iota =: i. : (+ i.)


1 iota 51 2 3 4 5


iota is 0 based if monadic, right argument based if dyadic.

if there were more "ascii op codes" an ideal design for every verb would have 
the monadic version be a "default argument" version of a dyadic form.
________________________________
From: 'Skip Cave' via Programming <[email protected]>
To: [email protected] 
Sent: Monday, December 31, 2018 11:42 AM
Subject: Re: [Jprogramming] One-based indices



To replace my proposed i;

i1=: >:@i.



On Mon, Dec 31, 2018, 10:38 AM Skip Cave <[email protected] wrote:

> Or >:i.
>
> On Dec 31, 2018 10:34 AM, "Raul Miller" <[email protected]> wrote:
>
> In every culture, some traditions are worth keeping, while some are
> worth abandoning (and some are so entrenched that they're best
> encapsulated and tolerated).
>
> Details of our calendar (which date back to the Roman Empire) are
> probably best treated in much the same way we treat details of roman
> numerals. Or, my take: surviving roman traditions tend to work well
> enough for their purpose, but do not work well enough for all similar
> purposes... (there's a reason, for example, why people in astronomical
> communities deal with leap seconds, and why they mostly ignore months
> in their time keeping efforts...)
>
> Also, I've used quadIO. For people who don't know: that was APL's
> tactic for dealing with different concepts of the numerical value of
> the first element of an array.  But quadIO was a complete pain that
> hit me every time I needed to use numeric indices.
>
> On the other hand, the problems surrounding APL's quadIO did have the
> benefit of discouraging me from using indices wherever possible. But
> this had a significant disadvantage also: sometimes the resulting code
> was way more elaborate than I anticipated when I started writing it.
> (Which, in turn, is a big deal when you're phasing things into
> production over time, based on an agreed-on end goal.)
>
> That said, this works just fine:
>
>    1+i.2 4
>
> 1 2 3 4
> 5 6 7 8
>
> (And, for anyone keeping track, *this* time I used copy and paste,
> rather than hand typing onto my phone from an untrusted computer.)
>
> Thanks,
>
>
> --
> Raul
>
>
>
>
>
>
> On Sun, Dec 30, 2018 at 6:13 PM 'Bo Jacoby' via Programming
> <[email protected]> wrote:
> >
> >  New year's day is January the first, not January the zeroth.
> > 'The first' is an ordinal number - not a cardinal number.
> > A zero-origin index counts how many elements to skip before reaching a
> certain element. It is a cardinal number - not an ordinal number. Zero is a
> cardinal number - 'zeroth' is not an ordinal number.
> > Not distinguishing  cardinal numbers from ordinal numbers creates
> confusion.
> > Thanks. Bo.
> >     Den søndag den 30. december 2018 18.54.48 CET skrev Henry Rich <
> [email protected]>:
> >
> >  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&data=02%7C01%7C%7C9e44f8b9de4d49a54aac08d66e7b98c7%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636817874454098584&sdata=SwB6%2FtOljN%2BEhNXUoESr4X4bSNi4a3lOTXbbTiw97C0%3D&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&data=02%7C01%7C%7C9e44f8b9de4d49a54aac08d66e7b98c7%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636817874454098584&sdata=rEAdhjw7xl8avJsOiugshj1EZffAbHvUKhhjF2hbEQg%3D&reserved=0
> > >> ----------------------------------------------------------------------
> > >> For information about J forums see
> https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&data=02%7C01%7C%7C9e44f8b9de4d49a54aac08d66e7b98c7%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636817874454098584&sdata=rEAdhjw7xl8avJsOiugshj1EZffAbHvUKhhjF2hbEQg%3D&reserved=0
> > >
> > >
> > > ---
> > > This email has been checked for viruses by AVG.
> > >
> https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.avg.com&data=02%7C01%7C%7C9e44f8b9de4d49a54aac08d66e7b98c7%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636817874454098584&sdata=p0QxrFpfFhA9pyQ%2FZRa6Ekin4BNKn3BLvWGk%2Fqe3W3A%3D&reserved=0
> > > ----------------------------------------------------------------------
> > > For information about J forums see
> https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&data=02%7C01%7C%7C9e44f8b9de4d49a54aac08d66e7b98c7%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636817874454098584&sdata=rEAdhjw7xl8avJsOiugshj1EZffAbHvUKhhjF2hbEQg%3D&reserved=0
> > > ----------------------------------------------------------------------
> > > For information about J forums see
> https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&data=02%7C01%7C%7C9e44f8b9de4d49a54aac08d66e7b98c7%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636817874454254828&sdata=MLxReCknfAxge%2BDeH0pIQHKY6WA7hSRd5998SEb3kJw%3D&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
> > ----------------------------------------------------------------------
> > 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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to