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