jank-lang / jank

The native Clojure dialect hosted on LLVM
https://jank-lang.org
Mozilla Public License 2.0
1.69k stars 50 forks source link

Add native repeat object #128

Closed jianlingzhong closed 1 week ago

jianlingzhong commented 1 week ago

Works as expected:

❯ build/jank repl
Bottom of clojure.core
> (take 3 (repeat 0))
(0 0 0)
> (take 3 (repeat -1))
(-1 -1 -1)
> (def a (repeat 3 4))
#'clojure.core/a
> a
(4 4 4)
> (first a)
4
> (next a)
(4 4)
> (next (next a))
(4)
> (repeat 0 1)
()
> (repeat -1 1)
()
> (repeat 0)  ; ==> repl hangs here
^C

This closes #52 .

jeaye commented 1 week ago

Nice work, @jianlingzhong!