perm filename RECORD.MSG[PAT,LMM] blob
sn#062960 filedate 1973-09-14 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00006 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 record question:
C00004 00003 WARREN:
C00007 00004 IT SEEMS LIKE THE RECORD STUFF IS RELATIVELY SMALL, CLEAN,
C00008 00005 It is now possible to declare mneumonics for CAR, CADDR, and the
C00012 00006 RE PRETTYTYPELST: I PUT (RECORD --) ON PRETTYTYPELST
C00013 ENDMK
C⊗;
record question:
x:field←value
(alternative 1)
translates to (RPLAC.FIELD X VALUE), which is CLISPTRAN'ed
to hide the appropriate (RPLACA ..) or (/RPLACA ...)
disadvantages: redeclaring records or fields will not change the CLISPTRAN'ed
value.
(alternative 2)
translates to (RPLAC.FIELD X VALUE), or to (/RPLAC.FIELD X VALUE)
or to (FRPLAC.FIELD X VALUE), depending on the declarations..
RECORD(FOO (FIE . FUM)) puts a function definition (AND macro prop AND
ACCESSFN prop) on all of:
RPLAC.FIE
/RPLAC.FIE
FRPLAC.FIE
RPLAC.FUM
/RPLAC.FUM
FRPLAC.FUM
disadvantages: too many function definitions and macro properties
sitting around.
(solution) Use alternative 1, and if a field is redeclared, MAPHASH
the whole CLISPTRAN array, looking for RPLAC.FIELD ...
WARREN:
HERE IS WHAT I NEED FOR THE RECORD STUFF TO WORK CLEANLY:
CLISPIFY:
(A) IN CLISPIFY2B, IN THAT BIG SELECTQ, CHECK IF CAR FORM IS
COMPOSE or compose, AND CLISPIFY1 THE REST... (THIS IS SO THE
THE GETHASH WON'T JUST UNGETHASH IT.. CURRENTLY, SINCE COMPOSES
ARE DONE WITH A CLISPTRAN, CLISPIFY2B FINDS THE TRAN, AND STOPS).
(B) DO THE ACCESSFN CHECK BEFORE THE GETHASH CHECK (FOR SAME REASON)
(P.S... looking at the code, could you do a FGETD check before
you do the lowercasing after (NLISTP FORM)? or:
I once had a function called BIND,
CLISP blindly turned it to "bind"....
DWIMIFY:
(A) COMPOSE: if CAR of FORM is COMPOSE or compose (or misspellings
thereof), (CLISPTRAN FORM (RECCOMPOSE0 FORM)) will do the proper
dwimification.
(B) X:FIELD←VALUE (LET'S TALK ABOUT THIS ONE)
The problem is that this translates, using the ACCESSFN thing
to (RPLAC.FIELD X VALUE)... and then when the RPLAC.FIELD
is hit, since it does not have a FN def, the translation
is CLISPTRAN'ed in... This currently is a two-level process..
i.e., running the code works fine; but calling dwimify directly
requires two calls... if a check were made after the acessfn
thing were found in CLISPATOM2 in the ← clause, (F ACCESSFN gets
you close), set a flag if no GETD, and if so, later, do the
macro expansion thing.
IT SEEMS LIKE THE RECORD STUFF IS RELATIVELY SMALL, CLEAN,
AND ALMOST READY TO INSERT INTO THE SYS.
FOLLOWING IS A VERY ROUGH, ROUGH DRAFT OF DOCUMENTATION.
It is now possible to declare mneumonics for CAR, CADDR, and the
like, using the RECORD feature. A record is a list structure,
with a name for the structure type, and names for the fields.
In this terminology, one could say that a CONS was a record
with two fields, CAR, and CDR.
One declares a record using the function:
RECORD(NAME FIELDS)
NAME is an atom which is the record name; FIELDS is the structure
of this record. For example,
RECORD(FOO (FIE FUM . FIG]
declares a record FOO, with three fields. FIE is the CAR, FUM is the
CADR, and FIG is the CDDR.
To get the FIE field of a variable, say X, one can say X:FIE
or (FIE X). Records are implemented by doing a MOVD from the
definitition of the appropriate C..R function to the field names,
along with putting a MACRO property so that it will compile
properly
this will DWIMIFY to (FIE X) .... the RECORD declaration
will /MOVD (CAR FIE) so that the execution of (FIE X) and of
(CAR X) will take the identical amount of time; also, a
MACRO property is put on FIE so that it will compile
properly.
To replace a field, one needs only say X:FIELD←value; this
will DWIMIFY to (RPLAC.field X value) which will have a translation
(in the CLISPARRAY) of the appropriate RPLACA, /RPLACD, etc,
depending on the declarations in effect.
to create a record:
(create FOO FIE←expression
FUM←expression
FUG←expression)
this will translate to the appropriate CONS/LIST expression
but the translation will remain invisible so that DWIMIFY+CLISPIFY will
get back the same thing.
also valid are:
(create FOO using expression
FIE←expression)
which will take every field except the FIE field (or whatever fields
are specified) from the first expression....
Both record names and field names must be unique (i.e., can't
be same as any function name. Record names, when declared, go on
CHANGEDRECLST and there is a RECORD PRETTYMACRO to make the dumping
of records convienient.
Another option available are typed records:
if one calls TYPERECORD(name fields), an extra field is inserted onto
the beginning of fields which will always contain the record name;
TYPERECORD will also define and macro a function FOO? = (EQ (CAR x) (QUOTE FOO]
RE PRETTYTYPELST: I PUT (RECORD --) ON PRETTYTYPELST
AND (RECORD ..) ON PRETTYMACROS, BUT IT DIDN'T WORK..
I LOOKED AT THE NEWFILE1A NEWFILE2 STUFF AND SEEMS
THAT IT DOESNT CHECK IF TYPE IS A TYPE, BUT JUST
GOES AHEAD AND EXPANDS THE MACRO.... NOT SURE THOUGH.
I DO KNOW THAT IT DOESN'T WORK.
LARRY