How do you become a LISP programmer (GO)

Source: Internet
Author: User

Label:

My path as a Lisp programmer is tortuous and long. I have summed up my study experience in my diary on October 3, 2007 and I am now copying it.

As early as May 2000, when academician Stallman visited China, he told me that Lisp (or its modern variant Scheme) was the most powerful programming language, and he himself was a senior Lisp programmer, and he was proficient in C,gnu Emacs, which was developed using both C and Lisp. I had mastered C, but I could not use Lisp, but I fully believed what he said was true. So, I want to become a master of programming, I decided to learn and master the programming language. I have been learning Lisp since the second half of 2000. The following summary of the learning experience is generally in chronological order of discharge:

It is necessary to point out that before I met Stallman Academician, I had read a book on artificial intelligence in college, "Artificial Intelligence---Making machines" think ", the author is Neill Graham, The last chapter of the book (the 14th chapter) is about Lisp, so I am not completely unfamiliar with the concept of AI and Lisp. The chapters in front of this book are well understood, but in this last chapter, I have a lot of trouble. I spent a lot of time trying to understand the truth, but in the end, in retrospect, the main reason is that I did not have a proper practice environment, after reading a lot of books, I felt as if I understood the truth, but actually did not really understand clearly. However, two points in my opinion are undoubtedly certain: first, Lisp has become the first choice of AI research projects (or the default) programming tools, in the field of artificial intelligence no other language can shake its leadership. Second, for the data operation with the table structure, the processing of the list head element (pair car part) is better recursive, but for many body elements (the part of the CDR of the pair), it is more efficient to use the iterative method.

When academician Stallman returned home, I first tried to use Emacs Lisp programming on a computer, which was an interpreter embedded in the GNU Emacs text editor. In the vast Lisp genealogy, Emacs Lisp is not Common Lisp, but a direct descendant of the early MacLisp, while simplifying and reinforcing in some ways. At the same time, I began to read Robert Chassell's "Introduction to Emacs Lisp programming", Robert Chassell, a Fellow of Stallman's early acquaintance, and one of the creators of the Free Software Foundation, who used it very early GNU Emacs, and using the Emacs Lisp program to customize GNU Emacs, Stallman a friendly way to introduce Robert Chassell to me. The book is a free document (which can be downloaded freely from the GNU website) and a publication of the Free Software Foundation (GNU Press). When I finished reading the book, I thought it was a wonderful book, and the author's writing was great (even for those who wanted to learn English writing, it should be a great help), and it was perfectly worthwhile to introduce the book to other people. I then found two translators (Dr. Mao Wentao and phasing), translated it into Chinese, and I worked as editor and reviewer of the book. Chinese version of the quality is very high, I am satisfied, it as a very great programming primer book is very suitable for the vast number of readers self-study (I think readers should get a read). I still want to translate the third edition of this book on my own, but now it's hard to find so much time to do editorial and proofreading work.

After reading this book, I realized that if I wanted to use Emacs Lisp to develop a non-toy-level practical application, according to the author's recommendation, the GNU Emacs Lisp Reference Manual, published by the Free Software Foundation, was an essential reference book, I printed the version 2.4 of this document, a total of four thick. The document was later formally published, and the books ordered from the GNU website were upgraded to version 2.6, for GNU Emacs version 21. I don't quite agree with Eric Raymond's comments on Emacs Lisp in his famous book The Art of Unix programming, who thinks that Emacs Lisp can only write control programs for the Emacs editor itself, rather than the other scripting languages. In fact, I think that as long as you are familiar with the details of Emacs Lisp, any other scripting language can be done using the Emacs Lisp program. I have seen Stallman in GNU Emacs to complete the editing, sending and receiving of e-mails, without Eric Raymond developing the Fetchmail program. I myself also used Emacs Lisp to write CGI applications, the effect is good.

Bob Glickstein once wrote a book "Writing GNU Emacs Extensions", which can be supplemented by Robert Chassell's book and the GNU Emacs Lisp Reference Manual.

After reading Robert Chassell's book, I began to take the time to read Dr. David Touretzky's "Common lisp:a Gentle Introduction to Symbolic Computation", a book that can be The Internet is free to download, and readers can get it on the World Wide Web on Google's own. This is also a great Lisp book, which is based on Common Lisp, but the author does not specifically emphasize this.  I printed the downloaded PDF file and bound the printed document paper into a two-volume manual. The biggest thing I've learned from this book is that I fully realize that everything in Lisp is an object: the number atom (numeric atoms) and the symbolic atom (symbolic atoms) are all objects. The numeric atomic evaluation returns its own value, while the symbol atom has the name (name), type, value (value), temperament table (plist), and binding table (Bindlist). These five fields can be placed in a data structure and expressed in C-language structs in the implementation.

While reading these materials, I found on the Internet a document written by Professor Gary Knott, "Interpreting Lisp," a document that is not long and has never been formally published. In this document, the author uses C language to write a tiny Lisp implementation, very close to the original Lisp implementation. The most valuable is that he will realize the source of the clean-up. From this book, I clearly saw how to construct the structure of Lisp objects, and I began to realize the importance of the memory garbage collection algorithm. Based on the understanding of the structure of the Lisp object introduced by Dr. David Touretzky, "Common lisp:a Gentle Introduction to symbolic computation", I understand the Lisp object pictured in the book If it is not enough to schedule five fields in the structure design only, you need to have a field for the garbage collection (gc,garbage ccollector) module operation.

During 2001-2002, I started to approach Scheme. Prior to this August 2000, Rorbert Chassell visited China, and when we were in Xian, he introduced me to Scheme as a language I should focus on. The Scheme was born in 1985 at MIT and has two inventors: one is Professor Gerald Sussman, one of the board members of the Free Software Foundation, and the other is Dr. Guy J.steele, who is about to be mentioned more. I first used Dorai Sitaram's textbook "Teaching Yourself Scheme in Fixnum days", which can be downloaded freely from the Internet, but frankly, the textbook is not suitable for beginners, People who read it should at least have a lot of basic knowledge or experience. I did not get too much help from this book, and I did not know the basic concept of Scheme, especially the concept of continuous (continuation). However, there are many harvests, and I realize that Scheme is a very graceful Lisp variant that inherits the characteristics of both ALGOL60 and early Lisp. At the end of the textbook, a specific programming example is given to teach how to use Scheme to write CGI programs. Now, in my opinion, in the fields of CGI programming, the wide application of scripting languages such as Perl and PHP is simply a loophole in the poor marketing of the Lisp community.

By the summer of 2001, I received a teacher's handbook from the United States "Structure and interpretation of computer Programs", my friend James Gray helped me buy, he was a good friend of mine, However, I would like to complain in good faith, he did some careless, I originally hoped he had to get me the book of the student's book, did not think he sent the teacher handbook, I think he bought the book without careful distinction, and the book's Teacher's manual and student book cover are used the same pattern, the author and MIT The editors of the publishing house were very good, they were very successful in marketing the book, and later they also opened a website to promote the book and related teaching materials, the online publication of the entire contents of the textbook, plus two authors in the classroom teaching video recording. The teacher Handbook was cheaper, James was either not carefully identified at the time of purchase, or helped me save money before sending the teacher's handbook. I did not have a student handbook, and I did not continue to study Scheme. But then again, the Teacher's handbook that James sent me has always been in my hands, and later on I have been very helpful in teaching Scheme in the hacker way, and I should be deeply grateful to James Gray.

Soon (2003), I bought a third edition of "Common Lisp" by Professor Patrick Winston, who was the director of the MIT AI Lab (Stallman was his soldier), and was very famous in the field of AI research in the United States, I just bought the book for his fame. After reading, I felt that the professor was a veritable, rather than a illusory of some of the people I had seen at home. This is an excellent textbook to introduce Common Lisp. Later Hans Hagen (one of the main authors of the ConTeXt typesetting software package) told me that the book co-author Berthold Klaus Paul Horn was also very famous in the TeX community, indeed, from the typesetting quality of this book can see a lot of things, typesetting style is a typical TeX style. As chairman of the Chinese TeX User Club (Ctug), I already know that few people in the domestic academic world (I mean math and computer science and technology) are proficient in the TeX typesetting system, and some people can use it to typeset their own handouts or books.

After reading this book, I felt I had to read Common Lisp's language Reference manual, and many questions had to be made clear after seeing the language specification (which is the basic yardstick). Guy L. Steele wrote this handbook, and he wrote it two times, the first version was done before the Common Lisp standardization, the second version was written after the normalization was completed, but someone on the web commented that some of the things that had to be written were not written, and whether the book would have a third edition unclear. Dr. Guy L. Steele is the author of a very well-known language handbook and has been successful in language reference manuals written in C, Common Lisp, Java and other programming languages, all of which are reprinted in a single edition and offer excellent sales, compared to the National Standardization Organization (ISO) in Switzerland, which publishes non- Often expensive standard documents sell a lot better. The language reference manuals he wrote have become the saviour of the authors of these language compilers.

At about the same time, I downloaded "on Lisp", an excellent book written by Dr. Paul Graham, from which I got the details of many Lisp concepts, especially the macro mechanism of Lisp, and how hackers use Lisp to think about problems. The author's introduction of the bottom-up (bottom up) methodology has touched me very much, and the author's explanation is very enlightening (the author has traveled to the Italian Academy of Fine Arts to study oil painting, so has a high artistic accomplishment). Since then, the idea of mixed programming (Hybrid programming) has begun to take shape in my mind, and I am convinced that Lisp will become a very long-lived programming language, which reminds me of the words of Stallman Academician in Sichuan Jiuzhaigou on the development of GNU Emacs. The implicit methodology behind GNU Emacs and Lisp is never outdated.

In 2004, I really found the sense of Lisp programming, felt myself getting into state, and started using Scheme to develop real applications, the program I wrote was a Web application, a Web message board (web-based Bulletin System), On the World Wide Web, CGI modules are written in scheme, and Apache is connected to the PostgreSQL database via scheme's CGI program on the server. I am using the 103 version of the PLT Scheme, I like this version very much, it is simple and clean, I wrote a DA (database adaptor) in C and PostgreSQL provided by LIBPG, so that the Scheme program can access the Post Gresql database.

After completing this project, the good things were double, I got the long-awaited "Structure and interpretation of Computer Programs" (referred to as SICP, or "purple book"), the author is Harold Abelson professor and Professor Gerald Sussman. It was this year that I began to take advantage of the mathematical ideas formed in my mind, especially the ideas expressed in my pan-scale theory, to study Scheme seriously and to understand the computational models of today's computer systems from the ancient Chinese yin-yang Taiji figure model. The process lasted for a long time until the winter of 2005 was finally successful! Many of the thoughts of this period have been written in my book, "Free software: New rules of the game", chapter II, "On the scale". In the future, I am going to spend more time to expand it, to form a book of books, "Pan-scale theory", in this booklet, I will use a longer space to the ancient Chinese philosophy, modern mathematical ideas and computer programming into one, the entire computational theory to put forward their own complete opinion. In the Hacker Road nine Dan, the first paragraph is to say "The essence of Computing", which included my thinking method and programming experience.

During 2004-2005, I carefully studied everything except the seventh chapter in the R5rs documentation, which was hugely rewarding. There was still some confusion about the contents of the seventh chapter, because the material needed to understand a lot of details about Lambda calculi and a lot of preparatory knowledge, and I didn't find enough material to delve into it. In addition, when studying the source code of the PLT Scheme, the memory garbage collection algorithm is still a big problem for me, obviously, I still need to learn more background material for the memory garbage collection technology.

By the end of 2005 years, I translated r5rs into Chinese. In completing the translation, I learned how to use formal language and extended Backus-Raul Paradigm (EBNF) to define the formal syntactic and semantic rules of a programming language, and how to properly understand and read it.

During 2005-2006, I studied a number of other books on LISP programming, including Dr. Paul Graham's ANSI Common Lisp, Matthew Flatt and others, "How to Design Programs", Bria n Harvey and Matthew Wright co-authored "Simply Scheme---Introducing computer science" (the book's cover design is ingenious, very memorable), Daniel Friedmann and Matt HIAs Felleisen co-authored "The Little schemer" and "the seasoned schemer". In addition, I spent a considerable amount of time reading the scheme programming Language, 3e, a masterpiece of Professor R. Dybvig, a Design Master of Chez Scheme. At the end of the year I got "Hackers and Painters" ("Hackers and Painters"), a collection of essays by Dr. Paul Graham, who, like Robert Chassell, was a great writer, and his writing was very easy to read, And the book's content, like its title subtitle, does have many great ideas that are very enlightening for innovative companies to develop innovative projects using LISP.

July 15, 2006, my student Junzhe from Seoul University in South Korea brought copies of two books he studied: "Scheme and the Art of programming" by George Springer and Daniel p. Friedman , and Mark Watson's "programming in Scheme:learn Scheme through Artificial Intelligence Programs". The difficulty of the previous book under the Purple Book, relatively good reading, many of them like games, showing a lot of advanced programming skills, it is worth thinking about, I immediately in the PLT scheme implementation of the most of the code to verify the book, the latter is how to use the MIT scheme to design AI programs, Very exciting.

In the summer of July 2006 after the Thousand Junzhe, I have been vacationing in Zurich, Switzerland (in late August I went to Madrid, Spain for the International Congress of Mathematicians), and the Central Library of Zurich (Zb,zentralbibliothek Zuerich) was a great library, The existing collection of 1.2 million kinds. It is said that Lenin came to Zurich when he was in exile in Europe and slept in the library to study. In the August, most of the Swiss were also on vacation, the library was very quiet and very few people. During this time I found a lot of background material from the library, including h.p. Barendregt's mathematical Classics, the LAMBDA calculus---its Syntax and Semantics, was published in 1981 by North Holland Publishing, a detailed introduction to this branch of mathematics, I think for this topic, no one can write better than this book. In addition, I found the first book on Lambda calculus, created by the founder of this theory, Alonzo Church, "The calculi of Lambda-conversion" is priceless, in this booklet, as a mathematician , the author clarifies the entire contents of the lambda calculi in a clear and concise manner. Anyone who wants to master lambda calculus should read the book carefully. In the library also found the "an Introduction to LMABDA calculi for computer scientists", the author is Chris Hankin. The programming Language and Lambda calculi, written by Matthias Felleisen and Matthew Flatt, are also printed and read two times, both of which are core members of the PLT Scheme research group. On the shelves of the Central library in Zurich, I also saw the first version of the SCIP Purple Book of the German text, the contents of the book and the second edition of the English version of the same, but I am acutely aware that the first version of the fourth chapter does not have the income of eval and apply the two higher-order operators form The Tai Chi hand chart, the second

I took the time to study the Lisp 1.5 Programmer's Manual, which is the first in the world to officially release the Lisp stable implementation version of the manual, the author is John McCarthy and other people, very academic authority, I think any Lisp programmer is should read this manual. After many years, I began to read the book on Artificial Intelligence, "Lisp, Lore and Logic" written by W Richard Stark, "Artificial Intelligence, Theory and practice" is Thoma S Dean and others have written that they have used Common Lisp to illustrate the problem. As I read, I refer to the classic textbook "Artificial Intelligence, 3e", written by Professor Partrick Winston, which has been mentioned earlier.

At the beginning of 2007, I began to focus on the R6RS in the scheme community, which would become the new scheme language specification. I still think that Common Lisp is too complex and too large to return to the factory overhaul seems unlikely, because industry has been well accepted Common Lisp, and Scheme will be the mainstream of the future. I began to develop my own scheme implementation version according to this specification, which is known as the MNM scheme.

From June 2007 to July, I printed r5.97rs in Campus Zollikerberg, Zurich, Switzerland, and I spent a lot of time understanding this new specification, especially its differences from the previous version (R5RS). At the same time, I re-pondered the source code implemented by the PLT Scheme and the features and implementation styles associated with modules (modules), namespaces (namespaces), box types, define-values, and other additions to the R5RS specification.

