source: Deliverables/D2.2/8051/src/utilities/option.ml @ 486

Last change on this file since 486 was 486, checked in by ayache, 9 years ago

Deliverable D2.2

File size: 360 bytes
Line 
1(* Pasted from Pottier's PP compiler *)
2
3let map f = function
4  | None ->
5      None
6  | Some x ->
7      Some (f x)
8
9let iter f = function
10  | None ->
11      ()
12  | Some x ->
13      f x
14
15let fold f o accu =
16  match o with
17  | None ->
18      accu
19  | Some x ->
20      f x accu
21
22let print printer () = function
23  | None ->
24      ""
25  | Some x ->
26      printer () x
27
Note: See TracBrowser for help on using the repository browser.