☰
option
option
Type Parameters
Functions
absolute value
synonym for infix >>=
collect the contents of this Sequence into an array
create an array backed version of this sequence in case this is not array
backed. This will ensure that operations like index[] or drop perform
in constant time.
returns Sequence.this if is_array_backed.
converts switch into a list of either a single element in case
switch.this.exists or `nil`otherwise
convert this switch to an option
convert this switch to an outcome
convert this switch to an outcome
convenience feature to work around type inference issues
NYI remove when type inference gets better
create a string representation of this Sequence including all the string
representations of its contents, separated by 'sep'.
NOTE: In case this Sequence is not finite, this will attempt to create an
infinitely long string resulting in failure due to resource exchaustion.
converts option to a string
returns the result of $T for an option containing an instance
of T, alternatively returns $nil for an option that is nil.
create a string representation of this Sequence including all the string
representations of its contents, separated by ", " and enclosed in '['
and ']'.
NOTE: In case this Sequence is not finite, this will attempt to create an
infinitely long string resulting in failure due to resource exchaustion.
call 'as_string' on the elements
the arithmetic mean of the sequence
https://en.wikipedia.org/wiki/Arithmetic_mean
create a new list that contains the first elements of
this Sequence for which 'f e' is false
monadic operator
Same as non-generic >>=, but also maps to a different type B.
chop this Sequence into chunks of `chunk_size`.
the last chunk may be smaller than `chunk_size`.
§create a new Sequence from the result of applying 'f' to the
elements all combinations of elements of this Sequence and
all elements of 'b' iterating of 'b' repeatedly as follows
Sequence.this[0] , b[0]
Sequence.this[0] , b[1]
Sequence.this[0] , b[2]
Sequence.this[0] , ...
Sequence.this[0] , b.last
Sequence.this[1] , b[0]
Sequence.this[1] , b[1]
Sequence.this[1] , ...
... , ...
Sequence.this.last, b.last
create a Sequence that consists of all the elements of this Sequence followed
by all the elements of s
does the Sequence contain element x?
count the number of elements in this Sequence. Note that this typically
runs forever if executed on an endless list
For lists that are not array backed, this might require time in O(count).
get the number of non-overlapping matches of l within this
get the number of matches of l
create a list that repeats the current Sequence indefinitely. In case 'Sequence.this'
is empty, returns 'nil'
create a list that consists of the elements of this Sequence except the first
n elements
NOTE: this may have performance in O(n) unless it is backed by an immutable array.
Lazily drop the first elements of this Sequence for which predicate 'p' holds.
Get the dynamic type of this instance. For value instances `x`, this is
equal to `type_of x`, but for `x` with a `ref` type `x.dynamic_type` gives
the actual runtime type, while `type_of x` results in the static
compile-time type.
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types. So for Type values, dynamic_type is redefined
to just return Type.type.
the euclidean norm of this sequence
i.e. the square of the sum of squares of this sequence
Does this switch contain a value of type A?
filter elements using predicate f
values for which f is false are dropped
get the index of pattern within this Sequence or nil if it does not exist
uses the Knuth-Morris-Pratt algorithm
port of racket code from this paper:
https://www.cambridge.org/core/services/aop-cambridge-core/content/view/8EFA77D663D585B68630E372BCE1EBA4/S0956796824000017a.pdf/knuth-morris-pratt-illustrated.pdf
worst-case performance: O( seq_length ) + O( pattern_length )
worst-case space complexity: O( pattern_length )
is this sequence known to be finite? For infinite sequences, features like
count diverge.
TRUE = known finite
FALSE = known infinite
nil = unknown
get the first element of this Sequence
get the first element of this Sequence or default if sequence is empty
map each element of this Sequence to Sequence
Then flatten the result by one level,
essentially combining all the sequences.
fold the elements of this Sequence using the given monoid.
e.g., to sum the elements of a Sequence of i32, use s.fold i32.sum
fold the elements of this non-empty Sequence using the given function
e.g., to find the minimum of a Sequence of i32, use `s.fold1 (<=)`
fold the elements of this Sequence using the given function and initial
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
Type Parameters
Functions
absolute value
synonym for infix >>=
collect the contents of this Sequence into an array
create an array backed version of this sequence in case this is not array
backed. This will ensure that operations like index[] or drop perform
in constant time.
returns Sequence.this if is_array_backed.
converts switch into a list of either a single element in case
switch.this.exists or `nil`otherwise
convert this switch to an option
convert this switch to an outcome
convert this switch to an outcome
convenience feature to work around type inference issues
NYI remove when type inference gets better
create a string representation of this Sequence including all the string
representations of its contents, separated by 'sep'.
NOTE: In case this Sequence is not finite, this will attempt to create an
infinitely long string resulting in failure due to resource exchaustion.
converts option to a string
returns the result of $T for an option containing an instance
of T, alternatively returns $nil for an option that is nil.
create a string representation of this Sequence including all the string
representations of its contents, separated by ", " and enclosed in '['
and ']'.
NOTE: In case this Sequence is not finite, this will attempt to create an
infinitely long string resulting in failure due to resource exchaustion.
call 'as_string' on the elements
the arithmetic mean of the sequence
https://en.wikipedia.org/wiki/Arithmetic_mean
create a new list that contains the first elements of
this Sequence for which 'f e' is false
monadic operator
Same as non-generic >>=, but also maps to a different type B.
chop this Sequence into chunks of `chunk_size`.
the last chunk may be smaller than `chunk_size`.
§create a new Sequence from the result of applying 'f' to the
elements all combinations of elements of this Sequence and
all elements of 'b' iterating of 'b' repeatedly as follows
Sequence.this[0] , b[0]
Sequence.this[0] , b[1]
Sequence.this[0] , b[2]
Sequence.this[0] , ...
Sequence.this[0] , b.last
Sequence.this[1] , b[0]
Sequence.this[1] , b[1]
Sequence.this[1] , ...
... , ...
Sequence.this.last, b.last
create a Sequence that consists of all the elements of this Sequence followed
by all the elements of s
does the Sequence contain element x?
count the number of elements in this Sequence. Note that this typically
runs forever if executed on an endless list
For lists that are not array backed, this might require time in O(count).
get the number of non-overlapping matches of l within this
get the number of matches of l
create a list that repeats the current Sequence indefinitely. In case 'Sequence.this'
is empty, returns 'nil'
create a list that consists of the elements of this Sequence except the first
n elements
NOTE: this may have performance in O(n) unless it is backed by an immutable array.
Lazily drop the first elements of this Sequence for which predicate 'p' holds.
Get the dynamic type of this instance. For value instances `x`, this is
equal to `type_of x`, but for `x` with a `ref` type `x.dynamic_type` gives
the actual runtime type, while `type_of x` results in the static
compile-time type.
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types. So for Type values, dynamic_type is redefined
to just return Type.type.
the euclidean norm of this sequence
i.e. the square of the sum of squares of this sequence
Does this switch contain a value of type A?
filter elements using predicate f
values for which f is false are dropped
get the index of pattern within this Sequence or nil if it does not exist
uses the Knuth-Morris-Pratt algorithm
port of racket code from this paper:
https://www.cambridge.org/core/services/aop-cambridge-core/content/view/8EFA77D663D585B68630E372BCE1EBA4/S0956796824000017a.pdf/knuth-morris-pratt-illustrated.pdf
worst-case performance: O( seq_length ) + O( pattern_length )
worst-case space complexity: O( pattern_length )
is this sequence known to be finite? For infinite sequences, features like
count diverge.
TRUE = known finite
FALSE = known infinite
nil = unknown
get the first element of this Sequence
get the first element of this Sequence or default if sequence is empty
map each element of this Sequence to Sequence
Then flatten the result by one level,
essentially combining all the sequences.
fold the elements of this Sequence using the given monoid.
e.g., to sum the elements of a Sequence of i32, use s.fold i32.sum
fold the elements of this non-empty Sequence using the given function
e.g., to find the minimum of a Sequence of i32, use `s.fold1 (<=)`
fold the elements of this Sequence using the given function and initial
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
Functions
absolute value
synonym for infix >>=
collect the contents of this Sequence into an array
create an array backed version of this sequence in case this is not array
backed. This will ensure that operations like index[] or drop perform
in constant time.
returns Sequence.this if is_array_backed.
converts switch into a list of either a single element in case
switch.this.exists or `nil`otherwise
convert this switch to an option
convert this switch to an outcome
convert this switch to an outcome
convenience feature to work around type inference issues
NYI remove when type inference gets better
create a string representation of this Sequence including all the string
representations of its contents, separated by 'sep'.
NOTE: In case this Sequence is not finite, this will attempt to create an
infinitely long string resulting in failure due to resource exchaustion.
converts option to a string
returns the result of $T for an option containing an instance
of T, alternatively returns $nil for an option that is nil.
create a string representation of this Sequence including all the string
representations of its contents, separated by ", " and enclosed in '['
and ']'.
NOTE: In case this Sequence is not finite, this will attempt to create an
infinitely long string resulting in failure due to resource exchaustion.
call 'as_string' on the elements
the arithmetic mean of the sequence
https://en.wikipedia.org/wiki/Arithmetic_mean
create a new list that contains the first elements of
this Sequence for which 'f e' is false
monadic operator
Same as non-generic >>=, but also maps to a different type B.
chop this Sequence into chunks of `chunk_size`.
the last chunk may be smaller than `chunk_size`.
§create a new Sequence from the result of applying 'f' to the
elements all combinations of elements of this Sequence and
all elements of 'b' iterating of 'b' repeatedly as follows
Sequence.this[0] , b[0]
Sequence.this[0] , b[1]
Sequence.this[0] , b[2]
Sequence.this[0] , ...
Sequence.this[0] , b.last
Sequence.this[1] , b[0]
Sequence.this[1] , b[1]
Sequence.this[1] , ...
... , ...
Sequence.this.last, b.last
create a Sequence that consists of all the elements of this Sequence followed
by all the elements of s
does the Sequence contain element x?
count the number of elements in this Sequence. Note that this typically
runs forever if executed on an endless list
For lists that are not array backed, this might require time in O(count).
get the number of non-overlapping matches of l within this
get the number of matches of l
create a list that repeats the current Sequence indefinitely. In case 'Sequence.this'
is empty, returns 'nil'
create a list that consists of the elements of this Sequence except the first
n elements
NOTE: this may have performance in O(n) unless it is backed by an immutable array.
Lazily drop the first elements of this Sequence for which predicate 'p' holds.
Get the dynamic type of this instance. For value instances `x`, this is
equal to `type_of x`, but for `x` with a `ref` type `x.dynamic_type` gives
the actual runtime type, while `type_of x` results in the static
compile-time type.
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types. So for Type values, dynamic_type is redefined
to just return Type.type.
the euclidean norm of this sequence
i.e. the square of the sum of squares of this sequence
Does this switch contain a value of type A?
filter elements using predicate f
values for which f is false are dropped
get the index of pattern within this Sequence or nil if it does not exist
uses the Knuth-Morris-Pratt algorithm
port of racket code from this paper:
https://www.cambridge.org/core/services/aop-cambridge-core/content/view/8EFA77D663D585B68630E372BCE1EBA4/S0956796824000017a.pdf/knuth-morris-pratt-illustrated.pdf
worst-case performance: O( seq_length ) + O( pattern_length )
worst-case space complexity: O( pattern_length )
is this sequence known to be finite? For infinite sequences, features like
count diverge.
TRUE = known finite
FALSE = known infinite
nil = unknown
get the first element of this Sequence
get the first element of this Sequence or default if sequence is empty
map each element of this Sequence to Sequence
Then flatten the result by one level,
essentially combining all the sequences.
fold the elements of this Sequence using the given monoid.
e.g., to sum the elements of a Sequence of i32, use s.fold i32.sum
fold the elements of this non-empty Sequence using the given function
e.g., to find the minimum of a Sequence of i32, use `s.fold1 (<=)`
fold the elements of this Sequence using the given function and initial
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
absolute value
synonym for infix >>=
collect the contents of this Sequence into an array
create an array backed version of this sequence in case this is not array
backed. This will ensure that operations like index[] or drop perform
in constant time.
returns Sequence.this if is_array_backed.
converts switch into a list of either a single element in case
switch.this.exists or `nil`otherwise
convert this switch to an option
convert this switch to an outcome
convert this switch to an outcome
convenience feature to work around type inference issues
NYI remove when type inference gets better
create a string representation of this Sequence including all the string
representations of its contents, separated by 'sep'.
NOTE: In case this Sequence is not finite, this will attempt to create an
infinitely long string resulting in failure due to resource exchaustion.
converts option to a string
returns the result of $T for an option containing an instance
of T, alternatively returns $nil for an option that is nil.
create a string representation of this Sequence including all the string
representations of its contents, separated by ", " and enclosed in '['
and ']'.
NOTE: In case this Sequence is not finite, this will attempt to create an
infinitely long string resulting in failure due to resource exchaustion.
call 'as_string' on the elements
the arithmetic mean of the sequence
https://en.wikipedia.org/wiki/Arithmetic_mean
create a new list that contains the first elements of
this Sequence for which 'f e' is false
monadic operator
Same as non-generic >>=, but also maps to a different type B.
chop this Sequence into chunks of `chunk_size`.
the last chunk may be smaller than `chunk_size`.
§create a new Sequence from the result of applying 'f' to the
elements all combinations of elements of this Sequence and
all elements of 'b' iterating of 'b' repeatedly as follows
Sequence.this[0] , b[0]
Sequence.this[0] , b[1]
Sequence.this[0] , b[2]
Sequence.this[0] , ...
Sequence.this[0] , b.last
Sequence.this[1] , b[0]
Sequence.this[1] , b[1]
Sequence.this[1] , ...
... , ...
Sequence.this.last, b.last
create a Sequence that consists of all the elements of this Sequence followed
by all the elements of s
does the Sequence contain element x?
count the number of elements in this Sequence. Note that this typically
runs forever if executed on an endless list
For lists that are not array backed, this might require time in O(count).
get the number of non-overlapping matches of l within this
get the number of matches of l
create a list that repeats the current Sequence indefinitely. In case 'Sequence.this'
is empty, returns 'nil'
create a list that consists of the elements of this Sequence except the first
n elements
NOTE: this may have performance in O(n) unless it is backed by an immutable array.
Lazily drop the first elements of this Sequence for which predicate 'p' holds.
Get the dynamic type of this instance. For value instances `x`, this is
equal to `type_of x`, but for `x` with a `ref` type `x.dynamic_type` gives
the actual runtime type, while `type_of x` results in the static
compile-time type.
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types. So for Type values, dynamic_type is redefined
to just return Type.type.
the euclidean norm of this sequence
i.e. the square of the sum of squares of this sequence
Does this switch contain a value of type A?
filter elements using predicate f
values for which f is false are dropped
get the index of pattern within this Sequence or nil if it does not exist
uses the Knuth-Morris-Pratt algorithm
port of racket code from this paper:
https://www.cambridge.org/core/services/aop-cambridge-core/content/view/8EFA77D663D585B68630E372BCE1EBA4/S0956796824000017a.pdf/knuth-morris-pratt-illustrated.pdf
worst-case performance: O( seq_length ) + O( pattern_length )
worst-case space complexity: O( pattern_length )
is this sequence known to be finite? For infinite sequences, features like
count diverge.
TRUE = known finite
FALSE = known infinite
nil = unknown
get the first element of this Sequence
get the first element of this Sequence or default if sequence is empty
map each element of this Sequence to Sequence
Then flatten the result by one level,
essentially combining all the sequences.
fold the elements of this Sequence using the given monoid.
e.g., to sum the elements of a Sequence of i32, use s.fold i32.sum
fold the elements of this non-empty Sequence using the given function
e.g., to find the minimum of a Sequence of i32, use `s.fold1 (<=)`
fold the elements of this Sequence using the given function and initial
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
synonym for infix >>=
collect the contents of this Sequence into an array
create an array backed version of this sequence in case this is not array
backed. This will ensure that operations like index[] or drop perform
in constant time.
returns Sequence.this if is_array_backed.
converts switch into a list of either a single element in case
switch.this.exists or `nil`otherwise
convert this switch to an option
convert this switch to an outcome
convert this switch to an outcome
convenience feature to work around type inference issues
NYI remove when type inference gets better
create a string representation of this Sequence including all the string
representations of its contents, separated by 'sep'.
NOTE: In case this Sequence is not finite, this will attempt to create an
infinitely long string resulting in failure due to resource exchaustion.
converts option to a string
returns the result of $T for an option containing an instance
of T, alternatively returns $nil for an option that is nil.
create a string representation of this Sequence including all the string
representations of its contents, separated by ", " and enclosed in '['
and ']'.
NOTE: In case this Sequence is not finite, this will attempt to create an
infinitely long string resulting in failure due to resource exchaustion.
call 'as_string' on the elements
the arithmetic mean of the sequence
https://en.wikipedia.org/wiki/Arithmetic_mean
create a new list that contains the first elements of
this Sequence for which 'f e' is false
monadic operator
Same as non-generic >>=, but also maps to a different type B.
chop this Sequence into chunks of `chunk_size`.
the last chunk may be smaller than `chunk_size`.
§create a new Sequence from the result of applying 'f' to the
elements all combinations of elements of this Sequence and
all elements of 'b' iterating of 'b' repeatedly as follows
Sequence.this[0] , b[0]
Sequence.this[0] , b[1]
Sequence.this[0] , b[2]
Sequence.this[0] , ...
Sequence.this[0] , b.last
Sequence.this[1] , b[0]
Sequence.this[1] , b[1]
Sequence.this[1] , ...
... , ...
Sequence.this.last, b.last
create a Sequence that consists of all the elements of this Sequence followed
by all the elements of s
does the Sequence contain element x?
count the number of elements in this Sequence. Note that this typically
runs forever if executed on an endless list
For lists that are not array backed, this might require time in O(count).
get the number of non-overlapping matches of l within this
get the number of matches of l
create a list that repeats the current Sequence indefinitely. In case 'Sequence.this'
is empty, returns 'nil'
create a list that consists of the elements of this Sequence except the first
n elements
NOTE: this may have performance in O(n) unless it is backed by an immutable array.
Lazily drop the first elements of this Sequence for which predicate 'p' holds.
Get the dynamic type of this instance. For value instances `x`, this is
equal to `type_of x`, but for `x` with a `ref` type `x.dynamic_type` gives
the actual runtime type, while `type_of x` results in the static
compile-time type.
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types. So for Type values, dynamic_type is redefined
to just return Type.type.
the euclidean norm of this sequence
i.e. the square of the sum of squares of this sequence
Does this switch contain a value of type A?
filter elements using predicate f
values for which f is false are dropped
get the index of pattern within this Sequence or nil if it does not exist
uses the Knuth-Morris-Pratt algorithm
port of racket code from this paper:
https://www.cambridge.org/core/services/aop-cambridge-core/content/view/8EFA77D663D585B68630E372BCE1EBA4/S0956796824000017a.pdf/knuth-morris-pratt-illustrated.pdf
worst-case performance: O( seq_length ) + O( pattern_length )
worst-case space complexity: O( pattern_length )
is this sequence known to be finite? For infinite sequences, features like
count diverge.
TRUE = known finite
FALSE = known infinite
nil = unknown
get the first element of this Sequence
get the first element of this Sequence or default if sequence is empty
map each element of this Sequence to Sequence
Then flatten the result by one level,
essentially combining all the sequences.
fold the elements of this Sequence using the given monoid.
e.g., to sum the elements of a Sequence of i32, use s.fold i32.sum
fold the elements of this non-empty Sequence using the given function
e.g., to find the minimum of a Sequence of i32, use `s.fold1 (<=)`
fold the elements of this Sequence using the given function and initial
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
collect the contents of this Sequence into an array
create an array backed version of this sequence in case this is not array
backed. This will ensure that operations like index[] or drop perform
in constant time.
returns Sequence.this if is_array_backed.
converts switch into a list of either a single element in case
switch.this.exists or `nil`otherwise
convert this switch to an option
convert this switch to an outcome
convert this switch to an outcome
convenience feature to work around type inference issues
NYI remove when type inference gets better
create a string representation of this Sequence including all the string
representations of its contents, separated by 'sep'.
NOTE: In case this Sequence is not finite, this will attempt to create an
infinitely long string resulting in failure due to resource exchaustion.
converts option to a string
returns the result of $T for an option containing an instance
of T, alternatively returns $nil for an option that is nil.
create a string representation of this Sequence including all the string
representations of its contents, separated by ", " and enclosed in '['
and ']'.
NOTE: In case this Sequence is not finite, this will attempt to create an
infinitely long string resulting in failure due to resource exchaustion.
call 'as_string' on the elements
the arithmetic mean of the sequence
https://en.wikipedia.org/wiki/Arithmetic_mean
create a new list that contains the first elements of
this Sequence for which 'f e' is false
monadic operator
Same as non-generic >>=, but also maps to a different type B.
chop this Sequence into chunks of `chunk_size`.
the last chunk may be smaller than `chunk_size`.
§create a new Sequence from the result of applying 'f' to the
elements all combinations of elements of this Sequence and
all elements of 'b' iterating of 'b' repeatedly as follows
Sequence.this[0] , b[0]
Sequence.this[0] , b[1]
Sequence.this[0] , b[2]
Sequence.this[0] , ...
Sequence.this[0] , b.last
Sequence.this[1] , b[0]
Sequence.this[1] , b[1]
Sequence.this[1] , ...
... , ...
Sequence.this.last, b.last
create a Sequence that consists of all the elements of this Sequence followed
by all the elements of s
does the Sequence contain element x?
count the number of elements in this Sequence. Note that this typically
runs forever if executed on an endless list
For lists that are not array backed, this might require time in O(count).
get the number of non-overlapping matches of l within this
get the number of matches of l
create a list that repeats the current Sequence indefinitely. In case 'Sequence.this'
is empty, returns 'nil'
create a list that consists of the elements of this Sequence except the first
n elements
NOTE: this may have performance in O(n) unless it is backed by an immutable array.
Lazily drop the first elements of this Sequence for which predicate 'p' holds.
Get the dynamic type of this instance. For value instances `x`, this is
equal to `type_of x`, but for `x` with a `ref` type `x.dynamic_type` gives
the actual runtime type, while `type_of x` results in the static
compile-time type.
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types. So for Type values, dynamic_type is redefined
to just return Type.type.
the euclidean norm of this sequence
i.e. the square of the sum of squares of this sequence
Does this switch contain a value of type A?
filter elements using predicate f
values for which f is false are dropped
get the index of pattern within this Sequence or nil if it does not exist
uses the Knuth-Morris-Pratt algorithm
port of racket code from this paper:
https://www.cambridge.org/core/services/aop-cambridge-core/content/view/8EFA77D663D585B68630E372BCE1EBA4/S0956796824000017a.pdf/knuth-morris-pratt-illustrated.pdf
worst-case performance: O( seq_length ) + O( pattern_length )
worst-case space complexity: O( pattern_length )
is this sequence known to be finite? For infinite sequences, features like
count diverge.
TRUE = known finite
FALSE = known infinite
nil = unknown
get the first element of this Sequence
get the first element of this Sequence or default if sequence is empty
map each element of this Sequence to Sequence
Then flatten the result by one level,
essentially combining all the sequences.
fold the elements of this Sequence using the given monoid.
e.g., to sum the elements of a Sequence of i32, use s.fold i32.sum
fold the elements of this non-empty Sequence using the given function
e.g., to find the minimum of a Sequence of i32, use `s.fold1 (<=)`
fold the elements of this Sequence using the given function and initial
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
create an array backed version of this sequence in case this is not array
backed. This will ensure that operations like index[] or drop perform
in constant time.
returns Sequence.this if is_array_backed.
backed. This will ensure that operations like index[] or drop perform
in constant time.
returns Sequence.this if is_array_backed.
converts switch into a list of either a single element in case
switch.this.exists or `nil`otherwise
convert this switch to an option
convert this switch to an outcome
convert this switch to an outcome
convenience feature to work around type inference issues
NYI remove when type inference gets better
create a string representation of this Sequence including all the string
representations of its contents, separated by 'sep'.
NOTE: In case this Sequence is not finite, this will attempt to create an
infinitely long string resulting in failure due to resource exchaustion.
converts option to a string
returns the result of $T for an option containing an instance
of T, alternatively returns $nil for an option that is nil.
create a string representation of this Sequence including all the string
representations of its contents, separated by ", " and enclosed in '['
and ']'.
NOTE: In case this Sequence is not finite, this will attempt to create an
infinitely long string resulting in failure due to resource exchaustion.
call 'as_string' on the elements
the arithmetic mean of the sequence
https://en.wikipedia.org/wiki/Arithmetic_mean
create a new list that contains the first elements of
this Sequence for which 'f e' is false
monadic operator
Same as non-generic >>=, but also maps to a different type B.
chop this Sequence into chunks of `chunk_size`.
the last chunk may be smaller than `chunk_size`.
§create a new Sequence from the result of applying 'f' to the
elements all combinations of elements of this Sequence and
all elements of 'b' iterating of 'b' repeatedly as follows
Sequence.this[0] , b[0]
Sequence.this[0] , b[1]
Sequence.this[0] , b[2]
Sequence.this[0] , ...
Sequence.this[0] , b.last
Sequence.this[1] , b[0]
Sequence.this[1] , b[1]
Sequence.this[1] , ...
... , ...
Sequence.this.last, b.last
create a Sequence that consists of all the elements of this Sequence followed
by all the elements of s
does the Sequence contain element x?
count the number of elements in this Sequence. Note that this typically
runs forever if executed on an endless list
For lists that are not array backed, this might require time in O(count).
get the number of non-overlapping matches of l within this
get the number of matches of l
create a list that repeats the current Sequence indefinitely. In case 'Sequence.this'
is empty, returns 'nil'
create a list that consists of the elements of this Sequence except the first
n elements
NOTE: this may have performance in O(n) unless it is backed by an immutable array.
Lazily drop the first elements of this Sequence for which predicate 'p' holds.
Get the dynamic type of this instance. For value instances `x`, this is
equal to `type_of x`, but for `x` with a `ref` type `x.dynamic_type` gives
the actual runtime type, while `type_of x` results in the static
compile-time type.
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types. So for Type values, dynamic_type is redefined
to just return Type.type.
the euclidean norm of this sequence
i.e. the square of the sum of squares of this sequence
Does this switch contain a value of type A?
filter elements using predicate f
values for which f is false are dropped
get the index of pattern within this Sequence or nil if it does not exist
uses the Knuth-Morris-Pratt algorithm
port of racket code from this paper:
https://www.cambridge.org/core/services/aop-cambridge-core/content/view/8EFA77D663D585B68630E372BCE1EBA4/S0956796824000017a.pdf/knuth-morris-pratt-illustrated.pdf
worst-case performance: O( seq_length ) + O( pattern_length )
worst-case space complexity: O( pattern_length )
is this sequence known to be finite? For infinite sequences, features like
count diverge.
TRUE = known finite
FALSE = known infinite
nil = unknown
get the first element of this Sequence
get the first element of this Sequence or default if sequence is empty
map each element of this Sequence to Sequence
Then flatten the result by one level,
essentially combining all the sequences.
fold the elements of this Sequence using the given monoid.
e.g., to sum the elements of a Sequence of i32, use s.fold i32.sum
fold the elements of this non-empty Sequence using the given function
e.g., to find the minimum of a Sequence of i32, use `s.fold1 (<=)`
fold the elements of this Sequence using the given function and initial
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
converts switch into a list of either a single element in case
switch.this.exists or `nil`otherwise
switch.this.exists or `nil`otherwise
convert this switch to an option
convert this switch to an outcome
convert this switch to an outcome
convenience feature to work around type inference issues
NYI remove when type inference gets better
create a string representation of this Sequence including all the string
representations of its contents, separated by 'sep'.
NOTE: In case this Sequence is not finite, this will attempt to create an
infinitely long string resulting in failure due to resource exchaustion.
converts option to a string
returns the result of $T for an option containing an instance
of T, alternatively returns $nil for an option that is nil.
create a string representation of this Sequence including all the string
representations of its contents, separated by ", " and enclosed in '['
and ']'.
NOTE: In case this Sequence is not finite, this will attempt to create an
infinitely long string resulting in failure due to resource exchaustion.
call 'as_string' on the elements
the arithmetic mean of the sequence
https://en.wikipedia.org/wiki/Arithmetic_mean
create a new list that contains the first elements of
this Sequence for which 'f e' is false
monadic operator
Same as non-generic >>=, but also maps to a different type B.
chop this Sequence into chunks of `chunk_size`.
the last chunk may be smaller than `chunk_size`.
§create a new Sequence from the result of applying 'f' to the
elements all combinations of elements of this Sequence and
all elements of 'b' iterating of 'b' repeatedly as follows
Sequence.this[0] , b[0]
Sequence.this[0] , b[1]
Sequence.this[0] , b[2]
Sequence.this[0] , ...
Sequence.this[0] , b.last
Sequence.this[1] , b[0]
Sequence.this[1] , b[1]
Sequence.this[1] , ...
... , ...
Sequence.this.last, b.last
create a Sequence that consists of all the elements of this Sequence followed
by all the elements of s
does the Sequence contain element x?
count the number of elements in this Sequence. Note that this typically
runs forever if executed on an endless list
For lists that are not array backed, this might require time in O(count).
get the number of non-overlapping matches of l within this
get the number of matches of l
create a list that repeats the current Sequence indefinitely. In case 'Sequence.this'
is empty, returns 'nil'
create a list that consists of the elements of this Sequence except the first
n elements
NOTE: this may have performance in O(n) unless it is backed by an immutable array.
Lazily drop the first elements of this Sequence for which predicate 'p' holds.
Get the dynamic type of this instance. For value instances `x`, this is
equal to `type_of x`, but for `x` with a `ref` type `x.dynamic_type` gives
the actual runtime type, while `type_of x` results in the static
compile-time type.
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types. So for Type values, dynamic_type is redefined
to just return Type.type.
the euclidean norm of this sequence
i.e. the square of the sum of squares of this sequence
Does this switch contain a value of type A?
filter elements using predicate f
values for which f is false are dropped
get the index of pattern within this Sequence or nil if it does not exist
uses the Knuth-Morris-Pratt algorithm
port of racket code from this paper:
https://www.cambridge.org/core/services/aop-cambridge-core/content/view/8EFA77D663D585B68630E372BCE1EBA4/S0956796824000017a.pdf/knuth-morris-pratt-illustrated.pdf
worst-case performance: O( seq_length ) + O( pattern_length )
worst-case space complexity: O( pattern_length )
is this sequence known to be finite? For infinite sequences, features like
count diverge.
TRUE = known finite
FALSE = known infinite
nil = unknown
get the first element of this Sequence
get the first element of this Sequence or default if sequence is empty
map each element of this Sequence to Sequence
Then flatten the result by one level,
essentially combining all the sequences.
fold the elements of this Sequence using the given monoid.
e.g., to sum the elements of a Sequence of i32, use s.fold i32.sum
fold the elements of this non-empty Sequence using the given function
e.g., to find the minimum of a Sequence of i32, use `s.fold1 (<=)`
fold the elements of this Sequence using the given function and initial
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
convert this switch to an option
convert this switch to an outcome
convert this switch to an outcome
convenience feature to work around type inference issues
NYI remove when type inference gets better
create a string representation of this Sequence including all the string
representations of its contents, separated by 'sep'.
NOTE: In case this Sequence is not finite, this will attempt to create an
infinitely long string resulting in failure due to resource exchaustion.
converts option to a string
returns the result of $T for an option containing an instance
of T, alternatively returns $nil for an option that is nil.
create a string representation of this Sequence including all the string
representations of its contents, separated by ", " and enclosed in '['
and ']'.
NOTE: In case this Sequence is not finite, this will attempt to create an
infinitely long string resulting in failure due to resource exchaustion.
call 'as_string' on the elements
the arithmetic mean of the sequence
https://en.wikipedia.org/wiki/Arithmetic_mean
create a new list that contains the first elements of
this Sequence for which 'f e' is false
monadic operator
Same as non-generic >>=, but also maps to a different type B.
chop this Sequence into chunks of `chunk_size`.
the last chunk may be smaller than `chunk_size`.
§create a new Sequence from the result of applying 'f' to the
elements all combinations of elements of this Sequence and
all elements of 'b' iterating of 'b' repeatedly as follows
Sequence.this[0] , b[0]
Sequence.this[0] , b[1]
Sequence.this[0] , b[2]
Sequence.this[0] , ...
Sequence.this[0] , b.last
Sequence.this[1] , b[0]
Sequence.this[1] , b[1]
Sequence.this[1] , ...
... , ...
Sequence.this.last, b.last
create a Sequence that consists of all the elements of this Sequence followed
by all the elements of s
does the Sequence contain element x?
count the number of elements in this Sequence. Note that this typically
runs forever if executed on an endless list
For lists that are not array backed, this might require time in O(count).
get the number of non-overlapping matches of l within this
get the number of matches of l
create a list that repeats the current Sequence indefinitely. In case 'Sequence.this'
is empty, returns 'nil'
create a list that consists of the elements of this Sequence except the first
n elements
NOTE: this may have performance in O(n) unless it is backed by an immutable array.
Lazily drop the first elements of this Sequence for which predicate 'p' holds.
Get the dynamic type of this instance. For value instances `x`, this is
equal to `type_of x`, but for `x` with a `ref` type `x.dynamic_type` gives
the actual runtime type, while `type_of x` results in the static
compile-time type.
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types. So for Type values, dynamic_type is redefined
to just return Type.type.
the euclidean norm of this sequence
i.e. the square of the sum of squares of this sequence
Does this switch contain a value of type A?
filter elements using predicate f
values for which f is false are dropped
get the index of pattern within this Sequence or nil if it does not exist
uses the Knuth-Morris-Pratt algorithm
port of racket code from this paper:
https://www.cambridge.org/core/services/aop-cambridge-core/content/view/8EFA77D663D585B68630E372BCE1EBA4/S0956796824000017a.pdf/knuth-morris-pratt-illustrated.pdf
worst-case performance: O( seq_length ) + O( pattern_length )
worst-case space complexity: O( pattern_length )
is this sequence known to be finite? For infinite sequences, features like
count diverge.
TRUE = known finite
FALSE = known infinite
nil = unknown
get the first element of this Sequence
get the first element of this Sequence or default if sequence is empty
map each element of this Sequence to Sequence
Then flatten the result by one level,
essentially combining all the sequences.
fold the elements of this Sequence using the given monoid.
e.g., to sum the elements of a Sequence of i32, use s.fold i32.sum
fold the elements of this non-empty Sequence using the given function
e.g., to find the minimum of a Sequence of i32, use `s.fold1 (<=)`
fold the elements of this Sequence using the given function and initial
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
convert this switch to an outcome
convert this switch to an outcome
convenience feature to work around type inference issues
NYI remove when type inference gets better
create a string representation of this Sequence including all the string
representations of its contents, separated by 'sep'.
NOTE: In case this Sequence is not finite, this will attempt to create an
infinitely long string resulting in failure due to resource exchaustion.
converts option to a string
returns the result of $T for an option containing an instance
of T, alternatively returns $nil for an option that is nil.
create a string representation of this Sequence including all the string
representations of its contents, separated by ", " and enclosed in '['
and ']'.
NOTE: In case this Sequence is not finite, this will attempt to create an
infinitely long string resulting in failure due to resource exchaustion.
call 'as_string' on the elements
the arithmetic mean of the sequence
https://en.wikipedia.org/wiki/Arithmetic_mean
create a new list that contains the first elements of
this Sequence for which 'f e' is false
monadic operator
Same as non-generic >>=, but also maps to a different type B.
chop this Sequence into chunks of `chunk_size`.
the last chunk may be smaller than `chunk_size`.
§create a new Sequence from the result of applying 'f' to the
elements all combinations of elements of this Sequence and
all elements of 'b' iterating of 'b' repeatedly as follows
Sequence.this[0] , b[0]
Sequence.this[0] , b[1]
Sequence.this[0] , b[2]
Sequence.this[0] , ...
Sequence.this[0] , b.last
Sequence.this[1] , b[0]
Sequence.this[1] , b[1]
Sequence.this[1] , ...
... , ...
Sequence.this.last, b.last
create a Sequence that consists of all the elements of this Sequence followed
by all the elements of s
does the Sequence contain element x?
count the number of elements in this Sequence. Note that this typically
runs forever if executed on an endless list
For lists that are not array backed, this might require time in O(count).
get the number of non-overlapping matches of l within this
get the number of matches of l
create a list that repeats the current Sequence indefinitely. In case 'Sequence.this'
is empty, returns 'nil'
create a list that consists of the elements of this Sequence except the first
n elements
NOTE: this may have performance in O(n) unless it is backed by an immutable array.
Lazily drop the first elements of this Sequence for which predicate 'p' holds.
Get the dynamic type of this instance. For value instances `x`, this is
equal to `type_of x`, but for `x` with a `ref` type `x.dynamic_type` gives
the actual runtime type, while `type_of x` results in the static
compile-time type.
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types. So for Type values, dynamic_type is redefined
to just return Type.type.
the euclidean norm of this sequence
i.e. the square of the sum of squares of this sequence
Does this switch contain a value of type A?
filter elements using predicate f
values for which f is false are dropped
get the index of pattern within this Sequence or nil if it does not exist
uses the Knuth-Morris-Pratt algorithm
port of racket code from this paper:
https://www.cambridge.org/core/services/aop-cambridge-core/content/view/8EFA77D663D585B68630E372BCE1EBA4/S0956796824000017a.pdf/knuth-morris-pratt-illustrated.pdf
worst-case performance: O( seq_length ) + O( pattern_length )
worst-case space complexity: O( pattern_length )
is this sequence known to be finite? For infinite sequences, features like
count diverge.
TRUE = known finite
FALSE = known infinite
nil = unknown
get the first element of this Sequence
get the first element of this Sequence or default if sequence is empty
map each element of this Sequence to Sequence
Then flatten the result by one level,
essentially combining all the sequences.
fold the elements of this Sequence using the given monoid.
e.g., to sum the elements of a Sequence of i32, use s.fold i32.sum
fold the elements of this non-empty Sequence using the given function
e.g., to find the minimum of a Sequence of i32, use `s.fold1 (<=)`
fold the elements of this Sequence using the given function and initial
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
convert this switch to an outcome
convenience feature to work around type inference issues
NYI remove when type inference gets better
create a string representation of this Sequence including all the string
representations of its contents, separated by 'sep'.
NOTE: In case this Sequence is not finite, this will attempt to create an
infinitely long string resulting in failure due to resource exchaustion.
converts option to a string
returns the result of $T for an option containing an instance
of T, alternatively returns $nil for an option that is nil.
create a string representation of this Sequence including all the string
representations of its contents, separated by ", " and enclosed in '['
and ']'.
NOTE: In case this Sequence is not finite, this will attempt to create an
infinitely long string resulting in failure due to resource exchaustion.
call 'as_string' on the elements
the arithmetic mean of the sequence
https://en.wikipedia.org/wiki/Arithmetic_mean
create a new list that contains the first elements of
this Sequence for which 'f e' is false
monadic operator
Same as non-generic >>=, but also maps to a different type B.
chop this Sequence into chunks of `chunk_size`.
the last chunk may be smaller than `chunk_size`.
§create a new Sequence from the result of applying 'f' to the
elements all combinations of elements of this Sequence and
all elements of 'b' iterating of 'b' repeatedly as follows
Sequence.this[0] , b[0]
Sequence.this[0] , b[1]
Sequence.this[0] , b[2]
Sequence.this[0] , ...
Sequence.this[0] , b.last
Sequence.this[1] , b[0]
Sequence.this[1] , b[1]
Sequence.this[1] , ...
... , ...
Sequence.this.last, b.last
create a Sequence that consists of all the elements of this Sequence followed
by all the elements of s
does the Sequence contain element x?
count the number of elements in this Sequence. Note that this typically
runs forever if executed on an endless list
For lists that are not array backed, this might require time in O(count).
get the number of non-overlapping matches of l within this
get the number of matches of l
create a list that repeats the current Sequence indefinitely. In case 'Sequence.this'
is empty, returns 'nil'
create a list that consists of the elements of this Sequence except the first
n elements
NOTE: this may have performance in O(n) unless it is backed by an immutable array.
Lazily drop the first elements of this Sequence for which predicate 'p' holds.
Get the dynamic type of this instance. For value instances `x`, this is
equal to `type_of x`, but for `x` with a `ref` type `x.dynamic_type` gives
the actual runtime type, while `type_of x` results in the static
compile-time type.
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types. So for Type values, dynamic_type is redefined
to just return Type.type.
the euclidean norm of this sequence
i.e. the square of the sum of squares of this sequence
Does this switch contain a value of type A?
filter elements using predicate f
values for which f is false are dropped
get the index of pattern within this Sequence or nil if it does not exist
uses the Knuth-Morris-Pratt algorithm
port of racket code from this paper:
https://www.cambridge.org/core/services/aop-cambridge-core/content/view/8EFA77D663D585B68630E372BCE1EBA4/S0956796824000017a.pdf/knuth-morris-pratt-illustrated.pdf
worst-case performance: O( seq_length ) + O( pattern_length )
worst-case space complexity: O( pattern_length )
is this sequence known to be finite? For infinite sequences, features like
count diverge.
TRUE = known finite
FALSE = known infinite
nil = unknown
get the first element of this Sequence
get the first element of this Sequence or default if sequence is empty
map each element of this Sequence to Sequence
Then flatten the result by one level,
essentially combining all the sequences.
fold the elements of this Sequence using the given monoid.
e.g., to sum the elements of a Sequence of i32, use s.fold i32.sum
fold the elements of this non-empty Sequence using the given function
e.g., to find the minimum of a Sequence of i32, use `s.fold1 (<=)`
fold the elements of this Sequence using the given function and initial
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
convenience feature to work around type inference issues
NYI remove when type inference gets better
NYI remove when type inference gets better
create a string representation of this Sequence including all the string
representations of its contents, separated by 'sep'.
NOTE: In case this Sequence is not finite, this will attempt to create an
infinitely long string resulting in failure due to resource exchaustion.
converts option to a string
returns the result of $T for an option containing an instance
of T, alternatively returns $nil for an option that is nil.
create a string representation of this Sequence including all the string
representations of its contents, separated by ", " and enclosed in '['
and ']'.
NOTE: In case this Sequence is not finite, this will attempt to create an
infinitely long string resulting in failure due to resource exchaustion.
call 'as_string' on the elements
the arithmetic mean of the sequence
https://en.wikipedia.org/wiki/Arithmetic_mean
create a new list that contains the first elements of
this Sequence for which 'f e' is false
monadic operator
Same as non-generic >>=, but also maps to a different type B.
chop this Sequence into chunks of `chunk_size`.
the last chunk may be smaller than `chunk_size`.
§create a new Sequence from the result of applying 'f' to the
elements all combinations of elements of this Sequence and
all elements of 'b' iterating of 'b' repeatedly as follows
Sequence.this[0] , b[0]
Sequence.this[0] , b[1]
Sequence.this[0] , b[2]
Sequence.this[0] , ...
Sequence.this[0] , b.last
Sequence.this[1] , b[0]
Sequence.this[1] , b[1]
Sequence.this[1] , ...
... , ...
Sequence.this.last, b.last
create a Sequence that consists of all the elements of this Sequence followed
by all the elements of s
does the Sequence contain element x?
count the number of elements in this Sequence. Note that this typically
runs forever if executed on an endless list
For lists that are not array backed, this might require time in O(count).
get the number of non-overlapping matches of l within this
get the number of matches of l
create a list that repeats the current Sequence indefinitely. In case 'Sequence.this'
is empty, returns 'nil'
create a list that consists of the elements of this Sequence except the first
n elements
NOTE: this may have performance in O(n) unless it is backed by an immutable array.
Lazily drop the first elements of this Sequence for which predicate 'p' holds.
Get the dynamic type of this instance. For value instances `x`, this is
equal to `type_of x`, but for `x` with a `ref` type `x.dynamic_type` gives
the actual runtime type, while `type_of x` results in the static
compile-time type.
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types. So for Type values, dynamic_type is redefined
to just return Type.type.
the euclidean norm of this sequence
i.e. the square of the sum of squares of this sequence
Does this switch contain a value of type A?
filter elements using predicate f
values for which f is false are dropped
get the index of pattern within this Sequence or nil if it does not exist
uses the Knuth-Morris-Pratt algorithm
port of racket code from this paper:
https://www.cambridge.org/core/services/aop-cambridge-core/content/view/8EFA77D663D585B68630E372BCE1EBA4/S0956796824000017a.pdf/knuth-morris-pratt-illustrated.pdf
worst-case performance: O( seq_length ) + O( pattern_length )
worst-case space complexity: O( pattern_length )
is this sequence known to be finite? For infinite sequences, features like
count diverge.
TRUE = known finite
FALSE = known infinite
nil = unknown
get the first element of this Sequence
get the first element of this Sequence or default if sequence is empty
map each element of this Sequence to Sequence
Then flatten the result by one level,
essentially combining all the sequences.
fold the elements of this Sequence using the given monoid.
e.g., to sum the elements of a Sequence of i32, use s.fold i32.sum
fold the elements of this non-empty Sequence using the given function
e.g., to find the minimum of a Sequence of i32, use `s.fold1 (<=)`
fold the elements of this Sequence using the given function and initial
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
create a string representation of this Sequence including all the string
representations of its contents, separated by 'sep'.
NOTE: In case this Sequence is not finite, this will attempt to create an
infinitely long string resulting in failure due to resource exchaustion.
representations of its contents, separated by 'sep'.
NOTE: In case this Sequence is not finite, this will attempt to create an
infinitely long string resulting in failure due to resource exchaustion.
converts option to a string
returns the result of $T for an option containing an instance
of T, alternatively returns $nil for an option that is nil.
create a string representation of this Sequence including all the string
representations of its contents, separated by ", " and enclosed in '['
and ']'.
NOTE: In case this Sequence is not finite, this will attempt to create an
infinitely long string resulting in failure due to resource exchaustion.
call 'as_string' on the elements
the arithmetic mean of the sequence
https://en.wikipedia.org/wiki/Arithmetic_mean
create a new list that contains the first elements of
this Sequence for which 'f e' is false
monadic operator
Same as non-generic >>=, but also maps to a different type B.
chop this Sequence into chunks of `chunk_size`.
the last chunk may be smaller than `chunk_size`.
§create a new Sequence from the result of applying 'f' to the
elements all combinations of elements of this Sequence and
all elements of 'b' iterating of 'b' repeatedly as follows
Sequence.this[0] , b[0]
Sequence.this[0] , b[1]
Sequence.this[0] , b[2]
Sequence.this[0] , ...
Sequence.this[0] , b.last
Sequence.this[1] , b[0]
Sequence.this[1] , b[1]
Sequence.this[1] , ...
... , ...
Sequence.this.last, b.last
create a Sequence that consists of all the elements of this Sequence followed
by all the elements of s
does the Sequence contain element x?
count the number of elements in this Sequence. Note that this typically
runs forever if executed on an endless list
For lists that are not array backed, this might require time in O(count).
get the number of non-overlapping matches of l within this
get the number of matches of l
create a list that repeats the current Sequence indefinitely. In case 'Sequence.this'
is empty, returns 'nil'
create a list that consists of the elements of this Sequence except the first
n elements
NOTE: this may have performance in O(n) unless it is backed by an immutable array.
Lazily drop the first elements of this Sequence for which predicate 'p' holds.
Get the dynamic type of this instance. For value instances `x`, this is
equal to `type_of x`, but for `x` with a `ref` type `x.dynamic_type` gives
the actual runtime type, while `type_of x` results in the static
compile-time type.
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types. So for Type values, dynamic_type is redefined
to just return Type.type.
the euclidean norm of this sequence
i.e. the square of the sum of squares of this sequence
Does this switch contain a value of type A?
filter elements using predicate f
values for which f is false are dropped
get the index of pattern within this Sequence or nil if it does not exist
uses the Knuth-Morris-Pratt algorithm
port of racket code from this paper:
https://www.cambridge.org/core/services/aop-cambridge-core/content/view/8EFA77D663D585B68630E372BCE1EBA4/S0956796824000017a.pdf/knuth-morris-pratt-illustrated.pdf
worst-case performance: O( seq_length ) + O( pattern_length )
worst-case space complexity: O( pattern_length )
is this sequence known to be finite? For infinite sequences, features like
count diverge.
TRUE = known finite
FALSE = known infinite
nil = unknown
get the first element of this Sequence
get the first element of this Sequence or default if sequence is empty
map each element of this Sequence to Sequence
Then flatten the result by one level,
essentially combining all the sequences.
fold the elements of this Sequence using the given monoid.
e.g., to sum the elements of a Sequence of i32, use s.fold i32.sum
fold the elements of this non-empty Sequence using the given function
e.g., to find the minimum of a Sequence of i32, use `s.fold1 (<=)`
fold the elements of this Sequence using the given function and initial
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
converts option to a string
returns the result of $T for an option containing an instance
of T, alternatively returns $nil for an option that is nil.
returns the result of $T for an option containing an instance
of T, alternatively returns $nil for an option that is nil.
create a string representation of this Sequence including all the string
representations of its contents, separated by ", " and enclosed in '['
and ']'.
NOTE: In case this Sequence is not finite, this will attempt to create an
infinitely long string resulting in failure due to resource exchaustion.
call 'as_string' on the elements
the arithmetic mean of the sequence
https://en.wikipedia.org/wiki/Arithmetic_mean
create a new list that contains the first elements of
this Sequence for which 'f e' is false
monadic operator
Same as non-generic >>=, but also maps to a different type B.
chop this Sequence into chunks of `chunk_size`.
the last chunk may be smaller than `chunk_size`.
§create a new Sequence from the result of applying 'f' to the
elements all combinations of elements of this Sequence and
all elements of 'b' iterating of 'b' repeatedly as follows
Sequence.this[0] , b[0]
Sequence.this[0] , b[1]
Sequence.this[0] , b[2]
Sequence.this[0] , ...
Sequence.this[0] , b.last
Sequence.this[1] , b[0]
Sequence.this[1] , b[1]
Sequence.this[1] , ...
... , ...
Sequence.this.last, b.last
create a Sequence that consists of all the elements of this Sequence followed
by all the elements of s
does the Sequence contain element x?
count the number of elements in this Sequence. Note that this typically
runs forever if executed on an endless list
For lists that are not array backed, this might require time in O(count).
get the number of non-overlapping matches of l within this
get the number of matches of l
create a list that repeats the current Sequence indefinitely. In case 'Sequence.this'
is empty, returns 'nil'
create a list that consists of the elements of this Sequence except the first
n elements
NOTE: this may have performance in O(n) unless it is backed by an immutable array.
Lazily drop the first elements of this Sequence for which predicate 'p' holds.
Get the dynamic type of this instance. For value instances `x`, this is
equal to `type_of x`, but for `x` with a `ref` type `x.dynamic_type` gives
the actual runtime type, while `type_of x` results in the static
compile-time type.
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types. So for Type values, dynamic_type is redefined
to just return Type.type.
the euclidean norm of this sequence
i.e. the square of the sum of squares of this sequence
Does this switch contain a value of type A?
filter elements using predicate f
values for which f is false are dropped
get the index of pattern within this Sequence or nil if it does not exist
uses the Knuth-Morris-Pratt algorithm
port of racket code from this paper:
https://www.cambridge.org/core/services/aop-cambridge-core/content/view/8EFA77D663D585B68630E372BCE1EBA4/S0956796824000017a.pdf/knuth-morris-pratt-illustrated.pdf
worst-case performance: O( seq_length ) + O( pattern_length )
worst-case space complexity: O( pattern_length )
is this sequence known to be finite? For infinite sequences, features like
count diverge.
TRUE = known finite
FALSE = known infinite
nil = unknown
get the first element of this Sequence
get the first element of this Sequence or default if sequence is empty
map each element of this Sequence to Sequence
Then flatten the result by one level,
essentially combining all the sequences.
fold the elements of this Sequence using the given monoid.
e.g., to sum the elements of a Sequence of i32, use s.fold i32.sum
fold the elements of this non-empty Sequence using the given function
e.g., to find the minimum of a Sequence of i32, use `s.fold1 (<=)`
fold the elements of this Sequence using the given function and initial
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
create a string representation of this Sequence including all the string
representations of its contents, separated by ", " and enclosed in '['
and ']'.
NOTE: In case this Sequence is not finite, this will attempt to create an
infinitely long string resulting in failure due to resource exchaustion.
representations of its contents, separated by ", " and enclosed in '['
and ']'.
NOTE: In case this Sequence is not finite, this will attempt to create an
infinitely long string resulting in failure due to resource exchaustion.
call 'as_string' on the elements
the arithmetic mean of the sequence
https://en.wikipedia.org/wiki/Arithmetic_mean
create a new list that contains the first elements of
this Sequence for which 'f e' is false
monadic operator
Same as non-generic >>=, but also maps to a different type B.
chop this Sequence into chunks of `chunk_size`.
the last chunk may be smaller than `chunk_size`.
§create a new Sequence from the result of applying 'f' to the
elements all combinations of elements of this Sequence and
all elements of 'b' iterating of 'b' repeatedly as follows
Sequence.this[0] , b[0]
Sequence.this[0] , b[1]
Sequence.this[0] , b[2]
Sequence.this[0] , ...
Sequence.this[0] , b.last
Sequence.this[1] , b[0]
Sequence.this[1] , b[1]
Sequence.this[1] , ...
... , ...
Sequence.this.last, b.last
create a Sequence that consists of all the elements of this Sequence followed
by all the elements of s
does the Sequence contain element x?
count the number of elements in this Sequence. Note that this typically
runs forever if executed on an endless list
For lists that are not array backed, this might require time in O(count).
get the number of non-overlapping matches of l within this
get the number of matches of l
create a list that repeats the current Sequence indefinitely. In case 'Sequence.this'
is empty, returns 'nil'
create a list that consists of the elements of this Sequence except the first
n elements
NOTE: this may have performance in O(n) unless it is backed by an immutable array.
Lazily drop the first elements of this Sequence for which predicate 'p' holds.
Get the dynamic type of this instance. For value instances `x`, this is
equal to `type_of x`, but for `x` with a `ref` type `x.dynamic_type` gives
the actual runtime type, while `type_of x` results in the static
compile-time type.
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types. So for Type values, dynamic_type is redefined
to just return Type.type.
the euclidean norm of this sequence
i.e. the square of the sum of squares of this sequence
Does this switch contain a value of type A?
filter elements using predicate f
values for which f is false are dropped
get the index of pattern within this Sequence or nil if it does not exist
uses the Knuth-Morris-Pratt algorithm
port of racket code from this paper:
https://www.cambridge.org/core/services/aop-cambridge-core/content/view/8EFA77D663D585B68630E372BCE1EBA4/S0956796824000017a.pdf/knuth-morris-pratt-illustrated.pdf
worst-case performance: O( seq_length ) + O( pattern_length )
worst-case space complexity: O( pattern_length )
is this sequence known to be finite? For infinite sequences, features like
count diverge.
TRUE = known finite
FALSE = known infinite
nil = unknown
get the first element of this Sequence
get the first element of this Sequence or default if sequence is empty
map each element of this Sequence to Sequence
Then flatten the result by one level,
essentially combining all the sequences.
fold the elements of this Sequence using the given monoid.
e.g., to sum the elements of a Sequence of i32, use s.fold i32.sum
fold the elements of this non-empty Sequence using the given function
e.g., to find the minimum of a Sequence of i32, use `s.fold1 (<=)`
fold the elements of this Sequence using the given function and initial
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
call 'as_string' on the elements
the arithmetic mean of the sequence
https://en.wikipedia.org/wiki/Arithmetic_mean
create a new list that contains the first elements of
this Sequence for which 'f e' is false
monadic operator
Same as non-generic >>=, but also maps to a different type B.
chop this Sequence into chunks of `chunk_size`.
the last chunk may be smaller than `chunk_size`.
§create a new Sequence from the result of applying 'f' to the
elements all combinations of elements of this Sequence and
all elements of 'b' iterating of 'b' repeatedly as follows
Sequence.this[0] , b[0]
Sequence.this[0] , b[1]
Sequence.this[0] , b[2]
Sequence.this[0] , ...
Sequence.this[0] , b.last
Sequence.this[1] , b[0]
Sequence.this[1] , b[1]
Sequence.this[1] , ...
... , ...
Sequence.this.last, b.last
create a Sequence that consists of all the elements of this Sequence followed
by all the elements of s
does the Sequence contain element x?
count the number of elements in this Sequence. Note that this typically
runs forever if executed on an endless list
For lists that are not array backed, this might require time in O(count).
get the number of non-overlapping matches of l within this
get the number of matches of l
create a list that repeats the current Sequence indefinitely. In case 'Sequence.this'
is empty, returns 'nil'
create a list that consists of the elements of this Sequence except the first
n elements
NOTE: this may have performance in O(n) unless it is backed by an immutable array.
Lazily drop the first elements of this Sequence for which predicate 'p' holds.
Get the dynamic type of this instance. For value instances `x`, this is
equal to `type_of x`, but for `x` with a `ref` type `x.dynamic_type` gives
the actual runtime type, while `type_of x` results in the static
compile-time type.
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types. So for Type values, dynamic_type is redefined
to just return Type.type.
the euclidean norm of this sequence
i.e. the square of the sum of squares of this sequence
Does this switch contain a value of type A?
filter elements using predicate f
values for which f is false are dropped
get the index of pattern within this Sequence or nil if it does not exist
uses the Knuth-Morris-Pratt algorithm
port of racket code from this paper:
https://www.cambridge.org/core/services/aop-cambridge-core/content/view/8EFA77D663D585B68630E372BCE1EBA4/S0956796824000017a.pdf/knuth-morris-pratt-illustrated.pdf
worst-case performance: O( seq_length ) + O( pattern_length )
worst-case space complexity: O( pattern_length )
is this sequence known to be finite? For infinite sequences, features like
count diverge.
TRUE = known finite
FALSE = known infinite
nil = unknown
get the first element of this Sequence
get the first element of this Sequence or default if sequence is empty
map each element of this Sequence to Sequence
Then flatten the result by one level,
essentially combining all the sequences.
fold the elements of this Sequence using the given monoid.
e.g., to sum the elements of a Sequence of i32, use s.fold i32.sum
fold the elements of this non-empty Sequence using the given function
e.g., to find the minimum of a Sequence of i32, use `s.fold1 (<=)`
fold the elements of this Sequence using the given function and initial
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
the arithmetic mean of the sequence
https://en.wikipedia.org/wiki/Arithmetic_mean
https://en.wikipedia.org/wiki/Arithmetic_mean
create a new list that contains the first elements of
this Sequence for which 'f e' is false
monadic operator
Same as non-generic >>=, but also maps to a different type B.
chop this Sequence into chunks of `chunk_size`.
the last chunk may be smaller than `chunk_size`.
§create a new Sequence from the result of applying 'f' to the
elements all combinations of elements of this Sequence and
all elements of 'b' iterating of 'b' repeatedly as follows
Sequence.this[0] , b[0]
Sequence.this[0] , b[1]
Sequence.this[0] , b[2]
Sequence.this[0] , ...
Sequence.this[0] , b.last
Sequence.this[1] , b[0]
Sequence.this[1] , b[1]
Sequence.this[1] , ...
... , ...
Sequence.this.last, b.last
create a Sequence that consists of all the elements of this Sequence followed
by all the elements of s
does the Sequence contain element x?
count the number of elements in this Sequence. Note that this typically
runs forever if executed on an endless list
For lists that are not array backed, this might require time in O(count).
get the number of non-overlapping matches of l within this
get the number of matches of l
create a list that repeats the current Sequence indefinitely. In case 'Sequence.this'
is empty, returns 'nil'
create a list that consists of the elements of this Sequence except the first
n elements
NOTE: this may have performance in O(n) unless it is backed by an immutable array.
Lazily drop the first elements of this Sequence for which predicate 'p' holds.
Get the dynamic type of this instance. For value instances `x`, this is
equal to `type_of x`, but for `x` with a `ref` type `x.dynamic_type` gives
the actual runtime type, while `type_of x` results in the static
compile-time type.
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types. So for Type values, dynamic_type is redefined
to just return Type.type.
the euclidean norm of this sequence
i.e. the square of the sum of squares of this sequence
Does this switch contain a value of type A?
filter elements using predicate f
values for which f is false are dropped
get the index of pattern within this Sequence or nil if it does not exist
uses the Knuth-Morris-Pratt algorithm
port of racket code from this paper:
https://www.cambridge.org/core/services/aop-cambridge-core/content/view/8EFA77D663D585B68630E372BCE1EBA4/S0956796824000017a.pdf/knuth-morris-pratt-illustrated.pdf
worst-case performance: O( seq_length ) + O( pattern_length )
worst-case space complexity: O( pattern_length )
is this sequence known to be finite? For infinite sequences, features like
count diverge.
TRUE = known finite
FALSE = known infinite
nil = unknown
get the first element of this Sequence
get the first element of this Sequence or default if sequence is empty
map each element of this Sequence to Sequence
Then flatten the result by one level,
essentially combining all the sequences.
fold the elements of this Sequence using the given monoid.
e.g., to sum the elements of a Sequence of i32, use s.fold i32.sum
fold the elements of this non-empty Sequence using the given function
e.g., to find the minimum of a Sequence of i32, use `s.fold1 (<=)`
fold the elements of this Sequence using the given function and initial
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
create a new list that contains the first elements of
this Sequence for which 'f e' is false
this Sequence for which 'f e' is false
monadic operator
Same as non-generic >>=, but also maps to a different type B.
chop this Sequence into chunks of `chunk_size`.
the last chunk may be smaller than `chunk_size`.
§create a new Sequence from the result of applying 'f' to the
elements all combinations of elements of this Sequence and
all elements of 'b' iterating of 'b' repeatedly as follows
Sequence.this[0] , b[0]
Sequence.this[0] , b[1]
Sequence.this[0] , b[2]
Sequence.this[0] , ...
Sequence.this[0] , b.last
Sequence.this[1] , b[0]
Sequence.this[1] , b[1]
Sequence.this[1] , ...
... , ...
Sequence.this.last, b.last
create a Sequence that consists of all the elements of this Sequence followed
by all the elements of s
does the Sequence contain element x?
count the number of elements in this Sequence. Note that this typically
runs forever if executed on an endless list
For lists that are not array backed, this might require time in O(count).
get the number of non-overlapping matches of l within this
get the number of matches of l
create a list that repeats the current Sequence indefinitely. In case 'Sequence.this'
is empty, returns 'nil'
create a list that consists of the elements of this Sequence except the first
n elements
NOTE: this may have performance in O(n) unless it is backed by an immutable array.
Lazily drop the first elements of this Sequence for which predicate 'p' holds.
Get the dynamic type of this instance. For value instances `x`, this is
equal to `type_of x`, but for `x` with a `ref` type `x.dynamic_type` gives
the actual runtime type, while `type_of x` results in the static
compile-time type.
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types. So for Type values, dynamic_type is redefined
to just return Type.type.
the euclidean norm of this sequence
i.e. the square of the sum of squares of this sequence
Does this switch contain a value of type A?
filter elements using predicate f
values for which f is false are dropped
get the index of pattern within this Sequence or nil if it does not exist
uses the Knuth-Morris-Pratt algorithm
port of racket code from this paper:
https://www.cambridge.org/core/services/aop-cambridge-core/content/view/8EFA77D663D585B68630E372BCE1EBA4/S0956796824000017a.pdf/knuth-morris-pratt-illustrated.pdf
worst-case performance: O( seq_length ) + O( pattern_length )
worst-case space complexity: O( pattern_length )
is this sequence known to be finite? For infinite sequences, features like
count diverge.
TRUE = known finite
FALSE = known infinite
nil = unknown
get the first element of this Sequence
get the first element of this Sequence or default if sequence is empty
map each element of this Sequence to Sequence
Then flatten the result by one level,
essentially combining all the sequences.
fold the elements of this Sequence using the given monoid.
e.g., to sum the elements of a Sequence of i32, use s.fold i32.sum
fold the elements of this non-empty Sequence using the given function
e.g., to find the minimum of a Sequence of i32, use `s.fold1 (<=)`
fold the elements of this Sequence using the given function and initial
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
monadic operator
Same as non-generic >>=, but also maps to a different type B.
Same as non-generic >>=, but also maps to a different type B.
chop this Sequence into chunks of `chunk_size`.
the last chunk may be smaller than `chunk_size`.
§create a new Sequence from the result of applying 'f' to the
elements all combinations of elements of this Sequence and
all elements of 'b' iterating of 'b' repeatedly as follows
Sequence.this[0] , b[0]
Sequence.this[0] , b[1]
Sequence.this[0] , b[2]
Sequence.this[0] , ...
Sequence.this[0] , b.last
Sequence.this[1] , b[0]
Sequence.this[1] , b[1]
Sequence.this[1] , ...
... , ...
Sequence.this.last, b.last
create a Sequence that consists of all the elements of this Sequence followed
by all the elements of s
does the Sequence contain element x?
count the number of elements in this Sequence. Note that this typically
runs forever if executed on an endless list
For lists that are not array backed, this might require time in O(count).
get the number of non-overlapping matches of l within this
get the number of matches of l
create a list that repeats the current Sequence indefinitely. In case 'Sequence.this'
is empty, returns 'nil'
create a list that consists of the elements of this Sequence except the first
n elements
NOTE: this may have performance in O(n) unless it is backed by an immutable array.
Lazily drop the first elements of this Sequence for which predicate 'p' holds.
Get the dynamic type of this instance. For value instances `x`, this is
equal to `type_of x`, but for `x` with a `ref` type `x.dynamic_type` gives
the actual runtime type, while `type_of x` results in the static
compile-time type.
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types. So for Type values, dynamic_type is redefined
to just return Type.type.
the euclidean norm of this sequence
i.e. the square of the sum of squares of this sequence
Does this switch contain a value of type A?
filter elements using predicate f
values for which f is false are dropped
get the index of pattern within this Sequence or nil if it does not exist
uses the Knuth-Morris-Pratt algorithm
port of racket code from this paper:
https://www.cambridge.org/core/services/aop-cambridge-core/content/view/8EFA77D663D585B68630E372BCE1EBA4/S0956796824000017a.pdf/knuth-morris-pratt-illustrated.pdf
worst-case performance: O( seq_length ) + O( pattern_length )
worst-case space complexity: O( pattern_length )
is this sequence known to be finite? For infinite sequences, features like
count diverge.
TRUE = known finite
FALSE = known infinite
nil = unknown
get the first element of this Sequence
get the first element of this Sequence or default if sequence is empty
map each element of this Sequence to Sequence
Then flatten the result by one level,
essentially combining all the sequences.
fold the elements of this Sequence using the given monoid.
e.g., to sum the elements of a Sequence of i32, use s.fold i32.sum
fold the elements of this non-empty Sequence using the given function
e.g., to find the minimum of a Sequence of i32, use `s.fold1 (<=)`
fold the elements of this Sequence using the given function and initial
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
chop this Sequence into chunks of `chunk_size`.
the last chunk may be smaller than `chunk_size`.
the last chunk may be smaller than `chunk_size`.
§create a new Sequence from the result of applying 'f' to the
elements all combinations of elements of this Sequence and
all elements of 'b' iterating of 'b' repeatedly as follows
Sequence.this[0] , b[0]
Sequence.this[0] , b[1]
Sequence.this[0] , b[2]
Sequence.this[0] , ...
Sequence.this[0] , b.last
Sequence.this[1] , b[0]
Sequence.this[1] , b[1]
Sequence.this[1] , ...
... , ...
Sequence.this.last, b.last
create a Sequence that consists of all the elements of this Sequence followed
by all the elements of s
does the Sequence contain element x?
count the number of elements in this Sequence. Note that this typically
runs forever if executed on an endless list
For lists that are not array backed, this might require time in O(count).
get the number of non-overlapping matches of l within this
get the number of matches of l
create a list that repeats the current Sequence indefinitely. In case 'Sequence.this'
is empty, returns 'nil'
create a list that consists of the elements of this Sequence except the first
n elements
NOTE: this may have performance in O(n) unless it is backed by an immutable array.
Lazily drop the first elements of this Sequence for which predicate 'p' holds.
Get the dynamic type of this instance. For value instances `x`, this is
equal to `type_of x`, but for `x` with a `ref` type `x.dynamic_type` gives
the actual runtime type, while `type_of x` results in the static
compile-time type.
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types. So for Type values, dynamic_type is redefined
to just return Type.type.
the euclidean norm of this sequence
i.e. the square of the sum of squares of this sequence
Does this switch contain a value of type A?
filter elements using predicate f
values for which f is false are dropped
get the index of pattern within this Sequence or nil if it does not exist
uses the Knuth-Morris-Pratt algorithm
port of racket code from this paper:
https://www.cambridge.org/core/services/aop-cambridge-core/content/view/8EFA77D663D585B68630E372BCE1EBA4/S0956796824000017a.pdf/knuth-morris-pratt-illustrated.pdf
worst-case performance: O( seq_length ) + O( pattern_length )
worst-case space complexity: O( pattern_length )
is this sequence known to be finite? For infinite sequences, features like
count diverge.
TRUE = known finite
FALSE = known infinite
nil = unknown
get the first element of this Sequence
get the first element of this Sequence or default if sequence is empty
map each element of this Sequence to Sequence
Then flatten the result by one level,
essentially combining all the sequences.
fold the elements of this Sequence using the given monoid.
e.g., to sum the elements of a Sequence of i32, use s.fold i32.sum
fold the elements of this non-empty Sequence using the given function
e.g., to find the minimum of a Sequence of i32, use `s.fold1 (<=)`
fold the elements of this Sequence using the given function and initial
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
§
create a new Sequence from the result of applying 'f' to the
elements all combinations of elements of this Sequence and
all elements of 'b' iterating of 'b' repeatedly as follows
Sequence.this[0] , b[0]
Sequence.this[0] , b[1]
Sequence.this[0] , b[2]
Sequence.this[0] , ...
Sequence.this[0] , b.last
Sequence.this[1] , b[0]
Sequence.this[1] , b[1]
Sequence.this[1] , ...
... , ...
Sequence.this.last, b.last
elements all combinations of elements of this Sequence and
all elements of 'b' iterating of 'b' repeatedly as follows
Sequence.this[0] , b[0]
Sequence.this[0] , b[1]
Sequence.this[0] , b[2]
Sequence.this[0] , ...
Sequence.this[0] , b.last
Sequence.this[1] , b[0]
Sequence.this[1] , b[1]
Sequence.this[1] , ...
... , ...
Sequence.this.last, b.last
create a Sequence that consists of all the elements of this Sequence followed
by all the elements of s
does the Sequence contain element x?
count the number of elements in this Sequence. Note that this typically
runs forever if executed on an endless list
For lists that are not array backed, this might require time in O(count).
get the number of non-overlapping matches of l within this
get the number of matches of l
create a list that repeats the current Sequence indefinitely. In case 'Sequence.this'
is empty, returns 'nil'
create a list that consists of the elements of this Sequence except the first
n elements
NOTE: this may have performance in O(n) unless it is backed by an immutable array.
Lazily drop the first elements of this Sequence for which predicate 'p' holds.
Get the dynamic type of this instance. For value instances `x`, this is
equal to `type_of x`, but for `x` with a `ref` type `x.dynamic_type` gives
the actual runtime type, while `type_of x` results in the static
compile-time type.
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types. So for Type values, dynamic_type is redefined
to just return Type.type.
the euclidean norm of this sequence
i.e. the square of the sum of squares of this sequence
Does this switch contain a value of type A?
filter elements using predicate f
values for which f is false are dropped
get the index of pattern within this Sequence or nil if it does not exist
uses the Knuth-Morris-Pratt algorithm
port of racket code from this paper:
https://www.cambridge.org/core/services/aop-cambridge-core/content/view/8EFA77D663D585B68630E372BCE1EBA4/S0956796824000017a.pdf/knuth-morris-pratt-illustrated.pdf
worst-case performance: O( seq_length ) + O( pattern_length )
worst-case space complexity: O( pattern_length )
is this sequence known to be finite? For infinite sequences, features like
count diverge.
TRUE = known finite
FALSE = known infinite
nil = unknown
get the first element of this Sequence
get the first element of this Sequence or default if sequence is empty
map each element of this Sequence to Sequence
Then flatten the result by one level,
essentially combining all the sequences.
fold the elements of this Sequence using the given monoid.
e.g., to sum the elements of a Sequence of i32, use s.fold i32.sum
fold the elements of this non-empty Sequence using the given function
e.g., to find the minimum of a Sequence of i32, use `s.fold1 (<=)`
fold the elements of this Sequence using the given function and initial
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
create a Sequence that consists of all the elements of this Sequence followed
by all the elements of s
by all the elements of s
does the Sequence contain element x?
count the number of elements in this Sequence. Note that this typically
runs forever if executed on an endless list
For lists that are not array backed, this might require time in O(count).
get the number of non-overlapping matches of l within this
get the number of matches of l
create a list that repeats the current Sequence indefinitely. In case 'Sequence.this'
is empty, returns 'nil'
create a list that consists of the elements of this Sequence except the first
n elements
NOTE: this may have performance in O(n) unless it is backed by an immutable array.
Lazily drop the first elements of this Sequence for which predicate 'p' holds.
Get the dynamic type of this instance. For value instances `x`, this is
equal to `type_of x`, but for `x` with a `ref` type `x.dynamic_type` gives
the actual runtime type, while `type_of x` results in the static
compile-time type.
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types. So for Type values, dynamic_type is redefined
to just return Type.type.
the euclidean norm of this sequence
i.e. the square of the sum of squares of this sequence
Does this switch contain a value of type A?
filter elements using predicate f
values for which f is false are dropped
get the index of pattern within this Sequence or nil if it does not exist
uses the Knuth-Morris-Pratt algorithm
port of racket code from this paper:
https://www.cambridge.org/core/services/aop-cambridge-core/content/view/8EFA77D663D585B68630E372BCE1EBA4/S0956796824000017a.pdf/knuth-morris-pratt-illustrated.pdf
worst-case performance: O( seq_length ) + O( pattern_length )
worst-case space complexity: O( pattern_length )
is this sequence known to be finite? For infinite sequences, features like
count diverge.
TRUE = known finite
FALSE = known infinite
nil = unknown
get the first element of this Sequence
get the first element of this Sequence or default if sequence is empty
map each element of this Sequence to Sequence
Then flatten the result by one level,
essentially combining all the sequences.
fold the elements of this Sequence using the given monoid.
e.g., to sum the elements of a Sequence of i32, use s.fold i32.sum
fold the elements of this non-empty Sequence using the given function
e.g., to find the minimum of a Sequence of i32, use `s.fold1 (<=)`
fold the elements of this Sequence using the given function and initial
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
does the Sequence contain element x?
count the number of elements in this Sequence. Note that this typically
runs forever if executed on an endless list
For lists that are not array backed, this might require time in O(count).
get the number of non-overlapping matches of l within this
get the number of matches of l
create a list that repeats the current Sequence indefinitely. In case 'Sequence.this'
is empty, returns 'nil'
create a list that consists of the elements of this Sequence except the first
n elements
NOTE: this may have performance in O(n) unless it is backed by an immutable array.
Lazily drop the first elements of this Sequence for which predicate 'p' holds.
Get the dynamic type of this instance. For value instances `x`, this is
equal to `type_of x`, but for `x` with a `ref` type `x.dynamic_type` gives
the actual runtime type, while `type_of x` results in the static
compile-time type.
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types. So for Type values, dynamic_type is redefined
to just return Type.type.
the euclidean norm of this sequence
i.e. the square of the sum of squares of this sequence
Does this switch contain a value of type A?
filter elements using predicate f
values for which f is false are dropped
get the index of pattern within this Sequence or nil if it does not exist
uses the Knuth-Morris-Pratt algorithm
port of racket code from this paper:
https://www.cambridge.org/core/services/aop-cambridge-core/content/view/8EFA77D663D585B68630E372BCE1EBA4/S0956796824000017a.pdf/knuth-morris-pratt-illustrated.pdf
worst-case performance: O( seq_length ) + O( pattern_length )
worst-case space complexity: O( pattern_length )
is this sequence known to be finite? For infinite sequences, features like
count diverge.
TRUE = known finite
FALSE = known infinite
nil = unknown
get the first element of this Sequence
get the first element of this Sequence or default if sequence is empty
map each element of this Sequence to Sequence
Then flatten the result by one level,
essentially combining all the sequences.
fold the elements of this Sequence using the given monoid.
e.g., to sum the elements of a Sequence of i32, use s.fold i32.sum
fold the elements of this non-empty Sequence using the given function
e.g., to find the minimum of a Sequence of i32, use `s.fold1 (<=)`
fold the elements of this Sequence using the given function and initial
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
count the number of elements in this Sequence. Note that this typically
runs forever if executed on an endless list
For lists that are not array backed, this might require time in O(count).
runs forever if executed on an endless list
For lists that are not array backed, this might require time in O(count).
get the number of non-overlapping matches of l within this
get the number of matches of l
create a list that repeats the current Sequence indefinitely. In case 'Sequence.this'
is empty, returns 'nil'
create a list that consists of the elements of this Sequence except the first
n elements
NOTE: this may have performance in O(n) unless it is backed by an immutable array.
Lazily drop the first elements of this Sequence for which predicate 'p' holds.
Get the dynamic type of this instance. For value instances `x`, this is
equal to `type_of x`, but for `x` with a `ref` type `x.dynamic_type` gives
the actual runtime type, while `type_of x` results in the static
compile-time type.
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types. So for Type values, dynamic_type is redefined
to just return Type.type.
the euclidean norm of this sequence
i.e. the square of the sum of squares of this sequence
Does this switch contain a value of type A?
filter elements using predicate f
values for which f is false are dropped
get the index of pattern within this Sequence or nil if it does not exist
uses the Knuth-Morris-Pratt algorithm
port of racket code from this paper:
https://www.cambridge.org/core/services/aop-cambridge-core/content/view/8EFA77D663D585B68630E372BCE1EBA4/S0956796824000017a.pdf/knuth-morris-pratt-illustrated.pdf
worst-case performance: O( seq_length ) + O( pattern_length )
worst-case space complexity: O( pattern_length )
is this sequence known to be finite? For infinite sequences, features like
count diverge.
TRUE = known finite
FALSE = known infinite
nil = unknown
get the first element of this Sequence
get the first element of this Sequence or default if sequence is empty
map each element of this Sequence to Sequence
Then flatten the result by one level,
essentially combining all the sequences.
fold the elements of this Sequence using the given monoid.
e.g., to sum the elements of a Sequence of i32, use s.fold i32.sum
fold the elements of this non-empty Sequence using the given function
e.g., to find the minimum of a Sequence of i32, use `s.fold1 (<=)`
fold the elements of this Sequence using the given function and initial
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
get the number of non-overlapping matches of l within this
get the number of matches of l
create a list that repeats the current Sequence indefinitely. In case 'Sequence.this'
is empty, returns 'nil'
create a list that consists of the elements of this Sequence except the first
n elements
NOTE: this may have performance in O(n) unless it is backed by an immutable array.
Lazily drop the first elements of this Sequence for which predicate 'p' holds.
Get the dynamic type of this instance. For value instances `x`, this is
equal to `type_of x`, but for `x` with a `ref` type `x.dynamic_type` gives
the actual runtime type, while `type_of x` results in the static
compile-time type.
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types. So for Type values, dynamic_type is redefined
to just return Type.type.
the euclidean norm of this sequence
i.e. the square of the sum of squares of this sequence
Does this switch contain a value of type A?
filter elements using predicate f
values for which f is false are dropped
get the index of pattern within this Sequence or nil if it does not exist
uses the Knuth-Morris-Pratt algorithm
port of racket code from this paper:
https://www.cambridge.org/core/services/aop-cambridge-core/content/view/8EFA77D663D585B68630E372BCE1EBA4/S0956796824000017a.pdf/knuth-morris-pratt-illustrated.pdf
worst-case performance: O( seq_length ) + O( pattern_length )
worst-case space complexity: O( pattern_length )
is this sequence known to be finite? For infinite sequences, features like
count diverge.
TRUE = known finite
FALSE = known infinite
nil = unknown
get the first element of this Sequence
get the first element of this Sequence or default if sequence is empty
map each element of this Sequence to Sequence
Then flatten the result by one level,
essentially combining all the sequences.
fold the elements of this Sequence using the given monoid.
e.g., to sum the elements of a Sequence of i32, use s.fold i32.sum
fold the elements of this non-empty Sequence using the given function
e.g., to find the minimum of a Sequence of i32, use `s.fold1 (<=)`
fold the elements of this Sequence using the given function and initial
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
get the number of matches of l
create a list that repeats the current Sequence indefinitely. In case 'Sequence.this'
is empty, returns 'nil'
create a list that consists of the elements of this Sequence except the first
n elements
NOTE: this may have performance in O(n) unless it is backed by an immutable array.
Lazily drop the first elements of this Sequence for which predicate 'p' holds.
Get the dynamic type of this instance. For value instances `x`, this is
equal to `type_of x`, but for `x` with a `ref` type `x.dynamic_type` gives
the actual runtime type, while `type_of x` results in the static
compile-time type.
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types. So for Type values, dynamic_type is redefined
to just return Type.type.
the euclidean norm of this sequence
i.e. the square of the sum of squares of this sequence
Does this switch contain a value of type A?
filter elements using predicate f
values for which f is false are dropped
get the index of pattern within this Sequence or nil if it does not exist
uses the Knuth-Morris-Pratt algorithm
port of racket code from this paper:
https://www.cambridge.org/core/services/aop-cambridge-core/content/view/8EFA77D663D585B68630E372BCE1EBA4/S0956796824000017a.pdf/knuth-morris-pratt-illustrated.pdf
worst-case performance: O( seq_length ) + O( pattern_length )
worst-case space complexity: O( pattern_length )
is this sequence known to be finite? For infinite sequences, features like
count diverge.
TRUE = known finite
FALSE = known infinite
nil = unknown
get the first element of this Sequence
get the first element of this Sequence or default if sequence is empty
map each element of this Sequence to Sequence
Then flatten the result by one level,
essentially combining all the sequences.
fold the elements of this Sequence using the given monoid.
e.g., to sum the elements of a Sequence of i32, use s.fold i32.sum
fold the elements of this non-empty Sequence using the given function
e.g., to find the minimum of a Sequence of i32, use `s.fold1 (<=)`
fold the elements of this Sequence using the given function and initial
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
create a list that repeats the current Sequence indefinitely. In case 'Sequence.this'
is empty, returns 'nil'
is empty, returns 'nil'
create a list that consists of the elements of this Sequence except the first
n elements
NOTE: this may have performance in O(n) unless it is backed by an immutable array.
Lazily drop the first elements of this Sequence for which predicate 'p' holds.
Get the dynamic type of this instance. For value instances `x`, this is
equal to `type_of x`, but for `x` with a `ref` type `x.dynamic_type` gives
the actual runtime type, while `type_of x` results in the static
compile-time type.
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types. So for Type values, dynamic_type is redefined
to just return Type.type.
the euclidean norm of this sequence
i.e. the square of the sum of squares of this sequence
Does this switch contain a value of type A?
filter elements using predicate f
values for which f is false are dropped
get the index of pattern within this Sequence or nil if it does not exist
uses the Knuth-Morris-Pratt algorithm
port of racket code from this paper:
https://www.cambridge.org/core/services/aop-cambridge-core/content/view/8EFA77D663D585B68630E372BCE1EBA4/S0956796824000017a.pdf/knuth-morris-pratt-illustrated.pdf
worst-case performance: O( seq_length ) + O( pattern_length )
worst-case space complexity: O( pattern_length )
is this sequence known to be finite? For infinite sequences, features like
count diverge.
TRUE = known finite
FALSE = known infinite
nil = unknown
get the first element of this Sequence
get the first element of this Sequence or default if sequence is empty
map each element of this Sequence to Sequence
Then flatten the result by one level,
essentially combining all the sequences.
fold the elements of this Sequence using the given monoid.
e.g., to sum the elements of a Sequence of i32, use s.fold i32.sum
fold the elements of this non-empty Sequence using the given function
e.g., to find the minimum of a Sequence of i32, use `s.fold1 (<=)`
fold the elements of this Sequence using the given function and initial
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
create a list that consists of the elements of this Sequence except the first
n elements
NOTE: this may have performance in O(n) unless it is backed by an immutable array.
n elements
NOTE: this may have performance in O(n) unless it is backed by an immutable array.
Lazily drop the first elements of this Sequence for which predicate 'p' holds.
Get the dynamic type of this instance. For value instances `x`, this is
equal to `type_of x`, but for `x` with a `ref` type `x.dynamic_type` gives
the actual runtime type, while `type_of x` results in the static
compile-time type.
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types. So for Type values, dynamic_type is redefined
to just return Type.type.
the euclidean norm of this sequence
i.e. the square of the sum of squares of this sequence
Does this switch contain a value of type A?
filter elements using predicate f
values for which f is false are dropped
get the index of pattern within this Sequence or nil if it does not exist
uses the Knuth-Morris-Pratt algorithm
port of racket code from this paper:
https://www.cambridge.org/core/services/aop-cambridge-core/content/view/8EFA77D663D585B68630E372BCE1EBA4/S0956796824000017a.pdf/knuth-morris-pratt-illustrated.pdf
worst-case performance: O( seq_length ) + O( pattern_length )
worst-case space complexity: O( pattern_length )
is this sequence known to be finite? For infinite sequences, features like
count diverge.
TRUE = known finite
FALSE = known infinite
nil = unknown
get the first element of this Sequence
get the first element of this Sequence or default if sequence is empty
map each element of this Sequence to Sequence
Then flatten the result by one level,
essentially combining all the sequences.
fold the elements of this Sequence using the given monoid.
e.g., to sum the elements of a Sequence of i32, use s.fold i32.sum
fold the elements of this non-empty Sequence using the given function
e.g., to find the minimum of a Sequence of i32, use `s.fold1 (<=)`
fold the elements of this Sequence using the given function and initial
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
Lazily drop the first elements of this Sequence for which predicate 'p' holds.
Get the dynamic type of this instance. For value instances `x`, this is
equal to `type_of x`, but for `x` with a `ref` type `x.dynamic_type` gives
the actual runtime type, while `type_of x` results in the static
compile-time type.
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types. So for Type values, dynamic_type is redefined
to just return Type.type.
the euclidean norm of this sequence
i.e. the square of the sum of squares of this sequence
Does this switch contain a value of type A?
filter elements using predicate f
values for which f is false are dropped
get the index of pattern within this Sequence or nil if it does not exist
uses the Knuth-Morris-Pratt algorithm
port of racket code from this paper:
https://www.cambridge.org/core/services/aop-cambridge-core/content/view/8EFA77D663D585B68630E372BCE1EBA4/S0956796824000017a.pdf/knuth-morris-pratt-illustrated.pdf
worst-case performance: O( seq_length ) + O( pattern_length )
worst-case space complexity: O( pattern_length )
is this sequence known to be finite? For infinite sequences, features like
count diverge.
TRUE = known finite
FALSE = known infinite
nil = unknown
get the first element of this Sequence
get the first element of this Sequence or default if sequence is empty
map each element of this Sequence to Sequence
Then flatten the result by one level,
essentially combining all the sequences.
fold the elements of this Sequence using the given monoid.
e.g., to sum the elements of a Sequence of i32, use s.fold i32.sum
fold the elements of this non-empty Sequence using the given function
e.g., to find the minimum of a Sequence of i32, use `s.fold1 (<=)`
fold the elements of this Sequence using the given function and initial
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
Get the dynamic type of this instance. For value instances `x`, this is
equal to `type_of x`, but for `x` with a `ref` type `x.dynamic_type` gives
the actual runtime type, while `type_of x` results in the static
compile-time type.
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types. So for Type values, dynamic_type is redefined
to just return Type.type.
equal to `type_of x`, but for `x` with a `ref` type `x.dynamic_type` gives
the actual runtime type, while `type_of x` results in the static
compile-time type.
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types. So for Type values, dynamic_type is redefined
to just return Type.type.
the euclidean norm of this sequence
i.e. the square of the sum of squares of this sequence
Does this switch contain a value of type A?
filter elements using predicate f
values for which f is false are dropped
get the index of pattern within this Sequence or nil if it does not exist
uses the Knuth-Morris-Pratt algorithm
port of racket code from this paper:
https://www.cambridge.org/core/services/aop-cambridge-core/content/view/8EFA77D663D585B68630E372BCE1EBA4/S0956796824000017a.pdf/knuth-morris-pratt-illustrated.pdf
worst-case performance: O( seq_length ) + O( pattern_length )
worst-case space complexity: O( pattern_length )
is this sequence known to be finite? For infinite sequences, features like
count diverge.
TRUE = known finite
FALSE = known infinite
nil = unknown
get the first element of this Sequence
get the first element of this Sequence or default if sequence is empty
map each element of this Sequence to Sequence
Then flatten the result by one level,
essentially combining all the sequences.
fold the elements of this Sequence using the given monoid.
e.g., to sum the elements of a Sequence of i32, use s.fold i32.sum
fold the elements of this non-empty Sequence using the given function
e.g., to find the minimum of a Sequence of i32, use `s.fold1 (<=)`
fold the elements of this Sequence using the given function and initial
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
the euclidean norm of this sequence
i.e. the square of the sum of squares of this sequence
i.e. the square of the sum of squares of this sequence
Does this switch contain a value of type A?
filter elements using predicate f
values for which f is false are dropped
get the index of pattern within this Sequence or nil if it does not exist
uses the Knuth-Morris-Pratt algorithm
port of racket code from this paper:
https://www.cambridge.org/core/services/aop-cambridge-core/content/view/8EFA77D663D585B68630E372BCE1EBA4/S0956796824000017a.pdf/knuth-morris-pratt-illustrated.pdf
worst-case performance: O( seq_length ) + O( pattern_length )
worst-case space complexity: O( pattern_length )
is this sequence known to be finite? For infinite sequences, features like
count diverge.
TRUE = known finite
FALSE = known infinite
nil = unknown
get the first element of this Sequence
get the first element of this Sequence or default if sequence is empty
map each element of this Sequence to Sequence
Then flatten the result by one level,
essentially combining all the sequences.
fold the elements of this Sequence using the given monoid.
e.g., to sum the elements of a Sequence of i32, use s.fold i32.sum
fold the elements of this non-empty Sequence using the given function
e.g., to find the minimum of a Sequence of i32, use `s.fold1 (<=)`
fold the elements of this Sequence using the given function and initial
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
Does this switch contain a value of type A?
filter elements using predicate f
values for which f is false are dropped
get the index of pattern within this Sequence or nil if it does not exist
uses the Knuth-Morris-Pratt algorithm
port of racket code from this paper:
https://www.cambridge.org/core/services/aop-cambridge-core/content/view/8EFA77D663D585B68630E372BCE1EBA4/S0956796824000017a.pdf/knuth-morris-pratt-illustrated.pdf
worst-case performance: O( seq_length ) + O( pattern_length )
worst-case space complexity: O( pattern_length )
is this sequence known to be finite? For infinite sequences, features like
count diverge.
TRUE = known finite
FALSE = known infinite
nil = unknown
get the first element of this Sequence
get the first element of this Sequence or default if sequence is empty
map each element of this Sequence to Sequence
Then flatten the result by one level,
essentially combining all the sequences.
fold the elements of this Sequence using the given monoid.
e.g., to sum the elements of a Sequence of i32, use s.fold i32.sum
fold the elements of this non-empty Sequence using the given function
e.g., to find the minimum of a Sequence of i32, use `s.fold1 (<=)`
fold the elements of this Sequence using the given function and initial
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
filter elements using predicate f
values for which f is false are dropped
values for which f is false are dropped
get the index of pattern within this Sequence or nil if it does not exist
uses the Knuth-Morris-Pratt algorithm
port of racket code from this paper:
https://www.cambridge.org/core/services/aop-cambridge-core/content/view/8EFA77D663D585B68630E372BCE1EBA4/S0956796824000017a.pdf/knuth-morris-pratt-illustrated.pdf
worst-case performance: O( seq_length ) + O( pattern_length )
worst-case space complexity: O( pattern_length )
is this sequence known to be finite? For infinite sequences, features like
count diverge.
TRUE = known finite
FALSE = known infinite
nil = unknown
get the first element of this Sequence
get the first element of this Sequence or default if sequence is empty
map each element of this Sequence to Sequence
Then flatten the result by one level,
essentially combining all the sequences.
fold the elements of this Sequence using the given monoid.
e.g., to sum the elements of a Sequence of i32, use s.fold i32.sum
fold the elements of this non-empty Sequence using the given function
e.g., to find the minimum of a Sequence of i32, use `s.fold1 (<=)`
fold the elements of this Sequence using the given function and initial
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
get the index of pattern within this Sequence or nil if it does not exist
uses the Knuth-Morris-Pratt algorithm
port of racket code from this paper:
https://www.cambridge.org/core/services/aop-cambridge-core/content/view/8EFA77D663D585B68630E372BCE1EBA4/S0956796824000017a.pdf/knuth-morris-pratt-illustrated.pdf
worst-case performance: O( seq_length ) + O( pattern_length )
worst-case space complexity: O( pattern_length )
uses the Knuth-Morris-Pratt algorithm
port of racket code from this paper:
https://www.cambridge.org/core/services/aop-cambridge-core/content/view/8EFA77D663D585B68630E372BCE1EBA4/S0956796824000017a.pdf/knuth-morris-pratt-illustrated.pdf
worst-case performance: O( seq_length ) + O( pattern_length )
worst-case space complexity: O( pattern_length )
is this sequence known to be finite? For infinite sequences, features like
count diverge.
TRUE = known finite
FALSE = known infinite
nil = unknown
get the first element of this Sequence
get the first element of this Sequence or default if sequence is empty
map each element of this Sequence to Sequence
Then flatten the result by one level,
essentially combining all the sequences.
fold the elements of this Sequence using the given monoid.
e.g., to sum the elements of a Sequence of i32, use s.fold i32.sum
fold the elements of this non-empty Sequence using the given function
e.g., to find the minimum of a Sequence of i32, use `s.fold1 (<=)`
fold the elements of this Sequence using the given function and initial
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
is this sequence known to be finite? For infinite sequences, features like
count diverge.
TRUE = known finite
FALSE = known infinite
nil = unknown
count diverge.
TRUE = known finite
FALSE = known infinite
nil = unknown
get the first element of this Sequence
get the first element of this Sequence or default if sequence is empty
map each element of this Sequence to Sequence
Then flatten the result by one level,
essentially combining all the sequences.
fold the elements of this Sequence using the given monoid.
e.g., to sum the elements of a Sequence of i32, use s.fold i32.sum
fold the elements of this non-empty Sequence using the given function
e.g., to find the minimum of a Sequence of i32, use `s.fold1 (<=)`
fold the elements of this Sequence using the given function and initial
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
get the first element of this Sequence
get the first element of this Sequence or default if sequence is empty
map each element of this Sequence to Sequence
Then flatten the result by one level,
essentially combining all the sequences.
fold the elements of this Sequence using the given monoid.
e.g., to sum the elements of a Sequence of i32, use s.fold i32.sum
fold the elements of this non-empty Sequence using the given function
e.g., to find the minimum of a Sequence of i32, use `s.fold1 (<=)`
fold the elements of this Sequence using the given function and initial
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
get the first element of this Sequence or default if sequence is empty
map each element of this Sequence to Sequence
Then flatten the result by one level,
essentially combining all the sequences.
fold the elements of this Sequence using the given monoid.
e.g., to sum the elements of a Sequence of i32, use s.fold i32.sum
fold the elements of this non-empty Sequence using the given function
e.g., to find the minimum of a Sequence of i32, use `s.fold1 (<=)`
fold the elements of this Sequence using the given function and initial
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
map each element of this Sequence to Sequence
Then flatten the result by one level,
essentially combining all the sequences.
Then flatten the result by one level,
essentially combining all the sequences.
fold the elements of this Sequence using the given monoid.
e.g., to sum the elements of a Sequence of i32, use s.fold i32.sum
fold the elements of this non-empty Sequence using the given function
e.g., to find the minimum of a Sequence of i32, use `s.fold1 (<=)`
fold the elements of this Sequence using the given function and initial
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
fold the elements of this Sequence using the given monoid.
e.g., to sum the elements of a Sequence of i32, use s.fold i32.sum
e.g., to sum the elements of a Sequence of i32, use s.fold i32.sum
fold the elements of this non-empty Sequence using the given function
e.g., to find the minimum of a Sequence of i32, use `s.fold1 (<=)`
fold the elements of this Sequence using the given function and initial
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
fold the elements of this non-empty Sequence using the given function
e.g., to find the minimum of a Sequence of i32, use `s.fold1 (<=)`
e.g., to find the minimum of a Sequence of i32, use `s.fold1 (<=)`
fold the elements of this Sequence using the given function and initial
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
fold the elements of this Sequence using the given function and initial
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
value.
In case this Sequence is empty, the result is `e`.
e.g., to find the product of a Sequence of i32, use `s.foldf (*) 1`
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
create a list and call 'for_each f' on it
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
apply 'f' to each element 'e' as long as 'f e'
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
unwraps a switch that is known to contain a value
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
this can only be called in cases where it is known for sure that this switch
is not nil. A runtime error will be created otherwise.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
unwrap value or get default
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
get a function that, given an index, returns the element at that index
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
the nth element in the sequence, must exist
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
determine the index of element x within this list. 0 if x is at the
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
head of the list, 1 if it comes directly after head, etc. nil if x is
not in the list.
adds the corresponding index to
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
adds the corresponding index to
every element in the sequence
every element in the sequence
adds an index to every element
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
adds an index to every element
in the sequence starting at start_idx
in the sequence starting at start_idx
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
consume all elements of this Sequence by f. This is an infix operator alias
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
for for_each.
Ex.: To print all the elements of a list, you can use
1..10 ! say
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
not equals operator
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
modulo operator
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
filter elements using predicate f, infix operator
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
synonym of filter.
NYI: What is better, 'infix |&' or 'infix &', or something else?
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
exponentation operator
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
multiplication operator
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
infix operand synonym for concat_sequences
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
addition operator
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
subtraction operator
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
division operator
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
lower or equal than operator
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
lower than operator
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
equals operator
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
greater or equal than operator
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
monadic operator
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
This is handy to implement functions on optional values. As an example,
take an option string and you would like to add a filename suffix to
this string if it is present. Then you can do this as follows:
add_txt(o option string) => o >>= s -> s + ".txt"
NYI: Should maybe have generic parameter B and result in option B
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
monadic operator to another monad
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
Apply f to elements of type A and wrap them in MB.
NYI: This is currently useless since a redefinition is not
allowed for features with generic arguments. Is there a way
we could allow this anyway?
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
monadic operator for bool result, false for nil
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
greater than operator
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
map the Sequence to a new Sequence applying function f to all elements
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
This is an infix operator alias of map enabling piping code like
l := 1..10 | *10 | 300-
to obtain 290,280,270,...200
Note that map and therefore also this operator is lazy, so
_ := (1..10 | say)
will not print anything while
(1..10 | say).for_each _->unit
will print the elements since `for_each` is not lazy.
filter elements using predicate f, infix operator
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
filter elements using predicate f, infix operator
synonym of filter.
synonym of filter.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
check if predicate f holds for all elements
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
check if predicate f holds for at least one element
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
insert element v at position at
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
apply transducer to sequence, returning a sequence of results
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
example usage:
human(age i32) is
ages := map (Sequence i32) human i32 (x -> x.age)
gt_ten := filter (Sequence i32) i32 (x -> x > 10)
xf := ages ∘ gt_ten
say ([human(4), human(12), human(30)].into xf) # [12,30]
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
is this Sequence known to be array backed? If so, this means that operations
like index[] are fast.
like index[] are fast.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
is this Sequence empty?
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
Does this option contain no value of type T?
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
check if argument is a valid index in this sequence.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
Note that this may have a performance in O(i) unless this
Sequence is_array_backed.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
is zero
§(MMA type :monad monad.MA (monad monad.A monad.MA), a MMA) => monad.MA [Inherited from monad] [Abstract feature]join operator
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
§
(MMA
type
:monad monad.MA (monad monad.A monad.MA), a MMA) =>
monad.MA [Inherited from monad]
[Abstract feature]
join operator
NYI: useless since redefinition currently not supported for
feature with generics.
NYI: useless since redefinition currently not supported for
feature with generics.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
get the last element of this Sequence
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
This may take time in O(count), in particular, it may not terminate
for an infinite Sequence.
option represents an optional value of type T