Reputation: 119
I don't know how to display images in the terminal.
Here is a .rkt test script:
#lang racket
(require 2htdp/image)
(circle 10 "solid" "red")
Then, I do this in the terminal:
$ racket
Welcome to Racket v6.8.
> (enter! "test.rkt")
(object:image% ...)
"test.rkt">
So I'm getting (object:image% ...)
when I should be getting an image of a circle.
How can I get images to display in the terminal?
Upvotes: 4
Views: 875
Reputation: 93
I stumbled on this question recently as well. Tried many combinations of keywords searching online and finally found a working solution.
For example,
; this approach would NOT render the image
; start repl inside a terminal
$ racket -i
(require 2htdp/image)
(circle 5 "solid" "red")
; this approach would render the image in a canvas
; start repl inside a terminal
$ racket -i
(require 2htdp/image racket/gui/base (only-in pict show-pict))
(show-pict (circle 5 "solid" "red"))
Regarding the comment by @Alexis King, as far as I know, although iTerm2 could display image, it would not work inside a repl
. I could be wrong though and would be happy to know if there are alternatives out there.
I can finally use vim + tmux to play with racket now!
Upvotes: 4