octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #59521] 'end' expression and anonymous functio


From: Rik
Subject: [Octave-bug-tracker] [bug #59521] 'end' expression and anonymous functions
Date: Mon, 23 Nov 2020 20:46:38 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36

Update of bug #59521 (project octave):

              Item Group:        Incorrect Result => Matlab Compatibility   
                  Status:                    None => Works For Me           
             Open/Closed:                    Open => Closed                 

    _______________________________________________________

Follow-up Comment #1:

Regardless of expectations, Matlab returns 4 for the sample code.  Since
Octave desires to be Matlab-compatible, we also need to return 4.

The issue is that the anonymous function is not a transparent passthrough of
the input to the output.


f = @(x) x;


It looks like a passthrough for ordinary values like 1.1 or "string".  But it
is not, or you could write a while loop like this: 


f(while i < 5)
  i++;
endwhile


In this case, while the interpreter doesn't throw an error, "f(end)" always
returns the value 1.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?59521>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]