Recursive Mini Converters

Recursive Mini Converters

These unit converters are a proof of concept for the notion of recursive forms (RFs).
Pressure Converter
Volume Converter
Mass Converter
Length Converter


These tools, in the modality of unit converters, are a proof of concept for the notion of recursive forms (RFs). In most cases, recursion provides a method for building user interfaces with a minimum number of input fields: just one. Because of this, RF-based unit converters can be called "recursive mini converters".

RFs automatically submit themselves when a user completes the following steps (see Theory section).

  1. Select an initial option or accept the default one.
  2. Input a value compatible with said option.
  3. Select a new option.


RFs can be used for converting units of measurements commonly found in Science and Engineering (NIST 2004; 2006; 2016). The following examples illustrate how the Pressure Converter works.

If a user selects the "pascal (Pa)" option, enters "101325", and switches to the "torr (Torr)" option, the RF returns "760".

Switching to the "pound/square inch (psi)" option, said output becomes the new input and the RF returns "14.6959".

Again, switching to the "atmosphere (atm)" option, the previous output becomes the new input and the RF returns "1".

1 atm = 14.6959 psi
14.6959 psi = 760 Torr
760 Torr = 101325 Pa
101325 Pa = 1 atm


We define a recursive form (RF) as an HTML form where the name/value pairs of successful controls are recursively generated through the decision-making process of users.


The algorithm implemented by these RFs is based on a one-dimensional associative array of the form

$index = [
   "unit_1" => "value_1",
   "unit_2" => "value_2", 

Upon submission:

  • The initial option and input value become the name/value pair of a dynamically generated hidden field.
  • The values of the new and initial options are located in the index and their ratio taken so a scaling ratio is computed.
  • The initial input value is multiplied by the scaling ratio, and the result displayed in the input field as the new value.

Users can repeat this process as many times as they wish to by simply switching to a new option.


  • Convert your weight to different mass units.
  • Convert your height to different length units.
  • Using the results from the last exercises, compute your body mass index (BMI) and your corpulence index (CI).