Logo GenPRES

Group Module

Maps a unit to its group, compares and formats groups and lists the units and unit combinations of a group.

Nested modules

Modules Description

Constants

Holds the names of the unit groups as text.

Functions and values

Function or value Description

contains g2 g1

Full Usage: contains g2 g1

Parameters:
Returns: bool

Check whether a group g1 contains group g2, i.e. g1 |> contains g2 checks whether group g1 contains g2

g2 : Group
g1 : Group
Returns: bool
Example

CombiGroup(MassGroup, OpPer, VolumeGroup) |> contains MassGroup = true

eqsGroup u1 u2

Full Usage: eqsGroup u1 u2

Parameters:
Returns: bool

Checks whether u1 contains the same unit groups as u2

Compares the flattened num/den groups: handles commutativity and associativity, but does not cancel common factors or drop Count. Reduction to the lowest terms is left to simplifyUnit upstream.

u1 : Unit
u2 : Unit
Returns: bool
Example

eqsGroup (Mass (KiloGram 1N)) (Mass (Gram 1N)) = true // also (ml/kg)/hour = (ml/hour)/kg = true! let un1 = CombiUnit (CombiUnit (Volume (MilliLiter 1N), OpPer, Weight (WeightKiloGram 1N)), OpPer, Time (Hour 1N)) let un2 = CombiUnit (CombiUnit (Volume (MilliLiter 1N), OpPer, Time (Hour 1N)), OpPer, Weight (WeightKiloGram 1N)) eqsGroup un1 un2 = true

getGroupUnits _arg1

Full Usage: getGroupUnits _arg1

Parameters:
Returns: Unit list

Get all the units that belong to a group in a list. Example: getGroupUnits MassGroup = [Mass (KiloGram 1N); Mass (Gram 1N); ...]

_arg1 : Group
Returns: Unit list

getGroups g

Full Usage: getGroups g

Parameters:
Returns: Group list

Get a list of the groups in a group g

g : Group
Returns: Group list

getUnitCombinations g

Full Usage: getUnitCombinations g

Parameters:
Returns: Unit list

Get all the units that belong to group or a combination of groups.

g : Group
Returns: Unit list
Example

 getUnitCombinations (CombiGroup (MassGroup, OpPer, VolumeGroup))
 returns:
   [CombiUnit (Mass (KiloGram 1N), OpPer, Volume (Liter 1N));
    CombiUnit (Mass (KiloGram 1N), OpPer, Volume (DeciLiter 1N));
     ...
    CombiUnit (Mass (NanoGram 1N), OpPer, Volume (MilliLiter 1N));
    CombiUnit (Mass (NanoGram 1N), OpPer, Volume (MicroLiter 1N))]

numDenom g

Full Usage: numDenom g

Parameters:
Returns: Group list * Group list

Separate numerators from denominators of a group. The recursion is always entered at the numerator, so the isNum flag (true = numerator, false = denominator) is an internal concern hidden behind the one-argument numDenom.

g : Group
Returns: Group list * Group list

toString

Full Usage: toString

Returns: Group -> string

Returns group g as a string

Returns: Group -> string

toStringDutch g

Full Usage: toStringDutch g

Parameters:
Returns: string
g : Group
Returns: string

toStringLong

Full Usage: toStringLong

Returns: Group -> string

Returns group g as a string with the specific General string specifier

Returns: Group -> string

toStringWithGeneralString b g

Full Usage: toStringWithGeneralString b g

Parameters:
Returns: string

Returns group g as a string

b : bool
g : Group
Returns: string

unitToGroup u

Full Usage: unitToGroup u

Parameters:
Returns: Group

Get the corresponding group for a unit Example: unitToGroup (Mass (KiloGram 1N)) = MassGroup

u : Unit
Returns: Group

Type something to start searching.