I had this code:
:history
(cons [t (:latest thing)] (take n (:history thing)) )
which was for adding a rolling window of recent history to a map on each iteration of my program. What I found was that after a certain number of iterations (~50) my program would slow down dramatically and progressively.
whereas, if I changed the code to:
:history
(cons [t (:latest thing)] (take n (vec (:history thing))) )
then the program ran slightly longer on each iteration (as the lazy seq was being realized), but ran consistently and did not slow down.
Being new to Clojure I don't understand...is it to do with chunked sequences ?