<br><br><div><span class="gmail_quote">On 9/20/07, <b class="gmail_sendername">Jens Axel Søgaard</b> &lt;<a href="mailto:jensaxel@soegaard.net" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">jensaxel@soegaard.net
</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
David Einstein wrote:<br>&gt; I am glad to see that plt is considering including some comprehension<br>&gt; macros.&nbsp;&nbsp;I realize that they are not yet final, but I have some comments.<br>&gt;<br>&gt; A) The behavior of in-range seems to have been inherited from srfi-42
<br>&gt; and python.&nbsp;&nbsp;In my opinion it is one of the few things that python gets<br>&gt; wrong.&nbsp;&nbsp;If you assign problems 7 through 9 as homework to your students,<br>&gt; do you really expect them to hand back just problems 7 and 8?&nbsp;&nbsp;(These
<br>&gt; would be abstract ideal students.)<br><br>ad A)<br><br>Given a vector (or string or byte-string) v it common to iterate through<br>the indices 0, 1, ... (- (vector-length v) 1). Convenience of the<br>common case therefore dictates the last index in the range to be
<br>excluded.</blockquote><div><br>Yes, but in this case you would just use the appropriate string or byte-string sequence.&nbsp; The&nbsp; purpose of&nbsp; comprehensions is to get away from indexing. <br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
 &gt; D)&nbsp;&nbsp;A &#39;for*/seq&#39;&nbsp;&nbsp;form that takes a set of nested sequences and<br> &gt; returns a generator for all the values of the nested would be useful.<br> &gt; I&#39;ve been trying to get one integrated into Jens&#39; srfi-42 rewrite
<br> &gt; using William Farr&#39;s multiple value yield, but my macro skills are not<br> &gt; yet up to the task.<br><br>ad D)<br><br>Do you have an example of the intended behaviour?</blockquote><div><br>&nbsp;In terms of srfi-42 something the ability to do something like
<br><br>(list-ec (:while [:nested (:range a 2 10) (:range b 1 a) (if (= 1 (gcd a b)))] (&lt; 7 (+ a b)) [list a b])<br><br>in terms of for.ss, something like<br><br>(for (stop-after [(a b) (for*/seq ((a1 [in-range 2 10])(b1 [in-range 1 a1]) #:when (= 1 [gcd a1 b1])) (yield a1 b1)] (&lt; 7 (+ a b))) (list a b))
<br><br>these should result in<br><br>&#39;((2 1) (3 1) (3 2) (4 1))<br><br>essentially what I want is functionality similar to Java&#39;s labeled breaks.&nbsp; Not something that you need often (unless you&#39;re doing Project Euler problems), but when you need them, they are indispensable. I don&#39;t see any real need to be able to run nested loops in parallel, but I don&#39;t see any reason that running them in parallel should be disallowed.
<br><br>I&#39;m not sure of the syntax of for*/seq.&nbsp; playing with :nested in srfi-42, I just returned everything declared, but I can see that it might be useful to be able to specify some subset (It makes the macrology easier as well, as the macro does not need to collect the variable names) 
<br><br><br><br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
--<br>Jens Axel Søgaard<br><br></blockquote></div><br>