From: =?ISO-8859-15?Q?Andr=E9_Thieme?=
Subject: How is values-list defined?
Date: 
Message-ID: <d8pip7$ian$1@ulric.tng.de>
One could make a macro values-list-macro that returns its arguments:

(values-list-macro (1 2 3))
1
2
3

But it would mean:
(values-list-macro (list 1 2 3))
LIST
1
2
3


And this does look strange to me:
(defun my-values-list (list)
   (eval `(values ,@lst)))

At least it now is a function:
(my-values-list (list 1 2 3))
1
2
3

Do you have better suggestions for an implementation of my-values-list?


Andr�
-- 

From: Carl Taylor
Subject: Re: How is values-list defined?
Date: 
Message-ID: <AAYre.324431$cg1.148401@bgtnsc04-news.ops.worldnet.att.net>
"Andr� Thieme" <······························@justmail.de> wrote in message 
·················@ulric.tng.de...
> One could make a macro values-list-macro that returns its arguments:

[...]

> Do you have better suggestions for an implementation of my-values-list?

CL-USER 2 >
(defun my-values-list (list)
   (apply #'values list))
MY-VALUES-LIST

CL-USER 3 > (my-values-list (list 1 2 3 4 5 6))
1
2
3
4
5
6

Carl Taylor 
From: Carl Taylor
Subject: Re: How is values-list defined?
Date: 
Message-ID: <RMYre.324465$cg1.213117@bgtnsc04-news.ops.worldnet.att.net>
Carl Taylor wrote:
> "Andr� Thieme" <······························@justmail.de> wrote in
> message ·················@ulric.tng.de...
>> One could make a macro values-list-macro that returns its arguments:
>
> [...]
>
>> Do you have better suggestions for an implementation of
>> my-values-list?
>
> CL-USER 2 >
> (defun my-values-list (list)
>   (apply #'values list))
> MY-VALUES-LIST

Oops, no need for this -- <values-list> is already defined as a Lisp 
function.

CT 
From: =?ISO-8859-15?Q?Andr=E9_Thieme?=
Subject: Re: How is values-list defined?
Date: 
Message-ID: <d8qgo4$c7e$1@ulric.tng.de>
Carl Taylor schrieb:
> Carl Taylor wrote:
> 
>> "Andr� Thieme" <······························@justmail.de> wrote:
>>
>>> One could make a macro values-list-macro that returns its arguments:
>>
>>
>> [...]
>>
>>> Do you have better suggestions for an implementation of
>>> my-values-list?
>>
>>
>> CL-USER 2 >
>> (defun my-values-list (list)
>>   (apply #'values list))
>> MY-VALUES-LIST
> 
> 
> Oops, no need for this -- <values-list> is already defined as a Lisp 
> function.

Yes, that's why I put it into the subject of post.
Of course values-list was not the function I was looking for when I asked
how to implement it ;)

However, your previous implementation with the obvious use of apply is
what I was looking for, thanks.


Andr�
-- 
From: Barry Margolin
Subject: Re: How is values-list defined?
Date: 
Message-ID: <barmar-79DB78.20265615062005@comcast.dca.giganews.com>
In article <············@ulric.tng.de>,
 Andr� Thieme <······························@justmail.de> wrote:

> One could make a macro values-list-macro that returns its arguments:
> 
> (values-list-macro (1 2 3))
> 1
> 2
> 3
> 
> But it would mean:
> (values-list-macro (list 1 2 3))
> LIST
> 1
> 2
> 3

Of course.  The reason you implemented it as a macro is presumably 
because you didn't want the argument to be evaluated.  If you want it 
evaluated, use the normal values-list function.

> And this does look strange to me:
> (defun my-values-list (list)
>    (eval `(values ,@lst)))
> 
> At least it now is a function:
> (my-values-list (list 1 2 3))
> 1
> 2
> 3
> 
> Do you have better suggestions for an implementation of my-values-list?

What are you really trying to accomplish?  What does my-values-list do 
that the built-in values-list doesn't?

-- 
Barry Margolin, ······@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
From: =?ISO-8859-15?Q?Andr=E9_Thieme?=
Subject: Re: How is values-list defined?
Date: 
Message-ID: <d8qidh$dmi$1@ulric.tng.de>
Barry Margolin schrieb:

> What are you really trying to accomplish?  What does my-values-list do 
> that the built-in values-list doesn't?

Nothing more. I just wanted to know how it is implemented.
I overlooked the obvious way of using apply like Carl suggested.
Maybe you have another idea that doesn't need apply?


Andr�
-- 
From: GP lisper
Subject: Re: How is values-list defined?
Date: 
Message-ID: <1118915107.0472c9cca7604630de46cf7d3794cbfb@teranews>
On Thu, 16 Jun 2005 02:53:00 +0200, <······························@justmail.de> wrote:
>
> Barry Margolin schrieb:
>
>> What are you really trying to accomplish?  What does my-values-list do 
>> that the built-in values-list doesn't?
>
> Nothing more. I just wanted to know how it is implemented.

You should be able to find the source to values-list within your
Common Lisp.  With SLIME, set the point just after the desired
function and "M-."


-- 
The LOOP construct is really neat, it's got a lot of knobs to turn!
Don't push the yellow one on the bottom.
From: Juliusz Chroboczek
Subject: Re: How is values-list defined?
Date: 
Message-ID: <7ill5ak4l5.fsf@lanthane.pps.jussieu.fr>
Andr� Thieme <······························@justmail.de>:

> And this does look strange to me:
> (defun my-values-list (list)
>    (eval `(values ,@lst)))

> At least it now is a function:
> (my-values-list (list 1 2 3))
> 1
> 2
> 3

But it's wrong.

  (my-values-list (list 'a 'b 'c))

Try

  (defun my-values-list (list)
     (eval `(values ,@(mapcar #'(lambda (x) (list 'quote x)) list))))

or simply

  (defun my-values-list (list)
     (apply #'values list))

Rule of thumb: every use of EVAL in Common Lisp is incorrect.  Either
EVAL can be replaced with APPLY, or else it gets the lexical environment
wrong.

(And yes, CL-Yacc uses EVAL; hey, it's only a rule.  That's the very
reason why you cannot use DEFINE-PARSER in a non-null lexical environment.)

                                        Juliusz