× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Jon Paris wrote:
One other comment on this topic.  If you have duplicate keys in the MODS (or
array for that matter) that you are sorting - there is no guarantee as to
what sequence they will be in.  Similarly if bsearch is used to locate an
item in a set with duplicates, there is no guarantee that you will locate
the first match in the list.  You have to "walk" backwards up the list to
find the first occurrence if it is important to do so.

Wonder if %LOOKUP comes up with the first one?  or just the first hit?  Hans
?  Barbara ?
Huh, uh, wha? (Sorry, I haven't been paying much attention to this
discussion, and it's still early.)

%LOOKUP seems to be a favorite topic these days. As I mentioned in
previous notes, %LOOKUP (like opcode LOOKUP) performs a sequential
search for unordered arrays. Thus, it works just like the opcode.

For ordered arrays, it assumes the programmer keeps his promise that
the data is in the proper order, and then performs a binary search.
But it doesn't just stop at the first match found. In order to match
the semantics of LOOKUP, the algorithm then walks up or down through
the matching elements to locate the appropriate target. For example,
in a %LOOKUPLT() operation, once a match is found, the built-in then
walks up the array to find the element closest to, but just below,
the search target.

Cheers!  Hans





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.