diff options
author | EuAndreh <eu@euandre.org> | 2020-02-23 00:03:30 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2020-02-23 00:03:30 -0300 |
commit | 1ae84a3217375e73a886c4a21e47e681b470f34f (patch) | |
tree | 2e68a496f79942e18c15eaa029cf5607f5ad05d3 | |
parent | TODOs.org (diff) | |
download | euandre.org-1ae84a3217375e73a886c4a21e47e681b470f34f.tar.gz euandre.org-1ae84a3217375e73a886c4a21e47e681b470f34f.tar.xz |
/home/andreh/dev/libre/dotfiles/scripts/ad-hoc/pastebin.sh: Auto-add _pastebins/rpn-macro-setup.md
-rw-r--r-- | _pastebins/rpn-macro-setup.md | 27 |
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. +|# +``` |