MzScheme:MzLib

MzScheme:MzLib

http://download.plt-scheme.org/doc/205/html/mzlib/index.htm

libは

> (current-library-collection-paths)
("C:\\Documents and Settings\\Imazu\\Application Data\\PLT Scheme\\205\\collects" "C:\\Program Files\\plt\\collects")
>

の中のmzlibから呼ばれる

process.ss

(require (lib "process.ss")) で使用可能となり

C:\Documents and Settings\Imazu>mzscheme
Welcome to MzScheme version 205, Copyright (c) 1995-2003 PLT
> (require (lib "process.ss"))
> (system "dir")
 ドライブ C のボリューム ラベルは IBM_PRELOAD です
 ボリューム シリアル番号は F0A9-BDBC です

 C:\Documents and Settings\Imazu のディレクトリ

2003/09/02  18:45    <DIR>          .
2003/09/02  18:45    <DIR>          ..
2003/08/27  18:21    <DIR>          Favorites
2003/08/21  12:54    <DIR>          My Documents
・・・・
#t
>
> (getenv "HOMEPATH")
"\\Documents and Settings\\Imazu"

等が実行できたりします。

date.ss

C:\Documents and Settings\Imazu>mzscheme
Welcome to MzScheme version 205, Copyright (c) 1995-2003 PLT
> (require (lib "date.ss"))
> (date->string (seconds->date (current-seconds)))
"Friday, September 5th, 2003"
> (current-seconds)
1062754361
> (julian/scalinger->string (date->julian/scalinger (seconds->date (current-seconds))))
"JD 2 452 888"
>

trace.ss

C:\Documents and Settings\Imazu>mzscheme
Welcome to MzScheme version 205, Copyright (c) 1995-2003 PLT
> (require (lib "trace.ss"))
> (trace expt)
(expt)
> (expt 2 4)
|(expt 2 4)
|16
16
> (define (f x n) (if (= n 0) 1 (* x (g x (- n 1)))))
> (define (g x n) (if (= n 0) 1 (+ x (f x (- n 1)))))
> (trace f)
(f)
> (trace g)
(g)
> (f 2 5)
|(f 2 5)
| (g 2 4)
| |(f 2 3)
| | (g 2 2)
| | |(f 2 1)
| | | (g 2 0)
| | | 1
| | |2
| | 4
| |8
| 10
|20
20
> (untrace g)
(g)
> (f 2 5)
|(f 2 5)
| (f 2 3)
| |(f 2 1)
| |2
| 8
|20
20
>

MzScheme, Scheme

More ...