hewih wrote:'m using a 2D vector class to represent a position. the position is shared with other classes. one of the class setfs the position, which creates a new instance however and the other classes refer to the old instance. is their a setf or something which only copies the values thus all the other classes have the updated position state?
I'm sorry, but I cannot understand what you mean exactly, because you seem to confuse 'instance' and 'class'. Classes do not 'refer' to instances, if you mean instances of some other classes still refer to the old object, the obviously they do, because how would the not? In general in Lisp there is no implicit copying, so if you do not want to have new instances then do not create them. You can either mutate an existing instance, update all the references or have the references be forwarded by some mutable common object.
hewih wrote:btw: does anybody know of a good vector implementation? i found cl-vectors and vecto which seem to be vector graphics, and GSLL which i can't get to install.
Common Lisp already has
vectors built-in. If you mean vector algebra, then for two dimensional case it is too trivial to create a library for (mostly applications of
MAP and maybe cross-product?).
For higher dimensional vector/matrix algebra usually bindings to external libraries is used, like BLAS/LAPACK (I am not sure which bindings are best, when I needed them I just defined the few functions I needed, maybe
lla or
cl-blapack) or Gnu Scientific Library (bindings are
GSLL which you found), but the do require installing those libraries and are probably overkill for most applications.
I think I have seen some attempts at pure CL vector/matrix libraries (for example
clem), but they usually do not get that far, since this is quite hard in general, and there isn't really much point in duplicating the Fortran effort for serious applications and for less involved ones some application specific functions are quite sufficient.