On 5/15/07, Dan Bron <[EMAIL PROTECTED]> wrote:
Raul wrote:
> For example, consider
> Y=: i.4 5 9 1
What output do you expect for that case? If you clarify the spec,
I could extend my solution.
I am looking for a wrapped version of i. where
X =: ?10 2 3$2
Y=: ?4 5 3 1$3
X wrappedI Y
is equivalent to
(10 3 3{.X) i. 4 5 3 3{.Y
In other words -- no data lossage, except that argument cells
for i. conform because of added fills ...and no errors because
of argument shape.
For example, something like:
wrappedI=:4 :0
r=.-0 >. _1 + #$x
y=.y{.~1+(r<.-#$y){._1+$y
s=.x >.&(r&{.)&$ y
x i.&:(s&{."(-r)) y
)
(But I was hoping for something more concise.)
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm