Silly IO problem

Christian Maeder maeder at tzi.de
Thu Nov 3 04:07:56 EST 2005


I don't see your problem. (I've put your code into the file Tac.hs)

Christian

maeder at turing:~/haskell/examples> ghc --make -o tac Tac.hs
Chasing modules from: Tac.hs
Compiling Main             ( Tac.hs, Tac.o )
Linking ...
maeder at turing:~/haskell/examples> ./tac 5
10.0


skaller wrote:
> This code doesn't work:
> ------------------------
> import System(getArgs)
> 
> main = do n <- getArgs >>= readIO.head
>           putStrLn (show (tak (3*n) (2*n) n))
> 
> tak :: Float -> Float -> Float -> Float
> tak x y z | y>=x      = z
>           | otherwise = tak (tak (x-1) y z) (tak (y-1) z x) (tak (z-1) x
> y)
> --------------
> It prints n, rather than tak(3n,2n,n). Can someone give me
> the right encoding please?
> 



More information about the Glasgow-haskell-users mailing list