Created
May 18, 2015 19:38
-
-
Save jez/6f398bfd294305863d32 to your computer and use it in GitHub Desktop.
Haskell's $ operator in SML
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
infixr 0 $ | |
fun f $ x = f x | |
fun compute NONE = "No value" | |
| compute (SOME x) = "The value is " ^ Int.toString x | |
fun println str = print $ str ^ "\n" | |
val _ = println $ compute $ SOME 42 | |
val _ = println $ compute NONE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment