print-str, print-i64, print-f64, print-bytes, print-line and newline leave the prelude. print and println are the whole printing surface now, and print is the better call at every one of the sites that used them: it is the same structural walk without the newline, so the no-newline case the family was kept for is covered, and it takes the value as it is. The old print-i64 forced an explicit (i64 x) at every call site, because this language widens nothing implicitly; that cast is gone from 127 places. Dropping it moves one answer. hash-grid returns u64, and the cast through the signed printer showed sand-headless's hash as -2851001042534928384. print routes a u64 through flan_u64_to_bytes, so it now prints 15595743031174623232 — the same 64 bits, read as the unsigned number they are. The pinned expectation follows the correction. test-flan-dev.el and test_session.ml both reached for print-line as "a name the prelude has"; they reach for rand-seed instead.
34 lines
1.3 KiB
Plaintext
34 lines
1.3 KiB
Plaintext
;;;; sand.flan's other half: N frames, no window, hash the grid.
|
|
;;;;
|
|
;;;; This is the version CI runs on native *and* wasm32, and it imports
|
|
;;;; sand.flan itself — window, raylib bindings, dev agent and all. It builds
|
|
;;;; for wasm32 anyway because the link follows what the program reaches:
|
|
;;;; nothing here calls into raylib, so no shim is compiled and no -lraylib is
|
|
;;;; passed, and the front-end's own functions are never emitted. sand.flan's
|
|
;;;; main is not exported, so the only main is this one.
|
|
;;;;
|
|
;;;; A package is a directory, except when it is a single .flan file named
|
|
;;;; outright — which is this, because sand.flan shares the repository root
|
|
;;;; with three other loose programs.
|
|
;;;;
|
|
;;;; The hash is a regression test only because the sequence is reproducible:
|
|
;;;; rand-f32 is a seeded PRNG written in Flan, so the same seed gives the same
|
|
;;;; grains in the same places on both targets (plan.org, RNG is ours).
|
|
|
|
(import sand "../../sand.flan")
|
|
|
|
(defconst frames 40)
|
|
|
|
(defn main [] i32
|
|
(rand-seed 20260910)
|
|
;; Four clouds, spread across the top, one per colour. Deterministic
|
|
;; positions: the mouse is what the interactive driver has and this does not.
|
|
(dotimes [i 4]
|
|
(sand/next-color)
|
|
(sand/paint-at 4 (* (+ i 1) (/ sand/cols 5))))
|
|
(dotimes [f frames]
|
|
(sand/step))
|
|
(print (sand/hash-grid))
|
|
(println "")
|
|
0)
|