Share your thoughts in the 2024 State of Clojure Survey!

Welcome! Please see the About page for a little more info on how this works.

0 votes
in Clojure by

May I know the rationale behind postwalk-replace/prewalk-replace to accept a map for replacing forms instead of functions? Functions provide ability to have some logic which is not possible via smap

1 Answer

+3 votes
by
selected by
 
Best answer

Seems to me like "postwalk-replace that accepts a function instead of a map" is just postwalk. Because all that postwalk-replace does is to call postwalk with (fn [x] (if (contains? smap x) (smap x) x)).
Or am I missing something?

by
You are correct.
by
never realized that :facepalm:
...