Skip to content
Related Articles

Related Articles

Naming Conventions in LISP

View Discussion
Improve Article
Save Article
Like Article
  • Last Updated : 31 Mar, 2022

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

  • LISP is a machine-independent language and is based on an iterative design methodology.
  • It is an extensible and expression-based language.
  • It can dynamically create and update programs and applications.
  • It provides debugging and supports object-oriented programming.
  • It supports all kinds of:
    • Data types: objects, structures, lists, vectors, adjustable arrays, sets, trees,hash-tables, and symbols and different decision-making statements like if, when, case, and cond.
    • Iterating statements: Like do, loop, loopfor, dotimes, and dolist.
  • It will support input and output functions and user-defined functions

Let’s say for writing “GeeksforGeeks” we can use the below syntax:

Syntax:

(write-line string)

Example:

Lisp




(write-line "GeeksforGeeks")

Output:

GeeksforGeeks

Explanation: The write-line is a method that writes the specified line on the output stream. We have passed “GeeksforGeeks” as a string.

Now let’s look into the Naming Conventions in LISP. 

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,akshit, etc
Not Acceptable: hell()0,sat{ akshit{,,,,,,,,etc

A variable can not contain double and single quotes, backslash, comma, colon, semicolon, and vertical bar.

Example:

Acceptable: hello,akshit, etc
Not Acceptable: hell””)0,sat//*& aka//>vab{,,,,,,,,etc

A variable can not start with a digit but it can contain any number of digits

Example:

Acceptable: hello88Geeks, a45akshit, ,,,,,etc
Not Acceptable: 40geeks,4akshit,….etc

Now let’s take a look at a couple of examples to better understand the Naming convention in LISP.

Example 1: Naming Conventions in LISP.

Lisp




;acceptable naming conventions
  
(write-line "akshit")
    
(terpri)
    
(write-line "akshit99")
    
(terpri)
    
(write-line "hello geeks")

Output:

akshit
akshit99
hello geeks

Example 2: Naming Conventions in LISP.

Lisp




;acceptable naming conventions
(write-line "hello_Geek")
    
(terpri)
    
(write-line "hello123")

Output:

hello_Geek
hello123

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!