Hmm.. well...
Copy (with a single preceeding 0 added to the right arg) should work
for that, with a fixed left argument.
But note that the approach I suggested could also be made to work with
a fixed sized argument.
For example:
(,a) 6 7 8 11 12 13} 20#0
(Or you could expand 20#0...).
Thank
Raul,
My current need was to understand Copy because I had a unique situation
where the size of a was fixed size. Your comments would help more if a was
variable size.
On Mon, Apr 29, 2019 at 11:51 AM Raul Miller wrote:
> (Just catching up on the weekend's email now...)
>
> I am going to ignore
(Just catching up on the weekend's email now...)
I am going to ignore the =. here (in `b =. ,a`), because that makes
most of the rest of this make sense...
It seems to me that ,(0,.~0,.0,~0,])a is going to be as concise as you
can get, unless J gets a "padding primitive".
That said, if a is larg
Brian,
Yes of course, only the first filler is needed. There is a bit of further
simplification available as the ] can be replaced by the , that had already
been applied to 'a'.
0j6 1 1 1j2 1 1 1j6 (#0,,) a
0 0 0 0 0 0 10 11 12 0 0 13 14 15 0 0 0 0 0 0
> On Apr 27, 2019, at 9:29 AM, Brian
Bob and Louis,
Your ideas are very helpful, too.
We seem to need to work around the need for starting with the fill atom.
Building on them and my own, another is this.
0j6 1 1 1j2 1 1 1j6 (#0,]) ,a
0 0 0 0 0 0 10 11 12 0 0 13 14 15 0 0 0 0 0 0
Thanks to all,
--
(B=)
Brian,
If you set are on using Copy, then I think that clearest path forward is in
adjusting 'a' a little by adding filler to receive the ajb arguments.
]a =: 10+i. 2 3
10 11 12
13 14 15
1 ,. a
1 10 11 12
1 13 14 15
, 1,.a
1 10 11 12 1 13 14 15
,&1 , 1 ,. a
1 10 11 12 1 13 14 15 1
Sorry! Misunderstood / read too fast.
Devon’s using expand is the way to go. Does this do what you want?
]t=: 0,.#:0 14 14 0
0 0 0 0 0
0 1 1 1 0
0 1 1 1 0
0 0 0 0 0
(,t) #inv ,10+i.2 3
0 0 0 0 0 0 10 11 12 0 0 13 14 15 0 0 0 0 0 0
Hope this is better,
Louis
> On 27 Apr 2019, at 17:31, Bria
I found a workaround that is quite unpleasing.
0j6 1 1 1 (#0,]) 10 11 12
0 0 0 0 0 0 10 11 12
--
For information about J forums see http://www.jsoftware.com/forums.htm
Devon, your result looses the middle zero's, but may be the only way to go.
I'll have to play more with your idea, or find another solution
Louis,
That helps a little, but I want my result to start with 6 zeros.
So I want x#10 11 12 to produce 0 0 0 0 0 0 10 11 12 .
But instead I can only get re
Hi,
From the dictionary page on # :
The complex left argument a j. b copies a items followed by b fills.
Also from the dictionary, we get that #’s rank is _ 1 _, so we can suppose the
left argument is a vector. In that case each atom of the left argument must
match an item of the right (scalar
Is this what you want?
a=: 10+i.2 3
(6,(#,a),6)# 0 1 0
0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0
((6,(#,a),6)# 0 1 0)#^:_1 ,a
0 0 0 0 0 0 10 11 12 13 14 15 0 0 0 0 0 0
On Sat, Apr 27, 2019 at 11:02 AM Brian Schott
wrote:
> I have a list `b =. ,a` where a is defined below. b always contains 6
I have a list `b =. ,a` where a is defined below. b always contains 6
(real) atoms, not necessarily the values in the current example a.
I want to produce b using complex x values in Copy but cannot seem to get
the correct x to do so.
]a =: 10+i. 2 3
10 11 12
13 14 15
(0,.~0,.0,~0,])a
0 0
12 matches
Mail list logo