Logo GenPRES

ValueUnit Module

Prints a unit as short Dutch text, moves an adjust unit to the middle of a combined unit and collects value units into one.

Nested modules

Modules Description

Units

Holds the value NoUnit, for a value without a unit.

Functions and values

Function or value Description

collect vus

Full Usage: collect vus

Parameters:
    vus : ValueUnit[] - The array of ValueUnits

Returns: ValueUnit option The ValueUnit, or None when the array or the collected values are empty

Collects the values of an array of ValueUnits into one ValueUnit in the unit of the first.

vus : ValueUnit[]

The array of ValueUnits

Returns: ValueUnit option

The ValueUnit, or None when the array or the collected values are empty

System.ArgumentException When the units are not all of the same group.

collectValues vus

Full Usage: collectValues vus

Parameters:
Returns: ValueUnit

Collects the values of a list of value units into one value unit in the unit of the first, sorted and without duplicates. Raises an ArgumentException when there is no value.

vus : ValueUnit list
Returns: ValueUnit

correctAdjustOrder vu

Full Usage: correctAdjustOrder vu

Parameters:
Returns: ValueUnit

Put an adjust unit in the middle of a combined unit.

vu : ValueUnit

The ValueUnit

Returns: ValueUnit
Example

 let u1 = Units.Mass.milliGram
 let u2 = Units.Weight.kiloGram
 let u3 = Units.Time.day
 // mg/day/kg
 let vu1 = withValue [|1N|] (u1 |> per u3 |> per u2)
 // = mg/kg/day
 let vu2 = vu1 |> correctAdjustOrder
 // check
 vu1 |> eqsGroup vu2
val u1: obj
val u2: obj
val u3: obj
val vu1: obj
val vu2: obj

isAdjust u

Full Usage: isAdjust u

Parameters:
    u : Unit - The Unit

Returns: bool

Check if a Unit is an adjust unit, i.e., kg or m2.

u : Unit

The Unit

Returns: bool

oneCount

Full Usage: oneCount

Returns: ValueUnit

The value 1, for a count.

Returns: ValueUnit

unitToString

Full Usage: unitToString

Returns: Unit -> string

Return a Unit as a short Dutch string

Returns: Unit -> string

Type something to start searching.