Re: Glasgow haskell vs. Lispworks



In article <1186864875.060177.110990@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
rossberg@xxxxxxxxxxxx wrote:

On 11 Aug., 14:22, Rainer Joswig <jos...@xxxxxxx> wrote:

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

Neither of these does The Right Thing in general. E.g. when you have
data structures that are largely structural, but contain a few mutable
nodes somewhere inside (say a tree carrying some mutable infos). The
right thing would be choosing different notions of equality on
different nodes. SML and Haskell do that automatically, thanks to
typing. E.g. in SML,

val r = ref 1

[r, r] = [r, r] (* true *)
[r, r] = [r, ref 1] (* false *)

Note that the lists are compared structurally, while the contained
references are compared by identity - which is the only definition of
equality properly mirroring observational equivalence.

strings

* "foo" and "foo", same strings ?

are these really the same objects?

* "foo" and "foo", same contents ?

It could be different string types (fixed length, growing strings,
unicode strings, ascii strings, ...)

* "foo" and "Foo", same word?

* "Rainer Joswig" and "Ranier Joswig", same name (minus spelling)?


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.

I'm confused. Is that a proof that SML and Haskell do not exist?

Choosing the appropriate comparison function does not depend on
the types of the arguments, but on the intentions of what
features of two objects I want to compare how.
.



Relevant Pages

  • Re: Glasgow haskell vs. Lispworks
    ... SML and Haskell do that automatically, ... Pairs, lists and trees all have distinct types, ... and Haskell can use the appropriate comparison function automatically. ... The compiler can't discover my intentions. ...
    (comp.lang.functional)
  • Re: printf resisting to be used
    ... This is the same type that main has in a haskell program. ... you can eliminate the coercion ... to Float in the printf argument by making the type of interest ... represent the action of printing the strings, ...
    (comp.lang.functional)
  • Re: Operators as functions
    ... > native language) a list of strings to a string. ... I know operators can be sent as arguments in Haskell and since ... > Python has functions as map, ...
    (comp.lang.python)
  • Operators as functions
    ... I want to concatinate (I apologize for bad English, ... native language) a list of strings to a string. ... I know operators can be sent as arguments in Haskell and since ... Python has functions as map, ...
    (comp.lang.python)