And since no one has mentioned it yet, MERGE.LIST takes advantage of Universe's built-in (a.k.a "C") sorting ability.

   SUBROUTINE SORT.ITEM(ITEM)
   WRITELIST ITEM ON "MYLIST"
   STMT = ""
   STMT<-1> = "GET.LIST MYLIST"
   STMT<-1> = "MERGE.LIST 0 UNION 0"
   STMT<-1> = "SAVE.LIST MYLIST"
   READLIST ITEM FROM "MYLIST" ELSE ABORTM "IMPOSSIBLE!"
   DELETELIST "MYLIST"
   RETURN
END

Of course, this still adds the i/o overhead of reading and writing, but is still faster than LOCATE's on 1000+ element items.

"[Another] aspect is that a lot dynamic arrays in programs do more than
just hold keys..." which is why I wrote ROW2COL and QUICKSORT as complimentary subroutines (both on PickWiki). ROW2COL will flip associated multivalues "sideways" so QUICKSORT can sort and subsort on values in the corresponding "rows"; then I use ROW2COL to flip them back. Ideally, Universe should provide similar built-in functionality.

rex
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to