bugGNU Octave - Bugs: bug #40965, curly braces confuses parsing of...

 
 

bug #40965: curly braces confuses parsing of anonymous function

Submitter:  Felipe G. Nievinski <fgnievinski>
Submitted:  Thu 19 Dec 2013 04:22:05 AM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 19 Dec 2013 01:01:23 PM UTC, comment #4: 

Confirmed that this did not work in 3.6.4 but does work in 3.8.0-rc1, marking as fixed.

Mike Miller <mtmiller>
Group Member
Thu 19 Dec 2013 12:16:56 PM UTC, comment #3: 

now it seems I tested that on 3.6.4 (not dev as I said originally), downloaded from sourceforge.

Felipe G. Nievinski <fgnievinski>
Thu 19 Dec 2013 07:13:15 AM UTC, comment #2: 

in between curly or square braces,
spaces are interpreted as element separators, for example:


>> {1 2 3}
ans =
{
  [1,1] =  1
  [1,2] =  2
  [1,3] =  3
}
>> >> {1, 2, 3}
ans =
{
  [1,1] =  1
  [1,2] =  2
  [1,3] =  3
}


therefore sometimes using spaces in that context confuses the parser, you should try defining the function handle without spaces.

In this particular case, though, I cannot seem to reproduce the behaviour you mention:


>> version
ans = 3.8.0-rc1
>> a =  {@(x) sin (x)}
a =
{
  [1,1] =

@(x) sin (x)

}
>> a{1}(1)
ans =  0.84147
>>


What version of Octave exactly are you using? where did you get it from?

c.

Carlo de Falco <cdf>
Group Member
Thu 19 Dec 2013 04:23:29 AM UTC, comment #1: 

although that doesn't work in matlab either... hum.

Felipe G. Nievinski <fgnievinski>
Thu 19 Dec 2013 04:22:05 AM UTC, original submission:  

octave:> {@(x) sin (x)}
error: 'x' undefined near line 121 column 13
error: evaluating argument list element number 2

{@(x) sin (x)} doesn't work
{@(x) sin(x)} works
@(x) sin (x) works
(and {@sin} works, sure, but that's not the point)

Felipe G. Nievinski <fgnievinski>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by cdf (Posted a comment)
  • -email is unavailable- added by fgnievinski (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-12-19 mtmiller StatusWorks For Me Fixed
        Open/ClosedOpen Closed
        Operating SystemMicrosoft Windows Any
    2013-12-19 cdf StatusNone Works For Me

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code