OK. So +/\ is special code then.
Thanks, Raul and Jose.
Q=: _2+?1000$5
(+/\ -: ([+])/\) Q
1
(+/\ -: ([+])~/\.&.|.) Q
1
ts '+/\ Q'
1.02999e_5 5248
ts '+/\.&.|. Q'
1.50313e_5 9728
ts '([+])/\ Q'
0.311365 18304
ts '([+])~/\.&.|. Q'
0.000485823 10496
Still, it's kind of murky.
Is there a link where it is systematically treated?
Also here is a relationship,
-/\1 2 3 4 5
1 _1 2 _2 3
-/@|.\.&.|.1 2 3 4 5
1 _1 2 _2 3
-/\.&.|.1 2 3 4 5
1 1 2 2 3
-/@|.\1 2 3 4 5
1 1 2 2 3
--- Jose Mario Quintana <[EMAIL PROTECTED]> wrote:
> > [EMAIL PROTECTED] On Behalf Of Oleg Kobchenko
> > Subject: RE: [Jprogramming] What a drag
> >
> > Wow. How is this exmpalined?
>
> Using a symbolic verb (and nouns)...
>
> lr'u'
> '('"_ , [ , ' u '"_ , ] , ')'"_
>
> (Y1;Y2;'..';YN)
> +--+--+--+--+
> |Y1|Y2|..|YN|
> +--+--+--+--+
>
> u e/\ (Y1;Y2;'..';YN)
> +--+---------+----------------+-----------------------+
> |Y1|(Y1 u Y2)|(Y1 u (Y2 u ..))|(Y1 u (Y2 u (.. u YN)))|
> +--+---------+----------------+-----------------------+
>
> (u~ e/\. &. |.) (Y1;Y2;'..';YN)
> +--+---------+----------------+-----------------------+
> |Y1|(Y1 u Y2)|((Y1 u Y2) u ..)|(((Y1 u Y2) u ..) u YN)|
> +--+---------+----------------+-----------------------+
>
> \. builds on previous results.
>
>
> >
> > Whereas
> >
> > Q=: _2+?1e6$5
> > (+/\ -: +/\.&.|.) Q
> > 1
> > ts '+/\ Q'
> > 0.00822809 4.19546e6
> > ts '+/\.&.|. Q'
> > 0.0244686 8.39014e6
>
>
> J "knows" that + is associative so there is no advantage, on the contrary.
>
>
> >
> >
> > --- Jose Mario Quintana <[EMAIL PROTECTED]> wrote:
> >
> > >
> > > T=. ?1000$9
> > > st'(([^:(0=]))/\) T'
> > > 19136 2.13611842
> > > st'(([^:(0=]))~/\. &. |.) T'
> > > 11200 0.00382534652
> > >
> > > ((([^:(0=]))/\) -: (([^:(0=]))~/\. &. |.)) T
> > > 1
> > >
> > >
> > > > -----Original Message-----
> > > > From: [EMAIL PROTECTED] [mailto:programming-
> > > > [EMAIL PROTECTED] On Behalf Of Oleg Kobchenko
> > > > Sent: Wednesday, December 13, 2006 12:38 PM
> > > > To: Programming forum
> > > > Subject: Re: [Jprogramming] What a drag
> > > >
> > > > That was a result of posing a question
> > > > "How would a fast C code look like?" and
> > > > then translated to J.
> > > >
> > > > Unfortunately, though it looks nice, it does not
> > > > work fast in J. Whereas >./\ special coded,
> > > > ([^:(0=]))/\ is not, although it is single scan tacit.
> > > >
> > > > As a result, more cumbersome multiscan algorithms
> > > > perform faster.
> > > >
> > > >
> > > > --- ramacd <[EMAIL PROTECTED]> wrote:
> > > >
> > > > > That is truly beautiful.
> > > > >
> > > > >
> > > > > ----- Original Message -----
> > > > > From: "Oleg Kobchenko" <[EMAIL PROTECTED]>
> > > > > To: "Programming forum" <[email protected]>
> > > > > Sent: Tuesday, December 12, 2006 4:31 AM
> > > > > Subject: RE: [Jprogramming] What a drag
> > > > >
> > > > >
> > > > > > More generally
> > > > > >
> > > > > > ([^:(0=]))/\ 5 4 0 0 5 0 3 0 0 0 7
> > > > > > 5 4 4 4 5 5 3 3 3 3 7
> > > > > >
> > > > > >
> > > > > > --- Oleg Kobchenko <[EMAIL PROTECTED]> wrote:
> > > > > >
> > > > > > > How about variation on the theme
> > > > > > >
> > > > > > > >./\ 3 4 0 0 5 0 6 0 0 0 7
> > > > > > > 3 4 4 4 5 5 6 6 6 6 7
> > > > > > >
> > > > > > >
> > > > > > > --- Dan Bron <[EMAIL PROTECTED]> wrote:
> > > > > > >
> > > > > > > > Raul wrote:
> > > > > > > > > drag=: {~ [EMAIL PROTECTED] >./\@:* ([EMAIL PROTECTED]
> > > > > > > > > 1{.0{.])
> > > > > > > >
> > > > > > > > Thank you; this is indeed faster; I've replaced my definition
> > > > with
> > > > > > > > yours. However, I was hoping for a solution that would
> > complete
> > > > in
> > > > > > > > about half the time of the solutions I provided. That is, I'd
> > > > like a
> > > > > > > > 2x or 100% speedup; drag is only about 20% faster than
> > drag0
> > > > on my
> > > > > > > > dataset.
> > > > > > > >
> > > > > > > > Any other lines of attack?
> > > > > > > >
> > > > > > > > -Dan
> > > >
> > > >
> > > >
> > > >
> > > >
> > __________________________________________________________________________
> > > > __________
> > > > Need a quick answer? Get one in minutes from people who know.
> > > > Ask your question on www.Answers.yahoo.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
> > >
> >
> >
> >
> >
> > __________________________________________________________________________
> > __________
> > Do you Yahoo!?
> > Everyone is raving about the all-new Yahoo! Mail beta.
> > http://new.mail.yahoo.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
>
____________________________________________________________________________________
Cheap talk?
Check out Yahoo! Messenger's low PC-to-Phone call rates.
http://voice.yahoo.com
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm