Advertisement
Guest User

Complex.fs

a guest
Feb 9th, 2015
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
F# 0.34 KB | None | 0 0
  1. type Complex (a, b) =
  2.     member z.a = a;
  3.     member z.b = b;
  4.    
  5.     static member (+) (z : Complex, w : Complex) =
  6.         Complex (z.a + w.a, z.b + w.b)
  7.    
  8.     static member (*) (z : Complex, w : Complex) =
  9.         Complex (z.a * w.a - z.b * w.b, z.b * w.a + z.a * w.b)
  10.    
  11. let i = Complex (0, 1)
  12.  
  13. let rotateBy90degree = (*) i
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement