aboutsummaryrefslogtreecommitdiff
path: root/lib/math/rational.ex
diff options
context:
space:
mode:
authorAnhgelus Morhtuuzh <william@herges.fr>2025-11-10 17:31:41 +0100
committerAnhgelus Morhtuuzh <william@herges.fr>2025-11-10 17:31:41 +0100
commit4840f480c8f255a6cf3b4eed291a00cea76b0cac (patch)
treed9baf898c1e961bb8ee5d181c38cce93b062129b /lib/math/rational.ex
parent037094a928653ed27f1f9d5497f637af1c5380e0 (diff)
feat(calc): supports function definition and evaluation
Diffstat (limited to 'lib/math/rational.ex')
-rw-r--r--lib/math/rational.ex5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/math/rational.ex b/lib/math/rational.ex
index c3d94c9..e788883 100644
--- a/lib/math/rational.ex
+++ b/lib/math/rational.ex
@@ -83,9 +83,8 @@ defmodule ElixirMathParser.Math.Rational do
iex> Rational.is_rational("My quick brown fox")
false
"""
- defguard is_rational(val)
- when is_map(val) and is_map_key(val, :__struct__) and is_struct(val) and
- :erlang.map_get(:__struct__, val) == __MODULE__
+ def is_rational(val) when is_map(val) and is_map_key(val, :__struct__) and is_struct(val),
+ do: :erlang.map_get(:__struct__, val) == __MODULE__
@doc """
Creates a new Rational number.