32

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?

Bob Bobson
  • 353
  • 3
  • 3
  • 1
    I disagree, but what was the argument the authors gave? – Tobu Jan 14 '11 at 22:24
  • 2
    None! They are giving a general introduction and say 'as a functional language, Haskell is part of the Lisp family along with ML, Occam and Clean'. – Bob Bobson Jan 14 '11 at 22:29
  • 3
    Well that's bogus. Lisp may have been the first functional langauge, but that doesn't make all functional languages lisps, in the same way Java is not Smalltalk and Python is not C. And to add to your list of Lisp features Haskell lacks, Lisp has little of Haskell's beyond-beginner-level features (for starters: Monads, algebraic data types and pattern matching). –  Jan 14 '11 at 22:35
  • 9
    Lists are _not_ the only composite data structure in Lisp. They just happen to be used for the syntax tree. – Svante Jan 15 '11 at 01:45
  • 2
    Isn't this exactly an "I'm curious if other people feel like I do"-type 'question'? According to the FAQ, these are to be "avoided". – Ken Jun 02 '11 at 02:00
  • Vote to close and move to Programmers. – user7116 Jun 02 '11 at 02:02
  • 1
    @delnan: "Lisp" is actually a family of languages, and some of them have very advanced features (check out Qi and Shen). – Tikhon Jelvis Jan 12 '12 at 18:33
  • 1
    @TikhonJelvis: I actually heard of Qi. The little I've seen of the type system is certainly impressive. I'm not sure if many would count it as Lisp though (yes, it's implemented in and influenced by Lisp, but Java isn't C++ either) - it seems to deviate heavily from most (all?) existing lisp dialects and adds major concepts, with the remaining resemblance being some common basics such as lists, a vague connection to lambda calculus, and S-expressions/homoiconicity. (In fact, I haven't found any claim that Qi is a lisp on Wikipedia and the Qi website.) –  Jan 12 '12 at 18:43
  • 1
    @delnan: At the very least, Qi is built on top of Common List and "inherits all the features of Lisp that ML and Haskell do not have". You can also mix Common Lisp and Qi functions in one file. I think this makes Qi a part of the Lisp family. (The quote is from [Qi's Google code page](http://code.google.com/p/qilang/).) – Tikhon Jelvis Jan 12 '12 at 19:12
  • 1.) Pattern matching was first implemented in Lisps, there is an exercise in SCIP to implement it. What is confusing is that Lispers then ignored the pattern matching and do everything with cadr and caddadaaadr... Monads are type-safe ways of programming in Macros that override/extend let, apply, and do(progn) as well as setf && others. I believe it was called "contexts" in Lisp. ADTs are type-safe s-expressions. – aoeu256 Mar 28 '21 at 18:16

9 Answers9

43

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

  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.

  2. 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.

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

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

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. a language that supports Functional Programming: Lisp, APL, ..., ML, SML, OCAML, F#, Miranda, Haskell, ...

  2. 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.

  3. 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.

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

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

Rainer Joswig
  • 136,269
  • 10
  • 221
  • 346
  • 12
    Yeah, moving beyond the syntax alone, JavaScript is probably more of a Lisp than Haskell. (Originally conceived as a Scheme implementation...) – Kevin Cantu Jan 15 '11 at 12:04
  • 9
    @Kevin Cantu: That's no accident. Brendan Eich mentions on his web site that Netscape hired him with the promise that he would implement Scheme in the browser. ;-) – Rainer Joswig Jan 15 '11 at 16:50
  • 1
    btw, I'm missing the homoiconicity as one of LISP's distinctive properties (although one could infer it from mentioning s-expressions) – hvr Jan 16 '11 at 14:51
  • 4
    @hvr: that's because 'homoiconicity' is a confusing term that is not used much in the Lisp world. There we talk about computation with symbolic expressions (see McCarthy's original paper on Lisp). Sometimes we talk about 'code as data'. – Rainer Joswig Jan 16 '11 at 15:53
20

I think that it is a stretch to consider Haskell as a member of the LISP family, but I suspect the reasoning goes something like this...

When classifying programming languages, it is meaningful to divide them into two groups: those descended from FORTRAN and those that are not. In 1958, the "not FORTRAN group" pretty much meant LISP (at least, among the languages that are not extinct today). So, for a time, the programming language family tree had two main branches: the FORTRAN descendants and the LISP descendants. If those are the only two choices, then I would put Haskell into the LISP branch.

However, many commentators consider languages like ML, Prolog and APL to have arisen "out of the blue" -- introducing sufficiently distinct paradigms to merit lineages unto themselves. Haskell is clearly kin to ML.

As examples of such classifications, see the following programming language family trees:

O'Reilly's Programming Language Poster

Computer Languages Timeline at levenez.com

HOPL: an interactive Roster of Programming Languages (Haskell Entry)

WReach
  • 18,098
  • 3
  • 49
  • 93
  • The O'Reilly link moved, look instead at http://cdn.oreillystatic.com/news/graphics/prog_lang_poster.pdf – Devon Jul 20 '20 at 22:15
9

I would not agree with that. They're both functional programming languages and Lisp influenced Haskell, but Haskell is not a Lisp derivative. Just look at the amount of parenthesis and you can tell.

mnuzzo
  • 3,529
  • 4
  • 26
  • 29
4

I think Haskell is a Lisp in the sense that they're both based on the λ calculus. Haskell is an implementation of λ.

Though most people would say that Haskell belongs to the ML family. ML is also based on λ, as are all functional languages I know of.

Under the hood, OCam (descended from ML) is compiled to combinatory logic, a formalism that is equivalent to λ calculus, and was invented by Haskell Curry, the logician whom Haskell is named after. But the use of combinatory logic for functional langauge compilation seems to be less popular nowadays, so I'm not sure about modern compilers like GHC.

Lisp's syntax is almost identical with λ calculus, which makes this family (Scheme, Clojure, etc) very special.

Yan King Yin
  • 1,189
  • 1
  • 10
  • 25
  • 1
    Very informally, Lisps are basically equivalent to untyped lambda calculus. Haskell is basically typed lambda calculus thanks to the Hindley-Milner type system. I think that distinction is big enough to assert that Haskell is *not* a Lisp. – mikera Jul 23 '12 at 07:02
4

What people define as a lisp varies. The original specification for a lisp didn't mention macros at all and only defined a small list of primitive function, which, if my memory serves me, are the following:

  • cons
  • car
  • cdr
  • cond
  • eq
  • atom
  • and
  • or
  • not
  • nil

This might not be the full list, or it might have few additional members, but in any case, John McCarthy's original specification was very small.

If you define a lisp as any language that defines all of those functions, then most modern languages are lisps, including haskell.

A more strict and modern definition of a lisp is as follows:

  • eager evaluation
  • dynamic typing
  • impure functional
  • macros
  • focus on lists as primary data structure

Haskell doesn't fit the first 3, it's macros (template haskell) don't follow the code-is-data paradigm, and while lists are very important, they're not the primary data structure.

So I would say no, Haskell is not a lisp.

adrusi
  • 835
  • 1
  • 7
  • 14
  • What do you mean about the "code-is-data paradigm"? Template Haskell can manipulate syntax trees; what more is needed? – dfeuer Aug 26 '19 at 12:31
2

Haskell is not lisp of course. Everyone has his own understanding what the heck "lisp" is. IMHO lisp is a language where the source code is a valid structure in that same language. Haskell source code is not a valid structure in haskell, hence they have to have a separate syntax (Haskell Template) to manipulate their own source code.

But there's at least one interesting feature in haskell that reminds me of lisp. Its the syntax of function calls: func args1 agr2 arg3. Lisp has EXACTLY the same syntax: (func args1 agr2 arg3). In fact you can include outside parens in haskell too. All other algol family languages introduce parens and commas between function name and arguments.

Vagif Verdi
  • 4,816
  • 1
  • 26
  • 31
  • 1
    Lisp source code can be a data structure in Lisp because Lisp is dynamically typed and easily handles a list which contains a mixture of symbols, strings, numbers, vectors, other lists, etc. – Kaz Mar 07 '12 at 03:23
1

I'd say that both are functional languages, which makes them belong to the same family. However, I wouldn't call Haskell a Lisp derivative (like Scheme).

David Weiser
  • 5,190
  • 4
  • 28
  • 35
1

Arguably, all functional languages are descendants of Scheme to the extent that Scheme stumbled into, roughly, implementing the lambda calculus (though with quirks), and functional languages also implement the lambda calculus, though they don't necessarily always look like it. Also, arguably, the ML lineage is completely distinct because it goes back to Landin's ISWIM, which was influential but never implemented, had very little to do with Lisp, and from the start knew its theoretical foundations.

The real thing though is that Haskell and Lisp have much more in common with one another than either has with either the C family or the Prolog family.

I would have argued that folks should look past syntactic issues, but I forgot that Lispers define syntax as a key part of what it means to be a lisp. Which I think is goofy because then arguably Haskell isn't a Lisp, but Liskell is, even though the latter is basically a processor for the former.

sclv
  • 38,665
  • 7
  • 99
  • 204
  • 5
    Scheme? No no no. Scheme is fancy modern stuff. When we talk about foundations of functional programming, we talk about that early primitive Lisp even "Lispers" would despise today. –  Jan 14 '11 at 22:40
  • 1
    Early primitive lisp hadn't solved funargs, even though roughly contemporaneous work did. No proper lexical scope and first class functions = not remotely functional. – sclv Jan 15 '11 at 00:22
  • 5
    The ML lineage *is* distinct because it is older than Scheme. Same goes for the Miranda lineage (SASL - KRC - Miranda - Haskell). Published work on Scheme dates to around 1976 I think, SASL dates to 1972. LCF the original host for ML dates to 1972, I don't know the status of ML within it though. Backus's FP might even precede Scheme. – stephen tetley Jan 15 '11 at 09:10
  • @delnan: Good chance Scheme is older than you, unless you are 36 or older. – leppie Jan 20 '11 at 05:16
  • @sclv: Scheme share ML semantics, and so does many others like OCaml, F#, SML and even LISP-1. – leppie Jan 20 '11 at 05:18
  • @leppi: It is. But the first thing called Scheme is notably younger than McCarthy's original Lisp. Also, does "fancy modern stuff" sound very serious to you? –  Jan 20 '11 at 17:50
-2

Hoyte compares some languages and claims that Haskell is NOT a Lisp for it is too strict in types and only for academics, whereas Common Lisp is more like a prototyping language (no strictness, dynamic typing).

See: Let Over Lambda—50 Years of Lisp by Doug Hoyte (an advanced book about Common Lisp, http://letoverlambda.com/)

Haskell and Common Lisp (probably all Lisps) are optimized against the functional programming (FP) paradigm. Haskell is pure, whereas Common Lisp is unpure. Contrast the term FP also with "total functional programming".

Also have a look at this diagram comparing programming language paradigms: http://www.info.ucl.ac.be/~pvr/paradigms.html

Gerold Meisinger
  • 4,500
  • 5
  • 26
  • 33