unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Matt Wette <matt.wette@gmail.com>
To: guile-devel@gnu.org
Subject: Re: new function
Date: Sun, 19 Sep 2021 07:43:17 -0700	[thread overview]
Message-ID: <89eacc31-9476-fc52-ef22-a4de293fce2c@gmail.com> (raw)
In-Reply-To: <de198fc0-7f0a-b5d3-3f65-4596f9cb4f0f@gmail.com>



On 9/19/21 7:41 AM, Matt Wette wrote:
> On 9/19/21 12:54 AM, 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
>
> Check the manual.
>
> scheme@(guile-user)> (define-once a 1)
> scheme@(guile-user)> (define-once a 2)
> scheme@(guile-user)> a
> $1 = 1
> scheme@(guile-user)>
>

Sorry.  I misread your post.   How about this:

mwette$ guile
scheme@(guile-user)> (define-once a 1)
scheme@(guile-user)> (define-once a 2)
scheme@(guile-user)> a
$1 = 1

scheme@(guile-user)> (define a 1)
scheme@(guile-user)> (define a 2)
scheme@(guile-user)> a
$2 = 2
scheme@(guile-user)>






  reply	other threads:[~2021-09-19 14:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-19  7:54 new function Damien Mattei
2021-09-19 14:41 ` Matt Wette
2021-09-19 14:43   ` Matt Wette [this message]
2021-09-19 21:38 ` Taylan Kammer
2021-09-21 12:26   ` Damien Mattei
2021-09-22  8:44   ` Damien Mattei
2021-09-22  9:06     ` William ML Leslie
2021-09-22  9:53       ` Damien Mattei
2021-09-22 18:51         ` Taylan Kammer
2021-09-22 21:52           ` William ML Leslie
2021-09-23  8:40             ` Damien Mattei
2021-09-23 19:03             ` Taylan Kammer
2021-09-23 17:27           ` Damien Mattei
2021-09-23 18:00             ` Maxime Devos
2021-09-23 20:27             ` Taylan Kammer
2021-09-23 20:42               ` Damien Mattei
2021-09-23 20:48               ` Taylan Kammer
2021-09-23 21:53                 ` Damien Mattei
2021-09-24  4:41                   ` Damien Mattei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=89eacc31-9476-fc52-ef22-a4de293fce2c@gmail.com \
    --to=matt.wette@gmail.com \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).