Last active
August 29, 2015 14:16
-
-
Save vendethiel/c643a3e3b2af4ebef4d2 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
import @ from "contracts.js"; | |
macro fun { | |
rule { | |
$name:ident ($contract ...) { $body ... } | |
} => { | |
@ $contract ... | |
function $name () { | |
return (function { | |
$body ... | |
}).apply(this, arguments); | |
} | |
} | |
} | |
export fun; |
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
fun getMul ((Num) -> (Num) -> Num) { | |
3 => (x) => x * 10, | |
x => (x) => x * 2 | |
}; | |
console.log(getMul(3)(4)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment