I just want to read this into the record.

The task: to run substrings of a string y together in a single list, where the substrings are given by an nx2 table x of (start,length) pairs.

The best solution is:

x (,."1@[ ;@:(<;.0) ]) y

(as of the next 9.01 beta).

The ,."1@[ creates a virtual block; the ;@:(<;.0) creates a virtual block for each substring AND calculates the length of the final result as it goes along.  The characters are moved only once.

This is not special code; it's code that takes advantage of the features that are generally available.

Henry Rich

---
This email has been checked for viruses by AVG.
https://www.avg.com

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

Reply via email to