Initial upload

This commit is contained in:
2022-08-24 14:28:45 +02:00
parent c67653ddee
commit 57bc7b0289
370 changed files with 18479 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
defmodule RPNCalculator do
def calculate!(stack, operation) do
operation.(stack)
end
def calculate(stack, operation) do
try do
{:ok, operation.(stack)}
rescue
_ in RuntimeError -> :error
end
end
def calculate_verbose(stack, operation) do
try do
{:ok, operation.(stack)}
rescue
e in ArgumentError -> {:error, e.message}
end
end
end