Welcome! Please see the About page for a little more info on how this works.

+2 votes
in Java Interop by
user> (def al (hamf/array-list (range 200))) 
user> (type al)
user> (chunked-seq? (seq al))
user> (instance? java.lang.Iterable al)
trueSyntax error reading source at (REPL:65:41).
Unmatched delimiter: )
user> (instance? java.lang.Iterable al)
user> (chunked-seq? (clojure.lang.RT/seq al))
user> (chunked-seq? (clojure.lang.RT/chunkIteratorSeq (.iterator al)))
user> (type (clojure.lang.RT/chunkIteratorSeq (.iterator al)))

If no lazy seq is a chunked seq then the result of clojure.core/map, filter, etc. also cannot ever be a chunked seq as they are currently written. There are just a whole lot of questions here.

If the above is true then the best answer by far is to remove chunking.  The core functions that matter can be written better, there are transducers and ham-fisted's lazy-noncaching namespace both of which provide lazy, noncaching programming model which is just faster than lazy-caching-threadsafe.
The seq of the seq is chunked...

user> (def data (seq al))
user> (type (seq data))
The answer is the result of map, etc is a lazy seq.  Calling seq on this seq returns a chunkedcons (in the single-collection case) so (chunked-seq? (map ...)) will always be false but
(chunked-seq? (seq (map ...))) will sometimes be true.  It would still be ideal if (RT/chunkIteratorSeq ...) did in fact return a chunked seq.

Please log in or register to answer this question.