(index ("persistent-map" 0) ("alist->map" 278) ("map->alist" 515) ("map?" 727) ("map-size" 827) ("map-add" 937) ("map-contains?" 1259) ("map-delete" 1402) ("map-ref" 1701) ("map-ref-in" 2083) ("map-update-in" 2585) ("map-equal?" 3315) ("map-keys" 3553) ("map-values" 3670) ("map-merge" 3793) ("map-reduce" 4032) ("map-collect" 4372) ("map-each" 4653) ("map->transient-map" 5037) ("transient-map?" 5177) ("persist-map!" 5296) ("map-add!" 5611) ("map-delete!" 5996))
(def (sig (procedure "(persistent-map [key value ...])" (id persistent-map))) (p "Returns a persistent map, optionally populated with the given key value pairs.") (p "Example:") (highlight scheme "(persistent-map 'foo 1 'bar 2)\n=> #<persistent-hash-map (bar . 2) (foo . 1)>"))
(def (sig (procedure "(alist->map alist)" (id alist->map))) (p "Constructs a persistent map from " (tt "alist") ".") (p "Example:") (highlight scheme "(alist->map '((foo . 1) (bar . 2)))\n=> #<persistent-hash-map (bar . 2) (foo . 1)>"))
(def (sig (procedure "(map->alist map)" (id map->alist))) (p "Constructs an alist from " (tt "map") ".") (p "Example:") (highlight scheme "(map->alist (persistent-map 'foo 1 'bar 2))\n=> ((bar . 2) (foo . 1))"))
(def (sig (procedure "(map? x)" (id map?))) (p "Checks whether " (tt "x") " is a persistent map."))
(def (sig (procedure "(map-size map)" (id map-size))) (p "Returns the number of entries in " (tt "map") "."))
(def (sig (procedure "(map-add map key value [key value ...])" (id map-add))) (p "Returns " (tt "map") " with the given " (tt "key value") " pairs added. Existing keys will be overridden.") (p "Example:") (highlight scheme "(map-add (persistent-map 'foo 1) 'foo 2 'bar 3)\n=> #<persistent-hash-map (bar . 3) (foo . 2)>"))
(def (sig (procedure "(map-contains? map key)" (id map-contains?))) (p "Checks whether " (tt "map") " contains an entry for " (tt "key") "."))
(def (sig (procedure "(map-delete map key [key ...])" (id map-delete))) (p "Returns " (tt "map") " without the given " (tt "keys") ". Non-existing keys will be ignored.") (p "Example:") (highlight scheme "(map-delete (persistent-map 'foo 1 'bar 2) 'foo 'qux)\n=> #<persistent-hash-map (bar . 2)>"))
(def (sig (procedure "(map-ref map key #!optional not-found)" (id map-ref))) (p "Returns the value associated with " (tt "key") " in " (tt "map") " or " (tt "not-found") " (default " (tt "#f") ") if " (tt "key") " does not exist.") (p "Example:") (highlight scheme "(define m (persistent-map 'foo 1))\n\n(map-ref m 'foo 2) => 1\n(map-ref m 'bar)   => #f\n(map-ref m 'bar 2) => 2"))
(def (sig (procedure "(map-ref-in map keys #!optional not-found)" (id map-ref-in))) (p "Recursively looks up the list of " (tt "keys") " in the nested " (tt "map") " and returns the value associated with the innermost key or " (tt "not-found") " (default " (tt "#f") ") if one of the keys does not exist.") (p "Example:") (highlight scheme "(define m (persistent-map 'foo (persistent-map 'bar (persistent-map 'qux 123))))\n\n(map-ref-in m '(foo bar qux)) => 123\n(map-ref-in m '(foo qux))     => #f"))
(def (sig (procedure "(map-update-in map keys proc . args)" (id map-update-in))) (p "Recursively looks up the " (tt "keys") " in the nested " (tt "map") " like " (tt "map-ref-in") " but applies " (tt "proc") " to the existing value of the innermost key (or " (tt "#f") " if it doesn't exist, yet) and the given " (tt "args") ". For non-existing intermediate keys new persistent maps will be added.") (p "Example:") (highlight scheme "(define m (persistent-map 'foo (persistent-map 'bar 1)))\n\n(map-update-in m '(foo bar) + 1)\n=> #<persistent-hash-map (foo . #<persistent-hash-map (bar . 2)>)>\n\n(map-update-in m '(foo qux) (lambda (x) (or x 9)))\n=> #<persistent-hash-map (foo . #<persistent-hash-map (bar . 1) (qux . 9)>)>"))
(def (sig (procedure "(map-equal? x y)" (id map-equal?))) (p "Checks whether the given maps " (tt "x") " and " (tt "y") " are " (tt "equal?") ". Values which are maps themselves will be recursively compared with " (tt "map-equal?") "."))
(def (sig (procedure "(map-keys map)" (id map-keys))) (p "Returns a list of the keys contained in " (tt "map") "."))
(def (sig (procedure "(map-values map)" (id map-values))) (p "Returns a list of the values contained in " (tt "map") "."))
(def (sig (procedure "(map-merge map1 map2)" (id map-merge))) (p "Returns a new map with the entries of " (tt "map2") " merged into " (tt "map1") ". Entries which are present in both maps will be overridden by those in " (tt "map2") "."))
(def (sig (procedure "(map-reduce f init map)" (id map-reduce))) (p "Reduces the entries of " (tt "map") " by applying them to " (tt "f") " together with the current reduction value, starting with " (tt "init") ".") (p "Example:") (highlight scheme "(define m (persistent-map 'foo 1 'bar 2))\n\n(map-reduce cons* '() m) => (bar 2 foo 1)"))
(def (sig (procedure "(map-collect proc map)" (id map-collect))) (p "Applies proc to each entry of " (tt "map") " and collects the return values in a list as the final result.") (p "Example:") (highlight scheme "(map-collect cons (persistent-map 1 2 3 4))\n=> ((1 . 2) (3 . 4))"))
(def (sig (procedure "(map-each proc map)" (id map-each))) (p "Applies proc to each entry of " (tt "map") " for its side-effects. The return value is undefined.") (p "Example:") (highlight scheme "(map-each (lambda (key value)\n            (pp (list key: key value: value)))\n          (persistent-map 'foo 1 'bar 2))") (p "Output:") (pre "(key: foo value: 1)\n(key: bar value: 2)"))
(def (sig (procedure "(map->transient-map map)" (id map->transient-map))) (p "Returns a transient copy of the persistent " (tt "map") "."))
(def (sig (procedure "(transient-map? x)" (id transient-map?))) (p "Checks whether " (tt "x") " is a transient map."))
(def (sig (procedure "(persist-map! map)" (id persist-map!))) (p "Marks " (tt "map") " as persistent and returns a persistent version of it. After " (tt "persist-map!") " has been called on a transient map it can't be mutated anymore. Calling " (tt "persist-map!") " twice on the same transient map is an error."))
(def (sig (procedure "(map-add! map key value [key value ...])" (id map-add!))) (p "Adds the given " (tt "key value") " pairs to " (tt "map") " and returns it.") (p "Example:") (highlight scheme "(define m (map->transient-map (persistent-map)))\n\n(for-each\n (lambda (k v) (map-add! m k v))\n '(foo bar)\n '(1 2))\n\n(persist-map! m)\n=> #<persistent-hash-map (bar . 2) (foo . 1)>"))
(def (sig (procedure "(map-delete! map key [key ...])" (id map-delete!))) (p "Deletes the given " (tt "keys") " from " (tt "map") " and returns it. Non-existing keys are ignored.") (p "Example:") (highlight scheme "(define m\n  (map->transient-map (persistent-map 'foo 1 'bar 2)))\n\n(map-delete! m 'bar)\n(persist-map! m)\n=> #<persistent-hash-map (foo . 1)>"))
