I bought the book the other day after it was posted here: http://news.ycombinator.com/item?id=1836935 and have been working through the chapters. The book contains some CLISP specific code but I'm running SBCL. So this is my SBCL hack for the first stumbling block I found.
disclaimer: I'm a LISP noob, so this is a beginners hack, but it may help others (like me) who have had difficulty installing CLISP.
Instead of using implementation dependent functions, use a library like trivial-shell, which is also available via QuickLisp. It has the SHELL-COMMAND function you need.
Cheers, I thought there might be something that was QL installable but didn't want to get sidetracked from the task at hand. I'll have a play with that in the morning :)
Thanks again for the advice, and the offer. Be warned, I may take you up on it :)
I shall investigate creating that image. I found ASDF to be a bit problematic when I tried it on it's own (which is probably down to my inexperience), but QL worked first time.
Also, you might find this slow little utility for converting a bunch of stuff into strings. It will do the job nicely, and it accepts every Lisp type.
(defun str (&rest strings)
(apply 'concatenate 'string
(loop for x in strings
collecting (format nil "~a" x))))
You can use it like this:
(shell (str "dot -Tpng -O " fname))
You might also find that WITH-OPEN-FILE arguments can get a little unwieldy to type in the repl, specially if you want to overwrite files, so you can use this WITH-TEXT-FILE macro. For binary files you will just need to add (:element-type '(unsigned-byte 8))
I consciously avoided that because FORMAT and LOOP mastery is something that should wait until one knows Lisp well. Introduced too early, they can either scare someone (in the case of format) or tempt one to start writing Pascal (in the case of loop; which is why deliberately used it for its collected result, and not its side-effect, as more common.)
FWIW, my first Lisp programs where board-games and I learned quite a bit about recursion trying to format ASCII art in curses. If I knew FORMAT had control, I wouldn't have learned much lisp so quickly, since quirky little DSLs are fascinating.
(or (net.aserve:vhost-log-stream (net.aserve:wserver-default-vhost net.aserve:*wserver*))
t)) ;;sends output directly to html stream on portable allegroserve
14 comments
[ 4.2 ms ] story [ 24.7 ms ] threaddisclaimer: I'm a LISP noob, so this is a beginners hack, but it may help others (like me) who have had difficulty installing CLISP.
http://common-lisp.net/project/trivial-shell/
Of course, you're more than welcome to shoot me an email if you ever get stuck.
Here is a far more forgiving reference to Common Lisp than the Hyperspec, though don't let the fancy TeX typesetting intimidate you.
http://clqr.berlios.de/clqr-a4-consec.pdf
In addition to that, I think you should dump yourself a nice image with ASDF and QL builtin, so you don't have to load them every time.
I shall investigate creating that image. I found ASDF to be a bit problematic when I tried it on it's own (which is probably down to my inexperience), but QL worked first time.
FWIW, my first Lisp programs where board-games and I learned quite a bit about recursion trying to format ASCII art in curses. If I knew FORMAT had control, I wouldn't have learned much lisp so quickly, since quirky little DSLs are fascinating.
(defmacro str (string &rest strings)
`(concatenate 'string ,string ,@strings))
http://rudix.org/packages-abc.html#clisp
(defun make-svg (file-name &key jpg)
(defun weblog-stream () (defmacro string+ (string &rest strings) `(concatenate 'string ,string ,@strings))