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.

No comments:

Post a Comment

Post a Comment