If I have a list
("foo" "bar" "" "baz")
and I need to change any "" to "biz", what is a good way to go about that?
Just for completeness, here's an alternate method that uses a more specialized built-in:
(replace ; Replace all instances of...
{"" "biz"} ; "" with "biz"...
'("foo" "bar" "" "baz")) ; in the list
Which also returns a lazy sequence.
Note that the map given as the first argument can contain multiple entries. If you have multiple replacements, I'd definitely go with replace over an explicit map.
replace actually just uses map behind the scenes, but uses a map lookup instead of a equality check to do the replacements. I would expect them to preform similarly for one replacement, but for replace to be faster for more than once since it doesn't need to do a linear search over all the replacements like you would doing manual = checks.
map, what did you try?