Incrementing a setq ID?

2 views
Skip to first unread message

Ben Trafford

unread,
Jan 2, 2010, 11:52:45 AM1/2/10
to tin...@googlegroups.com

Hi,

I'm trying to increment a setq's identifier dynamically. e.g. I want it
to go (ideally) from A to B to C and so forth.

I'm sure someone's had this problem before. Anybody got any hints?

--->Ben

Stephen Brewer

unread,
Jan 2, 2010, 6:55:19 PM1/2/10
to tin...@googlegroups.com
Depends on how you're doing it.

You can setq(0,0) as your index to the current register count, and then something like:

[setq(0,inc(%q0))][setq(pack(%q0,36),Whatever.)]

If you're iterating through something you can do:

iter(list of a bunch of items,[do whatever][setq(pack(inum(),36),Whatever)])

But that'll run out of registers if you iterate through more than 35 (36 if you do dec(inum()) instead, since inum starts at 1).

That's the best I can do without more info about what you're trying to do.

--Stephen

Ben Trafford

unread,
Jan 2, 2010, 7:20:42 PM1/2/10
to tin...@googlegroups.com

That helps wonderfully, thanks!

--->Ben

Reply all
Reply to author
Forward
0 new messages