[pro] BOA constructor and supplied-p argument

Tamas K Papp tkpapp at gmail.com
Fri Jun 10 14:53:06 UTC 2011


Hi,

I tried to save a supplied-p parameter from a BOA constructor like this:

(defstruct (delayed-iseq
             (:constructor iseq (start-or-end 
                                 &optional (end 0 end?) (by 1)
                                 strict-direction?)))
  "Delayed index sequence evaluation."
  start-or-end end end? by strict-direction?)

but SBCL complained that end? was not used.  After rereading the CLHS
page for defstruct, I am still not 100% sure why this is.  My
intepretation is that END? is an argument like any other, but probably I
am not getting something.

Anyhow, instead I used

(defstruct delayed-iseq
  "Delayed index sequence evaluation."
  start-or-end end end? by strict-direction?)

(defun iseq (start-or-end &optional (end 0 end?) (by 1) strict-direction?)
  (make-delayed-iseq :start-or-end start-or-end :end end :end? end? :by by
                     :strict-direction? strict-direction?))

Is there a way to do it in a single defstruct definition?

Best,

Tamas

PS.: (eq end nil) is different from when it is not supplied, hence the
need to save end?.





More information about the pro mailing list