mirror of
https://github.com/janet-lang/janet
synced 2026-09-15 13:51:21 +00:00
Make array literals require preceding @ character.
This commit is contained in:
+2
-2
@@ -3,12 +3,12 @@
|
||||
(defn primes
|
||||
"Returns a list of prime numbers less than n."
|
||||
[n]
|
||||
(def list [])
|
||||
(def list @[])
|
||||
(for [i 2 n]
|
||||
(var isprime? true)
|
||||
(def len (length list))
|
||||
(for [j 0 len]
|
||||
(def trial (get list j))
|
||||
(if (zero? (% i trial)) (varset! isprime? false)))
|
||||
(if (zero? (% i trial)) (:= isprime? false)))
|
||||
(if isprime? (array-push list i)))
|
||||
list)
|
||||
|
||||
Reference in New Issue
Block a user