[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
what do :copiers do?
- To: common-lisp@SU-AI.ARPA
- Subject: what do :copiers do?
- From: Gregor.pa@Xerox.ARPA
- Date: Wed, 18 Dec 1985 15:23:00 -0000
Assuming that the functionality of being able to copy a structure and
get back a structure of the same type and the functionality of being
able to copy a particular "sub-type part" of a structure are worthwhile,
here is a scheme which seems nice:
Remember that:
(defstruct person name)
(defstruct (astronaut (:include person)) helmet-size)
In the scheme I am proposing:
- copy-person of an astronaut returns a person
- a "new" function, copy, which given an astronaut returns an astronaut
More abstractly,
COPY-xxx as defined by a defstruct returns a structure of that
defstruct's type.
COPY returns a structure of the same type as its argument.