2009/09/20
SICPのSchemeコード
書こうと思ってたネタなんだけど別のところ で書いたのでこっちに転記。
SICP is a really good book to learn what is abstraction in programing, but keep in mind that it intentionally uses very limited range of features of actual Scheme to achieve its goal---here by "actual Scheme" I mean Scheme that is used to write real programs. Some people seem to get an impression from SICP that Scheme is minimalistic and you have to write your own structure or object abstraction using cons cells and closures, and conclude it is not a practical language you can use in your jobs.
Any modern Scheme implementation, in which you can write code at work, consists of not only the standard core language (RnRS) but also a large body of SRFIs (a kind of common libraries) and implementation's extensions. Unfortunately the extension part is fragmented among implementations, but in general, any decent implementation is far from "minimalistic" and comes with rich tools. SICP tells that Scheme allows you to make your own abstraction, but that doesn't mean you have to make ones every time.
「SICPはSchemeを学ぶ本ではない」という理由はこれね。プログラミング言語についての 説明を最小限に止めたいためにSchemeを使ってるのだから、Schemeの機能のうちでも 説明に必要な最小限の機能しか出てこないよ、ということ。
もちろんその最小限の機能を組み立てて色々できちゃう、ってところが醍醐味で、 それは知ってないとならないんだけれど、現場のSchemeコードを書く時も 小さなコアから全部自分で組み立てるなんてことはしないってこと。
Tags: Programming, Scheme