Created
June 25, 2013 17:11
-
-
Save fowlmouth/5860323 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fowltek/pointer_arithm | |
proc get_shiterator[T] (some: var seq[T]; idx: TSlice[int]): tuple[start,fin: ptr T] = | |
(some[idx.a].addr, some[idx.b].addr) | |
var x = @[1,2,3,4,3,2,1] | |
var (start,fin) = x.get_shiterator(1..5) | |
while start <= fin: | |
echo start[] | |
start.inc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment