[plt-scheme] module require - compile: unbound variable in module

From: Terrence Brannon (metaperl at urth.org)
Date: Wed Jul 14 11:27:42 EDT 2004

I dont know how to fix the error I am getting from MzScheme 207 when
attempting to require my module with the command:

(require "html-seamstress.scm")

---- here is the module:

; (require "html-seamstress.scm")


(module html-seamstress mzscheme

  (require (lib "htmlprag.ss" "htmlprag"))
;;; required by Util.scm
(require  (lib "13.ss" "srfi"))

(require  (lib "ssax.ss"       "ssax")
           (lib "sxml-tools.ss" "sxml")
       (lib "fragments.ss"  "sxml")
           (lib "guides.ss"     "sxml")
           (lib "info.ss"       "sxml")
           (lib "libmisc.ss"    "sxml")
           (lib "stx-engine.ss" "sxml")
           (lib "stx-xsl.ss"    "sxml")
           (lib "sxml-to-markup.ss" "sxml")
           (lib "sxml-tools.ss" "sxml")
           (lib "sxml-tree-trans.ss" "sxml")
           (lib "sxpath-ext.ss" "sxml")
           (lib "sxpath-plus.ss" "sxml")
           (lib "sxpath.ss"      "sxml")
           (lib "sxpathlib.ss"   "sxml")
           (lib "txpath.ss"      "sxml")
           (lib "xpath-parser.ss" "sxml"))


(define string->goodhtml sxml:string->html)
(define srv:send-reply   sxml:display-fragments)
(define pretty-print display)
(define console-output-port current-error-port)

  (load "start-ssax.scm")
  (load "start-laml.scm")

  (define point-mute-dir
    "c:/Documents and Settings/metaperl/My
Documents/Scheme/html-seamstress/example/point-mute/")


; (file->sxml (string-append point-mute-dir "point-mute.html"))

   (define (file->sxml file)
     (html->sxml (open-input-file file)))

   (define (xform-person-name name-string)
     `(span *preorder* . ,(lambda (tag . content)
                            '(span ,name-string))))

   (define point-mute-file
     (string-append point-mute-dir "point-mute.html"))

   (define universal-conversion-rules
     `(
       (@
        ((*default*       ; local override for attributes
          . ,(lambda (attr-key . value) (enattr attr-key value))))
          . ,(lambda (trigger  . value) (cons '@ value)))

       (*default* . ,(lambda (tag . elems) (entag tag elems)))

       (*text* . ,(lambda (trigger str)
                    (if (string? str) (string->goodHTML str) str)))

       (n_        ; a non-breaking space
        . ,(lambda (tag . elems)
             (cons " " elems)))))


   (define top-rule `(*TOP* . ,(lambda (x elem) elem)))


   (define (replace-text-with-ss-rule new-text)
     `(
       (@
        ((*text* . ,(lambda (tag str) str)))
        . ,(lambda x x))

       (*text* . ,(lambda (tag str) new-text))

       (*default* . ,(lambda x x))))

   (define overwite-name-rule
     `(span
      *preorder*
      . ,(lambda elem
           (if
         (null? ((sxpath '(@ hsi (equal? "overwrite_name"))) elem))
         (pre-post-order elem universal-conversion-rules)
         ; do the replacement
         (pre-post-order
           (pre-post-order elem (replace-text-with-ss "yada yada"))
           universal-conversion-rules)
         ))))


   (define ruleset (list universal-conversion-rules overwite-name-rule
                         top-rule replace-text-with-ss-rule))

   (define (point-mute-demo)
     (file->sxml point-mute-file))

   (provide file->sxml point-mute-file ruleset point-mute-demo)


   )


-- 
   (let recur ((lis x) (k k))
     (if (zero? k) (values '() lis)
	(receive (prefix suffix) (recur (cdr lis) (- k 1))
	  (values (cons (car lis) prefix) suffix)))))




Posted on the users mailing list.