And what is the point of your example please? If you append an m-item table to an n-item one the resultant table has m+n items. That works when m or n or both are 0. No surprise here.
In the original example a list is appended to a table. The list is treated as a one-row table. On Fri, Jan 11, 2013 at 2:39 PM, Graham Parkhouse < graham.parkho...@ntlworld.com> wrote: > (0 2$0),i.2 2 > 0 1 > 2 3 > > On Fri, 11 Jan 2013 09:00:42 -0800 > Roger Hui <rogerhui.can...@gmail.com> wrote: > > > It is not a bug and the following sequence illustrates why the behavior > > is > > reasonable: > > > > (n$0) , i. 2 2 [ n=: 3 > > 0 0 0 > > 0 1 0 > > 2 3 0 > > (n$0) , i. 2 2 [ n=: 2 > > 0 0 > > 0 1 > > 2 3 > > (n$0) , i. 2 2 [ n=: 1 > > 0 0 > > 0 1 > > 2 3 > > (n$0) , i. 2 2 [ n=: 0 > > 0 0 > > 0 1 > > 2 3 > > > > > > > > On Fri, Jan 11, 2013 at 8:52 AM, Steven Taylor <tayl...@gmail.com> > > wrote: > > > > > I didn't expect this extra (0 0) in the result. > > > > > > (0 $ 0),i. 2 2 > > > 0 0 > > > 0 1 > > > 2 3 > > > > > > i.e. nothing prepended to shape equals the same shape (not more or > > less) > > > > > > Is this a bug, or does this make sense in some situations? What > > should the > > > J way be? > > > > > > For a simple list, we get my expected behaviour : > > > > > > (0 $ 0),i. 3 > > > 0 1 2 > > > > > > Here's a possible solution > > > > > > empty=:(<'') = [: < [ > > > > > > empty 0 $ 0 > > > NB. build result > > > (xci sort~ u,xa),ya > > > ) > > > > > > empty=:(<'') = [: < [ > > > > > > carefulappend=:13 : '(empty x)}. x,y' f. > > > > > > carefulappend2=:4 : 0 > > > if. (empty x) do. > > > r=.y > > > elseif. empty y do. > > > r=.x > > > elseif. do. > > > r=.x,y > > > end. > > > r > > > ) > > > > > > (0 $ 0) carefulappend i. 2 2 > > > 0 1 > > > 2 3 > > > > > > (0 $ 0) carefulappend2 i. 2 2 > > > 0 1 > > > 2 3 > > > > > > thanks, > > > -Steven > > > --------------------------------------------------------------------- > > - > > > For information about J forums see > > http://www.jsoftware.com/forums.htm > > > > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm