Skip to content
Snippets Groups Projects
Commit a817ee25 authored by Thorsten Wißmann's avatar Thorsten Wißmann
Browse files

Implement TArray.all correctly

parent 0dfb55b5
No related branches found
No related tags found
No related merge requests found
...@@ -11,7 +11,7 @@ module TArray = struct ...@@ -11,7 +11,7 @@ module TArray = struct
else if f arr.(idx) then true else if f arr.(idx) then true
else g (idx + 1) else g (idx + 1)
in g 0 in g 0
let all f = any (fun x -> not (f x)) let all f arr = not (any (fun x -> not (f x)) arr)
let elem (x: 'a) (arr: 'a array) = let elem (x: 'a) (arr: 'a array) =
any (fun y -> x == y) arr any (fun y -> x == y) arr
let included sub sup = all (fun x -> elem x sup) sub let included sub sup = all (fun x -> elem x sup) sub
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment