Pascal's solution 
   2 ([ (] #~ [ = +/"1@:]) f@]) 6
uses a fork rather than a hook.
By the way is can be further simplified into
   2 ((] #~ [ = +/"1@:]) f) 6

Thank you everyone!
Bo.    Den lørdag den 31. juli 2021 18.43.11 CEST skrev Srdjan Stipic 
<[email protected]>:  
 
 You can use “13 : ‘…’” construct to get tacit verb.

On Sat 31. Jul 2021 at 18:00, 'Pascal Jasmin' via Programming <
[email protected]> wrote:

> 2 ([ (] #~ [ = +/"1@:]) f@]) 6
>
>
>
>
>
>
> On Saturday, July 31, 2021, 11:52:10 a.m. EDT, 'Bo Jacoby' via Programming
> <[email protected]> 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

Reply via email to