unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: "Walck, Scott" <walck@lvc.edu>
To: "guile-user@gnu.org" <guile-user@gnu.org>
Subject: RE: set-current-module in .guile ?
Date: Sun, 6 Apr 2008 21:27:05 -0400	[thread overview]
Message-ID: <E6C639C7E135D846B5127945421A789F06ECD97565@lvc02.lvc.edu> (raw)
In-Reply-To: <87iqyvrpwj.fsf@gnu.org>

Hi,

That seems to cause me a core dump.

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

Here is how it is designed to work:

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

Backtrace:
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)
guile>

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:*)
etc.,

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.

Scott


________________________________________
From: guile-user-bounces+walck=lvc.edu@gnu.org [guile-user-bounces+walck=lvc.edu@gnu.org] On Behalf Of Ludovic Courtès [ludo@gnu.org]
Sent: Sunday, April 06, 2008 10:58 AM
To: guile-user@gnu.org
Subject: Re: set-current-module in .guile ?

Hi,

"Walck, Scott" <walck@lvc.edu> 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.

Thanks,
Ludo'.








  reply	other threads:[~2008-04-07  1:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-05 17:24 set-current-module in .guile ? Scott N. Walck
2008-04-05 21:00 ` Jon Wilson
2008-04-06  0:01   ` Walck, Scott
2008-04-06 14:58     ` Ludovic Courtès
2008-04-07  1:27       ` Walck, Scott [this message]
2008-04-07  7:16         ` Ludovic Courtès
2008-04-07 11:27           ` Walck, Scott
2008-04-07 13:38             ` Ludovic Courtès
2008-04-07 15:07               ` Scott N. Walck
2008-04-08 13:40                 ` Ludovic Courtès
2008-04-08 15:41                   ` Scott N. Walck
2008-04-09 15:05                 ` Ludovic Courtès
2008-04-09 15:24                   ` Walck, Scott
2008-04-09 20:16 ` Neil Jerram

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=E6C639C7E135D846B5127945421A789F06ECD97565@lvc02.lvc.edu \
    --to=walck@lvc.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).