Aviad
Aviad

Reputation: 3584

Racket | CLI with specific language

I'm trying to use the racket CLI to run a file but I need a specific language (pretty-big) features to be available and I'm struggling with that.

As far as I know, if I run $ racket <file_name> then it requires the file as a module. In order to do that, I need to add #lang <some_lang> at the top of my file, but I just can't find any equiv to #lang pretty-big. Any idea how to ask for pretty-big this way?

The other option, is to run the code in load-mode (from the racket CLI manual) but on this case I'm getting no results back which obviously isn't good.

Any suggestions? I know the solution to this will be super easy, just can't find it.

Upvotes: 0

Views: 445

Answers (1)

Ryan Culpepper
Ryan Culpepper

Reputation: 10643

A search of the Racket docs for "pretty big" turned up this result, which says that the module lang/plt-pretty-big corresponds to DrRacket's "Pretty Big" legacy language.

Unfortunately, putting

#lang lang/plt-pretty-big

at the top of your file won't work, because that module doesn't specify a reader. But you can tell it to use the usual S-expression reader by using the s-exp "meta-language" as follows:

#lang s-exp lang/plt-pretty-big

If you want Racket to print out the results of top-level expressions in your file, it looks like the lang/plt-pretty-big language still won't do it, and I don't think there's an easy fix. Consider porting the program to #lang racket, which has that behavior. Or add println around the things you want printed.

Upvotes: 1

Related Questions