Quotes output by format (neeb questions)

For the Compleat Fan
Locked
ptdecker
Posts: 4
Joined: Fri Apr 29, 2005 8:26 pm
Contact:

Quotes output by format (neeb questions)

Post by ptdecker »

I'm working through Peter Seibel's Practical Common Lisp book using NewLisp as my environment (at least at work where I'm stuck with windows). Anyway, early on he provides an example to print the proverbial Hello World (from his book):

Code: Select all

> (format t "hello, world")
hello, world
nil
I quickly figured out that NewLisp wants a format string in place of the "t", so I tried:

Code: Select all

> (format "%s" "hello, world")
"hello, world"
>
This is great, but the point of the excercise was to get rid of the quotes in the output stream.

Any hints on how to do this in NewLisp? I couldn't find a thread on quotes in the forum and the NewLisp manual section on Format doesn't discuss the topic.

And, is there a FAQ that illustrates the differences between NewLisp and Common Lisp?

P. Todd

HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Re: Quotes output by format (neeb questions)

Post by HPW »

ptdecker wrote:Any hints on how to do this in NewLisp? I couldn't find a thread on quotes in the forum and the NewLisp manual section on Format doesn't discuss the topic.

And, is there a FAQ that illustrates the differences between NewLisp and Common Lisp?
Maybe this:
(silent(print "hello, world"))

http://www.newlisp.org/index.cgi?page=FAQ

http://www.newlisp.org/index.cgi?page=D ... ther_LISPs
Hans-Peter

ptdecker
Posts: 4
Joined: Fri Apr 29, 2005 8:26 pm
Contact:

Post by ptdecker »

Yes, your suggestion works fine. Thank you.

Also, the "Differences" FAQ is most helpful. Somehow, missed the link to it the first time I went through the general FAQ.

P. Todd

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

The quotes in the output stream are just the return value shown in the console with quotes. The same would happen if you just enter:

Code: Select all

> "Hello World"

"Hello World"
>
at the prompt. Format by itself does not print it just returns a formatted string. Normally you would have format embedded in a print statement:

Code: Select all

> (println (format "%s %d" "hello" 123))
hello 123
"hello 123"

>
The first line is the output from the println statement, the second is just the return value of 'println' shown in the interactive console.

For learning newLISP the usual LISP/Scheme Literature may lead you into the wrong direction. There is some usefull stuff on the newlisp.org website here: http://newlisp.org/index.cgi?page=Tips_and_Tricks in the 'Tutorials' section. I recommend at first the "newLISP in 21 minutes" tutorial and then the paper "Design Elements and Patterns in newLISP".

Last not least: Welcome to the newLISP discussion group.

Lutz

Locked