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 http://www.jsoftware.com/forums.htm
>
>
> ---
> This email has been checked for viruses by AVG.
> https://www.avg.com
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

Quantitative Consultant
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to