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))
>
Damien Mattei schreef op wo 22-09-2021 om 09:52 [+0200]:
> i do not understand well what you want to mean with those example.
> For me define-once does not seems to be a solution, it act as define too
> much
> ,does not set! variable if already exist and can not use to set it again
> because,
>
i do not understand well what you want to mean with those example.
For me define-once does not seems to be a solution, it act as define too
much ,does not set! variable if already exist and can not use to set it
again because, as define it is forbidden twice in the same block for the
same variable
Damien Mattei schreef op di 21-09-2021 om 15:04 [+0200]:
> i have tested define-once
> http://www.gnu.org/software/guile/docs/master/guile.html/Top-Level.html
> (the defvar of Lisp)and idea are:
> -unfortunately it is considered by scheme as a define,so there is some
> context where it is not allow
i have tested define-once
http://www.gnu.org/software/guile/docs/master/guile.html/Top-Level.html
(the defvar of Lisp)and idea are:
-unfortunately it is considered by scheme as a define,so there is some
context where it is not allowed in my code
-seems to work fine at toplevel (as mentioned in doc)
Matt Wette schreef op zo 19-09-2021 om 07:45 [-0700]:
> On 9/19/21 3:38 AM, Maxime Devos wrote:
> > [...]
> > (use-modules (system syntax))
> > (define-syntax define-or-set!
> >(lambda (s)
> > (syntax-case s ()
> >((_ var value)
> > (case (syntax-local-binding #'var)
> >
On 9/19/21 3:38 AM, Maxime Devos wrote:
Damien Mattei schreef op zo 19-09-2021 om 11:18 [+0200]:
-- Forwarded message -
From: Damien Mattei
Date: Sun, Sep 19, 2021 at 9:54 AM
Subject: new function
To:
hello,
i'm developing an extension to Scheme
and i need a procedure or m
Damien Mattei schreef op zo 19-09-2021 om 11:18 [+0200]:
> -- Forwarded message -
> From: Damien Mattei
> Date: Sun, Sep 19, 2021 at 9:54 AM
> Subject: new function
> To:
>
>
> hello,
> i'm developing an extension to Scheme
> and i need a procedure or macro that define a variabl
-- Forwarded message -
From: Damien Mattei
Date: Sun, Sep 19, 2021 at 9:54 AM
Subject: new function
To:
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