Hi Jacub! 2007/6/28, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > Author: jlg > Date: Thu Jun 28 15:49:30 2007 > New Revision: 44599 > > Modified: > pypy/dist/pypy/lang/scheme/TODO.txt > pypy/dist/pypy/lang/scheme/object.py > pypy/dist/pypy/lang/scheme/test/test_parser.py > Log: > RPython direction for object.py > > Modified: pypy/dist/pypy/lang/scheme/object.py > ============================================================================== > --- pypy/dist/pypy/lang/scheme/object.py (original) > +++ pypy/dist/pypy/lang/scheme/object.py Thu Jun 28 15:49:30 2007 > @@ -139,10 +139,16 @@ > raise NotImplementedError > > def add_lst(ctx, lst): > - return apply_lst(ctx, lambda x, y: x + y, lst) > + def adder(x, y): > + return x + y > + > + return apply_lst(ctx, adder, lst) > > def mul_lst(ctx, lst): > - return apply_lst(ctx, lambda x, y: x * y, lst) > + def multiplier(x, y): > + return x * y > + > + return apply_lst(ctx, multiplier, lst) > > def apply_lst(ctx, fun, lst): > acc = None >
This doesn't make mul_lst and add_lst any more rpython than before. In fact, lambda is fully rpython. The problem with this code is rather that you cannot have local functions in RPython. As I said, don't worry about making your code RPython too much yet. Cheers, Carl Friedrich _______________________________________________ [email protected] http://codespeak.net/mailman/listinfo/pypy-dev
