Created
August 23, 2016 15:48
-
-
Save feuery/bbe2834024d0633e04fb8430f25bc2e7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun rpn->infix (expr) | |
"Outputs expr in infix form. For example\n(rpn->infix '(< x1 (+ x2 w2))) => x1 < x2 + w2\n\nI'm not going to write an interactive version cause I don't remember how to command emacs' interactive-fn :D" | |
(let* ((symbol (car expr)) | |
(param1 (cadr expr)) | |
(param2 (caddr expr))) | |
(insert (prin1-to-string param1) " " | |
(prin1-to-string symbol) " ") | |
(if (atom param2) | |
(insert (prin1-to-string param2)) | |
(rpn->infix param2)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment