Quotes output by format (neeb questions)

Started by ptdecker, April 29, 2005, 02:00:42 PM

Previous topic - Next topic

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):
> (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:
> (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

#1
Quote from: "ptdecker"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=FAQ



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

ptdecker

#2
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

#3
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:



> "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:



> (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">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