textual-port?(3scm)

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

πŸ’– NAME πŸ’–

textual-port?, binary-port? β€” the little tests that check whether ports are textual or binary, bestie πŸ’…. Welcome to the textual-port?(3scm) page from the Scheme Programmer's Manual β€” this is your group chat for port vibes ✨.

πŸ“š LIBRARY πŸ“š

Grab the imports for your fave report flavor:

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

πŸͺ„ SYNOPSIS πŸͺ„

(binary-port? port)
(textual-port? port)

✨ DESCRIPTION ✨

Okay so textual-port? is the one that returns #t if port is textual, and returns #f otherwise πŸŽ€. And binary-port? returns #t if port is binary, and returns #f otherwise. That's literally it β€” just boolean energy, no cap.

R7RS tea: these procedures accept any kind of object πŸ‘€.

πŸŽ€ RETURN VALUES πŸŽ€

Returns a single boolean object. One little #t or #f, main character energy fr fr.

🌸 EXAMPLES 🌸

Vibe check in action:

(call-with-input-file "/dev/null" textual-port?)
   => #t

(binary-port? (open-bytevector-input-port #vu8(1 2 3)))
   => #t

πŸ¦‹ COMPATIBILITY πŸ¦‹

Some R7RS implementations may allow both binary and textual operations on ports πŸ¦‹. So a port can be lowkey versatile, but that's a may β€” keep that compatibility caveat in mind, bestie.

⚠️ ERRORS ⚠️

Heads up: 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 β€” passing the wrong number of arguments is an error. Implementations may signal an error, extend the procedure's domain of definition to include such arguments, or fail catastrophically πŸ’€

πŸ‘€ SEE ALSO πŸ‘€

Also see input-port?(3scm).

⭐ STANDARDS ⭐

R6RS, R7RS.

πŸ•°οΈ HISTORY πŸ•°οΈ

New in R6RS and new in R7RS. In R5RS and earlier reports, ports were conceptually textual.

🫢 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/.


πŸ’– source/version sign-off: Scheme Programmer's Manual, page textual-port?(3scm), dated 2021-06-25 β€” bye bestie, mwah! πŸ’–

πŸ“¦ where this page comes from