[Top][All Lists]

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

RE: set-current-module in .guile ?

From: Walck, Scott
Subject: RE: set-current-module in .guile ?
Date: Sun, 6 Apr 2008 21:27:05 -0400


That seems to cause me a core dump.

address@hidden:~$ guile
guile> (load "/usr/local/src/guile-scmutils/src/load.scm")
guile> +
#<primitive-generic +>
guile> (module-use! (current-module) generic-environment)
guile> +
#<procedure g:+ args>
guile> (+ 2 3)
guile> (+ (vector 5 6) (vector 7 8))
Segmentation fault (core dumped)

Here is how it is designed to work:

address@hidden:~$ guile
guile> (load "/usr/local/src/guile-scmutils/src/load.scm")
guile> +
#<primitive-generic +>
guile> (+ (vector 2 3) (vector 5 6))

In current input:
   3: 0* [+ {#(2 3)} #(5 6)]

<unnamed port>:3:1: In procedure + in expression (+ (vector 2 3) (vector 5 6)):
<unnamed port>:3:1: Wrong type argument in position 1: #(2 3)
ABORT: (wrong-type-arg)
guile> (set-current-module generic-environment)
#<directory (guile-user) b7bd75e0>
guile> +
#<procedure g:+ args>
guile> (+ (vector 2 3) (vector 5 6))
#(7 9)

and what I'd really like to do is find a way to effectively execute the

(set-current-module generic-environment)

command before the user gets the guile prompt.  I'll keep trying things, and 
let you know if something works.

What puzzles me is that if I just put code in my .guile file to define the 
things I want, like

(define + g:+)
(define * g:*)

I begin to get strange stack overflows, and what appear to be infinite loops.  
I conclude that the underlying primitive operations are needed somewhere by 
some procedure.  The whole thing is pretty treacherous, I guess.  Thanks for 
your ideas.


From: address@hidden address@hidden On Behalf Of Ludovic Courtès address@hidden
Sent: Sunday, April 06, 2008 10:58 AM
To: address@hidden
Subject: Re: set-current-module in .guile ?


"Walck, Scott" <address@hidden> writes:

> I don't know how to use use-modules in this situation.

That should be something like:

  (module-use! (current-module) generic-environment)

`use-modules' is just syntactic sugar that does this.

Let us know if it solves you problem.


reply via email to

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