Re: diff lib

2019-12-19 Thread marks
I think we're doing two different kinds of diff. My library takes sequences `a` 
and `b` and returns a sequence of "spans" (i.e., insert/delete/replace a from 
to, b from to) that if applied to `a` would transform it into `b`. This is 
explained in the Python [difflib 
docs](https://docs.python.org/3/library/difflib.html).


Re: diff lib

2019-12-19 Thread mratsim
I have an advanced differ for arbitrary Nim types if you want to study how to 
transform yours into macro. My use-case is for a test suite so I throw an 
exception as soon as there is a mismatch.

[https://github.com/status-im/nim-beacon-chain/blob/9050db7b/tests/helpers/debug_state.nim#L39-L114](https://github.com/status-im/nim-beacon-chain/blob/9050db7b/tests/helpers/debug_state.nim#L39-L114)


diff lib

2019-12-19 Thread marks
I've ported Python's difflib's sequence matcher to pure Nim: 
[diff](https://github.com/mark-summerfield/diff).

It can be used to see the differences between any two sequences of items that 
support `==` and `hash()` (string, char, or any custom item type with the 
necessary support).