THE FIRST FUNCTIONAL LANGUAGE: LISP
The oldest and most widely used functional language is Lisp
DATA TYPES AND STRUCTURES
- There are 2 types of data objects in the original Lisp: atoms and lists.
- Atoms, which have the form of identifiers, are the symbols of Lisp
- Numeric constants are also considered atoms
- Lisp rarely requires the operations of insertions or deletions
- Lists are specified by delimiting their elements within parentheses
Ex, (A B C D)
- Nested list structures are also specified by parentheses
Ex, (A (B C) D (E (F G)))
- The above list contains 4 elements: the first element is A, the second is (B C), the third is D and the fourth is (E (F G))
- Internally, lists are usually stored as single-linked list structures, in which each node has 2 pointers and represents an element
THE FIRST LISP INTERPRETER
- The first requirements for the universal Lisp function was a notation that allowed functions to be expressed in the same way data was expressed
- Function calls are specified in a prefix list form
Ex, (function_name arg_1 … arg_n)
- ex, if a + is a function that takes 2 numeric parameters, ( + 5 7) evaluates to 12.
- The function Evaluation could evaluate any other function and was itself in the form of an expression.
- A feature of early Lisp systems was the use of dynamic scoping
Very nice content.
ReplyDeleteBut more content should be added.