Last active
January 30, 2020 10:14
-
-
Save iamandrewluca/47f0be82c7ae8e2a8f15cf279f80e34c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun cod (list &optional acc) | |
(cond | |
((null list) (reverse acc)) | |
(T (cod | |
(remove (car list) list) | |
(cons | |
(cons | |
(count (car list) list) | |
(cons (car list) nil) | |
) | |
acc | |
) | |
)) | |
) | |
) | |
(print (cod '(A A A 33 2 2 2 F5 F5))) | |
;; ((3 A) (1 33) (3 2) (2 F5)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment