From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Taylan Kammer Newsgroups: gmane.lisp.guile.user Subject: Re: Fwd: new function Date: Wed, 22 Sep 2021 21:12:42 +0200 Message-ID: <4f267793-3076-72d3-214b-077dbcf3910c@gmail.com> References: <1f773384-058a-f2e3-69cf-b0e23033ec2d@gmail.com> <52130eefb713942a36aa5717ef4c916173567ce3.camel@telenet.be> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37569"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 Cc: guile-user To: Maxime Devos , Damien Mattei , Matt Wette Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Wed Sep 22 21:43:43 2021 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 1mT89f-0009c3-DZ for guile-user@m.gmane-mx.org; Wed, 22 Sep 2021 21:43:43 +0200 Original-Received: from localhost ([::1]:40656 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mT89e-0003EI-1b for guile-user@m.gmane-mx.org; Wed, 22 Sep 2021 15:43:42 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56670) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mT7fi-0002Hl-Oh for guile-user@gnu.org; Wed, 22 Sep 2021 15:12:46 -0400 Original-Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:44615) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mT7fh-0008NF-B1 for guile-user@gnu.org; Wed, 22 Sep 2021 15:12:46 -0400 Original-Received: by mail-wr1-x432.google.com with SMTP id d6so9893047wrc.11 for ; Wed, 22 Sep 2021 12:12:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=XtQqa6A8jlflZs/adSaZZoRpiFHST+hhuA4ZcKSol/A=; b=HBVx9WiZBj+AEfu82CAmwQeqwy1+7HQM5ZQVhTWHoaTRS5C4V5+DiEgzddKDI55qNP JSE9Hd8fDnYzGiR3OKUyr2EIbrLGM9jlW//HJyndhRq4dmx6LlAm7jklELX0MvDKuKc7 XfJ+GHJWEKeBbZ2baMuJ3TKCLI/44I4R3ZrPA9VAIytW9pdhDtdCtcudsejpRo99c3lG 4hc1s8aQH2P9fhJ4m2bH3rDn/iw0uCV14YoL3zKPqUYpDlxa2HxrbSYMZSgxzByrcgUY sxI6ARs8akU/iqqnP8MoqfspS5vN6TECW+cYPKrDFbgMbRzyZAY8VB1RqCIKD2bH64Kp B0Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=XtQqa6A8jlflZs/adSaZZoRpiFHST+hhuA4ZcKSol/A=; b=YUDJV88iPyNxN6Rt1R0I8yiIGoc06ovbgR2mN3Ob7TPjs2rrsFBS8i0O0wSbOBL7Wo 2asT6jJEuOV9ElnTh6wTSBiMpwnJfArIya9v/ck+3tP0JQ5ZqUJH8KuOyu5Lv25FQDRi SnDniU4RxrxWWyebrCqjiSg3GNn/hrWp4S70nGYfNmgNzgedHx7kxlaGeV3wOWdefNk2 spVdmPe/bmTaBFmnzResds6wt8wMZO36/LGWXoRgQkENCyEv0mm8kd3EtGa74rmHreRP 4yoA7BYFt1lhEvZJxd0mBxnf/WG+cddL5MOBUx+WMJUr8KmMJPYKNQzFAE6Jg4Nwpj22 GqiQ== X-Gm-Message-State: AOAM533ZNj7DSB/dOE/KjBc2t+nn9weMaFSwvE5bdjuLa24Jb/sPghq/ UwbGBnplTM1/4VDkhGDEpR3tEXFrTtWttA== X-Google-Smtp-Source: ABdhPJz5BnUhNhLDJi0P4L7ku+e+xjSBnNCi/0q8yMyjBmlUMgwVCxDxevWWQysEvj/biGVhTubDIw== X-Received: by 2002:a05:6000:154e:: with SMTP id 14mr652194wry.53.1632337964007; Wed, 22 Sep 2021 12:12:44 -0700 (PDT) Original-Received: from [192.168.178.20] (b2b-109-90-125-150.unitymedia.biz. [109.90.125.150]) by smtp.gmail.com with ESMTPSA id d8sm3311431wrv.80.2021.09.22.12.12.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 22 Sep 2021 12:12:43 -0700 (PDT) In-Reply-To: <52130eefb713942a36aa5717ef4c916173567ce3.camel@telenet.be> Content-Language: en-US Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=taylan.kammer@gmail.com; helo=mail-wr1-x432.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, NICE_REPLY_A=-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: guile-user@gnu.org X-Mailman-Version: 2.1.23 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" Xref: news.gmane.io gmane.lisp.guile.user:17777 Archived-At: On 21.09.2021 21:03, Maxime Devos wrote: > > (define (foo2 set?) > (define x) ; define an (undefined or unbound, not sure about terminology) variable > (if set? > (let () > (set! x 2) ; change the value of x > (display "x=") > (display x) > (newline)) > 'never) > (display x) > (newline)) > I didn't know (define x) without a value was possible in Guile. I guess it's just a shorthand for (define x *unspecified*), judging by your result. If I'm not mistaken, the only way in Scheme to get a "defined but not yet bound" kind of situation is to use 'letrec'. If you use the 'letrec*' variant, it guarantees a straight order of evaluation, so the following is supposed to definitely NOT work, due to y and z being defined-not-bound: (letrec* ((x (+ y z)) (y (random 10)) (z (random 10))) (display x) (newline)) However, in Guile, it seems to bind all the variables to # anyway, resulting in a "wrong type argument" error (since we end up passing # to '+') instead of saying that y and z are not yet bound. Long story short, there doesn't seem to be *any* way in Guile to have a lexical variable that's defined but not bound. -- Taylan