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:
@@ -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"))
|
||||||
|
|||||||
@@ -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"))
|
||||||
|
|||||||
Reference in New Issue
Block a user