LISP 或 Haskell
LISP 或 Haskell,我需要学习函数式编程,但我听说 lisp 很老了,这两种语言之间有什么建议吗?
LISP or Haskell, I need to learn functional programming, but I heard that lisp is very old, any advice between those two languages ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
为了呼应其他人,我会学习Scheme(一种功能更强大的Lisp 方言)和Haskell。 Scheme / Lisp 有一些有用的技巧来教你“代码就是数据/数据就是代码”和宏。 Scheme 鼓励良好的函数式风格,我会推荐“The Little Schemer”系列书籍来帮助您开始这方面的工作。 SICP 也是一本很棒的文本 http://mitpress.mit.edu/sicp /full-text/book/book.html 可能是有史以来最好的编程书籍之一。作为第一种函数式语言,Scheme 更容易使用。
一旦掌握了Scheme的窍门,您可能会发现自己因缺乏库、缺乏并行性以及规模虽小但优秀的社区而感到沮丧。这就是我决定学习 Haskell 时的情况。 Haskell 非常成熟、非常有用、非常实用,一旦你脱离了基础知识,学习就变得相当具有挑战性,因此拥有另一种函数式语言的基础将会有很大帮助。您不会后悔学习其中一个(或两者)。
Just to echo the others, I'd learn both Scheme (a more functional Lisp dialect) and Haskell. Scheme / Lisp have some useful tricks to teach you about 'code is data / data is code' and macros. Scheme encourages a good functional style and I would recommend the 'The Little Schemer' series of books to get you started on this. SICP is also a fantastic text http://mitpress.mit.edu/sicp/full-text/book/book.html and possibly one of the best books ever written on programming. Scheme is more accessible as a first functional language.
Once you've got the hang of Scheme you'll probably find yourself becoming frustrated with the lack of libraries, lack of parallelism and the small, although excellent, community. This is where I was when I decided to learn Haskell. Haskell is very mature, very useful and very functional and it is quite a challenge to learn once you move off the basics and so having a grounding in another functional language will help enormously. You won't regret learning either (or both).
为什么不两者都呢? LISP 非常容易学习(我会选择 Scheme 方言 - 请参阅 http://racket-lang.org)所以我就从那开始。如果你喜欢它,就坚持下去,但我也会尝试一下 Haskell,尽管(根据我的经验)它很难让你理解。
如今计算的伟大之处在于,除了您的时间之外,您还可以免费尝试所有这些语言。当我开始编程时,LISP 只能在大型机上使用,这给学习它带来了一些困难。
Why not both? LISP is very easy to learn (I'd go for the Scheme dialect - see http://racket-lang.org) so I'd start with that. If you like it, stick with it, but I'd also give Haskell a go, although it is (in my experience) considerably harder to wrap your head around.
The great thing about computing these days is that you can try all these languages for free, apart from your time. When I started programming LISP was only available on mainframes, which put a bit of a crimp on trying to learn it.
Haskell,因为一旦你学会了 Haskell,你就会喜欢它。然后,您将能够学习 Common LISP。但是,如果您的编辑器是 Emacs,那么就从 Lisp 开始吧。
Haskell, because once you've learned Haskell, you will love it. And then, you will be able to learn Common LISP. However, if your editor is Emacs, then go start with Lisp.
如果您想通过实现某种语言的编译器或解释器来学习函数式编程,那么 Lisp 或 ML 应该是更好的首选,因为它们比惰性语言更容易实现。否则你最好两者都学。
If you want to learn functional programming through implementing a compiler or interpreter of a language, then Lisp or ML should be a better first choice as they're much simpler to implement than a lazy language. Otherwise you'd better learn both.
根据年龄进行选择是愚蠢的,Haskell 的历史比 C# 的历史要长得多,而且它的历史可以追溯到更久远的地方。无论如何,我建议最终学习两者,对于学习函数式编程,Haskell 专门针对纯函数式编程(在多种意义上)。 Scheme 是 lisp 的面向功能的后代。
Choosing based on age is silly, Haskell has been around much longer than say C# and its history extends back a lot further. Anyway I'd recommend learning both eventually, for learning functional programming, Haskell is specifically about purely functional programming (in a number of senses of the meaning). Scheme is a functional orientated descendant of lisp.