Questions about this topic? Sign up to ask in the talk tab.

Lisp

From NetSec
Revision as of 18:37, 3 June 2012 by Levi99Vmsb (Talk | contribs) (moving template to bottom)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Lisp or LISP (Locator/Identifier Separation Protocol) is one of the oldest group of programming languages, characterized by its strength, dynamism, and parenthesized syntax.

Lesson

In the information security business, one tends to hear more about the low-level aspects of programming than the elegant, academic ones. Lisp is an example of something that has fallen by the wayside. Lisp is a computer programming language, but it is vastly different than most languages you are most likely familiar with. Instead of using 2 + 2 for addition, it would be written as (+ 2 2). While this can seem complicated at the smaller level, this syntax can allow for elegance at a larger scale. For example, it is easier to write (+ 1 2 3 4 5 6 7 8 9 10) than to write each number with an operator between it and the next one. It also makes order of operations confusions which are common in C hard to come by. you know for a fact that each groupings or parenthesis evaluates before the enclosing one. (* (+ 1 2) (-5 2)) is much clearer than the alternative.

Learning about lisp isn't going to make you a better exploit researcher, but it can make you a better tool-writer to leverage the exploits that you find. Lisp's syntactic power comes from macros. Imagine that you have a program which involves repetitive code, such as database probing, xml parsing, or something similar. Macros allow you to say "Every time I say something like this, interpret it like this." It is the C preprocessor on steroids.

For example, if you code up a script which connects to a server on a port, executes a piece of code, and transmits the return value to the server. With a macro, you could just wrap that up in a send(function operand1 operand2) notation. Also, lisp allows for functional programming, lazy evaluation, and object-oriented programming with the Common Lisp Object System. Lisp is truly a gentleman's language. Grasping lisp will make you a better programmer, even if you primarily code in another language.

A wiki page can only scratch the surface of Lisp's elegance. Anyone interested needs to read Paul Grahm's (now free) book, which is available here.

This article contains too little information, it should be expanded or updated.
Things you can do to help:
  • add more content.
  • update current content.