rpn_calculator v2

This commit is contained in:
Danil Negrienko 2024-03-07 02:05:21 -05:00
parent d1b894006c
commit 7ae168f5ea
1 changed files with 6 additions and 10 deletions

View File

@ -4,18 +4,14 @@ defmodule RPNCalculator do
end
def calculate(stack, operation) do
try do
{:ok, operation.(stack)}
rescue
_e -> :error
end
{:ok, operation.(stack)}
rescue
_e -> :error
end
def calculate_verbose(stack, operation) do
try do
{:ok, operation.(stack)}
rescue
e -> {:error, e.message}
end
{:ok, operation.(stack)}
rescue
e -> {:error, e.message}
end
end