Created
March 23, 2019 23:22
-
-
Save MarcelineVQ/26836662c9a908b74e157100cbfee9e7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--loop, I don't even use pffft | |
guess : (target : Nat) -> IO () | |
guess target = do | |
printLn "Rate die Zahl" | |
line <- getLine | |
Just g <- pure (stringToNat line) | Nothing => (printLn "Invalid String" *> guess target) | |
let pffft = stringToNat line | |
let g = case stringToNat line of | |
Just p => p | |
Nothing => 0 | |
case compare g target of | |
EQ => do | |
printLn "Richtig!" | |
LT => do | |
printLn "Mehr!" | |
guess target | |
GT => do | |
printLn "Weniger" | |
guess target | |
--no loop, there is no pffft but I do shadow the g | |
guess : (target : Nat) -> IO () | |
guess target = do | |
printLn "Rate die Zahl" | |
line <- getLine | |
Just g <- pure (stringToNat line) | Nothing => (printLn "Invalid String" *> guess target) | |
let g = case stringToNat line of | |
Just p => p | |
Nothing => 0 | |
case compare g target of | |
EQ => do | |
printLn "Richtig!" | |
LT => do | |
printLn "Mehr!" | |
guess target | |
GT => do | |
printLn "Weniger" | |
guess target | |
--loop, I don't shadow the g | |
guess : (target : Nat) -> IO () | |
guess target = do | |
printLn "Rate die Zahl" | |
line <- getLine | |
let g = case stringToNat line of | |
Just p => p | |
Nothing => 0 | |
case compare g target of | |
EQ => do | |
printLn "Richtig!" | |
LT => do | |
printLn "Mehr!" | |
guess target | |
GT => do | |
printLn "Weniger" | |
guess target | |
-- no loop, I don't have the let at all | |
guess : (target : Nat) -> IO () | |
guess target = do | |
printLn "Rate die Zahl" | |
line <- getLine | |
Just g <- pure (stringToNat line) | Nothing => (printLn "Invalid String" *> guess target) | |
case compare g target of | |
EQ => do | |
printLn "Richtig!" | |
LT => do | |
printLn "Mehr!" | |
guess target | |
GT => do | |
printLn "Weniger" | |
guess target | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment