Both the versions work for me. The one with two calls to fractal takes ~0.03 seconds, whereas the one with only one call takes ~0.01 seconds.
All timings produced using (:set +s) in ghci.

Also, that totally recursive definition is infinitely recursive.

If you provide some more context, it will be easier to answer your question. Till now I don't exactly understand what the issue is.

On 4 March 2015 at 08:52, '2+ <electriclightheads@gmail.com> wrote:
hi!
since my

fractal :: [Int] -> [Int]
fractal x = [y - head x + z | y <- x, z <- x]

seems to be working fine with something like:

take 300 $ cycle $ fractal $ fractal $ [11..17] ++ [55..77]

wanted to twist the function to something totally recursive
but:

fractal x = fractal [y - head x + z | y <- x, z <- x]

experimented with:

take 300 $ fractal $ [11..17] ++ [55..77]

doesnt end its process and eat up the RAM

any hints to solve this issue?

thank you

----- 2g ---
http://sarigama.namaste.jp


_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners



--
Regards

Sumit Sahrawat