That's a bit tricky in this case, but it can be done: First off, the problem:
13 : '(#~x=+/"1)f y' NB. select row 4 : '(#~x=+/"1)f y' But we can work around this by giving 13 : a variant expression: 13 : 't#~x=+/"1 t=.f y' [ (] #~ [ = [: +/"1 ]) [: f ] And, in this example, we can turn this into a hook through inspection: Smps=: (] #~ [ = [: +/"1 ]) f This could be simplified further, of course: 2 ((] #~ (= +/"1)) f) 6 and 2 (((= +/"1) # ]) f) 6 do the same computation. I hope this helps, -- Raul On Sat, Jul 31, 2021 at 12:43 PM Srdjan Stipic <srdjan.sti...@gmail.com> wrote: > > You can use “13 : ‘…’” construct to get tacit verb. > > On Sat 31. Jul 2021 at 18:00, 'Pascal Jasmin' via Programming < > programm...@jsoftware.com> wrote: > > > 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 > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm