
On Sat, Jun 7, 2014 at 8:40 AM, Erik Price
On Saturday, June 7, 2014, Richard Seldon
wrote: Hello,
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:
http://www.cs.nott.ac.uk/~gmh/fold.pdf
It shows how many of the basic higher-order functions (such as map, filter, etc) can be derived from a fold.
e
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) []