From d8e400c40c970996599c801974fadb6d49e60fdd Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 10 Oct 2020 14:51:52 -0300 Subject: Enforce all "post" and "pastebin" layouts have dates in filenames --- _pastebins/2016-04-05-rpn-macro-setup.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 _pastebins/2016-04-05-rpn-macro-setup.md (limited to '_pastebins/2016-04-05-rpn-macro-setup.md') diff --git a/_pastebins/2016-04-05-rpn-macro-setup.md b/_pastebins/2016-04-05-rpn-macro-setup.md new file mode 100644 index 0000000..5ebe3ab --- /dev/null +++ b/_pastebins/2016-04-05-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. +|# +``` -- cgit v1.2.3