aboutsummaryrefslogtreecommitdiff
path: root/Semestr 3/pf/lista1
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
parentf8a88b6a4aba1f66d04711a9330eaba49a50c463 (diff)
Duzy commit ze smieciami
Diffstat (limited to 'Semestr 3/pf/lista1')
-rw-r--r--Semestr 3/pf/lista1/a.outbin21950 -> 0 bytes
-rw-r--r--Semestr 3/pf/lista1/lista1bin823616 -> 0 bytes
-rw-r--r--Semestr 3/pf/lista1/lista1.cmibin2188 -> 0 bytes
-rw-r--r--Semestr 3/pf/lista1/lista1.cmobin1407 -> 0 bytes
-rw-r--r--Semestr 3/pf/lista1/lista1.ml70
-rw-r--r--Semestr 3/pf/lista1/zad6.ml37
6 files changed, 0 insertions, 107 deletions
diff --git a/Semestr 3/pf/lista1/a.out b/Semestr 3/pf/lista1/a.out
deleted file mode 100644
index 7fcdd98..0000000
--- a/Semestr 3/pf/lista1/a.out
+++ /dev/null
Binary files differ
diff --git a/Semestr 3/pf/lista1/lista1 b/Semestr 3/pf/lista1/lista1
deleted file mode 100644
index 8ce2f26..0000000
--- a/Semestr 3/pf/lista1/lista1
+++ /dev/null
Binary files differ
diff --git a/Semestr 3/pf/lista1/lista1.cmi b/Semestr 3/pf/lista1/lista1.cmi
deleted file mode 100644
index f2f5745..0000000
--- a/Semestr 3/pf/lista1/lista1.cmi
+++ /dev/null
Binary files differ
diff --git a/Semestr 3/pf/lista1/lista1.cmo b/Semestr 3/pf/lista1/lista1.cmo
deleted file mode 100644
index 801e852..0000000
--- a/Semestr 3/pf/lista1/lista1.cmo
+++ /dev/null
Binary files differ
diff --git a/Semestr 3/pf/lista1/lista1.ml b/Semestr 3/pf/lista1/lista1.ml
deleted file mode 100644
index f8f585f..0000000
--- a/Semestr 3/pf/lista1/lista1.ml
+++ /dev/null
@@ -1,70 +0,0 @@
-(* Zadanie 1 *)
-
-let a1 f g x = x |> g |> f
-let ff (a : 'a -> 'b) (b : 'c -> 'a) = fun x -> a (b x)
-
-let a2 a b = a
-let a3 a b = if a = b then a else a
-
-(* Zadanie 2 *);;
-let rec x y = x y;;
-
-(* Nie mozna bo etykieta b nie zostala nigdzie nalozona to jak ma byc sciagnieta? *)
-
-(* Zadanie 3 *);;
-
-
-let hd s = s 0
-let tl s = fun x -> s (x + 1)
-let add value s = fun x -> s x + value
-let map f s = fun x -> x |> s |> f
-let map2 f s1 s2 =
- fun x -> let a = s1 x and b = s2 x in f a b
-let replace n a s =
- fun x -> if x mod n = 0 then a else s x
-let take n s =
- fun x -> n*x |> s
-let rec scan f a s =
- fun x ->
- if x = 0 then f a (s 0)
- else f ((scan f a s) (x - 1)) (s x)
-let rec tabulate ?(l=0) r s =
- if l = r then [s r]
- else s l :: tabulate ~l:(l + 1) r s
-let s1 x = x + 1
-let s2 x = x * x
-
-(* Zadanie 4 *)
-
-let ctrue a b = a
-let cfalse a b = b
-let cand f1 f2 a b = f1 (f2 a b) b
-let cor f1 f2 a b = f1 a (f2 a b)
-let cbool_of_bool b = if b then ctrue else cfalse
-let bool_of_cbool f = f true false
-
-
-(* Zadanie 5 *)
-
-let zero f x = x
-let succ fn = fun f x -> fn f (f x)
-let add f1 f2 = fun f x -> f1 f (f2 f x)
-let mul f1 f2 = fun f x -> (f1 (f2 f)) x
-let is_zero f =
- let g x = x + 1
- in if (f g 0) = 0 then ctrue else cfalse
-let rec cnum_of_int = function
- | 0 -> zero
- | n -> succ (cnum_of_int (n - 1))
-
-let int_of_cnum f = f (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
-
-(* Zadanie 6 *) \ No newline at end of file
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