GNU logs - #36682, boring messages


Message sent to bug-guile@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#36682: Error in Guile scripting examples
Resent-From: Hans-Werner Roitzsch <hwroitzsch@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-guile@HIDDEN
Resent-Date: Mon, 15 Jul 2019 23:20:02 +0000
Resent-Message-ID: <handler.36682.B.156323279231022 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 36682
X-GNU-PR-Package: guile
X-GNU-PR-Keywords: 
To: 36682 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-guile@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.156323279231022
          (code B ref -1); Mon, 15 Jul 2019 23:20:02 +0000
Received: (at submit) by debbugs.gnu.org; 15 Jul 2019 23:19:52 +0000
Received: from localhost ([127.0.0.1]:49384 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hnAG6-00084F-F1
	for submit <at> debbugs.gnu.org; Mon, 15 Jul 2019 19:19:52 -0400
Received: from lists.gnu.org ([209.51.188.17]:45614)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <hwroitzsch@HIDDEN>) id 1hn9fX-00079q-Ez
 for submit <at> debbugs.gnu.org; Mon, 15 Jul 2019 18:42:04 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:59258)
 by lists.gnu.org with esmtp (Exim 4.86_2)
 (envelope-from <hwroitzsch@HIDDEN>) id 1hn9fV-0002or-RD
 for bug-guile@HIDDEN; Mon, 15 Jul 2019 18:42:03 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,HTML_MESSAGE,
 RCVD_IN_DNSWL_MED,URIBL_BLOCKED autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <hwroitzsch@HIDDEN>) id 1hn9fT-0003Cs-NH
 for bug-guile@HIDDEN; Mon, 15 Jul 2019 18:42:01 -0400
Received: from mout02.posteo.de ([185.67.36.66]:40139)
 by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <hwroitzsch@HIDDEN>)
 id 1hn9fT-0003An-4B
 for bug-guile@HIDDEN; Mon, 15 Jul 2019 18:41:59 -0400
