[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Ternary operator patch
- From: Martin Voigt <voigt.m@...>
- Date: Tue, 14 Sep 2010 19:21:19 +0200
> Since Lua is an applicative language both branches would be evaluated.
Whenever that becomes an issue i usually wrap the branches in quotes
and evaluate them in the function depending on the condition.
Martin
On 14 September 2010 18:53, Alex Queiroz <asandroq@gmail.com> wrote:
> Hallo,
>
> On Tue, Sep 14, 2010 at 1:47 PM, Martin Voigt <voigt.m@googlemail.com> wrote:
>> Maybe I'm missing something. What's wrong with using a function for
>> the ternary use case?
>>
>> local value = ternary(condition, value_if_true, value_if_false)
>>
>
> Since Lua is an applicative language both branches would be evaluated.
>
> --
> -alex
> http://www.artisancoder.com/
>
>
- References:
- Re: Ternary operator patch, Henk Boom
- Re: Ternary operator patch, steve donovan
- Re: Ternary operator patch, Geoff Leyland
- Re: Ternary operator patch, steve donovan
- Re: Ternary operator patch, Miles Bader
- Re: Ternary operator patch, David Kastrup
- Re: Ternary operator patch, Miles Bader
- Re: Ternary operator patch, David Kastrup
- Re: Ternary operator patch, Jonathan Castello
- Re: Ternary operator patch, Roberto Ierusalimschy
- Re: Ternary operator patch, Enrico Tassi
- Re: Ternary operator patch, Doug Rogers
- Re: Ternary operator patch, Ryota Hirose
- Re: Ternary operator patch, Ryota Hirose
- Re: Ternary operator patch, David Kastrup
- Re: Ternary operator patch, Miles Bader
- Re: Ternary operator patch, David Kastrup
- Re: Ternary operator patch, Mark Hamburg
- Re: Ternary operator patch, Martin Voigt
- Re: Ternary operator patch, Alex Queiroz