Джаваскрипт ближе к лиспу
Сам эту дурь придумал или прочитал где?
Крокфорд научил, а шо?
Хорошо, что Крокфорд не знает, что он тебя этому научил.
Джаваскрипт не имеет к лиспу никакого отношения. От слова вообще.
The Little Schemer
In 1974, Daniel P. Friedman published a little book called The Little LISPer. It was only 68 pages, but it did a remarkable thing: It could teach you to think recursively. It used some pretend dialect of LISP (which was written in all caps in those days). The dialect didn't fully conform to any real LISP. But that was ok because it wasn't really about LISP, it was about recursive functions. You didn't need a computer in order to work through the exercises. After reading the book, I was changed. In a good way. There are very few books that deeply change the way that you think. This is one of those books.
The format is a programmed text with questions on the left side and answers on the right. The way you use it is to read a question, think about the question, come up with an answer, and then compare your answer to Friedman's answer.
He used the names of foods as the symbols that are manipulated by your functions, and little jokes were scattered around to pull you back when things get so deep that your head is going to pop off. It even has a place reserved for JELLY STAINS!
The book has been through several revisions. The latest, The Little Schemer (Fourth Edition), updated by Friedman and Matthias Felleisen, now conforms more closely to a real programming language, Scheme, and has new chapters which delve much deeper into recursive function theory and language processors.
Felleisen is not as comfortable with the programmed text format, so instead of questions and answers, he has a deranged dialog going on which reads a little like Sméagol and Gollum discussing (quote (fishes)).
The Little Schemer is not a complete book on programming. It is weak in practical concerns like documentation, defensive programming, and computational efficiency. The development of a system of arithmetic from three primitives is delightful from a mathematical perspective and shockingly horrible from an engineering perspective.
It also will not teach you very much about Scheme. It touches on only a very small part of the language: a very good part.
Despite its flaws, the book has a very loyal following and that is because it works. It teaches one thing, a thing that is very difficult to teach, a thing that every professional programmer should know, and it does it really well. These are lessons that stick with you. You need to grab a sandwich and study this book.
The final chapter of The Little Schemer is a Little Scheme interpreter, capable of evaluating most of the expressions in the book. I made a couple of modifications.
I added the define function, which allows you to enter all of the Scheme functions and run them.
It runs in a web page, so you can execute your Scheme programs in any web browser. Just type your well-formed functions into the input box, press the big fat eval button, and see the result in the output box.
This interpreter was not designed for speed or reliability, so don't lean on it too hard. But it is responsive, and it is a good companion to the book.
(define l (quote (((hotdogs))(and)(pickle)relish) ))
(car (car l))
Use the define and quote functions to enter the s-expressions.