[REBOL] Re: Sort by first part of line
From: greggirwin:mindspring at: 6-Sep-2002 11:53
Scott, et al
OK, I didn't think much before, so here's another whack that preps the data
before sorting. Prep time is included in timings.
t: now/time/precise
data: make block! 2 * length? raw-data: read/lines %data-1.txt
foreach item raw-data [
append data reduce [to integer! first parse item none item]
]
compare-items: func [a b /local aa bb] [
either a < b [-1][either a > b [1][0]]
]
sort/skip/compare data 2 :compare-items
data: extract next data 2
print now/time/precise - t
halt
And the results:
1. 0:00:02.964
2. 0:00:02.974
3. 0:00:02.974
--Gregg