let int_of_permission pr =
let permission_int = [
(pr.user.sticky, 0o4000);
(pr.user.exec, 0o0100);
(pr.user.write, 0o0200);
(pr.user.read, 0o0400);
(pr.group.sticky, 0o2000);
(pr.group.exec, 0o0010);
(pr.group.write, 0o0020);
(pr.group.read, 0o0040);
(pr.other.sticky, 0o1000);
(pr.other.exec, 0o0001);
(pr.other.write, 0o0002);
(pr.other.read, 0o0004)
]
in
List.fold_left (fun full_perm (b,perm) ->
if b then
perm lor full_perm
else
full_perm)
0o0000 permission_int