>
> What you're suggesting is memoization, which has come up a number of
> times. The short version is that it is an easy way to speed up a slow
> language but is worse than useless in fast languages. You don't see people
> doing memoization in C or Fortran, do you?
>

That's a little, um, strong, don't you think?  Certainly it's not common,
but probably not "worse than useless".  ;-)  (The lack of a standard
map/dictionary/hash table in these languages probably contributes as well.)

A couple of examples in Julia where it's useful (and would be just as
useful in C or Fortran):

https://github.com/JuliaLang/julia/blob/master/base/combinatorics.jl#L304-L321
https://github.com/JuliaLang/julia/blob/master/base/combinatorics.jl#L368-L379

(Those should probably be wrapped in let statements.  I'll do that.)

These are not common functions, of course, but memoization here is
definitely useful.

Cheers!
   Kevin

Reply via email to