0

Is there a way to evaluate long expressions in CLIPS rule based programming language. I know how to evaluate single/simple expressions such as +, -, *, /, etc.

(+ 3 5)=>(3+5)=8

Is there an easy way to evaluate an expression like 10+4*19-35/12 in CLIPS without evaluating each part of the expression separately.

Eswar
  • 1,201
  • 19
  • 45

1 Answers1

0

Initially I used only one pair of brackets for the entire expression. The answer to question lies in using the brackets indicating which all expression have to be evaluated before the other. It kinda indicates the order of evaluation.

(+ 10 (- (* 4 19) (/ 35 12)))

The above expression will give the correct answer of 83.0833.

Eswar
  • 1,201
  • 19
  • 45