can someone show me how to implement (unless it already exists) a
function which tell whether 1 given string
is a substring of another string
(sub-string-p "abcde" "bcd") ==> t, or integer index, i don't care
which
(sub-string-p "abcdefg" "x") ==> nil
thanks.
On Jan 13, 8:02 pm, jimka <·····@rdrop.com> wrote:
> can someone show me how to implement (unless it already exists) a
> function which tell whether 1 given string
> is a substring of another string
>
> (sub-string-p "abcde" "bcd") ==> t, or integer index, i don't care
> which
> (sub-string-p "abcdefg" "x") ==> nil
>
> thanks.
http://www.lispworks.com/documentation/HyperSpec/Body/f_search.htm
great! thanks, i figured it was something to do with sequences, but i
did not find SEARCH.
On 13 Jan, 20:07, ·······@corporate-world.lisp.de" <······@corporate-
world.lisp.de> wrote:
> On Jan 13, 8:02 pm, jimka <·····@rdrop.com> wrote:
>
> > can someone show me how to implement (unless it already exists) a
> > function which tell whether 1 given string
> > is a substring of another string
>
> > (sub-string-p "abcde" "bcd") ==> t, or integer index, i don't care
> > which
> > (sub-string-p "abcdefg" "x") ==> nil
>
> > thanks.
>
> http://www.lispworks.com/documentation/HyperSpec/Body/f_search.htm
jimka escribi�:
> great! thanks, i figured it was something to do with sequences, but i
> did not find SEARCH.
>
Get the Common Lisp Quick Reference:
http://clqr.berlios.de/
A great help until you can remember at least half of CL :)
Leandro
Leandro Rios wrote:
> jimka escribi�:
>> great! thanks, i figured it was something to do with sequences, but i
>> did not find SEARCH.
>>
>
> Get the Common Lisp Quick Reference:
>
> http://clqr.berlios.de/
>
> A great help until you can remember at least half of CL :)
>
> Leandro
>
I have always been fond of "search" as one of the functions named so
massively inconsistently with the rest of the language. In these
situations I normally recommend apropos, and indeed our OP used the word
"search" in describing their objective, but in this case I would have to
admit apropos might not even be able to help.
kenneth
yes kenny it did not occur to me that i was searching for something,
rather that i was trying to FIND something, or find the INDEX of
something
or find a substring or subsequence. i took a brief look thru chapter
16 and chapter 17, but did not read them exhaustively.
good to know the answer though.
-jim
On Jan 13, 10:52 pm, Kenneth Tilton <·········@gmail.com> wrote:
> Leandro Rios wrote:
> > jimka escribió:
> >> great! thanks, i figured it was something to do with sequences, but i
> >> did not find SEARCH.
>
> > Get the Common Lisp Quick Reference:
>
> >http://clqr.berlios.de/
>
> > A great help until you can remember at least half of CL :)
>
> > Leandro
>
> I have always been fond of "search" as one of the functions named so
> massively inconsistently with the rest of the language. In these
> situations I normally recommend apropos, and indeed our OP used the word
> "search" in describing their objective, but in this case I would have to
> admit apropos might not even be able to help.
>
> kenneth
jimka wrote:
> yes kenny it did not occur to me that i was searching for something,
> rather that i was trying to FIND something, or find the INDEX of
> something
> or find a substring or subsequence. i took a brief look thru chapter
> 16 and chapter 17, but did not read them exhaustively.
>
> good to know the answer though.
We might be agreeing, though your churlish tone suggests not....strike
that. We might be argeeing even though /you/ think not.
hth,kth
Kenneth Tilton <·········@gmail.com> wrote:
+---------------
| I have always been fond of "search" as one of the functions
| named so massively inconsistently with the rest of the language.
+---------------
Indeed. FIND-SEQUENCE (or even FIND-SEQ) would have fit into
the overall naming scheme a *lot* better...
-Rob
-----
Rob Warnock <····@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607
Rob Warnock wrote:
> Kenneth Tilton <·········@gmail.com> wrote:
> +---------------
> | I have always been fond of "search" as one of the functions
> | named so massively inconsistently with the rest of the language.
> +---------------
>
> Indeed. FIND-SEQUENCE (or even FIND-SEQ) would have fit into
> the overall naming scheme a *lot* better...
not SUBSEQP? Ah, sorry, when it finds it it returns the offset...hey!
OFFSET's available...
:)
kth
Kenneth Tilton wrote:
> not SUBSEQP? Ah, sorry, when it finds it it returns the offset...hey!
> OFFSET's available...
I'd be happy with the addition of SUBSEQP provided you obey symmetry and
also implement SUPERSEQP.
On 15 jan, 02:46, "Steven M. Haflich" <····@alum.mit.edu> wrote:
> Kenneth Tilton wrote:
> > not SUBSEQP? Ah, sorry, when it finds it it returns the offset...hey!
> > OFFSET's available...
>
> I'd be happy with the addition of SUBSEQP provided you obey symmetry and
> also implement SUPERSEQP.
I'm happy with that, as long as I can request an editing error along
the lines of PROG2 so that it's specified to have the same behavior as
SUBSEQP.
On Jan 13, 10:54 pm, Leandro Rios <··················@gmail.com>
wrote:
>
> Get the Common Lisp Quick Reference:
>
> http://clqr.berlios.de/
>
> A great help until you can remember at least half of CL :)
Thanks! I was looking for something like this.