Emacs Lisp和Common Lisp之间的主要区别是什么? [英] What are the major differences between Emacs Lisp and Common Lisp?

查看:833
本文介绍了Emacs Lisp和Common Lisp之间的主要区别是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想学习lisp语言,因为我的编辑器是emacs,我更喜欢emacs lisp。



任何人都可以给我一些建议来学习lisp,emacs lisp,或共同的lisp?



这两者之间的主要区别是什么?

解决方案

有很多交叉,特别是在初学者层面,所以无论哪一个开始,都将转移到另一个。



一些主要区别: / p>


  • elisp传统上使用动态范围规则; Common Lisp使用词汇范围规则。使用动态范围,一个函数可以访问在调用函数中声明的局部变量,并且一般都没有使用。 Emacs有一个模拟词汇范围的 lexical-let 表单,并且emacs的最新版本在逐个函数的基础上允许可选的词法作用域。


  • elisp没有关闭,这使得组合功能和currying困难。有一个应用部分功能类似于currying工作。请注意,在Emacs 24中引入的 lexical-let 表单可以通过词汇作用域生成闭包。


  • 随着时间的推移,很多常见的Lisp库不能在elisp中使用。一个子集由elisp c> c


  • elisp不提供尾调用优化。



I want to learn the lisp language, since my editor is emacs, I prefer emacs lisp.

Can anyone give me some suggestions to learn lisp, emacs lisp, or common lisp?

What are the major differences between those two?

解决方案

There's quite a bit of crossover, especially at the beginner level, so whichever you start with will mostly transfer to the other.

Some of the major differences:

  • elisp has traditionally used dynamic scoping rules; Common Lisp uses lexical scoping rules. With dynamic scoping, a function can access local variables declared in calling functions and has generally fallen out of favor. Emacs has a lexical-let form that simulates lexical scoping and recent versions of emacs allow optional lexical scoping on a function-by-function basis.

  • elisp doesn't have closures, which makes composing functions and currying difficult. There's a apply-partially function that works similarly to currying. Note that the lexical-let form introduced in Emacs 24 makes it possible to produce closures via lexical scoping.

  • Much of the Common Lisp library that has been built up over time isn't available in elisp. A subset is provided by the elisp cl package

  • elisp doesn't do tail-call optimization.

这篇关于Emacs Lisp和Common Lisp之间的主要区别是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