Is this possible in CL (maybe via libaries)?
for example if I have a struct, that can have different number of dimensions, I would do it this way:
Code: Select all
(defstruct mover
(pos nil :type vector)
(vel nil :type vector))
Code: Select all
(defstruct mover2d
px py
vx vy)
(defstruct mover3d
px py pz
vx vy vz)
Code: Select all
template <int S>
struct mover{
int pos[S];
int vel[S];
}
is a similar behaviour possible in CL or would I have to write own macros that work this way
Code: Select all
(my-defstruct-template mover p v)
(macroexpand '(my-defstruct moverxd (mover x x)))
=>(defstruct moverxd
p0 .. px
v0 .. vx)