{"size": 1352, "ext": "scrbl", "max_stars_repo_path": "doc/sagittarius/io.scrbl", "max_stars_repo_name": "david135/sagittarius-scheme", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "doc/sagittarius/io.scrbl", "max_issues_repo_name": "david135/sagittarius-scheme", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "doc/sagittarius/io.scrbl", "max_forks_repo_name": "david135/sagittarius-scheme", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 32.1904761905, "max_line_length": 76, "alphanum_fraction": 0.7159763314}
@; -*- mode:scribble; coding: utf-8; -*-

@subsection[:tag "sagittarius.io"]{(sagittarius io) - Extra IO library}

@define[Library]{@name{(sagittarius io)}}
@desc{This library provided extra IO related procedures.}


@define[Function]{@name{with-input-from-port} @args{port thunk}}
@define[Function]{@name{with-output-to-port} @args{port thunk}}
@define[Function]{@name{with-error-to-port} @args{port thunk}}
@desc{Calls @var{thunk}. During evaluation of @var{thunk}, the current input
port, current output port, current error port are set to @var{port},
respectively.
}

@define[Function]{@name{call-with-input-string} @args{str proc}}
@define[Function]{@name{call-with-output-string} @args{proc}}
@define[Function]{@name{with-input-from-string} @args{str thunk}}
@define[Function]{@name{with-output-to-string} @args{thunk}}
@desc{These utility functions are trivially defined as follows;

@codeblock{
(define (call-with-input-string str proc)
  (proc (open-input-string str)))

(define (call-with-output-string proc)
  (let ((port (open-output-string)))
    (proc port)
    (get-output-string port)))

(define (with-input-from-string str thunk)
  (with-input-from-port (open-input-string str) thunk))

(define (with-output-to-string thunk)
  (let ((port (open-output-string)))
    (with-output-to-port port thunk)
    (get-output-string port)))
}
}

