Barbara,

Thank you for this info, and the enhancement.  So Joe WAS right, in a sense.

Also interesting that you can't change the existing desirable behavior of
LOOKUP on unsorted arrays, although undocumented.  I assume this is because,
IIRC, the language doesn't verify that the data in arrays is actually in the
sequence specified (except maybe compile-time arrays?).  So, if I
understand, some shops could get a different result if a binary search was
implemented.

(BTW, I tend to agree with Phil, and I try to stay clear of desirable
behavior as much as I can get away with...;-))

jt

| -----Original Message-----
| From: midrange-l-admin@midrange.com
| [mailto:midrange-l-admin@midrange.com]On Behalf Of bmorris@ca.ibm.com
| Sent: Monday, December 03, 2001 1:48 PM
| To: midrange-l@midrange.com
| Subject: RE: array handling
|
|
|
| >From: "jt" <jt@ee.net>
| >Date: Sun, 2 Dec 2001 18:39:53 -0500
| > ...
| >But you said ASCEND causes a binary search...?!?  Sheesh...
| When did THAT
| >happen...?!?  (I'd always thought it still used sequential search, and
| >ASCEND just allowed for *LT or *GT type lookups.)
| >...
|
| jt, LOOKUP indeed still uses a sequential search.  But the new %lookup
| builtin does a binary search for ordered arrays.  %lookup can behave
| this new (new for RPG ...) way because there's no compatability issue.
|
| (LOOKUP can't change to a binary search because of possibly desirable
| behaviour with arrays that are not actually sorted.  We won't change the
| behaviour, whether or not it's documented.)
|
| Barbara Morris
|
| _______________________________________________
| This is the Midrange Systems Technical Discussion (MIDRANGE-L)
| mailing list
| To post a message email: MIDRANGE-L@midrange.com
| To subscribe, unsubscribe, or change list options,
| visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l
| or email: MIDRANGE-L-request@midrange.com
| Before posting, please take a moment to review the archives
| at http://archive.midrange.com/midrange-l.
|



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-2022 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.