[pypy-commit] lang-scheme default: Add another helper function

boemmels noreply at buildbot.pypy.org
Sat Dec 3 18:22:03 CET 2011


Author: Juergen Boemmels <boemmels at web.de>
Branch: 
Changeset: r28:ebb0242d9706
Date: 2011-12-03 17:52 +0100
http://bitbucket.org/pypy/lang-scheme/changeset/ebb0242d9706/

Log:	Add another helper function

diff --git a/scheme/object.py b/scheme/object.py
--- a/scheme/object.py
+++ b/scheme/object.py
@@ -634,6 +634,18 @@
 
     return w_cdr
 
+def lst2plst(w_list):
+    """coverts W_Pair scheme list into a python list() of W_Root"""
+    lst = []
+    w_iter = w_list
+    while w_iter is not w_nil:
+        if not isinstance(w_iter, W_Pair):
+            raise WrongArg(w_list, "List")
+        lst.append(w_iter.car)
+        w_iter = w_iter.cdr
+
+    return lst
+
 ##
 # Continuations
 ##


More information about the pypy-commit mailing list