Created
April 28, 2010 17:39
-
-
Save dgfitch/382427 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
let f x = sprintf "[%A]" x | |
let g x = sprintf "{%A}" x | |
(* So you have two functions (string -> string) | |
Now, you want to do let result = f g "hi" | |
However, f doesn't take a function string -> string, it takes a string. | |
So you need to tell the compiler about your precedence. | |
Normal "idiomatic" ways: *) | |
f (g "input") | |
"input" |> g |> f | |
(* Crazier ways: *) | |
f <| g "input" | |
(f >> g) "input" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment