Why do I need to replace map
with mapv
in this piece of code to prevent a stack overflow:
#!/bin/bash lein-exec
(println (reduce (fn [acc _]
;;(mapv #(inc %) acc))
(map #(inc %) acc))
(repeat 2 0)
(range (long 1e6))))
~
I don't understand how the acc
is processed when lazy. Thanks for insight.