Re: find_from and match_from

new topic     » goto parent     » topic index » view thread      » older message » newer message

Matt Lewis wrote:
 
> I've put a feature request on sourceforge for find_from and match_from:
> <a
> href="http://sourceforge.net/tracker/index.php?func=detail&aid=1684321&group_id=182827&atid=902785">http://sourceforge.net/tracker/index.php?func=detail&aid=1684321&group_id=182827&atid=902785</a>
> 
> Text:
> "Add two built-in functions, find_from and match_from, which work similar to
> find and match, but add a third parameter, which specifies the place in the
> sequence to begin looking.
> 
> If found or matched, the index of the find or match is returned, or zero,
> if not found or matched to the end of the sequence.
> 
> This has already been implemented in ooeu (<a
> href="http://sf.net/projects/ooeu">http://sf.net/projects/ooeu</a>), so
> this is a matter of determining if we want this in Euphoria, not the
> feasibility or requesting resources for development."
> 
> 
> Since this is already developed (though not documented)in ooeu, we basically
> 
> need to decide if this should go into euphoria or not.
> 
> Matt

Hi Matt,

It seems to be very simple to implement this feature
just in some library and do not touch 4 different
versions of interpreters, translators, binders
with their docs etc etc :

-- not tested
global function find_from_to(integer N, integer L, object a, sequence b)
          L = find(a, b[N..L])
       if L then return L-1+N
       else return L
end function

global function match_from_to(integer N, integer L, sequence a, sequence b)
          L = match(a,b[N..L])
       if L then return L-1+N
       else return L
end function 


Any one can redefine the standard find() and match() as these
above function just now (ok, after testing and correction)
and use them.

You do know I'm very and too conservative and lazy guy,
so just my $0.02   smile

Regards,
Igor Kachan
kinz at peterlink.ru

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu