[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: |
Sat, 21 Aug 2021 12:08:48 +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 09:42]:
> >> (string= 'hi 'hi) -> t
> >
> > With symbols their "print names" are used, you can get that
> > with
> >
> > (symbol-name 'hi) ; "hi"
>
> The reason for this, I think, is for example so one can do
> a `defun' like this
>
(defun do-something (method)
(when (string= method "now")
(message "I'm all over it") ))
> Then one can do either
>
> (do-something "now")
>
> or
>
> (do-something 'now)
That is something new to me. I would not ever use it that way, but you
discovered it. It looks like incorrect use as (type-of 'now) ⇒ symbol
and is then compared as string.
I would do:
(setq now "Not now") ⇒ "Not now"
(do-something now) ⇒ nil
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
In support of Richard M. Stallman
https://stallmansupport.org/
- Re: this is United States calling (was: Re: [External] : Is there any difference between `equal' and `string=' for strings?), (continued)
Re: Is there any difference between `equal' and `string=' for strings?, Emanuel Berg, 2021/08/19
- Re: Is there any difference between `equal' and `string=' for strings?, Jean Louis, 2021/08/20
- Re: Is there any difference between `equal' and `string=' for strings?, Emanuel Berg, 2021/08/20
- Re: Is there any difference between `equal' and `string=' for strings?, Emanuel Berg, 2021/08/20
- Re: Is there any difference between `equal' and `string=' for strings?, Emanuel Berg, 2021/08/20
- Re: Is there any difference between `equal' and `string=' for strings?, Emanuel Berg, 2021/08/20
- Re: Is there any difference between `equal' and `string=' for strings?, Emanuel Berg, 2021/08/20
- Re: Is there any difference between `equal' and `string=' for strings?, Emanuel Berg, 2021/08/20
Re: Is there any difference between `equal' and `string=' for strings?,
Jean Louis <=
Re: Is there any difference between `equal' and `string=' for strings?, Emanuel Berg, 2021/08/21
Re: Is there any difference between `equal' and `string=' for strings?, Jean Louis, 2021/08/21
Re: Is there any difference between `equal' and `string=' for strings?, Emanuel Berg, 2021/08/21
Re: Is there any difference between `equal' and `string=' for strings?, Marcin Borkowski, 2021/08/24