There is no context in my example. I used it only to show the unnatural order 
of the arguments in the verb v.

I know about different types of Fold - Single and Multiple.

I chose such an example to show that the values ​​of the array on the right 
fall into the verb on the left,
which is not obvious and you need to remember, which guarantees more errors for 
programmers with this.

If the value is to the right of the Fold, then it is more intuitive if it falls 
into the verb v exactly as the right argument.

Yes, if I remember this unnatural order of arguments in the verb v, then it 
will not be difficult for me to swap the arguments.

But why complicate programming and force programmers to remember all sorts of 
argument permutations, if you can do without it?

When programming, I just made a mistake with the order of the arguments in the 
verb.
Therefore, I wrote to this mailing list.

Last time I asked to correct the unnatural order of the Fold verbs. And, 
fortunately, it was done.

Now there is a trifle left - to make the passing of values into a verb clearer. 
Just swap.

Sergey

23.02.2021 13:58, Raul Miller:
You should also look at the context where you made that suggestion.

Here's your example, restated:

V=: {{x+y [ echo x,y}}
    7 ]F:. V 1 2 3 4
1 7
2 8
3 10
4 13
8 10 13 17

And, related:
    7 ]F.. V 1 2 3 4
1 7
2 8
3 10
4 13
17

Now this second example is performing the same operations, but is
simpler.  It's equivalent to this:

    (((7 V 1) V 2) V 3) V 4
7 1
8 2
10 3
13 4
17

And you are asking that the argument order be swapped, because that
would be "more intuitive".

What I am asking is: *why* should we imagine that a swapped argument
order would be "more intuitive"?

Anyways, if you actually wanted to swap the x and y inside V, you
could do that like this:
    V=: {{y+x [ echo y,x}}

Thanks,

--
Raul


On Tue, Feb 23, 2021 at 2:50 AM 'Sergey Kamenev' via Programming
<[email protected]> wrote:

Not. I talked about swapping the arguments x and y inside the verb v.
In 'see_arg' in my example

23.02.2021 0:27, Raul Miller пишет:
I thought you were talking about using that verb in a fold operation
which proceeds from left to right?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

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

Reply via email to