Saturday, July 30, 2011

Haskell_Notes_3

Note: 
you can do 5 + 4.0 because 5 is sneaky and can act like an integer or a floating-point number. 4.0 can't act like an integer, so 5 is the one that has to adapt


Infix functions
PostFix Functions


* is a function that takes two numbers and multiplies them.  5*4  is an infix function.   
we can think 
function * (param1, param2)
{
    return param1 * param2;
}
Most functions that aren't used with numbers are prefix functions


Pre-Defined functions available in Haskell Libraries:


succ
pred
min
max


ghci> succ 8
9
ghci> max 10,11
11


div - this function does only integer division.






No comments:

Post a Comment