needs tests/harness text/diff testbegin \test max[]= create a1 map< , 1 2 3 4 5 create a2 map< , 1 2 9 4 5 a1 5 a2 5 max[]= 2 #eq a1 5 a2 1 max[]= 1 #eq a1 0 a2 5 max[]= 0 #eq \test lcs create a1 map< , 1 2 3 4 5 create a2 map< , 1 2 1 2 3 4 1 2 3 a1 5 a2 9 lcs 4 #eq 2 #eq \test diffcrcs[] : #hunk= ( lidx ridx delcnt addcnt lidx ridx delcnt addcnt -- ) 5 roll #eq 4 roll #eq rot #eq #eq ; create a1 map< , 1 2 3 4 5 create a2 map< , 1 3 4 6 7 5 a1 5 a2 6 diffcrcs[] 2 #eq 4 3 0 2 #hunk= 1 1 1 0 #hunk= \test diffcrcs[] compound deletions create a1 map< , 1 2 3 4 5 create a2 map< , 1 2 5 a1 5 a2 3 diffcrcs[] 1 #eq 2 2 2 0 #hunk= \test diffcrcs[] replacement create a1 map< , 1 2 3 4 5 create a2 map< , 1 2 8 4 5 a1 5 a2 5 diffcrcs[] 1 #eq 2 2 1 1 #hunk= \test diffcrcs[] tail replacement create a1 map< , 1 2 3 create a2 map< , 1 2 4 a1 3 a2 3 diffcrcs[] 1 #eq 2 2 1 1 #hunk= \test diff[] : #hunk= ( hunk lidx ridx delcnt addcnt -- ) 5 roll 16 + 4 0 do 4- tuck @ #eq loop drop ; "abc\ndef\nghi" c@+ "abc\nYYY\ndef\nXXX" c@+ diff[] 2 #eq dup 1 1 0 1 #hunk= 16 + 2 3 1 1 #hunk= \test skipline "ghi" "abc\ndef\nghi" c@+ skipline skipline #s[]= \test .diff[] \ no assert, just print the diff "abc\ndef\nghi" c@+ "abc\nYYY\ndef\nXXX" c@+ .diff[] testend