query
On this page

dropEnd

lib.lists.dropEnd

Docs pulled from | This Revision | 10 minutes ago


Remove the last (at most) N elements of a list.

Inputs

count

Number of elements to drop

list

Input list

Type

dropEnd :: Int -> [a] -> [a]

Examples

lib.lists.dropEnd usage example

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

Noogle detected

Aliases

Implementation

The following is the current implementation of this function.

dropEnd = n: xs: take (max 0 (length xs - n)) xs;