Why is recursion so slow?
Nick Craig-Wood
nick at craig-wood.com
Wed Jul 2 08:32:58 EDT 2008
Rich Harkins <rharkins at nettrekker.com> wrote:
> Nick Craig-Wood wrote:
> [snip]
> > By definition any function in a functional language will
> > always produce the same result if given the same arguments, so you can
> > memoize any function.
> >
>
> Ah, so that's why time.time() seems to be stuck... ;)
;-)
As Bruno noted I should have said "pure functional language" above.
As for how you deal with IO in a pure functional language, well,
either you make it impure (eg Erlang or Lisp) - functions can have
side effects, or you do other complicated things like monads in
Haskell!
--
Nick Craig-Wood <nick at craig-wood.com> -- http://www.craig-wood.com/nick
More information about the Python-list
mailing list