@@ -13,17 +13,18 @@ line is commented with its number:
13:gate end/atom :: 1
13:gate end/atom :: 1
14:var count 1 :: 2
14:var count 1 :: 2
16+:cast (list tape) :: 4
16−:if =(end count) :: 4
17+:if =(end count) :: 5
18−:cons :: 6
19+:cons :: 7
19− :if =(0 (mod count 15)) :: 7
20+ :if =(0 (mod count 15)) :: 8
20− "FizzBuzz" :: 8
21+ "FizzBuzz" :: 9
21− :if =(0 (mod count 5)) :: 9
22+ :if =(0 (mod count 5)) :: 10
22− "Fizz" :: 10
23+ "Fizz" :: 11
23− :if =(0 (mod count 3)) :: 11
24+ :if =(0 (mod count 3)) :: 12
24− "Buzz" :: 12
25+ "Buzz" :: 13
25− (text :wrap(count)) :: 13
26+ (text :wrap(count)) :: 14
26−:moar(count (add 1 count)) :: 14
27+:moar(count (add 1 count)) :: 15
29Can you understand this code by just looking at it? Hopefully,
30Can you understand this code by just looking at it? Hopefully,
@@ -40,16 +41,19 @@ Line 2 declares a variable, `count`, with initial value `1`.
41Line 3 begins a loop.
42Line 3 begins a loop.
44+Line 4 casts the product of the loop to a list of `tape`
45+(string as a character list).
43−Line 4 checks if `count` equals `end`. If so, line 5 (and the
47+Line 5 checks if `count` equals `end`. If so, line 6 (and the
44−whole loop) produces the value `~`, null. If not, line 6 begins
48+whole loop) produces the value `~`, null, the empty list. If
45−an ordered pair.
49+not, line 7 begins an ordered pair.
47The head of the pair is "FizzBuzz", or "Fizz", or "Buzz", if the
51The head of the pair is "FizzBuzz", or "Fizz", or "Buzz", if the
48−respective tests hit. If not, line 13 wraps a runtime type
52+respective tests hit. If not, line 14 wraps a runtime type
49around `count`, then prints the type-value pair to a string (like
53around `count`, then prints the type-value pair to a string (like
50C `sprintf()`). This string is the first item in the output list.
54C `sprintf()`). This string is the first item in the output list.
52−The tail of the pair is line 14, which repeats the loop (like
56+The tail of the pair is line 15, which repeats the loop (like
53Clojure `recur`), with `count` incremented. This list of strings
57Clojure `recur`), with `count` incremented. This list of strings
54is the rest of the output list.
58is the rest of the output list.