Hello all,

I am a newcomer in lisp. I hope the mailling list is a right channel to write 
this.

I imaginated a feature for iterate. A built-in clause that inserts a 
symbol-macro in iterate output. It seems useful to me because symbol-macros are 
elegant setf-able places.

Here is a clause named `ACCESS var IN-VECTOR v` with a symbol macro for var.

```
(defparameter *my-vector* (make-array 8
    :initial-contents (iter (for i from 1 to 8) (collect i)))

(print *my-vector*)
#(1 2 3 4 5 6 7 8)

(iter (access i in-vector *my-vector*)
  (incf i 10))

(print *my-vector*)
#(11 12 13 14 15 16 17 18)
```

The clause would be writen like this :

```
(defmacro-clause (ACCESS var IN-VECTOR v)
  "Access the elements of a vector"
  (let ((vect (gensym))
          (end (gensym))
          (index (gensym)))
    ‘(progn
       (with ,vect = ,v)
       (with ,end = (array-dimension ,vect 0))
       (for ,index from 0 to (1- ,end))
       (with-symbol-macro ,var (aref ,vect ,index)))))
```

I see no way to implement it without modifications in the iterate macro. But I 
think this can be implemented inserting a `symbol-macrolet ,(nreverse 
*symbol-macro-bindings*)` just after `let* ,(nreverse *bindings*)` in the 
iterate macro output.

I would like to try to implement it.

My questions :

1. Are they existing approaches to get the same result in iterate ?
2. Does some common lisp iteration systems already provides this feature in 
their built-ins clauses or in the extension mechanism ?
3. Does someone already tried to implement this kind of feature in iterate ?
4. What are the contributing guidelines on the common lisp gitlab repository ? 
I plan to imitate the current symbol naming, comment and commit style ; and 
writing the corresponding unit tests.

Reply via email to