Node:Selection, Next:Truncation, Previous:Indexing, Up:Sequences
The where
operator is used to select specified elements
of a sequence:
Q where B | Function |
Here Q is a sequence of values, and B is a sequence of conditions. The result is those elements of Q whose corresponding element of B is true. |
As a convenience, if an element of B is a function
it is first applied with the corresponding element of Q as
left argument. For example:
Q where {F x}
== Q where {Q? F x}
.
As usual, if either argument is not a sequence, it is extended to a sequence. Thus the following selects the positive element of Q:
Q where (> 0)since it is the same as
Q where {> 0}
, which is the same
as Q where {Q? > 0}
.
The result of a where
is a lazy sequence. (??).