有没有什么算法需要专门用函数式语言来实现
我是一名 C# 开发人员,我没有足够的关于函数式语言的信息,
我的问题是是否有任何算法需要专门使用函数式语言来实现?
问候。
I'm a C# developer and I don't have enough information about functional languages,
My question that is there any algorithm needs functional language exclusively to be implemented?
Regards.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
只要一种语言图灵完备,就可以实现任何算法其中(根据“算法”的定义)。但正如其他人所说,函数式语言可以更优雅地完成某些事情。 (看看 Haskell。多么可爱的语言啊。) 我还认为有一类问题 OOP 语言做得更好。 (在我看来,GUI,尽管有些人可能不同意。)
As long as a language is Turing complete, any algorithm can be implemented in it (by definition of "algorithm"). But as others have said, functional languages can do certain things more elegantly. (Just take a look at Haskell. What a lovely language.) I'd also argue that there is a class of problems that OOP languages do better. (In my opinion, GUIs, although some may disagree.)
不,但是函数式语言可能会为可以利用这种语言的功能的算法带来更优雅的实现。例如,需要大递归深度的递归。
No, however a functional language may lead to a more elegant implementation for an algorithm that can exploit the features of such a language. For example, one that requires large recursive depth.
据我了解,这种算法必须翻译成在某些微处理器上执行的一组机器命令(无论您使用编译语言还是解释语言)。目前的处理器都无法“正常运行”。
事实上,这导致了更广泛的断言:任何“功能算法”都可以用 C 或汇编程序实现:)
As I understand it, such algorithm would have to be translated into a set of machine commands executed on some micro-processor (whether you use compiled or interpreted language). And none of the current processors are 'functional'.
In fact, this leads to even broader assertion: any 'functional algorithm' can be implemented in C or assembler :)