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

[REBOL] Re: Algorithm challenge: compacting intege...

From: D:Weyand:gmx at: 29-Jan-2007 8:55

Here´s an improved version of my compact-code for challenge-1: compact: func [ blk [block!] /local rc b x val ][ rc: make list! blk loop length? rc [ either tail? b: next rc [ break ][ x: val: first rc all [while [(val: val + 1) = pick b 1] [b: remove b] change rc add x * 1x0 val - x * 0x1] ] rc: next rc ] to block! head rc ] ---- Dirk Weyand http://www.TGD-Consulting.de/Download.html#list -- Feel free - 5 GB Mailbox, 50 FreeSMS/Monat ... Jetzt GMX ProMail testen: http://www.gmx.net/de/go/promail