[REBOL] Newbie question about func refinements
From: edoconnor:gm:ail at: 13-Aug-2008 16:14
I'm sure this has been covered elsewhere, but I couldn't find it. Given a
function, such as:
sum: func ["Return the sum of two numbers."
arg1 [number!] "first number"
arg2 [number!] "second number"
/avg "return the average of two numbers"
/sub "subtracts the first from the second"
/div "divides the first into the second"
][
switch/default self/refinement [
avg [arg1 + arg2 / 2]
sub [arg1 - arg2]
div [arg1 / arg2]
][arg1 + arg2]
]
Is there a way to dynamically obtain a refinement value so I can use it in a
switch statement?
In the example above, the pseudo-code expression "self/refinement" is what
I'm looking for.
Odd that I've never encountered this over the years. I'm sure someone here
can set me straight on it.
Thanks,
Ed