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...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Fortress</strong> <strong>Programming</strong> <strong>Language</strong> <strong>Tutorial</strong>, PLDI, 11 June 2006Parametric Objectsobject Cart(re: R, im: R) extends Copr (self, other: Cart): Cart =Cart(self.re + other.re, self.im + other.im)opr (self): Cart =Cart(-self.re, -self.im)opr (self, other: Cart): Cart =Cart(self.re - other.re, self.im – other.im)opr ·(self, other: Cart): Cart =Cart(self.re · other.re – self.im · other.im,self.re · other.im + self.im · other.re)opr |self| : R = √((self.re) 2 + (self.im) 2 )...end© 2006 Sun Microsystems, Inc. All rights reserved.27

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

Saved successfully!

Ooh no, something went wrong!