4 ms·
Note that in Julia these are often referred to as array comprehensions, as the data structure involved is a (very efficient) array. C.f. Python
by montalbano 5y ago
Note that in Julia these are often referred to as array comprehensions, as the data structure involved is a (very efficient) array. C.f. Python
- kryptiskt 5y agoAnd in Haskell they are monad comprehensions these days, so they can build more than lists. They actually used to be so back in the 90s, but Haskell 98 was conservative and restricted them to lists.
- exdsq 5y agoWhat do monad comprehensions offer?
- thewakalix 5y agoList comprehensions are a concise way of writing do-expressions in the list monad, so monad comprehensions just extend that to all monads.
- jolmg 5y agoBeing very generic. One can define a very efficient array structure, define its Monad instance and be able to use it in comprehensions. The point is that comprehensions are not fixed to a particular data structure by the language, and can be used with any user-definable Monad.