1
0
Fork 0

Binary Functions

main
Sebastian Steger 2025-08-20 15:02:40 +02:00
parent eed6fc8fae
commit 6e1083ad56
1 changed files with 17 additions and 0 deletions

View File

@ -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