I\'ve written the following bit of code to simulate rolling a six-sided die a number of times and counting how many times each side landed up:
(defun dice (num)
like the post above, the compiler allocates the 0 as constant space. I used to know some tricks for this, one would be make it a macro such:
`',(list 0 0 0 0 0)
=>
?? (I forget and don't have the other machine on to check)
or wrapped in an (eval-when (compile)) ... )
also
(list 0 0 0 0 0)
=>
#.(list 0 0 0 0)
I don't know if this still works (or ever worked). The are also some implentation macros or compiler macros that could help keep the alloaction size constant but the data variable. Don't rememeber off the top of my head anymore.
remeber to use fill (like bzero in c).