[Haskell] recursion patterns?

2013-05-15 Thread 7stud
Well, my question does not meet the standards for a question at stackoverflow: (I am a haskell beginner) This example is from LYAH: import System.Random finiteRandoms :: (RandomGen g, Random a, Num n) => n -> g -> ([a], g) finiteRandoms 0 gen = ([], gen) finiteRandoms n gen

Re: [Haskell] recursion patterns?

2013-05-15 Thread 7stud
>> Is one solution more efficient than the other? I believe my solution is >> tail recursive, but it's my understanding that compilers can now >> optimize just about anything into tail recursion. >The first solution works for infinite lists and the second one does not. I don't see how that's