On 2019-03-02 3:11 am, Thomas Morley wrote:
fold, reduce any many other procedures are not part of core-guile, but
of the SRFI-1 module.
Nowadays SRFI-1 is present in every ly-file. Not in \paper and \layout,
though.
That's what I get for not reading the Guile docs closely enough. I knew
the section was within SRFI-1, but it was titled "Fold, Unfold & Map".
Since map appeared to work, I assumed that SRFI-1 was included and
something was amiss with fold/reduce. But I now see that map "is
extended with respect to R5RS, because the argument lists may have
different lengths."
That got me thinking. Since SRFI-1 defines its own map, the one in
\layout or \paper would be the core R5RS version and not take kindly to
lists of differing lengths:
%%%%
\version "2.19.82"
#(display (map + '(1 2 3) '(1 2 3 4)))
\paper { #(display (map + '(1 2 3) '(1 2 3 4))) }
%%%%
Sure enough:
====
GNU LilyPond 2.19.82
Processing `map-srfi-1.ly'
Parsing...(2 4 6)
map-srfi-1.ly:3:11: error: GUILE signaled an error for the expression
beginning
here
\paper { #
(display (map + '(1 2 3) '(1 2 3 4))) }
Argument 3 out of range: (1 2 3 4)
fatal error: failed files: "map-srfi-1.ly"
The terminal process terminated with exit code: 1
====
I don't know how one could change it.
Thus I usually define things outside from layout/paper:
It seems \header and \midi also fail like \layout and \paper, so that is
a perfectly reasonable approach to completely avoid these issues.
For fun, I tried adding an explicit use-modules:
%%%%
\version "2.19.82"
\paper {
#(use-modules (srfi srfi-1))
#(display (map + '(1 2 3) '(1 2 3 4)))
}
%%%%
====
GNU LilyPond 2.19.82
Processing `map-srfi-1.ly'
Parsing...WARNING: #f: `break' imported from both #f and (srfi srfi-1)
(2 4 6)
Success: compilation successfully completed
====
Nope. I don't like the look of that warning. :-/
-- Aaron Hill
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user