[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Guile library function availability
From: |
Thomas Morley |
Subject: |
Re: Guile library function availability |
Date: |
Mon, 24 May 2021 19:41:08 +0200 |
Am Mo., 24. Mai 2021 um 19:28 Uhr schrieb Lukas-Fabian Moser <lfm@gmx.de>:
>
> Hi,
>
> during my experiments with TextSpanners I stumbled upon the following:
>
> \version "2.22"
>
> \layout {
> \override NoteHead.after-line-breaking =
> #(lambda (grob) (pretty-print "I explode."))
> }
>
> {
> a4
> }
>
> explodes because pretty-print isn't available (the same happens for
> functions like "last" etc.)
>
> In contrast, the following works:
>
> \version "2.22"
>
> {
> \override NoteHead.after-line-breaking =
> #(lambda (grob) (pretty-print "I work just fine."))
>
> a4
> }
>
> What's the reason for the different availability of scheme library
> functions between working in \layout {} vs. in music?
>
> Lukas
>
>
I think in \paper and \layout is only vanilla-guile available (not sure though).
At least (ice-9 petty-print) is missing and (srfi srfi-1) as well.
I was always too lazy to research why and if it would be feasable to
include them.
For very short codings I workaround with, p.e.
#(define pretty-print pretty-print)
#(define last last)
\paper { #(pretty-print (last '(1 2))) }
{ b1 }
(ice-9 petty-print) and (srfi srfi-1) _are_ present in any ly-file!
For any longer coding I'd predefine things and only call them in paper
or layout. p.e.
#(define (xy) (pretty-print (last '(1 2))))
\paper { #(xy) }
{ b1 }
Cheers,
Harm