greg heil wrote:

> Yes but wouldn't that just be putting the accounting back in the users
> hands?

I am not suggesting this, merely giving an example of how another
language decomposes the problem.  Maybe Postscript is a bad example:
almost all programs are written by computers, not humans. Stack
efficiency is not an issue, since the graphics operations (which are
side effects of the primitives) occupy most of the running time.

Knuth's method for name=:p{name suggests overwriting p with its cycle
representation, as Roger described previously.  In my opinion, for
stack operations at the big end the expression to be optimized is

name=:(-p) C. name

where p counts from the top of the stack, starting at 1. This uses
space #p (the number of elements on the stack affected by the
permutation) rather than #name.

Best wishes,

John



----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to