diff --git a/web/examples/quotes.sh b/web/examples/quotes.sh index 44f6465..dd447fc 100644 --- a/web/examples/quotes.sh +++ b/web/examples/quotes.sh @@ -16,6 +16,16 @@ fail=0 flat=$(sed -e 's/<//g' -e 's/&/\&/g' "$page" | tr '\n' ' ' | tr -s ' ') want() { + # An empty needle would match anything — `case $x in **)` is always true — so + # every check whose text comes from a grep would go green the moment the line + # it greps for was renamed. That is the one failure this script exists to + # catch, so the empty case is a failure and not a match. + if [ -z "$2" ]; then + echo "FAIL $1" + echo " nothing to compare against — whatever this quotes has moved" + fail=1 + return + fi needle=$(printf '%s' "$2" | tr '\n' ' ' | tr -s ' ') case $flat in *"$needle"*) echo "ok $1" ;; diff --git a/web/index.html b/web/index.html index c5846e9..08b78ce 100644 --- a/web/index.html +++ b/web/index.html @@ -629,8 +629,8 @@ yielding a huge unsigned length.
The prelude is written in Flan and prepended to every program, so nothing in it -needs importing. Printing is deliberately not a primitive: +
The prelude is written in Flan, all but one line of it, and prepended to every
+program, so nothing in it needs importing. Printing is deliberately not a primitive:
write-stdout is the one output primitive and everything above it is
ordinary Flan.
i32swap-i32!, reverse-i32!, sort-i32!, index-of-i32, min-i32, max-i32, sum-i32bytes=?, starts-with?, ends-with?, index-of-byte, index-of-bytes, trim, digit?, space?parse-i64, parse-f64sign-f32, lerp, floor-f32, ceil-f32, round-f32, sqrt-f32sign-f32, lerp, floor-f32, ceil-f32, round-f32, and sqrt-f32, which is the one declare in the filerand-seed, rand-u32, rand-f32, rand-i32-range, rand-f32-rangestrtoll answers 0 for "", 0 for
"abc" and 12 for "12x", which are three wrong answers a caller
cannot tell from a real 12.
+sqrt-f32 goes the other way, and is the one function in the file that
+is not Flan: (declare sqrt-f32 [x f32] f32 "sqrtf"). Every other number
+here is reachable from the four operations and a cast; a square root is not, and the
+usual trick of seeding Newton's method from the exponent bits needs a bit-cast between
+f32 and u32 that the language does not have. IEEE-754 makes
+sqrt correctly rounded, so libm gives the same bit pattern on both targets
+anyway — the very property that keeps the RNG in Flan is, for this one, the argument
+for going out to C. It is also why every link carries -lm.
There is no println. There is no overloading yet, so each printer names
its type. The names are the compiler's answer too: (println 1) is
unknown function println.