[REBOL] Is there a shorter way to pass refinements? Re:(2)

2000-03-13 Thread VoToNi

In einer eMail vom 12.03.00 08:09:17 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:

Thanks. I needed a simple path! The way i can't find :-). I try to understand 
it. 

Volker

<< Volker asked:
 > Is there a shorter way to pass refinements?
 > 
 > for example
 > a: func[  /header][]
 > b: func[ /header][ either header [ a/header ][ a ]]
 
 Yes. For example:
 
 SNA_switch: function [
  "Selects a choice and evaluates what follows it."
  value "Value to search for."
  cases [block!] "Block of cases to search."
  /case "Value is case-sensitive."
  /only "Treats a series value as a single value."
  /any "Enables the * and ? wildcards."
  /default Default_Case "Default case if no others are found."
  ][
  Refined_Select
  ][
  Refined_Select: to path! 'select
  if case [head insert tail :Refined_Select 'case]
  if only [head insert tail :Refined_Select 'only]
  if any [head insert tail :Refined_Select 'any]
  either found? value: Refined_Select cases value [
   do value
   ][
   either default [
do Default_Case
][
none
]
   ]
  ]
 
 I hope that helps.
 
 Andrew Martin
 I >>


Volker



[REBOL] Is there a shorter way to pass refinements? Re:

2000-03-11 Thread Al . Bri

Volker asked:
> Is there a shorter way to pass refinements?
> 
> for example
> a: func[  /header][]
> b: func[ /header][ either header [ a/header ][ a ]]

Yes. For example:

SNA_switch: function [
 "Selects a choice and evaluates what follows it."
 value "Value to search for."
 cases [block!] "Block of cases to search."
 /case "Value is case-sensitive."
 /only "Treats a series value as a single value."
 /any "Enables the * and ? wildcards."
 /default Default_Case "Default case if no others are found."
 ][
 Refined_Select
 ][
 Refined_Select: to path! 'select
 if case [head insert tail :Refined_Select 'case]
 if only [head insert tail :Refined_Select 'only]
 if any [head insert tail :Refined_Select 'any]
 either found? value: Refined_Select cases value [
  do value
  ][
  either default [
   do Default_Case
   ][
   none
   ]
  ]
 ]

I hope that helps.

Andrew Martin
ICQ: 26227169
http://members.xoom.com/AndrewMartin/
-><-