On Wed, Feb 24, 2016 at 8:46 AM, Lars Mescheder <[email protected]> wrote: > Hi, > first thanks for all the amazing work on julia! I am currently trying to > write a very general version of some optimization algorithm. Ideally, it > would take an array of linear maps as input and then perform optimization > depending on those. > So, is it possible to make a function of the form > > function doostuff(Vector{Function} funcs) > .... > end > > fast? > > Since I know the signature of all these function, it would be amazing if > something like the following would be possible > > function doostuff(Vector{Method{InT, OutT}} funcs) > .... > end > > and the compiler could use it to infer types. > > Maybe some metaprogramming magic could do the trick, i.e. I dynamically > generate a function that takes the function index and its arguments as input > and then calls the right function depending on the index? I believe with the > recent changes to julia that make function arguments fast this would result > in a fast function. > Before getting into the details of this approach though, I wanted to make > sure there is no "easy" solution.
Ref https://github.com/JuliaLang/julia/issues/13984 See also my hacked version in the issue. > > Thanks in advance! > Lars
