How to run REPL in command-line Racket with another language?

In DrRacket I can simply set #lang basic-demo-3, then in REPL say

> let x = 5
> print x
5

In command line I tried

racket -I basic-demo-3

but it doesn't work.

$ racket -I basic-demo-3
Welcome to Racket v8.7 [cs].
> let x = 5
; let: undefined;
;  cannot reference an identifier before its definition
;   in module: top-level
; [,bt for context]
> ; x: undefined;
;  cannot reference an identifier before its definition
;   in module: top-level
; [,bt for context]
> ; =: undefined;
;  cannot reference an identifier before its definition
;   in module: top-level
; [,bt for context]
> 5
>
1 Like

My understanding is that using a non sexp reader in the command-line REPL is a relatively new feature (https://docs.racket-lang.org/reference/interaction-info.html, added in Racket 8.3). So far, Rhombus (https://github.com/racket/rhombus-prototype/blob/master/rhombus/private/runtime-config.rkt) seems to be the only language that uses this feature.

Chance is that this basic-demo-3 doesn't support the command-line REPL.

Note that DrRacket REPL has the capability to support a non sexp reader if the language cooperates. So you might want to try that.

1 Like

But it supports: Beautiful Racket: Closing the loop: basic

Note that DrRacket REPL has the capability to support a non sexp reader if the language cooperates. So you might want to try that.

The same code works in DrRacket, but I cannot use DrRacket in text mode.

So far, Rhombus

Could you show, how to user Rhombus in text-mode Racket?

You can run racket -I rhombus after installing the rhombus-prototype package.