]> git.donarmstrong.com Git - lilypond.git/commit
Fix `split-at-predicate' in `scm/lily-library.scm'.
authorThomas Morgan <tlm@ziiuu.com>
Thu, 12 Nov 2009 20:07:58 +0000 (20:07 +0000)
committerNeil Puttock <n.puttock@gmail.com>
Thu, 12 Nov 2009 20:15:01 +0000 (20:15 +0000)
commitcaf6f697cc296afe42de14fc7296e3a27f8e1cf9
tree390ee3462964c09bfe7299ab8c190ddbafe4ca6c
parent277328098ac34dfdefef64ea797b4eadc4aa05b8
Fix `split-at-predicate' in `scm/lily-library.scm'.

Don't make the assumption that if `(PRED previous_element element)'
is false, `(PRED element previous_element)' must be true.

Suppose we want to split `(1 2 3 5 7)' into two lists such that
the first list contains the initial consecutive integers `(1 2 3)'
and the second contains the remaining elements `(5 7)'.  We expect
`(split-at-predicate (lambda (x y) (= (- y x) 1)) '(1 2 3 5 7))'
to return `((1 2 3) . (5 7))', but in fact it returns `((1 2 3 5 7))'
because of this erroneous assumption.
scm/lily-library.scm