From: Lowell Kirsh
Subject: why doesn't this work
Date: 
Message-ID: <c3ecsp$gc5$1@mughi.cs.ubc.ca>
Why does this not work?

First I have a function '&' which will join together a list of strings 
with '<newline>* ' as the delimiter. It seems to work fine on it's own.

(defun & (&rest list)
   (format nil "~{~A~^~%* ~}" list))

Now I try to do the following:

(format nil "* ~A~%" (& "foo" "bar"))

Which should give me :

"* foo
* bar"

But it gives me:

"*
foo
* bar"

Any ideas why it is not working as expected?

Lowell

From: Wolfhard Buß
Subject: Re: why doesn't this work
Date: 
Message-ID: <m3ish15gx6.fsf@buss-14250.user.cis.dfn.de>
* Lowell Kirsh writes:

> Why does this not work?
>
> First I have a function '&' which will join together a list of strings
> with '<newline>* ' as the delimiter. It seems to work fine on it's own.
>
> (defun & (&rest list)
>    (format nil "~{~A~^~%* ~}" list))
>
> Now I try to do the following:
>
> (format nil "* ~A~%" (& "foo" "bar"))
>
> Which should give me :
>
> "* foo
> * bar"
>
> But it gives me:
>
> "*
> foo
> * bar"
>
> Any ideas why it is not working as expected?

You are using CLISP.  On the other hand, I'm not surprised that a
function called "&" refuses cooperation.

-- 
"Hurry if you still want to see something. Everything is vanishing."
                                       --  Paul C�zanne (1839-1906)
From: Lowell Kirsh
Subject: Re: why doesn't this work
Date: 
Message-ID: <c3ees2$gcm$1@mughi.cs.ubc.ca>
Wolfhard Bu� wrote:

> You are using CLISP.  On the other hand, I'm not surprised that a
> function called "&" refuses cooperation.

Yeah, I know that & is a bad name. It's only temporary...
So how'd you know that I'm using CLISP? Is there a bug in it or do they 
have some strange interpretation of the spec?

Lowell
From: Wolfhard Buß
Subject: Re: why doesn't this work
Date: 
Message-ID: <m3wu5h2jyc.fsf@buss-14250.user.cis.dfn.de>
* Lowell Kirsh writes:

> So how'd you know that I'm using CLISP? Is there a bug in it or do
> they have some strange interpretation of the spec?

You've seen a bug.  Don't know if he made it into the latest release.

-- 
"Hurry if you still want to see something. Everything is vanishing."
                                       --  Paul C�zanne (1839-1906)
From: szymon
Subject: Re: why doesn't this work
Date: 
Message-ID: <c3egk8$ing$1@nemesis.news.tpi.pl>
Lowell Kirsh wrote:
> Why does this not work?

I'm newbie too, so I don't no why... but with SBCL
your code works fine.

CL-USER> (defun & (&rest list)
   (format nil "~{~A~^~%* ~}" list))
&
CL-USER> (& "foo" "bar")
"foo
* bar"
CL-USER> (format nil "* ~A~%" (& "foo" "bar"))
"* foo
* bar
"
CL-USER> (format nil "* ~A" (& "foo" "bar"))
"* foo
* bar"

regards, szymon.
From: David Sletten
Subject: Re: why doesn't this work
Date: 
Message-ID: <MNA6c.5322$Lq4.725@twister.socal.rr.com>
Lowell Kirsh wrote:

> Why does this not work?
> 
> First I have a function '&' which will join together a list of strings 
> with '<newline>* ' as the delimiter. It seems to work fine on it's own.
> 
> (defun & (&rest list)
>   (format nil "~{~A~^~%* ~}" list))
> 
> Now I try to do the following:
> 
> (format nil "* ~A~%" (& "foo" "bar"))
> 
> Which should give me :
> 
> "* foo
> * bar"
> 
> But it gives me:
> 
> "*
> foo
> * bar"
> 
> Any ideas why it is not working as expected?
> 
> Lowell
I see the same bug with Clisp 2.29 on Macintosh. MCL behaves as you 
expected, however.