Converting python code into julia code

The OP seems to be trying to re-implement the Matlab buffer function (see their other thread: Convert buffer function existing in matlab to julia language). (Apparently they found a Python implementation and are now trying to port that, rather than starting from the spec?) This really seems better to implement via an array or iterator of views rather than copies.

See my suggestion in the other thread, which boils down to the one-liner @views stack([X[i:i+n-1] for i in firstindex(X):n-p:lastindex(X)-n+1]).

2 Likes