Created
May 17, 2011 19:23
-
-
Save jasonjckn/977174 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
(defn-match inf->pre-one-level | |
([[?func & ?x]] whatever_is_passed_in) ;;; where ?func is a function | |
([[?x ?op ?y]] [op x y]) ;;;; where ?op belongs to ['+, '-, '*, etc] | |
([[?x ?op1 ?y ?op2 & ?args]] | |
(if (< (prec op1) (prec op2)) | |
[op1 x (inf->pre-one-level (apply list y op2 args))] | |
(inf->pre-one-level (concat [[op1 x y] op2] args)))) | |
([?x] x)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment