Send Beginners mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1. Re:  Most important Functional Methods (Gregory Dean Weber)


----------------------------------------------------------------------

Message: 1
Date: Thu, 3 Jul 2014 14:32:38 -0400
From: Gregory Dean Weber <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Most important Functional Methods
Message-ID: <20140703183238.GB2235@lady>
Content-Type: text/plain; charset=us-ascii

Hello, Rustom,

On 2014-Jul-02, Rustom Mody wrote:
> On Sat, Jun 7, 2014 at 10:51 AM, Richard Seldon <[email protected]> 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.
> >

That's a good start, but I think it deals only with applying a
function to every element in a list, and while lists are certainly
important, there are many other data structures.
In Haskell, reduce is called foldl or foldr, 
depending on the direction.  I'm not familiar with mergeAll.
There's a nice set of functions for lists in the module Data.List:

    
http://www.haskell.org/ghc/docs/latest/html/libraries/base-4.7.0.0/Data-List.htmlhttp://www.haskell.org/ghc/docs/latest/html/libraries/base-4.7.0.0/Data-List.html

Now what about the functions to be applied to lists?
The id, const, compose (.), and flip functions are handy
for creating just the function you need.  See the Prelude
"Miscellaneous functions":

http://www.haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#g:9

So also is partial application, for example, (+ 3) is a function
which adds 3 to its argument.

Lists are an instance of the Functor class, which defines a 
method fmap which is a genealization of the map function.

    
http://www.haskell.org/ghc/docs/latest/html/libraries/base-4.7.0.0/Data-Functor.html

Lists are also an instance of the Monad class, which defines
generalizations of some of the other functions you mentioned
(mapM, filterM, etc.):

    
http://www.haskell.org/ghc/docs/latest/html/libraries/base-4.7.0.0/Control-Monad.html

> 
> 
> One of the classic papers that gives a good framing to this question is
> the bananas lenses paper:
> 
> http://eprints.eemcs.utwente.nl/7281/01/db-utwente-40501F46.pdf

> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners


-- 
Gregory D. Weber, Ph. D.                  http://mypage.iu.edu/~gdweber/
Associate Professor of Informatics        Tel (765) 973-8420
Indiana University East                   FAX (765) 973-8550



------------------------------

Subject: Digest Footer

_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners


------------------------------

End of Beginners Digest, Vol 73, Issue 2
****************************************

Reply via email to