Showing posts with label Lisp. Show all posts
Showing posts with label Lisp. Show all posts

Saturday, 23 May 2015

Common Lisp Programming Tutorial with Examples

            In this post, we will see Lisp(Dialect: Common Lisp) programming which includes Comments, Simple Statements, Defining Variables, Constants, Operators, Output to screen, Input from user, Conditional Statements, Looping Statements, Arrays, List Processing, Multi-threading, Arithmetic Shift (ash), Logical AND (logand), Functions along with Example for area of circle. 
           
1. What is Lisp?
            Lisp stands for "List Processing". It was invented by John McCarthy. Lisp is second oldest High-Level programming language after Fortran. It is in existence from 1958 and it is mostly used for Artificial intelligence programming. It uses functional programming paradigm for programming; i.e. in Lisp, all statements are specified in terms of function calls. Statements are written in fully parenthesized prefix notation. For e.g. (+ 15 36), (f op1 op2), (+ (- 5 3) 4) etc. It has automatic garbage collection. Hence the programmer need not have to explicitly free the dynamically allocated memory. It has a strong support for recursion. That's why, it is widely used in Artificial Intelligence projects. It is also used for programming for Computer Games, Pattern Recognition, Real Time Embedded Systems.
           Lisp has many dialects; but most common dialects are Common Lisp and Scheme. In this post, I have considered Common Lisp dialect and used Steel Bank Common Lisp (SBCL) compiler for execution. (Download SBCL from this link http://www.sbcl.org/platform-table.html)