Received: from submission (posteo.de [89.146.220.130]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 884012400E5
 for <bug-guile@HIDDEN>; Tue, 16 Jul 2019 00:41:56 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1563230516; bh=txTSSqhWWLBVWC8AvltNEhfuG3CazhVb+qXBsykO8U8=;
 h=To:From:Subject:Date:From;
 b=obRTBo1HJx7XL84VqoijY9641U6itXhVKOGJzSNEVrG30P4jUUGEQU75B5DyR3aKI
 iQdscqLjSNwNMo1fp6IFRRseGtUSHUlBVrNks0kfZQb71Q1HUfaBG98FOB83JYNU0z
 1l3xltjBkFRVvMHJZZmpdB99XmM5Wdis8YNTbpfyrd5KA0fpQ8CwV9q2zYqb9TJKgF
 Khm0mA8uW0PPutuOEbRYmOhJ3INosrul1i1y6prA2TWG85uIpv8tQUuAHYPYxFg9/U
 W489en1K2Z8PmETouAadTBT/iz2izSUnW9k/0/peLTJ5anJbdKwIMMuPpxwZJaCKRy
 XeQb4YhiLDRkw==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 45ndnH4YK3z9rxG
 for <bug-guile@HIDDEN>; Tue, 16 Jul 2019 00:41:55 +0200 (CEST)
From: Hans-Werner Roitzsch <hwroitzsch@HIDDEN>
Message-ID: <6956abda-8d34-8f3a-0816-9faacee7c7e7@HIDDEN>
Date: Tue, 16 Jul 2019 00:39:43 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101
 Thunderbird/60.7.2
MIME-Version: 1.0
Content-Type: multipart/alternative;
 boundary="------------EFCA7833A77C60E9DDD2AD1B"
Content-Language: en-US
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 185.67.36.66
X-Spam-Score: -1.3 (-)
X-Mailman-Approved-At: Mon, 15 Jul 2019 19:19:48 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

This is a multi-part message in MIME format.
--------------EFCA7833A77C60E9DDD2AD1B
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Hello GNU Team!

I wish to report a bug in either Guile's documentation or Guile's code
with regard to running scripts.

There are some examples of that given in Guile's documentation at:

https://www.gnu.org/software/guile/manual/html_node/Scripting-Examples.ht=
ml#Scripting-Examples

In the following I will describe the problem.


I have the file `modules.scm` with the following code:

----8<----start-of-code---->8----
#!/usr/bin/env sh
exec guile -l fact.scm -e '(@ (my-module) main)' -s "$0" "$@"
!#

;; Explanation:
;; -e (my-module)
;; If run as a script run the `my-module` module's `main`.
;; (Use `@@` to reference not exported procedures.)
;; -s
;; Run the script.

(define-module (my-module)
=C2=A0 #:export (main))

;; Create a module named `fac`.
;; Export the `main` procedure as part of `fac`.

(define (n-choose-k n k)
=C2=A0 (/ (fact n)
=C2=A0=C2=A0=C2=A0=C2=A0 (* (fact k)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (fact (- n k)))))

(define (main args)
=C2=A0 (let ((n (string->number (cadr args)))
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (k (string->number (caddr args=
))))
=C2=A0=C2=A0=C2=A0 (display (n-choose-k n k))
=C2=A0=C2=A0=C2=A0 (newline)))
----8<----end-of-code---->8----

And I have the following `fact.scm`:

----8<----start-of-code---->8----
#!/usr/local/bin/guile \
-e main -s
!#

;; How to run this program?
;; Example:
;; guile -e main -s factorial-script.scm 50
;; Explanation:
;; -e specifies the procedure to run
;; -s specifies to run this as a script
;; 50 is the number we take as input to the script

(define (fact n)
=C2=A0 (if (zero? n) 1
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (* n (fact (- n 1)))))

(define (main args)
=C2=A0 (display (fact (string->number (cadr args))))
=C2=A0 (newline))
----8<----end-of-code---->8----

The script is made executable by doing:

chmod +x modules.scm

Then I call the script as follows:

./modules.scm 10 3

This results in the error:

----8<----start-of-code---->8----
Backtrace:
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 4 (apply-smo=
b/1 #<catch-closure 119cb80>)
In ice-9/boot-9.scm:
=C2=A0=C2=A0=C2=A0 705:2=C2=A0 3 (call-with-prompt ("prompt") #<procedure=
 11aa8e0 at ice-9/eval.scm:330:13 ()> #<procedure default-prom=E2=80=A6>)
In ice-9/eval.scm:
=C2=A0=C2=A0=C2=A0 619:8=C2=A0 2 (_ #(#(#<directory (guile-user) 1233140>=
)))
In /home/xiaolong/development/Guile/scripting/./modules.scm:
=C2=A0=C2=A0=C2=A0 26:13=C2=A0 1 (main _)
=C2=A0=C2=A0=C2=A0=C2=A0 18:0=C2=A0 0 (n-choose-k _ _)

/home/xiaolong/development/Guile/scripting/./modules.scm:18:0: In procedu=
re n-choose-k:
In procedure module-lookup: Unbound variable: fact
----8<----end-of-code---->8----

According to my understanding of the tutorial in the Guile documentation
that I linked to above this code should work.

I also described the problem some time ago at:

https://stackoverflow.com/questions/50272618/guile-scheme-scripting-tutor=
ial-loading-scripts

My Guile version is:

guile (GNU Guile) 2.2.4

Best regards,

Hans-Werner Roitzsch


--------------EFCA7833A77C60E9DDD2AD1B
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

<html>
  <head>

    <meta http-equiv=3D"content-type" content=3D"text/html; charset=3DUTF=
-8">
  </head>
  <body bgcolor=3D"#FFFFFF" text=3D"#000000">
    <p>Hello GNU Team!</p>
    <p>I wish to report a bug in either Guile's documentation or Guile's
      code with regard to running scripts.</p>
    <p>There are some examples of that given in Guile's documentation
      at:</p>
    <p><a class=3D"moz-txt-link-freetext" href=3D"https://www.gnu.org/sof=
tware/guile/manual/html_node/Scripting-Examples.html#Scripting-Examples">=
https://www.gnu.org/software/guile/manual/html_node/Scripting-Examples.ht=
ml#Scripting-Examples</a></p>
    <p>In the following I will describe the problem.</p>
    <p><br>
    </p>
    <p>I have the file `modules.scm` with the following code:</p>
    <pre>----8&lt;----start-of-code----&gt;8----
#!/usr/bin/env sh
exec guile -l fact.scm -e '(@ (my-module) main)' -s "$0" "$@"
!#

;; Explanation:
;; -e (my-module)
;; If run as a script run the `my-module` module's `main`.
;; (Use `@@` to reference not exported procedures.)
;; -s
;; Run the script.

(define-module (my-module)
=C2=A0 #:export (main))

;; Create a module named `fac`.
;; Export the `main` procedure as part of `fac`.

(define (n-choose-k n k)
=C2=A0 (/ (fact n)
=C2=A0=C2=A0=C2=A0=C2=A0 (* (fact k)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (fact (- n k)))))

(define (main args)
=C2=A0 (let ((n (string-&gt;number (cadr args)))
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (k (string-&gt;number (caddr a=
rgs))))
=C2=A0=C2=A0=C2=A0 (display (n-choose-k n k))
=C2=A0=C2=A0=C2=A0 (newline)))
----8&lt;----end-of-code----&gt;8----</pre>
    <p>And I have the following `fact.scm`:</p>
    <pre>----8&lt;----start-of-code----&gt;8----
#!/usr/local/bin/guile \
-e main -s
!#

;; How to run this program?
;; Example:
;; guile -e main -s factorial-script.scm 50
;; Explanation:
;; -e specifies the procedure to run
;; -s specifies to run this as a script
;; 50 is the number we take as input to the script

(define (fact n)
=C2=A0 (if (zero? n) 1
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (* n (fact (- n 1)))))

(define (main args)
=C2=A0 (display (fact (string-&gt;number (cadr args))))
=C2=A0 (newline))
----8&lt;----end-of-code----&gt;8----</pre>
    <p>The script is made executable by doing: <br>
    </p>
    <pre>chmod +x modules.scm
</pre>
    <p>Then I call the script as follows:</p>
    <pre>./modules.scm 10 3</pre>
    <p>This results in the error:</p>
    <pre>----8&lt;----start-of-code----&gt;8----
Backtrace:
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 4 (apply-smo=
b/1 #&lt;catch-closure 119cb80&gt;)
In ice-9/boot-9.scm:
=C2=A0=C2=A0=C2=A0 705:2=C2=A0 3 (call-with-prompt ("prompt") #&lt;proced=
ure 11aa8e0 at ice-9/eval.scm:330:13 ()&gt; #&lt;procedure default-prom=E2=
=80=A6&gt;)
In ice-9/eval.scm:
=C2=A0=C2=A0=C2=A0 619:8=C2=A0 2 (_ #(#(#&lt;directory (guile-user) 12331=
40&gt;)))
In /home/xiaolong/development/Guile/scripting/./modules.scm:
=C2=A0=C2=A0=C2=A0 26:13=C2=A0 1 (main _)
=C2=A0=C2=A0=C2=A0=C2=A0 18:0=C2=A0 0 (n-choose-k _ _)

/home/xiaolong/development/Guile/scripting/./modules.scm:18:0: In procedu=
re n-choose-k:
In procedure module-lookup: Unbound variable: fact
----8&lt;----end-of-code----&gt;8----
</pre>
    <p>According to my understanding of the tutorial in the Guile
      documentation that I linked to above this code should work.</p>
    <p>I also described the problem some time ago at:</p>
    <p><a class=3D"moz-txt-link-freetext" href=3D"https://stackoverflow.c=
om/questions/50272618/guile-scheme-scripting-tutorial-loading-scripts">ht=
tps://stackoverflow.com/questions/50272618/guile-scheme-scripting-tutoria=
l-loading-scripts</a></p>
    <p>My Guile version is:</p>
    <pre>guile (GNU Guile) 2.2.4
</pre>
    <p>Best regards,</p>
    <p>Hans-Werner Roitzsch<br>
    </p>
  </body>
</html>

--------------EFCA7833A77C60E9DDD2AD1B--




Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.505 (Entity 5.505)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: Hans-Werner Roitzsch <hwroitzsch@HIDDEN>
Subject: bug#36682: Acknowledgement (Error in Guile scripting examples)
Message-ID: <handler.36682.B.156323279231022.ack <at> debbugs.gnu.org>
References: <6956abda-8d34-8f3a-0816-9faacee7c7e7@HIDDEN>
X-Gnu-PR-Message: ack 36682
X-Gnu-PR-Package: guile
Reply-To: 36682 <at> debbugs.gnu.org
Date: Mon, 15 Jul 2019 23:20:02 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 bug-guile@HIDDEN

If you wish to submit further information on this problem, please
send it to 36682 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
36682: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D36682
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message sent to bug-guile@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#36682: Error in Guile scripting examples
Resent-From: Arne Babenhauserheide <arne_bab@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-guile@HIDDEN
Resent-Date: Mon, 15 Jul 2019 23:46:02 +0000
Resent-Message-ID: <handler.36682.B.15632343081101 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 36682
X-GNU-PR-Package: guile
X-GNU-PR-Keywords: 
To: 36682 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-guile@HIDDEN
X-Debbugs-Original-Cc: 36682 <at> debbugs.gnu.org
Received: via spool by submit <at> debbugs.gnu.org id=B.15632343081101
          (code B ref -1); Mon, 15 Jul 2019 23:46:02 +0000
Received: (at submit) by debbugs.gnu.org; 15 Jul 2019 23:45:08 +0000
Received: from localhost ([127.0.0.1]:49402 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hnAea-0000Hh-2U
	for submit <at> debbugs.gnu.org; Mon, 15 Jul 2019 19:45:08 -0400
Received: from lists.gnu.org ([209.51.188.17]:42824)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <arne_bab@HIDDEN>) id 1hnAeY-0000Ha-Kv
 for submit <at> debbugs.gnu.org; Mon, 15 Jul 2019 19:45:06 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:41884)
 by lists.gnu.org with esmtp (Exim 4.86_2)
 (envelope-from <arne_bab@HIDDEN>) id 1hnAeX-0004Oc-Fy
 for bug-guile@HIDDEN; Mon, 15 Jul 2019 19:45:06 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM,
 RCVD_IN_DNSWL_NONE,URIBL_BLOCKED autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <arne_bab@HIDDEN>) id 1hnAeW-0000FA-8w
 for bug-guile@HIDDEN; Mon, 15 Jul 2019 19:45:05 -0400
