EsoKit/EsoKit.ek.math.mm

From Esolang
(Redirected from Material Measurements)
Jump to navigation Jump to search
Back to EsoKit

EsoKit.ek.math.mm, also known as the Material Measurements library, is a library in the EsoKit centred around doing measurement calculations in the form of material lists of objects ([metre(), metre(), metre()] is 3 metres), as opposed to just named values.

Old Description

This is from before it was incorporated into the EsoKit

Material Measurements is an esoteric library/API for Python (and, if you feel like porting it, other languages) that provides a way to convert between and use measurements of time, space, etc. in metric, imperial, and FFF in an alternative fashion to the usual system for programming.

Principle

Instead of having a function that accepts a floating point quantity, a measurement for that quantity, and something to convert to, such as:

convert(15, 'feet', 'metres')

Or a BUNCH of functions that each convert from a value and a type to a new system, such as:

convertToMetres(3, 'feet')

or worst of all, a thing that converts measurement a to measurement b, such as:

metresToFeet(3)

Or possibly any other system of converting measurements, Material Measurements accepts lists of quantities of things. This allows mixed measurements, and it is intuitive for some people. Here is an example in Python:

from MaterialMeasurements import *
dist = foot()*3

convert(dist, metre)

This has the limitation that half feet don't work, but for that, inches can be used, like so:

from MaterialMeasurements import *
dist = [foot()*15, inch()*6]

convert(dist, metre)

Anything that can be expressed in traditional units can be expressed in Material Measurements. Furthermore, entirely new units can be expressed in the system, for example acceleration:

accelerationSpeed = (5*kilometre())/(second()**2)