Author: admin

  • Predicates

    Predicates are functions that test their arguments for some specific conditions and returns nil if the condition is false, or some non-nil value is the condition is true. The following table shows some of the most commonly used predicates − Sr.No. Predicate & Description 1 atomIt takes one argument and returns t if the argument…

  • Functions

    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…

  • Error Handling

    Go programming provides a pretty simple error handling framework with inbuilt error interface type of the following declaration − Functions normally return error as last return value. Use errors.New to construct a basic error message as following − Use return value and error message. Example Live Demo When the above code is compiled and executed, it produces…

  • Interfaces

    Go programming provides another data type called interfaces which represents a set of method signatures. The struct data type implements these interfaces to have method definitions for the method signature of the interfaces. Syntax Example Live Demo When the above code is compiled and executed, it produces the following result −

  • Loops

    There may be a situation, when you need to execute a block of code numbers of times. A loop statement allows us to execute a statement or group of statements multiple times and following is the general form of a loop statement in most of the programming languages. LISP provides the following types of constructs…

  • Recursion

    Recursion is the process of repeating items in a self-similar way. The same concept applies in programming languages as well. If a program allows to call a function inside the same function, then it is called a recursive function call. Take a look at the following example − The Go programming language supports recursion. That…

  • Decision Making

    Decision making structures require that the programmer specify one or more conditions to be evaluated or tested by the program, along with a statement or statements to be executed if the condition is determined to be true, and optionally, other statements to be executed if the condition is determined to be false. Following is the…

  • Maps

    Go provides another important data type named map which maps unique keys to values. A key is an object that you use to retrieve a value at a later date. Given a key and a value, you can store the value in a Map object. After the value is stored, you can retrieve it by…

  • Operators

    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 The following table shows all the arithmetic operators supported by LISP. Assume variable A holds…

  • Constants

    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…