레이블이 Lisp인 게시물을 표시합니다. 모든 게시물 표시
레이블이 Lisp인 게시물을 표시합니다. 모든 게시물 표시

2015년 10월 10일 토요일

(E+K)What Made Lisp Different


What Made Lisp Different

December 2001 (rev. May 2002)

(This article came about in response to some questions on the LL1 mailing list. It is now incorporated in Revenge of the Nerds.)


When McCarthy designed Lisp in the late 1950s, it was a radical departure from existing languages, the most important of which was Fortran.

처음 시작은 기존 언어에 대한 반발로 일어나게 되었다.


Lisp embodied nine new ideas:

1. Conditionals. A conditional is an if-then-else construct. We take these for granted now. They were invented by McCarthy in the course of developing Lisp. (Fortran at that time only had a conditional goto, closely based on the branch instruction in the underlying hardware.) McCarthy, who was on the Algol committee, got conditionals into Algol, whence they spread to most other languages.

2. A function type. In Lisp, functions are first class objects-- they're a data type just like integers, strings, etc, and have a literal representation, can be stored in variables, can be passed as arguments, and so on.

3. Recursion. Recursion existed as a mathematical concept before Lisp of course, but Lisp was the first programming language to support it. (It's arguably implicit in making functions first class objects.)

4. A new concept of variables. In Lisp, all variables are effectively pointers. Values are what have types, not variables, and assigning or binding variables means copying pointers, not what they point to.

5. Garbage-collection.

6. Programs composed of expressions. Lisp programs are trees of expressions, each of which returns a value. (In some Lisps expressions can return multiple values.) This is in contrast to Fortran and most succeeding languages, which distinguish between expressions and statements.

It was natural to have this distinction in Fortran because (not surprisingly in a language where the input format was punched cards) the language was line-oriented. You could not nest statements. And so while you needed expressions for math to work, there was no point in making anything else return a value, because there could not be anything waiting for it.

This limitation went away with the arrival of block-structured languages, but by then it was too late. The distinction between expressions and statements was entrenched. It spread from Fortran into Algol and thence to both their descendants.

When a language is made entirely of expressions, you can compose expressions however you want. You can say either (using Arc syntax)

(if foo (= x 1) (= x 2))

or

(= x (if foo 1 2))

7. A symbol type. Symbols differ from strings in that you can test equality by comparing a pointer.

8. A notation for code using trees of symbols.

9. The whole language always available. There is no real distinction between read-time, compile-time, and runtime. You can compile or run code while reading, read or run code while compiling, and read or compile code at runtime.

Running code at read-time lets users reprogram Lisp's syntax; running code at compile-time is the basis of macros; compiling at runtime is the basis of Lisp's use as an extension language in programs like Emacs; and reading at runtime enables programs to communicate using s-expressions, an idea recently reinvented as XML.

When Lisp was first invented, all these ideas were far removed from ordinary programming practice, which was dictated largely by the hardware available in the late 1950s.

Over time, the default language, embodied in a succession of popular languages, has gradually evolved toward Lisp. 1-5 are now widespread. 6 is starting to appear in the mainstream. Python has a form of 7, though there doesn't seem to be any syntax for it. 8, which (with 9) is what makes Lisp macros possible, is so far still unique to Lisp, perhaps because (a) it requires those parens, or something just as bad, and (b) if you add that final increment of power, you can no longer claim to have invented a new language, but only to have designed a new dialect of Lisp ; -)

Though useful to present-day programmers, it's strange to describe Lisp in terms of its variation from the random expedients other languages adopted. That was not, probably, how McCarthy thought of it. Lisp wasn't designed to fix the mistakes in Fortran; it came about more as the byproduct of an attempt to axiomatize computation.

(E+K)The Roots of Lisp

May 2001

(I wrote this article to help myself understand exactly what McCarthy discovered. You don't need to know this stuff to program in Lisp, but it should be helpful to anyone who wants to understand the essence of Lisp-- both in the sense of its origins and its semantic core. The fact that it has such a core is one of Lisp's distinguishing features, and the reason why, unlike other languages, Lisp has dialects.)

나는  Lisp 을 만든  McCathy 가 Lisp 통해 실현하고자 하는 내용을 명확히 이해하기 위하여 이 사설을 정리한다. Lisp 프로그래밍을 하기위하여 그 내용을 꼭 알 필요는 없다. 하지만 Lisp 의 정수를 이해 한다면 유용할 것이다 -- 기원에 대한 이해와 의미를 이해하는 것. Lisp 만의 특징들과 다른언어와 달리 방언들이 많이 있는 것


In 1960, John McCarthy published a remarkable paper in which he did for programming something like what Euclid did for geometry. He showed how, given a handful of simple operators and a notation for functions, you can build a whole programming language. He called this language Lisp, for "List Processing," because one of his key ideas was to use a simple data structure called a list for both code and data.
1960 에 McCarthy 는 유클리드가 기하학에 한 것과 동일한 수준의 일에 대한 논문을 발표 하였다. 그는 간단한 오퍼래이터와 표기법 들로 새로운 언어를 만들 수 있도록 했다. 그리고 Lisp이라고 불렀는데 이는  List Processing 이라는 뜻이다.왜냐하면 Code 와 Data를 모두 list로 사용하는 것이다.

It's worth understanding what McCarthy discovered, not just as a landmark in the history of computers, but as a model for what programming is tending to become in our own time. It seems to me that there have been two really clean, consistent models of programming so far: the C model and the Lisp model. These two seem points of high ground, with swampy lowlands between them. As computers have grown more powerful, the new languages being developed have been moving steadily toward the Lisp model. A popular recipe for new programming languages in the past 20 years has been to take the C model of computing and add to it, piecemeal, parts taken from the Lisp model, like runtime typing and garbage collection.
McCarthy가 한 일을 이해하는 것은 가치가 있다,  단지 그가 한 것을 확인하는 것 뿐만이 아니라, 프로그래밍이 우리에게 어떤 영향을 주는지도 확인할 수 있다. 지금까지 프로그래밍에는 정말 분명하고, 대표격인 모델이 있다.C와 Lisp 이다. C -> Lisp 방향으로 진화해 가고 있다. runtime typing이나 garbage collection 이 그 예이다.


In this article I'm going to try to explain in the simplest possible terms what McCarthy discovered. The point is not just to learn about an interesting theoretical result someone figured out forty years ago, but to show where languages are heading. The unusual thing about Lisp-- in fact, the defining quality of Lisp-- is that it can be written in itself. To understand what McCarthy meant by this, we're going to retrace his steps, with his mathematical notation translated into running Common Lisp code.
이 사설에서는 McCarthy가 이야기 하고자 하는 것을 정말 간단하게 설명하고자 한다. 40년 전에 누군가가 이론적으로 만들어 놓은 결과물을 배우는 것이 아니라, 컴퓨터 언어 자체가 어디를 향하고 있는 지에 대한 이야기 이다. Lisp의 특이한 점은--Lisp의 수준--그 자신 안에 또 자신을 쓸 수 있다는 것이다. 이 얘기가 무슨 이야기 인지 이해하기 위하여 McCarthy 가 걸어갔던 길을 따라 가 보자, 수학적으로 표기된 것을  Common Lisp 으로 구현하고 실현시켜 보는 것이다.

(E+K)What is Lisp - Table of Contents

understanding the essense of Lisp should be done before actual coding. read, translate, understand at the same time.
Lisp 언어(List Prcessing) 를 익히기 위하여 정리하는 글이며, 프로그래머 폴그레이엄이  Lisp 의 의미를 정리한 글을 읽으면서 개념을 먼저 익히려고 한다.

 

Lisp(전체 목차)

The Roots of Lisp
What Made Lisp Different
A Lisp Startup
Arc: A New Lisp
Lisp Code
Lisp Links
Lisp History
Lisp Quotes
Lisp FAQ