im new to Haskell and dont understand how haskell handles recursion. Ive been working on this for months and just cant figure it out. My project is due in a few days, so im asking for any help or advice! My project description is to have 7 "criminals" with three of them are "guilty" i have to randomly display three of 7 criminals, tell how many of the three are guilty, and ask if the user want to make a guess at whos guilty or pass until all have been guessed correctly. I have figured out most of everything else, im just stuck on how to use a recursive function to repeatedly display 3 randoms from the 7, ask for input, and check if its right.
Ok so from looking at the stuff you've gave me, i tried to make a small function to try to practice using recursion as a loop before i implement it into my project, this is what i came up with:
main = do
num <- 7
print recursion(num)
let recursion a = do
putStrLn "guess my number!"
guess <- getLine
if a==guess
then print "good job"
return guess
else
recursion a
but im getting some parse errors on the lines towards the end, could you tell me what im doing wrong? @stonemetal