Re: find_all() And More

new topic     » goto parent     » topic index » view thread      » older message » newer message
mattlewis said...

I'd try something like this:

Here's a tweak to Matt's code ...

constant a = { 0, 1, 2, 3, 0 }  
 
function find_all_but( object needle, sequence haystack ) 
	integer ix = 1 
	integer jx 
        integer kx = 0 
	while jx with entry do 
		for i = ix to jx - 1 do 
                        kx += 1 
			haystack[kx] = i 
		end for 
		ix = jx + 1 
	entry 
		jx = find( needle, haystack, ix ) 
	end while 
         
	for i = ix to length(haystack) do 
                kx += 1 
		haystack[kx] = i 
	end for 
	return haystack[1 .. kx] 
end function 
 
? find_all_but( 0, a ) 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu