definition of combinator

5 messages
Open this post in threaded view
|

definition of combinator

 Although I can use libraries like Parsec, I don't really understand what a combinator is, theoretically. There is an article here http://en.wikipedia.org/wiki/Combinatorwith the statement "A combinator is a higher-order function that uses only function application and earlier defined combinators to define a result from its arguments." Okay, so I believe a "higher-order function" is a function that takes function(s) as its argument(s). I don't know what "uses only function application" means. Application of what functions to what? Can someone give a concrete example that's simple? Thanks, Mike
Open this post in threaded view
|

definition of combinator

 On Aug 23, 2009, at 20:44 , Michael Mossey wrote: > Although I can use libraries like Parsec, I don't really understand   > what a combinator is, theoretically. There is an article here Example:  in Parsec, "many" is a combinator which takes a parser as an   argument and produces a parser that matches multiple successive copies   of whatever the argument matches.  It doesn't need to know anything   about its argument except that it's a parser.  This kind of function   lets you build up complex but general parsers from smaller pieces. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [hidden email] system administrator [openafs,heimdal,too many hats] [hidden email] electrical and computer engineering, carnegie mellon university    KF8NH -------------- next part -------------- A non-text attachment was scrubbed... Name: PGP.sig Type: application/pgp-signature Size: 195 bytes Desc: This is a digitally signed message part Url : http://www.haskell.org/pipermail/beginners/attachments/20090823/a5cb87bd/PGP.bin
Open this post in threaded view
|

definition of combinator

 In reply to this post by Michael Mossey Hi Michael, On Sun, Aug 23, 2009 at 05:44:27PM -0700, Michael Mossey wrote: > "A combinator is a higher-order function that uses only function > application and earlier defined combinators to define a result from its > arguments." > > Okay, so I believe a "higher-order function" is a function that takes > function(s) as its argument(s). I don't know what "uses only function > application" means. Application of what functions to what? Briefly, a combinator applies ?earlier defined combinators? to ?its arguments?. But remember that a combinator's argument can be a function as well, so it may become more complicated. Then it simply applies functions (other combinators, combinator's arguments, library functions) to their arguments (other combinators, combinator's arguments, library functions, constants, ...). Finally, I guess that the word ?only? suggests that it doesn't read any parsed text by itself but it only calls (combine) other parsers. Sincerely,     Jan. -- Heriot-Watt University is a Scottish charity registered under charity number SC000278.