An operator is a symbol which perform an
operation between operands
An operator is said to be unary, if it
performs operation on single operand.
An operator is said to be binary, if it
performs operation on two operands
An Operator is said to be ternary if it
perform operation on three operands. In Haskell, any function that takes two
arguments and has a name consist entirely of non-alphanumeric characters is
considered an operator.
*Main> let (&) a b = 3 * (a+b) *Main> *Main> 10 & 20 90 *Main> *Main> 2 & 3 15
You can also
use operators in prefix notation.
*Main> (&) 2 3 15 *Main> *Main> (&) 20 20 120 *Main> *Main> (&) 10 20 90
No comments:
Post a Comment