HS pick runtime: guard nil inputs so pick first/last/items/match/matches don't hang

- hs-pick-first/last/random/items/slice: short-circuit nil or non-list
  (strings flow through unchanged).
- New hs-pick-match / hs-pick-matches wrappers around regex-match /
  regex-find-all, also nil-safe; compiler routes pick-match / pick-matches
  through them. Unblocks 'pick first from null returns null' and
  'pick match from null returns null' which previously looped past
  step_limit.
This commit is contained in:
2026-04-23 17:08:04 +00:00
parent e976d7c145
commit 5b31d935bd
4 changed files with 94 additions and 34 deletions

View File

@@ -818,7 +818,7 @@
(quote set!)
(quote it)
(list
(quote regex-match)
(quote hs-pick-match)
(hs-to-sx (nth ast 1))
(hs-to-sx (nth ast 2)))))
((= head (quote pick-matches))
@@ -826,7 +826,7 @@
(quote set!)
(quote it)
(list
(quote regex-find-all)
(quote hs-pick-matches)
(hs-to-sx (nth ast 1))
(hs-to-sx (nth ast 2)))))
((= head (quote prop-is))