On Sat, Feb 05, 2005 at 08:43:10PM +0800, Autrijus Tang wrote:
> On Sat, Feb 05, 2005 at 12:38:57PM +0000, Nicholas Clark wrote:
> > Surely you can do better than that for counterintuitive? :-)
> > 
> > 4 < (0 | 6) < 2
> 
>     pugs> ? 4 < (0 | 6) < 2
>     (#t|#f)
> 
> Why is it so?  Because:
> 
>     4 < (0 | 6)     and (0 | 6) < 2
>     (4 < 0 | 4 < 6) and (0 | 6) < 2     # local autothreading
>     (#f | #t)       and (0 | 6) < 2     # evaluation
>     #t              and (0 | 6) < 2     # reduction in boolean context(!)

Why is it allowed to do this?

>     (0 | 6) < 2                         # short circuitry
>     (0 < 2 | 6 < 2)                     # local autothreading
>     (#t | #f)                           # evaluation
> 
> Sick, eh?

Yes, indeed.

This example would work just as well if the local autothreading were done
first on the right and side of the "and". Is there an example where this
is not the case? I can't think of one.

Nicholas Clark

Reply via email to