Wednesday, November 18, 2009

PERL is an anagram of LISP

This observation was made by the godlike Shriram Krisnamurthi in his talk 'The Swine before Perl' http://ll1.ai.mit.edu/shriram-talk.ppt but I thought it deserved a post of its own.



One of the nicest things about a traditional LISP environment compared to a traditional compiled language like C is the REPL.

A REPL is a read-eval-print loop. You can converse with the compiler by asking it questions and getting back answers.

> (* 3 2)
6

Read an expression, evaluate it, then print the answer.

In a decent editor, you can write a whole program this way. Write a bit, evaluate it, define some functions, test them. Use the editor to arrange the working bits above the interactions.

In most languages, you'd write the function that creates the REPL something like:

(print (eval (read)))
(loop)

or for those who like their brackets elsewhere:

print (eval (read())) ;
loop ;

So you might call it a print eval read loop instead.

PERL

No one's ever been sure what PERL stood for. Practical Extraction and Report Language & Pathologically Eclectic Rubbish Lister are the two traditional explanations.

But in a world of LISP and FORTRAN, PERL is clearly a descendant of LISP with a syntax taken from the UNIX scripting tools sh sed and awk.

So if you were wanting to write a LISP variant for performing sysadmin tasks, which is a pretty fair description of PERL, and you wanted to throw a backhanded compliment to LISP without scaring anybody away, what would you do?

No comments:

Post a Comment

Followers