Log in Page Discussion History Go to the site toolbox

Procedure-on-disk-demo --mike b

From BluWiki

;; filename
(define f1 "procedure-to-disk-data.scm")

;; delete old
(if (file-exists? f1)
    (delete-file f1))

;; open file as new port
(define outport (open-output-file f1))

;; write a function to disk
(write '(define (catfood x) (display "hairball")) outport)
(newline outport)
(close-output-port outport)

;; load the file as a scheme file and call the function
(load f1)
(catfood 10)

Site Toolbox:

Personal tools
GNU Free Documentation License 1.2
This page was last modified on 19 December 2007, at 07:14.
Disclaimers - About BluWiki