- match (l1, l2) with
- ((head1::tail1), (head2::tail2)) ->
- (match (head1, head2) with
- ([], _) -> assert false (* gli header non devono mai essere vuoti *)
- | (_, []) -> assert false (* devono contenere almeno [retVal] *)
- | (_, _) ->
- (match (tail1, tail2) with
- ([], _) -> [["retVal"]] (* se una delle due code e' vuota... *)
- | (_, []) -> [["retVal"]] (* ... l'intersezione e' vuota *)
- | (_, _) ->
- [head2 @
- (List.find_all
- (function t -> not (List.mem t head2))
- head1
- )
- ] (* header del risultato finale *)
- @
- intersect_tails (List.tl head1) tail1 (List.tl head2) tail2
- (*
- List.fold_left
- (fun par1 elem1 -> par1 @
- List.map
- (fun elem2 ->
- [(List.hd elem1)] @
- (xres_join_context (List.tl head1) (List.tl elem1)
- (List.tl head2) (List.tl elem2)
- )
- )
- (List.find_all (* *)
- (fun elem2 -> (* trova tutti gli elementi della lista tail2 *)
- ((List.hd elem1) = (List.hd elem2)) && (* che stanno in tail1 *)
- not ((xres_join_context (List.tl head1) (List.tl elem1)
- (List.tl head2) (List.tl elem2)) = [])
- (* e per i quali la xres_join_context non sia vuota *)
+ (* PRE-CLAUDIO
+ (*let _ = print_string ("INTERSECT ")
+ and t = Unix.time () in*)
+ let result =
+ match (l1, l2) with
+ ((head1::tail1), (head2::tail2)) ->
+ (match (head1, head2) with
+ ([], _) -> assert false (* gli header non devono mai essere vuoti *)
+ | (_, []) -> assert false (* devono contenere almeno [retVal] *)
+ | (_, _) ->
+ (match (tail1, tail2) with
+ ([], _) -> [["retVal"]] (* se una delle due code e' vuota... *)
+ | (_, []) -> [["retVal"]] (* ... l'intersezione e' vuota *)
+ | (_, _) ->
+ [head2 @
+ (List.find_all
+ (function t -> not (List.mem t head2))
+ head1
+ )
+ ] (* header del risultato finale *)
+ @
+ intersect_tails (List.tl head1) tail1 (List.tl head2) tail2
+ (*
+ List.fold_left
+ (fun par1 elem1 -> par1 @
+ List.map
+ (fun elem2 ->
+ [(List.hd elem1)] @
+ (xres_join_context (List.tl head1) (List.tl elem1)
+ (List.tl head2) (List.tl elem2)
+ )