Monads/List monad: Difference between revisions

Added yield to the list of more expressive name for 'mu'
(→‎{{header|F_Sharp|F#}}: Add true list monad implementation)
(Added yield to the list of more expressive name for 'mu')
Line 4:
A [[wp:Monad_(functional_programming)|Monad]] is a combination of a data-type with two helper functions written for that type.
 
The data-type can be of any kind which can contain values of some other type – common examples are lists, records, sum-types, even functions or IO streams. The two special functions, mathematically known as '''eta''' and '''mu''', but usually given more expressive names like 'pure' or, 'return', or 'yield' and 'bind', abstract away some boilerplate needed for pipe-lining or enchaining sequences of computations on values held in the containing data-type.
 
The bind operator in the List monad enchains computations which return their values wrapped in lists. One application of this is the representation of indeterminacy, with returned lists representing a set of possible values. An empty list can be returned to express incomputability, or computational failure.
2,171

edits