Jan-Pieter, I used my "amend" approach with your great parsing and your method was 4 times as fast and 6.3 times as space efficient as mine.
FYI, my definitions are as follow.
cells =: <@{.+each,@{@(<@:i."0@(>:@-~/))@]
toggle =: -.@(cells@[ { ])`(cells@[)`]}
on =: 1:`(cells@[)`]}
off =: 0:`(cells@[)`]}
through =: ,:
--
(B=)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
