1maps(3)                    Erlang Module Definition                    maps(3)
2
3
4

NAME

6       maps - Maps processing functions.
7

DESCRIPTION

9       This  module  contains  functions  for  maps processing. The Efficiency
10       Guide contains a chapter that describes how to use maps efficiently.
11

DATA TYPES

13       iterator(Key, Value)
14
15              An iterator representing the associations in a map with keys  of
16              type Key and values of type Value.
17
18              Created using maps:iterator/1 or maps:iterator/2.
19
20              Consumed by:
21
22                * maps:next/1
23
24                * maps:filter/2
25
26                * maps:filtermap/2
27
28                * maps:fold/3
29
30                * maps:foreach/2
31
32                * maps:map/2
33
34                * maps:to_list/1
35
36       iterator() = iterator(term(), term())
37
38       iterator_order(Key) =
39           undefined | ordered | reversed |
40           fun((A :: Key, B :: Key) -> boolean())
41
42              Key-based  iterator  order  option  that can be one of undefined
43              (default for maps:iterator/1), ordered (sorted  in  map-key  or‐
44              der), reversed, or a custom sorting function.
45
46              Used by maps:iterator/2.
47
48              The   Expressions section contains descriptions of how terms are
49              ordered.
50
51       iterator_order() = iterator_order(term())
52

EXPORTS

