15/11/18 21:29:20.89 4nC9re2c.net
>>133 Emacs Lisp
(require 'cl-lib)
cl-lib
(defun f (l)
(while l
(let (m)
(cl-mapl (lambda (s)
(princ (car s))
(let ((s (let ((x (nth 0 s)) (y (nth 1 s)))
(and y (if (eq x y) x (car (remove x (remove y '(A B C)))))))))
(and s (push s m))))
l)
(terpri)
(setq l (reverse m)))))
f
(f '(A B B A C A C B B A))
ABBACACBBA
CBCBBBABC
AAABBCCA
AACBACB
ABACBA
CCBAC
CACB
BBA
BC
A
nil