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

[REBOL] Re: To do or not to do?

From: al::bri::xtra::co::nz at: 29-Nov-2001 20:41

Colin wrote:
> Rules: [ > "(Length? to-string *) > 0" "No data" > "date? *" "Bad date" > "(* - 14 ) < now/date" "Too old" > "specialcheck * " "Not special" > ]
Better would be: Rules: [ [(Length? to-string Value) > 0] "No data" [date? Value] "Bad date" [(Value - 14) < now/date] "Too old" [specialcheck Value] "Not special" ] And then instead of:
> foreach [rule message] Rules [ > if not (do replace/all copy rule "*" mold LoadedValue) [ > print [LoadedValue " fails rule: " Message] > break > ] ; if > ] ; for
try something like: foreach [Rule Message] Rules [ Value: LoadedValue if not do bind Rule 'Value [ print [Value "fails rule:" Message] break ] ] This way you avoid Rebol having to repeatedly parse the string. Instead you work directly with Rebol values, and avoid having to use special syntax in your rules. I hope that helps! Andrew Martin Who wishes Rebol could play DVD movies... ICQ: 26227169 http://valley.150m.com/