Skip to content

Commit

Permalink
Removed nil default for option
Browse files Browse the repository at this point in the history
  • Loading branch information
paulsullivanjr committed Oct 23, 2023
1 parent 3a2b9a9 commit ce1e47a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
3 changes: 1 addition & 2 deletions lib/scholar/metrics/discounted_cumulative_gain.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ defmodule Scholar.Metrics.DiscountedCumulativeGain do

opts = [
k: [
default: nil,
type: {:custom, Scholar.Options, :positive_number_or_nil, []},
type: {:custom, Scholar.Options, :positive_number, []},
doc: "Truncation parameter to consider only the top-k elements."
]
]
Expand Down
3 changes: 0 additions & 3 deletions lib/scholar/options.ex
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,4 @@ defmodule Scholar.Options do
{:error,
"expected metric to be a :cosine or tuple {:minkowski, p} where p is a positive number or :infinity, got: #{inspect(metric)}"}
end

def positive_number_or_nil(nil), do: {:ok, nil}
def positive_number_or_nil(k), do: positive_number(k)
end

0 comments on commit ce1e47a

Please sign in to comment.