PS: Here is a simple working example based on the above:

julia> function g(a,b)
       x -> 3*a*b*x
       end
g (generic function with 1 method)

julia> y(x) = g(1,2)(x) + g(2,3)(x)
y (generic function with 1 method)

julia> y(1)
24

julia> y(2)
48


On Sunday, September 20, 2015 at 7:40:48 AM UTC+8, Eric Forgy wrote:
>
> Maybe you’re looking to define a new function y (assuming a1, a2, b1, and 
>> b2 have already been defined): 
>>
>> y(x) = g(a1, b1)(x) + g(a2, b2)(x) 
>>
>> ? 
>>
>
> I had to try it. The fact this works is very cool. Thanks!
>
> Any performance concerns when doing things like this? 
>

Reply via email to