|Subject:||Re: Order of Evaluation|
|Date:||Mon, 19 Aug 2019 18:37:41 -0400|
|User-agent:||Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1|
On 8/19/19 2:56 PM, address@hidden wrote:
y = @(x) H = h(x), f(H) + g(H); % also wrong if in brackets
I thought it would work to create a 'fake' compound statement:
y = @(x) if true H = h(x), f(H) + g(H) end;
but this somehow fails, as if the conditional was not evaluated---the function does not return anything.
Given that "if true 123 end" returns 123, and "y = @(x) 123 ;" returns a function returning 123, why does
y = @(x) if true 123 end ;
fail to return anything? (Octave 4.2.2 on Linux)
In any case, https://octave.org/doc/v4.2.0/Anonymous-Functions.html suggests that anonymous functions aren't universally useful and recommends simply using function handles.
|[Prev in Thread]||Current Thread||[Next in Thread]|