PDA

View Full Version : SCM scripts



Mr.Macdonald
January 9th, 2009, 05:45 AM
I want to write a Scheme script using the scm compiler, similar to a bash script or python script

jpkotta
January 9th, 2009, 07:41 AM
Get scm.

sudo aptitude install scm

Create a script file.

#!/usr/bin/env scm

(print "Hello world.")
(quit)

Make it executable and run it.

chmod +x hello.scm
./hello.scm

Mr.Macdonald
January 9th, 2009, 02:32 PM
Thank you, I didn't know you needed the (quit)

nvteighen
January 9th, 2009, 08:33 PM
Just a note: scm is a bit non-standard in a lot of stuff... take for example the 'print' procedure... But all Scheme implementations are rather that way, so, if you happen to deploy that code, you better state what implementation you used to write it...

(My FreeTruco is not Standard Scheme just because of MIT/GNU Scheme specific read-eval-print procedure... :()