Posted to tcl by kbk at Fri Mar 23 15:35:35 GMT 2018view pretty

package require struct::list
set seq1 {a b r a c a d b r a}
set seq2 {  b r i c a   b r a c}
set len1 [llength $seq1]
set len2 [llength $seq1]
set lcs [struct::list longestCommonSubsequence $seq1 $seq2]
set diffs [struct::list lcsInvert $lcs $len1 $len2]
puts [join $diffs \n]