up previous next
first

the first N elements of a list

Syntax
first(L: LIST): OBJECT
first(L: LIST, N: INT): OBJECT

Description
In the first form the function returns the first element of the list L, same as L[1] . In the second form, it returns the list of the first N elements of L, same as [ L[i] | i in 1..N ]

Example
/**/  L := [1,2,3,4,5];
/**/  first(L);
1

/**/  first(L,3);
[1, 2, 3]

See Also