Changeset 3926


Ignore:
Timestamp:
Sep 18, 2008, 4:45:53 PM (12 years ago)
Author:
orlov
Message:
  • Parallel list processing without calls to <Map>.
File:
1 copied

Legend:

Unmodified
Added
Removed
  • to-imperative/trunk/samples/parfib.rf

    r3912 r3926  
    1 $use Access Arithm List StdIO;
     1$use Access Arithm StdIO;
    22
    3 $tfunc ParMap s.granule s.func e.list = e.list;
     3$tfunc ParMap s.granule e.list = e.list;
    44ParMap s.granule s.func e.list, {
    55        <Left 0 s.granule e.list> :: e.head, <Middle s.granule 0 e.list> :: e.tail,
    6                 <ParMap s.granule s.func e.tail> :: e.tail, <Map s.func (e.head)> :: e.head,
     6                <ParMap s.granule s.func e.tail> :: e.tail, <MapFib e.head> :: e.head,
    77                e.head e.tail;
    8         <Map s.func (e.list)>;
     8        <MapFib e.list>;
     9};
     10
     11$func MapFib e.list = e.results;
     12MapFib {
     13        s.n e.rest = <Fib s.n> <MapFib e.rest>;
     14        /*empty*/ = /*empty*/;
    915};
    1016
     
    1319        1   = 1;
    1420        2   = 1;
    15         s.n = <Add <Fib <Arithm.Sub s.n 1>> <Fib <Arithm.Sub s.n 2>>>;
     21        s.n = <Add <Fib <Sub s.n 1>> <Fib <Sub s.n 2>>>;
    1622};
    1723
Note: See TracChangeset for help on using the changeset viewer.