如果您已经了解LISP,为什么还要学习F#?

时间:2022-09-11 09:26:30

What is the added value for learning F# when you are already familiar with LISP?

当您熟悉LISP时,学习F#的附加价值是什么?

11 个解决方案

#1


19  

A lot of these are relatively recent developments in the programming language world. This is something you'll see in F# that you won't in Lisp, especially Common Lisp, because the F# standard is still under development. As a result, you'll find there is a quite a bit to learn. Of course things like ADTs, pattern matching, monads and currying can be built as a library in Lisp, but it's nicer to learn how to use them in a language where they are conveniently built-in.

其中许多是编程语言世界中相对较新的发展。这是你在F#中看到的,你不会在Lisp中,特别是Common Lisp,因为F#标准仍在开发中。因此,您会发现有相当多的东西需要学习。当然,诸如ADT,模式匹配,monad和currying之类的东西可以构建为Lisp中的库,但是学习如何在它们方便内置的语言中使用它们会更好。

The biggest advantage of learning F# for real-world use is its integration with .NET.

学习F#用于实际使用的最大优点是它与.NET的集成。

#2


6  

Comparing Lisp directly to F# isn't really fair, because at the end of the day with enough time you could write the same app in either language.

将Lisp直接与F#进行比较并不公平,因为在一天结束时有足够的时间你可以用任何一种语言编写相同的应用程序。

However, you should learn F# for the same reasons that a C# or Java developer should learn it - because it allows functional programming on the .NET platform. I'm not 100% familiar with Lisp, but I assume it has some of the same problems as OCaml in that there isn't stellar library support. How do you do Database access in Lisp? What about high-performance graphics?

但是,您应该学习F#,原因与C#或Java开发人员应该学习它相同 - 因为它允许在.NET平台上进行函数式编程。我不是100%熟悉Lisp,但我认为它与OCaml有一些相同的问题,因为它没有一流的库支持。你如何在Lisp中进行数据库访问?那么高性能的图形呢?

If you want to learn more about 'Why .NET', check out this SO question.

如果您想了解有关'Why .NET'的更多信息,请查看此SO问题。

#3


6  

If you knew F# and Lisp, you'd find this a rather strange question to ask.

如果你知道F#和Lisp,你会发现这是一个相当奇怪的问题。

As others have pointed out, Lisp is dynamically typed. More importantly, the unique feature of Lisp is that it's homoiconic: Lisp code is a fundamental Lisp data type (a list). The macro system takes advantage of that by letting you write code which executes at compile-time and modifies other code.

正如其他人所指出的那样,Lisp是动态类型的。更重要的是,Lisp的独特之处在于它是homoiconic:Lisp代码是一种基本的Lisp数据类型(列表)。宏系统通过让您编写在编译时执行的代码并修改其他代码来利用它。

F# has nothing like this - it's a statically typed language which borrows a lot of ideas from ML and Haskell, and runs it on .NET

F#没有这样的东西 - 它是一种静态类型的语言,它从ML和Haskell借用了很多想法,并在.NET上运行它

What you are asking is akin to "Why do I need to learn to use a spoon if I know how to use a fork?"

您要问的是“如果我知道如何使用叉子,为什么我需要学习使用勺子?”

#4


5  

Given that LISP is dynamically typed and F# is statically typed, I find such comparisons strange.

鉴于LISP是动态类型的,而F#是静态类型的,我发现这种比较很奇怪。

#5


3  

If I were switching from Lisp to F#, it would be solely because I had a task on my hands that hugely benefitted from some .NET-only library.

如果我从Lisp切换到F#,那将完全是因为我手上的任务非常受益于一些仅限.NET的库。

But I don't, so I'm not.

但我没有,所以我不是。

#6


3  

Money. F# code is already more valuable than Lisp code and this gap will widen very rapidly as F# sees widespread adoption.

钱。 F#代码已经比Lisp代码更有价值,并且随着F#的广泛采用,这种差距会迅速扩大。

In other words, you have a much better chance of earning a stable income using F# than using Lisp.

换句话说,使用F#比使用Lisp更有可能获得稳定的收入。

Cheers, Jon Harrop.

干杯,Jon Harrop。

#7


3  

