NeturalMath Language Definition and Syntax

Unit Data Type

The Unit data type is a representation of a measurable value. Units represent a single numeric value, combined with a (potentially) complex series of measurements. For example, a unit could represent a simple value such as inches (in), a relationship such as miles per hour (mph) or a very complex relationship such as square meters per second squared (m2/s2). Units are highly useful for solving scientific and engineering problems.

Units may be defined in terms of distance, time, temperature

Units are not implmented in the current version of NeturalMath. They are planned for implementation in v 0.3.5. Please see Roadmap for more details.

Type information

The Number data type will return the String 'unit' when queried.
:> x = unit(10,'in')
:> numType = type(x)
:> print numType

'unit'


Additional information about a unit's measurement type can be obtained with the unittype function.
:> x = unit(10,'in')
:> print utype(x)

'in'


If output, the unit type will return a string representation of both the value and the unit type
:> x = unit(10,'in')
:> print x

'10in'
:> y = unit(3,'s')
:> print y

'3s'


If the numeric value of a unit may be captured by calling the value function, or by converting the unit to a number.
:> x = unit(10,'in')
:> print value(x)

10
:> y = unit(3,'s')
:> print value(y)

3


Operations

This section is not complete

Literals

There is currently no support for inputing a unit as a literal. Units are defined by calling the unit function and providing an initial value and a unit type.

Conversions

Units exhibit the following behaviors when converted to other types:

Bool

This section is not complete

Complex

This section is not complete

RangeThis section is not complete

Set

This section is not complete

String

This section is not complete

Units

This section is not complete

Functions

The following System Functions consume the Unit data type:
This section is not complete

See Also:

Last edited Oct 14, 2010 at 3:36 PM by zanethorn, version 2

Comments

No comments yet.