Received: from mout.web.de ([212.227.15.3]:56563)
 by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <arne_bab@HIDDEN>) id 1hnAeV-0000CS-Vz
 for bug-guile@HIDDEN; Mon, 15 Jul 2019 19:45:04 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de;
 s=dbaedf251592; t=1563234286;
 bh=9dBohTMoCRmdX90i+AFyztdqjwsJ5O9VANvynXylg6g=;
 h=X-UI-Sender-Class:References:From:To:Cc:Subject:In-reply-to:Date;
 b=gBTuhqJWX2s2xycO22jXeN9ssHMXoM1jVOS9txfdzi+igMBpA27woiIEesfMPyICW
 d3FRhxrS6/+KBMctr0qqSK0yHNZMP2QQq4qCf92CINpVQK9jCw1ci4yXttmPZDGdAX
 BuzwH2dR60TauUvkWjjadWB3F7/yosbcwZZFfDz8=
X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9
Received: from fluss ([84.149.83.171]) by smtp.web.de (mrweb001
 [213.165.67.108]) with ESMTPSA (Nemesis) id 0Lj2TO-1iJjyV3rig-00dCOJ; Tue, 16
 Jul 2019 01:44:46 +0200
References: <6956abda-8d34-8f3a-0816-9faacee7c7e7@HIDDEN>
User-agent: mu4e 1.2.0; emacs 26.2
From: Arne Babenhauserheide <arne_bab@HIDDEN>
In-reply-to: <6956abda-8d34-8f3a-0816-9faacee7c7e7@HIDDEN>
Date: Tue, 16 Jul 2019 01:44:39 +0200
Message-ID: <875zo2g8wo.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha256; protocol="application/pgp-signature"
X-Provags-ID: V03:K1:L+sHWg1zxQpDE+Rgcn43Me6z8FM5mVcmCWeaHUg6NsyTx+IY2jR
 JCCmRqig7gERITbm3f2TnLG2LgD3ycDvPlr4u7w6TbqZ3B8BdHnbabf2XjUmYt8x7PEezZN
 53ItuU1VQv91BMXXtFi2BtdeR6oO/Zh7JCSTB0YrNPT3A+a50FRruJC8HToXW22EZi6TU6F
 hVvgAejkHc4w9LOZ/pe+w==
