Post Reply 
(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


Attached File(s)
.zip  LSORT v0r6b.zip (Size: 38 KB / Downloads: 12)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(48/49/50) LSORT v0.6b - Werner - 01-25-2018 09:19 PM
RE: (48/49/50) LSORT v0.6a - pier4r - 01-25-2018, 09:32 PM
RE: (48/49/50) LSORT v0.6a - Eric Rechlin - 01-25-2018, 10:26 PM
RE: (48/49/50) LSORT v0.6a - pier4r - 01-26-2018, 08:11 PM
RE: (48/49/50) LSORT v0.6a - Eric Rechlin - 01-26-2018, 10:21 PM
RE: (48/49/50) LSORT v0.6a - Werner - 01-26-2018, 06:34 AM
RE: (48/49/50) LSORT v0.6a - Gerald H - 01-26-2018, 03:22 PM
RE: (48/49/50) LSORT v0.6a - Werner - 01-26-2018, 04:09 PM
RE: (48/49/50) LSORT v0.6a - Eric Rechlin - 01-26-2018, 04:17 PM
RE: (48/49/50) LSORT v0.6a - Werner - 01-26-2018, 04:35 PM
RE: (48/49/50) LSORT v0.6a - Gerald H - 01-27-2018, 06:44 AM
RE: (48/49/50) LSORT v0.6a - Werner - 01-27-2018, 10:09 AM
RE: (48/49/50) LSORT v0.6a - pier4r - 01-27-2018, 01:12 PM
RE: (48/49/50) LSORT v0.6a - John Keith - 02-01-2018, 08:23 PM
RE: (48/49/50) LSORT v0.6a - Werner - 02-02-2018, 08:01 AM
RE: (48/49/50) LSORT v0.6b - John Keith - 02-16-2018, 08:29 PM
RE: (48/49/50) LSORT v0.6a - Gerald H - 02-02-2018, 08:28 AM
RE: (48/49/50) LSORT v0.6b - Werner - 02-16-2018, 02:52 PM
RE: (48/49/50) LSORT v0.6b - DavidM - 02-16-2018, 03:42 PM
RE: (48/49/50) LSORT v0.6b - Gerald H - 02-16-2018, 04:56 PM



User(s) browsing this thread: 1 Guest(s)