Lots of Irritating Superfluous Parentheses

After seeing last week’s xkcd, I was reminded of the delights of learning Lisp (or in my case, Scheme) as an undergraduate. I’m a big fan of declarative programming in general — I think exposure to functional and logic programming languages develops your problem solving skills and refines how you think about programming, by focusing on the logic of a computation without getting distracted by its control flow (although this discussion has been going on for many years). It has served me well: I used logic programming (Answer Set Programming) extensively in my PhD and I dabbled with OCaml whilst a research intern at ARM; although I have used very little Haskell, I know a man who does. There seems to be a wider trend of functional programming techniques moving into the mainstream, especially with the release of F# as part of Visual Studio 2010.

Anyone who has used Lisp for any amount of time will fondly remember its enthusiastic use of parentheses. But you can embrace the Lisp philosophy a little too much. Parenthetic is a programming language that only uses ( and ) as code; all other characters are considered comments. Parenthetic uses Lisp-style expressions where parentheses enclose expressions; programs with unmatched parentheses are invalid. It looks pretty similar to another esoteric language called Parenthesis Hell, and has most of the basic Lisp features, including lambda for anonymous functions. To demonstrate a nice simple code example, the following Parenthetic program prints ‘Hello World‘:

((()()())(()(()()))((()(()))((())()()()()()()())((()()(()))((())()()()()()()()()())
((())()()()()()()()()()()))))((()()())(()(()()()))((()(())(())())((())()()()()()()(
)()()()()()()()()()()()()()()()()()()()()()()()()())))((()(()))((()(())(())())((()(
()))(()(()()))((())()()()()()()())))((()(())(())())((()(()))(()(()()))((())()()()()
)))((()(())(())())((()(()))(()(()()))((())()()()()()()()()()()())))((()(())(())())(
(()(()))(()(()()))((())()()()()()()()()()()())))((()(())(())())((()(()))(()(()()))(
(())()()()()()()()()()()()()()())))(()(()()()))((()(())(())())((()(()))(()(()()))((
())()()()()()()()()()()()()()()()()()()()()()())))((()(())(())())((()(()))(()(()())
)((())()()()()()()()()()()()()()())))((()(())(())())((()(()))(()(()()))((())()()()(
)()()()()()()()()()()()()())))((()(())(())())((()(()))(()(()()))((())()()()()()()()
()()()())))((()(())(())())((()(()))(()(()()))((())()()()))))

Pretty expressive, I’m sure you’ll agree.

There has been a rich history of developing bizarre programming languages; for example, Brainfuck, an eight-instruction Turing-Complete programming language, and Ook!, a programming language designed for orangutans (essentially isomorphic to Brainfuck, but with even fewer syntax elements).

4 Comments

  1. Don’t forget Malbolge in which Hello world! is the following:

    ('&%:9]!~}|z2Vxwv-,POqponl$Hjig%eB@@>}=<M:9wv6WsU2T|nm-,jcL(I&%$#"
     `CB]V?Tx

    Interestingly enough it’s named after eighth circle of hell in Dante’s Inferno, which I happened to be reading at the weekend — cheerful chap that I am!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s