TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Land Of Lisp chapter 7 - Using SBCL

24 pointsby ciaranbradleyover 14 years ago

5 comments

gibsonf1over 14 years ago
Here's a function to create svg (default) or jpg for both sbcl and lispworks from graphviz:<p>(defun make-svg (file-name &#38;key jpg)<p><pre><code> #+lispworks (sys:call-system-showing-output (string+ cl-user::*organontech-graphviz* (if jpg " -Tjpg " " -Tsvg ") cl-user::*fcgaa-lean-mapping-path* "/" file-name ".dot" " -o " cl-user::*fcgaa-lean-mapping-path* "/" file-name (if jpg ".jpg" ".svg"))) #+sbcl (sb-ext:run-program cl-user::*organontech-graphviz* (list (if jpg "-Tjpg" "-Tsvg") (string+ cl-user::*fcgaa-lean-mapping-path* "/" file-name ".dot") "-o" (string+ cl-user::*fcgaa-lean-mapping-path* "/" file-name (if jpg ".jpg" ".svg"))) :output (weblog-stream) ) ) </code></pre> (defun weblog-stream ()<p><pre><code> (or (net.aserve:vhost-log-stream (net.aserve:wserver-default-vhost net.aserve:*wserver*)) t)) ;;sends output directly to html stream on portable allegroserve </code></pre> (defmacro string+ (string &#38;rest strings) `(concatenate 'string ,string ,@strings))
ciaranbradleyover 14 years ago
I bought the book the other day after it was posted here: <a href="http://news.ycombinator.com/item?id=1836935" rel="nofollow">http://news.ycombinator.com/item?id=1836935</a> 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.<p>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.
mahmudover 14 years ago
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.<p><a href="http://common-lisp.net/project/trivial-shell/" rel="nofollow">http://common-lisp.net/project/trivial-shell/</a>
评论 #1852027 未加载
评论 #1852007 未加载
waterhouseover 14 years ago
I use this. This makes the "shell" command work in SBCL, and does nothing in CLISP or any other implementation.<p><pre><code> #+sbcl (defun shell (x) (run-program "/bin/sh" (list "-c" x) :output t)) </code></pre> Tell me if you want it to work in an implementation other than CLISP or SBCL, and if I can install it on my computer, then I'll figure it out.
flavoieover 14 years ago
A page dedicated to landoflisp on sbcl would great. clisp looks like more trouble to install on my mac than the sbcl package.
评论 #1852313 未加载
评论 #1852241 未加载