I took advantage of j's residue definition for negative values. My verb rewrites the list keeping the "current position pointer" at the head, thereby losing track of the front of the list.

(list tally) | negative sum of all advancements

computes the front of the list.


parta=: $:&256 : (4 :0)  NB. LENGTHS parta N
 list=. i.y
 skip=. 0
 for_length. x do.
  list=. (length + skip) |. length (|.@:{.)`(i.@:[)`]} list
  skip=. >: skip
  echo length ; skip ; list
 end.
 i=.+/(,i.@:#)x
 list ; i ; ((#list) | -i) ; */ (0 1 + ((#list) | -i)){,~list
)

On 12/11/2017 07:00 AM, [email protected] wrote:
From: Jimmy Gauvin<[email protected]>
To:[email protected]
Subject: [Jprogramming] AOC 10 - explicit to tacit
Message-ID:
        <caelwgoeukwzemzv6rq4bne5jb4ujduyhtjtmydawzkfwbai...@mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to