Venkatesan S | 23 Jan 2011 12:14
Picon

defclause-driver with &sequence

Hi,

I was trying to roll an iterate driver for iterating over dates and I am stuck with a problem. When using defmacro-driver, I am unable to get the value passed in from to and other sequence classes. I tried with the example given in the manual (chapter "Rolling your own"), but hit the same problem. The manual says:
"We can now refer to parameters from, to, by, etc. which contain either the values for
the corresponding keyword, or nil if the keyword was not supplied. Implementing the right
code for these keywords is cumbersome but not difficult; it is left as an exercise."

But I guess I am one of the dumb few who failed the exercise :)) The following is my attempt with the example given in the manual:

(defmacro-driver (FOR var IN-WHOLE-VECTOR v &sequence)
      "All the elements of a vector (disregards fill-pointer)"
      (let ((vect (gensym))
              (end (gensym))
              (index (gensym))
              (myfrm (gensym "myfrm"))
              (kwd (if generate 'generate 'for)))
              `(progn
                            (with ,vect = ,v)
                            (with ,myfrm = ,from)
                            (with ,end = (array-dimension ,vect 0))
                            (with ,index = -1)
                            (,kwd ,var next (progn (incf ,index)
                            (if (>= ,index ,end) (terminate))
                                          (format t "myfrm: ~a~%" ,myfrm)
                                          (aref ,vect ,index))))))

I tried using the driver with: (a is an array of 10 elements)
(iter (for v in-whole-vector a from 5 below 8)
                 (print v))

I get the following error:
 The variable FROM is unbound.
   [Condition of type UNBOUND-VARIABLE]

Restarts:
 0: [RETRY] Retry SLIME REPL evaluation request.
 1: [*ABORT] Return to SLIME's top level.
 2: [ABORT] Exit debugger, returning to top level.

Backtrace:
  0: ((DEFMACRO CLAUSE-FOR-IN-WHOLE-VECTOR-18) (CLAUSE-FOR-IN-WHOLE-VECTOR-18 :FOR V :IN-WHOLE-VECTOR A :FROM ...) #<unused argument>)
  1: (MACROEXPAND-1 (CLAUSE-FOR-IN-WHOLE-VECTOR-18 :FOR V :IN-WHOLE-VECTOR A :FROM ...) #<NULL-LEXENV>)
  2: (ITERATE::PROCESS-CLAUSE (FOR V IN-WHOLE-VECTOR A FROM 5 ...))
  3: (ITERATE::WALK (FOR V IN-WHOLE-VECTOR A FROM 5 ...))
  4: (ITERATE::WALK-LIST-NCONCING ((FOR V IN-WHOLE-VECTOR A FROM 5 ...) (PRINT V)) #<FUNCTION ITERATE::WALK> #<FUNCTION (LAMBDA #) {100407D489}>)
  5: (ITERATE::WALK-LIST ((FOR V IN-WHOLE-VECTOR A FROM 5 ...) (PRINT V)))
  6: ((DEFMACRO ITER) ..)

I am using ubuntu maverick, 10.10, SBCL 1.0.45 64 bit.

I tried the following:
(with ,myfrm = from)

 I get an error:
The variable FROM is unbound.
   [Condition of type UNBOUND-VARIABLE]

Restarts:
 0: [RETRY] Retry SLIME REPL evaluation request.
 1: [*ABORT] Return to SLIME's top level.
 2: [ABORT] Exit debugger, returning to top level.

Backtrace:
  0: ((LAMBDA ()))
  1: (SB-INT:SIMPLE-EVAL-IN-LEXENV ..)
  2: (SWANK::EVAL-REGION "(iter (for v in-whole-vector a from 5 below 8)\n                 (print v))\n")
  3: ((LAMBDA ()))


2) (with ,myfrm = :from)
This does not throw any error, but just prints
myfrm: FROM
instead of the value given

I want to use defclause-driver with the sequence keywords, I could not figure out how to get the values passed in from, to and other such clauses. Can anyone please provide some pointers?



--
Audentis fortuna juvat
<div>
<div>Hi,<br clear="all">
</div>
<div><br></div>
<div>I was trying to roll an iterate driver for iterating over dates and I am stuck with a problem. When using defmacro-driver, I am unable to get the value passed in from to and other sequence classes. I tried with the example given in the manual (chapter "Rolling your own"), but hit the same problem. The manual says:</div>

<div>"We can now refer to parameters from, to, by, etc. which contain either the values for<br>the corresponding keyword, or nil if the keyword was not supplied. Implementing the right<br>code for these keywords is cumbersome but not difficult; it is left as an exercise."<br>
</div>
<div><br></div>
<div>But I guess I am one of the dumb few who failed the exercise :)) The following is my attempt with the example given in the manual:</div>
<div>
<br>(defmacro-driver (FOR var IN-WHOLE-VECTOR v &amp;sequence)<br>
&nbsp;		 &nbsp; &nbsp; "All the elements of a vector (disregards fill-pointer)"<br>
&nbsp;		 &nbsp; &nbsp; (let ((vect (gensym))<br>&nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (end (gensym))<br>				   &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (index (gensym)) <br>				   &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (myfrm (gensym "myfrm"))<br>				   &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (kwd (if generate 'generate 'for)))<br>

			   &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; `(progn<br>				  &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (with ,vect = ,v) <br>				  &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (with ,myfrm = ,from)<br>				  &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (with ,end = (array-dimension ,vect 0))<br>

				  &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (with ,index = -1)<br>				  &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (,kwd ,var next (progn (incf ,index)<br>										 &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (if (&gt;= ,index ,end) (terminate))<br>

										 &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (format t "myfrm: ~a~%" ,myfrm)<br>										 &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (aref ,vect ,index))))))</div>
