From 3b3272b2632a82736e0bea9d0a9f70d5f36208d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BCdiger=20Diedrich?= Date: Wed, 17 Jan 2024 15:51:25 +0100 Subject: [PATCH] formatting --- brc.exs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/brc.exs b/brc.exs index 9196215..7df0fbe 100644 --- a/brc.exs +++ b/brc.exs @@ -1,11 +1,11 @@ Mix.install([ - {:flow, "~> 1.2.4"}, - {:ex_cldr_collation, "~> 0.7.2"} + {:flow, "~> 1.2.4"}, + {:ex_cldr_collation, "~> 0.7.2"} ]) defmodule Brc do - require Logger - + require Logger + def run(path) do for {city, [min, max, mean]} <- parse_file(path) do "#{city}=#{min}/#{max}/#{Float.round(mean, 1)}" @@ -19,10 +19,10 @@ defmodule Brc do def parse_file(path) do Logger.info("parse file #{path}") - File.stream!(path) - |> Flow.from_enumerable() - |> Flow.map(&parse_line/1) - |> Flow.partition() + File.stream!(path) + |> Flow.from_enumerable() + |> Flow.map(&parse_line/1) + |> Flow.partition() |> Flow.reduce(fn -> %{} end, fn {city, temp}, acc -> Map.update(acc, city, [temp, temp, temp], fn [prev_min, prev_max, mean] -> [min(prev_min, temp), max(prev_max, temp), (mean + temp) / 2] @@ -36,4 +36,4 @@ defmodule Brc do end end -Brc.run("./priv/data.txt") +Brc.run("./measurements.txt")