Module ce_lists

List manipulation library.

Description

List manipulation library.

Function Index

between/2Extracts elements between delimeter elements, using an empty list when two delimeters are adjacent.
big_endian_to_integer/1Converts a big-endian list to an integer.
big_endian_to_integer/3Converts a big-endian segment of a list to an integer.
delete/2Returns a list of all but the nth element of a given list.
diff/2Calculates the differences between two ordered lists.
factor/1Factors a list, returning all combinations of sublists.
find_first/2Finds the first occurance of the given term in the given list and returns the 1-based index of where it was found.
grep/2Searches through a list for an element matching the given regexp.
integer_to_big_endian/2Converts an integer to a big-endian list.
integer_to_little_endian/2Converts an integer to a little-endian list.
is_homogenous/1Determines whether the given list is homogenous or not.
little_endian_to_integer/1Converts a little-endian list to an integer.
little_endian_to_integer/3Converts a little-endian segment of a list to an integer.
pairsearch/3Equivalent to pairsearch(term(), 1, [term()], term()).
pairsearch/4Searches for a key in a list of {Key, Value} tuples.
partition/2Splits a list into two sublists at a given point.
replace/3Returns a list with the nth element replaced by a new term.
replace_all/3Returns a list with the all elements equal to the first argument replaced with the second argument.
split/2Splits a list into two based on a predicate.
trunc/1Returns a list of all but the last element of a given list.
zip/2Creates a list of pairs from corresponding elements of two lists.
zipn/1Creates a list of tuples from corresponding elements of a list of lists.

Function Details

between/2

between(D::term(), L::[term()]) -> [term()]

Extracts elements between delimeter elements, using an empty list when two delimeters are adjacent. Can be used for parsing comma-seperated text where two adjacent commas indicates a significant null value in-between.

big_endian_to_integer/1

big_endian_to_integer(List::[integer()]) -> integer()

Converts a big-endian list to an integer.

big_endian_to_integer/3

big_endian_to_integer(List::[integer()], Start::integer(), Length::integer()) -> integer()

Converts a big-endian segment of a list to an integer.

delete/2

delete(X::integer(), T::[term()]) -> [term()]

Returns a list of all but the nth element of a given list.

diff/2

diff(List1::[term()], List2::[term()]) -> [diff()]

Calculates the differences between two ordered lists. The differences are expresses in terms of a list of tags which indicate which elements were inserted or deleted at what positions within the first list. Note that this by no means claims to provide a minimal set of differences!

factor/1

factor(L::[term() | [term()]]) -> [[term()]]

Factors a list, returning all combinations of sublists. e.g. factor([[a,b],c,[d,e]) -> [[a,c,d],[a,c,e],[b,c,d],[b,c,e]]

find_first/2

find_first(X::term(), L::[term()]) -> {ok, integer()} | {error, not_found}

Finds the first occurance of the given term in the given list and returns the 1-based index of where it was found.

grep/2

grep(P::regexp(), L::list()) -> string()

Searches through a list for an element matching the given regexp.

integer_to_big_endian/2

integer_to_big_endian(Integer::integer(), Size::integer()) -> [integer()]

Converts an integer to a big-endian list.

integer_to_little_endian/2

integer_to_little_endian(Integer::integer(), Size::integer()) -> [integer()]

Converts an integer to a little-endian list.

is_homogenous/1

is_homogenous(Tail::[term()]) -> true | false

Determines whether the given list is homogenous or not. If all of the terms of the list are equal, the list is considered homogenous.

little_endian_to_integer/1

little_endian_to_integer(List::[integer()]) -> integer()

Converts a little-endian list to an integer.

little_endian_to_integer/3

little_endian_to_integer(List::[integer()], Start::integer(), Length::integer()) -> integer()

Converts a little-endian segment of a list to an integer.

pairsearch/3

pairsearch(Term::term(), List::[term()], Else::term()) -> term()

Equivalent to pairsearch(term(), 1, [term()], term()).

pairsearch/4

pairsearch(Term::term(), Pos::integer(), List::[term()], Else::term()) -> term()

Searches for a key in a list of {Key, Value} tuples. Returns the value if found, or the Else argument if not found.

partition/2

partition(List::[term()], N::integer()) -> {[term()], [term()]}

Splits a list into two sublists at a given point.

replace/3

replace(X::integer(), T::[term()], G::term()) -> [term()]

Returns a list with the nth element replaced by a new term.

replace_all/3

replace_all(A::term(), B::term(), L::[term()]) -> [term()]

Returns a list with the all elements equal to the first argument replaced with the second argument.

split/2

split(Fun::function(), List::[term()]) -> {[term()], [term()]}

Splits a list into two based on a predicate. The first list returned consists of all the elements for which the predicate returns true, the second, all for which it returns false. The returned lists are both in the same order as the given one.

trunc/1

trunc(T::[term()]) -> [term()]

Returns a list of all but the last element of a given list.

zip/2

zip(A::[term()], B::[term()]) -> [tuple()]

Creates a list of pairs from corresponding elements of two lists. Thanks to Heinz Eriksson for this code.

zipn/1

zipn(Ls::[[term()]]) -> [tuple()]

Creates a list of tuples from corresponding elements of a list of lists. Thanks to Vladimir Sekissov for this code.


Generated by EDoc, Dec 25 2007, 02:37:32.