On Wed, May 27, 2009 at 9:11 AM, Derick Eddington <[email protected]> wrote: > On Wed, 2009-05-27 at 05:49 +0200, Michele Simionato wrote: >> http://www.artima.com/weblogs/viewpost.jsp?thread=249198 > > The curried-lambda in that article is broken (IMO) because > (curried-lambda () b b* ...) > expands to > (begin b b* ...) > > This expansion also breaks (define-curried (f) ---). Even though no one > should directly use curried-lambda or define-curried with zero > arguments, it's still broken because macros should be fully general so > they can be built upon by, say, other macros which expand to using > curried-lambda or define-curried and the zero-argument case can happen. > > Also, I consider it inadequate because it doesn't handle "rest" > arguments and because it requires applying one argument at a time (like > Ramana mentioned).
My curried-lambda does exactly what I wanted it to do. In particular I *wanted* curried-lambda with no arguments to return an expression, which I see as a zero-order function: > (define-curried (f3 x1 x2 x3) "third-order") > (((f3 1) 2) 3) ;; 3 parens here "third-order" > (define-curried (f2 x1 x2) "second-order") > ((f2 1) 2) ;; 2 parens here "second-order" > (define-curried (f1 x1) "first-order") > (f1 1) ;; 1 parens here "first-order" > (define-curried (f0) "zero-order") > f0 ;; 0 parens here "zero-order"
