[pypy-dev] [pypy-svn] r44599 - in pypy/dist/pypy/lang/scheme: . test

Carl Friedrich Bolz cfbolz at gmx.de
Thu Jun 28 16:46:19 CEST 2007


Hi Jacub!

2007/6/28, jlg at codespeak.net <jlg at codespeak.net>:
> 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



More information about the Pypy-dev mailing list