Browse Source

examples: update association_list

pull/22/merge
darkf 8 years ago
parent
commit
989db3dc10
  1. 4
      examples/association_list.lamb

4
examples/association_list.lamb

@ -2,7 +2,7 @@
map_insert(assoc, pair) -> pair :: assoc.
-- lookup by key
map_lookup([], _) -> ("nothing").
map_lookup([], _) -> ("nothing",).
map_lookup((k,v)::xs, key) ->
if k == key then ("just", v)
else map_lookup(xs, key).
@ -21,5 +21,5 @@ m = map_insert(m, ("ready", "go")).
print(m).
print(map_remove(m, "k")).
("just", x) = map_lookup(m, "hi").
("nothing") = map_lookup(m, "foo").
("nothing",) = map_lookup(m, "foo").
print(x).
Loading…
Cancel
Save