home
/
code
/
hope.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add get with default to dictionary interface.
[hope.git]
/
src
/
hope_kv_list.erl
diff --git
a/src/hope_kv_list.erl
b/src/hope_kv_list.erl
index
be11c31
..
d9a8177
100644
(file)
--- a/
src/hope_kv_list.erl
+++ b/
src/hope_kv_list.erl
@@
-12,6
+12,7
@@
-export(
[ empty/0
, get/2
-export(
[ empty/0
, get/2
+ , get/3
, set/3
, update/3
, pop/2
, set/3
, update/3
, pop/2
@@
-53,6
+54,12
@@
get(T, K) ->
; {K, V} -> {some, V}
end.
; {K, V} -> {some, V}
end.
+-spec get(t(K, V), K, V) ->
+ V.
+get(T, K, Default) ->
+ Vopt = get(T, K),
+ hope_option:get(Vopt, Default).
+
-spec set(t(K, V), K, V) ->
t(K, V).
set(T, K, V) ->
-spec set(t(K, V), K, V) ->
t(K, V).
set(T, K, V) ->
This page took
0.022789 seconds
and
4
git commands to generate.