flush-output-port(3scm)

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

πŸ’– flush-output-port πŸ’–

okay so this is the manual page for flush-output-port, straight from the Scheme Programmer's Manual. She flushes buffered data from a port to its sink, and honestly? iconic. πŸ’…

✨ NAME ✨

flush-output-port β€” flush buffered data from a port to its sink.

πŸ“š LIBRARY πŸ“š

bestie, import it from any of these depending on your standard:

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

πŸ¦‹ SYNOPSIS πŸ¦‹

(flush-output-port output-port)

🌸 DESCRIPTION 🌸

Flushes any buffered output from the buffer of output-port to the underlying file, device, or object. That's the whole job, and she does it slayfully. ✨

🧚 IMPLEMENTATION NOTES 🧚

Vicare Scheme

The standard output port is block buffered and it is not closed on exit. A manual flush is needed before exiting the program. So on Vicare, don't just dip before flushing β€” do the manual flush first, bestie. 🫢

πŸ’… RETURN VALUES πŸ’…

  • R6RS β€” Returns unspecified values.
  • R7RS β€” Returns an unspecified value.

πŸŽ€ EXAMPLES πŸŽ€

(display "Enter your name: ")
(flush-output-port (current-output-port))
(define name (get-line (current-input-port)))

πŸ”₯ APPLICATION USAGE πŸ”₯

Used to manually flush a port's internal buffers. The port is automatically flushed when the port is closed, so there is no need for a manual flush before closing a port. No extra flush needed before close, iykyk.

🌈 RATIONALE 🌈

Output ports are line buffered, block buffered or unbuffered. Buffering is typically good for performance, but sometimes applications need to write data immediately. Immediate vibes required? Flush her.

πŸ’€ COMPATIBILITY πŸ’€

No compatibility notes on this page β€” that section is literally empty. 🫢

😭 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.
  • &i/o-encoding (R6RS) β€” The port's transcoder is in raise mode and it encountered an invalid byte sequence.
  • &i/o-write (R6RS) β€” There was an I/O error during the write operation.
  • &i/o-port (R6RS) β€” This condition specifies the port object related to the &i/o-write condition.
  • 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 πŸ‘‘

call-with-port(3scm), close-port(3scm)

⭐ STANDARDS ⭐

R6RS, R7RS

πŸ¦‹ HISTORY πŸ¦‹

This procedure first appeared in R6RS as part of the reworked I/O system.

πŸ’– 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. sign-off details: source flush-output-port(3scm), date 2023-07-24, from the Scheme Programmer's Manual. byeee, mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from