[Python-Dev] Re: ternary operators (fwd)

gvwilson@nevex.com gvwilson@nevex.com
Mon, 31 Jan 2000 23:00:56 -0500 (EST)


So I asked Simon Peyton-Jones and Phil Wadler how languages other than C
and its derivatives did conditional expressions; one of the replies was:

On Mon, 31 Jan 2000, Philip Wadler wrote:

> Tony Hoare had a nice ternary `if'.  He writes
>
> 	if c then d else e
>
> as
> 
> 	d <c> e
> 
> This satisfies an associative law:
> 
> 	d <c> (e <c> f)  =  d <c> f  =  (d <c> e) <c> f
> 
> The paper appeared, I think, in CACM circa 1982.

Perhaps this would be a good time to ask around and see what else people
have in their back pockets?

A-week-of-coding-can-sometimes-save-an-hour-in-the-library'ly yours,

Greg