Hi list! Some time ago I've suggested that one can use keywords in clauses, e.g. (iter (:for i :from 1 to 10)) instead of (iter (for i from 1 to 10)) This way, one have to import just one symbol iter:iter into her package to use iterate. I made a patch and sent it to this mailing list, but it didn't pass through, maybe due to size limitations or by some other reason. After that, I created a fork, http://sourceforge.net/projects/iteratekeywords/ but several commits were made to iterate since that and my code seem to be outdated. I suggest re-doing my changes so that they could be merged into main iterate repository. But before doing that I'd like to see explicit confirmation that my changes will be accepted (patch is very big and contains about hundred of changes).
Just to point out to people on the list, you can already use keyword arguments for things you should be able to, like :from, :below, :in,
(iter (for i :below 5) (collect i)) => (1 2 3 4)
If you encode FOR and COLLECT as special tokens that Iterate's parser/compiler just understands you break the extensibility. For instance, you would not be able to define your own FOR or COLLECT. Using the example from the manual under "Roll your own":
(defpackage test (:use :cl))
(iterate:defmacro-clause (test::FOR var IN-WHOLE-VECTOR v) "A new definition of the for loop." (let ((vect (gensym)) (index (gensym))) `(progn (with ,vect = ,v) (for ,index from 0 below (array-dimension ,vect 0)) (for ,var = (aref ,vect ,index)))))
(iter (test::for i :in-whole-vector #(1 3 5)) (collect i)) => (1 3 5)
Thus completely replacing FOR or anything along these lines would be impossible without modifying iterate itself, and even then, it would suffer from name collisions inherent in the keyword package. Thus, I think this is a bad idea and it will potentially be detrimental to others, i.e. this isn't just a matter of taste.
Zach
On Sun, Oct 14, 2012 at 5:58 AM, Denis Budyak budden73@gmail.com wrote:
Hi list! Some time ago I've suggested that one can use keywords in clauses, e.g. (iter (:for i :from 1 to 10)) instead of (iter (for i from 1 to 10)) This way, one have to import just one symbol iter:iter into her package to use iterate. I made a patch and sent it to this mailing list, but it didn't pass through, maybe due to size limitations or by some other reason. After that, I created a fork, http://sourceforge.net/projects/iteratekeywords/ but several commits were made to iterate since that and my code seem to be outdated. I suggest re-doing my changes so that they could be merged into main iterate repository. But before doing that I'd like to see explicit confirmation that my changes will be accepted (patch is very big and contains about hundred of changes).
iterate-devel site list iterate-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/iterate-devel