It will be in Julia 0.4, and you can already overload `call` if you use the 
nightly releases.

In Julia 0.3 you will have to define a function and write call(r,1) in 
order for it to work.

Regards
Ivar

kl. 19:50:31 UTC+1 tirsdag 4. november 2014 skrev Evan Pu følgende:
>
> Hello,
> I want to create a polynomial type, parametrized by its coefficients, able 
> to perform polynomial additions and such.
> but I would also like to use it like a function call, since a polynomial 
> should be just like a function
> Something of the following would be nice:
>
> p = Poly([1,2,3]) # creating a polynomial p(x) = 1 + 2x + 3x^2
> q = Poly([1,2]) # creating a polynomial 1 + 2x
> r = p + q # using dynamic dispatch, creating the polynomial 2 + 4x + 3x^2
>
> r(1) # this should give 9, by evaluating polynomial r at x = 1
>
> Is there something in Julia that would allow me to create what I have in 
> mind?
> thanks!!
>

Reply via email to