Error: during expansion of (import ...) - module unresolved: sutils pasted by ubot2xyzw2008 on Sat Oct 17 04:46:11 2015
I am trying to import this module from the REPL. I got the error below. Any clues ??? The functions works in the REPL when copied and pasted, however it doesn't work when define in the module. $ rlwrap -c --remember csi -p '(import sutils)' Warning: reference to possibly unbound identifier `with-input-from-string' in: Warning: str->sexp Warning: reference to possibly unbound identifier `call-with-output-string' in: Warning: sexp->str Error: during expansion of (import ...) - module unresolved: sutils Call history: <syntax> [sexp->file] (##core#begin (close-output-port out)) <syntax> [sexp->file] (close-output-port out) <syntax> [sexp->file] (##core#undefined) <syntax> (define (file->sexp filename) (define in (open-input-file filename)) (define sexp (read in)) (begin ... <syntax> (##core#set! file->sexp (##core#lambda (filename) (define in (open-input-file filename)) (define sex...... <syntax> (##core#lambda (filename) (define in (open-input-file filename)) (define sexp (read in)) (begin (clo...... <syntax> [file->sexp] (##core#let ((in (##core#undefined)) (sexp (##core#undefined))) (##core#set! in (open-input-file fil...... <syntax> [file->sexp] (##core#begin (##core#set! in (open-input-file filename)) (##core#set! sexp (read in)) (close-input-...... <syntax> [file->sexp] (##core#set! in (open-input-file filename)) <syntax> [file->sexp] (open-input-file filename) <syntax> [file->sexp] (##core#set! sexp (read in)) <syntax> [file->sexp] (read in) <syntax> [file->sexp] (##core#begin (close-input-port in) sexp) <syntax> [file->sexp] (close-input-port in) <syntax> [file->sexp] (##core#undefined) <syntax> [file->sexp] (##core#undefined) ;;---------------------------------------------;; File: sutils.import.scm (module sutils ( sexp->str str->sexp sexp->file file->sexp ) (import chicken scheme) ;; (use srfi-6) (define (sexp->str sexp) (call-with-output-string (lambda (out) (write sexp out)))) (define (str->sexp str) (with-input-from-string str (lambda () (read)))) (define (sexp->file filename sexp) (define out (open-output-file filename)) (begin (write sexp out) (close-output-port out))) (define (file->sexp filename) (define in (open-input-file filename)) (define sexp (read in)) (begin (close-input-port in) sexp)) ) ;;; End of module sutils ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Solution added by ubot2xyzw2008 on Sat Oct 17 05:03:03 2015
Thanks to: <vandusen> and <evhan>. Solution: Add (use port) (module sutils ( sexp->str str->sexp sexp->file file->sexp ) (import chicken scheme) (use ports) ...