summaryrefslogtreecommitdiff
path: root/src/wall.mli
blob: dc9621827af82dcd316f67d7e63c3eff9be98e6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54


(* Programmed by Jedidiah Barber *)
(* Licensed under the Sunset License v1.0 *)


module type Algebra =
  sig
    type t

    val zero : t
    val one : t

    val add : t -> t -> t
    val sub : t -> t -> t
    val mul : t -> t -> t
    val div : t -> t -> t

    val to_string : t -> string
  end



module type S =
  sig
    type element
    type wall

    val empty : wall

    val create : dimx:int -> dimy:int -> init:element array -> wall

    val x_length : wall -> int
    val y_length : wall -> int

    val has_value : wall -> x:int -> y:int -> bool

    val get : wall -> x:int -> y:int -> element
    val get_opt : wall -> x:int -> y:int -> element option

    val last_nonzero_row : wall -> int

    val to_string : wall -> string
    val print : wall -> unit
    val output : Stdlib.out_channel -> wall -> unit
    val pp_print : Stdlib.Format.formatter -> wall -> unit
  end



module Make:
  functor (A : Algebra) -> S with type element = A.t