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

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

[Octave-bug-tracker] [bug #64783] Default number of output arguments not


From: Fernando
Subject: [Octave-bug-tracker] [bug #64783] Default number of output arguments not 1 for anonymous functions
Date: Tue, 17 Oct 2023 07:20:20 -0400 (EDT)

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

                 Summary: Default number of output arguments not 1 for
anonymous functions
                   Group: GNU Octave
               Submitter: tutissanalio
               Submitted: mar 17 oct 2023 11:20:18
                Category: Interpreter
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: dev
         Discussion Lock: Any
        Operating System: Any
           Fixed Release: None
         Planned Release: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: mar 17 oct 2023 11:20:18       By: Fernando <tutissanalio>
In octave (I tried with default, stable and ver 6.4.0), anonymous functions
return multiple output arguments in contexts where normal m-functions return
only one:

octave:1> a=struct('re',{1,2},'im',{3,4});
octave:2> a.re
ans = 1
ans = 2
octave:3> f=@(a)a.re;
octave:4> f(a)
ans = 1
ans = 2
octave:5> [f(a)]
ans =
   1   2


This is incompatible with Matlab. In Matlab:

>> a=struct('re',{1,2},'im',{3,4})
a = 
  1×2 struct array with fields:
    re
    im
>> f=@(a)a.re
f =
  function_handle with value:
    @(a)a.re
>> f(a)
ans =
     1
>> [f(a)]
ans =
     1









    _______________________________________________________

Reply to this item at:

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

_______________________________________________
Mensaje enviado vía Savannah
https://savannah.gnu.org/




reply via email to

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