Cody

Solution 1389418

Submitted on 21 Dec 2017 by Thomas Steffen
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
expr = "(+ 1 1 1 1 1)"; assert(isequal(eval_lisp(expr), 5));

x = 1 x = 1 x = 1 x = 1 x = 1 x = 5

2   Pass
expr = "(+ 1 5)"; assert(isequal(eval_lisp(expr), 6));

x = 1 x = 5 x = 6

3   Pass
expr = "(+ 1 1 1 1 1 1 1 1 1 1 1 1 1)"; assert(isequal(eval_lisp(expr), 13));

x = 1 x = 1 x = 1 x = 1 x = 1 x = 1 x = 1 x = 1 x = 1 x = 1 x = 1 x = 1 x = 1 x = 13

4   Pass
expr = "(+ 1 2 3 4 5 6 7 8 9 10)"; assert(isequal(eval_lisp(expr), 55));

x = 1 x = 2 x = 3 x = 4 x = 5 x = 6 x = 7 x = 8 x = 9 x = 10 x = 55

5   Pass
expr = "(* 1 2 3 4 5 6 7 8 9 10)"; assert(isequal(eval_lisp(expr), 3628800));

x = 1 x = 2 x = 3 x = 4 x = 5 x = 6 x = 7 x = 8 x = 9 x = 10 x = 3628800

6   Pass
expr = "(* (* 10 (+ 1 4)) (+ 10 (/ 12 2 3) 1) 0.1)"; assert(isequal(eval_lisp(expr), 65));

x = 10 x = 1 x = 4 x = 5 x = 50 x = 10 x = 12 x = 2 x = 3 x = 2 x = 1 x = 13 x = 0.1000 x = 65