<div><br></div>
<div>I tried using the driver with: (a is an array of 10 elements)<br>(iter (for v in-whole-vector a from 5 below 8)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;(print v))<br><br>I get the following error:<br>
</div>
<div>&nbsp;The variable FROM is unbound.<br>
&nbsp;&nbsp; [Condition of type UNBOUND-VARIABLE]<br><br>Restarts:<br>&nbsp;0: [RETRY] Retry SLIME REPL evaluation request.<br>&nbsp;1: [*ABORT] Return to SLIME's top level.<br>&nbsp;2: [ABORT] Exit debugger, returning to top level.<br><br>Backtrace:<br>
&nbsp; 0: ((DEFMACRO CLAUSE-FOR-IN-WHOLE-VECTOR-18) (CLAUSE-FOR-IN-WHOLE-VECTOR-18 :FOR V :IN-WHOLE-VECTOR A :FROM ...) #&lt;unused argument&gt;)<br>&nbsp; 1: (MACROEXPAND-1 (CLAUSE-FOR-IN-WHOLE-VECTOR-18 :FOR V :IN-WHOLE-VECTOR A :FROM ...) #&lt;NULL-LEXENV&gt;)<br>
&nbsp; 2: (ITERATE::PROCESS-CLAUSE (FOR V IN-WHOLE-VECTOR A FROM 5 ...))<br>&nbsp; 3: (ITERATE::WALK (FOR V IN-WHOLE-VECTOR A FROM 5 ...))<br>&nbsp; 4: (ITERATE::WALK-LIST-NCONCING ((FOR V IN-WHOLE-VECTOR A FROM 5 ...) (PRINT V)) #&lt;FUNCTION ITERATE::WALK&gt; #&lt;FUNCTION (LAMBDA #) {100407D489}&gt;)<br>
&nbsp; 5: (ITERATE::WALK-LIST ((FOR V IN-WHOLE-VECTOR A FROM 5 ...) (PRINT V)))<br>&nbsp; 6: ((DEFMACRO ITER) ..)<br><br>
</div>
<div>I am using ubuntu maverick, 10.10, SBCL 1.0.45 64 bit.</div>
<div><br></div>
<div>I tried the following:<br>
(with ,myfrm = from)<br><br>&nbsp;I get an error:<br>The variable FROM is unbound.<br>&nbsp;&nbsp; [Condition of type UNBOUND-VARIABLE]<br><br>Restarts:<br>&nbsp;0: [RETRY] Retry SLIME REPL evaluation request.<br>&nbsp;1: [*ABORT] Return to SLIME's top level.<br>
&nbsp;2: [ABORT] Exit debugger, returning to top level.<br><br>Backtrace:<br>&nbsp; 0: ((LAMBDA ()))<br>&nbsp; 1: (SB-INT:SIMPLE-EVAL-IN-LEXENV ..)<br>&nbsp; 2: (SWANK::EVAL-REGION "(iter (for v in-whole-vector a from 5 below 8)\n&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;(print v))\n")<br>
&nbsp; 3: ((LAMBDA ()))<br><br><br>2) (with ,myfrm = :from)<br>This does not throw any error, but just prints <br>myfrm: FROM<br>instead of the value given<br><br>I want to use defclause-driver with the sequence keywords, I could not figure out how to get the values passed in from, to and other such clauses. Can anyone please provide some pointers? <br><br><br>
</div>
<br>-- <br>Audentis fortuna juvat<br>
</div>
Venkatesan S | 23 Jan 2011 12:22
Picon

Re: defclause-driver with &sequence

Sorry, I meant defmacro-driver everywhere I mentioned defclause-driver in the last mail :(

On Sun, Jan 23, 2011 at 7:14 PM, Venkatesan S <svtesan <at> gmail.com> wrote:
Hi,

I was trying to roll an iterate driver for iterating over dates and I am stuck with a problem. When using defmacro-driver, I am unable to get the value passed in from to and other sequence classes. I tried with the example given in the manual (chapter "Rolling your own"), but hit the same problem. The manual says:
"We can now refer to parameters from, to, by, etc. which contain either the values for
the corresponding keyword, or nil if the keyword was not supplied. Implementing the right
code for these keywords is cumbersome but not difficult; it is left as an exercise."

But I guess I am one of the dumb few who failed the exercise :)) The following is my attempt with the example given in the manual:

