Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type Polygon =
- struct
- val Coords : list
- new(list_of_Coords) = { Coords = list_of_Coords }
- end
- type Polygon =
- struct
- val Coords : list<float>
- new(list_of_Coords) = { Coords = list_of_Coords }
- end
- type 'a Polygon =
- struct
- val Coords : 'a list
- new(list_of_Coords) = { Coords = list_of_Coords }
- end
- type Polygon = { Coords : Coord list }
- // Code ...
- let myPolygon = { Coords = [ ... ] }
- type Polygon<'a> =
- struct
- val Coords : list <'a>
- new(list_of_Coords) = { Coords = list_of_Coords }
- end
- let inline genPolygon (a: 'a list) =
- new Polygon<'a> (a)
- > genPolygon [1;2;3];;
- val it : Polygon<int> = FSI_0002+Polygon`1[System.Int32] {Coords = [1; 2; 3];}
- > genPolygon [1.0;2.0;3.0];;
- val it : Polygon<float>
- = FSI_0002+Polygon`1[System.Double] {Coords = [1.0; 2.0; 3.0];}
- type 'a F =
- {coords: 'a list;}
- > let dd = {coords=[1.;2.]};;
- val dd : float F
- > let dd = {coords=[[1.;2.];[1.;2.]]};;
- val dd : float list F
- type Coord =
- struct
- val X : float
- val Y : float
- new(x,y) = { X = x ; Y = y }
- end
- type DepthCurve =
- struct
- val Coords : list<Coord>
- val Depth : float
- new(list_of_Coords, depth) = { Coords = list_of_Coords ; Depth = depth}
- end
- let myCoord1 = new Coord(1.,2.)
- let myCoord2 = new Coord(3.,4.)
- let myDepthCurve = new DepthCurve([myCoord1;myCoord2] , 5. )
- type Coord = { X : float; Y : float }
- type 'a DepthCurve = {coords: 'a list;}
- let myDepthCurve = {coords=[[1.;2.];[3.;4.]]};;
- type 'a DepthCurve = {coords: 'a list; depth: float}
- let myDepthCurve = {coords=[[1.;2.];[3.;4.]] , 5. };;
- type Coord = { X : float; Y : float }
- type DepthCurve<'a> =
- struct
- val Coords : list <'a>
- new(list_of_Coords) = { Coords = list_of_Coords }
- end
- let inline genDepthCurve (a: 'a list) =
- new DepthCurve<'a> (a)
- let myDepthCurve = genDepthCurve [1;2;3];;
Add Comment
Please, Sign In to add comment