Here's another look at both:

5!:4 <'f'
      -- 0                               
  ----+- {                               
  │   L- [                               
  +- +                                   
--+   -- ]                               
  │   +- *                               
  │   │   -- [:                          
  L---+   +- i.                          
      │   │    -- [:                     
      L---+    +- >:                     
          │    │    -- ]                 
          L----+    +- ~ --- %           
               │    │                    
               L----+     -- [:          
                    │     +- -           
                    L-----+    -- [:     
                          L----+- / --- -
                               L- [      
  
   5!:4 <'seq'
        -- {.                       
  -- @ -+- [                        
  +- +                              
  │     -- ]                        
--+     +- *                        
  │     │          -- / --- ~ --- - 
  L-----+    -- @ -+- [             
        │    │                 -- i.
        │    │           -- @ -+- >:
        L----+     -- @ -+- <.      
             +- @ -+- %             
             L- ]                   
   
   5!:5 <'f'
(0 { [) + ] * [: i. [: >: ] %~ [: - [: -/ [
   5!:5 <'seq'
{.@[ + ] * -~/@[ i.@>:@<.@% ]
   

Linda


-----Original Message-----
From: programming-boun...@forums.jsoftware.com
[mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Ric Sherlock
Sent: Thursday, August 23, 2012 5:42 AM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Generating a sequence

Here is a tacit version using close to the same algorithm that you propose
below:

   seq=: {.@[ + ] * -~/@[ i.@>:@<.@% ]
   (2 5) seq 0.25
2 2.25 2.5 2.75 3 3.25 3.5 3.75 4 4.25 4.5 4.75 5


On Thu, Aug 23, 2012 at 9:07 PM, Skip Cave <s...@caveconsulting.com> wrote:
> I would like to generate a vector sequence of numbers starting from s 
> and going to e, with increment i here is an explicit function for 
> that:
> s + i * i. 1 + (e-s) %  i
>
>    s =. 2
>    e =. 5
>    i =. 0.25
>
>    s + i *  i. 1 +(e-s) %  i
> 2 2.25 2.5 2.75 3 3.25 3.5 3.75 4 4.25 4.5 4.75 5
>
> what would the tacit form of the sequence verb look like, if we 
> defined the dyadic verb seq  thus:
> (s,e) seq i
>
> --
> Skip Cave
> Cave Consulting LLC
> ----------------------------------------------------------------------
> 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