Надо построчно объяснить какие действия происходят
(defun work-word (word)
(defun word-cycle (rest-word prev count)
(if (null rest-word)
(if (= count 0)
'()
(cons (+ 1 count) '()))
(if (eq (car rest-word) prev)
(word-cycle (cdr rest-word)
prev
(+ count 1))
(if (= 0 count)
(cons (car rest-word)
(word-cycle (cdr rest-word)
(car rest-word)
0))
(cons (+ 1 count)
(cons (car rest-word)
(word-cycle (cdr rest-word)
(car rest-word)
0)))))))
(word-cycle word '() 0))
(defun work-proc (text)
(mapcar '(lambda (sentence)
(mapcar '(lambda (word)
(pack (work-word (unpack word))))
sentence))
text))
(prin1 (work-proc '((aaabb ccccddd) (eeefggg hhkl))))
(defun work-word (word)
(defun word-cycle (rest-word prev count)
(if (null rest-word)
(if (= count 0)
'()
(cons (+ 1 count) '()))
(if (eq (car rest-word) prev)
(word-cycle (cdr rest-word)
prev
(+ count 1))
(if (= 0 count)
(cons (car rest-word)
(word-cycle (cdr rest-word)
(car rest-word)
0))
(cons (+ 1 count)
(cons (car rest-word)
(word-cycle (cdr rest-word)
(car rest-word)
0)))))))
(word-cycle word '() 0))
(defun work-proc (text)
(mapcar '(lambda (sentence)
(mapcar '(lambda (word)
(pack (work-word (unpack word))))
sentence))
text))
(prin1 (work-proc '((aaabb ccccddd) (eeefggg hhkl))))