user=> (def r (range 1))
user=> (for [a r, b r, c r, d r, e r, f r, g r, h r :when (and (= 0 a) (not= 1 b))]
(list a b c d e f g h))
((0 0 0 0 0 0 0 0))
user=> (doseq [a r, b r, c r, d r, e r, f r, g r, h r :when (and (= 0 a) (not= 1 b))]
(println (list a b c d e f g h)))
CompilerException java.lang.RuntimeException: Method code too large!, compiling:(/tmp/form-init8346140986526777871.clj:1:1)
This appears to come from clojure.asm.MethodWriter. My Googling for this error with Clojure turns up almost no hits.
So...what on earth is going on? How deep does this rabbit hole go? Is this one line of Clojure code really producing a >65KB method (the value comes from MethodWriter's source)?
If this answer is hitting on the issue I'm running into, then (a) why does chunking mean it grows exponentially instead of linearly? And (b) what are the ramifications for me as a programmer? For example, is this behavior well-known and intended? Should I avoid using doseq
for any situation with more than 3 or 4 bindings? How does this compare to using for
and doall
?
Perhaps related: