Module s2_lists

Lists.

Description

Lists.

Data Types

'maybe'()

'maybe'(A, B) = {ok, A} | {error, B}

alist()

alist(A, B) = [{A, B}]

Function Index

assoc/2assoc(KVs, K) is the value associated with K in KVs.
assoc/3assoc(KVs, K, Def) is the value associated with K in KVs or Def.
butlast/1butlast(Xs) is Xs with its last element removed.
cons/1
cons/2cons(Car, Cdr) is Car consed unto Cdr.
dissoc/2dissoc(KVs, K) is KVs with all K-entries removed.
drop/2drop(N, Xs) is the Nth tail of Xs (empty if Xs has fewer than N elements).
intersperse/2intersperse(X, Ys) is Ys with X interspersed.
is_permutation/2is_permutation(Xs, Ys) is true iff Xs is a permutation of Ys.
partition/2partition(N, Xs) is a list of N-partitions of Xs.
repeatedly/2repeatedly(N, F) is a list of the results of N calls to F.
take/2take(N, Xs) is a list containing the first N elements of Xs (Xs if Xs has fewer than N elements).
to_list/1to_list(X) is the list-representation of X.

Function Details

assoc/2

assoc(L::alist(A, B), A) -> 'maybe'(B, notfound)

assoc(KVs, K) is the value associated with K in KVs.

assoc/3

assoc(KVs::alist(A, B), A, B) -> B

assoc(KVs, K, Def) is the value associated with K in KVs or Def.

butlast/1

butlast(Xs::[A, ...]) -> [A]

butlast(Xs) is Xs with its last element removed.

cons/1

cons(Car) -> any()

cons/2

cons(Car::term(), Cdr::term()) -> maybe_improper_list()

cons(Car, Cdr) is Car consed unto Cdr.

dissoc/2

dissoc(KVs::alist(A, term()), A) -> alist(A, term())

dissoc(KVs, K) is KVs with all K-entries removed.

drop/2

drop(N::integer(), Xs::[term()]) -> [term()]

drop(N, Xs) is the Nth tail of Xs (empty if Xs has fewer than N elements).

intersperse/2

intersperse(X::term(), Ys::[term()]) -> [term()]

intersperse(X, Ys) is Ys with X interspersed.

is_permutation/2

is_permutation(Xs::[A], Ys::[A]) -> boolean()

is_permutation(Xs, Ys) is true iff Xs is a permutation of Ys.

partition/2

partition(N::pos_integer(), Xs::[term()]) -> [[term()]] | []

partition(N, Xs) is a list of N-partitions of Xs.

repeatedly/2

repeatedly(N::non_neg_integer(), F::fun(() -> A)) -> [A]

repeatedly(N, F) is a list of the results of N calls to F.

take/2

take(N::integer(), Xs::[term()]) -> [term()]

take(N, Xs) is a list containing the first N elements of Xs (Xs if Xs has fewer than N elements).

to_list/1

to_list(X::term()) -> [term()]

to_list(X) is the list-representation of X.


Generated by EDoc