Problem 44382. Parse me a Lisp

Description

In Lisp and its variants, function calls are done using parenthesis where the first item in the parenthesis is the function being called and the following items are arguments to the function. Given a mathematical ( + - * / ) expression using this notation, return the result. Note: In Lisp, functions that normally take only two arguments can be called with many arguments, with the function being applied to all elements from left to right.

Simple example

(+ 1 1 1 1 1)

would give 5.

Complicated example

(* (* 10 (+ 1 4)) (+ 10 (/ 12 2 3) 1) 0.1)

would give 65.

Solution Stats

39.32% Correct | 60.68% Incorrect
Last Solution submitted on Jan 24, 2023

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers86

Suggested Problems

More from this Author56

Problem Tags

Community Treasure Hunt

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

Start Hunting!