This project has moved and is read-only. For the latest updates, please go here.

The value that should be

Sep 15, 2008 at 12:02 AM
Edited Sep 15, 2008 at 12:17 AM

Peace upon you The one who is lookin :)

If you didn't find the CTP version of F#  that contain the measuring supported in the compiler then find it here
F# September 2008 CTP Release .

I tried it and found it interesting :) congratulation to the F# team.


today I was willing to talk about  the value of the quantity, suddenly I had an argument with Patrick about what the value should be?
he tried to convince me that value should be some sort of matrix {like matlab variables} and then if I want to have a scalar then I can use {1x1} matrix

well I admit that he has a point, but again I wasn't satisfied :(

dealing with matrix in this early stage will be a headache for me also in any case I can't compete with matlab either :)

I was playing with F# while reading
Andrew blog about its implementation of units. when I read this statement

"Next time,
we'll write types that are generic in units-of-measure. This makes the feature extensible: if floats with units aren't what you want, just define your own types!"

I figured out that I can make the value of the quantity to be generic.

as you may know I was from the beginning insisting about making the Dimension of the quantity is my main concern, and not the units. so I am speaking Quantities not Units of measure. [its a huge difference] :)

review my latest discussion about the length problem.  { again making Angle Quantity was like a charm it is dimensionless and its detectable }

however as I am thinking about the syntax all the time I found my self writing this form of code

Velocity<float> vf1 = 20.8f;
Velocity<float> vf2 = 2.09f;

Velocity <float> v = vf1 + vf2;

and in that way I am emulating the Nullable<T> class

however the imagination didn't stop here

as I am concerned about the Quantity not the value that it hold

then why I can't do this ??

Velocity<int>          vi1 = 55;
Velocity<string>    vi2 = "Too Fast";

var v = vi1 + vi2;              // <= Can I really achieve it

as you may notice the addition is valid for the same quantity even if the storage type is not the same

try to imagine that you have a storage type called  'Tank'

and another one called  'Bottle'

struct Tank;
struct Bottle;

if you make Volume<Bottle> + Volume<Tank>  :    [ To be read like this Volume of Bottle Added to Volume of Tank ]

this meaning is really inspiring me again.  And you will have the right to define your plus operator to sum what you want {I'll just call your operator}

Another example

Visocity<Honey> + Viscosity<Oil>

Clear example like

Mass<Moon> + Mass<Earth> + Mass<Proton>

I hope it make sense


Again I am dealing with Quantities not units.

Quantities are smarter than units

Quantity can tell you about realizable meaning but units don't tell much

And reviewing the length problem you know that Work is having the same units of Torque which again is not permitted in any case.

Again my assumption about Length to be Arc Length and Normal Length may be wrong but until now I managed to solve the problem of Work and Torque and this what's keeping me up.


In the next discussions I want to clarify the meaning of Quantity-Value-Unit and how can they be ordered formed together.

Are they tightly coupled or loosely coupled?

Can I imagine them as a unit of three or a 2-1 or 1-2 or 1-1-1?  :D a bit like soccer game


Thanks for you all.