X-UI-Out-Filterresults: notjunk:1;V03:K0:EvkDqP4ZVbo=:TXk7FdgdlofiG6Njswpq/H
 Jloy5jwtY/smTNr8+fH108FityQ1tV10M8FKBFWBc/j2K9b0BXKXi94ENXj5AvudaI2qjyyGd
 pZrYoLSGovYqb7+WEPbYEx5+BF54X3CfFBvqP3TIr/bI4lNDFcFjItZ+8lfW4LsCbpq5WPNnZ
 v0qin2zfGo1P62gXgbzQKDnk7X7dp7udWKoTuEZx0orFUxU8J5I+UGbViasdaBQJJF3GelSC8
 QzIu4rKoPSU4tnqCMaQo2V2JMELfAhcLQCYtVosBAlv9PKYHwTLzLIQLA6uAaYO61UmpqK+bg
 OblKShH187ibu8MWsrHvSn6ZJsQx7XbZ3K9aUo35y2D7FqgQVUEkSOPSyZsHUQpLze3ZVBAft
 hcR8AaPFNS3aZHyeXNrKqYJqUVuau7em09J2ioWyjMLD5H36jK1Y5m6VY5BPOYXFB2LfRjViM
 I6m8lJ0mqDKblm/C/aepMJCRgDX5ZgQIZSZFRl5rt9YOZmIC6rKa3nc31ZzqudSR/qtUVd2xx
 KTCfzJzoVlrupxLunxh+sFP0Dmz+/5Z3lNpruDesFrzNQEx/yeb5NZA3qrc0xvsDYOueB39e+
 0KdOsHmYZgtSvNfb5rH7UwzoBY7Pw3Z4Guot26qb6QhUtB4I3RwyTyqwr9bFhj4exZ5D7cHaO
 9Xko=
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 212.227.15.3
X-Spam-Score: -1.4 (-)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.4 (--)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Hello Hans-Werner Roitzsch,

