Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uunet!snorkelwacker!bloom-beacon!GARLIC.STANFORD.EDU!mkatz From: mkatz@GARLIC.STANFORD.EDU (Morris Katz) Newsgroups: comp.lang.scheme Subject: Request for Comments: A new n-ary function construction Message-ID: <8911272329.AA07264@garlic.Stanford.EDU> Date: 27 Nov 89 23:29:55 GMT References: <891127-144857-1155@Xerox> Sender: root@athena.mit.edu (Wizard A. Root) Organization: The Internet Lines: 31 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 katz@cs.stanford.edu -------------------------------------------------------------------------------