stevengharms.com

Sententiae viri ex temporibus duobus

A Weekend Spent Battling Lisp

Well maybe I should make sure that I use a positive word, instead of “battling” I should say “becoming more acquainted with” Lisp.

This stuff reminds me so much of my symbolic logic class back in school, the material is dense, the explanation is denser, and virtually all the best part of the learning is left as an exercisle to the reader, his supply of ink, and his supply of paper.

As such, I have spent many hours trying to accomplish but a few problems or feel comfortable in being able to model the world according to the syntax of Lisp.

I don’t really fault the author for the didactic style, some things are just inherently hard and require a lot of independent work.

Here’s my nemesis:

Define a function that takes a list and returns a list indicating the number of times each element appears, sorted from most common element to least common:

(occurrences ‘(a b a d a c d c a))

From Graham’s ANSI Common Lisp

Well after a lot of fighting I finally got the code. I was about to post it in this entry but then I decided to try another test and broke it :-(. So the problem has but only begun to fight.

Upon further reflection I have decided that the most dangerous language has to be the language which tolerates and assists too much unsophistication. It’s not to say that something dangerous isn’t useful, notable, laudable or worthy (see: atomic fission) - it’s just dangerous.

This is why Perl is loved by systems administrators. Sysadmins generally have a lot of work to do, enough programming knowledge to understand things like iteration and decision structures, and Perl provides access to familiar unix tools underneath.

Thus, a novice Perl programmer (sysadmin type) can make something very dangerous very quickly by stitching his familiar toolkit pieces together with the duct tape of Perl. Quick example. Imagine your tools were a chainsaw and a staple-gun. Both items are dangerous but you know how to operate the two well.

Now say you duct tape the staple gun to the chain saw, you now have an object whose interactions are new, unfamiliar, and potentially very, very dangerous.

The flexibility of Perl and the power tools of the admin, when bound together without discipline has the potential to abet the creation of catastrophic evil.

An example for The Rest of Us:

Imagine you are to visit France. One, if one hopes to get by in the native tongue, does not need the baby words of French (mama, haricots verts). Rather, one wants the “power words and phrases” that will get them what a traveler needs: (lit/bed), (hotel/hotel), (metro/subway) (vin/wine).

To this extent there are textbooks that teach from ground 0 up (baby-talk up) and then there are the power-user books (“Survival French” / “French for Travelers”). Yet what if one mixes the two (as often happens). Complex ideas, lacking for discipline and abetted by the false assistance of the power-user books make for a dangerously unpredictable utterance.

“Me talk pretty someday” - Clearly the speaker is on baby-level, the listener realizes the speaker is incredibly limited.

“Where is the Metro to Montmartre” - The listener hears an adult utterance, phrased with a horrible accent. Tourist. Agh. Must be using one of those travel phrase books.

Confusion (and possibly danger) results when:

“Thank you for the directions I wanting much woman for kissing”

What’s that? Our listener thinks. Are you wanting to kiss my wife here on the bench? Are you asking my how to get to a brothel? And what very much makes you think that I would know the building on the left is a brothel? Or are you just asking where the local hotties are?

Perl allows people who should be bound into baby-grammar to produce dangerous utterances like just mentioned incredibly easily. Now I’m not debating the utility, many clueless admins have had their keester saved by Perl in dire time of need, but months later (assuming they continue in their study) they find the uttered program to be incomprehensible.

Thus it would seem: - Low learning curve, high potential for dangerous utterance, instant efficacy - High learning curve, low potential for dangerous utterance (can’t do it), slow efficacy

So here I sit, pouring ink and paper into the maw of Lisp, waiting to surmount the learning curve.

I would add that this phenomenon can also bee seen in snowsport:

  • Skiing: Low learning curve, high potential for dangerous getting in over your head, instant efficacy

  • Snowboarding: High learning curve, less potential for danger

I hope that the time I’m spending getting familiar with this yoke will allow me to do things undangerously as well as well in the future.