Christoph Pospiech <christoph.pospi...@de.ibm.com> wrote on 06/03/2010 
01:50:13 AM:

> On Wednesday 02 June 2010 11:41:04 pm Yoav Zibin wrote:
> > The definition of reduce is:
> > def reduce(op:(T,T)=>T, unit:T):T
> > 
> > You pass it a function with a guard:
> > ArrayD_add(s1:Array[Double],
> >             s2:Array[Double])
> >     *{s1.region() == s2.region(), s1.rail(), s2.rail()}*: 
Array[Double]
> > 
> > remove the guard, and it should fit.
> > 
> 
> Is there a type cast for function types ? Something along the lines
> ArrayD_add as op:(T,T)=>T ?
> 
> Otherwise, I have to find a guard-free implementation for ArrayD_add...

You can always wrap it in a closure that casts appropriately, namely:

(x:Array[Double],y:Array[Double])=>ArrayD_add(x as Array[Double]{rail}, y 
as Array[Double]{rail&&region==x.region})

HTH,
        Igor
-- 
Igor Peshansky  (note the spelling change!)
IBM T.J. Watson Research Center
X10: Parallel Productivity and Performance (http://x10-lang.org/)
XJ: No More Pain for XML's Gain (http://www.research.ibm.com/xj/)
"I hear and I forget.  I see and I remember.  I do and I understand" -- 
Confucius


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to