F# is a very different language compared to most Lisp dialects. So F# gives you a very different angle of programming - an angle that you won't learn from Lisp. Most Lisp dialects are best used for incremental, interactive development of symbolic software. At the same time most Lisp dialects are not Functional Programming Languages, but more like multi-paradigm languages - with different dialects placing different weight on supporting FPL features (free of side effects, immutable data structures, algebraic data types, ...). Thus most Lisp dialects either lack static typing or don't put much emphasis on it.

与大多数Lisp方言相比,F#是一种非常不同的语言。因此F#为您提供了一个非常不同的编程角度 - 这个角度是您不会从Lisp中学到的。大多数Lisp方言最适合用于符号软件的增量交互式开发。同时,大多数Lisp方言不是函数式编程语言,而更像是多范式语言 - 不同的方言在支持FPL特征方面有不同的权重(没有副作用,不可变数据结构,代数数据类型......)。因此,大多数Lisp方言要么缺乏静态类型,要么不太注重它。

So, if you know some Lisp dialect, then learning F# can make a lot of sense. Just don't think that much of your Lisp knowledge applies to F#, since F# is a very different language. As much as an imperative programming used to C or Java needs to unlearn some ideas when learning Lisp, one also needs to unlearn Lisp habits (no types, side effects, macros, ...) when using F#. F# is also driven by Microsoft and taking advantage of the .net framework.

所以,如果你知道一些Lisp方言,那么学习F#会很有意义。只是不要认为你的很多Lisp知识适用于F#,因为F#是一种非常不同的语言。在学习Lisp时,用于C或Java的命令式编程需要忘记一些想法,在使用F#时,还需要忘记Lisp习惯(没有类型,副作用,宏,......)。 F#也是由Microsoft驱动并利用.net框架。

#8


2  

F# has the benefit that .NET development (in general) is very widely adopted, easily available, and more mass market.

F#的好处是.NET开发(一般而言)被广泛采用,易于获得,并且更加大众化。

If you want to code F#, you can get Visual Studio, which many developers will already have...as opposed to getting the LISP environment up and running.

如果你想编写F#代码,你可以获得许多开发人员已经拥有的Visual Studio ......而不是让LISP环境启动并运行。

Additionally, existing .NET developers are much more likely to look at F# than LISP, if that means anything to you.

此外,现有的.NET开发人员更倾向于使用F#而不是LISP,如果这对您来说意味着什么。

(This is coming from a .NET developer who coded, and loved, LISP, while in college).

(这是来自.NET开发人员,他在大学期间编写并喜爱LISP)。

#9


1  

I'm not sure if you would? If you find F# interesting that would be a reason. If you work requires it, it would be a reason. If you think it would make you more productive or bring you added value over your current knowledge, that would be a reason.

我不确定你会不会?如果你发现F#有趣,那将是一个原因。如果你的工作需要它,那将是一个原因。如果您认为它会提高您的工作效率或为您带来超越您当前知识的附加值,那就是一个原因。

But if you don't find F# interesting, your work doesn't require it and you don't think it would make you more productive or bring you added value, then why would you?

但是,如果你没有发现F#有趣,你的工作并不需要它,你不认为它会让你更有效率或带给你增值,那你为什么呢?

If the question on the other hand is what F# gives that lisp don't, then type inference, pattern matching and integration with the rest of the .NET framework should be considered.

另一方面,如果问题是F#给出的lisp没有,那么应该考虑类型推断,模式匹配以及与.NET框架的其余部分的集成。

#10


0  

I know this thread is old but since I stumbled on this one I just wanted to comment on my reasons. I am learning F# simply for professional opportunities since .NET carries a lot of weight in a category of companies that dominate my field. The functional paradigm has been growing in use among more quantitatively and data oriented companies and I'd like to be one of the early comers to this trend. Currently there doesn't an exist a strong functional language that fully and safely integrates with the .NET library. I actually attempted to port some .NET from Lisp code and it's really a pain b/c the FFI only supports C primitives and .NET interoperability requires an 'interface' construct and even though I know how to do this in C it's really a huge pain. It would be really, really, good if Lisp went the extra mile in it's next standard and required a c++ class (including virtual functions w/ vtables), and a C# style interface type in it's FFI. Maybe even throw in a Java interface style type too. This would allow complete interoperability with the .NET library and make Lisp a strong contender as a large-scale language. However with that said, coming from a Lisp background made learning F# rather easy. And I like how F# has gone the extra mile to provide types that you would commonly see it quantitative type work. I believe F# was created with mathematical work in mind and that in itself has value over Lisp.

