Last active
February 11, 2023 06:24
-
-
Save CodeMan99/eff36a843776047c77db25526a48223b to your computer and use it in GitHub Desktop.
F# bound context
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
let a b c = | |
b + c | |
let d a = | |
let m = a + 1 // pretend this is opening something stateful, like a db connection | |
let x y = | |
m + y | |
x | |
// f is a bound function, a has not been executed yet | |
let f = a 2 | |
// g is a reference to the inner function, d has been executed | |
let g = d 3 | |
// execute a with static bound context | |
do f 4 |> ignore | |
// execute x with stateful bound context | |
do g 5 |> ignore |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment