On Fri, May 15, 2009 at 10:33 AM, Raul Miller <[email protected]> wrote:

> On Fri, May 15, 2009 at 12:10 PM, gary ng <[email protected]> wrote:
> > I can get fib 150000 before I run out of memory as Haskell now supports
> big
> > integer just like Python. A nice thing about the above Haskell solution
> is
> > that M. comes free.
>
> Borrowing from http://www.jsoftware.com/jwiki/Essays/Fibonacci%20Sequence
>
> f7=: 3 : 0
>  mp=. +/ .*
>  {.{: mp/ mp~^:(I.|.#:y) 2 2$0 1 1 1x
> )
>
>   f7 200000
> 1508568355798893899263687894817313444...
>
> Which sort of what I experienced in other languages as well in that
recursion is usually pretty down the list of choices unless there is no
other choices.

Though this thread was about recursion in J(and whether TCO is important
which is IMO not as important as it sounds because of other constraints) and
not about how to avoid recursion as there usually are better solutions.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to