Is Haskell a Lisp?

前端 未结 9 1453
梦毁少年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:37

    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.

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

    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.

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

    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.

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

    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.

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

    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)

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

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

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