CoCoA:First

From ApCoCoAWiki

First

the first N elements of a list

Description

In the first form, the function is the same as the function <ttref>Head</ttref>;

it returns the first element of the list L. In the second form, it

returns the list of the first N elements of L.

Example

  L := [1,2,3,4,5];
  First(L);
1
-------------------------------
  First(L,3);
[1, 2, 3]
-------------------------------

Syntax

First(L:LIST):OBJECT
First(L:LIST,N:INT):OBJECT

Head

Last

   <type>list</type>