Possible idea for a new built-in in Eu 2.4
Hi the list!
I often wind up with having to search for a key at a fixed place in a
sequence of sequences. The following obviously does the job:
<code>
function ffind(object key,integer field,sequence target)
--scans the field-th elements of target for key
--returns index of first record with matching entry or 0 if none found
for i=1 to length(target) do
if target[i][field]=key then return i end if
end for
--not found in this "column"
return 0
end function
</code>
But it may be slow if target is large enough, and I suspect that,
internally, there could be a way to do something like
<notional code>
function ffind(object key,integer field,sequence target)
--same purpose, args and returns as above
return find(key,target[..][field])
end function
</notional code>
Would the built-in be significantly faster? And is there a chance that
it appears in Eu 2.4?
CChris
|
Not Categorized, Please Help
|
|