Silly IO problem

skaller skaller at users.sourceforge.net
Wed Nov 2 23:07:04 EST 2005


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?

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net



More information about the Glasgow-haskell-users mailing list