[pypy-svn] r44601 - in pypy/dist/pypy/lang/scheme: . test
jlg at codespeak.net
jlg at codespeak.net
Thu Jun 28 16:18:20 CEST 2007
Author: jlg
Date: Thu Jun 28 16:18:19 2007
New Revision: 44601
Modified:
pypy/dist/pypy/lang/scheme/TODO.txt
pypy/dist/pypy/lang/scheme/object.py
pypy/dist/pypy/lang/scheme/test/test_object.py
Log:
all scheme objects .to_boolean() is True but #f
Modified: pypy/dist/pypy/lang/scheme/TODO.txt
==============================================================================
--- pypy/dist/pypy/lang/scheme/TODO.txt (original)
+++ pypy/dist/pypy/lang/scheme/TODO.txt Thu Jun 28 16:18:19 2007
@@ -17,10 +17,12 @@
(symbol? var) -> #f
(symbol? 'var) -> #t
+- control structures
+ - boolean
+
Do next
-------
-- control structures
- functions
- implement key funcions
(apply, reduce, mapcar and so on)
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 16:18:19 2007
@@ -5,7 +5,7 @@
return ''
def to_boolean(self):
- return False
+ return True
def __str__(self):
return self.to_string() + "W"
Modified: pypy/dist/pypy/lang/scheme/test/test_object.py
==============================================================================
--- pypy/dist/pypy/lang/scheme/test/test_object.py (original)
+++ pypy/dist/pypy/lang/scheme/test/test_object.py Thu Jun 28 16:18:19 2007
@@ -14,18 +14,21 @@
str = "Hello World!"
w_str = W_String(str)
assert str == w_str.to_string()
+ assert w_str.to_boolean() is True
def test_fixnum():
num = 12345
w_num = W_Fixnum(num)
assert num == w_num.to_fixnum()
assert float(num) == w_num.to_float()
+ assert w_num.to_boolean() is True
def test_float():
num = 12345.567
w_num = W_Float(num)
assert num == w_num.to_float()
assert int(num) == w_num.to_fixnum()
+ assert w_num.to_boolean() is True
def test_pair():
c1 = W_Fixnum(1)
@@ -39,14 +42,18 @@
assert p.cdr.car == c2
assert p.cdr.cdr.car == c3
assert p.cdr.cdr.cdr == c4
+ assert p.to_boolean() is True
+ assert c4.to_boolean() is True
def test_symbol():
w_sym = W_Symbol("symb")
assert w_sym.to_string() == "symb"
+ assert w_sym.to_boolean() is True
def test_symbol():
w_id = W_Identifier("ident")
assert w_id.to_string() == "ident"
+ assert w_id.to_boolean() is True
def test_ctx():
w_fnum = W_Fixnum(12)
More information about the Pypy-commit
mailing list