Skip to content

Instantly share code, notes, and snippets.

@calvinmetcalf
Last active December 22, 2015 07:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save calvinmetcalf/6438537 to your computer and use it in GitHub Desktop.
Save calvinmetcalf/6438537 to your computer and use it in GitHub Desktop.
impl Point {
fn sum( &self ) -> float { self.x + self.y }
fn sqsum( &self ) -> float { self.x * self.x + self.y * self.y }
fn sub( &self, other: float ) -> Point { Point { x:self.x - other, y:self.y - other } }
fn mul (&self, other: float ) -> Point { Point { x:self.x * other, y:self.y * other } }
fn add( &self, other: float ) -> Point { Point { x:self.x + other, y:self.y + other } }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment