Guest User

Untitled

a guest
May 24th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. let f x = sprintf "[%A]" x
  2. let g x = sprintf "{%A}" x
  3.  
  4. (* So you have two functions (string -> string)
  5. Now, you want to do let result = f g "hi"
  6. However, f doesn't take a function string -> string, it takes a string.
  7. So you need to tell the compiler about your precedence.
  8.  
  9. Normal "idiomatic" ways: *)
  10.  
  11. f (g "input")
  12. "input" |> g |> f
  13.  
  14. (* Crazier ways: *)
  15.  
  16. f <| g "input"
  17. (f >> g) "input"
Add Comment
Please, Sign In to add comment