[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Request for Comments: A new n-ary function construction

   Date: Mon, 27 Nov 89 14:11:47 PST
   From: Pavel.pa@Xerox.COM

   To what procedure would you apply "arity" to get the answer?

In retrospect it is clear that my original message on this subject was so
cryptic as to be content free.  I would propose having one extra argument which
would be bound to a procedure which would return the optional arguments as
multiple return values.  For symetry reasons, a language which supports
multiple return values would require two types of arity functions:  call-arity
and return-arity.  (Please don't flame about the names.  I just hate using foo
and bar as names when I can think of something semantically more meaningful.)
Call-arity is the procedure which is more commonly called arity and returns
information about the number of parameters which a function expect.
Return-arity is the procedure which returns information about the number of
return values to be returned by a function.  An application of return-arity to
the special function which is bound to optional arguments would return
information about the number of optionals which were supplied.

I realize that this proposal goes far beyond Pavel's original question; but, I
believe that multiple return values should be integrated into Scheme for good
symetry reasons.  I feel that this can be done in such a way that they will
actually solve many more problems than they create.  Pavel's application is
only one of many examples where the multiple value approach actually leads to a
quite elegant solution.

Morry Katz