[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Loading a module from the current-working-directory

From: Joel James Adamson
Subject: Loading a module from the current-working-directory
Date: Wed, 21 Jul 2010 16:27:54 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)


I've written a simple module:

(define-module (popgen popgen))
(export popgen)

(use-modules (ice-9 format))
(define *numprec*  "~10,8,,,0f ")
(define *numformat* (string-append "~{" *numprec* "~}~%"))

(define (popgen popfun data)
  ;; POPFUN is a function that evaluates the vector DATA to yield the
  ;; next generation's data; print the data to the terminal and then
  ;; check the result of evaluating (popfun data); if the new vector
  ;; is close enough to the old one, exit and return #f; otherwise
  ;; call (popgen POPFUN (POPFUN DATA))
  ;; First print the data to the current-output-port (user routines
  ;; may want to modify this to send the data down a pipe)

  (format #t "~{~}~%" num-format (vector->list data))
  (let* ((new (popfun data))
         (diff (eudiff (new data))))
    (cond ((< diff 1e-15) #f)
          (else (popgen popfun new)))))

(define (eudiff vec1 vec2)
  (sqrt (apply
         (map (lambda (x y)
                (* (- x y) (- x y)))
              (vector->list vec1)
              (vector->list vec2)))))

I'd like to test its features at the REPL, but I am having serious
trouble loading it.  I'm not sure if the problem is in the definition or
how I'm loading it.

I get the following behavior:

guile> %load-path
("/usr/share/guile/site" "/usr/share/guile/1.8" "/usr/share/guile")
guile> (set! %load-path (cons (getcwd) %load-path))
guile> %load-path
("/home/joel/Documents/ss_theory/scm" "/usr/share/guile/site" 
"/usr/share/guile/1.8" "/usr/share/guile")
guile> (use-modules (popgen popgen))

In standard input:
  76: 0* (use-modules (popgen popgen))
  76: 1  (eval-case (# # *unspecified*) (else #))
  76: 2  (begin (process-use-modules (list (list #))) *unspecified*)
In unknown file:
   ?: 3* [process-use-modules (((popgen popgen)))]

<unnamed port>: In procedure process-use-modules in expression 
(process-use-modules (list #)):
<unnamed port>: no code for module (popgen popgen)
ABORT: (misc-error)

Where am I going wrong?


Joel J. Adamson
Servedio Lab
University of North Carolina at Chapel Hill

FSF Member #8164

Attachment: pgpmiKTYh5Q3Q.pgp
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]