[m-rev.] for review: mercury implementation of string.m
Peter Ross
pro at missioncriticalit.com
Sat Jun 15 18:48:25 AEST 2002
On Sat, Jun 15, 2002 at 06:39:46AM +1000, Simon Taylor wrote:
> On 14-Jun-2002, Peter Ross <pro at missioncriticalit.com> wrote:
> > > > @@ -1116,6 +1165,20 @@
> > > > Index = WholeString->IndexOf(SubString);
> > > > }").
> > > >
> > > > +string__sub_string_search(String, SubString, Index) :-
> > > > + string__sub_string_search_2(String, SubString, 0, Index).
> > > > +
> > > > +:- pred sub_string_search_2(string::in, string::in,
> > > > + int::in, int::out) is semidet.
> > > > +
> > > > +sub_string_search_2(String, SubString, CurrentIndex, Index) :-
> > > > + ( string__prefix(String, SubString) ->
> > > > + Index = CurrentIndex
> > > > + ;
> > > > + string__first_char(String, _, Rest),
> > > > + sub_string_search_2(Rest, SubString, CurrentIndex + 1, Index)
> > > > + ).
> > >
> > > Same here.
> > >
> > I haven't done this because I couldn't easily change the algorithm to
> > use string__index. In reality we should implement a proper string
> > searching algorithm.
> > I have added an XXX.
>
> What's so hard about writing a brute force string matcher?
There is nothing that hard, but the amount of time it will take me more
time to write it then I have to devote to it at the moment. The goal of
these changes is to get a working version of the IL grade, and I am
under time pressure. Efficiency can come after I have the working version.
> I'm not happy for this to be committed as is.
>
Would you be happier to have no implementation then an inefficient
implementation?
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list