From: jimka
Subject: simple string search
Date: 
Message-ID: <9d1e85f2-a243-4859-bf25-ccac242a4442@t26g2000prh.googlegroups.com>
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.

From: ······@corporate-world.lisp.de
Subject: Re: simple string search
Date: 
Message-ID: <65e22add-4877-42b5-be6e-decc194bdcd2@s1g2000prg.googlegroups.com>
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
From: jimka
Subject: Re: simple string search
Date: 
Message-ID: <de87f679-4cad-43d0-ab89-3e3d8fdf54b8@p2g2000prf.googlegroups.com>
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
From: Leandro Rios
Subject: Re: simple string search
Date: 
Message-ID: <gkiv1o$5he$1@news.motzarella.org>
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
From: Kenneth Tilton
Subject: Re: simple string search
Date: 
Message-ID: <496d0d1f$0$4914$607ed4bc@cv.net>
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
From: jimka
Subject: Re: simple string search
Date: 
Message-ID: <e5ed5e50-4972-4a19-a7f0-96a24b95066a@n10g2000yqm.googlegroups.com>
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
From: Kenneth Tilton
Subject: Re: simple string search
Date: 
Message-ID: <496da827$0$13281$607ed4bc@cv.net>
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
From: Rob Warnock
Subject: Re: simple string search
Date: 
Message-ID: <2YidnQZvk5vkzPDUnZ2dnUVZ_ozinZ2d@speakeasy.net>
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
From: Kenneth Tilton
Subject: Re: simple string search
Date: 
Message-ID: <496da911$0$20298$607ed4bc@cv.net>
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
From: Steven M. Haflich
Subject: Re: simple string search
Date: 
Message-ID: <Nzwbl.10404$W06.574@flpi148.ffdc.sbc.com>
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.
From: Thomas F. Burdick
Subject: Re: simple string search
Date: 
Message-ID: <f5a71f6e-6aad-4bb9-90be-1dae53a5af8b@a29g2000pra.googlegroups.com>
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.
From: ········@gmail.com
Subject: Re: simple string search
Date: 
Message-ID: <3b3fcaa5-5e65-47bd-b9d1-b1ccdd70bb06@35g2000pry.googlegroups.com>
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.