Created
September 15, 2011 06:28
-
-
Save dalmaer/1218668 to your computer and use it in GitHub Desktop.
This file contains 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
# in and out | |
average :: ({name: Str, age: Num}, [...Num]) -> Str | |
average = (person, loc) -> | |
sum = loc.reduce (s1, s2) -> s1 + s2 | |
"#{person.name} wrote on average | |
#{sum / loc.length} lines of code." | |
# using your own functions to enforce (just need to handle true or false) | |
Even = (x) -> x % 2 is 0 | |
Odd = (x) -> x % 2 isnt 0 | |
addEvens :: (!Even) -> !Odd | |
addEvens = (x) -> x + 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment