Cody

# Problem 44382. Parse me a Lisp

Solution 1324268

Submitted on 2 Nov 2017 by Marco Tullio
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));

ss = '(+ 1 1 1 1 1)' i = 5×1 logical array 1 0 0 0 0 x = 5

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

ss = '(+ 1 5)' i = 5×1 logical array 0 1 0 0 0 x = 6

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

ss = '(+ 1 1 1 1 1 1 1 1 1 1 1 1 1)' i = 5×1 logical array 0 0 1 0 0 x = 13

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

ss = '(+ 1 2 3 4 5 6 7 8 9 10)' i = 5×1 logical array 0 0 0 1 0 x = 55

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

ss = '(* 1 2 3 4 5 6 7 8 9 10)' x = 3628800

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

ss = '(* (* 10 (+ 1 4)) (+ 10 (/ 12 2 3) 1) 0.1)' i = 5×1 logical array 0 0 0 0 1 x = 65