Skip to content

Instantly share code, notes, and snippets.

@feuery
Created August 23, 2016 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save feuery/bbe2834024d0633e04fb8430f25bc2e7 to your computer and use it in GitHub Desktop.
Save feuery/bbe2834024d0633e04fb8430f25bc2e7 to your computer and use it in GitHub Desktop.
(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