最近の更新 (Recent Changes)

2014-01-01
2013-01-04
2012-12-22
2012-12-15
2012-12-09

Wikiガイド(Guide)

サイドバー (Side Bar)

--
← 前のページに戻る

1. Closure Basicの実行方法

Closure Basicは、最新のデカルト言語の0.21.1バージョンから実行できます。 それよりも古いバージョンでは動作しないので語注意ください。 (0.21.0にもClosure Basicが含まれていますがバグがあり動作しません。0.21.0をDLした方には申し訳ありませんが、0.21.1またはそれより新しいバージョンをDLしてください。)

さて、以下のように実行します。


  descartes ClosureBasic プログラム

ファイルClosureBasicは、デカルト言語のパッケージの中の"example/ClosureBasic/ClosureBasic"にあります。

また、プログラムの例題が、パッケージの"example/ClosureBasic/test"ディレクトリの下にあります。

試しに、その中の一つfactor.cbsを実行してみましょう。

このプログラムfactor.cbsは、以下のような関数の定義と実行を行います。詳細については後の項で説明します。


fact = {fun (n)
        if n <= 1 then
                return 1
        else
                return n*fact(n-1)
        end
}

print fact(3)
print fact(5)
print fact(8)

実行結果を示します。


$ descartes ClosureBasic factor.cbs
Compiling...
Run
6
120
40320
result --
        <compile_run>
-- true