1. find_diff
Here's a routine I've found useful:
function find_diff( object o, sequence s )
for i = 1 to length( s ) do
if equal( s[i], o ) then
return i
end if
end for
return 0
end function
With find(), you can ask if an item is in a list. With find_diff(), you can
ask if something other than an item is in a list. For example:
find_diff( -1, list )
returns the index of the first item in the sequence that isn't -1. This is
NOT the same as:
not find( -1, list )
if the data in the list is not binary. For example, I have a listing of
timings where zero indicates a timer is ready, -1 indicates that it's been
fired, and a positive number indicates that there is time remaining:
{ 0, -1, 23, 33 }
with find_diff, I can ask if there are any timers not in a particular state.
-- David Cuny