I have to create a list of tuple
I have a function which takes a map
def some_func() do
list_of_map = Utils.decode_json(@path)
Enum.flat_map(list_of_map, fn i ->
list = i_distance(i)
IO.inspect list
end)
end
defp i_distance(%{
"a" => a,
"b" => b,
"c" => c,
"d" => d
}) do
{a, _} = Float.parse(a)
{b, _} = Float.parse(b)
distance =
calculate_distance(@e, @f, a, b)
if distance < 100, do: {c, d}
end
I want to create a list of [{user_id, name}] append together for each element of the map only when they are less than 100 needs to be in a list
so the output will be those element appended together [{123, "xyz"}, {241, "zxy"}]
and soon