infix operators, type 2: ..


 .. :
    description:
        ket1 .. ket2
        return the value of range(ket1, ket2)
        ie, return the superposition of ket1, ket1 + 1, ket1 + 2, ... , ket2
        we do our best to preserve categories
        if you require step size other than 1, then you need to use the range(start, stop, step) function
        note, the result is a superposition, not a sequence
        if you require a sequence, either use sp2seq or srange()
        if the kets are 2D then return a corresponding 2D patch

    examples:
        -- a simple range:
        |2> .. |7>
            |2> + |3> + |4> + |5> + |6> + |7>

        -- a 2D range:
        |0: 0> .. |2: 2>
            |0: 0> + |0: 1> + |0: 2> + |1: 0> + |1: 1> + |1: 2> + |2: 0> + |2: 1> + |2: 2>

        -- making use of compile and range(), we can also define a range operator for kets:
        range |*> #=> compile (|op: range> . |> . ssplit[" .. "] |_self>)

        -- now apply it, without an explicit step:
        range |3 .. 6>
            |3> + |4> + |5> + |6>

        -- now apply it with an explicit step:
        range |3 .. 5 .. 0.5>
            |3> + |3.5> + |4> + |4.5> + |5>

    see also:
        range, srange, sp2seq, compile, ssplit, display-grid

Home