function 1: read


read:
    description:
        read(positions) superposition
        replace positions with their index in the input superposition
        if the input is a sequence, then apply this operator for each sub-superposition
        index values start from 1, not 0
        negative values are also valid, so -1 is last element, -2 is second last element, etc
        if out of range, or not a number, return |> for that slot

    examples:
        -- a simple abstract example:
        read(|1> + |3> + |5>) (|one> + |two> + |three> + |four> + |five> + |six> + |seven>)
            |one> + |three> + |five>

        -- negative indices example:
        read(|-1> + |-3> + |-5>) (|one> + |two> + |three> + |four> + |five> + |six> + |seven>)
            |seven> + |five> + |three>

        -- if out of range, or not a number, return |> for that slot:
        read(|1> + |fish> + |11> + |4>) (|one> + |two> + |three> + |four> + |five> + |six> + |seven>)
            |one> + |four>

    see also:
        not-read, sread, not-sread

Home