Write a really short SRFI for it, then.

On Mon, Aug 23, 2021 at 11:58 AM Marc Nieper-Wißkirchen <xxxxxx@gmail.com> wrote:
Am Mo., 23. Aug. 2021 um 16:36 Uhr schrieb John Cowan <xxxxxx@ccil.org>:
Note also that both `receive` and `let-optionals` are being balloted.

It would be nice to have also a let-optionals case-lambda version, say lambda-optionals (modulo evaluation order called opt-lambda in Chibi, I think):

(lambda-optionals (x y (z a) (w b) . u)
  body)

=>

(rec f
  (case-lambda
    ((x y) (f x y a b))
    ((x y z) (f x y z b))
    ((x y z w . u) body)))

(For rec, see SRFI 31.)

Of course, for Schemes with an optimized let-optionals but no optimized case-lambda, this could be expanded into

=>

(lambda (x y . rest)
  (let-optionals* rest ((z a) (w b) u)
    body))

For many cases, lambda-optionals seems the better abstraction than let-optionals* because in let-optionals*, the rest argument, which is an implementation detail, is explicit and must be named.



On Mon, Aug 23, 2021 at 10:08 AM Lassi Kortela <xxxxxx@lassi.io> wrote:
Note that:

- (receive ...) can be converted to the standard (let-values ...)

- (let-optionals ...) can be converted to the standard (case-lambda ...)