Next: 8 InputPortクラス
Up: ソフトウェア特論 講義資料 JavaによるScheme言語処理系: Jscheme
Previous: 6 Macroクラス
Continuationクラスは,Procedureクラスの
サブクラスで,PrimitiveであるCall/CCが
applyされるところでそのインスタンスが作られます.
package jscheme;
/** @author Peter Norvig,
peter@norvig.com http://www.norvig.com
* Copyright 1998 Peter Norvig,
see http://www.norvig.com/license.html */
public class Continuation extends Procedure {
RuntimeException cc = null;
public Object value = null;
public Continuation(RuntimeException cc)
{ this.cc = cc; }
public Object apply(Scheme interpreter,
Object args) {
value = first(args);
throw cc;
}
}
generated through LaTeX2HTML. M.Inaba 平成18年5月6日