lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Comparing durations in Scheme


From: David Kastrup
Subject: Re: Comparing durations in Scheme
Date: Fri, 06 May 2011 07:42:59 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

"Christopher R. Maden" <address@hidden> writes:

> I am trying to tackle the swing music problem that someone posted about
> earlier; it arises in traditional Irish music as well.
>
> I’m blocked on detecting eighth-notes, though (or quavers for you Brits).
>
> It seems like this should work (event is an EventChord):
>
>   (eq?
>    (ly:music-property
>     (car (ly:music-property
>           event
>           'elements))
>     'duration)
>    (ly:make-duration 3 0 1 1))
>
> However, this seems to return #f all the time, regardless of what event
> actually has.  If I use (eq? (ly:duration-log ...) 3), it works, so I
> know I am getting a duration.  Do I have to actually compare
> duration-log, duration-dot, and duration-factor?  That seems a bit annoying.
>
> What am I missing?

The guile manual?  eq? compares for identity, not equality of objects.
Composite objects constructed independently are not identical.

-- 
David Kastrup




reply via email to

[Prev in Thread] Current Thread [Next in Thread]