Re: [PATCH] Make some local functions public (was: Re: lily-library.scm question)

2009-06-24 Thread Mark Polesky
Carl D. Sorensen wrote: > > I *am* interested in helping with this, but could someone apply my > > final patch on this? > > http://lists.gnu.org/archive/html/lilypond-devel/2009-06/msg00528.html > > > > It's been almost a month since I started with this... > > http://lists.gnu.org/archive/html/li

Re: [PATCH] Make some local functions public (was: Re: lily-library.scm question)

2009-06-24 Thread Carl D. Sorensen
On 6/24/09 10:36 AM, "Mark Polesky" wrote: > > > Han-Wen Nienhuys wrote: (eq? (split-at-predicate odd? '(2 3 6 8 9 0)) '((2) (6 8) (0))) holds. It would be .ly file that runs Scheme function on a set of inputs, and compares them to a set of outputs to make

Re: [PATCH] Make some local functions public (was: Re: lily-library.scm question)

2009-06-24 Thread Carl D. Sorensen
On 6/23/09 11:48 PM, "Mark Polesky" wrote: > > > Han-Wen Nienhuys wrote: >> I mean to have an automated set of tests, that checks for example that >> >> (eq? (split-at-predicate odd? '(2 3 6 8 9 0)) >>'((2) (6 8) (0))) >> >> holds. It would be .ly file that runs Scheme function

Re: [PATCH] Make some local functions public (was: Re: lily-library.scm question)

2009-06-24 Thread Mark Polesky
Han-Wen Nienhuys wrote: > >> (eq? (split-at-predicate odd? '(2 3 6 8 9 0)) > >>'((2) (6 8) (0))) > >> > >> holds. It would be .ly file that runs Scheme function on a > >> set of inputs, and compares them to a set of outputs to make > >> sure that they match. > > > > I second that, but w

Re: [PATCH] Make some local functions public (was: Re: lily-library.scm question)

2009-06-24 Thread Han-Wen Nienhuys
On Wed, Jun 24, 2009 at 4:18 AM, Jan Nieuwenhuizen wrote: >> (eq? (split-at-predicate odd?   '(2 3 6 8 9 0)) >>        '((2) (6 8) (0))) >> >> holds.  It would be .ly file that runs Scheme function on a set of >> inputs, and compares them to a set of outputs to make sure that they >> match. > > I

Re: [PATCH] Make some local functions public (was: Re: lily-library.scm question)

2009-06-24 Thread Jan Nieuwenhuizen
Op woensdag 24-06-2009 om 02:08 uur [tijdzone -0300], schreef Han-Wen Nienhuys: > I mean to have an automated set of tests, that checks for example that > > > (eq? (split-at-predicate odd? '(2 3 6 8 9 0)) >'((2) (6 8) (0))) > > holds. It would be .ly file that runs Scheme function on

Re: [PATCH] Make some local functions public (was: Re: lily-library.scm question)

2009-06-23 Thread Mark Polesky
Han-Wen Nienhuys wrote: > I mean to have an automated set of tests, that checks for example that > > (eq? (split-at-predicate odd? '(2 3 6 8 9 0)) >'((2) (6 8) (0))) > > holds. It would be .ly file that runs Scheme function on a set of > inputs, and compares them to a set of outputs t

Re: [PATCH] Make some local functions public (was: Re: lily-library.scm question)

2009-06-23 Thread Han-Wen Nienhuys
On Tue, Jun 23, 2009 at 6:12 PM, Mark Polesky wrote: >> Maybe you guys can look into making a test framework for the >> Scheme library functions. >> >> It should be fairly simple to check the functions (like you do >> here ad-hoc) in a separate .scm file that is loaded if you run >> ly/test-scm-fu

Re: [PATCH] Make some local functions public (was: Re: lily-library.scm question)

2009-06-23 Thread Mark Polesky
Han-Wen Nienhuys wrote: > > I also took a look at the next procedure, > > split-list-by-separator. My revised version is below. Unless I > > hear otherwise, I'll send a patch soon. > > Maybe you guys can look into making a test framework for the > Scheme library functions. > > It should be fairly

Re: [PATCH] Make some local functions public (was: Re: lily-library.scm question)

2009-06-23 Thread Han-Wen Nienhuys
On Tue, Jun 23, 2009 at 4:07 PM, Mark Polesky wrote: > > I also took a look at the next procedure, split-list-by-separator. > My revised version is below. Unless I hear otherwise, I'll send a > patch soon. Maybe you guys can look into making a test framework for the Scheme library functions. It s

Re: [PATCH] Make some local functions public

2009-06-23 Thread Mark Polesky
Here's a patch. I retained the definition styles: (define (split-at-predicate ... (define-public (split-list-by-separator ... I'd like to change certain other procedures from define to define-public (review this thread for more details), but I'll do that in a separate patch once this one gets ap

Re: [PATCH] Make some local functions public (was: Re: lily-library.scm question)

2009-06-23 Thread Mark Polesky
I also took a look at the next procedure, split-list-by-separator. My revised version is below. Unless I hear otherwise, I'll send a patch soon. - Mark ;; current version (define-public (split-list-by-separator lst sep?) "(display (split-list-by-separator '(a b c / d e f / g) (lambda (x) (equ

Re: [PATCH] Make some local functions public (was: Re: lily-library.scm question)

2009-06-22 Thread Mark Polesky
Jay Anderson wrote: > Actually, I like this much better. A couple things: > - It doesn't handle an empty list as input. Or is an error the correct > behavior? > - I'm not the biggest fan of multiple return values. You could do > (cons (take lst (1+ i)) (drop lst (1+ i))) instead (unless there ar

Re: [PATCH] Make some local functions public (was: Re: lily-library.scm question)

2009-06-22 Thread Jay Anderson
On Mon, Jun 22, 2009 at 6:03 PM, Mark Polesky wrote: > I know, I know, I just won't let this die. I rewrote this silly > function yet again (by now it's more of a programming exercise > than anything else). But the things I've learned from everyone so > far have found their way into my other LilyPo

Re: [PATCH] Make some local functions public (was: Re: lily-library.scm question)

2009-06-22 Thread Mark Polesky
Jay Anderson wrote: > > last-pair is an O(n) operation, since it has to traverse the whole list, > > making split-at-predicate O(n^2) instead of O(n), as it should be. You'd be > > better off building L0 backwards and reversing it at the end, so that the > > element you need is always at the begi

Re: [PATCH] Make some local functions public

2009-06-16 Thread Mark Polesky
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 th

Re: [PATCH] Make some local functions public (was: Re: lily-library.scm question)

2009-06-16 Thread Jay Anderson
On Mon, Jun 15, 2009 at 3:03 AM, Joe Neeman wrote: > > On Mon, Jun 8, 2009 at 3:59 AM, Mark Polesky wrote: >> >> my version: >> >> (define-public (split-at-predicate predicate lst) >>  "Split LST (into 2 lists) at the first element that returns #f for >>   (PREDICATE previous_element element), and

Re: [PATCH] Make some local functions public (was: Re: lily-library.scm question)

2009-06-15 Thread Joe Neeman
On Mon, Jun 8, 2009 at 3:59 AM, Mark Polesky wrote: > my version: > > (define-public (split-at-predicate predicate lst) > "Split LST (into 2 lists) at the first element that returns #f for > (PREDICATE previous_element element), and return the 2 new lists as a > pair. Example: (split-at-pre

Re: [PATCH] Make some local functions public (was: Re: lily-library.scm question)

2009-06-14 Thread Mark Polesky
Anyone want to double-check (and apply) my rewrite of split-at-predicate? http://lists.gnu.org/archive/html/lilypond-devel/2009-06/msg00226.html Thanks - Mark ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailm

Re: [PATCH] Make some local functions public (was: Re: lily-library.scm question)

2009-06-07 Thread Mark Polesky
Neil Puttock wrote: > -(define (split-at-predicate predicate lst) > +(define-public (split-at-predicate predicate lst) > > Can you amend the docstring for this, since the example given is > a bit broken (the cons part shouldn't be there): > > (split-at-predicate (lambda (x y) (= (- y x) 2)) '(1 3 5

Re: [PATCH] Make some local functions public (was: Re: lily-library.scm question)

2009-06-07 Thread Neil Puttock
2009/6/4 Patrick McCarty : > The "print-book-with" procedure is pretty specialized, but I don't see > any harm in making it public. It's a helper function for print-book-with-defaults and print-book-with-defaults-as-systems, so there's no need to make it public. -(define (split-at-predicate pred

Re: [PATCH] Make some local functions public (was: Re: lily-library.scm question)

2009-06-04 Thread Patrick McCarty
On Sat, May 30, 2009 at 1:08 AM, Mark Polesky wrote: > Patrick McCarty wrote: >> I don't know if there is any performance penalty, but it's probably >> negligible.  You could propose that these procedures be made public; I >> am okay with it. > > Then if no one has any reservations, does anyone wa

[PATCH] Make some local functions public (was: Re: lily-library.scm question)

2009-05-30 Thread Mark Polesky
Patrick McCarty wrote: > I don't know if there is any performance penalty, but it's probably > negligible. You could propose that these procedures be made public; I > am okay with it. Then if no one has any reservations, does anyone want to apply this? - Mark 0005-lily-library.scm-Mak