Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you run a scheme program in the terminal of Ubuntu?

Tags:

ubuntu

scheme

I have searched and I really can't seem to find this really basic question. I am new to mit-scheme and essentially I want to recreate hello world but instead of doing it through the prompt, I want to have a scheme file that contains the following code:

 (define hello-world
 (lambda ()
     (begin
        (write 'Hello-World)
        (newline)
        (hello-world))))

The problem is I am missing the simplest questions: What is the file extension for a scheme file? How do I run that file through scheme?

I have tried .ss and .scm but every time I try scheme hello-world.scm it says:

;Warning: Invalid keyword: "hello-world.scm"

;Warning: Unhandled command line options: ("hello-world.scm")
like image 274
War Gravy Avatar asked Sep 24 '14 04:09

War Gravy


Video Answer


1 Answers

Your issue isn't the file extension, it's just that MIT Scheme prints an error if invoked as scheme hello-world.scm, since it's supposed to be invoked as

scheme --load hello-world.scm

Also, note that you are using a left-quote character rather than the actual quote character '. If you look closely you can see the difference.

like image 127
Lily Chung Avatar answered Oct 05 '22 07:10

Lily Chung