1
0
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:
Calvin Rose
2018-05-23 22:08:36 -04:00
parent 644219a8a5
commit b09bf72490
9 changed files with 163 additions and 84 deletions

View File

@@ -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)))