Tuesday, March 12, 2013

Lisp Flavored Erlang

I've flirted with Lisp since the 90s, really started getting into it around 2008 when I started playing with genetic programming, and more recently investigated Common Lisp, Scheme (Gambit and Chicken), and Clojure with the intent of discovering the best way to write distributed programs in Lisp. (I even seriously explored implementing chunks of Twisted in Common Lisp. If only I had more time...)

Needless to say, I kept coming back to Erlang as it is a natural choice for the sort of concurrent programming I was interested in doing. On several occasions, I'd run across Robert Virding's Lisp-2 that he had written on top of the Erlang VM. At first blush, this appeared quite promising. Yet faced with the perceived burden of learning Erlang, I consistently set it aside for a future date.

"Excuse me, could I have some Erlang, please? Yes, just a cup. Oh, and can I get that Lisp-flavored? Thanks so much."

After bouncing between Clojure and CL, after running into difficulties with Termite on Chicken Scheme, and finally, after being quite impressed with the efforts made by the Elixir folks (who I believe took inspiration from LFE!), I decided to give LFE a chance. Within minutes of that decision, I came to two conclusions:
  1. LFE is brilliant.
  2. LFE needs docs like Elixir... and tutorials... and exposure! Why haven't I been using LFE all along?!
At which point, I started hacking on some docs to see if I could stick with it. When, after a few days, I proved to myself that I could, I contacted Robert and let him know not only how much I adored his masterpiece, but that I really wanted to write tons and tons of docs for it so that anyone could pick it up and start using it right away. I wanted to write docs for an audience like me, that didn't know Erlang, who weren't Lisp gurus.

This seemed like a doable goal, since I had about 5 minutes' worth of Erlang experience at the time I was having these conversations with Robert. I was learning Erlang at a rapid pace simply by virtue of the Lisp hook that LFE provided.

Our interactions led to the publicizing of the new docs site for Lisp Flavored Erlang on the LFE google groups list. We also created a Twitter account (we both have full access to it, but I tend to maintain it) whose sole purpose is to bring LFE to more people, keep the news around LFE fresh, etc.

"I could have sworn you just said 'Lisp'..."

A side note about Lisp: S-expressions are concise and elegant. Code and data using the same form is quite powerful. I do believe that the technology industry has the capacity to realize that old biases against Lisp are just that: old and outdated. The many dialects of Lisp are anything but. Clojure and (I believe) LFE are perfect examples of this. Whole new generations of programmers are delighting in the expressive power of a language whose roots can be traced back to actual manipulations of memory registers.

To resume the narrative: in the course of various efforts focused on documenting LFE, asking questions on the mail list, and having various other discussions, Robert pointed out that some of my coworkers at Rackspace had been working on Erlang projects. I subsequently reached out to Phil Toland. Then, within minutes of this (and entirely coincidentally), Kai Janson emailed a group of us about Erlang Factory SF and his desire to provide Erlang workshops for engineers at Rackspace.

This led to further conversations with Robert, then with Francesco, with several Rackers signing up for Erlang Factory this year, and finally, with me volunteering to put a Meetup together afterwards, hosted at Rackspace's SF office (more on that in a few hours).

For the curious, I do continue to work in Python and Twisted; I am excited about the new async support that Guido is spearheading for Python 3 and which has electrified so many hard-core Python hackers. Similarly, I continue to hack on Common Lisp projects. However, I am quite delighted that I have found a way to interface with Erlang which matches how I think, matches my aesthics. And finally, I look forward to many fruitful years of LFE in my life :-)

Thanks Joe! Thanks Mike! Thanks Robert!


Dario Bertini said...

I'm curious: it seems there're 2 valid lisp implementations on top of erlang:
lfe and joxa ( http://joxa.org )

I wonder what appealed you more toward lfe

I haven't used any of the two, but I find myself slightly more attracted to joxa: as a pythonista, I'm much more comfortable with a Lisp1 than with a Lisp2... but maybe this is just because I have never seen Common Lisp before using Python

Christopher Armstrong said...

Tell those guys to allow indentation as an optional alternative to parentheses :-)

Duncan McGreggor said...

Chris, you got it backwards: Guido is considering a parens optimization of Python. You know, this:

(with-open-file (stream "/some/file/name.txt")
(format t "~a~%" (read-line stream)))

Duncan McGreggor said...

Hey Dario,

Thanks for writing -- it's been a crazy day, and I'd forgotten to respond earlier :-/

The reason that I went with LFE is that it is 100% compatible with Erlang, and I wanted to take full advantage of Erlang apps, libraries, etc., and allow others to take advantage of any LFE creations I might make.

I myself am actually more comfortable with Lisp-2, simply due to having used Common Lisp on and off for many years. (That being said, I've also used Scheme for many years, though a bit less I guess... so perhaps it just boils down to a personal preference for Lisp-2!)

Spirito said...

Done: [ http://sourceforge.net/p/readable/wiki/Examples/#fib-and-fact ]