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)>