q: in ^/__ q:4200  is dyad
executed  as
  ^/ ( __ q: 4200 )

Вт, 05 июл 2016, Martin Kreuzer написал(а):
> Please be patient while I elaborate;
> 
> Ric -
> -----
> Looking at your solution, I first read up on "Key" (x u /.. y) and came up
> with this example:
> 
>    2 3 2 3 3 (2&|)/. 9 5 7 6 4
> 1 1 0
> 1 0 0
> 
> which I interpreted as
> * group the list on the left (2 2) (3 3 3), then
> * partition the list on the right accordingly (9 7) (5 6 4), then
> * apply decision between odd (1) and even (0) to the two partitions;
> (the zero in the first row is patched).
> 
> I then did 'group' and 'tally' on a vector (along an example borrowed from
> NuVoc page)
> 
>    ]a=. 7 9 8 7 8 7
> 7 9 8 7 8 7
>    (a # /. a)
> 3 1 2
>    (~. a) ,:(a # /. a)
> 7 9 8
> 3 1 2
> 
> to show the frequency of each item.
> 
> Replacing 'tally' by 'multiply' and extracting (a)
> 
>    (a */ /. a)
> 343 9 64
>    (*/ /.~) a
> 343 9 64
> 
> I arrived the sought verb
> 
>    red=. */ /.~
>    red q: 4200
> 8 3 25 7
>    ] v=. q: 4200
> 2 2 2 3 5 5 7
>    red v
> 8 3 25 7
> 
> Don -
> -----
> Looking at your solution, I first tried to put it ( in my naive way) into a
> verb like
> 
>    red=. ^/__
>    red q: 4200
> 2 3 5 7
> 3 1 2 1
>    red v
> |syntax error
> |       red v
> 
> The first result looked similar to the above frequency table, which inspired
> me to follow this path:
> 
>    reduc=. 13 : '^/ (~.y) ,:(y#/.y)'
>    reduc v
> 8 3 25 7
>    reduc q:4200
> 8 3 25 7
>    reduc=. [: ^/ ~. ,: # /.~
>    reduc q: 4200
> 8 3 25 7
>    reduc v
> 8 3 25 7
> 
> This gives the correct answer but is way from  what you suggested ...
> Would you kindly explain how you arrived at your code..?
> 
> Thanks
> -M
> 
> At 2016-07-04 21:50, you wrote:
> 
> >    ^/__ q:4200
> > 
> > 8 3 25 7
> > 
> > On Mon, Jul 4, 2016 at 3:48 PM, Ric Sherlock <tikk...@gmail.com> wrote:
> > 
> > > How's this?
> > >    *//.~ q: 4200
> > > 8 3 25 7
> > 
> > > On Tue, Jul 5, 2016 at 9:46 AM, Kip Murray <thekipmur...@gmail.com> wrote:
> > 
> > > > Consider
> > > >
> > > >     q: 4200
> > > >  2 2 2 3 5 5 7
> > > >
> > > > How would you "reduce" this to  8 3 25 7  ?
> > > > Write the verb red:
> > > >
> > > >     red q: 4200
> > > >  8 3 25 7
> > > >
> > > > --Kip Murray
> > > >
> > > >
> > > >
> > > > --
> > > > Sent from Gmail Mobile
> > > > ----------------------------------------------------------------------
> > > > 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

-- 
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
gpg --keyserver subkeys.pgp.net --armor --export 4434BAB3
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to