unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Creating a top level definition if none so far exists, on the fly.
@ 2013-08-15 10:57 Richard Shann
  2013-08-15 11:10 ` rixed
  2013-08-15 11:18 ` Mike Gran
  0 siblings, 2 replies; 7+ messages in thread
From: Richard Shann @ 2013-08-15 10:57 UTC (permalink / raw)
  To: guile-user


I have just started using GNU/Denemo under the guile 2.x and the
following construct no longer works:

(if (not (defined? 'ToggleFiguredBassMode::Active))
    (define ToggleFiguredBassMode::Active #f))

The intention is to have a variable defined at the top level which
starts out being #f. The need for the construct arose because it
appears in a self-contained script which cannot expect an
initialization step to have been performed.
Is there a straight-forward way to modify this?

Richard



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Creating a top level definition if none so far exists, on the fly.
  2013-08-15 10:57 Creating a top level definition if none so far exists, on the fly Richard Shann
@ 2013-08-15 11:10 ` rixed
  2013-08-15 11:18 ` Mike Gran
  1 sibling, 0 replies; 7+ messages in thread
From: rixed @ 2013-08-15 11:10 UTC (permalink / raw)
  To: guile-user

> (if (not (defined? 'ToggleFiguredBassMode::Active))
>     (define ToggleFiguredBassMode::Active #f))
> 
> The intention is to have a variable defined at the top level which
> starts out being #f. The need for the construct arose because it
> appears in a self-contained script which cannot expect an
> initialization step to have been performed.
> Is there a straight-forward way to modify this?

(define ToggleFiguredBassMode::Active
  (if (defined? 'ToggleFiguredBassMode::Active)
      ToggleFiguredBassMode::Active
      #f))

Nothing to feer I guess.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Creating a top level definition if none so far exists, on the fly.
  2013-08-15 10:57 Creating a top level definition if none so far exists, on the fly Richard Shann
  2013-08-15 11:10 ` rixed
@ 2013-08-15 11:18 ` Mike Gran
  2013-08-15 12:08   ` Richard Shann
  1 sibling, 1 reply; 7+ messages in thread
From: Mike Gran @ 2013-08-15 11:18 UTC (permalink / raw)
  To: Richard Shann, guile-user@gnu.org

> From: Richard Shann <richard.shann@virgin.net>
> 
> I have just started using GNU/Denemo under the guile 2.x and the
> following construct no longer works:
> 
> (if (not (defined? 'ToggleFiguredBassMode::Active))
>     (define ToggleFiguredBassMode::Active #f))

I remember Andy once suggested on this list that
 
(define-once ...) 
 
is a possible replacement for the
 
(if (not (defined? ...)
     (define ...))
 
construction
 
-Mike 



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Creating a top level definition if none so far exists, on the fly.
  2013-08-15 11:18 ` Mike Gran
@ 2013-08-15 12:08   ` Richard Shann
  2013-08-15 12:17     ` Mike Gran
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Shann @ 2013-08-15 12:08 UTC (permalink / raw)
  To: Mike Gran; +Cc: guile-user@gnu.org

On Thu, 15 Aug 2013 04:18:52 -0700 (PDT)
Mike Gran <spk121@yahoo.com> wrote:

> > From: Richard Shann <richard.shann@virgin.net>
> > 
> > I have just started using GNU/Denemo under the guile 2.x and the
> > following construct no longer works:
> > 
> > (if (not (defined? 'ToggleFiguredBassMode::Active))
> >     (define ToggleFiguredBassMode::Active #f))
> 
> I remember Andy once suggested on this list that
>  
> (define-once ...) 

Thank you! that works perfectly. Now there is the question of
supporting both guile 2.0 and 1.8 users. I seem to remember this came
up in another context, but unfortunately upgrading to Debian Wheezy has
lost me any easy access to my old emails.
I'll have a delve around to see if it can be done, but if anyone just
knows off the top of their head please say.

Richard



>  
> is a possible replacement for the
>  
> (if (not (defined? ...)
>      (define ...))
>  
> construction
>  
> -Mike  




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Creating a top level definition if none so far exists, on the fly.
  2013-08-15 12:08   ` Richard Shann
@ 2013-08-15 12:17     ` Mike Gran
  2013-08-15 13:37       ` Richard Shann
  0 siblings, 1 reply; 7+ messages in thread
From: Mike Gran @ 2013-08-15 12:17 UTC (permalink / raw)
  To: Richard Shann; +Cc: guile-user@gnu.org



> From: Richard Shann <richard.shann@virgin.net>
>>  > From: Richard Shann <richard.shann@virgin.net>
>>  > 
>>  > I have just started using GNU/Denemo under the guile 2.x and the
>>  > following construct no longer works:
>>  > 
>>  > (if (not (defined? 'ToggleFiguredBassMode::Active))
>>  >     (define ToggleFiguredBassMode::Active #f))
>> 
>>  I remember Andy once suggested on this list that
>>   
>>  (define-once ...) 
> 
> Thank you! that works perfectly. Now there is the question of
> supporting both guile 2.0 and 1.8 users. I seem to remember this came
> up in another context, but unfortunately upgrading to Debian Wheezy has
> lost me any easy access to my old emails.
> I'll have a delve around to see if it can be done, but if anyone just
> knows off the top of their head please say.

Try looking at the various responses to this thread

http://lists.gnu.org/archive/html/guile-user/2013-02/msg00173.html

-Mike



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Creating a top level definition if none so far exists, on the fly.
  2013-08-15 12:17     ` Mike Gran
@ 2013-08-15 13:37       ` Richard Shann
  2013-09-07  9:48         ` Andy Wingo
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Shann @ 2013-08-15 13:37 UTC (permalink / raw)
  To: Mike Gran; +Cc: guile-user@gnu.org

On Thu, 15 Aug 2013 05:17:49 -0700 (PDT)
Mike Gran <spk121@yahoo.com> wrote:

> 
> 
> > From: Richard Shann <richard.shann@virgin.net>
> >>  > From: Richard Shann <richard.shann@virgin.net>
> >>  > 
> >>  > I have just started using GNU/Denemo under the guile 2.x and the
> >>  > following construct no longer works:
> >>  > 
> >>  > (if (not (defined? 'ToggleFiguredBassMode::Active))
> >>  >     (define ToggleFiguredBassMode::Active #f))
> >> 
> >>  I remember Andy once suggested on this list that
> >>   
> >>  (define-once ...) 
> > 
> > Thank you! that works perfectly. Now there is the question of
> > supporting both guile 2.0 and 1.8 users. I seem to remember this
> > came up in another context, but unfortunately upgrading to Debian
> > Wheezy has lost me any easy access to my old emails.
> > I'll have a delve around to see if it can be done, but if anyone
> > just knows off the top of their head please say.
> 
> Try looking at the various responses to this thread
> 
> http://lists.gnu.org/archive/html/guile-user/2013-02/msg00173.html
>

Hmm, so I asked about this before in February. Gives me an idea of the
extent of my memory span - it didn't even ring a bell. (I should
explain that I didn't myself have a guile 2.0 system at the time so I
was sorting this all out as a proxy for someone else...)
The consequence was that I didn't know of the other half dozen uses of
that construct which have persisted until now.

Well, thank you for not bawling me out.

Richard


> -Mike




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Creating a top level definition if none so far exists, on the fly.
  2013-08-15 13:37       ` Richard Shann
@ 2013-09-07  9:48         ` Andy Wingo
  0 siblings, 0 replies; 7+ messages in thread
From: Andy Wingo @ 2013-09-07  9:48 UTC (permalink / raw)
  To: Richard Shann; +Cc: guile-user@gnu.org, Mike Gran

On Thu 15 Aug 2013 15:37, Richard Shann <richard.shann@virgin.net> writes:

> Hmm, so I asked about this before in February. Gives me an idea of the
> extent of my memory span - it didn't even ring a bell.

You know, I forgot about the answer too ;-)

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-09-07  9:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-15 10:57 Creating a top level definition if none so far exists, on the fly Richard Shann
2013-08-15 11:10 ` rixed
2013-08-15 11:18 ` Mike Gran
2013-08-15 12:08   ` Richard Shann
2013-08-15 12:17     ` Mike Gran
2013-08-15 13:37       ` Richard Shann
2013-09-07  9:48         ` Andy Wingo

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