[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Why (substring "abc" 0 4) does not return "abc" instead of an error?
From: |
Andreas Schwab |
Subject: |
Re: Why (substring "abc" 0 4) does not return "abc" instead of an error? |
Date: |
Mon, 16 Jul 2012 09:38:47 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) |
Juanma Barranquero <address@hidden> writes:
> BTW, for unexpected behavior wrt strings, my favourite is this one
> (it's not a bug);
>
> (let ((s "ab") (m 2)) (eq (substring s 0 m) (substring s 0 m))) => nil
> (let ((s "ab") (m 1)) (eq (substring s 0 m) (substring s 0 m))) => nil
> (let ((s "ab") (m 0)) (eq (substring s 0 m) (substring s 0 m))) => t
That's not much different from ("foo" == "foo") in C. Using eq for
comparing non-atoms is seldom useful.
Andreas.
--
Andreas Schwab, address@hidden
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
- Re: Why (substring "abc" 0 4) does not return "abc" instead of an error?, (continued)
- Re: Why (substring "abc" 0 4) does not return "abc" instead of an error?, Bastien, 2012/07/16
- Re: Why (substring "abc" 0 4) does not return "abc" instead of an error?, Tassilo Horn, 2012/07/16
- Re: Why (substring "abc" 0 4) does not return "abc" instead of an error?, Pascal J. Bourguignon, 2012/07/16
- Re: Why (substring "abc" 0 4) does not return "abc" instead of an error?, Bastien, 2012/07/16
- Re: Why (substring "abc" 0 4) does not return "abc" instead of an error?, Bastien, 2012/07/16
- Re: Why (substring "abc" 0 4) does not return "abc" instead of an error?, Pascal J. Bourguignon, 2012/07/16
- Re: Why (substring "abc" 0 4) does not return "abc" instead of an error?, Stefan Monnier, 2012/07/16
- Re: Why (substring "abc" 0 4) does not return "abc" instead of an error?, Lennart Borgman, 2012/07/16
- Re: Why (substring "abc" 0 4) does not return "abc" instead of an error?, Bastien, 2012/07/16
- Re: Why (substring "abc" 0 4) does not return "abc" instead of an error?, Lennart Borgman, 2012/07/16
- Re: Why (substring "abc" 0 4) does not return "abc" instead of an error?,
Andreas Schwab <=
- Re: Why (substring "abc" 0 4) does not return "abc" instead of an error?, Juanma Barranquero, 2012/07/16