write arrays with brackets in tests
The tests spelled out (¤ ...), what [...] reads into, which nobody writes. The reader's own tests keep it: there it is the point.
This commit is contained in:
@@ -66,12 +66,12 @@
|
||||
|
||||
(printf "Through a parameter: %d\n" (apply-twice (make-adder 50) 10))
|
||||
|
||||
(var table (¤ (closure ((int)) int) 3))
|
||||
(var table [(closure ((int)) int) 3])
|
||||
(var i int 0)
|
||||
(for (= i 0) (< i 3) (++ i)
|
||||
(= (¤ table i) (make-adder i)))
|
||||
(= [table i] (make-adder i)))
|
||||
(printf "From an array: %d %d %d\n"
|
||||
((¤ table 0) 1) ((¤ table 1) 1) ((¤ table 2) 1))
|
||||
([table 0] 1) ([table 1] 1) ([table 2] 1))
|
||||
|
||||
;; the index must be evaluated once, so `i' ends at 1 and not 2 --
|
||||
;; read in a separate statement, since reading and bumping it in one
|
||||
|
||||
Reference in New Issue
Block a user