[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: `compare-strings' style question
From: |
David Kastrup |
Subject: |
Re: `compare-strings' style question |
Date: |
Thu, 19 Nov 2009 17:17:22 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) |
tomas@tuxteam.de writes:
> On Thu, Nov 19, 2009 at 12:39:33PM +0100, David Kastrup wrote:
>> tomas@tuxteam.de writes:
>>
>> > Hi,
>> >
>> > In Elisp, I'm trying to test whether a string is a prefix of another.
>
> [...]
>
>> > (when (eq (compare-strings foo 0 5 bar 0 5) t)
>> > ...)
>> >
>> > which looks rather funny. My question: are there better idioms? Am I
>> > barking up the wrong function?
>>
>> (unless (numberp ...
>>
>> or
>>
>> (if (symbolp ...
>
> Thanks. Still looks a bit funna, though :-)
In my opinion, t was the wrong choice for a match. nil would have been
much better because you can't use the result of compare-strings as a
condition.
But I suppose there is not much one can do now because of compatibility.
--
David Kastrup