Re: findany_from()
- Posted by Shawn Pringle <shawn.pringle at gmail.c??> Apr 26, 2008
- 586 views
The use of magic numbers like this makes me uncomforatable. In ten years we will be wondering what a program doesn't work when sequences get to be more than a billion atoms long. Well, probably it will never be a problem but why not use length(haystack)+1 instead of 1e9?
global function findany_from2(sequence needles, sequence haystack, integer start) integer index,result if start > length(haystack) then return 0 end if result=length(haystack)+1 for i=1 to length(needles) do index=find_from(needles[i],haystack,start) if index and index<result then result=index end if end for return remainder( result, length(haystack)+1 ) end function