let main = do:
printLn "Welcome."
name ← ask "What's your name?"
fmtLn "Hello there, {}!" name
going ← ask "How are you?"
switch (evaluateStatus going):
good: printLn "Wow, that's good to hear."
bad: printLn "I'm sorry to hear that."
neutral: printLn "It could be worse, you know."
printLn "Well, I'd best be off. TTFN."
let status = enum:
good
bad
neutral
let goodwords = { "good", "great", "fantastic", "marvellous" }
let badwords = { "bad", "shit", "awful", "crap", "sucks" }
let evaluateStatus str = case:
any { good \contains str | good \in goodwords }: status/good
any { bad \contains str | bad \in badwords }: status/bad
otherwise: status/neutral
Last active
June 8, 2016 10:27
-
-
Save milesrout/f1b62ec06a4f3b4d9d259e5d5c8a5f18 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment