Hi Rafael, I recently posted an example of using function types, see:

https://groups.google.com/forum/#!searchin/julia-users/abstract$20functions/julia-users/lGRfDiJDX8E/jmahvLDldAUJ



On Fri, Aug 15, 2014 at 10:23 AM, Rafael Fourquet <[email protected]
> wrote:

> Oh, and by the way functions specialized on values can be emulated, e.g.
>
> type plusN{N}
>     plusN(x) = x+N
> end
> plus{10}(1)
>
> And writing a constrained function can be slightly simpler than in my
> previous post:
>
> # constrained function:
> f{F<:BinaryFunctor}(::Type{F}, x) = F(x, x)
> f(plus, 1)
>
> Or, as a functor:
>
> type f{F<:BinaryFunctor}
>     f(x) = F(x, x)
> end
> f{plus}(1)
>
>  I just hope that someone can assert this is a safe abuse of constructors.
>
>

Reply via email to