Returns the specified number of elements from the given sequence.
Sequence.Take · [count] · [sequence]
- The maximum number of elements to return.
- The sequence to return elements from.
A sequence containing the specified number of elements, at most.
This can be used in conjunction with Sequence.Skip to get a specific item in a sequence.
As an example, the following would get the fourth element selected by the
Sequence.Take · 1 · Sequence.Skip · 3 · Select.MySelector
Note that skipping 3 elements gives the fourth element because skipping 0 elements would give the first one. If
MySelector selects less than 4 elements, an empty sequence will be produced. If this functionality is needed more than once in a project, it can also be generalized into a function that takes a zero based index and a sequence:
function (index selector) Sequence.Take · 1 · Sequence.Skip · index · selector
Supposing the function was pasted into a global called
GetElement, it could be used anywhere within the project like this:
GetElement · 3 · Select.MySelector