1Diffing_with_keys(3)             OCaml library            Diffing_with_keys(3)
2
3
4

NAME

6       Diffing_with_keys  -  When  diffing lists where each element has a dis‐
7       tinct key, we can refine the diffing patch by introducing two composite
8       edit moves: swaps and moves.
9

Module

11       Module   Diffing_with_keys
12

Documentation

14       Module Diffing_with_keys
15        : sig end
16
17
18       When diffing lists where each element has a distinct key, we can refine
19       the diffing patch by introducing two composite edit  moves:  swaps  and
20       moves.
21
22
23       Swap  s exchange the position of two elements.  Swap cost is set to 2 *
24       change - epsilon .  Move s change the position of  one  element.   Move
25       cost is set to delete + addition - epsilon .
26
27       When  the  cost delete + addition is greater than change and with those
28       specific weights, the optimal patch with Swap s and Move s can be  com‐
29       puted directly and cheaply from the original optimal patch.
30
31
32
33
34
35       type 'a with_pos = {
36        pos : int ;
37        data : 'a ;
38        }
39
40
41
42
43
44       val with_pos : 'a list -> 'a with_pos list
45
46
47
48       type ('l, 'r, 'diff) mismatch =
49        | Name of {
50        pos : int ;
51        got : string ;
52        expected : string ;
53        types_match : bool ;
54        }
55        | Type of {
56        pos : int ;
57        got : 'l ;
58        expected : 'r ;
59        reason : 'diff ;
60        }
61
62
63
64
65       type ('l, 'r, 'diff) change =
66        | Change of ('l, 'r, 'diff) mismatch
67        | Swap of {
68        pos : int * int ;
69        first : string ;
70        last : string ;
71        }
72        | Move of {
73        name : string ;
74        got : int ;
75        expected : int ;
76        }
77        | Insert of {
78        pos : int ;
79        insert : 'r ;
80        }
81        | Delete of {
82        pos : int ;
83        delete : 'l ;
84        }
85
86
87       This  specialized  version of changes introduces two composite changes:
88       Move and Swap
89
90
91
92
93       val prefix : Format.formatter -> ('l, 'r, 'diff) change -> unit
94
95
96
97       module Define : functor (D : sig end) -> sig end
98
99
100
101
102
103
104
105OCamldoc                          2022-07-22              Diffing_with_keys(3)
Impressum