update for new carp

This commit is contained in:
2020-05-05 13:56:22 +02:00
parent fa8991082a
commit 9787870aa7

View File

@@ -1,7 +1,7 @@
(defndynamic null? [l] (= (length l) 0)) (defndynamic null? [l] (= (length l) 0))
(defndynamic infix-prec [op] (defndynamic infix-prec [op]
(if (Dynamic.or (= op '+) (= op '-)) 1 (if (or (= op '+) (= op '-)) 1
(if (= 'pow op) 3 (if (= 'pow op) 3
2))) 2)))
@@ -19,7 +19,7 @@
(if (list? (car expr)) (if (list? (car expr))
(infix:parse (cdr expr) operators (cons (infix:parse (car expr)) operands)) (infix:parse (cdr expr) operators (cons (infix:parse (car expr)) operands))
(if (symbol? (car expr)) (if (symbol? (car expr))
(if (Dynamic.or (null? operators) (if (or (null? operators)
(> (infix-prec (car expr)) (infix-prec (car operators)))) (> (infix-prec (car expr)) (infix-prec (car operators))))
(infix-parse (cdr expr) (cons (car expr) operators) operands) (infix-parse (cdr expr) (cons (car expr) operators) operands)
(infix-op expr operators operands)) (infix-op expr operators operands))