Skip to content

Instantly share code, notes, and snippets.

@cvmat
Created February 12, 2012 14:46
Show Gist options
  • Save cvmat/1808885 to your computer and use it in GitHub Desktop.
Save cvmat/1808885 to your computer and use it in GitHub Desktop.
(defun generate-index (n &optional m l)
(let ((base (mapcar 'char-to-string (number-sequence ?a ?z))))
(cond
((null m)
(generate-index n 0 l))
((<= n m)
l)
((null l)
(generate-index n (1+ m) base))
(t
(generate-index
n (1+ m)
(apply 'append l (mapcar (lambda (str)
(mapcar (lambda (e)
(concat str e))
l))
base)))))))
(generate-index 3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment