aboutsummaryrefslogtreecommitdiff
path: root/_pastebins/rpn-macro-setup.md
diff options
context:
space:
mode:
Diffstat (limited to '_pastebins/rpn-macro-setup.md')
-rw-r--r--_pastebins/rpn-macro-setup.md27
1 files changed, 27 insertions, 0 deletions
diff --git a/_pastebins/rpn-macro-setup.md b/_pastebins/rpn-macro-setup.md
new file mode 100644
index 0000000..5ebe3ab
--- /dev/null
+++ b/_pastebins/rpn-macro-setup.md
@@ -0,0 +1,27 @@
+---
+title: RPN macro setup
+date: 2016-04-05
+layout: pastebin
+lang: en
+---
+
+```lisp
+(defmacro rpn (body)
+ (rpn-expander body))
+
+(defun rpn-expander (body)
+ (mapcar (lambda (x)
+ (if (listp x)
+ (rpn-expander x)
+ x))
+ (reverse body)))
+
+(rpn ((2 1 +) 2 *))
+; => 6
+
+#|
+Just a quick stub.
+
+One could easily improve #'RPN-EXPANDER in order to better suit one's needs.
+|#
+```