When functions don’t have side effects we can actually define what they do (and correctness) purely by looking the types.
“function composition”: To combine two functions into a new one.“For X, first apply g, then f.”, Or “f of g of x”
No stiffness of object-oriented programming Possibility to make top-down design
Often we want to combine things that are not so directly linked to each other… Monad term is from Haskell where it is actually the only way to make side effects
Actually Nullable<T> is just a list with zero or one items.
Add things to thedomainModify: Handle the domainGet items from the domain
2: (a -> M<b>) is a transformation function (formap/select/…)3: (b -> a -> b) function is a collector/selector function and b is kind of an accumulator to collect the output result.
By chaining these we can create anything (without named parameters) I is unnecessary as I 5 = S (K) (K) (5) One ”Church-man" e.g. proved that we can make numbers and boolean logic just with functions. There is even a programming language based only combining these functions.
What if f(x) function would get input itself, I mean the f? Will become an recursion and infinite loop… The loop and the ending-condition-function can be separated to different functions Y can of course be made just with SKI-calculus
//function composition<br />let combine f g x = g(f(x)) <br />Let combine f g x = (f>>g)x<br />// f: 'a -> 'b<br />// g: 'b -> 'c<br />// x: 'a<br />combine f g x: (a -> b) -> (b -> c) -> a -> c<br />
//You can remove the parameter from the last one!<br />let combine f g= (f>>g)<br />// combine: ('a -> 'b) -><br /> ('b -> 'c) -><br /> ('a -> 'c)<br />