current-input-port(3scm)

πŸ“¦ version 0-unstable-2024-02, in nixpkgs unstable

okay so bestie, welcome to current-input-port(3scm) β€” a page straight outta the Scheme Programmer's Manual, and it's literally about grabbing the current (default) ports. It's giving tiny-but-mighty, no cap. πŸŽ€


🌸 NAME 🌸

  • current-input-port, current-output-port, current-error-port β€” get the current (default) ports.

πŸ“š LIBRARY πŸ“š

(import (rnrs))                     ;R6RS
(import (rnrs io ports))            ;R6RS
(import (rnrs io simple))           ;R6RS
(import (scheme r5rs))              ;R7RS
(import (scheme base))              ;R7RS

✨ SYNOPSIS ✨

(current-input-port)
(current-output-port)
(current-error-port)

πŸ’– DESCRIPTION πŸ’–

These return default textual ports for regular input, output, and error output. Normally, these default ports are associated with standard input, standard output, and standard error, respectively.

The return value of current-input-port and current-output-port can be dynamically re-assigned using with-input-from-file(3scm) and with-output-to-file(3scm) respectively.

A port returned by one of these procedures may or may not have an associated transcoder; if it does, the transcoder is implementation-dependent.

R7RS β€” These procedures are parameter objects, which can be overridden with parameterize(7scm).

πŸ› οΈ IMPLEMENTATION NOTES πŸ› οΈ

Standard input, output, and error ports are concepts in general purpose operating systems. The implementation should hook these ports up to whatever standard I/O mechanism is provided by the operating system, if any.

πŸ’€ The error port should usually be unbuffered so that no output is lost if the program exits unexpectedly. iykyk.

🎁 RETURN VALUES 🎁

These procedures return a single value; a port. βœ…

πŸ§ͺ EXAMPLES πŸ§ͺ

(display "There was an error.0 (current-error-port))

🫢 COMPATIBILITY 🫢

R7RS defines these procedures as parameters. They are likely to internally be some form of parameters in all implementations, however, because of how with-input-from-file(3scm), etc, works. But one cannot expect to portably use them as parameters outside of R7RS.

😭 ERRORS 😭

This procedure can raise exceptions with the following condition types:

  • &assertion (R6RS) β€” The wrong number of arguments was passed or an argument was outside its domain.
  • R7RS β€” The assertions described above are errors. Implementations may signal an error, extend the procedure's domain of definition to include such arguments, or fail catastrophically.

πŸ‘€ SEE ALSO πŸ‘€

🌈 STANDARDS 🌈

R4RS, IEEE Scheme, R5RS, R6RS, R7RS.

πŸ‘‘ HISTORY πŸ‘‘

The current-error-port procedure first appeared in R6RS. The other procedures are standard since R2RS.

πŸ’œ AUTHORS πŸ’œ

This page is part of the scheme-manpages project. It includes materials from the RnRS documents. More information can be found at https://github.com/schemedoc/manpages/.


okay that's the whole page, bestie! πŸ’… cute little sign-off: this is current-input-port(3scm), dated 2023-02-21, from the Scheme Programmer's Manual β€” now go forth and read your ports 🫢✨

πŸ“¦ where this page comes from