I do not read over or edit the content on this blog. There will be spelling errors, grammatical errors, and run-on sentences that make no sense.

Friday, August 18, 2006

LISP printm

If you are reading "The Elements of Artificial Intelligence" by Steven L. Tanimoto here is a "printm" macro:

(defmacro printm (&body body)
`'(,@body))

CL-USER> (printm this is a test)
(THIS IS A TEST)

or if you want the data not to print out as a list:

(defmacro printm (&body body)
`(format nil "~{~D ~}" '(,@body)))

CL-USER> (printm this is a test)
"THIS IS A TEST"

1 Comments:

Blogger simondublin said...

heh heh - exactly what i was looking for, and for this very book - much obliged!

1:48 PM

 

Post a Comment

Links to this post:

Create a Link

<< Home