misc: |_self>


|_self>:
    description:
        |_self>
        the self ket
        given a learn rule: op ket => sequence
        |_self> is set to the value of ket at invoke time
        needed because it is not always clear at definition time what that ket is going to be
        the most common use case is label descent, where we use |*>, or |category: *>
        a rarer use case is when we have learn rules of form: op indirect-sp => sequence

    examples:
        -- family-relations.sw3 is full of examples where |*> and |_self> are used.
        -- for example, let's just pick the aunt rule:
        aunt |*> #=> sister parent |_self>
        -- this reads as, for aunt applied to any type of ket, return "sister parent" applied to that input ket
        -- so for example, aunt |Mary>, returns "sister parent |Mary>"

        -- plural.sw3 is another example where |*> and |_self> are used.
        -- for example, the general rules for plural are append s to the input ket
        -- and inverse-plural is remove the s suffix:
        plural |*> #=> |_self> _ |s>
        inverse-plural |*> #=> remove-suffix["s"] |_self>

        -- though |*> rules have lower precedence than explicit rules
        -- so we can define irregular plurals using:
        plural |mouse> => |mice>
        plural |tooth> => |teeth>
        plural |foot> => |feet>
        plural |radius> => |radii>
        plural |matrix> => |matrices>

    see also:
        |*>, family-relations.sw3, plural.sw3

Home