One of the methods:
(defstruct (person
(:constructor make-person (&key real-name
(fake-name real-name))))
real-name
fake-name)
You can essentially customize the constructor function to your needs, including
- with a different name than
make-xxx - with Lisp, create a constructor "in order of argument" (BOA) instead of the keyword
Consider
(defstruct (person
(:constructor make-person (real-name
&optional (fake-name real-name))))
real-name
fake-name)
, &aux -:
(defstruct (person
(:constructor make-person (real-name
&aux (fake-name (format nil
"fake-of-~A"
real-name)))))
real-name
fake-name)