Setting language with #lang in the REPL

后端 未结 3 1984
醉酒成梦
醉酒成梦 2021-02-04 03:48

I would like to set the language in the REPL on the fly, with #lang, not using \"-I\" command-line argument. But this gives me the error \"read: #lang not enabled i

3条回答
  •  猫巷女王i
    2021-02-04 04:12

    I had a really hard time wrapping my head around this using Racket & Geiser to go through SICP with #lang sicp. Finally figured it out. Based on all the good answers above, these are comments to remind myself of what to do and why:

    #lang sicp
    ;;C-c C-a loads #lang module into REPL (save before loading)
    ;;C-u C-c C-z is faster than C-c C-a
    ;;https://docs.racket-lang.org/sicp-manual/index.html
    ;;https://stackoverflow.com/questions/21008623/setting-language-with-lang-in-the-repl
    (#%require sicp-pict)
    (paint einstein)
    

    Racket and Geiser are two amazing pieces of software, almost gave up but it was worth the effort to get this working. Thanks to all for the good work and helping us learn.

提交回复
热议问题