Reputation: 719
Is there a work-around for structure body slot bindings to be processed in sequence as in LET*
so that previous slot assignments are visible to later ones?
For instance in the following i want c
to be visible for d
.
(defstruct (my-struct (:constructor cons-struct (a b)))
(c (* a b))
(d c))
How could i get this effect?
Upvotes: 2
Views: 124
Reputation: 51501
You already use a boa constructor. You can use its boa lambda list to do things in order:
(defstruct (my-struct (:constructor cons-struct (a b
&aux
(c (* a b))
(d c))))
c
d)
Upvotes: 6