1

I'm trying to create a simple sicp-flavoured scheme script that outputs a single value:

$ cat test.scm 
#lang sicp
(+ 1 2 3)

When I run it with racket test.scm, it doesn't output the result ("6"). How should I be writing/running the script?

Community
  • 1
  • 1
planetp
  • 14,248
  • 20
  • 86
  • 160
  • Have you tried `(display (+ 1 2 3))` ? – Óscar López Jun 14 '16 at 21:02
  • @Óscar this almost works when I do `racket < test.scm`, but still outputs a lot of garbage. I need to output just the value. – planetp Jun 14 '16 at 21:07
  • Running `racket test.scm` on a file with that content prints `6` for me. What OS are you running and which version of Racket are you using? – Alexis King Jun 14 '16 at 21:13
  • "a lot of garbage" <- can you be more specific? – Óscar López Jun 14 '16 at 21:26
  • I have racket v.6.5 on an ArchLinux box. When I do `racket test.scm` I get: `racket test.scm standard-module-name-resolver: collection not found for module path: (submod sicp reader) collection: "sicp" in collection directories: /home/user/.racket/6.5/collects /usr/share/racket/collects ... [155 additional linked and package directories] context...: show-collection-err standard-module-name-resolver` – planetp Jun 14 '16 at 21:40
  • ..and `racket < test.scm` gives me: `Welcome to Racket v6.5. > stdin::1: read: #lang not enabled in the current context context...: /usr/share/racket/collects/racket/private/misc.rkt:87:7 > sicp: undefined; cannot reference undefined identifier context...: /usr/share/racket/collects/racket/private/misc.rkt:87:7 > 6>` – planetp Jun 14 '16 at 21:41

1 Answers1

1

The problem is deeper than it seems. The installation of the sicp module is incorrect, and/or the language configuration is wrong.

Try running the same code using DrRacket's GUI before running it from the command line. And try reinstalling the sicp module following the instructions in the documentation.

Óscar López
  • 232,561
  • 37
  • 312
  • 386