Why the Scala fascination with flatmap? (This doesn't seem to be the same for mapcat in the Clojure world) [closed]
https://softwareengineering.stackexchange.com/questions/220146
Question
In the Scala community - there is an apparent fascination with the FlatMap function.
Now I understand that FlatMap is significant because it is used for the bind part of a Monad. (and that the Clojure community hasn't dived into Monads yet, with some wonderful exceptions).
Now in the Clojure Community - there is no corresponding cultural idiom, eg "MapCat that S***".
My theory on the difference between the two communities and the reason for this difference is that the concurrency primitives in Clojure lend it towards solving problems on a single machine, in a single instance. (Ie Clojure is good at concurrency). Whereas in the Scala World, with the rise of the Actor model, Scala is a little more focused on solving multi-machine problems. This focus on multi-machine problems has a higher focus on breaking problems down into their parts, and a greater focus on what can be broken down and Scale. (eg Monoids) (Now I realise there is an STM in Scala, and that Actor models, Avout and Cascalog are wonderful exceptions to this - I'm making a generalization)
My question is, why the Scala fascination with flatmap?
(I'm not trying to start a flamewar - I think both communities have benefited from each others existence - I'm trying to understand a cultural behaviour).
Solution
Now I understand that FlatMap is significant because it is used for the bind part of a Monad. (and that the Clojure community hasn't dived into Monads yet, with some wonderful exceptions).
I think that's pretty much the entire explanation. Many Scala idioms and approaches are derived from Haskell, and so it pays a lot of attention to type-safety, monads, etc.
Now in the Clojure Community - there is no corresponding cultural idiom, eg "MapCat that S***".
mapcat
only works with collections, unlike flatMap
.
This focus on multi-machine problems has a higher focus on breaking problems down into their parts, and a greater focus on what can be broken down and Scale. (eg Monoids) (Now I realise there is an STM in Scala, and that Actor models, Avout and Cascalog are wonderful exceptions to this - I'm making a generalisation)
Better example of this in Clojure core is Reducers.