[Openmcl-devel] extracting values of variables

Gary Byers gb at clozure.com
Sat Jun 27 15:49:47 PDT 2009



On Sat, 27 Jun 2009, slepstein at mindspring.com wrote:

> My problem is trying to manipulate values in the break. (Inspection is clear.) For example, how would I go about multiplying the values of the two slots during the break? And thank you for helping!
>
> ? (defclass bar () ((slot-1 :initarg :slot-1 :initform 1 :accessor slot-1)
>                    (slot-2 :initarg :slot-2 :initform 2 :accessor slot-2)))
> #<STANDARD-CLASS BAR>
> ? (setf foo (make-instance 'bar))
> #<BAR #x300041BBFE8D>
> ? (describe foo)
> #<BAR #x300041BBFE8D>
> Class: #<STANDARD-CLASS BAR>
> Wrapper: #<CCL::CLASS-WRAPPER BAR #x300041B0E94D>
> Instance slots
> SLOT-1: 1
> SLOT-2: 2
> ? (defun baz (x) (print (+ (slot-1 x) (slot-2 x))) (break))
> BAZ
> ? (baz foo)
>
> 3 
>> Break: 
>> While executing: BAZ, in process Listener(6).
>> Type :GO to continue, :POP to abort, :R for a list of available restarts.
>> If continued: Return from BREAK.
>> Type :? for other options.
> 1 > (:arg x 0)
> #<BAR #x300041B154DD>

At this point, the REPL variable * is set to that instance of BAR, so

1> (slot-1 *)

would access its SLOT-1 slot.




More information about the Openmcl-devel mailing list