Racket Scheme modules

worker.rkt

#lang racket

(provide
    make-worker
)

(define (make-worker n)
    (lambda ()  (set! n (+ n 1))  n) )

main.rkt

#!/usr/bin/env racket -t-

#lang racket

(require
    scheme
    "worker.rkt"
)

(provide main)

(define (print* . args)
    (for-each display args)
    (newline) )

(define (main argv)
    (let ( (w (make-worker 0)) )
        (print* "worker: " (w))
        (print* "worker: " (w))
        (print* "worker: " (w)) ) )

(main (current-command-line-arguments))

build.sh

#!/bin/sh
raco exe main.rkt

run as script

% ./main.rkt

build & run as binary

% ./build.sh
% ./main