Variables and history (Calculator)
Add let <name = <expression (prints <name = <value; names are letters, digits and , not starting with a digit, and not ans, sqrt or abs, else Error: bad expression), variables in expressions (Error: unknown name <x if not set) and history, which prints history: and the last 5 results (oldest first, comma separated) or (empty). let does not change ans or the history.
Input: As before.
Output: As before.
Difficulty: Medium. Write your answer in the browser editor, run the examples, then submit it against hidden tests. Python and JavaScript are free; other languages are part of licode Club.
Hint
- Keep variables in a map the parser can read.