54       filter(Pred, MapOrIter) -> Map
55
56              Types:
57
58                 Pred = fun((Key, Value) -> boolean())
59                 MapOrIter = #{Key => Value} | iterator(Key, Value)
60                 Map = #{Key => Value}
61
62              Returns a map Map for which predicate Pred holds true in  MapOr‐
63              Iter.
64
65              The call fails with a {badmap,Map} exception if MapOrIter is not
66              a map or valid iterator, or with badarg if Pred is not  a  func‐
67              tion of arity 2.
68
69              Example:
70
71              > M = #{a => 2, b => 3, c=> 4, "a" => 1, "b" => 2, "c" => 4},
72                Pred = fun(K,V) -> is_atom(K) andalso (V rem 2) =:= 0 end,
73                maps:filter(Pred,M).
74              #{a => 2,c => 4}
75
76       filtermap(Fun, MapOrIter) -> Map
77
78              Types:
79
80                 Fun = fun((Key, Value1) -> boolean() | {true, Value2})
81                 MapOrIter = #{Key => Value1} | iterator(Key, Value1)
82                 Map = #{Key => Value1 | Value2}
83
84              Returns a map Map that is the result of calling Fun(Key, Value1)
85              for every Key to value Value1 association in  MapOrIter  in  any
86              order.
87
88              If  Fun(Key,  Value1) returns true, the association is copied to
89              the result map. If it returns  false,  the  association  is  not
90              copied. If it returns {true, NewValue}, the value for Key is re‐
91              placed with NewValue in the result map.
92
93              The call fails with a {badmap,Map} exception if MapOrIter is not
94              a map or valid iterator, or with badarg if Fun is not a function
95              of arity 2.
96
97              Example:
98
99              > Fun = fun(K,V) when is_atom(K) -> {true, V*2}; (_,V) -> (V rem 2) =:= 0 end,
100                Map = #{k1 => 1, "k2" => 2, "k3" => 3},
101                maps:filtermap(Fun,Map).
102              #{k1 => 2,"k2" => 2}
103
104       find(Key, Map) -> {ok, Value} | error
105
106              Types:
107
108                 Map = #{Key => Value, term() => term()}
109
110              Returns a tuple {ok, Value}, where Value is the value associated
111              with Key, or error if no value is associated with Key in Map.
112
113              The  call  fails  with  a {badmap,Map} exception if Map is not a
114              map.
115
116              Example:
117
118              > Map = #{"hi" => 42},
119                Key = "hi",
120                maps:find(Key,Map).
121              {ok,42}
122
123       fold(Fun, Init, MapOrIter) -> Acc
124
125              Types:
126
127                 Fun = fun((Key, Value, AccIn) -> AccOut)
128                 Init = term()
129                 Acc = AccOut
130                 AccIn = Init | AccOut
131                 MapOrIter = #{Key => Value} | iterator(Key, Value)
132
133              Calls F(Key, Value, AccIn) for every Key to value Value associa‐
134              tion  in  MapOrIter in any order. Function fun F/3 must return a
135              new accumulator, which is passed to the  next  successive  call.
136              This  function  returns  the final value of the accumulator. The
137              initial accumulator value Init is returned if the map is empty.
138
139              The call fails with a {badmap,Map} exception if MapOrIter is not
140              a map or valid iterator, or with badarg if Fun is not a function
141              of arity 3.
142
143              Example:
144
145              > Fun = fun(K,V,AccIn) when is_list(K) -> AccIn + V end,
146                Map = #{"k1" => 1, "k2" => 2, "k3" => 3},
147                maps:fold(Fun,0,Map).
148              6
149
150       foreach(Fun, MapOrIter) -> ok
151
152              Types:
153
154                 Fun = fun((Key, Value) -> term())
155                 MapOrIter = #{Key => Value} | iterator(Key, Value)
156
157              Calls fun F(Key, Value) for every Key to value Value association
158              in MapOrIter in any order.
159
160              The call fails with a {badmap,Map} exception if MapOrIter is not
161              a map or valid iterator, or with badarg if Fun is not a function
162              of arity 2.
163
164       from_keys(Keys, Value) -> Map
165
166              Types:
167
168                 Keys = list()
169                 Value = term()
170                 Map = map()
171
172              Takes a list of keys and a value and builds a map where all keys
173              point to the same value. The key can be in any order,  and  keys
174              and value can be of any term.
175
176              Example:
177
178              > Keys = ["a", "b", "c"], maps:from_keys(Keys, ok).
179              #{"a" => ok,"b" => ok,"c" => ok}
180
181       from_list(List) -> Map
182
183              Types:
184
185                 List = [{Key, Value}]
186                 Key = Value = term()
187                 Map = map()
188
189              Takes  a list of key-value tuples elements and builds a map. The
190              associations can be in any order, and both keys  and  values  in
191              the association can be of any term. If the same key appears more
192              than once, the latter (right-most) value is used and the  previ‐
193              ous values are ignored.
194
195              Example:
196
197              > List = [{"a",ignored},{1337,"value two"},{42,value_three},{"a",1}],
198                maps:from_list(List).
199              #{42 => value_three,1337 => "value two","a" => 1}
200
201       get(Key, Map) -> Value
202
203              Types:
204
205                 Key = term()
206                 Map = map()
207                 Value = term()
208
209              Returns value Value associated with Key if Map contains Key.
210
211              The  call  fails  with  a {badmap,Map} exception if Map is not a
212              map, or with a {badkey,Key} exception if no value is  associated
213              with Key.
214
215              Example:
216
217              > Key = 1337,
218                Map = #{42 => value_two,1337 => "value one","a" => 1},
219                maps:get(Key,Map).
220              "value one"
221
222       get(Key, Map, Default) -> Value | Default
223
224              Types:
225
226                 Map = #{Key => Value, term() => term()}
227
228              Returns  value Value associated with Key if Map contains Key. If
229              no value is associated with Key, Default is returned.
230
231              The call fails with a {badmap,Map} exception if  Map  is  not  a
232              map.
233
234              Example:
235
236              > Map = #{ key1 => val1, key2 => val2 }.
237              #{key1 => val1,key2 => val2}
238              > maps:get(key1, Map, "Default value").
239              val1
240              > maps:get(key3, Map, "Default value").
241              "Default value"
242
243       groups_from_list(KeyFun, List) -> GroupsMap
244
245              Types:
246
247                 KeyFun = fun((Elem) -> Key)
248                 GroupsMap = #{Key => Group}
249                 Key = term()
250                 List = Group = [Elem]
251                 Elem = term()
252
253              Partitions the given List into a map of groups.
254
255              The  result  is a map where each key is given by KeyFun and each
256              value is a list of elements from the given List for which KeyFun
257              returned the same key.
258
259              The  order  of elements within each group list is preserved from
260              the original list.
261
262              Examples:
263
264              > EvenOdd = fun(X) -> case X rem 2 of 0 -> even; 1 -> odd end end,
265              maps:groups_from_list(EvenOdd, [1, 2, 3]).
266              #{even => [2], odd => [1, 3]}
267              > maps:groups_from_list(fun erlang:length/1, ["ant", "buffalo", "cat", "dingo"]).
268              #{3 => ["ant", "cat"], 5 => ["dingo"], 7 => ["buffalo"]}
269
270       groups_from_list(KeyFun, ValueFun, List) -> GroupsMap
271
272              Types:
273
274                 KeyFun = fun((Elem) -> Key)
275                 ValueFun = fun((Elem) -> Value)
276                 GroupsMap = #{Key := Group}
277                 Key = Value = term()
278                 List = [Elem]
279                 Group = [Value]
280                 Elem = term()
281
282              Partitions the given List into a map of groups.
283
284              The result is a map where each key is given by KeyFun  and  each
285              value is a list of elements from the given List, mapped via Val‐
286              ueFun, for which KeyFun returned the same key.
287
288              The order of elements within each group list is  preserved  from
289              the original list.
290
291              Examples:
292
293              > EvenOdd = fun(X) -> case X rem 2 of 0 -> even; 1 -> odd end end,
294              > Square = fun(X) -> X * X end,
295              > maps:groups_from_list(EvenOdd, Square, [1, 2, 3]).
296              #{even => [4], odd => [1, 9]}
297              > maps:groups_from_list(
298               fun erlang:length/1,
299               fun lists:reverse/1,
300               ["ant", "buffalo", "cat", "dingo"]).
301              #{3 => ["tna", "tac"],5 => ["ognid"],7 => ["olaffub"]}
302
303       intersect(Map1, Map2) -> Map3
304
305              Types:
306
307                 Map1 = #{Key => term()}
308                 Map2 = #{term() => Value2}
309                 Map3 = #{Key => Value2}
310
311              Intersects  two  maps into a single map Map3. If a key exists in
312              both maps, the value in Map1 is superseded by the value in Map2.
313
314              The call fails with a {badmap,Map} exception if Map1 or Map2  is
315              not a map.
316
317              Example:
318
319              > Map1 = #{a => "value_one", b => "value_two"},
320                Map2 = #{a => 1, c => 2},
321                maps:intersect(Map1,Map2).
322              #{a => 1}
323
324       intersect_with(Combiner, Map1, Map2) -> Map3
325
326              Types:
327
328                 Map1 = #{Key => Value1}
329                 Map2 = #{term() => Value2}
330                 Combiner = fun((Key, Value1, Value2) -> CombineResult)
331                 Map3 = #{Key => CombineResult}
332
333              Intersects  two  maps into a single map Map3. If a key exists in
334              both maps, the value in Map1 is combined with the value in  Map2
335              by  the  Combiner fun. When Combiner is applied the key that ex‐
336              ists in both maps is the first parameter, the value from Map1 is
337              the  second  parameter, and the value from Map2 is the third pa‐
338              rameter.
339
340              The call fails with a {badmap,Map} exception if Map1 or Map2  is
341              not a map. The call fails with a badarg exception if Combiner is
342              not a fun that takes three arguments.
343
344              Example:
345
346              > Map1 = #{a => "value_one", b => "value_two"},
347                Map2 = #{a => 1, c => 2},
348                maps:intersect_with(fun(_Key, Value1, Value2) -> {Value1, Value2} end, Map1, Map2).
349              #{a => {"value_one",1}}
350
351       is_key(Key, Map) -> boolean()
352
353              Types:
354
355                 Key = term()
356                 Map = map()
357
358              Returns true if map Map contains Key and  returns  false  if  it
359              does not contain the Key.
360
361              The  call  fails  with  a {badmap,Map} exception if Map is not a
362              map.
363
364              Example:
365
366              > Map = #{"42" => value}.
367              #{"42" => value}
368              > maps:is_key("42",Map).
369              true
370              > maps:is_key(value,Map).
371              false
372
373       iterator(Map) -> Iterator
374
375              Types:
376
377                 Map = #{Key => Value}
378                 Iterator = iterator(Key, Value)
379
380              Returns a map iterator Iterator that can be used by  maps:next/1
381              to  traverse the key-value associations in a map. When iterating
382              over a map, the memory usage is guaranteed to be bounded no mat‐
383              ter the size of the map.
384
385              The  call  fails  with  a {badmap,Map} exception if Map is not a
386              map.
387
388              Example:
389
390              > M = #{ a => 1, b => 2 }.
391              #{a => 1,b => 2}
392              > I = maps:iterator(M), ok.
393              ok
394              > {K1, V1, I2} = maps:next(I), {K1, V1}.
395              {a,1}
396              > {K2, V2, I3} = maps:next(I2),{K2, V2}.
397              {b,2}
398              > maps:next(I3).
399              none
400
401       iterator(Map, Order) -> Iterator
402
403              Types:
404
405                 Map = #{Key => Value}
406                 Order = iterator_order(Key)
407                 Iterator = iterator(Key, Value)
408
409              Returns a map iterator Iterator that can be used by  maps:next/1
410              to  traverse  the  key-value associations in a map sorted by key
411              using the given Order.
412
413              The call fails with a {badmap,Map} exception if Map is not a map
414              or if Order is invalid.
415
416              Example (when Order is ordered):
417
418              > M = #{ a => 1, b => 2 }.
419              #{a => 1,b => 2}
420              > OrdI = maps:iterator(M, ordered), ok.
421              ok
422              > {K1, V1, OrdI2} = maps:next(OrdI), {K1, V1}.
423              {a,1}
424              > {K2, V2, OrdI3} = maps:next(OrdI2),{K2, V2}.
425              {b,2}
426              > maps:next(OrdI3).
427              none
428
429
430              Example (when Order is reversed):
431
432              > M = #{ a => 1, b => 2 }.
433              #{a => 1,b => 2}
434              > RevI = maps:iterator(M, reversed), ok.
435              ok
436              > {K2, V2, RevI2} = maps:next(RevI), {K2, V2}.
437              {b,2}
438              > {K1, V1, RevI3} = maps:next(RevI2),{K1, V1}.
439              {a,1}
440              > maps:next(RevI3).
441              none
442
443
444              Example (when Order is an arithmetic sorting function):
445
446              > M = #{ -1 => a, -1.0 => b, 0 => c, 0.0 => d }.
447              #{-1 => a,0 => c,-1.0 => b,0.0 => d}
448              > ArithOrdI = maps:iterator(M, fun(A, B) -> A =< B end), ok.
449              ok
450              > maps:to_list(ArithOrdI).
451              [{-1,a},{-1.0,b},{0,c},{0.0,d}]
452              > ArithRevI = maps:iterator(M, fun(A, B) -> B < A end), ok.
453              ok
454              > maps:to_list(ArithRevI).
455              [{0.0,d},{0,c},{-1.0,b},{-1,a}]
456
457
458       keys(Map) -> Keys
459
460              Types:
461
462                 Map = #{Key => term()}
463                 Keys = [Key]
464
465              Returns  a  complete  list  of keys, in any order, which resides
466              within Map.
467
468              The call fails with a {badmap,Map} exception if  Map  is  not  a
469              map.
470
471              Example:
472
473              > Map = #{42 => value_three,1337 => "value two","a" => 1},
474                maps:keys(Map).
475              [42,1337,"a"]
476
477       map(Fun, MapOrIter) -> Map
478
479              Types:
480
481                 Fun = fun((Key, Value1) -> Value2)
482                 MapOrIter = #{Key => Value1} | iterator(Key, Value1)
483                 Map = #{Key => Value2}
484
485              Produces  a  new  map Map by calling function fun F(Key, Value1)
486              for every Key to value Value1 association in  MapOrIter  in  any
487              order. Function fun Fun/2 must return value Value2 to be associ‐
488              ated with key Key for the new map Map.
489
490              The call fails with a {badmap,Map} exception if MapOrIter is not
491              a map or valid iterator, or with badarg if Fun is not a function
492              of arity 2.
493
494              Example:
495
496              > Fun = fun(K,V1) when is_list(K) -> V1*2 end,
497                Map = #{"k1" => 1, "k2" => 2, "k3" => 3},
498                maps:map(Fun,Map).
499              #{"k1" => 2,"k2" => 4,"k3" => 6}
500
501       merge(Map1, Map2) -> Map3
502
503              Types:
504
505                 Map1 = Map2 = Map3 = map()
506
507              Merges two maps into a single map Map3. If  two  keys  exist  in
508              both maps, the value in Map1 is superseded by the value in Map2.
509
510              The  call fails with a {badmap,Map} exception if Map1 or Map2 is
511              not a map.
512
513              Example:
514
515              > Map1 = #{a => "value_one", b => "value_two"},
516                Map2 = #{a => 1, c => 2},
517                maps:merge(Map1,Map2).
518              #{a => 1,b => "value_two",c => 2}
519
520       merge_with(Combiner, Map1, Map2) -> Map3
521
522              Types:
523
524                 Map1 = #{Key1 => Value1}
525                 Map2 = #{Key2 => Value2}
526                 Combiner = fun((Key1, Value1, Value2) -> CombineResult)
527                 Map3 = #{Key1 =>  CombineResult,  Key1  =>  Value1,  Key2  =>
528                 Value2}
529
530              Merges  two maps into a single map Map3. If a key exists in both
531              maps, the value in Map1 is combined with the value  in  Map2  by
532              the  Combiner  fun. When Combiner is applied the key that exists
533              in both maps is the first parameter, the value from Map1 is  the
534              second  parameter,  and the value from Map2 is the third parame‐
535              ter.
536
537              The call fails with a {badmap,Map} exception if Map1 or Map2  is
538              not a map. The call fails with a badarg exception if Combiner is
539              not a fun that takes three arguments.
540
541              Example:
542
543              > Map1 = #{a => "value_one", b => "value_two"},
544                Map2 = #{a => 1, c => 2},
545                maps:merge_with(fun(_Key, Value1, Value2) -> {Value1, Value2} end, Map1, Map2).
546              #{a => {"value_one",1},b => "value_two",c => 2}
547
548       new() -> Map
549
550              Types:
551
552                 Map = #{}
553
554              Returns a new empty map.
555
556              Example:
557
558              > maps:new().
559              #{}
560
561       next(Iterator) -> {Key, Value, NextIterator} | none
562
563              Types:
564
565                 Iterator = NextIterator = iterator(Key, Value)
566
567              Returns the next key-value association in Iterator and a new it‐
568              erator for the remaining associations in the iterator.
569
570              If  there  are no more associations in the iterator, none is re‐
571              turned.
572
573              Example:
574
575              > Map = #{a => 1, b => 2, c => 3}.
576              #{a => 1,b => 2,c => 3}
577              > I = maps:iterator(Map), ok.
578              ok
579              > {K1, V1, I1} = maps:next(I), {K1, V1}.
580              {a,1}
581              > {K2, V2, I2} = maps:next(I1), {K2, V2}.
582              {b,2}
583              > {K3, V3, I3} = maps:next(I2), {K3, V3}.
584              {c,3}
585              > maps:next(I3).
586              none
587
588       put(Key, Value, Map1) -> Map2
589
590              Types:
591
592                 Key = Value = term()
593                 Map1 = Map2 = map()
594
595              Associates Key with value Value and inserts the association into
596              map Map2. If key Key already exists in map Map1, the old associ‐
597              ated value is replaced by value Value. The  function  returns  a
598              new map Map2 containing the new association and the old associa‐
599              tions in Map1.
600
601              The call fails with a {badmap,Map} exception if Map1  is  not  a
602              map.
603
604              Example:
605
606              > Map = #{"a" => 1}.
607              #{"a" => 1}
608              > maps:put("a", 42, Map).
609              #{"a" => 42}
610              > maps:put("b", 1337, Map).
611              #{"a" => 1,"b" => 1337}
612
613       remove(Key, Map1) -> Map2
614
615              Types:
616
617                 Key = term()
618                 Map1 = Map2 = map()
619
620              Removes  the  Key,  if  it exists, and its associated value from
621              Map1 and returns a new map Map2 without key Key.
622
623              The call fails with a {badmap,Map} exception if Map1  is  not  a
624              map.
625
626              Example:
627
628              > Map = #{"a" => 1}.
629              #{"a" => 1}
630              > maps:remove("a",Map).
631              #{}
632              > maps:remove("b",Map).
633              #{"a" => 1}
634
635       size(Map) -> integer() >= 0
636
637              Types:
638
639                 Map = map()
640
641              Returns the number of key-value associations in Map. This opera‐
642              tion occurs in constant time.
643
644              Example:
645
646              > Map = #{42 => value_two,1337 => "value one","a" => 1},
647                maps:size(Map).
648              3
649
650       take(Key, Map1) -> {Value, Map2} | error
651
652              Types:
653
654                 Map1 = #{Key => Value, term() => term()}
655                 Map2 = #{term() => term()}
656
657              The function removes the Key, if it exists, and  its  associated
658              value  from  Map1 and returns a tuple with the removed Value and
659              the new map Map2 without key Key. If the key does not exist  er‐
660              ror is returned.
661
662              The  call will fail with a {badmap,Map} exception if Map1 is not
663              a map.
664
665              Example:
666
667              > Map = #{"a" => "hello", "b" => "world"}.
668              #{"a" => "hello", "b" => "world"}
669              > maps:take("a",Map).
670              {"hello",#{"b" => "world"}}
671              > maps:take("does not exist",Map).
672              error
673
674       to_list(MapOrIterator) -> [{Key, Value}]
675
676              Types:
677
678                 MapOrIterator = #{Key => Value} | iterator(Key, Value)
679
680              Returns a list of pairs representing the key-value  associations
681              of  MapOrIterator,  where  the pairs [{K1,V1}, ..., {Kn,Vn}] are
682              returned in arbitrary order.
683
684              The call fails with a {badmap,Map} exception if MapOrIterator is
685              not a map or an iterator obtained by a call to iterator/1 or it‐
686              erator/2.
687
688              Example:
689
690              > Map = #{42 => value_three,1337 => "value two","a" => 1},
691                maps:to_list(Map).
692              [{42,value_three},{1337,"value two"},{"a",1}]
693
694              Example (using iterator/2):
695
696              > Map = #{ z => 1, y => 2, x => 3 }.
697              #{x => 3,y => 2,z => 1}
698              > maps:to_list(maps:iterator(Map, ordered)).
699              [{x,3},{y,2},{z,1}]
700
701
702       update(Key, Value, Map1) -> Map2
703
704              Types:
705
706                 Map1 = #{Key := term(), term() => term()}
707                 Map2 = #{Key := Value, term() => term()}
708
709              If Key exists in Map1, the old associated value is  replaced  by
710              value  Value. The function returns a new map Map2 containing the
711              new associated value.
712
713              The call fails with a {badmap,Map} exception if Map1  is  not  a
714              map,  or with a {badkey,Key} exception if no value is associated
715              with Key.
716
717              Example:
718
719              > Map = #{"a" => 1}.
720              #{"a" => 1}
721              > maps:update("a", 42, Map).
722              #{"a" => 42}
723
724       update_with(Key, Fun, Map1) -> Map2
725
726              Types:
727
728                 Map1 = #{Key := Value1, term() => term()}
729                 Map2 = #{Key := Value2, term() => term()}
730                 Fun = fun((Value1) -> Value2)
731
732              Update a value in a Map1 associated with Key by calling  Fun  on
733              the  old  value to get a new value. An exception {badkey,Key} is
734              generated if Key is not present in the map.
735
736              Example:
737
738              > Map = #{"counter" => 1},
739                Fun = fun(V) -> V + 1 end,
740                maps:update_with("counter",Fun,Map).
741              #{"counter" => 2}
742
743       update_with(Key, Fun, Init, Map1) -> Map2
744
745              Types:
746
747                 Map1 = #{Key => Value1, term() => term()}
748                 Map2 = #{Key := Value2 | Init, term() => term()}
749                 Fun = fun((Value1) -> Value2)
750
751              Update a value in a Map1 associated with Key by calling  Fun  on
752              the  old value to get a new value. If Key is not present in Map1
753              then Init will be associated with Key.
754
755              Example:
756
757              > Map = #{"counter" => 1},
758                Fun = fun(V) -> V + 1 end,
759                maps:update_with("new counter",Fun,42,Map).
760              #{"counter" => 1,"new counter" => 42}
761
762       values(Map) -> Values
763
764              Types:
765
766                 Map = #{term() => Value}
767                 Values = [Value]
768
769              Returns a complete list of values, in arbitrary order, contained
770              in map Map.
771
772              The  call  fails  with  a {badmap,Map} exception if Map is not a
773              map.
774
775              Example:
776
777              > Map = #{42 => value_three,1337 => "value two","a" => 1},
778                maps:values(Map).
779              [value_three,"value two",1]
780
781       with(Ks, Map1) -> Map2
782
783              Types:
784
785                 Ks = [K]
786                 Map1 = #{K => V, term() => term()}
787                 Map2 = #{K => V}
788
789              Returns a new map Map2 with the keys K1 through Kn and their as‐
790              sociated values from map Map1. Any key in Ks that does not exist
791              in Map1 is ignored.
792
793              Example:
794
795              > Map = #{42 => value_three,1337 => "value two","a" => 1},
796                Ks = ["a",42,"other key"],
797                maps:with(Ks,Map).
798              #{42 => value_three,"a" => 1}
799
800       without(Ks, Map1) -> Map2
801
802              Types:
803
804                 Ks = [K]
805                 Map1 = Map2 = map()
806                 K = term()
807
808              Returns a new map Map2 without keys K1 through Kn and their  as‐
809              sociated values from map Map1. Any key in Ks that does not exist
810              in Map1 is ignored
811
812              Example:
813
814              > Map = #{42 => value_three,1337 => "value two","a" => 1},
815                Ks = ["a",42,"other key"],
816                maps:without(Ks,Map).
817              #{1337 => "value two"}
818
819
820
821Ericsson AB                      stdlib 5.1.1                          maps(3)
Impressum