Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Sort by first part of line

From: joel:neely:fedex at: 7-Sep-2002 10:00

Hi, Sunanda, [SunandaDH--aol--com] wrote:
> Though I'm not sure I'd recommend your method to Louis unless > he's absolutely certain that that first field is: > a) always an integer -- not a character string or a decimal > b) never has a plus sign > c) is never zero > d) is never negative > e) is never greater than 999 > f) always has leading zeroes to make it 3 digits long > g) is always in base 10 or below > > Those sorts of assumptions are hostages to fortune, and are > only worth it if the performance gain is utterly unliveable > without. >
Completely valid concerns; I thought the data bore a strong resemblance to the desired output described in another thread about parsing words out of a long chunk of text, so I assumed that Louis was actually creating the original "unsorted" data himself. Clearly the production use of an approach like the one I posted would require that the interface and assumptions be precisely documented, so that any change upstream could be checked against the requirements of the downstream code. -jn- -- ; Joel Neely joeldotneelyatfedexdotcom REBOL [] do [ do func [s] [ foreach [a b] s [prin b] ] sort/skip do function [s] [t] [ t: "" foreach [a b] s [repend t [b a]] t ] { | e s m!zauafBpcvekexEohthjJakwLrngohOqrlryRnsctdtiub} 2 ]