home
/
code
/
hope.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c1672ac
)
Clarify map lifting and application.
author
Siraaj Khandkar
<siraaj@khandkar.net>
Tue, 12 Aug 2014 20:31:08 +0000
(16:31 -0400)
committer
Siraaj Khandkar
<siraaj@khandkar.net>
Tue, 12 Aug 2014 20:31:08 +0000
(16:31 -0400)
src/hope_kv_list.erl
patch
|
blob
|
blame
|
history
diff --git
a/src/hope_kv_list.erl
b/src/hope_kv_list.erl
index
431932f
..
468c8d8
100644
(file)
--- a/
src/hope_kv_list.erl
+++ b/
src/hope_kv_list.erl
@@
-52,16
+52,15
@@
update(T, K, F) ->
set(T, K, V2).
iter(T, F1) ->
set(T, K, V2).
iter(T, F1) ->
- F2 = lift(F1),
+ F2 = lift
_map
(F1),
lists:foreach(F2, T).
map(T, F1) ->
lists:foreach(F2, T).
map(T, F1) ->
- F2 = lift(F1),
- F3 = fun ({K, _}=X) -> {K, F2(X)} end,
- lists:map(F3, T).
+ F2 = fun ({K, _}=X) -> {K, apply_map(F1, X)} end,
+ lists:map(F2, T).
filter(T, F1) ->
filter(T, F1) ->
- F2 = lift(F1),
+ F2 = lift
_map
(F1),
lists:filter(F2, T).
fold(T, F1, Accumulator) ->
lists:filter(F2, T).
fold(T, F1, Accumulator) ->
@@
-80,5
+79,8
@@
of_kv_list(List) ->
%% Helpers
%% ============================================================================
%% Helpers
%% ============================================================================
-lift(F) ->
- fun ({K, V}) -> F(K, V) end.
+lift_map(F) ->
+ fun (X) -> apply_map(F, X) end.
+
+apply_map(F, {K, V}) ->
+ F(K, V).
This page took
0.035844 seconds
and
4
git commands to generate.