develooper Front page | perl.perl6.language | Postings from February 2005

Re: Junctive puzzles.

Thread Previous | Thread Next
From:
Autrijus Tang
Date:
February 5, 2005 04:43
Subject:
Re: Junctive puzzles.
Message ID:
20050205124310.GA68789@aut.dyndns.org
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(!)
    (0 | 6) < 2                         # short circuitry
    (0 < 2 | 6 < 2)                     # local autothreading
    (#t | #f)                           # evaluation

Sick, eh?

Thanks,
/Autrijus/


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About