marianoguerra / efene

OFICIAL REPO IS AT https://github.com/efene/efene
https://github.com/efene/efene
Other
145 stars 32 forks source link

Ifene lambda-style function doesn't parse when final argument #46

Closed DavidMikeSimon closed 12 years ago

DavidMikeSimon commented 12 years ago

In Ifene, I can use indentation to specify the bounds of an anonymous function, like this:

  L = lists.map(fn(V)
    V*3
  , [1,2,3,4])

However, I get a syntax error if I try to do this for the last argument of a function, as when using the Efene lst module:

  L = lst.map([1,2,3,4], fn(V)
    V*3
  )

Strangely, the equivalent Efene code does work; it's only in Ifene that the problem occurs.

marianoguerra commented 12 years ago

fixed

https://github.com/marianoguerra/efene/commit/1f44d4b8d507f9c995e5c94b02537ab483be36e9

    mariano@ganesha:~$ fnc testt.ifn                                       
    Compiling testt.ifn                                                    
    .:4: Warning: variable 'L' is unused                                   
    mariano@ganesha:~$ fnc -t fn testt.ifn                                                                                                                                                                                               
    @public                                                                
    run = fn () {                                                          
        L = lst.map( [1, 2, 3, 4], fn (V) {                                
            V * 3                                                          
        } )                                                                
    }                                                                      

    mariano@ganesha:~$ cat testt.ifn                                       

    @public                                                                
    run = fn ()                                                            
        L = lst.map([1,2,3,4], fn(V)                                       
            V * 3                                                          
        ) 

thanks!