stan klimoff

Dictionary Processing

We all know that reductionism is quite widespread in the programming community. It’s easier to debug the program when you have a small number of moving parts and well-defined rules of composing these parts into something bigger.

For one thing, famous LISP (which, apocryphally, stands for LISt Processing) tried to reduce every computation to list manipulation. Lists were used as a basic structure for the source code as well. How effective is the approach is subject to intense debate, but in my world, idea is what counts.

Turns out there’s a handful of programming languages that tried to reduce computation to a different basis.

If you even did JavaScript, you probably know that it uses maps (hash tables, dictionaries, whatever) intensively. Some even dare to call JavaScript ‘the new Lisp’.

Lua goes farther that way, providing some pretty advanced meta-programming facilities by using maps internally to control behavior. Of course, it provides ability to alter those internal maps (mm, hacker’s delight).

Tangent: Presentation by Roberto Ierusalimschy on Lua design. Discussion on LtU.

Ruby advocates will indeed point out that objects is Ruby (and, arguably, Python) are all dictionary-based, making meta-programming magic akin to Lua possible.

Well, all of these languages do not address one of the key selling points of Lisp: uniformity of structure between data and code. What would it be like to have code written as a sequence of maps?

In my opinion, the most pure (from the reductionist’s standpoint) language in that realm is Io. For instance, local scope is a dictionary in Io. Check out the examples — this stuff definitely expands the boundaries of the mind.

One step further I can imagine is to treat maps and functions in the same fashion. Function is just a map from the set of inputs to the set of outputs, isn’t it?

What do you guys think — how far the reductionism of the maps can go?

— 2 years ago