12.07.2015 Views

Fortress Programming Language Tutorial.pdf - Free

Fortress Programming Language Tutorial.pdf - Free

Fortress Programming Language Tutorial.pdf - Free

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Fortress</strong> <strong>Programming</strong> <strong>Language</strong> <strong>Tutorial</strong>, PLDI, 11 June 2006Local Variables, Reduction Variables• Variables unassigned in a loop body are local• Variables accumulated in a loop body but not readare reduction variablesmeanVar⟦E extends Number, I extends ArrayIndex⟧(a : E[I]): (E,E) = don : E := 0sum : E := 0sumsq : E := 0for i ← a.indices don += 1t = a[i]sum += tsumsq += t tend(sum/n, (sumsq – sum sum)/n )end© 2006 Sun Microsystems, Inc. All rights reserved.45

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!