Share your thoughts in the 2024 State of Clojure Survey!

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

0 votes
in Transducers by
closed by

calling take-nth with 0 causes an OutOfMemoryError, and kills the repl. Perhaps a validation > 0 required here?

to reproduce,

user=> (take-nth 0 [1 2])
OutOfMemoryError Java heap space
        reply.eval-modes.nrepl/session-responses (nrepl.clj:51)
        reply.eval-modes.nrepl/session-responses (nrepl.clj:51)
        reply.eval-modes.nrepl/session-responses/fn--1340 (nrepl.clj:56)
        clojure.lang.LazySeq.sval (LazySeq.java:42)
        clojure.lang.LazySeq.seq (LazySeq.java:51)
        clojure.lang.RT.seq (RT.java:535)
        clojure.core/seq--5467 (core.clj:139)
        clojure.core/filter/fn--5962 (core.clj:2826)
        clojure.lang.LazySeq.sval (LazySeq.java:42)
        clojure.lang.LazySeq.seq (LazySeq.java:58)
        clojure.lang.RT.seq (RT.java:535)
        clojure.core/seq--5467 (core.clj:139)
Bye for now!
Error printing return value (OutOfMemoryError) at clojure.core/take-nth (core.clj:4289).
closed as a duplicate of: (take-nth 0 coll) redux...
...