Jay Anderson wrote: > Also it should avoid length when a null? check will do. Here's the > function with those changes: > > (define-public (split-at-predicate predicate lst) > "Split a list into 2 lists at the first element that returns #f for > (predicate previous_element element). Return the two parts as a pair. > Example: (split-at-predicate < '(1 2 3 2 1)) ==> ((1 2 3) . (2 1))" > (if (or (null? lst) (null? (cdr lst))) > (list lst) > (let loop ((lst-a (list (car lst))) (lst-b (cdr lst))) > (cond ((null? lst-b) (list lst)) > ((predicate (car lst-a) (car lst-b)) > (loop (cons (car lst-b) lst-a) (cdr lst-b))) > (else (cons (reverse lst-a) lst-b))))))
Jay and Joe, thanks for you help. Now, if there are no more objections, anyone want to apply the new patches? Thanks! - Mark
0001-lily-library.scm-Rewrite-split-at-predicate-procedur.patch
Description: Binary data
0002-lily-library.scm-Make-some-local-functions-public.patch
Description: Binary data
_______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel