Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

...

Although it is possible to create a sequence that produces infinite number of elements, it is not recommended. Some operations may require one or two full traversals of the sequence in order to compute, and invoking such an operation on an infinite sequence would never yield result.

Sequence type

sequence<Type>

Subtypes

Supertypes

Comparable types

list<Type>
set<Type>

none

java.lang.Iterable<Type>

...

Parameter type

Result type

{ => sequence<Type> }

sequence<Type>

Sequence can be created with initializer.

...

closure invocation

Result type

sequence<Type>

A sequence may be returned from a closure (see Closures).

...

Operand type

Parameter type

Result type

Type[]

none

sequence<Type>

An array can be used as a sequence.

...

Operand type

Parameter type

Result type

sequence<Type>

{ Type => void }

void

The code passed as a parameter (as a closure literal or by reference) is executed once for each element.

...

Operand type

Parameter type

Result type

sequence<Type>

none

int

Gives number of elements in a sequence.

...

Operand type

Parameter type

Result type

sequence<Type>

none

boolean

Test whether a sequence is empty, that is its size is 0.

...

Operand type

Parameter type

Result type

sequence<Type>

none

boolean

Test whether a sequence contains any elements.

...

Operand type

Parameter type

Result type

sequence<Type>

Type

int

Gives the index of a first occurrence in a sequence of an element that is passed to it as a parameter.

...

Operand type

Parameter type

Result type

sequence<Type>

Type

boolean

Produces boolean value, indicating whether or not a sequence contains the specified element.

...

Operand type

Parameter type

Result type

sequence<Type>

{ Type => boolean }

boolean

Produces boolean value that indicates whether any (in case of any operation) or all (in case of all) of the elements in the input sequence match the condition specified by the closure.

...

Operand type

Parameter type

Result type

sequence<Type>

none

iterator<Type>

Produces an #iterator.

enumerator

Operand type

Parameter type

Result type

sequence<Type>

none

enumerator<Type>

Produces an #enumerator.

Selection and filtering
first

Operand type

Parameter type

Result type

sequence<Type>

none

Type

Yields the first element.

...

Operand type

Parameter type

Result type

sequence<Type>

none

Type

Yields the last element.

...

Operand type

Parameter type

Result type

sequence<Type>

int

sequence<Type>

Produces a sequence that is sub-sequence of the original one, starting from first element and of size count.

...

Operand type

Parameter type

Result type

sequence<Type>

int

sequence<Type>

Produces a sequence that is sub-sequence of the original one, containing all elements starting with the element at index count.

...

Operand type

Parameter type

Result type

sequence<Type>

int

sequence<Type>

Produces a sequence that is a sub-sequence of the original one, containing all elements starting with first and up to (but not including) the element at index size minus count. In other words, this operation returns a sequence with all elements from the original one except the last count elements.

...

Operand type

Parameter type

Result type

sequence<Type>

int

sequence<Type>

Produces a sequence that is a sub-sequence of the original one, containing all elements starting with the element at index size minus count. In other words, this operations returns a sequence with count elements from the end of the original sequence, in the original order.

...

Operand type

Parameter type

Result type

sequence<Type>

int
int

sequence<Type>

Results in a sequence that is a sub-sequence of the original one, containing all elements starting with the element at index start and up to (but not including) the element at index end. It is a requirement that start is no greater than end.

...

Operand type

Parameter type

Result type

sequence<Type>

{ Type => boolean }

sequence<Type>

Produces a sequence that is a sub-sequence of the original one, with all elements for which the code passed as a parameter returns true.

...

Operand type

Parameter type

Result type

sequence<Type>

{ Type => boolean }

Type

Results in the first element that matches the parameter closure.

...

Operand type

Parameter type

Result type

sequence<Type>

{ Type => boolean }

Type

Results in the last element that matches the parameter closure.

...

Operand type

Parameter type

Result type

sequence<Type>

{ Type => Type2 }

sequence<Type2>

Results in a sequence consisting of elements, each of which is the result of applying the parameter function to each element of the original sequence in turn.

...

Operand type

Parameter type

Result type

sequence<Type>

{ Type => sequence<Type2> }

sequence<Type2>

Produces a sequence that is a concatenation of all sequences, which are all the results of applying the parameter closure to each element of the original sequence in turn. The statements skip and stop are available within the parameter closure.

...

Operand type

Parameter type

Result type

sequence<Type>

none

sequence<Type>

Produces a sequence, which contains all elements from the original sequence in the original order, with all the elements having cardinality exactly 1. Of all occurrences of an element in the original sequence only the first occurrence is included in the resulting sequence.

...

Operand type

Parameter type

Result type

sequence<Type>

{ Type => Type2 }
boolean

sequence<Type>

Produces a sequence with all elements from the original one in the order, which corresponds to an order induced by an imaginary sequence produced by applying the selector function to each element in the original sequence in turn. The selector function can be thought of as returning a key, which is used to sort elements in a sequence. The ascending parameter controls the sort order.

...

Operand type

Parameter type

Result type

sequence<Type>

{ Type => Type2 }
boolean

sequence<Type>

Equivalent to sortBy, unless used as a chain operation immediately following sortBy or another alsoSortBy. The result is a sequence sorted with a compound key, with the first component taken from previous sortBy or alsoSortBy (which is also a compound key), and the last component taken from this operation.

...

Operand type

Parameter type

Result type

sequence<Type>

{ Type, Type => int }
boolean sequence<Type>

Produces a sequence containing all elements from the original one in the order produced by applying the comparator function (passed as a closure literal or by reference) to a list with elements from the original sequence. The ascending parameter controls the sort order (order is reversed if the value is false).

...

Operand type

Parameter type

Result type

sequence<Type>

sequence<Type>

sequence<Type>

Produces a sequence containing elements contained both by the original sequence and the parameter sequence.

...

Operand type

Parameter type

Result type

sequence<Type>

sequence<Type>

sequence<Type>

Produces a sequence containing all elements from the original sequence that are not also members of the parameter sequence.

...

Operand type

Parameter type

Result type

sequence<Type>

sequence<Type>

sequence<Type>

Produces a sequence containing elements both from the original sequence and the one passed as a parameter.

...

Operand type

Parameter type

Result type

sequence<Type>

sequence<Type>

sequence<Type>

Produces exclusive disjunction (symmetric difference) of the original sequence and the one passed as a parameter.

...

Operand type

Parameter type

Result type

sequence<Type>

sequence<Type> }

sequence<Type>

Produces a sequence, which is a concatenation of the original one with the sequence passed as a parameter

...

Operand type

Parameter type

Result type

sequence<Type>

{ Type, Type => Type }

Type

...

Operand type

Parameter type

Result type

Applicable for

seed
sequence<Type>

{ Z, Type => Z }

Z

foldLeft

seed
sequence<Type>

{ Type, Z => Z }

Z

foldRight

...

Operand type

Parameter type

Result type

sequence< ? extends string >

string (optional)

string

This operation is only available on a sequence of strings. The result is a string that is produced by concatenating all elements with the optional separator. The default separator is " " (single space).

...

Operand type

Parameter type

Result type

sequence<Type>

none

list<Type>

Returns new list containing all the elements from the original sequence.

...

Operand type

Parameter type

Result type

sequence<Type>

none

Type*[]*

Returns new array containing all the elements from the original sequence.

...