user1013905
user1013905

Reputation: 167

Print structure in Lisp

I want to be able to print the variable of a structure when I instantiate it, in order to see what is going on. I have profusely googled this idea and cannot find anything concrete.

So for instance:

(setf object-name
      (make-the-object :obj-var value
                       :obj-var1 value))

Could this become something like this:

(setf object-name
      (make-the-object :obj-var value
                       :obj-var1 value
                       :(print obj-var1)))

so that the variable is printed on instantiation?

Upvotes: 0

Views: 481

Answers (2)

Vatine
Vatine

Reputation: 21238

If you have a dedicated object-maker function, you can always just trace that function.

Upvotes: 1

Vsevolod Dyomkin
Vsevolod Dyomkin

Reputation: 9451

(setf object-name (print (make-the-object :obj-var value :obj-var value)))

Upvotes: 0

Related Questions