Basic Syntax in LISP
LISP is a list processing programming language. It is widely used in the manipulation of data strings. It provides an input and output library. LISP provides a macro system and provides well control structures for the manipulation of data.
Basic Blocks in LISP:
There are three basic building blocks of the LISP program:
Atom: An atom includes numbers, special characters, and Strings.
hello-Geeks-Learn-coding 8789902 Color#268 atom145 Ayush *Namaste*
List: A list is a sequence of number or string contiguous characters in parentheses.
(g ( e e a) 12 34 5) (sun mon tue wed thur fri sat) ( ) ( People call me list) (Geeks ( Love coding program))
String: A string is a group of characters enclosed in double quotation marks.
" People call me string" "Steps require to solve this is:" "Hello 'How are you Geeks'! " "a ba c d efg #$%^&!"
Comments in LISP:
A ;(semicolon) is used to represent a single line comment in LISP.
; I am a comment in LISP ; I will not be executed in the program.
Naming Conventions in LISP:
Importance of Single Quotation Mark Note:
A single quote is used in representing data literal. It returns data.
Using a Single quote:
The list is a function, so the student gets evaluated to a function. ‘Geek is a notation for (quote Geek). Evaluating (quote Geek) gives the symbol Geek. So next the function is applied to the symbol Geek and a return value is computed.
Without using a single quote:
Here we have a function application and the student gets evaluated for a function. This time Geek is a variable. Evaluating Geek gives the value that is bound to it – whatever it is. So then the function is applied to the value of the variable Geek.