From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: George Demmy Newsgroups: gmane.lisp.guile.bugs Subject: bug#58529: possible doc bug in guile manual Date: Fri, 14 Oct 2022 16:04:53 -0500 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35664"; mail-complaints-to="usenet@ciao.gmane.io" To: 58529@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Fri Oct 14 23:06:10 2022 Return-path: Envelope-to: guile-bugs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ojRsg-00099T-9s for guile-bugs@m.gmane-mx.org; Fri, 14 Oct 2022 23:06:10 +0200 Original-Received: from localhost ([::1]:56490 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ojRsf-00028D-8K for guile-bugs@m.gmane-mx.org; Fri, 14 Oct 2022 17:06:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41006) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ojRsY-000285-P4 for bug-guile@gnu.org; Fri, 14 Oct 2022 17:06:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39706) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ojRsY-0003vX-1g for bug-guile@gnu.org; Fri, 14 Oct 2022 17:06:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ojRsX-00088K-Or for bug-guile@gnu.org; Fri, 14 Oct 2022 17:06:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: George Demmy Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Fri, 14 Oct 2022 21:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58529 X-GNU-PR-Package: guile X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.166578151031190 (code B ref -1); Fri, 14 Oct 2022 21:06:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 14 Oct 2022 21:05:10 +0000 Original-Received: from localhost ([127.0.0.1]:38784 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ojRrh-00086z-Nz for submit@debbugs.gnu.org; Fri, 14 Oct 2022 17:05:10 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:38652) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ojRrg-00086r-00 for submit@debbugs.gnu.org; Fri, 14 Oct 2022 17:05:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42950) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ojRrf-00020U-QQ for bug-guile@gnu.org; Fri, 14 Oct 2022 17:05:07 -0400 Original-Received: from mail-io1-xd34.google.com ([2607:f8b0:4864:20::d34]:36547) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ojRre-0003h9-3Z for bug-guile@gnu.org; Fri, 14 Oct 2022 17:05:07 -0400 Original-Received: by mail-io1-xd34.google.com with SMTP id y80so4879228iof.3 for ; Fri, 14 Oct 2022 14:05:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=Rx3zhKZ3G/y8m7R54eYckh0EcHyL6lclgfNBIcYplzU=; b=ekbA1up4CTGfHWA5gS2ITtZyel16WRs/yoxZzsHFWJnLjynelRA+iYsCNkllqe0AX4 VMxOmhZtErpFQrAT6E1qyLCw/SwsjwfohLvuCrBMCPwVtbgdGKxy7z+1u/JejpsHxEbR cR+axIY39azTbal/Yk1bhGrOtp2koSkKZqWYQWLLKlDdwjKFYD3M2ic1A06apTR/j43J Pk6MEf97B1FEJiGsWayho3tLSDSEswI1754v+jnz76GxijWoEQHutO8vOMT8nwN+NdL8 dLoxzKvGeiStO5uVYjnJMYmvjBbYR5elL6xh97r8C6h2x4ewfYTBJh6WbeKUGGyeeoFQ JNPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Rx3zhKZ3G/y8m7R54eYckh0EcHyL6lclgfNBIcYplzU=; b=awAHq+9sHJKb99loA3KzN7HpJj41/G4CzGI8BZQmdYHGw5NTRbI8gkn7jJRfYnpnSN L/YOQjPbXJi42tu74pJTWBglWmYeVvommADwSzdWByz8jm/IJual7lsw+dZLZcR2kU9x LLOJziM4LL9ZOZBVzyu9++ExDZJgAx4NqEcPR91BIGbG1t85NnPGTdDHQB2RcI/+zbk7 DVjxvfbYG4eMueLRTzc58Z4OFKXcFG4gZ6loQZdev+pcnHlcO2WXRSSFT0B57U6DrUib pR/KYnBi4QFC0jJY1mOBHTmjF6u803Q1sbtpjmVbuGEZAa736QA663n0GrQGHPTVcQ9k jqZg== X-Gm-Message-State: ACrzQf0KgHemni12eHbYIIXProbU/Pf7Xu9hVGAFoeevZZeRC4VTsIc8 Jt9q/HSp3SrRai+CPnaFHJZSALqvsb8lWfz5rm/A/YD2n3I= X-Google-Smtp-Source: AMsMyM5U4En57ElOT+MxHX0ZtTA8ujrOnTMC1k/OVWYBsg2CxMOVWjUE+WtJ92IB0zUVBJV5AfUhnTkgcDoF8di3tmA= X-Received: by 2002:a05:6638:4987:b0:363:c403:28ff with SMTP id cv7-20020a056638498700b00363c40328ffmr3588132jab.235.1665781504603; Fri, 14 Oct 2022 14:05:04 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::d34; envelope-from=gdemmy@gmail.com; helo=mail-io1-xd34.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.io gmane.lisp.guile.bugs:10405 Archived-At: 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 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: