Closed mrufsvold closed 1 year ago
@mrufsvold sorry for the late response. This already exists with Scan
:
julia> [1,2,3,4] |> Scan(*, 1) |> collect
4-element Vector{Int64}:
1
2
6
24
See https://juliafolds.github.io/Transducers.jl/dev/reference/manual/#Transducers.Scan in the manual for more details/
I'd like to create a Transducer that works like
Base.accumulate
where each element is passed into a function along with the result of the previous call. For example:I'm relatively new to the vernacular of functional programming, so it's quite possible I'm overlooking a function that provides this functionality already. But if not, it would be great to have!