F#: Ballistics, Rocketry and Research 5/7/2009
I just got back from the Foundation of Digital Games (FDG) Disney Cruise, and it WAS GREAT! I had great conversations with some of the best game researchers and professors on the planet, and we all couldn’t use our cell phones or do email without paying a bunch of money. ACM held the conference and the papers were awesome. They will be posted shortly, and I will definitely link to them. Then I went to the Imagine Cup US Nationals, and what a bunch of winning students!
Now I am looking forward to the Star Trek movie! (Hence the images, I got in the Webmaster program). WRT the Star Trek Movie, one of the things that I learned on the FDG Cruise was that Hollywood edit 194 of 196 movies using a Windows Based editor named Avid. I think that this is quite a bit different than I thought was used.
Let’s move on with the reading of the program by Chris Smith called BurnedLands, scroll down to F#: Ballistics, Rocketry and Research 4/12/2009 in this blog. Let’s face it, ballistics and rockets have to be understood before you get to view the Star Trek Physics. We are looking at the Math Module, if you have downloaded the code as well as the F# add-in for Visual Studio or the stand alone versions of F#, we are reviewing the Math.FS code, and just a few of the lines (that is: the following code won’t work by itself):
Today, it will be one line only, as I want to get this posted:
type Vector< [<Measure>] 'a>(x : float<'a>, y : float<'a>) =
In F# types are:
- Records: This is sum types are also referred to as union types
- Tuples: These are a set of types composed to form a composite type similar to classes in C#
F# includes matrix and column vector types:
- Matrix vector types are generic and use the form: Matrix<'a>
- Column vector types, are generally used to describe direction and magnitude, they use the form: Vector<'a>
- The Measure attribute tells F# that units kg, s and m aren't really types in the usual sense of the word, but are used to build units-of-measure.
- In this case, the [Measure] is telling the compiler to check the units for correctness.
- ‘a is a type parameterization, a special process in F# where a type is not known, but it will match the value that is returned, as you read the line you see that the ‘a is turned to the type of Float. The purpose of this is to help the compiler to find more type errors at compile time and helps avoid casting.
(x : float<'a>, y : float<'a>) =
- the variables x and y become the same variable type as ‘a
That’s it for today, for the next few posts, I will be discussing the new stuff that is coming out of Research.