﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-hex108-随笔分类-lisp</title><link>http://www.cppblog.com/hex108/category/15052.html</link><description>懂历史 ==&gt; 知未来</description><language>zh-cn</language><lastBuildDate>Sun, 17 Oct 2010 00:37:41 GMT</lastBuildDate><pubDate>Sun, 17 Oct 2010 00:37:41 GMT</pubDate><ttl>60</ttl><item><title>Practical Common Lisp（二）一个简单的&amp;ldquo;数据库&amp;rdquo;</title><link>http://www.cppblog.com/hex108/archive/2010/10/01/128227.html</link><dc:creator>hex108</dc:creator><author>hex108</author><pubDate>Fri, 01 Oct 2010 14:23:00 GMT</pubDate><guid>http://www.cppblog.com/hex108/archive/2010/10/01/128227.html</guid><wfw:comment>http://www.cppblog.com/hex108/comments/128227.html</wfw:comment><comments>http://www.cppblog.com/hex108/archive/2010/10/01/128227.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/hex108/comments/commentRss/128227.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/hex108/services/trackbacks/128227.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: lisp的功能还是挺强大的，简单的几行代码就搞定了一个小的“数据库”（经验：调试macro的时候可以用macroexpand-1展开该macro，看是否与设想的一样。）。&nbsp;&nbsp;<a href='http://www.cppblog.com/hex108/archive/2010/10/01/128227.html'>阅读全文</a><img src ="http://www.cppblog.com/hex108/aggbug/128227.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/hex108/" target="_blank">hex108</a> 2010-10-01 22:23 <a href="http://www.cppblog.com/hex108/archive/2010/10/01/128227.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Practical Common Lisp（一）运行环境emacs+slime+sbcl 与 编译运行</title><link>http://www.cppblog.com/hex108/archive/2010/10/01/128226.html</link><dc:creator>hex108</dc:creator><author>hex108</author><pubDate>Fri, 01 Oct 2010 14:03:00 GMT</pubDate><guid>http://www.cppblog.com/hex108/archive/2010/10/01/128226.html</guid><wfw:comment>http://www.cppblog.com/hex108/comments/128226.html</wfw:comment><comments>http://www.cppblog.com/hex108/archive/2010/10/01/128226.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/hex108/comments/commentRss/128226.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/hex108/services/trackbacks/128226.html</trackback:ping><description><![CDATA[


		<p>最近《hackers &amp; painters》学到的印象最深的一点是：lisp比你想像中的还强大，用lisp吧！</p>
		<p>1. 安装运行环境</p>
		<p>a. 下载emacs，解压即可。</p>
		<p>b. 下载slime，解压即可</p>
		<p>c. 下载sbcl，安装</p>
		<p>d. 配置emacs</p>
		<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 首先需要确定emacs会加载哪里的.emacs配置文件（即emacs的HOME目录为什么），可以通过改注册表(新添注册表项HKEY_CURRENT_USER\Software\GNU\Emacs(新建一个GNU项，然后在GNU项下新建一个子项Emacs)，新增一个项HOME,设置其字符串值为emacs解压后的目录)</p>
		<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 在emacs解压后的目录中，新建一个.emacs文件，添加如下几行:</p>
		<blockquote>
				<div>
						<pre>;<span style="color: rgb(0, 0, 255);">for</span> lisp mode
(add-to-list 'load-path "<span style="color: rgb(139, 0, 0);">D:\\slime\\</span>") ; <font color="#ff0000">注：在windows下路径分隔符为</font><a href="file://%5C%5C%E8%80%8C%E4%B8%8D%E6%98%AF%5C%EF%BC%8C%E5%90%A6%E5%88%99%E4%BC%9A%E8%A2%AB%E8%A7%A3%E9%87%8A%E4%B8%BA%20D:slime%EF%BC%8C%20%E6%88%96%E8%80%85%E6%94%B9%E6%88%90%E5%8F%A6%E5%A4%96%E4%B8%80%E7%A7%8D%E5%86%99%E6%B3%95%20D:/slime%28setq"><font color="#ff0000">\\而不是\，否则会被解释为 D:slime， 或者改成另外一种写法 D:/slime</font>
(setq</a> inferior-lisp-program "<span style="color: rgb(139, 0, 0);">D:\\SteelBankCommonLisp\\sbcl.exe</span>")   ;注：如果此处路径有空格，在M-x slime时会出现问题：<span style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; white-space: normal; font-size: 12px; ">apply: Spawning child process: invalid argument</span>
;(setq inferior-lisp-program "<span style="color: rgb(139, 0, 0);">D:\\clisp-2.49\\clisp.exe</span>") 
(require 'slime-autoloads)   ;<font color="#ff0000">注意这里加载的是 slime-autoloads，而不是 slime，要不然C-c C-c等很多功能都没有
</font>(slime-setup '(slime-fancy))
;(slime-setup)</pre>
				</div>
				<br>
		</blockquote>
		<p>2. 编译运行</p>
		<p>如果要进入用户交互界面，输入 M-x slime即可<br></p>
		<p>如果要编译lisp文件里的函数：a. 只编译某个函数,可以将光标放在该函数上，然后按C-c C-c</p>
		<div>
				<pre>The easiest is to type C-c C-c with the cursor anywhere in or immediately after the DEFUN form, which runs the command slime-compile-defun, which in turn sends the definition to Lisp to be evaluated and compiled.</pre>
		</div>
		<p>b. C-c C-c只能编译单个函数，如果文件内一些函数有关联，则这种方式就不好用了，此时可以编译整个文件</p>
		<p>&nbsp;&nbsp; (load&nbsp; &#8220;lisp_file&#8221;)</p>
		<p>c. load 某个文件后，如果又修改了该文件中的某个函数，则可以再用C-c C-c编译该函数而不需要重新load该文件</p>
<img src ="http://www.cppblog.com/hex108/aggbug/128226.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/hex108/" target="_blank">hex108</a> 2010-10-01 22:03 <a href="http://www.cppblog.com/hex108/archive/2010/10/01/128226.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>