query
On this page

take

lib.lists.take

Docs pulled from | This Revision | 10 minutes ago


Return the first (at most) N elements of a list.

Inputs

count

Number of elements to take

list

Input list

Type

take :: int -> [a] -> [a]

Examples

lib.lists.take usage example

take 2 [ "a" "b" "c" "d" ]
=> [ "a" "b" ]
take 2 [ ]
=> [ ]

Noogle detected

Aliases

Implementation

The following is the current implementation of this function.

take =
    count: sublist 0 count;