Another attempt to generate smarter arity-inspectable case-lambdas - #1189
Merged
Merged
Conversation
ashinn
reviewed
Sep 1, 2026
| ;; by rest arg | ||
| ((%case-lambda ((arg . _) ...) non-parsed-args clauses ...) | ||
| (lambda (arg ... . rest) | ||
| (let ((len (length `((unquote arg) ... . (unquote rest))))) |
Owner
There was a problem hiding this comment.
Currently Chibi doesn't constant fold length on a constant list but I'm likely to implement that. Even without the folding, there's no reason to construct a list at runtime here:
Suggested change
| (let ((len (length `((unquote arg) ... . (unquote rest))))) | |
| (let ((len (+ (length '(arg ...)) (length rest)))) |
Contributor
Author
|
@ashinn I believe I fixed the length calculation
|
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.
Yes, I’m at it again—trying to make
case-lambda-generated lambdas to have more inspectable and truthful arities. This time, the implementation is short (17 lines -> 30 lines,) tested, documented, and more straightforward in general. Expansion time shouln’t be too long either, especially compared to the previous attempt (#1167), where a whole set of recursive macros handling arglists was used.@ashinn how does that look?