Skip to content

Instantly share code, notes, and snippets.

@rojepp
Last active December 14, 2015 04:48
Show Gist options
  • Save rojepp/5030535 to your computer and use it in GitHub Desktop.
Save rojepp/5030535 to your computer and use it in GitHub Desktop.
#irc thingie
type A = | Correct | Incorrect
let answers = [1; 2; 3]
let correctanswers = [1; 2; 2]
answers
|> List.zip correctanswers
|> List.map (function | a,ca when a = ca -> Correct, a
| a,_ -> Incorrect, a)
// Just need a count? Use sumBy
answers
|> List.zip correctanswers
|> List.sumBy(function | a,ca when a = ca -> 1
| _ -> 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment