> On Jan 14, 2014, at 18:41, Ivar Nesje <[email protected]> wrote:
> 
> You can write them in a module namespace, or use a macro to do the trick with 
> gensym. See: 
> https://groups.google.com/forum/?fromgroups=#!topic/julia-users/NZGMP-oa4T0
> 
> This is cheating, because you are no longer using anonymous functions, but 
> they do not have a name (that you can use or see), and is referenced by a 
> variable.
> 
> kl. 12:17:54 UTC+1 tirsdag 14. januar 2014 skrev Avik Sengupta følgende:
>> 
>> You cannot create multiple methods for anonymous functions. Multiple 
>> dispatch happens by name, and anonymous functions, by definition, have no 
>> name. 
>> 
>> Regards
>> -
>> Avik
>> 
>>> On Tuesday, 14 January 2014 11:01:00 UTC, Brian Nguyen wrote:
>>> How to write anonymous functions with multiple methods?
You can do this:
f=(function()
    f(x::Type1)=Method1
    f(x::Type2)=Method2
    f(x::Type3)=Method3
    return f
 end)()

Reply via email to