I am confused as to why the code below goes into an infinite loop and does not return a lazy sequence when I am calling lazy-seq:
(= (take 5 ((fn [func se]
(lazy-seq
(reduce (fn [acc item]
(conj acc (func (last acc) item)))
[(first se)] (rest se))))
+
(range)))
[0 1 3 6 10])
The repl just spins as range gets infinitely called.
How can I make this function behave lazily?