The mutate operator is F#’s <- syntax for updating a mutable binding. F# reserves = for equality comparison, separating mutation from comparison and making immutable values the shorter default. section 4.2.3
let name = "isaac" #1 let mutable age = 42 #2 age <- 43 #3 if age = 43 then ... #4
Compare familiar assignment and equality syntax with F#’s explicit mutable binding, <- update, and = comparison. section 4.2.3
Updating a mutable gas tank
Declare mutable state before using the operator: let mutable gas = 100.0. A drive function can then update it with gas <- gas / 2.0, gas <- gas - 10.0, or gas <- gas - 1.0 depending on the distance. section 4.2.3
Use <- when modeling changing state directly. For immutable data, prefer a function that returns the next value, such as passing each gas state into drive and binding the resulting states. section 4.2.3
