Pointless API Docs

pointless/prelude/list.ptls (source)


head(list) link
Get the first element in a list

tail(list) link
Get all elements in a list after the first

last(list) link
Get the last element in a non-empty list

slice(start, end, list) link
Get a sublist of indices [start ... (end - 1)]

concat(lists) link
Lazily concatenate a list of lists into a single list

concatMap(func, lists) link
Map a list-generating function over a list and concatenate output lists

intersperse(sep, list) link
Make a new list with sep element interted between each pervious element

repeat(elem) link
Make an infinite list of a value, repeated

take(n, list) link
Get the first n elements in an list, or the whole list of length < n

drop(n, list) link
Get the elems after the first n elems in an list or empty if length < n

takeWhile(func, list) link
Take from a list the leading elements for which func returns true

takeUntil(func, list) link
Take elements up to (including) the first for which func returns true

dropWhile(func, list) link
Drop the leading elements for which func returns true

dropUntil(func, list) link
Drop elements up to (including) the first for which func returns true

find(func, list) link
Find the first element for which func return true, or None if none exists 

span(func, list) link
span(...) = (takewhile(...), dropWhile(...)) 

groupBy(func, list) link
Return the list of lists of consecutive values for which func(a, b) == true

reverse(list) link
Get the reverse of list

zip(a, b) link
From two lists, get a list of tuple pairs of elems from each list in order 

For lists [a0, a1, a2, ...], [b0, b1, b2, ...], return the list
[(a0, b0), (a1, b1), (a2, b2) ...], with length limited by the length
of the shorter input list

zipN(lists) link
Like zip, but for an arbitrary number of input lists

eager(list) link
Evaluate each value in a list
Useful for catching errors early

isEmpty(list) link
isEmpty(list) = list == Empty

toList(iter) link
Convert iter (a list, array, set, or tuple) to a list

enumerate(list) link
For a list [a, b, c, ...] return [(0, a), (1, b), (2, c), ...]

hasPrefix(prefix, list) link
Return true if list starts with the given prefix of elements

map(func, list) link
Apply a function to each list element, make a list of the results

filter(func, list) link
Apply a test to each list element, make new list of passing elements

reduce(func, acc, list) link
Get a single value given a list, starting value, and accumulator function

Starting with accumulator value acc, update acc <- func(acc, elem)
for each element elem in the list

example: sum(list) = reduce(0, add, list)

reduceFirst(func, list) link
Reduce a non-empty list with first element set as accumulator

scan(func, acc, list) link
Reduce a list with a given function and accumulator, returning a list of
the intermediate accumulator values, including the initial value