Introduction To Haskell
Built-In Functions
Overview
All of the operators that were used here are functions in Haskell. They are called infix functions. This is because they are positioned in between their arguments/parameters.
Most functions are prefix functions, the function is written first and followed by its arguments. Here are some examples of functions that are available to use straight away.
Function | Description |
---|---|
succ | Returns the successor or next item in the list. |
pred | Returns the predecessor or previous item in the list. |
min | Returns the lowest of two arguments. |
max | Returns the highest of two arguments. |
div | Returns the integer part of the result of dividing the first of two arguments by the second. |
mod | Returns the remainder resulting from the first argument being divided by the second. |
gcd | Returns the greatest common divisor (highest common factor). |
lcm | Returns the lowest common multiple. |
even | Returns True or False depending on whether the argument is even or not. |
odd | Returns True or False depending on whether the argument is odd or not. |