From: Joel James Adamson <adamsonj@email.unc.edu>
To: guile-user@gnu.org
Subject: Loading a module from the current-working-directory
Date: Wed, 21 Jul 2010 16:27:54 -0400 [thread overview]
Message-ID: <m3bpa060mt.fsf@chondestes.bio.unc.edu> (raw)
[-- Attachment #1: Type: text/plain, Size: 2166 bytes --]
Hello,
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))
Backtrace:
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?
Thanks,
Joel
--
Joel J. Adamson
Servedio Lab
University of North Carolina at Chapel Hill
FSF Member #8164
http://www.unc.edu/~adamsonj
[-- Attachment #2: Type: application/pgp-signature, Size: 229 bytes --]
next reply other threads:[~2010-07-21 20:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-21 20:27 Joel James Adamson [this message]
2010-07-22 7:52 ` Loading a module from the current-working-directory Thien-Thi Nguyen
2010-07-22 16:51 ` Joel James Adamson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3bpa060mt.fsf@chondestes.bio.unc.edu \
--to=adamsonj@email.unc.edu \
--cc=guile-user@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).