filter_map/2 | Filter a list and then apply a mapping function to each element. |
flatten_once/1 | Flatten a list of lists once. |
foldl_cons/3 | |
partition_map/2 | Partition a list and then apply a map to both parts. |
pmap/3 | Invoke Mod:Fun/1 for each element in List in parallel. |
pmap/5 | Invoke Mod:Fun/1 for each element in List in parallel, but require
that parallel processes reply before Timeout or else Error will be
inserted in the result list in place of a late process' answer. |
filter_map(Fun::'fun'(), List::[term()]) -> [term()]
Filter a list and then apply a mapping function to each element. Fun
is applied to each element in List
in order. If Fun
returns {true,
Value}
then Value
is part of the result; if Fun
returns false
then we
go on to the next element. The result is effectively doing a filter followed
by a map, which is pretty much what list comprehensions do.
flatten_once(Xs::[term()]) -> [term()]
Flatten a list of lists once. This allows you to turn, for example, a
list of lists of strings into a list of strings, whereas lists:flatten/1
would turn it into one big string.
foldl_cons(F, Acc0, L) -> any()
partition_map(Fun::'fun'(), List::[term()]) -> {[term()], [term()]}
Partition a list and then apply a map to both parts. The result is a
tuple of two lists. Fun
is applied to each element in List
in order. If
Fun
returns {true, Value}
then Value
is inserted into the first list;
if Fun
returns {false, Value}
then Value
is inserted into the second
list.
pmap(Mod::atom(), Fun::atom(), List::[term()]) -> [term()]
Equivalent to pmap(Mod, Fun, List, infinity, error).
Invoke Mod:Fun/1
for each element in List
in parallel.
pmap(Mod::atom(), Fun::atom(), List::[term()], Timeout::timeout(), Error::term()) -> [term()]
Invoke Mod:Fun/1
for each element in List
in parallel, but require
that parallel processes reply before Timeout
or else Error
will be
inserted in the result list in place of a late process' answer.
Mod:Fun/1
will be the process ID of the parent
process. The child process should send back a message of the form {Pid,
Answer}
where Pid
is the child's process ID. Whatever Answer
is will be
placed in the appropriate position as the result of pmap
. Supplying Pid
is necessary to keep the order so that each element of the output matches up
with the corresponding element of the input at the same index.
Generated by EDoc, Feb 9 2011, 21:50:42.