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

Re: Multiple values and &optional



	
    Date: Fri, 20 Dec 85 17:03 EST
    From: Guy Steele <gls@THINK-AQUINAS.ARPA>
    To: common-lisp@SU-AI.ARPA
    Subject: Multiple values and &optional
    Message-ID: <851220170310.1.GLS@THINK-WENCESLAS.ARPA>
    
    Just for the record, I had an application today where I really wanted to
    write something like
    
	    (MULTIPLE-VALUE-BIND (VALUE &OPTIONAL (FOUNDP T))
		(FUNCALL (MAGIC-HOOK-FUNCTION THINGY) FUNNY-ARG)
	      (WHEN FOUNDP
		(CACHE-SOME-STUFF THINGY FUNNY-ARG VALUE))
	      (VALUES VALUE FOUNDP))
    
How about:

        (multiple-value-call #'(lambda (value &optional (foundp t))
                                 (when foundp
                                   (cache-some-stuff thingy funny-arg value))
                                 (values value foundp))
                             (magic-hook-function thingy))

And I agree that MULTIPLE-VALUE-BIND should be able to take a full-blown
lambda-list.

	-- Nick