1
0
Fork 0

Unary Functions

main
Sebastian Steger 2025-08-20 15:02:22 +02:00
parent 7b6c597f32
commit eed6fc8fae
1 changed files with 13 additions and 0 deletions

View File

@ -20,6 +20,19 @@ Expression | Type (:t) | Value | Comment
## Unary Functions
Expression | Type (:t) | Value | Comment
--- | --- | --- | --------
`sqrt(4)` | `Floating a => a` | `2.0` |
`sqrt 4` | `Floating a => a` | `2.0` | Similar `abs,negate,signum,recip`
`sqrt` | `Floating a => a -> a` | |
`sqrt 3^2 + 4^2` | `Floating a => a` | `19.0` |
`sqrt (3^2 + 4^2)` | `Floating a => a` | `5.0` |
`negate(sqrt (3^2 + 4^2))` | `Floating a => a` | `-5.0` |
`negate $ sqrt (3^2 + 4^2)` | `Floating a => a`| `-5.0` | Function **application** operator `$`
`(negate . sqrt) (3^2 + 4^2)`| `Floating a => a`| `-5.0` | Function **composition** operator `.` Reads `negate` **after** `negate . sqrt` |
`(negate . length) "hallo"` | `Int` | `-5` |
`negatedRoot = negate . sqrt` | `Floating c => c -> c` | | Constant named `negatedRoot`
## Binary Functions
## Tuples