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

Re: Does FORMAT handle multiple values



    Date: Thu, 23 May 1985  04:57 EDT
    From: Rob MacLachlan <RAM@CMU-CS-C.ARPA>
    Subject: Does FORMAT handle multiple values

	Date: Thursday, 23 May 1985  04:30-EDT
	From: Dave <Steiner at RUTGERS.ARPA>
	To:   Common-Lisp at SU-AI.ARPA
	Re:   Does FORMAT handle multiple values

	(format t "~S~%" (progn ... (values ...)))

    I'm not sure what you think that code is supposed to do, but there are
    two ways that I can think of to turn MV's into format arguments (or
    any other kind of arguments).  You can use Multiple-Value-List (not
    values-list, as you said) 

Oops, I always mix up Values-List and Multiple-Value-List.  Obviously
need a TWIM (Type What I Mean :-)).

			      to get a list, or you can use
    Multiple-Value-Call.

What I'm doing is generating a bunch of test cases for random
functions, ie (format t "~S~%" (foo ...)).  I'd rather not have to do
a Multiple-Value-List around everything for the few times that
something returns MVs.  I was hoping that format could handle
multiple values in some way that I wouldn't have to know if I was
dealing with MVs or not.  Doesn't look like it.  Oh well.

    In Common Lisp, there is no user-visible distinction between returning
    one value and returning one "multiple value", so the
    multiple-value-### primitives will work fine even if only one value is
    being returned.

      Rob

    Date: Thursday, 23 May 1985, 10:43-EDT
    From: Guy Steele <gls%AQUINAS@THINK.ARPA>
    Subject: Does FORMAT handle multiple values

	Date: 23 May 85 04:30:24 EDT
	From: Dave <Steiner@RUTGERS.ARPA@think>


	Does format handle multiple values at all?  What I want to do is
	something like the following (only this throws away everything but
	the first value):

	(format t "~S~%" (progn ... (values ...)))

    I would write this as

	(multiple-value-call #'format t "~S~%" (progn ... (values ...)))

In this case you either have to know how many values you are going to
be returning or use the iteration directive in the format string.  If
you type this in as written (assuming that you get more than one
value back from values), you only get one value printed.

    thereby causing multiple values from each argument form to be
    "spread out" as separate arguments to FORMAT.

    --Guy

Oh well, looks like I'm going to have to have a separate case for
MVs.  thanks anyway.

ds
uucp:   ...{harvard, seismo, ut-sally, sri-iu, ihnp4!packard}!topaz!steiner
arpa:   Steiner@RUTGERS
-------