HS: in-expression filter semantics (+1 test)
`1 in [1, 2, 3]` must return (list 1) not true. Root cause: in? compiled to hs-contains? which returns boolean for scalar items. Fix: new hs-in? returns filtered list; new in-bool? operator for is/am-in comparison contexts so those still return boolean. Parser generates in-bool? for `X is in Y` / `X am in Y`; plain `in` keeps in? → list return. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -495,7 +495,8 @@
|
||||
(quote and)
|
||||
(list (quote >=) left lo)
|
||||
(list (quote <=) left hi)))))
|
||||
((match-kw "in") (list (quote in?) left (parse-expr)))
|
||||
((match-kw "in")
|
||||
(list (quote in-bool?) left (parse-expr)))
|
||||
((match-kw "really")
|
||||
(do
|
||||
(match-kw "equal")
|
||||
@@ -571,7 +572,8 @@
|
||||
(let
|
||||
((right (parse-expr)))
|
||||
(list (quote not) (list (quote =) left right))))))
|
||||
((match-kw "in") (list (quote in?) left (parse-expr)))
|
||||
((match-kw "in")
|
||||
(list (quote in-bool?) left (parse-expr)))
|
||||
((match-kw "empty") (list (quote empty?) left))
|
||||
((match-kw "between")
|
||||
(let
|
||||
|
||||
Reference in New Issue
Block a user