(defmacro-driver (FOR var IN-WHOLE-VECTOR v &sequence)
      "All the elements of a vector (disregards fill-pointer)"
      (let ((vect (gensym))
              (end (gensym))
              (index (gensym))
              (myfrm (gensym "myfrm"))
              (kwd (if generate 'generate 'for)))
              `(progn
                            (with ,vect = ,v)
                            (with ,myfrm = ,from)
                            (with ,end = (array-dimension ,vect 0))
                            (with ,index = -1)
                            (,kwd ,var next (progn (incf ,index)
                            (if (>= ,index ,end) (terminate))
                                          (format t "myfrm: ~a~%" ,myfrm)
                                          (aref ,vect ,index))))))

I tried using the driver with: (a is an array of 10 elements)
(iter (for v in-whole-vector a from 5 below 8)
                 (print v))

I get the following error:
 The variable FROM is unbound.
   [Condition of type UNBOUND-VARIABLE]

Restarts:
 0: [RETRY] Retry SLIME REPL evaluation request.
 1: [*ABORT] Return to SLIME's top level.
 2: [ABORT] Exit debugger, returning to top level.

Backtrace:
  0: ((DEFMACRO CLAUSE-FOR-IN-WHOLE-VECTOR-18) (CLAUSE-FOR-IN-WHOLE-VECTOR-18 :FOR V :IN-WHOLE-VECTOR A :FROM ...) #<unused argument>)
  1: (MACROEXPAND-1 (CLAUSE-FOR-IN-WHOLE-VECTOR-18 :FOR V :IN-WHOLE-VECTOR A :FROM ...) #<NULL-LEXENV>)
  2: (ITERATE::PROCESS-CLAUSE (FOR V IN-WHOLE-VECTOR A FROM 5 ...))
  3: (ITERATE::WALK (FOR V IN-WHOLE-VECTOR A FROM 5 ...))
  4: (ITERATE::WALK-LIST-NCONCING ((FOR V IN-WHOLE-VECTOR A FROM 5 ...) (PRINT V)) #<FUNCTION ITERATE::WALK> #<FUNCTION (LAMBDA #) {100407D489}>)
  5: (ITERATE::WALK-LIST ((FOR V IN-WHOLE-VECTOR A FROM 5 ...) (PRINT V)))
  6: ((DEFMACRO ITER) ..)

I am using ubuntu maverick, 10.10, SBCL 1.0.45 64 bit.

I tried the following:
(with ,myfrm = from)

 I get an error:
The variable FROM is unbound.
   [Condition of type UNBOUND-VARIABLE]

Restarts:
 0: [RETRY] Retry SLIME REPL evaluation request.
 1: [*ABORT] Return to SLIME's top level.
 2: [ABORT] Exit debugger, returning to top level.

Backtrace:
  0: ((LAMBDA ()))
  1: (SB-INT:SIMPLE-EVAL-IN-LEXENV ..)
  2: (SWANK::EVAL-REGION "(iter (for v in-whole-vector a from 5 below 8)\n                 (print v))\n")
  3: ((LAMBDA ()))


2) (with ,myfrm = :from)
This does not throw any error, but just prints
myfrm: FROM
instead of the value given

I want to use defclause-driver with the sequence keywords, I could not figure out how to get the values passed in from, to and other such clauses. Can anyone please provide some pointers?



--
Audentis fortuna juvat



--
Audentis fortuna juvat
<div>
<div>Sorry, I meant defmacro-driver everywhere I mentioned defclause-driver in the last mail :(</div>
<br><div class="gmail_quote">On Sun, Jan 23, 2011 at 7:14 PM, Venkatesan S <span dir="ltr">&lt;<a href="mailto:svtesan <at> gmail.com">svtesan <at> gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote">
<div>Hi,<br clear="all">
</div>
<div><br></div>
<div>I was trying to roll an iterate driver for iterating over dates and I am stuck with a problem. When using defmacro-driver, I am unable to get the value passed in from to and other sequence classes. I tried with the example given in the manual (chapter "Rolling your own"), but hit the same problem. The manual says:</div>

<div>"We can now refer to parameters from, to, by, etc. which contain either the values for<br>the corresponding keyword, or nil if the keyword was not supplied. Implementing the right<br>code for these keywords is cumbersome but not difficult; it is left as an exercise."<br>
</div>
<div><br></div>
<div>But I guess I am one of the dumb few who failed the exercise :)) The following is my attempt with the example given in the manual:</div>
<div>
<br>(defmacro-driver (FOR var IN-WHOLE-VECTOR v &amp;sequence)<br>

&nbsp;		 &nbsp; &nbsp; "All the elements of a vector (disregards fill-pointer)"<br>
&nbsp;		 &nbsp; &nbsp; (let ((vect (gensym))<br>&nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (end (gensym))<br>				   &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (index (gensym)) <br>				   &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (myfrm (gensym "myfrm"))<br>				   &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (kwd (if generate 'generate 'for)))<br>

			   &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; `(progn<br>				  &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (with ,vect = ,v) <br>				  &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (with ,myfrm = ,from)<br>				  &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (with ,end = (array-dimension ,vect 0))<br>

				  &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (with ,index = -1)<br>				  &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (,kwd ,var next (progn (incf ,index)<br>										 &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (if (&gt;= ,index ,end) (terminate))<br>

										 &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (format t "myfrm: ~a~%" ,myfrm)<br>										 &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;			   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (aref ,vect ,index))))))</div>
