Take
Returns the first n elements of a list.
$ wo 'Take[{1, 2, 3, 4, 5}, 3]'
{1, 2, 3}
$ wo 'Take[{1, 2, 3, 4, 5}, 1]'
{1}
$ wo 'Take[{1, 2, 3}, 5]'
Take::take: Cannot take positions 1 through 5 in {1, 2, 3}.
.* (regex*)
Take[{1, 2, 3}, 5]
$ wo 'Take[{a, b, c, d}, 2]'
{a, b}
$ wo 'Take[{1.5, 2.5, 3.5, 4.5}, 2]'
{1.5, 2.5}
$ wo 'Take[{10, 20, 30, 40}, 4]'
{10, 20, 30, 40}
$ wo 'Take[{1, 2, 3, 4, 5}, 5]'
{1, 2, 3, 4, 5}
A span i;;j takes elements i through j.
$ wo 'Take[{1, 2, 3, 4, 5}, 2;;4]'
{2, 3, 4}
$ wo 'Take[{1, 2, 3, 4, 5}, 1;;-1;;2]'
{1, 3, 5}
An empty span may sit one past either end, which is how a partition asks
for "everything after the last element":
$ wo 'Take[{1, 2, 3}, {4, -1}]'
{}
$ wo 'Take[{1, 2, 3}, {1, 0}]'
{}
Anything further out is still an error:
$ wo 'Take[{1, 2, 3}, {5, -1}]'
Take::take: Cannot take positions 5 through -1 in {1, 2, 3}.
Take[{1, 2, 3}, {5, -1}]