Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

procedure requested: string-output-port? #772

Closed
WillClinger opened this issue Jun 28, 2016 · 1 comment
Closed

procedure requested: string-output-port? #772

WillClinger opened this issue Jun 28, 2016 · 1 comment

Comments

@WillClinger
Copy link
Member

As Ken Dickey said: "It would be useful to test an output-port to see if get-output-string can be applied."

That procedure is defined in src/Lib/Common/stringio.sch but isn't available at the R5RS top level.

This temporary workaround is extremely representation-dependent and might break in future versions of Larceny, but it works in v0.99:

(import (primitives vector-like-ref))

(define port.iodata 7)    ; ouch

(define (string-output-port? port)
  (and (output-port? port)
       (let ((d (vector-like-ref port port.iodata)))
         (and (vector? d)
              (> (vector-length d) 0)
              (eq? (vector-ref d 0) 'string-output-port)))))
@WillClinger
Copy link
Member Author

Accomplished by changeset 0cec8f6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant