LISP is a general-purpose advanced computer programming language that has long monopolized applications in the field of artificial intelligence. LISP is a language designed in response to artificial intelligence. It is the first declarative in-system functional programming language. It is different from the in-system procedural C, Fortran, and object-oriented Java, C# and other structured programming languages. .
Lisp is a long-established language, the full name is LISt Processor, which is the "table processing language". It was a language designed by John McCarthy in 1958. Many languages, such as Algo, which appeared at the same time or even later as Lisp, have mostly died out, or have only a negligible use in some specific occasions. Until now, I am afraid that only Fortran and COBOL are left. However, Lisp alone has not declined with time. Instead, it has revived youth again and again. The languages ​​such as Scheme and ML from Lisp branch have even surpassed many veteran stars in many occasions. So where is the mystery of this evergreen tree forever?
If you have only been exposed to C/C++, Pascal and other "procedural languages", Lisp may make you feel very unusual. The first thing that attracts your eye (or makes you feel confused) must be the unusual parentheses in the Lisp program. Of course, from the current point of view, this design is not very friendly to programmers, but considering the computer processing power of the 1950s and 1960s, simplifying the design of the language itself was a priority at that time.
The basic syntax of Lisp is very simple. It doesn't even have reserved words (some linguists may disagree with this), it has only two basic data, only one basic grammatical structure is an expression, and these expressions are also It's the program structure, but just as the simplest Go game has the most complex changes, Lisp uses the most basic language structure definitions to accomplish the most complex functions that are difficult to implement in other languages.
LISP is a pioneer in functional programming. Its revolutionary innovative thinking has influenced the development of subsequent programming languages, and it has completely monopolized the application of artificial intelligence for a third of a century. The inefficiency factors that have emerged in the early years have also been removed from collective reforms, resulting in Common Lisp, Scheme, Emacs Lisp and Clojure, which are now widely used in software development, e-commerce and financial systems.
When the Lisp language was born, it contained nine new ideas. Some of us have become accustomed to it today, others have just appeared in other high-level languages, and two of them are unique to Lisp. According to the degree accepted by the public, these nine ideas are arranged in the following order.
(1) Conditional structure (ie, if-then-else structure). Now everyone thinks this is a matter of course, but Fortran I does not have this structure, it only has a goto structure based on the underlying machine instructions.
(2) A function is also a data type. In the Lisp language, functions, like integers or strings, are also a type of data type. It has its own literal representation (literal representationaTIon) that can be stored in variables and passed as parameters. A feature that a data type should have, it has.
(3) Recursion. Lisp is the first high-level language to support recursive functions.
(4) The dynamic type of the variable. In the Lisp language, all variables are actually pointers, the values ​​pointed to are of type, and the variables themselves are not. Copying variables is equivalent to copying pointers, not copying the data they point to.
(5) Garbage collection mechanism.
(6) The program consists of expressions. A Lisp program is a collection of expression trees, each of which returns a value. This is quite different from Fortran and most of the later languages, whose programs consist of expressions and statements.
Distinguishing expressions and statements is natural in Fortran I because it does not support statement nesting. So, if you need to calculate a value using a mathematical expression, then only the expression is used to return the value. No other syntax structure is available, otherwise the value cannot be processed.
Later, the new programming language supported the block structure, and of course this limitation did not exist. But it is too late, the distinction between expressions and statements is ingrained. It spreads from Fortran to the Algol language and then to the successor languages ​​of both.
(7) Symbol type. A symbol is actually a pointer to a string stored in a hash table. So, compare the two symbols for equality, just look at whether their pointers are the same, and do not compare them character by character.
(8) The code uses a tree representation of symbols and constants.
(9) The entire language is available at all times. Lisp does not really distinguish between read, compile, and run. You can compile or run the code during the read phase, read or run the code at compile time, and read or compile the code at runtime.
Running the code during the read period allows the user to reprogram the Lisp syntax; running the code at compile time is the basis for the Lisp macro; compiling the code at runtime allows Lisp to act as an extension in programs like Emacs Extension language; reading code at runtime so that programs can communicate with S-expressions. The recent emergence of XML formats has caused this concept to be "invented" again.
When Lisp language first appeared, these ideas were very different from other programming languages. The latter's design ideas were mainly determined by hardware in the late 1950s. As time went by, popular programming languages ​​were constantly updated, and language design ideas gradually moved closer to Lisp. Thoughts (1) to thoughts (5) have been widely accepted, thoughts (6) have begun to appear in mainstream programming languages, and ideas (7) have been implemented in the Python language, but there seems to be no proprietary syntax.
Thought (8) is probably the most interesting point. It and thought (9) were only part of the Lisp language for occasional reasons, because they were not part of McCarthy's original idea and were added by Russell. They have since made the Lisp language look weird, but it has also become the most unique feature of this language. The Lisp language is not weird because its syntax is weird, but because it has no grammar at all, the program is expressed directly in the form of a parse tree. In other languages, this form is only generated in the background after parsing, but Lisp uses it directly as an expression. It consists of a list, which is the basic data structure of Lisp.
Expressing the language with a language's own data structure is a very powerful feature. Thought (8) and thought (9) mean that you can write a program that you can program yourself. This may sound weird, but it's normal for the Lisp language. The most common practice is to use macros.
The term "macro" has a different meaning in the Lisp language than in other languages. The Lisp macro is all-encompassing. It can be either an abbreviated form of an expression or a compiler for a new language. Whether you want to really understand the Lisp language, or just want to broaden your programming horizons, it's best to learn macros. As far as I know, macros (defined in the Lisp language) are still unique to Lisp. One reason is that in order to use macros, you probably have to make your language look as weird as Lisp. Another possible reason is that if you want to add this ultimate weapon to your language, you can't claim to have invented a new language from this, you can only say that you have invented a new dialect of Lisp.
I said this as a joke, but that is the truth. If you create a new language with functions like car, cdr, cons, quote, cond, atom, eq, and a way to write functions as lists, then you can derive Lisp on their basis. All other parts of the language. In fact, the Lisp language is defined as such, and McCarthy designed the language to make this derivation possible.
ZTTEK Electric Scooter Batteries. Any size batteriesb can be customized! Suitable for most electric vechile modles, like electric e-bike, golf cart,forklift,beach electric motorcycle.
Electric Motorcycle Battery,Li-Ion Battery Pack For Electric Bike,Lithium Battery Charger For Electric Bike,Lithium Battery Pack For E-Bike
Jiangsu Zhitai New Energy Technology Co.,Ltd , https://www.zhitainewenergy.com