[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Your bug report about string-search
- To: DPH at MIT-ML
- Subject: Re: Your bug report about string-search
- From: MOON@MIT-MC
- Date: Sun ,1 Nov 82 05:59:31 EDT
- Cc: (BUG LISPM) at MIT-AI DPH@MIT-ML 01/11/82 16:22:27 To: (BUG LISPM) at MIT-AI In System 78.40, ZMail 38.5, microcode 836, on Lisp Machine Nineteen:
(string-search "" "banana") returns 0, while (string-search-char "" "banana")
and (string-search-set "" "banana") return NIL. Seeing that the zeroeth element
of "banana" is "b" and not the null string, it seems that string-search should do
what the other two functions do, namely return NIL for this somewhat pathalogical
case.
string-search doesn't search for elements, it searches for substrings.
Indeed there is a null string in characters 0 up to but not including 0
of "banana", hence string-search is returning the right value.
There is no reason that it should be doing what the other two functions
do, since they (each) do something different.
string-search-char should be giving an error, since the null string is
not a character. In fact it has a bug; string-search-char does no
type checking on its first argument. Should it coerce symbols and
strings into characters, as the character function does?
string-search-set could consistently return either 0 or NIL, depending
on whether the glass is half-full or half-empty (whether it is looking
for a character in the (empty) set, or looking for a place where there
isn't a character not in the (empty) set.) Evidently it is doing the
former.