Hi,
Olof-joachim, iterate-devel: Thanks for the help.
I have written a small driver for iterate which iterates over dates in a given range. The basic usage is:
(iter (for (y m d) from-date '(2011 1 26) to '(2011 2 27) by 2 skipweekends nil)
(format t "~a/~a/~a~%" d m y))
notes:
1) default value for "to" is today
2) default value for "by" is 1
3) skipweekends if true, skips over weekends
I would like to include this in date-calc package, as I feel it logically belongs there. Please let me know how to go about this.
I am just learning lisp, and all comments/flames are welcome.
In the iterate driver, I would like to reuse the given variables (y m d) instead of gensym'ming , but I get a slew of errors, which I am unable to comprehend.
Instead of:
(defmacro-driver (FOR (y m d) 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 YMD format, ie (YYYY MM DD)"
(let ((ty (gensym "TO-YEAR"))
(tm (gensym "TO-MONTH"))
(td (gensym "TO-DATE"))
(fy (gensym "FROM-YEAR"))
(fm (gensym "FROM-MONTH"))
(fd (gensym "FROM-DATE"))
.....
(,kwd ,y next (progn
....
(list ,fy ,fm ,fd)
....
I would like to use the input yy instead of gensym'ming to hold the current iteration value like:
(defmacro-driver (FOR (y m d) 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 YMD format, ie (YYYY MM DD)"
(let ((ty (gensym "TO-YEAR"))
(tm (gensym "TO-MONTH"))
(td (gensym "TO-DATE"))
.....
(,kwd ,y next (progn
....
(list ,y ,m ,d)
Also, any pointers to improve the code are very much appreciated.
Thanks,
Venkatesan
--
Audentis fortuna juvat