> I think, Barbara has answered my question. I had defined array as Ascend
> but did not sort it. But then shouldn't %Lookup search for the element in
> complete array? Or because of its binary search it does not do so?

How would the compiler know whether the array is sorted, unless you tell
it?  When you code ASCEND on the D-spec, you're telling the compiler "hey,
compiler!  This array is sorted in ascending sequence!"

And the compiler, trusting that you're telling it the truth, uses a
binary search because it's much faster than a normal sequential search.

Since the data isn't sorted, you should remove "ASCEND" from the D-spec.
That way, the %lookup() BIF will work properly.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.