Mon, 22 Mar 2004 12:51:12 -0600, Douglas a dit : >> (define (iterate func k) >> "Produce the function x -> FUNC(FUNC .. (x) .. ) " >> (if (> k 0) >> (lambda (x) (func ((iterate func (1- k)) x))) >> (lambda (x) x))) >> >> (define to-6th-power (iterate sqr 3)) >> >> If you're suitably masochistic, then you could come up with a C++ >> solution, but I doubt it would be natural or elegant. Besides, I don't >> appreciate masochism when it comes to programming.
> The C++ solution is both natural and elegant. Two example solutions follow, the > first not using templates, the second using templates. > [snip code] hm... "both natural and elegant"... Are you realizing that writing classes for everything is not natural, nor eleguant? Other programming paradigms do exist, and are notably more natural and eleguant for that particular problem. Your examples are very bright indeed, but a full page of C++ code against 5 lines of scheme code, is not very demonstrative. nicolas _______________________________________________ Lilypond-devel mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/lilypond-devel