I think that design is flawed – you don't want to be adding random methods to user-supplied functions. You could just use a helper function in the definition of bar that applies the foo transformation using a user-supplied anonymous function applied to each scalar.
On Thu, Mar 27, 2014 at 10:26 AM, andreas <[email protected]> wrote: > > Thanks for the fast response! > > However, when I change bar as proposed in the module this gives an error > "No method foo(Array)": > foo(x::Real) = x^2 > > bar(foo, [1:3]) > > > As far I understand passing foo as function argument to bar(f, y) is not > sufficient. The problem is that bar() uses foo(x::Real) and foo(x::Array). > However, foo(x::Array) is defined in the module based on the foo(x::Real). > The user should only provide the later one. >
