Longest common subsequence: Difference between revisions

Added PicoLisp
(Added PicoLisp)
Line 575:
in
{System.showInfo {LCS "thisisatest" "testing123testing"}}</lang>
 
=={{header|PicoLisp}}==
<lang PicoLisp>(de commonSequences (A B)
(when A
(conc
(when (member (car A) B)
(mapcar '((L) (cons (car A) L))
(cons NIL (commonSequences (cdr A) (cdr @))) ) )
(commonSequences (cdr A) B) ) ) )
 
(maxi length
(commonSequences
(chop "thisisatest")
(chop "testing123testing") ) )</lang>
Output:
<pre>-> ("t" "s" "i" "t" "e" "s" "t")</pre>
 
=={{header|Python}}==
Anonymous user