Re: Glasgow haskell vs. Lispworks
- From: Rainer Joswig <joswig@xxxxxxx>
- Date: Sat, 11 Aug 2007 14:22:05 +0200
In article <1186834189.429035.22350@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
Stuart Cook <scook0@xxxxxxxxx> wrote:
On Aug 11, 10:10 am, Rainer Joswig <jos...@xxxxxxx> wrote:
In article <f9id4j$9u...@xxxxxxxxx>,
"Rene de Visser" <Rene_de_Vis...@xxxxxxxxxxx> wrote:
Equals works correctly in Haskell. Not need to decide between eq, eql,
equals, equalp and other data structure specific versions.
Equal can't work 'correctly'. You might want to read Kent Pitman's
article about it.
http://www.nhplace.com/kent/PS/EQUAL.html
[Disclaimer: I'm a Haskell fan, and not a Lisper, so take my words
with an appropriate grain of salt.]
That article describes why generic equality can't work *in (Common)
Lisp*.
It talks that there are different equalities and you have to
say which you want:
* identity (is this really the same thing?)
* value (does it have the same value?)
* structural (does is have the same structure?)
* fuzzy (is it same up to some limit?)
and so on.
The fundamental problem for CL is that given a cons cell, it's
impossible to reliably determine whether it should be interpreted as a
cons-pair, a list, a tree, or something else entirely. This is because
CL gives you the flexibility to use conses in many different ways
without having to explicitly declare your intention.
Haskell denies you this particular flexibility, but in exchange you
gain the ability to have compiler discover your intentions using the
types of your terms. Pairs, lists and trees all have distinct types,
and Haskell can use the appropriate comparison function automatically.
The compiler can't discover my intentions. That would be AI.
So this is a nice example of a feature that CL can't[1] have -- not
because CL somehow isn't powerful enough, but because in this case it
has *too much* unrestricted power. "With great power comes great
responsibility", after all.
At a broad level of generalization, I suppose you could say that Lisp
compilers tend to assume you know what you're doing, as long as it
looks like it might make sense. A Haskell compiler tries to keep you
"honest", and in exchange does its best to assist you using the
information you provide.
(There are some other nice properties of Haskell arising from
typeclasses, purity etc., but I won't go into these right now.)
I have less choices in Haskell.For me this simplifies programming. Code
sometimes follows directly form the types.
Yes, this can be good.
Come to think of it, this is my entire post in a nutshell.
Stuart Cook
[1] Well, you might be able able to come close by avoiding raw conses
entirely, but would you be able call the result Lisp?
Sure, why not? In Lisp you are using all kinds of data structures which
are not build out of conses.
--
http://lispm.dyndns.org
.
- Follow-Ups:
- Re: Glasgow haskell vs. Lispworks
- From: rossberg
- Re: Glasgow haskell vs. Lispworks
- References:
- Glasgow haskell vs. Lispworks
- From: Rene de Visser
- Re: Glasgow haskell vs. Lispworks
- From: Rainer Joswig
- Re: Glasgow haskell vs. Lispworks
- From: Stuart Cook
- Glasgow haskell vs. Lispworks
- Prev by Date: Re: Glasgow haskell vs. Lispworks
- Next by Date: undecidable type vs. annotation?
- Previous by thread: Re: Glasgow haskell vs. Lispworks
- Next by thread: Re: Glasgow haskell vs. Lispworks
- Index(es):
Relevant Pages
|