功能语言的独特性格 [英] Distinctive traits of the functional languages

查看:124
本文介绍了功能语言的独特性格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

众所周知,所有的函数式语言都有一些基本的属性,例如使用函数作为程序的基本构建块,所有的后果,如使用递归而不是迭代。然而,也存在一些基本差异。 Lisp对Lisp代码和数据使用单个表示,而ML没有ML代码的标准表示。 Erlang有一个内置的基于actor的并发。 Haskell有monads。 Haskell在静态类型系统中区分纯函数和不纯函数;

It is known that all functional languages share some basic properties like using functions as basic building block for programs with all the consequences like using recursion instead of iteration. However, some fundamental differences also exist. Lisp uses a single representation for both Lisp code and data, while ML has no standard representation of ML code. Erlang has a built-in actor-based concurrency. Haskell has monads. Haskell makes a distinction in the static type system between pure and impure functions; ML does not.

其他函数式语言(Clojure,F#,Arc,其他)之间有什么独特的基本差异?基本上我的意思是影响你在这种语言中开发的方式,而不是例如,它是否与一些广泛的运行时集成。

What are the distinctive fundamental differences between other functional languages (Clojure, F#, Arc, any other)? By fundamental I mean something which influences the way you develop in this language, and not for example, whether it is integrated with some wide-spread runtime.

推荐答案

离开我的头顶:


  • 延迟热切 (又称​​非严格 em> strict call-by-need call-by-value ):函数参数,或之后,或从不?

  • :语言是否允许功能有副作用?是否有可变引用?

  • static vs. dynamic :在编译时或运行时语言检查类型?

  • algebraic datatypes :语言是否支持匹配变体类型的模式?

  • a href =http://en.wikipedia.org/wiki/Metaprogramming =nofollow noreferrer> 元编程 :语言是否提供了强大的代码生成系统? li>
  • 并发 parallelism :是线程/进程的第一类抽象?

  • 异域类型 :静态类型系统是如何表达的? GADT?依赖类型?线性类型?系统F?

  • lazy vs. eager (aka non-strict vs. strict or call-by-need vs. call-by-value): are function arguments evaluated before the function application, or after, or never?
  • pure vs. impure: does the language allow functions to have side effects? Does it have mutable references?
  • static vs. dynamic: does the language check types at compile time or runtime?
  • algebraic datatypes: does the language support pattern matching over variant types?
  • metaprogramming: does the language provide a powerful code generation system?
  • concurrency and parallelism: are threads/processes a first-class abstraction? Does the language make it easy to run multiple computations at the same time?
  • "exotic" types: how expressive is the static type system? GADTs? Dependent types? Linear types? System F?

只有前两个项目对于函数式语言是唯一的(即,几乎所有的命令式语言都是渴望的和不纯的)。

Only the first two items are really unique to functional languages (i.e., almost all imperative languages are eager and impure).

这篇关于功能语言的独特性格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