From 12bcda2d2293082e8e3f8f9a04c8a42f6550cc8c Mon Sep 17 00:00:00 2001 From: Patrick Michl Date: Wed, 1 Dec 2021 08:10:57 +0100 Subject: [PATCH] parameterize functions for faster compilation --- src/day_1.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/day_1.jl b/src/day_1.jl index 949a648..5361499 100644 --- a/src/day_1.jl +++ b/src/day_1.jl @@ -1,8 +1,8 @@ include(joinpath(readchomp(`git rev-parse --show-toplevel`), "aoc.jl")) import .Aoc: @aoc -function sliding(in, w) - ((@view in[i:i+w-1]) for i in 1:1:length(in)-w+1) +function sliding(in, w::Int64; step::Int = 1) + ((@view in[i:i+w-1]) for i in 1:step:length(in)-w+1) end function day1(in, w) @@ -17,12 +17,12 @@ function day1(in, w) c end -function p1(input) +function p1(input::Vector{String}) day1(input, 1) end -function p2(input) +function p2(input::Vector{String}) day1(input, 3) end