See comments below.
On 2016-08-07 01:35, robert therriault wrote:
For those particular monadic verbs ([: – [: – [: – [: – ]) I would use ] rather
than (-&-@- – ]), but maybe what is happening is that I am suggesting the
specific case, while you are expressing a more general application.
And how would you express a sequence of 4 monadic verbs? Obviously it is
totally impossible to get an answer to this question.
Can you come up with an example where (u1 & u2 @ u3 u4) would be an expression
that would be preferred for some [: u1 [: u2 [: u3 [: u4 as monadic verbs?
If I knew the answer to my own question I would not ask it. I never saw
anyone else cap most of their monadic verb applications. I repeatedly
proposed it in the J forums but no one liked this way to write. Same
reactions as in this thread. Your second example is a hook. In my second
example, (-&-@- – ]) , u4 is dyadic, however, my second example is
resembling(looks like) common ways to write J code as I see it.
Here is a code example with consistent use of @: which I would consider
proper, even if it obviously would not optimize memory use.
viewmat@:((>:@:i.@:#@:[)`(<"1@:[)`(])} (0 $~ >:@:(>./)))@:xy@:visits ROUTE
This author is not consistent, sometimes & , sometimes @ . It is hard to
see without analysing the code if the conjunctions @ and & are just
monadic verb applications or if they are used to create a loop, so the
use of these conjunctions instead of Cap makes the code very difficult
to read, as I see it. It is more acceptable to use @: as I see it. If
you really need a loop you can use @ , as I see it. The use of & in one
place and @ in another seems a little onordered, but possibly these
equivalent operators have some difference in meaning in some modeling
theory.
The use of @ and & when they are not needed can make the code very much
slower.
Toponm =: ((;@#~ ([ , $:@(-.L:1~)^:(*.&*&#)) (#~ -.)) 1&>:@#@>) Nm
There are 44 uses of Cap on this page:
http://code.jsoftware.com/wiki/Essays/Advent_Of_Code#Part_1, so Cap is
sometimes used, but not often.
I am a fan of tacit programming mainly because these mental gymnastics often
give me insights into the problem that I may have missed. If you already have
those insights then I can see why it could feel bothersome.
I have a similar experience and similar motivations.
Cheers, bob
On Aug 6, 2016, at 4:17 PM, Erling Hellenäs <[email protected]> wrote:
The important point in this seems to be how most J programmers would write a
sequence of 4 monadic verbs and the rationality they have for writing like that. I
think they would write something like this, (-&-@- – ]) , but I might be wrong
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm