That's the correct result.  #\ operates on prefixes of y, which are tables.

Henry Rich


On 12/30/2018 12:28 PM, Linda Alvord wrote:
  #\i.8 3
1 2 3 4 5 6 7 8

Sorry, Linda



Sent from my Verizon, Samsung Galaxy smartphone


-------- Original message --------
From: Linda Alvord <[email protected]>
Date: 12/30/18 12:24 PM (GMT-05:00)
To: [email protected]
Subject: Re: [Jprogramming] One-based indices

This doesn't work.

    #i.8 3
1 2 3 4 5 6 7 8


Linda

Sent from my Verizon, Samsung Galaxy smartphone


-------- Original message --------
From: Henry Rich <[email protected]>
Date: 12/30/18 12:08 AM (GMT-05:00)
To: [email protected]
Subject: Re: [Jprogramming] One-based indices

Seconded.  If you must create lists starting at 1, keep in mind

     #\ 'abcdefgh'

1 2 3 4 5 6 7 8


which Roger even supported with special code.


Henry Rich




On 12/29/2018 11:49 PM, Roger Hui wrote:
Why not use >:@i. ?

WRT a 1-origin primitive, don't do it!  Even non-APL people know this.
See *Why
numbering should start at zero
<https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.cs.utexas.edu%2Fusers%2FEWD%2Fewd08xx%2FEWD831.PDF&amp;data=02%7C01%7C%7C9e44f8b9de4d49a54aac08d66e7b98c7%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636817874454098584&amp;sdata=SwB6%2FtOljN%2BEhNXUoESr4X4bSNi4a3lOTXbbTiw97C0%3D&amp;reserved=0>.*

1-origin *delenda est*.



On Sat, Dec 29, 2018 at 8:22 PM 'Skip Cave' via Programming <
[email protected]> wrote:

I find that I need to use the expression 1+i.x much more often than I use
i.x.
Would it make sense to define the primitive i; as the one-origin version of
i.?

i. 5

0 1 2 3 4

i; 5

1 2 3 4 5

i. 2 3

0 1 2

3 4 5

i; 2 3

1 2 3

4 5 6


This avoids all the side effects of quad IO in APL but provides a handy way
to generate one-based indices.


Skip
----------------------------------------------------------------------
For information about J forums see 
https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&amp;data=02%7C01%7C%7C9e44f8b9de4d49a54aac08d66e7b98c7%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636817874454098584&amp;sdata=rEAdhjw7xl8avJsOiugshj1EZffAbHvUKhhjF2hbEQg%3D&amp;reserved=0
----------------------------------------------------------------------
For information about J forums see 
https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&amp;data=02%7C01%7C%7C9e44f8b9de4d49a54aac08d66e7b98c7%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636817874454098584&amp;sdata=rEAdhjw7xl8avJsOiugshj1EZffAbHvUKhhjF2hbEQg%3D&amp;reserved=0


---
This email has been checked for viruses by AVG.
https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.avg.com&amp;data=02%7C01%7C%7C9e44f8b9de4d49a54aac08d66e7b98c7%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636817874454098584&amp;sdata=p0QxrFpfFhA9pyQ%2FZRa6Ekin4BNKn3BLvWGk%2Fqe3W3A%3D&amp;reserved=0
----------------------------------------------------------------------
For information about J forums see 
https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&amp;data=02%7C01%7C%7C9e44f8b9de4d49a54aac08d66e7b98c7%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636817874454098584&amp;sdata=rEAdhjw7xl8avJsOiugshj1EZffAbHvUKhhjF2hbEQg%3D&amp;reserved=0
----------------------------------------------------------------------
For information about J forums see 
https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&amp;data=02%7C01%7C%7C9e44f8b9de4d49a54aac08d66e7b98c7%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636817874454254828&amp;sdata=MLxReCknfAxge%2BDeH0pIQHKY6WA7hSRd5998SEb3kJw%3D&amp;reserved=0
----------------------------------------------------------------------
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

Reply via email to