方案还是 Common Lisp?
我是一名中级程序员,决定学习 common lisp 或 schema。我的问题很简单,你会选择哪一个?我不太关心语法的难度,只关心语言本身的功能、灵活性和其他方面。另外,我应该选择 common lisp 或方案的哪种实现?谢谢!
I am an intermediate programmer, and have decided to learn either common lisp or scheme. My question is simple, which one would you choose? I don't care much for the difficulty of the syntax, just the power, flexibility, and other aspects of the language itself. Also, which implementation of either common lisp or scheme should I choose? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(11)
就像很多事情一样,这取决于您想做什么。
请记住,如果您现在选择一项,并不妨碍您以后进行更改。事实上,我发现从了解一点Scheme 到学习大量Clojure 是很容易的。
如果您只是想学习、使用 Lisp,甚至构建中等复杂的程序,我认为Scheme 可能是更好的选择。它有一个更干净、更清晰(更小)的标准库,并且有大量适合学习者的资源(并不是说没有 CL 的资源)。
如果您想要大量库(许多都写得很好)的原始功能以及 CL 附带的标准库(作为 CL 实现的标准)工具包,那么它是您更好的选择。
或者,我建议 Clojure。这是一种相对较新的语言(不到 5 年),但它有很多优点。它是为并发而构建的,具有大量原语,如果您需要状态,可以轻松编写状态安全程序。还有很多其他好处,不过,标准库设法保持小型。
它也在 JVM 上,因此如果您需要使用 Java,您可以访问所有库,而且 JVM 提供的原始速度触手可及。
然而,它是一种新语言,有一个新的(但非常友好!)社区。如果你只是想尝试一下 Lisp,我认为Scheme 是你最好的选择。如果你想把事情做好,我的偏好和热爱是 Clojure。
编辑老实说,这三个都不会出错。根据您想要做什么,其中一个可能会更好,我会向几乎所有人推荐 Clojure。
Like so many things, it depends on what you want to do.
Remember, if you choose one now, it doesn't preclude you from changing later. In fact, I found it quite easy to switch from knowing a little Scheme to learning a lot of Clojure.
If you just want to learn, and play around with a Lisp, or even build moderately complex programs, I'd say Scheme is probably a better bet. It's got a cleaner, crisper (smaller) standard library, and there are a lot of resources out that that cater to the learner (not that there aren't for CL, either).
If you want the raw power of tons of libraries (many very well written) and the toolkit of a standard (as standard as a CL implementation gets) library that comes with a CL, then it'd be your better bet.
Alternatively, I'd suggest Clojure. It's a relatively new language (< 5 years), but it's got a lot going for it. It's built for concurrency, with plenty of primitives that make it easy to write state-safe programs if you need to have state. And plenty of other perks, though again, the standard library manages to stay small.
It's also on the JVM, so you have access to all the libraries you would if you were using Java, should you need any of them, plus the raw speed that the JVM has to offer is at your fingertips.
However, it is a new language, with a new (but very friendly!) community. If you just want to dip your toes in the pool of Lisp, I'd say Scheme is your best bet. If you want to get things done, my preference and my love is Clojure.
EDIT Honestly, you can't go wrong with any of the three. One may be better depending on what you want to do, and I'd recommend Clojure to just about anyone.
如果您想编写实用的代码,和/或您希望从一种实现到另一种实现具有良好的可移植性,请使用 Common Lisp。目前有十一个实施正在积极维护中。 请参阅我对实现的调查。
不同的实现具有不同的优势。如果您想要一个免费的开源软件,Clozure Common Lisp (CCL)(不要与“Clojure”混淆!)和 Steel Bank Common Lisp (SBCL) 是很好的通用实现。还有商业实现,最著名的是 Allegro Common Lisp 和 LispWorks。对于 Windows 友好性,Corman Common Lisp 有一些有用的工具。对于嵌入,Embedded Common Lisp (ECL) 非常有用(您不必以嵌入方式使用它)。如果您想要一个可以编译为 Java 虚拟机的 Common Lisp,可以选择 Armed Bear Common Lisp (ABCL)。其他人请参阅论文;您想要哪一种取决于您的个人情况。
If you want to write practical code, and/or you want a good degree of portability from one implementation to another, use Common Lisp. There are eleven implementations currently under active maintenance. See my survey of implementations.
The different implementations have different strengths. If you want a free, open-source one, Clozure Common Lisp (CCL) (not to be confused with "Clojure"!) and Steel Bank Common Lisp (SBCL) are good general-purpose implementations. There are also commercial implementations, the best known being Allegro Common Lisp and LispWorks. For Windows-friendliness, Corman Common Lisp has useful facilities. For embedding, Embedded Common Lisp (ECL) is great (you don't have to use it in an embedded way). If you want a Common Lisp that compiles to the Java Virtual Machine, there's Armed Bear Common Lisp (ABCL). See the paper for others; which one you want depends on your individual circumstances.
如果你想要强大的功能和灵活性,你可以选择 Common Lisp。
如果你想要干净和简单,你可以选择Scheme。
到目前为止我对 SBCL 很满意。
If you want power and flexibility you go with Common Lisp.
If you want clean and simple you go with Scheme.
So far I'm happy with SBCL.
这是旧的了 ;) Emacs 还是 vi? KDE 还是 Gnome?红色还是白色?
两者最大的区别是Scheme倾向于函数式编程;有些作者强调 Common Lisp 中的函数式编程,例如 Paul Graham,如果我编写 Common Lisp,我就会遵循他们的建议。
我倾向于更喜欢Scheme,因为它对我来说更有意义。我发现计划社区,特别是围绕自由软件实现的社区,更加关注自由软件。考虑一下这对你来说是否重要。与流行的看法相反,Common Lisp 是一种非常流行的语言,但它大多是在封闭的公司大门后面。这是我放弃 Common Lisp 的一个重要因素:当社区不那么开放时,你不会找到那么多的帮助和库。
就实现而言,如果您是 GNU/Linux 用户,我会推荐 Guile。其他实现与 GNU 意识的主流相差太远;我喜欢 GNU 社区,所以 Guile 对我来说是最好的选择。此外,Guile 还拥有我发现的默认安装中包含的最好的库(考虑到与其他受访者不同,我对 Clojure 一无所知)。
我看到其他一些受访者重复着古老的咒语“如果你想完成某件事,请使用 Common Lisp;如果你想学习,请使用Scheme。”这在SICP时代可能是正确的,但我认为现在情况并非如此。一个好的Scheme实现,比如Guile,有大量可用的库,并且有很多很好的用例,表明你可以用它完成很多事情。
This is an old one ;) Emacs or vi? KDE or Gnome? Red or White?
The biggest difference between the two is that Scheme tends to focus on functional programming; some authors stress functional programming in Common Lisp, such as Paul Graham, and if I write Common Lisp, I follow their advice.
I tend to prefer Scheme since it just makes more sense to me. I've found that the Scheme community, particularly surrounding free software implementations, is much more focused on free software. Consider that if it's important to you. Contrary to popular belief, Common Lisp is a very popular language, but it's most behind closed, corporate doors. That was a big factor for me to turn away from Common Lisp: when the community's not as open, you're not going to find as much in the way of help and libraries.
As far as implementations, I would recommend Guile if you're a GNU/Linux user. Other implementations are just too far outside the mainstream of GNU-consciousness; I like the GNU community, so Guile was the best choice for me. Also Guile has the best set of libraries included in the default installation that I've found (considering that different from the other respondents I know nothing about Clojure).
I've seen some other respondents repeating the old incantation "If you want to get something done, use Common Lisp; if you want to learn, use Scheme." That was probably true in the era of SICP, but I don't think it's true these days. A good implementation of Scheme, like Guile, has tons of libraries available and has plenty of good use-cases that show you can get plenty of stuff done with it.
我的印象:Common Lisp 更适合完成工作,Scheme 更适合教育和娱乐。我更喜欢 SBCL 实现。计划,我不知道。
My impression: Common Lisp is more for getting stuff done, Scheme is more for education and fun. I prefer the SBCL implementation. Scheme, I don't know.
我对更实用、巴洛克式和疣状的编程语言有浓厚的兴趣,所以我选择了 Common Lisp。
我使用 GNU clisp,但我正在考虑更改为 SBCL,因为它注重效率。
I have an affinity for the more pragmatic, baroque, and warty programming languages, so I selected Common Lisp.
I use GNU clisp, but I am considering changing to SBCL due to its focus on efficiency.
我选择Scheme是因为它是计算机程序的结构和解释中教授的语言。到目前为止,读起来很有趣。
I chose Scheme because it was the language taught in Structure and Interpretation of Computer Programs. It's been a fun read so far.
我通常这样看待它:Common Lisp 之于Scheme 就像C++ 之于Python。使用 Common Lisp 和 C++,您将获得大量工具和强大功能,并且基本上可以自由漫游。另一方面,Scheme 更注重简单性,你可以依靠的绳索也少了一些。
就像 C++ 与 Python 一样,有这样一种想法,一种是用于真正的、成熟的项目,而另一种是一种玩具语言,可以使用或创建一次性脚本,尽管在大多数情况下“玩具”已经足够好了无论您需要做什么。
如果你想看一下Scheme,我推荐PLT Racket。它不是严格的标准方案,但本质上是相同的,并且是“包含电池”的分布。
I usually view it like this: Common Lisp is to Scheme as C++ is to Python. With both Common Lisp and C++, you're given a huge load of tools and lots of power and essentially allowed to roam free. With Scheme, on the other hand, there's more of a focus on simplicity and you're given a little bit less rope to hang yourself by.
And just like with C++ vs. Python, there's this idea that one is for real, grownup projects while the other is sort of a toy language to play around with or create throwaway scripts, even though in most cases the "toy" is good enough for whatever you need to do.
If you want to look at Scheme, I recommend PLT Racket. It's not strictly standard Scheme, but it's essentially the same and it's a "batteries included" distribution.
common lisp 更有用,但scheme 更简洁。主要归结于此。
common lisp is a lot more useful, but scheme is a lot cleaner. mostly comes down to that.
Scheme 与 Common Lisp 具有相同或更大的功能,但它没有那么多的支持或绑定。我会选择 Common Lisp。至于实施?我已经在 slime/swank 中使用 sbcl 一段时间了,它非常好而且快。史莱姆真的很好看。
Scheme is of equal or greater power of Common Lisp, but it doesn't have as much support or bindings. I'd go with Common Lisp. As for the implementation? I've been using sbcl in slime/swank for awhile now, and it's pretty nice and fast. Slime is really nice.
语法在任何 lisp 中都同样困难或没有。 Clojure 的语法对于非 Lispers 来说更容易一些,因为使用了不同的括号。这比人们想象的有更大的不同。
Clojure 和 CL 都有优秀的入门书籍。我没有读过任何深入的方案书籍,但相比之下似乎更有学术味道。
根据个人经验,我会向新手推荐 Clojure 或 Common Lisp。
Clojure 功能更强大,而且非常实用。如果使用 CL,我推荐使用 IDE(Allegro 和其他有免费版本),或者使用文本编辑器和 repl。换句话说,不要使用粘液。对于 Clojure,我想不出任何 IDE,但也许 Textmate 或 Eclipse 会有一些东西?
Scheme 也有一些非常好的 IDE,例如 DrScheme。但我发现在做一些实际项目时更容易保持专注,Clojure 和 CL 似乎都让这变得更容易。
The syntax is equally difficult or not in any lisp. Clojure's syntax is a bit easier for non-lispers because different brackets are used. This makes more of a difference than one would expect.
Both Clojure and CL have excellent introductory books. I haven't read scheme books in any depth, but they seem to have a more academic flavor in comparison.
I would recommend Clojure or Common Lisp to a neophyte, based on personal experience.
Clojure is more functional and eminently practical. If using CL I recommend an IDE (Allegro & others have free versions), or using a text-editor and repl. In other words, don't use slime. For Clojure I can't think of any IDEs, but perhaps Textmate or Eclipse will have something?
Scheme has some very good IDEs too such as DrScheme. But I found it easier to stay engaged when doing somewhat of a real project, and both Clojure and CL seemed to make that easier.