Re: Strings and the like.
- Posted by "Lucius L. Hilley III" <lhilley at CDC.NET> Dec 09, 1999
- 335 views
> ---------------------- Information from the mail header ----------------------- > Sender: Euphoria Programming for MS-DOS <EUPHORIA at LISTSERV.MUOHIO.EDU> > Poster: Everett Williams <rett at GVTC.COM> > Subject: Re: Strings and the like. > -------------------------------------------------------------------------- ----- > > On Wed, 8 Dec 1999 19:43:30 -0500, Lucius L. Hilley III <lhilley at CDC.NET> wrote: > > > The error in using the below code is that it doesn't check to see if there > >is a sequence inside s. And if there is. It fails to check it properly as > >well. > > > >Run this example: > > > >type whole_set(sequence s) > > return find(0, s = floor(s)) > >end type > > > >? whole_set({1, 2, 3}) > >? whole_set({1, 2, {3}}) > >? whole_set({1, 2, {3.14}}) > > > >of course you could try this. > > > >type whole_set(sequence s) > > return (compare(repeat(1, length(s)), s = floor(s)) = 1) > >end type > > > > All examples with either type definitions return 0's and I'm not quite sure > what that means. Your original premise, though, I agree with. The likelyhood > of sub-sequences in a string is fairly low, however, especially if we are > talking about externally supplied data. > > Everett L.(Rett) Williams > rett at gvtc.com > What it means is that I need to pay a lot more attention to what I am coding I have apparently made MANY fumbles in the past few days. NOW....... Since I have tested and corrected the code. Simply change floor(s)) = 1) to floor(s)) = 0). OR use the equal() command that was stated earlier. You will find that only first example is and should be returned TRUE. Lucius L. Hilley III lhilley at cdc.net +----------+--------------+--------------+ | Hollow | ICQ: 9638898 | AIM: LLHIII | | Horse +--------------+--------------+ | Software | http://www.cdc.net/~lhilley | +----------+-----------------------------+