我知道这个帖子已经老了,但是因为我偶然发现了这个故事,我只想评论一下我的理由。我正在学习F#只是为了获得专业机会,因为.NET在一个主导我的领域的公司中占有很大的份量。功能范例在越来越多的定量和数据导向型公司中得到应用,我希望成为这一趋势的早期成员之一。目前还没有一种强大的功能语言可以完全安全地与.NET库集成。我实际上试图从Lisp代码移植一些.NET,这真的是一个痛苦的原因,FFI只支持C原语,.NET互操作性需要一个“接口”构造,即使我知道如何在C中做到这一点它真的是一个巨大的痛。如果Lisp在下一个标准中加倍努力并且需要一个c ++类(包括虚拟函数w / vtables),并且在它的FFI中使用C#样式接口类型,那将是非常非常好的。甚至可能也会抛出Java接口样式类型。这将允许与.NET库完全互操作,并使Lisp成为大规模语言的有力竞争者。然而就是说,来自Lisp背景使得学习F#相当容易。而且我喜欢F#如何通过额外的努力提供通常会看到定量类型工作的类型。我相信F#是在考虑数学工作的情况下创建的,而且它本身对Lisp有价值。

#11


0  

One way to look at this (the original question) is to match up the language (and associated tools and platforms) to the immediate task. If the task requires an overwhelming percentage of .NET code, and it would require less shoe-horning in one language than another to meet the task head-on, then take the path of least resistance (F#). If you don't need .NET capabilities, and you're comfortable working with LISP and there's no arm-bending to move away from it, keep using it.

查看此问题(原始问题)的一种方法是将语言(以及相关工具和平台)与即时任务相匹配。如果任务需要绝大多数的.NET代码,并且在一种语言中需要较少的鞋子来完成任务,那么就采取阻力最小的路径(F#)。如果你不需要.NET功能,并且你很乐意使用LISP并且没有手臂弯曲可以远离它,那就继续使用它。

Not really much different from comparing a hammer with a wrench. Pick the tool that fits the job most effectively. Trying to pick a tool that's objectively "best" is nonsense. And in any case, in 20 years, all of the currently "hot" languages might be outdated anyway.

与锤子和扳手相比没有太大区别。选择最有效的工具。试图挑选一个客观“最好”的工具是无稽之谈。无论如何,在20年内,所有当前“热门”语言都可能过时。

#1


19  

A lot of these are relatively recent developments in the programming language world. This is something you'll see in F# that you won't in Lisp, especially Common Lisp, because the F# standard is still under development. As a result, you'll find there is a quite a bit to learn. Of course things like ADTs, pattern matching, monads and currying can be built as a library in Lisp, but it's nicer to learn how to use them in a language where they are conveniently built-in.

其中许多是编程语言世界中相对较新的发展。这是你在F#中看到的,你不会在Lisp中,特别是Common Lisp,因为F#标准仍在开发中。因此,您会发现有相当多的东西需要学习。当然,诸如ADT,模式匹配,monad和currying之类的东西可以构建为Lisp中的库,但是学习如何在它们方便内置的语言中使用它们会更好。

The biggest advantage of learning F# for real-world use is its integration with .NET.

学习F#用于实际使用的最大优点是它与.NET的集成。

#2


6  

Comparing Lisp directly to F# isn't really fair, because at the end of the day with enough time you could write the same app in either language.

将Lisp直接与F#进行比较并不公平,因为在一天结束时有足够的时间你可以用任何一种语言编写相同的应用程序。

However, you should learn F# for the same reasons that a C# or Java developer should learn it - because it allows functional programming on the .NET platform. I'm not 100% familiar with Lisp, but I assume it has some of the same problems as OCaml in that there isn't stellar library support. How do you do Database access in Lisp? What about high-performance graphics?

但是,您应该学习F#,原因与C#或Java开发人员应该学习它相同 - 因为它允许在.NET平台上进行函数式编程。我不是100%熟悉Lisp,但我认为它与OCaml有一些相同的问题,因为它没有一流的库支持。你如何在Lisp中进行数据库访问?那么高性能的图形呢?

If you want to learn more about 'Why .NET', check out this SO question.

如果您想了解有关'Why .NET'的更多信息,请查看此SO问题。

#3


6  

If you knew F# and Lisp, you'd find this a rather strange question to ask.

如果你知道F#和Lisp,你会发现这是一个相当奇怪的问题。

As others have pointed out, Lisp is dynamically typed. More importantly, the unique feature of Lisp is that it's homoiconic: Lisp code is a fundamental Lisp data type (a list). The macro system takes advantage of that by letting you write code which executes at compile-time and modifies other code.

正如其他人所指出的那样,Lisp是动态类型的。更重要的是,Lisp的独特之处在于它是homoiconic:Lisp代码是一种基本的Lisp数据类型(列表)。宏系统通过让您编写在编译时执行的代码并修改其他代码来利用它。

F# has nothing like this - it's a statically typed language which borrows a lot of ideas from ML and Haskell, and runs it on .NET

F#没有这样的东西 - 它是一种静态类型的语言,它从ML和Haskell借用了很多想法,并在.NET上运行它

What you are asking is akin to "Why do I need to learn to use a spoon if I know how to use a fork?"

您要问的是“如果我知道如何使用叉子,为什么我需要学习使用勺子?”

#4


5  

Given that LISP is dynamically typed and F# is statically typed, I find such comparisons strange.

鉴于LISP是动态类型的,而F#是静态类型的,我发现这种比较很奇怪。

#5


3  

If I were switching from Lisp to F#, it would be solely because I had a task on my hands that hugely benefitted from some .NET-only library.

如果我从Lisp切换到F#,那将完全是因为我手上的任务非常受益于一些仅限.NET的库。

But I don't, so I'm not.

但我没有,所以我不是。

#6


3  

Money. F# code is already more valuable than Lisp code and this gap will widen very rapidly as F# sees widespread adoption.

钱。 F#代码已经比Lisp代码更有价值,并且随着F#的广泛采用,这种差距会迅速扩大。

In other words, you have a much better chance of earning a stable income using F# than using Lisp.

换句话说,使用F#比使用Lisp更有可能获得稳定的收入。

Cheers, Jon Harrop.

干杯,Jon Harrop。

#7


3  

F# is a very different language compared to most Lisp dialects. So F# gives you a very different angle of programming - an angle that you won't learn from Lisp. Most Lisp dialects are best used for incremental, interactive development of symbolic software. At the same time most Lisp dialects are not Functional Programming Languages, but more like multi-paradigm languages - with different dialects placing different weight on supporting FPL features (free of side effects, immutable data structures, algebraic data types, ...). Thus most Lisp dialects either lack static typing or don't put much emphasis on it.

与大多数Lisp方言相比,F#是一种非常不同的语言。因此F#为您提供了一个非常不同的编程角度 - 这个角度是您不会从Lisp中学到的。大多数Lisp方言最适合用于符号软件的增量交互式开发。同时,大多数Lisp方言不是函数式编程语言,而更像是多范式语言 - 不同的方言在支持FPL特征方面有不同的权重(没有副作用,不可变数据结构,代数数据类型......)。因此,大多数Lisp方言要么缺乏静态类型,要么不太注重它。

So, if you know some Lisp dialect, then learning F# can make a lot of sense. Just don't think that much of your Lisp knowledge applies to F#, since F# is a very different language. As much as an imperative programming used to C or Java needs to unlearn some ideas when learning Lisp, one also needs to unlearn Lisp habits (no types, side effects, macros, ...) when using F#. F# is also driven by Microsoft and taking advantage of the .net framework.

所以,如果你知道一些Lisp方言,那么学习F#会很有意义。只是不要认为你的很多Lisp知识适用于F#,因为F#是一种非常不同的语言。在学习Lisp时,用于C或Java的命令式编程需要忘记一些想法,在使用F#时,还需要忘记Lisp习惯(没有类型,副作用,宏,......)。 F#也是由Microsoft驱动并利用.net框架。

#8


2  

F# has the benefit that .NET development (in general) is very widely adopted, easily available, and more mass market.

F#的好处是.NET开发(一般而言)被广泛采用,易于获得,并且更加大众化。

If you want to code F#, you can get Visual Studio, which many developers will already have...as opposed to getting the LISP environment up and running.

如果你想编写F#代码,你可以获得许多开发人员已经拥有的Visual Studio ......而不是让LISP环境启动并运行。

Additionally, existing .NET developers are much more likely to look at F# than LISP, if that means anything to you.

此外,现有的.NET开发人员更倾向于使用F#而不是LISP,如果这对您来说意味着什么。

(This is coming from a .NET developer who coded, and loved, LISP, while in college).

(这是来自.NET开发人员,他在大学期间编写并喜爱LISP)。

#9


1  

I'm not sure if you would? If you find F# interesting that would be a reason. If you work requires it, it would be a reason. If you think it would make you more productive or bring you added value over your current knowledge, that would be a reason.

我不确定你会不会?如果你发现F#有趣,那将是一个原因。如果你的工作需要它,那将是一个原因。如果您认为它会提高您的工作效率或为您带来超越您当前知识的附加值,那就是一个原因。

But if you don't find F# interesting, your work doesn't require it and you don't think it would make you more productive or bring you added value, then why would you?

但是,如果你没有发现F#有趣,你的工作并不需要它,你不认为它会让你更有效率或带给你增值,那你为什么呢?

If the question on the other hand is what F# gives that lisp don't, then type inference, pattern matching and integration with the rest of the .NET framework should be considered.

另一方面,如果问题是F#给出的lisp没有,那么应该考虑类型推断,模式匹配以及与.NET框架的其余部分的集成。

#10


0  

I know this thread is old but since I stumbled on this one I just wanted to comment on my reasons. I am learning F# simply for professional opportunities since .NET carries a lot of weight in a category of companies that dominate my field. The functional paradigm has been growing in use among more quantitatively and data oriented companies and I'd like to be one of the early comers to this trend. Currently there doesn't an exist a strong functional language that fully and safely integrates with the .NET library. I actually attempted to port some .NET from Lisp code and it's really a pain b/c the FFI only supports C primitives and .NET interoperability requires an 'interface' construct and even though I know how to do this in C it's really a huge pain. It would be really, really, good if Lisp went the extra mile in it's next standard and required a c++ class (including virtual functions w/ vtables), and a C# style interface type in it's FFI. Maybe even throw in a Java interface style type too. This would allow complete interoperability with the .NET library and make Lisp a strong contender as a large-scale language. However with that said, coming from a Lisp background made learning F# rather easy. And I like how F# has gone the extra mile to provide types that you would commonly see it quantitative type work. I believe F# was created with mathematical work in mind and that in itself has value over Lisp.

我知道这个帖子已经老了,但是因为我偶然发现了这个故事,我只想评论一下我的理由。我正在学习F#只是为了获得专业机会,因为.NET在一个主导我的领域的公司中占有很大的份量。功能范例在越来越多的定量和数据导向型公司中得到应用,我希望成为这一趋势的早期成员之一。目前还没有一种强大的功能语言可以完全安全地与.NET库集成。我实际上试图从Lisp代码移植一些.NET,这真的是一个痛苦的原因,FFI只支持C原语,.NET互操作性需要一个“接口”构造,即使我知道如何在C中做到这一点它真的是一个巨大的痛。如果Lisp在下一个标准中加倍努力并且需要一个c ++类(包括虚拟函数w / vtables),并且在它的FFI中使用C#样式接口类型,那将是非常非常好的。甚至可能也会抛出Java接口样式类型。这将允许与.NET库完全互操作,并使Lisp成为大规模语言的有力竞争者。然而就是说,来自Lisp背景使得学习F#相当容易。而且我喜欢F#如何通过额外的努力提供通常会看到定量类型工作的类型。我相信F#是在考虑数学工作的情况下创建的,而且它本身对Lisp有价值。

#11


0  

One way to look at this (the original question) is to match up the language (and associated tools and platforms) to the immediate task. If the task requires an overwhelming percentage of .NET code, and it would require less shoe-horning in one language than another to meet the task head-on, then take the path of least resistance (F#). If you don't need .NET capabilities, and you're comfortable working with LISP and there's no arm-bending to move away from it, keep using it.

查看此问题(原始问题)的一种方法是将语言(以及相关工具和平台)与即时任务相匹配。如果任务需要绝大多数的.NET代码,并且在一种语言中需要较少的鞋子来完成任务,那么就采取阻力最小的路径(F#)。如果你不需要.NET功能,并且你很乐意使用LISP并且没有手臂弯曲可以远离它,那就继续使用它。

Not really much different from comparing a hammer with a wrench. Pick the tool that fits the job most effectively. Trying to pick a tool that's objectively "best" is nonsense. And in any case, in 20 years, all of the currently "hot" languages might be outdated anyway.

与锤子和扳手相比没有太大区别。选择最有效的工具。试图挑选一个客观“最好”的工具是无稽之谈。无论如何,在20年内,所有当前“热门”语言都可能过时。