[REBOL] best means of passing refinements from main to helper function? Re:(3)
From: jelinem1:nationwide at: 18-Sep-2000 8:35
But then this (the example below) explicitly lists the refinements in the
function body. I think the "ultimate" solution would process an arbitray
list, as with a loop. It is fairly short though :) and IS a step up from
'if statements, esp for more than 2 refinements.
- Michael Jelinek
[jeff--rebol--net] on 09/15/2000 04:04:34 PM
From: [jeff--rebol--net] on 09/15/2000 04:04 PM
Please respond to [list--rebol--com]
To: [list--rebol--com]
cc:
Subject: [REBOL] best means of passing refinements from main to helper
function? Re:(2)
Howdy, Michael:
The following approach is exactly elegant, but it gets the
job done and it's fairly short. I think it's kind of cute.
-jeff
REBOL []
deduction: func [
/use-month month-to-use
/use-day day-to-use
][
rejoin [ "file-"
either use-month [ month-to-use ] [ now/month ]
either use-day [ day-to-use ] [ now/day ]
]
]
main: func [
/use-month month-to-use
/use-day day-to-use
] [
go?: func ['what /it][either it: get what [either true = it [what][it]]
[]]
do reduce compose/deep [to-path [deduction (go? use-month) (go?
use-day)]
(go? month-to-use) (go? day-to-use)]
]