On Thu, Aug 23, 2012 at 5:07 AM, 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 ... > what would the tacit form of the sequence verb look like, if we defined the > dyadic verb seq thus: > (s,e) seq i > here is an explicit function for that: > s + i * i. 1 + (e-s) % i
Note that if we do not bother with the increment, a vector going from s to e could be: (+ i.@>:)/ -~/\ s,e (+ i.@>:)/ -~/\ 5 8 5 6 7 8 or maybe a variation such as 0 1 (+ i.)/@:+ -~/\ s,e 0 1 (+ i.)/@:+ -~/\ 5 8 5 6 7 8 But that doesn't give us any really great mechanisms for inserting the "increment". We could use (+ i.@>:&.(%&i))/ -~/\ s,e (+ i.@>:&.(%&3))/ -~/\ 5 8 5 8 but I do not know of any good ways to make i be a tacit argument for that case. We could compute this more directly if instead of s,e,i we had s,i,1+(e-s)%i) +`(*i.)/s,i,1+(e-s)%i +`(*i.)/5 3 2 5 8 So if we can figure out how to build the list s,i,1+(e-s)%i we're done. One approach here could be: (s,e) ([: +`(*i.)/ ,&{., 1 - %&(-/)~) i 5 8 ([: +`(*i.)/ ,&{., 1 - %&(-/)~) 3 5 8 That said, note that most of the work here has to do with dealing with the arguments in the form you specified. And, also, note that you have a dependency between s,e and i -- if (e-s)%i is not an integer you get an error. So, personally, I would ask why you need to be doing this this way -- what are you really trying to accomplish? Thanks, -- Raul ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm