\. is faster than \ so use

 scan =. 1 : '}.@(u~/\.&.|.)'

Henry Rich 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Matthew Brand
> Sent: Friday, September 26, 2008 2:33 PM
> To: Programming forum
> Subject: Re: [Jprogramming] scan operator
> 
> Thanks for the pointers, here it is:
>   scan =. 1 : '}.@: (((u~/)&.|.)\)'
>    - scan >: i.5
> _1 _4 _8 _13
>    (1-2),((1-2)-3),(((1-2)-3)-4),((((1-2)-3)-4)-5)
> _1 _4 _8 _13
> 
> Does this seem like something there ought to be a primitive 
> for, I think
> that q might have one? Anyway, it looks like it works so far. 
> I want to use
> it to do exponentially weighted moving average EWMA, which 
> was a topic on
> the forum earlier in the year.
> 
> Cheers,
> Matthew.
> 
> On Fri, Sep 26, 2008 at 5:07 PM, Devon McCormick 
> <[EMAIL PROTECTED]> wrote:
> 
> > Hi Matthew - maybe this is what you want:
> >
> >   (1-2)-3
> > _4
> >   -~/|.1 2 3
> > _4
> >   ((1-2)-3)-4
> > _8
> >   -~/|.1 2 3 4
> > _8
> >
> > so, you could do "f~/|."
> >
> > On Fri, Sep 26, 2008 at 11:44 AM, Matthew Brand 
> <[EMAIL PROTECTED]
> > >wrote:
> >
> > > Hi All,
> > >
> > > If I have a dyadic function f, how can I do the following:
> > >
> > > (((y0 f y1) f y2) f y3... ) f yn
> > >
> > > I want to feed the result of x f y into the next 
> evaluation as the left
> > > parameter.
> > >
> > >
> > > Thanks,
> > > Matthew.
> > > 
> ----------------------------------------------------------------------
> > > For information about J forums see 
> http://www.jsoftware.com/forums.htm
> > >
> >
> >
> >
> > --
> > Devon McCormick, CFA
> > ^me^ at acm.
> > org is my
> > preferred e-mail
> > 
> ----------------------------------------------------------------------
> > 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