[Haskell-cafe] Strange behavior with listArray

Bas van Dijk v.dijk.bas at gmail.com
Mon Nov 12 08:36:49 CET 2012


On 12 November 2012 04:50, Alex Stangl <alex at stangl.us> wrote:
> I'm stymied trying to figure out why the program below blows up with
> <<<loop>>> when I use "f 0"

If you replace the a!0 in f by its value 0, f is equivalent to:

            f k = if k > 0
                    then f 0
                    else 0 : f 1

Do you see the loop now?

Maybe you meant f to be:

            f k = if k > 0
                    then f (a!k)
                    else 0 : f 1

Regards,

Bas



More information about the Haskell-Cafe mailing list