Merge with cfg
This commit is contained in:
@ -5,7 +5,8 @@ Random.self_init ()
|
|||||||
|
|
||||||
let (let*) = Result.bind
|
let (let*) = Result.bind
|
||||||
|
|
||||||
let evaluate_type_polimorphic (_program: t_exp) (_context: typingshape) : (typingshape, error) result =
|
let evaluate_type_polimorphic (_program: t_exp) (_context: typingshape)
|
||||||
|
: (typingshape, error) result =
|
||||||
failwith "Not implemented"
|
failwith "Not implemented"
|
||||||
(* match program with *)
|
(* match program with *)
|
||||||
(* Integer _ -> Ok (VariableMap.empty, IntegerType) *)
|
(* Integer _ -> Ok (VariableMap.empty, IntegerType) *)
|
||||||
@ -13,7 +14,7 @@ let evaluate_type_polimorphic (_program: t_exp) (_context: typingshape) : (typin
|
|||||||
(* | Variable x -> ( *)
|
(* | Variable x -> ( *)
|
||||||
(* match (VariableMap.find_opt x (fst context)) with *)
|
(* match (VariableMap.find_opt x (fst context)) with *)
|
||||||
(* (None) -> ( *)
|
(* (None) -> ( *)
|
||||||
(* let u = PolimorphicType (Utility.fromIntToString !globalIdentifier) in *)
|
(* let u = PolimorphicType (Utility.from_int_to_string !globalIdentifier) in *)
|
||||||
(* globalIdentifier := !globalIdentifier + 1; *)
|
(* globalIdentifier := !globalIdentifier + 1; *)
|
||||||
(* Ok (VariableMap.singleton x u, u) *)
|
(* Ok (VariableMap.singleton x u, u) *)
|
||||||
(* ) *)
|
(* ) *)
|
||||||
|
|||||||
@ -15,13 +15,13 @@ let rec powmod a d = function
|
|||||||
let alphabet = "abcdefghijklmnopqrstuvwxyz"
|
let alphabet = "abcdefghijklmnopqrstuvwxyz"
|
||||||
let base = 26
|
let base = 26
|
||||||
|
|
||||||
let rec fromIntToString (x: int) : string =
|
let rec from_int_to_string (x: int) : string =
|
||||||
if x < 0 then
|
if x < 0 then
|
||||||
""
|
""
|
||||||
else if x < base then
|
else if x < base then
|
||||||
String.get alphabet x |> String.make 1
|
String.get alphabet x |> String.make 1
|
||||||
else
|
else
|
||||||
(fromIntToString (x/base - 1)) ^ (String.get alphabet (x mod base) |> String.make 1)
|
(from_int_to_string (x/base - 1)) ^ (String.get alphabet (x mod base) |> String.make 1)
|
||||||
|
|
||||||
let int_and a b =
|
let int_and a b =
|
||||||
match (a>0, b>0) with
|
match (a>0, b>0) with
|
||||||
@ -169,4 +169,3 @@ let rec combine_twice la lb =
|
|||||||
| [a], [b] -> [a, b]
|
| [a], [b] -> [a, b]
|
||||||
| a::la, b::lb -> (a, b) :: (combine_twice la lb)
|
| a::la, b::lb -> (a, b) :: (combine_twice la lb)
|
||||||
| _ -> []
|
| _ -> []
|
||||||
>>>>>>> cfg
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
val pow : int -> int -> int
|
val pow : int -> int -> int
|
||||||
val powmod : int -> int -> int -> int
|
val powmod : int -> int -> int -> int
|
||||||
|
|
||||||
val fromIntToString : int -> string
|
val from_int_to_string : int -> string
|
||||||
|
|
||||||
val int_and : int -> int -> int
|
val int_and : int -> int -> int
|
||||||
val int_or : int -> int -> int
|
val int_or : int -> int -> int
|
||||||
|
|||||||
Reference in New Issue
Block a user