summaryrefslogtreecommitdiff
path: root/happy-birthday.el
blob: 9e6a9fda82e1a0f4e7db2977d4a8da90c9125485 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
;;; happy-birthday.el --  -*- lexical-binding: t -*-

(defmacro seb (&rest x)
  (let ((r) (w))
    (dolist (e x)
      (cond ((eq e '!) (push ?a w))
            ((eq e '!?)
             (push (intern (apply 'string w)) r)
             (setf w nil))
            ((eq e '()) (setf (car w) (1+ (car w))))))
    `(quote ,r)))
(seb
 ! () ! () () () () ! () () () () () () () () () () ()
 () () () () () () () !? ! () () () () () () () ()
 () () () () () () () () () () () () () () () () ! !
 () () () ! () () () () () () () ! () () () () () ()
 () () () () () () () () () () () () () ! () () ()
 () () () () () () () () () () () () () () ! () ()
 () () () () () () ! () !? ! () () () () () () () ()
 () () () () () () () () () () () () () () () () !
 () () () () () () () () () () () () () () () ! ()
 () () () () () () () () () () () () () () ! ! () ()
 () () () () () !?)


(mapcan
 (lambda (w)
   (let (r)
     (push '!? r)
     (mapc (lambda (c)
             (cl-loop for i below (- c ?a)
                      do (push '() r))
             (push '! r))
           w)
     r))
 (reverse (string-split "happy birthday seb")))