Day 2
This commit is contained in:
@@ -1,4 +1,15 @@
|
||||
defmodule Aoc2023.Common do
|
||||
def stringify(s) when is_binary(s) do s end
|
||||
def stringify(n) when is_integer(n) do inspect(n) end
|
||||
def stringify(nil), do: "nil"
|
||||
|
||||
def map_nth(tup, n, fun) do
|
||||
put_elem(tup, n, fun.(elem(tup, n)))
|
||||
end
|
||||
|
||||
defmacro pipe(expr) do
|
||||
quote do
|
||||
fn (val) -> val |> unquote(expr) end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user