summaryrefslogtreecommitdiff
path: root/defun-1.lisp
blob: a0c2416a3645526ca7ec442f0e7d4d680a3a4407 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
(%defmacro* defun (name lambda-list . body)
  (let ((lambda-sym (gensym)))
    `(%defun ,name ,lambda-sym
       (d-b ,lambda-list nil nil ,lambda-sym
         ,@body))))

(%defmacro* defmacro (name lambda-list . body)
  (let ((arg-sym (gensym))
        (lambda-sym (gensym))
        (whole-sym (gensym))
        (env-sym (gensym)))
    `(%defmacro ,name ,arg-sym
       (let ((,whole-sym (first ,arg-sym))
             (,lambda-sym (cdr (first ,arg-sym)))
             (,env-sym (second ,arg-sym)))
         (d-b ,lambda-list ,env-sym ,whole-sym ,lambda-sym
           ,@body)))))


(export '(defmacro defun))