next up previous
Next: 2 Schemeの処理系 Up: ソフトウェア特論 講義資料 Scheme言語 Previous: ソフトウェア特論 講義資料 Scheme言語

1 Scheme言語

Scheme言語は,コンピュータ科学のソフトウェア教育の基礎科目として 取り上げられている言語ですが, emacslispやCommonLispとは以下のような部分が違っています.
  1. 変数と関数は同じ名前空間を用いている.たとえばcarという変数の値として関 数本体が定義されているため,carを変数として用いることができない.
  2. 動的バインディングをする変数はなく,レキシカル変数だけである.
  3. 関数フォームの関数名の所をも評価する.
  4. 引数パラメタの指定に &optional, &keyなどはないけれども,&restをも つ.
  5. return,block,go,throwなどのようにいろいろのものはないけれども, call/ccというものひとつでそれらを実現できるようになっている.
  6. 名前空間を分けるためにCommonLispではパッケージというシステムがあ るが,Schemeにはない.Scheme では,レキシカル変数でそれと同じような機構 を実現できる.
  7. 副作用のある関数名には!を付け,述語には?を付ける,というネーミング に統一性を持たせている.
たとえば,
> (list 'a 'b)

-> (a b)

> ((if (= (+ 1 1) 2) list cons)
    'a 'b)

-> (a b)
というようになります. 最初の例では,listの値を取ってくると関数本体に なるためその関数本体を引数の'a,'bを評価したものに 適用します. 次の例では,ifフォームの計算結果がlistを評価した ものつまり,listの関数本体になり,最初の例と同じになります. Scheme言語の世界的によく用いられているテキストと, 関連する文献をあげておきます.

@book{Scheme,
title = "Structure and Interpretation of
         Computer Programs",
author = "Harold Abelson and
          Gerald Jay Sussman and Julie Sussman",
publisher = "The MIT Press",
year = 1985}

@book{Scheme2,
title = "Structure and Interpretation of
         Computer Programs, Second Edition
       (和田英一訳,計算機プログラムの構造と解釈
       第二版, ピアソン,2000)",
author = "Harold Abelson and
          Gerald Jay Sussman and Julie Sussman",
publisher = "The MIT Press",
year = 1996}

@unpublished{CLinger91,
author = "William Clinger and Jonathan Rees",
title = "{Revised^4 Report on
          the Algorithmic Language Scheme}",
note = "",
publisher = "",
year = 1991}

@techreport{CLinger85,
author = "William Clinger, editor",
title = "{The revised revised report on Scheme,
          or an uncommon Lisp}",
number = "{AIM-848}",
institution = "{Massachusetts Institute of Technology,
                Artificial Intelligence Laboratory}",
year = 1985}


generated through LaTeX2HTML. M.Inaba 平成18年5月6日