Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
915d8861
Commit
915d8861
authored
Nov 02, 2010
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test cleanup
parent
a22a763f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
34 deletions
+44
-34
tests/run/lambda_T195.pyx
tests/run/lambda_T195.pyx
+44
-34
No files found.
tests/run/lambda_T195.pyx
View file @
915d8861
...
@@ -2,67 +2,77 @@ __doc__ = u"""
...
@@ -2,67 +2,77 @@ __doc__ = u"""
#>>> py_identity = lambda x:x
#>>> py_identity = lambda x:x
#>>> py_identity(1) == cy_identity(1)
#>>> py_identity(1) == cy_identity(1)
#True
#True
>>> idcall = make_identity()
>>> idcall(1)
1
>>> idcall(2)
2
>>> make_const0(1)()
1
>>> make_const1(1)(2)
1
>>> make_const1(1)(2)
1
>>> make_const_calc0()()
11
>>> make_const_calc1()(2)
11
>>> make_const_calc1_xy(8)(2)
27
>>> make_lambda_lambda(1)(2)(4)
7
>>> make_typed_lambda_lambda(1)(2)(4)
7
>>> partial_lambda = make_typed_lambda_lambda(1)(2)
>>> partial_lambda(4)
7
>>> partial_lambda(5)
8
"""
"""
#cy_identity = lambda x:x
#cy_identity = lambda x:x
def
make_identity
():
def
make_identity
():
"""
>>> idcall = make_identity()
>>> idcall(1)
1
>>> idcall(2)
2
"""
return
lambda
x
:
x
return
lambda
x
:
x
def
make_const0
(
x
):
def
make_const0
(
x
):
"""
>>> make_const0(1)()
1
"""
return
lambda
:
x
return
lambda
:
x
def
make_const1
(
x
):
def
make_const1
(
x
):
"""
>>> make_const1(1)(2)
1
>>> make_const1(1)(2)
1
"""
return
lambda
_
:
x
return
lambda
_
:
x
def
make_const_calc0
():
def
make_const_calc0
():
"""
>>> make_const_calc0()()
11
"""
return
lambda
:
1
*
2
*
3
+
5
return
lambda
:
1
*
2
*
3
+
5
def
make_const_calc1
():
def
make_const_calc1
():
"""
>>> make_const_calc1()(2)
11
"""
return
lambda
_
:
1
*
2
*
3
+
5
return
lambda
_
:
1
*
2
*
3
+
5
def
make_const_calc1_xy
(
x
):
def
make_const_calc1_xy
(
x
):
"""
>>> make_const_calc1_xy(8)(2)
27
"""
return
lambda
y
:
x
*
y
+
(
1
*
2
*
3
+
5
)
return
lambda
y
:
x
*
y
+
(
1
*
2
*
3
+
5
)
def
make_lambda_lambda
(
x
):
def
make_lambda_lambda
(
x
):
"""
>>> make_lambda_lambda(1)(2)(4)
7
"""
return
lambda
y
:
\
return
lambda
y
:
\
lambda
z
:
x
+
y
+
z
lambda
z
:
x
+
y
+
z
def
make_typed_lambda_lambda
(
int
x
):
def
make_typed_lambda_lambda
(
int
x
):
"""
>>> make_typed_lambda_lambda(1)(2)(4)
7
>>> partial_lambda = make_typed_lambda_lambda(1)(2)
>>> partial_lambda(4)
7
>>> partial_lambda(5)
8
"""
return
lambda
int
y
:
\
return
lambda
int
y
:
\
lambda
int
z
:
x
+
y
+
z
lambda
int
z
:
x
+
y
+
z
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment