mirror of
https://github.com/janet-lang/janet
synced 2025-10-23 19:57:40 +00:00
Change primary looping macro to 'loop' instead of 'for'.
This commit is contained in:
@@ -4,10 +4,10 @@
|
||||
"Returns a list of prime numbers less than n."
|
||||
[n]
|
||||
(def list @[])
|
||||
(for [i 2 n]
|
||||
(loop [i :range [2 n]]
|
||||
(var isprime? true)
|
||||
(def len (length list))
|
||||
(for [j 0 len]
|
||||
(loop [j :range [0 len]]
|
||||
(def trial (get list j))
|
||||
(if (zero? (% i trial)) (:= isprime? false)))
|
||||
(if isprime? (array.push list i)))
|
||||
|
||||
Reference in New Issue
Block a user