Hi Lindsay,
> (de hexSpigot NIL
> (job '((N))
> ...
> : (do 32 (prin (hexSpigot)))
> ...
> 0123456789ABCDEF0123456789ABCDEF-> "F"
> ...
> : (pp 'hexSpigot)
> (de hexSpigot NIL
> (job
> '((N 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12
> 11 10 9 8 7 6 5 4 3 2 1 0 ) )
> ...
> The job vars are being modified and the list N is growing.. using ever
> greater amounts of memory. If I want to reset the spigot, or even clone it
> to have more than one, how would I do that?
The simplest is to use a global:
(setq *HexSpigot '((N)))
(de hexSpigot NIL
(job *HexSpigot
...
and later just do the 'setq' again.
BTW, for an expression like
(ifn N (setq N (0)))
there is 'default'
(default N (0))
So the above could be made a bit easier:
(off *HexSpigot)
(de hexSpigot NIL
(job (default *HexSpigot '((N . (0))))
(prog1
(hex (% (car N) 16))
(setq N (cons (+ 1 (car N)) N)) ) ) )
(do 32 (prin (hexSpigot)))
(off *HexSpigot)
(do 32 (prin (hexSpigot)))
i.e. just call 'off' to reset it :)
♪♫ Alex
--
UNSUBSCRIBE: mailto:[email protected]?subject=Unsubscribe