I have used this pair for a very long time,

   to=. [ + 1 i.@+ <.@-~
   inc=. (%&) ((<,'&.')`) (`:6)  NB. replacing <'&.' to make it "future proof"

   0 to 10
0 1 2 3 4 5 6 7 8 9 10

   0 to (10 inc) 100
0 10 20 30 40 50 60 70 80 90 100

   0j2 to (0.1j_0.2 inc) 1j0
0j2 0.1j1.8 0.2j1.6 0.3j1.4 0.4j1.2 0.5j1 0.6j0.8 0.7j0.6 0.8j0.4 0.9j0.2 1


On Sun, Mar 29, 2020 at 5:52 AM Rudolf Sykora <[email protected]> wrote:
>
> Dear all,
>
>
> how do you usually generate a sequence of integers from 'a' to 'b' with
> a step 's'?
>
> If I ignore the step, yesterday I wrote
>
>    interval=.{.+(i. @ >: @ ({:-{.))
>    interval 5 19
> 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
>
> but that seems overly complicated...
> Then I can include the step in this way
>
> _3 {.\ interval 5 19
> 5 8 11 14 17
>
> Putting the two parts together would make it even more complicated.
> There must be a better way...
>
>
> Thanks
> Ruda
> ----------------------------------------------------------------------
> 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