For Programmers: Free Programming Magazines  


Home > Archive > Lisp > December 2004 > ~:{...~} equivalent to ~{~1{...~:}~}?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author ~:{...~} equivalent to ~{~1{...~:}~}?
Peter Seibel

2004-12-20, 3:56 am

It seems that ~:{...~} will behave the same as ~{~1{...~:}~}. Likewise
~:@{...~} and ~@{~1{...~:}~} should be equivalent unless I'm missing
something. So am I missing something?

-Peter

--
Peter Seibel peter@javamonkey.com

Lisp is the red pill. -- John Fraser, comp.lang.lisp
Carl Taylor

2004-12-20, 3:59 pm


"Peter Seibel" <peter@javamonkey.com> wrote in message
news:m3llbtocj2.fsf@javamonkey.com...
> It seems that ~:{...~} will behave the same as ~{~1{...~:}~}. Likewise
> ~:@{...~} and ~@{~1{...~:}~} should be equivalent unless I'm missing
> something. So am I missing something?


In LW:

CL-USER 6 > (format t "~:{~A ~}" '((foo) (bar) (baz) (quux)))
FOO BAR BAZ QUUX
NIL

CL-USER 7 > (format t "~{~1{~A ~:}~}" '((foo) (bar) (baz) (quux)))
FOO BAR BAZ QUUX
NIL

CL-USER 8 > (format t "~:@{~A ~}" '((foo) (bar) (baz) (quux)))
(FOO)
NIL

CL-USER 9 > (format t " ~@{~1{~A ~:}~} " '((foo) (bar) (baz) (quux)))
(FOO)
NIL

The first and second do yield the same result. But the third and fourth are
slightly different. Note the result (FOO) is indented by one space in the
last example.

clt

Peter Seibel

2004-12-20, 8:58 pm

"Carl Taylor" <carltaylor@att.net> writes:

> "Peter Seibel" <peter@javamonkey.com> wrote in message
> news:m3llbtocj2.fsf@javamonkey.com...
>
> In LW:
>
> CL-USER 6 > (format t "~:{~A ~}" '((foo) (bar) (baz) (quux)))
> FOO BAR BAZ QUUX
> NIL
>
> CL-USER 7 > (format t "~{~1{~A ~:}~}" '((foo) (bar) (baz) (quux)))
> FOO BAR BAZ QUUX
> NIL
>
> CL-USER 8 > (format t "~:@{~A ~}" '((foo) (bar) (baz) (quux)))
> (FOO)
> NIL
>
> CL-USER 9 > (format t " ~@{~1{~A ~:}~} " '((foo) (bar) (baz) (quux)))
> (FOO)
> NIL
>
> The first and second do yield the same result. But the third and
> fourth are slightly different. Note the result (FOO) is indented by
> one space in the last example.


Uh, don't you think that has something to do with the extra space at
the beginning of the format string. ;-)

-Peter

--
Peter Seibel peter@javamonkey.com

Lisp is the red pill. -- John Fraser, comp.lang.lisp
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com