forked from steger/pr3-sose2026
Binary Functions
parent
eed6fc8fae
commit
6e1083ad56
|
|
@ -35,6 +35,23 @@ Expression | Type (:t) | Value | Comment
|
|||
|
||||
## Binary Functions
|
||||
|
||||
Expression | Type (:t) | Value | Comment
|
||||
--- | --- | --- | --------
|
||||
`div 8 4` | `Integral a => a` | `2` | Similar `mod,gcd,lcm,not`
|
||||
``8 `div` 4`` | `Integral a => a` | `2` | **Infix** notation using backticks
|
||||
`8 + 4` | `Num a => a` | `12` | `-,*,^,<, <=, >=, ==, /=`
|
||||
`(+) 8 4` | `Num a => a` | `12` | **Prefix** notation using parenthesis
|
||||
`div` | `Integral a => a -> a -> a` | | **Currying** represents multi-argument functions as a chain of single-argument functions |
|
||||
`div 8` | `Integral a => a -> a` | | binds the **first** argument; Similar `(8/),(8*),(8+),(8-)` |
|
||||
`div8bySomething = div 8` | `Integral a => a -> a` | |
|
||||
`div8bySomething 4` | `Integral a => a` | `2` |
|
||||
`uncurry div` | `Integral c => (c, c) -> c` | | accepts a single tuple argument
|
||||
`uncurry div (8,4)` | `Integral c => c` | `2` |
|
||||
`uncurry` | `(a -> b -> c) -> (a, b) -> c`| |
|
||||
`` (`div` 4) `` | `Integral a => a -> a` | | **Sectioning** binds the **second** argument of infix functions; Similar `(/8),(*8),(+8),(-8)` |
|
||||
``divSomethingBy4 = (`div` 4)`` | `Integral a => a -> a` | |
|
||||
`divSomethingBy4 8` | `Integral a => a` | `2` |
|
||||
|
||||
## Tuples
|
||||
|
||||
## Strings
|
||||
|
|
|
|||
Loading…
Reference in New Issue