Is Haskell a Lisp?

前端 未结 9 1454
梦毁少年i
梦毁少年i 2020-12-09 02:33

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 Haske

相关标签:
9条回答
  • 2020-12-09 02:57

    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.

    0 讨论(0)
  • 2020-12-09 02:57

    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.

    0 讨论(0)
  • 2020-12-09 03:01

    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

    0 讨论(0)
提交回复
热议问题