[Jprogramming] Learning Tacit Programming

Henry Rich henryhrich at gmail.com
Wed Aug 14 14:39:05 UTC 2019


Remember that tacit programming is not an all-or-nothing idea. You can 
write small bits of tacit code as part of explicit definitions.  In fact 
I think that's the best way to write most J code.

Program spec: given 2 lists x and y, find the index of the largest value 
in y, and increment the corresponding value in x.  Result is the new x.
Example: given x=1 2 3 and y=4 2 3, result is 2 2 3.

First version: (all this code is untested)
tallybig =: 4 : 0
bigy =. >./ y
bigyindex =. y i. bigy
xatindex =. bigyindex { x
x =. (>: xatindex) bigyindex} x  NB. new x becomes result
)

Second version:
tallybig =: 4 : 0
bigyindex =. (i. >./) y
xatindex =. bigyindex { x
x =. (>: xatindex) bigyindex} x  NB. new x becomes result
)

There's a little bit of tacit code there!

Third version:
tallybig =: 4 : 0
bigyindex =. (i. >./) y
x =. bigyindex >:@:{`[`]} x  NB. new x becomes result
)

More tacit code!

You could keep going till you get a full tacit program, but I would stop 
here.

Henry Rich


On 8/14/2019 7:43 AM, Ian Clark wrote:
> Thanks, Henry.
>
> Yes, Dissect certainly needs inclusion, since it came along post-2012. That
> did occur to me during the night.
>
> I've inserted a stub about Dissect into
>     https://code.jsoftware.com/wiki/Guides/Tacit_to_explicit_roadmap
>
> I've put it last (but not least), under "Approach #2", since IMO that is
> its natural home.
>
> As a general comment about the roadmap, it strikes me that the whole of the
> section "Approach #1" needs reformatting to give it a proper set of
> subheadings like "Approach #2". At present, actual links stand-in for
> subheadings – but that means they don't appear in the Table of Contents.
>
> As I never tire of saying, this is a wiki: if you see just how to alter it
> to make it better, go ahead and edit it yourselves.
>
> On Wed, 14 Aug 2019 at 10:09, Henry Rich <henryhrich at gmail.com> wrote:
>
>> Dissect is available now as an aid to seeing what happened in your tacit
>> sentence:
>>
>> https://code.jsoftware.com/wiki/Vocabulary/Dissect
>>
>> Henry Rich
>>
>>
>>
>> On 8/13/2019 11:21 PM, Ian Clark wrote:
>>> Josh Yang wrote:
>>>> I was wondering if you guys have any resources for learning tacit
>>> programming…
>>>
>>> There's a mountain of stuff in jwiki which purports to help a beginner
>> with
>>> tacit code. Too much IMO -- with too little feedback on what's proved to
>> be
>>> helpful and what hasn't.
>>>
>>> It would be nice to identify a royal road to point beginners along. But
>>> that idea comes to grief thanks to "cognitive style" -- different
>> beginners
>>> bring different aptitudes and past experiences to the task of learning J.
>>>
>>> In 2012 I tried to pull together into a roadmap all the material I could
>>> identify as relevant:
>>>      https://code.jsoftware.com/wiki/Guides/Tacit_to_explicit_roadmap
>>> I omitted the main texts in the corpus of J Help however, e.g. LJ, JforC,
>>> etc.
>>>
>>> My aim was not to throw-in yet-another potted tutorial on tacit
>>> programming, but to survey what was out there and discuss the different
>>> approaches taken, plus the tools (then) available, without presuming to
>>> critique each page: i.e. to say whether the approach was any good. In the
>>> absence of feedback I had no way of telling that.
>>>
>>> This proved to be a tall order: I needed to adopt a viewpoint from which
>> to
>>> survey the field, and explain it in terms a beginner might possibly
>>> understand. Re-reading it 7 years later, I'm not sure I was altogether
>>> successful.
>>>
>>> It's too much to hope a beginner might "learn tacit programming" from
>>> reading this roadmap. But if you're a beginner, and shopping for a
>> tutorial
>>> on the topic, this roadmap surveys and comments on each (then) available
>>> page, and you might just understand enough of what's said to decide if
>> you
>>> like the approach it takes enough to persevere with it.
>>>
>>> Let me know if I've missed anything, or if any new tools and tutorials
>> have
>>> come along since 2012 which the roadmap needs to cover.
>>>
>>> On Sat, 27 Jul 2019 at 00:20, The3DSquare Josh Yang <
>>> joshua.the3dsquare at gmail.com> 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
>>>>
>>> ----------------------------------------------------------------------
>>> 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
>>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm



More information about the Programming mailing list