F# is my language of choice, but I'd strongly recommend learning them all. They are all quite different and interesting in their own right. Here's a quick over view to each one (with perhaps a slight F# bias), you can easily find more info by googling:
F# - is a language that makes it easy to program in the functional style, lets you easily copy objects rather than mutating them. It also gives you interesting data types, like tuples and algebraic data types, useful language constructs such as pattern matching and list comprehensions. It also has OO and imperative features and good access to libraries, since you can use any .NET framework component.
Haskell - is a pure and lazy functional language, making a rare or even unique beast. This means there are no side effects at all, unless they are tracked by a monad. Haskel too has tuples, algebraic data and pattern matching.
Lisp - whereas F# and Haskell are statically typed, lisp is dynamically typed. It has distinctive syntax which uses lots of parentheses and provides an interesting macro feature that allows you to make transformations to the program itself and extend the syntax.
Since then, I have done some programming in F#. Now I am very glad I did, since it is realy helpful to understand LINQ in C# and that happened to be my background too. (I almost never use foreach in C# now since I learned F#)
I learned through F# a lot of things about lazy evalution, lists and sequences, all of which you could pick any language for with good support for lists, tuples, and so on (like any functional language I guess), but if you pick F#, all of this will be very useful in C# too. Maybe you already know all of this stuff and use it right, but in case you don't, pick F#.
I started out here : a very nice video tutorial, very impressive and a very inspiring tutor.
Currently I'm watching these video's on Channel 9 on the basics of Functional programming. It's explained using Haskell, but the basics apply to all languages. I must say it's very informative and easy to understand.
I don't know F# but I like to play with it sometimes. My language is Clojure which is very functional and works on the CLR too, but the JVM version is the main version.
It overs you a lot of the stuff you want. The main diffrence to F# is that Clojure is dynamicly typed and it has really good way handle concurency (one of the best I would say).
BTW. Did you know that F# was made because Haskell was to hard to get running on the CLR? (Thats not the whole story of course but its part of it)
Nobody actually answered this specific question: "I wonder if F# has features like Lisp macros or Haskell higher order functions."
F# does not offer macros. Also, it does not offer higher-kinded types (which is what I thought you were asking at first).
F# does offer higher-order functions in that you can easily write a function that takes a function and returns a function. In fact, C# (or really any .NET language) can do this as the Func delegate is part of the .NET framework.
编辑:那家伙正在研究语言来学习乐趣。嗯,Lisp 和 Haskell 是很好的候选者,因为它们的全部用途就是乐趣(那里没有带薪工作)。他“可能”(尽管不太可能)有机会在工作中使用 F#(他在 MS 商店),所以为什么要在空闲时间学习一些东西,因为他可以在工作中获得报酬。
Why choose? Learn both Lisp and Haskell on your own. No point in learning F# on your own time though. If you need it for work, you'll learn it at work ;)
EDIT: The guy was looking at language to learn for fun. Well, Lisp and Haskell are good candidates since fun is all they are going to be used for (no paid jobs there). He "might" (although unlikely) have opportunity to use F# at work (he is in MS shop), so why learning something in free time when he can be paid learning it at work.
I learned all of them to a diffeent degree, and would advise starting with Scheme (a Lisp dialect) - simply because it is easiest to learn. Haskell and F# are statically typed, which is a big advantage for real-life projects, but IMHO they have a little "too much" syntax and are not as easy to pick up as Scheme.
There is a nice Scheme implementation for .NET - IronScheme. You can take a look at my article "Playing with IronScheme" to see if you like it.
If We compare this three languages I'll recommend Haskell. It is more practical than LISP I think (because it's type system) and more powerful and clever than F#. As far as you know F# is a .NET port of OCaml and to some extent it is not ideoligally clear as Haskell is or as OCaml is. I'll recommend you study Haskell or OCaml to know how inconvinient F# is.
发布评论
评论(9)
F# 是我选择的语言,但我强烈建议学习所有这些语言。它们本身就非常不同且有趣。下面是对每一个的快速概述(可能有轻微的 F# 偏见),您可以通过谷歌搜索轻松找到更多信息:
F# - 是一种可以轻松以函数式风格进行编程的语言,让您可以轻松复制对象而不是变异他们。它还为您提供了有趣的数据类型,例如元组和代数数据类型,以及有用的语言结构,例如模式匹配和列表理解。它还具有面向对象和命令式功能以及对库的良好访问,因为您可以使用任何 .NET 框架组件。
Haskell - 是一种纯粹而懒惰的函数式语言,是一种罕见甚至独特的野兽。这意味着根本没有副作用,除非它们被 monad 跟踪。 Haskel 也有元组、代数数据和模式匹配。
Lisp - F# 和 Haskell 是静态类型,而 Lisp 是动态类型。它具有独特的语法,使用大量括号,并提供有趣的宏功能,允许您对程序本身进行转换并扩展语法。
F# is my language of choice, but I'd strongly recommend learning them all. They are all quite different and interesting in their own right. Here's a quick over view to each one (with perhaps a slight F# bias), you can easily find more info by googling:
F# - is a language that makes it easy to program in the functional style, lets you easily copy objects rather than mutating them. It also gives you interesting data types, like tuples and algebraic data types, useful language constructs such as pattern matching and list comprehensions. It also has OO and imperative features and good access to libraries, since you can use any .NET framework component.
Haskell - is a pure and lazy functional language, making a rare or even unique beast. This means there are no side effects at all, unless they are tracked by a monad. Haskel too has tuples, algebraic data and pattern matching.
Lisp - whereas F# and Haskell are statically typed, lisp is dynamically typed. It has distinctive syntax which uses lots of parentheses and provides an interesting macro feature that allows you to make transformations to the program itself and extend the syntax.
我曾经有过同样的问题,
从那以后,我用F#做了一些编程。现在我很高兴我这么做了,因为理解 C# 中的 LINQ 确实很有帮助,而且这也恰好是我的背景。 (自从学习 F# 以来,我现在几乎不再在 C# 中使用 foreach)
我通过 F# 学到了很多关于惰性求值、列表和序列的知识,所有这些你都可以选择任何语言来实现,并对列表、元组等提供良好的支持(就像我猜的任何函数式语言一样),但如果您选择 F#,所有这些在 C# 中也将非常有用。也许您已经了解所有这些内容并正确使用它们,但如果您不知道,请选择 F#。
我从这里开始:一个非常好的视频教程,非常令人印象深刻,也是一位非常鼓舞人心的导师。
I had the same question once
Since then, I have done some programming in F#. Now I am very glad I did, since it is realy helpful to understand LINQ in C# and that happened to be my background too. (I almost never use foreach in C# now since I learned F#)
I learned through F# a lot of things about lazy evalution, lists and sequences, all of which you could pick any language for with good support for lists, tuples, and so on (like any functional language I guess), but if you pick F#, all of this will be very useful in C# too. Maybe you already know all of this stuff and use it right, but in case you don't, pick F#.
I started out here : a very nice video tutorial, very impressive and a very inspiring tutor.
目前我正在观看 这些视频位于第 9 频道,介绍函数式编程的基础知识。它是使用 Haskell 进行解释的,但基础知识适用于所有语言。我必须说它内容丰富且易于理解。
Currently I'm watching these video's on Channel 9 on the basics of Functional programming. It's explained using Haskell, but the basics apply to all languages. I must say it's very informative and easy to understand.
这是一个非常主观的问题。
我的观点是,Scheme(Lisp 的变体)和阅读 SICP 是正确的事情。你会学到很多东西。
但出于实际目的,如果您是 .NET 开发人员,那么 F# 可能更好。
This is a very subjective question.
My opinion is that Scheme (a Lisp variant) and reading SICP is the right thing. You will learn a lot.
But for practical purposes and if you are a .NET developer then maybe F# is better.
我不懂 F#,但有时我喜欢玩它。我的语言是 Clojure,它非常实用,也可以在 CLR 上运行,但 JVM 版本是主要版本。
它超越了你很多你想要的东西。与 F# 的主要区别在于 Clojure 是动态类型的,并且它有非常好的处理并发的方法(我认为是最好的方法之一)。
顺便提一句。
您是否知道 F# 的诞生是因为 Haskell 很难在 CLR 上运行? (当然这不是整个故事,而是其中的一部分)
I don't know F# but I like to play with it sometimes. My language is Clojure which is very functional and works on the CLR too, but the JVM version is the main version.
It overs you a lot of the stuff you want. The main diffrence to F# is that Clojure is dynamicly typed and it has really good way handle concurency (one of the best I would say).
BTW.
Did you know that F# was made because Haskell was to hard to get running on the CLR? (Thats not the whole story of course but its part of it)
没有人真正回答这个具体问题:“我想知道 F# 是否具有 Lisp 宏或 Haskell 高阶函数等功能。”
F# 不提供宏。此外,它不提供更高级的类型(这就是我认为你一开始要问的)。
F# 确实提供了高阶函数,您可以轻松编写接受一个函数并返回一个函数的函数。事实上,C#(或者任何 .NET 语言)都可以做到这一点,因为
Func
委托是 .NET 框架的一部分。Nobody actually answered this specific question: "I wonder if F# has features like Lisp macros or Haskell higher order functions."
F# does not offer macros. Also, it does not offer higher-kinded types (which is what I thought you were asking at first).
F# does offer higher-order functions in that you can easily write a function that takes a function and returns a function. In fact, C# (or really any .NET language) can do this as the
Func
delegate is part of the .NET framework.为什么选择?
自学 Lisp 和 Haskell。
不过,用自己的时间学习 F# 是没有意义的。如果你在工作中需要它,你会在工作中学习它;)
编辑:那家伙正在研究语言来学习乐趣。嗯,Lisp 和 Haskell 是很好的候选者,因为它们的全部用途就是乐趣(那里没有带薪工作)。他“可能”(尽管不太可能)有机会在工作中使用 F#(他在 MS 商店),所以为什么要在空闲时间学习一些东西,因为他可以在工作中获得报酬。
Why choose?
Learn both Lisp and Haskell on your own.
No point in learning F# on your own time though. If you need it for work, you'll learn it at work ;)
EDIT: The guy was looking at language to learn for fun. Well, Lisp and Haskell are good candidates since fun is all they are going to be used for (no paid jobs there). He "might" (although unlikely) have opportunity to use F# at work (he is in MS shop), so why learning something in free time when he can be paid learning it at work.
我在不同程度上学习了所有这些,并建议从Scheme(一种 Lisp 方言)开始——只是因为它最容易学习。 Haskell 和 F# 是静态类型的,这对于现实项目来说是一个很大的优势,但恕我直言,它们的语法有点“太多”,并且不像Scheme那么容易掌握。
.NET 有一个很好的方案实现 - IronScheme。你可以看一下我的文章“玩IronScheme”来了解如果你喜欢的话。
I learned all of them to a diffeent degree, and would advise starting with Scheme (a Lisp dialect) - simply because it is easiest to learn. Haskell and F# are statically typed, which is a big advantage for real-life projects, but IMHO they have a little "too much" syntax and are not as easy to pick up as Scheme.
There is a nice Scheme implementation for .NET - IronScheme. You can take a look at my article "Playing with IronScheme" to see if you like it.
如果我们比较这三种语言,我会推荐 Haskell。我认为它比 LISP 更实用(因为它是类型系统),并且比 F# 更强大和聪明。据您所知,F# 是 OCaml 的 .NET 端口,在某种程度上,它并不像 Haskell 或 OCaml 那样清晰。我建议您学习 Haskell 或 OCaml 以了解 F# 有多么不方便。
If We compare this three languages I'll recommend Haskell. It is more practical than LISP I think (because it's type system) and more powerful and clever than F#. As far as you know F# is a .NET port of OCaml and to some extent it is not ideoligally clear as Haskell is or as OCaml is. I'll recommend you study Haskell or OCaml to know how inconvinient F# is.