Simplify curried function calls to use uncurried syntax - #12
Merged
Merged
Conversation
ds_uncurry compiles `lambdas (a b ...)` definitions into multi-argument functions, so a single-argument call_global now runs the body with missing arguments instead of returning a partial closure. The eval example failed decoding that result as a closure, and fsm hit a match failure. Pass all arguments in one call_global instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011Vsc7gM2NbYCYBxR6BsFqG
beta computed shift(+1, subst(0, shift(+1, arg), body)), but de Bruijn beta reduction needs a downward shift after substituting, to account for the removed binder. Free variables drifted upward, so read_church never recognized a numeral and every test_add reported "timeout". Add an unshift and use it in beta; church 1+1, 1+2 and 2+2 now evaluate to 2, 3 and 4. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011Vsc7gM2NbYCYBxR6BsFqG
vbergeron
force-pushed
the
claude/determined-pasteur-96rgdu
branch
from
September 23, 2026 10:20
e3b94a9 to
a369192
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR simplifies function call patterns across the codebase by leveraging the VM's support for uncurried (multi-argument) function calls, eliminating the need for manual currying and intermediate
VmCallablevalues.Changes
examples/eval/src/main.rs: Removed the
call3helper function that manually curried a 3-argument function call. Replaced with a directvm.call_global(funcs::TEST_ADD, (a, b, fuel))call, which the VM now handles as a single uncurried operation.examples/fsm/src/main.rs: Simplified
run_stepto callSTEPas a 2-ary uncurried function directly instead of currying it into two separate calls (call_globalfollowed bycall_closure). Removed the now-unusedVmCallableimport.examples/eval/eval.scm: Added the
unshifthelper function to complement the existingshiftfunction, enabling proper variable index adjustment during beta reduction. Updated thebetafunction to useunshiftfor correct substitution semantics.Implementation Details
The VM already supports passing multiple arguments to
call_global, which internally handles the uncurrying. This change makes the call sites cleaner and more direct, reducing boilerplate while maintaining the same functionality. The Scheme changes ensure correct de Bruijn index management during lambda application.https://claude.ai/code/session_011Vsc7gM2NbYCYBxR6BsFqG