I think you were referring to the "issue",

  to=. <.+i.@(+ *)@-~

   3 to 3 NB. empty result inherited from <[EMAIL PROTECTED]


but I could not understand your fix (perhaps I put the missing parenthesis in 
the wrong place?).  In the meantime...

   inc=. '&. (%& x )'(1 : )

   3 to (0.5 inc) 7 
3 3.5 4 4.5 5 5.5 6 6.5 7
   
   7 to (0.5 inc) 3
7 6.5 6 5.5 5 4.5 4 3.5 3
   
   Oh yes, beware of,
  
   7 to (0 inc) 3
|NaN error: to
|   7     to(0 inc)3
  
I find the above very useful for plotting purposes.  I had something similar 
written years ago but it was clumsy. 


----- Original Message ----
From: Raul Miller <[EMAIL PROTECTED]>
To: Programming forum <[email protected]>
Sent: Wednesday, September 24, 2008 12:19:29 PM
Subject: Re: [Jprogramming] Integers from x to y

On Wed, Sep 24, 2008 at 11:04 AM, Jose Mario Quintana
<[EMAIL PROTECTED]> wrote:
> That is really neat!  If you still want to include the edge...
>
>    3(<.+i.@(+ *)@-~)7
> 3 4 5 6 7
>
>    7(<.+i.@(+ *)@-~)3
> 7 6 5 4 3

But remember that (+ *) does not do the right thing for a difference
of 0 (where to
get the edge you want a result of 1).

You could instead use (+ *@(0.5&+)@-~ but I prefer -~ + _1 ^ <

FYI,

-- 
Raul
----------------------------------------------------------------------
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