Am Do., 28. März 2019 um 22:22 Uhr schrieb Aaron Hill
<lilyp...@hillvisions.com>:
>
> On 2019-03-28 2:18 pm, Valentin Villenave wrote:
> > On 3/28/19, Pedro Pessoa <pedrops...@gmail.com> wrote:
> >> I imagined something like:
> >>
> >> %%% pseudo
> >> #(define var
> >>     (not (is-bound? var) 0))
> >> %%%
> >
> > I’d probably probably do something like
> >
> > (null? (ly:parser-lookup 'var))
> >
> > But I’m sure there are better ways :-)
>
> ;;;;
> (if (not (defined? 'foo)) (define foo 47))
> ;;;;
>
>
> -- Aaron Hill

It's worth mentioning, the above will throw an error in guilev2:

error: GUILE signaled an error for the expression beginning here
#
 (if (not (defined? 'foo)) (define foo 47))
definition in expression context, where definitions are not allowed

Probably better get used to below:

#(if (not (defined? 'foo)) (ly:parser-define! 'foo 47))

Cheers,
  Harm

_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to