Forgive me if I'm oversimplifying, but will closures of the following form work for you?
mod2 = x -> mod(x,2) mod2(3) Or you can even create closure generators: modcreator(m) = x->mod(x,2) mod2 = modcreator(2) mod3 = modcreator(3) ... If you want mutable state, you might prefer something like 'the' let binding technique. There's a few examples of this trick in Base (and on the listserv) that I can never seem to find on demand... Jason On Friday, August 15, 2014 1:21:05 PM UTC-5, Neal Becker wrote: > > I'm trying to do numerical integration. I want a function that has state > information. > > Let's say I'm trying to integrate some function F over x. In addition, F > has > some state > > function F (x, state) = <do something with x and state> > > In python (and in c++), one way is to make F a class (which can have > state), and > overload the function call operator. Then this can be passed to the > numerical > integrator. > > But in julia, we can't overload the function call operator, so I don't > know how > to proceed. Essentially, what we need is to transform the function F by > binding > one of it's arguments. > > What would you suggest here? > >
