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

[REBOL] Re: Looking for advice

From: dockimbel:free at: 18-Jan-2003 20:28

Hi Patrick, Here's a possible solution using 'parse : validate: func [blk /local out div int op][ out: make block! length? blk div: to-lit-word "/" parse blk [ to integer! set int integer! (insert out int) some [ set op ['+ | '- | div | '*] to integer! set int integer! (repend out [op int]) | skip ] ] out ]
>> validate [3 none 1 + 9 4 + 1 -]
== [3 + 9 + 1]
>> validate [0 4 0 + 0 none none 2 /]
== [0 + 0]
>> validate [none / 8 1 7 none 0 * 5]
== [8 * 5]
>> validate [7 1 9 3 4 9 none - none]
== [7]
>> validate [2 3 - 7 + none 0 / none]
== [2 - 7 + 0] HTH, -DocKimbel A la poste wrote: