aboutsummaryrefslogblamecommitdiffstats
path: root/lib/sasl/doc/src/rel/lists2.2.erl
blob: 734bc36bbb2f28960b9a3a6bf86fee1c635b69a3 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13












                                                            
-module(lists2).
-vsn(2).

-export([assoc/2, multi_map/2]).

assoc(Key, [{Key, Val} | _]) -> {ok, Val};
assoc(Key, [H | T]) -> assoc(Key, T);
assoc(Key, []) -> false.

multi_map(Func, [[] | ListOfLists]) -> [];
multi_map(Func, ListOfLists) ->
    [apply(Func, lists:map({erlang, hd}, ListOfLists)) |
     multi_map(Func, lists:map({erlang, tl}, ListOfLists))].