using RollingFunctions
π·ππ‘π = [1, 2, 3, 4, 5]
πΉπ’ππ = sum
ππππ = 3
result = running(πΉπ’ππ,π·ππ‘π, ππππ)
julia> result
3-element Vector{Int64}:
6
9
12
#=
The first windowed value is the πΉπ’ππ (sum) of the first ππππ (3) values in π·ππ‘π.
The second windowed value is the πΉπ’ππ (sum) of the second ππππ (3) values in π·ππ‘π.
The third windowed value is the πΉπ’ππ (sum) of the third ππππ (3) values in π·ππ‘π.
There can be no fourth value as the third value used the fins entries inπ·ππ‘π.
=#
julia> sum(π·ππ‘π[1:3]), sum(π·ππ‘π[2:4]), sum(π·ππ‘π[3:5])
(6, 9, 12)
If the width of each subsequence increases to 4..
ππππ = 4
result = running(πΉπ’ππ,π·ππ‘π, ππππ);
result
2-element Vector{Int64}:
10
14