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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
539d795c
Commit
539d795c
authored
Feb 01, 2010
by
Craig Citro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a bunch of new tests for closures.
parent
da4566a3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
3003 additions
and
0 deletions
+3003
-0
tests/run/closure_tests_1.pyx
tests/run/closure_tests_1.pyx
+401
-0
tests/run/closure_tests_2.pyx
tests/run/closure_tests_2.pyx
+498
-0
tests/run/closure_tests_3.pyx
tests/run/closure_tests_3.pyx
+698
-0
tests/run/closure_tests_4.pyx
tests/run/closure_tests_4.pyx
+829
-0
tests/run/lambda_tests.pyx
tests/run/lambda_tests.pyx
+577
-0
No files found.
tests/run/closure_tests_1.pyx
0 → 100644
View file @
539d795c
#
# closure_tests_1.pyx
#
# Battery of tests for closures in Cython. Based on the collection of
# compiler tests from P423/B629 at Indiana University, Spring 1999 and
# Fall 2000. Special thanks to R. Kent Dybvig, Dan Friedman, Kevin
# Millikin, and everyone else who helped to generate the original
# tests. Converted into a collection of Python/Cython tests by Craig
# Citro.
#
# Note: This set of tests is split (somewhat randomly) into several
# files, simply because putting all the tests in a single file causes
# gcc and g++ to buckle under the load.
#
def
g1425
():
"""
>>> g1425()
142
"""
if
(
True
):
def
g1424
():
if
(
True
):
return
122
return
(
20
)
+
(
g1424
())
else
:
return
10000
def
g1432
():
"""
>>> g1432()
[0, []]
"""
def
g1431
():
return
[
0
,[]]
x_1056
=
g1431
()
if
(
x_1056
):
def
g1430
():
def
g1429
():
return
(
x_1056
[
0
])
def
g1428
():
return
(
x_1056
[
0
])
return
(
g1429
())
+
(
g1428
())
x_1056
[
0
]
=
g1430
()
return
x_1056
def
g1435
():
"""
>>> g1435()
4000
"""
def
g1434
():
def
g1433
(
y_1057
):
return
y_1057
return
g1433
return
g1434
()(
4000
)
def
g1438
():
"""
>>> g1438()
1
"""
def
g1437
():
def
g1436
(
x_1058
):
return
x_1058
return
g1436
f_1059
=
g1437
()
return
(
f_1059
(
0
)
+
1
)
def
g1441
():
"""
>>> g1441()
4
"""
def
g1440
():
def
g1439
(
y_1060
):
return
y_1060
return
g1439
f_1061
=
g1440
()
return
f_1061
(
f_1061
(
4
))
def
g1446
():
"""
>>> g1446()
4
"""
def
g1445
():
def
g1444
(
f_1063
):
return
f_1063
(
f_1063
(
4
))
return
g1444
def
g1443
():
def
g1442
(
y_1062
):
return
y_1062
return
g1442
return
g1445
()(
g1443
())
def
g1449
():
"""
>>> g1449()
9000
"""
def
g1448
():
a_1064
=
4000
def
g1447
(
b_1065
):
return
(
a_1064
)
+
(
b_1065
)
return
g1447
return
g1448
()(
5000
)
def
g1454
():
"""
>>> g1454()
9000
"""
def
g1453
():
def
g1452
():
def
g1450
(
a_1066
):
def
g1451
(
b_1067
):
return
(
a_1066
)
+
(
b_1067
)
return
g1451
return
g1450
return
g1452
()(
4000
)
return
g1453
()(
5000
)
def
g1459
():
"""
>>> g1459()
2
"""
def
g1458
():
def
g1457
(
f_1069
):
return
f_1069
(
f_1069
(
0
))
return
g1457
def
g1456
():
def
g1455
(
x_1068
):
return
(
x_1068
+
1
)
return
g1455
return
g1458
()(
g1456
())
def
g1462
():
"""
>>> g1462()
0
"""
x_1072
=
0
def
g1461
():
def
g1460
(
x_1070
):
return
x_1070
return
g1460
f_1071
=
g1461
()
a_1075
=
f_1071
(
x_1072
)
b_1074
=
f_1071
(
x_1072
)
c_1073
=
f_1071
(
x_1072
)
return
((
a_1075
)
+
(
b_1074
))
+
(
c_1073
)
def
g1465
():
"""
>>> g1465()
3
"""
x_1080
=
0
y_1079
=
1
z_1078
=
2
def
g1464
():
def
g1463
(
x_1076
):
return
x_1076
return
g1463
f_1077
=
g1464
()
a_1083
=
f_1077
(
x_1080
)
b_1082
=
f_1077
(
y_1079
)
c_1081
=
f_1077
(
z_1078
)
return
((
a_1083
)
+
(
b_1082
))
+
(
c_1081
)
def
g1468
():
"""
>>> g1468()
0
"""
def
g1467
():
def
g1466
(
x_1085
,
y_1084
):
return
x_1085
return
g1466
f_1086
=
g1467
()
a_1087
=
f_1086
(
0
,
1
)
return
f_1086
(
a_1087
,
a_1087
)
def
g1471
():
"""
>>> g1471()
0
"""
x_1094
=
0
y_1093
=
1
z_1092
=
2
def
g1470
():
def
g1469
(
x_1090
,
y_1089
,
z_1088
):
return
x_1090
return
g1469
f_1091
=
g1470
()
a_1097
=
f_1091
(
x_1094
,
y_1093
,
z_1092
)
b_1096
=
y_1093
c_1095
=
z_1092
return
f_1091
(
a_1097
,
b_1096
,
c_1095
)
def
g1474
():
"""
>>> g1474()
3
"""
def
g1473
():
def
g1472
(
a_1101
,
b_1100
,
c_1099
,
d_1098
):
return
(
a_1101
)
+
(
d_1098
)
return
g1472
f_1102
=
g1473
()
return
f_1102
(
0
,
1
,
2
,
3
)
def
g1478
():
"""
>>> g1478()
3
"""
def
g1477
():
def
g1476
(
x_1103
):
return
x_1103
return
g1476
f_1104
=
g1477
()
def
g1475
():
a_1107
=
0
b_1106
=
1
c_1105
=
2
return
(
f_1104
(
a_1107
))
+
((
f_1104
(
b_1106
))
+
(
f_1104
(
c_1105
)))
return
(
f_1104
(
0
))
+
(
g1475
())
def
g1483
():
"""
>>> g1483()
"""
a_1108
=
0
def
g1482
():
def
g1481
():
return
0
return
g1481
a_1110
=
g1482
()
def
g1480
():
def
g1479
():
return
11
return
g1479
b_1109
=
g1480
()
a_1110
=
11
def
g1486
():
"""
>>> g1486()
"""
a_1111
=
0
def
g1485
():
def
g1484
():
a_1113
=
0
return
g1484
a_1113
=
g1485
()
b_1112
=
11
return
a_1113
()
def
g1491
():
"""
>>> g1491()
0
"""
def
g1490
():
def
g1489
():
return
0
return
g1489
a_1115
=
g1490
()
def
g1488
():
def
g1487
():
return
11
return
g1487
b_1114
=
g1488
()
return
a_1115
()
def
g1494
():
"""
>>> g1494()
2
"""
def
g1493
():
x_1116
=
1
def
g1492
(
y_1117
):
return
(
x_1116
)
+
(
y_1117
)
return
g1492
f_1118
=
g1493
()
x_1119
=
0
return
f_1118
(
f_1118
(
x_1119
))
def
g1501
():
"""
>>> g1501()
3050
"""
def
g1500
():
def
g1499
():
def
g1498
(
x_1121
):
return
(
x_1121
)
+
(
50
)
return
g1498
t_1122
=
g1499
()
def
g1497
(
f_1123
):
return
t_1122
(
f_1123
(
1000
))
return
g1497
def
g1496
():
def
g1495
(
y_1120
):
return
(
y_1120
)
+
(
2000
)
return
g1495
return
g1500
()(
g1496
())
def
g1508
():
"""
>>> g1508()
60
"""
def
g1507
():
def
g1506
():
def
g1505
():
def
g1502
(
a_1124
):
def
g1503
(
b_1125
):
def
g1504
(
c_1126
):
return
(
a_1124
)
+
((
b_1125
)
+
(
c_1126
))
return
g1504
return
g1503
return
g1502
return
g1505
()(
10
)
return
g1506
()(
20
)
return
g1507
()(
30
)
def
g1513
():
"""
>>> g1513()
5
"""
def
g1512
():
def
g1509
(
b_1127
):
def
g1511
():
def
g1510
(
a_1128
):
return
(
b_1127
)
+
(
a_1128
)
return
g1510
return
g1511
()(
2
)
return
g1509
return
g1512
()(
3
)
def
g1518
():
"""
>>> g1518()
5
"""
def
g1517
():
def
g1516
(
f_1130
):
return
f_1130
(
f_1130
(
5
))
return
g1516
def
g1515
():
def
g1514
(
x_1129
):
return
x_1129
return
g1514
return
g1517
()(
g1515
())
def
g1523
():
"""
>>> g1523()
8000
"""
def
g1522
():
def
g1521
():
def
g1520
(
x_1131
):
return
(
x_1131
)
+
(
3000
)
return
g1520
f_1132
=
g1521
()
def
g1519
(
y_1133
):
return
f_1132
(
f_1132
(
y_1133
))
return
g1519
return
g1522
()(
2000
)
tests/run/closure_tests_2.pyx
0 → 100644
View file @
539d795c
#
# closure_tests_2.pyx
#
# Battery of tests for closures in Cython. Based on the collection of
# compiler tests from P423/B629 at Indiana University, Spring 1999 and
# Fall 2000. Special thanks to R. Kent Dybvig, Dan Friedman, Kevin
# Millikin, and everyone else who helped to generate the original
# tests. Converted into a collection of Python/Cython tests by Craig
# Citro.
#
# Note: This set of tests is split (somewhat randomly) into several
# files, simply because putting all the tests in a single file causes
# gcc and g++ to buckle under the load.
#
def
g1526
():
"""
>>> g1526()
2
"""
x_1134
=
0
def
g1525
():
x_1136
=
1
z_1135
=
x_1134
def
g1524
(
y_1137
):
return
(
x_1136
)
+
((
z_1135
)
+
(
y_1137
))
return
g1524
f_1138
=
g1525
()
return
f_1138
(
f_1138
(
x_1134
))
def
g1535
():
"""
>>> g1535()
3050
"""
def
g1534
():
def
g1533
():
def
g1531
(
t_1141
):
def
g1532
(
f_1142
):
return
t_1141
(
f_1142
(
1000
))
return
g1532
return
g1531
def
g1530
():
def
g1529
(
x_1140
):
return
(
x_1140
)
+
(
50
)
return
g1529
return
g1533
()(
g1530
())
def
g1528
():
def
g1527
(
y_1139
):
return
(
y_1139
)
+
(
2000
)
return
g1527
return
g1534
()(
g1528
())
def
g1540
():
"""
>>> g1540()
2050
"""
def
g1539
():
t_1143
=
50
def
g1538
(
f_1144
):
return
(
t_1143
)
+
(
f_1144
())
return
g1538
def
g1537
():
def
g1536
():
return
2000
return
g1536
return
g1539
()(
g1537
())
def
g1547
():
"""
>>> g1547()
2050
"""
def
g1546
():
def
g1545
():
def
g1543
(
t_1145
):
def
g1544
(
f_1146
):
return
(
t_1145
)
+
(
f_1146
())
return
g1544
return
g1543
return
g1545
()(
50
)
def
g1542
():
def
g1541
():
return
2000
return
g1541
return
g1546
()(
g1542
())
def
g1550
():
"""
>>> g1550()
700
"""
def
g1549
():
x_1147
=
300
def
g1548
(
y_1148
):
return
(
x_1147
)
+
(
y_1148
)
return
g1548
return
g1549
()(
400
)
def
g1553
():
"""
>>> g1553()
0
"""
x_1152
=
3
def
g1552
():
def
g1551
(
x_1150
,
y_1149
):
return
x_1150
return
g1551
f_1151
=
g1552
()
if
(
f_1151
(
0
,
0
)):
return
f_1151
(
f_1151
(
0
,
0
),
x_1152
)
else
:
return
0
def
g1562
():
"""
>>> g1562()
False
"""
def
g1561
():
def
g1556
(
x_1153
):
def
g1560
():
def
g1559
():
return
isinstance
(
x_1153
,
list
)
if
(
g1559
()):
def
g1558
():
def
g1557
():
return
(
x_1153
[
0
])
return
(
g1557
()
==
0
)
return
(
not
g1558
())
else
:
return
False
if
(
g1560
()):
return
x_1153
else
:
return
False
return
g1556
f_1154
=
g1561
()
def
g1555
():
def
g1554
():
return
[
0
,[]]
return
[
0
,
g1554
()]
return
f_1154
(
g1555
())
def
g1570
():
"""
>>> g1570()
False
"""
def
g1569
():
def
g1563
(
x_1155
):
def
g1568
():
if
(
x_1155
):
def
g1567
():
def
g1566
():
return
isinstance
(
x_1155
,
list
)
if
(
g1566
()):
def
g1565
():
def
g1564
():
return
(
x_1155
[
0
])
return
(
g1564
()
==
0
)
return
(
not
g1565
())
else
:
return
False
return
(
not
g1567
())
else
:
return
False
if
(
g1568
()):
return
x_1155
else
:
return
False
return
g1563
f_1156
=
g1569
()
return
f_1156
(
0
)
def
g1575
():
"""
>>> g1575()
[]
"""
def
g1574
():
def
g1571
(
x_1157
):
def
g1573
():
def
g1572
():
return
isinstance
(
x_1157
,
list
)
if
(
g1572
()):
return
True
else
:
return
(
x_1157
==
[])
if
(
g1573
()):
return
x_1157
else
:
return
[]
return
g1571
f_1158
=
g1574
()
return
f_1158
(
0
)
def
g1578
():
"""
>>> g1578()
4
"""
y_1159
=
4
def
g1577
():
def
g1576
(
y_1160
):
return
y_1160
return
g1576
f_1161
=
g1577
()
return
f_1161
(
f_1161
(
y_1159
))
def
g1581
():
"""
>>> g1581()
0
"""
y_1162
=
4
def
g1580
():
def
g1579
(
x_1164
,
y_1163
):
return
0
return
g1579
f_1165
=
g1580
()
return
f_1165
(
f_1165
(
y_1162
,
y_1162
),
f_1165
(
y_1162
,
y_1162
))
def
g1584
():
"""
>>> g1584()
0
"""
y_1166
=
4
def
g1583
():
def
g1582
(
x_1168
,
y_1167
):
return
0
return
g1582
f_1169
=
g1583
()
return
f_1169
(
f_1169
(
y_1166
,
y_1166
),
f_1169
(
y_1166
,
f_1169
(
y_1166
,
y_1166
)))
def
g1587
():
"""
>>> g1587()
0
"""
y_1170
=
4
def
g1586
():
def
g1585
(
x_1172
,
y_1171
):
return
0
return
g1585
f_1173
=
g1586
()
return
f_1173
(
f_1173
(
y_1170
,
f_1173
(
y_1170
,
y_1170
)),
f_1173
(
y_1170
,
f_1173
(
y_1170
,
y_1170
)))
def
g1594
():
"""
>>> g1594()
4
"""
def
g1593
():
def
g1588
(
y_1174
):
def
g1592
():
def
g1591
(
f_1176
):
return
f_1176
(
f_1176
(
y_1174
))
return
g1591
def
g1590
():
def
g1589
(
y_1175
):
return
y_1175
return
g1589
return
g1592
()(
g1590
())
return
g1588
return
g1593
()(
4
)
def
g1598
():
"""
>>> g1598()
23
"""
def
g1597
():
def
g1596
(
x_1177
):
return
x_1177
return
g1596
f_1178
=
g1597
()
def
g1595
():
if
(
False
):
return
1
else
:
return
f_1178
(
22
)
return
(
g1595
()
+
1
)
def
g1603
():
"""
>>> g1603()
22
"""
def
g1602
():
def
g1601
(
x_1179
):
return
x_1179
return
g1601
f_1180
=
g1602
()
def
g1600
():
def
g1599
():
return
23
==
0
return
f_1180
(
g1599
())
if
(
g1600
()):
return
1
else
:
return
22
def
g1611
():
"""
>>> g1611()
5061
"""
def
g1610
():
def
g1609
(
x_1182
):
if
(
x_1182
):
return
(
not
x_1182
)
else
:
return
x_1182
return
g1609
f_1185
=
g1610
()
def
g1608
():
def
g1607
(
x_1181
):
return
(
10
)
*
(
x_1181
)
return
g1607
f2_1184
=
g1608
()
x_1183
=
23
def
g1606
():
def
g1605
():
def
g1604
():
return
x_1183
==
0
return
f_1185
(
g1604
())
if
(
g1605
()):
return
1
else
:
return
(
x_1183
)
*
(
f2_1184
((
x_1183
-
1
)))
return
(
g1606
()
+
1
)
def
g1614
():
"""
>>> g1614()
1
"""
def
g1613
():
def
g1612
():
return
0
return
g1612
f_1186
=
g1613
()
x_1187
=
f_1186
()
return
1
def
g1617
():
"""
>>> g1617()
1
"""
def
g1616
():
def
g1615
():
return
0
return
g1615
f_1188
=
g1616
()
f_1188
()
return
1
def
g1620
():
"""
>>> g1620()
4
"""
def
g1619
():
def
g1618
(
x_1189
):
return
x_1189
return
g1618
f_1190
=
g1619
()
if
(
True
):
f_1190
(
3
)
return
4
else
:
return
5
def
g1623
():
"""
>>> g1623()
6
"""
def
g1622
():
def
g1621
(
x_1191
):
return
x_1191
return
g1621
f_1192
=
g1622
()
(
f_1192
(
4
))
if
(
True
)
else
(
5
)
return
6
def
g1627
():
"""
>>> g1627()
120
"""
def
g1626
():
def
g1624
(
fact_1195
,
n_1194
,
acc_1193
):
def
g1625
():
return
n_1194
==
0
if
(
g1625
()):
return
acc_1193
else
:
return
fact_1195
(
fact_1195
,
(
n_1194
-
1
),
(
n_1194
)
*
(
acc_1193
))
return
g1624
fact_1196
=
g1626
()
return
fact_1196
(
fact_1196
,
5
,
1
)
def
g1632
():
"""
>>> g1632()
144
"""
def
g1631
():
def
g1628
(
b_1199
,
c_1198
,
a_1197
):
b_1203
=
(
b_1199
)
+
(
a_1197
)
def
g1630
():
def
g1629
():
a_1201
=
(
b_1199
)
+
(
b_1199
)
c_1200
=
(
c_1198
)
+
(
c_1198
)
return
(
a_1201
)
+
(
a_1201
)
return
(
a_1197
)
+
(
g1629
())
a_1202
=
g1630
()
return
(
a_1202
)
*
(
a_1202
)
return
g1628
return
g1631
()(
2
,
3
,
4
)
def
g1639
():
"""
>>> g1639()
3
"""
def
g1638
():
def
g1636
(
x_1204
):
def
g1637
():
return
x_1204
()
return
g1637
return
g1636
f_1205
=
g1638
()
def
g1635
():
def
g1634
():
def
g1633
():
return
3
return
g1633
return
f_1205
(
g1634
())
return
g1635
()()
def
g1646
():
"""
>>> g1646()
3628800
"""
def
g1645
():
def
g1643
(
x_1207
):
def
g1644
():
return
x_1207
==
0
if
(
g1644
()):
return
1
else
:
return
(
x_1207
)
*
(
f_1206
((
x_1207
)
-
(
1
)))
return
g1643
f_1206
=
g1645
()
q_1208
=
17
def
g1642
():
def
g1640
(
a_1209
):
q_1208
=
10
def
g1641
():
return
a_1209
(
q_1208
)
return
g1641
return
g1640
g_1210
=
g1642
()
return
g_1210
(
f_1206
)()
tests/run/closure_tests_3.pyx
0 → 100644
View file @
539d795c
#
# closure_tests_3.pyx
#
# Battery of tests for closures in Cython. Based on the collection of
# compiler tests from P423/B629 at Indiana University, Spring 1999 and
# Fall 2000. Special thanks to R. Kent Dybvig, Dan Friedman, Kevin
# Millikin, and everyone else who helped to generate the original
# tests. Converted into a collection of Python/Cython tests by Craig
# Citro.
#
# Note: This set of tests is split (somewhat randomly) into several
# files, simply because putting all the tests in a single file causes
# gcc and g++ to buckle under the load.
#
def
g1649
():
"""
>>> g1649()
6
"""
def
g1648
():
def
g1647
(
x_1211
):
return
x_1211
return
g1647
f_1212
=
g1648
()
if
(
f_1212
(
True
)):
f_1212
(
3
)
f_1212
(
4
)
else
:
f_1212
(
5
)
return
f_1212
(
6
)
def
g1653
():
"""
>>> g1653()
5
"""
def
g1652
():
def
g1651
(
x_1213
):
return
(
x_1213
+
1
)
return
g1651
f_1214
=
g1652
()
def
g1650
():
f_1215
=
3
return
(
f_1215
)
+
(
1
)
return
f_1214
(
g1650
())
def
g1662
():
"""
>>> g1662()
51
"""
x_1223
=
15
def
g1661
():
def
g1660
(
h_1219
,
v_1218
):
return
(
h_1219
)
*
(
v_1218
)
return
g1660
f_1222
=
g1661
()
def
g1659
():
def
g1658
(
x_1217
):
return
(
x_1217
)
+
(
5
)
return
g1658
k_1221
=
g1659
()
def
g1657
():
def
g1656
(
x_1216
):
return
(
x_1216
+
1
)
return
g1656
g_1220
=
g1657
()
def
g1655
():
def
g1654
():
g_1224
=
3
return
f_1222
(
g_1224
,
x_1223
)
return
g_1220
(
g1654
())
return
k_1221
(
g1655
())
def
g1665
():
"""
>>> g1665()
5
"""
x_1225
=
4
def
g1664
():
def
g1663
():
return
x_1225
return
g1663
f_1226
=
g1664
()
x_1225
=
5
return
f_1226
()
def
g1670
():
"""
>>> g1670()
5
"""
def
g1669
():
def
g1668
():
def
g1667
():
def
g1666
():
return
4
return
g1666
y_1227
=
g1667
()
return
y_1227
()
return
(
g1668
()
+
1
)
x_1228
=
g1669
()
return
x_1228
def
g1674
():
"""
>>> g1674()
1
"""
def
g1673
():
def
g1671
(
n_1230
):
def
g1672
():
return
n_1230
==
0
if
(
g1672
()):
return
1
else
:
return
one_1229
((
n_1230
-
1
))
return
g1671
one_1229
=
g1673
()
return
one_1229
(
13
)
def
g1681
():
"""
>>> g1681()
True
"""
def
g1680
():
def
g1678
(
x_1234
):
def
g1679
():
return
x_1234
==
0
if
(
g1679
()):
return
True
else
:
return
odd_1231
((
x_1234
-
1
))
return
g1678
even_1232
=
g1680
()
def
g1677
():
def
g1675
(
x_1233
):
def
g1676
():
return
x_1233
==
0
if
(
g1676
()):
return
False
else
:
return
even_1232
((
x_1233
-
1
))
return
g1675
odd_1231
=
g1677
()
return
odd_1231
(
13
)
def
g1688
():
"""
>>> g1688()
True
"""
t_1236
=
True
f_1235
=
False
def
g1687
():
def
g1685
(
x_1240
):
def
g1686
():
return
x_1240
==
0
if
(
g1686
()):
return
t_1236
else
:
return
odd_1237
((
x_1240
-
1
))
return
g1685
even_1238
=
g1687
()
def
g1684
():
def
g1682
(
x_1239
):
def
g1683
():
return
x_1239
==
0
if
(
g1683
()):
return
f_1235
else
:
return
even_1238
((
x_1239
-
1
))
return
g1682
odd_1237
=
g1684
()
return
odd_1237
(
13
)
def
g1698
():
"""
>>> g1698()
True
"""
def
g1697
():
def
g1696
(
x_1241
):
return
x_1241
return
g1696
even_1242
=
g1697
()
def
g1695
():
def
g1694
():
def
g1692
(
x_1246
):
def
g1693
():
return
x_1246
==
0
if
(
g1693
()):
return
True
else
:
return
odd_1243
((
x_1246
-
1
))
return
g1692
even_1244
=
g1694
()
def
g1691
():
def
g1689
(
x_1245
):
def
g1690
():
return
x_1245
==
0
if
(
g1690
()):
return
False
else
:
return
even_1244
((
x_1245
-
1
))
return
g1689
odd_1243
=
g1691
()
return
odd_1243
(
13
)
return
even_1242
(
g1695
())
def
g1702
():
"""
>>> g1702()
120
"""
def
g1701
():
def
g1699
(
n_1248
):
def
g1700
():
return
n_1248
==
0
if
(
g1700
()):
return
1
else
:
return
(
n_1248
)
*
(
fact_1247
((
n_1248
-
1
)))
return
g1699
fact_1247
=
g1701
()
return
fact_1247
(
5
)
def
g1716
():
"""
>>> g1716()
10
"""
x_1249
=
5
def
g1715
():
def
g1713
(
u_1263
,
v_1262
,
w_1261
):
def
g1714
():
return
u_1263
==
0
if
(
g1714
()):
return
b_1251
(
v_1262
,
w_1261
)
else
:
return
a_1252
((
u_1263
)
-
(
1
),
v_1262
,
w_1261
)
return
g1713
a_1252
=
g1715
()
def
g1712
():
def
g1705
(
q_1255
,
r_1254
):
p_1256
=
(
q_1255
)
*
(
r_1254
)
def
g1711
():
def
g1709
(
n_1260
):
def
g1710
():
return
n_1260
==
0
if
(
g1710
()):
return
c_1250
(
p_1256
)
else
:
return
o_1257
((
n_1260
)
-
(
1
))
return
g1709
e_1258
=
g1711
()
def
g1708
():
def
g1706
(
n_1259
):
def
g1707
():
return
n_1259
==
0
if
(
g1707
()):
return
c_1250
(
x_1249
)
else
:
return
e_1258
((
n_1259
)
-
(
1
))
return
g1706
o_1257
=
g1708
()
return
e_1258
((
q_1255
)
*
(
r_1254
))
return
g1705
b_1251
=
g1712
()
def
g1704
():
def
g1703
(
x_1253
):
return
(
5
)
*
(
x_1253
)
return
g1703
c_1250
=
g1704
()
return
a_1252
(
3
,
2
,
1
)
def
g1729
():
"""
>>> g1729()
537516
"""
def
g1728
():
def
g1727
(
x_1269
):
return
(
x_1269
+
1
)
return
g1727
f_1276
=
g1728
()
def
g1726
():
def
g1725
(
x_1268
):
return
(
x_1268
-
1
)
return
g1725
g_1275
=
g1726
()
def
g1724
():
def
g1723
(
x_1267
):
return
(
x_1267
+
1
)
return
g1723
t_1274
=
g1724
()
def
g1722
():
def
g1721
(
x_1266
):
return
(
x_1266
+
1
)
return
g1721
j_1273
=
g1722
()
def
g1720
():
def
g1719
(
x_1265
):
return
(
x_1265
+
1
)
return
g1719
i_1272
=
g1720
()
def
g1718
():
def
g1717
(
x_1264
):
return
(
x_1264
+
1
)
return
g1717
h_1271
=
g1718
()
x_1270
=
80
a_1279
=
f_1276
(
x_1270
)
b_1278
=
g_1275
(
x_1270
)
c_1277
=
h_1271
(
i_1272
(
j_1273
(
t_1274
(
x_1270
))))
return
(
a_1279
)
*
((
b_1278
)
*
((
c_1277
)
+
(
0
)))
def
g1733
():
"""
>>> g1733()
120
"""
def
g1732
():
def
g1730
(
fact_1281
,
n_1280
):
def
g1731
():
return
n_1280
==
0
if
(
g1731
()):
return
1
else
:
return
(
fact_1281
(
fact_1281
,
(
n_1280
-
1
)))
*
(
n_1280
)
return
g1730
fact_1282
=
g1732
()
return
fact_1282
(
fact_1282
,
5
)
def
g1737
():
"""
>>> g1737()
10000
"""
def
g1736
():
def
g1735
(
x_1283
):
return
(
x_1283
)
+
(
1000
)
return
g1735
f_1284
=
g1736
()
def
g1734
():
return
f_1284
(
-
2
)
==
0
if
(
g1734
()):
return
f_1284
(
6000
)
else
:
return
f_1284
(
f_1284
(
8000
))
def
g1741
():
"""
>>> g1741()
10000
"""
def
g1740
():
def
g1739
(
x_1285
):
return
(
x_1285
)
+
(
1000
)
return
g1739
f_1286
=
g1740
()
def
g1738
():
return
f_1286
(
-
1
)
==
0
if
(
g1738
()):
return
f_1286
(
6000
)
else
:
return
f_1286
(
f_1286
(
8000
))
def
g1747
():
"""
>>> g1747()
8000
"""
def
g1746
():
def
g1745
(
x_1288
,
y_1287
):
return
(
x_1288
)
+
(
1000
)
return
g1745
f_1289
=
g1746
()
def
g1744
():
def
g1743
():
def
g1742
():
return
0
return
f_1289
(
3000
,
g1742
())
if
(
g1743
()):
return
f_1289
(
f_1289
(
4000
,
0
),
0
)
else
:
return
8000
return
(
g1744
())
+
(
2000
)
def
g1754
():
"""
>>> g1754()
24
"""
def
g1753
():
def
g1752
():
def
g1751
():
def
g1748
(
x_1290
):
def
g1749
(
y_1291
):
def
g1750
(
z_1292
):
return
(
x_1290
)
+
((
y_1291
)
+
((
z_1292
)
+
(
y_1291
)))
return
g1750
return
g1749
return
g1748
return
g1751
()(
5
)
return
g1752
()(
6
)
return
g1753
()(
7
)
def
g1765
():
"""
>>> g1765()
35
"""
def
g1764
():
def
g1763
():
def
g1762
():
def
g1761
():
def
g1760
():
def
g1755
(
x_1293
):
def
g1756
(
y_1294
):
def
g1757
(
z_1295
):
def
g1758
(
w_1296
):
def
g1759
(
u_1297
):
return
(
x_1293
)
+
((
y_1294
)
+
((
z_1295
)
+
((
w_1296
)
+
(
u_1297
))))
return
g1759
return
g1758
return
g1757
return
g1756
return
g1755
return
g1760
()(
5
)
return
g1761
()(
6
)
return
g1762
()(
7
)
return
g1763
()(
8
)
return
g1764
()(
9
)
def
g1769
():
"""
>>> g1769()
True
"""
def
g1768
():
def
g1767
(
x_1298
):
return
x_1298
return
g1767
f_1299
=
g1768
()
def
g1766
():
return
callable
(
f_1299
)
if
(
g1766
()):
return
True
else
:
return
False
def
g1779
():
"""
>>> g1779()
6
"""
def
g1778
():
def
g1773
(
sum_1301
,
ls_1300
):
def
g1777
():
return
(
ls_1300
==
[])
if
(
g1777
()):
return
0
else
:
def
g1776
():
return
(
ls_1300
[
0
])
def
g1775
():
def
g1774
():
return
(
ls_1300
[
1
])
return
sum_1301
(
sum_1301
,
g1774
())
return
(
g1776
())
+
(
g1775
())
return
g1773
sum_1302
=
g1778
()
def
g1772
():
def
g1771
():
def
g1770
():
return
[
3
,[]]
return
[
2
,
g1770
()]
return
[
1
,
g1771
()]
return
sum_1302
(
sum_1302
,
g1772
())
def
g1785
():
"""
>>> g1785()
1500
"""
def
g1784
():
def
g1783
():
def
g1780
(
a_1303
):
def
g1781
():
def
g1782
():
if
(
True
):
return
200
(
a_1303
)
+
(
g1782
())
return
1500
return
g1781
return
g1780
return
g1783
()(
1000
)
return
g1784
()()
def
g1791
():
"""
>>> g1791()
102
"""
def
g1790
():
def
g1789
():
def
g1786
(
b_1304
):
def
g1787
(
a_1305
):
def
g1788
():
if
(
1
):
return
2
a_1305
=
g1788
()
return
(
a_1305
)
+
(
b_1304
)
return
g1787
return
g1786
return
g1789
()(
100
)
return
g1790
()(
200
)
def
g1800
():
"""
>>> g1800()
2600
"""
def
g1799
():
def
g1798
():
def
g1797
():
def
g1792
(
a_1306
):
def
g1793
(
b_1307
):
def
g1794
():
if
(
b_1307
):
return
200
a_1306
=
g1794
()
def
g1795
(
c_1308
):
def
g1796
():
if
(
300
):
return
400
c_1308
=
g1796
()
return
(
a_1306
)
+
((
b_1307
)
+
(
c_1308
))
return
g1795
return
g1793
return
g1792
return
g1797
()(
1000
)
return
g1798
()(
2000
)
return
g1799
()(
3000
)
def
g1807
():
"""
>>> g1807()
3628800
"""
def
g1806
():
def
g1804
(
x_1310
):
def
g1805
():
return
x_1310
==
0
if
(
g1805
()):
return
1
else
:
return
(
x_1310
)
*
(
f_1309
((
x_1310
)
-
(
1
)))
return
g1804
f_1309
=
g1806
()
def
g1803
():
def
g1801
(
a_1311
):
def
g1802
(
b_1312
):
return
a_1311
(
b_1312
)
return
g1802
return
g1801
g_1313
=
g1803
()
return
g_1313
(
f_1309
)(
10
)
def
g1828
():
"""
>>> g1828()
[52, [44, [17, [44, [52, 17]]]]]
"""
def
g1827
():
def
g1826
():
return
(
a_1316
)
+
(
b_1315
)
return
g1826
f_1318
=
g1827
()
def
g1825
():
def
g1822
(
y_1320
):
def
g1824
():
def
g1823
(
y_1321
):
return
y_1321
return
g1823
g_1317
=
g1824
()
return
(
y_1320
)
+
(
y_1320
)
return
g1822
g_1317
=
g1825
()
a_1316
=
17
b_1315
=
35
def
g1821
():
def
g1820
():
def
g1819
():
return
a_1316
return
g1819
def
g1818
():
def
g1817
(
v_1319
):
a_1316
=
v_1319
return
g1817
return
[
g1820
(),
g1818
()]
h_1314
=
g1821
()
x1_1324
=
f_1318
()
x2_1323
=
g_1317
(
22
)
def
g1816
():
def
g1815
():
return
(
h_1314
[
0
])
return
g1815
()()
x3_1322
=
g1816
()
x4_1325
=
g_1317
(
22
)
def
g1814
():
return
(
h_1314
[
1
])
g1814
()(
3
)
x5_1327
=
f_1318
()
def
g1813
():
def
g1812
():
return
(
h_1314
[
0
])
return
g1812
()()
x6_1326
=
g1813
()
def
g1811
():
def
g1810
():
def
g1809
():
def
g1808
():
return
[
x5_1327
,
x6_1326
]
return
[
x4_1325
,
g1808
()]
return
[
x3_1322
,
g1809
()]
return
[
x2_1323
,
g1810
()]
return
[
x1_1324
,
g1811
()]
def
g1843
():
"""
>>> g1843()
[52, [17, [35, [17, 35]]]]
"""
def
g1842
():
def
g1841
():
return
(
a_1330
)
+
(
b_1329
)
return
g1841
f_1331
=
g1842
()
a_1330
=
17
b_1329
=
35
def
g1840
():
def
g1839
():
def
g1838
():
return
a_1330
return
g1838
def
g1837
():
def
g1836
():
return
b_1329
return
g1836
return
[
g1839
(),
g1837
()]
h_1328
=
g1840
()
def
g1835
():
def
g1834
():
def
g1833
():
def
g1832
():
def
g1831
():
return
(
h_1328
[
0
])
return
g1831
()()
def
g1830
():
def
g1829
():
return
(
h_1328
[
1
])
return
g1829
()()
return
[
g1832
(),
g1830
()]
return
[
b_1329
,
g1833
()]
return
[
a_1330
,
g1834
()]
return
[
f_1331
(),
g1835
()]
tests/run/closure_tests_4.pyx
0 → 100644
View file @
539d795c
#
# closure_tests_4.pyx
#
# Battery of tests for closures in Cython. Based on the collection of
# compiler tests from P423/B629 at Indiana University, Spring 1999 and
# Fall 2000. Special thanks to R. Kent Dybvig, Dan Friedman, Kevin
# Millikin, and everyone else who helped to generate the original
# tests. Converted into a collection of Python/Cython tests by Craig
# Citro.
#
# Note: This set of tests is split (somewhat randomly) into several
# files, simply because putting all the tests in a single file causes
# gcc and g++ to buckle under the load.
#
def
g1852
():
"""
>>> g1852()
[3, 42]
"""
def
g1851
():
def
g1850
(
x_1333
):
x_1334
=
3
return
3
return
g1850
f_1332
=
g1851
()
def
g1848
():
def
g1847
(
x_1336
):
y_1337
=
14
y_1337
=
7
return
y_1337
return
g1847
g_1335
=
g1848
()
def
g1849
():
return
[
g_1335
,
3
]
g_1335
=
g1849
()
def
g1846
():
def
g1845
(
x_1340
):
return
x_1340
return
g1845
h_1339
=
g1846
()
z_1338
=
42
def
g1844
():
return
(
g_1335
[
1
])
return
[
g1844
(),
h_1339
(
z_1338
)]
def
g1864
():
"""
>>> g1864()
True
"""
t_1342
=
True
f_1341
=
False
def
g1863
():
return
[
t_1342
,
f_1341
]
bools_1345
=
g1863
()
def
g1862
():
def
g1861
(
x_1343
):
if
((
not
x_1343
)):
return
f_1341
else
:
return
t_1342
return
g1861
id_1344
=
g1862
()
def
g1860
():
def
g1857
(
x_1349
):
def
g1859
():
return
x_1349
==
0
if
(
g1859
()):
def
g1858
():
return
(
bools_1345
[
0
])
return
id_1344
(
g1858
())
else
:
return
odd_1346
((
x_1349
)
-
(
1
))
return
g1857
even_1347
=
g1860
()
def
g1856
():
def
g1853
(
y_1348
):
def
g1855
():
return
y_1348
==
0
if
(
g1855
()):
def
g1854
():
return
(
bools_1345
[
1
])
return
id_1344
(
g1854
())
else
:
return
even_1347
((
y_1348
)
-
(
1
))
return
g1853
odd_1346
=
g1856
()
return
odd_1346
(
5
)
def
g1872
():
"""
>>> g1872()
35
"""
a_1350
=
5
def
g1871
():
return
[
a_1350
,
6
]
b_1351
=
g1871
()
def
g1870
():
def
g1869
(
x_1352
):
return
(
x_1352
)
*
(
a_1350
)
return
g1869
f_1353
=
g1870
()
def
g1867
():
def
g1866
():
return
(
b_1351
[
0
])
return
(
f_1353
(
a_1350
))
-
(
g1866
())
if
(
g1867
()):
def
g1868
():
if
((
not
a_1350
)):
return
(
2
)
*
(
a_1350
)
else
:
return
(
2
)
+
(
a_1350
)
b_1351
[
0
]
=
g1868
()
f_1353
(
a_1350
)
else
:
if
((
not
(
not
(
f_1353
(
a_1350
)
<
b_1351
)))):
(
f_1353
(
a_1350
))
def
g1865
():
return
(
b_1351
[
0
])
return
f_1353
(
g1865
())
def
g1885
():
"""
>>> g1885()
9
"""
def
g1884
():
def
g1883
(
x_1368
,
y_1367
):
if
((
not
x_1368
)):
return
g_1355
((
x_1368
+
1
),
(
y_1367
+
1
))
else
:
return
h_1354
((
x_1368
)
+
(
y_1367
))
return
g1883
f_1356
=
g1884
()
def
g1882
():
def
g1875
(
u_1359
,
v_1358
):
a_1361
=
(
u_1359
)
+
(
v_1358
)
b_1360
=
(
u_1359
)
*
(
v_1358
)
def
g1881
():
def
g1876
(
d_1363
):
def
g1880
():
return
[
a_1361
,
b_1360
]
p_1365
=
g1880
()
def
g1879
():
def
g1877
(
m_1366
):
if
((
m_1366
<
u_1359
)):
return
f_1356
(
m_1366
,
d_1363
)
else
:
def
g1878
():
return
(
p_1365
[
0
])
return
h_1354
(
g1878
())
return
g1877
q_1364
=
g1879
()
return
q_1364
(
f_1356
(
a_1361
,
b_1360
))
return
g1876
e_1362
=
g1881
()
return
e_1362
(
u_1359
)
return
g1875
g_1355
=
g1882
()
def
g1874
():
def
g1873
(
w_1357
):
return
w_1357
return
g1873
h_1354
=
g1874
()
return
f_1356
(
4
,
5
)
def
g1897
():
"""
>>> g1897()
22
"""
def
g1896
():
def
g1890
(
x_1373
):
def
g1895
():
def
g1894
():
def
g1893
():
def
g1891
(
y_1374
):
def
g1892
(
z_1375
):
return
(
y_1374
)
+
(
z_1375
)
return
g1892
return
g1891
return
g1893
()(
6
)
return
g1894
()(
7
)
return
(
x_1373
)
+
(
g1895
())
return
g1890
f_1370
=
g1896
()
def
g1889
():
def
g1888
():
def
g1887
():
def
g1886
(
w_1372
,
u_1371
):
return
(
w_1372
)
+
(
u_1371
)
return
g1886
return
g1887
()(
8
,
9
)
return
(
5
)
+
(
g1888
())
g_1369
=
g1889
()
return
g_1369
def
g1923
():
"""
>>> g1923()
True
"""
y_1377
=
[]
z_1376
=
10
def
g1911
():
return
[
5
,
y_1377
]
test_ls_1378
=
g1911
()
def
g1922
():
def
g1913
(
f_1379
):
def
g1921
():
def
g1918
(
g_1382
):
def
g1920
():
def
g1919
(
x_1383
):
return
g_1382
(
g_1382
)(
x_1383
)
return
g1919
return
f_1379
(
g1920
())
return
g1918
def
g1917
():
def
g1914
(
g_1380
):
def
g1916
():
def
g1915
(
x_1381
):
return
g_1380
(
g_1380
)(
x_1381
)
return
g1915
return
f_1379
(
g1916
())
return
g1914
return
g1921
()(
g1917
())
return
g1913
y_1377
=
g1922
()
def
g1912
():
return
[
z_1376
,
test_ls_1378
]
test_ls_1378
=
g1912
()
def
g1910
():
def
g1906
(
ls_1385
):
def
g1909
():
return
(
ls_1385
==
[])
if
(
g1909
()):
return
0
else
:
def
g1908
():
def
g1907
():
return
(
ls_1385
[
1
])
return
length_1384
(
g1907
())
return
(
1
)
+
(
g1908
())
return
g1906
length_1384
=
g1910
()
len_1386
=
length_1384
(
test_ls_1378
)
def
g1905
():
def
g1904
():
def
g1903
():
def
g1898
(
len_1387
):
def
g1899
(
ls_1388
):
def
g1902
():
return
(
ls_1388
==
[])
if
(
g1902
()):
return
0
else
:
def
g1901
():
def
g1900
():
return
(
ls_1388
[
1
])
return
len_1387
(
g1900
())
return
(
1
)
+
(
g1901
())
return
g1899
return
g1898
return
y_1377
(
g1903
())
length_1384
=
g1904
()
return
length_1384
(
test_ls_1378
)
return
(
g1905
()
==
len_1386
)
def
g1927
():
"""
>>> g1927()
0
"""
def
g1926
():
def
g1924
():
def
g1925
():
return
loop_1389
()
return
g1925
return
g1924
loop_1389
=
g1926
()
loop_1389
()
return
0
def
g1935
():
"""
>>> g1935()
668
"""
def
g1934
():
def
g1928
():
def
g1933
():
def
g1931
(
link_1392
):
def
g1932
():
return
link_1392
()
return
g1932
return
g1931
loop_1391
=
g1933
()
def
g1930
():
def
g1929
():
return
668
return
g1929
return
loop_1391
(
g1930
())
return
g1928
f_1390
=
g1934
()
return
f_1390
()()
def
g1946
():
"""
>>> g1946()
14629
"""
def
g1945
():
def
g1944
():
return
1
return
g1944
if
(
g1945
()):
a_1393
=
2
def
g1943
():
def
g1942
():
def
g1941
():
def
g1938
(
x_1394
):
def
g1940
():
def
g1939
():
a_1393
=
1
a_1393
=
g1939
()
x_1395
=
g1940
()
return
x_1395
return
g1938
return
g1941
()(
1
)
if
(
g1942
()):
def
g1937
():
def
g1936
():
return
None
return
(
a_1393
==
g1936
())
if
(
g1937
()):
return
True
else
:
return
False
else
:
return
False
if
(
g1943
()):
return
778477
else
:
return
14629
def
g1949
():
"""
>>> g1949()
2
"""
def
g1948
():
def
g1947
(
x_1396
):
return
x_1396
return
g1947
f_1397
=
g1948
()
a_1398
=
1
return
((
f_1397
(
a_1398
))
+
(
a_1398
))
*
(
a_1398
)
def
g1952
():
"""
>>> g1952()
17
"""
def
g1951
():
def
g1950
(
x_1400
,
y_1399
):
return
x_1400
return
g1950
k_1401
=
g1951
()
b_1402
=
17
return
k_1401
(
k_1401
(
k_1401
,
37
),
37
)(
b_1402
,
(
b_1402
)
*
(
b_1402
))
def
g1956
():
"""
>>> g1956()
False
"""
def
g1955
():
def
g1953
():
n_1403
=
256
def
g1954
():
return
([
0
]
*
n_1403
)
v_1404
=
g1954
()
v_1404
[
32
]
=
n_1403
return
v_1404
[
32
]
return
g1953
f_1405
=
g1955
()
return
isinstance
(
f_1405
(),
list
)
def
g1959
():
"""
>>> g1959()
60
"""
w_1409
=
4
x_1408
=
8
y_1407
=
16
z_1406
=
32
def
g1958
():
def
g1957
():
return
(
w_1409
)
+
((
x_1408
)
+
((
y_1407
)
+
(
z_1406
)))
return
g1957
f_1410
=
g1958
()
return
f_1410
()
def
g1965
():
"""
>>> g1965()
37
"""
def
g1964
():
def
g1962
(
g_1412
,
u_1411
):
def
g1963
():
if
(
u_1411
):
return
g_1412
(
37
)
else
:
return
u_1411
return
g_1412
(
g1963
())
return
g1962
f_1413
=
g1964
()
def
g1961
():
def
g1960
(
x_1414
):
return
x_1414
return
g1960
return
f_1413
(
g1961
(),
75
)
def
g1971
():
"""
>>> g1971()
4687
"""
def
g1970
():
def
g1968
(
h_1416
,
u_1415
):
def
g1969
():
if
(
u_1415
):
return
h_1416
((
u_1415
)
+
(
37
))
else
:
return
u_1415
return
h_1416
(
g1969
())
return
g1968
f_1418
=
g1970
()
w_1417
=
62
def
g1967
():
def
g1966
(
x_1419
):
return
(
w_1417
)
-
(
x_1419
)
return
g1966
return
f_1418
(
g1967
(),
(
75
)
*
(
w_1417
))
def
g1983
():
"""
>>> g1983()
True
"""
t_1421
=
True
f_1420
=
False
def
g1982
():
return
[
t_1421
,
f_1420
]
bools_1424
=
g1982
()
def
g1981
():
def
g1980
(
x_1422
):
if
((
not
x_1422
)):
return
f_1420
else
:
return
t_1421
return
g1980
id_1423
=
g1981
()
def
g1979
():
def
g1976
(
x_1428
):
def
g1978
():
def
g1977
():
return
x_1428
==
0
return
id_1423
(
g1977
())
if
(
g1978
()):
return
(
bools_1424
[
0
])
else
:
return
odd_1425
((
x_1428
)
-
(
1
))
return
g1976
even_1426
=
g1979
()
def
g1975
():
def
g1972
(
y_1427
):
def
g1974
():
return
y_1427
==
0
if
(
g1974
()):
def
g1973
():
return
(
bools_1424
[
1
])
return
id_1423
(
g1973
())
else
:
return
even_1426
((
y_1427
)
-
(
1
))
return
g1972
odd_1425
=
g1975
()
return
odd_1425
(
5
)
def
g1990
():
"""
>>> g1990()
48
"""
def
g1989
():
def
g1984
(
x_1431
,
y_1430
,
z_1429
):
def
g1988
():
def
g1987
(
u_1435
,
v_1434
):
x_1431
=
u_1435
return
(
x_1431
)
+
(
v_1434
)
return
g1987
f_1437
=
g1988
()
def
g1986
():
def
g1985
(
r_1433
,
s_1432
):
y_1430
=
(
z_1429
)
+
(
s_1432
)
return
y_1430
return
g1985
g_1436
=
g1986
()
return
(
f_1437
(
1
,
2
))
*
(
g_1436
(
3
,
4
))
return
g1984
return
g1989
()(
10
,
11
,
12
)
def
g1997
():
"""
>>> g1997()
176
"""
def
g1996
():
def
g1991
(
x_1440
,
y_1439
,
z_1438
):
f_1444
=
False
def
g1995
():
def
g1994
(
r_1442
,
s_1441
):
y_1439
=
(
z_1438
)
+
(
s_1441
)
return
y_1439
return
g1994
g_1443
=
g1995
()
def
g1993
():
def
g1992
(
u_1446
,
v_1445
):
v_1445
=
u_1446
return
(
x_1440
)
+
(
v_1445
)
return
g1992
f_1444
=
g1993
()
return
(
f_1444
(
1
,
2
))
*
(
g_1443
(
3
,
4
))
return
g1991
return
g1996
()(
10
,
11
,
12
)
def
g2002
():
"""
>>> g2002()
5
"""
def
g2001
():
def
g2000
(
x_1450
):
return
(
x_1450
)
+
(
1
)
return
g2000
f_1448
=
g2001
()
def
g1999
():
def
g1998
(
y_1449
):
return
f_1448
(
f_1448
(
y_1449
))
return
g1998
g_1447
=
g1999
()
return
(
f_1448
(
1
))
+
(
g_1447
(
1
))
def
g2010
():
"""
>>> g2010()
1521
"""
y_1451
=
3
def
g2009
():
def
g2007
(
x_1457
):
def
g2008
():
return
x_1457
==
0
if
(
g2008
()):
return
g_1453
((
x_1457
)
+
(
1
))
else
:
return
f_1454
((
x_1457
)
-
(
y_1451
))
return
g2007
f_1454
=
g2009
()
def
g2006
():
def
g2005
(
x_1456
):
return
h_1452
((
x_1456
)
*
(
x_1456
))
return
g2005
g_1453
=
g2006
()
def
g2004
():
def
g2003
(
x_1455
):
return
x_1455
return
g2003
h_1452
=
g2004
()
return
g_1453
(
39
)
def
g2017
():
"""
>>> g2017()
-1
"""
def
g2014
():
def
g2013
(
x_1461
):
return
(
x_1461
)
+
(
1
)
return
g2013
f_1459
=
g2014
()
def
g2012
():
def
g2011
(
y_1460
):
return
f_1459
(
f_1459
(
y_1460
))
return
g2011
g_1458
=
g2012
()
def
g2016
():
def
g2015
(
x_1462
):
return
(
x_1462
)
-
(
1
)
return
g2015
f_1459
=
g2016
()
return
(
f_1459
(
1
))
+
(
g_1458
(
1
))
def
g2032
():
"""
>>> g2032()
[52, [17, [35, [17, 35]]]]
"""
def
g2031
():
def
g2030
():
return
(
a_1465
)
+
(
b_1464
)
return
g2030
f_1466
=
g2031
()
a_1465
=
17
b_1464
=
35
def
g2029
():
def
g2028
():
def
g2027
():
return
a_1465
return
g2027
def
g2026
():
def
g2025
():
return
b_1464
return
g2025
return
[
g2028
(),
g2026
()]
h_1463
=
g2029
()
def
g2024
():
def
g2023
():
def
g2022
():
def
g2021
():
def
g2020
():
return
(
h_1463
[
0
])
return
g2020
()()
def
g2019
():
def
g2018
():
return
(
h_1463
[
1
])
return
g2018
()()
return
[
g2021
(),
g2019
()]
return
[
b_1464
,
g2022
()]
return
[
a_1465
,
g2023
()]
return
[
f_1466
(),
g2024
()]
def
g2038
():
"""
>>> g2038()
120
"""
x_1469
=
5
def
g2037
():
a_1467
=
1
def
g2036
():
return
a_1467
return
g2036
th_1468
=
g2037
()
def
g2035
():
def
g2033
(
n_1472
,
th_1471
):
def
g2034
():
return
n_1472
==
0
if
(
g2034
()):
return
th_1471
()
else
:
return
(
n_1472
)
*
(
fact_1470
((
n_1472
)
-
(
1
),
th_1471
))
return
g2033
fact_1470
=
g2035
()
return
fact_1470
(
x_1469
,
th_1468
)
def
g2046
():
"""
>>> g2046()
[120, -120]
"""
def
g2045
():
def
g2044
(
n_1473
):
return
(
n_1473
<
0
)
return
g2044
negative_1474
=
g2045
()
def
g2043
():
def
g2041
(
n_1478
):
def
g2042
():
return
n_1478
==
0
if
(
g2042
()):
return
1
else
:
return
(
n_1478
)
*
(
fact_1476
((
n_1478
)
-
(
1
)))
return
g2041
fact_1476
=
g2043
()
def
g2040
():
def
g2039
(
n_1477
):
if
((
not
negative_1474
(
n_1477
))):
return
fact_1476
(
n_1477
)
else
:
return
(
0
)
-
(
fact_1476
((
0
)
-
(
n_1477
)))
return
g2039
call_fact_1475
=
g2040
()
return
[
call_fact_1475
(
5
),
call_fact_1475
(
-
5
)]
def
g2050
():
"""
>>> g2050()
[0, 1, 2, 3]
"""
def
g2049
():
def
g2048
(
v_1482
,
i_1481
,
n_1480
):
if
((
not
(
i_1481
==
n_1480
))):
v_1482
[
i_1481
]
=
i_1481
return
iota_fill_1479
(
v_1482
,
(
i_1481
)
+
(
1
),
n_1480
)
return
g2048
iota_fill_1479
=
g2049
()
n_1483
=
4
def
g2047
():
return
([
0
]
*
n_1483
)
v_1484
=
g2047
()
iota_fill_1479
(
v_1484
,
0
,
n_1483
)
return
v_1484
def
g2061
():
"""
>>> g2061()
[[33, 55], [77, 99]]
"""
def
g2060
():
def
g2059
():
def
g2058
():
def
g2057
():
def
g2051
(
a_1485
):
def
g2052
(
b_1486
):
def
g2053
(
c_1487
):
def
g2054
(
d_1488
):
def
g2056
():
return
[
a_1485
,
b_1486
]
def
g2055
():
return
[
c_1487
,
d_1488
]
return
[
g2056
(),
g2055
()]
return
g2054
return
g2053
return
g2052
return
g2051
return
g2057
()(
33
)
return
g2058
()(
55
)
return
g2059
()(
77
)
return
g2060
()(
99
)
def
g2075
():
"""
>>> g2075()
[[[3, [21, [18, []]]], [4, [28, [24, []]]]], [[[0, [0, [0, []]]], [1, [7, [6, []]]]], [[408, 408], []]]]
"""
a_1489
=
17
def
g2074
():
def
g2064
(
x_1490
):
x1_1492
=
(
x_1490
)
+
(
1
)
x2_1491
=
(
x_1490
)
+
(
2
)
y1_1494
=
(
x1_1492
)
*
(
7
)
y2_1493
=
(
x2_1491
)
*
(
7
)
z1_1496
=
(
y1_1494
)
-
(
x1_1492
)
z2_1495
=
(
y2_1493
)
-
(
x2_1491
)
w1_1498
=
(
z1_1496
)
*
(
a_1489
)
w2_1497
=
(
z2_1495
)
*
(
a_1489
)
def
g2073
():
def
g2068
(
b_1500
):
if
((
b_1500
==
a_1489
)):
def
g2072
():
def
g2071
():
return
[
z1_1496
,[]]
return
[
y1_1494
,
g2071
()]
return
[
x1_1492
,
g2072
()]
else
:
def
g2070
():
def
g2069
():
return
[
z2_1495
,[]]
return
[
y2_1493
,
g2069
()]
return
[
x2_1491
,
g2070
()]
return
g2068
g_1502
=
g2073
()
def
g2067
():
def
g2066
(
c_1499
):
if
((
c_1499
==
x_1490
)):
return
w1_1498
else
:
return
w2_1497
return
g2066
h_1501
=
g2067
()
def
g2065
():
if
(((
x_1490
)
*
(
x_1490
)
==
(
x_1490
)
+
(
x_1490
))):
return
True
else
:
return
(
x_1490
<
0
)
if
(
g2065
()):
return
[
g_1502
(
17
),
g_1502
(
16
)]
else
:
return
[
h_1501
(
x_1490
),
h_1501
((
x_1490
)
-
(
0
))]
return
g2064
f_1503
=
g2074
()
def
g2063
():
def
g2062
():
return
[
f_1503
(
3
),[]]
return
[
f_1503
(
-
1
),
g2062
()]
return
[
f_1503
(
2
),
g2063
()]
tests/run/lambda_tests.pyx
0 → 100644
View file @
539d795c
#
# lambda_tests.pyx
#
# Battery of tests for closures in Cython. Based on the collection of
# compiler tests from P423/B629 at Indiana University, Spring 1999 and
# Fall 2000. Special thanks to R. Kent Dybvig, Dan Friedman, Kevin
# Millikin, and everyone else who helped to generate the original
# tests. Converted into a collection of Python/Cython tests by Craig
# Citro.
#
# Note: This set of tests is split (somewhat randomly) into several
# files, simply because putting all the tests in a single file causes
# gcc and g++ to buckle under the load.
#
def
g0
():
"""
>>> g0()
4000
"""
return
(
lambda
y_1
:
y_1
)(
4000
)
def
g1
():
"""
>>> g1()
1
"""
f_3
=
(
lambda
x_2
:
x_2
)
return
(
f_3
(
0
)
+
1
)
def
g2
():
"""
>>> g2()
4
"""
f_5
=
(
lambda
y_4
:
y_4
)
return
f_5
(
f_5
(
4
))
def
g3
():
"""
>>> g3()
4
"""
return
(
lambda
f_7
:
f_7
(
f_7
(
4
)))((
lambda
y_6
:
y_6
))
def
g5
():
"""
>>> g5()
9000
"""
def
g4
():
a_8
=
4000
return
lambda
b_9
:
((
a_8
)
+
(
b_9
))
return
g4
()(
5000
)
def
g6
():
"""
>>> g6()
9000
"""
return
(
lambda
a_10
:
(
lambda
b_11
:
(
a_10
)
+
(
b_11
)))(
4000
)(
5000
)
def
g7
():
"""
>>> g7()
2
"""
return
(
lambda
f_13
:
f_13
(
f_13
(
0
)))((
lambda
x_12
:
(
x_12
+
1
)))
def
g8
():
"""
>>> g8()
0
"""
f_16
=
(
lambda
x_15
,
y_14
:
x_15
)
a_17
=
f_16
(
0
,
1
)
return
f_16
(
a_17
,
a_17
)
def
g10
():
"""
>>> g10()
3
"""
f_19
=
(
lambda
x_18
:
x_18
)
def
g9
():
a_22
=
0
b_21
=
1
c_20
=
2
return
(
f_19
(
a_22
))
+
((
f_19
(
b_21
))
+
(
f_19
(
c_20
)))
return
(
f_19
(
0
))
+
(
g9
())
def
g12
():
"""
>>> g12()
2
"""
def
g11
():
x_23
=
1
return
lambda
y_24
:
((
x_23
)
+
(
y_24
))
f_25
=
g11
()
x_26
=
0
return
f_25
(
f_25
(
x_26
))
def
g14
():
"""
>>> g14()
3050
"""
def
g13
():
t_29
=
(
lambda
x_28
:
(
x_28
)
+
(
50
))
return
lambda
f_30
:
(
t_29
(
f_30
(
1000
)))
return
g13
()((
lambda
y_27
:
(
y_27
)
+
(
2000
)))
def
g15
():
"""
>>> g15()
3050
"""
return
(
lambda
t_33
:
(
lambda
f_34
:
t_33
(
f_34
(
1000
))))((
lambda
x_32
:
(
x_32
)
+
(
50
)))((
lambda
y_31
:
(
y_31
)
+
(
2000
)))
def
g17
():
"""
>>> g17()
2050
"""
def
g16
():
t_35
=
50
return
lambda
f_36
:
((
t_35
)
+
(
f_36
()))
return
g16
()((
lambda
:
2000
))
def
g18
():
"""
>>> g18()
2050
"""
return
(
lambda
t_37
:
(
lambda
f_38
:
(
t_37
)
+
(
f_38
())))(
50
)((
lambda
:
2000
))
def
g20
():
"""
>>> g20()
700
"""
def
g19
():
x_39
=
300
return
lambda
y_40
:
((
x_39
)
+
(
y_40
))
return
g19
()(
400
)
def
g21
():
"""
>>> g21()
0
"""
x_44
=
3
f_43
=
(
lambda
x_42
,
y_41
:
x_42
)
if
(
f_43
(
0
,
0
)):
return
f_43
(
f_43
(
0
,
0
),
x_44
)
else
:
return
0
def
g22
():
"""
>>> g22()
False
"""
f_46
=
(
lambda
x_45
:
(
x_45
)
if
(((
not
((
x_45
[
0
])
==
0
)))
if
(
isinstance
(
x_45
,
list
))
else
(
False
))
else
(
False
))
return
f_46
([
0
,[
0
,[]]])
def
g23
():
"""
>>> g23()
False
"""
f_48
=
(
lambda
x_47
:
(
x_47
)
if
(((
not
((
not
((
x_47
[
0
])
==
0
)))
if
(
isinstance
(
x_47
,
list
))
else
(
False
)))
if
(
x_47
)
else
(
False
))
else
(
False
))
return
f_48
(
0
)
def
g24
():
"""
>>> g24()
[]
"""
f_50
=
(
lambda
x_49
:
(
x_49
)
if
((
True
)
if
(
isinstance
(
x_49
,
list
))
else
((
x_49
==
[])))
else
([]))
return
f_50
(
0
)
def
g25
():
"""
>>> g25()
0
"""
y_51
=
4
f_54
=
(
lambda
x_53
,
y_52
:
0
)
return
f_54
(
f_54
(
y_51
,
y_51
),
f_54
(
y_51
,
y_51
))
def
g26
():
"""
>>> g26()
0
"""
y_55
=
4
f_58
=
(
lambda
x_57
,
y_56
:
0
)
return
f_58
(
f_58
(
y_55
,
f_58
(
y_55
,
y_55
)),
f_58
(
y_55
,
f_58
(
y_55
,
y_55
)))
def
g27
():
"""
>>> g27()
4
"""
return
(
lambda
y_59
:
(
lambda
f_61
:
f_61
(
f_61
(
y_59
)))((
lambda
y_60
:
y_60
)))(
4
)
def
g28
():
"""
>>> g28()
23
"""
f_63
=
(
lambda
x_62
:
x_62
)
return
((
1
)
if
(
False
)
else
(
f_63
(
22
))
+
1
)
def
g29
():
"""
>>> g29()
5061
"""
f_68
=
(
lambda
x_65
:
((
not
x_65
))
if
(
x_65
)
else
(
x_65
))
f2_67
=
(
lambda
x_64
:
(
10
)
*
(
x_64
))
x_66
=
23
return
((
1
)
if
(
f_68
(
x_66
==
0
))
else
((
x_66
)
*
(
f2_67
((
x_66
-
1
))))
+
1
)
def
g30
():
"""
>>> g30()
1
"""
one_69
=
(
lambda
n_70
:
(
1
)
if
(
n_70
==
0
)
else
(
one_69
((
n_70
-
1
))))
return
one_69
(
13
)
def
g31
():
"""
>>> g31()
True
"""
even_72
=
(
lambda
x_74
:
(
True
)
if
(
x_74
==
0
)
else
(
odd_71
((
x_74
-
1
))))
odd_71
=
(
lambda
x_73
:
(
False
)
if
(
x_73
==
0
)
else
(
even_72
((
x_73
-
1
))))
return
odd_71
(
13
)
def
g32
():
"""
>>> g32()
False
"""
even_76
=
(
lambda
x_78
:
(
True
)
if
(
x_78
==
0
)
else
(
odd_75
((
x_78
-
1
))))
odd_75
=
(
lambda
x_77
:
(
False
)
if
(
x_77
==
0
)
else
(
even_76
((
x_77
-
1
))))
return
even_76
(
13
)
def
g34
():
"""
>>> g34()
True
"""
even_80
=
(
lambda
x_79
:
x_79
)
def
g33
():
even_82
=
(
lambda
x_84
:
(
True
)
if
(
x_84
==
0
)
else
(
odd_81
((
x_84
-
1
))))
odd_81
=
(
lambda
x_83
:
(
False
)
if
(
x_83
==
0
)
else
(
even_82
((
x_83
-
1
))))
return
odd_81
(
13
)
return
even_80
(
g33
())
def
g35
():
"""
>>> g35()
120
"""
fact_85
=
(
lambda
n_86
:
(
1
)
if
(
n_86
==
0
)
else
((
n_86
)
*
(
fact_85
((
n_86
-
1
)))))
return
fact_85
(
5
)
def
g38
():
"""
>>> g38()
10
"""
x_87
=
5
a_90
=
(
lambda
u_101
,
v_100
,
w_99
:
(
b_89
(
v_100
,
w_99
))
if
(
u_101
==
0
)
else
(
a_90
((
u_101
)
-
(
1
),
v_100
,
w_99
)))
def
g37
():
def
g36
(
q_93
,
r_92
):
p_94
=
(
q_93
)
*
(
r_92
)
e_96
=
(
lambda
n_98
:
(
c_88
(
p_94
))
if
(
n_98
==
0
)
else
(
o_95
((
n_98
)
-
(
1
))))
o_95
=
(
lambda
n_97
:
(
c_88
(
x_87
))
if
(
n_97
==
0
)
else
(
e_96
((
n_97
)
-
(
1
))))
return
e_96
((
q_93
)
*
(
r_92
))
return
g36
b_89
=
g37
()
c_88
=
(
lambda
x_91
:
(
5
)
*
(
x_91
))
return
a_90
(
3
,
2
,
1
)
def
g39
():
"""
>>> g39()
120
"""
fact_104
=
(
lambda
fact_103
,
n_102
:
(
1
)
if
(
n_102
==
0
)
else
((
fact_103
(
fact_103
,
(
n_102
-
1
)))
*
(
n_102
)))
return
fact_104
(
fact_104
,
5
)
def
g40
():
"""
>>> g40()
35
"""
return
(
lambda
x_105
:
(
lambda
y_106
:
(
lambda
z_107
:
(
lambda
w_108
:
(
lambda
u_109
:
(
x_105
)
+
((
y_106
)
+
((
z_107
)
+
((
w_108
)
+
(
u_109
)))))))))(
5
)(
6
)(
7
)(
8
)(
9
)
def
g41
():
"""
>>> g41()
6
"""
sum_112
=
(
lambda
sum_111
,
ls_110
:
(
0
)
if
((
ls_110
==
[]))
else
(((
ls_110
[
0
]))
+
(
sum_111
(
sum_111
,
(
ls_110
[
1
])))))
return
sum_112
(
sum_112
,
[
1
,[
2
,[
3
,[]]]])
def
g46
():
"""
>>> g46()
1500
"""
def
g45
():
def
g44
():
def
g42
(
a_113
):
def
g43
():
(
a_113
)
+
(
200
if
True
else
None
)
return
1500
return
g43
return
g42
return
g44
()(
1000
)
return
g45
()()
def
g53
():
"""
>>> g53()
2600
"""
def
g52
():
def
g51
():
def
g50
():
def
g47
(
a_114
):
def
g48
(
b_115
):
a_114
=
200
if
b_115
else
None
def
g49
(
c_116
):
c_116
=
400
if
300
else
None
return
(
a_114
)
+
((
b_115
)
+
(
c_116
))
return
g49
return
g48
return
g47
return
g50
()(
1000
)
return
g51
()(
2000
)
return
g52
()(
3000
)
def
g54
():
"""
>>> g54()
5
"""
return
(
lambda
f_118
:
f_118
(
f_118
(
5
)))((
lambda
x_117
:
x_117
))
def
g56
():
"""
>>> g56()
8000
"""
def
g55
():
f_120
=
(
lambda
x_119
:
(
x_119
)
+
(
3000
))
return
lambda
y_121
:
(
f_120
(
f_120
(
y_121
)))
return
g55
()(
2000
)
def
g57
():
"""
>>> g57()
120
"""
fact_125
=
(
lambda
fact_124
,
n_123
,
acc_122
:
(
acc_122
)
if
(
n_123
==
0
)
else
(
fact_124
(
fact_124
,
(
n_123
-
1
),
(
n_123
)
*
(
acc_122
))))
return
fact_125
(
fact_125
,
5
,
1
)
def
g58
():
"""
>>> g58()
3
"""
f_127
=
(
lambda
x_126
:
(
lambda
:
x_126
()))
return
f_127
((
lambda
:
3
))()
def
g59
():
"""
>>> g59()
22
"""
f_129
=
(
lambda
x_132
:
(
x_132
)
+
((
lambda
y_133
:
(
lambda
z_134
:
(
y_133
)
+
(
z_134
)))(
6
)(
7
)))
g_128
=
(
5
)
+
((
lambda
w_131
,
u_130
:
(
w_131
)
+
(
u_130
))(
8
,
9
))
return
g_128
def
g60
():
"""
>>> g60()
0
"""
loop_135
=
(
lambda
:
(
lambda
:
loop_135
()))
loop_135
()
return
0
def
g63
():
"""
>>> g63()
668
"""
def
g62
():
def
g61
():
loop_137
=
(
lambda
link_138
:
(
lambda
:
link_138
()))
return
loop_137
((
lambda
:
668
))
return
g61
f_136
=
g62
()
return
f_136
()()
def
g64
():
"""
>>> g64()
17
"""
k_141
=
(
lambda
x_140
,
y_139
:
x_140
)
b_142
=
17
return
k_141
(
k_141
(
k_141
,
37
),
37
)(
b_142
,
(
b_142
)
*
(
b_142
))
def
g65
():
"""
>>> g65()
37
"""
f_145
=
(
lambda
g_144
,
u_143
:
g_144
((
g_144
(
37
))
if
(
u_143
)
else
(
u_143
)))
return
f_145
((
lambda
x_146
:
x_146
),
75
)
def
g66
():
"""
>>> g66()
4687
"""
f_150
=
(
lambda
h_148
,
u_147
:
h_148
((
h_148
((
u_147
)
+
(
37
)))
if
(
u_147
)
else
(
u_147
)))
w_149
=
62
return
f_150
((
lambda
x_151
:
(
w_149
)
-
(
x_151
)),
(
75
)
*
(
w_149
))
def
g67
():
"""
>>> g67()
True
"""
t_153
=
True
f_152
=
False
bools_156
=
[
t_153
,
f_152
]
id_155
=
(
lambda
x_154
:
(
f_152
)
if
((
not
x_154
))
else
(
t_153
))
even_158
=
(
lambda
x_160
:
((
bools_156
[
0
]))
if
(
id_155
(
x_160
==
0
))
else
(
odd_157
((
x_160
)
-
(
1
))))
odd_157
=
(
lambda
y_159
:
(
id_155
((
bools_156
[
1
])))
if
(
y_159
==
0
)
else
(
even_158
((
y_159
)
-
(
1
))))
return
odd_157
(
5
)
def
g68
():
"""
>>> g68()
5
"""
f_162
=
(
lambda
x_164
:
(
x_164
)
+
(
1
))
g_161
=
(
lambda
y_163
:
f_162
(
f_162
(
y_163
)))
return
(
f_162
(
1
))
+
(
g_161
(
1
))
def
g69
():
"""
>>> g69()
1521
"""
y_165
=
3
f_168
=
(
lambda
x_171
:
(
g_167
((
x_171
)
+
(
1
)))
if
(
x_171
==
0
)
else
(
f_168
((
x_171
)
-
(
y_165
))))
g_167
=
(
lambda
x_170
:
h_166
((
x_170
)
*
(
x_170
)))
h_166
=
(
lambda
x_169
:
x_169
)
return
g_167
(
39
)
def
g70
():
"""
>>> g70()
-1
"""
f_173
=
(
lambda
x_175
:
(
x_175
)
+
(
1
))
g_172
=
(
lambda
y_174
:
f_173
(
f_173
(
y_174
)))
f_173
=
(
lambda
x_176
:
(
x_176
)
-
(
1
))
return
(
f_173
(
1
))
+
(
g_172
(
1
))
def
g71
():
"""
>>> g71()
[52, [17, [35, [17, 35]]]]
"""
f_180
=
(
lambda
:
(
a_179
)
+
(
b_178
))
a_179
=
17
b_178
=
35
h_177
=
[(
lambda
:
a_179
),(
lambda
:
b_178
)]
return
[
f_180
(),[
a_179
,[
b_178
,[(
h_177
[
0
])(),(
h_177
[
1
])()]]]]
def
g73
():
"""
>>> g73()
120
"""
x_183
=
5
def
g72
():
a_181
=
1
return
lambda
:
(
a_181
)
th_182
=
g72
()
fact_184
=
(
lambda
n_186
,
th_185
:
(
th_185
())
if
(
n_186
==
0
)
else
((
n_186
)
*
(
fact_184
((
n_186
)
-
(
1
),
th_185
))))
return
fact_184
(
x_183
,
th_182
)
def
g74
():
"""
>>> g74()
[120, -120]
"""
negative_188
=
(
lambda
n_187
:
(
n_187
<
0
))
fact_190
=
(
lambda
n_192
:
(
1
)
if
(
n_192
==
0
)
else
((
n_192
)
*
(
fact_190
((
n_192
)
-
(
1
)))))
call_fact_189
=
(
lambda
n_191
:
(
fact_190
(
n_191
))
if
((
not
negative_188
(
n_191
)))
else
((
0
)
-
(
fact_190
((
0
)
-
(
n_191
)))))
return
[
call_fact_189
(
5
),
call_fact_189
(
-
5
)]
def
g75
():
"""
>>> g75()
[[33, 55], [77, 99]]
"""
return
(
lambda
a_193
:
(
lambda
b_194
:
(
lambda
c_195
:
(
lambda
d_196
:
[[
a_193
,
b_194
],[
c_195
,
d_196
]]))))(
33
)(
55
)(
77
)(
99
)
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