f=: 13 :'(1 + i., 1 + i.@-)@<:y'
g=: 13 :'}.}:(i.y),1+i.-y'
f
(1 + i. , 1 + i.@-)@<:
g
[: }. [: }: i. , 1 + [: i. -
timespacex 'f 4000'
0.00015572 66560
timespacex 'g 4000'
0.00012852 66496
5!:4 <'f'
-- 1
+- +
-----+ -- i.
│ │ +- ,
│ L---+ -- 1
-- @ -+ │ +- +
│ L----+ -- i.
│ L- @ -+- -
L- <:
5!:4 <'g'
-- [:
+- }.
--+ -- [:
│ +- }:
L----+ -- i.
│ +- ,
L----+ -- 1
│ +- +
L----+ -- [:
L---+- i.
L- -
Linda
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Raul Miller
Sent: Thursday, July 03, 2014 9:05 AM
To: Programming forum
Subject: Re: [Jprogramming] Finger tapping
Where it doesn't add code bulk, I like to avoid [: and I like to avoid
unnecessary bulk.
Here, that might be expressed as
(_1 }. ,~ #/.@$ 1:) 4
1 2 3 4 3 2
But I also think this approach is pretty.
That said, the i. approach would be more efficient if the range of
arguments were right:
(1 + i., 1 + i.@-)@<: 4000
1 2 3 ...
But it's oh so tempting to assume that other people are thinking about the
same kind of data that we are.
Thanks,
--
Raul
On Thu, Jul 3, 2014 at 8:52 AM, 'Pascal Jasmin' via Programming <
[email protected]> wrote:
> I like yours better, a variation on Marshalls:
>
> ([: }: 1 #/.@:$~ ],]) 7
> 1 2 3 4 5 6 7 6 5 4 3 2
>
> and yours tacitly:
>
> (] }:@:- [: |@:i: <:) 7
> 1 2 3 4 5 6 7 6 5 4 3 2
>
>
>
> ----- Original Message -----
> From: R.E. Boss <[email protected]>
> To: [email protected]
> Cc:
> Sent: Thursday, July 3, 2014 1:15:09 AM
> Subject: Re: [Jprogramming] Finger tapping
>
> Nice!
>
> Beats my usual constructs for up and down sequences:
>
> }:4-|i:3
> 1 2 3 4 3 2
>
> or
>
> }:(<.|.)>:i.7
> 1 2 3 4 3 2
>
>
> R.E. Boss
>
> (Add your info to http://www.jsoftware.com/jwiki/Community/Demographics )
>
>
>
> > -----Original Message-----
> > From: [email protected] [mailto:programming-
> > [email protected]] On Behalf Of Marshall Lochbaum
> > Sent: maandag 30 juni 2014 17:06
> > To: [email protected]
> > Subject: Re: [Jprogramming] Finger tapping
> >
> > How about this one?
> >
> > }:#/.=i. 4
> > 1 2 3 4 3 2
> >
> > Marshall
> >
> > On Mon, Jun 30, 2014 at 10:26:50AM -0400, Henry Rich wrote:
> > > Also
> > >
> > > (,#\.)@i.&.<: 4
> > > 1 2 3 4 3 2
> > >
> > > Henry Rich
> > >
> > > On 6/30/2014 10:11 AM, Marshall Lochbaum wrote:
> > > >People have addressed the reshaping part of this, but a rather nice
> way
> > > >to generate the base sequence is:
> > > >
> > > > ((],-)i.)&.<: 4
> > > >1 2 3 4 3 2
> > > > ((],-)i.)&.<: 8
> > > >1 2 3 4 5 6 7 8 7 6 5 4 3 2
> > > >
> > > >Marshall
> > > >
> > > >On Fri, Jun 27, 2014 at 12:18:09AM -0500, Kip Murray wrote:
> > > >>Hold up your right hand with its back toward you and number the
> > forefinger
> > > >>through little finger 1 through 4. (I suppose the thumb has index
> 0.)
> > Now
> > > >>try finger tapping this pattern:
> > > >>
> > > >>1 2 3 4
> > > >>3 2 1 2
> > > >>3 4 3 2
> > > >>1 2 3 4
> > > >>3 2 1 2
> > > >>3 4 3 2
> > > >>
> > > >>Write a J expression to produce this pattern.
> > > >>
> > > >>--Kip Murray
> > > >>
> > > >>
> > > >>--
> > > >>Sent from Gmail Mobile
> > >
> >>----------------------------------------------------------------------
> > > >>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
>
> ----------------------------------------------------------------------
> 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