Mikalai <mbirukou@yahoo.com> wrote:
+---------------
| Can you help me with the following.
| I have a object. I do not know neither the number of slots
| nor names of the slots. Is there a way to access them?
+---------------
In addition to other answers you've gotten, if you're sitting
at a REPL don't forget the simpleminded use of DESCRIBE:
> (describe random-object-1)
#<Closure Over Function "LAMBDA (X)" {4893B8E1}> is function.
Arguments:
There are no arguments.
Its defined argument types are:
NIL
Its result type is:
LIST
On Sunday, 3/26/06 07:39:32 pm PST it was compiled from:
#(#'(LAMBDA # #))
Its closure environment is:
0: 56
1: 34
2: 12
> (describe random-object-2)
#<Stream for file "/u/rpw3/foo.log"> is a structure of type FD-STREAM.
IN-BUFFER: NIL.
IN-INDEX: 512.
IN: #<Function LISP::INPUT-CHARACTER {101BB3F9}>.
BIN: #<Function LISP::ILL-BIN {10060F41}>.
N-BIN: #<Function LISP::FD-STREAM-READ-N-BYTES {10169299}>.
OUT: #<Function LISP::ILL-OUT {1011D601}>.
BOUT: #<Function LISP::ILL-BOUT {1006E481}>.
SOUT: #<Function LISP::ILL-OUT {1011D601}>.
MISC: #<Function LISP::FD-STREAM-MISC-ROUTINE {100C3439}>.
NAME: "file \"/u/rpw3/foo.log\"".
FILE: "/u/rpw3/foo.log".
ORIGINAL: NIL.
DELETE-ORIGINAL: NIL.
ELEMENT-SIZE: 1.
ELEMENT-TYPE: CHARACTER.
FD: 6.
BUFFERING: :FULL.
CHAR-POS: NIL.
LISTEN: NIL.
UNREAD: NIL.
IBUF-SAP: #.(SYSTEM:INT-SAP #x28137000).
IBUF-LENGTH: 4096.
IBUF-HEAD: 0.
IBUF-TAIL: 0.
OBUF-SAP: NIL.
OBUF-LENGTH: NIL.
OBUF-TAIL: 0.
OUTPUT-LATER: NIL.
HANDLER: NIL.
TIMEOUT: NIL.
PATHNAME: #p"/u/rpw3/foo.log".
>
Yes, DESCRIBE is implementation-specific, and some implementations
will tell you more or less than others. But it's a useful tool
when doing interactive exploration.
Ditto INSPECT...
-Rob
-----
Rob Warnock <rpw3@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607