Dear J Forum:
 
Given a vector X of n atoms, and a partition P of non-negative integers that
sum to n; i.e. n = n1+n2+...+nk, how can I efficiently create a list of k
items, whose first atom is the box of the first n1 elements of X, whose
second atom is the box of the next n2 elements, etc?  Empty boxes (ni=0)
must be allowed.  I can do this with difficulty; but I suppose that J
primitives allow it to be done as a one-line tacit dyadic function X
BoxAccTo P.  Thanks.
 
Sincerely,
 
Leigh
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to