takeEnd
lib.lists.takeEnd
Docs pulled from | This Revision | 6 minutes ago
Return the last (at most) N elements of a list.
Inputs
count
-
Maximum number of elements to pick
list
-
Input list
Type
takeEnd :: int -> [a] -> [a]
Examples
lib.lists.takeEnd
usage example
takeEnd 2 [ "a" "b" "c" "d" ]
=> [ "c" "d" ]
takeEnd 2 [ ]
=> [ ]
Noogle detected
Implementation
The following is the current implementation of this function.
takeEnd = n: xs: drop (max 0 (length xs - n)) xs;