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

[REBOL] Re: [refinements] Mutually exclusive refinements

From: greggirwin:mindspring at: 15-Aug-2004 0:15

Hi Ashley, AT> Here's my attempt at handling mutually exclusive refinements AT> without using nested 'either. AT> f: func [/a /b /c /d /e][ AT> print switch/default true compose [ AT> (a) ["A"] AT> (b) ["B"] AT> (c) ["C"] AT> (d) ["D"] AT> (e) ["E"] AT> ]["?"] AT> ] I won't say "better", but another way is: f: func [/a /b /c /d /e][ print any [ all [a b "AB"] all [a "A"] all [b "B"] all [c "C"] all [d "D"] all [e "E"] "?" ] ] Which, as you can see, allows for combinations of refinements that aren't mutually exclusive. I can't think of a case where I've had more than a couple refinements that are mutually exclusive *without* another option that may be combined with them. -- Gregg