Jan-Pieter,

Thank you very much for your solution.
Puzzling through it really helped me.
I think your approach is really clever and your comments were perfect.
I had trouble understanding your off, on, an toggle until I realized you
were updating the whole array each time, because my (incomplete) approach
had involved using amend and only updating the 'through' cells each time.
Your approach using both positive and negative indexing with { also were a
break through for me.

On Mon, Dec 7, 2015 at 4:30 PM, Jan-Pieter Jacobs <
janpieter.jac...@gmail.com> wrote:

> This is my (entirely tacit) solution to problem of day 6.
> it works by exploiting a pair of nice J features:
>
> - ;: for parsing words and it's inverse to piece it together with spaces.
> - "on","off" and "toggle" defined for changing the lights
> - "through" for generating lights corresponding to the given indices.
> - s5parse splits the lines, adds a pair of parentheses, parses words, and
> rearranges them so each line is formatted as (x1 y1 through x2 y2)
> action-verb.
> - Reverse order, so it uses strict right to left precedence, and join into
> one long phrase.
>
> Have fun with the deciphering!
>
> --
(B=)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to