First commit

This commit is contained in:
elvis
2024-10-04 19:38:34 +02:00
parent 0ee328edfc
commit c1e513d3dc
12 changed files with 380 additions and 0 deletions

60
lib/exercises.mli Normal file
View File

@ -0,0 +1,60 @@
type a_exp =
Aval of int
| Plus of a_exp * a_exp
| Minus of a_exp * a_exp
| Times of a_exp * a_exp
| Of_bool of b_exp
and b_exp =
Bval of bool
| And of b_exp * b_exp
| Or of b_exp * b_exp
| Not of b_exp
| Minor of a_exp * a_exp
val eval_a_exp: a_exp -> int
val eval_b_exp: b_exp -> bool
type 'a my_tree =
Leaf of 'a
| Node of ('a my_tree) list
val mod_list: 'a list -> 'a list list
(* --------------------------------------------------------------------------- *)
val to_tup : ('a -> 'b) -> ('c -> 'd) -> (('a * 'c) -> ('b * 'd))
val partialsum : int list -> int list
type label =
string
type 'a finite_state_automata = {
l: label;
next: ('a finite_state_automata * 'a list) list;
final: bool;
}
val check_included : 'a list -> 'a finite_state_automata -> bool
(* -------------------------------------------------------------------------- *)
module StringMap : Map.S with type key = string
type fsa = {
vertices: bool StringMap.t;
edges: (string * char) StringMap.t;
state: string;
}
val ex8 : char list -> fsa -> bool
type binary_tree =
Node of binary_tree * binary_tree
| Leaf of int
val ex9 : binary_tree -> int
(* -------------------------------------------------------------------------- *)