Preserve minimum possible arity in case-lambda-generated procedure - #1167
Preserve minimum possible arity in case-lambda-generated procedure#1167aartaka wants to merge 2 commits into
Conversation
8103234 to
b9fbb90
Compare
|
CC @ashinn |
|
The code is much larger and harder to follow, expansion is slower, you're pulling SRFI 1 into That said, the depths to which I despise is just and I can merge this, but if it breaks I'll revert and never accept patches for |
Given that most
I pushed a fixed version that no longer depends on SRFI 1. Use your judgement, I’m not particularly attached to this code and it’s fine by me if you don’t merge—it is quite repulsing indeed. Is there maybe a better macro magic way to get the shorter of two arglists? Mine seems overly complex. Is that the way to go even? |
| ;; Generate the actual lambda with the right minimum arity | ||
| ((%collect-args (shortest ...) (clauses ...)) | ||
| (lambda (shortest ... . rest) | ||
| (let ((len (length `((unquote shortest) ... . (unquote rest))))) |
There was a problem hiding this comment.
| (let ((len (length `((unquote shortest) ... . (unquote rest))))) | |
| (let ((len (+ (length '(shortest ...)) (length rest)))) |
It always grated me that
case-lambda-created procedures had0+arity. Even when having actual clear arglists with fixed / minimum arity. That’s because the current implementation ofcase-lambdaalways sets a rest argument and processed it instead of actual arguments. Which is fine! Just that I want more understanding over the structure of the lambda. Thus this pull request: to get the minimum arity of acase-lambdaright.Tested on this expression (try and remove some of the clauses to observe the effect:)