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: Jean Louis
Subject: Re: Is there any difference between `equal' and `string=' for strings?
Date: Fri, 20 Aug 2021 08:25:16 +0300
User-agent: Mutt/2.0.7+183 (3d24855) (2021-05-28)

* Emanuel Berg via Users list for the GNU Emacs text editor 
<help-gnu-emacs@gnu.org> [2021-08-20 02:04]:
> Marcin Borkowski wrote:
> 
> > Well, of course a string and a symbol can never be `equal',
> > but they can be `string='. But what if both arguments
> > are strings?
> 
> ... and if both arguments are symbols?
> 
> (string= 'hi 'hi) ; t
> 
> (Why ever one would use `string=' for that.)
> 
> Yeah, it is a jungle all that ...

How I understand it, it is good also for comparison of symbols as
strings. 

(setq s1 "Jane") ⇒ "Jane"
(setq s2 "Jane") ⇒ "Jane"
(setq s3 "Doe") ⇒ "Doe"

Then this is how I understand the intended purpose:

(string= s1 s2) ⇒ t
(string= s1 s3) ⇒ nil

And of course you are free to compare empty symbols:

(string= 'hi 'hi) ⇒ t

However by looking at the purpose it becomes all logical to me.


-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



reply via email to

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