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: anonymous
Subject: [Octave-bug-tracker] [bug #59521] 'end' expression and anonymous functions
Date: Mon, 23 Nov 2020 13:59:25 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:68.9) Gecko/20100101 Goanna/4.6 Firefox/68.9 Mypal/28.14.2

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

                 Summary: 'end' expression and anonymous functions
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Mon 23 Nov 2020 06:59:23 PM UTC
                Category: Interpreter
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: 6.0.92
         Discussion Lock: Any
        Operating System: Any

    _______________________________________________________

Details:

In version 6.0.92 it is possible to pass 'end' as an argument to an anonymous
function:


f = @(x)x;
f(end)


It seems that 'f' is treated as one element array and 'end' in this case
returns 1. In Octave 5.2.0 it results in error.

Another example:


a = [4 5 6];
f = @(x)x;
a(f(end))


I think it should return 6 but it returns 4.




    _______________________________________________________

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]