exercism-elixir/boutique-suggestions/lib/boutique_suggestions.ex
2022-02-10 14:09:24 -04:00

12 lines
315 B
Elixir

defmodule BoutiqueSuggestions do
def get_combinations(tops, bottoms, options \\ []) do
max = Keyword.get(options, :maximum_price, 100)
for top <- tops,
bottom <- bottoms,
top.base_color != bottom.base_color,
top.price + bottom.price < max do
{top, bottom}
end
end
end