Please I need help with this Enum.max_by code snippet

This code snippet always returns the same item regardless of the item passed.

  def fuzzy_match(x, items) do
    m = Enum.max_by(items, fn i ->, x.desc, i.desc) end)
    IO.puts("fuzzy: #{inspect(m)}")

Please what have I missed?

What items do you pass in and what do you say the output should be for each?


The first item in the list was blank, hence throwing off the results

1 Like

@OvermindDL1 the source data had blank strings in the desc. it would seems this throws off the fuzzy_match algorithm

1 Like