forked from steger/pr3-sose2026
Unary Functions
parent
7b6c597f32
commit
eed6fc8fae
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue