On 5/15/07, Dan Bron <[EMAIL PROTECTED]> wrote:
RM=Raul Miller, RH=Roger Hui, DB=me
RM> what's a good idiom to extend cells of
RM> x and/or y with fills, such that their
RM> shapes conform?
X =: i.10 2 3
Y =: i.4 5 2 4
r =: 0>.(#$X)-1
Z =. (}.$ X) {."r Y
X i. Z
10 10 10 10 10
10 10 10 10 10
10 10 10 10 10
10 10 10 10 10
Ok, but this only works for the specific illustrated
case.
For example, consider
Y=: i.4 5 9 1
Also note that with i. values this is just an academic
exercise. It becomes more interesting when comparing
text in character arrays (where trailing spaces are often
irrelevant).
(But perhaps that specific case would be better addressed
using i.&:(<@dtb"1)).
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm