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

1Question about declaration0



    Date: Fri, 11 Dec 87 10:54 EST
    From: Robert W. Kerns <RWK@YUKON.SCRC.Symbolics.COM>
    
        Date: Fri, 11 Dec 87 01:16 EST
        From: Brad Miller <miller@ACORN.CS.ROCHESTER.EDU>
    
    1    How would you write a function declaration for the following?
    
        (defun foo (bar)
    	    (declare (type list bar))
    	    (values-list bar)
    
        (proclaim '(function foo (list) ????))
    
    0I wouldn't.  CL doesn't have any syntax for declaring
    a variable number of values, period.
    
I think you can do this in CL:

(function foo (list) (values &rest list))

see CLtL pg 48 under the values type specifier. The explaination for
this "feature" is motivated by multiple-value-call.

So presumably with this declaration, you can do

(multiple-value-call '+ (foo 1 2 3))

and get some kind of optimized call since it knows it's getting back
a variable number of values when FOO returns.

...mike beckerle