2 ([ (] #~ [ = +/"1@:]) f@]) 6
On Saturday, July 31, 2021, 11:52:10 a.m. EDT, 'Bo Jacoby' via Programming <programm...@jsoftware.com> wrote: Consider this code f=.#&2#:[:i.2&^ NB. 0-1 rows Smps=. 4 : '(#~x=+/"1)f y' NB. select rows 2 Smps 6 NB. for example 0 0 0 0 1 1 0 0 0 1 0 1 0 0 0 1 1 0 0 0 1 0 0 1 0 0 1 0 1 0 0 0 1 1 0 0 0 1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 1 1 0 0 0 1 0 0 0 0 1 1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 1 1 0 0 0 0 I want to rewrite it tacit Smps=.((=+/)"1 f)#f@] This works but is without the hook, so "f" is repeated. How to write the hook tacitly? I believe that this is easy, but I am stuck. Thank you! Bo. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm