maanantai 13. kesäkuuta 2016 4.53.14 UTC+3 Xiaoqing Rong-Mullins kirjoitti:
>
> The methods I've tried do not allow me to define an anonymous function 
> with keyword arguments:
>
> julia> VERSION
> v"0.4.5"
>
>
The following trick seems to work. I think this is called eta-expansion (in 
lambda calculus).

julia> (function () function g1(a1,a2;a3=1) a1+a2+a3*2 end end)()(1,1)
4

julia> (function () function g1(a1,a2;a3=1) a1+a2+a3*2 end end)()(1,1; a3 = 
0)
2

julia> (function () function g1(a1,a2;a3=1) a1+a2+a3*2 end end)()(1,1; a3 = 
2)
6

 

Reply via email to