diff module

This module provides a function to compute differences between two lists/arrays.

revision = diff( original , revised )
revision . size()

diff() compute the difference of the specified two sequences. The sequences can be either of the following types.

If String or File is specified as a parameter, the lines in the file are to be compared. If Reader or InputStram is specified, a collection of the lines is created first, then compared with the other parameter.

size() returns the number of chunks. 0 means no difference.

> r = diff([1,2,3], [1,3,4])

2d1
< 2
3a3
> 4

> r.size()
2
patch( revision, original )

patch() applies the patch to original to get revised.

> patch(r, [1,2,3])
[1, 3, 4]
parseDiff( ( Reader | InputStream | String | File ) input )

parseDiff() parses a diff-formatted text reading from input, and returns the same type of object that diff() returns.

parseDiff("diff.txt")