Hi I am beginning to learn Haskell and am making a program to do the iterative process:
n -> n/2 (for even n)
n -> 3n+1 (for odd n)
So I got this far:`
chain n | n == 0 = error "What are you on about?"
| n == 1 = error "Finished"
| rem n 2 == 0 = chain (n `div` 2)
| rem n 2 /= 0 = chain (3 * n + 1)
` Will this work? But it only does the calculations behind the scenes, is there any way to make it display or export as list the result for n on each iteration until it reaches 1 so I can find the length of the list later?
On a side note, is there any way to make GHCi begin in a specific folder ?(I'm using windows)