本文介绍了Haskell 是 Lisp 吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在阅读 Doets 和 Eijck 于 2004 年合着的 The Haskell Road to Logic, Maths and Programming.这本书似乎是一本备受推崇的书,但当它声称 Haskell 是 Lisp 家族的一员时,我感到震惊.这是准确的吗?我会用 s 表达式、不纯函数和列表来描述 Lisps 作为唯一的复合数据结构.Haskell 没有这些.这种说法有什么理由?

I've been reading The Haskell Road to Logic, Maths and Programming by Doets and Eijck 2004. It seems to be a well respected book, but I was struck when it claims that Haskell is a member of the Lisp family. Is this accurate? I would characterise Lisps with s-expressions, impure functions, and lists as the only composite data structure. Haskell has none of that. What justification is there for that claim?

推荐答案

Lisp 是一个非常模糊的概念.我看到了两种或多或少有用的解释:

Lisp is a very vague concept. I see two more or less useful interpretations:

  1. Lisp 作为拥有一些共同思想的语言家族.在广泛的解释中,非常不同的语言属于这个家族:Common Lisp、Scheme、Logo、Dylan、Emacs Lisp、Clojure、RLisp、3Lisp 以及许多其他语言.

  1. Lisp as a family of languages which share some common ideas. In a wide interpretation very different languages belong to this family: Common Lisp, Scheme, Logo, Dylan, Emacs Lisp, Clojure, RLisp, 3Lisp and many, many others.

Lisp 作为以某种方式实现核心语言(CAR、CDR、CONS、LAMBDA、PROG、SET、SETQ、QUOTE、DEFUN、IF、COND、DO...)的一系列语言:Lisp1.5、MacLisp、Lisp Machine Lisp、Emacs Lisp、Common Lisp、ISLisp.请注意,这些语言通常将Lisp"作为其名称的一部分.

Lisp as a lineage of languages that are somehow implementing a core language (CAR, CDR, CONS, LAMBDA, PROG, SET, SETQ, QUOTE, DEFUN, IF, COND, DO, ...): Lisp 1.5, MacLisp, Lisp Machine Lisp, Emacs Lisp, Common Lisp, ISLisp. Note that these languages usually have 'Lisp' as part of their name.

我们在 Lisp 方言中发现的一些典型事物:严格求值、副作用、直接命令式编程、函数式编程结构、s 表达式、求值、宏.

Some typical things we find in Lisp dialects: strict evaluation, side effects, direct imperative programming, functional programming constructs, s-expressions, evaluation, macros.

Haskell 是一种非常不同的语言:非严格计算、不基于 s 表达式的语法、静态类型、纯函数式.

Haskell is a very different language: non-strict evaluation, syntax not based on top of s-expressions, static typing, purely functional.

Haskell 不适合 1 或 2.所以,我会说 Haskell 不是 Lisp.

Haskell does not fit 1 nor 2. So, I would say Haskell is not a Lisp.

类似于我们可以说函数式编程语言是:

Similar we can say that a Functional Programming language is:

  1. 一种支持函数式编程的语言:Lisp、APL、...、ML、SML、OCAML、F#、Miranda、Haskell、...

  1. a language that supports Functional Programming: Lisp, APL, ..., ML, SML, OCAML, F#, Miranda, Haskell, ...

一种强制执行函数式编程的语言.这里 Lisp 已经不太适合了,因为命令式甚至面向对象编程在 Lisp 中都不是二等的.

a language that enforces Functional Programming. Here Lisp already does not really fit in, since imperative or even object-oriented programming is not second class in Lisp.

一种强制执行纯函数式编程的语言.这里我们以 Haskell 为例.作为一种相对较新的 Lisp 方言,Clojure 也可能适合.

a language that enforces Pure Functional Programming. Here we have Haskell as a good example. As a relatively new Lisp dialect Clojure also might fit in.

通常 Lisp 只支持,但不强制执行函数式编程.所以它是一种更广泛解释的函数式编程语言.

Usually Lisp does only support, but not enforce Functional Programming. So it is a Functional Programming Language in a wider interpretation.

Haskell 是一种被视为纯函数式编程语言的语言.

Haskell is one of the languages that is seen as a Purely Functional Programming Language.

这篇关于Haskell 是 Lisp 吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 08:10