0

Is it possible to run smoothly files saved by DrRacket?

for example if I save the following lines in a file called test.rkt with DrRacket and want to run it with emacs. How would I do this?

(require lang/htdp-intermediate)

; this is a test ; and a box comment-out with a box

;example
(check-expect (doubleN 2) 4)

;define
(define (doubleN nat)
(* 2 nat))

(doubleN 4)
DJJ
  • 2,481
  • 2
  • 28
  • 53

1 Answers1

1

The steps are:

  1. Install geiser in emacs following the instructions on the Geiser website.

  2. Open the file test.rkt in emacs.

  3. Geiser mode should be active. If not use M-x geiser-mode and follow the prompts.

  4. Press C-c C-a to start/enter the REPL and load test.rkt as the module.

  5. If you make changes to test.rkt in its emacs buffer, save the changes with C-x C-s before reloading the module into the REPL with C-c C-a.

ben rudgers
  • 3,647
  • 2
  • 20
  • 32
  • Thanks for the tip. I did everything in the list and it works... only the first time. It seem that I cannot the above code twice. as it tells: doubleN: this name was defined previously and cannot be re-defined. – DJJ Feb 10 '15 at 20:39
  • @DJJ The issue may be related to using `lang\htdp-intermediate` because of module definitions. The student language may not behave as Geiser expects on the reload since it does not have the `#lang` reader syntax. – ben rudgers Feb 10 '15 at 20:57
  • I removed but (require lang/htdp-intermediate), the problem persists. – DJJ Feb 10 '15 at 21:23
  • @DJJ Do you have #lang racket` at the top of the file? Have you restarted emacs? – ben rudgers Feb 11 '15 at 00:13