source: Deliverables/D2.2/8051/src/utilities/bList.ml @ 1580

Last change on this file since 1580 was 1580, checked in by tranquil, 8 years ago

implemented constant propagation in LTL
cleaned up translations in optimizations, a new module for translations is available

File size: 512 bytes
RevLine 
[1580]1(** This module gives lists with internal binders. *)
2
3type ('a, 'b) t =
4  | BNil
5  | BCons of 'a * ('a, 'b) t
6  | BNew of ('b -> ('a, 'b) t)
7
8let (^::) x l = BCons (x, l)
9
10let rec (^@) l1 l2 = match l1 with
11  | BNil -> l2
12  | BCons (x, l1') -> BCons (x, l1' ^@ l2)
13  | BNew f -> BNew (fun x -> f x ^@ l2)
14
15let (?^) f = BNew f
16
17let b_rev l =
18  let rec rev_acc acc = function
19    | BNil -> acc
20    | BCons (x, l) -> rev_acc (BCons (x, acc)) l
21    | BNew f -> BNew (fun x -> rev_acc acc (f x)) in
22  rev_acc BNil l
Note: See TracBrowser for help on using the repository browser.