is that a bug? (reduce (fn [ ] (reduced true) [])
The docstring covers this
it's not
Huh?
yeah just saw that, tend to forget about it
:)
it's not a bug I meant 😛
I just "fixed" a memory leak by converting (concat ws xs ys zs)
to (concat (concat ws xs) (concat ys zs))
; I can't quite convince myself by staring at the definition of concat
why this would be the case; but is it a known issue/phenomenon?
Without knowing any of the specifics of your problem, https://stuartsierra.com/2015/04/26/clojure-donts-concat came to mind.
yeah, I'm familiar with concat bombs; I don't think that can apply here; the symptom is OOM, not stack overflow, and the reason there's an OOM is the same reason I need to use laziness, I can't just make everything eager like he suggests
(the seqs in question are lazy, of course, and are presumably somehow being overrealized or head-held when they needn't be)
Try lazy-cat
(I think that still exists)
Concat is a function, arguments evaluated, lazy-cat is a macro and does some extra thunkifying
I don't see how it would be a problem that the args are merely evaluated
as long as the whole lazy seqs aren't realized with a held head
I vaguely recall at some point something about concat not being as lazy as it could be, maybe it calls seq on all it's arguments or something (realizing the first element before it is strictly required).
you might be recalling a mapcat ticket I made ages and ages ago