Lispを異ならせたもの
本文の状態
日本語全文を表示中
詳細モードで約5分の本文を読めます。
同じ出来事の情報源
この情報源を基点に整理
Paul Graham
1950年代後半にマッカーシーが設計したLispは、Fortranなどの既存言語から根本的に異なり、プログラミング言語の新たな可能性を示した。
Continue in AI NEW LAB
このニュースを、実務の判断につなげる
AI NEW LABで、試したことや先に確認したい条件を共有できます。まずはログインなしで読めます。
AI NEW LABで論点を見るSource Article
元記事を日本語で読む
本文に関係しない購読案内、埋め込み通知、サイト内プロモーションは除いています。


2001年12月 (2002年5月改訂) (この記事は、LL1メーリングリストでのいくつかの質問に応えて書かれたものです。現在は『Revenge of the Nerds』に組み込まれています。) 1950年代後半にマッカーシーがLispを設計したとき、それは既存の言語(最も重要なのはFortranでした)からの急進的な脱却でした。Lispは九つの新しいアイデアを体現していました: 1. 条件分岐。条件分岐はif-then-else構文です。今では当たり前のものと見なされていますが、これはマッカーシーがLispを開発する過程で発明したものです。(当時のFortranには、基本的なハードウェアの分岐命令に密接に基づいた条件付きgotoしかありませんでした。) アルゴル委員会のメンバーでもあったマッカーシーは、条件分岐をアルゴルに導入し、そこからほとんどの他の言語に広まりました。 2. 関数型。Lispでは、関数は第一級オブジェクトです。つまり、整数や文字列などと同様のデータ型であり、リテラル表現を持ち、変数に格納でき、引数として渡すことができます。 3. 再帰。もちろん再帰はLisp以前から数学的概念として存在していましたが、Lispはそれをサポートした最初のプログラミング言語でした。(これは、関数を第一級オブジェクトにすることに暗黙的に含まれていると言えるかもしれません。) 4. 変数の新しい概念。Lispでは、すべての変数は実質的にポインタです。型を持つのは値であって変数ではなく、変数の代入や束縛は、指し示す対象ではなくポインタをコピーすることを意味します。 5. ガベージコレクション。 6. 式で構成されるプログラム。Lispのプログラムは式の木構造であり、各式は値を返します。(一部のLispでは、式が複数の値を返すこともあります。) これは、式と文を区別するFortranとその後継言語のほとんどとは対照的です。この区別がFortranに存在したのは自然なことでした。なぜなら、(入力形式がパンチカードであった言語に当然のことながら) その言語は行指向だったからです。文をネストすることはできませんでした。したがって、数学を機能させるためには式が必要でしたが、他の何かに値を返させる意味はありませんでした。なぜなら、それを待つものは何もあり得なかったからです。この制限はブロック構造言語の登場でなくなりましたが、その時にはすでに手遅れでした。式と文の区別は定着していたのです。それはFortranからアルゴルへ、そして両方の子孫言語へと広まりました。言語が完全に式で構成されている場合、どのようにでも式を組み合わせることができます。(Arcの構文を使って) 次のどちらでも書けます: (if foo (= x 1) (= x 2)) または (= x (if foo 1 2)) 7. シンボル型。シンボルは文字列とは異なり、ポインタを比較することで等価性をテストできます。 8. シンボルの木構造を用いたコードの記法。 9. 言語全体が常に利用可能。読み込み時、コンパイル時、実行時の間に本質的な区別はありません。読み込み中にコードをコンパイルまたは実行でき、コンパイル中にコードを読み込みまたは実行でき、実行時にコードを読み込みまたはコンパイルできます。読み込み時にコードを実行することで、ユーザーはLispの構文を再プログラムできます。コンパイル時にコードを実行することはマクロの基礎です。実行時にコンパイルすることは、Emacsのようなプログラムで拡張言語としてLispを使用する基礎です。そして実行時に読み込むことで、プログラムはs式を使って通信できます。このアイデアは最近、XMLとして再発明されました。 Lispが最初に発明されたとき、これらすべてのアイデアは、1950年代後半に利用可能なハードウェアによって大きく支配されていた通常のプログラミング手法からは程遠いものでした。時が経つにつれて、一連の人気言語に体現されたデフォルトの言語は、徐々にLispに向かって進化してきました。 1-5は現在広く普及しています。 6は主流になりつつあります。Pythonには7の形式がありますが、それ用の構文はないようです。 8は(9とともに)Lispマクロを可能にするものですが、これまでLispにほぼ固有のままです。おそらくその理由は、(a) あのかっこ、あるいはそれと同等に悪い何かが必要であり、(b) もしその最後の力の増分を追加したなら、もはや新しい言語を発明したと主張することはできず、Lispの新しい方言を設計しただけだと言わざるを得なくなるからでしょう ;-) 現在のプログラマにとっては有用ですが、Lispを他の言語が採用した場当たり的な手段からの変異という観点で説明するのは奇妙なことです。それはおそらく、マッカーシーが考えていたことではないでしょう。LispはFortranの間違いを修正するために設計されたのではなく、計算を公理化しようとする試みの副産物として生まれたのです。



日本語訳 

原文を表示


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.



Japanese Translation 

今日のまとめ
AIデイリーブリーフで今日の重要ニュースをまとめ読み