This is the crux of the problem:

   1,''
1
   $1
   $1,''
1
   
What is the simplest way to make the shape of   1,''  be empty?
   
Linda


 -----Original Messapege-----
From: programming-boun...@forums.jsoftware.com
[mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Ric Sherlock
Sent: Thursday, October 04, 2012 2:40 AM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Why the length error?

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 <lindaalv...@verizon.net>
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

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to