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

&rest replacement/addition



    Date: Mon, 04 Apr 88 10:24:30 EDT
    From: Sean.Engelson@spice.cs.cmu.edu

    (defun fu (a &more-args)
       (do-args (arg)
	  ...code...
	  (moby-calculation a arg)
	  ...more code...
	))

This is similar in spirit to MacLisp's lexprs, which also had special
forms for accessing the arguments.  However, it needs a minor fix to
prevent it from sharing one of their faults, too.  &MORE-ARGS should be
followed by a symbol, which would be used as an argument to the special
forms.  This way you can have nested functions that use &MORE-ARGS and
be able to access the outer function's arguments from the inner
function.

Actually, if this were added, the operations that extract the arguments
need not be special forms.  &MORE-ARGS <var> could bind <var> to an
object of type MORE-ARGS.  Common Lisp would only specify accessors for
this object, so it could be passed along with no possibility of strange
side-effects.  APPLY could also be extended to allow a MORE-ARGS in
place of a list as its last argument.

                                                barmar