3 ms·
It makes a List of Lists, then combines those into a List. [5,3,4] becomes [f(5), f(3), f(4)], but f(x) must return a List. Those inner Lists are then concaten
by scottmsul 10y ago
It makes a List of Lists, then combines those into a List.
[5,3,4] becomes [f(5), f(3), f(4)], but f(x) must return a List. Those inner Lists are then concatenated.
When I say "original data structure", I mean the type of data structure is the same (in this case, List).
- jnordwick 10y agoWhat is the data structures don't support a join operation, like a tree?
- scottmsul 10y agoWe would need a way to transform a Tree of Trees into a single Tree. The inner Trees would be at leaf nodes of the outer Tree, so they could be attached in place. Although I recall monads need to satisfy certain laws, and I don't recall if Trees satisfy them or not. Just because something is a data structure does not necessarily imply it is a monad.
- dllthomas 10y agoA rose tree is a monad.