From: "Jürgen Hartmann" <juergen_hartmann_@hotmail.com>
To: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: RE: Differences between identical strings in Emacs lisp
Date: Wed, 8 Apr 2015 13:02:20 +0200 [thread overview]
Message-ID: <DUB124-W368531EDFF0ECCDCA9B6C7A8FC0@phx.gbl> (raw)
In-Reply-To: <jwva8yjzm37.fsf-monnier+gmane.emacs.help@gnu.org>
@Stefan Monnier: Thank you for your clarification:
>> both evaluate to (186), indicating that the strings contain the same
>> character(s). So they are identical.
>
> No: the "\xBA" string does not contain any character, it only contains
> bytes (we call such "string of bytes" a "unibyte string" and the usual
> "string of characters" is called a "multibyte string").
That's very important, in deed--according to the golden rule:
"Clarity of concept requires clarity of terms."
> And yes, the (integer) codes of the bytes of "\xBA" happen to be
> identical to the (integer) codes of the characters of (concat '(#xBA)).
>
> So (equal (append "\xBA" nil) (append "º" nil)) is non-nil.
> Note that the same applies to: (equal (append "\xBA" nil) (append [#xBA] nil))
I think my problem was that I have missed the type--unibyte vs. multibyte--of
my strings, the fact that characters and raw bytes are different things, and
that the (integer) codes of raw bytes gets converted between unibyte and
multibyte contexts. Because of the latter we have equality for example
between "\xBA" and (concat '(#x3FFFBA)):
(string= "\xBA" (concat '(#x3FFFBA)))
--> t
Again, thank you for your input.
Juergen
next prev parent reply other threads:[~2015-04-08 11:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-06 13:21 Differences between identical strings in Emacs lisp Jürgen Hartmann
2015-04-07 21:10 ` Stefan Monnier
2015-04-08 11:02 ` Jürgen Hartmann [this message]
2015-04-08 13:44 ` Jürgen Hartmann
[not found] <mailman.76.1428326518.904.help-gnu-emacs@gnu.org>
2015-04-07 0:10 ` Pascal J. Bourguignon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DUB124-W368531EDFF0ECCDCA9B6C7A8FC0@phx.gbl \
--to=juergen_hartmann_@hotmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).