Cody

# Problem 44382. Parse me a Lisp

Solution 1330410

Submitted on 7 Nov 2017 by Anselm Karl
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));

(+ 1 1 1 1 1) 5

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

(+ 1 5) 6

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

(+ 1 1 1 1 1 1 1 1 1 1 1 1 1) 13

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

(+ 1 2 3 4 5 6 7 8 9 10) 55

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

(* 1 2 3 4 5 6 7 8 9 10) 3628800

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

(* (* 10 (+ 1 4)) (+ 10 (/ 12 2 3) 1) 0.1) (* (* 10 5) (+ 10 (/ 12 2 3) 1) 0.1) (* 50 (+ 10 (/ 12 2 3) 1) 0.1) (* 50 (+ 10 2 1) 0.1) (* 50 13 0.1) 65

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!