Skip to content

Instantly share code, notes, and snippets.

@MiyamonY
Created November 9, 2019 15:53
Show Gist options
  • Save MiyamonY/7e79d6ba512c761f39bbd3055934f15d to your computer and use it in GitHub Desktop.
Save MiyamonY/7e79d6ba512c761f39bbd3055934f15d to your computer and use it in GitHub Desktop.
racket output port as string
#lang racket
(require racket/port)
(define (output-string)
(with-output-to-string
(thunk (displayln "ok"))))
(module+ test
(require rackunit)
(check-equal? (output-string) "ok\n"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment