[REBOL] Re: More on expressions
From: sunandadh:aol at: 2-Feb-2003 6:37
Just to demonstrate how sticking to the rules may not lead to an elegant
solution....
The median is the one in the middle -- provided the first one is lower and
the third one is higher. If those conditions aren't true, throw the numbers
in the air and try again:
until [set [a b c] random/secure reduce [a b c] all [a <= b b <= c]] b
There is no explicit "decision" just a termination condition whose precise
timing is indeterminate. No "selection" activity either -- random shuffling
isn't selection.
(We'd of course put this in a func with local variables to stop messing up
the caller's three variables. I'm not entirely unreasonable when it comes to
coding).
:-)
Sunanda.