planck 2018-03-22

Got it; thanks for the tips @mfikes! (and for planck of course!)

@pesterhazy has left the channel

I tried to figure out what a chunked-seq is.

So I ran to planck, to check it out:

cljs.user=> (chunked-seq? (seq (range 1000)))
false

Running clj I get:

user=> (chunked-seq? (seq (range 100)))
true

Well, in ClojureScript, range is special. And calling seq on it returns the same thing back.

I guess the "same thing" is true in Clojure

But, the point is that (range) returns a Range

Yeah, I saw that when typing (type (range))

Maybe (chunked-seq? (seq (vec (range 1000)))) helps dig into what it is?

most certainly does 🙂

No prob. I've not myself dug deeply into chunked seq stuff. It is this substrate that has always been there and worked properly, from my perspective 🙂

It seems that in Clojure (range) is not a chunked seq, but any call to range which yields a finite range is?

Oh, wow. Interesting.

Hah, (range) and (range 1000) are of different types.

Since iterate is directly reducible, (range) would be faster as a result

So @slipset The stuff I was saying about Clojure's range was evidently true before https://github.com/clojure/clojure/commit/07d6129a9847f62010079ab6f04b7930c2a593e4

That's way more information than I can handle at this hour 🙂

So... a consequence is that ClojureScript's range could be updated to be chunked... hah. And then mapping over ranges would be faster.

Well, at least Clojurescript knows the size of infinity 🙂

21:50 $ ./script/repljs
ClojureScript 1.10.168
cljs.user=> (count (range))
1.7976931348623157e+308
cljs.user=>

Clojure does not.

Yes, it does 🙂

or, it might be 42, it just takes some time for Clojure to calculate that.

A silly part of me wonders if that ClojureScript call should return ##Inf

But that would be a double, I guess

Or whatever, since JavaScript doesn't care