aboutsummaryrefslogtreecommitdiff
path: root/Semestr 3/pf/lista1/zad6.ml
diff options
context:
space:
mode:
authorFranciszek Malinka <franciszek.malinka@gmail.com>2021-10-05 21:49:54 +0200
committerFranciszek Malinka <franciszek.malinka@gmail.com>2021-10-05 21:49:54 +0200
commitc5fcf7179a83ef65c86c6a4a390029149e518649 (patch)
treed29ffc5b86a0d257453cedcf87d91a13d8bf3b0d /Semestr 3/pf/lista1/zad6.ml
parentf8a88b6a4aba1f66d04711a9330eaba49a50c463 (diff)
Duzy commit ze smieciami
Diffstat (limited to 'Semestr 3/pf/lista1/zad6.ml')
-rw-r--r--Semestr 3/pf/lista1/zad6.ml37
1 files changed, 0 insertions, 37 deletions
diff --git a/Semestr 3/pf/lista1/zad6.ml b/Semestr 3/pf/lista1/zad6.ml
deleted file mode 100644
index 46e7f6d..0000000
--- a/Semestr 3/pf/lista1/zad6.ml
+++ /dev/null
@@ -1,37 +0,0 @@
-type cbool = { cbool : 'a. 'a -> 'a -> 'a }
-type cnum = { cnum : 'a. ('a -> 'a) -> 'a -> 'a }
-
-
-let even n =
- { cbool = fun tt ff -> fst (n.cnum (fun (a, b) -> (b, a)) (tt, ff))}
-
-
-let ctrue =
- { cbool = fun a b -> a}
-let cfalse =
- { cbool = fun a b -> b}
-let cand f1 f2 a b = f1.cbool (f2.cbool a b) b
-let cor f1 f2 a b = f1.cbool a (f2.cbool a b)
-let cbool_of_bool b = if b then ctrue else cfalse
-let bool_of_cbool f = f.cbool true false
-
-let zero = { cnum = fun f x -> x }
-let succ fn = { cnum = fun f x -> fn.cnum f (f x) }
-let add f1 f2 = { cnum = fun f x -> f1.cnum f (f2.cnum f x) }
-let mul f1 f2 = { cnum = fun f x -> f1.cnum (f2.cnum f) x }
-(* let is_zero f = *)
-let rec cnum_of_int = function
- | 0 -> zero
- | n -> succ (cnum_of_int (n - 1))
-let is_zero f =
- let g x = x + 1
- in if (f.cnum g 0) = 0 then ctrue else cfalse
-let int_of_cnum f = f.cnum (fun x -> x + 1) 0
-
-let one = succ zero
-let two = succ one
-let three = succ two
-let four = succ three
-let five = succ four
-
-let func x = x * 2 \ No newline at end of file