Skip to content

feat(stdlib): add panic, and type combinations, permutations and find_subsequence 📐 - #346

Merged
timfennis merged 1 commit into
feat/type-checkerfrom
feature/never-and-typed-builtins
Nov 13, 2026
Merged

timfennis merged 1 commit into
feat/type-checkerfrom
feature/never-and-typed-builtins

Conversation

@timfennis

Copy link
Copy Markdown
Owner

Groundwork for making Any explicit (#331): these built-ins gave Any that nobody wrote, which would need a cast at every use once Any only comes out through as.

  • panic(message) stops the program with the message and has type Never, so it can end a branch whose other branches give a value: if c { 1 } else { panic("no such thing") } is an Int. assert(false) can't do this, as assert returns when its condition holds.
  • combinations(xs, k) and permutations(xs, k) now give lists rather than tuples, as k is only known when the program runs: Iterator<List<T>> and List<List<T>> instead of Any. Destructuring them works as before; they print as [1,2] rather than (1,2). On the advent-of-brian day 8 solution, nothing in the pair loop is picked as the program runs any more, which made part 2 about a third faster.
  • find_subsequence returned the index or (), typed Any. It now returns an Int and fails when the subsequence isn't there, and the new find_subsequence? returns an Option<Int>, like first/first?. An empty subsequence is found at 0 instead of panicking.

🤖 Generated with Claude Code

…_subsequence 📐

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T21:12:40.272815Z 84f7d9a PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@timfennis
timfennis merged commit 57592fd into feat/type-checker Nov 13, 2026
1 check passed
@timfennis
timfennis deleted the feature/never-and-typed-builtins branch November 13, 2026 21:13
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