[plt-scheme] for.ss

From: David Einstein (deinst at gmail.com)
Date: Thu Sep 20 12:36:02 EDT 2007

I am glad to see that plt is considering including some comprehension
macros.  I realize that they are not yet final, but I have some comments.

A) The behavior of in-range seems to have been inherited from srfi-42 and
python.  In my opinion it is one of the few things that python gets wrong.
If you assign problems 7 through 9 as homework to your students, do you
really expect them to hand back just problems 7 and 8?  (These would be
abstract ideal students.)

B) The behavior of #:when in a parallel for loop scares me.  I would prefer
that either
1) The #:when constructs always behaved as if they occurred at the end of
the list of generators.
or
2) The #:when construct is illegal anywhere except at the end of a parallel
list of generators.

I agree that something that splits a parallel 'for' construct up into nested
pieces is useful, I just don't think that overloading #:when is the right
way to do it.   I know for certain that I will screw it up. Until they start
making bulletproof tevas please don't make it so easy for me to shoot myself
in the foot.

C) What is the difference between the fourth and sixth parameter to
make-do-sequence? Why are they both necessary?

D)  A 'for*/seq'  form that takes a set of nested sequences and returns a
generator for all the values of the nested would be useful.  I've been
trying to get one integrated into Jens' srfi-42 rewrite using William Farr's
multiple value yield, but my macro skills are not yet up to the task.

E)  The begin form in srfi-42, although ugly, was extremely useful for
debugging deeply nested loops.

F) The :let generator was indispensable for the Project Euler problems.  I
know that even I could write a macro for it, but it would be nice to have
provided.

G)  I do not understand :do-in and make-do-sequence well enough, but one of
the things that bothers me about the srfi-42 :parallel generator is that the
following two fragments to not generate the same result.

(let ([a 1][b 1])
  (zip
   (list-ec (:do ((a 0)) (< a 10) ((+ a b))) a)
   (list-ec (:do ((b 0)) (< b 10) ((+ a b))) b)))

(let ([a 1][b 1])
  (list-ec (:parallel
            (:do ((a 0)) (< a 10) ((+ a b)))
            (:do ((b 0)) (< b 10) ((+ a b)))) (list a b)))

Yes, I know that that is not code that any sane person would write, and I am
not sure that it is possible to have the same leakage in for.ss.


Sorry for being so whiny,  I do greatly appreciate all the work that y'all
are doing.


 Deinst
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20070920/684c8de0/attachment.html>

Posted on the users mailing list.