mirror of
https://github.com/Noratrieb/idris-learning.git
synced 2026-01-15 13:35:01 +01:00
move and change
This commit is contained in:
parent
80aa1a2be7
commit
1330cb05e9
10 changed files with 161 additions and 142 deletions
|
|
@ -1,43 +0,0 @@
|
|||
double : Num ty => ty -> ty
|
||||
double x = x + x
|
||||
|
||||
add : Int -> Int -> Int
|
||||
add x y = x + y
|
||||
|
||||
identity : ty -> ty
|
||||
identity x = x
|
||||
|
||||
-- the
|
||||
der : (ty : Type) -> ty -> ty
|
||||
der ty x = x
|
||||
|
||||
|
||||
||| Higher-Order-Functions
|
||||
|
||||
twice : (a -> a) -> a -> a
|
||||
twice f x = f (f x)
|
||||
|
||||
Shape : Type
|
||||
|
||||
rotate : Shape -> Shape
|
||||
|
||||
quadruple : Num a => a -> a
|
||||
quadruple = twice double
|
||||
|
||||
turn_around : Shape -> Shape
|
||||
turn_around = twice rotate
|
||||
|
||||
apply_n : (a -> a) -> Nat -> a -> a
|
||||
|
||||
longer : String -> String -> Nat
|
||||
longer word1 word2 =
|
||||
let len1 = length word1
|
||||
len2 = length word2 in
|
||||
max len1 len2
|
||||
|
||||
|
||||
pythagoras : Double -> Double -> Double
|
||||
pythagoras x y = sqrt (square x + square y)
|
||||
where
|
||||
square : Double -> Double
|
||||
square x = x * x
|
||||
Loading…
Add table
Add a link
Reference in a new issue