<div><br></div>
<div>I tried using the driver with: (a is an array of 10 elements)<br>(iter (for v in-whole-vector a from 5 below 8)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;(print v))<br><br>I get the following error:<br>
</div>
<div>&nbsp;The variable FROM is unbound.<br>

&nbsp;&nbsp; [Condition of type UNBOUND-VARIABLE]<br><br>Restarts:<br>&nbsp;0: [RETRY] Retry SLIME REPL evaluation request.<br>&nbsp;1: [*ABORT] Return to SLIME's top level.<br>&nbsp;2: [ABORT] Exit debugger, returning to top level.<br><br>Backtrace:<br>

&nbsp; 0: ((DEFMACRO CLAUSE-FOR-IN-WHOLE-VECTOR-18) (CLAUSE-FOR-IN-WHOLE-VECTOR-18 :FOR V :IN-WHOLE-VECTOR A :FROM ...) #&lt;unused argument&gt;)<br>&nbsp; 1: (MACROEXPAND-1 (CLAUSE-FOR-IN-WHOLE-VECTOR-18 :FOR V :IN-WHOLE-VECTOR A :FROM ...) #&lt;NULL-LEXENV&gt;)<br>

&nbsp; 2: (ITERATE::PROCESS-CLAUSE (FOR V IN-WHOLE-VECTOR A FROM 5 ...))<br>&nbsp; 3: (ITERATE::WALK (FOR V IN-WHOLE-VECTOR A FROM 5 ...))<br>&nbsp; 4: (ITERATE::WALK-LIST-NCONCING ((FOR V IN-WHOLE-VECTOR A FROM 5 ...) (PRINT V)) #&lt;FUNCTION ITERATE::WALK&gt; #&lt;FUNCTION (LAMBDA #) {100407D489}&gt;)<br>

&nbsp; 5: (ITERATE::WALK-LIST ((FOR V IN-WHOLE-VECTOR A FROM 5 ...) (PRINT V)))<br>&nbsp; 6: ((DEFMACRO ITER) ..)<br><br>
</div>
<div>I am using ubuntu maverick, 10.10, SBCL 1.0.45 64 bit.</div>
<div><br></div>
<div>I tried the following:<br>

(with ,myfrm = from)<br><br>&nbsp;I get an error:<br>The variable FROM is unbound.<br>&nbsp;&nbsp; [Condition of type UNBOUND-VARIABLE]<br><br>Restarts:<br>&nbsp;0: [RETRY] Retry SLIME REPL evaluation request.<br>&nbsp;1: [*ABORT] Return to SLIME's top level.<br>

&nbsp;2: [ABORT] Exit debugger, returning to top level.<br><br>Backtrace:<br>&nbsp; 0: ((LAMBDA ()))<br>&nbsp; 1: (SB-INT:SIMPLE-EVAL-IN-LEXENV ..)<br>&nbsp; 2: (SWANK::EVAL-REGION "(iter (for v in-whole-vector a from 5 below 8)\n&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;(print v))\n")<br>

&nbsp; 3: ((LAMBDA ()))<br><br><br>2) (with ,myfrm = :from)<br>This does not throw any error, but just prints <br>myfrm: FROM<br>instead of the value given<br><br>I want to use defclause-driver with the sequence keywords, I could not figure out how to get the values passed in from, to and other such clauses. Can anyone please provide some pointers? <br><br><br>
</div>
<br>-- <br>Audentis fortuna juvat<br>
</blockquote>
</div>
<br><br clear="all"><br>-- <br>Audentis fortuna juvat<br>
</div>
Olof-Joachim Frahm | 23 Jan 2011 17:40
Picon

Re: defclause-driver with &sequence

Venkatesan S <svtesan <at> gmail.com> writes:

> I want to use defclause-driver with the sequence keywords, I could not
> figure out how to get the values passed in from, to and other such
> clauses. Can anyone please provide some pointers? 

Hi, you were just a tiny step from the working solution:  With

>        (with ,myfrm = ,iterate::from)

, that is, using the qualified FROM from the iterate package, it works
just fine.  You can also see this, if you macroexpand your
IN-WHOLE-VECTOR definition:

> (EVAL-WHEN (:COMPILE-TOPLEVEL :LOAD-TOPLEVEL :EXECUTE)
>   (DEFMACRO CLAUSE-FOR-IN-WHOLE-VECTOR-5
>             (&KEY ((:FOR VAR)) ((:IN-WHOLE-VECTOR V)) ((:FROM ITERATE::FROM))
>              ((:UPFROM ITERATE::UPFROM)) ((:DOWNFROM ITERATE::DOWNFROM))
>              ((:TO ITERATE::TO)) ((:DOWNTO ITERATE::DOWNTO))
>              ((:ABOVE ITERATE::ABOVE)) ((:BELOW ITERATE::BELOW))
>              ((:BY ITERATE::BY) 1) ((:WITH-INDEX ITERATE::WITH-INDEX))
>              GENERATE)
>     "All the elements of a vector (disregards fill-pointer)"
> ...

Since all those extra symbols are not exported from the iterate package,
you've got to use them explicitely.

Hth and cheers,
Olof

--

-- 
The world is burning.  Run.

Venkatesan S | 24 Jan 2011 00:56
Picon

Re: defclause-driver with &sequence

Thanks!! It works fine <sheepish grin>

On Mon, Jan 24, 2011 at 12:40 AM, Olof-Joachim Frahm <Olof.Frahm <at> web.de> wrote:
Venkatesan S <svtesan <at> gmail.com> writes:

> I want to use defclause-driver with the sequence keywords, I could not
> figure out how to get the values passed in from, to and other such
> clauses. Can anyone please provide some pointers?

Hi, you were just a tiny step from the working solution:  With

>        (with ,myfrm = ,iterate::from)

, that is, using the qualified FROM from the iterate package, it works
just fine.  You can also see this, if you macroexpand your
IN-WHOLE-VECTOR definition:

> (EVAL-WHEN (:COMPILE-TOPLEVEL :LOAD-TOPLEVEL :EXECUTE)
>   (DEFMACRO CLAUSE-FOR-IN-WHOLE-VECTOR-5
>             (&KEY ((:FOR VAR)) ((:IN-WHOLE-VECTOR V)) ((:FROM ITERATE::FROM))
>              ((:UPFROM ITERATE::UPFROM)) ((:DOWNFROM ITERATE::DOWNFROM))
>              ((:TO ITERATE::TO)) ((:DOWNTO ITERATE::DOWNTO))
>              ((:ABOVE ITERATE::ABOVE)) ((:BELOW ITERATE::BELOW))
>              ((:BY ITERATE::BY) 1) ((:WITH-INDEX ITERATE::WITH-INDEX))
>              GENERATE)
>     "All the elements of a vector (disregards fill-pointer)"
> ...

Since all those extra symbols are not exported from the iterate package,
you've got to use them explicitely.

Hth and cheers,
Olof

--
The world is burning.  Run.

_______________________________________________
iterate-devel site list
iterate-devel <at> common-lisp.net
http://common-lisp.net/mailman/listinfo/iterate-devel



--
Audentis fortuna juvat
<div>
<p>Thanks!! It works fine &lt;sheepish grin&gt;<br><br></p>
<div class="gmail_quote">On Mon, Jan 24, 2011 at 12:40 AM, Olof-Joachim Frahm <span dir="ltr">&lt;<a href="mailto:Olof.Frahm <at> web.de">Olof.Frahm <at> web.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote">
<div class="im">Venkatesan S &lt;<a href="mailto:svtesan <at> gmail.com">svtesan <at> gmail.com</a>&gt; writes:<br><br>
&gt; I want to use defclause-driver with the sequence keywords, I could not<br>
&gt; figure out how to get the values passed in from, to and other such<br>
&gt; clauses. Can anyone please provide some pointers?<br><br>
</div>Hi, you were just a tiny step from the working solution: &nbsp;With<br><br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp;(with ,myfrm = ,iterate::from)<br><br>
, that is, using the qualified FROM from the iterate package, it works<br>
just fine. &nbsp;You can also see this, if you macroexpand your<br>
IN-WHOLE-VECTOR definition:<br><br>
&gt; (EVAL-WHEN (:COMPILE-TOPLEVEL :LOAD-TOPLEVEL :EXECUTE)<br>
&gt; &nbsp; (DEFMACRO CLAUSE-FOR-IN-WHOLE-VECTOR-5<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (&amp;KEY ((:FOR VAR)) ((:IN-WHOLE-VECTOR V)) ((:FROM ITERATE::FROM))<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;((:UPFROM ITERATE::UPFROM)) ((:DOWNFROM ITERATE::DOWNFROM))<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;((:TO ITERATE::TO)) ((:DOWNTO ITERATE::DOWNTO))<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;((:ABOVE ITERATE::ABOVE)) ((:BELOW ITERATE::BELOW))<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;((:BY ITERATE::BY) 1) ((:WITH-INDEX ITERATE::WITH-INDEX))<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;GENERATE)<br><div class="im">&gt; &nbsp; &nbsp; "All the elements of a vector (disregards fill-pointer)"<br>
</div>&gt; ...<br><br>
Since all those extra symbols are not exported from the iterate package,<br>
you've got to use them explicitely.<br><br>
Hth and cheers,<br>
Olof<br><br>
--<br>
The world is burning. &nbsp;Run.<br><br>
_______________________________________________<br>
iterate-devel site list<br><a href="mailto:iterate-devel <at> common-lisp.net">iterate-devel <at> common-lisp.net</a><br><a href="http://common-lisp.net/mailman/listinfo/iterate-devel" target="_blank">http://common-lisp.net/mailman/listinfo/iterate-devel</a><br>
</blockquote>
</div>
<br><br clear="all"><br>-- <br>Audentis fortuna juvat<br>
</div>

Gmane