[plt-scheme] Creating Executable

From: Jamie L. Raymond (raymond at ccs.neu.edu)
Date: Sat Sep 7 11:30:50 EDT 2002

Paulo J. Matos wrote:
> I've been checking and it's not just my program. Here it is what
> I've done in PLT-Scheme 202 running in Linux Slack Kernel 2.4.17
> (running binaries, not compiled in my system) with current
> language 'Pretty Big':
> I started Drscheme.
> I entered the following in the definitions window:
> (define double
>   (lambda (x) (* 2 x)))
> I've executed and checked in the interactions window:
>>(double 2)
> 4
> Ok, it's running fine.
> I've saved it in home dir as double.scm.
> Then I've clicked Scheme->Create Executable and it created a
> file named double which is executable.
> In bash:
> pdestroy at localhost:~$ ./double
> pdestroy at localhost:~$
> It was as if nothing happened.
> Any ideas?

The executable that gets created doesn't mimic a Read-Eval-Print loop, 
so you need to explicity print results to standard out for them to be 
displayed. You asked "How will it know which function to call when we 
run it?": all of the expressions get evaluated in the order that they 
appear, so if your double.scm looked like this:

(define double
   (lambda (x) (* 2 x))

(printf "~a~n" (double 2))

double would be bound to the lambda expression, then
it would be applied to 2 which results in 4 being handed to printf for 

Jamie Raymond

Posted on the users mailing list.