Subject: Re: [Jprogramming] Fold experience
Your diagram isn't right. Rather than a column y{UV, you need a column y, the
first entry in which would be 3.
The first application of foo is
3 foo 0 0 0
which gives a result of shape 3 3 .
The next application of foo is
2 foo (3x3 array)
g
4
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Fold experience
Fold principles:
1. The items of y [and x] are applied to the x argument of v. This is
analogousto u/ y and u/\. y. The underlying J principle is that when a verb
operates multiple times, it operates repeatedly on its y argument. Th
l Message-
From: Programming On Behalf Of Henry
Rich
Sent: dinsdag 7 september 2021 16:44
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Fold experience
Fold principles:
1. The items of y [and x] are applied to the x argument of v. This is
analogousto u/ y and u/\. y. The und
: [Jprogramming] Fold experience
The diagram shows the y argument to the fold on the left and the x argument to
the fold on the right. So that cannot be the issue you are talking about.
The diagram shows y0 being used first, y1 second and so on, which matches what
we saw happening in action. So that
Boss
>
>
> -Original Message-
> From: Programming On Behalf Of
> Raul Miller
> Sent: dinsdag 7 september 2021 11:28
> To: Programming forum
> Subject: Re: [Jprogramming] Fold experience
>
> The diagram shows the y argument to the fold on the left and the x ar
does swapping the parameters (with ~) not work?
Thanks.
R.E. Boss
-Original Message-
From: Programming On Behalf Of Raul
Miller
Sent: dinsdag 7 september 2021 11:28
To: Programming forum
Subject: Re: [Jprogramming] Fold experience
The diagram shows the y argument to the fold on the
to /\. , where all items are equal, and you are forced to use
> boxes.
>
>
> R.E.Boss
>
>
> -Original Message-
> From: Programming On Behalf Of
> Raul Miller
> Sent: dinsdag 7 september 2021 10:16
> To: Programming forum
> Subject: Re: [Jprogramming]
essentially from an item of y,
contrary to /\. , where all items are equal, and you are forced to use boxes.
R.E.Boss
-Original Message-
From: Programming On Behalf Of Raul
Miller
Sent: dinsdag 7 september 2021 10:16
To: Programming forum
Subject: Re: [Jprogramming] Fold experience
Swapping
Swapping the argument does not appear to influence the shape of the result.
The results themselves are different,
UV=:0,(,-@|.)=i.3
foo=: {{ x+ y{UV }}
oof=: {{ y+ x{UV }}
0 0 0 (]F:.foo -: ]F:.foo~) 3 2 _3
0
0 0 0 (]F:.oof -: ]F:.oof~) 3 2 _3
0
That said, focusing on the variant which yo
[UV=:0,(,-@|.)=i.3
0 0 0
1 0 0
0 1 0
0 0 1
0 0 _1
0 _1 0
_1 0 0
foo=: {{ x+ y{UV }}NB. constructed conform the diagram on
https://code.jsoftware.com/wiki/Vocabulary/fcap
$0 0 0 (]F:. foo) 3 2 _3
3 3 3 3 3
$0 0 0 (]F:. foo)~ 3 2 _3
3 3 3 3 3
foo=: {{ y+ x{UV }}
10 matches
Mail list logo