(i. 2 3) 1 2} 3 3$0
0 0 0
0 1 2
3 4 5
(i. 1 3) (,1)} 3 3$0
0 0 0
0 1 2
0 0 0
(i. 0 3) ''} 3 3$0
0 0 0
0 0 0
0 0 0
This is not a refutation of your suggestion - it's just showing why the
current behavior is as it is. Maybe empty cases should be treated more
leniently, as you suggest, b
As I recall, the issue was as follows:
12 66 (2 1;0 2)} 3 3$0 NB.amend 2 atoms with 2 atoms; ok
0 0 66
0 0 0
0 12 0
(,66) (,<0 2)} 3 3$0 NB.amend 1 atom with 1 atom; ok
0 0 66
0 0 0
0 0 0
'' ''} 3 3$0 NB. amend 0 atoms with 0 atoms; not ok ??
|length error
| ''''}3 3$0
Th
> Each row of m addresses a cell of y, with rank (#$y)-({.$m).
Oh!
Thanks, I got that backwards, somehow.
--
Raul
--
For information about J forums see http://www.jsoftware.com/forums.htm
?
99 (i. 2 2)} i. 5 5
0 99 2 3 4
5 6 7 8 9
10 11 12 99 14
15 16 17 18 19
20 21 22 23 24
99 (i. 2 2)} i. 3 4 2
0 1
99 99
4 5
6 7
8 9
10 11
12 13
14 15
16 17
18 19
20 21
99 99
Each row of m addresses a cell of y, with rank (#$y)-({.$m).
This discussion ignores the ma
On Sun, Jul 3, 2022 at 4:44 AM Elijah Stone wrote:
> I am not sure how to feel about this. Mainly, I am not sure what the
> difference is between x m}y and (for high-ranked numeric m) x (<"1 m)} y. I
> am also not sure what the difference is between your proposed semantics and
> the existing one
On Sun, Jul 3, 2022 at 4:44 AM Elijah Stone wrote:
> As far as I know, no apl used suffix rules for conformability. Two arrays of
> like shape were conformable, and a scalar is conformable with anything; but no
> two arrays are conformable aside from that. An early version of j did use
> suffix
On Mon, 20 Jun 2022, Raul Miller wrote:
"Language change: Scatter-amend support: x m} y changed when m is a numeric
array of rank>1. In that case, each 1-cell of m is the index list of a cell
of y that is replaced by the corresponding cell of x. This is an
incompatible change with J8.07 and ea
On Mon, Jun 20, 2022 at 4:59 AM Elijah Stone wrote:
> On Mon, 20 Jun 2022, Elijah Stone wrote:
> > meaning that the shape of the result from indexing could be any prefix of $y
>
> I am not thinking straight, and should go to bed. Could be any _suffix_ of y.
> Just reverse $x and $y, and I think t
On Mon, 20 Jun 2022, Elijah Stone wrote:
meaning that the shape of the result from indexing could be any prefix of $y
I am not thinking straight, and should go to bed. Could be any _suffix_ of y.
Just reverse $x and $y, and I think the formula I gave before holds.
--
On Mon, 20 Jun 2022, Elijah Stone wrote:
Actually, it needs to be a suffix. That's the issue.
7 9 ''}i.2 2
Thinking about the issue a little bit more: using an empty list for m, it
could have been intended as an array of k-indices for any k<$$y, meaning that
the shape of the result from
On Mon, 20 Jun 2022, Raul Miller wrote:
9 ''} i.2 2
Coincidentally, this was how my code originally looked. Then I needed x to be
a vector instead of a scalar, and the curtains fell.
Conceptually '' the shape of is a prefix of the shape of i.0 2:
Actually, it needs to be a suffix. T
It should probably be more relaxed.
9 ''} i.2 2
0 1
2 3
(i.0 2) ''} i.2 2
0 1
2 3
Conceptually '' the shape of is a prefix of the shape of i.0 2:
$9
$''
0
$i.0 2
0 2
So, it doesn't make sense that this would be a length error. If it
needs to be an error, it should be some other
Hmm, there is an annoyance. } is specified in terms of {, and:
$(1 0;0 1){i.2 2
2
$(,<1 0){i.2 2
1
$''{i.2 2
0 2
On the other hand, it's _really_ annoying that the original code doesn't work.
Thoughts--would it be permissible for } to be more relaxed here? It is
difficult because im
Than you Elijah, that second example is exactly what I want!
> On 9 Mar 2022, at 05:59, Elijah Stone wrote:
>
> Something like this, perhaps?
>
> ]a=. i.5 5
> 0 1 2 3 4
> 5 6 7 8 9
> 10 11 12 13 14
> 15 16 17 18 19
> 20 21 22 23 24
> ]b=. 2 2 $ 100 200 300 400
> 100 200
> 300 400
>
Something like this, perhaps?
]a=. i.5 5
0 1 2 3 4
5 6 7 8 9
10 11 12 13 14
15 16 17 18 19
20 21 22 23 24
]b=. 2 2 $ 100 200 300 400
100 200
300 400
b (<1 2;0 1)} a
0 1 2 3 4
100 200 7 8 9
300 400 12 13 14
15 16 17 18 19
20 21 22 23 24
Note this requires you to s
3 5 7 9 (0 0;0 1;1 0;1 1)} i.5 5
On Wednesday, March 9, 2022, 12:47:32 a.m. EST, Richard Donovan
wrote:
Can I amend an array with a smaller array? For example amend a 5x5 array by a
2x2 array starting at location x,y within the larger array?
Thanks
Richard Donovan
-
Ah, yes, indeed it matters "where" the array is amended.
Somehow I was expecting sparse arrays to use hashing, rather than sorting,
but then again 4$. is always sorted (and it's above my league). I will try
to understand what's going on in the "farewell for now" discussion and see
what comes out o
Interesting problem. Sparse amend sorts the indices; they are mostly in
order but with some small values at the end. I previously implemented a
quicksort for integer lists, usually fast but this hit a worst-case.
Since I think the case is not unusual I have changed the choice of
pivot. Fixe
I'll look into it.
Henry Rich
On 4/13/2021 7:52 PM, Ben Gorte wrote:
Perhaps in a bit of a clumsy way I tried to report last Thursday that
inserting a value in a large sparse array (changing an element from "zero"
into something else) had become quite slow.
SIZE=:1000
A =: 1 $. SI
On Fri, Sep 20, 2013 at 6:21 PM, Pascal Jasmin wrote:
>> I wanted to use the dyadic definition, but did not have
>> a meaningful value for x, so I used ~ (giving the effect of y m} y).
>
> There seems to be a lot more going on there. There is already an x value of
> 1.
Here?
1 3:`2:`]}~&.>@
; From: Raul Miller
> To: Programming forum
> Cc:
> Sent: Friday, September 20, 2013 3:40:38 PM
> Subject: Re: [Jprogramming] Amend trickiness part 2
>
> On Fri, Sep 20, 2013 at 3:37 PM, Pascal Jasmin wrote:
>> I would have hoped that the right approach was:
>
trying to change columns 1 and 4 row 2 to 3 and 'F', but I expect that
to be harder.
- Original Message -
From: Raul Miller
To: Programming forum
Cc:
Sent: Friday, September 20, 2013 5:27:58 PM
Subject: Re: [Jprogramming] Amend trickiness part 2
The verb m} has two diffe
{`1:`]} (<"1 &. |: i. 5 3), <'ABCDE'
> ┌──────────┬───┬───┬─┐
> │0 3 6 9 12│1 4 3 10 13│2 5 8 11 14│ABCDE│
> └──┴───┴───┴─┘
>
>
>
>
> - Original Message -
> From: Raul Miller
> To: Progra
On Fri, Sep 20, 2013 at 3:37 PM, Pascal Jasmin wrote:
> I would have hoped that the right approach was:
>
>3 [L:0(2})`1:`]} |: <"1 |: i. 5 3
> ┌─┐
> │3│
> └─┘
>
> but no.
I've lost track of your goal.
Thanks,
--
Raul
--
F
┐
│1 4 7 10 13│
└───┘
though changing each to L:0 allows both forms.
1 (3"_)`2:`]}~(L:0)@{`1:`]} (<"1 &. |: i. 5 3), <'ABCDE'
┌──┬───┬───┬─┐
│0 3 6 9 12│1 4 3 10 13│2 5 8 11 14│ABCDE│
└──────┴───┴───┴─┘
-
ing forum
Cc:
Sent: Friday, September 20, 2013 3:40:38 PM
Subject: Re: [Jprogramming] Amend trickiness part 2
On Fri, Sep 20, 2013 at 3:37 PM, Pascal Jasmin wrote:
> I would have hoped that the right approach was:
>
> 3 [L:0(2})`1:`]} |: <"1 |: i. 5 3
> ┌─┐
> │3│
> └
<"1 &. |: i. 5 3
┌──┬───┬───┐
│0 3 6 9 12│1 4 7 10 13│2 5 8 11 14│
└──┴───┴───┘
(3) (2)} L:0 <"1 &. |: i. 5 3
┌──┬───┬───┐
│0 3 3 9 12│1 4 3 10 13│2 5 3 11 14│
└──┴───┴───┘
but:
(3) (2)} L
what is a bit confusing though is:
$ 3 (i.@{.@$) i. 4 5
0 1 2 3 4
# 3 (i.@{.@$) i. 4 5 ---returns nothing
0
Assuming you meant to apply $ monadically, and just got lucky with the sample
data :)
Lucky?, how about:
x (f g) y means x f (g y)
or in this case:
x f~ (g y
5 6 7 11 9
> 10 11 12 21 14
> 15 16 17 31 19
>
>
>
> - Original Message -
> From: Raul Miller
> To: Programming forum
> Cc:
> Sent: Thursday, September 19, 2013 2:00:16 PM
> Subject: Re: [Jprogramming] Amend trickiness
>
> On Thu, Sep 19, 2013 at 12:
ogramming forum
Cc:
Sent: Thursday, September 19, 2013 2:50:33 PM
Subject: Re: [Jprogramming] Amend trickiness
I think I should drop a warning flag here:
3 (0 1&{) 2 3 5 7
2 3
3 (0 1&(+:@{)) 2 3 5 7
16 24
http://www.jsoftware.com/help/dictionary/d630n.htm
;)
In other words, the be
On Thu, Sep 19, 2013 at 12:02 PM, Pascal Jasmin wrote:
>4 5 $ (+:@(3&{)"1 sel} ,) i. 4 5
> 0 1 2 6 4
> 5 6 7 16 9
> 10 11 12 26 14
> 15 16 17 36 19
>
> is there a gerund amend version that avoids the temp assignments? or other
> code to get the same result?
In addition to the other
programm...@jsoftware.com
Cc:
Sent: Thursday, September 19, 2013 12:42:25 PM
Subject: Re: [Jprogramming] Amend trickiness
perhaps this one
3 (<"1@(,.~i.@{.@$)+:@{`[`]} ])i. 4 5
or this one
3 +:@{`[`]}&.|: i. 4 5
On 19-09-13 18:02, Pascal Jasmin wrote:
> 6 (3}"1) i.4 5
> 0 1
Cc:
Sent: Thursday, September 19, 2013 2:00:16 PM
Subject: Re: [Jprogramming] Amend trickiness
On Thu, Sep 19, 2013 at 12:02 PM, Pascal Jasmin wrote:
> 4 5 $ (+:@(3&{)"1 sel} ,) i. 4 5
> 0 1 2 6 4
> 5 6 7 16 9
> 10 11 12 26 14
> 15 16 17 36 19
>
> is t
Sorry, try again
3 (<"1@(,.~i.@{.@$)+:@{`[`]} ])i. 4 5
3 +:@{`[`]}&.|: i. 4 5
On 19-09-13 18:02, Pascal Jasmin wrote:
6 (3}"1) i.4 5
0 1 2 6 4
5 6 7 6 9
10 11 12 6 14
15 16 17 6 19
+: (3}"1) i.4 5
6 16 26 36
I'd wish for the result to return the full row/table as the first
perhaps this one
3 (<"1@(,.~i.@{.@$)+:@{`[`]} ])i. 4 5
or this one
3 +:@{`[`]}&.|: i. 4 5
On 19-09-13 18:02, Pascal Jasmin wrote:
6 (3}"1) i.4 5
0 1 2 6 4
5 6 7 6 9
10 11 12 6 14
15 16 17 6 19
+: (3}"1) i.4 5
6 16 26 36
I'd wish for the result to return the full row/tab
Adjacent is important.
Linda
-Original Message-
From: programming-boun...@forums.jsoftware.com
[mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Brian Schott
Sent: Monday, August 13, 2012 10:44 AM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Amend adjacent
2012 5:24 AM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Amend adjacent columns
Assuming you mean remove a column preceded by an identical column:
(#~1 , [: -. 2&(-:/\))&.|: 2 10$'ABCDEEEFGH'
ABCDEFGH
ABCDEFGH
requires at least 1 column.
Henry Rich
If you mean remove any duplicate, then this might work.
f=:2 10$'ABCDEEEFGH'
~.&.(<"1&.|:) f
--
For information about J forums see http://www.jsoftware.com/forums.htm
On Mon, Aug 13, 2012 at 5:13 AM, Linda Alvord wrote:
> How can I amend adjacent columns to remove duplicates?
>
> 2 10$'ABCDEEEFGH'
> ABCDEEEFGH
> ABCDEEEFGH
>
>2 7$'ABCDEFG'
> ABCDEFG
> ABCDEFG
Note that "amend" is a J primitive which preserves the shape of its
right argument, so I am go
Assuming you mean remove a column preceded by an identical column:
(#~1 , [: -. 2&(-:/\))&.|: 2 10$'ABCDEEEFGH'
ABCDEFGH
ABCDEFGH
requires at least 1 column.
Henry Rich
On 8/13/2012 5:13 AM, Linda Alvord wrote:
How can I amend adjacent columns to remove duplicates?
2 10$'ABCDE
40 matches
Mail list logo