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

[REBOL] Re: Rank function using new 'collect function

From: brett:codeconscious at: 31-Jul-2003 16:54

Nice to see it used :^) It looks fairly concise and readable. I wonder how it would compare in terms of speed with a purpose built function. Regards, Brett. ----- Original Message ----- From: "Andrew Martin" <[andrew--martin--colenso--school--nz]> To: <[rebol-list--rebol--com]> Sent: Thursday, July 31, 2003 3:12 PM Subject: [REBOL] Rank function using new 'collect function Rank: function [{Ranks a series of items.} Series [series!] /Reverse Reverse order ] [Place] [ Place: do compose [(either Reverse ['sort/reverse] ['sort]) copy Series] foreach Item Series collect/initial [ index? find/only Place Item ] block! ] An example: Rank [10 12 14 14 16 18] ; == [1 2 3 3 5 6] Andrew J Martin Attendance Officer & Information Systems Trouble Shooter Colenso High School Arnold Street, Napier. Tel: 64-6-8310180 ext 826 Fax: 64-6-8336759 http://colenso.net/scripts/Wiki.r?AJM http://www.colenso.school.nz/ DISCLAIMER: Colenso High School and its Board of Trustees is not responsible (or legally liable) for materials distributed to or acquired from user e-mail accounts. You can report any misuse of an e-mail account to our ICT Manager and the complaint will be investigated. (Misuse can come in many forms, but can be viewed as any material sent/received that indicate or suggest pornography, unethical or illegal solicitation, racism, sexism, inappropriate language and/or other issues described in our Acceptable Use Policy.) All outgoing messages are certified virus-free by McAfee GroupShield Exchange 5.10.285.0 Phone: +64 6 843 5095 or Fax: +64 6 833 6759 or E-mail: [postmaster--colenso--school--nz]