Skip to content

Instantly share code, notes, and snippets.

@monroth
monroth / infix-mode.lisp
Created June 2, 2020 11:20
Infix mode for Common Lisp
(defparameter *infix-operator-order* '((!) (^ :reverse) (* /) (+ -) (> < >= <= =) (and) (or) (eql)))
(defparameter *infix-operator-set* '(+ * ^ - / ! = and or eql))
(defparameter *unary-operator-set* '(!))
(defparameter *infix-operator-hash* (let ((local-hash (make-hash-table)))
(setf (gethash '+ local-hash) '+)
(setf (gethash '* local-hash) '*)
(setf (gethash '^ local-hash) 'expt)