ITERATE use (was Re: [cl-typesetting-devel] CLISP support)

Klaus Weidner kw at w-m-p.com
Tue Apr 27 20:01:01 UTC 2004


On Tue, Apr 27, 2004 at 08:34:35PM +0200, Marc Battyani wrote:
> "Klaus Weidner" <kw at w-m-p.com> wrote:
> > The implementations seem to agree on everything other than that.
> 
> No, there is also the sequential vs global tests. Where CLisp differs from
> the other ones.

I'm not sure what you mean by that - the changes I did regarding in-loop
and on-loop etc. were all related to getting the expected iteration
variable value into the FINALLY clause. If the code had not cared about
those, there would have been no need for a change - the values always
matched while inside the loop body itself.

The maximized NIL value was a separate issue and a real bug in the code
that depended on the implicit 0 initialization done by MIT LOOP.

> > It's Marc's decision - I can live with either one. I'd suggest reducing
> > the complexity of loops of either kind if at all possible, similar in
> > spirit to the v-split change I made.
> 
> Still don't like LOOP heh...  ;-)

You caught me... This entire episode didn't exactly endear it to me. I
learned more about it than I originally wanted to, and I'm not sure if
that was a good thing.

> But I agree that loops should keep a reasonable size.

Thanks, then I don't think it'll be a problem. The complex ones are just
IMHO hard to debug and experiment with.

> A good point in favor of ITERATE is that the semantics can be precisely
> defined and implemented. I discussed with Andreas and he is open to modify
> it and the associated doc so that it is really usable.

Note that the FINALLY values are also the rather weird MIT LOOP ones in
ITERATE:

	(iter (for i :from 0 :below 2)
	      (for j :from 0 :below 2)
	      (finally (return (list i j))))
	=> (2 1)

So even if this behavior is documented and dependable, I still would not
consider it to be good style to write code that uses those values.

> A bad point is that it is not standard. So this will make the sources less
> readable for others.

I don't think that it's such a big deal - if you mentally remove some
parentheses it looks much like LOOP, with some standard Lisp expressions
intermingled. I think it's far cleaner to be able to use standard if/when
inside ITER rather than the weird pseudo-Lisp LOOP variants.

> BTW Andreas has put a new version of ITERATE with a postscript manual. I
> will try to look at it this evening.

I had read the included "Iterate Manual" MIT report this weekend, and I
like it a lot. As far as I can tell it also doesn't specifically say
anything about values of iterate vars in FINALLY clauses ;-)

-Klaus




More information about the cl-typesetting-devel mailing list