Skip to content

fix string-any/string-every to honor the start argument - #1195

Open
jordanlhenderson wants to merge 1 commit into
ashinn:masterfrom
jordanlhenderson:fix-string-any-start
Open

jordanlhenderson wants to merge 1 commit into
ashinn:masterfrom
jordanlhenderson:fix-string-any-start

Conversation

@jordanlhenderson

Copy link
Copy Markdown
Contributor

string-any accepts optional start/end (indexes or cursors) but used start only in its emptiness check; the scan always began at (string-cursor-start str), so (string-any pred str start end) examined [0, end). string-every is the complement of string-any and inherited this, and (srfi 130) re-exports both, so ranged calls violated SRFI 130. Present since 2b7927b added the optional arguments.

Fix: bind start once and start the loop there. Adds ranged tests with indexes and cursors to the SRFI 130 and (chibi string) suites. make test-all and make test-safe-string-cursors pass.

The optional start argument added in 2b7927b was used only in the
emptiness check; the scan always began at the start of the string, so
(string-any pred str start end) examined [0, end).  string-every,
defined as the complement of string-any, inherited the defect, and
(srfi 130) re-exports both, so ranged calls violated SRFI 130.  Bind
start once and start the loop there.  Add ranged tests with indexes and
cursors to the srfi 130 and (chibi string) suites.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MHtb28AgcXCooRRkPyqSUH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant