See the discussion @ https://github.com/JuliaLang/julia/issues/1864 for the trade-offs of this approach.
On Thursday, September 4, 2014 11:34:44 AM UTC-4, Job van der Zwan wrote: > > Cool. > > So as someone who doesn't use anonymous functions enough to understand the > fine details: is this a stopgap solution, or a "won't be part of base > because it makes a certain trade-off"-solution? > > On Thursday, 4 September 2014 00:29:31 UTC+2, Tim Holy wrote: >> >> I'm pleased to announce the availability of the FastAnonymous package: >> https://github.com/timholy/FastAnonymous.jl >> >> Those of you who have used Julia for a while may know that things such as >> map(myfunction, collection) >> do not have ideal performance, and particularly the anonymous-function >> version >> map(x->x^2, collection) >> is quite slow. FastAnonymous provides a simple mechanism for getting >> inlined >> performance for arbitrary functions, even those that require additional >> parameters. Please see the README for details. >> >> In this context it's also worth reminding folks of the existence of >> Dahua's >> excellent NumericFuns, which provides partially-overlapping functionality >> with >> a different API. >> >> Best, >> --Tim >> >>
