misc: |__self>


|__self>:
    description:
        |__self>
        |__selfk>
        the multi-line self ket
        for anonymous and multi-line functions or multi-line operators, input parameters are bound to their respective multi-line self-ket
        where k is a positive integer
        this notation is now partially deprecated in favour of bound functions

    examples:
        -- define an operator, that accesses elements one ket at a time:
        op |*> #=>
            sprint["input: "] |__self0>
            sprint["one: "] |__self1>
            |return var>

        -- define a function that accesses the entire sequence, instead of ket-wise:
        fn (*) #=>
            sprint["input: "] |__self0>
            sprint["one: "] |__self1>
            |return var>


        -- now invoke them:
        -- noting that op was invoked 3 times, one for each ket in the input, while fn was invoked only once.
        sa: op rank split |abc>

            input: |__self0>
            one: |a>
            input: |__self0>
            one: 2|b>
            input: |__self0>
            one: 3|c>
            3|return var>

        sa: fn rank split |abc>

            input: |>
            one: |a> + 2|b> + 3|c>
            |return var>

    see also:
        (*,*), |*>, |_self>

Home