LISP – Hash Table ”; Previous Next The hash table data structure represents a collection of key-and-value pairs that are organized based on the hash code of the key. It uses the key to access the elements in the collection. A hash table is used when you need to access elements by using a key, and you can identify a useful key value. Each item in the hash table has a key/value pair. The key is used to access the items in the collection. Creating Hash Table in LISP In Common LISP, hash table is a general-purpose collection. You can use arbitrary objects as a key or indexes. When you store a value in a hash table, you make a key-value pair, and store it under that key. Later you can retrieve the value from the hash table using the same key. Each key maps to a single value, although you can store a new value in a key. Hash tables, in LISP, could be categorized into three types, based on the way the keys could be compared – eq, eql or equal. If the hash table is hashed on LISP objects then the keys are compared with eq or eql. If the hash table hash on tree structure, then it would be compared using equal. The make-hash-table function is used for creating a hash table. Syntax for this function is − make-hash-table &key :test :size :rehash-size :rehash-threshold Where − The key argument provides the key. The :test argument determines how keys are compared – it should have one of three values #”eq, #”eql, or #”equal, or one of the three symbols eq, eql, or equal. If not specified, eql is assumed. The :size argument sets the initial size of the hash table. This should be an integer greater than zero. The :rehash-size argument specifies how much to increase the size of the hash table when it becomes full. This can be an integer greater than zero, which is the number of entries to add, or it can be a floating-point number greater than 1, which is the ratio of the new size to the old size. The default value for this argument is implementation-dependent. The :rehash-threshold argument specifies how full the hash table can get before it must grow. This can be an integer greater than zero and less than the :rehash-size (in which case it will be scaled whenever the table is grown), or it can be a floating-point number between zero and 1. The default value for this argument is implementation-dependent. You can also call the make-hash-table function with no arguments. Retrieving Items from and Adding Items into the Hash Table The gethash function retrieves an item from the hash table by searching for its key. If it does not find the key, then it returns nil. It has the following syntax − gethash key hash-table &optional default where − key: is the associated key hash-table: is the hash-table to be searched default: is the value to be returned, if the entry is not found, which is nil, if not specified. The gethash function actually returns two values, the second being a predicate value that is true if an entry was found, and false if no entry was found. For adding an item to the hash table, you can use the setf function along with the gethash function. Example Create a new source code file named main.lisp and type the following code in it. Live Demo (setq empList (make-hash-table)) (setf (gethash ”001 empList) ”(Charlie Brown)) (setf (gethash ”002 empList) ”(Freddie Seal)) (write (gethash ”001 empList)) (terpri) (write (gethash ”002 empList)) When you execute the code, it returns the following result − (CHARLIE BROWN) (FREDDIE SEAL) Removing an Entry The remhash function removes any entry for a specific key in hash-table. This is a predicate that is true if there was an entry or false if there was not. The syntax for this function is − remhash key hash-table Example Create a new source code file named main.lisp and type the following code in it. Live Demo (setq empList (make-hash-table)) (setf (gethash ”001 empList) ”(Charlie Brown)) (setf (gethash ”002 empList) ”(Freddie Seal)) (setf (gethash ”003 empList) ”(Mark Mongoose)) (write (gethash ”001 empList)) (terpri) (write (gethash ”002 empList)) (terpri) (write (gethash ”003 empList)) (remhash ”003 empList) (terpri) (write (gethash ”003 empList)) When you execute the code, it returns the following result − (CHARLIE BROWN) (FREDDIE SEAL) (MARK MONGOOSE) NIL The maphash Function The maphash function allows you to apply a specified function on each key-value pair on a hash table. It takes two arguments – the function and a hash table and invokes the function once for each key/value pair in the hash table. Example Create a new source code file named main.lisp and type the following code in it. Live Demo (setq empList (make-hash-table)) (setf (gethash ”001 empList) ”(Charlie Brown)) (setf (gethash ”002 empList) ”(Freddie Seal)) (setf (gethash ”003 empList) ”(Mark Mongoose)) (maphash #”(lambda (k v) (format t “~a => ~a~%” k v)) empList) When you execute the code, it returns the following result − 3 => (MARK MONGOOSE) 2 => (FREDDIE SEAL) 1 => (CHARLIE BROWN) Print Page Previous Next Advertisements ”;
Category: lisp
LISP – Functions
LISP – Functions ”; Previous Next A function is a group of statements that together perform a task. You can divide up your code into separate functions. How you divide up your code among different functions is up to you, but logically the division usually is so each function performs a specific task. Defining Functions in LISP The macro named defun is used for defining functions. The defun macro needs three arguments − Name of the function Parameters of the function Body of the function Syntax for defun is − (defun name (parameter-list) “Optional documentation string.” body) Let us illustrate the concept with simple examples. Example 1 Let”s write a function named averagenum that will print the average of four numbers. We will send these numbers as parameters. Create a new source code file named main.lisp and type the following code in it. Live Demo (defun averagenum (n1 n2 n3 n4) (/ ( + n1 n2 n3 n4) 4) ) (write(averagenum 10 20 30 40)) When you execute the code, it returns the following result − 25 Example 2 Let”s define and call a function that would calculate the area of a circle when the radius of the circle is given as an argument. Create a new source code file named main.lisp and type the following code in it. Live Demo (defun area-circle(rad) “Calculates area of a circle with given radius” (terpri) (format t “Radius: ~5f” rad) (format t “~%Area: ~10f” (* 3.141592 rad rad)) ) (area-circle 10) When you execute the code, it returns the following result − Radius: 10.0 Area: 314.1592 Please note that − You can provide an empty list as parameters, which means the function takes no arguments, the list is empty, written as (). LISP also allows optional, multiple, and keyword arguments. The documentation string describes the purpose of the function. It is associated with the name of the function and can be obtained using the documentation function. The body of the function may consist of any number of Lisp expressions. The value of the last expression in the body is returned as the value of the function. You can also return a value from the function using the return-from special operator. Let us discuss the above concepts in brief. Click following links to find details − Optional Parameters Rest Parameters Keyword Parameters Returning Values from a Function Lambda Functions Mapping Functions Print Page Previous Next Advertisements ”;
LISP – Operators
LISP – Operators ”; Previous Next An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations. LISP allows numerous operations on data, supported by various functions, macros and other constructs. The operations allowed on data could be categorized as − Arithmetic Operations Comparison Operations Logical Operations Bitwise Operations Arithmetic Operations The following table shows all the arithmetic operators supported by LISP. Assume variable A holds 10 and variable B holds 20 then − Show Examples Operator Description Example + Adds two operands (+A B) will give 30 – Subtracts second operand from the first (- A B) will give -10 * Multiplies both operands (* A B) will give 200 / Divides numerator by de-numerator (/ B A) will give 2 mod,rem Modulus Operator and remainder of after an integer division (mod B A )will give 0 incf Increments operator increases integer value by the second argument specified (incf A 3) will give 13 decf Decrements operator decreases integer value by the second argument specified (decf A 4) will give 9 Comparison Operations Following table shows all the relational operators supported by LISP that compares between numbers. However unlike relational operators in other languages, LISP comparison operators may take more than two operands and they work on numbers only. Assume variable A holds 10 and variable B holds 20, then − Show Examples Operator Description Example = Checks if the values of the operands are all equal or not, if yes then condition becomes true. (= A B) is not true. /= Checks if the values of the operands are all different or not, if values are not equal then condition becomes true. (/= A B) is true. > Checks if the values of the operands are monotonically decreasing. (> A B) is not true. < Checks if the values of the operands are monotonically increasing. (< A B) is true. >= Checks if the value of any left operand is greater than or equal to the value of next right operand, if yes then condition becomes true. (>= A B) is not true. <= Checks if the value of any left operand is less than or equal to the value of its right operand, if yes then condition becomes true. (<= A B) is true. max It compares two or more arguments and returns the maximum value. (max A B) returns 20 min It compares two or more arguments and returns the minimum value. (min A B) returns 10 Logical Operations on Boolean Values Common LISP provides three logical operators: and, or, and not that operates on Boolean values. Assume A has value nil and B has value 5, then − Show Examples Operator Description Example and It takes any number of arguments. The arguments are evaluated left to right. If all arguments evaluate to non-nil, then the value of the last argument is returned. Otherwise nil is returned. (and A B) will return NIL. or It takes any number of arguments. The arguments are evaluated left to right until one evaluates to non-nil, in such case the argument value is returned, otherwise it returns nil. (or A B) will return 5. not It takes one argument and returns t if the argument evaluates to nil. (not A) will return T. Bitwise Operations on Numbers Bitwise operators work on bits and perform bit-by-bit operation. The truth tables for bitwise and, or, and xor operations are as follows − Show Examples p q p and q p or q p xor q 0 0 0 0 0 0 1 0 1 1 1 1 1 1 0 1 0 0 1 1 Assume if A = 60; and B = 13; now in binary format they will be as follows: A = 0011 1100 B = 0000 1101 —————– A and B = 0000 1100 A or B = 0011 1101 A xor B = 0011 0001 not A = 1100 0011 The Bitwise operators supported by LISP are listed in the following table. Assume variable A holds 60 and variable B holds 13, then − Operator Description Example logand This returns the bit-wise logical AND of its arguments. If no argument is given, then the result is -1, which is an identity for this operation. (logand a b)) will give 12 logior This returns the bit-wise logical INCLUSIVE OR of its arguments. If no argument is given, then the result is zero, which is an identity for this operation. (logior a b) will give 61 logxor This returns the bit-wise logical EXCLUSIVE OR of its arguments. If no argument is given, then the result is zero, which is an identity for this operation. (logxor a b) will give 49 lognor This returns the bit-wise NOT of its arguments. If no argument is given, then the result is -1, which is an identity for this operation. (lognor a b) will give -62, logeqv This returns the bit-wise logical EQUIVALENCE (also known as exclusive nor) of its arguments. If no argument is given, then the result is -1, which is an identity for this operation. (logeqv a b) will give -50 Print Page Previous Next Advertisements ”;
LISP – Symbols
LISP – Symbols ”; Previous Next In LISP, a symbol is a name that represents data objects and interestingly it is also a data object. What makes symbols special is that they have a component called the property list, or plist. Property Lists LISP allows you to assign properties to symbols. For example, let us have a ”person” object. We would like this ”person” object to have properties like name, sex, height, weight, address, profession etc. A property is like an attribute name. A property list is implemented as a list with an even number (possibly zero) of elements. Each pair of elements in the list constitutes an entry; the first item is the indicator, and the second is the value. When a symbol is created, its property list is initially empty. Properties are created by using get within a setf form. For example, the following statements allow us to assign properties title, author and publisher, and respective values, to an object named (symbol) ”book”. Example 1 Create a new source code file named main.lisp and type the following code in it. Live Demo (write (setf (get ”books”title) ”(Gone with the Wind))) (terpri) (write (setf (get ”books ”author) ”(Margaret Michel))) (terpri) (write (setf (get ”books ”publisher) ”(Warner Books))) When you execute the code, it returns the following result − (GONE WITH THE WIND) (MARGARET MICHEL) (WARNER BOOKS) Various property list functions allow you to assign properties as well as retrieve, replace or remove the properties of a symbol. The get function returns the property list of symbol for a given indicator. It has the following syntax − get symbol indicator &optional default The get function looks for the property list of the given symbol for the specified indicator, if found then it returns the corresponding value; otherwise default is returned (or nil, if a default value is not specified). Example 2 Create a new source code file named main.lisp and type the following code in it. Live Demo (setf (get ”books ”title) ”(Gone with the Wind)) (setf (get ”books ”author) ”(Margaret Micheal)) (setf (get ”books ”publisher) ”(Warner Books)) (write (get ”books ”title)) (terpri) (write (get ”books ”author)) (terpri) (write (get ”books ”publisher)) When you execute the code, it returns the following result − (GONE WITH THE WIND) (MARGARET MICHEAL) (WARNER BOOKS) The symbol-plist function allows you to see all the properties of a symbol. Example 3 Create a new source code file named main.lisp and type the following code in it. Live Demo (setf (get ”annie ”age) 43) (setf (get ”annie ”job) ”accountant) (setf (get ”annie ”sex) ”female) (setf (get ”annie ”children) 3) (terpri) (write (symbol-plist ”annie)) When you execute the code, it returns the following result − (CHILDREN 3 SEX FEMALE JOB ACCOUNTANT AGE 43) The remprop function removes the specified property from a symbol. Example 4 Create a new source code file named main.lisp and type the following code in it. Live Demo (setf (get ”annie ”age) 43) (setf (get ”annie ”job) ”accountant) (setf (get ”annie ”sex) ”female) (setf (get ”annie ”children) 3) (terpri) (write (symbol-plist ”annie)) (remprop ”annie ”age) (terpri) (write (symbol-plist ”annie)) When you execute the code, it returns the following result − (CHILDREN 3 SEX FEMALE JOB ACCOUNTANT AGE 43) (CHILDREN 3 SEX FEMALE JOB ACCOUNTANT) Print Page Previous Next Advertisements ”;
LISP – Tree
LISP – Tree ”; Previous Next You can build tree data structures from cons cells, as lists of lists. To implement tree structures, you will have to design functionalities that would traverse through the cons cells, in specific order, for example, pre-order, in-order, and post-order for binary trees. Tree as List of Lists Let us consider a tree structure made up of cons cell that form the following list of lists − ((1 2) (3 4) (5 6)). Diagrammatically, it could be expressed as − Tree Functions in LISP Although mostly you will need to write your own tree-functionalities according to your specific need, LISP provides some tree functions that you can use. Apart from all the list functions, the following functions work especially on tree structures − Sr.No. Function & Description 1 copy-tree x & optional vecp It returns a copy of the tree of cons cells x. It recursively copies both the car and the cdr directions. If x is not a cons cell, the function simply returns x unchanged. If the optional vecp argument is true, this function copies vectors (recursively) as well as cons cells. 2 tree-equal x y & key :test :test-not :key It compares two trees of cons cells. If x and y are both cons cells, their cars and cdrs are compared recursively. If neither x nor y is a cons cell, they are compared by eql, or according to the specified test. The :key function, if specified, is applied to the elements of both trees. 3 subst new old tree & key :test :test-not :key It substitutes occurrences of given old item with new item, in tree, which is a tree of cons cells. 4 nsubst new old tree & key :test :test-not :key It works same as subst, but it destroys the original tree. 5 sublis alist tree & key :test :test-not :key It works like subst, except that it takes an association list alist of old-new pairs. Each element of the tree (after applying the :key function, if any), is compared with the cars of alist; if it matches, it is replaced by the corresponding cdr. 6 nsublis alist tree & key :test :test-not :key It works same as sublis, but a destructive version. Example 1 Create a new source code file named main.lisp and type the following code in it. Live Demo (setq lst (list ”(1 2) ”(3 4) ”(5 6))) (setq mylst (copy-list lst)) (setq tr (copy-tree lst)) (write lst) (terpri) (write mylst) (terpri) (write tr) When you execute the code, it returns the following result − ((1 2) (3 4) (5 6)) ((1 2) (3 4) (5 6)) ((1 2) (3 4) (5 6)) Example 2 Create a new source code file named main.lisp and type the following code in it. Live Demo (setq tr ”((1 2 (3 4 5) ((7 8) (7 8 9))))) (write tr) (setq trs (subst 7 1 tr)) (terpri) (write trs) When you execute the code, it returns the following result − ((1 2 (3 4 5) ((7 8) (7 8 9)))) ((7 2 (3 4 5) ((7 8) (7 8 9)))) Building Your Own Tree Let us try to build our own tree, using the list functions available in LISP. First let us create a new node that contains some data (defun make-tree (item) “it creates a new node with item.” (cons (cons item nil) nil) ) Next let us add a child node into the tree – it will take two tree nodes and add the second tree as the child of the first. (defun add-child (tree child) (setf (car tree) (append (car tree) child)) tree) This function will return the first child a given tree – it will take a tree node and return the first child of that node, or nil, if this node does not have any child node. (defun first-child (tree) (if (null tree) nil (cdr (car tree)) ) ) This function will return the next sibling of a given node – it takes a tree node as argument, and returns a reference to the next sibling node, or nil, if the node does not have any. (defun next-sibling (tree) (cdr tree) ) Lastly we need a function to return the information in a node − (defun data (tree) (car (car tree)) ) Example This example uses the above functionalities − Create a new source code file named main.lisp and type the following code in it. Live Demo (defun make-tree (item) “it creates a new node with item.” (cons (cons item nil) nil) ) (defun first-child (tree) (if (null tree) nil (cdr (car tree)) ) ) (defun next-sibling (tree) (cdr tree) ) (defun data (tree) (car (car tree)) ) (defun add-child (tree child) (setf (car tree) (append (car tree) child)) tree ) (setq tr ”((1 2 (3 4 5) ((7 8) (7 8 9))))) (setq mytree (make-tree 10)) (write (data mytree)) (terpri) (write (first-child tr)) (terpri) (setq newtree (add-child tr mytree)) (terpri) (write newtree) When you execute the code, it returns the following result − 10 (2 (3 4 5) ((7 8) (7 8 9))) ((1 2 (3 4 5) ((7 8) (7 8 9)) (10))) Print Page Previous Next Advertisements ”;
LISP – Constants
LISP – Constants ”; Previous Next In LISP, constants are variables that never change their values during program execution. Constants are declared using the defconstant construct. Example The following example shows declaring a global constant PI and later using this value inside a function named area-circle that calculates the area of a circle. The defun construct is used for defining a function, we will look into it in the Functions chapter. Create a new source code file named main.lisp and type the following code in it. Live Demo (defconstant PI 3.141592) (defun area-circle(rad) (terpri) (format t “Radius: ~5f” rad) (format t “~%Area: ~10f” (* PI rad rad))) (area-circle 10) When you click the Execute button, or type Ctrl+E, LISP executes it immediately and the result returned is. Radius: 10.0 Area: 314.1592 Print Page Previous Next Advertisements ”;
LISP – Home
LISP Tutorial PDF Version Quick Guide Resources Job Search Discussion Lisp is the second-oldest high-level programming language after Fortran and has changed a great deal since its early days, and a number of dialects have existed over its history. Today, the most widely known general-purpose Lisp dialects are Common Lisp and Scheme. Lisp was invented by John McCarthy in 1958 while he was at the Massachusetts Institute of Technology (MIT). This reference will take you through simple and practical approach while learning LISP Programming language. Audience This reference has been prepared for the beginners to help them understand the basic to advanced concepts related to LISP Programming language. Prerequisites Before you start doing practice with various types of examples given in this reference, I”m making an assumption that you are already aware about what is a computer program and what is a computer programming language? Print Page Previous Next Advertisements ”;
LISP – Basic Syntax
LISP – Basic Syntax ”; Previous Next Basic Building Blocks in LISP LISP programs are made up of three basic building blocks − atom list string An atom is a number or string of contiguous characters. It includes numbers and special characters. Following are examples of some valid atoms − hello-from-tutorials-point name 123008907 *hello* Block#221 abc123 A list is a sequence of atoms and/or other lists enclosed in parentheses. Following are examples of some valid lists − ( i am a list) (a ( a b c) d e fgh) (father tom ( susan bill joe)) (sun mon tue wed thur fri sat) ( ) A string is a group of characters enclosed in double quotation marks. Following are examples of some valid strings − ” I am a string” “a ba c d efg #$%^&!” “Please enter the following details :” “Hello from ”Tutorials Point”! ” Adding Comments The semicolon symbol (;) is used for indicating a comment line. For Example, Live Demo (write-line “Hello World”) ; greet the world ; tell them your whereabouts (write-line “I am at ”Tutorials Point”! Learning LISP”) When you click the Execute button, or type Ctrl+E, LISP executes it immediately and the result returned is − Hello World I am at ”Tutorials Point”! Learning LISP Some Notable Points before Moving to Next Following are some of the important points to note − The basic numeric operations in LISP are +, -, *, and / LISP represents a function call f(x) as (f x), for example cos(45) is written as cos 45 LISP expressions are case-insensitive, cos 45 or COS 45 are same. LISP tries to evaluate everything, including the arguments of a function. Only three types of elements are constants and always return their own value Numbers The letter t, that stands for logical true. The value nil, that stands for logical false, as well as an empty list. Little More about LISP Forms In the previous chapter, we mentioned that the evaluation process of LISP code takes the following steps. The reader translates the strings of characters to LISP objects or s-expressions. The evaluator defines syntax of Lisp forms that are built from s-expressions. This second level of evaluation defines a syntax that determines which s-expressions are LISP forms. Now, a LISP forms could be. An Atom An empty or non-list Any list that has a symbol as its first element The evaluator works as a function that takes a valid LISP form as an argument and returns a value. This is the reason why we put the LISP expression in parenthesis, because we are sending the entire expression/form to the evaluator as arguments. Naming Conventions in LISP Name or symbols can consist of any number of alphanumeric characters other than whitespace, open and closing parentheses, double and single quotes, backslash, comma, colon, semicolon and vertical bar. To use these characters in a name, you need to use escape character (). A name can have digits but not entirely made of digits, because then it would be read as a number. Similarly a name can have periods, but can”t be made entirely of periods. Use of Single Quotation Mark LISP evaluates everything including the function arguments and list members. At times, we need to take atoms or lists literally and don”t want them evaluated or treated as function calls. To do this, we need to precede the atom or the list with a single quotation mark. The following example demonstrates this. Create a file named main.lisp and type the following code into it. Live Demo (write-line “single quote used, it inhibits evaluation”) (write ”(* 2 3)) (write-line ” “) (write-line “single quote not used, so expression evaluated”) (write (* 2 3)) When you click the Execute button, or type Ctrl+E, LISP executes it immediately and the result returned is − single quote used, it inhibits evaluation (* 2 3) single quote not used, so expression evaluated 6 Print Page Previous Next Advertisements ”;
LISP – Overview
LISP – Overview ”; Previous Next John McCarthy invented LISP in 1958, shortly after the development of FORTRAN. It was first implemented by Steve Russell on an IBM 704 computer. It is particularly suitable for Artificial Intelligence programs, as it processes symbolic information effectively. Common Lisp originated, during the 1980s and 1990s, in an attempt to unify the work of several implementation groups that were successors to Maclisp, like ZetaLisp and NIL (New Implementation of Lisp) etc. It serves as a common language, which can be easily extended for specific implementation. Programs written in Common LISP do not depend on machine-specific characteristics, such as word length etc. Features of Common LISP It is machine-independent It uses iterative design methodology, and easy extensibility. It allows updating the programs dynamically. It provides high level debugging. It provides advanced object-oriented programming. It provides a convenient macro system. It provides wide-ranging data types like, objects, structures, lists, vectors, adjustable arrays, hash-tables, and symbols. It is expression-based. It provides an object-oriented condition system. It provides a complete I/O library. It provides extensive control structures. Applications Built in LISP Large successful applications built in Lisp. Emacs G2 AutoCad Igor Engraver Yahoo Store Print Page Previous Next Advertisements ”;
LISP – Program Structure
LISP – Program Structure ”; Previous Next LISP expressions are called symbolic expressions or s-expressions. The s-expressions are composed of three valid objects, atoms, lists and strings. Any s-expression is a valid program. LISP programs run either on an interpreter or as compiled code. The interpreter checks the source code in a repeated loop, which is also called the read-evaluate-print loop (REPL). It reads the program code, evaluates it, and prints the values returned by the program. A Simple Program Let us write an s-expression to find the sum of three numbers 7, 9 and 11. To do this, we can type at the interpreter prompt. (+ 7 9 11) LISP returns the result − 27 If you would like to run the same program as a compiled code, then create a LISP source code file named myprog.lisp and type the following code in it. Live Demo (write (+ 7 9 11)) When you click the Execute button, or type Ctrl+E, LISP executes it immediately and the result returned is − 27 LISP Uses Prefix Notation You might have noted that LISP uses prefix notation. In the above program the + symbol works as the function name for the process of summation of the numbers. In prefix notation, operators are written before their operands. For example, the expression, a * ( b + c ) / d will be written as − (/ (* a (+ b c) ) d) Let us take another example, let us write code for converting Fahrenheit temp of 60o F to the centigrade scale − The mathematical expression for this conversion will be − (60 * 9 / 5) + 32 Create a source code file named main.lisp and type the following code in it. Live Demo (write(+ (* (/ 9 5) 60) 32)) When you click the Execute button, or type Ctrl+E, LISP executes it immediately and the result returned is− 140 Evaluation of LISP Programs Evaluation of LISP programs has two parts − Translation of program text into Lisp objects by a reader program Implementation of the semantics of the language in terms of these objects by an evaluator program The evaluation process takes the following steps − The reader translates the strings of characters to LISP objects or s-expressions. The evaluator defines syntax of Lisp forms that are built from s-expressions. This second level of evaluation defines a syntax that determines which s-expressions are LISP forms. The evaluator works as a function that takes a valid LISP form as an argument and returns a value. This is the reason why we put the LISP expression in parenthesis, because we are sending the entire expression/form to the evaluator as arguments. The ”Hello World” Program Learning a new programming language doesn”t really take off until you learn how to greet the entire world in that language, right! So, please create new source code file named main.lisp and type the following code in it. Live Demo (write-line “Hello World”) (write-line “I am at ”Tutorials Point”! Learning LISP”) When you click the Execute button, or type Ctrl+E, LISP executes it immediately and the result returned is − Hello World I am at ”Tutorials Point”! Learning LISP Print Page Previous Next Advertisements ”;