Search code examples
clojureclojurescript

Replace Empty Strings In A List With A Value


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?


Solution

  • (map #(if (empty? %) "biz" %)
         '("foo" "bar" "" "baz"))