I'm trying to get a slice of a seq but I only want every second element. I could write a loop that does this but I'm wondering if there is a more elegant way of doing it? In Python you can do:
I know that Arraymancer has this syntax: a[0.._|2] but is there any equivilent for normal seqs? There is none.
Also if by sliced you meant that they share memory, it wouldn't be possible with normal seqs as they always copy (unless you use shallow() or you wrap them in an object with the {.shallow.} pragma like I do in Arraymancer)
Ok, good to know :-)
Copy would have been fine but I'll return to my loop approch instead
Great! :-) will try it out.
What I'm trying to do is that I'm starting a DSP (digital signal processing) module for NumericalNim and getting every Nth element is quite useful.