Hello Everyone,
I am Very much new to LISP, I don't have basic knowledge in LISP but I supposed to do project in LISP. I need to evaluate given expression(Just addition, Subtraction, Multiplication, Division), kindly help me to do this. I am using LISPWORKS as tool.
Evalating Expressions
Re: Evalating Expressions
You don't even specify the input!
However, I provide a generel answer.
If you have an arithmetic expression in s-expr form, you can easily evaluate it:
For the standard infix notation of arithmetic expression, feel free to look at general description of Shunting yard algorithm.
However, I provide a generel answer.
If you have an arithmetic expression in s-expr form, you can easily evaluate it:
Code: Select all
(defvar arithmetic-expression '(+ 1 (* 5 6)))
(eval arithmetic-expression) ; = 31
cl-2dsyntax is my attempt to create a Python-like reader. My mirror of CLHS (and the dark themed version). Temporary mirrors of aferomentioned: CLHS and a dark version.
Re: Evalating Expressions
And on Rosetta Code, you have an implementation in CL of the arithmetic expression evaluation. Consider it as an inspiration only.
cl-2dsyntax is my attempt to create a Python-like reader. My mirror of CLHS (and the dark themed version). Temporary mirrors of aferomentioned: CLHS and a dark version.
Re: Evalating Expressions
Thank you so much, I got complete idea over it.
Goheeca wrote:And on Rosetta Code, you have an implementation in CL of the arithmetic expression evaluation. Consider it as an inspiration only.