Another valuable book borrowed from the Central Library of Zurich was Garbage Collection, co-authored by Richard Jones and Rafael Lins, which helped me to understand the details of the design of the memory garbage collection algorithm. I began to really understand the last dark corner of Scheme implementation. For all Lisp objects, the algorithm design of memory garbage collection does not exist theoretically optimal algorithm, the efficiency of the algorithm is influenced by many factors, and Lisp designers can decide how to recycle the memory garbage according to their own design idea.

At this time I have grown into a skilled C + + programmer, stand in the C + + Programmer's standpoint, all Lisp objects have types, I can use the C + + language built-in class (class) to describe them (that is, declaring a variety of user-defined classes), all Lisp Objects have commonalities from the point of view of storage allocation and reclamation, so this can use C + + templates to express the storage management structure of Lisp objects, and the amount of storage space that each Lisp object occupies, You can use the class's constructors (constructor) and destructors (destructor) to perform uniform operations on memory allocation and memory garbage collection with the support of the template.

The GC developed from Lisp is an "old" technology, actually it has been widely adopted, Java is now a new business programming language, and Java's GC algorithm is very well designed, and I decided to refer to it in my Scheme implementation. On my flight from Hong Kong to Zurich in September 2007, I read the fourth edition of Thinking in Java, a famous American programmer, Bruce Eckel, and from the author's introduction, I combined the knowledge gained from the garbage Collection. I understood the general idea of Java's memory garbage collection algorithm and conceived how to use their algorithms to improve my design. And on the same day I left Zurich (September 26, 2007), all the editorial members of the R6RS Technical Committee decided to freeze the discussion on the draft, formally releasing the code, and from that date, the pace of my MNM Scheme was greatly accelerated. (However, please note that in the voting held by the Committee, many people voted against it and objected to it, and these views, together with their support, are of great value. )

There are many implementations of Scheme, and it is a good indicator to test the depth of academic accomplishment of a computer professional (this is one of the reasons why I have set the fifth paragraph's teaching content as "the principle and structure of the interpreter" in the hacker's path). The best scheme implementations so far have been: PLT scheme, MIT scheme, Chez scheme and so on. I think the PLT Scheme is a very good implementation version, it is released under the GPL free software, it is worth recommending to the vast number of readers here. To be polite, my MNM Scheme should also be counted as one.

Common Lisp has a lot of implementations, aside from commercial versions of Franz Lisp, the two most famous implementations of the free software community are: Bruno Haible, who has been maintaining and developing the Clisp since 1992, and Carnegie Mellon's team developing CMU Co Mmon Lisp. These two Common Lisp implementations are very good, I personally prefer to use Clisp. Currently the best Common Lisp programming book can recommend Peter Seibel wrote "Practical Common Lisp", the author of the talent is clearly higher than I, he was originally a Java and Perl programmers, 2004 years to learn Common Lisp , he spent a year to learn it, fully learned, and at the same time, while learning, while practicing, while writing books, the results are very fruitful, write this book is the reader can see the results, this book has been widely recognized, it was published in the United States publishing computer book creation of the Shock award. In an interview, he put forward a new argument: the development of The Times requires "second-generation LISP programmers", and every programmer should learn Lisp. (Let me recall again the words that academician Stallman said to me in 2000.) )

As the reader read above, it's not easy to be a programmer who knows everything about Lisp, but I'm happy because I've successfully crossed the threshold that seemed to be very high at the beginning, and I'm already a programmer. Learning Lisp has brought me great pleasure, and without this kind of fun in programming, I would never have spent so much time learning it. Today, I'm proud of myself, because I'm already a part of the second generation of good Lisp programmers, according to Peter Seibel's statement and measurement.

The above list of learning experience for the average person is obviously too long, the hacker students can stand on my shoulder, learn from my experience and lessons, less go a lot of detours, avoid the dead end of the road. Fortunately, I have been in the hacker course design consciously do a lot of work, who participated in the first paragraph of the Hacker Course Learning students (S1: "The Essence of Computing"), in a short period of time to learn to master Lisp.

How do you become a LISP programmer (GO)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

Tags Index: