You are on page 1of 3

Write For Us

Submit Tips

Subscribe to Print Edition

Search

HOME

REVIEWS

HOW-TOS

CODING

INTERVIEWS

FEATURES

OVERVIEW

BLOGS

SERIES

IT ADMIN

Lisp: Tears of Joy, Part 10


By Vivek Shangari on March 29, 2012 in Coding, Developers 3 Comments

Search for:

Search

Lisp has been hailed as the worlds most powerful programming language. But only the top percentile of programmers use it, because of its cryptic syntax and academic reputation. This is rather unfortunate, since Lisp isnt that hard to grasp. If you want to be among the crme de la crme, this series is for you. This is the tenth and final article in the series that began in June 2011.
There was a joke back in the 80s, when Reagans SDI (Strategic Defense Initiative) programme was in full swing, that someone stole the Lisp source code to the missile interceptor program and to prove it, he showed the last page of code

Get Connected RSS Feed Twitter

) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) )

In our quest for supreme knowledge, through the past nine articles on the Lisp series, weve travelled far enough to discover that LISP does not stand for Lots of Irritating Superfluous Parentheses (I know, strange!). In this epilogue, lets summarise in brief why hacking Lisp code could be a profound experience in your life.

Lisps Functional Programming advantage


Functional Programming is the art of writing programs that work by returning values, instead of modifying things. Functional Programming also enables you to create fabulously powerful and very efficient abstract programs it is a mathematical approach to programming. In math, for at least the last 400 years, functions have played a very central role. Functions express the connection between parameters (the input) and the result (the output) of certain processes. In each computation, the result depends, in a certain way, on the parameters. Therefore, a function is a good way of specifying a computation. This is the basis of the functional programming style. A program consists of the definition of one or more functions. With the execution of a program, the function is provided with parameters, and the result must be calculated. Writing code in a functional style guarantees that a function does only one thing (returns a value), and is dependent on one thing (the parameters passed to it). This equips you to control side effects. However, some side effects are almost always necessary for a program to actually do something. This means that you cant write a useful program that has the entirety of its code written in the functional style. In Article 8, where we talked about CLOS, I pointed out James Hagues assessment of functional programming, where he argues that, 100 per cent pure functional programming doesnt work. Even 98 per cent pure functional programming doesnt work. But if the slider between functional purity and 1980s BASIC-style imperative messiness is kicked down a few notches say, to 85 per cent then it really does work. You get all the advantages of functional programming, but without the extreme mental effort and unmaintainability that increases as you get closer and closer to perfectly pure.

LINUX For You on

Follow

+2,503

Macros

Macros may be the single most important reason why Lispers put up with all those annoying parentheses in their code. These very parentheses enable this powerful macro system in Lisp. Paul Graham, who comes close to being a Lisp missionary, points out that Lisp code is made out of Lisp data objects. And not in the trivial sense that the source files contain characters, and strings are one of the data types supported by the language. Lisp code, after its read by the parser, is made of data structures that you can traverse. If you understand how compilers work, youll figure out that whats really going on is not so much that Lisp has a strange syntax (parentheses everywhere!) as that Lisp has no syntax. You write programs in the parse trees that get generated within the compiler when other languages are parsed but these parse trees are fully accessible to your programs; you can write programs that manipulate them. In Lisp, these programs are called macros. They are programs that write programs.

Find us on Facebook

Open Source For You


Like 253,414 people like Open Source For You.

F acebook social plugin

A great medium to express recursion


Popular Comments Tag cloud

Recursion is the act of defining an object or solving a problem in terms of itself. Properly used, recursion is a powerful problem-solving technique, both in artificial domains like mathematics and computer programming, as well as in real life. The power of recursion evidently lies in the possibility of defining an infinite set of objects by a finite statement. In the same manner, an infinite number of computations can be described by a finite recursive program, even if this program contains no explicit repetitions, wrote Niklaus Wirth in his 1976 book, Algorithms + Data Structures = Programs. Lisp is the best programming language to use when working with recursive problems. Daniel P. Friedman and Matthias Felleisen demonstrate this case for Lisp in their book The Little Lisper. Lisp is inherently symbolic programmers do not have to make an explicit mapping between the symbols of their own language and the representations in the computer. Recursion is Lisps natural computational mechanism; the primary programming activity is the creation of (potentially) recursive definitions.

