1
0
Fork 0
advent-of-code/2021/lib/aoc_helpers.ex

17 lines
378 B
Elixir
Raw Normal View History

2022-09-21 09:19:53 -04:00
defmodule AOCHelpers do
defmacro __using__(_) do
quote do
def input_number_list(sep \\ ",") do
input_string()
|> String.trim()
|> String.split(sep)
|> Enum.map(&String.to_integer/1)
end
def iterate(times, start, fun) do
Enum.reduce(1..times, start, fn _, current -> fun.(current) end)
end
end
end
end