Monday, December 26, 2011

Everything is a function

Everything is a function. Associative arrays are just functions of their keys, lists are functions of the natural numbers, etc. These data structures are all groups of key/value pairs. There is only one problem: sometimes a value isn't given any key. In this case, we can automatically generate a key for it to turn it into a map:
(= (to-map #{1 2 3})
   {"#_2185" 3, "#_1873" 2, "#_0195" 1})
Now here is an example of the combination of a group of map structures:
(= (merge-maps {:x 10, :y 100} [1 2 3] #{1 2 3})
   {"#_0249" 1, "#_1847" 2, "#_212" 3, 0 1, 1 2, 2 3, :x 10, :y 100})
This shows how we can represent essentially any value as a map. This has the further advantage that we can easily add metadata to any object. Now a further concern comes when we want to describe links between these structures:
(add-edges [0 1] [1 2] [2 3] #{:x :y})
Any system of simple links can be represented in terms of adjacency matrices which are predicate functions on pairs on natural numbers:
[[0 1 1 0]
 [1 0 0 1]
 [1 0 0 1]
 [0 1 1 0]]

 [1 0]
 [1 1 0]
 [1 1 1 0]]
Otherwise the links may have complicated metadata, such as labels. Furthermore, sometimes we want to deal with hypergraphs, which requires yet more complicated edge objects.

Monday, December 19, 2011

History and versioning

Versioning occurs sequentially. That is, new versions of objects are created one after another. Nonetheless, it is often useful to organise our representation of versions hierarchically. For example, most software programs have versions such as 23.3.1, 5.25.1, etc.

Similarly, we organise dates hierarchically with specific orders of magnitude such as years, months, days, hours, minutes, and seconds. For example, the date December 19, 2011 can be represented as 2011.12.19. As these version numbers are just paths in a hierarchy, we can easily represent them in Lisp:
(date. 1957 6 12)
(date. 2008 9 3)
These paths are also similar to file system paths, which allows you to easily organise your files according to date. In Clojure, you can access the value of a data structure at a path using get-in.

Sunday, December 18, 2011

Emacs setup for Christmas break

I have created a special emacs setup for this Christmas break. I have further customised my keyboard with new hotkeys specifically for navigating S-expressions so that I can effectively use emacs as a structured data editor. I intend to use emacs as a general structured data editor, to edit any tree-like data structures such as file systems, lisp programs, and other data formats such as XML. I am also exploring options for manipulating visual and graph-based systems.

Saturday, December 17, 2011

Applications of graph theory in computer science

Graph theory has a diverse range of applications in computer science. In the past people programmed using sequential side effects and that worked relatively well at the time. However, with the creation of the internet and the onset of the multicore age we need to view computation in terms of several interacting agents.

Graph theory is the mathematical mechanism which allows us to understand the interactions between a diverse range of agents in a network. As the Internet expands, computation will become increasingly distributed across the Internet, which will increase the importance of graph theory.

Tuesday, December 6, 2011

Linked data structures

Graph theory deals with collections of nodes and edges. Linked data structures are graphs such that each edge is a link between precisely two nodes. Each such structure can be expressed using an adjacency list:
  :a [[:- :a] [:> :b] [:> :c]]
  :b [[:- :b] [:> :c]]
  :c [[:- :c]]
Edges stored outside the adjacency list may also be linked to in order to describe more complicated metadata, in which case our representation is closer to an incidence list.

Saturday, December 3, 2011

Infinitesimal analysis

In the absence of known discrete foundations for some mathematical system we can produce some other foundational abstraction. In particular, if elements occur at extremely small scales, the extent of which is also unknown, then infinitesimals are the particular class of abstraction that should be considered.

Once we have some notion of infinitesimals in our grasp, the next step is to describe the effects of infinitesimal changes in input has to a function. In particular, a function is called smooth if infinitesimal changes in input only result in infinitesimal changes in output.

Derivatives are just the slope of an infinitesimal secant line of a function and integration is the process of calculating areas of infinitesimal points.