[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: new snippet: combine multimeasure rests
From: |
David Kastrup |
Subject: |
Re: new snippet: combine multimeasure rests |
Date: |
Fri, 19 Apr 2013 07:50:21 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
Shevek <address@hidden> writes:
> I just finished writing my first Scheme extension for Lilypond! It is a
> function to take a sequential music expression and condense consecutive
> multimeasure rests into a single multimeasure rest. Since this is my first
> attempt at Scheme, I'd love suggestions on how to improve it. One thing I'd
> like is to make this something that can be turned on with a single line in a
> layout block, instead of a function that needs to be included with every
> staff or voice.
>
> % \version "2.14.2"
> \version "2.16.0"
>
> #(define (add-durations dur1 dur2) (ly:duration? ly:duration?)
It is amusing that this works. define does not take type specifications
for its arguments, as opposed to define-music-function and
define-scheme-function. What happens is that (ly:duration?
ly:duration?) is called as the first statement in the function. It
checks whether ly:duration? is a duration and returns #f since it is
actually a function instead.
You do this several times. I'll look at the rest later.
--
David Kastrup