How to set language to htdp/bsl in REPL

917 Views Asked by At

I have the following htdp/bsl program saved as example.rkt:

#lang htdp/bsl
(+ 1 1)

When the above is run using racket example.rkt, the output is as expected (i.e. 2).

However, when I try to start an REPL with htdp/bsl as the language (racket -I htdp/bsl), the following error appears:

Welcome to Racket v6.3.
 default-load-handler: cannot open module file
  module path: (lib "htdp/bsl")
  path: /usr/share/racket/pkgs/htdp-lib/htdp/bsl.rkt
  system error: No such file or directory; errno=2
  context...:

This error does not appear when the language selected is typed/racket, for example.

Why does the error happen with htdp/bsl, and how do I correctly start an REPL with htdp/bsl as the language?

2

There are 2 best solutions below

1
On

Use

racket -I htpd/bsl/lang example.rkt

to start your program (tested with Racket version 6.3.0.1).

Also, consider updating to the current version of Racket (version 6.10).

0
On

As @soegaard said, the htdp languages really work best in DrRacket, which I highly recommend in this case. However, if you really do want a REPL outside of DrRacket (say if you are grading homework and want to make a shell script for it), then you can actually use ,enter to get a BSL repl. Say you have a BSL file called homework1.rkt, which says:

#lang htdp/bsl
"I'm a rebel"

Then what you can do is open up Racket in the files directory and enter the module. In this case you'll get something like:

$ racket
> ,enter "homework1.bsl"
"I'm a rebel"
homework1.bsl>

From here you are in a BSL repl that is very similar to the one in DrRacket.