clojure-dev

Issues: https://clojure.atlassian.net/browse/CLJ | Guide: https://insideclojure.org/2015/05/01/contributing-clojure/
mpenet 2020-06-20T14:58:56.308800Z

is that a bug? (reduce (fn [ ] (reduced true) [])

dominicm 2020-06-20T14:59:16.309800Z

The docstring covers this

mpenet 2020-06-20T14:59:48.310400Z

it's not

dominicm 2020-06-20T14:59:54.310700Z

Huh?

mpenet 2020-06-20T14:59:56.310900Z

yeah just saw that, tend to forget about it

dominicm 2020-06-20T15:00:01.311200Z

:)

mpenet 2020-06-20T15:00:04.311400Z

it's not a bug I meant 😛

👍 1
2020-06-20T15:09:24.312600Z

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?

devn 2020-06-27T08:45:07.338600Z

Without knowing any of the specifics of your problem, https://stuartsierra.com/2015/04/26/clojure-donts-concat came to mind.

2020-06-27T12:16:43.338900Z

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

2020-06-20T15:09:56.313100Z

(the seqs in question are lazy, of course, and are presumably somehow being overrealized or head-held when they needn't be)

2020-06-20T22:01:40.313700Z

Try lazy-cat

2020-06-20T22:01:57.314200Z

(I think that still exists)

2020-06-20T22:03:22.315800Z

Concat is a function, arguments evaluated, lazy-cat is a macro and does some extra thunkifying

2020-06-20T22:04:47.316400Z

I don't see how it would be a problem that the args are merely evaluated

2020-06-20T22:04:59.316700Z

as long as the whole lazy seqs aren't realized with a held head

2020-06-20T22:58:00.319500Z

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).

2020-06-20T23:16:15.321Z

you might be recalling a mapcat ticket I made ages and ages ago