From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Skyler Ferris Newsgroups: gmane.lisp.guile.user Subject: Re: can't export conditional variable set with 'cond' Date: Fri, 02 Feb 2024 00:00:56 +0000 Message-ID: <39e242b5-fa54-4edc-9810-333d18bb23c0@protonmail.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34785"; mail-complaints-to="usenet@ciao.gmane.io" To: Mortimer Cladwell , guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Fri Feb 02 01:02:04 2024 Return-path: Envelope-to: guile-user@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 1rVh0O-0008qR-AZ for guile-user@m.gmane-mx.org; Fri, 02 Feb 2024 01:02:04 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVgzj-0000UM-9Q; Thu, 01 Feb 2024 19:01:23 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVgzg-0000U5-B4 for guile-user@gnu.org; Thu, 01 Feb 2024 19:01:21 -0500 Original-Received: from mail-40134.protonmail.ch ([185.70.40.134]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVgze-0001I2-Cc for guile-user@gnu.org; Thu, 01 Feb 2024 19:01:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1706832073; x=1707091273; bh=uaEe6cRUzfacp1H2+pDqWqP3yq5XS5PcdsfnC2SLiao=; h=Date:To:From:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=gqHlTUbfSCgvkHX1TC9rQzBoIkCBIiPcVujIhBHIuhQFkAXDR4imtg2MPIz7uzPWy pCuTr5HQaNf73HUqmD3029KVHrokA67XxLQ4Q5D0EZ9Dx5Q5Z4L/dfN+DjZqXp83Hk z/rDJl6fjxkGEmcrrwYcN/+V1eFLgJLygWbMVTsRsOv5MBFTgdDdPrB4kWOajjpzh6 VQRudobkE88/xpyJzs0S+i6Hll/QKC0vCJoQBLz/7GMVxZl9bHDdZyxsMNWJivtUI/ z3sW9w23y4TefD/JMgiKTwnc6/eeai45sCEwTMin6+y+YRXs9ZRwWKZA2KAy3nfejB CX6Por4mzNoWA== In-Reply-To: Feedback-ID: 40635331:user:proton Received-SPF: pass client-ip=185.70.40.134; envelope-from=skyvine@protonmail.com; helo=mail-40134.protonmail.ch 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_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.user:19426 Archived-At: It's also worth mentioning that a "lispier" way of doing this is to use=20 parameters, described in "6.11.2 Parameters". I get the impression that=20 you were asking this more for curiosity about how the language=20 implementation works than to solve a problem, but I might be wrong in=20 that assumption and people who are looking to solve this problem might=20 come upon this thread in the future. The example looks like this after=20 re-writing to use parameters (and it displays the correct output on my=20 machine): -------------testexport.scm begin---------------------------------- (define-module (testexport) #:use-module (ice-9 pretty-print) #:use-module (env) ) (define (main) (pretty-print (string-append "varA in main: " (varA))) (pretty-print (string-append "varB in main: " (varB))) (pretty-print (string-append "varC in main: " (varC))) ) (main) -------------testexport.scm end---------------------------------- -------------env.scm begin---------------------------------- (define-module (env) #:use-module (ice-9 pretty-print) #:export(varA varB varC)) (define varA (make-parameter "A")) (define varB (make-parameter "")) (define varC (make-parameter "")) (define testval "x") (cond ((string=3D testval "x") (varB "B")) ((string=3D testval "y") (varB "error")) ((string=3D testval "z") (varB "null")) ) (pretty-print (string-append "varB post cond: " (varB))) (when (string=3D testval "x") (varC "C")) (pretty-print (string-append "varC post if: " (varC))) -------------env.scm end----------------------------------