mirror of
https://github.com/janet-lang/janet
synced 2025-01-26 23:24:44 +00:00
Update documentation, fix life example.
This commit is contained in:
parent
77ea11c603
commit
cc5b4eac0a
@ -16,7 +16,7 @@
|
|||||||
(def cell-set (frequencies state))
|
(def cell-set (frequencies state))
|
||||||
(def neighbor-set (frequencies (mapcat neighbors state)))
|
(def neighbor-set (frequencies (mapcat neighbors state)))
|
||||||
(seq [coord :keys neighbor-set
|
(seq [coord :keys neighbor-set
|
||||||
:let [count neighbor-set@coord]
|
:let [count neighbor-set.coord]
|
||||||
:when (or (= count 3) (and (get cell-set coord) (= count 2)))]
|
:when (or (= count 3) (and (get cell-set coord) (= count 2)))]
|
||||||
coord))
|
coord))
|
||||||
|
|
||||||
@ -24,7 +24,7 @@
|
|||||||
"Draw cells in the game of life from (x1, y1) to (x2, y2)"
|
"Draw cells in the game of life from (x1, y1) to (x2, y2)"
|
||||||
[state x1 y1 x2 y2]
|
[state x1 y1 x2 y2]
|
||||||
(def cellset @{})
|
(def cellset @{})
|
||||||
(each cell state (set cellset@cell true))
|
(each cell state (set cellset.cell true))
|
||||||
(loop [x :range [x1 (+ 1 x2)]
|
(loop [x :range [x1 (+ 1 x2)]
|
||||||
:after (print)
|
:after (print)
|
||||||
y :range [y1 (+ 1 y2)]]
|
y :range [y1 (+ 1 y2)]]
|
||||||
|
@ -406,9 +406,9 @@ static const JanetReg cfuns[] = {
|
|||||||
"\t:string\n"
|
"\t:string\n"
|
||||||
"\t:buffer\n"
|
"\t:buffer\n"
|
||||||
"\t:symbol\n"
|
"\t:symbol\n"
|
||||||
"\t:abstract\n"
|
|
||||||
"\t:function\n"
|
"\t:function\n"
|
||||||
"\t:cfunction"
|
"\t:cfunction\n\n"
|
||||||
|
"or another symbol for an abstract type."
|
||||||
},
|
},
|
||||||
{"next", janet_core_next,
|
{"next", janet_core_next,
|
||||||
"(next dict key)\n\n"
|
"(next dict key)\n\n"
|
||||||
|
Loading…
Reference in New Issue
Block a user