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

[REBOL] Re: Refinements

From: joel:neely:fedex at: 14-Nov-2002 9:48

Hi, Jan, RDOIT! (REBOL Does Its Own Thing!) See below... Jan Skibinski wrote:
> Joel, > > > That leads me to wonder about giving each refinement an explicit > > logical value ... > > I have recently come to a similar conclusion, but for a bit > different reason: one cannot do direct logical operations on > refinements... > > I ended up defining the corresponding local logical variables > instead, so I can or- them together if needed...
Although OR is picky about the types of its arguments (for no good reason that I can understand, as IF and EITHER allow NONE to proxy for FALSE), you can use ANY instead as a "generalized OR", and ALL as a "generalized AND" with either LOGIC! or NONE values ... tester: func [/ref0 /ref1] [ print [ "ref0 was" either ref0 ["set"]["absent"] newline "ref1 was" either ref1 ["set"]["absent"] newline either any [ref0 ref1] [ either all [ref0 ref1] [ "both were set" ][ "one was set" ] ][ "neither was set" ] ] ] ... which behaves as ....
>> tester
ref0 was absent ref1 was absent neither was set
>> tester/ref0
ref0 was set ref1 was absent one was set
>> tester/ref1
ref0 was absent ref1 was set one was set
>> tester/ref0/ref1
ref0 was set ref1 was set both were set HTH! -jn- -- ---------------------------------------------------------------------- Joel Neely joelDOTneelyATfedexDOTcom 901-263-4446