fix compiler warnings
This commit is contained in:
parent
6e8cb62c40
commit
857a26892e
2 changed files with 6 additions and 6 deletions
|
@ -17,7 +17,7 @@ defmodule Mix.Tasks.Day3 do
|
|||
for [pre, curr, post] <-
|
||||
s
|
||||
|> then(fn x -> Enum.concat([""], x) end)
|
||||
|> Enum.chunk(3, 1)
|
||||
|> Enum.chunk_every(3, 1)
|
||||
|> Enum.map(fn u -> Enum.map(u, &String.trim/1) end),
|
||||
[{index, length}] <- Regex.scan(@r_digits, curr, return: :index),
|
||||
contains_symbol(String.slice(curr, max(index - 1, 0), length + 2)) ||
|
||||
|
@ -32,7 +32,7 @@ defmodule Mix.Tasks.Day3 do
|
|||
def part2(s) do
|
||||
for [pre, curr, post] <-
|
||||
s
|
||||
|> Enum.chunk(3, 1)
|
||||
|> Enum.chunk_every(3, 1)
|
||||
|> Enum.map(fn u -> Enum.map(u, &String.trim/1) end),
|
||||
curr |> String.contains?("*"),
|
||||
[{gear_idx, _}] <- Regex.scan(~r/\*/, curr, return: :index),
|
||||
|
|
|
@ -79,10 +79,6 @@ defmodule Mix.Tasks.Day5 do
|
|||
n
|
||||
end
|
||||
|
||||
def get_location(:location, range) do
|
||||
[range]
|
||||
end
|
||||
|
||||
def get_location(source, n, maps) when is_integer(n) do
|
||||
{dest, ranges} = maps |> Map.get(source)
|
||||
|
||||
|
@ -96,6 +92,10 @@ defmodule Mix.Tasks.Day5 do
|
|||
get_location(dest, transpose, maps)
|
||||
end
|
||||
|
||||
def get_location(:location, range) do
|
||||
[range]
|
||||
end
|
||||
|
||||
def get_location(source, range) do
|
||||
{dest, ranges} = :persistent_term.get(:maps) |> Map.get(source)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue