Skip to content

Commit

Permalink
crook
Browse files Browse the repository at this point in the history
  • Loading branch information
dvanhorn committed Nov 25, 2024
1 parent 791e785 commit f539fa5
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 36 deletions.
12 changes: 8 additions & 4 deletions evildoer/interp-io.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@
;; Interpret e with given string as input,
;; return value and collected output as string
(define (interp/io e input)
(parameterize ((current-output-port (open-output-string))
(current-input-port (open-input-string input)))
(cons (interp e)
(get-output-string (current-output-port)))))
(define result (box #f))
(define output
(with-input-from-string input
(λ ()
(with-output-to-string
(λ ()
(set-box! result (interp e)))))))
(cons (unbox result) output))

12 changes: 8 additions & 4 deletions extort/interp-io.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@
;; Interpret e with given string as input,
;; return value and collected output as string
(define (interp/io e input)
(parameterize ((current-output-port (open-output-string))
(current-input-port (open-input-string input)))
(cons (interp e)
(get-output-string (current-output-port)))))
(define result (box #f))
(define output
(with-input-from-string input
(λ ()
(with-output-to-string
(λ ()
(set-box! result (interp e)))))))
(cons (unbox result) output))

12 changes: 8 additions & 4 deletions fraud/interp-io.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@
;; Interpret e with given string as input,
;; return value and collected output as string
(define (interp/io e input)
(parameterize ((current-output-port (open-output-string))
(current-input-port (open-input-string input)))
(cons (interp e)
(get-output-string (current-output-port)))))
(define result (box #f))
(define output
(with-input-from-string input
(λ ()
(with-output-to-string
(λ ()
(set-box! result (interp e)))))))
(cons (unbox result) output))

12 changes: 8 additions & 4 deletions hoax/interp-io.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@
;; Interpret e with given string as input,
;; return value and collected output as string
(define (interp/io e input)
(parameterize ((current-output-port (open-output-string))
(current-input-port (open-input-string input)))
(cons (interp e)
(get-output-string (current-output-port)))))
(define result (box #f))
(define output
(with-input-from-string input
(λ ()
(with-output-to-string
(λ ()
(set-box! result (interp e)))))))
(cons (unbox result) output))

12 changes: 8 additions & 4 deletions hustle/interp-io.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@
;; Interpret e with given string as input,
;; return value and collected output as string
(define (interp/io e input)
(parameterize ((current-output-port (open-output-string))
(current-input-port (open-input-string input)))
(cons (interp e)
(get-output-string (current-output-port)))))
(define result (box #f))
(define output
(with-input-from-string input
(λ ()
(with-output-to-string
(λ ()
(set-box! result (interp e)))))))
(cons (unbox result) output))

12 changes: 8 additions & 4 deletions iniquity/interp-io.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
;; Interpret p with given string as input,
;; return value and collected output as string
(define (interp/io p input)
(parameterize ((current-output-port (open-output-string))
(current-input-port (open-input-string input)))
(cons (interp p)
(get-output-string (current-output-port)))))
(define result (box #f))
(define output
(with-input-from-string input
(λ ()
(with-output-to-string
(λ ()
(set-box! result (interp p)))))))
(cons (unbox result) output))

12 changes: 8 additions & 4 deletions jig/interp-io.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
;; Interpret p with given string as input,
;; return value and collected output as string
(define (interp/io p input)
(parameterize ((current-output-port (open-output-string))
(current-input-port (open-input-string input)))
(cons (interp p)
(get-output-string (current-output-port)))))
(define result (box #f))
(define output
(with-input-from-string input
(λ ()
(with-output-to-string
(λ ()
(set-box! result (interp p)))))))
(cons (unbox result) output))

12 changes: 8 additions & 4 deletions knock/interp-io.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
;; Interpret p with given string as input,
;; return value and collected output as string
(define (interp/io p input)
(parameterize ((current-output-port (open-output-string))
(current-input-port (open-input-string input)))
(cons (interp p)
(get-output-string (current-output-port)))))
(define result (box #f))
(define output
(with-input-from-string input
(λ ()
(with-output-to-string
(λ ()
(set-box! result (interp p)))))))
(cons (unbox result) output))

12 changes: 8 additions & 4 deletions loot/interp-io.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
;; Interpret p with given string as input,
;; return value and collected output as string
(define (interp/io p input)
(parameterize ((current-output-port (open-output-string))
(current-input-port (open-input-string input)))
(cons (interp p)
(get-output-string (current-output-port)))))
(define result (box #f))
(define output
(with-input-from-string input
(λ ()
(with-output-to-string
(λ ()
(set-box! result (interp p)))))))
(cons (unbox result) output))

0 comments on commit f539fa5

Please sign in to comment.