Re: [julia-users] Save state in a function

2015-02-04 Thread Mauro
I don't know why the word functor was originally used in Julia for function-like type, but it doesn't seem to have anything to do with the functional programming / haskell / category theory functor (or any particular relevance to monads). Might be a good idea to use a different term since it

Re: [julia-users] Save state in a function

2015-02-04 Thread Erik Schnetter
On Feb 4, 2015, at 11:04 , Mike Innes mike.j.in...@gmail.com wrote: I don't know why the word functor was originally used in Julia for function-like type, but it doesn't seem to have anything to do with the functional programming / haskell / category theory functor (or any particular

Re: [julia-users] Save state in a function

2015-02-04 Thread Mike Innes
I don't know why the word functor was originally used in Julia for function-like type, but it doesn't seem to have anything to do with the functional programming / haskell / category theory functor (or any particular relevance to monads). Might be a good idea to use a different term since it

Re: [julia-users] Save state in a function

2015-02-04 Thread Matt Bauman
The idiom that seems to be used most commonly in Base is a closure around a variable hidden in a let scope. Note that your function must be declared global. See base/combinatorics.jl:L361-L380

Re: [julia-users] Save state in a function

2015-02-03 Thread Erik Schnetter
On Feb 3, 2015, at 20:30 , Erik Schnetter schnet...@gmail.com wrote: On Feb 3, 2015, at 20:22 , Peter Simon psimon0...@gmail.com wrote: Thanks, I will take a look at functors when I upgrade to 0.4. I didn't see this before. Here's another approach, without objects; it's functional and very

[julia-users] Save state in a function

2015-02-03 Thread Peter Simon
I saw a suggestion from Miles Lubin in https://groups.google.com/forum/#!topic/julia-opt/z8Ld4-kdvCI for avoiding redundant calculations that appeared to involve saving state between function calls, and I wonder what is the standard Julian way to do this. I'm asking here because this seems to