(define (lcs lst1 lst2)
(define (except-last-pair list)
(if (pair? (cdr list))
(cons (car list) (except-last-pair (cdr list)))
'()))
(define (car-last-pair list)
(if (pair? (cdr list))
(car-last-pair (cdr list))
(car list)))
(if (or (null? lst1) (null? lst2)) null
(if (= (car-last-pair lst1) (car-last-pair lst2))
(append (lcs (except-last-pair lst1) (except-last-pair lst2)) (cons (car-last-pair lst1) '()))
(**if (> (length (lcs lst1 (except-last-pair lst2))) (length (lcs lst2 (except-last-pair lst1))))
(lcs lst1 (except-last-pair lst2))
(lcs lst2 (except-last-pair lst1))))))**
I dont want it to run over and over..
Regards, Superguay