Kairit wrote:
>  Now I tried to rewrite my code by following your 
>  suggested pattern.

>  but I get the length error and I don't understand 
>  what's wrong.

I just saw this message.  I looked at the code you wanted to refactor, but 
noted right off that it's inoperative.  Specifically, I
saw you had a lot of letter case problems (e.g.  In 'If.' vs 'if.' the former 
is an error in J).  I bet these problems were
introduced (automatically) by your mail client.

So here's what to do:

   1.  First, describe the code's purpose.  Tell us, in a 
       sentence or two, what it's supposed to do (i.e. what
       the goal of the program is).

   2.  Second, take the code you want to refactor.

       a.  Make sure it runs properly in J.  

       b.  Ensure the example is stand alone.  That is,
           if we type exactly what you post into J, we get
           exactly the same results as you.  (So, for 
           example, if you depend upon a global name, be 
           sure to include the lines that define that 
           global name).  

       c.  Include a couple of examples of its use (i.e.
           give us example arguments).

   3.  Third, ensure that your mail client doesn't intrude
       again.  Right before you hit "send":

       a.  Highlight the code in the email.  
       b.  Copy it.  
       c.  Start a new, fresh J, without any custom 
           profile.  
       d.  Open a new, fresh script window (IJS).  
       e.  Paste the code.  
       f.  Run the window.  
       g.  Confirm you see the desired results.  

All this is kind of a hassle, but it does make it easier for us to understand 
your code and help with your problems.

-Dan

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

Reply via email to