GNU bug report logs - #58529
possible doc bug in guile manual

Previous Next

Package: guile;

Reported by: George Demmy <gdemmy <at> gmail.com>

Date: Fri, 14 Oct 2022 20:50:01 UTC

Severity: normal

To reply to this bug, email your comments to 58529 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#58529; Package guile. (Fri, 14 Oct 2022 20:50:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to George Demmy <gdemmy <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Fri, 14 Oct 2022 20:50:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: George Demmy <gdemmy <at> gmail.com>
To: bug-guile <at> gnu.org
Subject: possible doc bug in guile manual
Date: Fri, 14 Oct 2022 15:48:45 -0500
Hi,

Reading through the gnu manual, I wanted to get a better handle on
some of @ module syntax introduced in:
https://www.gnu.org/software/guile/manual/html_node/Scripting-Examples.html
I cut and pasted fact and choose into their own files.

I used this version of choose:




Information forwarded to bug-guile <at> gnu.org:
bug#58529; Package guile. (Fri, 14 Oct 2022 21:06:01 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: George Demmy <gdemmy <at> gmail.com>
To: bug-guile <at> gnu.org
Subject: Re: possible doc bug in guile manual
Date: Fri, 14 Oct 2022 16:04:53 -0500
Sorry about the fat finger automagic send from gmail...

Reading through the gnu manual, I wanted to get a better handle on
some of @ module syntax introduced in:
https://www.gnu.org/software/guile/manual/html_node/Scripting-Examples.html
I cut and pasted fact and choose into their own files.

I used this version of choose:

#!/usr/bin/env sh
exec guile -l fact -e '(@ (fac) main)' -s "$0" "$@"
!#
(define-module (fac)
  #:export (main))

(define (choose n m)
  (/ (fact m) (* (fact (- m n)) (fact n))))

(define (main args)
  (let ((n (string->number (cadr args)))
        (m (string->number (caddr args))))
    (display (choose n m))
    (newline)))

It was pure cut and paste, no edits save changing /usr/local/bin/guile
to /usr/bin/guile. Running choose I got

./choose:8:6: In procedure main: Unbound variable: fact

I wondered if there was something going on with -l fact, so I changed
the args for choose to:

exec guile -l fact -e main -s "$0" "$@"

and it indeed ran main from fact. Then I changed it to:

exec guile -l fact -e fact -s "$0" "$@"

and it unsurprisingly yielded:

fact:5:6: In procedure fact:
In procedure =: Wrong type argument in position 1: ("./choose.scm" "4")

So, guile is loading fact (the file and its contents), but it seems
that define-module has got something to do with it.

This is guile 3.0.8 on an up-to-date cygwin. You get similar behavior
on guile 2.0.14 on OpenSUSE LEAP 15.3.

Regards,

George Demmy

On Fri, Oct 14, 2022 at 3:48 PM George Demmy <gdemmy <at> gmail.com> wrote:
>
> Hi,
>
> Reading through the gnu manual, I wanted to get a better handle on
> some of @ module syntax introduced in:
> https://www.gnu.org/software/guile/manual/html_node/Scripting-Examples.html
> I cut and pasted fact and choose into their own files.
>
> I used this version of choose:




This bug report was last modified 2 years and 75 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.