This gives a length error because (1,'') # '' |length error | (1,'') #''
An simple solution to your problem is to returns the input on error: rad=: (#~ [: -. 0 , 2 -:/\ ])@|: :: ] rad '' rad B 3 2 5 1 4 6 On Thu, Oct 4, 2012 at 6:41 PM, Linda Alvord <[email protected]> wrote: > > rad=: 13 :'(A=:1,-. 2-:/\|:y)#"1 y' NB. Remove adjacent duplicates > > ]B=:2 4 $3 5 5 4 2 1 1 6 > 3 5 5 4 > 2 1 1 6 > rad B > 3 5 4 > 2 1 6 > > > The verb rad works as expected, but suppose in an earlier step B has > become empty, I get a length error. Why does this happen? > > > C=:'' > rad C > |length error: rad > | (A=:1,-.2-:/\|:y) #"1 y > A > 1 > 1#"1 C > > What can I do to get an empty result? > > Linda > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
