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

[REBOL] Re: More on expressions

From: sunandadh:aol at: 2-Feb-2003 10:15

Joel, Spoiler on Joel's solution below: . .. ... ..... ...... ..... .... ... .. .
> set [a b] reduce [a min b a max b] > set [b c] reduce [b min c b max c] > set [a b] reduce [a min b a max c]
Just to be picky myself here for a few lines, a min b is not valid Rebol -- you mean min a b. That makes your first step: set [a b] reduce [min a b max a b] set [b c] reduce [min b c max b c] set [a b] reduce [min a b max a b] Which clearly does make b the median value. Your subsequent simplifications confused me, perhaps because of the wrong syntax -- but is seems to me that you need to do at least one swap to make the thing work. My attempted reformulation of your final result doesn't work: max (min a b) (min (max a b) c) But I may have missed a step there somewhere. Try again!? Sunanda