> [EMAIL PROTECTED] On Behalf Of Oleg Kobchenko
> Sent: Wednesday, October 25, 2006 5:00 PM
> 
> This is the pattern of monadic "dapply", see Distributed Apply
> 
>    http://www.jsoftware.com/jwiki/Essays/Distributed_Apply
> 
> In general, Robert Bernecky called it "MIMD (Multiple-Instruction,
> Multiple-Data),
> concurrent application of a collection of functions to arrays of data".
> 
> It may be perceived to be naturally attainable in J or APL.
> 
> A related area is simultaneous application of function(s)
> to a collection of objects.
> 
> 

That is,

   apply=. 128!:2 NB. The default definition
   G=. '+/';'$'

   (b{G) apply &.> list
+-+-+-+--+-+-+
|3|4|3|19|2|5|
+-+-+-+--+-+-+
   
   Alternatively,

   u=. +/
   v=. $

   (b{(u`v)) apply &.> list
+-+-+-+--+-+-+
|3|4|3|19|2|5|
+-+-+-+--+-+-+



> [EMAIL PROTECTED] On Behalf Of Mike Powell
> 
> I have a list of vectors of two types. Each vector needs to be
> processed by a monadic function according to the corresponding
> element of a boolean. I'm trying to do this by constructing a gerund
> and applying this item by item to the list (with an explicit or
> implied pre-open and post-box). I'm stuck. For example:
> 
> b =: 0 1 1 0 1 1
> g=:+/`$
> list=:1 2;3 4 5 6;8 8 8; 9 2 4 1 3;1 2; 5 5 5 5 5
> 
> (b{g) apply list
> 
> 3;4;3;19;2;5




----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to