(48/49/50) LSORT v0.6b
|
01-25-2018, 09:19 PM
(This post was last modified: 02-16-2018 02:46 PM by Werner.)
Post: #1
|
|||
|
|||
(48/49/50) LSORT v0.6b
[Edit:] Changed to LSORT v0.6b
LSORT behaves exactly like the built-in SORT, except that it doesn't accept units, and it is many times faster. Some things you may not realise SORT, and LSORT, do: - no error for an empty list (contrary to DOLIST, for instance) - no type checking for a list of 1 element -> e.g. you can sort { \<< \>> } - Tagged objects will be sorted according to value, not tags, of course -> { A:3 1 B2:C3:2 } (L)SORT -> { 1 B2:C3:2 A:3 } - Included objects vs. ROM objects { 3. 1. 2. } is 12.5 bytes, while { 3.3 1.1 2.2 } is 36.5 bytes. That is because 1., 2. and 3. reside in ROM, and the list entries merely point at those rather than including them. So any self-respecting SORT routine must be able to handle both included objects and referenced ones. In SysRPL that makes no difference, but in ASM it surely does. - List of lists When the elements of a list are themselves lists, (L)SORT will sort them by the first object of each list element. { {3} {1 [1]} {2 "A"} } -> { {1 [1]} {2 "A"} {3} } You may even have a list of lists of lists etc... - stable sort: elements having the same value will be kept in the same order (this will only be apparent for lists of lists) {{2 "A"}{3}{2 "B"}{1}} -> {{1}{2 "A"}{2 "B"}{3}} This version corrects a few bugs that were present in v0.4, and adds support for binary integers, respecting wordsize. The zip file in annex contains compiled versions for the 48 and 49/50. (The 50 file should work in all versions of the 49 and 50) Cheers, Werner 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)