Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Ex 1.a
- type PclShape =
- |Rectangle of float*float
- |RightTriangle of float*float
- //Ex 1.b
- let rect = Rectangle(5.0,6.0)
- let triang = RightTriangle(3.0,4.0)
- //Ex 1.c
- let pclArea shape =
- match shape with
- |Rectangle (a,b)-> a * b
- |RightTriangle (a,b)-> a * b / 2.0
- //Ex 1.d
- let pclPerimeter shape =
- match shape with
- |Rectangle (a,b)-> 2.0*a + 2.0*b
- |RightTriangle (a,b)-> a + b + ( (a*a + b*b)**0.5 )
- type sides = {sideA : float; sideB : float}
- type PclShapeR =
- |Rectangle of sides
- |RightTriangle of sides
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement