Книга: Introduction to Microprocessors and Microcontrollers
Lisp
Lisp
Lisp was designed about the same time as Cobol and several years before Basic. It is the work of an American, John McCarthy (see Figure 10.11).
Figure 10.11 Lisp – dealing with lists
Lisp (LISt Processing) involves the manipulation of data which is held in lists or entered by keyboard and is associated with artificial intelligence. Lisp is a function-oriented language. This means that we define a function, such as add, subtract or more complex combinations. A list consists of a series of ‘members’ separated by spaces and enclosed in brackets. Samples of lists are (2 5 56 234) or (mother father son daughter).
A simple function defined as (PLUS 6 4) would return the answer 10 by adding the two numbers. Since it is an interpreted language, the program is executed one step at a time so inputted values are used as they are entered. In some versions of Lisp, this would have been written as (+ 6 4) using the mathematical symbol.
We can define our own function by saying
(defun result (A B)(+A B))
defun = define function and A B are inputted numbers and the answers have been given the name ‘result’. So, if we input the numbers 4 and 5 we would receive the response 9. This has defined a function in which we enter two numbers A and B and they are added. We could use this to enter a list of values for A and B generating a list of all the results.
- 14.4.8. Emacs Lisp
- Джон Маккарти Отец искусственного интеллекта, автор языка LISP
- Chapter 11. Emacs Lisp Programming
- Appendix B. Emacs Lisp Packages
- 12. They Called It LISP for a Reason: List Processing
- У3.2 Принцип Открыт-Закрыт (для программистов Lisp)
- 9.5.3 Installing the ELisp Library
- 11.5.2 More Lisp Basics: Lists
- А.5. Common Lisp Object System (CLOS)
- 8.2.11. Учебный пример: Emacs Lisp
- 17.5.1.8. Переносимость Emacs Lisp
- Why Lisp?