Skip to content

Commit 618fdb6

Browse files
committed
Export infix-to-prefix and add unit tests
1 parent 9b2de50 commit 618fdb6

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/package.lisp

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#:make-biconditional
4141
#:*valid-operators*
4242
#:prefix-to-infix
43+
#:infix-to-prefix
4344
#:print-truth-table ;; truth-table.lisp
4445
#:eval-expression
4546
#:equal-expression

t/test.lisp

+13
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,17 @@
102102
'(p))
103103
"EQUAL EXPRESSION 2")
104104

105+
(diag "== Infix Parsing")
106+
107+
(is (infix-to-prefix '(~ (p v q)))
108+
'(~ (v p q)))
109+
110+
(is (infix-to-prefix '(p => q))
111+
'(=> p q))
112+
113+
(is (infix-to-prefix '((p v q) <=> ((~ p) ^ (~ q))))
114+
'(<=> (v p q)
115+
(^ (~ p)
116+
(~ q))))
117+
105118
(finalize)

0 commit comments

Comments
 (0)