That is an interesting application.  The original verb (alpha) could have
been defined as follows,

   sum=. +/
   count=. #

   ( alpha=. (sum , count, sum % count )f."1 )
(+/ , # , +/ % #)"1

the one (beta) using a form of teleportation is produced as follows (beware
of wrapping),

   in=.  adverb def 'y [ (m,''_inout_'')=: y'
   out=. adverb def '3 : (m,''_inout_'')'

   ( beta=. ('sum'out , 'count'out , 'sum'in@(+/) % 'count'in@#)"1 )
(3 : 'sum_inout_' , 3 : 'count_inout_' , 'sum' (1 : 'y [ (m,''_inout_'')=:
y')@(+/) % 'count' (1 : 'y [ (m,''_inout_'')=: y')@#)"1

I often use a different method [0] for refferencing the results of previous
calculations (without embbeding explicit definitions), which for the case
at hand produces the following tacit verb (gamma),

   gamma=. (1&({::) , 2&({::) , 1&({::) % 2&({::))@:(<@:(#@:(0&({::))) 2}
])@:(<@:(+/@:(0&({::))) 1} ])@:(,&(<;._1 ' . .')@:<)"1

This is how they compare using different arguments,

   stp=. ] (([ ((<;._1 '|Sentence|Space|Time|Space * Time') , (, */&.:>@:(1
2&{))@:(] ; 7!:2@:] ; 6!:2)&>) (10{a.) -.&a:@:(<;._2@,~) ]) [ (0 0 $
13!:8^:((0 e. ])`(12"_)))@:(2 -:/\ ])@:(".&.>)@:((10{a.) -.&a:@:(<;._2@,~)
]) ::(0 0&$@(1!:2&2)@:('Mismatch!'"_))) ".@:('0( : 0)'"_)


   T=. i.3 11

   stp 666
  alpha  T
  beta   T
  gamma  T
)
┌──────────┬─────┬──────────┬────────────┐
│Sentence  │Space│Time      │Space * Time│
├──────────┼─────┼──────────┼────────────┤
│  alpha  T│1792 │4.12658e_6│0.00739483  │
├──────────┼─────┼──────────┼────────────┤
│  beta   T│2560 │1.52727e_5│0.039098    │
├──────────┼─────┼──────────┼────────────┤
│  gamma  T│2240 │9.80135e_6│0.021955    │
└──────────┴─────┴──────────┴────────────┘

   T=. i.33 111

   stp 666
  alpha  T
  beta   T
  gamma  T
)
┌──────────┬─────┬───────────┬────────────┐
│Sentence  │Space│Time       │Space * Time│
├──────────┼─────┼───────────┼────────────┤
│  alpha  T│2560 │4.70158e_5 │0.12036     │
├──────────┼─────┼───────────┼────────────┤
│  beta   T│3328 │0.000142892│0.475544    │
├──────────┼─────┼───────────┼────────────┤
│  gamma  T│3776 │6.78763e_5 │0.256301    │
└──────────┴─────┴───────────┴────────────┘

   T=. i.33 11111

   stp 66
  alpha  T
  beta   T
  gamma  T
)
┌──────────┬──────┬───────────┬────────────┐
│Sentence  │Space │Time       │Space * Time│
├──────────┼──────┼───────────┼────────────┤
│  alpha  T│2560  │0.00103981 │2.66192     │
├──────────┼──────┼───────────┼────────────┤
│  beta   T│133376│0.00107527 │143.415     │
├──────────┼──────┼───────────┼────────────┤
│  gamma  T│133824│0.000839982│112.41      │
└──────────┴──────┴───────────┴────────────┘

The comparisons above might evoke the KISS principle.  ;)  (I know, Iknow,
it was just an illustration.)

[0] The verb (gamma) was produced, breaking a lot of J rules, with the aid
of a Tacit Toolkit (similar to those which I have shown before) as follows,

   (Y SUM COUNT)mn
┌───────┬───────┬───────┐
│0&({::)│1&({::)│2&({::)│
└───────┴───────┴───────┘

   gamma=. [ tv f. "1
  (SUM COUNT)local o <
  SUM   h (+/ o Y)
  COUNT h (#  o Y)
  SUM , COUNT , SUM % COUNT
)

   gamma
(1&({::) , 2&({::) , 1&({::) % 2&({::))@:(<@:(#@:(0&({::))) 2}
])@:(<@:(+/@:(0&({::))) 1} ])@:(,&(<;._1 ' . .)@:<)"1

However, the verb itself (gamma) is kosher, as far as I know.




On Mon, Nov 25, 2019 at 8:28 AM Kirk Iverson <kbi.jsoftw...@gmail.com>
wrote:
>
> Anyone following this thread may be interested in a short discussion
> between Igor Zhuravlov, Raul Miller, and myself on Raul's user_talk wiki
> page:
> https://code.jsoftware.com/wiki/User_talk:Raul_Miller
>
> /K
>
>
>
> > Date: Sun, 24 Nov 2019 15:59:29 -0500
> > From: Jose Mario Quintana <jose.mario.quint...@gmail.com>
> > To: Programming forum <programm...@jsoftware.com>
> > Subject: Re: [Jprogramming] Explicit vs tacit with assignment
> > Message-ID:
> >         <CABtFPKt21uj8RWg_xuU2ELX=
> > pr93ao8h4qhmojqnkk7wesx...@mail.gmail.com>
> > Content-Type: text/plain; charset="UTF-8"
> >
> > > To break the rules deliberately one must first know where to swing!
> >
> > Certainly...
> >
> > "Learn the rules like a pro, so you can break them like an artist."
> >
> > Picasso
> >
> > Did he know of what he spoke?  His father, a painter and a teacher,
> > reportedly overwhelmed gave his own palette, brushes, and colors to his
> > thirteen-year-old son stating that he will never paint again. This,
> >
> >   https://www.pablo-ruiz-picasso.net/work-9.php
> >
> > illustrates what he knew when he was fifteen years old.
> >
> > Back to the subject of tacit assignment, how can one faithfully (to some
> > extent) reproduce the behavior of the explicit verb 3 : 'a,a=:?@#y'
> > (e.g,
> >
> >    3 : 'a,a=:?@#y' '01234'
> > 4 4
> >    a
> > 4
> >
> > ) tacitly?  (Yes, using a global assignment as opposed to the original
> > local assignment, to make things more interesting.)
> >
> > Right, producing named entities seems to be against the spirit of tacit
> > writing.  In addition, a copula is neither a noun, verb, adverb nor
> > conjunction.  Nevertheless, one can simply ignore those minor details
and
> > go ahead anyway,
> >
> >    (('a'"_) ,&:". 'a=: ' , ":@:?@#) '01234'
> > 3 3
> >    a
> > 3
> >
> >    (('a'"_) ,&:". 'a=: ' , ":@:?@#) ''
> > 0.732158184 0.732158184
> >    a
> > 0.732158184
> >
> > Perhaps surprisingly, a more challenging puzzle is to reproduce the
> > behavior of,
> >
> >    4 :'(x)=:y'
> >
> > tacitly.
> >
> > On Sat, Nov 23, 2019 at 8:53 PM Louis de Forcrand <ol...@bluewin.ch>
> > wrote:
> > >
> > > To follow up on all this, while I am a member of the generation which
> > might write off "lie", I find that correct grammar and spelling are
> > qualities necessary (although certainly not sufficient) for writing
clearly
> > and with good style, and in learning the former one inevitably improves
on
> > the latter.
> > >
> > > To break the rules deliberately one must first know where to swing!
> > >
> > > Cheers,
> > > Louis
> > >
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to