It looks like you=E2=80=99re mixing up two concepts: the fac creates a modu=
le
and loads the fact which is not a module, so basically main and choose
live in another namespace than fact (define-module starts a new
namespace).

And it seems that this is indeed a bug in the documentation, because
https://www.gnu.org/software/guile/manual/html_node/Scripting-Examples.html=
#Scripting-Examples
jumps to defining fac as a module but does not at the same time define
and import fact as a module, too.

Hans-Werner Roitzsch <hwroitzsch@HIDDEN> writes:
> I have the file `modules.scm` with the following code:
>
> ----8<----start-of-code---->8----
> #!/usr/bin/env sh
> exec guile -l fact.scm -e '(@ (my-module) main)' -s "$0" "$@"
> !#
>
> ;; Explanation:
> ;; -e (my-module)
> ;; If run as a script run the `my-module` module's `main`.
> ;; (Use `@@` to reference not exported procedures.)
> ;; -s
> ;; Run the script.
>
> (define-module (my-module)
>   #:export (main))

At this point you need

(use-modules (fact))

> ;; Create a module named `fac`.
> ;; Export the `main` procedure as part of `fac`.
>
> (define (n-choose-k n k)
>   (/ (fact n)
>      (* (fact k)
>         (fact (- n k)))))
>
> (define (main args)
>   (let ((n (string->number (cadr args)))
>         (k (string->number (caddr args))))
>     (display (n-choose-k n k))
>     (newline)))
> ----8<----end-of-code---->8----
>
> And I have the following `fact.scm`:
>
> ----8<----start-of-code---->8----
> #!/usr/local/bin/guile \
> -e main -s
> !#
>
> ;; How to run this program?
> ;; Example:
> ;; guile -e main -s factorial-script.scm 50
> ;; Explanation:
> ;; -e specifies the procedure to run
> ;; -s specifies to run this as a script
> ;; 50 is the number we take as input to the script

To be usable as module, this needs to be defined as module:

(define-module (fact)
  #:export (fact))

> (define (fact n)
>   (if (zero? n) 1
>       (* n (fact (- n 1)))))
>
> (define (main args)
>   (display (fact (string->number (cadr args))))
>   (newline))
> ----8<----end-of-code---->8----
=E2=80=A6
> chmod +x modules.scm
> ./modules.scm 10 3

Does it work with the added module definition and import?

If yes, then this looks like a bug in the documentation.

> Best regards,
>
> Hans-Werner Roitzsch

Best wishes, and thank you for reporting!
Arne
=2D-
Unpolitisch sein
hei=C3=9Ft politisch sein
ohne es zu merken

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEE801qEjXQSQPNItXAE++NRSQDw+sFAl0tD+oACgkQE++NRSQD
w+uv/A//TFj/xrwPZNtlVlTG4tbyISUg/fGU0Z8EnFS/BzHgsG26Z/KBW58MJ/fW
lfAWdYOnzauXa+DJU4LHs/HEfBNgYEsXFXur56OZA39bJ4F2WiRgZibcfHD45Rwt
RC8txwbldyUHz1AW009LHyGJqxlt+wAhf24VFMDdbaLFxZrG/O81YLx9nzHXumea
hFoQt8JIMPvjjoWgjm18LPCYC2bDChkIYdLDrBDSWhKJx2SuWSdJftpAsmxI0+Dh
2ChT5F6UT48Kzh/ymU1xCf1wTpb1H91x5fZJS1xYSfLIes9pkQM1qCDzY00xYhW4
CsUuSXqK+4WadEK9L1ggtMOIdxpKfElEhaz+gsG8NqOMPg8NOL93IDap7i1y5aTY
tuKi7AoJ1Rp8eJCCdXuX9Nc5/674OKlc9YptFaWW9VfvuePVw1wrYoKsa2qcfKZE
KcTr77BIt1DfIrBJsPXtfyG5diC/pb09JK7SgD2d77lp28DVdFVRHWyC/+GwVAyY
6/GQvX7PCFVeDierSYbkKaK+s1fohtl3Wek28Z9pgLMFbj3FilHwE/Q/X1UIsvQF
pgix2uyUeBxofevoVTwxZTrrZ6UAbT/jN5c2/6mzaRiMAogc673qwBz/yHLNpAQr
yULU8Xz/Cy4t2wAQv8fVsnzkjpSijGtIo39eppVnhxxug7HaJ3OIswQBAQgAHRYh
BN0ovebZh1yrzkqLHdzPDbMLwQVIBQJdLQ/qAAoJENzPDbMLwQVI8OcD/iKSTl+x
etXZzW46EajYzN6uweCViwt3jApIAFPj7rL604XAR9BmnxeEC0o8IfceIHyJ4YsH
lAdTJOEvG40whMnUYhIYsCncEWkjvzXoqHPljY8j4ZT2/OBH2r5JLlfB3oMSBvWg
qnBRLa093dldcgjMwS8IKjd1C1YGikD20GuT
=d4KY
-----END PGP SIGNATURE-----
--=-=-=--




Message sent to bug-guile@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#36682: Error in Guile scripting examples
Resent-From: Arne Babenhauserheide <arne_bab@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-guile@HIDDEN
Resent-Date: Mon, 15 Jul 2019 23:46:02 +0000
Resent-Message-ID: <handler.36682.B36682.15632343051085 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 36682
X-GNU-PR-Package: guile
X-GNU-PR-Keywords: 
To: 36682 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-guile@HIDDEN
X-Debbugs-Original-Cc: 36682 <at> debbugs.gnu.org
Received: via spool by 36682-submit <at> debbugs.gnu.org id=B36682.15632343051085
          (code B ref 36682); Mon, 15 Jul 2019 23:46:02 +0000
Received: (at 36682) by debbugs.gnu.org; 15 Jul 2019 23:45:05 +0000
Received: from localhost ([127.0.0.1]:49399 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hnAeW-0000HQ-M0
	for submit <at> debbugs.gnu.org; Mon, 15 Jul 2019 19:45:04 -0400
Received: from mout.web.de ([212.227.15.3]:51939)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <arne_bab@HIDDEN>) id 1hnAeR-0000Ga-Gv
 for 36682 <at> debbugs.gnu.org; Mon, 15 Jul 2019 19:45:00 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de;
 s=dbaedf251592; t=1563234286;
 bh=9dBohTMoCRmdX90i+AFyztdqjwsJ5O9VANvynXylg6g=;
 h=X-UI-Sender-Class:References:From:To:Cc:Subject:In-reply-to:Date;
 b=gBTuhqJWX2s2xycO22jXeN9ssHMXoM1jVOS9txfdzi+igMBpA27woiIEesfMPyICW
 d3FRhxrS6/+KBMctr0qqSK0yHNZMP2QQq4qCf92CINpVQK9jCw1ci4yXttmPZDGdAX
 BuzwH2dR60TauUvkWjjadWB3F7/yosbcwZZFfDz8=
X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9
Received: from fluss ([84.149.83.171]) by smtp.web.de (mrweb001
 [213.165.67.108]) with ESMTPSA (Nemesis) id 0Lj2TO-1iJjyV3rig-00dCOJ; Tue, 16
 Jul 2019 01:44:46 +0200
References: <6956abda-8d34-8f3a-0816-9faacee7c7e7@HIDDEN>
User-agent: mu4e 1.2.0; emacs 26.2
From: Arne Babenhauserheide <arne_bab@HIDDEN>
In-reply-to: <6956abda-8d34-8f3a-0816-9faacee7c7e7@HIDDEN>
Date: Tue, 16 Jul 2019 01:44:39 +0200
Message-ID: <875zo2g8wo.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha256; protocol="application/pgp-signature"
X-Provags-ID: V03:K1:L+sHWg1zxQpDE+Rgcn43Me6z8FM5mVcmCWeaHUg6NsyTx+IY2jR
 JCCmRqig7gERITbm3f2TnLG2LgD3ycDvPlr4u7w6TbqZ3B8BdHnbabf2XjUmYt8x7PEezZN
 53ItuU1VQv91BMXXtFi2BtdeR6oO/Zh7JCSTB0YrNPT3A+a50FRruJC8HToXW22EZi6TU6F
 hVvgAejkHc4w9LOZ/pe+w==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:EvkDqP4ZVbo=:TXk7FdgdlofiG6Njswpq/H
 Jloy5jwtY/smTNr8+fH108FityQ1tV10M8FKBFWBc/j2K9b0BXKXi94ENXj5AvudaI2qjyyGd
 pZrYoLSGovYqb7+WEPbYEx5+BF54X3CfFBvqP3TIr/bI4lNDFcFjItZ+8lfW4LsCbpq5WPNnZ
 v0qin2zfGo1P62gXgbzQKDnk7X7dp7udWKoTuEZx0orFUxU8J5I+UGbViasdaBQJJF3GelSC8
 QzIu4rKoPSU4tnqCMaQo2V2JMELfAhcLQCYtVosBAlv9PKYHwTLzLIQLA6uAaYO61UmpqK+bg
 OblKShH187ibu8MWsrHvSn6ZJsQx7XbZ3K9aUo35y2D7FqgQVUEkSOPSyZsHUQpLze3ZVBAft
 hcR8AaPFNS3aZHyeXNrKqYJqUVuau7em09J2ioWyjMLD5H36jK1Y5m6VY5BPOYXFB2LfRjViM
 I6m8lJ0mqDKblm/C/aepMJCRgDX5ZgQIZSZFRl5rt9YOZmIC6rKa3nc31ZzqudSR/qtUVd2xx
 KTCfzJzoVlrupxLunxh+sFP0Dmz+/5Z3lNpruDesFrzNQEx/yeb5NZA3qrc0xvsDYOueB39e+
 0KdOsHmYZgtSvNfb5rH7UwzoBY7Pw3Z4Guot26qb6QhUtB4I3RwyTyqwr9bFhj4exZ5D7cHaO
 9Xko=
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Hello Hans-Werner Roitzsch,

It looks like you=E2=80=99re mixing up two concepts: the fac creates a modu=
le
and loads the fact which is not a module, so basically main and choose
live in another namespace than fact (define-module starts a new
namespace).

And it seems that this is indeed a bug in the documentation, because
https://www.gnu.org/software/guile/manual/html_node/Scripting-Examples.html=
#Scripting-Examples
jumps to defining fac as a module but does not at the same time define
and import fact as a module, too.

Hans-Werner Roitzsch <hwroitzsch@HIDDEN> writes:
> I have the file `modules.scm` with the following code:
>
> ----8<----start-of-code---->8----
> #!/usr/bin/env sh
> exec guile -l fact.scm -e '(@ (my-module) main)' -s "$0" "$@"
> !#
>
> ;; Explanation:
> ;; -e (my-module)
> ;; If run as a script run the `my-module` module's `main`.
> ;; (Use `@@` to reference not exported procedures.)
> ;; -s
> ;; Run the script.
>
> (define-module (my-module)
>   #:export (main))

At this point you need

(use-modules (fact))

> ;; Create a module named `fac`.
> ;; Export the `main` procedure as part of `fac`.
>
> (define (n-choose-k n k)
>   (/ (fact n)
>      (* (fact k)
>         (fact (- n k)))))
>
> (define (main args)
>   (let ((n (string->number (cadr args)))
>         (k (string->number (caddr args))))
>     (display (n-choose-k n k))
>     (newline)))
> ----8<----end-of-code---->8----
>
> And I have the following `fact.scm`:
>
> ----8<----start-of-code---->8----
> #!/usr/local/bin/guile \
> -e main -s
> !#
>
> ;; How to run this program?
> ;; Example:
> ;; guile -e main -s factorial-script.scm 50
> ;; Explanation:
> ;; -e specifies the procedure to run
> ;; -s specifies to run this as a script
> ;; 50 is the number we take as input to the script

To be usable as module, this needs to be defined as module:

(define-module (fact)
  #:export (fact))

> (define (fact n)
>   (if (zero? n) 1
>       (* n (fact (- n 1)))))
>
> (define (main args)
>   (display (fact (string->number (cadr args))))
>   (newline))
> ----8<----end-of-code---->8----
=E2=80=A6
> chmod +x modules.scm
> ./modules.scm 10 3

Does it work with the added module definition and import?

If yes, then this looks like a bug in the documentation.

> Best regards,
>
> Hans-Werner Roitzsch

Best wishes, and thank you for reporting!
Arne
=2D-
Unpolitisch sein
hei=C3=9Ft politisch sein
ohne es zu merken

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEE801qEjXQSQPNItXAE++NRSQDw+sFAl0tD+oACgkQE++NRSQD
w+uv/A//TFj/xrwPZNtlVlTG4tbyISUg/fGU0Z8EnFS/BzHgsG26Z/KBW58MJ/fW
lfAWdYOnzauXa+DJU4LHs/HEfBNgYEsXFXur56OZA39bJ4F2WiRgZibcfHD45Rwt
RC8txwbldyUHz1AW009LHyGJqxlt+wAhf24VFMDdbaLFxZrG/O81YLx9nzHXumea
hFoQt8JIMPvjjoWgjm18LPCYC2bDChkIYdLDrBDSWhKJx2SuWSdJftpAsmxI0+Dh
2ChT5F6UT48Kzh/ymU1xCf1wTpb1H91x5fZJS1xYSfLIes9pkQM1qCDzY00xYhW4
CsUuSXqK+4WadEK9L1ggtMOIdxpKfElEhaz+gsG8NqOMPg8NOL93IDap7i1y5aTY
tuKi7AoJ1Rp8eJCCdXuX9Nc5/674OKlc9YptFaWW9VfvuePVw1wrYoKsa2qcfKZE
KcTr77BIt1DfIrBJsPXtfyG5diC/pb09JK7SgD2d77lp28DVdFVRHWyC/+GwVAyY
6/GQvX7PCFVeDierSYbkKaK+s1fohtl3Wek28Z9pgLMFbj3FilHwE/Q/X1UIsvQF
pgix2uyUeBxofevoVTwxZTrrZ6UAbT/jN5c2/6mzaRiMAogc673qwBz/yHLNpAQr
yULU8Xz/Cy4t2wAQv8fVsnzkjpSijGtIo39eppVnhxxug7HaJ3OIswQBAQgAHRYh
BN0ovebZh1yrzkqLHdzPDbMLwQVIBQJdLQ/qAAoJENzPDbMLwQVI8OcD/iKSTl+x
etXZzW46EajYzN6uweCViwt3jApIAFPj7rL604XAR9BmnxeEC0o8IfceIHyJ4YsH
lAdTJOEvG40whMnUYhIYsCncEWkjvzXoqHPljY8j4ZT2/OBH2r5JLlfB3oMSBvWg
qnBRLa093dldcgjMwS8IKjd1C1YGikD20GuT
=d4KY
-----END PGP SIGNATURE-----
--=-=-=--





Last modified: Mon, 25 Nov 2019 12:00:02 UTC

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