HS: add hs-ends-with-ic? / hs-matches-ignore-case?, drop exists? short-circuit; test-tco: reduce TCO depth to 5000

HS compiler: stop special-casing exists? in boolean fallthrough so it compiles
via the default callable path. HS runtime: add case-insensitive ends-with? /
matches? helpers paralleling hs-contains-ignore-case?.

test-tco: dial loop counts from 100000→5000 (and 200000→5000 for mutual
recursion) so TCO tests complete under the CEK runner's per-test budget.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-22 11:06:26 +00:00
parent ce7ad3eead
commit ef5faa6b54
3 changed files with 25 additions and 12 deletions

View File

@@ -427,7 +427,7 @@
((= head (quote null-literal)) nil)
((= head (quote not))
(list (quote not) (hs-to-sx (nth ast 1))))
((or (= head (quote starts-with?)) (= head (quote ends-with?)) (= head (quote contains?)) (= head (quote precedes?)) (= head (quote follows?)) (= head (quote exists?)))
((or (= head (quote starts-with?)) (= head (quote ends-with?)) (= head (quote contains?)) (= head (quote precedes?)) (= head (quote follows?)))
(cons head (map hs-to-sx (rest ast))))
((= head (quote object-literal))
(let

View File

@@ -614,6 +614,19 @@
hs-starts-with-ic?
(fn (str prefix) (starts-with? (downcase str) (downcase prefix))))
(define
hs-ends-with-ic?
(fn (str suffix) (ends-with? (downcase str) (downcase suffix))))
(define
hs-matches-ignore-case?
(fn
(target pattern)
(cond
((string? target)
(contains? (downcase (str target)) (downcase (str pattern))))
(true false))))
(define
hs-contains-ignore-case?
(fn