Sequences
A sequence is an ordered aggregate that contains a series of expressions that are evaluated upon invocation. The =>
operator can be used to attach a lefthand parameter pattern to a righthand sequence expression. This is known as a Routine. When invoking a routine, any arguments provided are passed through the pattern which will either fail due to not fulfilling the pattern's features or will gain contextual containers that are then in-scope for the sequence's body of expressions.
#
How to...#
create a sequence#
create a sequence with positional parameters#
invoke a sequenceThe (2 + 4)
sequence is eagerly invoked by the +
operator.
#
invoke with argumentsIf a parentheses-less invocation becomes ambiguous, you can use a ;
to terminate.
#
convert to a routine#
declare a routineYou can declare a routine the same way you convert, by supplying a lefthand pattern and a righthand sequence to the =>
operator.
#
OperatorsBinary and unary operations that act specifically on Sequences.
->
#
This operator will do several difference types of transformations depending on the receiver. In the case of being received by a sequence, the supplying sequence is provided as arguments to the receiving sequence. In the case of being received by a pattern, the supplying sequence is tested against the pattern to determine if it matches.
#
ExamplesThe |-|
builtin container is for input and output and in this case, it prints whatever value is provided to it to the STDOUT.
<-
#
Take the receiving values as arguments to an invocation of the sequence.
#
Examples+
Invokes any sequence provided as an argument to the +
operator.
#
Examples==
#
Invokes any sequence provided as an argument to the ==
operator.
#
Examples<>
#
Invokes any sequence provided as an argument to the <>
operator.
#
Examples>>
#
Invokes any sequence provided as an argument to the >>
operator.
#
Examples<<
#
Invokes any sequence provided as an argument to the <<
operator.
#
Examples>=
#
Invokes any sequence provided as an argument to the >=
operator.
#
Examples<=
#
Invokes any sequence provided as an argument to the <=
operator.
#
Examples***
#
Invoke the sequence as many times as indicated by the other operand.
#
Examples#
Method OperatorsMethod operations that are performed on Sequence containers. Since they are accessing the internal table of each container, they use the table postcircumfix delimiters [...]
.
[+]
#
Add a new routine to the container
#
Examples[:]
#
Clone the container of sequences
#
Examples[_:]
#
Cloned table of all parameter patterns
#
Examples[?]
#
Check for a matching parameter pattern
#
Examples[-]
#
Change a routine by looking up it's parameter pattern
#
Examples[@]
#
Count of how many routines are contained