HS: not precedence over or + truthy/falsy coercion (+3 tests)

parse-atom emitted (not (parse-expr)) which let or/and capture the whole
RHS before `not` could bind. Also emitted SX `not` which treats only nil/
false as falsy, so `not 0` returned false.

Fix: `not` now emits `(hs-falsy? (parse-atom))` — tight binding to the
following atom, and hyperscript-style truthy/falsy (0, "", nil, false, []).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-23 21:40:00 +00:00
parent 9e92b9c9fc
commit 4fe0b64965
2 changed files with 2 additions and 2 deletions

View File

@@ -137,7 +137,7 @@
(when (and (= (tp-type) "op") (= (tp-val) "!")) (adv!)) (when (and (= (tp-type) "op") (= (tp-val) "!")) (adv!))
(list (quote beep!) (parse-expr)))) (list (quote beep!) (parse-expr))))
((and (= typ "keyword") (= val "not")) ((and (= typ "keyword") (= val "not"))
(do (adv!) (list (quote not) (parse-expr)))) (do (adv!) (list (quote hs-falsy?) (parse-atom))))
((and (= typ "keyword") (= val "no")) ((and (= typ "keyword") (= val "no"))
(do (adv!) (list (quote no) (parse-expr)))) (do (adv!) (list (quote no) (parse-expr))))
((and (= typ "keyword") (= val "eval")) ((and (= typ "keyword") (= val "eval"))

View File

@@ -137,7 +137,7 @@
(when (and (= (tp-type) "op") (= (tp-val) "!")) (adv!)) (when (and (= (tp-type) "op") (= (tp-val) "!")) (adv!))
(list (quote beep!) (parse-expr)))) (list (quote beep!) (parse-expr))))
((and (= typ "keyword") (= val "not")) ((and (= typ "keyword") (= val "not"))
(do (adv!) (list (quote not) (parse-expr)))) (do (adv!) (list (quote hs-falsy?) (parse-atom))))
((and (= typ "keyword") (= val "no")) ((and (= typ "keyword") (= val "no"))
(do (adv!) (list (quote no) (parse-expr)))) (do (adv!) (list (quote no) (parse-expr))))
((and (= typ "keyword") (= val "eval")) ((and (= typ "keyword") (= val "eval"))