Yes that's more like what I was hoping for. Very nice Arie!
On Thu, Dec 7, 2017 at 11:29 AM, Arie Groeneveld <[email protected]> wrote: > Nice Jish like? > > (([+{);>:@{`[`]})&>/ ::]^:a:@(0&;) 0 3 0 1 _3 > > > > Op 05-12-17 om 23:05 schreef Ric Sherlock: > >> Did anyone come up with a nice Jish solution for this? >> >> Mine (see below) ended up being very scalar. >> >> >> >> >> >> >> >> >> >> >> >> >> >> countJumps=: 3 :0 >> >> count=. idx=. 0 >> >> offsets=. y >> >> while. (0 <: idx) *. (idx < #offsets) do. >> >> count=. count + 1 >> >> idx_new=. idx ([ + {) offsets >> >> offsets=. idx (1 + {)`[`]} offsets >> >> idx=. idx_new >> >> end. >> >> count;idx;offsets >> >> ) >> >> >> countJumps 0 3 0 1 _3 >> >> 5 >> ---------------------------------------------------------------------- >> 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
