It seems not to matter that 1 is in parentheses:

   g=:13 :'1 x}y'
      
   1 3 5 g i.10
0 1 2 1 4 1 6 7 8 9
   
   g
4 : '1 x}y'

But hee is a surprise.
Itemize (,:y) shows up.   

   5!:4 <'g'
      ┌─ 4        
── : ─┴─ ,:'1 x}y'
   
   $'1 x}y'
5
   
   $,:'1 x}y'
1 5
Why is this here?

Linda
   


-----Original Message-----
From: Programming <[email protected]> On Behalf Of Roger 
Hui
Sent: Saturday, July 27, 2019 1:06 AM
To: [email protected]
Subject: Re: [Jprogramming] Learning Tacit Programming

13 : '(1) x}y'  or  13 : '1 x}y'  can not be made tacit because they use a 
function argument (x) as an operand.  Similarly 13 : '+/"y x' or 13 : '+/"x y' 
can not be made tacit either.

Why not, you might ask?  The sequence for an operator is that you _first_ 
derive a function, and _then_ the function is applied to function arguments x 
and/or y .  When you say x} or +/"x  or +/"y , at that point you don't yet have 
the function argument.



On Fri, Jul 26, 2019 at 9:40 PM Devon McCormick <[email protected]> wrote:

> I am intrigued by tacit programming but agree with Henry that you 
> should drink the Kool-Aid with slow, measured sips.
>
> I continue to rely heavily on "13 : .." (to the dismay of tacit 
> die-hards) but still puzzle over why certain expressions cause it to give up, 
> e.g.
>
>    13 : '(1) x}y'
> 4 : '(1) x}y'
>
> Yet this works
>    x=. 2 4 6
>    y=. i.10
>    (1) x}y
> 0 1 1 3 1 5 1 7 8 9
>
> Whereas these do not:
>    x ((1) [}]) y
> 0 1 2 3 4 5 6 7 8 9
>    x ((1)& [}]) y
> 0 6 2 3 4 5 6 7 8 9
>
>
> On Fri, Jul 26, 2019 at 11:53 PM Henry Rich <[email protected]> wrote:
>
> > Yes, you have to think differently.
> >
> > Please, don't make a fetish of tacit programming.  The important 
> > thing about becoming a J programmer is training yourself to look at 
> > the whole problem rather than working with atoms.  That is, getting 
> > over the loop mindset.
> >
> > Problem: You have an array a and you want to apply a linear function
> > y=3x+1 to every atom.  How do you do it?
> >
> > 0. (3 * a) + 1
> > Bravo! You didn't have to loop.  Full marks.
> >
> > 1. 1 + 3 * a
> > Piu bravo!  You are thinking right to left.
> >
> > 2. (1 + 3&*) a
> > Bravissimo!  You have written a little bit of tacit code.  You could 
> > also have written (1 + 3 * ]) a
> >
> > 3. 1 3 p. a
> > Congratulations, you have reached master level.  Let the interpreter 
> > sweat the details.
> >
> >
> > My very first J program was a model of texture processing for a 
> > computer-graphics system.  I imbibed the tacit liquor too deeply, 
> > and wrote the whole thing as a sequence of tacit verbs, 50 of them.  
> > It worked.  It was absolutely unmaintainable.  Don't go there.
> >
> > Use tacit verbs for problems whose spec is mathematically unchangeable.
> > For everything else, use explicit verbs.
> >
> > Henry Rich
> >
> >
> >
> >
> >
> > On 7/26/2019 7:20 PM, The3DSquare Josh Yang wrote:
> > > I was wondering if you guys have any resources for learning tacit 
> > > programming in J. I've been struggling with tacit programming, 
> > > probably because all the other programming languages are mainly explicit.
> > Something
> > > like "Tacit programming for the explicit programmer" would be 
> > > great
> > since I
> > > often fail to derive the tacit equivalent of a series of explicit 
> > > eeaxpressions (especially when there are mutable variables).
> > >
> > > I know I need to think differently, but having some guidance would 
> > > help greatly.
> > > ------------------------------------------------------------------
> > > ---- For information about J forums see 
> > > https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fw
> > > ww.jsoftware.com%2Fforums.htm&amp;data=02%7C01%7C%7Cbee23238788f4c
> > > 6797a408d712502b9c%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C63
> > > 6998007844844113&amp;sdata=1N2L%2BXvxZpRcW5HmcfClWxo9xt%2Fi%2BYJXc
> > > WkdRSmMDs8%3D&amp;reserved=0
> >
> >
> > ---
> > This email has been checked for viruses by AVG.
> > https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fww
> > w.avg.com&amp;data=02%7C01%7C%7Cbee23238788f4c6797a408d712502b9c%7C8
> > 4df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636998007844844113&amp;sda
> > ta=XcPRZc2FCxfsXOitXh4CazEAK4rJ2icX5c5Vpj9xIsw%3D&amp;reserved=0
> >
> > --------------------------------------------------------------------
> > -- For information about J forums see 
> > https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww
> > .jsoftware.com%2Fforums.htm&amp;data=02%7C01%7C%7Cbee23238788f4c6797
> > a408d712502b9c%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C63699800
> > 7844844113&amp;sdata=1N2L%2BXvxZpRcW5HmcfClWxo9xt%2Fi%2BYJXcWkdRSmMD
> > s8%3D&amp;reserved=0
> >
>
>
> --
>
> Devon McCormick, CFA
>
> Quantitative Consultant
> ----------------------------------------------------------------------
> For information about J forums see 
> https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.j
> software.com%2Fforums.htm&amp;data=02%7C01%7C%7Cbee23238788f4c6797a408
> d712502b9c%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C63699800784484
> 4113&amp;sdata=1N2L%2BXvxZpRcW5HmcfClWxo9xt%2Fi%2BYJXcWkdRSmMDs8%3D&am
> p;reserved=0
>
----------------------------------------------------------------------
For information about J forums see 
https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&amp;data=02%7C01%7C%7Cbee23238788f4c6797a408d712502b9c%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636998007844844113&amp;sdata=1N2L%2BXvxZpRcW5HmcfClWxo9xt%2Fi%2BYJXcWkdRSmMDs8%3D&amp;reserved=0
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to