Re: [Haskell-cafe] Re: Newbie: Project: Missionary and Cannibal [Contd].

thank you very much for all your Help. I am finally able to do something (O:
I watched the video presentation from Edsge W. Dijkstra. It is very helpful.
thank you once again for providing me the link.
I am trying to call a function and print a message.
moveLoadR :: Int -> Int -> (IO ()-> a)
moveLoadR m c | m==0 && c==0 = moveEndR $ putStrLn "END"
| otherwise = moveLoadR (m-1) (c-1) $ putStrLn
"Starting Missionary and Cannibal Game.\nLeft Bank: Missionary=3:Cannibal=3:
Moving From: Left ===> Right: Missionary=1 Cannibal=1 \n"
moveEndR :: (IO ()->a)
moveEndR = putStrLn"END OF Solution" <<< === THIS IS INCORRECT.
I tried doing this . but it will take me to the infinite Loop.
moveEndR :: (IO ()->a)
moveEndR = moveEndR $ putStrLn"END OF GAME"
Any help in this would be greatly appreciated.
.
On 1/16/07, Paul Johnson
This is presumably your homework. See http://www.haskell.org/haskellwiki/Homework_help
This kind of problem is often solved by using the List monad, so try looking at that first.
Failing that, have a list of moves to make a sequence. Then make a list of all possible sequences. Then filter out the ones that break the rules. Whatever is left is the answer you want.
Paul. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

On Wed, 17 Jan 2007 05:35:59 +0100,
I watched the video presentation from Edsge W. Dijkstra. It is very helpful.
I made a typo in my previous e-mail: His first name is Edsger
I am trying to call a function and print a message.
moveEndR :: (IO ()->a) moveEndR = putStrLn"END OF Solution" <<< === THIS IS INCORRECT.
The type signature is wrong, you can find the type of the function with Hugs and GHCi: Prelude> :t putStrLn"END OF Solution" putStrLn"END OF Solution" :: IO () -- Met vriendelijke groet, Henk-Jan van Tuyl -- http://Van.Tuyl.eu/ --
participants (2)
-
Henk-Jan van Tuyl
-
thapaps@gmail.com