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

[REBOL] Re: [refinements] Mutually exclusive refinements

From: carl:cybercraft at: 15-Aug-2004 14:45

my attempt at handling mutually exclusive refinements without usin
>g >nested 'either. > >f: func [/a /b /c /d /e][ > print switch/default true compose [ > (a) ["A"] > (b) ["B"] > (c) ["C"] > (d) ["D"] > (e) ["E"] > ]["?"] >] > >Anyone come across a better way?
This is possibly marginally better, perhaps... f: func [/a /b /c /d /e][ print select reduce [ a ["A"] b ["B"] c ["C"] d ["D"] e ["E"] true ["?"] ] true ]
>> f
?
>> f/a
A
>> f/c
C
>> f/c/a
A -- Carl Read