1. Replacing a vslice
- Posted by evanmars Mar 16, 2018
- 1109 views
Is it possible to do something like this?
sequence s = {{1,2,3},{4,5,6},{7,8,9}} sequence temp = vslice(s,3} temp = rotate(temp,ROTATE_RIGHT) s = replace_vslice(temp,s,3) -- Insert the previous vslice back in s after it has been rotated -- s is {{1,2,9},{4,5,3},{7,8,6}}
2. Re: Replacing a vslice
- Posted by petelomax Mar 16, 2018
- 1098 views
try this:
global function replace_vslice(sequence rep, sequence source, integer column) for i=1 to length(rep) do source[i][column] = rep[i] end for return source end function
3. Re: Replacing a vslice
- Posted by evanmars Mar 16, 2018
- 1067 views
Thanks. That's pretty much what I am doing. Just wondered if there was defined routine that was faster than iterating through the sequence.
EDIT: Turns out it's plenty fast. It was the way I was using it that slowed things down.