Mizur v1.0.1 Mizur.System

Sets up a metric system.

This module must be used in another module to define a metric system. Using this module provide functions to builds typed values.

When used, it accepts the following options:

  • :intensive : defined a metric system as using intensive measurements. An intensive system prohibits arithmetic operations between units. It only allows conversions.

Example

defmodule Distance do 
  use Mizur.System

  type m # m is used as a reference
  type cm = m / 100 
  type mm = m / 1000 
  type km = m * 1000

end

Summary

Functions

Defines the metric system reference unit. For example, m in the distance system

Functions

type(arg1) (macro)

Defines the metric system reference unit. For example, m in the distance system :

defmodule Distance do 
  use Mizur.System

  type m # m is used as a reference
  type cm = m / 100 
  type mm = m / 1000 
  type km = m * 1000

end
  • You can only use one reference unit.
  • In the expression to define the ratio between a unit and its reference, only the reference can be used as variable and the operators: +, *, - and /.