Hi,
How can I print the struct without #s ?
For example my result is #S(U) and I just want to print U. How can I do that !?
CL-USER(1): (defstruct point x y)
POINT
CL-USER(2): (defvar *a* (make-point :x 10 :y 20))
*A*
CL-USER(3): *a*
#S(POINT :X 10 :Y 20)
CL-USER(4): (sb-mop:class-slots (class-of *a*))
(#<SB-PCL::STRUCTURE-EFFECTIVE-SLOT-DEFINITION X>
#<SB-PCL::STRUCTURE-EFFECTIVE-SLOT-DEFINITION Y>)
CL-USER(5): (mapcar #'sb-mop:slot-definition-name (sb-mop:class-slots (class-of *a*)))
(X Y)mparsa wrote:I want to get the value of the b
CL-USER(3): (defstruct point2d x y)
POINT2D
CL-USER(4): (make-point2d :x 1 :y 2)
#S(POINT2D :X 1 :Y 2)
CL-USER(5): (slot-value * 'x)
1
CL-USER(6): (slot-value ** 'y)
2CL-USER(1): (defvar *x* (make-point2d :x 10 :y 20))
*X*
CL-USER(2): (mapcan #'(lambda (slot-name) (list slot-name (slot-value *x* slot-name))) (mapcar #'sb-mop:slot-definition-name (sb-mop:class-slots (class-of *x*))))
(X 10 Y 20)
Users browsing this forum: No registered users and 2 guests