Skip to content

Instantly share code, notes, and snippets.

@iamandrewluca
Last active January 30, 2020 10:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamandrewluca/47f0be82c7ae8e2a8f15cf279f80e34c to your computer and use it in GitHub Desktop.
Save iamandrewluca/47f0be82c7ae8e2a8f15cf279f80e34c to your computer and use it in GitHub Desktop.
(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