defsubst
authorRobin Templeton <robin@terpri.org>
Tue, 5 Aug 2014 03:11:43 +0000 (23:11 -0400)
committerRobin Templeton <robin@terpri.org>
Tue, 21 Apr 2015 23:36:29 +0000 (19:36 -0400)
module/language/elisp/boot.el

index fe9af29..fae86a2 100644 (file)
        (%funcall (@ (language elisp runtime) symbol-plist) ',name)))
      ',name))
 
+(defmacro defsubst (name args &rest body)
+  `(progn
+     (defun ,name ,args ,@body)
+     (eval-and-compile
+       (%define-compiler-macro ,name (form)
+         (%funcall (@ (guile) cons*)
+                   '%funcall
+                   (%funcall
+                    (@ (guile) list)
+                    'function
+                    (%funcall (@ (guile) cons*) 'lambda ',args ',body))
+                   (%funcall (@ (guile) cdr) form))))))
+
 (eval-and-compile
   (defun eval (form)
     (%funcall (@ (language elisp runtime) eval-elisp) form)))