加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

emacs – 学习Windows / C程序员的常见Lisp技巧

发布时间:2020-12-14 01:48:34 所属栏目:Windows 来源:网络整理
导读:我是一位经验丰富的C /.NET / Java Windows / Web程序员,正在尝试学习(Common)Lisp.我正在阅读 Practical Common Lisp并使用 SLIME. 我很容易获得Lisp语言,但是我很难理解开发的机制.我的一个问题是处理Emacs.我没有经验,发现它一般令人困惑,很难找到/弄清楚
我是一位经验丰富的C /.NET / Java Windows / Web程序员,正在尝试学习(Common)Lisp.我正在阅读 Practical Common Lisp并使用 SLIME.

我很容易获得Lisp语言,但是我很难理解开发的机制.我的一个问题是处理Emacs.我没有经验,发现它一般令人困惑,很难找到/弄清楚命令.

具体问题:

>我得到REPL,但我不太清楚如何有效地使用它.当我需要更改一个函数时,我必须重新键入defun并进行更改(繁琐且容易出错).我怎么能做得更好?
>如何从REPL中输入代码到实际拥有程序?我已经习惯了C模型,你可以在那里查看,编辑和重新编译代码文件.我知道Lisp有类似的东西(通过加载函数),但是如何获得我刚刚定义并测试到要保存的文件的函数?我希望有一种比我目前选择的复制粘贴更好的方法.
>你如何调试错误?是否有能力像其他语言一样进入代码?
>只要S表达式有效,我输入(defun …)时就不会出现任何错误.直到我尝试使用它,我发现它无效.有没有办法尽快得到错误(即编译代码)?
>是否有一些IDE对我更熟悉或允许我更容易使用该语言?
>我应该切换到学习Scheme吗?

任何提示将非常感谢!

-I get the REPL,but don’t quite get how I can use it effectively. When I
need to change a function I have to
retype the defun and make changes
(tedious and error prone). How can I
do this better?

-How do I get from entering code at the REPL to actually having a program?
I’m used to the C model where you have
code files that you can review,edit
and recompile. I know lisp has
something similar (via the load
function),but how does one get a
function I just defined and tested
into a file to be saved? I’m hoping
there’s a better method than my
current select+copy+paste.

加载SLIME.在.lisp文件中输入代码,然后运行slime-eval-buffer将所有代码加载到Lisp中.然后,对于一个特定的函数,你正在攻击C-e,C-j在你运行的Lisp中重新定义它.

-How do you debug errors? Is there any ability to step into code like I would with other languages?

是. (跟踪’my-function) – 或其中的一些变体 – 当调用my-function时,它将进入调试器.

-As long as the S-expression is valid,I don’t get any errors when entering a
(defun …). It’s not until I try to
use it that I find out it’s not valid.
Is there any way to get errors sooner
(i.e. compile the code)?

在某种程度上,这是动态语言(Python,Perl,Ruby,Lisp等)的特征.尝试SBCL以获得更好的错误检查.

-Is there some IDE that would be more familiar to me or allow me to play with the language easier?

Emacs是Lisp的免费IDE. Allegro有一个免费版我相信;我从来没试过过..

-Should I switch to learning Scheme instead?

不,Scheme不是一种实用的语言.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读