2008.7.4  

MacBookで、生まれてはじめてのScheme  

昨日SICP読書会というものに参加をし、生まれてはじめてSchemeに触れてきました。

今回は扱いやすいGaucheというScheme処理系を使いました。

Gauche(ゴーシュ)は、スクリプトインタプリタとしての使い易さに重点を置いて開発を行っているR5RS準拠のScheme処理系です。

*Gauche – A Scheme Interpreter より引用:

http://practical-scheme.net/gauche/index-j.html

インストール方法 (MacPortsによるインストール)

MacPortsでインストールが非常に簡単にできます。

[sourcecode language=”bash”]
$ sudo port install gauche gauche-readline
[/sourcecode]

port コマンドがないよ!って言われる場合

~/.bashrcか~/.bash_profileに下記を追記。

[sourcecode language=”bash”]
export PATH=/opt/local/bin:/opt/local/sbin/:$PATH
[/sourcecode]

source ~/.bashrcで実行しパスを通す。

[sourcecode language=”bash”]
$ source ~/.bashrc
[/sourcecode]

Gaucheの起動

ターミナル上でgosh ,または gosh-rlと入力します。

[sourcecode language=”bash”]
$ gosh-rl
[/sourcecode]

gosh-rlとするとgosh>とプロンプトの対話的なものが立ち上がります。

[sourcecode language=”bash”]
gosh> (+ 3 4)
7
[/sourcecode]

Gaucheの終了

exitだけだと認識してくれません。(exit)で終了します。

[sourcecode language=”bash”]
gosh> (exit)
[/sourcecode]

ファイルで作成した場合の拡張子

ファイル名.scm で保存し、以下のシェルを叩くと実行できます。

[sourcecode language=”bash”]
$ gosh ファイル名.scm
[/sourcecode]

計算機プログラムの構造と解釈
Gerald Jay Sussman Julie Sussman Harold Abelson

計算機プログラムの構造と解釈
ピアソンエデュケーション 2000-02
売り上げランキング : 29951

おすすめ平均 star
star食わず嫌いでした。
starプログラマにとって必読の本です
starこの第2版の日本語訳は大変よくない

Amazonで詳しく見るby G-Tools

0 Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
(c) 2024 Heart Beat | powered by WordPress with Barecity