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.devel Subject: Re: new function Date: Sun, 19 Sep 2021 23:38:59 +0200 Message-ID: <147c2fb4-75d6-7cf6-4f4a-4edd996b0a4a@gmail.com> References: 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="11418"; 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 To: Damien Mattei , guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Sun Sep 19 23:39:39 2021 Return-path: Envelope-to: guile-devel@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 1mS4XD-0002j8-14 for guile-devel@m.gmane-mx.org; Sun, 19 Sep 2021 23:39:39 +0200 Original-Received: from localhost ([::1]:55276 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mS4XA-0002o2-AA for guile-devel@m.gmane-mx.org; Sun, 19 Sep 2021 17:39:36 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57180) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mS4We-0002nf-IZ for guile-devel@gnu.org; Sun, 19 Sep 2021 17:39:04 -0400 Original-Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:35601) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mS4Wc-0003fH-RE for guile-devel@gnu.org; Sun, 19 Sep 2021 17:39:04 -0400 Original-Received: by mail-wr1-x434.google.com with SMTP id i23so25254464wrb.2 for ; Sun, 19 Sep 2021 14:39:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=kzFpg8Rjv2LgGR1Y4wnWQchJk4Z7/uqF4OdGw6bGXGo=; b=cEdzqkhuq5O45jxVZ7lTPMjG+G66HYkMLVzv1wgZVpefMCp6ca8fAgbYcbyoouvr4m 7t+bGOOLdK7OvYM7GXm/2SMcFenEHZjHfPCKik4YdhmWqPllEaaYZ+MeAywMxkfaFgnn zA5Jo5kZIYN8L/eGZ7Y3rAQ0bP0V6n/BoJrET+UEeW/MxXmwPUfV40m4CuulCLJMtX+O TIuzmJ0W3rMdDRmFQrJeUZeaGcLeIBPdcU3qLKIzVL3UfgmyxjI+DahFmt/8KoR1/UoO t70PjEbOQ6x+3lJPukXVb33IVWxjJIwunjVs5iAXFNgN1BQOtt4f6wN62jt2nqpMVsaM UyWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=kzFpg8Rjv2LgGR1Y4wnWQchJk4Z7/uqF4OdGw6bGXGo=; b=rwUIy58vk1NQwk6RWgez1sMZWQKtNkX/XZOLsjd8kOZmMMg1OEjB9DuL8PTpZ2cbH0 KveVxi6R/Y+ncPbAxDSJoTCBzp+4emf21ZFJDJAFsXpatx09B2sFEJUFJZRELw4tvK7T VgQYHvUpWFRSAWWKhAACIQG/MyHbpe0TwmK2jWAxW6WW77J/MANwsdfHpPVbzUYFXb/a 3+2Uf9w15VE2h8fTjGYgQCpe9RxFX55wIQgcz2x4yPX2h58vU2kRuLXht/fUOu3sKJlN EW59Tf63YIkMF9v4RP1vyaZNQMcKyvfjrhknLP9swjvfV8jkWmRr7+BWc/Tl0vtihlj1 3Vtw== X-Gm-Message-State: AOAM5313ExpnQyLj2jYVTHC0rJyCkCVSxDkznTmaVh0aqfzO1JF0kyp6 7KVyaVykw5C4400tJuB8HgE4gZZO+YI= X-Google-Smtp-Source: ABdhPJxJP3TuFnzGydFvCQL795PLh0E7cEUxWvlD4yN6pg9NOLxPUb5l9DDm2hpCF1kOa6ZiAHi/3w== X-Received: by 2002:a05:6000:34a:: with SMTP id e10mr25174585wre.421.1632087540700; Sun, 19 Sep 2021 14:39:00 -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 w5sm13824174wra.87.2021.09.19.14.39.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 19 Sep 2021 14:39:00 -0700 (PDT) In-Reply-To: Content-Language: en-US Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=taylan.kammer@gmail.com; helo=mail-wr1-x434.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-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.io gmane.lisp.guile.devel:20867 Archived-At: On 19.09.2021 09:54, Damien Mattei wrote: > hello, > i'm developing an extension to Scheme > and i need a procedure or macro that define a variable only if it is not bind and if it is just set! it. > > I can not do it in Guile or any Scheme,and i'm desperately searching a way to do that. I finally conclude that it can be done only by adding it in the language. > > Can someone include a such function in Guile next release? > i know guile have a predicate defined? to test binfing of a vairable but writing a macro with it is not possible because define can be used in an expression context. > > Thank in advance for any help > Damien What is the utility of such a function? Since Scheme is lexically scoped, it's generally obvious whether a variable has already been defined or not, rendering such an operation useless. If you're constructing code from outside input so that you don't know whether a provided variable name represents a variable that's already been defined or not, then you could use the module reflection API: https://www.gnu.org/software/guile/manual/html_node/Module-System-Reflection.html Sounds like 'module-define!' does exactly what you ask for. I wonder what exactly your use-case is though. Chances are that your use-case is best served with a simple data structure like a hash table... -- Taylan