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

[REBOL] Re: sort/compare

From: sunandadh::aol::com at: 7-Nov-2002 15:12

Phillipe
> I try to sort a series of blocks on the second element of the block which > represents the age of individuals.
It fails because the block contains the two words: [Damien Fabien] not the two block to which they refer: [ [ "Damien" 20 ] ["Fabien" 1] ] So you are one level in indirection out. Try this: person: make block! [ name age ] damien: make person [ "Damien" 20 ] fabien: make person [ "Fabien" 1 ] list-of-person: [ Damien Fabien ] age-comp: func [ a b ] [ (second get :a) < (second get :b) ] sort/compare list-of-person :age-comp Sunanda.