Re: Glasgow haskell vs. Lispworks



Rainer Joswig schrieb:
* "foo" and "foo", same strings ?

are these really the same objects?

That depends on whether you want equality or identity.

Observationally, A is identical to B if both are equal and remain equal under any change to A. If I can't change A, equality implies identity; since identity implies equality by definition, identity and equality are equivalent under immutability.
So in a pure language, identity is the same as equality.

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

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

They couldn't (in Haskell).

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

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

You work with equivalence classes in such a case.

I.e. either you write a function that maps "same modulo whatever" to equal values, and compare the results.
Or you write a "fuzzy" equality comparison function.

The language semantics remains unaffected.

Regards,
Jo
.



Relevant Pages

  • Re: Improving String.equals() implementation
    ... public boolean equals(Object anObject) { ... I really wonder whether that first test really helps to improve ... I would guess that the ratio of non-this Strings ... First, there is an instanceof query, which is more complex than a simple test extension, followed by a size equality check, followed by a loop doing comparison on each member of the string. ...
    (comp.lang.java.programmer)
  • Re: Holub on getters/setters again
    ... >> the same state (ie two different but equal object) to be contained in ... >I don't see the source for Includes, but presumably it would do equality ... >allows overloading of the equality operator, ... >don't think the Add method would allow two strings with the same state. ...
    (comp.object)
  • Re: Could I put commands in a variable
    ... Joel wrote: ... It's actually an operator, for inequality of strings. ... the string equality operator eq. ...
    (perl.beginners)
  • Re: OOs best feature survey results
    ... JOIN may require a way to compare columns from two different ... tables for equality. ... Boolean types or Boolean "answers" so that it can match or ... from just numbers and strings, ...
    (comp.object)