How to get Scheme to work

Hi - I’m new to replit and am tyring to get Scheme code to run. I must be missing something, because when I run a few simple commands:

(print "What's your name?")
(print "Hello, " (read) "!")

I get following output in the console:

 guile --no-auto-compile -l .init.scm -l main.scm
Backtrace:
           3 (primitive-load "/home/runner/Test-Scheme/main.scm")
In ice-9/eval.scm:
   191:27  2 (_ #f)
   223:20  1 (proc #<directory (guile-user) 7f89296f9c80>)
In unknown file:
           0 (%resolve-variable (7 . print) #<directory (guile-user)…>)

ERROR: In procedure %resolve-variable:
Unbound variable: print
exit status 1

Any ideas on how to resolve this?
Thanks!

1 Like

AFAIK the function to print in Scheme is display or write , not print. And the function to read a line from the console is read-line , not read .

(display "What's your name?\n")
(define name (read-line))
(display "Hello, ")
(display name)
(display "!\n")
2 Likes

Thanks - but even simple operations aren’t working:

(+ 2 3)
(* 3 5)

etc.

try (display (+ 2 3))

you have to wrap it in parenthesis if you’re not already doing that.

Apparently it uses something called Guile.

4 Likes