While I do have some experience with other Lisps, I'm fairly new to
Common Lisp and SBCL, and so I'd need some help with common practices.
In particular, I'm wondering how to best represent 2D coordinates in CL,
especially such that SBCL can easily optimize operations on them.
Although I guess the most easily optimizable representation would be to
return multiple values, one for each axis, but it would be really
helpful if I could represent coordinates as a single value, in order to
do compound algebra on them, such as "(coord-add a (coord-mul b 2))" or
similar. I will only be dealing with integer coordinates (and probably
within fixnum range, but I'm not entirely sure).
If I use vectors for coordinates, would SBCL be able to inline compound
operations such as the above on them without actually consing vectors
for each step? (Vectors would obviously be quite convenient as well,
since I could construct a coordinate with "#(x y)"). If not, how about
structs? Lists? Conses? Would there be any other particular reasons to
choose a certain representation over the others?
Thanks for reading!