I want to define a series of anonymous functions, where each will be a value in a Dict and/or a field value in a composite type. I need to be able to use them for multiple times with different choices of arguments, including keyword arguments. How many of them are defined at runtime depends on the input and is unknown before hand, therefore I thought it'll be convenient to for them to be anonymous.
The methods I've tried do not allow me to define an anonymous function with keyword arguments: julia> VERSION v"0.4.5" julia> function (a1,a2;a3=1) a1+a2+a3*2 end ERROR: syntax: unexpected semicolon in tuple julia> (a1,a2;a3=1) -> a1+a2+a3*2 ERROR: syntax: unexpected semicolon in tuple julia> (a1,a2;a3=1) = a1+a2+a3*2 ERROR: syntax: unexpected semicolon in tuple I can define named functions, but I want it to work on anonymous functions. julia> function g1(a1,a2;a3=1) a1+a2+a3*2 end g1 (generic function with 1 method) julia> g2(a1,a2;a3=1) = a1+a2+a3*2 g2 (generic function with 1 method)