misc: |>
|>:
description:
|>
the empty ket
any time an op|ket> pair is invoked, and they are not defined, then the empty ket is returned
any operator or function where the input doesn't make sense, the empty ket is usually returned
it is the identity element for superposition addition: sp + |> == |> + sp == sp
it is the identity element for ket merge: |label> _ |> == |> _ |label> == |label>
it is the identity element for ket colon merge: |label> :_ |> == |> :_ |label> == |label>
there is a special operator the do-you-know operator, that returns |no> if applied to the empty ket, |yes> otherwise
sometimes used with value-if() to return a default value if the computation fails
to remove empty kets from a sequence, use the sdrop operator
in the context of a superposition being a list, |> is the equivalent of the empty list
examples:
do-you-know |>
|no>
do-you-know |something ...>
|yes>
-- the range operator:
-- if applied to a valid range ket, then return that range, else return the ket unchanged
range |*> #=>
the |result> => compile (|op: range> . |> . ssplit[" .. "] |__self>)
value-if( do-you-know the |result>, the |result>, |__self>)
-- now apply it:
range (|fish> . |3 .. 5> . |apples> . |books> . |2 .. 3 .. 0.25> . |house>)
|fish> . |3> + |4> + |5> . |apples> . |books> . |2> + |2.25> + |2.5> + |2.75> + |3> . |house>
see also:
do-you-know, drop, sdrop, value-if
Home