89df9abc00e5

Add a handy disassembly macro
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Tue, 05 Jul 2016 16:44:10 +0000
parents 970e21fa14b0
children 6a93a2d2ed60
branches/tags (none)
files package.lisp src/utils.lisp

Changes

--- a/package.lisp	Mon Jul 04 23:35:08 2016 +0000
+++ b/package.lisp	Tue Jul 05 16:44:10 2016 +0000
@@ -6,6 +6,7 @@
   (:use
     #:cl
     #:defstar
+    #:cl-arrows
     #:bones.quickutils)
   (:export
     #:repeat
@@ -15,7 +16,7 @@
     #:recur
     #:when-let
     #:unique-items
-    ))
+    #:dis))
 
 (defpackage #:bones.circle
   (:use #:cl #:defstar)
--- a/src/utils.lisp	Mon Jul 04 23:35:08 2016 +0000
+++ b/src/utils.lisp	Tue Jul 05 16:44:10 2016 +0000
@@ -56,6 +56,15 @@
     :finally (return once)))
 
 
+(defmacro dis (arglist &body body)
+  `(->> '(lambda* ,arglist
+          (declare (optimize speed))
+          ,@body)
+    macroexpand-1
+    (compile nil)
+    disassemble))
+
+
 ;;;; loop/recur
 (defmacro recursively (bindings &body body)
   "Execute body recursively, like Clojure's `loop`/`recur`.