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

Reply via email to