Lisp is a programming language that has an overall style that is organized around expressions and functions. Every Lisp procedure is a function, and when called, it returns a data object as its value. It is also commonly referred to as "functions" even though they may have side effects.
Lisp is the second-oldest high-level programming language in the world which is invented by John McCarthy in the year 1958 at the Massachusetts Institute of Technology.
Features of LISP Programming Language:
- It is a machine-independent language
- It uses iterative design methodology and is easily extensible
- It allows us to create and update the programs and applications dynamically.
- It provides high-level debugging.
- It supports object-oriented programming.
- It supports all kinds of data types like objects, structures, lists, vectors, adjustable arrays, set, trees,hash-tables, and symbols.
- It is an expression-based language
- It can support different decision-making statements like if, when,case, and cond
- It will also support different iterating statements like do, loop,loopfor, dotimes and dolist.
- It will support input and output functions
- By using lisp we can also create our own functions
These are the features of LISP Programming.
Hello World program in LISP:
we can start writing a string by using the write-line method
Syntax:
(write-line string)
Example:
Lisp
;this is a comment
(write-line "Hello Geeks")
Output:
Hello Geeks
Naming Conventions:
The naming Conventions mean the way we are declaring variables in a program. It includes the variable names and syntax formats
Lets us discuss the conventions
- A variable can contain any number of alphanumeric characters other than whitespace, open and closing parentheses
Example:
Acceptable - hello,saisravan, etc
Not Acceptable - hell()0,sat{ sravab{,,,,,,,,etc
- A variable can not contain double and single quotes, backslash, comma, colon, semicolon, and vertical bar.
Example:
Acceptable - hello,saisravan, etc
Not Acceptable - hell"")0,sat//*& sra//>vab{,,,,,,,,etc
- A variable can not start with a digit but. it can contain any number of digits
Example:
Acceptable - hello88Geeks, r56lisp, ,,,,,etc
Not Acceptable - 40geeks,4klll,....etc
Example Code: For acceptable names
Lisp
;acceptable naming conventions
(write-line "hello")
(terpri)
;acceptable naming conventions
(write-line "hello99")
(terpri)
;acceptable naming conventions
(write-line "hello geeks")
(terpri)
;acceptable naming conventions
(write-line "hello_Geek")
(terpri)
;acceptable naming conventions
(write-line "hello123")
Output:
hello
hello99
hello geeks
hello_Geek
hello123
Similar Reads
Loop Construct in LISP In this article, we will discuss Loop Construct. This Construct is used to iterate the data until it finds the return statement. And then it will stop iterating and return the results. Syntax: (loop (statements) condition return ) where, loop is the keywordstatements are used to iterate the loopcond
2 min read
Loop For Construct in LISP The loop for construct in common LISP is used to iterate over an iterable, similar to the for loop in other programming languages. It can be used for the following: This is used to set up variables for iteration.It can be used for conditionally terminate the iteration.It can be used for operating on
2 min read
If Construct in LISP In this article, we will discuss the if construct in LISP. The if is a decision-making statement used to check whether the condition is right or wrong. The if the condition is right, then it will go inside the if block and execute the statements under if block. Otherwise, the statements are not exec
2 min read
Do Construct in LISP In this article, we will discuss the Do Construct in LISP. Do construct is used to perform an iteration in a structured format. Syntax: (do ((variable1 value1 new updated value 1) (variable2 value2 new updated value 2) ------------------------------- ------------------------------- (variable n value
2 min read
Introspection in Ruby Introspection is a method of metaprogramming in Ruby. It gives your Ruby code to analyse itself at run-time. It can be considered asking the program questions about its methods, instance variables, parents, ancestors and what functions it responds to. Introspection means to look inward. when our cod
4 min read