I need to silently discard the first two values returned from
decode-universal-time, in this macro, and not get a warning about
ignoring values, etc. I know you usually use (declare (ignore ..)) but
it seems a bit of a waste to create a gensym in order to ignore it.
Does anyone have any other suggestions?
(defmacro with-day-month-year (day month year date &rest body)
`(multiple-value-bind (,(gensym) ,(gensym) ,day ,month ,year)
(decode-universal-time ,date) ,@body))
?
"JohnFredCee" <·····@yagc.ndo.co.uk> writes:
> I need to silently discard the first two values returned from
> decode-universal-time, in this macro, and not get a warning about
> ignoring values, etc. I know you usually use (declare (ignore ..)) but
> it seems a bit of a waste to create a gensym in order to ignore it.
> Does anyone have any other suggestions?
Read CLHS decode-universal-time
> (defmacro with-day-month-year (day month year date &rest body)
> `(multiple-value-bind (,(gensym) ,(gensym) ,day ,month ,year)
> (decode-universal-time ,date) ,@body))
This won't help. You need to declare them ignored.
(defmacro with-day-month-year ((day month year date) &body body)
(let ((h (gensym))(m (gensym))(s (gensym)))
`(multiple-value-bind (,s ,m ,h ,day ,month ,year)
(decode-universal-time ,date)
(declare (ignore ,s ,m ,h))
,@body)))
(with-day-month-year (d m y (get-universal-time))
(list y m d))
--> (2006 10 24)
--
__Pascal Bourguignon__ http://www.informatimago.com/
THIS IS A 100% MATTER PRODUCT: In the unlikely event that this
merchandise should contact antimatter in any form, a catastrophic
explosion will result.
Pascal Bourguignon wrote:
> "JohnFredCee" <·····@yagc.ndo.co.uk> writes:
>
> > I need to silently discard the first two values returned from
> > decode-universal-time, in this macro, and not get a warning about
> > ignoring values, etc. I know you usually use (declare (ignore ..)) but
> > it seems a bit of a waste to create a gensym in order to ignore it.
> > Does anyone have any other suggestions?
>
> Read CLHS decode-universal-time
>
I was going to say "I have"..but then I noticed the typo. D'oh.
Thanks for showing me how to use (declare (ignore ..)) in this context,
though..
> THIS IS A 100% MATTER PRODUCT: In the unlikely event that this
> merchandise should contact antimatter in any form, a catastrophic
> explosion will result.