mirror of
https://github.com/janet-lang/janet
synced 2026-09-14 13:21:21 +00:00
Rename the := special form to set so it does not look like a keyword.
This commit is contained in:
@@ -18,8 +18,8 @@
|
||||
(if ,loaded
|
||||
,state
|
||||
(do
|
||||
(:= ,loaded true)
|
||||
(:= ,state (do ;forms)))))))
|
||||
(set ,loaded true)
|
||||
(set ,state (do ;forms)))))))
|
||||
|
||||
# Use tuples instead of structs to save memory
|
||||
(def- HEAD 0)
|
||||
|
||||
+2
-2
@@ -24,7 +24,7 @@
|
||||
"Draw cells in the game of life from (x1, y1) to (x2, y2)"
|
||||
[state x1 y1 x2 y2]
|
||||
(def cellset @{})
|
||||
(each cell state (:= cellset@cell true))
|
||||
(each cell state (set cellset@cell true))
|
||||
(loop [x :range [x1 (+ 1 x2)]
|
||||
:after (print)
|
||||
y :range [y1 (+ 1 y2)]]
|
||||
@@ -40,4 +40,4 @@
|
||||
(for i 0 20
|
||||
(print "generation " i)
|
||||
(draw *state* -7 -7 7 7)
|
||||
(:= *state* (tick *state*)))
|
||||
(set *state* (tick *state*)))
|
||||
|
||||
@@ -9,6 +9,6 @@
|
||||
(def len (length list))
|
||||
(for j 0 len
|
||||
(def trial (get list j))
|
||||
(if (zero? (% i trial)) (:= isprime? false)))
|
||||
(if (zero? (% i trial)) (set isprime? false)))
|
||||
(if isprime? (array/push list i)))
|
||||
list)
|
||||
|
||||
Reference in New Issue
Block a user