Commit 94184291 authored by Jean-Christophe Filliâtre's avatar Jean-Christophe Filliâtre
Browse files

a mere generalization

parent 1f163b68
...@@ -8,14 +8,15 @@ module Fill ...@@ -8,14 +8,15 @@ module Fill
use import int.Int use import int.Int
use import module array.Array use import module array.Array
type tree = Null | Node tree int tree type elt
type tree = Null | Node tree elt tree
predicate contains (t: tree) (x: int) = match t with predicate contains (t: tree) (x: elt) = match t with
| Null -> false | Null -> false
| Node l y r -> contains l x || x = y || contains r x | Node l y r -> contains l x || x = y || contains r x
end end
let rec fill (t: tree) (a: array int) (start: int) : int = let rec fill (t: tree) (a: array elt) (start: int) : int =
{ 0 <= start <= length a } { 0 <= start <= length a }
match t with match t with
| Null -> | Null ->
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment