re: Daily Challenge #16 - Number of People on the Bus VIEW POST

FULL DISCUSSION
 

Elixir:

defmodule Bus do
  @spec passengers([{non_neg_integer, non_neg_integer}]) :: non_neg_integer
  def passengers(list) do
    list
    |> Enum.map(fn {went_on, went_off} -> went_on - went_off end)
    |> Enum.sum()
  end
end
code of conduct - report abuse