> Same amount of code as what?

As the lambda* macro I sent in another currying thread:

(define-syntax lambda*
 (syntax-rules ()
   ((_ (x x* ...) b b* ...)
    (let ((f (lambda (x x* ...) b b* ...)))
      (...
        (define-syntax cases
          (syntax-rules ()
            ((_ (x^ ...) () f^ (c ...))
             (case-lambda c ...
               ((x^ ...) (f^ x^ ...))
               ((x^ ... . w) (apply (f^ x^ ...) w))))
            ((_ (x^ ...) (y1 y2 ...) f^ (c ...))
             (cases (x^ ... y1) (y2 ...) f^
               (((x^ ...) (lambda* (y1 y2 ...) (f^ x^ ... y1 y2 ...)))
                c ...))))))
      (cases (x) (x* ...) f ())))))

>> and possibly more efficient... I don't know
>
> I don't think so.  In ikarus, the compiler only understands
> case-lambda and expands lambdas to the corresponding 1-clause
> case-lambda.

so doing an expansion to a case-lambda with lots of clauses could be
better than creating the partially applied functions at run time.

Reply via email to