Just like Haskell, operators can be used as a function.
var d = 40
d + 1 // 41
(+)(d, 2) // 42
Unlike Haskell, Swift has assignment operators which also works as a function.
(+=)(&d, 2) // d is now 42. Note it is d, &d, not d
Surprisingly this does NOT work. Looks like the assignment operator =
is special.
(=)(&d, 42) // Swift complains, "Expected ',' separator"