Agreed that the other methods are better on this problem. But we don't
want readers to shy away from use of
x -. y . It is part of the i.-family and has good performance for what
it is asked to do.
Henry Rich
On 6/29/2019 11:02 PM, bill lam wrote:
Dyad -. is an expensive operation. For efficiency,
try some other variations such as Raul just suggested.
Sat, 29 Jun 2019, Raul Miller написал(а):
Close, but not exactly...
i. is applied to both arguments.
-. eliminates overlapping values
~ swaps argument order.
If you want a variation which handles negative values, you might try:
to=:<. + i.@(+*)@-~
Thanks,
--
Raul
On Saturday, June 29, 2019, Thomas Bulka <thomas.bu...@posteo.de> wrote:
Am 29.06.2019 20:45 schrieb Clifford Reiter:
Do these experiments help?
to =: -.&i.~,]
3 to 5
3 4 5
3 -.&i.~ 5
3 4
5 -.&i. 3
3 4
(i.5)-.(i.3)
3 4
Hello Clifford,
thank you very much for your quick reply! By working through your
examples, I got a better understanding, I think. Probably my description is
terminologically weak, but now I would describe my understanding of the
to-sentence like this:
1. The i~ is used to generate the vectors (i. y) and (i. x).
2. The less-primitive is used to remove (i. x) from (i. y), giving a
result of x..y-1.
3. Finally the ,] is applied to add the upper limit, provided as the
parameter y, to the result.
Is this, what the to-sentence is supposed to do?
Kind regards,
Thomas
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
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