August 13, 2013 39 Comments Diksha P Gupta

India has immense under-utilised talent in the cloud security space


May 6, 2013 6 Comments Priyanka Sarkar

PHP Development: A Smart Career Move


June 20, 2013 3 Comments sophie-samuel

New and amazing features of Linux


June 20, 2013 3 Comments Priyanka Sarkar

What it Takes to be an Open Source Expert


May 6, 2013 1 Comments Deepti Sharma

A Simple guide to building your own Linux Kernel

What else?
There are many more reasons why one should try out Lisp. Apart from the ones mentioned above, I have covered a few in my previous articles. This series was my small attempt to evangelise Lisp and plant a seed of curiosity in those who are seeking a better way of life in the maddening programming world. If the seed has taken root in your mind and youd like to explore further, feel free to contact me by leaving a comment, should you have any questions, or if you need pointers to resources that may aid your discovery of the worlds most powerful programming language. Have fun with Lisp!

Reference
Wirth, Niklaus (1976), Algorithms + Data Structures = Programs, Prentice-Hall

Related Posts:
Lisp: Tears of Joy, Part 3 Lisp: Tears of Joy, Part 5 Lisp: Tears of Joy, Part 7 Lisp: Tears of Joy, Part 8 Lisp: Tears of Joy, Part 6
Tags: Common Lisp, Daniel P. Friedman, data structures, functional programming, interceptor programs, James Hague, LFY March 2012, Lisp, Lisp: Tears of Joy series, Macros, mathematical approach, Matthias Felleisen, missile interceptor, Niklaus Wirth, Paul Graham, programming style, Reagan, SDI, strategic defense initiative

Article written by:


Vivek Shangari
The author is a hard-core hacker, if there ever was one. He always thinks programs, and holds a piece of code in his head all the time. His favourite past-time is to stop random strangers on the street and start talking about the benefits of open source over proprietary software, till they agree to switch sides, or threaten to jump off the nearest building. Connect with him: Website

Previous Post

Next Post

Guard Your Network with IPCop, Part 4: Configuring OpenVPN with Zerina Add-on

Building Image Processing Embedded Systems using Python, Part 3

AROUND THE WEB

ALSO ON LINUX FOR YOU

What's this?

Pastor Mocked For His "Biblical Money Code" Moneynews Don't Let Your Kids Read This: Paying Teens for Citi Women & Co. Don't Get Alzheimer's: Here's What May Cause It Newsmax Health Egg Rolls in Your Kitchen? Here's the Recipe FOODIE

India has immense under-utilised talent in the cloud 39 comments Getting Your First Job Code Sport
1 comment 1 comment

File Systems A Semester Project-II, Part-19 6 comments

3 comments Leave a message...


Newest Community Dan W aggoner
a year ago

Share


r
:))))

ok, they're extra smiles


Reply

Share
a year ago

Dan W aggoner Reply

Share

Dan W aggoner Reply

a year ago

^those aren't extra smiles. I've saved these parentheses for later to copy and paste.
Share

C o m m e n t fe e d

Su b s cri b e vi a e m a i l

Reviews

How-Tos

Coding

Interviews

Features

Overview

Blogs

Search
Popular tags
Linux , ubuntu, Java, MySQL, Google, python, Fedora, Android, PHP, C, html, w eb applications , India, Microsoft, unix , Window s , Red Hat, Oracle, Security , Apache, xml, LFY April 2012, FOSS, GNOME, http, JavaScript, LFY June 2011, open source, RAM, operating systems

For You & Me Developers Sysadmins Open Gurus CXOs Columns

All published articles are released under Creative Commons Attribution-NonCommercial 3.0 Unported License, unless otherw ise noted. LINUX For You is pow ered by WordPress, w hich gladly sits on top of a CentOS-based LEMP stack.

You might also like