Thursday, August 30, 2012

Default values of data types

Given default values for record data types like cons cells, then each place in the cons cell is optional, for example:
{} ;-> '(nil)
{first 10} ;-> (10)
{rest '(1 2)} ;-> (nil 1 2)
The constructor for the data type can be implemented by modifying places of the original cons cell. Consider colors as another example, we could declare that the default color value will be black. Now colors can be constructed using RGB or HSL:
{saturation 1, luminosity 0.5} ; red 
{blue 255} ; blue 
Another advantage of having default values for a data type, is that reducing any place becomes as simple as setting the value of that place to its corresponding default value, so for example, a butrest function could set the rest of a cons cell to the empty list. If a data type forms a lattice, the default value could just be the bottom element (e.g zero in positive total orders).


  1. What do you mean by reduceing? My brain is too poluted by reduce meaning fold, to think of any other meaning. Also I couldn't find any other mention of a butrest function on the internet, what is butrest supposed to do?

    1. If you want to better understand where I am coming from I recommend you check out NREVERSAL of Fortune -- The Thermodynamics of Garbage Collection. In that article, Henry Baker makes the case for reversible computing.

      By default, I consider operations to conserve all the information need to reverse them. Reduction operations are irreversible operations whose entire purpose is to lose information. For example, butlast loses in the information in the last place, butfirst loses the information in the first place, butrest loses the information in the rest place, etc.

    2. I love that paper, it opened my eyes to the physics of information. However the fact that dna doesn't bother with conservation of information makes me think that I can't do too much in pure conservation mode.