Well, using something other than a plain symbol after the FOR keyword
isn't supported by DEFMACRO-DRIVER because that symbol is inserted in a
normal macro definition.  E.g.:

yeah, I saw it in macroexpand and the macro flew into a rage if I tried to use any other variable than the first in the next form (like: (,kwd ,mm ... ). I ascribed it to my lack of knowledge and never thought it was illegal :) 
 
Well, contact the author?  And although it may for you logically belong
there, it adds a dependency to the date-calc package, which is, for a
small library perhaps not worth it.  Since iterate has contribs (or one,
the postgres driver) I'd think it could be added there instead more
easily.  But I'm only using this library, so same goes here.

I posted to date-calc-devel mailing list too, but as you say contribs might be a better place for this. How do I go about putting this into iterate/contribs?


Thanks for your time, and the inputs. I very much appreciate it.

Code remarks: I'd probably use &key instead of &optional, because
wrapping date-calc:today every time I want to change skip-weekends would
be too much work.  Everything else is personal style, such as my habit
for long names.  And for just learning it looks good, imho.

General remarks: use irc.freenode.net, #lisp and, if you like usenet,
comp.lang.lisp, because there're certainly more people reading in those
places.  And you'll get more flames ;)

Cheers,
Olof

[1]: http://www.lispworks.com/documentation/HyperSpec/Body/03_dd.htm

--8<---------------cut here---------------start------------->8---
(iterate::defclause-driver (FOR year-month-date-vars FROM-DATE from-date-spec &optional TO to-date-spec BY (n 1) SKIP-WEEKENDS (skipval t))
 "Driver for iterating over dates.  All dates are in (YYYY MM DD) format."
 (declare (ignorable to-date-spec))
 (iterate::top-level-check)
 (unless (and (listp year-month-date-vars)
              (every #'symbolp year-month-date-vars))
   (iterate::clause-error "~a should be a list of up to three variables: ~
the year, month and day" year-month-date-vars))
 (mapc #'iterate::make-default-binding year-month-date-vars)
 (let* ((step-var (iterate::make-var-and-default-binding 'by :type 'fixnum))
        (fy (iterate::make-var-and-default-binding 'from-year :type 'fixnum))
        (fm (iterate::make-var-and-default-binding 'from-month :type 'fixnum))
        (fd (iterate::make-var-and-default-binding 'from-day :type 'fixnum))
        (ty (iterate::make-var-and-default-binding 'to-year :type 'fixnum))
        (tm (iterate::make-var-and-default-binding 'to-month :type 'fixnum))
        (td (iterate::make-var-and-default-binding 'to-day :type 'fixnum))
        (step `((multiple-value-setq (,fy ,fm ,fd)
                  (get-next-day ,fy ,fm ,fd ,step-var ,skipval))
                (multiple-value-setq ,year-month-date-vars
                  (values ,fy ,fm ,fd))))
        (test `(when (< (date-calc:delta-days ,fy ,fm ,fd ,ty ,tm ,td) 0)
                 (go ,iterate::*loop-end*))))
   (setf iterate::*loop-end-used?* T)
   (iterate::return-driver-code
    :initial `((setq ,step-var ,n)
               (destructuring-bind (y m d)
                   ,from-date-spec
                 (multiple-value-setq (,fy ,fm ,fd)
                   (get-next-day y m d (- ,step-var) ,skipval)))
               (let ((spec ,to-date-spec))
                 (multiple-value-setq (,ty ,tm ,td)
                   (if spec
                       (values-list spec)
                       (date-calc:today)))))
    :next `(,.step ,test)
    :variable year-month-date-vars)))
--8<---------------cut here---------------end--------------->8---

--
The world is burning.  Run.

_______________________________________________
iterate-devel site list
iterate-devel@common-lisp.net
http://common-lisp.net/mailman/listinfo/iterate-devel



--
Audentis fortuna juvat