unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Loading a module from the current-working-directory
@ 2010-07-21 20:27 Joel James Adamson
  2010-07-22  7:52 ` Thien-Thi Nguyen
  0 siblings, 1 reply; 3+ messages in thread
From: Joel James Adamson @ 2010-07-21 20:27 UTC (permalink / raw)
  To: guile-user

[-- 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 --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-07-22 16:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-21 20:27 Loading a module from the current-working-directory Joel James Adamson
2010-07-22  7:52 ` Thien-Thi Nguyen
2010-07-22 16:51   ` Joel James Adamson

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).