[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Define variable only if it doesn't exist / is unbound
From: |
Thomas Morley |
Subject: |
Re: Define variable only if it doesn't exist / is unbound |
Date: |
Fri, 29 Mar 2019 12:06:46 +0100 |
Am Fr., 29. März 2019 um 11:48 Uhr schrieb Aaron Hill
<address@hidden>:
>
> On 2019-03-29 3:37 am, Thomas Morley wrote:
> > Am Fr., 29. März 2019 um 10:00 Uhr schrieb Richard Shann
> > <address@hidden>:
> >> This sounds like a problem I had when Denemo started running under
> >> Guile 2 - I asked on the guile mailing list and got fixed up with
> >> this:
> >>
> >> ;;; for guile 2.0 compatibility define the define-once procedure to
> >> work in guile 1.8
> >> (cond-expand
> >> (guile-2) ; nothing
> >> (else ; guile < 2.0
> >> (define-macro (define-once sym exp)
> >> `(define ,sym
> >> (if (module-locally-bound? (current-module) ',sym)
> >> ,sym
> >> ,exp)))))
> >>
> >> Apologies in advance if this is un-related, I've not been following
> >> this thread :(
> >>
> >> Richard
> >
> > Hi Richard,
> >
> > I tried to understand what you've got from the guile-list.
> >
> > Thus I opened a guilev2 prompt and simply typed cond-expand:
> >
> > scheme@(guile-user)> (version)
> > $1 = "2.2.4.9-71f536"
> > scheme@(guile-user)> cond-expand
> > While compiling expression:
> > Syntax error:
> > unknown location: source expression failed to match any pattern in
> > form cond-expand
> > scheme@(guile-user)>
> >
> > Well, ok, the guile-manual says:
> > 7.5.2 SRFI-0 - cond-expand
> > [...]
> >
> > So I tried:
> >
> > scheme@(guile-user)> (use-modules (srfi srfi-0))
> > While compiling expression:
> > no code for module (srfi srfi-0)
> >
> > What am I missing?
>
> Looks like srfi-0 is built into guile 2, so there is no module to use
> anymore.
>
> But cond-expand does work if you do something with it:
>
> scheme@(guile-user)> (cond-expand (guile-2 'hi))
> $2 = hi
>
> -- Aaron Hill
Yeah, I should have read a little more:
7.5.2 SRFI-0 - cond-expand
[...] There’s no module to load, this is in the Guile core.
Though, then I'd expect
scheme@(guile-user)> cond-expand
not returning an error.
But surely my expectations are wong.
Even
scheme@(guile-user)> if
errors.
:(
Harm
- Define variable only if it doesn't exist / is unbound, Pedro Pessoa, 2019/03/28
- Re: Define variable only if it doesn't exist / is unbound, Valentin Villenave, 2019/03/28
- Re: Define variable only if it doesn't exist / is unbound, Aaron Hill, 2019/03/28
- Re: Define variable only if it doesn't exist / is unbound, Thomas Morley, 2019/03/28
- Re: Define variable only if it doesn't exist / is unbound, Aaron Hill, 2019/03/28
- Re: Define variable only if it doesn't exist / is unbound, Richard Shann, 2019/03/29
- Re: Define variable only if it doesn't exist / is unbound, Thomas Morley, 2019/03/29
- Re: Define variable only if it doesn't exist / is unbound, Aaron Hill, 2019/03/29
- Re: Define variable only if it doesn't exist / is unbound,
Thomas Morley <=
- Re: Define variable only if it doesn't exist / is unbound, Thomas Morley, 2019/03/29
- Re: Define variable only if it doesn't exist / is unbound, Vaughan McAlley, 2019/03/30
Re: Define variable only if it doesn't exist / is unbound, Pedro Pessoa, 2019/03/28
Re: Define variable only if it doesn't exist / is unbound, David Kastrup, 2019/03/29