• You have a data sequence π·π‘Žπ‘‘π‘Ž, the Vector[1, 2, 3, 4, 5].
  • The window width π‘†π‘π‘Žπ‘› of each subsequence is 3.
  • The function 𝐹𝑒𝑛𝑐 to be applied over subsequences of π·π‘Žπ‘‘π‘Ž is sum.
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