[Top][All Lists]

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

Re: string> missing?

From: Stefan Monnier
Subject: Re: string> missing?
Date: Thu, 04 Jun 2015 11:33:44 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

> (setq str1 "foo")
> (setq str2 "foo")
> (setq str3 str1)
> (= str1 str2)       ;;==> *error*
> (eq str1 str2)      ;;==> nil
> (eq str1 "foo")     ;;==> nil
> (eq str1 str3)      ;;==> nil
> (string= str1 str2) ;;==> t

The "standard" equality testing in Elisp is `equal'.
E.g. it's what is used by `add-to-list', `member', and `assoc'.
IOW, usually you're expected to use `equal' unless you need something else.


reply via email to

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