Skip to content

clojure.core/replace

View this page on ClojureDocs

Type: function Added: Clojure 1.0 Examples: 5 Runnable: 3
([smap] [smap coll])

Given a map of replacement pairs and a vector/collection, returns a vector/seq with any elements = a key in smap replaced with the corresponding val in smap. Returns a transducer when no collection is provided.

Examples

by jneira on
by huahaiy on . May have evaluation errors.
by Alexey Tarasevich on . May have evaluation errors.
by ertugrulcetin on
by reborg on

Note by jneira

The behaviour for vectors was a little strange for me. I'd say replace "selects" from "smap" the indexes which are in "coll"

See also


Content from the matching ClojureDocs page, with authors credited on each contribution.