keyword arguments and anonymous function - ERROR: syntax: "begin args... kwargs... end" is not a valid function argument name

94 views
Skip to first unread message

Femto Trader

unread,
May 31, 2016, 3:26:55 AM5/31/16
to julia-users
Hello,

I'm trying to define an anonymous function


julia> (args...) -> begin
           println("hello anonymous func with args")
       end
(anonymous function)

works correctly

A "classic" with keywords arguments can be define using

julia> function f(args...; kwargs...)
           println("hello classic func with args and kwargs")
       end
f (generic function with 1 method)

But it doesn't work with keyword arguments


julia> (args...; kwargs...) -> begin
           println("hello anonymous func with args and kwargs")
       end
ERROR: syntax: "begin
    args...
    kwargs...
end" is not a valid function argument name


I don't understand if that's an issue or a misunderstanding from my side.

Any idea ?


Kind regards

Mauro

unread,
May 31, 2016, 3:49:38 AM5/31/16
to julia...@googlegroups.com
This works on 0.5, where anonymous functions are almost like normal
functions now.

Femto Trader

unread,
May 31, 2016, 5:20:21 AM5/31/16
to julia-users
How can I update to this version ?
Is it sure enough to do it ?
If 0.5 is not released, when it will be ?

or

doesn't help

Mauro

unread,
May 31, 2016, 5:36:15 AM5/31/16
to julia...@googlegroups.com
> How can I update to this version ?

You can download it (http://julialang.org/downloads/ nightly builds) or
build it yourself. Best to have both 0.4 and 0.5 installed. But note
that 0.5 is in development, i.e. not stable!

> Is it sure enough to do it ?

?

> If 0.5 is not released, when it will be ?

The release date is not known yet, presumably in the next few month.

> https://github.com/JuliaLang/julia/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+roadmap
> or
> https://github.com/JuliaLang/julia/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+0.5
>
> doesn't help
>
>
> Le mardi 31 mai 2016 09:49:38 UTC+2, Mauro a écrit :
>>
>> This works on 0.5, where anonymous functions are almost like normal
>> functions now.
>>
>> On Tue, 2016-05-31 at 09:26, Femto Trader <femto....@gmail.com
Reply all
Reply to author
Forward
0 new messages