With the right rank of #: defined as 0, the individual results of 10 #:
y must be padded on the right during assembly. That's part of the spec
for the assembly process.
If the right rank were _, #: would be free to do whatever it likes on
array arguments. But the rank is not _, and changing the rank is liable
to break any code that uses u@#: .
Henry Rich
On 7/5/2018 12:10 PM, Jimmy Gauvin wrote:
Hi,
is "left-justification" really a problem ?
Can't 10 #: 123 1230 1234 be handled just like 10 #.^:_1 ] 123 1230 1234
inside the interpreter?
Or is it that the interpreter cannot work that way?
Jimmy
On Thu, Jul 5, 2018 at 10:57 AM, Henry Rich <[email protected]> wrote:
I have been wondering, if this simple idea is so good, why didn't Ken
think of it?
I think I have the answer.
With the new definition, we would have
10 #: 123 1230 1234
1 2 3 0
1 2 3 0
1 2 3 4
because of left-justification of assembled results. (Note that #: y is
defined with infinite rank to avoid this problem; I think it is out of the
question to change the rank of x #: y, for compatibility reasons)
Results on lists would have this peculiarity. And, #. would be an
imperfect inverse for #: .
So I think rather than having this odd behavior Ken forced us to use
#.^:_1, which DOES have infinite rank and even right-justifies properly:
10 #.^:_1 ] 123 1234
0 1 2 3
1 2 3 4
[20 years of using J and 2 years of intimate work with the source code,
and there are still these gems of Roger's that surprise me.]
For all that, I think I would support making the change Joey suggests, but
I would want more time for all of us to think it over.
Henry Rich
On 7/4/2018 1:37 AM, Joey K Tuttle wrote:
The proposed change is only to Antibase (#:) not Copy (#)
Plus, all the functionality of #: would be maintained and the statement
from NuVoc, "x #: y is used only when you need to state how many places
you want in the result would still remain in effect but the left argument
be required to be a vector (even if only 1 place was sought).
On 2018Jul 3, at 21:41, Skip Cave <[email protected]> wrote:
As long as we don''t change this functionality:
1 1 0 1 0 0 1#10 2 34 13 6 87 9
10 2 13 9
Skip Cave
Cave Consulting LLC
On Tue, Jul 3, 2018 at 11:33 PM Jimmy Gauvin <[email protected]>
wrote:
Hi,
I also support the idea of this scalar extension.
#.inv or #.^:_1 have a "kludgy" feeling ...
Jimmy
On Tue, Jul 3, 2018 at 11:31 PM, Joey K Tuttle <[email protected]> wrote:
Can anyone provide a reason it would be undesirable to have a scalar
left
(x) argument to #: behave any differently than x (#.^:_1) y ?
In NuVoc I find - "
x #: y is used only when you need to state how many places you want in
the
result, or if x contains differing values. If you want just sufficient
places to hold the value of y in the base x, use #.inv to convert to a
fixed base.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
---
This email has been checked for viruses by AVG.
https://www.avg.com
----------------------------------------------------------------------
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