Skip to content

Instantly share code, notes, and snippets.

@ThomasTheSpaceFox
Created October 22, 2018 18:20
Show Gist options
  • Save ThomasTheSpaceFox/ff64aa13bf1f922111b34ce5b981c835 to your computer and use it in GitHub Desktop.
Save ThomasTheSpaceFox/ff64aa13bf1f922111b34ce5b981c835 to your computer and use it in GitHub Desktop.
A basic SSTNPL iterator example.
#SSTNPL tutorial part 3: iterators
var cb=0
#### Basic Iterators ####
uiter itval,test1,@-5,@5
newline
diter itval,test1,@5,@-5
newline
#### Double Iterators ####
u2iter itvalx,itvaly,test2,@-5,@5,@-1,@1
newline
d2iter itvalx,itvaly,test2,@5,@-5,@1,@-1
newline
#### iterating over rows ####
uiter itval,getat1,@0,@2
newline
#### iterating over columns ####
uiter itval,getat1B,@0,@2
newline
#### Over the whole thing ####
u2iter itvalx,itvaly,getat2,@0,@2,@0,@2
newline
stop
#### Our table ####
table sam,3,3
tstr 123
tstr abc
tstr xyz
########### associated subroutines below ###########
#### Basic iterators (subroutine) ####
label test1
dumpd itval
return
#### Double iterators (subroutine) ####
label test2
dumpd itvalx
dumpd itvaly
return
#### iterating over rows (subroutine) ####
label getat1
tabr sam,itval,@0
set cb
chardump cb
return
#### iterating over columns (subroutine) ####
label getat1B
tabr sam,@0,itval
set cb
chardump cb
return
#### over the whole thing (subroutine) ####
label getat2
tabr sam,itvalx,itvaly
set cb
chardump cb
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment