Hi,<br clear="all"><div><br></div><div>Olof-joachim, iterate-devel: Thanks for the help.</div><div><br></div><div>I have written a small driver for iterate which iterates over dates in a given range. The basic usage is:</div>
<div>(iter (for (y m d) from-date '(2011 1 26) to '(2011 2 27) by 2 skipweekends nil)</div><div> (format t "~a/~a/~a~%" d m y))</div><div><br></div><div>notes:<br></div><div>1) default value for "to" is today </div>
<div>2) default value for "by" is 1 </div><div>3) skipweekends if true, skips over weekends</div><div><br></div><div><br></div><div>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. </div>
<div>I am just learning lisp, and all comments/flames are welcome.</div><div><br></div><div>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. </div>
<div>Instead of:</div><div><br></div><div>(defmacro-driver (FOR (y m d) FROM-DATE from-date-spec &optional TO to-date-spec BY (n 1) SKIP-WEEKENDS (skipval t))<br></div><div> "Driver for iterating over dates. All dates are in YMD format, ie (YYYY MM DD)"<br>
(let ((ty (gensym "TO-YEAR"))<br> (tm (gensym "TO-MONTH"))<br> (td (gensym "TO-DATE"))<br> (fy (gensym "FROM-YEAR"))<br> (fm (gensym "FROM-MONTH"))<br>
(fd (gensym "FROM-DATE"))<br> .....</div><div>(,kwd ,y next (progn</div><div>....</div><div> (list ,fy ,fm ,fd)<br>....<br></div><div><br></div><div>I would like to use the input yy instead of gensym'ming to hold the current iteration value like:</div>
<div><div>(defmacro-driver (FOR (y m d) FROM-DATE from-date-spec &optional TO to-date-spec BY (n 1) SKIP-WEEKENDS (skipval t))<br></div><div> "Driver for iterating over dates. All dates are in YMD format, ie (YYYY MM DD)"<br>
(let ((ty (gensym "TO-YEAR"))<br> (tm (gensym "TO-MONTH"))<br> (td (gensym "TO-DATE"))<br> .....</div><div>(,kwd ,y next (progn<br>....<br></div><div> (list ,y ,m ,d)</div>
<div><br></div><div>Also, any pointers to improve the code are very much appreciated.</div><br></div><div><br></div><div>Thanks,<br></div><div>Venkatesan</div><div><br></div><font color="#888888">-- <br>Audentis fortuna juvat<br>
</font><br><br clear="all"><br>-- <br>Audentis fortuna juvat<br>