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:
2026-04-25 18:35:26 +00:00
parent db8d7aca91
commit 67a5f13713
6 changed files with 112 additions and 20 deletions

View File

@@ -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