textual-port?(3scm)
π 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
- nixpkgs unstable: scheme-manpages 0-unstable-2024-02-11
- π the page's license: MIT
- Copyright (c) 2021 Gwen Weinholt
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms