[Haskell-beginners] Most important Functional Methods
Patrick Mylund Nielsen
haskell at patrickmylund.com
Sat Jun 7 12:51:00 UTC 2014
On Sat, Jun 7, 2014 at 8:40 AM, Erik Price <erikprice at gmail.com> wrote:
> On Saturday, June 7, 2014, Richard Seldon <arcseldon at gmail.com> wrote:
>> I have a general question, not specific to Haskell although I am learning
>> Haskell as I ask this question..
>> Please can someone provide consensus on the most important functional
>> methods in their view.
>> I read somewhere that having map, reduce, filter, mergeAll, and zip
>> pretty much means everything else can be derived.
> You might be interested in reading this excellent introductory article on
> folds, which are Haskell's equivalent to what some languages call reduce:
> It shows how many of the basic higher-order functions (such as map,
> filter, etc) can be derived from a fold.
In fact, concatMap (flatMap) is defined like so:
-- | Map a function over a list and concatenate the results.concatMap
:: (a -> [b]) -> [a] -> [b]concatMap f =
foldr ((++) . f) 
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners