Open jmglov opened 8 years ago
@thomasmulvaney @mpenet What do you guys think about this one?
I agree. One would expect concat
to behave lazily.
+1 for lazy concat, just for clojure compatibility's sake.
This might be a good one for me to take a swing at into order to get familiar with Pixie's sequences implementation. I'll see what I can do. :)
@jmglov Were you still planning on fixing this? If not I would be happy to work on it.
Also I noticed something interesting with regards to performance, anyone have any idea why this is?
user => (time (take 2 (concat [3] (range))))
"Elapsed time: 24.371005 ms"
(3 0)
user => (time (take 2 (lazy-seq (concat [3] (range)))))
"Elapsed time: 0.004442 ms"
(3 0)
I guess I would expect these to be fairly similar from a performance perspective.
@brian-dawn I've gotten really busy at work with non-Pixie stuff, so please feel free to run with it.
As for your performance question, I'm really not sure.
Pixie's concat always returns a vector, whereas in Clojure, it returns a lazy seq:
Pixie:
Clojure:
I think the Clojure behaviour is more desirable here.