> > This general case version can be a bit slow, because J > currently includes > no special code to support this case. (No one has presented > any really > convincing cases about why something this obscure should be > made really > fast.)
I have brought this up at least twice. The case is not obscure at all: it arises when you have to apply a verb to a sequence of items with some state information carried forward from item to item. In general, the state information is not the same type as the items, so boxing is needed. The issue is not so much with u/ as with u/\. which you use if you need the result from each item. The last time I brought this up, Roger dismissed it because the current implementation is pretty fast. That, I think, missed the point, which is that the current implementation uses so much memory as to be unworkable for some problems. If the state information is passed from each item to the next, it will be present in each item of the result of u/\. so if I have 100 bytes of state to process a list of 1,000,000 integers, my result will be 100MB in size when I really need only 4MB. You can add some zeros to the sizes until you agree there's a problem. There would be a side benefit in avoiding boxing, avoiding the cost of the initial append, the |., etc., but those savings are not vital. Saving orders of magnitude of memory usage might be. The alternative is to make u an explicit verb that keeps its state in a public noun. Henry Rich ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
