home
/
code
/
hope.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
blame
|
history
|
raw
|
HEAD
Implement a Key->Value list dictionary.
[hope.git]
/
src
/
hope_list.erl
1
-module(hope_list).
2
3
-export_type(
4
[ t/1
5
]).
6
7
-export(
8
[ unique_preserve_order/1
9
]).
10
11
12
-type t(A) ::
13
[A].
14
15
16
-spec unique_preserve_order(t(A)) ->
17
t(A).
18
unique_preserve_order(L) ->
19
AppendIfNew =
20
fun (X, Xs) ->
21
case lists:member(X, Xs)
22
of true -> Xs
23
; false -> Xs ++ [X]
24
end
25
end,
26
lists:foldl(AppendIfNew, [], L).
This page took
0.061123 seconds
and
4
git commands to generate.