I was thinking that i: with a complex argument would get you there, eg:
5+i:2 2j2
3 4 5 6 7
3 5 7 5 5 NB. why the trailing 5s?
but bending it to your wishes looks a bit tricky.
I vaguely recalled there was a utility verb, "steps." I've found it in
various addons;
I think it's in one of the standard libraries, too:
steps=: {. + (1&{ - {.) * (i.@>: % ])@{:
steps 3 7 2
3 5 7
steps 3 7 3
3 4.33333 5.66667 7
I see someone else has just posted, but I'll send this anyway, having
spent a few minutes on it!
Cheers,
Mike
On 29/03/2020 10:52, Rudolf Sykora 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
--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm