[Haskell-beginners] What's the difference between "operator" and "function"?

yi huang yi.codeplayer at gmail.com
Mon Oct 10 14:29:28 CEST 2011


Usually, operator is function that takes two values and return a value, and
used in infix form, since in haskell infix and prefix form is
interchangable, so you can define operator as function taking two arguments.

>>> 1+2
3
>>> (+) 1 2
3
>>> map (+1) [1,2,3]
[2,3,4]
>>> (+1) `map` [1,2,3]
[2,3,4]

Hope you can understand my pool english ;-)
Best regards.

On Mon, Oct 10, 2011 at 8:08 PM, Costello, Roger L. <costello at mitre.org>wrote:

> Hi Folks,
>
> In a book that I am reading the author distinguishes between "operator" and
> "function."
>
> Example: The "+" is an operator. The "map" is a function.
>
> What's the difference between operator and function?
>
> /Roger
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>



-- 
http://www.yi-programmer.com/blog/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20111010/3910f1c9/attachment.htm>


More information about the Beginners mailing list