print and println had no line anywhere on index.html — a builtin the reader meets in the first example and is never told about. There is a section for them now, between arrays and the prelude: what the walk covers, that an enum comes back as its name and a Ptr does not get followed, that a string is raw at the top and quoted inside a structure, and that the depth and span caps are what keep a grid from printing a screenful. printing.flan is beside the other examples so check.sh has been green on every line of it. The prelude's table loses its output row, because the prelude has no output functions left, and the fifty-odd example blocks follow the files they quote. Two pinned things moved. sand-headless prints 15595743031174623232 where it printed -2851001042534928384: same bits, read unsigned, because the cast that made it signed is gone. bounds.flan's trap moved from column 28 to 19, which is where (at xs i) now starts on that line. And the indirection-cell illustration is defer.flan rather than hello.flan. hello.flan cannot show a cell any more: its one call was to a prelude function, and println is compiler-provided, so the smallest program makes no Flan-to-Flan call at all. defer.flan's main calls work, and is already on the page a few sections up.
31 lines
661 B
Plaintext
31 lines
661 B
Plaintext
(defconst nums [5 i32] [1 3 8 9 10])
|
|
|
|
(defn classify [n i32] string
|
|
(cond
|
|
(< n 0) "negative"
|
|
(= n 0) "zero"
|
|
:else "positive"))
|
|
|
|
(defn countdown [n i32]
|
|
(let [i n]
|
|
(while (> i 0)
|
|
(print i)
|
|
(print " ")
|
|
(set i (- i 1)))
|
|
(println "")))
|
|
|
|
(defn first-even [s [i32]] (Option i32)
|
|
(dotimes [i (len s)]
|
|
(when (= 0 (% (at s i) 2))
|
|
(return (Some (at s i)))))
|
|
None)
|
|
|
|
(defn main []
|
|
(println (classify -3))
|
|
(countdown 4)
|
|
(unless false
|
|
(println "unless runs when the test is false"))
|
|
(match (first-even (slice nums 0 (len nums)))
|
|
(Some n) (do (print n) (println ""))
|
|
None (println "none")))
|