From 020c1e77489b772f854bb3288b9c8d2818a6bf9d Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 18 Apr 2025 02:17:12 -0300 Subject: git mv src/content/* src/content/en/ --- src/content/en/pastebins/2016/04/05/rpn.adoc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/content/en/pastebins/2016/04/05/rpn.adoc (limited to 'src/content/en/pastebins/2016/04/05') diff --git a/src/content/en/pastebins/2016/04/05/rpn.adoc b/src/content/en/pastebins/2016/04/05/rpn.adoc new file mode 100644 index 0000000..c567d0d --- /dev/null +++ b/src/content/en/pastebins/2016/04/05/rpn.adoc @@ -0,0 +1,23 @@ += RPN macro setup + +[source,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