aboutsummaryrefslogtreecommitdiff
path: root/Semestr 3/pf/lista7/Map1.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/lista7/Map1.ml
parentf8a88b6a4aba1f66d04711a9330eaba49a50c463 (diff)
Duzy commit ze smieciami
Diffstat (limited to 'Semestr 3/pf/lista7/Map1.ml')
-rw-r--r--Semestr 3/pf/lista7/Map1.ml56
1 files changed, 0 insertions, 56 deletions
diff --git a/Semestr 3/pf/lista7/Map1.ml b/Semestr 3/pf/lista7/Map1.ml
deleted file mode 100644
index 90cf893..0000000
--- a/Semestr 3/pf/lista7/Map1.ml
+++ /dev/null
@@ -1,56 +0,0 @@
-type ('a, _) order1 =
- | Lt : ('a, 'b) order1
- | Eq : ('a, 'a) order1
- | Gt : ('a, 'b) order1
-
-module type Type1 = sig
- type 'a t
-end
-
-module type OrderedType1 = sig
- include Type1
- val compare : 'a t -> 'b t -> ('a, 'b) order1
-end
-
-module type S = sig
- type 'a key
- type 'a value
- type t
- val empty : t
- val add : 'a key -> 'a value -> t -> t
- val remove : 'a key -> t -> t
- val find : 'a key -> t -> 'a value
-end
-
-module Make(Key : OrderedType1)(Value : Type1) :
- (S with type 'a key = 'a Key.t and type 'a value = 'a Value.t) =
-struct
- type 'a key = 'a Key.t
- type 'a value = 'a Value.t
- type ex_key =
- | Key : 'a key -> ex_key
- type key_value_pair =
- | KeyVal : 'a key * 'a value -> key_value_pair
- module ExKey =
- struct
- type t = ex_key
- let compare (Key k1) (Key k2) : int =
- match Key.compare k1 k2 with
- | Lt -> -1
- | Eq -> 0
- | Gt -> 1
- end
- module ExMap = Map.Make(ExKey)
- type t = key_value_pair ExMap.t
- let empty : t = ExMap.empty
- let add (k: 'a key) (v: 'a value) (m: t) : t =
- ExMap.add (Key k) (KeyVal (k, v)) m
- let remove (k: 'a key) (m: t) : t =
- ExMap.remove (Key k) m
- let find (type a) (k: a key) (m: t) : a value =
- let (KeyVal (kf, v)) = ExMap.find (Key k) m in
- match Key.compare k kf with
- | Eq -> v
- | _ -> failwith "sth is wrong"
-end
-