help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is there any difference between `equal' and `string=' for strings?


From: Emanuel Berg
Subject: Re: Is there any difference between `equal' and `string=' for strings?
Date: Sat, 21 Aug 2021 01:42:14 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

>>   (defun do-something (method)
>>     (when (string= method "now")
>>       (message "I'm all over it") ))
>
> What about
>
> (defun get-string (s)
>   (if (stringp s)
>       s
>     (let ((val (symbol-value s)))
>       (or (and (stringp val) val)
>           (symbol-name s) ))))
>
> (defun string== (s1 s2)
>   (string= (get-string s1)
>            (get-string s2) ))

Maybe one should rationalize everything down into

"same" - same object is t, else nil

"equal-all" - same type _and_ equal data is t, else nil (for
this purpose, the predicates, e.g., `stringp' would imply the
existence of a type)

"equal-data" - equal data, here it would have to be set up on
a case-by-case basis for all the types, so while obviously for
`integerp' and `floatp'

  (equal-data 2 2.0)

but one can think of a lot more, for example

  (equal-data "data" '(?d ?a ?t ?a)) ; t

and so on.

Not saying one should change Lisp tho, just to theorize what
it could be I mean ...

What does the computer science (or perhaps login/math
science?) of "type theory" have to say about all this? :)
No, really?

Did all the equality functions arrive little by little or was
there a plane? A little bit of both perhaps?

All the overlap are implementation/optimization derived
things, right?

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

[Prev in Thread] Current Thread [Next in Thread]