About Lisp and programming languages

2018-07-16 @Computer Science

I don’t care for programming or programming languages as I once did. I care more about interesting models, aesthetics, and expression. But let me first provide some background.

I rarely cared for mainstream programming languages, and although my life exposure to various languages numbers at least 15, and closer to 20 if we include all varieties of scripting languages, I never maintained active and in-depth interest in more than one or two, maybe three. The others faded as suddenly as they appeared.

At some point I could comfortably express myself in more spoken than programming languages. That was the point that caused me to reflect on my entire relationship with programming.

I experimented with some form of programming as early as 13 or 14 years of age, first with Quick Basic, then with Visual Basic, and with C++ after. For most of my life, however, the language that inspired authentic interest in me, in and of itself, was exclusively basic C.

I admired C for the same reasons others resented it - for the closeness to the hardware and all the dangers associated with having direct access to memory and memory allocation. I loved having that amount of control and embraced the level of obfuscation generally associated with the respective low-level directives. C programming especially emphasized discipline, maintainability, and the strong call for simplification, lacking the abstractions available in higher-level languages to rely upon. The experience pulsated with beauty as a whole and as individual components.

Most other languages I interacted with borrowed heavily from the model available and C or other C-like languages, abstracting lower level inconveniences into higher-level abstractions, none of which radiated with me intrinsically. There were, however, some occasional exceptions.

The Perl interpreted language, used largely, but not strictly for scripting and web plugins, the caricature it may have become, provided certain excitement in the prospect of being the all-in-one handyman, who, ideally strived for order and reliable construction, but in times of peril, held few reservations in producing a horrific, barely stable concoction, screaming of pain and decadence. In the land of interpreted languages, it felt like loose territory but with potential for much freedom of model and expression.

In the realm of purely object-oriented languages, back in College, I experimented with a variant of Smalltalk for a few months. It presented a model, attractive in many aspects, similar to no other I’ve known before or since. Regretfully, it belonged to a fairly closed ecosystem and served more of an educational purpose than practical. Under normal circumstances, that doesn’t discourage me. On the contrary, I have a tendency to embrace the impractical in light of academic interest. However, this particular case didn’t respect certain parameters I would later place under the umbrella of minimalism.

Then nothing much varied over 15 years. My curiosity for programming languages generally saturated. Each new one I encountered pretended to simplify or abstract the limitations exhibited by others, but never inspired intrinsic appreciation to any respect. Some presented unique models even, which, however, didn’t much entice me. Python I use from time to time in the Machine Learning domain. Granted, it impresses for the emphasis on ease of mathematical analysis and visualizations, abstracting the bulk of computability-and-hardware-concious programming. Yet similar to other cases, it hadn’t captured my attention beyond that of a toolkit designed as means to an end.

In all my experience I had never explored one of the predominantly functional programming languages. The likes of Haskell, Scala and Closure had occasionally stirred my curiosity, but it was of late that I ventured to research the properties behind these languages and the merits of functional programming in general. In the course of this research I again stumbled across Lisp.

Lisp, also largely functional in nature, although not in a pure sense, exhibits a rather cult reputation. Despite being one of the oldest languages in existence (dating to the 1950’s), it still finds much use and even prevails among others in certain cases. Having a peculiar syntax, somewhat of a steep learning curve, and a distinctively different model, it never gained the same popularity as the mainstream languages of the proceeding decades, and certainly does not compete in the industry user-base. Academically and aesthetically, however, it simply fascinates me. How I refrained from exploring this gem all these years still baffles me.

Lisp actually represents a family of dialects or variants, and Common Lisp became the subject of my focus. Now, I’m not in a place to yet argue all the merits, but I’ll cover a handful of highlights.

Lisp is a meta-programming language. It provides macros, but different from those characteristic of the C preprocessor, for example. The Lisp macros enable dynamic code generation in a much more transparent manner. They also facilitate straightforward simplification of certain maintenance-related constructs traditionally burdensome and even distracting to the main problem at hand.

Almost all directives are provided by means of “s-expressions”, or rather, parenthesized constructs, the first element of which represents the function, and the remainder, the parameters. Each parameter, consequently, represents either an atom (a simple value), or another s-expression. Alternatively, an s-expression can also represent a pure list. The Lisp grammar marvels in simplicity.

Depending on the context, code and data become interchangeable. An s-expression containing a list can be interpreted as code if and when desired, and a block of code can be passed around as data. Also, the nature of parenthesized s-expressions is such that formatting becomes a trivial issue for Lisp-aware text editors, and doesn’t provoke the formatting culture clashes evident in non-parenthesized languages.

In recent years, I found more novelty in the pursuit of algorithm analysis and complexity rather than actual programming. Maybe Lisp will be the balance between the theoretical and the practical I’ve been seeking. So far it succeeded in sparking the excitement I long believed extinguished.

Questions, comments? Connect.