This file is indexed.

/usr/share/snd/s7test.scm is in snd 18.1-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

    1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
   97
   98
   99
  100
  101
  102
  103
  104
  105
  106
  107
  108
  109
  110
  111
  112
  113
  114
  115
  116
  117
  118
  119
  120
  121
  122
  123
  124
  125
  126
  127
  128
  129
  130
  131
  132
  133
  134
  135
  136
  137
  138
  139
  140
  141
  142
  143
  144
  145
  146
  147
  148
  149
  150
  151
  152
  153
  154
  155
  156
  157
  158
  159
  160
  161
  162
  163
  164
  165
  166
  167
  168
  169
  170
  171
  172
  173
  174
  175
  176
  177
  178
  179
  180
  181
  182
  183
  184
  185
  186
  187
  188
  189
  190
  191
  192
  193
  194
  195
  196
  197
  198
  199
  200
  201
  202
  203
  204
  205
  206
  207
  208
  209
  210
  211
  212
  213
  214
  215
  216
  217
  218
  219
  220
  221
  222
  223
  224
  225
  226
  227
  228
  229
  230
  231
  232
  233
  234
  235
  236
  237
  238
  239
  240
  241
  242
  243
  244
  245
  246
  247
  248
  249
  250
  251
  252
  253
  254
  255
  256
  257
  258
  259
  260
  261
  262
  263
  264
  265
  266
  267
  268
  269
  270
  271
  272
  273
  274
  275
  276
  277
  278
  279
  280
  281
  282
  283
  284
  285
  286
  287
  288
  289
  290
  291
  292
  293
  294
  295
  296
  297
  298
  299
  300
  301
  302
  303
  304
  305
  306
  307
  308
  309
  310
  311
  312
  313
  314
  315
  316
  317
  318
  319
  320
  321
  322
  323
  324
  325
  326
  327
  328
  329
  330
  331
  332
  333
  334
  335
  336
  337
  338
  339
  340
  341
  342
  343
  344
  345
  346
  347
  348
  349
  350
  351
  352
  353
  354
  355
  356
  357
  358
  359
  360
  361
  362
  363
  364
  365
  366
  367
  368
  369
  370
  371
  372
  373
  374
  375
  376
  377
  378
  379
  380
  381
  382
  383
  384
  385
  386
  387
  388
  389
  390
  391
  392
  393
  394
  395
  396
  397
  398
  399
  400
  401
  402
  403
  404
  405
  406
  407
  408
  409
  410
  411
  412
  413
  414
  415
  416
  417
  418
  419
  420
  421
  422
  423
  424
  425
  426
  427
  428
  429
  430
  431
  432
  433
  434
  435
  436
  437
  438
  439
  440
  441
  442
  443
  444
  445
  446
  447
  448
  449
  450
  451
  452
  453
  454
  455
  456
  457
  458
  459
  460
  461
  462
  463
  464
  465
  466
  467
  468
  469
  470
  471
  472
  473
  474
  475
  476
  477
  478
  479
  480
  481
  482
  483
  484
  485
  486
  487
  488
  489
  490
  491
  492
  493
  494
  495
  496
  497
  498
  499
  500
  501
  502
  503
  504
  505
  506
  507
  508
  509
  510
  511
  512
  513
  514
  515
  516
  517
  518
  519
  520
  521
  522
  523
  524
  525
  526
  527
  528
  529
  530
  531
  532
  533
  534
  535
  536
  537
  538
  539
  540
  541
  542
  543
  544
  545
  546
  547
  548
  549
  550
  551
  552
  553
  554
  555
  556
  557
  558
  559
  560
  561
  562
  563
  564
  565
  566
  567
  568
  569
  570
  571
  572
  573
  574
  575
  576
  577
  578
  579
  580
  581
  582
  583
  584
  585
  586
  587
  588
  589
  590
  591
  592
  593
  594
  595
  596
  597
  598
  599
  600
  601
  602
  603
  604
  605
  606
  607
  608
  609
  610
  611
  612
  613
  614
  615
  616
  617
  618
  619
  620
  621
  622
  623
  624
  625
  626
  627
  628
  629
  630
  631
  632
  633
  634
  635
  636
  637
  638
  639
  640
  641
  642
  643
  644
  645
  646
  647
  648
  649
  650
  651
  652
  653
  654
  655
  656
  657
  658
  659
  660
  661
  662
  663
  664
  665
  666
  667
  668
  669
  670
  671
  672
  673
  674
  675
  676
  677
  678
  679
  680
  681
  682
  683
  684
  685
  686
  687
  688
  689
  690
  691
  692
  693
  694
  695
  696
  697
  698
  699
  700
  701
  702
  703
  704
  705
  706
  707
  708
  709
  710
  711
  712
  713
  714
  715
  716
  717
  718
  719
  720
  721
  722
  723
  724
  725
  726
  727
  728
  729
  730
  731
  732
  733
  734
  735
  736
  737
  738
  739
  740
  741
  742
  743
  744
  745
  746
  747
  748
  749
  750
  751
  752
  753
  754
  755
  756
  757
  758
  759
  760
  761
  762
  763
  764
  765
  766
  767
  768
  769
  770
  771
  772
  773
  774
  775
  776
  777
  778
  779
  780
  781
  782
  783
  784
  785
  786
  787
  788
  789
  790
  791
  792
  793
  794
  795
  796
  797
  798
  799
  800
  801
  802
  803
  804
  805
  806
  807
  808
  809
  810
  811
  812
  813
  814
  815
  816
  817
  818
  819
  820
  821
  822
  823
  824
  825
  826
  827
  828
  829
  830
  831
  832
  833
  834
  835
  836
  837
  838
  839
  840
  841
  842
  843
  844
  845
  846
  847
  848
  849
  850
  851
  852
  853
  854
  855
  856
  857
  858
  859
  860
  861
  862
  863
  864
  865
  866
  867
  868
  869
  870
  871
  872
  873
  874
  875
  876
  877
  878
  879
  880
  881
  882
  883
  884
  885
  886
  887
  888
  889
  890
  891
  892
  893
  894
  895
  896
  897
  898
  899
  900
  901
  902
  903
  904
  905
  906
  907
  908
  909
  910
  911
  912
  913
  914
  915
  916
  917
  918
  919
  920
  921
  922
  923
  924
  925
  926
  927
  928
  929
  930
  931
  932
  933
  934
  935
  936
  937
  938
  939
  940
  941
  942
  943
  944
  945
  946
  947
  948
  949
  950
  951
  952
  953
  954
  955
  956
  957
  958
  959
  960
  961
  962
  963
  964
  965
  966
  967
  968
  969
  970
  971
  972
  973
  974
  975
  976
  977
  978
  979
  980
  981
  982
  983
  984
  985
  986
  987
  988
  989
  990
  991
  992
  993
  994
  995
  996
  997
  998
  999
 1000
 1001
 1002
 1003
 1004
 1005
 1006
 1007
 1008
 1009
 1010
 1011
 1012
 1013
 1014
 1015
 1016
 1017
 1018
 1019
 1020
 1021
 1022
 1023
 1024
 1025
 1026
 1027
 1028
 1029
 1030
 1031
 1032
 1033
 1034
 1035
 1036
 1037
 1038
 1039
 1040
 1041
 1042
 1043
 1044
 1045
 1046
 1047
 1048
 1049
 1050
 1051
 1052
 1053
 1054
 1055
 1056
 1057
 1058
 1059
 1060
 1061
 1062
 1063
 1064
 1065
 1066
 1067
 1068
 1069
 1070
 1071
 1072
 1073
 1074
 1075
 1076
 1077
 1078
 1079
 1080
 1081
 1082
 1083
 1084
 1085
 1086
 1087
 1088
 1089
 1090
 1091
 1092
 1093
 1094
 1095
 1096
 1097
 1098
 1099
 1100
 1101
 1102
 1103
 1104
 1105
 1106
 1107
 1108
 1109
 1110
 1111
 1112
 1113
 1114
 1115
 1116
 1117
 1118
 1119
 1120
 1121
 1122
 1123
 1124
 1125
 1126
 1127
 1128
 1129
 1130
 1131
 1132
 1133
 1134
 1135
 1136
 1137
 1138
 1139
 1140
 1141
 1142
 1143
 1144
 1145
 1146
 1147
 1148
 1149
 1150
 1151
 1152
 1153
 1154
 1155
 1156
 1157
 1158
 1159
 1160
 1161
 1162
 1163
 1164
 1165
 1166
 1167
 1168
 1169
 1170
 1171
 1172
 1173
 1174
 1175
 1176
 1177
 1178
 1179
 1180
 1181
 1182
 1183
 1184
 1185
 1186
 1187
 1188
 1189
 1190
 1191
 1192
 1193
 1194
 1195
 1196
 1197
 1198
 1199
 1200
 1201
 1202
 1203
 1204
 1205
 1206
 1207
 1208
 1209
 1210
 1211
 1212
 1213
 1214
 1215
 1216
 1217
 1218
 1219
 1220
 1221
 1222
 1223
 1224
 1225
 1226
 1227
 1228
 1229
 1230
 1231
 1232
 1233
 1234
 1235
 1236
 1237
 1238
 1239
 1240
 1241
 1242
 1243
 1244
 1245
 1246
 1247
 1248
 1249
 1250
 1251
 1252
 1253
 1254
 1255
 1256
 1257
 1258
 1259
 1260
 1261
 1262
 1263
 1264
 1265
 1266
 1267
 1268
 1269
 1270
 1271
 1272
 1273
 1274
 1275
 1276
 1277
 1278
 1279
 1280
 1281
 1282
 1283
 1284
 1285
 1286
 1287
 1288
 1289
 1290
 1291
 1292
 1293
 1294
 1295
 1296
 1297
 1298
 1299
 1300
 1301
 1302
 1303
 1304
 1305
 1306
 1307
 1308
 1309
 1310
 1311
 1312
 1313
 1314
 1315
 1316
 1317
 1318
 1319
 1320
 1321
 1322
 1323
 1324
 1325
 1326
 1327
 1328
 1329
 1330
 1331
 1332
 1333
 1334
 1335
 1336
 1337
 1338
 1339
 1340
 1341
 1342
 1343
 1344
 1345
 1346
 1347
 1348
 1349
 1350
 1351
 1352
 1353
 1354
 1355
 1356
 1357
 1358
 1359
 1360
 1361
 1362
 1363
 1364
 1365
 1366
 1367
 1368
 1369
 1370
 1371
 1372
 1373
 1374
 1375
 1376
 1377
 1378
 1379
 1380
 1381
 1382
 1383
 1384
 1385
 1386
 1387
 1388
 1389
 1390
 1391
 1392
 1393
 1394
 1395
 1396
 1397
 1398
 1399
 1400
 1401
 1402
 1403
 1404
 1405
 1406
 1407
 1408
 1409
 1410
 1411
 1412
 1413
 1414
 1415
 1416
 1417
 1418
 1419
 1420
 1421
 1422
 1423
 1424
 1425
 1426
 1427
 1428
 1429
 1430
 1431
 1432
 1433
 1434
 1435
 1436
 1437
 1438
 1439
 1440
 1441
 1442
 1443
 1444
 1445
 1446
 1447
 1448
 1449
 1450
 1451
 1452
 1453
 1454
 1455
 1456
 1457
 1458
 1459
 1460
 1461
 1462
 1463
 1464
 1465
 1466
 1467
 1468
 1469
 1470
 1471
 1472
 1473
 1474
 1475
 1476
 1477
 1478
 1479
 1480
 1481
 1482
 1483
 1484
 1485
 1486
 1487
 1488
 1489
 1490
 1491
 1492
 1493
 1494
 1495
 1496
 1497
 1498
 1499
 1500
 1501
 1502
 1503
 1504
 1505
 1506
 1507
 1508
 1509
 1510
 1511
 1512
 1513
 1514
 1515
 1516
 1517
 1518
 1519
 1520
 1521
 1522
 1523
 1524
 1525
 1526
 1527
 1528
 1529
 1530
 1531
 1532
 1533
 1534
 1535
 1536
 1537
 1538
 1539
 1540
 1541
 1542
 1543
 1544
 1545
 1546
 1547
 1548
 1549
 1550
 1551
 1552
 1553
 1554
 1555
 1556
 1557
 1558
 1559
 1560
 1561
 1562
 1563
 1564
 1565
 1566
 1567
 1568
 1569
 1570
 1571
 1572
 1573
 1574
 1575
 1576
 1577
 1578
 1579
 1580
 1581
 1582
 1583
 1584
 1585
 1586
 1587
 1588
 1589
 1590
 1591
 1592
 1593
 1594
 1595
 1596
 1597
 1598
 1599
 1600
 1601
 1602
 1603
 1604
 1605
 1606
 1607
 1608
 1609
 1610
 1611
 1612
 1613
 1614
 1615
 1616
 1617
 1618
 1619
 1620
 1621
 1622
 1623
 1624
 1625
 1626
 1627
 1628
 1629
 1630
 1631
 1632
 1633
 1634
 1635
 1636
 1637
 1638
 1639
 1640
 1641
 1642
 1643
 1644
 1645
 1646
 1647
 1648
 1649
 1650
 1651
 1652
 1653
 1654
 1655
 1656
 1657
 1658
 1659
 1660
 1661
 1662
 1663
 1664
 1665
 1666
 1667
 1668
 1669
 1670
 1671
 1672
 1673
 1674
 1675
 1676
 1677
 1678
 1679
 1680
 1681
 1682
 1683
 1684
 1685
 1686
 1687
 1688
 1689
 1690
 1691
 1692
 1693
 1694
 1695
 1696
 1697
 1698
 1699
 1700
 1701
 1702
 1703
 1704
 1705
 1706
 1707
 1708
 1709
 1710
 1711
 1712
 1713
 1714
 1715
 1716
 1717
 1718
 1719
 1720
 1721
 1722
 1723
 1724
 1725
 1726
 1727
 1728
 1729
 1730
 1731
 1732
 1733
 1734
 1735
 1736
 1737
 1738
 1739
 1740
 1741
 1742
 1743
 1744
 1745
 1746
 1747
 1748
 1749
 1750
 1751
 1752
 1753
 1754
 1755
 1756
 1757
 1758
 1759
 1760
 1761
 1762
 1763
 1764
 1765
 1766
 1767
 1768
 1769
 1770
 1771
 1772
 1773
 1774
 1775
 1776
 1777
 1778
 1779
 1780
 1781
 1782
 1783
 1784
 1785
 1786
 1787
 1788
 1789
 1790
 1791
 1792
 1793
 1794
 1795
 1796
 1797
 1798
 1799
 1800
 1801
 1802
 1803
 1804
 1805
 1806
 1807
 1808
 1809
 1810
 1811
 1812
 1813
 1814
 1815
 1816
 1817
 1818
 1819
 1820
 1821
 1822
 1823
 1824
 1825
 1826
 1827
 1828
 1829
 1830
 1831
 1832
 1833
 1834
 1835
 1836
 1837
 1838
 1839
 1840
 1841
 1842
 1843
 1844
 1845
 1846
 1847
 1848
 1849
 1850
 1851
 1852
 1853
 1854
 1855
 1856
 1857
 1858
 1859
 1860
 1861
 1862
 1863
 1864
 1865
 1866
 1867
 1868
 1869
 1870
 1871
 1872
 1873
 1874
 1875
 1876
 1877
 1878
 1879
 1880
 1881
 1882
 1883
 1884
 1885
 1886
 1887
 1888
 1889
 1890
 1891
 1892
 1893
 1894
 1895
 1896
 1897
 1898
 1899
 1900
 1901
 1902
 1903
 1904
 1905
 1906
 1907
 1908
 1909
 1910
 1911
 1912
 1913
 1914
 1915
 1916
 1917
 1918
 1919
 1920
 1921
 1922
 1923
 1924
 1925
 1926
 1927
 1928
 1929
 1930
 1931
 1932
 1933
 1934
 1935
 1936
 1937
 1938
 1939
 1940
 1941
 1942
 1943
 1944
 1945
 1946
 1947
 1948
 1949
 1950
 1951
 1952
 1953
 1954
 1955
 1956
 1957
 1958
 1959
 1960
 1961
 1962
 1963
 1964
 1965
 1966
 1967
 1968
 1969
 1970
 1971
 1972
 1973
 1974
 1975
 1976
 1977
 1978
 1979
 1980
 1981
 1982
 1983
 1984
 1985
 1986
 1987
 1988
 1989
 1990
 1991
 1992
 1993
 1994
 1995
 1996
 1997
 1998
 1999
 2000
 2001
 2002
 2003
 2004
 2005
 2006
 2007
 2008
 2009
 2010
 2011
 2012
 2013
 2014
 2015
 2016
 2017
 2018
 2019
 2020
 2021
 2022
 2023
 2024
 2025
 2026
 2027
 2028
 2029
 2030
 2031
 2032
 2033
 2034
 2035
 2036
 2037
 2038
 2039
 2040
 2041
 2042
 2043
 2044
 2045
 2046
 2047
 2048
 2049
 2050
 2051
 2052
 2053
 2054
 2055
 2056
 2057
 2058
 2059
 2060
 2061
 2062
 2063
 2064
 2065
 2066
 2067
 2068
 2069
 2070
 2071
 2072
 2073
 2074
 2075
 2076
 2077
 2078
 2079
 2080
 2081
 2082
 2083
 2084
 2085
 2086
 2087
 2088
 2089
 2090
 2091
 2092
 2093
 2094
 2095
 2096
 2097
 2098
 2099
 2100
 2101
 2102
 2103
 2104
 2105
 2106
 2107
 2108
 2109
 2110
 2111
 2112
 2113
 2114
 2115
 2116
 2117
 2118
 2119
 2120
 2121
 2122
 2123
 2124
 2125
 2126
 2127
 2128
 2129
 2130
 2131
 2132
 2133
 2134
 2135
 2136
 2137
 2138
 2139
 2140
 2141
 2142
 2143
 2144
 2145
 2146
 2147
 2148
 2149
 2150
 2151
 2152
 2153
 2154
 2155
 2156
 2157
 2158
 2159
 2160
 2161
 2162
 2163
 2164
 2165
 2166
 2167
 2168
 2169
 2170
 2171
 2172
 2173
 2174
 2175
 2176
 2177
 2178
 2179
 2180
 2181
 2182
 2183
 2184
 2185
 2186
 2187
 2188
 2189
 2190
 2191
 2192
 2193
 2194
 2195
 2196
 2197
 2198
 2199
 2200
 2201
 2202
 2203
 2204
 2205
 2206
 2207
 2208
 2209
 2210
 2211
 2212
 2213
 2214
 2215
 2216
 2217
 2218
 2219
 2220
 2221
 2222
 2223
 2224
 2225
 2226
 2227
 2228
 2229
 2230
 2231
 2232
 2233
 2234
 2235
 2236
 2237
 2238
 2239
 2240
 2241
 2242
 2243
 2244
 2245
 2246
 2247
 2248
 2249
 2250
 2251
 2252
 2253
 2254
 2255
 2256
 2257
 2258
 2259
 2260
 2261
 2262
 2263
 2264
 2265
 2266
 2267
 2268
 2269
 2270
 2271
 2272
 2273
 2274
 2275
 2276
 2277
 2278
 2279
 2280
 2281
 2282
 2283
 2284
 2285
 2286
 2287
 2288
 2289
 2290
 2291
 2292
 2293
 2294
 2295
 2296
 2297
 2298
 2299
 2300
 2301
 2302
 2303
 2304
 2305
 2306
 2307
 2308
 2309
 2310
 2311
 2312
 2313
 2314
 2315
 2316
 2317
 2318
 2319
 2320
 2321
 2322
 2323
 2324
 2325
 2326
 2327
 2328
 2329
 2330
 2331
 2332
 2333
 2334
 2335
 2336
 2337
 2338
 2339
 2340
 2341
 2342
 2343
 2344
 2345
 2346
 2347
 2348
 2349
 2350
 2351
 2352
 2353
 2354
 2355
 2356
 2357
 2358
 2359
 2360
 2361
 2362
 2363
 2364
 2365
 2366
 2367
 2368
 2369
 2370
 2371
 2372
 2373
 2374
 2375
 2376
 2377
 2378
 2379
 2380
 2381
 2382
 2383
 2384
 2385
 2386
 2387
 2388
 2389
 2390
 2391
 2392
 2393
 2394
 2395
 2396
 2397
 2398
 2399
 2400
 2401
 2402
 2403
 2404
 2405
 2406
 2407
 2408
 2409
 2410
 2411
 2412
 2413
 2414
 2415
 2416
 2417
 2418
 2419
 2420
 2421
 2422
 2423
 2424
 2425
 2426
 2427
 2428
 2429
 2430
 2431
 2432
 2433
 2434
 2435
 2436
 2437
 2438
 2439
 2440
 2441
 2442
 2443
 2444
 2445
 2446
 2447
 2448
 2449
 2450
 2451
 2452
 2453
 2454
 2455
 2456
 2457
 2458
 2459
 2460
 2461
 2462
 2463
 2464
 2465
 2466
 2467
 2468
 2469
 2470
 2471
 2472
 2473
 2474
 2475
 2476
 2477
 2478
 2479
 2480
 2481
 2482
 2483
 2484
 2485
 2486
 2487
 2488
 2489
 2490
 2491
 2492
 2493
 2494
 2495
 2496
 2497
 2498
 2499
 2500
 2501
 2502
 2503
 2504
 2505
 2506
 2507
 2508
 2509
 2510
 2511
 2512
 2513
 2514
 2515
 2516
 2517
 2518
 2519
 2520
 2521
 2522
 2523
 2524
 2525
 2526
 2527
 2528
 2529
 2530
 2531
 2532
 2533
 2534
 2535
 2536
 2537
 2538
 2539
 2540
 2541
 2542
 2543
 2544
 2545
 2546
 2547
 2548
 2549
 2550
 2551
 2552
 2553
 2554
 2555
 2556
 2557
 2558
 2559
 2560
 2561
 2562
 2563
 2564
 2565
 2566
 2567
 2568
 2569
 2570
 2571
 2572
 2573
 2574
 2575
 2576
 2577
 2578
 2579
 2580
 2581
 2582
 2583
 2584
 2585
 2586
 2587
 2588
 2589
 2590
 2591
 2592
 2593
 2594
 2595
 2596
 2597
 2598
 2599
 2600
 2601
 2602
 2603
 2604
 2605
 2606
 2607
 2608
 2609
 2610
 2611
 2612
 2613
 2614
 2615
 2616
 2617
 2618
 2619
 2620
 2621
 2622
 2623
 2624
 2625
 2626
 2627
 2628
 2629
 2630
 2631
 2632
 2633
 2634
 2635
 2636
 2637
 2638
 2639
 2640
 2641
 2642
 2643
 2644
 2645
 2646
 2647
 2648
 2649
 2650
 2651
 2652
 2653
 2654
 2655
 2656
 2657
 2658
 2659
 2660
 2661
 2662
 2663
 2664
 2665
 2666
 2667
 2668
 2669
 2670
 2671
 2672
 2673
 2674
 2675
 2676
 2677
 2678
 2679
 2680
 2681
 2682
 2683
 2684
 2685
 2686
 2687
 2688
 2689
 2690
 2691
 2692
 2693
 2694
 2695
 2696
 2697
 2698
 2699
 2700
 2701
 2702
 2703
 2704
 2705
 2706
 2707
 2708
 2709
 2710
 2711
 2712
 2713
 2714
 2715
 2716
 2717
 2718
 2719
 2720
 2721
 2722
 2723
 2724
 2725
 2726
 2727
 2728
 2729
 2730
 2731
 2732
 2733
 2734
 2735
 2736
 2737
 2738
 2739
 2740
 2741
 2742
 2743
 2744
 2745
 2746
 2747
 2748
 2749
 2750
 2751
 2752
 2753
 2754
 2755
 2756
 2757
 2758
 2759
 2760
 2761
 2762
 2763
 2764
 2765
 2766
 2767
 2768
 2769
 2770
 2771
 2772
 2773
 2774
 2775
 2776
 2777
 2778
 2779
 2780
 2781
 2782
 2783
 2784
 2785
 2786
 2787
 2788
 2789
 2790
 2791
 2792
 2793
 2794
 2795
 2796
 2797
 2798
 2799
 2800
 2801
 2802
 2803
 2804
 2805
 2806
 2807
 2808
 2809
 2810
 2811
 2812
 2813
 2814
 2815
 2816
 2817
 2818
 2819
 2820
 2821
 2822
 2823
 2824
 2825
 2826
 2827
 2828
 2829
 2830
 2831
 2832
 2833
 2834
 2835
 2836
 2837
 2838
 2839
 2840
 2841
 2842
 2843
 2844
 2845
 2846
 2847
 2848
 2849
 2850
 2851
 2852
 2853
 2854
 2855
 2856
 2857
 2858
 2859
 2860
 2861
 2862
 2863
 2864
 2865
 2866
 2867
 2868
 2869
 2870
 2871
 2872
 2873
 2874
 2875
 2876
 2877
 2878
 2879
 2880
 2881
 2882
 2883
 2884
 2885
 2886
 2887
 2888
 2889
 2890
 2891
 2892
 2893
 2894
 2895
 2896
 2897
 2898
 2899
 2900
 2901
 2902
 2903
 2904
 2905
 2906
 2907
 2908
 2909
 2910
 2911
 2912
 2913
 2914
 2915
 2916
 2917
 2918
 2919
 2920
 2921
 2922
 2923
 2924
 2925
 2926
 2927
 2928
 2929
 2930
 2931
 2932
 2933
 2934
 2935
 2936
 2937
 2938
 2939
 2940
 2941
 2942
 2943
 2944
 2945
 2946
 2947
 2948
 2949
 2950
 2951
 2952
 2953
 2954
 2955
 2956
 2957
 2958
 2959
 2960
 2961
 2962
 2963
 2964
 2965
 2966
 2967
 2968
 2969
 2970
 2971
 2972
 2973
 2974
 2975
 2976
 2977
 2978
 2979
 2980
 2981
 2982
 2983
 2984
 2985
 2986
 2987
 2988
 2989
 2990
 2991
 2992
 2993
 2994
 2995
 2996
 2997
 2998
 2999
 3000
 3001
 3002
 3003
 3004
 3005
 3006
 3007
 3008
 3009
 3010
 3011
 3012
 3013
 3014
 3015
 3016
 3017
 3018
 3019
 3020
 3021
 3022
 3023
 3024
 3025
 3026
 3027
 3028
 3029
 3030
 3031
 3032
 3033
 3034
 3035
 3036
 3037
 3038
 3039
 3040
 3041
 3042
 3043
 3044
 3045
 3046
 3047
 3048
 3049
 3050
 3051
 3052
 3053
 3054
 3055
 3056
 3057
 3058
 3059
 3060
 3061
 3062
 3063
 3064
 3065
 3066
 3067
 3068
 3069
 3070
 3071
 3072
 3073
 3074
 3075
 3076
 3077
 3078
 3079
 3080
 3081
 3082
 3083
 3084
 3085
 3086
 3087
 3088
 3089
 3090
 3091
 3092
 3093
 3094
 3095
 3096
 3097
 3098
 3099
 3100
 3101
 3102
 3103
 3104
 3105
 3106
 3107
 3108
 3109
 3110
 3111
 3112
 3113
 3114
 3115
 3116
 3117
 3118
 3119
 3120
 3121
 3122
 3123
 3124
 3125
 3126
 3127
 3128
 3129
 3130
 3131
 3132
 3133
 3134
 3135
 3136
 3137
 3138
 3139
 3140
 3141
 3142
 3143
 3144
 3145
 3146
 3147
 3148
 3149
 3150
 3151
 3152
 3153
 3154
 3155
 3156
 3157
 3158
 3159
 3160
 3161
 3162
 3163
 3164
 3165
 3166
 3167
 3168
 3169
 3170
 3171
 3172
 3173
 3174
 3175
 3176
 3177
 3178
 3179
 3180
 3181
 3182
 3183
 3184
 3185
 3186
 3187
 3188
 3189
 3190
 3191
 3192
 3193
 3194
 3195
 3196
 3197
 3198
 3199
 3200
 3201
 3202
 3203
 3204
 3205
 3206
 3207
 3208
 3209
 3210
 3211
 3212
 3213
 3214
 3215
 3216
 3217
 3218
 3219
 3220
 3221
 3222
 3223
 3224
 3225
 3226
 3227
 3228
 3229
 3230
 3231
 3232
 3233
 3234
 3235
 3236
 3237
 3238
 3239
 3240
 3241
 3242
 3243
 3244
 3245
 3246
 3247
 3248
 3249
 3250
 3251
 3252
 3253
 3254
 3255
 3256
 3257
 3258
 3259
 3260
 3261
 3262
 3263
 3264
 3265
 3266
 3267
 3268
 3269
 3270
 3271
 3272
 3273
 3274
 3275
 3276
 3277
 3278
 3279
 3280
 3281
 3282
 3283
 3284
 3285
 3286
 3287
 3288
 3289
 3290
 3291
 3292
 3293
 3294
 3295
 3296
 3297
 3298
 3299
 3300
 3301
 3302
 3303
 3304
 3305
 3306
 3307
 3308
 3309
 3310
 3311
 3312
 3313
 3314
 3315
 3316
 3317
 3318
 3319
 3320
 3321
 3322
 3323
 3324
 3325
 3326
 3327
 3328
 3329
 3330
 3331
 3332
 3333
 3334
 3335
 3336
 3337
 3338
 3339
 3340
 3341
 3342
 3343
 3344
 3345
 3346
 3347
 3348
 3349
 3350
 3351
 3352
 3353
 3354
 3355
 3356
 3357
 3358
 3359
 3360
 3361
 3362
 3363
 3364
 3365
 3366
 3367
 3368
 3369
 3370
 3371
 3372
 3373
 3374
 3375
 3376
 3377
 3378
 3379
 3380
 3381
 3382
 3383
 3384
 3385
 3386
 3387
 3388
 3389
 3390
 3391
 3392
 3393
 3394
 3395
 3396
 3397
 3398
 3399
 3400
 3401
 3402
 3403
 3404
 3405
 3406
 3407
 3408
 3409
 3410
 3411
 3412
 3413
 3414
 3415
 3416
 3417
 3418
 3419
 3420
 3421
 3422
 3423
 3424
 3425
 3426
 3427
 3428
 3429
 3430
 3431
 3432
 3433
 3434
 3435
 3436
 3437
 3438
 3439
 3440
 3441
 3442
 3443
 3444
 3445
 3446
 3447
 3448
 3449
 3450
 3451
 3452
 3453
 3454
 3455
 3456
 3457
 3458
 3459
 3460
 3461
 3462
 3463
 3464
 3465
 3466
 3467
 3468
 3469
 3470
 3471
 3472
 3473
 3474
 3475
 3476
 3477
 3478
 3479
 3480
 3481
 3482
 3483
 3484
 3485
 3486
 3487
 3488
 3489
 3490
 3491
 3492
 3493
 3494
 3495
 3496
 3497
 3498
 3499
 3500
 3501
 3502
 3503
 3504
 3505
 3506
 3507
 3508
 3509
 3510
 3511
 3512
 3513
 3514
 3515
 3516
 3517
 3518
 3519
 3520
 3521
 3522
 3523
 3524
 3525
 3526
 3527
 3528
 3529
 3530
 3531
 3532
 3533
 3534
 3535
 3536
 3537
 3538
 3539
 3540
 3541
 3542
 3543
 3544
 3545
 3546
 3547
 3548
 3549
 3550
 3551
 3552
 3553
 3554
 3555
 3556
 3557
 3558
 3559
 3560
 3561
 3562
 3563
 3564
 3565
 3566
 3567
 3568
 3569
 3570
 3571
 3572
 3573
 3574
 3575
 3576
 3577
 3578
 3579
 3580
 3581
 3582
 3583
 3584
 3585
 3586
 3587
 3588
 3589
 3590
 3591
 3592
 3593
 3594
 3595
 3596
 3597
 3598
 3599
 3600
 3601
 3602
 3603
 3604
 3605
 3606
 3607
 3608
 3609
 3610
 3611
 3612
 3613
 3614
 3615
 3616
 3617
 3618
 3619
 3620
 3621
 3622
 3623
 3624
 3625
 3626
 3627
 3628
 3629
 3630
 3631
 3632
 3633
 3634
 3635
 3636
 3637
 3638
 3639
 3640
 3641
 3642
 3643
 3644
 3645
 3646
 3647
 3648
 3649
 3650
 3651
 3652
 3653
 3654
 3655
 3656
 3657
 3658
 3659
 3660
 3661
 3662
 3663
 3664
 3665
 3666
 3667
 3668
 3669
 3670
 3671
 3672
 3673
 3674
 3675
 3676
 3677
 3678
 3679
 3680
 3681
 3682
 3683
 3684
 3685
 3686
 3687
 3688
 3689
 3690
 3691
 3692
 3693
 3694
 3695
 3696
 3697
 3698
 3699
 3700
 3701
 3702
 3703
 3704
 3705
 3706
 3707
 3708
 3709
 3710
 3711
 3712
 3713
 3714
 3715
 3716
 3717
 3718
 3719
 3720
 3721
 3722
 3723
 3724
 3725
 3726
 3727
 3728
 3729
 3730
 3731
 3732
 3733
 3734
 3735
 3736
 3737
 3738
 3739
 3740
 3741
 3742
 3743
 3744
 3745
 3746
 3747
 3748
 3749
 3750
 3751
 3752
 3753
 3754
 3755
 3756
 3757
 3758
 3759
 3760
 3761
 3762
 3763
 3764
 3765
 3766
 3767
 3768
 3769
 3770
 3771
 3772
 3773
 3774
 3775
 3776
 3777
 3778
 3779
 3780
 3781
 3782
 3783
 3784
 3785
 3786
 3787
 3788
 3789
 3790
 3791
 3792
 3793
 3794
 3795
 3796
 3797
 3798
 3799
 3800
 3801
 3802
 3803
 3804
 3805
 3806
 3807
 3808
 3809
 3810
 3811
 3812
 3813
 3814
 3815
 3816
 3817
 3818
 3819
 3820
 3821
 3822
 3823
 3824
 3825
 3826
 3827
 3828
 3829
 3830
 3831
 3832
 3833
 3834
 3835
 3836
 3837
 3838
 3839
 3840
 3841
 3842
 3843
 3844
 3845
 3846
 3847
 3848
 3849
 3850
 3851
 3852
 3853
 3854
 3855
 3856
 3857
 3858
 3859
 3860
 3861
 3862
 3863
 3864
 3865
 3866
 3867
 3868
 3869
 3870
 3871
 3872
 3873
 3874
 3875
 3876
 3877
 3878
 3879
 3880
 3881
 3882
 3883
 3884
 3885
 3886
 3887
 3888
 3889
 3890
 3891
 3892
 3893
 3894
 3895
 3896
 3897
 3898
 3899
 3900
 3901
 3902
 3903
 3904
 3905
 3906
 3907
 3908
 3909
 3910
 3911
 3912
 3913
 3914
 3915
 3916
 3917
 3918
 3919
 3920
 3921
 3922
 3923
 3924
 3925
 3926
 3927
 3928
 3929
 3930
 3931
 3932
 3933
 3934
 3935
 3936
 3937
 3938
 3939
 3940
 3941
 3942
 3943
 3944
 3945
 3946
 3947
 3948
 3949
 3950
 3951
 3952
 3953
 3954
 3955
 3956
 3957
 3958
 3959
 3960
 3961
 3962
 3963
 3964
 3965
 3966
 3967
 3968
 3969
 3970
 3971
 3972
 3973
 3974
 3975
 3976
 3977
 3978
 3979
 3980
 3981
 3982
 3983
 3984
 3985
 3986
 3987
 3988
 3989
 3990
 3991
 3992
 3993
 3994
 3995
 3996
 3997
 3998
 3999
 4000
 4001
 4002
 4003
 4004
 4005
 4006
 4007
 4008
 4009
 4010
 4011
 4012
 4013
 4014
 4015
 4016
 4017
 4018
 4019
 4020
 4021
 4022
 4023
 4024
 4025
 4026
 4027
 4028
 4029
 4030
 4031
 4032
 4033
 4034
 4035
 4036
 4037
 4038
 4039
 4040
 4041
 4042
 4043
 4044
 4045
 4046
 4047
 4048
 4049
 4050
 4051
 4052
 4053
 4054
 4055
 4056
 4057
 4058
 4059
 4060
 4061
 4062
 4063
 4064
 4065
 4066
 4067
 4068
 4069
 4070
 4071
 4072
 4073
 4074
 4075
 4076
 4077
 4078
 4079
 4080
 4081
 4082
 4083
 4084
 4085
 4086
 4087
 4088
 4089
 4090
 4091
 4092
 4093
 4094
 4095
 4096
 4097
 4098
 4099
 4100
 4101
 4102
 4103
 4104
 4105
 4106
 4107
 4108
 4109
 4110
 4111
 4112
 4113
 4114
 4115
 4116
 4117
 4118
 4119
 4120
 4121
 4122
 4123
 4124
 4125
 4126
 4127
 4128
 4129
 4130
 4131
 4132
 4133
 4134
 4135
 4136
 4137
 4138
 4139
 4140
 4141
 4142
 4143
 4144
 4145
 4146
 4147
 4148
 4149
 4150
 4151
 4152
 4153
 4154
 4155
 4156
 4157
 4158
 4159
 4160
 4161
 4162
 4163
 4164
 4165
 4166
 4167
 4168
 4169
 4170
 4171
 4172
 4173
 4174
 4175
 4176
 4177
 4178
 4179
 4180
 4181
 4182
 4183
 4184
 4185
 4186
 4187
 4188
 4189
 4190
 4191
 4192
 4193
 4194
 4195
 4196
 4197
 4198
 4199
 4200
 4201
 4202
 4203
 4204
 4205
 4206
 4207
 4208
 4209
 4210
 4211
 4212
 4213
 4214
 4215
 4216
 4217
 4218
 4219
 4220
 4221
 4222
 4223
 4224
 4225
 4226
 4227
 4228
 4229
 4230
 4231
 4232
 4233
 4234
 4235
 4236
 4237
 4238
 4239
 4240
 4241
 4242
 4243
 4244
 4245
 4246
 4247
 4248
 4249
 4250
 4251
 4252
 4253
 4254
 4255
 4256
 4257
 4258
 4259
 4260
 4261
 4262
 4263
 4264
 4265
 4266
 4267
 4268
 4269
 4270
 4271
 4272
 4273
 4274
 4275
 4276
 4277
 4278
 4279
 4280
 4281
 4282
 4283
 4284
 4285
 4286
 4287
 4288
 4289
 4290
 4291
 4292
 4293
 4294
 4295
 4296
 4297
 4298
 4299
 4300
 4301
 4302
 4303
 4304
 4305
 4306
 4307
 4308
 4309
 4310
 4311
 4312
 4313
 4314
 4315
 4316
 4317
 4318
 4319
 4320
 4321
 4322
 4323
 4324
 4325
 4326
 4327
 4328
 4329
 4330
 4331
 4332
 4333
 4334
 4335
 4336
 4337
 4338
 4339
 4340
 4341
 4342
 4343
 4344
 4345
 4346
 4347
 4348
 4349
 4350
 4351
 4352
 4353
 4354
 4355
 4356
 4357
 4358
 4359
 4360
 4361
 4362
 4363
 4364
 4365
 4366
 4367
 4368
 4369
 4370
 4371
 4372
 4373
 4374
 4375
 4376
 4377
 4378
 4379
 4380
 4381
 4382
 4383
 4384
 4385
 4386
 4387
 4388
 4389
 4390
 4391
 4392
 4393
 4394
 4395
 4396
 4397
 4398
 4399
 4400
 4401
 4402
 4403
 4404
 4405
 4406
 4407
 4408
 4409
 4410
 4411
 4412
 4413
 4414
 4415
 4416
 4417
 4418
 4419
 4420
 4421
 4422
 4423
 4424
 4425
 4426
 4427
 4428
 4429
 4430
 4431
 4432
 4433
 4434
 4435
 4436
 4437
 4438
 4439
 4440
 4441
 4442
 4443
 4444
 4445
 4446
 4447
 4448
 4449
 4450
 4451
 4452
 4453
 4454
 4455
 4456
 4457
 4458
 4459
 4460
 4461
 4462
 4463
 4464
 4465
 4466
 4467
 4468
 4469
 4470
 4471
 4472
 4473
 4474
 4475
 4476
 4477
 4478
 4479
 4480
 4481
 4482
 4483
 4484
 4485
 4486
 4487
 4488
 4489
 4490
 4491
 4492
 4493
 4494
 4495
 4496
 4497
 4498
 4499
 4500
 4501
 4502
 4503
 4504
 4505
 4506
 4507
 4508
 4509
 4510
 4511
 4512
 4513
 4514
 4515
 4516
 4517
 4518
 4519
 4520
 4521
 4522
 4523
 4524
 4525
 4526
 4527
 4528
 4529
 4530
 4531
 4532
 4533
 4534
 4535
 4536
 4537
 4538
 4539
 4540
 4541
 4542
 4543
 4544
 4545
 4546
 4547
 4548
 4549
 4550
 4551
 4552
 4553
 4554
 4555
 4556
 4557
 4558
 4559
 4560
 4561
 4562
 4563
 4564
 4565
 4566
 4567
 4568
 4569
 4570
 4571
 4572
 4573
 4574
 4575
 4576
 4577
 4578
 4579
 4580
 4581
 4582
 4583
 4584
 4585
 4586
 4587
 4588
 4589
 4590
 4591
 4592
 4593
 4594
 4595
 4596
 4597
 4598
 4599
 4600
 4601
 4602
 4603
 4604
 4605
 4606
 4607
 4608
 4609
 4610
 4611
 4612
 4613
 4614
 4615
 4616
 4617
 4618
 4619
 4620
 4621
 4622
 4623
 4624
 4625
 4626
 4627
 4628
 4629
 4630
 4631
 4632
 4633
 4634
 4635
 4636
 4637
 4638
 4639
 4640
 4641
 4642
 4643
 4644
 4645
 4646
 4647
 4648
 4649
 4650
 4651
 4652
 4653
 4654
 4655
 4656
 4657
 4658
 4659
 4660
 4661
 4662
 4663
 4664
 4665
 4666
 4667
 4668
 4669
 4670
 4671
 4672
 4673
 4674
 4675
 4676
 4677
 4678
 4679
 4680
 4681
 4682
 4683
 4684
 4685
 4686
 4687
 4688
 4689
 4690
 4691
 4692
 4693
 4694
 4695
 4696
 4697
 4698
 4699
 4700
 4701
 4702
 4703
 4704
 4705
 4706
 4707
 4708
 4709
 4710
 4711
 4712
 4713
 4714
 4715
 4716
 4717
 4718
 4719
 4720
 4721
 4722
 4723
 4724
 4725
 4726
 4727
 4728
 4729
 4730
 4731
 4732
 4733
 4734
 4735
 4736
 4737
 4738
 4739
 4740
 4741
 4742
 4743
 4744
 4745
 4746
 4747
 4748
 4749
 4750
 4751
 4752
 4753
 4754
 4755
 4756
 4757
 4758
 4759
 4760
 4761
 4762
 4763
 4764
 4765
 4766
 4767
 4768
 4769
 4770
 4771
 4772
 4773
 4774
 4775
 4776
 4777
 4778
 4779
 4780
 4781
 4782
 4783
 4784
 4785
 4786
 4787
 4788
 4789
 4790
 4791
 4792
 4793
 4794
 4795
 4796
 4797
 4798
 4799
 4800
 4801
 4802
 4803
 4804
 4805
 4806
 4807
 4808
 4809
 4810
 4811
 4812
 4813
 4814
 4815
 4816
 4817
 4818
 4819
 4820
 4821
 4822
 4823
 4824
 4825
 4826
 4827
 4828
 4829
 4830
 4831
 4832
 4833
 4834
 4835
 4836
 4837
 4838
 4839
 4840
 4841
 4842
 4843
 4844
 4845
 4846
 4847
 4848
 4849
 4850
 4851
 4852
 4853
 4854
 4855
 4856
 4857
 4858
 4859
 4860
 4861
 4862
 4863
 4864
 4865
 4866
 4867
 4868
 4869
 4870
 4871
 4872
 4873
 4874
 4875
 4876
 4877
 4878
 4879
 4880
 4881
 4882
 4883
 4884
 4885
 4886
 4887
 4888
 4889
 4890
 4891
 4892
 4893
 4894
 4895
 4896
 4897
 4898
 4899
 4900
 4901
 4902
 4903
 4904
 4905
 4906
 4907
 4908
 4909
 4910
 4911
 4912
 4913
 4914
 4915
 4916
 4917
 4918
 4919
 4920
 4921
 4922
 4923
 4924
 4925
 4926
 4927
 4928
 4929
 4930
 4931
 4932
 4933
 4934
 4935
 4936
 4937
 4938
 4939
 4940
 4941
 4942
 4943
 4944
 4945
 4946
 4947
 4948
 4949
 4950
 4951
 4952
 4953
 4954
 4955
 4956
 4957
 4958
 4959
 4960
 4961
 4962
 4963
 4964
 4965
 4966
 4967
 4968
 4969
 4970
 4971
 4972
 4973
 4974
 4975
 4976
 4977
 4978
 4979
 4980
 4981
 4982
 4983
 4984
 4985
 4986
 4987
 4988
 4989
 4990
 4991
 4992
 4993
 4994
 4995
 4996
 4997
 4998
 4999
 5000
 5001
 5002
 5003
 5004
 5005
 5006
 5007
 5008
 5009
 5010
 5011
 5012
 5013
 5014
 5015
 5016
 5017
 5018
 5019
 5020
 5021
 5022
 5023
 5024
 5025
 5026
 5027
 5028
 5029
 5030
 5031
 5032
 5033
 5034
 5035
 5036
 5037
 5038
 5039
 5040
 5041
 5042
 5043
 5044
 5045
 5046
 5047
 5048
 5049
 5050
 5051
 5052
 5053
 5054
 5055
 5056
 5057
 5058
 5059
 5060
 5061
 5062
 5063
 5064
 5065
 5066
 5067
 5068
 5069
 5070
 5071
 5072
 5073
 5074
 5075
 5076
 5077
 5078
 5079
 5080
 5081
 5082
 5083
 5084
 5085
 5086
 5087
 5088
 5089
 5090
 5091
 5092
 5093
 5094
 5095
 5096
 5097
 5098
 5099
 5100
 5101
 5102
 5103
 5104
 5105
 5106
 5107
 5108
 5109
 5110
 5111
 5112
 5113
 5114
 5115
 5116
 5117
 5118
 5119
 5120
 5121
 5122
 5123
 5124
 5125
 5126
 5127
 5128
 5129
 5130
 5131
 5132
 5133
 5134
 5135
 5136
 5137
 5138
 5139
 5140
 5141
 5142
 5143
 5144
 5145
 5146
 5147
 5148
 5149
 5150
 5151
 5152
 5153
 5154
 5155
 5156
 5157
 5158
 5159
 5160
 5161
 5162
 5163
 5164
 5165
 5166
 5167
 5168
 5169
 5170
 5171
 5172
 5173
 5174
 5175
 5176
 5177
 5178
 5179
 5180
 5181
 5182
 5183
 5184
 5185
 5186
 5187
 5188
 5189
 5190
 5191
 5192
 5193
 5194
 5195
 5196
 5197
 5198
 5199
 5200
 5201
 5202
 5203
 5204
 5205
 5206
 5207
 5208
 5209
 5210
 5211
 5212
 5213
 5214
 5215
 5216
 5217
 5218
 5219
 5220
 5221
 5222
 5223
 5224
 5225
 5226
 5227
 5228
 5229
 5230
 5231
 5232
 5233
 5234
 5235
 5236
 5237
 5238
 5239
 5240
 5241
 5242
 5243
 5244
 5245
 5246
 5247
 5248
 5249
 5250
 5251
 5252
 5253
 5254
 5255
 5256
 5257
 5258
 5259
 5260
 5261
 5262
 5263
 5264
 5265
 5266
 5267
 5268
 5269
 5270
 5271
 5272
 5273
 5274
 5275
 5276
 5277
 5278
 5279
 5280
 5281
 5282
 5283
 5284
 5285
 5286
 5287
 5288
 5289
 5290
 5291
 5292
 5293
 5294
 5295
 5296
 5297
 5298
 5299
 5300
 5301
 5302
 5303
 5304
 5305
 5306
 5307
 5308
 5309
 5310
 5311
 5312
 5313
 5314
 5315
 5316
 5317
 5318
 5319
 5320
 5321
 5322
 5323
 5324
 5325
 5326
 5327
 5328
 5329
 5330
 5331
 5332
 5333
 5334
 5335
 5336
 5337
 5338
 5339
 5340
 5341
 5342
 5343
 5344
 5345
 5346
 5347
 5348
 5349
 5350
 5351
 5352
 5353
 5354
 5355
 5356
 5357
 5358
 5359
 5360
 5361
 5362
 5363
 5364
 5365
 5366
 5367
 5368
 5369
 5370
 5371
 5372
 5373
 5374
 5375
 5376
 5377
 5378
 5379
 5380
 5381
 5382
 5383
 5384
 5385
 5386
 5387
 5388
 5389
 5390
 5391
 5392
 5393
 5394
 5395
 5396
 5397
 5398
 5399
 5400
 5401
 5402
 5403
 5404
 5405
 5406
 5407
 5408
 5409
 5410
 5411
 5412
 5413
 5414
 5415
 5416
 5417
 5418
 5419
 5420
 5421
 5422
 5423
 5424
 5425
 5426
 5427
 5428
 5429
 5430
 5431
 5432
 5433
 5434
 5435
 5436
 5437
 5438
 5439
 5440
 5441
 5442
 5443
 5444
 5445
 5446
 5447
 5448
 5449
 5450
 5451
 5452
 5453
 5454
 5455
 5456
 5457
 5458
 5459
 5460
 5461
 5462
 5463
 5464
 5465
 5466
 5467
 5468
 5469
 5470
 5471
 5472
 5473
 5474
 5475
 5476
 5477
 5478
 5479
 5480
 5481
 5482
 5483
 5484
 5485
 5486
 5487
 5488
 5489
 5490
 5491
 5492
 5493
 5494
 5495
 5496
 5497
 5498
 5499
 5500
 5501
 5502
 5503
 5504
 5505
 5506
 5507
 5508
 5509
 5510
 5511
 5512
 5513
 5514
 5515
 5516
 5517
 5518
 5519
 5520
 5521
 5522
 5523
 5524
 5525
 5526
 5527
 5528
 5529
 5530
 5531
 5532
 5533
 5534
 5535
 5536
 5537
 5538
 5539
 5540
 5541
 5542
 5543
 5544
 5545
 5546
 5547
 5548
 5549
 5550
 5551
 5552
 5553
 5554
 5555
 5556
 5557
 5558
 5559
 5560
 5561
 5562
 5563
 5564
 5565
 5566
 5567
 5568
 5569
 5570
 5571
 5572
 5573
 5574
 5575
 5576
 5577
 5578
 5579
 5580
 5581
 5582
 5583
 5584
 5585
 5586
 5587
 5588
 5589
 5590
 5591
 5592
 5593
 5594
 5595
 5596
 5597
 5598
 5599
 5600
 5601
 5602
 5603
 5604
 5605
 5606
 5607
 5608
 5609
 5610
 5611
 5612
 5613
 5614
 5615
 5616
 5617
 5618
 5619
 5620
 5621
 5622
 5623
 5624
 5625
 5626
 5627
 5628
 5629
 5630
 5631
 5632
 5633
 5634
 5635
 5636
 5637
 5638
 5639
 5640
 5641
 5642
 5643
 5644
 5645
 5646
 5647
 5648
 5649
 5650
 5651
 5652
 5653
 5654
 5655
 5656
 5657
 5658
 5659
 5660
 5661
 5662
 5663
 5664
 5665
 5666
 5667
 5668
 5669
 5670
 5671
 5672
 5673
 5674
 5675
 5676
 5677
 5678
 5679
 5680
 5681
 5682
 5683
 5684
 5685
 5686
 5687
 5688
 5689
 5690
 5691
 5692
 5693
 5694
 5695
 5696
 5697
 5698
 5699
 5700
 5701
 5702
 5703
 5704
 5705
 5706
 5707
 5708
 5709
 5710
 5711
 5712
 5713
 5714
 5715
 5716
 5717
 5718
 5719
 5720
 5721
 5722
 5723
 5724
 5725
 5726
 5727
 5728
 5729
 5730
 5731
 5732
 5733
 5734
 5735
 5736
 5737
 5738
 5739
 5740
 5741
 5742
 5743
 5744
 5745
 5746
 5747
 5748
 5749
 5750
 5751
 5752
 5753
 5754
 5755
 5756
 5757
 5758
 5759
 5760
 5761
 5762
 5763
 5764
 5765
 5766
 5767
 5768
 5769
 5770
 5771
 5772
 5773
 5774
 5775
 5776
 5777
 5778
 5779
 5780
 5781
 5782
 5783
 5784
 5785
 5786
 5787
 5788
 5789
 5790
 5791
 5792
 5793
 5794
 5795
 5796
 5797
 5798
 5799
 5800
 5801
 5802
 5803
 5804
 5805
 5806
 5807
 5808
 5809
 5810
 5811
 5812
 5813
 5814
 5815
 5816
 5817
 5818
 5819
 5820
 5821
 5822
 5823
 5824
 5825
 5826
 5827
 5828
 5829
 5830
 5831
 5832
 5833
 5834
 5835
 5836
 5837
 5838
 5839
 5840
 5841
 5842
 5843
 5844
 5845
 5846
 5847
 5848
 5849
 5850
 5851
 5852
 5853
 5854
 5855
 5856
 5857
 5858
 5859
 5860
 5861
 5862
 5863
 5864
 5865
 5866
 5867
 5868
 5869
 5870
 5871
 5872
 5873
 5874
 5875
 5876
 5877
 5878
 5879
 5880
 5881
 5882
 5883
 5884
 5885
 5886
 5887
 5888
 5889
 5890
 5891
 5892
 5893
 5894
 5895
 5896
 5897
 5898
 5899
 5900
 5901
 5902
 5903
 5904
 5905
 5906
 5907
 5908
 5909
 5910
 5911
 5912
 5913
 5914
 5915
 5916
 5917
 5918
 5919
 5920
 5921
 5922
 5923
 5924
 5925
 5926
 5927
 5928
 5929
 5930
 5931
 5932
 5933
 5934
 5935
 5936
 5937
 5938
 5939
 5940
 5941
 5942
 5943
 5944
 5945
 5946
 5947
 5948
 5949
 5950
 5951
 5952
 5953
 5954
 5955
 5956
 5957
 5958
 5959
 5960
 5961
 5962
 5963
 5964
 5965
 5966
 5967
 5968
 5969
 5970
 5971
 5972
 5973
 5974
 5975
 5976
 5977
 5978
 5979
 5980
 5981
 5982
 5983
 5984
 5985
 5986
 5987
 5988
 5989
 5990
 5991
 5992
 5993
 5994
 5995
 5996
 5997
 5998
 5999
 6000
 6001
 6002
 6003
 6004
 6005
 6006
 6007
 6008
 6009
 6010
 6011
 6012
 6013
 6014
 6015
 6016
 6017
 6018
 6019
 6020
 6021
 6022
 6023
 6024
 6025
 6026
 6027
 6028
 6029
 6030
 6031
 6032
 6033
 6034
 6035
 6036
 6037
 6038
 6039
 6040
 6041
 6042
 6043
 6044
 6045
 6046
 6047
 6048
 6049
 6050
 6051
 6052
 6053
 6054
 6055
 6056
 6057
 6058
 6059
 6060
 6061
 6062
 6063
 6064
 6065
 6066
 6067
 6068
 6069
 6070
 6071
 6072
 6073
 6074
 6075
 6076
 6077
 6078
 6079
 6080
 6081
 6082
 6083
 6084
 6085
 6086
 6087
 6088
 6089
 6090
 6091
 6092
 6093
 6094
 6095
 6096
 6097
 6098
 6099
 6100
 6101
 6102
 6103
 6104
 6105
 6106
 6107
 6108
 6109
 6110
 6111
 6112
 6113
 6114
 6115
 6116
 6117
 6118
 6119
 6120
 6121
 6122
 6123
 6124
 6125
 6126
 6127
 6128
 6129
 6130
 6131
 6132
 6133
 6134
 6135
 6136
 6137
 6138
 6139
 6140
 6141
 6142
 6143
 6144
 6145
 6146
 6147
 6148
 6149
 6150
 6151
 6152
 6153
 6154
 6155
 6156
 6157
 6158
 6159
 6160
 6161
 6162
 6163
 6164
 6165
 6166
 6167
 6168
 6169
 6170
 6171
 6172
 6173
 6174
 6175
 6176
 6177
 6178
 6179
 6180
 6181
 6182
 6183
 6184
 6185
 6186
 6187
 6188
 6189
 6190
 6191
 6192
 6193
 6194
 6195
 6196
 6197
 6198
 6199
 6200
 6201
 6202
 6203
 6204
 6205
 6206
 6207
 6208
 6209
 6210
 6211
 6212
 6213
 6214
 6215
 6216
 6217
 6218
 6219
 6220
 6221
 6222
 6223
 6224
 6225
 6226
 6227
 6228
 6229
 6230
 6231
 6232
 6233
 6234
 6235
 6236
 6237
 6238
 6239
 6240
 6241
 6242
 6243
 6244
 6245
 6246
 6247
 6248
 6249
 6250
 6251
 6252
 6253
 6254
 6255
 6256
 6257
 6258
 6259
 6260
 6261
 6262
 6263
 6264
 6265
 6266
 6267
 6268
 6269
 6270
 6271
 6272
 6273
 6274
 6275
 6276
 6277
 6278
 6279
 6280
 6281
 6282
 6283
 6284
 6285
 6286
 6287
 6288
 6289
 6290
 6291
 6292
 6293
 6294
 6295
 6296
 6297
 6298
 6299
 6300
 6301
 6302
 6303
 6304
 6305
 6306
 6307
 6308
 6309
 6310
 6311
 6312
 6313
 6314
 6315
 6316
 6317
 6318
 6319
 6320
 6321
 6322
 6323
 6324
 6325
 6326
 6327
 6328
 6329
 6330
 6331
 6332
 6333
 6334
 6335
 6336
 6337
 6338
 6339
 6340
 6341
 6342
 6343
 6344
 6345
 6346
 6347
 6348
 6349
 6350
 6351
 6352
 6353
 6354
 6355
 6356
 6357
 6358
 6359
 6360
 6361
 6362
 6363
 6364
 6365
 6366
 6367
 6368
 6369
 6370
 6371
 6372
 6373
 6374
 6375
 6376
 6377
 6378
 6379
 6380
 6381
 6382
 6383
 6384
 6385
 6386
 6387
 6388
 6389
 6390
 6391
 6392
 6393
 6394
 6395
 6396
 6397
 6398
 6399
 6400
 6401
 6402
 6403
 6404
 6405
 6406
 6407
 6408
 6409
 6410
 6411
 6412
 6413
 6414
 6415
 6416
 6417
 6418
 6419
 6420
 6421
 6422
 6423
 6424
 6425
 6426
 6427
 6428
 6429
 6430
 6431
 6432
 6433
 6434
 6435
 6436
 6437
 6438
 6439
 6440
 6441
 6442
 6443
 6444
 6445
 6446
 6447
 6448
 6449
 6450
 6451
 6452
 6453
 6454
 6455
 6456
 6457
 6458
 6459
 6460
 6461
 6462
 6463
 6464
 6465
 6466
 6467
 6468
 6469
 6470
 6471
 6472
 6473
 6474
 6475
 6476
 6477
 6478
 6479
 6480
 6481
 6482
 6483
 6484
 6485
 6486
 6487
 6488
 6489
 6490
 6491
 6492
 6493
 6494
 6495
 6496
 6497
 6498
 6499
 6500
 6501
 6502
 6503
 6504
 6505
 6506
 6507
 6508
 6509
 6510
 6511
 6512
 6513
 6514
 6515
 6516
 6517
 6518
 6519
 6520
 6521
 6522
 6523
 6524
 6525
 6526
 6527
 6528
 6529
 6530
 6531
 6532
 6533
 6534
 6535
 6536
 6537
 6538
 6539
 6540
 6541
 6542
 6543
 6544
 6545
 6546
 6547
 6548
 6549
 6550
 6551
 6552
 6553
 6554
 6555
 6556
 6557
 6558
 6559
 6560
 6561
 6562
 6563
 6564
 6565
 6566
 6567
 6568
 6569
 6570
 6571
 6572
 6573
 6574
 6575
 6576
 6577
 6578
 6579
 6580
 6581
 6582
 6583
 6584
 6585
 6586
 6587
 6588
 6589
 6590
 6591
 6592
 6593
 6594
 6595
 6596
 6597
 6598
 6599
 6600
 6601
 6602
 6603
 6604
 6605
 6606
 6607
 6608
 6609
 6610
 6611
 6612
 6613
 6614
 6615
 6616
 6617
 6618
 6619
 6620
 6621
 6622
 6623
 6624
 6625
 6626
 6627
 6628
 6629
 6630
 6631
 6632
 6633
 6634
 6635
 6636
 6637
 6638
 6639
 6640
 6641
 6642
 6643
 6644
 6645
 6646
 6647
 6648
 6649
 6650
 6651
 6652
 6653
 6654
 6655
 6656
 6657
 6658
 6659
 6660
 6661
 6662
 6663
 6664
 6665
 6666
 6667
 6668
 6669
 6670
 6671
 6672
 6673
 6674
 6675
 6676
 6677
 6678
 6679
 6680
 6681
 6682
 6683
 6684
 6685
 6686
 6687
 6688
 6689
 6690
 6691
 6692
 6693
 6694
 6695
 6696
 6697
 6698
 6699
 6700
 6701
 6702
 6703
 6704
 6705
 6706
 6707
 6708
 6709
 6710
 6711
 6712
 6713
 6714
 6715
 6716
 6717
 6718
 6719
 6720
 6721
 6722
 6723
 6724
 6725
 6726
 6727
 6728
 6729
 6730
 6731
 6732
 6733
 6734
 6735
 6736
 6737
 6738
 6739
 6740
 6741
 6742
 6743
 6744
 6745
 6746
 6747
 6748
 6749
 6750
 6751
 6752
 6753
 6754
 6755
 6756
 6757
 6758
 6759
 6760
 6761
 6762
 6763
 6764
 6765
 6766
 6767
 6768
 6769
 6770
 6771
 6772
 6773
 6774
 6775
 6776
 6777
 6778
 6779
 6780
 6781
 6782
 6783
 6784
 6785
 6786
 6787
 6788
 6789
 6790
 6791
 6792
 6793
 6794
 6795
 6796
 6797
 6798
 6799
 6800
 6801
 6802
 6803
 6804
 6805
 6806
 6807
 6808
 6809
 6810
 6811
 6812
 6813
 6814
 6815
 6816
 6817
 6818
 6819
 6820
 6821
 6822
 6823
 6824
 6825
 6826
 6827
 6828
 6829
 6830
 6831
 6832
 6833
 6834
 6835
 6836
 6837
 6838
 6839
 6840
 6841
 6842
 6843
 6844
 6845
 6846
 6847
 6848
 6849
 6850
 6851
 6852
 6853
 6854
 6855
 6856
 6857
 6858
 6859
 6860
 6861
 6862
 6863
 6864
 6865
 6866
 6867
 6868
 6869
 6870
 6871
 6872
 6873
 6874
 6875
 6876
 6877
 6878
 6879
 6880
 6881
 6882
 6883
 6884
 6885
 6886
 6887
 6888
 6889
 6890
 6891
 6892
 6893
 6894
 6895
 6896
 6897
 6898
 6899
 6900
 6901
 6902
 6903
 6904
 6905
 6906
 6907
 6908
 6909
 6910
 6911
 6912
 6913
 6914
 6915
 6916
 6917
 6918
 6919
 6920
 6921
 6922
 6923
 6924
 6925
 6926
 6927
 6928
 6929
 6930
 6931
 6932
 6933
 6934
 6935
 6936
 6937
 6938
 6939
 6940
 6941
 6942
 6943
 6944
 6945
 6946
 6947
 6948
 6949
 6950
 6951
 6952
 6953
 6954
 6955
 6956
 6957
 6958
 6959
 6960
 6961
 6962
 6963
 6964
 6965
 6966
 6967
 6968
 6969
 6970
 6971
 6972
 6973
 6974
 6975
 6976
 6977
 6978
 6979
 6980
 6981
 6982
 6983
 6984
 6985
 6986
 6987
 6988
 6989
 6990
 6991
 6992
 6993
 6994
 6995
 6996
 6997
 6998
 6999
 7000
 7001
 7002
 7003
 7004
 7005
 7006
 7007
 7008
 7009
 7010
 7011
 7012
 7013
 7014
 7015
 7016
 7017
 7018
 7019
 7020
 7021
 7022
 7023
 7024
 7025
 7026
 7027
 7028
 7029
 7030
 7031
 7032
 7033
 7034
 7035
 7036
 7037
 7038
 7039
 7040
 7041
 7042
 7043
 7044
 7045
 7046
 7047
 7048
 7049
 7050
 7051
 7052
 7053
 7054
 7055
 7056
 7057
 7058
 7059
 7060
 7061
 7062
 7063
 7064
 7065
 7066
 7067
 7068
 7069
 7070
 7071
 7072
 7073
 7074
 7075
 7076
 7077
 7078
 7079
 7080
 7081
 7082
 7083
 7084
 7085
 7086
 7087
 7088
 7089
 7090
 7091
 7092
 7093
 7094
 7095
 7096
 7097
 7098
 7099
 7100
 7101
 7102
 7103
 7104
 7105
 7106
 7107
 7108
 7109
 7110
 7111
 7112
 7113
 7114
 7115
 7116
 7117
 7118
 7119
 7120
 7121
 7122
 7123
 7124
 7125
 7126
 7127
 7128
 7129
 7130
 7131
 7132
 7133
 7134
 7135
 7136
 7137
 7138
 7139
 7140
 7141
 7142
 7143
 7144
 7145
 7146
 7147
 7148
 7149
 7150
 7151
 7152
 7153
 7154
 7155
 7156
 7157
 7158
 7159
 7160
 7161
 7162
 7163
 7164
 7165
 7166
 7167
 7168
 7169
 7170
 7171
 7172
 7173
 7174
 7175
 7176
 7177
 7178
 7179
 7180
 7181
 7182
 7183
 7184
 7185
 7186
 7187
 7188
 7189
 7190
 7191
 7192
 7193
 7194
 7195
 7196
 7197
 7198
 7199
 7200
 7201
 7202
 7203
 7204
 7205
 7206
 7207
 7208
 7209
 7210
 7211
 7212
 7213
 7214
 7215
 7216
 7217
 7218
 7219
 7220
 7221
 7222
 7223
 7224
 7225
 7226
 7227
 7228
 7229
 7230
 7231
 7232
 7233
 7234
 7235
 7236
 7237
 7238
 7239
 7240
 7241
 7242
 7243
 7244
 7245
 7246
 7247
 7248
 7249
 7250
 7251
 7252
 7253
 7254
 7255
 7256
 7257
 7258
 7259
 7260
 7261
 7262
 7263
 7264
 7265
 7266
 7267
 7268
 7269
 7270
 7271
 7272
 7273
 7274
 7275
 7276
 7277
 7278
 7279
 7280
 7281
 7282
 7283
 7284
 7285
 7286
 7287
 7288
 7289
 7290
 7291
 7292
 7293
 7294
 7295
 7296
 7297
 7298
 7299
 7300
 7301
 7302
 7303
 7304
 7305
 7306
 7307
 7308
 7309
 7310
 7311
 7312
 7313
 7314
 7315
 7316
 7317
 7318
 7319
 7320
 7321
 7322
 7323
 7324
 7325
 7326
 7327
 7328
 7329
 7330
 7331
 7332
 7333
 7334
 7335
 7336
 7337
 7338
 7339
 7340
 7341
 7342
 7343
 7344
 7345
 7346
 7347
 7348
 7349
 7350
 7351
 7352
 7353
 7354
 7355
 7356
 7357
 7358
 7359
 7360
 7361
 7362
 7363
 7364
 7365
 7366
 7367
 7368
 7369
 7370
 7371
 7372
 7373
 7374
 7375
 7376
 7377
 7378
 7379
 7380
 7381
 7382
 7383
 7384
 7385
 7386
 7387
 7388
 7389
 7390
 7391
 7392
 7393
 7394
 7395
 7396
 7397
 7398
 7399
 7400
 7401
 7402
 7403
 7404
 7405
 7406
 7407
 7408
 7409
 7410
 7411
 7412
 7413
 7414
 7415
 7416
 7417
 7418
 7419
 7420
 7421
 7422
 7423
 7424
 7425
 7426
 7427
 7428
 7429
 7430
 7431
 7432
 7433
 7434
 7435
 7436
 7437
 7438
 7439
 7440
 7441
 7442
 7443
 7444
 7445
 7446
 7447
 7448
 7449
 7450
 7451
 7452
 7453
 7454
 7455
 7456
 7457
 7458
 7459
 7460
 7461
 7462
 7463
 7464
 7465
 7466
 7467
 7468
 7469
 7470
 7471
 7472
 7473
 7474
 7475
 7476
 7477
 7478
 7479
 7480
 7481
 7482
 7483
 7484
 7485
 7486
 7487
 7488
 7489
 7490
 7491
 7492
 7493
 7494
 7495
 7496
 7497
 7498
 7499
 7500
 7501
 7502
 7503
 7504
 7505
 7506
 7507
 7508
 7509
 7510
 7511
 7512
 7513
 7514
 7515
 7516
 7517
 7518
 7519
 7520
 7521
 7522
 7523
 7524
 7525
 7526
 7527
 7528
 7529
 7530
 7531
 7532
 7533
 7534
 7535
 7536
 7537
 7538
 7539
 7540
 7541
 7542
 7543
 7544
 7545
 7546
 7547
 7548
 7549
 7550
 7551
 7552
 7553
 7554
 7555
 7556
 7557
 7558
 7559
 7560
 7561
 7562
 7563
 7564
 7565
 7566
 7567
 7568
 7569
 7570
 7571
 7572
 7573
 7574
 7575
 7576
 7577
 7578
 7579
 7580
 7581
 7582
 7583
 7584
 7585
 7586
 7587
 7588
 7589
 7590
 7591
 7592
 7593
 7594
 7595
 7596
 7597
 7598
 7599
 7600
 7601
 7602
 7603
 7604
 7605
 7606
 7607
 7608
 7609
 7610
 7611
 7612
 7613
 7614
 7615
 7616
 7617
 7618
 7619
 7620
 7621
 7622
 7623
 7624
 7625
 7626
 7627
 7628
 7629
 7630
 7631
 7632
 7633
 7634
 7635
 7636
 7637
 7638
 7639
 7640
 7641
 7642
 7643
 7644
 7645
 7646
 7647
 7648
 7649
 7650
 7651
 7652
 7653
 7654
 7655
 7656
 7657
 7658
 7659
 7660
 7661
 7662
 7663
 7664
 7665
 7666
 7667
 7668
 7669
 7670
 7671
 7672
 7673
 7674
 7675
 7676
 7677
 7678
 7679
 7680
 7681
 7682
 7683
 7684
 7685
 7686
 7687
 7688
 7689
 7690
 7691
 7692
 7693
 7694
 7695
 7696
 7697
 7698
 7699
 7700
 7701
 7702
 7703
 7704
 7705
 7706
 7707
 7708
 7709
 7710
 7711
 7712
 7713
 7714
 7715
 7716
 7717
 7718
 7719
 7720
 7721
 7722
 7723
 7724
 7725
 7726
 7727
 7728
 7729
 7730
 7731
 7732
 7733
 7734
 7735
 7736
 7737
 7738
 7739
 7740
 7741
 7742
 7743
 7744
 7745
 7746
 7747
 7748
 7749
 7750
 7751
 7752
 7753
 7754
 7755
 7756
 7757
 7758
 7759
 7760
 7761
 7762
 7763
 7764
 7765
 7766
 7767
 7768
 7769
 7770
 7771
 7772
 7773
 7774
 7775
 7776
 7777
 7778
 7779
 7780
 7781
 7782
 7783
 7784
 7785
 7786
 7787
 7788
 7789
 7790
 7791
 7792
 7793
 7794
 7795
 7796
 7797
 7798
 7799
 7800
 7801
 7802
 7803
 7804
 7805
 7806
 7807
 7808
 7809
 7810
 7811
 7812
 7813
 7814
 7815
 7816
 7817
 7818
 7819
 7820
 7821
 7822
 7823
 7824
 7825
 7826
 7827
 7828
 7829
 7830
 7831
 7832
 7833
 7834
 7835
 7836
 7837
 7838
 7839
 7840
 7841
 7842
 7843
 7844
 7845
 7846
 7847
 7848
 7849
 7850
 7851
 7852
 7853
 7854
 7855
 7856
 7857
 7858
 7859
 7860
 7861
 7862
 7863
 7864
 7865
 7866
 7867
 7868
 7869
 7870
 7871
 7872
 7873
 7874
 7875
 7876
 7877
 7878
 7879
 7880
 7881
 7882
 7883
 7884
 7885
 7886
 7887
 7888
 7889
 7890
 7891
 7892
 7893
 7894
 7895
 7896
 7897
 7898
 7899
 7900
 7901
 7902
 7903
 7904
 7905
 7906
 7907
 7908
 7909
 7910
 7911
 7912
 7913
 7914
 7915
 7916
 7917
 7918
 7919
 7920
 7921
 7922
 7923
 7924
 7925
 7926
 7927
 7928
 7929
 7930
 7931
 7932
 7933
 7934
 7935
 7936
 7937
 7938
 7939
 7940
 7941
 7942
 7943
 7944
 7945
 7946
 7947
 7948
 7949
 7950
 7951
 7952
 7953
 7954
 7955
 7956
 7957
 7958
 7959
 7960
 7961
 7962
 7963
 7964
 7965
 7966
 7967
 7968
 7969
 7970
 7971
 7972
 7973
 7974
 7975
 7976
 7977
 7978
 7979
 7980
 7981
 7982
 7983
 7984
 7985
 7986
 7987
 7988
 7989
 7990
 7991
 7992
 7993
 7994
 7995
 7996
 7997
 7998
 7999
 8000
 8001
 8002
 8003
 8004
 8005
 8006
 8007
 8008
 8009
 8010
 8011
 8012
 8013
 8014
 8015
 8016
 8017
 8018
 8019
 8020
 8021
 8022
 8023
 8024
 8025
 8026
 8027
 8028
 8029
 8030
 8031
 8032
 8033
 8034
 8035
 8036
 8037
 8038
 8039
 8040
 8041
 8042
 8043
 8044
 8045
 8046
 8047
 8048
 8049
 8050
 8051
 8052
 8053
 8054
 8055
 8056
 8057
 8058
 8059
 8060
 8061
 8062
 8063
 8064
 8065
 8066
 8067
 8068
 8069
 8070
 8071
 8072
 8073
 8074
 8075
 8076
 8077
 8078
 8079
 8080
 8081
 8082
 8083
 8084
 8085
 8086
 8087
 8088
 8089
 8090
 8091
 8092
 8093
 8094
 8095
 8096
 8097
 8098
 8099
 8100
 8101
 8102
 8103
 8104
 8105
 8106
 8107
 8108
 8109
 8110
 8111
 8112
 8113
 8114
 8115
 8116
 8117
 8118
 8119
 8120
 8121
 8122
 8123
 8124
 8125
 8126
 8127
 8128
 8129
 8130
 8131
 8132
 8133
 8134
 8135
 8136
 8137
 8138
 8139
 8140
 8141
 8142
 8143
 8144
 8145
 8146
 8147
 8148
 8149
 8150
 8151
 8152
 8153
 8154
 8155
 8156
 8157
 8158
 8159
 8160
 8161
 8162
 8163
 8164
 8165
 8166
 8167
 8168
 8169
 8170
 8171
 8172
 8173
 8174
 8175
 8176
 8177
 8178
 8179
 8180
 8181
 8182
 8183
 8184
 8185
 8186
 8187
 8188
 8189
 8190
 8191
 8192
 8193
 8194
 8195
 8196
 8197
 8198
 8199
 8200
 8201
 8202
 8203
 8204
 8205
 8206
 8207
 8208
 8209
 8210
 8211
 8212
 8213
 8214
 8215
 8216
 8217
 8218
 8219
 8220
 8221
 8222
 8223
 8224
 8225
 8226
 8227
 8228
 8229
 8230
 8231
 8232
 8233
 8234
 8235
 8236
 8237
 8238
 8239
 8240
 8241
 8242
 8243
 8244
 8245
 8246
 8247
 8248
 8249
 8250
 8251
 8252
 8253
 8254
 8255
 8256
 8257
 8258
 8259
 8260
 8261
 8262
 8263
 8264
 8265
 8266
 8267
 8268
 8269
 8270
 8271
 8272
 8273
 8274
 8275
 8276
 8277
 8278
 8279
 8280
 8281
 8282
 8283
 8284
 8285
 8286
 8287
 8288
 8289
 8290
 8291
 8292
 8293
 8294
 8295
 8296
 8297
 8298
 8299
 8300
 8301
 8302
 8303
 8304
 8305
 8306
 8307
 8308
 8309
 8310
 8311
 8312
 8313
 8314
 8315
 8316
 8317
 8318
 8319
 8320
 8321
 8322
 8323
 8324
 8325
 8326
 8327
 8328
 8329
 8330
 8331
 8332
 8333
 8334
 8335
 8336
 8337
 8338
 8339
 8340
 8341
 8342
 8343
 8344
 8345
 8346
 8347
 8348
 8349
 8350
 8351
 8352
 8353
 8354
 8355
 8356
 8357
 8358
 8359
 8360
 8361
 8362
 8363
 8364
 8365
 8366
 8367
 8368
 8369
 8370
 8371
 8372
 8373
 8374
 8375
 8376
 8377
 8378
 8379
 8380
 8381
 8382
 8383
 8384
 8385
 8386
 8387
 8388
 8389
 8390
 8391
 8392
 8393
 8394
 8395
 8396
 8397
 8398
 8399
 8400
 8401
 8402
 8403
 8404
 8405
 8406
 8407
 8408
 8409
 8410
 8411
 8412
 8413
 8414
 8415
 8416
 8417
 8418
 8419
 8420
 8421
 8422
 8423
 8424
 8425
 8426
 8427
 8428
 8429
 8430
 8431
 8432
 8433
 8434
 8435
 8436
 8437
 8438
 8439
 8440
 8441
 8442
 8443
 8444
 8445
 8446
 8447
 8448
 8449
 8450
 8451
 8452
 8453
 8454
 8455
 8456
 8457
 8458
 8459
 8460
 8461
 8462
 8463
 8464
 8465
 8466
 8467
 8468
 8469
 8470
 8471
 8472
 8473
 8474
 8475
 8476
 8477
 8478
 8479
 8480
 8481
 8482
 8483
 8484
 8485
 8486
 8487
 8488
 8489
 8490
 8491
 8492
 8493
 8494
 8495
 8496
 8497
 8498
 8499
 8500
 8501
 8502
 8503
 8504
 8505
 8506
 8507
 8508
 8509
 8510
 8511
 8512
 8513
 8514
 8515
 8516
 8517
 8518
 8519
 8520
 8521
 8522
 8523
 8524
 8525
 8526
 8527
 8528
 8529
 8530
 8531
 8532
 8533
 8534
 8535
 8536
 8537
 8538
 8539
 8540
 8541
 8542
 8543
 8544
 8545
 8546
 8547
 8548
 8549
 8550
 8551
 8552
 8553
 8554
 8555
 8556
 8557
 8558
 8559
 8560
 8561
 8562
 8563
 8564
 8565
 8566
 8567
 8568
 8569
 8570
 8571
 8572
 8573
 8574
 8575
 8576
 8577
 8578
 8579
 8580
 8581
 8582
 8583
 8584
 8585
 8586
 8587
 8588
 8589
 8590
 8591
 8592
 8593
 8594
 8595
 8596
 8597
 8598
 8599
 8600
 8601
 8602
 8603
 8604
 8605
 8606
 8607
 8608
 8609
 8610
 8611
 8612
 8613
 8614
 8615
 8616
 8617
 8618
 8619
 8620
 8621
 8622
 8623
 8624
 8625
 8626
 8627
 8628
 8629
 8630
 8631
 8632
 8633
 8634
 8635
 8636
 8637
 8638
 8639
 8640
 8641
 8642
 8643
 8644
 8645
 8646
 8647
 8648
 8649
 8650
 8651
 8652
 8653
 8654
 8655
 8656
 8657
 8658
 8659
 8660
 8661
 8662
 8663
 8664
 8665
 8666
 8667
 8668
 8669
 8670
 8671
 8672
 8673
 8674
 8675
 8676
 8677
 8678
 8679
 8680
 8681
 8682
 8683
 8684
 8685
 8686
 8687
 8688
 8689
 8690
 8691
 8692
 8693
 8694
 8695
 8696
 8697
 8698
 8699
 8700
 8701
 8702
 8703
 8704
 8705
 8706
 8707
 8708
 8709
 8710
 8711
 8712
 8713
 8714
 8715
 8716
 8717
 8718
 8719
 8720
 8721
 8722
 8723
 8724
 8725
 8726
 8727
 8728
 8729
 8730
 8731
 8732
 8733
 8734
 8735
 8736
 8737
 8738
 8739
 8740
 8741
 8742
 8743
 8744
 8745
 8746
 8747
 8748
 8749
 8750
 8751
 8752
 8753
 8754
 8755
 8756
 8757
 8758
 8759
 8760
 8761
 8762
 8763
 8764
 8765
 8766
 8767
 8768
 8769
 8770
 8771
 8772
 8773
 8774
 8775
 8776
 8777
 8778
 8779
 8780
 8781
 8782
 8783
 8784
 8785
 8786
 8787
 8788
 8789
 8790
 8791
 8792
 8793
 8794
 8795
 8796
 8797
 8798
 8799
 8800
 8801
 8802
 8803
 8804
 8805
 8806
 8807
 8808
 8809
 8810
 8811
 8812
 8813
 8814
 8815
 8816
 8817
 8818
 8819
 8820
 8821
 8822
 8823
 8824
 8825
 8826
 8827
 8828
 8829
 8830
 8831
 8832
 8833
 8834
 8835
 8836
 8837
 8838
 8839
 8840
 8841
 8842
 8843
 8844
 8845
 8846
 8847
 8848
 8849
 8850
 8851
 8852
 8853
 8854
 8855
 8856
 8857
 8858
 8859
 8860
 8861
 8862
 8863
 8864
 8865
 8866
 8867
 8868
 8869
 8870
 8871
 8872
 8873
 8874
 8875
 8876
 8877
 8878
 8879
 8880
 8881
 8882
 8883
 8884
 8885
 8886
 8887
 8888
 8889
 8890
 8891
 8892
 8893
 8894
 8895
 8896
 8897
 8898
 8899
 8900
 8901
 8902
 8903
 8904
 8905
 8906
 8907
 8908
 8909
 8910
 8911
 8912
 8913
 8914
 8915
 8916
 8917
 8918
 8919
 8920
 8921
 8922
 8923
 8924
 8925
 8926
 8927
 8928
 8929
 8930
 8931
 8932
 8933
 8934
 8935
 8936
 8937
 8938
 8939
 8940
 8941
 8942
 8943
 8944
 8945
 8946
 8947
 8948
 8949
 8950
 8951
 8952
 8953
 8954
 8955
 8956
 8957
 8958
 8959
 8960
 8961
 8962
 8963
 8964
 8965
 8966
 8967
 8968
 8969
 8970
 8971
 8972
 8973
 8974
 8975
 8976
 8977
 8978
 8979
 8980
 8981
 8982
 8983
 8984
 8985
 8986
 8987
 8988
 8989
 8990
 8991
 8992
 8993
 8994
 8995
 8996
 8997
 8998
 8999
 9000
 9001
 9002
 9003
 9004
 9005
 9006
 9007
 9008
 9009
 9010
 9011
 9012
 9013
 9014
 9015
 9016
 9017
 9018
 9019
 9020
 9021
 9022
 9023
 9024
 9025
 9026
 9027
 9028
 9029
 9030
 9031
 9032
 9033
 9034
 9035
 9036
 9037
 9038
 9039
 9040
 9041
 9042
 9043
 9044
 9045
 9046
 9047
 9048
 9049
 9050
 9051
 9052
 9053
 9054
 9055
 9056
 9057
 9058
 9059
 9060
 9061
 9062
 9063
 9064
 9065
 9066
 9067
 9068
 9069
 9070
 9071
 9072
 9073
 9074
 9075
 9076
 9077
 9078
 9079
 9080
 9081
 9082
 9083
 9084
 9085
 9086
 9087
 9088
 9089
 9090
 9091
 9092
 9093
 9094
 9095
 9096
 9097
 9098
 9099
 9100
 9101
 9102
 9103
 9104
 9105
 9106
 9107
 9108
 9109
 9110
 9111
 9112
 9113
 9114
 9115
 9116
 9117
 9118
 9119
 9120
 9121
 9122
 9123
 9124
 9125
 9126
 9127
 9128
 9129
 9130
 9131
 9132
 9133
 9134
 9135
 9136
 9137
 9138
 9139
 9140
 9141
 9142
 9143
 9144
 9145
 9146
 9147
 9148
 9149
 9150
 9151
 9152
 9153
 9154
 9155
 9156
 9157
 9158
 9159
 9160
 9161
 9162
 9163
 9164
 9165
 9166
 9167
 9168
 9169
 9170
 9171
 9172
 9173
 9174
 9175
 9176
 9177
 9178
 9179
 9180
 9181
 9182
 9183
 9184
 9185
 9186
 9187
 9188
 9189
 9190
 9191
 9192
 9193
 9194
 9195
 9196
 9197
 9198
 9199
 9200
 9201
 9202
 9203
 9204
 9205
 9206
 9207
 9208
 9209
 9210
 9211
 9212
 9213
 9214
 9215
 9216
 9217
 9218
 9219
 9220
 9221
 9222
 9223
 9224
 9225
 9226
 9227
 9228
 9229
 9230
 9231
 9232
 9233
 9234
 9235
 9236
 9237
 9238
 9239
 9240
 9241
 9242
 9243
 9244
 9245
 9246
 9247
 9248
 9249
 9250
 9251
 9252
 9253
 9254
 9255
 9256
 9257
 9258
 9259
 9260
 9261
 9262
 9263
 9264
 9265
 9266
 9267
 9268
 9269
 9270
 9271
 9272
 9273
 9274
 9275
 9276
 9277
 9278
 9279
 9280
 9281
 9282
 9283
 9284
 9285
 9286
 9287
 9288
 9289
 9290
 9291
 9292
 9293
 9294
 9295
 9296
 9297
 9298
 9299
 9300
 9301
 9302
 9303
 9304
 9305
 9306
 9307
 9308
 9309
 9310
 9311
 9312
 9313
 9314
 9315
 9316
 9317
 9318
 9319
 9320
 9321
 9322
 9323
 9324
 9325
 9326
 9327
 9328
 9329
 9330
 9331
 9332
 9333
 9334
 9335
 9336
 9337
 9338
 9339
 9340
 9341
 9342
 9343
 9344
 9345
 9346
 9347
 9348
 9349
 9350
 9351
 9352
 9353
 9354
 9355
 9356
 9357
 9358
 9359
 9360
 9361
 9362
 9363
 9364
 9365
 9366
 9367
 9368
 9369
 9370
 9371
 9372
 9373
 9374
 9375
 9376
 9377
 9378
 9379
 9380
 9381
 9382
 9383
 9384
 9385
 9386
 9387
 9388
 9389
 9390
 9391
 9392
 9393
 9394
 9395
 9396
 9397
 9398
 9399
 9400
 9401
 9402
 9403
 9404
 9405
 9406
 9407
 9408
 9409
 9410
 9411
 9412
 9413
 9414
 9415
 9416
 9417
 9418
 9419
 9420
 9421
 9422
 9423
 9424
 9425
 9426
 9427
 9428
 9429
 9430
 9431
 9432
 9433
 9434
 9435
 9436
 9437
 9438
 9439
 9440
 9441
 9442
 9443
 9444
 9445
 9446
 9447
 9448
 9449
 9450
 9451
 9452
 9453
 9454
 9455
 9456
 9457
 9458
 9459
 9460
 9461
 9462
 9463
 9464
 9465
 9466
 9467
 9468
 9469
 9470
 9471
 9472
 9473
 9474
 9475
 9476
 9477
 9478
 9479
 9480
 9481
 9482
 9483
 9484
 9485
 9486
 9487
 9488
 9489
 9490
 9491
 9492
 9493
 9494
 9495
 9496
 9497
 9498
 9499
 9500
 9501
 9502
 9503
 9504
 9505
 9506
 9507
 9508
 9509
 9510
 9511
 9512
 9513
 9514
 9515
 9516
 9517
 9518
 9519
 9520
 9521
 9522
 9523
 9524
 9525
 9526
 9527
 9528
 9529
 9530
 9531
 9532
 9533
 9534
 9535
 9536
 9537
 9538
 9539
 9540
 9541
 9542
 9543
 9544
 9545
 9546
 9547
 9548
 9549
 9550
 9551
 9552
 9553
 9554
 9555
 9556
 9557
 9558
 9559
 9560
 9561
 9562
 9563
 9564
 9565
 9566
 9567
 9568
 9569
 9570
 9571
 9572
 9573
 9574
 9575
 9576
 9577
 9578
 9579
 9580
 9581
 9582
 9583
 9584
 9585
 9586
 9587
 9588
 9589
 9590
 9591
 9592
 9593
 9594
 9595
 9596
 9597
 9598
 9599
 9600
 9601
 9602
 9603
 9604
 9605
 9606
 9607
 9608
 9609
 9610
 9611
 9612
 9613
 9614
 9615
 9616
 9617
 9618
 9619
 9620
 9621
 9622
 9623
 9624
 9625
 9626
 9627
 9628
 9629
 9630
 9631
 9632
 9633
 9634
 9635
 9636
 9637
 9638
 9639
 9640
 9641
 9642
 9643
 9644
 9645
 9646
 9647
 9648
 9649
 9650
 9651
 9652
 9653
 9654
 9655
 9656
 9657
 9658
 9659
 9660
 9661
 9662
 9663
 9664
 9665
 9666
 9667
 9668
 9669
 9670
 9671
 9672
 9673
 9674
 9675
 9676
 9677
 9678
 9679
 9680
 9681
 9682
 9683
 9684
 9685
 9686
 9687
 9688
 9689
 9690
 9691
 9692
 9693
 9694
 9695
 9696
 9697
 9698
 9699
 9700
 9701
 9702
 9703
 9704
 9705
 9706
 9707
 9708
 9709
 9710
 9711
 9712
 9713
 9714
 9715
 9716
 9717
 9718
 9719
 9720
 9721
 9722
 9723
 9724
 9725
 9726
 9727
 9728
 9729
 9730
 9731
 9732
 9733
 9734
 9735
 9736
 9737
 9738
 9739
 9740
 9741
 9742
 9743
 9744
 9745
 9746
 9747
 9748
 9749
 9750
 9751
 9752
 9753
 9754
 9755
 9756
 9757
 9758
 9759
 9760
 9761
 9762
 9763
 9764
 9765
 9766
 9767
 9768
 9769
 9770
 9771
 9772
 9773
 9774
 9775
 9776
 9777
 9778
 9779
 9780
 9781
 9782
 9783
 9784
 9785
 9786
 9787
 9788
 9789
 9790
 9791
 9792
 9793
 9794
 9795
 9796
 9797
 9798
 9799
 9800
 9801
 9802
 9803
 9804
 9805
 9806
 9807
 9808
 9809
 9810
 9811
 9812
 9813
 9814
 9815
 9816
 9817
 9818
 9819
 9820
 9821
 9822
 9823
 9824
 9825
 9826
 9827
 9828
 9829
 9830
 9831
 9832
 9833
 9834
 9835
 9836
 9837
 9838
 9839
 9840
 9841
 9842
 9843
 9844
 9845
 9846
 9847
 9848
 9849
 9850
 9851
 9852
 9853
 9854
 9855
 9856
 9857
 9858
 9859
 9860
 9861
 9862
 9863
 9864
 9865
 9866
 9867
 9868
 9869
 9870
 9871
 9872
 9873
 9874
 9875
 9876
 9877
 9878
 9879
 9880
 9881
 9882
 9883
 9884
 9885
 9886
 9887
 9888
 9889
 9890
 9891
 9892
 9893
 9894
 9895
 9896
 9897
 9898
 9899
 9900
 9901
 9902
 9903
 9904
 9905
 9906
 9907
 9908
 9909
 9910
 9911
 9912
 9913
 9914
 9915
 9916
 9917
 9918
 9919
 9920
 9921
 9922
 9923
 9924
 9925
 9926
 9927
 9928
 9929
 9930
 9931
 9932
 9933
 9934
 9935
 9936
 9937
 9938
 9939
 9940
 9941
 9942
 9943
 9944
 9945
 9946
 9947
 9948
 9949
 9950
 9951
 9952
 9953
 9954
 9955
 9956
 9957
 9958
 9959
 9960
 9961
 9962
 9963
 9964
 9965
 9966
 9967
 9968
 9969
 9970
 9971
 9972
 9973
 9974
 9975
 9976
 9977
 9978
 9979
 9980
 9981
 9982
 9983
 9984
 9985
 9986
 9987
 9988
 9989
 9990
 9991
 9992
 9993
 9994
 9995
 9996
 9997
 9998
 9999
10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
10016
10017
10018
10019
10020
10021
10022
10023
10024
10025
10026
10027
10028
10029
10030
10031
10032
10033
10034
10035
10036
10037
10038
10039
10040
10041
10042
10043
10044
10045
10046
10047
10048
10049
10050
10051
10052
10053
10054
10055
10056
10057
10058
10059
10060
10061
10062
10063
10064
10065
10066
10067
10068
10069
10070
10071
10072
10073
10074
10075
10076
10077
10078
10079
10080
10081
10082
10083
10084
10085
10086
10087
10088
10089
10090
10091
10092
10093
10094
10095
10096
10097
10098
10099
10100
10101
10102
10103
10104
10105
10106
10107
10108
10109
10110
10111
10112
10113
10114
10115
10116
10117
10118
10119
10120
10121
10122
10123
10124
10125
10126
10127
10128
10129
10130
10131
10132
10133
10134
10135
10136
10137
10138
10139
10140
10141
10142
10143
10144
10145
10146
10147
10148
10149
10150
10151
10152
10153
10154
10155
10156
10157
10158
10159
10160
10161
10162
10163
10164
10165
10166
10167
10168
10169
10170
10171
10172
10173
10174
10175
10176
10177
10178
10179
10180
10181
10182
10183
10184
10185
10186
10187
10188
10189
10190
10191
10192
10193
10194
10195
10196
10197
10198
10199
10200
10201
10202
10203
10204
10205
10206
10207
10208
10209
10210
10211
10212
10213
10214
10215
10216
10217
10218
10219
10220
10221
10222
10223
10224
10225
10226
10227
10228
10229
10230
10231
10232
10233
10234
10235
10236
10237
10238
10239
10240
10241
10242
10243
10244
10245
10246
10247
10248
10249
10250
10251
10252
10253
10254
10255
10256
10257
10258
10259
10260
10261
10262
10263
10264
10265
10266
10267
10268
10269
10270
10271
10272
10273
10274
10275
10276
10277
10278
10279
10280
10281
10282
10283
10284
10285
10286
10287
10288
10289
10290
10291
10292
10293
10294
10295
10296
10297
10298
10299
10300
10301
10302
10303
10304
10305
10306
10307
10308
10309
10310
10311
10312
10313
10314
10315
10316
10317
10318
10319
10320
10321
10322
10323
10324
10325
10326
10327
10328
10329
10330
10331
10332
10333
10334
10335
10336
10337
10338
10339
10340
10341
10342
10343
10344
10345
10346
10347
10348
10349
10350
10351
10352
10353
10354
10355
10356
10357
10358
10359
10360
10361
10362
10363
10364
10365
10366
10367
10368
10369
10370
10371
10372
10373
10374
10375
10376
10377
10378
10379
10380
10381
10382
10383
10384
10385
10386
10387
10388
10389
10390
10391
10392
10393
10394
10395
10396
10397
10398
10399
10400
10401
10402
10403
10404
10405
10406
10407
10408
10409
10410
10411
10412
10413
10414
10415
10416
10417
10418
10419
10420
10421
10422
10423
10424
10425
10426
10427
10428
10429
10430
10431
10432
10433
10434
10435
10436
10437
10438
10439
10440
10441
10442
10443
10444
10445
10446
10447
10448
10449
10450
10451
10452
10453
10454
10455
10456
10457
10458
10459
10460
10461
10462
10463
10464
10465
10466
10467
10468
10469
10470
10471
10472
10473
10474
10475
10476
10477
10478
10479
10480
10481
10482
10483
10484
10485
10486
10487
10488
10489
10490
10491
10492
10493
10494
10495
10496
10497
10498
10499
10500
10501
10502
10503
10504
10505
10506
10507
10508
10509
10510
10511
10512
10513
10514
10515
10516
10517
10518
10519
10520
10521
10522
10523
10524
10525
10526
10527
10528
10529
10530
10531
10532
10533
10534
10535
10536
10537
10538
10539
10540
10541
10542
10543
10544
10545
10546
10547
10548
10549
10550
10551
10552
10553
10554
10555
10556
10557
10558
10559
10560
10561
10562
10563
10564
10565
10566
10567
10568
10569
10570
10571
10572
10573
10574
10575
10576
10577
10578
10579
10580
10581
10582
10583
10584
10585
10586
10587
10588
10589
10590
10591
10592
10593
10594
10595
10596
10597
10598
10599
10600
10601
10602
10603
10604
10605
10606
10607
10608
10609
10610
10611
10612
10613
10614
10615
10616
10617
10618
10619
10620
10621
10622
10623
10624
10625
10626
10627
10628
10629
10630
10631
10632
10633
10634
10635
10636
10637
10638
10639
10640
10641
10642
10643
10644
10645
10646
10647
10648
10649
10650
10651
10652
10653
10654
10655
10656
10657
10658
10659
10660
10661
10662
10663
10664
10665
10666
10667
10668
10669
10670
10671
10672
10673
10674
10675
10676
10677
10678
10679
10680
10681
10682
10683
10684
10685
10686
10687
10688
10689
10690
10691
10692
10693
10694
10695
10696
10697
10698
10699
10700
10701
10702
10703
10704
10705
10706
10707
10708
10709
10710
10711
10712
10713
10714
10715
10716
10717
10718
10719
10720
10721
10722
10723
10724
10725
10726
10727
10728
10729
10730
10731
10732
10733
10734
10735
10736
10737
10738
10739
10740
10741
10742
10743
10744
10745
10746
10747
10748
10749
10750
10751
10752
10753
10754
10755
10756
10757
10758
10759
10760
10761
10762
10763
10764
10765
10766
10767
10768
10769
10770
10771
10772
10773
10774
10775
10776
10777
10778
10779
10780
10781
10782
10783
10784
10785
10786
10787
10788
10789
10790
10791
10792
10793
10794
10795
10796
10797
10798
10799
10800
10801
10802
10803
10804
10805
10806
10807
10808
10809
10810
10811
10812
10813
10814
10815
10816
10817
10818
10819
10820
10821
10822
10823
10824
10825
10826
10827
10828
10829
10830
10831
10832
10833
10834
10835
10836
10837
10838
10839
10840
10841
10842
10843
10844
10845
10846
10847
10848
10849
10850
10851
10852
10853
10854
10855
10856
10857
10858
10859
10860
10861
10862
10863
10864
10865
10866
10867
10868
10869
10870
10871
10872
10873
10874
10875
10876
10877
10878
10879
10880
10881
10882
10883
10884
10885
10886
10887
10888
10889
10890
10891
10892
10893
10894
10895
10896
10897
10898
10899
10900
10901
10902
10903
10904
10905
10906
10907
10908
10909
10910
10911
10912
10913
10914
10915
10916
10917
10918
10919
10920
10921
10922
10923
10924
10925
10926
10927
10928
10929
10930
10931
10932
10933
10934
10935
10936
10937
10938
10939
10940
10941
10942
10943
10944
10945
10946
10947
10948
10949
10950
10951
10952
10953
10954
10955
10956
10957
10958
10959
10960
10961
10962
10963
10964
10965
10966
10967
10968
10969
10970
10971
10972
10973
10974
10975
10976
10977
10978
10979
10980
10981
10982
10983
10984
10985
10986
10987
10988
10989
10990
10991
10992
10993
10994
10995
10996
10997
10998
10999
11000
11001
11002
11003
11004
11005
11006
11007
11008
11009
11010
11011
11012
11013
11014
11015
11016
11017
11018
11019
11020
11021
11022
11023
11024
11025
11026
11027
11028
11029
11030
11031
11032
11033
11034
11035
11036
11037
11038
11039
11040
11041
11042
11043
11044
11045
11046
11047
11048
11049
11050
11051
11052
11053
11054
11055
11056
11057
11058
11059
11060
11061
11062
11063
11064
11065
11066
11067
11068
11069
11070
11071
11072
11073
11074
11075
11076
11077
11078
11079
11080
11081
11082
11083
11084
11085
11086
11087
11088
11089
11090
11091
11092
11093
11094
11095
11096
11097
11098
11099
11100
11101
11102
11103
11104
11105
11106
11107
11108
11109
11110
11111
11112
11113
11114
11115
11116
11117
11118
11119
11120
11121
11122
11123
11124
11125
11126
11127
11128
11129
11130
11131
11132
11133
11134
11135
11136
11137
11138
11139
11140
11141
11142
11143
11144
11145
11146
11147
11148
11149
11150
11151
11152
11153
11154
11155
11156
11157
11158
11159
11160
11161
11162
11163
11164
11165
11166
11167
11168
11169
11170
11171
11172
11173
11174
11175
11176
11177
11178
11179
11180
11181
11182
11183
11184
11185
11186
11187
11188
11189
11190
11191
11192
11193
11194
11195
11196
11197
11198
11199
11200
11201
11202
11203
11204
11205
11206
11207
11208
11209
11210
11211
11212
11213
11214
11215
11216
11217
11218
11219
11220
11221
11222
11223
11224
11225
11226
11227
11228
11229
11230
11231
11232
11233
11234
11235
11236
11237
11238
11239
11240
11241
11242
11243
11244
11245
11246
11247
11248
11249
11250
11251
11252
11253
11254
11255
11256
11257
11258
11259
11260
11261
11262
11263
11264
11265
11266
11267
11268
11269
11270
11271
11272
11273
11274
11275
11276
11277
11278
11279
11280
11281
11282
11283
11284
11285
11286
11287
11288
11289
11290
11291
11292
11293
11294
11295
11296
11297
11298
11299
11300
11301
11302
11303
11304
11305
11306
11307
11308
11309
11310
11311
11312
11313
11314
11315
11316
11317
11318
11319
11320
11321
11322
11323
11324
11325
11326
11327
11328
11329
11330
11331
11332
11333
11334
11335
11336
11337
11338
11339
11340
11341
11342
11343
11344
11345
11346
11347
11348
11349
11350
11351
11352
11353
11354
11355
11356
11357
11358
11359
11360
11361
11362
11363
11364
11365
11366
11367
11368
11369
11370
11371
11372
11373
11374
11375
11376
11377
11378
11379
11380
11381
11382
11383
11384
11385
11386
11387
11388
11389
11390
11391
11392
11393
11394
11395
11396
11397
11398
11399
11400
11401
11402
11403
11404
11405
11406
11407
11408
11409
11410
11411
11412
11413
11414
11415
11416
11417
11418
11419
11420
11421
11422
11423
11424
11425
11426
11427
11428
11429
11430
11431
11432
11433
11434
11435
11436
11437
11438
11439
11440
11441
11442
11443
11444
11445
11446
11447
11448
11449
11450
11451
11452
11453
11454
11455
11456
11457
11458
11459
11460
11461
11462
11463
11464
11465
11466
11467
11468
11469
11470
11471
11472
11473
11474
11475
11476
11477
11478
11479
11480
11481
11482
11483
11484
11485
11486
11487
11488
11489
11490
11491
11492
11493
11494
11495
11496
11497
11498
11499
11500
11501
11502
11503
11504
11505
11506
11507
11508
11509
11510
11511
11512
11513
11514
11515
11516
11517
11518
11519
11520
11521
11522
11523
11524
11525
11526
11527
11528
11529
11530
11531
11532
11533
11534
11535
11536
11537
11538
11539
11540
11541
11542
11543
11544
11545
11546
11547
11548
11549
11550
11551
11552
11553
11554
11555
11556
11557
11558
11559
11560
11561
11562
11563
11564
11565
11566
11567
11568
11569
11570
11571
11572
11573
11574
11575
11576
11577
11578
11579
11580
11581
11582
11583
11584
11585
11586
11587
11588
11589
11590
11591
11592
11593
11594
11595
11596
11597
11598
11599
11600
11601
11602
11603
11604
11605
11606
11607
11608
11609
11610
11611
11612
11613
11614
11615
11616
11617
11618
11619
11620
11621
11622
11623
11624
11625
11626
11627
11628
11629
11630
11631
11632
11633
11634
11635
11636
11637
11638
11639
11640
11641
11642
11643
11644
11645
11646
11647
11648
11649
11650
11651
11652
11653
11654
11655
11656
11657
11658
11659
11660
11661
11662
11663
11664
11665
11666
11667
11668
11669
11670
11671
11672
11673
11674
11675
11676
11677
11678
11679
11680
11681
11682
11683
11684
11685
11686
11687
11688
11689
11690
11691
11692
11693
11694
11695
11696
11697
11698
11699
11700
11701
11702
11703
11704
11705
11706
11707
11708
11709
11710
11711
11712
11713
11714
11715
11716
11717
11718
11719
11720
11721
11722
11723
11724
11725
11726
11727
11728
11729
11730
11731
11732
11733
11734
11735
11736
11737
11738
11739
11740
11741
11742
11743
11744
11745
11746
11747
11748
11749
11750
11751
11752
11753
11754
11755
11756
11757
11758
11759
11760
11761
11762
11763
11764
11765
11766
11767
11768
11769
11770
11771
11772
11773
11774
11775
11776
11777
11778
11779
11780
11781
11782
11783
11784
11785
11786
11787
11788
11789
11790
11791
11792
11793
11794
11795
11796
11797
11798
11799
11800
11801
11802
11803
11804
11805
11806
11807
11808
11809
11810
11811
11812
11813
11814
11815
11816
11817
11818
11819
11820
11821
11822
11823
11824
11825
11826
11827
11828
11829
11830
11831
11832
11833
11834
11835
11836
11837
11838
11839
11840
11841
11842
11843
11844
11845
11846
11847
11848
11849
11850
11851
11852
11853
11854
11855
11856
11857
11858
11859
11860
11861
11862
11863
11864
11865
11866
11867
11868
11869
11870
11871
11872
11873
11874
11875
11876
11877
11878
11879
11880
11881
11882
11883
11884
11885
11886
11887
11888
11889
11890
11891
11892
11893
11894
11895
11896
11897
11898
11899
11900
11901
11902
11903
11904
11905
11906
11907
11908
11909
11910
11911
11912
11913
11914
11915
11916
11917
11918
11919
11920
11921
11922
11923
11924
11925
11926
11927
11928
11929
11930
11931
11932
11933
11934
11935
11936
11937
11938
11939
11940
11941
11942
11943
11944
11945
11946
11947
11948
11949
11950
11951
11952
11953
11954
11955
11956
11957
11958
11959
11960
11961
11962
11963
11964
11965
11966
11967
11968
11969
11970
11971
11972
11973
11974
11975
11976
11977
11978
11979
11980
11981
11982
11983
11984
11985
11986
11987
11988
11989
11990
11991
11992
11993
11994
11995
11996
11997
11998
11999
12000
12001
12002
12003
12004
12005
12006
12007
12008
12009
12010
12011
12012
12013
12014
12015
12016
12017
12018
12019
12020
12021
12022
12023
12024
12025
12026
12027
12028
12029
12030
12031
12032
12033
12034
12035
12036
12037
12038
12039
12040
12041
12042
12043
12044
12045
12046
12047
12048
12049
12050
12051
12052
12053
12054
12055
12056
12057
12058
12059
12060
12061
12062
12063
12064
12065
12066
12067
12068
12069
12070
12071
12072
12073
12074
12075
12076
12077
12078
12079
12080
12081
12082
12083
12084
12085
12086
12087
12088
12089
12090
12091
12092
12093
12094
12095
12096
12097
12098
12099
12100
12101
12102
12103
12104
12105
12106
12107
12108
12109
12110
12111
12112
12113
12114
12115
12116
12117
12118
12119
12120
12121
12122
12123
12124
12125
12126
12127
12128
12129
12130
12131
12132
12133
12134
12135
12136
12137
12138
12139
12140
12141
12142
12143
12144
12145
12146
12147
12148
12149
12150
12151
12152
12153
12154
12155
12156
12157
12158
12159
12160
12161
12162
12163
12164
12165
12166
12167
12168
12169
12170
12171
12172
12173
12174
12175
12176
12177
12178
12179
12180
12181
12182
12183
12184
12185
12186
12187
12188
12189
12190
12191
12192
12193
12194
12195
12196
12197
12198
12199
12200
12201
12202
12203
12204
12205
12206
12207
12208
12209
12210
12211
12212
12213
12214
12215
12216
12217
12218
12219
12220
12221
12222
12223
12224
12225
12226
12227
12228
12229
12230
12231
12232
12233
12234
12235
12236
12237
12238
12239
12240
12241
12242
12243
12244
12245
12246
12247
12248
12249
12250
12251
12252
12253
12254
12255
12256
12257
12258
12259
12260
12261
12262
12263
12264
12265
12266
12267
12268
12269
12270
12271
12272
12273
12274
12275
12276
12277
12278
12279
12280
12281
12282
12283
12284
12285
12286
12287
12288
12289
12290
12291
12292
12293
12294
12295
12296
12297
12298
12299
12300
12301
12302
12303
12304
12305
12306
12307
12308
12309
12310
12311
12312
12313
12314
12315
12316
12317
12318
12319
12320
12321
12322
12323
12324
12325
12326
12327
12328
12329
12330
12331
12332
12333
12334
12335
12336
12337
12338
12339
12340
12341
12342
12343
12344
12345
12346
12347
12348
12349
12350
12351
12352
12353
12354
12355
12356
12357
12358
12359
12360
12361
12362
12363
12364
12365
12366
12367
12368
12369
12370
12371
12372
12373
12374
12375
12376
12377
12378
12379
12380
12381
12382
12383
12384
12385
12386
12387
12388
12389
12390
12391
12392
12393
12394
12395
12396
12397
12398
12399
12400
12401
12402
12403
12404
12405
12406
12407
12408
12409
12410
12411
12412
12413
12414
12415
12416
12417
12418
12419
12420
12421
12422
12423
12424
12425
12426
12427
12428
12429
12430
12431
12432
12433
12434
12435
12436
12437
12438
12439
12440
12441
12442
12443
12444
12445
12446
12447
12448
12449
12450
12451
12452
12453
12454
12455
12456
12457
12458
12459
12460
12461
12462
12463
12464
12465
12466
12467
12468
12469
12470
12471
12472
12473
12474
12475
12476
12477
12478
12479
12480
12481
12482
12483
12484
12485
12486
12487
12488
12489
12490
12491
12492
12493
12494
12495
12496
12497
12498
12499
12500
12501
12502
12503
12504
12505
12506
12507
12508
12509
12510
12511
12512
12513
12514
12515
12516
12517
12518
12519
12520
12521
12522
12523
12524
12525
12526
12527
12528
12529
12530
12531
12532
12533
12534
12535
12536
12537
12538
12539
12540
12541
12542
12543
12544
12545
12546
12547
12548
12549
12550
12551
12552
12553
12554
12555
12556
12557
12558
12559
12560
12561
12562
12563
12564
12565
12566
12567
12568
12569
12570
12571
12572
12573
12574
12575
12576
12577
12578
12579
12580
12581
12582
12583
12584
12585
12586
12587
12588
12589
12590
12591
12592
12593
12594
12595
12596
12597
12598
12599
12600
12601
12602
12603
12604
12605
12606
12607
12608
12609
12610
12611
12612
12613
12614
12615
12616
12617
12618
12619
12620
12621
12622
12623
12624
12625
12626
12627
12628
12629
12630
12631
12632
12633
12634
12635
12636
12637
12638
12639
12640
12641
12642
12643
12644
12645
12646
12647
12648
12649
12650
12651
12652
12653
12654
12655
12656
12657
12658
12659
12660
12661
12662
12663
12664
12665
12666
12667
12668
12669
12670
12671
12672
12673
12674
12675
12676
12677
12678
12679
12680
12681
12682
12683
12684
12685
12686
12687
12688
12689
12690
12691
12692
12693
12694
12695
12696
12697
12698
12699
12700
12701
12702
12703
12704
12705
12706
12707
12708
12709
12710
12711
12712
12713
12714
12715
12716
12717
12718
12719
12720
12721
12722
12723
12724
12725
12726
12727
12728
12729
12730
12731
12732
12733
12734
12735
12736
12737
12738
12739
12740
12741
12742
12743
12744
12745
12746
12747
12748
12749
12750
12751
12752
12753
12754
12755
12756
12757
12758
12759
12760
12761
12762
12763
12764
12765
12766
12767
12768
12769
12770
12771
12772
12773
12774
12775
12776
12777
12778
12779
12780
12781
12782
12783
12784
12785
12786
12787
12788
12789
12790
12791
12792
12793
12794
12795
12796
12797
12798
12799
12800
12801
12802
12803
12804
12805
12806
12807
12808
12809
12810
12811
12812
12813
12814
12815
12816
12817
12818
12819
12820
12821
12822
12823
12824
12825
12826
12827
12828
12829
12830
12831
12832
12833
12834
12835
12836
12837
12838
12839
12840
12841
12842
12843
12844
12845
12846
12847
12848
12849
12850
12851
12852
12853
12854
12855
12856
12857
12858
12859
12860
12861
12862
12863
12864
12865
12866
12867
12868
12869
12870
12871
12872
12873
12874
12875
12876
12877
12878
12879
12880
12881
12882
12883
12884
12885
12886
12887
12888
12889
12890
12891
12892
12893
12894
12895
12896
12897
12898
12899
12900
12901
12902
12903
12904
12905
12906
12907
12908
12909
12910
12911
12912
12913
12914
12915
12916
12917
12918
12919
12920
12921
12922
12923
12924
12925
12926
12927
12928
12929
12930
12931
12932
12933
12934
12935
12936
12937
12938
12939
12940
12941
12942
12943
12944
12945
12946
12947
12948
12949
12950
12951
12952
12953
12954
12955
12956
12957
12958
12959
12960
12961
12962
12963
12964
12965
12966
12967
12968
12969
12970
12971
12972
12973
12974
12975
12976
12977
12978
12979
12980
12981
12982
12983
12984
12985
12986
12987
12988
12989
12990
12991
12992
12993
12994
12995
12996
12997
12998
12999
13000
13001
13002
13003
13004
13005
13006
13007
13008
13009
13010
13011
13012
13013
13014
13015
13016
13017
13018
13019
13020
13021
13022
13023
13024
13025
13026
13027
13028
13029
13030
13031
13032
13033
13034
13035
13036
13037
13038
13039
13040
13041
13042
13043
13044
13045
13046
13047
13048
13049
13050
13051
13052
13053
13054
13055
13056
13057
13058
13059
13060
13061
13062
13063
13064
13065
13066
13067
13068
13069
13070
13071
13072
13073
13074
13075
13076
13077
13078
13079
13080
13081
13082
13083
13084
13085
13086
13087
13088
13089
13090
13091
13092
13093
13094
13095
13096
13097
13098
13099
13100
13101
13102
13103
13104
13105
13106
13107
13108
13109
13110
13111
13112
13113
13114
13115
13116
13117
13118
13119
13120
13121
13122
13123
13124
13125
13126
13127
13128
13129
13130
13131
13132
13133
13134
13135
13136
13137
13138
13139
13140
13141
13142
13143
13144
13145
13146
13147
13148
13149
13150
13151
13152
13153
13154
13155
13156
13157
13158
13159
13160
13161
13162
13163
13164
13165
13166
13167
13168
13169
13170
13171
13172
13173
13174
13175
13176
13177
13178
13179
13180
13181
13182
13183
13184
13185
13186
13187
13188
13189
13190
13191
13192
13193
13194
13195
13196
13197
13198
13199
13200
13201
13202
13203
13204
13205
13206
13207
13208
13209
13210
13211
13212
13213
13214
13215
13216
13217
13218
13219
13220
13221
13222
13223
13224
13225
13226
13227
13228
13229
13230
13231
13232
13233
13234
13235
13236
13237
13238
13239
13240
13241
13242
13243
13244
13245
13246
13247
13248
13249
13250
13251
13252
13253
13254
13255
13256
13257
13258
13259
13260
13261
13262
13263
13264
13265
13266
13267
13268
13269
13270
13271
13272
13273
13274
13275
13276
13277
13278
13279
13280
13281
13282
13283
13284
13285
13286
13287
13288
13289
13290
13291
13292
13293
13294
13295
13296
13297
13298
13299
13300
13301
13302
13303
13304
13305
13306
13307
13308
13309
13310
13311
13312
13313
13314
13315
13316
13317
13318
13319
13320
13321
13322
13323
13324
13325
13326
13327
13328
13329
13330
13331
13332
13333
13334
13335
13336
13337
13338
13339
13340
13341
13342
13343
13344
13345
13346
13347
13348
13349
13350
13351
13352
13353
13354
13355
13356
13357
13358
13359
13360
13361
13362
13363
13364
13365
13366
13367
13368
13369
13370
13371
13372
13373
13374
13375
13376
13377
13378
13379
13380
13381
13382
13383
13384
13385
13386
13387
13388
13389
13390
13391
13392
13393
13394
13395
13396
13397
13398
13399
13400
13401
13402
13403
13404
13405
13406
13407
13408
13409
13410
13411
13412
13413
13414
13415
13416
13417
13418
13419
13420
13421
13422
13423
13424
13425
13426
13427
13428
13429
13430
13431
13432
13433
13434
13435
13436
13437
13438
13439
13440
13441
13442
13443
13444
13445
13446
13447
13448
13449
13450
13451
13452
13453
13454
13455
13456
13457
13458
13459
13460
13461
13462
13463
13464
13465
13466
13467
13468
13469
13470
13471
13472
13473
13474
13475
13476
13477
13478
13479
13480
13481
13482
13483
13484
13485
13486
13487
13488
13489
13490
13491
13492
13493
13494
13495
13496
13497
13498
13499
13500
13501
13502
13503
13504
13505
13506
13507
13508
13509
13510
13511
13512
13513
13514
13515
13516
13517
13518
13519
13520
13521
13522
13523
13524
13525
13526
13527
13528
13529
13530
13531
13532
13533
13534
13535
13536
13537
13538
13539
13540
13541
13542
13543
13544
13545
13546
13547
13548
13549
13550
13551
13552
13553
13554
13555
13556
13557
13558
13559
13560
13561
13562
13563
13564
13565
13566
13567
13568
13569
13570
13571
13572
13573
13574
13575
13576
13577
13578
13579
13580
13581
13582
13583
13584
13585
13586
13587
13588
13589
13590
13591
13592
13593
13594
13595
13596
13597
13598
13599
13600
13601
13602
13603
13604
13605
13606
13607
13608
13609
13610
13611
13612
13613
13614
13615
13616
13617
13618
13619
13620
13621
13622
13623
13624
13625
13626
13627
13628
13629
13630
13631
13632
13633
13634
13635
13636
13637
13638
13639
13640
13641
13642
13643
13644
13645
13646
13647
13648
13649
13650
13651
13652
13653
13654
13655
13656
13657
13658
13659
13660
13661
13662
13663
13664
13665
13666
13667
13668
13669
13670
13671
13672
13673
13674
13675
13676
13677
13678
13679
13680
13681
13682
13683
13684
13685
13686
13687
13688
13689
13690
13691
13692
13693
13694
13695
13696
13697
13698
13699
13700
13701
13702
13703
13704
13705
13706
13707
13708
13709
13710
13711
13712
13713
13714
13715
13716
13717
13718
13719
13720
13721
13722
13723
13724
13725
13726
13727
13728
13729
13730
13731
13732
13733
13734
13735
13736
13737
13738
13739
13740
13741
13742
13743
13744
13745
13746
13747
13748
13749
13750
13751
13752
13753
13754
13755
13756
13757
13758
13759
13760
13761
13762
13763
13764
13765
13766
13767
13768
13769
13770
13771
13772
13773
13774
13775
13776
13777
13778
13779
13780
13781
13782
13783
13784
13785
13786
13787
13788
13789
13790
13791
13792
13793
13794
13795
13796
13797
13798
13799
13800
13801
13802
13803
13804
13805
13806
13807
13808
13809
13810
13811
13812
13813
13814
13815
13816
13817
13818
13819
13820
13821
13822
13823
13824
13825
13826
13827
13828
13829
13830
13831
13832
13833
13834
13835
13836
13837
13838
13839
13840
13841
13842
13843
13844
13845
13846
13847
13848
13849
13850
13851
13852
13853
13854
13855
13856
13857
13858
13859
13860
13861
13862
13863
13864
13865
13866
13867
13868
13869
13870
13871
13872
13873
13874
13875
13876
13877
13878
13879
13880
13881
13882
13883
13884
13885
13886
13887
13888
13889
13890
13891
13892
13893
13894
13895
13896
13897
13898
13899
13900
13901
13902
13903
13904
13905
13906
13907
13908
13909
13910
13911
13912
13913
13914
13915
13916
13917
13918
13919
13920
13921
13922
13923
13924
13925
13926
13927
13928
13929
13930
13931
13932
13933
13934
13935
13936
13937
13938
13939
13940
13941
13942
13943
13944
13945
13946
13947
13948
13949
13950
13951
13952
13953
13954
13955
13956
13957
13958
13959
13960
13961
13962
13963
13964
13965
13966
13967
13968
13969
13970
13971
13972
13973
13974
13975
13976
13977
13978
13979
13980
13981
13982
13983
13984
13985
13986
13987
13988
13989
13990
13991
13992
13993
13994
13995
13996
13997
13998
13999
14000
14001
14002
14003
14004
14005
14006
14007
14008
14009
14010
14011
14012
14013
14014
14015
14016
14017
14018
14019
14020
14021
14022
14023
14024
14025
14026
14027
14028
14029
14030
14031
14032
14033
14034
14035
14036
14037
14038
14039
14040
14041
14042
14043
14044
14045
14046
14047
14048
14049
14050
14051
14052
14053
14054
14055
14056
14057
14058
14059
14060
14061
14062
14063
14064
14065
14066
14067
14068
14069
14070
14071
14072
14073
14074
14075
14076
14077
14078
14079
14080
14081
14082
14083
14084
14085
14086
14087
14088
14089
14090
14091
14092
14093
14094
14095
14096
14097
14098
14099
14100
14101
14102
14103
14104
14105
14106
14107
14108
14109
14110
14111
14112
14113
14114
14115
14116
14117
14118
14119
14120
14121
14122
14123
14124
14125
14126
14127
14128
14129
14130
14131
14132
14133
14134
14135
14136
14137
14138
14139
14140
14141
14142
14143
14144
14145
14146
14147
14148
14149
14150
14151
14152
14153
14154
14155
14156
14157
14158
14159
14160
14161
14162
14163
14164
14165
14166
14167
14168
14169
14170
14171
14172
14173
14174
14175
14176
14177
14178
14179
14180
14181
14182
14183
14184
14185
14186
14187
14188
14189
14190
14191
14192
14193
14194
14195
14196
14197
14198
14199
14200
14201
14202
14203
14204
14205
14206
14207
14208
14209
14210
14211
14212
14213
14214
14215
14216
14217
14218
14219
14220
14221
14222
14223
14224
14225
14226
14227
14228
14229
14230
14231
14232
14233
14234
14235
14236
14237
14238
14239
14240
14241
14242
14243
14244
14245
14246
14247
14248
14249
14250
14251
14252
14253
14254
14255
14256
14257
14258
14259
14260
14261
14262
14263
14264
14265
14266
14267
14268
14269
14270
14271
14272
14273
14274
14275
14276
14277
14278
14279
14280
14281
14282
14283
14284
14285
14286
14287
14288
14289
14290
14291
14292
14293
14294
14295
14296
14297
14298
14299
14300
14301
14302
14303
14304
14305
14306
14307
14308
14309
14310
14311
14312
14313
14314
14315
14316
14317
14318
14319
14320
14321
14322
14323
14324
14325
14326
14327
14328
14329
14330
14331
14332
14333
14334
14335
14336
14337
14338
14339
14340
14341
14342
14343
14344
14345
14346
14347
14348
14349
14350
14351
14352
14353
14354
14355
14356
14357
14358
14359
14360
14361
14362
14363
14364
14365
14366
14367
14368
14369
14370
14371
14372
14373
14374
14375
14376
14377
14378
14379
14380
14381
14382
14383
14384
14385
14386
14387
14388
14389
14390
14391
14392
14393
14394
14395
14396
14397
14398
14399
14400
14401
14402
14403
14404
14405
14406
14407
14408
14409
14410
14411
14412
14413
14414
14415
14416
14417
14418
14419
14420
14421
14422
14423
14424
14425
14426
14427
14428
14429
14430
14431
14432
14433
14434
14435
14436
14437
14438
14439
14440
14441
14442
14443
14444
14445
14446
14447
14448
14449
14450
14451
14452
14453
14454
14455
14456
14457
14458
14459
14460
14461
14462
14463
14464
14465
14466
14467
14468
14469
14470
14471
14472
14473
14474
14475
14476
14477
14478
14479
14480
14481
14482
14483
14484
14485
14486
14487
14488
14489
14490
14491
14492
14493
14494
14495
14496
14497
14498
14499
14500
14501
14502
14503
14504
14505
14506
14507
14508
14509
14510
14511
14512
14513
14514
14515
14516
14517
14518
14519
14520
14521
14522
14523
14524
14525
14526
14527
14528
14529
14530
14531
14532
14533
14534
14535
14536
14537
14538
14539
14540
14541
14542
14543
14544
14545
14546
14547
14548
14549
14550
14551
14552
14553
14554
14555
14556
14557
14558
14559
14560
14561
14562
14563
14564
14565
14566
14567
14568
14569
14570
14571
14572
14573
14574
14575
14576
14577
14578
14579
14580
14581
14582
14583
14584
14585
14586
14587
14588
14589
14590
14591
14592
14593
14594
14595
14596
14597
14598
14599
14600
14601
14602
14603
14604
14605
14606
14607
14608
14609
14610
14611
14612
14613
14614
14615
14616
14617
14618
14619
14620
14621
14622
14623
14624
14625
14626
14627
14628
14629
14630
14631
14632
14633
14634
14635
14636
14637
14638
14639
14640
14641
14642
14643
14644
14645
14646
14647
14648
14649
14650
14651
14652
14653
14654
14655
14656
14657
14658
14659
14660
14661
14662
14663
14664
14665
14666
14667
14668
14669
14670
14671
14672
14673
14674
14675
14676
14677
14678
14679
14680
14681
14682
14683
14684
14685
14686
14687
14688
14689
14690
14691
14692
14693
14694
14695
14696
14697
14698
14699
14700
14701
14702
14703
14704
14705
14706
14707
14708
14709
14710
14711
14712
14713
14714
14715
14716
14717
14718
14719
14720
14721
14722
14723
14724
14725
14726
14727
14728
14729
14730
14731
14732
14733
14734
14735
14736
14737
14738
14739
14740
14741
14742
14743
14744
14745
14746
14747
14748
14749
14750
14751
14752
14753
14754
14755
14756
14757
14758
14759
14760
14761
14762
14763
14764
14765
14766
14767
14768
14769
14770
14771
14772
14773
14774
14775
14776
14777
14778
14779
14780
14781
14782
14783
14784
14785
14786
14787
14788
14789
14790
14791
14792
14793
14794
14795
14796
14797
14798
14799
14800
14801
14802
14803
14804
14805
14806
14807
14808
14809
14810
14811
14812
14813
14814
14815
14816
14817
14818
14819
14820
14821
14822
14823
14824
14825
14826
14827
14828
14829
14830
14831
14832
14833
14834
14835
14836
14837
14838
14839
14840
14841
14842
14843
14844
14845
14846
14847
14848
14849
14850
14851
14852
14853
14854
14855
14856
14857
14858
14859
14860
14861
14862
14863
14864
14865
14866
14867
14868
14869
14870
14871
14872
14873
14874
14875
14876
14877
14878
14879
14880
14881
14882
14883
14884
14885
14886
14887
14888
14889
14890
14891
14892
14893
14894
14895
14896
14897
14898
14899
14900
14901
14902
14903
14904
14905
14906
14907
14908
14909
14910
14911
14912
14913
14914
14915
14916
14917
14918
14919
14920
14921
14922
14923
14924
14925
14926
14927
14928
14929
14930
14931
14932
14933
14934
14935
14936
14937
14938
14939
14940
14941
14942
14943
14944
14945
14946
14947
14948
14949
14950
14951
14952
14953
14954
14955
14956
14957
14958
14959
14960
14961
14962
14963
14964
14965
14966
14967
14968
14969
14970
14971
14972
14973
14974
14975
14976
14977
14978
14979
14980
14981
14982
14983
14984
14985
14986
14987
14988
14989
14990
14991
14992
14993
14994
14995
14996
14997
14998
14999
15000
15001
15002
15003
15004
15005
15006
15007
15008
15009
15010
15011
15012
15013
15014
15015
15016
15017
15018
15019
15020
15021
15022
15023
15024
15025
15026
15027
15028
15029
15030
15031
15032
15033
15034
15035
15036
15037
15038
15039
15040
15041
15042
15043
15044
15045
15046
15047
15048
15049
15050
15051
15052
15053
15054
15055
15056
15057
15058
15059
15060
15061
15062
15063
15064
15065
15066
15067
15068
15069
15070
15071
15072
15073
15074
15075
15076
15077
15078
15079
15080
15081
15082
15083
15084
15085
15086
15087
15088
15089
15090
15091
15092
15093
15094
15095
15096
15097
15098
15099
15100
15101
15102
15103
15104
15105
15106
15107
15108
15109
15110
15111
15112
15113
15114
15115
15116
15117
15118
15119
15120
15121
15122
15123
15124
15125
15126
15127
15128
15129
15130
15131
15132
15133
15134
15135
15136
15137
15138
15139
15140
15141
15142
15143
15144
15145
15146
15147
15148
15149
15150
15151
15152
15153
15154
15155
15156
15157
15158
15159
15160
15161
15162
15163
15164
15165
15166
15167
15168
15169
15170
15171
15172
15173
15174
15175
15176
15177
15178
15179
15180
15181
15182
15183
15184
15185
15186
15187
15188
15189
15190
15191
15192
15193
15194
15195
15196
15197
15198
15199
15200
15201
15202
15203
15204
15205
15206
15207
15208
15209
15210
15211
15212
15213
15214
15215
15216
15217
15218
15219
15220
15221
15222
15223
15224
15225
15226
15227
15228
15229
15230
15231
15232
15233
15234
15235
15236
15237
15238
15239
15240
15241
15242
15243
15244
15245
15246
15247
15248
15249
15250
15251
15252
15253
15254
15255
15256
15257
15258
15259
15260
15261
15262
15263
15264
15265
15266
15267
15268
15269
15270
15271
15272
15273
15274
15275
15276
15277
15278
15279
15280
15281
15282
15283
15284
15285
15286
15287
15288
15289
15290
15291
15292
15293
15294
15295
15296
15297
15298
15299
15300
15301
15302
15303
15304
15305
15306
15307
15308
15309
15310
15311
15312
15313
15314
15315
15316
15317
15318
15319
15320
15321
15322
15323
15324
15325
15326
15327
15328
15329
15330
15331
15332
15333
15334
15335
15336
15337
15338
15339
15340
15341
15342
15343
15344
15345
15346
15347
15348
15349
15350
15351
15352
15353
15354
15355
15356
15357
15358
15359
15360
15361
15362
15363
15364
15365
15366
15367
15368
15369
15370
15371
15372
15373
15374
15375
15376
15377
15378
15379
15380
15381
15382
15383
15384
15385
15386
15387
15388
15389
15390
15391
15392
15393
15394
15395
15396
15397
15398
15399
15400
15401
15402
15403
15404
15405
15406
15407
15408
15409
15410
15411
15412
15413
15414
15415
15416
15417
15418
15419
15420
15421
15422
15423
15424
15425
15426
15427
15428
15429
15430
15431
15432
15433
15434
15435
15436
15437
15438
15439
15440
15441
15442
15443
15444
15445
15446
15447
15448
15449
15450
15451
15452
15453
15454
15455
15456
15457
15458
15459
15460
15461
15462
15463
15464
15465
15466
15467
15468
15469
15470
15471
15472
15473
15474
15475
15476
15477
15478
15479
15480
15481
15482
15483
15484
15485
15486
15487
15488
15489
15490
15491
15492
15493
15494
15495
15496
15497
15498
15499
15500
15501
15502
15503
15504
15505
15506
15507
15508
15509
15510
15511
15512
15513
15514
15515
15516
15517
15518
15519
15520
15521
15522
15523
15524
15525
15526
15527
15528
15529
15530
15531
15532
15533
15534
15535
15536
15537
15538
15539
15540
15541
15542
15543
15544
15545
15546
15547
15548
15549
15550
15551
15552
15553
15554
15555
15556
15557
15558
15559
15560
15561
15562
15563
15564
15565
15566
15567
15568
15569
15570
15571
15572
15573
15574
15575
15576
15577
15578
15579
15580
15581
15582
15583
15584
15585
15586
15587
15588
15589
15590
15591
15592
15593
15594
15595
15596
15597
15598
15599
15600
15601
15602
15603
15604
15605
15606
15607
15608
15609
15610
15611
15612
15613
15614
15615
15616
15617
15618
15619
15620
15621
15622
15623
15624
15625
15626
15627
15628
15629
15630
15631
15632
15633
15634
15635
15636
15637
15638
15639
15640
15641
15642
15643
15644
15645
15646
15647
15648
15649
15650
15651
15652
15653
15654
15655
15656
15657
15658
15659
15660
15661
15662
15663
15664
15665
15666
15667
15668
15669
15670
15671
15672
15673
15674
15675
15676
15677
15678
15679
15680
15681
15682
15683
15684
15685
15686
15687
15688
15689
15690
15691
15692
15693
15694
15695
15696
15697
15698
15699
15700
15701
15702
15703
15704
15705
15706
15707
15708
15709
15710
15711
15712
15713
15714
15715
15716
15717
15718
15719
15720
15721
15722
15723
15724
15725
15726
15727
15728
15729
15730
15731
15732
15733
15734
15735
15736
15737
15738
15739
15740
15741
15742
15743
15744
15745
15746
15747
15748
15749
15750
15751
15752
15753
15754
15755
15756
15757
15758
15759
15760
15761
15762
15763
15764
15765
15766
15767
15768
15769
15770
15771
15772
15773
15774
15775
15776
15777
15778
15779
15780
15781
15782
15783
15784
15785
15786
15787
15788
15789
15790
15791
15792
15793
15794
15795
15796
15797
15798
15799
15800
15801
15802
15803
15804
15805
15806
15807
15808
15809
15810
15811
15812
15813
15814
15815
15816
15817
15818
15819
15820
15821
15822
15823
15824
15825
15826
15827
15828
15829
15830
15831
15832
15833
15834
15835
15836
15837
15838
15839
15840
15841
15842
15843
15844
15845
15846
15847
15848
15849
15850
15851
15852
15853
15854
15855
15856
15857
15858
15859
15860
15861
15862
15863
15864
15865
15866
15867
15868
15869
15870
15871
15872
15873
15874
15875
15876
15877
15878
15879
15880
15881
15882
15883
15884
15885
15886
15887
15888
15889
15890
15891
15892
15893
15894
15895
15896
15897
15898
15899
15900
15901
15902
15903
15904
15905
15906
15907
15908
15909
15910
15911
15912
15913
15914
15915
15916
15917
15918
15919
15920
15921
15922
15923
15924
15925
15926
15927
15928
15929
15930
15931
15932
15933
15934
15935
15936
15937
15938
15939
15940
15941
15942
15943
15944
15945
15946
15947
15948
15949
15950
15951
15952
15953
15954
15955
15956
15957
15958
15959
15960
15961
15962
15963
15964
15965
15966
15967
15968
15969
15970
15971
15972
15973
15974
15975
15976
15977
15978
15979
15980
15981
15982
15983
15984
15985
15986
15987
15988
15989
15990
15991
15992
15993
15994
15995
15996
15997
15998
15999
16000
16001
16002
16003
16004
16005
16006
16007
16008
16009
16010
16011
16012
16013
16014
16015
16016
16017
16018
16019
16020
16021
16022
16023
16024
16025
16026
16027
16028
16029
16030
16031
16032
16033
16034
16035
16036
16037
16038
16039
16040
16041
16042
16043
16044
16045
16046
16047
16048
16049
16050
16051
16052
16053
16054
16055
16056
16057
16058
16059
16060
16061
16062
16063
16064
16065
16066
16067
16068
16069
16070
16071
16072
16073
16074
16075
16076
16077
16078
16079
16080
16081
16082
16083
16084
16085
16086
16087
16088
16089
16090
16091
16092
16093
16094
16095
16096
16097
16098
16099
16100
16101
16102
16103
16104
16105
16106
16107
16108
16109
16110
16111
16112
16113
16114
16115
16116
16117
16118
16119
16120
16121
16122
16123
16124
16125
16126
16127
16128
16129
16130
16131
16132
16133
16134
16135
16136
16137
16138
16139
16140
16141
16142
16143
16144
16145
16146
16147
16148
16149
16150
16151
16152
16153
16154
16155
16156
16157
16158
16159
16160
16161
16162
16163
16164
16165
16166
16167
16168
16169
16170
16171
16172
16173
16174
16175
16176
16177
16178
16179
16180
16181
16182
16183
16184
16185
16186
16187
16188
16189
16190
16191
16192
16193
16194
16195
16196
16197
16198
16199
16200
16201
16202
16203
16204
16205
16206
16207
16208
16209
16210
16211
16212
16213
16214
16215
16216
16217
16218
16219
16220
16221
16222
16223
16224
16225
16226
16227
16228
16229
16230
16231
16232
16233
16234
16235
16236
16237
16238
16239
16240
16241
16242
16243
16244
16245
16246
16247
16248
16249
16250
16251
16252
16253
16254
16255
16256
16257
16258
16259
16260
16261
16262
16263
16264
16265
16266
16267
16268
16269
16270
16271
16272
16273
16274
16275
16276
16277
16278
16279
16280
16281
16282
16283
16284
16285
16286
16287
16288
16289
16290
16291
16292
16293
16294
16295
16296
16297
16298
16299
16300
16301
16302
16303
16304
16305
16306
16307
16308
16309
16310
16311
16312
16313
16314
16315
16316
16317
16318
16319
16320
16321
16322
16323
16324
16325
16326
16327
16328
16329
16330
16331
16332
16333
16334
16335
16336
16337
16338
16339
16340
16341
16342
16343
16344
16345
16346
16347
16348
16349
16350
16351
16352
16353
16354
16355
16356
16357
16358
16359
16360
16361
16362
16363
16364
16365
16366
16367
16368
16369
16370
16371
16372
16373
16374
16375
16376
16377
16378
16379
16380
16381
16382
16383
16384
16385
16386
16387
16388
16389
16390
16391
16392
16393
16394
16395
16396
16397
16398
16399
16400
16401
16402
16403
16404
16405
16406
16407
16408
16409
16410
16411
16412
16413
16414
16415
16416
16417
16418
16419
16420
16421
16422
16423
16424
16425
16426
16427
16428
16429
16430
16431
16432
16433
16434
16435
16436
16437
16438
16439
16440
16441
16442
16443
16444
16445
16446
16447
16448
16449
16450
16451
16452
16453
16454
16455
16456
16457
16458
16459
16460
16461
16462
16463
16464
16465
16466
16467
16468
16469
16470
16471
16472
16473
16474
16475
16476
16477
16478
16479
16480
16481
16482
16483
16484
16485
16486
16487
16488
16489
16490
16491
16492
16493
16494
16495
16496
16497
16498
16499
16500
16501
16502
16503
16504
16505
16506
16507
16508
16509
16510
16511
16512
16513
16514
16515
16516
16517
16518
16519
16520
16521
16522
16523
16524
16525
16526
16527
16528
16529
16530
16531
16532
16533
16534
16535
16536
16537
16538
16539
16540
16541
16542
16543
16544
16545
16546
16547
16548
16549
16550
16551
16552
16553
16554
16555
16556
16557
16558
16559
16560
16561
16562
16563
16564
16565
16566
16567
16568
16569
16570
16571
16572
16573
16574
16575
16576
16577
16578
16579
16580
16581
16582
16583
16584
16585
16586
16587
16588
16589
16590
16591
16592
16593
16594
16595
16596
16597
16598
16599
16600
16601
16602
16603
16604
16605
16606
16607
16608
16609
16610
16611
16612
16613
16614
16615
16616
16617
16618
16619
16620
16621
16622
16623
16624
16625
16626
16627
16628
16629
16630
16631
16632
16633
16634
16635
16636
16637
16638
16639
16640
16641
16642
16643
16644
16645
16646
16647
16648
16649
16650
16651
16652
16653
16654
16655
16656
16657
16658
16659
16660
16661
16662
16663
16664
16665
16666
16667
16668
16669
16670
16671
16672
16673
16674
16675
16676
16677
16678
16679
16680
16681
16682
16683
16684
16685
16686
16687
16688
16689
16690
16691
16692
16693
16694
16695
16696
16697
16698
16699
16700
16701
16702
16703
16704
16705
16706
16707
16708
16709
16710
16711
16712
16713
16714
16715
16716
16717
16718
16719
16720
16721
16722
16723
16724
16725
16726
16727
16728
16729
16730
16731
16732
16733
16734
16735
16736
16737
16738
16739
16740
16741
16742
16743
16744
16745
16746
16747
16748
16749
16750
16751
16752
16753
16754
16755
16756
16757
16758
16759
16760
16761
16762
16763
16764
16765
16766
16767
16768
16769
16770
16771
16772
16773
16774
16775
16776
16777
16778
16779
16780
16781
16782
16783
16784
16785
16786
16787
16788
16789
16790
16791
16792
16793
16794
16795
16796
16797
16798
16799
16800
16801
16802
16803
16804
16805
16806
16807
16808
16809
16810
16811
16812
16813
16814
16815
16816
16817
16818
16819
16820
16821
16822
16823
16824
16825
16826
16827
16828
16829
16830
16831
16832
16833
16834
16835
16836
16837
16838
16839
16840
16841
16842
16843
16844
16845
16846
16847
16848
16849
16850
16851
16852
16853
16854
16855
16856
16857
16858
16859
16860
16861
16862
16863
16864
16865
16866
16867
16868
16869
16870
16871
16872
16873
16874
16875
16876
16877
16878
16879
16880
16881
16882
16883
16884
16885
16886
16887
16888
16889
16890
16891
16892
16893
16894
16895
16896
16897
16898
16899
16900
16901
16902
16903
16904
16905
16906
16907
16908
16909
16910
16911
16912
16913
16914
16915
16916
16917
16918
16919
16920
16921
16922
16923
16924
16925
16926
16927
16928
16929
16930
16931
16932
16933
16934
16935
16936
16937
16938
16939
16940
16941
16942
16943
16944
16945
16946
16947
16948
16949
16950
16951
16952
16953
16954
16955
16956
16957
16958
16959
16960
16961
16962
16963
16964
16965
16966
16967
16968
16969
16970
16971
16972
16973
16974
16975
16976
16977
16978
16979
16980
16981
16982
16983
16984
16985
16986
16987
16988
16989
16990
16991
16992
16993
16994
16995
16996
16997
16998
16999
17000
17001
17002
17003
17004
17005
17006
17007
17008
17009
17010
17011
17012
17013
17014
17015
17016
17017
17018
17019
17020
17021
17022
17023
17024
17025
17026
17027
17028
17029
17030
17031
17032
17033
17034
17035
17036
17037
17038
17039
17040
17041
17042
17043
17044
17045
17046
17047
17048
17049
17050
17051
17052
17053
17054
17055
17056
17057
17058
17059
17060
17061
17062
17063
17064
17065
17066
17067
17068
17069
17070
17071
17072
17073
17074
17075
17076
17077
17078
17079
17080
17081
17082
17083
17084
17085
17086
17087
17088
17089
17090
17091
17092
17093
17094
17095
17096
17097
17098
17099
17100
17101
17102
17103
17104
17105
17106
17107
17108
17109
17110
17111
17112
17113
17114
17115
17116
17117
17118
17119
17120
17121
17122
17123
17124
17125
17126
17127
17128
17129
17130
17131
17132
17133
17134
17135
17136
17137
17138
17139
17140
17141
17142
17143
17144
17145
17146
17147
17148
17149
17150
17151
17152
17153
17154
17155
17156
17157
17158
17159
17160
17161
17162
17163
17164
17165
17166
17167
17168
17169
17170
17171
17172
17173
17174
17175
17176
17177
17178
17179
17180
17181
17182
17183
17184
17185
17186
17187
17188
17189
17190
17191
17192
17193
17194
17195
17196
17197
17198
17199
17200
17201
17202
17203
17204
17205
17206
17207
17208
17209
17210
17211
17212
17213
17214
17215
17216
17217
17218
17219
17220
17221
17222
17223
17224
17225
17226
17227
17228
17229
17230
17231
17232
17233
17234
17235
17236
17237
17238
17239
17240
17241
17242
17243
17244
17245
17246
17247
17248
17249
17250
17251
17252
17253
17254
17255
17256
17257
17258
17259
17260
17261
17262
17263
17264
17265
17266
17267
17268
17269
17270
17271
17272
17273
17274
17275
17276
17277
17278
17279
17280
17281
17282
17283
17284
17285
17286
17287
17288
17289
17290
17291
17292
17293
17294
17295
17296
17297
17298
17299
17300
17301
17302
17303
17304
17305
17306
17307
17308
17309
17310
17311
17312
17313
17314
17315
17316
17317
17318
17319
17320
17321
17322
17323
17324
17325
17326
17327
17328
17329
17330
17331
17332
17333
17334
17335
17336
17337
17338
17339
17340
17341
17342
17343
17344
17345
17346
17347
17348
17349
17350
17351
17352
17353
17354
17355
17356
17357
17358
17359
17360
17361
17362
17363
17364
17365
17366
17367
17368
17369
17370
17371
17372
17373
17374
17375
17376
17377
17378
17379
17380
17381
17382
17383
17384
17385
17386
17387
17388
17389
17390
17391
17392
17393
17394
17395
17396
17397
17398
17399
17400
17401
17402
17403
17404
17405
17406
17407
17408
17409
17410
17411
17412
17413
17414
17415
17416
17417
17418
17419
17420
17421
17422
17423
17424
17425
17426
17427
17428
17429
17430
17431
17432
17433
17434
17435
17436
17437
17438
17439
17440
17441
17442
17443
17444
17445
17446
17447
17448
17449
17450
17451
17452
17453
17454
17455
17456
17457
17458
17459
17460
17461
17462
17463
17464
17465
17466
17467
17468
17469
17470
17471
17472
17473
17474
17475
17476
17477
17478
17479
17480
17481
17482
17483
17484
17485
17486
17487
17488
17489
17490
17491
17492
17493
17494
17495
17496
17497
17498
17499
17500
17501
17502
17503
17504
17505
17506
17507
17508
17509
17510
17511
17512
17513
17514
17515
17516
17517
17518
17519
17520
17521
17522
17523
17524
17525
17526
17527
17528
17529
17530
17531
17532
17533
17534
17535
17536
17537
17538
17539
17540
17541
17542
17543
17544
17545
17546
17547
17548
17549
17550
17551
17552
17553
17554
17555
17556
17557
17558
17559
17560
17561
17562
17563
17564
17565
17566
17567
17568
17569
17570
17571
17572
17573
17574
17575
17576
17577
17578
17579
17580
17581
17582
17583
17584
17585
17586
17587
17588
17589
17590
17591
17592
17593
17594
17595
17596
17597
17598
17599
17600
17601
17602
17603
17604
17605
17606
17607
17608
17609
17610
17611
17612
17613
17614
17615
17616
17617
17618
17619
17620
17621
17622
17623
17624
17625
17626
17627
17628
17629
17630
17631
17632
17633
17634
17635
17636
17637
17638
17639
17640
17641
17642
17643
17644
17645
17646
17647
17648
17649
17650
17651
17652
17653
17654
17655
17656
17657
17658
17659
17660
17661
17662
17663
17664
17665
17666
17667
17668
17669
17670
17671
17672
17673
17674
17675
17676
17677
17678
17679
17680
17681
17682
17683
17684
17685
17686
17687
17688
17689
17690
17691
17692
17693
17694
17695
17696
17697
17698
17699
17700
17701
17702
17703
17704
17705
17706
17707
17708
17709
17710
17711
17712
17713
17714
17715
17716
17717
17718
17719
17720
17721
17722
17723
17724
17725
17726
17727
17728
17729
17730
17731
17732
17733
17734
17735
17736
17737
17738
17739
17740
17741
17742
17743
17744
17745
17746
17747
17748
17749
17750
17751
17752
17753
17754
17755
17756
17757
17758
17759
17760
17761
17762
17763
17764
17765
17766
17767
17768
17769
17770
17771
17772
17773
17774
17775
17776
17777
17778
17779
17780
17781
17782
17783
17784
17785
17786
17787
17788
17789
17790
17791
17792
17793
17794
17795
17796
17797
17798
17799
17800
17801
17802
17803
17804
17805
17806
17807
17808
17809
17810
17811
17812
17813
17814
17815
17816
17817
17818
17819
17820
17821
17822
17823
17824
17825
17826
17827
17828
17829
17830
17831
17832
17833
17834
17835
17836
17837
17838
17839
17840
17841
17842
17843
17844
17845
17846
17847
17848
17849
17850
17851
17852
17853
17854
17855
17856
17857
17858
17859
17860
17861
17862
17863
17864
17865
17866
17867
17868
17869
17870
17871
17872
17873
17874
17875
17876
17877
17878
17879
17880
17881
17882
17883
17884
17885
17886
17887
17888
17889
17890
17891
17892
17893
17894
17895
17896
17897
17898
17899
17900
17901
17902
17903
17904
17905
17906
17907
17908
17909
17910
17911
17912
17913
17914
17915
17916
17917
17918
17919
17920
17921
17922
17923
17924
17925
17926
17927
17928
17929
17930
17931
17932
17933
17934
17935
17936
17937
17938
17939
17940
17941
17942
17943
17944
17945
17946
17947
17948
17949
17950
17951
17952
17953
17954
17955
17956
17957
17958
17959
17960
17961
17962
17963
17964
17965
17966
17967
17968
17969
17970
17971
17972
17973
17974
17975
17976
17977
17978
17979
17980
17981
17982
17983
17984
17985
17986
17987
17988
17989
17990
17991
17992
17993
17994
17995
17996
17997
17998
17999
18000
18001
18002
18003
18004
18005
18006
18007
18008
18009
18010
18011
18012
18013
18014
18015
18016
18017
18018
18019
18020
18021
18022
18023
18024
18025
18026
18027
18028
18029
18030
18031
18032
18033
18034
18035
18036
18037
18038
18039
18040
18041
18042
18043
18044
18045
18046
18047
18048
18049
18050
18051
18052
18053
18054
18055
18056
18057
18058
18059
18060
18061
18062
18063
18064
18065
18066
18067
18068
18069
18070
18071
18072
18073
18074
18075
18076
18077
18078
18079
18080
18081
18082
18083
18084
18085
18086
18087
18088
18089
18090
18091
18092
18093
18094
18095
18096
18097
18098
18099
18100
18101
18102
18103
18104
18105
18106
18107
18108
18109
18110
18111
18112
18113
18114
18115
18116
18117
18118
18119
18120
18121
18122
18123
18124
18125
18126
18127
18128
18129
18130
18131
18132
18133
18134
18135
18136
18137
18138
18139
18140
18141
18142
18143
18144
18145
18146
18147
18148
18149
18150
18151
18152
18153
18154
18155
18156
18157
18158
18159
18160
18161
18162
18163
18164
18165
18166
18167
18168
18169
18170
18171
18172
18173
18174
18175
18176
18177
18178
18179
18180
18181
18182
18183
18184
18185
18186
18187
18188
18189
18190
18191
18192
18193
18194
18195
18196
18197
18198
18199
18200
18201
18202
18203
18204
18205
18206
18207
18208
18209
18210
18211
18212
18213
18214
18215
18216
18217
18218
18219
18220
18221
18222
18223
18224
18225
18226
18227
18228
18229
18230
18231
18232
18233
18234
18235
18236
18237
18238
18239
18240
18241
18242
18243
18244
18245
18246
18247
18248
18249
18250
18251
18252
18253
18254
18255
18256
18257
18258
18259
18260
18261
18262
18263
18264
18265
18266
18267
18268
18269
18270
18271
18272
18273
18274
18275
18276
18277
18278
18279
18280
18281
18282
18283
18284
18285
18286
18287
18288
18289
18290
18291
18292
18293
18294
18295
18296
18297
18298
18299
18300
18301
18302
18303
18304
18305
18306
18307
18308
18309
18310
18311
18312
18313
18314
18315
18316
18317
18318
18319
18320
18321
18322
18323
18324
18325
18326
18327
18328
18329
18330
18331
18332
18333
18334
18335
18336
18337
18338
18339
18340
18341
18342
18343
18344
18345
18346
18347
18348
18349
18350
18351
18352
18353
18354
18355
18356
18357
18358
18359
18360
18361
18362
18363
18364
18365
18366
18367
18368
18369
18370
18371
18372
18373
18374
18375
18376
18377
18378
18379
18380
18381
18382
18383
18384
18385
18386
18387
18388
18389
18390
18391
18392
18393
18394
18395
18396
18397
18398
18399
18400
18401
18402
18403
18404
18405
18406
18407
18408
18409
18410
18411
18412
18413
18414
18415
18416
18417
18418
18419
18420
18421
18422
18423
18424
18425
18426
18427
18428
18429
18430
18431
18432
18433
18434
18435
18436
18437
18438
18439
18440
18441
18442
18443
18444
18445
18446
18447
18448
18449
18450
18451
18452
18453
18454
18455
18456
18457
18458
18459
18460
18461
18462
18463
18464
18465
18466
18467
18468
18469
18470
18471
18472
18473
18474
18475
18476
18477
18478
18479
18480
18481
18482
18483
18484
18485
18486
18487
18488
18489
18490
18491
18492
18493
18494
18495
18496
18497
18498
18499
18500
18501
18502
18503
18504
18505
18506
18507
18508
18509
18510
18511
18512
18513
18514
18515
18516
18517
18518
18519
18520
18521
18522
18523
18524
18525
18526
18527
18528
18529
18530
18531
18532
18533
18534
18535
18536
18537
18538
18539
18540
18541
18542
18543
18544
18545
18546
18547
18548
18549
18550
18551
18552
18553
18554
18555
18556
18557
18558
18559
18560
18561
18562
18563
18564
18565
18566
18567
18568
18569
18570
18571
18572
18573
18574
18575
18576
18577
18578
18579
18580
18581
18582
18583
18584
18585
18586
18587
18588
18589
18590
18591
18592
18593
18594
18595
18596
18597
18598
18599
18600
18601
18602
18603
18604
18605
18606
18607
18608
18609
18610
18611
18612
18613
18614
18615
18616
18617
18618
18619
18620
18621
18622
18623
18624
18625
18626
18627
18628
18629
18630
18631
18632
18633
18634
18635
18636
18637
18638
18639
18640
18641
18642
18643
18644
18645
18646
18647
18648
18649
18650
18651
18652
18653
18654
18655
18656
18657
18658
18659
18660
18661
18662
18663
18664
18665
18666
18667
18668
18669
18670
18671
18672
18673
18674
18675
18676
18677
18678
18679
18680
18681
18682
18683
18684
18685
18686
18687
18688
18689
18690
18691
18692
18693
18694
18695
18696
18697
18698
18699
18700
18701
18702
18703
18704
18705
18706
18707
18708
18709
18710
18711
18712
18713
18714
18715
18716
18717
18718
18719
18720
18721
18722
18723
18724
18725
18726
18727
18728
18729
18730
18731
18732
18733
18734
18735
18736
18737
18738
18739
18740
18741
18742
18743
18744
18745
18746
18747
18748
18749
18750
18751
18752
18753
18754
18755
18756
18757
18758
18759
18760
18761
18762
18763
18764
18765
18766
18767
18768
18769
18770
18771
18772
18773
18774
18775
18776
18777
18778
18779
18780
18781
18782
18783
18784
18785
18786
18787
18788
18789
18790
18791
18792
18793
18794
18795
18796
18797
18798
18799
18800
18801
18802
18803
18804
18805
18806
18807
18808
18809
18810
18811
18812
18813
18814
18815
18816
18817
18818
18819
18820
18821
18822
18823
18824
18825
18826
18827
18828
18829
18830
18831
18832
18833
18834
18835
18836
18837
18838
18839
18840
18841
18842
18843
18844
18845
18846
18847
18848
18849
18850
18851
18852
18853
18854
18855
18856
18857
18858
18859
18860
18861
18862
18863
18864
18865
18866
18867
18868
18869
18870
18871
18872
18873
18874
18875
18876
18877
18878
18879
18880
18881
18882
18883
18884
18885
18886
18887
18888
18889
18890
18891
18892
18893
18894
18895
18896
18897
18898
18899
18900
18901
18902
18903
18904
18905
18906
18907
18908
18909
18910
18911
18912
18913
18914
18915
18916
18917
18918
18919
18920
18921
18922
18923
18924
18925
18926
18927
18928
18929
18930
18931
18932
18933
18934
18935
18936
18937
18938
18939
18940
18941
18942
18943
18944
18945
18946
18947
18948
18949
18950
18951
18952
18953
18954
18955
18956
18957
18958
18959
18960
18961
18962
18963
18964
18965
18966
18967
18968
18969
18970
18971
18972
18973
18974
18975
18976
18977
18978
18979
18980
18981
18982
18983
18984
18985
18986
18987
18988
18989
18990
18991
18992
18993
18994
18995
18996
18997
18998
18999
19000
19001
19002
19003
19004
19005
19006
19007
19008
19009
19010
19011
19012
19013
19014
19015
19016
19017
19018
19019
19020
19021
19022
19023
19024
19025
19026
19027
19028
19029
19030
19031
19032
19033
19034
19035
19036
19037
19038
19039
19040
19041
19042
19043
19044
19045
19046
19047
19048
19049
19050
19051
19052
19053
19054
19055
19056
19057
19058
19059
19060
19061
19062
19063
19064
19065
19066
19067
19068
19069
19070
19071
19072
19073
19074
19075
19076
19077
19078
19079
19080
19081
19082
19083
19084
19085
19086
19087
19088
19089
19090
19091
19092
19093
19094
19095
19096
19097
19098
19099
19100
19101
19102
19103
19104
19105
19106
19107
19108
19109
19110
19111
19112
19113
19114
19115
19116
19117
19118
19119
19120
19121
19122
19123
19124
19125
19126
19127
19128
19129
19130
19131
19132
19133
19134
19135
19136
19137
19138
19139
19140
19141
19142
19143
19144
19145
19146
19147
19148
19149
19150
19151
19152
19153
19154
19155
19156
19157
19158
19159
19160
19161
19162
19163
19164
19165
19166
19167
19168
19169
19170
19171
19172
19173
19174
19175
19176
19177
19178
19179
19180
19181
19182
19183
19184
19185
19186
19187
19188
19189
19190
19191
19192
19193
19194
19195
19196
19197
19198
19199
19200
19201
19202
19203
19204
19205
19206
19207
19208
19209
19210
19211
19212
19213
19214
19215
19216
19217
19218
19219
19220
19221
19222
19223
19224
19225
19226
19227
19228
19229
19230
19231
19232
19233
19234
19235
19236
19237
19238
19239
19240
19241
19242
19243
19244
19245
19246
19247
19248
19249
19250
19251
19252
19253
19254
19255
19256
19257
19258
19259
19260
19261
19262
19263
19264
19265
19266
19267
19268
19269
19270
19271
19272
19273
19274
19275
19276
19277
19278
19279
19280
19281
19282
19283
19284
19285
19286
19287
19288
19289
19290
19291
19292
19293
19294
19295
19296
19297
19298
19299
19300
19301
19302
19303
19304
19305
19306
19307
19308
19309
19310
19311
19312
19313
19314
19315
19316
19317
19318
19319
19320
19321
19322
19323
19324
19325
19326
19327
19328
19329
19330
19331
19332
19333
19334
19335
19336
19337
19338
19339
19340
19341
19342
19343
19344
19345
19346
19347
19348
19349
19350
19351
19352
19353
19354
19355
19356
19357
19358
19359
19360
19361
19362
19363
19364
19365
19366
19367
19368
19369
19370
19371
19372
19373
19374
19375
19376
19377
19378
19379
19380
19381
19382
19383
19384
19385
19386
19387
19388
19389
19390
19391
19392
19393
19394
19395
19396
19397
19398
19399
19400
19401
19402
19403
19404
19405
19406
19407
19408
19409
19410
19411
19412
19413
19414
19415
19416
19417
19418
19419
19420
19421
19422
19423
19424
19425
19426
19427
19428
19429
19430
19431
19432
19433
19434
19435
19436
19437
19438
19439
19440
19441
19442
19443
19444
19445
19446
19447
19448
19449
19450
19451
19452
19453
19454
19455
19456
19457
19458
19459
19460
19461
19462
19463
19464
19465
19466
19467
19468
19469
19470
19471
19472
19473
19474
19475
19476
19477
19478
19479
19480
19481
19482
19483
19484
19485
19486
19487
19488
19489
19490
19491
19492
19493
19494
19495
19496
19497
19498
19499
19500
19501
19502
19503
19504
19505
19506
19507
19508
19509
19510
19511
19512
19513
19514
19515
19516
19517
19518
19519
19520
19521
19522
19523
19524
19525
19526
19527
19528
19529
19530
19531
19532
19533
19534
19535
19536
19537
19538
19539
19540
19541
19542
19543
19544
19545
19546
19547
19548
19549
19550
19551
19552
19553
19554
19555
19556
19557
19558
19559
19560
19561
19562
19563
19564
19565
19566
19567
19568
19569
19570
19571
19572
19573
19574
19575
19576
19577
19578
19579
19580
19581
19582
19583
19584
19585
19586
19587
19588
19589
19590
19591
19592
19593
19594
19595
19596
19597
19598
19599
19600
19601
19602
19603
19604
19605
19606
19607
19608
19609
19610
19611
19612
19613
19614
19615
19616
19617
19618
19619
19620
19621
19622
19623
19624
19625
19626
19627
19628
19629
19630
19631
19632
19633
19634
19635
19636
19637
19638
19639
19640
19641
19642
19643
19644
19645
19646
19647
19648
19649
19650
19651
19652
19653
19654
19655
19656
19657
19658
19659
19660
19661
19662
19663
19664
19665
19666
19667
19668
19669
19670
19671
19672
19673
19674
19675
19676
19677
19678
19679
19680
19681
19682
19683
19684
19685
19686
19687
19688
19689
19690
19691
19692
19693
19694
19695
19696
19697
19698
19699
19700
19701
19702
19703
19704
19705
19706
19707
19708
19709
19710
19711
19712
19713
19714
19715
19716
19717
19718
19719
19720
19721
19722
19723
19724
19725
19726
19727
19728
19729
19730
19731
19732
19733
19734
19735
19736
19737
19738
19739
19740
19741
19742
19743
19744
19745
19746
19747
19748
19749
19750
19751
19752
19753
19754
19755
19756
19757
19758
19759
19760
19761
19762
19763
19764
19765
19766
19767
19768
19769
19770
19771
19772
19773
19774
19775
19776
19777
19778
19779
19780
19781
19782
19783
19784
19785
19786
19787
19788
19789
19790
19791
19792
19793
19794
19795
19796
19797
19798
19799
19800
19801
19802
19803
19804
19805
19806
19807
19808
19809
19810
19811
19812
19813
19814
19815
19816
19817
19818
19819
19820
19821
19822
19823
19824
19825
19826
19827
19828
19829
19830
19831
19832
19833
19834
19835
19836
19837
19838
19839
19840
19841
19842
19843
19844
19845
19846
19847
19848
19849
19850
19851
19852
19853
19854
19855
19856
19857
19858
19859
19860
19861
19862
19863
19864
19865
19866
19867
19868
19869
19870
19871
19872
19873
19874
19875
19876
19877
19878
19879
19880
19881
19882
19883
19884
19885
19886
19887
19888
19889
19890
19891
19892
19893
19894
19895
19896
19897
19898
19899
19900
19901
19902
19903
19904
19905
19906
19907
19908
19909
19910
19911
19912
19913
19914
19915
19916
19917
19918
19919
19920
19921
19922
19923
19924
19925
19926
19927
19928
19929
19930
19931
19932
19933
19934
19935
19936
19937
19938
19939
19940
19941
19942
19943
19944
19945
19946
19947
19948
19949
19950
19951
19952
19953
19954
19955
19956
19957
19958
19959
19960
19961
19962
19963
19964
19965
19966
19967
19968
19969
19970
19971
19972
19973
19974
19975
19976
19977
19978
19979
19980
19981
19982
19983
19984
19985
19986
19987
19988
19989
19990
19991
19992
19993
19994
19995
19996
19997
19998
19999
20000
20001
20002
20003
20004
20005
20006
20007
20008
20009
20010
20011
20012
20013
20014
20015
20016
20017
20018
20019
20020
20021
20022
20023
20024
20025
20026
20027
20028
20029
20030
20031
20032
20033
20034
20035
20036
20037
20038
20039
20040
20041
20042
20043
20044
20045
20046
20047
20048
20049
20050
20051
20052
20053
20054
20055
20056
20057
20058
20059
20060
20061
20062
20063
20064
20065
20066
20067
20068
20069
20070
20071
20072
20073
20074
20075
20076
20077
20078
20079
20080
20081
20082
20083
20084
20085
20086
20087
20088
20089
20090
20091
20092
20093
20094
20095
20096
20097
20098
20099
20100
20101
20102
20103
20104
20105
20106
20107
20108
20109
20110
20111
20112
20113
20114
20115
20116
20117
20118
20119
20120
20121
20122
20123
20124
20125
20126
20127
20128
20129
20130
20131
20132
20133
20134
20135
20136
20137
20138
20139
20140
20141
20142
20143
20144
20145
20146
20147
20148
20149
20150
20151
20152
20153
20154
20155
20156
20157
20158
20159
20160
20161
20162
20163
20164
20165
20166
20167
20168
20169
20170
20171
20172
20173
20174
20175
20176
20177
20178
20179
20180
20181
20182
20183
20184
20185
20186
20187
20188
20189
20190
20191
20192
20193
20194
20195
20196
20197
20198
20199
20200
20201
20202
20203
20204
20205
20206
20207
20208
20209
20210
20211
20212
20213
20214
20215
20216
20217
20218
20219
20220
20221
20222
20223
20224
20225
20226
20227
20228
20229
20230
20231
20232
20233
20234
20235
20236
20237
20238
20239
20240
20241
20242
20243
20244
20245
20246
20247
20248
20249
20250
20251
20252
20253
20254
20255
20256
20257
20258
20259
20260
20261
20262
20263
20264
20265
20266
20267
20268
20269
20270
20271
20272
20273
20274
20275
20276
20277
20278
20279
20280
20281
20282
20283
20284
20285
20286
20287
20288
20289
20290
20291
20292
20293
20294
20295
20296
20297
20298
20299
20300
20301
20302
20303
20304
20305
20306
20307
20308
20309
20310
20311
20312
20313
20314
20315
20316
20317
20318
20319
20320
20321
20322
20323
20324
20325
20326
20327
20328
20329
20330
20331
20332
20333
20334
20335
20336
20337
20338
20339
20340
20341
20342
20343
20344
20345
20346
20347
20348
20349
20350
20351
20352
20353
20354
20355
20356
20357
20358
20359
20360
20361
20362
20363
20364
20365
20366
20367
20368
20369
20370
20371
20372
20373
20374
20375
20376
20377
20378
20379
20380
20381
20382
20383
20384
20385
20386
20387
20388
20389
20390
20391
20392
20393
20394
20395
20396
20397
20398
20399
20400
20401
20402
20403
20404
20405
20406
20407
20408
20409
20410
20411
20412
20413
20414
20415
20416
20417
20418
20419
20420
20421
20422
20423
20424
20425
20426
20427
20428
20429
20430
20431
20432
20433
20434
20435
20436
20437
20438
20439
20440
20441
20442
20443
20444
20445
20446
20447
20448
20449
20450
20451
20452
20453
20454
20455
20456
20457
20458
20459
20460
20461
20462
20463
20464
20465
20466
20467
20468
20469
20470
20471
20472
20473
20474
20475
20476
20477
20478
20479
20480
20481
20482
20483
20484
20485
20486
20487
20488
20489
20490
20491
20492
20493
20494
20495
20496
20497
20498
20499
20500
20501
20502
20503
20504
20505
20506
20507
20508
20509
20510
20511
20512
20513
20514
20515
20516
20517
20518
20519
20520
20521
20522
20523
20524
20525
20526
20527
20528
20529
20530
20531
20532
20533
20534
20535
20536
20537
20538
20539
20540
20541
20542
20543
20544
20545
20546
20547
20548
20549
20550
20551
20552
20553
20554
20555
20556
20557
20558
20559
20560
20561
20562
20563
20564
20565
20566
20567
20568
20569
20570
20571
20572
20573
20574
20575
20576
20577
20578
20579
20580
20581
20582
20583
20584
20585
20586
20587
20588
20589
20590
20591
20592
20593
20594
20595
20596
20597
20598
20599
20600
20601
20602
20603
20604
20605
20606
20607
20608
20609
20610
20611
20612
20613
20614
20615
20616
20617
20618
20619
20620
20621
20622
20623
20624
20625
20626
20627
20628
20629
20630
20631
20632
20633
20634
20635
20636
20637
20638
20639
20640
20641
20642
20643
20644
20645
20646
20647
20648
20649
20650
20651
20652
20653
20654
20655
20656
20657
20658
20659
20660
20661
20662
20663
20664
20665
20666
20667
20668
20669
20670
20671
20672
20673
20674
20675
20676
20677
20678
20679
20680
20681
20682
20683
20684
20685
20686
20687
20688
20689
20690
20691
20692
20693
20694
20695
20696
20697
20698
20699
20700
20701
20702
20703
20704
20705
20706
20707
20708
20709
20710
20711
20712
20713
20714
20715
20716
20717
20718
20719
20720
20721
20722
20723
20724
20725
20726
20727
20728
20729
20730
20731
20732
20733
20734
20735
20736
20737
20738
20739
20740
20741
20742
20743
20744
20745
20746
20747
20748
20749
20750
20751
20752
20753
20754
20755
20756
20757
20758
20759
20760
20761
20762
20763
20764
20765
20766
20767
20768
20769
20770
20771
20772
20773
20774
20775
20776
20777
20778
20779
20780
20781
20782
20783
20784
20785
20786
20787
20788
20789
20790
20791
20792
20793
20794
20795
20796
20797
20798
20799
20800
20801
20802
20803
20804
20805
20806
20807
20808
20809
20810
20811
20812
20813
20814
20815
20816
20817
20818
20819
20820
20821
20822
20823
20824
20825
20826
20827
20828
20829
20830
20831
20832
20833
20834
20835
20836
20837
20838
20839
20840
20841
20842
20843
20844
20845
20846
20847
20848
20849
20850
20851
20852
20853
20854
20855
20856
20857
20858
20859
20860
20861
20862
20863
20864
20865
20866
20867
20868
20869
20870
20871
20872
20873
20874
20875
20876
20877
20878
20879
20880
20881
20882
20883
20884
20885
20886
20887
20888
20889
20890
20891
20892
20893
20894
20895
20896
20897
20898
20899
20900
20901
20902
20903
20904
20905
20906
20907
20908
20909
20910
20911
20912
20913
20914
20915
20916
20917
20918
20919
20920
20921
20922
20923
20924
20925
20926
20927
20928
20929
20930
20931
20932
20933
20934
20935
20936
20937
20938
20939
20940
20941
20942
20943
20944
20945
20946
20947
20948
20949
20950
20951
20952
20953
20954
20955
20956
20957
20958
20959
20960
20961
20962
20963
20964
20965
20966
20967
20968
20969
20970
20971
20972
20973
20974
20975
20976
20977
20978
20979
20980
20981
20982
20983
20984
20985
20986
20987
20988
20989
20990
20991
20992
20993
20994
20995
20996
20997
20998
20999
21000
21001
21002
21003
21004
21005
21006
21007
21008
21009
21010
21011
21012
21013
21014
21015
21016
21017
21018
21019
21020
21021
21022
21023
21024
21025
21026
21027
21028
21029
21030
21031
21032
21033
21034
21035
21036
21037
21038
21039
21040
21041
21042
21043
21044
21045
21046
21047
21048
21049
21050
21051
21052
21053
21054
21055
21056
21057
21058
21059
21060
21061
21062
21063
21064
21065
21066
21067
21068
21069
21070
21071
21072
21073
21074
21075
21076
21077
21078
21079
21080
21081
21082
21083
21084
21085
21086
21087
21088
21089
21090
21091
21092
21093
21094
21095
21096
21097
21098
21099
21100
21101
21102
21103
21104
21105
21106
21107
21108
21109
21110
21111
21112
21113
21114
21115
21116
21117
21118
21119
21120
21121
21122
21123
21124
21125
21126
21127
21128
21129
21130
21131
21132
21133
21134
21135
21136
21137
21138
21139
21140
21141
21142
21143
21144
21145
21146
21147
21148
21149
21150
21151
21152
21153
21154
21155
21156
21157
21158
21159
21160
21161
21162
21163
21164
21165
21166
21167
21168
21169
21170
21171
21172
21173
21174
21175
21176
21177
21178
21179
21180
21181
21182
21183
21184
21185
21186
21187
21188
21189
21190
21191
21192
21193
21194
21195
21196
21197
21198
21199
21200
21201
21202
21203
21204
21205
21206
21207
21208
21209
21210
21211
21212
21213
21214
21215
21216
21217
21218
21219
21220
21221
21222
21223
21224
21225
21226
21227
21228
21229
21230
21231
21232
21233
21234
21235
21236
21237
21238
21239
21240
21241
21242
21243
21244
21245
21246
21247
21248
21249
21250
21251
21252
21253
21254
21255
21256
21257
21258
21259
21260
21261
21262
21263
21264
21265
21266
21267
21268
21269
21270
21271
21272
21273
21274
21275
21276
21277
21278
21279
21280
21281
21282
21283
21284
21285
21286
21287
21288
21289
21290
21291
21292
21293
21294
21295
21296
21297
21298
21299
21300
21301
21302
21303
21304
21305
21306
21307
21308
21309
21310
21311
21312
21313
21314
21315
21316
21317
21318
21319
21320
21321
21322
21323
21324
21325
21326
21327
21328
21329
21330
21331
21332
21333
21334
21335
21336
21337
21338
21339
21340
21341
21342
21343
21344
21345
21346
21347
21348
21349
21350
21351
21352
21353
21354
21355
21356
21357
21358
21359
21360
21361
21362
21363
21364
21365
21366
21367
21368
21369
21370
21371
21372
21373
21374
21375
21376
21377
21378
21379
21380
21381
21382
21383
21384
21385
21386
21387
21388
21389
21390
21391
21392
21393
21394
21395
21396
21397
21398
21399
21400
21401
21402
21403
21404
21405
21406
21407
21408
21409
21410
21411
21412
21413
21414
21415
21416
21417
21418
21419
21420
21421
21422
21423
21424
21425
21426
21427
21428
21429
21430
21431
21432
21433
21434
21435
21436
21437
21438
21439
21440
21441
21442
21443
21444
21445
21446
21447
21448
21449
21450
21451
21452
21453
21454
21455
21456
21457
21458
21459
21460
21461
21462
21463
21464
21465
21466
21467
21468
21469
21470
21471
21472
21473
21474
21475
21476
21477
21478
21479
21480
21481
21482
21483
21484
21485
21486
21487
21488
21489
21490
21491
21492
21493
21494
21495
21496
21497
21498
21499
21500
21501
21502
21503
21504
21505
21506
21507
21508
21509
21510
21511
21512
21513
21514
21515
21516
21517
21518
21519
21520
21521
21522
21523
21524
21525
21526
21527
21528
21529
21530
21531
21532
21533
21534
21535
21536
21537
21538
21539
21540
21541
21542
21543
21544
21545
21546
21547
21548
21549
21550
21551
21552
21553
21554
21555
21556
21557
21558
21559
21560
21561
21562
21563
21564
21565
21566
21567
21568
21569
21570
21571
21572
21573
21574
21575
21576
21577
21578
21579
21580
21581
21582
21583
21584
21585
21586
21587
21588
21589
21590
21591
21592
21593
21594
21595
21596
21597
21598
21599
21600
21601
21602
21603
21604
21605
21606
21607
21608
21609
21610
21611
21612
21613
21614
21615
21616
21617
21618
21619
21620
21621
21622
21623
21624
21625
21626
21627
21628
21629
21630
21631
21632
21633
21634
21635
21636
21637
21638
21639
21640
21641
21642
21643
21644
21645
21646
21647
21648
21649
21650
21651
21652
21653
21654
21655
21656
21657
21658
21659
21660
21661
21662
21663
21664
21665
21666
21667
21668
21669
21670
21671
21672
21673
21674
21675
21676
21677
21678
21679
21680
21681
21682
21683
21684
21685
21686
21687
21688
21689
21690
21691
21692
21693
21694
21695
21696
21697
21698
21699
21700
21701
21702
21703
21704
21705
21706
21707
21708
21709
21710
21711
21712
21713
21714
21715
21716
21717
21718
21719
21720
21721
21722
21723
21724
21725
21726
21727
21728
21729
21730
21731
21732
21733
21734
21735
21736
21737
21738
21739
21740
21741
21742
21743
21744
21745
21746
21747
21748
21749
21750
21751
21752
21753
21754
21755
21756
21757
21758
21759
21760
21761
21762
21763
21764
21765
21766
21767
21768
21769
21770
21771
21772
21773
21774
21775
21776
21777
21778
21779
21780
21781
21782
21783
21784
21785
21786
21787
21788
21789
21790
21791
21792
21793
21794
21795
21796
21797
21798
21799
21800
21801
21802
21803
21804
21805
21806
21807
21808
21809
21810
21811
21812
21813
21814
21815
21816
21817
21818
21819
21820
21821
21822
21823
21824
21825
21826
21827
21828
21829
21830
21831
21832
21833
21834
21835
21836
21837
21838
21839
21840
21841
21842
21843
21844
21845
21846
21847
21848
21849
21850
21851
21852
21853
21854
21855
21856
21857
21858
21859
21860
21861
21862
21863
21864
21865
21866
21867
21868
21869
21870
21871
21872
21873
21874
21875
21876
21877
21878
21879
21880
21881
21882
21883
21884
21885
21886
21887
21888
21889
21890
21891
21892
21893
21894
21895
21896
21897
21898
21899
21900
21901
21902
21903
21904
21905
21906
21907
21908
21909
21910
21911
21912
21913
21914
21915
21916
21917
21918
21919
21920
21921
21922
21923
21924
21925
21926
21927
21928
21929
21930
21931
21932
21933
21934
21935
21936
21937
21938
21939
21940
21941
21942
21943
21944
21945
21946
21947
21948
21949
21950
21951
21952
21953
21954
21955
21956
21957
21958
21959
21960
21961
21962
21963
21964
21965
21966
21967
21968
21969
21970
21971
21972
21973
21974
21975
21976
21977
21978
21979
21980
21981
21982
21983
21984
21985
21986
21987
21988
21989
21990
21991
21992
21993
21994
21995
21996
21997
21998
21999
22000
22001
22002
22003
22004
22005
22006
22007
22008
22009
22010
22011
22012
22013
22014
22015
22016
22017
22018
22019
22020
22021
22022
22023
22024
22025
22026
22027
22028
22029
22030
22031
22032
22033
22034
22035
22036
22037
22038
22039
22040
22041
22042
22043
22044
22045
22046
22047
22048
22049
22050
22051
22052
22053
22054
22055
22056
22057
22058
22059
22060
22061
22062
22063
22064
22065
22066
22067
22068
22069
22070
22071
22072
22073
22074
22075
22076
22077
22078
22079
22080
22081
22082
22083
22084
22085
22086
22087
22088
22089
22090
22091
22092
22093
22094
22095
22096
22097
22098
22099
22100
22101
22102
22103
22104
22105
22106
22107
22108
22109
22110
22111
22112
22113
22114
22115
22116
22117
22118
22119
22120
22121
22122
22123
22124
22125
22126
22127
22128
22129
22130
22131
22132
22133
22134
22135
22136
22137
22138
22139
22140
22141
22142
22143
22144
22145
22146
22147
22148
22149
22150
22151
22152
22153
22154
22155
22156
22157
22158
22159
22160
22161
22162
22163
22164
22165
22166
22167
22168
22169
22170
22171
22172
22173
22174
22175
22176
22177
22178
22179
22180
22181
22182
22183
22184
22185
22186
22187
22188
22189
22190
22191
22192
22193
22194
22195
22196
22197
22198
22199
22200
22201
22202
22203
22204
22205
22206
22207
22208
22209
22210
22211
22212
22213
22214
22215
22216
22217
22218
22219
22220
22221
22222
22223
22224
22225
22226
22227
22228
22229
22230
22231
22232
22233
22234
22235
22236
22237
22238
22239
22240
22241
22242
22243
22244
22245
22246
22247
22248
22249
22250
22251
22252
22253
22254
22255
22256
22257
22258
22259
22260
22261
22262
22263
22264
22265
22266
22267
22268
22269
22270
22271
22272
22273
22274
22275
22276
22277
22278
22279
22280
22281
22282
22283
22284
22285
22286
22287
22288
22289
22290
22291
22292
22293
22294
22295
22296
22297
22298
22299
22300
22301
22302
22303
22304
22305
22306
22307
22308
22309
22310
22311
22312
22313
22314
22315
22316
22317
22318
22319
22320
22321
22322
22323
22324
22325
22326
22327
22328
22329
22330
22331
22332
22333
22334
22335
22336
22337
22338
22339
22340
22341
22342
22343
22344
22345
22346
22347
22348
22349
22350
22351
22352
22353
22354
22355
22356
22357
22358
22359
22360
22361
22362
22363
22364
22365
22366
22367
22368
22369
22370
22371
22372
22373
22374
22375
22376
22377
22378
22379
22380
22381
22382
22383
22384
22385
22386
22387
22388
22389
22390
22391
22392
22393
22394
22395
22396
22397
22398
22399
22400
22401
22402
22403
22404
22405
22406
22407
22408
22409
22410
22411
22412
22413
22414
22415
22416
22417
22418
22419
22420
22421
22422
22423
22424
22425
22426
22427
22428
22429
22430
22431
22432
22433
22434
22435
22436
22437
22438
22439
22440
22441
22442
22443
22444
22445
22446
22447
22448
22449
22450
22451
22452
22453
22454
22455
22456
22457
22458
22459
22460
22461
22462
22463
22464
22465
22466
22467
22468
22469
22470
22471
22472
22473
22474
22475
22476
22477
22478
22479
22480
22481
22482
22483
22484
22485
22486
22487
22488
22489
22490
22491
22492
22493
22494
22495
22496
22497
22498
22499
22500
22501
22502
22503
22504
22505
22506
22507
22508
22509
22510
22511
22512
22513
22514
22515
22516
22517
22518
22519
22520
22521
22522
22523
22524
22525
22526
22527
22528
22529
22530
22531
22532
22533
22534
22535
22536
22537
22538
22539
22540
22541
22542
22543
22544
22545
22546
22547
22548
22549
22550
22551
22552
22553
22554
22555
22556
22557
22558
22559
22560
22561
22562
22563
22564
22565
22566
22567
22568
22569
22570
22571
22572
22573
22574
22575
22576
22577
22578
22579
22580
22581
22582
22583
22584
22585
22586
22587
22588
22589
22590
22591
22592
22593
22594
22595
22596
22597
22598
22599
22600
22601
22602
22603
22604
22605
22606
22607
22608
22609
22610
22611
22612
22613
22614
22615
22616
22617
22618
22619
22620
22621
22622
22623
22624
22625
22626
22627
22628
22629
22630
22631
22632
22633
22634
22635
22636
22637
22638
22639
22640
22641
22642
22643
22644
22645
22646
22647
22648
22649
22650
22651
22652
22653
22654
22655
22656
22657
22658
22659
22660
22661
22662
22663
22664
22665
22666
22667
22668
22669
22670
22671
22672
22673
22674
22675
22676
22677
22678
22679
22680
22681
22682
22683
22684
22685
22686
22687
22688
22689
22690
22691
22692
22693
22694
22695
22696
22697
22698
22699
22700
22701
22702
22703
22704
22705
22706
22707
22708
22709
22710
22711
22712
22713
22714
22715
22716
22717
22718
22719
22720
22721
22722
22723
22724
22725
22726
22727
22728
22729
22730
22731
22732
22733
22734
22735
22736
22737
22738
22739
22740
22741
22742
22743
22744
22745
22746
22747
22748
22749
22750
22751
22752
22753
22754
22755
22756
22757
22758
22759
22760
22761
22762
22763
22764
22765
22766
22767
22768
22769
22770
22771
22772
22773
22774
22775
22776
22777
22778
22779
22780
22781
22782
22783
22784
22785
22786
22787
22788
22789
22790
22791
22792
22793
22794
22795
22796
22797
22798
22799
22800
22801
22802
22803
22804
22805
22806
22807
22808
22809
22810
22811
22812
22813
22814
22815
22816
22817
22818
22819
22820
22821
22822
22823
22824
22825
22826
22827
22828
22829
22830
22831
22832
22833
22834
22835
22836
22837
22838
22839
22840
22841
22842
22843
22844
22845
22846
22847
22848
22849
22850
22851
22852
22853
22854
22855
22856
22857
22858
22859
22860
22861
22862
22863
22864
22865
22866
22867
22868
22869
22870
22871
22872
22873
22874
22875
22876
22877
22878
22879
22880
22881
22882
22883
22884
22885
22886
22887
22888
22889
22890
22891
22892
22893
22894
22895
22896
22897
22898
22899
22900
22901
22902
22903
22904
22905
22906
22907
22908
22909
22910
22911
22912
22913
22914
22915
22916
22917
22918
22919
22920
22921
22922
22923
22924
22925
22926
22927
22928
22929
22930
22931
22932
22933
22934
22935
22936
22937
22938
22939
22940
22941
22942
22943
22944
22945
22946
22947
22948
22949
22950
22951
22952
22953
22954
22955
22956
22957
22958
22959
22960
22961
22962
22963
22964
22965
22966
22967
22968
22969
22970
22971
22972
22973
22974
22975
22976
22977
22978
22979
22980
22981
22982
22983
22984
22985
22986
22987
22988
22989
22990
22991
22992
22993
22994
22995
22996
22997
22998
22999
23000
23001
23002
23003
23004
23005
23006
23007
23008
23009
23010
23011
23012
23013
23014
23015
23016
23017
23018
23019
23020
23021
23022
23023
23024
23025
23026
23027
23028
23029
23030
23031
23032
23033
23034
23035
23036
23037
23038
23039
23040
23041
23042
23043
23044
23045
23046
23047
23048
23049
23050
23051
23052
23053
23054
23055
23056
23057
23058
23059
23060
23061
23062
23063
23064
23065
23066
23067
23068
23069
23070
23071
23072
23073
23074
23075
23076
23077
23078
23079
23080
23081
23082
23083
23084
23085
23086
23087
23088
23089
23090
23091
23092
23093
23094
23095
23096
23097
23098
23099
23100
23101
23102
23103
23104
23105
23106
23107
23108
23109
23110
23111
23112
23113
23114
23115
23116
23117
23118
23119
23120
23121
23122
23123
23124
23125
23126
23127
23128
23129
23130
23131
23132
23133
23134
23135
23136
23137
23138
23139
23140
23141
23142
23143
23144
23145
23146
23147
23148
23149
23150
23151
23152
23153
23154
23155
23156
23157
23158
23159
23160
23161
23162
23163
23164
23165
23166
23167
23168
23169
23170
23171
23172
23173
23174
23175
23176
23177
23178
23179
23180
23181
23182
23183
23184
23185
23186
23187
23188
23189
23190
23191
23192
23193
23194
23195
23196
23197
23198
23199
23200
23201
23202
23203
23204
23205
23206
23207
23208
23209
23210
23211
23212
23213
23214
23215
23216
23217
23218
23219
23220
23221
23222
23223
23224
23225
23226
23227
23228
23229
23230
23231
23232
23233
23234
23235
23236
23237
23238
23239
23240
23241
23242
23243
23244
23245
23246
23247
23248
23249
23250
23251
23252
23253
23254
23255
23256
23257
23258
23259
23260
23261
23262
23263
23264
23265
23266
23267
23268
23269
23270
23271
23272
23273
23274
23275
23276
23277
23278
23279
23280
23281
23282
23283
23284
23285
23286
23287
23288
23289
23290
23291
23292
23293
23294
23295
23296
23297
23298
23299
23300
23301
23302
23303
23304
23305
23306
23307
23308
23309
23310
23311
23312
23313
23314
23315
23316
23317
23318
23319
23320
23321
23322
23323
23324
23325
23326
23327
23328
23329
23330
23331
23332
23333
23334
23335
23336
23337
23338
23339
23340
23341
23342
23343
23344
23345
23346
23347
23348
23349
23350
23351
23352
23353
23354
23355
23356
23357
23358
23359
23360
23361
23362
23363
23364
23365
23366
23367
23368
23369
23370
23371
23372
23373
23374
23375
23376
23377
23378
23379
23380
23381
23382
23383
23384
23385
23386
23387
23388
23389
23390
23391
23392
23393
23394
23395
23396
23397
23398
23399
23400
23401
23402
23403
23404
23405
23406
23407
23408
23409
23410
23411
23412
23413
23414
23415
23416
23417
23418
23419
23420
23421
23422
23423
23424
23425
23426
23427
23428
23429
23430
23431
23432
23433
23434
23435
23436
23437
23438
23439
23440
23441
23442
23443
23444
23445
23446
23447
23448
23449
23450
23451
23452
23453
23454
23455
23456
23457
23458
23459
23460
23461
23462
23463
23464
23465
23466
23467
23468
23469
23470
23471
23472
23473
23474
23475
23476
23477
23478
23479
23480
23481
23482
23483
23484
23485
23486
23487
23488
23489
23490
23491
23492
23493
23494
23495
23496
23497
23498
23499
23500
23501
23502
23503
23504
23505
23506
23507
23508
23509
23510
23511
23512
23513
23514
23515
23516
23517
23518
23519
23520
23521
23522
23523
23524
23525
23526
23527
23528
23529
23530
23531
23532
23533
23534
23535
23536
23537
23538
23539
23540
23541
23542
23543
23544
23545
23546
23547
23548
23549
23550
23551
23552
23553
23554
23555
23556
23557
23558
23559
23560
23561
23562
23563
23564
23565
23566
23567
23568
23569
23570
23571
23572
23573
23574
23575
23576
23577
23578
23579
23580
23581
23582
23583
23584
23585
23586
23587
23588
23589
23590
23591
23592
23593
23594
23595
23596
23597
23598
23599
23600
23601
23602
23603
23604
23605
23606
23607
23608
23609
23610
23611
23612
23613
23614
23615
23616
23617
23618
23619
23620
23621
23622
23623
23624
23625
23626
23627
23628
23629
23630
23631
23632
23633
23634
23635
23636
23637
23638
23639
23640
23641
23642
23643
23644
23645
23646
23647
23648
23649
23650
23651
23652
23653
23654
23655
23656
23657
23658
23659
23660
23661
23662
23663
23664
23665
23666
23667
23668
23669
23670
23671
23672
23673
23674
23675
23676
23677
23678
23679
23680
23681
23682
23683
23684
23685
23686
23687
23688
23689
23690
23691
23692
23693
23694
23695
23696
23697
23698
23699
23700
23701
23702
23703
23704
23705
23706
23707
23708
23709
23710
23711
23712
23713
23714
23715
23716
23717
23718
23719
23720
23721
23722
23723
23724
23725
23726
23727
23728
23729
23730
23731
23732
23733
23734
23735
23736
23737
23738
23739
23740
23741
23742
23743
23744
23745
23746
23747
23748
23749
23750
23751
23752
23753
23754
23755
23756
23757
23758
23759
23760
23761
23762
23763
23764
23765
23766
23767
23768
23769
23770
23771
23772
23773
23774
23775
23776
23777
23778
23779
23780
23781
23782
23783
23784
23785
23786
23787
23788
23789
23790
23791
23792
23793
23794
23795
23796
23797
23798
23799
23800
23801
23802
23803
23804
23805
23806
23807
23808
23809
23810
23811
23812
23813
23814
23815
23816
23817
23818
23819
23820
23821
23822
23823
23824
23825
23826
23827
23828
23829
23830
23831
23832
23833
23834
23835
23836
23837
23838
23839
23840
23841
23842
23843
23844
23845
23846
23847
23848
23849
23850
23851
23852
23853
23854
23855
23856
23857
23858
23859
23860
23861
23862
23863
23864
23865
23866
23867
23868
23869
23870
23871
23872
23873
23874
23875
23876
23877
23878
23879
23880
23881
23882
23883
23884
23885
23886
23887
23888
23889
23890
23891
23892
23893
23894
23895
23896
23897
23898
23899
23900
23901
23902
23903
23904
23905
23906
23907
23908
23909
23910
23911
23912
23913
23914
23915
23916
23917
23918
23919
23920
23921
23922
23923
23924
23925
23926
23927
23928
23929
23930
23931
23932
23933
23934
23935
23936
23937
23938
23939
23940
23941
23942
23943
23944
23945
23946
23947
23948
23949
23950
23951
23952
23953
23954
23955
23956
23957
23958
23959
23960
23961
23962
23963
23964
23965
23966
23967
23968
23969
23970
23971
23972
23973
23974
23975
23976
23977
23978
23979
23980
23981
23982
23983
23984
23985
23986
23987
23988
23989
23990
23991
23992
23993
23994
23995
23996
23997
23998
23999
24000
24001
24002
24003
24004
24005
24006
24007
24008
24009
24010
24011
24012
24013
24014
24015
24016
24017
24018
24019
24020
24021
24022
24023
24024
24025
24026
24027
24028
24029
24030
24031
24032
24033
24034
24035
24036
24037
24038
24039
24040
24041
24042
24043
24044
24045
24046
24047
24048
24049
24050
24051
24052
24053
24054
24055
24056
24057
24058
24059
24060
24061
24062
24063
24064
24065
24066
24067
24068
24069
24070
24071
24072
24073
24074
24075
24076
24077
24078
24079
24080
24081
24082
24083
24084
24085
24086
24087
24088
24089
24090
24091
24092
24093
24094
24095
24096
24097
24098
24099
24100
24101
24102
24103
24104
24105
24106
24107
24108
24109
24110
24111
24112
24113
24114
24115
24116
24117
24118
24119
24120
24121
24122
24123
24124
24125
24126
24127
24128
24129
24130
24131
24132
24133
24134
24135
24136
24137
24138
24139
24140
24141
24142
24143
24144
24145
24146
24147
24148
24149
24150
24151
24152
24153
24154
24155
24156
24157
24158
24159
24160
24161
24162
24163
24164
24165
24166
24167
24168
24169
24170
24171
24172
24173
24174
24175
24176
24177
24178
24179
24180
24181
24182
24183
24184
24185
24186
24187
24188
24189
24190
24191
24192
24193
24194
24195
24196
24197
24198
24199
24200
24201
24202
24203
24204
24205
24206
24207
24208
24209
24210
24211
24212
24213
24214
24215
24216
24217
24218
24219
24220
24221
24222
24223
24224
24225
24226
24227
24228
24229
24230
24231
24232
24233
24234
24235
24236
24237
24238
24239
24240
24241
24242
24243
24244
24245
24246
24247
24248
24249
24250
24251
24252
24253
24254
24255
24256
24257
24258
24259
24260
24261
24262
24263
24264
24265
24266
24267
24268
24269
24270
24271
24272
24273
24274
24275
24276
24277
24278
24279
24280
24281
24282
24283
24284
24285
24286
24287
24288
24289
24290
24291
24292
24293
24294
24295
24296
24297
24298
24299
24300
24301
24302
24303
24304
24305
24306
24307
24308
24309
24310
24311
24312
24313
24314
24315
24316
24317
24318
24319
24320
24321
24322
24323
24324
24325
24326
24327
24328
24329
24330
24331
24332
24333
24334
24335
24336
24337
24338
24339
24340
24341
24342
24343
24344
24345
24346
24347
24348
24349
24350
24351
24352
24353
24354
24355
24356
24357
24358
24359
24360
24361
24362
24363
24364
24365
24366
24367
24368
24369
24370
24371
24372
24373
24374
24375
24376
24377
24378
24379
24380
24381
24382
24383
24384
24385
24386
24387
24388
24389
24390
24391
24392
24393
24394
24395
24396
24397
24398
24399
24400
24401
24402
24403
24404
24405
24406
24407
24408
24409
24410
24411
24412
24413
24414
24415
24416
24417
24418
24419
24420
24421
24422
24423
24424
24425
24426
24427
24428
24429
24430
24431
24432
24433
24434
24435
24436
24437
24438
24439
24440
24441
24442
24443
24444
24445
24446
24447
24448
24449
24450
24451
24452
24453
24454
24455
24456
24457
24458
24459
24460
24461
24462
24463
24464
24465
24466
24467
24468
24469
24470
24471
24472
24473
24474
24475
24476
24477
24478
24479
24480
24481
24482
24483
24484
24485
24486
24487
24488
24489
24490
24491
24492
24493
24494
24495
24496
24497
24498
24499
24500
24501
24502
24503
24504
24505
24506
24507
24508
24509
24510
24511
24512
24513
24514
24515
24516
24517
24518
24519
24520
24521
24522
24523
24524
24525
24526
24527
24528
24529
24530
24531
24532
24533
24534
24535
24536
24537
24538
24539
24540
24541
24542
24543
24544
24545
24546
24547
24548
24549
24550
24551
24552
24553
24554
24555
24556
24557
24558
24559
24560
24561
24562
24563
24564
24565
24566
24567
24568
24569
24570
24571
24572
24573
24574
24575
24576
24577
24578
24579
24580
24581
24582
24583
24584
24585
24586
24587
24588
24589
24590
24591
24592
24593
24594
24595
24596
24597
24598
24599
24600
24601
24602
24603
24604
24605
24606
24607
24608
24609
24610
24611
24612
24613
24614
24615
24616
24617
24618
24619
24620
24621
24622
24623
24624
24625
24626
24627
24628
24629
24630
24631
24632
24633
24634
24635
24636
24637
24638
24639
24640
24641
24642
24643
24644
24645
24646
24647
24648
24649
24650
24651
24652
24653
24654
24655
24656
24657
24658
24659
24660
24661
24662
24663
24664
24665
24666
24667
24668
24669
24670
24671
24672
24673
24674
24675
24676
24677
24678
24679
24680
24681
24682
24683
24684
24685
24686
24687
24688
24689
24690
24691
24692
24693
24694
24695
24696
24697
24698
24699
24700
24701
24702
24703
24704
24705
24706
24707
24708
24709
24710
24711
24712
24713
24714
24715
24716
24717
24718
24719
24720
24721
24722
24723
24724
24725
24726
24727
24728
24729
24730
24731
24732
24733
24734
24735
24736
24737
24738
24739
24740
24741
24742
24743
24744
24745
24746
24747
24748
24749
24750
24751
24752
24753
24754
24755
24756
24757
24758
24759
24760
24761
24762
24763
24764
24765
24766
24767
24768
24769
24770
24771
24772
24773
24774
24775
24776
24777
24778
24779
24780
24781
24782
24783
24784
24785
24786
24787
24788
24789
24790
24791
24792
24793
24794
24795
24796
24797
24798
24799
24800
24801
24802
24803
24804
24805
24806
24807
24808
24809
24810
24811
24812
24813
24814
24815
24816
24817
24818
24819
24820
24821
24822
24823
24824
24825
24826
24827
24828
24829
24830
24831
24832
24833
24834
24835
24836
24837
24838
24839
24840
24841
24842
24843
24844
24845
24846
24847
24848
24849
24850
24851
24852
24853
24854
24855
24856
24857
24858
24859
24860
24861
24862
24863
24864
24865
24866
24867
24868
24869
24870
24871
24872
24873
24874
24875
24876
24877
24878
24879
24880
24881
24882
24883
24884
24885
24886
24887
24888
24889
24890
24891
24892
24893
24894
24895
24896
24897
24898
24899
24900
24901
24902
24903
24904
24905
24906
24907
24908
24909
24910
24911
24912
24913
24914
24915
24916
24917
24918
24919
24920
24921
24922
24923
24924
24925
24926
24927
24928
24929
24930
24931
24932
24933
24934
24935
24936
24937
24938
24939
24940
24941
24942
24943
24944
24945
24946
24947
24948
24949
24950
24951
24952
24953
24954
24955
24956
24957
24958
24959
24960
24961
24962
24963
24964
24965
24966
24967
24968
24969
24970
24971
24972
24973
24974
24975
24976
24977
24978
24979
24980
24981
24982
24983
24984
24985
24986
24987
24988
24989
24990
24991
24992
24993
24994
24995
24996
24997
24998
24999
25000
25001
25002
25003
25004
25005
25006
25007
25008
25009
25010
25011
25012
25013
25014
25015
25016
25017
25018
25019
25020
25021
25022
25023
25024
25025
25026
25027
25028
25029
25030
25031
25032
25033
25034
25035
25036
25037
25038
25039
25040
25041
25042
25043
25044
25045
25046
25047
25048
25049
25050
25051
25052
25053
25054
25055
25056
25057
25058
25059
25060
25061
25062
25063
25064
25065
25066
25067
25068
25069
25070
25071
25072
25073
25074
25075
25076
25077
25078
25079
25080
25081
25082
25083
25084
25085
25086
25087
25088
25089
25090
25091
25092
25093
25094
25095
25096
25097
25098
25099
25100
25101
25102
25103
25104
25105
25106
25107
25108
25109
25110
25111
25112
25113
25114
25115
25116
25117
25118
25119
25120
25121
25122
25123
25124
25125
25126
25127
25128
25129
25130
25131
25132
25133
25134
25135
25136
25137
25138
25139
25140
25141
25142
25143
25144
25145
25146
25147
25148
25149
25150
25151
25152
25153
25154
25155
25156
25157
25158
25159
25160
25161
25162
25163
25164
25165
25166
25167
25168
25169
25170
25171
25172
25173
25174
25175
25176
25177
25178
25179
25180
25181
25182
25183
25184
25185
25186
25187
25188
25189
25190
25191
25192
25193
25194
25195
25196
25197
25198
25199
25200
25201
25202
25203
25204
25205
25206
25207
25208
25209
25210
25211
25212
25213
25214
25215
25216
25217
25218
25219
25220
25221
25222
25223
25224
25225
25226
25227
25228
25229
25230
25231
25232
25233
25234
25235
25236
25237
25238
25239
25240
25241
25242
25243
25244
25245
25246
25247
25248
25249
25250
25251
25252
25253
25254
25255
25256
25257
25258
25259
25260
25261
25262
25263
25264
25265
25266
25267
25268
25269
25270
25271
25272
25273
25274
25275
25276
25277
25278
25279
25280
25281
25282
25283
25284
25285
25286
25287
25288
25289
25290
25291
25292
25293
25294
25295
25296
25297
25298
25299
25300
25301
25302
25303
25304
25305
25306
25307
25308
25309
25310
25311
25312
25313
25314
25315
25316
25317
25318
25319
25320
25321
25322
25323
25324
25325
25326
25327
25328
25329
25330
25331
25332
25333
25334
25335
25336
25337
25338
25339
25340
25341
25342
25343
25344
25345
25346
25347
25348
25349
25350
25351
25352
25353
25354
25355
25356
25357
25358
25359
25360
25361
25362
25363
25364
25365
25366
25367
25368
25369
25370
25371
25372
25373
25374
25375
25376
25377
25378
25379
25380
25381
25382
25383
25384
25385
25386
25387
25388
25389
25390
25391
25392
25393
25394
25395
25396
25397
25398
25399
25400
25401
25402
25403
25404
25405
25406
25407
25408
25409
25410
25411
25412
25413
25414
25415
25416
25417
25418
25419
25420
25421
25422
25423
25424
25425
25426
25427
25428
25429
25430
25431
25432
25433
25434
25435
25436
25437
25438
25439
25440
25441
25442
25443
25444
25445
25446
25447
25448
25449
25450
25451
25452
25453
25454
25455
25456
25457
25458
25459
25460
25461
25462
25463
25464
25465
25466
25467
25468
25469
25470
25471
25472
25473
25474
25475
25476
25477
25478
25479
25480
25481
25482
25483
25484
25485
25486
25487
25488
25489
25490
25491
25492
25493
25494
25495
25496
25497
25498
25499
25500
25501
25502
25503
25504
25505
25506
25507
25508
25509
25510
25511
25512
25513
25514
25515
25516
25517
25518
25519
25520
25521
25522
25523
25524
25525
25526
25527
25528
25529
25530
25531
25532
25533
25534
25535
25536
25537
25538
25539
25540
25541
25542
25543
25544
25545
25546
25547
25548
25549
25550
25551
25552
25553
25554
25555
25556
25557
25558
25559
25560
25561
25562
25563
25564
25565
25566
25567
25568
25569
25570
25571
25572
25573
25574
25575
25576
25577
25578
25579
25580
25581
25582
25583
25584
25585
25586
25587
25588
25589
25590
25591
25592
25593
25594
25595
25596
25597
25598
25599
25600
25601
25602
25603
25604
25605
25606
25607
25608
25609
25610
25611
25612
25613
25614
25615
25616
25617
25618
25619
25620
25621
25622
25623
25624
25625
25626
25627
25628
25629
25630
25631
25632
25633
25634
25635
25636
25637
25638
25639
25640
25641
25642
25643
25644
25645
25646
25647
25648
25649
25650
25651
25652
25653
25654
25655
25656
25657
25658
25659
25660
25661
25662
25663
25664
25665
25666
25667
25668
25669
25670
25671
25672
25673
25674
25675
25676
25677
25678
25679
25680
25681
25682
25683
25684
25685
25686
25687
25688
25689
25690
25691
25692
25693
25694
25695
25696
25697
25698
25699
25700
25701
25702
25703
25704
25705
25706
25707
25708
25709
25710
25711
25712
25713
25714
25715
25716
25717
25718
25719
25720
25721
25722
25723
25724
25725
25726
25727
25728
25729
25730
25731
25732
25733
25734
25735
25736
25737
25738
25739
25740
25741
25742
25743
25744
25745
25746
25747
25748
25749
25750
25751
25752
25753
25754
25755
25756
25757
25758
25759
25760
25761
25762
25763
25764
25765
25766
25767
25768
25769
25770
25771
25772
25773
25774
25775
25776
25777
25778
25779
25780
25781
25782
25783
25784
25785
25786
25787
25788
25789
25790
25791
25792
25793
25794
25795
25796
25797
25798
25799
25800
25801
25802
25803
25804
25805
25806
25807
25808
25809
25810
25811
25812
25813
25814
25815
25816
25817
25818
25819
25820
25821
25822
25823
25824
25825
25826
25827
25828
25829
25830
25831
25832
25833
25834
25835
25836
25837
25838
25839
25840
25841
25842
25843
25844
25845
25846
25847
25848
25849
25850
25851
25852
25853
25854
25855
25856
25857
25858
25859
25860
25861
25862
25863
25864
25865
25866
25867
25868
25869
25870
25871
25872
25873
25874
25875
25876
25877
25878
25879
25880
25881
25882
25883
25884
25885
25886
25887
25888
25889
25890
25891
25892
25893
25894
25895
25896
25897
25898
25899
25900
25901
25902
25903
25904
25905
25906
25907
25908
25909
25910
25911
25912
25913
25914
25915
25916
25917
25918
25919
25920
25921
25922
25923
25924
25925
25926
25927
25928
25929
25930
25931
25932
25933
25934
25935
25936
25937
25938
25939
25940
25941
25942
25943
25944
25945
25946
25947
25948
25949
25950
25951
25952
25953
25954
25955
25956
25957
25958
25959
25960
25961
25962
25963
25964
25965
25966
25967
25968
25969
25970
25971
25972
25973
25974
25975
25976
25977
25978
25979
25980
25981
25982
25983
25984
25985
25986
25987
25988
25989
25990
25991
25992
25993
25994
25995
25996
25997
25998
25999
26000
26001
26002
26003
26004
26005
26006
26007
26008
26009
26010
26011
26012
26013
26014
26015
26016
26017
26018
26019
26020
26021
26022
26023
26024
26025
26026
26027
26028
26029
26030
26031
26032
26033
26034
26035
26036
26037
26038
26039
26040
26041
26042
26043
26044
26045
26046
26047
26048
26049
26050
26051
26052
26053
26054
26055
26056
26057
26058
26059
26060
26061
26062
26063
26064
26065
26066
26067
26068
26069
26070
26071
26072
26073
26074
26075
26076
26077
26078
26079
26080
26081
26082
26083
26084
26085
26086
26087
26088
26089
26090
26091
26092
26093
26094
26095
26096
26097
26098
26099
26100
26101
26102
26103
26104
26105
26106
26107
26108
26109
26110
26111
26112
26113
26114
26115
26116
26117
26118
26119
26120
26121
26122
26123
26124
26125
26126
26127
26128
26129
26130
26131
26132
26133
26134
26135
26136
26137
26138
26139
26140
26141
26142
26143
26144
26145
26146
26147
26148
26149
26150
26151
26152
26153
26154
26155
26156
26157
26158
26159
26160
26161
26162
26163
26164
26165
26166
26167
26168
26169
26170
26171
26172
26173
26174
26175
26176
26177
26178
26179
26180
26181
26182
26183
26184
26185
26186
26187
26188
26189
26190
26191
26192
26193
26194
26195
26196
26197
26198
26199
26200
26201
26202
26203
26204
26205
26206
26207
26208
26209
26210
26211
26212
26213
26214
26215
26216
26217
26218
26219
26220
26221
26222
26223
26224
26225
26226
26227
26228
26229
26230
26231
26232
26233
26234
26235
26236
26237
26238
26239
26240
26241
26242
26243
26244
26245
26246
26247
26248
26249
26250
26251
26252
26253
26254
26255
26256
26257
26258
26259
26260
26261
26262
26263
26264
26265
26266
26267
26268
26269
26270
26271
26272
26273
26274
26275
26276
26277
26278
26279
26280
26281
26282
26283
26284
26285
26286
26287
26288
26289
26290
26291
26292
26293
26294
26295
26296
26297
26298
26299
26300
26301
26302
26303
26304
26305
26306
26307
26308
26309
26310
26311
26312
26313
26314
26315
26316
26317
26318
26319
26320
26321
26322
26323
26324
26325
26326
26327
26328
26329
26330
26331
26332
26333
26334
26335
26336
26337
26338
26339
26340
26341
26342
26343
26344
26345
26346
26347
26348
26349
26350
26351
26352
26353
26354
26355
26356
26357
26358
26359
26360
26361
26362
26363
26364
26365
26366
26367
26368
26369
26370
26371
26372
26373
26374
26375
26376
26377
26378
26379
26380
26381
26382
26383
26384
26385
26386
26387
26388
26389
26390
26391
26392
26393
26394
26395
26396
26397
26398
26399
26400
26401
26402
26403
26404
26405
26406
26407
26408
26409
26410
26411
26412
26413
26414
26415
26416
26417
26418
26419
26420
26421
26422
26423
26424
26425
26426
26427
26428
26429
26430
26431
26432
26433
26434
26435
26436
26437
26438
26439
26440
26441
26442
26443
26444
26445
26446
26447
26448
26449
26450
26451
26452
26453
26454
26455
26456
26457
26458
26459
26460
26461
26462
26463
26464
26465
26466
26467
26468
26469
26470
26471
26472
26473
26474
26475
26476
26477
26478
26479
26480
26481
26482
26483
26484
26485
26486
26487
26488
26489
26490
26491
26492
26493
26494
26495
26496
26497
26498
26499
26500
26501
26502
26503
26504
26505
26506
26507
26508
26509
26510
26511
26512
26513
26514
26515
26516
26517
26518
26519
26520
26521
26522
26523
26524
26525
26526
26527
26528
26529
26530
26531
26532
26533
26534
26535
26536
26537
26538
26539
26540
26541
26542
26543
26544
26545
26546
26547
26548
26549
26550
26551
26552
26553
26554
26555
26556
26557
26558
26559
26560
26561
26562
26563
26564
26565
26566
26567
26568
26569
26570
26571
26572
26573
26574
26575
26576
26577
26578
26579
26580
26581
26582
26583
26584
26585
26586
26587
26588
26589
26590
26591
26592
26593
26594
26595
26596
26597
26598
26599
26600
26601
26602
26603
26604
26605
26606
26607
26608
26609
26610
26611
26612
26613
26614
26615
26616
26617
26618
26619
26620
26621
26622
26623
26624
26625
26626
26627
26628
26629
26630
26631
26632
26633
26634
26635
26636
26637
26638
26639
26640
26641
26642
26643
26644
26645
26646
26647
26648
26649
26650
26651
26652
26653
26654
26655
26656
26657
26658
26659
26660
26661
26662
26663
26664
26665
26666
26667
26668
26669
26670
26671
26672
26673
26674
26675
26676
26677
26678
26679
26680
26681
26682
26683
26684
26685
26686
26687
26688
26689
26690
26691
26692
26693
26694
26695
26696
26697
26698
26699
26700
26701
26702
26703
26704
26705
26706
26707
26708
26709
26710
26711
26712
26713
26714
26715
26716
26717
26718
26719
26720
26721
26722
26723
26724
26725
26726
26727
26728
26729
26730
26731
26732
26733
26734
26735
26736
26737
26738
26739
26740
26741
26742
26743
26744
26745
26746
26747
26748
26749
26750
26751
26752
26753
26754
26755
26756
26757
26758
26759
26760
26761
26762
26763
26764
26765
26766
26767
26768
26769
26770
26771
26772
26773
26774
26775
26776
26777
26778
26779
26780
26781
26782
26783
26784
26785
26786
26787
26788
26789
26790
26791
26792
26793
26794
26795
26796
26797
26798
26799
26800
26801
26802
26803
26804
26805
26806
26807
26808
26809
26810
26811
26812
26813
26814
26815
26816
26817
26818
26819
26820
26821
26822
26823
26824
26825
26826
26827
26828
26829
26830
26831
26832
26833
26834
26835
26836
26837
26838
26839
26840
26841
26842
26843
26844
26845
26846
26847
26848
26849
26850
26851
26852
26853
26854
26855
26856
26857
26858
26859
26860
26861
26862
26863
26864
26865
26866
26867
26868
26869
26870
26871
26872
26873
26874
26875
26876
26877
26878
26879
26880
26881
26882
26883
26884
26885
26886
26887
26888
26889
26890
26891
26892
26893
26894
26895
26896
26897
26898
26899
26900
26901
26902
26903
26904
26905
26906
26907
26908
26909
26910
26911
26912
26913
26914
26915
26916
26917
26918
26919
26920
26921
26922
26923
26924
26925
26926
26927
26928
26929
26930
26931
26932
26933
26934
26935
26936
26937
26938
26939
26940
26941
26942
26943
26944
26945
26946
26947
26948
26949
26950
26951
26952
26953
26954
26955
26956
26957
26958
26959
26960
26961
26962
26963
26964
26965
26966
26967
26968
26969
26970
26971
26972
26973
26974
26975
26976
26977
26978
26979
26980
26981
26982
26983
26984
26985
26986
26987
26988
26989
26990
26991
26992
26993
26994
26995
26996
26997
26998
26999
27000
27001
27002
27003
27004
27005
27006
27007
27008
27009
27010
27011
27012
27013
27014
27015
27016
27017
27018
27019
27020
27021
27022
27023
27024
27025
27026
27027
27028
27029
27030
27031
27032
27033
27034
27035
27036
27037
27038
27039
27040
27041
27042
27043
27044
27045
27046
27047
27048
27049
27050
27051
27052
27053
27054
27055
27056
27057
27058
27059
27060
27061
27062
27063
27064
27065
27066
27067
27068
27069
27070
27071
27072
27073
27074
27075
27076
27077
27078
27079
27080
27081
27082
27083
27084
27085
27086
27087
27088
27089
27090
27091
27092
27093
27094
27095
27096
27097
27098
27099
27100
27101
27102
27103
27104
27105
27106
27107
27108
27109
27110
27111
27112
27113
27114
27115
27116
27117
27118
27119
27120
27121
27122
27123
27124
27125
27126
27127
27128
27129
27130
27131
27132
27133
27134
27135
27136
27137
27138
27139
27140
27141
27142
27143
27144
27145
27146
27147
27148
27149
27150
27151
27152
27153
27154
27155
27156
27157
27158
27159
27160
27161
27162
27163
27164
27165
27166
27167
27168
27169
27170
27171
27172
27173
27174
27175
27176
27177
27178
27179
27180
27181
27182
27183
27184
27185
27186
27187
27188
27189
27190
27191
27192
27193
27194
27195
27196
27197
27198
27199
27200
27201
27202
27203
27204
27205
27206
27207
27208
27209
27210
27211
27212
27213
27214
27215
27216
27217
27218
27219
27220
27221
27222
27223
27224
27225
27226
27227
27228
27229
27230
27231
27232
27233
27234
27235
27236
27237
27238
27239
27240
27241
27242
27243
27244
27245
27246
27247
27248
27249
27250
27251
27252
27253
27254
27255
27256
27257
27258
27259
27260
27261
27262
27263
27264
27265
27266
27267
27268
27269
27270
27271
27272
27273
27274
27275
27276
27277
27278
27279
27280
27281
27282
27283
27284
27285
27286
27287
27288
27289
27290
27291
27292
27293
27294
27295
27296
27297
27298
27299
27300
27301
27302
27303
27304
27305
27306
27307
27308
27309
27310
27311
27312
27313
27314
27315
27316
27317
27318
27319
27320
27321
27322
27323
27324
27325
27326
27327
27328
27329
27330
27331
27332
27333
27334
27335
27336
27337
27338
27339
27340
27341
27342
27343
27344
27345
27346
27347
27348
27349
27350
27351
27352
27353
27354
27355
27356
27357
27358
27359
27360
27361
27362
27363
27364
27365
27366
27367
27368
27369
27370
27371
27372
27373
27374
27375
27376
27377
27378
27379
27380
27381
27382
27383
27384
27385
27386
27387
27388
27389
27390
27391
27392
27393
27394
27395
27396
27397
27398
27399
27400
27401
27402
27403
27404
27405
27406
27407
27408
27409
27410
27411
27412
27413
27414
27415
27416
27417
27418
27419
27420
27421
27422
27423
27424
27425
27426
27427
27428
27429
27430
27431
27432
27433
27434
27435
27436
27437
27438
27439
27440
27441
27442
27443
27444
27445
27446
27447
27448
27449
27450
27451
27452
27453
27454
27455
27456
27457
27458
27459
27460
27461
27462
27463
27464
27465
27466
27467
27468
27469
27470
27471
27472
27473
27474
27475
27476
27477
27478
27479
27480
27481
27482
27483
27484
27485
27486
27487
27488
27489
27490
27491
27492
27493
27494
27495
27496
27497
27498
27499
27500
27501
27502
27503
27504
27505
27506
27507
27508
27509
27510
27511
27512
27513
27514
27515
27516
27517
27518
27519
27520
27521
27522
27523
27524
27525
27526
27527
27528
27529
27530
27531
27532
27533
27534
27535
27536
27537
27538
27539
27540
27541
27542
27543
27544
27545
27546
27547
27548
27549
27550
27551
27552
27553
27554
27555
27556
27557
27558
27559
27560
27561
27562
27563
27564
27565
27566
27567
27568
27569
27570
27571
27572
27573
27574
27575
27576
27577
27578
27579
27580
27581
27582
27583
27584
27585
27586
27587
27588
27589
27590
27591
27592
27593
27594
27595
27596
27597
27598
27599
27600
27601
27602
27603
27604
27605
27606
27607
27608
27609
27610
27611
27612
27613
27614
27615
27616
27617
27618
27619
27620
27621
27622
27623
27624
27625
27626
27627
27628
27629
27630
27631
27632
27633
27634
27635
27636
27637
27638
27639
27640
27641
27642
27643
27644
27645
27646
27647
27648
27649
27650
27651
27652
27653
27654
27655
27656
27657
27658
27659
27660
27661
27662
27663
27664
27665
27666
27667
27668
27669
27670
27671
27672
27673
27674
27675
27676
27677
27678
27679
27680
27681
27682
27683
27684
27685
27686
27687
27688
27689
27690
27691
27692
27693
27694
27695
27696
27697
27698
27699
27700
27701
27702
27703
27704
27705
27706
27707
27708
27709
27710
27711
27712
27713
27714
27715
27716
27717
27718
27719
27720
27721
27722
27723
27724
27725
27726
27727
27728
27729
27730
27731
27732
27733
27734
27735
27736
27737
27738
27739
27740
27741
27742
27743
27744
27745
27746
27747
27748
27749
27750
27751
27752
27753
27754
27755
27756
27757
27758
27759
27760
27761
27762
27763
27764
27765
27766
27767
27768
27769
27770
27771
27772
27773
27774
27775
27776
27777
27778
27779
27780
27781
27782
27783
27784
27785
27786
27787
27788
27789
27790
27791
27792
27793
27794
27795
27796
27797
27798
27799
27800
27801
27802
27803
27804
27805
27806
27807
27808
27809
27810
27811
27812
27813
27814
27815
27816
27817
27818
27819
27820
27821
27822
27823
27824
27825
27826
27827
27828
27829
27830
27831
27832
27833
27834
27835
27836
27837
27838
27839
27840
27841
27842
27843
27844
27845
27846
27847
27848
27849
27850
27851
27852
27853
27854
27855
27856
27857
27858
27859
27860
27861
27862
27863
27864
27865
27866
27867
27868
27869
27870
27871
27872
27873
27874
27875
27876
27877
27878
27879
27880
27881
27882
27883
27884
27885
27886
27887
27888
27889
27890
27891
27892
27893
27894
27895
27896
27897
27898
27899
27900
27901
27902
27903
27904
27905
27906
27907
27908
27909
27910
27911
27912
27913
27914
27915
27916
27917
27918
27919
27920
27921
27922
27923
27924
27925
27926
27927
27928
27929
27930
27931
27932
27933
27934
27935
27936
27937
27938
27939
27940
27941
27942
27943
27944
27945
27946
27947
27948
27949
27950
27951
27952
27953
27954
27955
27956
27957
27958
27959
27960
27961
27962
27963
27964
27965
27966
27967
27968
27969
27970
27971
27972
27973
27974
27975
27976
27977
27978
27979
27980
27981
27982
27983
27984
27985
27986
27987
27988
27989
27990
27991
27992
27993
27994
27995
27996
27997
27998
27999
28000
28001
28002
28003
28004
28005
28006
28007
28008
28009
28010
28011
28012
28013
28014
28015
28016
28017
28018
28019
28020
28021
28022
28023
28024
28025
28026
28027
28028
28029
28030
28031
28032
28033
28034
28035
28036
28037
28038
28039
28040
28041
28042
28043
28044
28045
28046
28047
28048
28049
28050
28051
28052
28053
28054
28055
28056
28057
28058
28059
28060
28061
28062
28063
28064
28065
28066
28067
28068
28069
28070
28071
28072
28073
28074
28075
28076
28077
28078
28079
28080
28081
28082
28083
28084
28085
28086
28087
28088
28089
28090
28091
28092
28093
28094
28095
28096
28097
28098
28099
28100
28101
28102
28103
28104
28105
28106
28107
28108
28109
28110
28111
28112
28113
28114
28115
28116
28117
28118
28119
28120
28121
28122
28123
28124
28125
28126
28127
28128
28129
28130
28131
28132
28133
28134
28135
28136
28137
28138
28139
28140
28141
28142
28143
28144
28145
28146
28147
28148
28149
28150
28151
28152
28153
28154
28155
28156
28157
28158
28159
28160
28161
28162
28163
28164
28165
28166
28167
28168
28169
28170
28171
28172
28173
28174
28175
28176
28177
28178
28179
28180
28181
28182
28183
28184
28185
28186
28187
28188
28189
28190
28191
28192
28193
28194
28195
28196
28197
28198
28199
28200
28201
28202
28203
28204
28205
28206
28207
28208
28209
28210
28211
28212
28213
28214
28215
28216
28217
28218
28219
28220
28221
28222
28223
28224
28225
28226
28227
28228
28229
28230
28231
28232
28233
28234
28235
28236
28237
28238
28239
28240
28241
28242
28243
28244
28245
28246
28247
28248
28249
28250
28251
28252
28253
28254
28255
28256
28257
28258
28259
28260
28261
28262
28263
28264
28265
28266
28267
28268
28269
28270
28271
28272
28273
28274
28275
28276
28277
28278
28279
28280
28281
28282
28283
28284
28285
28286
28287
28288
28289
28290
28291
28292
28293
28294
28295
28296
28297
28298
28299
28300
28301
28302
28303
28304
28305
28306
28307
28308
28309
28310
28311
28312
28313
28314
28315
28316
28317
28318
28319
28320
28321
28322
28323
28324
28325
28326
28327
28328
28329
28330
28331
28332
28333
28334
28335
28336
28337
28338
28339
28340
28341
28342
28343
28344
28345
28346
28347
28348
28349
28350
28351
28352
28353
28354
28355
28356
28357
28358
28359
28360
28361
28362
28363
28364
28365
28366
28367
28368
28369
28370
28371
28372
28373
28374
28375
28376
28377
28378
28379
28380
28381
28382
28383
28384
28385
28386
28387
28388
28389
28390
28391
28392
28393
28394
28395
28396
28397
28398
28399
28400
28401
28402
28403
28404
28405
28406
28407
28408
28409
28410
28411
28412
28413
28414
28415
28416
28417
28418
28419
28420
28421
28422
28423
28424
28425
28426
28427
28428
28429
28430
28431
28432
28433
28434
28435
28436
28437
28438
28439
28440
28441
28442
28443
28444
28445
28446
28447
28448
28449
28450
28451
28452
28453
28454
28455
28456
28457
28458
28459
28460
28461
28462
28463
28464
28465
28466
28467
28468
28469
28470
28471
28472
28473
28474
28475
28476
28477
28478
28479
28480
28481
28482
28483
28484
28485
28486
28487
28488
28489
28490
28491
28492
28493
28494
28495
28496
28497
28498
28499
28500
28501
28502
28503
28504
28505
28506
28507
28508
28509
28510
28511
28512
28513
28514
28515
28516
28517
28518
28519
28520
28521
28522
28523
28524
28525
28526
28527
28528
28529
28530
28531
28532
28533
28534
28535
28536
28537
28538
28539
28540
28541
28542
28543
28544
28545
28546
28547
28548
28549
28550
28551
28552
28553
28554
28555
28556
28557
28558
28559
28560
28561
28562
28563
28564
28565
28566
28567
28568
28569
28570
28571
28572
28573
28574
28575
28576
28577
28578
28579
28580
28581
28582
28583
28584
28585
28586
28587
28588
28589
28590
28591
28592
28593
28594
28595
28596
28597
28598
28599
28600
28601
28602
28603
28604
28605
28606
28607
28608
28609
28610
28611
28612
28613
28614
28615
28616
28617
28618
28619
28620
28621
28622
28623
28624
28625
28626
28627
28628
28629
28630
28631
28632
28633
28634
28635
28636
28637
28638
28639
28640
28641
28642
28643
28644
28645
28646
28647
28648
28649
28650
28651
28652
28653
28654
28655
28656
28657
28658
28659
28660
28661
28662
28663
28664
28665
28666
28667
28668
28669
28670
28671
28672
28673
28674
28675
28676
28677
28678
28679
28680
28681
28682
28683
28684
28685
28686
28687
28688
28689
28690
28691
28692
28693
28694
28695
28696
28697
28698
28699
28700
28701
28702
28703
28704
28705
28706
28707
28708
28709
28710
28711
28712
28713
28714
28715
28716
28717
28718
28719
28720
28721
28722
28723
28724
28725
28726
28727
28728
28729
28730
28731
28732
28733
28734
28735
28736
28737
28738
28739
28740
28741
28742
28743
28744
28745
28746
28747
28748
28749
28750
28751
28752
28753
28754
28755
28756
28757
28758
28759
28760
28761
28762
28763
28764
28765
28766
28767
28768
28769
28770
28771
28772
28773
28774
28775
28776
28777
28778
28779
28780
28781
28782
28783
28784
28785
28786
28787
28788
28789
28790
28791
28792
28793
28794
28795
28796
28797
28798
28799
28800
28801
28802
28803
28804
28805
28806
28807
28808
28809
28810
28811
28812
28813
28814
28815
28816
28817
28818
28819
28820
28821
28822
28823
28824
28825
28826
28827
28828
28829
28830
28831
28832
28833
28834
28835
28836
28837
28838
28839
28840
28841
28842
28843
28844
28845
28846
28847
28848
28849
28850
28851
28852
28853
28854
28855
28856
28857
28858
28859
28860
28861
28862
28863
28864
28865
28866
28867
28868
28869
28870
28871
28872
28873
28874
28875
28876
28877
28878
28879
28880
28881
28882
28883
28884
28885
28886
28887
28888
28889
28890
28891
28892
28893
28894
28895
28896
28897
28898
28899
28900
28901
28902
28903
28904
28905
28906
28907
28908
28909
28910
28911
28912
28913
28914
28915
28916
28917
28918
28919
28920
28921
28922
28923
28924
28925
28926
28927
28928
28929
28930
28931
28932
28933
28934
28935
28936
28937
28938
28939
28940
28941
28942
28943
28944
28945
28946
28947
28948
28949
28950
28951
28952
28953
28954
28955
28956
28957
28958
28959
28960
28961
28962
28963
28964
28965
28966
28967
28968
28969
28970
28971
28972
28973
28974
28975
28976
28977
28978
28979
28980
28981
28982
28983
28984
28985
28986
28987
28988
28989
28990
28991
28992
28993
28994
28995
28996
28997
28998
28999
29000
29001
29002
29003
29004
29005
29006
29007
29008
29009
29010
29011
29012
29013
29014
29015
29016
29017
29018
29019
29020
29021
29022
29023
29024
29025
29026
29027
29028
29029
29030
29031
29032
29033
29034
29035
29036
29037
29038
29039
29040
29041
29042
29043
29044
29045
29046
29047
29048
29049
29050
29051
29052
29053
29054
29055
29056
29057
29058
29059
29060
29061
29062
29063
29064
29065
29066
29067
29068
29069
29070
29071
29072
29073
29074
29075
29076
29077
29078
29079
29080
29081
29082
29083
29084
29085
29086
29087
29088
29089
29090
29091
29092
29093
29094
29095
29096
29097
29098
29099
29100
29101
29102
29103
29104
29105
29106
29107
29108
29109
29110
29111
29112
29113
29114
29115
29116
29117
29118
29119
29120
29121
29122
29123
29124
29125
29126
29127
29128
29129
29130
29131
29132
29133
29134
29135
29136
29137
29138
29139
29140
29141
29142
29143
29144
29145
29146
29147
29148
29149
29150
29151
29152
29153
29154
29155
29156
29157
29158
29159
29160
29161
29162
29163
29164
29165
29166
29167
29168
29169
29170
29171
29172
29173
29174
29175
29176
29177
29178
29179
29180
29181
29182
29183
29184
29185
29186
29187
29188
29189
29190
29191
29192
29193
29194
29195
29196
29197
29198
29199
29200
29201
29202
29203
29204
29205
29206
29207
29208
29209
29210
29211
29212
29213
29214
29215
29216
29217
29218
29219
29220
29221
29222
29223
29224
29225
29226
29227
29228
29229
29230
29231
29232
29233
29234
29235
29236
29237
29238
29239
29240
29241
29242
29243
29244
29245
29246
29247
29248
29249
29250
29251
29252
29253
29254
29255
29256
29257
29258
29259
29260
29261
29262
29263
29264
29265
29266
29267
29268
29269
29270
29271
29272
29273
29274
29275
29276
29277
29278
29279
29280
29281
29282
29283
29284
29285
29286
29287
29288
29289
29290
29291
29292
29293
29294
29295
29296
29297
29298
29299
29300
29301
29302
29303
29304
29305
29306
29307
29308
29309
29310
29311
29312
29313
29314
29315
29316
29317
29318
29319
29320
29321
29322
29323
29324
29325
29326
29327
29328
29329
29330
29331
29332
29333
29334
29335
29336
29337
29338
29339
29340
29341
29342
29343
29344
29345
29346
29347
29348
29349
29350
29351
29352
29353
29354
29355
29356
29357
29358
29359
29360
29361
29362
29363
29364
29365
29366
29367
29368
29369
29370
29371
29372
29373
29374
29375
29376
29377
29378
29379
29380
29381
29382
29383
29384
29385
29386
29387
29388
29389
29390
29391
29392
29393
29394
29395
29396
29397
29398
29399
29400
29401
29402
29403
29404
29405
29406
29407
29408
29409
29410
29411
29412
29413
29414
29415
29416
29417
29418
29419
29420
29421
29422
29423
29424
29425
29426
29427
29428
29429
29430
29431
29432
29433
29434
29435
29436
29437
29438
29439
29440
29441
29442
29443
29444
29445
29446
29447
29448
29449
29450
29451
29452
29453
29454
29455
29456
29457
29458
29459
29460
29461
29462
29463
29464
29465
29466
29467
29468
29469
29470
29471
29472
29473
29474
29475
29476
29477
29478
29479
29480
29481
29482
29483
29484
29485
29486
29487
29488
29489
29490
29491
29492
29493
29494
29495
29496
29497
29498
29499
29500
29501
29502
29503
29504
29505
29506
29507
29508
29509
29510
29511
29512
29513
29514
29515
29516
29517
29518
29519
29520
29521
29522
29523
29524
29525
29526
29527
29528
29529
29530
29531
29532
29533
29534
29535
29536
29537
29538
29539
29540
29541
29542
29543
29544
29545
29546
29547
29548
29549
29550
29551
29552
29553
29554
29555
29556
29557
29558
29559
29560
29561
29562
29563
29564
29565
29566
29567
29568
29569
29570
29571
29572
29573
29574
29575
29576
29577
29578
29579
29580
29581
29582
29583
29584
29585
29586
29587
29588
29589
29590
29591
29592
29593
29594
29595
29596
29597
29598
29599
29600
29601
29602
29603
29604
29605
29606
29607
29608
29609
29610
29611
29612
29613
29614
29615
29616
29617
29618
29619
29620
29621
29622
29623
29624
29625
29626
29627
29628
29629
29630
29631
29632
29633
29634
29635
29636
29637
29638
29639
29640
29641
29642
29643
29644
29645
29646
29647
29648
29649
29650
29651
29652
29653
29654
29655
29656
29657
29658
29659
29660
29661
29662
29663
29664
29665
29666
29667
29668
29669
29670
29671
29672
29673
29674
29675
29676
29677
29678
29679
29680
29681
29682
29683
29684
29685
29686
29687
29688
29689
29690
29691
29692
29693
29694
29695
29696
29697
29698
29699
29700
29701
29702
29703
29704
29705
29706
29707
29708
29709
29710
29711
29712
29713
29714
29715
29716
29717
29718
29719
29720
29721
29722
29723
29724
29725
29726
29727
29728
29729
29730
29731
29732
29733
29734
29735
29736
29737
29738
29739
29740
29741
29742
29743
29744
29745
29746
29747
29748
29749
29750
29751
29752
29753
29754
29755
29756
29757
29758
29759
29760
29761
29762
29763
29764
29765
29766
29767
29768
29769
29770
29771
29772
29773
29774
29775
29776
29777
29778
29779
29780
29781
29782
29783
29784
29785
29786
29787
29788
29789
29790
29791
29792
29793
29794
29795
29796
29797
29798
29799
29800
29801
29802
29803
29804
29805
29806
29807
29808
29809
29810
29811
29812
29813
29814
29815
29816
29817
29818
29819
29820
29821
29822
29823
29824
29825
29826
29827
29828
29829
29830
29831
29832
29833
29834
29835
29836
29837
29838
29839
29840
29841
29842
29843
29844
29845
29846
29847
29848
29849
29850
29851
29852
29853
29854
29855
29856
29857
29858
29859
29860
29861
29862
29863
29864
29865
29866
29867
29868
29869
29870
29871
29872
29873
29874
29875
29876
29877
29878
29879
29880
29881
29882
29883
29884
29885
29886
29887
29888
29889
29890
29891
29892
29893
29894
29895
29896
29897
29898
29899
29900
29901
29902
29903
29904
29905
29906
29907
29908
29909
29910
29911
29912
29913
29914
29915
29916
29917
29918
29919
29920
29921
29922
29923
29924
29925
29926
29927
29928
29929
29930
29931
29932
29933
29934
29935
29936
29937
29938
29939
29940
29941
29942
29943
29944
29945
29946
29947
29948
29949
29950
29951
29952
29953
29954
29955
29956
29957
29958
29959
29960
29961
29962
29963
29964
29965
29966
29967
29968
29969
29970
29971
29972
29973
29974
29975
29976
29977
29978
29979
29980
29981
29982
29983
29984
29985
29986
29987
29988
29989
29990
29991
29992
29993
29994
29995
29996
29997
29998
29999
30000
30001
30002
30003
30004
30005
30006
30007
30008
30009
30010
30011
30012
30013
30014
30015
30016
30017
30018
30019
30020
30021
30022
30023
30024
30025
30026
30027
30028
30029
30030
30031
30032
30033
30034
30035
30036
30037
30038
30039
30040
30041
30042
30043
30044
30045
30046
30047
30048
30049
30050
30051
30052
30053
30054
30055
30056
30057
30058
30059
30060
30061
30062
30063
30064
30065
30066
30067
30068
30069
30070
30071
30072
30073
30074
30075
30076
30077
30078
30079
30080
30081
30082
30083
30084
30085
30086
30087
30088
30089
30090
30091
30092
30093
30094
30095
30096
30097
30098
30099
30100
30101
30102
30103
30104
30105
30106
30107
30108
30109
30110
30111
30112
30113
30114
30115
30116
30117
30118
30119
30120
30121
30122
30123
30124
30125
30126
30127
30128
30129
30130
30131
30132
30133
30134
30135
30136
30137
30138
30139
30140
30141
30142
30143
30144
30145
30146
30147
30148
30149
30150
30151
30152
30153
30154
30155
30156
30157
30158
30159
30160
30161
30162
30163
30164
30165
30166
30167
30168
30169
30170
30171
30172
30173
30174
30175
30176
30177
30178
30179
30180
30181
30182
30183
30184
30185
30186
30187
30188
30189
30190
30191
30192
30193
30194
30195
30196
30197
30198
30199
30200
30201
30202
30203
30204
30205
30206
30207
30208
30209
30210
30211
30212
30213
30214
30215
30216
30217
30218
30219
30220
30221
30222
30223
30224
30225
30226
30227
30228
30229
30230
30231
30232
30233
30234
30235
30236
30237
30238
30239
30240
30241
30242
30243
30244
30245
30246
30247
30248
30249
30250
30251
30252
30253
30254
30255
30256
30257
30258
30259
30260
30261
30262
30263
30264
30265
30266
30267
30268
30269
30270
30271
30272
30273
30274
30275
30276
30277
30278
30279
30280
30281
30282
30283
30284
30285
30286
30287
30288
30289
30290
30291
30292
30293
30294
30295
30296
30297
30298
30299
30300
30301
30302
30303
30304
30305
30306
30307
30308
30309
30310
30311
30312
30313
30314
30315
30316
30317
30318
30319
30320
30321
30322
30323
30324
30325
30326
30327
30328
30329
30330
30331
30332
30333
30334
30335
30336
30337
30338
30339
30340
30341
30342
30343
30344
30345
30346
30347
30348
30349
30350
30351
30352
30353
30354
30355
30356
30357
30358
30359
30360
30361
30362
30363
30364
30365
30366
30367
30368
30369
30370
30371
30372
30373
30374
30375
30376
30377
30378
30379
30380
30381
30382
30383
30384
30385
30386
30387
30388
30389
30390
30391
30392
30393
30394
30395
30396
30397
30398
30399
30400
30401
30402
30403
30404
30405
30406
30407
30408
30409
30410
30411
30412
30413
30414
30415
30416
30417
30418
30419
30420
30421
30422
30423
30424
30425
30426
30427
30428
30429
30430
30431
30432
30433
30434
30435
30436
30437
30438
30439
30440
30441
30442
30443
30444
30445
30446
30447
30448
30449
30450
30451
30452
30453
30454
30455
30456
30457
30458
30459
30460
30461
30462
30463
30464
30465
30466
30467
30468
30469
30470
30471
30472
30473
30474
30475
30476
30477
30478
30479
30480
30481
30482
30483
30484
30485
30486
30487
30488
30489
30490
30491
30492
30493
30494
30495
30496
30497
30498
30499
30500
30501
30502
30503
30504
30505
30506
30507
30508
30509
30510
30511
30512
30513
30514
30515
30516
30517
30518
30519
30520
30521
30522
30523
30524
30525
30526
30527
30528
30529
30530
30531
30532
30533
30534
30535
30536
30537
30538
30539
30540
30541
30542
30543
30544
30545
30546
30547
30548
30549
30550
30551
30552
30553
30554
30555
30556
30557
30558
30559
30560
30561
30562
30563
30564
30565
30566
30567
30568
30569
30570
30571
30572
30573
30574
30575
30576
30577
30578
30579
30580
30581
30582
30583
30584
30585
30586
30587
30588
30589
30590
30591
30592
30593
30594
30595
30596
30597
30598
30599
30600
30601
30602
30603
30604
30605
30606
30607
30608
30609
30610
30611
30612
30613
30614
30615
30616
30617
30618
30619
30620
30621
30622
30623
30624
30625
30626
30627
30628
30629
30630
30631
30632
30633
30634
30635
30636
30637
30638
30639
30640
30641
30642
30643
30644
30645
30646
30647
30648
30649
30650
30651
30652
30653
30654
30655
30656
30657
30658
30659
30660
30661
30662
30663
30664
30665
30666
30667
30668
30669
30670
30671
30672
30673
30674
30675
30676
30677
30678
30679
30680
30681
30682
30683
30684
30685
30686
30687
30688
30689
30690
30691
30692
30693
30694
30695
30696
30697
30698
30699
30700
30701
30702
30703
30704
30705
30706
30707
30708
30709
30710
30711
30712
30713
30714
30715
30716
30717
30718
30719
30720
30721
30722
30723
30724
30725
30726
30727
30728
30729
30730
30731
30732
30733
30734
30735
30736
30737
30738
30739
30740
30741
30742
30743
30744
30745
30746
30747
30748
30749
30750
30751
30752
30753
30754
30755
30756
30757
30758
30759
30760
30761
30762
30763
30764
30765
30766
30767
30768
30769
30770
30771
30772
30773
30774
30775
30776
30777
30778
30779
30780
30781
30782
30783
30784
30785
30786
30787
30788
30789
30790
30791
30792
30793
30794
30795
30796
30797
30798
30799
30800
30801
30802
30803
30804
30805
30806
30807
30808
30809
30810
30811
30812
30813
30814
30815
30816
30817
30818
30819
30820
30821
30822
30823
30824
30825
30826
30827
30828
30829
30830
30831
30832
30833
30834
30835
30836
30837
30838
30839
30840
30841
30842
30843
30844
30845
30846
30847
30848
30849
30850
30851
30852
30853
30854
30855
30856
30857
30858
30859
30860
30861
30862
30863
30864
30865
30866
30867
30868
30869
30870
30871
30872
30873
30874
30875
30876
30877
30878
30879
30880
30881
30882
30883
30884
30885
30886
30887
30888
30889
30890
30891
30892
30893
30894
30895
30896
30897
30898
30899
30900
30901
30902
30903
30904
30905
30906
30907
30908
30909
30910
30911
30912
30913
30914
30915
30916
30917
30918
30919
30920
30921
30922
30923
30924
30925
30926
30927
30928
30929
30930
30931
30932
30933
30934
30935
30936
30937
30938
30939
30940
30941
30942
30943
30944
30945
30946
30947
30948
30949
30950
30951
30952
30953
30954
30955
30956
30957
30958
30959
30960
30961
30962
30963
30964
30965
30966
30967
30968
30969
30970
30971
30972
30973
30974
30975
30976
30977
30978
30979
30980
30981
30982
30983
30984
30985
30986
30987
30988
30989
30990
30991
30992
30993
30994
30995
30996
30997
30998
30999
31000
31001
31002
31003
31004
31005
31006
31007
31008
31009
31010
31011
31012
31013
31014
31015
31016
31017
31018
31019
31020
31021
31022
31023
31024
31025
31026
31027
31028
31029
31030
31031
31032
31033
31034
31035
31036
31037
31038
31039
31040
31041
31042
31043
31044
31045
31046
31047
31048
31049
31050
31051
31052
31053
31054
31055
31056
31057
31058
31059
31060
31061
31062
31063
31064
31065
31066
31067
31068
31069
31070
31071
31072
31073
31074
31075
31076
31077
31078
31079
31080
31081
31082
31083
31084
31085
31086
31087
31088
31089
31090
31091
31092
31093
31094
31095
31096
31097
31098
31099
31100
31101
31102
31103
31104
31105
31106
31107
31108
31109
31110
31111
31112
31113
31114
31115
31116
31117
31118
31119
31120
31121
31122
31123
31124
31125
31126
31127
31128
31129
31130
31131
31132
31133
31134
31135
31136
31137
31138
31139
31140
31141
31142
31143
31144
31145
31146
31147
31148
31149
31150
31151
31152
31153
31154
31155
31156
31157
31158
31159
31160
31161
31162
31163
31164
31165
31166
31167
31168
31169
31170
31171
31172
31173
31174
31175
31176
31177
31178
31179
31180
31181
31182
31183
31184
31185
31186
31187
31188
31189
31190
31191
31192
31193
31194
31195
31196
31197
31198
31199
31200
31201
31202
31203
31204
31205
31206
31207
31208
31209
31210
31211
31212
31213
31214
31215
31216
31217
31218
31219
31220
31221
31222
31223
31224
31225
31226
31227
31228
31229
31230
31231
31232
31233
31234
31235
31236
31237
31238
31239
31240
31241
31242
31243
31244
31245
31246
31247
31248
31249
31250
31251
31252
31253
31254
31255
31256
31257
31258
31259
31260
31261
31262
31263
31264
31265
31266
31267
31268
31269
31270
31271
31272
31273
31274
31275
31276
31277
31278
31279
31280
31281
31282
31283
31284
31285
31286
31287
31288
31289
31290
31291
31292
31293
31294
31295
31296
31297
31298
31299
31300
31301
31302
31303
31304
31305
31306
31307
31308
31309
31310
31311
31312
31313
31314
31315
31316
31317
31318
31319
31320
31321
31322
31323
31324
31325
31326
31327
31328
31329
31330
31331
31332
31333
31334
31335
31336
31337
31338
31339
31340
31341
31342
31343
31344
31345
31346
31347
31348
31349
31350
31351
31352
31353
31354
31355
31356
31357
31358
31359
31360
31361
31362
31363
31364
31365
31366
31367
31368
31369
31370
31371
31372
31373
31374
31375
31376
31377
31378
31379
31380
31381
31382
31383
31384
31385
31386
31387
31388
31389
31390
31391
31392
31393
31394
31395
31396
31397
31398
31399
31400
31401
31402
31403
31404
31405
31406
31407
31408
31409
31410
31411
31412
31413
31414
31415
31416
31417
31418
31419
31420
31421
31422
31423
31424
31425
31426
31427
31428
31429
31430
31431
31432
31433
31434
31435
31436
31437
31438
31439
31440
31441
31442
31443
31444
31445
31446
31447
31448
31449
31450
31451
31452
31453
31454
31455
31456
31457
31458
31459
31460
31461
31462
31463
31464
31465
31466
31467
31468
31469
31470
31471
31472
31473
31474
31475
31476
31477
31478
31479
31480
31481
31482
31483
31484
31485
31486
31487
31488
31489
31490
31491
31492
31493
31494
31495
31496
31497
31498
31499
31500
31501
31502
31503
31504
31505
31506
31507
31508
31509
31510
31511
31512
31513
31514
31515
31516
31517
31518
31519
31520
31521
31522
31523
31524
31525
31526
31527
31528
31529
31530
31531
31532
31533
31534
31535
31536
31537
31538
31539
31540
31541
31542
31543
31544
31545
31546
31547
31548
31549
31550
31551
31552
31553
31554
31555
31556
31557
31558
31559
31560
31561
31562
31563
31564
31565
31566
31567
31568
31569
31570
31571
31572
31573
31574
31575
31576
31577
31578
31579
31580
31581
31582
31583
31584
31585
31586
31587
31588
31589
31590
31591
31592
31593
31594
31595
31596
31597
31598
31599
31600
31601
31602
31603
31604
31605
31606
31607
31608
31609
31610
31611
31612
31613
31614
31615
31616
31617
31618
31619
31620
31621
31622
31623
31624
31625
31626
31627
31628
31629
31630
31631
31632
31633
31634
31635
31636
31637
31638
31639
31640
31641
31642
31643
31644
31645
31646
31647
31648
31649
31650
31651
31652
31653
31654
31655
31656
31657
31658
31659
31660
31661
31662
31663
31664
31665
31666
31667
31668
31669
31670
31671
31672
31673
31674
31675
31676
31677
31678
31679
31680
31681
31682
31683
31684
31685
31686
31687
31688
31689
31690
31691
31692
31693
31694
31695
31696
31697
31698
31699
31700
31701
31702
31703
31704
31705
31706
31707
31708
31709
31710
31711
31712
31713
31714
31715
31716
31717
31718
31719
31720
31721
31722
31723
31724
31725
31726
31727
31728
31729
31730
31731
31732
31733
31734
31735
31736
31737
31738
31739
31740
31741
31742
31743
31744
31745
31746
31747
31748
31749
31750
31751
31752
31753
31754
31755
31756
31757
31758
31759
31760
31761
31762
31763
31764
31765
31766
31767
31768
31769
31770
31771
31772
31773
31774
31775
31776
31777
31778
31779
31780
31781
31782
31783
31784
31785
31786
31787
31788
31789
31790
31791
31792
31793
31794
31795
31796
31797
31798
31799
31800
31801
31802
31803
31804
31805
31806
31807
31808
31809
31810
31811
31812
31813
31814
31815
31816
31817
31818
31819
31820
31821
31822
31823
31824
31825
31826
31827
31828
31829
31830
31831
31832
31833
31834
31835
31836
31837
31838
31839
31840
31841
31842
31843
31844
31845
31846
31847
31848
31849
31850
31851
31852
31853
31854
31855
31856
31857
31858
31859
31860
31861
31862
31863
31864
31865
31866
31867
31868
31869
31870
31871
31872
31873
31874
31875
31876
31877
31878
31879
31880
31881
31882
31883
31884
31885
31886
31887
31888
31889
31890
31891
31892
31893
31894
31895
31896
31897
31898
31899
31900
31901
31902
31903
31904
31905
31906
31907
31908
31909
31910
31911
31912
31913
31914
31915
31916
31917
31918
31919
31920
31921
31922
31923
31924
31925
31926
31927
31928
31929
31930
31931
31932
31933
31934
31935
31936
31937
31938
31939
31940
31941
31942
31943
31944
31945
31946
31947
31948
31949
31950
31951
31952
31953
31954
31955
31956
31957
31958
31959
31960
31961
31962
31963
31964
31965
31966
31967
31968
31969
31970
31971
31972
31973
31974
31975
31976
31977
31978
31979
31980
31981
31982
31983
31984
31985
31986
31987
31988
31989
31990
31991
31992
31993
31994
31995
31996
31997
31998
31999
32000
32001
32002
32003
32004
32005
32006
32007
32008
32009
32010
32011
32012
32013
32014
32015
32016
32017
32018
32019
32020
32021
32022
32023
32024
32025
32026
32027
32028
32029
32030
32031
32032
32033
32034
32035
32036
32037
32038
32039
32040
32041
32042
32043
32044
32045
32046
32047
32048
32049
32050
32051
32052
32053
32054
32055
32056
32057
32058
32059
32060
32061
32062
32063
32064
32065
32066
32067
32068
32069
32070
32071
32072
32073
32074
32075
32076
32077
32078
32079
32080
32081
32082
32083
32084
32085
32086
32087
32088
32089
32090
32091
32092
32093
32094
32095
32096
32097
32098
32099
32100
32101
32102
32103
32104
32105
32106
32107
32108
32109
32110
32111
32112
32113
32114
32115
32116
32117
32118
32119
32120
32121
32122
32123
32124
32125
32126
32127
32128
32129
32130
32131
32132
32133
32134
32135
32136
32137
32138
32139
32140
32141
32142
32143
32144
32145
32146
32147
32148
32149
32150
32151
32152
32153
32154
32155
32156
32157
32158
32159
32160
32161
32162
32163
32164
32165
32166
32167
32168
32169
32170
32171
32172
32173
32174
32175
32176
32177
32178
32179
32180
32181
32182
32183
32184
32185
32186
32187
32188
32189
32190
32191
32192
32193
32194
32195
32196
32197
32198
32199
32200
32201
32202
32203
32204
32205
32206
32207
32208
32209
32210
32211
32212
32213
32214
32215
32216
32217
32218
32219
32220
32221
32222
32223
32224
32225
32226
32227
32228
32229
32230
32231
32232
32233
32234
32235
32236
32237
32238
32239
32240
32241
32242
32243
32244
32245
32246
32247
32248
32249
32250
32251
32252
32253
32254
32255
32256
32257
32258
32259
32260
32261
32262
32263
32264
32265
32266
32267
32268
32269
32270
32271
32272
32273
32274
32275
32276
32277
32278
32279
32280
32281
32282
32283
32284
32285
32286
32287
32288
32289
32290
32291
32292
32293
32294
32295
32296
32297
32298
32299
32300
32301
32302
32303
32304
32305
32306
32307
32308
32309
32310
32311
32312
32313
32314
32315
32316
32317
32318
32319
32320
32321
32322
32323
32324
32325
32326
32327
32328
32329
32330
32331
32332
32333
32334
32335
32336
32337
32338
32339
32340
32341
32342
32343
32344
32345
32346
32347
32348
32349
32350
32351
32352
32353
32354
32355
32356
32357
32358
32359
32360
32361
32362
32363
32364
32365
32366
32367
32368
32369
32370
32371
32372
32373
32374
32375
32376
32377
32378
32379
32380
32381
32382
32383
32384
32385
32386
32387
32388
32389
32390
32391
32392
32393
32394
32395
32396
32397
32398
32399
32400
32401
32402
32403
32404
32405
32406
32407
32408
32409
32410
32411
32412
32413
32414
32415
32416
32417
32418
32419
32420
32421
32422
32423
32424
32425
32426
32427
32428
32429
32430
32431
32432
32433
32434
32435
32436
32437
32438
32439
32440
32441
32442
32443
32444
32445
32446
32447
32448
32449
32450
32451
32452
32453
32454
32455
32456
32457
32458
32459
32460
32461
32462
32463
32464
32465
32466
32467
32468
32469
32470
32471
32472
32473
32474
32475
32476
32477
32478
32479
32480
32481
32482
32483
32484
32485
32486
32487
32488
32489
32490
32491
32492
32493
32494
32495
32496
32497
32498
32499
32500
32501
32502
32503
32504
32505
32506
32507
32508
32509
32510
32511
32512
32513
32514
32515
32516
32517
32518
32519
32520
32521
32522
32523
32524
32525
32526
32527
32528
32529
32530
32531
32532
32533
32534
32535
32536
32537
32538
32539
32540
32541
32542
32543
32544
32545
32546
32547
32548
32549
32550
32551
32552
32553
32554
32555
32556
32557
32558
32559
32560
32561
32562
32563
32564
32565
32566
32567
32568
32569
32570
32571
32572
32573
32574
32575
32576
32577
32578
32579
32580
32581
32582
32583
32584
32585
32586
32587
32588
32589
32590
32591
32592
32593
32594
32595
32596
32597
32598
32599
32600
32601
32602
32603
32604
32605
32606
32607
32608
32609
32610
32611
32612
32613
32614
32615
32616
32617
32618
32619
32620
32621
32622
32623
32624
32625
32626
32627
32628
32629
32630
32631
32632
32633
32634
32635
32636
32637
32638
32639
32640
32641
32642
32643
32644
32645
32646
32647
32648
32649
32650
32651
32652
32653
32654
32655
32656
32657
32658
32659
32660
32661
32662
32663
32664
32665
32666
32667
32668
32669
32670
32671
32672
32673
32674
32675
32676
32677
32678
32679
32680
32681
32682
32683
32684
32685
32686
32687
32688
32689
32690
32691
32692
32693
32694
32695
32696
32697
32698
32699
32700
32701
32702
32703
32704
32705
32706
32707
32708
32709
32710
32711
32712
32713
32714
32715
32716
32717
32718
32719
32720
32721
32722
32723
32724
32725
32726
32727
32728
32729
32730
32731
32732
32733
32734
32735
32736
32737
32738
32739
32740
32741
32742
32743
32744
32745
32746
32747
32748
32749
32750
32751
32752
32753
32754
32755
32756
32757
32758
32759
32760
32761
32762
32763
32764
32765
32766
32767
32768
32769
32770
32771
32772
32773
32774
32775
32776
32777
32778
32779
32780
32781
32782
32783
32784
32785
32786
32787
32788
32789
32790
32791
32792
32793
32794
32795
32796
32797
32798
32799
32800
32801
32802
32803
32804
32805
32806
32807
32808
32809
32810
32811
32812
32813
32814
32815
32816
32817
32818
32819
32820
32821
32822
32823
32824
32825
32826
32827
32828
32829
32830
32831
32832
32833
32834
32835
32836
32837
32838
32839
32840
32841
32842
32843
32844
32845
32846
32847
32848
32849
32850
32851
32852
32853
32854
32855
32856
32857
32858
32859
32860
32861
32862
32863
32864
32865
32866
32867
32868
32869
32870
32871
32872
32873
32874
32875
32876
32877
32878
32879
32880
32881
32882
32883
32884
32885
32886
32887
32888
32889
32890
32891
32892
32893
32894
32895
32896
32897
32898
32899
32900
32901
32902
32903
32904
32905
32906
32907
32908
32909
32910
32911
32912
32913
32914
32915
32916
32917
32918
32919
32920
32921
32922
32923
32924
32925
32926
32927
32928
32929
32930
32931
32932
32933
32934
32935
32936
32937
32938
32939
32940
32941
32942
32943
32944
32945
32946
32947
32948
32949
32950
32951
32952
32953
32954
32955
32956
32957
32958
32959
32960
32961
32962
32963
32964
32965
32966
32967
32968
32969
32970
32971
32972
32973
32974
32975
32976
32977
32978
32979
32980
32981
32982
32983
32984
32985
32986
32987
32988
32989
32990
32991
32992
32993
32994
32995
32996
32997
32998
32999
33000
33001
33002
33003
33004
33005
33006
33007
33008
33009
33010
33011
33012
33013
33014
33015
33016
33017
33018
33019
33020
33021
33022
33023
33024
33025
33026
33027
33028
33029
33030
33031
33032
33033
33034
33035
33036
33037
33038
33039
33040
33041
33042
33043
33044
33045
33046
33047
33048
33049
33050
33051
33052
33053
33054
33055
33056
33057
33058
33059
33060
33061
33062
33063
33064
33065
33066
33067
33068
33069
33070
33071
33072
33073
33074
33075
33076
33077
33078
33079
33080
33081
33082
33083
33084
33085
33086
33087
33088
33089
33090
33091
33092
33093
33094
33095
33096
33097
33098
33099
33100
33101
33102
33103
33104
33105
33106
33107
33108
33109
33110
33111
33112
33113
33114
33115
33116
33117
33118
33119
33120
33121
33122
33123
33124
33125
33126
33127
33128
33129
33130
33131
33132
33133
33134
33135
33136
33137
33138
33139
33140
33141
33142
33143
33144
33145
33146
33147
33148
33149
33150
33151
33152
33153
33154
33155
33156
33157
33158
33159
33160
33161
33162
33163
33164
33165
33166
33167
33168
33169
33170
33171
33172
33173
33174
33175
33176
33177
33178
33179
33180
33181
33182
33183
33184
33185
33186
33187
33188
33189
33190
33191
33192
33193
33194
33195
33196
33197
33198
33199
33200
33201
33202
33203
33204
33205
33206
33207
33208
33209
33210
33211
33212
33213
33214
33215
33216
33217
33218
33219
33220
33221
33222
33223
33224
33225
33226
33227
33228
33229
33230
33231
33232
33233
33234
33235
33236
33237
33238
33239
33240
33241
33242
33243
33244
33245
33246
33247
33248
33249
33250
33251
33252
33253
33254
33255
33256
33257
33258
33259
33260
33261
33262
33263
33264
33265
33266
33267
33268
33269
33270
33271
33272
33273
33274
33275
33276
33277
33278
33279
33280
33281
33282
33283
33284
33285
33286
33287
33288
33289
33290
33291
33292
33293
33294
33295
33296
33297
33298
33299
33300
33301
33302
33303
33304
33305
33306
33307
33308
33309
33310
33311
33312
33313
33314
33315
33316
33317
33318
33319
33320
33321
33322
33323
33324
33325
33326
33327
33328
33329
33330
33331
33332
33333
33334
33335
33336
33337
33338
33339
33340
33341
33342
33343
33344
33345
33346
33347
33348
33349
33350
33351
33352
33353
33354
33355
33356
33357
33358
33359
33360
33361
33362
33363
33364
33365
33366
33367
33368
33369
33370
33371
33372
33373
33374
33375
33376
33377
33378
33379
33380
33381
33382
33383
33384
33385
33386
33387
33388
33389
33390
33391
33392
33393
33394
33395
33396
33397
33398
33399
33400
33401
33402
33403
33404
33405
33406
33407
33408
33409
33410
33411
33412
33413
33414
33415
33416
33417
33418
33419
33420
33421
33422
33423
33424
33425
33426
33427
33428
33429
33430
33431
33432
33433
33434
33435
33436
33437
33438
33439
33440
33441
33442
33443
33444
33445
33446
33447
33448
33449
33450
33451
33452
33453
33454
33455
33456
33457
33458
33459
33460
33461
33462
33463
33464
33465
33466
33467
33468
33469
33470
33471
33472
33473
33474
33475
33476
33477
33478
33479
33480
33481
33482
33483
33484
33485
33486
33487
33488
33489
33490
33491
33492
33493
33494
33495
33496
33497
33498
33499
33500
33501
33502
33503
33504
33505
33506
33507
33508
33509
33510
33511
33512
33513
33514
33515
33516
33517
33518
33519
33520
33521
33522
33523
33524
33525
33526
33527
33528
33529
33530
33531
33532
33533
33534
33535
33536
33537
33538
33539
33540
33541
33542
33543
33544
33545
33546
33547
33548
33549
33550
33551
33552
33553
33554
33555
33556
33557
33558
33559
33560
33561
33562
33563
33564
33565
33566
33567
33568
33569
33570
33571
33572
33573
33574
33575
33576
33577
33578
33579
33580
33581
33582
33583
33584
33585
33586
33587
33588
33589
33590
33591
33592
33593
33594
33595
33596
33597
33598
33599
33600
33601
33602
33603
33604
33605
33606
33607
33608
33609
33610
33611
33612
33613
33614
33615
33616
33617
33618
33619
33620
33621
33622
33623
33624
33625
33626
33627
33628
33629
33630
33631
33632
33633
33634
33635
33636
33637
33638
33639
33640
33641
33642
33643
33644
33645
33646
33647
33648
33649
33650
33651
33652
33653
33654
33655
33656
33657
33658
33659
33660
33661
33662
33663
33664
33665
33666
33667
33668
33669
33670
33671
33672
33673
33674
33675
33676
33677
33678
33679
33680
33681
33682
33683
33684
33685
33686
33687
33688
33689
33690
33691
33692
33693
33694
33695
33696
33697
33698
33699
33700
33701
33702
33703
33704
33705
33706
33707
33708
33709
33710
33711
33712
33713
33714
33715
33716
33717
33718
33719
33720
33721
33722
33723
33724
33725
33726
33727
33728
33729
33730
33731
33732
33733
33734
33735
33736
33737
33738
33739
33740
33741
33742
33743
33744
33745
33746
33747
33748
33749
33750
33751
33752
33753
33754
33755
33756
33757
33758
33759
33760
33761
33762
33763
33764
33765
33766
33767
33768
33769
33770
33771
33772
33773
33774
33775
33776
33777
33778
33779
33780
33781
33782
33783
33784
33785
33786
33787
33788
33789
33790
33791
33792
33793
33794
33795
33796
33797
33798
33799
33800
33801
33802
33803
33804
33805
33806
33807
33808
33809
33810
33811
33812
33813
33814
33815
33816
33817
33818
33819
33820
33821
33822
33823
33824
33825
33826
33827
33828
33829
33830
33831
33832
33833
33834
33835
33836
33837
33838
33839
33840
33841
33842
33843
33844
33845
33846
33847
33848
33849
33850
33851
33852
33853
33854
33855
33856
33857
33858
33859
33860
33861
33862
33863
33864
33865
33866
33867
33868
33869
33870
33871
33872
33873
33874
33875
33876
33877
33878
33879
33880
33881
33882
33883
33884
33885
33886
33887
33888
33889
33890
33891
33892
33893
33894
33895
33896
33897
33898
33899
33900
33901
33902
33903
33904
33905
33906
33907
33908
33909
33910
33911
33912
33913
33914
33915
33916
33917
33918
33919
33920
33921
33922
33923
33924
33925
33926
33927
33928
33929
33930
33931
33932
33933
33934
33935
33936
33937
33938
33939
33940
33941
33942
33943
33944
33945
33946
33947
33948
33949
33950
33951
33952
33953
33954
33955
33956
33957
33958
33959
33960
33961
33962
33963
33964
33965
33966
33967
33968
33969
33970
33971
33972
33973
33974
33975
33976
33977
33978
33979
33980
33981
33982
33983
33984
33985
33986
33987
33988
33989
33990
33991
33992
33993
33994
33995
33996
33997
33998
33999
34000
34001
34002
34003
34004
34005
34006
34007
34008
34009
34010
34011
34012
34013
34014
34015
34016
34017
34018
34019
34020
34021
34022
34023
34024
34025
34026
34027
34028
34029
34030
34031
34032
34033
34034
34035
34036
34037
34038
34039
34040
34041
34042
34043
34044
34045
34046
34047
34048
34049
34050
34051
34052
34053
34054
34055
34056
34057
34058
34059
34060
34061
34062
34063
34064
34065
34066
34067
34068
34069
34070
34071
34072
34073
34074
34075
34076
34077
34078
34079
34080
34081
34082
34083
34084
34085
34086
34087
34088
34089
34090
34091
34092
34093
34094
34095
34096
34097
34098
34099
34100
34101
34102
34103
34104
34105
34106
34107
34108
34109
34110
34111
34112
34113
34114
34115
34116
34117
34118
34119
34120
34121
34122
34123
34124
34125
34126
34127
34128
34129
34130
34131
34132
34133
34134
34135
34136
34137
34138
34139
34140
34141
34142
34143
34144
34145
34146
34147
34148
34149
34150
34151
34152
34153
34154
34155
34156
34157
34158
34159
34160
34161
34162
34163
34164
34165
34166
34167
34168
34169
34170
34171
34172
34173
34174
34175
34176
34177
34178
34179
34180
34181
34182
34183
34184
34185
34186
34187
34188
34189
34190
34191
34192
34193
34194
34195
34196
34197
34198
34199
34200
34201
34202
34203
34204
34205
34206
34207
34208
34209
34210
34211
34212
34213
34214
34215
34216
34217
34218
34219
34220
34221
34222
34223
34224
34225
34226
34227
34228
34229
34230
34231
34232
34233
34234
34235
34236
34237
34238
34239
34240
34241
34242
34243
34244
34245
34246
34247
34248
34249
34250
34251
34252
34253
34254
34255
34256
34257
34258
34259
34260
34261
34262
34263
34264
34265
34266
34267
34268
34269
34270
34271
34272
34273
34274
34275
34276
34277
34278
34279
34280
34281
34282
34283
34284
34285
34286
34287
34288
34289
34290
34291
34292
34293
34294
34295
34296
34297
34298
34299
34300
34301
34302
34303
34304
34305
34306
34307
34308
34309
34310
34311
34312
34313
34314
34315
34316
34317
34318
34319
34320
34321
34322
34323
34324
34325
34326
34327
34328
34329
34330
34331
34332
34333
34334
34335
34336
34337
34338
34339
34340
34341
34342
34343
34344
34345
34346
34347
34348
34349
34350
34351
34352
34353
34354
34355
34356
34357
34358
34359
34360
34361
34362
34363
34364
34365
34366
34367
34368
34369
34370
34371
34372
34373
34374
34375
34376
34377
34378
34379
34380
34381
34382
34383
34384
34385
34386
34387
34388
34389
34390
34391
34392
34393
34394
34395
34396
34397
34398
34399
34400
34401
34402
34403
34404
34405
34406
34407
34408
34409
34410
34411
34412
34413
34414
34415
34416
34417
34418
34419
34420
34421
34422
34423
34424
34425
34426
34427
34428
34429
34430
34431
34432
34433
34434
34435
34436
34437
34438
34439
34440
34441
34442
34443
34444
34445
34446
34447
34448
34449
34450
34451
34452
34453
34454
34455
34456
34457
34458
34459
34460
34461
34462
34463
34464
34465
34466
34467
34468
34469
34470
34471
34472
34473
34474
34475
34476
34477
34478
34479
34480
34481
34482
34483
34484
34485
34486
34487
34488
34489
34490
34491
34492
34493
34494
34495
34496
34497
34498
34499
34500
34501
34502
34503
34504
34505
34506
34507
34508
34509
34510
34511
34512
34513
34514
34515
34516
34517
34518
34519
34520
34521
34522
34523
34524
34525
34526
34527
34528
34529
34530
34531
34532
34533
34534
34535
34536
34537
34538
34539
34540
34541
34542
34543
34544
34545
34546
34547
34548
34549
34550
34551
34552
34553
34554
34555
34556
34557
34558
34559
34560
34561
34562
34563
34564
34565
34566
34567
34568
34569
34570
34571
34572
34573
34574
34575
34576
34577
34578
34579
34580
34581
34582
34583
34584
34585
34586
34587
34588
34589
34590
34591
34592
34593
34594
34595
34596
34597
34598
34599
34600
34601
34602
34603
34604
34605
34606
34607
34608
34609
34610
34611
34612
34613
34614
34615
34616
34617
34618
34619
34620
34621
34622
34623
34624
34625
34626
34627
34628
34629
34630
34631
34632
34633
34634
34635
34636
34637
34638
34639
34640
34641
34642
34643
34644
34645
34646
34647
34648
34649
34650
34651
34652
34653
34654
34655
34656
34657
34658
34659
34660
34661
34662
34663
34664
34665
34666
34667
34668
34669
34670
34671
34672
34673
34674
34675
34676
34677
34678
34679
34680
34681
34682
34683
34684
34685
34686
34687
34688
34689
34690
34691
34692
34693
34694
34695
34696
34697
34698
34699
34700
34701
34702
34703
34704
34705
34706
34707
34708
34709
34710
34711
34712
34713
34714
34715
34716
34717
34718
34719
34720
34721
34722
34723
34724
34725
34726
34727
34728
34729
34730
34731
34732
34733
34734
34735
34736
34737
34738
34739
34740
34741
34742
34743
34744
34745
34746
34747
34748
34749
34750
34751
34752
34753
34754
34755
34756
34757
34758
34759
34760
34761
34762
34763
34764
34765
34766
34767
34768
34769
34770
34771
34772
34773
34774
34775
34776
34777
34778
34779
34780
34781
34782
34783
34784
34785
34786
34787
34788
34789
34790
34791
34792
34793
34794
34795
34796
34797
34798
34799
34800
34801
34802
34803
34804
34805
34806
34807
34808
34809
34810
34811
34812
34813
34814
34815
34816
34817
34818
34819
34820
34821
34822
34823
34824
34825
34826
34827
34828
34829
34830
34831
34832
34833
34834
34835
34836
34837
34838
34839
34840
34841
34842
34843
34844
34845
34846
34847
34848
34849
34850
34851
34852
34853
34854
34855
34856
34857
34858
34859
34860
34861
34862
34863
34864
34865
34866
34867
34868
34869
34870
34871
34872
34873
34874
34875
34876
34877
34878
34879
34880
34881
34882
34883
34884
34885
34886
34887
34888
34889
34890
34891
34892
34893
34894
34895
34896
34897
34898
34899
34900
34901
34902
34903
34904
34905
34906
34907
34908
34909
34910
34911
34912
34913
34914
34915
34916
34917
34918
34919
34920
34921
34922
34923
34924
34925
34926
34927
34928
34929
34930
34931
34932
34933
34934
34935
34936
34937
34938
34939
34940
34941
34942
34943
34944
34945
34946
34947
34948
34949
34950
34951
34952
34953
34954
34955
34956
34957
34958
34959
34960
34961
34962
34963
34964
34965
34966
34967
34968
34969
34970
34971
34972
34973
34974
34975
34976
34977
34978
34979
34980
34981
34982
34983
34984
34985
34986
34987
34988
34989
34990
34991
34992
34993
34994
34995
34996
34997
34998
34999
35000
35001
35002
35003
35004
35005
35006
35007
35008
35009
35010
35011
35012
35013
35014
35015
35016
35017
35018
35019
35020
35021
35022
35023
35024
35025
35026
35027
35028
35029
35030
35031
35032
35033
35034
35035
35036
35037
35038
35039
35040
35041
35042
35043
35044
35045
35046
35047
35048
35049
35050
35051
35052
35053
35054
35055
35056
35057
35058
35059
35060
35061
35062
35063
35064
35065
35066
35067
35068
35069
35070
35071
35072
35073
35074
35075
35076
35077
35078
35079
35080
35081
35082
35083
35084
35085
35086
35087
35088
35089
35090
35091
35092
35093
35094
35095
35096
35097
35098
35099
35100
35101
35102
35103
35104
35105
35106
35107
35108
35109
35110
35111
35112
35113
35114
35115
35116
35117
35118
35119
35120
35121
35122
35123
35124
35125
35126
35127
35128
35129
35130
35131
35132
35133
35134
35135
35136
35137
35138
35139
35140
35141
35142
35143
35144
35145
35146
35147
35148
35149
35150
35151
35152
35153
35154
35155
35156
35157
35158
35159
35160
35161
35162
35163
35164
35165
35166
35167
35168
35169
35170
35171
35172
35173
35174
35175
35176
35177
35178
35179
35180
35181
35182
35183
35184
35185
35186
35187
35188
35189
35190
35191
35192
35193
35194
35195
35196
35197
35198
35199
35200
35201
35202
35203
35204
35205
35206
35207
35208
35209
35210
35211
35212
35213
35214
35215
35216
35217
35218
35219
35220
35221
35222
35223
35224
35225
35226
35227
35228
35229
35230
35231
35232
35233
35234
35235
35236
35237
35238
35239
35240
35241
35242
35243
35244
35245
35246
35247
35248
35249
35250
35251
35252
35253
35254
35255
35256
35257
35258
35259
35260
35261
35262
35263
35264
35265
35266
35267
35268
35269
35270
35271
35272
35273
35274
35275
35276
35277
35278
35279
35280
35281
35282
35283
35284
35285
35286
35287
35288
35289
35290
35291
35292
35293
35294
35295
35296
35297
35298
35299
35300
35301
35302
35303
35304
35305
35306
35307
35308
35309
35310
35311
35312
35313
35314
35315
35316
35317
35318
35319
35320
35321
35322
35323
35324
35325
35326
35327
35328
35329
35330
35331
35332
35333
35334
35335
35336
35337
35338
35339
35340
35341
35342
35343
35344
35345
35346
35347
35348
35349
35350
35351
35352
35353
35354
35355
35356
35357
35358
35359
35360
35361
35362
35363
35364
35365
35366
35367
35368
35369
35370
35371
35372
35373
35374
35375
35376
35377
35378
35379
35380
35381
35382
35383
35384
35385
35386
35387
35388
35389
35390
35391
35392
35393
35394
35395
35396
35397
35398
35399
35400
35401
35402
35403
35404
35405
35406
35407
35408
35409
35410
35411
35412
35413
35414
35415
35416
35417
35418
35419
35420
35421
35422
35423
35424
35425
35426
35427
35428
35429
35430
35431
35432
35433
35434
35435
35436
35437
35438
35439
35440
35441
35442
35443
35444
35445
35446
35447
35448
35449
35450
35451
35452
35453
35454
35455
35456
35457
35458
35459
35460
35461
35462
35463
35464
35465
35466
35467
35468
35469
35470
35471
35472
35473
35474
35475
35476
35477
35478
35479
35480
35481
35482
35483
35484
35485
35486
35487
35488
35489
35490
35491
35492
35493
35494
35495
35496
35497
35498
35499
35500
35501
35502
35503
35504
35505
35506
35507
35508
35509
35510
35511
35512
35513
35514
35515
35516
35517
35518
35519
35520
35521
35522
35523
35524
35525
35526
35527
35528
35529
35530
35531
35532
35533
35534
35535
35536
35537
35538
35539
35540
35541
35542
35543
35544
35545
35546
35547
35548
35549
35550
35551
35552
35553
35554
35555
35556
35557
35558
35559
35560
35561
35562
35563
35564
35565
35566
35567
35568
35569
35570
35571
35572
35573
35574
35575
35576
35577
35578
35579
35580
35581
35582
35583
35584
35585
35586
35587
35588
35589
35590
35591
35592
35593
35594
35595
35596
35597
35598
35599
35600
35601
35602
35603
35604
35605
35606
35607
35608
35609
35610
35611
35612
35613
35614
35615
35616
35617
35618
35619
35620
35621
35622
35623
35624
35625
35626
35627
35628
35629
35630
35631
35632
35633
35634
35635
35636
35637
35638
35639
35640
35641
35642
35643
35644
35645
35646
35647
35648
35649
35650
35651
35652
35653
35654
35655
35656
35657
35658
35659
35660
35661
35662
35663
35664
35665
35666
35667
35668
35669
35670
35671
35672
35673
35674
35675
35676
35677
35678
35679
35680
35681
35682
35683
35684
35685
35686
35687
35688
35689
35690
35691
35692
35693
35694
35695
35696
35697
35698
35699
35700
35701
35702
35703
35704
35705
35706
35707
35708
35709
35710
35711
35712
35713
35714
35715
35716
35717
35718
35719
35720
35721
35722
35723
35724
35725
35726
35727
35728
35729
35730
35731
35732
35733
35734
35735
35736
35737
35738
35739
35740
35741
35742
35743
35744
35745
35746
35747
35748
35749
35750
35751
35752
35753
35754
35755
35756
35757
35758
35759
35760
35761
35762
35763
35764
35765
35766
35767
35768
35769
35770
35771
35772
35773
35774
35775
35776
35777
35778
35779
35780
35781
35782
35783
35784
35785
35786
35787
35788
35789
35790
35791
35792
35793
35794
35795
35796
35797
35798
35799
35800
35801
35802
35803
35804
35805
35806
35807
35808
35809
35810
35811
35812
35813
35814
35815
35816
35817
35818
35819
35820
35821
35822
35823
35824
35825
35826
35827
35828
35829
35830
35831
35832
35833
35834
35835
35836
35837
35838
35839
35840
35841
35842
35843
35844
35845
35846
35847
35848
35849
35850
35851
35852
35853
35854
35855
35856
35857
35858
35859
35860
35861
35862
35863
35864
35865
35866
35867
35868
35869
35870
35871
35872
35873
35874
35875
35876
35877
35878
35879
35880
35881
35882
35883
35884
35885
35886
35887
35888
35889
35890
35891
35892
35893
35894
35895
35896
35897
35898
35899
35900
35901
35902
35903
35904
35905
35906
35907
35908
35909
35910
35911
35912
35913
35914
35915
35916
35917
35918
35919
35920
35921
35922
35923
35924
35925
35926
35927
35928
35929
35930
35931
35932
35933
35934
35935
35936
35937
35938
35939
35940
35941
35942
35943
35944
35945
35946
35947
35948
35949
35950
35951
35952
35953
35954
35955
35956
35957
35958
35959
35960
35961
35962
35963
35964
35965
35966
35967
35968
35969
35970
35971
35972
35973
35974
35975
35976
35977
35978
35979
35980
35981
35982
35983
35984
35985
35986
35987
35988
35989
35990
35991
35992
35993
35994
35995
35996
35997
35998
35999
36000
36001
36002
36003
36004
36005
36006
36007
36008
36009
36010
36011
36012
36013
36014
36015
36016
36017
36018
36019
36020
36021
36022
36023
36024
36025
36026
36027
36028
36029
36030
36031
36032
36033
36034
36035
36036
36037
36038
36039
36040
36041
36042
36043
36044
36045
36046
36047
36048
36049
36050
36051
36052
36053
36054
36055
36056
36057
36058
36059
36060
36061
36062
36063
36064
36065
36066
36067
36068
36069
36070
36071
36072
36073
36074
36075
36076
36077
36078
36079
36080
36081
36082
36083
36084
36085
36086
36087
36088
36089
36090
36091
36092
36093
36094
36095
36096
36097
36098
36099
36100
36101
36102
36103
36104
36105
36106
36107
36108
36109
36110
36111
36112
36113
36114
36115
36116
36117
36118
36119
36120
36121
36122
36123
36124
36125
36126
36127
36128
36129
36130
36131
36132
36133
36134
36135
36136
36137
36138
36139
36140
36141
36142
36143
36144
36145
36146
36147
36148
36149
36150
36151
36152
36153
36154
36155
36156
36157
36158
36159
36160
36161
36162
36163
36164
36165
36166
36167
36168
36169
36170
36171
36172
36173
36174
36175
36176
36177
36178
36179
36180
36181
36182
36183
36184
36185
36186
36187
36188
36189
36190
36191
36192
36193
36194
36195
36196
36197
36198
36199
36200
36201
36202
36203
36204
36205
36206
36207
36208
36209
36210
36211
36212
36213
36214
36215
36216
36217
36218
36219
36220
36221
36222
36223
36224
36225
36226
36227
36228
36229
36230
36231
36232
36233
36234
36235
36236
36237
36238
36239
36240
36241
36242
36243
36244
36245
36246
36247
36248
36249
36250
36251
36252
36253
36254
36255
36256
36257
36258
36259
36260
36261
36262
36263
36264
36265
36266
36267
36268
36269
36270
36271
36272
36273
36274
36275
36276
36277
36278
36279
36280
36281
36282
36283
36284
36285
36286
36287
36288
36289
36290
36291
36292
36293
36294
36295
36296
36297
36298
36299
36300
36301
36302
36303
36304
36305
36306
36307
36308
36309
36310
36311
36312
36313
36314
36315
36316
36317
36318
36319
36320
36321
36322
36323
36324
36325
36326
36327
36328
36329
36330
36331
36332
36333
36334
36335
36336
36337
36338
36339
36340
36341
36342
36343
36344
36345
36346
36347
36348
36349
36350
36351
36352
36353
36354
36355
36356
36357
36358
36359
36360
36361
36362
36363
36364
36365
36366
36367
36368
36369
36370
36371
36372
36373
36374
36375
36376
36377
36378
36379
36380
36381
36382
36383
36384
36385
36386
36387
36388
36389
36390
36391
36392
36393
36394
36395
36396
36397
36398
36399
36400
36401
36402
36403
36404
36405
36406
36407
36408
36409
36410
36411
36412
36413
36414
36415
36416
36417
36418
36419
36420
36421
36422
36423
36424
36425
36426
36427
36428
36429
36430
36431
36432
36433
36434
36435
36436
36437
36438
36439
36440
36441
36442
36443
36444
36445
36446
36447
36448
36449
36450
36451
36452
36453
36454
36455
36456
36457
36458
36459
36460
36461
36462
36463
36464
36465
36466
36467
36468
36469
36470
36471
36472
36473
36474
36475
36476
36477
36478
36479
36480
36481
36482
36483
36484
36485
36486
36487
36488
36489
36490
36491
36492
36493
36494
36495
36496
36497
36498
36499
36500
36501
36502
36503
36504
36505
36506
36507
36508
36509
36510
36511
36512
36513
36514
36515
36516
36517
36518
36519
36520
36521
36522
36523
36524
36525
36526
36527
36528
36529
36530
36531
36532
36533
36534
36535
36536
36537
36538
36539
36540
36541
36542
36543
36544
36545
36546
36547
36548
36549
36550
36551
36552
36553
36554
36555
36556
36557
36558
36559
36560
36561
36562
36563
36564
36565
36566
36567
36568
36569
36570
36571
36572
36573
36574
36575
36576
36577
36578
36579
36580
36581
36582
36583
36584
36585
36586
36587
36588
36589
36590
36591
36592
36593
36594
36595
36596
36597
36598
36599
36600
36601
36602
36603
36604
36605
36606
36607
36608
36609
36610
36611
36612
36613
36614
36615
36616
36617
36618
36619
36620
36621
36622
36623
36624
36625
36626
36627
36628
36629
36630
36631
36632
36633
36634
36635
36636
36637
36638
36639
36640
36641
36642
36643
36644
36645
36646
36647
36648
36649
36650
36651
36652
36653
36654
36655
36656
36657
36658
36659
36660
36661
36662
36663
36664
36665
36666
36667
36668
36669
36670
36671
36672
36673
36674
36675
36676
36677
36678
36679
36680
36681
36682
36683
36684
36685
36686
36687
36688
36689
36690
36691
36692
36693
36694
36695
36696
36697
36698
36699
36700
36701
36702
36703
36704
36705
36706
36707
36708
36709
36710
36711
36712
36713
36714
36715
36716
36717
36718
36719
36720
36721
36722
36723
36724
36725
36726
36727
36728
36729
36730
36731
36732
36733
36734
36735
36736
36737
36738
36739
36740
36741
36742
36743
36744
36745
36746
36747
36748
36749
36750
36751
36752
36753
36754
36755
36756
36757
36758
36759
36760
36761
36762
36763
36764
36765
36766
36767
36768
36769
36770
36771
36772
36773
36774
36775
36776
36777
36778
36779
36780
36781
36782
36783
36784
36785
36786
36787
36788
36789
36790
36791
36792
36793
36794
36795
36796
36797
36798
36799
36800
36801
36802
36803
36804
36805
36806
36807
36808
36809
36810
36811
36812
36813
36814
36815
36816
36817
36818
36819
36820
36821
36822
36823
36824
36825
36826
36827
36828
36829
36830
36831
36832
36833
36834
36835
36836
36837
36838
36839
36840
36841
36842
36843
36844
36845
36846
36847
36848
36849
36850
36851
36852
36853
36854
36855
36856
36857
36858
36859
36860
36861
36862
36863
36864
36865
36866
36867
36868
36869
36870
36871
36872
36873
36874
36875
36876
36877
36878
36879
36880
36881
36882
36883
36884
36885
36886
36887
36888
36889
36890
36891
36892
36893
36894
36895
36896
36897
36898
36899
36900
36901
36902
36903
36904
36905
36906
36907
36908
36909
36910
36911
36912
36913
36914
36915
36916
36917
36918
36919
36920
36921
36922
36923
36924
36925
36926
36927
36928
36929
36930
36931
36932
36933
36934
36935
36936
36937
36938
36939
36940
36941
36942
36943
36944
36945
36946
36947
36948
36949
36950
36951
36952
36953
36954
36955
36956
36957
36958
36959
36960
36961
36962
36963
36964
36965
36966
36967
36968
36969
36970
36971
36972
36973
36974
36975
36976
36977
36978
36979
36980
36981
36982
36983
36984
36985
36986
36987
36988
36989
36990
36991
36992
36993
36994
36995
36996
36997
36998
36999
37000
37001
37002
37003
37004
37005
37006
37007
37008
37009
37010
37011
37012
37013
37014
37015
37016
37017
37018
37019
37020
37021
37022
37023
37024
37025
37026
37027
37028
37029
37030
37031
37032
37033
37034
37035
37036
37037
37038
37039
37040
37041
37042
37043
37044
37045
37046
37047
37048
37049
37050
37051
37052
37053
37054
37055
37056
37057
37058
37059
37060
37061
37062
37063
37064
37065
37066
37067
37068
37069
37070
37071
37072
37073
37074
37075
37076
37077
37078
37079
37080
37081
37082
37083
37084
37085
37086
37087
37088
37089
37090
37091
37092
37093
37094
37095
37096
37097
37098
37099
37100
37101
37102
37103
37104
37105
37106
37107
37108
37109
37110
37111
37112
37113
37114
37115
37116
37117
37118
37119
37120
37121
37122
37123
37124
37125
37126
37127
37128
37129
37130
37131
37132
37133
37134
37135
37136
37137
37138
37139
37140
37141
37142
37143
37144
37145
37146
37147
37148
37149
37150
37151
37152
37153
37154
37155
37156
37157
37158
37159
37160
37161
37162
37163
37164
37165
37166
37167
37168
37169
37170
37171
37172
37173
37174
37175
37176
37177
37178
37179
37180
37181
37182
37183
37184
37185
37186
37187
37188
37189
37190
37191
37192
37193
37194
37195
37196
37197
37198
37199
37200
37201
37202
37203
37204
37205
37206
37207
37208
37209
37210
37211
37212
37213
37214
37215
37216
37217
37218
37219
37220
37221
37222
37223
37224
37225
37226
37227
37228
37229
37230
37231
37232
37233
37234
37235
37236
37237
37238
37239
37240
37241
37242
37243
37244
37245
37246
37247
37248
37249
37250
37251
37252
37253
37254
37255
37256
37257
37258
37259
37260
37261
37262
37263
37264
37265
37266
37267
37268
37269
37270
37271
37272
37273
37274
37275
37276
37277
37278
37279
37280
37281
37282
37283
37284
37285
37286
37287
37288
37289
37290
37291
37292
37293
37294
37295
37296
37297
37298
37299
37300
37301
37302
37303
37304
37305
37306
37307
37308
37309
37310
37311
37312
37313
37314
37315
37316
37317
37318
37319
37320
37321
37322
37323
37324
37325
37326
37327
37328
37329
37330
37331
37332
37333
37334
37335
37336
37337
37338
37339
37340
37341
37342
37343
37344
37345
37346
37347
37348
37349
37350
37351
37352
37353
37354
37355
37356
37357
37358
37359
37360
37361
37362
37363
37364
37365
37366
37367
37368
37369
37370
37371
37372
37373
37374
37375
37376
37377
37378
37379
37380
37381
37382
37383
37384
37385
37386
37387
37388
37389
37390
37391
37392
37393
37394
37395
37396
37397
37398
37399
37400
37401
37402
37403
37404
37405
37406
37407
37408
37409
37410
37411
37412
37413
37414
37415
37416
37417
37418
37419
37420
37421
37422
37423
37424
37425
37426
37427
37428
37429
37430
37431
37432
37433
37434
37435
37436
37437
37438
37439
37440
37441
37442
37443
37444
37445
37446
37447
37448
37449
37450
37451
37452
37453
37454
37455
37456
37457
37458
37459
37460
37461
37462
37463
37464
37465
37466
37467
37468
37469
37470
37471
37472
37473
37474
37475
37476
37477
37478
37479
37480
37481
37482
37483
37484
37485
37486
37487
37488
37489
37490
37491
37492
37493
37494
37495
37496
37497
37498
37499
37500
37501
37502
37503
37504
37505
37506
37507
37508
37509
37510
37511
37512
37513
37514
37515
37516
37517
37518
37519
37520
37521
37522
37523
37524
37525
37526
37527
37528
37529
37530
37531
37532
37533
37534
37535
37536
37537
37538
37539
37540
37541
37542
37543
37544
37545
37546
37547
37548
37549
37550
37551
37552
37553
37554
37555
37556
37557
37558
37559
37560
37561
37562
37563
37564
37565
37566
37567
37568
37569
37570
37571
37572
37573
37574
37575
37576
37577
37578
37579
37580
37581
37582
37583
37584
37585
37586
37587
37588
37589
37590
37591
37592
37593
37594
37595
37596
37597
37598
37599
37600
37601
37602
37603
37604
37605
37606
37607
37608
37609
37610
37611
37612
37613
37614
37615
37616
37617
37618
37619
37620
37621
37622
37623
37624
37625
37626
37627
37628
37629
37630
37631
37632
37633
37634
37635
37636
37637
37638
37639
37640
37641
37642
37643
37644
37645
37646
37647
37648
37649
37650
37651
37652
37653
37654
37655
37656
37657
37658
37659
37660
37661
37662
37663
37664
37665
37666
37667
37668
37669
37670
37671
37672
37673
37674
37675
37676
37677
37678
37679
37680
37681
37682
37683
37684
37685
37686
37687
37688
37689
37690
37691
37692
37693
37694
37695
37696
37697
37698
37699
37700
37701
37702
37703
37704
37705
37706
37707
37708
37709
37710
37711
37712
37713
37714
37715
37716
37717
37718
37719
37720
37721
37722
37723
37724
37725
37726
37727
37728
37729
37730
37731
37732
37733
37734
37735
37736
37737
37738
37739
37740
37741
37742
37743
37744
37745
37746
37747
37748
37749
37750
37751
37752
37753
37754
37755
37756
37757
37758
37759
37760
37761
37762
37763
37764
37765
37766
37767
37768
37769
37770
37771
37772
37773
37774
37775
37776
37777
37778
37779
37780
37781
37782
37783
37784
37785
37786
37787
37788
37789
37790
37791
37792
37793
37794
37795
37796
37797
37798
37799
37800
37801
37802
37803
37804
37805
37806
37807
37808
37809
37810
37811
37812
37813
37814
37815
37816
37817
37818
37819
37820
37821
37822
37823
37824
37825
37826
37827
37828
37829
37830
37831
37832
37833
37834
37835
37836
37837
37838
37839
37840
37841
37842
37843
37844
37845
37846
37847
37848
37849
37850
37851
37852
37853
37854
37855
37856
37857
37858
37859
37860
37861
37862
37863
37864
37865
37866
37867
37868
37869
37870
37871
37872
37873
37874
37875
37876
37877
37878
37879
37880
37881
37882
37883
37884
37885
37886
37887
37888
37889
37890
37891
37892
37893
37894
37895
37896
37897
37898
37899
37900
37901
37902
37903
37904
37905
37906
37907
37908
37909
37910
37911
37912
37913
37914
37915
37916
37917
37918
37919
37920
37921
37922
37923
37924
37925
37926
37927
37928
37929
37930
37931
37932
37933
37934
37935
37936
37937
37938
37939
37940
37941
37942
37943
37944
37945
37946
37947
37948
37949
37950
37951
37952
37953
37954
37955
37956
37957
37958
37959
37960
37961
37962
37963
37964
37965
37966
37967
37968
37969
37970
37971
37972
37973
37974
37975
37976
37977
37978
37979
37980
37981
37982
37983
37984
37985
37986
37987
37988
37989
37990
37991
37992
37993
37994
37995
37996
37997
37998
37999
38000
38001
38002
38003
38004
38005
38006
38007
38008
38009
38010
38011
38012
38013
38014
38015
38016
38017
38018
38019
38020
38021
38022
38023
38024
38025
38026
38027
38028
38029
38030
38031
38032
38033
38034
38035
38036
38037
38038
38039
38040
38041
38042
38043
38044
38045
38046
38047
38048
38049
38050
38051
38052
38053
38054
38055
38056
38057
38058
38059
38060
38061
38062
38063
38064
38065
38066
38067
38068
38069
38070
38071
38072
38073
38074
38075
38076
38077
38078
38079
38080
38081
38082
38083
38084
38085
38086
38087
38088
38089
38090
38091
38092
38093
38094
38095
38096
38097
38098
38099
38100
38101
38102
38103
38104
38105
38106
38107
38108
38109
38110
38111
38112
38113
38114
38115
38116
38117
38118
38119
38120
38121
38122
38123
38124
38125
38126
38127
38128
38129
38130
38131
38132
38133
38134
38135
38136
38137
38138
38139
38140
38141
38142
38143
38144
38145
38146
38147
38148
38149
38150
38151
38152
38153
38154
38155
38156
38157
38158
38159
38160
38161
38162
38163
38164
38165
38166
38167
38168
38169
38170
38171
38172
38173
38174
38175
38176
38177
38178
38179
38180
38181
38182
38183
38184
38185
38186
38187
38188
38189
38190
38191
38192
38193
38194
38195
38196
38197
38198
38199
38200
38201
38202
38203
38204
38205
38206
38207
38208
38209
38210
38211
38212
38213
38214
38215
38216
38217
38218
38219
38220
38221
38222
38223
38224
38225
38226
38227
38228
38229
38230
38231
38232
38233
38234
38235
38236
38237
38238
38239
38240
38241
38242
38243
38244
38245
38246
38247
38248
38249
38250
38251
38252
38253
38254
38255
38256
38257
38258
38259
38260
38261
38262
38263
38264
38265
38266
38267
38268
38269
38270
38271
38272
38273
38274
38275
38276
38277
38278
38279
38280
38281
38282
38283
38284
38285
38286
38287
38288
38289
38290
38291
38292
38293
38294
38295
38296
38297
38298
38299
38300
38301
38302
38303
38304
38305
38306
38307
38308
38309
38310
38311
38312
38313
38314
38315
38316
38317
38318
38319
38320
38321
38322
38323
38324
38325
38326
38327
38328
38329
38330
38331
38332
38333
38334
38335
38336
38337
38338
38339
38340
38341
38342
38343
38344
38345
38346
38347
38348
38349
38350
38351
38352
38353
38354
38355
38356
38357
38358
38359
38360
38361
38362
38363
38364
38365
38366
38367
38368
38369
38370
38371
38372
38373
38374
38375
38376
38377
38378
38379
38380
38381
38382
38383
38384
38385
38386
38387
38388
38389
38390
38391
38392
38393
38394
38395
38396
38397
38398
38399
38400
38401
38402
38403
38404
38405
38406
38407
38408
38409
38410
38411
38412
38413
38414
38415
38416
38417
38418
38419
38420
38421
38422
38423
38424
38425
38426
38427
38428
38429
38430
38431
38432
38433
38434
38435
38436
38437
38438
38439
38440
38441
38442
38443
38444
38445
38446
38447
38448
38449
38450
38451
38452
38453
38454
38455
38456
38457
38458
38459
38460
38461
38462
38463
38464
38465
38466
38467
38468
38469
38470
38471
38472
38473
38474
38475
38476
38477
38478
38479
38480
38481
38482
38483
38484
38485
38486
38487
38488
38489
38490
38491
38492
38493
38494
38495
38496
38497
38498
38499
38500
38501
38502
38503
38504
38505
38506
38507
38508
38509
38510
38511
38512
38513
38514
38515
38516
38517
38518
38519
38520
38521
38522
38523
38524
38525
38526
38527
38528
38529
38530
38531
38532
38533
38534
38535
38536
38537
38538
38539
38540
38541
38542
38543
38544
38545
38546
38547
38548
38549
38550
38551
38552
38553
38554
38555
38556
38557
38558
38559
38560
38561
38562
38563
38564
38565
38566
38567
38568
38569
38570
38571
38572
38573
38574
38575
38576
38577
38578
38579
38580
38581
38582
38583
38584
38585
38586
38587
38588
38589
38590
38591
38592
38593
38594
38595
38596
38597
38598
38599
38600
38601
38602
38603
38604
38605
38606
38607
38608
38609
38610
38611
38612
38613
38614
38615
38616
38617
38618
38619
38620
38621
38622
38623
38624
38625
38626
38627
38628
38629
38630
38631
38632
38633
38634
38635
38636
38637
38638
38639
38640
38641
38642
38643
38644
38645
38646
38647
38648
38649
38650
38651
38652
38653
38654
38655
38656
38657
38658
38659
38660
38661
38662
38663
38664
38665
38666
38667
38668
38669
38670
38671
38672
38673
38674
38675
38676
38677
38678
38679
38680
38681
38682
38683
38684
38685
38686
38687
38688
38689
38690
38691
38692
38693
38694
38695
38696
38697
38698
38699
38700
38701
38702
38703
38704
38705
38706
38707
38708
38709
38710
38711
38712
38713
38714
38715
38716
38717
38718
38719
38720
38721
38722
38723
38724
38725
38726
38727
38728
38729
38730
38731
38732
38733
38734
38735
38736
38737
38738
38739
38740
38741
38742
38743
38744
38745
38746
38747
38748
38749
38750
38751
38752
38753
38754
38755
38756
38757
38758
38759
38760
38761
38762
38763
38764
38765
38766
38767
38768
38769
38770
38771
38772
38773
38774
38775
38776
38777
38778
38779
38780
38781
38782
38783
38784
38785
38786
38787
38788
38789
38790
38791
38792
38793
38794
38795
38796
38797
38798
38799
38800
38801
38802
38803
38804
38805
38806
38807
38808
38809
38810
38811
38812
38813
38814
38815
38816
38817
38818
38819
38820
38821
38822
38823
38824
38825
38826
38827
38828
38829
38830
38831
38832
38833
38834
38835
38836
38837
38838
38839
38840
38841
38842
38843
38844
38845
38846
38847
38848
38849
38850
38851
38852
38853
38854
38855
38856
38857
38858
38859
38860
38861
38862
38863
38864
38865
38866
38867
38868
38869
38870
38871
38872
38873
38874
38875
38876
38877
38878
38879
38880
38881
38882
38883
38884
38885
38886
38887
38888
38889
38890
38891
38892
38893
38894
38895
38896
38897
38898
38899
38900
38901
38902
38903
38904
38905
38906
38907
38908
38909
38910
38911
38912
38913
38914
38915
38916
38917
38918
38919
38920
38921
38922
38923
38924
38925
38926
38927
38928
38929
38930
38931
38932
38933
38934
38935
38936
38937
38938
38939
38940
38941
38942
38943
38944
38945
38946
38947
38948
38949
38950
38951
38952
38953
38954
38955
38956
38957
38958
38959
38960
38961
38962
38963
38964
38965
38966
38967
38968
38969
38970
38971
38972
38973
38974
38975
38976
38977
38978
38979
38980
38981
38982
38983
38984
38985
38986
38987
38988
38989
38990
38991
38992
38993
38994
38995
38996
38997
38998
38999
39000
39001
39002
39003
39004
39005
39006
39007
39008
39009
39010
39011
39012
39013
39014
39015
39016
39017
39018
39019
39020
39021
39022
39023
39024
39025
39026
39027
39028
39029
39030
39031
39032
39033
39034
39035
39036
39037
39038
39039
39040
39041
39042
39043
39044
39045
39046
39047
39048
39049
39050
39051
39052
39053
39054
39055
39056
39057
39058
39059
39060
39061
39062
39063
39064
39065
39066
39067
39068
39069
39070
39071
39072
39073
39074
39075
39076
39077
39078
39079
39080
39081
39082
39083
39084
39085
39086
39087
39088
39089
39090
39091
39092
39093
39094
39095
39096
39097
39098
39099
39100
39101
39102
39103
39104
39105
39106
39107
39108
39109
39110
39111
39112
39113
39114
39115
39116
39117
39118
39119
39120
39121
39122
39123
39124
39125
39126
39127
39128
39129
39130
39131
39132
39133
39134
39135
39136
39137
39138
39139
39140
39141
39142
39143
39144
39145
39146
39147
39148
39149
39150
39151
39152
39153
39154
39155
39156
39157
39158
39159
39160
39161
39162
39163
39164
39165
39166
39167
39168
39169
39170
39171
39172
39173
39174
39175
39176
39177
39178
39179
39180
39181
39182
39183
39184
39185
39186
39187
39188
39189
39190
39191
39192
39193
39194
39195
39196
39197
39198
39199
39200
39201
39202
39203
39204
39205
39206
39207
39208
39209
39210
39211
39212
39213
39214
39215
39216
39217
39218
39219
39220
39221
39222
39223
39224
39225
39226
39227
39228
39229
39230
39231
39232
39233
39234
39235
39236
39237
39238
39239
39240
39241
39242
39243
39244
39245
39246
39247
39248
39249
39250
39251
39252
39253
39254
39255
39256
39257
39258
39259
39260
39261
39262
39263
39264
39265
39266
39267
39268
39269
39270
39271
39272
39273
39274
39275
39276
39277
39278
39279
39280
39281
39282
39283
39284
39285
39286
39287
39288
39289
39290
39291
39292
39293
39294
39295
39296
39297
39298
39299
39300
39301
39302
39303
39304
39305
39306
39307
39308
39309
39310
39311
39312
39313
39314
39315
39316
39317
39318
39319
39320
39321
39322
39323
39324
39325
39326
39327
39328
39329
39330
39331
39332
39333
39334
39335
39336
39337
39338
39339
39340
39341
39342
39343
39344
39345
39346
39347
39348
39349
39350
39351
39352
39353
39354
39355
39356
39357
39358
39359
39360
39361
39362
39363
39364
39365
39366
39367
39368
39369
39370
39371
39372
39373
39374
39375
39376
39377
39378
39379
39380
39381
39382
39383
39384
39385
39386
39387
39388
39389
39390
39391
39392
39393
39394
39395
39396
39397
39398
39399
39400
39401
39402
39403
39404
39405
39406
39407
39408
39409
39410
39411
39412
39413
39414
39415
39416
39417
39418
39419
39420
39421
39422
39423
39424
39425
39426
39427
39428
39429
39430
39431
39432
39433
39434
39435
39436
39437
39438
39439
39440
39441
39442
39443
39444
39445
39446
39447
39448
39449
39450
39451
39452
39453
39454
39455
39456
39457
39458
39459
39460
39461
39462
39463
39464
39465
39466
39467
39468
39469
39470
39471
39472
39473
39474
39475
39476
39477
39478
39479
39480
39481
39482
39483
39484
39485
39486
39487
39488
39489
39490
39491
39492
39493
39494
39495
39496
39497
39498
39499
39500
39501
39502
39503
39504
39505
39506
39507
39508
39509
39510
39511
39512
39513
39514
39515
39516
39517
39518
39519
39520
39521
39522
39523
39524
39525
39526
39527
39528
39529
39530
39531
39532
39533
39534
39535
39536
39537
39538
39539
39540
39541
39542
39543
39544
39545
39546
39547
39548
39549
39550
39551
39552
39553
39554
39555
39556
39557
39558
39559
39560
39561
39562
39563
39564
39565
39566
39567
39568
39569
39570
39571
39572
39573
39574
39575
39576
39577
39578
39579
39580
39581
39582
39583
39584
39585
39586
39587
39588
39589
39590
39591
39592
39593
39594
39595
39596
39597
39598
39599
39600
39601
39602
39603
39604
39605
39606
39607
39608
39609
39610
39611
39612
39613
39614
39615
39616
39617
39618
39619
39620
39621
39622
39623
39624
39625
39626
39627
39628
39629
39630
39631
39632
39633
39634
39635
39636
39637
39638
39639
39640
39641
39642
39643
39644
39645
39646
39647
39648
39649
39650
39651
39652
39653
39654
39655
39656
39657
39658
39659
39660
39661
39662
39663
39664
39665
39666
39667
39668
39669
39670
39671
39672
39673
39674
39675
39676
39677
39678
39679
39680
39681
39682
39683
39684
39685
39686
39687
39688
39689
39690
39691
39692
39693
39694
39695
39696
39697
39698
39699
39700
39701
39702
39703
39704
39705
39706
39707
39708
39709
39710
39711
39712
39713
39714
39715
39716
39717
39718
39719
39720
39721
39722
39723
39724
39725
39726
39727
39728
39729
39730
39731
39732
39733
39734
39735
39736
39737
39738
39739
39740
39741
39742
39743
39744
39745
39746
39747
39748
39749
39750
39751
39752
39753
39754
39755
39756
39757
39758
39759
39760
39761
39762
39763
39764
39765
39766
39767
39768
39769
39770
39771
39772
39773
39774
39775
39776
39777
39778
39779
39780
39781
39782
39783
39784
39785
39786
39787
39788
39789
39790
39791
39792
39793
39794
39795
39796
39797
39798
39799
39800
39801
39802
39803
39804
39805
39806
39807
39808
39809
39810
39811
39812
39813
39814
39815
39816
39817
39818
39819
39820
39821
39822
39823
39824
39825
39826
39827
39828
39829
39830
39831
39832
39833
39834
39835
39836
39837
39838
39839
39840
39841
39842
39843
39844
39845
39846
39847
39848
39849
39850
39851
39852
39853
39854
39855
39856
39857
39858
39859
39860
39861
39862
39863
39864
39865
39866
39867
39868
39869
39870
39871
39872
39873
39874
39875
39876
39877
39878
39879
39880
39881
39882
39883
39884
39885
39886
39887
39888
39889
39890
39891
39892
39893
39894
39895
39896
39897
39898
39899
39900
39901
39902
39903
39904
39905
39906
39907
39908
39909
39910
39911
39912
39913
39914
39915
39916
39917
39918
39919
39920
39921
39922
39923
39924
39925
39926
39927
39928
39929
39930
39931
39932
39933
39934
39935
39936
39937
39938
39939
39940
39941
39942
39943
39944
39945
39946
39947
39948
39949
39950
39951
39952
39953
39954
39955
39956
39957
39958
39959
39960
39961
39962
39963
39964
39965
39966
39967
39968
39969
39970
39971
39972
39973
39974
39975
39976
39977
39978
39979
39980
39981
39982
39983
39984
39985
39986
39987
39988
39989
39990
39991
39992
39993
39994
39995
39996
39997
39998
39999
40000
40001
40002
40003
40004
40005
40006
40007
40008
40009
40010
40011
40012
40013
40014
40015
40016
40017
40018
40019
40020
40021
40022
40023
40024
40025
40026
40027
40028
40029
40030
40031
40032
40033
40034
40035
40036
40037
40038
40039
40040
40041
40042
40043
40044
40045
40046
40047
40048
40049
40050
40051
40052
40053
40054
40055
40056
40057
40058
40059
40060
40061
40062
40063
40064
40065
40066
40067
40068
40069
40070
40071
40072
40073
40074
40075
40076
40077
40078
40079
40080
40081
40082
40083
40084
40085
40086
40087
40088
40089
40090
40091
40092
40093
40094
40095
40096
40097
40098
40099
40100
40101
40102
40103
40104
40105
40106
40107
40108
40109
40110
40111
40112
40113
40114
40115
40116
40117
40118
40119
40120
40121
40122
40123
40124
40125
40126
40127
40128
40129
40130
40131
40132
40133
40134
40135
40136
40137
40138
40139
40140
40141
40142
40143
40144
40145
40146
40147
40148
40149
40150
40151
40152
40153
40154
40155
40156
40157
40158
40159
40160
40161
40162
40163
40164
40165
40166
40167
40168
40169
40170
40171
40172
40173
40174
40175
40176
40177
40178
40179
40180
40181
40182
40183
40184
40185
40186
40187
40188
40189
40190
40191
40192
40193
40194
40195
40196
40197
40198
40199
40200
40201
40202
40203
40204
40205
40206
40207
40208
40209
40210
40211
40212
40213
40214
40215
40216
40217
40218
40219
40220
40221
40222
40223
40224
40225
40226
40227
40228
40229
40230
40231
40232
40233
40234
40235
40236
40237
40238
40239
40240
40241
40242
40243
40244
40245
40246
40247
40248
40249
40250
40251
40252
40253
40254
40255
40256
40257
40258
40259
40260
40261
40262
40263
40264
40265
40266
40267
40268
40269
40270
40271
40272
40273
40274
40275
40276
40277
40278
40279
40280
40281
40282
40283
40284
40285
40286
40287
40288
40289
40290
40291
40292
40293
40294
40295
40296
40297
40298
40299
40300
40301
40302
40303
40304
40305
40306
40307
40308
40309
40310
40311
40312
40313
40314
40315
40316
40317
40318
40319
40320
40321
40322
40323
40324
40325
40326
40327
40328
40329
40330
40331
40332
40333
40334
40335
40336
40337
40338
40339
40340
40341
40342
40343
40344
40345
40346
40347
40348
40349
40350
40351
40352
40353
40354
40355
40356
40357
40358
40359
40360
40361
40362
40363
40364
40365
40366
40367
40368
40369
40370
40371
40372
40373
40374
40375
40376
40377
40378
40379
40380
40381
40382
40383
40384
40385
40386
40387
40388
40389
40390
40391
40392
40393
40394
40395
40396
40397
40398
40399
40400
40401
40402
40403
40404
40405
40406
40407
40408
40409
40410
40411
40412
40413
40414
40415
40416
40417
40418
40419
40420
40421
40422
40423
40424
40425
40426
40427
40428
40429
40430
40431
40432
40433
40434
40435
40436
40437
40438
40439
40440
40441
40442
40443
40444
40445
40446
40447
40448
40449
40450
40451
40452
40453
40454
40455
40456
40457
40458
40459
40460
40461
40462
40463
40464
40465
40466
40467
40468
40469
40470
40471
40472
40473
40474
40475
40476
40477
40478
40479
40480
40481
40482
40483
40484
40485
40486
40487
40488
40489
40490
40491
40492
40493
40494
40495
40496
40497
40498
40499
40500
40501
40502
40503
40504
40505
40506
40507
40508
40509
40510
40511
40512
40513
40514
40515
40516
40517
40518
40519
40520
40521
40522
40523
40524
40525
40526
40527
40528
40529
40530
40531
40532
40533
40534
40535
40536
40537
40538
40539
40540
40541
40542
40543
40544
40545
40546
40547
40548
40549
40550
40551
40552
40553
40554
40555
40556
40557
40558
40559
40560
40561
40562
40563
40564
40565
40566
40567
40568
40569
40570
40571
40572
40573
40574
40575
40576
40577
40578
40579
40580
40581
40582
40583
40584
40585
40586
40587
40588
40589
40590
40591
40592
40593
40594
40595
40596
40597
40598
40599
40600
40601
40602
40603
40604
40605
40606
40607
40608
40609
40610
40611
40612
40613
40614
40615
40616
40617
40618
40619
40620
40621
40622
40623
40624
40625
40626
40627
40628
40629
40630
40631
40632
40633
40634
40635
40636
40637
40638
40639
40640
40641
40642
40643
40644
40645
40646
40647
40648
40649
40650
40651
40652
40653
40654
40655
40656
40657
40658
40659
40660
40661
40662
40663
40664
40665
40666
40667
40668
40669
40670
40671
40672
40673
40674
40675
40676
40677
40678
40679
40680
40681
40682
40683
40684
40685
40686
40687
40688
40689
40690
40691
40692
40693
40694
40695
40696
40697
40698
40699
40700
40701
40702
40703
40704
40705
40706
40707
40708
40709
40710
40711
40712
40713
40714
40715
40716
40717
40718
40719
40720
40721
40722
40723
40724
40725
40726
40727
40728
40729
40730
40731
40732
40733
40734
40735
40736
40737
40738
40739
40740
40741
40742
40743
40744
40745
40746
40747
40748
40749
40750
40751
40752
40753
40754
40755
40756
40757
40758
40759
40760
40761
40762
40763
40764
40765
40766
40767
40768
40769
40770
40771
40772
40773
40774
40775
40776
40777
40778
40779
40780
40781
40782
40783
40784
40785
40786
40787
40788
40789
40790
40791
40792
40793
40794
40795
40796
40797
40798
40799
40800
40801
40802
40803
40804
40805
40806
40807
40808
40809
40810
40811
40812
40813
40814
40815
40816
40817
40818
40819
40820
40821
40822
40823
40824
40825
40826
40827
40828
40829
40830
40831
40832
40833
40834
40835
40836
40837
40838
40839
40840
40841
40842
40843
40844
40845
40846
40847
40848
40849
40850
40851
40852
40853
40854
40855
40856
40857
40858
40859
40860
40861
40862
40863
40864
40865
40866
40867
40868
40869
40870
40871
40872
40873
40874
40875
40876
40877
40878
40879
40880
40881
40882
40883
40884
40885
40886
40887
40888
40889
40890
40891
40892
40893
40894
40895
40896
40897
40898
40899
40900
40901
40902
40903
40904
40905
40906
40907
40908
40909
40910
40911
40912
40913
40914
40915
40916
40917
40918
40919
40920
40921
40922
40923
40924
40925
40926
40927
40928
40929
40930
40931
40932
40933
40934
40935
40936
40937
40938
40939
40940
40941
40942
40943
40944
40945
40946
40947
40948
40949
40950
40951
40952
40953
40954
40955
40956
40957
40958
40959
40960
40961
40962
40963
40964
40965
40966
40967
40968
40969
40970
40971
40972
40973
40974
40975
40976
40977
40978
40979
40980
40981
40982
40983
40984
40985
40986
40987
40988
40989
40990
40991
40992
40993
40994
40995
40996
40997
40998
40999
41000
41001
41002
41003
41004
41005
41006
41007
41008
41009
41010
41011
41012
41013
41014
41015
41016
41017
41018
41019
41020
41021
41022
41023
41024
41025
41026
41027
41028
41029
41030
41031
41032
41033
41034
41035
41036
41037
41038
41039
41040
41041
41042
41043
41044
41045
41046
41047
41048
41049
41050
41051
41052
41053
41054
41055
41056
41057
41058
41059
41060
41061
41062
41063
41064
41065
41066
41067
41068
41069
41070
41071
41072
41073
41074
41075
41076
41077
41078
41079
41080
41081
41082
41083
41084
41085
41086
41087
41088
41089
41090
41091
41092
41093
41094
41095
41096
41097
41098
41099
41100
41101
41102
41103
41104
41105
41106
41107
41108
41109
41110
41111
41112
41113
41114
41115
41116
41117
41118
41119
41120
41121
41122
41123
41124
41125
41126
41127
41128
41129
41130
41131
41132
41133
41134
41135
41136
41137
41138
41139
41140
41141
41142
41143
41144
41145
41146
41147
41148
41149
41150
41151
41152
41153
41154
41155
41156
41157
41158
41159
41160
41161
41162
41163
41164
41165
41166
41167
41168
41169
41170
41171
41172
41173
41174
41175
41176
41177
41178
41179
41180
41181
41182
41183
41184
41185
41186
41187
41188
41189
41190
41191
41192
41193
41194
41195
41196
41197
41198
41199
41200
41201
41202
41203
41204
41205
41206
41207
41208
41209
41210
41211
41212
41213
41214
41215
41216
41217
41218
41219
41220
41221
41222
41223
41224
41225
41226
41227
41228
41229
41230
41231
41232
41233
41234
41235
41236
41237
41238
41239
41240
41241
41242
41243
41244
41245
41246
41247
41248
41249
41250
41251
41252
41253
41254
41255
41256
41257
41258
41259
41260
41261
41262
41263
41264
41265
41266
41267
41268
41269
41270
41271
41272
41273
41274
41275
41276
41277
41278
41279
41280
41281
41282
41283
41284
41285
41286
41287
41288
41289
41290
41291
41292
41293
41294
41295
41296
41297
41298
41299
41300
41301
41302
41303
41304
41305
41306
41307
41308
41309
41310
41311
41312
41313
41314
41315
41316
41317
41318
41319
41320
41321
41322
41323
41324
41325
41326
41327
41328
41329
41330
41331
41332
41333
41334
41335
41336
41337
41338
41339
41340
41341
41342
41343
41344
41345
41346
41347
41348
41349
41350
41351
41352
41353
41354
41355
41356
41357
41358
41359
41360
41361
41362
41363
41364
41365
41366
41367
41368
41369
41370
41371
41372
41373
41374
41375
41376
41377
41378
41379
41380
41381
41382
41383
41384
41385
41386
41387
41388
41389
41390
41391
41392
41393
41394
41395
41396
41397
41398
41399
41400
41401
41402
41403
41404
41405
41406
41407
41408
41409
41410
41411
41412
41413
41414
41415
41416
41417
41418
41419
41420
41421
41422
41423
41424
41425
41426
41427
41428
41429
41430
41431
41432
41433
41434
41435
41436
41437
41438
41439
41440
41441
41442
41443
41444
41445
41446
41447
41448
41449
41450
41451
41452
41453
41454
41455
41456
41457
41458
41459
41460
41461
41462
41463
41464
41465
41466
41467
41468
41469
41470
41471
41472
41473
41474
41475
41476
41477
41478
41479
41480
41481
41482
41483
41484
41485
41486
41487
41488
41489
41490
41491
41492
41493
41494
41495
41496
41497
41498
41499
41500
41501
41502
41503
41504
41505
41506
41507
41508
41509
41510
41511
41512
41513
41514
41515
41516
41517
41518
41519
41520
41521
41522
41523
41524
41525
41526
41527
41528
41529
41530
41531
41532
41533
41534
41535
41536
41537
41538
41539
41540
41541
41542
41543
41544
41545
41546
41547
41548
41549
41550
41551
41552
41553
41554
41555
41556
41557
41558
41559
41560
41561
41562
41563
41564
41565
41566
41567
41568
41569
41570
41571
41572
41573
41574
41575
41576
41577
41578
41579
41580
41581
41582
41583
41584
41585
41586
41587
41588
41589
41590
41591
41592
41593
41594
41595
41596
41597
41598
41599
41600
41601
41602
41603
41604
41605
41606
41607
41608
41609
41610
41611
41612
41613
41614
41615
41616
41617
41618
41619
41620
41621
41622
41623
41624
41625
41626
41627
41628
41629
41630
41631
41632
41633
41634
41635
41636
41637
41638
41639
41640
41641
41642
41643
41644
41645
41646
41647
41648
41649
41650
41651
41652
41653
41654
41655
41656
41657
41658
41659
41660
41661
41662
41663
41664
41665
41666
41667
41668
41669
41670
41671
41672
41673
41674
41675
41676
41677
41678
41679
41680
41681
41682
41683
41684
41685
41686
41687
41688
41689
41690
41691
41692
41693
41694
41695
41696
41697
41698
41699
41700
41701
41702
41703
41704
41705
41706
41707
41708
41709
41710
41711
41712
41713
41714
41715
41716
41717
41718
41719
41720
41721
41722
41723
41724
41725
41726
41727
41728
41729
41730
41731
41732
41733
41734
41735
41736
41737
41738
41739
41740
41741
41742
41743
41744
41745
41746
41747
41748
41749
41750
41751
41752
41753
41754
41755
41756
41757
41758
41759
41760
41761
41762
41763
41764
41765
41766
41767
41768
41769
41770
41771
41772
41773
41774
41775
41776
41777
41778
41779
41780
41781
41782
41783
41784
41785
41786
41787
41788
41789
41790
41791
41792
41793
41794
41795
41796
41797
41798
41799
41800
41801
41802
41803
41804
41805
41806
41807
41808
41809
41810
41811
41812
41813
41814
41815
41816
41817
41818
41819
41820
41821
41822
41823
41824
41825
41826
41827
41828
41829
41830
41831
41832
41833
41834
41835
41836
41837
41838
41839
41840
41841
41842
41843
41844
41845
41846
41847
41848
41849
41850
41851
41852
41853
41854
41855
41856
41857
41858
41859
41860
41861
41862
41863
41864
41865
41866
41867
41868
41869
41870
41871
41872
41873
41874
41875
41876
41877
41878
41879
41880
41881
41882
41883
41884
41885
41886
41887
41888
41889
41890
41891
41892
41893
41894
41895
41896
41897
41898
41899
41900
41901
41902
41903
41904
41905
41906
41907
41908
41909
41910
41911
41912
41913
41914
41915
41916
41917
41918
41919
41920
41921
41922
41923
41924
41925
41926
41927
41928
41929
41930
41931
41932
41933
41934
41935
41936
41937
41938
41939
41940
41941
41942
41943
41944
41945
41946
41947
41948
41949
41950
41951
41952
41953
41954
41955
41956
41957
41958
41959
41960
41961
41962
41963
41964
41965
41966
41967
41968
41969
41970
41971
41972
41973
41974
41975
41976
41977
41978
41979
41980
41981
41982
41983
41984
41985
41986
41987
41988
41989
41990
41991
41992
41993
41994
41995
41996
41997
41998
41999
42000
42001
42002
42003
42004
42005
42006
42007
42008
42009
42010
42011
42012
42013
42014
42015
42016
42017
42018
42019
42020
42021
42022
42023
42024
42025
42026
42027
42028
42029
42030
42031
42032
42033
42034
42035
42036
42037
42038
42039
42040
42041
42042
42043
42044
42045
42046
42047
42048
42049
42050
42051
42052
42053
42054
42055
42056
42057
42058
42059
42060
42061
42062
42063
42064
42065
42066
42067
42068
42069
42070
42071
42072
42073
42074
42075
42076
42077
42078
42079
42080
42081
42082
42083
42084
42085
42086
42087
42088
42089
42090
42091
42092
42093
42094
42095
42096
42097
42098
42099
42100
42101
42102
42103
42104
42105
42106
42107
42108
42109
42110
42111
42112
42113
42114
42115
42116
42117
42118
42119
42120
42121
42122
42123
42124
42125
42126
42127
42128
42129
42130
42131
42132
42133
42134
42135
42136
42137
42138
42139
42140
42141
42142
42143
42144
42145
42146
42147
42148
42149
42150
42151
42152
42153
42154
42155
42156
42157
42158
42159
42160
42161
42162
42163
42164
42165
42166
42167
42168
42169
42170
42171
42172
42173
42174
42175
42176
42177
42178
42179
42180
42181
42182
42183
42184
42185
42186
42187
42188
42189
42190
42191
42192
42193
42194
42195
42196
42197
42198
42199
42200
42201
42202
42203
42204
42205
42206
42207
42208
42209
42210
42211
42212
42213
42214
42215
42216
42217
42218
42219
42220
42221
42222
42223
42224
42225
42226
42227
42228
42229
42230
42231
42232
42233
42234
42235
42236
42237
42238
42239
42240
42241
42242
42243
42244
42245
42246
42247
42248
42249
42250
42251
42252
42253
42254
42255
42256
42257
42258
42259
42260
42261
42262
42263
42264
42265
42266
42267
42268
42269
42270
42271
42272
42273
42274
42275
42276
42277
42278
42279
42280
42281
42282
42283
42284
42285
42286
42287
42288
42289
42290
42291
42292
42293
42294
42295
42296
42297
42298
42299
42300
42301
42302
42303
42304
42305
42306
42307
42308
42309
42310
42311
42312
42313
42314
42315
42316
42317
42318
42319
42320
42321
42322
42323
42324
42325
42326
42327
42328
42329
42330
42331
42332
42333
42334
42335
42336
42337
42338
42339
42340
42341
42342
42343
42344
42345
42346
42347
42348
42349
42350
42351
42352
42353
42354
42355
42356
42357
42358
42359
42360
42361
42362
42363
42364
42365
42366
42367
42368
42369
42370
42371
42372
42373
42374
42375
42376
42377
42378
42379
42380
42381
42382
42383
42384
42385
42386
42387
42388
42389
42390
42391
42392
42393
42394
42395
42396
42397
42398
42399
42400
42401
42402
42403
42404
42405
42406
42407
42408
42409
42410
42411
42412
42413
42414
42415
42416
42417
42418
42419
42420
42421
42422
42423
42424
42425
42426
42427
42428
42429
42430
42431
42432
42433
42434
42435
42436
42437
42438
42439
42440
42441
42442
42443
42444
42445
42446
42447
42448
42449
42450
42451
42452
42453
42454
42455
42456
42457
42458
42459
42460
42461
42462
42463
42464
42465
42466
42467
42468
42469
42470
42471
42472
42473
42474
42475
42476
42477
42478
42479
42480
42481
42482
42483
42484
42485
42486
42487
42488
42489
42490
42491
42492
42493
42494
42495
42496
42497
42498
42499
42500
42501
42502
42503
42504
42505
42506
42507
42508
42509
42510
42511
42512
42513
42514
42515
42516
42517
42518
42519
42520
42521
42522
42523
42524
42525
42526
42527
42528
42529
42530
42531
42532
42533
42534
42535
42536
42537
42538
42539
42540
42541
42542
42543
42544
42545
42546
42547
42548
42549
42550
42551
42552
42553
42554
42555
42556
42557
42558
42559
42560
42561
42562
42563
42564
42565
42566
42567
42568
42569
42570
42571
42572
42573
42574
42575
42576
42577
42578
42579
42580
42581
42582
42583
42584
42585
42586
42587
42588
42589
42590
42591
42592
42593
42594
42595
42596
42597
42598
42599
42600
42601
42602
42603
42604
42605
42606
42607
42608
42609
42610
42611
42612
42613
42614
42615
42616
42617
42618
42619
42620
42621
42622
42623
42624
42625
42626
42627
42628
42629
42630
42631
42632
42633
42634
42635
42636
42637
42638
42639
42640
42641
42642
42643
42644
42645
42646
42647
42648
42649
42650
42651
42652
42653
42654
42655
42656
42657
42658
42659
42660
42661
42662
42663
42664
42665
42666
42667
42668
42669
42670
42671
42672
42673
42674
42675
42676
42677
42678
42679
42680
42681
42682
42683
42684
42685
42686
42687
42688
42689
42690
42691
42692
42693
42694
42695
42696
42697
42698
42699
42700
42701
42702
42703
42704
42705
42706
42707
42708
42709
42710
42711
42712
42713
42714
42715
42716
42717
42718
42719
42720
42721
42722
42723
42724
42725
42726
42727
42728
42729
42730
42731
42732
42733
42734
42735
42736
42737
42738
42739
42740
42741
42742
42743
42744
42745
42746
42747
42748
42749
42750
42751
42752
42753
42754
42755
42756
42757
42758
42759
42760
42761
42762
42763
42764
42765
42766
42767
42768
42769
42770
42771
42772
42773
42774
42775
42776
42777
42778
42779
42780
42781
42782
42783
42784
42785
42786
42787
42788
42789
42790
42791
42792
42793
42794
42795
42796
42797
42798
42799
42800
42801
42802
42803
42804
42805
42806
42807
42808
42809
42810
42811
42812
42813
42814
42815
42816
42817
42818
42819
42820
42821
42822
42823
42824
42825
42826
42827
42828
42829
42830
42831
42832
42833
42834
42835
42836
42837
42838
42839
42840
42841
42842
42843
42844
42845
42846
42847
42848
42849
42850
42851
42852
42853
42854
42855
42856
42857
42858
42859
42860
42861
42862
42863
42864
42865
42866
42867
42868
42869
42870
42871
42872
42873
42874
42875
42876
42877
42878
42879
42880
42881
42882
42883
42884
42885
42886
42887
42888
42889
42890
42891
42892
42893
42894
42895
42896
42897
42898
42899
42900
42901
42902
42903
42904
42905
42906
42907
42908
42909
42910
42911
42912
42913
42914
42915
42916
42917
42918
42919
42920
42921
42922
42923
42924
42925
42926
42927
42928
42929
42930
42931
42932
42933
42934
42935
42936
42937
42938
42939
42940
42941
42942
42943
42944
42945
42946
42947
42948
42949
42950
42951
42952
42953
42954
42955
42956
42957
42958
42959
42960
42961
42962
42963
42964
42965
42966
42967
42968
42969
42970
42971
42972
42973
42974
42975
42976
42977
42978
42979
42980
42981
42982
42983
42984
42985
42986
42987
42988
42989
42990
42991
42992
42993
42994
42995
42996
42997
42998
42999
43000
43001
43002
43003
43004
43005
43006
43007
43008
43009
43010
43011
43012
43013
43014
43015
43016
43017
43018
43019
43020
43021
43022
43023
43024
43025
43026
43027
43028
43029
43030
43031
43032
43033
43034
43035
43036
43037
43038
43039
43040
43041
43042
43043
43044
43045
43046
43047
43048
43049
43050
43051
43052
43053
43054
43055
43056
43057
43058
43059
43060
43061
43062
43063
43064
43065
43066
43067
43068
43069
43070
43071
43072
43073
43074
43075
43076
43077
43078
43079
43080
43081
43082
43083
43084
43085
43086
43087
43088
43089
43090
43091
43092
43093
43094
43095
43096
43097
43098
43099
43100
43101
43102
43103
43104
43105
43106
43107
43108
43109
43110
43111
43112
43113
43114
43115
43116
43117
43118
43119
43120
43121
43122
43123
43124
43125
43126
43127
43128
43129
43130
43131
43132
43133
43134
43135
43136
43137
43138
43139
43140
43141
43142
43143
43144
43145
43146
43147
43148
43149
43150
43151
43152
43153
43154
43155
43156
43157
43158
43159
43160
43161
43162
43163
43164
43165
43166
43167
43168
43169
43170
43171
43172
43173
43174
43175
43176
43177
43178
43179
43180
43181
43182
43183
43184
43185
43186
43187
43188
43189
43190
43191
43192
43193
43194
43195
43196
43197
43198
43199
43200
43201
43202
43203
43204
43205
43206
43207
43208
43209
43210
43211
43212
43213
43214
43215
43216
43217
43218
43219
43220
43221
43222
43223
43224
43225
43226
43227
43228
43229
43230
43231
43232
43233
43234
43235
43236
43237
43238
43239
43240
43241
43242
43243
43244
43245
43246
43247
43248
43249
43250
43251
43252
43253
43254
43255
43256
43257
43258
43259
43260
43261
43262
43263
43264
43265
43266
43267
43268
43269
43270
43271
43272
43273
43274
43275
43276
43277
43278
43279
43280
43281
43282
43283
43284
43285
43286
43287
43288
43289
43290
43291
43292
43293
43294
43295
43296
43297
43298
43299
43300
43301
43302
43303
43304
43305
43306
43307
43308
43309
43310
43311
43312
43313
43314
43315
43316
43317
43318
43319
43320
43321
43322
43323
43324
43325
43326
43327
43328
43329
43330
43331
43332
43333
43334
43335
43336
43337
43338
43339
43340
43341
43342
43343
43344
43345
43346
43347
43348
43349
43350
43351
43352
43353
43354
43355
43356
43357
43358
43359
43360
43361
43362
43363
43364
43365
43366
43367
43368
43369
43370
43371
43372
43373
43374
43375
43376
43377
43378
43379
43380
43381
43382
43383
43384
43385
43386
43387
43388
43389
43390
43391
43392
43393
43394
43395
43396
43397
43398
43399
43400
43401
43402
43403
43404
43405
43406
43407
43408
43409
43410
43411
43412
43413
43414
43415
43416
43417
43418
43419
43420
43421
43422
43423
43424
43425
43426
43427
43428
43429
43430
43431
43432
43433
43434
43435
43436
43437
43438
43439
43440
43441
43442
43443
43444
43445
43446
43447
43448
43449
43450
43451
43452
43453
43454
43455
43456
43457
43458
43459
43460
43461
43462
43463
43464
43465
43466
43467
43468
43469
43470
43471
43472
43473
43474
43475
43476
43477
43478
43479
43480
43481
43482
43483
43484
43485
43486
43487
43488
43489
43490
43491
43492
43493
43494
43495
43496
43497
43498
43499
43500
43501
43502
43503
43504
43505
43506
43507
43508
43509
43510
43511
43512
43513
43514
43515
43516
43517
43518
43519
43520
43521
43522
43523
43524
43525
43526
43527
43528
43529
43530
43531
43532
43533
43534
43535
43536
43537
43538
43539
43540
43541
43542
43543
43544
43545
43546
43547
43548
43549
43550
43551
43552
43553
43554
43555
43556
43557
43558
43559
43560
43561
43562
43563
43564
43565
43566
43567
43568
43569
43570
43571
43572
43573
43574
43575
43576
43577
43578
43579
43580
43581
43582
43583
43584
43585
43586
43587
43588
43589
43590
43591
43592
43593
43594
43595
43596
43597
43598
43599
43600
43601
43602
43603
43604
43605
43606
43607
43608
43609
43610
43611
43612
43613
43614
43615
43616
43617
43618
43619
43620
43621
43622
43623
43624
43625
43626
43627
43628
43629
43630
43631
43632
43633
43634
43635
43636
43637
43638
43639
43640
43641
43642
43643
43644
43645
43646
43647
43648
43649
43650
43651
43652
43653
43654
43655
43656
43657
43658
43659
43660
43661
43662
43663
43664
43665
43666
43667
43668
43669
43670
43671
43672
43673
43674
43675
43676
43677
43678
43679
43680
43681
43682
43683
43684
43685
43686
43687
43688
43689
43690
43691
43692
43693
43694
43695
43696
43697
43698
43699
43700
43701
43702
43703
43704
43705
43706
43707
43708
43709
43710
43711
43712
43713
43714
43715
43716
43717
43718
43719
43720
43721
43722
43723
43724
43725
43726
43727
43728
43729
43730
43731
43732
43733
43734
43735
43736
43737
43738
43739
43740
43741
43742
43743
43744
43745
43746
43747
43748
43749
43750
43751
43752
43753
43754
43755
43756
43757
43758
43759
43760
43761
43762
43763
43764
43765
43766
43767
43768
43769
43770
43771
43772
43773
43774
43775
43776
43777
43778
43779
43780
43781
43782
43783
43784
43785
43786
43787
43788
43789
43790
43791
43792
43793
43794
43795
43796
43797
43798
43799
43800
43801
43802
43803
43804
43805
43806
43807
43808
43809
43810
43811
43812
43813
43814
43815
43816
43817
43818
43819
43820
43821
43822
43823
43824
43825
43826
43827
43828
43829
43830
43831
43832
43833
43834
43835
43836
43837
43838
43839
43840
43841
43842
43843
43844
43845
43846
43847
43848
43849
43850
43851
43852
43853
43854
43855
43856
43857
43858
43859
43860
43861
43862
43863
43864
43865
43866
43867
43868
43869
43870
43871
43872
43873
43874
43875
43876
43877
43878
43879
43880
43881
43882
43883
43884
43885
43886
43887
43888
43889
43890
43891
43892
43893
43894
43895
43896
43897
43898
43899
43900
43901
43902
43903
43904
43905
43906
43907
43908
43909
43910
43911
43912
43913
43914
43915
43916
43917
43918
43919
43920
43921
43922
43923
43924
43925
43926
43927
43928
43929
43930
43931
43932
43933
43934
43935
43936
43937
43938
43939
43940
43941
43942
43943
43944
43945
43946
43947
43948
43949
43950
43951
43952
43953
43954
43955
43956
43957
43958
43959
43960
43961
43962
43963
43964
43965
43966
43967
43968
43969
43970
43971
43972
43973
43974
43975
43976
43977
43978
43979
43980
43981
43982
43983
43984
43985
43986
43987
43988
43989
43990
43991
43992
43993
43994
43995
43996
43997
43998
43999
44000
44001
44002
44003
44004
44005
44006
44007
44008
44009
44010
44011
44012
44013
44014
44015
44016
44017
44018
44019
44020
44021
44022
44023
44024
44025
44026
44027
44028
44029
44030
44031
44032
44033
44034
44035
44036
44037
44038
44039
44040
44041
44042
44043
44044
44045
44046
44047
44048
44049
44050
44051
44052
44053
44054
44055
44056
44057
44058
44059
44060
44061
44062
44063
44064
44065
44066
44067
44068
44069
44070
44071
44072
44073
44074
44075
44076
44077
44078
44079
44080
44081
44082
44083
44084
44085
44086
44087
44088
44089
44090
44091
44092
44093
44094
44095
44096
44097
44098
44099
44100
44101
44102
44103
44104
44105
44106
44107
44108
44109
44110
44111
44112
44113
44114
44115
44116
44117
44118
44119
44120
44121
44122
44123
44124
44125
44126
44127
44128
44129
44130
44131
44132
44133
44134
44135
44136
44137
44138
44139
44140
44141
44142
44143
44144
44145
44146
44147
44148
44149
44150
44151
44152
44153
44154
44155
44156
44157
44158
44159
44160
44161
44162
44163
44164
44165
44166
44167
44168
44169
44170
44171
44172
44173
44174
44175
44176
44177
44178
44179
44180
44181
44182
44183
44184
44185
44186
44187
44188
44189
44190
44191
44192
44193
44194
44195
44196
44197
44198
44199
44200
44201
44202
44203
44204
44205
44206
44207
44208
44209
44210
44211
44212
44213
44214
44215
44216
44217
44218
44219
44220
44221
44222
44223
44224
44225
44226
44227
44228
44229
44230
44231
44232
44233
44234
44235
44236
44237
44238
44239
44240
44241
44242
44243
44244
44245
44246
44247
44248
44249
44250
44251
44252
44253
44254
44255
44256
44257
44258
44259
44260
44261
44262
44263
44264
44265
44266
44267
44268
44269
44270
44271
44272
44273
44274
44275
44276
44277
44278
44279
44280
44281
44282
44283
44284
44285
44286
44287
44288
44289
44290
44291
44292
44293
44294
44295
44296
44297
44298
44299
44300
44301
44302
44303
44304
44305
44306
44307
44308
44309
44310
44311
44312
44313
44314
44315
44316
44317
44318
44319
44320
44321
44322
44323
44324
44325
44326
44327
44328
44329
44330
44331
44332
44333
44334
44335
44336
44337
44338
44339
44340
44341
44342
44343
44344
44345
44346
44347
44348
44349
44350
44351
44352
44353
44354
44355
44356
44357
44358
44359
44360
44361
44362
44363
44364
44365
44366
44367
44368
44369
44370
44371
44372
44373
44374
44375
44376
44377
44378
44379
44380
44381
44382
44383
44384
44385
44386
44387
44388
44389
44390
44391
44392
44393
44394
44395
44396
44397
44398
44399
44400
44401
44402
44403
44404
44405
44406
44407
44408
44409
44410
44411
44412
44413
44414
44415
44416
44417
44418
44419
44420
44421
44422
44423
44424
44425
44426
44427
44428
44429
44430
44431
44432
44433
44434
44435
44436
44437
44438
44439
44440
44441
44442
44443
44444
44445
44446
44447
44448
44449
44450
44451
44452
44453
44454
44455
44456
44457
44458
44459
44460
44461
44462
44463
44464
44465
44466
44467
44468
44469
44470
44471
44472
44473
44474
44475
44476
44477
44478
44479
44480
44481
44482
44483
44484
44485
44486
44487
44488
44489
44490
44491
44492
44493
44494
44495
44496
44497
44498
44499
44500
44501
44502
44503
44504
44505
44506
44507
44508
44509
44510
44511
44512
44513
44514
44515
44516
44517
44518
44519
44520
44521
44522
44523
44524
44525
44526
44527
44528
44529
44530
44531
44532
44533
44534
44535
44536
44537
44538
44539
44540
44541
44542
44543
44544
44545
44546
44547
44548
44549
44550
44551
44552
44553
44554
44555
44556
44557
44558
44559
44560
44561
44562
44563
44564
44565
44566
44567
44568
44569
44570
44571
44572
44573
44574
44575
44576
44577
44578
44579
44580
44581
44582
44583
44584
44585
44586
44587
44588
44589
44590
44591
44592
44593
44594
44595
44596
44597
44598
44599
44600
44601
44602
44603
44604
44605
44606
44607
44608
44609
44610
44611
44612
44613
44614
44615
44616
44617
44618
44619
44620
44621
44622
44623
44624
44625
44626
44627
44628
44629
44630
44631
44632
44633
44634
44635
44636
44637
44638
44639
44640
44641
44642
44643
44644
44645
44646
44647
44648
44649
44650
44651
44652
44653
44654
44655
44656
44657
44658
44659
44660
44661
44662
44663
44664
44665
44666
44667
44668
44669
44670
44671
44672
44673
44674
44675
44676
44677
44678
44679
44680
44681
44682
44683
44684
44685
44686
44687
44688
44689
44690
44691
44692
44693
44694
44695
44696
44697
44698
44699
44700
44701
44702
44703
44704
44705
44706
44707
44708
44709
44710
44711
44712
44713
44714
44715
44716
44717
44718
44719
44720
44721
44722
44723
44724
44725
44726
44727
44728
44729
44730
44731
44732
44733
44734
44735
44736
44737
44738
44739
44740
44741
44742
44743
44744
44745
44746
44747
44748
44749
44750
44751
44752
44753
44754
44755
44756
44757
44758
44759
44760
44761
44762
44763
44764
44765
44766
44767
44768
44769
44770
44771
44772
44773
44774
44775
44776
44777
44778
44779
44780
44781
44782
44783
44784
44785
44786
44787
44788
44789
44790
44791
44792
44793
44794
44795
44796
44797
44798
44799
44800
44801
44802
44803
44804
44805
44806
44807
44808
44809
44810
44811
44812
44813
44814
44815
44816
44817
44818
44819
44820
44821
44822
44823
44824
44825
44826
44827
44828
44829
44830
44831
44832
44833
44834
44835
44836
44837
44838
44839
44840
44841
44842
44843
44844
44845
44846
44847
44848
44849
44850
44851
44852
44853
44854
44855
44856
44857
44858
44859
44860
44861
44862
44863
44864
44865
44866
44867
44868
44869
44870
44871
44872
44873
44874
44875
44876
44877
44878
44879
44880
44881
44882
44883
44884
44885
44886
44887
44888
44889
44890
44891
44892
44893
44894
44895
44896
44897
44898
44899
44900
44901
44902
44903
44904
44905
44906
44907
44908
44909
44910
44911
44912
44913
44914
44915
44916
44917
44918
44919
44920
44921
44922
44923
44924
44925
44926
44927
44928
44929
44930
44931
44932
44933
44934
44935
44936
44937
44938
44939
44940
44941
44942
44943
44944
44945
44946
44947
44948
44949
44950
44951
44952
44953
44954
44955
44956
44957
44958
44959
44960
44961
44962
44963
44964
44965
44966
44967
44968
44969
44970
44971
44972
44973
44974
44975
44976
44977
44978
44979
44980
44981
44982
44983
44984
44985
44986
44987
44988
44989
44990
44991
44992
44993
44994
44995
44996
44997
44998
44999
45000
45001
45002
45003
45004
45005
45006
45007
45008
45009
45010
45011
45012
45013
45014
45015
45016
45017
45018
45019
45020
45021
45022
45023
45024
45025
45026
45027
45028
45029
45030
45031
45032
45033
45034
45035
45036
45037
45038
45039
45040
45041
45042
45043
45044
45045
45046
45047
45048
45049
45050
45051
45052
45053
45054
45055
45056
45057
45058
45059
45060
45061
45062
45063
45064
45065
45066
45067
45068
45069
45070
45071
45072
45073
45074
45075
45076
45077
45078
45079
45080
45081
45082
45083
45084
45085
45086
45087
45088
45089
45090
45091
45092
45093
45094
45095
45096
45097
45098
45099
45100
45101
45102
45103
45104
45105
45106
45107
45108
45109
45110
45111
45112
45113
45114
45115
45116
45117
45118
45119
45120
45121
45122
45123
45124
45125
45126
45127
45128
45129
45130
45131
45132
45133
45134
45135
45136
45137
45138
45139
45140
45141
45142
45143
45144
45145
45146
45147
45148
45149
45150
45151
45152
45153
45154
45155
45156
45157
45158
45159
45160
45161
45162
45163
45164
45165
45166
45167
45168
45169
45170
45171
45172
45173
45174
45175
45176
45177
45178
45179
45180
45181
45182
45183
45184
45185
45186
45187
45188
45189
45190
45191
45192
45193
45194
45195
45196
45197
45198
45199
45200
45201
45202
45203
45204
45205
45206
45207
45208
45209
45210
45211
45212
45213
45214
45215
45216
45217
45218
45219
45220
45221
45222
45223
45224
45225
45226
45227
45228
45229
45230
45231
45232
45233
45234
45235
45236
45237
45238
45239
45240
45241
45242
45243
45244
45245
45246
45247
45248
45249
45250
45251
45252
45253
45254
45255
45256
45257
45258
45259
45260
45261
45262
45263
45264
45265
45266
45267
45268
45269
45270
45271
45272
45273
45274
45275
45276
45277
45278
45279
45280
45281
45282
45283
45284
45285
45286
45287
45288
45289
45290
45291
45292
45293
45294
45295
45296
45297
45298
45299
45300
45301
45302
45303
45304
45305
45306
45307
45308
45309
45310
45311
45312
45313
45314
45315
45316
45317
45318
45319
45320
45321
45322
45323
45324
45325
45326
45327
45328
45329
45330
45331
45332
45333
45334
45335
45336
45337
45338
45339
45340
45341
45342
45343
45344
45345
45346
45347
45348
45349
45350
45351
45352
45353
45354
45355
45356
45357
45358
45359
45360
45361
45362
45363
45364
45365
45366
45367
45368
45369
45370
45371
45372
45373
45374
45375
45376
45377
45378
45379
45380
45381
45382
45383
45384
45385
45386
45387
45388
45389
45390
45391
45392
45393
45394
45395
45396
45397
45398
45399
45400
45401
45402
45403
45404
45405
45406
45407
45408
45409
45410
45411
45412
45413
45414
45415
45416
45417
45418
45419
45420
45421
45422
45423
45424
45425
45426
45427
45428
45429
45430
45431
45432
45433
45434
45435
45436
45437
45438
45439
45440
45441
45442
45443
45444
45445
45446
45447
45448
45449
45450
45451
45452
45453
45454
45455
45456
45457
45458
45459
45460
45461
45462
45463
45464
45465
45466
45467
45468
45469
45470
45471
45472
45473
45474
45475
45476
45477
45478
45479
45480
45481
45482
45483
45484
45485
45486
45487
45488
45489
45490
45491
45492
45493
45494
45495
45496
45497
45498
45499
45500
45501
45502
45503
45504
45505
45506
45507
45508
45509
45510
45511
45512
45513
45514
45515
45516
45517
45518
45519
45520
45521
45522
45523
45524
45525
45526
45527
45528
45529
45530
45531
45532
45533
45534
45535
45536
45537
45538
45539
45540
45541
45542
45543
45544
45545
45546
45547
45548
45549
45550
45551
45552
45553
45554
45555
45556
45557
45558
45559
45560
45561
45562
45563
45564
45565
45566
45567
45568
45569
45570
45571
45572
45573
45574
45575
45576
45577
45578
45579
45580
45581
45582
45583
45584
45585
45586
45587
45588
45589
45590
45591
45592
45593
45594
45595
45596
45597
45598
45599
45600
45601
45602
45603
45604
45605
45606
45607
45608
45609
45610
45611
45612
45613
45614
45615
45616
45617
45618
45619
45620
45621
45622
45623
45624
45625
45626
45627
45628
45629
45630
45631
45632
45633
45634
45635
45636
45637
45638
45639
45640
45641
45642
45643
45644
45645
45646
45647
45648
45649
45650
45651
45652
45653
45654
45655
45656
45657
45658
45659
45660
45661
45662
45663
45664
45665
45666
45667
45668
45669
45670
45671
45672
45673
45674
45675
45676
45677
45678
45679
45680
45681
45682
45683
45684
45685
45686
45687
45688
45689
45690
45691
45692
45693
45694
45695
45696
45697
45698
45699
45700
45701
45702
45703
45704
45705
45706
45707
45708
45709
45710
45711
45712
45713
45714
45715
45716
45717
45718
45719
45720
45721
45722
45723
45724
45725
45726
45727
45728
45729
45730
45731
45732
45733
45734
45735
45736
45737
45738
45739
45740
45741
45742
45743
45744
45745
45746
45747
45748
45749
45750
45751
45752
45753
45754
45755
45756
45757
45758
45759
45760
45761
45762
45763
45764
45765
45766
45767
45768
45769
45770
45771
45772
45773
45774
45775
45776
45777
45778
45779
45780
45781
45782
45783
45784
45785
45786
45787
45788
45789
45790
45791
45792
45793
45794
45795
45796
45797
45798
45799
45800
45801
45802
45803
45804
45805
45806
45807
45808
45809
45810
45811
45812
45813
45814
45815
45816
45817
45818
45819
45820
45821
45822
45823
45824
45825
45826
45827
45828
45829
45830
45831
45832
45833
45834
45835
45836
45837
45838
45839
45840
45841
45842
45843
45844
45845
45846
45847
45848
45849
45850
45851
45852
45853
45854
45855
45856
45857
45858
45859
45860
45861
45862
45863
45864
45865
45866
45867
45868
45869
45870
45871
45872
45873
45874
45875
45876
45877
45878
45879
45880
45881
45882
45883
45884
45885
45886
45887
45888
45889
45890
45891
45892
45893
45894
45895
45896
45897
45898
45899
45900
45901
45902
45903
45904
45905
45906
45907
45908
45909
45910
45911
45912
45913
45914
45915
45916
45917
45918
45919
45920
45921
45922
45923
45924
45925
45926
45927
45928
45929
45930
45931
45932
45933
45934
45935
45936
45937
45938
45939
45940
45941
45942
45943
45944
45945
45946
45947
45948
45949
45950
45951
45952
45953
45954
45955
45956
45957
45958
45959
45960
45961
45962
45963
45964
45965
45966
45967
45968
45969
45970
45971
45972
45973
45974
45975
45976
45977
45978
45979
45980
45981
45982
45983
45984
45985
45986
45987
45988
45989
45990
45991
45992
45993
45994
45995
45996
45997
45998
45999
46000
46001
46002
46003
46004
46005
46006
46007
46008
46009
46010
46011
46012
46013
46014
46015
46016
46017
46018
46019
46020
46021
46022
46023
46024
46025
46026
46027
46028
46029
46030
46031
46032
46033
46034
46035
46036
46037
46038
46039
46040
46041
46042
46043
46044
46045
46046
46047
46048
46049
46050
46051
46052
46053
46054
46055
46056
46057
46058
46059
46060
46061
46062
46063
46064
46065
46066
46067
46068
46069
46070
46071
46072
46073
46074
46075
46076
46077
46078
46079
46080
46081
46082
46083
46084
46085
46086
46087
46088
46089
46090
46091
46092
46093
46094
46095
46096
46097
46098
46099
46100
46101
46102
46103
46104
46105
46106
46107
46108
46109
46110
46111
46112
46113
46114
46115
46116
46117
46118
46119
46120
46121
46122
46123
46124
46125
46126
46127
46128
46129
46130
46131
46132
46133
46134
46135
46136
46137
46138
46139
46140
46141
46142
46143
46144
46145
46146
46147
46148
46149
46150
46151
46152
46153
46154
46155
46156
46157
46158
46159
46160
46161
46162
46163
46164
46165
46166
46167
46168
46169
46170
46171
46172
46173
46174
46175
46176
46177
46178
46179
46180
46181
46182
46183
46184
46185
46186
46187
46188
46189
46190
46191
46192
46193
46194
46195
46196
46197
46198
46199
46200
46201
46202
46203
46204
46205
46206
46207
46208
46209
46210
46211
46212
46213
46214
46215
46216
46217
46218
46219
46220
46221
46222
46223
46224
46225
46226
46227
46228
46229
46230
46231
46232
46233
46234
46235
46236
46237
46238
46239
46240
46241
46242
46243
46244
46245
46246
46247
46248
46249
46250
46251
46252
46253
46254
46255
46256
46257
46258
46259
46260
46261
46262
46263
46264
46265
46266
46267
46268
46269
46270
46271
46272
46273
46274
46275
46276
46277
46278
46279
46280
46281
46282
46283
46284
46285
46286
46287
46288
46289
46290
46291
46292
46293
46294
46295
46296
46297
46298
46299
46300
46301
46302
46303
46304
46305
46306
46307
46308
46309
46310
46311
46312
46313
46314
46315
46316
46317
46318
46319
46320
46321
46322
46323
46324
46325
46326
46327
46328
46329
46330
46331
46332
46333
46334
46335
46336
46337
46338
46339
46340
46341
46342
46343
46344
46345
46346
46347
46348
46349
46350
46351
46352
46353
46354
46355
46356
46357
46358
46359
46360
46361
46362
46363
46364
46365
46366
46367
46368
46369
46370
46371
46372
46373
46374
46375
46376
46377
46378
46379
46380
46381
46382
46383
46384
46385
46386
46387
46388
46389
46390
46391
46392
46393
46394
46395
46396
46397
46398
46399
46400
46401
46402
46403
46404
46405
46406
46407
46408
46409
46410
46411
46412
46413
46414
46415
46416
46417
46418
46419
46420
46421
46422
46423
46424
46425
46426
46427
46428
46429
46430
46431
46432
46433
46434
46435
46436
46437
46438
46439
46440
46441
46442
46443
46444
46445
46446
46447
46448
46449
46450
46451
46452
46453
46454
46455
46456
46457
46458
46459
46460
46461
46462
46463
46464
46465
46466
46467
46468
46469
46470
46471
46472
46473
46474
46475
46476
46477
46478
46479
46480
46481
46482
46483
46484
46485
46486
46487
46488
46489
46490
46491
46492
46493
46494
46495
46496
46497
46498
46499
46500
46501
46502
46503
46504
46505
46506
46507
46508
46509
46510
46511
46512
46513
46514
46515
46516
46517
46518
46519
46520
46521
46522
46523
46524
46525
46526
46527
46528
46529
46530
46531
46532
46533
46534
46535
46536
46537
46538
46539
46540
46541
46542
46543
46544
46545
46546
46547
46548
46549
46550
46551
46552
46553
46554
46555
46556
46557
46558
46559
46560
46561
46562
46563
46564
46565
46566
46567
46568
46569
46570
46571
46572
46573
46574
46575
46576
46577
46578
46579
46580
46581
46582
46583
46584
46585
46586
46587
46588
46589
46590
46591
46592
46593
46594
46595
46596
46597
46598
46599
46600
46601
46602
46603
46604
46605
46606
46607
46608
46609
46610
46611
46612
46613
46614
46615
46616
46617
46618
46619
46620
46621
46622
46623
46624
46625
46626
46627
46628
46629
46630
46631
46632
46633
46634
46635
46636
46637
46638
46639
46640
46641
46642
46643
46644
46645
46646
46647
46648
46649
46650
46651
46652
46653
46654
46655
46656
46657
46658
46659
46660
46661
46662
46663
46664
46665
46666
46667
46668
46669
46670
46671
46672
46673
46674
46675
46676
46677
46678
46679
46680
46681
46682
46683
46684
46685
46686
46687
46688
46689
46690
46691
46692
46693
46694
46695
46696
46697
46698
46699
46700
46701
46702
46703
46704
46705
46706
46707
46708
46709
46710
46711
46712
46713
46714
46715
46716
46717
46718
46719
46720
46721
46722
46723
46724
46725
46726
46727
46728
46729
46730
46731
46732
46733
46734
46735
46736
46737
46738
46739
46740
46741
46742
46743
46744
46745
46746
46747
46748
46749
46750
46751
46752
46753
46754
46755
46756
46757
46758
46759
46760
46761
46762
46763
46764
46765
46766
46767
46768
46769
46770
46771
46772
46773
46774
46775
46776
46777
46778
46779
46780
46781
46782
46783
46784
46785
46786
46787
46788
46789
46790
46791
46792
46793
46794
46795
46796
46797
46798
46799
46800
46801
46802
46803
46804
46805
46806
46807
46808
46809
46810
46811
46812
46813
46814
46815
46816
46817
46818
46819
46820
46821
46822
46823
46824
46825
46826
46827
46828
46829
46830
46831
46832
46833
46834
46835
46836
46837
46838
46839
46840
46841
46842
46843
46844
46845
46846
46847
46848
46849
46850
46851
46852
46853
46854
46855
46856
46857
46858
46859
46860
46861
46862
46863
46864
46865
46866
46867
46868
46869
46870
46871
46872
46873
46874
46875
46876
46877
46878
46879
46880
46881
46882
46883
46884
46885
46886
46887
46888
46889
46890
46891
46892
46893
46894
46895
46896
46897
46898
46899
46900
46901
46902
46903
46904
46905
46906
46907
46908
46909
46910
46911
46912
46913
46914
46915
46916
46917
46918
46919
46920
46921
46922
46923
46924
46925
46926
46927
46928
46929
46930
46931
46932
46933
46934
46935
46936
46937
46938
46939
46940
46941
46942
46943
46944
46945
46946
46947
46948
46949
46950
46951
46952
46953
46954
46955
46956
46957
46958
46959
46960
46961
46962
46963
46964
46965
46966
46967
46968
46969
46970
46971
46972
46973
46974
46975
46976
46977
46978
46979
46980
46981
46982
46983
46984
46985
46986
46987
46988
46989
46990
46991
46992
46993
46994
46995
46996
46997
46998
46999
47000
47001
47002
47003
47004
47005
47006
47007
47008
47009
47010
47011
47012
47013
47014
47015
47016
47017
47018
47019
47020
47021
47022
47023
47024
47025
47026
47027
47028
47029
47030
47031
47032
47033
47034
47035
47036
47037
47038
47039
47040
47041
47042
47043
47044
47045
47046
47047
47048
47049
47050
47051
47052
47053
47054
47055
47056
47057
47058
47059
47060
47061
47062
47063
47064
47065
47066
47067
47068
47069
47070
47071
47072
47073
47074
47075
47076
47077
47078
47079
47080
47081
47082
47083
47084
47085
47086
47087
47088
47089
47090
47091
47092
47093
47094
47095
47096
47097
47098
47099
47100
47101
47102
47103
47104
47105
47106
47107
47108
47109
47110
47111
47112
47113
47114
47115
47116
47117
47118
47119
47120
47121
47122
47123
47124
47125
47126
47127
47128
47129
47130
47131
47132
47133
47134
47135
47136
47137
47138
47139
47140
47141
47142
47143
47144
47145
47146
47147
47148
47149
47150
47151
47152
47153
47154
47155
47156
47157
47158
47159
47160
47161
47162
47163
47164
47165
47166
47167
47168
47169
47170
47171
47172
47173
47174
47175
47176
47177
47178
47179
47180
47181
47182
47183
47184
47185
47186
47187
47188
47189
47190
47191
47192
47193
47194
47195
47196
47197
47198
47199
47200
47201
47202
47203
47204
47205
47206
47207
47208
47209
47210
47211
47212
47213
47214
47215
47216
47217
47218
47219
47220
47221
47222
47223
47224
47225
47226
47227
47228
47229
47230
47231
47232
47233
47234
47235
47236
47237
47238
47239
47240
47241
47242
47243
47244
47245
47246
47247
47248
47249
47250
47251
47252
47253
47254
47255
47256
47257
47258
47259
47260
47261
47262
47263
47264
47265
47266
47267
47268
47269
47270
47271
47272
47273
47274
47275
47276
47277
47278
47279
47280
47281
47282
47283
47284
47285
47286
47287
47288
47289
47290
47291
47292
47293
47294
47295
47296
47297
47298
47299
47300
47301
47302
47303
47304
47305
47306
47307
47308
47309
47310
47311
47312
47313
47314
47315
47316
47317
47318
47319
47320
47321
47322
47323
47324
47325
47326
47327
47328
47329
47330
47331
47332
47333
47334
47335
47336
47337
47338
47339
47340
47341
47342
47343
47344
47345
47346
47347
47348
47349
47350
47351
47352
47353
47354
47355
47356
47357
47358
47359
47360
47361
47362
47363
47364
47365
47366
47367
47368
47369
47370
47371
47372
47373
47374
47375
47376
47377
47378
47379
47380
47381
47382
47383
47384
47385
47386
47387
47388
47389
47390
47391
47392
47393
47394
47395
47396
47397
47398
47399
47400
47401
47402
47403
47404
47405
47406
47407
47408
47409
47410
47411
47412
47413
47414
47415
47416
47417
47418
47419
47420
47421
47422
47423
47424
47425
47426
47427
47428
47429
47430
47431
47432
47433
47434
47435
47436
47437
47438
47439
47440
47441
47442
47443
47444
47445
47446
47447
47448
47449
47450
47451
47452
47453
47454
47455
47456
47457
47458
47459
47460
47461
47462
47463
47464
47465
47466
47467
47468
47469
47470
47471
47472
47473
47474
47475
47476
47477
47478
47479
47480
47481
47482
47483
47484
47485
47486
47487
47488
47489
47490
47491
47492
47493
47494
47495
47496
47497
47498
47499
47500
47501
47502
47503
47504
47505
47506
47507
47508
47509
47510
47511
47512
47513
47514
47515
47516
47517
47518
47519
47520
47521
47522
47523
47524
47525
47526
47527
47528
47529
47530
47531
47532
47533
47534
47535
47536
47537
47538
47539
47540
47541
47542
47543
47544
47545
47546
47547
47548
47549
47550
47551
47552
47553
47554
47555
47556
47557
47558
47559
47560
47561
47562
47563
47564
47565
47566
47567
47568
47569
47570
47571
47572
47573
47574
47575
47576
47577
47578
47579
47580
47581
47582
47583
47584
47585
47586
47587
47588
47589
47590
47591
47592
47593
47594
47595
47596
47597
47598
47599
47600
47601
47602
47603
47604
47605
47606
47607
47608
47609
47610
47611
47612
47613
47614
47615
47616
47617
47618
47619
47620
47621
47622
47623
47624
47625
47626
47627
47628
47629
47630
47631
47632
47633
47634
47635
47636
47637
47638
47639
47640
47641
47642
47643
47644
47645
47646
47647
47648
47649
47650
47651
47652
47653
47654
47655
47656
47657
47658
47659
47660
47661
47662
47663
47664
47665
47666
47667
47668
47669
47670
47671
47672
47673
47674
47675
47676
47677
47678
47679
47680
47681
47682
47683
47684
47685
47686
47687
47688
47689
47690
47691
47692
47693
47694
47695
47696
47697
47698
47699
47700
47701
47702
47703
47704
47705
47706
47707
47708
47709
47710
47711
47712
47713
47714
47715
47716
47717
47718
47719
47720
47721
47722
47723
47724
47725
47726
47727
47728
47729
47730
47731
47732
47733
47734
47735
47736
47737
47738
47739
47740
47741
47742
47743
47744
47745
47746
47747
47748
47749
47750
47751
47752
47753
47754
47755
47756
47757
47758
47759
47760
47761
47762
47763
47764
47765
47766
47767
47768
47769
47770
47771
47772
47773
47774
47775
47776
47777
47778
47779
47780
47781
47782
47783
47784
47785
47786
47787
47788
47789
47790
47791
47792
47793
47794
47795
47796
47797
47798
47799
47800
47801
47802
47803
47804
47805
47806
47807
47808
47809
47810
47811
47812
47813
47814
47815
47816
47817
47818
47819
47820
47821
47822
47823
47824
47825
47826
47827
47828
47829
47830
47831
47832
47833
47834
47835
47836
47837
47838
47839
47840
47841
47842
47843
47844
47845
47846
47847
47848
47849
47850
47851
47852
47853
47854
47855
47856
47857
47858
47859
47860
47861
47862
47863
47864
47865
47866
47867
47868
47869
47870
47871
47872
47873
47874
47875
47876
47877
47878
47879
47880
47881
47882
47883
47884
47885
47886
47887
47888
47889
47890
47891
47892
47893
47894
47895
47896
47897
47898
47899
47900
47901
47902
47903
47904
47905
47906
47907
47908
47909
47910
47911
47912
47913
47914
47915
47916
47917
47918
47919
47920
47921
47922
47923
47924
47925
47926
47927
47928
47929
47930
47931
47932
47933
47934
47935
47936
47937
47938
47939
47940
47941
47942
47943
47944
47945
47946
47947
47948
47949
47950
47951
47952
47953
47954
47955
47956
47957
47958
47959
47960
47961
47962
47963
47964
47965
47966
47967
47968
47969
47970
47971
47972
47973
47974
47975
47976
47977
47978
47979
47980
47981
47982
47983
47984
47985
47986
47987
47988
47989
47990
47991
47992
47993
47994
47995
47996
47997
47998
47999
48000
48001
48002
48003
48004
48005
48006
48007
48008
48009
48010
48011
48012
48013
48014
48015
48016
48017
48018
48019
48020
48021
48022
48023
48024
48025
48026
48027
48028
48029
48030
48031
48032
48033
48034
48035
48036
48037
48038
48039
48040
48041
48042
48043
48044
48045
48046
48047
48048
48049
48050
48051
48052
48053
48054
48055
48056
48057
48058
48059
48060
48061
48062
48063
48064
48065
48066
48067
48068
48069
48070
48071
48072
48073
48074
48075
48076
48077
48078
48079
48080
48081
48082
48083
48084
48085
48086
48087
48088
48089
48090
48091
48092
48093
48094
48095
48096
48097
48098
48099
48100
48101
48102
48103
48104
48105
48106
48107
48108
48109
48110
48111
48112
48113
48114
48115
48116
48117
48118
48119
48120
48121
48122
48123
48124
48125
48126
48127
48128
48129
48130
48131
48132
48133
48134
48135
48136
48137
48138
48139
48140
48141
48142
48143
48144
48145
48146
48147
48148
48149
48150
48151
48152
48153
48154
48155
48156
48157
48158
48159
48160
48161
48162
48163
48164
48165
48166
48167
48168
48169
48170
48171
48172
48173
48174
48175
48176
48177
48178
48179
48180
48181
48182
48183
48184
48185
48186
48187
48188
48189
48190
48191
48192
48193
48194
48195
48196
48197
48198
48199
48200
48201
48202
48203
48204
48205
48206
48207
48208
48209
48210
48211
48212
48213
48214
48215
48216
48217
48218
48219
48220
48221
48222
48223
48224
48225
48226
48227
48228
48229
48230
48231
48232
48233
48234
48235
48236
48237
48238
48239
48240
48241
48242
48243
48244
48245
48246
48247
48248
48249
48250
48251
48252
48253
48254
48255
48256
48257
48258
48259
48260
48261
48262
48263
48264
48265
48266
48267
48268
48269
48270
48271
48272
48273
48274
48275
48276
48277
48278
48279
48280
48281
48282
48283
48284
48285
48286
48287
48288
48289
48290
48291
48292
48293
48294
48295
48296
48297
48298
48299
48300
48301
48302
48303
48304
48305
48306
48307
48308
48309
48310
48311
48312
48313
48314
48315
48316
48317
48318
48319
48320
48321
48322
48323
48324
48325
48326
48327
48328
48329
48330
48331
48332
48333
48334
48335
48336
48337
48338
48339
48340
48341
48342
48343
48344
48345
48346
48347
48348
48349
48350
48351
48352
48353
48354
48355
48356
48357
48358
48359
48360
48361
48362
48363
48364
48365
48366
48367
48368
48369
48370
48371
48372
48373
48374
48375
48376
48377
48378
48379
48380
48381
48382
48383
48384
48385
48386
48387
48388
48389
48390
48391
48392
48393
48394
48395
48396
48397
48398
48399
48400
48401
48402
48403
48404
48405
48406
48407
48408
48409
48410
48411
48412
48413
48414
48415
48416
48417
48418
48419
48420
48421
48422
48423
48424
48425
48426
48427
48428
48429
48430
48431
48432
48433
48434
48435
48436
48437
48438
48439
48440
48441
48442
48443
48444
48445
48446
48447
48448
48449
48450
48451
48452
48453
48454
48455
48456
48457
48458
48459
48460
48461
48462
48463
48464
48465
48466
48467
48468
48469
48470
48471
48472
48473
48474
48475
48476
48477
48478
48479
48480
48481
48482
48483
48484
48485
48486
48487
48488
48489
48490
48491
48492
48493
48494
48495
48496
48497
48498
48499
48500
48501
48502
48503
48504
48505
48506
48507
48508
48509
48510
48511
48512
48513
48514
48515
48516
48517
48518
48519
48520
48521
48522
48523
48524
48525
48526
48527
48528
48529
48530
48531
48532
48533
48534
48535
48536
48537
48538
48539
48540
48541
48542
48543
48544
48545
48546
48547
48548
48549
48550
48551
48552
48553
48554
48555
48556
48557
48558
48559
48560
48561
48562
48563
48564
48565
48566
48567
48568
48569
48570
48571
48572
48573
48574
48575
48576
48577
48578
48579
48580
48581
48582
48583
48584
48585
48586
48587
48588
48589
48590
48591
48592
48593
48594
48595
48596
48597
48598
48599
48600
48601
48602
48603
48604
48605
48606
48607
48608
48609
48610
48611
48612
48613
48614
48615
48616
48617
48618
48619
48620
48621
48622
48623
48624
48625
48626
48627
48628
48629
48630
48631
48632
48633
48634
48635
48636
48637
48638
48639
48640
48641
48642
48643
48644
48645
48646
48647
48648
48649
48650
48651
48652
48653
48654
48655
48656
48657
48658
48659
48660
48661
48662
48663
48664
48665
48666
48667
48668
48669
48670
48671
48672
48673
48674
48675
48676
48677
48678
48679
48680
48681
48682
48683
48684
48685
48686
48687
48688
48689
48690
48691
48692
48693
48694
48695
48696
48697
48698
48699
48700
48701
48702
48703
48704
48705
48706
48707
48708
48709
48710
48711
48712
48713
48714
48715
48716
48717
48718
48719
48720
48721
48722
48723
48724
48725
48726
48727
48728
48729
48730
48731
48732
48733
48734
48735
48736
48737
48738
48739
48740
48741
48742
48743
48744
48745
48746
48747
48748
48749
48750
48751
48752
48753
48754
48755
48756
48757
48758
48759
48760
48761
48762
48763
48764
48765
48766
48767
48768
48769
48770
48771
48772
48773
48774
48775
48776
48777
48778
48779
48780
48781
48782
48783
48784
48785
48786
48787
48788
48789
48790
48791
48792
48793
48794
48795
48796
48797
48798
48799
48800
48801
48802
48803
48804
48805
48806
48807
48808
48809
48810
48811
48812
48813
48814
48815
48816
48817
48818
48819
48820
48821
48822
48823
48824
48825
48826
48827
48828
48829
48830
48831
48832
48833
48834
48835
48836
48837
48838
48839
48840
48841
48842
48843
48844
48845
48846
48847
48848
48849
48850
48851
48852
48853
48854
48855
48856
48857
48858
48859
48860
48861
48862
48863
48864
48865
48866
48867
48868
48869
48870
48871
48872
48873
48874
48875
48876
48877
48878
48879
48880
48881
48882
48883
48884
48885
48886
48887
48888
48889
48890
48891
48892
48893
48894
48895
48896
48897
48898
48899
48900
48901
48902
48903
48904
48905
48906
48907
48908
48909
48910
48911
48912
48913
48914
48915
48916
48917
48918
48919
48920
48921
48922
48923
48924
48925
48926
48927
48928
48929
48930
48931
48932
48933
48934
48935
48936
48937
48938
48939
48940
48941
48942
48943
48944
48945
48946
48947
48948
48949
48950
48951
48952
48953
48954
48955
48956
48957
48958
48959
48960
48961
48962
48963
48964
48965
48966
48967
48968
48969
48970
48971
48972
48973
48974
48975
48976
48977
48978
48979
48980
48981
48982
48983
48984
48985
48986
48987
48988
48989
48990
48991
48992
48993
48994
48995
48996
48997
48998
48999
49000
49001
49002
49003
49004
49005
49006
49007
49008
49009
49010
49011
49012
49013
49014
49015
49016
49017
49018
49019
49020
49021
49022
49023
49024
49025
49026
49027
49028
49029
49030
49031
49032
49033
49034
49035
49036
49037
49038
49039
49040
49041
49042
49043
49044
49045
49046
49047
49048
49049
49050
49051
49052
49053
49054
49055
49056
49057
49058
49059
49060
49061
49062
49063
49064
49065
49066
49067
49068
49069
49070
49071
49072
49073
49074
49075
49076
49077
49078
49079
49080
49081
49082
49083
49084
49085
49086
49087
49088
49089
49090
49091
49092
49093
49094
49095
49096
49097
49098
49099
49100
49101
49102
49103
49104
49105
49106
49107
49108
49109
49110
49111
49112
49113
49114
49115
49116
49117
49118
49119
49120
49121
49122
49123
49124
49125
49126
49127
49128
49129
49130
49131
49132
49133
49134
49135
49136
49137
49138
49139
49140
49141
49142
49143
49144
49145
49146
49147
49148
49149
49150
49151
49152
49153
49154
49155
49156
49157
49158
49159
49160
49161
49162
49163
49164
49165
49166
49167
49168
49169
49170
49171
49172
49173
49174
49175
49176
49177
49178
49179
49180
49181
49182
49183
49184
49185
49186
49187
49188
49189
49190
49191
49192
49193
49194
49195
49196
49197
49198
49199
49200
49201
49202
49203
49204
49205
49206
49207
49208
49209
49210
49211
49212
49213
49214
49215
49216
49217
49218
49219
49220
49221
49222
49223
49224
49225
49226
49227
49228
49229
49230
49231
49232
49233
49234
49235
49236
49237
49238
49239
49240
49241
49242
49243
49244
49245
49246
49247
49248
49249
49250
49251
49252
49253
49254
49255
49256
49257
49258
49259
49260
49261
49262
49263
49264
49265
49266
49267
49268
49269
49270
49271
49272
49273
49274
49275
49276
49277
49278
49279
49280
49281
49282
49283
49284
49285
49286
49287
49288
49289
49290
49291
49292
49293
49294
49295
49296
49297
49298
49299
49300
49301
49302
49303
49304
49305
49306
49307
49308
49309
49310
49311
49312
49313
49314
49315
49316
49317
49318
49319
49320
49321
49322
49323
49324
49325
49326
49327
49328
49329
49330
49331
49332
49333
49334
49335
49336
49337
49338
49339
49340
49341
49342
49343
49344
49345
49346
49347
49348
49349
49350
49351
49352
49353
49354
49355
49356
49357
49358
49359
49360
49361
49362
49363
49364
49365
49366
49367
49368
49369
49370
49371
49372
49373
49374
49375
49376
49377
49378
49379
49380
49381
49382
49383
49384
49385
49386
49387
49388
49389
49390
49391
49392
49393
49394
49395
49396
49397
49398
49399
49400
49401
49402
49403
49404
49405
49406
49407
49408
49409
49410
49411
49412
49413
49414
49415
49416
49417
49418
49419
49420
49421
49422
49423
49424
49425
49426
49427
49428
49429
49430
49431
49432
49433
49434
49435
49436
49437
49438
49439
49440
49441
49442
49443
49444
49445
49446
49447
49448
49449
49450
49451
49452
49453
49454
49455
49456
49457
49458
49459
49460
49461
49462
49463
49464
49465
49466
49467
49468
49469
49470
49471
49472
49473
49474
49475
49476
49477
49478
49479
49480
49481
49482
49483
49484
49485
49486
49487
49488
49489
49490
49491
49492
49493
49494
49495
49496
49497
49498
49499
49500
49501
49502
49503
49504
49505
49506
49507
49508
49509
49510
49511
49512
49513
49514
49515
49516
49517
49518
49519
49520
49521
49522
49523
49524
49525
49526
49527
49528
49529
49530
49531
49532
49533
49534
49535
49536
49537
49538
49539
49540
49541
49542
49543
49544
49545
49546
49547
49548
49549
49550
49551
49552
49553
49554
49555
49556
49557
49558
49559
49560
49561
49562
49563
49564
49565
49566
49567
49568
49569
49570
49571
49572
49573
49574
49575
49576
49577
49578
49579
49580
49581
49582
49583
49584
49585
49586
49587
49588
49589
49590
49591
49592
49593
49594
49595
49596
49597
49598
49599
49600
49601
49602
49603
49604
49605
49606
49607
49608
49609
49610
49611
49612
49613
49614
49615
49616
49617
49618
49619
49620
49621
49622
49623
49624
49625
49626
49627
49628
49629
49630
49631
49632
49633
49634
49635
49636
49637
49638
49639
49640
49641
49642
49643
49644
49645
49646
49647
49648
49649
49650
49651
49652
49653
49654
49655
49656
49657
49658
49659
49660
49661
49662
49663
49664
49665
49666
49667
49668
49669
49670
49671
49672
49673
49674
49675
49676
49677
49678
49679
49680
49681
49682
49683
49684
49685
49686
49687
49688
49689
49690
49691
49692
49693
49694
49695
49696
49697
49698
49699
49700
49701
49702
49703
49704
49705
49706
49707
49708
49709
49710
49711
49712
49713
49714
49715
49716
49717
49718
49719
49720
49721
49722
49723
49724
49725
49726
49727
49728
49729
49730
49731
49732
49733
49734
49735
49736
49737
49738
49739
49740
49741
49742
49743
49744
49745
49746
49747
49748
49749
49750
49751
49752
49753
49754
49755
49756
49757
49758
49759
49760
49761
49762
49763
49764
49765
49766
49767
49768
49769
49770
49771
49772
49773
49774
49775
49776
49777
49778
49779
49780
49781
49782
49783
49784
49785
49786
49787
49788
49789
49790
49791
49792
49793
49794
49795
49796
49797
49798
49799
49800
49801
49802
49803
49804
49805
49806
49807
49808
49809
49810
49811
49812
49813
49814
49815
49816
49817
49818
49819
49820
49821
49822
49823
49824
49825
49826
49827
49828
49829
49830
49831
49832
49833
49834
49835
49836
49837
49838
49839
49840
49841
49842
49843
49844
49845
49846
49847
49848
49849
49850
49851
49852
49853
49854
49855
49856
49857
49858
49859
49860
49861
49862
49863
49864
49865
49866
49867
49868
49869
49870
49871
49872
49873
49874
49875
49876
49877
49878
49879
49880
49881
49882
49883
49884
49885
49886
49887
49888
49889
49890
49891
49892
49893
49894
49895
49896
49897
49898
49899
49900
49901
49902
49903
49904
49905
49906
49907
49908
49909
49910
49911
49912
49913
49914
49915
49916
49917
49918
49919
49920
49921
49922
49923
49924
49925
49926
49927
49928
49929
49930
49931
49932
49933
49934
49935
49936
49937
49938
49939
49940
49941
49942
49943
49944
49945
49946
49947
49948
49949
49950
49951
49952
49953
49954
49955
49956
49957
49958
49959
49960
49961
49962
49963
49964
49965
49966
49967
49968
49969
49970
49971
49972
49973
49974
49975
49976
49977
49978
49979
49980
49981
49982
49983
49984
49985
49986
49987
49988
49989
49990
49991
49992
49993
49994
49995
49996
49997
49998
49999
50000
50001
50002
50003
50004
50005
50006
50007
50008
50009
50010
50011
50012
50013
50014
50015
50016
50017
50018
50019
50020
50021
50022
50023
50024
50025
50026
50027
50028
50029
50030
50031
50032
50033
50034
50035
50036
50037
50038
50039
50040
50041
50042
50043
50044
50045
50046
50047
50048
50049
50050
50051
50052
50053
50054
50055
50056
50057
50058
50059
50060
50061
50062
50063
50064
50065
50066
50067
50068
50069
50070
50071
50072
50073
50074
50075
50076
50077
50078
50079
50080
50081
50082
50083
50084
50085
50086
50087
50088
50089
50090
50091
50092
50093
50094
50095
50096
50097
50098
50099
50100
50101
50102
50103
50104
50105
50106
50107
50108
50109
50110
50111
50112
50113
50114
50115
50116
50117
50118
50119
50120
50121
50122
50123
50124
50125
50126
50127
50128
50129
50130
50131
50132
50133
50134
50135
50136
50137
50138
50139
50140
50141
50142
50143
50144
50145
50146
50147
50148
50149
50150
50151
50152
50153
50154
50155
50156
50157
50158
50159
50160
50161
50162
50163
50164
50165
50166
50167
50168
50169
50170
50171
50172
50173
50174
50175
50176
50177
50178
50179
50180
50181
50182
50183
50184
50185
50186
50187
50188
50189
50190
50191
50192
50193
50194
50195
50196
50197
50198
50199
50200
50201
50202
50203
50204
50205
50206
50207
50208
50209
50210
50211
50212
50213
50214
50215
50216
50217
50218
50219
50220
50221
50222
50223
50224
50225
50226
50227
50228
50229
50230
50231
50232
50233
50234
50235
50236
50237
50238
50239
50240
50241
50242
50243
50244
50245
50246
50247
50248
50249
50250
50251
50252
50253
50254
50255
50256
50257
50258
50259
50260
50261
50262
50263
50264
50265
50266
50267
50268
50269
50270
50271
50272
50273
50274
50275
50276
50277
50278
50279
50280
50281
50282
50283
50284
50285
50286
50287
50288
50289
50290
50291
50292
50293
50294
50295
50296
50297
50298
50299
50300
50301
50302
50303
50304
50305
50306
50307
50308
50309
50310
50311
50312
50313
50314
50315
50316
50317
50318
50319
50320
50321
50322
50323
50324
50325
50326
50327
50328
50329
50330
50331
50332
50333
50334
50335
50336
50337
50338
50339
50340
50341
50342
50343
50344
50345
50346
50347
50348
50349
50350
50351
50352
50353
50354
50355
50356
50357
50358
50359
50360
50361
50362
50363
50364
50365
50366
50367
50368
50369
50370
50371
50372
50373
50374
50375
50376
50377
50378
50379
50380
50381
50382
50383
50384
50385
50386
50387
50388
50389
50390
50391
50392
50393
50394
50395
50396
50397
50398
50399
50400
50401
50402
50403
50404
50405
50406
50407
50408
50409
50410
50411
50412
50413
50414
50415
50416
50417
50418
50419
50420
50421
50422
50423
50424
50425
50426
50427
50428
50429
50430
50431
50432
50433
50434
50435
50436
50437
50438
50439
50440
50441
50442
50443
50444
50445
50446
50447
50448
50449
50450
50451
50452
50453
50454
50455
50456
50457
50458
50459
50460
50461
50462
50463
50464
50465
50466
50467
50468
50469
50470
50471
50472
50473
50474
50475
50476
50477
50478
50479
50480
50481
50482
50483
50484
50485
50486
50487
50488
50489
50490
50491
50492
50493
50494
50495
50496
50497
50498
50499
50500
50501
50502
50503
50504
50505
50506
50507
50508
50509
50510
50511
50512
50513
50514
50515
50516
50517
50518
50519
50520
50521
50522
50523
50524
50525
50526
50527
50528
50529
50530
50531
50532
50533
50534
50535
50536
50537
50538
50539
50540
50541
50542
50543
50544
50545
50546
50547
50548
50549
50550
50551
50552
50553
50554
50555
50556
50557
50558
50559
50560
50561
50562
50563
50564
50565
50566
50567
50568
50569
50570
50571
50572
50573
50574
50575
50576
50577
50578
50579
50580
50581
50582
50583
50584
50585
50586
50587
50588
50589
50590
50591
50592
50593
50594
50595
50596
50597
50598
50599
50600
50601
50602
50603
50604
50605
50606
50607
50608
50609
50610
50611
50612
50613
50614
50615
50616
50617
50618
50619
50620
50621
50622
50623
50624
50625
50626
50627
50628
50629
50630
50631
50632
50633
50634
50635
50636
50637
50638
50639
50640
50641
50642
50643
50644
50645
50646
50647
50648
50649
50650
50651
50652
50653
50654
50655
50656
50657
50658
50659
50660
50661
50662
50663
50664
50665
50666
50667
50668
50669
50670
50671
50672
50673
50674
50675
50676
50677
50678
50679
50680
50681
50682
50683
50684
50685
50686
50687
50688
50689
50690
50691
50692
50693
50694
50695
50696
50697
50698
50699
50700
50701
50702
50703
50704
50705
50706
50707
50708
50709
50710
50711
50712
50713
50714
50715
50716
50717
50718
50719
50720
50721
50722
50723
50724
50725
50726
50727
50728
50729
50730
50731
50732
50733
50734
50735
50736
50737
50738
50739
50740
50741
50742
50743
50744
50745
50746
50747
50748
50749
50750
50751
50752
50753
50754
50755
50756
50757
50758
50759
50760
50761
50762
50763
50764
50765
50766
50767
50768
50769
50770
50771
50772
50773
50774
50775
50776
50777
50778
50779
50780
50781
50782
50783
50784
50785
50786
50787
50788
50789
50790
50791
50792
50793
50794
50795
50796
50797
50798
50799
50800
50801
50802
50803
50804
50805
50806
50807
50808
50809
50810
50811
50812
50813
50814
50815
50816
50817
50818
50819
50820
50821
50822
50823
50824
50825
50826
50827
50828
50829
50830
50831
50832
50833
50834
50835
50836
50837
50838
50839
50840
50841
50842
50843
50844
50845
50846
50847
50848
50849
50850
50851
50852
50853
50854
50855
50856
50857
50858
50859
50860
50861
50862
50863
50864
50865
50866
50867
50868
50869
50870
50871
50872
50873
50874
50875
50876
50877
50878
50879
50880
50881
50882
50883
50884
50885
50886
50887
50888
50889
50890
50891
50892
50893
50894
50895
50896
50897
50898
50899
50900
50901
50902
50903
50904
50905
50906
50907
50908
50909
50910
50911
50912
50913
50914
50915
50916
50917
50918
50919
50920
50921
50922
50923
50924
50925
50926
50927
50928
50929
50930
50931
50932
50933
50934
50935
50936
50937
50938
50939
50940
50941
50942
50943
50944
50945
50946
50947
50948
50949
50950
50951
50952
50953
50954
50955
50956
50957
50958
50959
50960
50961
50962
50963
50964
50965
50966
50967
50968
50969
50970
50971
50972
50973
50974
50975
50976
50977
50978
50979
50980
50981
50982
50983
50984
50985
50986
50987
50988
50989
50990
50991
50992
50993
50994
50995
50996
50997
50998
50999
51000
51001
51002
51003
51004
51005
51006
51007
51008
51009
51010
51011
51012
51013
51014
51015
51016
51017
51018
51019
51020
51021
51022
51023
51024
51025
51026
51027
51028
51029
51030
51031
51032
51033
51034
51035
51036
51037
51038
51039
51040
51041
51042
51043
51044
51045
51046
51047
51048
51049
51050
51051
51052
51053
51054
51055
51056
51057
51058
51059
51060
51061
51062
51063
51064
51065
51066
51067
51068
51069
51070
51071
51072
51073
51074
51075
51076
51077
51078
51079
51080
51081
51082
51083
51084
51085
51086
51087
51088
51089
51090
51091
51092
51093
51094
51095
51096
51097
51098
51099
51100
51101
51102
51103
51104
51105
51106
51107
51108
51109
51110
51111
51112
51113
51114
51115
51116
51117
51118
51119
51120
51121
51122
51123
51124
51125
51126
51127
51128
51129
51130
51131
51132
51133
51134
51135
51136
51137
51138
51139
51140
51141
51142
51143
51144
51145
51146
51147
51148
51149
51150
51151
51152
51153
51154
51155
51156
51157
51158
51159
51160
51161
51162
51163
51164
51165
51166
51167
51168
51169
51170
51171
51172
51173
51174
51175
51176
51177
51178
51179
51180
51181
51182
51183
51184
51185
51186
51187
51188
51189
51190
51191
51192
51193
51194
51195
51196
51197
51198
51199
51200
51201
51202
51203
51204
51205
51206
51207
51208
51209
51210
51211
51212
51213
51214
51215
51216
51217
51218
51219
51220
51221
51222
51223
51224
51225
51226
51227
51228
51229
51230
51231
51232
51233
51234
51235
51236
51237
51238
51239
51240
51241
51242
51243
51244
51245
51246
51247
51248
51249
51250
51251
51252
51253
51254
51255
51256
51257
51258
51259
51260
51261
51262
51263
51264
51265
51266
51267
51268
51269
51270
51271
51272
51273
51274
51275
51276
51277
51278
51279
51280
51281
51282
51283
51284
51285
51286
51287
51288
51289
51290
51291
51292
51293
51294
51295
51296
51297
51298
51299
51300
51301
51302
51303
51304
51305
51306
51307
51308
51309
51310
51311
51312
51313
51314
51315
51316
51317
51318
51319
51320
51321
51322
51323
51324
51325
51326
51327
51328
51329
51330
51331
51332
51333
51334
51335
51336
51337
51338
51339
51340
51341
51342
51343
51344
51345
51346
51347
51348
51349
51350
51351
51352
51353
51354
51355
51356
51357
51358
51359
51360
51361
51362
51363
51364
51365
51366
51367
51368
51369
51370
51371
51372
51373
51374
51375
51376
51377
51378
51379
51380
51381
51382
51383
51384
51385
51386
51387
51388
51389
51390
51391
51392
51393
51394
51395
51396
51397
51398
51399
51400
51401
51402
51403
51404
51405
51406
51407
51408
51409
51410
51411
51412
51413
51414
51415
51416
51417
51418
51419
51420
51421
51422
51423
51424
51425
51426
51427
51428
51429
51430
51431
51432
51433
51434
51435
51436
51437
51438
51439
51440
51441
51442
51443
51444
51445
51446
51447
51448
51449
51450
51451
51452
51453
51454
51455
51456
51457
51458
51459
51460
51461
51462
51463
51464
51465
51466
51467
51468
51469
51470
51471
51472
51473
51474
51475
51476
51477
51478
51479
51480
51481
51482
51483
51484
51485
51486
51487
51488
51489
51490
51491
51492
51493
51494
51495
51496
51497
51498
51499
51500
51501
51502
51503
51504
51505
51506
51507
51508
51509
51510
51511
51512
51513
51514
51515
51516
51517
51518
51519
51520
51521
51522
51523
51524
51525
51526
51527
51528
51529
51530
51531
51532
51533
51534
51535
51536
51537
51538
51539
51540
51541
51542
51543
51544
51545
51546
51547
51548
51549
51550
51551
51552
51553
51554
51555
51556
51557
51558
51559
51560
51561
51562
51563
51564
51565
51566
51567
51568
51569
51570
51571
51572
51573
51574
51575
51576
51577
51578
51579
51580
51581
51582
51583
51584
51585
51586
51587
51588
51589
51590
51591
51592
51593
51594
51595
51596
51597
51598
51599
51600
51601
51602
51603
51604
51605
51606
51607
51608
51609
51610
51611
51612
51613
51614
51615
51616
51617
51618
51619
51620
51621
51622
51623
51624
51625
51626
51627
51628
51629
51630
51631
51632
51633
51634
51635
51636
51637
51638
51639
51640
51641
51642
51643
51644
51645
51646
51647
51648
51649
51650
51651
51652
51653
51654
51655
51656
51657
51658
51659
51660
51661
51662
51663
51664
51665
51666
51667
51668
51669
51670
51671
51672
51673
51674
51675
51676
51677
51678
51679
51680
51681
51682
51683
51684
51685
51686
51687
51688
51689
51690
51691
51692
51693
51694
51695
51696
51697
51698
51699
51700
51701
51702
51703
51704
51705
51706
51707
51708
51709
51710
51711
51712
51713
51714
51715
51716
51717
51718
51719
51720
51721
51722
51723
51724
51725
51726
51727
51728
51729
51730
51731
51732
51733
51734
51735
51736
51737
51738
51739
51740
51741
51742
51743
51744
51745
51746
51747
51748
51749
51750
51751
51752
51753
51754
51755
51756
51757
51758
51759
51760
51761
51762
51763
51764
51765
51766
51767
51768
51769
51770
51771
51772
51773
51774
51775
51776
51777
51778
51779
51780
51781
51782
51783
51784
51785
51786
51787
51788
51789
51790
51791
51792
51793
51794
51795
51796
51797
51798
51799
51800
51801
51802
51803
51804
51805
51806
51807
51808
51809
51810
51811
51812
51813
51814
51815
51816
51817
51818
51819
51820
51821
51822
51823
51824
51825
51826
51827
51828
51829
51830
51831
51832
51833
51834
51835
51836
51837
51838
51839
51840
51841
51842
51843
51844
51845
51846
51847
51848
51849
51850
51851
51852
51853
51854
51855
51856
51857
51858
51859
51860
51861
51862
51863
51864
51865
51866
51867
51868
51869
51870
51871
51872
51873
51874
51875
51876
51877
51878
51879
51880
51881
51882
51883
51884
51885
51886
51887
51888
51889
51890
51891
51892
51893
51894
51895
51896
51897
51898
51899
51900
51901
51902
51903
51904
51905
51906
51907
51908
51909
51910
51911
51912
51913
51914
51915
51916
51917
51918
51919
51920
51921
51922
51923
51924
51925
51926
51927
51928
51929
51930
51931
51932
51933
51934
51935
51936
51937
51938
51939
51940
51941
51942
51943
51944
51945
51946
51947
51948
51949
51950
51951
51952
51953
51954
51955
51956
51957
51958
51959
51960
51961
51962
51963
51964
51965
51966
51967
51968
51969
51970
51971
51972
51973
51974
51975
51976
51977
51978
51979
51980
51981
51982
51983
51984
51985
51986
51987
51988
51989
51990
51991
51992
51993
51994
51995
51996
51997
51998
51999
52000
52001
52002
52003
52004
52005
52006
52007
52008
52009
52010
52011
52012
52013
52014
52015
52016
52017
52018
52019
52020
52021
52022
52023
52024
52025
52026
52027
52028
52029
52030
52031
52032
52033
52034
52035
52036
52037
52038
52039
52040
52041
52042
52043
52044
52045
52046
52047
52048
52049
52050
52051
52052
52053
52054
52055
52056
52057
52058
52059
52060
52061
52062
52063
52064
52065
52066
52067
52068
52069
52070
52071
52072
52073
52074
52075
52076
52077
52078
52079
52080
52081
52082
52083
52084
52085
52086
52087
52088
52089
52090
52091
52092
52093
52094
52095
52096
52097
52098
52099
52100
52101
52102
52103
52104
52105
52106
52107
52108
52109
52110
52111
52112
52113
52114
52115
52116
52117
52118
52119
52120
52121
52122
52123
52124
52125
52126
52127
52128
52129
52130
52131
52132
52133
52134
52135
52136
52137
52138
52139
52140
52141
52142
52143
52144
52145
52146
52147
52148
52149
52150
52151
52152
52153
52154
52155
52156
52157
52158
52159
52160
52161
52162
52163
52164
52165
52166
52167
52168
52169
52170
52171
52172
52173
52174
52175
52176
52177
52178
52179
52180
52181
52182
52183
52184
52185
52186
52187
52188
52189
52190
52191
52192
52193
52194
52195
52196
52197
52198
52199
52200
52201
52202
52203
52204
52205
52206
52207
52208
52209
52210
52211
52212
52213
52214
52215
52216
52217
52218
52219
52220
52221
52222
52223
52224
52225
52226
52227
52228
52229
52230
52231
52232
52233
52234
52235
52236
52237
52238
52239
52240
52241
52242
52243
52244
52245
52246
52247
52248
52249
52250
52251
52252
52253
52254
52255
52256
52257
52258
52259
52260
52261
52262
52263
52264
52265
52266
52267
52268
52269
52270
52271
52272
52273
52274
52275
52276
52277
52278
52279
52280
52281
52282
52283
52284
52285
52286
52287
52288
52289
52290
52291
52292
52293
52294
52295
52296
52297
52298
52299
52300
52301
52302
52303
52304
52305
52306
52307
52308
52309
52310
52311
52312
52313
52314
52315
52316
52317
52318
52319
52320
52321
52322
52323
52324
52325
52326
52327
52328
52329
52330
52331
52332
52333
52334
52335
52336
52337
52338
52339
52340
52341
52342
52343
52344
52345
52346
52347
52348
52349
52350
52351
52352
52353
52354
52355
52356
52357
52358
52359
52360
52361
52362
52363
52364
52365
52366
52367
52368
52369
52370
52371
52372
52373
52374
52375
52376
52377
52378
52379
52380
52381
52382
52383
52384
52385
52386
52387
52388
52389
52390
52391
52392
52393
52394
52395
52396
52397
52398
52399
52400
52401
52402
52403
52404
52405
52406
52407
52408
52409
52410
52411
52412
52413
52414
52415
52416
52417
52418
52419
52420
52421
52422
52423
52424
52425
52426
52427
52428
52429
52430
52431
52432
52433
52434
52435
52436
52437
52438
52439
52440
52441
52442
52443
52444
52445
52446
52447
52448
52449
52450
52451
52452
52453
52454
52455
52456
52457
52458
52459
52460
52461
52462
52463
52464
52465
52466
52467
52468
52469
52470
52471
52472
52473
52474
52475
52476
52477
52478
52479
52480
52481
52482
52483
52484
52485
52486
52487
52488
52489
52490
52491
52492
52493
52494
52495
52496
52497
52498
52499
52500
52501
52502
52503
52504
52505
52506
52507
52508
52509
52510
52511
52512
52513
52514
52515
52516
52517
52518
52519
52520
52521
52522
52523
52524
52525
52526
52527
52528
52529
52530
52531
52532
52533
52534
52535
52536
52537
52538
52539
52540
52541
52542
52543
52544
52545
52546
52547
52548
52549
52550
52551
52552
52553
52554
52555
52556
52557
52558
52559
52560
52561
52562
52563
52564
52565
52566
52567
52568
52569
52570
52571
52572
52573
52574
52575
52576
52577
52578
52579
52580
52581
52582
52583
52584
52585
52586
52587
52588
52589
52590
52591
52592
52593
52594
52595
52596
52597
52598
52599
52600
52601
52602
52603
52604
52605
52606
52607
52608
52609
52610
52611
52612
52613
52614
52615
52616
52617
52618
52619
52620
52621
52622
52623
52624
52625
52626
52627
52628
52629
52630
52631
52632
52633
52634
52635
52636
52637
52638
52639
52640
52641
52642
52643
52644
52645
52646
52647
52648
52649
52650
52651
52652
52653
52654
52655
52656
52657
52658
52659
52660
52661
52662
52663
52664
52665
52666
52667
52668
52669
52670
52671
52672
52673
52674
52675
52676
52677
52678
52679
52680
52681
52682
52683
52684
52685
52686
52687
52688
52689
52690
52691
52692
52693
52694
52695
52696
52697
52698
52699
52700
52701
52702
52703
52704
52705
52706
52707
52708
52709
52710
52711
52712
52713
52714
52715
52716
52717
52718
52719
52720
52721
52722
52723
52724
52725
52726
52727
52728
52729
52730
52731
52732
52733
52734
52735
52736
52737
52738
52739
52740
52741
52742
52743
52744
52745
52746
52747
52748
52749
52750
52751
52752
52753
52754
52755
52756
52757
52758
52759
52760
52761
52762
52763
52764
52765
52766
52767
52768
52769
52770
52771
52772
52773
52774
52775
52776
52777
52778
52779
52780
52781
52782
52783
52784
52785
52786
52787
52788
52789
52790
52791
52792
52793
52794
52795
52796
52797
52798
52799
52800
52801
52802
52803
52804
52805
52806
52807
52808
52809
52810
52811
52812
52813
52814
52815
52816
52817
52818
52819
52820
52821
52822
52823
52824
52825
52826
52827
52828
52829
52830
52831
52832
52833
52834
52835
52836
52837
52838
52839
52840
52841
52842
52843
52844
52845
52846
52847
52848
52849
52850
52851
52852
52853
52854
52855
52856
52857
52858
52859
52860
52861
52862
52863
52864
52865
52866
52867
52868
52869
52870
52871
52872
52873
52874
52875
52876
52877
52878
52879
52880
52881
52882
52883
52884
52885
52886
52887
52888
52889
52890
52891
52892
52893
52894
52895
52896
52897
52898
52899
52900
52901
52902
52903
52904
52905
52906
52907
52908
52909
52910
52911
52912
52913
52914
52915
52916
52917
52918
52919
52920
52921
52922
52923
52924
52925
52926
52927
52928
52929
52930
52931
52932
52933
52934
52935
52936
52937
52938
52939
52940
52941
52942
52943
52944
52945
52946
52947
52948
52949
52950
52951
52952
52953
52954
52955
52956
52957
52958
52959
52960
52961
52962
52963
52964
52965
52966
52967
52968
52969
52970
52971
52972
52973
52974
52975
52976
52977
52978
52979
52980
52981
52982
52983
52984
52985
52986
52987
52988
52989
52990
52991
52992
52993
52994
52995
52996
52997
52998
52999
53000
53001
53002
53003
53004
53005
53006
53007
53008
53009
53010
53011
53012
53013
53014
53015
53016
53017
53018
53019
53020
53021
53022
53023
53024
53025
53026
53027
53028
53029
53030
53031
53032
53033
53034
53035
53036
53037
53038
53039
53040
53041
53042
53043
53044
53045
53046
53047
53048
53049
53050
53051
53052
53053
53054
53055
53056
53057
53058
53059
53060
53061
53062
53063
53064
53065
53066
53067
53068
53069
53070
53071
53072
53073
53074
53075
53076
53077
53078
53079
53080
53081
53082
53083
53084
53085
53086
53087
53088
53089
53090
53091
53092
53093
53094
53095
53096
53097
53098
53099
53100
53101
53102
53103
53104
53105
53106
53107
53108
53109
53110
53111
53112
53113
53114
53115
53116
53117
53118
53119
53120
53121
53122
53123
53124
53125
53126
53127
53128
53129
53130
53131
53132
53133
53134
53135
53136
53137
53138
53139
53140
53141
53142
53143
53144
53145
53146
53147
53148
53149
53150
53151
53152
53153
53154
53155
53156
53157
53158
53159
53160
53161
53162
53163
53164
53165
53166
53167
53168
53169
53170
53171
53172
53173
53174
53175
53176
53177
53178
53179
53180
53181
53182
53183
53184
53185
53186
53187
53188
53189
53190
53191
53192
53193
53194
53195
53196
53197
53198
53199
53200
53201
53202
53203
53204
53205
53206
53207
53208
53209
53210
53211
53212
53213
53214
53215
53216
53217
53218
53219
53220
53221
53222
53223
53224
53225
53226
53227
53228
53229
53230
53231
53232
53233
53234
53235
53236
53237
53238
53239
53240
53241
53242
53243
53244
53245
53246
53247
53248
53249
53250
53251
53252
53253
53254
53255
53256
53257
53258
53259
53260
53261
53262
53263
53264
53265
53266
53267
53268
53269
53270
53271
53272
53273
53274
53275
53276
53277
53278
53279
53280
53281
53282
53283
53284
53285
53286
53287
53288
53289
53290
53291
53292
53293
53294
53295
53296
53297
53298
53299
53300
53301
53302
53303
53304
53305
53306
53307
53308
53309
53310
53311
53312
53313
53314
53315
53316
53317
53318
53319
53320
53321
53322
53323
53324
53325
53326
53327
53328
53329
53330
53331
53332
53333
53334
53335
53336
53337
53338
53339
53340
53341
53342
53343
53344
53345
53346
53347
53348
53349
53350
53351
53352
53353
53354
53355
53356
53357
53358
53359
53360
53361
53362
53363
53364
53365
53366
53367
53368
53369
53370
53371
53372
53373
53374
53375
53376
53377
53378
53379
53380
53381
53382
53383
53384
53385
53386
53387
53388
53389
53390
53391
53392
53393
53394
53395
53396
53397
53398
53399
53400
53401
53402
53403
53404
53405
53406
53407
53408
53409
53410
53411
53412
53413
53414
53415
53416
53417
53418
53419
53420
53421
53422
53423
53424
53425
53426
53427
53428
53429
53430
53431
53432
53433
53434
53435
53436
53437
53438
53439
53440
53441
53442
53443
53444
53445
53446
53447
53448
53449
53450
53451
53452
53453
53454
53455
53456
53457
53458
53459
53460
53461
53462
53463
53464
53465
53466
53467
53468
53469
53470
53471
53472
53473
53474
53475
53476
53477
53478
53479
53480
53481
53482
53483
53484
53485
53486
53487
53488
53489
53490
53491
53492
53493
53494
53495
53496
53497
53498
53499
53500
53501
53502
53503
53504
53505
53506
53507
53508
53509
53510
53511
53512
53513
53514
53515
53516
53517
53518
53519
53520
53521
53522
53523
53524
53525
53526
53527
53528
53529
53530
53531
53532
53533
53534
53535
53536
53537
53538
53539
53540
53541
53542
53543
53544
53545
53546
53547
53548
53549
53550
53551
53552
53553
53554
53555
53556
53557
53558
53559
53560
53561
53562
53563
53564
53565
53566
53567
53568
53569
53570
53571
53572
53573
53574
53575
53576
53577
53578
53579
53580
53581
53582
53583
53584
53585
53586
53587
53588
53589
53590
53591
53592
53593
53594
53595
53596
53597
53598
53599
53600
53601
53602
53603
53604
53605
53606
53607
53608
53609
53610
53611
53612
53613
53614
53615
53616
53617
53618
53619
53620
53621
53622
53623
53624
53625
53626
53627
53628
53629
53630
53631
53632
53633
53634
53635
53636
53637
53638
53639
53640
53641
53642
53643
53644
53645
53646
53647
53648
53649
53650
53651
53652
53653
53654
53655
53656
53657
53658
53659
53660
53661
53662
53663
53664
53665
53666
53667
53668
53669
53670
53671
53672
53673
53674
53675
53676
53677
53678
53679
53680
53681
53682
53683
53684
53685
53686
53687
53688
53689
53690
53691
53692
53693
53694
53695
53696
53697
53698
53699
53700
53701
53702
53703
53704
53705
53706
53707
53708
53709
53710
53711
53712
53713
53714
53715
53716
53717
53718
53719
53720
53721
53722
53723
53724
53725
53726
53727
53728
53729
53730
53731
53732
53733
53734
53735
53736
53737
53738
53739
53740
53741
53742
53743
53744
53745
53746
53747
53748
53749
53750
53751
53752
53753
53754
53755
53756
53757
53758
53759
53760
53761
53762
53763
53764
53765
53766
53767
53768
53769
53770
53771
53772
53773
53774
53775
53776
53777
53778
53779
53780
53781
53782
53783
53784
53785
53786
53787
53788
53789
53790
53791
53792
53793
53794
53795
53796
53797
53798
53799
53800
53801
53802
53803
53804
53805
53806
53807
53808
53809
53810
53811
53812
53813
53814
53815
53816
53817
53818
53819
53820
53821
53822
53823
53824
53825
53826
53827
53828
53829
53830
53831
53832
53833
53834
53835
53836
53837
53838
53839
53840
53841
53842
53843
53844
53845
53846
53847
53848
53849
53850
53851
53852
53853
53854
53855
53856
53857
53858
53859
53860
53861
53862
53863
53864
53865
53866
53867
53868
53869
53870
53871
53872
53873
53874
53875
53876
53877
53878
53879
53880
53881
53882
53883
53884
53885
53886
53887
53888
53889
53890
53891
53892
53893
53894
53895
53896
53897
53898
53899
53900
53901
53902
53903
53904
53905
53906
53907
53908
53909
53910
53911
53912
53913
53914
53915
53916
53917
53918
53919
53920
53921
53922
53923
53924
53925
53926
53927
53928
53929
53930
53931
53932
53933
53934
53935
53936
53937
53938
53939
53940
53941
53942
53943
53944
53945
53946
53947
53948
53949
53950
53951
53952
53953
53954
53955
53956
53957
53958
53959
53960
53961
53962
53963
53964
53965
53966
53967
53968
53969
53970
53971
53972
53973
53974
53975
53976
53977
53978
53979
53980
53981
53982
53983
53984
53985
53986
53987
53988
53989
53990
53991
53992
53993
53994
53995
53996
53997
53998
53999
54000
54001
54002
54003
54004
54005
54006
54007
54008
54009
54010
54011
54012
54013
54014
54015
54016
54017
54018
54019
54020
54021
54022
54023
54024
54025
54026
54027
54028
54029
54030
54031
54032
54033
54034
54035
54036
54037
54038
54039
54040
54041
54042
54043
54044
54045
54046
54047
54048
54049
54050
54051
54052
54053
54054
54055
54056
54057
54058
54059
54060
54061
54062
54063
54064
54065
54066
54067
54068
54069
54070
54071
54072
54073
54074
54075
54076
54077
54078
54079
54080
54081
54082
54083
54084
54085
54086
54087
54088
54089
54090
54091
54092
54093
54094
54095
54096
54097
54098
54099
54100
54101
54102
54103
54104
54105
54106
54107
54108
54109
54110
54111
54112
54113
54114
54115
54116
54117
54118
54119
54120
54121
54122
54123
54124
54125
54126
54127
54128
54129
54130
54131
54132
54133
54134
54135
54136
54137
54138
54139
54140
54141
54142
54143
54144
54145
54146
54147
54148
54149
54150
54151
54152
54153
54154
54155
54156
54157
54158
54159
54160
54161
54162
54163
54164
54165
54166
54167
54168
54169
54170
54171
54172
54173
54174
54175
54176
54177
54178
54179
54180
54181
54182
54183
54184
54185
54186
54187
54188
54189
54190
54191
54192
54193
54194
54195
54196
54197
54198
54199
54200
54201
54202
54203
54204
54205
54206
54207
54208
54209
54210
54211
54212
54213
54214
54215
54216
54217
54218
54219
54220
54221
54222
54223
54224
54225
54226
54227
54228
54229
54230
54231
54232
54233
54234
54235
54236
54237
54238
54239
54240
54241
54242
54243
54244
54245
54246
54247
54248
54249
54250
54251
54252
54253
54254
54255
54256
54257
54258
54259
54260
54261
54262
54263
54264
54265
54266
54267
54268
54269
54270
54271
54272
54273
54274
54275
54276
54277
54278
54279
54280
54281
54282
54283
54284
54285
54286
54287
54288
54289
54290
54291
54292
54293
54294
54295
54296
54297
54298
54299
54300
54301
54302
54303
54304
54305
54306
54307
54308
54309
54310
54311
54312
54313
54314
54315
54316
54317
54318
54319
54320
54321
54322
54323
54324
54325
54326
54327
54328
54329
54330
54331
54332
54333
54334
54335
54336
54337
54338
54339
54340
54341
54342
54343
54344
54345
54346
54347
54348
54349
54350
54351
54352
54353
54354
54355
54356
54357
54358
54359
54360
54361
54362
54363
54364
54365
54366
54367
54368
54369
54370
54371
54372
54373
54374
54375
54376
54377
54378
54379
54380
54381
54382
54383
54384
54385
54386
54387
54388
54389
54390
54391
54392
54393
54394
54395
54396
54397
54398
54399
54400
54401
54402
54403
54404
54405
54406
54407
54408
54409
54410
54411
54412
54413
54414
54415
54416
54417
54418
54419
54420
54421
54422
54423
54424
54425
54426
54427
54428
54429
54430
54431
54432
54433
54434
54435
54436
54437
54438
54439
54440
54441
54442
54443
54444
54445
54446
54447
54448
54449
54450
54451
54452
54453
54454
54455
54456
54457
54458
54459
54460
54461
54462
54463
54464
54465
54466
54467
54468
54469
54470
54471
54472
54473
54474
54475
54476
54477
54478
54479
54480
54481
54482
54483
54484
54485
54486
54487
54488
54489
54490
54491
54492
54493
54494
54495
54496
54497
54498
54499
54500
54501
54502
54503
54504
54505
54506
54507
54508
54509
54510
54511
54512
54513
54514
54515
54516
54517
54518
54519
54520
54521
54522
54523
54524
54525
54526
54527
54528
54529
54530
54531
54532
54533
54534
54535
54536
54537
54538
54539
54540
54541
54542
54543
54544
54545
54546
54547
54548
54549
54550
54551
54552
54553
54554
54555
54556
54557
54558
54559
54560
54561
54562
54563
54564
54565
54566
54567
54568
54569
54570
54571
54572
54573
54574
54575
54576
54577
54578
54579
54580
54581
54582
54583
54584
54585
54586
54587
54588
54589
54590
54591
54592
54593
54594
54595
54596
54597
54598
54599
54600
54601
54602
54603
54604
54605
54606
54607
54608
54609
54610
54611
54612
54613
54614
54615
54616
54617
54618
54619
54620
54621
54622
54623
54624
54625
54626
54627
54628
54629
54630
54631
54632
54633
54634
54635
54636
54637
54638
54639
54640
54641
54642
54643
54644
54645
54646
54647
54648
54649
54650
54651
54652
54653
54654
54655
54656
54657
54658
54659
54660
54661
54662
54663
54664
54665
54666
54667
54668
54669
54670
54671
54672
54673
54674
54675
54676
54677
54678
54679
54680
54681
54682
54683
54684
54685
54686
54687
54688
54689
54690
54691
54692
54693
54694
54695
54696
54697
54698
54699
54700
54701
54702
54703
54704
54705
54706
54707
54708
54709
54710
54711
54712
54713
54714
54715
54716
54717
54718
54719
54720
54721
54722
54723
54724
54725
54726
54727
54728
54729
54730
54731
54732
54733
54734
54735
54736
54737
54738
54739
54740
54741
54742
54743
54744
54745
54746
54747
54748
54749
54750
54751
54752
54753
54754
54755
54756
54757
54758
54759
54760
54761
54762
54763
54764
54765
54766
54767
54768
54769
54770
54771
54772
54773
54774
54775
54776
54777
54778
54779
54780
54781
54782
54783
54784
54785
54786
54787
54788
54789
54790
54791
54792
54793
54794
54795
54796
54797
54798
54799
54800
54801
54802
54803
54804
54805
54806
54807
54808
54809
54810
54811
54812
54813
54814
54815
54816
54817
54818
54819
54820
54821
54822
54823
54824
54825
54826
54827
54828
54829
54830
54831
54832
54833
54834
54835
54836
54837
54838
54839
54840
54841
54842
54843
54844
54845
54846
54847
54848
54849
54850
54851
54852
54853
54854
54855
54856
54857
54858
54859
54860
54861
54862
54863
54864
54865
54866
54867
54868
54869
54870
54871
54872
54873
54874
54875
54876
54877
54878
54879
54880
54881
54882
54883
54884
54885
54886
54887
54888
54889
54890
54891
54892
54893
54894
54895
54896
54897
54898
54899
54900
54901
54902
54903
54904
54905
54906
54907
54908
54909
54910
54911
54912
54913
54914
54915
54916
54917
54918
54919
54920
54921
54922
54923
54924
54925
54926
54927
54928
54929
54930
54931
54932
54933
54934
54935
54936
54937
54938
54939
54940
54941
54942
54943
54944
54945
54946
54947
54948
54949
54950
54951
54952
54953
54954
54955
54956
54957
54958
54959
54960
54961
54962
54963
54964
54965
54966
54967
54968
54969
54970
54971
54972
54973
54974
54975
54976
54977
54978
54979
54980
54981
54982
54983
54984
54985
54986
54987
54988
54989
54990
54991
54992
54993
54994
54995
54996
54997
54998
54999
55000
55001
55002
55003
55004
55005
55006
55007
55008
55009
55010
55011
55012
55013
55014
55015
55016
55017
55018
55019
55020
55021
55022
55023
55024
55025
55026
55027
55028
55029
55030
55031
55032
55033
55034
55035
55036
55037
55038
55039
55040
55041
55042
55043
55044
55045
55046
55047
55048
55049
55050
55051
55052
55053
55054
55055
55056
55057
55058
55059
55060
55061
55062
55063
55064
55065
55066
55067
55068
55069
55070
55071
55072
55073
55074
55075
55076
55077
55078
55079
55080
55081
55082
55083
55084
55085
55086
55087
55088
55089
55090
55091
55092
55093
55094
55095
55096
55097
55098
55099
55100
55101
55102
55103
55104
55105
55106
55107
55108
55109
55110
55111
55112
55113
55114
55115
55116
55117
55118
55119
55120
55121
55122
55123
55124
55125
55126
55127
55128
55129
55130
55131
55132
55133
55134
55135
55136
55137
55138
55139
55140
55141
55142
55143
55144
55145
55146
55147
55148
55149
55150
55151
55152
55153
55154
55155
55156
55157
55158
55159
55160
55161
55162
55163
55164
55165
55166
55167
55168
55169
55170
55171
55172
55173
55174
55175
55176
55177
55178
55179
55180
55181
55182
55183
55184
55185
55186
55187
55188
55189
55190
55191
55192
55193
55194
55195
55196
55197
55198
55199
55200
55201
55202
55203
55204
55205
55206
55207
55208
55209
55210
55211
55212
55213
55214
55215
55216
55217
55218
55219
55220
55221
55222
55223
55224
55225
55226
55227
55228
55229
55230
55231
55232
55233
55234
55235
55236
55237
55238
55239
55240
55241
55242
55243
55244
55245
55246
55247
55248
55249
55250
55251
55252
55253
55254
55255
55256
55257
55258
55259
55260
55261
55262
55263
55264
55265
55266
55267
55268
55269
55270
55271
55272
55273
55274
55275
55276
55277
55278
55279
55280
55281
55282
55283
55284
55285
55286
55287
55288
55289
55290
55291
55292
55293
55294
55295
55296
55297
55298
55299
55300
55301
55302
55303
55304
55305
55306
55307
55308
55309
55310
55311
55312
55313
55314
55315
55316
55317
55318
55319
55320
55321
55322
55323
55324
55325
55326
55327
55328
55329
55330
55331
55332
55333
55334
55335
55336
55337
55338
55339
55340
55341
55342
55343
55344
55345
55346
55347
55348
55349
55350
55351
55352
55353
55354
55355
55356
55357
55358
55359
55360
55361
55362
55363
55364
55365
55366
55367
55368
55369
55370
55371
55372
55373
55374
55375
55376
55377
55378
55379
55380
55381
55382
55383
55384
55385
55386
55387
55388
55389
55390
55391
55392
55393
55394
55395
55396
55397
55398
55399
55400
55401
55402
55403
55404
55405
55406
55407
55408
55409
55410
55411
55412
55413
55414
55415
55416
55417
55418
55419
55420
55421
55422
55423
55424
55425
55426
55427
55428
55429
55430
55431
55432
55433
55434
55435
55436
55437
55438
55439
55440
55441
55442
55443
55444
55445
55446
55447
55448
55449
55450
55451
55452
55453
55454
55455
55456
55457
55458
55459
55460
55461
55462
55463
55464
55465
55466
55467
55468
55469
55470
55471
55472
55473
55474
55475
55476
55477
55478
55479
55480
55481
55482
55483
55484
55485
55486
55487
55488
55489
55490
55491
55492
55493
55494
55495
55496
55497
55498
55499
55500
55501
55502
55503
55504
55505
55506
55507
55508
55509
55510
55511
55512
55513
55514
55515
55516
55517
55518
55519
55520
55521
55522
55523
55524
55525
55526
55527
55528
55529
55530
55531
55532
55533
55534
55535
55536
55537
55538
55539
55540
55541
55542
55543
55544
55545
55546
55547
55548
55549
55550
55551
55552
55553
55554
55555
55556
55557
55558
55559
55560
55561
55562
55563
55564
55565
55566
55567
55568
55569
55570
55571
55572
55573
55574
55575
55576
55577
55578
55579
55580
55581
55582
55583
55584
55585
55586
55587
55588
55589
55590
55591
55592
55593
55594
55595
55596
55597
55598
55599
55600
55601
55602
55603
55604
55605
55606
55607
55608
55609
55610
55611
55612
55613
55614
55615
55616
55617
55618
55619
55620
55621
55622
55623
55624
55625
55626
55627
55628
55629
55630
55631
55632
55633
55634
55635
55636
55637
55638
55639
55640
55641
55642
55643
55644
55645
55646
55647
55648
55649
55650
55651
55652
55653
55654
55655
55656
55657
55658
55659
55660
55661
55662
55663
55664
55665
55666
55667
55668
55669
55670
55671
55672
55673
55674
55675
55676
55677
55678
55679
55680
55681
55682
55683
55684
55685
55686
55687
55688
55689
55690
55691
55692
55693
55694
55695
55696
55697
55698
55699
55700
55701
55702
55703
55704
55705
55706
55707
55708
55709
55710
55711
55712
55713
55714
55715
55716
55717
55718
55719
55720
55721
55722
55723
55724
55725
55726
55727
55728
55729
55730
55731
55732
55733
55734
55735
55736
55737
55738
55739
55740
55741
55742
55743
55744
55745
55746
55747
55748
55749
55750
55751
55752
55753
55754
55755
55756
55757
55758
55759
55760
55761
55762
55763
55764
55765
55766
55767
55768
55769
55770
55771
55772
55773
55774
55775
55776
55777
55778
55779
55780
55781
55782
55783
55784
55785
55786
55787
55788
55789
55790
55791
55792
55793
55794
55795
55796
55797
55798
55799
55800
55801
55802
55803
55804
55805
55806
55807
55808
55809
55810
55811
55812
55813
55814
55815
55816
55817
55818
55819
55820
55821
55822
55823
55824
55825
55826
55827
55828
55829
55830
55831
55832
55833
55834
55835
55836
55837
55838
55839
55840
55841
55842
55843
55844
55845
55846
55847
55848
55849
55850
55851
55852
55853
55854
55855
55856
55857
55858
55859
55860
55861
55862
55863
55864
55865
55866
55867
55868
55869
55870
55871
55872
55873
55874
55875
55876
55877
55878
55879
55880
55881
55882
55883
55884
55885
55886
55887
55888
55889
55890
55891
55892
55893
55894
55895
55896
55897
55898
55899
55900
55901
55902
55903
55904
55905
55906
55907
55908
55909
55910
55911
55912
55913
55914
55915
55916
55917
55918
55919
55920
55921
55922
55923
55924
55925
55926
55927
55928
55929
55930
55931
55932
55933
55934
55935
55936
55937
55938
55939
55940
55941
55942
55943
55944
55945
55946
55947
55948
55949
55950
55951
55952
55953
55954
55955
55956
55957
55958
55959
55960
55961
55962
55963
55964
55965
55966
55967
55968
55969
55970
55971
55972
55973
55974
55975
55976
55977
55978
55979
55980
55981
55982
55983
55984
55985
55986
55987
55988
55989
55990
55991
55992
55993
55994
55995
55996
55997
55998
55999
56000
56001
56002
56003
56004
56005
56006
56007
56008
56009
56010
56011
56012
56013
56014
56015
56016
56017
56018
56019
56020
56021
56022
56023
56024
56025
56026
56027
56028
56029
56030
56031
56032
56033
56034
56035
56036
56037
56038
56039
56040
56041
56042
56043
56044
56045
56046
56047
56048
56049
56050
56051
56052
56053
56054
56055
56056
56057
56058
56059
56060
56061
56062
56063
56064
56065
56066
56067
56068
56069
56070
56071
56072
56073
56074
56075
56076
56077
56078
56079
56080
56081
56082
56083
56084
56085
56086
56087
56088
56089
56090
56091
56092
56093
56094
56095
56096
56097
56098
56099
56100
56101
56102
56103
56104
56105
56106
56107
56108
56109
56110
56111
56112
56113
56114
56115
56116
56117
56118
56119
56120
56121
56122
56123
56124
56125
56126
56127
56128
56129
56130
56131
56132
56133
56134
56135
56136
56137
56138
56139
56140
56141
56142
56143
56144
56145
56146
56147
56148
56149
56150
56151
56152
56153
56154
56155
56156
56157
56158
56159
56160
56161
56162
56163
56164
56165
56166
56167
56168
56169
56170
56171
56172
56173
56174
56175
56176
56177
56178
56179
56180
56181
56182
56183
56184
56185
56186
56187
56188
56189
56190
56191
56192
56193
56194
56195
56196
56197
56198
56199
56200
56201
56202
56203
56204
56205
56206
56207
56208
56209
56210
56211
56212
56213
56214
56215
56216
56217
56218
56219
56220
56221
56222
56223
56224
56225
56226
56227
56228
56229
56230
56231
56232
56233
56234
56235
56236
56237
56238
56239
56240
56241
56242
56243
56244
56245
56246
56247
56248
56249
56250
56251
56252
56253
56254
56255
56256
56257
56258
56259
56260
56261
56262
56263
56264
56265
56266
56267
56268
56269
56270
56271
56272
56273
56274
56275
56276
56277
56278
56279
56280
56281
56282
56283
56284
56285
56286
56287
56288
56289
56290
56291
56292
56293
56294
56295
56296
56297
56298
56299
56300
56301
56302
56303
56304
56305
56306
56307
56308
56309
56310
56311
56312
56313
56314
56315
56316
56317
56318
56319
56320
56321
56322
56323
56324
56325
56326
56327
56328
56329
56330
56331
56332
56333
56334
56335
56336
56337
56338
56339
56340
56341
56342
56343
56344
56345
56346
56347
56348
56349
56350
56351
56352
56353
56354
56355
56356
56357
56358
56359
56360
56361
56362
56363
56364
56365
56366
56367
56368
56369
56370
56371
56372
56373
56374
56375
56376
56377
56378
56379
56380
56381
56382
56383
56384
56385
56386
56387
56388
56389
56390
56391
56392
56393
56394
56395
56396
56397
56398
56399
56400
56401
56402
56403
56404
56405
56406
56407
56408
56409
56410
56411
56412
56413
56414
56415
56416
56417
56418
56419
56420
56421
56422
56423
56424
56425
56426
56427
56428
56429
56430
56431
56432
56433
56434
56435
56436
56437
56438
56439
56440
56441
56442
56443
56444
56445
56446
56447
56448
56449
56450
56451
56452
56453
56454
56455
56456
56457
56458
56459
56460
56461
56462
56463
56464
56465
56466
56467
56468
56469
56470
56471
56472
56473
56474
56475
56476
56477
56478
56479
56480
56481
56482
56483
56484
56485
56486
56487
56488
56489
56490
56491
56492
56493
56494
56495
56496
56497
56498
56499
56500
56501
56502
56503
56504
56505
56506
56507
56508
56509
56510
56511
56512
56513
56514
56515
56516
56517
56518
56519
56520
56521
56522
56523
56524
56525
56526
56527
56528
56529
56530
56531
56532
56533
56534
56535
56536
56537
56538
56539
56540
56541
56542
56543
56544
56545
56546
56547
56548
56549
56550
56551
56552
56553
56554
56555
56556
56557
56558
56559
56560
56561
56562
56563
56564
56565
56566
56567
56568
56569
56570
56571
56572
56573
56574
56575
56576
56577
56578
56579
56580
56581
56582
56583
56584
56585
56586
56587
56588
56589
56590
56591
56592
56593
56594
56595
56596
56597
56598
56599
56600
56601
56602
56603
56604
56605
56606
56607
56608
56609
56610
56611
56612
56613
56614
56615
56616
56617
56618
56619
56620
56621
56622
56623
56624
56625
56626
56627
56628
56629
56630
56631
56632
56633
56634
56635
56636
56637
56638
56639
56640
56641
56642
56643
56644
56645
56646
56647
56648
56649
56650
56651
56652
56653
56654
56655
56656
56657
56658
56659
56660
56661
56662
56663
56664
56665
56666
56667
56668
56669
56670
56671
56672
56673
56674
56675
56676
56677
56678
56679
56680
56681
56682
56683
56684
56685
56686
56687
56688
56689
56690
56691
56692
56693
56694
56695
56696
56697
56698
56699
56700
56701
56702
56703
56704
56705
56706
56707
56708
56709
56710
56711
56712
56713
56714
56715
56716
56717
56718
56719
56720
56721
56722
56723
56724
56725
56726
56727
56728
56729
56730
56731
56732
56733
56734
56735
56736
56737
56738
56739
56740
56741
56742
56743
56744
56745
56746
56747
56748
56749
56750
56751
56752
56753
56754
56755
56756
56757
56758
56759
56760
56761
56762
56763
56764
56765
56766
56767
56768
56769
56770
56771
56772
56773
56774
56775
56776
56777
56778
56779
56780
56781
56782
56783
56784
56785
56786
56787
56788
56789
56790
56791
56792
56793
56794
56795
56796
56797
56798
56799
56800
56801
56802
56803
56804
56805
56806
56807
56808
56809
56810
56811
56812
56813
56814
56815
56816
56817
56818
56819
56820
56821
56822
56823
56824
56825
56826
56827
56828
56829
56830
56831
56832
56833
56834
56835
56836
56837
56838
56839
56840
56841
56842
56843
56844
56845
56846
56847
56848
56849
56850
56851
56852
56853
56854
56855
56856
56857
56858
56859
56860
56861
56862
56863
56864
56865
56866
56867
56868
56869
56870
56871
56872
56873
56874
56875
56876
56877
56878
56879
56880
56881
56882
56883
56884
56885
56886
56887
56888
56889
56890
56891
56892
56893
56894
56895
56896
56897
56898
56899
56900
56901
56902
56903
56904
56905
56906
56907
56908
56909
56910
56911
56912
56913
56914
56915
56916
56917
56918
56919
56920
56921
56922
56923
56924
56925
56926
56927
56928
56929
56930
56931
56932
56933
56934
56935
56936
56937
56938
56939
56940
56941
56942
56943
56944
56945
56946
56947
56948
56949
56950
56951
56952
56953
56954
56955
56956
56957
56958
56959
56960
56961
56962
56963
56964
56965
56966
56967
56968
56969
56970
56971
56972
56973
56974
56975
56976
56977
56978
56979
56980
56981
56982
56983
56984
56985
56986
56987
56988
56989
56990
56991
56992
56993
56994
56995
56996
56997
56998
56999
57000
57001
57002
57003
57004
57005
57006
57007
57008
57009
57010
57011
57012
57013
57014
57015
57016
57017
57018
57019
57020
57021
57022
57023
57024
57025
57026
57027
57028
57029
57030
57031
57032
57033
57034
57035
57036
57037
57038
57039
57040
57041
57042
57043
57044
57045
57046
57047
57048
57049
57050
57051
57052
57053
57054
57055
57056
57057
57058
57059
57060
57061
57062
57063
57064
57065
57066
57067
57068
57069
57070
57071
57072
57073
57074
57075
57076
57077
57078
57079
57080
57081
57082
57083
57084
57085
57086
57087
57088
57089
57090
57091
57092
57093
57094
57095
57096
57097
57098
57099
57100
57101
57102
57103
57104
57105
57106
57107
57108
57109
57110
57111
57112
57113
57114
57115
57116
57117
57118
57119
57120
57121
57122
57123
57124
57125
57126
57127
57128
57129
57130
57131
57132
57133
57134
57135
57136
57137
57138
57139
57140
57141
57142
57143
57144
57145
57146
57147
57148
57149
57150
57151
57152
57153
57154
57155
57156
57157
57158
57159
57160
57161
57162
57163
57164
57165
57166
57167
57168
57169
57170
57171
57172
57173
57174
57175
57176
57177
57178
57179
57180
57181
57182
57183
57184
57185
57186
57187
57188
57189
57190
57191
57192
57193
57194
57195
57196
57197
57198
57199
57200
57201
57202
57203
57204
57205
57206
57207
57208
57209
57210
57211
57212
57213
57214
57215
57216
57217
57218
57219
57220
57221
57222
57223
57224
57225
57226
57227
57228
57229
57230
57231
57232
57233
57234
57235
57236
57237
57238
57239
57240
57241
57242
57243
57244
57245
57246
57247
57248
57249
57250
57251
57252
57253
57254
57255
57256
57257
57258
57259
57260
57261
57262
57263
57264
57265
57266
57267
57268
57269
57270
57271
57272
57273
57274
57275
57276
57277
57278
57279
57280
57281
57282
57283
57284
57285
57286
57287
57288
57289
57290
57291
57292
57293
57294
57295
57296
57297
57298
57299
57300
57301
57302
57303
57304
57305
57306
57307
57308
57309
57310
57311
57312
57313
57314
57315
57316
57317
57318
57319
57320
57321
57322
57323
57324
57325
57326
57327
57328
57329
57330
57331
57332
57333
57334
57335
57336
57337
57338
57339
57340
57341
57342
57343
57344
57345
57346
57347
57348
57349
57350
57351
57352
57353
57354
57355
57356
57357
57358
57359
57360
57361
57362
57363
57364
57365
57366
57367
57368
57369
57370
57371
57372
57373
57374
57375
57376
57377
57378
57379
57380
57381
57382
57383
57384
57385
57386
57387
57388
57389
57390
57391
57392
57393
57394
57395
57396
57397
57398
57399
57400
57401
57402
57403
57404
57405
57406
57407
57408
57409
57410
57411
57412
57413
57414
57415
57416
57417
57418
57419
57420
57421
57422
57423
57424
57425
57426
57427
57428
57429
57430
57431
57432
57433
57434
57435
57436
57437
57438
57439
57440
57441
57442
57443
57444
57445
57446
57447
57448
57449
57450
57451
57452
57453
57454
57455
57456
57457
57458
57459
57460
57461
57462
57463
57464
57465
57466
57467
57468
57469
57470
57471
57472
57473
57474
57475
57476
57477
57478
57479
57480
57481
57482
57483
57484
57485
57486
57487
57488
57489
57490
57491
57492
57493
57494
57495
57496
57497
57498
57499
57500
57501
57502
57503
57504
57505
57506
57507
57508
57509
57510
57511
57512
57513
57514
57515
57516
57517
57518
57519
57520
57521
57522
57523
57524
57525
57526
57527
57528
57529
57530
57531
57532
57533
57534
57535
57536
57537
57538
57539
57540
57541
57542
57543
57544
57545
57546
57547
57548
57549
57550
57551
57552
57553
57554
57555
57556
57557
57558
57559
57560
57561
57562
57563
57564
57565
57566
57567
57568
57569
57570
57571
57572
57573
57574
57575
57576
57577
57578
57579
57580
57581
57582
57583
57584
57585
57586
57587
57588
57589
57590
57591
57592
57593
57594
57595
57596
57597
57598
57599
57600
57601
57602
57603
57604
57605
57606
57607
57608
57609
57610
57611
57612
57613
57614
57615
57616
57617
57618
57619
57620
57621
57622
57623
57624
57625
57626
57627
57628
57629
57630
57631
57632
57633
57634
57635
57636
57637
57638
57639
57640
57641
57642
57643
57644
57645
57646
57647
57648
57649
57650
57651
57652
57653
57654
57655
57656
57657
57658
57659
57660
57661
57662
57663
57664
57665
57666
57667
57668
57669
57670
57671
57672
57673
57674
57675
57676
57677
57678
57679
57680
57681
57682
57683
57684
57685
57686
57687
57688
57689
57690
57691
57692
57693
57694
57695
57696
57697
57698
57699
57700
57701
57702
57703
57704
57705
57706
57707
57708
57709
57710
57711
57712
57713
57714
57715
57716
57717
57718
57719
57720
57721
57722
57723
57724
57725
57726
57727
57728
57729
57730
57731
57732
57733
57734
57735
57736
57737
57738
57739
57740
57741
57742
57743
57744
57745
57746
57747
57748
57749
57750
57751
57752
57753
57754
57755
57756
57757
57758
57759
57760
57761
57762
57763
57764
57765
57766
57767
57768
57769
57770
57771
57772
57773
57774
57775
57776
57777
57778
57779
57780
57781
57782
57783
57784
57785
57786
57787
57788
57789
57790
57791
57792
57793
57794
57795
57796
57797
57798
57799
57800
57801
57802
57803
57804
57805
57806
57807
57808
57809
57810
57811
57812
57813
57814
57815
57816
57817
57818
57819
57820
57821
57822
57823
57824
57825
57826
57827
57828
57829
57830
57831
57832
57833
57834
57835
57836
57837
57838
57839
57840
57841
57842
57843
57844
57845
57846
57847
57848
57849
57850
57851
57852
57853
57854
57855
57856
57857
57858
57859
57860
57861
57862
57863
57864
57865
57866
57867
57868
57869
57870
57871
57872
57873
57874
57875
57876
57877
57878
57879
57880
57881
57882
57883
57884
57885
57886
57887
57888
57889
57890
57891
57892
57893
57894
57895
57896
57897
57898
57899
57900
57901
57902
57903
57904
57905
57906
57907
57908
57909
57910
57911
57912
57913
57914
57915
57916
57917
57918
57919
57920
57921
57922
57923
57924
57925
57926
57927
57928
57929
57930
57931
57932
57933
57934
57935
57936
57937
57938
57939
57940
57941
57942
57943
57944
57945
57946
57947
57948
57949
57950
57951
57952
57953
57954
57955
57956
57957
57958
57959
57960
57961
57962
57963
57964
57965
57966
57967
57968
57969
57970
57971
57972
57973
57974
57975
57976
57977
57978
57979
57980
57981
57982
57983
57984
57985
57986
57987
57988
57989
57990
57991
57992
57993
57994
57995
57996
57997
57998
57999
58000
58001
58002
58003
58004
58005
58006
58007
58008
58009
58010
58011
58012
58013
58014
58015
58016
58017
58018
58019
58020
58021
58022
58023
58024
58025
58026
58027
58028
58029
58030
58031
58032
58033
58034
58035
58036
58037
58038
58039
58040
58041
58042
58043
58044
58045
58046
58047
58048
58049
58050
58051
58052
58053
58054
58055
58056
58057
58058
58059
58060
58061
58062
58063
58064
58065
58066
58067
58068
58069
58070
58071
58072
58073
58074
58075
58076
58077
58078
58079
58080
58081
58082
58083
58084
58085
58086
58087
58088
58089
58090
58091
58092
58093
58094
58095
58096
58097
58098
58099
58100
58101
58102
58103
58104
58105
58106
58107
58108
58109
58110
58111
58112
58113
58114
58115
58116
58117
58118
58119
58120
58121
58122
58123
58124
58125
58126
58127
58128
58129
58130
58131
58132
58133
58134
58135
58136
58137
58138
58139
58140
58141
58142
58143
58144
58145
58146
58147
58148
58149
58150
58151
58152
58153
58154
58155
58156
58157
58158
58159
58160
58161
58162
58163
58164
58165
58166
58167
58168
58169
58170
58171
58172
58173
58174
58175
58176
58177
58178
58179
58180
58181
58182
58183
58184
58185
58186
58187
58188
58189
58190
58191
58192
58193
58194
58195
58196
58197
58198
58199
58200
58201
58202
58203
58204
58205
58206
58207
58208
58209
58210
58211
58212
58213
58214
58215
58216
58217
58218
58219
58220
58221
58222
58223
58224
58225
58226
58227
58228
58229
58230
58231
58232
58233
58234
58235
58236
58237
58238
58239
58240
58241
58242
58243
58244
58245
58246
58247
58248
58249
58250
58251
58252
58253
58254
58255
58256
58257
58258
58259
58260
58261
58262
58263
58264
58265
58266
58267
58268
58269
58270
58271
58272
58273
58274
58275
58276
58277
58278
58279
58280
58281
58282
58283
58284
58285
58286
58287
58288
58289
58290
58291
58292
58293
58294
58295
58296
58297
58298
58299
58300
58301
58302
58303
58304
58305
58306
58307
58308
58309
58310
58311
58312
58313
58314
58315
58316
58317
58318
58319
58320
58321
58322
58323
58324
58325
58326
58327
58328
58329
58330
58331
58332
58333
58334
58335
58336
58337
58338
58339
58340
58341
58342
58343
58344
58345
58346
58347
58348
58349
58350
58351
58352
58353
58354
58355
58356
58357
58358
58359
58360
58361
58362
58363
58364
58365
58366
58367
58368
58369
58370
58371
58372
58373
58374
58375
58376
58377
58378
58379
58380
58381
58382
58383
58384
58385
58386
58387
58388
58389
58390
58391
58392
58393
58394
58395
58396
58397
58398
58399
58400
58401
58402
58403
58404
58405
58406
58407
58408
58409
58410
58411
58412
58413
58414
58415
58416
58417
58418
58419
58420
58421
58422
58423
58424
58425
58426
58427
58428
58429
58430
58431
58432
58433
58434
58435
58436
58437
58438
58439
58440
58441
58442
58443
58444
58445
58446
58447
58448
58449
58450
58451
58452
58453
58454
58455
58456
58457
58458
58459
58460
58461
58462
58463
58464
58465
58466
58467
58468
58469
58470
58471
58472
58473
58474
58475
58476
58477
58478
58479
58480
58481
58482
58483
58484
58485
58486
58487
58488
58489
58490
58491
58492
58493
58494
58495
58496
58497
58498
58499
58500
58501
58502
58503
58504
58505
58506
58507
58508
58509
58510
58511
58512
58513
58514
58515
58516
58517
58518
58519
58520
58521
58522
58523
58524
58525
58526
58527
58528
58529
58530
58531
58532
58533
58534
58535
58536
58537
58538
58539
58540
58541
58542
58543
58544
58545
58546
58547
58548
58549
58550
58551
58552
58553
58554
58555
58556
58557
58558
58559
58560
58561
58562
58563
58564
58565
58566
58567
58568
58569
58570
58571
58572
58573
58574
58575
58576
58577
58578
58579
58580
58581
58582
58583
58584
58585
58586
58587
58588
58589
58590
58591
58592
58593
58594
58595
58596
58597
58598
58599
58600
58601
58602
58603
58604
58605
58606
58607
58608
58609
58610
58611
58612
58613
58614
58615
58616
58617
58618
58619
58620
58621
58622
58623
58624
58625
58626
58627
58628
58629
58630
58631
58632
58633
58634
58635
58636
58637
58638
58639
58640
58641
58642
58643
58644
58645
58646
58647
58648
58649
58650
58651
58652
58653
58654
58655
58656
58657
58658
58659
58660
58661
58662
58663
58664
58665
58666
58667
58668
58669
58670
58671
58672
58673
58674
58675
58676
58677
58678
58679
58680
58681
58682
58683
58684
58685
58686
58687
58688
58689
58690
58691
58692
58693
58694
58695
58696
58697
58698
58699
58700
58701
58702
58703
58704
58705
58706
58707
58708
58709
58710
58711
58712
58713
58714
58715
58716
58717
58718
58719
58720
58721
58722
58723
58724
58725
58726
58727
58728
58729
58730
58731
58732
58733
58734
58735
58736
58737
58738
58739
58740
58741
58742
58743
58744
58745
58746
58747
58748
58749
58750
58751
58752
58753
58754
58755
58756
58757
58758
58759
58760
58761
58762
58763
58764
58765
58766
58767
58768
58769
58770
58771
58772
58773
58774
58775
58776
58777
58778
58779
58780
58781
58782
58783
58784
58785
58786
58787
58788
58789
58790
58791
58792
58793
58794
58795
58796
58797
58798
58799
58800
58801
58802
58803
58804
58805
58806
58807
58808
58809
58810
58811
58812
58813
58814
58815
58816
58817
58818
58819
58820
58821
58822
58823
58824
58825
58826
58827
58828
58829
58830
58831
58832
58833
58834
58835
58836
58837
58838
58839
58840
58841
58842
58843
58844
58845
58846
58847
58848
58849
58850
58851
58852
58853
58854
58855
58856
58857
58858
58859
58860
58861
58862
58863
58864
58865
58866
58867
58868
58869
58870
58871
58872
58873
58874
58875
58876
58877
58878
58879
58880
58881
58882
58883
58884
58885
58886
58887
58888
58889
58890
58891
58892
58893
58894
58895
58896
58897
58898
58899
58900
58901
58902
58903
58904
58905
58906
58907
58908
58909
58910
58911
58912
58913
58914
58915
58916
58917
58918
58919
58920
58921
58922
58923
58924
58925
58926
58927
58928
58929
58930
58931
58932
58933
58934
58935
58936
58937
58938
58939
58940
58941
58942
58943
58944
58945
58946
58947
58948
58949
58950
58951
58952
58953
58954
58955
58956
58957
58958
58959
58960
58961
58962
58963
58964
58965
58966
58967
58968
58969
58970
58971
58972
58973
58974
58975
58976
58977
58978
58979
58980
58981
58982
58983
58984
58985
58986
58987
58988
58989
58990
58991
58992
58993
58994
58995
58996
58997
58998
58999
59000
59001
59002
59003
59004
59005
59006
59007
59008
59009
59010
59011
59012
59013
59014
59015
59016
59017
59018
59019
59020
59021
59022
59023
59024
59025
59026
59027
59028
59029
59030
59031
59032
59033
59034
59035
59036
59037
59038
59039
59040
59041
59042
59043
59044
59045
59046
59047
59048
59049
59050
59051
59052
59053
59054
59055
59056
59057
59058
59059
59060
59061
59062
59063
59064
59065
59066
59067
59068
59069
59070
59071
59072
59073
59074
59075
59076
59077
59078
59079
59080
59081
59082
59083
59084
59085
59086
59087
59088
59089
59090
59091
59092
59093
59094
59095
59096
59097
59098
59099
59100
59101
59102
59103
59104
59105
59106
59107
59108
59109
59110
59111
59112
59113
59114
59115
59116
59117
59118
59119
59120
59121
59122
59123
59124
59125
59126
59127
59128
59129
59130
59131
59132
59133
59134
59135
59136
59137
59138
59139
59140
59141
59142
59143
59144
59145
59146
59147
59148
59149
59150
59151
59152
59153
59154
59155
59156
59157
59158
59159
59160
59161
59162
59163
59164
59165
59166
59167
59168
59169
59170
59171
59172
59173
59174
59175
59176
59177
59178
59179
59180
59181
59182
59183
59184
59185
59186
59187
59188
59189
59190
59191
59192
59193
59194
59195
59196
59197
59198
59199
59200
59201
59202
59203
59204
59205
59206
59207
59208
59209
59210
59211
59212
59213
59214
59215
59216
59217
59218
59219
59220
59221
59222
59223
59224
59225
59226
59227
59228
59229
59230
59231
59232
59233
59234
59235
59236
59237
59238
59239
59240
59241
59242
59243
59244
59245
59246
59247
59248
59249
59250
59251
59252
59253
59254
59255
59256
59257
59258
59259
59260
59261
59262
59263
59264
59265
59266
59267
59268
59269
59270
59271
59272
59273
59274
59275
59276
59277
59278
59279
59280
59281
59282
59283
59284
59285
59286
59287
59288
59289
59290
59291
59292
59293
59294
59295
59296
59297
59298
59299
59300
59301
59302
59303
59304
59305
59306
59307
59308
59309
59310
59311
59312
59313
59314
59315
59316
59317
59318
59319
59320
59321
59322
59323
59324
59325
59326
59327
59328
59329
59330
59331
59332
59333
59334
59335
59336
59337
59338
59339
59340
59341
59342
59343
59344
59345
59346
59347
59348
59349
59350
59351
59352
59353
59354
59355
59356
59357
59358
59359
59360
59361
59362
59363
59364
59365
59366
59367
59368
59369
59370
59371
59372
59373
59374
59375
59376
59377
59378
59379
59380
59381
59382
59383
59384
59385
59386
59387
59388
59389
59390
59391
59392
59393
59394
59395
59396
59397
59398
59399
59400
59401
59402
59403
59404
59405
59406
59407
59408
59409
59410
59411
59412
59413
59414
59415
59416
59417
59418
59419
59420
59421
59422
59423
59424
59425
59426
59427
59428
59429
59430
59431
59432
59433
59434
59435
59436
59437
59438
59439
59440
59441
59442
59443
59444
59445
59446
59447
59448
59449
59450
59451
59452
59453
59454
59455
59456
59457
59458
59459
59460
59461
59462
59463
59464
59465
59466
59467
59468
59469
59470
59471
59472
59473
59474
59475
59476
59477
59478
59479
59480
59481
59482
59483
59484
59485
59486
59487
59488
59489
59490
59491
59492
59493
59494
59495
59496
59497
59498
59499
59500
59501
59502
59503
59504
59505
59506
59507
59508
59509
59510
59511
59512
59513
59514
59515
59516
59517
59518
59519
59520
59521
59522
59523
59524
59525
59526
59527
59528
59529
59530
59531
59532
59533
59534
59535
59536
59537
59538
59539
59540
59541
59542
59543
59544
59545
59546
59547
59548
59549
59550
59551
59552
59553
59554
59555
59556
59557
59558
59559
59560
59561
59562
59563
59564
59565
59566
59567
59568
59569
59570
59571
59572
59573
59574
59575
59576
59577
59578
59579
59580
59581
59582
59583
59584
59585
59586
59587
59588
59589
59590
59591
59592
59593
59594
59595
59596
59597
59598
59599
59600
59601
59602
59603
59604
59605
59606
59607
59608
59609
59610
59611
59612
59613
59614
59615
59616
59617
59618
59619
59620
59621
59622
59623
59624
59625
59626
59627
59628
59629
59630
59631
59632
59633
59634
59635
59636
59637
59638
59639
59640
59641
59642
59643
59644
59645
59646
59647
59648
59649
59650
59651
59652
59653
59654
59655
59656
59657
59658
59659
59660
59661
59662
59663
59664
59665
59666
59667
59668
59669
59670
59671
59672
59673
59674
59675
59676
59677
59678
59679
59680
59681
59682
59683
59684
59685
59686
59687
59688
59689
59690
59691
59692
59693
59694
59695
59696
59697
59698
59699
59700
59701
59702
59703
59704
59705
59706
59707
59708
59709
59710
59711
59712
59713
59714
59715
59716
59717
59718
59719
59720
59721
59722
59723
59724
59725
59726
59727
59728
59729
59730
59731
59732
59733
59734
59735
59736
59737
59738
59739
59740
59741
59742
59743
59744
59745
59746
59747
59748
59749
59750
59751
59752
59753
59754
59755
59756
59757
59758
59759
59760
59761
59762
59763
59764
59765
59766
59767
59768
59769
59770
59771
59772
59773
59774
59775
59776
59777
59778
59779
59780
59781
59782
59783
59784
59785
59786
59787
59788
59789
59790
59791
59792
59793
59794
59795
59796
59797
59798
59799
59800
59801
59802
59803
59804
59805
59806
59807
59808
59809
59810
59811
59812
59813
59814
59815
59816
59817
59818
59819
59820
59821
59822
59823
59824
59825
59826
59827
59828
59829
59830
59831
59832
59833
59834
59835
59836
59837
59838
59839
59840
59841
59842
59843
59844
59845
59846
59847
59848
59849
59850
59851
59852
59853
59854
59855
59856
59857
59858
59859
59860
59861
59862
59863
59864
59865
59866
59867
59868
59869
59870
59871
59872
59873
59874
59875
59876
59877
59878
59879
59880
59881
59882
59883
59884
59885
59886
59887
59888
59889
59890
59891
59892
59893
59894
59895
59896
59897
59898
59899
59900
59901
59902
59903
59904
59905
59906
59907
59908
59909
59910
59911
59912
59913
59914
59915
59916
59917
59918
59919
59920
59921
59922
59923
59924
59925
59926
59927
59928
59929
59930
59931
59932
59933
59934
59935
59936
59937
59938
59939
59940
59941
59942
59943
59944
59945
59946
59947
59948
59949
59950
59951
59952
59953
59954
59955
59956
59957
59958
59959
59960
59961
59962
59963
59964
59965
59966
59967
59968
59969
59970
59971
59972
59973
59974
59975
59976
59977
59978
59979
59980
59981
59982
59983
59984
59985
59986
59987
59988
59989
59990
59991
59992
59993
59994
59995
59996
59997
59998
59999
60000
60001
60002
60003
60004
60005
60006
60007
60008
60009
60010
60011
60012
60013
60014
60015
60016
60017
60018
60019
60020
60021
60022
60023
60024
60025
60026
60027
60028
60029
60030
60031
60032
60033
60034
60035
60036
60037
60038
60039
60040
60041
60042
60043
60044
60045
60046
60047
60048
60049
60050
60051
60052
60053
60054
60055
60056
60057
60058
60059
60060
60061
60062
60063
60064
60065
60066
60067
60068
60069
60070
60071
60072
60073
60074
60075
60076
60077
60078
60079
60080
60081
60082
60083
60084
60085
60086
60087
60088
60089
60090
60091
60092
60093
60094
60095
60096
60097
60098
60099
60100
60101
60102
60103
60104
60105
60106
60107
60108
60109
60110
60111
60112
60113
60114
60115
60116
60117
60118
60119
60120
60121
60122
60123
60124
60125
60126
60127
60128
60129
60130
60131
60132
60133
60134
60135
60136
60137
60138
60139
60140
60141
60142
60143
60144
60145
60146
60147
60148
60149
60150
60151
60152
60153
60154
60155
60156
60157
60158
60159
60160
60161
60162
60163
60164
60165
60166
60167
60168
60169
60170
60171
60172
60173
60174
60175
60176
60177
60178
60179
60180
60181
60182
60183
60184
60185
60186
60187
60188
60189
60190
60191
60192
60193
60194
60195
60196
60197
60198
60199
60200
60201
60202
60203
60204
60205
60206
60207
60208
60209
60210
60211
60212
60213
60214
60215
60216
60217
60218
60219
60220
60221
60222
60223
60224
60225
60226
60227
60228
60229
60230
60231
60232
60233
60234
60235
60236
60237
60238
60239
60240
60241
60242
60243
60244
60245
60246
60247
60248
60249
60250
60251
60252
60253
60254
60255
60256
60257
60258
60259
60260
60261
60262
60263
60264
60265
60266
60267
60268
60269
60270
60271
60272
60273
60274
60275
60276
60277
60278
60279
60280
60281
60282
60283
60284
60285
60286
60287
60288
60289
60290
60291
60292
60293
60294
60295
60296
60297
60298
60299
60300
60301
60302
60303
60304
60305
60306
60307
60308
60309
60310
60311
60312
60313
60314
60315
60316
60317
60318
60319
60320
60321
60322
60323
60324
60325
60326
60327
60328
60329
60330
60331
60332
60333
60334
60335
60336
60337
60338
60339
60340
60341
60342
60343
60344
60345
60346
60347
60348
60349
60350
60351
60352
60353
60354
60355
60356
60357
60358
60359
60360
60361
60362
60363
60364
60365
60366
60367
60368
60369
60370
60371
60372
60373
60374
60375
60376
60377
60378
60379
60380
60381
60382
60383
60384
60385
60386
60387
60388
60389
60390
60391
60392
60393
60394
60395
60396
60397
60398
60399
60400
60401
60402
60403
60404
60405
60406
60407
60408
60409
60410
60411
60412
60413
60414
60415
60416
60417
60418
60419
60420
60421
60422
60423
60424
60425
60426
60427
60428
60429
60430
60431
60432
60433
60434
60435
60436
60437
60438
60439
60440
60441
60442
60443
60444
60445
60446
60447
60448
60449
60450
60451
60452
60453
60454
60455
60456
60457
60458
60459
60460
60461
60462
60463
60464
60465
60466
60467
60468
60469
60470
60471
60472
60473
60474
60475
60476
60477
60478
60479
60480
60481
60482
60483
60484
60485
60486
60487
60488
60489
60490
60491
60492
60493
60494
60495
60496
60497
60498
60499
60500
60501
60502
60503
60504
60505
60506
60507
60508
60509
60510
60511
60512
60513
60514
60515
60516
60517
60518
60519
60520
60521
60522
60523
60524
60525
60526
60527
60528
60529
60530
60531
60532
60533
60534
60535
60536
60537
60538
60539
60540
60541
60542
60543
60544
60545
60546
60547
60548
60549
60550
60551
60552
60553
60554
60555
60556
60557
60558
60559
60560
60561
60562
60563
60564
60565
60566
60567
60568
60569
60570
60571
60572
60573
60574
60575
60576
60577
60578
60579
60580
60581
60582
60583
60584
60585
60586
60587
60588
60589
60590
60591
60592
60593
60594
60595
60596
60597
60598
60599
60600
60601
60602
60603
60604
60605
60606
60607
60608
60609
60610
60611
60612
60613
60614
60615
60616
60617
60618
60619
60620
60621
60622
60623
60624
60625
60626
60627
60628
60629
60630
60631
60632
60633
60634
60635
60636
60637
60638
60639
60640
60641
60642
60643
60644
60645
60646
60647
60648
60649
60650
60651
60652
60653
60654
60655
60656
60657
60658
60659
60660
60661
60662
60663
60664
60665
60666
60667
60668
60669
60670
60671
60672
60673
60674
60675
60676
60677
60678
60679
60680
60681
60682
60683
60684
60685
60686
60687
60688
60689
60690
60691
60692
60693
60694
60695
60696
60697
60698
60699
60700
60701
60702
60703
60704
60705
60706
60707
60708
60709
60710
60711
60712
60713
60714
60715
60716
60717
60718
60719
60720
60721
60722
60723
60724
60725
60726
60727
60728
60729
60730
60731
60732
60733
60734
60735
60736
60737
60738
60739
60740
60741
60742
60743
60744
60745
60746
60747
60748
60749
60750
60751
60752
60753
60754
60755
60756
60757
60758
60759
60760
60761
60762
60763
60764
60765
60766
60767
60768
60769
60770
60771
60772
60773
60774
60775
60776
60777
60778
60779
60780
60781
60782
60783
60784
60785
60786
60787
60788
60789
60790
60791
60792
60793
60794
60795
60796
60797
60798
60799
60800
60801
60802
60803
60804
60805
60806
60807
60808
60809
60810
60811
60812
60813
60814
60815
60816
60817
60818
60819
60820
60821
60822
60823
60824
60825
60826
60827
60828
60829
60830
60831
60832
60833
60834
60835
60836
60837
60838
60839
60840
60841
60842
60843
60844
60845
60846
60847
60848
60849
60850
60851
60852
60853
60854
60855
60856
60857
60858
60859
60860
60861
60862
60863
60864
60865
60866
60867
60868
60869
60870
60871
60872
60873
60874
60875
60876
60877
60878
60879
60880
60881
60882
60883
60884
60885
60886
60887
60888
60889
60890
60891
60892
60893
60894
60895
60896
60897
60898
60899
60900
60901
60902
60903
60904
60905
60906
60907
60908
60909
60910
60911
60912
60913
60914
60915
60916
60917
60918
60919
60920
60921
60922
60923
60924
60925
60926
60927
60928
60929
60930
60931
60932
60933
60934
60935
60936
60937
60938
60939
60940
60941
60942
60943
60944
60945
60946
60947
60948
60949
60950
60951
60952
60953
60954
60955
60956
60957
60958
60959
60960
60961
60962
60963
60964
60965
60966
60967
60968
60969
60970
60971
60972
60973
60974
60975
60976
60977
60978
60979
60980
60981
60982
60983
60984
60985
60986
60987
60988
60989
60990
60991
60992
60993
60994
60995
60996
60997
60998
60999
61000
61001
61002
61003
61004
61005
61006
61007
61008
61009
61010
61011
61012
61013
61014
61015
61016
61017
61018
61019
61020
61021
61022
61023
61024
61025
61026
61027
61028
61029
61030
61031
61032
61033
61034
61035
61036
61037
61038
61039
61040
61041
61042
61043
61044
61045
61046
61047
61048
61049
61050
61051
61052
61053
61054
61055
61056
61057
61058
61059
61060
61061
61062
61063
61064
61065
61066
61067
61068
61069
61070
61071
61072
61073
61074
61075
61076
61077
61078
61079
61080
61081
61082
61083
61084
61085
61086
61087
61088
61089
61090
61091
61092
61093
61094
61095
61096
61097
61098
61099
61100
61101
61102
61103
61104
61105
61106
61107
61108
61109
61110
61111
61112
61113
61114
61115
61116
61117
61118
61119
61120
61121
61122
61123
61124
61125
61126
61127
61128
61129
61130
61131
61132
61133
61134
61135
61136
61137
61138
61139
61140
61141
61142
61143
61144
61145
61146
61147
61148
61149
61150
61151
61152
61153
61154
61155
61156
61157
61158
61159
61160
61161
61162
61163
61164
61165
61166
61167
61168
61169
61170
61171
61172
61173
61174
61175
61176
61177
61178
61179
61180
61181
61182
61183
61184
61185
61186
61187
61188
61189
61190
61191
61192
61193
61194
61195
61196
61197
61198
61199
61200
61201
61202
61203
61204
61205
61206
61207
61208
61209
61210
61211
61212
61213
61214
61215
61216
61217
61218
61219
61220
61221
61222
61223
61224
61225
61226
61227
61228
61229
61230
61231
61232
61233
61234
61235
61236
61237
61238
61239
61240
61241
61242
61243
61244
61245
61246
61247
61248
61249
61250
61251
61252
61253
61254
61255
61256
61257
61258
61259
61260
61261
61262
61263
61264
61265
61266
61267
61268
61269
61270
61271
61272
61273
61274
61275
61276
61277
61278
61279
61280
61281
61282
61283
61284
61285
61286
61287
61288
61289
61290
61291
61292
61293
61294
61295
61296
61297
61298
61299
61300
61301
61302
61303
61304
61305
61306
61307
61308
61309
61310
61311
61312
61313
61314
61315
61316
61317
61318
61319
61320
61321
61322
61323
61324
61325
61326
61327
61328
61329
61330
61331
61332
61333
61334
61335
61336
61337
61338
61339
61340
61341
61342
61343
61344
61345
61346
61347
61348
61349
61350
61351
61352
61353
61354
61355
61356
61357
61358
61359
61360
61361
61362
61363
61364
61365
61366
61367
61368
61369
61370
61371
61372
61373
61374
61375
61376
61377
61378
61379
61380
61381
61382
61383
61384
61385
61386
61387
61388
61389
61390
61391
61392
61393
61394
61395
61396
61397
61398
61399
61400
61401
61402
61403
61404
61405
61406
61407
61408
61409
61410
61411
61412
61413
61414
61415
61416
61417
61418
61419
61420
61421
61422
61423
61424
61425
61426
61427
61428
61429
61430
61431
61432
61433
61434
61435
61436
61437
61438
61439
61440
61441
61442
61443
61444
61445
61446
61447
61448
61449
61450
61451
61452
61453
61454
61455
61456
61457
61458
61459
61460
61461
61462
61463
61464
61465
61466
61467
61468
61469
61470
61471
61472
61473
61474
61475
61476
61477
61478
61479
61480
61481
61482
61483
61484
61485
61486
61487
61488
61489
61490
61491
61492
61493
61494
61495
61496
61497
61498
61499
61500
61501
61502
61503
61504
61505
61506
61507
61508
61509
61510
61511
61512
61513
61514
61515
61516
61517
61518
61519
61520
61521
61522
61523
61524
61525
61526
61527
61528
61529
61530
61531
61532
61533
61534
61535
61536
61537
61538
61539
61540
61541
61542
61543
61544
61545
61546
61547
61548
61549
61550
61551
61552
61553
61554
61555
61556
61557
61558
61559
61560
61561
61562
61563
61564
61565
61566
61567
61568
61569
61570
61571
61572
61573
61574
61575
61576
61577
61578
61579
61580
61581
61582
61583
61584
61585
61586
61587
61588
61589
61590
61591
61592
61593
61594
61595
61596
61597
61598
61599
61600
61601
61602
61603
61604
61605
61606
61607
61608
61609
61610
61611
61612
61613
61614
61615
61616
61617
61618
61619
61620
61621
61622
61623
61624
61625
61626
61627
61628
61629
61630
61631
61632
61633
61634
61635
61636
61637
61638
61639
61640
61641
61642
61643
61644
61645
61646
61647
61648
61649
61650
61651
61652
61653
61654
61655
61656
61657
61658
61659
61660
61661
61662
61663
61664
61665
61666
61667
61668
61669
61670
61671
61672
61673
61674
61675
61676
61677
61678
61679
61680
61681
61682
61683
61684
61685
61686
61687
61688
61689
61690
61691
61692
61693
61694
61695
61696
61697
61698
61699
61700
61701
61702
61703
61704
61705
61706
61707
61708
61709
61710
61711
61712
61713
61714
61715
61716
61717
61718
61719
61720
61721
61722
61723
61724
61725
61726
61727
61728
61729
61730
61731
61732
61733
61734
61735
61736
61737
61738
61739
61740
61741
61742
61743
61744
61745
61746
61747
61748
61749
61750
61751
61752
61753
61754
61755
61756
61757
61758
61759
61760
61761
61762
61763
61764
61765
61766
61767
61768
61769
61770
61771
61772
61773
61774
61775
61776
61777
61778
61779
61780
61781
61782
61783
61784
61785
61786
61787
61788
61789
61790
61791
61792
61793
61794
61795
61796
61797
61798
61799
61800
61801
61802
61803
61804
61805
61806
61807
61808
61809
61810
61811
61812
61813
61814
61815
61816
61817
61818
61819
61820
61821
61822
61823
61824
61825
61826
61827
61828
61829
61830
61831
61832
61833
61834
61835
61836
61837
61838
61839
61840
61841
61842
61843
61844
61845
61846
61847
61848
61849
61850
61851
61852
61853
61854
61855
61856
61857
61858
61859
61860
61861
61862
61863
61864
61865
61866
61867
61868
61869
61870
61871
61872
61873
61874
61875
61876
61877
61878
61879
61880
61881
61882
61883
61884
61885
61886
61887
61888
61889
61890
61891
61892
61893
61894
61895
61896
61897
61898
61899
61900
61901
61902
61903
61904
61905
61906
61907
61908
61909
61910
61911
61912
61913
61914
61915
61916
61917
61918
61919
61920
61921
61922
61923
61924
61925
61926
61927
61928
61929
61930
61931
61932
61933
61934
61935
61936
61937
61938
61939
61940
61941
61942
61943
61944
61945
61946
61947
61948
61949
61950
61951
61952
61953
61954
61955
61956
61957
61958
61959
61960
61961
61962
61963
61964
61965
61966
61967
61968
61969
61970
61971
61972
61973
61974
61975
61976
61977
61978
61979
61980
61981
61982
61983
61984
61985
61986
61987
61988
61989
61990
61991
61992
61993
61994
61995
61996
61997
61998
61999
62000
62001
62002
62003
62004
62005
62006
62007
62008
62009
62010
62011
62012
62013
62014
62015
62016
62017
62018
62019
62020
62021
62022
62023
62024
62025
62026
62027
62028
62029
62030
62031
62032
62033
62034
62035
62036
62037
62038
62039
62040
62041
62042
62043
62044
62045
62046
62047
62048
62049
62050
62051
62052
62053
62054
62055
62056
62057
62058
62059
62060
62061
62062
62063
62064
62065
62066
62067
62068
62069
62070
62071
62072
62073
62074
62075
62076
62077
62078
62079
62080
62081
62082
62083
62084
62085
62086
62087
62088
62089
62090
62091
62092
62093
62094
62095
62096
62097
62098
62099
62100
62101
62102
62103
62104
62105
62106
62107
62108
62109
62110
62111
62112
62113
62114
62115
62116
62117
62118
62119
62120
62121
62122
62123
62124
62125
62126
62127
62128
62129
62130
62131
62132
62133
62134
62135
62136
62137
62138
62139
62140
62141
62142
62143
62144
62145
62146
62147
62148
62149
62150
62151
62152
62153
62154
62155
62156
62157
62158
62159
62160
62161
62162
62163
62164
62165
62166
62167
62168
62169
62170
62171
62172
62173
62174
62175
62176
62177
62178
62179
62180
62181
62182
62183
62184
62185
62186
62187
62188
62189
62190
62191
62192
62193
62194
62195
62196
62197
62198
62199
62200
62201
62202
62203
62204
62205
62206
62207
62208
62209
62210
62211
62212
62213
62214
62215
62216
62217
62218
62219
62220
62221
62222
62223
62224
62225
62226
62227
62228
62229
62230
62231
62232
62233
62234
62235
62236
62237
62238
62239
62240
62241
62242
62243
62244
62245
62246
62247
62248
62249
62250
62251
62252
62253
62254
62255
62256
62257
62258
62259
62260
62261
62262
62263
62264
62265
62266
62267
62268
62269
62270
62271
62272
62273
62274
62275
62276
62277
62278
62279
62280
62281
62282
62283
62284
62285
62286
62287
62288
62289
62290
62291
62292
62293
62294
62295
62296
62297
62298
62299
62300
62301
62302
62303
62304
62305
62306
62307
62308
62309
62310
62311
62312
62313
62314
62315
62316
62317
62318
62319
62320
62321
62322
62323
62324
62325
62326
62327
62328
62329
62330
62331
62332
62333
62334
62335
62336
62337
62338
62339
62340
62341
62342
62343
62344
62345
62346
62347
62348
62349
62350
62351
62352
62353
62354
62355
62356
62357
62358
62359
62360
62361
62362
62363
62364
62365
62366
62367
62368
62369
62370
62371
62372
62373
62374
62375
62376
62377
62378
62379
62380
62381
62382
62383
62384
62385
62386
62387
62388
62389
62390
62391
62392
62393
62394
62395
62396
62397
62398
62399
62400
62401
62402
62403
62404
62405
62406
62407
62408
62409
62410
62411
62412
62413
62414
62415
62416
62417
62418
62419
62420
62421
62422
62423
62424
62425
62426
62427
62428
62429
62430
62431
62432
62433
62434
62435
62436
62437
62438
62439
62440
62441
62442
62443
62444
62445
62446
62447
62448
62449
62450
62451
62452
62453
62454
62455
62456
62457
62458
62459
62460
62461
62462
62463
62464
62465
62466
62467
62468
62469
62470
62471
62472
62473
62474
62475
62476
62477
62478
62479
62480
62481
62482
62483
62484
62485
62486
62487
62488
62489
62490
62491
62492
62493
62494
62495
62496
62497
62498
62499
62500
62501
62502
62503
62504
62505
62506
62507
62508
62509
62510
62511
62512
62513
62514
62515
62516
62517
62518
62519
62520
62521
62522
62523
62524
62525
62526
62527
62528
62529
62530
62531
62532
62533
62534
62535
62536
62537
62538
62539
62540
62541
62542
62543
62544
62545
62546
62547
62548
62549
62550
62551
62552
62553
62554
62555
62556
62557
62558
62559
62560
62561
62562
62563
62564
62565
62566
62567
62568
62569
62570
62571
62572
62573
62574
62575
62576
62577
62578
62579
62580
62581
62582
62583
62584
62585
62586
62587
62588
62589
62590
62591
62592
62593
62594
62595
62596
62597
62598
62599
62600
62601
62602
62603
62604
62605
62606
62607
62608
62609
62610
62611
62612
62613
62614
62615
62616
62617
62618
62619
62620
62621
62622
62623
62624
62625
62626
62627
62628
62629
62630
62631
62632
62633
62634
62635
62636
62637
62638
62639
62640
62641
62642
62643
62644
62645
62646
62647
62648
62649
62650
62651
62652
62653
62654
62655
62656
62657
62658
62659
62660
62661
62662
62663
62664
62665
62666
62667
62668
62669
62670
62671
62672
62673
62674
62675
62676
62677
62678
62679
62680
62681
62682
62683
62684
62685
62686
62687
62688
62689
62690
62691
62692
62693
62694
62695
62696
62697
62698
62699
62700
62701
62702
62703
62704
62705
62706
62707
62708
62709
62710
62711
62712
62713
62714
62715
62716
62717
62718
62719
62720
62721
62722
62723
62724
62725
62726
62727
62728
62729
62730
62731
62732
62733
62734
62735
62736
62737
62738
62739
62740
62741
62742
62743
62744
62745
62746
62747
62748
62749
62750
62751
62752
62753
62754
62755
62756
62757
62758
62759
62760
62761
62762
62763
62764
62765
62766
62767
62768
62769
62770
62771
62772
62773
62774
62775
62776
62777
62778
62779
62780
62781
62782
62783
62784
62785
62786
62787
62788
62789
62790
62791
62792
62793
62794
62795
62796
62797
62798
62799
62800
62801
62802
62803
62804
62805
62806
62807
62808
62809
62810
62811
62812
62813
62814
62815
62816
62817
62818
62819
62820
62821
62822
62823
62824
62825
62826
62827
62828
62829
62830
62831
62832
62833
62834
62835
62836
62837
62838
62839
62840
62841
62842
62843
62844
62845
62846
62847
62848
62849
62850
62851
62852
62853
62854
62855
62856
62857
62858
62859
62860
62861
62862
62863
62864
62865
62866
62867
62868
62869
62870
62871
62872
62873
62874
62875
62876
62877
62878
62879
62880
62881
62882
62883
62884
62885
62886
62887
62888
62889
62890
62891
62892
62893
62894
62895
62896
62897
62898
62899
62900
62901
62902
62903
62904
62905
62906
62907
62908
62909
62910
62911
62912
62913
62914
62915
62916
62917
62918
62919
62920
62921
62922
62923
62924
62925
62926
62927
62928
62929
62930
62931
62932
62933
62934
62935
62936
62937
62938
62939
62940
62941
62942
62943
62944
62945
62946
62947
62948
62949
62950
62951
62952
62953
62954
62955
62956
62957
62958
62959
62960
62961
62962
62963
62964
62965
62966
62967
62968
62969
62970
62971
62972
62973
62974
62975
62976
62977
62978
62979
62980
62981
62982
62983
62984
62985
62986
62987
62988
62989
62990
62991
62992
62993
62994
62995
62996
62997
62998
62999
63000
63001
63002
63003
63004
63005
63006
63007
63008
63009
63010
63011
63012
63013
63014
63015
63016
63017
63018
63019
63020
63021
63022
63023
63024
63025
63026
63027
63028
63029
63030
63031
63032
63033
63034
63035
63036
63037
63038
63039
63040
63041
63042
63043
63044
63045
63046
63047
63048
63049
63050
63051
63052
63053
63054
63055
63056
63057
63058
63059
63060
63061
63062
63063
63064
63065
63066
63067
63068
63069
63070
63071
63072
63073
63074
63075
63076
63077
63078
63079
63080
63081
63082
63083
63084
63085
63086
63087
63088
63089
63090
63091
63092
63093
63094
63095
63096
63097
63098
63099
63100
63101
63102
63103
63104
63105
63106
63107
63108
63109
63110
63111
63112
63113
63114
63115
63116
63117
63118
63119
63120
63121
63122
63123
63124
63125
63126
63127
63128
63129
63130
63131
63132
63133
63134
63135
63136
63137
63138
63139
63140
63141
63142
63143
63144
63145
63146
63147
63148
63149
63150
63151
63152
63153
63154
63155
63156
63157
63158
63159
63160
63161
63162
63163
63164
63165
63166
63167
63168
63169
63170
63171
63172
63173
63174
63175
63176
63177
63178
63179
63180
63181
63182
63183
63184
63185
63186
63187
63188
63189
63190
63191
63192
63193
63194
63195
63196
63197
63198
63199
63200
63201
63202
63203
63204
63205
63206
63207
63208
63209
63210
63211
63212
63213
63214
63215
63216
63217
63218
63219
63220
63221
63222
63223
63224
63225
63226
63227
63228
63229
63230
63231
63232
63233
63234
63235
63236
63237
63238
63239
63240
63241
63242
63243
63244
63245
63246
63247
63248
63249
63250
63251
63252
63253
63254
63255
63256
63257
63258
63259
63260
63261
63262
63263
63264
63265
63266
63267
63268
63269
63270
63271
63272
63273
63274
63275
63276
63277
63278
63279
63280
63281
63282
63283
63284
63285
63286
63287
63288
63289
63290
63291
63292
63293
63294
63295
63296
63297
63298
63299
63300
63301
63302
63303
63304
63305
63306
63307
63308
63309
63310
63311
63312
63313
63314
63315
63316
63317
63318
63319
63320
63321
63322
63323
63324
63325
63326
63327
63328
63329
63330
63331
63332
63333
63334
63335
63336
63337
63338
63339
63340
63341
63342
63343
63344
63345
63346
63347
63348
63349
63350
63351
63352
63353
63354
63355
63356
63357
63358
63359
63360
63361
63362
63363
63364
63365
63366
63367
63368
63369
63370
63371
63372
63373
63374
63375
63376
63377
63378
63379
63380
63381
63382
63383
63384
63385
63386
63387
63388
63389
63390
63391
63392
63393
63394
63395
63396
63397
63398
63399
63400
63401
63402
63403
63404
63405
63406
63407
63408
63409
63410
63411
63412
63413
63414
63415
63416
63417
63418
63419
63420
63421
63422
63423
63424
63425
63426
63427
63428
63429
63430
63431
63432
63433
63434
63435
63436
63437
63438
63439
63440
63441
63442
63443
63444
63445
63446
63447
63448
63449
63450
63451
63452
63453
63454
63455
63456
63457
63458
63459
63460
63461
63462
63463
63464
63465
63466
63467
63468
63469
63470
63471
63472
63473
63474
63475
63476
63477
63478
63479
63480
63481
63482
63483
63484
63485
63486
63487
63488
63489
63490
63491
63492
63493
63494
63495
63496
63497
63498
63499
63500
63501
63502
63503
63504
63505
63506
63507
63508
63509
63510
63511
63512
63513
63514
63515
63516
63517
63518
63519
63520
63521
63522
63523
63524
63525
63526
63527
63528
63529
63530
63531
63532
63533
63534
63535
63536
63537
63538
63539
63540
63541
63542
63543
63544
63545
63546
63547
63548
63549
63550
63551
63552
63553
63554
63555
63556
63557
63558
63559
63560
63561
63562
63563
63564
63565
63566
63567
63568
63569
63570
63571
63572
63573
63574
63575
63576
63577
63578
63579
63580
63581
63582
63583
63584
63585
63586
63587
63588
63589
63590
63591
63592
63593
63594
63595
63596
63597
63598
63599
63600
63601
63602
63603
63604
63605
63606
63607
63608
63609
63610
63611
63612
63613
63614
63615
63616
63617
63618
63619
63620
63621
63622
63623
63624
63625
63626
63627
63628
63629
63630
63631
63632
63633
63634
63635
63636
63637
63638
63639
63640
63641
63642
63643
63644
63645
63646
63647
63648
63649
63650
63651
63652
63653
63654
63655
63656
63657
63658
63659
63660
63661
63662
63663
63664
63665
63666
63667
63668
63669
63670
63671
63672
63673
63674
63675
63676
63677
63678
63679
63680
63681
63682
63683
63684
63685
63686
63687
63688
63689
63690
63691
63692
63693
63694
63695
63696
63697
63698
63699
63700
63701
63702
63703
63704
63705
63706
63707
63708
63709
63710
63711
63712
63713
63714
63715
63716
63717
63718
63719
63720
63721
63722
63723
63724
63725
63726
63727
63728
63729
63730
63731
63732
63733
63734
63735
63736
63737
63738
63739
63740
63741
63742
63743
63744
63745
63746
63747
63748
63749
63750
63751
63752
63753
63754
63755
63756
63757
63758
63759
63760
63761
63762
63763
63764
63765
63766
63767
63768
63769
63770
63771
63772
63773
63774
63775
63776
63777
63778
63779
63780
63781
63782
63783
63784
63785
63786
63787
63788
63789
63790
63791
63792
63793
63794
63795
63796
63797
63798
63799
63800
63801
63802
63803
63804
63805
63806
63807
63808
63809
63810
63811
63812
63813
63814
63815
63816
63817
63818
63819
63820
63821
63822
63823
63824
63825
63826
63827
63828
63829
63830
63831
63832
63833
63834
63835
63836
63837
63838
63839
63840
63841
63842
63843
63844
63845
63846
63847
63848
63849
63850
63851
63852
63853
63854
63855
63856
63857
63858
63859
63860
63861
63862
63863
63864
63865
63866
63867
63868
63869
63870
63871
63872
63873
63874
63875
63876
63877
63878
63879
63880
63881
63882
63883
63884
63885
63886
63887
63888
63889
63890
63891
63892
63893
63894
63895
63896
63897
63898
63899
63900
63901
63902
63903
63904
63905
63906
63907
63908
63909
63910
63911
63912
63913
63914
63915
63916
63917
63918
63919
63920
63921
63922
63923
63924
63925
63926
63927
63928
63929
63930
63931
63932
63933
63934
63935
63936
63937
63938
63939
63940
63941
63942
63943
63944
63945
63946
63947
63948
63949
63950
63951
63952
63953
63954
63955
63956
63957
63958
63959
63960
63961
63962
63963
63964
63965
63966
63967
63968
63969
63970
63971
63972
63973
63974
63975
63976
63977
63978
63979
63980
63981
63982
63983
63984
63985
63986
63987
63988
63989
63990
63991
63992
63993
63994
63995
63996
63997
63998
63999
64000
64001
64002
64003
64004
64005
64006
64007
64008
64009
64010
64011
64012
64013
64014
64015
64016
64017
64018
64019
64020
64021
64022
64023
64024
64025
64026
64027
64028
64029
64030
64031
64032
64033
64034
64035
64036
64037
64038
64039
64040
64041
64042
64043
64044
64045
64046
64047
64048
64049
64050
64051
64052
64053
64054
64055
64056
64057
64058
64059
64060
64061
64062
64063
64064
64065
64066
64067
64068
64069
64070
64071
64072
64073
64074
64075
64076
64077
64078
64079
64080
64081
64082
64083
64084
64085
64086
64087
64088
64089
64090
64091
64092
64093
64094
64095
64096
64097
64098
64099
64100
64101
64102
64103
64104
64105
64106
64107
64108
64109
64110
64111
64112
64113
64114
64115
64116
64117
64118
64119
64120
64121
64122
64123
64124
64125
64126
64127
64128
64129
64130
64131
64132
64133
64134
64135
64136
64137
64138
64139
64140
64141
64142
64143
64144
64145
64146
64147
64148
64149
64150
64151
64152
64153
64154
64155
64156
64157
64158
64159
64160
64161
64162
64163
64164
64165
64166
64167
64168
64169
64170
64171
64172
64173
64174
64175
64176
64177
64178
64179
64180
64181
64182
64183
64184
64185
64186
64187
64188
64189
64190
64191
64192
64193
64194
64195
64196
64197
64198
64199
64200
64201
64202
64203
64204
64205
64206
64207
64208
64209
64210
64211
64212
64213
64214
64215
64216
64217
64218
64219
64220
64221
64222
64223
64224
64225
64226
64227
64228
64229
64230
64231
64232
64233
64234
64235
64236
64237
64238
64239
64240
64241
64242
64243
64244
64245
64246
64247
64248
64249
64250
64251
64252
64253
64254
64255
64256
64257
64258
64259
64260
64261
64262
64263
64264
64265
64266
64267
64268
64269
64270
64271
64272
64273
64274
64275
64276
64277
64278
64279
64280
64281
64282
64283
64284
64285
64286
64287
64288
64289
64290
64291
64292
64293
64294
64295
64296
64297
64298
64299
64300
64301
64302
64303
64304
64305
64306
64307
64308
64309
64310
64311
64312
64313
64314
64315
64316
64317
64318
64319
64320
64321
64322
64323
64324
64325
64326
64327
64328
64329
64330
64331
64332
64333
64334
64335
64336
64337
64338
64339
64340
64341
64342
64343
64344
64345
64346
64347
64348
64349
64350
64351
64352
64353
64354
64355
64356
64357
64358
64359
64360
64361
64362
64363
64364
64365
64366
64367
64368
64369
64370
64371
64372
64373
64374
64375
64376
64377
64378
64379
64380
64381
64382
64383
64384
64385
64386
64387
64388
64389
64390
64391
64392
64393
64394
64395
64396
64397
64398
64399
64400
64401
64402
64403
64404
64405
64406
64407
64408
64409
64410
64411
64412
64413
64414
64415
64416
64417
64418
64419
64420
64421
64422
64423
64424
64425
64426
64427
64428
64429
64430
64431
64432
64433
64434
64435
64436
64437
64438
64439
64440
64441
64442
64443
64444
64445
64446
64447
64448
64449
64450
64451
64452
64453
64454
64455
64456
64457
64458
64459
64460
64461
64462
64463
64464
64465
64466
64467
64468
64469
64470
64471
64472
64473
64474
64475
64476
64477
64478
64479
64480
64481
64482
64483
64484
64485
64486
64487
64488
64489
64490
64491
64492
64493
64494
64495
64496
64497
64498
64499
64500
64501
64502
64503
64504
64505
64506
64507
64508
64509
64510
64511
64512
64513
64514
64515
64516
64517
64518
64519
64520
64521
64522
64523
64524
64525
64526
64527
64528
64529
64530
64531
64532
64533
64534
64535
64536
64537
64538
64539
64540
64541
64542
64543
64544
64545
64546
64547
64548
64549
64550
64551
64552
64553
64554
64555
64556
64557
64558
64559
64560
64561
64562
64563
64564
64565
64566
64567
64568
64569
64570
64571
64572
64573
64574
64575
64576
64577
64578
64579
64580
64581
64582
64583
64584
64585
64586
64587
64588
64589
64590
64591
64592
64593
64594
64595
64596
64597
64598
64599
64600
64601
64602
64603
64604
64605
64606
64607
64608
64609
64610
64611
64612
64613
64614
64615
64616
64617
64618
64619
64620
64621
64622
64623
64624
64625
64626
64627
64628
64629
64630
64631
64632
64633
64634
64635
64636
64637
64638
64639
64640
64641
64642
64643
64644
64645
64646
64647
64648
64649
64650
64651
64652
64653
64654
64655
64656
64657
64658
64659
64660
64661
64662
64663
64664
64665
64666
64667
64668
64669
64670
64671
64672
64673
64674
64675
64676
64677
64678
64679
64680
64681
64682
64683
64684
64685
64686
64687
64688
64689
64690
64691
64692
64693
64694
64695
64696
64697
64698
64699
64700
64701
64702
64703
64704
64705
64706
64707
64708
64709
64710
64711
64712
64713
64714
64715
64716
64717
64718
64719
64720
64721
64722
64723
64724
64725
64726
64727
64728
64729
64730
64731
64732
64733
64734
64735
64736
64737
64738
64739
64740
64741
64742
64743
64744
64745
64746
64747
64748
64749
64750
64751
64752
64753
64754
64755
64756
64757
64758
64759
64760
64761
64762
64763
64764
64765
64766
64767
64768
64769
64770
64771
64772
64773
64774
64775
64776
64777
64778
64779
64780
64781
64782
64783
64784
64785
64786
64787
64788
64789
64790
64791
64792
64793
64794
64795
64796
64797
64798
64799
64800
64801
64802
64803
64804
64805
64806
64807
64808
64809
64810
64811
64812
64813
64814
64815
64816
64817
64818
64819
64820
64821
64822
64823
64824
64825
64826
64827
64828
64829
64830
64831
64832
64833
64834
64835
64836
64837
64838
64839
64840
64841
64842
64843
64844
64845
64846
64847
64848
64849
64850
64851
64852
64853
64854
64855
64856
64857
64858
64859
64860
64861
64862
64863
64864
64865
64866
64867
64868
64869
64870
64871
64872
64873
64874
64875
64876
64877
64878
64879
64880
64881
64882
64883
64884
64885
64886
64887
64888
64889
64890
64891
64892
64893
64894
64895
64896
64897
64898
64899
64900
64901
64902
64903
64904
64905
64906
64907
64908
64909
64910
64911
64912
64913
64914
64915
64916
64917
64918
64919
64920
64921
64922
64923
64924
64925
64926
64927
64928
64929
64930
64931
64932
64933
64934
64935
64936
64937
64938
64939
64940
64941
64942
64943
64944
64945
64946
64947
64948
64949
64950
64951
64952
64953
64954
64955
64956
64957
64958
64959
64960
64961
64962
64963
64964
64965
64966
64967
64968
64969
64970
64971
64972
64973
64974
64975
64976
64977
64978
64979
64980
64981
64982
64983
64984
64985
64986
64987
64988
64989
64990
64991
64992
64993
64994
64995
64996
64997
64998
64999
65000
65001
65002
65003
65004
65005
65006
65007
65008
65009
65010
65011
65012
65013
65014
65015
65016
65017
65018
65019
65020
65021
65022
65023
65024
65025
65026
65027
65028
65029
65030
65031
65032
65033
65034
65035
65036
65037
65038
65039
65040
65041
65042
65043
65044
65045
65046
65047
65048
65049
65050
65051
65052
65053
65054
65055
65056
65057
65058
65059
65060
65061
65062
65063
65064
65065
65066
65067
65068
65069
65070
65071
65072
65073
65074
65075
65076
65077
65078
65079
65080
65081
65082
65083
65084
65085
65086
65087
65088
65089
65090
65091
65092
65093
65094
65095
65096
65097
65098
65099
65100
65101
65102
65103
65104
65105
65106
65107
65108
65109
65110
65111
65112
65113
65114
65115
65116
65117
65118
65119
65120
65121
65122
65123
65124
65125
65126
65127
65128
65129
65130
65131
65132
65133
65134
65135
65136
65137
65138
65139
65140
65141
65142
65143
65144
65145
65146
65147
65148
65149
65150
65151
65152
65153
65154
65155
65156
65157
65158
65159
65160
65161
65162
65163
65164
65165
65166
65167
65168
65169
65170
65171
65172
65173
65174
65175
65176
65177
65178
65179
65180
65181
65182
65183
65184
65185
65186
65187
65188
65189
65190
65191
65192
65193
65194
65195
65196
65197
65198
65199
65200
65201
65202
65203
65204
65205
65206
65207
65208
65209
65210
65211
65212
65213
65214
65215
65216
65217
65218
65219
65220
65221
65222
65223
65224
65225
65226
65227
65228
65229
65230
65231
65232
65233
65234
65235
65236
65237
65238
65239
65240
65241
65242
65243
65244
65245
65246
65247
65248
65249
65250
65251
65252
65253
65254
65255
65256
65257
65258
65259
65260
65261
65262
65263
65264
65265
65266
65267
65268
65269
65270
65271
65272
65273
65274
65275
65276
65277
65278
65279
65280
65281
65282
65283
65284
65285
65286
65287
65288
65289
65290
65291
65292
65293
65294
65295
65296
65297
65298
65299
65300
65301
65302
65303
65304
65305
65306
65307
65308
65309
65310
65311
65312
65313
65314
65315
65316
65317
65318
65319
65320
65321
65322
65323
65324
65325
65326
65327
65328
65329
65330
65331
65332
65333
65334
65335
65336
65337
65338
65339
65340
65341
65342
65343
65344
65345
65346
65347
65348
65349
65350
65351
65352
65353
65354
65355
65356
65357
65358
65359
65360
65361
65362
65363
65364
65365
65366
65367
65368
65369
65370
65371
65372
65373
65374
65375
65376
65377
65378
65379
65380
65381
65382
65383
65384
65385
65386
65387
65388
65389
65390
65391
65392
65393
65394
65395
65396
65397
65398
65399
65400
65401
65402
65403
65404
65405
65406
65407
65408
65409
65410
65411
65412
65413
65414
65415
65416
65417
65418
65419
65420
65421
65422
65423
65424
65425
65426
65427
65428
65429
65430
65431
65432
65433
65434
65435
65436
65437
65438
65439
65440
65441
65442
65443
65444
65445
65446
65447
65448
65449
65450
65451
65452
65453
65454
65455
65456
65457
65458
65459
65460
65461
65462
65463
65464
65465
65466
65467
65468
65469
65470
65471
65472
65473
65474
65475
65476
65477
65478
65479
65480
65481
65482
65483
65484
65485
65486
65487
65488
65489
65490
65491
65492
65493
65494
65495
65496
65497
65498
65499
65500
65501
65502
65503
65504
65505
65506
65507
65508
65509
65510
65511
65512
65513
65514
65515
65516
65517
65518
65519
65520
65521
65522
65523
65524
65525
65526
65527
65528
65529
65530
65531
65532
65533
65534
65535
65536
65537
65538
65539
65540
65541
65542
65543
65544
65545
65546
65547
65548
65549
65550
65551
65552
65553
65554
65555
65556
65557
65558
65559
65560
65561
65562
65563
65564
65565
65566
65567
65568
65569
65570
65571
65572
65573
65574
65575
65576
65577
65578
65579
65580
65581
65582
65583
65584
65585
65586
65587
65588
65589
65590
65591
65592
65593
65594
65595
65596
65597
65598
65599
65600
65601
65602
65603
65604
65605
65606
65607
65608
65609
65610
65611
65612
65613
65614
65615
65616
65617
65618
65619
65620
65621
65622
65623
65624
65625
65626
65627
65628
65629
65630
65631
65632
65633
65634
65635
65636
65637
65638
65639
65640
65641
65642
65643
65644
65645
65646
65647
65648
65649
65650
65651
65652
65653
65654
65655
65656
65657
65658
65659
65660
65661
65662
65663
65664
65665
65666
65667
65668
65669
65670
65671
65672
65673
65674
65675
65676
65677
65678
65679
65680
65681
65682
65683
65684
65685
65686
65687
65688
65689
65690
65691
65692
65693
65694
65695
65696
65697
65698
65699
65700
65701
65702
65703
65704
65705
65706
65707
65708
65709
65710
65711
65712
65713
65714
65715
65716
65717
65718
65719
65720
65721
65722
65723
65724
65725
65726
65727
65728
65729
65730
65731
65732
65733
65734
65735
65736
65737
65738
65739
65740
65741
65742
65743
65744
65745
65746
65747
65748
65749
65750
65751
65752
65753
65754
65755
65756
65757
65758
65759
65760
65761
65762
65763
65764
65765
65766
65767
65768
65769
65770
65771
65772
65773
65774
65775
65776
65777
65778
65779
65780
65781
65782
65783
65784
65785
65786
65787
65788
65789
65790
65791
65792
65793
65794
65795
65796
65797
65798
65799
65800
65801
65802
65803
65804
65805
65806
65807
65808
65809
65810
65811
65812
65813
65814
65815
65816
65817
65818
65819
65820
65821
65822
65823
65824
65825
65826
65827
65828
65829
65830
65831
65832
65833
65834
65835
65836
65837
65838
65839
65840
65841
65842
65843
65844
65845
65846
65847
65848
65849
65850
65851
65852
65853
65854
65855
65856
65857
65858
65859
65860
65861
65862
65863
65864
65865
65866
65867
65868
65869
65870
65871
65872
65873
65874
65875
65876
65877
65878
65879
65880
65881
65882
65883
65884
65885
65886
65887
65888
65889
65890
65891
65892
65893
65894
65895
65896
65897
65898
65899
65900
65901
65902
65903
65904
65905
65906
65907
65908
65909
65910
65911
65912
65913
65914
65915
65916
65917
65918
65919
65920
65921
65922
65923
65924
65925
65926
65927
65928
65929
65930
65931
65932
65933
65934
65935
65936
65937
65938
65939
65940
65941
65942
65943
65944
65945
65946
65947
65948
65949
65950
65951
65952
65953
65954
65955
65956
65957
65958
65959
65960
65961
65962
65963
65964
65965
65966
65967
65968
65969
65970
65971
65972
65973
65974
65975
65976
65977
65978
65979
65980
65981
65982
65983
65984
65985
65986
65987
65988
65989
65990
65991
65992
65993
65994
65995
65996
65997
65998
65999
66000
66001
66002
66003
66004
66005
66006
66007
66008
66009
66010
66011
66012
66013
66014
66015
66016
66017
66018
66019
66020
66021
66022
66023
66024
66025
66026
66027
66028
66029
66030
66031
66032
66033
66034
66035
66036
66037
66038
66039
66040
66041
66042
66043
66044
66045
66046
66047
66048
66049
66050
66051
66052
66053
66054
66055
66056
66057
66058
66059
66060
66061
66062
66063
66064
66065
66066
66067
66068
66069
66070
66071
66072
66073
66074
66075
66076
66077
66078
66079
66080
66081
66082
66083
66084
66085
66086
66087
66088
66089
66090
66091
66092
66093
66094
66095
66096
66097
66098
66099
66100
66101
66102
66103
66104
66105
66106
66107
66108
66109
66110
66111
66112
66113
66114
66115
66116
66117
66118
66119
66120
66121
66122
66123
66124
66125
66126
66127
66128
66129
66130
66131
66132
66133
66134
66135
66136
66137
66138
66139
66140
66141
66142
66143
66144
66145
66146
66147
66148
66149
66150
66151
66152
66153
66154
66155
66156
66157
66158
66159
66160
66161
66162
66163
66164
66165
66166
66167
66168
66169
66170
66171
66172
66173
66174
66175
66176
66177
66178
66179
66180
66181
66182
66183
66184
66185
66186
66187
66188
66189
66190
66191
66192
66193
66194
66195
66196
66197
66198
66199
66200
66201
66202
66203
66204
66205
66206
66207
66208
66209
66210
66211
66212
66213
66214
66215
66216
66217
66218
66219
66220
66221
66222
66223
66224
66225
66226
66227
66228
66229
66230
66231
66232
66233
66234
66235
66236
66237
66238
66239
66240
66241
66242
66243
66244
66245
66246
66247
66248
66249
66250
66251
66252
66253
66254
66255
66256
66257
66258
66259
66260
66261
66262
66263
66264
66265
66266
66267
66268
66269
66270
66271
66272
66273
66274
66275
66276
66277
66278
66279
66280
66281
66282
66283
66284
66285
66286
66287
66288
66289
66290
66291
66292
66293
66294
66295
66296
66297
66298
66299
66300
66301
66302
66303
66304
66305
66306
66307
66308
66309
66310
66311
66312
66313
66314
66315
66316
66317
66318
66319
66320
66321
66322
66323
66324
66325
66326
66327
66328
66329
66330
66331
66332
66333
66334
66335
66336
66337
66338
66339
66340
66341
66342
66343
66344
66345
66346
66347
66348
66349
66350
66351
66352
66353
66354
66355
66356
66357
66358
66359
66360
66361
66362
66363
66364
66365
66366
66367
66368
66369
66370
66371
66372
66373
66374
66375
66376
66377
66378
66379
66380
66381
66382
66383
66384
66385
66386
66387
66388
66389
66390
66391
66392
66393
66394
66395
66396
66397
66398
66399
66400
66401
66402
66403
66404
66405
66406
66407
66408
66409
66410
66411
66412
66413
66414
66415
66416
66417
66418
66419
66420
66421
66422
66423
66424
66425
66426
66427
66428
66429
66430
66431
66432
66433
66434
66435
66436
66437
66438
66439
66440
66441
66442
66443
66444
66445
66446
66447
66448
66449
66450
66451
66452
66453
66454
66455
66456
66457
66458
66459
66460
66461
66462
66463
66464
66465
66466
66467
66468
66469
66470
66471
66472
66473
66474
66475
66476
66477
66478
66479
66480
66481
66482
66483
66484
66485
66486
66487
66488
66489
66490
66491
66492
66493
66494
66495
66496
66497
66498
66499
66500
66501
66502
66503
66504
66505
66506
66507
66508
66509
66510
66511
66512
66513
66514
66515
66516
66517
66518
66519
66520
66521
66522
66523
66524
66525
66526
66527
66528
66529
66530
66531
66532
66533
66534
66535
66536
66537
66538
66539
66540
66541
66542
66543
66544
66545
66546
66547
66548
66549
66550
66551
66552
66553
66554
66555
66556
66557
66558
66559
66560
66561
66562
66563
66564
66565
66566
66567
66568
66569
66570
66571
66572
66573
66574
66575
66576
66577
66578
66579
66580
66581
66582
66583
66584
66585
66586
66587
66588
66589
66590
66591
66592
66593
66594
66595
66596
66597
66598
66599
66600
66601
66602
66603
66604
66605
66606
66607
66608
66609
66610
66611
66612
66613
66614
66615
66616
66617
66618
66619
66620
66621
66622
66623
66624
66625
66626
66627
66628
66629
66630
66631
66632
66633
66634
66635
66636
66637
66638
66639
66640
66641
66642
66643
66644
66645
66646
66647
66648
66649
66650
66651
66652
66653
66654
66655
66656
66657
66658
66659
66660
66661
66662
66663
66664
66665
66666
66667
66668
66669
66670
66671
66672
66673
66674
66675
66676
66677
66678
66679
66680
66681
66682
66683
66684
66685
66686
66687
66688
66689
66690
66691
66692
66693
66694
66695
66696
66697
66698
66699
66700
66701
66702
66703
66704
66705
66706
66707
66708
66709
66710
66711
66712
66713
66714
66715
66716
66717
66718
66719
66720
66721
66722
66723
66724
66725
66726
66727
66728
66729
66730
66731
66732
66733
66734
66735
66736
66737
66738
66739
66740
66741
66742
66743
66744
66745
66746
66747
66748
66749
66750
66751
66752
66753
66754
66755
66756
66757
66758
66759
66760
66761
66762
66763
66764
66765
66766
66767
66768
66769
66770
66771
66772
66773
66774
66775
66776
66777
66778
66779
66780
66781
66782
66783
66784
66785
66786
66787
66788
66789
66790
66791
66792
66793
66794
66795
66796
66797
66798
66799
66800
66801
66802
66803
66804
66805
66806
66807
66808
66809
66810
66811
66812
66813
66814
66815
66816
66817
66818
66819
66820
66821
66822
66823
66824
66825
66826
66827
66828
66829
66830
66831
66832
66833
66834
66835
66836
66837
66838
66839
66840
66841
66842
66843
66844
66845
66846
66847
66848
66849
66850
66851
66852
66853
66854
66855
66856
66857
66858
66859
66860
66861
66862
66863
66864
66865
66866
66867
66868
66869
66870
66871
66872
66873
66874
66875
66876
66877
66878
66879
66880
66881
66882
66883
66884
66885
66886
66887
66888
66889
66890
66891
66892
66893
66894
66895
66896
66897
66898
66899
66900
66901
66902
66903
66904
66905
66906
66907
66908
66909
66910
66911
66912
66913
66914
66915
66916
66917
66918
66919
66920
66921
66922
66923
66924
66925
66926
66927
66928
66929
66930
66931
66932
66933
66934
66935
66936
66937
66938
66939
66940
66941
66942
66943
66944
66945
66946
66947
66948
66949
66950
66951
66952
66953
66954
66955
66956
66957
66958
66959
66960
66961
66962
66963
66964
66965
66966
66967
66968
66969
66970
66971
66972
66973
66974
66975
66976
66977
66978
66979
66980
66981
66982
66983
66984
66985
66986
66987
66988
66989
66990
66991
66992
66993
66994
66995
66996
66997
66998
66999
67000
67001
67002
67003
67004
67005
67006
67007
67008
67009
67010
67011
67012
67013
67014
67015
67016
67017
67018
67019
67020
67021
67022
67023
67024
67025
67026
67027
67028
67029
67030
67031
67032
67033
67034
67035
67036
67037
67038
67039
67040
67041
67042
67043
67044
67045
67046
67047
67048
67049
67050
67051
67052
67053
67054
67055
67056
67057
67058
67059
67060
67061
67062
67063
67064
67065
67066
67067
67068
67069
67070
67071
67072
67073
67074
67075
67076
67077
67078
67079
67080
67081
67082
67083
67084
67085
67086
67087
67088
67089
67090
67091
67092
67093
67094
67095
67096
67097
67098
67099
67100
67101
67102
67103
67104
67105
67106
67107
67108
67109
67110
67111
67112
67113
67114
67115
67116
67117
67118
67119
67120
67121
67122
67123
67124
67125
67126
67127
67128
67129
67130
67131
67132
67133
67134
67135
67136
67137
67138
67139
67140
67141
67142
67143
67144
67145
67146
67147
67148
67149
67150
67151
67152
67153
67154
67155
67156
67157
67158
67159
67160
67161
67162
67163
67164
67165
67166
67167
67168
67169
67170
67171
67172
67173
67174
67175
67176
67177
67178
67179
67180
67181
67182
67183
67184
67185
67186
67187
67188
67189
67190
67191
67192
67193
67194
67195
67196
67197
67198
67199
67200
67201
67202
67203
67204
67205
67206
67207
67208
67209
67210
67211
67212
67213
67214
67215
67216
67217
67218
67219
67220
67221
67222
67223
67224
67225
67226
67227
67228
67229
67230
67231
67232
67233
67234
67235
67236
67237
67238
67239
67240
67241
67242
67243
67244
67245
67246
67247
67248
67249
67250
67251
67252
67253
67254
67255
67256
67257
67258
67259
67260
67261
67262
67263
67264
67265
67266
67267
67268
67269
67270
67271
67272
67273
67274
67275
67276
67277
67278
67279
67280
67281
67282
67283
67284
67285
67286
67287
67288
67289
67290
67291
67292
67293
67294
67295
67296
67297
67298
67299
67300
67301
67302
67303
67304
67305
67306
67307
67308
67309
67310
67311
67312
67313
67314
67315
67316
67317
67318
67319
67320
67321
67322
67323
67324
67325
67326
67327
67328
67329
67330
67331
67332
67333
67334
67335
67336
67337
67338
67339
67340
67341
67342
67343
67344
67345
67346
67347
67348
67349
67350
67351
67352
67353
67354
67355
67356
67357
67358
67359
67360
67361
67362
67363
67364
67365
67366
67367
67368
67369
67370
67371
67372
67373
67374
67375
67376
67377
67378
67379
67380
67381
67382
67383
67384
67385
67386
67387
67388
67389
67390
67391
67392
67393
67394
67395
67396
67397
67398
67399
67400
67401
67402
67403
67404
67405
67406
67407
67408
67409
67410
67411
67412
67413
67414
67415
67416
67417
67418
67419
67420
67421
67422
67423
67424
67425
67426
67427
67428
67429
67430
67431
67432
67433
67434
67435
67436
67437
67438
67439
67440
67441
67442
67443
67444
67445
67446
67447
67448
67449
67450
67451
67452
67453
67454
67455
67456
67457
67458
67459
67460
67461
67462
67463
67464
67465
67466
67467
67468
67469
67470
67471
67472
67473
67474
67475
67476
67477
67478
67479
67480
67481
67482
67483
67484
67485
67486
67487
67488
67489
67490
67491
67492
67493
67494
67495
67496
67497
67498
67499
67500
67501
67502
67503
67504
67505
67506
67507
67508
67509
67510
67511
67512
67513
67514
67515
67516
67517
67518
67519
67520
67521
67522
67523
67524
67525
67526
67527
67528
67529
67530
67531
67532
67533
67534
67535
67536
67537
67538
67539
67540
67541
67542
67543
67544
67545
67546
67547
67548
67549
67550
67551
67552
67553
67554
67555
67556
67557
67558
67559
67560
67561
67562
67563
67564
67565
67566
67567
67568
67569
67570
67571
67572
67573
67574
67575
67576
67577
67578
67579
67580
67581
67582
67583
67584
67585
67586
67587
67588
67589
67590
67591
67592
67593
67594
67595
67596
67597
67598
67599
67600
67601
67602
67603
67604
67605
67606
67607
67608
67609
67610
67611
67612
67613
67614
67615
67616
67617
67618
67619
67620
67621
67622
67623
67624
67625
67626
67627
67628
67629
67630
67631
67632
67633
67634
67635
67636
67637
67638
67639
67640
67641
67642
67643
67644
67645
67646
67647
67648
67649
67650
67651
67652
67653
67654
67655
67656
67657
67658
67659
67660
67661
67662
67663
67664
67665
67666
67667
67668
67669
67670
67671
67672
67673
67674
67675
67676
67677
67678
67679
67680
67681
67682
67683
67684
67685
67686
67687
67688
67689
67690
67691
67692
67693
67694
67695
67696
67697
67698
67699
67700
67701
67702
67703
67704
67705
67706
67707
67708
67709
67710
67711
67712
67713
67714
67715
67716
67717
67718
67719
67720
67721
67722
67723
67724
67725
67726
67727
67728
67729
67730
67731
67732
67733
67734
67735
67736
67737
67738
67739
67740
67741
67742
67743
67744
67745
67746
67747
67748
67749
67750
67751
67752
67753
67754
67755
67756
67757
67758
67759
67760
67761
67762
67763
67764
67765
67766
67767
67768
67769
67770
67771
67772
67773
67774
67775
67776
67777
67778
67779
67780
67781
67782
67783
67784
67785
67786
67787
67788
67789
67790
67791
67792
67793
67794
67795
67796
67797
67798
67799
67800
67801
67802
67803
67804
67805
67806
67807
67808
67809
67810
67811
67812
67813
67814
67815
67816
67817
67818
67819
67820
67821
67822
67823
67824
67825
67826
67827
67828
67829
67830
67831
67832
67833
67834
67835
67836
67837
67838
67839
67840
67841
67842
67843
67844
67845
67846
67847
67848
67849
67850
67851
67852
67853
67854
67855
67856
67857
67858
67859
67860
67861
67862
67863
67864
67865
67866
67867
67868
67869
67870
67871
67872
67873
67874
67875
67876
67877
67878
67879
67880
67881
67882
67883
67884
67885
67886
67887
67888
67889
67890
67891
67892
67893
67894
67895
67896
67897
67898
67899
67900
67901
67902
67903
67904
67905
67906
67907
67908
67909
67910
67911
67912
67913
67914
67915
67916
67917
67918
67919
67920
67921
67922
67923
67924
67925
67926
67927
67928
67929
67930
67931
67932
67933
67934
67935
67936
67937
67938
67939
67940
67941
67942
67943
67944
67945
67946
67947
67948
67949
67950
67951
67952
67953
67954
67955
67956
67957
67958
67959
67960
67961
67962
67963
67964
67965
67966
67967
67968
67969
67970
67971
67972
67973
67974
67975
67976
67977
67978
67979
67980
67981
67982
67983
67984
67985
67986
67987
67988
67989
67990
67991
67992
67993
67994
67995
67996
67997
67998
67999
68000
68001
68002
68003
68004
68005
68006
68007
68008
68009
68010
68011
68012
68013
68014
68015
68016
68017
68018
68019
68020
68021
68022
68023
68024
68025
68026
68027
68028
68029
68030
68031
68032
68033
68034
68035
68036
68037
68038
68039
68040
68041
68042
68043
68044
68045
68046
68047
68048
68049
68050
68051
68052
68053
68054
68055
68056
68057
68058
68059
68060
68061
68062
68063
68064
68065
68066
68067
68068
68069
68070
68071
68072
68073
68074
68075
68076
68077
68078
68079
68080
68081
68082
68083
68084
68085
68086
68087
68088
68089
68090
68091
68092
68093
68094
68095
68096
68097
68098
68099
68100
68101
68102
68103
68104
68105
68106
68107
68108
68109
68110
68111
68112
68113
68114
68115
68116
68117
68118
68119
68120
68121
68122
68123
68124
68125
68126
68127
68128
68129
68130
68131
68132
68133
68134
68135
68136
68137
68138
68139
68140
68141
68142
68143
68144
68145
68146
68147
68148
68149
68150
68151
68152
68153
68154
68155
68156
68157
68158
68159
68160
68161
68162
68163
68164
68165
68166
68167
68168
68169
68170
68171
68172
68173
68174
68175
68176
68177
68178
68179
68180
68181
68182
68183
68184
68185
68186
68187
68188
68189
68190
68191
68192
68193
68194
68195
68196
68197
68198
68199
68200
68201
68202
68203
68204
68205
68206
68207
68208
68209
68210
68211
68212
68213
68214
68215
68216
68217
68218
68219
68220
68221
68222
68223
68224
68225
68226
68227
68228
68229
68230
68231
68232
68233
68234
68235
68236
68237
68238
68239
68240
68241
68242
68243
68244
68245
68246
68247
68248
68249
68250
68251
68252
68253
68254
68255
68256
68257
68258
68259
68260
68261
68262
68263
68264
68265
68266
68267
68268
68269
68270
68271
68272
68273
68274
68275
68276
68277
68278
68279
68280
68281
68282
68283
68284
68285
68286
68287
68288
68289
68290
68291
68292
68293
68294
68295
68296
68297
68298
68299
68300
68301
68302
68303
68304
68305
68306
68307
68308
68309
68310
68311
68312
68313
68314
68315
68316
68317
68318
68319
68320
68321
68322
68323
68324
68325
68326
68327
68328
68329
68330
68331
68332
68333
68334
68335
68336
68337
68338
68339
68340
68341
68342
68343
68344
68345
68346
68347
68348
68349
68350
68351
68352
68353
68354
68355
68356
68357
68358
68359
68360
68361
68362
68363
68364
68365
68366
68367
68368
68369
68370
68371
68372
68373
68374
68375
68376
68377
68378
68379
68380
68381
68382
68383
68384
68385
68386
68387
68388
68389
68390
68391
68392
68393
68394
68395
68396
68397
68398
68399
68400
68401
68402
68403
68404
68405
68406
68407
68408
68409
68410
68411
68412
68413
68414
68415
68416
68417
68418
68419
68420
68421
68422
68423
68424
68425
68426
68427
68428
68429
68430
68431
68432
68433
68434
68435
68436
68437
68438
68439
68440
68441
68442
68443
68444
68445
68446
68447
68448
68449
68450
68451
68452
68453
68454
68455
68456
68457
68458
68459
68460
68461
68462
68463
68464
68465
68466
68467
68468
68469
68470
68471
68472
68473
68474
68475
68476
68477
68478
68479
68480
68481
68482
68483
68484
68485
68486
68487
68488
68489
68490
68491
68492
68493
68494
68495
68496
68497
68498
68499
68500
68501
68502
68503
68504
68505
68506
68507
68508
68509
68510
68511
68512
68513
68514
68515
68516
68517
68518
68519
68520
68521
68522
68523
68524
68525
68526
68527
68528
68529
68530
68531
68532
68533
68534
68535
68536
68537
68538
68539
68540
68541
68542
68543
68544
68545
68546
68547
68548
68549
68550
68551
68552
68553
68554
68555
68556
68557
68558
68559
68560
68561
68562
68563
68564
68565
68566
68567
68568
68569
68570
68571
68572
68573
68574
68575
68576
68577
68578
68579
68580
68581
68582
68583
68584
68585
68586
68587
68588
68589
68590
68591
68592
68593
68594
68595
68596
68597
68598
68599
68600
68601
68602
68603
68604
68605
68606
68607
68608
68609
68610
68611
68612
68613
68614
68615
68616
68617
68618
68619
68620
68621
68622
68623
68624
68625
68626
68627
68628
68629
68630
68631
68632
68633
68634
68635
68636
68637
68638
68639
68640
68641
68642
68643
68644
68645
68646
68647
68648
68649
68650
68651
68652
68653
68654
68655
68656
68657
68658
68659
68660
68661
68662
68663
68664
68665
68666
68667
68668
68669
68670
68671
68672
68673
68674
68675
68676
68677
68678
68679
68680
68681
68682
68683
68684
68685
68686
68687
68688
68689
68690
68691
68692
68693
68694
68695
68696
68697
68698
68699
68700
68701
68702
68703
68704
68705
68706
68707
68708
68709
68710
68711
68712
68713
68714
68715
68716
68717
68718
68719
68720
68721
68722
68723
68724
68725
68726
68727
68728
68729
68730
68731
68732
68733
68734
68735
68736
68737
68738
68739
68740
68741
68742
68743
68744
68745
68746
68747
68748
68749
68750
68751
68752
68753
68754
68755
68756
68757
68758
68759
68760
68761
68762
68763
68764
68765
68766
68767
68768
68769
68770
68771
68772
68773
68774
68775
68776
68777
68778
68779
68780
68781
68782
68783
68784
68785
68786
68787
68788
68789
68790
68791
68792
68793
68794
68795
68796
68797
68798
68799
68800
68801
68802
68803
68804
68805
68806
68807
68808
68809
68810
68811
68812
68813
68814
68815
68816
68817
68818
68819
68820
68821
68822
68823
68824
68825
68826
68827
68828
68829
68830
68831
68832
68833
68834
68835
68836
68837
68838
68839
68840
68841
68842
68843
68844
68845
68846
68847
68848
68849
68850
68851
68852
68853
68854
68855
68856
68857
68858
68859
68860
68861
68862
68863
68864
68865
68866
68867
68868
68869
68870
68871
68872
68873
68874
68875
68876
68877
68878
68879
68880
68881
68882
68883
68884
68885
68886
68887
68888
68889
68890
68891
68892
68893
68894
68895
68896
68897
68898
68899
68900
68901
68902
68903
68904
68905
68906
68907
68908
68909
68910
68911
68912
68913
68914
68915
68916
68917
68918
68919
68920
68921
68922
68923
68924
68925
68926
68927
68928
68929
68930
68931
68932
68933
68934
68935
68936
68937
68938
68939
68940
68941
68942
68943
68944
68945
68946
68947
68948
68949
68950
68951
68952
68953
68954
68955
68956
68957
68958
68959
68960
68961
68962
68963
68964
68965
68966
68967
68968
68969
68970
68971
68972
68973
68974
68975
68976
68977
68978
68979
68980
68981
68982
68983
68984
68985
68986
68987
68988
68989
68990
68991
68992
68993
68994
68995
68996
68997
68998
68999
69000
69001
69002
69003
69004
69005
69006
69007
69008
69009
69010
69011
69012
69013
69014
69015
69016
69017
69018
69019
69020
69021
69022
69023
69024
69025
69026
69027
69028
69029
69030
69031
69032
69033
69034
69035
69036
69037
69038
69039
69040
69041
69042
69043
69044
69045
69046
69047
69048
69049
69050
69051
69052
69053
69054
69055
69056
69057
69058
69059
69060
69061
69062
69063
69064
69065
69066
69067
69068
69069
69070
69071
69072
69073
69074
69075
69076
69077
69078
69079
69080
69081
69082
69083
69084
69085
69086
69087
69088
69089
69090
69091
69092
69093
69094
69095
69096
69097
69098
69099
69100
69101
69102
69103
69104
69105
69106
69107
69108
69109
69110
69111
69112
69113
69114
69115
69116
69117
69118
69119
69120
69121
69122
69123
69124
69125
69126
69127
69128
69129
69130
69131
69132
69133
69134
69135
69136
69137
69138
69139
69140
69141
69142
69143
69144
69145
69146
69147
69148
69149
69150
69151
69152
69153
69154
69155
69156
69157
69158
69159
69160
69161
69162
69163
69164
69165
69166
69167
69168
69169
69170
69171
69172
69173
69174
69175
69176
69177
69178
69179
69180
69181
69182
69183
69184
69185
69186
69187
69188
69189
69190
69191
69192
69193
69194
69195
69196
69197
69198
69199
69200
69201
69202
69203
69204
69205
69206
69207
69208
69209
69210
69211
69212
69213
69214
69215
69216
69217
69218
69219
69220
69221
69222
69223
69224
69225
69226
69227
69228
69229
69230
69231
69232
69233
69234
69235
69236
69237
69238
69239
69240
69241
69242
69243
69244
69245
69246
69247
69248
69249
69250
69251
69252
69253
69254
69255
69256
69257
69258
69259
69260
69261
69262
69263
69264
69265
69266
69267
69268
69269
69270
69271
69272
69273
69274
69275
69276
69277
69278
69279
69280
69281
69282
69283
69284
69285
69286
69287
69288
69289
69290
69291
69292
69293
69294
69295
69296
69297
69298
69299
69300
69301
69302
69303
69304
69305
69306
69307
69308
69309
69310
69311
69312
69313
69314
69315
69316
69317
69318
69319
69320
69321
69322
69323
69324
69325
69326
69327
69328
69329
69330
69331
69332
69333
69334
69335
69336
69337
69338
69339
69340
69341
69342
69343
69344
69345
69346
69347
69348
69349
69350
69351
69352
69353
69354
69355
69356
69357
69358
69359
69360
69361
69362
69363
69364
69365
69366
69367
69368
69369
69370
69371
69372
69373
69374
69375
69376
69377
69378
69379
69380
69381
69382
69383
69384
69385
69386
69387
69388
69389
69390
69391
69392
69393
69394
69395
69396
69397
69398
69399
69400
69401
69402
69403
69404
69405
69406
69407
69408
69409
69410
69411
69412
69413
69414
69415
69416
69417
69418
69419
69420
69421
69422
69423
69424
69425
69426
69427
69428
69429
69430
69431
69432
69433
69434
69435
69436
69437
69438
69439
69440
69441
69442
69443
69444
69445
69446
69447
69448
69449
69450
69451
69452
69453
69454
69455
69456
69457
69458
69459
69460
69461
69462
69463
69464
69465
69466
69467
69468
69469
69470
69471
69472
69473
69474
69475
69476
69477
69478
69479
69480
69481
69482
69483
69484
69485
69486
69487
69488
69489
69490
69491
69492
69493
69494
69495
69496
69497
69498
69499
69500
69501
69502
69503
69504
69505
69506
69507
69508
69509
69510
69511
69512
69513
69514
69515
69516
69517
69518
69519
69520
69521
69522
69523
69524
69525
69526
69527
69528
69529
69530
69531
69532
69533
69534
69535
69536
69537
69538
69539
69540
69541
69542
69543
69544
69545
69546
69547
69548
69549
69550
69551
69552
69553
69554
69555
69556
69557
69558
69559
69560
69561
69562
69563
69564
69565
69566
69567
69568
69569
69570
69571
69572
69573
69574
69575
69576
69577
69578
69579
69580
69581
69582
69583
69584
69585
69586
69587
69588
69589
69590
69591
69592
69593
69594
69595
69596
69597
69598
69599
69600
69601
69602
69603
69604
69605
69606
69607
69608
69609
69610
69611
69612
69613
69614
69615
69616
69617
69618
69619
69620
69621
69622
69623
69624
69625
69626
69627
69628
69629
69630
69631
69632
69633
69634
69635
69636
69637
69638
69639
69640
69641
69642
69643
69644
69645
69646
69647
69648
69649
69650
69651
69652
69653
69654
69655
69656
69657
69658
69659
69660
69661
69662
69663
69664
69665
69666
69667
69668
69669
69670
69671
69672
69673
69674
69675
69676
69677
69678
69679
69680
69681
69682
69683
69684
69685
69686
69687
69688
69689
69690
69691
69692
69693
69694
69695
69696
69697
69698
69699
69700
69701
69702
69703
69704
69705
69706
69707
69708
69709
69710
69711
69712
69713
69714
69715
69716
69717
69718
69719
69720
69721
69722
69723
69724
69725
69726
69727
69728
69729
69730
69731
69732
69733
69734
69735
69736
69737
69738
69739
69740
69741
69742
69743
69744
69745
69746
69747
69748
69749
69750
69751
69752
69753
69754
69755
69756
69757
69758
69759
69760
69761
69762
69763
69764
69765
69766
69767
69768
69769
69770
69771
69772
69773
69774
69775
69776
69777
69778
69779
69780
69781
69782
69783
69784
69785
69786
69787
69788
69789
69790
69791
69792
69793
69794
69795
69796
69797
69798
69799
69800
69801
69802
69803
69804
69805
69806
69807
69808
69809
69810
69811
69812
69813
69814
69815
69816
69817
69818
69819
69820
69821
69822
69823
69824
69825
69826
69827
69828
69829
69830
69831
69832
69833
69834
69835
69836
69837
69838
69839
69840
69841
69842
69843
69844
69845
69846
69847
69848
69849
69850
69851
69852
69853
69854
69855
69856
69857
69858
69859
69860
69861
69862
69863
69864
69865
69866
69867
69868
69869
69870
69871
69872
69873
69874
69875
69876
69877
69878
69879
69880
69881
69882
69883
69884
69885
69886
69887
69888
69889
69890
69891
69892
69893
69894
69895
69896
69897
69898
69899
69900
69901
69902
69903
69904
69905
69906
69907
69908
69909
69910
69911
69912
69913
69914
69915
69916
69917
69918
69919
69920
69921
69922
69923
69924
69925
69926
69927
69928
69929
69930
69931
69932
69933
69934
69935
69936
69937
69938
69939
69940
69941
69942
69943
69944
69945
69946
69947
69948
69949
69950
69951
69952
69953
69954
69955
69956
69957
69958
69959
69960
69961
69962
69963
69964
69965
69966
69967
69968
69969
69970
69971
69972
69973
69974
69975
69976
69977
69978
69979
69980
69981
69982
69983
69984
69985
69986
69987
69988
69989
69990
69991
69992
69993
69994
69995
69996
69997
69998
69999
70000
70001
70002
70003
70004
70005
70006
70007
70008
70009
70010
70011
70012
70013
70014
70015
70016
70017
70018
70019
70020
70021
70022
70023
70024
70025
70026
70027
70028
70029
70030
70031
70032
70033
70034
70035
70036
70037
70038
70039
70040
70041
70042
70043
70044
70045
70046
70047
70048
70049
70050
70051
70052
70053
70054
70055
70056
70057
70058
70059
70060
70061
70062
70063
70064
70065
70066
70067
70068
70069
70070
70071
70072
70073
70074
70075
70076
70077
70078
70079
70080
70081
70082
70083
70084
70085
70086
70087
70088
70089
70090
70091
70092
70093
70094
70095
70096
70097
70098
70099
70100
70101
70102
70103
70104
70105
70106
70107
70108
70109
70110
70111
70112
70113
70114
70115
70116
70117
70118
70119
70120
70121
70122
70123
70124
70125
70126
70127
70128
70129
70130
70131
70132
70133
70134
70135
70136
70137
70138
70139
70140
70141
70142
70143
70144
70145
70146
70147
70148
70149
70150
70151
70152
70153
70154
70155
70156
70157
70158
70159
70160
70161
70162
70163
70164
70165
70166
70167
70168
70169
70170
70171
70172
70173
70174
70175
70176
70177
70178
70179
70180
70181
70182
70183
70184
70185
70186
70187
70188
70189
70190
70191
70192
70193
70194
70195
70196
70197
70198
70199
70200
70201
70202
70203
70204
70205
70206
70207
70208
70209
70210
70211
70212
70213
70214
70215
70216
70217
70218
70219
70220
70221
70222
70223
70224
70225
70226
70227
70228
70229
70230
70231
70232
70233
70234
70235
70236
70237
70238
70239
70240
70241
70242
70243
70244
70245
70246
70247
70248
70249
70250
70251
70252
70253
70254
70255
70256
70257
70258
70259
70260
70261
70262
70263
70264
70265
70266
70267
70268
70269
70270
70271
70272
70273
70274
70275
70276
70277
70278
70279
70280
70281
70282
70283
70284
70285
70286
70287
70288
70289
70290
70291
70292
70293
70294
70295
70296
70297
70298
70299
70300
70301
70302
70303
70304
70305
70306
70307
70308
70309
70310
70311
70312
70313
70314
70315
70316
70317
70318
70319
70320
70321
70322
70323
70324
70325
70326
70327
70328
70329
70330
70331
70332
70333
70334
70335
70336
70337
70338
70339
70340
70341
70342
70343
70344
70345
70346
70347
70348
70349
70350
70351
70352
70353
70354
70355
70356
70357
70358
70359
70360
70361
70362
70363
70364
70365
70366
70367
70368
70369
70370
70371
70372
70373
70374
70375
70376
70377
70378
70379
70380
70381
70382
70383
70384
70385
70386
70387
70388
70389
70390
70391
70392
70393
70394
70395
70396
70397
70398
70399
70400
70401
70402
70403
70404
70405
70406
70407
70408
70409
70410
70411
70412
70413
70414
70415
70416
70417
70418
70419
70420
70421
70422
70423
70424
70425
70426
70427
70428
70429
70430
70431
70432
70433
70434
70435
70436
70437
70438
70439
70440
70441
70442
70443
70444
70445
70446
70447
70448
70449
70450
70451
70452
70453
70454
70455
70456
70457
70458
70459
70460
70461
70462
70463
70464
70465
70466
70467
70468
70469
70470
70471
70472
70473
70474
70475
70476
70477
70478
70479
70480
70481
70482
70483
70484
70485
70486
70487
70488
70489
70490
70491
70492
70493
70494
70495
70496
70497
70498
70499
70500
70501
70502
70503
70504
70505
70506
70507
70508
70509
70510
70511
70512
70513
70514
70515
70516
70517
70518
70519
70520
70521
70522
70523
70524
70525
70526
70527
70528
70529
70530
70531
70532
70533
70534
70535
70536
70537
70538
70539
70540
70541
70542
70543
70544
70545
70546
70547
70548
70549
70550
70551
70552
70553
70554
70555
70556
70557
70558
70559
70560
70561
70562
70563
70564
70565
70566
70567
70568
70569
70570
70571
70572
70573
70574
70575
70576
70577
70578
70579
70580
70581
70582
70583
70584
70585
70586
70587
70588
70589
70590
70591
70592
70593
70594
70595
70596
70597
70598
70599
70600
70601
70602
70603
70604
70605
70606
70607
70608
70609
70610
70611
70612
70613
70614
70615
70616
70617
70618
70619
70620
70621
70622
70623
70624
70625
70626
70627
70628
70629
70630
70631
70632
70633
70634
70635
70636
70637
70638
70639
70640
70641
70642
70643
70644
70645
70646
70647
70648
70649
70650
70651
70652
70653
70654
70655
70656
70657
70658
70659
70660
70661
70662
70663
70664
70665
70666
70667
70668
70669
70670
70671
70672
70673
70674
70675
70676
70677
70678
70679
70680
70681
70682
70683
70684
70685
70686
70687
70688
70689
70690
70691
70692
70693
70694
70695
70696
70697
70698
70699
70700
70701
70702
70703
70704
70705
70706
70707
70708
70709
70710
70711
70712
70713
70714
70715
70716
70717
70718
70719
70720
70721
70722
70723
70724
70725
70726
70727
70728
70729
70730
70731
70732
70733
70734
70735
70736
70737
70738
70739
70740
70741
70742
70743
70744
70745
70746
70747
70748
70749
70750
70751
70752
70753
70754
70755
70756
70757
70758
70759
70760
70761
70762
70763
70764
70765
70766
70767
70768
70769
70770
70771
70772
70773
70774
70775
70776
70777
70778
70779
70780
70781
70782
70783
70784
70785
70786
70787
70788
70789
70790
70791
70792
70793
70794
70795
70796
70797
70798
70799
70800
70801
70802
70803
70804
70805
70806
70807
70808
70809
70810
70811
70812
70813
70814
70815
70816
70817
70818
70819
70820
70821
70822
70823
70824
70825
70826
70827
70828
70829
70830
70831
70832
70833
70834
70835
70836
70837
70838
70839
70840
70841
70842
70843
70844
70845
70846
70847
70848
70849
70850
70851
70852
70853
70854
70855
70856
70857
70858
70859
70860
70861
70862
70863
70864
70865
70866
70867
70868
70869
70870
70871
70872
70873
70874
70875
70876
70877
70878
70879
70880
70881
70882
70883
70884
70885
70886
70887
70888
70889
70890
70891
70892
70893
70894
70895
70896
70897
70898
70899
70900
70901
70902
70903
70904
70905
70906
70907
70908
70909
70910
70911
70912
70913
70914
70915
70916
70917
70918
70919
70920
70921
70922
70923
70924
70925
70926
70927
70928
70929
70930
70931
70932
70933
70934
70935
70936
70937
70938
70939
70940
70941
70942
70943
70944
70945
70946
70947
70948
70949
70950
70951
70952
70953
70954
70955
70956
70957
70958
70959
70960
70961
70962
70963
70964
70965
70966
70967
70968
70969
70970
70971
70972
70973
70974
70975
70976
70977
70978
70979
70980
70981
70982
70983
70984
70985
70986
70987
70988
70989
70990
70991
70992
70993
70994
70995
70996
70997
70998
70999
71000
71001
71002
71003
71004
71005
71006
71007
71008
71009
71010
71011
71012
71013
71014
71015
71016
71017
71018
71019
71020
71021
71022
71023
71024
71025
71026
71027
71028
71029
71030
71031
71032
71033
71034
71035
71036
71037
71038
71039
71040
71041
71042
71043
71044
71045
71046
71047
71048
71049
71050
71051
71052
71053
71054
71055
71056
71057
71058
71059
71060
71061
71062
71063
71064
71065
71066
71067
71068
71069
71070
71071
71072
71073
71074
71075
71076
71077
71078
71079
71080
71081
71082
71083
71084
71085
71086
71087
71088
71089
71090
71091
71092
71093
71094
71095
71096
71097
71098
71099
71100
71101
71102
71103
71104
71105
71106
71107
71108
71109
71110
71111
71112
71113
71114
71115
71116
71117
71118
71119
71120
71121
71122
71123
71124
71125
71126
71127
71128
71129
71130
71131
71132
71133
71134
71135
71136
71137
71138
71139
71140
71141
71142
71143
71144
71145
71146
71147
71148
71149
71150
71151
71152
71153
71154
71155
71156
71157
71158
71159
71160
71161
71162
71163
71164
71165
71166
71167
71168
71169
71170
71171
71172
71173
71174
71175
71176
71177
71178
71179
71180
71181
71182
71183
71184
71185
71186
71187
71188
71189
71190
71191
71192
71193
71194
71195
71196
71197
71198
71199
71200
71201
71202
71203
71204
71205
71206
71207
71208
71209
71210
71211
71212
71213
71214
71215
71216
71217
71218
71219
71220
71221
71222
71223
71224
71225
71226
71227
71228
71229
71230
71231
71232
71233
71234
71235
71236
71237
71238
71239
71240
71241
71242
71243
71244
71245
71246
71247
71248
71249
71250
71251
71252
71253
71254
71255
71256
71257
71258
71259
71260
71261
71262
71263
71264
71265
71266
71267
71268
71269
71270
71271
71272
71273
71274
71275
71276
71277
71278
71279
71280
71281
71282
71283
71284
71285
71286
71287
71288
71289
71290
71291
71292
71293
71294
71295
71296
71297
71298
71299
71300
71301
71302
71303
71304
71305
71306
71307
71308
71309
71310
71311
71312
71313
71314
71315
71316
71317
71318
71319
71320
71321
71322
71323
71324
71325
71326
71327
71328
71329
71330
71331
71332
71333
71334
71335
71336
71337
71338
71339
71340
71341
71342
71343
71344
71345
71346
71347
71348
71349
71350
71351
71352
71353
71354
71355
71356
71357
71358
71359
71360
71361
71362
71363
71364
71365
71366
71367
71368
71369
71370
71371
71372
71373
71374
71375
71376
71377
71378
71379
71380
71381
71382
71383
71384
71385
71386
71387
71388
71389
71390
71391
71392
71393
71394
71395
71396
71397
71398
71399
71400
71401
71402
71403
71404
71405
71406
71407
71408
71409
71410
71411
71412
71413
71414
71415
71416
71417
71418
71419
71420
71421
71422
71423
71424
71425
71426
71427
71428
71429
71430
71431
71432
71433
71434
71435
71436
71437
71438
71439
71440
71441
71442
71443
71444
71445
71446
71447
71448
71449
71450
71451
71452
71453
71454
71455
71456
71457
71458
71459
71460
71461
71462
71463
71464
71465
71466
71467
71468
71469
71470
71471
71472
71473
71474
71475
71476
71477
71478
71479
71480
71481
71482
71483
71484
71485
71486
71487
71488
71489
71490
71491
71492
71493
71494
71495
71496
71497
71498
71499
71500
71501
71502
71503
71504
71505
71506
71507
71508
71509
71510
71511
71512
71513
71514
71515
71516
71517
71518
71519
71520
71521
71522
71523
71524
71525
71526
71527
71528
71529
71530
71531
71532
71533
71534
71535
71536
71537
71538
71539
71540
71541
71542
71543
71544
71545
71546
71547
71548
71549
71550
71551
71552
71553
71554
71555
71556
71557
71558
71559
71560
71561
71562
71563
71564
71565
71566
71567
71568
71569
71570
71571
71572
71573
71574
71575
71576
71577
71578
71579
71580
71581
71582
71583
71584
71585
71586
71587
71588
71589
71590
71591
71592
71593
71594
71595
71596
71597
71598
71599
71600
71601
71602
71603
71604
71605
71606
71607
71608
71609
71610
71611
71612
71613
71614
71615
71616
71617
71618
71619
71620
71621
71622
71623
71624
71625
71626
71627
71628
71629
71630
71631
71632
71633
71634
71635
71636
71637
71638
71639
71640
71641
71642
71643
71644
71645
71646
71647
71648
71649
71650
71651
71652
71653
71654
71655
71656
71657
71658
71659
71660
71661
71662
71663
71664
71665
71666
71667
71668
71669
71670
71671
71672
71673
71674
71675
71676
71677
71678
71679
71680
71681
71682
71683
71684
71685
71686
71687
71688
71689
71690
71691
71692
71693
71694
71695
71696
71697
71698
71699
71700
71701
71702
71703
71704
71705
71706
71707
71708
71709
71710
71711
71712
71713
71714
71715
71716
71717
71718
71719
71720
71721
71722
71723
71724
71725
71726
71727
71728
71729
71730
71731
71732
71733
71734
71735
71736
71737
71738
71739
71740
71741
71742
71743
71744
71745
71746
71747
71748
71749
71750
71751
71752
71753
71754
71755
71756
71757
71758
71759
71760
71761
71762
71763
71764
71765
71766
71767
71768
71769
71770
71771
71772
71773
71774
71775
71776
71777
71778
71779
71780
71781
71782
71783
71784
71785
71786
71787
71788
71789
71790
71791
71792
71793
71794
71795
71796
71797
71798
71799
71800
71801
71802
71803
71804
71805
71806
71807
71808
71809
71810
71811
71812
71813
71814
71815
71816
71817
71818
71819
71820
71821
71822
71823
71824
71825
71826
71827
71828
71829
71830
71831
71832
71833
71834
71835
71836
71837
71838
71839
71840
71841
71842
71843
71844
71845
71846
71847
71848
71849
71850
71851
71852
71853
71854
71855
71856
71857
71858
71859
71860
71861
71862
71863
71864
71865
71866
71867
71868
71869
71870
71871
71872
71873
71874
71875
71876
71877
71878
71879
71880
71881
71882
71883
71884
71885
71886
71887
71888
71889
71890
71891
71892
71893
71894
71895
71896
71897
71898
71899
71900
71901
71902
71903
71904
71905
71906
71907
71908
71909
71910
71911
71912
71913
71914
71915
71916
71917
71918
71919
71920
71921
71922
71923
71924
71925
71926
71927
71928
71929
71930
71931
71932
71933
71934
71935
71936
71937
71938
71939
71940
71941
71942
71943
71944
71945
71946
71947
71948
71949
71950
71951
71952
71953
71954
71955
71956
71957
71958
71959
71960
71961
71962
71963
71964
71965
71966
71967
71968
71969
71970
71971
71972
71973
71974
71975
71976
71977
71978
71979
71980
71981
71982
71983
71984
71985
71986
71987
71988
71989
71990
71991
71992
71993
71994
71995
71996
71997
71998
71999
72000
72001
72002
72003
72004
72005
72006
72007
72008
72009
72010
72011
72012
72013
72014
72015
72016
72017
72018
72019
72020
72021
72022
72023
72024
72025
72026
72027
72028
72029
72030
72031
72032
72033
72034
72035
72036
72037
72038
72039
72040
72041
72042
72043
72044
72045
72046
72047
72048
72049
72050
72051
72052
72053
72054
72055
72056
72057
72058
72059
72060
72061
72062
72063
72064
72065
72066
72067
72068
72069
72070
72071
72072
72073
72074
72075
72076
72077
72078
72079
72080
72081
72082
72083
72084
72085
72086
72087
72088
72089
72090
72091
72092
72093
72094
72095
72096
72097
72098
72099
72100
72101
72102
72103
72104
72105
72106
72107
72108
72109
72110
72111
72112
72113
72114
72115
72116
72117
72118
72119
72120
72121
72122
72123
72124
72125
72126
72127
72128
72129
72130
72131
72132
72133
72134
72135
72136
72137
72138
72139
72140
72141
72142
72143
72144
72145
72146
72147
72148
72149
72150
72151
72152
72153
72154
72155
72156
72157
72158
72159
72160
72161
72162
72163
72164
72165
72166
72167
72168
72169
72170
72171
72172
72173
72174
72175
72176
72177
72178
72179
72180
72181
72182
72183
72184
72185
72186
72187
72188
72189
72190
72191
72192
72193
72194
72195
72196
72197
72198
72199
72200
72201
72202
72203
72204
72205
72206
72207
72208
72209
72210
72211
72212
72213
72214
72215
72216
72217
72218
72219
72220
72221
72222
72223
72224
72225
72226
72227
72228
72229
72230
72231
72232
72233
72234
72235
72236
72237
72238
72239
72240
72241
72242
72243
72244
72245
72246
72247
72248
72249
72250
72251
72252
72253
72254
72255
72256
72257
72258
72259
72260
72261
72262
72263
72264
72265
72266
72267
72268
72269
72270
72271
72272
72273
72274
72275
72276
72277
72278
72279
72280
72281
72282
72283
72284
72285
72286
72287
72288
72289
72290
72291
72292
72293
72294
72295
72296
72297
72298
72299
72300
72301
72302
72303
72304
72305
72306
72307
72308
72309
72310
72311
72312
72313
72314
72315
72316
72317
72318
72319
72320
72321
72322
72323
72324
72325
72326
72327
72328
72329
72330
72331
72332
72333
72334
72335
72336
72337
72338
72339
72340
72341
72342
72343
72344
72345
72346
72347
72348
72349
72350
72351
72352
72353
72354
72355
72356
72357
72358
72359
72360
72361
72362
72363
72364
72365
72366
72367
72368
72369
72370
72371
72372
72373
72374
72375
72376
72377
72378
72379
72380
72381
72382
72383
72384
72385
72386
72387
72388
72389
72390
72391
72392
72393
72394
72395
72396
72397
72398
72399
72400
72401
72402
72403
72404
72405
72406
72407
72408
72409
72410
72411
72412
72413
72414
72415
72416
72417
72418
72419
72420
72421
72422
72423
72424
72425
72426
72427
72428
72429
72430
72431
72432
72433
72434
72435
72436
72437
72438
72439
72440
72441
72442
72443
72444
72445
72446
72447
72448
72449
72450
72451
72452
72453
72454
72455
72456
72457
72458
72459
72460
72461
72462
72463
72464
72465
72466
72467
72468
72469
72470
72471
72472
72473
72474
72475
72476
72477
72478
72479
72480
72481
72482
72483
72484
72485
72486
72487
72488
72489
72490
72491
72492
72493
72494
72495
72496
72497
72498
72499
72500
72501
72502
72503
72504
72505
72506
72507
72508
72509
72510
72511
72512
72513
72514
72515
72516
72517
72518
72519
72520
72521
72522
72523
72524
72525
72526
72527
72528
72529
72530
72531
72532
72533
72534
72535
72536
72537
72538
72539
72540
72541
72542
72543
72544
72545
72546
72547
72548
72549
72550
72551
72552
72553
72554
72555
72556
72557
72558
72559
72560
72561
72562
72563
72564
72565
72566
72567
72568
72569
72570
72571
72572
72573
72574
72575
72576
72577
72578
72579
72580
72581
72582
72583
72584
72585
72586
72587
72588
72589
72590
72591
72592
72593
72594
72595
72596
72597
72598
72599
72600
72601
72602
72603
72604
72605
72606
72607
72608
72609
72610
72611
72612
72613
72614
72615
72616
72617
72618
72619
72620
72621
72622
72623
72624
72625
72626
72627
72628
72629
72630
72631
72632
72633
72634
72635
72636
72637
72638
72639
72640
72641
72642
72643
72644
72645
72646
72647
72648
72649
72650
72651
72652
72653
72654
72655
72656
72657
72658
72659
72660
72661
72662
72663
72664
72665
72666
72667
72668
72669
72670
72671
72672
72673
72674
72675
72676
72677
72678
72679
72680
72681
72682
72683
72684
72685
72686
72687
72688
72689
72690
72691
72692
72693
72694
72695
72696
72697
72698
72699
72700
72701
72702
72703
72704
72705
72706
72707
72708
72709
72710
72711
72712
72713
72714
72715
72716
72717
72718
72719
72720
72721
72722
72723
72724
72725
72726
72727
72728
72729
72730
72731
72732
72733
72734
72735
72736
72737
72738
72739
72740
72741
72742
72743
72744
72745
72746
72747
72748
72749
72750
72751
72752
72753
72754
72755
72756
72757
72758
72759
72760
72761
72762
72763
72764
72765
72766
72767
72768
72769
72770
72771
72772
72773
72774
72775
72776
72777
72778
72779
72780
72781
72782
72783
72784
72785
72786
72787
72788
72789
72790
72791
72792
72793
72794
72795
72796
72797
72798
72799
72800
72801
72802
72803
72804
72805
72806
72807
72808
72809
72810
72811
72812
72813
72814
72815
72816
72817
72818
72819
72820
72821
72822
72823
72824
72825
72826
72827
72828
72829
72830
72831
72832
72833
72834
72835
72836
72837
72838
72839
72840
72841
72842
72843
72844
72845
72846
72847
72848
72849
72850
72851
72852
72853
72854
72855
72856
72857
72858
72859
72860
72861
72862
72863
72864
72865
72866
72867
72868
72869
72870
72871
72872
72873
72874
72875
72876
72877
72878
72879
72880
72881
72882
72883
72884
72885
72886
72887
72888
72889
72890
72891
72892
72893
72894
72895
72896
72897
72898
72899
72900
72901
72902
72903
72904
72905
72906
72907
72908
72909
72910
72911
72912
72913
72914
72915
72916
72917
72918
72919
72920
72921
72922
72923
72924
72925
72926
72927
72928
72929
72930
72931
72932
72933
72934
72935
72936
72937
72938
72939
72940
72941
72942
72943
72944
72945
72946
72947
72948
72949
72950
72951
72952
72953
72954
72955
72956
72957
72958
72959
72960
72961
72962
72963
72964
72965
72966
72967
72968
72969
72970
72971
72972
72973
72974
72975
72976
72977
72978
72979
72980
72981
72982
72983
72984
72985
72986
72987
72988
72989
72990
72991
72992
72993
72994
72995
72996
72997
72998
72999
73000
73001
73002
73003
73004
73005
73006
73007
73008
73009
73010
73011
73012
73013
73014
73015
73016
73017
73018
73019
73020
73021
73022
73023
73024
73025
73026
73027
73028
73029
73030
73031
73032
73033
73034
73035
73036
73037
73038
73039
73040
73041
73042
73043
73044
73045
73046
73047
73048
73049
73050
73051
73052
73053
73054
73055
73056
73057
73058
73059
73060
73061
73062
73063
73064
73065
73066
73067
73068
73069
73070
73071
73072
73073
73074
73075
73076
73077
73078
73079
73080
73081
73082
73083
73084
73085
73086
73087
73088
73089
73090
73091
73092
73093
73094
73095
73096
73097
73098
73099
73100
73101
73102
73103
73104
73105
73106
73107
73108
73109
73110
73111
73112
73113
73114
73115
73116
73117
73118
73119
73120
73121
73122
73123
73124
73125
73126
73127
73128
73129
73130
73131
73132
73133
73134
73135
73136
73137
73138
73139
73140
73141
73142
73143
73144
73145
73146
73147
73148
73149
73150
73151
73152
73153
73154
73155
73156
73157
73158
73159
73160
73161
73162
73163
73164
73165
73166
73167
73168
73169
73170
73171
73172
73173
73174
73175
73176
73177
73178
73179
73180
73181
73182
73183
73184
73185
73186
73187
73188
73189
73190
73191
73192
73193
73194
73195
73196
73197
73198
73199
73200
73201
73202
73203
73204
73205
73206
73207
73208
73209
73210
73211
73212
73213
73214
73215
73216
73217
73218
73219
73220
73221
73222
73223
73224
73225
73226
73227
73228
73229
73230
73231
73232
73233
73234
73235
73236
73237
73238
73239
73240
73241
73242
73243
73244
73245
73246
73247
73248
73249
73250
73251
73252
73253
73254
73255
73256
73257
73258
73259
73260
73261
73262
73263
73264
73265
73266
73267
73268
73269
73270
73271
73272
73273
73274
73275
73276
73277
73278
73279
73280
73281
73282
73283
73284
73285
73286
73287
73288
73289
73290
73291
73292
73293
73294
73295
73296
73297
73298
73299
73300
73301
73302
73303
73304
73305
73306
73307
73308
73309
73310
73311
73312
73313
73314
73315
73316
73317
73318
73319
73320
73321
73322
73323
73324
73325
73326
73327
73328
73329
73330
73331
73332
73333
73334
73335
73336
73337
73338
73339
73340
73341
73342
73343
73344
73345
73346
73347
73348
73349
73350
73351
73352
73353
73354
73355
73356
73357
73358
73359
73360
73361
73362
73363
73364
73365
73366
73367
73368
73369
73370
73371
73372
73373
73374
73375
73376
73377
73378
73379
73380
73381
73382
73383
73384
73385
73386
73387
73388
73389
73390
73391
73392
73393
73394
73395
73396
73397
73398
73399
73400
73401
73402
73403
73404
73405
73406
73407
73408
73409
73410
73411
73412
73413
73414
73415
73416
73417
73418
73419
73420
73421
73422
73423
73424
73425
73426
73427
73428
73429
73430
73431
73432
73433
73434
73435
73436
73437
73438
73439
73440
73441
73442
73443
73444
73445
73446
73447
73448
73449
73450
73451
73452
73453
73454
73455
73456
73457
73458
73459
73460
73461
73462
73463
73464
73465
73466
73467
73468
73469
73470
73471
73472
73473
73474
73475
73476
73477
73478
73479
73480
73481
73482
73483
73484
73485
73486
73487
73488
73489
73490
73491
73492
73493
73494
73495
73496
73497
73498
73499
73500
73501
73502
73503
73504
73505
73506
73507
73508
73509
73510
73511
73512
73513
73514
73515
73516
73517
73518
73519
73520
73521
73522
73523
73524
73525
73526
73527
73528
73529
73530
73531
73532
73533
73534
73535
73536
73537
73538
73539
73540
73541
73542
73543
73544
73545
73546
73547
73548
73549
73550
73551
73552
73553
73554
73555
73556
73557
73558
73559
73560
73561
73562
73563
73564
73565
73566
73567
73568
73569
73570
73571
73572
73573
73574
73575
73576
73577
73578
73579
73580
73581
73582
73583
73584
73585
73586
73587
73588
73589
73590
73591
73592
73593
73594
73595
73596
73597
73598
73599
73600
73601
73602
73603
73604
73605
73606
73607
73608
73609
73610
73611
73612
73613
73614
73615
73616
73617
73618
73619
73620
73621
73622
73623
73624
73625
73626
73627
73628
73629
73630
73631
73632
73633
73634
73635
73636
73637
73638
73639
73640
73641
73642
73643
73644
73645
73646
73647
73648
73649
73650
73651
73652
73653
73654
73655
73656
73657
73658
73659
73660
73661
73662
73663
73664
73665
73666
73667
73668
73669
73670
73671
73672
73673
73674
73675
73676
73677
73678
73679
73680
73681
73682
73683
73684
73685
73686
73687
73688
73689
73690
73691
73692
73693
73694
73695
73696
73697
73698
73699
73700
73701
73702
73703
73704
73705
73706
73707
73708
73709
73710
73711
73712
73713
73714
73715
73716
73717
73718
73719
73720
73721
73722
73723
73724
73725
73726
73727
73728
73729
73730
73731
73732
73733
73734
73735
73736
73737
73738
73739
73740
73741
73742
73743
73744
73745
73746
73747
73748
73749
73750
73751
73752
73753
73754
73755
73756
73757
73758
73759
73760
73761
73762
73763
73764
73765
73766
73767
73768
73769
73770
73771
73772
73773
73774
73775
73776
73777
73778
73779
73780
73781
73782
73783
73784
73785
73786
73787
73788
73789
73790
73791
73792
73793
73794
73795
73796
73797
73798
73799
73800
73801
73802
73803
73804
73805
73806
73807
73808
73809
73810
73811
73812
73813
73814
73815
73816
73817
73818
73819
73820
73821
73822
73823
73824
73825
73826
73827
73828
73829
73830
73831
73832
73833
73834
73835
73836
73837
73838
73839
73840
73841
73842
73843
73844
73845
73846
73847
73848
73849
73850
73851
73852
73853
73854
73855
73856
73857
73858
73859
73860
73861
73862
73863
73864
73865
73866
73867
73868
73869
73870
73871
73872
73873
73874
73875
73876
73877
73878
73879
73880
73881
73882
73883
73884
73885
73886
73887
73888
73889
73890
73891
73892
73893
73894
73895
73896
73897
73898
73899
73900
73901
73902
73903
73904
73905
73906
73907
73908
73909
73910
73911
73912
73913
73914
73915
73916
73917
73918
73919
73920
73921
73922
73923
73924
73925
73926
73927
73928
73929
73930
73931
73932
73933
73934
73935
73936
73937
73938
73939
73940
73941
73942
73943
73944
73945
73946
73947
73948
73949
73950
73951
73952
73953
73954
73955
73956
73957
73958
73959
73960
73961
73962
73963
73964
73965
73966
73967
73968
73969
73970
73971
73972
73973
73974
73975
73976
73977
73978
73979
73980
73981
73982
73983
73984
73985
73986
73987
73988
73989
73990
73991
73992
73993
73994
73995
73996
73997
73998
73999
74000
74001
74002
74003
74004
74005
74006
74007
74008
74009
74010
74011
74012
74013
74014
74015
74016
74017
74018
74019
74020
74021
74022
74023
74024
74025
74026
74027
74028
74029
74030
74031
74032
74033
74034
74035
74036
74037
74038
74039
74040
74041
74042
74043
74044
74045
74046
74047
74048
74049
74050
74051
74052
74053
74054
74055
74056
74057
74058
74059
74060
74061
74062
74063
74064
74065
74066
74067
74068
74069
74070
74071
74072
74073
74074
74075
74076
74077
74078
74079
74080
74081
74082
74083
74084
74085
74086
74087
74088
74089
74090
74091
74092
74093
74094
74095
74096
74097
74098
74099
74100
74101
74102
74103
74104
74105
74106
74107
74108
74109
74110
74111
74112
74113
74114
74115
74116
74117
74118
74119
74120
74121
74122
74123
74124
74125
74126
74127
74128
74129
74130
74131
74132
74133
74134
74135
74136
74137
74138
74139
74140
74141
74142
74143
74144
74145
74146
74147
74148
74149
74150
74151
74152
74153
74154
74155
74156
74157
74158
74159
74160
74161
74162
74163
74164
74165
74166
74167
74168
74169
74170
74171
74172
74173
74174
74175
74176
74177
74178
74179
74180
74181
74182
74183
74184
74185
74186
74187
74188
74189
74190
74191
74192
74193
74194
74195
74196
74197
74198
74199
74200
74201
74202
74203
74204
74205
74206
74207
74208
74209
74210
74211
74212
74213
74214
74215
74216
74217
74218
74219
74220
74221
74222
74223
74224
74225
74226
74227
74228
74229
74230
74231
74232
74233
74234
74235
74236
74237
74238
74239
74240
74241
74242
74243
74244
74245
74246
74247
74248
74249
74250
74251
74252
74253
74254
74255
74256
74257
74258
74259
74260
74261
74262
74263
74264
74265
74266
74267
74268
74269
74270
74271
74272
74273
74274
74275
74276
74277
74278
74279
74280
74281
74282
74283
74284
74285
74286
74287
74288
74289
74290
74291
74292
74293
74294
74295
74296
74297
74298
74299
74300
74301
74302
74303
74304
74305
74306
74307
74308
74309
74310
74311
74312
74313
74314
74315
74316
74317
74318
74319
74320
74321
74322
74323
74324
74325
74326
74327
74328
74329
74330
74331
74332
74333
74334
74335
74336
74337
74338
74339
74340
74341
74342
74343
74344
74345
74346
74347
74348
74349
74350
74351
74352
74353
74354
74355
74356
74357
74358
74359
74360
74361
74362
74363
74364
74365
74366
74367
74368
74369
74370
74371
74372
74373
74374
74375
74376
74377
74378
74379
74380
74381
74382
74383
74384
74385
74386
74387
74388
74389
74390
74391
74392
74393
74394
74395
74396
74397
74398
74399
74400
74401
74402
74403
74404
74405
74406
74407
74408
74409
74410
74411
74412
74413
74414
74415
74416
74417
74418
74419
74420
74421
74422
74423
74424
74425
74426
74427
74428
74429
74430
74431
74432
74433
74434
74435
74436
74437
74438
74439
74440
74441
74442
74443
74444
74445
74446
74447
74448
74449
74450
74451
74452
74453
74454
74455
74456
74457
74458
74459
74460
74461
74462
74463
74464
74465
74466
74467
74468
74469
74470
74471
74472
74473
74474
74475
74476
74477
74478
74479
74480
74481
74482
74483
74484
74485
74486
74487
74488
74489
74490
74491
74492
74493
74494
74495
74496
74497
74498
74499
74500
74501
74502
74503
74504
74505
74506
74507
74508
74509
74510
74511
74512
74513
74514
74515
74516
74517
74518
74519
74520
74521
74522
74523
74524
74525
74526
74527
74528
74529
74530
74531
74532
74533
74534
74535
74536
74537
74538
74539
74540
74541
74542
74543
74544
74545
74546
74547
74548
74549
74550
74551
74552
74553
74554
74555
74556
74557
74558
74559
74560
74561
74562
74563
74564
74565
74566
74567
74568
74569
74570
74571
74572
74573
74574
74575
74576
74577
74578
74579
74580
74581
74582
74583
74584
74585
74586
74587
74588
74589
74590
74591
74592
74593
74594
74595
74596
74597
74598
74599
74600
74601
74602
74603
74604
74605
74606
74607
74608
74609
74610
74611
74612
74613
74614
74615
74616
74617
74618
74619
74620
74621
74622
74623
74624
74625
74626
74627
74628
74629
74630
74631
74632
74633
74634
74635
74636
74637
74638
74639
74640
74641
74642
74643
74644
74645
74646
74647
74648
74649
74650
74651
74652
74653
74654
74655
74656
74657
74658
74659
74660
74661
74662
74663
74664
74665
74666
74667
74668
74669
74670
74671
74672
74673
74674
74675
74676
74677
74678
74679
74680
74681
74682
74683
74684
74685
74686
74687
74688
74689
74690
74691
74692
74693
74694
74695
74696
74697
74698
74699
74700
74701
74702
74703
74704
74705
74706
74707
74708
74709
74710
74711
74712
74713
74714
74715
74716
74717
74718
74719
74720
74721
74722
74723
74724
74725
74726
74727
74728
74729
74730
74731
74732
74733
74734
74735
74736
74737
74738
74739
74740
74741
74742
74743
74744
74745
74746
74747
74748
74749
74750
74751
74752
74753
74754
74755
74756
74757
74758
74759
74760
74761
74762
74763
74764
74765
74766
74767
74768
74769
74770
74771
74772
74773
74774
74775
74776
74777
74778
74779
74780
74781
74782
74783
74784
74785
74786
74787
74788
74789
74790
74791
74792
74793
74794
74795
74796
74797
74798
74799
74800
74801
74802
74803
74804
74805
74806
74807
74808
74809
74810
74811
74812
74813
74814
74815
74816
74817
74818
74819
74820
74821
74822
74823
74824
74825
74826
74827
74828
74829
74830
74831
74832
74833
74834
74835
74836
74837
74838
74839
74840
74841
74842
74843
74844
74845
74846
74847
74848
74849
74850
74851
74852
74853
74854
74855
74856
74857
74858
74859
74860
74861
74862
74863
74864
74865
74866
74867
74868
74869
74870
74871
74872
74873
74874
74875
74876
74877
74878
74879
74880
74881
74882
74883
74884
74885
74886
74887
74888
74889
74890
74891
74892
74893
74894
74895
74896
74897
74898
74899
74900
74901
74902
74903
74904
74905
74906
74907
74908
74909
74910
74911
74912
74913
74914
74915
74916
74917
74918
74919
74920
74921
74922
74923
74924
74925
74926
74927
74928
74929
74930
74931
74932
74933
74934
74935
74936
74937
74938
74939
74940
74941
74942
74943
74944
74945
74946
74947
74948
74949
74950
74951
74952
74953
74954
74955
74956
74957
74958
74959
74960
74961
74962
74963
74964
74965
74966
74967
74968
74969
74970
74971
74972
74973
74974
74975
74976
74977
74978
74979
74980
74981
74982
74983
74984
74985
74986
74987
74988
74989
74990
74991
74992
74993
74994
74995
74996
74997
74998
74999
75000
75001
75002
75003
75004
75005
75006
75007
75008
75009
75010
75011
75012
75013
75014
75015
75016
75017
75018
75019
75020
75021
75022
75023
75024
75025
75026
75027
75028
75029
75030
75031
75032
75033
75034
75035
75036
75037
75038
75039
75040
75041
75042
75043
75044
75045
75046
75047
75048
75049
75050
75051
75052
75053
75054
75055
75056
75057
75058
75059
75060
75061
75062
75063
75064
75065
75066
75067
75068
75069
75070
75071
75072
75073
75074
75075
75076
75077
75078
75079
75080
75081
75082
75083
75084
75085
75086
75087
75088
75089
75090
75091
75092
75093
75094
75095
75096
75097
75098
75099
75100
75101
75102
75103
75104
75105
75106
75107
75108
75109
75110
75111
75112
75113
75114
75115
75116
75117
75118
75119
75120
75121
75122
75123
75124
75125
75126
75127
75128
75129
75130
75131
75132
75133
75134
75135
75136
75137
75138
75139
75140
75141
75142
75143
75144
75145
75146
75147
75148
75149
75150
75151
75152
75153
75154
75155
75156
75157
75158
75159
75160
75161
75162
75163
75164
75165
75166
75167
75168
75169
75170
75171
75172
75173
75174
75175
75176
75177
75178
75179
75180
75181
75182
75183
75184
75185
75186
75187
75188
75189
75190
75191
75192
75193
75194
75195
75196
75197
75198
75199
75200
75201
75202
75203
75204
75205
75206
75207
75208
75209
75210
75211
75212
75213
75214
75215
75216
75217
75218
75219
75220
75221
75222
75223
75224
75225
75226
75227
75228
75229
75230
75231
75232
75233
75234
75235
75236
75237
75238
75239
75240
75241
75242
75243
75244
75245
75246
75247
75248
75249
75250
75251
75252
75253
75254
75255
75256
75257
75258
75259
75260
75261
75262
75263
75264
75265
75266
75267
75268
75269
75270
75271
75272
75273
75274
75275
75276
75277
75278
75279
75280
75281
75282
75283
75284
75285
75286
75287
75288
75289
75290
75291
75292
75293
75294
75295
75296
75297
75298
75299
75300
75301
75302
75303
75304
75305
75306
75307
75308
75309
75310
75311
75312
75313
75314
75315
75316
75317
75318
75319
75320
75321
75322
75323
75324
75325
75326
75327
75328
75329
75330
75331
75332
75333
75334
75335
75336
75337
75338
75339
75340
75341
75342
75343
75344
75345
75346
75347
75348
75349
75350
75351
75352
75353
75354
75355
75356
75357
75358
75359
75360
75361
75362
75363
75364
75365
75366
75367
75368
75369
75370
75371
75372
75373
75374
75375
75376
75377
75378
75379
75380
75381
75382
75383
75384
75385
75386
75387
75388
75389
75390
75391
75392
75393
75394
75395
75396
75397
75398
75399
75400
75401
75402
75403
75404
75405
75406
75407
75408
75409
75410
75411
75412
75413
75414
75415
75416
75417
75418
75419
75420
75421
75422
75423
75424
75425
75426
75427
75428
75429
75430
75431
75432
75433
75434
75435
75436
75437
75438
75439
75440
75441
75442
75443
75444
75445
75446
75447
75448
75449
75450
75451
75452
75453
75454
75455
75456
75457
75458
75459
75460
75461
75462
75463
75464
75465
75466
75467
75468
75469
75470
75471
75472
75473
75474
75475
75476
75477
75478
75479
75480
75481
75482
75483
75484
75485
75486
75487
75488
75489
75490
75491
75492
75493
75494
75495
75496
75497
75498
75499
75500
75501
75502
75503
75504
75505
75506
75507
75508
75509
75510
75511
75512
75513
75514
75515
75516
75517
75518
75519
75520
75521
75522
75523
75524
75525
75526
75527
75528
75529
75530
75531
75532
75533
75534
75535
75536
75537
75538
75539
75540
75541
75542
75543
75544
75545
75546
75547
75548
75549
75550
75551
75552
75553
75554
75555
75556
75557
75558
75559
75560
75561
75562
75563
75564
75565
75566
75567
75568
75569
75570
75571
75572
75573
75574
75575
75576
75577
75578
75579
75580
75581
75582
75583
75584
75585
75586
75587
75588
75589
75590
75591
75592
75593
75594
75595
75596
75597
75598
75599
75600
75601
75602
75603
75604
75605
75606
75607
75608
75609
75610
75611
75612
75613
75614
75615
75616
75617
75618
75619
75620
75621
75622
75623
75624
75625
75626
75627
75628
75629
75630
75631
75632
75633
75634
75635
75636
75637
75638
75639
75640
75641
75642
75643
75644
75645
75646
75647
75648
75649
75650
75651
75652
75653
75654
75655
75656
75657
75658
75659
75660
75661
75662
75663
75664
75665
75666
75667
75668
75669
75670
75671
75672
75673
75674
75675
75676
75677
75678
75679
75680
75681
75682
75683
75684
75685
75686
75687
75688
75689
75690
75691
75692
75693
75694
75695
75696
75697
75698
75699
75700
75701
75702
75703
75704
75705
75706
75707
75708
75709
75710
75711
75712
75713
75714
75715
75716
75717
75718
75719
75720
75721
75722
75723
75724
75725
75726
75727
75728
75729
75730
75731
75732
75733
75734
75735
75736
75737
75738
75739
75740
75741
75742
75743
75744
75745
75746
75747
75748
75749
75750
75751
75752
75753
75754
75755
75756
75757
75758
75759
75760
75761
75762
75763
75764
75765
75766
75767
75768
75769
75770
75771
75772
75773
75774
75775
75776
75777
75778
75779
75780
75781
75782
75783
75784
75785
75786
75787
75788
75789
75790
75791
75792
75793
75794
75795
75796
75797
75798
75799
75800
75801
75802
75803
75804
75805
75806
75807
75808
75809
75810
75811
75812
75813
75814
75815
75816
75817
75818
75819
75820
75821
75822
75823
75824
75825
75826
75827
75828
75829
75830
75831
75832
75833
75834
75835
75836
75837
75838
75839
75840
75841
75842
75843
75844
75845
75846
75847
75848
75849
75850
75851
75852
75853
75854
75855
75856
75857
75858
75859
75860
75861
75862
75863
75864
75865
75866
75867
75868
75869
75870
75871
75872
75873
75874
75875
75876
75877
75878
75879
75880
75881
75882
75883
75884
75885
75886
75887
75888
75889
75890
75891
75892
75893
75894
75895
75896
75897
75898
75899
75900
75901
75902
75903
75904
75905
75906
75907
75908
75909
75910
75911
75912
75913
75914
75915
75916
75917
75918
75919
75920
75921
75922
75923
75924
75925
75926
75927
75928
75929
75930
75931
75932
75933
75934
75935
75936
75937
75938
75939
75940
75941
75942
75943
75944
75945
75946
75947
75948
75949
75950
75951
75952
75953
75954
75955
75956
75957
75958
75959
75960
75961
75962
75963
75964
75965
75966
75967
75968
75969
75970
75971
75972
75973
75974
75975
75976
75977
75978
75979
75980
75981
75982
75983
75984
75985
75986
75987
75988
75989
75990
75991
75992
75993
75994
75995
75996
75997
75998
75999
76000
76001
76002
76003
76004
76005
76006
76007
76008
76009
76010
76011
76012
76013
76014
76015
76016
76017
76018
76019
76020
76021
76022
76023
76024
76025
76026
76027
76028
76029
76030
76031
76032
76033
76034
76035
76036
76037
76038
76039
76040
76041
76042
76043
76044
76045
76046
76047
76048
76049
76050
76051
76052
76053
76054
76055
76056
76057
76058
76059
76060
76061
76062
76063
76064
76065
76066
76067
76068
76069
76070
76071
76072
76073
76074
76075
76076
76077
76078
76079
76080
76081
76082
76083
76084
76085
76086
76087
76088
76089
76090
76091
76092
76093
76094
76095
76096
76097
76098
76099
76100
76101
76102
76103
76104
76105
76106
76107
76108
76109
76110
76111
76112
76113
76114
76115
76116
76117
76118
76119
76120
76121
76122
76123
76124
76125
76126
76127
76128
76129
76130
76131
76132
76133
76134
76135
76136
76137
76138
76139
76140
76141
76142
76143
76144
76145
76146
76147
76148
76149
76150
76151
76152
76153
76154
76155
76156
76157
76158
76159
76160
76161
76162
76163
76164
76165
76166
76167
76168
76169
76170
76171
76172
76173
76174
76175
76176
76177
76178
76179
76180
76181
76182
76183
76184
76185
76186
76187
76188
76189
76190
76191
76192
76193
76194
76195
76196
76197
76198
76199
76200
76201
76202
76203
76204
76205
76206
76207
76208
76209
76210
76211
76212
76213
76214
76215
76216
76217
76218
76219
76220
76221
76222
76223
76224
76225
76226
76227
76228
76229
76230
76231
76232
76233
76234
76235
76236
76237
76238
76239
76240
76241
76242
76243
76244
76245
76246
76247
76248
76249
76250
76251
76252
76253
76254
76255
76256
76257
76258
76259
76260
76261
76262
76263
76264
76265
76266
76267
76268
76269
76270
76271
76272
76273
76274
76275
76276
76277
76278
76279
76280
76281
76282
76283
76284
76285
76286
76287
76288
76289
76290
76291
76292
76293
76294
76295
76296
76297
76298
76299
76300
76301
76302
76303
76304
76305
76306
76307
76308
76309
76310
76311
76312
76313
76314
76315
76316
76317
76318
76319
76320
76321
76322
76323
76324
76325
76326
76327
76328
76329
76330
76331
76332
76333
76334
76335
76336
76337
76338
76339
76340
76341
76342
76343
76344
76345
76346
76347
76348
76349
76350
76351
76352
76353
76354
76355
76356
76357
76358
76359
76360
76361
76362
76363
76364
76365
76366
76367
76368
76369
76370
76371
76372
76373
76374
76375
76376
76377
76378
76379
76380
76381
76382
76383
76384
76385
76386
76387
76388
76389
76390
76391
76392
76393
76394
76395
76396
76397
76398
76399
76400
76401
76402
76403
76404
76405
76406
76407
76408
76409
76410
76411
76412
76413
76414
76415
76416
76417
76418
76419
76420
76421
76422
76423
76424
76425
76426
76427
76428
76429
76430
76431
76432
76433
76434
76435
76436
76437
76438
76439
76440
76441
76442
76443
76444
76445
76446
76447
76448
76449
76450
76451
76452
76453
76454
76455
76456
76457
76458
76459
76460
76461
76462
76463
76464
76465
76466
76467
76468
76469
76470
76471
76472
76473
76474
76475
76476
76477
76478
76479
76480
76481
76482
76483
76484
76485
76486
76487
76488
76489
76490
76491
76492
76493
76494
76495
76496
76497
76498
76499
76500
76501
76502
76503
76504
76505
76506
76507
76508
76509
76510
76511
76512
76513
76514
76515
76516
76517
76518
76519
76520
76521
76522
76523
76524
76525
76526
76527
76528
76529
76530
76531
76532
76533
76534
76535
76536
76537
76538
76539
76540
76541
76542
76543
76544
76545
76546
76547
76548
76549
76550
76551
76552
76553
76554
76555
76556
76557
76558
76559
76560
76561
76562
76563
76564
76565
76566
76567
76568
76569
76570
76571
76572
76573
76574
76575
76576
76577
76578
76579
76580
76581
76582
76583
76584
76585
76586
76587
76588
76589
76590
76591
76592
76593
76594
76595
76596
76597
76598
76599
76600
76601
76602
76603
76604
76605
76606
76607
76608
76609
76610
76611
76612
76613
76614
76615
76616
76617
76618
76619
76620
76621
76622
76623
76624
76625
76626
76627
76628
76629
76630
76631
76632
76633
76634
76635
76636
76637
76638
76639
76640
76641
76642
76643
76644
76645
76646
76647
76648
76649
76650
76651
76652
76653
76654
76655
76656
76657
76658
76659
76660
76661
76662
76663
76664
76665
76666
76667
76668
76669
76670
76671
76672
76673
76674
76675
76676
76677
76678
76679
76680
76681
76682
76683
76684
76685
76686
76687
76688
76689
76690
76691
76692
76693
76694
76695
76696
76697
76698
76699
76700
76701
76702
76703
76704
76705
76706
76707
76708
76709
76710
76711
76712
76713
76714
76715
76716
76717
76718
76719
76720
76721
76722
76723
76724
76725
76726
76727
76728
76729
76730
76731
76732
76733
76734
76735
76736
76737
76738
76739
76740
76741
76742
76743
76744
76745
76746
76747
76748
76749
76750
76751
76752
76753
76754
76755
76756
76757
76758
76759
76760
76761
76762
76763
76764
76765
76766
76767
76768
76769
76770
76771
76772
76773
76774
76775
76776
76777
76778
76779
76780
76781
76782
76783
76784
76785
76786
76787
76788
76789
76790
76791
76792
76793
76794
76795
76796
76797
76798
76799
76800
76801
76802
76803
76804
76805
76806
76807
76808
76809
76810
76811
76812
76813
76814
76815
76816
76817
76818
76819
76820
76821
76822
76823
76824
76825
76826
76827
76828
76829
76830
76831
76832
76833
76834
76835
76836
76837
76838
76839
76840
76841
76842
76843
76844
76845
76846
76847
76848
76849
76850
76851
76852
76853
76854
76855
76856
76857
76858
76859
76860
76861
76862
76863
76864
76865
76866
76867
76868
76869
76870
76871
76872
76873
76874
76875
76876
76877
76878
76879
76880
76881
76882
76883
76884
76885
76886
76887
76888
76889
76890
76891
76892
76893
76894
76895
76896
76897
76898
76899
76900
76901
76902
76903
76904
76905
76906
76907
76908
76909
76910
76911
76912
76913
76914
76915
76916
76917
76918
76919
76920
76921
76922
76923
76924
76925
76926
76927
76928
76929
76930
76931
76932
76933
76934
76935
76936
76937
76938
76939
76940
76941
76942
76943
76944
76945
76946
76947
76948
76949
76950
76951
76952
76953
76954
76955
76956
76957
76958
76959
76960
76961
76962
76963
76964
76965
76966
76967
76968
76969
76970
76971
76972
76973
76974
76975
76976
76977
76978
76979
76980
76981
76982
76983
76984
76985
76986
76987
76988
76989
76990
76991
76992
76993
76994
76995
76996
76997
76998
76999
77000
77001
77002
77003
77004
77005
77006
77007
77008
77009
77010
77011
77012
77013
77014
77015
77016
77017
77018
77019
77020
77021
77022
77023
77024
77025
77026
77027
77028
77029
77030
77031
77032
77033
77034
77035
77036
77037
77038
77039
77040
77041
77042
77043
77044
77045
77046
77047
77048
77049
77050
77051
77052
77053
77054
77055
77056
77057
77058
77059
77060
77061
77062
77063
77064
77065
77066
77067
77068
77069
77070
77071
77072
77073
77074
77075
77076
77077
77078
77079
77080
77081
77082
77083
77084
77085
77086
77087
77088
77089
77090
77091
77092
77093
77094
77095
77096
77097
77098
77099
77100
77101
77102
77103
77104
77105
77106
77107
77108
77109
77110
77111
77112
77113
77114
77115
77116
77117
77118
77119
77120
77121
77122
77123
77124
77125
77126
77127
77128
77129
77130
77131
77132
77133
77134
77135
77136
77137
77138
77139
77140
77141
77142
77143
77144
77145
77146
77147
77148
77149
77150
77151
77152
77153
77154
77155
77156
77157
77158
77159
77160
77161
77162
77163
77164
77165
77166
77167
77168
77169
77170
77171
77172
77173
77174
77175
77176
77177
77178
77179
77180
77181
77182
77183
77184
77185
77186
77187
77188
77189
77190
77191
77192
77193
77194
77195
77196
77197
77198
77199
77200
77201
77202
77203
77204
77205
77206
77207
77208
77209
77210
77211
77212
77213
77214
77215
77216
77217
77218
77219
77220
77221
77222
77223
77224
77225
77226
77227
77228
77229
77230
77231
77232
77233
77234
77235
77236
77237
77238
77239
77240
77241
77242
77243
77244
77245
77246
77247
77248
77249
77250
77251
77252
77253
77254
77255
77256
77257
77258
77259
77260
77261
77262
77263
77264
77265
77266
77267
77268
77269
77270
77271
77272
77273
77274
77275
77276
77277
77278
77279
77280
77281
77282
77283
77284
77285
77286
77287
77288
77289
77290
77291
77292
77293
77294
77295
77296
77297
77298
77299
77300
77301
77302
77303
77304
77305
77306
77307
77308
77309
77310
77311
77312
77313
77314
77315
77316
77317
77318
77319
77320
77321
77322
77323
77324
77325
77326
77327
77328
77329
77330
77331
77332
77333
77334
77335
77336
77337
77338
77339
77340
77341
77342
77343
77344
77345
77346
77347
77348
77349
77350
77351
77352
77353
77354
77355
77356
77357
77358
77359
77360
77361
77362
77363
77364
77365
77366
77367
77368
77369
77370
77371
77372
77373
77374
77375
77376
77377
77378
77379
77380
77381
77382
77383
77384
77385
77386
77387
77388
77389
77390
77391
77392
77393
77394
77395
77396
77397
77398
77399
77400
77401
77402
77403
77404
77405
77406
77407
77408
77409
77410
77411
77412
77413
77414
77415
77416
77417
77418
77419
77420
77421
77422
77423
77424
77425
77426
77427
77428
77429
77430
77431
77432
77433
77434
77435
77436
77437
77438
77439
77440
77441
77442
77443
77444
77445
77446
77447
77448
77449
77450
77451
77452
77453
77454
77455
77456
77457
77458
77459
77460
77461
77462
77463
77464
77465
77466
77467
77468
77469
77470
77471
77472
77473
77474
77475
77476
77477
77478
77479
77480
77481
77482
77483
77484
77485
77486
77487
77488
77489
77490
77491
77492
77493
77494
77495
77496
77497
77498
77499
77500
77501
77502
77503
77504
77505
77506
77507
77508
77509
77510
77511
77512
77513
77514
77515
77516
77517
77518
77519
77520
77521
77522
77523
77524
77525
77526
77527
77528
77529
77530
77531
77532
77533
77534
77535
77536
77537
77538
77539
77540
77541
77542
77543
77544
77545
77546
77547
77548
77549
77550
77551
77552
77553
77554
77555
77556
77557
77558
77559
77560
77561
77562
77563
77564
77565
77566
77567
77568
77569
77570
77571
77572
77573
77574
77575
77576
77577
77578
77579
77580
77581
77582
77583
77584
77585
77586
77587
77588
77589
77590
77591
77592
77593
77594
77595
77596
77597
77598
77599
77600
77601
77602
77603
77604
77605
77606
77607
77608
77609
77610
77611
77612
77613
77614
77615
77616
77617
77618
77619
77620
77621
77622
77623
77624
77625
77626
77627
77628
77629
77630
77631
77632
77633
77634
77635
77636
77637
77638
77639
77640
77641
77642
77643
77644
77645
77646
77647
77648
77649
77650
77651
77652
77653
77654
77655
77656
77657
77658
77659
77660
77661
77662
77663
77664
77665
77666
77667
77668
77669
77670
77671
77672
77673
77674
77675
77676
77677
77678
77679
77680
77681
77682
77683
77684
77685
77686
77687
77688
77689
77690
77691
77692
77693
77694
77695
77696
77697
77698
77699
77700
77701
77702
77703
77704
77705
77706
77707
77708
77709
77710
77711
77712
77713
77714
77715
77716
77717
77718
77719
77720
77721
77722
77723
77724
77725
77726
77727
77728
77729
77730
77731
77732
77733
77734
77735
77736
77737
77738
77739
77740
77741
77742
77743
77744
77745
77746
77747
77748
77749
77750
77751
77752
77753
77754
77755
77756
77757
77758
77759
77760
77761
77762
77763
77764
77765
77766
77767
77768
77769
77770
77771
77772
77773
77774
77775
77776
77777
77778
77779
77780
77781
77782
77783
77784
77785
77786
77787
77788
77789
77790
77791
77792
77793
77794
77795
77796
77797
77798
77799
77800
77801
77802
77803
77804
77805
77806
77807
77808
77809
77810
77811
77812
77813
77814
77815
77816
77817
77818
77819
77820
77821
77822
77823
77824
77825
77826
77827
77828
77829
77830
77831
77832
77833
77834
77835
77836
77837
77838
77839
77840
77841
77842
77843
77844
77845
77846
77847
77848
77849
77850
77851
77852
77853
77854
77855
77856
77857
77858
77859
77860
77861
77862
77863
77864
77865
77866
77867
77868
77869
77870
77871
77872
77873
77874
77875
77876
77877
77878
77879
77880
77881
77882
77883
77884
77885
77886
77887
77888
77889
77890
77891
77892
77893
77894
77895
77896
77897
77898
77899
77900
77901
77902
77903
77904
77905
77906
77907
77908
77909
77910
77911
77912
77913
77914
77915
77916
77917
77918
77919
77920
77921
77922
77923
77924
77925
77926
77927
77928
77929
77930
77931
77932
77933
77934
77935
77936
77937
77938
77939
77940
77941
77942
77943
77944
77945
77946
77947
77948
77949
77950
77951
77952
77953
77954
77955
77956
77957
77958
77959
77960
77961
77962
77963
77964
77965
77966
77967
77968
77969
77970
77971
77972
77973
77974
77975
77976
77977
77978
77979
77980
77981
77982
77983
77984
77985
77986
77987
77988
77989
77990
77991
77992
77993
77994
77995
77996
77997
77998
77999
78000
78001
78002
78003
78004
78005
78006
78007
78008
78009
78010
78011
78012
78013
78014
78015
78016
78017
78018
78019
78020
78021
78022
78023
78024
78025
78026
78027
78028
78029
78030
78031
78032
78033
78034
78035
78036
78037
78038
78039
78040
78041
78042
78043
78044
78045
78046
78047
78048
78049
78050
78051
78052
78053
78054
78055
78056
78057
78058
78059
78060
78061
78062
78063
78064
78065
78066
78067
78068
78069
78070
78071
78072
78073
78074
78075
78076
78077
78078
78079
78080
78081
78082
78083
78084
78085
78086
78087
78088
78089
78090
78091
78092
78093
78094
78095
78096
78097
78098
78099
78100
78101
78102
78103
78104
78105
78106
78107
78108
78109
78110
78111
78112
78113
78114
78115
78116
78117
78118
78119
78120
78121
78122
78123
78124
78125
78126
78127
78128
78129
78130
78131
78132
78133
78134
78135
78136
78137
78138
78139
78140
78141
78142
78143
78144
78145
78146
78147
78148
78149
78150
78151
78152
78153
78154
78155
78156
78157
78158
78159
78160
78161
78162
78163
78164
78165
78166
78167
78168
78169
78170
78171
78172
78173
78174
78175
78176
78177
78178
78179
78180
78181
78182
78183
78184
78185
78186
78187
78188
78189
78190
78191
78192
78193
78194
78195
78196
78197
78198
78199
78200
78201
78202
78203
78204
78205
78206
78207
78208
78209
78210
78211
78212
78213
78214
78215
78216
78217
78218
78219
78220
78221
78222
78223
78224
78225
78226
78227
78228
78229
78230
78231
78232
78233
78234
78235
78236
78237
78238
78239
78240
78241
78242
78243
78244
78245
78246
78247
78248
78249
78250
78251
78252
78253
78254
78255
78256
78257
78258
78259
78260
78261
78262
78263
78264
78265
78266
78267
78268
78269
78270
78271
78272
78273
78274
78275
78276
78277
78278
78279
78280
78281
78282
78283
78284
78285
78286
78287
78288
78289
78290
78291
78292
78293
78294
78295
78296
78297
78298
78299
78300
78301
78302
78303
78304
78305
78306
78307
78308
78309
78310
78311
78312
78313
78314
78315
78316
78317
78318
78319
78320
78321
78322
78323
78324
78325
78326
78327
78328
78329
78330
78331
78332
78333
78334
78335
78336
78337
78338
78339
78340
78341
78342
78343
78344
78345
78346
78347
78348
78349
78350
78351
78352
78353
78354
78355
78356
78357
78358
78359
78360
78361
78362
78363
78364
78365
78366
78367
78368
78369
78370
78371
78372
78373
78374
78375
78376
78377
78378
78379
78380
78381
78382
78383
78384
78385
78386
78387
78388
78389
78390
78391
78392
78393
78394
78395
78396
78397
78398
78399
78400
78401
78402
78403
78404
78405
78406
78407
78408
78409
78410
78411
78412
78413
78414
78415
78416
78417
78418
78419
78420
78421
78422
78423
78424
78425
78426
78427
78428
78429
78430
78431
78432
78433
78434
78435
78436
78437
78438
78439
78440
78441
78442
78443
78444
78445
78446
78447
78448
78449
78450
78451
78452
78453
78454
78455
78456
78457
78458
78459
78460
78461
78462
78463
78464
78465
78466
78467
78468
78469
78470
78471
78472
78473
78474
78475
78476
78477
78478
78479
78480
78481
78482
78483
78484
78485
78486
78487
78488
78489
78490
78491
78492
78493
78494
78495
78496
78497
78498
78499
78500
78501
78502
78503
78504
78505
78506
78507
78508
78509
78510
78511
78512
78513
78514
78515
78516
78517
78518
78519
78520
78521
78522
78523
78524
78525
78526
78527
78528
78529
78530
78531
78532
78533
78534
78535
78536
78537
78538
78539
78540
78541
78542
78543
78544
78545
78546
78547
78548
78549
78550
78551
78552
78553
78554
78555
78556
78557
78558
78559
78560
78561
78562
78563
78564
78565
78566
78567
78568
78569
78570
78571
78572
78573
78574
78575
78576
78577
78578
78579
78580
78581
78582
78583
78584
78585
78586
78587
78588
78589
78590
78591
78592
78593
78594
78595
78596
78597
78598
78599
78600
78601
78602
78603
78604
78605
78606
78607
78608
78609
78610
78611
78612
78613
78614
78615
78616
78617
78618
78619
78620
78621
78622
78623
78624
78625
78626
78627
78628
78629
78630
78631
78632
78633
78634
78635
78636
78637
78638
78639
78640
78641
78642
78643
78644
78645
78646
78647
78648
78649
78650
78651
78652
78653
78654
78655
78656
78657
78658
78659
78660
78661
78662
78663
78664
78665
78666
78667
78668
78669
78670
78671
78672
78673
78674
78675
78676
78677
78678
78679
78680
78681
78682
78683
78684
78685
78686
78687
78688
78689
78690
78691
78692
78693
78694
78695
78696
78697
78698
78699
78700
78701
78702
78703
78704
78705
78706
78707
78708
78709
78710
78711
78712
78713
78714
78715
78716
78717
78718
78719
78720
78721
78722
78723
78724
78725
78726
78727
78728
78729
78730
78731
78732
78733
78734
78735
78736
78737
78738
78739
78740
78741
78742
78743
78744
78745
78746
78747
78748
78749
78750
78751
78752
78753
78754
78755
78756
78757
78758
78759
78760
78761
78762
78763
78764
78765
78766
78767
78768
78769
78770
78771
78772
78773
78774
78775
78776
78777
78778
78779
78780
78781
78782
78783
78784
78785
78786
78787
78788
78789
78790
78791
78792
78793
78794
78795
78796
78797
78798
78799
78800
78801
78802
78803
78804
78805
78806
78807
78808
78809
78810
78811
78812
78813
78814
78815
78816
78817
78818
78819
78820
78821
78822
78823
78824
78825
78826
78827
78828
78829
78830
78831
78832
78833
78834
78835
78836
78837
78838
78839
78840
78841
78842
78843
78844
78845
78846
78847
78848
78849
78850
78851
78852
78853
78854
78855
78856
78857
78858
78859
78860
78861
78862
78863
78864
78865
78866
78867
78868
78869
78870
78871
78872
78873
78874
78875
78876
78877
78878
78879
78880
78881
78882
78883
78884
78885
78886
78887
78888
78889
78890
78891
78892
78893
78894
78895
78896
78897
78898
78899
78900
78901
78902
78903
78904
78905
78906
78907
78908
78909
78910
78911
78912
78913
78914
78915
78916
78917
78918
78919
78920
78921
78922
78923
78924
78925
78926
78927
78928
78929
78930
78931
78932
78933
78934
78935
78936
78937
78938
78939
78940
78941
78942
78943
78944
78945
78946
78947
78948
78949
78950
78951
78952
78953
78954
78955
78956
78957
78958
78959
78960
78961
78962
78963
78964
78965
78966
78967
78968
78969
78970
78971
78972
78973
78974
78975
78976
78977
78978
78979
78980
78981
78982
78983
78984
78985
78986
78987
78988
78989
78990
78991
78992
78993
78994
78995
78996
78997
78998
78999
79000
79001
79002
79003
79004
79005
79006
79007
79008
79009
79010
79011
79012
79013
79014
79015
79016
79017
79018
79019
79020
79021
79022
79023
79024
79025
79026
79027
79028
79029
79030
79031
79032
79033
79034
79035
79036
79037
79038
79039
79040
79041
79042
79043
79044
79045
79046
79047
79048
79049
79050
79051
79052
79053
79054
79055
79056
79057
79058
79059
79060
79061
79062
79063
79064
79065
79066
79067
79068
79069
79070
79071
79072
79073
79074
79075
79076
79077
79078
79079
79080
79081
79082
79083
79084
79085
79086
79087
79088
79089
79090
79091
79092
79093
79094
79095
79096
79097
79098
79099
79100
79101
79102
79103
79104
79105
79106
79107
79108
79109
79110
79111
79112
79113
79114
79115
79116
79117
79118
79119
79120
79121
79122
79123
79124
79125
79126
79127
79128
79129
79130
79131
79132
79133
79134
79135
79136
79137
79138
79139
79140
79141
79142
79143
79144
79145
79146
79147
79148
79149
79150
79151
79152
79153
79154
79155
79156
79157
79158
79159
79160
79161
79162
79163
79164
79165
79166
79167
79168
79169
79170
79171
79172
79173
79174
79175
79176
79177
79178
79179
79180
79181
79182
79183
79184
79185
79186
79187
79188
79189
79190
79191
79192
79193
79194
79195
79196
79197
79198
79199
79200
79201
79202
79203
79204
79205
79206
79207
79208
79209
79210
79211
79212
79213
79214
79215
79216
79217
79218
79219
79220
79221
79222
79223
79224
79225
79226
79227
79228
79229
79230
79231
79232
79233
79234
79235
79236
79237
79238
79239
79240
79241
79242
79243
79244
79245
79246
79247
79248
79249
79250
79251
79252
79253
79254
79255
79256
79257
79258
79259
79260
79261
79262
79263
79264
79265
79266
79267
79268
79269
79270
79271
79272
79273
79274
79275
79276
79277
79278
79279
79280
79281
79282
79283
79284
79285
79286
79287
79288
79289
79290
79291
79292
79293
79294
79295
79296
79297
79298
79299
79300
79301
79302
79303
79304
79305
79306
79307
79308
79309
79310
79311
79312
79313
79314
79315
79316
79317
79318
79319
79320
79321
79322
79323
79324
79325
79326
79327
79328
79329
79330
79331
79332
79333
79334
79335
79336
79337
79338
79339
79340
79341
79342
79343
79344
79345
79346
79347
79348
79349
79350
79351
79352
79353
79354
79355
79356
79357
79358
79359
79360
79361
79362
79363
79364
79365
79366
79367
79368
79369
79370
79371
79372
79373
79374
79375
79376
79377
79378
79379
79380
79381
79382
79383
79384
79385
79386
79387
79388
79389
79390
79391
79392
79393
79394
79395
79396
79397
79398
79399
79400
79401
79402
79403
79404
79405
79406
79407
79408
79409
79410
79411
79412
79413
79414
79415
79416
79417
79418
79419
79420
79421
79422
79423
79424
79425
79426
79427
79428
79429
79430
79431
79432
79433
79434
79435
79436
79437
79438
79439
79440
79441
79442
79443
79444
79445
79446
79447
79448
79449
79450
79451
79452
79453
79454
79455
79456
79457
79458
79459
79460
79461
79462
79463
79464
79465
79466
79467
79468
79469
79470
79471
79472
79473
79474
79475
79476
79477
79478
79479
79480
79481
79482
79483
79484
79485
79486
79487
79488
79489
79490
79491
79492
79493
79494
79495
79496
79497
79498
79499
79500
79501
79502
79503
79504
79505
79506
79507
79508
79509
79510
79511
79512
79513
79514
79515
79516
79517
79518
79519
79520
79521
79522
79523
79524
79525
79526
79527
79528
79529
79530
79531
79532
79533
79534
79535
79536
79537
79538
79539
79540
79541
79542
79543
79544
79545
79546
79547
79548
79549
79550
79551
79552
79553
79554
79555
79556
79557
79558
79559
79560
79561
79562
79563
79564
79565
79566
79567
79568
79569
79570
79571
79572
79573
79574
79575
79576
79577
79578
79579
79580
79581
79582
79583
79584
79585
79586
79587
79588
79589
79590
79591
79592
79593
79594
79595
79596
79597
79598
79599
79600
79601
79602
79603
79604
79605
79606
79607
79608
79609
79610
79611
79612
79613
79614
79615
79616
79617
79618
79619
79620
79621
79622
79623
79624
79625
79626
79627
79628
79629
79630
79631
79632
79633
79634
79635
79636
79637
79638
79639
79640
79641
79642
79643
79644
79645
79646
79647
79648
79649
79650
79651
79652
79653
79654
79655
79656
79657
79658
79659
79660
79661
79662
79663
79664
79665
79666
79667
79668
79669
79670
79671
79672
79673
79674
79675
79676
79677
79678
79679
79680
79681
79682
79683
79684
79685
79686
79687
79688
79689
79690
79691
79692
79693
79694
79695
79696
79697
79698
79699
79700
79701
79702
79703
79704
79705
79706
79707
79708
79709
79710
79711
79712
79713
79714
79715
79716
79717
79718
79719
79720
79721
79722
79723
79724
79725
79726
79727
79728
79729
79730
79731
79732
79733
79734
79735
79736
79737
79738
79739
79740
79741
79742
79743
79744
79745
79746
79747
79748
79749
79750
79751
79752
79753
79754
79755
79756
79757
79758
79759
79760
79761
79762
79763
79764
79765
79766
79767
79768
79769
79770
79771
79772
79773
79774
79775
79776
79777
79778
79779
79780
79781
79782
79783
79784
79785
79786
79787
79788
79789
79790
79791
79792
79793
79794
79795
79796
79797
79798
79799
79800
79801
79802
79803
79804
79805
79806
79807
79808
79809
79810
79811
79812
79813
79814
79815
79816
79817
79818
79819
79820
79821
79822
79823
79824
79825
79826
79827
79828
79829
79830
79831
79832
79833
79834
79835
79836
79837
79838
79839
79840
79841
79842
79843
79844
79845
79846
79847
79848
79849
79850
79851
79852
79853
79854
79855
79856
79857
79858
79859
79860
79861
79862
79863
79864
79865
79866
79867
79868
79869
79870
79871
79872
79873
79874
79875
79876
79877
79878
79879
79880
79881
79882
79883
79884
79885
79886
79887
79888
79889
79890
79891
79892
79893
79894
79895
79896
79897
79898
79899
79900
79901
79902
79903
79904
79905
79906
79907
79908
79909
79910
79911
79912
79913
79914
79915
79916
79917
79918
79919
79920
79921
79922
79923
79924
79925
79926
79927
79928
79929
79930
79931
79932
79933
79934
79935
79936
79937
79938
79939
79940
79941
79942
79943
79944
79945
79946
79947
79948
79949
79950
79951
79952
79953
79954
79955
79956
79957
79958
79959
79960
79961
79962
79963
79964
79965
79966
79967
79968
79969
79970
79971
79972
79973
79974
79975
79976
79977
79978
79979
79980
79981
79982
79983
79984
79985
79986
79987
79988
79989
79990
79991
79992
79993
79994
79995
79996
79997
79998
79999
80000
80001
80002
80003
80004
80005
80006
80007
80008
80009
80010
80011
80012
80013
80014
80015
80016
80017
80018
80019
80020
80021
80022
80023
80024
80025
80026
80027
80028
80029
80030
80031
80032
80033
80034
80035
80036
80037
80038
80039
80040
80041
80042
80043
80044
80045
80046
80047
80048
80049
80050
80051
80052
80053
80054
80055
80056
80057
80058
80059
80060
80061
80062
80063
80064
80065
80066
80067
80068
80069
80070
80071
80072
80073
80074
80075
80076
80077
80078
80079
80080
80081
80082
80083
80084
80085
80086
80087
80088
80089
80090
80091
80092
80093
80094
80095
80096
80097
80098
80099
80100
80101
80102
80103
80104
80105
80106
80107
80108
80109
80110
80111
80112
80113
80114
80115
80116
80117
80118
80119
80120
80121
80122
80123
80124
80125
80126
80127
80128
80129
80130
80131
80132
80133
80134
80135
80136
80137
80138
80139
80140
80141
80142
80143
80144
80145
80146
80147
80148
80149
80150
80151
80152
80153
80154
80155
80156
80157
80158
80159
80160
80161
80162
80163
80164
80165
80166
80167
80168
80169
80170
80171
80172
80173
80174
80175
80176
80177
80178
80179
80180
80181
80182
80183
80184
80185
80186
80187
80188
80189
80190
80191
80192
80193
80194
80195
80196
80197
80198
80199
80200
80201
80202
80203
80204
80205
80206
80207
80208
80209
80210
80211
80212
80213
80214
80215
80216
80217
80218
80219
80220
80221
80222
80223
80224
80225
80226
80227
80228
80229
80230
80231
80232
80233
80234
80235
80236
80237
80238
80239
80240
80241
80242
80243
80244
80245
80246
80247
80248
80249
80250
80251
80252
80253
80254
80255
80256
80257
80258
80259
80260
80261
80262
80263
80264
80265
80266
80267
80268
80269
80270
80271
80272
80273
80274
80275
80276
80277
80278
80279
80280
80281
80282
80283
80284
80285
80286
80287
80288
80289
80290
80291
80292
80293
80294
80295
80296
80297
80298
80299
80300
80301
80302
80303
80304
80305
80306
80307
80308
80309
80310
80311
80312
80313
80314
80315
80316
80317
80318
80319
80320
80321
80322
80323
80324
80325
80326
80327
80328
80329
80330
80331
80332
80333
80334
80335
80336
80337
80338
80339
80340
80341
80342
80343
80344
80345
80346
80347
80348
80349
80350
80351
80352
80353
80354
80355
80356
80357
80358
80359
80360
80361
80362
80363
80364
80365
80366
80367
80368
80369
80370
80371
80372
80373
80374
80375
80376
80377
80378
80379
80380
80381
80382
80383
80384
80385
80386
80387
80388
80389
80390
80391
80392
80393
80394
80395
80396
80397
80398
80399
80400
80401
80402
80403
80404
80405
80406
80407
80408
80409
80410
80411
80412
80413
80414
80415
80416
80417
80418
80419
80420
80421
80422
80423
80424
80425
80426
80427
80428
80429
80430
80431
80432
80433
80434
80435
80436
80437
80438
80439
80440
80441
80442
80443
80444
80445
80446
80447
80448
80449
80450
80451
80452
80453
80454
80455
80456
80457
80458
80459
80460
80461
80462
80463
80464
80465
80466
80467
80468
80469
80470
80471
80472
80473
80474
80475
80476
80477
80478
80479
80480
80481
80482
80483
80484
80485
80486
80487
80488
80489
80490
80491
80492
80493
80494
80495
80496
80497
80498
80499
80500
80501
80502
80503
80504
80505
80506
80507
80508
80509
80510
80511
80512
80513
80514
80515
80516
80517
80518
80519
80520
80521
80522
80523
80524
80525
80526
80527
80528
80529
80530
80531
80532
80533
80534
80535
80536
80537
80538
80539
80540
80541
80542
80543
80544
80545
80546
80547
80548
80549
80550
80551
80552
80553
80554
80555
80556
80557
80558
80559
80560
80561
80562
80563
80564
80565
80566
80567
80568
80569
80570
80571
80572
80573
80574
80575
80576
80577
80578
80579
80580
80581
80582
80583
80584
80585
80586
80587
80588
80589
80590
80591
80592
80593
80594
80595
80596
80597
80598
80599
80600
80601
80602
80603
80604
80605
80606
80607
80608
80609
80610
80611
80612
80613
80614
80615
80616
80617
80618
80619
80620
80621
80622
80623
80624
80625
80626
80627
80628
80629
80630
80631
80632
80633
80634
80635
80636
80637
80638
80639
80640
80641
80642
80643
80644
80645
80646
80647
80648
80649
80650
80651
80652
80653
80654
80655
80656
80657
80658
80659
80660
80661
80662
80663
80664
80665
80666
80667
80668
80669
80670
80671
80672
80673
80674
80675
80676
80677
80678
80679
80680
80681
80682
80683
80684
80685
80686
80687
80688
80689
80690
80691
80692
80693
80694
80695
80696
80697
80698
80699
80700
80701
80702
80703
80704
80705
80706
80707
80708
80709
80710
80711
80712
80713
80714
80715
80716
80717
80718
80719
80720
80721
80722
80723
80724
80725
80726
80727
80728
80729
80730
80731
80732
80733
80734
80735
80736
80737
80738
80739
80740
80741
80742
80743
80744
80745
80746
80747
80748
80749
80750
80751
80752
80753
80754
80755
80756
80757
80758
80759
80760
80761
80762
80763
80764
80765
80766
80767
80768
80769
80770
80771
80772
80773
80774
80775
80776
80777
80778
80779
80780
80781
80782
80783
80784
80785
80786
80787
80788
80789
80790
80791
80792
80793
80794
80795
80796
80797
80798
80799
80800
80801
80802
80803
80804
80805
80806
80807
80808
80809
80810
80811
80812
80813
80814
80815
80816
80817
80818
80819
80820
80821
80822
80823
80824
80825
80826
80827
80828
80829
80830
80831
80832
80833
80834
80835
80836
80837
80838
80839
80840
80841
80842
80843
80844
80845
80846
80847
80848
80849
80850
80851
80852
80853
80854
80855
80856
80857
80858
80859
80860
80861
80862
80863
80864
80865
80866
80867
80868
80869
80870
80871
80872
80873
80874
80875
80876
80877
80878
80879
80880
80881
80882
80883
80884
80885
80886
80887
80888
80889
80890
80891
80892
80893
80894
80895
80896
80897
80898
80899
80900
80901
80902
80903
80904
80905
80906
80907
80908
80909
80910
80911
80912
80913
80914
80915
80916
80917
80918
80919
80920
80921
80922
80923
80924
80925
80926
80927
80928
80929
80930
80931
80932
80933
80934
80935
80936
80937
80938
80939
80940
80941
80942
80943
80944
80945
80946
80947
80948
80949
80950
80951
80952
80953
80954
80955
80956
80957
80958
80959
80960
80961
80962
80963
80964
80965
80966
80967
80968
80969
80970
80971
80972
80973
80974
80975
80976
80977
80978
80979
80980
80981
80982
80983
80984
80985
80986
80987
80988
80989
80990
80991
80992
80993
80994
80995
80996
80997
80998
80999
81000
81001
81002
81003
81004
81005
81006
81007
81008
81009
81010
81011
81012
81013
81014
81015
81016
81017
81018
81019
81020
81021
81022
81023
81024
81025
81026
81027
81028
81029
81030
81031
81032
81033
81034
81035
81036
81037
81038
81039
81040
81041
81042
81043
81044
81045
81046
81047
81048
81049
81050
81051
81052
81053
81054
81055
81056
81057
81058
81059
81060
81061
81062
81063
81064
81065
81066
81067
81068
81069
81070
81071
81072
81073
81074
81075
81076
81077
81078
81079
81080
81081
81082
81083
81084
81085
81086
81087
81088
81089
81090
81091
81092
81093
81094
81095
81096
81097
81098
81099
81100
81101
81102
81103
81104
81105
81106
81107
81108
81109
81110
81111
81112
81113
81114
81115
81116
81117
81118
81119
81120
81121
81122
81123
81124
81125
81126
81127
81128
81129
81130
81131
81132
81133
81134
81135
81136
81137
81138
81139
81140
81141
81142
81143
81144
81145
81146
81147
81148
81149
81150
81151
81152
81153
81154
81155
81156
81157
81158
81159
81160
81161
81162
81163
81164
81165
81166
81167
81168
81169
81170
81171
81172
81173
81174
81175
81176
81177
81178
81179
81180
81181
81182
81183
81184
81185
81186
81187
81188
81189
81190
81191
81192
81193
81194
81195
81196
81197
81198
81199
81200
81201
81202
81203
81204
81205
81206
81207
81208
81209
81210
81211
81212
81213
81214
81215
81216
81217
81218
81219
81220
81221
81222
81223
81224
81225
81226
81227
81228
81229
81230
81231
81232
81233
81234
81235
81236
81237
81238
81239
81240
81241
81242
81243
81244
81245
81246
81247
81248
81249
81250
81251
81252
81253
81254
81255
81256
81257
81258
81259
81260
81261
81262
81263
81264
81265
81266
81267
81268
81269
81270
81271
81272
81273
81274
81275
81276
81277
81278
81279
81280
81281
81282
81283
81284
81285
81286
81287
81288
81289
81290
81291
81292
81293
81294
81295
81296
81297
81298
81299
81300
81301
81302
81303
81304
81305
81306
81307
81308
81309
81310
81311
81312
81313
81314
81315
81316
81317
81318
81319
81320
81321
81322
81323
81324
81325
81326
81327
81328
81329
81330
81331
81332
81333
81334
81335
81336
81337
81338
81339
81340
81341
81342
81343
81344
81345
81346
81347
81348
81349
81350
81351
81352
81353
81354
81355
81356
81357
81358
81359
81360
81361
81362
81363
81364
81365
81366
81367
81368
81369
81370
81371
81372
81373
81374
81375
81376
81377
81378
81379
81380
81381
81382
81383
81384
81385
81386
81387
81388
81389
81390
81391
81392
81393
81394
81395
81396
81397
81398
81399
81400
81401
81402
81403
81404
81405
81406
81407
81408
81409
81410
81411
81412
81413
81414
81415
81416
81417
81418
81419
81420
81421
81422
81423
81424
81425
81426
81427
81428
81429
81430
81431
81432
81433
81434
81435
81436
81437
81438
81439
81440
81441
81442
81443
81444
81445
81446
81447
81448
81449
81450
81451
81452
81453
81454
81455
81456
81457
81458
81459
81460
81461
81462
81463
81464
81465
81466
81467
81468
81469
81470
81471
81472
81473
81474
81475
81476
81477
81478
81479
81480
81481
81482
81483
81484
81485
81486
81487
81488
81489
81490
81491
81492
81493
81494
81495
81496
81497
81498
81499
81500
81501
81502
81503
81504
81505
81506
81507
81508
81509
81510
81511
81512
81513
81514
81515
81516
81517
81518
81519
81520
81521
81522
81523
81524
81525
81526
81527
81528
81529
81530
81531
81532
81533
81534
81535
81536
81537
81538
81539
81540
81541
81542
81543
81544
81545
81546
81547
81548
81549
81550
81551
81552
81553
81554
81555
81556
81557
81558
81559
81560
81561
81562
81563
81564
81565
81566
81567
81568
81569
81570
81571
81572
81573
81574
81575
81576
81577
81578
81579
81580
81581
81582
81583
81584
81585
81586
81587
81588
81589
81590
81591
81592
81593
81594
81595
81596
81597
81598
81599
81600
81601
81602
81603
81604
81605
81606
81607
81608
81609
81610
81611
81612
81613
81614
81615
81616
81617
81618
81619
81620
81621
81622
81623
81624
81625
81626
81627
81628
81629
81630
81631
81632
81633
81634
81635
81636
81637
81638
81639
81640
81641
81642
81643
81644
81645
81646
81647
81648
81649
81650
81651
81652
81653
81654
81655
81656
81657
81658
81659
81660
81661
81662
81663
81664
81665
81666
81667
81668
81669
81670
81671
81672
81673
81674
81675
81676
81677
81678
81679
81680
81681
81682
81683
81684
81685
81686
81687
81688
81689
81690
81691
81692
81693
81694
81695
81696
81697
81698
81699
81700
81701
81702
81703
81704
81705
81706
81707
81708
81709
81710
81711
81712
81713
81714
81715
81716
81717
81718
81719
81720
81721
81722
81723
81724
81725
81726
81727
81728
81729
81730
81731
81732
81733
81734
81735
81736
81737
81738
81739
81740
81741
81742
81743
81744
81745
81746
81747
81748
81749
81750
81751
81752
81753
81754
81755
81756
81757
81758
81759
81760
81761
81762
81763
81764
81765
81766
81767
81768
81769
81770
81771
81772
81773
81774
81775
81776
81777
81778
81779
81780
81781
81782
81783
81784
81785
81786
81787
81788
81789
81790
81791
81792
81793
81794
81795
81796
81797
81798
81799
81800
81801
81802
81803
81804
81805
81806
81807
81808
81809
81810
81811
81812
81813
81814
81815
81816
81817
81818
81819
81820
81821
81822
81823
81824
81825
81826
81827
81828
81829
81830
81831
81832
81833
81834
81835
81836
81837
81838
81839
81840
81841
81842
81843
81844
81845
81846
81847
81848
81849
81850
81851
81852
81853
81854
81855
81856
81857
81858
81859
81860
81861
81862
81863
81864
81865
81866
81867
81868
81869
81870
81871
81872
81873
81874
81875
81876
81877
81878
81879
81880
81881
81882
81883
81884
81885
81886
81887
81888
81889
81890
81891
81892
81893
81894
81895
81896
81897
81898
81899
81900
81901
81902
81903
81904
81905
81906
81907
81908
81909
81910
81911
81912
81913
81914
81915
81916
81917
81918
81919
81920
81921
81922
81923
81924
81925
81926
81927
81928
81929
81930
81931
81932
81933
81934
81935
81936
81937
81938
81939
81940
81941
81942
81943
81944
81945
81946
81947
81948
81949
81950
81951
81952
81953
81954
81955
81956
81957
81958
81959
81960
81961
81962
81963
81964
81965
81966
81967
81968
81969
81970
81971
81972
81973
81974
81975
81976
81977
81978
81979
81980
81981
81982
81983
81984
81985
81986
81987
81988
81989
81990
81991
81992
81993
81994
81995
81996
81997
81998
81999
82000
82001
82002
82003
82004
82005
82006
82007
82008
82009
82010
82011
82012
82013
82014
82015
82016
82017
82018
82019
82020
82021
82022
82023
82024
82025
82026
82027
82028
82029
82030
82031
82032
82033
82034
82035
82036
82037
82038
82039
82040
82041
82042
82043
82044
82045
82046
82047
82048
82049
82050
82051
82052
82053
82054
82055
82056
82057
82058
82059
82060
82061
82062
82063
82064
82065
82066
82067
82068
82069
82070
82071
82072
82073
82074
82075
82076
82077
82078
82079
82080
82081
82082
82083
82084
82085
82086
82087
82088
82089
82090
82091
82092
82093
82094
82095
82096
82097
82098
82099
82100
82101
82102
82103
82104
82105
82106
82107
82108
82109
82110
82111
82112
82113
82114
82115
82116
82117
82118
82119
82120
82121
82122
82123
82124
82125
82126
82127
82128
82129
82130
82131
82132
82133
82134
82135
82136
82137
82138
82139
82140
82141
82142
82143
82144
82145
82146
82147
82148
82149
82150
82151
82152
82153
82154
82155
82156
82157
82158
82159
82160
82161
82162
82163
82164
82165
82166
82167
82168
82169
82170
82171
82172
82173
82174
82175
82176
82177
82178
82179
82180
82181
82182
82183
82184
82185
82186
82187
82188
82189
82190
82191
82192
82193
82194
82195
82196
82197
82198
82199
82200
82201
82202
82203
82204
82205
82206
82207
82208
82209
82210
82211
82212
82213
82214
82215
82216
82217
82218
82219
82220
82221
82222
82223
82224
82225
82226
82227
82228
82229
82230
82231
82232
82233
82234
82235
82236
82237
82238
82239
82240
82241
82242
82243
82244
82245
82246
82247
82248
82249
82250
82251
82252
82253
82254
82255
82256
82257
82258
82259
82260
82261
82262
82263
82264
82265
82266
82267
82268
82269
82270
82271
82272
82273
82274
82275
82276
82277
82278
82279
82280
82281
82282
82283
82284
82285
82286
82287
82288
82289
82290
82291
82292
82293
82294
82295
82296
82297
82298
82299
82300
82301
82302
82303
82304
82305
82306
82307
82308
82309
82310
82311
82312
82313
82314
82315
82316
82317
82318
82319
82320
82321
82322
82323
82324
82325
82326
82327
82328
82329
82330
82331
82332
82333
82334
82335
82336
82337
82338
82339
82340
82341
82342
82343
82344
82345
82346
82347
82348
82349
82350
82351
82352
82353
82354
82355
82356
82357
82358
82359
82360
82361
82362
82363
82364
82365
82366
82367
82368
82369
82370
82371
82372
82373
82374
82375
82376
82377
82378
82379
82380
82381
82382
82383
82384
82385
82386
82387
82388
82389
82390
82391
82392
82393
82394
82395
82396
82397
82398
82399
82400
82401
82402
82403
82404
82405
82406
82407
82408
82409
82410
82411
82412
82413
82414
82415
82416
82417
82418
82419
82420
82421
82422
82423
82424
82425
82426
82427
82428
82429
82430
82431
82432
82433
82434
82435
82436
82437
82438
82439
82440
82441
82442
82443
82444
82445
82446
82447
82448
82449
82450
82451
82452
82453
82454
82455
82456
82457
82458
82459
82460
82461
82462
82463
82464
82465
82466
82467
82468
82469
82470
82471
82472
82473
82474
82475
82476
82477
82478
82479
82480
82481
82482
82483
82484
82485
82486
82487
82488
82489
82490
82491
82492
82493
82494
82495
82496
82497
82498
82499
82500
82501
82502
82503
82504
82505
82506
82507
82508
82509
82510
82511
82512
82513
82514
82515
82516
82517
82518
82519
82520
82521
82522
82523
82524
82525
82526
82527
82528
82529
82530
82531
82532
82533
82534
82535
82536
82537
82538
82539
82540
82541
82542
82543
82544
82545
82546
82547
82548
82549
82550
82551
82552
82553
82554
82555
82556
82557
82558
82559
82560
82561
82562
82563
82564
82565
82566
82567
82568
82569
82570
82571
82572
82573
82574
82575
82576
82577
82578
82579
82580
82581
82582
82583
82584
82585
82586
82587
82588
82589
82590
82591
82592
82593
82594
82595
82596
82597
82598
82599
82600
82601
82602
82603
82604
82605
82606
82607
82608
82609
82610
82611
82612
82613
82614
82615
82616
82617
82618
82619
82620
82621
82622
82623
82624
82625
82626
82627
82628
82629
82630
82631
82632
82633
82634
82635
82636
82637
82638
82639
82640
82641
82642
82643
82644
82645
82646
82647
82648
82649
82650
82651
82652
82653
82654
82655
82656
82657
82658
82659
82660
82661
82662
82663
82664
82665
82666
82667
82668
82669
82670
82671
82672
82673
82674
82675
82676
82677
82678
82679
82680
82681
82682
82683
82684
82685
82686
82687
82688
82689
82690
82691
82692
82693
82694
82695
82696
82697
82698
82699
82700
82701
82702
82703
82704
82705
82706
82707
82708
82709
82710
82711
82712
82713
82714
82715
82716
82717
82718
82719
82720
82721
82722
82723
82724
82725
82726
82727
82728
82729
82730
82731
82732
82733
82734
82735
82736
82737
82738
82739
82740
82741
82742
82743
82744
82745
82746
82747
82748
82749
82750
82751
82752
82753
82754
82755
82756
82757
82758
82759
82760
82761
82762
82763
82764
82765
82766
82767
82768
82769
82770
82771
82772
82773
82774
82775
82776
82777
82778
82779
82780
82781
82782
82783
82784
82785
82786
82787
82788
82789
82790
82791
82792
82793
82794
82795
82796
82797
82798
82799
82800
82801
82802
82803
82804
82805
82806
82807
82808
82809
82810
82811
82812
82813
82814
82815
82816
82817
82818
82819
82820
82821
82822
82823
82824
82825
82826
82827
82828
82829
82830
82831
82832
82833
82834
82835
82836
82837
82838
82839
82840
82841
82842
82843
82844
82845
82846
82847
82848
82849
82850
82851
82852
82853
82854
82855
82856
82857
82858
82859
82860
82861
82862
82863
82864
82865
82866
82867
82868
82869
82870
82871
82872
82873
82874
82875
82876
82877
82878
82879
82880
82881
82882
82883
82884
82885
82886
82887
82888
82889
82890
82891
82892
82893
82894
82895
82896
82897
82898
82899
82900
82901
82902
82903
82904
82905
82906
82907
82908
82909
82910
82911
82912
82913
82914
82915
82916
82917
82918
82919
82920
82921
82922
82923
82924
82925
82926
82927
82928
82929
82930
82931
82932
82933
82934
82935
82936
82937
82938
82939
82940
82941
82942
82943
82944
82945
82946
82947
82948
82949
82950
82951
82952
82953
82954
82955
82956
82957
82958
82959
82960
82961
82962
82963
82964
82965
82966
82967
82968
82969
82970
82971
82972
82973
82974
82975
82976
82977
82978
82979
82980
82981
82982
82983
82984
82985
82986
82987
82988
82989
82990
82991
82992
82993
82994
82995
82996
82997
82998
82999
83000
83001
83002
83003
83004
83005
83006
83007
83008
83009
83010
83011
83012
83013
83014
83015
83016
83017
83018
83019
83020
83021
83022
83023
83024
83025
83026
83027
83028
83029
83030
83031
83032
83033
83034
83035
83036
83037
83038
83039
83040
83041
83042
83043
83044
83045
83046
83047
83048
83049
83050
83051
83052
83053
83054
83055
83056
83057
83058
83059
83060
83061
83062
83063
83064
83065
83066
83067
83068
83069
83070
83071
83072
83073
83074
83075
83076
83077
83078
83079
83080
83081
83082
83083
83084
83085
83086
83087
83088
83089
83090
83091
83092
83093
83094
83095
83096
83097
83098
83099
83100
83101
83102
83103
83104
83105
83106
83107
83108
83109
83110
83111
83112
83113
83114
83115
83116
83117
83118
83119
83120
83121
83122
83123
83124
83125
83126
83127
83128
83129
83130
83131
83132
83133
83134
83135
83136
83137
83138
83139
83140
83141
83142
83143
83144
83145
83146
83147
83148
83149
83150
83151
83152
83153
83154
83155
83156
83157
83158
83159
83160
83161
83162
83163
83164
83165
83166
83167
83168
83169
83170
83171
83172
83173
83174
83175
83176
83177
83178
83179
83180
83181
83182
83183
83184
83185
83186
83187
83188
83189
83190
83191
83192
83193
83194
83195
83196
83197
83198
83199
83200
83201
83202
83203
83204
83205
83206
83207
83208
83209
83210
83211
83212
83213
83214
83215
83216
83217
83218
83219
83220
83221
83222
83223
83224
83225
83226
83227
83228
83229
83230
83231
83232
83233
83234
83235
83236
83237
83238
83239
83240
83241
83242
83243
83244
83245
83246
83247
83248
83249
83250
83251
83252
83253
83254
83255
83256
83257
83258
83259
83260
83261
83262
83263
83264
83265
83266
83267
83268
83269
83270
83271
83272
83273
83274
83275
83276
83277
83278
83279
83280
83281
83282
83283
83284
83285
83286
83287
83288
83289
83290
83291
83292
83293
83294
83295
83296
83297
83298
83299
83300
83301
83302
83303
83304
83305
83306
83307
83308
83309
83310
83311
83312
83313
83314
83315
83316
83317
83318
83319
83320
83321
83322
83323
83324
83325
83326
83327
83328
83329
83330
83331
83332
83333
83334
83335
83336
83337
83338
83339
83340
83341
83342
83343
83344
83345
83346
83347
83348
83349
83350
83351
83352
83353
83354
83355
83356
83357
83358
83359
83360
83361
83362
83363
83364
83365
83366
83367
83368
83369
83370
83371
83372
83373
83374
83375
83376
83377
83378
83379
83380
83381
83382
83383
83384
83385
83386
83387
83388
83389
83390
83391
83392
83393
83394
83395
83396
83397
83398
83399
83400
83401
83402
83403
83404
83405
83406
83407
83408
83409
83410
83411
83412
83413
83414
83415
83416
83417
83418
83419
83420
83421
83422
83423
83424
83425
83426
83427
83428
83429
83430
83431
83432
83433
83434
83435
83436
83437
83438
83439
83440
83441
83442
83443
83444
83445
83446
83447
83448
83449
83450
83451
83452
83453
83454
83455
83456
83457
83458
83459
83460
83461
83462
83463
83464
83465
83466
83467
83468
83469
83470
83471
83472
83473
83474
83475
83476
83477
83478
83479
83480
83481
83482
83483
83484
83485
83486
83487
83488
83489
83490
83491
83492
83493
83494
83495
83496
83497
83498
83499
83500
83501
83502
83503
83504
83505
83506
83507
83508
83509
83510
83511
83512
83513
83514
83515
83516
83517
83518
83519
83520
83521
83522
83523
83524
83525
83526
83527
83528
83529
83530
83531
83532
83533
83534
83535
83536
83537
83538
83539
83540
83541
83542
83543
83544
83545
83546
83547
83548
83549
83550
83551
83552
83553
83554
83555
83556
83557
83558
83559
83560
83561
83562
83563
83564
83565
83566
83567
83568
83569
83570
83571
83572
83573
83574
83575
83576
83577
83578
83579
83580
83581
83582
83583
83584
83585
83586
83587
83588
83589
83590
83591
83592
83593
83594
83595
83596
83597
83598
83599
83600
83601
83602
83603
83604
83605
83606
83607
83608
83609
83610
83611
83612
83613
83614
83615
83616
83617
83618
83619
83620
83621
83622
83623
83624
83625
83626
83627
83628
83629
83630
83631
83632
83633
83634
83635
83636
83637
83638
83639
83640
83641
83642
83643
83644
83645
83646
83647
83648
83649
83650
83651
83652
83653
83654
83655
83656
83657
83658
83659
83660
83661
83662
83663
83664
83665
83666
83667
83668
83669
83670
83671
83672
83673
83674
83675
83676
83677
83678
83679
83680
83681
83682
83683
83684
83685
83686
83687
83688
83689
83690
83691
83692
83693
83694
83695
83696
83697
83698
83699
83700
83701
83702
83703
83704
83705
83706
83707
83708
83709
83710
83711
83712
83713
83714
83715
83716
83717
83718
83719
83720
83721
83722
83723
83724
83725
83726
83727
83728
83729
83730
83731
83732
83733
83734
83735
83736
83737
83738
83739
83740
83741
83742
83743
83744
83745
83746
83747
83748
83749
83750
83751
83752
83753
83754
83755
83756
83757
83758
83759
83760
83761
83762
83763
83764
83765
83766
83767
83768
83769
83770
83771
83772
83773
83774
83775
83776
83777
83778
83779
83780
83781
83782
83783
83784
83785
83786
83787
83788
83789
83790
83791
83792
83793
83794
83795
83796
83797
83798
83799
83800
83801
83802
83803
83804
83805
83806
83807
83808
83809
83810
83811
83812
83813
83814
83815
83816
83817
83818
83819
83820
83821
83822
83823
83824
83825
83826
83827
83828
83829
83830
83831
83832
83833
83834
83835
83836
83837
83838
83839
83840
83841
83842
83843
83844
83845
83846
83847
83848
83849
83850
83851
83852
83853
83854
83855
83856
83857
83858
83859
83860
83861
83862
83863
83864
83865
83866
83867
83868
83869
83870
83871
83872
83873
83874
83875
83876
83877
83878
83879
83880
83881
83882
83883
83884
83885
83886
83887
83888
83889
83890
83891
83892
83893
83894
83895
83896
83897
83898
83899
83900
83901
83902
83903
83904
83905
83906
83907
83908
83909
83910
83911
83912
83913
83914
83915
83916
83917
83918
83919
83920
83921
83922
83923
83924
83925
83926
83927
83928
83929
83930
83931
83932
83933
83934
83935
83936
83937
83938
83939
83940
83941
83942
83943
83944
83945
83946
83947
83948
83949
83950
83951
83952
83953
83954
83955
83956
83957
83958
83959
83960
83961
83962
83963
83964
83965
83966
83967
83968
83969
83970
83971
83972
83973
83974
83975
83976
83977
83978
83979
83980
83981
83982
83983
83984
83985
83986
83987
83988
83989
83990
83991
83992
83993
83994
83995
83996
83997
83998
83999
84000
84001
84002
84003
84004
84005
84006
84007
84008
84009
84010
84011
84012
84013
84014
84015
84016
84017
84018
84019
84020
84021
84022
84023
84024
84025
84026
84027
84028
84029
84030
84031
84032
84033
84034
84035
84036
84037
84038
84039
84040
84041
84042
84043
84044
84045
84046
84047
84048
84049
84050
84051
84052
84053
84054
84055
84056
84057
84058
84059
84060
84061
84062
84063
84064
84065
84066
84067
84068
84069
84070
84071
84072
84073
84074
84075
84076
84077
84078
84079
84080
84081
84082
84083
84084
84085
84086
84087
84088
84089
84090
84091
84092
84093
84094
84095
84096
84097
84098
84099
84100
84101
84102
84103
84104
84105
84106
84107
84108
84109
84110
84111
84112
84113
84114
84115
84116
84117
84118
84119
84120
84121
84122
84123
84124
84125
84126
84127
84128
84129
84130
84131
84132
84133
84134
84135
84136
84137
84138
84139
84140
84141
84142
84143
84144
84145
84146
84147
84148
84149
84150
84151
84152
84153
84154
84155
84156
84157
84158
84159
84160
84161
84162
84163
84164
84165
84166
84167
84168
84169
84170
84171
84172
84173
84174
84175
84176
84177
84178
84179
84180
84181
84182
84183
84184
84185
84186
84187
84188
84189
84190
84191
84192
84193
84194
84195
84196
84197
84198
84199
84200
84201
84202
84203
84204
84205
84206
84207
84208
84209
84210
84211
84212
84213
84214
84215
84216
84217
84218
84219
84220
84221
84222
84223
84224
84225
84226
84227
84228
84229
84230
84231
84232
84233
84234
84235
84236
84237
84238
84239
84240
84241
84242
84243
84244
84245
84246
84247
84248
84249
84250
84251
84252
84253
84254
84255
84256
84257
84258
84259
84260
84261
84262
84263
84264
84265
84266
84267
84268
84269
84270
84271
84272
84273
84274
84275
84276
84277
84278
84279
84280
84281
84282
84283
84284
84285
84286
84287
84288
84289
84290
84291
84292
84293
84294
84295
84296
84297
84298
84299
84300
84301
84302
84303
84304
84305
84306
84307
84308
84309
84310
84311
84312
84313
84314
84315
84316
84317
84318
84319
84320
84321
84322
84323
84324
84325
84326
84327
84328
84329
84330
84331
84332
84333
84334
84335
84336
84337
84338
84339
84340
84341
84342
84343
84344
84345
84346
84347
84348
84349
84350
84351
84352
84353
84354
84355
84356
84357
84358
84359
84360
84361
84362
84363
84364
84365
84366
84367
84368
84369
84370
84371
84372
84373
84374
84375
84376
84377
84378
84379
84380
84381
84382
84383
84384
84385
84386
84387
84388
84389
84390
84391
84392
84393
84394
84395
84396
84397
84398
84399
84400
84401
84402
84403
84404
84405
84406
84407
84408
84409
84410
84411
84412
84413
84414
84415
84416
84417
84418
84419
84420
84421
84422
84423
84424
84425
84426
84427
84428
84429
84430
84431
84432
84433
84434
84435
84436
84437
84438
84439
84440
84441
84442
84443
84444
84445
84446
84447
84448
84449
84450
84451
84452
84453
84454
84455
84456
84457
84458
84459
84460
84461
84462
84463
84464
84465
84466
84467
84468
84469
84470
84471
84472
84473
84474
84475
84476
84477
84478
84479
84480
84481
84482
84483
84484
84485
84486
84487
84488
84489
84490
84491
84492
84493
84494
84495
84496
84497
84498
84499
84500
84501
84502
84503
84504
84505
84506
84507
84508
84509
84510
84511
84512
84513
84514
84515
84516
84517
84518
84519
84520
84521
84522
84523
84524
84525
84526
84527
84528
84529
84530
84531
84532
84533
84534
84535
84536
84537
84538
84539
84540
84541
84542
84543
84544
84545
84546
84547
84548
84549
84550
84551
84552
84553
84554
84555
84556
84557
84558
84559
84560
84561
84562
84563
84564
84565
84566
84567
84568
84569
84570
84571
84572
84573
84574
84575
84576
84577
84578
84579
84580
84581
84582
84583
84584
84585
84586
84587
84588
84589
84590
84591
84592
84593
84594
84595
84596
84597
84598
84599
84600
84601
84602
84603
84604
84605
84606
84607
84608
84609
84610
84611
84612
84613
84614
84615
84616
84617
84618
84619
84620
84621
84622
84623
84624
84625
84626
84627
84628
84629
84630
84631
84632
84633
84634
84635
84636
84637
84638
84639
84640
84641
84642
84643
84644
84645
84646
84647
84648
84649
84650
84651
84652
84653
84654
84655
84656
84657
84658
84659
84660
84661
84662
84663
84664
84665
84666
84667
84668
84669
84670
84671
84672
84673
84674
84675
84676
84677
84678
84679
84680
84681
84682
84683
84684
84685
84686
84687
84688
84689
84690
84691
84692
84693
84694
84695
84696
84697
84698
84699
84700
84701
84702
84703
84704
84705
84706
84707
84708
84709
84710
84711
84712
84713
84714
84715
84716
84717
84718
84719
84720
84721
84722
84723
84724
84725
84726
84727
84728
84729
84730
84731
84732
84733
84734
84735
84736
84737
84738
84739
84740
84741
84742
84743
84744
84745
84746
84747
84748
84749
84750
84751
84752
84753
84754
84755
84756
84757
84758
84759
84760
84761
84762
84763
84764
84765
84766
84767
84768
84769
84770
84771
84772
84773
84774
84775
84776
84777
84778
84779
84780
84781
84782
84783
84784
84785
84786
84787
84788
84789
84790
84791
84792
84793
84794
84795
84796
84797
84798
84799
84800
84801
84802
84803
84804
84805
84806
84807
84808
84809
84810
84811
84812
84813
84814
84815
84816
84817
84818
84819
84820
84821
84822
84823
84824
84825
84826
84827
84828
84829
84830
84831
84832
84833
84834
84835
84836
84837
84838
84839
84840
84841
84842
84843
84844
84845
84846
84847
84848
84849
84850
84851
84852
84853
84854
84855
84856
84857
84858
84859
84860
84861
84862
84863
84864
84865
84866
84867
84868
84869
84870
84871
84872
84873
84874
84875
84876
84877
84878
84879
84880
84881
84882
84883
84884
84885
84886
84887
84888
84889
84890
84891
84892
84893
84894
84895
84896
84897
84898
84899
84900
84901
84902
84903
84904
84905
84906
84907
84908
84909
84910
84911
84912
84913
84914
84915
84916
84917
84918
84919
84920
84921
84922
84923
84924
84925
84926
84927
84928
84929
84930
84931
84932
84933
84934
84935
84936
84937
84938
84939
84940
84941
84942
84943
84944
84945
84946
84947
84948
84949
84950
84951
84952
84953
84954
84955
84956
84957
84958
84959
84960
84961
84962
84963
84964
84965
84966
84967
84968
84969
84970
84971
84972
84973
84974
84975
84976
84977
84978
84979
84980
84981
84982
84983
84984
84985
84986
84987
84988
84989
84990
84991
84992
84993
84994
84995
84996
84997
84998
84999
85000
85001
85002
85003
85004
85005
85006
85007
85008
85009
85010
85011
85012
85013
85014
85015
85016
85017
85018
85019
85020
85021
85022
85023
85024
85025
85026
85027
85028
85029
85030
85031
85032
85033
85034
85035
85036
85037
85038
85039
85040
85041
85042
85043
85044
85045
85046
85047
85048
85049
85050
85051
85052
85053
85054
85055
85056
85057
85058
85059
85060
85061
85062
85063
85064
85065
85066
85067
85068
85069
85070
85071
85072
85073
85074
85075
85076
85077
85078
85079
85080
85081
85082
85083
85084
85085
85086
85087
85088
85089
85090
85091
85092
85093
85094
85095
85096
85097
85098
85099
85100
85101
85102
85103
85104
85105
85106
85107
85108
85109
85110
85111
85112
85113
85114
85115
85116
85117
85118
85119
85120
85121
85122
85123
85124
85125
85126
85127
85128
85129
85130
85131
85132
85133
85134
85135
85136
85137
85138
85139
85140
85141
85142
85143
85144
85145
85146
85147
85148
85149
85150
85151
85152
85153
85154
85155
85156
85157
85158
85159
85160
85161
85162
85163
85164
85165
85166
85167
85168
85169
85170
85171
85172
85173
85174
85175
85176
85177
85178
85179
85180
85181
85182
85183
85184
85185
85186
85187
85188
85189
85190
85191
85192
85193
85194
85195
85196
85197
85198
85199
85200
85201
85202
85203
85204
85205
85206
85207
85208
85209
85210
85211
85212
85213
85214
85215
85216
85217
85218
85219
85220
85221
85222
85223
85224
85225
85226
85227
85228
85229
85230
85231
85232
85233
85234
85235
85236
85237
85238
85239
85240
85241
85242
85243
85244
85245
85246
85247
85248
85249
85250
85251
85252
85253
85254
85255
85256
85257
85258
85259
85260
85261
85262
85263
85264
85265
85266
85267
85268
85269
85270
85271
85272
85273
85274
85275
85276
85277
85278
85279
85280
85281
85282
85283
85284
85285
85286
85287
85288
85289
85290
85291
85292
85293
85294
85295
85296
85297
85298
85299
85300
85301
85302
85303
85304
85305
85306
85307
85308
85309
85310
85311
85312
85313
85314
85315
85316
85317
85318
85319
85320
85321
85322
85323
85324
85325
85326
85327
85328
85329
85330
85331
85332
85333
85334
85335
85336
85337
85338
85339
85340
85341
85342
85343
85344
85345
85346
85347
85348
85349
85350
85351
85352
85353
85354
85355
85356
85357
85358
85359
85360
85361
85362
85363
85364
85365
85366
85367
85368
85369
85370
85371
85372
85373
85374
85375
85376
85377
85378
85379
85380
85381
85382
85383
85384
85385
85386
85387
85388
85389
85390
85391
85392
85393
85394
85395
85396
85397
85398
85399
85400
85401
85402
85403
85404
85405
85406
85407
85408
85409
85410
85411
85412
85413
85414
85415
85416
85417
85418
85419
85420
85421
85422
85423
85424
85425
85426
85427
85428
85429
85430
85431
85432
85433
85434
85435
85436
85437
85438
85439
85440
85441
85442
85443
85444
85445
85446
85447
85448
85449
85450
85451
85452
85453
85454
85455
85456
85457
85458
85459
85460
85461
85462
85463
85464
85465
85466
85467
85468
85469
85470
85471
85472
85473
85474
85475
85476
85477
85478
85479
85480
85481
85482
85483
85484
85485
85486
85487
85488
85489
85490
85491
85492
85493
85494
85495
85496
85497
85498
85499
85500
85501
85502
85503
85504
85505
85506
85507
85508
85509
85510
85511
85512
85513
85514
85515
85516
85517
85518
85519
85520
85521
85522
85523
85524
85525
85526
85527
85528
85529
85530
85531
85532
85533
85534
85535
85536
85537
85538
85539
85540
85541
85542
85543
85544
85545
85546
85547
85548
85549
85550
85551
85552
85553
85554
85555
85556
85557
85558
85559
85560
85561
85562
85563
85564
85565
85566
85567
85568
85569
85570
85571
85572
85573
85574
85575
85576
85577
85578
85579
85580
85581
85582
85583
85584
85585
85586
85587
85588
85589
85590
85591
85592
85593
85594
85595
85596
85597
85598
85599
85600
85601
85602
85603
85604
85605
85606
85607
85608
85609
85610
85611
85612
85613
85614
85615
85616
85617
85618
85619
85620
85621
85622
85623
85624
85625
85626
85627
85628
85629
85630
85631
85632
85633
85634
85635
85636
85637
85638
85639
85640
85641
85642
85643
85644
85645
85646
85647
85648
85649
85650
85651
85652
85653
85654
85655
85656
85657
85658
85659
85660
85661
85662
85663
85664
85665
85666
85667
85668
85669
85670
85671
85672
85673
85674
85675
85676
85677
85678
85679
85680
85681
85682
85683
85684
85685
85686
85687
85688
85689
85690
85691
85692
85693
85694
85695
85696
85697
85698
85699
85700
85701
85702
85703
85704
85705
85706
85707
85708
85709
85710
85711
85712
85713
85714
85715
85716
85717
85718
85719
85720
85721
85722
85723
85724
85725
85726
85727
85728
85729
85730
85731
85732
85733
85734
85735
85736
85737
85738
85739
85740
85741
85742
85743
85744
85745
85746
85747
85748
85749
85750
85751
85752
85753
85754
85755
85756
85757
85758
85759
85760
85761
85762
85763
85764
85765
85766
85767
85768
85769
85770
85771
85772
85773
85774
85775
85776
85777
85778
85779
85780
85781
85782
85783
85784
85785
85786
85787
85788
85789
85790
85791
85792
85793
85794
85795
85796
85797
85798
85799
85800
85801
85802
85803
85804
85805
85806
85807
85808
85809
85810
85811
85812
85813
85814
85815
85816
85817
85818
85819
85820
85821
85822
85823
85824
85825
85826
85827
85828
85829
85830
85831
85832
85833
85834
85835
85836
85837
85838
85839
85840
85841
85842
85843
85844
85845
85846
85847
85848
85849
85850
85851
85852
85853
85854
85855
85856
85857
85858
85859
85860
85861
85862
85863
85864
85865
85866
85867
85868
85869
85870
85871
85872
85873
85874
85875
85876
85877
85878
85879
85880
85881
85882
85883
85884
85885
85886
85887
85888
85889
85890
85891
85892
85893
85894
85895
85896
85897
85898
85899
85900
85901
85902
85903
85904
85905
85906
85907
85908
85909
85910
85911
85912
85913
85914
85915
85916
85917
85918
85919
85920
85921
85922
85923
85924
85925
85926
85927
85928
85929
85930
85931
85932
85933
85934
85935
85936
85937
85938
85939
85940
85941
85942
85943
85944
85945
85946
85947
85948
85949
85950
85951
85952
85953
85954
85955
85956
85957
85958
85959
85960
85961
85962
85963
85964
85965
85966
85967
85968
85969
85970
85971
85972
85973
85974
85975
85976
85977
85978
85979
85980
85981
85982
85983
85984
85985
85986
85987
85988
85989
85990
85991
85992
85993
85994
85995
85996
85997
85998
85999
86000
86001
86002
86003
86004
86005
86006
86007
86008
86009
86010
86011
86012
86013
86014
86015
86016
86017
86018
86019
86020
86021
86022
86023
86024
86025
86026
86027
86028
86029
86030
86031
86032
86033
86034
86035
86036
86037
86038
86039
86040
86041
86042
86043
86044
86045
86046
86047
86048
86049
86050
86051
86052
86053
86054
86055
86056
86057
86058
86059
86060
86061
86062
86063
86064
86065
86066
86067
86068
86069
86070
86071
86072
86073
86074
86075
86076
86077
86078
86079
86080
86081
86082
86083
86084
86085
86086
86087
86088
86089
86090
86091
86092
86093
86094
86095
86096
86097
86098
86099
86100
86101
86102
86103
86104
86105
86106
86107
86108
86109
86110
86111
86112
86113
86114
86115
86116
86117
86118
86119
86120
86121
86122
86123
86124
86125
86126
86127
86128
86129
86130
86131
86132
86133
86134
86135
86136
86137
86138
86139
86140
86141
86142
86143
86144
86145
86146
86147
86148
86149
86150
86151
86152
86153
86154
86155
86156
86157
86158
86159
86160
86161
86162
86163
86164
86165
86166
86167
86168
86169
86170
86171
86172
86173
86174
86175
86176
86177
86178
86179
86180
86181
86182
86183
86184
86185
86186
86187
86188
86189
86190
86191
86192
86193
86194
86195
86196
86197
86198
86199
86200
86201
86202
86203
86204
86205
86206
86207
86208
86209
86210
86211
86212
86213
86214
86215
86216
86217
86218
86219
86220
86221
86222
86223
86224
86225
86226
86227
86228
86229
86230
86231
86232
86233
86234
86235
86236
86237
86238
86239
86240
86241
86242
86243
86244
86245
86246
86247
86248
86249
86250
86251
86252
86253
86254
86255
86256
86257
86258
86259
86260
86261
86262
86263
86264
86265
86266
86267
86268
86269
86270
86271
86272
86273
86274
86275
86276
86277
86278
86279
86280
86281
86282
86283
86284
86285
86286
86287
86288
86289
86290
86291
86292
86293
86294
86295
86296
86297
86298
86299
86300
86301
86302
86303
86304
86305
86306
86307
86308
86309
86310
86311
86312
86313
86314
86315
86316
86317
86318
86319
86320
86321
86322
86323
86324
86325
86326
86327
86328
86329
86330
86331
86332
86333
86334
86335
86336
86337
86338
86339
86340
86341
86342
86343
86344
86345
86346
86347
86348
86349
86350
86351
86352
86353
86354
86355
86356
86357
86358
86359
86360
86361
86362
86363
86364
86365
86366
86367
86368
86369
86370
86371
86372
86373
86374
86375
86376
86377
86378
86379
86380
86381
86382
86383
86384
86385
86386
86387
86388
86389
86390
86391
86392
86393
86394
86395
86396
86397
86398
86399
86400
86401
86402
86403
86404
86405
86406
86407
86408
86409
86410
86411
86412
86413
86414
86415
86416
86417
86418
86419
86420
86421
86422
86423
86424
86425
86426
86427
86428
86429
86430
86431
86432
86433
86434
86435
86436
86437
86438
86439
86440
86441
86442
86443
86444
86445
86446
86447
86448
86449
86450
86451
86452
86453
86454
86455
86456
86457
86458
86459
86460
86461
86462
86463
86464
86465
86466
86467
86468
86469
86470
86471
86472
86473
86474
86475
86476
86477
86478
86479
86480
86481
86482
86483
86484
86485
86486
86487
86488
86489
86490
86491
86492
86493
86494
86495
86496
86497
86498
86499
86500
86501
86502
86503
86504
86505
86506
86507
86508
86509
86510
86511
86512
86513
86514
86515
86516
86517
86518
86519
86520
86521
86522
86523
86524
86525
86526
86527
86528
86529
86530
86531
86532
86533
86534
86535
86536
86537
86538
86539
86540
86541
86542
86543
86544
86545
86546
86547
86548
86549
86550
86551
86552
86553
86554
86555
86556
86557
86558
86559
86560
86561
86562
86563
86564
86565
86566
86567
86568
86569
86570
86571
86572
86573
86574
86575
86576
86577
86578
86579
86580
86581
86582
86583
86584
86585
86586
86587
86588
86589
86590
86591
86592
86593
86594
86595
86596
86597
86598
86599
86600
86601
86602
86603
86604
86605
86606
86607
86608
86609
86610
86611
86612
86613
86614
86615
86616
86617
86618
86619
86620
86621
86622
86623
86624
86625
86626
86627
86628
86629
86630
86631
86632
86633
86634
86635
86636
86637
86638
86639
86640
86641
86642
86643
86644
86645
86646
86647
86648
86649
86650
86651
86652
86653
86654
86655
86656
86657
86658
86659
86660
86661
86662
86663
86664
86665
86666
86667
86668
86669
86670
86671
86672
86673
86674
86675
86676
86677
86678
86679
86680
86681
86682
86683
86684
86685
86686
86687
86688
86689
86690
86691
86692
86693
86694
86695
86696
86697
86698
86699
86700
86701
86702
86703
86704
86705
86706
86707
86708
86709
86710
86711
86712
86713
86714
86715
86716
86717
86718
86719
86720
86721
86722
86723
86724
86725
86726
86727
86728
86729
86730
86731
86732
86733
86734
86735
86736
86737
86738
86739
86740
86741
86742
86743
86744
86745
86746
86747
86748
86749
86750
86751
86752
86753
86754
86755
86756
86757
86758
86759
86760
86761
86762
86763
86764
86765
86766
86767
86768
86769
86770
86771
86772
86773
86774
86775
86776
86777
86778
86779
86780
86781
86782
86783
86784
86785
86786
86787
86788
86789
86790
86791
86792
86793
86794
86795
86796
86797
86798
86799
86800
86801
86802
86803
86804
86805
86806
86807
86808
86809
86810
86811
86812
86813
86814
86815
86816
86817
86818
86819
86820
86821
86822
86823
86824
86825
86826
86827
86828
86829
86830
86831
86832
86833
86834
86835
86836
86837
86838
86839
86840
86841
86842
86843
86844
86845
86846
86847
86848
86849
86850
86851
86852
86853
86854
86855
86856
86857
86858
86859
86860
86861
86862
86863
86864
86865
86866
86867
86868
86869
86870
86871
86872
86873
86874
86875
86876
86877
86878
86879
86880
86881
86882
86883
86884
86885
86886
86887
86888
86889
86890
86891
86892
86893
86894
86895
86896
86897
86898
86899
86900
86901
86902
86903
86904
86905
86906
86907
86908
86909
86910
86911
86912
86913
86914
86915
86916
86917
86918
86919
86920
86921
86922
86923
86924
86925
86926
86927
86928
86929
86930
86931
86932
86933
86934
86935
86936
86937
86938
86939
86940
86941
86942
86943
86944
86945
86946
86947
86948
86949
86950
86951
86952
86953
86954
86955
86956
86957
86958
86959
86960
86961
86962
86963
86964
86965
86966
86967
86968
86969
86970
86971
86972
86973
86974
86975
86976
86977
86978
86979
86980
86981
86982
86983
86984
86985
86986
86987
86988
86989
86990
86991
86992
86993
86994
86995
86996
86997
86998
86999
87000
87001
87002
87003
87004
87005
87006
87007
87008
87009
87010
87011
87012
87013
87014
87015
87016
87017
87018
87019
87020
87021
87022
87023
87024
87025
87026
87027
87028
87029
87030
87031
87032
87033
87034
87035
87036
87037
87038
87039
87040
87041
87042
87043
87044
87045
87046
87047
87048
87049
87050
87051
87052
87053
87054
87055
87056
87057
87058
87059
87060
87061
87062
87063
87064
87065
87066
87067
87068
87069
87070
87071
87072
87073
87074
87075
87076
87077
87078
87079
87080
87081
87082
87083
87084
87085
87086
87087
87088
87089
87090
87091
87092
87093
87094
87095
87096
87097
87098
87099
87100
87101
87102
87103
87104
87105
87106
87107
87108
87109
87110
87111
87112
87113
87114
87115
87116
87117
87118
87119
87120
87121
87122
87123
87124
87125
87126
87127
87128
87129
87130
87131
87132
87133
87134
87135
87136
87137
87138
87139
87140
87141
87142
87143
87144
87145
87146
87147
87148
87149
87150
87151
87152
87153
87154
87155
87156
87157
87158
87159
87160
87161
87162
87163
87164
87165
87166
87167
87168
87169
87170
87171
87172
87173
87174
87175
87176
87177
87178
87179
87180
87181
87182
87183
87184
87185
87186
87187
87188
87189
87190
87191
87192
87193
87194
87195
87196
87197
87198
87199
87200
87201
87202
87203
87204
87205
87206
87207
87208
87209
87210
87211
87212
87213
87214
87215
87216
87217
87218
87219
87220
87221
87222
87223
87224
87225
87226
87227
87228
87229
87230
87231
87232
87233
87234
87235
87236
87237
87238
87239
87240
87241
87242
87243
87244
87245
87246
87247
87248
87249
87250
87251
87252
87253
87254
87255
87256
87257
87258
87259
87260
87261
87262
87263
87264
87265
87266
87267
87268
87269
87270
87271
87272
87273
87274
87275
87276
87277
87278
87279
87280
87281
87282
87283
87284
87285
87286
87287
87288
87289
87290
87291
87292
87293
87294
87295
87296
87297
87298
87299
87300
87301
87302
87303
87304
87305
87306
87307
87308
87309
87310
87311
87312
87313
87314
87315
87316
87317
87318
87319
87320
87321
87322
87323
87324
87325
87326
87327
87328
87329
87330
87331
87332
87333
87334
87335
87336
87337
87338
87339
87340
87341
87342
87343
87344
87345
87346
87347
87348
87349
87350
87351
87352
87353
87354
87355
87356
87357
87358
87359
87360
87361
87362
87363
87364
87365
87366
87367
87368
87369
87370
87371
87372
87373
87374
87375
87376
87377
87378
87379
87380
87381
87382
87383
87384
87385
87386
87387
87388
87389
87390
87391
87392
87393
87394
87395
87396
87397
87398
87399
87400
87401
87402
87403
87404
87405
87406
87407
87408
87409
87410
87411
87412
87413
87414
87415
87416
87417
87418
87419
87420
87421
87422
87423
87424
87425
87426
87427
87428
87429
87430
87431
87432
87433
87434
87435
87436
87437
87438
87439
87440
87441
87442
87443
87444
87445
87446
87447
87448
87449
87450
87451
87452
87453
87454
87455
87456
87457
87458
87459
87460
87461
87462
87463
87464
87465
87466
87467
87468
87469
87470
87471
87472
87473
87474
87475
87476
87477
87478
87479
87480
87481
87482
87483
87484
87485
87486
87487
87488
87489
87490
87491
87492
87493
87494
87495
87496
87497
87498
87499
87500
87501
87502
87503
87504
87505
87506
87507
87508
87509
87510
87511
87512
87513
87514
87515
87516
87517
87518
87519
87520
87521
87522
87523
87524
87525
87526
87527
87528
87529
87530
87531
87532
87533
87534
87535
87536
87537
87538
87539
87540
87541
87542
87543
87544
87545
87546
87547
87548
87549
87550
87551
87552
87553
87554
87555
87556
87557
87558
87559
87560
87561
87562
87563
87564
87565
87566
87567
87568
87569
87570
87571
87572
87573
87574
87575
87576
87577
87578
87579
87580
87581
87582
87583
87584
87585
87586
87587
87588
87589
87590
87591
87592
87593
87594
87595
87596
87597
87598
87599
87600
87601
87602
87603
87604
87605
87606
87607
87608
87609
87610
87611
87612
87613
87614
87615
87616
87617
87618
87619
87620
87621
87622
87623
87624
87625
87626
87627
87628
87629
87630
87631
87632
87633
87634
87635
87636
87637
87638
87639
87640
87641
87642
87643
87644
87645
87646
87647
87648
87649
87650
87651
87652
87653
87654
87655
87656
87657
87658
87659
87660
87661
87662
87663
87664
87665
87666
87667
87668
87669
87670
87671
87672
87673
87674
87675
87676
87677
87678
87679
87680
87681
87682
87683
87684
87685
87686
87687
87688
87689
87690
87691
87692
87693
87694
87695
87696
87697
87698
87699
87700
87701
87702
87703
87704
87705
87706
87707
87708
87709
87710
87711
87712
87713
87714
87715
87716
87717
87718
87719
87720
87721
87722
87723
87724
87725
87726
87727
87728
87729
87730
87731
87732
87733
87734
87735
87736
87737
87738
87739
87740
87741
87742
87743
87744
87745
87746
87747
87748
87749
87750
87751
87752
87753
87754
87755
87756
87757
87758
87759
87760
87761
87762
87763
87764
87765
87766
87767
87768
87769
87770
87771
87772
87773
87774
87775
87776
87777
87778
87779
87780
87781
87782
87783
87784
87785
87786
87787
87788
87789
87790
87791
87792
87793
87794
87795
87796
87797
87798
87799
87800
87801
87802
87803
87804
87805
87806
87807
87808
87809
87810
87811
87812
87813
87814
87815
87816
87817
87818
87819
87820
87821
87822
87823
87824
87825
87826
87827
87828
87829
87830
87831
87832
87833
87834
87835
87836
87837
87838
87839
87840
87841
87842
87843
87844
87845
87846
87847
87848
87849
87850
87851
87852
87853
87854
87855
87856
87857
87858
87859
87860
87861
87862
87863
87864
87865
87866
87867
87868
87869
87870
87871
87872
87873
87874
87875
87876
87877
87878
87879
87880
87881
87882
87883
87884
87885
87886
87887
87888
87889
87890
87891
87892
87893
87894
87895
87896
87897
87898
87899
87900
87901
87902
87903
87904
87905
87906
87907
87908
87909
87910
87911
87912
87913
87914
87915
87916
87917
87918
87919
87920
87921
87922
87923
87924
87925
87926
87927
87928
87929
87930
87931
87932
87933
87934
87935
87936
87937
87938
87939
87940
87941
87942
87943
87944
87945
87946
87947
87948
87949
87950
87951
87952
87953
87954
87955
87956
87957
87958
87959
87960
87961
87962
87963
87964
87965
87966
87967
87968
87969
87970
87971
87972
87973
87974
87975
87976
87977
87978
87979
87980
87981
87982
87983
87984
87985
87986
87987
87988
87989
87990
87991
87992
87993
87994
87995
87996
87997
87998
87999
88000
88001
88002
88003
88004
88005
88006
88007
88008
88009
88010
88011
88012
88013
88014
88015
88016
88017
88018
88019
88020
88021
88022
88023
88024
88025
88026
88027
88028
88029
88030
88031
88032
88033
88034
88035
88036
88037
88038
88039
88040
88041
88042
88043
88044
88045
88046
88047
88048
88049
88050
88051
88052
88053
88054
88055
88056
88057
88058
88059
88060
88061
88062
88063
88064
88065
88066
88067
88068
88069
88070
88071
88072
88073
88074
88075
88076
88077
88078
88079
88080
88081
88082
88083
88084
88085
88086
88087
88088
88089
88090
88091
88092
88093
88094
88095
88096
88097
88098
88099
88100
88101
88102
88103
88104
88105
88106
88107
88108
88109
88110
88111
88112
88113
88114
88115
88116
88117
88118
88119
88120
88121
88122
88123
88124
88125
88126
88127
88128
88129
88130
88131
88132
88133
88134
88135
88136
88137
88138
88139
88140
88141
88142
88143
88144
88145
88146
88147
88148
88149
88150
88151
88152
88153
88154
88155
88156
88157
88158
88159
88160
88161
88162
88163
88164
88165
88166
88167
88168
88169
88170
88171
88172
88173
88174
88175
88176
88177
88178
88179
88180
88181
88182
88183
88184
88185
88186
88187
88188
88189
88190
88191
88192
88193
88194
88195
88196
88197
88198
88199
88200
88201
88202
88203
88204
88205
88206
88207
88208
88209
88210
88211
88212
88213
88214
88215
88216
88217
88218
88219
88220
88221
88222
88223
88224
88225
88226
88227
88228
88229
88230
88231
88232
88233
88234
88235
88236
88237
88238
88239
88240
88241
88242
88243
88244
88245
88246
88247
88248
88249
88250
88251
88252
88253
88254
88255
88256
88257
88258
88259
88260
88261
88262
88263
88264
88265
88266
88267
88268
88269
88270
88271
88272
88273
88274
88275
88276
88277
88278
88279
88280
88281
88282
88283
88284
88285
88286
88287
88288
88289
88290
88291
88292
88293
88294
88295
88296
88297
88298
88299
88300
88301
88302
88303
88304
88305
88306
88307
88308
88309
88310
88311
88312
88313
88314
88315
88316
88317
88318
88319
88320
88321
88322
88323
88324
88325
88326
88327
88328
88329
88330
88331
88332
88333
88334
88335
88336
88337
88338
88339
88340
88341
88342
88343
88344
88345
88346
88347
88348
88349
88350
88351
88352
88353
88354
88355
88356
88357
88358
88359
88360
88361
88362
88363
88364
88365
88366
88367
88368
88369
88370
88371
88372
88373
88374
88375
88376
88377
88378
88379
88380
88381
88382
88383
88384
88385
88386
88387
88388
88389
88390
88391
88392
88393
88394
88395
88396
88397
88398
88399
88400
88401
88402
88403
88404
88405
88406
88407
88408
88409
88410
88411
88412
88413
88414
88415
88416
88417
88418
88419
88420
88421
88422
88423
88424
88425
88426
88427
88428
88429
88430
88431
88432
88433
88434
88435
88436
88437
88438
88439
88440
88441
88442
88443
88444
88445
88446
88447
88448
88449
88450
88451
88452
88453
88454
88455
88456
88457
88458
88459
88460
88461
88462
88463
88464
88465
88466
88467
88468
88469
88470
88471
88472
88473
88474
88475
88476
88477
88478
88479
88480
88481
88482
88483
88484
88485
88486
88487
88488
88489
88490
88491
88492
88493
88494
88495
88496
88497
88498
88499
88500
88501
88502
88503
88504
88505
88506
88507
88508
88509
88510
88511
88512
88513
88514
88515
88516
88517
88518
88519
88520
88521
88522
88523
88524
88525
88526
88527
88528
88529
88530
88531
88532
88533
88534
88535
88536
88537
88538
88539
88540
88541
88542
88543
88544
88545
88546
88547
88548
88549
88550
88551
88552
88553
88554
88555
88556
88557
88558
88559
88560
88561
88562
88563
88564
88565
88566
88567
88568
88569
88570
88571
88572
88573
88574
88575
88576
88577
88578
88579
88580
88581
88582
88583
88584
88585
88586
88587
88588
88589
88590
88591
88592
88593
88594
88595
88596
88597
88598
88599
88600
88601
88602
88603
88604
88605
88606
88607
88608
88609
88610
88611
88612
88613
88614
88615
88616
88617
88618
88619
88620
88621
88622
88623
88624
88625
88626
88627
88628
88629
88630
88631
88632
88633
88634
88635
88636
88637
88638
88639
88640
88641
88642
88643
88644
88645
88646
88647
88648
88649
88650
88651
88652
88653
88654
88655
88656
88657
88658
88659
88660
88661
88662
88663
88664
88665
88666
88667
88668
88669
88670
88671
88672
88673
88674
88675
88676
88677
88678
88679
88680
88681
88682
88683
88684
88685
88686
88687
88688
88689
88690
88691
88692
88693
88694
88695
88696
88697
88698
88699
88700
88701
88702
88703
88704
88705
88706
88707
88708
88709
88710
88711
88712
88713
88714
88715
88716
88717
88718
88719
88720
88721
88722
88723
88724
88725
88726
88727
88728
88729
88730
88731
88732
88733
88734
88735
88736
88737
88738
88739
88740
88741
88742
88743
88744
88745
88746
88747
88748
88749
88750
88751
88752
88753
88754
88755
88756
88757
88758
88759
88760
88761
88762
88763
88764
88765
88766
88767
88768
88769
88770
88771
88772
88773
88774
88775
88776
88777
88778
88779
88780
88781
88782
88783
88784
88785
88786
88787
88788
88789
88790
88791
88792
88793
88794
88795
88796
88797
88798
88799
88800
88801
88802
88803
88804
88805
88806
88807
88808
88809
88810
88811
88812
88813
88814
88815
88816
88817
88818
88819
88820
88821
88822
88823
88824
88825
88826
88827
88828
88829
88830
88831
88832
88833
88834
88835
88836
88837
88838
88839
88840
88841
88842
88843
88844
88845
88846
88847
88848
88849
88850
88851
88852
88853
88854
88855
88856
88857
88858
88859
88860
88861
88862
88863
88864
88865
88866
88867
88868
88869
88870
88871
88872
88873
88874
88875
88876
88877
88878
88879
88880
88881
88882
88883
88884
88885
88886
88887
88888
88889
88890
88891
88892
88893
88894
88895
88896
88897
88898
88899
88900
88901
88902
88903
88904
88905
88906
88907
88908
88909
88910
88911
88912
88913
88914
88915
88916
88917
88918
88919
88920
88921
88922
88923
88924
88925
88926
88927
88928
88929
88930
88931
88932
88933
88934
88935
88936
88937
88938
88939
88940
88941
88942
88943
88944
88945
88946
88947
88948
88949
88950
88951
88952
88953
88954
88955
88956
88957
88958
88959
88960
88961
88962
88963
88964
88965
88966
88967
88968
88969
88970
88971
88972
88973
88974
88975
88976
88977
88978
88979
88980
88981
88982
88983
88984
88985
88986
88987
88988
88989
88990
88991
88992
88993
88994
88995
88996
88997
88998
88999
89000
89001
89002
89003
89004
89005
89006
89007
89008
89009
89010
89011
89012
89013
89014
89015
89016
89017
89018
89019
89020
89021
89022
89023
89024
89025
89026
89027
89028
89029
89030
89031
89032
89033
89034
89035
89036
89037
89038
89039
89040
89041
89042
89043
89044
89045
89046
89047
89048
89049
89050
89051
89052
89053
89054
89055
89056
89057
89058
89059
89060
89061
89062
89063
89064
89065
89066
89067
89068
89069
89070
89071
89072
89073
89074
89075
89076
89077
89078
89079
89080
89081
89082
89083
89084
89085
89086
89087
89088
89089
89090
89091
89092
89093
89094
89095
89096
89097
89098
89099
89100
89101
89102
89103
89104
89105
89106
89107
89108
89109
89110
89111
89112
89113
89114
89115
89116
89117
89118
89119
89120
89121
89122
89123
89124
89125
89126
89127
89128
89129
89130
89131
89132
89133
89134
89135
89136
89137
89138
89139
89140
89141
89142
89143
89144
89145
89146
89147
89148
89149
89150
89151
89152
89153
89154
89155
89156
89157
89158
89159
89160
89161
89162
89163
89164
89165
89166
89167
89168
89169
89170
89171
89172
89173
89174
89175
89176
89177
89178
89179
89180
89181
89182
89183
89184
89185
89186
89187
89188
89189
89190
89191
89192
89193
89194
89195
89196
89197
89198
89199
89200
89201
89202
89203
89204
89205
89206
89207
89208
89209
89210
89211
89212
89213
89214
89215
89216
89217
89218
89219
89220
89221
89222
89223
89224
89225
89226
89227
89228
89229
89230
89231
89232
89233
89234
89235
89236
89237
89238
89239
89240
89241
89242
89243
89244
89245
89246
89247
89248
89249
89250
89251
89252
89253
89254
89255
89256
89257
89258
89259
89260
89261
89262
89263
89264
89265
89266
89267
89268
89269
89270
89271
89272
89273
89274
89275
89276
89277
89278
89279
89280
89281
89282
89283
89284
89285
89286
89287
89288
89289
89290
89291
89292
89293
89294
89295
89296
89297
89298
89299
89300
89301
89302
89303
89304
89305
89306
89307
89308
89309
89310
89311
89312
89313
89314
89315
89316
89317
89318
89319
89320
89321
89322
89323
89324
89325
89326
89327
89328
89329
89330
89331
89332
89333
89334
89335
89336
89337
89338
89339
89340
89341
89342
89343
89344
89345
89346
89347
89348
89349
89350
89351
89352
89353
89354
89355
89356
89357
89358
89359
89360
89361
89362
89363
89364
89365
89366
89367
89368
89369
89370
89371
89372
89373
89374
89375
89376
89377
89378
89379
89380
89381
89382
89383
89384
89385
89386
89387
89388
89389
89390
89391
89392
89393
89394
89395
89396
89397
89398
89399
89400
89401
89402
89403
89404
89405
89406
89407
89408
89409
89410
89411
89412
89413
89414
89415
89416
89417
89418
89419
89420
89421
89422
89423
89424
89425
89426
89427
89428
89429
89430
89431
89432
89433
89434
89435
89436
89437
89438
89439
89440
89441
89442
89443
89444
89445
89446
89447
89448
89449
89450
89451
89452
89453
89454
89455
89456
89457
89458
89459
89460
89461
89462
89463
89464
89465
89466
89467
89468
89469
89470
89471
89472
89473
89474
89475
89476
89477
89478
89479
89480
89481
89482
89483
89484
89485
89486
89487
89488
89489
89490
89491
89492
89493
89494
89495
89496
89497
89498
89499
89500
89501
89502
89503
89504
89505
89506
89507
89508
89509
89510
89511
89512
89513
89514
89515
89516
89517
89518
89519
89520
89521
89522
89523
89524
89525
89526
89527
89528
89529
89530
89531
89532
89533
89534
89535
89536
89537
89538
89539
89540
89541
89542
89543
89544
89545
89546
89547
89548
89549
89550
89551
89552
89553
89554
89555
89556
89557
89558
89559
89560
89561
89562
89563
89564
89565
89566
89567
89568
89569
89570
89571
89572
89573
89574
89575
89576
89577
89578
89579
89580
89581
89582
89583
89584
89585
89586
89587
89588
89589
89590
89591
89592
89593
89594
89595
89596
89597
89598
89599
89600
89601
89602
89603
89604
89605
89606
89607
89608
89609
89610
89611
89612
89613
89614
89615
89616
89617
89618
89619
89620
89621
89622
89623
89624
89625
89626
89627
89628
89629
89630
89631
89632
89633
89634
89635
89636
89637
89638
89639
89640
89641
89642
89643
89644
89645
89646
89647
89648
89649
89650
89651
89652
89653
89654
89655
89656
89657
89658
89659
89660
89661
89662
89663
89664
89665
89666
89667
89668
89669
89670
89671
89672
89673
89674
89675
89676
89677
89678
89679
89680
89681
89682
89683
89684
89685
89686
89687
89688
89689
89690
89691
89692
89693
89694
89695
89696
89697
89698
89699
89700
89701
89702
89703
89704
89705
89706
89707
89708
89709
89710
89711
89712
89713
89714
89715
89716
89717
89718
89719
89720
89721
89722
89723
89724
89725
89726
89727
89728
89729
89730
89731
89732
89733
89734
89735
89736
89737
89738
89739
89740
89741
89742
89743
89744
89745
89746
89747
89748
89749
89750
89751
89752
89753
89754
89755
89756
89757
89758
89759
89760
89761
89762
89763
89764
89765
89766
89767
89768
89769
89770
89771
89772
89773
89774
89775
89776
89777
89778
89779
89780
89781
89782
89783
89784
89785
89786
89787
89788
89789
89790
89791
89792
89793
89794
89795
89796
89797
89798
89799
89800
89801
89802
89803
89804
89805
89806
89807
89808
89809
89810
89811
89812
89813
89814
89815
89816
89817
89818
89819
89820
89821
89822
89823
89824
89825
89826
89827
89828
89829
89830
89831
89832
89833
89834
89835
89836
89837
89838
89839
89840
89841
89842
89843
89844
89845
89846
89847
89848
89849
89850
89851
89852
89853
89854
89855
89856
89857
89858
89859
89860
89861
89862
89863
89864
89865
89866
89867
89868
89869
89870
89871
89872
89873
89874
89875
89876
89877
89878
89879
89880
89881
89882
89883
89884
89885
89886
89887
89888
89889
89890
89891
89892
89893
89894
89895
89896
89897
89898
89899
89900
89901
89902
89903
89904
89905
89906
89907
89908
89909
89910
89911
89912
89913
89914
89915
89916
89917
89918
89919
89920
89921
89922
89923
89924
89925
89926
89927
89928
89929
89930
89931
89932
89933
89934
89935
89936
89937
89938
89939
89940
89941
89942
89943
89944
89945
89946
89947
89948
89949
89950
89951
89952
89953
89954
89955
89956
89957
89958
89959
89960
89961
89962
89963
89964
89965
89966
89967
89968
89969
89970
89971
89972
89973
89974
89975
89976
89977
89978
89979
89980
89981
89982
89983
89984
89985
89986
89987
89988
89989
89990
89991
89992
89993
89994
89995
89996
89997
89998
89999
90000
90001
90002
90003
90004
90005
90006
90007
90008
90009
90010
90011
90012
90013
90014
90015
90016
90017
90018
90019
90020
90021
90022
90023
90024
90025
90026
90027
90028
90029
90030
90031
90032
90033
90034
90035
90036
90037
90038
90039
90040
90041
90042
90043
90044
90045
90046
90047
90048
90049
90050
90051
90052
90053
90054
90055
90056
90057
90058
90059
90060
90061
90062
90063
90064
90065
90066
90067
90068
90069
90070
90071
90072
90073
90074
90075
90076
90077
90078
90079
90080
90081
90082
90083
90084
90085
90086
90087
90088
90089
90090
90091
90092
90093
90094
90095
90096
90097
90098
90099
90100
90101
90102
90103
90104
90105
90106
90107
90108
90109
90110
90111
90112
90113
90114
90115
90116
90117
90118
90119
90120
90121
90122
90123
90124
90125
90126
90127
90128
90129
90130
90131
90132
90133
90134
90135
90136
90137
90138
90139
90140
90141
90142
90143
90144
90145
90146
90147
90148
90149
90150
90151
90152
90153
90154
90155
90156
90157
90158
90159
90160
90161
90162
90163
90164
90165
90166
90167
90168
90169
90170
90171
90172
90173
90174
90175
90176
90177
90178
90179
90180
90181
90182
90183
90184
90185
90186
90187
90188
90189
90190
90191
90192
90193
90194
90195
90196
90197
90198
90199
90200
90201
90202
90203
90204
90205
90206
90207
90208
90209
90210
90211
90212
90213
90214
90215
90216
90217
90218
90219
90220
90221
90222
90223
90224
90225
90226
90227
90228
90229
90230
90231
90232
90233
90234
90235
90236
90237
90238
90239
90240
90241
90242
90243
90244
90245
90246
90247
90248
90249
90250
90251
90252
90253
90254
90255
90256
90257
90258
90259
90260
90261
90262
90263
90264
90265
90266
90267
90268
90269
90270
90271
90272
90273
90274
90275
90276
90277
90278
90279
90280
90281
90282
90283
90284
90285
90286
90287
90288
90289
90290
90291
90292
90293
90294
90295
90296
90297
90298
90299
90300
90301
90302
90303
90304
90305
90306
90307
90308
90309
90310
90311
90312
90313
90314
90315
90316
90317
90318
90319
90320
90321
90322
90323
90324
90325
90326
90327
90328
90329
90330
90331
90332
90333
90334
90335
90336
90337
90338
90339
90340
90341
90342
90343
90344
90345
90346
90347
90348
90349
90350
90351
90352
90353
90354
90355
90356
90357
90358
90359
90360
90361
90362
90363
90364
90365
90366
90367
90368
90369
90370
90371
90372
90373
90374
90375
90376
90377
90378
90379
90380
90381
90382
90383
90384
90385
90386
90387
90388
90389
90390
90391
90392
90393
90394
90395
90396
90397
90398
90399
90400
90401
90402
90403
90404
90405
90406
90407
90408
90409
90410
90411
90412
90413
90414
90415
90416
90417
90418
90419
90420
90421
90422
90423
90424
90425
90426
90427
90428
90429
90430
90431
90432
90433
90434
90435
90436
90437
90438
90439
90440
90441
90442
90443
90444
90445
90446
90447
90448
90449
90450
90451
90452
90453
90454
90455
90456
90457
90458
90459
90460
90461
90462
90463
90464
90465
90466
90467
90468
90469
90470
90471
90472
90473
90474
90475
90476
90477
90478
90479
90480
90481
90482
90483
90484
90485
90486
90487
90488
90489
90490
90491
90492
90493
90494
90495
90496
90497
90498
90499
90500
90501
90502
90503
90504
90505
90506
90507
90508
90509
90510
90511
90512
90513
90514
90515
90516
90517
90518
90519
90520
90521
90522
90523
90524
90525
90526
90527
90528
90529
90530
90531
90532
90533
90534
90535
90536
90537
90538
90539
90540
90541
90542
90543
90544
90545
90546
90547
90548
90549
90550
90551
90552
90553
90554
90555
90556
90557
90558
90559
90560
90561
90562
90563
90564
90565
90566
90567
90568
90569
90570
90571
90572
90573
90574
90575
90576
90577
90578
90579
90580
90581
90582
90583
90584
90585
90586
90587
90588
90589
90590
90591
90592
90593
90594
90595
90596
90597
90598
90599
90600
90601
90602
90603
90604
90605
90606
90607
90608
90609
90610
90611
90612
90613
90614
90615
90616
90617
90618
90619
90620
90621
90622
90623
90624
90625
90626
90627
90628
90629
90630
90631
90632
90633
90634
90635
90636
90637
90638
90639
90640
90641
90642
90643
90644
90645
90646
90647
90648
90649
90650
90651
90652
90653
90654
90655
90656
90657
90658
90659
90660
90661
90662
90663
90664
90665
90666
90667
90668
90669
90670
90671
90672
90673
90674
90675
90676
90677
90678
90679
90680
90681
90682
90683
90684
90685
90686
90687
90688
90689
90690
90691
90692
90693
90694
90695
90696
90697
90698
90699
90700
90701
90702
90703
90704
90705
90706
90707
90708
90709
90710
90711
90712
90713
90714
90715
90716
90717
90718
90719
90720
90721
90722
90723
90724
90725
90726
90727
90728
90729
90730
90731
90732
90733
90734
90735
90736
90737
90738
90739
90740
90741
90742
90743
90744
90745
90746
90747
90748
90749
90750
90751
90752
90753
90754
90755
90756
90757
90758
90759
90760
90761
90762
90763
90764
90765
90766
90767
90768
90769
90770
90771
90772
90773
90774
90775
90776
90777
90778
90779
90780
90781
90782
90783
90784
90785
90786
90787
90788
90789
90790
90791
90792
90793
90794
90795
90796
90797
90798
90799
90800
90801
90802
90803
90804
90805
90806
90807
90808
90809
90810
90811
90812
90813
90814
90815
90816
90817
90818
90819
90820
90821
90822
90823
90824
90825
90826
90827
90828
90829
90830
90831
90832
90833
90834
90835
90836
90837
90838
90839
90840
90841
90842
90843
90844
90845
90846
90847
90848
90849
90850
90851
90852
90853
90854
90855
90856
90857
90858
90859
90860
90861
90862
90863
90864
90865
90866
90867
90868
90869
90870
90871
90872
90873
90874
90875
90876
90877
90878
90879
90880
90881
90882
90883
90884
90885
90886
90887
90888
90889
90890
90891
90892
90893
90894
90895
90896
90897
90898
90899
90900
90901
90902
90903
90904
90905
90906
90907
90908
90909
90910
90911
90912
90913
90914
90915
90916
90917
90918
90919
90920
90921
90922
90923
90924
90925
90926
90927
90928
90929
90930
90931
90932
90933
90934
90935
90936
90937
90938
90939
90940
90941
90942
90943
90944
90945
90946
90947
90948
90949
90950
90951
90952
90953
90954
90955
90956
90957
90958
90959
90960
90961
90962
90963
90964
90965
90966
90967
90968
90969
90970
90971
90972
90973
90974
90975
90976
90977
90978
90979
90980
90981
90982
90983
90984
90985
90986
90987
90988
90989
90990
90991
90992
90993
90994
90995
90996
90997
90998
90999
91000
91001
91002
91003
91004
91005
91006
91007
91008
91009
91010
91011
91012
91013
91014
91015
91016
91017
91018
91019
91020
91021
91022
91023
91024
91025
91026
91027
91028
91029
91030
91031
91032
91033
91034
91035
91036
91037
91038
91039
91040
91041
91042
91043
91044
91045
91046
91047
91048
91049
91050
91051
91052
91053
91054
91055
91056
91057
91058
91059
91060
91061
91062
91063
91064
91065
91066
91067
91068
91069
91070
91071
91072
91073
91074
91075
91076
91077
91078
91079
91080
91081
91082
91083
91084
91085
91086
91087
91088
91089
91090
91091
91092
91093
91094
91095
91096
91097
91098
91099
91100
91101
91102
91103
91104
91105
91106
91107
91108
91109
91110
91111
91112
91113
91114
91115
91116
91117
91118
91119
91120
91121
91122
91123
91124
91125
91126
91127
91128
91129
91130
91131
91132
91133
91134
91135
91136
91137
91138
91139
91140
91141
91142
91143
91144
91145
91146
91147
91148
91149
91150
91151
91152
91153
91154
91155
91156
91157
91158
91159
91160
91161
91162
91163
91164
91165
91166
91167
91168
91169
91170
91171
91172
91173
91174
91175
91176
91177
91178
91179
91180
91181
91182
91183
91184
91185
91186
91187
91188
91189
91190
91191
91192
91193
91194
91195
91196
91197
91198
91199
91200
91201
91202
91203
91204
91205
91206
91207
91208
91209
91210
91211
91212
91213
91214
91215
91216
91217
91218
91219
91220
91221
91222
91223
91224
91225
91226
91227
91228
91229
91230
91231
91232
91233
91234
91235
91236
91237
91238
91239
91240
91241
91242
91243
91244
91245
91246
91247
91248
91249
91250
91251
91252
91253
91254
91255
91256
91257
91258
91259
91260
91261
91262
91263
91264
91265
91266
91267
91268
91269
91270
91271
91272
91273
91274
91275
91276
91277
91278
91279
91280
91281
91282
91283
91284
91285
91286
91287
91288
91289
91290
91291
91292
91293
91294
91295
91296
91297
91298
91299
91300
91301
91302
91303
91304
91305
91306
91307
91308
91309
91310
91311
91312
91313
91314
91315
91316
91317
91318
91319
91320
91321
91322
91323
91324
91325
91326
91327
91328
91329
91330
91331
91332
91333
91334
91335
91336
91337
91338
91339
91340
91341
91342
91343
91344
91345
91346
91347
91348
91349
91350
91351
91352
91353
91354
91355
91356
91357
91358
91359
91360
91361
91362
91363
91364
91365
91366
91367
91368
91369
91370
91371
91372
91373
91374
91375
91376
91377
91378
91379
91380
91381
91382
91383
91384
91385
91386
91387
91388
91389
91390
91391
91392
91393
91394
91395
91396
91397
91398
91399
91400
91401
91402
91403
91404
91405
91406
91407
91408
91409
91410
91411
91412
91413
91414
91415
91416
91417
91418
91419
91420
91421
91422
91423
91424
91425
91426
91427
91428
91429
91430
91431
91432
91433
91434
91435
91436
91437
91438
91439
91440
91441
91442
91443
91444
91445
91446
91447
91448
91449
91450
91451
91452
91453
91454
91455
91456
91457
91458
91459
91460
91461
91462
91463
91464
91465
91466
91467
91468
91469
91470
91471
91472
91473
91474
91475
91476
91477
91478
91479
91480
91481
91482
91483
91484
91485
91486
91487
91488
91489
91490
91491
91492
91493
91494
91495
91496
91497
91498
91499
91500
91501
91502
91503
91504
91505
91506
91507
91508
91509
91510
91511
91512
91513
91514
91515
91516
91517
91518
91519
91520
91521
91522
91523
91524
91525
91526
91527
91528
91529
91530
91531
91532
91533
91534
91535
91536
91537
91538
91539
91540
91541
91542
91543
91544
91545
91546
91547
91548
91549
91550
91551
91552
91553
91554
91555
91556
91557
91558
91559
91560
91561
91562
91563
91564
91565
91566
91567
91568
91569
91570
91571
91572
91573
91574
91575
91576
91577
91578
91579
91580
91581
91582
91583
91584
91585
91586
91587
91588
91589
91590
91591
91592
91593
91594
91595
91596
91597
91598
91599
91600
91601
91602
91603
91604
91605
91606
91607
91608
91609
91610
91611
91612
91613
91614
91615
91616
91617
91618
91619
91620
91621
91622
91623
91624
91625
91626
91627
91628
91629
91630
91631
91632
91633
91634
91635
91636
91637
91638
91639
91640
91641
91642
91643
91644
91645
91646
91647
91648
91649
91650
91651
91652
91653
91654
91655
91656
91657
91658
91659
91660
91661
91662
91663
91664
91665
91666
91667
91668
91669
91670
91671
91672
91673
91674
91675
91676
91677
91678
91679
91680
91681
91682
91683
91684
91685
91686
91687
91688
91689
91690
91691
91692
91693
91694
91695
91696
91697
91698
91699
91700
91701
91702
91703
91704
91705
91706
91707
91708
91709
91710
91711
91712
91713
91714
91715
91716
91717
91718
91719
91720
91721
91722
91723
91724
91725
91726
91727
91728
91729
91730
91731
91732
91733
91734
91735
91736
91737
91738
91739
91740
91741
91742
91743
91744
91745
91746
91747
91748
91749
91750
91751
91752
91753
91754
91755
91756
91757
91758
91759
91760
91761
91762
91763
91764
91765
91766
91767
91768
91769
91770
91771
91772
91773
91774
91775
91776
91777
91778
91779
91780
91781
91782
91783
91784
91785
91786
91787
91788
91789
91790
91791
91792
91793
91794
91795
91796
91797
91798
91799
91800
91801
91802
91803
91804
91805
91806
91807
91808
91809
91810
91811
91812
91813
91814
91815
91816
91817
91818
91819
91820
91821
91822
91823
91824
91825
91826
91827
91828
91829
91830
91831
91832
91833
91834
91835
91836
91837
91838
91839
91840
91841
91842
91843
91844
91845
91846
91847
91848
91849
91850
91851
91852
91853
91854
91855
91856
91857
91858
91859
91860
91861
91862
91863
91864
91865
91866
91867
91868
91869
91870
91871
91872
91873
91874
91875
91876
91877
91878
91879
91880
91881
91882
91883
91884
91885
91886
91887
91888
91889
91890
91891
91892
91893
91894
91895
91896
91897
91898
91899
91900
91901
91902
91903
91904
91905
91906
91907
91908
91909
91910
91911
91912
91913
91914
91915
91916
91917
91918
91919
91920
91921
91922
91923
91924
91925
91926
91927
91928
91929
91930
91931
91932
91933
91934
91935
91936
91937
91938
91939
91940
91941
91942
91943
91944
91945
91946
91947
91948
91949
91950
91951
91952
91953
91954
91955
91956
91957
91958
91959
91960
91961
91962
91963
91964
91965
91966
91967
91968
91969
91970
91971
91972
91973
91974
91975
91976
91977
91978
91979
91980
91981
91982
91983
91984
91985
91986
91987
91988
91989
91990
91991
91992
91993
91994
91995
91996
91997
91998
91999
92000
92001
92002
92003
92004
92005
92006
92007
92008
92009
92010
92011
92012
92013
92014
92015
92016
92017
92018
92019
92020
92021
92022
92023
92024
92025
92026
92027
92028
92029
92030
92031
92032
92033
92034
92035
92036
92037
92038
92039
92040
92041
92042
92043
92044
92045
92046
92047
92048
92049
92050
92051
92052
92053
92054
92055
92056
92057
92058
92059
92060
92061
92062
92063
92064
92065
92066
92067
92068
92069
92070
92071
92072
92073
92074
92075
92076
92077
92078
92079
92080
92081
92082
92083
92084
92085
92086
92087
92088
92089
92090
92091
92092
92093
92094
92095
92096
92097
92098
92099
92100
92101
92102
92103
92104
92105
92106
92107
92108
92109
92110
92111
92112
92113
92114
92115
92116
92117
92118
92119
92120
92121
92122
92123
92124
92125
92126
92127
92128
92129
92130
92131
92132
92133
92134
92135
92136
92137
92138
92139
92140
92141
92142
92143
92144
92145
92146
92147
92148
92149
92150
92151
92152
92153
92154
92155
92156
92157
92158
92159
92160
92161
92162
92163
92164
92165
92166
92167
92168
92169
92170
92171
92172
92173
92174
92175
92176
92177
92178
92179
92180
92181
92182
92183
92184
92185
92186
92187
92188
92189
92190
92191
92192
92193
92194
92195
92196
92197
92198
92199
92200
92201
92202
92203
92204
92205
92206
92207
92208
92209
92210
92211
92212
92213
92214
92215
92216
92217
92218
92219
92220
92221
92222
92223
92224
92225
92226
92227
92228
92229
92230
92231
92232
92233
92234
92235
92236
92237
92238
92239
92240
92241
92242
92243
92244
92245
92246
92247
92248
92249
92250
92251
92252
92253
92254
92255
92256
92257
92258
92259
92260
92261
92262
92263
92264
92265
92266
92267
92268
92269
92270
92271
92272
92273
92274
92275
92276
92277
92278
92279
92280
92281
92282
92283
92284
92285
92286
92287
92288
92289
92290
92291
92292
92293
92294
92295
92296
92297
92298
92299
92300
92301
92302
92303
92304
92305
92306
92307
92308
92309
92310
92311
92312
92313
92314
92315
92316
92317
92318
92319
92320
92321
92322
92323
92324
92325
92326
92327
92328
92329
92330
92331
92332
92333
92334
92335
92336
92337
92338
92339
92340
92341
92342
92343
92344
92345
92346
92347
92348
92349
92350
92351
92352
92353
92354
92355
92356
92357
92358
92359
92360
92361
92362
92363
92364
92365
92366
92367
92368
92369
92370
92371
92372
92373
92374
92375
92376
92377
92378
92379
92380
92381
92382
92383
92384
92385
92386
92387
92388
92389
92390
92391
92392
92393
92394
92395
92396
92397
92398
92399
92400
92401
92402
92403
92404
92405
92406
92407
92408
92409
92410
92411
92412
92413
92414
92415
92416
92417
92418
92419
92420
92421
92422
92423
92424
92425
92426
92427
92428
92429
92430
92431
92432
92433
92434
92435
92436
92437
92438
92439
92440
92441
92442
92443
92444
92445
92446
92447
92448
92449
92450
92451
92452
92453
92454
92455
92456
92457
92458
92459
92460
92461
92462
92463
92464
92465
92466
92467
92468
92469
92470
92471
92472
92473
92474
92475
92476
92477
92478
92479
92480
92481
92482
92483
92484
92485
92486
92487
92488
92489
92490
92491
92492
92493
92494
92495
92496
92497
92498
92499
92500
92501
92502
92503
92504
92505
92506
92507
92508
92509
92510
92511
92512
92513
92514
92515
92516
92517
92518
92519
92520
92521
92522
92523
92524
92525
92526
92527
92528
92529
92530
92531
92532
92533
92534
92535
92536
92537
92538
92539
92540
92541
92542
92543
92544
92545
92546
92547
92548
92549
92550
92551
92552
92553
92554
92555
92556
92557
92558
92559
92560
92561
92562
92563
92564
92565
92566
92567
92568
92569
92570
92571
92572
92573
92574
92575
92576
92577
92578
92579
92580
92581
92582
92583
92584
92585
92586
92587
92588
92589
92590
92591
92592
92593
92594
92595
92596
92597
92598
92599
92600
92601
92602
92603
92604
92605
92606
92607
92608
92609
92610
92611
92612
92613
92614
92615
92616
92617
92618
92619
92620
92621
92622
92623
92624
92625
92626
92627
92628
92629
92630
92631
92632
92633
92634
92635
92636
92637
92638
92639
92640
92641
92642
92643
92644
92645
92646
92647
92648
92649
92650
92651
92652
92653
92654
92655
92656
92657
92658
92659
92660
92661
92662
92663
92664
92665
92666
92667
92668
92669
92670
92671
92672
92673
92674
92675
92676
92677
92678
92679
92680
92681
92682
92683
92684
92685
92686
92687
92688
92689
92690
92691
92692
92693
92694
92695
92696
92697
92698
92699
92700
92701
92702
92703
92704
92705
92706
92707
92708
92709
92710
92711
92712
92713
92714
92715
92716
92717
92718
92719
92720
92721
92722
92723
92724
92725
92726
92727
92728
92729
92730
92731
92732
92733
92734
92735
92736
92737
92738
92739
92740
92741
92742
92743
92744
92745
92746
92747
92748
92749
92750
92751
92752
92753
92754
92755
92756
92757
92758
92759
92760
92761
92762
92763
92764
92765
92766
92767
92768
92769
92770
92771
92772
92773
92774
92775
92776
92777
92778
92779
92780
92781
92782
92783
92784
92785
92786
92787
92788
92789
92790
92791
92792
92793
92794
92795
92796
92797
92798
92799
92800
92801
92802
92803
92804
92805
92806
92807
92808
92809
92810
92811
92812
92813
92814
92815
92816
92817
92818
92819
92820
92821
92822
92823
92824
92825
92826
92827
92828
92829
92830
92831
92832
92833
92834
92835
92836
92837
92838
92839
92840
92841
92842
92843
92844
92845
92846
92847
92848
92849
92850
92851
92852
92853
92854
92855
92856
92857
92858
92859
92860
92861
92862
92863
92864
92865
92866
92867
92868
92869
92870
92871
92872
92873
92874
92875
92876
92877
92878
92879
92880
92881
92882
92883
92884
92885
92886
92887
92888
92889
92890
92891
92892
92893
92894
92895
92896
92897
92898
92899
92900
92901
92902
92903
92904
92905
92906
92907
92908
92909
92910
92911
92912
92913
92914
92915
92916
92917
92918
92919
92920
92921
92922
92923
92924
92925
92926
92927
92928
92929
92930
92931
92932
92933
92934
92935
92936
92937
92938
92939
92940
92941
92942
92943
92944
92945
92946
92947
92948
92949
92950
92951
92952
92953
92954
92955
92956
92957
92958
92959
92960
92961
92962
92963
92964
92965
92966
92967
92968
92969
92970
92971
92972
92973
92974
92975
92976
92977
92978
92979
92980
92981
92982
92983
92984
92985
92986
92987
92988
92989
92990
92991
92992
92993
92994
92995
92996
92997
92998
92999
93000
93001
93002
93003
93004
93005
93006
93007
93008
93009
93010
93011
93012
93013
93014
93015
93016
93017
93018
93019
93020
93021
93022
93023
93024
93025
93026
93027
93028
93029
93030
93031
93032
93033
93034
93035
93036
93037
93038
93039
93040
93041
93042
93043
93044
93045
93046
93047
93048
93049
93050
93051
93052
93053
93054
93055
93056
93057
93058
93059
93060
93061
93062
93063
93064
93065
93066
93067
93068
93069
93070
93071
93072
93073
93074
93075
93076
93077
93078
93079
93080
93081
93082
93083
93084
93085
93086
93087
93088
93089
93090
93091
93092
93093
93094
93095
93096
93097
93098
93099
93100
93101
93102
93103
93104
93105
93106
93107
93108
93109
93110
93111
93112
93113
93114
93115
93116
93117
93118
93119
93120
93121
93122
93123
93124
93125
93126
93127
93128
93129
93130
93131
93132
93133
93134
93135
93136
93137
93138
93139
93140
93141
93142
93143
93144
93145
93146
93147
93148
93149
93150
93151
93152
93153
93154
93155
93156
93157
93158
93159
93160
93161
93162
93163
93164
93165
93166
93167
93168
93169
93170
93171
93172
93173
93174
93175
93176
93177
93178
93179
93180
93181
93182
93183
93184
93185
93186
93187
93188
93189
93190
93191
93192
93193
93194
93195
93196
93197
93198
93199
93200
93201
93202
93203
93204
93205
93206
93207
93208
93209
93210
93211
93212
93213
93214
93215
93216
93217
93218
93219
93220
93221
93222
93223
93224
93225
93226
93227
93228
93229
93230
93231
93232
93233
93234
93235
93236
93237
93238
93239
93240
93241
93242
93243
93244
93245
93246
93247
93248
93249
93250
93251
93252
93253
93254
93255
93256
93257
93258
93259
93260
93261
93262
93263
93264
93265
93266
93267
93268
93269
93270
93271
93272
93273
93274
93275
93276
93277
93278
93279
93280
93281
93282
93283
93284
93285
93286
93287
93288
93289
93290
93291
93292
93293
93294
93295
93296
93297
93298
93299
93300
93301
93302
93303
93304
93305
93306
93307
93308
93309
93310
93311
93312
93313
93314
93315
93316
93317
93318
93319
93320
93321
93322
93323
93324
93325
93326
93327
93328
93329
93330
93331
93332
93333
93334
93335
93336
93337
93338
93339
93340
93341
93342
93343
93344
93345
93346
93347
93348
93349
93350
93351
93352
93353
93354
93355
93356
93357
93358
93359
93360
93361
93362
93363
93364
93365
93366
93367
93368
93369
93370
93371
93372
93373
93374
93375
93376
93377
93378
93379
93380
93381
93382
93383
93384
93385
93386
93387
93388
93389
93390
93391
93392
93393
93394
93395
93396
93397
93398
93399
93400
93401
93402
93403
93404
93405
93406
93407
93408
93409
93410
93411
93412
93413
93414
93415
93416
93417
93418
93419
93420
93421
93422
93423
93424
93425
93426
93427
93428
93429
93430
93431
93432
93433
93434
93435
93436
93437
93438
93439
93440
93441
93442
93443
93444
93445
93446
93447
93448
93449
93450
93451
93452
93453
93454
93455
93456
93457
93458
93459
93460
93461
93462
93463
93464
93465
93466
93467
93468
93469
93470
93471
93472
93473
93474
93475
93476
93477
93478
93479
93480
93481
93482
93483
93484
93485
93486
93487
93488
93489
93490
93491
93492
93493
93494
93495
93496
93497
93498
93499
93500
93501
93502
93503
93504
93505
93506
93507
93508
93509
93510
93511
93512
93513
93514
93515
93516
93517
93518
93519
93520
93521
93522
93523
93524
93525
93526
93527
93528
93529
93530
93531
93532
93533
93534
93535
93536
93537
93538
93539
93540
93541
93542
93543
93544
93545
93546
93547
93548
93549
93550
93551
93552
93553
93554
93555
93556
93557
93558
93559
93560
93561
93562
93563
93564
93565
93566
93567
93568
93569
93570
93571
93572
93573
93574
93575
93576
93577
93578
93579
93580
93581
93582
93583
93584
93585
93586
93587
93588
93589
93590
93591
93592
93593
93594
93595
93596
93597
93598
93599
93600
93601
93602
93603
93604
93605
93606
93607
93608
93609
93610
93611
93612
93613
93614
93615
93616
93617
93618
93619
93620
93621
93622
93623
93624
93625
93626
93627
93628
93629
93630
93631
93632
93633
93634
93635
93636
93637
93638
93639
93640
93641
93642
93643
93644
93645
93646
93647
93648
93649
93650
93651
93652
93653
93654
93655
93656
93657
93658
93659
93660
93661
93662
93663
93664
93665
93666
93667
93668
93669
93670
93671
93672
93673
93674
93675
93676
93677
93678
93679
93680
93681
93682
93683
93684
93685
93686
93687
93688
93689
93690
93691
93692
93693
93694
93695
93696
93697
93698
93699
93700
93701
93702
93703
93704
93705
93706
93707
93708
93709
93710
93711
93712
93713
93714
93715
93716
93717
93718
93719
93720
93721
93722
93723
93724
93725
93726
93727
93728
93729
93730
93731
93732
93733
93734
93735
93736
93737
93738
93739
93740
93741
93742
93743
93744
93745
93746
93747
93748
93749
93750
93751
93752
93753
93754
93755
93756
93757
93758
93759
93760
93761
93762
93763
93764
93765
93766
93767
93768
93769
93770
93771
93772
93773
93774
93775
93776
93777
93778
93779
93780
93781
93782
93783
93784
93785
93786
93787
93788
93789
93790
93791
93792
93793
93794
93795
93796
93797
93798
93799
93800
93801
93802
93803
93804
93805
93806
93807
93808
93809
93810
93811
93812
93813
93814
93815
93816
93817
93818
93819
93820
93821
93822
93823
93824
93825
93826
93827
93828
93829
93830
93831
93832
93833
93834
93835
93836
93837
93838
93839
93840
93841
93842
93843
93844
93845
93846
93847
93848
93849
93850
93851
93852
93853
93854
93855
93856
93857
93858
93859
93860
93861
93862
93863
93864
93865
93866
93867
93868
93869
93870
93871
93872
93873
93874
93875
93876
93877
93878
93879
93880
93881
93882
93883
93884
93885
93886
93887
93888
93889
93890
93891
93892
93893
93894
93895
93896
93897
93898
93899
93900
93901
93902
93903
93904
93905
93906
93907
93908
93909
93910
93911
93912
93913
93914
93915
93916
93917
93918
93919
93920
93921
93922
93923
93924
93925
93926
93927
93928
93929
93930
93931
93932
93933
93934
93935
93936
93937
93938
93939
93940
93941
93942
93943
93944
93945
93946
93947
93948
93949
93950
93951
93952
93953
93954
93955
93956
93957
93958
93959
93960
93961
93962
93963
93964
93965
93966
93967
93968
93969
93970
93971
93972
93973
93974
93975
93976
93977
93978
93979
93980
93981
93982
93983
93984
93985
93986
93987
93988
93989
93990
93991
93992
93993
93994
93995
93996
93997
93998
93999
94000
94001
94002
94003
94004
94005
94006
94007
94008
94009
94010
94011
94012
94013
94014
94015
94016
94017
94018
94019
94020
94021
94022
94023
94024
94025
94026
94027
94028
94029
94030
94031
94032
94033
94034
94035
94036
94037
94038
94039
94040
94041
94042
94043
94044
94045
94046
94047
94048
94049
94050
94051
94052
94053
94054
94055
94056
94057
94058
94059
94060
94061
94062
94063
94064
94065
94066
94067
94068
94069
94070
94071
94072
94073
94074
94075
94076
94077
94078
94079
94080
94081
94082
94083
94084
94085
94086
94087
94088
94089
94090
94091
94092
94093
94094
94095
94096
94097
94098
94099
94100
94101
94102
94103
94104
94105
94106
94107
94108
94109
94110
94111
94112
94113
94114
94115
94116
94117
94118
94119
94120
94121
94122
94123
94124
94125
94126
94127
94128
94129
94130
94131
94132
94133
94134
94135
94136
94137
94138
94139
94140
94141
94142
94143
94144
94145
94146
94147
94148
94149
94150
94151
94152
94153
94154
94155
94156
94157
94158
94159
94160
94161
94162
94163
94164
94165
94166
94167
94168
94169
94170
94171
94172
94173
94174
94175
94176
94177
94178
94179
94180
94181
94182
94183
94184
94185
94186
94187
94188
94189
94190
94191
94192
94193
94194
94195
94196
94197
94198
94199
94200
94201
94202
94203
94204
94205
94206
94207
94208
94209
94210
94211
94212
94213
94214
94215
94216
94217
94218
94219
94220
94221
94222
94223
94224
94225
94226
94227
94228
94229
94230
94231
94232
94233
94234
94235
94236
94237
94238
94239
94240
94241
94242
94243
94244
94245
94246
94247
94248
94249
94250
94251
94252
94253
94254
94255
94256
94257
94258
94259
94260
94261
94262
94263
94264
94265
94266
94267
94268
94269
94270
94271
94272
94273
94274
94275
94276
94277
94278
94279
94280
94281
94282
94283
94284
94285
94286
94287
94288
94289
94290
94291
94292
94293
94294
94295
94296
94297
94298
94299
94300
94301
94302
94303
94304
94305
94306
94307
94308
94309
94310
94311
94312
94313
94314
94315
94316
94317
94318
94319
94320
94321
94322
94323
94324
94325
94326
94327
94328
94329
94330
94331
94332
94333
94334
94335
94336
94337
94338
94339
94340
94341
94342
94343
94344
94345
94346
94347
94348
94349
94350
94351
94352
94353
94354
94355
94356
94357
94358
94359
94360
94361
94362
94363
94364
94365
94366
94367
94368
94369
94370
94371
94372
94373
94374
94375
94376
94377
94378
94379
94380
94381
94382
94383
94384
94385
94386
94387
94388
94389
94390
94391
94392
94393
94394
94395
94396
94397
94398
94399
94400
94401
94402
94403
94404
94405
94406
94407
94408
94409
94410
94411
94412
94413
94414
94415
94416
94417
94418
94419
94420
94421
94422
94423
94424
94425
94426
94427
94428
94429
94430
94431
94432
94433
94434
94435
94436
94437
94438
94439
94440
94441
94442
94443
94444
94445
94446
94447
94448
94449
94450
94451
94452
94453
94454
94455
94456
94457
94458
94459
94460
94461
94462
94463
94464
94465
94466
94467
94468
94469
94470
94471
94472
94473
94474
94475
94476
94477
94478
94479
94480
94481
94482
94483
94484
94485
94486
94487
94488
94489
94490
94491
94492
94493
94494
94495
94496
94497
94498
94499
94500
94501
94502
94503
94504
94505
94506
94507
94508
94509
94510
94511
94512
94513
94514
94515
94516
94517
94518
94519
94520
94521
94522
94523
94524
94525
94526
94527
94528
94529
94530
94531
94532
94533
94534
94535
94536
94537
94538
94539
94540
94541
94542
94543
94544
94545
94546
94547
94548
94549
94550
94551
94552
94553
94554
94555
94556
94557
94558
94559
94560
94561
94562
94563
94564
94565
94566
94567
94568
94569
94570
94571
94572
94573
94574
94575
94576
94577
94578
94579
94580
94581
94582
94583
94584
94585
94586
94587
94588
94589
94590
94591
94592
94593
94594
94595
94596
94597
94598
94599
94600
94601
94602
94603
94604
94605
94606
94607
94608
94609
94610
94611
94612
94613
94614
94615
94616
94617
94618
94619
94620
94621
94622
94623
94624
94625
94626
94627
94628
94629
94630
94631
94632
94633
94634
94635
94636
94637
94638
94639
94640
94641
94642
94643
94644
94645
94646
94647
94648
94649
94650
94651
94652
94653
94654
94655
94656
94657
94658
94659
94660
94661
94662
94663
94664
94665
94666
94667
94668
94669
94670
94671
94672
94673
94674
94675
94676
94677
94678
94679
94680
94681
94682
94683
94684
94685
94686
94687
94688
94689
94690
94691
94692
94693
94694
;;; s7 test suite
;;;
;;; sources include 
;;;   clisp test suite
;;;   sbcl test suite
;;;   Paul Dietz's CL test suite (gcl/ansi-tests/*)
;;;   R Kelsey, W Clinger, and J Rees r5rs.html (and r6rs.html)
;;;   A Jaffer's r4rstest.scm (the inspiration for this...)
;;;   guile test suite
;;;   gauche test suite
;;;   sacla test suite
;;;   Kent Dybvig's "The Scheme Programming Language"
;;;   Brad Lucier and Peter Bex
;;;   GSL tests
;;;   Abramowitz and Stegun, "Handbook of Mathematical Functions"
;;;   Weisstein, "Encyclopedia of Mathematics"
;;;   the arprec package of David Bailey et al
;;;   Maxima, William Schelter et al
;;;   H Cohen, "A Course in Computational Algebraic Number Theory"
;;;   N Higham, "Accuracy and Stability of Numerical Algorithms"
;;;   various mailing lists and websites (see individual cases below)

(define full-test #f) ; this includes some time-consuming stuff
(define with-bignums (provided? 'gmp))  ; scheme number has any number of bits
					; we assume s7_double is double, and s7_int is long long int
                                        ;   a few of the bignum tests assume the default bignum-precision is 128

(define with-complex (provided? 'complex-numbers))
(define with-windows (provided? 'windows))
(if (not (defined? 's7test-exits)) (define s7test-exits #t))
(define asan-flags "") ;" -fsanitize=address -fsanitize=bounds ")

;;; ---------------- pure-s7 ----------------
(define pure-s7 (provided? 'pure-s7))
(when pure-s7
  (define (make-polar mag ang)
    (if (and (real? mag) (real? ang))
	(complex (* mag (cos ang)) (* mag (sin ang)))
	(error 'wrong-type-arg "make-polar args should be real")))
  (define make-rectangular complex)

  (define (char-ci=? . chars) (apply char=? (map char-upcase chars)))
  (define (char-ci<=? . chars) (apply char<=? (map char-upcase chars)))
  (define (char-ci>=? . chars) (apply char>=? (map char-upcase chars)))
  (define (char-ci<? . chars) (apply char<? (map char-upcase chars)))
  (define (char-ci>? . chars) (apply char>? (map char-upcase chars)))
  
  (define (string-ci=? . strs) (apply string=? (map string-upcase strs)))
  (define (string-ci<=? . strs) (apply string<=? (map string-upcase strs)))
  (define (string-ci>=? . strs) (apply string>=? (map string-upcase strs)))
  (define (string-ci<? . strs) (apply string<? (map string-upcase strs)))
  (define (string-ci>? . strs) (apply string>? (map string-upcase strs)))

  (define (list->string lst) (apply string lst))
  (define (list->vector lst) (apply vector lst))

  (define (let->list e)
    (if (let? e)
	(reverse! (map values e))
	(error 'wrong-type-arg "let->list argument should be an environment: ~A" str)))

  (define* (string->list str (start 0) end)
    (if (and (string? str)
	     (integer? start)
	     (not (negative? start))
	     (or (not end)
		 (and (integer? end)
		      (>= end start))))
	(map values (substring str start (or end (length str))))
	(error 'wrong-type-arg "string->list argument should be a string: ~A" str)))

  (define (string-copy str)
    (if (string? str)
	(copy str)
	(if (openlet? str)
	    ((let-ref str 'string-copy) str)
	    (error 'wrong-type-arg "string-copy argument should be a string: ~A" str))))
  
  (define (string-length str)
    (if (string? str)
	(length str)
	(if (openlet? str)
	    ((let-ref str 'string-length) str)
	    (error 'wrong-type-arg "string-length argument should be a string: ~A" str))))
  
  (define (string-fill! str chr . args)
    (if (string? str)
	(apply fill! str chr args)
	(if (openlet? str)
	    (apply (let-ref str 'string-fill!) str chr args)
	    (error 'wrong-type-arg "string-fill! argument should be a string: ~A" str))))
  
  (define* (vector->list vect (start 0) end)
    (if (and (vector? vect)
	     (integer? start)
	     (not (negative? start))
	     (or (not end)
		 (and (integer? end)
		      (>= end start))))
	(if start
	    (let ((stop (or end (length vect))))
	      (if (= start stop)
		  ()
		  (map values (make-shared-vector vect (list (- stop start)) start))))
	    (map values vect))
	(error 'wrong-type-arg "vector->list argument should be a vector: ~A" vect)))

  (define (vector-length vect)
    (if (vector? vect)
	(length vect)
	(error 'wrong-type-arg "vector-length argument should be a vector: ~A" vect)))
  
  (define (vector-fill! vect val . args)
    (if (vector? vect)
	(apply fill! vect val args)
	(error 'wrong-type-arg "vector-fill! argument should be a vector: ~A" str)))
  
  (define (vector-append . args)
    (if (null? args)
	#()
	(if (vector? (car args))
	    (apply append args)
	    (error 'wrong-type-arg "vector-append arguments should be vectors: ~A" args))))
  
  (define* (char-ready? p)
    (and p (not (input-port? p))
	 (error 'wrong-type-arg "char-ready? arg should be an input port")))

  (define (set-current-output-port port) (error 'undefined-function "set-current-output-port is not in pure-s7"))
  (define (set-current-input-port port) (error 'undefined-function "set-current-input-port is not in pure-s7"))

  (define (exact? n) 
    (if (number? n)
	(rational? n)
	(if (openlet? n)
	    ((let-ref n 'exact?) n)
	    (error 'wrong-type-arg "exact? argument should be a number: ~A" n))))

  (define (inexact? x) 
    (if (number? x)
	(not (rational? x))
	(if (openlet? n)
	    ((let-ref n 'inexact?) n)
	    (error 'wrong-type-arg "inexact? argument should be a number: ~A" x))))

  (define (inexact->exact x)
    (if (not (number? x))
	(error 'wrong-type-arg "inexact->exact argument should be a number: ~A" x)
	(if (rational? x)
	    x
	    (rationalize x))))

  (define (exact->inexact x)
    (if (number? x)
	(* x 1.0)
	(error 'wrong-type-arg "exact->inexact argument should be a number: ~A" x)))

  (define (integer-length i)
    (if (integer? i)
	(if (zero? i)
	    0
	    (+ (ceiling (log (abs i) 2))
	       (if (and (positive? i)
			(zero? (logand i (- i 1))))
		   1 0)))
	(if (openlet? i)
	    ((let-ref i 'integer-length) i)
	    (error 'wrong-type-arg "integer-length argument should be an integer: ~A" x))))

  (set! *#readers* (list (cons #\i (lambda (str) (* 1.0 (string->number (substring str 1)))))
			 (cons #\e (lambda (str) (floor (string->number (substring str 1)))))))
  ;; one problem (of many): (string->number "#e0a" 16) -- no simple way to tell the #e reader that we want base 16
  ;;   similarly #x#if -- so in pure-s7, the reader complains

  (define-macro (defmacro name args . body) `(define-macro ,(cons name args) ,@body))
  (define-macro (defmacro* name args . body) `(define-macro* ,(cons name args) ,@body))

  (define-macro (call-with-values producer consumer) `(,consumer (,producer)))

  (define-macro (multiple-value-bind vars expression . body)   ; named "receive" in srfi-8 which strikes me as perverse
    (if (or (symbol? vars) (negative? (length vars)))
	`((lambda ,vars ,@body) ,expression)
	`((lambda* (,@vars . ,(gensym)) ,@body) ,expression)))

  (define-macro (multiple-value-set! vars expr . body)
    (let ((local-vars (map (lambda (n) (gensym)) vars)))
      `((lambda* (,@local-vars . ,(gensym))
	  ,@(map (lambda (n ln) `(set! ,n ,ln)) vars local-vars)
	  ,@body)
	,expr)))

  (define-macro (cond-expand . clauses)
    (letrec ((traverse (lambda (tree)
			 (if (pair? tree)
			     (cons (traverse (car tree))
				   (if (null? (cdr tree)) () (traverse (cdr tree))))
			     (if (memq tree '(and or not else))
				 tree
				 (and (symbol? tree) (provided? tree)))))))
      `(cond ,@(map (lambda (clause)
		      (cons (traverse (car clause))
			    (if (null? (cdr clause)) '(#f) (cdr clause))))
		    clauses))))
  )
;;; ---------------- end pure-s7 ----------------

(define tmp-output-file "tmp1.r5rs")
(define tmp-data-file "test.dat")
(define bold-text (format #f "~C[1m" #\escape))
(define unbold-text (format #f "~C[22m" #\escape))
(set! (hook-functions *unbound-variable-hook*) ())
(set! (hook-functions *missing-close-paren-hook*) ())
(define s7test-output #f) ; if a string, it's treated as a logfile
;(set! (*s7* 'gc-stats) #t)
;(set! (*s7* 'undefined-identifier-warnings) #t)

(define old-stdin *stdin*)
(define old-stdout *stdout*)
(define old-stderr *stderr*)
(define *max-arity* #x20000000)

(define (-s7-stack-top-) (*s7* 'stack-top))

(if (provided? 'profiling)
    (load "profile.scm"))

;;; --------------------------------------------------------------------------------

(if (and (defined? 'current-time) ; in Snd
	 (defined? 'mus-rand-seed))
    (set! (mus-rand-seed) (current-time)))

(define (ok? otst ola oexp)
  (let ((result (catch #t ola
		       (lambda args
			 (if (not (eq? oexp 'error)) 
			     (begin (display args) (newline)))
			 'error))))
    (if (not (equal? result oexp))
	(format #t "~A: ~A got ~S but expected ~S~%~%" (port-line-number) otst result oexp))))

(if (not (defined? 'test))
    (define-macro (test tst expected) ;(display tst *stderr*) (newline *stderr*)
      ;; `(ok? ',tst (lambda () (eval-string (format #f "~S" ',tst))) ,expected))
      ;; `(ok? ',tst (lambda () (eval ',tst)) ,expected))
      ;; `(ok? ',tst (lambda () ,tst) ,expected))
      ;; `(ok? ',tst (lambda () (eval-string (object->string ,tst :readable))) ,expected))
      ;; `(ok? ',tst (let () (define (_s7_) ,tst)) ,expected))
      ;; `(ok? ',tst (lambda () (let ((_s7_ #f)) (set! _s7_ ,tst))) ,expected))
      ;; `(ok? ',tst (lambda () (let ((_s7_ ,tst)) _s7_)) ,expected))
      ;; `(ok? ',tst (catch #t (lambda () (lambda* ((_a_ ,tst)) _a_)) (lambda any (lambda () 'error))) ,expected))
      ;; `(ok? ',tst (lambda () (do ((_a_ ,tst)) (#t _a_))) ,expected))
      ;; `(ok? ',tst (lambda () (call-with-exit (lambda (_a_) (_a_ ,tst)))) ,expected))
      ;; `(ok? ',tst (lambda () (values ,tst)) ,expected))
      ;; `(ok? ',tst (lambda () (define (_s7_ _a_) _a_) (_s7_ ,tst)) ,expected))
      ;; `(ok? ',tst (lambda () (define* (_s7_ (_a_ #f)) (or _a_)) (_s7_ ,tst)) ,expected))
      ;; `(ok? ',tst (lambda () (caadr (catch 'receive (lambda () (throw 'receive ,tst)) (lambda any any)))) ,expected))
      ;; `(ok? ',tst (lambda () (stacktrace (- (random 100) 50) (- (random 100) 50) (- (random 100) 50) (- (random 100) 50) (> (random 100) 50)) ,tst) ,expected))
      (list-values 'ok? (list-values quote tst) (list-values lambda () tst) expected))
#|
      `(let ((_result_ #f))
	 (define (stest) (set! _result_ ,tst))
	 (catch #t stest
		(lambda args
		  (set! _result_ 'error)))
	 (if (not (equal? _result_ ,expected))
	     (format #t "~A: ~A got ~S but expected ~S~%~%" (port-line-number) ',tst _result_ ,expected))))
|#
    )

(define (tok? otst ola)
  (let* ((data #f)
	 (result (catch #t ola 
			(lambda args 
			 (set! data args) 
			 'error))))
    (if (or (not result)
	    (eq? result 'error))
	(format #t "~A: ~A got ~S ~A~%~%" (port-line-number) otst result (or data "")))))

(define-macro (test-t tst) ;(display tst *stderr*) (newline *stderr*)
  `(tok? ',tst (lambda () ,tst)))

(define-macro (test-e tst op arg) ;(display tst *stderr*) (newline *stderr*)
  `(let ((result (catch #t (lambda () ,tst) 
			(lambda args 
			 'error))))
     (if (not (eq? result 'error))
	 (format #t "~A: (~A ~S) got ~S but expected 'error~%~%" (port-line-number) ,op ,arg result))))


(define (op-error op result expected)
  
  (if (and (real? result)
	   (real? expected))
      (/ (abs (- result expected)) (max 1.0 (abs expected)))
      (case op
	((acosh)
	 (/ (magnitude (- (cosh result) (cosh expected)))
	    (max 0.001 (magnitude (cosh expected)))))
	((asin)
	 (/ (min (magnitude (- (sin result) (sin expected)))
		 (magnitude (- result expected)))
	    (max 0.001 (* 10 (magnitude (sin expected))))))
	((acos)
	 (/ (min (magnitude (- (cos result) (cos expected)))
		 (magnitude (- result expected)))
	    (max 0.001 (magnitude (cos expected)))))
	((asinh)
	 (/ (magnitude (- (sinh result) (sinh expected)))
	    (max 0.001 (magnitude (sinh expected)))))
	((atanh)
	 (/ (min (magnitude (- (tanh result) (tanh expected)))
		 (magnitude (- result expected)))
	    (max 0.001 (magnitude (tanh expected)))))
	((atan)
	 (/ (min (magnitude (- (tan result) (tan expected)))
		 (magnitude (- result expected)))
	    (max 0.001 (magnitude (tan expected)))))
	((cosh)
	 (/ (min (magnitude (- result expected))
		 (magnitude (+ result expected)))
	    (max 0.001 (magnitude expected))))
	(else (/ (magnitude (- result expected)) (max 0.001 (magnitude expected)))))))


;;; relative error (/ (abs (- x res) (abs x)))

(define error-12 1e-12)
(define error-6  1e-6)

(define (number-ok? tst result expected)
  (if (and (not (eq? result expected))
	   (or (not (or (number? expected) 
			(eq? result expected)))
	       (and (number? expected)
		    (nan? expected)
		    (not (nan? result)))
	       (and (number? result)
		    (nan? result)
		    (number? expected)
		    (not (nan? expected)))
	       (and (number? expected)
		    (or (not (number? result))
			(nan? result)))
	       (and (rational? expected)
		    (rational? result)
		    (not (= result expected)))
	       (and (or (rational? expected)
			(rational? result))
		    (real? expected)
		    (real? result)
		    (> (/ (abs (- result expected)) (max 1.0 (abs expected))) error-12))
	       (and (pair? tst)
		    (> (op-error (car tst) result expected) error-6))))
      (format #t "~A: ~A got ~A~Abut expected ~A~%~%" 
		     (port-line-number) tst result 
		     (if (and (rational? result) (not (rational? expected)))
			 (format #f " (~A) " (* 1.0 result))
			 " ")
		     expected)))

(define (nok? otst ola oexp)
  (let ((result (catch #t ola 
		       (lambda args 
			 'error))))
    (number-ok? otst result oexp)))

(if (not (defined? 'num-test))
    (define-macro (num-test tst expected) ;(display tst *stderr*) (newline *stderr*)
      ;; `(nok? ',tst  (lambda () ,tst) ,expected))
      ;; `(nok? ',tst (let () (define (_s7_) ,tst)) ,expected))
      (list-values 'nok? (list-values quote tst) (list-values lambda () tst) expected)))

(define-macro (num-test-1 proc val tst expected)
  `(let ((result (catch #t (lambda () ,tst) 
			(lambda args 
			 'error))))
     (number-ok? (list ,proc ,val) result ,expected)))

(define-macro (num-test-2 proc val1 val2 tst expected)
  `(let ((result (catch #t (lambda () ,tst) 
			(lambda args 
			 'error))))
     (number-ok? (list ,proc ,val1 ,val2) result ,expected)))

(define (reinvert n op1 op2 arg)
  (let ((body (op2 (op1 arg))))
    (do ((i 1 (+ i 1)))
	((= i n) body)
      (set! body (op2 (op1 body))))))
    
(define (recompose n op arg)
  (define (recompose-1 n)
    (if (= n 1)
	(op arg)
	(op (recompose-1 (- n 1)))))
  (recompose-1 n))


(if (symbol-setter 'val) (set! (symbol-setter 'val) #f)) ; might get here from snd-test

(define _ht_ (make-hash-table))
(define _undef_ (car (with-input-from-string "(#_asdf 1 2)" read)))


;;; --------------------------------------------------------------------------------
;;; before starting, make a test c-object

(define with-block (not (provided? 'windows)))

(if with-block
    (begin
      (call-with-output-file "s7test-block.c"
	(lambda (p)
	  (format p "
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#include \"s7.h\"
static s7_scheme *s7;

/* c-object tests */
typedef struct {
  size_t size;
  double *data;
} g_block;    

static int g_block_type = 0;
static s7_pointer g_block_methods;

static s7_pointer g_block_let(s7_scheme *sc, s7_pointer args)
{
  #define g_block_let_help \"(block-let block) returns the block'e let.\"
  if (s7_c_object_type(s7_car(args)) != g_block_type)
    return(s7_wrong_type_arg_error(sc, \"block-let\", 1, s7_car(args), \"a block\"));
  return(s7_c_object_let(s7_car(args)));
}

static s7_pointer g_make_block(s7_scheme *sc, s7_pointer args)
{
  #define g_make_block_help \"(make-block size) returns a new block of the given size\"
  g_block *g;
  s7_pointer new_g;
  s7_int size;
  if (!s7_is_integer(s7_car(args)))
    return(s7_wrong_type_arg_error(sc, \"make-block\", 1, s7_car(args), \"an integer\"));
  size = s7_integer(s7_car(args));
  if ((size < 0) ||
      (size > 1073741824))
     return(s7_out_of_range_error(sc, \"make-block\", 1, s7_car(args), \"should be something reasonable\"));
  g = (g_block *)calloc(1, sizeof(g_block));
  g->size = (size_t)size;
  if (g->size > 0)
    g->data = (double *)calloc(g->size, sizeof(double));
  else g->data = NULL;
  new_g = s7_make_c_object(sc, g_block_type, (void *)g);
  s7_c_object_set_let(new_g, g_block_methods);
  s7_openlet(sc, new_g);
  return(new_g);
}

static s7_pointer g_to_block(s7_scheme *sc, s7_pointer args)
{
  #define g_block_help \"(block ...) returns a block c_object with the arguments as its contents.\"
  s7_pointer p, b;
  size_t i, len;
  g_block *gb;
  len = s7_list_length(sc, args);
  b = g_make_block(sc, s7_cons(sc, s7_make_integer(sc, len), s7_nil(sc)));
  gb = (g_block *)s7_c_object_value(b);
  for (i = 0, p = args; i < len; i++, p = s7_cdr(p))
    gb->data[i] = s7_number_to_real(sc, s7_car(p));
  return(b);
}

static char *g_block_display(s7_scheme *sc, void *value)
{
  g_block *b = (g_block *)value;
  int i, len;
  char *buf;
  char flt[64];
  len = b->size;
  if (len > s7_print_length(sc)) len = s7_print_length(sc);
  buf = (char *)calloc((len + 1) * 64, sizeof(char));
  snprintf(buf, (len + 1) * 64, \"(block\");
  for (i = 0; i < len; i++)
    {
      snprintf(flt, 64, \" %.3f\", b->data[i]);
      strcat(buf, flt);
    }
  if (b->size > s7_print_length(sc))
    strcat(buf, \" ...)\");
  else strcat(buf, \")\");
  return(buf);
}

static char *g_block_display_readably(s7_scheme *sc, void *value)
{
  char *buf;
  s7_int plen;
  g_block *b = (g_block *)value;
  plen = s7_set_print_length(sc, b->size + 1);
  buf = g_block_display(sc, value);
  s7_set_print_length(sc, plen);
  return(buf);
}

static void g_block_free(void *value)
{
  g_block *g = (g_block *)value;
  if (g->data) free(g->data);
  free(g);
}

static bool g_block_is_equal(void *val1, void *val2)
{
  int i, len;
  g_block *b1 = (g_block *)val1;
  g_block *b2 = (g_block *)val2;
  if (val1 == val2) return(true);
  len = b1->size;
  if (len != b2->size) return(false);
  for (i = 0; i < len; i++)
    if (b1->data[i] != b2->data[i])
      return(false);
  return(true);	 
}

static void g_block_mark(void *val)
{
  /* nothing to mark */
}

static s7_pointer g_is_block(s7_scheme *sc, s7_pointer args)
{
  #define g_is_block_help \"(block? obj) returns #t if obj is a block.\"
  return(s7_make_boolean(sc, s7_c_object_type(s7_car(args)) == g_block_type));
}

static s7_pointer g_block_ref(s7_scheme *sc, s7_pointer obj, s7_pointer args)
{
  g_block *g = (g_block *)s7_c_object_value(obj);
  size_t index;
  s7_pointer ind;
  if (s7_is_null(sc, args)) /* this is for an (obj) test */
    return(s7_make_integer(sc, 32));
  ind = s7_car(args);
  if (!s7_is_integer(ind))
    {
      if (s7_is_symbol(ind))
         return(s7_symbol_local_value(sc, ind, g_block_methods));
      return(s7_wrong_type_arg_error(sc, \"block-ref\", 1, ind, \"an integer\"));
    }
  index = (size_t)s7_integer(ind);
  if (index < g->size)
    return(s7_make_real(sc, g->data[index]));
  return(s7_out_of_range_error(sc, \"block-ref\", 1, ind, \"should be less than block length\"));
}

static s7_pointer g_block_set(s7_scheme *sc, s7_pointer obj, s7_pointer args)
{
  g_block *g;
  s7_int index;
  if (s7_is_immutable(obj))
    return(s7_wrong_type_arg_error(sc, \"block-set!\", 0, obj, \"a mutable block\"));
  if (!s7_is_integer(s7_car(args)))
    return(s7_wrong_type_arg_error(sc, \"block-set!\", 1, s7_car(args), \"an integer\"));
  g = (g_block *)s7_c_object_value(obj);
  index = s7_integer(s7_car(args));
  if ((index >= 0) && (index < g->size))
    {
      g->data[index] = s7_number_to_real(sc, s7_cadr(args));
      return(s7_cadr(args));
    }
  return(s7_out_of_range_error(sc, \"block-set\", 1, s7_car(args), \"should be less than block length\"));
}

static s7_pointer block_direct_ref(s7_scheme *sc, s7_pointer obj, s7_int index)
{
  g_block *g;
  g = (g_block *)s7_c_object_value(obj);
  if ((index >= 0) && (index < g->size))
    return(s7_make_real(sc, g->data[index]));
  return(s7_out_of_range_error(sc, \"block-ref\", 1, s7_make_integer(sc, index), \"should be less than block length\"));
}
 
static s7_pointer block_direct_set(s7_scheme *sc, s7_pointer obj, s7_int index, s7_pointer val)
{
  g_block *g;
  if (s7_is_immutable(obj))
    return(s7_wrong_type_arg_error(sc, \"block-set!\", 0, obj, \"a mutable block\"));
  g = (g_block *)s7_c_object_value(obj);
  if ((index >= 0) && (index < g->size))
    {
      g->data[index] = s7_number_to_real(sc, val);
      return(val);
    }
  return(s7_out_of_range_error(sc, \"block-set\", 1, s7_make_integer(sc, index), \"should be less than block length\"));
}

static s7_pointer g_block_length(s7_scheme *sc, s7_pointer obj)
{
  g_block *g = (g_block *)s7_c_object_value(obj);
  return(s7_make_integer(sc, g->size));
}

static int get_start_and_end(s7_scheme *sc, s7_pointer args, int *start, int end)
{
  if (s7_is_pair(s7_cdr(args)))
    {
      s7_pointer p;
      p = s7_cadr(args);
      if (s7_is_integer(p))
        {
          int nstart;
          nstart = s7_integer(p);
          if ((nstart < 0) || (nstart >= end))
            {s7_out_of_range_error(sc, \"subblock\", 2, p, \"should be less than block length\"); return(0);}
          *start = nstart;
        }
      if (s7_is_pair(s7_cddr(args)))
        {
          p = s7_caddr(args);
          if (s7_is_integer(p))
            {
              int nend;
              nend = s7_integer(p);
              if (nend <= *start)
                {s7_out_of_range_error(sc, \"subblock\", 3, p, \"should be greater than the start point\"); return(0);}
              if (nend < end) end = nend;
            }
        }
    }
  return(end - *start);
}

static s7_pointer g_block_copy(s7_scheme *sc, s7_pointer args)
{
  s7_pointer new_g, obj;
  g_block *g, *g1;
  size_t len;
  int start = 0;
  obj = s7_car(args);
  g = (g_block *)s7_c_object_value(obj);
  len = g->size;
  if (s7_is_pair(s7_cdr(args)))
    {
      new_g = s7_cadr(args);
      if (s7_is_immutable(new_g))
        return(s7_wrong_type_arg_error(sc, \"block-copy!\", 0, new_g, \"a mutable block\"));
      if (s7_c_object_type(new_g) != g_block_type) /* fall back on the float-vector code using a wrapper */
        {
          s7_pointer v;
	  v = s7_make_float_vector_wrapper(sc, len, g->data, 1, NULL, false);
	  s7_gc_protect_via_stack(sc, v);
          new_g = s7_copy(sc, s7_cons(sc, v, s7_cdr(args)));
          return(new_g);
        }
      if (s7_is_pair(s7_cddr(args)))
        len = get_start_and_end(sc, s7_cdr(args), &start, len);
    }
  else new_g = g_make_block(sc, s7_cons(sc, s7_make_integer(sc, len), s7_nil(sc)));
  g1 = (g_block *)s7_c_object_value(new_g);
  if (g1->size < len) len = g1->size;
  memcpy((void *)(g1->data), (void *)(g->data + start), len * sizeof(double));
  return(new_g);
}

static s7_pointer g_block_append(s7_scheme *sc, s7_pointer args)
{
  #define g_block_append_help \"(append block...) returns a new block containing the argument blocks concatenated.\"
  int i, len = 0;
  s7_pointer p, new_g;
  g_block *g;
  for (i = 0, p = args; s7_is_pair(p); p = s7_cdr(p), i++)
    {
      g_block *g1;
      if (s7_c_object_type(s7_car(p)) != g_block_type)
        return(s7_wrong_type_arg_error(sc, \"block-append\", i, s7_car(p), \"a block\"));
      g1 = (g_block *)s7_c_object_value(s7_car(p));
      len += g1->size;
    }
  new_g = g_make_block(sc, s7_cons(sc, s7_make_integer(sc, len), s7_nil(sc)));
  g = (g_block *)s7_c_object_value(new_g);
  for (i = 0, p = args; s7_is_pair(p); p = s7_cdr(p))
    {
      g_block *g1;
      g1 = (g_block *)s7_c_object_value(s7_car(p));
      memcpy((void *)(g->data + i), (void *)(g1->data), g1->size * sizeof(double));
      i += g1->size;
    }
  return(new_g);
}

static s7_pointer g_block_reverse(s7_scheme *sc, s7_pointer args)
{
  size_t i, j;
  g_block *g, *g1; 
  s7_pointer new_g;
  g = (g_block *)s7_c_object_value(s7_car(args));
  new_g = g_make_block(sc, s7_cons(sc, s7_make_integer(sc, g->size), s7_nil(sc)));
  g1 = (g_block *)s7_c_object_value(new_g);
  for (i = 0, j = g->size - 1; i < g->size; i++, j--)
    g1->data[i] = g->data[j];
  return(new_g);
}

static s7_pointer g_block_reverse_in_place(s7_scheme *sc, s7_pointer args)
{
  #define g_block_reverse_in_place_help \"(block-reverse! block) returns block with its data reversed.\"
  size_t i, j;
  g_block *g; 
  s7_pointer obj;
  obj = s7_car(args);
  if (s7_c_object_type(obj) != g_block_type)
    return(s7_wrong_type_arg_error(sc, \"block-reverse!\", 0, obj, \"a block\"));
  if (s7_is_immutable(obj))
    return(s7_wrong_type_arg_error(sc, \"block-reverse!\", 0, obj, \"a mutable block\"));
  g = (g_block *)s7_c_object_value(obj);
  if (g->size < 2) return(obj);
  for (i = 0, j = g->size - 1; i < j; i++, j--)
    {
      double temp;
      temp = g->data[i];
      g->data[i] = g->data[j];
      g->data[j] = temp;
    }
  return(obj);
}

static s7_pointer g_block_fill(s7_scheme *sc, s7_pointer args)
{
  s7_pointer obj, val;
  size_t i, len;
  int start = 0;
  double fill_val;
  g_block *g;
  obj = s7_car(args);
  if (s7_is_immutable(obj))
    return(s7_wrong_type_arg_error(sc, \"block-fill!\", 0, obj, \"a mutable block\"));
  val = s7_cadr(args);
  g = (g_block *)s7_c_object_value(obj);
  fill_val = s7_number_to_real(sc, val);
  len = g->size;
  if (s7_is_pair(s7_cddr(args)))
    len = get_start_and_end(sc, s7_cdr(args), &start, len);
  if (fill_val == 0.0)
    memset((void *)(g->data + start), 0, len * sizeof(double));
  else
    {
      for (i = 0; i < len; i++)
        g->data[i + start] = fill_val;
    }
  return(obj);
}

static s7_pointer g_blocks(s7_scheme *sc, s7_pointer args)
{
  return(s7_copy(sc, s7_list(sc, 1, args)));
}

static s7_pointer g_subblock(s7_scheme *sc, s7_pointer args)
{
  #define g_subblock_help \"(subblock block (start 0) end) returns a portion of the block.\"
  s7_pointer p, new_g, obj;
  int start = 0, new_len, i;
  g_block *g, *g1;
  obj = s7_car(args);
  if (s7_c_object_type(obj) != g_block_type)
    return(s7_wrong_type_arg_error(sc, \"subblock\", 1, obj, \"a block\"));
  g = (g_block *)s7_c_object_value(obj);
  new_len = get_start_and_end(sc, args, &start, g->size);
  new_g = g_make_block(sc, s7_cons(sc, s7_make_integer(sc, new_len), s7_nil(sc)));
  g1 = (g_block *)s7_c_object_value(new_g);
  memcpy((void *)(g1->data), (void *)(g->data + start), new_len * sizeof(double));
  return(new_g);
}


/* function port tests */
static unsigned char *fout = NULL;
static unsigned int fout_size = 0, fout_loc = 0;
static void foutput(s7_scheme *sc, unsigned char c, s7_pointer port)
{
  if (fout_size == fout_loc)
    {
      if (fout_size == 0)
        {
          fout_size = 128;
          fout = (unsigned char *)malloc(fout_size * sizeof(unsigned char));
        }
      else
        {
          fout_size += 128;
          fout = (unsigned char *)realloc(fout, fout_size * sizeof(unsigned char));
        }
    }
  fout[fout_loc++] = c;
}

static s7_pointer fout_open(s7_scheme *sc, s7_pointer args)
{
  return(s7_open_output_function(sc, foutput));
}

static s7_pointer fout_get_output(s7_scheme *sc, s7_pointer args)
{
  foutput(sc, 0, s7_car(args)); /* make sure it's null-terminated */
  return(s7_make_string_with_length(sc, (const char *)fout, fout_loc - 1));
}

static s7_pointer fout_close(s7_scheme *sc, s7_pointer args)
{
  fout_loc = 0;
  return(s7_car(args));
}

static const char *fin = NULL;
static unsigned int fin_size = 0, fin_loc = 0;
static s7_pointer finput(s7_scheme *sc, s7_read_t peek, s7_pointer port)
{
  switch (peek)
    {
      case S7_READ_BYTE:
        return(s7_make_integer(sc, (int)fin[fin_loc++]));
      case S7_READ_CHAR:
        return(s7_make_character(sc, fin[fin_loc++]));
      case S7_PEEK_CHAR:
        return(s7_make_character(sc, fin[fin_loc]));
      case S7_READ_LINE:
        {
          unsigned int i;
          s7_pointer result;
          for (i = fin_loc; (i < fin_size) && (fin[i] != '\\n'); i++);
          result = s7_make_string_with_length(sc, (char *)(fin + fin_loc), i - fin_loc);
          fin_loc = i + 1;
          return(result);
        }
      case S7_IS_CHAR_READY:
        return(s7_make_boolean(sc, fin_loc < fin_size));
      case S7_READ:
        return(s7_error(sc, s7_make_symbol(sc, \"read-error\"), s7_make_string(sc, \"can't read yet!\")));
    }
}

static s7_pointer fin_open(s7_scheme *sc, s7_pointer args)
{
  /* arg = string to read */
  s7_pointer str;
  fin_loc = 0;
  str = s7_car(args);
  fin = s7_string(str); /* assume caller will GC protect the string */
  fin_size = s7_string_length(str);
  return(s7_open_input_function(sc, finput));
}

/* dilambda test */
static s7_pointer g_dilambda_test(s7_scheme *sc, s7_pointer args) {return(s7_f(sc));}
static s7_pointer g_dilambda_set_test(s7_scheme *sc, s7_pointer args) {return(s7_car(args));}

/* hash-table tests */
static s7_pointer g_hloc(s7_scheme *sc, s7_pointer args) {return(s7_make_integer(sc, 0));}
static s7_pointer g_heq(s7_scheme *sc, s7_pointer args) {return(s7_make_boolean(sc, s7_is_eq(s7_car(args), s7_cadr(args))));}

/* optimizer tests */
static s7_pointer g_cf10(s7_scheme *sc, s7_pointer args) {return(s7_car(args));}
static s7_pointer g_cf11(s7_scheme *sc, s7_pointer args) {return(s7_car(args));}
static s7_pointer g_cs11(s7_scheme *sc, s7_pointer args) {return(s7_car(args));}

static s7_pointer g_cf20(s7_scheme *sc, s7_pointer args) {return(s7_car(args));}
static s7_pointer g_cf21(s7_scheme *sc, s7_pointer args) {return(s7_car(args));}
static s7_pointer g_cf22(s7_scheme *sc, s7_pointer args) {return(s7_cadr(args));}

static s7_pointer g_cf30(s7_scheme *sc, s7_pointer args) {return(s7_car(args));}
static s7_pointer g_cf31(s7_scheme *sc, s7_pointer args) {return(s7_car(args));}
static s7_pointer g_cf32(s7_scheme *sc, s7_pointer args) {return(s7_cadr(args));}
static s7_pointer g_cf33(s7_scheme *sc, s7_pointer args) {return(s7_caddr(args));}

static s7_pointer g_cf41(s7_scheme *sc, s7_pointer args) {return(s7_car(args));}
static s7_pointer g_cf42(s7_scheme *sc, s7_pointer args) {return(s7_cadr(args));}
static s7_pointer g_cf43(s7_scheme *sc, s7_pointer args) {return(s7_caddr(args));}
static s7_pointer g_cf44(s7_scheme *sc, s7_pointer args) {return(s7_cadddr(args));}
static s7_pointer g_rs11(s7_scheme *sc, s7_pointer args) {return(s7_make_integer(sc, s7_integer(s7_car(args)) + 1));}

static s7_pointer g_cf51(s7_scheme *sc, s7_pointer args) {return(s7_car(args));}

static s7_pointer sload(s7_scheme *sc, s7_pointer args) 
{
  if (s7_is_string(s7_car(args)))
    {
      if (s7_is_pair(s7_cdr(args)))
	 {
	   if (s7_is_let(s7_cadr(args)))
             return(s7_load_with_environment(sc, s7_string(s7_car(args)), s7_cadr(args)));
           return(s7_wrong_type_arg_error(sc, \"load\", 2, s7_cadr(args), \"an environment\"));
         }
      return(s7_load(sc, s7_string(s7_car(args))));
    }
  return(s7_wrong_type_arg_error(sc, \"load\", 1, s7_car(args), \"file name\"));
}
static s7_pointer scall(s7_scheme *sc, s7_pointer args) {return(s7_call(sc, s7_car(args), s7_cadr(args)));}
static s7_pointer sread(s7_scheme *sc, s7_pointer args) 
{
  if (s7_is_pair(args))
    return(s7_read(sc, s7_car(args)));
  return(s7_read(sc, s7_current_input_port(sc)));
}
static s7_pointer swind(s7_scheme *sc, s7_pointer args) {return(s7_dynamic_wind(sc, s7_car(args), s7_cadr(args), s7_caddr(args)));}
static s7_pointer seval(s7_scheme *sc, s7_pointer args) 
{
  if (s7_is_pair(s7_cdr(args)))
    return(s7_eval(sc, s7_car(args), s7_cadr(args)));
  return(s7_eval(sc, s7_car(args), s7_curlet(sc)));
}
static s7_pointer sevalstr(s7_scheme *sc, s7_pointer args) 
{
  if (s7_is_string(s7_car(args)))
    {
      if (s7_is_pair(s7_cdr(args)))
	 {
	   if (s7_is_let(s7_cadr(args)))
             return(s7_eval_c_string_with_environment(sc, s7_string(s7_car(args)), s7_cadr(args)));
           return(s7_wrong_type_arg_error(sc, \"eval-string\", 2, s7_cadr(args), \"an environment\"));
	 }
      return(s7_eval_c_string_with_environment(sc, s7_string(s7_car(args)), s7_curlet(sc)));
    }
  return(s7_wrong_type_arg_error(sc, \"eval-string\", 1, s7_car(args), \"string of code\"));
}

void block_init(s7_scheme *sc);
void block_init(s7_scheme *sc)
{
  s7_pointer cur_env;
  cur_env = s7_outlet(sc, s7_curlet(sc));
  g_block_type = s7_make_c_type(sc, \"#<block>\");
  s7_c_type_set_print(sc, g_block_type, g_block_display);
  s7_c_type_set_free(sc, g_block_type, g_block_free);
  s7_c_type_set_equal(sc, g_block_type, g_block_is_equal);
  s7_c_type_set_mark(sc, g_block_type, g_block_mark);
  s7_c_type_set_apply(sc, g_block_type, g_block_ref);
  s7_c_type_set_set(sc, g_block_type, g_block_set);
  s7_c_type_set_length(sc, g_block_type, g_block_length);
  s7_c_type_set_copy(sc, g_block_type, g_block_copy);
  s7_c_type_set_reverse(sc, g_block_type, g_block_reverse);
  s7_c_type_set_fill(sc, g_block_type, g_block_fill);
  s7_c_type_set_print_readably(sc, g_block_type, g_block_display_readably);
  s7_define_safe_function(sc, \"make-block\", g_make_block, 1, 0, false, g_make_block_help);
  s7_define_safe_function(sc, \"block\", g_to_block, 0, 0, true, g_block_help);
  s7_define_safe_function(sc, \"block-let\", g_block_let, 1, 0, false, g_block_let_help);
  s7_define_safe_function(sc, \"subblock\", g_subblock, 1, 0, true, g_subblock_help);
  s7_define_safe_function(sc, \"block-append\", g_block_append, 0, 0, true, g_block_append_help);
  s7_define_safe_function(sc, \"block-reverse!\", g_block_reverse_in_place, 1, 0, true, g_block_reverse_in_place_help);
  s7_define_safe_function(sc, \"block?\", g_is_block, 1, 0, false, g_is_block_help);
  s7_define_function_star(sc, \"blocks\", g_blocks, \"(frequency 4) (scaler 1)\", \"test for function*\");
  g_block_methods = s7_eval_c_string(sc, \"(openlet (immutable! (inlet 'float-vector? (lambda (p) #t) \
								       'vector-dimensions (lambda (p) (list (length p))) \
						                       'empty (lambda (p) (zero? (length p))) \
                                                                       'subsequence subblock \
						                       'append block-append \
						                       'reverse! block-reverse!)))\");
  s7_gc_protect(sc, g_block_methods);
  s7_c_type_set_apply_direct(sc, g_block_type, block_direct_ref);
  s7_c_type_set_set_direct(sc, g_block_type, block_direct_set);

  s7_define_safe_function(sc, \"function-open-output\", fout_open, 0, 0, false, \"\");
  s7_define_safe_function(sc, \"function-get-output\", fout_get_output, 1, 0, false, \"\");
  s7_define_safe_function(sc, \"function-close-output\", fout_close, 1, 0, false, \"\");
  s7_define_safe_function(sc, \"function-open-input\", fin_open, 1, 0, false, \"\");

  s7_define_safe_function(sc, \"hash_heq\", g_heq, 2, 0, false, \"hash-table test\");
  s7_define_safe_function(sc, \"hash_hloc\", g_hloc, 1, 0, false, \"hash-table test\");

  s7_define_safe_function(sc, \"cf10\", g_cf10, 1, 0, false, \"\");
  s7_define_safe_function(sc, \"cf11\", g_cf11, 1, 0, false, \"\");
  s7_define_safe_function(sc, \"cs11\", g_cs11, 1, 0, false, \"\");
  s7_define_safe_function(sc, \"rs11\", g_rs11, 1, 0, false, \"\");

  s7_define_safe_function(sc, \"cf20\", g_cf20, 2, 0, false, \"\");
  s7_define_safe_function(sc, \"cf21\", g_cf21, 2, 0, false, \"\");
  s7_define_safe_function(sc, \"cf22\", g_cf22, 2, 0, false, \"\");

  s7_define_safe_function(sc, \"cf30\", g_cf30, 3, 0, false, \"\");
  s7_define_safe_function(sc, \"cf31\", g_cf31, 3, 0, false, \"\");
  s7_define_safe_function(sc, \"cf32\", g_cf32, 3, 0, false, \"\");
  s7_define_safe_function(sc, \"cf33\", g_cf33, 3, 0, false, \"\");

  s7_define_safe_function(sc, \"cf41\", g_cf41, 4, 0, false, \"\");
  s7_define_safe_function(sc, \"cf42\", g_cf42, 4, 0, false, \"\");
  s7_define_safe_function(sc, \"cf43\", g_cf43, 4, 0, false, \"\");
  s7_define_safe_function(sc, \"cf44\", g_cf44, 4, 0, false, \"\");

  s7_define_safe_function(sc, \"cf51\", g_cf51, 5, 0, false, \"\");

  s7_define_function(sc, \"sload\",  sload,        1, 1, false, \"test s7_load\");
  s7_define_function(sc, \"scall\",  scall,        2, 0, false, \"test s7_call\");
  s7_define_function(sc, \"sread\",  sread,        0, 1, false, \"test s7_read\");
  s7_define_function(sc, \"swind\",  swind,        3, 0, false, \"test s7_dynamic_wind\");
  s7_define_function(sc, \"seval\",  seval,        1, 1, false, \"test s7_eval\");
  s7_define_function(sc, \"sevalstr\",  sevalstr,  1, 1, false, \"test s7_eval_c_string\");
}
")))

  ;; immutable! above to counteract:
  ;;      wrong-number-of-args ("~A: not enough arguments: ~A" let-temporarily ((block)))
  ;; where (float-vector? (block)) was evaluated.
  ;;   (gdb) p DISPLAY(s7_eval_c_string(sc, "((block 0.0) 'float-vector?)"))
  ;;   $3 = 0x555555f11380 "let-temporarily"

(cond ((provided? 'osx)
       (system "gcc -c s7test-block.c -O2")
       (system "gcc s7test-block.o -o s7test-block.so -dynamic -bundle -undefined suppress -flat_namespace"))

      ((or (provided? 'freebsd)
	   (provided? 'netbsd))
       (system "cc -fPIC -c s7test-block.c -O2")
       (system "cc s7test-block.o -shared -o s7test-block.so -lm -lc"))

      ((provided? 'openbsd)
       (system "gcc -fPIC -ftrampolines -c s7test-block.c -O2")
       (system "gcc s7test-block.o -shared -o s7test-block.so -lm -lc"))

      ((provided? 'solaris)
       (system "gcc -fPIC -c s7test-block.c")
       (system "gcc s7test-block.o -shared -o s7test-block.so -G -ldl -lm"))

      (else 
       (system "gcc -fPIC -c s7test-block.c -O2")
       (system "gcc s7test-block.o -shared -o s7test-block.so -ldl -lm -Wl,-export-dynamic")))

(let ((new-env (sublet (curlet) (cons 'init_func 'block_init)))) ; load calls init_func
  (load "s7test-block.so" new-env))

(define _c_obj_ (make-block 16))

(unless (immutable? (block-let _c_obj_)) (format *stderr* "~S's let is mutable~%" _c_obj_))
)                               ; with-block

(define _c_obj_ (c-pointer 0))) ; not with-block

(define _null_ (c-pointer 0))

(when (and (provided? 'linux)
	   (not (provided? 'gmp)))
  (system (string-append "gcc -o ffitest ffitest.c -g3 -Wall s7.o " asan-flags " -lm -I. -ldl"))
  (system "ffitest"))

#|
(when with-block
;(define eval seval)           ; finished ok
;(define dynamic-wind swind)   ; finished ok
;(define read sread)           ; ok until (unsupported) let-as-port 80480, also read-error in sevalstr does not unwind C stack
;(define load sload)           ; ok until (unsupported) cload
;(define-macro (test tst expected) `(ok? ',tst (lambda () (define (_s7_ _a_) ,tst) (scall _s7_ (list 0))) ,expected)) ; finished ok!
;(define eval-string sevalstr) ; ok except various local exiters, eval-string as method, multiple statements etc, gloms up C stack
(test (sevalstr "(+ 1 2)") 3)
(test (sevalstr "(+ 1 #())") 'error)
(test (let ((x 1) (y 2)) (sevalstr "(begin (set! x 3) (set! y 4))") (list x y)) '(3 4))
(test (+ 1 (values (sevalstr "(catch #t (lambda () asdf) (lambda args 2))") (sevalstr "(catch #t (lambda () asdf) (lambda args 3))"))) 6)
(test (seval '(+ 1 #())) 'error)
)
|#
#|
(let ()
  (if (null? (hook-functions *error-hook*))
      (set! (hook-functions *error-hook*)
	    (list (lambda (hook)
		    (apply format *stderr* (hook 'data))
		    (newline *stderr*)
		    (throw 'all-done)))))
  (catch 'all-done
    (lambda ()
      (+ 1 #()))
    (lambda args
      (format *stderr* "in catch~%"))))

(define (ok1? otst ola oexp)
  (let ((result (catch 'all-done ola
		       (lambda args
			 (if (not (eq? oexp 'error)) 
			     (begin (display args) (newline)))
			 'error))))
    (if (not (equal? result oexp))
	(format #t "~A: ~A got ~S but expected ~S~%~%" (port-line-number) otst result oexp))))

(define-macro (test tst expected)
  `(ok1? ',tst (lambda () 
		 (if (null? (hook-functions *error-hook*))
		     (set! (hook-functions *error-hook*)
			   (list (lambda (hook)
				   (apply format *stderr* (hook 'data))
				   (newline *stderr*)
				   (set! (hook 'result) 'error)
				   (throw 'all-done)))))
		 ,tst) 
	 ,expected))
|#


;;; --------------------------------------------------------------------------------
;;; eq?

(test (eq? 'a 3) #f)
(test (eq? #t 't) #f)
(test (eq? "abs" 'abc) #f)
(test (eq? "hi" '(hi)) #f)
(test (eq? "hi" "hi") #f)
(test (eq? "()" ()) #f)
(test (eq? '(1) '(1)) #f)
(test (eq? '(#f) '(#f)) #f)
(test (eq? #\a #\b) #f)
(test (eq? #t #t) #t)
(test (eq? #f #f) #t)
(test (eq? #f #t) #f)
(test (eq? (null? ()) #t) #t)
(test (eq? (null? '(a)) #f) #t)
(test (eq? (cdr '(a)) ()) #t)
(test (eq? 'a 'a) #t)
(test (eq? 'a 'b) #f)
(test (eq? 'a (string->symbol "a")) #t)
(test (eq? (symbol "a") (string->symbol "a")) #t)
(test (eq? :a :a) #t)
(test (eq? ':a 'a) #f)
(test (eq? ':a ':a) #t)
(test (eq? :a a:) #f)
(test (eq? ':a 'a:) #f)
(test (eq? 'a: 'a:) #t)
(test (eq? ':a: 'a:) #f)
(test (eq? 'a (symbol "a")) #t)
(test (eq? :: '::) #t)
(test (eq? ':a (symbol->keyword (symbol "a"))) #t) ; but not a:
(test (eq? '(a) '(b)) #f)
(test (let ((x '(a . b))) (eq? x x)) #t)
(test (let ((x (cons 'a 'b))) (eq? x x)) #t)
(test (eq? (cons 'a 'b) (cons 'a 'b)) #f)
(test (eq? "abc" "cba") #f)
(test (let ((x "hi")) (eq? x x)) #t)
(test (eq? (string #\h #\i) (string #\h #\i)) #f)
(test (eq? #(a) #(b)) #f)
(test (let ((x (vector 'a))) (eq? x x)) #t)
(test (eq? (vector 'a) (vector 'a)) #f)
(test (eq? car car) #t)
(test (eq? car cdr) #f)
(test (let ((x (lambda () 1))) (eq? x x)) #t)
(test (let ((x (lambda () 1))) (let ((y x)) (eq? x y))) #t)
(test (let ((x (lambda () 1))) (let ((y (lambda () 1))) (eq? x y))) #f)
(test (eq? 'abc 'abc) #t)
(test (eq? eq? eq?) #t)
(test (eq? (if #f 1) 1) #f)
(test (eq? () '(#||#)) #t)
(test (eq? () '(#|@%$&|#)) #t)
(test (eq? '#||#hi 'hi) #t) ; ??
(test (eq? '; a comment
         hi 'hi) #t) ; similar:
    (test (cadr '#| a comment |#(+ 1 2)) 1)
    (test `(+ 1 ,@#||#(list 2 3)) '(+ 1 2 3))
    (test `(+ 1 ,#||#(+ 3 4)) '(+ 1 7))
    ;; but not splitting the ",@" or splitting a number:
    (test (+ 1 2.0+#||#3i) 'error)
    (test `(+ 1 ,#||#@(list 2 3)) 'error)
(test (eq? #||# (#|%%|# append #|^|#) #|?|# (#|+|# list #|<>|#) #||#) #t)
(test (eq? '() ;a comment
	   '()) #t)
(test (eq? 3/4 3) #f)
(test (eq? '() '()) #t)
(test (eq? '() '(  )) #t)
(test (eq? '()'()) #t)
(test (eq? '()(list)) #t)
(test (eq? () (list)) #t)
(test (eq? (begin) (append)) #t)
(test (let ((lst (list 1 2 3))) (eq? lst (apply list lst))) #f) ; changed 26-Sep-11

;(test (eq? 1/0 1/0) #f)
;(test (let ((+nan.0 1/0)) (eq? +nan.0 +nan.0)) #f)
;; these are "unspecified" so any boolean value is ok

(test (eq? ''2 '2) #f)
(test (eq? '2 '2) #t) ; unspecified??
(test (eq? '2 2) #t)
(test (eq? ''2 ''2) #f)
(test (eq? ''#\a '#\a) #f)
(test (eq? '#\a #\a) #t) ; was #f 
(test (eq? 'car car) #f)
(test (eq? '()()) #t)
(test (eq? ''() '()) #f)
(test (eq? '   () '
()) #t)
(test (eq? '#f #f) #t)
(test (eq? '#f '#f) #t)
(test (eq? #f '  #f) #t)
(test (eq? '()'()) #t) ; no space
(test (#||# eq? #||# #f #||# #f #||#) #t)
(test (eq? (current-input-port) (current-input-port)) #t)
(test (let ((f (lambda () (quote (1 . "H"))))) (eq? (f) (f))) #t)
(test (let ((f (lambda () (cons 1 (string #\H))))) (eq? (f) (f))) #f)
(test (eq? *stdin* *stdin*) #t)
(test (eq? *stdout* *stderr*) #f)
(test (eq? *stdin* *stderr*) #f)
(test (eq? else else) #t)
(test (eq? :else else) #f)
(test (eq? :else 'else) #f)
(test (eq? :if if) #f)
(test (eq? 'if 'if) #t)
(test (eq? :if :if) #t)

(test (eq? (string) (string)) #f)
(test (eq? (string) "") #f)
(test (eq? (vector) (vector)) #f)
(test (eq? (vector) #()) #f)
(test (eq? (list) (list)) #t)
(test (eq? (list) ()) #t)
(test (eq? (hash-table) (hash-table)) #f)
(test (eq? (curlet) (curlet)) #t)
(test (eq? (rootlet) (rootlet)) #t)
(test (eq? (funclet abs) (funclet abs)) #t) ; or any other built-in...
(test (eq? letrec* letrec*) #t)

(test (eq? (current-input-port) (current-input-port)) #t)
(test (eq? (current-error-port) (current-error-port)) #t)
(test (eq? (current-output-port) (current-output-port)) #t)
(test (eq? (current-input-port) (current-output-port)) #f)

(test (eq? (string #\a) (string #\a)) #f)
(test (eq? "a" "a") #f)
(test (eq? #(1) #(1)) #f)
(test (let ((a "hello") (b "hello")) (eq? a b)) #f)
(test (let ((a "foo")) (eq? a (copy a))) #f)
(test (let ((p (c-pointer 0))) (eq? p (copy p))) #f)
(test (let ((p (c-pointer 0))) (let ((p1 p)) (eq? p p1))) #t)

(begin #| ; |# (display ""))
(newline)

(test (;
       eq? ';!
       (;)()#
	);((")";
       ;"#|)#""
       '#|";"|#(#|;|#); ;#
	 ;\;"#"#f 
	       )#t)

(test (+ #| this is a comment |# 2 #| and this is another |# 3) 5)
(test (eq? #| a comment |# #f #f) #t)
(test (eq? #| a comment |##f #f) #t)  ; ??
(test (eq? #| a comment | ##f|##f #f) #t) ; ??
(test (eq? #||##||##|a comment| ##f|##f #f) #t)

(test (+ ;#|
            3 ;|#
            4)
      7)
(test (+ #| ; |# 3
		 4)
      7)

(test (eq? (if #f #t) (if #f 3)) #t)

(test (eq?) 'error)           ; "this comment is missing a double-quote
(test (eq? #t) 'error)        #| "this comment is missing a double-quote |#
(test (eq? #t #t #t) 'error)  #| and this has redundant starts #| #| |#
(test (eq? #f . 1) 'error)
(test (eq #f #f) 'error)

(let ((things (vector #t #f #\space () "" 0 1 3/4 1+i 1.5 '(1 .2) #() (vector) (vector 1) (list 1) 'f 't #\t)))
  (let ((len (length things)))
    (do ((i 0 (+ i 1)))
	((= i (- len 1)))
      (do ((j (+ i 1) (+ j 1)))
	  ((= j len))
	(if (eq? (vector-ref things i) (vector-ref things j))
	    (format #t ";(eq? ~A ~A) -> #t?~%" (vector-ref things i) (vector-ref things j)))))))

;;; these are defined at user-level in s7 -- why are other schemes so coy about them?
(test (eq? (if #f #f) #<unspecified>) #t)
(test (eq? (symbol->value '_?__undefined__?_) #<undefined>) #t)
(test (eq? #<eof> #<eof>) #t)
(test (eq? #<undefined> #<undefined>) #t)
(test (eq? #<unspecified> #<unspecified>) #t)
(test (eq? #<eof> #<undefined>) #f)
(test (eq? #<eof> ()) #f)
(test (eq? #<undefined> _undef_) #f)
(test (eq? _undef_ _undef_) #t)

(test (let () (define-macro (hi a) `(+ 1 ,a)) (eq? hi hi)) #t)
(test (let () (define (hi a) (+ 1 a)) (eq? hi hi)) #t)
(test (let ((x (lambda* (hi (a 1)) (+ 1 a)))) (eq? x x)) #t)

(test (eq? quasiquote quasiquote) #t)
(test (eq? `quasiquote 'quasiquote) #t)
(test (eq? 'if (keyword->symbol :if)) #t)
(test (eq? 'if (string->symbol "if")) #t)
(test (eq? (copy lambda) (copy 'lambda)) #f)
(test (eq? if 'if) #f)
(test (eq? if `if) #f)
(test (eq? if (keyword->symbol :if)) #f)
(test (eq? if (string->symbol "if")) #f)
(test (eq? lambda and) #f)
(test (eq? let let*) #f)
(test (eq? quote quote) #t)
(test (eq? '"hi" '"hi") #f) ; guile also
;(test (eq? '"" "") #f)
;(test (eq? '"" '"") #f)
;(test (eq? "" "") #f)
(test (eq? #() #()) #f)
(test (eq? '#() #()) #f)
(test (eq? '#() '#()) #f)
(test (let ((v #())) (eq? v #())) #f)
(test (let ((v #())) (eq? v #())) #f)
(test (let ((v #())) (eq? v v)) #t)
(test (call/cc (lambda (return) (return (eq? return return)))) #t)
(test (let ((r #f)) (call/cc (lambda (return) (set! r return) #f)) (eq? r r)) #t)
(test (eq? _unbound_variable_ #f) 'error)

(when with-block
  (let ((b (make-block 4))) 
    (test (eq? b b) #t)
    (test (equal? b b) #t)
    (test (block? b) #t)
    (test (block? #()) #f)
    (test (block? #f) #f)
    (set! (b 0) 32)
    (test (b 0) 32.0)
    (let () (define (hi b i) (b i)) (hi b 0) (test (hi b 0) 32.0))
    (let () (define (hi b) (b 0)) (hi b) (test (hi b) 32.0))
    (let () (define (hi b) (b)) (hi b) (test (hi b) 32))
    (test b (block 32.0 0.0 0.0 0.0))
    (test (let? (block-let b)) #t)
    (test (((block-let b) 'float-vector?) b) #t)
    (test (object->string b) "(block 32.000 0.000 0.000 0.000)")
    (let ((b1 (make-block 4)))
      (test (eq? b b1) #f)))
  (test (blocks) (list 4 1))
  (test (blocks :frequency 2) (list 2 1))
  (test (blocks :scaler 3 :frequency 2) (list 2 3))
  (test (blocks :scaler 3 :phase 1) 'error)
  (test (map blocks '(1 2 3)) '((1 1) (2 1) (3 1)))
  (test (map blocks '( 1 2 3) '(4 5 6)) '((1 4) (2 5) (3 6)))
  (test (documentation blocks) "test for function*")
  (test (apply blocks '(:frequency 5 :scaler 4)) '(5 4))
  (test (let () (define (b1) (blocks 100)) (b1)) '(100 1))
  (test (procedure? blocks) #t)

  (define (fv32)
    (let ((b (block 1 2 3 4))
	  (f (make-float-vector 4)))
      (do ((i 0 (+ i 1)))
	  ((= i 4) f)
	(set! (f i) (+ (b i) 1.0)))))
  (test (fv32) (float-vector 2.0 3.0 4.0 5.0))

  (define (fv33)
    (let ((b (block 1 2 3 4))
	  (f (make-block 4)))
      (do ((i 0 (+ i 1)))
	  ((= i 4) f)
	(set! (f i) (+ (b i) 1.0)))))
  (test (fv33) (block 2.0 3.0 4.0 5.0))

  (define (fv34)
    (let ((b (block 1 2 3 4))
	  (f (make-vector 4)))
      (do ((k 0 (+ k 1)))
	  ((= k 1) f)
	(do ((i 0 (+ i 1)))
	    ((= i 4))
	  (set! (f i) (b i))))))
  (test (fv34) (vector 1.0 2.0 3.0 4.0))

  )

;;; c-pointer
(test (c-pointer? 0) #f)
(test (c-pointer? _null_) #t)
(if with-block
    (test (integer? (c-object? _c_obj_)) #t)
    (test (c-pointer? _c_obj_) #t))

(for-each
 (lambda (arg)
   (test (c-pointer? arg) #f)
   (test (c-object? arg) #f)
   (test (c-pointer arg) 'error))
 (list "hi" () (integer->char 65) #f #t 0+i '(1 2) _ht_ _undef_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))

(test (c-pointer?) 'error)
(test (c-object?) 'error)
(test (c-pointer? _c_obj_ 2 3) 'error)
(test (c-object? _c_obj_ 2) 'error)
(test (c-pointer 1 2 3 4) 'error)
(when with-bignums
  (test (c-pointer? (c-pointer (bignum "12341234"))) #t)
  (test (c-pointer (bignum "1.4")) 'error))

(let ((ptr (c-pointer 1 'abc (inlet 'object->string 
				  (lambda (obj . args)
				    (let ((lt (object->let obj)))
				      (format #f "I am pointer ~A of type '~A!" 
					      (lt 'c-pointer)
					      (lt 'c-type))))))))
  (openlet ptr)
  (test (object->string ptr) "I am pointer 1 of type 'abc!"))

(test (openlet (c-pointer #b101 (setter car) (rootlet))) 'error)

(when with-block
  (test (pair? (*s7* 'c-types)) #t))


;;; a ridiculous optimizer typo...
(test (let ((sym 'a)) (define (hi a) (eq? (cdr a) sym)) (hi '(a a))) #f)
(test (let ((sym 'a)) (define (hi a) (eq? (cdr a) sym)) (hi '(a . a))) #t)
(test (let ((sym 'a)) (define (hi a) (eq? (cdr a) sym)) (hi '(a . b))) #f)

(for-each
 (lambda (arg)
   (let ((x arg)
	 (y arg))
     (if (not (eq? x x))
	 (format #t ";(eq? x x) of ~A -> #f?~%" x))
     (if (not (eq? x arg))
	 (format #t ";(eq? x arg) of ~A ~A -> #f?~%" x arg))
     (if (not (eq? x y))
	 (format #t ";(eq? x y) of ~A ~A -> #f?~%" x y))))
 ;; actually I hear that #f is ok here for numbers
 (list "hi" '(1 2) (integer->char 65) 1 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3/4 #\f (lambda (a) (+ a 1)) :hi (if #f #f) #<eof> #<undefined>))
;; this used to include 3.14 and 1+i but that means the (eq? x x) case differs from the (eq? 3.14 3.14) case

(define comment-start (port-line-number))
#|
:'(1(1))
(1 (1))
:'(1#(1))
(1# (1))
|#
(if (not (= (- (port-line-number) comment-start) 7)) (format *stderr* ";block comment newline counter: ~D ~D~%" comment-start (port-line-number)))

;;; this comes from G Sussman
(let ()
  (define (counter count)
    (lambda ()
      (set! count (+ 1 count))
      count))

  (define c1 (counter 0))
  (define c2 (counter 0))

  (test (eq? c1 c2) #f)
  (test (eq? c1 c1) #t)
  (test (eq? c2 c2) #t)

  (test (let ((p (lambda (x) x))) (eqv? p p)) #t)
  (for-each
   (lambda (arg)
     (if (not ((lambda (p) (eq? p p)) arg))
	 (format #t "~A not eq? to itself?~%" arg)))
   (list "hi" '(1 2) (integer->char 65) 1 'a-symbol (make-vector 3) abs quasiquote macroexpand 1/0 (log 0) 
	 3.14 3/4 1.0+1.0i #\f (lambda (a) (+ a 1)) :hi (if #f #f) #<eof> #<undefined> '(1 2 . 3)
	 (let ((lst (list 1 2)))
	   (set! (cdr (cdr lst)) lst)
	   lst)
	 (vector) (string) (list)
	 (let ((x 3))
	   (lambda (y) (+ x y))))))

;;; this for r7rs
(test (eq? #t #true) #t)
(test (eq? #f #false) #t)
(test (eq? () (map values ())) #t)

(let () (define (f2) f2) (test (eq? f2 (f2)) #t))
(letrec ((f2 (lambda () f2))) (test (eq? f2 (f2)) #t))




;;; --------------------------------------------------------------------------------
;;; eqv?

(test (eqv? 'a 3) #f)
(test (eqv? #t 't) #f)
(test (eqv? "abs" 'abc) #f)
(test (eqv? "hi" '(hi)) #f)
(test (eqv? "()" ()) #f)
(test (eqv? '(1) '(1)) #f)
(test (eqv? '(#f) '(#f)) #f)
(test (eqv? #\a #\b) #f)
(test (eqv? #\a #\a) #t)
(test (eqv? (integer->char 255) (string-ref (string #\x (integer->char 255) #\x) 1)) #t)
(test (eqv? (integer->char #xf0) (integer->char #x70)) #f)
(test (eqv? #\space #\space) #t)
(test (let ((x (string-ref "hi" 0))) (eqv? x x)) #t)
(test (eqv? #t #t) #t)
(test (eqv? #f #f) #t)
(test (eqv? #f #t) #f)
(test (eqv? (null? ()) #t) #t)
(test (eqv? (null? '(a)) #f) #t)
(test (eqv? (cdr '(a)) '()) #t)
(test (eqv? 'a 'a) #t)
(test (eqv? 'a 'b) #f)
(test (eqv? 'a (string->symbol "a")) #t)
(test (eqv? '(a) '(b)) #f)
(test (let ((x '(a . b))) (eqv? x x)) #t)
(test (let ((x (cons 'a 'b))) (eqv? x x)) #t)
(test (eqv? (cons 'a 'b) (cons 'a 'b)) #f)
(test (eqv? "abc" "cba") #f)
(test (let ((x "hi")) (eqv? x x)) #t)
(test (eqv? (string #\h #\i) (string #\h #\i)) #f)
(test (eqv? #(a) #(b)) #f)
(test (let ((x (vector 'a))) (eqv? x x)) #t)
(test (eqv? (vector 'a) (vector 'a)) #f)
(test (eqv? car car) #t)
(test (eqv? car cdr) #f)
(test (let ((x (lambda () 1))) (eqv? x x)) #t)
(test (eqv? (lambda () 1) (lambda () 1)) #f)
(test (let () (define (make-adder x) (lambda (y) (+ x y))) (eqv? (make-adder 1) (make-adder 1))) #f)
(test (eqv? 9/2 9/2) #t)
(test (eqv? quote quote) #t)
(test (eqv? () ()) #t)
(test (eqv? () '()) #t)
;(test (eqv? "" "") #f)
(test (eqv? "hi" "hi") #f) ; unspecified 
(test (eqv? #() #()) #f)   ; unspecified, but in s7 (eqv? () ()) is #t
(test (eqv? (vector) (vector)) #f)

(let ((c1 (let ((x 32))
	    (lambda () x)))
      (c2 (let ((x 123))
	    (lambda () x))))
  (test (eqv? c1 c2) #f)
  (test (eqv? c1 c1) #t))

(test (eqv? most-positive-fixnum most-positive-fixnum) #t)
(test (eqv? most-positive-fixnum most-negative-fixnum) #f)
(test (eqv? 9223372036854775807 9223372036854775806) #f)
(test (eqv? 9223372036854775807 -9223372036854775808) #f)
(test (eqv? -9223372036854775808 -9223372036854775808) #t)
(test (eqv? 123456789/2 123456789/2) #t)
(test (eqv? 123456789/2 123456787/2) #f)
(test (eqv? -123456789/2 -123456789/2) #t)
(test (eqv? 2/123456789 2/123456789) #t)
(test (eqv? -2/123456789 -2/123456789) #t)
(test (eqv? 2147483647/2147483646 2147483647/2147483646) #t)
(test (eqv? 3/4 12/16) #t)
(test (eqv? 1/1 1) #t)
(test (eqv? 312689/99532 833719/265381) #f)
(test (let ((x 3.141)) (eqv? x x)) #t)
(test (let ((x 1+i)) (eqv? x x)) #t)
(test (let* ((x 3.141) (y x)) (eqv? x y)) #t)
(test (let* ((x 1+i) (y x)) (eqv? x y)) #t)
(test (let* ((x 3/4) (y x)) (eqv? x y)) #t)
(test (eqv? 1.0 1.0) #t)
(test (eqv? 0.6 0.6) #t)
(test (eqv? 0.6 0.60) #t)
(test (eqv? 1+i 1+i) #t)
(test (eqv? -3.14 -3.14) #t)
(test (eqv? 1e2 1e2) #t)
(test (eqv? 1 1.0) #f)
(test (eqv? 1/2 0.5) #f)
(test (eqv? 1 1/1) #t)
(test (eqv? 0.5 5e-1) #t)
(test (eqv? 1/0 1/0) #f)
(test (let ((+nan.0 1/0)) (eqv? +nan.0 +nan.0)) #f)

(test (eqv? (cons 'a 'b) (cons 'a 'c)) #f)
(test (eqv? eqv? eqv?) #t)
(test (eqv? #(1) #(1)) #f)
(test (eqv? '(1) '(1)) #f)
(test (eqv? '() '()) #t)
(test (eqv? '() (list)) #t)
(test (eqv? '(()) '(())) #f)
(test (eqv? (list 'abs 'cons) '(abs cons)) #f)

(let ((things (vector #t #f #\space '() "" 0 1 3/4 1+i 1.5 '(1 .2) #() (vector) (vector 1) (list 1) 'f 't #\t)))
  (let ((len (length things)))
    (do ((i 0 (+ i 1)))
	((= i (- len 1)))
      (do ((j (+ i 1) (+ j 1)))
	  ((= j len))
	(if (eqv? (vector-ref things i) (vector-ref things j))
	    (format #t ";(eqv? ~A ~A) -> #t?~%" (vector-ref things i) (vector-ref things j)))))))

(test (eqv?) 'error)
(test (eqv? #t) 'error)
(test (eqv? #t #t #t) 'error)
(test (eqv #f #f) 'error)

(test (eqv? ''2 '2) #f)
(test (eqv? '2 '2) #t)
(test (eqv? '2 2) #t)
(test (eqv? ''2 ''2) #f)
(test (eqv? ''#\a '#\a) #f)
(test (eqv? '#\a #\a) #t)
(test (eqv? 'car car) #f)
(test (eqv? ''() '()) #f)
(test (eqv? '#f #f) #t)
(test (eqv? '#f '#f) #t)
(test (eqv? #<eof> #<eof>) #t)
(test (eqv? #<undefined> #<undefined>) #t)
(test (eqv? #<unspecified> #<unspecified>) #t)
(test (eqv? (if #f #f) #<unspecified>) #t)
(test (eqv? #<eof> #<undefined>) #f)
(test (eqv? #<eof> '()) #f)
(test (let () (define-macro (hi a) `(+ 1 ,a)) (eqv? hi hi)) #t)
(test (let () (define (hi a) (+ 1 a)) (eqv? hi hi)) #t)
(test (let ((x (lambda* (hi (a 1)) (+ 1 a)))) (eqv? x x)) #t)
(test (eqv? else else) #t)
(test (let ((p (lambda (x) x))) (eqv? p p)) #t)
(test (eqv? #<undefined> _undef_) #f)
(test (eqv? _undef_ _undef_) #t)

(when with-bignums
  (test (eqv? (bignum "1+i") (bignum "1+i")) #t)
  (test (eqv? (bignum "1+i") 1+i) #t)
  (test (eqv? 1+i (bignum "1+i")) #t)
  (test (eqv? (bignum "2.0") (bignum "2.0")) #t)
  (test (eqv? (bignum "2.0") (bignum "1.0")) #f))

;; from M Weaver:
(test (list (eqv? +0.0 -0.0)
	    (eqv? (complex +0.0  1.0)
		  (complex -0.0  1.0))
	    (eqv? (complex  1.0 +0.0)
		  (complex  1.0 -0.0)))
      '(#t #t #t))
(test (list ;(eq? +0.0 -0.0)
        (eq? (complex  +0.0  1.0)
              (complex -0.0  1.0))
        (eq? (complex   1.0 +0.0)
              (complex  1.0 -0.0)))
      '(#f #f))
(test (list (eq? +0 -0)
        (eq? (complex  +0  1)
              (complex -0  1))
        (eq? (complex   1 +0)
              (complex  1 -0)))
      '(#t #f #t))




;;; --------------------------------------------------------------------------------
;;; equal?

(test (equal? 'a 3) #f)
(test (equal? #t 't) #f)
(test (equal? "abs" 'abc) #f)
(test (equal? "hi" '(hi)) #f)
(test (equal? "()" '()) #f)
(test (equal? '(1) '(1)) #t)
(test (equal? '(#f) '(#f)) #t)
(test (equal? '(()) '(() . ())) #t)
(test (equal? #\a #\b) #f)
(test (equal? #\a #\a) #t)
(test (let ((x (string-ref "hi" 0))) (equal? x x)) #t)
(test (equal? #t #t) #t)
(test (equal? #f #f) #t)
(test (equal? #f #t) #f)
(test (equal? (null? '()) #t) #t)
(test (equal? (null? '(a)) #f) #t)
(test (equal? (cdr '(a)) '()) #t)
(test (equal? 'a 'a) #t)
(test (equal? 'a 'b) #f)
(test (equal? 'a (string->symbol "a")) #t)
(test (equal? '(a) '(b)) #f)
(test (equal? '(a) '(a)) #t)
(test (let ((x '(a . b))) (equal? x x)) #t)
(test (let ((x (cons 'a 'b))) (equal? x x)) #t)
(test (equal? (cons 'a 'b) (cons 'a 'b)) #t)
(test (equal?(cons 'a 'b)(cons 'a 'b)) #t) ; no space
(test (equal? "abc" "cba") #f)
(test (equal? "abc" "abc") #t)
(test (let ((x "hi")) (equal? x x)) #t)
(test (equal? (string #\h #\i) (string #\h #\i)) #t)
(test (equal? #(a) #(b)) #f)
(test (equal? #(a) #(a)) #t)
(test (let ((x (vector 'a))) (equal? x x)) #t)
(test (equal? (vector 'a) (vector 'a)) #t)
(test (equal? #(1 2) (vector 1 2)) #t)
(test (equal? #(1.0 2/3) (vector 1.0 2/3)) #t)
(test (equal? #(1 2) (vector 1 2.0)) #f) ; 2 not equal 2.0!
(test (equal? '(1 . 2) (cons 1 2)) #t)
(test (equal? '(1 #||# . #||# 2) (cons 1 2)) #t)
(test (- '#||#1) -1) ; hmm
(test (equal? #(1 "hi" #\a) (vector 1 "hi" #\a)) #t)
(test (equal? #((1 . 2)) (vector (cons 1 2))) #t)
(test (equal? #(1 "hi" #\a (1 . 2)) (vector 1 "hi" #\a (cons 1 2))) #t)
(test (equal? #(#f hi (1 2) 1 "hi" #\a (1 . 2)) (vector #f 'hi (list 1 2) 1 "hi" #\a (cons 1 2))) #t)
(test (equal? #(#(1) #(1)) (vector (vector 1) (vector 1))) #t)
(test (equal? #(()) (vector '())) #t)
(test (equal? #("hi" "ho") (vector "hi" '"ho")) #t)
(test (equal? `#(1) #(1)) #t)
(test (equal? ``#(1) #(1)) #t)
(test (equal? '`#(1) #(1)) #t)
(test (equal? ''#(1) #(1)) #f)
(test (equal? ''#(1) '#(1)) #f)
(test (equal? '(1) '        (   1    )) #t)
(test (equal? (list 1 "hi" #\a) '(1 "hi" #\a)) #t)
(test (equal? (list 1.0 2/3) '(1.0 2/3)) #t)
(test (equal? (list 1 2) '(1 2.0)) #f)
(test (equal? #(1.0+1.0i) (vector 1.0+1.0i)) #t)
(test (equal? (list 1.0+1.0i) '(1.0+1.0i)) #t)
(test (equal? '((())) (list (list (list)))) #t)
(test (equal? '((())) (cons (cons () ()) ())) #t)
(test (equal? car car) #t)
(test (equal? car cdr) #f)
(test (let ((x (lambda () 1))) (equal? x x)) #t)
(test (equal? (lambda () 1) (lambda () 1)) #f)
(test (equal? 9/2 9/2) #t)
(test (equal? #((())) #((()))) #t)
(test (equal? "123""123") #t);no space
(test (equal? """") #t)#|nospace|#
(test (equal? #()#()) #t)
(test (equal? #()()) #f)
(test (equal? ()"") #f)
(test (equal? "hi""hi") #t)
(test (equal? #<eof> #<eof>) #t)
(test (equal? #<undefined> #<undefined>) #t)
(test (equal? #<unspecified> #<unspecified>) #t)
(test (equal? (if #f #f) #<unspecified>) #t)
(test (equal? #<eof> #<undefined>) #f)
(test (equal? (values) #<eof>) #f)
(test (equal? (values) (values)) #t)
(test (equal? #<eof> #<unspecified>) #f)
(test (equal? (values) #<unspecified>) #t)
(test (equal? #<unspecified> (values)) #t)
(test (equal? #<eof> ()) #f)
(test (let () (define-macro (hi a) `(+ 1 ,a)) (equal? hi hi)) #t)
(test (let () (define (hi a) (+ 1 a)) (equal? hi hi)) #t)
(test (let ((x (lambda* (hi (a 1)) (+ 1 a)))) (equal? x x)) #t)
(test (equal? ``"" '"") #t)
(test (let ((pws (dilambda (lambda () 1) (lambda (x) x)))) (equal? pws pws)) #t)
(test (equal? if :if) #f)
(test (equal? (list 'abs 'cons) '(abs cons)) #t)
(test (equal? '(1) '(list 1)) #f)
(test (equal? #<undefined> _undef_) #f)
(test (equal? _undef_ _undef_) #t)

(test (equal? (values) #<unspecified>) #t)
(test (equal? (list (values)) (list #<unspecified>)) #t)

(test (equal? most-positive-fixnum most-positive-fixnum) #t)
(test (equal? most-positive-fixnum most-negative-fixnum) #f)
(test (equal? pi pi) #t)
(test (equal? 9223372036854775807 9223372036854775806) #f)
(test (equal? 9223372036854775807 -9223372036854775808) #f)
(test (equal? -9223372036854775808 -9223372036854775808) #t)
(test (equal? 123456789/2 123456789/2) #t)
(test (equal? 123456789/2 123456787/2) #f)
(test (equal? -123456789/2 -123456789/2) #t)
(test (equal? 2/123456789 2/123456789) #t)
(test (equal? -2/123456789 -2/123456789) #t)
(test (equal? 2147483647/2147483646 2147483647/2147483646) #t)
(test (equal? 3/4 12/16) #t)
(test (equal? 1/1 1) #t)
(test (equal? 312689/99532 833719/265381) #f)
(test (let ((x 3.141)) (equal? x x)) #t)
(test (let ((x 1+i)) (equal? x x)) #t)
(test (let* ((x 3.141) (y x)) (equal? x y)) #t)
(test (let* ((x 1+i) (y x)) (equal? x y)) #t)
(test (let* ((x 3/4) (y x)) (equal? x y)) #t)
(test (equal? '(+ '1) '(+ 1)) #f) ; !?

(test (equal? '(1/0) '(1/0)) #f)
(test (equal? '1/0 '1/0) #f) 
(test (let ((+nan.0 1/0)) (equal? '(+nan.0) '(+nan.0))) #t)
(test (let ((+nan.0 1/0)) (equal? (list +nan.0) (list +nan.0))) #f)
;;; in the first case we're looking at the symbol, not its value
(test (let ((+nan.0 1/0)) (equal? (vector +nan.0) (vector +nan.0))) #f)
(test (let ((+nan.0 1/0)) (equal? #(1/0) #(1/0))) #f)

(test (let ((x 3.141)) (equal? x x)) #t)
(test (equal? 3 3) #t)
(test (equal? 3 3.0) #f)
(test (equal? 3.0 3.0) #t)
(test (equal? 3-4i 3-4i) #t)
(test (equal? (string #\c) "c") #t)
(test (equal? equal? equal?) #t)
(test (equal? (cons 1 (cons 2 3)) '(1 2 . 3)) #t)
(test (equal? '() '()) #t)
(test (equal? '() (list)) #t)
(test (equal? (cdr '   ''0) '((quote 0))) #t)
(test (equal? "\n" "\n") #t)
(test (equal? #f ((lambda () #f))) #t)
(test (equal? (+) 0) #t)
(test (equal? (recompose 32 list '(1)) (recompose 32 list (list 1))) #t)
(test (equal? (recompose 100 list '(1)) (recompose 100 list (list 1))) #t)
(test (equal? (recompose 32 vector 1) (recompose 32 vector 1)) #t)
(test (equal? (reinvert 32 list vector 1) (reinvert 32 list vector 1)) #t)
(test (equal? (recompose 32 (lambda (a) (cons 1 a)) ()) (recompose 32 (lambda (a) (cons 1 a)) ())) #t)
(test (equal? (recompose 32 (lambda (a) (list 1 a)) ()) (recompose 32 (lambda (a) (list 1 a)) ())) #t)

(test (equal? "asd""asd") #t) ; is this the norm?
(let ((streq (lambda (a b) (equal? a b)))) (test (streq "asd""asd") #t))

(let ((things (vector #t #f #\space () "" 0 1 3/4 1+i 1.5 '(1 .2) #() (vector 1) (list 1) 'f 't #\t)))
  (let ((len (length things)))
    (do ((i 0 (+ i 1)))
	((= i (- len 1)))
      (do ((j (+ i 1) (+ j 1)))
	  ((= j len))
	(if (equal? (vector-ref things i) (vector-ref things j))
	    (format #t ";(equal? ~A ~A) -> #t?~%" (vector-ref things i) (vector-ref things j)))))))

(test (equal?) 'error)
(test (equal? #t) 'error)
(test (equal? #t #t #t) 'error)
(test (equal #t #t) 'error)

(when with-block
  (let ((b (make-block 4))) 
    (test (equal? b b) #t)
    (let ((b1 (make-block 4)))
      (test (equal? b b1) #t)
      (set! (b 1) 1.0)
      (test (equal? b b1) #f))))
(test (let ((p (c-pointer 0))) (equal? p (copy p))) #t)

(test (call-with-exit (lambda (return) (return (equal? return return)))) #t)
(test (call-with-exit (lambda (return) (call-with-exit (lambda (quit) (return (equal? return quit)))))) #f)
(test (call/cc (lambda (return) (return (equal? return return)))) #t)
(test (let hiho ((i 0)) (equal? hiho hiho)) #t)
(test (let hiho ((i 0)) (let hoho ((i 0)) (equal? hiho hoho))) #f)
(test (equal? + *) #f)
(test (equal? lambda lambda) #t)
(test (equal? lambda lambda*) #f)
(test (equal? let let) #t)
(test (equal? let letrec) #f)
(test (equal? define define) #t)
(test (equal? + ((lambda (a) a) +)) #t)
(test (let ((x "hi")) (define (hi) x) (equal? (hi) (hi))) #t)

;; so (eq? 3/4 3/4) is #f, (eqv? 3/4 3/4) is #t,
;;    (eqv? #(1) #(1)) is #f, (equal? #(1) #(1)) is #t
;;    (equal? 3 3.0) is #f, (= 3 3.0) is #t
;; in s7 
;;    (eq? 0.0 0.0) is #t,
;;    (eq? 2.0 2.0) is #f
(test (equal? .0 0.) #t)
(test (equal? 
       (list "hi" (integer->char 65) 1 'a-symbol (make-vector 3) (list) (cons 1 2) abs quasiquote 3 3/4 1.0+1.0i #\f (if #f #f) #<eof> #<undefined>)
       (list "hi" (integer->char 65) 1 'a-symbol (make-vector 3) (list) (cons 1 2) abs quasiquote 3 3/4 1.0+1.0i #\f (if #f #f) #<eof> #<undefined>))
      #t)
(test (equal? 
       (vector "hi" (integer->char 65) 1 'a-symbol (make-vector 3) abs quasiquote 3 3/4 1.0+1.0i #\f (if #f #f) #<eof> #<undefined>)
       (vector "hi" (integer->char 65) 1 'a-symbol (make-vector 3) abs quasiquote 3 3/4 1.0+1.0i #\f (if #f #f) #<eof> #<undefined>))
      #t)
(test (equal? (make-string 3) (make-string 3)) #t)
(test (equal? (make-list 3) (make-list 3)) #t)
(test (equal? (make-vector 3) (make-vector 3)) #t)
(unless with-bignums (test (equal? (random-state 100) (random-state 100)) #t))

(test (equal? (current-input-port) (current-input-port)) #t)
(test (equal? (current-input-port) (current-output-port)) #f)
(test (equal? *stdin* *stderr*) #f)
(test (let ((l1 (list 'a 'b)) 
	    (l2 (list 'a 'b 'a 'b))) 
	(set! (cdr (cdr l1)) l1) 
	(set! (cdr (cdr (cdr (cdr l2)))) l2)
	(equal? l1 l2))
      #t)
(test (let ((l1 (list 'a 'b)) 
	    (l2 (list 'a 'b 'a))) 
	(set! (cdr (cdr l1)) l1) 
	(set! (cdr (cdr (cdr l2))) l2)
	(equal? l1 l2))
      #f)
(test (let ((v1 (vector 1 2 3))
	    (v2 (vector 1 2 3)))
	(set! (v1 1) v1)
	(set! (v2 1) v2)
	(equal? v1 v2))
      #t)
(test (let ((v1 (vector 1 2 3))
	    (v2 (vector 1 2 4)))
	(set! (v1 1) v1)
	(set! (v2 1) v2)
	(equal? v1 v2))
      #f)

(when with-bignums
  (test (equal? (/ (* 5 most-positive-fixnum) (* 3 most-negative-fixnum)) -46116860184273879035/27670116110564327424) #t))



;;; --------------------------------------------------------------------------------
;;; morally-equal?

(test (morally-equal? 'a 3) #f)
(test (morally-equal? #t 't) #f)
(test (morally-equal? "abs" 'abc) #f)
(test (morally-equal? "hi" '(hi)) #f)
(test (morally-equal? "()" '()) #f)
(test (morally-equal? '(1) '(1)) #t)
(test (morally-equal? '(#f) '(#f)) #t)
(test (morally-equal? '(()) '(() . ())) #t)
(test (morally-equal? #\a #\b) #f)
(test (morally-equal? #\a #\a) #t)
(test (let ((x (string-ref "hi" 0))) (morally-equal? x x)) #t)
(test (morally-equal? #t #t) #t)
(test (morally-equal? #f #f) #t)
(test (morally-equal? #f #t) #f)
(test (morally-equal? (null? '()) #t) #t)
(test (morally-equal? (null? '(a)) #f) #t)
(test (morally-equal? (cdr '(a)) '()) #t)
(test (morally-equal? 'a 'a) #t)
(test (morally-equal? 'a 'b) #f)
(test (morally-equal? 'a (string->symbol "a")) #t)
(test (morally-equal? '(a) '(b)) #f)
(test (morally-equal? '(a) '(a)) #t)
(test (let ((x '(a . b))) (morally-equal? x x)) #t)
(test (let ((x (cons 'a 'b))) (morally-equal? x x)) #t)
(test (morally-equal? (cons 'a 'b) (cons 'a 'b)) #t)
(test (morally-equal?(cons 'a 'b)(cons 'a 'b)) #t) ; no space
(test (morally-equal? "abc" "cba") #f)
(test (morally-equal? "abc" "abc") #t)
(test (let ((x "hi")) (morally-equal? x x)) #t)
(test (morally-equal? (string #\h #\i) (string #\h #\i)) #t)
(test (morally-equal? #(a) #(b)) #f)
(test (morally-equal? #(a) #(a)) #t)
(test (let ((x (vector 'a))) (morally-equal? x x)) #t)
(test (morally-equal? (vector 'a) (vector 'a)) #t)
(test (morally-equal? #(1 2) (vector 1 2)) #t)
(test (morally-equal? #(1.0 2/3) (vector 1.0 2/3)) #t)
(test (morally-equal? #(1 2) (vector 1 2.0)) #t)
(test (morally-equal? '(1 . 2) (cons 1 2)) #t)
(test (morally-equal? '(1 #||# . #||# 2) (cons 1 2)) #t)
(test (- '#||#1) -1) ; hmm
(test (morally-equal? #(1 "hi" #\a) (vector 1 "hi" #\a)) #t)
(test (morally-equal? #((1 . 2)) (vector (cons 1 2))) #t)
(test (morally-equal? #(1 "hi" #\a (1 . 2)) (vector 1 "hi" #\a (cons 1 2))) #t)
(test (morally-equal? #(#f hi (1 2) 1 "hi" #\a (1 . 2)) (vector #f 'hi (list 1 2) 1 "hi" #\a (cons 1 2))) #t)
(test (morally-equal? #(#(1) #(1)) (vector (vector 1) (vector 1))) #t)
(test (morally-equal? #(()) (vector '())) #t)
(test (morally-equal? #("hi" "ho") (vector "hi" '"ho")) #t)
(test (morally-equal? `#(1) #(1)) #t)
(test (morally-equal? ``#(1) #(1)) #t)
(test (morally-equal? '`#(1) #(1)) #t)
(test (morally-equal? ''#(1) #(1)) #f)
(test (morally-equal? ''#(1) '#(1)) #f)
(test (morally-equal? (list 1 "hi" #\a) '(1 "hi" #\a)) #t)
(test (morally-equal? (list 1.0 2/3) '(1.0 2/3)) #t)
(test (morally-equal? (list 1 2) '(1 2.0)) #t)
(test (morally-equal? #(1.0+1.0i) (vector 1.0+1.0i)) #t)
(test (morally-equal? (list 1.0+1.0i) '(1.0+1.0i)) #t)
(test (morally-equal? '((())) (list (list (list)))) #t)
(test (morally-equal? car car) #t)
(test (morally-equal? car cdr) #f)
(test (let ((x (lambda () 1))) (morally-equal? x x)) #t)
(test (morally-equal? (lambda () 1) (lambda () 1)) #t)
(test (morally-equal? 9/2 9/2) #t)
(test (morally-equal? #((())) #((()))) #t)
(test (morally-equal? "123""123") #t);no space
(test (morally-equal? """") #t)#|nospace|#
(test (morally-equal? #()#()) #t)
(test (morally-equal? #()()) #f)
(test (morally-equal? ()"") #f)
(test (morally-equal? "hi""hi") #t)
(test (morally-equal? #<eof> #<eof>) #t)
(test (morally-equal? #<undefined> #<undefined>) #t)
(test (morally-equal? #<unspecified> #<unspecified>) #t)
(test (morally-equal? (if #f #f) #<unspecified>) #t)
(test (morally-equal? #<eof> #<undefined>) #f)
(test (morally-equal? #<eof> '()) #f)
(test (morally-equal? (values) #<eof>) #f)
(test (morally-equal? #<eof> (values)) #f)
(test (morally-equal? (values) (values)) #t)
(test (morally-equal? #<eof> #<unspecified>) #f)
(test (morally-equal? (values) #<unspecified>) #t)
(test (morally-equal? #<unspecified> (values)) #t)
(test (morally-equal? #<undefined> _undef_) #f)
(test (morally-equal? _undef_ _undef_) #t)
(test (let () (define-macro (hi a) `(+ 1 ,a)) (morally-equal? hi hi)) #t)
(test (let () (define (hi a) (+ 1 a)) (morally-equal? hi hi)) #t)
(test (let ((x (lambda* (hi (a 1)) (+ 1 a)))) (morally-equal? x x)) #t)
(test (morally-equal? ``"" '"") #t)
(test (let ((pws (dilambda (lambda () 1) (lambda (x) x)))) (morally-equal? pws pws)) #t)
(test (morally-equal? if :if) #f)
(test (morally-equal? (list 'abs 'cons) '(abs cons)) #t)
(test (morally-equal? (make-int-vector 2 0) (vector 0 0)) #t)
(test (morally-equal? (make-int-vector 2 0) (make-vector 2 0)) #t)
(test (morally-equal? (make-int-vector 2 0) (make-int-vector 2 0)) #t)
(test (morally-equal? (make-int-vector 2 0) (make-float-vector 2)) #t)
(test (morally-equal? (vector 0.0 0) (make-float-vector 2 0.0)) #t)
(test (morally-equal? (make-int-vector 2 0) (vector 0 1.0)) #f)
(test (morally-equal? (make-float-vector 1 -nan.0) (make-float-vector 1 -nan.0)) #t)

(test (morally-equal? (make-iterator "") (make-iterator "")) #t)
(test (morally-equal? (make-iterator "1") (make-iterator "1" (cons 1 1))) #t)
(test (morally-equal? (make-iterator "1" (cons 3 4)) (make-iterator "1" (cons 1 1))) #t)
(test (morally-equal? (make-iterator #()) (make-iterator #())) #t)
(test (morally-equal? (make-iterator '(1 2 3)) (make-iterator '(1 2 3))) #t)
(test (morally-equal? (make-iterator '(1 2 3)) (make-iterator '(1 2 3 4))) #f)

(let ((str "123"))
  (let ((i1 (make-iterator str))
	(i2 (make-iterator str)))
    (test (equal? i1 i2) #t)
    (test (morally-equal? i1 i2) #t)
    (iterate i1)
    (test (equal? i1 i2) #f)
    (test (morally-equal? i1 i2) #f)
    (iterate i2)
    (test (equal? i1 i2) #t)
    (test (morally-equal? i1 i2) #t)))

(let ((i1 (make-iterator "123"))
      (i2 (make-iterator "123")))
  (test (morally-equal? i1 i2) #t)
  (iterate i1)
  (test (morally-equal? i1 i2) #f)
  (iterate i2)
  (test (morally-equal? i1 i2) #t))

(let ((i1 (make-iterator (vector 1 2 3)))
      (i2 (make-iterator (int-vector 1 2 3))))
  (test (morally-equal? i1 i2) #t)
  (iterate i1)
  (test (morally-equal? i1 i2) #f)
  (iterate i2)
  (test (morally-equal? i1 i2) #t))
  
(let ((i1 (make-iterator (vector 1 2 3)))
      (i2 (make-iterator (vector 1 2 3))))
  (test (equal? i1 i2) #t)
  (test (morally-equal? i1 i2) #t)
  (iterate i1)
  (test (equal? i1 i2) #f)
  (test (morally-equal? i1 i2) #f)
  (iterate i2)
  (test (equal? i1 i2) #t)
  (test (morally-equal? i1 i2) #t))
  
(let ((str (hash-table* 'a 1 'b 2)))
  (let ((i1 (make-iterator str))
	(i2 (make-iterator str)))
    (test (equal? i1 i2) #t)
    (test (morally-equal? i1 i2) #t)
    (iterate i1)
    (test (equal? i1 i2) #f)
    (test (morally-equal? i1 i2) #f)
    (iterate i2)
    (test (equal? i1 i2) #t)
    (test (morally-equal? i1 i2) #t)))

(let ((i1 (make-iterator (list 1 2 3)))
      (i2 (make-iterator (list 1 2 3))))
  (test (morally-equal? i1 i2) #t)
  (iterate i1)
  (test (morally-equal? i1 i2) #f)
  (iterate i2)
  (test (morally-equal? i1 i2) #t))

;;; opt bug
(test (morally-equal? ''(1) (list 1)) #f)
(test (morally-equal? ''(1+i) '(1+i)) #f)
(test (morally-equal? '(1) (list 1)) #t)
(test (morally-equal? '(1) ''(1)) #f)
(test (morally-equal? (list 1) ''(1)) #f)
(test (morally-equal? (list 1) '(1)) #t)
(test (morally-equal? ''(1) ''(1)) #t)
(test (morally-equal? '''(1) ''(1)) #f)

(let ()
  (define-macro (mac a) `(+ 1 ,a))
  (define-macro (mac1 a) `(+ 1 ,a))
  (define-macro (mac2 a) `(+ 2 ,a))
  (define-macro (mac3 a b) `(+ ,b ,a))
  (test (morally-equal? mac mac1) #t)
  (test (morally-equal? mac mac2) #f)
  (test (morally-equal? mac1 mac3) #f)
  (test (morally-equal? mac3 mac3) #t)
  (let ()
    (define-macro (mac4 a) `(+ 1 ,a))
    (test (morally-equal? mac mac4) #t)) ; was #f
  (define-bacro (mac5 a) `(+ 1 ,a))
  (test (morally-equal? mac mac5) #f)
  (define-bacro (mac6 a) `(+ 1 ,a))
  (test (morally-equal? mac5 mac6) #t))

(test (morally-equal? most-positive-fixnum most-positive-fixnum) #t)
(test (morally-equal? most-positive-fixnum most-negative-fixnum) #f)
(test (morally-equal? pi pi) #t)
(test (morally-equal? 9223372036854775807 9223372036854775806) #f)
(test (morally-equal? 9223372036854775807 -9223372036854775808) #f)
(test (morally-equal? -9223372036854775808 -9223372036854775808) #t)
(test (morally-equal? 123456789/2 123456789/2) #t)
(test (morally-equal? 123456789/2 123456787/2) #f)
(test (morally-equal? -123456789/2 -123456789/2) #t)
(test (morally-equal? 2/123456789 2/123456789) #t)
(test (morally-equal? -2/123456789 -2/123456789) #t)
(test (morally-equal? 2147483647/2147483646 2147483647/2147483646) #t)
(test (morally-equal? 3/4 12/16) #t)
(test (morally-equal? 1/1 1) #t)
(test (morally-equal? 312689/99532 833719/265381) #f)
(test (let ((x 3.141)) (morally-equal? x x)) #t)
(test (let ((x 1+i)) (morally-equal? x x)) #t)
(test (let* ((x 3.141) (y x)) (morally-equal? x y)) #t)
(test (let* ((x 1+i) (y x)) (morally-equal? x y)) #t)
(test (let* ((x 3/4) (y x)) (morally-equal? x y)) #t)
(test (morally-equal? .1 1/10) #t)
(test (morally-equal? pi '(1 2)) #f)

(test (let ((x 3.141)) (morally-equal? x x)) #t)
(test (morally-equal? 3 3) #t)
(test (morally-equal? 3 3.0) #t)
(test (morally-equal? 3.0 3.0) #t)
(test (morally-equal? 3-4i 3-4i) #t)
(test (morally-equal? 1/0 0/0) #t)
(test (morally-equal? 1/0 (- 1/0)) #t) ; but they print as nan.0 and -nan.0 (this is C based I think), and equal? here is #f
(test (morally-equal? (real-part (log 0)) (- (real-part (log 0)))) #f)
(test (morally-equal? (log 0) (log 0)) #t)
(test (morally-equal? 0/0+i 0/0+i) #t)
(test (morally-equal? 0/0+i 0/0-i) #f)

(test (morally-equal? (list 3) (list 3.0)) #t)
(test (morally-equal? (list 3.0) (list 3.0)) #t)
(test (morally-equal? (list 3-4i) (list 3-4i)) #t)
(test (morally-equal? (list 1/0) (list 0/0)) #t)
(test (morally-equal? (list (log 0)) (list (log 0))) #t)
(test (morally-equal? (list 0/0+i) (list 0/0+i)) #t)

(test (morally-equal? (vector 3) (vector 3.0)) #t)
(test (morally-equal? (vector 3.0) (vector 3.0)) #t)
(test (morally-equal? (vector 3-4i) (vector 3-4i)) #t)
(test (morally-equal? (vector 1/0) (vector 0/0)) #t)
(test (morally-equal? (vector (log 0)) (vector (log 0))) #t)
(test (morally-equal? (vector 0/0+i) (vector 0/0+i)) #t)

(test (morally-equal? (string #\c) "c") #t)
(test (morally-equal? morally-equal? morally-equal?) #t)
(test (morally-equal? (cons 1 (cons 2 3)) '(1 2 . 3)) #t)
(test (morally-equal? '() '()) #t)
(test (morally-equal? '() (list)) #t)
(test (morally-equal? (cdr '   ''0) '((quote 0))) #t)
(test (morally-equal? "\n" "\n") #t)
(test (morally-equal? #f ((lambda () #f))) #t)
(test (morally-equal? (+) 0) #t)
(test (morally-equal? (recompose 32 list '(1)) (recompose 32 list (list 1))) #t)
(test (morally-equal? (recompose 100 list '(1)) (recompose 100 list (list 1))) #t)
(test (morally-equal? (recompose 32 vector 1) (recompose 32 vector 1)) #t)
(test (morally-equal? (reinvert 32 list vector 1) (reinvert 32 list vector 1)) #t)
(test (morally-equal? (recompose 32 (lambda (a) (cons 1 a)) ()) (recompose 32 (lambda (a) (cons 1 a)) ())) #t)
(test (morally-equal? (recompose 32 (lambda (a) (list 1 a)) ()) (recompose 32 (lambda (a) (list 1 a)) ())) #t)

(test (morally-equal? "asd""asd") #t) ; is this the norm?
(let ((streq (lambda (a b) (morally-equal? a b)))) (test (streq "asd""asd") #t))

(let ((things (vector #t #f #\space () "" 0 1 3/4 1+i 1.5 '(1 .2) #() (vector 1) (list 1) 'f 't #\t)))
  (let ((len (length things)))
    (do ((i 0 (+ i 1)))
	((= i (- len 1)))
      (do ((j (+ i 1) (+ j 1)))
	  ((= j len))
	(if (morally-equal? (vector-ref things i) (vector-ref things j))
	    (format #t ";(morally-equal? ~A ~A) -> #t?~%" (vector-ref things i) (vector-ref things j)))))))

(test (morally-equal?) 'error)
(test (morally-equal? #t) 'error)
(test (morally-equal? #t #t #t) 'error)
(test (equal #t #t) 'error)

(test (call-with-exit (lambda (return) (return (morally-equal? return return)))) #t)
(test (call-with-exit (lambda (return) (call-with-exit (lambda (quit) (return (morally-equal? return quit)))))) #f)
(test (call/cc (lambda (return) (return (morally-equal? return return)))) #t)
(test (let hiho ((i 0)) (morally-equal? hiho hiho)) #t)
(test (let hiho ((i 0)) (let hoho ((i 0)) (morally-equal? hiho hoho))) #f)
(test (morally-equal? + *) #f)
(test (morally-equal? lambda lambda) #t)
(test (morally-equal? lambda lambda*) #f)
(test (morally-equal? let let) #t)
(test (morally-equal? let letrec) #f)
(test (morally-equal? define define) #t)
(test (morally-equal? + ((lambda (a) a) +)) #t)
(test (let ((x "hi")) (define (hi) x) (morally-equal? (hi) (hi))) #t)

(test (morally-equal? 
       (list "hi" (integer->char 65) 1 'a-symbol (make-vector 3) (list) (cons 1 2) abs quasiquote 3 3/4 1.0+1.0i #\f (if #f #f) #<eof> #<undefined>)
       (list "hi" (integer->char 65) 1 'a-symbol (make-vector 3) (list) (cons 1 2) abs quasiquote 3 3/4 1.0+1.0i #\f (if #f #f) #<eof> #<undefined>))
      #t)
(test (morally-equal? 
       (vector "hi" (integer->char 65) 1 'a-symbol (make-vector 3) abs quasiquote 3 3/4 1.0+1.0i #\f (if #f #f) #<eof> #<undefined>)
       (vector "hi" (integer->char 65) 1 'a-symbol (make-vector 3) abs quasiquote 3 3/4 1.0+1.0i #\f (if #f #f) #<eof> #<undefined>))
      #t)
(test (morally-equal? (make-string 3) (make-string 3)) #t)
(test (morally-equal? (make-list 3) (make-list 3)) #t)
(test (morally-equal? (make-vector 3) (make-vector 3)) #t)
(test (morally-equal? (make-float-vector 3 1.0) (vector 1 1 1)) #t)
(test (morally-equal? (int-vector 1) (int-vector 2)) #f)
(test (morally-equal? (int-vector 1) (int-vector 1)) #t)
(test (morally-equal? (float-vector 0.0) (float-vector nan.0)) #f)
(test (morally-equal? (float-vector nan.0) (float-vector nan.0)) #t)
(let-temporarily (((*s7* 'morally-equal-float-epsilon) 0.0))
  (test (morally-equal? (float-vector 0.0) (float-vector nan.0)) #f)
  (test (morally-equal? (float-vector nan.0) (float-vector nan.0)) #t)
  (test (morally-equal? (float-vector 0.0) (float-vector 0.0)) #t)
  (test (morally-equal? (float-vector 0.0) (float-vector 1e-15)) #f)
  (set! (*s7* 'morally-equal-float-epsilon) 0.01)
  (test (morally-equal? (float-vector 0.0) (float-vector 1e-15)) #t)
  (test (morally-equal? (float-vector 0.0) (float-vector 0.005)) #t)
  (test (morally-equal? (float-vector 0.0) (float-vector 0.02)) #f))

(unless with-bignums (test (morally-equal? (random-state 100) (random-state 100)) #t))

(test (morally-equal? (current-input-port) (current-input-port)) #t)
(test (morally-equal? (current-input-port) (current-output-port)) #f)
(test (morally-equal? *stdin* *stderr*) #f)

(test (morally-equal? 
       (let () 
	 (define-macro* (a_func (an_arg (lambda () #t))) 
	   `,an_arg) 
	 (a_func)) 
       (let () 
	 (define-macro (a_func an_arg) 
	   `,an_arg) 
	 (a_func (lambda () #t))))
      #t) ; was #f

(test (morally-equal? (- 4/3 1 -63.0) 190/3) #t)
(test (morally-equal? 190/3 (- 4/3 1 -63.0)) #t)

(unless with-bignums
  (test (morally-equal? (+ 5e-16 nan.0) nan.0) #t)
  (test (morally-equal? (+ 0+5e-16i nan.0) nan.0) #t)
  (test (morally-equal? (+ 1/0 0+5e-16i) 1/0) #t)
  (test (morally-equal? 1/0 (+ 1/0 0+5e-16i)) #t)
  (test (morally-equal? 0 (+ 0 5e-16)) #t)
  (test (morally-equal? 0 (- 0 1/1428571428571429)) #t)
  (test (morally-equal? 0 (+ 0 0+5e-16i)) #t)
  (test (morally-equal? 0 (+ 0 0-1/1428571428571429i)) #t)
  (test (morally-equal? 0 (+ 0 1e-11)) #f)
  (test (morally-equal? 0 0) #t)
  (test (morally-equal? 0 1/1000) #f)
  (test (morally-equal? 0 0.0) #t)
  (test (morally-equal? 0 1e-16) #t)
  (test (morally-equal? 0 0+i) #f)
  (test (morally-equal? 0 1e-16+i) #f)
  (test (morally-equal? 0 0+1e-16i) #t)
  (test (morally-equal? 0 1e-300) #t)
  (test (morally-equal? 0 0+1e-300i) #t)
  (test (morally-equal? 0 1/0) #f)
  (test (morally-equal? 0 (- 0/0)) #f)
  (test (morally-equal? 0 (log 0)) #f)
  (test (morally-equal? 1 (+ 1 5e-16)) #t)
  (test (morally-equal? 1 (- 1 1/1428571428571429)) #t)
  (test (morally-equal? 1 (+ 1 0+5e-16i)) #t)
  (test (morally-equal? 1 (+ 1 0-1/1428571428571429i)) #t)
  (test (morally-equal? 1 (+ 1 1e-11)) #f)
  (test (morally-equal? 1 1) #t)
  (test (morally-equal? 1 1.0) #t)
  (test (morally-equal? 1 1e-16) #f)
  (test (morally-equal? 1 1e4) #f)
  (test (morally-equal? 1 0+i) #f)
  (test (morally-equal? 1 1e-16+i) #f)
  (test (morally-equal? 1 (complex 1 1/0)) #f)
  (test (morally-equal? 1 (complex (real-part (log 0)) 1)) #f)
  (test (morally-equal? 1 (complex 1 (real-part (log 0)))) #f)
  (test (morally-equal? 1000 (+ 1000 5e-16)) #t)
  (test (morally-equal? 1000 (- 1000 1/1428571428571429)) #t)
  (test (morally-equal? 1000 (+ 1000 0+5e-16i)) #t)
  (test (morally-equal? 1000 (+ 1000 0-1/1428571428571429i)) #t)
  (test (morally-equal? 1000 (+ 1000 1e-11)) #f)
  (test (morally-equal? 1000 1000) #t)
  (test (morally-equal? 1000 1/1000) #f)
  (test (morally-equal? 1000 1e4) #f)
  (test (morally-equal? 1/1000 (+ 1/1000 5e-16)) #t)
  (test (morally-equal? 1/1000 (- 1/1000 1/1428571428571429)) #t)
  (test (morally-equal? 1/1000 (+ 1/1000 0+5e-16i)) #t)
  (test (morally-equal? 1/1000 (+ 1/1000 0-1/1428571428571429i)) #t)
  (test (morally-equal? 1/1000 (+ 1/1000 1e-11)) #f)
  (test (morally-equal? 1/1000 0) #f)
  (test (morally-equal? 1/1000 1/1000) #t)
  (test (morally-equal? 1/1000 0.0) #f)
  (test (morally-equal? 1/1000 1e-16) #f)
  (test (morally-equal? 1/1000 1e-16+i) #f)
  (test (morally-equal? 1/1000 0+1e-16i) #f)
  (test (morally-equal? 1/1000 1e-300) #f)
  (test (morally-equal? 1/1000 0+1e-300i) #f)
  (test (morally-equal? 1/1000 1/0) #f)
  (test (morally-equal? 0.0 (+ 0.0 5e-16)) #t)
  (test (morally-equal? 0.0 (- 0.0 1/1428571428571429)) #t)
  (test (morally-equal? 0.0 (+ 0.0 0+5e-16i)) #t)
  (test (morally-equal? 0.0 (+ 0.0 0-1/1428571428571429i)) #t)
  (test (morally-equal? 0.0 (+ 0.0 1e-11)) #f)
  (test (morally-equal? 0.0 0) #t)
  (test (morally-equal? 0.0 1/1000) #f)
  (test (morally-equal? 0.0 0.0) #t)
  (test (morally-equal? 0.0 1e-16) #t)
  (test (morally-equal? 0.0 0+i) #f)
  (test (morally-equal? 0.0 1+i) #f)
  (test (morally-equal? 0.0 1e-16+i) #f)
  (test (morally-equal? 0.0 0+1e-16i) #t)
  (test (morally-equal? 0.0 1e-300) #t)
  (test (morally-equal? 0.0 0+1e-300i) #t)
  (test (morally-equal? 0.0 1/0) #f)
  (test (morally-equal? 0.0 (real-part (log 0))) #f)
  (test (morally-equal? 0.0 (- (real-part (log 0)))) #f)
  (test (morally-equal? 0.0 (- 0/0)) #f)
  (test (morally-equal? 0.0 (log 0)) #f)
  (test (morally-equal? 1.0 (+ 1.0 5e-16)) #t)
  (test (morally-equal? 1.0 (- 1.0 1/1428571428571429)) #t)
  (test (morally-equal? 1.0 (+ 1.0 0+5e-16i)) #t)
  (test (morally-equal? 1.0 (+ 1.0 0-1/1428571428571429i)) #t)
  (test (morally-equal? 1.0 (+ 1.0 1e-11)) #f)
  (test (morally-equal? 1.0 1) #t)
  (test (morally-equal? 1.0 1.0) #t)
  (test (morally-equal? 1.0 1e-16+i) #f)
  (test (morally-equal? 1.0 0+1e-16i) #f)
  (test (morally-equal? 1.0 1e-300) #f)
  (test (morally-equal? 1.0 0+1e-300i) #f)
  (test (morally-equal? 1.0 1/0) #f)
  (test (morally-equal? 1.0 (- 0/0)) #f)
  (test (morally-equal? 1.0 (complex 1/0 1)) #f)
  (test (morally-equal? 1.0 (complex 1 1/0)) #f)
  (test (morally-equal? 1.0 (complex 1 (real-part (log 0)))) #f)
  (test (morally-equal? 1e-16 (+ 1e-16 5e-16)) #t)
  (test (morally-equal? 1e-16 (- 1e-16 1/1428571428571429)) #t)
  (test (morally-equal? 1e-16 (+ 1e-16 0+5e-16i)) #t)
  (test (morally-equal? 1e-16 (+ 1e-16 0-1/1428571428571429i)) #t)
  (test (morally-equal? 1e-16 (+ 1e-16 1e-11)) #f)
  (test (morally-equal? 1e-16 0) #t)
  (test (morally-equal? 1e-16 1/1000) #f)
  (test (morally-equal? 1e-16 0.0) #t)
  (test (morally-equal? 1e-16 1e-16) #t)
  (test (morally-equal? 1e-16 1e-16+i) #f)
  (test (morally-equal? 1e-16 0+1e-16i) #t)
  (test (morally-equal? 1e-16 1e-300) #t)
  (test (morally-equal? 1e-16 0+1e-300i) #t)
  (test (morally-equal? 1e-16 1/0) #f)
  (test (morally-equal? 1e4 (+ 1e4 5e-16)) #t)
  (test (morally-equal? 1e4 (- 1e4 1/1428571428571429)) #t)
  (test (morally-equal? 1e4 (+ 1e4 0+5e-16i)) #t)
  (test (morally-equal? 1e4 (+ 1e4 0-1/1428571428571429i)) #t)
  (test (morally-equal? 1e4 (+ 1e4 1e-11)) #f)
  (test (morally-equal? 1e4 1000) #f)
  (test (morally-equal? 1e4 1/1000) #f)
  (test (morally-equal? 1e4 1e-16) #f)
  (test (morally-equal? 1e4 1e4) #t)
  (test (morally-equal? 1e4 1e-16+i) #f)
  (test (morally-equal? 1e4 0+1e-16i) #f)
  (test (morally-equal? 1e4 1e-300) #f)
  (test (morally-equal? 1e4 0+1e-300i) #f)
  (test (morally-equal? 1e4 1/0) #f)
  (test (morally-equal? 0+i (+ 0+i 5e-16)) #t)
  (test (morally-equal? 0+i (- 0+i 1/1428571428571429)) #t)
  (test (morally-equal? 0+i (+ 0+i 0+5e-16i)) #t)
  (test (morally-equal? 0+i (+ 0+i 0-1/1428571428571429i)) #t)
  (test (morally-equal? 0+i (+ 0+i 1e-11)) #f)
  (test (morally-equal? 0+i 0) #f)
  (test (morally-equal? 0+i 1/1000) #f)
  (test (morally-equal? 0+i 0.0) #f)
  (test (morally-equal? 0+i 1e-16) #f)
  (test (morally-equal? 0+i 0+i) #t)
  (test (morally-equal? 0+i 1+i) #f)
  (test (morally-equal? 0+i 1e-16+i) #t)
  (test (morally-equal? 0+i 0+1e-16i) #f)
  (test (morally-equal? 0+i 1e-300) #f)
  (test (morally-equal? 0+i 0+1e-300i) #f)
  (test (morally-equal? 0+i 1/0) #f)
  (test (morally-equal? 0+i (real-part (log 0))) #f)
  (test (morally-equal? 0+i (- (real-part (log 0)))) #f)
  (test (morally-equal? 0+i (- 0/0)) #f)
  (test (morally-equal? 0+i (log 0)) #f)
  (test (morally-equal? 0+i (complex 1/0 1)) #f)
  (test (morally-equal? 0+i (complex 1 1/0)) #f)
  (test (morally-equal? 0+i (complex 1/0 1/0)) #f)
  (test (morally-equal? 0+i (complex (real-part (log 0)) 1/0)) #f)
  (test (morally-equal? 1+i (+ 1+i 5e-16)) #t)
  (test (morally-equal? 1+i (- 1+i 1/1428571428571429)) #t)
  (test (morally-equal? 1+i (+ 1+i 0+5e-16i)) #t)
  (test (morally-equal? 1+i (+ 1+i 0-1/1428571428571429i)) #t)
  (test (morally-equal? 1+i (+ 1+i 1e-11)) #f)
  (test (morally-equal? 1+i 0+i) #f)
  (test (morally-equal? 1+i 1+i) #t)
  (test (morally-equal? 1+i 1e-16+i) #f)
  (test (morally-equal? 1+i 0+1e-16i) #f)
  (test (morally-equal? 1+i 1e-300) #f)
  (test (morally-equal? 1+i 0+1e-300i) #f)
  (test (morally-equal? 1e-16+i (+ 1e-16+i 5e-16)) #t)
  (test (morally-equal? 1e-16+i (- 1e-16+i 1/1428571428571429)) #t)
  (test (morally-equal? 1e-16+i (+ 1e-16+i 0+5e-16i)) #t)
  (test (morally-equal? 1e-16+i (+ 1e-16+i 0-1/1428571428571429i)) #t)
  (test (morally-equal? 1e-16+i (+ 1e-16+i 1e-11)) #f)
  (test (morally-equal? 1e-16+i 0) #f)
  (test (morally-equal? 1e-16+i 1e-16) #f)
  (test (morally-equal? 1e-16+i 1e4) #f)
  (test (morally-equal? 1e-16+i 0+i) #t)
  (test (morally-equal? 1e-16+i 1+i) #f)
  (test (morally-equal? 1e-16+i 1e-16+i) #t)
  (test (morally-equal? 1e-16+i 0+1e-16i) #f)
  (test (morally-equal? 1e-16+i 1e-300) #f)
  (test (morally-equal? 1e-16+i 0+1e-300i) #f)
  (test (morally-equal? 1e-16+i 1/0) #f)
  (test (morally-equal? 1e-16+i (real-part (log 0))) #f)
  (test (morally-equal? 1e-16+i (- (real-part (log 0)))) #f)
  (test (morally-equal? 1e-16+i (- 0/0)) #f)
  (test (morally-equal? 1e-16+i (log 0)) #f)
  (test (morally-equal? 1e-16+i (complex 1/0 1)) #f)
  (test (morally-equal? 1e-16+i (complex 1 1/0)) #f)
  (test (morally-equal? 1e-16+i (complex 1/0 1/0)) #f)
  (test (morally-equal? 1e-16+i (complex (real-part (log 0)) 1/0)) #f)
  (test (morally-equal? 0+1e-16i (+ 0+1e-16i 5e-16)) #t)
  (test (morally-equal? 0+1e-16i (- 0+1e-16i 1/1428571428571429)) #t)
  (test (morally-equal? 0+1e-16i (+ 0+1e-16i 0+5e-16i)) #t)
  (test (morally-equal? 0+1e-16i (+ 0+1e-16i 0-1/1428571428571429i)) #t)
  (test (morally-equal? 0+1e-16i (+ 0+1e-16i 1e-11)) #f)
  (test (morally-equal? 0+1e-16i 0) #t)
  (test (morally-equal? 0+1e-16i 1/1000) #f)
  (test (morally-equal? 0+1e-16i 0.0) #t)
  (test (morally-equal? 0+1e-16i 1e-16) #t)
  (test (morally-equal? 0+1e-16i 0+i) #f)
  (test (morally-equal? 0+1e-16i 1+i) #f)
  (test (morally-equal? 0+1e-16i 1e-16+i) #f)
  (test (morally-equal? 0+1e-16i 0+1e-16i) #t)
  (test (morally-equal? 0+1e-16i 1e-300) #t)
  (test (morally-equal? 0+1e-16i 0+1e-300i) #t)
  (test (morally-equal? 0+1e-16i 1/0) #f)
  (test (morally-equal? 0+1e-16i (real-part (log 0))) #f)
  (test (morally-equal? 0+1e-16i (- (real-part (log 0)))) #f)
  (test (morally-equal? 0+1e-16i (- 0/0)) #f)
  (test (morally-equal? 0+1e-16i (log 0)) #f)
  (test (morally-equal? 1e-300 (+ 1e-300 5e-16)) #t)
  (test (morally-equal? 1e-300 (- 1e-300 1/1428571428571429)) #t)
  (test (morally-equal? 1e-300 (+ 1e-300 0+5e-16i)) #t)
  (test (morally-equal? 1e-300 (+ 1e-300 0-1/1428571428571429i)) #t)
  (test (morally-equal? 1e-300 (+ 1e-300 1e-11)) #f)
  (test (morally-equal? 1e-300 0) #t)
  (test (morally-equal? 1e-300 1/1000) #f)
  (test (morally-equal? 1e-300 0.0) #t)
  (test (morally-equal? 1e-300 1e-16) #t)
  (test (morally-equal? 1e-300 1e-16+i) #f)
  (test (morally-equal? 1e-300 0+1e-16i) #t)
  (test (morally-equal? 1e-300 1e-300) #t)
  (test (morally-equal? 1e-300 0+1e-300i) #t)
  (test (morally-equal? 1e-300 1/0) #f)
  (test (morally-equal? 1e-300 (- 0/0)) #f)
  (test (morally-equal? 1e-300 (log 0)) #f)
  (test (morally-equal? 0+1e-300i (+ 0+1e-300i 5e-16)) #t)
  (test (morally-equal? 0+1e-300i (- 0+1e-300i 1/1428571428571429)) #t)
  (test (morally-equal? 0+1e-300i (+ 0+1e-300i 0+5e-16i)) #t)
  (test (morally-equal? 0+1e-300i (+ 0+1e-300i 0-1/1428571428571429i)) #t)
  (test (morally-equal? 0+1e-300i (+ 0+1e-300i 1e-11)) #f)
  (test (morally-equal? 0+1e-300i 0) #t)
  (test (morally-equal? 0+1e-300i 1000) #f)
  (test (morally-equal? 0+1e-300i 1/1000) #f)
  (test (morally-equal? 0+1e-300i 0.0) #t)
  (test (morally-equal? 0+1e-300i 1e-16) #t)
  (test (morally-equal? 0+1e-300i 0+i) #f)
  (test (morally-equal? 0+1e-300i 1e-16+i) #f)
  (test (morally-equal? 0+1e-300i 0+1e-16i) #t)
  (test (morally-equal? 0+1e-300i 1e-300) #t)
  (test (morally-equal? 0+1e-300i 0+1e-300i) #t)
  (test (morally-equal? 0+1e-300i 1/0) #f)
  (test (morally-equal? 0+1e-300i (- 0/0)) #f)
  (test (morally-equal? 1/0 (+ 1/0 5e-16)) #t)
  (test (morally-equal? 1/0 (- 1/0 1/1428571428571429)) #t)
  (test (morally-equal? 1/0 (+ 1/0 0+5e-16i)) #t)
  (test (morally-equal? 1/0 (+ 1/0 0-1/1428571428571429i)) #t)
  (test (morally-equal? 1/0 0) #f)
  (test (morally-equal? 1/0 1/0) #t)
  (test (morally-equal? 1/0 (real-part (log 0))) #f)
  (test (morally-equal? 1/0 (- (real-part (log 0)))) #f)
  (test (morally-equal? 1/0 (- 0/0)) #t)
  (test (morally-equal? 1/0 (log 0)) #f)
  (test (morally-equal? 1/0 (complex 1/0 1)) #f)
  (test (morally-equal? 1/0 (complex 1 1/0)) #f)
  (test (morally-equal? 1/0 (complex 1/0 1/0)) #f)
  (test (morally-equal? 1/0 (complex (real-part (log 0)) 1/0)) #f)
  (test (morally-equal? 1/0 (complex 1/0 (real-part (log 0)))) #f)
  (test (morally-equal? 1/0 (complex (real-part (log 0)) (real-part (log 0)))) #f)
  (test (morally-equal? 1/0 (complex (real-part (log 0)) 1)) #f)
  (test (morally-equal? 1/0 (complex 1 (real-part (log 0)))) #f)
  (test (morally-equal? (real-part (log 0)) (+ (real-part (log 0)) 5e-16)) #t)
  (test (morally-equal? (real-part (log 0)) (- (real-part (log 0)) 1/1428571428571429)) #t)
  (test (morally-equal? (real-part (log 0)) (+ (real-part (log 0)) 0+5e-16i)) #t)
  (test (morally-equal? (real-part (log 0)) (+ (real-part (log 0)) 0-1/1428571428571429i)) #t)
  (test (morally-equal? (real-part (log 0)) 0) #f)
  (test (morally-equal? (real-part (log 0)) 1e-16+i) #f)
  (test (morally-equal? (real-part (log 0)) 0+1e-16i) #f)
  (test (morally-equal? (real-part (log 0)) 1e-300) #f)
  (test (morally-equal? (real-part (log 0)) 0+1e-300i) #f)
  (test (morally-equal? (real-part (log 0)) 1/0) #f)
  (test (morally-equal? (real-part (log 0)) (real-part (log 0))) #t)
  (test (morally-equal? (real-part (log 0)) (- (real-part (log 0)))) #f)
  (test (morally-equal? (real-part (log 0)) (- 0/0)) #f)
  (test (morally-equal? (real-part (log 0)) (log 0)) #f)
  (test (morally-equal? (real-part (log 0)) (complex 1/0 1)) #f)
  (test (morally-equal? (real-part (log 0)) (complex 1 1/0)) #f)
  (test (morally-equal? (real-part (log 0)) (complex 1/0 1/0)) #f)
  (test (morally-equal? (real-part (log 0)) (complex (real-part (log 0)) 1/0)) #f)
  (test (morally-equal? (real-part (log 0)) (complex 1/0 (real-part (log 0)))) #f)
  (test (morally-equal? (real-part (log 0)) (complex (real-part (log 0)) (real-part (log 0)))) #f)
  (test (morally-equal? (real-part (log 0)) (complex (real-part (log 0)) 1)) #f)
  (test (morally-equal? (real-part (log 0)) (complex 1 (real-part (log 0)))) #f)
  (test (morally-equal? (- (real-part (log 0))) (+ (- (real-part (log 0))) 5e-16)) #t)
  (test (morally-equal? (- (real-part (log 0))) (- (- (real-part (log 0))) 1/1428571428571429)) #t)
  (test (morally-equal? (- (real-part (log 0))) (+ (- (real-part (log 0))) 0+5e-16i)) #t)
  (test (morally-equal? (- (real-part (log 0))) (+ (- (real-part (log 0))) 0-1/1428571428571429i)) #t)
  (test (morally-equal? (- (real-part (log 0))) 1e-16+i) #f)
  (test (morally-equal? (- (real-part (log 0))) 0+1e-16i) #f)
  (test (morally-equal? (- (real-part (log 0))) 1e-300) #f)
  (test (morally-equal? (- (real-part (log 0))) 0+1e-300i) #f)
  (test (morally-equal? (- (real-part (log 0))) 1/0) #f)
  (test (morally-equal? (- (real-part (log 0))) (real-part (log 0))) #f)
  (test (morally-equal? (- (real-part (log 0))) (- (real-part (log 0)))) #t)
  (test (morally-equal? (- (real-part (log 0))) (- 0/0)) #f)
  (test (morally-equal? (- (real-part (log 0))) (log 0)) #f)
  (test (morally-equal? (- (real-part (log 0))) (complex 1/0 1)) #f)
  (test (morally-equal? (- (real-part (log 0))) (complex 1 1/0)) #f)
  (test (morally-equal? (- (real-part (log 0))) (complex 1/0 1/0)) #f)
  (test (morally-equal? (- (real-part (log 0))) (complex (real-part (log 0)) 1/0)) #f)
  (test (morally-equal? (- (real-part (log 0))) (complex 1/0 (real-part (log 0)))) #f)
  (test (morally-equal? (- (real-part (log 0))) (complex (real-part (log 0)) (real-part (log 0)))) #f)
  (test (morally-equal? (- (real-part (log 0))) (complex (real-part (log 0)) 1)) #f)
  (test (morally-equal? (- (real-part (log 0))) (complex 1 (real-part (log 0)))) #f)
  (test (morally-equal? (- 0/0) (+ (- 0/0) 5e-16)) #t)
  (test (morally-equal? (- 0/0) (- (- 0/0) 1/1428571428571429)) #t)
  (test (morally-equal? (- 0/0) (+ (- 0/0) 0+5e-16i)) #t)
  (test (morally-equal? (- 0/0) (+ (- 0/0) 0-1/1428571428571429i)) #t)
  (test (morally-equal? (- 0/0) 0) #f)
  (test (morally-equal? (- 0/0) 1e-300) #f)
  (test (morally-equal? (- 0/0) 0+1e-300i) #f)
  (test (morally-equal? (- 0/0) 1/0) #t)
  (test (morally-equal? (- 0/0) (real-part (log 0))) #f)
  (test (morally-equal? (- 0/0) (- (real-part (log 0)))) #f)
  (test (morally-equal? (- 0/0) (- 0/0)) #t)
  (test (morally-equal? (- 0/0) (log 0)) #f)
  (test (morally-equal? (- 0/0) (complex 1/0 1)) #f)
  (test (morally-equal? (- 0/0) (complex 1 1/0)) #f)
  (test (morally-equal? (- 0/0) (complex 1/0 1/0)) #f)
  (test (morally-equal? (- 0/0) (complex (real-part (log 0)) 1/0)) #f)
  (test (morally-equal? (- 0/0) (complex 1/0 (real-part (log 0)))) #f)
  (test (morally-equal? (- 0/0) (complex (real-part (log 0)) (real-part (log 0)))) #f)
  (test (morally-equal? (- 0/0) (complex (real-part (log 0)) 1)) #f)
  (test (morally-equal? (- 0/0) (complex 1 (real-part (log 0)))) #f)
  (test (morally-equal? (log 0) (+ (log 0) 5e-16)) #t)
  (test (morally-equal? (log 0) (- (log 0) 1/1428571428571429)) #t)
  (test (morally-equal? (log 0) (+ (log 0) 0+5e-16i)) #t)
  (test (morally-equal? (log 0) (+ (log 0) 0-1/1428571428571429i)) #t)
  (test (morally-equal? (log 0) 0) #f)
  (test (morally-equal? (log 0) 1/0) #f)
  (test (morally-equal? (log 0) (real-part (log 0))) #f)
  (test (morally-equal? (log 0) (- (real-part (log 0)))) #f)
  (test (morally-equal? (log 0) (- 0/0)) #f)
  (test (morally-equal? (log 0) (log 0)) #t)
  (test (morally-equal? (log 0) (complex 1/0 1)) #f)
  (test (morally-equal? (log 0) (complex 1 1/0)) #f)
  (test (morally-equal? (log 0) (complex 1/0 1/0)) #f)
  (test (morally-equal? (log 0) (complex (real-part (log 0)) 1/0)) #f)
  (test (morally-equal? (log 0) (complex 1/0 (real-part (log 0)))) #f)
  (test (morally-equal? (log 0) (complex (real-part (log 0)) (real-part (log 0)))) #f)
  (test (morally-equal? (log 0) (complex (real-part (log 0)) 1)) #f)
  (test (morally-equal? (log 0) (complex 1 (real-part (log 0)))) #f)
  (test (morally-equal? (complex 1/0 1) (+ (complex 1/0 1) 5e-16)) #t)
  (test (morally-equal? (complex 1/0 1) (- (complex 1/0 1) 1/1428571428571429)) #t)
  (test (morally-equal? (complex 1/0 1) (+ (complex 1/0 1) 0+5e-16i)) #t)
  (test (morally-equal? (complex 1/0 1) (+ (complex 1/0 1) 0-1/1428571428571429i)) #t)
  (test (morally-equal? (complex 1/0 1) 0) #f)
  (test (morally-equal? (complex 1/0 1) 1) #f)
  (test (morally-equal? (complex 1/0 1) 1e-16+i) #f)
  (test (morally-equal? (complex 1/0 1) 0+1e-16i) #f)
  (test (morally-equal? (complex 1/0 1) 1e-300) #f)
  (test (morally-equal? (complex 1/0 1) 0+1e-300i) #f)
  (test (morally-equal? (complex 1/0 1) 1/0) #f)
  (test (morally-equal? (complex 1/0 1) (real-part (log 0))) #f)
  (test (morally-equal? (complex 1/0 1) (- (real-part (log 0)))) #f)
  (test (morally-equal? (complex 1/0 1) (- 0/0)) #f)
  (test (morally-equal? (complex 1/0 1) (log 0)) #f)
  (test (morally-equal? (complex 1/0 1) (complex 1/0 1)) #t)
  (test (morally-equal? (complex 1/0 1) (complex 1 1/0)) #f)
  (test (morally-equal? (complex 1/0 1) (complex 1/0 1/0)) #f)
  (test (morally-equal? (complex 1/0 1) (complex (real-part (log 0)) 1/0)) #f)
  (test (morally-equal? (complex 1/0 1) (complex 1/0 (real-part (log 0)))) #f)
  (test (morally-equal? (complex 1/0 1) (complex (real-part (log 0)) (real-part (log 0)))) #f)
  (test (morally-equal? (complex 1/0 1) (complex (real-part (log 0)) 1)) #f)
  (test (morally-equal? (complex 1/0 1) (complex 1 (real-part (log 0)))) #f)
  (test (morally-equal? (complex 1 1/0) (+ (complex 1 1/0) 5e-16)) #t)
  (test (morally-equal? (complex 1 1/0) (- (complex 1 1/0) 1/1428571428571429)) #t)
  (test (morally-equal? (complex 1 1/0) (+ (complex 1 1/0) 0+5e-16i)) #t)
  (test (morally-equal? (complex 1 1/0) (+ (complex 1 1/0) 0-1/1428571428571429i)) #t)
  (test (morally-equal? (complex 1 1/0) 0) #f)
  (test (morally-equal? (complex 1 1/0) 1) #f)
  (test (morally-equal? (complex 1 1/0) 1e-300) #f)
  (test (morally-equal? (complex 1 1/0) 0+1e-300i) #f)
  (test (morally-equal? (complex 1 1/0) 1/0) #f)
  (test (morally-equal? (complex 1 1/0) (real-part (log 0))) #f)
  (test (morally-equal? (complex 1 1/0) (- (real-part (log 0)))) #f)
  (test (morally-equal? (complex 1 1/0) (- 0/0)) #f)
  (test (morally-equal? (complex 1 1/0) (log 0)) #f)
  (test (morally-equal? (complex 1 1/0) (complex 1/0 1)) #f)
  (test (morally-equal? (complex 1 1/0) (complex 1 1/0)) #t)
  (test (morally-equal? (complex 1 1/0) (complex 1/0 1/0)) #f)
  (test (morally-equal? (complex 1 1/0) (complex (real-part (log 0)) 1/0)) #f)
  (test (morally-equal? (complex 1 1/0) (complex 1/0 (real-part (log 0)))) #f)
  (test (morally-equal? (complex 1 1/0) (complex (real-part (log 0)) (real-part (log 0)))) #f)
  (test (morally-equal? (complex 1 1/0) (complex (real-part (log 0)) 1)) #f)
  (test (morally-equal? (complex 1 1/0) (complex 1 (real-part (log 0)))) #f)
  (test (morally-equal? (complex 1/0 1/0) (+ (complex 1/0 1/0) 5e-16)) #t)
  (test (morally-equal? (complex 1/0 1/0) (- (complex 1/0 1/0) 1/1428571428571429)) #t)
  (test (morally-equal? (complex 1/0 1/0) (+ (complex 1/0 1/0) 0+5e-16i)) #t)
  (test (morally-equal? (complex 1/0 1/0) (+ (complex 1/0 1/0) 0-1/1428571428571429i)) #t)
  (test (morally-equal? (complex 1/0 1/0) 0) #f)
  (test (morally-equal? (complex 1/0 1/0) 1/0) #f)
  (test (morally-equal? (complex 1/0 1/0) (real-part (log 0))) #f)
  (test (morally-equal? (complex 1/0 1/0) (- (real-part (log 0)))) #f)
  (test (morally-equal? (complex 1/0 1/0) (- 0/0)) #f)
  (test (morally-equal? (complex 1/0 1/0) (log 0)) #f)
  (test (morally-equal? (complex 1/0 1/0) (complex 1/0 1)) #f)
  (test (morally-equal? (complex 1/0 1/0) (complex 1 1/0)) #f)
  (test (morally-equal? (complex 1/0 1/0) (complex 1/0 1/0)) #t)
  (test (morally-equal? (complex 1/0 1/0) (complex (real-part (log 0)) 1/0)) #f)
  (test (morally-equal? (complex 1/0 1/0) (complex 1/0 (real-part (log 0)))) #f)
  (test (morally-equal? (complex 1/0 1/0) (complex (real-part (log 0)) (real-part (log 0)))) #f)
  (test (morally-equal? (complex 1/0 1/0) (complex (real-part (log 0)) 1)) #f)
  (test (morally-equal? (complex 1/0 1/0) (complex 1 (real-part (log 0)))) #f)
  (test (morally-equal? (complex (real-part (log 0)) 1/0) (+ (complex (real-part (log 0)) 1/0) 5e-16)) #t)
  (test (morally-equal? (complex (real-part (log 0)) 1/0) (- (complex (real-part (log 0)) 1/0) 1/1428571428571429)) #t)
  (test (morally-equal? (complex (real-part (log 0)) 1/0) (+ (complex (real-part (log 0)) 1/0) 0+5e-16i)) #t)
  (test (morally-equal? (complex (real-part (log 0)) 1/0) (+ (complex (real-part (log 0)) 1/0) 0-1/1428571428571429i)) #t)
  (test (morally-equal? (complex (real-part (log 0)) 1/0) 0) #f)
  (test (morally-equal? (complex (real-part (log 0)) 1/0) 1) #f)
  (test (morally-equal? (complex (real-part (log 0)) 1/0) 1000) #f)
  (test (morally-equal? (complex (real-part (log 0)) 1/0) 1/1000) #f)
  (test (morally-equal? (complex (real-part (log 0)) 1/0) 0.0) #f)
  (test (morally-equal? (complex (real-part (log 0)) 1/0) 1.0) #f)
  (test (morally-equal? (complex (real-part (log 0)) 1/0) 1e-16) #f)
  (test (morally-equal? (complex (real-part (log 0)) 1/0) 1e4) #f)
  (test (morally-equal? (complex (real-part (log 0)) 1/0) 1/0) #f)
  (test (morally-equal? (complex (real-part (log 0)) 1/0) (real-part (log 0))) #f)
  (test (morally-equal? (complex (real-part (log 0)) 1/0) (- (real-part (log 0)))) #f)
  (test (morally-equal? (complex (real-part (log 0)) 1/0) (- 0/0)) #f)
  (test (morally-equal? (complex (real-part (log 0)) 1/0) (log 0)) #f)
  (test (morally-equal? (complex (real-part (log 0)) 1/0) (complex 1/0 1)) #f)
  (test (morally-equal? (complex (real-part (log 0)) 1/0) (complex 1 1/0)) #f)
  (test (morally-equal? (complex (real-part (log 0)) 1/0) (complex 1/0 1/0)) #f)
  (test (morally-equal? (complex (real-part (log 0)) 1/0) (complex (real-part (log 0)) 1/0)) #t)
  (test (morally-equal? (complex (real-part (log 0)) 1/0) (complex 1/0 (real-part (log 0)))) #f)
  (test (morally-equal? (complex (real-part (log 0)) 1/0) (complex (real-part (log 0)) (real-part (log 0)))) #f)
  (test (morally-equal? (complex (real-part (log 0)) 1/0) (complex (real-part (log 0)) 1)) #f)
  (test (morally-equal? (complex (real-part (log 0)) 1/0) (complex 1 (real-part (log 0)))) #f)
  (test (morally-equal? (complex 1/0 (real-part (log 0))) (+ (complex 1/0 (real-part (log 0))) 5e-16)) #t)
  (test (morally-equal? (complex 1/0 (real-part (log 0))) (- (complex 1/0 (real-part (log 0))) 1/1428571428571429)) #t)
  (test (morally-equal? (complex 1/0 (real-part (log 0))) (+ (complex 1/0 (real-part (log 0))) 0+5e-16i)) #t)
  (test (morally-equal? (complex 1/0 (real-part (log 0))) (+ (complex 1/0 (real-part (log 0))) 0-1/1428571428571429i)) #t)
  (test (morally-equal? (complex 1/0 (real-part (log 0))) (real-part (log 0))) #f)
  (test (morally-equal? (complex 1/0 (real-part (log 0))) (- (real-part (log 0)))) #f)
  (test (morally-equal? (complex 1/0 (real-part (log 0))) (- 0/0)) #f)
  (test (morally-equal? (complex 1/0 (real-part (log 0))) (log 0)) #f)
  (test (morally-equal? (complex 1/0 (real-part (log 0))) (complex 1/0 1)) #f)
  (test (morally-equal? (complex 1/0 (real-part (log 0))) (complex 1 1/0)) #f)
  (test (morally-equal? (complex 1/0 (real-part (log 0))) (complex 1/0 1/0)) #f)
  (test (morally-equal? (complex 1/0 (real-part (log 0))) (complex (real-part (log 0)) 1/0)) #f)
  (test (morally-equal? (complex 1/0 (real-part (log 0))) (complex 1/0 (real-part (log 0)))) #t)
  (test (morally-equal? (complex 1/0 (real-part (log 0))) (complex (real-part (log 0)) (real-part (log 0)))) #f)
  (test (morally-equal? (complex 1/0 (real-part (log 0))) (complex (real-part (log 0)) 1)) #f)
  (test (morally-equal? (complex 1/0 (real-part (log 0))) (complex 1 (real-part (log 0)))) #f)
  (test (morally-equal? (complex (real-part (log 0)) (real-part (log 0))) (+ (complex (real-part (log 0)) (real-part (log 0))) 5e-16)) #t)
  (test (morally-equal? (complex (real-part (log 0)) (real-part (log 0))) (- (complex (real-part (log 0)) (real-part (log 0))) 1/1428571428571429)) #t)
  (test (morally-equal? (complex (real-part (log 0)) (real-part (log 0))) (+ (complex (real-part (log 0)) (real-part (log 0))) 0+5e-16i)) #t)
  (test (morally-equal? (complex (real-part (log 0)) (real-part (log 0))) (+ (complex (real-part (log 0)) (real-part (log 0))) 0-1/1428571428571429i)) #t)
  (test (morally-equal? (complex (real-part (log 0)) (real-part (log 0))) 0) #f)
  (test (morally-equal? (complex (real-part (log 0)) (real-part (log 0))) 1/0) #f)
  (test (morally-equal? (complex (real-part (log 0)) (real-part (log 0))) (real-part (log 0))) #f)
  (test (morally-equal? (complex (real-part (log 0)) (real-part (log 0))) (- (real-part (log 0)))) #f)
  (test (morally-equal? (complex (real-part (log 0)) (real-part (log 0))) (- 0/0)) #f)
  (test (morally-equal? (complex (real-part (log 0)) (real-part (log 0))) (log 0)) #f)
  (test (morally-equal? (complex (real-part (log 0)) (real-part (log 0))) (complex 1/0 1)) #f)
  (test (morally-equal? (complex (real-part (log 0)) (real-part (log 0))) (complex 1 1/0)) #f)
  (test (morally-equal? (complex (real-part (log 0)) (real-part (log 0))) (complex 1/0 1/0)) #f)
  (test (morally-equal? (complex (real-part (log 0)) (real-part (log 0))) (complex (real-part (log 0)) 1/0)) #f)
  (test (morally-equal? (complex (real-part (log 0)) (real-part (log 0))) (complex 1/0 (real-part (log 0)))) #f)
  (test (morally-equal? (complex (real-part (log 0)) (real-part (log 0))) (complex (real-part (log 0)) (real-part (log 0)))) #t)
  (test (morally-equal? (complex (real-part (log 0)) (real-part (log 0))) (complex (real-part (log 0)) 1)) #f)
  (test (morally-equal? (complex (real-part (log 0)) (real-part (log 0))) (complex 1 (real-part (log 0)))) #f)
  (test (morally-equal? (complex (real-part (log 0)) 1) (+ (complex (real-part (log 0)) 1) 5e-16)) #t)
  (test (morally-equal? (complex (real-part (log 0)) 1) (- (complex (real-part (log 0)) 1) 1/1428571428571429)) #t)
  (test (morally-equal? (complex (real-part (log 0)) 1) (+ (complex (real-part (log 0)) 1) 0+5e-16i)) #t)
  (test (morally-equal? (complex (real-part (log 0)) 1) (+ (complex (real-part (log 0)) 1) 0-1/1428571428571429i)) #t)
  (test (morally-equal? (complex (real-part (log 0)) 1) 0) #f)
  (test (morally-equal? (complex (real-part (log 0)) 1) 1) #f)
  (test (morally-equal? (complex (real-part (log 0)) 1) 0+1e-300i) #f)
  (test (morally-equal? (complex (real-part (log 0)) 1) 1/0) #f)
  (test (morally-equal? (complex (real-part (log 0)) 1) (real-part (log 0))) #f)
  (test (morally-equal? (complex (real-part (log 0)) 1) (- (real-part (log 0)))) #f)
  (test (morally-equal? (complex (real-part (log 0)) 1) (- 0/0)) #f)
  (test (morally-equal? (complex (real-part (log 0)) 1) (log 0)) #f)
  (test (morally-equal? (complex (real-part (log 0)) 1) (complex 1/0 1)) #f)
  (test (morally-equal? (complex (real-part (log 0)) 1) (complex 1 1/0)) #f)
  (test (morally-equal? (complex (real-part (log 0)) 1) (complex 1/0 1/0)) #f)
  (test (morally-equal? (complex (real-part (log 0)) 1) (complex (real-part (log 0)) 1/0)) #f)
  (test (morally-equal? (complex (real-part (log 0)) 1) (complex 1/0 (real-part (log 0)))) #f)
  (test (morally-equal? (complex (real-part (log 0)) 1) (complex (real-part (log 0)) (real-part (log 0)))) #f)
  (test (morally-equal? (complex (real-part (log 0)) 1) (complex (real-part (log 0)) 1)) #t)
  (test (morally-equal? (complex (real-part (log 0)) 1) (complex 1 (real-part (log 0)))) #f)
  (test (morally-equal? (complex 1 (real-part (log 0))) (+ (complex 1 (real-part (log 0))) 5e-16)) #t)
  (test (morally-equal? (complex 1 (real-part (log 0))) (- (complex 1 (real-part (log 0))) 1/1428571428571429)) #t)
  (test (morally-equal? (complex 1 (real-part (log 0))) (+ (complex 1 (real-part (log 0))) 0+5e-16i)) #t)
  (test (morally-equal? (complex 1 (real-part (log 0))) (+ (complex 1 (real-part (log 0))) 0-1/1428571428571429i)) #t)
  (test (morally-equal? (complex 1 (real-part (log 0))) (real-part (log 0))) #f)
  (test (morally-equal? (complex 1 (real-part (log 0))) (- (real-part (log 0)))) #f)
  (test (morally-equal? (complex 1 (real-part (log 0))) (- 0/0)) #f)
  (test (morally-equal? (complex 1 (real-part (log 0))) (log 0)) #f)
  (test (morally-equal? (complex 1 (real-part (log 0))) (complex 1/0 1)) #f)
  (test (morally-equal? (complex 1 (real-part (log 0))) (complex 1 1/0)) #f)
  (test (morally-equal? (complex 1 (real-part (log 0))) (complex 1/0 1/0)) #f)
  (test (morally-equal? (complex 1 (real-part (log 0))) (complex (real-part (log 0)) 1/0)) #f)
  (test (morally-equal? (complex 1 (real-part (log 0))) (complex 1/0 (real-part (log 0)))) #f)
  (test (morally-equal? (complex 1 (real-part (log 0))) (complex (real-part (log 0)) (real-part (log 0)))) #f)
  (test (morally-equal? (complex 1 (real-part (log 0))) (complex (real-part (log 0)) 1)) #f)
  (test (morally-equal? (complex 1 (real-part (log 0))) (complex 1 (real-part (log 0)))) #t)) ; end with-bignums


;;; ----------------
;;; try a bunch of combinations

(define-expansion (format-with-line port str . args)
  `(format ,port ,str ,(port-line-number) ,@args))

(let ((lst1 ())
      (lst2 ()))
  (if (not (eq? lst1 lst2)) (format-with-line #t ";~A: nils are not eq?~%"))
  (if (not (eqv? lst1 lst2)) (format-with-line #t ";~A: nils are not eqv?~%"))
  (if (not (equal? lst1 lst2)) (format-with-line #t ";~A: nils are not equal?~%"))

  (let ((v1 (make-vector 100 #f))
	(v2 (make-vector 100 #f)))
    (if (not (equal? v1 v2)) (format-with-line #t ";~A: base vectors are not equal?~%"))

    (let ((h1 (make-hash-table))
	  (h2 (make-hash-table)))
      (if (not (equal? h1 h2)) (format-with-line #t ";~A: base hash-tables are not equal?~%"))

      (let ((e1 (sublet (curlet)))
	    (e2 (sublet (curlet))))
	(if (not (equal? e1 e2)) (format-with-line #t ";~A: base environments are not equal?~%"))

	(let ((ctr 0))
	  (for-each
	   (lambda (arg1 arg2)
	     ;; make sure the args are eq? to themselves
	     ;; if equal? and equal to copy place in lst1, place copy in lst2, check that they are still equal
	     ;;     similarly for vector, hash-table, envs
	   (let ((a1 arg1)
		 (a2 arg2))
	     (if (not (eq? a1 arg1)) 
		 (format-with-line #t ";~A: ~A is not eq? to itself? ~A~%" arg1 a1))
	     (if (and (eq? a1 a2) (not (eqv? a1 a2)))
		 (format-with-line #t ";~A: ~A is eq? but not eqv? ~A~%" a1 a2))

	     (if (equal? a1 a2)
		 (begin
		   (if (and (eq? a1 a2) (not (eqv? a1 a2))) 
		       (format-with-line #t ";~A: ~A is eq? and equal? but not eqv?? ~A~%" a1 a2))
		   (if (not (morally-equal? a1 a2))
		       (format-with-line #t ";~A: ~A is equal? but not morally-equal? ~A~%" a1 a2))
		   (set! lst1 (cons a1 lst1))
		   (set! lst2 (cons a2 lst2))
		   (set! (v1 ctr) a1)
		   (set! (v2 ctr) a2)
		   (let* ((sym1 (symbol "symbol-" (number->string ctr)))
			  (sym2 (copy sym1)))
		     (set! (h1 sym1) a1)
		     (set! (h2 sym2) a2)
		     (varlet e1 (cons sym1 a1))
		     (varlet e2 (cons sym2 a2))

		     (if (not (equal? lst1 lst2))
			 (begin
			   (format-with-line #t ";~A: add ~A to lists, now not equal?~%" a1)
			   (set! lst1 (cdr lst1))
			   (set! lst2 (cdr lst2))))
		     (if (not (equal? v1 v2))
			 (begin
			   (format-with-line #t ";~A: add ~A to vectors, now not equal?~%" a1)
			   (set! (v1 ctr) #f)
			   (set! (v2 ctr) #f)))
		     (if (not (equal? h1 h2))
			 (begin
			   (format-with-line #t ";~A: add ~A to hash-tables, now not equal?~%" a1)
			   (set! (h1 sym1) #f)
			   (set! (h2 sym2) #f)))
		     (if (not (equal? e1 e2))
			 (begin
			   (format-with-line #t ";~A: add ~A to environments, now not equal?~% ~A~% ~A~%" a1 e1 e2)
			   (eval `(set! ,sym1 #f) e1)
			   (eval `(set! ,sym2 #f) e2)))
		     ))
		 (begin
		   (if (eq? a1 arg1) (format-with-line #t ";~A: ~A is eq? but not equal? ~A~%" a1 a2))
		   (if (eqv? a1 arg1) (format-with-line #t ";~A: ~A is eqv? but not equal? ~A~%" a1 a2))
		   (format-with-line #t ";~A: ~A is not equal to ~A~%" a1 a2)))

	     (set! ctr (+ ctr 1))))

	 (list "hi" ""
	       (integer->char 65) #\space #\newline #\null
	       1 3/4 
	       ;; 1.0 1+i pi (real-part (log 0)) 1e18
	       most-negative-fixnum most-positive-fixnum 
	       'a-symbol 
	       (make-vector 3 #f) #() #2d((1 2) (3 4))
	       abs quasiquote macroexpand (log 0) 
	       (hash-table '(a . 1) '(b . 2)) (hash-table)
	       (sublet (curlet) '(a . 1)) (rootlet)
	       #f #t :hi 
	       #<eof> #<undefined> #<unspecified>
	       (cons 1 2) () '(1) (list (cons 1 2)) '(1 2 . 3) 
	       (let ((lst (cons 1 2))) (set-cdr! lst lst) lst)
	       )
	 (list (string #\h #\i) (string)
	       #\A #\space #\newline (integer->char 0)
	       (- 2 1) (/ 3 4) 
	       ;; 1.0 1+i pi (real-part (log 0)) 1e18
	       -9223372036854775808 9223372036854775807 
	       (string->symbol "a-symbol")
	       (vector #f #f #f) (vector)  #2d((1 2) (3 4))
	       abs quasiquote macroexpand (log 0) 
	       (let ((h (make-hash-table 31))) (set! (h 'a) 1) (set! (h 'b) 2) h) (make-hash-table 123)
	       (sublet (curlet) '(a . 1)) (rootlet)
	       #f #t :hi 
	       #<eof> #<undefined> (if #f #f)
	       '(1 . 2) (list) (list 1) (list (cons 1 2)) '(1 2 . 3) 
	       (let ((lst (cons 1 2))) (set-cdr! lst lst) lst)
	       ))
	  
	  (set! (v1 ctr) lst1)
	  (set! (v2 ctr) lst2)
	  (set! ctr (+ ctr 1))
	  (if (not (equal? v1 v2))
	      (format-with-line #t ";~A: add lists to vectors, now vectors not equal?~%")
	      (begin
		(set! lst1 (cons v1 lst1))
		(set! lst2 (cons v2 lst2)) 
		(if (not (equal? lst1 lst2))
		    (begin
		      (format-with-line #t ";~A: add vectors to lists, now lists not equal?~%")
		      (set! (h1 'lst1) lst1)
		      (set! (h2 'lst2) lst2)
		      (if (not (equal? h1 h2))
			  (format-with-line #t ";~A: add lists to hash-tables, not hash-tables not equal?~%")
			  (begin
			    (set! (v1 ctr) v1)
			    (set! (v2 ctr) v2)
			    (set! ctr (+ ctr 1))
			    (if (not (equal? v1 v2))
				(format-with-line #t ";~A: add vectors to themselves, now vectors not equal?~%"))
			    (if (not (equal? lst1 lst2))
				(format-with-line #t ";~A: add vectors to themselves, now lists not equal?~%"))
			    (set! (h1 'h1) h1)
			    (set! (h2 'h2) h2)
			    (if (not (equal? h1 h2))
				(format-with-line #t ";~A: add hash-tables to themselves, not hash-tables not equal?~%"))
			    )))))))))))

(define old-readers *#readers*)
(set! *#readers* (cons (cons #\u (lambda (str) (string->number (substring str 1)))) ()))
(test (eval (with-input-from-string "(+ 10 #u12)" read)) 22)
(test (eval (with-input-from-string "(+ 10 #u87)" read)) 97)

(set! *#readers* 
  (list (cons #\[
	      (lambda (str)
		(let ((h (make-hash-table)))
		  (do ((c (read) (read)))
		      ((eq? c ']#) h)
		    (set! (h (car c)) (cdr c))))))))

(eval-string "(let ((table #[(a . 1) (b . #[(c . 3)]#)]#))
  (test (hash-table? table) #t)
  (test (table 'a) 1)
  (test (hash-table? (table 'b)) #t)
  (test ((table 'b) 'c) 3))")

(set! *#readers* old-readers)

(when with-block
  (let ((b (make-block 4))) 
    (test (morally-equal? b b) #t)
    (let ((b1 (make-block 4)))
      (test (morally-equal? b b1) #t)
      (set! (b 1) 1.0)
      (test (morally-equal? b b1) #f))))
(test (let ((p (c-pointer 0))) (morally-equal? p (copy p))) #t)


;;; --------------------------------------------------------------------------------
;;; type-of

(test (type-of) 'error)
(test (type-of 1 2) 'error)
(test (type-of #f) 'boolean?)
(test (type-of ()) 'null?)
(test (type-of (list 1)) 'pair?)
(test (type-of 1) 'integer?)
(test (type-of 1/2) 'rational?)
(test (type-of 1.0) 'float?)
(test (type-of 1+i) 'complex?)
(test (type-of #<unspecified>) 'unspecified?)
(test (type-of #<undefined>) 'undefined?)
(test (type-of _undef_) 'undefined?)
(test (type-of #<eof>) 'eof-object?)
(test (type-of (hash-table)) 'hash-table?)
(test (type-of #(1)) 'vector?)
(test (type-of #r(1.0)) 'float-vector?)
(test (type-of #i(1)) 'int-vector?)
(test (type-of "") 'string?)
(test (type-of #\a) 'char?)
(test (type-of 'a) 'symbol?)
(test (type-of :a) 'symbol?)
(test (type-of (inlet 'a 1)) 'let?)
(test (type-of *stderr*) 'output-port?)
(test (type-of *stdin*) 'input-port?)
(test (type-of abs) 'procedure?)
(test (type-of +) 'procedure?)
(test (type-of (c-pointer 0)) 'c-pointer?)
(test (type-of (random-state 123)) 'random-state?)
(test (type-of lambda) 'syntax?)
(test (type-of (byte-vector 1 2)) 'string?) ;; someday...

(let ()
  (define (remove obj seq) ; remove-all?
    (case (type-of seq)
      
      ((pair?)
       (if (proper-list? seq)
	   (let loop ((lst seq) (res ()))
	     (if (null? lst)
		 (reverse! res)
		 (loop (cdr lst)
		       (if (equal? obj (car lst))
			   res
			   (cons (car lst) res)))))
	   seq))
      
      ((string? vector? float-vector? int-vector?)
       (let ((len (length seq)))
	 (if (zero? len)
	     seq
	     (do ((v (copy seq))
		  (j -1)
		  (i 0 (+ i 1)))
		 ((= i len)
		  (if (string? seq)
		      (copy v ((if (byte-vector? seq) make-byte-vector make-string) (+ j 1)))
		      (make-shared-vector v (+ j 1))))
	       (if (not (equal? obj (seq i)))
		   (set! (v (set! j (+ j 1))) (seq i)))))))
      
      ((hash-table?)
       (let ((ht (copy seq)))
	 (hash-table-set! ht obj #f)
	 ht))
      
      ((let?)
       (let ((lt (copy seq)))
	 (if (and (openlet? lt)
		  (let-ref lt 'remove))
	     ((let-ref lt 'remove) obj lt)
	     (cutlet lt obj))
	 lt))
      
      (else seq)))
  
  (test (remove #\a "abcdabcd") "bcdbcd")
  (test (remove 1 (vector 0 1 2 1 1)) #(0 2))
  (test (remove 1 (vector 1)) #())
  (test (remove 1 (byte-vector 0 1 2 1 1)) #u8(0 2))
  (test (remove 1 (int-vector 1 2 1 3 4 1 5)) #i(2 3 4 5))
  (test (remove 1.0 (float-vector 1.0 3.0 1.0)) #r(3.0))
  (test (remove 1 '(1 2 3 4 1)) '(2 3 4))
  (test (remove 'a (hash-table* 'a 1 'b 2)) (hash-table '(b . 2)))
  (test (remove 'a (inlet 'a 1 'b 2)) (inlet 'b 2))
  (let ((lt1 (remove 'a (openlet (inlet 'a 1 'b 2
					'remove (lambda (obj lt)
						  (set! (lt 'b) 3)
						  (cutlet lt obj)))))))
    (test (lt1 'b) 3))
  (test (remove 1 (vector)) #())
  
  (define (hi)
    (let ((v (byte-vector 1 2 3))
	  (sv (make-vector 3)))
      (do ((i 0 (+ i 1)))
	  ((= i 3) sv)
	(set! (sv i) (v i)))))
  (test (hi) #(1 2 3))
  
  (define (hi)
    (let ((v (byte-vector 1 2 3))
	  (sv (make-byte-vector 3)))
      (do ((i 0 (+ i 1)))
	  ((= i 3) sv)
	(set! (sv i) (v i)))))
  (test (hi) #u8(1 2 3)))
  


;;; --------------------------------------------------------------------------------
;;; boolean?

(test (boolean? #f) #t)
(test (boolean? #t) #t)
(test (boolean? 0) #f)
(test (boolean? 1) #f)
(test (boolean? "") #f)
(test (boolean? #\0) #f)
(test (boolean? ()) #f)
(test (boolean? #()) #f)
(test (boolean? 't) #f)
(test (boolean? (list)) #f)
(test ( boolean? #t) #t)
(test (boolean? boolean?) #f)
(test (boolean? or) #f)
(test (   ; a comment 
       boolean?  ;;; and another
       #t
       )
      #t)

(for-each
 (lambda (arg)
   (if (boolean? arg)
       (format #t ";(boolean? ~A) -> #t?~%" arg)))
 (list "hi" '(1 2) (integer->char 65) 1 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #\f (lambda (a) (+ a 1)) :hi (if #f #f) #<eof> #<undefined>))

(test (recompose 12 boolean? #f) #t)

(test (boolean?) 'error)
(test (boolean? #f #t) 'error)
(test (boolean #f) 'error)
(test (boolean? (lambda (x) #f)) #f)
(test (boolean? and) #f)
(test (boolean? if) #f)
(test (boolean? (values)) #f)
;(test (boolean? else) #f) ; this could also be an error -> unbound variable, like (symbol? else)




;;; --------------------------------------------------------------------------------
;;; not

(test (not #f) #t)
(test (not #t) #f)
(test (not (not #t)) #t)
(test (not 0) #f)
(test (not 1) #f)
(test (not ()) #f)
(test (not 't) #f)
(test (not (list)) #f)
(test (not (list 3)) #f)
(test (not 'nil) #f)
(test (not not) #f)
(test (not "") #f)
(test (not lambda) #f)
(test (not quote) #f)

(for-each
 (lambda (arg)
   (if (not arg)
       (format #t ";(not ~A) -> #t?~%" arg)))
 (list "hi" (integer->char 65) 1 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #\f (lambda (a) (+ a 1)) :hi #<eof> #<undefined> (if #f #f)))

(test (recompose 12 not #f) #f)

(test (not) 'error)
(test (not #f #t) 'error)
(test (not and) #f)
(test (not case) #f)

(let () ; check some optimizer branches
  (define (f1 sym) (not (symbol? sym))) (test (f1 'hi) #f) (test (f1 "hi") #t)  
  (define (f2 sym) (not (integer? sym))) (test (f2 2) #f) (test (f2 'hi) #t)
  (define (f3 sym) (not (char? sym))) (test (f3 2) #t) (test (f3 #\a) #f)
  (define (f4 sym) (not (list? sym))) (test (f4 2) #t) (test (f4 '(1 2 3)) #f)
  (define (f5 sym) (not (boolean? sym))) (test (f5 2) #t) (test (f5 #f) #f)
  (define (f6 sym) (not (eof-object? sym))) (test (f6 2) #t) (test (f6 #<eof>) #f)
  (define (f7 sym) (not (pair? (car sym)))) (test (f7 '(hi)) #t) (test (f7 '((1))) #f)
  (define (f8 sym) (not (eq? sym 'q))) (test (f8 'a) #t) (test (f8 'q) #f)
  (define (f9 sym) (pair? (cadr sym))) (test (f9 '(1 2 3)) #f) (test (f9 '(1 (2 3) 4)) #t)
  (define (f10 lst val) (eq? (car lst) val)) (test (f10 '(#f) #f) #t) (test (f10 '(a) 32) #f)
  (define (f11 lst) (eq? (caar lst) 'q)) (test (f11 '((a))) #f) (test (f11 '((q))) #t)
  (define (f12 lst) (= (length lst) 2)) (test (f12 '(1 2)) #t) (test (f12 '(1 2 3)) #f)
  (define (f13 lst) (< (length lst) 2)) (test (f13 '(1 2)) #f) (test (f13 '(1)) #t)
  (define (f14 lst) (negative? (length lst))) (test (f14 '(1 2)) #f) (test (f14 '(1 . 3)) #t)
  (define (f15 lst) (memq (car lst) '(a b c))) (test (f15 '(a)) '(a b c)) (test (f15 '(d)) #f)
  (define (f16 a b) (if a (begin (+ b a) (format #f "~A" a) (+ a a)))) (test (f16 1 2) 2)
  (define (f17 a) (aritable? a 1)) (test (f17 abs) #t)
  (define (f22) (begin (display ":") (display (object->string 2)) (display ":"))) (test (with-output-to-string (lambda () (f22))) ":2:")
  (define (f23 a b) (list a b))
  (define (f24 x y) (f23 (car x) (car y)))
  (define (f25 x y) (f23 (cdr x) (cdr y)))
  (test (f24 '(1 2) '(3 4)) '(1 3)) (test (f25 '(1 2) '(3 4)) '((2) (4)))
  (define (f24a s1 s2 s3) (+ (* s1 s2) (* (- 1.0 s1) s3))) (test (f24a 2.0 3.0 4.0) 2.0)
  (let () (define (a b) (define c 1) (+ b c)) (define (tst) (a 2)) (tst) (test (tst) 3))
  (define (f25) 
    (let ((x 0.0) (y 1.0)) 
      (call-with-exit 
       (lambda (return) 
	 (do ((i y (+ i 1))) ((= i 6)) 
	   (do ((i i (+ i 1))) ((>= i 7)) 
	     (set! x (+ x i)) 
	     (if (> x 123.0) (return x)))))) 
      x))
  (test (f25) 85.0)
  )
(let ()
  (test (let () (define (ho a) (+ a 2)) (define (hi) (+ (ho 1) (ho 2))) (hi)) 7)
  (test (let () (define (ho a) (+ a 2)) (define (hi) (+ (ho 1) (values 3 4))) (hi)) 10)
  (test (let () (define (ho a) (+ a 2)) (define (hi) (+ (values 3 4) (ho 1))) (hi)) 10)
  (test (let () (define (hi) (+ (values 1 2) (values 3 4))) (hi)) 10)
  (test (let () (define (ho a) (values a 1)) (define (hi) (- (ho 2))) (hi)) 1)
  (test (let () (define (ho1) (s7-version)) (define (ho2) (ho1)) (string? (ho2))) #t)
  (test (let () (define (hi) (vector 0)) (define (ho) (hi)) (ho)) #(0)))
(let ()
  (define (make-it . names) (apply vector names))
  (define (hi) (make-it pi pi pi pi))
  (test (hi) (vector pi pi pi pi)))
(test (let () (define (hi a b c d) (+ a (* (- b c) d))) (define (ho) (hi 1 2 3 4)) (ho)) -3)
(test (let () (define (hi a b c d) (+ a (* d (- b c)))) (define (ho) (hi 1 2 3 4)) (ho)) -3)
(test (let () (define (hi) (let ((x (values 1 2))) (if x (list x)))) (define (ho) (hi)) (catch #t (lambda () (ho)) (lambda args #f)) (ho)) 'error)
(test (let () (define (hi a b) (- (+ a (abs b)))) (define (ho) (hi 1 -2)) (ho)) -3)

(let () (define (e1) (((lambda () list)) 'a 'b 'c)) (define (e2) (e1)) (e2) (test (e2) '(a b c)))
(let () (define (c1 s i) (case (string-ref s i) ((#\a) 1) (else 2))) (define (c3 s i) (c1 s i)) (c3 "hiho" 1) (test (c3 "hiho" 1) 2))
(let () (define (c1 s i) (case (string-ref s i) ((#\a) 1) ((#\i) 2))) (define (c3 s i) (c1 s i)) (c3 "hiho" 1) (test (c3 "hiho" 1) 2))
(let () (define (c1 s i) (case (string-ref s i) ((#\a #\h) 1) ((#\i #\o) 2))) (define (c3 s i) (c1 s i)) (c3 "hiho" 1) (test (c3 "hiho" 1) 2))
(let () (define (c1 s i) (case (string-ref s i) ((#\a #\h) 1) (else 2))) (define (c3 s i) (c1 s i)) (c3 "hiho" 1) (test (c3 "hiho" 1) 2))
(let () (define (d1) (do ((lst () (cons i lst)) (i 0 (+ i 1))) ((> i 6) (reverse lst)))) (define (d2) (d1)) (d2) (test (d2) '(0 1 2 3 4 5 6)))
(let () (define (d3) ((define (hi a) (+ a 1)) 2)) (define (d4) (d3)) (d4) (test (d4) 3))
(let () (define (fif) (if (< 2 3) (quote . -1))) (catch #t fif (lambda args 'error)) (test (catch #t fif (lambda args 'error)) 'error))
;(let () (define (fcond) (cond ((< 2 3) ((lambda (x) x 1 . 5) 2)))) (catch #t fcond (lambda args 'error)) (test (fcond) 'error))
;(let () (define (fcond1) (cond ((< 2 3) ((lambda* (x) x . 5) 2)))) (catch #t fcond1 (lambda args 'error)) (test (fcond1) 'error))
; those aren't what they appear to be: the catch does the stray dot check/error, then a call simply does what it can
(let () (define (incsaa k i) (let ((sum 1)) (set! sum (+ sum (expt k i) (expt (- k) i))) sum)) (define (f1) (incsaa 3 2)) (test (f1) 19))
(let () (define (unks v1 i) (let ((x 0)) (set! x (v1 i)) x)) (define (f1) (unks (vector 1 2 3) 2)) (test (f1) 3))


;;; --------------------------------------------------------------------------------
;;; symbol?

(test (symbol? 't) #t)
(test (symbol? "t") #f)
(test (symbol? '(t)) #f)
(test (symbol? #t) #f)
(test (symbol? 4) #f)
(test (symbol? 'foo) #t)
(test (symbol? (car '(a b))) #t)
(test (symbol? 'nil) #t)
(test (symbol? ()) #f)
(test (symbol? #()) #f)
(test (symbol? #f) #f)
(test (symbol? 'car) #t)
(test (symbol? car) #f)
(test (symbol? '#f) #f)
(test (symbol? #()) #f)
(test (symbol? :hi) #t)
(test (symbol? hi:) #t)
(test (symbol? :hi:) #t)
(test (symbol? ::) #t)
(test (symbol? ':) #t)
(test (symbol? '|) #t)
(test (symbol? '|') #t)
(test (symbol? '@) #t)
;(test (symbol? '#:) #t) ; confusable given guile-style keywords
(test (symbol? #b1) #f)
(test (symbol? 'sym0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789) #t) ;M Gran
(test (symbol? (vector-ref #(1 a 34) 1)) #t)
(test (if (symbol? '1+) (symbol? '0e) #t) #t)
(test (symbol? 'begin) #t)
(test (symbol? 'if) #t)
(test (symbol? (keyword->symbol :if)) #t)
(test (symbol? (string->symbol "if")) #t)
(test (symbol? if) #f)
(test (symbol? quote) #f)
(test (symbol? '(AB\c () xyz)) #f)

(for-each
 (lambda (arg)
   (if (symbol? arg)
       (format #t ";(symbol? ~A) -> #t?~%" arg)))
 (list "hi" (integer->char 65) 1 (list 1 2) '#t '3 (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #\f (lambda (a) (+ a 1)) #<eof> #<undefined>))

(test (symbol?) 'error)
(test (symbol? 'hi 'ho) 'error)
(test (symbol? 'hi 3) 'error)
(test (symbol? 3 3) 'error)
(test (symbol? 3 'hi) 'error)
(test (symbol 'hi) 'error) ; symbol takes a string

;;; "Returns #t if obj is a symbol, otherwise returns #f" (r5|6rs.html)
(test (symbol? begin) #f) ; this is an error in Guile, it was #t in s7
(test (symbol? expt) #f)
(test (symbol? if) #f)
(test (symbol? and) #f)
(test (symbol? lambda) #f)
(test (symbol? 'let) #t)
(test (symbol? call/cc) #f)
(test (symbol? '1.2.3) #t)
(test (symbol? '1.2) #f)
(test (symbol? ''1.2) #f)
(test (symbol? '"hi") #f)

(test (let ((sym000000000000000000000 3))
	(let ((sym000000000000000000001 4))
	  (+ sym000000000000000000000 sym000000000000000000001)))
      7)
(test (let ((11-1 10)
	    (2012-4-19 21)
	    (1+the-road 18)
	    (-1+2 1)
	    (1e. 2)
	    (0+i' 3)
	    (0.. 4))
	(+ 11-1 2012-4-19 1+the-road -1+2 1e. 0+i' 0..))
      59)

(test (let ((name "hiho"))
	(string-set! name 2 #\null)
	(symbol? (string->symbol name)))
      #t)


;;; syntax?
(test (syntax? 'lambda) #f)
(test (syntax? lambda) #t)
(test (syntax? if) #t)
(test (syntax? macroexpand) #t)
(test (syntax? 1) #f)
(for-each
 (lambda (arg)
   (if (syntax? arg)
       (format #t ";(syntax? ~A) -> #t?~%" arg)))
 (list "hi" (integer->char 65) (list 1 2) '#t '3 (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #\f (lambda (a) (+ a 1)) #<eof> #<undefined>))
(test (syntax?) 'error)
(test (syntax? 'hi 'ho) 'error)
(test (syntax? 'hi 3) 'error)
(test (syntax? 3 3) 'error)
(test (syntax? 3 'hi) 'error)
(test (syntax? 'else) #f)
(test (syntax? '=>) #f)
(test (syntax? else) #f)
(let ()
  (define (syntactic x)
    (if x (case x ((1) 1) (else 2))))
  (syntactic 1)
  (let ((source (procedure-source syntactic)))
    (test (syntax? (car source)) #f))) ; 'lambda from (lambda (x) (if x (case x ((1) 1) (else 2))))


;;; --------------------------------------------------------------------------------
;;; procedure?

(test (procedure? car) #t)
(test (procedure? procedure?) #t)
(test (procedure? 'car) #f)
(test (procedure? (lambda (x) x)) #t)
(test (procedure? '(lambda (x) x)) #f)
(test (call/cc procedure?) #t) 
(test (let ((a (lambda (x) x)))	(procedure? a)) #t)
(test (letrec ((a (lambda () (procedure? a)))) (a)) #t)
(test (let ((a 1)) (let ((a (lambda () (procedure? a)))) (a))) #f)
(test (let () (define (hi) 1) (procedure? hi)) #t)
(test (let () (define-macro (hi a) `(+ ,a 1)) (procedure? hi)) #f)
(test (procedure? begin) #f)
(test (procedure? lambda) #f)
(test (procedure? (lambda* ((a 1)) a)) #t)
(test (procedure? and) #f)
(test (procedure? 'let) #f)
(test (procedure? (dilambda (lambda () 1) (lambda (x) x))) #t)
(if with-bignums (test (procedure? (bignum "1e100")) #f))
(test (procedure? quasiquote) #f)
(let () (define-macro (hi a) `(+ ,a 1)) (test (procedure? hi) #f))
(test (procedure? (random-state 1234)) #f)
(test (procedure? pi) #f)
(test (procedure? cond) #f)
(test (procedure? do) #f)
(test (procedure? set!) #f)

(for-each
 (lambda (arg)
   (if (procedure? arg)
       (format #t ";(procedure? ~A) -> #t?~%" arg)))
 (list "hi" _ht_ _undef_ _null_ :hi (integer->char 65) 1 (list 1 2) '#t '3 (make-vector 3) 3.14 3/4 1.0+1.0i #\f #() (if #f #f)))

(test (procedure?) 'error)
(test (procedure? abs car) 'error)
(test (procedure abs) 'error)

;; these are questionable -- an applicable object is a procedure
(test (procedure? "hi") #f)
(test (procedure? '(1 2)) #f)
(test (procedure? #(1 2)) #f)





;;; --------------------------------------------------------------------------------
;;; CHARACTERS
;;; --------------------------------------------------------------------------------

(test (eqv? '#\  #\space) #t)
(test (eqv? #\newline '#\newline) #t)

;;; --------------------------------------------------------------------------------
;;; char?

(test (char? #\a) #t)
(test (char? #\() #t)
(test (char? #\space) #t)
(test (char? '#\newline) #t)
(test (char? #\1) #t)
(test (char? #\$) #t)
(test (char? #\.) #t)
(test (char? #\\) #t)
(test (char? #\)) #t)
(test (char? #\%) #t)
(test (char? '#\space) #t)
(test (char? '#\ ) #t)
(test (char? '#\newline) #t)
(test (char? '#\a) #t)
(test (char? '#\8) #t)
(test (char? #\-) #t)
(test (char? #\n) #t)
(test (char? #\() #t)
(test (char? #\#) #t)
(test (char? #\x) #t)
(test (char? #\o) #t)
(test (char? #\b) #t)
(test (char? #b101) #f)
(test (char? #o73) #f)
(test (char? #x73) #f)
(test (char? 'a) #f)
(test (char? 97) #f)
(test (char? "a") #f)
(test (char? (string-ref "hi" 0)) #t)
(test (char? (string-ref (make-string 1) 0)) #t)
(test (char? #\") #t)
(test (char? #\') #t)
(test (char? #\`) #t)
(test (char? #\@) #t)
(test (char? #<eof>) #f)
(test (char? '1e311) #f)

(for-each
 (lambda (arg)
   (if (char? arg)
       (format #t ";(char? ~A) -> #t?~%" arg)))
 (list "hi" () (list 1) '(1 . 2) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #f #t (if #f #f) :hi (lambda (a) (+ a 1))))

(test (char? begin) #f)

(do ((i 0 (+ i 1)))
    ((= i 256))
  (if (not (char? (integer->char i)))
      (format #t ";(char? (integer->char ~A)) -> #f?~%" i)))

(test (char?) 'error)
(test (char? #\a #\b) 'error)
(test (char #\a) 'error)

(test (char? #\x65) #t)
(test (char? #\x000000000065) #t)
(test (char? #\x0) #t)
(test (char=? #\x000 #\null) #t)
(test (char=? #\x08 #\x8) #t)
(test (char=? #\x0e #\xe) #t) ; Guile thinks both of these names are bogus
(test (char=? #\x00e #\xe) #t)
(test (char=? #\x0000e #\xe) #t)
(test (char=? #\x00000000e #\xe) #t) ; hmmm -- surely this is a bug
(test (char? #\xff) #t)
;; any larger number is a reader error

(test (eval-string "(char? #\xbdca2cbec)") #f)
(test (eval-string "(char? #\\xbdca2cbec)") #f)
(test (eval-string "(char? #\\100)") #f)
(test (eval-string "(char? #\\x-65)") #f)
(test (eval-string "(char? #\\x6.5)") #f)
(test (eval-string "(char? #\\x6/5)") #f)
(test (eval-string "(char? #\\x6/3)") #f)
(test (eval-string "(char? #\\x6+i)") #f)
(test (eval-string "(char? #\\x6asd)") #f)
(test (eval-string "(char? #\\x6#)") #f)
(test (eval-string "(char? #\\x#b0)") #f)
(test (eval-string "(char? #\\x#b0") 'error) ; missing )
(test (eval-string "(char? #\\x-0)") #f)
(test (eval-string "(char? #\\x1.4)") #f)
(test (eval-string "(char? #\\x#b0)") #f)
(test (eval-string "(char? #\\x-0)") #f)
(test (eval-string "(char? #\\x1.4)") #f)

(test (char=? #\x6a #\j) #t)

(test (char? #\return) #t)
(test (char? #\null) #t)
(test (char? #\nul) #t)
(test (char? #\linefeed) #t)
(test (char? #\tab) #t)
(test (char? #\space) #t)
(test (char=? #\null #\nul) #t)
(test (char=? #\newline #\linefeed) #t)
(test (char=? #\return #\xd) #t)
(test (char=? #\nul #\x0) #t)
;(test (char? #\ÿ) #t) ; this seems to involve unwanted translations in emacs?
(test (eval-string (string-append "(char? " (format #f "#\\~C" (integer->char 255)) ")")) #t)
(test (eval-string (string-append "(char? " (format #f "#\\~C" (integer->char 127)) ")")) #t)
(test (apply char? (list (integer->char 255))) #t)

(test (char? #\escape) #t)
(test (char? #\alarm) #t)
(test (char? #\backspace) #t)
(test (char? #\delete) #t)
(test (char=? #\delete #\backspace) #f)

(num-test (let ((str (make-string 258 #\space)))
	    (do ((i 1 (+ i 1)))
		((= i 256))
	      (string-set! str i (integer->char i)))
	    (string-set! str 257 (integer->char 0))
	    (string-length str))
	  258)


(let ((a-to-z (list #\a #\b #\c #\d #\e #\f #\g #\h #\i #\j #\k #\l #\m #\n #\o #\p #\q #\r #\s #\t #\u #\v #\x #\y #\z))
      (cap-a-to-z (list #\A #\B #\C #\D #\E #\F #\G #\H #\I #\J #\K #\L #\M #\N #\O #\P #\Q #\R #\S #\T #\U #\V #\X #\Y #\Z))
      (mixed-a-to-z (list #\a #\B #\c #\D #\e #\F #\g #\H #\I #\j #\K #\L #\m #\n #\O #\p #\Q #\R #\s #\t #\U #\v #\X #\y #\Z))
      (digits (list #\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9)))
  
;;; --------------------------------------------------------------------------------
;;; char-upper-case?

  (test (char-upper-case? #\a) #f)
  (test (char-upper-case? #\A) #t)
  
  (for-each
   (lambda (arg)
     (if (not (char-upper-case? arg))
	 (format #t ";(char-upper-case? ~A) -> #f?~%" arg)))
   cap-a-to-z)
  
  (for-each
   (lambda (arg)
     (if (char-upper-case? arg)
	 (format #t ";(char-upper-case? ~A) -> #t?~%" arg)))
   a-to-z)
  
  (test (char-upper-case? (integer->char 192)) #t) ; 192..208 for unicode
  ;; non-alpha chars are "unspecified" here
  
  (test (char-upper-case? 1) 'error)
  (test (char-upper-case?) 'error)
  (test (char-upper-case? 1) 'error)
  (test (char-upper-case?) 'error)
  (test (char-upper-case? #\a #\b) 'error)
  (test (char-upper-case #\a) 'error)


  
;;; --------------------------------------------------------------------------------
;;; char-lower-case?

  (test (char-lower-case? #\A) #f)
  (test (char-lower-case? #\a) #t)
  
  (for-each
   (lambda (arg)
     (if (not (char-lower-case? arg))
	 (format #t ";(char-lower-case? ~A) -> #f?~%" arg)))
   a-to-z)
  
  (for-each
   (lambda (arg)
     (if (char-lower-case? arg)
	 (format #t ";(char-lower-case? ~A) -> #t?~%" arg)))
   cap-a-to-z)
  
  (test (char-lower-case? 1) 'error)
  (test (char-lower-case?) 'error)
  (test (char-lower-case? 1) 'error)
  (test (char-lower-case?) 'error)
  (test (char-lower-case? #\a #\b) 'error)
  (test (char-lower-case #\a) 'error)

;;  (test (char-lower-case? #\xb5) #t)  ; what is this?  in Snd it's #t, in ex1 it's #f -- is this a locale choice?
  (test (char-lower-case? #\xb6) #f)

  (for-each
   (lambda (c)
     (test (and (not (char-upper-case? c)) 
		(not (char-lower-case? c))) #t))
   (map integer->char (list 0 1 2 3 32 33 34 170 182 247)))


  
;;; --------------------------------------------------------------------------------
;;; char-upcase

  (test (char-upcase #\A) #\A)
  (test (char-upcase #\a) #\A)
  (test (char-upcase #\?) #\?)
  (test (char-upcase #\$) #\$)
  (test (char-upcase #\.) #\.)
  (test (char-upcase #\\) #\\)
  (test (char-upcase #\5) #\5)
  (test (char-upcase #\)) #\))
  (test (char-upcase #\%) #\%)
  (test (char-upcase #\0) #\0)
  (test (char-upcase #\_) #\_)
  (test (char-upcase #\?) #\?)
  (test (char-upcase #\space) #\space)
  (test (char-upcase #\newline) #\newline)
  (test (char-upcase #\null) #\null)
  (test (char-upper-case? (char-upcase #\?)) #f) ; !
  (test (char-lower-case? (char-downcase #\?)) #f)
  (test (char-upper-case? (char-upcase #\_)) #f)
  (test (or (char-upper-case? #\?) (char-lower-case? #\?)) #f)
  
  (for-each
   (lambda (arg1 arg2)
     (if (not (char=? (char-upcase arg1) arg2))
	 (format #t ";(char-upcase ~A) != ~A?~%" arg1 arg2)))
   a-to-z
   cap-a-to-z)
  
  (do ((i 1 (+ i 1)))
      ((= i 256))
    (if (and (not (char=? (integer->char i) (char-upcase (integer->char i))))
	     (not (char-alphabetic? (integer->char i))))
	(format #t ";(char-upcase ~A) -> ~A but not alphabetic?~%" (integer->char i) (char-upcase (integer->char i)))))

  (test (recompose 12 char-upcase #\a) #\A)
  (test (reinvert 12 char-upcase char-downcase #\a) #\a)

  (test (char-upcase) 'error)
  (test (char-upcase #\a #\b) 'error)
  (test (char-upcase #<eof>) 'error)
  (test (char-upcase #f) 'error)
  (test (char-upcase (list)) 'error)


  
;;; --------------------------------------------------------------------------------
;;; char-downcase

  (test (char-downcase #\A) #\a)
  (test (char-downcase #\a) #\a)
  (test (char-downcase #\?) #\?)
  (test (char-downcase #\$) #\$)
  (test (char-downcase #\.) #\.)
  (test (char-downcase #\_) #\_)
  (test (char-downcase #\\) #\\)
  (test (char-downcase #\5) #\5)
  (test (char-downcase #\)) #\))
  (test (char-downcase #\%) #\%)
  (test (char-downcase #\0) #\0)
  (test (char-downcase #\space) #\space)
  
  (for-each
   (lambda (arg1 arg2)
     (if (not (char=? (char-downcase arg1) arg2))
	 (format #t ";(char-downcase ~A) != ~A?~%" arg1 arg2)))
   cap-a-to-z
   a-to-z)

  (test (recompose 12 char-downcase #\A) #\a)

  (test (char-downcase) 'error)
  (test (char-downcase #\a #\b) 'error)  


;;; --------------------------------------------------------------------------------
;;; char-numeric?  

  (test (char-numeric? #\a) #f)
  (test (char-numeric? #\5) #t)
  (test (char-numeric? #\A) #f)
  (test (char-numeric? #\z) #f)
  (test (char-numeric? #\Z) #f)
  (test (char-numeric? #\0) #t)
  (test (char-numeric? #\9) #t)
  (test (char-numeric? #\space) #f)
  (test (char-numeric? #\;) #f)
  (test (char-numeric? #\.) #f)
  (test (char-numeric? #\-) #f)
  (test (char-numeric? (integer->char 200)) #f)
  (test (char-numeric? (integer->char 128)) #f)
  (test (char-numeric? (integer->char 216)) #f) ; 0 slash
  (test (char-numeric? (integer->char 189)) #f) ; 1/2
  
  (for-each
   (lambda (arg)
     (if (char-numeric? arg)
	 (format #t ";(char-numeric? ~A) -> #t?~%" arg)))
   cap-a-to-z)
  
  (for-each
   (lambda (arg)
     (if (char-numeric? arg)
	 (format #t ";(char-numeric? ~A) -> #t?~%" arg)))
   a-to-z)

  (test (char-numeric?) 'error)
  (test (char-numeric? #\a #\b) 'error)  

  
;;; --------------------------------------------------------------------------------
;;; char-whitespace?

  (test (char-whitespace? #\a) #f)
  (test (char-whitespace? #\A) #f)
  (test (char-whitespace? #\z) #f)
  (test (char-whitespace? #\Z) #f)
  (test (char-whitespace? #\0) #f)
  (test (char-whitespace? #\9) #f)
  (test (char-whitespace? #\space) #t)
  (test (char-whitespace? #\tab) #t)
  (test (char-whitespace? #\newline) #t)
  (test (char-whitespace? #\return) #t)
  (test (char-whitespace? #\linefeed) #t)
  (test (char-whitespace? #\null) #f)
  (test (char-whitespace? #\;) #f)
  (test (char-whitespace? #\xb) #t)
  (test (char-whitespace? #\x0b) #t)
  (test (char-whitespace? #\xc) #t)
  (test (char-whitespace? #\xd) #t) ; #\return
  (test (char-whitespace? #\xe) #f) 

  ;; unicode whitespace apparently:
  (test (char-whitespace? (integer->char 9)) #t)
  (test (char-whitespace? (integer->char 10)) #t)
  (test (char-whitespace? (integer->char 11)) #t)
  (test (char-whitespace? (integer->char 12)) #t)
  (test (char-whitespace? (integer->char 13)) #t)
  (test (char-whitespace? (integer->char 32)) #t)
  (test (char-whitespace? (integer->char 133)) #t)
  (test (char-whitespace? (integer->char 160)) #t)

  (for-each
   (lambda (arg)
     (if (char-whitespace? arg)
	 (format #t ";(char-whitespace? ~A) -> #t?~%" arg)))
   mixed-a-to-z)
  
  (for-each
   (lambda (arg)
     (if (char-whitespace? arg)
	 (format #t ";(char-whitespace? ~A) -> #t?~%" arg)))
   digits)

  (test (char-whitespace?) 'error)
  (test (char-whitespace? #\a #\b) 'error)   
 
  
;;; --------------------------------------------------------------------------------
;;; char-alphabetic?

  (test (char-alphabetic? #\a) #t)
  (test (char-alphabetic? #\$) #f)
  (test (char-alphabetic? #\A) #t)
  (test (char-alphabetic? #\z) #t)
  (test (char-alphabetic? #\Z) #t)
  (test (char-alphabetic? #\0) #f)
  (test (char-alphabetic? #\9) #f)
  (test (char-alphabetic? #\space) #f)
  (test (char-alphabetic? #\;) #f)
  (test (char-alphabetic? #\.) #f)
  (test (char-alphabetic? #\-) #f)
  (test (char-alphabetic? #\_) #f)
  (test (char-alphabetic? #\^) #f)
  (test (char-alphabetic? #\[) #f)

  ;(test (char-alphabetic? (integer->char 200)) #t) ; ??
  (test (char-alphabetic? (integer->char 127)) #f)  ; backspace
  
  (for-each
   (lambda (arg)
     (if (char-alphabetic? arg)
	 (format #t ";(char-alphabetic? ~A) -> #t?~%" arg)))
   digits)
  
  (for-each
   (lambda (arg)
     (if (not (char-alphabetic? arg))
	 (format #t ";(char-alphabetic? ~A) -> #f?~%" arg)))
   mixed-a-to-z)

  (test (char-alphabetic?) 'error)
  (test (char-alphabetic? #\a #\b) 'error)  

  (for-each
   (lambda (op)
     (for-each
      (lambda (arg)
	(test (op arg) 'error))
      (list "hi" () (list 1) '(1 . 2) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
	    3.14 3/4 1.0+1.0i #f #t :hi (if #f #f) (lambda (a) (+ a 1)))))
   (list char-upper-case? char-lower-case? char-upcase char-downcase char-numeric? char-whitespace? char-alphabetic?))


  
  (test 
   (let ((unhappy ()))
     (do ((i 0 (+ i 1))) 
	 ((= i 256)) 
       (let* ((ch (integer->char i))
	      (chu (char-upcase ch))
	      (chd (char-downcase ch)))

	 (if (and (not (char=? ch chu))
		  (not (char-upper-case? chu)))
	     (format #t ";(char-upper-case? (char-upcase ~C)) is #f~%" ch))

	 (if (and (not (char=? ch chd))
		  (not (char-lower-case? chd)))
	     (format #t ";(char-lower-case? (char-downcase ~C)) is #f~%" ch))

	 (if (or (and (not (char=? ch chu))
		      (not (char=? ch (char-downcase chu))))
		 (and (not (char=? ch chd))
		      (not (char=? ch (char-upcase chd))))
		 (and (not (char=? ch chd))
		      (not (char=? ch chu)))
		 (not (char-ci=? chu chd))
		 (not (char-ci=? ch chu))
		 (and (char-alphabetic? ch)
		      (or (not (char-alphabetic? chd))
			  (not (char-alphabetic? chu))))
		 (and (char-numeric? ch)
		      (or (not (char-numeric? chd))
			  (not (char-numeric? chu))))
		 (and (char-whitespace? ch)
		      (or (not (char-whitespace? chd))
			  (not (char-whitespace? chu))))
		 (and (char-alphabetic? ch)
		      (char-whitespace? ch))
		 (and (char-numeric? ch)
		      (char-whitespace? ch))
		 (and (char-alphabetic? ch)
		      (char-numeric? ch)))
	     ;; there are characters that are alphabetic but the result of char-upcase is not an upper-case character
	     ;; 223 for example, or 186 for lower case
	     (set! unhappy (cons (format #f "~C: ~C ~C (~D)~%" ch chu chd i) unhappy)))))
     unhappy)
   ())
  
  (for-each
   (lambda (op)
     (for-each
      (lambda (arg)
	(test (op #\a arg) 'error))
      (list "hi" () (list 1) '(1 . 2) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
	    3.14 3/4 1.0+1.0i #f #t :hi (if #f #f) (lambda (a) (+ a 1)))))
   (list char=? char<? char<=? char>? char>=? char-ci=? char-ci<? char-ci<=? char-ci>? char-ci>=?))

  (for-each
   (lambda (op)
     (for-each
      (lambda (arg)
	(test (op arg #\a) 'error))
      (list "hi" () (list 1) '(1 . 2) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
	    3.14 3/4 1.0+1.0i #f #t :hi (if #f #f) (lambda (a) (+ a 1)))))
   (list char=? char<? char<=? char>? char>=? char-ci=? char-ci<? char-ci<=? char-ci>? char-ci>=?))

  (let () ; check direct opts 
    (define (fc str)
      (let ((len (length str))
	    (count 0))
	(do ((i 0 (+ i 1)))
	    ((= i len) count)
	  (if (char-whitespace? (string-ref str i))
	      (set! count (+ count 1)))
	  (if (char-alphabetic? (string-ref str i))
	      (set! count (+ count 1)))
	  (if (char-numeric? (string-ref str i))
	      (set! count (+ count 1)))
	  (if (char-lower-case? (string-ref str i))
	      (set! count (+ count 1)))
	  (if (char-upper-case? (string-ref str i))
	      (set! count (+ count 1))))))
    (test (fc "123 4Ab.2") 10))


;;; --------------------------------------------------------------------------------
;;; char=?

  (test (char=? #\d #\d) #t)
  (test (char=? #\A #\a) #f)
  (test (char=? #\d #\x) #f)
  (test (char=? #\d #\D) #f)
  (test (char=? #\a #\a) #t)
  (test (char=? #\A #\B) #f)
  (test (char=? #\a #\b) #f)
  (test (char=? #\9 #\0) #f)
  (test (char=? #\A #\A) #t)
  (test (char=? #\  #\space) #t)
  (let ((i (char->integer #\space)))
    (test (char=? (integer->char i) #\space) #t))
  (test (char=? (integer->char (char->integer #\")) #\") #t)
  (test (char=? #\x65 #\e) #t)
  
  (test (char=? #\d #\d #\d #\d) #t)
  (test (char=? #\d #\d #\x #\d) #f)
  (test (char=? #\d #\y #\x #\c) #f)
  (test (apply char=? cap-a-to-z) #f)
  (test (apply char=? mixed-a-to-z) #f)
  (test (apply char=? digits) #f)
  (test (char=? #\d #\c #\d) #f)

  (test (char=? #\a) 'error)
  (test (char=?) 'error)
  (test (char=? #\a 0) 'error)
  (test (char=? #\a #\b 0) 'error)
  

;;; --------------------------------------------------------------------------------
;;; char<?  

  (test (char<? #\z #\0) #f)
  (test (char<? #\d #\x) #t)
  (test (char<? #\d #\d) #f)
  (test (char<? #\d #\x) #t)
  (test (char<? #\A #\B) #t)
  (test (char<? #\a #\b) #t)
  (test (char<? #\9 #\0) #f)
  (test (char<? #\A #\A) #f)
  (test (char<? #\space #\space) #f)
  
  (test (char<? #\a #\e #\y #\z) #t)
  (test (char<? #\a #\e #\e #\y) #f)
  (test (apply char<? a-to-z) #t)
  (test (apply char<? cap-a-to-z) #t)
  (test (apply char<? mixed-a-to-z) #f)
  (test (apply char<? digits) #t)
  (test (apply char<? (reverse a-to-z)) #f)
  (test (apply char<? (reverse cap-a-to-z)) #f)
  (test (apply char<? (reverse mixed-a-to-z)) #f)
  (test (apply char<? (reverse digits)) #f)
  (test (char<? #\b #\c #\a) #f)
  (test (char<? #\B #\B #\A) #f)
  (test (char<? #\b #\c #\e) #t)
  (test (char<? (integer->char #xf0) (integer->char #x70)) #f)

  (test (char<?) 'error)
  (test (char<? #\b #\a "hi") 'error)
  (test (char<? #\b #\a 0) 'error)
  (test (char<? (integer->char 0) (integer->char 255)) #t)
  
  

;;; --------------------------------------------------------------------------------
;;; char<=?

  (test (char<=? #\d #\x) #t)
  (test (char<=? #\d #\d) #t)
  
  (test (char<=? #\a #\e #\y #\z) #t)
  (test (char<=? #\a #\e #\e #\y) #t)
  (test (char<=? #\A #\B) #t)
  (test (char<=? #\a #\b) #t)
  (test (char<=? #\9 #\0) #f)
  (test (char<=? #\A #\A) #t)
  (test (char<=? #\space #\space) #t)
  
  (test (char<=? #\a #\e #\y #\z) #t)
  (test (char<=? #\a #\e #\e #\y) #t)
  (test (char<=? #\e #\e #\d #\y) #f)
  (test (apply char<=? a-to-z) #t)
  (test (apply char<=? cap-a-to-z) #t)
  (test (apply char<=? mixed-a-to-z) #f)
  (test (apply char<=? digits) #t)
  (test (apply char<=? (reverse a-to-z)) #f)
  (test (apply char<=? (reverse cap-a-to-z)) #f)
  (test (apply char<=? (reverse mixed-a-to-z)) #f)
  (test (apply char<=? (reverse digits)) #f)
  (test (char<=? #\b #\c #\a) #f)
  (test (char<=? #\B #\B #\A) #f)
  (test (char<=? #\b #\c #\e) #t)
  
  (test (char<=? #\b #\a "hi") 'error)
  (test (char<=? #\b #\a 0) 'error)
  (test (char<=?) 'error)


  
;;; --------------------------------------------------------------------------------
;;; char>?

  (test (char>? #\e #\d) #t)
  (test (char>? #\z #\a) #t)
  (test (char>? #\A #\B) #f)
  (test (char>? #\a #\b) #f)
  (test (char>? #\9 #\0) #t)
  (test (char>? #\A #\A) #f)
  (test (char>? #\space #\space) #f)
  
  (test (char>? #\d #\c #\b #\a) #t)
  (test (char>? #\d #\d #\c #\a) #f)
  (test (char>? #\e #\d #\b #\c #\a) #f)
  (test (apply char>? a-to-z) #f)
  (test (apply char>? cap-a-to-z) #f)
  (test (apply char>? mixed-a-to-z) #f)
  (test (apply char>? digits) #f)
  (test (apply char>? (reverse a-to-z)) #t)
  (test (apply char>? (reverse cap-a-to-z)) #t)
  (test (apply char>? (reverse mixed-a-to-z)) #f)
  (test (apply char>? (reverse digits)) #t)
  (test (char>? #\d #\c #\a) #t)
  (test (char>? #\d #\c #\c) #f)
  (test (char>? #\B #\B #\C) #f)
  (test (char>? #\b #\c #\e) #f)
  (test (char>? (integer->char #xf0) (integer->char #x70)) #t)

  (test (char>? #\a #\b "hi") 'error)
  (test (char>? #\a #\b 0) 'error)
  (test (char>?) 'error)

  
  
;;; --------------------------------------------------------------------------------
;;; char>=?

  (test (char>=? #\e #\d) #t)
  (test (char>=? #\A #\B) #f)
  (test (char>=? #\a #\b) #f)
  (test (char>=? #\9 #\0) #t)
  (test (char>=? #\A #\A) #t)
  (test (char>=? #\space #\space) #t)
  
  (test (char>=? #\d #\c #\b #\a) #t)
  (test (char>=? #\d #\d #\c #\a) #t)
  (test (char>=? #\e #\d #\b #\c #\a) #f)
  (test (apply char>=? a-to-z) #f)
  (test (apply char>=? cap-a-to-z) #f)
  (test (apply char>=? mixed-a-to-z) #f)
  (test (apply char>=? digits) #f)
  (test (apply char>=? (reverse a-to-z)) #t)
  (test (apply char>=? (reverse cap-a-to-z)) #t)
  (test (apply char>=? (reverse mixed-a-to-z)) #f)
  (test (apply char>=? (reverse digits)) #t)
  (test (char>=? #\d #\c #\a) #t)
  (test (char>=? #\d #\c #\c) #t)
  (test (char>=? #\B #\B #\C) #f)
  (test (char>=? #\b #\c #\e) #f)

  (test (char>=? #\a #\b "hi") 'error)
  (test (char>=? #\a #\b 0) 'error)
  (test (char>=?) 'error)

  
  
;;; --------------------------------------------------------------------------------
;;; char-ci=?

  (test (char-ci=? #\A #\B) #f)
  (test (char-ci=? #\a #\B) #f)
  (test (char-ci=? #\A #\b) #f)
  (test (char-ci=? #\a #\b) #f)
  (test (char-ci=? #\9 #\0) #f)
  (test (char-ci=? #\A #\A) #t)
  (test (char-ci=? #\A #\a) #t)
  (test (char-ci=? #\a #\A) #t)
  (test (char-ci=? #\space #\space) #t)
  
  (test (char-ci=? #\d #\D #\d #\d) #t)
  (test (char-ci=? #\d #\d #\X #\d) #f)
  (test (char-ci=? #\d #\Y #\x #\c) #f)
  (test (apply char-ci=? cap-a-to-z) #f)
  (test (apply char-ci=? mixed-a-to-z) #f)
  (test (apply char-ci=? digits) #f)
  (test (char-ci=? #\d #\c #\d) #f)

  (test (char-ci=?) 'error)
  (test (char-ci=? #\a #\b 0) 'error)
  

  
;;; --------------------------------------------------------------------------------
;;; char-ci<?

  (test (char-ci<? #\A #\B) #t)
  (test (char-ci<? #\a #\B) #t)
  (test (char-ci<? #\A #\b) #t)
  (test (char-ci<? #\a #\b) #t)
  (test (char-ci<? #\9 #\0) #f)
  (test (char-ci<? #\0 #\9) #t)
  (test (char-ci<? #\A #\A) #f)
  (test (char-ci<? #\A #\a) #f)
  (test (char-ci<? #\Y #\_) #t)
  (test (char-ci<? #\\ #\J) #f)
  (test (char-ci<? #\_ #\e) #f)
  (test (char-ci<? #\t #\_) #t)
  (test (char-ci<? #\a #\]) #t)
  (test (char-ci<? #\z #\^) #t)
  
  (test (char-ci<? #\b #\a "hi") 'error)
  (test (char-ci<? #\b #\a 0) 'error)
  (test (char-ci>? (integer->char #xf0) (integer->char #x70)) #t)

#|
    ;; this tries them all:
    (do ((i 0 (+ i 1)))
	((= i 256))
      (do ((k 0 (+ k 1)))
	  ((= k 256))
	(let ((c1 (integer->char i))
	      (c2 (integer->char k)))
	  (for-each
	   (lambda (op1 op2)
	     (if (not (eq? (op1 c1 c2) (op2 (string c1) (string c2))))
		 (format #t ";(~A|~A ~A ~A) -> ~A|~A~%" op1 op2 c1 c2 (op1 c1 c2) (op2 (string c1) (string c2)))))
	   (list char=? char<? char<=? char>? char>=? char-ci=? char-ci<? char-ci<=? char-ci>? char-ci>=?)
	   (list string=? string<? string<=? string>? string>=? string-ci=? string-ci<? string-ci<=? string-ci>? string-ci>=?)))))
|#
  
  (test (char-ci<? #\d #\D #\d #\d) #f)
  (test (char-ci<? #\d #\d #\X #\d) #f)
  (test (char-ci<? #\d #\Y #\x #\c) #f)
  (test (apply char-ci<? cap-a-to-z) #t)
  (test (apply char-ci<? mixed-a-to-z) #t)
  (test (apply char-ci<? digits) #t)
  (test (char-ci<? #\d #\c #\d) #f)
  (test (char-ci<? #\b #\c #\a) #f)
  (test (char-ci<? #\b #\C #\e) #t)
  (test (char-ci<? #\3 #\? #\Z #\[) #t)
  
  (test (char-ci>? #\a #\b "hi") 'error)
  (test (char-ci>? #\a #\b 0) 'error)


  
;;; --------------------------------------------------------------------------------
;;; char-ci>?

  (test (char-ci>? #\A #\B) #f)
  (test (char-ci>? #\a #\B) #f)
  (test (char-ci>? #\A #\b) #f)
  (test (char-ci>? #\a #\b) #f)
  (test (char-ci>? #\9 #\0) #t)
  (test (char-ci>? #\A #\A) #f)
  (test (char-ci>? #\A #\a) #f)
  (test (char-ci>? #\^ #\a) #t)
  (test (char-ci>? #\_ #\e) #t)
  (test (char-ci>? #\[ #\S) #t)
  (test (char-ci>? #\\ #\l) #t)
  (test (char-ci>? #\t #\_) #f)
  (test (char-ci>? #\a #\]) #f)
  (test (char-ci>? #\z #\^) #f)
  (test (char-ci>? #\] #\X) #t)
  
  (test (char-ci>? #\d #\D #\d #\d) #f)
  (test (char-ci>? #\d #\d #\X #\d) #f)
  (test (char-ci>? #\d #\Y #\x #\c) #f)
  (test (apply char-ci>? cap-a-to-z) #f)
  (test (apply char-ci>? mixed-a-to-z) #f)
  (test (apply char-ci>? (reverse mixed-a-to-z)) #t)
  (test (apply char-ci>? digits) #f)
  (test (char-ci>? #\d #\c #\d) #f)
  (test (char-ci>? #\b #\c #\a) #f)
  (test (char-ci>? #\d #\C #\a) #t)
  
  
;;; --------------------------------------------------------------------------------
;;; char-ci<=?

  (test (char-ci<=? #\A #\B) #t)
  (test (char-ci<=? #\a #\B) #t)
  (test (char-ci<=? #\A #\b) #t)
  (test (char-ci<=? #\a #\b) #t)
  (test (char-ci<=? #\9 #\0) #f)
  (test (char-ci<=? #\A #\A) #t)
  (test (char-ci<=? #\A #\a) #t)
  (test (char-ci<=? #\` #\H) #f)
  (test (char-ci<=? #\[ #\m) #f)
  (test (char-ci<=? #\j #\`) #t)
  (test (char-ci<=? #\\ #\E) #f)
  (test (char-ci<=? #\t #\_) #t)
  (test (char-ci<=? #\a #\]) #t)
  (test (char-ci<=? #\z #\^) #t)
  
  (test (char-ci<=? #\d #\D #\d #\d) #t)
  (test (char-ci<=? #\d #\d #\X #\d) #f)
  (test (char-ci<=? #\d #\Y #\x #\c) #f)
  (test (apply char-ci<=? cap-a-to-z) #t)
  (test (apply char-ci<=? mixed-a-to-z) #t)
  (test (apply char-ci<=? digits) #t)
  (test (char-ci<=? #\d #\c #\d) #f)
  (test (char-ci<=? #\b #\c #\a) #f)
  (test (char-ci<=? #\b #\c #\C) #t)
  (test (char-ci<=? #\b #\C #\e) #t)
  
  (test (char-ci<=? #\b #\a "hi") 'error)
  (test (char-ci<=? #\b #\a 0) 'error)


  
;;; --------------------------------------------------------------------------------
;;; char-ci>=?

  (test (char-ci>=? #\A #\B) #f)
  (test (char-ci>=? #\a #\B) #f)
  (test (char-ci>=? #\A #\b) #f)
  (test (char-ci>=? #\a #\b) #f)
  (test (char-ci>=? #\9 #\0) #t)
  (test (char-ci>=? #\A #\A) #t)
  (test (char-ci>=? #\A #\a) #t)
  (test (char-ci>=? #\Y #\_) #f)
  (test (char-ci>=? #\` #\S) #t)
  (test (char-ci>=? #\[ #\Y) #t)
  (test (char-ci>=? #\t #\_) #f)
  (test (char-ci>=? #\a #\]) #f)
  (test (char-ci>=? #\z #\^) #f)
  
  (test (char-ci>=? #\d #\D #\d #\d) #t)
  (test (char-ci>=? #\d #\d #\X #\d) #f)
  (test (char-ci>=? #\d #\Y #\x #\c) #f)
  (test (apply char-ci>=? cap-a-to-z) #f)
  (test (apply char-ci>=? mixed-a-to-z) #f)
  (test (apply char-ci>=? (reverse mixed-a-to-z)) #t)
  (test (apply char-ci>=? (reverse mixed-a-to-z)) #t)
  (test (apply char-ci>=? digits) #f)
  (test (char-ci>=? #\d #\c #\d) #f)
  (test (char-ci>=? #\b #\c #\a) #f)
  (test (char-ci>=? #\d #\D #\a) #t)
  (test (char-ci>=? #\\ #\J #\+) #t)

  (test (char-ci>=? #\a #\b "hi") 'error)
  (test (char-ci>=? #\a #\b 0) 'error)

  ) ; end let with a-to-z



;;; --------------------------------------------------------------------------------
;;; integer->char
;;; char->integer

(test (integer->char (char->integer #\.)) #\.)
(test (integer->char (char->integer #\A)) #\A)
(test (integer->char (char->integer #\a)) #\a)
(test (integer->char (char->integer #\space)) #\space)
(test (char->integer (integer->char #xf0)) #xf0)

(do ((i 0 (+ i 1)))
    ((= i 256)) 
  (if (not (= (char->integer (integer->char i)) i)) 
      (format #t ";char->integer ~D ~A != ~A~%" i (integer->char i) (char->integer (integer->char i)))))

(test (reinvert 12 integer->char char->integer 60) 60)

(test (char->integer 33) 'error)
(test (char->integer) 'error)
(test (integer->char) 'error)
(test (integer->char (expt 2 31)) 'error)
(test (integer->char (expt 2 32)) 'error)
(test (integer->char 12 14) 'error)
(test (char->integer #\a #\b) 'error)
;(test (char->integer #\ÿ) 255) ; emacs confusion?
(test (eval-string (string-append "(char->integer " (format #f "#\\~C" (integer->char 255)) ")")) 255)

(for-each
 (lambda (arg)
   (test (char->integer arg) 'error))
 (list -1 1 0 123456789 "hi" () (list 1) '(1 . 2) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))

(for-each
 (lambda (arg)
   (test (integer->char arg) 'error))
 (list -1 257 123456789 -123456789 #\a "hi" () (list 1) '(1 . 2) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi most-positive-fixnum 1/0 (if #f #f) (lambda (a) (+ a 1))))

(test (#\a) 'error)
(test (#\newline 1) 'error)



;;; --------------------------------------------------------------------------------
;;; STRINGS
;;; --------------------------------------------------------------------------------

;;; --------------------------------------------------------------------------------
;;; string?

(test (string? "abc") #t)
(test (string? ':+*/-) #f)
(test (string? "das ist einer der teststrings") #t)
(test (string? '(das ist natuerlich falsch)) #f)
(test (string? "aaaaaa") #t)
(test (string? #\a) #f)
(test (string? "\"\\\"") #t)
(test (string? lambda) #f)
(test (string? format) #f)

(for-each
 (lambda (arg)
   (test (string? arg) #f))
 (list #\a () (list 1) '(1 . 2) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))

(test (string?) 'error)
(test (string? "hi" "ho") 'error)
(test (string? #\null) #f)



;;; --------------------------------------------------------------------------------
;;; string=?

(test (string=? "foo" "foo") #t)
(test (string=? "foo" "FOO") #f)
(test (string=? "foo" "bar") #f)
(test (string=? "FOO" "FOO") #t)
(test (string=? "A" "B") #f)
(test (string=? "a" "b") #f)
(test (string=? "9" "0") #f)
(test (string=? "A" "A") #t)
(test (string=? "" "") #t)
(test (string=? (string #\newline) (string #\newline)) #t)

(test (string=? "A" "B" "a") #f)
(test (string=? "A" "A" "a") #f)
(test (string=? "A" "A" "A") #t)
(test (string=? "foo" "foo" "foo") #t)
(test (string=? "foo" "foo" "") #f)
(test (string=? "foo" "foo" "fOo") #f)

(test (string=? "foo" "FOO" 1.0) 'error)

(test (let ((str (string #\" #\1 #\\ #\2 #\")))	(string=? str "\"1\\2\"")) #t)
(test (let ((str (string #\\ #\\ #\\)))	(string=? str "\\\\\\")) #t)
(test (let ((str (string #\")))	(string=? str "\"")) #t)
(test (let ((str (string #\\ #\"))) (string=? str "\\\"")) #t)
(test (let ((str (string #\space #\? #\)))) (string=? str " ?)")) #t)
(test (let ((str (string #\# #\\ #\t))) (string=? str "#\\t")) #t)
(test (string=? (string #\x (integer->char #xf0) #\x) (string #\x (integer->char #x70) #\x)) #f)
(test (string=? (string #\x (integer->char #xf0) #\x) (string #\x (integer->char #xf0) #\x)) #t)
(test (string=? "\x65;\x65;" "ee") #t)
(test (string=? "\"\\\n\t\r\/\b\f\x65;\"" "\x22;\x5c;\xa;\x09;\xd;\x2f;\x8;\xc;e\x22;") #t)

(test (string=? (string) "") #t)
(test (string=? (string) (make-string 0)) #t)
(test (string=? (string-copy (string)) (make-string 0)) #t)
(test (string=? "" (make-string 0)) #t)
(test (string=? "" (string-append)) #t)
(test (string=? (string #\space #\newline) " \n") #t)

(test (string=? "......" "...\
...") #t)
(test (string=? "\n" (string #\newline)) #t)
(test (string=? "\
\
\
\
" "") #t)
(test (string=? "" (string #\null)) #f)
(test (string=? (string #\null #\null) (string #\null)) #f)
(test (string=? "" "asd") #f)
(test (string=? "asd" "") #f)
(test (string=? "xx" (make-string 2 #\x) (string #\x #\x) (list->string (list #\x #\x)) (substring "axxb" 1 3) (string-append "x" "x")) #t)
(test (let ((s1 "1234") (s2 "1245")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string=? s1 s2)) #f)
(test (let ((s1 "1234") (s2 "1234")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string=? s1 s2)) #t)
(test (let ((s1 "1234") (s2 "124")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string=? s1 s2)) #f)
(test (string=? (make-string 3 #\space) (let ((s (make-string 4 #\space))) (set! (s 3) #\null) s)) #f)
(test "\x3012;" "0\x12;") ; \x30 = 48 = #\0

(for-each
 (lambda (arg)
   (test (string=? "hi" arg) 'error)
   (test (string=? arg "hi") 'error))
 (list #\a () (list 1) '(1 . 2) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))


;; this strikes me as highly dubious
(test (call-with-input-string "1\n2" (lambda (p) (read p))) 1)
(test (call-with-input-string "1\\ \n2" (lambda (p) (read p))) (symbol "1\\"))

(test (call-with-input-string "1\
2" (lambda (p) (read p))) 12)

;; do we guarantee that read takes place in the current environment? no...
(test (call-with-input-string "fl\
oor" read) 'floor)

(test (call-with-input-string "p\
i" (lambda (p) (eval (read p)))) pi)

(test (call-with-input-string "(+ 1;\
 this is presumably a comment
 1)" (lambda (p) (eval (read p)))) 2)

(test (call-with-input-string "(+ 1;\
 this is presumably a comment;\
 and more commentary
 1)" (lambda (p) (eval (read p)))) 2)

(test (string=? (string #\1) (byte-vector 2)) #f) ; ?? -- should this be an error?



;;; --------------------------------------------------------------------------------
;;; string<?

(test (string<? "aaaa" "aaab") #t)
(test (string<? "aaaa" "aaaaa") #t)
(test (string<? "" "abcdefgh") #t)
(test (string<? "a" "abcdefgh") #t)
(test (string<? "abc" "abcdefgh") #t)
(test (string<? "cabc" "abcdefgh") #f)
(test (string<? "abcdefgh" "abcdefgh") #f)
(test (string<? "xyzabc" "abcdefgh") #f)
(test (string<? "abc" "xyzabcdefgh") #t)
(test (string<? "abcdefgh" "") #f)
(test (string<? "abcdefgh" "a") #f)
(test (string<? "abcdefgh" "abc") #f)
(test (string<? "abcdefgh" "cabc") #t)
(test (string<? "abcdefgh" "xyzabc") #t)
(test (string<? "xyzabcdefgh" "abc") #f)
(test (string<? "abcdef" "bcdefgh") #t)
(test (string<? "" "abcdefgh") #t)
(test (string<? "" "") #f)
(test (string<? "A" "B") #t)
(test (string<? "a" "b") #t)
(test (string<? "9" "0") #f)
(test (string<? "A" "A") #f)

(test (string<? "A" "B" "A") #f)
(test (string<? "A" "A" "B") #f)
(test (string<? "A" "A" "A") #f)
(test (string<? "B" "B" "C") #f)
(test (string<? "foo" "foo" "foo") #f)
(test (string<? "foo" "foo" "") #f)
(test (string<? "foo" "foo" "fOo") #f)

(test (string<? "foo" "fo" 1.0) 'error)
(test (let ((s1 "1234") (s2 "1245")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string<? s1 s2)) #t)
(test (let ((s1 "1234") (s2 "123")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string<? s1 s2)) #f)
(test (let ((s1 "123") (s2 "1234")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string<? s1 s2)) #t)
(test (not (string<? "foo\x0a;" "foo\x0a;")) #t)
(test (string<? "foo\x0a;" "foo\x0b;") #t)

(test (string<? (string (integer->char #xf0)) (string (integer->char #x70))) #f) 

(for-each
 (lambda (arg)
   (test (string<? "hi" arg) 'error)
   (test (string<? arg "hi") 'error))
 (list #\a () (list 1) '(1 . 2) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))



;;; --------------------------------------------------------------------------------
;;; string>?

(test (string>? "aaab" "aaaa") #t)
(test (string>? "aaaaa" "aaaa") #t)
(test (string>? "" "abcdefgh") #f)
(test (string>? "a" "abcdefgh") #f)
(test (string>? "abc" "abcdefgh") #f)
(test (string>? "cabc" "abcdefgh") #t)
(test (string>? "abcdefgh" "abcdefgh") #f)
(test (string>? "xyzabc" "abcdefgh") #t)
(test (string>? "abc" "xyzabcdefgh") #f)
(test (string>? "abcdefgh" "") #t)
(test (string>? "abcdefgh" "a") #t)
(test (string>? "abcdefgh" "abc") #t)
(test (string>? "abcdefgh" "cabc") #f)
(test (string>? "abcdefgh" "xyzabc") #f)
(test (string>? "xyzabcdefgh" "abc") #t)
(test (string>? "abcde" "bc") #f)
(test (string>? "bcdef" "abcde") #t)
(test (string>? "bcdef" "abcdef") #t)
(test (string>? "" "") #f)
(test (string>? "A" "B") #f)
(test (string>? "a" "b") #f)
(test (string>? "9" "0") #t)
(test (string>? "A" "A") #f)

(test (string>? "A" "B" "a") #f)
(test (string>? "C" "B" "A") #t)
(test (string>? "A" "A" "A") #f)
(test (string>? "B" "B" "A") #f)
(test (string>? "foo" "foo" "foo") #f)
(test (string>? "foo" "foo" "") #f)
(test (string>? "foo" "foo" "fOo") #f)

(test (string>? "foo" "fooo" 1.0) 'error)
(test (let ((s1 "1234") (s2 "1245")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string>? s1 s2)) #f)
(test (let ((s1 "1234") (s2 "123")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string>? s1 s2)) #t)
(test (let ((s1 "123") (s2 "1234")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string>? s1 s2)) #f)

(test (string>? (string (integer->char #xf0)) (string (integer->char #x70))) #t) ; ??

(for-each
 (lambda (arg)
   (test (string>? "hi" arg) 'error)
   (test (string>? arg "hi") 'error))
 (list #\a () (list 1) '(1 . 2) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))



;;; --------------------------------------------------------------------------------
;;; string<=?

(test (string<=? "aaa" "aaaa") #t)
(test (string<=? "aaaaa" "aaaa") #f)
(test (string<=? "a" "abcdefgh") #t)
(test (string<=? "abc" "abcdefgh") #t)
(test (string<=? "aaabce" "aaabcdefgh") #f)
(test (string<=? "cabc" "abcdefgh") #f)
(test (string<=? "abcdefgh" "abcdefgh") #t)
(test (string<=? "xyzabc" "abcdefgh") #f)
(test (string<=? "abc" "xyzabcdefgh") #t)
(test (string<=? "abcdefgh" "") #f)
(test (string<=? "abcdefgh" "a") #f)
(test (string<=? "abcdefgh" "abc") #f)
(test (string<=? "abcdefgh" "cabc") #t)
(test (string<=? "abcdefgh" "xyzabc") #t)
(test (string<=? "xyzabcdefgh" "abc") #f)
(test (string<=? "abcdef" "bcdefgh") #t)
(test (string<=? "" "") #t)
(test (string<=? "A" "B") #t)
(test (string<=? "a" "b") #t)
(test (string<=? "9" "0") #f)
(test (string<=? "A" "A") #t)

(test (string<=? "A" "B" "C") #t)
(test (string<=? "C" "B" "A") #f)
(test (string<=? "A" "B" "B") #t)
(test (string<=? "A" "A" "A") #t)
(test (string<=? "B" "B" "A") #f)
(test (string<=? "foo" "foo" "foo") #t)
(test (string<=? "foo" "foo" "") #f)
(test (string<=? "foo" "foo" "fooo") #t)

(test (string<=? "foo" "fo" 1.0) 'error)
(test (let ((s1 "1234") (s2 "1245")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string<=? s1 s2)) #t)
(test (let ((s1 "1234") (s2 "123")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string<=? s1 s2)) #f)
(test (let ((s1 "123") (s2 "1234")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string<=? s1 s2)) #t)
(test (let ((s1 "1234") (s2 "1234")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string<=? s1 s2)) #t)

(for-each
 (lambda (arg)
   (test (string<=? "hi" arg) 'error)
   (test (string<=? arg "hi") 'error))
 (list #\a () (list 1) '(1 . 2) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))



;;; --------------------------------------------------------------------------------
;;; string>=?

(test (string>=? "aaaaa" "aaaa") #t)
(test (string>=? "aaaa" "aaaa") #t)
(test (string>=? "aaa" "aaaa") #f)
(test (string>=? "" "abcdefgh") #f)
(test (string>=? "a" "abcdefgh") #f)
(test (string>=? "abc" "abcdefgh") #f)
(test (string>=? "cabc" "abcdefgh") #t)
(test (string>=? "abcdefgh" "abcdefgh") #t)
(test (string>=? "xyzabc" "abcdefgh") #t)
(test (string>=? "abc" "xyzabcdefgh") #f)
(test (string>=? "abcdefgh" "") #t)
(test (string>=? "abcdefgh" "a") #t)
(test (string>=? "abcdefgh" "abc") #t)
(test (string>=? "abcdefgh" "cabc") #f)
(test (string>=? "abcdefgh" "xyzabc") #f)
(test (string>=? "xyzabcdefgh" "abc") #t)
(test (string>=? "bcdef" "abcdef") #t)
(test (string>=? "A" "B") #f)
(test (string>=? "a" "b") #f)
(test (string>=? "9" "0") #t)
(test (string>=? "A" "A") #t)
(test (string>=? "" "") #t)

(test (string>=? "A" "B" "C") #f)
(test (string>=? "C" "B" "A") #t)
(test (string>=? "C" "B" "B") #t)
(test (string>=? "A" "B" "B") #f)
(test (string>=? "A" "A" "A") #t)
(test (string>=? "B" "B" "A") #t)
(test (string>=? "B" "B" "C") #f)
(test (string>=? "foo" "foo" "foo") #t)
(test (string>=? "foo" "foo" "") #t)
(test (string>=? "foo" "foo" "fo") #t)

(test (string>=? "fo" "foo" 1.0) 'error)
(test (let ((s1 "1234") (s2 "1245")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string>=? s1 s2)) #f)
(test (let ((s1 "1234") (s2 "123")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string>=? s1 s2)) #t)
(test (let ((s1 "123") (s2 "1234")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string>=? s1 s2)) #f)
(test (let ((s1 "1234") (s2 "1234")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string>=? s1 s2)) #t)

(for-each
 (lambda (arg)
   (test (string>=? "hi" arg) 'error)
   (test (string>=? arg "hi") 'error))
 (list #\a () (list 1) '(1 . 2) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))



;;; --------------------------------------------------------------------------------
;;; string-ci=?

(test (string-ci=? "A" "B") #f)
(test (string-ci=? "a" "B") #f)
(test (string-ci=? "A" "b") #f)
(test (string-ci=? "a" "b") #f)
(test (string-ci=? "9" "0") #f)
(test (string-ci=? "A" "A") #t)
(test (string-ci=? "A" "a") #t)
(test (string-ci=? "" "") #t)
(test (string-ci=? "aaaa" "AAAA") #t)
(test (string-ci=? "aaaa" "Aaaa") #t)

(test (string-ci=? "A" "B" "a") #f)
(test (string-ci=? "A" "A" "a") #t)
(test (string-ci=? "A" "A" "a") #t)
(test (string-ci=? "foo" "foo" "foo") #t)
(test (string-ci=? "foo" "foo" "") #f)
(test (string-ci=? "foo" "Foo" "fOo") #t)

(test (string-ci=? "foo" "GOO" 1.0) 'error)
(test (let ((s1 "1234") (s2 "1245")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string-ci=? s1 s2)) #f)
(test (let ((s1 "1234") (s2 "1234")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string-ci=? s1 s2)) #t)
(test (let ((s1 "1234") (s2 "124")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string-ci=? s1 s2)) #f)
(test (let ((s1 "abcd") (s2 "ABCD")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string-ci=? s1 s2)) #t)
(test (let ((s1 "abcd") (s2 "ABCE")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string-ci=? s1 s2)) #f)
(test (let ((s1 "abcd") (s2 "ABC")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string-ci=? s1 s2)) #f)

(for-each
 (lambda (arg)
   (test (string-ci=? "hi" arg) 'error)
   (test (string-ci=? arg "hi") 'error))
 (list #\a () (list 1) '(1 . 2) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))


(when full-test
  (let ((size 15)
	(tries 10000))
    (let ((str1 (make-string size))
	  (str2 (make-string size)))
      (do ((i 0 (+ i 1)))
	  ((= i tries))
	(do ((k 0 (+ k 1)))
	    ((= k size))
	  (set! (str1 k) (integer->char (random 128)))
	  (if (> (random 10) 4)
	      (set! (str2 k) (char-upcase (str1 k)))
	      (set! (str2 k) (char-downcase (str1 k)))))
	(if (not (string-ci=? str1 str2))
	    (format #t "not =: ~S ~S~%" str1 str2))
	(if (and (string-ci<? str1 str2)
		 (string-ci>=? str1 str2))
	    (format #t "< : ~S ~S~%" str1 str2))
	(if (and (string-ci>? str1 str2)
		 (string-ci<=? str1 str2))
	    (format #t "> : ~S ~S~%" str1 str2))))))



;;; --------------------------------------------------------------------------------
;;; string-ci<?

(test (string-ci<? "a" "Aa") #t)
(test (string-ci<? "A" "B") #t)
(test (string-ci<? "a" "B") #t)
(test (string-ci<? "A" "b") #t)
(test (string-ci<? "a" "b") #t)
(test (string-ci<? "9" "0") #f)
(test (string-ci<? "0" "9") #t)
(test (string-ci<? "A" "A") #f)
(test (string-ci<? "A" "a") #f)
(test (string-ci<? "" "") #f)

(test (string-ci<? "t" "_") #t)
(test (string-ci<? "a" "]") #t)
(test (string-ci<? "z" "^") #t)
(test (string-ci<? "]4.jVKo\\\\^:\\A9Z4" "MImKA[mNv1`") #f)

(test (string-ci<? "A" "B" "A") #f)
(test (string-ci<? "A" "A" "B") #f)
(test (string-ci<? "A" "A" "A") #f)
(test (string-ci<? "B" "B" "C") #f)
(test (string-ci<? "B" "b" "C") #f)
(test (string-ci<? "foo" "foo" "foo") #f)
(test (string-ci<? "foo" "foo" "") #f)
(test (string-ci<? "foo" "foo" "fOo") #f)
(test (string-ci<? "34ZsfQD<obff33FBPFl" "7o" "9l7OM" "FC?M63=" "rLM5*J") #t)
(test (string-ci<? "NX7" "-;h>P" "DMhk3Bg") #f)
(test (string-ci<? "+\\mZl" "bE7\\e(HaW5CDXbPi@U_" "B_") #t)

(if (char-ci<? (integer->char #xf0) (integer->char #x70))
    (test (string-ci<? (string (integer->char #xf0)) (string (integer->char #x70))) #t))

(test (string-ci<? "foo" "fo" 1.0) 'error)
(test (let ((s1 "1234") (s2 "1245")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string-ci<? s1 s2)) #t)
(test (let ((s1 "1234") (s2 "1234")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string-ci<? s1 s2)) #f)
(test (let ((s1 "1234") (s2 "124")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string-ci<? s1 s2)) #t)
(test (let ((s1 "123") (s2 "12")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string-ci<? s1 s2)) #f)
(test (let ((s1 "abcd") (s2 "ABCD")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string-ci<? s1 s2)) #f)
(test (let ((s1 "abcd") (s2 "ABCE")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string-ci<? s1 s2)) #t)
(test (let ((s1 "abcd") (s2 "ABC")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string-ci<? s1 s2)) #f)
(test (let ((s1 "abc") (s2 "ABCD")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string-ci<? s1 s2)) #t)

(for-each
 (lambda (arg)
   (test (string-ci<? "hi" arg) 'error)
   (test (string-ci<? arg "hi") 'error))
 (list #\a () (list 1) '(1 . 2) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))



;;; --------------------------------------------------------------------------------
;;; string-ci>?

(test (string-ci>? "Aaa" "AA") #t)
(test (string-ci>? "A" "B") #f)
(test (string-ci>? "a" "B") #f)
(test (string-ci>? "A" "b") #f)
(test (string-ci>? "a" "b") #f)
(test (string-ci>? "9" "0") #t)
(test (string-ci>? "A" "A") #f)
(test (string-ci>? "A" "a") #f)
(test (string-ci>? "" "") #f)
(test (string-ci>? "Z" "DjNTl0") #t)
(test (string-ci>? "2399dt7BVN[,A" "^KHboHV") #f)

(test (string-ci>? "t" "_") #f)
(test (string-ci>? "a" "]") #f)
(test (string-ci>? "z" "^") #f)
(test (string-ci>? "R*95oG.k;?" "`2?J6LBbLG^alB[fMD") #f)
(test (string-ci>? "]" "X") #t)

(test (string-ci>? "A" "B" "a") #f)
(test (string-ci>? "C" "b" "A") #t)
(test (string-ci>? "a" "A" "A") #f)
(test (string-ci>? "B" "B" "A") #f)
(test (string-ci>? "foo" "foo" "foo") #f)
(test (string-ci>? "foo" "foo" "") #f)
(test (string-ci>? "foo" "foo" "fOo") #f)
(test (string-ci>? "ZNiuEa@/V" "KGbKliYMY" "9=69q3ica" ":]") #f)
(test (string-ci>? "^" "aN@di;iEO" "7*9q6uPmX9)PaY,6J" "15vH") #t)

(test (string-ci>? "foo" "fooo" 1.0) 'error)
(test (let ((s1 "abcd") (s2 "ABCD")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string-ci>? s1 s2)) #f)
(test (let ((s1 "abcd") (s2 "ABCE")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string-ci>? s1 s2)) #f)
(test (let ((s1 "abcd") (s2 "ABC")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string-ci>? s1 s2)) #t)
(test (let ((s1 "abc") (s2 "ABCD")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string-ci>? s1 s2)) #f)

(for-each
 (lambda (arg)
   (test (string-ci>? "hi" arg) 'error)
   (test (string-ci>? arg "hi") 'error))
 (list #\a () (list 1) '(1 . 2) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))



;;; --------------------------------------------------------------------------------
;;; string-ci<=?

(test (string-ci<=? "A" "B") #t)
(test (string-ci<=? "a" "B") #t)
(test (string-ci<=? "A" "b") #t)
(test (string-ci<=? "a" "b") #t)
(test (string-ci<=? "9" "0") #f)
(test (string-ci<=? "A" "A") #t)
(test (string-ci<=? "A" "a") #t)
(test (string-ci<=? "" "") #t)
(test (string-ci<=? ":LPC`" ",O0>affA?(") #f)

(test (string-ci<=? "t" "_") #t)
(test (string-ci<=? "a" "]") #t)
(test (string-ci<=? "z" "^") #t)
(test (string-ci<=? "G888E>beF)*mwCNnagP" "`2uTd?h") #t)

(test (string-ci<=? "A" "b" "C") #t)
(test (string-ci<=? "c" "B" "A") #f)
(test (string-ci<=? "A" "B" "B") #t)
(test (string-ci<=? "a" "A" "A") #t)
(test (string-ci<=? "B" "b" "A") #f)
(test (string-ci<=? "foo" "foo" "foo") #t)
(test (string-ci<=? "foo" "foo" "") #f)
(test (string-ci<=? "FOO" "fOo" "fooo") #t)
(test (string-ci<=? "78mdL82*" "EFaCrIdm@_D+" "eMu\\@dSSY") #t)
(test (string-ci<=? "`5pNuFc3PM<rNs" "e\\Su_raVNk6HD" "vXnuN7?S0?S(w+M?p") #f)

(test (string-ci<=? "fOo" "fo" 1.0) 'error)
(test (let ((s1 "abcd") (s2 "ABCD")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string-ci<=? s1 s2)) #t)
(test (let ((s1 "abcd") (s2 "ABCE")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string-ci<=? s1 s2)) #t)
(test (let ((s1 "abcd") (s2 "ABC")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string-ci<=? s1 s2)) #f)
(test (let ((s1 "abc") (s2 "ABCD")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string-ci<=? s1 s2)) #t)

(for-each
 (lambda (arg)
   (test (string-ci<=? "hi" arg) 'error)
   (test (string-ci<=? arg "hi") 'error))
 (list #\a () (list 1) '(1 . 2) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))



;;; --------------------------------------------------------------------------------
;;; string-ci>=?

(test (string-ci>=? "A" "B") #f)
(test (string-ci>=? "a" "B") #f)
(test (string-ci>=? "A" "b") #f)
(test (string-ci>=? "a" "b") #f)
(test (string-ci>=? "9" "0") #t)
(test (string-ci>=? "A" "A") #t)
(test (string-ci>=? "A" "a") #t)
(test (string-ci>=? "" "") #t)
(test (string-ci>=? "5d7?[o[:hop=ktv;9)" "p^r9;TAXO=^") #f)

(test (string-ci>=? "t" "_") #f)
(test (string-ci>=? "a" "]") #f)
(test (string-ci>=? "z" "^") #f)
(test (string-ci>=? "jBS" "`<+s[[:`l") #f)

(test (string-ci>=? "A" "b" "C") #f)
(test (string-ci>=? "C" "B" "A") #t)
(test (string-ci>=? "C" "B" "b") #t)
(test (string-ci>=? "a" "B" "B") #f)
(test (string-ci>=? "A" "A" "A") #t)
(test (string-ci>=? "B" "B" "A") #t)
(test (string-ci>=? "B" "b" "C") #f)
(test (string-ci>=? "foo" "foo" "foo") #t)
(test (string-ci>=? "foo" "foo" "") #t)
(test (string-ci>=? "foo" "foo" "fo") #t)
(test (string-ci>=? "tF?8`Sa" "NIkMd7" "f`" "1td-Z?teE" "-ik1SK)hh)Nq].>") #t)
(test (string-ci>=? "Z6a8P" "^/VpmWwt):?o[a9\\_N" "8[^h)<KX?[utsc") #f)

(test (string-ci>=? "fo" "foo" 1.0) 'error)
(test (let ((s1 "abcd") (s2 "ABCD")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string-ci>=? s1 s2)) #t)
(test (let ((s1 "abcd") (s2 "ABCE")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string-ci>=? s1 s2)) #f)
(test (let ((s1 "abcd") (s2 "ABC")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string-ci>=? s1 s2)) #t)
(test (let ((s1 "abc") (s2 "ABCD")) (string-set! s1 1 #\null) (string-set! s2 1 #\null) (string-ci>=? s1 s2)) #f)

(for-each
 (lambda (arg)
   (test (string-ci>=? "hi" arg) 'error)
   (test (string-ci>=? arg "hi") 'error))
 (list #\a () (list 1) '(1 . 2) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))



;;; --------------------------------------------------------------------------------
;;; string-length

(test (string-length "abc") 3)
(test (string-length "") 0)
(test (string-length (string)) 0)
(test (string-length "\"\\\"") 3)
(test (string-length (string #\newline)) 1)
(test (string-length "hi there") 8)
(test (string-length "\"") 1)
(test (string-length "\\") 1)
(test (string-length "\n") 1)
(test (string-length (make-string 100 #\a)) 100)
(test (string-length "1\\2") 3)
(test (string-length "1\\") 2)
(test (string-length "hi\\") 3)
(test (string-length "\\\\\\\"") 4)
(test (string-length "A ; comment") 11)
(test (string-length "#| comment |#") 13)
(test (string-length "'123") 4)
(test (string-length '"'123") 4)
(test (let ((str (string #\# #\\ #\t))) (string-length str)) 3)

(test (string-length "#\\(") 3)
(test (string-length ")()") 3)
(test (string-length "(()") 3)
(test (string-length "(string #\\( #\\+ #\\space #\\1 #\\space #\\3 #\\))") 44)
(test (string-length) 'error)
(test (string-length "hi" "ho") 'error)
(test (string-length (string #\null)) 1) ; ?
(test (string-length (string #\null #\null)) 2) ; ?
(test (string-length (string #\null #\newline)) 2) ; ?
(test (string-length ``"hi") 2) ; ?? and in s7 ,"hi" is "hi" as with numbers

(test (string-length ";~S ~S") 6)
(test (string-length "\n;~S ~S") 7)
(test (string-length "\n\t") 2)
(test (string-length "#\newline") 8)
(test (string-length "#\tab") 4)
(test (string-length "a\x00;b") 3)

(test (string-length "123\
456") 6)
(test (string-length"123\n
456") 8)
(test (string-length"123\n\
456") 7)

(for-each
 (lambda (arg)
   (test (string-length arg) 'error))
 (list #\a () (list 1) '(1 . 2) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))

;;; a couple more string constant cases
(test (string? "[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*") #t)
(test (format #f "\x7f~a" 1) (string #\delete #\1))
(test (format #f "\x00~a\xff" 1) (string #\null #\1 #\xff))



;;; --------------------------------------------------------------------------------
;;; string

(for-each
 (lambda (arg)
   (test (string #\a arg) 'error)
   (test (string #\a #\null arg) 'error)
   (test (string arg) 'error))
 (list () (list 1) '(1 . 2) "a" #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))

(test (string) "")
(test (string #\a #\b #\c) "abc")
(test (string #\a) "a")
(test (map string '(#\a #\b)) '("a" "b"))
(test (map string '(#\a #\b) '(#\c #\d)) '("ac" "bd"))
(test (map string '(#\a #\b #\c) '(#\d #\e #\f) '(#\g #\h #\i)) '("adg" "beh" "cfi"))
(test (map string "abc" "def" "ghi") '("adg" "beh" "cfi"))
(test (string #\" #\# #\") "\"#\"")
(test (string #\\ #\\ #\# #\\ #\# #\#) "\\\\#\\##")
(test (string #\' #\' #\` #\") '"''`\"")
;;; some schemes accept \' and other such sequences in a string, but the spec only mentions \\ and \"
(test (string ()) 'error)
(test (string "j" #\a) 'error)




;;; --------------------------------------------------------------------------------
;;; make-string

(test (make-string 0) "")
(test (make-string 3 #\a) "aaa")
(test (make-string 0 #\a) "")
(test (make-string 3 #\space) "   ")
(test (let ((hi (make-string 3 #\newline))) (string-length hi)) 3)

(test (make-string -1) 'error)
(test (make-string -0) "")
(test (make-string 2 #\a #\b) 'error)
(test (make-string) 'error)
(test (make-string most-positive-fixnum) 'error)
(test (make-string most-negative-fixnum) 'error)
(let () (define (hi size) (make-string size (integer->char (+ 1 (random 255))))) (string? (hi 3)))

(for-each
 (lambda (arg)
   (test (make-string 3 arg) 'error))
 (list "hi" () (list 1) '(1 . 2) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))

(for-each
 (lambda (arg)
   (test (make-string arg #\a) 'error))
 (list #\a "hi" () (list 1) '(1 . 2) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))

(for-each
 (lambda (arg)
   (test (make-string arg) 'error))
 (list #\a "hi" () (list 1) '(1 . 2) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))



;;; --------------------------------------------------------------------------------
;;; string-ref

(test (string-ref "abcdef-dg1ndh" 0) #\a)
(test (string-ref "abcdef-dg1ndh" 1) #\b)
(test (string-ref "abcdef-dg1ndh" 6) #\-)
(test (string-ref "\"\\\"" 1) #\\)
(test (string-ref "\"\\\"" 2) #\")

(test (let ((str (make-string 3 #\x))) (set! (string-ref str 1) #\a) str) "xax")

(test (string-ref "abcdef-dg1ndh" 20) 'error)
(test (string-ref "abcdef-dg1ndh") 'error)
(test (string-ref "abcdef-dg1ndh" -3) 'error)
(test (string-ref) 'error)
(test (string-ref 2) 'error)
(test (string-ref "\"\\\"" 3) 'error)
(test (string-ref "" 0) 'error)  
(test (string-ref "" 1) 'error)
(test (string-ref "hiho" (expt 2 32)) 'error)
(test (char=? (string-ref (string #\null) 0) #\null) #t)
(test (char=? (string-ref (string #\1 #\null #\2) 1) #\null) #t)
(test (char=? ("1\x002;" 1) #\null) #t)
(test (char=? (string-ref (string #\newline) 0) #\newline) #t)
(test (char=? (string-ref (string #\space) 0) #\space) #t)

(for-each
 (lambda (arg)
   (test (string-ref arg 0) 'error))
 (list #\a 1 () (list 1) '(1 . 2) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))

(for-each
 (lambda (arg)
   (test (string-ref "hiho" arg) 'error))
 (list #\a -1 123 4 "hi" () (list 1) '(1 . 2) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))

(test ("hi" 1) #\i)
(test (("hi" 1) 0) 'error)
(test ("hi" 1 2) 'error)
(test ("" 0) 'error)
(test (set! ("" 0) #\a) 'error)
(test (set! ("hi" 1 2) #\a) 'error)
(test (set! ("hi" 1) #\a #\b) 'error)
(test ("hi") 'error)
(test ("") 'error)
(test ((let () "hi")) 'error)
(test ((let () "hi") 0) #\h)

(test ("abs" most-negative-fixnum) 'error)
(test (string-ref "abs" most-negative-fixnum) 'error)
(test ("abs" (+ 1 most-negative-fixnum)) 'error)
(test ("abs" most-positive-fixnum) 'error)




;;; --------------------------------------------------------------------------------
;;; string-copy

(test (let ((hi (string-copy "hi"))) (string-set! hi 0 #\H) hi) "Hi")
(test (let ((hi (string-copy "hi"))) (string-set! hi 1 #\H) hi) "hH")
(test (let ((hi (string-copy "\"\\\""))) (string-set! hi 0 #\a) hi) "a\\\"")
(test (let ((hi (string-copy "\"\\\""))) (string-set! hi 1 #\a) hi) "\"a\"")
(test (let ((hi (string #\a #\newline #\b))) (string-set! hi 1 #\c) hi) "acb")
(test (string-copy "ab") "ab")
(test (string-copy "") "")
(test (string-copy "\"\\\"") "\"\\\"")
(test (let ((hi "abc")) (eq? hi (string-copy hi))) #f)
(test (let ((hi (string-copy (make-string 8 (integer->char 0))))) (string-fill! hi #\a) hi) "aaaaaaaa") ; is this result widely accepted?
(test (string-copy (string-copy (string-copy "a"))) "a")
(test (string-copy (string-copy (string-copy ""))) "")
(test (string-copy "a\x00;b") "a\x00;b") ; prints normally as "a" however
(test (string-copy (string #\1 #\null #\2)) (string #\1 #\null #\2))
(test (string-copy) 'error)
(test (string-copy "hi" "ho") 'error)

(for-each
 (lambda (arg)
   (test (string-copy arg) 'error))
 (list #\a 1 () (list 1) '(1 . 2) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))

(test (length (string-copy (string #\null))) 1)


;;; --------------------------------------------------------------------------------
;;; string-set!

(let ((str (make-string 10 #\x)))
  (string-set! str 3 (integer->char 0))
  (test (string=? str "xxx") #f)
  (test (char=? (string-ref str 4) #\x) #t)
  (string-set! str 4 #\a)
  (test (string=? str "xxx") #f)
  (test (char=? (string-ref str 4) #\a) #t)
  (string-set! str 3 #\x)
  (test (string=? str "xxxxaxxxxx") #t))

(test (string-set! "hiho" 1 #\c) #\c)
(test (set! ("hi" 1 2) #\i) 'error)
(test (set! ("hi" 1) "ho") 'error)
(test (set! ("hi") #\i) 'error)
(test (let ((x "hi") (y 'x)) (string-set! y 0 #\x) x) 'error)
(test (let ((str "ABS")) (set! (str 0) #\a)) #\a)
(test (let ((str "ABS")) (string-set! str 0 #\a)) #\a)
(test (let ((str "ABS")) (set! (string-ref str 0) #\a)) #\a)

(test (let ((hi (make-string 3 #\a)))
	(string-set! hi 1 (let ((ho (make-string 4 #\x)))
			    (string-set! ho 1 #\b)
			    (string-ref ho 0)))
	hi)
      "axa")

(test (string-set! "hiho" (expt 2 32) #\a) 'error)

(test (let ((hi (string-copy "hi"))) (string-set! hi 2 #\H) hi) 'error)
(test (let ((hi (string-copy "hi"))) (string-set! hi -1 #\H) hi) 'error)
(test (let ((g (lambda () "***"))) (string-set! (g) 0 #\?)) #\?)
(test (string-set! "" 0 #\a) 'error)
(test (string-set! "" 1 #\a) 'error)
(test (string-set! (string) 0 #\a) 'error)
(test (string-set! (symbol->string 'lambda) 0 #\a) #\a)
(test (let ((ho (make-string 0 #\x))) (string-set! ho 0 #\a) ho) 'error)
(test (let ((str "hi")) (string-set! (let () str) 1 #\a) str) "ha") ; (also in Guile)
(test (let ((x 2) (str "hi")) (string-set! (let () (set! x 3) str) 1 #\a) (list x str)) '(3 "ha"))
(test (let ((str "hi")) (set! ((let () str) 1) #\b) str) "hb")
(test (let ((str "hi")) (string-set! (let () (string-set! (let () str) 0 #\x) str) 1 #\x) str) "xx")
(test (let ((str "hi")) (string-set! (let () (set! str "hiho") str) 3 #\x) str) "hihx") ; ! (this works in Guile also)

(for-each
 (lambda (arg)
   (test (string-set! arg 0 #\a) 'error))
 (list #\a 1 () (list 1) '(1 . 2) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))

(for-each
 (lambda (arg)
   (test (string-set! "hiho" arg #\a) 'error))
 (list #\a -1 123 4 "hi" () (list 1) '(1 . 2) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))

(for-each
 (lambda (arg)
   (test (string-set! "hiho" 0 arg) 'error))
 (list 1 "hi" () (list 1) '(1 . 2) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))

(test (equal? (let ((str "hiho")) (string-set! str 2 #\null) str) "hi") #f)
(test (string=? (let ((str "hiho")) (string-set! str 2 #\null) str) "hi") #f)
(test (let* ((s1 "hi") (s2 s1)) (string-set! s2 1 #\x) s1) "hx")
(test (let* ((s1 "hi") (s2 (copy s1))) (string-set! s2 1 #\x) s1) "hi")

(test (eq? (car (catch #t (lambda () (set! ("hi") #\a)) (lambda args args))) 'wrong-number-of-args) #t)
(test (eq? (car (catch #t (lambda () (set! ("hi" 0 0) #\a)) (lambda args args))) 'wrong-number-of-args) #t) ; (vector-set! 1 ...)
(test (eq? (car (catch #t (lambda () (set! (("hi" 0) 0) #\a)) (lambda args args))) 'syntax-error) #t) ; (set! (1 ...))

(test (let ((s "012345")) (set! (apply s 2) #\a) s) 'error)
(test (string-set! #u8(0 1 0) 0 -9223372036854775808) 'error)

(let () (define (hi) (let ((str "123")) (set! (str 0) (values #\a #\b)) str)) (test (begin (hi) (hi)) 'error))
(let () (define (hi) (let ((str "123")) (set! (str 0) (values #\a #\b)) str)) (test (begin (catch #t hi (lambda a a)) (hi)) 'error))



;;; --------------------------------------------------------------------------------
;;; string-fill!

(test (string-fill! "hiho" #\c) #\c)
(test (string-fill! "" #\a) #\a)
(test (string-fill! "hiho" #\a) #\a)
(test (let ((g (lambda () "***"))) (string-fill! (g) #\?)) #\?)
(test (string-fill!) 'error)
(test (string-fill! "hiho" #\a #\b) 'error)

(test (let ((hi (string-copy "hi"))) (string-fill! hi #\s) hi) "ss")
(test (let ((hi (string-copy ""))) (string-fill! hi #\x) hi) "")
(test (let ((str (make-string 0))) (string-fill! str #\a) str) "")
(test (let ((hi (make-string 8 (integer->char 0)))) (string-fill! hi #\a) hi) "aaaaaaaa") ; is this result widely accepted?
(test (recompose 12 string-copy "xax") "xax")
(test (let ((hi (make-string 3 #\x))) (recompose 12 (lambda (a) (string-fill! a #\a) a) hi)) "aaa")
(test (let ((hi (make-string 3 #\x))) (recompose 12 (lambda (a) (string-fill! hi a)) #\a) hi) "aaa")
(test (let ((str (string #\null #\null))) (fill! str #\x) str) "xx")

(for-each
 (lambda (arg)
   (test (let ((hiho "hiho")) (string-fill! hiho arg) hiho) 'error))
 (list 1 "hi" () (list 1) '(1 . 2) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))

(for-each
 (lambda (arg)
   (test (string-fill! arg #\a) 'error))
 (list #\a 1 () (list 1) '(1 . 2) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))

(test (let ((str "1234567890")) (string-fill! str #\a 0) str) "aaaaaaaaaa")
(test (let ((str "1234567890")) (string-fill! str #\a 0 10) str) "aaaaaaaaaa")
(test (let ((str "1234567890")) (string-fill! str #\a 0 0) str) "1234567890")
(test (let ((str "1234567890")) (string-fill! str #\a 4 4) str) "1234567890")
(test (let ((str "1234567890")) (string-fill! str #\a 10 10) str) "1234567890")
(test (let ((str "1234567890")) (string-fill! str #\a 0 4) str) "aaaa567890")
(test (let ((str "1234567890")) (string-fill! str #\a 3 4) str) "123a567890")
(test (let ((str "1234567890")) (string-fill! str #\a 1 9) str) "1aaaaaaaa0")
(test (let ((str "1234567890")) (string-fill! str #\a 8) str) "12345678aa")
(test (let ((str "1234567890")) (string-fill! str #\a 1 9 0) str) 'error)
(test (let ((str "1234567890")) (string-fill! str #\a 1 0) str) 'error)
(test (let ((str "1234567890")) (string-fill! str #\a 11) str) 'error)
(test (let ((str "1234567890")) (string-fill! str #\a 9 11) str) 'error)
(test (string-fill! "" 0 "hi") 'error)
(test (string-fill! "" 0 -1 3) 'error)
(test (string-fill! "" 0 1) 'error)
(test (string-fill! "" 0 0 4/3) 'error)



;;; --------------------------------------------------------------------------------
;;; string-upcase
;;; string-downcase

(test (string-downcase "") "")
(test (string-downcase "a") "a")
(test (string-downcase "A") "a")
(test (string-downcase "AbC") "abc")
(test (string-downcase "\"\\\"") "\"\\\"")
(test (let ((hi "abc")) (eq? hi (string-downcase hi))) #f)
(test (string-downcase (string-upcase (string-downcase "a"))) "a")
(test (string-downcase "a\x00;b") "a\x00;b") 
(test (string-downcase (string #\1 #\null #\2)) (string #\1 #\null #\2))
(test (string-downcase) 'error)
(test (string-downcase "hi" "ho") 'error)

(test (string-upcase "") "")
(test (string-upcase "a") "A")
(test (string-upcase "A") "A")
(test (string-upcase "AbC") "ABC")
(test (string-upcase "\"\\\"") "\"\\\"")
(test (let ((hi "ABC")) (eq? hi (string-upcase hi))) #f)
(test (string-upcase (string-downcase (string-upcase "a"))) "A")
(test (string-upcase "a\x00;b") "A\x00;B") 
(test (string-upcase (string #\1 #\null #\2)) (string #\1 #\null #\2))
(test (string-upcase) 'error)
(test (string-upcase "hi" "ho") 'error)

(for-each
 (lambda (arg)
   (test (string-downcase arg) 'error)
   (test (string-upcase arg) 'error))
 (list #\a 1 () (list 1) '(1 . 2) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))

;;; for r7rs, these need to be unicode-aware


;;; --------------------------------------------------------------------------------
;;; substring

(test (substring "ab" 0 0) "")
(test (substring "ab" 1 1) "")
(test (substring "ab" 2 2) "")
(test (substring "ab" 0 1) "a")
(test (substring "ab" 1 2) "b")
(test (substring "ab" 0 2) "ab")
(test (substring "hi there" 3 6) "the")
(test (substring "hi there" 0 (string-length "hi there")) "hi there")
(test (substring "" 0 0) "")
(let ((str "012345"))
  (let ((str1 (substring str 2 4)))
    (string-set! str1 1 #\x)
    (test (string=? str "012345") #t)
    (let ((str2 (substring str1 1)))
      (set! (str2 0) #\z)
      (test (string=? str "012345") #t)
      (test (string=? str1 "2x") #t)
      (test (string=? str2 "z") #t))))
(test (substring (substring "hiho" 0 2) 1) "i")
(test (substring (substring "hiho" 0 2) 2) "")
(test (substring (substring "hiho" 0 2) 0 1) "h")
(test (substring "hi\nho" 3 5) "ho")
(test (substring (substring "hi\nho" 1 4) 2) "h")
(test (substring (substring "hi\nho" 3 5) 1 2) "o")
(test (substring "hi\"ho" 3 5) "ho")
(test (substring (substring "hi\"ho" 1 4) 2) "h")
(test (substring (substring "hi\"ho" 3 5) 1 2) "o")
(test (let* ((s1 "0123456789") (s2 (substring s1 1 3))) (string-set! s2 1 #\x) s1) "0123456789")
(test (substring (substring "" 0 0) 0 0) "")
(test (substring (format #f "") 0 0) "")
(test (string=? (substring (substring (substring "01234567" 1) 1) 1) "34567") #t)
(let ()
  (define (hi) (string=? (substring (substring (substring "01234567" 1) 1) 1) "34567"))
  (define (ho) (hi)) (ho)
  (test (ho) #t))

(test (substring "012" 3) "")
(test (substring "012" 10) 'error)
(test (substring "012" most-positive-fixnum) 'error)
(test (substring "012" -1) 'error)
(test (substring "012" 3 3) "")
(test (substring "012" 3 4) 'error)
(test (substring "012" 3 2) 'error)
(test (substring "012" 3 -2) 'error)
(test (substring "012" 3 0) 'error)
(test (substring "012" 0) "012")
(test (substring "012" 2) "2")
(test (substring "" 0) "")

(test (recompose 12 (lambda (a) (substring a 0 3)) "12345") "123")
(test (reinvert 12 (lambda (a) (substring a 0 3)) (lambda (a) (string-append a "45")) "12345") "12345")

(test (substring "ab" 0 3) 'error)
(test (substring "ab" 3 3) 'error)
(test (substring "ab" 2 3) 'error)
(test (substring "" 0 1) 'error)
(test (substring "" -1 0) 'error)
(test (substring "abc" -1 0) 'error)
(test (substring "hiho" (expt 2 32) (+ 2 (expt 2 32))) 'error)
(test (substring) 'error)
(test (substring "hiho" 0 1 2) 'error)
(test (substring "1234" -1 -1) 'error)
(test (substring "1234" 1 0) 'error)
(test (substring "" most-positive-fixnum 1) 'error)

(let ((str "0123456789"))
  (string-set! str 5 #\null)
  (test (substring str 6) "6789")
  (test (substring str 5 5) "")
  (test (substring str 4 5) "4")
  (test (substring str 5 6) "\x00;")
  (test (substring str 5 7) "\x00;6")
  (test (substring str 4 7) "4\x00;6"))

(for-each
 (lambda (arg)
   (test (substring "hiho" arg 0) 'error))
 (list "hi" #\a 1 () (list 1) '(1 . 2) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))

(for-each
 (lambda (arg)
   (test (substring "0123" arg) 'error)
   (test (substring "hiho" 1 arg) 'error))
 (list "hi" #\a -1 () (list 1) '(1 . 2) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))

(for-each
 (lambda (arg)
   (test (substring arg 1 2) 'error))
 (list #\a 1 () (list 1) '(1 . 2) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))

(define (substring? pattern target) ; taken from net somewhere (umich?) with changes for s7 (which now has string-position, so this is unneeded)
  (define (build-shift-vector pattern)
    (let* ((pat-len (length pattern))
	   (shift-vec (make-vector 256 (+ pat-len 1)))
	   (max-pat-index (- pat-len 1)))
      (let loop ((index 0))
	(set! (shift-vec (char->integer (pattern index))) (- pat-len index))
	(if (< index max-pat-index)
	    (loop (+ index 1))
	    shift-vec))))
  (if (or (not (string? pattern))
	  (not (string? target)))
      (error 'wrong-type-arg "substring? args should be strings: ~S ~S" pattern target)
      (let ((pat-len (length pattern)))
	(if (zero? pat-len)
	    0
	    (let ((shift-vec (build-shift-vector pattern)))
	      (let* ((tar-len (length target))
		     (max-tar-index (- tar-len 1))
		     (max-pat-index (- pat-len 1)))
		(let outer ((start-index 0))
		  (and (<= (+ pat-len start-index) tar-len)
		       (let inner ((p-ind 0) (t-ind start-index))
			 (cond
			  ((> p-ind max-pat-index) #f)           ; nothing left to check
			  ((char=? (pattern p-ind) (target t-ind))
			   (if (= p-ind max-pat-index)
			       start-index                       ; success -- return start index of match
			       (inner (+ p-ind 1) (+ t-ind 1)))) ; keep checking
			  ((> (+ pat-len start-index) max-tar-index) #f) ; fail
			  (else (outer (+ start-index (shift-vec (char->integer (target (+ start-index pat-len)))))))))))))))))

(test (substring? "hiho" "test hiho test") 5)
(test (substring? "hiho" "test hihptest") #f)
(test (substring? "hiho" "test hih") #f)
(test (substring? "hiho" "") #f)
(test (substring? "hiho" "hiho") 0)
(test (substring? "" "hiho") 0)
(test (substring? "abc" 'abc) 'error)



;;; --------------------------------------------------------------------------------
;;; string-append

(test (string-append "hi" "ho") "hiho")
(test (string-append "hi") "hi")
(test (string-append "hi" "") "hi")
(test (string-append "hi" "" "ho") "hiho")
(test (string-append "" "hi") "hi")
(test (string-append) "")
(test (string-append "a" (string-append (string-append "b" "c") "d") "e") "abcde")
(test (string-append "a" "b" "c" "d" "e") "abcde")
(test (string-append (string-append) (string-append (string-append))) "")
(test (let ((hi "hi")) (let ((ho (string-append hi))) (eq? hi ho))) #f)
(test (let ((hi "hi")) (let ((ho (string-append hi))) (string-set! ho 0 #\a) hi)) "hi")
(test (let ((hi "hi")) (set! hi (string-append hi hi hi hi)) hi) "hihihihi")
(test (string-append ()) 'error)
(test (string=? (string-append "012" (string #\null) "456") 
		(let ((str "0123456")) (string-set! str 3 #\null) str))
      #t)
(test (string=? (string-append "012" (string #\null) "356") 
		(let ((str "0123456")) (string-set! str 3 #\null) str))
      #f)
(test (string-append """hi""ho""") "hiho")
(test (let* ((s1 "hi") (s2 (string-append s1 s1))) (string-set! s2 1 #\x) s1) "hi")
(test (let* ((s1 "hi") (s2 (string-append s1))) (string-set! s2 1 #\x) s1) "hi")
(test (length (string-append (string #\x #\y (integer->char 127) #\z) (string #\a (integer->char 0) #\b #\c))) 8)

(test (length (string-append "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc" "abc")) 915)
(test (length (string-append (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c) (string #\a #\b #\c))) 915)


(num-test (letrec ((hi (lambda (str n)
			 (if (= n 0)
			     str
			     (hi (string-append str "a") (- n 1))))))
	    (string-length (hi "" 100)))
	  100)

(test (let* ((str "hiho")
	     (str1 "ha")
	     (str2 (string-append str1 str)))
	(string-set! str2 1 #\x)
	(string-set! str2 4 #\x)
	(and (string=? str "hiho")
	     (string=? str1 "ha")
	     (string=? str2 "hxhixo")))
      #t)
(test (let* ((str (string-copy "hiho"))
	     (str1 (string-copy "ha"))
	     (str2 (string-append str1 str)))
	(string-set! str1 1 #\x)
	(string-set! str 2 #\x)
	(and (string=? str "hixo")
	     (string=? str1 "hx")
	     (string=? str2 "hahiho")))
      #t)

(let ((s1 (string #\x #\null #\y))
      (s2 (string #\z #\null)))
  (test (string=? (string-append s1 s2) (string #\x #\null #\y #\z #\null)) #t)
  (test (string=? (string-append s2 s1) (string #\z #\null #\x #\null #\y)) #t))

(test (recompose 12 string-append "x") "x")
(test (recompose 12 (lambda (a) (string-append a "x")) "a") "axxxxxxxxxxxx")
(test (recompose 12 (lambda (a) (string-append "x" a)) "a") "xxxxxxxxxxxxa")

(test (length (string-append "\\?" "hi")) 4)
(test (string-append "hi" 1) 'error)
(test (eval-string "(string-append \"\\?\")") 'error) ; guile mailing list
(test (eval-string "(string-append \"\\?\" \"hi\")") 'error) ; guile mailing list
(for-each
 (lambda (arg)
   (test (string-append "hiho" arg) 'error)
   (test (string-append arg "hi") 'error)
   (test (string-append "a" "b" arg) 'error))
 (list #\a 1 () (list 1) '(1 . 2) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))


(test (let ((str (make-string 4 #\x))
	    (ctr 0))
	(for-each
	 (lambda (c)
	   (string-set! str ctr c)
	   (set! ctr (+ ctr 1)))
	 "1234")
	str)
      "1234")

(test (let ((str (make-string 8 #\x))
	    (ctr 0))
	(for-each
	 (lambda (c1 c2)
	   (string-set! str ctr c1)
	   (string-set! str (+ ctr 1) c2)
	   (set! ctr (+ ctr 2)))
	 "1234"
	 "hiho")
	str)
      "1h2i3h4o")

#|
(let ((size 1024))
  (let ((str (make-string size)))
    (do ((i 0 (+ i 1)))
	((= i size))
      (set! (str i) (integer->char (+ 1 (modulo i 255)))))
    (let ((str1 (string-copy str)))
      (test (string? str1) #t)
      (test (string-length str1) 1024)
      (test (string-ref str1 556) (string-ref str 556))
      (test (string=? str str1) #t)
      (test (string<=? str str1) #t)
      (test (string>=? str str1) #t)
      (test (string-ci=? str str1) #t)
      (test (string-ci<=? str str1) #t)
      (test (string-ci>=? str str1) #t)
      (test (string<? str str1) #f)
      (test (string>? str str1) #f)
      (test (string-ci<? str str1) #f)
      (test (string-ci>? str str1) #f)
      (test (substring str 123 321) (substring str1 123 321))

      (string-set! str1 1000 #\space)
      (test (string=? str str1) #f)
      (test (string<=? str str1) #f)
      (test (string>=? str str1) #t)
      (test (string-ci=? str str1) #f)
      (test (string-ci<=? str str1) #f)
      (test (string-ci>=? str str1) #t)
      (test (string<? str str1) #f)
      (test (string>? str str1) #t)
      (test (string-ci<? str str1) #f)
      (test (string-ci>? str str1) #t)

      (test (string-length (string-append str str1)) 2048)
      ))))
|#



;;; --------------------------------------------------------------------------------
;;; string->list
;;; list->string

(test (string->list "abc") (list #\a #\b #\c))
(test (string->list "") ())
(test (string->list (make-string 0)) ())
(test (string->list (string #\null)) '(#\null))
(test (string->list (string)) ())
(test (string->list (substring "hi" 0 0)) ())
(test (string->list (list->string (list #\a #\b #\c))) (list #\a #\b #\c))
(test (string->list (list->string ())) ())
(test (list->string (string->list "abc")) "abc")
(test (list->string (string->list "hi there")) "hi there")
(test (list->string (string->list "&*#%^@%$)~@")) "&*#%^@%$)~@")
(test (list->string (string->list "")) "")
(test (let* ((str "abc")
	     (lst (string->list str)))
	(and (string=? str "abc")
	     (equal? lst (list #\a #\b #\c))))
      #t)
(test (list->string ()) "")

(test (list->string (list #\a #\b #\c)) "abc")
(test (list->string (list)) "")

(test (list->string (list #\" #\# #\")) "\"#\"")
(test (list->string (list #\\ #\\ #\# #\\ #\# #\#)) "\\\\#\\##")
(test (list->string (list #\' #\' #\` #\")) '"''`\"")

(test (reinvert 12 string->list list->string "12345") "12345")

(test (string->list) 'error)
(test (list->string) 'error)
(test (string->list "hi" "ho") 'error)
(test (list->string () '(1 2)) 'error)
(test (apply list->string '(#\a . #\b)) 'error)
(test (list->string #\a . #\b) 'error)
(test (let ((lst (cons #\a #\b))) (list->string lst)) 'error)
(test (string->list " hi ") '(#\space #\h #\i #\space))
(test (string->list (string (integer->char #xf0) (integer->char #x70))) (list (integer->char #xf0) (integer->char #x70)))

(for-each
 (lambda (arg)
   (test (string->list arg) 'error))
 (list #\a 1 () (list 1) '(1 . 2) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))

(test (let ((x (cons #\a #\b))) (set-cdr! x x) (list->string x)) 'error)
(test (let ((lst (list #\a #\b))) (set! (cdr (cdr lst)) lst) (list->string lst)) 'error)
(test (let ((lst (list #\a #\b))) (set! (cdr (cdr lst)) lst) (apply string lst)) 'error)

(for-each
 (lambda (arg)
   (test (list->string arg) 'error))
 (list "hi" #\a 1 ''foo '(1 . 2) (cons #\a #\b) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))

(let ((str (list->string '(#\x #\space #\null #\x))))
  (test (length str) 4)
  (test (str 1) #\space)
  (test (str 2) #\null)
  (test (str 3) #\x)
  (test (object->string str) "\"x \\x00;x\"")
  (let ((lst (string->list str)))
    (test lst '(#\x #\space #\null #\x))))

(let ((strlen 8))
  (let ((str (make-string strlen)))
    (do ((i 0 (+ i 1)))
	((= i 10))
      (do ((k 0 (+ k 1)))
	  ((= k strlen))
	(set! (str k) (integer->char (random 256))))
      (let ((lst (string->list str)))
	(let ((newstr (list->string lst)))
	  (let ((lstlen (length lst))
		(newstrlen (length newstr)))
	    (if (or (not (= lstlen strlen newstrlen))
		    (not (string=? newstr str)))
		(format #t ";string->list->string: ~S -> ~A -> ~S~%" str lst newstr))))))))

(when full-test
  (let ()
    (define (all-strs len file)
      (let* ((funny-chars (list #\` #\# #\, #\@ #\' #\" #\. #\( #\) #\\))
	     (num-chars (length funny-chars)))
	(let ((ctrs (make-vector len 0)))
	  
	  (do ((i 0 (+ i 1)))
	      ((= i (expt num-chars len)))
	    (let ((carry #t))
	      (do ((k 0 (+ k 1)))
		  ((or (= k len)
		       (not carry)))
		(vector-set! ctrs k (+ 1 (vector-ref ctrs k)))
		(if (= (vector-ref ctrs k) num-chars)
		    (vector-set! ctrs k 0)
		    (set! carry #f)))
	      
	      (let ((strlst ()))
		(do ((k 0 (+ k 1)))
		    ((= k len))
		  (let ((c (list-ref funny-chars (vector-ref ctrs k))))
		    (set! strlst (cons c strlst))))
		
		(let ((str (list->string strlst)))
		  (format file "(test (and (string=? ~S (string ~{#\\~C~^ ~})) (equal? '~A (string->list ~S))) #t)~%" str strlst strlst str))))))))
    
    (call-with-output-file "strtst.scm"
      (lambda (p)
	(do ((len 3 (+ len 1)))
	    ((= len 5))
	  (all-strs len p))))
    
    (load "strtst.scm")))


(test (and (string=? "\"" (string #\")) (equal? '(#\") (string->list "\""))) #t)
(test (and (string=? "#\\" (string #\# #\\)) (equal? '(#\# #\\) (string->list "#\\"))) #t)
(test (and (string=? "#(" (string #\# #\()) (equal? '(#\# #\() (string->list "#("))) #t)
(test (and (string=? "\"@" (string #\" #\@)) (equal? '(#\" #\@) (string->list "\"@"))) #t)
(test (and (string=? "\";" (string #\" #\;)) (equal? '(#\" #\;) (string->list "\";"))) #t)
(test (and (string=? ")(" (string #\) #\()) (equal? '(#\) #\() (string->list ")("))) #t)
(test (and (string=? "`)#" (string #\` #\) #\#)) (equal? '(#\` #\) #\#) (string->list "`)#"))) #t)
(test (and (string=? "##\\" (string #\# #\# #\\)) (equal? '(#\# #\# #\\) (string->list "##\\"))) #t)
(test (and (string=? "#\"(" (string #\# #\" #\()) (equal? '(#\# #\" #\() (string->list "#\"("))) #t)
(test (and (string=? "#.@" (string #\# #\. #\@)) (equal? '(#\# #\. #\@) (string->list "#.@"))) #t)
(test (and (string=? ",`@" (string #\, #\` #\@)) (equal? '(#\, #\` #\@) (string->list ",`@"))) #t)
(test (and (string=? "',@" (string #\' #\, #\@)) (equal? '(#\' #\, #\@) (string->list "',@"))) #t)
(test (and (string=? "\"#@" (string #\" #\# #\@)) (equal? '(#\" #\# #\@) (string->list "\"#@"))) #t)
(test (and (string=? "\")\"" (string #\" #\) #\")) (equal? '(#\" #\) #\") (string->list "\")\""))) #t)
(test (and (string=? ")#(" (string #\) #\# #\()) (equal? '(#\) #\# #\() (string->list ")#("))) #t)
(test (and (string=? "`(,@" (string #\` #\( #\, #\@)) (equal? '(#\` #\( #\, #\@) (string->list "`(,@"))) #t)
(test (and (string=? "`)#\"" (string #\` #\) #\# #\")) (equal? '(#\` #\) #\# #\") (string->list "`)#\""))) #t)
(test (and (string=? "#\"'#" (string #\# #\" #\' #\#)) (equal? '(#\# #\" #\' #\#) (string->list "#\"'#"))) #t)
(test (and (string=? "#(@\\" (string #\# #\( #\@ #\\)) (equal? '(#\# #\( #\@ #\\) (string->list "#(@\\"))) #t)
(test (and (string=? "#(\\\\" (string #\# #\( #\\ #\\)) (equal? '(#\# #\( #\\ #\\) (string->list "#(\\\\"))) #t)
(test (and (string=? ",,.@" (string #\, #\, #\. #\@)) (equal? '(#\, #\, #\. #\@) (string->list ",,.@"))) #t)
(test (and (string=? ",@`\"" (string #\, #\@ #\` #\")) (equal? '(#\, #\@ #\` #\") (string->list ",@`\""))) #t)
(test (and (string=? "\"'\")" (string #\" #\' #\" #\))) (equal? '(#\" #\' #\" #\)) (string->list "\"'\")"))) #t)
(test (and (string=? "\")#\"" (string #\" #\) #\# #\")) (equal? '(#\" #\) #\# #\") (string->list "\")#\""))) #t)
(test (and (string=? "(\\`)" (string #\( #\\ #\` #\))) (equal? '(#\( #\\ #\` #\)) (string->list "(\\`)"))) #t)
(test (and (string=? "))\"'" (string #\) #\) #\" #\')) (equal? '(#\) #\) #\" #\') (string->list "))\"'"))) #t)
(test (and (string=? "\\,\\\"" (string #\\ #\, #\\ #\")) (equal? '(#\\ #\, #\\ #\") (string->list "\\,\\\""))) #t)
(test (and (string=? "\\\"`\"" (string #\\ #\" #\` #\")) (equal? '(#\\ #\" #\` #\") (string->list "\\\"`\""))) #t)
(test (and (string=? "\\\\#\"" (string #\\ #\\ #\# #\")) (equal? '(#\\ #\\ #\# #\") (string->list "\\\\#\""))) #t)

(test (string->list "" 0 10) 'error)
(test (string->list "1" 0 2) 'error)
(test (string->list "" 0 0) ())
(test (string->list "1" 1) ())
(test (string->list "1" 0) '(#\1))
(test (string->list "" #\null) 'error)
(test (string->list "" 0 #\null) 'error)
(test (string->list "" -1) 'error)
(test (string->list "1" -1) 'error)
(test (string->list "1" 0 -1) 'error)
(test (string->list "1" -2 -1) 'error)
(test (string->list "1" most-negative-fixnum) 'error)
(test (string->list "1" 2) 'error)

(for-each
 (lambda (arg)
   (test (string->list "012345" arg) 'error)
   (test (string->list "012345" 1 arg) 'error))
 (list #\a "hi" () (list 1) '(1 . 2) 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))

(test (string->list "12345" 0) '(#\1 #\2 #\3 #\4 #\5))
(test (string->list "12345" 0 5) '(#\1 #\2 #\3 #\4 #\5))
(test (string->list "12345" 5 5) ())
(test (string->list "12345" 4 5) '(#\5))
(test (string->list "12345" 2 4) '(#\3 #\4))
(test (string->list "12345" 2 1) 'error)
(test (string->list "12345" 2 3 4) 'error)
(test (string->list (make-string 3 #\null) 2 3) '(#\null))



;;; --------------------------------------------------------------------------------
;;; char-position
;;; string-position

(test (char-position) 'error)
(test (char-position #\a) 'error)
(test (char-position #\a "abc" #\0) 'error)
(test (char-position #\a "abc" 0 1) 'error)
(test (string-position) 'error)
(test (string-position #\a) 'error)
(test (string-position "a" "abc" #\0) 'error)
(test (string-position "a" "abc" 0 1) 'error)

(for-each
 (lambda (arg) 
   (test (string-position arg "abc") 'error)
   (test (char-position arg "abc") 'error)
   (test (string-position "a" arg) 'error)
   (test (char-position #\a arg) 'error)
   (test (string-position "a" "abc" arg) 'error)
   (test (char-position #\a "abc" arg) 'error))
 (list () (list 1) '(1 . 2) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 -1 most-negative-fixnum 1.0+1.0i :hi (if #f #f) (lambda (a) (+ a 1))))
(test (char-position #\a "abc" most-positive-fixnum) #f)
(test (char-position "a" "abc" most-positive-fixnum) #f)
(test (string-position "a" "abc" most-positive-fixnum) #f)

(test (char-position #\b "abc") 1)
(test (char-position #\b "abc" 0) 1)
(test (char-position #\b "abc" 1) 1)
(test (char-position "b" "abc") 1)
(test (char-position "b" "abc" 1) 1)
(test (char-position "b" "abc") 1)
(test (string-position "b" "abc") 1)
(test (string-position "b" "abc" 1) 1)
(test (string-position "b" "abc" 2) #f)
(test (string-position "b" "abc" 3) #f)
(test (char-position "b" "abc" 2) #f)
(test (char-position "b" "abc" 3) #f)
(test (char-position #\b "abc" 2) #f)
(test (char-position #\b "abc" 3) #f)
(test (char-position "ab" "abcd") 0)
(test (char-position "ab" "ffbcd") 2)
(test (char-position "ab" "ffacd") 2)
(test (string-position "ab" "ffacd") #f)
(test (string-position "ab" "ffabd") 2)
(test (string-position "ab" "ffabab" 2) 2)
(test (string-position "ab" "ffabab" 3) 4)
(test (string-position "ab" "ffabab" 4) 4)
(test (string-position "ab" "ffabab" 5) #f)
(test (string-position "abc" "ab") #f)
(test (string-position "abc" "") #f)
(test (string-position "" "") #f)
(test (char-position "\"" "a") #f)
(test (char-position "\"" "a\"b") 1)
(test (char-position #\" "a\"b") 1)
(test (string-position "\"hiho\"" "hiho") #f)
(test (string-position "\"hiho\"" "\"\"hiho\"") 1)

(test (string-position "" "a") #f) ; this is a deliberate choice in s7.c
(test (char-position "" "a") #f) 
(test (char-position #\null "a") 1)  ; ??
(test (char-position #\null "") #f)  ; ??
(test (string-position (string #\null) "a") 0) ; ??
(test (string-position (string #\null) "") #f) ; ??
(test (char-position #\null (string #\null)) 0) ; ??
(test (char-position #\null (string #\a #\null #\n)) 1)
(test (char-position "" (string #\a #\null #\n)) #f)
;(test (char-position #\n (string #\a #\null #\n)) 2)   ; ?? returns #f due to assumption of C-style strings
;(test (char-position "n" (string #\a #\null #\n)) 1)   ; oops!
;(test (string-position "n" (string #\a #\null #\n)) 2) ; oops!
(test (char-position "" (string #\a #\n)) #f)
(test (char-position #(1) "asdasd" 63) 'error)

;; if "" as string-pos first, -> #f so same for char-pos, even if string contains a null

(let ()
  ;; actually more of a string-append/temp substring test
  (define (fixit str)
    (let ((pos (char-position #\& str)))
      (if (not pos)
	  str
	  (string-append (substring str 0 pos)
			 (let ((epos (char-position #\; str pos)))
			   (let ((substr (substring str (+ pos 1) epos)))
			     (let ((replacement (cond ((string=? substr "gt") ">")
						      ((string=? substr "lt") "<")
						      ((string=? substr "mdash") "-")
						      (else (format #t "unknown: ~A~%" substr)))))
			       (string-append replacement
					      (fixit (substring str (+ epos 1)))))))))))
  (test (fixit "(let ((f (hz-&gt;radians 100)) (g (hz-&gt;radians 200))) (&lt; f g))")
	"(let ((f (hz->radians 100)) (g (hz->radians 200))) (< f g))"))

;;; opt bug
(test (apply char-position '(#\a #u8() #f)) 'error)
(test (let () (define (f1) (do ((i 0 (+ i 1))) ((= i 1) (char-position #\a #u8() #f)) (char-position #\a #u8() #f))) (f1)) 'error)




;;; --------------------------------------------------------------------------------
;;; symbol->string
;;; string->symbol
;;; symbol

(test (symbol->string 'hi) "hi")
(test (string->symbol (symbol->string 'hi)) 'hi)
(test (eq? (string->symbol "hi") 'hi) #t)
(test (eq? (string->symbol "hi") (string->symbol "hi")) #t)

(test (string->symbol "hi") 'hi)

(test (let ((str (symbol->string 'hi)))
	(catch #t (lambda () (string-set! str 1 #\x)) (lambda args 'error)) ; can be disallowed
	(symbol->string 'hi))
      "hi")

(test (symbol->string 'sym0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789)
      "sym0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789")
(test (string->symbol "sym0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789")
      'sym0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789)
(test (let ((sym0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 32))
	(+ sym0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 1))
      33)

(test (symbol->string (string->symbol "hi there")) "hi there")
(test (symbol->string (string->symbol "Hi There")) "Hi There")
(test (symbol->string (string->symbol "HI THERE")) "HI THERE")
(test (symbol->string (string->symbol "")) 'error) ; this fluctuates
(test (symbol? (string->symbol "(weird name for a symbol!)")) #t)
(test (symbol->string (string->symbol "()")) "()")
(test (symbol->string (string->symbol (string #\"))) "\"")
(test (symbol->string 'quote) "quote")
(test (symbol->string if) 'error)
(test (symbol->string quote) 'error)

(test (symbol? (string->symbol "0")) #t)
(test (symbol? (symbol "0")) #t)
(test (symbol? (symbol ".")) #t) ; hmmm
(test (let () (define |.| 1) (+ |.| 2)) 3)
(test (string->symbol "0e") '0e)
(test (string->symbol "1+") '1+)
(test (symbol? (string->symbol "1+i")) #t)
(test (string->symbol ":0") ':0)
(test (symbol? (string->symbol " hi") ) #t)
(test (symbol? (string->symbol "hi ")) #t)
(test (keyword? (string->symbol ":asdf")) #t)

(test (reinvert 12 string->symbol symbol->string "hiho") "hiho")

(test (symbol->string) 'error)
(test (string->symbol) 'error)
(test (symbol->string 'hi 'ho) 'error)
(test (string->symbol "hi" "ho") 'error)

(test (symbol? (string->symbol (string #\x (integer->char 255) #\x))) #t)
(test (symbol? (string->symbol (string #\x (integer->char 8) #\x))) #t)
(test (symbol? (string->symbol (string #\x (integer->char 128) #\x))) #t)
(test (symbol? (string->symbol (string #\x (integer->char 200) #\x))) #t)
(test (symbol? (string->symbol (string #\x (integer->char 255) #\x))) #t)
(test (symbol? (string->symbol (string #\x (integer->char 20) #\x))) #t)
(test (symbol? (string->symbol (string #\x (integer->char 2) #\x))) #t)
(test (symbol? (string->symbol (string #\x (integer->char 7) #\x))) #t)
(test (symbol? (string->symbol (string #\x (integer->char 17) #\x))) #t)
(test (symbol? (string->symbol (string #\x (integer->char 170) #\x))) #t)
(test (symbol? (string->symbol (string #\x (integer->char 0) #\x))) #t)       ; but the symbol's name here is "x"
;(test (eq? (string->symbol (string #\x (integer->char 0) #\x)) 'x) #t)        ;   hmmm...
(test (symbol? (string->symbol (string #\x #\y (integer->char 127) #\z))) #t) ; xy(backspace)z

(test (symbol? (string->symbol (string #\; #\" #\)))) #t)
(test (let (((symbol ";")) 3) (symbol ";")) 'error)
(test (symbol "") 'error)

(for-each
 (lambda (arg)
   (test (symbol->string arg) 'error))
 (list #\a 1 "hi" () (list 1) '(1 . 2) #f (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t (if #f #f) (lambda (a) (+ a 1))))

(for-each
 (lambda (arg)
   (test (string->symbol arg) 'error)
   (test (symbol arg) 'error))
 (list #\a 1 () (list 1) '(1 . 2) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))

(for-each
 (lambda (arg)
   (test (symbol? (string->symbol (string arg))) #t)
   (test (symbol? (symbol (string arg))) #t))
 (list #\; #\, #\. #\) #\( #\" #\' #\` #\x33 #\xff #\x7f #\# #\]))

(test (symbol) 'error)
(test (symbol "hi" "ho") 'hiho)

(let ()
  (define-macro (string-case selector . clauses)
    `(case (symbol ,selector)
       ,@(map (lambda (clause)
		(if (pair? (car clause))
		    `(,(map symbol (car clause)) ,@(cdr clause))
		    clause))
	      clauses)))

  (test (let ((str "hi"))
	  (string-case str
            (("hi" "ho") 1 2 3)
	    (("hiho") 2)
	    (else 4)))
	3))

(let ()
  (apply define (list (symbol "(#)") 3))
  (test (eval (symbol "(#)") (curlet)) 3))

(let ()
  (define (immutabl obj) (string->symbol (object->string obj :readable)))
  (define (symbol->object sym) (eval-string (symbol->string sym)))
  (test (symbol->object (immutabl (list 1 2 3))) (list 1 2 3))
  (test (symbol->object (immutabl "hi")) "hi"))

#|
(let ((str "(let ((X 3)) X)"))
  (do ((i 0 (+ i 1)))
      ((= i 256))
    (catch #t
	   (lambda ()
	     (if (symbol? (string->symbol (string (integer->char i))))
		 (catch #t
			(lambda ()
			  (set! (str 7) (integer->char i))
			  (set! (str 13) (integer->char i))
			  (let ((val (eval-string str)))
			    #t)) ;(format #t "ok: ~S -> ~S~%" str val)))
			(lambda args
			  (format #t "bad but symbol: ~S~%" str))))) ; 11 12 # ' , . 
	   (lambda args
	     (format #t "bad: ~C~%" (integer->char i))))))  ; # ( ) ' " . ` nul 9 10 13 space 0..9 ;

(let ((str "(let ((XY 3)) XY)"))
  (do ((i 0 (+ i 1)))
      ((= i 256))
    (do ((k 0 (+ k 1)))
	((= k 256))
      (catch #t
	     (lambda ()
	       (if (symbol? (string->symbol (string (integer->char i))))
		   (catch #t
			  (lambda ()
			    (set! (str 7) (integer->char i))
			    (set! (str 8) (integer->char k))
			    (set! (str 14) (integer->char i))
			    (set! (str 15) (integer->char k))
			    (let ((val (eval-string str)))
			      #t)) ;(format #t "ok: ~S -> ~S~%" str val)))
			  (lambda args
			    (format #t "bad but symbol: ~S~%" str))))) ; 11 12 # ' , . 
	     (lambda args
	       (format #t "bad: ~C~%" (integer->char i)))))))  ; # ( ) ' " . ` nul 9 10 13 space 0..9 ;
|#




;;; --------------------------------------------------------------------------------
;;; symbol->value
;;; symbol->dynamic-value

(let ((sym 0))
  (test (symbol->value 'sym) 0)
  (test (symbol->dynamic-value 'sym) 0)
  (for-each
   (lambda (arg)
     (set! sym arg)
     (test (symbol->value 'sym) arg)
     (test (symbol->dynamic-value 'sym) arg))
   (list #\a 1 () (list 1) '(1 . 2) #f (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand (log 0) 
	 3.14 3/4 1.0+1.0i #t (if #f #f) #<eof> (lambda (a) (+ a 1)))))

(for-each
 (lambda (arg)
   (test (symbol->value arg) 'error)
   (test (symbol->value 'abs arg) 'error)
   (test (symbol->dynamic-value arg) 'error)
   (test (symbol->dynamic-value 'abs arg) 'error))
 (list #\a 1 () (list 1) "hi" '(1 . 2) #f (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t (if #f #f) #<eof> (lambda (a) (+ a 1))))
  
(test (symbol->value) 'error)
(test (symbol->value 'hi 'ho) 'error)
(test (symbol->dynamic-value) 'error)
(test (symbol->dynamic-value 'hi 'ho) 'error)

(test (symbol->value 'abs (unlet)) abs)
(test (symbol->value 'abs (rootlet)) abs)
(test (symbol->value 'lambda) lambda)
(test (symbol->value 'do) do)
(test (symbol->value do) 'error)
(test (symbol->value 'macroexpand) macroexpand)
(test (symbol->value 'quasiquote) quasiquote)
(test (symbol->value 'else) else)
(test (symbol->value :hi) :hi)
(test (symbol->value hi:) hi:)

(test (symbol->dynamic-value 'lambda) lambda)
(test (symbol->dynamic-value 'do) do)
(test (symbol->dynamic-value do) 'error)
(test (symbol->dynamic-value 'macroexpand) macroexpand)
(test (symbol->dynamic-value 'quasiquote) quasiquote)
(test (symbol->dynamic-value 'else) else)
(test (symbol->dynamic-value :hi) :hi)
(test (symbol->dynamic-value hi:) hi:)

(test (symbol->value '#<eof>) 'error) ; because it's not a symbol:
(test (symbol? '#<eof>) #f)
(test (let ((a1 32)) (let () (symbol->value 'a1 (curlet)))) 32)
(test (let ((a1 32)) (let ((a1 0)) (symbol->value 'a1 (curlet)))) 0)
(test (let ((a1 32)) (let ((a1 0)) (symbol->value 'b1 (curlet)))) #<undefined>)
(test (symbol->value 'abs ()) 'error)
(test (let ((a1 (let ((b1 32)) (lambda () b1)))) (symbol->value 'b1 (funclet a1))) 32)
(test (let ((x #f)) (set! x (let ((a1 (let ((b1 32)) (lambda () b1)))) a1)) (symbol->value 'b1 (funclet x))) 32)
(test (symbol->value 'if) if)
(test (symbol->value if) 'error)
(test ((define (hi a) (+ a 1)) 2) 3)
(test ((define-macro (hi a) `(+ ,a 1)) 2) 3)
(test (let ((mac (define-macro (hi a) `(+ ,a 1)))) (mac 3)) 4)

(test (eq? #_abs (symbol->value 'abs 'unlet)) #t)
(test (eq? #_lambda (symbol->value 'lambda 'unlet)) #t)
(test (let ((b 2)) (let ((e (curlet))) (let ((a 1)) (symbol->value 'a e)))) #<undefined>)
(test (let ((a 2)) (let ((e (curlet))) (let ((a 1)) (symbol->value 'a e)))) 2)
(test (let ((a 2)) (let ((e (curlet))) (let ((a 1)) (symbol->value 'a)))) 1)

(let ()
  (define *ds* 0)
  (define (get-ds) (list *ds* (symbol->dynamic-value '*ds*)))
  (test (get-ds) '(0 0))
  (let ((*ds* 32))
    (test (values (get-ds)) '(0 32)))
  (let ((*ds* 3))
    (define (gds) (list *ds* (symbol->dynamic-value '*ds*)))
    (test (list (get-ds) (gds)) '((0 3) (3 3)))
    (let ((*ds* 123)) 
      (test (list (get-ds) (gds)) '((0 123) (3 123)))))
  (let ((*ds* 3))
    (define (gds) (list *ds* (symbol->dynamic-value '*ds*)))
    (let ((*ds* 123)) 
      (set! *ds* 321)
      (test (list (get-ds) (gds)) '((0 321) (3 321))))))

(test (symbol->dynamic-value 'asdasfasdasfg) #<undefined>)

(let ((x 32))
  (define (gx) (symbol->dynamic-value 'x))
  (let ((x 12))
    (test (values (gx)) 12)))

(let ((x "hi")
      (y 0)
      (z '(1 2 3)))
  (define (gx) (+ (symbol->dynamic-value 'x) (symbol->dynamic-value 'z)))
  (let ((x 32) 
	(z (+ 123 (car z))))
    (test (values (gx)) 156)))

(let ((x 32))
  (define (gx) (symbol->dynamic-value 'x))
  (let ((x 100))
    (let ((x 12))
      (test (values (gx)) 12))))

(let ((x 32))
  (define (gx) ; return both bindings of 'x
    (list x (symbol->value 'x) (symbol->dynamic-value 'x)))
  (let ((x 100))
    (let ((x 12))
      (test (values (gx)) '(32 32 12)))))

(let ((bindings ()))
  ;; taken from the MIT_Scheme documentation (changing fluid-let to let)

  (define (write-line v) 
    (set! bindings (cons v bindings)))

  (define (complicated-dynamic-binding)
    (let ((variable 1)
	  (inside-continuation #f))
      (write-line variable)
      (call-with-current-continuation
       (lambda (outside-continuation)
	 (let ((variable 2))
	   (write-line variable)
	   (set! variable 3)
	   (call-with-current-continuation
	    (lambda (k)
	      (set! inside-continuation k)
	      (outside-continuation #t)))
	   (write-line variable)
	   (set! inside-continuation #f))))
      (write-line variable)
      (if inside-continuation
	  (begin
	    (set! variable 4)
	    (inside-continuation #f)))))

  (complicated-dynamic-binding)
  (test (reverse bindings) '(1 2 1 3 4)))

;;; (define (func x) (call-with-output-file "/dev/null" (symbol->dynamic-value __func__)))
;;;    gets either stack overflow or error: open-output-file: Too many open files "/dev/null"
;;;    because (symbol->dynamic-value __func__) is the calling function (func) so we have 
;;;    an infinite recursion.


;;; --------------------------------------------------------------------------------
;;; BYTE-VECTORS
;;; --------------------------------------------------------------------------------

(let ((bv #u8(1 0 3)))
  (test bv #u8(1 0 3))
  (test (object->string bv) "#u8(1 0 3)")
  (test (equal? bv #u8(1 0 3)) #t)
  (test (eq? bv bv) #t)
  (test (eqv? bv bv) #t)
  (test (equal? (byte-vector 1 0 3) #u8(1 0 3)) #t)
  (test (byte-vector? bv) #t)
  (test (equal? (make-byte-vector 3) #u8(0 0 0)) #t)
  (test (string-ref #u8(64 65 66) 1) #\A)
  (test (byte-vector-ref #u8(64 65 66) 1) 65)
  (test (let ((nbv (copy bv))) (equal? nbv bv)) #t)
  (test (let ((rbv (reverse bv))) (equal? rbv #u8(3 0 1))) #t)
  (test (length bv) 3)
  )

(test (eval-string "#u8(-1)") 'error)
(test (eval-string "#u8(1.0)") 'error)
(test (eval-string "#u8(3/2)") 'error)
(test (eval-string "#u8(1+i)") 'error)
(test (eval-string "#u8((32))") 'error)
(test (eval-string "#u8(#\\a)") 'error)
(test (eval-string "#u8(256)") 'error)
(test (eval-string "#u8(1/0)") 'error)
(test (eval-string "#u8(9223372036854775807)") 'error)
(test (eval-string "#u8(-9223372036854775808)") 'error)
(test #u8(#b11 #x8) #u8(3 8))
(test (eval-string "#u8(1 2 . 3)") 'error)

(test #u8(255) (byte-vector 255))
(test (byte-vector 256) 'error)
(test (byte-vector -1) 'error)
(test (object->string #u8()) "#u8()")
(test (object->string #u8(255)) "#u8(255)")
(test (object->string #u8(255 255)) "#u8(255 255)")
(test (object->string #u8(128)) "#u8(128)")
(test (object->string #u8(128 128)) "#u8(128 128)")

(test (length #u8(0)) 1)
(test (length #u8(0 0)) 2)
(test (length #u8()) 0)
(test (length (byte-vector)) 0)
(test (byte-vector? #u8()) #t)
(test (equal? (let ((bv #u8(1 0 3))) (set! (bv 2) 64) bv) #u8(1 0 64)) #t)
(test (let ((bv #u8(1 0 3))) (map values bv)) '(1 0 3))
(test (let ((bv #u8(1 0 3)) (lst ())) (for-each (lambda (x) (set! lst (cons x lst))) bv) lst) '(3 0 1))
(test (let ((bv #u8(1 2 3))) (bv 1)) 2)
(test (let ((bv #u8(1 2 3))) (reverse bv)) #u8(3 2 1))
(test (let ((bv #u8(1 2 3))) (object->string (reverse bv))) "#u8(3 2 1)")
(test (let ((bv #u8(1 2 3))) (copy bv)) #u8(1 2 3))
(test (#u8(1 2 3) 2) 3)
(test (let ((v #u8(0 1 2))) (let ((v1 (reverse! v))) (eq? v v1))) #t)
(test (let ((v #u8(0 1 2))) (reverse! v)) #u8(2 1 0))
;; should (vector? #u8(1 2)) be #t?
(test (format #f "~{~A ~}" (byte-vector 255 0)) "255 0 ")

;;; string->byte-vector -- why is this needed? -- why not use copy instead?
(test (byte-vector? (string->byte-vector (string #\0))) #t)
(test (byte-vector? (string->byte-vector "")) #t)
(test (byte-vector? (string->byte-vector "1230")) #t)
(test (byte-vector? (string->byte-vector (string->byte-vector (string #\0)))) #t)
(test (byte-vector? (string->byte-vector (string))) #t)
(test (byte-vector? (string->byte-vector #u8(1 2))) #t)
(test (byte-vector? (string->byte-vector #u8())) #t)
(test (byte-vector? (string->byte-vector #(1 2))) 'error)
(test (byte-vector? (string-append #u8(1 2) #u8(3 4))) #t)
(for-each
 (lambda (arg)
   (test (string->byte-vector arg) 'error)
   (test (byte-vector? arg) #f))
 (list #\a () (list 1)  '(1 . 2) #f (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t (if #f #f) #<eof> (lambda (a) (+ a 1))))

(test (string->byte-vector #x010203) 'error)
(test (string->byte-vector (immutable! "123")) 'error)

(test (let ((str "123")) (string->byte-vector str) (byte-vector? str)) #t) ;??
(test (let ((str (string #\a))) (string->byte-vector str) (byte-vector? str)) #t) ;??

;;; make-byte-vector
(test (equal? (make-byte-vector 0) #u8()) #t)
(test (equal? (make-byte-vector 0 32) #u8()) #t)
(test (equal? (make-byte-vector 1 32) #u8(32)) #t)
(test (make-byte-vector 0 -32) 'error)
(test (make-byte-vector 1 -32) 'error)
(test (make-byte-vector 1 256) 'error)
(for-each
 (lambda (arg)
   (test (make-byte-vector arg) 'error)
   (test (make-byte-vector 1 arg) 'error))
 (list #\a () (list 1)  '(1 . 2) #f (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t (if #f #f) #<eof> (lambda (a) (+ a 1))))


;;; byte-vector
(test (byte-vector) #u8())
(test (byte-vector 32) (make-byte-vector 1 32))
(test (byte-vector 0 256) 'error)
(test (byte-vector -1) 'error)
(for-each
 (lambda (arg)
   (test (byte-vector arg) 'error))
 (list #\a () (list 1)  '(1 . 2) #f (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t (if #f #f) #<eof> (lambda (a) (+ a 1))))

(test (map append #u8(0 1 2)) '(0 1 2))
(test (format #f "~{#x~X~| ~}" #u8(49 50 51)) "#x31 #x32 #x33")
(test (format #f "~{~D~| ~}" (string->byte-vector "abcd")) "97 98 99 100")
(test (let ((lst ())) (for-each (lambda (c) (set! lst (cons c lst))) #u8(90 91 92)) (reverse lst)) '(90 91 92))
(test (integer? (#u8(1 2 3) 0)) #t)
(test (integer? ((string->byte-vector "abc") 1)) #t)

(test ((vector (byte-vector 1)) 0 0) 1) ; i.e. not a character

(let ((bv (byte-vector 0 1 2 3)))
  (fill! bv 4)
  (test bv #u8(4 4 4 4))
  (fill! bv 1 1 3)
  (test bv #u8(4 1 1 4))
  (let ((bv1 (copy bv)))
    (test bv1 #u8(4 1 1 4))
    (fill! bv 1)
    (copy bv bv1)
    (test bv1 #u8(1 1 1 1))
    (fill! bv 255)
    (copy bv bv1 1 3)
    (test bv1 #u8(255 255 1 1)))) ; copy and fill do not interpret their indices in the same way (one is source, the other destination)

(test (equal? (byte-vector (char->integer #\a)) (string #\a)) #t) ;??
(test (morally-equal? (byte-vector (char->integer #\a)) (string #\a)) #t) ;?

(test (byte-vector? (copy "12")) #f)
(test (byte-vector? (copy #u8(0))) #t)
(test (byte-vector? (reverse (byte-vector 0 1))) #t)
(test (let ((v (byte-vector 0))) (fill! v #\a)) 'error)
(test (let ((v (byte-vector 0))) (fill! v 1) v) #u8(1))
(test (byte-vector? (append #u8(0 1) (byte-vector 2 3))) #t)

;;; should string->byte-vector insist on string (not bv) arg?  similarly for string-ref et al?

;;; byte-vector-ref
;;; byte-vector-set!

(test (let ((str "123")) (byte-vector-ref str 0)) 'error)
(test (let ((str "123")) (byte-vector-set! str 0 1)) 'error)
(test (let ((str "123")) (byte-vector-set! str 0 #\1)) 'error)
(test (let ((str (byte-vector 0 1 2))) (byte-vector-ref str 0)) 0)
(test (let ((str (byte-vector 0 1 2))) (char? (byte-vector-ref str 0))) #f)
(test (let ((str (byte-vector 0 1 2))) (byte-vector-set! str 0 1)) 1)
(test (let ((str (byte-vector 0 1 2))) (byte-vector-set! str 0 #\1)) 'error)
(test (byte-vector-ref #u8(0 1 2)) 'error)
(test (byte-vector-ref) 'error)
(test (byte-vector-ref #u8(0 1 2) 1 1) 'error)
(test (byte-vector-ref #u8(0 1 2) -1) 'error)
(test (byte-vector-set! #u8(0 1 2)) 'error)
(test (byte-vector-set! #u8(0 1 2) 0) 'error)
(test (byte-vector-set!) 'error)
(test (byte-vector-set! #u8(0 1 2) 1 1 2) 'error)
(test (byte-vector-set! #u8(0 1 2) -1 1) 'error)

(for-each
 (lambda (arg)
   (test (byte-vector-ref arg 0) 'error)
   (test (byte-vector-set! arg 0 0) 'error)
   (test (byte-vector-ref #u8(0 1 2) arg) 'error)
   (test (byte-vector-set! #u8(0 1 2) arg 0) 'error)
   (test (byte-vector-set! #u8(0 1 2) 0 arg) 'error)
   (test (let ((v #u8(0 1 2))) (v arg)) 'error)
   (test (let ((v #u8(0 1 2))) (set! (v arg) 0)) 'error))
 (list #\a () (list 1) "str" "" '(1 . 2) #f (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t (if #f #f) #<eof> (lambda (a) (+ a 1))))

(test (let ((v #u8(0 1 2))) (v 1)) 1)
(test (let ((v (byte-vector 0 1 2))) (set! (v 1) 3) v) #u8(0 3 2))

(test (let ((bv (byte-vector #\1))) bv) 'error)
(test (let ((bv (string 1))) bv) 'error)
(let ((bv #u8(0 1))) (test (string->byte-vector bv) bv))
(test (let ((bv (byte-vector 1))) (define (f) (do ((i 0 (+ i 1))) ((= i 1)) (byte-vector-set! bv 0 #\1))) (f)) 'error)
(test (let ((bc #u8(0 1))) (set! (bc 0) #\1)) 'error)
(test (let ((bc #u8(0 1))) (byte-vector-set! bc 0 #\1)) 'error)
(test (let ((bc #u8(0 1))) (string-set! bc 0 #\1)) 'error)
(test (let ((bc "123")) (set! (bc 0) 1)) 'error)
(test (let ((bc "123")) (string-set! bc 0 1)) 'error)
(test (let ((bc "123")) (byte-vector-set! bc 0 1)) 'error)
(test (let ((bv (byte-vector 1))) (define (f) (do ((i 0 (+ i 1))) ((= i 1)) (set! (bv 0) #\1))) (f)) 'error)
(test (let ((bv (string #\1))) (define (f) (do ((i 0 (+ i 1))) ((= i 1)) (set! (bv 0) 1))) (f)) 'error)
(test (let ((bv (string #\1))) (define (f) (do ((i 0 (+ i 1))) ((= i 1)) (string-set! bv 0 1))) (f)) 'error)
(test (let () (define (hi) (do ((i 0 (+ i 1))) ((= i 1)) (char-alphabetic? (string-ref #u8(0 1) 1)))) (hi)) #t)


;;; --------------------------------------------------------------------------------
;;; LISTS
;;; --------------------------------------------------------------------------------


;;; --------------------------------------------------------------------------------
;;; cons

(test (cons 'a ()) '(a))
(test (cons '(a) '(b c d)) '((a) b c d))
(test (cons "a" '(b c)) '("a" b c))
(test (cons 'a 3) '(a . 3))
(test (cons '(a b) 'c) '((a b) . c))
(test (cons () ()) '(()))
(test (cons () 1) '(() . 1))
(test (cons 1 2) '(1 . 2))
(test (cons 1 ()) '(1))
(test (cons () 2) '(() . 2))
(test (cons 1 (cons 2 (cons 3 (cons 4 ())))) '(1 2 3 4))
(test (cons 'a 'b) '(a . b))
(test (cons 'a (cons 'b (cons 'c ()))) '(a b c))
(test (cons 'a (list 'b 'c 'd)) '(a b c d))
(test (cons 'a (cons 'b (cons 'c 'd))) '(a b c . d))
(test '(a b c d e) '(a . (b . (c . (d . (e . ()))))))
(test (cons (cons 1 2) (cons 3 4)) '((1 . 2) 3 . 4))
(test (list (cons 1 2) (cons 3 4)) '((1 . 2) (3 . 4)))
(test (cons (cons 1 (cons 2 3)) 4) '((1 . (2 . 3)) . 4))
(test (cons (cons 1 (cons 2 ())) (cons 1 2)) '((1 2) . (1 . 2)))
(test (let ((lst (list 1 2))) (list (apply cons lst) lst)) '((1 . 2) (1 2)))
(test (let ((lst (list 1 2))) (list lst (apply cons lst))) '((1 2) (1 . 2)))
(test (cdadr (let ((lst (list 1 2))) (list (apply cons lst) lst))) '(2))
(test (cons '+ '=) '(+ . =))
(test (cons .(cadddr 10)) (cons cadddr 10))
(test (cons 1 ()) '(
                      1
		       ))



;;; --------------------------------------------------------------------------------
;;; car

(test (car (list 1 2 3)) 1)
(test (car (cons 1 2)) 1)
(test (car (list 1)) 1)
(test (car '(1 2 3)) 1)
(test (car '(1)) 1)
(test (car '(1 . 2)) 1)
(test (car '((1 2) 3)) '(1 2))
(test (car '(((1 . 2) . 3) 4)) '((1 . 2) . 3))
(test (car (list (list) (list 1 2))) ())
(test (car '(a b c)) 'a)
(test (car '((a) b c d)) '(a))
(test (car (reverse (list 1 2 3 4))) 4)
(test (car (list 'a 'b 'c 'd 'e 'f 'g)) 'a)
(test (car '(a b c d e f g)) 'a)
(test (car '(((((1 2 3) 4) 5) (6 7)) (((u v w) x) y) ((q w e) r) (a b c) e f g)) '((((1 2 3) 4) 5) (6 7)))
(test (car '(a)) 'a)
(test (car '(1 ^ 2)) 1)
(test (car '(1 .. 2)) 1)
(test (car ''foo) 'quote)
(test (car '(1 2 . 3)) 1)
(test (car (cons 1 ())) 1)
(test (car (if #f #f)) 'error)
(test (car ()) 'error)
(test (car #(1 2)) 'error)
(test (car #(1 2)) 'error)

(for-each
 (lambda (arg)
   (if (not (equal? (car (cons arg ())) arg))
       (format #t ";(car '(~A)) returned ~A?~%" arg (car (cons arg ()))))
   (test (car arg) 'error))
 (list "hi" (integer->char 65) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand (log 0) 
       3.14 3/4 1.0+1.0i #\f #t :hi (if #f #f) (lambda (a) (+ a 1))))

(test (reinvert 12 car (lambda (a) (cons a ())) '(1)) '(1))



;;; --------------------------------------------------------------------------------
;;; cdr

(test (cdr (list 1 2 3)) '(2 3))
(test (cdr (cons 1 2)) 2)
(test (cdr (list 1)) ())
(test (cdr '(1 2 3)) '(2 3))
(test (cdr '(1)) ())
(test (cdr '(1 . 2)) 2)
(test (cdr '((1 2) 3)) '(3))
(test (cdr '(((1 . 2) . 3) 4)) '(4))
(test (cdr (list (list) (list 1 2))) '((1 2)))
(test (cdr '(a b c)) '(b c))
(test (cdr '((a) b c d)) '(b c d))
(test (equal? (cdr (reverse (list 1 2 3 4))) 4) #f)
(test (equal? (cdr (list 'a 'b 'c 'd 'e 'f 'g)) 'a) #f)
(test (cdr '((((((1 2 3) 4) 5) (6 7)) (((u v w) x) y) ((q w e) r) (a b c) e f) g)) '(g))
(test (cdr '(a)) ())
(test (cdr '(a b c d e f g)) '(b c d e f g))
(test (cdr '(((((1 2 3) 4) 5) (6 7)) (((u v w) x) y) ((q w e) r) (a b c) e f g)) '((((u v w) x) y) ((q w e) r) (a b c) e f g))
(test (cdr ''foo) '(foo))
(test (cdr (cons (cons 1 2) (cons 3 4))) '(3 . 4))
(test (cdr '(1 2 . 3)) '(2 . 3))
(test (cdr (if #f #f)) 'error)
(test (cdr ()) 'error)

(for-each
 (lambda (arg)
   (if (not (equal? (cdr (cons () arg)) arg))
       (format #t ";(cdr '(() ~A) -> ~A?~%" arg (cdr (cons () arg))))
   (test (cdr arg) 'error))
 (list "hi" (integer->char 65) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand (log 0) 
       3.14 3/4 1.0+1.0i #\f #t :hi (if #f #f) (lambda (a) (+ a 1))))

(let* ((a (list 1 2 3))
       (b a))
  (set! (car a) (cadr a)) 
  (set! (cdr a) (cddr a))
  (test a (list 2 3))
  (test b a))

(define (cons-r a b n) (if (= 0 n) (cons a b) (cons (cons-r (+ a 1) (+ b 1) (- n 1)) (cons-r (- a 1) (- b 1) (- n 1)))))
(define (list-r a b n) (if (= 0 n) (list a b) (list (list-r (+ a 1) (+ b 1) (- n 1)) (list-r (- a 1) (- b 1) (- n 1)))))

(define lists (list (list 1 2 3)
		    (cons 1 2)
		    (list 1)
		    (list)
		    (list (list 1 2) (list 3 4))
		    (list (list 1 2) 3)
		    '(1 . 2)
		    '(a b c)
		    '((a) b (c))
		    '((1 2) (3 4))
		    '((1 2 3) (4 5 6) (7 8 9))
		    '(((1) (2) (3)) ((4) (5) (6)) ((7) (8) (9)))
		    '((((1 123) (2 124) (3 125) (4 126)) ((5) (6) (7) (8)) ((9) (10) (11) (12)) ((13) (14) (15) (16)))
		      (((21 127) (22 128) (23 129) (24 130)) ((25) (26) (27) (28)) ((29) (30) (31) (32)) ((33) (34) (35) (36)))
		      (((41 131) (42 132) (43 133) (44 134)) ((45) (46) (47) (48)) ((49) (50) (51) (52)) ((53) (54) (55) (56)))
		      (((61 135) (62 136) (63 137) (64 138)) ((65) (66) (67) (68)) ((69) (70) (71) (72)) ((73) (74) (75) (76)))
		      321)
		    (cons 1 (cons 2 (cons 3 4)))
		    (cons (cons 2 (cons 3 4)) 5)
		    (cons () 1)
		    (cons 1 ())
		    (cons () ())
		    (list 1 2 (cons 3 4) 5 (list (list 6) 7))
		    (cons-r 0 0 4)
		    (cons-r 0 0 5)
		    (cons-r 0 0 10)
		    (list-r 0 0 3)
		    (list-r 0 0 7)
		    (list-r 0 0 11)
		    ''a
		    ))


;;; --------------------------------------------------------------------------------
;;; cxr

(define (caar-1 x) (car (car x)))
(define (cadr-1 x) (car (cdr x)))
(define (cdar-1 x) (cdr (car x)))
(define (cddr-1 x) (cdr (cdr x)))
(define (caaar-1 x) (car (car (car x))))
(define (caadr-1 x) (car (car (cdr x))))
(define (cadar-1 x) (car (cdr (car x))))
(define (caddr-1 x) (car (cdr (cdr x))))
(define (cdaar-1 x) (cdr (car (car x))))
(define (cdadr-1 x) (cdr (car (cdr x))))
(define (cddar-1 x) (cdr (cdr (car x))))
(define (cdddr-1 x) (cdr (cdr (cdr x))))
(define (caaaar-1 x) (car (car (car (car x)))))
(define (caaadr-1 x) (car (car (car (cdr x)))))
(define (caadar-1 x) (car (car (cdr (car x)))))
(define (caaddr-1 x) (car (car (cdr (cdr x)))))
(define (cadaar-1 x) (car (cdr (car (car x)))))
(define (cadadr-1 x) (car (cdr (car (cdr x)))))
(define (caddar-1 x) (car (cdr (cdr (car x)))))
(define (cadddr-1 x) (car (cdr (cdr (cdr x)))))
(define (cdaaar-1 x) (cdr (car (car (car x)))))
(define (cdaadr-1 x) (cdr (car (car (cdr x)))))
(define (cdadar-1 x) (cdr (car (cdr (car x)))))
(define (cdaddr-1 x) (cdr (car (cdr (cdr x)))))
(define (cddaar-1 x) (cdr (cdr (car (car x)))))
(define (cddadr-1 x) (cdr (cdr (car (cdr x)))))
(define (cdddar-1 x) (cdr (cdr (cdr (car x)))))
(define (cddddr-1 x) (cdr (cdr (cdr (cdr x)))))

(for-each
 (lambda (name op1 op2)
   (for-each
    (lambda (lst)
      (let ((val1 (catch #t (lambda () (op1 lst)) (lambda args 'error)))
	    (val2 (catch #t (lambda () (op2 lst)) (lambda args 'error))))
	(if (not (equal? val1 val2))
	    (format #t ";(~A ~S) -> ~S, (~A-1): ~S?~%" name lst val1 name val2))))
    lists))
 (list 'caar 'cadr 'cdar 'cddr 'caaar 'caadr 'cadar 'cdaar 'caddr 'cdddr 'cdadr 'cddar 
       'caaaar 'caaadr 'caadar 'cadaar 'caaddr 'cadddr 'cadadr 'caddar 'cdaaar 
       'cdaadr 'cdadar 'cddaar 'cdaddr 'cddddr 'cddadr 'cdddar)
 
 (list caar cadr cdar cddr caaar caadr cadar cdaar caddr cdddr cdadr cddar 
       caaaar caaadr caadar cadaar caaddr cadddr cadadr caddar cdaaar 
       cdaadr cdadar cddaar cdaddr cddddr cddadr cdddar)
 
 (list caar-1 cadr-1 cdar-1 cddr-1 caaar-1 caadr-1 cadar-1 cdaar-1 caddr-1 cdddr-1 cdadr-1 cddar-1 
       caaaar-1 caaadr-1 caadar-1 cadaar-1 caaddr-1 cadddr-1 cadadr-1 caddar-1 cdaaar-1 
       cdaadr-1 cdadar-1 cddaar-1 cdaddr-1 cddddr-1 cddadr-1 cdddar-1))



(test (equal? (cadr (list 'a 'b 'c 'd 'e 'f 'g)) 'b) #t)
(test (equal? (cddr (list 'a 'b 'c 'd 'e 'f 'g)) '(c d e f g)) #t)
(test (equal? (caddr (list 'a 'b 'c 'd 'e 'f 'g)) 'c) #t)
(test (equal? (cdddr (list 'a 'b 'c 'd 'e 'f 'g)) '(d e f g)) #t)
(test (equal? (cadddr (list 'a 'b 'c 'd 'e 'f 'g)) 'd) #t)
(test (equal? (cddddr (list 'a 'b 'c 'd 'e 'f 'g)) '(e f g)) #t)
(test (equal? (caadr (list (list (list (list (list 1 2 3) 4) 5) (list 6 7)) (list (list (list 'u 'v 'w) 'x) 'y) (list (list 'q 'w 'e) 'r) (list 'a 'b 'c) 'e 'f 'g)) '((u v w) x)) #t)
(test (equal? (cadar (list (list (list (list (list 1 2 3) 4) 5) (list 6 7)) (list (list (list 'u 'v 'w) 'x) 'y) (list (list 'q 'w 'e) 'r) (list 'a 'b 'c) 'e 'f 'g)) '(6 7)) #t)
(test (equal? (cdaar (list (list (list (list (list 1 2 3) 4) 5) (list 6 7)) (list (list (list 'u 'v 'w) 'x) 'y) (list (list 'q 'w 'e) 'r) (list 'a 'b 'c) 'e 'f 'g)) '(5)) #t)
(test (equal? (cdadr (list (list (list (list (list 1 2 3) 4) 5) (list 6 7)) (list (list (list 'u 'v 'w) 'x) 'y) (list (list 'q 'w 'e) 'r) (list 'a 'b 'c) 'e 'f 'g)) '(y)) #t)
(test (equal? (cddar (list (list (list (list (list 1 2 3) 4) 5) (list 6 7)) (list (list (list 'u 'v 'w) 'x) 'y) (list (list 'q 'w 'e) 'r) (list 'a 'b 'c) 'e 'f 'g)) ()) #t)
(test (equal? (caaaar (list (list (list (list (list 1 2 3) 4) 5) (list 6 7)) (list (list (list 'u 'v 'w) 'x) 'y) (list (list 'q 'w 'e) 'r) (list 'a 'b 'c) 'e 'f 'g)) '(1 2 3)) #t)
(test (equal? (caadar (list (list (list (list (list 1 2 3) 4) 5) (list 6 7)) (list (list (list 'u 'v 'w) 'x) 'y) (list (list 'q 'w 'e) 'r) (list 'a 'b 'c) 'e 'f 'g)) 6) #t)
(test (equal? (caaddr (list (list (list (list (list 1 2 3) 4) 5) (list 6 7)) (list (list (list 'u 'v 'w) 'x) 'y) (list (list 'q 'w 'e) 'r) (list 'a 'b 'c) 'e 'f 'g)) '(q w e)) #t)
(test (equal? (cadaar (list (list (list (list (list 1 2 3) 4) 5) (list 6 7)) (list (list (list 'u 'v 'w) 'x) 'y) (list (list 'q 'w 'e) 'r) (list 'a 'b 'c) 'e 'f 'g)) 5) #t)
(test (equal? (cadadr (list (list (list (list (list 1 2 3) 4) 5) (list 6 7)) (list (list (list 'u 'v 'w) 'x) 'y) (list (list 'q 'w 'e) 'r) (list 'a 'b 'c) 'e 'f 'g)) 'y) #t)
(test (equal? (caddar (list (list (list (list (list 1 2 3) 4) 5) 1 6 (list 5 7)) (list (list (list 'u 'v 'w) 'x) 'y) (list (list 'q 'w 'e) 'r) (list 'a 'b 'c) 'e 'f 'g)) 6) #t)
(test (equal? (cadddr (list (list (list (list (list 1 2 3) 4) 5) (list 6 7)) (list (list (list 'u 'v 'w) 'x) 'y) (list (list 'q 'w 'e) 'r) (list 'a 'b 'c) 'e 'f 'g)) '(a b c)) #t)
(test (equal? (cdaaar (list (list (list (list (list 1 2 3) 4) 5) (list 6 7)) (list (list (list 'u 'v 'w) 'x) 'y) (list (list 'q 'w 'e) 'r) (list 'a 'b 'c) 'e 'f 'g)) '(4)) #t)
(test (equal? (cdaadr (list (list (list (list (list 1 2 3) 4) 5) (list 6 7)) (list (list (list 'u 'v 'w) 'x) 'y) (list (list 'q 'w 'e) 'r) (list 'a 'b 'c) 'e 'f 'g)) '(x)) #t)
(test (equal? (cdadar (list (list (list (list (list 1 2 3) 4) 5) (list 6 7)) (list (list (list 'u 'v 'w) 'x) 'y) (list (list 'q 'w 'e) 'r) (list 'a 'b 'c) 'e 'f 'g)) '(7)) #t)

(test (caar '((a) b c d e f g)) 'a)
(test (cadr '(a b c d e f g)) 'b)
(test (cdar '((a b) c d e f g)) '(b))
(test (cddr '(a b c d e f g)) '(c d e f g))
(test (caaar '(((a)) b c d e f g)) 'a)
(test (caadr '(a (b) c d e f g)) 'b)
(test (cadar '((a b) c d e f g)) 'b)
(test (caddr '(a b c d e f g)) 'c)
(test (cdaar '(((a b)) c d e f g)) '(b))
(test (cdadr '(a (b c) d e f g)) '(c))
(test (cddar '((a b c) d e f g)) '(c))
(test (cdddr '(a b c d e f g)) '(d e f g))
(test (caaaar '((((a))) b c d e f g)) 'a)
(test (caaadr '(a ((b)) c d e f g)) 'b)
(test (caadar '((a (b)) c d e f g)) 'b)
(test (caaddr '(a b (c) d e f g)) 'c)
(test (cadaar '(((a b)) c d e f g)) 'b)
(test (cadadr '(a (b c) d e f g)) 'c)
(test (caddar '((a b c) d e f g)) 'c)
(test (cadddr '(a b c d e f g)) 'd)
(test (cdaaar '((((a b))) c d e f g)) '(b))
(test (cdaadr '(a ((b c)) d e f g)) '(c))
(test (cdadar '((a (b c)) d e f g)) '(c))
(test (cdaddr '(a b (c d) e f g)) '(d))
(test (cddaar '(((a b c)) d e f g)) '(c))
(test (cddadr '(a (b c d) e f g)) '(d))
(test (cdddar '((a b c d) e f g)) '(d))
(test (cddddr '(a b c d e f g)) '(e f g))
(test (cadr '(1 2 . 3)) 2)
(test (cddr '(1 2 . 3)) 3)
(test (cadadr '''1) 1)
(test (cdadr '''1) '(1))

;; sacla
(test (caar '((a) b c)) 'a)
(test (cadr '(a b c)) 'b)
(test (cdar '((a . aa) b c)) 'aa)
(test (cddr '(a b . c)) 'c)
(test (caaar '(((a)) b c)) 'a)
(test (caadr '(a (b) c)) 'b)
(test (cadar '((a aa) b c)) 'aa)
(test (caddr '(a b c)) 'c)
(test (cdaar '(((a . aa)) b c)) 'aa)
(test (cdadr '(a (b . bb) c)) 'bb)
(test (cddar '((a aa . aaa) b c)) 'aaa)
(test (cdddr '(a b c . d)) 'd)
(test (caaaar '((((a))) b c)) 'a)
(test (caaadr '(a ((b)) c)) 'b)
(test (caadar '((a (aa)) b c)) 'aa)
(test (caaddr '(a b (c))) 'c)
(test (cadaar '(((a aa)) b c)) 'aa)
(test (cadadr '(a (b bb) c)) 'bb)
(test (caddar '((a aa aaa) b c)) 'aaa)
(test (cadddr '(a b c d)) 'd)
(test (cdaaar '((((a . aa))) b c)) 'aa)
(test (cdaadr '(a ((b . bb)) c)) 'bb)
(test (cdadar '((a (aa . aaa)) b c)) 'aaa)
(test (cdaddr '(a b (c . cc))) 'cc)
(test (cddaar '(((a aa . aaa)) b c)) 'aaa)
(test (cddadr '(a (b bb . bbb) c)) 'bbb)
(test (cdddar '((a aa aaa . aaaa) b c)) 'aaaa)
(test (cddddr '(a b c d . e)) 'e)

(test (caar '(((((1 2 3) 4) 5) (6 7)) (((u v w) x) y) ((q w e) r) (a b c) e f g)) '(((1 2 3) 4) 5))
(test (cadr '(((((1 2 3) 4) 5) (6 7)) (((u v w) x) y) ((q w e) r) (a b c) e f g)) '(((u v w) x) y))
(test (cdar '(((((1 2 3) 4) 5) (6 7)) (((u v w) x) y) ((q w e) r) (a b c) e f g)) '((6 7)))
(test (cddr '(((((1 2 3) 4) 5) (6 7)) (((u v w) x) y) ((q w e) r) (a b c) e f g)) '(((q w e) r) (a b c) e f g))
(test (caaar '(((((1 2 3) 4) 5) (6 7)) (((u v w) x) y) ((q w e) r) (a b c) e f g)) '((1 2 3) 4))
(test (caadr '(((((1 2 3) 4) 5) (6 7)) (((u v w) x) y) ((q w e) r) (a b c) e f g)) '((u v w) x))
(test (cadar '(((((1 2 3) 4) 5) (6 7)) (((u v w) x) y) ((q w e) r) (a b c) e f g)) '(6 7))
(test (caddr '(((((1 2 3) 4) 5) (6 7)) (((u v w) x) y) ((q w e) r) (a b c) e f g)) '((q w e) r))
(test (cdaar '(((((1 2 3) 4) 5) (6 7)) (((u v w) x) y) ((q w e) r) (a b c) e f g)) '(5))
(test (cdadr '(((((1 2 3) 4) 5) (6 7)) (((u v w) x) y) ((q w e) r) (a b c) e f g)) '(y))
(test (cddar '(((((1 2 3) 4) 5) (6 7)) (((u v w) x) y) ((q w e) r) (a b c) e f g)) ())
(test (cdddr '(((((1 2 3) 4) 5) (6 7)) (((u v w) x) y) ((q w e) r) (a b c) e f g)) '((a b c) e f g))
(test (caaaar '(((((1 2 3) 4) 5) (6 7)) (((u v w) x) y) ((q w e) r) (a b c) e f g)) '(1 2 3))
(test (caaadr '(((((1 2 3) 4) 5) (6 7)) (((u v w) x) y) ((q w e) r) (a b c) e f g)) '(u v w))
(test (caadar '(((((1 2 3) 4) 5) (6 7)) (((u v w) x) y) ((q w e) r) (a b c) e f g)) 6)
(test (caaddr '(((((1 2 3) 4) 5) (6 7)) (((u v w) x) y) ((q w e) r) (a b c) e f g)) '(q w e))
(test (cadaar '(((((1 2 3) 4) 5) (6 7)) (((u v w) x) y) ((q w e) r) (a b c) e f g)) 5)
(test (cadadr '(((((1 2 3) 4) 5) (6 7)) (((u v w) x) y) ((q w e) r) (a b c) e f g)) 'y)
(test (cadddr '(((((1 2 3) 4) 5) (6 7)) (((u v w) x) y) ((q w e) r) (a b c) e f g)) '(a b c))
(test (cdaaar '(((((1 2 3) 4) 5) (6 7)) (((u v w) x) y) ((q w e) r) (a b c) e f g)) '(4))
(test (cdaadr '(((((1 2 3) 4) 5) (6 7)) (((u v w) x) y) ((q w e) r) (a b c) e f g)) '(x))
(test (cdadar '(((((1 2 3) 4) 5) (6 7)) (((u v w) x) y) ((q w e) r) (a b c) e f g)) '(7))
(test (cdaddr '(((((1 2 3) 4) 5) (6 7)) (((u v w) x) y) ((q w e) r) (a b c) e f g)) '(r))
(test (cddaar '(((((1 2 3) 4) 5) (6 7)) (((u v w) x) y) ((q w e) r) (a b c) e f g)) ())
(test (cddadr '(((((1 2 3) 4) 5) (6 7)) (((u v w) x) y) ((q w e) r) (a b c) e f g)) ())
(test (cddddr '(((((1 2 3) 4) 5) (6 7)) (((u v w) x) y) ((q w e) r) (a b c) e f g)) '(e f g))

(test (cadr '(a b c d e f g)) 'b)
(test (cddr '(a b c d e f g)) '(c d e f g))
(test (caddr '(a b c d e f g)) 'c)
(test (cdddr '(a b c d e f g)) '(d e f g))
(test (cadddr '(a b c d e f g)) 'd)
(test (cddddr '(a b c d e f g)) '(e f g))

(test (caar '((((a . b) c . d) (e . f) g . h) ((i . j) k . l) (m . n) o . p)) '((a . b) c . d))
(test (caar '(((a . b) c . d) (e . f) g . h)) '(a . b))
(test (caar '((a . b) c . d)) 'a)
(test (cadr '((((a . b) c . d) (e . f) g . h) ((i . j) k . l) (m . n) o . p)) '((i . j) k . l))
(test (cadr '(((a . b) c . d) (e . f) g . h)) '(e . f))
(test (cadr '((a . b) c . d)) 'c)
(test (cdar '((((a . b) c . d) (e . f) g . h) ((i . j) k . l) (m . n) o . p)) '((e . f) g . h))
(test (cdar '(((a . b) c . d) (e . f) g . h)) '(c . d))
(test (cdar '((a . b) c . d)) 'b)
(test (cddr '((((a . b) c . d) (e . f) g . h) ((i . j) k . l) (m . n) o . p)) '((m . n) o . p))
(test (cddr '(((a . b) c . d) (e . f) g . h)) '(g . h))
(test (cddr '((a . b) c . d)) 'd)
(test (caaar '((((a . b) c . d) (e . f) g . h) ((i . j) k . l) (m . n) o . p)) '(a . b))
(test (caaar '(((a . b) c . d) (e . f) g . h)) 'a)
(test (caadr '((((a . b) c . d) (e . f) g . h) ((i . j) k . l) (m . n) o . p)) '(i . j))
(test (caadr '(((a . b) c . d) (e . f) g . h)) 'e)
(test (cddar '((((a . b) c . d) (e . f) g . h) ((i . j) k . l) (m . n) o . p)) '(g . h))
(test (cddar '(((a . b) c . d) (e . f) g . h)) 'd)
(test (cdddr '((((a . b) c . d) (e . f) g . h) ((i . j) k . l) (m . n) o . p)) '(o . p))
(test (cdddr '(((a . b) c . d) (e . f) g . h)) 'h)
(test (caaaar '((((a . b) c . d) (e . f) g . h) ((i . j) k . l) (m . n) o . p)) 'a)
(test (caaadr '((((a . b) c . d) (e . f) g . h) ((i . j) k . l) (m . n) o . p)) 'i)
(test (caddar '((((a . b) c . d) (e . f) g . h) ((i . j) k . l) (m . n) o . p)) 'g)
(test (cadddr '((((a . b) c . d) (e . f) g . h) ((i . j) k . l) (m . n) o . p)) 'o)
(test (cdaaar '((((a . b) c . d) (e . f) g . h) ((i . j) k . l) (m . n) o . p)) 'b)
(test (cdaadr '((((a . b) c . d) (e . f) g . h) ((i . j) k . l) (m . n) o . p)) 'j)
(test (cdddar '((((a . b) c . d) (e . f) g . h) ((i . j) k . l) (m . n) o . p)) 'h)
(test (cddddr '((((a . b) c . d) (e . f) g . h) ((i . j) k . l) (m . n) o . p)) 'p)

(test (cadr ''foo) 'foo)

(test (caar '((a) b c)) 'a)
(test (cadr '(a b c)) 'b)
(test (cdar '((a . aa) b c)) 'aa)
(test (cddr '(a b . c)) 'c)
(test (caaar '(((a)) b c)) 'a)
(test (caadr '(a (b) c)) 'b)
(test (cadar '((a aa) b c)) 'aa)
(test (caddr '(a b c)) 'c)
(test (cdaar '(((a . aa)) b c)) 'aa)
(test (cdadr '(a (b . bb) c)) 'bb)
(test (cddar '((a aa . aaa) b c)) 'aaa)
(test (cdddr '(a b c . d)) 'd)
(test (caaaar '((((a))) b c)) 'a)
(test (caaadr '(a ((b)) c)) 'b)
(test (caadar '((a (aa)) b c)) 'aa)
(test (caaddr '(a b (c))) 'c)
(test (cadaar '(((a aa)) b c)) 'aa)
(test (cadadr '(a (b bb) c)) 'bb)
(test (caddar '((a aa aaa) b c)) 'aaa)
(test (cadddr '(a b c d)) 'd)
(test (cdaaar '((((a . aa))) b c)) 'aa)
(test (cdaadr '(a ((b . bb)) c)) 'bb)
(test (cdadar '((a (aa . aaa)) b c)) 'aaa)
(test (cdaddr '(a b (c . cc))) 'cc)
(test (cddaar '(((a aa . aaa)) b c)) 'aaa)
(test (cddadr '(a (b bb . bbb) c)) 'bbb)
(test (cdddar '((a aa aaa . aaaa) b c)) 'aaaa)
(test (cddddr '(a b c d . e)) 'e)

(let ((lst '((((A . B) C . D) (E . F) G . H) ((I . J) K . L) (M . N) O . P))) ; from comp.lang.lisp I think
  (test (car lst) '(((A . B) C . D) (E . F) G . H))
  (test (cdr lst) '(((I . J) K . L) (M . N) O . P))
  (test (caar lst) '((A . B) C . D))
  (test (cadr lst) '((I . J) K . L))
  (test (cdar lst) '((E . F) G . H))
  (test (cddr lst) '((M . N) O . P))
  (test (caaar lst) '(A . B))
  (test (caadr lst) '(I . J))
  (test (cadar lst) '(E . F))
  (test (caddr lst) '(M . N))
  (test (cdaar lst) '(C . D))
  (test (cdadr lst) '(K . L))
  (test (cddar lst) '(G . H))
  (test (cdddr lst) '(O . P))
  (test (caaaar lst) 'A)
  (test (caaadr lst) 'I)
  (test (caadar lst) 'E)
  (test (caaddr lst) 'M)
  (test (cadaar lst) 'C)
  (test (cadadr lst) 'K)
  (test (caddar lst) 'G)
  (test (cadddr lst) 'O)
  (test (cdaaar lst) 'B)
  (test (cdaadr lst) 'J)
  (test (cdadar lst) 'F)
  (test (cdaddr lst) 'N)
  (test (cddaar lst) 'D)
  (test (cddadr lst) 'L)
  (test (cdddar lst) 'H)
  (test (cddddr lst) 'P))

(test (recompose 10 cdr '(1 2 3 4 5 6 7 8 9 10 11 12)) '(11 12))
(test (recompose 10 car '(((((((((((1 2 3)))))))))))) '(1 2 3))

(test (cons 1 . 2) 'error)
(test (eval-string "(1 . 2 . 3)") 'error)
(test (car (list)) 'error)
(test (car ()) 'error)
(test (cdr (list)) 'error)
(test (cdr ()) 'error)
(test (caddar '(((((1 2 3) 4) 5) (6 7)) (((u v w) x) y) ((q w e) r) (a b c) e f g)) 'error)
(test (cdddar '(((((1 2 3) 4) 5) (6 7)) (((u v w) x) y) ((q w e) r) (a b c) e f g)) 'error)
(test (caar '(a b c d e f g)) 'error)
(test (cdar '(a b c d e f g)) 'error)
(test (caaar '(a b c d e f g)) 'error)
(test (caadr '(a b c d e f g)) 'error)
(test (cadar '(a b c d e f g)) 'error)
(test (cdaar '(a b c d e f g)) 'error)
(test (cdadr '(a b c d e f g)) 'error)
(test (cddar '(a b c d e f g)) 'error)
(test (caaaar '(a b c d e f g)) 'error)
(test (caaadr '(a b c d e f g)) 'error)
(test (caadar '(a b c d e f g)) 'error)
(test (caaddr '(a b c d e f g)) 'error)
(test (cadaar '(a b c d e f g)) 'error)
(test (cadadr '(a b c d e f g)) 'error)
(test (caddar '(a b c d e f g)) 'error)
(test (cdaaar '(a b c d e f g)) 'error)
(test (cdaadr '(a b c d e f g)) 'error)
(test (cdadar '(a b c d e f g)) 'error)
(test (cdaddr '(a b c d e f g)) 'error)
(test (cddaar '(a b c d e f g)) 'error)
(test (cddadr '(a b c d e f g)) 'error)
(test (cdddar '(a b c d e f g)) 'error)
(test (caar 'a) 'error)
(test (caar '(a)) 'error)
(test (cadr 'a) 'error)
(test (cadr '(a . b)) 'error)
(test (cdar 'a) 'error)
(test (cdar '(a . b)) 'error)
(test (cddr 'a) 'error)
(test (cddr '(a . b)) 'error)
(test (caaar 'a) 'error)
(test (caaar '(a)) 'error)
(test (caaar '((a))) 'error)
(test (caadr 'a) 'error)
(test (caadr '(a . b)) 'error)
(test (caadr '(a b)) 'error)
(test (cadar 'a) 'error)
(test (cadar '(a . b)) 'error)
(test (cadar '((a . c) . b)) 'error)
(test (caddr 'a) 'error)
(test (caddr '(a . b)) 'error)
(test (caddr '(a c . b)) 'error)
(test (cdaar 'a) 'error)
(test (cdaar '(a)) 'error)
(test (cdaar '((a . b))) 'error)
(test (cdadr 'a) 'error)
(test (cdadr '(a . b)) 'error)
(test (cdadr '(a b . c)) 'error)
(test (cddar 'a) 'error)
(test (cddar '(a . b)) 'error)
(test (cddar '((a . b) . b)) 'error)
(test (cdddr 'a) 'error)
(test (cdddr '(a . b)) 'error)
(test (cdddr '(a c . b)) 'error)
(test (caaaar 'a) 'error)
(test (caaaar '(a)) 'error)
(test (caaaar '((a))) 'error)
(test (caaaar '(((a)))) 'error)
(test (caaadr 'a) 'error)
(test (caaadr '(a . b)) 'error)
(test (caaadr '(a b)) 'error)
(test (caaadr '(a (b))) 'error)
(test (caadar 'a) 'error)
(test (caadar '(a . b)) 'error)
(test (caadar '((a . c) . b)) 'error)
(test (caadar '((a c) . b)) 'error)
(test (caaddr 'a) 'error)
(test (caaddr '(a . b)) 'error)
(test (caaddr '(a c . b)) 'error)
(test (caaddr '(a c b)) 'error)
(test (cadaar 'a) 'error)
(test (cadaar '(a)) 'error)
(test (cadaar '((a . b))) 'error)
(test (cadaar '((a b))) 'error)
(test (cadadr 'a) 'error)
(test (cadadr '(a . b)) 'error)
(test (cadadr '(a b . c)) 'error)
(test (cadadr '(a (b . e) . c)) 'error)
(test (caddar 'a) 'error)
(test (caddar '(a . b)) 'error)
(test (caddar '((a . b) . b)) 'error)
(test (caddar '((a b . c) . b)) 'error)
(test (cadddr 'a) 'error)
(test (cadddr '(a . b)) 'error)
(test (cadddr '(a c . b)) 'error)
(test (cadddr '(a c e . b)) 'error)
(test (cdaaar 'a) 'error)
(test (cdaaar '(a)) 'error)
(test (cdaaar '((a))) 'error)
(test (cdaaar '(((a . b)))) 'error)
(test (cdaadr 'a) 'error)
(test (cdaadr '(a . b)) 'error)
(test (cdaadr '(a b)) 'error)
(test (cdaadr '(a (b . c))) 'error)
(test (cdadar 'a) 'error)
(test (cdadar '(a . b)) 'error)
(test (cdadar '((a . c) . b)) 'error)
(test (cdadar '((a c . d) . b)) 'error)
(test (cdaddr 'a) 'error)
(test (cdaddr '(a . b)) 'error)
(test (cdaddr '(a c . b)) 'error)
(test (cdaddr '(a c b . d)) 'error)
(test (cddaar 'a) 'error)
(test (cddaar '(a)) 'error)
(test (cddaar '((a . b))) 'error)
(test (cddaar '((a b))) 'error)
(test (cddadr 'a) 'error)
(test (cddadr '(a . b)) 'error)
(test (cddadr '(a b . c)) 'error)
(test (cddadr '(a (b . e) . c)) 'error)
(test (cdddar 'a) 'error)
(test (cdddar '(a . b)) 'error)
(test (cdddar '((a . b) . b)) 'error)
(test (cdddar '((a b . c) . b)) 'error)
(test (cddddr 'a) 'error)
(test (cddddr '(a . b)) 'error)
(test (cddddr '(a c . b)) 'error)
(test (cddddr '(a c e . b)) 'error)

(test (caar '((1))) 1)
(test (cadr '(1 2)) 2)
(test (cdar '((1 . 2))) 2)
(test (cddr '(1 2 . 3)) 3)
(test (caaar '(((1)))) 1)
(test (caadr '(1 (2))) 2)
(test (cadar '((1 2))) 2)
(test (cdaar '(((1 . 2)))) 2)
(test (caddr '(1 2 3)) 3)
(test (cdddr '(1 2 3 . 4)) 4)
(test (cdadr '(1 (2 . 3))) 3)
(test (cddar '((1 2 . 3))) 3)
(test (caaaar '((((1))))) 1)
(test (caaadr '(1 ((2)))) 2)
(test (caadar '((1 (2)))) 2)
(test (cadaar '(((1 2)))) 2)
(test (caaddr '(1 2 (3))) 3)
(test (cadddr '(1 2 3 4)) 4)
(test (cadadr '(1 (2 3))) 3)
(test (caddar '((1 2 3))) 3)
(test (cdaaar '((((1 . 2))))) 2)
(test (cdaadr '(1 ((2 . 3)))) 3)
(test (cdadar '((1 (2 . 3)))) 3)
(test (cddaar '(((1 2 . 3)))) 3)
(test (cdaddr '(1 2 (3 . 4))) 4)
(test (cddddr '(1 2 3 4 . 5)) 5)
(test (cddadr '(1 (2 3 . 4))) 4)
(test (cdddar '((1 2 3 . 4))) 4)

(let () (define (f1 x) (eq? (car x) 'y)) (let ((z 1)) (test (f1 z) 'error)))
(let () (define (f1 x) (eq? (cdr x) 'y)) (let ((z 1)) (test (f1 z) 'error)))
(let () (define (f1 x) (eq? (caar x) 'y)) (let ((z (list 1 2))) (test (f1 z) 'error)))
(let () (define (f1 x) (eq? (cadr x) 'y)) (let ((z (cons 1 2))) (test (f1 z) 'error)))
(let () (define (f1 x) (eq? (cdar x) 'y)) (let ((z (list 1 2))) (test (f1 z) 'error)))
(let () (define (f1 x) (eq? (cddr x) 'y)) (let ((z (cons 1 2))) (test (f1 z) 'error)))



;;; --------------------------------------------------------------------------------
;;; length

(test (length (list 'a 'b 'c 'd 'e 'f)) 6)
(test (length (list 'a 'b 'c 'd)) 4)
(test (length (list 'a (list 'b 'c) 'd)) 3)
(test (length ()) 0)
(test (length '(this-that)) 1)
(test (length '(this - that)) 3)
(test (length '(a b)) 2)
(test (length '(a b c)) 3)
(test (length '(a (b) (c d e))) 3)
(test (length (list 1 (cons 1 2))) 2)
(test (length (list 1 (cons 1 ()))) 2)

(for-each
 (lambda (arg)
   (test (length arg) #f))
 (list (integer->char 65) #f 'a-symbol abs quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #\f #t :hi (if #f #f) (lambda (a) (+ a 1))))

(test (length 'x) #f)
(test (length (cons 1 2)) -1)
(let ((x (list 1 2)))
  (set-cdr! x x)
  (test (infinite? (length x)) #t))
(test (length '(1 2 . 3)) -2)
(test (length) 'error)
(test (length '(1 2 3) #(1 2 3)) 'error)
(test (integer? (length (funclet cons))) #t)

(test (length '((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((0))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) 1)



;;; --------------------------------------------------------------------------------
;;; reverse

(test (reverse '(a b c d)) '(d c b a))
(test (reverse '(a b c))  '(c b a))
(test (reverse '(a (b c) d (e (f))))  '((e (f)) d (b c) a))
(test (reverse ()) ())
(test (reverse (list 1 2 3)) '(3 2 1))
(test (reverse (list 1)) '(1))
(test (reverse (list)) (list))
(test (reverse '(1 2 3)) (list 3 2 1))
(test (reverse '(1)) '(1))
(test (reverse '((1 2) 3)) '(3 (1 2)))
(test (reverse '(((1 . 2) . 3) 4)) '(4 ((1 . 2) . 3)))
(test (reverse (list (list) (list 1 2))) '((1 2) ()))
(test (reverse '((a) b c d)) '(d c b (a)))
(test (reverse (reverse (list 1 2 3 4))) (list 1 2 3 4))
(test (reverse ''foo) '(foo quote))
(test (let ((x (list 1 2 3 4)))
	(let ((y (reverse x)))
	  (and (equal? x (list 1 2 3 4))
	       (equal? y (list 4 3 2 1)))))
      #t)
(test (letrec ((hi (lambda (lst n)
		     (if (= n 0)
			 lst
			 (hi (reverse lst) (- n 1))))))
	(hi (list 1 2 3) 100))
      (list 1 2 3))
(test (let ((var (list 1 2 3))) (reverse (cdr var)) var) (list 1 2 3))
(test (let ((var '(1 2 3))) (reverse (cdr var)) var) '(1 2 3))
(test (let ((var (list 1 (list 2 3)))) (reverse (cdr var)) var) (list 1 (list 2 3)))
(test (let ((var '(1 (2 3)))) (reverse (cdr var)) var) '(1 (2 3)))
(test (let ((var (list (list 1 2) (list 3 4 5)))) (reverse (car var)) var) '((1 2) (3 4 5)))
(test (let ((x '(1 2 3))) (list (reverse x) x)) '((3 2 1) (1 2 3)))
(test (reverse '(1 2)) '(2 1))
(test (reverse '(1 2 3)) '(3 2 1))
(test (reverse '(1 2 3 4)) '(4 3 2 1))

(when with-block 
  (test (block? (reverse _c_obj_)) #t)
  (let ((b (block 1 2 3 4)))
    (let ((b1 (reverse b)))
      (test b1 (block 4 3 2 1))
      (test b (block 1 2 3 4)))))

(for-each
 (lambda (lst)
   (if (proper-list? lst)
       (if (not (equal? lst (reverse (reverse lst))))
	   (format #t ";(reverse (reverse ~A)) -> ~A?~%" lst (reverse (reverse lst))))))
 lists)

(for-each
 (lambda (lst)
   (if (proper-list? lst)
       (if (not (equal? lst (reverse (reverse (reverse (reverse lst))))))
	   (format #t ";(reverse...(4x) ~A) -> ~A?~%" lst (reverse (reverse (reverse (reverse lst))))))))
 lists)

(test (let ((x (list 1 2 3))) (list (recompose 32 reverse x) x)) '((1 2 3) (1 2 3)))
(test (let ((x (list 1 2 3))) (list (recompose 31 reverse x) x)) '((3 2 1) (1 2 3)))

(test (reverse (cons 1 2)) '(2 . 1))
(test (reverse '(1 . 2)) '(2 . 1))
(test (reverse '(1 2 . 3)) '(3 2 1))
(test (reverse) 'error)
(test (reverse '(1 2 3) '(3 2 1)) 'error)
(test (reverse (make-shared-vector (make-int-vector '(2 3) 0) '(6))) (make-int-vector 6 0))
(test (reverse (make-float-vector 6 0.0)) (make-float-vector 6 0.0))

(for-each
 (lambda (arg)
   (test (reverse arg) 'error))
 (list (integer->char 65) #f 'a-symbol abs quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #\f #t :hi (if #f #f) (lambda (a) (+ a 1))))

(test (reverse "hi") "ih")
(test (reverse "") "")
(test (reverse "123") "321")
(test (reverse "1234") "4321")
(test (reverse "12") "21")
(test (reverse "a\x00;b") "b\x00;a")
(test (reverse #()) #())
(test (reverse #(1)) #(1))
(test (reverse #(1 2)) #(2 1))
(test (reverse #(1 2 3)) #(3 2 1))
(test (reverse #(1 2 3 4)) #(4 3 2 1))
(test (reverse #2D((1 2) (3 4))) #2D((4 3) (2 1)))
(test (reverse (string #\a #\null #\b)) "b\x00;a")
(test (reverse abs) 'error)
(test (vector->list (reverse (let ((v (make-int-vector 3))) (set! (v 1) 1) (set! (v 2) 2) v))) '(2 1 0))
(test (reverse (int-vector)) #())
(test (reverse (int-vector 1)) (int-vector 1))
(test (reverse (int-vector 1 2)) (int-vector 2 1))
(test (reverse (int-vector 1 2 3)) (int-vector 3 2 1))
(test (reverse (int-vector 1 2 3 4)) (int-vector 4 3 2 1))
(test (reverse (float-vector)) #())
(test (reverse (float-vector 1)) (float-vector 1))
(test (reverse (float-vector 1 2)) (float-vector 2 1))
(test (reverse (float-vector 1 2 3)) (float-vector 3 2 1))
(test (reverse (float-vector 1 2 3 4)) (float-vector 4 3 2 1))
(test (let ((v #(1 2 3))) (reverse v) v) #(1 2 3))
(test (reverse #u8(1 2 3)) #u8(3 2 1))
(test (reverse #u8(1 2)) #u8(2 1))
(test (reverse #u8(1 2 3 4)) #u8(4 3 2 1))

(when with-block
  (let ((b (block 1.0 2.0 3.0)))
    (set! (b 1) 32.0)
    (test (b 1) 32.0)
    (let ((b1 (reverse b)))
      (test b1 (block 3.0 32.0 1.0)))))




;;; --------------------------------------------------------------------------------
;;; reverse!

(test (reverse! '(1 . 2)) 'error)
(test (reverse! (cons 1 2)) 'error)
(test (reverse! (cons 1 (cons 2 3))) 'error)
(test (reverse!) 'error)
(test (reverse! '(1 2 3) '(3 2 1)) 'error)

(test (reverse! '(a b c d)) '(d c b a))
(test (reverse! '(a b c))  '(c b a))
(test (reverse! '(a (b c) d (e (f))))  '((e (f)) d (b c) a))
(test (reverse! ()) ())
(test (reverse! (list 1 2 3)) '(3 2 1))
(test (reverse! (list 1)) '(1))
(test (reverse! (list)) (list))
(test (reverse! '(1 2 3)) (list 3 2 1))
(test (reverse! '(1)) '(1))
(test (reverse! '((1 2) 3)) '(3 (1 2)))
(test (reverse! '(((1 . 2) . 3) 4)) '(4 ((1 . 2) . 3)))
(test (reverse! (list (list) (list 1 2))) '((1 2) ()))
(test (reverse! '((a) b c d)) '(d c b (a)))
(test (reverse! (reverse! (list 1 2 3 4))) (list 1 2 3 4))
(test (reverse! (reverse! (sort! (list 1 2 3 4) >))) (sort! (list 1 2 3 4) >))
(test (reverse! ''foo) '(foo quote))
(test (reverse (reverse! (list 1 2 3))) (list 1 2 3))
(test (reverse (reverse! (reverse! (reverse (list 1 2 3))))) (list 1 2 3))

(test (let ((x (list 1 2 3))) (recompose 31 reverse! x)) '(3 2 1))
(test (reverse! '(1 2 . 3)) 'error)

(let* ((lst1 (list 1 2 3))
       (lst2 (apply list '(4 5 6)))
       (lst3 (sort! (reverse! (append lst1 lst2)) <)))
  (test lst3 '(1 2 3 4 5 6))
  (define (lt . args)
    args)
  (set! lst3 (sort! (apply reverse! (lt lst3)) >))
  (test lst3 '(6 5 4 3 2 1)))

(for-each
 (lambda (arg)
   (test (reverse! arg) 'error))
 (list (integer->char 65) #f 'a-symbol abs _ht_ _undef_ _null_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #\f #t (if #f #f) (lambda (a) (+ a 1))))

(test (let ((str "1234")) (reverse! str) str) "4321")
(test (let ((str "123")) (reverse! str) str) "321")
(test (let ((str "")) (reverse! str) str) "")
(test (let ((v #(1 2 3))) (reverse! v) v) #(3 2 1))
(test (let ((v #(1 2 3 4))) (reverse! v) v) #(4 3 2 1))
(test (let ((v #())) (reverse! v) v) #())
(test (let ((v (float-vector 1.0 2.0 3.0))) (reverse! v) v) (float-vector 3.0 2.0 1.0))
(test (let ((v (float-vector 1.0 2.0 3.0 4.0))) (reverse! v) v) (float-vector 4.0 3.0 2.0 1.0))
(test (let ((v (float-vector))) (reverse! v) v) #())
(test (let ((v (int-vector 1 2 3))) (reverse! v) v) (int-vector 3 2 1))
(test (let ((v (int-vector 1 2 3 4))) (reverse! v) v) (int-vector 4 3 2 1))
(test (let ((v (int-vector))) (reverse! v) v) #())
(when with-block 
  (test (block? (reverse! _c_obj_)) #t)
  (let ((b (block 1 2 3 4)))
    (reverse! b)
    (test b (block 4 3 2 1))))
(test (let ((v (make-int-vector 3 1))) (set! (v 1) 2) (set! (v 2) 3) (reverse! v) v) (let ((v (make-int-vector 3 3))) (set! (v 1) 2) (set! (v 2) 1) v))

(when full-test
  (let ()
    ;; some sequence tests
    
    (define (fv-tst len)
      (let ((fv (make-float-vector len)))
	(if (not (= (length fv) len))
	    (format *stderr* "float-vector length ~A: ~A~%" fv (length fv)))
	(fill! fv 0.0)
	(let ((fv-orig (copy fv)))
	  (do ((i 0 (+ i 1)))
	      ((= i len))
	    (set! (fv i) (- (random 1000.0) 500.0)))
	  (let ((fv-ran (copy fv))
		(fv-ran1 (copy fv)))
	    (sort! fv <)
	    (call-with-exit
	     (lambda (quit)
	       (do ((i 1 (+ i 1)))
		   ((= i len))
		 (when (> (fv (- i 1)) (fv i))
		   (format *stderr* "float-vector: ~A > ~A at ~D~%" (fv (- i 1)) (fv i) i)
		   (quit)))))
	    (sort! fv-ran (lambda (a b) (< a b)))
	    (if (not (morally-equal? fv fv-ran))
		(format *stderr* "float-vector closure not equal~%"))
	    (sort! fv-ran1 (lambda (a b) (cond ((< a b) #t) (#t #f))))
	    (if (not (morally-equal? fv fv-ran1))
		(format *stderr* "float-vector cond closure not equal~%")))
	  
	  (let ((fv-copy (copy fv)))
	    (reverse! fv)
	    (if (and (not (morally-equal? fv-copy fv))
		     (morally-equal? fv fv-orig))
		(format *stderr* "float-vector reverse!: ~A ~A~%" fv fv-orig))
	    (reverse! fv)
	    (if (not (morally-equal? fv-copy fv))
		(format *stderr* "float-vector reverse! twice: ~A ~A~%" fv fv-copy))
	    (let ((fv1 (apply float-vector (make-list len 1.0))))
	      (if (or (not (= (length fv1) len))
		      (not (= (fv1 (- len 1)) 1.0)))
		  (format *stderr* "float-vector apply: ~A ~A~%" len (fv (- len 1)))))
	    ))))
    
    (define (iv-tst len)
      (let ((fv (make-int-vector len 0)))
	(if (not (= (length fv) len))
	    (format *stderr* "int-vector length ~A: ~A~%" fv (length fv)))
	(fill! fv 0)
	(let ((fv-orig (copy fv)))
	  (do ((i 0 (+ i 1)))
	      ((= i len))
	    (set! (fv i) (- (random 1000000) 500000)))
	  (let ((fv-ran (copy fv))
		(fv-ran1 (copy fv)))
	    (sort! fv <)
	    (call-with-exit
	     (lambda (quit)
	       (do ((i 1 (+ i 1)))
		   ((= i len))
		 (when (> (fv (- i 1)) (fv i))
		   (format *stderr* "int-vector: ~A > ~A at ~D~%" (fv (- i 1)) (fv i) i)
		   (quit)))))
	    (sort! fv-ran (lambda (a b) (< a b)))
	    (if (not (morally-equal? fv fv-ran))
		(format *stderr* "int-vector closure not equal~%"))
	    (sort! fv-ran1 (lambda (a b) (cond ((< a b) #t) (#t #f))))
	    (if (not (morally-equal? fv fv-ran1))
		(format *stderr* "int-vector cond closure not equal~%")))
	  
	  (let ((fv-copy (copy fv)))
	    (reverse! fv)
	    (if (and (not (morally-equal? fv-copy fv))
		     (morally-equal? fv fv-orig))
		(format *stderr* "int-vector reverse!: ~A ~A~%" fv fv-orig))
	    (reverse! fv)
	    (if (not (morally-equal? fv-copy fv))
		(format *stderr* "int-vector reverse! twice: ~A ~A~%" fv fv-copy))
	    ))))
    
    (define (v-tst len)
      (let ((fv (make-vector len)))
	(if (not (= (length fv) len))
	    (format *stderr* "vector length ~A: ~A~%" fv (length fv)))
	(fill! fv 0)
	(let ((fv-orig (copy fv)))
	  (do ((i 0 (+ i 1)))
	      ((= i len))
	    (set! (fv i) (- (random 1000000) 500000)))
	  (let ((fv-ran (copy fv))
		(fv-ran1 (copy fv)))
	    (sort! fv <)
	    (call-with-exit
	     (lambda (quit)
	       (do ((i 1 (+ i 1)))
		   ((= i len))
		 (when (> (fv (- i 1)) (fv i))
		   (format *stderr* "vector: ~A > ~A at ~D~%" (fv (- i 1)) (fv i) i)
		   (quit)))))
	    (sort! fv-ran (lambda (a b) (< a b)))
	    (if (not (morally-equal? fv fv-ran))
		(format *stderr* "vector closure not equal~%"))
	    (sort! fv-ran1 (lambda (a b) (cond ((< a b) #t) (#t #f))))
	    (if (not (morally-equal? fv fv-ran1))
		(format *stderr* "vector cond closure not equal~%")))
	  
	  (let ((fv-copy (copy fv)))
	    (reverse! fv)
	    (if (and (not (morally-equal? fv-copy fv))
		     (morally-equal? fv fv-orig))
		(format *stderr* "vector reverse!: ~A ~A~%" fv fv-orig))
	    (reverse! fv)
	    (if (not (morally-equal? fv-copy fv))
		(format *stderr* "vector reverse! twice: ~A ~A~%" fv fv-copy))
	    (let ((fv1 (apply vector (make-list len 1))))
	      (if (or (not (= (length fv1) len))
		      (not (= (fv1 (- len 1)) 1)))
		  (format *stderr* "vector apply: ~A ~A~%" len (fv (- len 1)))))
	    ))))
    
    (define (s-tst len)
      (let ((fv (make-string len)))
	(if (not (= (length fv) len))
	    (format *stderr* "string length ~A: ~A~%" fv (length fv)))
	(fill! fv #\a)
	(let ((fv-orig (copy fv)))
	  (do ((i 0 (+ i 1)))
	      ((= i len))
	    (set! (fv i) (integer->char (+ 20 (random 100)))))
	  (let ((fv-ran (copy fv))
		(fv-ran1 (copy fv)))
	    (sort! fv char<?)
	    (call-with-exit
	     (lambda (quit)
	       (do ((i 1 (+ i 1)))
		   ((= i len))
		 (when (char>? (fv (- i 1)) (fv i))
		   (format *stderr* "string: ~A > ~A at ~D~%" (fv (- i 1)) (fv i) i)
		   (quit)))))
	    (sort! fv-ran (lambda (a b) (char<? a b)))
	    (if (not (morally-equal? fv fv-ran))
		(format *stderr* "string closure not equal~%"))
	    (sort! fv-ran1 (lambda (a b) (cond ((char<? a b) #t) (#t #f))))
	    (if (not (morally-equal? fv fv-ran))
		(format *stderr* "string cond closure not equal~%")))
	  
	  (let ((fv-copy (copy fv)))
	    (reverse! fv)
	    (if (and (not (morally-equal? fv-copy fv))
		     (morally-equal? fv fv-orig))
		(format *stderr* "string reverse!: ~A ~A~%" fv fv-orig))
	    (reverse! fv)
	    (if (not (morally-equal? fv-copy fv))
		(format *stderr* "string reverse! twice: ~A ~A~%" fv fv-copy))
	    (let ((fv1 (apply string (make-list len #\a))))
	      (if (or (not (= (length fv1) len))
		      (not (char=? (fv1 (- len 1)) #\a)))
		  (format *stderr* "string apply: ~A ~A~%" len (fv (- len 1)))))
	    ))))
    
    (define (p-tst len)
      (let ((fv (make-list len)))
	(if (not (= (length fv) len))
	    (format *stderr* "list length ~A: ~A~%" fv (length fv)))
	(fill! fv 0)
	(let ((fv-orig (copy fv)))
	  (do ((p fv (cdr p)))
	      ((null? p))
	    (set-car! p (- (random 100000) 50000)))
	  (let ((fv-ran (copy fv)))
	    (sort! fv <)
	    (call-with-exit
	     (lambda (quit)
	       (do ((p0 fv (cdr p0))
		    (p1 (cdr fv) (cdr p1))
		    (i 1 (+ i 1)))
		   ((null? p1))
		 (when (> (car p0) (car p1))
		   (format *stderr* "list: ~A > ~A at ~D~%" (car p0) (car p1) i)
		   (quit)))))
	    (sort! fv-ran (lambda (a b) (< a b)))
	    (if (not (morally-equal? fv fv-ran))
		(format *stderr* "pair closure not equal~%")))
	  
	  (let ((fv-copy (copy fv)))
	    (set! fv (reverse! fv))
	    (if (and (not (morally-equal? fv-copy fv))
		     (morally-equal? fv fv-orig))
		(format *stderr* "list reverse!: ~A ~A~%" fv fv-orig))
	    (set! fv (reverse! fv))
	    (if (not (morally-equal? fv-copy fv))
		(format *stderr* "list reverse! twice: ~A ~A~%" fv fv-copy))
	    ))))
    
    (for-each
     (lambda (b p)
       (do ((k 0 (+ k 1)))
	   ((= k 1000))
	 (fv-tst b)
	 (iv-tst b)
	 (v-tst b)
	 (s-tst b)
	 (p-tst b))
       (do ((i 0 (+ i 1)))
	   ((= i p))
	 (format *stderr* "~D fv " (expt b i))
	 (fv-tst (expt b i))
	 (format *stderr* "iv ")
	 (iv-tst (expt b i))
	 (format *stderr* "v ")
	 (v-tst (expt b i))
	 (format *stderr* "s ")
	 (s-tst (expt b i))
	 (format *stderr* "p ")
	 (p-tst (expt b i))
	 (newline *stderr*)
	 ))
     (list 2 3 4 7 10)
     (list 12 4 3 6 6))
    ))

(test (let ((v (vector 1 2 3 4))) (let ((sv (make-shared-vector v 3))) (reverse! sv) v)) #(3 2 1 4))
(test (let ((v (vector 1 2 3 4))) (let ((sv (make-shared-vector v 3 1))) (reverse! sv) v)) #(1 4 3 2))
(test (let ((v (vector 1 2 3 4))) (let ((sv (make-shared-vector v 3 1))) (fill! sv 5) v)) #(1 5 5 5))
(test (let ((v (vector 1 2 3 4))) (let ((sv (make-shared-vector v 3 1))) (reverse sv) v)) #(1 2 3 4))
(test (let ((v (vector 1 2 3 4))) (let ((sv (make-shared-vector v 3 1))) (sort! sv >) v)) #(1 4 3 2))
(test (let ((v (make-int-vector '(3 3) 1))) (let ((sv (v 1))) (fill! sv 2) v)) (make-shared-vector (int-vector 1 1 1 2 2 2 1 1 1) '(3 3)))

(test (let ((v (make-int-vector '(3 3) 1)))
	(do ((i 0 (+ i 1)))
	    ((= i 3))
	  (do ((j 0 (+ j 1)))
	      ((= j 3))
	    (set! (v i j) (+ j (* i 3)))))
	(let ((sv (v 1)))
	  (fill! sv 2)
	  v))
      (make-shared-vector (int-vector 0 1 2 2 2 2 6 7 8) '(3 3)))

(test (let ((v (make-int-vector '(3 3) 1)))
	(do ((i 0 (+ i 1)))
	    ((= i 3))
	  (do ((j 0 (+ j 1)))
	      ((= j 3))
	    (set! (v i j) (+ j (* i 3)))))
	(let ((sv (v 1)))
	  (sort! sv >)
	  v))
      (make-shared-vector (int-vector 0 1 2 5 4 3 6 7 8) '(3 3)))

(test (let ((v (make-int-vector '(3 3) 1)))
	(do ((i 0 (+ i 1)))
	    ((= i 3))
	  (do ((j 0 (+ j 1)))
	      ((= j 3))
	    (set! (v i j) (+ j (* i 3)))))
	(let ((sv (v 1)))
	  (reverse! sv)
	  v)) 
      (make-shared-vector (int-vector 0 1 2 5 4 3 6 7 8) '(3 3)))

(test (catch #t
	(lambda ()
	  (reverse! (catch #t 1 cons))
	  (reverse! (catch #t 1 cons))) ; this will clobber sc->wrong_type_arg_info if not caught
	(lambda args 'error))
      'error)
(test (reverse! `((1) . x)) 'error)
(if with-block (test (reverse! (immutable! (block 0 0))) 'error))



;;; --------------------------------------------------------------------------------
;;; pair?

(test (pair? 'a) #f)
(test (pair? '()) #f)
(test (pair? ()) #f)
(test (pair? '(a b c)) #t)
(test (pair? (cons 1 2)) #t)
(test (pair? ''()) #t)
(test (pair? #f) #f)
(test (pair? (make-vector 6)) #f)
(test (pair? #t) #f)
(test (pair? '(a . b)) #t)
(test (pair? #(a b))  #f)
(test (pair? (list 1 2)) #t)
(test (pair? (list)) #f)
(test (pair? ''foo) #t)
(test (pair? (list 'a 'b 'c 'd 'e 'f)) #t)
(test (pair? '(this-that)) #t)
(test (pair? '(this - that)) #t)
(let ((x (list 1 2)))
  (set-cdr! x x)
  (test (pair? x) #t))
(test (pair? (list 1 (cons 1 2))) #t)
(test (pair? (list 1 (cons 1 ()))) #t)
(test (pair? (cons 1 ())) #t)
(test (pair? (cons () ())) #t)
(test (pair? (cons () 1)) #t)
(test (pair? (list (list))) #t)
(test (pair? '(())) #t)
(test (pair? (cons 1 (cons 2 3))) #t)
(test (pair?) 'error)
(test (pair? `'1) #t)
(test (pair? begin) #f)
(test (pair? 'begin) #f)
(test (pair? ''begin) #t)
(test (pair? list) #f)

(for-each
 (lambda (arg)
   (if (pair? arg)
       (format #t ";(pair? ~A) -> #t?~%" arg)))
 (list "hi" (integer->char 65) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #\f #t :hi (if #f #f) (lambda (a) (+ a 1))))



;;; pair-line-number

(test (pair-line-number) 'error)
(test (pair-line-number () ()) 'error)
(for-each
 (lambda (arg)
   (test (pair-line-number arg) 'error))
 (list "hi" (integer->char 65) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #\f #t :hi (if #f #f) (lambda (a) (+ a 1))))

;;; pair-filename

(test (pair-filename) 'error)
(test (pair-filename () ()) 'error)
(for-each
 (lambda (arg)
   (test (pair-filename arg) 'error))
 (list "hi" (integer->char 65) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #\f #t :hi (if #f #f) (lambda (a) (+ a 1))))




;;; --------------------------------------------------------------------------------
;;; list?

(test (list? 'a) #f)
(test (list? ()) #t)
(test (list? '(a b c)) #t)
(test (list? (cons 1 2)) #t)
(test (list? ''()) #t)
(test (list? #f) #f)
(test (list? (make-vector 6)) #f)
(test (list? #t) #f)
(test (list? '(a . b)) #t)
(test (list? #(a b))  #f)
(test (list? (list 1 2)) #t)
(test (list? (list)) #t)
(test (list? ''foo) #t)
(test (list? ''2) #t)
(test (list? (list 'a 'b 'c 'd 'e 'f)) #t)
(test (list? '(this-that)) #t)
(test (list? '(this - that)) #t)
(let ((x (list 1 2)))
  (set-cdr! x x)
  (test (proper-list? x) #f)
  (test (list? x) #t))
(test (list? (list 1 (cons 1 2))) #t)
(test (list? (list 1 (cons 1 ()))) #t)
(test (list? (cons 1 ())) #t)
(test (list? (cons () ())) #t)
(test (list? (cons () 1)) #t)
(test (list? (list (list))) #t)
(test (list? '(())) #t)
(test (list? '(1 2 . 3)) #t)
(test (list? (cons 1 (cons 2 3))) #t)
(test (list? '(1 . ())) #t)

(test (list? '(1 2) ()) 'error)
(test (list?) 'error)
(for-each
 (lambda (arg)
   (if (list? arg)
       (format #t ";(list? ~A) -> #t?~%" arg)))
 (list "hi" (integer->char 65) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #\f #t :hi (if #f #f) (lambda (a) (+ a 1))))


;;; proper-list?

(test (proper-list? 'a) #f)
(test (proper-list? ()) #t)
(test (proper-list? '(a b c)) #t)
(test (proper-list? (cons 1 2)) #f)
(test (proper-list? ''()) #t)
(test (proper-list? #f) #f)
(test (proper-list? (make-vector 6)) #f)
(test (proper-list? #t) #f)
(test (proper-list? '(a . b)) #f)
(test (proper-list? #(a b))  #f)
(test (proper-list? (list 1 2)) #t)
(test (proper-list? (list)) #t)
(test (proper-list? ''foo) #t)
(test (proper-list? ''2) #t)
(test (proper-list? (list 'a 'b 'c 'd 'e 'f)) #t)
(test (proper-list? '(this-that)) #t)
(test (proper-list? '(this - that)) #t)
(let ((x (list 1 2)))
  (set-cdr! x x)
  (test (proper-list? x) #f))
(test (proper-list? (list 1 (cons 1 2))) #t)
(test (proper-list? (list 1 (cons 1 ()))) #t)
(test (proper-list? (cons 1 ())) #t)
(test (proper-list? (cons () ())) #t)
(test (proper-list? (cons () 1)) #f)
(test (proper-list? (list (list))) #t)
(test (proper-list? '(())) #t)
(test (proper-list? '(1 2 . 3)) #f)
(test (proper-list? (cons 1 (cons 2 3))) #f)
(test (proper-list? '(1 . ())) #t)

(test (proper-list? (let ((lst (list 1))) (set-cdr! lst lst) lst)) #f)
(test (proper-list? (let ((lst (list 1 2))) (set-cdr! (cdr lst) lst) lst)) #f)
(test (proper-list? (let ((lst (list 1 2 3))) (set-cdr! (cddr lst) lst) lst)) #f)
(test (proper-list? (let ((lst (list 1 2 3 4))) (set-cdr! (cdddr lst) lst) lst)) #f)
(test (proper-list? (let ((lst (list 1 2 3 4 5))) (set-cdr! (cdr (cdddr lst)) lst) lst)) #f)

(test (proper-list? '(1 2) ()) 'error)
(test (proper-list?) 'error)
(for-each
 (lambda (arg)
   (if (proper-list? arg)
       (format #t ";(list? ~A) -> #t?~%" arg)))
 (list "hi" (integer->char 65) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #\f #t :hi (if #f #f) (lambda (a) (+ a 1))))


;;; --------------------------------------------------------------------------------
;;; null?

(test (null? 'a) '#f)
(test (null? ()) #t)
(test (null? ()) #t)
(test (null? '(a b c)) #f)
(test (null? (cons 1 2)) #f)
(test (null? ''()) #f)
(test (null? #f) #f)
(test (null? (make-vector 6)) #f)
(test (null? #t) #f)
(test (null? '(a . b)) #f)
(test (null? #(a b))  #f)
(test (null? (list 1 2)) #f)
(test (null? (list)) #t)
(test (null? ''foo) #f)
(test (null? (list 'a 'b 'c 'd 'e 'f)) #f)
(test (null? '(this-that)) #f)
(test (null? '(this - that)) #f)
(let ((x (list 1 2)))
  (set-cdr! x x)
  (test (null? x) #f))
(test (null? (list 1 (cons 1 2))) #f)
(test (null? (list 1 (cons 1 ()))) #f)
(test (null? (cons 1 ())) #f)
(test (null? (cons () ())) #f)
(test (null? (cons () 1)) #f)
(test (null? (list (list))) #f)
(test (null? '(())) #f)
(test (null? #()) #f)
(test (null? (make-vector '(2 0 3))) #f)
(test (null? "") #f)
(test (null? lambda) #f)
(test (null? cons) #f)
(test (null? (begin)) #t)
(test (null? (cdr (list 1))) #t)
(test (null? (cdr (cons () '(())))) #f)

(test (null? () ()) 'error)
(test (null?) 'error)

(for-each
 (lambda (arg)
   (if (null? arg)
       (format #t ";(null? ~A) -> #t?~%" arg)))
 (list "hi" (integer->char 65) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #\f #t (if #f #f) :hi #<eof> #<undefined> (values) (lambda (a) (+ a 1))))



;;; --------------------------------------------------------------------------------
;;; set-car!

(test (let ((x (cons 1 2))) (set-car! x 3) x) (cons 3 2))
(test (let ((x (list 1 2))) (set-car! x 3) x) (list 3 2))
(test (let ((x (list (list 1 2) 3))) (set-car! x 22) x) (list 22 3))
(test (let ((x (cons 1 2))) (set-car! x ()) x) (cons () 2))
(test (let ((x (list 1 (list 2 3 4)))) (set-car! x (list 5 (list 6))) x) (list (list 5 (list 6)) (list 2 3 4)))
(test (let ((x '(((1) 2) (3)))) (set-car! x '((2) 1)) x) '(((2) 1) (3)))
(test (let ((x ''foo)) (set-car! x "hi") x) (list "hi" 'foo))
(test (let ((x '((1 . 2) . 3))) (set-car! x 4) x) '(4 . 3))
(test (let ((x '(1 . 2))) (set-car! x (cdr x)) x) '(2 . 2))
(test (let ((x '(1 . 2))) (set-car! x x) (proper-list? x)) #f)
(test (let ((x (list 1))) (set-car! x ()) x) '(()))
(test (let ((x '(((1 2) . 3) 4))) (set-car! x 1) x) '(1 4))
(test (let ((lst (cons 1 (cons 2 3)))) (set-car! (cdr lst) 4) lst) (cons 1 (cons 4 3)))
(test (let ((lst (cons 1 (cons 2 3)))) (set-car! lst 4) lst) (cons 4 (cons 2 3)))
(test (let ((x (list 1 2))) (set! (car x) 0) x) (list 0 2))
(test (let ((x (cons 1 2))) (set! (cdr x) 0) x) (cons 1 0))
(test (let ((x (list 1 2))) (set-car! x (list 3 4)) x) '((3 4) 2))
(test (let ((x (cons 1 2))) (set-car! x (list 3 4)) x) '((3 4) . 2))
(test (let ((x (cons (list 1 2) 3))) (set-car! (car x) (list 3 4)) x) '(((3 4) 2) . 3))
(test (let ((lst (list 1 2 3))) (set! (car lst) 32) lst) '(32 2 3))

(test (set-car! '() 32) 'error)
(test (set-car! () 32) 'error)
(test (set-car! (list) 32) 'error)
(test (set-car! 'x 32) 'error)
(test (set-car! #f 32) 'error)
(test (set-car!) 'error)
(test (set-car! '(1 2) 1 2) 'error)
(test (let ((lst (list 1 2))) (set-car! lst (values 2 3)) lst) 'error)
(test (let ((lst '(1 2))) (set-car! lst 32)) 32)
(test (let ((lst '(1 2))) (set! (car lst) 32)) 32)

(test (let ((c (cons 1 2))) (set-car! c #\a) (car c)) #\a)
(test (let ((c (cons 1 2))) (set-car! c #()) (car c)) #())
(test (let ((c (cons 1 2))) (set-car! c #f) (car c)) #f)
(test (let ((c (cons 1 2))) (set-car! c _ht_) (car c)) _ht_)



;;; --------------------------------------------------------------------------------
;;; set-cdr!

(test (let ((x (cons 1 2))) (set-cdr! x 3) x) (cons 1 3))
(test (let ((x (list 1 2))) (set-cdr! x 3) x) (cons 1 3))
(test (let ((x (list (list 1 2) 3))) (set-cdr! x 22) x) '((1 2) . 22))
(test (let ((x (cons 1 2))) (set-cdr! x '()) x) (list 1))
(test (let ((x (list 1 (list 2 3 4)))) (set-cdr! x (list 5 (list 6))) x) '(1 5 (6)))
(test (let ((x '(((1) 2) (3)))) (set-cdr! x '((2) 1)) x) '(((1) 2) (2) 1))
(test (let ((x ''foo)) (set-cdr! x "hi") x) (cons 'quote "hi"))
(test (let ((x '((1 . 2) . 3))) (set-cdr! x 4) x) '((1 . 2) . 4))
(test (let ((x '(1 . 2))) (set-cdr! x (cdr x)) x) '(1 . 2))
(test (let ((x '(1 . 2))) (set-cdr! x x) (proper-list? x)) #f)
(test (let ((x (list 1))) (set-cdr! x '()) x) (list 1))
(test (let ((x '(1 . (2 . (3 (4 5)))))) (set-cdr! x 4) x) '(1 . 4))
(test (let ((lst (cons 1 (cons 2 3)))) (set-cdr! (cdr lst) 4) lst) (cons 1 (cons 2 4)))
(test (let ((x (cons (list 1 2) 3))) (set-cdr! (car x) (list 3 4)) x) '((1 3 4) . 3))
(test (let ((x (list 1 2))) (set-cdr! x (list 4 5)) x) '(1 4 5))
(test (let ((x (cons 1 2))) (set-cdr! x (list 4 5)) x) '(1 4 5)) ;!
(test (let ((x (cons 1 2))) (set-cdr! x (cons 4 5)) x) '(1 4 . 5))
(test (let ((lst (list 1 2 3))) (set! (cdr lst) 32) lst) (cons 1 32))

(test (set-cdr! '() 32) 'error)
(test (set-cdr! () 32) 'error)
(test (set-cdr! (list) 32) 'error)
(test (set-cdr! 'x 32) 'error)
(test (set-cdr! #f 32) 'error)
(test (set-cdr!) 'error)
(test (set-cdr! '(1 2) 1 2) 'error)
(test (let ((lst '(1 2))) (set-cdr! lst 32)) 32)
(test (let ((lst '(1 2))) (set! (cdr lst) 32)) 32)

(test (let ((c (cons 1 2))) (set-cdr! c #\a) (cdr c)) #\a)
(test (let ((c (cons 1 2))) (set-cdr! c #()) (cdr c)) #())
(test (let ((c (cons 1 2))) (set-cdr! c #f) (cdr c)) #f)
(test (let ((c (cons 1 2))) (set-cdr! c _ht_) (cdr c)) _ht_)
(test (let ((c (cons 1 2))) (set-cdr! c (list 3)) c) '(1 3))




;;; --------------------------------------------------------------------------------
;;; list-ref

(test (list-ref (list 1 2) 1) 2)
(test (list-ref '(a b c d) 2) 'c)
(test (list-ref (cons 1 2) 0) 1) ; !!
(test (list-ref ''foo 0) 'quote)
(test (list-ref '((1 2) (3 4)) 1) '(3 4))
(test (list-ref (list-ref (list (list 1 2) (list 3 4)) 1) 1) 4)
(test (let ((x (list 1 2 3))) (list-ref x (list-ref x 1))) 3)
(test (list-ref '(1 2 . 3) 1) 2)
(test (list-ref '(1 2 . 3) 2) 'error) ; hmm...
(test ('(1 2 . 3) 0) 1)
(test ('(1 . 2) 0) 1)

(test (let ((lst (list 1 2))) (set! (list-ref lst 1) 0) lst) (list 1 0))
(test (((lambda () list)) 'a 'b 'c) '(a b c))
(test (apply ((lambda () list)) (list 'a 'b 'c) (list 'c 'd 'e)) '((a b c) c d e))
(test (((lambda () (values list))) 1 2 3) '(1 2 3))
(test (apply list 'a 'b '(c)) '(a b c))

(for-each
 (lambda (name op1 op2)
   (for-each
    (lambda (lst)
      (let ((val1 (catch #t (lambda () (op1 lst)) (lambda args 'error)))
	    (val2 (catch #t (lambda () (op2 lst)) (lambda args 'error))))
	(if (not (equal? val1 val2))
	    (format #t ";(~A ~A) -> ~A ~A?~%" name lst val1 val2))))
    lists))
 (list 'list-ref:0 'list-ref:1 'list-ref:2 'list-ref:3)
 (list car cadr caddr cadddr)
 (list (lambda (l) (list-ref l 0)) (lambda (l) (list-ref l 1)) (lambda (l) (list-ref l 2)) (lambda (l) (list-ref l 3))))

(for-each
 (lambda (arg)
   (test (list-ref (list 1 arg) 1) arg))
 (list "hi" (integer->char 65) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand (log 0) 
       3.14 3/4 1.0+1.0i #\f #t :hi (if #f #f) (lambda (a) (+ a 1))))

(test (let ((x '(1 . 2))) (set-cdr! x x) (list-ref x 0)) 1)
(test (let ((x '(1 . 2))) (set-cdr! x x) (list-ref x 1)) 1)
(test (let ((x '(1 . 2))) (set-cdr! x x) (list-ref x 100)) 1)

(test (list-ref '((1 2 3) (4 5 6)) 1) '(4 5 6))
(test (list-ref '((1 2 3) (4 5 6)) 1 2) 6)
(test (list-ref '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))) 1) '((7 8 9) (10 11 12)))
(test (list-ref '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))) 1 0) '(7 8 9))
(test (list-ref '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))) 1 0 2) 9)
(test (list-ref '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))) 1 0 3) 'error)
(test (list-ref '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))) 1 0 2 0) 'error)

(test ('((1 2 3) (4 5 6)) 1) '(4 5 6))
(test ('((1 2 3) (4 5 6)) 1 2) 6)
(test ('(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))) 1) '((7 8 9) (10 11 12)))
(test ('(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))) 1 0) '(7 8 9))
(test ('(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))) 1 0 2) 9)
(test ('(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))) 1 0 3) 'error)
(test ('(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))) 1 0 2 0) 'error)

(test (let ((L '((1 2 3) (4 5 6)))) (L 1)) '(4 5 6))
(test (let ((L '((1 2 3) (4 5 6)))) (L 1 2)) 6)
(test (let ((L '((1 2 3) (4 5 6)))) (L 1 2 3)) 'error)
(test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (L 1)) '((7 8 9) (10 11 12)))
(test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (L 1 0)) '(7 8 9))
(test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (L 1 0 2)) 9)
(test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (L 1 0 2 3)) 'error)

(test (let ((L '((1 2 3) (4 5 6)))) ((L 1) 2)) 6)
(test (let ((L '((1 2 3) (4 5 6)))) (((L 1) 2) 3)) 'error)
(test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) ((L 1) 0)) '(7 8 9))
(test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (((L 1) 0) 2)) 9)
(test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) ((L 1 0) 2)) 9)
(test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) ((L 1) 0 2)) 9)
(test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) ((((L 1) 0) 2) 3)) 'error)

(test (let ((L '((1 2 3) (4 5 6)))) (list-ref (L 1) 2)) 6)
(test (let ((L '((1 2 3) (4 5 6)))) (list-ref ((L 1) 2) 3)) 'error)
(test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (list-ref (L 1) 0)) '(7 8 9))
(test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) ((list-ref (L 1) 0) 2)) 9)
(test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (list-ref (((L 1) 0) 2) 3)) 'error)

(let ((zero 0)
      (one 1)
      (two 2)
      (three 3))
  (test (list-ref '((1 2 3) (4 5 6)) one) '(4 5 6))
  (test (list-ref '((1 2 3) (4 5 6)) 1 two) 6)
  (test (list-ref '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))) one) '((7 8 9) (10 11 12)))
  (test (list-ref '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))) one zero) '(7 8 9))
  (test (list-ref '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))) one zero two) 9)
  (test (list-ref '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))) one zero three) 'error)
  
  (test ('((1 2 3) (4 5 6)) one) '(4 5 6))
  (test ('((1 2 3) (4 5 6)) 1 two) 6)
  (test ('(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))) one) '((7 8 9) (10 11 12)))
  (test ('(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))) one zero) '(7 8 9))
  (test ('(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))) one zero two) 9)
  (test ('(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))) one zero three) 'error)
  
  (test (let ((L '((1 2 3) (4 5 6)))) (L one)) '(4 5 6))
  (test (let ((L '((1 2 3) (4 5 6)))) (L 1 two)) 6)
  (test (let ((L '((1 2 3) (4 5 6)))) (L 1 2 3)) 'error)
  (test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (L one)) '((7 8 9) (10 11 12)))
  (test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (L one zero)) '(7 8 9))
  (test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (L one zero two)) 9)
  
  (test (let ((L '((1 2 3) (4 5 6)))) ((L one) two)) 6)
  (test (let ((L '((1 2 3) (4 5 6)))) (((L one) two) 3)) 'error)
  (test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) ((L one) zero)) '(7 8 9))
  (test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (((L one) zero) two)) 9)
  (test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) ((L one zero) two)) 9)
  (test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) ((L one) 0 two)) 9)
  
  (test (let ((L '((1 2 3) (4 5 6)))) (list-ref (L one) two)) 6)
  (test (let ((L '((1 2 3) (4 5 6)))) (list-ref ((L one) two) 3)) 'error)
  (test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (list-ref (L one) zero)) '(7 8 9))
  (test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) ((list-ref (L one) zero) two)) 9))


(test (list-ref () 0) 'error)
(test (list-ref (list 1 2) 2) 'error)
(test (list-ref (list 1 2) -1) 'error)
(test (list-ref (list 1 2) 1.3) 'error)
(test (list-ref (list 1 2) 1/3) 'error)
(test (list-ref (list 1 2) 1+2.0i) 'error)
(test (list-ref (cons 1 2) 1) 'error)
(test (list-ref (cons 1 2) 2) 'error)
(test (list-ref (list 1 2 3) (expt 2 32)) 'error)
(test (list-ref '(1 2 3) 1 2) 'error)
(test (list-ref) 'error)
(test (list-ref '(1 2)) 'error)
(test ('(0)) 'error)
(test ((0)) 'error)
(test (list-ref '((1 2) (3 4)) 1 1) 4)
(test ('(1 2 3) 1) 2)
(test ((list 1 2 3) 2) 3)
(test ((list)) 'error)
(test ((list 1) 0 0) 'error)
(test ((list 1 (list 2 3)) 1 1) 3)
(test ((append '(3) () '(1 2)) 0) 3)
(test ((append '(3) () 1) 0) 3)
(test ((append '(3) () 1) 1) 'error)
;; this works with 0 because:
(test ((cons 1 2) 0) 1)
(test (list-ref (cons 1 2) 0) 1)
(test (((list (list 1 2 3)) 0) 0) 1)
(test (((list (list 1 2 3)) 0) 1) 2)
(test (((list (list 1 2 3)) 0 1)) 'error) ; see below
(test (let ((lst (list (list 1 2 3)))) (lst 0 1)) 2) 
(test ((list (list 1 2 3)) 0 1) 2)
(test (list-ref (list (list 1 2)) 0 ()) 'error)
(test (((list +) 0) 1 2 3) 6)


(let ((lst (list 1 2)))
  (for-each
   (lambda (arg)
     (test (list-ref (list 1 2) arg) 'error)
     (test ((list 1 2) arg) 'error)
     (test (lst arg) 'error))
   (list "hi" (integer->char 65) #f '(1 2) () 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
	 3.14 3/4 1.0+1.0i #\f #t :hi (if #f #f) (lambda (a) (+ a 1)))))




;;; --------------------------------------------------------------------------------
;;; list-set!

(test (let ((x (list 1))) (list-set! x 0 2) x) (list 2))
(test (let ((x (cons 1 2))) (list-set! x 0 3) x) '(3 . 2))
(test (let ((x (cons 1 2))) (list-set! x 1 3) x) 'error)
(test (let ((x '((1) 2))) (list-set! x 0 1) x) '(1 2))
(test (let ((x '(1 2))) (list-set! x 1 (list 3 4)) x) '(1 (3 4)))
(test (let ((x ''foo)) (list-set! x 0 "hi") x ) '("hi" foo))
(test (let ((x (list 1 2))) (list-set! x 0 x) (list? x)) #t)
(test (let ((x (list 1 2))) (list-set! x 1 x) (list? x)) #t)
(test (let ((x 2) (lst '(1 2))) (list-set! (let () (set! x 3) lst) 1 23) (list x lst)) '(3 (1 23)))
(test (apply list-set! '((1 2) (3 2)) 1 '(1 2)) 2)

(test (list-set! '(1 2 3) 1 4) 4)
(test (set-car! '(1 2) 4) 4)
(test (set-cdr! '(1 2) 4) 4)
(test (fill! (list 1 2) 4) 4)
(test (fill! () 1) 1)
(test (list-set! '(1 2 . 3) 1 23) 23)
(test (list-set! '(1 2 . 3) 2 23) 'error)
(test (set! ('(1 2 . 3) 1) 23) 23)
(test (let ((lst '(1 2 3))) (list-set! lst 0 32)) 32)
(test (let ((lst '(1 2 3))) (set! (lst 0) 32)) 32)
(test (let ((lst '(1 2 3))) (set! (list-ref lst 0) 32)) 32)

(for-each
 (lambda (arg)
   (test (let ((x (list 1 2))) (list-set! x 0 arg) (list-ref x 0)) arg))
 (list "hi" (integer->char 65) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand (log 0) 
       3.14 3/4 1.0+1.0i #\f #t :hi (if #f #f) (lambda (a) (+ a 1))))

(test (let ((L '((1 2 3) (4 5 6)))) (list-set! L 1 32) L) '((1 2 3) 32))
(test (let ((L '((1 2 3) (4 5 6)))) (list-set! L 1 0 32) L) '((1 2 3) (32 5 6)))
(test (let ((L '((1 2 3) (4 5 6)))) (list-set! L 1 0 2 32) L) 'error)
(test (let ((L '((1 2 3) (4 5 6)))) (list-set! L 1 3 32) L) 'error)
(test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (list-set! L 1 32) L) '(((1 2 3) (4 5 6)) 32))
(test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (list-set! L 1 0 32) L) '(((1 2 3) (4 5 6)) (32 (10 11 12))))
(test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (list-set! L 1 0 2 32) L) '(((1 2 3) (4 5 6)) ((7 8 32) (10 11 12))))
(test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (list-set! L 1 0 2 1 32) L) 'error)
(test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (list-set! L 1 4 2 32) L) 'error)

(test (let ((L '((1 2 3) (4 5 6)))) (set! (L 1) 32) L) '((1 2 3) 32))
(test (let ((L '((1 2 3) (4 5 6)))) (set! (L 1 0) 32) L) '((1 2 3) (32 5 6)))
(test (let ((L '((1 2 3) (4 5 6)))) (set! (L 1 0 2) 32) L) 'error)
(test (let ((L '((1 2 3) (4 5 6)))) (set! (L 1 3) 32) L) 'error)
(test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (set! (L 1) 32) L) '(((1 2 3) (4 5 6)) 32))
(test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (set! (L 1 0) 32) L) '(((1 2 3) (4 5 6)) (32 (10 11 12))))
(test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (set! (L 1 0 2) 32) L) '(((1 2 3) (4 5 6)) ((7 8 32) (10 11 12))))
(test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (set! (L 1 0 2 1) 32) L) 'error)
(test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (set! (L 1 4 2) 32) L) 'error)

(test (let ((L '((1 2 3) (4 5 6)))) (set! ((L 1) 0) 32) L) '((1 2 3) (32 5 6)))
(test (let ((L '((1 2 3) (4 5 6)))) (set! (((L 1) 0) 2) 32) L) 'error)
(test (let ((L '((1 2 3) (4 5 6)))) (set! ((L 1) 3) 32) L) 'error)
(test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (set! ((L 1) 0) 32) L) '(((1 2 3) (4 5 6)) (32 (10 11 12))))
(test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (set! (((L 1) 0) 2) 32) L) '(((1 2 3) (4 5 6)) ((7 8 32) (10 11 12))))
(test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (set! ((((L 1) 0) 2) 1) 32) L) 'error)
(test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (set! (((L 1) 4) 2) 32) L) 'error)
(test (let ((L '(((1 2 3))))) (set! ((L 0) 0 1) 32) L) '(((1 32 3))))
(test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (set! ((L 1 0) 2) 32) L) '(((1 2 3) (4 5 6)) ((7 8 32) (10 11 12))))
(test (let ((L '((((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))) (13 14 15)))) (set! (L 0 0 1) 32) L) '((((1 2 3) 32) ((7 8 9) (10 11 12))) (13 14 15)))
(test (let ((L '((((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))) (13 14 15)))) (set! ((L 0) 0 1 2) 32) L) '((((1 2 3) (4 5 32)) ((7 8 9) (10 11 12))) (13 14 15)))
(test (let ((L '((((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))) (13 14 15)))) (set! ((L 0 0) 1 2) 32) L) '((((1 2 3) (4 5 32)) ((7 8 9) (10 11 12))) (13 14 15)))
(test (let ((L '((((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))) (13 14 15)))) (set! ((L 0 0 1) 2) 32) L) '((((1 2 3) (4 5 32)) ((7 8 9) (10 11 12))) (13 14 15)))
(test (let ((L '((((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))) (13 14 15)))) (set! (((L 0) 0) 1 2) 32) L) '((((1 2 3) (4 5 32)) ((7 8 9) (10 11 12))) (13 14 15)))
(test (let ((L '((((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))) (13 14 15)))) (set! (((L 0 0) 1) 2) 32) L) '((((1 2 3) (4 5 32)) ((7 8 9) (10 11 12))) (13 14 15)))
(test (let ((L '((((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))) (13 14 15)))) (set! ((((L 0) 0) 1) 2) 32) L) '((((1 2 3) (4 5 32)) ((7 8 9) (10 11 12))) (13 14 15)))
(test (let ((L '(1 2 3))) (let ((L1 (list L))) (set! ((car L1) 1) 32) L)) '(1 32 3))

(let ((zero 0)
      (one 1)
      (two 2)
      (three 3)
      (thirty-two 32))
  (test (let ((L '((1 2 3) (4 5 6)))) (list-set! L one thirty-two) L) '((1 2 3) 32))
  (test (let ((L '((1 2 3) (4 5 6)))) (list-set! L one zero thirty-two) L) '((1 2 3) (32 5 6)))
  (test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (list-set! L one thirty-two) L) '(((1 2 3) (4 5 6)) 32))
  (test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (list-set! L one zero thirty-two) L) '(((1 2 3) (4 5 6)) (32 (10 11 12))))
  (test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (list-set! L one zero two thirty-two) L) '(((1 2 3) (4 5 6)) ((7 8 32) (10 11 12))))
  
  (test (let ((L '((1 2 3) (4 5 6)))) (set! (L one) thirty-two) L) '((1 2 3) 32))
  (test (let ((L '((1 2 3) (4 5 6)))) (set! (L one zero) thirty-two) L) '((1 2 3) (32 5 6)))
  (test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (set! (L one) thirty-two) L) '(((1 2 3) (4 5 6)) 32))
  (test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (set! (L one zero) thirty-two) L) '(((1 2 3) (4 5 6)) (32 (10 11 12))))
  (test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (set! (L one zero two) thirty-two) L) '(((1 2 3) (4 5 6)) ((7 8 32) (10 11 12))))
  
  (test (let ((L '((1 2 3) (4 5 6)))) (set! ((L one) zero) thirty-two) L) '((1 2 3) (32 5 6)))
  (test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (set! ((L one) zero) thirty-two) L) '(((1 2 3) (4 5 6)) (32 (10 11 12))))
  (test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (set! (((L one) zero) two) thirty-two) L) '(((1 2 3) (4 5 6)) ((7 8 32) (10 11 12))))
  (test (let ((L '(((1 2 3))))) (set! ((L zero) zero one) thirty-two) L) '(((1 32 3))))
  (test (let ((L '(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (set! ((L one zero) two) thirty-two) L) '(((1 2 3) (4 5 6)) ((7 8 32) (10 11 12))))
  (test (let ((L '((((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))) (13 14 15)))) (set! (L zero zero one) thirty-two) L) '((((1 2 3) 32) ((7 8 9) (10 11 12))) (13 14 15)))
  (test (let ((L '((((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))) (13 14 15)))) (set! ((L zero) zero one two) thirty-two) L) '((((1 2 3) (4 5 32)) ((7 8 9) (10 11 12))) (13 14 15)))
  (test (let ((L '((((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))) (13 14 15)))) (set! ((L zero zero) one two) thirty-two) L) '((((1 2 3) (4 5 32)) ((7 8 9) (10 11 12))) (13 14 15)))
  (test (let ((L '((((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))) (13 14 15)))) (set! ((L zero 0 one) two) thirty-two) L) '((((1 2 3) (4 5 32)) ((7 8 9) (10 11 12))) (13 14 15)))
  (test (let ((L '((((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))) (13 14 15)))) (set! (((L zero) zero) one two) thirty-two) L) '((((1 2 3) (4 5 32)) ((7 8 9) (10 11 12))) (13 14 15)))
  (test (let ((L '((((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))) (13 14 15)))) (set! (((L zero zero) one) two) thirty-two) L) '((((1 2 3) (4 5 32)) ((7 8 9) (10 11 12))) (13 14 15)))
  (test (let ((L '((((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))) (13 14 15)))) (set! ((((L zero) zero) one) two) thirty-two) L) '((((1 2 3) (4 5 32)) ((7 8 9) (10 11 12))) (13 14 15)))
  (test (let ((L '(1 2 3))) (let ((L1 (list L))) (set! ((car L1) one) thirty-two) L)) '(1 32 3)))
  
(test (let ((x '(1)) (y '(2))) (set! ((if #t x y) 0) 32) (list x y)) '((32) (2)))
  
(test (list-set! () 0 1) 'error)
(test (list-set! () -1 1) 'error)
(test (list-set! '(1) 1 2) 'error)
(test (list-set! '(1 2 3) -1 2) 'error)
(test (list-set! '(1) 1.5 2) 'error)
(test (list-set! '(1) 3/2 2) 'error)
(test (list-set! '(1) 1+3i 2) 'error)
(test (list-set! '(1 2 3) 1 2 3) 'error)
(test (list-set! (list 1 2 3) (expt 2 32)  0) 'error)
(test (list-set! (list 1 2) () 1) 'error)

(for-each
 (lambda (arg)
   (test (list-set! (list 1 2) arg arg) 'error)
   (test (list-set! arg 1 2) 'error)
   (test (list-set! (list 1 2) arg 1) 'error))
 (list "hi" (integer->char 65) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #\f #t :hi (if #f #f) (lambda (a) (+ a 1))))



;;; --------------------------------------------------------------------------------
;;; list

(test (let ((tree1 (list 1 (list 1 2) (list (list 1 2 3)) (list (list (list 1 2 3 4)))))) tree1) '(1 (1 2) ((1 2 3)) (((1 2 3 4)))))
(test (let ((tree2 (list "one" (list "one" "two") (list (list "one" "two" "three"))))) tree2) '("one" ("one" "two") (("one" "two" "three"))))
(test (let ((tree1 (list 1 (list 1 2) (list 1 2 3) (list 1 2 3 4)))) tree1) '(1 (1 2) (1 2 3) (1 2 3 4)))
(test (let ((tree1 (list 1 (list 1 2))) (tree2 (list 1 (list 1 2)))) tree2) '(1 (1 2)))
(test (let ((tree1 (list 1 (list 1 2))) (tree2 (list 1 (list 1 2)))) (eqv? tree1 tree2)) #f)
(test (let ((tree1 (list ''a (list ''b ''c))) (tree2 (list ''a (list ''b ''c)))) tree2) '('a ('b 'c)))
(test (let ((lst (list 1 (list 2 3)))) lst) '(1 (2 3)))
(test (let* ((lst (list 1 (list 2 3))) (slst lst)) slst) '(1 (2 3)))
(test (list 1) '(1))
(test (let ((a 1)) (list a 2)) '(1 2))
(test (let ((a 1)) (list 'a '2)) '(a 2))
(test (let ((a 1)) (list 'a 2)) '(a 2))
(test (list) ())
(test (let ((a (list 1 2))) a) '(1 2))
(test (let ((a (list 1 2))) (list 3 4 'a (car (cons 'b 'c)) (+ 6 -2))) '(3 4 a b 4))
(test (list) ())
(test (length (list quote do map call/cc lambda define if begin set! let let* cond and or for-each)) 15)
(test (list 1(list 2)) '(1(2)))
(test (list 1 2 . 3) 'error)
;(test (list 1 2 , 3) 'error) ; ,3 -> 3 in the reader now
(test (list 1 2 ,@ 3) 'error)




;;; --------------------------------------------------------------------------------
;;; list-tail

(test (list-tail '(1 2 3) 0) '(1 2 3))
(test (list-tail '(1 2 3) 2) '(3))
(test (list-tail '(1 2 3) 3) ())
(test (list-tail '(1 2 3 . 4) 2) '(3 . 4))
(test (list-tail '(1 2 3 . 4) 3) 4)
(test (let ((x (list 1 2 3))) (eq? (list-tail x 2) (cddr x))) #t)
(test (list-tail () 0) ())
(test (list-tail () 1) 'error)
(test (list-tail '(1 2 3) 4) 'error)
(test (list-tail () -1) 'error)
(test (list-tail (list 1 2) 2) ())
(test (list-tail (cons 1 2) 0) '(1 . 2))
(test (list-tail (cons 1 2) 1) 2)
(test (list-tail (cons 1 2) 2) 'error)
(test (list-tail (cons 1 2) -1) 'error)
(test (list-tail ''foo 1) '(foo))
(test (list-tail '((1 2) (3 4)) 1) '((3 4)))
(test (list-tail (list-tail '(1 2 3) 1) 1) '(3))
(test (list-tail (list-tail (list-tail '(1 2 3 4) 1) 1) 1) '(4))
(test (list-tail '(1 2) (list-tail '(0 . 1) 1)) '(2))

(let ((x '(1 . 2))) (set-cdr! x x) (test (list-tail x 0) x))
(let ((x '(1 . 2))) (set-cdr! x x) (test (list-tail x 1) (cdr x)))
(let ((x '(1 . 2))) (set-cdr! x x) (test (list-tail x 100) x))

(let ((x (list 1 2 3)))
  (let ((y (list-tail x 1)))
    (set! (y 1) 32)
    (test (equal? y '(2 32)) #t)
    (test (equal? x '(1 2 32)) #t))) ; list-tail is not like substring

(for-each
 (lambda (name op1 op2)
   (for-each
    (lambda (lst)
      (let ((val1 (catch #t (lambda () (op1 lst)) (lambda args 'error)))
	    (val2 (catch #t (lambda () (op2 lst)) (lambda args 'error))))
	(if (not (equal? val1 val2))
	    (format #t ";(~A ~A) -> ~A ~A?~%" name lst val1 val2))))
    lists))
 (list 'list-tail:0 'list-tail:1 'list-tail:2 'list-tail:3 'list-tail:4)
 (list (lambda (l) l) cdr cddr cdddr cddddr)
 (list (lambda (l) (list-tail l 0)) (lambda (l) (list-tail l 1)) (lambda (l) (list-tail l 2)) (lambda (l) (list-tail l 3)) (lambda (l) (list-tail l 4))))

(test (list-tail (list 1 2) 3) 'error)
(test (list-tail (list 1 2) -1) 'error)
(test (list-tail (list 1 2) 1.3) 'error)
(test (list-tail (list 1 2) 1/3) 'error)
(test (list-tail (list 1 2) 1+2.0i) 'error)
(test (list-tail '(1 2 . 3)) 'error)
(test (list-tail '(1 2 . 3) 1) '(2 . 3))
(test (list-tail '(1 2 . 3) 0) '(1 2 . 3))
(test (list-tail (list 1 2 3) (+ 1 (expt 2 32))) 'error)
(test (list-tail) 'error)
(test (list-tail '(1)) 'error)
(test (list-tail '(1) 1 2) 'error)
(test (set! (list-tail (list 1 2 3)) '(32)) 'error) ; should this work?

(for-each
 (lambda (arg)
   (test (list-tail (list 1 2) arg) 'error)
   (test (list-tail arg 0) 'error))
 (list "hi" -1 3 most-negative-fixnum most-positive-fixnum 
       (integer->char 65) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #\f #t (if #f #f) #<eof> #() #(1 2 3) (lambda (a) (+ a 1))))


;;; --------------------------------------------------------------------------------
;;; make-list 

(test (make-list 0) ())
(test (make-list 0 123) ())
(test (make-list 1) '(#f))
(test (make-list 1 123) '(123))
(test (make-list 1 ()) '(()))
(test (make-list 2) '(#f #f))
(test (make-list 2 1) '(1 1))
(test (make-list 2/1 1) '(1 1))
(test (make-list 2 (make-list 1 1)) '((1) (1)))
(test (make-list -1) 'error)
(test (make-list -0) ())
(test (make-list most-negative-fixnum) 'error)
(test (make-list most-positive-fixnum) 'error)
(test (make-list 0 #\a) ())
(test (make-list 1 #\a) '(#\a))

(for-each
 (lambda (arg)
   (test (make-list arg) 'error))
 (list #\a #(1 2 3) 3.14 3/4 1.0+1.0i 0.0 1.0 () #t 'hi #(()) (list 1 2 3) '(1 . 2) "hi" (- (real-part (log 0.0)))))

(for-each
 (lambda (arg)
   (test ((make-list 1 arg) 0) arg))
 (list #\a #(1 2 3) 3.14 3/4 1.0+1.0i () #f 'hi #(()) (list 1 2 3) '(1 . 2) "hi"))

(test (make-list) 'error)
(test (make-list 1 2 3) 'error)
(test (let ((lst (make-list 2 (make-list 1 0)))) (eq? (lst 0) (lst 1))) #t)




;;; --------------------------------------------------------------------------------
;;; assq

(let ((e '((a 1) (b 2) (c 3))))
  (test (assq 'a e) '(a 1))
  (test (assq 'b e) '(b 2))
  (test (assq 'd e) #f))
(test (assq (list 'a) '(((a)) ((b)) ((c))))  #f)

(let ((xcons (cons 1 2))
      (xvect (vector 1 2))
      (xlambda (lambda () 1))
      (xstr "abs"))
  (let ((e (list (list #t 1) (list #f 2) (list 'a 3) (list xcons 4) (list xvect 5) (list xlambda 6) (list xstr 7) (list car 8))))
    (test (assq #t e) (list #t 1))
    (test (assq #f e) (list #f 2))
    (test (assq 'a e) (list 'a 3))
    (test (assq xcons e) (list xcons 4))
    (test (assq xvect e) (list xvect 5))
    (test (assq xlambda e) (list xlambda 6))
    (test (assq xstr e) (list xstr 7))
    (test (assq car e) (list car 8))))

(let ((e '((1+i 1) (3.0 2) (5/3 3))))
  (test (assq 1+i e) #f)
  (test (assq 3.0 e) #f)
  (test (assq 5/3 e) #f))

(test (assq 'x (cdr (assq 'a '((b . 32) (a . ((a . 12) (b . 32) (x . 1))) (c . 1))))) '(x . 1))

(test (assq #f '(#f 2 . 3)) #f)
(test (assq #f '((#f 2) . 3)) '(#f 2))
(test (assq () '((() 1) (#f 2))) '(() 1))
(test (assq () '((1) (#f 2))) #f)
(test (assq #() '((#f 1) (() 2) (#() 3))) #f)  ; (eq? #() #()) -> #f

(test (assq 'b '((a . 1) (b . 2) () (c . 3) #f)) '(b . 2))
(test (assq 'c '((a . 1) (b . 2) () (c . 3) #f)) '(c . 3))
(test (assq 'b '((a . 1) (b . 2) () (c . 3) . 4)) '(b . 2))
(test (assq 'c '((a . 1) (b . 2) () (c . 3) . 4)) '(c . 3))
(test (assq 'b (list '(a . 1) '(b . 2) () '(c . 3) #f)) '(b . 2))
(test (assq 'asdf (list '(a . 1) '(b . 2) () '(c . 3) #f)) #f)
(test (assq "" (list '("a" . 1) '("" . 2) '(#() . 3))) #f) ; since (eq? "" "") is #f
(test (assq 'a '((a . 1) (a . 2) (a . 3))) '(a . 1)) ; is this specified?
(test (assq 'a '((b . 1) (a . 2) (a . 3))) '(a . 2))

;; check the even/odd cases
(let ((odd '((3 . 1) (a . 2) (3.0 . 3) (b . 4) (3/4 . 5) (c . 6) (#(1) . 7) (d . 8)))
      (even '((e . 1) (3 . 2) (a . 3) (3.0 . 4) (b . 5) (3/4 . 6) (c . 7) (#(1) . 8) (d . 9))))
  (test (assq 'a odd) '(a . 2))
  (test (assq 'a even) '(a . 3))
  (test (assq 3/4 odd) #f)
  (test (assq 3/4 even) #f)
  (test (assq 3.0 odd) #f)
  (test (assq 3.0 even) #f)
  (test (assq #(1) odd) #f)
  (test (assq #(1) even) #f))



;;; --------------------------------------------------------------------------------
;;; assv

(test (assv 1 '(1 2 . 3)) #f)
(test (assv 1 '((1 2) . 3)) '(1 2))

(let ((e '((a 1) (b 2) (c 3))))
  (test (assv 'a e) '(a 1))
  (test (assv 'b e) '(b 2))
  (test (assv 'd e) #f))
(test (assv (list 'a) '(((a)) ((b)) ((c))))  #f)

(let ((xcons (cons 1 2))
      (xvect (vector 1 2))
      (xlambda (lambda () 1))
      (xstr "abs"))
  (let ((e (list (list #t 1) (list #f 2) (list 'a 3) (list xcons 4) (list xvect 5) (list xlambda 6) (list xstr 7) (list car 8))))
    (test (assv #t e) (list #t 1))
    (test (assv #f e) (list #f 2))
    (test (assv 'a e) (list 'a 3))
    (test (assv xcons e) (list xcons 4))
    (test (assv xvect e) (list xvect 5))
    (test (assv xlambda e) (list xlambda 6))
    (test (assv xstr e) (list xstr 7))
    (test (assv car e) (list car 8))))

(let ((e '((1+i 1) (3.0 2) (5/3 3) (#\a 4) ("hiho" 5))))
  (test (assv 1+i e) '(1+i 1))
  (test (assv 3.0 e) '(3.0 2))
  (test (assv 5/3 e) '(5/3 3))
  (test (assv #\a e) '(#\a 4))
  (test (assv "hiho" e) #f))

(let ((e '(((a) 1) (#(a) 2) ("c" 3))))
  (test (assv '(a) e) #f)
  (test (assv #(a) e) #f)
  (test (assv (string #\c) e) #f))

(let ((lst '((2 . a) (3 . b))))
  (set-cdr! (assv 3 lst) 'c)
  (test lst '((2 . a) (3 . c))))

(test (assv () '((() 1) (#f 2))) '(() 1))
(test (assv () '((1) (#f 2))) #f)
(test (assv #() '((#f 1) (() 2) (#() 3))) #f)  ; (eqv? #() #()) -> #f ??

(test (assv 'b '((a . 1) (b . 2) () (c . 3) #f)) '(b . 2))
(test (assv 'c '((a . 1) (b . 2) () (c . 3) #f)) '(c . 3))
(test (assv 'b '((a . 1) (b . 2) () (c . 3) . 4)) '(b . 2))
(test (assv 'c '((a . 1) (b . 2) () (c . 3) . 4)) '(c . 3))
(test (assv 'asdf '((a . 1) (b . 2) () (c . 3) . 4)) #f)
(test (assv 'd '((a . 1) (b . 2) () (c . 3) (d . 5))) '(d . 5))
(test (assv 'a '((a . 1) (a . 2) (a . 3))) '(a . 1)) ; is this specified?
(test (assv 'a '((b . 1) (a . 2) (a . 3))) '(a . 2))

(let ((odd '((3 . 1) (a . 2) (3.0 . 3) (b . 4) (3/4 . 5) (c . 6) (#(1) . 7) (d . 8)))
      (even '((e . 1) (3 . 2) (a . 3) (3.0 . 4) (b . 5) (3/4 . 6) (c . 7) (#(1) . 8) (d . 9))))
  (test (assv 'a odd) '(a . 2))
  (test (assv 'a even) '(a . 3))
  (test (assv 3 odd) '(3 . 1))
  (test (assv 3 even) '(3 . 2))
  (test (assv 3/4 odd) '(3/4 . 5))
  (test (assv 3/4 even) '(3/4 . 6))
  (test (assv 3.0 odd) '(3.0 . 3))
  (test (assv 3.0 even) '(3.0 . 4))
  (test (assv #(1) odd) #f)
  (test (assv #(1) even) #f))

(test (assv 1/0 '((1/0 . 1) (1.0 . 3))) #f)
(test (pair? (assv (real-part (log 0)) (list (cons 1/0 1) (cons (real-part (log 0)) 2) (cons -1 3)))) #t)
(test (pair? (assv (- (real-part (log 0))) (list (cons 1/0 1) (cons (real-part (log 0)) 2) (cons -1 3)))) #f)



;;; --------------------------------------------------------------------------------
;;; assoc

(let ((e '((a 1) (b 2) (c 3))))
  (test (assoc 'a e) '(a 1))
  (test (assoc 'b e) '(b 2))
  (test (assoc 'd e) #f))
(test (assoc (list 'a) '(((a)) ((b)) ((c))))  '((a)))

(let ((xcons (cons 1 2))
      (xvect (vector 1 2))
      (xlambda (lambda () 1))
      (xstr "abs"))
  (let ((e (list (list #t 1) (list #f 2) (list 'a 3) (list xcons 4) (list xvect 5) (list xlambda 6) (list xstr 7) (list car 8))))
    (test (assoc #t e) (list #t 1))
    (test (assoc #f e) (list #f 2))
    (test (assoc 'a e) (list 'a 3))
    (test (assoc xcons e) (list xcons 4))
    (test (assoc xvect e) (list xvect 5))
    (test (assoc xlambda e) (list xlambda 6))
    (test (assoc xstr e) (list xstr 7))
    (test (assoc car e) (list car 8))))

(let ((e '((1+i 1) (3.0 2) (5/3 3) (#\a 4) ("hiho" 5))))
  (test (assoc 1+i e) '(1+i 1))
  (test (assoc 3.0 e) '(3.0 2))
  (test (assoc 5/3 e) '(5/3 3))
  (test (assoc #\a e) '(#\a 4))
  (test (assoc "hiho" e) '("hiho" 5)))

(let ((e '(((a) 1) (#(a) 2) ("c" 3))))
  (test (assoc '(a) e) '((a) 1))
  (test (assoc #(a) e) '(#(a) 2))
  (test (assoc (string #\c) e) '("c" 3)))

(test (assoc 'a '((b c) (a u) (a i))) '(a u))
(test (assoc 'a '((b c) ((a) u) (a i))) '(a i))
(test (assoc (list 'a) '(((a)) ((b)) ((c))))  '((a)))
(test (assoc 5 '((2 3) (5 7) (11 13))) '(5 7))
(test (assoc 'key ()) #f)
(test (assoc 'key '(() ())) 'error)
(test (assoc () ()) #f)
(test (assoc 1 '((1 (2)) (((3) 4)))) '(1 (2)))
(test (assoc #f () 1/9223372036854775807) 'error)

(test (assoc () 1) 'error)
(test (assoc (cons 1 2) 1) 'error)
(test (assoc (let ((x (cons 1 2))) (set-cdr! x x)) 1) 'error)
(test (assoc '((1 2) .3) 1) 'error)
(test (assoc ''foo quote) 'error)
(test (assoc 3 '((a . 3)) abs =) 'error)
(test (assoc 1 '(1 2 . 3)) 'error)
(test (assoc 1 '((1 2) . 3)) '(1 2))
(test (assoc 1 '((1) (1 3) (1 . 2))) '(1))
(test (assoc 1 '((1 2 . 3) (1 . 2))) '(1 2 . 3))
(test (assoc '(((1 2))) '((1 2) ((1 2) 3) (((1 2) 3) 4) ((((1 2) 3) 4) 5))) #f)
(test (assoc '(((1 2))) '((1 2) ((1 2)) (((1 2))) ((((1 2)))))) '((((1 2)))))
(test (assoc 'a '((a . 1) (a . 2) (a . 3))) '(a . 1)) ; is this specified?
(test (assoc 'a '((b . 1) (a . 2) (a . 3))) '(a . 2))

(test (assoc () '((() 1) (#f 2))) '(() 1))
(test (assoc () '((1) (#f 2))) #f)
(test (assoc #() '((#f 1) (() 2) (#() 3))) '(#() 3))
(test (assoc #<unspecified> (list (cons (apply values ()) #f))) '(#<unspecified> . #f))

(for-each
 (lambda (arg)
   (test (assoc arg (list (list 1 2) (list arg 3))) (list arg 3)))
 (list "hi" (integer->char 65) #f 'a-symbol #() abs 3/4 #\f #t (if #f #f)))

(test (assoc 'b '((a . 1) (b . 2) () (c . 3) #f)) '(b . 2))
(test (assoc 'c '((a . 1) (b . 2) () (c . 3) #f)) '(c . 3))
(test (assoc 'b '((a . 1) (b . 2) () (c . 3) . 4)) '(b . 2))
(test (assoc 'c '((a . 1) (b . 2) () (c . 3) . 4)) '(c . 3))
(test (assoc 'c '((a . 1) (b . 2) () (c . 3) (c . 4) . 4)) '(c . 3))
(test (assoc 'asdf '((a . 1) (b . 2) () (c . 3) (c . 4) . 4)) #f)
(test (assoc "" (list '("a" . 1) '("" . 2) '(#() . 3))) '("" . 2))
(test (assoc assoc (list (cons abs 1) (cons assoc 2) (cons + 3))) (cons assoc 2))

(let ((odd '((3 . 1) (a . 2) (3.0 . 3) (b . 4) (3/4 . 5) (c . 6) (#(1) . 7) (d . 8)))
      (even '((e . 1) (3 . 2) (a . 3) (3.0 . 4) (b . 5) (3/4 . 6) (c . 7) (#(1) . 8) (d . 9))))
  (test (assoc 'a odd) '(a . 2))
  (test (assoc 'a even) '(a . 3))
  (test (assoc 3 odd) '(3 . 1))
  (test (assoc 3 even) '(3 . 2))
  (test (assoc 3/4 odd) '(3/4 . 5))
  (test (assoc 3/4 even) '(3/4 . 6))
  (test (assoc 3.0 odd =) '(3 . 1)) 
  (test (assoc 3.0 odd) '(3.0 . 3)) 
  (test (assoc 3.0 even) '(3.0 . 4))
  (test (assoc #(1) odd) '(#(1) . 7))
  (test (assoc #(1) even) '(#(1) . 8)))

(test (assoc 3 '((1 . a) (2 . b) (3 . c) (4 . d)) =) '(3 . c))
(test (assoc 3 '((1 . a) (2 . b) (31 . c) (4 . d)) =) #f)
(test (assoc 3 () =) #f)
(test (assoc 3.0 '((1 . a) (2 . b) (3 . c) (4 . d)) =) '(3 . c))
(test (assoc #\a '((#\A . 1) (#\b . 2)) char=?) #f)
(test (assoc #\a '((#\A . 1) (#\b . 2)) char-ci=?) '(#\A . 1))
(test (assoc #\a '((#\A . 1) (#\b . 2)) (lambda (a b) (char-ci=? a b))) '(#\A . 1))
(test (assoc 3 '((1 . a) (2 . b) (3 . c) (4 . d)) #(1)) 'error)
(test (assoc 3 '((1 . a) (2 . b) (3 . c) (4 . d)) abs) 'error)
(test (assoc 3 '((1 . a) (2 . b) (3 . c) (4 . d)) quasiquote) 'error)
(test (assoc 3 '((1 . a) (2 . b) (3 . c) (4 . d)) (lambda (a b c) (= a b))) 'error)
(test (assoc 3.0 '((1 . a) (2 . b) (3 . c) (4 . d)) (lambda* (a b c) (= a b))) '(3 . c))
(test (assoc 3 '((1 . a) (2 . b) (3 . c) (4 . d)) (lambda (a) (= a 1))) 'error)
(test (assoc 4.0 '((1 . a) (2 . b) (3 . c) (4 . d)) (dilambda = =)) '(4 . d))
(test (catch #t (lambda () (assoc 4.0 '((1 . a) (2 . b) (3 . c) (4 . d)) (lambda (a b) (error 'assoc a)))) (lambda args (car args))) 'assoc)
(test (call-with-exit (lambda (go) (assoc 4.0 '((1 . a) (2 . b) (3 . c) (4 . d)) (lambda (a b) (go 'assoc))))) 'assoc)
(test (assoc 3 '((#\a . 3) (#() . 2) (3.0 . 1) ("3" . 0))) #f)
(test (assoc 3 '((#\a . 3) (#() . 2) (3.0 . 1) ("3" . 0)) (lambda (a b) (= a b))) 'error)
(test (assoc 3 '((#\a . 3) (#() . 2) (3.0 . 1) ("3" . 0)) (lambda (a b) (and (number? b) (= a b)))) '(3.0 . 1)) ; is this order specified?
(test (let ((lst (list (cons 1 2) (cons 3 4) (cons 5 6)))) (set! (cdr (cdr lst)) lst) (assoc 3 lst)) '(3 . 4))
(test (let ((lst '((1 . 2) (3 . 4) . 5))) (assoc 3 lst)) '(3 . 4))
(test (let ((lst '((1 . 2) (3 . 4) . 5))) (assoc 5 lst)) #f)
(test (let ((lst '((1 . 2) (3 . 4) . 5))) (assoc 3 lst =)) '(3 . 4))
(test (let ((lst '((1 . 2) (3 . 4) . 5))) (assoc 5 lst =)) #f)
(test (assoc 3 '((1 . 2) . 3)) #f)
(test (assoc 1 '((1 . 2) . 3)) '(1 . 2))
(test (assoc 3 '((1 . 2) . 3) =) #f)
(test (assoc 1 '((1 . 2) . 3) =) '(1 . 2))
(test (let ((lst (list (cons 1 2) (cons 2 3) (cons 3 4)))) (and (assoc 2 lst =) lst)) '((1 . 2) (2 . 3) (3 . 4)))
(test (let ((lst (list (cons 1 2) (cons 2 3) (cons 3 4)))) (set! (cdr (cdr lst)) lst) (assoc 2 lst)) '(2 . 3))
(test (let ((lst (list (cons 1 2) (cons 2 3) (cons 3 4)))) (set! (cdr (cdr lst)) lst) (assoc 2 lst =)) '(2 . 3))
(test (let ((lst (list (cons 1 2) (cons 2 3) (cons 3 4)))) (set! (cdr (cdr lst)) lst) (assoc 4 lst)) #f)
(test (let ((lst (list (cons 1 2) (cons 2 3) (cons 3 4)))) (set! (cdr (cdr lst)) lst) (assoc 4 lst =)) #f)
(test (let ((lst (list (cons 1 2) (cons 2 3) (cons 3 4)))) (set! (cdr (cdr (cdr lst))) lst) (assoc 3 lst =)) '(3 . 4))
(test (assoc '(1 2) '((a . 3) ((1 2) . 4))) '((1 2) . 4))
(test (assoc '(1 2) '((a . 3) ((1 2) . (3 4)))) '((1 2) 3 4))
(test (assoc '(1 2) '((a . 3) ((1 2) . (3 . 4)))) '((1 2) 3 . 4))
(test (cdr (assoc '(1 2) '((a . 3) ((1 2) . (3 . 4))))) (cons 3 4))

(test (assoc #t (list 1 2) #()) 'error)
(test (assoc #t (list 1 2) (integer->char 127)) 'error)
(test (assoc #t (list 1 2) (lambda (x y) (+ x 1))) 'error) ; (+ #t 1)
(test (assoc #t (list 1 2) abs) 'error)
(test (assoc #t (list 1 2) (lambda args args)) 'error)
(test (assoc 1 '((3 . 2) 3) =) 'error)
(test (assoc 1 '((1 . 2) 3) =) '(1 . 2)) ; this is like other trailing error unchecked cases -- should we check?

(test (assoc 'a '((c 3) (a 1) (b 2)) (lambda (a) (eq? a b))) 'error)
(test (assoc 'a '((c 3) (a 1) (b 2)) (lambda (a b) (eq? a b))) '(a 1))
(test (assoc 'a '((c 3) (a 1) (b 2)) (lambda (a b c) (eq? a b))) 'error)
(test (assoc 'a '((c 3) (a 1) (b 2)) (lambda (a b c . d) (eq? a b))) 'error)
(test (assoc 'a '((c 3) (a 1) (b 2)) (lambda (a b . c) (eq? a b))) '(a 1))
(test (assoc 'a '((c 3) (a 1) (b 2)) (lambda a (apply eq? a))) '(a 1))
(test (assoc 'a '((c 3) (a 1) (b 2)) (lambda (a . b) (eq? a (car b)))) '(a 1))

(test (assoc 'a '((c 3) (a 1) (b 2)) (lambda* (a) (eq? a b))) 'error)
(test (assoc 'a '((c 3) (a 1) (b 2)) (lambda* (a b) (eq? a b))) '(a 1))
(test (assoc 'a '((c 3) (a 1) (b 2)) (lambda* (a b c) (eq? a b))) '(a 1))
(test (assoc 'a '((c 3) (a 1) (b 2)) (lambda* (a b c . d) (eq? a b))) '(a 1))
(test (assoc 'a '((c 3) (a 1) (b 2)) (lambda* (a b . c) (eq? a b))) '(a 1))
(test (assoc 'a '((c 3) (a 1) (b 2)) (lambda* a (apply eq? a))) '(a 1))
(test (assoc 'a '((c 3) (a 1) (b 2)) (lambda* (a . b) (eq? a (car b)))) '(a 1))
(test (assoc 'a '((c 3) (a 1) (b 2)) (lambda* (a :rest b) (eq? a (car b)))) '(a 1))
(test (assoc 'a '((c 3) (a 1) (b 2)) (lambda* (a :rest b :rest c) (eq? a (car b)))) '(a 1))
(test (assoc 'a '((c 3) (a 1) (b 2)) (lambda* (:rest a) (apply eq? a))) '(a 1))
(test (assoc 'a '((a 1) (b 2) (c 3)) (define-macro (_m_ a b) `(eq? ',a ',b))) '(a 1))
(test (assoc 'c '((a 1) (b 2) (c 3)) (define-macro (_m_ a b) `(eq? ',a ',b))) '(c 3))

(let ()
  (define (atest a b)
    (eq? a b))
  (atest 1 1)
  (let ((lst (list (cons 'a 1) (cons 'b 2))))
    (test (assoc 'b lst atest) '(b . 2))))

(for-each
  (lambda (arg lst)
    (test (assoc arg lst eq?) (assq arg lst))
    (test (assoc arg lst eqv?) (assv arg lst))
    (test (assoc arg lst equal?) (assoc arg lst)))
  (list 'a #f (list 'a) 'a 1 3/4 #(1) "hi")
  (list '((a . 1) (b . 2) (c . 3)) '((1 . 1) ("hi" . 2) (#t . 4) (#f . 5) (2 . 3)) 
	'((b . 1) ((a) . 2) (c . 3)) '((d . 1) (a . 2) (b . 4) . (c . 3)) 
	'((1 . 1) (3/4 . 2) (23 . 3)) '((a . 1) (1 . 2) (#(1) . 4) (23 . 3)) 
	'((1 . 1) ("hi" . 2) (23 . 3))))

(test (catch #t (lambda () (assoc 1 (list (list 3 2) (list 2)) (lambda (a b) (catch #t 1 cons)))) (lambda args 'error)) '(3 2))
(test (catch #t (lambda () (member 1 (list 3 2) (lambda (a b) (catch #t 1 cons)))) (lambda args 'error)) '(3 2))
;;; are those correct??  at least it doesn't die.


;;; --------------------------------------------------------------------------------
;;; memq

(test (memq 'a '(a b c)) '(a b c))
(test (memq 'a (list 'a 'b 'c)) '(a b c))
(test (memq 'b '(a b c)) '(b c))
(test (memq 'a '(b c d)) #f)
(test (memq (list 'a) '(b (a) c))  #f)
(test (memq 'a '(b a c a d a)) '(a c a d a))
(let ((v (vector 'a))) (test (memq v (list 'a 1.2 v "hi")) (list v "hi")))
(test (memq #f '(1 a #t "hi" #f 2)) '(#f 2))
(test (memq eq? (list 2 eqv? 1 eq?)) (list eq?))
(test (memq eq? (list 2 eqv? 2)) #f)
(test (memq 6 (memq 5 (memq 4 (memq 3 (memq 2 (memq 1 '(1 2 3 4 5 6))))))) '(6))
(test (memq 1/2 (list (/ 2.0) .5 1/2)) #f)
(test (memq 'a (cons 'a 'b)) '(a . b))
(test (memq) 'error)
(test (memq 'a) 'error)
(test (memq 'a 'b) 'error)
(test (memq 'a '(a b . c)) '(a b . c))
(test (memq 'b '(a b . c)) '(b . c))
(test (memq 'c '(a b . c)) #f) ; or should it be 'c?
(test (memq () '(1 () 3)) '(() 3))
(test (memq () '(1 2)) #f)
(test (memq 'a '(c d a b c)) '(a b c))
(test (memq 'a '(c d f b c)) #f)
(test (memq 'a ()) #f)
(test (memq 'a '(c d a b . c)) '(a b . c))
(test (memq 'a '(c d f b . c)) #f)
(test (memq #f '(1 "hi" #t)) #f)
(test (memq () ()) #f)
(test (memq () (list)) #f)
(test (memq () (list ())) '(()))
(test (let ((x (cons 1 2))) (memq x (list x (cons 3 4)))) '((1 . 2) (3 . 4)))
(test (pair? (let ((x (lambda () 1))) (memq x (list 1 2 x 3)))) #t)
(test (memq memq (list abs + memq car)) (list memq car))
(test (memq 'a '(a a a)) '(a a a)) ;?
(test (memq 'a '(b a a)) '(a a))
(test (memq "hi" '(1 "hi" 2)) #f)
(test (let ((str "hi")) (memq str (list 1 str 2))) '("hi" 2))
(test (memq #\a '(1 #f #\a 2)) '(#\a 2))

(test (let* ((x (vector 1 2 3)) (lst (list 1 "hi" x (vector 1 2)))) (memq x lst)) '(#(1 2 3) #(1 2)))
(test (let* ((x (vector 1 2 3)) (lst (list 1 "hi" (vector 1 2 3)))) (memq x lst)) #f)

(let ((odd '(3 a 3.0 b 3/4 c #(1) d))
      (even '(e 3 a 3.0 b 3/4 c #(1) d)))
  (test (memq 'a odd) '(a 3.0 b 3/4 c #(1) d))
  (test (memq 'a even) '(a 3.0 b 3/4 c #(1) d))
  (test (memq 3/4 odd) #f)
  (test (memq 3/4 even) #f)
  (test (memq 3.0 odd) #f)
  (test (memq 3.0 even) #f)
  (test (memq #(1) odd) #f)
  (test (memq #(1) even) #f))

;;; but (memq pi (list 1 pi 2)) -> '(3.1415926535898 2)

(test (memq (values #\a '(#\A 97 a))) #f)
(test (memq (values #\a '(#\A 97 #\a))) '(#\a))
(test (memq #\a (values #\a '(#\A 97 #\a))) 'error)
(test (memq #\a (values '(#\A 97 #\a))) '(#\a))
(test (memq #\a '(1 2) (values)) 'error) ; hmmm
(test ((values memq (values #\a '(#\A 97 #\a)))) '(#\a))




;;; --------------------------------------------------------------------------------
;;; memv

(test (memv 101 '(100 101 102)) '(101 102))
(test (memv 101 (list 100 101 102)) '(101 102))
(test (memv 3.4 '(1.2 2.3 3.4 4.5)) '(3.4 4.5))
(test (memv 3.4 '(1.3 2.5 3.7 4.9)) #f)
(test (memv 1/2 (list (/ 2.0) .5 1/2)) '(1/2))
(test (memv 1.0 '(1 2 3)) #f)
(test (memv 1/0 '(1/0 1.0 3)) #f)
(test (pair? (memv (real-part (log 0)) (list 1/0 (real-part (log 0)) -1))) #t)
(test (pair? (memv (- (real-part (log 0))) (list 1/0 (real-part (log 0)) -1))) #f)

(let ((ls (list 'a 'b 'c)))
  (set-car! (memv 'b ls) 'z)
  (test ls '(a z c)))
(test (memv 1 (cons 1 2)) '(1 . 2))
(test (memv 'a (list 'a 'b . 'c)) 'error)
(test (memv 'a '(a b . c)) '(a b . c))
(test (memv 'asdf '(a b . c)) #f)
(test (memv) 'error)
(test (memv 'a) 'error)
(test (memv 'a 'b) 'error)
(test (memv 'c '(a b c)) '(c))
(test (memv 'c '(a b . c)) #f)
(test (memv ''a '('a b c)) #f)
(test (let ((x (cons 1 2))) (memv x (list (cons 1 2) (cons 3 4)))) #f)
(test (let ((x (cons 1 2))) (memv x (list x (cons 3 4)))) '((1 . 2) (3 . 4)))
(test (memv 'a '(a a a)) '(a a a)) ;?
(test (memv 'a '(b a a)) '(a a))
(test (memv "hi" '(1 "hi" 2)) #f)
(test (memv #\a '(1 #f #\a 2)) '(#\a 2))
(test (memv cons (list car cdr cons +)) (list cons +))
(test (memv (apply values ()) (list #<unspecified>)) (list #<unspecified>))

(let ((odd '(3 a 3.0 b 3/4 c #(1) d))
      (even '(e 3 a 3.0 b 3/4 c #(1) d)))
  (test (memv 'a odd) '(a 3.0 b 3/4 c #(1) d))
  (test (memv 'a even) '(a 3.0 b 3/4 c #(1) d))
  (test (memv 3/4 odd) '(3/4 c #(1) d))
  (test (memv 3/4 even) '(3/4 c #(1) d))
  (test (memv 3.0 odd) '(3.0 b 3/4 c #(1) d))
  (test (memv 3.0 even) '(3.0 b 3/4 c #(1) d))
  (test (memv #(1) odd) #f)
  (test (memv #(1) even) #f))
(test (memv #(1) '(1 #(1) 2)) #f)
(test (memv () '(1 () 2)) '(() 2))
(test (let* ((x (vector 1 2 3)) (lst (list 1 "hi" x (vector 1 2)))) (memv x lst)) '(#(1 2 3) #(1 2)))
(test (let* ((x (vector 1 2 3)) (lst (list 1 "hi" (vector 1 2 3)))) (memv x lst)) #f)



;;; --------------------------------------------------------------------------------
;;; member

(test (member (list 'a) '(b (a) c)) '((a) c))
(test (member "b" '("a" "c" "b")) '("b"))
(test (member 1 '(3 2 1 4)) '(1 4))
(test (member 1 (list 3 2 1 4)) '(1 4))
(test (member car (list abs car modulo)) (list car modulo))
(test (member do (list quote map do)) (list do))
(test (member 5/2 (list 1/3 2/4 5/2)) '(5/2))
(test (member 'a '(a b c d)) '(a b c d))
(test (member 'b '(a b c d)) '(b c d))
(test (member 'c '(a b c d)) '(c d))
(test (member 'd '(a b c d)) '(d))
(test (member 'e '(a b c d)) #f)
(test (member 1 (cons 1 2)) '(1 . 2))
(test (member 1 '(1 2 . 3)) '(1 2 . 3))
(test (member 2 '(1 2 . 3)) '(2 . 3))
(test (member 3 '(1 2 . 3)) #f)
(test (member 4 '(1 2 . 3)) #f)
(test (member 1/2 (list (/ 2.0) .5 1/2)) '(1/2))
(test (member) 'error)
(test (member 'a) 'error)
(test (member 'a 'b) 'error)
(test (member () '(1 2 3)) #f)
(test (member () '(1 2 ())) '(()))
(test (member #() '(1 () 2 #() 3)) '(#() 3))
(test (member #2d((1 2) (3 4)) '(1 #() #2d((1 2) (1 2)))) #f)
(test (member #2d((1 2) (3 4)) '(1 #() #2d((1 2) (3 4)))) '(#2d((1 2) (3 4))))
(test (let ((x (cons 1 2))) (member x (list (cons 1 2) (cons 3 4)))) '((1 . 2) (3 . 4)))
(test (let ((x (list 1 2))) (member x (list (cons 1 2) (list 1 2)))) '((1 2)))
(test (member ''a '('a b c)) '('a b c))
(test (member 'a '(a a a)) '(a a a)) ;?
(test (member 'a '(b a a)) '(a a))
(test (member (member 3 '(1 2 3 4)) '((1 2) (2 3) (3 4) (4 5))) '((3 4) (4 5)))
(test (member "hi" '(1 "hi" 2)) '("hi" 2))
(test (member #\a '(1 #f #\a 2)) '(#\a 2))
(test (let* ((x (vector 1 2 3)) (lst (list 1 "hi" x (vector 1 2)))) (member x lst)) '(#(1 2 3) #(1 2)))
(test (let* ((x (vector 1 2 3)) (lst (list 1 "hi" (vector 1 2 3)))) (member x lst)) '(#(1 2 3)))

(for-each
 (lambda (arg)
   (test (member arg (list 1 2 arg 3)) (list arg 3)))
 (list "hi" (integer->char 65) #f 'a-symbol abs 3/4 #\f #t (if #f #f) '(1 2 (3 (4))) most-positive-fixnum))

(test (member 3 . (1 '(2 3))) 'error)
(test (member 3 '(1 2 3) = =) 'error)
(test (member 3 . ('(1 2 3))) '(3))
(test (member 3 . ('(1 2 3 . 4))) '(3 . 4))
(test (member . (3 '(1 2 3))) '(3))
(test (member '(1 2) '(1 2)) #f)
(test (member '(1 2) '((1 2))) '((1 2)))
(test (member . '(quote . ((quote)))) #f)
(test (member . '(quote . ((quote) .()))) #f)
(test (member '(((1))) '((((1).()).()).())) '((((1)))))
(test (member '((1)) '(1 (1) ((1)) (((1))))) '(((1)) (((1)))))
(test (member member (list abs car memq member +)) (list member +))
(test (member () () "") 'error)

(let ((odd '(3 a 3.0 b 3/4 c #(1) d))
      (even '(e 3 a 3.0 b 3/4 c #(1) d)))
  (test (member 'a odd) '(a 3.0 b 3/4 c #(1) d))
  (test (member 'a even) '(a 3.0 b 3/4 c #(1) d))
  (test (member 3/4 odd) '(3/4 c #(1) d))
  (test (member 3/4 even) '(3/4 c #(1) d))
  (test (member 3.0 odd) '(3.0 b 3/4 c #(1) d))
  (test (member 3.0 even) '(3.0 b 3/4 c #(1) d))
  (test (member #(1) odd) '(#(1) d))
  (test (member #(1) even) '(#(1) d)))

(test (member 3 '(1 2 3 4) =) '(3 4))
(test (member 3 () =) #f)
(test (member 3 '(1 2 4 5) =) #f)
(test (member 4.0 '(1 2 4 5) =) '(4 5))
(test (member #\a '(#\b #\A #\c) char=?) #f)
(test (member #\a '(#\b #\A #\c) char-ci=?) '(#\A #\c))
(test (member #\a '(#\b #\A #\c) (lambda (a b) (char-ci=? a b))) '(#\A #\c))
(test (char=? (car (member #\a '(#\b #\a))) #\a) #t)
(test (char=? (car (member #\a '(#\b #\a) (lambda (a b) (char=? a b)))) #\a) #t)
(test (member 3 '(1 2 3 4) <) '(4))
(test (member 3 '((1 2) (3 4)) member) '((3 4)))
(test (member 3 '(((1 . 2) (4 . 5)) ((3 . 4))) assoc) '(((3 . 4))))
(test (member '(#f #f #t) '(0 1 2) list-ref) '(2))
(test (let ((v (vector 1 2 3))) (member v (list 0 v) vector-fill!)) '(0 #(0 0 0)))

(test (member 3 '(1 2 3) abs) 'error)
(test (member 3 '(1 2 3) quasiquote) 'error)
(test (member 3 '(1 2 3) (lambda (a b c) (= a b))) 'error)
(test (member 3 '(1 2 3) (lambda* (a b c) (= a b))) '(3))
(test (member 3 '(1 2 3 4) (dilambda = =)) '(3 4))
(test (catch #t (lambda () (member 3 '(1 2 3) (lambda (a b) (error 'member a)))) (lambda args (car args))) 'member)
(test (call-with-exit (lambda (go) (member 3 '(1 2 3) (lambda (a b) (go 'member))))) 'member)
(test (member 'a '(a a a) eq?) '(a a a))
(test (member 'a '(b a a) eqv?) '(a a))
(test (member 3.0 '(1 #\a (3 . 3) abs #() 3+i)) #f)
(test (member 3.0 '(1 #\a (3 . 3) abs #() 3+i) (lambda (a b) (= (real-part a) b))) 'error)
(test (member 3.0 '(1 #\a (3 . 3) abs #() 3+i) (lambda (a b) (and (number? b) (= (real-part b) a)))) '(3+i))
;; is it guaranteed that in the comparison function the value is first and the list member 2nd?
(test (member 4 '((1 2 3) (4 5 6) (7 8 9)) member) '((4 5 6) (7 8 9)))
(test (member 4 '(1 2 3) member) 'error)
(test (member 4 '((1 2) (3 5) 7) (lambda (a b) (member a (map (lambda (c) (+ c 1)) b)))) '((3 5) 7))
(test (member 4 '((1 2) (3 5) 7) (lambda (a b) (assoc a (map (lambda (c) (cons (+ c 1) c)) b)))) '((3 5) 7))
(test (let ((f #f)) (member 'a '(a b c) (lambda (a b) (if (eq? b 'a) (set! f (lambda () b))) (eq? a 123))) (f)) 'a)
(test (let ((i 0) (f (make-vector 3))) (member 'a '(a b c) (lambda (a b) (vector-set! f i b) (set! i (+ i 1)) (eq? a 123))) f) #(a b c))
(test (member 1 '(0 1 2) (lambda (a b . c) (= a b))) '(1 2))
(test (member 1 '(0 1 2) (lambda* (a b c) (= a b))) '(1 2))
(test (member 1 '(0 1 2) (lambda (a) (= a b))) 'error)
(test (member 1 '(0 1 2) (lambda a (= (car a) (cadr a)))) '(1 2))

(test (member 'a '(c 3 a 1 b 2) (lambda (a) (eq? a b))) 'error)
(test (member 'a '(c 3 a 1 b 2) (lambda (a b) (eq? a b))) '(a 1 b 2))
(test (member 'a '(c 3 a 1 b 2) (lambda (a b c) (eq? a b))) 'error)
(test (member 'a '(c 3 a 1 b 2) (lambda (a b c . d) (eq? a b))) 'error)
(test (member 'a '(c 3 a 1 b 2) (lambda (a b . c) (eq? a b))) '(a 1 b 2))
(test (member 'a '(c 3 a 1 b 2) (lambda a (apply eq? a))) '(a 1 b 2))
(test (member 'a '(c 3 a 1 b 2) (lambda (a . b) (eq? a (car b)))) '(a 1 b 2))

(test (member 'a '(c 3 a 1 b 2) (lambda* (a) (eq? a b))) 'error)
(test (member 'a '(c 3 a 1 b 2) (lambda* (a b) (eq? a b))) '(a 1 b 2))
(test (member 'a '(c 3 a 1 b 2) (lambda* (a b c) (eq? a b))) '(a 1 b 2))
(test (member 'a '(c 3 a 1 b 2) (lambda* (a b c . d) (eq? a b))) '(a 1 b 2))
(test (member 'a '(c 3 a 1 b 2) (lambda* (a b . c) (eq? a b))) '(a 1 b 2))
(test (member 'a '(c 3 a 1 b 2) (lambda* a (apply eq? a))) '(a 1 b 2))
(test (member 'a '(c 3 a 1 b 2) (lambda* (a . b) (eq? a (car b)))) '(a 1 b 2))
(test (member 'a '(c 3 a 1 b 2) (lambda* (a :rest b) (eq? a (car b)))) '(a 1 b 2))
(test (member 'a '(c 3 a 1 b 2) (lambda* (a :rest b :rest c) (eq? a (car b)))) '(a 1 b 2))
(test (member 'a '(c 3 a 1 b 2) (lambda* (:rest a) (apply eq? a))) '(a 1 b 2))
(test (member 'a '(a b c) (define-macro (_m_ a b) `(eq? ',a ',b))) '(a b c))
(test (member 'c '(a b c) (define-macro (_m_ a b) `(eq? ',a ',b))) '(c))

(test (member 4 '(1 2 3 4 . 5)) '(4 . 5))
(test (member 4 '(1 2 3 4 . 5) =) '(4 . 5))
(test (member 4 '(1 2 3 . 4)) #f)
(test (member 4 '(1 2 3 . 4) =) #f)
(test (let ((lst (list 1 2 3))) (and (member 2 lst =) lst)) '(1 2 3))
(test (pair? (let ((lst (list 1 2 3))) (set! (cdr (cdr lst)) lst) (member 2 lst))) #t)
(test (pair? (let ((lst (list 1 2 3))) (set! (cdr (cdr lst)) lst) (member 2 lst =))) #t)
(test (let ((lst (list 1 2 3))) (set! (cdr (cdr lst)) lst) (member 4 lst)) #f)
(test (let ((lst (list 1 2 3))) (set! (cdr (cdr lst)) lst) (member 4 lst =)) #f)
(test (pair? (let ((lst (list 1 2 3))) (set! (cdr (cdr (cdr lst))) lst) (member 3 lst =))) #t)
(test (pair? (let ((lst (list 1 2 3 4))) (set! (cdr (cdr (cdr lst))) (cdr (cdr lst))) (member 3 lst =))) #t)
(test (let ((lst (list 1 2 3 4))) (set! (cdr (cdr (cdr lst))) (cdr (cdr lst))) (member 5 lst =)) #f)
(test (let ((lst (list 1 2 3 4))) (set! (cdr (cdr (cdr lst))) (cdr lst)) (member 4 lst =)) #f)
(test (let ((lst '(1 2 3 5 6 9 10))) (member 3 lst (let ((last (car lst))) (lambda (a b) (let ((result (= (- b last) a))) (set! last b) result))))) '(9 10))
(test (let ((lst '(1 2 3 5 6 9 10))) (member 2 lst (let ((last (car lst))) (lambda (a b) (let ((result (= (- b last) a))) (set! last b) result))))) '(5 6 9 10))
(test (member 1 () =) #f)
(test (member 1 #(1) =) 'error)
(test (member 3 '(5 4 3 2 1) >) '(2 1))
(test (member 3 '(5 4 3 2 1) >=) '(3 2 1))
(test (member '(1 2) '((1) (1 . 2) (1 2 . 3) (1 2 3) (1 2) 1 . 2)) '((1 2) 1 . 2))
(test (member '(1 2 . 3) '((1) (1 . 2) (1 2 . 3) (1 2 3) (1 2) 1 . 2)) '((1 2 . 3) (1 2 3) (1 2) 1 . 2))

(when with-block
  (test (member 1 (list 2 3) (lambda (a b) (float-vector? (block)))) '(2 3)))

(let ()
  (define (sfind obj lst)
    (member obj lst (lambda (a b)
		      (catch #t
			(lambda ()
			  (and (equal? a b)
			       (member obj lst (lambda (a b)
						 (catch #t
						   (lambda ()
						     (error 'oops))
						   (lambda args
						     (equal? a b)))))))
			(lambda args
			  'oops)))))
  (test (sfind 'a '(b c a d)) '(a d)))

(let ()
  (define-macro (do-list lst . body) 
    `(member #t ,(cadr lst) (lambda (a b) 
			      (let ((,(car lst) b)) 
				,@body 
				#f))))
  (let ((sum 0))
    (do-list (x '(1 2 3)) (set! sum (+ sum x)))
    (test (= sum 6) #t)))

(let ()
  (define (tree-member a lst) 
    (member a lst (lambda (c d) 
		    (if (pair? d) 
			(tree-member c d) 
			(equal? c d)))))
  (test (tree-member 1 '(2 3 (4 1) 5)) '((4 1) 5))
  (test (tree-member -1 '(2 3 (4 1) 5)) #f)
  (test (tree-member 1 '(2 3 ((4 (1) 5)))) '(((4 (1) 5)))))

(let ((lst (list 1 2 3)))
  (set! (cdr (cdr (cdr lst))) lst)
  (test (member 2 lst) (member 2 lst equal?)))

(let ((lst (list 1 2 3)))
  (set! (cdr (cdr (cdr lst))) lst)
  (test (member 4 lst) (member 4 lst equal?)))

(let ((lst (list 1 2 3 4)))
  (set! (cdr (cdr (cdr (cdr lst)))) lst)
  (test (member 4 lst) (member 4 lst equal?)))

(let ((lst (list 1 2 3 4)))
  (set! (cdr (cdr (cdr (cdr lst)))) (cdr lst))
  (test (member 4 lst) (member 4 lst equal?)))

(for-each
  (lambda (arg lst)
    (test (member arg lst eq?) (memq arg lst))
    (test (member arg lst eqv?) (memv arg lst))
    (test (member arg lst equal?) (member arg lst)))
  (list 'a #f (list 'a) 'a 1 3/4 #(1) "hi")
  (list '(a b c) '(1 "hi" #t #f 2) '(b (a) c) '(d a b . c) '(1 3/4 23) '(1 3/4 23) '(a 1 #(1) 23) '(1 "hi" 23)))

(for-each
 (lambda (op)
   (test (op) 'error)
   (for-each
    (lambda (arg)
      (let ((result (catch #t (lambda () (op arg)) (lambda args 'error))))
	(if (not (eq? result 'error))
	    (format #t ";(~A ~A) returned ~A?~%" op arg result))
	(test (op arg () arg) 'error)
	(test (op arg) 'error)))
    (list () "hi" (integer->char 65) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
	  3.14 3/4 1.0+1.0i #\f #t :hi (if #f #f) (lambda (a) (+ a 1)))))
 (list cons car cdr set-car! set-cdr! caar cadr cdar cddr caaar caadr cadar cdaar caddr cdddr cdadr cddar 
       caaaar caaadr caadar cadaar caaddr cadddr cadadr caddar cdaaar cdaadr cdadar cddaar cdaddr cddddr cddadr cdddar
       assq assv memq memv list-ref list-tail))

(for-each
 (lambda (op)
   (test (op '(1) '(2)) 'error))
 (list reverse car cdr caar cadr cdar cddr caaar caadr cadar cdaar caddr cdddr cdadr cddar 
       caaaar caaadr caadar cadaar caaddr cadddr cadadr caddar cdaaar cdaadr cdadar cddaar cdaddr cddddr cddadr cdddar
       list-ref list-tail list-set!))

(for-each
 (lambda (op)
   (for-each
    (lambda (arg)
      (let ((result (catch #t (lambda () (op #f arg)) (lambda args 'error))))
	(if (not (eq? result 'error))
	    (format #t ";(~A #f ~A) returned ~A?~%" op arg result))))
    (list "hi" (integer->char 65) #f 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
	  3.14 3/4 1.0+1.0i #\f #t :hi (if #f #f) (lambda (a) (+ a 1)))))
 (list assq assv assoc memq memv member))




;;; --------------------------------------------------------------------------------
;;; append

(test (append '(a b c) ()) '(a b c))
(test (append () '(a b c)) '(a b c))
(test (append '(a b) '(c d)) '(a b c d))
(test (append '(a b) 'c) '(a b . c))
(test (equal? (append (list 'a 'b 'c) (list 'd 'e 'f) () '(g)) '(a b c d e f g)) #t)
(test (append (list 'a 'b 'c) (list 'd 'e 'f) () (list 'g)) '(a b c d e f g))
(test (append (list 'a 'b 'c) 'd) '(a b c . d))
(test (append () ()) ())
(test (append () (list 'a 'b 'c)) '(a b c))
(test (append) ())
(test (append () 1) 1)
(test (append 'a) 'a)
(test (append '(x) '(y))  '(x y))
(test (append '(a) '(b c d)) '(a b c d))
(test (append '(a (b)) '((c)))  '(a (b) (c)))
(test (append '(a b) '(c . d))  '(a b c . d))
(test (append () 'a)  'a)
(test (append '(a b) (append (append '(c)) '(e) 'f)) '(a b c e . f))
(test (append ''foo 'foo) '(quote foo . foo))
(test (append () (cons 1 2)) '(1 . 2))
(test (append () () ()) ())
(test (append (cons 1 2)) '(1 . 2))
(test (append (list 1) 2) '(1 . 2))

(test (append #f) #f)
(test (append () #f) #f)
(test (append '(1 2) #f) '(1 2 . #f))
(test (append () () #f) #f)
(test (append () '(1 2) #f) '(1 2 . #f))
(test (append '(1 2) () #f) '(1 2 . #f))
(test (append '(1 2) '(3 4) #f) '(1 2 3 4 . #f))
(test (append () () () #f) #f)
(test (append '(1 2) '(3 4) '(5 6) #f) '(1 2 3 4 5 6 . #f))
(test (append () () #()) #())
(test (append () ((lambda () #f))) #f)

(test (append (begin) do) do)
(test (append if) if)
(test (append quote) quote)
(test (append 0) 0) ; is this correct?
(test (append () 0) 0)
(test (append () () 0) 0)
(test (let* ((x '(1 2 3)) (y (append x ()))) (eq? x y)) #f) ; check that append returns a new list
(test (let* ((x '(1 2 3)) (y (append x ()))) (equal? x y)) #t)
(test (let* ((x (list 1 2 3)) (y (append x (list)))) (eq? x y)) #f) 
(test (append '(1) 2) '(1 . 2))
(let ((x (list 1 2 3)))
  (let ((y (append x ())))
    (set-car! x 0)
    (test (= (car y) 1) #t)))
(let ((x (list 1 2 3)))
  (let ((y (append x ())))
    (set-cdr! x 0)
    (test (and (= (car y) 1)
	       (= (cadr y) 2)
	       (= (caddr y) 3))
	  #t)))

(test (let ((xx (list 1 2))) (recompose 12 (lambda (x) (append (list (car x)) (cdr x))) xx)) '(1 2))

(test (append 'a 'b) 'error)
(test (append 'a ()) 'error)
(test (append (cons 1 2) ()) 'error)
(test (append '(1) 2 '(3)) 'error)
(test (append '(1) 2 3) 'error)
(test (let ((lst (list 1 2 3))) (append lst lst)) '(1 2 3 1 2 3))
(test (append ''1 ''1) '(quote 1 quote 1))
(test (append '(1 2 . 3) '(4)) 'error)
(test (append '(1 2 . 3)) '(1 2 . 3))
(test (append '(4) '(1 2 . 3)) '(4 1 2 . 3))
(test (append () 12 . ()) 12)
(test (append '(1) 12) '(1 . 12))
(test (append '(1) 12 . ()) '(1 . 12))
(test (append () () '(1) 12) '(1 . 12))
(test (append '(1) '(2) '(3) 12) '(1 2 3 . 12))
(test (append '(((1))) '(((2)))) '(((1)) ((2))))
(test (append () . (2)) 2)
(test (append . (2)) 2)
(test (append ''() ()) ''())
(test (let ((i 1)) (logior 123 (append i))) 123) ; !

(for-each
 (lambda (arg)
   (test (append arg) arg)
   (test (append () arg) arg)
   (test (append () () () arg) arg))
 (list "hi" #\a #f 'a-symbol _ht_ _undef_ _null_ (make-vector 3) abs 1 3.14 3/4 1.0+1.0i #t #<unspecified> #<eof> () #() (list 1 2) (cons 1 2) #(0) (lambda (a) (+ a 1))))
(test (append not) not)

(test (let ((l0 (list 0))
	    (l1 (list 0)))
	(let ((m0 (append '(2) l0))
	      (m1 (append '(2) l1 '())))
	  (and (equal? l0 l1)
	       (equal? m0 m1)
	       (let ()
		 (list-set! m0 1 3)
		 (list-set! m1 1 3)
		 (list l0 l1)))))
      '((3) (0)))

;;; generic append
(test (append "asdasd" '("asd")) 'error)
(test (append "asdasd" #("asd")) 'error)
(test (append (string->byte-vector "asdasd") '("asd")) 'error)
(test (append (string->byte-vector "asdasd") #("asd")) 'error)

(test (let ((h1 (hash-table* 'a 1 'b 2)) (h2 (hash-table* 'c 3))) (append h1 h2)) (hash-table '(c . 3) '(a . 1) '(b . 2)))
(test (let ((i1 (inlet 'a 1)) (i2 (inlet 'b 2 'c 3))) (append i1 i2)) (inlet 'a 1 'c 3 'b 2))
(test (let ((s1 "abc") (s2 "def")) (append s1 s2)) "abcdef")
(test (let ((v1 #(0 1)) (v2 #(2 3))) (append v1 v2)) #(0 1 2 3))
(test (let ((p1 '(1 2)) (p2 '(3 4))) (append p1 p2)) '(1 2 3 4))
(test (vector? (append #())) #t)
(test (float-vector? (append (float-vector))) #t)
(test (int-vector? (append (int-vector))) #t)
(test (append "12" '(1 . 2) "3") 'error)
(for-each
 (lambda (arg)
   (test (append arg) arg)
   (test (append () arg) arg))
 (list "" #u8() () #() (int-vector) (float-vector) (inlet) (hash-table)
       "123" #u8(101 102) 
       '(1 2 3) '((e . 5) (f . 6)) 
       #(1 2 3) #((g . 8) (h . 9)) (int-vector 1 2 3) (float-vector 1 2 3)
       (inlet 'a 1 'b 2)
       (hash-table* 'c 3 'd 4)))
(test (append #u8() (int-vector 1 2 3)) #u8(1 2 3))
(test (append #u8() "123") #u8(49 50 51))
(test (append "" "123") "123")
(test (append #() (hash-table)) #())
(test (append #() #u8(101 102)) #(101 102))
(test (append (float-vector) #u8(101 102)) (float-vector 101.0 102.0))
(test (append (int-vector) #u8(101 102)) (int-vector 101 102))
(test (append (hash-table) '((e . 5) (f . 6))) (hash-table '(e . 5) '(f . 6)))
(test (append (inlet) #((g . 8) (h . 9))) (inlet 'g 8 'h 9))
(test (append '(1 2 3) #u8()) '(1 2 3 . #u8()))
(test (append '(1 2 3) #u8() #(4 5)) '(1 2 3 4 5))
(test (append '(1 2 3) #u8(101 102)) '(1 2 3 . #u8(101 102)))
(test (append '(1 2 3) #() (inlet 'a 1 'b 2)) '(1 2 3 (b . 2) (a . 1)))
(test (let ((lst (append '((e . 5) (f . 6)) "" (hash-table '(c . 3) '(d . 4)))))
	(or (equal? lst '((e . 5) (f . 6) (c . 3) (d . 4)))
	    (equal? lst '((e . 5) (f . 6) (d . 4) (c . 3))))) #t)
(test (append (list 1) "hi") '(1 . "hi"))
(test (append #(1 2 3) "123") #(1 2 3 #\1 #\2 #\3))
(test (append (int-vector 1 2 3) #(1 2 3)) (int-vector 1 2 3 1 2 3))
(test (append (int-vector 1 2 3) "123") (int-vector 1 2 3 49 50 51))
(test (append (float-vector 1.0 2.0 3.0) (int-vector 1 2 3)) (float-vector 1.0 2.0 3.0 1.0 2.0 3.0))
(test (append (int-vector 1 2 3) (float-vector 1.0 2.0 3.0)) (int-vector 1 2 3 1 2 3))
(test (append (inlet 'a 1 'b 2) '((e . 5) (f . 6))) (inlet 'b 2 'a 1 'e 5 'f 6))
(test (append (inlet 'a 1 'b 2) (hash-table '(c . 3) '(d . 4))) (inlet 'b 2 'a 1 'c 3 'd 4))
(test (append "" #() #u8(101 102)) "ef")
(test (append "" #u8(101 102) (hash-table)) "ef")
(test (append #u8() #() #u8(101 102)) #u8(101 102))
(test (append #u8() (inlet) "") #u8())
(test (append #u8() #u8(101 102) "123") #u8(101 102 49 50 51))
(test (append () "" (int-vector 1 2 3)) (int-vector 1 2 3))
(test (let ((v (append #() #u8() (hash-table '(c . 3) '(d . 4)))))
	(or (equal? v #((c . 3) (d . 4)))
	    (equal? v #((d . 4) (c . 3))))) #t)
(test (append #() #(1 2 3) (inlet)) #(1 2 3))
(test (append #() (float-vector 1.0 2.0 3.0) ()) #(1.0 2.0 3.0))
(test (append (float-vector) "" "123") (float-vector 49.0 50.0 51.0))
(test (append (float-vector) (int-vector 1 2 3) #u8(101 102)) (float-vector 1.0 2.0 3.0 101.0 102.0))
(test (append (inlet) #() #((g . 8) (h . 9))) (inlet 'g 8 'h 9))
(test (append (inlet) '((e . 5) (f . 6)) (hash-table '(c . 3) '(d . 4))) (inlet 'e 5 'f 6 'c 3 'd 4))
(test (append (hash-table) "" (inlet 'a 1 'b 2)) (hash-table '(b . 2) '(a . 1)))
(test (append (hash-table) '((e . 5) (f . 6)) (inlet 'a 1 'b 2)) (hash-table '(b . 2) '(e . 5) '(f . 6) '(a . 1)))
(test (append (hash-table) #((g . 8) (h . 9)) '((e . 5) (f . 6))) (hash-table '(e . 5) '(g . 8) '(f . 6) '(h . 9)))
(test (append "123" #u8(101 102) (hash-table)) "123ef")
(test (append #u8(101 102) #u8() #u8(101 102)) #u8(101 102 101 102))
(test (append #u8(101 102) "123" (int-vector 1 2 3)) #u8(101 102 49 50 51 1 2 3))
(test (append #u8(101 102) '(1 2 3) "") #u8(101 102 1 2 3))
(test (append '(1 2 3) #u8(101 102) #(1 2 3)) '(1 2 3 101 102 1 2 3))
(test (let ((lst (append '(1 2 3) (hash-table '(c . 3) '(d . 4)) "")))
	(or (equal? lst '(1 2 3 (c . 3) (d . 4)))
	    (equal? lst '(1 2 3 (d . 4) (c . 3))))) #t)
(test (append (int-vector 1 2 3) #u8(101 102) (float-vector 1.0 2.0 3.0)) (int-vector 1 2 3 101 102 1 2 3))
(test (append (int-vector 1 2 3) '(1 2 3) #u8(101 102)) (int-vector 1 2 3 1 2 3 101 102))
(test (append (hash-table '(c . 3) '(d . 4)) (hash-table '(c . 3) '(d . 4)) '((e . 5) (f . 6))) (hash-table '(e . 5) '(f . 6) '(c . 3) '(d . 4)))
(when with-block
  (test (append (block 1 2) (block 3 4)) (block 1 2 3 4))
  (test (let () (define (func) (append (list (list (list 1)) (setter car)) (vector-dimensions (block 0.0)))) (define (hi) (func)) (hi)) (list '((1)) set-car! 1)))

(test (random-state? (cdr (append '(1) (random-state 123)))) #t)
(test (append '(1) (random-state 123) ()) 'error)
(test (random-state? (append () (random-state 123))) #t)

(when full-test
  (let ((seqs (list "" #u8() () #() (int-vector) (float-vector) (inlet) (hash-table)
		    "123" #u8(101 102) 
		    '(1 2 3) '((e . 5) (f . 6)) 
		    #(1 2 3) #((g . 8) (h . 9)) (int-vector 1 2 3) (float-vector 1 2 3)
		    (inlet 'a 1 'b 2)
		    (hash-table* 'c 3 'd 4)
		    1 #f '(1 . 2) (let ((lst (list 1))) (set-cdr! lst lst)))))
    (define (test-append)
      (for-each
       (lambda (s1)
	 (catch #t 
	   (lambda () 
	     (append s1)
	     (for-each
	      (lambda (s2)
		(catch #t 
		  (lambda () 
		    (append s1 s2)
		    (for-each
		     (lambda (s3)
		       (catch #t 
			 (lambda () 
			   (append s1 s2 s3)
			   (for-each
			    (lambda (s4)
			      (catch #t 
				(lambda () 
				  (append s1 s2 s3 s4)
				  (for-each
				   (lambda (s5)
				     (catch #t (lambda () 
						 (append s1 s2 s3 s4 s5)) 
					    (lambda args 'error)))
				   seqs))
				(lambda args 'error)))
			    seqs))
			 (lambda args 'error)))
		     seqs))
		  (lambda args 'error)))
	      seqs))
	   (lambda args 'error)))
       seqs))
    (test-append)))


;;; tree-cyclic
(test (tree-cyclic? '(1 2)) #f)
(test (tree-cyclic? 1) #f)
(test (tree-cyclic? (let ((lst (list 1))) (set-cdr! lst lst))) #t)
(test (tree-cyclic? (let ((lst (list 1))) (set-car! lst lst))) #t)
(test (tree-cyclic? (let ((lst (list 1 2))) (set-cdr! (cdr lst) lst))) #t)
(test (tree-cyclic? (let ((lst (list (list 1 3) 2))) (set-cdr! (car lst) lst))) #t)
(test (tree-cyclic? (let ((lst (list (list 1 3) 2))) (set-car! (car lst) lst))) #t)
(test (tree-cyclic? (let ((lst (list 1 (list 1 3) 2))) (set-car! (cdr lst) lst))) #t)
(test (tree-cyclic? (let ((lst (list 1 (list 1 3) 2))) (set-cdr! (cdr lst) lst))) #t)
(test (tree-cyclic? (let ((lst (list 1 (list 1 3) 2))) (set-cdr! (cddr lst) lst))) #t)
(test (tree-cyclic? '(1 2 (3 4))) #f)
(test (tree-cyclic? '(1 . 2)) #f)
(test (tree-cyclic? '(1 2 . 3)) #f)
(test (tree-cyclic? (let ((lst (list 1 (list 1 3) 2))) (set-cdr! (cddr lst) lst) (list 1 lst))) #t)
(test (tree-cyclic? (let ((lst (list 1 (list 1 3) 2))) (set-cdr! (cddr lst) lst) (list 1 (cdr lst)))) #t)
(test (tree-cyclic? (let ((lst (list (cons 1 3) 2))) (set-cdr! (cdr lst) lst))) #t)
(test (tree-cyclic? (let ((lst (list (list 1 4) (cons 2 3)))) (set-cdr! (car lst) lst))) #t)
(test (tree-cyclic? (let ((lst (list (list 1 4) (cons 2 3)))) (set-cdr! (cadr lst) lst))) #t)
(test (tree-cyclic? (let ((lst (list (list 1 2) (list 3) (list 4 5 6)))) (set-car! (car lst) lst))) #t)
(test (tree-cyclic? (let ((lst (list (list 1 2) (list 3) (list 4 5 6)))) (set-car! (cdar lst) lst))) #t)
(test (tree-cyclic? (let ((lst (list (list 1 2) (list 3) (list 4 5 6)))) (set-cdr! (car lst) lst))) #t)
(test (tree-cyclic? (let ((lst (list (list 1 2) (list 3) (list 4 5 6)))) (set-cdr! (cdar lst) lst))) #t)
(test (tree-cyclic? (let ((lst (list (list 1 2) (list 3) (list 4 5 6)))) (set-car! (cadr lst) lst))) #t)
(test (tree-cyclic? (let ((lst (list (list 1 2) (list 3) (list 4 5 6)))) (set-cdr! (cadr lst) lst))) #t)
(test (tree-cyclic? (let ((lst (list (list 1 2) (list 3) (list 4 5 6)))) (set-car! (cadr lst) (cdr lst)))) #t)
(test (tree-cyclic? (let ((lst (list (list 1 2) (list 3) (list 4 5 6)))) (set-cdr! (cadr lst) (cdr lst)))) #t)
(test (tree-cyclic? (let ((lst (list (list 1 2) (list 3) (list 4 5 6)))) (set-car! (caddr lst) lst))) #t)
(test (tree-cyclic? (let ((lst (list (list 1 2) (list 3) (list 4 5 6)))) (set-cdr! (caddr lst) lst))) #t)
(test (tree-cyclic? (let ((lst (list (list 1 2) (list 3) (list 4 5 6)))) (set-car! (caddr lst) (cdr lst)))) #t)
(test (tree-cyclic? (let ((lst (list (list 1 2) (list 3) (list 4 5 6)))) (set-cdr! (caddr lst) (cdr lst)))) #t)
(test (tree-cyclic? (let ((lst (list (list 1 2) (list 3) (list 4 5 6)))) (set-car! (caddr lst) (cddr lst)))) #t)
(test (tree-cyclic? (let ((lst (list (list 1 2) (list 3) (list 4 5 6)))) (set-cdr! (caddr lst) (cddr lst)))) #t)
(test (tree-cyclic? (let ((lst (list (list 1 2) (list 3) (list 4 5 6)))) (set-car! (cdaddr lst) lst))) #t)
(test (tree-cyclic? (let ((lst (list (list 1 2) (list 3) (list 4 5 6)))) (set-cdr! (cdaddr lst) lst))) #t)
(test (tree-cyclic? (let ((lst (list (list 1 2) (list 3) (list 4 5 6)))) (set-car! (cdaddr lst) (cdr lst)))) #t)
(test (tree-cyclic? (let ((lst (list (list 1 2) (list 3) (list 4 5 6)))) (set-cdr! (cdaddr lst) (cdr lst)))) #t)
(test (tree-cyclic? (let ((lst (list (list 1 2) (list 3) (list 4 5 6)))) (set-car! (cdaddr lst) (cddr lst)))) #t)
(test (tree-cyclic? (let ((lst (list (list 1 2) (list 3) (list 4 5 6)))) (set-cdr! (cdaddr lst) (cddr lst)))) #t)

;;; tree-leaves
(test (tree-leaves '(lambda () 1)) 3)
(test (tree-leaves ()) 0)
(test (tree-leaves 1) 1)
(test (tree-leaves '(a . b)) 2)
(test (tree-leaves '(1 (2 3) (4 (5 . 6) . 7))) 7)
(test (tree-leaves '((() (1) (())))) 3)

;; tree-memq
(test (tree-memq 'a '(a b c)) #t)
(test (tree-memq 'a '(b c . a)) #t)
(test (tree-memq 'a '(b c . e)) #f)
(test (tree-memq 'a '(c b c)) #f)
(test (tree-memq 'a '(b c ((b a)))) #t)
(test (tree-memq 3 '(b c ((b 3)))) #t)

;;; tree-count
(test (tree-count 'x '(a b c)) 0)
(test (tree-count 'x '(a x c)) 1)
(test (tree-count 'x '(a x x)) 2)
(test (tree-count 'x '(a x x) 1) 1)
(test (tree-count 'x '(x x x) 2) 2)

;;; tree-set-memq
(test (tree-set-memq '(a b) '(1 (2 3 a) 4)) #t)
(test (tree-set-memq '(a b) '(1 (2 3 b) 4)) #t)
(test (tree-set-memq '(a b) '(1 (2 3 c) 4)) #f)
(test (tree-set-memq '(a) ()) #f)

(let-temporarily (((*s7* 'safety) 1))
  (test (tree-count 'a (let ((lst (list 1))) (set-cdr! lst lst))) 'error)
  (test (tree-leaves (let ((lst (list 1))) (set-cdr! lst lst))) 'error)
  (test (tree-memq 'a (let ((lst (list 1))) (set-cdr! lst lst))) 'error)
  (test (tree-set-memq '(a b c) (let ((lst (list 1))) (set-cdr! lst lst))) 'error))
  


;;; --------------------------------------------------------------------------------
;;; VECTORS
;;; --------------------------------------------------------------------------------


;;; --------------------------------------------------------------------------------
;;; vector?

(test (vector? (make-vector 6)) #t)
(test (vector? (make-vector 6 #\a)) #t)
(test (vector? (make-vector 0)) #t)
;; (test (vector? #*1011) #f)
(test (vector? #(0 (2 2 2 2) "Anna")) #t)
(test (vector? #()) #t)
(test (vector? #("hi")) #t)
(test (vector? (vector 1)) #t)
(test (let ((v (vector 1 2 3))) (vector? v)) #t)

(for-each
 (lambda (arg)
   (test (vector? arg) #f))
 (list #\a 1 () (list 1) '(1 . 2) #f "hi" 'a-symbol abs _ht_ _undef_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))

(test (vector?) 'error)
(test (vector? #() #(1)) 'error)
(test (vector? begin) #f)
(test (vector? vector?) #f)

;;; make a shared ref -- we'll check it later after enough has happened that an intervening GC is likely

(define check-shared-vector-after-gc #f)
(let ((avect (make-vector '(6 6) 32)))
  (do ((i 0 (+ i 1)))
      ((= i 6))
    (do ((j 0 (+ j 1)))
	((= j 6))
      (set! (avect i j) (cons i j))))
  (set! check-shared-vector-after-gc (avect 3)))

(if (not with-bignums)
    (test (vector? (make-float-vector 3 pi)) #t))
(test (vector? (make-vector 3 pi)) #t)
(test (vector? (make-shared-vector (make-int-vector '(2 3)) '(3 2))) #t)





;;; --------------------------------------------------------------------------------
;;; make-vector

(test (let ((v (make-vector 3 #f))) (and (vector? v) (= (vector-length v) 3) (eq? (vector-ref v 1) #f))) #t)
(test (let ((v (make-vector 1 1))) (and (vector? v) (= (vector-length v) 1) (vector-ref v 0))) 1)
(test (let ((v (make-vector 0 1))) (and (vector? v) (= (vector-length v) 0))) #t)
(test (do ((vec (make-vector 5)) (i 0 (+ i 1))) ((= i 5) vec) (vector-set! vec i i)) #(0 1 2 3 4))
(test (let ((v (make-vector 5))) (for-each (lambda (i) (vector-set! v i (* i i))) '(0 1 2 3 4)) v) #(0 1 4 9 16))
(test (make-vector 2 'hi) #(hi hi))
(test (make-vector 0) #())
(test (make-vector -0) #())
(test (make-vector 0 'hi) #())
(test (make-vector 3 (make-vector 1 'hi)) #(#(hi) #(hi) #(hi)))
(test (make-vector 3 #(hi)) #(#(hi) #(hi) #(hi)))
(test (make-vector 9/3 (list)) #(() () ()))
(test (make-vector 3/1 (make-vector 1 (make-vector 1 'hi))) #(#(#(hi)) #(#(hi)) #(#(hi))))
(test (make-float-vector 0 0.0) #())
(test (make-vector 0 0.0) #())

(test (let ((v (make-vector 3 0))) (set! (vector-ref v 1) 32) v) #(0 32 0))
(test (let ((v (make-int-vector 3))) (set! (vector-ref v 1) 0) v) (make-int-vector 3 0))

(for-each
 (lambda (arg)
   (test (vector-ref (make-vector 1 arg) 0) arg))
 (list #\a 1 () (list 1) '(1 . 2) #f "hi" 'a-symbol abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand (log 0) 
       3.14 3/4 1.0+1.0i #t (vector 1 2 3) (lambda (a) (+ a 1))))

(test (make-vector) 'error)
(test (make-vector 1 #f #t) 'error)
(test (make-vector 1 2 3) 'error)
(test (make-vector most-positive-fixnum) 'error)
(test (make-vector most-negative-fixnum) 'error)
(test (make-vector '(2 -2)) 'error)
(test (make-vector (list 2 -2 -3)) 'error)
(test (make-vector (cons 2 3)) 'error)
(test (make-vector '(2 3 . 4)) 'error)
(test (make-vector '(2 (3))) 'error)
(test (make-vector most-negative-fixnum) 'error)
(test (make-vector 3 0 #f 1) 'error)

(for-each
 (lambda (arg)
   (test (make-vector arg) 'error)
   (test (make-vector (list 2 arg)) 'error))
 (list #\a () -1 #f "hi" 'a-symbol abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t (vector 1 2 3) (lambda (a) (+ a 1))))

(test (eval-string "#2147483649D()") 'error)
(test (type-of (eval-string "#-9223372036854775808D()")) 'error)
(test (eval-string "#922D()") 'error)


;;; make-shared-vector
(test (let ((v1 #2d((1 2 3) (4 5 6)))) (let ((v2 (make-shared-vector v1 '(6)))) v2)) #(1 2 3 4 5 6))
(test (let ((v1 #(1 2 3 4 5 6))) (let ((v2 (make-shared-vector v1 '(3 2)))) v2)) #2D((1 2) (3 4) (5 6)))
(test (make-shared-vector #2d() '(0)) #())
(test (make-shared-vector '(1) '(1)) 'error)
(test (make-shared-vector #(1) '(2)) 'error)
(test (make-shared-vector #(1) '(1 2)) 'error)
(test (make-shared-vector #(1 2 3 4) ()) 'error)
(test (make-shared-vector #(1 2 3 4) most-positive-fixnum) 'error)
(test (make-shared-vector #(1 2 3 4) most-negative-fixnum) 'error)
(test (make-shared-vector #(1 2 3 4) -1) 'error)
(test (make-shared-vector #(1 2 3 4) 5) 'error)
(test (make-shared-vector #(1 2 3 4) 0) #())
(test (make-shared-vector #(1 2 3 4) '(2)) #(1 2))
(test (make-shared-vector #(1 2 3 4) '(2 1)) #2D((1) (2)))
(test (make-shared-vector #(1 2 3 4) '(0)) #())
(for-each
 (lambda (arg)
   (test (make-shared-vector arg) 'error)
   (test (make-shared-vector #(1 2 3) arg) 'error))
 (list #\a () -1 #f "hi" 'a-symbol abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t (vector 1 2 3) (lambda (a) (+ a 1))))

(let ((v #2d((1 2) (3 4))))
  (test (make-shared-vector v '((1 2) (3 4))) 'error)
  (test (make-shared-vector v ()) 'error)
  (test (make-shared-vector v '(1.4)) 'error)
  (test (make-shared-vector v '(14 15)) 'error)
  (test (make-shared-vector v (list most-positive-fixnum)) 'error)
  (test (make-shared-vector v '(-1 0)) 'error)
  (test (make-shared-vector v '(1) most-positive-fixnum) 'error))

(let ((v (float-vector 0.0 1.0 2.0)))
  (let ((v1 (make-shared-vector v (list 1 3))))
    (test (float-vector? v1) #t)
    (test (morally-equal? (v 0) (v1 0 0)) #t)))

(let ((v (int-vector 0 1 2)))
  (let ((v1 (make-shared-vector v (list 1 3))))
    (test (int-vector? v1) #t)
    (test (morally-equal? (v 0) (v1 0 0)) #t)))

(let ((v (make-int-vector 3)))
  (set! (v 1) 1)
  (set! (v 2) 2)
  (let ((v1 (make-shared-vector v (list 1 3))))
    (test (float-vector? v1) #f)
    (test (int-vector? v1) #t)
    (test (integer? (v1 0 2)) #t)
    (test (= (v 2) (v1 0 2)) #t)))

(let ((v (vector 0 1 2 3 4 5 6 7 8)))
  (test (make-shared-vector v (list 3 2) 1) #2D((1 2) (3 4) (5 6)))
  (test (make-shared-vector v (list 3 2) 2) #2D((2 3) (4 5) (6 7)))
  (test (make-shared-vector v (list 3) 2) #(2 3 4))
  (test (make-shared-vector v (list 3) 0) (make-shared-vector v (list 3)))
  (test (make-shared-vector v (list 3) -1) 'error)
  (test (make-shared-vector v (list 3) 10) 'error)
  (test (make-shared-vector v (list 3) 3.2) 'error)
  (test (make-shared-vector v (list 3) "0") 'error)
  )

(test (make-shared-vector (make-shared-vector (float-vector 1.0 2.0 3.0 4.0) '(2 2)) '(0)) #())
(test (make-shared-vector (make-shared-vector (float-vector 1.0 2.0 3.0 4.0) '(2 2)) '(1)) (float-vector 1.0))
(test ((make-shared-vector (make-shared-vector (float-vector 1.0 2.0 3.0 4.0) '(2 2)) '(4 1)) 2 0) 3.0)

(let-temporarily (((*s7* 'print-length) 123123123))
  (test (object->string (make-vector 2048 #f)) "(make-vector 2048 #f)")
  (test (object->string (make-vector '(12 2048) #<unspecified>)) "(make-vector '(12 2048) #<unspecified>)")
  (test (object->string (make-float-vector 2048 1.0)) "(make-float-vector 2048 1)")
  (test (object->string (make-int-vector 2048 32)) "(make-int-vector 2048 32)")
  (test (object->string (make-int-vector '(12 2048) 2)) "(make-int-vector '(12 2048) 2)")
  (test (object->string (make-string 20000)) "(make-string 20000 #\\space)")
  (test (object->string (make-byte-vector 2000 12)) "(make-byte-vector 2000 12)"))

(when with-bignums
  (let ((v (float-vector (bignum "1.0") (bignum "2.0"))))
    (test (float-vector? v) #t)
    (test (v 0) 1.0)))

(test (vector? (float-vector)) #t)
(test (vector? (int-vector)) #t)
(when with-block (test (float-vector? _c_obj_) #t))
(test (float-vector? 1 2) 'error)
(test (float-vector?) 'error)
(test (int-vector? 1 2) 'error)
(test (int-vector?) 'error)
(for-each
 (lambda (arg)
   (if (float-vector? arg) (format *stderr* ";~A is a float-vector?~%" arg))
   (test (float-vector arg) 'error)
   (if (int-vector? arg) (format *stderr* ";~A is an int-vector?~%" arg))
   (test (int-vector arg) 'error))
 (list #\a () #f "hi" 'a-symbol abs _ht_ _undef_ _null_ quasiquote macroexpand #() #t (vector 1 2 3) (lambda (a) (+ a 1))))
 

;;; make-float-vector
(test (float-vector? (make-float-vector 3)) #t)
(test (float-vector? (make-float-vector 3 pi)) #t)
(test ((make-float-vector 3) 1) 0.0)
(test (float-vector? (float-vector)) #t)
(test (float-vector? (make-float-vector 0)) #t)
(test (float-vector? (int-vector)) #f)
(test (equal? (float-vector) (int-vector)) #t)
(test (equal? (vector) (int-vector)) #t)

(test (equal? (make-float-vector 3 1.0) (float-vector 1.0 1.0 1.0)) #t)
(test (equal? (make-float-vector 3 1/2) (float-vector 0.5 0.5 0.5)) #t)
(test ((make-float-vector '(2 3) 2.0) 1 2) 2.0)
(test (nan? ((make-float-vector 3 1/0) 0)) #t)
(for-each
 (lambda (arg)
   (test (make-float-vector arg) 'error)
   (test (make-float-vector 3 arg) 'error))
 (list #\a () #f "hi" 'a-symbol abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand (log 0) 1.0+1.0i #t (vector 1 2 3) (lambda (a) (+ a 1))))
(test (equal? (vector) (float-vector)) #t)
(test (float-vector? (make-float-vector 3 0)) #t)
(test (float-vector? (make-float-vector 3 1/2)) #t)
(test (float-vector? #r(1.0)) #t)


;;; make-int-vector
(test (int-vector? (make-int-vector 3)) #t)
(test (int-vector? (make-int-vector 3 2)) #t)
(test ((make-int-vector 3) 1) 0)
(test (int-vector? (int-vector)) #t)
(test (int-vector? (make-int-vector 0)) #t)
(test (int-vector? (float-vector)) #f)
(test (int-vector? (vector)) #f)
(test (int-vector? #i(1)) #t)

(test (equal? (make-int-vector 3 1) (int-vector 1 1 1)) #t)
(test ((make-int-vector '(2 3) 2) 1 2) 2)
(for-each
 (lambda (arg)
   (test (make-int-vector arg) 'error)
   (test (make-int-vector 3 arg) 'error))
 (list #\a () #f "hi" 'a-symbol abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand (log 0) 1.0+1.0i 1/2 pi #t (vector 1 2 3) (lambda (a) (+ a 1))))
(test (equal? (vector) (int-vector)) #t)

(test (catch #t
	(lambda () (make-float-vector 3.0))
	(lambda args
	  (let ((type (car args))
		(errmsg (apply format #f (cadr args))))
	    (list type errmsg))))
      '(wrong-type-arg "make-float-vector argument 1, 3.0, is a real but should be an integer or a list of integers"))

(test (catch #t
	(lambda () (make-int-vector 3.0))
	(lambda args
	  (let ((type (car args))
		(errmsg (apply format #f (cadr args))))
	    (list type errmsg))))
      '(wrong-type-arg "make-int-vector argument 1, 3.0, is a real but should be an integer or a list of integers"))

(test (catch #t
	(lambda () (make-vector 3.0))
	(lambda args
	  (let ((type (car args))
		(errmsg (apply format #f (cadr args))))
	    (list type errmsg))))
      '(wrong-type-arg "make-vector argument 1, 3.0, is a real but should be an integer or a list of integers"))


;;; float-vector-ref
;;; float-vector-set!

(test (float-vector-ref (float-vector 1.0 2.0) 1) 2.0)
(for-each
 (lambda (arg)
   (test (float-vector-ref arg 0) 'error)
   (test (float-vector-ref (float-vector 1.0) arg) 'error))
 (list #\a () #f "hi" 'a-symbol abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand (log 0) 1.0+1.0i #t (vector 1 2 3) (lambda (a) (+ a 1))))
(let ((v (make-float-vector (list 2 3) 1.0))
      (v1 (make-float-vector 3)))
  (set! (v 1 1) 2.0)
  (test (v 1 1) 2.0)
  (test (v 0 1) 1.0)
  (test (float-vector-ref v 1 1) 2.0)
  (test (float-vector-ref #r2d((1 2) (3 4)) 1 1) 4.0)
  (test (float-vector-ref v 0) (float-vector 1.0 1.0 1.0))
  (test (float-vector-set! v 0 0 3.0) 3.0)
  (test (float-vector-ref v 0 0) 3.0)
  (test (float-vector-ref v1 3) 'error)
  (test (float-vector-ref v 1 3) 'error)
  (test (float-vector-ref v 2 2) 'error)
  (test (float-vector-ref v1 most-positive-fixnum) 'error)
  (test (float-vector-ref v1 most-negative-fixnum) 'error)
  (test (float-vector-set! v1 3 0.0) 'error)
  (test (float-vector-set! v 1 3 0.0) 'error)
  (test (float-vector-set! v 2 2 0.0) 'error)
  (test (float-vector-set! v1 most-positive-fixnum 0.0) 'error)
  (test (float-vector-set! v1 most-negative-fixnum 0.0) 'error)
  (test (float-vector-set! v1 0 0+i) 'error)
  (for-each
   (lambda (arg)
     (test (float-vector-ref v 0 arg) 'error)
     (test (float-vector-set! arg 0 1.0) 'error)
     (test (float-vector-set! v1 arg) 'error)
     (test (float-vector-set! v1 0 arg) 'error)
     (test (float-vector-set! v 0 arg 1.0) 'error))
   (list #\a () #f "hi" 1+i 'a-symbol abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand #t (vector 1 2 3) (lambda (a) (+ a 1))))
  (test (float-vector-ref v) 'error)
  (test (float-vector-set! v) 'error)
  (test (float-vector-ref v1 0 1) 'error)
  (test (float-vector-ref v 0 1 0) 'error)
  (test (float-vector-ref v1 -1) 'error)
  (float-vector-set! v1 0 2/5)
  (test (float-vector-ref v1 0) 0.4)
  (test (float-vector-set! v1 1 4.0) 4.0)
  (test (float-vector-ref v1 1) 4.0)
  (test (float-vector-ref v 3 0) 'error)
  (test (float-vector-ref v 1 3) 'error)
  (test (fill! v 0.0) 0.0))
(test (float-vector-ref (float-vector) 0) 'error)
(let ((v (float-vector 1 2 3)))
  (set! (float-vector-ref v 1) 32)
  (test v (float-vector 1 32 3))
  (set! (v 0) 64)
  (test v (float-vector 64 32 3))
  (test (float-vector-set! v 2 (float-vector-set! v 1 0.0)) 0.0)
  (test v (float-vector 64 0 0)))
(let ((v0 (make-float-vector '(3 0)))
      (v1 (make-float-vector '(0 3)))
      (v2 (make-float-vector '(2 3)))
      (v3 (make-float-vector '(1 3)))
      (v4 (make-float-vector '(3 1))))
  (test (float-vector? v0) #t)
  (test (float-vector-ref v0 0 0) 'error)
  (test (vector? v0) #t)
  (test (vector-ref v0 0 0) 'error)
  (test (v0 0 0) 'error)
  (test (float-vector? v1) #t)
  (test (float-vector-ref v1 0 0) 'error)
  (test (vector? v1) #t)
  (test (vector-ref v1 0 0) 'error)
  (test (v1 0 0) 'error)
  (test (equal? v0 v1) #f)
  (test (float-vector? (float-vector-ref v2 1)) #t)
  (test (float-vector-set! v2 1 32.0) 'error)
  (test (float-vector-set! (float-vector-ref v2 1) 1 32.0) 32.0)
  (test (float-vector-ref v2 1 1) 32.0)
  (test (float-vector-ref v3 0) (float-vector 0 0 0))
  (test (float-vector-ref v4 0) (float-vector 0))
  )
(let ()
  (define (hi) (let ((v2 (make-float-vector '(2 3)))) (float-vector-set! v2 1 12.0) v2))
  (test (hi) 'error))

(let () ; regression test for optimizer safe_c_opcq_opcq bug 
  (define (fx n x y)
    (make-float-vector (if x (+ n 1) n)
		       (if y 0 (/ pi 2))))
  (test (morally-equal? (fx 3 #f #f) (make-float-vector 3 (/ pi 2))) #t)
  (test (morally-equal? (fx 3 #f #t) (make-float-vector 3)) #t)
  (test (morally-equal? (fx 3 #t #f) (make-float-vector 4 (/ pi 2))) #t)
  (test (morally-equal? (fx 3 #t #t) (make-float-vector 4)) #t)

  (define (fx1 n x y)
    (make-float-vector (if x (+ n 1) (- n 1))
		       (if y (* pi 2) (/ pi 2))))
  (test (morally-equal? (fx1 3 #f #f) (make-float-vector 2 (/ pi 2))) #t)
  (test (morally-equal? (fx1 3 #f #t) (make-float-vector 2 (* pi 2))) #t)
  (test (morally-equal? (fx1 3 #t #f) (make-float-vector 4 (/ pi 2))) #t)
  (test (morally-equal? (fx1 3 #t #t) (make-float-vector 4 (* pi 2))) #t)

  (define (fx2 n x y)
    (make-float-vector (if x (+ n 1) n)
		       (if y (* pi 2) 0.0)))
  (test (morally-equal? (fx2 3 #f #f) (make-float-vector 3)) #t)
  (test (morally-equal? (fx2 3 #f #t) (make-float-vector 3 (* pi 2))) #t)
  (test (morally-equal? (fx2 3 #t #f) (make-float-vector 4)) #t)
  (test (morally-equal? (fx2 3 #t #t) (make-float-vector 4 (* pi 2))) #t)

  (define (fx3 n y) ; same for safe_c_opssq_opcq
    (make-float-vector (+ n n)
		       (if y 0.0 (/ pi 2))))
  (test (morally-equal? (fx3 3 #f) (make-float-vector 6 (/ pi 2))) #t)
  (test (morally-equal? (fx3 3 #t) (make-float-vector 6)) #t)
  )



;;; int-vector-ref
;;; int-vector-set!

(test (int-vector-ref (int-vector 1 2) 1) 2)
(for-each
 (lambda (arg)
   (test (int-vector-ref arg 0) 'error)
   (test (int-vector-ref (int-vector 1) arg) 'error))
 (list #\a () #f "hi" 'a-symbol abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand (log 0) 1.0+1.0i #t (vector 1 2 3) (lambda (a) (+ a 1))))
(let ((v (make-int-vector (list 2 3) 1))
      (v1 (make-int-vector 3)))
  (set! (v 1 1) 2)
  (test (v 1 1) 2)
  (test (v 0 1) 1)
  (test (int-vector-ref v 1 1) 2)
  (test (int-vector-ref #i2d((1 2) (3 4)) 1 1) 4)
  (test (int-vector-ref v 0) (int-vector 1 1 1))
  (test (int-vector-set! v 0 0 3) 3)
  (test (int-vector-ref v 0 0) 3)
  (test (int-vector-ref v1 3) 'error)
  (test (int-vector-ref v 1 3) 'error)
  (test (int-vector-ref v 2 2) 'error)
  (test (int-vector-ref v1 most-positive-fixnum) 'error)
  (test (int-vector-ref v1 most-negative-fixnum) 'error)
  (test (int-vector-set! v1 3 0) 'error)
  (test (int-vector-set! v 1 3 0) 'error)
  (test (int-vector-set! v 2 2 0) 'error)
  (test (int-vector-set! v1 most-positive-fixnum 0) 'error)
  (test (int-vector-set! v1 most-negative-fixnum 0) 'error)
  (test (int-vector-set! v1 0 0+i) 'error)
  (for-each
   (lambda (arg)
     (test (int-vector-ref v 0 arg) 'error)
     (test (int-vector-set! arg 0 1) 'error)
     (test (int-vector-set! v1 arg) 'error)
     (test (int-vector-set! v1 0 arg) 'error)
     (test (int-vector-set! v 0 arg 1) 'error))
   (list #\a () #f "hi" 1+i 'a-symbol abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand #t (vector 1 2 3) (lambda (a) (+ a 1))))
  (test (int-vector-ref v) 'error)
  (test (int-vector-set! v) 'error)
  (test (int-vector-ref v1 0 1) 'error)
  (test (int-vector-ref v 0 1 0) 'error)
  (test (int-vector-ref v1 -1) 'error)
  (int-vector-set! v1 0 2)
  (test (int-vector-ref v1 0) 2)
  (test (int-vector-set! v1 1 4) 4)
  (test (int-vector-ref v1 1) 4)
  (test (int-vector-ref v 3 0) 'error)
  (test (int-vector-ref v 1 3) 'error)
  (test (fill! v 0) 0))
(test (int-vector-ref (int-vector) 0) 'error)
(let ((v (int-vector 1 2 3)))
  (set! (int-vector-ref v 1) 32)
  (test v (int-vector 1 32 3))
  (set! (v 0) 64)
  (test v (int-vector 64 32 3))
  (test (int-vector-set! v 2 (int-vector-set! v 1 0)) 0)
  (test v (int-vector 64 0 0)))
(let ((v0 (make-int-vector '(3 0)))
      (v1 (make-int-vector '(0 3)))
      (v2 (make-int-vector '(2 3)))
      (v3 (make-int-vector '(1 3)))
      (v4 (make-int-vector '(3 1))))
  (test (int-vector? v0) #t)
  (test (int-vector-ref v0 0 0) 'error)
  (test (vector? v0) #t)
  (test (vector-ref v0 0 0) 'error)
  (test (v0 0 0) 'error)
  (test (int-vector? v1) #t)
  (test (int-vector-ref v1 0 0) 'error)
  (test (vector? v1) #t)
  (test (vector-ref v1 0 0) 'error)
  (test (v1 0 0) 'error)
  (test (equal? v0 v1) #f)
  (test (int-vector? (int-vector-ref v2 1)) #t)
  (test (int-vector-set! v2 1 32) 'error)
  (test (int-vector-set! (int-vector-ref v2 1) 1 32) 32)
  (test (int-vector-ref v2 1 1) 32)
  (test (int-vector-ref v3 0) (int-vector 0 0 0))
  (test (int-vector-ref v4 0) (int-vector 0))
  )
(let ()
  (define (hi) (let ((v2 (make-int-vector '(2 3)))) (int-vector-set! v2 1 12) v2))
  (test (hi) 'error))

(let ()
  (define (f1)
    (let ((x (float-vector 0.0)))
      (set! (x 0) (complex 1 2))))
  (test (let ((x (float-vector 0.0))) (set! (x 0) 1+i)) 'error)
  (test (f1) 'error)

  (define (f2)
    (let ((x (int-vector 0)))
      (int-vector-set! x 0 (complex 1 2))))
  (test (let ((x (int-vector 0))) (set! (x 0) 0+i)) 'error)
  (test (f2) 'error)

  (define (f3)
    (let ((x (float-vector 0.0)))
      (float-vector-set! x 0 (complex 1 2))))
  (test (f3) 'error)

  (define (f4)
    (let ((x (int-vector 0)))
      (set! (x 0) (complex 1 2))))
  (test (f4) 'error))

(when with-bignums
  (test (int-vector 1 (bignum "2")) #i(1 2))
  (test (float-vector 1.0 (bignum "2.0")) #r(1.0 2.0)))


;;; --------------------------------------------------------------------------------
;;; vector

(test (vector 1 2 3) #(1 2 3))
(test (vector 1 '(2) 3) #(1 (2) 3))
(test (vector) #())
(test (vector (vector (vector))) #(#(#())))
(test (vector (vector) (vector) (vector)) #(#() #() #()))
(test (vector (list)) #(()))
(test #(1 #\a "hi" hi) (vector 1 #\a "hi" 'hi))
(test (let ((v (make-vector 4 "hi")))
	(vector-set! v 0 1)
	(vector-set! v 1 #\a)
	(vector-set! v 3 'hi)
	v)
      #(1 #\a "hi" hi))
(let ((x 34))
  (test (vector x 'x) #(34 x)))

(for-each
 (lambda (arg)
   (test (vector-ref (vector arg) 0) arg))
 (list #\a 1 () (list 1) '(1 . 2) #f "hi" 'a-symbol abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand (log 0) 
       3.14 3/4 1.0+1.0i #t (vector 1 2 3) (lambda (a) (+ a 1))))
(test (vector 1 . 2) 'error)
(test (apply vector (cons 1 2)) 'error)



;;; --------------------------------------------------------------------------------
;;; vector->list
;;; list->vector

(test (vector->list #(0)) (list 0))
(test (vector->list (vector)) ())
(test (vector->list #(a b c)) '(a b c))
(test (vector->list #(#(0) #(1))) '(#(0) #(1)))
(test (vector? (list-ref (let ((v (vector 1 2))) (vector-set! v 1 v) (vector->list v)) 1)) #t)
(test (vector->list #i(1 2)) '(1 2))

(test (list->vector ()) #())
(test (list->vector '(a b c)) #(a b c))
(test (list->vector (list (list 1 2) (list 3 4))) #((1 2) (3 4)))
(test (list->vector ''foo) #(quote foo))
(test (list->vector (list)) #())
(test (list->vector (list 1)) #(1))
(test (list->vector (list (list))) #(()))
(test (list->vector (list 1 #\a "hi" 'hi)) #(1 #\a "hi" hi))
(test (list->vector ''1) #(quote 1))
(test (list->vector '''1) #(quote '1))

(for-each
 (lambda (arg)
   (if (proper-list? arg)
       (test (vector->list (list->vector arg)) arg)))
 lists)
(set! lists ())

(test (list->vector (vector->list (vector))) #())
(test (list->vector (vector->list (vector 1))) #(1))
(test (vector->list (list->vector (list))) ())
(test (vector->list (list->vector (list 1))) '(1))

(test (reinvert 12 vector->list list->vector #(1 2 3)) #(1 2 3))

(test (vector->list) 'error)
(test (list->vector) 'error)
(test (vector->list #(1) #(2)) 'error)
(test (list->vector '(1) '(2)) 'error)

(for-each
 (lambda (arg)
   (test (vector->list arg) 'error))
 (list #\a 1 () (list 1) '(1 . 2) #f 'a-symbol "hi" abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))

(test (let ((x (cons #\a #\b))) (set-cdr! x x) (list->vector x)) 'error)
(test (list->vector (cons 1 2)) 'error)
(test (list->vector '(1 2 . 3)) 'error)
(test (let ((lst (list #\a #\b))) (set! (cdr (cdr lst)) lst) (list->vector lst)) 'error)
(test (let ((lst (list #\a #\b))) (set! (cdr (cdr lst)) lst) (apply vector lst)) 'error)

(for-each
 (lambda (arg)
   (test (list->vector arg) 'error))
 (list "hi" #\a 1 '(1 . 2) (cons #\a #\b) 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))

(test (vector->list #(1 2 3 4) 0) '(1 2 3 4))
(test (vector->list #(1 2 3 4) 2) '(3 4))
(test (vector->list #(1 2 3 4) 0 4) '(1 2 3 4))
(test (vector->list #(1 2 3 4) 4 4) ())
(test (vector->list #(1 2 3 4) 1 2) '(2))

(test (vector->list #(1 2 3 4) -1 4) 'error)
(test (vector->list #(1 2 3 4) 1 0) 'error)
(test (vector->list #(1 2 3 4) 5) 'error)
(test (vector->list #(1 2 3 4) 1 5) 'error)
(test (vector->list #(1 2 3 4) 1 2 3) 'error)

(test (vector->list #() 0 10) 'error)
(test (vector->list #(1) 0 2) 'error)
(test (vector->list #() 0 0) ())
(test (vector->list #(1) 1) ())
(test (vector->list #(1) 0) '(1))
(test (vector->list #() #\null) 'error)
(test (vector->list #() 0 #\null) 'error)
(test (vector->list #() -1) 'error)
(test (vector->list #(1) -1) 'error)
(test (vector->list #(1) 0 -1) 'error)
(test (vector->list #(1) -2 -1) 'error)
(test (vector->list #(1) most-negative-fixnum) 'error)
(test (vector->list #(1) 2) 'error)

(test (vector->list (make-int-vector 3)) '(0 0 0))
(test (vector->list (make-float-vector 3)) '(0.0 0.0 0.0))

(for-each
 (lambda (arg)
   (test (vector->list #(0 1 2 3 4 5) arg) 'error)
   (test (vector->list #(0 1 2 3 4 5) 1 arg) 'error))
 (list #\a "hi" () (list 1) '(1 . 2) 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))



;;; --------------------------------------------------------------------------------
;;; vector-length

(test (vector-length (vector)) 0)
(test (vector-length (vector 1)) 1)
(test (vector-length (make-vector 128)) 128)
(test (vector-length #(a b c d e f)) 6)
(test (vector-length #()) 0)
(test (vector-length (vector #\a (list 1 2) (vector 1 2))) 3)
(test (vector-length #(#(#(hi)) #(#(hi)) #(#(hi)))) 3)
(test (vector-length (vector 1 2 3 4)) 4)
(test (vector-length (let ((v (vector 1 2))) (vector-set! v 1 v) v)) 2)
(test (vector-length (let ((v (vector 1 2))) (vector-set! v 1 v) (vector-ref v 1))) 2)
(test (vector-length (make-int-vector 3 0)) 3)
(if (not with-bignums) (test (vector-length (make-float-vector 3 pi)) 3))
(if (not with-bignums) (test (vector-length (make-float-vector '(2 3) pi)) 6))
(test (vector-length #r(1 2)) 2)

(test (vector-length) 'error)
(test (vector-length #(1) #(2)) 'error)

(for-each
 (lambda (arg)
   (test (vector-length arg) 'error))
 (list "hi" #\a 1 () '(1 . 2) (cons #\a #\b) #f 'a-symbol abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))




;;; --------------------------------------------------------------------------------
;;; vector-ref

(test (vector-ref #(1 1 2 3 5 8 13 21) 5) 8)
(test (vector-ref #(1 1 2 3 5 8 13 21) (let ((i (round (* 2 (acos -1))))) (if (inexact? i) (inexact->exact i)  i))) 13)
(test (let ((v (make-vector 1 0))) (vector-ref v 0)) 0)
(test (let ((v (vector 1 (list 2) (make-vector 3 #\a)))) (vector-ref v 1)) (list 2))
(test (let ((v (vector 1 (list 2) (make-vector 3 #\a)))) (vector-ref v 2)) #(#\a #\a #\a))
(test (let ((v (vector 1 (list 2) (make-vector 3 #\a)))) (vector-ref (vector-ref v 2) 1)) #\a)
(test (vector-ref #(a b c) 1) 'b)
(test (vector-ref #(()) 0) ())
(test (vector-ref #(#()) 0) #())
(test (vector-ref (vector-ref (vector-ref #(1 (2) #(3 (4) #(5))) 2) 2) 0) 5)
(test (let ((v (vector 1 2))) (vector-set! v 1 v) (eq? (vector-ref v 1) v)) #t)
(test (let ((v (make-int-vector 3))) (vector-ref v 1)) 0)
(test (let ((v (make-vector 3 0))) (vector-ref v 1)) 0)
(test (let ((v (make-float-vector 3 1.0))) (vector-ref v 1)) 1.0)
(test (let ((v (make-int-vector 6 0))) (vector-set! v 3 32) (let ((v1 (make-shared-vector v '(2 3)))) (vector-ref v1 1 0))) 32)

(test (vector-ref) 'error)
(test (vector-ref #(1)) 'error)
(test (vector-ref #(1) 0 0) 'error)
(test (vector-ref () 0) 'error)

(test (let ((v (make-vector 1 0))) (vector-ref v 1)) 'error)
(test (let ((v (make-vector 1 0))) (vector-ref v -1)) 'error)
(test (let ((v (vector 1 (list 2) (make-vector 3 #\a)))) (vector-ref (vector-ref v 2) 3)) 'error)
(test (let ((v (vector 1 (list 2) (make-vector 3 #\a)))) (vector-ref (vector-ref v 3) 0)) 'error)
(test (vector-ref (vector) 0) 'error)
(test (vector-ref #() 0) 'error)
(test (vector-ref #() -1) 'error)
(test (vector-ref #() 1) 'error)
(test (vector-ref #(1 2 3) (floor .1)) 1)
(test (vector-ref #(1 2 3) (floor 0+0i)) 1)
(test (vector-ref #10D((((((((((0 1)))))))))) 0 0 0 0 0 0 0 0 0 1) 1)

(test (#(1 2) 1) 2)
(test (#(1 2) 1 2) 'error)
(test ((#("hi" "ho") 0) 1) #\i)
(test (((vector (list 1 2) (cons 3 4)) 0) 1) 2)
(test ((#(#(1 2) #(3 4)) 0) 1) 2)
(test ((((vector (vector (vector 1 2) 0) 0) 0) 0) 0) 1)
(test ((((list (list (list 1 2) 0) 0) 0) 0) 0) 1)
(test ((((list (list (list 1 2) 0) 0) 0) 0) ((((vector (vector (vector 1 2) 0) 0) 0) 0) 0)) 2)
(test (#(1 2) -1) 'error)
(test (#()) 'error)
(test (#(1)) 'error)
(test (#2d((1 2) (3 4))) 'error)
(test (apply (make-vector '(1 2))) 'error)

(test (type-of (eval-string "#2/3d(1 2)")) 'error)
(test (type-of (eval-string "#2.1d(1 2)")) 'error)
(test (eval-string "#(1 2 . 3)") 'error)
(test (#(#(#(#t))) 0 0 0) #t)
(test (let ((v (make-vector 3 0 #t))) (v 0 0)) 'error)
(test (let ((v (make-int-vector '(2 2)))) (v 0 0 0)) 'error)
(test (let ((v (make-float-vector 3))) (vector-ref v 0 0)) 'error)
(test (let ((v (make-vector '(2 2) 0.0 #t))) (vector-ref v 0 0 0)) 'error)
(test (let ((v (make-vector 3 0))) (v 0 0)) 'error)
(test (let ((v (make-vector '(2 2) 0))) (v 0 0 0)) 'error)

(let ((v #(1 2 3)))
  (for-each
   (lambda (arg)
     ; (format *stderr* "~A~%" arg)
     (test (vector-ref arg 0) 'error)
     (test (v arg) 'error)
     (test (v arg 0) 'error)
     (test (vector-ref v arg) 'error)
     (test (vector-ref v arg 0) 'error)
     (test (vector-ref #2d((1 2) (3 4)) 0 arg) 'error))
   (list "hi" () #() #\a -1 '(1 . 2) (cons #\a #\b) #f 'a-symbol abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
	 3.14 3/4 1.0+1.0i #t (lambda (a) (+ a 1)) (make-hash-table))))


(test (vector-ref #(#(1 2 3) #(4 5 6)) 1) #(4 5 6))
(test (vector-ref #(#(1 2 3) #(4 5 6)) 1 2) 6)
(test (vector-ref #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))) 1) #(#(7 8 9) #(10 11 12)))
(test (vector-ref #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))) 1 0) #(7 8 9))
(test (vector-ref #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))) 1 0 2) 9)
(test (vector-ref #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))) 1 0 3) 'error)
(test (vector-ref #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))) 1 0 2 0) 'error)

(test (#(#(1 2 3) #(4 5 6)) 1) #(4 5 6))
(test (#(#(1 2 3) #(4 5 6)) 1 2) 6)
(test (#(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))) 1) #(#(7 8 9) #(10 11 12)))
(test (#(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))) 1 0) #(7 8 9))
(test (#(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))) 1 0 2) 9)
(test (#(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))) 1 0 3) 'error)
(test (#(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))) 1 0 2 0) 'error)

(test (let ((L #(#(1 2 3) #(4 5 6)))) (L 1)) #(4 5 6))
(test (let ((L #(#(1 2 3) #(4 5 6)))) (L 1 2)) 6)
(test (let ((L #(#(1 2 3) #(4 5 6)))) (L 1 2 3)) 'error)
(test (let ((L #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))))) (L 1)) #(#(7 8 9) #(10 11 12)))
(test (let ((L #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))))) (L 1 0)) #(7 8 9))
(test (let ((L #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))))) (L 1 0 2)) 9)
(test (let ((L #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))))) (L 1 0 2 3)) 'error)

(test (let ((L #(#(1 2 3) #(4 5 6)))) ((L 1) 2)) 6)
(test (let ((L #(#(1 2 3) #(4 5 6)))) (((L 1) 2) 3)) 'error)
(test (let ((L #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))))) ((L 1) 0)) #(7 8 9))
(test (let ((L #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))))) (((L 1) 0) 2)) 9)
(test (let ((L #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))))) ((L 1 0) 2)) 9)
(test (let ((L #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))))) ((L 1) 0 2)) 9)
(test (let ((L #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))))) ((((L 1) 0) 2) 3)) 'error)

(test (let ((L #(#(1 2 3) #(4 5 6)))) (vector-ref (L 1) 2)) 6)
(test (let ((L #(#(1 2 3) #(4 5 6)))) (vector-ref ((L 1) 2) 3)) 'error)
(test (let ((L #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))))) (vector-ref (L 1) 0)) #(7 8 9))
(test (let ((L #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))))) ((vector-ref (L 1) 0) 2)) 9)
(test (let ((L #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))))) (vector-ref (((L 1) 0) 2) 3)) 'error)


(let ((zero 0)
      (one 1)
      (two 2)
      (three 3)
      (thirty-two 32))
  (test (vector-ref #(#(1 2 3) #(4 5 6)) one) #(4 5 6))
  (test (vector-ref #(#(1 2 3) #(4 5 6)) one two) 6)
  (test (vector-ref #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))) one) #(#(7 8 9) #(10 11 12)))
  (test (vector-ref #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))) one zero) #(7 8 9))
  (test (vector-ref #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))) one zero two) 9)
  
  (test (#(#(1 2 3) #(4 5 6)) one) #(4 5 6))
  (test (#(#(1 2 3) #(4 5 6)) one two) 6)
  (test (#(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))) one) #(#(7 8 9) #(10 11 12)))
  (test (#(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))) one zero) #(7 8 9))
  (test (#(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))) one zero two) 9)
  
  (test (let ((L #(#(1 2 3) #(4 5 6)))) (L one)) #(4 5 6))
  (test (let ((L #(#(1 2 3) #(4 5 6)))) (L one two)) 6)
  (test (let ((L #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))))) (L one)) #(#(7 8 9) #(10 11 12)))
  (test (let ((L #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))))) (L one zero)) #(7 8 9))
  (test (let ((L #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))))) (L one zero two)) 9)
  
  (test (let ((L #(#(1 2 3) #(4 5 6)))) ((L one) two)) 6)
  (test (let ((L #(#(1 2 3) #(4 5 6)))) (((L one) two) 3)) 'error)
  (test (let ((L #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))))) ((L one) zero)) #(7 8 9))
  (test (let ((L #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))))) (((L one) zero) two)) 9)
  (test (let ((L #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))))) ((L one zero) two)) 9)
  (test (let ((L #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))))) ((L one) zero two)) 9)
  
  (test (let ((L #(#(1 2 3) #(4 5 6)))) (vector-ref (L one) two)) 6)
  (test (let ((L #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))))) (vector-ref (L one) zero)) #(7 8 9))
  (test (let ((L #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))))) ((vector-ref (L one) zero) two)) 9))

(test ((#(#(:hi) #\a (3)) (#("hi" 2) 1)) (#2d((#() ()) (0 #(0))) 1 ('(cons 0) 1))) 3)
(test (#(1 2 3) (#(1 2 3) 1)) 3)
(test ((#(#(1 2)) (#(1 0) 1)) (#(3 2 1 0) 2)) 2)
(test (apply min (#(1 #\a (3)) (#(1 2) 1))) 3) ; i.e vector ref here 2 levels -- (#(1 2) 1) is 2 and (#(1 #\a (3)) 2) is (3) 

;;; vector-ref optimizer checks
(define global_vector (vector 1 2 3))
(let ()
  (define (hi i) (vector-ref global_vector i))
  (test (hi 1) 2))
(let ()
  (define (hi i) (vector-ref global_vector (vector-ref global_vector i)))
  (test (hi 0) 2))

(test (let ((v #(0 1 2 3 4 5))) (define (f1) (v 4/3)) (f1)) 'error)
(test (let ((v "012345")) (define (f1) (v 4/3)) (f1)) 'error)
(test (let ((v (list 0 1 2 3 4 5))) (define (f1) (v 4/3)) (f1)) 'error)

(define-constant -a-global-vector- (vector 1 2 3))
(let ()
  (define (fg a) (vector-ref -a-global-vector- a))
  (test (fg 0) 1))

(let ()
  (define (f1)    
    (let ((v (vector #f)) (X #2D((1 2) (3 4))))    
      (do ((i 0 (+ i 1))) ((= i 1) v)    
	(vector-set! v 0 (vector-ref X 1)))))
  (test (f1) #(#(3 4))))

(let ()
  (define (f1)     
    (let ((v (vector #f)) (X #2D((1 2) (3 4))))     
      (do ((i 0 (+ i 1))) ((= i 1) v)     
	(vector-set! v 0 (vector-ref X 2)))))
  (test (f1) 'error))

(let ()
  (define (f1)    
    (let ((I 0) (v (vector #f)) (X #2D((1 2) (3 4))))    
      (do ((i 0 (+ i 1))) ((= i 1) v)    
	(vector-set! v 0 (vector-ref X (+ I 1))))))
  (test (f1) #(#(3 4))))

(let ()
  (define (f1)    
    (let ((I 1) (v (vector #f)) (X #2D((1 2) (3 4))))    
      (do ((i 0 (+ i 1))) ((= i 1) v)    
	(vector-set! v 0 (vector-ref X (+ I 1))))))
  (test (f1) 'error))

(set! global_vector #2D((1 2) (3 4)))
(let ()
  (define (f1)    
    (let ((I 1) (v (vector #f)))
      (do ((i 0 (+ i 1))) ((= i 1) v)    
	(vector-set! v 0 (vector-ref global_vector I)))))
  (test (f1) #(#(3 4))))

(let ()
  (define (f1)    
    (let ((I 2) (v (vector #f)))
      (do ((i 0 (+ i 1))) ((= i 1) v)    
	(vector-set! v 0 (vector-ref global_vector I)))))
  (test (f1) 'error))



;;; --------------------------------------------------------------------------------
;;; vector-set!

(test (let ((vec (vector 0 '(2 2 2 2) "Anna"))) (vector-set! vec 1 '("Sue" "Sue")) vec) #(0 ("Sue" "Sue") "Anna"))
(test (let ((v (vector 1 2 3))) (vector-set! v 1 32) v) #(1 32 3))
(let ((v (make-vector 8 #f)))
  (for-each
   (lambda (arg)
     (vector-set! v 1 arg)
     (test (vector-ref v 1) arg))
   (list #\a 1 () (list 1) '(1 . 2) #f "hi" 'a-symbol abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand (log 0) 
	 3.14 3/4 1.0+1.0i #t (vector 1 2 3) (lambda (a) (+ a 1)))))
(test (let ((v (vector 1 2 3))) (vector-set! v 1 0) v) #(1 0 3))
(test (let ((v (vector #f))) (vector-set! v 0 (vector)) v) #(#()))
(test (let ((v (vector 1 (list 2) (vector 1 2 3)))) (vector-set! (vector-ref v 2) 0 21) v) #(1 (2) #(21 2 3)))
(test (let ((v (make-int-vector 3))) (vector-set! v 1 32) (vector->list v)) '(0 32 0))
(test (let ((v (make-int-vector 3 0))) (set! (v 1) 32) (vector->list v)) '(0 32 0))

(test (vector-set! (vector 1 2) 0 4) 4)
(test (vector-set!) 'error)
(test (vector-set! #(1)) 'error)
(test (vector-set! #(1) 0) 'error)
(test (vector-set! #(1) 0 0 1) 'error)
(test (vector-set! #(1) 0 0 1 2 3) 'error)
(test (vector-set! #(1) #(0) 1) 'error)
(test (vector-set! #(1 2) 0 2) 2)
(test (let ((x 2) (v (vector 1 2))) (vector-set! (let () (set! x 3) v) 1 23) (list x v)) '(3 #(1 23)))
(test (let ((v #(1 2))) (vector-set! v 0 32)) 32)
(test (let ((v #(1 2))) (set! (v 0) 32)) 32)
(test (let ((v #(1 2))) (set! (vector-ref v 0) 32)) 32)
(test (let ((v (make-vector '(2 3) 0))) (set! (v (values 0 1)) 23) v) #2D((0 23 0) (0 0 0)))

(for-each
 (lambda (arg)
   (test (vector-set! arg 0 0) 'error))
 (list "hi" () #\a -1 '(1 . 2) (cons #\a #\b) #f 'a-symbol abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t (lambda (a) (+ a 1)) (make-hash-table)))

(let ((v (vector 1 2 3)))
  (for-each
   (lambda (arg)
     (test (vector-set! v arg 0) 'error))
   (list "hi" () #() #\a -1 '(1 . 2) (cons #\a #\b) #f 'a-symbol abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
	 3.14 3/4 1.0+1.0i #t (make-vector 3) (lambda (a) (+ a 1)))))

(for-each
 (lambda (arg)
   (test (vector-set! arg 0 0) 'error))
 (list "hi" () #\a 1 '(1 . 2) (cons #\a #\b) #f 'a-symbol abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))

(let ((v #(#(0 1) #(2 3))))
  (vector-set! (vector-ref v 1) 1 4)
  (test (v 1 1) 4)
  (set! ((vector-ref v 1) 1) 5)
  (test (v 1 1) 5)
  (set! ((v 1) 1) 6)
  (test (v 1 1) 6)
  (vector-set! (v 1) 1 7)
  (test (v 1 1) 7)
  (set! (v 1 1) 8)
  (test (v 1 1) 8))

(let ((v (vector)))
  (test (vector-set! v 0 0) 'error)
  (test (vector-set! v 1 0) 'error)
  (test (vector-set! v -1 0) 'error))
(test (vector-set! #() 0 123) 'error)
(test (vector-set! #(1 2 3) 0 123) 123)
(test (let ((v #(1 2 3))) (set! (v 0) '(+ 1 2)) v) #((+ 1 2) 2 3))
(test (let ((v #(1 2 3))) (set! (v '(+ 1 1)) 2) v) 'error)
(test (let ((v #(1 2 3))) (set! (v (+ 1 1)) 2) v) #(1 2 2))

(test (let ((g (lambda () #(1 2 3)))) (vector-set! (g) 0 #\?) (g)) #(#\? 2 3))
(test (let ((g (lambda () '(1 . 2)))) (set-car! (g) 123) (g)) '(123 . 2))
(test (let ((g (lambda () '(1 2)))) (list-set! (g) 0 123) (g)) '(123 2))
(test (let ((g (lambda () (symbol->string 'hi)))) (string-set! (g) 1 #\a) (symbol->string 'hi)) "hi")

(test (let ((L #(#(1 2 3) #(4 5 6)))) (vector-set! L 1 32) L) #(#(1 2 3) 32))
(test (let ((L #(#(1 2 3) #(4 5 6)))) (vector-set! L 1 0 32) L) #(#(1 2 3) #(32 5 6)))
(test (let ((L #(#(1 2 3) #(4 5 6)))) (vector-set! L 1 0 2 32) L) 'error)
(test (let ((L #(#(1 2 3) #(4 5 6)))) (vector-set! L 1 3 32) L) 'error)
(test (let ((L #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))))) (vector-set! L 1 32) L) #(#(#(1 2 3) #(4 5 6)) 32))
(test (let ((L #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))))) (vector-set! L 1 0 32) L) #(#(#(1 2 3) #(4 5 6)) #(32 #(10 11 12))))
(test (let ((L #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))))) (vector-set! L 1 0 2 32) L) #(#(#(1 2 3) #(4 5 6)) #(#(7 8 32) #(10 11 12))))
(test (let ((L #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))))) (vector-set! L 1 0 2 1 32) L) 'error)
(test (let ((L #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))))) (vector-set! L 1 4 2 32) L) 'error)

(test (let ((L #(#(1 2 3) #(4 5 6)))) (set! (L 1) 32) L) #(#(1 2 3) 32))
(test (let ((L #(#(1 2 3) #(4 5 6)))) (set! (L 1 0) 32) L) #(#(1 2 3) #(32 5 6)))
(test (let ((L #(#(1 2 3) #(4 5 6)))) (set! (L 1 0 2) 32) L) 'error)
(test (let ((L #(#(1 2 3) #(4 5 6)))) (set! (L 1 3) 32) L) 'error)
(test (let ((L #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))))) (set! (L 1) 32) L) #(#(#(1 2 3) #(4 5 6)) 32))
(test (let ((L #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))))) (set! (L 1 0) 32) L) #(#(#(1 2 3) #(4 5 6)) #(32 #(10 11 12))))
(test (let ((L #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))))) (set! (L 1 0 2) 32) L) #(#(#(1 2 3) #(4 5 6)) #(#(7 8 32) #(10 11 12))))
(test (let ((L #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))))) (set! (L 1 0 2 1) 32) L) 'error)
(test (let ((L #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))))) (set! (L 1 4 2) 32) L) 'error)

(test (let ((L #(#(1 2 3) #(4 5 6)))) (set! ((L 1) 0) 32) L) #(#(1 2 3) #(32 5 6)))
(test (let ((L #(#(1 2 3) #(4 5 6)))) (set! (((L 1) 0) 2) 32) L) 'error)
(test (let ((L #(#(1 2 3) #(4 5 6)))) (set! ((L 1) 3) 32) L) 'error)
(test (let ((L #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))))) (set! ((L 1) 0) 32) L) #(#(#(1 2 3) #(4 5 6)) #(32 #(10 11 12))))
(test (let ((L #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))))) (set! (((L 1) 0) 2) 32) L) #(#(#(1 2 3) #(4 5 6)) #(#(7 8 32) #(10 11 12))))
(test (let ((L #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))))) (set! ((((L 1) 0) 2) 1) 32) L) 'error)
(test (let ((L #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))))) (set! (((L 1) 4) 2) 32) L) 'error)
(test (let ((L #(#(#(1 2 3))))) (set! ((L 0) 0 1) 32) L) #(#(#(1 32 3))))
(test (let ((L #(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))))) (set! ((L 1 0) 2) 32) L) #(#(#(1 2 3) #(4 5 6)) #(#(7 8 32) #(10 11 12))))

(test (let ((L #(#(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))) #(13 14 15)))) 
	(set! (L 0 0 1) 32) 
	L) 
      #(#(#(#(1 2 3) 32) #(#(7 8 9) #(10 11 12))) #(13 14 15)))
(test (let ((L #(#(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))) #(13 14 15)))) 
	(set! ((L 0) 0 1 2) 32) 
	L) 
      #(#(#(#(1 2 3) #(4 5 32)) #(#(7 8 9) #(10 11 12))) #(13 14 15)))
(test (let ((L #(#(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))) #(13 14 15)))) 
	(set! ((L 0 0) 1 2) 32) 
	L) 
      #(#(#(#(1 2 3) #(4 5 32)) #(#(7 8 9) #(10 11 12))) #(13 14 15)))
(test (let ((L #(#(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))) #(13 14 15)))) 
	(set! ((L 0 0 1) 2) 32) 
	L) 
      #(#(#(#(1 2 3) #(4 5 32)) #(#(7 8 9) #(10 11 12))) #(13 14 15)))
(test (let ((L #(#(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))) #(13 14 15)))) 
	(set! (((L 0) 0) 1 2) 32) 
	L) 
      #(#(#(#(1 2 3) #(4 5 32)) #(#(7 8 9) #(10 11 12))) #(13 14 15)))
(test (let ((L #(#(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))) #(13 14 15)))) 
	(set! (((L 0 0) 1) 2) 32) 
	L) 
      #(#(#(#(1 2 3) #(4 5 32)) #(#(7 8 9) #(10 11 12))) #(13 14 15)))
(test (let ((L #(#(#(#(1 2 3) #(4 5 6)) #(#(7 8 9) #(10 11 12))) #(13 14 15)))) 
	(set! ((((L 0) 0) 1) 2) 32) 
	L) 
      #(#(#(#(1 2 3) #(4 5 32)) #(#(7 8 9) #(10 11 12))) #(13 14 15)))


(test (eq? (car (catch #t (lambda () (set! (#(1)) 2)) (lambda args args))) 'wrong-number-of-args) #t)
(test (eq? (car (catch #t (lambda () (set! (#(1) 0 0) 2)) (lambda args args))) 'syntax-error) #t) 
(test (eq? (car (catch #t (lambda () (set! ((#(1) 0) 0) 2)) (lambda args args))) 'syntax-error) #t) ; (set! (1 ...))
(test (let ((L #(#(1 2 3) #(4 5 6)))) (eq? (car (catch #t (lambda () (set! ((L) 1) 32) L) (lambda args args))) 'wrong-number-of-args)) #t)
(test (let ((L #(#(1 2 3) #(4 5 6)))) (eq? (car (catch #t (lambda () (set! ((L)) 32) L) (lambda args args))) 'wrong-number-of-args)) #t)
(test (let ((L #(#(1 2 3) #(4 5 6)))) (eq? (car (catch #t (lambda () (set! ((L 1) 2)) L) (lambda args args))) 'syntax-error)) #t)

(let ((v #(1 2 3))) (define (vr v a) (vector-ref v (+ a 1))) (test (vr v 1) 3))
(let () (define (fillv) (let ((v (make-vector 10))) (do ((i 0 (+ i 1))) ((= i 10) v) (vector-set! v i i)))) (test (fillv) #(0 1 2 3 4 5 6 7 8 9)))
(let () (define (vv) (let ((v #(0 1)) (i 0) (x 2)) (vector-set! v i (+ (vector-ref v i) x)))) (test (vv) 2))
(let () (define (hi) (let ((v1 #(0 1)) (i 0) (j 1)) (vector-set! v1 i (vector-ref v1 j)))) (hi) 1)



;;; --------------------------------------------------------------------------------
;;; vector-fill!

(test (fill! (vector 1 2) 4) 4)

(test (let ((v (vector 1 2 3))) (vector-fill! v 0) v) #(0 0 0))
(test (let ((v (vector))) (vector-fill! v #f) v) #())
(let ((v (make-vector 8 #f)))
  (for-each
   (lambda (arg)
     (vector-fill! v arg)
     (test (vector-ref v 1) arg))
   (list #\a 1 () (list 1) '(1 . 2) #f "hi" 'a-symbol abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand (log 0) 
	 3.14 3/4 1.0+1.0i #t (vector 1 2 3) (lambda (a) (+ a 1)))))

(test (let ((str "hi") (v (make-vector 3))) (vector-fill! v str) (string-set! (vector-ref v 0) 1 #\a) str) "ha")
(test (let ((lst (list 1 2)) (v (make-vector 3))) (vector-fill! v lst) (list-set! (vector-ref v 0) 1 #\a) lst) '(1 #\a))

(test (let ((v (vector 1 2 3))) (vector-set! v -1 0)) 'error)
(test (let ((v (vector 1 2 3))) (vector-set! v 3 0)) 'error)
(test (vector-fill! #(1 2) 2) 2)
(test (vector-fill! #() 0) 0)
(test (vector-fill! (vector) 0) 0)
(test (let ((v (vector 1))) (vector-fill! v 32) (v 0)) 32)
(test (let ((v (make-vector 11 0))) (vector-fill! v 32) (v 10)) 32)
(test (let ((v (make-vector 16 0))) (vector-fill! v 32) (v 15)) 32)
(test (let ((v (make-vector 3 0))) (vector-fill! v 32) (v 1)) 32)
(test (let ((v (make-vector 3 0))) (fill! v 32) (v 1)) 32)
(test (let ((v #2d((1 2 3) (4 5 6)))) (vector-fill! (v 1) 12) v) #2D((1 2 3) (12 12 12)))
(test (let ((v #i(1 2))) (fill! v 3) v) #i(3 3))

(for-each
 (lambda (arg)
   (test (vector-fill! arg 0) 'error))
 (list "hi" #\a () 1 '(1 . 2) (cons #\a #\b) #f 'a-symbol abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))

(when with-bignums
  (let ((v (make-vector 2 0.0)))
    (vector-fill! v 1180591620717411303424)
    (num-test (v 1) (expt 2 70))
    (vector-fill! v 3/1180591620717411303424)
    (num-test (v 0) 3/1180591620717411303424)
    (vector-fill! v 1180591620717411303424.0)
    (num-test (v 1) 1180591620717411303424.0)
    (vector-fill! v (complex (expt 2 70) 1.0))
    (num-test (v 0) (complex (expt 2 70) 1.0))
    (set! v (float-vector 1.0))
    (vector-fill! v (bignum "2.0"))
    (num-test (v 0) 2.0)
    (vector-fill! v pi)
    (num-test (v 0) pi)
    (set! v (float-vector 0.0 0.0 0.0))
    (vector-fill! v (bignum "2.0") 1 2)
    (num-test (v 0) 0.0)
    (num-test (v 1) 2.0)
    (set! v (make-int-vector 1))
    (vector-fill! v (bignum "2"))
    (num-test (v 0) 2)
    (set! v (make-int-vector 3 0))
    (vector-fill! v (bignum "2") 1 2)
    (num-test (v 0) 0)
    (num-test (v 1) 2)))

(let ((v (make-vector 3)))
  (vector-fill! v v)
  (test (v 0) v)
  (set! (v 1) 32)
  (test ((v 0) 1) 32))

(test (let ((v (vector 1 2 3 4 5))) (vector-fill! v 21 0) v) #(21 21 21 21 21))
(test (let ((v (vector 1 2 3 4 5))) (vector-fill! v 21 0 5) v) #(21 21 21 21 21))
(test (let ((v (vector 1 2 3 4 5))) (vector-fill! v 21 0 3) v) #(21 21 21 4 5))
(test (let ((v (vector 1 2 3 4 5))) (vector-fill! v 21 2 3) v) #(1 2 21 4 5))
(test (let ((v (vector 1 2 3 4 5))) (vector-fill! v 21 3 3) v) #(1 2 3 4 5))

(if (not with-bignums) (test (let ((v (make-float-vector 3 pi))) (vector-fill! v 0.0) (vector->list v)) '(0.0 0.0 0.0)))
(test (let ((v (make-int-vector 3 1))) (vector-fill! v "2.5")) 'error)
(test (let ((v (make-float-vector 3 pi))) (vector-fill! v #\a)) 'error)
(test (let ((v (make-float-vector 3))) (vector-fill! v 1+i) v) 'error)
(test (let ((v (make-float-vector 3 0.0))) (vector-fill! v 3/4) (vector->list v)) '(0.75 0.75 0.75))
(test (let ((v (make-float-vector 3 0.0))) (vector-fill! v 3) (vector->list v)) '(3.0 3.0 3.0))
(test (let ((v (make-int-vector 3))) (vector-fill! v 1+i) v) 'error)
(test (let ((v (make-int-vector 3 0))) (vector-fill! v 3/4) v) 'error)
(test (let ((v (make-int-vector 3 0))) (vector-fill! v 3.0) v) 'error)

(test (let ((v (make-int-vector 3 1))) (vector-fill! v 2 1) (vector->list v)) '(1 2 2))
(test (let ((v (make-int-vector 3 1))) (vector-fill! v 2 1 1) (vector->list v)) '(1 1 1))
(test (let ((v (make-int-vector 3 1))) (vector-fill! v 2 1 2) (vector->list v)) '(1 2 1))
(test (let ((v (make-int-vector 3 1))) (vector-fill! v 2 1 3) (vector->list v)) '(1 2 2))
(test (let ((v (make-int-vector 3 1))) (vector-fill! v 2 0 3) (vector->list v)) '(2 2 2))
(test (let ((v (make-int-vector 3 1))) (vector-fill! v 2 1 4) (vector->list v)) 'error)
(test (let ((v (make-int-vector 3 1))) (vector-fill! v 2 -1) (vector->list v)) 'error)
(test (let ((v (make-float-vector 3 0.0))) (vector-fill! v 1.0 1) (vector->list v)) '(0.0 1.0 1.0))
(test (let ((v (make-int-vector 3 1))) (vector-fill! v "2.5" 1)) 'error)
(test (let ((v (make-float-vector 3 pi))) (vector-fill! v #\a 0 1)) 'error)
(test (let ((v (make-float-vector 3 0.0))) (vector-fill! v 1+i 1) v) 'error)
(test (let ((v (make-float-vector 3 0.0))) (vector-fill! v 3/4 1) (vector->list v)) '(0.0 0.75 0.75))
(test (let ((v (make-float-vector 3))) (vector-fill! v 3 2) (vector->list v)) '(0.0 0.0 3.0))
(test (let ((v (make-int-vector 3 0))) (vector-fill! v 1+i 2) v) 'error)
(test (let ((v (make-int-vector 3 0))) (vector-fill! v 3/4 0 1) v) 'error)
(test (let ((v (make-int-vector 3))) (vector-fill! v 3.0 2) v) 'error)
(test (vector-fill! #() 0 "hi") 'error)
(test (vector-fill! #() 0 -1 3) 'error)
(test (vector-fill! #() 0 1) 'error)
(test (vector-fill! #() 0 0 4/3) 'error)





;;; --------------------------------------------------------------------------------
;;; vector-append

(test (vector-append #() #2d()) #())
(test (vector-append) #())
(test (vector-append #()) #())
(test (vector-append #(1 2)) #(1 2))
(test (vector-append #(1) #(2 3) #() #(4)) #(1 2 3 4))
(test (vector-append #(1) #2d((2 3) (4 5)) #3d()) #(1 2 3 4 5))
(test (vector-append #2d((1 2) (3 4)) #3d(((5 6) (7 8)) ((9 10) (11 12)))) #(1 2 3 4 5 6 7 8 9 10 11 12))

(test (vector-append (vector 1 2) (make-int-vector 1 3) #(4)) #(1 2 3 4))
(test (vector-append (vector 1 2) (make-float-vector 1) #(4)) #(1 2 0.0 4))
(test (vector->list (vector-append (make-int-vector 1 3) (make-int-vector 2 1))) '(3 1 1))
(test (vector->list (vector-append (make-float-vector 1 0.0) (make-float-vector 2 1.0))) '(0.0 1.0 1.0))

(unless pure-s7
  (for-each
   (lambda (arg)
     (test (vector-append arg) 'error)
     (test (vector-append #(1 2) arg) 'error))
   (list "hi" #\a () 1 '(1 . 2) (cons #\a #\b) #f 'a-symbol abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
	 3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1)))))

(test (equal? (make-vector 3 1) (make-int-vector 3 1)) #f)

(let ((iv (make-int-vector 3 1))
      (fv (make-float-vector 3 2.0))
      (vv (make-vector 3 #f)))
  (test (equal? (vector-append iv iv iv) (make-int-vector 9 1)) #t)
  (test (vector-append iv iv vv) 'error)
  (test (vector-append iv fv iv) (int-vector 1 1 1 2 2 2 1 1 1))
  (test (vector-append iv fv fv) (int-vector 1 1 1 2 2 2 2 2 2))
  (test (vector-append iv fv vv) 'error)
  (test (vector-append iv vv iv) 'error)
  (test (vector-append fv iv iv) (float-vector 2.0 2.0 2.0 1 1 1 1 1 1))       ; #(2.0 2.0 2.0 1 1 1 1 1 1))
  (test (vector-append fv iv fv) (float-vector 2.0 2.0 2.0 1 1 1 2.0 2.0 2.0)) ; #(2.0 2.0 2.0 1 1 1 2.0 2.0 2.0))
  (test (vector-append fv fv iv) (float-vector 2.0 2.0 2.0 2.0 2.0 2.0 1 1 1)) ; #(2.0 2.0 2.0 2.0 2.0 2.0 1 1 1))
  (test (vector-append fv fv fv) (make-float-vector 9 2.0))
  (test (vector-append fv fv vv) 'error)
  (test (vector-append vv iv iv) #(#f #f #f 1 1 1 1 1 1))
  (test (vector-append vv iv fv) #(#f #f #f 1 1 1 2.0 2.0 2.0))
  (test (vector-append vv iv vv) #(#f #f #f 1 1 1 #f #f #f))
  (test (vector-append vv fv iv) #(#f #f #f 2.0 2.0 2.0 1 1 1))
  (test (vector-append vv fv fv) #(#f #f #f 2.0 2.0 2.0 2.0 2.0 2.0))
  (test (vector-append vv fv vv) #(#f #f #f 2.0 2.0 2.0 #f #f #f))
  (test (vector-append vv vv iv) #(#f #f #f #f #f #f 1 1 1))
  (test (vector-append vv vv fv) #(#f #f #f #f #f #f 2.0 2.0 2.0))
  (test (vector-append vv vv vv) #(#f #f #f #f #f #f #f #f #f)))

(test (equal? (vector-append (float-vector 1 2 3) #()) (float-vector 1 2 3)) #t)
(test (equal? (vector-append (float-vector) #(1 2 3) #() (make-int-vector 0 0)) (float-vector 1 2 3)) #t)
(test (equal? (float-vector) (vector-append (float-vector))) #t)
(test (equal? (vector-append #() (float-vector) (make-int-vector 3 1) (vector)) (make-vector 3 1)) #t)
(test (equal? (vector-append (int-vector 1 2 3) #()) (int-vector 1 2 3)) #t)
(test (equal? (vector-append (int-vector) #(1 2 3) #() (make-int-vector 0 0)) (int-vector 1 2 3)) #t)
(test (equal? (int-vector) (vector-append (int-vector))) #t)
(test (equal? (vector-append #() (int-vector) (make-int-vector 3 1) (vector)) (make-vector 3 1)) #t)

(when full-test
  (define (test-append size)
    (let ((strs ())
	  (vecs ())
	  (fvecs ())
	  (ivecs ())
	  (ifvecs ())
	  (allvecs ())
	  (bvecs ())
	  (lsts ()))
      (do ((i 0 (+ i 1)))
	  ((= i size))
	(set! strs (cons (make-string size (integer->char (+ 1 (random 255)))) strs))
	(set! bvecs (cons (string->byte-vector (make-string size (integer->char (random 256)))) bvecs))
	(set! vecs (cons (make-vector size i) vecs))
	(set! ivecs (cons (make-int-vector size i) ivecs))
	(set! fvecs (cons (make-float-vector size (* i 1.0)) fvecs))
	(set! ifvecs (cons (make-vector size (if (even? i) (* i 1.0) i)) ifvecs))
	(set! allvecs (cons (make-vector size (if (even? i) (* i 1.0) i)) allvecs))
	(set! lsts (cons (make-list size i) lsts)))
      (let ((lst (apply append lsts))
	    (vec (apply vector-append vecs))
	    (fvec (apply vector-append fvecs))
	    (ivec (apply vector-append ivecs))
	    (ifvec (apply vector-append ifvecs))
	    (allvec (apply vector-append allvecs))
	    (str (apply string-append strs))
	    (bvec (string->byte-vector (apply string-append bvecs))))
	(test (vector? vec) #t)
	(test (length vec) (* size size))
	(test (float-vector? fvec) #t)
	(test (length fvec) (* size size))
	(test (int-vector? ivec) #t)
	(test (length ivec) (* size size))
	(test (vector? allvec) #t)
	(test (length allvec) (* size size))
	(test (vector? ifvec) #t)
	(test (length ifvec) (* size size))
	(test (pair? lst) #t)
	(test (length lst) (* size size))
	(test (string? str) #t)
	(test (length str) (* size size))
	(test (byte-vector? bvec) #t)
	(test (length bvec) (* size size))
	)))
  
  (do ((i 1 (* i 10)))
      ((> i 1000))
    (test-append i)))


  
;;; --------------------------------------------------------------------------------
;;; miscellaneous vectors

(test (let ((sum 0)) (for-each (lambda (n) (set! sum (+ sum n))) (vector 1 2 3)) sum) 6)
(test (let ((sum 0)) (for-each (lambda (n m) (set! sum (+ sum n (- m)))) (vector 1 2 3) (vector 4 5 6)) sum) -9)
(test (let () (for-each (lambda (n) (error 'wrong-type-arg "oops")) (vector)) #f) #f)
(test (let ((sum 0)) (for-each (lambda (n m p) (set! sum (+ sum n (- m) (* 2 p)))) (vector 1 2 3) (vector 4 5 6) (vector 6 7 8)) sum) 33)
(test (let ((sum 0)) (for-each (lambda (n) (for-each (lambda (m) (set! sum (+ sum (* m n)))) (vector 1 2 3))) (vector 4 5 6)) sum) 90)
(test (call/cc (lambda (return) (for-each (lambda (n) (return "oops")) (vector 1 2 3)))) "oops")
(test (call/cc (lambda (return) (for-each (lambda (n) (if (even? n) (return n))) (vector 1 3 8 7 9 10)))) 8)

(for-each
 (lambda (data)
   (let ((v data)
	 (c #f)
	 (y 0))
     
     (do ((i 0 (+ i 1)))
	 ((= i 10))
       (set! (v i) i))
     
     (let ((tag 
	    (call/cc
	     (lambda (exit)
	       
	       (for-each
		(lambda (x)
		  
		  (call/cc
		   (lambda (return)
		     (set! c return)))
		  
		  (if (and (even? (inexact->exact x))
			   (> x y) 
			   (< x 10)) 
		      (begin 
			(set! (v (inexact->exact y)) 100)
			(set! y x) 
			(exit x))
		      (set! y x)))
		v)))))
       
       (if (and (number? tag) (< tag 10))
	   (c)))
     
     (let ((correct (vector 0 100 2 100 4 100 6 100 8 9)))
       (do ((i 0 (+ i 1)))
	   ((= i (length v)))
	 (if (not (= (correct i) (inexact->exact (v i))))
	     (format #t ";for-each call/cc data: ~A~%" v))))))
 
 (list (make-vector 10)
       (make-list 10)))


(test (map (lambda (n) (+ 1 n)) (vector 1 2 3)) '(2 3 4))
(test (map (lambda (n m) (- n m)) (vector 1 2 3) (vector 4 5 6)) '(-3 -3 -3))
(test (map (lambda (n m p) (+ n m p)) (vector 1 2 3) (vector 4 5 6) (vector 6 7 8)) '(11 14 17))
(test (map (lambda (n) (map (lambda (m) (* m n)) (vector 1 2 3))) (vector 4 5 6)) '((4 8 12) (5 10 15) (6 12 18)))
(test (call/cc (lambda (return) (map (lambda (n) (return "oops")) (vector 1 2 3)))) "oops")
(test (call/cc (lambda (return) (map (lambda (n) (if (even? n) (return n))) (vector 1 3 8 7 9 10)))) 8)

(test (map (lambda (x) x) (make-int-vector 3 0)) '(0 0 0))
(test (map (lambda (x) x) (let ((v (make-int-vector 3 0))) (set! (v 1) 1) (set! (v 2) 2) v)) '(0 1 2))
(test (map (lambda (x) x) (make-float-vector 3 0.0)) '(0.0 0.0 0.0))
(test (let ((lst ())) (for-each (lambda (n) (set! lst (cons n lst))) (let ((v (make-int-vector 3 0))) (set! (v 1) 1) v)) lst) '(0 1 0))

(test (vector? (symbol-table)) #t)

(let ((v (make-vector 3 (vector 1 2))))
  (test (equal? (v 0) (v 1)) #t)
  (test (eq? (v 0) (v 1)) #t)
  (test (eqv? (v 0) (v 1)) #t))

(let ((v (vector (vector 1 2) (vector 1 2) (vector 1 2))))
  (test (equal? (v 0) (v 1)) #t)
  (test (eq? (v 0) (v 1)) #f)
  (test (eqv? (v 0) (v 1)) #f))

(let ((v (vector (vector (vector (vector 1 2) 3) 4) 5)))
  (test (v 0) #(#(#(1 2) 3) 4))
  (test (v 1) 5)
  (test (((v 0) 0) 1) 3)
  (test ((((v 0) 0) 0) 1) 2))

(test (make-vector 1 (make-vector 1 (make-vector 1 0))) #(#(#(0))))
(test (vector->list (let ((v (make-int-vector 3 0))) (set! (v 0) 32) (set! (v 1) -1) (set! (v 2) 2) (sort! v <))) '(-1 2 32))

(let ((v1 (make-vector 3 1)))
  (num-test (v1 1) 1)
  (set! (v1 1) 2)
  (num-test (v1 1) 2)
  (let ((i0 0)
	(i2 2))
    (num-test (v1 i0) 1)
    (num-test (vector-ref v1 i2) 1)
    (set! (v1 i0) 0)
    (num-test (v1 0) 0)
    (set! (v1 i0) i2)
    (num-test (v1 i0) i2))
  (test (vector-dimensions v1) '(3))
  (set! v1 (make-vector '(3 2)))
  (test (vector-dimensions v1) '(3 2))
  (vector-set! v1 1 1 0)
  (num-test (vector-ref v1 1 1) 0)
  (let ((i0 1)
	(i1 1)
	(i2 32))
    (set! (v1 i0 i1) i2)
    (num-test (vector-ref v1 1 1) 32)
    (num-test (v1 i0 i1) i2)
    (vector-set! v1 0 1 3)
    (num-test (v1 0 1) 3)
    (num-test (v1 1 1) 32))
  (set! v1 (make-vector '(2 4 3) 1))
  (test (vector-dimensions v1) '(2 4 3))      
  (num-test (vector-ref v1 1 1 1) 1)
  (vector-set! v1 0 0 0 32)
  (num-test (v1 0 0 0) 32)
  (set! (v1 0 1 1) 3)
  (num-test (v1 0 1 1) 3))

(for-each
 (lambda (arg)
   (test (vector-dimensions arg) 'error))
 (list "hi" -1 0 #\a 'a-symbol '(1 . 2) '(1 2 3) 3.14 3/4 1.0+1.0i #t abs #<eof> #<unspecified> (lambda () 1)))
(test (vector-dimensions) 'error)
(test (vector-dimensions #() #()) 'error)
(test (vector-dimensions #()) '(0))
(test (vector-dimensions (vector)) '(0))
(test (vector-dimensions (vector 0)) '(1))
(test (vector-dimensions (vector-ref #2d((1 2 3) (3 4 5)) 0)) '(3))
(test (vector-dimensions (vector-ref #3D(((1 2 3) (3 4 5)) ((5 6 1) (7 8 2))) 0)) '(2 3))
(test (vector-dimensions (vector-ref #3D(((1 2 3) (3 4 5)) ((5 6 1) (7 8 2))) 0 1)) '(3))
(test (set! (vector-dimensions #(1 2)) 1) 'error)
(test (let ((v #(1 2 3))) (set! (car (vector-dimensions v)) 0) v) #(1 2 3))
(test (vector-dimensions (make-int-vector '(2 3) 0)) '(2 3))

(let-temporarily (((*s7* 'print-length) 32))
  (let ((vect1 #3D(((1 2 3) (3 4 5)) ((5 6 1) (7 8 2))))
	(vect2 #2d((1 2 3 4 5 6) (7 8 9 10 11 12)))
	(vect3 #(1 2 3 4 5 6 7 8 9 10 11 12 13 14))
	(vect4 #3D(((1 2) (3 4) (5 6)) ((7 8) (9 10) (11 12))))
	(vect1t (make-int-vector '(2 2 3) 0)))
    (let ((v (make-shared-vector vect1t '(12))))
      (set! (v 0) 1) (set! (v 1) 2) (set! (v 2) 3) (set! (v 3) 3) (set! (v 4) 4) (set! (v 5) 5) 
      (set! (v 6) 5) (set! (v 7) 6) (set! (v 8) 1) (set! (v 9) 7) (set! (v 10) 8) (set! (v 11) 2))
    (do ((i 1 (+ i 1)))
	((= i 15))
      (set! (*s7* 'print-length) i)
      (let ((str (object->string vect1)))
	(test str (case i
		    ((1) "#3D(((1 ...)...)...)")
		    ((2) "#3D(((1 2 ...)...)...)")
		    ((3) "#3D(((1 2 3)...)...)")
		    ((4) "#3D(((1 2 3) (3 ...))...)")
		    ((5) "#3D(((1 2 3) (3 4 ...))...)")
		    ((6) "#3D(((1 2 3) (3 4 5))...)")
		    ((7) "#3D(((1 2 3) (3 4 5)) ((5 ...)...))")
		    ((8) "#3D(((1 2 3) (3 4 5)) ((5 6 ...)...))")
		    ((9) "#3D(((1 2 3) (3 4 5)) ((5 6 1)...))")
		    ((10) "#3D(((1 2 3) (3 4 5)) ((5 6 1) (7 ...)))")
		    ((11) "#3D(((1 2 3) (3 4 5)) ((5 6 1) (7 8 ...)))")
		    ((12) "#3D(((1 2 3) (3 4 5)) ((5 6 1) (7 8 2)))")
		    ((13) "#3D(((1 2 3) (3 4 5)) ((5 6 1) (7 8 2)))")
		    ((14) "#3D(((1 2 3) (3 4 5)) ((5 6 1) (7 8 2)))"))))

      (let ((str (object->string vect1t)))
	(test str (case i
		    ((1) "#i3D(((1 ...)...)...)")
		    ((2) "#i3D(((1 2 ...)...)...)")
		    ((3) "#i3D(((1 2 3)...)...)")
		    ((4) "#i3D(((1 2 3) (3 ...))...)")
		    ((5) "#i3D(((1 2 3) (3 4 ...))...)")
		    ((6) "#i3D(((1 2 3) (3 4 5))...)")
		    ((7) "#i3D(((1 2 3) (3 4 5)) ((5 ...)...))")
		    ((8) "#i3D(((1 2 3) (3 4 5)) ((5 6 ...)...))")
		    ((9) "#i3D(((1 2 3) (3 4 5)) ((5 6 1)...))")
		    ((10) "#i3D(((1 2 3) (3 4 5)) ((5 6 1) (7 ...)))")
		    ((11) "#i3D(((1 2 3) (3 4 5)) ((5 6 1) (7 8 ...)))")
		    ((12) "#i3D(((1 2 3) (3 4 5)) ((5 6 1) (7 8 2)))")
		    ((13) "#i3D(((1 2 3) (3 4 5)) ((5 6 1) (7 8 2)))")
		    ((14) "#i3D(((1 2 3) (3 4 5)) ((5 6 1) (7 8 2)))"))))

      (let ((str (object->string vect4)))
	(test str (case i
		    ((1) "#3D(((1 ...)...)...)")
		    ((2) "#3D(((1 2)...)...)")
		    ((3) "#3D(((1 2) (3 ...)...)...)")
		    ((4) "#3D(((1 2) (3 4)...)...)")
		    ((5) "#3D(((1 2) (3 4) (5 ...))...)")
		    ((6) "#3D(((1 2) (3 4) (5 6))...)")
		    ((7) "#3D(((1 2) (3 4) (5 6)) ((7 ...)...))")
		    ((8) "#3D(((1 2) (3 4) (5 6)) ((7 8)...))")
		    ((9) "#3D(((1 2) (3 4) (5 6)) ((7 8) (9 ...)...))")
		    ((10) "#3D(((1 2) (3 4) (5 6)) ((7 8) (9 10)...))")
		    ((11) "#3D(((1 2) (3 4) (5 6)) ((7 8) (9 10) (11 ...)))")
		    ((12) "#3D(((1 2) (3 4) (5 6)) ((7 8) (9 10) (11 12)))")
		    ((13) "#3D(((1 2) (3 4) (5 6)) ((7 8) (9 10) (11 12)))")
		    ((14) "#3D(((1 2) (3 4) (5 6)) ((7 8) (9 10) (11 12)))"))))

      (let ((str (object->string vect2)))
	(test str (case i
		    ((1) "#2D((1 ...)...)")
		    ((2) "#2D((1 2 ...)...)")
		    ((3) "#2D((1 2 3 ...)...)")
		    ((4) "#2D((1 2 3 4 ...)...)")
		    ((5) "#2D((1 2 3 4 5 ...)...)")
		    ((6) "#2D((1 2 3 4 5 6)...)")
		    ((7) "#2D((1 2 3 4 5 6) (7 ...))")
		    ((8) "#2D((1 2 3 4 5 6) (7 8 ...))")
		    ((9) "#2D((1 2 3 4 5 6) (7 8 9 ...))")
		    ((10) "#2D((1 2 3 4 5 6) (7 8 9 10 ...))")
		    ((11) "#2D((1 2 3 4 5 6) (7 8 9 10 11 ...))")
		    ((12) "#2D((1 2 3 4 5 6) (7 8 9 10 11 12))")
		    ((13) "#2D((1 2 3 4 5 6) (7 8 9 10 11 12))")
		    ((14) "#2D((1 2 3 4 5 6) (7 8 9 10 11 12))"))))

      (let ((str (object->string vect3)))
	(test str (case i
		    ((1) "#(1 ...)")
		    ((2) "#(1 2 ...)")
		    ((3) "#(1 2 3 ...)")
		    ((4) "#(1 2 3 4 ...)")
		    ((5) "#(1 2 3 4 5 ...)")
		    ((6) "#(1 2 3 4 5 6 ...)")
		    ((7) "#(1 2 3 4 5 6 7 ...)")
		    ((8) "#(1 2 3 4 5 6 7 8 ...)")
		    ((9) "#(1 2 3 4 5 6 7 8 9 ...)")
		    ((10) "#(1 2 3 4 5 6 7 8 9 10 ...)")
		    ((11) "#(1 2 3 4 5 6 7 8 9 10 11 ...)")
		    ((12) "#(1 2 3 4 5 6 7 8 9 10 11 12 ...)")
		    ((13) "#(1 2 3 4 5 6 7 8 9 10 11 12 13 ...)")
		    ((14) "#(1 2 3 4 5 6 7 8 9 10 11 12 13 14)")))))

    (let ((vect5 (make-vector '(2 3))))
      (set! (vect5 0 0) vect1)
      (set! (vect5 0 1) vect2)
      (set! (vect5 0 2) vect3)
      (set! (vect5 1 0) vect4)
      (set! (vect5 1 1) (vector 1 2 3))
      (set! (vect5 1 2) #2d())

      (do ((i 1 (+ i 1)))
	  ((= i 15))
	(set! (*s7* 'print-length) i)
	(let ((str (object->string vect5)))
	  (test str (case i
		      ((1) "#2D((#3D(((1 ...)...)...) ...)...)")
		      ((2) "#2D((#3D(((1 2 ...)...)...) #2D((1 2 ...)...) ...)...)")
		      ((3) "#2D((#3D(((1 2 3)...)...) #2D((1 2 3 ...)...) #(1 2 3 ...))...)")
		      ((4) "#2D((#3D(((1 2 3) (3 ...))...) #2D((1 2 3 4 ...)...) #(1 2 3 4 ...)) (#3D(((1 2) (3 4)...)...) ...))")
		      ((5) "#2D((#3D(((1 2 3) (3 4 ...))...) #2D((1 2 3 4 5 ...)...) #(1 2 3 4 5 ...)) (#3D(((1 2) (3 4) (5 ...))...) #(1 2 3) ...))")
		      ((6) "#2D((#3D(((1 2 3) (3 4 5))...) #2D((1 2 3 4 5 6)...) #(1 2 3 4 5 6 ...)) (#3D(((1 2) (3 4) (5 6))...) #(1 2 3) #2D()))")
		      ((7) "#2D((#3D(((1 2 3) (3 4 5)) ((5 ...)...)) #2D((1 2 3 4 5 6) (7 ...)) #(1 2 3 4 5 6 7 ...)) (#3D(((1 2) (3 4) (5 6)) ((7 ...)...)) #(1 2 3) #2D()))")
		      ((8) "#2D((#3D(((1 2 3) (3 4 5)) ((5 6 ...)...)) #2D((1 2 3 4 5 6) (7 8 ...)) #(1 2 3 4 5 6 7 8 ...)) (#3D(((1 2) (3 4) (5 6)) ((7 8)...)) #(1 2 3) #2D()))")
		      ((9) "#2D((#3D(((1 2 3) (3 4 5)) ((5 6 1)...)) #2D((1 2 3 4 5 6) (7 8 9 ...)) #(1 2 3 4 5 6 7 8 9 ...)) (#3D(((1 2) (3 4) (5 6)) ((7 8) (9 ...)...)) #(1 2 3) #2D()))")
		      ((10) "#2D((#3D(((1 2 3) (3 4 5)) ((5 6 1) (7 ...))) #2D((1 2 3 4 5 6) (7 8 9 10 ...)) #(1 2 3 4 5 6 7 8 9 10 ...)) (#3D(((1 2) (3 4) (5 6)) ((7 8) (9 10)...)) #(1 2 3) #2D()))")
		      ((11) "#2D((#3D(((1 2 3) (3 4 5)) ((5 6 1) (7 8 ...))) #2D((1 2 3 4 5 6) (7 8 9 10 11 ...)) #(1 2 3 4 5 6 7 8 9 10 11 ...)) (#3D(((1 2) (3 4) (5 6)) ((7 8) (9 10) (11 ...))) #(1 2 3) #2D()))")
		      ((12) "#2D((#3D(((1 2 3) (3 4 5)) ((5 6 1) (7 8 2))) #2D((1 2 3 4 5 6) (7 8 9 10 11 12)) #(1 2 3 4 5 6 7 8 9 10 11 12 ...)) (#3D(((1 2) (3 4) (5 6)) ((7 8) (9 10) (11 12))) #(1 2 3) #2D()))")
		      ((13) "#2D((#3D(((1 2 3) (3 4 5)) ((5 6 1) (7 8 2))) #2D((1 2 3 4 5 6) (7 8 9 10 11 12)) #(1 2 3 4 5 6 7 8 9 10 11 12 13 ...)) (#3D(((1 2) (3 4) (5 6)) ((7 8) (9 10) (11 12))) #(1 2 3) #2D()))")
		      ((14) "#2D((#3D(((1 2 3) (3 4 5)) ((5 6 1) (7 8 2))) #2D((1 2 3 4 5 6) (7 8 9 10 11 12)) #(1 2 3 4 5 6 7 8 9 10 11 12 13 14)) (#3D(((1 2) (3 4) (5 6)) ((7 8) (9 10) (11 12))) #(1 2 3) #2D()))"))))))))
  
(test (object->string (make-int-vector 3 0)) "#i(0 0 0)")

(let ((v (make-vector '(2 2))))
  (set! (v 0 0) 1)
  (set! (v 0 1) 2)
  (set! (v 1 0) 3)
  (set! (v 1 1) 4)
  (set! (v 0 1) #2d((1 2) (3 4)))
  (test (object->string v) "#2D((1 #2D((1 2) (3 4))) (3 4))"))

(let ((v (make-int-vector '(2 2))))
  (set! (v 0 0) 1)
  (set! (v 0 1) 2)
  (set! (v 1 0) 3)
  (set! (v 1 1) 4)
  (test (object->string v) "#i2D((1 2) (3 4))"))

(let ((v #2d((1 2) (3 4)))) 
  (set! (v 0 1) #2d((1 2) (3 4))) 
  (test (object->string v) "#2D((1 #2D((1 2) (3 4))) (3 4))"))

(let ((v (make-vector '(2 3))))
  (do ((i 0 (+ i 1)))
      ((= i 2))
    (do ((j 0 (+ j 1)))
	((= j 3))
      (set! (v i j) (list i j))))
  (test (v 0 0) '(0 0))
  (test ((v 1 2) 0) 1)
  (test (v 1 2 0) 1)
  (test (v 1 2 0 0) 'error)
  (test (object->string v) "#2D(((0 0) (0 1) (0 2)) ((1 0) (1 1) (1 2)))"))

(test (object->string (make-float-vector 3 1.0)) "#r(1.0 1.0 1.0)")
(test (object->string (make-float-vector 3 -1.5)) "#r(-1.5 -1.5 -1.5)")
(test (object->string (make-int-vector 3 1)) "#i(1 1 1)")
(test (object->string (make-int-vector 3 -1)) "#i(-1 -1 -1)")
(test (object->string (make-int-vector 0 0)) "#i()")
(test (object->string #r()) "#r()")
(test (object->string (make-float-vector '(3 2 0) 0.0)) "#r3D()")

(test (let ((v1 (make-vector '(3 2) 1))
	    (v2 (make-vector '(3 2) 2))
	    (sum 0))
	(for-each (lambda (n m) (set! sum (+ sum n m))) v1 v2)
	sum)
      18)
(test (vector->list (make-vector '(2 3) 1)) '(1 1 1 1 1 1))
(test (vector->list #2d((1 2) (3 4))) '(1 2 3 4))
(test (list->vector '((1 2) (3 4))) #((1 2) (3 4)))
(test (vector->list (make-vector (list 2 0))) ())
(test (vector-dimensions #2d((1 2 3))) '(1 3))

(test (#2d((1 2 3) (4 5 6)) 0 0) 1)
(test (#2d((1 2 3) (4 5 6)) 0 1) 2)
(test (#2d((1 2 3) (4 5 6)) 1 1) 5)
(test (#3D(((1 2) (3 4)) ((5 6) (7 8))) 0 0 0) 1)
(test (#3D(((1 2) (3 4)) ((5 6) (7 8))) 1 1 0) 7)
(test (#4d((((1) (2)) ((3) (4)) ((5) (6)))) 0 0 0 0) 1)
(test (vector? #2d((1 2) (3 4))) #t)
(test ((#2d((1 #2d((2 3) (4 5))) (6 7)) 0 1) 1 0) 4)
(test ((((((((((#10D((((((((((1) (1))) (((1) (1))))) (((((1) (1))) (((1) (1))))))) (((((((1) (1))) (((1) (1))))) (((((1) (1))) (((1) (1))))))))) (((((((((1) (1))) (((1) (1))))) (((((1) (1))) (((1) (1))))))) (((((((1) (1))) (((1) (1))))) (((((1) (1))) (((1) (1)))))))))) 0) 0) 0) 0) 0) 0) 0) 0) 0) 0) 1)
(test (#10D((((((((((1) (1))) (((1) (1))))) (((((1) (1))) (((1) (1))))))) (((((((1) (1))) (((1) (1))))) (((((1) (1))) (((1) (1))))))))) (((((((((1) (1))) (((1) (1))))) (((((1) (1))) (((1) (1))))))) (((((((1) (1))) (((1) (1))))) (((((1) (1))) (((1) (1)))))))))) 0 0 0 0 0 0 0 0 0 0) 1)
(let ((v (make-vector (make-list 100 1) 0)))
  (test (equal? v #100D((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((0))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) #t)
  (test (apply v (make-list 100 0)) 0)
  (test (v 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) 0))

;; eval-string here else these are read errors
(test (eval-string "#3D(((1 2) (3 4)) ((5 6) (7)))") 'error)
(test (eval-string "#3D(((1 2) (3 4)) ((5) (7 8)))") 'error)
(test (eval-string "#3D(((1 2) (3 4)) (() (7 8)))") 'error)
(test (eval-string "#3D(((1 2) (3 4)) ((5 6) (7 8 9)))") 'error)
(test (eval-string "#3D(((1 2) (3 4)) (5 (7 8 9)))") 'error)
(test (eval-string "#3D(((1 2) (3 4)) ((5 6) (7 . 8)))") 'error)
(test (eval-string "#3D(((1 2) (3 4)) ((5 6) (7 8 . 9)))") 'error)
(test (eval-string "#3D(((1 2) (3 4)) ((5 6) ()))") 'error)
(test (eval-string "#3D(((1 2) (3 4)) ((5 6)))") 'error)

(test (vector-dimensions #3D(((1 2) (3 4)) ((5 6) (7 8)))) '(2 2 2))
(test (vector-dimensions #2d((1 2 3) (4 5 6))) '(2 3))
(test (vector-dimensions #4d((((1) (2)) ((3) (4)) ((5) (6))))) '(1 3 2 1))

(test (vector-length #3D(((1 2) (3 4)) ((5 6) (7 8)))) 8)
(test (length #2d((1 2 3) (4 5 6))) 6)

(test (#2d((1 (2) 3) (4 () 6)) 0 1) '(2))
(test (#2d((1 (2) 3) (4 () 6)) 1 1) ())
(test (#2d((1 (2) 3) (4 6 ())) 1 2) ())
(test (#2d((() (2) ()) (4 5 6)) 0 2) ())

(test (equal? (make-vector 0) (make-vector '(0))) #t)
(test (equal? #() (make-vector '(0))) #t)

(test (equal? #2d((1 2) (3 4)) #2D((1 2) (3 4))) #t)
(test (eq? #2d((1 2) (3 4)) #2D((1 2) (3 4))) #f)
(test (eqv? #2d((1 2) (3 4)) #2D((1 2) (3 4))) #f)
(test (make-vector (1 . 2) "hi") 'error)
(test (make-vector (cons 1 2) "hi") 'error)
(test (equal? (make-vector 0) (vector)) #t)
(test (equal? #() (vector)) #t)
(test (equal? (make-int-vector 0 0) (make-int-vector 0 0)) #t)
(test (equal? #() (make-int-vector 0 0)) #t)
(test (equal? (make-vector '(2 0)) (make-int-vector '(2 0) 0)) #t)
(test (equal? (make-vector '(2 0)) (make-int-vector '(0 2) 0)) #f)

(let ((v (make-vector '(2 3) 0)))
  (num-test (vector-length v) 6)
  (test (vector-dimensions v) '(2 3))
  (num-test (v 0 0) 0)
  (num-test (v 1 2) 0)
  (test (v 2 2) 'error)
  (test (v 2 -1) 'error)
  (test (v 2 0) 'error)
  (set! (v 0 1) 1)
  (num-test (v 0 1) 1)
  (num-test (v 1 0) 0)
  (set! (v 1 2) 2)
  (num-test (v 1 2) 2)
  (test (set! (v 2 2) 32) 'error)
  (test (set! (v 1 -1) 0) 'error)
  (test (set! (v 2 0) 0) 'error)
  (num-test (vector-ref v 0 1) 1)
  (num-test (vector-ref v 1 2) 2)
  (test (vector-ref v 2 2) 'error)
  (test (vector-ref v 1 -1) 'error)
  (vector-set! v 1 1 64)
  (num-test (vector-ref v 1 1) 64)
  (num-test (vector-ref v 0 0) 0)
  (test (vector-ref v 1 2 3) 'error)
  (test (vector-set! v 1 2 3 4) 'error)
  (test (v 1 1 1) 'error)
  (test (set! (v 1 1 1) 1) 'error))


(let ((v1 (make-vector '(3 2) 0))
      (v2 (make-vector '(2 3) 0))
      (v3 (make-vector '(2 3 4) 0))
      (v4 (make-vector 6 0))
      (v5 (make-vector '(2 3) 0)))
  (test (equal? v1 v2) #f)
  (test (equal? v1 v3) #f)
  (test (equal? v1 v4) #f)
  (test (equal? v2 v2) #t)
  (test (equal? v3 v2) #f)
  (test (equal? v4 v2) #f)
  (test (equal? v5 v2) #t)
  (test (equal? v4 v3) #f)
  (test (vector-dimensions v3) '(2 3 4))
  (test (vector-dimensions v4) '(6))
  (num-test (v3 1 2 3) 0)
  (set! (v3 1 2 3) 32)
  (num-test (v3 1 2 3) 32)
  (num-test (vector-length v3) 24)
  (num-test (vector-ref v3 1 2 3) 32)
  (vector-set! v3 1 2 3 -32)
  (num-test (v3 1 2 3) -32)
  (test (v3 1 2) #(0 0 0 -32))
  (test (set! (v3 1 2) 3) 'error)
  (test (vector-ref v3 1 2) #(0 0 0 -32))
  (test (vector-set! v3 1 2 32) 'error))

(test (let ((v #2d((1 2) (3 4)))) (vector-fill! v #t) v) #2D((#t #t) (#t #t)))

(test (eval-string "#2d((1 2) #2d((3 4) 5 6))") 'error)
(test (string=? (object->string #2d((1 2) (3 #2d((3 4) (5 6))))) "#2D((1 2) (3 #2D((3 4) (5 6))))") #t)
(test (string=? (object->string #3d(((#2d((1 2) (3 4)) #(1)) (#3d(((1))) 6)))) "#3D(((#2D((1 2) (3 4)) #(1)) (#3D(((1))) 6)))") #t)

(test (make-vector '(2 -2)) 'error)
(test (make-vector '(2 1/2)) 'error)
(test (make-vector '(2 1.2)) 'error)
(test (make-vector '(2 2+i)) 'error)
(test (make-vector '(2 "hi")) 'error)

(let ((v (make-vector '(1 1 1) 32)))
  (test (vector? v) #t)
  (test (equal? v #()) #f)
  (test (vector->list v) '(32))
  (test (vector-ref v 0) '#2D((32)))
  (test (vector-set! v 0 0) 'error)
  (test (vector-ref v 0 0) #(32))
  (test (vector-set! v 0 0 0) 'error)
  (test (vector-ref v 0 0 0) 32)
  (test (let () (vector-set! v 0 0 0 31) (vector-ref v 0 0 0)) 31)
  (test (vector-length v) 1)
  (test (vector-dimensions v) '(1 1 1))
  (test (object->string v) "#3D(((31)))")
  )

(test (vector? #3D(((32)))) #t)
(test (equal? #3D(((32))) #()) #f)
(test (vector->list #3D(((32)))) '(32))
(test (#3D(((32))) 0) '#2D((32)))
(test (set! (#3D(((32))) 0) 0) 'error)
(test (#3D(((32))) 0 0) #(32))
(test (set! (#3D(((32))) 0 0) 0) 'error)
(test (#3D(((32))) 0 0 0) 32)
(test (vector-length #3D(((32)))) 1)
(test (vector-dimensions #3D(((32)))) '(1 1 1))
(test (object->string #3D(((32)))) "#3D(((32)))")


(let ((v1 (make-vector '(1 0))))
  (test (vector? v1) #t)
  (test (equal? v1 #()) #f)
  (test (vector->list v1) ())
  (test (vector-ref v1 0) 'error)
  (test (vector-set! v1 0 0) 'error)
  (test (vector-ref v1 0 0) 'error)
  (test (vector-set! v1 0 0 0) 'error)
  (test (vector-length v1) 0)
  (test (vector-dimensions v1) '(1 0))
  (test (object->string v1) "#2D()")
  )

(let ((v2 (make-vector '(10 3 0))))
  (test (vector? v2) #t)
  (test (equal? v2 #()) #f)
  (test (vector->list v2) ())
  (test (vector-ref v2) 'error)
  (test (vector-set! v2 0) 'error)
  (test (vector-ref v2 0) 'error)
  (test (vector-set! v2 0 0) 'error)
  (test (vector-ref v2 0 0) 'error)
  (test (vector-set! v2 0 0 0) 'error)
  (test (vector-ref v2 1 2 0) 'error)
  (test (vector-set! v2 1 2 0 0) 'error)
  (test (vector-length v2) 0)
  (test (vector-dimensions v2) '(10 3 0))
  (test (object->string v2) "#3D()")
  )

(let ((v3 (make-vector '(10 0 3))))
  (test (vector? v3) #t)
  (test (equal? v3 #()) #f)
  (test (vector->list v3) ())
  (test (vector-ref v3) 'error)
  (test (vector-set! v3 0) 'error)
  (test (vector-ref v3 0) 'error)
  (test (vector-set! v3 0 0) 'error)
  (test (vector-ref v3 0 0) 'error)
  (test (vector-set! v3 0 0 0) 'error)
  (test (vector-ref v3 1 0 2) 'error)
  (test (vector-set! v3 1 0 2 0) 'error)
  (test (vector-length v3) 0)
  (test (vector-dimensions v3) '(10 0 3))
  (test (object->string v3) "#3D()")
  )

(test (((#(("hi") ("ho")) 0) 0) 1) #\i)
(test (string-ref (list-ref (vector-ref #(("hi") ("ho")) 0) 0) 1) #\i)

(test (equal? #2D() (make-vector '(0 0))) #t)
(test (equal? #2D() (make-vector '(1 0))) #f)
(test (equal? (make-vector '(2 2) 2) #2D((2 2) (2 2))) #t)
(test (equal? (make-vector '(2 2) 2) #2D((2 2) (1 2))) #f)
(test (equal? (make-vector '(1 2 3) 0) (make-vector '(1 2 3) 0)) #t)
(test (equal? (make-vector '(1 2 3) 0) (make-vector '(1 3 2) 0)) #f)
(test (make-vector '1 2 3) 'error)

(test (set! (vector) 1) 'error)
(test (set! (make-vector 1) 1) 'error)
(test (equal? (make-vector 10 ()) (make-hash-table 10)) #f)
(test (equal? #() (copy #())) #t)
(test (equal? #2d() (copy #2d())) #t)
(test (fill! #() 1) 1)
(test (fill! #2d() 1) 1)

(test (equal? #2d((1 2) (3 4)) (copy #2d((1 2) (3 4)))) #t)
(test (equal? #3d() #3d(((())))) #f)
(test (equal? #3d() #3d()) #t)
(test (equal? #1d() #1d()) #t)
(test (equal? #3d() #2d()) #f)
(test (equal? #3d() (copy #3d())) #t)
(test (equal? #2d((1) (2)) #2d((1) (3))) #f)
(test (equal? #2d((1) (2)) (copy #2d((1) (2)))) #t)
(test (equal? (make-vector '(3 0 1)) (make-vector '(3 0 2))) #f)
(test (eval-string "#0d()") 'error)

(let ((v #2d((1 2 3) (4 5 6))))
  (let ((v1 (v 0))
	(v2 (v 1)))
    (if (not (equal? v1 #(1 2 3)))
	(format #t ";(v 0) subvector: ~A~%" v1))
    (if (not (equal? v2 #(4 5 6)))
	(format #t ";(v 1) subvector: ~A~%" v2))
    (let ((v3 (copy v1)))
      (if (not (equal? v3 #(1 2 3)))
	  (format #t ";(v 0) copied subvector: ~A~%" v3))
      (if (not (= (length v3) 3))
	  (format #t ";(v 0) copied length: ~A~%" (length v3)))
      (if (not (equal? v3 (copy (v 0))))
	  (format #t ";(v 0) copied subvectors: ~A ~A~%" v3 (copy (v 0)))))))

(let ((v1 (make-vector '(3 2 1) #f))
      (v2 (make-vector '(3 2 1) #f)))
  (test (equal? v1 v2) #t)
  (set! (v2 0 0 0) 1)
  (test (equal? v1 v2) #f))
(test (equal? (make-vector '(3 2 1) #f) (make-vector '(1 2 3) #f)) #f)

(test (map (lambda (n) n) #2d((1 2) (3 4))) '(1 2 3 4))
(test (let ((vals ())) (for-each (lambda (n) (set! vals (cons n vals))) #2d((1 2) (3 4))) vals) '(4 3 2 1))
(test (map (lambda (x y) (+ x y)) #2d((1 2) (3 4)) #1d(4 3 2 1)) '(5 5 5 5))
(test (let ((vals ())) (for-each (lambda (x y) (set! vals (cons (+ x y) vals))) #2d((1 2) (3 4)) #1d(4 3 2 1)) vals) '(5 5 5 5))

(let ((v #2D((#(1 2) #(3 4)) (#2d((5 6) (7 8)) #2D((9 10 11) (12 13 14))))))
  (test (v 0 0) #(1 2))
  (test (v 0 1) #(3 4))
  (test (v 1 0) #2d((5 6) (7 8)))
  (test (v 1 1) #2D((9 10 11) (12 13 14)))
  (test ((v 1 0) 0 1) 6)
  (test ((v 0 1) 1) 4)
  (test ((v 1 1) 1 2) 14))

(let ((v #2D((#((1) #(2)) #(#(3) (4))) (#2d(((5) #(6)) (#(7) #(8))) #2D((#2d((9 10) (11 12)) (13)) (14 15))))))
  (test (v 0 0) #((1) #(2)))
  (test (v 0 1) #(#(3) (4)))
  (test (v 1 0) #2D(((5) #(6)) (#(7) #(8))))
  (test (v 1 1) #2D((#2D((9 10) (11 12)) (13)) (14 15)))
  (test ((v 1 0) 0 1) #(6))
  (test (((v 1 0) 0 1) 0) 6)
  (test ((v 0 1) 1) '(4))
  (test (((v 1 1) 0 0) 1 0) 11))


(test (let ((V #2D((1 2 3) (4 5 6)))) (V 0)) #(1 2 3))
(test (let ((V #2D((1 2 3) (4 5 6)))) (V 1)) #(4 5 6))
(test (let ((V #2D((1 2 3) (4 5 6)))) (V 2)) 'error)
(test (let ((V #2D((1 2 3) (4 5 6)))) (set! (V 1) 0)) 'error)
(test (let ((V #2D((1 2 3) (4 5 6)))) (let ((V1 (V 0))) (set! (V1 1) 32) V)) '#2D((1 32 3) (4 5 6)))
(test (let ((V #2D((1 2 3) (4 5 6)))) (let ((V1 (V 0))) (set! (V1 3) 32) V)) 'error)

(test (let ((V '#3D(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (V 1)) '#2D((7 8 9) (10 11 12)))
(test (let ((V '#3D(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (V 1 1)) #(10 11 12))
(test (let ((V '#3D(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (V 0 1)) #(4 5 6))
(test (let ((V '#3D(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (V 2 1)) 'error)
(test (let ((V '#3D(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) ((V 0) 1)) #(4 5 6))
(test (let ((V '#3D(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (set! (((V 0) 1) 1) 32) V) '#3D(((1 2 3) (4 32 6)) ((7 8 9) (10 11 12))))
(test (let ((V '#3D(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (vector-set! V 0 1 1 32) V) '#3D(((1 2 3) (4 32 6)) ((7 8 9) (10 11 12))))
(test (let ((V '#3D(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (vector-set! V 1 1 0 32) V) '#3D(((1 2 3) (4 5 6)) ((7 8 9) (32 11 12))))
(test (let ((V '#3D(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (vector-length (V 1))) 6)
(test (let ((V '#3D(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (vector-dimensions (V 1))) '(2 3))
(test (let ((V '#3D(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (vector-length (V 0 1))) 3)
(test (let ((V '#3D(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12))))) (vector-dimensions (V 0 1))) '(3))
(test (let ((V '#3D(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12)))) (one 1) (zero 0)) 
	(let ((V1 (V one zero))
	      (sum 0))
	  (for-each (lambda (n) (set! sum (+ sum n))) V1)
	  sum))
      24) ; 7 8 9
(test (let ((V '#3D(((1 2 3) (4 5 6)) ((7 8 9) (10 11 12)))) (two 2) (one 1) (zero 0)) 
	(let ((V10 (V one zero))
	      (V00 (V zero zero))
	      (V01 (V zero one))
	      (V11 (V one one))
	      (sum 0))
	  (for-each (lambda (n0 n1 n2 n3) (set! sum (+ sum n0 n1 n2 n3))) V00 V01 V10 V11)
	  sum))
      78)

(let-temporarily (((*s7* 'print-length) 32))
  (test (object->string (make-vector '(8 8) 0)) "#2D((0 0 0 0 0 0 0 0) (0 0 0 0 0 0 0 0) (0 0 0 0 0 0 0 0) (0 0 0 0 0 0 0 0)...)")
  (test (object->string (make-vector 64 0)) "#(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...)")
  (test (object->string (make-vector 32 0)) "#(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)")
  (test (object->string (make-vector 33 0)) "#(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...)")
  (test (object->string (make-vector '(8 4) 0)) "#2D((0 0 0 0) (0 0 0 0) (0 0 0 0) (0 0 0 0) (0 0 0 0) (0 0 0 0) (0 0 0 0) (0 0 0 0))"))

(let-temporarily (((*s7* 'print-length) 1024))
  (test (object->string (make-vector '(2 1 2 1 2 1 2 1 2 1 2 1 2 1) 0)) "#14D((((((((((((((0) (0))) (((0) (0))))) (((((0) (0))) (((0) (0))))))) (((((((0) (0))) (((0) (0))))) (((((0) (0))) (((0) (0))))))))) (((((((((0) (0))) (((0) (0))))) (((((0) (0))) (((0) (0))))))) (((((((0) (0))) (((0) (0))))) (((((0) (0))) (((0) (0))))))))))) (((((((((((0) (0))) (((0) (0))))) (((((0) (0))) (((0) (0))))))) (((((((0) (0))) (((0) (0))))) (((((0) (0))) (((0) (0))))))))) (((((((((0) (0))) (((0) (0))))) (((((0) (0))) (((0) (0))))))) (((((((0) (0))) (((0) (0))))) (((((0) (0))) (((0) (0))))))))))))) (((((((((((((0) (0))) (((0) (0))))) (((((0) (0))) (((0) (0))))))) (((((((0) (0))) (((0) (0))))) (((((0) (0))) (((0) (0))))))))) (((((((((0) (0))) (((0) (0))))) (((((0) (0))) (((0) (0))))))) (((((((0) (0))) (((0) (0))))) (((((0) (0))) (((0) (0))))))))))) (((((((((((0) (0))) (((0) (0))))) (((((0) (0))) (((0) (0))))))) (((((((0) (0))) (((0) (0))))) (((((0) (0))) (((0) (0))))))))) (((((((((0) (0))) (((0) (0))))) (((((0) (0))) (((0) (0))))))) (((((((0) (0))) (((0) (0))))) (((((0) (0))) (((0) (0))))))))))))))")

  (test (object->string (make-vector '(16 1 1 1 1 1 1 1 1 1 1 1 1 1) 0)) "#14D((((((((((((((0))))))))))))) (((((((((((((0))))))))))))) (((((((((((((0))))))))))))) (((((((((((((0))))))))))))) (((((((((((((0))))))))))))) (((((((((((((0))))))))))))) (((((((((((((0))))))))))))) (((((((((((((0))))))))))))) (((((((((((((0))))))))))))) (((((((((((((0))))))))))))) (((((((((((((0))))))))))))) (((((((((((((0))))))))))))) (((((((((((((0))))))))))))) (((((((((((((0))))))))))))) (((((((((((((0))))))))))))) (((((((((((((0))))))))))))))")

;;; now see if our shared vector has survived...
  (test (and (vector? check-shared-vector-after-gc)
	     (= (length check-shared-vector-after-gc) 6)
	     (do ((i 0 (+ i 1))
		  (happy #t))
		 ((= i 6) happy)
	       (if (or (not (pair? (check-shared-vector-after-gc i)))
		       (not (equal? (check-shared-vector-after-gc i) (cons 3 i))))
		   (set! happy #f))))
	#t)
  (set! check-shared-vector-after-gc #f))



;;; -------- circular structures --------

;;; here's an oddity:

(let ((l1 (make-list 1 #f))
      (l2 (make-list 3 #f)))
  (set-cdr! l1 l1)
  (set-cdr! (list-tail l2 2) l2)
  (test (equal? l1 l2) #t))  ; but (eq? l1 (cdr l1)): #t, and (eq? l2 (cdr l2)): #f

(let ((l1 (make-list 1 #f))
      (l2 (make-list 3 #f)))
  (set-car! l1 #t)
  (set-car! l2 #t)
  (set-cdr! l1 l1)
  (set-cdr! (list-tail l2 2) l2)
  (test (equal? l1 l2) #f))

;;; Guile agrees on the first, but hangs on the second
;;; CL says the first is false, but hangs on the second
;;; r7rs agrees with s7 here, to my dismay.

;;; other cases:
(let ((l1 (list #f #f))
      (l2 (list #f #f)))
  (set-cdr! l1 l1)
  (set-cdr! (cdr l2) l2)
  (test (equal? l1 l2) #t))

(let ((l1 (list #f #f #f))
      (l2 (list #f #f #f)))
  (set-cdr! (cdr l1) l1)
  (set-cdr! (cddr l2) l2)
  (test (equal? l1 l2) #f)) ; r7rs says #t I think

(let ((l1 (list #f #f #f))
      (l2 (list #f #f #f)))
  (set-cdr! (cdr l1) l1)
  (set-cdr! (cddr l2) (cdr l2))
  (test (equal? l1 l2) #t))

;;; Gauche says #t #f #t #t #t, as does chibi
;;; Guile-2.0 hangs on all, as does Chicken

(let ((l1 (list #t #f #f))
      (l2 (list #t #f #t)))
  (set-cdr! (cdr l1) l1)
  (set-cdr! (cddr l2) (cdr l2))
  (test (equal? l1 l2) #t))

(let ((l1 (list #t #f #f))
      (l2 (list #t #f #f #t)))
  (set-cdr! (cddr l1) l1)
  (set-cdr! (cdddr l2) (cdr l2))
  (test (equal? l1 l2) #t))


;;; cyclic-sequences

(define* (make-circular-list n init)
  (let ((l (make-list n init)))
    (set-cdr! (list-tail l (- n 1)) l)))

(define (cyclic? obj) (not (null? (cyclic-sequences obj))))

(for-each
 (lambda (arg)
   (test (cyclic? arg) #f))
  (list "hi" "" #\null #\a () #() 1 '(1 . 2) (cons #\a #\b) #f 'a-symbol abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))
       (let ((x '(1 2))) (list x x))
       (let ((x #(1 2))) (vector x x))
       (let ((x "a")) (list (vector x) x))
       (let ((x (hash-table '(a . 1)))) (vector x (list x x) (inlet 'b x)))
       (let ((x '(1))) (let ((y (list x))) (list x (list y))))))

(test (cyclic-sequences) 'error)
(test (cyclic-sequences (list 1 2) (list 3 4)) 'error)

(test (let ((y (make-circular-list 3))) (let ((x (cyclic-sequences y))) (list (length x) (eq? (car x) y)))) '(1 #t))
(test (let ((y (make-circular-list 3))) (let ((x (cyclic-sequences (vector y)))) (list (length x) (eq? (car x) y)))) '(1 #t))
(test (let ((y (make-circular-list 3))) (let ((x (cyclic-sequences (list y (vector y))))) (list (length x) (eq? (car x) y)))) '(1 #t))
(test (let* ((y (list 1)) (x (vector y))) (set! (y 0) x) (eq? x (car (cyclic-sequences x)))) #t)
(test (let ((x (hash-table (cons 'a (make-circular-list 1))))) (eq? (car (cyclic-sequences x)) (x 'a))) #t)
(test (let ((x (list (make-circular-list 1) (make-circular-list 2)))) (length (cyclic-sequences x))) 2)
(test (let ((l1 '(1))) (let ((l2 (cons l1 l1))) (cyclic-sequences l2))) ())
(test (let ((l1 '(1))) (let ((l2 (list l1 l1))) (cyclic-sequences l2))) ())
(test (let ((y '(1))) 
	(let ((x (list (make-circular-list 1) y y)))
	  (set-cdr! (cddr x) (cdr x))
	  (let ((z (cyclic-sequences x)))
	    (list (length z) (and (memq (cdr x) z) #t))))) ; "and" here just to make the result easier to check
      '(2 #t))
(test (let ((z (vector 1 2)))
	(let ((y (list 1 z 2)))
	  (let ((x (hash-table (cons 'x y))))
	    (set! (z 1) x)
	    (length (cyclic-sequences z)))))
      1)
(test (let ((x '(1 2)))
	(let ((y (list x x)))
	  (let ((z (vector x y)))
	    (null? (cyclic-sequences z)))))
      #t)
(test (let ((v (vector 1 2 3 4)))
	(let ((lst (list 1 2)))
	  (set-cdr! (cdr lst) lst)
	  (set! (v 0) v)
	  (set! (v 3) lst) 
	  (length (cyclic-sequences v))))
      2)

(test (infinite? (length (make-circular-list 3))) #t)
(test (object->string (make-circular-list 3)) "#1=(#f #f #f . #1#)")

(let ((lst (list 1 2 3)))
   (set! (cdr (cddr lst)) lst)
   (test (apply + lst) 'error)
   (test (cyclic? lst) #t)
   (test (eq? (car (cyclic-sequences lst)) lst) #t))

(let ((l1 (list 1)))
  (test (object->string (list l1 1 l1)) "((1) 1 (1))") ; was "(#1=(1) 1 #1#)"
  (test (cyclic? (list l1 1 l1)) #f))

(let ((lst (list 1 2)))
   (set! (cdr (cdr lst)) (cdr lst))
   (test (object->string lst) "(1 . #1=(2 . #1#))")
   (test (object->string lst :readable) "(let (({1} #f)) (let (({lst} (make-list 2))) (let (({x} {lst})) (set-car! {x} 1) (set! {x} (cdr {x})) (set-car! {x} 2) (set-cdr! {x} (set! {1} (let (({lst} (make-list 1))) (set! {1} {lst}) (let (({x} {lst})) (set-car! {x} 2) (set-cdr! {x} {1}) ) {lst}))) ) {lst}))"))

(let ((lst (list 1 2 3)))
   (set! (cdr (cddr lst)) lst)
   (test (object->string (append '(1) lst)) "(1 . #1=(1 2 3 . #1#))"))
(let ((lst (list 1 2 3)))
   (set! (cdr (cddr lst)) lst)
   (test (append lst ()) 'error)) 

(let ((lst (list 1 2 3)))
   (set! (cdr (cddr lst)) lst)
   (test (sort! lst <) 'error))

(let ((lst (list 1 2 3)))
   (set! (cdr (cddr lst)) lst)
   (test (object->string (list lst)) "(#1=(1 2 3 . #1#))"))

(let ((lst (list 1 2 3)))
   (set! (cdr (cddr lst)) lst)
   (test (object->string (make-list 4 lst)) "(#1=(1 2 3 . #1#) #1# #1# #1#)"))

(let ((lst (list 1 2 3)))
   (set! (cdr (cddr lst)) lst)
   (test (object->string (vector lst lst)) "#(#1=(1 2 3 . #1#) #1#)"))

(let ((lst `(+ 1 2 3)))
   (set! (cdr (cdddr lst)) (cddr lst)) 
   (test (object->string lst) "(+ 1 . #1=(2 3 . #1#))"))


(let ((x (list 1 2)))
  (test (equal? x x) #t)
  (test (equal? x (cdr x)) #f)
  (test (equal? x ()) #f))
(let ((x (list 1 (list 2 3) (list (list 4 (list 5)))))
      (y (list 1 (list 2 3) (list (list 4 (list 5))))))
  (test (equal? x y) #t))
(let ((x (list 1 (list 2 3) (list (list 4 (list 5)))))
      (y (list 1 (list 2 3) (list (list 4 (list 5) 6)))))
  (test (equal? x y) #f))

(test (length ()) 0)
(test (length (cons 1 2)) -1)
(test (length '(1 2 3)) 3)

(let ((lst1 (list 1 2))) 
  (test (length lst1) 2)
  (list-set! lst1 0 lst1)
  (test (length lst1) 2) ; its car is a circular list, but it isn't
  (test (eq? ((cyclic-sequences lst1) 0) lst1) #t)
  (test (list->string lst1) 'error)
  (let ((lst2 (list 1 2)))
    (set-car! lst2 lst2)
    (test (equal? lst1 lst2) #t)
    (test (morally-equal? lst1 lst2) #t)
    (test (eq? lst1 lst2) #f)
    (test (eqv? lst1 lst2) #f)
    (test (pair? lst1) #t)
    (test (null? lst1) #f)
    (test (car lst2) lst2)
    (test (car lst1) lst1)
    (test (let ()
	    (fill! lst1 32)
	    lst1)
	  '(32 32))))

(let ((lst1 (list 1))) 
  (test (length lst1) 1)
  (set-cdr! lst1 lst1)
  (test (infinite? (length lst1)) #t)
  (test (eq? (cdr ((cyclic-sequences lst1) 0)) lst1) #t)
  (test (null? lst1) #f)
  (test (pair? lst1) #t)
  (let ((lst2 (cons 1 ())))
    (set-cdr! lst2 lst2)
    (test (equal? lst1 lst2) #t)
    (test (morally-equal? lst1 lst2) #t)
    (set-car! lst2 0)
    (test (equal? lst1 lst2) #f)
    (test (morally-equal? lst1 lst2) #f)
    (test (infinite? (length lst2)) #t)))

(let ((lst1 (list 1))) 
  (set-cdr! lst1 lst1)
  (test (list-tail lst1 0) lst1)
  (test (list-tail lst1 3) lst1)
  (test (list-tail lst1 10) lst1))

(let ((lst1 (let ((lst (list 'a))) 
	      (set-cdr! lst lst)
	      lst)))
  (test (apply lambda lst1 (list 1)) 'error)) ; lambda parameter 'a is used twice in the lambda argument list !

(let ((lst1 (list 1))
      (lst2 (list 1)))
  (set-car! lst1 lst2)
  (set-car! lst2 lst1)
  (test (equal? lst1 lst2) #t)
  (test (morally-equal? lst1 lst2) #t)
  (test (length lst1) 1)
  (let ((lst3 (list 1)))
    (test (equal? lst1 lst3) #f)
    (test (morally-equal? lst1 lst3) #f)
    (set-cdr! lst3 lst3)
    (test (equal? lst1 lst3) #f)
    (test (morally-equal? lst1 lst3) #f)))

(let ((lst1 (list 'a 'b 'c)))
  (set! (cdr (cddr lst1)) lst1)
  (test (infinite? (length lst1)) #t)
  (test (memq 'd lst1) #f)
  (test (memq 'a lst1) lst1)
  (test (memq 'b lst1) (cdr lst1)))

(let ((lst1 (list 1 2 3)))
  (list-set! lst1 1 lst1)
  (test (object->string lst1) "#1=(1 #1# 3)"))

(let ((lst1 (let ((lst (list 1))) 
	      (set-cdr! lst lst)
	      lst)))
  (test (list-ref lst1 9223372036854775807) 'error)
  (test (list-set! lst1 9223372036854775807 2) 'error)
  (test (list-tail lst1 9223372036854775807) 'error)
  (test (make-vector lst1 9223372036854775807) 'error)
  (let-temporarily (((*s7* 'safety) 1))
    (test (not (member (map (lambda (x) x) lst1) (list () '(1)))) #f) ; geez -- just want to allow two possible ok results
    (test (not (member (map (lambda (x y) x) lst1 lst1) (list () '(1)))) #f)
    (test (for-each (lambda (x) x) lst1) #<unspecified>) ; was 'error
    (test (for-each (lambda (x y) x) lst1 lst1) #<unspecified>) ; was 'error
    (test (not (member (map (lambda (x y) (+ x y)) lst1 '(1 2 3)) (list () '(2)))) #f)))

(test (map abs (let ((lst (list 0))) (set! (cdr lst) lst))) '(0))
(test (map (lambda (x) x) (let ((lst (list 0))) (set! (cdr lst) lst))) '(0))
(test (map abs (let ((lst (list 0 1))) (set-cdr! (cdr lst) lst))) '(0 1 0))
(test (map (lambda (x) x) (let ((lst (list 0 1))) (set-cdr! (cdr lst) lst))) '(0 1))

(let ((lst1 (list 1 -1)))
  (set-cdr! (cdr lst1) lst1)
  (let ((vals (map * '(1 2 3 4) lst1)))
    (test vals '(1 -2)))) ; was '(1 -2 3 -4), then later (1) -- as in other cases above, map/for-each stop when a cycle is encountered

(test (let ((lst '(a b c)))
	(set! (cdr (cddr lst)) lst)
	(map cons lst '(0 1 2 3 4 5)))
      '((a . 0) (b . 1) (c . 2) (a . 3)))

(test (object->string (let ((l1 (list 0 1))) (set! (l1 1) l1) (copy l1))) "(0 #1=(0 #1#))")

;;; this changed 11-Mar-15
;;;(test (object->string (let ((lst (list 1 2))) (set! (cdr lst) lst) (copy lst))) "(1 . #1=(1 . #1#))")
(test (object->string (let ((lst (list 1 2))) (set! (cdr lst) lst) (copy lst))) "#1=(1 . #1#)") 
(test (object->string (let ((lst (list 1 2))) (set! (cdr lst) lst) lst))        "#1=(1 . #1#)")

(test (object->string (let ((l1 (list 1 2))) (copy (list l1 4 l1)))) "((1 2) 4 (1 2))") ; was "(#1=(1 2) 4 #1#)"
;;;(test (object->string (let ((lst (list 1 2 3))) (set! (cdr (cddr lst)) (cdr lst)) (copy lst))) "(1 2 3 . #1=(2 3 . #1#))")
(test (object->string (let ((lst (list 1 2 3))) (set! (cdr (cddr lst)) (cdr lst)) (copy lst))) "(1 . #1=(2 3 . #1#))")
(test (object->string (let ((lst (list 1 2 3))) (set! (cdr (cddr lst)) (cdr lst)) lst))        "(1 . #1=(2 3 . #1#))")

(test (object->string (let ((lst (list 1 2 3))) (set! (cdr (cddr lst)) (cddr lst)) (copy lst))) "(1 2 . #1=(3 . #1#))")
(test (object->string (let ((lst (list 1 2 3))) (set! (cdr (cddr lst)) (cddr lst)) lst))        "(1 2 . #1=(3 . #1#))")

;;;(test (object->string (let ((lst (list 1 2 3 4))) (set! (cdr (cdddr lst)) (cddr lst)) (copy lst))) "(1 2 3 4 . #1=(3 4 . #1#))")
(test (object->string (let ((lst (list 1 2 3 4))) (set! (cdr (cdddr lst)) (cddr lst)) (copy lst))) "(1 2 . #1=(3 4 . #1#))")
(test (object->string (let ((lst (list 1 2 3 4))) (set! (cdr (cdddr lst)) (cddr lst)) lst))        "(1 2 . #1=(3 4 . #1#))")

;;;(test (object->string (let ((lst (list 1 2 3 4))) (set! (cdr (cdddr lst)) (cdr lst)) (copy lst))) "(1 2 3 4 . #1=(2 3 4 . #1#))")
(test (object->string (let ((lst (list 1 2 3 4))) (set! (cdr (cdddr lst)) (cdr lst)) (copy lst))) "(1 . #1=(2 3 4 . #1#))")
(test (object->string (let ((lst (list 1 2 3 4))) (set! (cdr (cdddr lst)) (cdr lst)) lst))        "(1 . #1=(2 3 4 . #1#))")

(test (object->string (vector (let ((lst (list 1))) (set-cdr! lst lst)))) "#(#1=(1 . #1#))")
(test (object->string (let ((lst (list 1 2))) (set! (cdr (cdr lst)) lst) (set! (car lst) (vector lst)) lst)) "#1=(#(#1#) 2 . #1#)")

;; these are ugly!
(test (object->string (vector (let ((lst (list 1))) (set-cdr! lst lst))) :readable)
      "(let (({1} #f)) (vector (set! {1} (let (({lst} (make-list 1))) (set! {1} {lst}) (let (({x} {lst})) (set-car! {x} 1) (set-cdr! {x} {1}) ) {lst}))))")
(test (object->string (let ((lst (list 1 2))) (set! (cdr (cdr lst)) lst) (set! (car lst) (vector lst)) lst) :readable)
      "(let (({1} #f)) (set! {1} (let (({lst} (make-list 2))) (set! {1} {lst}) (let (({x} {lst})) (set-car! {x} (vector {1})) (set! {x} (cdr {x})) (set-car! {x} 2) (set-cdr! {x} {1}) ) {lst})))")
(test (let ((v (vector 1 2))) (set! (v 0) v) (object->string v :readable)) 
      "(let (({1} #f)) (set! {1} (let (({v} (make-vector 2))) (set! {1} {v}) (set! ({v} 0) {1}) (set! ({v} 1) 2) {v})))")
(test (let ((v (make-vector '(2 2) 0))) (set! (v 1 1) v) (object->string v :readable))
      "(let (({1} #f)) (set! {1} (let (({v} (make-vector '(2 2 )))) (set! {1} {v}) (set! ({v} 0 0) 0) (set! ({v} 0 1) 0) (set! ({v} 1 0) 0) (set! ({v} 1 1) {1}) {v})))")

(test (reverse '(1 2 (3 4))) '((3 4) 2 1))
(test (reverse '(1 2 3)) '(3 2 1))
(test (reverse ()) ())
(test (let ((lst (list 1 2 3))) (set! (lst 2) lst) (object->string (reverse lst))) "(#1=(1 2 #1#) 2 1)")
(test (let ((l1 (cons 1 ()))) (set-cdr! l1 l1) (object->string (reverse l1))) "(#1=(1 . #1#) 1 1 1)")


(test (equal? (vector 0) (vector 0)) #t)
(test (equal? (vector 0 #\a "hi" (list 1 2 3)) (vector 0 #\a "hi" (list 1 2 3))) #t)
(test (let ((v (vector 0))) (equal? (vector v) (vector v))) #t)

(let ((v1 (make-vector 1 0)))
  (set! (v1 0) v1)
  (test (vector? v1) #t)
  (let ((v2 (vector 0)))
    (vector-set! v2 0 v2)
    (test (vector-length v1) 1)
    (test (equal? v1 v2) #t)
    (test (equal? (vector-ref v1 0) v1) #t)
    (test (equal? (vector->list v1) (list v1)) #t)
    (vector-fill! v1 0)
    (test (equal? v1 (vector 0)) #t)
    (let ((v3 (copy v2)))
      (test (equal? v2 v3) #t)
      (vector-set! v3 0 0)
      (test (equal? v3 (vector 0)) #t))
    ))

(let ((v1 (make-vector 1 0))
      (v2 (vector 0)))
  (set! (v1 0) v2)
  (set! (v2 0) v1)
  (test (equal? v1 v2) #t)) 

(test (vector? (let ((v (vector 0))) (set! (v 0) v) (v 0 0 0 0))) #t) ; ?

(let* ((l1 (list 1 2))
       (v1 (vector 1 2))
       (l2 (list 1 l1 2))
       (v2 (vector l1 v1 l2)))
  (vector-set! v1 0 v2)
  (list-set! l1 1 l2)
  (test (equal? v1 v2) #f))

(let ((v1 (make-vector 1 0)))
  (set! (v1 0) v1)
  (let ((v2 (vector 0)))
    (vector-set! v2 0 v2)
    (test (equal? v1 v2) #t)))

(let ((v1 (make-vector 1 0)))
  (set! (v1 0) v1)
  (test (eq? ((cyclic-sequences v1) 0) v1) #t)
  (test (object->string v1) "#1=#(#1#)"))

(let ((l1 (cons 0 ()))) 
  (set-cdr! l1 l1) 
  (test (list->vector l1) 'error))

(let ((lst (list "nothing" "can" "go" "wrong")))
  (let ((slst (cddr lst))
	(result ()))
    (set! (cdr (cdddr lst)) slst)
    (test (do ((i 0 (+ i 1))
	       (l lst (cdr l)))
	      ((or (null? l) (= i 12))
	       (reverse result))
	    (set! result (cons (car l) result)))
	  '("nothing" "can" "go" "wrong" "go" "wrong" "go" "wrong" "go" "wrong" "go" "wrong"))))

#|
;;; here is a circular function
(let ()
  (define (cfunc)
    (begin
      (display "cfunc! ")
      #f))

  (let ((clst (procedure-source cfunc)))
    (set! (cdr (cdr (car (cdr (cdr clst)))))
	  (cdr (car (cdr (cdr clst))))))

  (cfunc))
|#

(test (let ((l (list 1 2))) 
	(list-set! l 0 l) 
	(string=? (object->string l) "#1=(#1# 2)")) 
      #t)
(test (let ((lst (list 1)))
	(set! (car lst) lst)
	(set! (cdr lst) lst)
	(string=? (object->string lst) "#1=(#1# . #1#)"))
      #t)
(test (let ((lst (list 1)))
	(set! (car lst) lst)
	(set! (cdr lst) lst)
	(equal? (car lst) (cdr lst)))
      #t)
(test (let ((lst (cons 1 2))) 
	(set-cdr! lst lst)
	(string=? (object->string lst) "#1=(1 . #1#)"))
      #t)
(test (let ((lst (cons 1 2))) 
	(set-car! lst lst)
	(string=? (object->string lst) "#1=(#1# . 2)"))
      #t)
(test (let ((lst (cons (cons 1 2) 3))) 
	(set-car! (car lst) lst)
	(string=? (object->string lst) "#1=((#1# . 2) . 3)"))
      #t)
(test (let ((v (vector 1 2))) 
	(vector-set! v 0 v) 
	(string=? (object->string v) "#1=#(#1# 2)")) 
      #t)
(test (let* ((l1 (list 1 2)) (l2 (list l1))) 
	(list-set! l1 0 l1) 
	(string=? (object->string l2) "(#1=(#1# 2))")) 
      #t)

(test (let ((lst (list 1 2 3))) (set! (cdr (cdr (cdr lst))) lst) (object->string lst)) "#1=(1 2 3 . #1#)")
(test (let ((lst (list 1 2 3))) (set! (cdr (cdr (cdr lst))) (cdr lst)) (object->string lst)) "(1 . #1=(2 3 . #1#))")
(test (let ((lst (list 1 2 3))) (set! (cdr (cdr (cdr lst))) (cdr (cdr lst))) (object->string lst)) "(1 2 . #1=(3 . #1#))")
(test (let ((lst (list 1 2 3))) (set! (car lst) (cdr lst)) (object->string lst)) "((2 3) 2 3)") ; was "(#1=(2 3) . #1#)"
(test (let ((lst (list 1 2 3))) (set! (car (cdr lst)) (cdr lst)) (object->string lst)) "(1 . #1=(#1# 3))")
(test (let ((lst (list 1 2 3))) (set! (car (cdr lst)) lst) (object->string lst)) "#1=(1 #1# 3)")
(test (let ((l1 (list 1))) (let ((l2 (list l1 l1))) (object->string l2))) "((1) (1))") ; was "(#1=(1) #1#)"

(test (let* ((v1 (vector 1 2)) (v2 (vector v1))) 
	(vector-set! v1 1 v1) 
	(string=? (object->string v2) "#(#1=#(1 #1#))")) 
      #t)
(test (let ((v1 (make-vector 3 1))) 
	(vector-set! v1 0 (cons 3 v1)) 
	(string=? (object->string v1) "#1=#((3 . #1#) 1 1)")) 
      #t)
(test (let ((h1 (make-hash-table 11))
	    (old-print-length (*s7* 'print-length)))
	(set! (*s7* 'print-length) 32)
	(hash-table-set! h1 "hi" h1)
	(let ((result (object->string h1)))
	  (set! (*s7* 'print-length) old-print-length)
	  (let ((val (string=? result "#1=(hash-table '(\"hi\" . #1#))")))
	    (if (not val)
		(format #t ";hash display:~%  ~A~%" (object->string h1)))
	    val)))
      #t)

(test (let* ((l1 (list 1 2))
	     (v1 (vector 1 2))
	     (l2 (list 1 l1 2))
	     (v2 (vector l1 v1 l2)))
	(vector-set! v1 0 v2)
	(list-set! l1 1 l2)
	(string=? (object->string v2) "#2=#(#1=(1 #3=(1 #1# 2)) #(#2# 2) #3#)"))
      #t)

(test (let ((l1 (list 1 2))
	    (l2 (list 1 2)))
	(set! (car l1) l2)
	(set! (car l2) l1)
	(object->string (list l1 l2)))
      "(#1=(#2=(#1# 2) 2) #2#)")

(test (let* ((l1 (list 1 2)) 
	     (l2 (list 3 4)) 
	     (l3 (list 5 l1 6 l2 7)))
	(set! (cdr (cdr l1)) l1) 
	(set! (cdr (cdr l2)) l2)
	(string=? (object->string l3) "(5 #1=(1 2 . #1#) 6 #2=(3 4 . #2#) 7)"))
      #t)
(test (let* ((lst1 (list 1 2))
	     (lst2 (list (list (list 1 (list (list (list 2 (list (list (list 3 (list (list (list 4 lst1 5))))))))))))))
	(set! (cdr (cdr lst1)) lst1)
	(string=? (object->string lst2) "(((1 (((2 (((3 (((4 #1=(1 2 . #1#) 5))))))))))))"))
      #t)


(test (equal? '(a) (list 'a)) #t)
(test (equal? '(a b . c) '(a b . c)) #t)
(test (equal? '(a b (c . d)) '(a b (c . d))) #t)
(test (equal? (list "hi" "hi" "hi") '("hi" "hi" "hi")) #t)
(let ((l1 (list "hi" "hi" "hi"))
      (l2 (list "hi" "hi" "hi")))
  (fill! l1 "ho")
  (test (equal? l1 l2) #f)
  (fill! l2 (car l1))
  (test (equal? l1 l2) #t))
(let ((lst (list 1 2 3 4))) 
  (fill! lst "hi") 
  (test (equal? lst '("hi" "hi" "hi" "hi")) #t))
(let ((vect (vector 1 2 3 4)))
  (fill! vect "hi")
  (test (equal? vect #("hi" "hi" "hi" "hi")) #t))
(let ((lst (list 1 2 (list 3 4) (list (list 5) 6))))
  (test (equal? lst '(1 2 (3 4) ((5) 6))) #t)
  (fill! lst #f)
  (test (equal? lst '(#f #f #f #f)) #t))
(let ((lst (list 1 2 3 4)))
  (set! (cdr (cdddr lst)) lst)
  (test (equal? lst lst) #t)
  (test (eq? lst lst) #t)
  (test (eqv? lst lst) #t)
  (fill! lst #f)
  (test (object->string lst) "#1=(#f #f #f #f . #1#)")
  (let ((l1 (copy lst)))
    (test (equal? lst l1) #t)
    (test (eq? lst l1) #f)
    (test (eqv? lst l1) #f)))


(let ((lst '(#\( #\) #\* #\+ #\, #\- #\. #\/ #\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9 #\: #\; #\< #\= #\> #\? #\@ #\A #\B #\C #\D #\E #\F #\G #\H #\I #\J #\K #\L #\M #\N #\O #\P #\Q #\R #\S #\T #\U #\V #\W #\X #\Y #\Z #\[ #\\ #\] #\^ #\_ #\` #\a #\b #\c #\d #\e #\f #\g #\h #\i #\j #\k #\l #\m #\n #\o #\p #\q #\r #\s #\t #\u #\v #\w #\x #\y #\z #\{ #\| #\} #\~)))
  (let ((str (apply string lst)))
    (let ((lstr (list->string lst)))
      (let ((strl (string->list str)))
	(test (eq? str str) #t)
	(test (eq? str lstr) #f)
	(test (eqv? str str) #t)
	(test (eqv? str lstr) #f)
	(test (equal? str lstr) #t)
	(test (equal? str str) #t)
	(test (eq? lst strl) #f)	
	(test (eqv? lst strl) #f)	
	(test (equal? lst strl) #t)
	(let ((l2 (copy lst))
	      (s2 (copy str)))
	  (test (eq? l2 lst) #f)
	  (test (eq? s2 str) #f)
	  (test (eqv? l2 lst) #f)
	  (test (eqv? s2 str) #f)
	  (test (equal? l2 lst) #t)
	  (test (equal? s2 str) #t))))))


(let ((vect #(#\( #\) #\* #\+ #\, #\- #\. #\/ #\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9 #\: #\; #\< #\= #\> #\? #\@ #\A #\B #\C #\D #\E #\F #\G #\H #\I #\J #\K #\L #\M #\N #\O #\P #\Q #\R #\S #\T #\U #\V #\W #\X #\Y #\Z #\[ #\\ #\] #\^ #\_ #\` #\a #\b #\c #\d #\e #\f #\g #\h #\i #\j #\k #\l #\m #\n #\o #\p #\q #\r #\s #\t #\u #\v #\w #\x #\y #\z #\{ #\| #\} #\~)))
  (let ((lst (vector->list vect)))
    (let ((vect1 (list->vector lst)))
	(test (eq? lst lst) #t)
	(test (eq? lst vect) #f)
	(test (eqv? lst lst) #t)
	(test (eqv? lst vect) #f)
	(test (equal? vect1 vect) #t)
	(test (equal? lst lst) #t)
	(test (eq? vect vect1) #f)	
	(test (eqv? vect vect1) #f)	
	(test (equal? vect vect1) #t)
	(let ((l2 (copy vect))
	      (s2 (copy lst)))
	  (test (eq? l2 vect) #f)
	  (test (eq? s2 lst) #f)
	  (test (eqv? l2 vect) #f)
	  (test (eqv? s2 lst) #f)
	  (test (equal? l2 vect) #t)
	  (test (equal? s2 lst) #t)))))

(let* ((vals (list "hi" #\A 1 'a #(1) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand (log 0) 
		   3.14 3/4 1.0+1.0i #\f '(1 . 2)))
       (vlen (length vals)))
  (do ((i 0 (+ i 1)))
      ((= i 20))
    (let* ((size (max 1 (random 20)))
	   (vect (make-vector size ())))
      (do ((n 0 (+ n 1)))
	  ((= n size))
	(let ((choice (random 4))
	      (len (random 4)))
	  (if (= choice 0)
	      (let ((v (make-vector len)))
		(do ((k 0 (+ k 1)))
		    ((= k len))
		  (vector-set! v k (list-ref vals (random vlen))))
		(vector-set! vect n v))
	      (if (= choice 1)
		  (let ((lst (make-list len #f)))
		    (do ((k 0 (+ k 1)))
			((= k len))
		      (list-set! lst k (list-ref vals (random vlen))))
		    (vector-set! vect n lst))
		  (vector-set! vect n (list-ref vals (random vlen)))))))
      (test (eq? vect vect) #t)
      (test (eqv? vect vect) #t)
      (test (equal? vect vect) #t)
      (let ((lst1 (vector->list vect)))
	(let ((lst2 (copy lst1)))
	  (test (eq? lst1 lst2) #f)
	  (test (eqv? lst1 lst2) #f)
	  (test (equal? lst1 lst2) #t))))))

(let* ((lst1 (list 1 2 3))
       (vec1 (vector 1 2 lst1)))
  (list-set! lst1 2 vec1)
  (let* ((lst2 (list 1 2 3))
	 (vec2 (vector 1 2 lst2)))
    (list-set! lst2 2 vec2)
    (test (equal? lst1 lst2) #t)
    (test (equal? vec1 vec2) #t)
    (vector-set! vec1 1 vec1)
    (test (equal? lst1 lst2) #f)
    (test (equal? vec1 vec2) #f)
    ))
  
(let* ((base (list #f))
       (lst1 (list 1 2 3))
       (vec1 (vector 1 2 base)))
  (list-set! lst1 2 vec1)
  (let* ((lst2 (list 1 2 3))
	 (vec2 (vector 1 2 base)))
    (list-set! lst2 2 vec2)
    (set! (car lst1) lst1)
    (set! (car lst2) lst2)
    (set! (cdr (cddr lst1)) base)
    (set! (cdr (cddr lst2)) base)
    (test (length (cyclic-sequences lst2)) 1)
    (test (equal? lst1 lst2) #t)
    (test (equal? vec1 vec2) #t)
    (test (object->string lst1) "#1=(#1# 2 #(1 2 (#f)) #f)"))) ; was "#1=(#1# 2 #(1 2 #2=(#f)) . #2#)"

(let ((base (list 0 #f)))
  (let ((lst1 (list 1 base 2))
	(lst2 (list 1 base 2)))
    (set! (cdr (cdr base)) base)
    (test (equal? lst1 lst2) #t)))

(let ((base1 (list 0 #f))
      (base2 (list 0 #f)))
  (let ((lst1 (list 1 base1 2))
	(lst2 (list 1 base2 2)))
    (set! (cdr (cdr base1)) lst2)
    (set! (cdr (cdr base2)) lst1)
    (test (equal? lst1 lst2) #t)
    (test (object->string lst1) "#1=(1 (0 #f 1 (0 #f . #1#) 2) 2)")))

(let ()
  (define-macro (c?r path)

    (define (X-marks-the-spot accessor tree)
      (if (pair? tree)
	  (or (X-marks-the-spot (cons 'car accessor) (car tree))
	      (X-marks-the-spot (cons 'cdr accessor) (cdr tree)))
	  (if (eq? tree 'X) accessor #f)))
    
    (let ((body 'lst))
      (for-each
       (lambda (f)
	 (set! body (list f body)))
       (reverse (X-marks-the-spot () path)))
      
      `(dilambda
	(lambda (lst) 
	  ,body)
	(lambda (lst val)
	  (set! ,body val)))))
  
  (define (copy-tree lis)
    (if (pair? lis)
	(cons (copy-tree (car lis))
	      (copy-tree (cdr lis)))
	lis))

  (let* ((l1 '(0 (1 (2 (3 (4 (5 (6 (7 (8))))))))))
	 (l2 (list 0 (list 1 (list 2 (list 3 (list 4 (list 5 (list 6 (list 7 (list 8))))))))))
	 (l3 (copy-tree l1))
	 (cxr (c?r (0 (1 (2 (3 (4 (5 (6 (7 (X))))))))))))
    (set! (cxr l1) 3)
    (set! (cxr l2) 4)
    (test (equal? l1 l2) #f)
    (test (equal? l1 l3) #f)
    (set! (cxr l2) 3)
    (test (cxr l2) 3)
    (test (cxr l1) 3)
    (test (cxr l3) 8)
    (test (equal? l1 l2) #t)
    (test (equal? l2 l3) #f))

  (let* ((l1 '(0 (1 (2 (3 (4 (5 (6 (7 (8))))))))))
	 (l2 (list 0 (list 1 (list 2 (list 3 (list 4 (list 5 (list 6 (list 7 (list 8))))))))))
	 (l3 (copy-tree l1))
	 (cxr (c?r (0 (1 (2 (3 (4 (5 (6 (7 (8 . X))))))))))))
    (set! (cxr l1) l1)
    (set! (cxr l2) l2)
    (test (equal? l1 l2) #t)
    (test (equal? l1 l3) #f)
    (test (object->string l2) "#1=(0 (1 (2 (3 (4 (5 (6 (7 (8 . #1#)))))))))"))

  (let* ((l1 '(0 ((((((1))))))))
	 (l2 (copy-tree l1))
	 (cxr (c?r (0 ((((((1 . X))))))))))
    (set! (cxr l1) l2)
    (set! (cxr l2) l1)
    (test (equal? l1 l2) #t))

  (let* ((l1 '(0 1 (2 3) 4 5))
	 (cxr (c?r (0 1 (2 3 . X) 4 5))))
    (set! (cxr l1) (cdr l1))
    (test (object->string l1) "(0 . #1=(1 (2 3 . #1#) 4 5))"))

  (let* ((l1 '(0 1 (2 3) 4 5))
	 (l2 '(6 (7 8 9) 10))
	 (cxr1 (c?r (0 1 (2 3 . X) 4 5)))
	 (cxr2 (c?r (6 . X)))
	 (cxr3 (c?r (6 (7 8 9) 10 . X)))
	 (cxr4 (c?r (0 . X))))
    (set! (cxr1 l1) (cxr2 l2))
    (set! (cxr3 l2) (cxr4 l1))
    (test (object->string l1) "(0 . #1=(1 (2 3 (7 8 9) 10 . #1#) 4 5))")
    (test (cadr l1) 1)
    (test (cadddr l1) 4)
    )

  (let ((l1 '((a . 2) (b . 3) (c . 4)))
	(cxr (c?r ((a . 2) (b . 3) (c . 4) . X))))
    (set! (cxr l1) (cdr l1))
    (test (assq 'a l1) '(a . 2))
    (test (assv 'b l1) '(b . 3))
    (test (assoc 'c l1) '(c . 4))
    (test (object->string l1) "((a . 2) . #1=((b . 3) (c . 4) . #1#))")
    (test (assq 'asdf l1) #f)
    (test (assv 'asdf l1) #f)
    (test (assoc 'asdf l1) #f)
    )

  (let ((l1 '(a b c d e))
	(cxr (c?r (a b c d e . X))))
    (set! (cxr l1) (cddr l1))
    (test (memq 'b l1) (cdr l1))
    (test (memv 'c l1) (cddr l1))
    (test (member 'd l1) (cdddr l1))
    (test (object->string l1) "(a b . #1=(c d e . #1#))")
    (test (memq 'asdf l1) #f)
    (test (memv 'asdf l1) #f)
    (test (member 'asdf l1) #f)
    (test (pair? (member 'd l1)) #t) ; #1=(d e c . #1#)
    )

  (let ((ctr 0)
	(x 0))
    (let ((lst `(call-with-exit (lambda (return) (set! x (+ x 1)) (if (> x 10) (return x) 0)))))
      (let ((acc1 (c?r (call-with-exit (lambda (return) . X))))
	    (acc2 (c?r (call-with-exit (lambda (return) (set! x (+ x 1)) (if (> x 10) (return x) 0) . X)))))
	(set! (acc2 lst) (acc1 lst))
	(test (eval lst (curlet)) 11))))
  )

(let ()
  ;; anonymous recursion...
  (define (fc?r path)
    (define (X-marks-the-spot accessor tree)
      (if (pair? tree)
	  (or (X-marks-the-spot (cons 'car accessor) (car tree))
	      (X-marks-the-spot (cons 'cdr accessor) (cdr tree)))
	  (if (eq? tree 'X) accessor #f)))
    (let ((body 'lst))
      (for-each
       (lambda (f)
	 (set! body (list f body)))
       (reverse (X-marks-the-spot () path)))
      (let ((getter (apply lambda '(lst) body ()))
	    (setter (apply lambda '(lst val) `(set! ,body val) ())))
	(dilambda getter setter))))
  
  (let ((body '(if (not (pair? (cdr lst))) lst (begin (set! lst (cdr lst)) X)))) ; X is where we jump back to the start
    (let ((recurse (fc?r body)))
      (set! (recurse body) body)
      (test ((apply lambda '(lst) body ()) '(1 2 3)) '(3)))))
  

  
(let ((v #2d((1 2) (3 4))))
  (set! (v 1 0) v)
  (test (object->string v) "#1=#2D((1 2) (#1# 4))")
  (test (length v) 4)
  (test ((((v 1 0) 1 0) 1 0) 0 0) 1))

(let ((lst (list 1 2 3)))
  (set! (cdr (cddr lst)) lst)
  (test (lst 100) 2)
  (test ((cdddr (cdddr (cdddr lst))) 100) 2)
  (set! (lst 100) 32)
  (test (object->string lst) "#1=(1 32 3 . #1#)"))

(let* ((l1 (list 1 2))
       (l2 (list l1 l1)))
  (set! (l1 0) 32)
  (test (equal? l2 '((32 2) (32 2))) #t))

(let ((q (list 1 2 3 4)))
  (set! (cdr (cdddr q)) q) 
  (test (car q) 1)
  (set! (car q) 5)
  (set! q (cdr q))
  (test (car q) 2)
  (test (object->string q) "#1=(2 3 4 5 . #1#)"))

(let ()
  (define make-node vector)
  (define prev (dilambda (lambda (node) (node 0)) (lambda (node val) (set! (node 0) val))))
  (define next (dilambda (lambda (node) (node 2)) (lambda (node val) (set! (node 2) val))))
  (define data (dilambda (lambda (node) (node 1)) (lambda (node val) (set! (node 1) val))))
  (let* ((head (make-node () 0 ()))
	 (cur head))
    (do ((i 1 (+ i 1)))
	((= i 8))
      (let ((next-node (make-node cur i ())))
	(set! (next cur) next-node)
	(set! cur (next cur))))
    (set! (next cur) head)
    (set! (prev head) cur)
    (test (object->string head) "#1=#(#7=#(#6=#(#5=#(#4=#(#3=#(#2=#(#8=#(#1# 1 #2#) 2 #3#) 3 #4#) 4 #5#) 5 #6#) 6 #7#) 7 #1#) 0 #8#)")
#|
    ;; in CL:
    (let* ((head (vector nil 0 nil))
	   (cur head))
      (do ((i 1 (+ i 1)))
	  ((= i 8))
	(let ((node (vector nil i nil)))
	  (setf (aref node 0) cur)
	  (setf (aref cur 2) node)
	  (setf cur node)))
      (setf (aref head 0) cur)
      (setf (aref cur 2) head)
      (format t "~A~%" head)) -> "#1=#(#2=#(#3=#(#4=#(#5=#(#6=#(#7=#(#8=#(#1# 1 #7#) 2 #6#) 3 #5#) 4 #4#) 5 #3#) 6 #2#) 7 #1#) 0 #8#)"
|#
    (let ((ahead (do ((cur head (next cur))
		      (dat () (cons (data cur) dat)))
		     ((member (data cur) dat)
		      (reverse dat)))))
      (let ((behind (do ((cur (prev head) (prev cur))
			 (dat () (cons (data cur) dat)))
			((member (data cur) dat)
			 dat))))
	(test (equal? ahead behind) #t)))))

(let ()
  (define make-node list)
  (define prev (dilambda (lambda (node) (node 0)) (lambda (node val) (set! (node 0) val))))
  (define next (dilambda (lambda (node) (node 2)) (lambda (node val) (set! (node 2) val))))
  (define data (dilambda (lambda (node) (node 1)) (lambda (node val) (set! (node 1) val))))
  (let* ((head (make-node () 0 ()))
	 (cur head))
    (do ((i 1 (+ i 1)))
	((= i 8))
      (let ((next-node (make-node cur i ())))
	(set! (next cur) next-node)
	(set! cur (next cur))))
    (set! (next cur) head)
    (set! (prev head) cur)
    (test (object->string head) "#1=(#7=(#6=(#5=(#4=(#3=(#2=(#8=(#1# 1 #2#) 2 #3#) 3 #4#) 4 #5#) 5 #6#) 6 #7#) 7 #1#) 0 #8#)")
    (let ((ahead (do ((cur head (next cur))
		      (dat () (cons (data cur) dat)))
		     ((member (data cur) dat)
		      (reverse dat)))))
      (let ((behind (do ((cur (prev head) (prev cur))
			 (dat () (cons (data cur) dat)))
			((member (data cur) dat)
			 dat))))
	(test (equal? ahead behind) #t))))
  (let* ((head (make-node () 0 ()))
	 (cur head))
    (do ((i 1 (+ i 1)))
	((= i 32))
      (let ((next-node (make-node cur i ())))
	(set! (next cur) next-node)
	(set! cur (next cur))))
    (set! (next cur) head)
    (set! (prev head) cur)
    (test (object->string head) "#1=(#31=(#30=(#29=(#28=(#27=(#26=(#25=(#24=(#23=(#22=(#21=(#20=(#19=(#18=(#17=(#16=(#15=(#14=(#13=(#12=(#11=(#10=(#9=(#8=(#7=(#6=(#5=(#4=(#3=(#2=(#32=(#1# 1 #2#) 2 #3#) 3 #4#) 4 #5#) 5 #6#) 6 #7#) 7 #8#) 8 #9#) 9 #10#) 10 #11#) 11 #12#) 12 #13#) 13 #14#) 14 #15#) 15 #16#) 16 #17#) 17 #18#) 18 #19#) 19 #20#) 20 #21#) 21 #22#) 22 #23#) 23 #24#) 24 #25#) 25 #26#) 26 #27#) 27 #28#) 28 #29#) 29 #30#) 30 #31#) 31 #1#) 0 #32#)")))

(test (let ((lst (list 1 2 3))) (set! (cdr (cddr lst)) lst) (append lst lst ())) 'error)
(test (let ((lst (list 1 2 3))) (set! (cdr (cddr lst)) lst) (object->string (append (list lst) (list lst) ()))) "(#1=(1 2 3 . #1#) #1#)")

(let ((ht (make-hash-table 3)))
  (set! (ht "hi") ht)
  (test (object->string ht) "#1=(hash-table '(\"hi\" . #1#))")
  (test (equal? (ht "hi") ht) #t))

(let ((l1 '(0)) (l2 '(0))) 
  (set! (car l1) l1) (set! (cdr l1) l1) (set! (car l2) l2) (set! (cdr l2) l2)
  (test (object->string l1) "#1=(#1# . #1#)")
  (test (equal? l1 l2) #t)
  (set! (cdr l1) l2)
  (test (object->string l1) "#1=(#1# . #2=(#2# . #2#))")
  (test (equal? l1 l2) #t)
  (set! (cdr l1) ())
  (test (equal? l1 l2) #f))

(let ((lst (list 1 2 3)))
  (set! (cdr (cddr lst)) lst)
  (test (map (lambda (a b)
	       (+ a b))
	     (list 4 5 6)
	     lst)
	'(5 7 9)))
(test (let ((lst (list 1 2 3)) 
	    (result ()))
	(set! (cdr (cddr lst)) lst)
	(for-each (lambda (a b)
		    (set! result (cons (+ a b) result)))
		  (list 4 5 6)
		  lst)
	result)
      '(9 7 5))
(let ((lst (list 1 2 3)))
  (set! (cdr (cddr lst)) lst)
  (test (map (lambda (a b)
	       (+ a b))
	     (vector 4 5 6)
	     lst)
	'(5 7 9)))
(test (let ((lst (list 1 2 3)))
	(set! (cdr (cddr lst)) lst)
	(map (lambda (a b)
	       (+ a b))
	     (vector 4 5 6 7 8 9 10)
	     lst))
      '(5 7 9 8)) ; this now quits when it sees the cycle
(test (map (lambda (a) a) '(0 1 2 . 3)) '(0 1 2))
(test (let ((ctr 0)) (for-each (lambda (a) (set! ctr (+ ctr a))) '(1 2 . 3)) ctr) 3)
(let ((lst (list 1 2 3)))
  (set! (cdr (cddr lst)) lst)
  (test (map (lambda (a b)
	       (+ a b))
	     ()
	     lst)
	()))
(test (let ((lst (list 1 2 3))
	    (ctr 0))
	(set! (cdr (cddr lst)) lst)
	(for-each (lambda (a b)
		    (set! ctr (+ ctr (+ a b))))
		  lst ())
	ctr)
      0)

(test (let ((lst (list 1))) (set! (cdr lst) (car lst)) (object->string lst)) "(1 . 1)")
(test (let ((lst (list 1))) (set! (car lst) (cdr lst)) (object->string lst)) "(())")

(let ((ctr 0) (lst `(let ((x 3)) (set! ctr (+ ctr 1)) (set! (cdr (cddr lst)) `((+ x ctr))) (+ x 1))))
  (test (eval lst) 4)
  (test (eval lst) 5)
  (test (eval lst) 6))
  

(let ()
  (define fact         ; Reini Urban, http://autocad.xarch.at/lisp/self-mod.lsp.txt
    (let ((old ())
	  (result ()))
      
      (define (last lst)
	(list-tail lst (- (length lst) 1)))
      
      (define (butlast lis)
	(let ((len (length lis)))
	  (if (<= len 1) ()
	      (let ((result ()))
		(do ((i 0 (+ i 1))
		     (lst lis (cdr lst)))
		    ((= i (- len 1)) (reverse result))
		  (set! result (cons (car lst) result)))))))
      
      (lambda (n)
	(cond ((zero? n) 1)
	      (#t 
	       (set! old (procedure-source fact))
	       (set! fact (apply lambda '(n)
				 `((cond 
				    ,@(butlast (cdr (car (cdr (cdr old)))))
				    ((= n ,n) ,(let ()
						 (set! result (* n (fact (- n 1))))
						 result))
				    ,@(last (cdr (car (cdr (cdr old)))))))))
	       result)))))

  (test (fact 3) 6)
  (test (fact 5) 120)
  (test (fact 2) 2))

(test (let ((f #f))
	(set! f (lambda () 
		  (let* ((code (procedure-source f))
			 (pos (- (length code) 1)))
		    (set! (code pos) (+ (code pos) 1)))
		  1))
	(f) (f) (f))
      4)

(let* ((x (list 1 2 3)) ; from Lambda the Ultimate I think -- I lost the reference
       (y (list 4 5))	
       (z (cons (car x) (cdr y)))
       (w (append y z))
       (v (cons (cdr x) (cdr y))))
  (set-car! x 6)
  (set-car! y 7)
  (set-cdr! (cdr x) (list 8))
  (test (object->string (list x y z w v)) "((6 2 8) (7 5) (1 5) (4 5 1 5) ((2 8) 5))"))
;; was "((6 . #3=(2 8)) (7 . #1=(5)) #2=(1 . #1#) (4 5 . #2#) (#3# . #1#))"

;; circular eval
(test (let ((e (list (list '+ 1)))) (set-cdr! (car e) e) (eval e)) 'error)
(test (let ((e (list (list '+ 1 2)))) (set-cdr! (cdar e) e) (eval e)) 'error)
(test (let ((e (list (list '+ 1 2) 3))) (set-cdr! (cdar e) e) (eval e)) 'error)
(test (let ((e (list (list '+ 1) 3 4))) (set-cdr! (cdar e) e) (eval e)) 'error)
(test (let ((x '(1 2 3)))
	(set! (x 0) (cons x 2))
	(eval (list-values 'let () (list-values 'define '(f1) (list-values 'list-set! x 0 (list-values 'cons x 2))) '(catch #t f1 (lambda a 'error)))))
      'error)
(test (let ((x '(car (list 1 2 3)))) 
	(set! (x 0) x) 
	(eval (list-values 'let () (list-values 'define '(f1) x) '(catch #t f1 (lambda a 'error)))))
      'error)


#|
(define (for-each-permutation func vals)          ; for-each-combination -- use for-each-subset below
  "(for-each-permutation func vals) applies func to every permutation of vals"
  ;;   (for-each-permutation (lambda args (format #t "~{~A~^ ~}~%" args)) '(1 2 3))
  (define (pinner cur nvals len)
    (if (= len 1)
	(apply func (cons (car nvals) cur))
	(do ((i 0 (+ i 1)))                       ; I suppose a named let would be more Schemish
	    ((= i len))
	  (let ((start nvals))
	    (set! nvals (cdr nvals))
	    (let ((cur1 (cons (car nvals) cur)))  ; add (car nvals) to our arg list
	      (set! (cdr start) (cdr nvals))      ; splice out that element and 
	      (pinner cur1 (cdr start) (- len 1)) ;   pass a smaller circle on down
	      (set! (cdr start) nvals))))))       ; restore original circle
  (let ((len (length vals)))
    (set-cdr! (list-tail vals (- len 1)) vals)    ; make vals into a circle
    (pinner () vals len)
    (set-cdr! (list-tail vals (- len 1)) ())))   ; restore its original shape
|#

#|
;; a slightly faster version (avoids consing and some recursion)
(define (for-each-permutation func vals)          ; for-each-combination -- use for-each-subset below
  "(for-each-permutation func vals) applies func to every permutation of vals"
  ;;   (for-each-permutation (lambda args (format #t "~A~%" args)) '(1 2 3))
  (let ((cur (make-list (length vals))))

    (define (pinner nvals len)
      (if (= len 2)
	  (begin
	    (set! (cur 0) (car nvals))
	    (set! (cur 1) (cadr nvals))
	    (apply func cur)
	    (set! (cur 1) (car nvals))
	    (set! (cur 0) (cadr nvals))
	    (apply func cur))
		
	(do ((i 0 (+ i 1))) 
	    ((= i len))
	  (let ((start nvals))
	    (set! nvals (cdr nvals))
	    (set! (cur (- len 1)) (car nvals)) 
	    (set! (cdr start) (cdr nvals))        ; splice out that element and 
	    (pinner (cdr start) (- len 1))        ;   pass a smaller circle on down
	    (set! (cdr start) nvals)))))          ; restore original circle

  (let ((len (length vals)))
    (set-cdr! (list-tail vals (- len 1)) vals)    ; make vals into a circle
    (pinner vals len)
    (set-cdr! (list-tail vals (- len 1)) ()))))  ; restore its original shape
|#

;; and continuing down that line...
(define (for-each-permutation func vals)          ; for-each-combination -- use for-each-subset below
  "(for-each-permutation func vals) applies func to every permutation of vals"
  ;;   (for-each-permutation (lambda args (format #t "~A~%" args)) '(1 2 3))
  (let ((cur (make-list (length vals))))

    (define (pinner nvals len)
      (if (= len 3)
	  (let ((a0 (car nvals))
		(a1 (cadr nvals))
		(a2 (caddr nvals))
		(c1 (cdr cur))
		(c2 (cddr cur)))
	    (set-car! cur a2)
	    (set-car! c1 a0)
	    (set-car! c2 a1)
	    (apply func cur)
	    (set-car! cur a0)
	    (set-car! c1 a2)
	    ;(set-car! c2 a1)
	    (apply func cur)
	    ;(set-car! cur a0)
	    (set-car! c1 a1)
	    (set-car! c2 a2)
	    (apply func cur)
	    (set-car! cur a1)
	    (set-car! c1 a0)
	    ;(set-car! c2 a2)
	    (apply func cur)
	    ;(set-car! cur a1)
	    (set-car! c1 a2)
	    (set-car! c2 a0)
	    (apply func cur)
	    (set-car! cur a2)
	    (set-car! c1 a1)
	    ;(set-car! c2 a0)
	    (apply func cur)
	    )
		
	(do ((i 0 (+ i 1)))                       
	    ((= i len))
	  (let ((start nvals))
	    (set! nvals (cdr nvals))
	    (list-set! cur (- len 1) (car nvals)) 
	    (set! (cdr start) (cdr nvals))        ; splice out that element and 
	    (pinner (cdr start) (- len 1))        ;   pass a smaller circle on down
	    (set! (cdr start) nvals)))))          ; restore original circle

  (let ((len (length vals)))
    (if (< len 2)
	(apply func vals)
	(if (= len 2)
	    (let ((c1 (cdr cur)))
	      (set-car! cur (car vals))
	      (set-car! c1 (cadr vals))
	      (apply func cur)
	      (set-car! c1 (car vals))
	      (set-car! cur (cadr vals))
	      (apply func cur))
	    (begin
	      (set-cdr! (list-tail vals (- len 1)) vals)    ; make vals into a circle
	      (pinner vals len)
	      (set-cdr! (list-tail vals (- len 1)) ())))))))  ; restore its original shape


(when full-test
  (let()
    (define ops '(+ *))
    (define args '(1 pi 1+i 2/3 x y))
    
    (define (listify lst)
      ((if (memq (car lst) ops) list 
	   (if (null? (cdr lst)) append values))
       (if (null? (cdr lst))
	   (car lst)
	   (values (car lst) (listify (cdr lst))))))
    
    (call-with-output-file "t923.scm"
      (lambda (p)
	(let ((fctr 0))
	  (for-each-permutation
	   (lambda lst
	     (let ((expr (list (listify lst))))
	       (format p "(define (f~D x y) ~{~^~S ~})~%" fctr expr)
	       (format p "(let ((e1 (f~D 3 4)))~%" fctr)
	       (format p "  (let ((e2 (let ((x 3) (y 4)) ~{~^~S ~})))~%" expr)
	       (format p "    (let ((e3 (let ((x 3) (y 4)) (f~D x y))))~%" fctr)
	       (format p "      (if (not (= e1 e2 e3))~%          (format *stderr* \"~{~^~S ~}: ~~A ~~A ~~A~~%\" e1 e2 e3)))))~%~%" expr))
	     (set! fctr (+ fctr 1)))
	   (append ops args)))))
    
    (load "t923.scm")))

  ;; t224 also applies this to +/*

(let ((perms '((3 1 2) (1 3 2) (1 2 3) (2 1 3) (2 3 1) (3 2 1)))
      (pos ()))
  (for-each-permutation
   (lambda args
     (call-with-exit
      (lambda (ok)
	(let ((ctr 0))
	  (for-each
	   (lambda (a)
	     (if (equal? a args)
		 (begin
		   (set! pos (cons ctr pos))
		   (ok)))
	     (set! ctr (+ ctr 1)))
	   perms)))))
   '(1 2 3))
  (test pos '(5 4 3 2 1 0)))

(test (let ((v1 (make-vector 16 0)) 
	    (v2 (make-vector 16 0))) 
	(set! (v2 12) v2) 
	(set! (v1 12) v1) 
	(equal? v1 v2))        ; hmmm -- not sure this is correct
      #t)
(test (let ((lst1 (list 1)) 
	    (lst2 (list 1))) 
	(set-cdr! lst1 lst1) 
	(set-cdr! lst2 lst2) 
	(equal? lst1 lst2))
      #t)


(test (let ((hi 3))
	(let ((e (curlet)))
	  (set! hi (curlet)) 
	  (object->string e)))
      "#1=(inlet 'hi (inlet 'e #1#))")
(let ((e (inlet 'a 0 'b 1)))
  (let ((e1 (inlet 'a e)))
    (set! (e 'b) e1)
    (test (equal? e (copy e)) #t)
    (test (object->string e) "#1=(inlet 'a 0 'b (inlet 'a #1#))")))

;; eval circles -- there are many more of these that will cause stack overflow 
(test (let ((x '(1 2 3))) (set! (x 0) (cons x 2)) (eval `(let () (define (f1) (list-set! ,x 0 (cons ,x 2))) (catch #t f1 (lambda a 'error))))) 'error)
(test (let ((x '(car (list 1 2 3)))) (set! (x 0) x) (eval `(let () (define (f1) ,x) (catch #t f1 (lambda a 'error))))) 'error)


(test (apply + (cons 1 2)) 'error)
(test (let ((L (list 0))) (set-cdr! L L) (apply + L)) 'error)
(test (let ((L (list 0))) (set-cdr! L L) (format #f "(~S~{~^ ~S~})~%" '+ L)) 'error)
(test (apply + (list (let ((L (list 0 1))) (set-cdr! L L) L))) 'error)
(test (apply + (let ((L (list 0 1))) (set-cdr! L L) L)) 'error)
(test (length (let ((E (inlet 'value 0))) (varlet E 'self E))) 2)
;(test (apply case 2 (list (let ((L (list (list 0 1)))) (set-cdr! L L) L))) 'error)
;(test (apply cond (list (let ((L (list 0 1))) (set-cdr! L L) L))) 'error)
;(test (apply quote (let ((L (list 0 1))) (set-car! L L) L)) 'error)
;(test (apply letrec (hash-table) (let ((L (list 0 1))) (set-car! L L) L)) 'error)
;I now think the caller should check for these, not s7



;;; --------------------------------------------------------------------------------
;;; HOOKS
;;; make-hook
;;; hook-functions
;;; --------------------------------------------------------------------------------

(let-temporarily (((hook-functions *error-hook*) ())
		  ((hook-functions *load-hook*) ())
		  ((hook-functions *unbound-variable-hook*) ())
		  ((hook-functions *missing-close-paren-hook*) ()))
  (for-each
   (lambda (arg)
     (test (set! *unbound-variable-hook* arg) 'error)
     (test (set! *missing-close-paren-hook* arg) 'error)
     (test (set! *load-hook* arg) 'error)
     
     (test (set! (hook-functions *unbound-variable-hook*) arg) 'error)
     (test (set! (hook-functions *missing-close-paren-hook*) arg) 'error)
     (test (set! (hook-functions *error-hook*) arg) 'error)
     (test (set! (hook-functions *load-hook*) arg) 'error)
     
     (test (set! (hook-functions *unbound-variable-hook*) (list arg)) 'error)
     (test (set! (hook-functions *missing-close-paren-hook*) (list arg)) 'error)
     (test (set! (hook-functions *error-hook*) (list arg)) 'error)
     (test (set! (hook-functions *load-hook*) (list arg)) 'error))
   (list -1 #\a #(1 2 3) 3.14 3/4 1.0+1.0i 'hi :hi #<eof> #(1 2 3) #(()) "hi" '(1 . 2) '(1 2 3))))

(let ((hook-val #f))
  (let-temporarily (((hook-functions *unbound-variable-hook*)
		     (list (lambda (hook) 
			     (set! hook-val (hook 'variable)) 
			     (set! (hook 'result) 123)))))
    (let ((val (catch #t
		 (lambda ()
		   (+ 1 one-two-three))
		 (lambda args
		   (apply format *stderr* (cadr args))
		   'error))))
      (test val 124))
    (test (equal? one-two-three 123) #t)
    (test (equal? hook-val 'one-two-three) #t)))

(let-temporarily (((hook-functions *unbound-variable-hook*) (list (lambda (hook) 
								    (set! (hook 'result) 32)))))
  (let ((val (+ 1 _an_undefined_variable_i_hope_)))
    (test val 33))
  (let ((val (+ 1 _an_undefined_variable_i_hope_)))
    (test (call/cc (lambda (_a_) (_a_ val))) 33))
  (let ((val (* _an_undefined_variable_i_hope_ _an_undefined_variable_i_hope_)))
    (test val 1024)))

(let ((x #f))
  (let-temporarily (((hook-functions *unbound-variable-hook*) 
		     (list (lambda (hook)
			     (set! x 0)
			     (set! (hook 'result) #<undefined>))
			   (lambda (hook) 
			     (set! (hook 'result) 32))
			   (lambda (hook)
			     (if (not (number? (hook 'result)))
				 (format *stderr* "oops -- *unbound-variable-hook* func called incorrectly~%"))))))
    (let ((val (+ 1 _an_undefined_variable_i_hope_)))
      (test val 33))
    (test x 0)
    (test (+ 1 _an_undefined_variable_i_hope_) 33)))


(define (-a-rootlet-entry- x) (- x (abs x)))
(define -a-rootlet-entry-value- #f)
(set! (hook-functions *rootlet-redefinition-hook*) 
      (list (lambda (hook) 
	      (set! -a-rootlet-entry-value- (hook 'value)))))
(define (-a-rootlet-entry- x) (+ x (abs x)))
(if (not (and (procedure? -a-rootlet-entry-value-)
	      (equal? (procedure-source -a-rootlet-entry-value-) '(lambda (x) (+ x (abs x))))))
    (format *stderr* "rootlet redef: ~W~%" -a-rootlet-entry-value-))
(set! (hook-functions *rootlet-redefinition-hook*) ())


;;; optimizer bug involving unbound variable
(let ()
  (define (opt1)
    (let ((val (let () 
		 (define (hi x y) (let ((m (memq x y)) (loc (and m (- x (length m))))) loc))
		 (hi 'a '(a b c)))))
      (format #t "~A: opt1 got ~S but expected 'error~%~%" (port-line-number) val)))
  (catch #t opt1
	 (lambda (type info)
	   (if (or (not (eq? type 'unbound-variable))
		   (not (equal? info '("~A: unbound variable" m))))
	       (format *stderr* "opt1 type: ~A, info: ~A~%" type info))
	   'error)))
(let ()
  (define (opt2)
    (let ((val (let () 
		 (define (hi x y) (let* ((n (memq x y)) (loc (and m (- x (length m)))) (m (+ n 1))) loc)) 
		 (hi 'a '(a b c)))))
      (format #t "~A: opt2 got ~S but expected 'error~%~%" (port-line-number) val)))
  (catch #t opt2
	 (lambda (type info)
	   (if (or (not (eq? type 'unbound-variable))
		   (not (equal? info '("~A: unbound variable" m))))
	       (format *stderr* "opt2 type: ~A, info: ~A~%" type info))
	   'error)))

(let ()
  (define (opt3)
    (let ((val (let () 
		 (define (hi x y) (do ((m (memq x y) 0) (loc (and m (- x (length m))) 0)) (loc #t))) 
		 (hi 'a '(a b c)))))
      (format #t "~A: opt3 got ~S but expected 'error~%~%" (port-line-number) val)))
  (catch #t opt3
	 (lambda (type info)
	   (if (or (not (eq? type 'unbound-variable))
		   (not (equal? info '("~A: unbound variable" m))))
	       (format *stderr* "opt3 type: ~A, info: ~A~%" type info))
	   'error)))

(let ()
  (define (opt4)
    (let () 
      (define (hi x y) (letrec ((m (memq x y)) (loc (and m (length m)))) loc)) 
      (hi 'a '(a b c))))
  (catch #t opt4
	 (lambda (type info)
	   'error)))

(let ()
  (define (opt5)
    (let ((val (let () 
		 (define (hi x y) (letrec* ((n (memq x y)) (loc (and m (- x (length m)))) (m (+ n 1))) loc))
		 (hi 'a '(a b c)))))
      (format #t "~A: opt5 got ~S but expected 'error~%~%" (port-line-number) val)))
  (catch #t opt5
	 (lambda (type info)
	   'error)))

(let ()
  (define (opt6)
    (let ((val (let () 
		 (define (hi x) (let ((m (memq n x)) (loc (and m (- x (length m))))) (define n 1) loc)) 
		 (hi '(a b c)))))
      (format #t "~A: opt6 got ~S but expected 'error~%~%" (port-line-number) val)))
  (catch #t opt6
	 (lambda (type info)
	   (if (or (not (eq? type 'unbound-variable))
		   (not (equal? info '("~A: unbound variable" n))))
	       (format *stderr* "opt6 type: ~A, info: ~A~%" type info))
	   'error)))

(let ()
  (define (opt7)
    (let ((val (let () 
		 (define* (f1 (a (+ m 1)) (m (+ a 1))) (+ a m))
		 (f1))))
      (format #t "~A: opt7 got ~S but expected 'error~%~%" (port-line-number) val)))
  (catch #t opt7
	 (lambda (type info)
	   'error)))

(let ()
  (define (opt8)
    (let ((val (let () 
		 (let ((x 1)) 
		   (set! x (+ m 1)) 
		   (define m 2) 
		   x))))
      (format #t "~A: opt8 got ~S but expected 'error~%~%" (port-line-number) val)))
  (catch #t opt8
	 (lambda (type info)
	   (if (or (not (eq? type 'unbound-variable))
		   (not (equal? info '("~A: unbound variable" m))))
	       (format *stderr* "opt8 type: ~A, info: ~A~%" type info))
	   'error)))

(let ()
  (define (opt9)
    (let ((val (let () 
		 (let ((x 1)) (set! x (and m (length m))) (define m 2) x))))
      (format #t "~A: opt9 got ~S but expected 'error~%~%" (port-line-number) val)))
  (catch #t opt9
	 (lambda (type info)
	   (if (or (not (eq? type 'unbound-variable))
		   (not (equal? info '("~A: unbound variable" m))))
	       (format *stderr* "opt9 type: ~A, info: ~A~%" type info))
	   'error)))

(let ()
  (define (opt10)
    (let () 
      (define* (f1 (a (and m (length m))) (m 1)) (+ a m))
      (f1))) ; but not unbound var error!  isn't this a bug?
  (catch #t opt10
	 (lambda (type info)
	   'error)))


(let ((val #f))
  (let-temporarily (((hook-functions *load-hook*) (list (lambda (hook) 
							  (if (or val
								  (defined? 'load-hook-test))
							      (format #t ";*load-hook*: ~A ~A?~%" val load-hook-test))
							  (set! val (hook 'name))))))
    (with-output-to-file "load-hook-test.scm"
      (lambda ()
	(format #t "(define (load-hook-test val) (+ val 1))")))
    (load "load-hook-test.scm")
    (if (or (not (string? val))
	    (not (string=? val "load-hook-test.scm")))
	(format #t ";*load-hook-test* file: ~S~%" val))
    (if (not (defined? 'load-hook-test))
	(format #t ";load-hook-test function not defined?~%")
	(if (not (= (load-hook-test 1) 2))
	    (format #t ";load-hook-test: ~A~%" (load-hook-test 1))))))

(let-temporarily (((hook-functions *error-hook*) ()))
  (test (hook-functions *error-hook*) ())
  (set! (hook-functions *error-hook*) (list (lambda (hook) #f)))
  (test (list? (hook-functions *error-hook*)) #t))

(let-temporarily (((hook-functions *missing-close-paren-hook*) (list (lambda (h) (set! (h 'result) 'incomplete-expr)))))
  (test (catch #t (lambda () (eval-string "(+ 1 2")) (lambda args (car args))) 'incomplete-expr)
  (test (catch #t (lambda () (eval-string "(")) (lambda args (car args))) 'incomplete-expr)
  (test (catch #t (lambda () (eval-string "(abs ")) (lambda args (car args))) 'incomplete-expr))

(let ((h (make-hook 'x)))
  (test (procedure? h) #t)
  (test (eq? h h) #t) 
  (test (eqv? h h) #t)
  (test (equal? h h) #t)
  (test (morally-equal? h h) #t)
  (let ((h1 (copy h)))
    (test (eq? h h1) #f) ; fluctutates...
    (test (morally-equal? h h1) #t))
  (test (hook-functions h) ())
  (test (h) #<unspecified>)
  (test (h 1) #<unspecified>)
  (test (h 1 2) 'error)
  (let ((f1 (lambda (hook) (set! (hook 'result) (hook 'x)))))
    (set! (hook-functions h) (list f1))
    (test (member f1 (hook-functions h)) (list f1))
    (test (hook-functions h) (list f1))
    (test (h 1) 1)
    (set! (hook-functions h) ())
    (test (hook-functions h) ())
    (let ((f2 (lambda* args (set! ((car args) 'result) ((car args) 'x)))))
      (set! (hook-functions h) (list f2))
      (test (hook-functions h) (list f2))
      (test (h 1) 1)))
  (for-each
   (lambda (arg)
     (test (set! (hook-functions h) arg) 'error))
   (list "hi" #f (integer->char 65) 1 (list 1 2) '#t '3 (make-vector 3) 3.14 3/4 1.0+1.0i #\f :hi #<eof> #<undefined> #<unspecified>)))

(let ((h (make-hook)))
  (test (procedure? h) #t)
  (test (documentation h) "")
  (test (hook-functions h) ())
  (test (h) #<unspecified>)
  (test (h 1) 'error)
  (let ((f1 (lambda (hook) (set! (hook 'result) 123))))
    (set! (hook-functions h) (list f1))
    (test (member f1 (hook-functions h)) (list f1))
    (test (hook-functions h) (list f1))
    (test (h) 123)
    (set! (hook-functions h) ())
    (test (hook-functions h) ())
    (let ((f2 (lambda* args (set! ((car args) 'result) 321))))
      (set! (hook-functions h) (list f2))
      (test (hook-functions h) (list f2))
      (test (h) 321))))

(let ((h (make-hook '(a 32) 'b)))
  (test (procedure? h) #t)
  (test (hook-functions h) ())
  (test (h) #<unspecified>)
  (test (h 1) #<unspecified>)
  (test (h 1 2) #<unspecified>)
  (test (h 1 2 3) 'error)
  (let ((f1 (lambda (hook) (set! (hook 'result) (+ (hook 'a) (or (hook 'b) 0))))))
    (set! (hook-functions h) (list f1))
    (test (member f1 (hook-functions h)) (list f1))
    (test (hook-functions h) (list f1))
    (test (h) 32)
    (test (h 1) 1)
    (test (h 1 2) 3)
    (set! (hook-functions h) ())
    (test (hook-functions h) ())))

(let ()
  (for-each
   (lambda (arg)
     (test (make-hook arg) 'error))
   (list "hi" #f 1 (list 1 2) '#t '3 (make-vector 3) 3.14 3/4 1.0+1.0i #\f :hi #<eof> #<undefined> #<unspecified>)))

(let ((h (make-hook)))
  (let ((f1 (lambda (hook) (if (number? (hook 'result)) (set! (hook 'result) (+ (hook 'result) 1)) (set! (hook 'result) 0)))))
    (test (h) #<unspecified>)
    (set! (hook-functions h) (list f1))
    (test (h) 0)
    (set! (hook-functions h) (list f1 f1 f1))
    (test (h) 2)))

(if (not (defined? 'hook-push))
    (define (hook-push hook func)
      (set! (hook-functions hook) (cons func (hook-functions hook)))))

(let ((h (make-hook)))
  (hook-push h (lambda (hook) (set! (hook 'result) 32)))
  (test (dynamic-wind h h h) 32)
  (test (catch h h h) 32)
  )

(let ((h (make-hook 'x)))
  (hook-push h (lambda (hook) (set! (hook 'result) (hook 'x))))
  (test (continuation? (call/cc h)) #t)
  (set! (hook-functions h) (list (lambda (hook) (set! (hook 'result) (+ 1 (hook 'x))))))
  (test (map h '(1 2 3)) '(2 3 4))
  )

(let ()
  (define-macro (hook . body)
    `(let ((h (make-hook)))
       (set! (hook-functions h) 
	     (list (lambda (h) 
		     (set! (h 'result) (begin ,@body)))))
       h)) 
  (let ((x 0))
    (define hi (hook (set! x 32) (+ 2 3 1)))
    (test (hi) 6)
    (test x 32)))

(let ()
  (define-macro (hooked-catch hook . body)
    `(catch #t 
       (lambda () 
	 ,@body) 
       (lambda args 
	 (let ((val (apply ,hook args)))
	   (if (eq? val #<unspecified>) ; hook did not do anything
	       (apply error args)       ; so re-raise the error
	       val)))))

 (let ((a-hook (make-hook 'error-type :rest 'error-info)))
   (set! (hook-functions a-hook)
         (list (lambda (hook) 
		 ;(format #t "hooked-catch: ~A~%" (apply format #t (car (hook 'error-info))))
		 (set! (hook 'result) 32))))
   (test (hooked-catch a-hook (abs "hi")) 32)
   
   (set! (hook-functions a-hook) ())

   (test (catch #t
	   (lambda ()
	     (hooked-catch a-hook (abs "hi")))
	   (lambda args
	     123))
	 123)
   ))

(let ()
  (define *breaklet* #f)
  (define *step-hook* (make-hook 'code 'e))
  
  (define-macro* (trace/break code . break-points)
    (define (caller tree)
      (if (pair? tree)
	  (cons 
	   (if (pair? (car tree))
	       (if (and (symbol? (caar tree))
			(procedure? (symbol->value (caar tree))))
		   (if (member (car tree) break-points)
		       `(__break__ ,(caller (car tree)))
		       `(__call__ ,(caller (car tree))))
		   (caller (car tree)))
	       (car tree))
	   (caller (cdr tree)))
	  tree))
    `(call-with-exit (lambda (__top__) ,(caller code))))
  
  (define (go . args)
    (and (let? *breaklet*)
	 (apply (*breaklet* 'go) args)))
  
  (define (clear-break)
    (set! *breaklet* #f))
  
  (define-macro (__call__ code)
    `(*step-hook* ',code (curlet)))
  
  (define-macro (__break__ code)
    `(begin
       (call/cc
	(lambda (go)
	  (set! *breaklet* (curlet))
	  (__top__ (format #f "break at: ~A~%" ',code))))
       ,code))
  
  (set! (hook-functions *step-hook*) 
	(list (lambda (hook)
		(set! (hook 'result) (eval (hook 'code) (hook 'e))))
	      (lambda (hook)
		(define (uncaller tree)
		  (if (pair? tree)
		      (cons 
		       (if (and (pair? (car tree))
				(memq (caar tree) '(__call__ __break__)))
			   (uncaller (cadar tree))
			   (uncaller (car tree)))
		       (uncaller (cdr tree)))
		      tree))
		(format (current-output-port) ": ~A -> ~A~40T~A~%" 
			(uncaller (hook 'code)) 
			(hook 'result)
			(if (and (not (eq? (hook 'e) (rootlet)))
				 (not (defined? '__top__ (hook 'e))))
			    (map values (hook 'e)) 
			    "")))))
  
  (let ((str (with-output-to-string
	       (lambda ()
		 (trace/break (let ((a (+ 3 1)) (b 2)) (if (> (* 2 a) b) 2 3)))))))
    (test (or (string=? str ": (+ 3 1) -> 4                         
: (* 2 a) -> 8                         ((a . 4) (b . 2))
: (> (* 2 a) b) -> #t                  ((a . 4) (b . 2))
") 
	      (string=? str ": (+ 3 1) -> 4                         
: (* 2 a) -> 8                         ((b . 2) (a . 4))
: (> (* 2 a) b) -> #t                  ((b . 2) (a . 4))
")) #t)))





;;; --------------------------------------------------------------------------------
;;; HASH-TABLES
;;; --------------------------------------------------------------------------------

(let ((ht (make-hash-table)))
  (test (hash-table? ht) #t)
  (test (equal? ht ht) #t)
  (test (let () (hash-table-set! ht 'key 3.14) (hash-table-ref ht 'key)) 3.14)
  (test (let () (hash-table-set! ht "ky" 3.14) (hash-table-ref ht "ky")) 3.14)
  (test (let () (hash-table-set! ht 123 "hiho") (hash-table-ref ht 123)) "hiho")
  (test (let () (hash-table-set! ht 3.14 "hi") (hash-table-ref ht 3.14)) "hi")
  (test (let () (hash-table-set! ht pi "hiho") (hash-table-ref ht pi)) "hiho")
  (test (hash-table-ref ht "123") #f)
  (let ((ht1 (copy ht)))
    (test (hash-table? ht1) #t)
    (test (iterator? ht1) #f)
    (test (iterator? (make-iterator ht1)) #t)
    (test (= (length ht) (length ht1)) #t)
    (test (equal? ht ht1) #t)
    (test (eq? ht ht) #t)
    (test (eqv? ht ht) #t)
    (set! (ht 'key) 32)
    (set! (ht1 'key) 123)
    (test (and (= (ht 'key) 32) (= (ht1 'key) 123)) #t)
    (set! (ht "key") 321)
    (test (ht "key") 321)
    (test (ht 'key) 32)
    (set! (ht 123) 43)
    (set! (ht "123") 45)
    (test (ht 123) 43)
    (test (ht "123") 45)
    (test (hash-table-set! ht "1" 1) 1)
    (test (set! (ht "2") 1) 1)
    (test (set! (hash-table-ref ht "3") 1) 1)
    (test (hash-table-ref ht "3") 1))
  (test (let () (set! (hash-table-ref ht 'key) 32) (hash-table-ref ht 'key)) 32)

  (for-each
   (lambda (arg)
     (test (let () (hash-table-set! ht 'key arg) (hash-table-ref ht 'key)) arg))
   (list "hi" -1 #\a 1 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #t (list 1 2 3) '(1 . 2))))

(for-each
 (lambda (arg)
   (test (iterator? arg) #f)
   (test (hash-table-set! arg 'key 32) 'error))
 (list "hi" () -1 #\a 1 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #t (list 1 2 3) '(1 . 2)))

(let ((ht1 (make-hash-table 31))
      (ht2 (make-hash-table 31)))
  (if (not (equal? ht1 ht2))
      (format #t ";ht1 and ht2 are empty, but not equal??~%"))

      ;; these first tests take advantage of s7's hashing function
  (hash-table-set! ht1 'abc 1)
  (hash-table-set! ht1 'abcabc 2)
  (hash-table-set! ht1 'abcabcabc 3)
  (hash-table-set! ht2 'abcabcabc 3)  
  (hash-table-set! ht2 'abcabc 2) 
  (hash-table-set! ht2 'abc 1)
  (if (not (equal? ht1 ht2))
      (format #t ";ht1 and ht2 have the same key value pairs, but are not equal??~%"))

  (test (make-hash-table 1 (call-with-exit (lambda (goto) goto))) 'error)
  
  (set! ht2 (make-hash-table 31))
  (hash-table-set! ht2 'abc 1)
  (hash-table-set! ht2 'abcabc 2) 
  (hash-table-set! ht2 'abcabcabc 3)  
  (if (not (equal? ht1 ht2))
      (format #t ";ht1 and ht2 have the same key value pairs in the same order, but are not equal??~%"))
  
  (hash-table-set! ht2 'abc "1")
  (if (equal? ht1 ht2) 
      (format #t ";ht1 and ht2 are equal but values are not~%"))
  (hash-table-set! ht2 'abc 1)
  (if (not (equal? ht1 ht2))
      (format #t ";after reset ht1 and ht2 have the same key value pairs in the same order, but are not equal??~%"))
  (hash-table-set! ht2 1 'abc)
  (if (equal? ht1 ht2)
      (format #t ";ht1 and ht2 are equal but entries are not~%"))
  (hash-table-set! ht1 1 'abc)
  (if (not (equal? ht1 ht2))
      (format #t ";after add ht1 and ht2 have the same key value pairs, but are not equal??~%"))

      ;; these should force chaining in any case
  (set! ht1 (make-hash-table 31))
  (set! ht2 (make-hash-table 60))
  (do ((i 0 (+ i 1)))
      ((= i 100))
    (hash-table-set! ht1 i (* i 2))
    (hash-table-set! ht2 i (* i 2)))
  (if (not (equal? ht1 ht2))
      (format #t ";ht1 and ht2 have the same (integer) key value pairs in the same order, but are not equal??~%"))

  (let ((h1 (hash-table* "a" 1))
          (h2 (hash-table* 'a 1)))
     (set! (h2 "a") 1)
     (set! (h2 'a) #f)
     test (equal? h1 h2) #t)

  (let ((ht (make-hash-table)))
    (set! (ht (expt 2 40)) 40)
    (set! (ht (expt 2 50)) 50)
    (set! (ht (- (expt 2 60))) -60) ; these all hash into 0 unfortunately -- maybe fold halves?
    (test (ht (expt 2 40)) 40)
    (test (ht (expt 2 50)) 50)
    (test (ht (expt 2 60)) #f)
    (test (ht (- (expt 2 60))) -60)
    (test (ht (expt 2 41)) #f))
  
  (set! ht2 (make-hash-table 31))
  (do ((i 99 (- i 1)))
      ((< i 0))
    (hash-table-set! ht2 i (* i 2)))
  (test (hash-table-entries ht2) 100)
  (if (not (equal? ht1 ht2))
      (format #t ";ht1 and ht2 have the same (integer) key value pairs, but are not equal??~%"))
  
  (fill! ht1 ())
  (test (hash-table-entries ht1) 100)
  (test (ht1 32) ()))

(let ((h (make-hash-table)))
  (test (hash-table-entries h) 0)
  (set! (h 'a) 1)
  (test (hash-table-entries h) 1)
  (set! (h 'a) #f)
  (test (hash-table-entries h) 0))

(let ((ht (make-hash-table))
      (l1 '(x y z))
      (l2 '(y x z)))
  (set! (hash-table-ref ht 'x) 123)
  (define (hi)
    (hash-table-ref ht (cadr l1))) ; 123
  (test (hi) #f))

(test (make-hash-table most-positive-fixnum) 'error)
;(test (make-hash-table (+ 1 (expt 2 31))) 'error)  ; out-of-memory error except in clang
(test (make-hash-table most-negative-fixnum) 'error)
(test (make-hash-table 21 eq? 12) 'error)
(test (make-hash-table 21 12) 'error)
(test (make-hash-table eq? eq?) 'error)
(test (make-hash-table eq? eq? 12) 'error)
(test (make-hash-table ()) 'error)
(test (make-hash-table 3 ()) 'error)
(test (make-hash-table eq? ()) 'error)
(test (make-hash-table 0) 'error)
(test (make-hash-table -4) 'error)
(for-each
 (lambda (arg)
   (test (make-hash-table arg) 'error))
 (list "hi" #\a 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #t (list 1 2 3) '(1 . 2)))

(let ((h (hash-table)))
  (hash-table-set! h 0/0 1)
  (test (object->string h) "(hash-table '(nan.0 . 1))")
  (hash-table-set! h 0/0 #f)
  (test (object->string h) "(hash-table)"))

(let ((ht (hash-table* :a 1/0)))
  (test (nan? (ht :a)) #t)
  (set! (ht 1/0) :a)
  (test (ht 1/0) :a)) ; is this just by chance?

(let ((ht (make-hash-table))) 
  (define (f1) (do ((i 0 (+ i 1))) ((= i 100)) (hash-table-set! ht i #t)))
  (f1)
  (test (hash-table-entries ht) 100)
  (set! ht (make-hash-table))
  (define (f2) (do ((i 0 (+ i 1))) ((= i 100)) (hash-table-set! ht i 0)))
  (f2)
  (test (hash-table-entries ht) 100)
  (set! ht (make-hash-table))
  (define (f3) (do ((i 0 (+ i 1))) ((= i 100)) (hash-table-set! ht i i)))
  (f3)
  (test (hash-table-entries ht) 100))

(let ((ht (make-hash-table))) 
  (define (f1) (do ((i 0 (+ i 1))) ((= i 1000)) (hash-table-set! ht i #t)))
  (f1)
  (test (hash-table-entries ht) 1000))

(let ((hi (make-hash-table 7)))
  (test (object->string hi) "(hash-table)")
  (set! (hi 1) "1")
  (test (object->string hi) "(hash-table '(1 . \"1\"))")
  (set! (hi -1) "-1")
  (test (or (string=? (object->string hi) "(hash-table '(-1 . \"-1\") '(1 . \"1\"))")
	    (string=? (object->string hi) "(hash-table '(1 . \"1\") '(-1 . \"-1\"))"))
	#t)
  (set! (hi 9) "9")
  (test (or (string=? (object->string hi) "(hash-table '(9 . \"9\") '(-1 . \"-1\") '(1 . \"1\"))")
	    (string=? (object->string hi) "(hash-table '(9 . \"9\") '(1 . \"1\") '(-1 . \"-1\"))"))
	#t)
  (set! (hi -9) "-9")
  (test (or (string=? (object->string hi) "(hash-table '(-9 . \"-9\") '(9 . \"9\") '(-1 . \"-1\") '(1 . \"1\"))")
	    (string=? (object->string hi) "(hash-table '(9 . \"9\") '(1 . \"1\") '(-9 . \"-9\") '(-1 . \"-1\"))"))
	#t)
  (test (hi 1) "1")
  (test (hi -1) "-1")
  (test (hi -9) "-9")
  (set! (hi 2) "2")
  (test (or (string=? (object->string hi) "(hash-table '(-9 . \"-9\") '(9 . \"9\") '(-1 . \"-1\") '(1 . \"1\") '(2 . \"2\"))")
	    (string=? (object->string hi) "(hash-table '(9 . \"9\") '(1 . \"1\") '(2 . \"2\") '(-9 . \"-9\") '(-1 . \"-1\"))"))
	#t)
  (let-temporarily (((*s7* 'print-length) 3))
    (test (or (string=? (object->string hi) "(hash-table '(-9 . \"-9\") '(9 . \"9\") '(-1 . \"-1\") ...)")
	      (string=? (object->string hi) "(hash-table '(9 . \"9\") '(1 . \"1\") '(2 . \"2\") ...)"))
	  #t)
    (set! (*s7* 'print-length) 0)
    (test (object->string hi) "(hash-table ...)")
    (test (object->string (hash-table)) "(hash-table)")))

(let ((ht (make-hash-table 277)))
  (test (hash-table? ht) #t)
  (test (>= (length ht) 277) #t)
  (test (hash-table-entries ht) 0)
  (test (let () (hash-table-set! ht 'key 3.14) (hash-table-ref ht 'key)) 3.14)
  (test (let () (hash-table-set! ht "ky" 3.14) (hash-table-ref ht "ky")) 3.14)
  (for-each
   (lambda (arg)
     (test (let () (hash-table-set! ht 'key arg) (hash-table-ref ht 'key)) arg))
   (list "hi" -1 #\a 1 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #t (list 1 2 3) '(1 . 2))))

(for-each
 (lambda (arg)
   (test (hash-table? arg) #f))
 (list "hi" -1 #\a 1 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #t #f () #(()) (list 1 2 3) '(1 . 2)))

(test (hash-table? (make-vector 3 ())) #f)
(test (let ((ht (make-hash-table))) (set! (ht 'a) 123) (map values ht)) '((a . 123)))

(let ((ht (make-hash-table)))	
  (test (hash-table-ref ht 'not-a-key) #f)
  (test (hash-table-ref ht "not-a-key") #f)
  (hash-table-set! ht 'key 3/4)
  (hash-table-set! ht "key" "hi")
  (test (hash-table-ref ht "key") "hi")
  (test (hash-table-ref ht 'key) 3/4)
  
  (hash-table-set! ht 'asd 'hiho)
  (test (hash-table-ref ht 'asd) 'hiho)
  (hash-table-set! ht 'asd 1234)
  (test (hash-table-ref ht 'asd) 1234))

(let ((ht (make-hash-table)))
  (define (ht-add h)
    (+ (h 1) (h 2)))
  (hash-table-set! ht 1 2)
  (hash-table-set! ht 2 3)
  (test (ht-add ht) 5))

(let ((let1 (inlet 'a 1))
      (let2 (inlet 'a 1))
      (let3 (inlet 'a 2))
      (let4 (inlet 'b 1))
      (let5 (inlet 'a 2 'a 1)))
  (test (equal? let1 let2) #t)
  (test (equal? let1 let3) #f)
  (test (equal? let1 let5) #t)
  (let ((hash1 (hash-table* let1 32)))
    (test (integer? (hash1 let1)) #t)
    (test (integer? (hash1 let2)) #t)
    (test (integer? (hash1 let3)) #f)
    (test (integer? (hash1 let4)) #f)
    (test (integer? (hash1 let5)) #t)))

(test ((hash-table* 1.5 #t #f #t) #f) #t) ; this is checking hash_float if debugging
(test ((hash-table* 1.5 #t 1 #t) 1) #t)

(let ((let1 (inlet 'a 1 'b 2))
      (let2 (inlet 'b 2 'a 1))
      (let3 (inlet 'a 1 'b 1)))
  (test (equal? let1 let2) #t)
  (let ((hash1 (hash-table* let1 32)))
    (test (integer? (hash1 let1)) #t)
    (test (integer? (hash1 let2)) #t)
    (test (integer? (hash1 let3)) #f)))

(let ((hash1 (hash-table* 'a 1 'b 2))
      (hash2 (hash-table* 'b 2 'a 1)))
  (test (equal? hash1 hash2) #t)
  (let ((hash3 (hash-table* hash1 32)))
    (test (integer? (hash3 hash1)) #t)
    (test (integer? (hash3 hash2)) #t)))

(let ((hash1 (hash-table* 'b 2 'a 1)))
  (let ((hash2 (make-hash-table (* (length hash1) 2))))
    (set! (hash2 'a) 1)
    (set! (hash2 'b) 2)
    (test (equal? hash1 hash2) #t)
    (let ((hash3 (make-hash-table (* 2 (length hash2)))))
      (set! (hash3 hash1) 32)
      (test (integer? (hash3 hash1)) #t)
      (test (integer? (hash3 hash2)) #t))))

(for-each
 (lambda (arg)
   (test (hash-table-ref arg 'key) 'error))
 (list "hi" -1 #\a 1 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #t (list 1 2 3) '(1 . 2)))

(let ((ht1 (make-hash-table 653))
      (ht2 (make-hash-table 277)))
  (test (equal? ht1 ht2) #t) ; equal? because both are empty
  (hash-table-set! ht1 'key 'hiho)
  (hash-table-set! ht2 (hash-table-ref ht1 'key) 3.14)
  (test (>= (length ht1) 653) #t)
  (test (hash-table-ref ht2 'hiho) 3.14)
  (test (hash-table-ref ht2 (hash-table-ref ht1 'key)) 3.14))

(let ((ht1 (make-hash-table)))
   (set! (ht1 1) 'hi)
   (let ((ht2 (make-hash-table)))
      (set! (ht2 1) ht1)
      (test ((ht2 1) 1) 'hi)))

(let ((ht1 (make-hash-table)))
   (set! (ht1 1/0) "NaN!")
   (let ((nan 1/0))
      (test (ht1 nan) "NaN!")
      (set! (ht1 nan) 0)
      (test (ht1 nan) 0)
      (if (not with-windows)
	  (test (object->string ht1) "(hash-table '(nan.0 . 0))"))))

(unless with-bignums
  (let ((ht1 (make-hash-table)))
    (set! (ht1 1) "1")
    (set! (ht1 1.0) "1.0")
    (test (ht1 1) "1")
    (set! (ht1 1/0) "nan")
    (test (ht1 0/0) "nan")
    (set! (ht1 (/ (log 0) (log 0))) "nan-nani")
    (test (ht1 (/ (log 0) (log 0))) "nan-nani")
    (test (ht1 (- 0/0)) "nan")
    (test (ht1 (real-part (/ (log 0) (log 0)))) "nan")
    (test (ht1 (complex 0/0 1/0)) "nan-nani")
    (set! (ht1 (real-part (log 0))) "-inf")
    (test (ht1 (real-part (log 0))) "-inf")
    (set! (ht1 (- (real-part (log 0)))) "inf")
    (test (ht1 (- (real-part (log 0)))) "inf")
    (set! (ht1 (log 0)) "log(0)")
    (test (ht1 (log 0)) "log(0)")
    (set! (ht1 (complex 80143857/25510582 1)) "pi+i")
    (test (ht1 (complex pi (- 1.0 1e-16))) "pi+i")))

(let ((ht (make-hash-table)))
  (set! (ht (string #\a #\null #\b)) 1)
  (test (ht (string #\a #\null #\b)) 1)
  (test (ht (string #\a)) #f)
  (set! (ht (string #\a #\null #\b)) 12)
  (test (ht (string #\a #\null #\b)) 12)
  (fill! ht #f)
  (test (hash-table-entries ht) 0)
  (set! (ht #u8(3 0 21)) 1)
  (test (ht #u8(3 0 21)) 1))

(let ((ht (hash-table* 'a #t)))
  (test (hash-table-entries ht) 1)
  (do ((i 0 (+ i 1))) ((= i 10)) (set! (ht 'a) #f) (set! (ht 'a) #t))
  (test (hash-table-entries ht) 1))

(when with-bignums
  (let ((ht (make-hash-table)))
    (set! (ht pi) 1)
    (test (ht pi) 1)
    (set! (ht (bignum "1")) 32)
    (test (ht (bignum "1")) 32)
    (set! (ht (/ (bignum "11") (bignum "3"))) 12)
    (test (ht (/ (bignum "11") (bignum "3"))) 12)
    (set! (ht (bignum "1+i")) -1)
    (test (ht (bignum "1+i")) -1)
    (set! (ht 3) 2)
    (test (ht 3) 2)
    (set! (ht 3.0) 3)
    (test (ht 3.0) 3)))
    
(test (hash-table?) 'error)
(test (hash-table? 1 2) 'error)

(test (make-hash-table most-positive-fixnum) 'error)
(test (make-hash-table most-negative-fixnum) 'error)
(test (make-hash-table 10 1) 'error)

(let () ; size bug noticed by K.M. -- libasan reports it
  (define hash (make-hash-table 1)) ;; Size must be 1.
  (set! (hash :hello) "a50")
  (gc))

(let ((ht (make-hash-table)))
  (test (hash-table? ht ht) 'error)
  (test (hash-table-ref ht #\a #\b) 'error)
  (test (hash-table-ref ht) 'error)
  (test (hash-table-ref) 'error)
  (test (hash-table-set!) 'error)
  (test (hash-table-set! ht) 'error)
  (test (hash-table-set! ht #\a) 'error)
  (test (hash-table-set! ht #\a #\b #\c) 'error)
  (set! (ht 'key) 32)
  (test (fill! ht 123) 123)
  (test (ht 'key) 123)
  (set! (ht 'key) 32)
  (test (ht 'key) 32)
  (set! (ht :key) 123)
  (test (ht 'key) 32)
  (test (ht :key) 123)
  (fill! ht ())
  (test (ht 'key) ()))

(let ((ht (make-hash-table)))
  (test (hash-table-set! ht #\a 'key) 'key)
  (for-each
   (lambda (arg)
     (test (hash-table-set! ht arg 3.14) 3.14))
   (list #\a #(1 2 3) 3/4 1.0+1.0i #t (list 1 2 3) '(1 . 2)))
  (for-each
   (lambda (arg)
     (test (hash-table-ref ht arg) 3.14))
   (list #\a #(1 2 3) 3/4 1.0+1.0i #t (list 1 2 3) '(1 . 2)))
  (test (length ht 123) 'error))

(for-each
 (lambda (arg)
   (test (make-hash-table arg) 'error))
 (list "hi" -1 0 #\a 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #t (list 1 2 3) '(1 . 2)))

(let ((lst (list 1 2)))
  (set-cdr! (cdr lst) lst)
  (test (object->string (hash-table* 'a lst)) "(hash-table '(a . #1=(1 2 . #1#)))")
  (test (object->string (hash-table* lst lst)) "(hash-table '(#1=(1 2 . #1#) . #1#))")
  (test (object->string (hash-table* lst 1)) "(hash-table '(#1=(1 2 . #1#) . 1))"))

(let ()
 (define ht (make-hash-table))
 (set! (ht 123) "123")
 (set! (ht 456) "456")
 (define hti (make-iterator ht))
 (test (iterator? hti) #t)
 (test (object->string hti) "#<iterator: hash-table>")
 (test (equal? hti hti) #t)
 (test (eq? hti hti) #t)
 (test (eqv? hti hti) #t)
 (test (morally-equal? hti hti) #t)

 (let ((hti2 hti))
   (test (equal? hti2 hti) #t)
   (test (morally-equal? hti2 hti) #t)
   (set! hti2 (copy hti))
   (test (equal? hti2 hti) #t)
   (test (morally-equal? hti2 hti) #t)
   (test (let ((val (hti2))) (or (equal? val '(123 . "123")) (equal? val '(456 . "456")))) #t) ; order depends on table size
   (test (equal? hti2 hti) #f)
   (test (morally-equal? hti2 hti) #f)
   )

 (let ((vals (list (hti) (hti))))
   (if (not (equal? (sort! vals (lambda (a b) (< (car a) (car b)))) '((123 . "123") (456 . "456"))))
       (format #t ";iterator: ~A~%" vals))
   (let ((val (hti)))
     (if (not (eof-object? val))
	 (format #t ";iterator at end: ~A~%" val)))
   (let ((val (hti)))
     (if (not (eof-object? val))
	 (format #t ";iterator at end (2): ~A~%" val)))))

(test (make-iterator) 'error)
(test (make-iterator (make-hash-table) 1) 'error)
(test (iterator?) 'error)
(test (iterator? 1 2) 'error)

(let ()
  (define (get-iter)
    (let ((ht (hash-table '(a . 1) '(b . 2))))
      (test (hash-table-entries ht) 2)
      (make-iterator ht)))
  (let ((hti (get-iter)))
    (gc)
    (let ((a (hti)))
      (let ((b (hti)))
	(let ((c (hti)))
	  (test (let ((lst (list a b c)))
		  (or (equal? lst '((a . 1) (b . 2) #<eof>))
		      (equal? lst '((b . 2) (a . 1) #<eof>))))
		#t))))))

(let ((ht1 (make-hash-table))
      (ht2 (make-hash-table)))
  (test (equal? ht1 ht2) #t)
  (test (equal? ht1 (make-vector (length ht1) ())) #f)
  (hash-table-set! ht1 'key 'hiho)
  (test (equal? ht1 ht2) #f)
  (hash-table-set! ht2 'key 'hiho)
  (test (equal? ht1 ht2) #t)

  (hash-table-set! ht1 'a ())
  (test (ht1 'a) ())
  )

(let ((ht (make-hash-table 1)))
  (test (>= (length ht) 1) #t)
  (set! (ht 1) 32)
  (test (>= (length ht) 1) #t))

(let ((ht (hash-table '("hi" . 32) '("ho" . 1))))
  (test (hash-table-entries ht) 2)
  (test (ht "hi") 32)
  (test (ht "ho") 1))

(let ((ht (hash-table* "hi" 32 "ho" 1)))
  (test (hash-table-entries ht) 2)
  (test (ht "hi") 32)
  (test (ht "ho") 1))

(let ((ht (hash-table)))
  (test (hash-table? ht) #t)
  (test (>= (length ht) 1) #t)
  (test (ht 1) #f))

(let ((ht (hash-table*)))
  (test (hash-table? ht) #t)
  (test (>= (length ht) 1) #t)
  (test (ht 1) #f))

(for-each
 (lambda (arg)
   (test (hash-table arg) 'error)
   (test (hash-table* arg) 'error)
   (test ((hash-table* 'a arg) 'a) arg)
   (test ((hash-table* arg 'a) arg) 'a))
 (list "hi" -1 0 #\a 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #t abs #<eof> #<unspecified> (lambda () 1)))

(let ((ht (make-hash-table))
      (lst (list 1)))
  (set-cdr! lst lst)
  (set! (ht lst) lst)
  (let ((lst1 (list 1 2)))
    (set-cdr! (cdr lst1) lst1)
    (set! (ht lst1) lst1)
    (test (ht lst) lst)
    (test (ht lst1) lst1)
    (test (or (string=? (object->string ht) "(hash-table '(#1=(1 2 . #1#) . #1#) '(#2=(1 . #2#) . #2#))")
	      (string=? (object->string ht) "(hash-table '(#1=(1 . #1#) . #1#) '(#2=(1 2 . #2#) . #2#))"))
	  #t)))

(test (set! (hash-table) 1) 'error)
(test (set! (hash-table*) 1) 'error)
(test (set! (make-hash-table) 1) 'error)

;; no null hash-tables?

(let ((ht (make-hash-table)))
  (test (map (lambda (x) x) ht) ())
  (test (let ((ctr 0)) (for-each (lambda (x) (set! ctr (+ ctr 1))) ht) ctr) 0)
  (test (map (lambda (x y) (cons x y)) (list 1 2 3) ht) ())
  ;(test (let ((ctr 0)) (for-each (lambda (x) (set! ctr (+ ctr 1))) #(1 2 3) ht) ctr) 0) ; this is now an error 15-Jan-15
  (test (map (lambda (x y) (cons x y)) ht "123") ())
  (test (let ((ctr 0)) (for-each (lambda (x) (set! ctr (+ ctr 1))) ht ()) ctr) 'error) ; 2 args

  (let ((rt (reverse ht)))
    (test (map (lambda (x) x) rt) ())
    (test (let ((ctr 0)) (for-each (lambda (x) (set! ctr (+ ctr 1))) rt) ctr) 0))

  (set! (ht 1) 32)
  ;; these need to be independent of entry order
  
  (test (sort! (map (lambda (x) (cdr x)) ht) <) '(32))
  (test (let ((ctr 0)) (for-each (lambda (x) (set! ctr (+ ctr 1))) ht) ctr) 1)
  (test (map (lambda (x y) (cons x y)) () ht) ())
  (test (let ((ctr 0)) (for-each (lambda (x y) (set! ctr (+ ctr 1))) ht "") ctr) 0)
  (test (sort! (map (lambda (x y) (max (cdr x) y)) ht (list 1 2 3)) <) '(32))
  (test (let ((ctr 0)) (for-each (lambda (x y) (set! ctr (max (cdr x) y))) ht #(1 2 3)) ctr) 32)

  (let ((rt (reverse ht)))
    (test (equal? (rt 32) 1) #t)
    (test (equal? (rt 1) #f) #t)
    (test (ht (rt 32)) 32)
    (test (sort! (map (lambda (x) (cdr x)) rt) <) '(1))
    (test (let ((ctr 0)) (for-each (lambda (x) (set! ctr (+ ctr 1))) rt) ctr) 1)
    (for-each (lambda (x) (test (ht (rt (cdr x))) (cdr x)) (test (rt (ht (car x))) (car x))) ht)
    (set! (rt 32) 123)
    (test (rt 32) 123)
    (test (ht 32) #f)
    (test (ht 1) 32))

  (set! (ht 2) 1)
  (test (ht (ht 2)) 32)
  (test (sort! (map (lambda (x) (cdr x)) ht) <) '(1 32))
  (test (let ((ctr 0)) (for-each (lambda (x) (set! ctr (+ ctr 1))) ht) ctr) 2)
  (set! (ht 3) 123)
  (test (sort! (map (lambda (x) (cdr x)) ht) <) '(1 32 123))
  (test (let ((ctr 0)) (for-each (lambda (x) (set! ctr (+ ctr 1))) ht) ctr) 3)
  (test (let ((ctr 0)) (for-each (lambda (x y) (set! ctr (+ ctr 1))) ht '(1)) ctr) 1)
  (test (let ((ctr 0)) (for-each (lambda (x y z) (set! ctr (+ ctr 1))) "12" ht '(1)) ctr) 1)
  (test (let ((ctr 0)) (for-each (lambda (x y z) (set! ctr (+ ctr 1))) "12" ht '(1 2)) ctr) 2)
  (test (let ((ctr 0)) (for-each (lambda (x y z) (set! ctr (+ ctr 1))) "12345" ht '(1 2 3 4 5 6)) ctr) 3)
  
  (test (sort! (map (lambda (x y) (max x (cdr y))) (list -1 -2 -3 -4) ht) <) '(1 32 123))
  (test (let ((sum 0)) (for-each (lambda (x y) (set! sum (+ sum x (cdr y)))) #(10 20 30) ht) sum) 216)

  
  (let ((rt (reverse ht)))
    (for-each (lambda (x) (test (ht (rt (cdr x))) (cdr x)) (test (rt (ht (car x))) (car x))) ht))
  
  (set! (ht (list 1 2 3)) "hi")
  (test (ht '(1 2 3)) "hi")
  (test (ht 2) 1)
  (test (let ((ctr 0)) (for-each (lambda (x) (set! ctr (+ ctr 1))) ht) ctr) 4)
  (set! (ht "hi") 2)
  (test (ht "hi") 2)
  (test (ht (ht (ht "hi"))) 32)

  (let ((rt (reverse ht)))
    (test (rt "hi") '(1 2 3))
    (test (rt 2) "hi")
    (for-each (lambda (x) (test (ht (rt (cdr x))) (cdr x)) (test (rt (ht (car x))) (car x))) ht)
    (set! (rt 2) "ho")
    (test (rt 2) "ho")
    (test (ht '(1 2 3)) "hi")
    (set! (rt 123) 321)
    (test (rt 123) 321)
    (test (ht 3) 123))

  (fill! ht 0)
  (set! (ht "hi") 1)
  (set! (ht "hoi") 2)
  (test (sort! (map (lambda (x) (cdr x)) ht) <) '(0 0 0 0 1 2))
  (test (let ((ctr 0)) (for-each (lambda (x) (set! ctr (+ ctr 1))) ht) ctr) 6)
  
  (let ((rt (reverse ht)))
    (test (rt 2) "hoi")
    (set! (rt 2) "ha")
    (test (ht "hoi") 2))

  (set! (ht #\a) #\b)
  (test (ht #\a) #\b)
  (test (ht "hi") 1)

  (set! ht (hash-table))
  (set! (ht #(1)) #(2))
  (test (ht #(1)) #(2))
  (set! (ht '(1)) '(3))
  (set! (ht "1") "4")
  ;(set! (ht ht) "5")
  ;(test (ht ht) "5")
  (test (ht '(1)) '(3))
  (test (let ((ctr 0)) (for-each (lambda (x) (set! ctr (+ ctr 1))) ht) ctr) 3)  
    
  (let ((rt (reverse ht)))
    ;(test (rt "5") ht)
    (test (rt "4") "1")
    (for-each (lambda (x) 
		(test (ht (rt (cdr x))) (cdr x))
		(test (rt (ht (car x))) (car x)))
	      ht))
  )  

(let ((ht (make-hash-table)))
  (let ((str (string (integer->char 255)))
	(u8 #u8(254 0))
	(rl 1e18)
	(int most-negative-fixnum)
	(rat (/ 1 most-negative-fixnum)))
    (set! (ht str) 1)
    (set! (ht u8) 2)
    (set! (ht rl) 3)
    (set! (ht int) 4)
    (set! (ht rat) 5)
    (test (ht str) 1) 
    (test (ht u8) 2)
    (test (ht rl) 3)
    (test (ht int) 4)
    (test (ht rat) 5)))

(let ((ht1 (make-hash-table 32))
      (ht2 (make-hash-table 1024)))
  (do ((i 0 (+ i 1)))
      ((= i 256))
    (let ((str (number->string i)))
      (set! (ht1 str) i)
      (set! (ht2 i) str)))
  (let ((cases 0))
    (for-each
     (lambda (a b)
       (if (not (equal? (string->number (car a)) (cdr a)))
	   (format #t ";hash-table for-each (str . i): ~A?~%" a))
       (if (not (equal? (number->string (car b)) (cdr b)))
	   (format #t ";hash-table for-each (i . str): ~A?~%" b))
       (set! cases (+ cases 1)))
     ht1 ht2)
    (if (not (= cases 256))
	(format #t ";hash-table for-each cases: ~A~%" cases)))
  (let ((iter1 (make-iterator ht1))
	(iter2 (make-iterator ht2)))
    (test (equal? iter1 iter2) #f)
    (test (morally-equal? iter1 iter2) #f)
    (test (iterator? iter2) #t)
    (let ((cases 0))
      (do ((a (iter1) (iter1))
	   (b (iter2) (iter2)))
	  ((or (eof-object? a)
	       (eof-object? b)))
	(if (not (equal? (string->number (car a)) (cdr a)))
	    (format #t ";hash-table iter1 (str . i): ~A?~%" a))
	(if (not (equal? (number->string (car b)) (cdr b)))
	    (format #t ";hash-table iter2 (i . str): ~A?~%" b))
	(set! cases (+ cases 1)))
      (if (not (= cases 256))
	  (format #t ";hash-table iter1/2 cases: ~A~%" cases)))))

(let ((ht (make-hash-table 31)))
  (let ((ht1 (make-hash-table 31)))
    (set! (ht1 'a1) 'b1)
    (set! (ht 'a0) ht1)
    (test ((ht 'a0) 'a1) 'b1)
    (test (hash-table-ref ht 'a0 'a1) 'b1)
    (test (ht 'a0 'a1) 'b1)))

(let ((ht (make-hash-table 31))
      (e (curlet)))
  (define (a-func a) (+ a 1))
  (define-macro (a-macro a) `(+ 1 , a))
  (define (any-func a) (let ((x a)) (lambda () x)))

  (set! (ht abs) 1)
  (set! (ht begin) 2)
  (set! (ht quasiquote) 3)
  (set! (ht a-func) 4)
  (set! (ht a-macro) 5)
  (set! (ht (any-func 6)) 6)
  (set! (ht e) 7)
  (test (ht e) 7)
  (set! (ht (rootlet)) 8)
  (test (ht abs) 1)
  (test (ht round) #f)
  (test (ht quasiquote) 3)
  (test (ht begin) 2)
  (test (ht lambda) #f)
  (test (ht a-func) 4)
  (test (ht a-macro) 5)
  (test (ht (any-func 6)) #f)
  (test (ht (rootlet)) 8)
  (call-with-exit
   (lambda (return)
     (set! (ht return) 9)
     (test (ht return) 9)))
  ;(set! (ht ht) 10)
  ;(test (ht ht) 10)
  )
  

(test (let ((h1 (hash-table '(a . 1) '(b . 2))) (h2 (make-hash-table 31))) (set! (h2 'a) 1) (set! (h2 'b) 2.0) (morally-equal? h1 h2)) #t)
(test (let ((h1 (hash-table '(a . 1) '(b . 2))) (h2 (make-hash-table 31))) (set! (h2 'a) 1.0) (set! (h2 'b) 2) (morally-equal? (list h1) (list h2))) #t)

(test (let ((h1 (hash-table* 'a 1 'b 2)) (h2 (make-hash-table 31))) (set! (h2 'a) 1) (set! (h2 'b) 2.0) (morally-equal? h1 h2)) #t)
(test (let ((h1 (hash-table* 'a 1 'b 2)) (h2 (make-hash-table 31))) (set! (h2 'a) 1.0) (set! (h2 'b) 2) (morally-equal? (list h1) (list h2))) #t)

;(test (let ((ht (make-hash-table))) (hash-table-set! ht ht 1) (ht ht)) #f)
; this is #f now because the old ht is not equal to the new one (different number of entries)
;(test (let ((ht (make-hash-table))) (hash-table-set! ht ht ht) (equal? (ht ht) ht)) #t)

(test (let ((ht (make-hash-table))) (hash-table-set! ht 'a ht) (object->string ht)) "#1=(hash-table '(a . #1#))")
(test (let ((h1 (make-hash-table))) (hash-table-set! h1 "hi" h1) (object->string h1)) "#1=(hash-table '(\"hi\" . #1#))")
(test (let ((ht (make-hash-table))) (hash-table-set! ht 'a ht) (morally-equal? ht (copy ht))) #t)
(test (let ((ht (make-hash-table))) (hash-table-set! ht 'a ht) (equal? ht (copy ht))) #t)

(test (hash-table 'a 1 'b) 'error)

;; there's no real need for multidim hashes:

(let ((ht (make-hash-table)))
   (set! (ht (cons 'a 1)) 'b)
   (set! (ht (cons 'a 2)) 'c)
   (set! (ht (cons 'b 1)) 'd)
   (test (ht '(a . 1)) 'b)
   (test (ht '(b . 1)) 'd)
   (set! (ht '(a . 2)) 32)
   (test (ht '(a . 2)) 32)
   (let ((lst1 (list 1))
	 (lst2 (list 1)))
     (set-car! lst1 lst2)
     (set-car! lst2 lst1)
     (set! (ht lst1) 32)
     (set! (ht lst2) 3)
     (test (equal? lst1 lst2) #t)
     (test (ht lst1) 3)
     (test (ht lst2) 3)))

(let ((ht (make-hash-table)))
  (set! (ht 1.0) 'a)
  (set! (ht 2.0) 'b)
  (set! (ht 3.0) 'c)
  (test (ht 2.0) 'b)
  (set! (ht 2.0) 'd)
  (test (ht 2.0) 'd)
  (test (ht 0.0) #f)
  (test (ht 1.0) 'a))

(let ((ht (make-hash-table)))
  (test (ht) 'error)
  (test (ht 0 1) 'error))

(let ((h (hash-table* 'a (hash-table* 'b 2 'c 3)
		      'b (hash-table* 'b 3 'c 4))))
  (test (h 'a 'b) 2)
  (test (h 'b 'b) 3)
  (test (h 'a 'c) 3))

(let ()
  (define-macro (memoize f)
    `(define ,f (let ((ht (make-hash-table))
		      (old-f ,f))
		  (lambda args
		    (or (ht args)
			(let ((new-val (apply old-f args)))
			  (set! (ht args) new-val)
			  new-val))))))

  (define (our-abs num) (abs num))
  (memoize our-abs)
  (num-test (our-abs -1) 1)
  (with-let (funclet our-abs)
    (test (ht '(-1)) 1)))

(let ()
  (define-macro (define-memoized name&arg . body)
    (let ((arg (cadr name&arg))
	  (memo (gensym "memo")))
      `(define ,(car name&arg)
	 (let ((,memo (make-hash-table)))
	   (lambda (,arg)
	     (or (,memo ,arg)
		 (set! (,memo ,arg) (begin ,@body))))))))
  
  (define-memoized (f1 abc) (+ abc 2))
  (test (f1 3) 5)
  (test (f1 3) 5)
  (test (f1 2) 4)
  (let ((ht (call-with-exit
	     (lambda (return)
	       (for-each (lambda (x)
			   (if (hash-table? (cdr x))
			       (return (cdr x))))
			 (outlet (funclet f1)))
	       #f))))
    (if (not (hash-table? ht))
	(format #t ";can't find memo? ~A~%" (let->list (outlet (funclet f1))))
	(test (length (map (lambda (x) x) ht)) 2))))

(let ()
  (define-macro (define-memoized name&args . body)
    (let ((args (cdr name&args))
	  (memo (gensym "memo")))
      `(define ,(car name&args)
	 (let ((,memo (make-hash-table)))
	   (lambda ,args
	     (or (,memo (list ,@args))
		 (set! (,memo (list ,@args)) (begin ,@body))))))))

  (define (ack m n)
    (cond ((= m 0) (+ n 1))
	  ((= n 0) (ack (- m 1) 1))
	  (else (ack (- m 1) (ack m (- n 1))))))

  (define-memoized (ack1 m n)
    (cond ((= m 0) (+ n 1))
	  ((= n 0) (ack1 (- m 1) 1))
	  (else (ack1 (- m 1) 
		      (ack1 m (- n 1))))))

  (test (ack 2 3) (ack1 2 3)))

 
(let ((ht (make-hash-table)))
  (test (eq? (car (catch #t (lambda () (set! (ht) 2)) (lambda args args))) 'wrong-number-of-args) #t)
  (test (eq? (car (catch #t (lambda () (set! (ht 0 0) 2)) (lambda args args))) 'syntax-error) #t) ; attempt to apply boolean #f to (0)
  (test (eq? (car (catch #t (lambda () (set! ((ht 0) 0) 2)) (lambda args args))) 'syntax-error) #t))

(let ()
  (define (merge-hash-tables . tables)
    (apply hash-table (apply append (map (lambda (table) (map values table)) tables))))
  (let ((ht (merge-hash-tables (hash-table '(a . 1) '(b . 2)) (hash-table '(c . 3)))))
    (test (ht 'c) 3))
  (test ((append (hash-table '(a . 1) '(b . 2)) (hash-table '(c . 3))) 'c) 3))

;;; test the eq-func business

(let ((ht (make-hash-table 8 eq?)))
  (test (hash-table-ref ht 'a) #f)
  (hash-table-set! ht 'a 1)
  (hash-table-set! ht 'c 'd)
  (test (hash-table-ref ht 'a) 1)
  (hash-table-set! ht "hi" 3)
  (test (hash-table-ref ht "hi") #f)
  (set! (ht '(a . 1)) "ho")
  (test (ht '(a . 1)) #f)
  (let ((ht1 (copy ht)))
    (test (ht1 'a) 1)
    (test (ht1 "hi") #f)
    (set! (ht1 #\a) #\b)
    (test (ht1 #\a) #\b)
    (test (ht #\a) #f)
    (let ((ht2 (reverse ht1)))
      (test (ht1 #\a) #\b)
      (test (ht2 #\b) #\a)
      (test (ht2 'd) 'c)))
  (do ((i 0 (+ i 1)))
      ((= i 32))
    (set! (ht (string->symbol (string-append "g" (number->string i)))) i))
  (test (ht 'a) 1)
  (test (ht 'g3) 3)
  (set! (ht ht) 123)
  (test (ht ht) 123))

(let ((ht (make-hash-table 31 string=?)))
  (test (length ht) 32)
  (set! (ht "hi") 'a)
  (test (ht "hi") 'a)
  (test (ht "Hi") #f)
  (set! (ht 32) 'b)
  (test (ht 32) #f)
  )

(let ((ht (make-hash-table 31 char=?)))
  (test (length ht) 32)
  (set! (ht #\a) 'a)
  (test (ht #\a) 'a)
  (test (ht #\A) #f)
  (set! (ht 32) 'b)
  (test (ht 32) #f)
  )

(unless pure-s7
  (let ((ht (make-hash-table 31 string-ci=?)))
    (test (length ht) 32)
    (set! (ht "hi") 'a)
    (test (ht "hi") 'a)
    (test (ht "Hi") 'a)
    (test (ht "HI") 'a)
    (set! (ht 32) 'b)
    (test (ht 32) #f)
    )
  
  (let ((ht (make-hash-table 31 char-ci=?)))
    (test (length ht) 32)
    (set! (ht #\a) 'a)
    (test (ht #\a) 'a)
    (test (ht #\A) 'a)
    (set! (ht 32) 'b)
    (test (ht 32) #f)
    ))

(let ((ht (make-hash-table 31 =)))
  (test (length ht) 32)
  (set! (ht 1) 'a)
  (test (ht 1.0) 'a)
  (test (ht 1+i) #f)
  (set! (ht 32) 'b)
  (test (ht 32) 'b)
  (set! (ht 1/2) 'c)
  (test (ht 0.5) 'c)
  )

(let ((ht (make-hash-table 31 eqv?)))
  (test (length ht) 32)
  (set! (ht 1) 'a)
  (test (ht 1.0) #f)
  (set! (ht 2.0) 'b)
  (test (ht 2.0) 'b)
  (set! (ht 32) 'b)
  (test (ht 32) 'b)
  (set! (ht #\a) 1)
  (test (ht #\a) 1)
  (set! (ht ()) 2)
  (test (ht ()) 2)
  (set! (ht abs) 3)
  (test (ht abs) 3)
  )

(let ((ht (make-hash-table 8 (cons string=? (lambda (a) (string-length a))))))
  (set! (ht "a") 'a)
  (test (ht "a") 'a)
  (set! (ht "abc") 'abc)
  (test (ht "abc") 'abc))

(let ((ht (make-hash-table 8 (cons (lambda (a b) (string=? a b)) string-length))))
  (set! (ht "a") 'a)
  (test (ht "a") 'a)
  (set! (ht "abc") 'abc)
  (test (ht "abc") 'abc))

(let ((ht (make-hash-table 8 (cons (lambda (a b) (string=? a b)) (lambda (a) (string-length a))))))
  (set! (ht "a") 'a)
  (test (ht "a") 'a)
  (set! (ht "abc") 'abc)
  (test (ht "abc") 'abc))

(let ((ht (make-hash-table 8 (cons string=? string-length))))
  (set! (ht "a") 'a)
  (test (ht "a") 'a)
  (set! (ht "abc") 'abc)
  (test (ht "abc") 'abc))

(let-temporarily (((*s7* 'morally-equal-float-epsilon) 1e-15))
  (let ((h (make-hash-table 8 equal?)))
    (set! (h (make-int-vector 3 0)) 3)
    (test (h (make-int-vector 3 0)) 3)
    (test (h (make-vector 3 0)) #f)
    (test (h (make-float-vector 3 0)) #f)
    (let ((x 1.0)
	  (y (+ 1.0 (* 0.5 (*s7* 'morally-equal-float-epsilon))))
	  (z (+ 1.0 (* 1000 (*s7* 'morally-equal-float-epsilon))))) ; !
      (set! (h x) 12)
      (test (h x) 12)
      (test (h y) 12)
      (test (h z) #f))))

(let ((h (make-hash-table 8 morally-equal?)))
  (set! (h (make-int-vector 3 0)) 3)
  (test (h (make-int-vector 3 0)) 3)
  (test (h (make-vector 3 0)) 3)
  (test (h (make-float-vector 3 0)) 3)
  (let ((x 1.0)
	(y (+ 1.0 (* 0.5 (*s7* 'morally-equal-float-epsilon))))
	(z (+ 1.0 (* 2 (*s7* 'morally-equal-float-epsilon)))))
    (set! (h x) 12)
    (test (h x) 12)
    (test (h y) 12)
    (test (h z) #f)
    (set! (h 1/10) 3)
    (test (h 0.1) 3)
    (set! (h #(1 2.0)) 4)
    (test (h (vector 1 2)) 4)
    (set! (h 1.0) 5)
    (test (h 1) 5)
    (set! (h (list 3)) 6)
    (test (h (list 3.0)) 6)
    ))

(when with-block
  (let ((ht (make-hash-table 31 (cons hash_heq hash_hloc))))
    (test (length ht) 32)
    (set! (ht 'a) 'b)
    (test (ht 'a) 'b) 
    (test (ht 1) #f)
    (let ((ht1 (reverse ht)))
      (test (ht1 'b) 'a))
    ))

(let ((ht (make-hash-table 31 morally-equal?))
      (ht1 (make-hash-table 31)))
  (test (length ht) 32)
  (test (equal? ht ht1) #t) 
  (set! (ht 3) 1)
  (test (ht 3) 1)
  (set! (ht1 3) 1)
  (test (equal? ht ht1) #f)
  (set! (ht 3.14) 'a)
  (test (ht 3.14) 'a)
  (set! (ht "hi") 123)
  (test (ht "hi") 123)
  (set! (ht 1/0) #<eof>)
  (test (ht 1/0) #<eof>))

(let ((ht (make-hash-table 31 (cons (lambda (a b) (eq? a b)) (lambda (a) 0)))))
  (test (hash-table-ref ht 'a) #f)
  (hash-table-set! ht 'a 1)
  (hash-table-set! ht 'c 'd)
  (test (hash-table-ref ht 'a) 1)
  (hash-table-set! ht "hi" 3)
  (test (hash-table-ref ht "hi") #f)
  (set! (ht '(a . 1)) "ho")
  (test (ht '(a . 1)) #f)
  (let ((ht1 (copy ht)))
    (test (ht1 'a) 1)
    (test (ht1 "hi") #f)
    (set! (ht1 #\a) #\b)
    (test (ht1 #\a) #\b)
    (test (ht #\a) #f)))

(when (provided? 'snd)
  (let ((ht (make-hash-table 31 (cons equal? mus-type))))
    (let ((g1 (make-oscil 100))
	  (g2 (make-oscil 100)))
      (set! (ht g1) 32)
      (test (ht g1) 32)
      (test (ht g2) 32)
      (test (equal? g1 g2) #t))))


#|
(define constants (vector 1)) ; etc -- see tauto.scm
(define ops (list eq? eqv? equal? morally-equal? = char=? string=? char-ci=? string-ci=?
		  (cons string=? (lambda (a) (string-length a)))
		  (cons (lambda (a b) (string=? a b)) string-length)))
(for-each
 (lambda (op)
   (for-each
    (lambda (val)
      (let ((h (make-hash-table 8 op)))
	(catch #t
	  (lambda ()
	    (set! (h val) #t)
	    (if (not (eq? (h val) (op val val)))
		(format *stderr* "~A ~A: ~A ~A~%" op val (h val) (op val val))))
	  (lambda any #f))))
    constants))
 ops)
|#

(let ()
  (let ((ht (make-hash-table 31 (cons (lambda (a b) (eq? a b)) (lambda (a) 0)))))
    (hash-table-set! ht 'a 1)
    (test (ht 'a) 1))
  (let ((ht (make-hash-table 31 (cons (lambda* (a b) (eq? a b)) (lambda (a) 0)))))
    (hash-table-set! ht 'a 1)
    (test (ht 'a) 1))
  (let ((ht (make-hash-table 31 (cons (lambda* (a (b 0)) (eq? a b)) (lambda (a) 0)))))
    (hash-table-set! ht 'a 1)
    (test (ht 'a) 1))
  (test (let ((ht (make-hash-table 31 (list (eq? a b)))))
	  (hash-table-set! ht 'a 1)
	  (ht 'a))
	'error)
  (test (let ((ht (make-hash-table 31 (cons abs +))))
	  (hash-table-set! ht 'a 1)
	  (ht 'a))
	'error)
  (test (let ((ht (make-hash-table 31 (cons eq? float-vector-ref))))
	  (hash-table-set! ht 'a 1)
	  (ht 'a))
	'error)
  (test (let ((ht (make-hash-table 31 (dilambda (lambda (a) (eq? a b)) (lambda (a) 0)))))
	  (hash-table-set! ht 'a 1)
	  (ht 'a))
	'error)
  (test (let ((ht (make-hash-table 31 (lambda a (eq? car a) (cadr s)))))
	  (hash-table-set! ht 'a 1)
	  (ht 'a))
	'error)
  (test (let ((ht (make-hash-table 31 (cons (lambda (a b c) (eq? a b)) (lambda (a) 0)))))
	  (hash-table-set! ht 'a 1)
	  (ht 'a))
	'error)
  (test (let ((ht (make-hash-table 31 (define-macro (_m_ . args) #f))))
	  (hash-table-set! ht 'a 1)
	  (ht 'a))
	'error)
  (test (let ((ht (make-hash-table 31 abs)))
	  (hash-table-set! ht 'a 1)
	  (ht 'a))
	'error)
  (test (let ((ht (make-hash-table 31 list-set!)))
	  (hash-table-set! ht 'a 1)
	  (ht 'a))
	'error))

(let ()
  (define (test-hash size)
    (let ((c #t))
      (let ((int-hash (make-hash-table (max size 511) (cons (lambda (a b) (= a b)) (lambda (a) a)))))
	(do ((i 0 (+ i 1))) 
	    ((= i size)) 
	  (hash-table-set! int-hash i i))
	(do ((i 0 (+ i 1)))	
	    ((= i size))
	  (let ((x (hash-table-ref int-hash i)))
	    (if (not (= x i)) (format *stderr* ";test-hash(0) ~D -> ~D~%" i x)))))
      (let ((int-hash (make-hash-table (max size 511) (cons (lambda (a b) (and c (= a b))) (lambda (a) a)))))
	(do ((i 0 (+ i 1))) 
	    ((= i size)) 
	  (hash-table-set! int-hash i i))
	(do ((i 0 (+ i 1)))	
	    ((= i size))
	  (let ((x (hash-table-ref int-hash i)))
	    (if (not (= x i)) (format *stderr* ";test-hash(1) ~D -> ~D~%" i x)))))
      (let ((int-hash (make-hash-table (max size 511) (let ((c #f)) (cons (lambda (a b) (and (not c) (= a b))) (lambda (a) a))))))
	(do ((i 0 (+ i 1))) 
	    ((= i size)) 
	  (hash-table-set! int-hash i i))
	(do ((i 0 (+ i 1)))	
	    ((= i size))
	  (let ((x (hash-table-ref int-hash i)))
	    (if (not (= x i)) (format *stderr* ";test-hash(2) ~D -> ~D~%" i x)))))
      ))

  (test-hash 10))

#|
;; another problem
(let ((ht (make-hash-table))
      (lst (list 1)))
  (set! (ht lst) 32)
  (let ((v1 (ht '(1)))
	(v2 (ht '(2))))
    (set-car! lst 2)
    (let ((v3 (ht '(1)))
	  (v4 (ht '(2))))
      (list v1 v2 v3 v4)))) ; 32 #f #f #f

(let ((ht (make-hash-table))
      (lst (list 1)))
  (set! (ht (copy lst)) 32)
  (let ((v1 (ht '(1)))
	(v2 (ht '(2))))
    (set-car! lst 2)
    (let ((v3 (ht '(1)))
	  (v4 (ht '(2))))
      (list v1 v2 v3 v4)))) ; 32 #f 32 #f

;; so copy the key if it might be changed 
|#



;;; --------------------------------------------------------------------------------
;;; some implicit index tests

(test (#(#(1 2) #(3 4)) 1 1) 4)
(test (#("12" "34") 0 1) #\2)
(test (#((1 2) (3 4)) 1 0) 3)
(test (#((1 (2 3))) 0 1 0) 2)
(test ((vector (hash-table '(a . 1) '(b . 2))) 0 'a) 1)
(test ((list (lambda (x) x)) 0 "hi") "hi")
(test (let ((lst '("12" "34"))) (lst 0 1)) #\2)
(test (let ((lst (list #(1 2) #(3 4)))) (lst 0 1)) 2)
(test (#2d(("hi" "ho") ("ha" "hu")) 1 1 0) #\h)
(test ((list (lambda (a) (+ a 1)) (lambda (b) (* b 2))) 1 2) 4)
(test ((lambda (arg) arg) "hi" 0) 'error)

(let ((L1 (list 1 2 3))
      (V1 (vector 1 2 3))
      (M1 #2d((1 2 3) (4 5 6) (7 8 9)))
      (S1 "123")
      (H1 (hash-table '(1 . 1) '(2 . 2) '(3 . 3))))
  (let ((L2 (list L1 V1 M1 S1 H1))
	(V2 (vector L1 V1 M1 S1 H1))
	(H2 (hash-table (cons 0 L1) (cons 1 V1) (cons 2 M1) (cons 3 S1) (cons 4 H1)))
	(M2 (let ((v (make-vector '(3 3))))
	      (set! (v 0 0) L1)
	      (set! (v 0 1) V1)
	      (set! (v 0 2) M1)
	      (set! (v 1 0) S1)
	      (set! (v 1 1) H1)
	      (set! (v 1 2) L1)
	      (set! (v 2 0) S1)
	      (set! (v 2 1) H1)
	      (set! (v 2 2) L1)
	      v)))
#|
    ;; this code generates the tests below
    (for-each
     (lambda (arg)
       (let* ((val (symbol->value arg))
	      (len (min 5 (length val))))
	 (do ((i 0 (+ i 1)))
	     ((= i len))
	   (format *stderr* "(test (~S ~S) ~S)~%" arg i
		   (catch #t (lambda () (val i)) (lambda args 'error)))
	   (let ((len1 (catch #t (lambda () (min 5 (length (val i)))) (lambda args 0))))
	     (if (> len1 0)
		 (do ((k 0 (+ k 1)))
		     ((= k len1))
		   (format *stderr* "(test (~S ~S ~S) ~S)~%" arg i k
			   (catch #t (lambda () (val i k)) (lambda args 'error)))
		   (let ((len2 (catch #t (lambda () (min 5 (length (val i k)))) (lambda args 0))))
		     (if (> len2 0)
			 (do ((m 0 (+ m 1)))
			     ((= m len2))
			   (format *stderr* "(test (~S ~S ~S ~S) ~S)~%" arg i k m
				   (catch #t (lambda () (val i k m)) (lambda args 'error)))
			   (let ((len3 (catch #t (lambda () (min 5 (length (val i k m)))) (lambda args 0))))
			     (if (> len3 0)
				 (do ((n 0 (+ n 1)))
				     ((= n len3))
				   (format *stderr* "(test (~S ~S ~S ~S ~S) ~S)~%" arg i k m n
					   (catch #t (lambda () (val i k m n)) (lambda args 'error)))))))))))))))
     (list 'L2 'V2 'M2 'H2))
|#

    (test (L2 0) '(1 2 3))
    (test (L2 0 0) 1)
    (test (L2 0 1) 2)
    (test (L2 0 2) 3)
    (test (L2 1) #(1 2 3))
    (test (L2 1 0) 1)
    (test (L2 1 1) 2)
    (test (L2 1 2) 3)
    (test (L2 2) #2D((1 2 3) (4 5 6) (7 8 9)))
    (test (L2 2 0) #(1 2 3))
    (test (L2 2 0 0) 1)
    (test (L2 2 0 1) 2)
    (test (L2 2 0 2) 3)
    (test (L2 2 1) #(4 5 6))
    (test (L2 2 1 0) 4)
    (test (L2 2 1 1) 5)
    (test (L2 2 1 2) 6)
    (test (L2 2 2) #(7 8 9))
    (test (L2 2 2 0) 7)
    (test (L2 2 2 1) 8)
    (test (L2 2 2 2) 9)
    (test (L2 2 3) 'error)
    (test (L2 2 4) 'error)
    (test (L2 3) "123")
    (test (L2 3 0) #\1)
    (test (L2 3 1) #\2)
    (test (L2 3 2) #\3)
    (test (L2 4) H1)
    (test (L2 4 0) #f)
    (test (L2 4 1) 1)
    (test (L2 4 2) 2)
    (test (L2 4 3) 3)
    (test (L2 4 4) #f)
    (test (V2 0) '(1 2 3))
    (test (V2 0 0) 1)
    (test (V2 0 1) 2)
    (test (V2 0 2) 3)
    (test (V2 1) #(1 2 3))
    (test (V2 1 0) 1)
    (test (V2 1 1) 2)
    (test (V2 1 2) 3)
    (test (V2 2) #2D((1 2 3) (4 5 6) (7 8 9)))
    (test (V2 2 0) #(1 2 3))
    (test (V2 2 0 0) 1)
    (test (V2 2 0 1) 2)
    (test (V2 2 0 2) 3)
    (test (V2 2 1) #(4 5 6))
    (test (V2 2 1 0) 4)
    (test (V2 2 1 1) 5)
    (test (V2 2 1 2) 6)
    (test (V2 2 2) #(7 8 9))
    (test (V2 2 2 0) 7)
    (test (V2 2 2 1) 8)
    (test (V2 2 2 2) 9)
    (test (V2 2 3) 'error)
    (test (V2 2 4) 'error)
    (test (V2 3) "123")
    (test (V2 3 0) #\1)
    (test (V2 3 1) #\2)
    (test (V2 3 2) #\3)
    (test (V2 4) H1)
    (test (V2 4 0) #f)
    (test (V2 4 1) 1)
    (test (V2 4 2) 2)
    (test (V2 4 3) 3)
    (test (V2 4 4) #f)
    (test (M2 0) #((1 2 3) #(1 2 3) #2D((1 2 3) (4 5 6) (7 8 9))))
    (test (M2 0 0) '(1 2 3))
    (test (M2 0 0 0) 1)
    (test (M2 0 0 1) 2)
    (test (M2 0 0 2) 3)
    (test (M2 0 1) #(1 2 3))
    (test (M2 0 1 0) 1)
    (test (M2 0 1 1) 2)
    (test (M2 0 1 2) 3)
    (test (M2 0 2) #2D((1 2 3) (4 5 6) (7 8 9)))
    (test (M2 0 2 0) #(1 2 3))
    (test (M2 0 2 0 0) 1)
    (test (M2 0 2 0 1) 2)
    (test (M2 0 2 0 2) 3)
    (test (M2 0 2 1) #(4 5 6))
    (test (M2 0 2 1 0) 4)
    (test (M2 0 2 1 1) 5)
    (test (M2 0 2 1 2) 6)
    (test (M2 0 2 2) #(7 8 9))
    (test (M2 0 2 2 0) 7)
    (test (M2 0 2 2 1) 8)
    (test (M2 0 2 2 2) 9)
    (test (M2 0 2 3) 'error)
    (test (M2 0 2 4) 'error)
    (test (M2 1) (vector "123" H1 '(1 2 3)))
    (test (M2 1 0) "123")
    (test (M2 1 0 0) #\1)
    (test (M2 1 0 1) #\2)
    (test (M2 1 0 2) #\3)
    (test (M2 1 1) H1)
    (test (M2 1 1 0) #f)
    (test (M2 1 1 1) 1)
    (test (M2 1 1 2) 2)
    (test (M2 1 1 3) 3)
    (test (M2 1 1 4) #f)
    (test (M2 1 2) '(1 2 3))
    (test (M2 1 2 0) 1)
    (test (M2 1 2 1) 2)
    (test (M2 1 2 2) 3)
    (test (M2 2) (vector "123" H1 '(1 2 3)))
    (test (M2 2 0) "123")
    (test (M2 2 0 0) #\1)
    (test (M2 2 0 1) #\2)
    (test (M2 2 0 2) #\3)
    (test (M2 2 1) H1)
    (test (M2 2 1 0) #f)
    (test (M2 2 1 1) 1)
    (test (M2 2 1 2) 2)
    (test (M2 2 1 3) 3)
    (test (M2 2 1 4) #f)
    (test (M2 2 2) '(1 2 3))
    (test (M2 2 2 0) 1)
    (test (M2 2 2 1) 2)
    (test (M2 2 2 2) 3)
    (test (M2 3) 'error)
    (test (M2 4) 'error)
    (test (H2 0) '(1 2 3))
    (test (H2 0 0) 1)
    (test (H2 0 1) 2)
    (test (H2 0 2) 3)
    (test (H2 1) #(1 2 3))
    (test (H2 1 0) 1)
    (test (H2 1 1) 2)
    (test (H2 1 2) 3)
    (test (H2 2) #2D((1 2 3) (4 5 6) (7 8 9)))
    (test (H2 2 0) #(1 2 3))
    (test (H2 2 0 0) 1)
    (test (H2 2 0 1) 2)
    (test (H2 2 0 2) 3)
    (test (H2 2 1) #(4 5 6))
    (test (H2 2 1 0) 4)
    (test (H2 2 1 1) 5)
    (test (H2 2 1 2) 6)
    (test (H2 2 2) #(7 8 9))
    (test (H2 2 2 0) 7)
    (test (H2 2 2 1) 8)
    (test (H2 2 2 2) 9)
    (test (H2 2 3) 'error)
    (test (H2 2 4) 'error)
    (test (H2 3) "123")
    (test (H2 3 0) #\1)
    (test (H2 3 1) #\2)
    (test (H2 3 2) #\3)
    (test (H2 4) H1)
    (test (H2 4 0) #f)
    (test (H2 4 1) 1)
    (test (H2 4 2) 2)
    (test (H2 4 3) 3)
    (test (H2 4 4) #f)
     ))

(let* ((L1 (cons 1 2))
       (L2 (list L1 3)))
  (test (L1 0) 1)
  (test (L1 1) 'error)
  (test (L1 2) 'error)
  (test (L2 0 0) 1)
  (test (L2 0 1) 'error)
  (test ((cons "123" 0) 0 1) #\2))

(let ((L1 (list "123" "456" "789")))
  (set-cdr! (cdr L1) L1)
  (test (L1 0 1) #\2)
  (test (L1 1 1) #\5)
  (test (L1 2 1) #\2)
  (test (L1 12 0) #\1))

(let ((L1 (list "123" "456" "789")))
  (set-car! (cdr L1) L1) 
  (test (L1 1 1 1 1 1 0 0) #\1))

(test ((list (list) "") 1 0) 'error)
(test ((list (list) "") 0 0) 'error)
(test (#(1 2) 0 0) 'error)
(test (#(1 #()) 1 0) 'error)

(test ('(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((12))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) 12)

;;; implicit index as expression (_A cases)

(let ((L1 (list 1 2 3))
      (V1 (vector 1 2 3))
      (S1 "123")
      (H1 (hash-table '(1 . 1) '(2 . 2) '(3 . 3)))
      (E1 (inlet :a 1 :b 2)))
  (define (f1 i s L V S H E)
    (vector (L (+ i 1)) (V (+ i 1)) (S (+ i 1)) (H (+ i 1)) (E (string->symbol s))))
  (test (f1 0 "a" L1 V1 S1 H1 E1) (vector 2 2 #\2 1 1))
  (test (f1 1 "b" L1 V1 S1 H1 E1) (vector 3 3 #\3 2 2))
  (define (f2 i s L V S H E)
    (vector (L (abs i)) (V (abs i)) (S (abs i)) (H (abs i)) (E (vector-ref s 0))))
  (test (f2 -2 #(b a) L1 V1 S1 H1 E1) (vector 3 3 #\3 2 2)))

(when with-block
  (define (f3 B i) (B (+ i 1)))
  (define (f4 B i) (B (abs i)))
  (let ((b (make-block 4))) 
    (set! (b 0) 1.0)
    (set! (b 1) 2.0)
    (test (f3 b -1) 1.0)
    (test (f4 b -1) 2.0)))

(let ((v1 #(0 1 2 3 4 5 6 7))
      (v2 #2D((0 1 2 3) (4 5 6 7)))
      (e1 (inlet :a 1))
      (p1 (list 0 1 2 3))
      (s1 "0123")
      )
  (define (call-1 func arg1 arg2) (func arg1 arg2)) 
  (define (call-2 func arg1 arg2) (func arg1 arg2)) 
  (define (call-3 func arg1 arg2) (func arg1 arg2)) 
  (define (call-4 func arg1 arg2) (func arg1 arg2)) 
  (define (call-5 func arg1 arg2) (func arg1 arg2))
  (define (call-6 func) (func 'a))
  (define (call-7 func) (func 'a))
  (define (call-8 func arg) (func (* 2 (+ arg 1))))
  (define (call-9 func arg) (func (* 2 (+ arg 1))))
  (define (call-10 func arg) (func arg))
  (define (call-11 func arg) (func arg))
  (define (call-12 func) (func 0))
  (define (call-13 func) (func 0))
  (define (call-14 func arg) (func arg 2))
  (define (call-15 func arg) (func 2 arg))

  (define (f+ x y) (+ x y))
  (define (f- x y) (- x y))
  (define* (f++ (x 0) y) (+ x y))
  (define* (f-- x (y 0)) (- x y))
  (define (fabs x) (abs x))
  (define-macro (m+ x y) `(+ ,x ,y))

  (test (call-1 + 5 2) 7)
  (test (call-1 f- 5 2) 3)
  (test (call-2 f+ 5 2) 7)
  (test (call-2 - 5 2) 3)
  (test (call-3 v2 0 3) 3)
  (test (call-3 list 0 3) (list 0 3))
  (test (call-4 f++ 5 2) 7)
  (test (call-4 f-- 5 2) 3)
  (test (call-5 m+ 5 2) 7)
  (test (call-5 - 5 2) 3)
  (test (call-6 e1) 1)
  (test (call-6 symbol?) #t)
  (test (call-7 symbol?) #t)
  (test (call-7 list) (list 'a))
  (test (call-8 abs -3) 4)
  (test (call-8 f-- 10) 22)
  (test (call-9 fabs -3) 4)
  (test (call-9 list -3) (list -4))
  (test (call-10 e1 'a) 1)
  (test (call-10 list 'a) (list 'a))
  (test (call-11 symbol? 'a) #t)
  (test (call-11 e1 'a) 1)
  (test (call-12 p1) 0)
  (test (call-12 s1) #\0)
  (test (call-13 v1) 0)
  (test (call-13 (lambda (x) (+ x 1))) 1)
  (test (call-14 * 3) 6)
  (test (call-14 (lambda (x y) (- x y)) 3) 1)
  (test (call-15 (lambda (x y) (- x y)) 3) -1)
  (test (call-15 - 3) -1)
  )
	    
;; multi-index get/set
(let ((v (vector (hash-table* 'a 1 'b 2)))) (test (v 0 'a) 1) (set! (v 0 'a) 5) (test (v 0 'a) 5))
(let ((v (vector (inlet 'a 1 'b 2)))) (test (v 0 'a) 1) (set! (v 0 'a) 5) (test (v 0 'a) 5))
(let ((v (vector (list 1 2)))) (test (v 0 1) 2) (set! (v 0 1) 5) (test (v 0 1) 5))
(let ((v (vector (string #\1 #\2)))) (test (v 0 1) #\2) (set! (v 0 1) #\5) (test (v 0 1) #\5))
(let ((v (vector (vector 1 2)))) (test (v 0 1) 2) (set! (v 0 1) 5) (test (v 0 1) 5))
(let ((v (vector (byte-vector 1 2)))) (test (v 0 1) 2) (set! (v 0 1) 5) (test (v 0 1) 5))
(when with-block (let ((v (vector (block 1 2)))) (test (v 0 1) 2.0) (set! (v 0 1) 5) (test (v 0 1) 5.0)))
(let ((v (vector (float-vector 1 2)))) (test (v 0 1) 2.0) (set! (v 0 1) 5) (test (v 0 1) 5.0))
(let ((v (vector (int-vector 1 2)))) (test (v 0 1) 2) (set! (v 0 1) 5) (test (v 0 1) 5))
(let ((v (list (hash-table* 'a 1 'b 2)))) (test (v 0 'a) 1) (set! (v 0 'a) 5) (test (v 0 'a) 5))
(let ((v (list (inlet 'a 1 'b 2)))) (test (v 0 'a) 1) (set! (v 0 'a) 5) (test (v 0 'a) 5))
(let ((v (list (list 1 2)))) (test (v 0 1) 2) (set! (v 0 1) 5) (test (v 0 1) 5))
(let ((v (list (string #\1 #\2)))) (test (v 0 1) #\2) (set! (v 0 1) #\5) (test (v 0 1) #\5))
(let ((v (list (vector 1 2)))) (test (v 0 1) 2) (set! (v 0 1) 5) (test (v 0 1) 5))
(let ((v (list (byte-vector 1 2)))) (test (v 0 1) 2) (set! (v 0 1) 5) (test (v 0 1) 5))
(when with-block (let ((v (list (block 1 2)))) (test (v 0 1) 2.0) (set! (v 0 1) 5) (test (v 0 1) 5.0)))
(let ((v (list (float-vector 1 2)))) (test (v 0 1) 2.0) (set! (v 0 1) 5) (test (v 0 1) 5.0))
(let ((v (list (int-vector 1 2)))) (test (v 0 1) 2) (set! (v 0 1) 5) (test (v 0 1) 5))
(let ((v (hash-table* 'a (hash-table* 'a 1 'b 2)))) (test (v 'a 'a) 1) (set! (v 'a 'a) 5) (test (v 'a 'a) 5))
(let ((v (hash-table* 'a (inlet 'a 1 'b 2)))) (test (v 'a 'a) 1) (set! (v 'a 'a) 5) (test (v 'a 'a) 5))
(let ((v (hash-table* 'a (list 1 2)))) (test (v 'a 1) 2) (set! (v 'a 1) 5) (test (v 'a 1) 5))
(let ((v (hash-table* 'a (string #\1 #\2)))) (test (v 'a 1) #\2) (set! (v 'a 1) #\5) (test (v 'a 1) #\5))
(let ((v (hash-table* 'a (vector 1 2)))) (test (v 'a 1) 2) (set! (v 'a 1) 5) (test (v 'a 1) 5))
(let ((v (hash-table* 'a (byte-vector 1 2)))) (test (v 'a 1) 2) (set! (v 'a 1) 5) (test (v 'a 1) 5))
(when with-block (let ((v (hash-table* 'a (block 1 2)))) (test (v 'a 1) 2.0) (set! (v 'a 1) 5) (test (v 'a 1) 5.0)))
(let ((v (hash-table* 'a (float-vector 1 2)))) (test (v 'a 1) 2.0) (set! (v 'a 1) 5) (test (v 'a 1) 5.0))
(let ((v (hash-table* 'a (int-vector 1 2)))) (test (v 'a 1) 2) (set! (v 'a 1) 5) (test (v 'a 1) 5))
(let ((v (inlet 'a (hash-table* 'a 1 'b 2)))) (test (v 'a 'a) 1) (set! (v 'a 'a) 5) (test (v 'a 'a) 5))
(let ((v (inlet 'a (inlet 'a 1 'b 2)))) (test (v 'a 'a) 1) (set! (v 'a 'a) 5) (test (v 'a 'a) 5))
(let ((v (inlet 'a (list 1 2)))) (test (v 'a 1) 2) (set! (v 'a 1) 5) (test (v 'a 1) 5))
(let ((v (inlet 'a (string #\1 #\2)))) (test (v 'a 1) #\2) (set! (v 'a 1) #\5) (test (v 'a 1) #\5))
(let ((v (inlet 'a (vector 1 2)))) (test (v 'a 1) 2) (set! (v 'a 1) 5) (test (v 'a 1) 5))
(let ((v (inlet 'a (byte-vector 1 2)))) (test (v 'a 1) 2) (set! (v 'a 1) 5) (test (v 'a 1) 5))
(when with-block (let ((v (inlet 'a (block 1 2)))) (test (v 'a 1) 2.0) (set! (v 'a 1) 5) (test (v 'a 1) 5.0)))
(let ((v (inlet 'a (float-vector 1 2)))) (test (v 'a 1) 2.0) (set! (v 'a 1) 5) (test (v 'a 1) 5.0))
(let ((v (inlet 'a (int-vector 1 2)))) (test (v 'a 1) 2) (set! (v 'a 1) 5) (test (v 'a 1) 5))

(let ((ind 0) (sym 'a) (v (vector (hash-table* 'a 1 'b 2)))) (test (v ind sym) 1) (set! (v (+ ind ind) sym) (+ ind 5)) (test (v 0 'a) 5))
(let ((v (vector (hash-table* 'a "123" 'b 2)))) (test (v 0 'a 1) #\2) (set! (v 0 'a 1) #\5) (test (v 0 'a) "153"))

(let ((iv (make-vector '(2 2))))
  (set! (iv 1 0) 2)
  (set! (iv 1 1) 4)
  (let ((v (vector iv))) 
    (test (v 0 1 0) 2) 
    (set! (v 0 1 0) 5) 
    (test (v 0 1) #(5 4))))

(let ((ov (make-vector '(2 2)))
      (iv (make-vector '(2 2))))
  (set! (ov 1 0) iv)
  (set! (iv 0 1) 3)
  (test (ov 1 0 0 1) 3)
  (set! (ov 1 0 0 1) 5)
  (test (ov 1 0 0 1) 5))



;;; --------------------------------------------------------------------------------
;;; PORTS
;;; --------------------------------------------------------------------------------

(define start-input-port (current-input-port))
(define start-output-port (current-output-port))

(test (input-port? (current-input-port)) #t)
(test (input-port? *stdin*) #t)
(test (input-port? (current-output-port)) #f)
(test (input-port? *stdout*) #f)
(test (input-port? (current-error-port)) #f)
(test (input-port? *stderr*) #f)

(for-each
 (lambda (arg)
   (if (input-port? arg)
       (format #t ";(input-port? ~A) -> #t?~%" arg)))
 (list "hi" #f (integer->char 65) 1 (list 1 2) '#t '3 (make-vector 3) 3.14 3/4 1.0+1.0i #\f :hi #<eof> #<undefined> #<unspecified>))

(test (call-with-input-file "s7test.scm" input-port?) #t)
(if (not (eq? start-input-port (current-input-port)))
    (format #t "call-with-input-file did not restore current-input-port? ~A from ~A~%" start-input-port (current-input-port)))

(test (let ((this-file (open-input-file "s7test.scm"))) (let ((res (input-port? this-file))) (close-input-port this-file) res)) #t)
(if (not (eq? start-input-port (current-input-port)))
    (format #t "open-input-file clobbered current-input-port? ~A from ~A~%" start-input-port (current-input-port)))

(test (call-with-input-string "(+ 1 2)" input-port?) #t)
(test (let ((this-file (open-input-string "(+ 1 2)"))) (let ((res (input-port? this-file))) (close-input-port this-file) res)) #t)
(test (let ((this-file (open-input-string "(+ 1 2)"))) (let ((len (length this-file))) (close-input-port this-file) len)) 7)

;;; (test (let ((str "1234567890")) (let ((p (open-input-string str))) (string-set! str 0 #\a) (let ((c (read-char p))) (close-input-port p) c))) #\1)
;;; is that result demanded by the scheme spec? perhaps make str immutable if so?

;;; read
;;; write
(test (+ 100 (call-with-input-string "123" (lambda (p) (values (read p) 1)))) 224)


(test (call-with-input-string
       "1234567890"
       (lambda (p)
	 (call-with-input-string
	  "0987654321"
	  (lambda (q)
            (+ (read p) (read q))))))
      2222222211)

(test (call-with-input-string
       "12345 67890"
       (lambda (p)
	 (call-with-input-string
	  "09876 54321"
	  (lambda (q)
            (- (+ (read p) (read q)) (read p) (read q))))))
      -99990)

(call-with-output-file "empty-file" (lambda (p) #f))
(test (call-with-input-file "empty-file" (lambda (p) (eof-object? (read-char p)))) #t)
(test (call-with-input-file "empty-file" (lambda (p) (eof-object? (read p)))) #t)
(test (call-with-input-file "empty-file" (lambda (p) (eof-object? (read-byte p)))) #t)
(test (call-with-input-file "empty-file" (lambda (p) (eof-object? (read-line p)))) #t)
(test (load "empty-file") #<unspecified>)
(test (call-with-input-file "empty-file" (lambda (p) (port-closed? p))) #f)
(test (eof-object? (call-with-input-string "" (lambda (p) (read p)))) #t)
(test (eof-object? #<eof>) #t)
(test (let () (define (hi a) (eof-object? a)) (hi #<eof>)) #t)

(let ()
  (define (io-func) (lambda (p) (eof-object? (read-line p))))
  (test (call-with-input-file (let () "empty-file") (io-func)) #t))

(let ((p1 #f))
  (call-with-output-file "empty-file" (lambda (p) (set! p1 p) (write-char #\a p)))
  (test (port-closed? p1) #t))
(test (call-with-input-file "empty-file" (lambda (p) (and (char=? (read-char p) #\a) (eof-object? (read-char p))))) #t)
(test (call-with-input-file "empty-file" (lambda (p) (and (string=? (symbol->string (read p)) "a") (eof-object? (read p))))) #t) ; Guile also returns a symbol here
(test (call-with-input-file "empty-file" (lambda (p) (and (char=? (integer->char (read-byte p)) #\a) (eof-object? (read-byte p))))) #t)
(test (call-with-input-file "empty-file" (lambda (p) (and (string=? (read-line p) "a") (eof-object? (read-line p))))) #t)

(test (call-with-input-string "(lambda (a) (+ a 1))" (lambda (p) (let ((f (eval (read p)))) (f 123)))) 124)
(test (call-with-input-string "(let ((x 21)) (+ x 1))" (lambda (p) (eval (read p)))) 22)
(test (call-with-input-string "(1 2 3) (4 5 6)" (lambda (p) (list (read p) (read p)))) '((1 2 3) (4 5 6)))

(test (let ()
	(call-with-output-file "empty-file" (lambda (p) (write '(lambda (a) (+ a 1)) p)))
	(call-with-input-file "empty-file" (lambda (p) (let ((f (eval (read p)))) (f 123)))))
      124)
(test (let ()
	(call-with-output-file "empty-file" (lambda (p) (write '(let ((x 21)) (+ x 1)) p)))
	(call-with-input-file "empty-file" (lambda (p) (eval (read p)))))
      22)
(test (let ()
	(call-with-output-file "empty-file" (lambda (p) (write '(1 2 3) p) (write '(4 5 6) p)))
	(call-with-input-file "empty-file" (lambda (p) (list (read p) (read p)))))
      '((1 2 3) (4 5 6)))

(call-with-output-file "empty-file" (lambda (p) (for-each (lambda (c) (write-char c p)) "#b11")))
(test (call-with-input-file "empty-file" (lambda (p) 
					   (and (char=? (read-char p) #\#) 
						(char=? (read-char p) #\b) 
						(char=? (read-char p) #\1) 
						(char=? (read-char p) #\1) 
						(eof-object? (read-char p))))) 
      #t)
(test (call-with-input-file "empty-file" (lambda (p) 
					   (and (= (read p) 3) 
						(eof-object? (read p))))) 
      #t)
(test (call-with-input-file "empty-file" (lambda (p) 
					   (and (= (read-byte p) (char->integer #\#))
						(= (read-byte p) (char->integer #\b))
						(= (read-byte p) (char->integer #\1))
						(= (read-byte p) (char->integer #\1))
						(eof-object? (read-byte p))))) 
      #t)
(test (call-with-input-file "empty-file" (lambda (p) 
					   (and (string=? (read-line p) "#b11") 
						(eof-object? (read-line p))))) 
      #t)
(test (load "empty-file") 3)
(let ((p1 (dilambda (lambda (p) (and (= (read p) 3) (eof-object? (read p)))) (lambda (p) #f))))
  (test (call-with-input-file "empty-file" p1) #t))


;;; load
(for-each
 (lambda (arg)
   (test (load arg) 'error)
   (test (load "empty-file" arg) 'error))
 (list () (list 1) '(1 . 2) #f #\a 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #f #t :hi (if #f #f) (lambda (a) (+ a 1))))
(test (load) 'error)
(test (load "empty-file" (curlet) 1) 'error)
(test (load "not a file") 'error)
(test (load "") 'error)
(test (load "/home/bil/cl") 'error)
(test (call-with-input-string "(display (+ 1 2))" load) 'error)

(call-with-output-file "empty-file" (lambda (p) (write '(+ 1 2 3) p)))
(let ((x 4))
  (test (+ x (load "empty-file")) 10))

(call-with-output-file "empty-file" (lambda (p) (write '(list 1 2 3) p)))
(let ((x 4))
  (test (cons x (load "empty-file")) '(4 1 2 3)))

(call-with-output-file "empty-file" (lambda (p) (write '(values 1 2 3) p)))
(let ((x 4))
  (test (+ x (load "empty-file")) 10))
(test (+ 4 (eval (call-with-input-file "empty-file" (lambda (p) (read p))))) 10)

(call-with-output-file "empty-file" (lambda (p) (write '(+ x 1) p)))
(let ((x 2))
  (test (load "empty-file" (curlet)) 3))

(call-with-output-file "empty-file" (lambda (p) (write '(set! x 1) p)))
(let ((x 2))
  (load "empty-file" (curlet))
  (test x 1))

(call-with-output-file "empty-file" (lambda (p) (write '(define (hi a) (values a 2)) p) (write '(hi x) p)))
(let ((x 4))
  (test (+ x (load "empty-file" (curlet))) 10))

(let ((x 1)
      (e #f))
  (set! e (curlet))
  (let ((x 4))
    (test (+ x (load "empty-file" e)) 7)))

(let ()
  (let ()
    (call-with-output-file "empty-file" (lambda (p) (write '(define (load_hi a) (+ a 1)) p)))
    (load "empty-file" (curlet))
    (test (load_hi 2) 3))
  (test (defined? 'load_hi) #f))

(let ()
  (apply load '("empty-file"))
  (test (load_hi 2) 3))

(call-with-output-file "empty-file" (lambda (p) (display "\"empty-file\"" p)))
(test (load (load "empty-file")) "empty-file")

;;; autoload
(test (autoload) 'error)
(test (autoload 'abs) 'error)
(test (autoload :abs "dsp.scm") 'error)
(for-each
 (lambda (arg)
   (test (autoload arg "dsp.scm") 'error)
   (test (autoload 'hi arg) 'error))
 (list #f () (integer->char 65) 1 (list 1 2) _ht_ _undef_ _null_ _c_obj_ '#t '3 (make-vector 3) 3.14 3/4 1.0+1.0i #\f))
(test (autoload 'abs "dsp.scm" 123) 'error)
(test (autoload "" "dsp.scm") 'error)

(autoload 'auto_test_var "empty-file")
(test (defined? 'auto_test_var) #f)
(call-with-output-file "empty-file" (lambda (p) (format p "(define auto_test_var 123)~%")))
(load "empty-file")
(test (+ 1 auto_test_var) 124)

(autoload 'auto_test_var_2 (lambda (e) (varlet e (cons 'auto_test_var_2 1))))
(test (let () (+ 1 auto_test_var_2)) 2)

(autoload 'auto_test_var_3 (lambda (e) (varlet e (cons 'auto_test_var_3 1))))
(autoload 'auto_test_var_4 (lambda (e) (varlet e (cons 'auto_test_var_4 (+ auto_test_var_3 1)))))
(test (let () (+ auto_test_var_4 1)) 3)
(test (autoload 'auto_test_var_1 (lambda () #f)) 'error)
(test (autoload 'auto_test_var_1 (lambda (a b) #f)) 'error)

(let ((str3 #f))
  ;; IO tests mainly

  (set! str3 "0123456789")
  (set! str3 (string-append str3 str3 str3 str3 str3 str3 str3 str3 str3 str3))
  (set! str3 (string-append str3 str3 str3 str3 str3 str3 str3 str3 str3 str3))
  (set! str3 (string-append str3 str3 str3))

  (call-with-output-file "test.scm"
    (lambda (p)
      (format p "(define (big-string)~%")
      (format p "  \"")
      (display str3 p)
      (format p "\\\n") ; this becomes \<newline> in the midst of a string which we ignore
      (display str3 p)
      (format p "\"")
      (format p ")~%")))
  
  (load "test.scm")
  (let ((str (big-string)))
    (test (length str) 6000))
  
  (let ((big-string (eval (call-with-input-string
			   (call-with-output-string
			    (lambda (p)
			      (format p "(lambda ()~%")
			      (format p "  \"")
			      (display str3 p)
			      (format p "\\\n") ; this becomes \<newline> in the midst of a string which we ignore
			      (display str3 p)
			      (format p "\"")
			      (format p ")~%")))
			   read))))
    (let ((str (big-string)))
      (test (length str) 6000)))
  
  (call-with-output-file "test.scm"
    (lambda (p)
      (format p "(define (big-string)~%")
      (format p "  \"")
      (display str3 p)
      (format p "\\\"") 
      (display str3 p)
      (format p "\"")
      (format p ")~%")))
  
  (load "test.scm")
  (let ((str (big-string)))
    (test (length str) 6001))
  
  (let ((big-string (eval (call-with-input-string
			   (call-with-output-string
			    (lambda (p)
			      (format p "(lambda ()~%")
			      (format p "  \"")
			      (display str3 p)
			      (format p "\\\"") 
			      (display str3 p)
			      (format p "\"")
			      (format p ")~%")))
			   read))))
    (let ((str (big-string)))
      (test (length str) 6001)))
  
  (call-with-output-file "test.scm"
    (lambda (p)
      (format p "")))
  (load "test.scm") ; #<unspecified>
  
  (let ()
    (define (write-stuff p)
      (format p ";")
      (do ((i 0 (+ i 1)))
	  ((= i 3000))
	(let ((c (integer->char (random 128))))
	  (if (char<? c #\space)
	      (display #\space p)
	      (display c p))))
      (format p "~%32~%"))
    (call-with-output-file "test.scm" write-stuff)
    (test (load "test.scm") 32))
  
  (let ()
    (define (write-stuff p)
      (format p "(define (big-list)~%  (list ")
      (do ((i 0 (+ i 1)))
	  ((= i 2000))
	(format p "~D " i))
      (format p "))~%"))
    (call-with-output-file "test.scm" write-stuff)
    (load "test.scm")
    (let ((lst (big-list)))
      (test (length lst) 2000)))
  
  (let ()
    (define (write-stuff p)
      (format p "(define (big-list)~%  ")
      (do ((i 0 (+ i 1)))
	  ((= i 2000))
	(format p "(cons ~D " i))
      (format p "()")
      (do ((i 0 (+ i 1)))
	  ((= i 2000))
	(format p ")"))
      (format p ")~%"))
  (call-with-output-file "test.scm" write-stuff)  
  (load "test.scm")
  (let ((lst (big-list)))
    (test (length lst) 2000)))
  
  (call-with-output-file "test.scm"
    (lambda (p)
      (format p "(define (a-char)~%  #\\a)~%")))
  
  (load "test.scm")
  (test (a-char) #\a)
  
  (call-with-output-file "test.scm"
    (lambda (p)
      (let ((a (char->integer #\a)))
	(format p "(define (big-char)~%  (string ")
	(do ((i 0 (+ i 1)))
	    ((= i 2000))
	  (format p "#\\~C " (integer->char (+ a (modulo i 26)))))
	(format p "))~%"))))
  
  (load "test.scm")
  (let ((chars (big-char)))
    (test (length chars) 2000))
  
  (call-with-output-file "test.scm"
    (lambda (p)
      (let ((a (char->integer #\a)))
	(format p "(define (big-xchar)~%  (string ")
	(do ((i 0 (+ i 1)))
	    ((= i 2000))
	  (format p "#\\x~X " (+ a (modulo i 26))))
	(format p "))~%"))))
  
  (load "test.scm")
  (let ((chars (big-xchar)))
    (test (length chars) 2000))
  
  (call-with-output-file "test.scm"
    (lambda (p)
      (format p "(define (ychar) #\\~C)" (integer->char 255))))
  (load "test.scm") 
  (test (ychar) (integer->char 255))

  (let ()
    (define (write-stuff p)
      (do ((i 0 (+ i 1)))
	  ((= i 1000))
	(format p "~D" i))
      (format p "~%")
      (do ((i 0 (+ i 1)))
	  ((= i 1000))
	(format p "~D" i)))
    (call-with-output-file "test.scm" write-stuff))
  
  (call-with-input-file "test.scm"
    (lambda (p)
      (let ((s1 (read-line p))
	    (s2 (read-line p)))
	(test (and (string=? s1 s2)
		   (= (length s1) 2890))
	      #t))))
  
  (call-with-output-file "test.scm"
    (lambda (p)
      (format p "(define (big-int)~%")
      (do ((i 0 (+ i 1)))
	  ((= i 3000))
	(format p "0"))
      (format p "123)~%")))
  
  (load "test.scm")
  (test (big-int) 123)
  
  (call-with-output-file "test.scm"
    (lambda (p)
      (format p "(define (big-rat)~%")
      (do ((i 0 (+ i 1)))
	  ((= i 3000))
	(format p "0"))
      (format p "123/")
      (do ((i 0 (+ i 1)))
	  ((= i 3000))
	(format p "0"))
      (format p "2)~%")))
  
  (load "test.scm")
  (test (big-rat) 123/2)
  
  (call-with-output-file "test.scm"
    (lambda (p)
      (format p "(define (big-hash)~%  (hash-table ")
      (do ((i 0 (+ i 1)))
	  ((= i 2000))
	(format p "'(~D . ~D) " i (+ i 1)))
      (format p "))~%")))
  
  (load "test.scm")
  (let ((ht (big-hash)))
    (let ((entries 0))
      (for-each
       (lambda (htv)
	 (set! entries (+ entries 1))
	 (if (not (= (+ (car htv) 1) (cdr htv)))
	     (format *stderr* ";hashed: ~A~%" htv)))
       ht)
      (test entries 2000)))
  
  (call-with-output-file "test.scm"
    (lambda (p)
      (format p "(define (big-hash)~%  (apply hash-table (list ")
      (do ((i 0 (+ i 1)))
	  ((= i 2000))
	(format p "(cons ~D ~D) " i (+ i 1)))
      (format p ")))~%")))
  
  (load "test.scm")
  (let ((ht (big-hash)))
    (let ((entries 0))
      (for-each
       (lambda (htv)
	 (set! entries (+ entries 1))
	 (if (not (= (+ (car htv) 1) (cdr htv)))
	     (format *stderr* ";hashed: ~A~%" htv)))
       ht)
      (test entries 2000)))
  
  (call-with-output-file "test.scm"
    (lambda (p)
      (let ((a (char->integer #\a)))
	(format p "(define (big-env)~%  (inlet ")
	(do ((i 0 (+ i 1)))
	    ((= i 2000))
	  (format p "'(~A . ~D) " 
		  (string (integer->char (+ a (modulo i 26)))
			  (integer->char (+ a (modulo (floor (/ i 26)) 26)))
			  (integer->char (+ a (modulo (floor (/ i (* 26 26))) 26))))
		  i))
	(format p "))~%"))))
  
  (load "test.scm")
  (let ((E (big-env))
	(a (char->integer #\a)))
    (do ((i 0 (+ i 1)))
	((= i 2000))
      (let ((sym (string->symbol
		  (string (integer->char (+ a (modulo i 26)))
			  (integer->char (+ a (modulo (floor (/ i 26)) 26)))
			  (integer->char (+ a (modulo (floor (/ i (* 26 26))) 26)))))))
	(let ((val (E sym)))
	  (if (not (equal? val i))
	      (format *stderr* ";env: ~A -> ~A, not ~D~%" sym val i))))))
  
  (call-with-output-file "test.scm"
    (lambda (p)
      (format p "")))
  
  (let ((val (call-with-input-file "test.scm"
	       (lambda (p)
		 (read p)))))
    (if (not (eof-object? val))
	(format *stderr* ";read empty file: ~A~%" val)))
  
  (call-with-output-file "test.scm"
    (lambda (p)
      (format p " ;")
      (do ((i 0 (+ i 1)))
	  ((= i 3000))
	(let ((c (integer->char (random 128))))
	  (if (char<? c #\space)
	      (display #\space p)
	      (display c p))))
      (format p "~%")))
  
  (let ((val (call-with-input-file "test.scm"
	       (lambda (p)
		 (read p)))))
    (if (not (eof-object? val))
	(format *stderr* ";read comment file: ~A~%" val)))
  
  (call-with-output-file "test.scm"
    (lambda (p)
      (format p "\"~3001TT\"~%")))
  
  (let ((str (call-with-input-file "test.scm"
	       (lambda (p)
		 (read p)))))
    (test (length str) 3000)))

#|
(let ((c #f)
      (i 0)
      (e #f))
  (set! e (curlet))
  (call-with-output-file "empty-file" (lambda (p) (write '(call/cc (lambda (c1) (set! c c1) (set! i (+ i 1)))) p)))
  (load "empty-file" e)
  (test (c) 'error)) ; ;read-error ("our input port got clobbered!")
|#


(test (reverse *stdin*) 'error)
(test (fill! (current-output-port)) 'error)
(test (length *stderr*) #f)

(test (output-port? (current-input-port)) #f)
(test (output-port? *stdin*) #f)
(test (output-port? (current-output-port)) #t)
(test (output-port? *stdout*) #t)
(test (output-port? (current-error-port)) #t)
(test (output-port? *stderr*) #t)

;(write-char #\space (current-output-port))
;(write " " (current-output-port))
(newline (current-output-port))
(for-each
 (lambda (p)
   (test (write-char #\a p) 'error)
   (test (write-byte 0 p) 'error)
   (test (write-string "a" p) 'error)
   (test (write "a" p) 'error)
   (test (display "a" p) 'error)
   (test (format p "~a" 2) 'error))
 (list *stdin* (current-input-port)))

(for-each
 (lambda (p)
   (test (read-char p) 'error)
   (test (read-byte p) 'error)
   (test (read-line p) 'error)
   (test (read-string p) 'error)
   (test (read p) 'error))
 (list *stdout* #f (current-output-port)))

(for-each
 (lambda (p)
   (test (write-char #\a p) 'error)
   (test (write-byte 0 p) 'error)
   (test (write-string "a" p) 'error)
   (test (write "a" p) 'error)
   (test (display "a" p) 'error)
   (test (format p "~a" 2) 'error)
   (test (read-char p) 'error)
   (test (read-byte p) 'error)
   (test (read-line p) 'error)
   (test (read-string p) 'error)
   (test (read p) 'error))
 (list (let ((p (open-output-string))) (close-output-port p) p)
       (let ((p (open-input-string "123"))) (close-input-port p) p)))

(for-each
 (lambda (arg)
   (if (output-port? arg)
       (format #t ";(output-port? ~A) -> #t?~%" arg)))
 (list "hi" #f () 'hi (integer->char 65) 1 (list 1 2) _ht_ _undef_ _null_ _c_obj_ '#t '3 (make-vector 3) 3.14 3/4 1.0+1.0i #\f))

(for-each
 (lambda (arg)
   (test (read-line () arg) 'error)
   (test (read-line arg) 'error))
 (list "hi" (integer->char 65) 1 #f _ht_ _undef_ _null_ _c_obj_ (list) (cons 1 2) (list 1 2) (make-vector 3) 3.14 3/4 1.0+1.0i #\f))

(test (call-with-output-file tmp-output-file output-port?) #t)
(if (not (eq? start-output-port (current-output-port)))
    (format #t "call-with-output-file did not restore current-output-port? ~A from ~A~%" start-output-port (current-output-port)))

(test (let ((this-file (open-output-file tmp-output-file))) (let ((res (output-port? this-file))) (close-output-port this-file) res)) #t)
(if (not (eq? start-output-port (current-output-port)))
    (format #t "open-output-file clobbered current-output-port? ~A from ~A~%" start-output-port (current-output-port)))

(test (let ((val #f)) (call-with-output-string (lambda (p) (set! val (output-port? p)))) val) #t)
(test (let ((res #f)) (let ((this-file (open-output-string))) (set! res (output-port? this-file)) (close-output-port this-file) res)) #t)

(test (with-output-to-string (lambda () (display _undef_))) "#_asdf")
(test (with-output-to-string (lambda () (write _undef_))) "#_asdf")

(for-each
 (lambda (arg)
   (if (eof-object? arg)
       (format #t ";(eof-object? ~A) -> #t?~%" arg)))
 (list "hi" () '(1 2) -1 #\a 1 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #f #t (if #f #f) #<undefined> (lambda (a) (+ a 1))))

(for-each
 (lambda (arg)
   (let ((val (catch #t
		     (lambda () (port-closed? arg))
		     (lambda args 'error))))
     (if (not (eq? val 'error))
	 (format #t ";(port-closed? ~A) -> ~S?~%" arg val))))
 (list "hi" '(1 2) -1 #\a 1 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #f #t (if #f #f) #<undefined> #<eof> (lambda (a) (+ a 1))))

(test (port-closed?) 'error)
(test (port-closed? (current-input-port) (current-output-port)) 'error)
(test (let-temporarily (((current-output-port) #f)) (port-closed? (current-output-port))) #f)

(call-with-output-file tmp-output-file (lambda (p) (display "3.14" p)))
(test (call-with-input-file tmp-output-file (lambda (p) (read p) (let ((val (read p))) (eof-object? val)))) #t)

(test (call-with-input-file tmp-output-file (lambda (p) (read-char p))) #\3)
(test (call-with-input-file tmp-output-file (lambda (p) (peek-char p))) #\3)
(test (call-with-input-file tmp-output-file (lambda (p) (peek-char p) (read-char p))) #\3)
(test (call-with-input-file tmp-output-file (lambda (p) (list->string (list (read-char p) (read-char p) (read-char p) (read-char p))))) "3.14")
(test (call-with-input-file tmp-output-file (lambda (p) (list->string (list (read-char p) (peek-char p) (read-char p) (read-char p) (peek-char p) (read-char p))))) "3..144")

(for-each
 (lambda (arg)
   (call-with-output-file tmp-output-file (lambda (p) (write arg p)))
   (if (not (morally-equal? (call-with-input-file tmp-output-file (lambda (p) (read p))) arg))
       (format *stderr* "~A different after write~%" arg)))
 (list "hi" -1 #\a 1 'a-symbol (make-vector 3 0) 3.14 3/4 .6 1.0+1.0i #f #t (list 1 2 3) (cons 1 2)
       '(1 2 . 3) () '((1 2) (3 . 4)) '(()) (list (list 'a "hi") #\b 3/4) ''a
       (string #\a #\null #\b) "" "\"hi\""
       (integer->char 128) (integer->char 127) (integer->char 255) #\space #\null #\newline #\tab
       #() #2d((1 2) (3 4)) #3d()
       :hi #<eof> #<undefined> #<unspecified>
       most-negative-fixnum
       (if with-bignums 1239223372036854775808 123)
       (if with-bignums 144580536300674537151081081515762353325831/229154728370723013560448485454219755525522 11/10)
       (if with-bignums 221529797579218180403518826416685087012.0 1000.1)
       (if with-bignums 1239223372036854775808+1239223372036854775808i 1000.1-1234i)))

(for-each
 (lambda (arg)
   (call-with-output-file tmp-output-file (lambda (p) (write arg p)))
   (test (call-with-input-file tmp-output-file (lambda (p) (eval (read p)))) arg)) ; so read -> symbol?
 (list *stdout* *stdin* *stderr*
       abs + quasiquote
  
;       (hash-table '(a . 1) '(b . 2)) (hash-table)
;       0/0 (real-part (log 0))
;;; for these we need nan? and infinite? since equal? might be #f
;       (lambda (a) (+ a 1))
; pws?
;       (current-output-port)
;       (random-state 1234)
;       (symbol ":\"")
; (let () (define-macro (hi1 a) `(+ ,a 1)) hi1)
;;; and how could a continuation work in general?        
       ))

;;; (call-with-input-file tmp-output-file (lambda (p) (read p))) got (symbol ":\"") but expected (symbol ":\"")


;;; r4rstest
(let* ((write-test-obj '(#t #f a () 9739 -3 . #((test) "te \" \" st" "" test #() b c)))
       (load-test-obj (list 'define 'foo (list 'quote write-test-obj))))
  
  (define (check-test-file name)
    (let ((val (call-with-input-file
		   name
		 (lambda (test-file)
		   (test (read test-file) load-test-obj)
		   (test (eof-object? (peek-char test-file)) #t)
		   (test (eof-object? (read-char test-file)) #t)
		   (input-port? test-file)))))
      (if (not (eq? val #t))
	  (format #t "input-port? in call-with-input-file? returned ~A from ~A~%" val name))))
  
  (test (call-with-output-file
	    tmp-output-file
	  (lambda (test-file)
	    (write-char #\; test-file)
	    (display #\; test-file)
	    (display ";" test-file)
	    (write write-test-obj test-file)
	    (newline test-file)
	    (write load-test-obj test-file)
	    (output-port? test-file))) #t)
  (check-test-file tmp-output-file)
  
  (let ((test-file (open-output-file "tmp2.r5rs")))
    (test (port-closed? test-file) #f)
    (write-char #\; test-file)
    (display #\; test-file)
    (display ";" test-file)
    (write write-test-obj test-file)
    (newline test-file)
    (write load-test-obj test-file)
    (test (output-port? test-file) #t)
    (close-output-port test-file)
    (check-test-file "tmp2.r5rs")))


(call-with-output-file tmp-output-file (lambda (p) (display "3.14" p)))
(test (with-input-from-file tmp-output-file read) 3.14)
(if (not (eq? start-input-port (current-input-port)))
    (format #t "with-input-from-file did not restore current-input-port? ~A from ~A~%" start-input-port (current-input-port)))

(test (with-input-from-file tmp-output-file (lambda () (eq? (current-input-port) start-input-port))) #f)
(test (char->integer ((with-input-from-string (string (integer->char 255))(lambda () (read-string 1))) 0)) 255)

(test (with-output-to-file tmp-output-file (lambda () (eq? (current-output-port) start-output-port))) #f)
(if (not (eq? start-output-port (current-output-port)))
    (format #t "with-output-to-file did not restore current-output-port? ~A from ~A~%" start-output-port (current-output-port)))


(let ((newly-found-sonnet-probably-by-shakespeare 
       "This is the story, a sad tale but true \
        Of a programmer who had far too little to do.\
        One day as he sat in his hut swilling stew, \
        He cried \"CLM takes forever, it's stuck in a slough!,\
        Its C code is slow, too slow by a few.\
        Why, with just a small effort, say one line or two,\
        It could outpace a no-op, you could scarcely say 'boo'\"!\
        So he sat in his kitchen and worked like a dog.\
        He typed and he typed 'til his mind was a fog. \
        Now 6000 lines later, what wonders we see!  \
        CLM is much faster, and faster still it will be!\
        In fact, for most cases, C beats the DSP!  \
        But bummed is our coder; he grumbles at night.  \
        That DSP code took him a year to write.  \
        He was paid many dollars, and spent them with glee,\
        But his employer might mutter, this result were he to see."))
  
  (call-with-output-file tmp-output-file
    (lambda (p)
      (write newly-found-sonnet-probably-by-shakespeare p)))
  
  (let ((sonnet (with-input-from-file tmp-output-file
		  (lambda ()
		    (read)))))
    (if (or (not (string? sonnet))
	    (not (string=? sonnet newly-found-sonnet-probably-by-shakespeare)))
	(format #t "write/read long string returned: ~A~%" sonnet)))
  
  (let ((file (open-output-file tmp-output-file)))
    (let ((len (string-length newly-found-sonnet-probably-by-shakespeare)))
      (write-char #\" file)
      (do ((i 0 (+ i 1)))
	  ((= i len))
	(let ((chr (string-ref newly-found-sonnet-probably-by-shakespeare i)))
	  (if (char=? chr #\")
	      (write-char #\\ file))
	  (write-char chr file)))
      (write-char #\" file)
      (close-output-port file)))
  
  (let ((file (open-input-file tmp-output-file)))
    (let ((sonnet (read file)))
      (close-input-port file)
      (if (or (not (string? sonnet))
	      (not (string=? sonnet newly-found-sonnet-probably-by-shakespeare)))
	  (format #t "write-char/read long string returned: ~A~%" sonnet)))))

(let ((file (open-output-file tmp-output-file)))
  (for-each
   (lambda (arg)
     (write arg file)
     (write-char #\space file))
   (list "hi" -1 #\a 1 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #f #t (list 1 2 3) '(1 . 2)))
  (close-output-port file))

(let ((file (open-input-file tmp-output-file)))
  (for-each
   (lambda (arg)
     (let ((val (read file)))
       (if (not (equal? val arg))
	   (format #t "read/write ~A returned ~A~%" arg val))))
   (list "hi" -1 #\a 1 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #f #t (list 1 2 3) '(1 . 2)))
  (close-input-port file))

(with-output-to-file tmp-output-file
  (lambda ()
    (write lists)))

(let ((val (with-input-from-file tmp-output-file
	     (lambda ()
	       (read)))))
  (if (not (equal? val lists))
      (format #t "read/write lists returned ~A~%" val)))

(if (not (string=? "" (with-output-to-string (lambda () (display "")))))
    (format #t "with-output-to-string null string?"))

(let ((str (with-output-to-string
	     (lambda ()
	       (with-input-from-string "hiho123"
		 (lambda ()
		   (do ((c (read-char) (read-char)))
		       ((eof-object? c))
		     (display c))))))))
  (if (not (string=? str "hiho123"))
      (format #t "with string ports 0: ~S?~%" str)))

(let ((p1 (open-input-string "123"))
      (p2 (open-input-string "123")))
  (test (morally-equal? p1 p2) #t)
  (read-char p1)
  (test (morally-equal? p1 p2) #f)
  (read-char p2)
  (test (morally-equal? p1 p2) #t)
  (close-input-port p1)
  (close-input-port p2))

(let ((p1 (open-input-string "1234"))
      (p2 (open-input-string "123")))
  (test (morally-equal? p1 p2) #f)
  (read-char p1)
  (test (morally-equal? p1 p2) #f)
  (close-input-port p1)
  (close-input-port p2))

(let ((p1 (open-output-string))
      (p2 (open-output-string)))
  (test (morally-equal? p1 p2) #t)
  (write-char #\a p1)
  (test (morally-equal? p1 p2) #f)
  (close-output-port p1)
  (close-output-port p2))

(let ()
  (define* (f1 (b 123)) (display b))
  (test (with-output-to-string f1) "123")
  (define (f2) (display "123"))
  (test (with-output-to-string f2) "123")
  (define (f3 . args) (display 123))
  (test (with-output-to-string f3) "123")
  (define-macro (m1) `(write 123))
  (test (with-output-to-string m1) "123")
  (define-macro (m2) (write 123))
  (test (with-output-to-string m2) "123")
  (define (f4 a b) (display 123))
  (test (with-output-to-string f4) 'error)
  (test (with-output-to-string s7-version) "")) ; the output is a string -- not written to stdout or whatever

(let ()
  (define* (f1 a (b 123)) (display b a))
  (test (call-with-output-string f1) "123")
  (define (f2 a) (display "123" a))
  (test (call-with-output-string f2) "123")
  (define (f3 . args) (display 123 (car args)))
  (test (call-with-output-string f3) "123")
  (define-macro (m1 p) `(write 123 ,p))
  (test (call-with-output-string m1) "123")
  (define-macro* (m2 (p #f)) (write 123 p))
  (test (call-with-output-string m2) "123")
  (define (f4 a b) (display 123 a))
  (test (call-with-output-string f4) 'error)
  (test (call-with-output-string s7-version) 'error))

(let ()
  (define* (f1 (a #f)) (read))
  (test (with-input-from-string "(+ 1 2 3)" f1) '(+ 1 2 3))
  (define* (f2 . args) (read))
  (test (with-input-from-string "(+ 1 2 3)" f2) '(+ 1 2 3))
  (define f3 read)
  (test (with-input-from-string "(+ 1 2 3)" f3) '(+ 1 2 3))
  (define (f4) (read))
  (test (with-input-from-string "(+ 1 2 3)" f4) '(+ 1 2 3))
  (define-macro (m1) `(read))
  (test (with-input-from-string "(+ 1 2 3)" m1) '(+ 1 2 3))
  (define-macro (m2) (read))
  (test (with-input-from-string "(+ 1 2 3)" m2) 6)
  (define (f5 a) (read a))
  (test (with-input-from-string "(+ 1 2 3)" f5) 'error)
  (test (with-input-from-string "(+ 1 2 3)" s7-version) (s7-version)))

(let ()
  (define* (f1 (a #f)) (read a))
  (test (call-with-input-string "(+ 1 2 3)" f1) '(+ 1 2 3))
  (define* (f2 . args) (read (car args)))
  (test (call-with-input-string "(+ 1 2 3)" f2) '(+ 1 2 3))
  (define f3 read)
  (test (call-with-input-string "(+ 1 2 3)" f3) '(+ 1 2 3))
  (define-macro (m1 p) `(read ,p))
  (test (call-with-input-string "(+ 1 2 3)" m1) '(+ 1 2 3))
  (define-macro* (m2 (p #f)) (read p))
  (test (call-with-input-string "(+ 1 2 3)" m2) 6)
  (define (f4) (read))
  (test (call-with-input-string "(+ 1 2 3)" f4) 'error)
  (test (call-with-input-string "(+ 1 2 3)" s7-version) 'error))


(let ()
  (with-output-to-file tmp-output-file
    (lambda ()
      (display "(+ 1 2 3)")))
  (define* (f1 (a #f)) (read))
  (test (with-input-from-file tmp-output-file f1) '(+ 1 2 3))
  (define* (f2 . args) (read))
  (test (with-input-from-file tmp-output-file f2) '(+ 1 2 3))
  (define f3 read)
  (test (with-input-from-file tmp-output-file f3) '(+ 1 2 3))
  (define (f4) (read))
  (test (with-input-from-file tmp-output-file f4) '(+ 1 2 3))
  (define-macro (m1) `(read))
  (test (with-input-from-file tmp-output-file m1) '(+ 1 2 3))
  (define-macro (m2) (read))
  (test (with-input-from-file tmp-output-file m2) 6)
  (define (f5 a) (read a))
  (test (with-input-from-file tmp-output-file f5) 'error)
  (test (with-input-from-file tmp-output-file s7-version) (s7-version)))

(let ()
  (define (eval-from-string-1 str)
    (define-macro (m) (read))
    (with-input-from-string str m))
  (test (eval-from-string-1 "(+ 1 2 3)") 6)
  (define (eval-from-string str)
    (with-input-from-string str (define-macro (m) (read))))
  (test (eval-from-string "(+ 1 2 3)") 6))

(let ()
  (define* (f1 (a #f)) (read a))
  (test (call-with-input-file tmp-output-file f1) '(+ 1 2 3))
  (define* (f2 . args) (read (car args)))
  (test (call-with-input-file tmp-output-file f2) '(+ 1 2 3))
  (define f3 read)
  (test (call-with-input-file tmp-output-file f3) '(+ 1 2 3))
  (define-macro (m1 p) `(read ,p))
  (test (call-with-input-file tmp-output-file m1) '(+ 1 2 3))
  (define-macro* (m2 (p #f)) (read p))
  (test (call-with-input-file tmp-output-file m2) 6)
  (define (f4) (read))
  (test (call-with-input-file tmp-output-file f4) 'error)
  (test (call-with-input-file tmp-output-file s7-version) 'error))

(let ((ofile tmp-output-file))
  (define (get-file-contents)
    (with-input-from-file ofile read-line))

  (define* (f1 (b 123)) (display b))
  (test (let () (with-output-to-file ofile f1) (get-file-contents)) "123")
  (define (f2) (display "123"))
  (test (let () (with-output-to-file ofile f2) (get-file-contents)) "123")
  (define (f3 . args) (display 123))
  (test (let () (with-output-to-file ofile f3) (get-file-contents)) "123")
  (define-macro (m1) `(write 123))
  (test (let () (with-output-to-file ofile m1) (get-file-contents)) "123")
  (define-macro (m2) (write 123))
  (test (let () (with-output-to-file ofile m2) (get-file-contents)) "123")
  (define (f4 a b) (display 123))
  (test (let () (with-output-to-file ofile f4) (get-file-contents)) 'error)
  (test (let () (with-output-to-file ofile s7-version) (get-file-contents)) #<eof>)

  (define* (f11 a (b 123)) (display b a))
  (test (let () (call-with-output-file ofile f11) (get-file-contents)) "123")
  (define (f21 a) (display "123" a))
  (test (let () (call-with-output-file ofile f21) (get-file-contents)) "123")
  (define (f31 . args) (display 123 (car args)))
  (test (let () (call-with-output-file ofile f31) (get-file-contents)) "123")
  (define-macro (m3 p) `(write 123 ,p))
  (test (let () (call-with-output-file ofile m3) (get-file-contents)) "123")
  (define-bacro* (m2 (p 123)) `(write 123 ,p))
  (test (let () (call-with-output-file ofile m2) (get-file-contents)) "123")
  (define (f41 a b) (display 123 a))
  (test (let () (call-with-output-file ofile f41) (get-file-contents)) 'error)
  (test (let () (call-with-output-file ofile s7-version) (get-file-contents)) 'error))

(if (not (eof-object? (with-input-from-string "" (lambda () (read-char)))))
    (format #t ";input from null string not #<eof>?~%")
    (let ((EOF (with-input-from-string "" (lambda () (read-char)))))
      (if (not (eq? (with-input-from-string "" (lambda () (read-char)))
		    (with-input-from-string "" (lambda () (read-char)))))
	  (format #t "#<eof> is not eq? to itself?~%"))
      (if (char? EOF)
	  (do ((c 0 (+ c 1)))
	      ((= c 256))
	    (if (char=? EOF (integer->char c))
		(format #t "#<eof> is char=? to ~C~%" (integer->char c)))))))

(test (+ 100 (call-with-output-file "tmp.r5rs" (lambda (p) (write "1" p) (values 1 2)))) 103)
(test (+ 100 (with-output-to-file "tmp.r5rs" (lambda () (write "2") (values 1 2)))) 103)

(if (not pure-s7)
    (let ((str (with-output-to-string
		 (lambda ()
		   (with-input-from-string "hiho123"
		     (lambda ()
		       (do ((c (read-char) (read-char)))
			   ((or (not (char-ready?))
				(eof-object? c)))
			 (display c))))))))
      (if (not (string=? str "hiho123"))
	  (format #t "with string ports 1: ~S?~%" str))))

(let ((str (with-output-to-string
	     (lambda ()
	       (with-input-from-string ""
		 (lambda ()
		   (do ((c (read-char) (read-char)))
		       ((eof-object? c))
		     (display c))))))))
  (if (not (string=? str ""))
      (format #t "with string ports and null string: ~S?~%" str)))

(let ((str (with-output-to-string ; this is from the guile-user mailing list, I think -- don't know who wrote it
	     (lambda ()
	       (with-input-from-string "A2B5E3426FG0ZYW3210PQ89R."
		 (lambda ()
		   (call/cc
		    (lambda (hlt)
		      (define (nextchar)
			(let ((c (read-char)))
			  (if (and (char? c) 
				   (char=? c #\space))
			      (nextchar) 
			      c)))
		      
		      (define inx
			(lambda()
			  (let in1 ()
			    (let ((c (nextchar)))
			      (if (char-numeric? c)
				  (let ((r (nextchar)))
				    (let out*n ((n (- (char->integer c) (char->integer #\0))))
				      (out r)
				      (if (not (zero? n))
					  (out*n (- n 1)))))
				  (out c))
			      (in1)))))
		      
		      (define (move-char c)
			(write-char c)
			(if (char=? c #\.)
			    (begin (hlt))))
		      
		      (define outx
			(lambda()
			  (let out1 ()
			    (let h1 ((n 16))
			      (move-char (in))
			      (move-char (in))
			      (move-char (in))
			      (if (= n 1)
				  (begin (out1))
				  (begin (write-char #\space) (h1 (- n 1))) )))))
		      
		      (define (in)
			(call/cc (lambda(return)
				   (set! outx return)
				   (inx))))
		      
		      (define (out c)
			(call/cc (lambda(return) 
				   (set! inx return)
				   (outx c))))
		      (outx)))))))))
  (if (not (string=? str "ABB BEE EEE E44 446 66F GZY W22 220 0PQ 999 999 999 R."))
      (format #t "call/cc with-input-from-string str: ~A~%" str)))

(let ((badfile tmp-output-file))
  (let ((p (open-output-file badfile)))
    (close-output-port p))
  (load badfile))

(for-each
 (lambda (str)
   ;;(test (eval-string str) 'error)
   ;; eval-string is confused somehow
   (test (with-input-from-string str read) 'error))
 (list "\"\\x" "\"\\x0" "`(+ ," "`(+ ,@" "#2d("))

(let ((loadit tmp-output-file))
  (let ((p1 (open-output-file loadit)))
    (display "(define s7test-var 314) (define (s7test-func) 314) (define-macro (s7test-mac a) `(+ ,a 2))" p1)
    (newline p1)
    (close-output-port p1)
    (load loadit)
    (test (= s7test-var 314) #t)
    (test (s7test-func) 314)
    (test (s7test-mac 1) 3)
    (let ((p2 (open-output-file loadit))) ; hopefully this starts a new file
      (display "(define s7test-var 3) (define (s7test-func) 3) (define-macro (s7test-mac a) `(+ ,a 1))" p2)
      (newline p2)
      (close-output-port p2)
      (load loadit)
      (test (= s7test-var 3) #t)
      (test (s7test-func) 3)
      (test (s7test-mac 1) 2)
      (test (morally-equal? p1 p2) #t))))

(test (+ 100 (with-input-from-string "123" (lambda () (values (read) 1)))) 224)

(for-each
 (lambda (op)
   (for-each
    (lambda (arg) ;(format #t ";(~A ~A)~%" op arg)
      (test (op arg) 'error))
    (list (integer->char 65) 1 0 -1 (list 1) (cons 1 2) 'a-symbol (make-vector 3) abs lambda with-let
	  _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
	  3.14 3/4 1.0+1.0i #\f #t :hi (if #f #f) (lambda (a) (+ a 1)))))
 (list char-ready? set-current-output-port set-current-input-port set-current-error-port
       close-input-port close-output-port open-input-file open-output-file
       read-char peek-char read 
       (lambda (arg) (write-char #\a arg))
       (lambda (arg) (write "hi" arg))
       (lambda (arg) (display "hi" arg))
       call-with-input-file with-input-from-file call-with-output-file with-output-to-file))

(unless pure-s7 (test (char-ready? (open-input-string "")) #t)) ; humph
(with-output-to-file tmp-output-file
  (lambda ()
    (display "this is a test")
    (newline)))
    
(test (call-with-input-file tmp-output-file (lambda (p) (integer->char (read-byte p)))) #\t)
(test (with-input-from-string "123" (lambda () (read-byte))) 49)
;(test (with-input-from-string "1/0" read) 'error) ; this is a reader error in CL
;;; this test causes trouble when s7test is called from snd-test -- I can't see why

(let ((bytes (vector #o000 #o000 #o000 #o034 #o000 #o001 #o215 #o030 #o000 #o000 #o000 #o022 #o000 
		     #o000 #o126 #o042 #o000 #o000 #o000 #o001 #o000 #o000 #o000 #o000 #o000 #o001)))
  (with-output-to-file tmp-output-file
    (lambda ()
      (for-each
       (lambda (b)
	 (write-byte b))
       bytes)))
  
  (let ((ctr 0))
    (call-with-input-file tmp-output-file
      (lambda (p)	
	(if (not (string=? (port-filename p) tmp-output-file)) (display (port-filename p)))	
	(let loop ((val (read-byte p)))
	  (if (eof-object? val)
	      (if (not (= ctr 26))
		  (format #t "read-byte done at ~A~%" ctr))
	      (begin
		(if (not (= (bytes ctr) val))
		    (format #t "read-byte bytes[~D]: ~A ~A~%" ctr (bytes ctr) val))
		(set! ctr (+ 1 ctr))
		(loop (read-byte p))))))))
  
  (let ((ctr 0))
    (call-with-input-file tmp-output-file
      (lambda (p)
	(let loop ((val (read-char p)))
	  (if (eof-object? val)
	      (if (not (= ctr 26))
		  (format #t "read-char done at ~A~%" ctr))
	      (begin
		(if (not (= (bytes ctr) (char->integer val)))
		    (format #t "read-char bytes[~D]: ~A ~A~%" ctr (bytes ctr) (char->integer val)))
		(set! ctr (+ 1 ctr))
		(loop (read-char p))))))))
  )

(with-output-to-file tmp-output-file
  (lambda ()
    (if (not (string=? (port-filename (current-output-port)) tmp-output-file)) (display (port-filename (current-output-port))))
    (display "(+ 1 2) 32")
    (newline)
    (display "#\\a  -1")))

(with-input-from-file tmp-output-file
  (lambda ()
    (if (not (string=? (port-filename (current-input-port)) tmp-output-file)) (display (port-filename (current-input-port))))
    (let ((val (read)))
      (if (not (equal? val (list '+ 1 2)))
	  (format #t ";file read +: ~A~%" val)))
    (let ((val (read)))
      (if (not (equal? val 32))
	  (format #t "file read 32: ~A~%" val)))
    (let ((val (read)))
      (if (not (equal? val #\a))
	  (format #t "file read a: ~A~%" val)))
    (let ((val (read)))
      (if (not (equal? val -1))
	  (format #t "file read -1: ~A~%" val)))
    (let ((val (read)))
      (if (not (eof-object? val))
	  (format #t "file read #<eof>: ~A~%" val)))
    (let ((val (read)))
      (if (not (eof-object? val))
	  (format #t "file read #<eof> again: ~A~%" val)))))

(let ()
  (call-with-input-string "012"
    (lambda (p)
      (do ((i 0 (+ i 1)))
	  ((= i 4))
	(let ((c (peek-char p)))
	  (let ((r (read-char p)))
	    (if (not (equal? c r))
		(format #t ";peek-char: ~A ~A~%" c r))))))))
	  
(let ((port #f))
  (call-with-exit
   (lambda (go)
     (call-with-input-string "0123456789"
       (lambda (p)
	 (set! port p)
	 (if (not (char=? (peek-char p) #\0))
	     (format #t ";peek-char input-string: ~A~%" (peek-char p)))
	 (go)))))
  (if (not (input-port? port))
      (format #t ";c/e-> c/is -> port? ~A~%" port)
      (if (not (port-closed? port))
	  (begin
	    (format #t ";c/e -> c/is -> closed? ~A~%" port)
	    (close-input-port port)))))

(call-with-output-file tmp-output-file (lambda (p) (display "0123456789" p)))

(let ((port #f))
  (call-with-exit
   (lambda (go)
     (call-with-input-file tmp-output-file
       (lambda (p)
	 (set! port p)
	 (if (not (char=? (peek-char p) #\0))
	     (format #t ";peek-char input-file: ~A~%" (peek-char p)))
	 (go)))))
  (if (not (input-port? port))
      (format #t ";c/e -> c/if -> port? ~A~%" port)
      (if (not (port-closed? port))
	  (begin
	    (format #t ";c/e -> c/if -> closed? ~A~%" port)
	    (close-input-port port)))))

(let ((port #f))
  (call-with-exit
   (lambda (go)
     (dynamic-wind
	 (lambda () #f)
	 (lambda ()
	   (call-with-input-string "0123456789"
             (lambda (p)
	       (set! port p)
	       (if (not (char=? (peek-char p) #\0))
		   (format #t ";peek-char input-string 1: ~A~%" (peek-char p)))
	       (go))))
	 (lambda ()
	   (close-input-port port)))))
  (if (not (input-port? port))
      (format #t ";c/e -> dw -> c/is -> port? ~A~%" port)
      (if (not (port-closed? port))
	  (begin
	    (format #t ";c/e -> dw -> c/is -> closed? ~A~%" port)
	    (close-input-port port)))))

(let ((port #f))
  (call-with-exit
   (lambda (go)
     (dynamic-wind
	 (lambda () #f)
	 (lambda ()
	   (call-with-input-file tmp-output-file
            (lambda (p)
	      (set! port p)
	      (if (not (char=? (peek-char p) #\0))
		  (format #t ";peek-char input-file: ~A~%" (peek-char p)))
	      (go))))
	 (lambda ()
	   (close-input-port port)))))
  (if (not (input-port? port))
      (format #t ";c/e -> dw -> c/if -> port? ~A~%" port)
      (if (not (port-closed? port))
	  (begin
	    (format #t ";c/e -> dw -> c/if -> closed? ~A~%" port)
	    (close-input-port port)))))

(let ((port #f))
  (catch #t
    (lambda ()
     (call-with-input-string "0123456789"
       (lambda (p)
	 (set! port p)
	 (if (not (char=? (peek-char p) #\0))
	     (format #t ";peek-char input-string: ~A~%" (peek-char p)))
	 (error 'oops))))
    (lambda args #f))
  (if (not (input-port? port))
      (format #t ";catch -> c/is -> error -> port? ~A~%" port)
      (if (not (port-closed? port))
	  (begin
	    (format #t ";catch -> c/is -> error -> closed? ~A~%" port)
	    (close-input-port port)))))

(let ((port #f))
  (catch #t
    (lambda ()
     (call-with-input-file tmp-output-file
       (lambda (p)
	 (set! port p)
	 (if (not (char=? (peek-char p) #\0))
	     (format #t ";peek-char input-file: ~A~%" (peek-char p)))
	 (error 'oops))))
    (lambda args #f))
  (if (not (input-port? port))
      (format #t ";catch -> c/if -> error -> port? ~A~%" port)
      (if (not (port-closed? port))
	  (begin
	    (format #t ";catch -> c/if -> error -> closed? ~A~%" port)
	    (close-input-port port)))))

(test (with-output-to-string (lambda () (write (string (integer->char 4) (integer->char 8) (integer->char 20) (integer->char 30))))) "\"\\x04;\\b\\x14;\\x1e;\"")
(test (string-length "\x04;\x08;\x14;\x1e;") 4)
(test (char->integer (string-ref "\x0;" 0)) 0)
(test (char->integer (string-ref "\x0e;" 0)) 14)
(test (char->integer (string-ref "\x1e;" 0)) 30)
(test (char->integer (string-ref "\xff;" 0)) 255)
(test (string=? "\x61;\x42;\x63;" "aBc") #t)
(test (string=? "\"\\x01;\\x02;\\x03;\\x04;\\x05;\\x06;\\x07;\\x08;\\x09;x\\x0b;\\x0c;\\x0d;\\x0e;\\x0f;\\x10;\\x11;\\x12;\\x13;\\x14;\\x15;\\x16;\\x17;\\x18;\\x19;\\x1a;\\x1b;\\x1c;\\x1d;\\x1e;\\x1f; !\\\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\\x7f;\\x80;\\x81;\\x82;\\x83;\\x84;\\x85;\\x86;\\x87;\\x88;\\x89;\\x8a;\\x8b;\\x8c;\\x8d;\\x8e;\\x8f;\\x90;\\x91;\\x92;\\x93;\\x94;\\x95;\\x96;\\x97;\\x98;\\x99;\\x9a;\\x9b;\\x9c;\\x9d;\\x9e;\\x9f;\\xa0¡¢£¤¥¦§¨©ª«¬\\xad®¯°±²³´µ¶·¸¹º»¼½¾¿Ã\x80;Ã\x81;Ã\x82;Ã\x83;Ã\x84;Ã\x85;Ã\x86;Ã\x87;Ã\x88;Ã\x89;Ã\x8a;Ã\x8b;Ã\x8c;Ã\x8d;Ã\x8e;Ã\x8f;Ã\x90;Ã\x91;Ã\x92;Ã\x93;Ã\x94;Ã\x95;Ã\x96;Ã\x97;Ã\x98;Ã\x99;Ã\x9a;Ã\x9b;Ã\x9c;Ã\x9d;Ã\x9e;Ã\x9f;àáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ\""
		"\"\\x01;\\x02;\\x03;\\x04;\\x05;\\x06;\\x07;\\x08;\\x09;x\\x0b;\\x0c;\\x0d;\\x0e;\\x0f;\\x10;\\x11;\\x12;\\x13;\\x14;\\x15;\\x16;\\x17;\\x18;\\x19;\\x1a;\\x1b;\\x1c;\\x1d;\\x1e;\\x1f; !\\\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\\x7f;\\x80;\\x81;\\x82;\\x83;\\x84;\\x85;\\x86;\\x87;\\x88;\\x89;\\x8a;\\x8b;\\x8c;\\x8d;\\x8e;\\x8f;\\x90;\\x91;\\x92;\\x93;\\x94;\\x95;\\x96;\\x97;\\x98;\\x99;\\x9a;\\x9b;\\x9c;\\x9d;\\x9e;\\x9f;\\xa0¡¢£¤¥¦§¨©ª«¬\\xad®¯°±²³´µ¶·¸¹º»¼½¾¿Ã\x80;Ã\x81;Ã\x82;Ã\x83;Ã\x84;Ã\x85;Ã\x86;Ã\x87;Ã\x88;Ã\x89;Ã\x8a;Ã\x8b;Ã\x8c;Ã\x8d;Ã\x8e;Ã\x8f;Ã\x90;Ã\x91;Ã\x92;Ã\x93;Ã\x94;Ã\x95;Ã\x96;Ã\x97;Ã\x98;Ã\x99;Ã\x9a;Ã\x9b;Ã\x9c;Ã\x9d;Ã\x9e;Ã\x9f;àáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ\"") #t)

(when (provided? 'system-extras)
  ;; directory?
  (test (directory? tmp-output-file) #f)
  (test (directory? ".") #t)
  (test (directory?) 'error)
  (test (directory? "." 0) 'error)
  (for-each
   (lambda (arg)
     (test (directory? arg) 'error))
   (list -1 #\a 1 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
	 3.14 3/4 1.0+1.0i #f #t :hi (if #f #f) (lambda (a) (+ a 1))))
  
  ;; file-exists?
  (test (file-exists? tmp-output-file) #t)
  (test (file-exists? "not-a-file-I-hope") #f)
  (test (file-exists?) 'error)
  (test (file-exists? tmp-output-file 0) 'error)
  (for-each
   (lambda (arg)
     (test (file-exists? arg) 'error))
   (list -1 #\a 1 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
	 3.14 3/4 1.0+1.0i #f #t :hi (if #f #f) (lambda (a) (+ a 1))))
  
  ;; delete-file
  (test (delete-file tmp-output-file) 0)
  (test (file-exists? tmp-output-file) #f)
  (test (delete-file "not-a-file-I-hope") -1)
  (test (delete-file) 'error)
  (test (delete-file tmp-output-file 0) 'error)
  (for-each
   (lambda (arg)
     (test (delete-file arg) 'error))
   (list -1 #\a 1 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
	 3.14 3/4 1.0+1.0i #f #t :hi (if #f #f) (lambda (a) (+ a 1))))
  
  ;; getenv
  (test (pair? (member (getenv "HOME") '("/usr/home/bil" "/Users/bil" "/home/bil") string=?)) #t)
  (test (getenv "NO-ENV") "")
  (test (getenv) 'error)
  (test (getenv "HOME" #t) 'error)
  (for-each
   (lambda (arg)
     (test (getenv arg) 'error))
   (list -1 #\a 1 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
	 3.14 3/4 1.0+1.0i #f #t :hi (if #f #f) (lambda (a) (+ a 1))))
  
  ;; directory->list
  (test (directory->list) 'error)
  (test (directory->list "." 0) 'error)
  (for-each
   (lambda (arg)
     (test (directory->list arg) 'error))
   (list -1 #\a 1 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
	 3.14 3/4 1.0+1.0i #f #t :hi (if #f #f) (lambda (a) (+ a 1))))
  
  ;; system
  (test (system "test -f s7test.scm") 0)
  (test (system) 'error)
  (test (let ((str (system "man fgrep" #t)))
	  (and (string? str)
	       (> (length str) 10000))) ; osx: 14479, linux: 40761
	#t)
  (for-each
   (lambda (arg)
     (test (system arg) 'error))
   (list -1 #\a 1 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
	 3.14 3/4 1.0+1.0i #f #t :hi (if #f #f) (lambda (a) (+ a 1)))))
        
(let ()
  (define (args2)
    (with-output-to-file tmp-data-file
      (lambda ()
	(write-byte 1)
	(write-byte 2)
	(write-byte 1)
	(write-byte 2)))
    
    (let ((v (with-input-from-file tmp-data-file
	       (lambda ()
		 (vector (+ (read-byte) (ash (read-byte) 8))
			 (+ 1 (ash 2 8))
			 (+ (ash (read-byte) 8) (read-byte))
			 (+ (ash 1 8) 2))))))
      (if (not (equal? v #(513 513 258 258)))
	  (format *stderr* ";2 arg order check: ~A~%" v))))
  
  
  (args2)
  
  (define (args3)
    (with-output-to-file tmp-data-file
      (lambda ()
	(do ((i 0 (+ i 1)))
	    ((= i 8))
	  (write-byte 1)
	  (write-byte 2)
	  (write-byte 3))))
    
    (let ((v (with-input-from-file tmp-data-file
	       (lambda ()
		 (vector (+ (read-byte) (ash (read-byte) 8) (ash (read-byte) 16))
			 (+ 1 (ash 2 8) (ash 3 16))
			 (+ (read-byte) (read-byte) (ash (read-byte) 8))
			 (+ 1 2 (ash 3 8))
			 (+ (read-byte) (ash (read-byte) 8) (read-byte))
			 (+ 1 (ash 2 8) 3)
			 (+ (ash (read-byte) 8) (read-byte) (read-byte))
			 (+ (ash 1 8) 2 3)
			 (+ (ash (read-byte) 8) (ash (read-byte) 16) (read-byte))
			 (+ (ash 1 8) (ash 2 16) 3)
			 (+ (ash (read-byte) 8) (read-byte) (ash (read-byte) 16))
			 (+ (ash 1 8) 2 (ash 3 16)))))))
      (if (not (equal? v #(197121 197121 771 771 516 516 261 261 131331 131331 196866 196866)))
	  (format *stderr* ";3 arg order check: ~A~%" v))))
  
  (args3))

(if (not pure-s7)
    (for-each
     (lambda (arg)
       (test (char-ready? arg) 'error))
     (list "hi" -1 #\a 1 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
	   3.14 3/4 1.0+1.0i #f #t :hi (if #f #f) (lambda (a) (+ a 1)))))

;;; newline
(test (newline 0) 'error)
(test (newline *stdout* 0) 'error)
(test (newline #f) #\newline)
(test (with-output-to-string (lambda () (newline))) "\n")
(test (with-output-to-string (lambda () (newline #f))) "")
(test (call-with-output-string (lambda (p) (newline p))) "\n")
(test (newline *stdin*) 'error)

(test (display 0 0) 'error)
(test (write 0 0) 'error)
(test (write-char 0 0) 'error)
(test (write-string 0 0) 'error)
(test (write-line 0 0) 'error)
(test (read-char 0) 'error)
(test (read 0) 'error)
(test (read-string 1 0) 'error)
(test (read-line 0) 'error)


;;; -------- format --------
;;; format

(test (format #f "hiho") "hiho")
(test (format #f "") "")
(test (format #f "" 1) 'error)
(test (format #f "a") "a")
;(test (format #f "a\x00;b") "a")

(test (format #f "~~") "~") ; guile returns this, but clisp thinks it's an error
(test (format #f "~~~~") "~~")
(test (format #f "a~~") "a~")
(test (format #f "~~a") "~a")
(test (format #f "~A" "") "")
(test (format #f "~{~^~A~}" ()) "")
(test (format #f "~{~^~{~^~A~}~}" '(())) "")
(test (format #f "~P" 1) "")
(test (format #f "~P" #\a) 'error)
(test (format #f "~0T") "")
(test (format #f "") "")
(test (format #f "~*~*" 1 2) "")
(test (format #f "~20,'~D" 3) "~~~~~~~~~~~~~~~~~~~3")
(test (format #f "~0D" 123) "123")
(test (format #f "~{~S~}" ()) "")
(test (format #f "~-1D" 123) 'error)
(test (format #f "~+1D" 123) 'error)
(test (format #f "~1.D" 123) 'error)
(test (format #f "~1+iD" 123) 'error)
(test (format #f "~1/2D" 123) 'error)
(test (format #f "~1/1D" 123) 'error)
(test (format #f "~20,'-1D" 123) 'error)

(for-each 
 (lambda (arg)
   (test (format arg "~D" 1) 'error))
 (list "hi" #\a 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand :hi (if #f #f) (lambda (a) (+ a 1))))

(for-each
 (lambda (directive)
   (for-each 
    (lambda (arg)
      (test (format #f directive arg) 'error)
      (test (format #f directive) 'error))
    (list "hi" #\a 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand
	  #f #t :hi (if #f #f) (lambda (a) (+ a 1)))))
 (list "~D" "~F" "~G" "~X" "~B" "~O" "~E" "~P"))

(test (format #f "~,1" 123) 'error)
;format "~,1" 123: numeric argument, but no directive!
;    (format #f "~,1" 123)

(test (format #f "~,123456789123456789123456789d" 1) 'error)
;format "~,123456789123456789123456789d" 1: numeric argument too large
;    (format #t "~,123456789123456789123456789d" 1)
(test (format #f "~969424987x" 12) 'error)

(test (format #f "~D" 1 2) 'error)
;format: "~D" 1 2
;           ^: too many arguments
;    (format #f "~D" 1 2)

(test (format #f "~D~" 1) 'error)
;format: "~D~" 1
;           ^: control string ends in tilde
;    (format #f "~D~" 1)
(test (format #f "~") 'error)
(test (format #f " ~") 'error)
(test (format #f "~~~") 'error)
(test (format #f " ~~~") 'error)

(test (format #f "~@D" 1) 'error)
;format "~@D" 1: unknown '@' directive
;    (format #f "~@D" 1)

(test (format #f "~@p" #\a) 'error)
;format "~@p" #\a: '@P' directive argument is not an integer
;    (format #f "~@p" #\a)

(test (format #f "~P" 1+i) 'error)
;format "~P" 1+1i: 'P' directive argument is not a real number
;    (format #f "~P" 1+1i)

(test (format #f "~P" (real-part (log 0))) "s")

(test (format #f "~@p" 0+i) 'error)
;format "~@p" 0+1i: '@P' directive argument is not a real number
;    (format #f "~@p" 0+1i)

(test (format #f "~{~}") 'error)
;format "~{~}": missing argument
;    (format #f "~{~}")

(test (format #f "~{~a" '(1 2 3)) 'error)
;format "~{~a" (1 2 3): '{' directive, but no matching '}'
;    (format #f "~{~a" '(1 2 3))

(test (format #f "~{~a~}" '(1 . 2)) 'error)
;format "~{~a~}" (1 . 2): '{' directive argument should be a proper list or something we can turn into a list
;    (format #f "~{~a~}" '(1 . 2))

(test (let ((lst (cons 1 2))) (set-cdr! lst lst) (format #f "~{~A~}" lst)) 'error)
;format "~{~A~}" #1=(1 . #1#): '{' directive argument should be a proper list or something we can turn into a list
;    (format #f "~{~A~}" lst)

(test (format #f "~{~a~}" 'asdf) 'error)
;format "~{~a~}" asdf: '{' directive argument should be a proper list or something we can turn into a list
;    (format #f "~{~a~}" 'asdf)

(test (format #f "~{~a~}" ()) "")
(test (format #f "~{asd~}" '(1 2 3)) 'error)
;format: "~{asd~}" (1 2 3)
;             ^: '{...}' doesn't consume any arguments!
;    (format #f "~{asd~}" '(1 2 3))

(test (format #f "~}" '(1 2 3)) 'error)
;format "~}" (1 2 3): unmatched '}'
;    (format #f "~}" '(1 2 3))

(test (format #f "~C") 'error)
;format "~C": ~C: missing argument
;    (format #f "~C")

(test (format #f "~A ~C" #\a) 'error)
;format: "~A ~C" #\a
;            ^: ~C: missing argument
;    (format #f "~A ~C" #\a)

(test (format #f "~C" 1) 'error)
;format "~C" 1: 'C' directive requires a character argument
;    (format #f "~C" 1)

(test (format #f "~C" #<eof>) 'error)
;format "~C" #<eof>: 'C' directive requires a character argument
;    (format #f "~C" #<eof>)

(test (format #f "~1,9223372036854775807f" 1) 'error)
;format "~1,9223372036854775807f" 1: numeric argument too large
;    (format #f "~1,9223372036854775807f" 1)

(test (format #f "~1,2A" 1) 'error)
;format "~1,2A" 1: extra numeric argument
;    (format #f "~1,2A" 1)

(test (format #f "~F" #\a) 'error)
;format "~F" #\a: ~F: numeric argument required
;    (format #f "~F" #\a)

(test (format #f "~1,") 'error)
;format "~1,": format directive does not take a numeric argument
;    (format #f "~1,")

(test (format #f "~-1,") 'error)
;format "~-1,": unimplemented format directive
;    (format #f "~-1,")

(test (format #f "~L" 1) 'error)
;format "~L" 1: unimplemented format directive
;    (format #f "~L" 1)

(test (format #f "~*") 'error)
;format "~*": can't skip argument!

(test (format #f "~*~A") 'error)
(test (format #f "~*~*" 1) 'error)
(test (format #f "~N") 'error)
(test (format #f "~N" 2) 'error)
(test (format #f "~N." 2) 'error)
(test (format #f "~NT" 2.1) 'error)
(test (format #f "~NT" #\a) 'error)
(test (format #f "~N," 1) 'error)
(test (format #f "~N,N" 1 2) 'error)
(test (format #f "~N,N." 1 2) 'error)
(test (format #f "~,N" 1) 'error)
(test (format #f "~,N." 1) 'error)
(test (format #f "~ND" 123456789) 'error)
(test (format #f "~ND" -1) 'error)

(for-each
 (lambda (c)
   (test (apply format #f (string-append "~" (string c)) '(a)) 'error))
 (list #\H #\I #\J #\K #\L #\M #\Q #\R #\U #\V #\Y #\Z 
       #\[ #\\ #\] #\_ #\` #\$ #\# #\! #\" #\' #\( #\) #\+ #\, #\- #\. #\/ #\< #\= #\> #\?
       #\h #\i #\j #\k #\l #\m #\q #\r #\u #\v #\y #\z))

(test (format #f "~A" 1 2) 'error)
;format: "~A" 1 2
;           ^: too many arguments
;    (format #f "~A" 1 2)

(test (format #f "hiho~%ha") (string-append "hiho" (string #\newline) "ha"))
(test (format #f "~%") (string #\newline))
(test (format #f "~%ha") (string-append (string #\newline) "ha"))
(test (format #f "hiho~%") (string-append "hiho" (string #\newline)))

(test (eq? #\tab ((format #f "\t") 0)) #t)
(test (eq? #\newline ((format #f "\n") 0)) #t)
(test (eq? #\\ ((format #f "\\") 0)) #t)
(test (eq? #\" ((format #f "\"") 0)) #t)

(for-each
 (lambda (arg res)
   (let ((val (catch #t (lambda () (format #f "~A" arg)) (lambda args 'error))))
     (if (or (not (string? val))
	     (not (string=? val res)))
	 (begin (display "(format #f \"~A\" ") (display arg) 
		(display " returned \"") (display val) 
		(display "\" but expected \"") (display res) (display "\"") 
		(newline)))))
 (list "hiho"  -1  #\a  1   #f   #t  #(1 2 3)   3.14   3/4  1.5+1.5i ()  #(())  (list 1 2 3) '(1 . 2) 'hi)
 (list "hiho" "-1" "a" "1" "#f" "#t" "#(1 2 3)" "3.14" "3/4" "1.5+1.5i"   "()" "#(())" "(1 2 3)"    "(1 . 2)" "hi"))

(test (format #f "hi ~A ho" 1) "hi 1 ho")
(test (format #f "hi ~a ho" 1) "hi 1 ho")
(test (format #f "~a~A~a" 1 2 3) "123")
(test (format #f "~a~~~a" 1 3) "1~3")
(test (format #f "~a~%~a" 1 3) (string-append "1" (string #\newline) "3"))

(for-each
 (lambda (arg res)
   (let ((val (catch #t (lambda () (format #f "~S" arg)) (lambda args 'error))))
     (if (or (not (string? val))
	     (not (string=? val res)))
	 (begin (display "(format #f \"~S\" ") (display arg) 
		(display " returned \"") (display val) 
		(display "\" but expected \"") (display res) (display "\"") 
		(newline)))))
 (list "hiho"  -1  #\a  1   #f   #t  #(1 2 3)   3.14   3/4  1.5+1.5i ()  #(())  (list 1 2 3) '(1 . 2) 'hi)
 (list "\"hiho\"" "-1" "#\\a" "1" "#f" "#t" "#(1 2 3)" "3.14" "3/4" "1.5+1.5i"   "()" "#(())" "(1 2 3)"    "(1 . 2)" "hi"))

(test (format #f "hi ~S ho" 1) "hi 1 ho")
(test (format #f "hi ~S ho" "abc") "hi \"abc\" ho")
(test (format #f "~s~a" #\a #\b) "#\\ab")
(test (format #f "~C~c~C" #\a #\b #\c) "abc")
;(test (format #f "1 2~C 3 4" #\null) "1 2") ; ?? everyone does something different here
;; s7 used to return "1 2 3 4" because it treated ~C as a string (empty in this case)
(test  (format #f "1 2~C 3 4" #\null) "1 2\x00; 3 4") 
(test (format #f "~nc" 3 #\a) "aaa")
(test (format #f "~nc" 0 #\a) "")
(test (format #f "~0c" #\a) "")
(test (format #f "~01c" #\a) "a")
(test (format #f "~002c" #\a) "aa")
(test (format #f "~nc" -1 #\a) 'error)
(test (format #f "~nc" most-positive-fixnum #\a) 'error)
(test (format #f "~nc" 1.0 #\a) 'error)
(test (format #f "~n~nc" 1 2 #\a) 'error)
(test (format #f "~na" 1 #\a) 'error)

(test (format #f "~{~A~}" '(1 2 3)) "123")
(test (format #f "asb~{~A ~}asb" '(1 2 3 4)) "asb1 2 3 4 asb")
(test (format #f "asb~{~A ~A.~}asb" '(1 2 3 4)) "asb1 2.3 4.asb")
(test (format #f ".~{~A~}." ()) "..")

(test (format #f "~{~A ~A ~}" '(1 "hi" 2 "ho")) "1 hi 2 ho ")
(test (format #f "~{.~{+~A+~}.~}" (list (list 1 2 3) (list 4 5 6))) ".+1++2++3+..+4++5++6+.")
(test (format #f "~{~s ~}" '(fred jerry jill)) "fred jerry jill ")
(test (format #f "~{~s~^ ~}" '(fred jerry jill)) "fred jerry jill")
(test (format #f "~{~s~^~^ ~}" '(fred jerry jill)) "fred jerry jill")
(test (format #f "~{.~{~A~}+~{~A~}~}" '((1 2) (3 4 5) (6 7 8) (9))) ".12+345.678+9")
(test (format #f "~{.~{+~{-~A~}~}~}" '(((1 2) (3 4 5)))) ".+-1-2+-3-4-5")
(test (format #f "~{.~{+~{-~A~}~}~}" '(((1 2) (3 4 5)) ((6) (7 8 9)))) ".+-1-2+-3-4-5.+-6+-7-8-9")

(test (format #f "~A ~* ~A" 1 2 3) "1  3")
(test (format #f "~*" 1) "")
(test (format #f "~{~* ~}" '(1 2 3)) "   ")
(test (format #f "~A" catch) "catch")
(test (format #f "this is a ~
             sentence") "this is a sentence")
(test (format #f "~{~C~}" "hi") "hi")
(test (format #f "~{~C~}" #(#\h #\i)) "hi")

(test (format #f "~{.~{~C+~}~}" '((#\h #\i) (#\h #\o))) ".h+i+.h+o+")
(test (format #f "~{.~{~C+~}~}" '("hi" "ho")) ".h+i+.h+o+")
(test (format #f "~{.~{~C+~}~}" #("hi" "ho")) ".h+i+.h+o+")
(test (format #f "~{.~{~C+~}~}" #(#(#\h #\i) #(#\h #\o))) ".h+i+.h+o+")

; (format #f "~{.~{~C~+~}~}" #2d((#\h #\i) (#\h #\o))) error?? -- this is documented...
(test (format #f "~{~A~}" #2D((1 2) (3 4))) "1234") ; this seems inconsistent with:
(test (format #f "~{~A~}" '((1 2) (3 4))) "(1 2)(3 4)")
(test (format #f "~{~A ~}" #2d((1 2) (3 4))) "1 2 3 4 ")
(test (format #f "1~\
a2" 3) "132")
(test (format #f "1~
                 ~a2" 3) "132")

(test (format #f "~{~{~C~^ ~}~^...~}" (list "hiho" "test")) "h i h o...t e s t")

;; ~nT handling is a mess -- what are the defaults?  which is column 1? do we space up to or up to and including?

(test (format #f "~A:~8T~A" 100 'a)   "100:   a")
(test (format #f "~A:~nT~A" 100 8 'a)   "100:   a")
(test (format #f "~A:~8T~A" 0 'a)     "0:     a")
(test (format #f "~A:~8T~A" 10000 'a) "10000: a")
(test (format #f "~8T~A" 'a)      "       a")
(test (format #f "1212:~8T~A" 'a) "1212:  a")
(test (format #f "~D:~8T~A" 100 'a)   "100:   a")
(test (format #f "~D:~8T~A" 0 'a)     "0:     a")
(test (format #f "~D:~8T~A" 10000 'a) "10000: a")
(test (format #f "~a~10,7Tb" 1)     "1               b")
(test (format #f "~a~10,7Tb" 10000) "10000           b")
(test (format #f "~a~10,12Tb" 1)     "1                    b")
(test (format #f "~a~10,12Tb" 10000) "10000                b")
(test (format #f "~a~n,nTb" 10000 10 12) "10000                b")
(test (format #f "~n,'xT" 8) "xxxxxxx")
(test (format #f "~n,' T" 8) "       ")

(test (length (format #f "~{~A~}~40T." '(1 2 3))) 40)
(test (length (format #f "~{~A ~}~40T." '(1 2 3))) 40)
(test (length (format #f "~{~,3F ~}~40T." '(1.0 2.0 3.0))) 40)
(test (length (format #f "~S~40T." pi)) (if with-bignums 44 40))

(test (format #f "asdh~20Thiho") "asdh               hiho")
(test (format #f "asdh~2Thiho") "asdhhiho")
(test (format #f "a~Tb") "ab")
(test (format #f "0123456~4,8Tb") "0123456    b")
(test (format #f "0123456~0,8Tb") "0123456b")
(test (format #f "0123456~10,8Tb") "0123456          b")
(test (format #f "0123456~1,0Tb") "0123456b")
(test (format #f "0123456~1,Tb") "0123456b")
(test (format #f "0123456~1,Tb") "0123456b")
(test (format #f "0123456~,Tb") "0123456b")
(test (format #f "0123456~7,10Tb") "0123456         b")
(test (format #f "0123456~8,10tb") "0123456          b")
(test (format #f "0123456~3,12tb") "0123456       b")
(test (format #f "~40TX") "                                       X")
(test (format #f "X~,8TX~,8TX") "X      X       X")
(test (format #f "X~8,TX~8,TX") "X      XX")
(test (format #f "X~8,10TX~8,10TX") "X                X         X")
(test (format #f "X~8,0TX~8,0TX") "X      XX")
(test (format #f "X~0,8TX~0,8TX") "X      X       X")
(test (format #f "X~1,8TX~1,8TX") "X       X       X")
(test (format #f "X~,8TX~,8TX") "X      X       X") ; ??
(test (format #f "X~TX~TX") "XXX") ; clisp and sbcl say "X X X" here and similar differences elsewhere -- is it colnum or colinc as default if no comma?
(test (format #f "X~2TX~4TX") "XX X")
(test (format #f "X~0,0TX~0,0TX") "XXX")
(test (format #f "X~0,TX~0,TX") "XXX")
(test (format #f "X~,0TX~,0TX") "XXX")

(test (format #f "~0D" 123) "123")
(test (format #f "~0F" 123.123) "123.123000")
(test (format #f "~,0D" 123) "123")
(test (format #f "~,0F" 123.123) "123.0")
(test (format #f "~,D" 123) "123")
(test (format #f "~,F" 123.123) "123.123000")
(test (format #f "~0,D" 123) "123")
(test (format #f "~0,F" 123.123) "123.123000")
(test (format #f "~0,0D" 123) "123")
(test (format #f "~n,nD" 0 0 123) "123")
(test (format #f "~0,0F" 123.123) "123.0")
(test (format #f "~0,0,D" 123) 'error)
(test (format #f "~n,n,D" 0 0 123) 'error)
(test (format #f "~0,0,F" 123.123) 'error)

(test (format #f "~,3F" 1+i) "1.000+1.000i")
(test (format #f "~,nF" 3 1+i) "1.000+1.000i")
(test (format #f "~,3G" 1+i) "1+1i")
(test (format #f "~,3E" 1+i) "1.000e+00+1.000e+00i")
(test (format #f "~,3F" 1-i) "1.000-1.000i")
(test (format #f "~,3G" 1-i) "1-1i")
(test (format #f "~,3E" 1-i) "1.000e+00-1.000e+00i")

;; not sure about these:
(test (format #f "~X" 1-i) "1.0-1.0i")
(test (format #f "~,3D" 1-i) "1.000e+00-1.000e+00i")
(test (format #f "~A" 1-i) "1-1i")

(test (format #f "~W" 3) "3")
(test (format #f "~W" 3/4) "3/4")
(test (format #f "~W" 3.4) "3.4")
(if with-bignums
    (test (format #f "~W" pi) "3.141592653589793238462643383279502884195E0")
    (test (format #f "~W" pi) "3.141592653589793"))
(test (format #f "~W" 3+4i) "3+4i")
(test (format #f "~W" 3-4i) "3-4i")
(unless with-bignums
  (let ((name (if pure-s7 'complex 'complex))
	(func (if pure-s7 complex complex)))
    (test (format #f "~W" (func 1/0 0)) "nan.0")
    (test (format #f "~W" (func 1/0 1)) (format #f "(~S nan.0 1)" name))
    (test (format #f "~W" (func inf.0 1/0)) (format #f "(~S inf.0 nan.0)" name))
    (test (format #f "~W" (log 0)) (format #f "(~S -inf.0 3.141592653589793)" name))))

;; see also object->string with :readable

(test (format #f "~000000000000000000000000000000000000000000003F" 123.123456789) "123.123457")
(test (format #f "~922337203685477580F" 123.123) 'error)   ; numeric argument too large
(test (format #f "~,922337203685477580F" 123.123) 'error)  
(test (format #f "~1,922337203685477580F" 123.123) 'error) 
(test (format #f "~1 ,2F" 123.456789) 'error)
(test (format #f "~1, 2F" 123.456789) 'error)
(test (format #f "~1, F" 123.456789) 'error)

(if with-bignums
    (begin
      (test (format #f "~o" 1e19) "1.053071060221172E21")
      (test (format #f "~o" -1e19) "-1.053071060221172E21")
      (test (format #f "~x" 1e19) "8.ac7230489e8@15")
      (test (format #f "~b" 1e19) "1.00010101100011100100011000001001000100111101E63")
      (test (format #f "~o" 1e308) "1.071474702753621177617256074117252375235444E341")
      (test (format #f "~o" -1e308) "-1.071474702753621177617256074117252375235444E341")
      (test (format #f "~x" 1e308) "8.e679c2f5e44ff8f570f09eaa7ea7648@255")
      (test (format #f "~x" 9.22e18) "7.ff405267d1a@15")
      (test (format #f "~b" 1e308) "1.0001110011001111001110000101111010111100100010011111111100011110101011100001111000010011110101010100111111010100111011001001E1023")
      (test (format #f "~,791o" 1e308) "1.071474702753621177617256074117252375235444E341")
      (test (format #f "~1200,2g" 1e308) "                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   9.999999999999999999999999999999999999982E307")
      (test (format #f "~o" 1e19-1e20i) "1.053071060221172E21-1.2657072742654304E22i")
      (test (format #f "~x" 1e308+1e300i) "8.e679c2f5e44ff8f570f09eaa7ea7648@255+1.7e43c8800759ba59c08e14c7cd7aad86@249i"))
    (begin
      (test (format #f "~o" 1e19) "1.053071e21")
      (test (format #f "~o" -1e19) "-1.053071e21")
      (test (format #f "~x" 1e19) "8.ac723e15")
      (test (format #f "~b" 1e19) "1.000101e63")
      (test (format #f "~o" 1e308) "1.071474e341")
      (test (format #f "~o" -1e308) "-1.071474e341")
      (test (format #f "~x" 1e308) "8.e679c2e255")
      (test (or (string=? (format #f "~x" 9.22e18) "7ff405267d1a0000.0")
		(string=? (format #f "~x" 9.22e18) "7.ff4052e15"))
	    #t) ; this depends on a cutoff point in s7.c, L8850, number_to_string_with_radix
      (test (format #f "~b" 1e308) "1.000111e1023")
      (test (format #f "~,791o" 1e308) "1.0714747027536212e341")
      (test (format #f "~1200,2g" 1e308) "                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          1e+308")
      (test (format #f "~o" 1e19-1e20i) "1.053071e21-1.265707e22i")
      (test (format #f "~x" 1e308+1e300i) "8.e679c2e255+1.7e43c8e249i")))

(test (= (length (substring (format #f "~%~10T.") 1)) (length (format #f "~10T."))) #t)
(test (= (length (substring (format #f "~%-~10T.~%") 1)) (length (format #f "-~10T.~%"))) #t)
(test (string=? (format #f "~%|0 1 2|~21T|5  8  3  2|~%~
                              |1 2 3| |0 1 2 3|~21T|8 14  8  6|~%~
                              |2 3 0| |1 2 3 0| = ~21T|3  8 13  6|~%~
                              |3 0 1| |2 3 0 1|~21T|2  6  6 10|~%")
		"
|0 1 2|             |5  8  3  2|
|1 2 3| |0 1 2 3|   |8 14  8  6|
|2 3 0| |1 2 3 0| = |3  8 13  6|
|3 0 1| |2 3 0 1|   |2  6  6 10|
") #t)


(if (not with-windows) (test (format #f "~S" '(+ 1/0 1/0)) "(+ nan.0 nan.0)")) ; !?
(if (not with-windows) (test (format #f "~S" '(+ '1/0 1/0)) "(+ 'nan.0 nan.0)")) ; !? 
(test (format #f "~S" '(+ 1/0 1.0/0.0)) (format #f "~S" (list '+ '1/0 '1.0/0.0)))
(test (format #f "~S" (quote (+ '1 1))) "(+ '1 1)")


(test (format #f "~12,''D" 1) "'''''''''''1")
(test (let ((str "~12,'xD")) (set! (str 5) #\space) (format #f str 1)) "           1")
(test (format #f "~12,' D" 1) "           1")
(test (format #f "~12,'\\D" 1) "\\\\\\\\\\\\\\\\\\\\\\1")
(test (format #f "~12,'\"D" 1) "\"\"\"\"\"\"\"\"\"\"\"1")
(test (format #f "~12,'~D" 1) "~~~~~~~~~~~1")
(test (format #f "~12,',d" 1) ",,,,,,,,,,,1")
(test (format #f "~12,',,d" 1) 'error)
(test (format #f "~12,,d" 1) 'error)
(test (format #f "~n,,d" 12 1) 'error)

(test (string=? (format #f "~%~&" ) (string #\newline)) #t)
(test (string=? (format #f "~%a~&" ) (string #\newline #\a #\newline)) #t)
(test (string=? (format #f "~%~%") (string #\newline #\newline)) #t)
(test (string=? (format #f "~10T~%~&~10T.") (format #f "~10T~&~&~10T.")) #t)
(test (string=? (format #f "~10T~&~10T.") (format #f "~10T~%~&~&~&~&~10T.")) #t)
(test (length (format #f "~%~&~%")) 2)
(test (length (format #f "~%~&~&~&~&~%")) 2)
(test (length (format #f "~&~%")) 1)

(test (format #f "~2,1F" 0.5) "0.5")
(test (format #f "~:2T") 'error)
(test (format #f "~2,1,3F" 0.5) 'error)
(test (format #f "~<~W~>" 'foo) 'error)
(test (format #f "~{12") 'error)
(test (format #f "~{}") 'error)
(test (format #f "~{}" '(1 2)) 'error)
(test (format #f "{~}" '(1 2)) 'error)
(test (format #f "~{~{~}}" '(1 2)) 'error)
(test (format #f "~}" ) 'error)
;(test (format #f "#|~|#|") 'error) ; ~| is ~^+ now
(test (format #f "~1.5F" 1.5) 'error)
(test (format #f "~1+iF" 1.5) 'error)
(test (format #f "~1,1iF" 1.5) 'error)
(test (format #f "~0" 1) 'error)
(test (format #f "~1") 'error)
(test (format #f "~^" 1) 'error)
(test (format #f "~.0F" 1.0) 'error)
(test (format #f "~1.0F" 1.0) 'error)
(test (format #f "~-1F" 1.0) 'error)
(test (format #f "~^") "")
(test (format #f "~A ~A~|this is not printed" 1 2) "1 2")
(test (format #f "~^~A~^~A~^this is not printed" 1 2) "12")
(test (format #f "~|") "")
(test (format #f "~D~" 9) 'error)
(test (format #f "~&" 9) 'error)
(test (format #f "~D~100T~D" 1 1) "1                                                                                                  1")
(test (format #f ".~P." 1) "..")
(test (format #f ".~P." 1.0) "..")
(test (format #f ".~P." 1.2) ".s.")
(test (format #f ".~P." 2/3) ".s.")
(test (format #f ".~P." 2) ".s.")
(test (format #f ".~p." 1) "..")
(test (format #f ".~p." 1.0) "..")
(test (format #f ".~p." 1.2) ".s.")
(test (format #f ".~p." 2) ".s.")
(test (format #f ".~@P." 1) ".y.")
(test (format #f ".~@P." 1.0) ".y.")
(test (format #f ".~@P." 1.2) ".ies.")
(test (format #f ".~@P." 2) ".ies.")
(test (format #f ".~@p." 1) ".y.")
(test (format #f ".~@p." 1.0) ".y.")
(test (format #f ".~@p." 1.2) ".ies.")
(test (format #f ".~@p." 2) ".ies.")
(test (format #f ".~P." 1.0+i) 'error)
(test (format #f ".~P." 1/0) ".s.")
(test (format #f "~P" 1) "") ; Clisp does this
(if (not with-windows) (test (format #f ".~P." (real-part (log 0))) ".s."))

(test (format #f (string #\~ #\a) 1) "1")
(test (format #f (format #f "~~a") 1) "1")
(test (format #f (format #f "~~a") (format #f "~D" 1)) "1")
(test (format #f "~A" (quasiquote quote)) "quote")

(test (format #f "~f" (/ 1 3)) "1/3") ; hmmm -- should it call exact->inexact?
(test (format #f "~f" 1) "1")
(test (format #f "~F" most-positive-fixnum) "9223372036854775807")

(unless with-bignums
  (test (format #f "~,20F" 1e-20) "0.00000000000000000001")
  (test (format #f "~,40F" 1e-40) "0.0000000000000000000000000000000000000001"))
;; if with bignums, these needs more bits

;;; the usual troubles here with big floats:
;;; (format #f "~F" 922337203685477580.9) -> "922337203685477632.000000"
;;; (format #f "~F" 9223372036854775.9) -> "9223372036854776.000000"
;;; (format #f "~F" 1e25) -> "10000000000000000905969664.000000"
;;; or small:
;;; (format #f "~,30F" 1e-1) -> "0.100000000000000005551115123126"

(when with-bignums
  (test (format #f "~A" -7043009959286724629649270926654940933664689003233793014518979272497911394287216967075767325693021717277238746020477538876750544587281879084559996466844417586093291189295867052594478662802691926547232838591510540917276694295393715934079679531035912244103731582711556740654671309980075069010778644542022/670550434139267031632063192770201289106737062379324644110801846820471752716238484923370056920388400273070254958650831435834503195629325418985020030706879602898158806736813101434594805676212779217311897830937606064579213895527844045511878668289820732425014254579493444623868748969110751636786165152601) "-7043009959286724629649270926654940933664689003233793014518979272497911394287216967075767325693021717277238746020477538876750544587281879084559996466844417586093291189295867052594478662802691926547232838591510540917276694295393715934079679531035912244103731582711556740654671309980075069010778644542022/670550434139267031632063192770201289106737062379324644110801846820471752716238484923370056920388400273070254958650831435834503195629325418985020030706879602898158806736813101434594805676212779217311897830937606064579213895527844045511878668289820732425014254579493444623868748969110751636786165152601")
  (test (format #f "~D" -7043009959286724629649270926654940933664689003233793014518979272497911394287216967075767325693021717277238746020477538876750544587281879084559996466844417586093291189295867052594478662802691926547232838591510540917276694295393715934079679531035912244103731582711556740654671309980075069010778644542022/670550434139267031632063192770201289106737062379324644110801846820471752716238484923370056920388400273070254958650831435834503195629325418985020030706879602898158806736813101434594805676212779217311897830937606064579213895527844045511878668289820732425014254579493444623868748969110751636786165152601) "-7043009959286724629649270926654940933664689003233793014518979272497911394287216967075767325693021717277238746020477538876750544587281879084559996466844417586093291189295867052594478662802691926547232838591510540917276694295393715934079679531035912244103731582711556740654671309980075069010778644542022/670550434139267031632063192770201289106737062379324644110801846820471752716238484923370056920388400273070254958650831435834503195629325418985020030706879602898158806736813101434594805676212779217311897830937606064579213895527844045511878668289820732425014254579493444623868748969110751636786165152601"))

(test (format #f "~@F" 1.23) 'error)
(test (format #f "~{testing ~D ~C ~}" (list 0 #\( 1 #\) 2 #\* 3 #\+ 4 #\, 5 #\- 6 #\. 7 #\/ 8 #\0 9 #\1 10 #\2 11 #\3 12 #\4 13 #\5 14 #\6 15 #\7 16 #\8 17 #\9 18 #\: 19 #\; 20 #\< 21 #\= 22 #\> 23 #\? 24 #\@ 25 #\A 26 #\B 27 #\C 28 #\D 29 #\E 30 #\F 31 #\G 32 #\H 33 #\I 34 #\J 35 #\K 36 #\L 37 #\M 38 #\N 39 #\O 40 #\P 41 #\Q 42 #\R 43 #\S 44 #\T 45 #\U 46 #\V 47 #\W 48 #\X 49 #\Y 50 #\( 51 #\) 52 #\* 53 #\+ 54 #\, 55 #\- 56 #\. 57 #\/ 58 #\0 59 #\1 60 #\2 61 #\3 62 #\4 63 #\5 64 #\6 65 #\7 66 #\8 67 #\9 68 #\: 69 #\; 70 #\< 71 #\= 72 #\> 73 #\? 74 #\@ 75 #\A 76 #\B 77 #\C 78 #\D 79 #\E 80 #\F 81 #\G 82 #\H 83 #\I 84 #\J 85 #\K 86 #\L 87 #\M 88 #\N 89 #\O 90 #\P 91 #\Q 92 #\R 93 #\S 94 #\T 95 #\U 96 #\V 97 #\W 98 #\X 99 #\Y))
      "testing 0 ( testing 1 ) testing 2 * testing 3 + testing 4 , testing 5 - testing 6 . testing 7 / testing 8 0 testing 9 1 testing 10 2 testing 11 3 testing 12 4 testing 13 5 testing 14 6 testing 15 7 testing 16 8 testing 17 9 testing 18 : testing 19 ; testing 20 < testing 21 = testing 22 > testing 23 ? testing 24 @ testing 25 A testing 26 B testing 27 C testing 28 D testing 29 E testing 30 F testing 31 G testing 32 H testing 33 I testing 34 J testing 35 K testing 36 L testing 37 M testing 38 N testing 39 O testing 40 P testing 41 Q testing 42 R testing 43 S testing 44 T testing 45 U testing 46 V testing 47 W testing 48 X testing 49 Y testing 50 ( testing 51 ) testing 52 * testing 53 + testing 54 , testing 55 - testing 56 . testing 57 / testing 58 0 testing 59 1 testing 60 2 testing 61 3 testing 62 4 testing 63 5 testing 64 6 testing 65 7 testing 66 8 testing 67 9 testing 68 : testing 69 ; testing 70 < testing 71 = testing 72 > testing 73 ? testing 74 @ testing 75 A testing 76 B testing 77 C testing 78 D testing 79 E testing 80 F testing 81 G testing 82 H testing 83 I testing 84 J testing 85 K testing 86 L testing 87 M testing 88 N testing 89 O testing 90 P testing 91 Q testing 92 R testing 93 S testing 94 T testing 95 U testing 96 V testing 97 W testing 98 X testing 99 Y ")


(let ((vect1 #3D(((1 2 3) (3 4 5)) ((5 6 1) (7 8 2))))
      (vect2 #2d((1 2 3 4 5 6) (7 8 9 10 11 12)))
      (vect3 #(1 2 3 4 5 6 7 8 9 10 11 12 13 14))
      (vect4 #3D(((1 2) (3 4) (5 6)) ((7 8) (9 10) (11 12)))))
  (do ((i 0 (+ i 2)))
      ((>= i 10))
    (set! (*s7* 'print-length) i)
    (test (object->string vect1) (format #f "~A" vect1))
    (test (object->string vect2) (format #f "~A" vect2))
    (test (object->string vect3) (format #f "~A" vect3))
    (test (object->string vect4) (format #f "~A" vect4))))

(let-temporarily (((*s7* 'print-length) 0))
  (test (format #f "~A" #()) "#()"))

(let-temporarily (((*s7* 'print-length) 3))
  (let ((lst (list 1)))
    (set-car! lst lst)
    (let ((v (vector 1 1 1 1 1 1 1 1 1 lst)))
      (let ((str (format #f "~A" v)))
	(test (string=? str "#(1 1 1 ...)") #t)))))

(test (format #f "~D" 123) "123")
(test (format #f "~X" 123) "7b")
(test (format #f "~B" 123) "1111011")
(test (format #f "~O" 123) "173")

(test (format #f "~10D" 123) "       123")
(test (format #f "~nD" 10 123) "       123")
(test (format #f "~10X" 123) "        7b")
(test (format #f "~10B" 123) "   1111011")
(test (format #f "~10O" 123) "       173")

(test (format #f "~D" -123) "-123")
(test (format #f "~X" -123) "-7b")
(test (format #f "~B" -123) "-1111011")
(test (format #f "~O" -123) "-173")

(test (format #f "~10D" -123) "      -123")
(test (format #f "~10X" -123) "       -7b")
(test (format #f "~10B" -123) "  -1111011")
(test (format #f "~10O" -123) "      -173")

(test (format #f "~d" 123) "123")
(test (format #f "~x" 123) "7b")
(test (format #f "~b" 123) "1111011")
(test (format #f "~o" 123) "173")

(test (format #f "~10d" 123) "       123")
(test (format #f "~10x" 123) "        7b")
(test (format #f "~10b" 123) "   1111011")
(test (format #f "~10o" 123) "       173")

(test (format #f "~d" -123) "-123")
(test (format #f "~x" -123) "-7b")
(test (format #f "~b" -123) "-1111011")
(test (format #f "~o" -123) "-173")

(test (format #f "~10d" -123) "      -123")
(test (format #f "~10x" -123) "       -7b")
(test (format #f "~10b" -123) "  -1111011")
(test (format #f "~10o" -123) "      -173")

(test (format #f "~D" most-positive-fixnum) "9223372036854775807")
(test (format #f "~D" (+ 1 most-negative-fixnum)) "-9223372036854775807")
      
(test (format #f "~X" most-positive-fixnum) "7fffffffffffffff")
(test (format #f "~X" (+ 1 most-negative-fixnum)) "-7fffffffffffffff")
      
(test (format #f "~O" most-positive-fixnum) "777777777777777777777")
(test (format #f "~O" (+ 1 most-negative-fixnum)) "-777777777777777777777")
      
(test (format #f "~B" most-positive-fixnum) "111111111111111111111111111111111111111111111111111111111111111")
(test (format #f "~B" (+ 1 most-negative-fixnum)) "-111111111111111111111111111111111111111111111111111111111111111")
      
(num-test (inexact->exact most-positive-fixnum) most-positive-fixnum)

(test (format #f "~0D" 123) "123")
(test (format #f "~0X" 123) "7b")
(test (format #f "~0B" 123) "1111011")
(test (format #f "~0O" 123) "173")

(test (format #f "" 1) 'error)
(test (format #f "hiho" 1) 'error)
(test (format #f "a~%" 1) 'error) ; some just ignore extra args

(for-each
 (lambda (arg)
   (let ((result (catch #t (lambda () (format arg "hiho")) (lambda args 'error))))
     (if (not (eq? result 'error))
	 (begin (display "(format ") (display arg) (display " \"hiho\")")
		(display " returned ") (display result) 
		(display " but expected 'error")
		(newline)))))
 (list -1 #\a 1 #(1 2 3) 3.14 3/4 1.0+1.0i 'hi :hi #<eof> abs (lambda () 1) #(()) (list 1 2 3) '(1 . 2)))

(for-each
 (lambda (arg)
   (let ((result (catch #t (lambda () (format #f arg)) (lambda args 'error))))
     (if (not (eq? result 'error))
	 (begin (display "(format #f ") (display arg) (display ")")
		(display " returned ") (display result) 
		(display " but expected 'error")
		(newline)))))
 (list -1 #\a 1 #f #t #(1 2 3) 3.14 3/4 1.0+1.0i () 'hi abs (lambda () 1) #(()) (list 1 2 3) '(1 . 2)))

(test (format #f "hi ~A ho" 1 2) 'error)
(test (format #f "hi ~A ho") 'error)
(test (format #f "hi ~S ho") 'error)
(test (format #f "hi ~S ho" 1 2) 'error)
(test (format #f "~C" 1) 'error)
(test (format #f "123 ~R 321" 1) 'error)
(test (format #f "123 ~,3R 321" 1) 'error)
(test (format #f "~,2,3,4D" 123) 'error)

(test (format #f "hi ~Z ho") 'error)
(test (format #f "hi ~+ ho") 'error)
(test (format #f "hi ~# ho") 'error)
(test (format #f "hi ~, ho") 'error)

(test (format #f "hi ~} ho") 'error)
(test (format #f "hi {ho~}") 'error)

(test (format #f "asb~{~A asd" '(1 2 3)) 'error)
(test (format #f "~{~A~}" 1 2 3) 'error)
(test (format #f "asb~{~}asd" '(1 2 3)) 'error)
(test (format #f "asb~{ ~}asd" '(1 2 3)) 'error)
(test (format #f "asb~{ . ~}asd" '(1 2 3)) 'error)
(test (format #f "asb~{ hiho~~~}asd" '(1 2 3)) 'error)

(test (format #f "~12C" #\a) "aaaaaaaaaaaa")
(test (format #f ".~0C." #\a) "..")
(test (format #f "~10C" #\space) "          ")

(test (format #f "~12P" #\a) 'error)
(test (format #f "~12*" #\a) 'error)
(test (format #f "~12%" #\a) 'error)
(test (format #f "~12^" #\a) 'error)
(test (format #f "~12{" #\a) 'error)
(test (format #f "~12,2A" #\a) 'error)

(test (format #f "~12,A" #\a) 'error) ; s7 misses padding errors such as (format #f "~12,' A" #\a)

(for-each
 (lambda (arg)
   (test (format #f "~F" arg) 'error))
 (list "hi" #\a 'a-symbol (make-vector 3) abs #f #t :hi (if #f #f) (lambda (a) (+ a 1))))

(for-each
 (lambda (arg)
   (test (format #f "~D" arg) 'error))
 (list "hi" #\a 'a-symbol (make-vector 3) abs #f #t :hi (if #f #f) (lambda (a) (+ a 1))))

(for-each
 (lambda (arg)
   (test (format #f "~P" arg) 'error))
 (list "hi" #\a 'a-symbol (make-vector 3) abs #f #t :hi (if #f #f) (lambda (a) (+ a 1))))

(for-each
 (lambda (arg)
   (test (format #f "~X" arg) 'error))
 (list "hi" #\a 'a-symbol (make-vector 3) abs #f #t :hi (if #f #f) (lambda (a) (+ a 1))))

(for-each
 (lambda (arg)
   (test (format #f "~C" arg) 'error))
 (list "hi" 1 1.0 1+i 2/3 'a-symbol (make-vector 3) abs #f #t :hi (if #f #f) (lambda (a) (+ a 1))))

(for-each
 (lambda (arg)
   (test (format #f arg 123) 'error))
 (list 1 1.0 1+i 2/3 'a-symbol (make-vector 3) abs #f #t :hi (if #f #f) (lambda (a) (+ a 1))))

(test (format #f "~{~A ~A ~}" '(1 "hi" 2)) 'error)
(for-each
 (lambda (arg)
   (let ((result (catch #t (lambda () (format #f "~F" arg)) (lambda args 'error))))
     (if (not (eq? result 'error))
	 (begin (display "(format #f \"~F\" ") (display arg)
		(display ") returned ") (display result) 
		(display " but expected 'error")
		(newline)))))
 (list #\a #(1 2 3) "hi" () 'hi abs (lambda () 1) #(()) (list 1 2 3) '(1 . 2)))

(test (format #f "~D") 'error)
(test (format () "hi") #f) ; not an error now -- will print "hi" also
(test (format #f "~F" "hi") 'error)
(test (format #f "~D" #\x) 'error)
(test (format #f "~C" (list 1 2 3)) 'error)
(test (format #f "~1/4F" 1.4) 'error)
(test (format #f "~1.4F" 1.4) 'error)
(test (format #f "~F" (real-part (log 0.0))) "-inf.0")
(test (let ((val (format #f "~F" (/ (real-part (log 0.0)) (real-part (log 0.0)))))) (or (string=? val "nan.0") (string=? val "-nan.0"))) #t)
(test (format #f "~1/4T~A" 1) 'error)
(test (format #f "~T") "")
(test (format #f "~@P~S" 1 '(1)) "y(1)")
(test (format #f ".~A~*" 1 '(1)) ".1")
(test (format #f "~*~*~T" 1 '(1)) "")

(test (format #f "~A" 'AB\c) "(symbol \"AB\\\\c\")")
(test (format #f "~S" 'AB\c) "(symbol \"AB\\\\c\")")
(test (format #f "~A" '(AB\c () xyz)) "((symbol \"AB\\\\c\") () xyz)")
(test (format #f "~,2f" 1234567.1234) "1234567.12")
(test (format #f "~5D" 3) "    3")
(test (format #f "~5,'0D" 3) "00003")
(test (format #f "++~{-=~s=-~}++" (quote (1 2 3))) "++-=1=--=2=--=3=-++")

(test (format) 'error)
(for-each
 (lambda (arg)
   (test (format arg) 'error))
 (list 1 1.0 1+i 2/3 'a-symbol (make-vector 3) '(1 2) (cons 1 2) abs #f #t :hi (if #f #f) (lambda (a) (+ a 1))))
(test (format "hi") "hi") ; !?
(test (format "~A ~D" 1/3 2) "1/3 2")
(test (format "") "")

;; from slib/formatst.scm
(test (string=? (format #f "abc") "abc") #t)
(test (string=? (format #f "~a" 10) "10") #t)
(test (string=? (format #f "~a" -1.2) "-1.2") #t)
(test (string=? (format #f "~a" 'a) "a") #t)
(test (string=? (format #f "~a" #t) "#t") #t)
(test (string=? (format #f "~a" #f) "#f") #t)
(test (string=? (format #f "~a" "abc") "abc") #t)
(test (string=? (format #f "~a" #(1 2 3)) "#(1 2 3)") #t)
(test (string=? (format #f "~a" ()) "()") #t)
(test (string=? (format #f "~a" '(a)) "(a)") #t)
(test (string=? (format #f "~a" '(a b)) "(a b)") #t)
(test (string=? (format #f "~a" '(a (b c) d)) "(a (b c) d)") #t)
(test (string=? (format #f "~a" '(a . b)) "(a . b)") #t)
(test (string=? (format #f "~a ~a" 10 20) "10 20") #t)
(test (string=? (format #f "~a abc ~a def" 10 20) "10 abc 20 def") #t)
(test (string=? (format #f "~d" 100) "100") #t)
(test (string=? (format #f "~x" 100) "64") #t)
(test (string=? (format #f "~o" 100) "144") #t)
(test (string=? (format #f "~b" 100) "1100100") #t)
(test (string=? (format #f "~10d" 100) "       100") #t)
(test (string=? (format #f "~10,'*d" 100) "*******100") #t)
(test (string=? (format #f "~c" #\a) "a") #t)
(test (string=? (format #f "~c" #\space) " ") #t)
(test (string=? (format #f "~C" #\x91) "\x91;") #t)
(test (string=? (format #f "~C" #\x9) "\x09;") #t)
(test (string=? (format #f "~C" #\~) "~") #t)
(test (string=? (format #f "~A" #\x91) "\x91;") #t)
(test (string=? (format #f "~S" #\x91) "#\\x91") #t)
(test (string=? (format #f "~A" (string->symbol "hi")) "hi") #t)
(test (string=? (format #f "~S" (string->symbol "hi")) "hi") #t)
(test (string=? (format #f "~A" (string->symbol ";\\\";")) "(symbol \";\\\\\\\";\")") #t)
(test (string=? (format #f "~S" (string->symbol ";\\\";")) "(symbol \";\\\\\\\";\")") #t)
(test (string=? (format #f "~A" (string->symbol (string #\, #\. #\# #\; #\" #\\ #\' #\`))) "(symbol \",.#;\\\"\\\\'`\")") #t)

(test (string=? (format #f "~~~~") "~~") #t)
(test (string=? (format #f "~s" "abc") "\"abc\"") #t)
(test (string=? (format #f "~s" "abc \\ abc") "\"abc \\\\ abc\"") #t)
(test (string=? (format #f "~a" "abc \\ abc") "abc \\ abc") #t)
(test (string=? (format #f "~s" "abc \" abc") "\"abc \\\" abc\"") #t)
(test (string=? (format #f "~a" "abc \" abc") "abc \" abc") #t)
(test (string=? (format #f "~s" #\space) "#\\space") #t)
(test (string=? (format #f "~s" #\newline) "#\\newline") #t)
(test (string=? (format #f "~s" #\a) "#\\a") #t)
(test (string=? (format #f "~a" '(a "b" c)) "(a \"b\" c)") #t)
(test (string=? (format #f "abc~
         123") "abc123") #t)
(test (string=? (format #f "abc~
123") "abc123") #t)
(test (string=? (format #f "abc~
") "abc") #t)
(test (string=? (format #f "~{ ~a ~}" '(a b c)) " a  b  c ") #t)
(test (string=? (format #f "~{ ~a ~}" ()) "") #t)
(test (string=? (format #f "~{ ~a ~}" "") "") #t)
(test (string=? (format #f "~{ ~a ~}" #()) "") #t)
(test (string=? (format #f "~{ ~a,~a ~}" '(a 1 b 2 c 3)) " a,1  b,2  c,3 ") #t)
(test (string=? (format #f "abc ~^ xyz") "abc ") #t)
(test (format (values #f "~A ~D" 1 2)) "1 2")
(test (format #f "~A~^" 1) "1") ; clisp agrees here
(test (format #f "~A~*~* ~A" (values 1 2 3 4)) "1 4")
(test (format #f "~^~A~^~*~*~^ ~^~A~^" (values 1 2 3 4)) "1 4")

(test (string=? (format #f "~B" 123) "1111011") #t)
(test (string=? (format #f "~B" 123/25) "1111011/11001") #t)
(test (string=? (format #f "~B" 123.25) "1111011.01") #t)
(test (string=? (format #f "~B" 123+i) "1111011.0+1.0i") #t)

(test (string=? (format #f "~D" 123) "123") #t)
(test (string=? (format #f "~D" 123/25) "123/25") #t)

(test (string=? (format #f "~O" 123) "173") #t)
(test (string=? (format #f "~O" 123/25) "173/31") #t)
(test (string=? (format #f "~O" 123.25) "173.2") #t)
(test (string=? (format #f "~O" 123+i) "173.0+1.0i") #t)

(test (string=? (format #f "~X" 123) "7b") #t)
(test (string=? (format #f "~X" 123/25) "7b/19") #t)
(test (string=? (format #f "~X" 123.25) "7b.4") #t)
(test (string=? (format #f "~X" 123+i) "7b.0+1.0i") #t)

(test (string=? (format #f "~A" "hi") (format #f "~S" "hi")) #f)
(test (string=? (format #f "~A" #\a) (format #f "~S" #\a)) #f)
(for-each
 (lambda (arg)
   (test (string=? (format #f "~A" arg) (format #f "~S" arg)) #t))
 (list 1 1.0 #(1 2 3) '(1 2 3) '(1 . 2) () #f #t abs #<eof> #<unspecified> 'hi '\a))
(test (length (format #f "~S" (string #\\))) 4)                  ; "\"\\\\\""
(test (length (format #f "~S" (string #\a))) 3)                  ; "\"a\""
(test (length (format #f "~S" (string #\null))) 7)               ; "\"\\x00;\""
(test (length (format #f "~S" (string (integer->char #xf0)))) 3) ; "\"ð\""
(test (length (format #f "~S" (string #\"))) 4)                  ; "\""

(test (format #f "~F" 3.0) "3.000000")
(test (format #f "~G" 3.0) "3.0")
(test (format #f "~E" 3.0) (if (not with-windows) "3.000000e+00" "3.000000e+000"))
(test (format #f "~F" 3.14159) "3.141590")
(test (format #f "~G" 3.14159) "3.14159")
(test (format #f "~E" 3.14159) (if (not with-windows) "3.141590e+00" "3.141590e+000"))
(test (format #f "~,2F" 3.14159) "3.14")
(test (format #f "~,2G" 3.14159) "3.1")
(test (format #f "~,2E" 3.14159) (if (not with-windows) "3.14e+00" "3.14e+000"))
(test (format #f "~12F" 3.14159) "    3.141590")
(test (format #f "~12G" 3.14159) "     3.14159")
(test (format #f "~12E" 3.14159) (if (not with-windows) "3.141590e+00" "3.141590e+000"))
(test (format #f "~12,3F" 3.14159) "       3.142")
(test (format #f "~n,nF" 12 3 3.14159) "       3.142")
(test (format #f "~12,nF" 3 3.14159) "       3.142")
(test (format #f "~12,3G" 3.14159) "        3.14")
(test (format #f "~12,3E" 3.14159) (if (not with-windows) "   3.142e+00" "  3.142e+000"))
(test (format #f "~12,'xD" 1) "xxxxxxxxxxx1")
(test (format #f "~12,'xF" 3.14159) "xxxx3.141590")
(test (format #f "~12,'xG" 3.14159) "xxxxx3.14159")
(test (format #f "~12,'xE" 3.14159) (if (not with-windows) "3.141590e+00" "3.141590e+000"))
(test (format #f "~12,'\\F" 3.14159) "\\\\\\\\3.141590")
(test (format #f "~20,20G" 3.0) "                   3.0")
(test (format #f "~20,20F" 3.0) "3.00000000000000000000")
(test (format #f "~20,20E" 3.0) (if (not with-windows) "3.00000000000000000000e+00" "3.00000000000000000000e+000"))

(test (format #f "~,3B" 0.99999) "0.111")
(test (format #f "~,3O" 0.99999) "0.777")
(test (format #f "~,3F" 0.99999) "1.000")
(test (format #f "~,3X" 0.99999) "0.fff")

(test (format #f "~-2F" 0.0) 'error)
(test (format #f "~,-2F" 0.0) 'error)
(test (format #f "~2/3F" 0.0) 'error)
(test (format #f "~2.3F" 0.0) 'error)
(test (format #f "~2,1,3,4F" 0.0) 'error)
(test (format #f "~'xF" 0.0) 'error)
(test (format #f "~3,3" pi) 'error)
(test (format #f "~3," pi) 'error)
(test (format #f "~3" pi) 'error)
(test (format #f "~," pi) 'error)
(test (format #f "~'," pi) 'error)
(test (format #f "~'" pi) 'error)

(test (format #f "~*" 1.0) "")
(test (format #f "~D" 1.0) (if (not with-windows) "1.000000e+00" "1.000000e+000"))
(test (format #f "~O" 1.0) "1.0")
(test (format #f "~P" 1.0) "")
(test (format #f "~P" '(1 2 3)) 'error)
(test (format #f "~\x00;T") 'error)
(test (format #f "~9,'(T") "((((((((")
(test (format #f "~0F" 1+1i) "1.000000+1.000000i")
(test (format #f "~9F" 1) "        1")
(test (format #f "~,0F" 3.14) "3.0")
(test (format #f "~,0F" 1+1i) "1+1i")
(test (format #f "~,0X" 1+1i) "1.0+1.0i")
(test (format #f "~,9g" 1+1i) "1+1i")
(test (format #f "~,1e" 3.14) (if (not with-windows) "3.1e+00" "3.1e+000"))
(test (format #f "~9,0F" 3.14) "        3.0")
(test (format #f "~9,1F" 3.14) "      3.1")
(test (format #f "~9,2F" 3.14) "     3.14")
(test (format #f "~9,3F" 3.14) "    3.140")
(test (format #f "~9,4F" 3.14) "   3.1400")
(test (format #f "~n,4F" 9 3.14) "   3.1400")
(test (format #f "~9,nF" 4 3.14) "   3.1400")
(test (format #f "~n,nF" 9 4 3.14) "   3.1400")
(test (format #f "~9,5F" 3.14) "  3.14000")
(test (format #f "~9,6F" 3.14) " 3.140000")
(test (format #f "~9,7F" 3.14) "3.1400000")
(test (format #f "~9,8F" 3.14) "3.14000000")
(test (format #f "~9,9F" 3.14) "3.140000000")
(test (format #f "~9,9G" 1+1i) "     1+1i")
(if (not with-windows)
    (begin
      (test (format #f "~9,0e" 1+1i) "1e+00+1e+00i")
      (test (format #f "~9,1e" 1+1i) "1.0e+00+1.0e+00i")
      (test (format #f "~9,2e" 1+1i) "1.00e+00+1.00e+00i")
      (test (format #f "~9,3e" 1+1i) "1.000e+00+1.000e+00i")
      (test (format #f "~9,4e" 1+1i) "1.0000e+00+1.0000e+00i")
      (test (format #f "~9,5e" 1+1i) "1.00000e+00+1.00000e+00i")
      (test (format #f "~9,6e" 1+1i) "1.000000e+00+1.000000e+00i")
      (test (format #f "~9,7e" 1+1i) "1.0000000e+00+1.0000000e+00i")
      (test (format #f "~9,8e" 1+1i) "1.00000000e+00+1.00000000e+00i")
      (test (format #f "~9,9e" 1+1i) "1.000000000e+00+1.000000000e+00i"))
    (begin
      (test (format #f "~9,0e" 1+1i) "1e+000+1e+000i")
      (test (format #f "~9,1e" 1+1i) "1.0e+000+1.0e+000i")
      (test (format #f "~9,2e" 1+1i) "1.00e+000+1.00e+000i")
      (test (format #f "~9,3e" 1+1i) "1.000e+000+1.000e+000i")
      (test (format #f "~9,4e" 1+1i) "1.0000e+000+1.0000e+000i")
      (test (format #f "~9,5e" 1+1i) "1.00000e+000+1.00000e+000i")
      (test (format #f "~9,6e" 1+1i) "1.000000e+000+1.000000e+000i")
      (test (format #f "~9,7e" 1+1i) "1.0000000e+000+1.0000000e+000i")
      (test (format #f "~9,8e" 1+1i) "1.00000000e+000+1.00000000e+000i")
      (test (format #f "~9,9e" 1+1i) "1.000000000e+000+1.000000000e+000i")))
(test (format #f "~9,0x" 3.14) "      3.0")
(test (format #f "~9,1x" 3.14) "      3.2")
(test (format #f "~9,2x" 3.14) "     3.23")
(test (format #f "~9,3x" 3.14) "    3.23d")
(test (format #f "~9,4x" 3.14) "   3.23d7")
(test (format #f "~9,5x" 3.14) "   3.23d7")
(test (format #f "~9,6x" 3.14) " 3.23d70a")
(test (format #f "~9,7x" 3.14) "3.23d70a3")
(test (format #f "~9,8x" 3.14) "3.23d70a3d")
(test (format #f "~9,9x" 3.14) "3.23d70a3d7")
(test (format #f "~9,0b" 3.14) "     11.0")
(test (format #f "~9,1b" 3.14) "     11.0")
(test (format #f "~9,2b" 3.14) "     11.0")
(test (format #f "~9,3b" 3.14) "   11.001")
(test (format #f "~9,4b" 3.14) "   11.001")
(test (format #f "~9,5b" 3.14) "   11.001")
(test (format #f "~9,6b" 3.14) "   11.001")
(test (format #f "~9,7b" 3.14) "11.0010001")
(test (format #f "~9,8b" 3.14) "11.00100011")
(test (format #f "~9,9b" 3.14) "11.001000111")
(test (format #f "~0,'xf" 1) "1")
(test (format #f "~1,'xf" 1) "1")
(test (format #f "~2,'xf" 1) "x1")
(test (format #f "~3,'xf" 1) "xx1")
(test (format #f "~4,'xf" 1) "xxx1")
(test (format #f "~5,'xf" 1) "xxxx1")
(test (format #f "~6,'xf" 1) "xxxxx1")
(test (format #f "~7,'xf" 1) "xxxxxx1")
(test (format #f "~8,'xf" 1) "xxxxxxx1")
(test (format #f "~9,'xf" 1) "xxxxxxxx1")
(test (format #f "~11,'xf" 3.14) "xxx3.140000")
(test (format #f "~12,'xf" 3.14) "xxxx3.140000")
(test (format #f "~13,'xf" 3.14) "xxxxx3.140000")
(test (format #f "~14,'xf" 3.14) "xxxxxx3.140000")
(test (format #f "~15,'xf" 3.14) "xxxxxxx3.140000")
(test (format #f "~16,'xf" 3.14) "xxxxxxxx3.140000")
(test (format #f "~17,'xf" 3.14) "xxxxxxxxx3.140000")
(test (format #f "~18,'xf" 3.14) "xxxxxxxxxx3.140000")
(test (format #f "~19,'xf" 3.14) "xxxxxxxxxxx3.140000")
(test (format #f "~,f" 1.0) "1.000000")
(test (format #f "~,,f" 1.0) 'error)
(test (format #f "~p" '(1 2 3)) 'error) ; these are not errors in CL
(test (format #f "~p" #(())) 'error)
(test (format #f "~p" 'hi) 'error)
(test (format #f "~p" abs) 'error)
(test (format #f "~p" 1+i) 'error)
(test (format #f "~@p" '(1 2 3)) 'error)
(test (format #f "~@p" #(())) 'error)
(test (format #f "~@p" 'hi) 'error)
(test (format #f "~@p" abs) 'error)
(let-temporarily (((*s7* 'print-length) 3))
  (test (format #f "~{~A~| ~}" '(1 2 3 4 5 6)) "1 2 3 ...")
  (test (format #f "~{~A~| ~}" #(1 2 3 4 5 6)) "1 2 3 ...")
  (test (format #f "~{~A~| ~}" #(1 2)) "1 2")
  (test (format #f "~{~A~| ~}" #(1 2 3)) "1 2 3")
  (test (format #f "~{~A~| ~}" #(1 2 3 4)) "1 2 3 ...")
  (test (format #f "~{~A~| ~}" (inlet 'a 1 'b 2 'c 3 'd 4 'e 5)) "(a . 1) (b . 2) (c . 3) ...")
  (test (format #f "~{~{~A~| ~}~}" '((1 2 3 4 5 6))) "1 2 3 ...")
  (test (format #f "~{~{~A~| ~}~|~}" '((1 2) (3 4 5 6 7 8) (15) (16) ())) "1 23 4 5 ...15 ...")
  (test (format #f "~{~|~|~|~A ~}" '(1 2 3 4 5)) "1 2 3  ...")
  (test (format #f "~{~C~| ~}" "1234567") "1 2 3 ...")
  (test (format #f "~{~{~A~|~} ~}" '((1 2) (3 4))) "12 34 ")
  (test (format #f "~C ~^" #\a) "a ")
  (test (format #f "~{~{~{~A~| ~}~| ~}~}" '(((1 2) (3 4)))) "1 2 3 4")
  (test (format #f "~{~{~{~A~| ~}~| ~}~}" '((#(1 2) #(3 4)))) "1 2 3 4")
  (test (format #f "~{~{~{~A~| ~}~| ~}~}" #(((1 2) (3 4)))) "1 2 3 4")
  (test (format #f "~{~{~{~A~| ~}~| ~}~}" #(#((1 2) (3 4)))) "1 2 3 4")
  (test (format #f "~{~{~C~| ~}~| ~}" (list "hiho" "xxx")) "h i h ... x x x"))
(test (format #f "~{~{~A~^~} ~}" '((hi 1))) "hi1 ")
(test (format #f "~{~{~A~^~} ~}" '((1 2) (3 4))) "12 34 ")
(test (format #f "~{~{~A~} ~}" '((1 2) (3 4))) "12 34 ")
(test (format #f "~{~{~A~} ~}" '(())) " ")
(test (format #f "~{~{~A~} ~}" '((()))) "() ")
(test (format #f "~{~{~F~} ~}" '(())) " ")
(test (format #f "~{~{~C~} ~}" '(())) " ")
(test (format #f "~{~C ~}" ()) "")
(test (format #f "~C ~^" #\a) "a ") ; CL ignores pointless ~^
(test (format #f "~^~A" #f) "#f")
(test (format #f "~^~^~A" #f) "#f")
(test (format #f "~*~*~A~*" 1 2 3 4) "3")
(test (format #f "~{~*~A~}" '(1 2 3 4)) "24")
(test (let ((lst (list 1 2 3))) (set! (cdr (cddr lst)) lst) (format #f "~A" lst)) "#1=(1 2 3 . #1#)")
(test (let ((lst (list 1 2 3))) (set! (cdr (cddr lst)) lst) (format #f "~{~A~}" lst)) 'error)
(test (format #f "~{~A~}" (cons 1 2)) 'error)
(test (format #f "~{~A~}" '(1 2 3 . 4)) 'error)
(test (format #f "~20,vF" 3.14) 'error)
(test (format #f "~{~C~^ ~}" "hiho") "h i h o")
(test (format #f "~{~{~C~^ ~}~}" (list "hiho")) "h i h o")
(test (format #f "~{~A ~}" #(1 2 3 4)) "1 2 3 4 ")
(test (let ((v (vector 1))) (set! (v 0) v) (format #f "~A" v)) "#1=#(#1#)")
(test (let ((v (vector 1))) (set! (v 0) v) (format #f "~{~A~}" v)) "#1=#(#1#)")
(test (format #f "~{~{~{~A~^ ~}~^ ~}~}" '(((1 2) (3 4)))) "1 2 3 4")
(test (format #f "~{~{~{~A~^ ~}~^ ~}~}" '((#(1 2) #(3 4)))) "1 2 3 4")
(test (format #f "~{~{~{~A~^ ~}~^ ~}~}" #(((1 2) (3 4)))) "1 2 3 4")
(test (format #f "~{~{~{~A~^ ~}~^ ~}~}" #(#((1 2) (3 4)))) "1 2 3 4")
(test (format #f "~{~{~{~A~^ ~}~^ ~}~}" #(#(#(1 2) (3 4)))) "1 2 3 4")
(test (format #f "~{~{~{~A~^ ~}~^ ~}~}" #(#(#(1 2) #(3 4)))) "1 2 3 4")
(test (format #f "~{~{~C~^ ~}~^ ~}" (list "hiho" "xxx")) "h i h o x x x")
(test (format #f "~{~{~A~}~}" '((1 . 2) (3 . 4))) 'error)
(test (format #f "~{~A~^ ~}" '((1 . 2) (3 . 4))) "(1 . 2) (3 . 4)") 
(test (format #f "~{~A ~}" (hash-table)) "")
(test (format #f "~{~^~S ~}" (make-iterator '(1 2 3))) "1 2 3 ")
(test (format #f "~{~^~S ~}" (make-iterator (let ((lst (list 1))) (set-cdr! lst lst)))) "1 ")
(test (format #f "~{~^~S ~}" (make-iterator "")) "")
(test (format #f "~{~^~S ~}" (make-iterator #(1 2 3))) "1 2 3 ")

(test (format #f "~10,'-T") "---------")
(test (format #f "~10,'\\T") "\\\\\\\\\\\\\\\\\\")
(test (format #f "~10,'\"T") "\"\"\"\"\"\"\"\"\"")
(test (format #f "~10,'-T12345~20,'-T") "---------12345-----")
(test (format #f "~10,')T") ")))))))))")

(test (format #f "~,0F" 1.4) "1.0")
(test (format #f "~,0F" 1.5) "2.0")
(test (format #f "~,0F" 1.6) "2.0")
(test (format #f "~,0F" 0.4) "0.0")
(test (format #f "~,0F" 0.5) (if (not with-windows) "0.0" "1.0")) ; !!
(test (format #f "~,0F" 0.6) "1.0")
(test (format #f "~,-0F" 1.4) 'error)
(test (format #f "~, 0F" 1.4) 'error)
(test (format #f "~*1~*" 1) 'error)
(test (format #f "~*1~A" 1) 'error)

(let* ((str1 #t) (str2 (with-output-to-string (lambda () (set! str1 (format () "~D" 1)))))) (test (and (not str1) (equal? str2 "1")) #t))

(test (format #f "~,'") 'error)
(if with-bignums
    (begin
      (test (format #f "~F" 1e300) "9.999999999999999999999999999999999999987E299")
      (test (format #f "~F" 1e308) "9.999999999999999999999999999999999999982E307")
      (test (format #f "~G" 1e308) "9.999999999999999999999999999999999999982E307")
      (test (format #f "~E" 1e308)  "9.999999999999999999999999999999999999982E307")
      (test (format #f "~E" 1e308+1e308i) "9.999999999999999999999999999999999999982E307+9.999999999999999999999999999999999999982E307i")
      (test  (format #f "~F" 1e308+1e308i) "9.999999999999999999999999999999999999982E307+9.999999999999999999999999999999999999982E307i")
      (test (format #f "~F" -1e308-1e308i) "-9.999999999999999999999999999999999999982E307-9.999999999999999999999999999999999999982E307i")
      (test (format #f "~,32f" (/ 1.0 most-positive-fixnum)) "1.084202172485504434125002235952170462235E-19")
      (test (format #f "~{~^~f ~}" (vector 1e308)) "9.999999999999999999999999999999999999982E307 ")
      (test (object->string (vector 1e308)) "#(9.999999999999999999999999999999999999982E307)"))
    (begin
      (test (format #f "~F" 1e300) "1000000000000000052504760255204420248704468581108159154915854115511802457988908195786371375080447864043704443832883878176942523235360430575644792184786706982848387200926575803737830233794788090059368953234970799945081119038967640880074652742780142494579258788820056842838115669472196386865459400540160.000000")
      (test (format #f "~F" 1e308) "100000000000000001097906362944045541740492309677311846336810682903157585404911491537163328978494688899061249669721172515611590283743140088328307009198146046031271664502933027185697489699588559043338384466165001178426897626212945177628091195786707458122783970171784415105291802893207873272974885715430223118336.000000")
      (test (format #f "~G" 1e308) "1e+308")
      (test (format #f "~E" 1e308) "1.000000e+308")
      (test (format #f "~E" 1e308+1e308i) "1.000000e+308+1.000000e+308i")
      (test  (format #f "~F" 1e308+1e308i) "100000000000000001097906362944045541740492309677311846336810682903157585404911491537163328978494688899061249669721172515611590283743140088328307009198146046031271664502933027185697489699588559043338384466165001178426897626212945177628091195786707458122783970171784415105291802893207873272974885715430223118336.000000+100000000000000001097906362944045541740492309677311846336810682903157585404911491537163328978494688899061249669721172515611590283743140088328307009198146046031271664502933027185697489699588559043338384466165001178426897626212945177628091195786707458122783970171784415105291802893207873272974885715430223118336.000000i")
      (test (format #f "~F" -1e308-1e308i) "-100000000000000001097906362944045541740492309677311846336810682903157585404911491537163328978494688899061249669721172515611590283743140088328307009198146046031271664502933027185697489699588559043338384466165001178426897626212945177628091195786707458122783970171784415105291802893207873272974885715430223118336.000000-100000000000000001097906362944045541740492309677311846336810682903157585404911491537163328978494688899061249669721172515611590283743140088328307009198146046031271664502933027185697489699588559043338384466165001178426897626212945177628091195786707458122783970171784415105291802893207873272974885715430223118336.000000i")
      (test (format #f "~,32f" (/ 1.0 most-positive-fixnum)) "0.00000000000000000010842021724855")
      (test (format #f "~{~^~f ~}" (vector 1e308)) "100000000000000001097906362944045541740492309677311846336810682903157585404911491537163328978494688899061249669721172515611590283743140088328307009198146046031271664502933027185697489699588559043338384466165001178426897626212945177628091195786707458122783970171784415105291802893207873272974885715430223118336.000000 ")
      (test (object->string (vector 1e308)) "#(1e+308)")))


(when full-test
  (let ()
    (define ctrl-chars (vector ;#\A #\S #\C #\F #\E #\G #\O #\D #\B #\X #\W
			#\, #\{ #\} #\@ #\P #\* #\< #\>
			#\a #\s #\c #\f #\e #\g #\o #\d #\b #\x #\p #\n #\w
			#\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9
			#\~ #\T #\& #\% #\^ #\|
			#\~ #\~ #\~ #\~ 
			#\, #\, #\, #\, #\" #\" #\\ #\'
			#\+ #\- #\@ #\. #\/ #\; #\:
			))
    (define ctrl-chars-len (length ctrl-chars))
    
    (define (test-chars)
      (do ((size 1 (+ size 1)))
	  ((= size 7))
	(let ((tries (* size size 10000)))
	  (format *stderr* "~D " size)
	  (let ((ctrl-str (make-string (+ size 1)))
		(x 12)
		(y '(1 2))
		(z #\a))
	    (string-set! ctrl-str 0 #\~)
	    (do ((i 0 (+ i 1)))
		((= i tries))
	      (do ((j 1 (+ j 1)))
		  ((> j size))
		(string-set! ctrl-str j (vector-ref ctrl-chars (random ctrl-chars-len))))
					;(format *stderr* "~S " ctrl-str)
					;(catch #t (lambda () (format *stderr* "~S: ~A~%" ctrl-str (format #f ctrl-str))) (lambda arg 'error))
					;(catch #t (lambda () (format *stderr* "~S ~A: ~A~%" ctrl-str x (format #f ctrl-str x))) (lambda arg 'error))
					;(catch #t (lambda () (format *stderr* "~S ~A: ~A~%" ctrl-str y (format #f ctrl-str y))) (lambda arg 'error))
					;(catch #t (lambda () (format *stderr* "~S ~A: ~A~%" ctrl-str z (format #f ctrl-str z))) (lambda arg 'error)))))
	      (catch #t (lambda () (format #f ctrl-str)) (lambda arg 'error))
	      (catch #t (lambda () (format #f ctrl-str x)) (lambda arg 'error))
	      (catch #t (lambda () (format #f ctrl-str y)) (lambda arg 'error))
	      (catch #t (lambda () (format #f ctrl-str z)) (lambda arg 'error))
	      (catch #t (lambda () (format #f ctrl-str x x)) (lambda arg 'error))
	      (catch #t (lambda () (format #f ctrl-str x y)) (lambda arg 'error))
	      (catch #t (lambda () (format #f ctrl-str y z)) (lambda arg 'error))
	      (catch #t (lambda () (format #f ctrl-str x y z)) (lambda arg 'error)))))
	))
    (test-chars)))


(test (reverse (format #f "~{~A~}" '((1 2) (3 4)))) ")4 3()2 1(")
(test (string->symbol (format #f "~A" '(1 2))) (symbol "(1 2)"))

(test (string->number (format #f "~A" -1)) -1)
(test (string->number (format #f "~S" -1)) -1)
(test (string->number (format #f "~F" -1)) -1)
(test (string->number (format #f "~D" -1)) -1)
(test (string->number (format #f "~G" -1)) -1)
(test (string->number (format #f "~E" -1)) -1)
(test (string->number (format #f "~B" -1)) -1)
(test (string->number (format #f "~X" -1)) -1)
(test (string->number (format #f "~O" -1)) -1)
(num-test (string->number (format #f "~A" 1.5)) 1.5)
(num-test (string->number (format #f "~S" 1.5)) 1.5)
(num-test (string->number (format #f "~F" 1.5)) 1.5)
(num-test (string->number (format #f "~D" 1.5)) 1.5)
(num-test (string->number (format #f "~G" 1.5)) 1.5)
(num-test (string->number (format #f "~E" 1.5)) 1.5)
(num-test (string->number (format #f "~B" 1.5)) 1.1)
(num-test (string->number (format #f "~X" 1.5)) 1.8)
(num-test (string->number (format #f "~O" 1.5)) 1.4)
(num-test (string->number (format #f "~A" 1+1i)) 1+1i)
(num-test (string->number (format #f "~S" 1+1i)) 1+1i)
(num-test (string->number (format #f "~F" 1+1i)) 1+1i)
(num-test (string->number (format #f "~D" 1+1i)) 1+1i)
(num-test (string->number (format #f "~G" 1+1i)) 1+1i)
(num-test (string->number (format #f "~E" 1+1i)) 1+1i)
(num-test (string->number (format #f "~B" 1+1i)) 1+1i)
(num-test (string->number (format #f "~X" 1+1i)) 1+1i)
(num-test (string->number (format #f "~O" 1+1i)) 1+1i)
(test (string->number (format #f "~A" 3/4)) 3/4)
(test (string->number (format #f "~S" 3/4)) 3/4)
(test (string->number (format #f "~F" 3/4)) 3/4)
(test (string->number (format #f "~D" 3/4)) 3/4)
(test (string->number (format #f "~G" 3/4)) 3/4)
(test (string->number (format #f "~E" 3/4)) 3/4)
(test (string->number (format #f "~B" 3/4)) 11/100)
(test (string->number (format #f "~X" 3/4)) 3/4)
(test (string->number (format #f "~O" 3/4)) 3/4)
(num-test (string->number (format #f "~A" 0+1i)) 0+1i)
(num-test (string->number (format #f "~S" 0+1i)) 0+1i)
(num-test (string->number (format #f "~F" 0+1i)) 0+1i)
(num-test (string->number (format #f "~D" 0+1i)) 0+1i)
(num-test (string->number (format #f "~G" 0+1i)) 0+1i)
(num-test (string->number (format #f "~E" 0+1i)) 0+1i)
(num-test (string->number (format #f "~B" 0+1i)) 0+1i)
(num-test (string->number (format #f "~X" 0+1i)) 0+1i)
(num-test (string->number (format #f "~O" 0+1i)) 0+1i)

(test (format "~G" 1e10) (if (not with-windows) "1e+10" "1e+010"))
(test (format "~F" 1e10) "10000000000.000000")
(test (format "~E" 1e10) (if (not with-windows) "1.000000e+10" "1.000000e+010"))
(test (format "~A" 1e10) "10000000000.0")
(test (format "~D" 1e10) (if (not with-windows) "1.000000e+10" "1.000000e+010"))

(test (format #f "~P{T}'" 1) "{T}'")
(test (format #f "~") 'error)
(test (format #f "~B&B~X" 1.5 1.5) "1.1&B1.8")
(test (format #f ",~~~A~*1" 1 1) ",~11")
(test (format #f "~D~20B" 0 0) "0                   0")
(test (format #f "~D~20B" 1 1) "1                   1")
(test (format #f "~10B" 1) "         1")
(test (format #f "~10B" 0) "         0")
(test (format #f "~100B" 1) "                                                                                                   1")
(test (length (format #f "~1000B" 1)) 1000)
(test (format #f "~D~20D" 3/4 3/4) "3/4                 3/4")
(test (length (format #f "~20D" 3/4)) 20)
(test (format #f "~20B" 3/4) "              11/100")
(test (length (format #f "~20B" 3/4)) 20)
(test (format #f "~D~20B" 3/4 3/4) "3/4              11/100")
(test (format #f "~X~20X" 21/33 21/33) "7/b                 7/b")
(test (format #f "~D~20,'.B" 3/4 3/4) "3/4..............11/100")
(test (format #f "~20g" 1+i) "                1+1i")
(test (length (format #f "~20g" 1+i)) 20)
(test (format #f "~20f" 1+i) "  1.000000+1.000000i")
(test (length (format #f "~20f" 1+i)) 20)
(test (format #f "~20x" 17+23i) "          11.0+17.0i")
(test (length (format #f "~20x" 17+23i)) 20)

(test (format #f "~{~{~A~^~} ~}" (hash-table '((a . 1) (b . 2)))) "(a . 1)(b . 2) ")
(test (format #f "~{~{~A~^~}~^~}" (hash-table '((a . 1) (b . 2)))) "(a . 1)(b . 2)")
(test (format #f "~{~{~A~^ ~}~^~}" (hash-table '((a . 1) (b . 2)))) "(a . 1) (b . 2)")
(test (format #f "~{~{~{~A~^~} ~}~}" #(())) "")
(test (format #f "~{~{~{~P~^~} ~}~}" '((()))) " ")
(test (format #f "~{~{~{~P~^~}~}~}" '(((2 3 4)))) "sss")
(test (apply format #f "~T~~{~{~{~*~~0~1~*~}~@~}" '(())) "~{")
(test (format #f "~{~S}%~}" '(a b c)) "a}%b}%c}%")
(test (format #f "~&~^%~F." 0) "%0.")
(test (format #f "1~^2") "1")
(test (apply format #f "~P~d~B~~" '(1 2 3)) "211~")
(test (format #f "~T1~~^~P" 0) "1~^s")
(test (format #f "~S~^~{~^" '(+ x 1)) "(+ x 1)")
(test (format #f "1~^~{2") "1")
(test (format #f "~A~{~0~g~@~B~}" () ()) "()")
(test (format #f "1~^~^~^2") "1")
(test (format #f "~{~{~~}~~,~}~*" '(()) '(())) "~,")
(test (format #f "~~S~S~T~~C~g~~" 0 0) "~S0~C0~")
(test (format #f "~{~~e~}~~{~*~~" "" "") "~{~")

(let ()
  (define* (clean-string e (precision 3))
    (format #f (format #f "(~~{~~,~DF~~^ ~~})" precision) e))
  (test (clean-string '(1.123123 -2.31231323 3.141592653589 4/3) 1) "(1.1 -2.3 3.1 4/3)")
  (test (clean-string '(1.123123 -2.31231323 3.141592653589 4/3)) "(1.123 -2.312 3.142 4/3)")
  (test (clean-string '(1.123123 -2.31231323 3.141592653589 4/3) 6) "(1.123123 -2.312313 3.141593 4/3)"))

(when with-bignums
  (test (format #f "~P" (bignum "1")) "")
  (test (format #f "~P" (bignum "1.0")) "")
  (test (format #f "~P" (bignum "2")) "s")
  (test (format #f "~P" (bignum "2.0")) "s")
  (test (format #f "~10,' D" (bignum "1")) "         1")
  (test (format #f "~10,' D" (bignum "3/4")) "       3/4")
  (test (format #f "~10,'.D" (bignum "3/4")) ".......3/4")
  (test (format #f "~10D" (bignum "3/4")) "       3/4")
  (test (length (format #f "~100D" (bignum "34"))) 100)
  (test (format #f "~50F" (bignum "12345678.7654321")) "                                1.23456787654321E7"))


(call-with-output-file tmp-output-file (lambda (p) (format p "this ~A ~C test ~D" "is" #\a 3)))
(let ((res (call-with-input-file tmp-output-file (lambda (p) (read-line p)))))
  (if (not (string=? res "this is a test 3"))
      (begin 
	(display "call-with-input-file + format to \"tmp1.r5rs\" ... expected \"this is a test 3\", but got \"")
	(display res) (display "\"?") (newline))))

(let ((val (format #f "line 1~%line 2~%line 3")))
  (with-input-from-string val
    (lambda ()
      (let ((line1 (read-line)))
	(test (string=? line1 "line 1") #t))
      (let ((line2 (read-line)))
	(test (string=? line2 "line 2") #t))
      (let ((line3 (read-line)))
	(test (string=? line3 "line 3") #t))
      (let ((eof (read-line)))
	(test (eof-object? eof) #t))
      (let ((eof (read-line)))
	(test (eof-object? eof) #t)))))

(test (display 3 #f) 3)
(test (write 3 #f) 3)

(let ((val (format #f "line 1~%line 2~%line 3")))
  (call-with-input-string val
			  (lambda (p)
			    (let ((line1 (read-line p #t)))
			      (test (string=? line1 (string-append "line 1" (string #\newline))) #t))
			    (let ((line2 (read-line p #t)))
			      (test (string=? line2 (string-append "line 2" (string #\newline))) #t))
			    (let ((line3 (read-line p #t)))
			      (test (string=? line3 "line 3") #t))
			    (let ((eof (read-line p #t)))
			      (test (eof-object? eof) #t))
			    (let ((eof (read-line p #t)))
			      (test (eof-object? eof) #t)))))

(let ((res #f)) 
  (let ((this-file (open-output-string))) 
    (format this-file "this ~A ~C test ~D" "is" #\a 3)
    (set! res (get-output-string this-file))
    (close-output-port this-file))
  (if (not (string=? res "this is a test 3"))
      (begin 
	(display "open-output-string + format ... expected \"this is a test 3\", but got \"")
	(display res) (display "\"?") (newline))))

(test (with-output-to-string (lambda () (display 123) (flush-output-port))) "123")
(test (with-output-to-string (lambda () (display 123) (flush-output-port) (display 124))) "123124")

(test (call-with-output-string
       (lambda (p)
	 (write 1 p)
	 (display 2  p)
	 (format p "~D" 3)
	 (write-byte (char->integer #\4) p)
	 (write-char #\5 p)
	 (write-string "6" p)
	 (write 1 #f)
	 (display 2 #f)
	 (format #f "~D" 3)
	 (write-byte (char->integer #\4) #f)
	 (write-char #\5 #f)
	 (write-string "6" #f)))
      "123456")

(test (write-byte most-positive-fixnum #f) 'error)
(test (write-byte -1 #f) 'error)
(test (write-byte 256 #f) 'error)

(let ((res #f)) 
  (let ((this-file (open-output-string))) 
    (format this-file "this is a test")
    (set! res (get-output-string this-file))
    (if (not (string=? res "this is a test"))
	(format #t "open-output-string + format expected \"this is a test\", but got ~S~%" res))
    (flush-output-port this-file)
    (set! res (get-output-string this-file))
    (if (not (string=? res "this is a test"))
	(format #t "flush-output-port of string port expected \"this is a test\", but got ~S~%" res))
    (format this-file "this is a test")
    (set! res (get-output-string this-file))
    (if (not (string=? res "this is a testthis is a test"))
	(format #t "open-output-string after flush expected \"this is a testthis is a test\", but got ~S~%" res))
    (close-output-port this-file)
    (test (flush-output-port this-file) this-file)))

(test (flush-output-port "hiho") 'error)
(test (flush-output-port *stdin*) 'error)

(call-with-output-file tmp-output-file
  (lambda (p)
    (format p "123456~%")
    (format p "67890~%")
    (flush-output-port p)
    (test (call-with-input-file tmp-output-file
	    (lambda (p)
	      (read-line p)))
	  "123456")
    (close-output-port p)))
    
(let ((res1 #f)
      (res2 #f)
      (res3 #f))
  (let ((p1 (open-output-string)))
    (format p1 "~D" 0)
    (let ((p2 (open-output-string)))
      (format p2 "~D" 1)
      (let ((p3 (open-output-string)))
	(if (not (string=? (get-output-string p1) "0"))
	    (format #t ";format to nested ports, p1: ~S~%" (get-output-string p1)))	
	(if (not (string=? (get-output-string p2) "1"))
	    (format #t ";format to nested ports, p2: ~S~%" (get-output-string p2)))	
	(format p3 "~D" 2)
	(format p2 "~D" 3)
	(format p1 "~D" 4)
	(format p3 "~D" 5)
	(set! res3 (get-output-string p3))
	(close-output-port p3)
	(if (not (string=? (get-output-string p1) "04"))
	    (format #t ";format to nested ports after close, p1: ~S~%" (get-output-string p1)))	
	(if (not (string=? (get-output-string p2) "13"))
	    (format #t ";format to nested ports after close, p2: ~S~%" (get-output-string p2))))
      (format (or p1 p3) "~D" 6)
      (format (and p1 p2) "~D" 7)
      (set! res1 (get-output-string p1))
      (close-output-port p1)
      (if (not (string=? (get-output-string p2) "137"))
	  (format #t ";format to nested ports after 2nd close, p2: ~S~%" (get-output-string p2)))
      (format p2 "~D" 8)
      (set! res2 (get-output-string p2))
      (test (get-output-string p1) 'error)
      (test (get-output-string p2 "hi") 'error)
      (close-output-port p2)))
  (if (not (string=? res1 "046"))
      (format #t ";format to nested ports, res1: ~S~%" res1))
  (if (not (string=? res2 "1378"))
      (format #t ";format to nested ports, res2: ~S~%" res2))
  (if (not (string=? res3 "25"))
      (format #t ";format to nested ports, res3: ~S~%" res3)))

(test (call/cc (lambda (return) 
		 (let ((val (format #f "line 1~%line 2~%line 3")))
		   (call-with-input-string val
					   (lambda (p) (return "oops"))))))
      "oops")

(test (get-output-string #f 64) 'error)

;(format #t "format #t: ~D" 1)
;(format (current-output-port) " output-port: ~D! (this is testing output ports)~%" 2)

(call-with-output-file tmp-output-file
  (lambda (p)
    (display 1 p)
    (write 2 p)
    (write-char #\3 p)
    (format p "~D" 4)
    (write-byte (char->integer #\5) p)
    (call-with-output-file "tmp2.r5rs"
      (lambda (p)
	(display 6 p)
	(write 7 p)
	(write-char #\8 p)
	(format p "~D" 9)
	(write-byte (char->integer #\0) p)
	(newline p)))
    (call-with-input-file "tmp2.r5rs"
      (lambda (pin)
	(display (read-line pin) p)))
    (newline p)))

(test (call-with-input-file tmp-output-file
	(lambda (p)
	  (read-line p)))
      "1234567890")

(call-with-output-file tmp-output-file
  (lambda (p)
    (format p "12345~%")
    (format p "67890~%")))

(call-with-input-file tmp-output-file
  (lambda (p)
    (test (read-char p) #\1)
    (test (read-byte p) (char->integer #\2))
    (test (peek-char p) #\3)
    (if (not pure-s7) (test (char-ready? p) #t))
    (test (read-line p) "345")
    (test (read-line p) "67890")))

(call-with-output-file tmp-output-file
  (lambda (p)
    (write-string "123" p)
    (write-string "" p)
    (write-string "456\n789" p)))

(call-with-input-file tmp-output-file
  (lambda (p)
    (test (read-line p) "123456")
    (test (read-char p) #\7)
    (test (read-char p) #\8)
    (test (read-char p) #\9)
    (test (eof-object? (read-char p)) #t)))
    
(test (with-output-to-string
	(lambda ()
	  (write-string "123")
	  (write-string "")
	  (write-string "456")))
      "123456")

(test (with-output-to-string
	(lambda ()
	  (write-string "123" (current-output-port))
	  (write-string "" (current-output-port))
	  (write-string "456" (current-output-port))
	  (write-string "678" (current-output-port) 1)
	  (write-string "679" (current-output-port) 2 3)
	  (write-string "079" (current-output-port) 0 1)
	  (write-string "123" (current-output-port) 0 3)
	  (write-string "123" (current-output-port) 3 3)
	  (write-string "" (current-output-port) 0 0)
	  (write-string "1423" (current-output-port) 1 1) ; 1.3.3: end is exclusive, if start=end, empty result
	  (write-string "1423" (current-output-port) 1 4/2)
	  (write-string "5423" (current-output-port) -0 1)))
      "123456789012345")

(test (write-string "12345" -1) 'error)
(test (write-string "12345" 0 -1) 'error)
(test (write-string "12345" 0 18) 'error)
(test (write-string "12345" 18) 'error)
(test (write-string "12345" 2 1) 'error)
(test (write-string "12345" 5 5) 'error)
(test (write-string "12345" 0.0 2) 'error)
(test (write-string "12345" 0 2.0) 'error)
(test (write-string "12345" 0 1+i) 'error)
(test (write-string "12345" 0 2/3) 'error)
(test (write-string "12345" 0 #\a) 'error)
(test (write-string "12345" #\null) 'error)
(test (write-string "12345" most-negative-fixnum) 'error)
(test (write-string "12345" 0 most-positive-fixnum) 'error)
(test (write-string "12345" 0 4294967296) 'error)
(test (write-string "a" #f 1) "")
(test (write-string "abc" #f 3) "")
(test (write-string "ab" #f 1) "b")
(test (write-string "ab" #f 2) "")
(test (write-string "abc" #f 1 2) "b")
(test (write-string "abc" #f 1 3) "bc")

(test (with-input-from-string "12345" (lambda () (read-string 3))) "123")
(test (with-input-from-string "" (lambda () (read-string 3))) #<eof>)
(test (with-input-from-string "" (lambda () (read-string 0))) "")
(test (with-input-from-string "1" (lambda () (read-string 0))) "")
(test (with-input-from-string "1" (lambda () (read-string -1))) 'error)
(test (with-input-from-string "1" (lambda () (read-string #f))) 'error)
(test (with-input-from-string "123" (lambda () (read-string 10))) "123")
(test (call-with-input-string "123" (lambda (p) (read-string 2 p))) "12")
(test (call-with-input-string "123" (lambda (p) (read-string 2 #f))) 'error)
(test (call-with-input-string "123" (lambda (p) (read-string 2 (current-output-port)))) 'error)
(test (call-with-input-string "123" (lambda (p) (read-string 0 #<unspecified>))) 'error)
(test (call-with-input-string "123" (lambda (p) (read-string 0 123))) 'error)

(test (read-string most-positive-fixnum) 'error)
(test (read-string -1) 'error)
(test (read-string most-negative-fixnum) 'error)
;(test (read-string 0) "")
; (test (read-string 123) "")
; s7 considers this file (during load) to be the current-input-file, so the above read-string ruins the load
; the other choice is to hang (waiting for stdin)
; perhaps this choice should be documented since it is specifically contrary to r7rs

(test (write 1 (current-input-port)) 'error)
(test (write-char #\a (current-input-port)) 'error)
(test (write-byte 0 (current-input-port)) 'error)
(test (read (current-output-port)) 'error)
(test (read-char (current-output-port)) 'error)
(test (read-byte (current-output-port)) 'error)
(test (read-line (current-output-port)) 'error)
(test (display 3) 3)
(test (display 3 #f) 3)

(when (not pure-s7)
  (let ((op1 (set-current-output-port (open-output-file tmp-output-file))))
    (display 1)
    (write 2)
    (write-char #\3)
    (format #t "~D" 4) ; #t -> output port
    (write-byte (char->integer #\5))
    (let ((op2 (set-current-output-port (open-output-file "tmp2.r5rs"))))
      (display 6)
      (write 7)
      (write-char #\8)
      (format #t "~D" 9)
      (write-byte (char->integer #\0))
      (newline)
      (close-output-port (current-output-port))
      (set-current-output-port op2)
      (let ((ip1 (set-current-input-port (open-input-file "tmp2.r5rs"))))
	(display (read-line))
	(close-input-port (current-input-port))
	(set-current-input-port ip1))
      (newline)
      (close-output-port (current-output-port)))

    (set-current-output-port #f)
    (test (string? (format #t "~%")) #t)
    (write "write: should not appear" #f) (newline #f)
    (display "display: should not appear" #f) (newline #f)
    (format #f "format: should not appear") (newline #f)
    (write-string "write-string: should not appear" #f) (newline #f)
    (write-char #\! #f)
    (write-byte 123 #f)

    (write "write: should not appear" (current-output-port)) (newline (current-output-port))
    (display "display: should not appear" (current-output-port)) (newline (current-output-port))
    (format (current-output-port) "format: should not appear") (newline (current-output-port))
    (write-string "write-string: should not appear" (current-output-port)) (newline (current-output-port))
    (write-char #\! (current-output-port))
    (write-byte 123 (current-output-port))

    (write "write: should not appear") (newline)
    (display "display: should not appear") (newline)
    (format #t "format: should not appear") (newline)
    (write-string "write-string: should not appear") (newline)
    (write-char #\!)
    (write-byte 123)

    (set-current-output-port op1))

  (let ((op1 (open-output-file tmp-output-file)))
    (let-temporarily (((current-output-port) op1))
      (display 1)
      (write 2)
      (write-char #\3)
      (format #t "~D" 4) ; #t -> output port
      (write-byte (char->integer #\5))
      (let ((op2 (open-output-file "tmp2.r5rs")))
	(let-temporarily (((current-output-port) op2))
	  (display 6)
	  (write 7)
	  (write-char #\8)
	  (format #t "~D" 9)
	  (write-byte (char->integer #\0))
	  (newline)
	  (close-output-port (current-output-port)))
	(let ((ip1 (open-input-file "tmp2.r5rs")))
	  (let-temporarily (((current-input-port) ip1))
	    (display (read-line))
	    (close-input-port (current-input-port))))
	(newline)
	(close-output-port (current-output-port)))))

  (test (call-with-input-file tmp-output-file
	  (lambda (p)
	    (read-line p)))
	"1234567890"))

(for-each 
 (lambda (op)
   (for-each
    (lambda (arg)
      (test (op arg display) 'error))
    (list 1 1.0 1+i 2/3 'a-symbol (make-vector 3) '(1 2) (cons 1 2) abs #f #t :hi (if #f #f) (lambda (a) (+ a 1)))))
 (list call-with-output-file call-with-input-file
       call-with-output-string call-with-input-string
       with-input-from-string with-input-from-file
       with-output-to-file))

(for-each 
 (lambda (op)
   (for-each
    (lambda (arg)
      (test (op arg) 'error))
    (list 1 1.0 1+i 2/3 'a-symbol (make-vector 3) '(1 2) (cons 1 2) abs #f #t :hi (if #f #f) (lambda (a) (+ a 1)))))
 (list open-output-file open-input-file 
       open-input-string))

(for-each
 (lambda (op)
   (for-each 
    (lambda (arg)
      (test (op "hi" arg) 'error))
    (list "hi" 1 1.0 1+i 2/3 'a-symbol (make-vector 3) '(1 2) (cons 1 2) abs #t :hi (if #f #f) (lambda (a) (+ a 1)))))
 (list write display write-byte newline write-char 
       read read-char read-byte peek-char char-ready? read-line))

(for-each 
 (lambda (arg)
   (test (write-char arg) 'error)
   (test (write-byte arg) 'error)
   (test (read-char arg) 'error)
   (test (read-byte arg) 'error)
   (test (peek-char arg) 'error)
   (test (write-char #\a arg) 'error)
   (test (write-byte 1 arg) 'error))
 (list "hi" 1.0 1+i 2/3 'a-symbol (make-vector 3) '(1 2) (cons 1 2) abs #t :hi (if #f #f) (lambda (a) (+ a 1))))

(test (write-byte -1) 'error)
(test (write-byte most-positive-fixnum) 'error)
(test (write-byte 300) 'error)

(for-each 
 (lambda (arg)
   (test (write-string arg) 'error)
   (test (write-string "hi" arg) 'error))
 (list 1.0 1+i 2/3 'a-symbol (make-vector 3) '(1 2) (cons 1 2) abs #t :hi (if #f #f) (lambda (a) (+ a 1))))

(test (with-output-to-string (lambda () (newline #f))) "")
(test (with-output-to-string (lambda () (write-byte 95 #f))) "")
(test (with-output-to-string (lambda () (write-char #\a #f))) "")
(test (with-output-to-string (lambda () (write-string "a" #f))) "")
(test (with-output-to-string (lambda () (write "hiho" #f))) "")
(test (with-output-to-string (lambda () (display "hiho" #f))) "")
(test (with-output-to-string (lambda () (format #f "hiho"))) "")

(when (not pure-s7)
  (test (with-output-to-string
	  (lambda ()
	    (set! (current-output-port) #f)
	    (newline (current-output-port))
	    (write-byte 95 (current-output-port))
	    (write-char #\a (current-output-port))
	    (write-string "a" (current-output-port))
	    (write "hiho" (current-output-port))
	    (display "hiho" (current-output-port))
	    (format (current-output-port) "hiho")))
	"")
  (set! (current-output-port) *stdout*))

(for-each
 (lambda (op)
   (for-each
    (lambda (arg)
      (test (op arg) 'error))
    (list "hi" 1 1.0 1+i 2/3 'a-symbol (make-vector 3) '(1 2) (cons 1 2) abs :hi (if #f #f) (lambda (a) (+ a 1)))))
 (list set-current-input-port set-current-error-port set-current-output-port close-input-port close-output-port))

(let ((hi (open-output-string)))
  (test (get-output-string hi) "")
  (close-output-port hi)
  (test (get-output-string hi) 'error))

(test (open-output-string "hiho") 'error)
(test (with-output-to-string "hi") 'error)
(test (call-with-output-string "hi") 'error)

(test (get-output-string 1 2) 'error)
(test (get-output-string) 'error)
(for-each 
 (lambda (arg)
   (test (get-output-string arg) 'error))
 (list "hi" 1 1.0 1+i 2/3 'a-symbol (make-vector 3) '(1 2) (cons 1 2) abs :hi (if #f #f) (lambda (a) (+ a 1))))

(let ((p (open-output-string)))
  (write 123 p)
  (test (get-output-string p) "123")
  (write 124 p)
  (test (get-output-string p #t) "123124")
  (test (get-output-string p #t) "")
  (write 123 p)
  (test (get-output-string p) "123"))

;; since read of closed port will generate garbage, it needs to be an error,
;;   so I guess write of closed port should also be an error

(let ((hi (open-output-string)))
  (close-output-port hi)
  (for-each
   (lambda (op)
     (test-e (op hi) (object->string op) 'closed-port))
   (list (lambda (p) (display 1 p))
	 (lambda (p) (write 1 p))
	 (lambda (p) (write-char #\a p))
	 (lambda (p) (write-byte 0 p))
	 (lambda (p) (format p "hiho"))
	 (if pure-s7 newline set-current-output-port)
	 (if pure-s7 newline set-current-input-port)
	 set-current-error-port
	 newline)))

(let ((hi (open-input-string "hiho")))
  (test (get-output-string hi) 'error)
  (close-input-port hi)
  (for-each
   (lambda (op)
     (test-e (op hi) (object->string op) 'closed-port))
   (list read read-char read-byte peek-char read-line 
	 port-filename port-line-number
	 (if pure-s7 read-line char-ready?)
	 (if pure-s7 read-line set-current-output-port)
	 (if pure-s7 read-line set-current-input-port)
	 set-current-error-port
	 )))
  
(test (close-output-port (open-input-string "hiho")) 'error)
(test (close-input-port (open-output-string)) 'error)
(test (set! (port-filename) "hiho") 'error)
(test (set! (port-closed? (current-output-port)) "hiho") 'error)
(test (begin (close-output-port *stderr*) (port-closed? *stderr*)) #f)
(test (begin (close-output-port *stdout*) (port-closed? *stdout*)) #f)
(test (begin (close-input-port *stdin*) (port-closed? *stdin*)) #f)

(test (let ((str ""))
	(with-input-from-string "1234567890" (lambda ()
          (with-input-from-string "1234567890" (lambda ()
            (with-input-from-string "1234567890" (lambda ()
              (with-input-from-string "1234567890" (lambda ()
                (with-input-from-string "1234567890" (lambda ()
                  (with-input-from-string "1234567890" (lambda ()
                    (with-input-from-string "1234567890" (lambda ()
	              (set! str (string-append str (string (read-char))))))
	            (set! str (string-append str (string (read-char) (read-char))))))
	          (set! str (string-append str (string (read-char) (read-char) (read-char))))))
	        (set! str (string-append str (string (read-char) (read-char) (read-char) (read-char))))))
              (set! str (string-append str (string (read-char) (read-char) (read-char) (read-char) (read-char))))))
            (set! str (string-append str (string (read-char) (read-char) (read-char) (read-char) (read-char) (read-char))))))
          (set! str (string-append str (string (read-char) (read-char) (read-char) (read-char) (read-char) (read-char) (read-char))))))
	  str)
      "1121231234123451234561234567")

(let* ((new-error-port (open-output-string))
       (old-error-port (set-current-error-port new-error-port)))
  (catch #t
    (lambda ()
      (format #f "~R" 123))
    (lambda args
      (format (current-error-port) "oops")))
  (let ((str (get-output-string new-error-port)))
    (set-current-error-port old-error-port)
    (test str "oops")))

(let ((hi (open-input-string "hiho")))
  (for-each
   (lambda (op)
     (test-e (op hi) (object->string op) 'input-port))
   (list (lambda (p) (display 1 p))
	 (lambda (p) (write 1 p))
	 (lambda (p) (write-char #\a p))
	 (lambda (p) (write-byte 0 p))
	 (lambda (p) (format p "hiho"))
	 newline))
  (close-input-port hi))

(let ((hi (open-output-file tmp-output-file)))
  (write-byte 1 hi)
  (close-output-port hi)
  (test (write-byte 1 hi) 'error))

(let ((hi (open-output-string)))
  (for-each
   (lambda (op)
     (test-e (op hi) (object->string op) 'output-port))
   (list read read-char read-byte peek-char char-ready? read-line))
  (close-output-port hi))

(test (output-port? (current-error-port)) #t)
(test (and (not (null? (current-error-port))) (input-port? (current-error-port))) #f)

(call-with-output-file tmp-output-file
  (lambda (p)
    (test (get-output-string p) 'error)
    (do ((i 0 (+ i 1)))
	((= i 256))
      (write-byte i p))))

(call-with-input-file tmp-output-file
  (lambda (p)
    (test (get-output-string p) 'error)
    (call-with-exit
     (lambda (quit)
       (do ((i 0 (+ i 1)))
	   ((= i 256))
	 (let ((b (read-byte p)))
	   (if (or (not (number? b))
		   (not (= b i)))
	       (begin
		 (format #t "read-byte got ~A, expected ~A~%" b i)
		 (quit)))))))
    (let ((eof (read-byte p)))
      (if (not (eof-object? eof))
	  (format #t "read-byte at end: ~A~%" eof)))
    (let ((eof (read-byte p)))
      (if (not (eof-object? eof))
	  (format #t "read-byte at end: ~A~%" eof)))))

(call-with-output-file tmp-output-file
  (lambda (p)
    (do ((i 0 (+ i 1)))
	((= i 256))
      (write-char (integer->char i) p))))

(define our-eof #f)

(call-with-input-file tmp-output-file
  (lambda (p)
    (call-with-exit
     (lambda (quit)
       (do ((i 0 (+ i 1)))
	   ((= i 256))
	 (let ((b (read-char p)))
	   (if (or (not (char? b))
		   (not (char=? b (integer->char i))))
	       (begin
		 (format #t "read-char got ~A, expected ~A (~D: char? ~A)~%" b (integer->char i) i (char? (integer->char i)))
		 (quit)))))))
    (let ((eof (read-char p)))
      (if (not (eof-object? eof))
	  (format #t "read-char at end: ~A~%" eof))
      (set! our-eof eof))
    (let ((eof (read-char p)))
      (if (not (eof-object? eof))
	  (format #t "read-char again at end: ~A~%" eof)))))

(test (eof-object? (integer->char 255)) #f)
(test (eof-object? our-eof) #t)
(test (char->integer our-eof) 'error)
(test (char? our-eof) #f)
(test (eof-object? ((lambda () our-eof))) #t)

(for-each
 (lambda (op)
   (test (op *stdout*) 'error)
   (test (op *stderr*) 'error)
   (test (op (current-output-port)) 'error)
   (test (op (current-error-port)) 'error)
   (test (op ()) 'error))
 (list read read-line read-char read-byte peek-char char-ready?))

(for-each
 (lambda (op)
   (test (op #\a *stdin*) 'error)
   (test (op #\a (current-input-port)) 'error)
   (test (op #\a ()) 'error))
 (list write display write-char))
	 
(test (write-byte 0 *stdin*) 'error)
(test (write-byte (char->integer #\space) *stdout*) (char->integer #\space))
(test (write-byte (char->integer #\space) *stderr*) (char->integer #\space))
(test (newline *stdin*) 'error)
(test (format *stdin* "hiho") 'error)

(test (port-filename *stdin*) "*stdin*")	 
(test (port-filename *stdout*) "*stdout*")	 
(test (port-filename *stderr*) "*stderr*")	

(test (input-port? *stdin*) #t) 
(test (output-port? *stdin*) #f) 
(test (port-closed? *stdin*) #f)
(test (input-port? *stdout*) #f) 
(test (output-port? *stdout*) #t) 
(test (port-closed? *stdout*) #f)
(test (input-port? *stderr*) #f) 
(test (output-port? *stderr*) #t) 
(test (port-closed? *stderr*) #f)

(test (port-line-number *stdin*) 0)
(test (port-line-number *stdout*) 'error)
(test (port-line-number *stderr*) 'error)
(test (port-line-number ()) 'error) ; this used to be *stdin*?

(test (open-input-file "[*not-a-file!*]-") 'error)
(test (call-with-input-file "[*not-a-file!*]-" (lambda (p) p)) 'error)
(test (with-input-from-file "[*not-a-file!*]-" (lambda () #f)) 'error)

(test (open-input-file "") 'error)
(test (call-with-input-file "" (lambda (p) p)) 'error)
(test (with-input-from-file "" (lambda () #f)) 'error)

;(test (open-output-file "/bad-dir/badness/[*not-a-file!*]-") 'error)
;(test (call-with-output-file "/bad-dir/badness/[*not-a-file!*]-" (lambda (p) p)) 'error)
;(test (with-output-to-file "/bad-dir/badness/[*not-a-file!*]-" (lambda () #f)) 'error)

(with-output-to-file "tmp.r5rs"
  (lambda ()
    (write-char #\a)
    (with-output-to-file tmp-output-file
      (lambda ()
	(format #t "~C" #\b)
	(with-output-to-file "tmp2.r5rs"
	  (lambda ()
	    (display #\c)))
	(display (with-input-from-file "tmp2.r5rs"
		   (lambda ()
		     (read-char))))))
    (with-input-from-file tmp-output-file
      (lambda ()
	(write-byte (read-byte))
	(write-char (read-char))))))

(with-input-from-file "tmp.r5rs"
  (lambda ()
    (test (read-line) "abc")))

(with-input-from-file "tmp.r5rs" ; this assumes tmp.r5rs has "abc" as above
  (lambda ()
    (test (read-char) #\a)
    (test (eval-string "(+ 1 2)") 3)
    (test (read-char) #\b)
    (with-input-from-string "(+ 3 4)"
      (lambda ()
	(test (read) '(+ 3 4))))
    (test (read-char) #\c)))

(test (eval-string (object->string (with-input-from-string "(+ 1 2)" read))) 3)
(test (eval (eval-string "(with-input-from-string \"(+ 1 2)\" read)")) 3)
(test (eval-string "(eval (with-input-from-string \"(+ 1 2)\" read))") 3)
(test (eval-string (object->string (eval-string (format #f "(+ 1 2)")))) 3)


;;; -------- test that we can plow past errors --------

(if (and (defined? 'file-exists?) ; (ifdef name ...)?
	 (file-exists? "tests.data"))
    (delete-file "tests.data"))

(call-with-output-file "tests.data"
  (lambda (p)
    (format p "start ")
    (catch #t 
      (lambda () 
	(format p "next ") (abs "hi") (format p "oops "))
      (lambda args
	'error))
    (format p "done\n")))

(let ((str (call-with-input-file "tests.data" 
             (lambda (p) 
	       (read-line p)))))
  (if (or (not (string? str))
	  (not (string=? str "start next done")))
      (format #t ";call-with-output-file + error -> ~S~%" str)))

(let ((str (call-with-input-file "tests.data" 
             (lambda (p) 
	       (catch #t
		      (lambda ()
			(read-char p)
			(abs "hi")
			(read-char p))
		      (lambda args "s"))))))
  (if (or (not (string? str))
	  (not (string=? str "s")))
      (format #t ";call-with-input-file + error -> ~S~%" str)))

(if (and (defined? 'file-exists?)
	 (file-exists? "tests.data"))
    (delete-file "tests.data"))

(with-output-to-file "tests.data"
  (lambda ()
    (format #t "start ")
    (catch #t 
      (lambda () 
	(format #t "next ") (abs "hi") (format #t "oops "))
      (lambda args
	'error))
    (format #t "done\n")))

(let ((str (with-input-from-file "tests.data" 
             (lambda () 
	       (read-line)))))
  (if (or (not (string? str))
	  (not (string=? str "start next done")))
      (format #t ";with-output-to-file + error -> ~S~%" str)))

(let ((str (with-input-from-file "tests.data" 
             (lambda () 
	       (catch #t
		      (lambda ()
			(read-char)
			(abs "hi")
			(read-char))
		      (lambda args "s"))))))
  (if (or (not (string? str))
	  (not (string=? str "s")))
      (format #t ";with-input-from-file + error -> ~S~%" str)))

(test (call-with-output-string newline) (string #\newline))
(test (call-with-output-string append) "")

(let ((str (call-with-output-string
	    (lambda (p)
	      (format p "start ")
	      (catch #t 
		     (lambda () 
		       (format p "next ") (abs "hi") (format p "oops "))
		     (lambda args
		       'error))
	      (format p "done")))))
  (if (or (not (string? str))
	  (not (string=? str "start next done")))
      (format #t ";call-with-output-string + error -> ~S~%" str)))

(let ((str (with-output-to-string
	    (lambda ()
	      (format #t "start ")
	      (catch #t 
		     (lambda () 
		       (format #t "next ") (abs "hi") (format #t "oops "))
		     (lambda args
		       'error))
	      (format #t "done")))))
  (if (or (not (string? str))
	  (not (string=? str "start next done")))
      (format #t ";with-output-to-string + error -> ~S~%" str)))

(test (with-output-to-string (lambda () (format (current-output-port) "a test ~D" 123))) "a test 123")
;(test (with-output-to-string (lambda () (format *stdout* "a test ~D" 1234))) "a test 1234")

(test (string=? (with-output-to-string (lambda () (write #\null))) "#\\null") #t)
(test (string=? (with-output-to-string (lambda () (write #\space))) "#\\space") #t)
(test (string=? (with-output-to-string (lambda () (write #\return))) "#\\return") #t)
(test (string=? (with-output-to-string (lambda () (write #\escape))) "#\\escape") #t)
(test (string=? (with-output-to-string (lambda () (write #\tab))) "#\\tab") #t)
(test (string=? (with-output-to-string (lambda () (write #\newline))) "#\\newline") #t)
(test (string=? (with-output-to-string (lambda () (write #\backspace))) "#\\backspace") #t)
(test (string=? (with-output-to-string (lambda () (write #\alarm))) "#\\alarm") #t)
(test (string=? (with-output-to-string (lambda () (write #\delete))) "#\\delete") #t)

(test (string=? (with-output-to-string (lambda () (write-char #\space))) " ") #t)  ; weird -- the name is backwards
(test (string=? (with-output-to-string (lambda () (display #\space))) " ") #t)

(let ((str (call-with-input-string "12345"
	    (lambda (p)
	      (catch #t
		     (lambda ()
		       (read-char p)
		       (abs "hi")
		       (read-char p))
		     (lambda args "s"))))))
  (if (or (not (string? str))
	  (not (string=? str "s")))
      (format #t ";call-with-input-string + error -> ~S~%" str)))

(let ((str (with-input-from-string "12345"
	    (lambda ()
	      (catch #t
		     (lambda ()
		       (read-char)
		       (abs "hi")
		       (read-char))
		     (lambda args "s"))))))
  (if (or (not (string? str))
	  (not (string=? str "s")))
      (format #t ";with-input-from-string + error -> ~S~%" str)))

(for-each
 (lambda (arg)
   (test (port-line-number arg) 'error)
   (test (port-filename arg) 'error))
 (list "hi" -1 0 #\a 'a-symbol #(1 2 3) '(1 . 2) '(1 2 3) 3.14 3/4 1.0+1.0i #t abs #<eof> #<unspecified> (lambda () 1)))

(test (catch #t (lambda () (eval-string (port-filename))) (lambda args #f)) #f)
(test (symbol? (string->symbol (port-filename))) #t)

(for-each
 (lambda (arg)
   (test
    (with-input-from-string (format #f "~A" arg)
      (lambda ()
	(read)))
    arg))
 (list 1 3/4 '(1 2) #(1 2) :hi #f #t))

(num-test (with-input-from-string "3.14" read) 3.14)
(num-test (with-input-from-string "3.14+2i" read) 3.14+2i)
(num-test (with-input-from-string "#x2.1" read) 2.0625)
(test (with-input-from-string "'hi" read) ''hi)
(test (with-input-from-string "'(1 . 2)" read) ''(1 . 2))

(test
 (let ((cin #f)
       (cerr #f))
   (catch #t
	  (lambda ()
	    (with-input-from-string "123"
	      (lambda ()
		(set! cin (current-input-port))
		(error 'testing "jump out"))))
	  (lambda args
	    (set! cerr #t)))
   (format #f "~A ~A" cin cerr))
 "<input-string-port (closed)> #t")

;;; old form:  "<port string input (closed)> #t")

(test
 (let ((cp (current-output-port))
       (cout #f)
       (cerr #f))
   (catch #t
	  (lambda ()
	    (with-output-to-string
	      (lambda ()
		(set! cout (current-output-port))
		(error 'testing "jump out"))))
	  (lambda args
	    (set! cerr #t)))
   (format #f "~A ~A" cout cerr))
 "<output-string-port (closed)> #t")
(if (not (eq? *stdout* old-stdout))
    (format *stderr* ";~D: stdout clobbered~%" (port-line-number)))

;;; old form:  "<port string output (closed)> #t")

(let ((port (open-input-file #u8(115 55 116 101 115 116 46 115 99 109 0) #u8(114 0 98)))) ; "s7test.scm" "r\x00b"
  (test (input-port? port) #t) ; ??
  (close-input-port port))

(call-with-output-file tmp-output-file
  (lambda (p)
    (display "1" p)
    (newline p)
    (newline p)
    (display "2345" p)
    (newline p)))

(call-with-input-file tmp-output-file
  (lambda (p)
    (test (read-line p) "1")
    (test (read-line p) "")
    (test (read-line p) "2345")
    (test (eof-object? (read-line p)) #t)))

(let ((p (open-output-file tmp-output-file "a")))
  (display "678" p)
  (newline p)
  (close-output-port p))

(if (not with-windows) ; "xyzzy" is legit in windows??
    (begin
      (test (let ((p (open-output-file tmp-output-file "xyzzy"))) (close-output-port p)) 'error)
      (test (let ((p (open-input-file tmp-output-file "xyzzy"))) (close-input-port p)) 'error)))

(call-with-input-file tmp-output-file
  (lambda (p)
    (test (read-line p) "1")
    (test (read-line p) "")
    (test (read-line p) "2345")
    (test (read-line p) "678")
    (test (eof-object? (read-line p)) #t)))

(test (let ((a 1))
	(define-macro (m1) `(set! a (read)))
	(with-input-from-string "123" m1)
	a)
      123)

(test (let ((a 1))
	(define-macro (m3 p) `(set! a (read ,p)))
	(call-with-input-string "123" m3)
	a)
      123)
  
(test (let ()
	(define-macro (m1) `(define a (read)))
	(with-input-from-string "123" m1)
	a)
      123)

(test (let ()
	(define-macro (m3 p) `(define a (read ,p)))
	(call-with-input-string "123" m3)
	a)
      123)
  
(for-each
 (lambda (arg)
   (test (port-filename arg) 'error))
 (list "hi" -1 #\a 1 0 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #f #t () (list 1 2 3) '(1 . 2)))

(for-each
 (lambda (arg)
   (test (port-filename arg) 'error))
 (list "hi" -1 #\a 1 0 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #f #t () (list 1 2 3) '(1 . 2)))

(for-each
 (lambda (arg)
   (test (open-input-file "s7test.scm" arg) 'error)
   (test (open-output-file tmp-data-file arg) 'error))
 (list -1 #\a 1 0 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #f #t () (list 1 2 3) '(1 . 2)))

(test (current-input-port ()) 'error)
(test (current-output-port ()) 'error)
(test (current-error-port ()) 'error)

(for-each
 (lambda (op)
   (let ((tag (catch #t (lambda () (op)) (lambda args 'error))))
     (if (not (eq? tag 'error))
	 (format #t ";(~A) -> ~A (expected 'error)~%" op tag))))
 (list set-current-input-port set-current-error-port set-current-output-port 
       close-input-port close-output-port
       write display write-byte write-char format                     ; newline
       ;read read-char read-byte peek-char char-ready? read-line      ; these can default to current input
       call-with-output-file call-with-input-file
       call-with-output-string call-with-input-string
       with-input-from-string with-input-from-file
       with-output-to-file
       open-output-file open-input-file 
       open-input-string))

(for-each
 (lambda (op)
   (let ((tag (catch #t (lambda () (op 1 2 3 4 5)) (lambda args 'error))))
     (if (not (eq? tag 'error))
	 (format #t ";(~A 1 2 3 4 5) -> ~A (expected 'error)~%" op tag))))
 (list set-current-input-port set-current-error-port set-current-output-port 
       close-input-port close-output-port
       write display write-byte write-char format newline
       read read-char read-byte peek-char char-ready? read-line
       call-with-output-file call-with-input-file
       call-with-output-string call-with-input-string
       with-input-from-string with-input-from-file
       with-output-to-file
       open-output-file open-input-file 
       open-input-string))

;;; (string-set! (with-input-from-string "\"1234\"" read) 1 #\a)
(test (with-input-from-string "(+ 1 2)" read) '(+ 1 2))

(test (>= (length (with-output-to-string (lambda () (write (make-string 512 #\tab))))) 512) #t)
(test (>= (length (with-output-to-string (lambda () (write (make-string 512 #\newline))))) 512) #t)
(test (>= (length (with-output-to-string (lambda () (write (make-string 512 #\"))))) 512) #t)
(test (>= (length (with-output-to-string (lambda () (write (make-string 512 #\x65))))) 512) #t)

(if (and (defined? 'file-exists?)
	 (file-exists? "/home/bil/test"))
    (let-temporarily ((*load-path* (cons "/home/bil/test" *load-path*)))
      (with-output-to-file "/home/bil/test/load-path-test.scm"
	(lambda ()
	  (format #t "(define (load-path-test) *load-path*)~%")))

      (load "load-path-test.scm")
      (if (or (not (defined? 'load-path-test))
	      (not (equal? *load-path* (load-path-test))))
	  (format #t ";*load-path*: ~S, but ~S~%" *load-path* (load-path-test)))))

;;; function ports
(when with-block

  (let ((p (function-open-output)))
    (write-char #\a p)
    (let ((val (function-get-output p)))
      (function-close-output p)
      (if (not (string=? val "a"))
	  (format *stderr* ";function port write #\\a: ~S (~D, ~A)~%" val (length val) (string->vector val)))))
  
  (let ((p (function-open-output)))
    (display "123" p)
    (format p "4~D6" 5)
    (write-string "789" p)
    (write-byte (char->integer #\0) p)
    (newline p)
    (let ((val (function-get-output p)))
      (function-close-output p)
      (if (not (string=? val "1234567890\n"))
	  (format *stderr* ";function port outputs: ~S (~D, ~A)~%" val (length val) (string->vector val)))))
  
  (let ((str "0123"))
    (let ((p (function-open-input str)))
      (let ((val (read-char p)))
	(if (not (char=? val #\0))
	    (format *stderr* ";function port read #\\0: ~S~%" val)))))
  
  (let ((str "0123\n45678"))
    (let ((p (function-open-input str)))
      (let ((val (read-line p)))
	(if (not (string=? val "0123"))
	    (format *stderr* ";function port read-line: ~S~%" val))
	(set! val (read-byte p))
	(if (not (= val (char->integer #\4)))
	    (format *stderr* ";function port read-byte: ~S~%" val))
	(set! val (peek-char p))
	(if (not (char=? val #\5))
	    (format *stderr* ";function port peek-char: ~S~%" val))
	(set! val (read-string 2 p))
	(if (not (string=? val "56"))
	    (format *stderr* ";function port read-string: ~S~%" val))
	(if (and (not pure-s7)
		 (not (char-ready? p)))
	    (format *stderr* ";function port has no char ready?~%"))
	(close-input-port p)))))



;;; -------- poke at the reader --------

(test (cdr '(1 ."a")) "a")
(test '(1 .(2 3)) '(1 2 3))
(test '(1 .(2 3)) '(1 . (2 3)))
(test (+ .(2 .(3))) 5)
(test (cadr '(1 '0,)) ''0,)
(test (equal? 3 ' 3) #t)
(test (equal? '   
	             3 3) #t)
(test (equal? '"hi" ' "hi") #t)
(test (equal? '#\a '    #\a) #t)
(test (let ((nam()e 1)) 1) 'error)
(test (let ((nam""e 1)) nam""e) 'error) ; this was 1 originally
(test (cadr '(1 ']x)) '']x)
(test `1 1)
(test (equal? '(1 .(1 .())) '(1 1)) #t)
(test (equal? '("hi"."ho") ' ("hi" . "ho")) #t)
(test (equal? '("hi""ho") '("hi" "ho")) #t)
(test '("""""") '("" "" ""))
(test '(#|;"();|#) ())
(test '(#||##\# #||##b1) '(#\# 1))
(test (#|s'!'|#*) 1)
(test (#|==|#) ())
(test -#|==|#1 'error) ; unbound variable
(test '((). '()) '(() quote ()))
(test '(1. . .2) '(1.0 . 0.2))
(test (equal? '(().()) '(())) #t)
(test (equal? '(()()) '(() ())) #t)
(test (equal? '(()..()) '(() .. ())) #t)
(test '((().()).()) '((())))
(test '(((().()).()).()) '(((()))))
(test '((().(().())).()) '((() ())))
(test '((()().(().()))) '((() () ())))
(test '(1 .;
	  2) '(1 . 2))
(test (vector .(1 .(2))) #(1 2))
(test (vector 0. .(.1)) #(0.0 0.1))
(test '(a #|foo||# b) '(a b)) ; from bug-guile
(test '(a #|foo|||# b) '(a b))
(test '(a #|foo||||# b) '(a b))
(test '(a #|foo|||||# b) '(a b))

(test (let () (define (f' x) (+ x x)) (f' 10)) 20) ; from /r/scheme
(test (let () (define (f'' a'b) (+ a'b a'b)) (f'' 10)) 20)
(test (symbol? 'a'b) #t)

(test (char? #\#) #t)
(test (type-of (eval-string "'#<float-vector>")) 'undefined?)
(test (type-of (eval-string "'(#<float-vector>)")) 'pair?)
(test (car `(,.1e0)) .1)
(test (car `(,.1E0)) .1)
(test (let ((x "hi")) (set! x"asdf") x) "asdf")
(test (let* ((x "hi") (y x)) (set! x "asdf") y) "hi")
(test (let ((x 1)) (set! x(list 1 2)) x) '(1 2))
(num-test (let ((x 1)) (set!;"
			x;)
			12.;(
			);#|
	       x) 12.0)
(test (let ((\x00}< 1) (@:\t{ 2)) (+ \x00}< @:\t{)) 3)
(test (let ((| 1) (|| 2) (||| 3)) (+ || | |||)) 6)
(test (let ((|a#||#b| 1)) |a#||#b|) 1)
(test (let ((@,@'[1] 1) (\,| 2)) (+ @,@'[1] \,|)) 3)
(test (list"0"0()#()#\a"""1"'x(list)+(cons"""")#f) (list "0" 0 () #() #\a "" "1" 'x (list) + '("" . "") #f))
(test (let ((x, 1)) x,) 1)
(test (length (eval-string (string #\' #\( #\1 #\space #\. (integer->char 200) #\2 #\)))) 2) ; will be -1 if dot is for improper list, 3 if dot is a symbol
(test (+ `,0(angle ```,`11)) 0)
(test (map . (char->integer "123")) '(49 50 51))
(test (map .(values "0'1")) '(#\0 #\' #\1))
(test (map /""'(123)) ())
(num-test (+ 1 .()) 1)
(test (let () (define (x .()) (list .())) (x)) ())

(test '(1 . ()) '(1))
(test '(1 . (2)) '(1 2))
(test '(1 . (2) 3) '(1 2 3)) ; Guile says "missing close paren", sbcl says "More than one object follows . in list.", clisp: "illegal end of dotted list"
(test '(1 . (2 3) 4 5) '(1 2 3 4 5))
(test '(1 . (2) (3)) '(1 2 (3)))
(test '(1 2 . 'x 3) '(1 2 quote x 3))
(test (eval-string "'(1 . 2 3)") 'error)  ; eval-string here wraps up the read-error
(test '(1 . (2 . 3)) '(1 2 . 3))
(test (eval-string "'(1 . . ((2 3)))") 'error)
(test '((1 . 2) . (3 . 4)) '((1 . 2) 3 . 4))
(test (eval-string "'(1 . () 2)") 'error)
(test '(1 . (2) . (3)) '(1 2 3))
(test '(1 . (2 . (3))) '(1 2 3)) 

;; how is ...#(... parsed?
;(test (eval-string "'(# (1))") 'error)
(test (let ((lst (eval-string "'(#(1))"))) (and (= (length lst) 1) (vector? (car lst)))) #t)                     ; '(#(1))
(test (let ((lst (eval-string "'(-#(1))"))) (and (= (length lst) 2) (symbol? (car lst)) (pair? (cadr lst)))) #t) ; '(-# (1))
(test (let ((lst (eval-string "'(1#(1))"))) (and (= (length lst) 2) (symbol? (car lst)) (pair? (cadr lst)))) #t) ; '(1# (1))
(test (let ((lst (eval-string "'('#(1))"))) (and (= (length lst) 1) (vector? (cadar lst)))) #t)                  ; '((quote #(1)))
(test (let ((lst (eval-string "'(()#())"))) (and (= (length lst) 2) (null? (car lst)) (vector? (cadr lst)))) #t) ; '(() #())
(test (let ((lst (eval-string "'(().())"))) (and (= (length lst) 1) (null? (car lst)))) #t)                      ; '(())
(test (let ((lst (eval-string "'(()-())"))) (and (= (length lst) 3) (null? (car lst)) (null? (caddr lst)))) #t)  ; '(() - ())
(test (let ((lst (eval-string "'(().#())"))) (and (= (length lst) 3) (null? (car lst)) (null? (caddr lst)))) #t) ; '(() .# ())
(test (let ((lst (eval-string "'((). #())"))) (and (= (length lst) -1) (null? (car lst)) (vector? (cdr lst)))) #t) ; '(() . #())
(test (let ((lst (eval-string "'(\"\"#())"))) (and (= (length lst) 2) (string? (car lst)) (vector? (cadr lst)))) #t) ; '("" #())
(test (length (car '("#\\("))) 3)
(test (length (car '("#\\\""))) 3)
(test (char=? ((car '("#\\\"")) 2) #\") #t)
(test (length '(()#\(())) 3)
(test (length (eval-string "'(()#\\(())")) 3)
(test (char=? ((eval-string "'(()#\\#())") 1) #\#) #t)
(test (length (list""#t())) 3)
(test (length (list""#())) 2)
(test (length (eval-string "'(#xA(1))")) 2)
(test (length '(#xA""#(1))) 3)
(test (length (eval-string "'(#xA\"\"#(1))")) 3)
(test (length (eval-string "'(1#f)")) 1)
;(test (eval-string "'(#f#())") 'error)
(test (length '(#f())) 2)
(test (length '(#f"")) 2)
(test (eq? #f (eval-string "#F")) #f)
;(test (eval-string "'(#<eof>#<eof>)") 'error)
;(test (eval-string "'(#<eof>#())") 'error)
(test (equal? '('#()) '(#())) #f)
(test (equal? (list #()) '(#())) #t)
(test (equal? '(#()) '(#())) #t)
(test (equal? '('#()) '(`#())) #f) ;  [guile agrees]
(test (equal? '('()) '(`())) #f) ; ! quote != quasiquote [guile agrees]
(test (equal? '('(1)) '(`(1))) #t) ;  but lists are different? [guile says #f]
(test (equal? '('#(1)) '(`#(1))) #f) ; [guile agrees]
(test (equal? '('#()) '(#())) #f)
(test (equal? '(`#()) '(`#())) #t)
(test (equal? #() `#()) #t)
(test (equal? (list #()) (list `#())) #t)
(test (equal? (list #()) '(`#())) #t)
(test (equal? '(`#()) '(#())) #t)
(test (equal? `#() #()) #t) ; and also (1) () #(1) etc
(test (equal? `#() '#()) #t) ; "
(test (equal? '`#() ''#()) #f) ; it equals #() -- this is consistent -- see below
(test (equal? '`#() ``#()) #t)

(test (equal? '() '()) #t)
(test (equal? (quote ()) '()) #t)
(test (equal? '() (quote ())) #t)
(test (equal? (quote ()) (quote ())) #t)
(test (equal? `(1) '(1)) #t)
(test (equal? (quasiquote (1)) '(1)) #t)
(test (equal? `(1) (quote (1))) #t)
(test (equal? (quasiquote (1)) (quote (1))) #t)
(test (equal? ``''1 '``'1) #t)
(test (equal? (quasiquote `(quote (quote 1))) '``'1) #t)
(test (equal? ``''1 (quote ``(quote 1))) #t)
(test (equal? (quasiquote `(quote (quote 1))) (quote ``(quote 1))) #t)
(test (equal? '``'#f ```'#f) #t)
(test (equal? (quote ``(quote #f)) ```'#f) #t)
(test (equal? '``'#f (quasiquote ``(quote #f))) #t)
(test (equal? (quote ``(quote #f)) (quasiquote ``(quote #f))) #t)
;;; etc:

#|
(equal? (quote `1) (quote (quasiquote 1))) -> #f
the reader sees `1 and turns it into 1 in the first case, but does not collapse the 2nd case to 1
  (who knows, quasiquote might have been redefined in context... but ` can't be redefined):
:(define (` a) a)
;define: define a non-symbol? 'a
;    (define ('a) a)

this is different from guile which does not handle ` at read time except to expand it:

guile> (quote `1) 
(quasiquote 1)

:(quote `1)
1

so anything that quotes ` is not going to equal quote quasiquote

(define (check-strs str1 str2)
  (for-each
   (lambda (arg)
     (let ((expr (format #f "(equal? ~A~A ~A~A)" str1 arg str2 arg)))
       (let ((val (catch #t 
			 (lambda () (eval-string expr))
			 (lambda args 'error))))
	 (format #t "--------~%~S -> ~S" expr val)
	 (let* ((parens3 0)
		(parens4 0)
		(str3 (apply string-append (map (lambda (c)
						 (if (char=? c #\`)
						     (if (= parens3 0)
							 (begin
							   (set! parens3 (+ parens3 1))
							   "(quasiquote ")
							 "`")
						     (if (char=? c #\')
							 (begin
							   (set! parens3 (+ parens3 1))
							   "(quote ")
							 (string c))))
						str1)))
		(str4 (apply string-append (map (lambda (c)
						 (if (char=? c #\`)
						     (if (= parens4 0)
							 (begin
							   (set! parens4 (+ parens4 1))
							   "(quasiquote ")
							 "`")
						     (if (char=? c #\')
							 (begin
							   (set! parens4 (+ parens4 1))
							   "(quote ")
							 (string c))))
						str2))))
	   (let ((expr (format #f "(equal? ~A~A~A ~A~A)" str3 arg (make-string parens3 #\)) str2 arg)))
	     (let* ((val1 (catch #t 
			       (lambda () (eval-string expr))
			       (lambda args 'error)))
		    (trouble (and (not (eq? val1 'error))
				  (not (eq? val1 val)))))
	       (if trouble
		   (format #t "~%~8T~A~S -> ~S~A" bold-text expr val1 unbold-text)
		   (format #t "~%~8T~S -> ~S" expr val1))))
	   (let ((expr (format #f "(equal? ~A~A ~A~A~A)" str1 arg str4 arg (make-string parens4 #\)))))
	     (let* ((val1 (catch #t 
			       (lambda () (eval-string expr))
			       (lambda args 'error)))
		    (trouble (and (not (eq? val1 'error))
				  (not (eq? val1 val)))))
	       (if trouble
		   (format #t "~%~8T~A~S -> ~S~A" bold-text expr val1 unbold-text)
		   (format #t "~%~8T~S -> ~S" expr val1))))
	   (let ((expr (format #f "(equal? ~A~A~A ~A~A~A)" str3 arg (make-string parens3 #\)) str4 arg (make-string parens4 #\)))))
	     (let* ((val1 (catch #t 
			       (lambda () (eval-string expr))
			       (lambda args 'error)))
		    (trouble (and (not (eq? val1 'error))
				  (not (eq? val1 val)))))
	       (if trouble
		   (format #t "~%~8T~A~S -> ~S~A~%" bold-text expr val1 unbold-text)
		   (format #t "~%~8T~S -> ~S~%" expr val1))))
	   ))))
   (list "()" "(1)" "#()" "#(1)" "1" "#f")))
   ;; (list ",(+ 1 2)" "\"\"" "(())" "#\\1" "3/4" ",1")

(check-strs "'" "'")
(check-strs "`" "'")
(check-strs "'" "`")
(check-strs "`" "`")

(let ((strs ()))
  (do ((i 0 (+ i 1)))
      ((= i 4))
    (let ((c1 ((vector #\' #\` #\' #\`) i))
	  (c2 ((vector #\' #\' #\` #\`) i)))
      (do ((k 0 (+ k 1)))
	  ((= k 4))
	(let ((d1 ((vector #\' #\` #\' #\`) k))
	      (d2 ((vector #\' #\' #\` #\`) k)))
	  (let ((str1 (string c1 c2))
		(str2 (string d1 d2)))
	    (if (not (member (list str1 str2) strs))
		(begin
		  (check-strs str1 str2)
		  (set! strs (cons (list str1 str2) strs))
		  (set! strs (cons (list str2 str1) strs))))))))))

(let ((strs ()))
  (do ((i 0 (+ i 1)))
      ((= i 8))
    (let ((c1 ((vector #\' #\` #\' #\` #\' #\` #\' #\`) i))
	  (c2 ((vector #\' #\' #\` #\` #\' #\' #\` #\`) i))
	  (c3 ((vector #\' #\' #\' #\' #\` #\` #\` #\`) i)))
      (do ((k 0 (+ k 1)))
	  ((= k 8))
	(let ((d1 ((vector #\' #\` #\' #\` #\' #\` #\' #\`) k))
	      (d2 ((vector #\' #\' #\` #\` #\' #\' #\` #\`) k))
	      (d3 ((vector #\' #\' #\' #\' #\` #\` #\` #\`) k)))
	  (let ((str1 (string c1 c2 c3))
		(str2 (string d1 d2 d3)))
	    (if (not (member (list str1 str2) strs))
		(begin
		  (check-strs str1 str2)
		  (set! strs (cons (list str1 str2) strs))
		  (set! strs (cons (list str2 str1) strs))))))))))


;;; --------------------------------

(do ((i 0 (+ i 1)))
    ((= i 256))
  (if (and (not (= i (char->integer #\))))
	   (not (= i (char->integer #\"))))
      (let ((str (string #\' #\( #\1 #\space #\. (integer->char i) #\2 #\))))
	(catch #t
	       (lambda ()
		 (let ((val (eval-string str)))
		   (format #t "[~D] ~A -> ~S (~S ~S)~%" i str val (car val) (cdr val))))
	       (lambda args
		 (format #t "[~D] ~A -> ~A~%" i str args))))))

(let ((chars (vector (integer->char 0) #\newline #\space #\tab #\. #\, #\@ #\= #\x #\b #\' #\` 
		     #\# #\] #\[ #\} #\{ #\( #\) #\1 #\i #\+ #\- #\e #\_ #\\ #\" #\: #\; #\> #\<)))
  (let ((nchars (vector-length chars)))
    (do ((len 2 (+ len 1)))
	((= len 3))
      (let ((str (make-string len))
	    (ctrs (make-vector len 0)))

	(do ((i 0 (+ i 1)))
	    ((= i (expt nchars len)))

	  (let ((carry #t))
	    (do ((k 0 (+ k 1)))
		((or (= k len)
		     (not carry)))
	      (vector-set! ctrs k (+ 1 (vector-ref ctrs k)))
	      (if (= (vector-ref ctrs k) nchars)
		  (vector-set! ctrs k 0)
		  (set! carry #f)))
	    (do ((k 0 (+ k 1)))
		((= k len))
	      (string-set! str k (vector-ref chars (vector-ref ctrs k)))))

	  (format #t "~A -> " str)
	  (catch #t
		 (lambda ()
		   (let ((val (eval-string str)))
		     (format #t " ~S -> ~S~%" str val)))
		 (lambda args
		   ;(format #t " ~A~%" args)
		   #f
		   )))))))
|#

(let ((äåæéîå define)
      (ìåîçôè length)
      (äï do)
      (ìåô* let*)
      (éæ if)
      (áâó abs)
      (ìïç log)
      (óåô! set!))

  (äåæéîå (óòã-äõòáôéïî å)
    (ìåô* ((ìåî (ìåîçôè å))
           (åø0 (å 0))
           (åø1 (å (- ìåî 2)))
           (áìì-ø (- åø1 åø0))
           (äõò 0.0))
      (äï ((é 0 (+ é 2)))
          ((>= é (- ìåî 2)) äõò)
        (ìåô* ((ø0 (å é))
               (ø1 (å (+ é 2)))
               (ù0 (å (+ é 1))) ; 1/ø ø ðïéîôó
               (ù1 (å (+ é 3)))
               (áòåá (éæ (< (áâó (- ù0 ù1)) .0001)
                         (/ (- ø1 ø0) (* ù0 áìì-ø))
                         (* (/ (- (ìïç ù1) (ìïç ù0)) 
                               (- ù1 ù0)) 
                            (/ (- ø1 ø0) áìì-ø)))))
         (óåô! äõò (+ äõò (áâó áòåá)))))))

  (num-test (óòã-äõòáôéïî (list 0 1 1 2)) 0.69314718055995)
  (num-test (óòã-äõòáôéïî (vector 0 1 1 2)) 0.69314718055995))

(test (let ((ÿa 1)) ÿa) 1)
(test (+ (let ((!a 1)) !a) (let (($a 1)) $a) (let ((%a 1)) %a) (let ((&a 1)) &a) (let ((*a 1)) *a) (let ((+a 1)) +a) (let ((-a 1)) -a) (let ((.a 1)) .a) (let ((/a 1)) /a) (let ((0a 1)) 0a) (let ((1a 1)) 1a) (let ((2a 1)) 2a) (let ((3a 1)) 3a) (let ((4a 1)) 4a) (let ((5a 1)) 5a) (let ((6a 1)) 6a) (let ((7a 1)) 7a) (let ((8a 1)) 8a) (let ((9a 1)) 9a) (let ((<a 1)) <a) (let ((=a 1)) =a) (let ((>a 1)) >a) (let ((?a 1)) ?a) (let ((@a 1)) @a) (let ((Aa 1)) Aa) (let ((Ba 1)) Ba) (let ((Ca 1)) Ca) (let ((Da 1)) Da) (let ((Ea 1)) Ea) (let ((Fa 1)) Fa) (let ((Ga 1)) Ga) (let ((Ha 1)) Ha) (let ((Ia 1)) Ia) (let ((Ja 1)) Ja) (let ((Ka 1)) Ka) (let ((La 1)) La) (let ((Ma 1)) Ma) (let ((Na 1)) Na) (let ((Oa 1)) Oa) (let ((Pa 1)) Pa) (let ((Qa 1)) Qa) (let ((Ra 1)) Ra) (let ((Sa 1)) Sa) (let ((Ta 1)) Ta) (let ((Ua 1)) Ua) (let ((Va 1)) Va) (let ((Wa 1)) Wa) (let ((Xa 1)) Xa) (let ((Ya 1)) Ya) (let ((Za 1)) Za) (let (([a 1)) [a) (let ((\a 1)) \a) (let ((]a 1)) ]a) (let ((^a 1)) ^a) (let ((_a 1)) _a) (let ((aa 1)) aa) (let ((ba 1)) ba) (let ((ca 1)) ca) (let ((da 1)) da) (let ((ea 1)) ea) (let ((fa 1)) fa) (let ((ga 1)) ga) (let ((ha 1)) ha) (let ((ia 1)) ia) (let ((ja 1)) ja) (let ((ka 1)) ka) (let ((la 1)) la) (let ((ma 1)) ma) (let ((na 1)) na) (let ((oa 1)) oa) (let ((pa 1)) pa) (let ((qa 1)) qa) (let ((ra 1)) ra) (let ((sa 1)) sa) (let ((ta 1)) ta) (let ((ua 1)) ua) (let ((va 1)) va) (let ((wa 1)) wa) (let ((xa 1)) xa) (let ((ya 1)) ya) (let ((za 1)) za) (let (({a 1)) {a) (let ((|a 1)) |a) (let ((}a 1)) }a) (let ((~a 1)) ~a) (let (( a 1))  a) (let ((¡a 1)) ¡a) (let ((¢a 1)) ¢a) (let ((£a 1)) £a) (let ((¤a 1)) ¤a) (let ((¥a 1)) ¥a) (let ((¦a 1)) ¦a) (let ((§a 1)) §a) (let ((¨a 1)) ¨a) (let ((©a 1)) ©a) (let ((ªa 1)) ªa) (let ((«a 1)) «a) (let ((¬a 1)) ¬a) (let ((­a 1)) ­a) (let ((®a 1)) ®a) (let ((¯a 1)) ¯a) (let ((°a 1)) °a) (let ((±a 1)) ±a) (let ((²a 1)) ²a) (let ((³a 1)) ³a) (let ((´a 1)) ´a) (let ((µa 1)) µa) (let ((¶a 1)) ¶a) (let ((·a 1)) ·a) (let ((¸a 1)) ¸a) (let ((¹a 1)) ¹a) (let ((ºa 1)) ºa) (let ((»a 1)) »a) (let ((¼a 1)) ¼a) (let ((½a 1)) ½a) (let ((¾a 1)) ¾a) (let ((¿a 1)) ¿a) (let ((Àa 1)) Àa) (let ((Áa 1)) Áa) (let ((Âa 1)) Âa) (let ((Ãa 1)) Ãa) (let ((Äa 1)) Äa) (let ((Åa 1)) Åa) (let ((Æa 1)) Æa) (let ((Ça 1)) Ça) (let ((Èa 1)) Èa) (let ((Éa 1)) Éa) (let ((Êa 1)) Êa) (let ((Ëa 1)) Ëa) (let ((Ìa 1)) Ìa) (let ((Ía 1)) Ía) (let ((Îa 1)) Îa) (let ((Ïa 1)) Ïa) (let ((Ða 1)) Ða) (let ((Ña 1)) Ña) (let ((Òa 1)) Òa) (let ((Óa 1)) Óa) (let ((Ôa 1)) Ôa) (let ((Õa 1)) Õa) (let ((Öa 1)) Öa) (let ((×a 1)) ×a) (let ((Øa 1)) Øa) (let ((Ùa 1)) Ùa) (let ((Úa 1)) Úa) (let ((Ûa 1)) Ûa) (let ((Üa 1)) Üa) (let ((Ýa 1)) Ýa) (let ((Þa 1)) Þa) (let ((ßa 1)) ßa) (let ((àa 1)) àa) (let ((áa 1)) áa) (let ((âa 1)) âa) (let ((ãa 1)) ãa) (let ((äa 1)) äa) (let ((åa 1)) åa) (let ((æa 1)) æa) (let ((ça 1)) ça) (let ((èa 1)) èa) (let ((éa 1)) éa) (let ((êa 1)) êa) (let ((ëa 1)) ëa) (let ((ìa 1)) ìa) (let ((ía 1)) ía) (let ((îa 1)) îa) (let ((ïa 1)) ïa) (let ((ða 1)) ða) (let ((ña 1)) ña) (let ((òa 1)) òa) (let ((óa 1)) óa) (let ((ôa 1)) ôa) (let ((õa 1)) õa) (let ((öa 1)) öa) (let ((÷a 1)) ÷a) (let ((øa 1)) øa) (let ((ùa 1)) ùa) (let ((úa 1)) úa) (let ((ûa 1)) ûa) (let ((üa 1)) üa) (let ((ýa 1)) ýa) (let ((þa 1)) þa) (let ((ÿa 1)) ÿa)) 181)

;;; there are about 50 non-printing chars, some of which would probably work as well


;; (eval-string "(eval-string ...)") is not what it appears to be -- the outer call
;;    still sees the full string when it evaluates, not the string that results from
;;    the inner call.


(let () ; from scheme bboard
  (define (maxlist list) 
    (define (maxlist' l max) 
      (if (null? l) max 
	  (if (> (car l) max) 
	      (maxlist' (cdr l) (car l)) 
	      (maxlist' (cdr l) max)))) 
    (if (null? list) 'undef 
	(maxlist' list (car list)))) 
  (test (maxlist '(1 2 3)) 3) ; quote is ok in s7 if not the initial char (sort of like a number)

  (let ((h'a 3))
    (test h'a 3))
  (let ((1'2 32))
    (test 1'2 32))
  (let ((1'`'2 32))
    (test 1'`'2 32))
  (let ((1'`,@2 32))
    (test 1'`,@2 32))

;  (test (define '3 32) 'error) ;define quote: syntactic keywords tend to behave badly if redefined
  )

(let ((|,``:,*|',## 1)
      (0,,&:@'>>.<# 2)
      (@.*0`#||\<,, 3)
      (*&:`&'>#,*<` 4)
      (*0,,`&|#*:`> 5)
      (>:|<*.<@:\|` 6)
      (*',>>:.'@,** 7)
      (0|.'@<<:,##< 8)
      (<>,\',\.>>#` 9)
      (@#.>|&#&,\0* 10)
      (0'.`&<','<<. 11)
      (&@@*<*\'&|., 12)
      (|0*&,':|0\** 13)
      (<:'*@<>*,<&` 14)
      (>@<@<|>,`&'. 15)
      (@#,00:<:@*.\ 16)
      (*&.`\>#&,&., 17)
      (0|0|`,,..<@, 18)
      (0@,'>\,,&.@# 19)
      (>@@>,000`\#< 20)
      (|>*'',<:&@., 21)
      (|>,0>0|,@'|. 22)
      (0,`'|'`,:`@` 23)
      (<>#'>,,\'.'& 24)
      (*..,|,.,&&@0 25))
  (test (+ |,``:,*|',## 0,,&:@'>>.<# @.*0`#||\<,, *&:`&'>#,*<` *0,,`&|#*:`> >:|<*.<@:\|` *',>>:.'@,**
	   0|.'@<<:,##< <>,\',\.>>#` @#.>|&#&,\0* 0'.`&<','<<.  &@@*<*\'&|., |0*&,':|0\** <:'*@<>*,<&`
           >@<@<|>,`&'. @#,00:<:@*.\ *&.`\>#&,&., 0|0|`,,..<@, 0@,'>\,,&.@# >@@>,000`\#<
           |>*'',<:&@., |>,0>0|,@'|. 0,`'|'`,:`@` <>#'>,,\'.'& *..,|,.,&&@0)
	325))

(when full-test
  (let ((first-chars (list #\. #\0 #\@ #\! #\& #\| #\* #\< #\>))
	(rest-chars (list #\. #\0 #\@ #\! #\| #\, #\# #\' #\\ #\` #\, #\: #\& #\* #\< #\>)))
    (let ((first-len (length first-chars))
	  (rest-len (length rest-chars)))
      (let ((n 100)
	    (size 12))
	(let ((str (make-string size #\space)))
	  (do ((i 0 (+ i 1)))
	      ((= i n))
	    (set! (str 0) (first-chars (random first-len)))
	    (do ((k 1 (+ 1 k)))
		((= k size))
	      (set! (str k) (rest-chars (random rest-len))))
	    (catch #t (lambda ()
			(let ((val (eval-string (format #f "(let () (define ~A 3) ~A)" str str))))
			  (format #f "~A -> ~A~%" str val)))
		   (lambda args
		     (format #f "~A error: ~A~%" str args)))))))))

(let ((List 1)
      (LIST 2)
      (lIsT 3)
      (-list 4)
      (_list 5)
      (+list 6))
  (test (apply + (list List LIST lIsT -list _list +list)) 21))

(let ()
  (define (\ arg) (+ arg 1))
  (test (+ 1 (\ 2)) 4)
  (define (@\ arg) (+ arg 1))
  (test (+ 1 (@\ 2)) 4)
  (define (@,\ arg) (+ arg 1))
  (test (+ 1 (@,\ 2)) 4)
  (define (\,@\ arg) (+ arg 1))
  (test (+ 1 (\,@\ 2)) 4)
  )

;;; these are from the r7rs discussions
(test (let ((a'b 3)) a'b) 3) ; allow variable names like "can't-go-on" or "don't-ask"
(test (let () (define (f x y) (+ x y)) (let ((a 3) (b 4)) (f a, b))) 'error) ; unbound variable a,
(test (let () (define (f x y) (+ x y)) (let ((a 3) (b 4)) (f a ,b))) 'error) ; unquote outside quasiquote

(test (vector? (owlet 0. 3/4 #(reader-cond ))) 'error)
(test (vector? #(reader-cond)) #t)


;;; -------- object->string
;;; object->string

(test (string=? (object->string 32) "32") #t)
(test (string=? (object->string 32.5) "32.5") #t)
(test (string=? (object->string 32/5) "32/5") #t)
(test (object->string 1+i) "1+1i")
(test (string=? (object->string "hiho") "\"hiho\"") #t)
(test (string=? (object->string 'symb) "symb") #t)
(test (string=? (object->string (list 1 2 3)) "(1 2 3)") #t)
(test (string=? (object->string (cons 1 2)) "(1 . 2)") #t)
(test (string=? (object->string #(1 2 3)) "#(1 2 3)") #t)
(test (string=? (object->string +) "+") #t)
(test (object->string (object->string (object->string "123"))) "\"\\\"\\\\\\\"123\\\\\\\"\\\"\"")
(test (object->string #<eof>) "#<eof>")
(test (object->string (if #f #f)) "#<unspecified>")
(test (object->string #<undefined>) "#<undefined>")
(test (object->string _undef_) "#_asdf")
(test (object->string #f) "#f")
(test (object->string #t) "#t")
(test (object->string ()) "()")
(test (object->string #()) "#()")
(test (object->string "") "\"\"")
(test (object->string abs) "abs")
(test (object->string lambda) "lambda")
(test (object->string (lambda () a)) "#<lambda ()>")
(test (object->string (lambda a a)) "#<lambda a>")
(test (object->string (lambda (a) a)) "#<lambda (a)>")
(test (object->string (lambda (a . b) a)) "#<lambda (a . b)>")
(test (object->string (lambda (a b) a)) "#<lambda (a b)>")
(test (object->string (lambda (a b c) a)) "#<lambda (a b ...)>")
(test (object->string (lambda (a b . c) a)) "#<lambda (a b ...)>")
(test (object->string (lambda* (a :rest b) a)) "#<lambda* (a :rest b)>")
(test (object->string (lambda* (:rest a) a)) "#<lambda* (:rest a)>")
(test (object->string (lambda* (a b :rest c) a)) "#<lambda* (a b ...)>")
(let () (define-macro (mac a) a) (test (object->string mac) "mac"))
(let ((m (define-macro (mac a) a))) (test (object->string m) "#<macro (a)>"))
(let ((m (define-macro* (mac a) a))) (test (object->string m) "#<macro* (a)>"))
(let ((m (define-bacro (mac a) a))) (test (object->string m) "#<bacro (a)>"))
(let ((m (define-bacro* (mac a) a))) (test (object->string m) "#<bacro* (a)>"))
(let ((_?_m (define-expansion (_?_mac a) a))) (test (object->string _?_m) "#<expansion (a)>"))
(test (object->string +) "+")
(test (object->string +) "+")
(test (object->string '''2) "''2")
(test (object->string (lambda () #f)) "#<lambda ()>") ;"#<closure>"
(test (call-with-exit (lambda (return) (object->string return))) "#<goto>")
(test (call/cc (lambda (return) (object->string return))) "#<continuation>")
(test (let () (define-macro (hi a) `(+ 1 ,a)) (object->string hi)) "hi")
(test (let () (define (hi a) (+ 1 a)) (object->string hi)) "hi")
(test (let () (define* (hi a) (+ 1 a)) (object->string hi)) "hi")
(test (object->string dynamic-wind) "dynamic-wind")
(test (object->string (dilambda (lambda () 1) (lambda (val) val))) "#<lambda ()>") ;"#<closure>"
(test (object->string object->string) "object->string")
(test (object->string 'if) "if")
(test (object->string begin) "begin")
(test (object->string let) "let")

(test (object->string #\n #f) "n")
(test (object->string #\n) "#\\n")
(test (object->string #\r) "#\\r")
(test (object->string #\r #f) "r")
(test (object->string #\t #f) "t")
(test (object->string #\t) "#\\t")

(test (object->string "a\x00;b" #t) "\"a\\x00;b\"")
(test (object->string "a\x00;b" #f) "a\x00;b")

(let-temporarily (((*s7* 'print-length) 3))
  (test (object->string (inlet :a 1 :b 2 :c 3 :d 4)) "(inlet 'a 1 'b 2 'c 3 ...)")
  (test (object->string (vector 1 2 3 4)) "#(1 2 3 ...)")
  (test (object->string #r(1 2 3 4)) "#r(1.0 2.0 3.0 ...)")
  (test (object->string #i(1 2 3 4)) "#i(1 2 3 ...)")
  (test (object->string (list 1 2 3 4)) "(1 2 3 4)")) ; oops...
;;; hash-tables are hard to check here -- order of entries is not known

#|
(do ((i 0 (+ i 1))) 
    ((= i 256)) 
  (let ((c (integer->char i))) 
    (let ((str (object->string c))) 
      (if (and (not (= (length str) 3))       ; "#\\a"
	       (or (not (char=? (str 2) #\x))
		   (not (= (length str) 5)))) ; "#\\xee"
	  (format #t "(#t) ~C: ~S~%" c str))
      (set! str (object->string c #f))
      (if (not (= (length str) 1))
	  (format #t "(#f) ~C: ~S~%" c str)))))
this prints:
(#t) : "#\\null"
(#f) : ""
(#t) : "#\\x1"
(#t) : "#\\x2"
(#t) : "#\\x3"
(#t) : "#\\x4"
(#t) : "#\\x5"
(#t) : "#\\x6"
(#t) : "#\\x7"
(#t): "#\\x8"
(#t) 	: "#\\tab"
(#t) 
: "#\\newline"
(#t) 
     : "#\\xb"
(#t) 
     : "#\\xc"
: "#\\return"
(#t) : "#\\xe"
(#t) : "#\\xf"
(#t)  : "#\\space"
|#

(test (object->string #\x30) "#\\0")
(test (object->string #\x91) "#\\x91")
(test (object->string #\x10) "#\\x10")
(test (object->string #\xff) "#\\xff")
(test (object->string #\x55) "#\\U")
(test (object->string #\x7e) "#\\~")
(test (object->string #\newline) "#\\newline")
(test (object->string #\return) "#\\return")
(test (object->string #\tab) "#\\tab")
(test (object->string #\null) "#\\null")
(test (object->string #\space) "#\\space")
(test (object->string (integer->char 8)) "#\\backspace")
(test (object->string ''#\a) "'#\\a")
(test (object->string (list 1 '.' 2)) "(1 .' 2)")
(test (object->string (quote (quote))) "(quote)")
(test (object->string (quote quote)) "quote")
(test (object->string (quote (quote (quote)))) "'(quote)")

(test (object->string) 'error)
(test (object->string 1 2) 'error)
(test (object->string 1 #f #t) 'error)
(test (object->string abs) "abs")
(test(let ((val 0)) (cond (else (set! val (object->string else)) 1)) val) "else")
(test (cond (else (object->string else))) "else")
(test (object->string (string->symbol (string #\; #\" #\)))) "(symbol \";\\\")\")")

(test (object->string "hi" #f) "hi")
(test (object->string "h\\i" #f) "h\\i")
(test (object->string -1.(list? -1e0)) "-1.0")

(test (object->string catch) "catch")
(test (object->string lambda) "lambda")
(test (object->string dynamic-wind) "dynamic-wind")
(test (object->string quasiquote) "quasiquote")
;(test (object->string else) "else") ; this depends on previous code
(test (object->string do) "do")

(for-each
 (lambda (arg)
   (test (object->string 1 arg) 'error)
   (test (object->string arg) (with-output-to-string (lambda () (write arg))))
   (test (object->string arg #t) (with-output-to-string (lambda () (write arg))))
   (test (object->string arg #f) (with-output-to-string (lambda () (display arg)))))
 (list "hi" -1 #\a 1 0 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i () (list 1 2 3) '(1 . 2)))

(test (string->symbol (object->string #(1 #\a (3)) #f)) (symbol "#(1 #\\a (3))"))
(test (string->list (object->string #(1 2) #f)) '(#\# #\( #\1 #\space #\2 #\)))
(test (string->list (object->string #(1 #\a (3)) #f)) '(#\# #\( #\1 #\space #\# #\\ #\a #\space #\( #\3 #\) #\)))
(test (reverse (object->string #2D((1 2) (3 4)) #f))  "))4 3( )2 1((D2#")

;; write readably (this affects ~W in format as well)
;; :readable special things
(for-each
 (lambda (n)
   (let ((str (object->string n :readable)))
     (let ((obj (with-input-from-string str
		  (lambda ()
		    (eval (read))))))
       (if (not (eq? n obj))
	   (format *stderr* "~A not eq? ~A (~S)~%" n obj str)))))
 (list #<eof> #<undefined> #<unspecified> #t #f #true #false else ()
       lambda lambda* begin case if do quote set! let let* letrec
       cond and or define define* define-constant define-macro
       define-macro* define-bacro define-bacro*
       with-baffle
       *stdin* *stdout* *stderr*))

;; :readable characters
(do ((i 0 (+ i 1)))
    ((= i 256))
  (let ((c (integer->char i)))
    (let ((str (object->string c :readable)))
      (let ((nc (with-input-from-string str
		  (lambda ()
		    (eval (read)))))) ; no need for eval here or in some other cases, but might as well be consistent
	(if (not (eq? c nc))
	    (format *stderr* "~C (~D) != ~C (~S)~%" c i nc str))))))

;; :readable integers
(for-each
 (lambda (n)
   (let ((str (object->string n :readable)))
     (let ((nn (with-input-from-string str
		 (lambda ()
		   (eval (read))))))
       (if (or (not (integer? n))
	       (not (integer? nn))
	       (not (= n nn)))
	   (format *stderr* "~D != ~D (~S)~%" n nn str)))))
 (list 0 1 3 most-positive-fixnum -0 -1 -3 most-negative-fixnum
       -9223372036854775808 9223372036854775807))
;; but unless gmp at read end we'll fail with most-positive-fixnum+1
;; -> check *features* at start of read

;; :readable ratios
(for-each
 (lambda (n)
   (let ((str (object->string n :readable)))
     (let ((nn (with-input-from-string str
		 (lambda ()
		   (eval (read))))))
       (if (or (not (rational? n))
	       (not (rational? nn))
	       (not (= n nn)))
	   (format *stderr* "~A != ~A (~S)~%" n nn str)))))
 (list 1/2 -1/2 123456789/2 -2/123456789 2147483647/2147483646 312689/99532
       -9223372036854775808/3 9223372036854775807/2  1/1428571428571429 1/1152921504606846976))

(when (not (provided? 'solaris))
  ;; :readable reals
  (for-each
   (lambda (n)
     (let ((str (object->string n :readable)))
       (let ((nn (with-input-from-string str
		   (lambda ()
		     (eval (read))))))
	 (if (or (not (real? n))
		 (not (real? nn))
		 (not (morally-equal? n nn)))
	     (format *stderr* "~A != ~A (~S)~%" n nn str)))))
   (list 1.0 0.0 -0.0 pi 0.1 -0.1 0.9999999995 9007199254740993.1 (sqrt 2) 1/100000000000
	 1.5e-16 1.5e16 3.141592653589793238462643383279502884197169399375105820 1e-300 8.673617379884e-19
	 1/0 (- 1/0) (real-part (log 0)) (- (real-part (log 0)))))
  
  ;; :readable complex
  (for-each
   (lambda (n)
     (let ((str (object->string n :readable)))
       (let ((nn (with-input-from-string str
		   (lambda ()
		     (eval (read))))))
	 (if (or (not (complex? n))
		 (not (complex? nn))
		 (not (morally-equal? n nn)))
	     (format *stderr* "~A != ~A (~S)~%" n nn str)))))
   (list 0+i 0-i 1+i 1.4+i 3.0+1.5i
	 (log 0) (- (log 0)) 
	 (complex 1/0 1.0) (complex 1/0 1/0) (complex 1.0 1/0) ; default: nan+1i nannani 1nani!
	 (complex 1/0 (real-part (log 0))) (complex (real-part (log 0)) 1/0) 
	 1e-14+1e14i 0+1e-16i (complex pi pi))))


;; :readable strings/byte-vectors
(for-each
 (lambda (n)
   (let ((str (object->string n :readable)))
     (let ((obj (with-input-from-string str
		  (lambda ()
		    (eval (read))))))
       (if (or (not (string? n))
	       (not (string? obj))
	       (not (string=? n obj))
	       (and (byte-vector? n)
		    (not (byte-vector? obj))))
	   (format *stderr* "~S not string=? ~S (~S)~%" n obj str)))))
 (list "" "abc" (string #\newline) "#<abc>" "a\"b\"c" "a\\b\nc" "aBc"
       (let ((s (make-string 4 #\space))) (set! (s 3) #\null) s) ; writes as "   \x00"
       "ab
c"
       (string #\a #\b #\null #\c #\escape #\newline)
       (string #\x (integer->char #xf0) #\x)
       (string #\null)
       #u8() #u8(0 1 2 3) 
       (let ((str (make-string 256 #\null)))
	 (do ((i 0 (+ i 1)))
	     ((= i 256) str)
	   (set! (str i) (integer->char i))))))

;; :readable symbols/keywords
(for-each
 (lambda (n)
   (let ((str (object->string n :readable)))
     (let ((obj (with-input-from-string str
		  (lambda ()
		    (eval (read))))))
       (if (or (not (symbol? n))
	       (not (symbol? obj))
	       (not (eq? n obj)))
	   (format *stderr* "~A not eq? ~A (~S)~%" n obj str)))))
 (list 'abc :abc abc:
       (symbol "a") (symbol "#<>")
       (gensym "|") (gensym "#<>") (gensym "}")
       :: ':abc
       (gensym "\\")))
  
;; :readable environments
(for-each
 (lambda (n)
   (let ((str (object->string n :readable)))
     (let ((obj (with-input-from-string str
		  (lambda ()
		    (eval (read))))))
       (if (or (not (let? n))
	       (not (let? obj))
	       (not (equal? n obj)))
	   (format *stderr* "~A not equal?~%~A~%    (~S)~%" n obj str)))))
 (list (inlet '(a . 1))
       (inlet)
       (rootlet)
       (inlet (cons 't12 "12") (cons (symbol "#<") 12))
       (inlet 'a 1 'a 2)))

;(test (object->string (list (owlet)) :readable) "(list (owlet))")

;; :readable hash-tables
(for-each
 (lambda (n)
   (let ((str (object->string n :readable)))
     (let ((obj (with-input-from-string str
		  (lambda ()
		    (eval (read))))))
       (if (or (not (hash-table? n))
	       (not (hash-table? obj))
	       (not (equal? n obj)))
	   (format *stderr* ";readable hash-tables, ~A not equal? ~A (~S)~%" n obj str)))))
 (list (hash-table '(a . 1))
       (hash-table '(a . 1) (cons 'b "hi"))
       (let ((ht (make-hash-table 31)))
	 (set! (ht 1) 321)
	 (set! (ht 2) 123)
	 ht)
       (let ((ht (make-hash-table)))
	 (set! (ht 'b) 1)
	 (set! (ht 'a) ht)
	 ht)
       ;(let ((ht (make-hash-table))) (set! (ht ht) 123) ht) 
       ;(let ((ht (make-hash-table))) (set! (ht ht) ht)  ht)
       (hash-table)))
  
;; :readable vectors
(let-temporarily (((*s7* 'print-length) 8))
  (for-each
   (lambda (p)
     (set! (*s7* 'print-length) p)
     (for-each
      (lambda (n)
	(let ((str (object->string n :readable)))
	  (let ((obj (with-input-from-string str
		       (lambda ()
			 (eval (read))))))
	    (if (or (not (vector? n))
		    (not (vector? obj))
		    (not (equal? n obj)))
		(format *stderr* ";readable vectors, ~A not equal? ~A (~S)~%" n obj str)))))
      (list #() #(1) #(1 #(2)) #2d((1 2) (3 4))
	    #3d(((1 2 3) (4 5 6) (7 8 9)) ((9 8 7) (6 5 4) (3 2 1)))
	    #2d()
	    #(1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0)
	    (let ((v (vector 1 2 3))) (set! (v 1) v) v)
	    (let ((v (vector 1 #(2) 3))) (set! ((v 1) 0) v) v)
	    (let ((v #2d((1 2 3) (4 5 6)))) (set! (v 1 1) v) v)
	    (make-int-vector 3 0)
	    (make-float-vector 3 0.0)
	    (make-int-vector '(2 3) 1))))
   (list 8 2 1)))

(test (object->string (vector 1 2 3) :readable) "(vector 1 2 3)")
  
;; :readable lists (circular, dotted)
(for-each
 (lambda (n)
   (let ((str (object->string n :readable)))
     (let ((obj (with-input-from-string str
		  (lambda ()
		    (eval (read))))))
       (if (or (not (pair? n))
	       (not (pair? obj))
	       (not (equal? n obj)))
	   (format *stderr* ";readable lists, ~A not equal? ~A (~S)~%" n obj str)))))
 (list '(1) '(1 . 2) '((1 ()) 3) '((1 2) (3 4))
       '(1 2 . 3) '(1 2 3 . 4) '(())
       (let ((lst (cons 1 2))) (set-cdr! lst lst) lst)
       (let ((lst (list 1 2 3))) (set-cdr! (cddr lst) lst) lst)
       (let ((lst (list 1 2 3))) (set-car! (cddr lst) lst) lst)
       ))

;; :readable macros
(let ()
  (define-macro (mac1) `(+ 1 2))
  (test ((eval-string (object->string mac1 :readable))) 3)
  (define-macro (mac2 a) `(+ ,a 2))
  (test ((eval-string (object->string mac2 :readable)) 1) 3)
  (define-macro* (mac3 (a 1)) `(+ ,a 2))
  (test ((eval-string (object->string mac3 :readable))) 3)
  (define-macro (mac4 . a) `(+ ,@a 2))
  (test ((eval-string (object->string mac4 :readable)) 1 3) 6)
  (define-macro (mac5 a b . c) `(+ ,a ,b ,@c 2))
  (test ((eval-string (object->string mac5 :readable)) 1 5 3 4) 15)
  (define-macro (mac7 a) (let ((b (+ a 1))) `(+ ,b ,a)))
  (test ((eval-string (object->string mac7 :readable)) 2) 5)
  )

;; :readable closures/functions/built-in (C) functions + the setters thereof
(for-each
 (lambda (n)
   (let ((str (object->string n :readable)))
     (let ((obj (with-input-from-string str
		  (lambda ()
		    (eval (read))))))
       (if (or (not (procedure? n))
	       (not (procedure? obj))
	       (not (equal? (procedure-source n) (procedure-source obj))))
	   (format *stderr* "'~A not equal? '~A (~S)~%" n obj str)))))
 (list abs
       (lambda () 1)
       (lambda (a) (+ a 1))
       (lambda args (display args) (cdr args))
       (lambda* (a b) (or a b))
       (let ((a 1)) (lambda (b) (+ a b)))
       (let ((b 2)) (let ((a 1)) (lambda* (c . d) (display (+ a b c) *stdout*) d)))
       (lambda* (:rest b) b)
       ))

(for-each
 (lambda (n)
   (let ((str (object->string n :readable)))
     (test ((eval-string str) 21) (n 21))))
 (list (lambda (a) (+ a 1))
       (lambda args (cdr args))
       (lambda* (a b) (or a b))
       (let ((a 1)) (lambda (b) (+ a b)))
       (let ((b 2)) (let ((a 1)) (lambda* (c . d) (+ a b c))))
       (lambda* (:rest b) b)
       ))

(let ()
  (define* (f1 a :allow-other-keys) (+ a 1))
  (let ((str (object->string f1 :readable)))
     (let ((obj (with-input-from-string str
		  (lambda ()
		    (eval (read))))))
       (test (f1 2 :b 3) 3)
       (test (obj 2) 3)
       (test (obj 2 :b 3) 3)))) ; too many args
    

;; :readable ports
(for-each
 (lambda (n)
   (let ((str (object->string n :readable)))
     (let ((obj (with-input-from-string str
		  (lambda ()
		    (eval (read))))))
       (if (or (not (input-port? n))
	       (not (input-port? obj))
	       (not (equal? (port-closed? n) (port-closed? obj))))
	   (format *stderr* "~A not equal? ~A (~S)~%" n obj str)
	   (if (and (not (port-closed? n))
		    (not (eq? n *stdin*))
		    (not (eq? n (current-input-port))))
	       (let ((c1 (read-char n))
		     (c2 (read-char obj)))
		 (if (not (equal? c1 c2))
		     (format *stderr* "read-char results ~A not equal? ~A (~S)~%" c1 c2 str)))))
       (if (and (not (eq? n *stdin*))
		(not (eq? n (current-input-port))))
	   (begin
	     (close-input-port n)
	     (close-input-port obj))))))
 (list *stdin*
       (open-input-string "a test")
       (call-with-input-string "a test" (lambda (p) p))
       (let ((p (open-input-string "a test"))) (read-char p) p)
       (call-with-input-file "s7test.scm" (lambda (p) p))
       (open-input-file "write.scm")
       (let ((p (open-input-file "write.scm"))) (read-char p) p)))

;; :readable environments
(for-each
 (lambda (n)
   (let ((str (object->string n :readable)))
     (let ((obj (with-input-from-string str
		  (lambda ()
		    (eval (read))))))
       (if (or (not (let? n))
	       (not (let? obj))
	       (not (equal? n obj)))
	   (format *stderr* "~A not equal? ~A (~S)~%" n obj str)))))
 (list (rootlet)
       (let ((a 1)) (curlet))
       (let ((a 1) (b 2)) (curlet))))

(when with-block
  (let ((b (block 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0)))
    (let-temporarily (((*s7* 'print-length) 2))
      (test (format #f "~W" b) "(block 1.000 2.000 3.000 4.000 5.000 6.000 7.000 8.000)")
      (test (format #f "~A" b) "(block 1.000 2.000 ...)"))))

(test (object->string (define (ex1 a b) (+ a  b)) :readable) "(lambda (a b) (+ a b))")
(test (object->string (let ((c 3)) (define (ex1 a b) (+ a c b))) :readable) "(let ((c 3)) (lambda (a b) (+ a c b)))")
(test (object->string (let ((c 3)) (define (ex1) (+ c 1))) :readable) "(let ((c 3)) (lambda () (+ c 1)))")
(test (object->string (define* (ex1 a (b 0)) (+ a  b)) :readable) "(lambda* (a (b 0)) (+ a b))")
(test (object->string (define (ex1 a . b) (+ a  b)) :readable) "(lambda (a . b) (+ a b))")

(let-temporarily (((*s7* 'print-length) 4))
  (define (f1) (vector-ref #(0 1 2 3 4 5 6 7 8) 2))
  (test (object->string f1 :readable) "(lambda () (vector-ref #(0 1 2 3 4 5 6 7 8) 2))"))

(test (object->string (make-iterator #u8(12 41 2)) :readable) "(make-iterator #u8(12 41 2))")
(test (object->string (inlet) :readable) "(inlet)")
(test (object->string (inlet 'a 1) :readable) "(inlet 'a 1)")
(test (object->string (inlet 'a 1 'b 2) :readable) "(inlet 'a 1 'b 2)")
(test (object->string (inlet 'a #\1) :readable) "(inlet 'a #\\1)")
(test (object->string (inlet 'a #\newline) :readable) "(inlet 'a #\\newline)")
(test (object->string (inlet 'a #\null) :readable) "(inlet 'a #\\null)")
(test (object->string (inlet 'a 3.0) :readable) "(inlet 'a 3.0)")
(test (object->string (inlet 'a 1/2) :readable) "(inlet 'a 1/2)")
(test (object->string (inlet 'a 1+i) :readable) "(inlet 'a 1+1i)")
(test (object->string (inlet 'a (log 0)) :readable) (format #f "(inlet 'a (~S -inf.0 3.141592653589793))" 'complex))
(test (object->string (inlet 'a 1/0) :readable) "(inlet 'a nan.0)")
(test (object->string (inlet 'a "1") :readable) "(inlet 'a \"1\")")
(test (object->string (inlet 'a "") :readable) "(inlet 'a \"\")")
(test (object->string (inlet 'a #<undefined>) :readable) "(inlet 'a #<undefined>)")
(test (object->string (inlet 'a #<unspecified>) :readable) "(inlet 'a #<unspecified>)")
(test (object->string (inlet 'a #<eof>) :readable) "(inlet 'a (begin #<eof>))")
(test (object->string (inlet 'a lambda) :readable) "(inlet 'a lambda)")
(test (object->string (inlet 'a 'b) :readable) "(inlet 'a 'b)")
(test (object->string (inlet 'a (symbol "( a b c )")) :readable) "(inlet 'a (symbol \"( a b c )\"))")
(test (object->string (inlet 'a else) :readable) "(inlet 'a 'else)")
(test (object->string (inlet 'a (cons 1 2)) :readable) "(inlet 'a (cons 1 2))")
(test (object->string (inlet 'a (list 1 2)) :readable) "(inlet 'a (list 1 2))")
(test (object->string (inlet 'a (list "hi")) :readable) "(inlet 'a (list \"hi\"))")
(test (object->string (inlet 'a ()) :readable) "(inlet 'a ())")
(test (object->string (inlet 'a '(1 2 . 3)) :readable) "(inlet 'a (cons 1 (cons 2 3)))")
(test (object->string (inlet 'a #t) :readable) "(inlet 'a #t)")
(test (object->string (inlet 'a #f) :readable) "(inlet 'a #f)")
(test (object->string (inlet 'a :b) :readable) "(inlet 'a :b)")
(test (object->string (inlet 'a (hash-table)) :readable) "(inlet 'a (hash-table))")
(test (object->string (inlet 'a (hash-table* 'b 1))  :readable) "(inlet 'a (hash-table (cons 'b 1)))")
(test (object->string (inlet 'a (hash-table* 'b "hi")) :readable) "(inlet 'a (hash-table (cons 'b \"hi\")))")
(test (object->string (inlet 'a (hash-table* 'b "h\"i")) :readable) "(inlet 'a (hash-table (cons 'b \"h\\\"i\")))")
(test (object->string (inlet 'a #()) :readable) "(inlet 'a #())")
(test (object->string (inlet 'a #(1 2 3)) :readable) "(inlet 'a (vector 1 2 3))")
(test (object->string (inlet 'a (vector "hi" #\a 'b)) :readable) "(inlet 'a (vector \"hi\" #\\a 'b))")
(test (object->string (inlet 'a (float-vector 1 2 3)) :readable) "(inlet 'a #r(1.0 2.0 3.0))")
(test (object->string (inlet 'a (int-vector 1 2 3)) :readable) "(inlet 'a #i(1 2 3))")
(test (object->string (inlet 'a #2d((1 2 3) (4 5 6))) :readable) "(inlet 'a (make-shared-vector (vector 1 2 3 4 5 6) '(2 3)))")
(test (object->string (inlet 'a abs) :readable) "(inlet 'a abs)")
(test (object->string (inlet 'a (lambda (b) (+ b 1))) :readable) "(inlet 'a (lambda (b) (+ b 1)))")
(test (object->string (inlet 'a (lambda b (list b 1))) :readable) "(inlet 'a (lambda b (list b 1)))")
(test (object->string (inlet 'a (lambda (a . b) (list a b))) :readable) "(inlet 'a (lambda (a . b) (list a b)))")
(test (object->string (inlet 'a (define-macro (_m_ b) `(+ ,b 1))) :readable) "(inlet 'a (define-macro (_m_ b) (list-values '+ b 1)))")
(test (object->string (inlet 'a (define-bacro (_m_ b) `(+ ,b 1))) :readable) "(inlet 'a (define-bacro (_m_ b) (list-values '+ b 1)))")
(test (object->string (inlet 'a (lambda* ((b 1)) (+ b 1))) :readable) "(inlet 'a (lambda* ((b 1)) (+ b 1)))")
(test (object->string (inlet 'a (lambda* a (list a))) :readable) "(inlet 'a (lambda* a (list a)))")
(test (object->string (inlet 'a (lambda* (a (b 1) c) (list a b c))) :readable) "(inlet 'a (lambda* (a (b 1) c) (list a b c)))")
(test (object->string (inlet 'a (define-macro* (_m_ (b 1)) `(+ ,b 1))) :readable) "(inlet 'a (define-macro* (_m_ (b 1)) (list-values '+ b 1)))")
(test (object->string (inlet 'a (define-bacro* (_m_ (b 1)) `(+ ,b 1))) :readable) "(inlet 'a (define-bacro* (_m_ (b 1)) (list-values '+ b 1)))")
(when with-block
  (test (object->string (inlet 'a (block)) :readable) "(inlet 'a (block))")
  (test (object->string (inlet 'a blocks) :readable) "(inlet 'a blocks)")
  (test (object->string (inlet 'a (block 1 2 3)) :readable) "(inlet 'a (block 1.000 2.000 3.000))"))
(test (object->string (inlet 'a (c-pointer 0)) :readable) "(inlet 'a (c-pointer 0))")
(test (object->string (inlet 'a (c-pointer 1)) :readable) "(inlet 'a (c-pointer 1))")
(test (object->string (inlet 'a quasiquote) :readable) "(inlet 'a quasiquote)")
(test (object->string (inlet 'a (dilambda (lambda () 1) (lambda (x) x))) :readable) "(inlet 'a (dilambda (lambda () 1) (lambda (x) x)))")
(test (object->string (inlet 'a (inlet 'b 1)) :readable) "(inlet 'a (inlet 'b 1))")
(test (object->string (inlet 'a (let ((b 1)) (lambda () b))) :readable) "(inlet 'a (let ((b 1)) (lambda () b)))")
(test (object->string 
       (inlet 'a (let ((y 1)) (dilambda (lambda () y) (lambda (x) (set! y x))))) :readable) 
      "(inlet 'a (let ((y 1)) (dilambda (lambda () y) (lambda (x) (set! y x)))))")
(test (object->string (inlet 'a (open-input-string "123456")) :readable) "(inlet 'a (open-input-string \"123456\"))")
(test (object->string (inlet 'a (let ((p (open-input-string "123456"))) (read-char p) p)) :readable) "(inlet 'a (open-input-string \"23456\"))")
(test (object->string (inlet 'a (let ((p (open-input-string "1"))) (read-char p) p)) :readable) "(inlet 'a (open-input-string \"\"))")
(test (object->string (inlet 'a (let ((p (open-input-string "1"))) (read-char p) (read-char p) p)) :readable) "(inlet 'a (open-input-string \"\"))")
(test (object->string (inlet 'a (call-with-input-string "1" (lambda (p) p))) :readable) "(inlet 'a (call-with-input-string \"\" (lambda (p) p)))")
(test (object->string (inlet 'a (let ((p (open-input-string "1"))) (close-input-port p) p)) :readable) "(inlet 'a (call-with-input-string \"\" (lambda (p) p)))")
(test (object->string (inlet 'a *stdin*) :readable) "(inlet 'a *stdin*)")
(test (object->string (inlet 'a *stdout*) :readable) "(inlet 'a *stdout*)")
(test (object->string (inlet 'a *stderr*) :readable) "(inlet 'a *stderr*)")
(test (object->string
       (inlet 'a (let ((p (open-output-string))) (close-output-port p) p)) :readable) 
      "(inlet 'a (let ((p (open-output-string))) (close-output-port p) p))")
(test (object->string (inlet 'a (open-output-string)) :readable) "(inlet 'a (let ((p (open-output-string))) p))")
(test (object->string 
       (inlet 'a (let ((p (open-output-string))) (display 32 p) p)) :readable) 
      "(inlet 'a (let ((p (open-output-string))) (display \"32\" p) p))")
(test (object->string (inlet 'a (open-output-file "test.test")) :readable) "(inlet 'a (open-output-file \"test.test\" \"a\"))")
(test (object->string (inlet 'a (open-input-file "test.test")) :readable) "(inlet 'a (open-input-file \"test.test\"))")
(test (object->string (inlet 'a (make-iterator "123")) :readable) "(inlet 'a (make-iterator \"123\"))")
(test (object->string (inlet 'a (let ((iter (make-iterator "123"))) (iter) iter)) :readable) "(inlet 'a (make-iterator \"23\"))")
(test (object->string (inlet 'a (make-iterator #(1 2 3))) :readable) "(inlet 'a (make-iterator (vector 1 2 3)))")
(test (object->string (inlet 'a (make-iterator '(1 2 3))) :readable) "(inlet 'a (make-iterator (list 1 2 3)))")
(test (object->string
       (inlet 'a (let ((iter (make-iterator (float-vector 1 2 3)))) (iter) iter)) :readable) 
      "(inlet 'a (let ((iter (make-iterator #r(1.0 2.0 3.0)))) (do ((i 0 (+ i 1))) ((= i 1) iter) (iterate iter))))")

(test (object->string (let () (define (f1) (+ a 1)) (curlet)) :readable) "(inlet 'f1 (lambda () (+ a 1)))")
(test (object->string (let () (define (f1) 1) (let () (define f2 f1) (curlet))) :readable) "(inlet 'f2 (lambda () 1))")
(test (object->string 
       (let ((a 1)) (define d (let ((b 1)) (lambda (c) (+ a b c)))) (curlet)) :readable) 
      "(inlet 'a 1 'd (let ((b 1) (a 1)) (lambda (c) (+ a b c))))")
(test (object->string 
       (let () (define a (let ((b 1) (c 2)) (lambda (d) (+ b c d)))) (curlet)) :readable) 
      "(inlet 'a (let ((c 2) (b 1)) (lambda (d) (+ b c d))))")
(test (object->string (let ((a 1)) (define d (let ((b 1)) (let ((c b)) (lambda (e) (+ a b c e))))) (curlet)) :readable)
      "(inlet 'a 1 'd (let ((c 1) (b 1) (a 1)) (lambda (e) (+ a b c e))))")
(test (object->string (inlet 'a (let ((b 1)) (lambda () (+ b c)))) :readable) "(inlet 'a (let ((b 1)) (lambda () (+ b c))))")
(test (object->string (inlet 'a (let ((b 1)) (lambda () (+ b pi)))) :readable) "(inlet 'a (let ((b 1)) (lambda () (+ b pi))))")
(test (object->string (let* ((a 1) (b a)) (curlet)) :readable) "(inlet 'b 1)")
(test (object->string (let ((a 1)) (define (b c) (+ c a)) (curlet)) :readable) "(inlet 'a 1 'b (let ((a 1)) (lambda (c) (+ c a))))")
;;; ideally we'd catch the documentation setting

(test (string? (object->string (let ((lst (list 1))) (set-cdr! lst lst) (make-iterator lst)) :readable)) #t)

;;; these are not readable:
(test (object->string (inlet 'a (call-with-exit (lambda (return) return))) :readable) "(inlet 'a goto)")
(test (object->string (inlet 'a (call/cc (lambda (return) return))) :readable) "(inlet 'a continuation)")

;;; these are incorrect:
;(test (object->string (let () (define-constant a 32) (curlet)) :readable) "(inlet 'a 32)")
;(test (object->string #('1)) "(vector '1)")
;(test (object->string (inlet 'a ''()) :readable) "(inlet 'a '())")
(test (object->string (c-pointer 1234) :readable) "(c-pointer 1234)")

(test (string? (object->string (*s7* 'gc-protected-objects) :readable)) #t)
(test (string? (object->string (*s7* 'c-objects) :readable)) #t)
(test (string? (object->string (*s7* 'file-names) :readable)) #t)
(test (string? (object->string (*s7* 'c-types) :readable)) #t)
(test (string? (object->string (*s7* 'cpu-time) :readable)) #t)
(test (string? (object->string (*s7* 'catches) :readable)) #t)
(test (string? (object->string (*s7* 'exits) :readable)) #t)
(test (string? (object->string (*s7* 'stack) :readable)) #t)

(let ((ht (hash-table* 'a 1))
      (lt (inlet :b 1))
      (lst (list 1)))
  (set! (ht 'a) lst)
  (set! (lst 0) lt)
  (set! (lt 'b) ht)
  (test (object->string ht) "#1=(hash-table '(a (inlet 'b #1#)))"))

(let ((ht (hash-table* 'a 1)))
  (fill! ht ht)
  (test (object->string ht) "#1=(hash-table '(a . #1#))"))

(let ((ht (hash-table* 'a 1)))
  (set! (ht 'a) ht)
  (fill! ht (list ht))
  (test (object->string ht) "#1=(hash-table '(a #1#))"))

(let ((ht (hash-table* 'a 1)))
  (let ((lt (curlet)))
    (set! (ht 'a) ht)
    (fill! ht (list lt))
    (test (object->string ht) "#1=(hash-table '(a (inlet 'ht #1#)))")))

(if (not with-bignums)
    (begin
      (test (object->string (random-state 123 321)) "#<rng 123 321>")
      (test (object->string (random-state 9223372036854775807 9223372036854775807)) "#<rng 9223372036854775807 9223372036854775807>")
      (test (object->string (random-state 123 321) :readable) "(random-state 123 321)") 
      (test (object->string (random-state 9223372036854775807 9223372036854775807) :readable) "(random-state 9223372036854775807 9223372036854775807)"))
    (begin
      (test (substring (object->string (random-state 9223372036854775807 9223372036854775807)) 0 6) "#<rng ")
      (test (object->string (random-state 9223372036854775807 9223372036854775807) :readable) "#<unprint-readable object>")))

(when full-test
  (let ()
    (define (testlet e)
      (let ((data (cons #f #f)))
	(let ((iter (make-iterator e data)))
	  (do ((val (iterate iter) (iterate iter)))
	      ((iterator-at-end? iter))
	    (let ((sym (car val))
		  (fnc (cdr val)))
	      (if (procedure? fnc)
		  (let ((sig (catch #t (lambda () (signature fnc)) (lambda args #f)))
			(doc (catch #t (lambda () (documentation fnc)) (lambda args #f)))
			(src (catch #t (lambda () (procedure-source fnc)) (lambda args #f)))
			(ari (catch #t (lambda () (arity fnc)) (lambda args #f))))
		    (let ((lst (list sym fnc sig doc src ari)))
		      (object->string lst)
		      (object->string lst :readable)))
		  (begin
		    (object->string val)
		    (object->string val :readable))))))))
    
    (testlet (rootlet))
    
    (require libc.scm)
    (testlet *libc*)
    
    (require libm.scm)
    (when (defined? '*libm*) (testlet *libm*))
    
    (when (provided? 'gtk)
      (testlet *gtk*))
    
    (require libgsl.scm)
    (when (defined? '*libgsl*) (testlet *libgsl*))
    
    (require libgdbm.scm)
    (when (defined? '*libgdbm*) (testlet *libgdbm*))
    
    (require libdl.scm)
    (when (defined? '*libdl*) (testlet *libdl*))
    
    (require libutf8proc.scm)
    (when (defined? '*libutf8proc*) (testlet *libutf8proc*))))
      


;;; --------------------------------------------------------------------------------
;;; CONTROL OPS
;;; --------------------------------------------------------------------------------

(define control-ops (list lambda define quote if begin set! let let* letrec cond case and or do
			  call/cc eval apply for-each map values call-with-values dynamic-wind))
(for-each
 (lambda (op)
   (if (not (eq? op op))
       (format #t "~A not eq? to itself?~%" op)))
 control-ops)

(for-each
 (lambda (op)
   (if (not (eqv? op op))
       (format #t "~A not eqv? to itself?~%" op)))
 control-ops)

(for-each
 (lambda (op)
   (if (not (equal? op op))
       (format #t "~A not equal? to itself?~%" op)))
 control-ops)

(define question-ops (list boolean? eof-object? string?
		           number? integer? real? rational? complex? char?
			   list? vector? pair? null?))

(for-each
 (lambda (ques)
   (for-each
    (lambda (op)
      (if (ques op)
	  (format #t ";(~A ~A) returned #t?~%" ques op)))
    control-ops))
 question-ops)

(let ((unspecified (if #f #f)))
  (for-each
   (lambda (op)
     (if (op unspecified)
	 (format #t ";(~A #<unspecified>) returned #t?~%" op)))
   question-ops))

(for-each 
 (lambda (s)
   (if (not (symbol? s))
       (format #t ";(symbol? ~A returned #f?~%" s)))
 '(+ - ... !.. $.+ %.- &.! *.: /:. <-. =. >. ?. ~. _. ^.))



;;; --------------------------------------------------------------------------------
;;; if
;;; --------------------------------------------------------------------------------

(test ((if #f + *) 3 4) 12)
(test (if (> 3 2) 'yes 'no) 'yes)
(test (if (> 2 3) 'yes 'no) 'no)
(test (if (> 3 2) (- 3 2) (+ 3 2)) 1)
(test (if (> 3 2) 1) 1)
(test (if '() 1 2) 1)
(test (if 't 1 2) 1)
(test (if #t 1 2) 1)
(test (if #() 1 2) 1)
(test (if 1 2 3) 2)
(test (if 0 2 3) 2)
(test (if (list) 2 3) 2)
(test (if "" 2 3) 2)
(test (eq? (if #f #f) (if #f #f)) #t) ; I assume there's only one #<unspecified>!
(test (if . (1 2)) 2)
(test (if (if #f #f) #f #t) #f)
(test (if 1/0 0 1) 0)

(test (let ((a #t) (b #f) (c #t) (d #f)) (if (if (if (if d d c) d b) d a) 'a 'd)) 'a)
(test (let ((a #t) (b #f) (c #t) (d #f)) (if a (if b (if c (if d d c) c) 'b) 'a)) 'b)
(test (let ((a #t) (b #f) (c #t) (d #f)) (if b (if a (if d 'gad) 'gad) (if d 'gad 'a))) 'a)

(let ((a #t))
  (for-each
   (lambda (arg)
     (test (if a arg 'gad) arg))
   (list "hi" -1 #\a 1 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #f #t (list 1 2 3) '(1 . 2))))

(let ((a #t))
  (for-each
   (lambda (arg)
     (test (if (not a) 'gad arg) arg))
   (list "hi" -1 #\a 1 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #f #t (list 1 2 3) '(1 . 2))))

(test (let ((ctr 0) (a #t)) (if a (let ((b ctr)) (set! ctr (+ ctr 1)) (list b ctr)) (let ((c ctr)) (set! ctr (+ ctr 100)) (list c ctr)))) (list 0 1))

(test (if if if if) if)
(test (((if if if) if if) if if 'gad) if)
(test (if if (if if if) if) if)
(test ((car (list if)) #t 0 1) 0)
(test (symbol->string 'if) "if")
(test (if (and if (if if if)) if 'gad) if)
(test (let ((ctr 0)) (if (let () (set! ctr (+ ctr 1)) (= ctr 1)) 0 1)) 0)
(test (let ((ctr 0)) (if (let () (set! ctr (+ ctr 1)) (if (= ctr 1) (> 3 2) (< 3 2))) 0 1)) 0)
(test (        if (> 3 2) 1 2) 1)
(test (let ((alist (list (list map 1) (list car 2) (list if 3) (list do 4)))) (assoc if alist)) (list if 3))
(test (let ((alist (list (list map 1) (list car 2) (list if 3) (list do 4)))) (assv if alist)) (list if 3))
(test (let ((alist (list (list map 1) (list car 2) (list if 3) (list do 4)))) (assq if alist)) (list if 3))
(test (let ((alist (list map car if do))) (member if alist)) (list if do))
(test (let ((alist (list map car if do))) (memv if alist)) (list if do))
(test (let ((alist (list map car if do))) (memq if alist)) (list if do))
(test ((vector-ref (vector if) 0) #t 1 2) 1)
(test ((vector-ref (make-vector 1 if) 0) #t 1 2) 1)
(test ((if #t + -) 3 4) 7)
(test (list (if 0 1 2)) (list 1))
(test ((car (list if map)) #f 1 2) 2)
(test (let ((ctr 0)) (if (= ctr 0) (let () (set! ctr (+ ctr 1)) (if (= ctr 1) 2 3)) (let () (set! ctr (+ ctr 1)) (if (= ctr 1) 4 5)))) 2)
(test (let ((x (cons 1 2))) (set-cdr! x x) (if x 1 2)) 1)
(test (let ((ctr 0)) (if (let ((ctr 123)) (set! ctr (+ ctr 1)) (= ctr 124)) (let () (set! ctr (+ ctr 100)) ctr) (let () (set! ctr (+ ctr 1000)) ctr)) ctr) 100)
(test (let () (if #t (define (hi a) a)) (hi 1)) 1)
(test (let () (if #f (define (hi a) (+ a 1)) (define (hi a) a)) (hi 1)) 1)
(test (let ((oddp (lambda (a) (not (even? a))))) (define (hi a) (if (a 123) (a 321))) (hi oddp)) #t)

(test (let ((ctr 0)) (call/cc (lambda (exit) (if (> 3 2) (let () (exit ctr) (set! ctr 100) ctr) #f)))) 0)
(test (let ((ctr 0)) (call/cc (lambda (exit) (if (< 3 2) #f (let () (exit ctr) (set! ctr 100) ctr))))) 0)
(test (let ((ctr 0)) (call/cc (lambda (exit) (if (let () (exit ctr) (set! ctr 100) ctr) 123 321)))) 0)
(test (let ((ctr 0)) (if (> 3 2) (call/cc (lambda (exit) (set! ctr (+ ctr 1)) (exit ctr))) #f) ctr) 1)

(test (let ((ctr 0))
	(do ((x 0 (+ x 1)))
	    ((= x 12))
	  (if (> x 0)
	      (if (> x 1)
		  (if (> x 2)
		      (if (> x 3)
			  (if (> x 4)
			      (if (> x 5)
				  (if (> x 6)
				      (if (> x 7)
					  (if (> x 8)
					      (if (> x 9)
						  (if (> x 10)
						      (set! ctr (+ ctr 1000))
						      (set! ctr (- ctr 1)))
						  (set! ctr (- ctr 2)))
					      (set! ctr (- ctr 3)))
					  (set! ctr (- ctr 4)))
				      (set! ctr (- ctr 5)))
				  (set! ctr (- ctr 6)))
			      (set! ctr (- ctr 7)))
			  (set! ctr (- ctr 8)))
		      (set! ctr (- ctr 9)))
		  (set! ctr (- ctr 10)))
	      (set! ctr (- ctr 11))))
	ctr)
      934)

(test (let ((ctr 0))
	(do ((x 0 (+ x 1)))
	    ((= x 12))
	  (if (> x 0)
	      (if (> x 1)
		  (if (> x 2)
		      (if (> x 3)
			  (if (> x 4)
			      (if (> x 5)
				  (if (> x 6)
				      (if (> x 7)
					  (if (> x 8)
					      (if (> x 9)
						  (if (> x 10)
						      (set! ctr (+ ctr 1000))
						      (set! ctr (- ctr 1)))
						  (set! ctr (- ctr 2)))
					      (set! ctr (- ctr 3)))
					  (set! ctr (- ctr 4))))))))
		  (set! ctr (- ctr 10)))
	      (set! ctr (- ctr 11))))
	ctr)
      969)

(test (if #f) 'error)
(test (if (< 2 3)) 'error)
(test (if #f 1 2 3) 'error)
(test (if 1 2 3 4) 'error)
(test (if #f 1 else 2) 'error)
(test (if) 'error)
(test ('+ '1 '2) 'error)
(test (if 1 . 2) 'error)
(test (if 1 2 . 3) 'error)
(test (if . 1) 'error)
(test (if _no_var_ 1) 'error)
(test (if (values) (values) (values) 1) 'error)
(num-test (+ 1 (if #t (values 3 4) (values 5 6)) 2) 10)
(let ()
  (define (bad a) (if a 1 2 3))
  (test (bad #f) 'error)
  (test (bad #t) 'error))


;;; when
(test (when #f #f) #<unspecified>)
(test (when #t #f) #f)
(test (when) 'error)
(test (when #t) 'error)
(test (when . #t) 'error)
(test (when #t . 1) 'error)
(test (when when when) when)
(test (symbol->string 'when) "when")
(test (when #t 1 2 3) 3)
(test (when #t (define a 1) (+ a 1)) 2)
(test ((when #t +) 2 3) 5)
(test (when #t (when #f #f)) #<unspecified>)
(test (+ (when #t (values 2 3))) 5)
(test (when (when #t #t) 2) 2)
(test (apply when '(< 2 3) '((+ 2 1))) 3)

(let ((x 0))
  (define (t1 a) (when a (set! x (+ x 1)) x))
  (test (t1 #t) 1)
  (test (t1 #f) #<unspecified>)
  (test (t1 #t) 2))


;;; unless
(test (unless #t #f) #<unspecified>)
(test (unless #f #f) #f)
(test (unless) 'error)
(test (unless #f) 'error)
(test (unless . #t) 'error)
(test (unless #f . 1) 'error)
(test (unless (not unless) unless) unless)
(test (symbol->string 'unless) "unless")
(test (unless #f 1 2 3) 3)
(test (unless #f (define a 1) (+ a 1)) 2)
(test ((unless #f +) 2 3) 5)
(test (unless #f (unless #t #f)) #<unspecified>)
(test (+ (unless #f (values 2 3))) 5)
(test (unless (unless #f #f) 2) 2)
(test (apply unless '(= 2 3) '((+ 2 1))) 3)

(let ((x 0))
  (define (t1 a) (unless a (set! x (+ x 1)) x))
  (test (t1 #f) 1)
  (test (t1 #t) #<unspecified>)
  (test (t1 #f) 2))

(test (when (unless (= 2 3) #t) 1) 1)




;;; --------------------------------------------------------------------------------
;;; quote
;;; --------------------------------------------------------------------------------

(test (quote a) 'a)
(test 'a (quote a))
(test '1 1)
(test '1/4 1/4)
(test '(+ 2 3) '(+ 2 3))
(test '"hi" "hi")
(test '#\a #\a)
(test '#f #f)
(test '#t #t)
(test '#b1 1)
(test '() '())
(test '(1 . 2) (cons 1 2))
(test #(1 2) #(1 2))
(test (+ '1 '2) 3)
(test (+ '1 '2) '3)
(test (+ ' 1 '   2) '    3)
(test (char? '#\a) #t)
(test (string? '"hi") #t)
(test (boolean? '#t) #t)
(test (if '#f 2 3) 3)
(test (if '#t 2 3) 2)
(test (vector? #()) #t)
(test (char? (quote #\a)) #t)
(test (string? (quote "hi")) #t)
(test (boolean? (quote #t)) #t)
(test (if (quote #f) 2 3) 3)
(test (if (quote #t) 2 3) 2)
(test (vector? (quote #())) #t)
(test (+ (quote 1) (quote 2)) (quote 3))
(test (list? (quote ())) #t)
(test (pair? (quote (1 . 2))) #t)
(test (+ '1.0 '2.0) 3.0)
(test (+ '1/2 '3/2) 2)
(test (+ '1.0+1.0i '-2.0) -1.0+1.0i)
(test (let ((hi 2)) (equal? hi 'hi)) #f)
(test ''1 (quote (quote 1)))
(test ''a (quote (quote a)))
(test (symbol? '#f) #f)
(test (symbol? '.') #t)
(test ''quote (quote (quote quote)))
(test (+ (cadr ''3) (cadadr '''4) (cadr (cadr (cadr ''''5)))) 12)
(test (+ (cadr ' '   3) (cadadr '  
  '    ' 4)) 7)
(test (+ '#| a comment |#2 3) 5)
(test (+ ' #| a comment |# 2 3) 5)
(test (eq? lambda 'lambda) #f)
(test (equal? + '+) #f)
(test (eq? '() ()) #t) ; s7 specific

(test (quote) 'error)
(test (quote . -1) 'error)
(test (quote 1 1) 'error)
(test (quote . 1) 'error)
(test (quote . (1 2)) 'error)
(test (quote 1 . 2) 'error)
(test (symbol? '1'1) #t) 
(test (apply '+ (list 1 2)) 'error)
(test ((quote . #\h) (2 . #\i)) 'error)
(test ((quote "hi") 1) #\i)

(test (equal? '(1 2 '(3 4)) '(1 2 (3 4))) #f)
(test (equal? '(1 2 '(3 4)) (quote (list 1 2 (quote (list 3 4))))) #f)
(test (equal? (list-ref '(1 2 '(3 4)) 2) '(3 4)) #f)
(test (equal? '(1 2 '(3 4)) (list 1 2 (list 'quote (list 3 4)))) #t)
(test (equal? '(1 2 ''(3 4)) (list 1 2 (list 'quote (list 'quote (list 3 4))))) #t)
(test (equal? '('3 4) (list (list 'quote 3) 4)) #t)
(test (equal? '('3 4) (list 3 4)) #f)
(test (equal? '('() 4) (list (list 'quote '()) 4)) #t)
(test (equal? '('('4)) (list (list quote (list (list quote 4))))) #f)
(test (equal? '('('4)) (list (list 'quote (list (list 'quote 4))))) #t) 
(test (equal? '('('4)) '((quote ((quote 4))))) #t)
(test (equal? '1 ''1) #f)
(test (equal? ''1 ''1) #t)
(test (equal? '(1 '(1 . 2)) (list 1 (cons 1 2))) #f)
(test (equal? #(1 #(2 3)) '#(1 '#(2 3))) #f)
(test (equal? #(1) #('1)) #f)
(test (equal? #(()) #('())) #f)
(test (equal? cons 'cons) #f)

(test (eqv? #\a (quote #\a)) #t)
(test (eqv? 1 (quote 1)) #t)
(test (eqv? 0 (quote 0)) #t)
(test (equal? #(1 2 3) (quote #(1 2 3))) #t)
(test (eqv? 3.14 (quote 3.14)) #t)
(test (eqv? 3/4 (quote 3/4)) #t)
(test (eqv? 1+1i (quote 1+1i)) #t)
(test (eq? #f (quote #f)) #t)
(test (eq? #t (quote #t)) #t)
(test (eq? '() (quote ())) #t)
(test (equal? '(1 2 3) (quote (1 2 3))) #t)
(test (equal? '(1 . 2) (quote (1 . 2))) #t)
(test ('abs -1) 'error)
(test ('"hi" 0) #\h)

(test (''begin 1) 'begin)
(test (''let ((x 1)) ('set! x 3) x) 'error)
(test ('and #f) 'error)
(test ('and 1 #f) 'error)
(test ('begin 1) 'error)
(test ('cond ('define '#f)) 'error)
(test ('let ((x 1)) ('set! x 3) x) 'error)
(test ('let* () ('define x 3) x) 'error)
(test ('or #f) 'error)
(test ('quote 3) 'error)
(test ((copy quote) 1) 1)
(test ((copy quote) quote) 'quote)
(test ((lambda (q) (let ((x 1)) (q x))) quote) 'x) ; these two are strange -- not sure about them, but Guile 1.8 is the same
(test ((lambda (s c) (s c)) quote #f) 'c)
;;; ((lambda (lambda) (lambda (else))) quote) -> '(else)
(test ((quote and) #f) 'error)
(test ((values quote) 1) 1)

(test ((lambda () (define (_f_ $a$) $a$) (_f_ (quote 1 1)))) 'error)
(test ((lambda () (define (_f_ $a$) $a$) (_f_ (quote 1 . 1)))) 'error)
(test ((lambda () (define (_f_ $a$) $a$) (_f_ (quote . 1)))) 'error)

;; see also quasiquote




;;; --------------------------------------------------------------------------------
;;; for-each
;;; --------------------------------------------------------------------------------

(test (let ((v (make-vector 5))) (for-each (lambda (i) (vector-set! v i (* i i))) '(0 1 2 3 4)) v) #(0 1 4 9 16))
(test (let ((ctr 0) (v (make-vector 5))) (for-each (lambda (i) (vector-set! v ctr (* i i)) (set! ctr (+ ctr 1))) '(0 1 2 3 4)) v) #(0 1 4 9 16))
(for-each (lambda (x) (display "for-each should not have called this")) ())
(test (let ((ctr 0)) (for-each (lambda (x y) (if (= x y) (set! ctr (+ ctr 1)))) '(1 2 3 4 5 6) '(2 3 3 4 7 6)) ctr) 3)
(test (let ((ctr 0)) (for-each (lambda (x y z) (set! ctr (+ ctr x y z))) '(0 1) '(2 3) '(4 5)) ctr) 15)
(test (let ((ctr 0)) (for-each (lambda (x y z) (set! ctr (+ ctr x y z))) '(1) '(3) '(5)) ctr) 9)
(test (let ((ctr 0)) (for-each (lambda (x y z) (set! ctr (+ ctr x y z))) () () ()) ctr) 0)
(test (let () (for-each abs '(1 2)) 1) 1)
(test (let ((ctr 0)) (for-each (lambda (a) (for-each (lambda (b) (set! ctr (+ ctr 1))) '(0 1))) '(2 3 4)) ctr) 6)
(test (let ((sum 0)) (for-each (lambda args (set! sum (+ sum (apply + args)))) '(0 1 2) '(2 1 0) '(3 4 5) '(5 4 3) '(6 7 8) '(8 7 6)) sum) 72)
(test (let ((sum 0)) (for-each (lambda (a b . args) (set! sum (+ sum a b (apply + args)))) '(0 1 2) '(2 1 0) '(3 4 5) '(5 4 3) '(6 7 8) '(8 7 6)) sum) 72)
(test (let ((sum 0)) (for-each (lambda (a b . args) (set! sum (+ sum a b (apply + args)))) '(0 1 2) '(2 1 0)) sum) 6)
(test (let () (for-each + '(0 1 2) '(2 1 0)) 0) 0)
(test (let () () ()) ())
(test (for-each + ()) #<unspecified>)
(test (let ((sum 0)) (for-each (lambda a (set! sum (+ sum (apply + a)))) '(1 2 3)) sum) 6)
(test (let ((sum 0)) (for-each (lambda* ((a 1)) (set! sum (+ sum a))) '(1 2 3)) sum) 6)
(test (let ((sum 0)) (for-each (lambda (a . b) (set! sum (+ sum a))) '(1 2 3)) sum) 6)
(test (let ((sum 0) (lst (list 1 2 3))) (for-each (lambda (a b c) (set! sum (+ sum a b c))) lst lst lst) sum) 18)
(test (let ((sum 0) (lst (vector 1 2 3))) (for-each (lambda (a b c) (set! sum (+ sum a b c))) lst lst lst) sum) 18)
(test (let ((v (vector 1 2 3))) (for-each vector-set! (list v v v) (list 0 1 2) (list 32 33 34)) v) #(32 33 34))
(test (let () (define (hi) (for-each (lambda (x) (+ x 1)) (list 1 2 3))) (hi) (hi)) #<unspecified>)
(test (let () (define (func) (for-each (let ((x 4)) (lambda (y) (+ x y))) (make-float-vector 8 0))) (define (hi) (func)) (hi)) #<unspecified>)

(test (let ((d 0))
	(for-each (let ((a 0))
		    (for-each (lambda (b) (set! a (+ a b))) (list 1 2))
		    (lambda (c) (set! d (+ d c a))))
		  (list 3 4 5))
	d)
      21)
(test (let ((d 0))
	(for-each (lambda (c)
		    (let ((a 0))
		      (for-each (lambda (b) (set! a (+ a b))) (list 1 2))
		      (set! d (+ d a c))))
		  (list 3 4 5))
	d)
      21)

(test (let ((ctr 0)) 
	(let ((val (call/cc 
		    (lambda (exit) 
		      (for-each (lambda (a) 
				  (if (> a 3) (exit a)) 
				  (set! ctr (+ ctr 1))) 
				(list 0 1 2 3 4 5)))))) 
	  (list ctr val)))
      (list 4 4))

(test (call-with-current-continuation
       (lambda (exit)
	 (for-each 
	  (lambda (x) 
	    (if (negative? x) (exit x)))
	  '(54 0 37 -3 245 19))
	 #t))
      -3)

(test (let ((ctr 0)
	    (cont #f)
	    (lst ()))
	(let ((val (call/cc 
		    (lambda (exit) 
		      (for-each (lambda (a) 
				  (if (and (not cont) (= a 2))
				      (exit a)) 
				  (if (and cont (= a 5)) 
				      (exit a))
				  (call/cc (lambda (c) (set! cont c)))
				  (set! lst (cons ctr lst))
				  (set! ctr (+ ctr 1)))
				(list 0 1 2 3 4 5)))))) 
	  (if (< val 5)
	      (cont))
	  (list ctr val lst)))
      (list 5 5 (list 4 3 2 1 0)))

(test (let ((lst ())) 
	(for-each (lambda (a) (set! lst (cons a lst))) 
		  (let ((lst ())) 
		    (for-each (lambda (b) (set! lst (cons b lst))) 
			      (list 1 2 3)) 
		    lst)) 
	lst) 
      (list 1 2 3))

(test (let ((v (vector 0 0 0))
	    (iv #i(1 2 3))
	    (ctr 0))
	(for-each (lambda (i)
		    (vector-set! v ctr i)
		    (set! ctr (+ ctr 1)))
		  iv)
	v)
      #(1 2 3))

;;; this is an infinite loop?
					; (let ((cont #f)) (call/cc (lambda (x) (set! cont x))) (for-each cont (list 1 2 3)))
(test (call/cc (lambda (x) (for-each x (list 1 2 3)))) 1) ; map also gives 1 ... perhaps not actually legal?

(let ((args (list 0 1 2))
      (xx (list 4)))
  (define (it1)
    (for-each
     (lambda (x)
       (catch #t
	 (lambda ()
	   (set-car! xx x))
	 (lambda any 'error)))
     (cdr args))
    (car xx))
  (test (it1) 2))

(let ((args (list 0 1 2))
      (xx (list 4)))
  (define (it1)
    (for-each
     (lambda (x)
       (catch #t
	 (lambda ()
	   (set-car! xx x))
	 (lambda any 'error))
       (set-car! xx (+ (car xx) 32)))
     (cdr args))
    (car xx))
  (test (it1) 34))

(test (let ((ctr 0))
	(for-each 
	 (lambda (x)
	   (for-each
	    (lambda (x y)
	      (for-each 
	       (lambda (x y z)
		 (set! ctr (+ x y z)))
	       (list x (+ x 1))
	       (list y (+ y 2))
	       (list (+ x y) (- x y))))
	    (list (+ x 3) (+ x 4) (+ x 5))
	    (list (- x 3) (- x 4) (- x 5))))
	 (list 1 2 3 4 5))
	ctr)
      23)

(for-each
 (lambda (a)
   (if (not (string=? a "hi"))
       (format #t "yow: ~S" a)))
 (list "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi" "hi"))


;; now some mixed cases
(test (let ((sum 0)) (for-each (lambda (n m) (set! sum (+ sum n m))) (list 1 2) (vector 3 4)) sum) 10)
(test (let ((sum 0)) (for-each (lambda (n m) (set! sum (+ sum n m))) (vector 1 2) (list 3 4)) sum) 10)
(test (let ((sum 0)) (for-each (lambda (n m p) (set! sum (+ sum n m))) (vector 1 2) (list 3 4) (vector 5 6)) sum) 10)
(test (let ((sum 0)) (for-each (lambda (n m p) (if (char=? p #\x) (set! sum (+ sum n m)))) (vector 1 2 3) (list 3 4 5) "xax") sum) 12)

(test (let* ((x (list (list 1 2 3))) (y (apply for-each abs x))) x) '((1 2 3)))

(test (for-each (lambda (x) (display "for-each should not have called this"))) 'error)
(test (for-each (lambda () 1) ()) 'error) ; #<unspecified>
(test (let ((ctr 0)) (for-each (lambda (x y z) (set! ctr (+ ctr x y z))) '(1) '(3) ()) ctr) 0)
(test (let ((ctr 0)) (for-each (lambda (x y z) (set! ctr (+ ctr x y z))) '(0 1) '(2 3) '(4 5 6)) ctr) 15)
(test (for-each (lambda (a b) (+ a b)) (list 1)) 'error)
(test (for-each (lambda (a b) (+ a b)) (list 1) (list)) #<unspecified>)
(test (for-each (lambda (a b) (+ a b)) (list 1)) 'error)
(test (for-each (lambda (a b) (+ a b)) (list 1) (list 2) (list 3)) 'error)
(test (for-each (lambda (a b) (+ a b)) (list 1) (list 1 2)) #<unspecified>)
(test (for-each (lambda (a b) (+ a b)) (list 1 2) (list 1)) #<unspecified>)
(test (for-each (lambda (a b) (+ a b)) (list 1 2) (list 1 2 3)) #<unspecified>)
(test (for-each (lambda (a b) (+ a b)) (list 1 2) (list 1)) #<unspecified>)
(test (for-each (lambda (a b) (+ a b)) (list 1 2) (list 1 2) (list)) 'error) ; #<unspecified>
(test (for-each (lambda (a b) (+ a b)) (list 1 2) (list 1 2) (list 1 2)) 'error)
(test (for-each (lambda (a b) (+ a b)) (list 1 2) (cons 1 2)) #<unspecified>)
(test (for-each (lambda (a b) (+ a b)) (cons 1 2) (list 1 2)) #<unspecified>)
(test (for-each (lambda (a) (+ a 1)) (list 1) (list 2)) 'error)
(test (for-each (lambda (a) (+ a 1)) #\a) 'error)
(test (for-each (lambda (a) (+ a 1)) (cons 1 2)) #<unspecified>)
(test (for-each (lambda (x) x) (openlet (inlet 'make-iterator (lambda (v) v)))) 'error)
(test (for-each (lambda (x) x) (openlet (inlet 'make-iterator (let ((iterator? #t)) (lambda (v) v))))) 'error)
(test (let ((sum 0)) (for-each (lambda (a b . args) (set! sum (+ sum a b (apply + args)))) '(0 1 2)) sum) 'error)
(test (for-each (lambda (a) a) '(1 2 . 3)) #<unspecified>)
(test (for-each #(0 1 2) #(2 1 0)) #<unspecified>)
(for-each
 (lambda (arg)
   (test (for-each arg (list 1)) #<unspecified>))
 (list (list 1 2 3) #(1 2 3) "hi"))

(for-each
 (lambda (op)
   (test (for-each op ()) 'error)
   (test (for-each op "") 'error)
   (test (for-each op #(1 2 3) ()) 'error)
   (test (for-each op #() (list) (string)) 'error))
 (list 0 () #f #t 'a-symbol :hi #\a #<eof> #<unspecified> #<undefined> 0.0 1+i 1/2 1/0 0/0 *stdout* (current-input-port)))
(for-each
 (lambda (arg)
   (test (for-each arg (list 1)) 'error))
 (list -1 #\a 1 'a-symbol 3.14 3/4 1.0+1.0i #f #t))
(for-each
 (lambda (arg)
   (test (for-each (lambda (n m) n) (list 1) arg) 'error))
 (list -1 #\a 1 'a-symbol 3.14 3/4 1.0+1.0i #f #t))
(for-each
 (lambda (arg)
   (test (for-each (lambda (a) a) arg) 'error))
 (list -1 #\a 1 'a-symbol 3.14 3/4 1.0+1.0i #f #t))

(test (for-each) 'error)
(test (for-each #t) 'error)
(test (for-each map #t) 'error)

(test (for-each abs () abs) 'error)
(test (for-each abs '(1) #(1)) 'error)
(test (let ((vals ())) (for-each for-each (list (lambda (a) (set! vals (cons (abs a) vals)))) (list (list -1 -2))) vals) '(2 1))
(test (let ((c #f)) (for-each (lambda (x) (set! c x)) "a") c) #\a)
(test (let ((c #f)) (for-each (lambda (x) (set! c x)) "") c) #f)
(test (let ((c #f)) (for-each (lambda (x) (set! c x)) (string #\null)) c) #\null)

(test (let ((L (list 1 2 3 4 5)) (sum 0)) (for-each (lambda (x) (set-cdr! (cddr L) 5) (set! sum (+ sum x))) L) sum) 6)
; map (below) has more tests along this line
(test (let ((f #f)) (for-each (lambda (a) (if (eq? a 'a) (set! f (lambda () a)))) '(a b c)) (f)) 'a)
(test (let ((i 0) (f (make-vector 3))) (for-each (lambda (b) (vector-set! f i b) (set! i (+ i 1))) '(a b c)) f) #(a b c))
(test (let ((i 0) (f (make-vector 3)) (lst '(a b c))) (define (hi) (for-each (lambda (b) (vector-set! f i b) (set! i (+ i 1))) lst)) (hi) f) #(a b c))
(test (let ((i 0) (f (make-vector 3)) (lst '(a b c))) (define (hi) (for-each (lambda (b) (let () (vector-set! f i b) (set! i (+ i 1)))) lst)) (hi) f) #(a b c))
(test (let ((i 0) (f (make-vector 3)) (lst (list 1 2 3))) (define (hi) (for-each (lambda (b) (vector-set! f i (let ((b (+ b 1))) b)) (set! i (+ i 1))) lst)) (hi) f) #(2 3 4))
(test (let ((i 0) (f (make-vector 3)) (lst (list 1 2 3))) (define (hi) (for-each (lambda (b) (let ((b (+ b 1))) (vector-set! f i (let ((b (+ b 1))) b)) (set! i (+ i 1)))) lst)) (hi) f) #(3 4 5))
(test (let ((f #f)) (define (hi) (for-each (lambda (a) (if (eq? a 'a) (set! f (lambda () (let () a))))) '(a b c))) (hi) (f)) 'a)
(test (let ((lst '((a b c) (1 2 3)))) (define (hi) (for-each (lambda (a) a) (apply values lst))) (hi)) 'error)
(test (let ((lst ())) (for-each (lambda args (set! lst (cons args lst))) (values (list 1 2 3) '(4 5 6) (list 7 8 9))) lst) '((3 6 9) (2 5 8) (1 4 7)))

(test (for-each ="") 'error) ; #<unspecified>
(test (for-each =""=) 'error)
(test (for-each = "" 123) 'error)
(test (for-each = () 123) 'error)
(test (for-each =()=) 'error)
(test (for-each abs "") #<unspecified>)
(test (for-each null? () #() "") 'error) ; #<unspecified>
(test (for-each null? () #() 0 "") 'error)
(test (for-each define '(a) '(3)) #<unspecified>)
(test (let () (for-each define '(a b c) '(1 2 3)) (list a b c)) '(1 2 3))
(test (let () (for-each define '(first second third fourth) '(car cadr caddr cadddr)) (third '(1 2 3 4 5))) 3)
(test (for-each '(()) #()) #<unspecified>)
(test (for-each '(1 2 . 3) '(1 . 2)) #<unspecified>)
(test (for-each '(()) ()) #<unspecified>)
(test (for-each #2D((1 2) (3 4)) '(1)) #<unspecified>)
(test (for-each "a\x00;b" #(1 2)) #<unspecified>)
(test (for-each #(1 (3)) '(1)) #<unspecified>)
(test (for-each '((1 (2)) (((3) 4))) '(1)) #<unspecified>)
(test (for-each "hi" '(1)) #<unspecified>)
(test (for-each #() #()) 'error) ; #<unspecified>
(test (for-each '(1 . 2) #()) #<unspecified>)
(test (let ((ht (hash-table '(a . 1) '(b . 2)))) (for-each ht ht)) #<unspecified>)
(test (let ((ht (hash-table '(a . 1) '(b . 2)))) (let ((sum 0)) (for-each (lambda (c) (set! sum (+ sum (cdr c)))) ht) sum)) 3)
(test (let ((ht (hash-table '(a . 1) '(b . 2)))) (for-each ht '(a b))) #<unspecified>)
(test (for-each ''2 '(1)) #<unspecified>)
(let ((os (*s7* 'safety)))
  (set! (*s7* 'safety) 1)
  (let ((lst (list 1 2))) (set! (cdr (cdr lst)) lst) (test (for-each lst lst) #<unspecified>)) ; 'error
  (let ((lst (list 1 2))) (set! (cdr (cdr lst)) lst) (test (for-each #() lst) 'error))
  (set! (*s7* 'safety) os))
(test (for-each 1 "hi" ()) 'error)
(test (for-each 0 #() ()) 'error)
(test (for-each #\a #(1 2) '(3 4) "") 'error)
(test (for-each '2 ()) 'error)
(test (let ((a 1) (b 2)) (for-each apply (list set! set!) '(a b) '((12) (32))) (list a b)) '(12 32))
(test (let ((a 1) (b 2) (c 3)) (for-each apply (make-list 3 set!) '(a b c) '((12) (32) (0))) (list a b c)) '(12 32 0))
(test (let ((a 1) (b 2) (c 3)) (for-each set! '(a b c) '(12 32 0)) (list a b c)) '(12 32 0))

(let ()
  (define (hi)
    (let ((lst '(1 2 3)))
      (for-each
       (lambda (x)
	 (catch #t
	   (lambda ()
	     (if (defined? 'local-x)
		 (format #t ";for-each catch local env not cleared: ~A~%" local-x))
	     (define local-x x)
	     local-x)
	   (lambda args #f)))
       lst)))
  (hi)
  (hi))

;; this caught me -- Guile returns 6 3 also
(test (let ((fnc #f))
	(for-each
	 (let ((ctr 0))
	   (lambda (x)
	     (if (= ctr 3)
		 (set! fnc (lambda () ctr)))
	     (set! ctr (+ ctr 1))))
	 '(1 2 3 4 5 6))
	(fnc))
      6)

(test (let ((fnc #f))
	(for-each
	 (let ((ctr 0))
	   (lambda (x)
	     (if (= ctr 3)
		 (set! fnc (let ((local-ctr ctr))
			     (lambda () local-ctr))))
	     (set! ctr (+ ctr 1))))
	 '(1 2 3 4 5 6))
	(fnc))
      3)

(let ((x 0))
  (let ((p1 (dilambda (lambda (a) (set! x (+ x a))) (lambda (a b) (+ a b)))))
    (for-each p1 '(1 2 3))
    (test x 6))
  (set! x 0)
  (for-each (lambda args (set! x (+ x (car args)))) '(1 2 3))
  (test x 6)
  (set! x 0)
  (for-each (lambda* (a (b 2)) (set! x (+ x a))) '(1 2 3))
  (test x 6)
  (set! x 0)
  (for-each (lambda args (set! x (+ x (car args) (cadr args)))) '(1 2 3) '(3 2 1))
  (test x 12)
  (set! x 0)
  (for-each (lambda* (a (b 2)) (set! x (+ x a b))) '(1 2 3) '(3 2 1))
  (test x 12)
  (set! x 0)
  (for-each (lambda* (a (b 2)) (set! x (+ x a b))) '(1 2 3))
  (test x 12))

(test (let ((lst '(1 2 3)) (sum 0)) (define-macro (hi a) `(set! sum (+ sum (+ 1 ,a)))) (for-each hi lst) sum) 9)
(test (let ((lst '(1 2 3)) (sum 0)) (define-bacro (hi a) `(set! sum (+ sum (+ 1 ,a)))) (for-each hi lst) sum) 9)
  
(let ((sum 0))
  (define (and-for-each func . args)
    ;; apply func to first of each arg, stopping if func returns #f
    (call-with-exit
     (lambda (quit)
       (apply for-each 
	      (lambda arglist
		(if (not (apply func arglist))
		    (quit #<unspecified>)))
	      args))))
  
  (test (and-for-each (lambda (arg) 
			(and (not (null? arg))
			     (set! sum (+ sum arg))))
		      (list 1 2 () 3 4))
	#<unspecified>)
  (test sum 3)
  (set! sum 0)
  
  (and-for-each (lambda (arg) 
		  (and (not (null? arg))
		       (set! sum (+ sum arg))))
		(list 1 2 3 4))
  (test sum 10)
  (set! sum 0)
  
  (and-for-each (lambda (arg1 arg2) 
		  (and (not (null? arg1))
		       (not (null? arg2))
		       (set! sum (+ sum arg1 arg2))))
		(list 1 2 3 4)
		(list 5 6 () 7 8))
  (test sum 14))


(define (and-map func . args) ; see stuff.scm for a better version
  (call-with-exit
   (lambda (quit)
     (let ((result ()))
       (apply for-each 
	      (lambda arglist
		(let ((val (apply func arglist)))
		  (if (not val)
		      (quit (reverse result))
		      (set! result (cons val result)))))
	    args)
       (reverse result)))))

(test (and-map even? '(0 2 4 5 6)) '(#t #t #t))

(define (find-if f . args)
  (call-with-exit
   (lambda (return) 
     (apply for-each (lambda main-args 
		       (if (apply f main-args) 
			   (apply return main-args)))
	    args))))

(test (find-if even? #(1 3 5 2)) 2)
(test (* (find-if > #(1 3 5 2) '(2 2 2 3))) 6)

(define (position-if f . args)
  (let ((pos 0))
    (call-with-exit
     (lambda (return) 
       (apply for-each (lambda main-args 
			 (if (apply f main-args) 
			     (return pos))
			 (set! pos (+ pos 1)))
	    args)))))

(test (position-if even? #(1 3 5 2)) 3)
(test (position-if > #(1 3 5 2) '(2 2 2 3)) 1)

(let ((summer (lambda (v)
		(let ((sum 0))
		  (do ((i 0 (+ i 1)))
		      ((= i 10) sum)
		    (set! sum (+ sum ((v i)))))))))
		
  (test (let ((saved-args (make-vector 10))
	      (i 0))
	  (for-each
	   (lambda (arg)
	     (set! (saved-args i) arg)
	     (set! i (+ i 1)))
	   (list 0 1 2 3 4 5 6 7 8 9))
	  (set! (saved-args 0) 32)
	  saved-args)
	#(32 1 2 3 4 5 6 7 8 9))
  
  (test (let ((f #f))
	  (for-each
	   (lambda (i)
	     (let ()
	       (define (x) i)
	       (if (= i 1) (set! f x))))
	   (list 0 1 2 3))
	  (f))
	1)
  
  (test (let ((saved-args (make-vector 10))
	      (i 0))
	  (for-each
	   (lambda (arg)
	     (set! (saved-args i) (lambda () arg))
	     (set! i (+ i 1)))
	   (list 0 1 2 3 4 5 6 7 8 9))
	  (summer saved-args))
	45)
  
  (test (let ((saved-args (make-list 10))
	      (i 0))
	  (for-each
	   (lambda (arg)
	     (list-set! saved-args i (lambda () arg))
	     (set! i (+ i 1)))
	   (list 0 1 2 3 4 5 6 7 8 9))
	  (summer saved-args))
	45)
  
;;; these are the same but use map
  (test (let ((saved-args (make-vector 10))
	      (i 0))
	  (map
	   (lambda (arg)
	     (set! (saved-args i) arg)
	     (set! i (+ i 1)))
	   (list 0 1 2 3 4 5 6 7 8 9))
	  (set! (saved-args 0) 32)
	  saved-args)
	#(32 1 2 3 4 5 6 7 8 9))
  
  (test (let ((f #f))
	  (map
	   (lambda (i)
	     (let ()
	       (define (x) i)
	       (if (= i 1) (set! f x))))
	   (list 0 1 2 3))
	  (f))
	1)
  
  (test (let ((saved-args (make-vector 10))
	      (i 0))
	  (map
	   (lambda (arg)
	     (set! (saved-args i) (lambda () arg))
	     (set! i (+ i 1)))
	   (list 0 1 2 3 4 5 6 7 8 9))
	  (summer saved-args))
	45)
  
  ;; and again but with named let
  (test (let ((saved-args (make-vector 10)))
	  (let runner ((arg 0))
	    (set! (saved-args arg) arg)
	    (if (< arg 9)
		(runner (+ arg 1))))
	  (set! (saved-args 0) 32)
	  saved-args)
	#(32 1 2 3 4 5 6 7 8 9))
  
  (test (let ((f #f))
	  (let runner ((i 0))
	    (let ()
	      (define (x) i)
	      (if (= i 1) (set! f x))
	      (if (< i 3)
		  (runner (+ i 1)))))
	  (f))
	1)
  
  (test (let ((saved-args (make-vector 10)))
	  (let runner ((i 0))
	    (set! (saved-args i) (lambda () i))
	    (if (< i 9)
		(runner (+ i 1))))
	  (summer saved-args))
	45)
  
  
;;; and recursion
  (test (let ((saved-args (make-vector 10)))
	  (define (runner arg)
	    (set! (saved-args arg) arg)
	    (if (< arg 9)
		(runner (+ arg 1))))
	  (runner 0)
	  (set! (saved-args 0) 32)
	  saved-args)
	#(32 1 2 3 4 5 6 7 8 9))
  
  (test (let ((f #f))
	  (define (runner i)
	    (let ()
	      (define (x) i)
	      (if (= i 1) (set! f x))
	      (if (< i 3)
		  (runner (+ i 1)))))
	  (runner 0)
	  (f))
	1)
  
  (test (let ((saved-args (make-vector 10)))
	  (define (runner i)
	    (set! (saved-args i) (lambda () i))
	    (if (< i 9)
		(runner (+ i 1))))
	  (runner 0)
	  (summer saved-args))
	45)
  
  
;;; and member/assoc
  (test (let ((saved-args (make-vector 10)))
	  (member 'a '(0 1 2 3 4 5 6 7 8 9) 
		  (lambda (a b)
		    (set! (saved-args b) (lambda () b))
		    #f))
	  (summer saved-args))
	45)
  
  (test (let ((saved-args (make-vector 10)))
	  (assoc 'a '((0 b) (1 b) (2 b) (3 b) (4 b) (5 b) (6 b) (7 b) (8 b) (9 b))
		 (lambda (a b)
		   (set! (saved-args b) (lambda () b))
		   #f))
	  (summer saved-args))
	45)
  
  (test (let ((saved-args (make-vector 10 #f)))
	  (sort! '(3 2 1 4 6 5 9 8 7 0)
		 (lambda (a b)
		   (if (not (saved-args b))
		       (set! (saved-args b) (lambda () b)))
		   (< a b)))
	  (summer saved-args))
	45)
  
;;; and do which has never worked in this way
#|  
  (test (let ((saved-args (make-vector 10)))
	  (do ((i 0 (+ i 1)))
	      ((= i 10))
	    (set! (saved-args i) (lambda () i)))
	  (summer saved-args))
	45)
|#
  )

;;; originally for-each/map used old_frame_with_slot, but if the closure had
;;;   a local define, the arg symbol was not updated (let_id), leading to segfaults
;;;   if the optimizer thought checks were unneeded.  So...

(let ()
  (define (f1) (for-each (lambda (f3) (let ((x 0)) (if (> f3 x) (abs f3)))) (list 1 2))) (f1)
  (define (f2) (for-each (lambda (f3) (define x 0) (if (> f3 x) (abs f3))) (list 1 2))) (f2)
  (let ((f (let flet ((x 1)) (if (> x 0) (flet (- x 1))) flet))) (map f (list 1 2)))
  (define (f4) (map (let flet ((x 1)) (if (> x 0) (flet (- x 1))) flet) (list 1 2))) (f4)
  (define (f4a) (for-each (let flet ((x 1)) (if (> x 0) (flet (- x 1))) flet) (list 1 2))) (f4a)
  (define (f4b) (for-each (let flet ((x 1)) (define y 0) (if (> x y) (flet (- x 1))) flet) (list 1 2))) (f4b)
  (define (f5) (for-each (let () (define (f x) (if (> x 0) (f (- x 1)))) f) (list 1 2))) (f5)
  (define (f5a) (for-each (let () (define (f x) (define y 0) (if (> x y) (f (- x 1)))) f) (list 1 2))) (f5a)
  (define (f5b) (for-each (lambda (x) (define z 2) (define y 0) (if (> z x y) (display (- x 1)))) (list 1 2))) (f5b)
  (define (f6) (map (let () (define (f x) (if (> x 0) (f (- x 1)) x)) f) (list 1 2))) (test (f6) '(0 0))
  (define (f7) (map (let () (define (f x) (define y (+ x 1)) (if (> y 0) (f (- x 1)) x)) f) (list 1 2))) (test (f7) '(-1 -1))
  )



;;; --------------------------------------------------------------------------------
;;; map
;;; --------------------------------------------------------------------------------

(test (map cadr '((a b) (d e) (g h))) '(b e h))
(test (map (lambda (n) (expt n n)) '(1 2 3 4 5)) '(1 4 27 256 3125))
(test (map + '(1 2 3) '(4 5 6)) '(5 7 9))

(test (apply vector (map (lambda (i) (* i i)) '(0 1 2 3 4))) #(0 1 4 9 16))
(map (lambda (x) (display "map should not have called this")) ())
(test (let ((ctr 0)) (map (lambda (x y) (if (= x y) (set! ctr (+ ctr 1))) ctr) '(1 2 3 4 5 6) '(2 3 3 4 7 6))) (list 0 0 1 2 2 3))
(test (let ((ctr 0)) (map (lambda (x y z) (set! ctr (+ ctr x y z)) ctr) '(0 1) '(2 3) '(4 5))) (list 6 15))
(test (let ((ctr 0)) (map (lambda (x y z) (set! ctr (+ ctr x y z)) ctr) '(1) '(3) '(5))) (list 9))
(test (let ((ctr 0)) (map (lambda (x y z) (set! ctr (+ ctr x y z)) ctr) () () ())) ())
(test (map (lambda (a b) (+ a b)) (list 1 2) (list 1 2)) (list 2 4))
(test (map abs '(1 -2)) (list 1 2))
(test (map + '(0 1 2) '(2 1 0) '(3 4 5) '(5 4 3) '(6 7 8) '(8 7 6)) (list 24 24 24))
(test (map (lambda (a) (cons a (map (lambda (b) (+ b 1)) (list 0 1 2)))) (list 3 4 5)) '((3 1 2 3) (4 1 2 3) (5 1 2 3)))
(test (map (lambda (a) (+ a 1)) (map (lambda (b) (+ b 1)) (map (lambda (c) (+ c 1)) (list 0 1 2)))) '(3 4 5))
(test (map (lambda args (apply + args)) '(0 1 2) '(3 4 5) '(6 7 8) '(9 10 11) '(12 13 14)) '(30 35 40))
(test (map (lambda (a b . args) (+ a b (apply + args))) '(0 1 2) '(3 4 5) '(6 7 8) '(9 10 11) '(12 13 14)) '(30 35 40))
(test (map (lambda (a b . args) (+ a b (apply + args))) '(0 1 2) '(3 4 5)) '(3 5 7))
(test (map (lambda args args) '(1 2 3)) '((1) (2) (3)))
(test (map + () ()) ())
(test (map + (#(#() #()) 1)) ())
(test (map + #(1) #(1) #(1)) '(3))
(test (map list '(a b c)) '((a) (b) (c)))
(test (map (lambda (a b) (- a b)) (list 1 2) (vector 3 4)) '(-2 -2))
(test (map (lambda (a b c) (if (char=? a #\a) (+ b c) (- b c))) "axa" (list 1 2 3) (vector 4 5 6)) '(5 -3 9))
(test (map vector (memv 1 (list 1 2 3))) '(#(1) #(2) #(3)))
(test (map append #(1 2 3)) '(1 2 3))
(test (map eval '((+ 1 2) (* 3 4))) '(3 12))
(test (map (map + (list 1 2 3)) (list 0 1 2)) '(1 2 3))
(test (let ((a #t) (b #f) (c #t)) (map when '(a b c) '(12 32 0))) '(12 #<unspecified> 0))
(test (let ((a #t) (b #f)) (map if '(a b) '(1 2) '(3 4))) '(1 4))
(test (let ((a #t) (b #f)) (map unless '(a b) '(1 2))) '(#<unspecified> 2))
(test (let ((a #t) (b #f)) (list (map set! '(a b) '(1 2)) a b)) '((1 2) 1 2))
(test (let ((a #t) (b #f)) (map begin '(a b))) '(#t #f))
(test (let () (map apply (map lambda '(a b) '((car a) (car b))) '((2) (3)))) '(2 3))
(test (let () (map apply (map lambda* '(((a 1)) ((b 2))) '(a b)) '((3) ()))) '(3 2))
(test (map + '(1 2 3) '(4 5 6) '(7 8 9)) '(12 15 18))

(test (let* ((x (list (list 1 2 3))) (y (apply map abs x))) (list x y)) '(((1 2 3)) (1 2 3)))
(test (let* ((x (quote ((1 2) (3 4)))) (y (apply map ash x))) (list x y)) '(((1 2) (3 4)) (8 32)))
(test (let* ((x (quote ((1 2 3) (4 5 6) (7 8 9)))) (y (apply map + x))) (list x y)) '(((1 2 3) (4 5 6) (7 8 9)) (12 15 18)))
(test (map * (map + '(1 2 3) '(4 5 6)) '(1 2 3)) '(5 14 27))
(test (apply map * (apply map + '(1 2 3) '((4 5 6))) '((1 2 3))) '(5 14 27))
(test (let* ((x (lambda () '(1 2 3))) (y (apply map - (list (x))))) (x)) '(1 2 3))

;(test (map car (list (list 0) (list (values)) (list 2))) (map (lambda (x) (car x)) (list (list 0) (list (values)) (list 2))))
(test (apply append (map list '((a . 1) (b . 2) #<eof>))) '((a . 1) (b . 2) #<eof>))
(test (apply append (map list '(a b #<eof> d))) '(a b #<eof> d))
(test (map values (vector 1 2 #<eof> 3)) '(1 2 #<eof> 3))

(test (map (lambda (x) (set! x (* 2 x)) 2) '(1 2 3)) '(2 2 2))
(test (map (lambda (x) x (set! x (* 2 x)) x) '(1 2 3)) '(2 4 6))
(test (map (lambda (x) 1) '(1 2 3)) '(1 1 1))

(test (let () (define (f) (map (let ((x 3)) (lambda (y) (+ x y))) '((x 1) (y . 2)))) (f)) 'error)
(test (let () (define (f) (map (let ((x 3)) (lambda (y) (+ x y))) '(x 2))) (f)) 'error)
(test (let () (define (f) (map (let ((x 3)) (lambda (y) (+ x y))) '(1 2))) (f)) '(4 5))
(test (let () (define (f) (map (let ((x 3)) (let ((y 0)) (lambda (y) (+ x y)))) '(1 2))) (f)) '(4 5))
(test (let () (define (func) (map (lambda (x) (if (>= x 0.0) x (- x))) (list (float-vector? (block))))) (define (hi) (func)) (hi)) 'error)

(test (let ((d 0))
	(map (let ((a 0))
	       (map (lambda (b) (set! a (+ a b))) (list 1 2))
	       (lambda (c) (set! d (+ d c a)) d))
	     (list 3 4 5)))
      (list 6 13 21))
(test (let ((d 0))
	(map (lambda (c)
	       (let ((a 0))
		 (map (lambda (b) (set! a (+ a b))) (list 1 2))
		 (set! d (+ d a c))
		 d))
	     (list 3 4 5)))
      (list 6 13 21))

(test (let ((ctr 0))
	(let ((val (call/cc 
		    (lambda (exit) 
		      (map (lambda (a) 
			     (if (> a 3) (exit a)) 
			     (set! ctr (+ ctr 1))
			     ctr)
			   (list 0 1 2 3 4 5))))))
	  (list ctr val)))
      (list 4 4))

(test (call-with-current-continuation
       (lambda (exit)
	 (map 
	  (lambda (x) 
	    (if (negative? x) (exit x))
	    x)
	  '(54 0 37 -3 245 19))))
      -3)

(test (let ((ctr 0)
	    (cont #f)
	    (lst ()))
	(let ((val (call/cc 
		    (lambda (exit) 
		      (map (lambda (a) 
			     (if (and (not cont) (= a 2))
				 (exit a)) 
			     (if (and cont (= a 5)) 
				 (exit a))
			     (call/cc (lambda (c) (set! cont c)))
			     (set! lst (cons ctr lst))
			     (set! ctr (+ ctr 1))
			     ctr)
			   (list 0 1 2 3 4 5))))))
	  (if (< val 5)
	      (cont))
	  (list ctr val lst)))
      (list 5 5 (list 4 3 2 1 0)))

(let ()
  (define (tree-add x lst)
    (define (tree-add-1 lst-1)
      (map (lambda (a)
	     (if (pair? a) (tree-add-1 a) (+ a x)))
	   lst-1))
    (tree-add-1 lst))
  (test (tree-add 12 '((1 2) ((3)) 4 5)) '((13 14) ((15)) 16 17)))

(test (map (lambda (a) a) (map (lambda (b) b) (list 1 2 3))) (list 1 2 3))
(test (map cons '(a b c) '(() () ())) '((a) (b) (c)))
(test (map (lambda a (list a)) '(1 2 3)) '(((1)) ((2)) ((3))))
(test (map (lambda* a (list a)) '(1 2 3)) '(((1)) ((2)) ((3))))
(test (map (lambda* (a) (list a)) '(1 2 3)) '((1) (2) (3)))
(test (map (lambda* ((a 0)) (list a)) '(1 2 3)) '((1) (2) (3)))
(test (map (lambda* ((a 0) (b 1)) (list a)) '(1 2 3)) '((1) (2) (3)))
(test (map (lambda (a . b) (list a)) '(1 2 3)) '((1) (2) (3)))
(test (map list '(1 2 3)) '((1) (2) (3)))
(test (map (lambda a (apply list a)) '(1 2 3)) '((1) (2) (3)))
(test (map (lambda a (apply values a)) '(1 2 3)) '(1 2 3))
(test (map (lambda a (values a)) '(1 2 3)) '((1) (2) (3)))
(test (map (lambda a (append a)) '(1 2 3)) '((1) (2) (3)))
(test (map values '(1 2 3)) '(1 2 3))
;(test ((lambda* ('a) quote) 1) 1)
(test (procedure? (car (map lambda '(()) '((1))))) #t)
(test (procedure? (car (map lambda '((x)) '(((+ x 1)))))) #t)
(test (map #(0 1 2) #(2 1 0)) '(2 1 0))
;(test (map quasiquote '((quasiquote 1) (quasiquote 2))) '(1 2)) -- this has changed (12-May-14)
(test (map (lambda (a b) (a b)) (map lambda '((x) (y) (z)) '((+ x x) (* y y) (expt z z))) (list 1 2 3)) '(2 4 27))
(test (map apply (map lambda '((x) (y) (z)) '((+ x x) (* y y) (expt z z))) '((1) (2) (3))) '(2 4 27))
(test (let () (define (add-some x) (define (add-some x) (+ x 2)) (+ x 1)) (map add-some '(1 2 3 4))) '(2 3 4 5)) ; from some CL website -- kinda ridiculous
(test (map gcd #(1 2)) '(1 2))
(test (apply vector (map values #(1 2) #(3 4))) #(1 3 2 4))
(test (map values '(1 2 3) '(4 5 6) '(7 8 9)) '(1 4 7 2 5 8 3 6 9))
(test (map eval (list (+ 1 2) (+ 3 4))) '(3 7))
(test (map apply (list + - * /) (list 1 2 3 4) '((5) (6) (7) (8))) '(6 -4 21 1/2))

;;; (let ((val ())) (list (map (lambda a (set! val (cons a val)) a) '(1 2 3)) val)) -> ((#3=(1) #2=(2) #1=(3)) (#1# #2# #3#))
(test (map if '(#f #f #t) '(0 1 2) '(3 4 5)) '(3 4 2))
(test (map apply (map lambda '(() (a) (a b)) '(1 (+ a 1) (+ a b 1))) '(() (2) (3 4))) '(1 3 8))
(test (map values (list 1 2 3) (list 4 5 6)) '(1 4 2 5 3 6))
(test (map map (list values) '((1 2)) '((3 4))) '((1 3 2 4)))
(test (map values '((1 2)) '((3 4))) '((1 2) (3 4)))
(test (map map (list map) (list (list values)) '(((1 2))) '(((3 4)))) '(((1 3 2 4))))
(test (map apply (list values) '(((1 2))) '(((3 4)))) (apply map values '(((1 2))) '(((3 4))))) ; !
(test (let ((x '((1 2)))) (eval `(apply apply values x)) (object->string x)) "((1 2))") ; not "((values 1 2))" -- 24-Aug-12
(test (map (lambda (x) x) #u8(255)) (list 255))

(let ()
  (define (shuffle . args) 
    (apply map values args))
  (test (shuffle '(1 2 3) #(4 5 6) '(7 8 9)) '(1 4 7 2 5 8 3 6 9))
  (test (shuffle '(1 2 3)) '(1 2 3))
  (test (shuffle '(1 2 3) '(4)) '(1 4))
  (test (shuffle '(1 2 3) ()) ())
  )

(test (map list "hi") '((#\h) (#\i)))
(test (map string "hi") '("h" "i"))
(test (map vector "hi") '(#(#\h) #(#\i)))
(test (map char-upcase "hi") '(#\H #\I))
(test (map append #(#() #())) '(#() #()))

(test (map abs () abs) 'error)
(test (map (lambda (x) (display "map should not have called this"))) 'error)
(test (let ((ctr 0)) (map (lambda (x y z) (set! ctr (+ ctr x y z)) ctr) '(1) '(3) ())) ())
(test (let ((ctr 0)) (map (lambda (x y z) (set! ctr (+ ctr x y z))) '(0 1) '(2 3) '(4 5 6))) '(6 15))

(test (map (lambda (a b) (+ a b)) (list 1)) 'error)
(test (map (lambda (a b) (+ a b)) (list 1) (list)) ())
(test (map (lambda (a b) (+ a b)) (list 1) (list 2)) (list 3))
(test (map (lambda (a b) (+ a b)) (list 1)) 'error)
(test (map (lambda (a b) (+ a b)) (list 1) (list 2) (list 3)) 'error)
(test (map (lambda (a b) (+ a b)) (list 1) (list 1 2)) '(2))
(test (map (lambda (a b) (+ a b)) (list 1 2) (list 1)) '(2))
(test (map (lambda (a b) (+ a b)) (list 1 2) (list 1 2 3)) '(2 4))
(test (map (lambda (a b) (+ a b)) (list 1 2) (list 1)) '(2))
(test (map (lambda (a b) (+ a b)) (list 1 2) (list 1 2) (list)) 'error) ; ()
(test (map (lambda (a b) (+ a b)) (list 1 2) (list 1 2) (list 1 2)) 'error)
(test (map (lambda (a b) (+ a b)) (list 1 2) (cons 1 2)) '(2))

(test (map (lambda* (x . args) args) '(1 2 3)) '(() () ()))
(test (map (lambda (x . args) args) '(1 2 3)) '(() () ()))
(test (map (lambda* (x . args) (list x args)) '(1 2 3)) '((1 ()) (2 ()) (3 ())))
(test (map (lambda (x . args) (list x args)) '(1 2 3)) '((1 ()) (2 ()) (3 ())))
(test (map (lambda args args) '(1 2 3)) '((1) (2) (3)))
(test (map (lambda* args args) '(1 2 3)) '((1) (2) (3)))
(test (map (lambda (x y . args) args) '(1 2 3)) 'error)
(test (map (lambda* (x y . args) args) '(1 2 3)) '(() () ())) ; all args are optional in lambda*
(test (map (lambda (x y . args) args) '(1 2 3) '(4 5 6)) '(() () ()))
(test (map (lambda* (x y . args) args) '(1 2 3) '(4 5 6)) '(() () ()))
(test (map (lambda (x y . args) (list x y args)) '(1 2 3) '(4 5 6)) '((1 4 ()) (2 5 ()) (3 6 ())))
(test (map (lambda* (x y . args) (list x y args)) '(1 2 3) '(4 5 6)) '((1 4 ()) (2 5 ()) (3 6 ())))
(test (map (lambda (x y . args) (list x y args)) '(1 2 3) '(4 5 6) '(7 8 9)) '((1 4 (7)) (2 5 (8)) (3 6 (9))))
(test (map (lambda* (x y . args) (list x y args)) '(1 2 3) '(4 5 6) '(7 8 9)) '((1 4 (7)) (2 5 (8)) (3 6 (9))))
(test (map (lambda* (x y :rest args) (list x y args)) '(1 2 3) '(4 5 6) '(7 8 9)) '((1 4 (7)) (2 5 (8)) (3 6 (9))))

(test (map (lambda . (x y z 8)) '(1 2 3))  'error) ; (y unbound) but other schemes ignore unused args
(test (map (lambda . (x 8)) '(1 2)) '(8 8)) 

(test (map (lambda (a) (+ a 1)) (list 1) (list 2)) 'error)
(test (map (lambda (a) (+ a 1)) #\a) 'error)
(test (map (lambda (a) (+ a 1)) (cons 1 2)) '(2))
(test (map (lambda (a b . args) (+ a b (apply + args))) '(0 1 2)) 'error)
(test (map (lambda (a) a) '(1 2 . 3)) '(1 2))
(test (map) 'error)
(test (map #t) 'error)
(test (map set-cdr! '(1 2 3)) 'error)
(test (map (lambda (a b) (set-cdr! a b) b) '((1) (2) (3)) '(4 5 6)) '(4 5 6))
(test (let ((str "0123")) (set! (str 2) #\null) (map append str)) '(#\0 #\1 #\null #\3))

(test (map ((lambda () abs)) '(-1 -2 -3)) '(1 2 3))
(test (apply map ((lambda () abs)) (list (list -1 -2 -3))) '(1 2 3))
(test (apply apply map ((lambda () abs)) (list (list (list -1 -2 -3)))) '(1 2 3))
(test (apply apply apply map ((lambda () abs)) '((((-1 -2 -3))))) '(1 2 3))
(test (apply apply apply (list (list map abs (list (list -1 -2 -3))))) '(1 2 3))
(test (apply apply list 1 '((1 2) (3 4))) '(1 (1 2) 3 4))
(test (apply + (apply apply apply (list (list map abs (list (list -1 -2 -3)))))) 6)
(test (apply (apply apply lambda '(a) '(((+ a 1)))) '(14)) 15)
(test (let ((a 14)) (apply apply quasiquote '(((+ ,a 1))))) '(+ 14 1))
(test (apply map vector (values (list (vector 1 2)))) '(#(1) #(2)))
(test (apply map string (list "123")) '("1" "2" "3"))
(test (apply map string '("123" "456")) '("14" "25" "36"))
(test (apply map list '((1 2) (3 4))) '((1 3) (2 4))) ; matrix transpose

;;; Is <code>(apply apply func arglist)</code> the same as <code>(apply func (apply values arglist))</code>,
;;; or (leaving aside <code>'(()))</code>, <code>(func (apply values (apply values arglist)))</code>?
(test (apply apply + '((1 2 3))) (apply + (apply values '((1 2 3)))))
(test (apply apply + '((1 2 3))) (+ (apply values (apply values '((1 2 3))))))

(test (map string "123") '("1" "2" "3"))
(test (map "hi" '(0 1)) '(#\h #\i))
(test (map (list 2 3) '(0 1)) '(2 3))
(test (map #(2 3) '(1 0)) '(3 2))
(for-each
 (lambda (arg)
   (test (map arg (list 1)) 'error))
 (list -1 #\a 1 'a-symbol 3.14 3/4 1.0+1.0i #f #t))
(for-each
 (lambda (arg)
   (test (map (lambda (n m) n) (list 1) arg) 'error))
 (list -1 #\a 1 'a-symbol 3.14 3/4 1.0+1.0i #f #t))
(for-each
 (lambda (arg)
   (test (map (lambda (a) a) arg) 'error))
 (list -1 #\a 1 'a-symbol 3.14 3/4 1.0+1.0i #f #t))

(let ()
  (define (concatenate . args)
    (apply append (map (lambda (arg) (map values arg)) args)))
  (test (concatenate "hi" #(#\h #\o)) '(#\h #\i #\h #\o))
  (test (let ((lst (concatenate '(1 2) (let ((a 2) (b 3)) (curlet)) (hash-table* 'c 4))))
	  (or (equal? lst '(1 2 (b . 3) (a . 2) (c . 4)))
	      (equal? lst '(1 2 (a . 2) (b . 3) (c . 4)))))
	#t))

(test (map (lambda (a1 a2 a3 a4 a5 a6 a7 a8 a9 a10)
	     (max a1 a2 a3 a4 a5 a6 a7 a8 a9 a10))
	   (list 6 7 8 9 10)
	   (list 21 22 23 24 25)
	   (list 16 17 18 19 20)
	   (list 11 12 13 14 15)
	   (list 26 27 28 29 30)
	   (list 1 2 3 4 5)
	   (list 36 37 38 39 40)
	   (list 41 42 43 44 45)
	   (list 46 47 48 49 50)
	   (list 31 32 33 34 35))
      (list 46 47 48 49 50))
  
(test (map (lambda (a1 a2 a3 a4 a5 a6 a7 a8 a9 . a10)
	     (apply max a1 a2 a3 a4 a5 a6 a7 a8 a9 a10))
	   (list 6 7 8 9 10)
	   (list 21 22 23 24 25)
	   (list 16 17 18 19 20)
	   (list 11 12 13 14 15)
	   (list 26 27 28 29 30)
	   (list 1 2 3 4 5)
	   (list 36 37 38 39 40)
	   (list 41 42 43 44 45)
	   (list 46 47 48 49 50)
	   (list 31 32 33 34 35))
      (list 46 47 48 49 50))

(test (map (lambda* (a1 a2 a3 . a10)
	     (apply max a1 a2 a3 a10))
	   (list 6 7 8 9 10)
	   (list 21 22 23 24 25)
	   (list 16 17 18 19 20)
	   (list 11 12 13 14 15)
	   (list 26 27 28 29 30)
	   (list 1 2 3 4 5)
	   (list 36 37 38 39 40)
	   (list 41 42 43 44 45)
	   (list 46 47 48 49 50)
	   (list 31 32 33 34 35))
      (list 46 47 48 49 50))

(test (map (lambda args
	     (apply max args))
	   (list 6 7 8 9 10)
	   (list 21 22 23 24 25)
	   (list 16 17 18 19 20)
	   (list 11 12 13 14 15)
	   (list 26 27 28 29 30)
	   (list 1 2 3 4 5)
	   (list 36 37 38 39 40)
	   (list 41 42 43 44 45)
	   (list 46 47 48 49 50)
	   (list 31 32 33 34 35))
      (list 46 47 48 49 50))
  
(test (map map (list abs) (list (list -1))) '((1)))
(test (map map (list map) (list (list abs)) (list (list (list -1)))) '(((1))))
(test (map map (list map) (list (list map)) (list (list (list abs))) (list (list (list (list -1 -3))))) '((((1 3)))))
(test (map map (list lcm) (vector #(1 2))) '((1 2)))
(test (map map (list integer?) (list (vector "hi" 1 2/3))) '((#f #t #f)))
(test (map map (list char-lower-case?) (list "hAba")) '((#t #f #t #t)))
(test (map map (list char-lower-case? char-upper-case?) (list "hAba" "HacDf")) '((#t #f #t #t) (#t #f #f #t #f)))
(test (map map (list + -) (list (list 1 2) (list 3 4))) '((1 2) (-3 -4)))
(test (map map (list map map) (list (list + -) (list - +)) '(((1 2) (3 4)) ((4 5) (6 7)))) '(((1 2) (-3 -4)) ((-4 -5) (6 7))))

(test (map member (list 1 2 3) (list (list 1 2 3) (list 1 3 4) (list 3 4 5))) '((1 2 3) #f (3 4 5)))
(test (map - (list 1 2 3) (list 1 2 3) (list 1 3 4) (list 3 4 5)) '(-4 -7 -9))
(test (map - (list 1 2 3) (list 1 2 3 'hi) (list 1 3 4 #\a "hi") (list 3 4 5)) '(-4 -7 -9))
(test (let () (define (mrec a b) (if (<= b 0) (list a) (map mrec (list a) (list (- b 1))))) (mrec (list 1 2) 5)) '(((((((1 2))))))))
(test (map append '(3/4)) '(3/4))
(test (map list '(1.5)) '((1.5)))
(test (map vector '("hi")) '(#("hi")))
(test (map object->string '(:hi (1 2) (()))) '(":hi" "(1 2)" "(())"))
(test (map map (list for-each) (list (list abs)) (list (list (list 1 2 3)))) '((#<unspecified>)))
(test (map map (list vector) '((#(1 #\a (3))))) '((#(#(1 #\a (3))))))
(test (apply map map (list cdr) '((((1 2) (3 4 5))))) '(((2) (4 5))))
(test (apply map map (list char-upcase) '(("hi"))) '((#\H #\I)))
(test (apply map map (list *) '(((1 2)) ((3 4 5)))) '((3 8))) ; (* 1 3) (* 2 4)
(test (map apply (list map) (list map) (list (list *)) '((((1 2)) ((3 4 5))))) '(((3 8))))
(test (map map (list magnitude) '((1 . 2))) '((1))) ; magnitude is called once with arg 1
(test (map magnitude '(1 . 2)) '(1))
(test (map call/cc (list (lambda (r1) 1) (lambda (r2) (r2 2 3)) (lambda (r3) (values 4 5)))) '(1 2 3 4 5))
(test (map call/cc (list number? continuation?)) '(#f #t))

;; from scheme working group 
(test (let ((L (list 1 2 3 4 5))) (map (lambda (x) (set-cdr! (cddr L) 5) x) L)) '(1 2 3))
(test (let ((L (list 1 2))) (map (lambda (x) (set! (cdr (cdr L)) L) x) L)) '(1 2))
(test (let ((L (list 1 2))) (object->string (map (lambda (x) (set! (car (cdr L)) L) x) L))) "(1 #1=(1 #1#))")
;;;(test (let ((L (list 1 2))) (map (lambda (x) (set-cdr! L L) x) L)) '(1 2)) ;?? this depends on when we cdr? infinite loop in Guile
;;;(let ((L (list 1 2 3 4 5))) (map (lambda (x) (set-cdr! L ()) x) L)) ; another similar case -- s7 doesn't notice what happened
;;;  does that mean a GC during this map would leave us accessing freed memory? 
;;;  I think not because the original list is held by map (eval) locals that are protected
;;;  we simply stepped on something after looking at it, similar to:
(test (let ((L (list 1 2 3 4 5))) (map (lambda (x) (set-car! L 123) x) L)) '(1 2 3 4 5))
(test (let ((L (list 1 2 3 4 5))) (map (lambda (x) (set-cdr! (cddr L) (list 6 7 8)) x) L)) '(1 2 3 6 7 8))
;;; we could do something similar with strings:
(test (let ((S "12345")) (map (lambda (x) (set! (S 2) #\null) x) S)) '(#\1 #\2 #\null #\4 #\5))
;;; (length S) is still 5 even with the embedded null
(test (let ((L (list 1 2 3))) (map (lambda (x) (set! L (list 6 7 8)) x) L)) '(1 2 3))
(test (let ((L1 (list 1 2 3)) (L2 (list 4 5 6 7))) (map (lambda (x1 x2) (set-cdr! (cdr L1) ()) (cons x1 x2)) L1 L2)) '((1 . 4) (2 . 5)))
(test (let ((L (list 1 2 3))) (map (lambda (x) (set-car! (cddr L) 32) x) L)) '(1 2 32))
;;; should these notice the increased length?:
(test (let ((L1 (list 1 2)) (L2 (list 6 7 8 9))) (map (lambda (x y) (set-cdr! (cdr L1) (list 10 11 12 13 14)) (cons x y)) L1 L2)) '((1 . 6) (2 . 7) (10 . 8) (11 . 9)))
(test (let ((L1 (list 1)) (L2 (list 6 7 8))) (map (lambda (x y) (set-cdr! L1 (list 10 11 12)) (cons x y)) L1 L2)) '((1 . 6)))
(test (let ((L1 (list 1 2))) (map (lambda (x) (set-cdr! (cdr L1) (list 10 11 12)) x) L1)) '(1 2 10 11 12))
;;; a similar case could be made from hash-tables
(test (let ((H (hash-table '(a . 3) '(b . 4)))) (pair? (map (lambda (x) (set! (H 'c) 32) (cdr x)) H))) #t)
(test (let ((H (hash-table '(a . 3) '(b . 4)))) 
	(let ((L (map (lambda (x) (set! (H 'b) 32) (cdr x)) H)))
	  (or (equal? L '(3 32))
	      (equal? L '(4 3)))))
      #t)
;; in that first example, the set-cdr! is not the problem (map supposedly can treat its args in any order),
;;   any set! will do:
(test (let ((x 0)) (map (lambda (y) (set! x (+ x y)) x) '(1 2 3 4))) '(1 3 6 10))

(test (map begin '(1 2 3)) '(1 2 3))
(let ((funcs (map (lambda (lst) (eval `(lambda ,@lst))) '((() #f) ((arg) (+ arg 1))))))
  (test ((car funcs)) #f)
  (test ((cadr funcs) 2) 3))

(test (map = #() =) 'error)
(test (map ="") 'error)
(test (map abs ()) ())
(test (map abs "") ())
(test (map abs "123" "") 'error)
(test (map abs "123" "" #f) 'error)
(test (map null? () #() "") 'error)
(test (map null? () #() 0 "") 'error)
(test (map '(()) #()) ())
(test (map '(1 2 . 3) '(1 . 2)) '(2))
(test (map '(()) ()) ())
(test (map #2D((1 2) (3 4)) '(1)) '(#(3 4)))
(test (map "a\x00;b" #(1 2)) '(#\null #\b))
(test (map #(1 (3)) '(1)) '((3)))
(test (map '((1 (2)) (((3) 4))) '(1)) '((((3) 4))))
(test (map "hi" '(1)) '(#\i))
(test (map #() #()) 'error)
(test (map '(1 . 2) #()) ())
(test (map ''2 '(1)) '(2))
(test (((map lambda '((x)) '(1 2 . 3)) 0) 0) 1)
(test (((map lambda '(()) #(1 2)) 0)) 1)
(test (((map lambda '((x)) '((+ x 1))) 0) 32) 33)
(test (map #() ()) 'error)
(test (map () ()) 'error)
(test (map "" "") 'error)
(test (map (let ((lst (list 1 2))) (set! (cdr (cdr lst)) lst) lst) '(0)) '(1))
(let ((lst (list 1 2)) (os (*s7* 'safety))) (set! (*s7* 'safety) 1) (set! (cdr (cdr lst)) lst) (test (map lst lst) '(2 1)) (set! (*s7* 'safety) os))
(test (map 1 "hi" ()) 'error)
(test (map 0 #() ()) 'error)
(test (map #\a #(1 2) '(3 4) "") 'error)
(test (map or '(1 2 . 3)) '(1 2))
(test (map or "a\x00;b") '(#\a #\null #\b))
(test (map cond '((1 2) (3 4))) '(2 4)) ; (cond (1 2)) -> 2
(test (map begin "hi") '(#\h #\i))
(test (map quote "hi") '(#\h #\i))
(test (map quote '(a b c)) '(a b c)) ; when are (map quote ...) and (map values ...) different?
(test (map (begin #(1 (3))) '(1)) '((3)))
(test (map (''2 0) ''2) 'error)
(test (map (apply lambda 'a '(-1)) '((1 2))) '(-1))
(test (map (apply lambda 'a '(-1)) '(1 2)) '(-1 -1))
(test (map do '(()) '((1 2))) '(2)) ; (list 2) because it's map, not just do
(test (map case '(1) '(((-1 1) 2) 3)) '(2))
(test (map let '(()) "a\x00;b") '(#\a))
(test (map "hi" '(0 1) '(0 1)) 'error)
(test (map '((1 2) (3 4)) '(0 1) '(0 1)) '(1 4))
(test (map #2d((1 2) (3 4)) '(0 1) '(0 1)) '(1 4))
(test (map #2d((1 2) (3 4)) '(0 1)) '(#(1 2) #(3 4)))
(let ((os (*s7* 'safety)))
  (set! (*s7* 'safety) 1)
  (let ((lst (list 1 2))) (set! (cdr (cdr lst)) lst) (test (map (lambda (a) a) lst) '(1 2 1)))
  (let ((lst (list 1 2))) (set! (cdr (cdr lst)) lst) (test (map (lambda (a) a) lst lst) 'error))
  (set! (*s7* 'safety) os))
(test (map "hi" ('((1)) 0)) '(#\i))
(test (map "hi" ('((1 0)) 0)) '(#\i #\h))
(test (let ((ht (hash-table '(a . 1) '(b . 2)))) (map ht ht)) '(#f #f))
(test (let ((ht (hash-table '(a . 1) '(b . 2)))) (let ((lst (map (lambda (c) (cdr c)) ht))) (or (equal? lst '(1 2)) (equal? lst '(2 1))))) #t)
(test (let ((ht (hash-table '(a . 1) '(b . 2)))) (map ht '(a b))) '(1 2))

(test (map '((1 2) (3 4)) #(1) #(1)) '(4))
(test (map (quasiquote ((1 2) (3 4))) #(1) #(1 2)) '(4))

(let ((pws (dilambda (lambda (a) a) (lambda (a b) b))))
  (test (map append pws) 'error)
  (test (map pws '(1 2 3)) '(1 2 3)))

(test (map abs '(1 2 . 3)) '(1 2)) ;; ?? Guile says wrong type arg here
(test (map + '(1) '(1 2 . 3)) '(2))
(test (map abs '(1 . 2)) '(1))
;; problematic because last thing is completely ignored:
(test (map abs '(1 . "hi")) '(1))
(test (map floor '(1 . "hi")) '(1))

(for-each
 (lambda (op)
   (test (map op ()) 'error)
   (test (map op "") 'error)
   (test (map op #() (list) (string)) 'error))
 (list 0 () #f #t 'a-symbol :hi #\a #<eof> #<unspecified> #<undefined> 0.0 1+i 1/2 1/0 0/0 *stdout* (current-input-port)))

(test (map append (make-vector (list 2 0))) ())
(let ((p1 (dilambda (lambda (a) (+ a 1)) (lambda (a b) (+ a b)))))
  (test (map p1 '(1 2 3)) '(2 3 4)))
(test (map (lambda args (+ (car args) 1)) '(1 2 3)) '(2 3 4))
(test (map (lambda* (a (b 2)) (+ a 1)) '(1 2 3)) '(2 3 4))
(let ((p1 (dilambda (lambda (a b) (+ a b)) (lambda (a b c) (+ a b c)))))
  (test (map p1 '(1 2 3) '(3 2 1)) '(4 4 4)))
(test (map (lambda args (+ (car args) (cadr args))) '(1 2 3) '(3 2 1)) '(4 4 4))
(test (map (lambda* (a (b 2)) (+ a b)) '(1 2 3) '(3 2 1)) '(4 4 4))
(test (map (lambda* (a (b 2)) (+ a b)) '(1 2 3)) '(3 4 5))
(test (map (lambda* ((a 1) (b (map (lambda (c) (+ c 1)) (list 1 2)))) (+ a (apply + b))) (list 4 5 6)) '(9 10 11))
(test (let ((lst (list 0 1 2))) (map (lambda* ((a 1) (b (for-each (lambda (c) (set! (lst c) (+ (lst c) 1))) (list 0 1 2)))) a) lst)) '(0 2 4))

(test (let ((lst '(1 2 3))) (define-macro (hiho a) `(+ 1 ,a)) (map hiho lst)) '(2 3 4))
(test (let ((lst '(1 2 3))) (define-bacro (hiho a) `(+ 1 ,a)) (map hiho lst)) '(2 3 4))
(test (let ((lst '(1 2 3))) (define-macro (hiho a b) `(+ 1 ,a (* 2 ,b))) (map hiho lst lst)) '(4 7 10))
(test (let ((lst '(1 2 3))) (define-macro (hi1 a) `(+ 1 ,a)) (define-macro (hiho a b) `(+ 1 ,a (* 2 ,b))) (map hiho lst (map hi1 lst))) '(6 9 12))
(test (let ((lst '(1 2 3))) (define-macro (hiho a b) `(+ 1 ,a (* 2 ,b))) (map hiho lst (map (define-macro (hi1 a) `(+ 1 ,a)) lst))) '(6 9 12))
(test (let ((lst '(1 2 3))) (define-macro (hi a) `(+ 1 ,a)) (define-macro (ho b) `(+ 1 (hi ,b))) (map ho lst)) '(3 4 5))
(test (let ((lst '(1 2 3))) (define-macro* (hi a (b 2)) `(+ 1 ,a (* 2 ,b))) (map hi lst)) '(6 7 8))
(test (let ((lst '(1 2 3))) (define-macro* (hi a (b 2)) `(+ 1 ,a (* 2 ,b))) (map hi lst (map hi lst))) '(14 17 20))

(let ()
  (define (hi)
    (map (lambda (a) (a 0))
	 (list (vector 1 2 3)
	       (string #\a #\b #\c)
	       (list 'e 'f 'g))))
  (test (hi) '(1 #\a e)))

(let ((ctr -1)) 
  (apply begin (map (lambda (symbol) 
		      (set! ctr (+ ctr 1))
		      (list 'define symbol ctr))
		    '(_zero_ _one_ _two_)))
  (+ _zero_ _one_ _two_))

(let ()
  (define (map-with-exit func . args)
  ;; func takes escape thunk, then args
  (let* ((result ())
	 (escape-tag (gensym))
	 (escape (lambda () (throw escape-tag))))
    (catch escape-tag
      (lambda ()
	(let ((len (apply max (map length args))))
	  (do ((ctr 0 (+ ctr 1)))
	      ((= ctr len) (reverse result))      ; return the full result if no throw
	    (let ((val (apply func escape (map (lambda (x) (x ctr)) args))))
	      (set! result (cons val result))))))
      (lambda args
	(reverse result))))) ; if we catch escape-tag, return the partial result

  (define (truncate-if func lst)
    (map-with-exit (lambda (escape x) (if (func x) (escape) x)) lst))

  (test (truncate-if even? #(1 3 5 -1 4 6 7 8)) '(1 3 5 -1))
  (test (truncate-if negative? (truncate-if even? #(1 3 5 -1 4 6 7 8))) '(1 3 5))
  )

;;; this is testing the one-liner unsafe closure optimizations
(test (let ()
	(define (fib n)
	  (if (< n 2)
	      n
	      (+ (fib (- n 1))
		 (fib (- n 2)))))
	(let ((x 0)
	      (ctr -1))
	  (map
	   (lambda (f)
	     (let ((z 1))
	       (set! ctr (+ ctr 1))
	       (case ctr
		 ((0 1 2 3) (f z))
		 ((4 5) (f z z))
		 ((6 7) (values (f (+ 1)) (f (+ 2)))))))
	   (list
	    (lambda (i)
	      (set! x (list i)))
	    (lambda (i)
	      (set! x (list i))
	      (set! x (list (+ i 1))))
	    (vector 1 2 3)
	    (list 3 2 1)
	    (lambda (a b)
	      (+ a b))
	    (lambda (a b)
	      (+ a b)
	      (+ a b a))
	    (lambda (a)
	      (if (< a 2) a (+ (fib (- a 1)) (fib (- a 2)))))
	    (lambda (a)
	      (if (zero? a) a (list a))
	      (list (+ a 10)))
	    ))))
      '((1) (2) 2 2 2 3 1 1 (11) (12)))
;;; more along the same lines
(test (let () (define (f2 a) (+ a 1)) (define (f1 a) (f2 a)) (define (f2 a) (- a)) (f1 12)) -12)
(test (let () (define (f2 a) (+ a 1)) (define (f1 a) (f2 a 1)) (define (f2 a b) (- a b)) (f1 12)) 11)
(test (let () (define (f2 a) (+ a 1)) (define (f1 a) (f2 a)) (define (f2 a) (- a 1)) (f1 12)) 11)

(test (let () (define* (f2 a) (+ a 1)) (define (f1 a) (f2 a)) (define* (f2 a) (- a)) (f1 12)) -12)
(test (let () (define* (f2 a) (+ a 1)) (define (f1 a) (f2 a 1)) (define* (f2 a b) (- a b)) (f1 12)) 11)
(test (let () (define* (f2 a) (+ a 1)) (define (f1 a) (f2 a)) (define* (f2 a) (- a 1)) (f1 12)) 11)

;;; (test (map symbol->value (let ((lst (list 'integer? 'boolean?))) (set-cdr! (cdr lst) lst) lst)) (list integer?))
;;; I think this depends on when the list iterator notices the cycle


#|
;;; this is from the r6rs comment site
(let ((resume #f)
       (results ()))
   (set! results
         (cons (map (lambda (x)
                      (call/cc (lambda (k)
                                 (if (not resume) (set! resume k))
                                 0)))
                    '(#f #f))
               results ))
   (display results) (newline)
   (if resume
       (let ((resume* resume))
         (set! resume #f)
         (resume* 1))))

With a careful implementation of MAP, a new list is returned every
time, so that the displayed results are

   ((0 0))
   ((1 0) (0 0))
   ((1 1) (1 0) (0 0))

in s7:
((0 0))
((1 0) (0 0))
((0 . #1=(1 1)) #1# (0 0))

|#

;; from Doug Hoyte, Let Over Lambda
(let ()
  (define (batcher n) 
    (let* ((network ())
	   (tee (ceiling (log n 2)))
	   (p (ash 1 (- tee 1))))
      (do ()
	  ((= p 0) (reverse network))
	(let ((q (ash 1 (- tee 1)))
	      (r 0)
	      (d p))
	  (do ()
	      ((= d 0))
	    (do ((i 0 (+ i 1)))
		((= i (- n d)))
	      (if (= (logand i p) r)
		  (set! network (cons (list i (+ i d)) network))))
	    (set! d (- q p))
	    (set! q (ash q -1))
	    (set! r p)))
	(set! p (ash p -1)))))
  
  (define-macro (sortf comparator . places)
    (let ((tmp (gensym))
	  (net (batcher (length places))))
      `(begin
	 ,@(map (lambda (a b)
		  `(if (,comparator ,a ,b) ; we're ignoring the fancy CL getf|setf business
		       (let ((,tmp ,a))    ;   I suppose if it's a list, get setter?
			 (set! ,a ,b)
			 (set! ,b ,tmp))))
		(map (lambda (ab) (places (car ab))) net)
		(map (lambda (ab) (places (cadr ab))) net)))))
  
  (test (let ((a 1) (b 3) (c 0))
	  (sortf > a b c)
	  (list a b c))
	'(0 1 3))
  (test (let ((a 1) (b 3) (c 0))
	  (sortf < a b c)
	  (list a b c))
	'(3 1 0))
  (test (let ((v #(1 3 2)))
	  (sortf > (v 0) (v 1) (v 2))
	  v)
	#(1 2 3)))

;;; fftf?

(let ()
  (define-macro (shiftf . places)
    (let ((tmp (gensym)))
      `(let ((,tmp ,(car places)))
	 ,@(map (lambda (a b)
		  `(set! ,a ,b))
		places
		(cdr places))
	 ,tmp)))

  (define-macro (rotatef . places)
    (let ((tmp (gensym))
	  (last (car (list-tail places (- (length places) 1)))))
      `(let ((,tmp ,(car places)))
	 ,@(map (lambda (a b)
		  `(set! ,a ,b))
		places
		(cdr places))
	 (set! ,last ,tmp))))
  
  (test (let ((a 1) (b 2) (c 3))
	  (rotatef a b c)
	  (list a b c))
	'(2 3 1))
  (test (let ((a 1) (b 2) (c 3))
	  (rotatef a b c)
	  (rotatef a b c)
	  (list a b c))
	'(3 1 2))
  (test (let ((v #(1 3 2)))
	  (rotatef (v 0) (v 1) (v 2))
	  v)
	#(3 2 1))
  
  (test (let ((a 1) (b 2) (c 3))
	  (let ((d (shiftf a b c (+ 3 2))))
	    (list a b c d)))
	'(2 3 5 1))
  
  (test (let ((a 1) (b 2) (c 3))
	  (let ((d (shiftf a b c (shiftf a b c))))
	    (list a b c d)))
	'(3 3 2 1))
  ;; this expands to:
  ;; (let ((a 1) (b 2) (c 3))
  ;;   (let (({gensym}-22 a)) 
  ;;     (set! a b) 
  ;;     (set! b c) 
  ;;     (set! c (let (({gensym}-23 a))
  ;; 	         (set! a b) 
  ;; 	         (set! b c) 
  ;; 	         (set! c (* 2 3))
  ;; 	         {gensym}-23))
  ;;     (list a b c {gensym}-22)))
  
  (test (let ((v #(1 3 2)))
	  (let ((d (shiftf (v 0) (v 1) (v 2) (* 4 3))))
	    (list d v)))
	'(1 #(3 2 12))))


;;; --------------------------------------------------------------------------------
;;; iterate
;;; make-iterator
;;; iterator?
;;; iterator-sequence
;;; iterator-at-end?
;;; --------------------------------------------------------------------------------

(test (iterate) 'error)
(test (iterator?) 'error)
(test (iterator-sequence) 'error)
(test (iterator-at-end?) 'error)
(test (make-iterator) 'error)
(test (make-iterator "hi" "ho") 'error)
(test (iterator? "hi" "ho") 'error)
(test (iterator-sequence "hi" "ho") 'error)
(test (iterator-at-end? "hi" "ho") 'error)
(test (iterate "hi" "ho") 'error)
(test (make-iterator (hash-table* 'a 1) (immutable! (cons 0 0))) 'error)
(test (make-iterator (inlet 'a 1) (immutable! (cons 0 0))) 'error)

(for-each
 (lambda (arg)
   (if (iterator? arg)
       (format #t ";~A: (iterator? ~A) -> #t?~%" (port-line-number) arg)))
 (list "hi" '(1 2) (integer->char 65) 1 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #\f (lambda (a) (+ a 1)) :hi (if #f #f) #<eof> #<undefined>))

(for-each
 (lambda (arg)
   (test (iterate arg) 'error)
   (test (iterator-sequence arg) 'error)
   (test (iterate-at-end? arg) 'error))
 (list "hi" '(1 2) (integer->char 65) 1 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #\f (lambda (a) (+ a 1)) :hi (if #f #f) #<eof> #<undefined>))

(for-each
 (lambda (arg)
   (test (make-iterator arg) 'error)
   (test (make-iterator #(1 2) arg) 'error))
 (list 1 'a-symbol quasiquote macroexpand 3.14 3/4 1.0+1.0i #\f :hi (if #f #f) #<eof> #<undefined>))

(let ((str "12345"))
  (let ((s1 (make-iterator str)))
    (test (iterator? s1) #t)
    (test (iterator? str) #f)
    (test (make-iterator s1) 'error)
    (test (iterator-sequence s1) str)
    (test (iterator-at-end? s1) #f)
    (test (iterate s1) #\1)
    (test (iterate s1 s1) 'error)
    (test (object->string s1) "#<iterator: string>")
    (test (s1) #\2)
    (test (list (s1) (s1) (s1)) (list #\3 #\4 #\5))
    (test (s1) #<eof>)
    (test (iterator-at-end? s1) #t)
    (let ((s2 (copy s1)))
      (test (equal? s1 s2) #t)
      (test (morally-equal? s1 s2) #t)
      (test (eq? s1 s2) #f)
      (test (eqv? s1 s2) #f))))

(let ((str ""))
  (let ((s1 (make-iterator str)))
    (let ((s2 (copy s1)))
      (test (equal? s1 s2) #t)
      (test (iterator? s1) #t)
      (test (iterator-sequence s1) str)
      (test (s1) #<eof>)
      (test (iterator-at-end? s1) #t)
      (test (iterator? s1) #t))))

(let ((s1 (make-iterator "1234")))
  (test (iterator? s1) #t)
  (test (s1) #\1))

(let ((str (vector #\1 #\2 #\3 #\4 #\5)))
  (let ((s1 (make-iterator str)))
    (let ((s2 (copy s1)))
      (test (equal? s1 s2) #t)
      (test (iterator? s1) #t)
      (test (iterator? str) #f)
      (test (make-iterator s1) 'error)
      (test (iterator-sequence s1) str)
      (test (iterate s1) #\1)
      (test (object->string s1) "#<iterator: vector>")
      (test (equal? s1 s2) #f)
      (s2)
      (test (equal? s1 s2) #t)
      (test (iterate s1 s1) 'error)
      (test (s1) #\2)
      (test (list (s1) (s1) (s1)) (list #\3 #\4 #\5))
      (test (s1) #<eof>))))

(let ((str #()))
  (let ((s1 (make-iterator str)))
    (test (iterator? s1) #t)
    (test (iterator-sequence s1) str)
    (test (s1) #<eof>)
    (test (iterator-at-end? s1) #t)
    (test (iterator? s1) #t)))

(let ((str #2d((1 2) (3 4))))
  (let ((s1 (make-iterator str)))
    (test (iterator-at-end? s1) #f)
    (test (s1) 1)
    (test (iterate s1) 2)
    (test (s1) 3)))


(let ((str (float-vector 1.0 2.0 3.0 4.0)))
  (let ((s1 (make-iterator str)))
    (test (iterator? s1) #t)
    (test (iterator? str) #f)
    (test (iterator-sequence s1) str)
    (test (iterate s1) 1.0)
    (test (s1) 2.0)
    (test (list (s1) (s1)) (list 3.0 4.0))
    (test (s1) #<eof>)))

(let ((str (float-vector)))
  (let ((s1 (make-iterator str)))
    (test (iterator? s1) #t)
    (test (iterator-sequence s1) str)
    (test (s1) #<eof>)
    (test (iterator-at-end? s1) #t)
    (test (iterator? s1) #t)))

(let ((str (make-int-vector 4 0)))
  (do ((i 1 (+ i 1))) ((= i 4)) (set! (str i) i))
  (let ((s1 (make-iterator str)))
    (test (iterator? s1) #t)
    (test (iterator-sequence s1) str)
    (test (iterate s1) 0)
    (test (s1) 1)
    (test (list (s1) (s1) (s1)) (list 2 3 #<eof>))
    (test (s1) #<eof>)))

(let ((str (list 0 1 2 3)))
  (let ((s1 (make-iterator str)))
    (test (iterator? s1) #t)
    (test (iterator-sequence s1) str)
    (test (iterate s1) 0)
    (test (s1) 1)
    (test (s1 0) 'error)
    (test (iterate s1 0) 'error)
    (test (list (s1) (s1) (s1)) (list 2 3 #<eof>))
    (test (s1) #<eof>)))

(let ((str ()))
  (test (make-iterator str) 'error))

(let ((str '((1 2) (3 4))))
  (let ((s1 (make-iterator str)))
    (test (s1) '(1 2))
    (test (iterate s1) '(3 4))
    (test (s1) #<eof>)))

(let ((str (list 0 1)))
  (set! (cdr (cdr str)) str)
  (let ((s1 (make-iterator str)))
    (test (iterator? s1) #t)
    (test (iterator-sequence s1) str)
    (test (iterate s1) 0)
    (test (s1) 1)
    (test (s1) #<eof>)))

(let ((p (cons #f #f))
      (h (hash-table* 'a 1 'b 2)))
  (let ((iter (make-iterator h p)))
    (let ((v (iter)))
      (test (pair? v) #t)
      (test (eq? v p) #t)
      (test (pair? (memq (car v) '(a b))) #t)
      (set! v (iter))
      (test (pair? v) #t)
      (test (eq? v p) #t)
      (test (pair? (memq (car v) '(a b))) #t))))

;; hash-table and let dealt with elsewhere

(test (length (make-iterator (list 1 2 3))) 3)
(test (length (make-iterator "123")) 3)
(test (length (make-iterator #(1 2 3))) 3)
(test (length (make-iterator (int-vector 1 2 3))) 3)
(test (length (make-iterator (float-vector 1 2 3))) 3)
(test (length (make-iterator (inlet 'a 1 'b 2))) 2)
(test (length (make-iterator (hash-table* 'a 1 'b 2))) 8)

(when with-block
  (test (length (make-iterator (block 1 2 3))) 3)
  (let ((b (block 0.0 1.0 2.0)))
    (let ((b1 (make-iterator b)))
      (test (iterator? b1) #t)
      ;(test (iterator-sequence b1) b) ; this is now a function
      (test (b1) 0.0)
      (test (iterate b1) 1.0)
      (test (list (b1) (b1)) '(2.0 #<eof>)))))

(let ((c1 (let ((iterator? #t) (a 0)) (lambda () (set! a (+ a 1))))))
  (let ((iter (make-iterator c1)))
    (test (iterate iter) 1)
    (test (iterator? c1) #t)
    (test (iterator? iter) #t)
    (test (eq? (iterator-sequence iter) c1) #t)))

(let ()
  (define c1 #f)
  (let ((length (lambda (x) 3))
	(iterator? #t)
	(x 0))
    (set! c1 (openlet (lambda () (let ((res (* x 2))) (set! x (+ x 1)) res)))))
  (let ((c2 (make-iterator c1)))
    (test (iterator? c2) #t)
    (test (iterator-sequence c2) c1)
    (test (c2) 0)
    (test (c2) 2)
    (test (c2) 4)))

(let ((lst (list 1))) (set-cdr! lst lst) (let ((i (make-iterator lst))) (test (map values i) '(1))))
(let ((lst (list 1 2))) (set-cdr! (cdr lst) lst) (let ((i (make-iterator lst))) (test (map values i) '(1 2))))
(let ((lst (list 1 2 3))) (set-cdr! (cddr lst) lst) (let ((i (make-iterator lst))) (test (> (length (map values i)) 2) #t))) ; '(1 2 3) ideally
(let ((lst (list 1 2 3 4))) (set-cdr! (cdddr lst) lst) (let ((i (make-iterator lst))) (test (> (length (map values i)) 3) #t))) ; '(1 2 3 4)?

(test (format #f "~{~{[~A ~A]~}~}" 
	      (make-iterator 
	       (let ((lst '((a . 1) (b . 2) (c . 2)))
		     (iterator? #t))
		 (lambda () 
		   (if (pair? lst)
		       (let ((res (list (caar lst) (cdar lst))))
			 (set! lst (cdr lst))
			 res)
		       #<eof>)))))
      "[a 1][b 2][c 2]")

(let ()
  (define (make-diagonal-iterator matrix)
    (if (or (= (length (vector-dimensions matrix)) 1)
	    (< (length matrix) 2))
	(make-iterator matrix)
	(make-iterator (let ((inds (length (vector-dimensions matrix)))
			     (len (apply min (vector-dimensions matrix))))
			 (let ((length (lambda (obj) len))
			       (iterator? #t)
			       (pos 0))
			   (openlet 
			    (lambda ()
			      (if (>= pos len)
				  #<eof>
				  (let ((res (apply matrix (make-list inds pos))))
				    (set! pos (+ pos 1))
				    res)))))))))
  
  (define v #2d((1 2 3 4) (5 6 7 8)))

  (let ((iv (make-diagonal-iterator v)))
    (let ((vals (map values iv)))
      (test vals '(1 6)))))

(test (let ((iter (make-iterator "123"))) (map values iter)) '(#\1 #\2 #\3))
(test (let ((iter (make-iterator '(1 2 3))) (str "456") (vals ())) 
	(for-each (lambda (x y) (set! vals (cons (cons y x) vals))) iter str) vals)
      '((#\6 . 3) (#\5 . 2) (#\4 . 1)))

(let ()
  (define* (make-full-let-iterator lt (stop (rootlet)))
    (if (eq? stop lt)
	(make-iterator #())
	(let ((iter (make-iterator lt)))
	  (if (eq? stop (outlet lt))
	      iter
	      (letrec ((iterloop 
			(let ((iterator? #t))
			  (lambda ()
			    (let ((result (iter)))
			      (if (and (eof-object? result)
				       (iterator-at-end? iter))
				  (if (eq? stop (outlet (iterator-sequence iter)))
				      result
				      (begin 
					(set! iter (make-iterator (outlet (iterator-sequence iter))))
					(iterloop)))
				  (if (not (char=? ((symbol->string (car result)) 0) #\_))
				      result
				      (iterloop))))))))
		(make-iterator iterloop))))))
  (let ((stop #f)) 
    (set! stop (curlet)) 
    (test (let ((a 1)) (map values (make-full-let-iterator (curlet) stop))) '((a . 1))))
  (let ((stop #f)) 
    (set! stop (curlet)) 
    (test (let ((b 2)) (let ((a 1)) (map values (make-full-let-iterator (curlet) stop)))) '((a . 1) (b . 2))))
  (let ((stop #f)) 
    (set! stop (curlet))
    (test (let ((b 2) (c 3)) (let () (let ((a 1)) (map values (make-full-let-iterator (curlet) stop))))) '((a . 1) (c . 3) (b . 2))))
  )

(let ()
  (define (make-range lo hi)
    (make-iterator
     (let ((iterator? #t)
	   (now lo))
       (lambda ()
	 (if (> now hi)
	     #<eof>
	     (let ((result now))
	       (set! now (+ now 1))
	       result))))))
  (test (map values (make-range 4 8)) '(4 5 6 7 8)))

(let ()
  (define (make-input-iterator port)
    (make-iterator (let ((iterator? #t)) (lambda () (read-char port)))))

  (test (let ((p (open-input-string "12345")))
	  (let ((ip (make-input-iterator p)))
	    (let ((res (map values ip)))
	      (close-input-port p)
	      res)))
	'(#\1 #\2 #\3 #\4 #\5)))

(let ()
  (define (make-input-iterator port)
    (make-iterator (let ((iterator? #t)) (define-macro (_m_) `(read-char ,port)))))

  (test (let ((p (open-input-string "12345")))
	  (let ((ip (make-input-iterator p)))
	    (let ((res (map values ip)))
	      (close-input-port p)
	      res)))
	'(#\1 #\2 #\3 #\4 #\5)))

(let ((iter (make-iterator (let ((iterator? #t)
				 (pos 0))
			     (lambda ()          
			       (if (< pos 3) 
				   (let ((p pos))
				     (set! pos (+ pos 1))
				     (values p (* p 2)))         ; ?? maybe this is inconsistent? 
				   #<eof>))))))
  (test (map values iter) '(0 0 1 2 2 4)))

(let ()
  (define (make-row-iterator v)
    (make-iterator (let ((iterator? #t)
			 (col 0))
		     (lambda ()
		       (if (< col (car (vector-dimensions v)))
			   (let ((c col))
			     (set! col (+ col 1))
			     (make-shared-vector v (cadr (vector-dimensions v)) (* c (cadr (vector-dimensions v)))))
			   #<eof>)))))

  (let ((v #2d((0 1 2) (4 5 6))))
    (let ((iter (make-row-iterator v)))
      (test (map values iter) '(#(0 1 2) #(4 5 6))))))

(let ()
  (define (make-semi-complete-iterator obj)
    (make-iterator
     (let ((iters ())
	   (iter (make-iterator obj)))
       (define (iterloop)
	 (let ((result (iter)))
	   (if (length result) ; i.e. result is a sequence
	       (begin
		 (set! iters (cons iter iters))
		 (set! iter (make-iterator result))
		 result)       ; this returns the sequence before we descend into it
			       ;   we could also call iterloop here to skip that step
	       (if (eof-object? result)
		   (if (null? iters)
		       result  ; return #<eof>
		       (begin
			 (set! iter (car iters))
			 (set! iters (cdr iters))
			 (iterloop)))
		   result))))
       (let ((iterator? #t))
	 (lambda () 
	   (iterloop))))))
  
  (test (let ((v '(1 2 (4 5)))) (let ((i (make-semi-complete-iterator v))) (map values i))) '(1 2 (4 5) 4 5))
  (test (let ((v #(1 2 (4 5)))) (let ((i (make-semi-complete-iterator v))) (map values i))) '(1 2 (4 5) 4 5))
  (test (let ((v '((1 2 (4 5))))) (let ((i (make-semi-complete-iterator v))) (map values i))) '((1 2 (4 5)) 1 2 (4 5) 4 5))
  (test (let ((v '(1 2 #(4 5)))) (let ((i (make-semi-complete-iterator v))) (map values i))) '(1 2 #(4 5) 4 5))
  (test (let ((v '(1 2 #(4 5) ("67")))) (let ((i (make-semi-complete-iterator v))) (map values i))) '(1 2 #(4 5) 4 5 ("67") "67" #\6 #\7)))

(let ()
  (define (make-settable-iterator obj)
    (make-iterator (let ((iterator? #t)
			 (pos 0))
		     (dilambda (lambda ()
				 (let ((res (obj pos)))
				   (set! pos (+ pos 1))
				   res))
			       (lambda (val)
				 (set! (obj pos) val))))))
  (test (procedure? (setter (make-settable-iterator (vector 1 2 3)))) #t)
  (let ((v (vector 1 2 3)))
    (let ((iter (make-settable-iterator v)))
      (set! (iter) 32)
      (test v #(32 2 3)))))

(let ()
  (define (make-circular-iterator obj)
    (let ((iter (make-iterator obj)))
      (make-iterator 
       (let ((iterator? #t))
	 (lambda ()
	   (let ((result (iter)))
	     (if (eof-object? result)
		 ((set! iter (make-iterator obj)))
		 result)))))))
  
  (let ((iter (make-circular-iterator '(1 2 3)))
	(lst ()))
    (do ((i 0 (+ i 1)))
	((= i 10)
	 (test (reverse lst) '(1 2 3 1 2 3 1 2 3 1)))
      (set! lst (cons (iter) lst))))
  
  (let ((iter (make-circular-iterator (hash-table* :a 1 :b 2)))
	(lst ()))
    (do ((i 0 (+ i 1)))
	((= i 4)
	 (test (let ((r (reverse lst)))
		 (or (equal? r '((:a . 1) (:b . 2) (:a . 1) (:b . 2)))
		     (equal? r '((:b . 2) (:a . 1) (:b . 2) (:a . 1)))))
	       #t))
      (set! lst (cons (iter) lst)))))
  

(test (setter (make-iterator "123")) #f)
(test (setter (make-iterator #(1))) #f)
(test (setter (make-iterator '(1))) #f)
(test (setter (make-iterator (float-vector pi))) #f)

(test (copy (make-iterator '(1 2 3)) (vector 1)) 'error)

(let ()
  (define (make-file-iterator file)
    ;; reads a text file, returning one word at a time
    (let* ((port (open-input-file file))
	   (line (read-line port #t))
	   (pos -1)
	   (new-pos 0)
	   (eol (string #\space #\tab #\newline #\linefeed)))
      
      (define (next-word)
	(set! pos (char-position eol line (+ pos 1)))
	(if (not pos)
	    (begin
	      (set! pos -1)
              (set! new-pos 0)
	      (set! line (read-line port #t))
	      (if (eof-object? line)
		  (begin
		    (close-input-port port)
		    line)
		  (next-word)))
	    (if (= new-pos pos)
		(next-word)
		(let ((start (do ((k new-pos (+ k 1)))
				 ((or (= k pos)
				      (char-alphabetic? (string-ref line k))
				      (char-numeric? (string-ref line k)))
				  k))))
		  (if (< start pos)
		      (let ((end (do ((k (- pos 1) (- k 1)))
				     ((or (= k start)
					  (char-alphabetic? (string-ref line k))
					  (char-numeric? (string-ref line k)))
				      (+ k 1)))))
			(set! new-pos (+ pos 1))
			(if (> end start)
			    (substring line start end)
			    (next-word)))
		      (next-word))))))
      
      (make-iterator 
       (let ((iterator? #t))
	 (lambda* (p)
	   (if (eq? p 'eof)
	       (begin
		 (close-input-port port)
		 #<eof>)
	       (next-word)))))))

  (define iter (make-file-iterator "s7.c"))
  (test (iter) "s7")
  (test (iter) "a")
  (test (iter) "Scheme")
  (test (iter) "interpreter")
  (test ((iterator-sequence iter) 'eof) #<eof>)
  )




;;; --------------------------------------------------------------------------------
;;; do
;;; --------------------------------------------------------------------------------

(test (do () (#t 1)) 1)
(for-each
 (lambda (arg)
   (test (do () (#t arg)) arg))
 (list "hi" -1 #\a 1 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #f #t (list 1 2 3) '(1 . 2)))

(for-each
 (lambda (arg)
   (test (do ((i arg)) (#t i)) arg))
 (list "hi" -1 #\a 1 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #f #t (list 1 2 3) '(1 . 2)))

(test (do ((i 0 (+ i 1))) ((= i 3) #f)) #f)
(test (do ((i 0 (+ i 1))) ((= i 3) i)) 3)
(test (do ((i 1/2 (+ i 1/8))) ((= i 2) i)) 2)
(test (do ((i 1/2 (+ i 1/8))) ((> i 2) i)) 17/8)
(test (do ((vec (make-vector 5)) (i 0 (+ i 1))) ((= i 5) vec) (vector-set! vec i i)) #(0 1 2 3 4))
(test (let ((x '(1 3 5 7 9))) (do ((x x (cdr x)) (sum 0 (+ sum (car x))))  ((null? x) sum))) 25)
(test (do ((i 4 (- i 1)) (a 1 (* a i))) ((zero? i) a)) 24)
(test (do ((i 2 (+ i 1))) ((> i 0) 123)) 123)

(test (do () (() ()) ()) ())
(test (do () ('() ())) ())
(test (do () ('())) ())
(test (do () (())) ())
(test (do) 'error)
(test (do ((i 0 (+ i 1)) (i 0)) ((= i 0)) i) 'error)

(test (let ((x 0) (y 0)) (set! y (do () (#t (set! x 32) 123))) (list x y)) (list 32 123))
(test (let ((i 32)) (do ((i 0 (+ i 1)) (j i (+ j 1))) ((> j 33) i))) 2)
(test (let ((i 0)) (do () ((> i 1)) (set! i (+ i 1))) i) 2)
(test (let ((i 0) (j 0)) (do ((k #\a)) (#t i) (set! i (char->integer k)) (set! j (+ j i)))) 0)
(test (let ((i 0) (j 0)) (do ((k #\a)) ((> i 1) j) (set! i (char->integer k)) (set! j (+ j i)))) (char->integer #\a))
(test (let ((x 0)) (do ((i 0 (+ i 2)) (j 1 (* j 2))) ((= i 4) x) (set! x (+ x i j)))) 5)
(test (let ((sum 0)) (do ((lst '(1 2 3 4) (cdr lst))) ((null? lst) sum) (set! sum (+ sum (car lst))))) 10)
(test (do ((i 0 (+ 1 i))) ((= i 4) (do ((i 0 (+ i 2))) ((= i 10) i)))) 10)
(test (let ((i 0)) (do ((i 1 (+ i 1))) ((= i 3) i))) 3)
(test (let ((j 0)) (do ((i 0 (+ i 1))) ((= i 3) (+ i j)) (do ((j 0 (+ j i 1))) ((> j 3) j)))) 3)
(test (let ((add1 (lambda (a) (+ a 1)))) (do ((i 0 (add1 i))) ((= i 10) (add1 i)))) 11)
(test (do ((i 0 (do ((j 0 (+ j 1))) ((= j i) (+ i 1))))) ((= i 3) i)) 3)
(test (do ((i 0 (do ((i 0 (+ i 1))) ((= i 3) i)))) ((= i 3) i)) 3)
(test (let ((i 123)) (do ((i 0 (+ i 1)) (j i (+ j i))) ((> j 200) i))) 13)
(test (do ((i 0 (+ i 1))) ((> i 3) i) (set! i (* i 10))) 11)
(test (do ((i 123) (j 0 (+ j i))) ((= j 246) i)) 123)
(test (do ((i 123 i) (j 0 (+ j i))) ((= j 246) i)) 123)
(test (do ((i 0 i)) (i i)) 0)
(test (do ((i 1 i)) (i i (+ i i) (+ i i i))) 3)
(test (do ((i 1)) (#t 1) 123) 1)
(test (do ((i 0 (+ i j)) (j 0 (+ j 1))) (#t 1)) 1)
(test (do ((i 0 j) (j 0 (+ j 1))) ((= j 3) i)) 2) ; uh, lessee... lexical scoping...
(test (do ((i 1 j) (j 0 k) (k 0 m) (m 0 (+ i j k))) ((> m 10) (list i j k m))) (list 4 5 8 11))
(test (let ((i 10) (j 11) (k 12)) (do ((i i j) (j j k) (k k m) (m (+ i j k) (+ i j k))) ((> m 100) (list i j k m)))) (list 33 56 78 122))
(test (let ((x 0) (i 3)) (do ((i i (+ i 1))) ((= i 6)) (do ((i i (+ i 1))) ((= i 7)) (set! x (+ x i)))) x) 44)
(test (let () (define (hi) (let ((x 0) (i 3)) (do ((i i (+ i 1))) ((= i 6)) (do ((i i (+ i 1))) ((= i 7)) (set! x (+ x i)))) x)) (hi)) 44)
(test (do ((i 0 (let () (set! j 3) (+ i 1))) (j 0 (+ j 1))) ((= i 3) j)) 4)
(test (let ((i 0)) (do () ((= i 3) (* i 2)) (set! i (+ i 1)))) 6)
(num-test (do ((i 0 (- i 1))) ((= i -3) i)) -3)
(num-test (do ((i 1/2 (+ i 1/2))) ((> i 2) i)) 5/2)
(num-test (do ((i 0.0 (+ i 0.1))) ((>= i 0.9999) i)) 1.0)
(num-test (do ((i 0 (- i 1/2))) ((< i -2) i)) -5/2)
(num-test (do ((i 0+i (+ i 0+i))) ((> (magnitude i) 2) i)) 0+3i)
(test (let ((x 0)) 
	(do ((i 0 (+ i 1)))
	    ((> i 4) x) 
	  (set! x (+ x i))
	  (set! i (+ i 0.5))))
      4.5)
(test (do ((i 0 1)) ((> i 0) i)) 1)
(test (do ((i 1.0+i 3/4)) ((= i 3/4) i)) 3/4)
(test (do ((i 0 "hi")) ((not (number? i)) i)) "hi")
(test (do ((i "hi" 1)) ((number? i) i)) 1)
(test (do ((i #\c "hi")) ((string? i) i)) "hi")
(test (do ((i #\c +)) ((not (char? i)) i)) +)
(test (let ((j 1)) (do ((i 0 j)) ((= i j) i))) 1)
(test (let ((j 1)) (do ((i 0 j)) ((= i j) i) (set! j 2))) 2)
(test (do ((j 1 2) (i 0 j)) ((= i j) i)) 2)
(test (let ((old+ +) (j 0)) (do ((i 0 (old+ i 1))) ((or (< i -3) (> i 3))) (set! old+ -) (set! j (+ j i))) j) -6)
(test (do ((i 0 (case i ((0) 1) ((1) "hi")))) ((string? i) i)) "hi")
(test (do ((i if +)) ((equal? i +) i)) +)
(test (let ((k 0)) (do ((j 0 (+ j 1)) (i 0 ((if (= i 0) + -) i 1))) ((= j 5)) (set! k (+ k i))) k) 2)
(test (let ((j -10) (k 0)) (do ((i 0 (+ i j)) (j 2)) ((> i 4) k) (set! k (+ k i)))) 6)
(test (let ((j -10) (k 0)) (do ((i j (+ i j)) (j 2)) ((> i 4) k) (set! k (+ k i)))) -24)
(test (let ((j -10) (k 0)) (do ((i j (+ i j)) (j 2)) ((= i j) k) (set! k (+ k i)))) -30)
(test (let ((j -10) (k 0)) (do ((i j (+ i j)) (j 2)) ((= i j) j) (set! k (+ k i)))) 2)
(test (let ((equal =)) (do ((i 0 (+ i 1))) ((equal i 3) i))) 3)
(test (let ((equal =)) (do ((i 0 (+ i 1))) ((equal i 3) i) (set! equal >))) 4)
(test (do ((equal =) (i 0 (+ i 1))) ((equal i 3) i)) 3)
(test (do ((equal = >) (i 0 (+ i 1))) ((equal i 3) i)) 4)
(test (do ((j 0) (plus + -) (i 0 (plus i 1))) ((= i -1) j) (set! j (+ j 1))) 3)
(test (let ((expr `(+ i 1))) (do ((j 0) (i 0 (eval expr))) ((= i 3) j) (set! j (+ j 1)))) 3)
(test (let ((expr `(+ i 1))) (do ((j 0) (i 0 (eval expr))) ((= i -3) j) (set! j (+ j 1)) (if (= j 3) (set! expr `(- i 1))))) 7)
(test (do ((i 0 (+ i 1))) ((or (= i 12) (not (number? i)) (> (expt 2 i) 32)) (expt 2 i))) 64)
(test (let ((k 0)) (do ((i 0 (+ i 1))) ((let () (set! k (+ k 1)) (set! i (+ i 1)) (> k 3)) i))) 7)
(num-test (do ((i 0 (+ i 1))) ((> i 3) i) (set! i (* .9 i))) 3.439)
(test (let ((v #(0 0 0))) (do ((i 0 (+ i 1))) ((= i 3) v) (set! (v i) i))) #(0 1 2))
(test (let ((v (list 0 0 0))) (do ((i 0 (+ i 1))) ((= i 3) v) (set! (v i) i))) '(0 1 2))
(test (let ((sum 0)) ((do ((i 0 (+ i 1))) ((> i 64) (lambda () sum)) (set! sum (+ sum i))))) 2080)
(test (do ((lst () (cons i lst)) (i 0 (+ i 1))) ((> i 6) (reverse lst))) '(0 1 2 3 4 5 6))
(let ()
  (define (d1) (do ((i 0 (+ i 1))) ((= i 10) i)))
  (define (d2) (do ((i 0 (+ i 1))) ((= i 10) i) i))
  (test (d1) 10)
  (test (d1) (d2)))
(test (+ 1 (do ((i 2 (+ i 1))) ((values i (+ i 1))))) 6)
(test (+ 1 (do ((i 2 (+ i 1))) ((= i 3) (values i (+ i 1))))) 8)
(test (let () (define (f) (+ 1 (do ((i 2 (+ i 1))) ((values i (+ i 1)))))) (f) (f)) 6)
(test (let () (define (f) (+ 1 (do ((i 2 (+ i 1))) ((= i 3) (values i (+ i 1)))))) (f) (f)) 8)
(test (let ((lst '(1 2)))
	(do ((p lst (cdr p))) 
	    ((or (not (pair? p)) (car p))
	     => (lambda (val) 
		  (and (pair? p)
		       val)))))
      1)
(let ()
  (define (f lst) 
    (do ((p lst (cdr p))) 
	((or (not (pair? p)) (car p))
	 => (lambda (val) 
	      (and (pair? p)
		   val)))))
  (test (f '(1 2)) 1)
  (test (f '(2 3)) 2))
(let ()
  (define (f lst) 
    (do ((p lst (cdr p))) 
	((or (not (pair? p)) (car p))
	 => car)))
  (test (f '((1) 2)) 1)
  (test (f '((2) 3)) 2))
(let ()
  (define (f lst) 
    (do ((p lst (cdr p))) 
	((if (pair? p)
	     (apply values (car p))
	     #t)
	 => +)))
  (test (f '((1 2) 2)) 3)
  (test (f '((2 3 4) 3)) 9))

(test (do () (1)) 1)
(test (do () (1 2)) 2)
(test (do () '2) 2)
(test (do () (())) ())
(test (do ((i 0 (+ i 1))) ((= i 2) (+ i j)) (define j i) j) 3) ; bizarre (Guile sez "bad define placement" from r6|7rs I guess)
(test (do ((i 1 (+ i j))) ((>= i 2) (+ i j)) (define j i) j) 3)
(test (do ((i 1 (+ i j))) ((>= i 2) (+ i j)) (define j (+ i 10)) j) 23)
;(test (do ((i 1 (+ i j))) ((>= i 2) (+ i j)) (if (integer? i) (define j i)) j) 3)
(test (do ((i 0 (+ i 1))) ((>= i 2) i) (define i 10) i) 11)
(test (do ((x (values (substring "0123" 2) #b101))) (#t (vector))) 'error)
(test (do ((x 0 (values 1 2))) ((= x 2)) (display x #f)) 'error)
(test (do ((i 0 (+ i 1))) ((values #t #f) 21) (abs i)) 21)
(test (+ 1 (do ((i 0 (+ i 1))) ((values (= i 1) 2 3) 4)) 5) 10)   ; (+ 1 (do (...) (#t 2 3 4)) 5) -> (+ 1 4 5)
(test (+ 1 (do ((i 0 (+ i 1))) ((values (= i 1) 2 3))) 5) 'error) ; the #f gets spliced into + args
(test (+ 1 (do ((i 0 (+ i 1))) ((values 2 3))) 5) 11)             ; (+ 1 2 3 5) -- hmmm.
(test (let ((x (do ((i 0 (+ i 1))) (#t)))) x) #t) ; guile: #<unspecified>

(test (let ((lst '(1 2 3))
	    (v (vector 0 0 0)))
	(do ((l lst (map (lambda (a) (+ a 1)) (cdr l))))
	    ((null? l))
	  (set! (v (- (length l) 1)) (apply + l)))
	v)
      #(5 7 6))

(test (do ((i 0 (+ i 1)) (j 1 2)) ((= i 4) j) (set! j 3)) 2)

(test (let ((lst '(1 2 3)))
	(map (lambda (a)
	       (let ((! 1))
		 (do ((i 0 (+ i 1))
		      (sum 0))
		     ((= i a) sum)
		   (set! sum (+ sum a)))))
	     lst))
      '(1 4 9))

(test (let ((sum 0)) (do ((i_0 0 (+ i_0 0))(i_1 1 (+ i_1 1))(i_2 2 (+ i_2 2))(i_3 3 (+ i_3 3))(i_4 4 (+ i_4 4))(i_5 5 (+ i_5 5))(i_6 6 (+ i_6 6))(i_7 7 (+ i_7 7))(i_8 8 (+ i_8 8))(i_9 9 (+ i_9 9))(i_10 10 (+ i_10 10))(i_11 11 (+ i_11 11))(i_12 12 (+ i_12 12))(i_13 13 (+ i_13 13))(i_14 14 (+ i_14 14))(i_15 15 (+ i_15 15))(i_16 16 (+ i_16 16))(i_17 17 (+ i_17 17))(i_18 18 (+ i_18 18))(i_19 19 (+ i_19 19))(i_20 20 (+ i_20 20))(i_21 21 (+ i_21 21))(i_22 22 (+ i_22 22))(i_23 23 (+ i_23 23))(i_24 24 (+ i_24 24))(i_25 25 (+ i_25 25))(i_26 26 (+ i_26 26))(i_27 27 (+ i_27 27))(i_28 28 (+ i_28 28))(i_29 29 (+ i_29 29))(i_30 30 (+ i_30 30))(i_31 31 (+ i_31 31))(i_32 32 (+ i_32 32))(i_33 33 (+ i_33 33))(i_34 34 (+ i_34 34))(i_35 35 (+ i_35 35))(i_36 36 (+ i_36 36))(i_37 37 (+ i_37 37))(i_38 38 (+ i_38 38))(i_39 39 (+ i_39 39)))
    ((= i_1 10) sum)
  (set! sum (+ sum i_0 i_1 i_2 i_3 i_4 i_5 i_6 i_7 i_8 i_9 i_10 i_11 i_12 i_13 i_14 i_15 i_16 i_17 i_18 i_19 i_20 i_21 i_22 i_23 i_24 i_25 i_26 i_27 i_28 i_29 i_30 i_31 i_32 i_33 i_34 i_35 i_36 i_37 i_38 i_39))))
      35100)

(let () (define (jtest) (let ((j 0)) (do ((i 0 (+ i 1))) ((= i 10) j) (if (= i 3) (set! j i))))) (test (jtest) 3))
(let () (define (jtest1) (let ((j (vector 0))) (do ((i 0 (+ i 1))) ((= i 10) (j 0)) (if (= i 3) (set! (j 0) i))))) (test (jtest1) 3))
(let () (define (jtest2) (let ((j (vector 0))) (do ((i 0 (+ i 1))) ((= i 10) (j 0)) (if (= i 3) (vector-set! j 0 i))))) (test (jtest2) 3))
(let () (define (jtest3) (let ((j (vector 0))) (do ((i 0 (+ i 1))) ((= i 10) (j 0)) (if (= i 3) (set! (vector-ref j 0) i))))) (test (jtest3) 3))
(let () (define (jtest4) (let ((j (list 0))) (do ((i 0 (+ i 1))) ((= i 10) (j 0)) (if (= i 3) (set! (j 0) i))))) (test (jtest4) 3))
(let () (define (jtest5) (let ((j (list 0))) (do ((i 0 (+ i 1))) ((= i 10) (j 0)) (if (= i 3) (set! (car j) i))))) (test (jtest5) 3))
(let () (define (jtest6) (let ((j (list 0))) (do ((i 0 (+ i 1))) ((= i 10) (j 0)) (if (= i 3) (set-car! j i))))) (test (jtest6) 3))
(let () (define (jtest7) (let ((j (list 0))) (do ((i 0 (+ i 1))) ((= i 10) (j 0)) (if (= i 3) (list-set! j 0 i))))) (test (jtest7) 3))
(let () (define (jtest8) (let ((j #f)) (do ((i 0 (+ i 1))) ((= i 10) (car j)) (if (= i 3) (set! j (list i)))))) (test (jtest8) 3))
(let () (define (jtest9) (let ((j #f)) (do ((i 0 (+ i 1))) ((= i 10) (j 0)) (if (= i 3) (set! j (vector i)))))) (test (jtest9) 3))
(let () (define (jtest10) (let ((j (cons 1 2))) (do ((i 0 (+ i 1))) ((= i 10) j) (if (= i 3) (set-car! j i))))) (test (jtest10) '(3 . 2)))
(let () (define (jtest10a) (let ((j (cons 1 2))) (do ((i 0 (+ i 1))) ((= i 10) j) (if (= i 3) (list-set! j 0 i))))) (test (jtest10a) '(3 . 2)))
(let () (define (jtest11) (let ((j (cons 1 2))) (do ((i 0 (+ i 1))) ((= i 10) j) (if (= i 3) (set! j (cons 0 i)))))) (test (jtest11) '(0 . 3)))
;; (let ((f #f)) (define (jtest12) (do ((i 0 (+ i 1))) ((= i 10) (f)) (if (= i 3) (set! f (lambda () i))))) (test (jtest12) 3))
;; this lambda business is a separate issue (s7 returns 10 here)

;; do_all_x:
(let () (define (f1) (let ((v (vector 0 0 0))) (do ((i 0 (+ i 1))) ((= i 3) v) (vector-set! v i (abs i))))) (test (f1) #(0 1 2)))
(let () (define (f1) (let ((v (vector 0 0 0)) (x #f)) (do ((i 0 (+ i 1))) ((= i 3) (set! x v) x) (vector-set! v i (abs i))))) (test (f1) #(0 1 2)))
(let () (define (f1) (let ((end 3) (v (vector 0 0 0))) (vector (do ((i 0 (+ i 1))) ((= i end)) (vector-set! v i (abs i))) v))) (test (f1) #(#t #(0 1 2))))
(let () (define (f1) (let ((v (vector 0 0 0))) (do ((i 0 (+ i 1))) ((= i 3) v) (display i #f) (vector-set! v i (abs i))))) (test (f1) #(0 1 2)))

(let () (define (f1) (let ((v (vector 0 0 0))) (do ((i 0 (+ i 1))) ((= i 0) v) (vector-set! v i (abs i))))) (test (f1) #(0 0 0)))

(let () (define (safe-do-all-x)
	  (let ((v1 (vector 1 2 3 4 5 6))
		(v2 (vector 10 11 12 13 14 15)))
	    (do ((i 0 (+ i 1)))
		((= i 3))
	      (vector-set! v1 i (vector-ref v2 (+ i 1))))
	    v1))
     (test (safe-do-all-x) (vector 11 12 13 4 5 6)))


(test (let () (define (step-it a) (+ a 1)) (define (hi) (do ((i 0 (step-it i))) ((= i 3) i))) (hi) (hi)) 3)

(test (call-with-exit (lambda (return) (do () () (if #t (return 123))))) 123)
(test (call-with-exit (lambda (return) (do () (#f) (if #t (return 123))))) 123)
(test (call-with-exit (lambda (return) (do ((i 0 (+ i 1))) () (if (= i 100) (return 123))))) 123)
(test (call-with-exit (lambda (return) (do () ((return 123))))) 123)
(test (call-with-exit (lambda (return) (do () (#t (return 123))))) 123)

(test (do () (/ 0)) 0)
(test (do () (+)) +)
(test (do () (+ +) *) +)

(when with-bignums
  (num-test (do ((i 24444516448431392447461 (+ i 1))
		 (j 0 (+ j 1)))
		((>= i 24444516448431392447471) j))
	    10)
  (num-test (do ((i 0 (+ i 24444516448431392447461))
		 (j 0 (+ j 1)))
		((>= i 244445164484313924474610) j))
	    10)
  (num-test (do ((i 4096 (* i 2))
		 (j 0 (+ j 1)))
		((= i 4722366482869645213696) j))
	    60))

(test (do ((i 9223372036854775805 (+ i 1))
	   (j 0 (+ j 1)))
	  ((>= i 9223372036854775807) j))
      2)
(test (do ((i -9223372036854775805 (- i 1))
	   (j 0 (+ j 1)))
	  ((<= i -9223372036854775808) j))
      3)

(num-test (do ((x (list 1 2 3) (cdr x)) (j -1)) ((null? x) j) (set! j (car x))) 3)

(test (let ((x 0)) 
	(do ((i 0 (+ i 1)))
	    ((= i (do ((j 0 (+ j 1))) ((= j 2) (+ j 1)))))
	  (set! x (+ x i)))
	x)
      3)
(test (let ((x 0)) 
	(do ((i 0 (+ i (do ((j 0 (+ j 1))) ((= j 2) 1)))))
	    ((= i 3) x)
	  (set! x (+ x i))))
      3)
(test (let ((x 0)) 
	(do ((i 0 (+ i (do ((j 0 (+ j 1))) ((= j 2) 1)))))
	    ((= i 3) (do ((j 0 (+ j 1))) ((= j 5) x) (set! x j)))
	  (set! x (+ x i))))
      4)

(test (call-with-exit (lambda (exit) (do ((i 0 (+ i 1))) ((= i 100) i) (if (= i 2) (exit 321))))) 321)
(test (call-with-exit (lambda (exit) (do ((i 0 (if (= i 3) (exit 321) (+ i 1)))) ((= i 100) i)))) 321)
(test (call-with-exit (lambda (exit) (do ((i 0 (+ i 1))) ((= i 10) (exit 321))))) 321)
(test (call-with-exit (lambda (exit) (do ((i 0 (+ i 1))) ((= i 10) i) (if (= i -2) (exit 321))))) 10)
(test (do ((x 0 (+ x 1)) (y 0 (call/cc (lambda (c) c)))) ((> x 5) x) #f) 6)
(test (let ((happy #f)) (do ((i 0 (+ i 1))) (happy happy) (if (> i 3) (set! happy i)))) 4)

(test (+ (do ((i 0 (+ i 1))) ((= i 3) i)) (do ((j 0 (+ j 1))) ((= j 4) j))) 7)
(test (do ((i (if #f #f))) (i i)) (if #f #f))
(test (do ((i (if #f #f)) (j #f i)) (j j)) (if #f #f))

(test (let ((cont #f)
	    (j 0)
	    (k 0))
	(call/cc (lambda (exit) 
		   (do ((i 0 (+ i 1))) 
		       ((= i 100) i) 
		     (set! j i)
		     (call/cc (lambda (r) (set! cont r)))
		     (if (= j 2) (exit))
		     (set! k i))))
	(if (= j 2)
	    (begin
	      (set! j 3)
	      (cont))
	    (list j k)))
      (list 99 99))

(test (call/cc (lambda (r) (do () (#f) (r 1)))) 1)
(test (let ((hi (lambda (x) (+ x 1)))) (do ((i 0 (hi i))) ((= i 3) i))) 3)
(test (do ((i 0 (+ i 1))) (list 1) ((= i 3) #t)) 1) ; a typo originally -- Guile and Gauche are happy with it
(test (do () (1 2) 3) 2)

;; from sacla tests
(test (let ((rev (lambda (list)
		   (do ((x list (cdr x))
			(reverse () (cons (car x) reverse)))
		       ((null? x) reverse)))))
	(and (null? (rev ()))
	     (equal? (rev '(0 1 2 3 4)) '(4 3 2 1 0))))
      #t)

(test (let ((nrev (lambda (list)
		    (do ((f1st (if (null? list) () (cdr list)) (if (null? f1st) () (cdr f1st)))
			 (s2nd list f1st)
			 (t3rd () s2nd))
			((null? s2nd) t3rd)
		      (set-cdr! s2nd t3rd)))))
	(and (null? (nrev ()))
	     (equal? (nrev (list 0 1 2 3 4)) '(4 3 2 1 0))))
      #t)

(test (do ((temp-one 1 (+ temp-one 1))
	   (temp-two 0 (- temp-two 1)))
	  ((> (- temp-one temp-two) 5) temp-one))
      4)

(test (do ((temp-one 1 (+ temp-one 1))
	   (temp-two 0 (+ temp-one 1)))     
	  ((= 3 temp-two) temp-one))
      3)

(let ((vec (vector 0 1 2 3 4 5 6 7 8 9)))
  (test (do ((i 0 (+ 1 i))
	     (n #f)
	     (j 9 (- j 1)))
	    ((>= i j) vec)
	  (set! n (vector-ref vec i))
	  (vector-set! vec i (vector-ref vec j))
	  (vector-set! vec j n))
	#(9 8 7 6 5 4 3 2 1 0)))

(test (do ((i 0 (+ i 1))) (#t i) (error 'syntax-error "do evaluated its body?")) 0)
(test (do '() (#t 1)) 'error)
(test (do . 1) 'error)
(test (do ((i i i)) (i i)) 'error)
(test (do ((i 0 i (+ i 1))) (i i)) 'error)
(test (do ((i)) (#t i)) 'error)
(test (do ((i 0 (+ i 1))) #t) 'error)
(test (do 123 (#t 1)) 'error)
(test (do ((i 1)) (#t . 1) 1) 'error)
(test (do ((i 1) . 1) (#t 1) 1) 'error)
(test (do ((i 1) ()) (= i 1)) 'error)
(test (do ((i 0 . 1)) ((= i 1)) i) 'error)
(test (do ((i 0 (+ i 1))) ((= i 3)) (set! i "hiho")) 'error)
(test (let ((do+ +)) (do ((i 0 (do+ i 1))) ((= i 3)) (set! do+ abs))) 'error)
(test (do () . 1) 'error)
(test (do ((i)) (1 2)) 'error)
(test (do (((i))) (1 2)) 'error)
(test (do ((i 1) ((j))) (1 2)) 'error)
(test (do (((1))) (1 2)) 'error)
(test (do ((pi 1 2)) (#t pi)) 'error)
(test (do ((1+i 2 3)) (#t #t)) 'error)
(test (do ((1.2 2 3)) (#t #t)) 'error)
(test (do (((1 . 2) "hi" (1 2))) (#t 1)) 'error)
(test (do ((() () ())) (#t #t)) 'error)
(test (do (("hi" "hi")) ("hi")) 'error)
(test (do ((:hi 1 2)) (#t :hi)) 'error)
(test (do ((i 0 (abs ()))) ((not (= i 0)) i)) 'error)
(test (do ((i j) (j i)) (i i)) 'error)
(test (do ((i 0 0) . ((j 0 j))) (#t j)) 0)
(test (do ((i 0 1 . 2)) (#t i)) 'error)
(test (do ((i 0 "hi")) ((string? i) . i)) 'error)
(test (do ((i 0 j)) (#t i)) 0) ; guile also -- (do ((i 0 (abs "hi"))) (#t i)) etc (do ((i 0 1)) (#t i) (abs "hi"))
(test (do ((i 0 1) . (j 0 0)) ((= i 1) i) i) 'error)
(test (do ((i 0 1) ((j 0 0)) ((= i 1) i)) i) 'error)
(test (do #f) 'error)
(test (do () #f) 'error)
(test (do () #()) 'error)
(test (do '((i 1)) ()) 'error)
(test (do #() ()) 'error)
(test (do ((#() 1)) ()) 'error)
(test (do ((1)) ()) 'error)
(test (do ((i 1) . #(a 1)) ()) 'error)
(test (do () ((3 4))) 'error)
(test (do ((i 1)) '()) ())
(test (do . (() (#t 1))) 1)
(test (do () . ((#t 1))) 1)
(test (do ((i 1 (+ i 1))) . ((() . ()))) ())
(test (do ((a . 1) (b . 2)) () a) 'error)
(let () (define (d1) (do ((i 0 (+ i 1))) ((= i 3) . i) (display i))) (test (d1) 'error))
(let () (define (d1) (do ((i 0 (+ i 1))) ((= i 3) i) . i)) (test (d1) 'error))
(test (let () (define (f) (do ((i 0 (+ i 1))) ((= i 1) i) ((0 1) ()))) (f)) 'error)
(test (let () (define (f) (do ((i 0 (+ i 1))) ((= i 1) i) () (define-macro (_m1_ a) (list-values '+ a 1)))) (f)) 1)
(test (let () (define (f) (do ((i 0 (+ i 1)) (j 0 (+ j 1))) ((= i 1) i) () (define-macro (_m1_ a) (list-values '+ a 1)))) (f)) 1)

(test (define-constant) 'error)
(test (define-constant _asdf_ 2 3) 'error)
(test (define-constant pi 3) 'error) ; except in Utah
(test (define-constant pi . 3) 'error)
(define-constant __do_step_var_check__ 1)
(test (do ((__do_step_var_check__ 2 3)) (#t #t)) 'error)
(test (let ((__do_step_var_check__ 2)) 1) 'error)
(test (let () (set! __do_step_var_check__ 2)) 'error)
(test (let ((__a_var__ 123))
	(set! (symbol-setter '__a_var__) (lambda (val sym) 0))
	(set! __a_var__ -1123))
      0)
(test (do ((hi #3d(((1 2) (3 4)) ((5 6) (7 8))) (hi 1))) ((equal? hi 8) hi)) 8)
(test (do ((i 0 ('((1 2) (3 4)) 0 1))) ((not (= i 0)) i)) 2)
(test (do () (#t (+ 1 2 3))) 6)
(test (do ((f + *) (j 1 (+ j 1))) ((= j 2) (apply f (list j j)))) 4)
(test (do ((f lambda) (j 1 (+ j 1))) ((= j 2) ((f (a) (+ a j)) 3))) 5)

(let ()
  (define-macro (add-1 x) `(+ ,x 1))
  (test (do ((i 0 (add-1 i))) ((= i 3) i)) 3)
  (test (do ((i 0 (add-1 i))) ((= i 3) (add-1 i))) 4))

(test (let ((j #f))
	(do ((i 0 (let ((x 0))
		    (dynamic-wind
			(lambda ()
			  (set! x i))
			(lambda ()
			  (+ x 1))
			(lambda ()
			  (if (> x 3)
			      (set! j #t)))))))
	    (j i)))
      5)
(test (let ((j 0)) (do ((i 0 (eval-string "(+ j 1)"))) ((= i 4) j) (set! j i))) 3)
(test (do ((i (do ((i (do ((i 0 (+ i 1)))
			  ((= i 3) (+ i 1)))
		      (do ((j 0 (+ j 1)))
			  ((= j 3)) (+ j i))))
		  ((> (do ((k 0 (+ k 1)))
			  ((= k 2) (* k 4)))
		      (do ((n 0 (+ n 1)))
			  ((= n 3) n)))
		   (do ((m 0 (+ m 1)))
		       ((= m 3) (+ m i)))))
	      i))
	  ((> i 6) i))
      7)

(test (let ((L (list 1 2))) 
	(do ((sum 0 (+ sum (car lst))) 
	     (i 0 (+ i 1)) 
	     (lst L (cdr lst))) 
	    ((or (null? lst) 
		 (> i 10)) 
	     sum) 
	  (set-cdr! (cdr L) L))) 
      16)

;;; optimizer checks
(num-test (let ((x 0)) (do ((i 1.0 (+ i 1))) ((> i 3)) (set! x (+ x i))) x) 6.0)
(num-test (let ((x 0)) (do ((i 1 4)) ((> i 3)) (set! x (+ x i))) x) 1)
(num-test (let ((x 0)) (do ((i 1 ((if #t + -) i 1))) ((> i 3)) (set! x (+ x i))) x) 6)
(num-test (let ((x 0)) (do ((i 1 (+))) ((> i 0)) (set! x (+ x i))) x) 0)
(let () (define (f12345) (let ((x 0)) (do ((i 1 (+))) ((> i 0)) (set! x (+ x i))) x) 0) (f12345) (f12345))
(num-test (let ((x 0)) (do ((i 1 (+ 1))) ((> i 0)) (set! x (+ x i))) x) 0)
(num-test (let ((x 0)) (do ((i 1 (+ 1 i 2))) ((> i 10)) (set! x (+ x i))) x) 22)
(num-test (let ((x 0)) (do ((i 1 (+ 1.0 i))) ((> i 3)) (set! x (+ x i))) x) 6.0)
(num-test (let ((x 0)) (do ((i 1 (+ 1 pi))) ((> i 2)) (set! x (+ x i))) x) 1)
(num-test (do ((i 0 (+ 1 pi))) ((> i 2) i)) (+ pi 1.0))
(num-test (let ((x 0)) (do ((i 0 (+ i 8796093022208))) ((> i 0)) (set! x (+ x i))) x) 0)
(num-test (let ((x 0)) (do ((i 0 (+ i 8796093022208))) ((> i 17592186044416)) (set! x (+ x i))) x) (+ (expt 2 44) (expt 2 43)))
(num-test (let ((x 0)) (do ((i 1 (* i 2))) ((> i 10)) (set! x (+ x i))) x) 15)
(num-test (do ((i 0 (+ i 1))) ((> i 2) i) (set! i (+ i 3.0))) 4.0)
(num-test (let ((x 0)) (let ((add +)) (do ((i 0 (add i 1))) ((< i -2)) (set! add -) (set! x (+ x i)))) x) -3)
(num-test (let ((equals =) (x 0)) (do ((i 0 (+ i 1))) ((equals i 3) x) (set! x (+ x i)))) 3)
(num-test (let ((equals =) (x 0)) (do ((i 0 (+ i 1))) ((equals i 3) x) (set! x (+ x i)) (set! i (* i 1.0)))) 3.0)
(num-test (let ((equals =) (x 0)) (do ((i 0 (+ i 1))) ((equals i 3) x) (set! x (+ x i)) (set! equals >))) 6)
(num-test (let ((equals =) (x 0)) (do ((i 0 (+ i 1))) ((equals i 3) x) (set! x (+ x i)) (set! equals =))) 3)
(num-test (let ((equals =) (x 0)) (do ((i 0 (+ i 1))) ((equals i 3) (set! x (+ x 1)) x) (set! x (+ x i)) (set! equals =))) 4)
(num-test (do ((i 0 (+ i 1))) ((> i 3) i) (set! i (expt 2 60))) (+ 1 (expt 2 60)))
(num-test (let ((x 0) (n 3)) (do ((i 0 (+ i 1))) ((= i n) x) (set! x (+ x i)))) 3)
(num-test (let ((x 0) (n 3)) (do ((i 0 (+ i 1))) ((= 1 1) x) (set! x (+ x i)))) 0)
(num-test (let ((x 0) (n (expt 2 50))) (do ((i 0 (+ i n))) ((= i (expt 2 51)) x) (set! x (+ x i)))) (expt 2 50))
(num-test (let ((x 0) (n 31.0)) (do ((i 0 (+ i 1))) ((= i n) x) (set! x (+ x i)) (set! n 3))) 3)
(num-test (let ((x 0)) (do ((i 0 (+ i 1/2))) ((= i 3) x) (set! x (+ x i)))) 15/2)
(num-test (let ((x 0)) (do ((i 0 (+ i 1+i))) ((> (magnitude i) 3) x) (set! x (+ x i)))) 3+3i)
(num-test (call-with-exit (lambda (r) (do () () (r 1)))) 1)
(num-test (call-with-exit (lambda (r) (do () (#t 10 14) (r 1)))) 14)
(num-test (do ((i 0 (+ i 1))) (#t 10 12)) 12)
(num-test (do ((i 0 (+ i 1))) ((= i 3) i)) 3)
(num-test (do ((i 0 (+ i 1))) ((> i 3) i)) 4)
(num-test (do ((i 0 (+ i 1))) ((< i 3) i)) 0)
(num-test (do ((i 0 (+ i 1))) ((<= i 3) i)) 0)
(num-test (do ((i 0 (+ i 1))) ((>= i 3) i)) 3)
(num-test (do ((i 0 (+ i 1))) ((>= 3 i) i)) 0)
(num-test (do ((i 0 (+ i 1))) ((> 3 i) i)) 0)
(num-test (do ((i 0 (+ i 1))) ((< 3 i) i)) 4)
(num-test (do ((i 0 (+ i 1))) ((<= 3 i) i)) 3)
(num-test (let ((n 3)) (do ((i 0 (+ i 1))) ((> i n) i))) 4)
(num-test (let ((n 3)) (do ((i 0 (+ i 1))) ((< n i) i))) 4)
(num-test (do ((i 10 (- i 1))) ((= i 0) i)) 0)
(num-test (do ((i 10 (- 1 i))) ((< i 0) i)) -9)
(num-test (do ((i 10 (- i 3))) ((< i 0) i)) -2)
(let () (define (hi) (do ((i 1 (+ 1 i))) ((= i 1) i))) (hi) (test (hi) 1))
(let () (define (hi) (do ((i 10 (+ i 1))) ((= i 10) i) (abs i))) (hi) (test (hi) 10))
(let ((sum 0)) (define (hi) (do ((i 10 (+ i 1))) ((= i 10) i) (set! sum (+ sum i)))) (hi) (test (hi) 10))
(let () (define (hi a) (do ((i a (+ i 1))) ((= i a) i) (+ a 1))) (hi 1) (test (hi 1) 1))
(let () 
  (define (fx) 
    (let ((iter (make-iterator #(1 2 3)))) 
      (do () ((or (string? (iterate iter)) (iterator-at-end? iter)) (not (iterator-at-end? iter))))))
  (test (fx) #f))
(let ()
  (define (fx1)
    (let ((iter (make-iterator #(1 2 3)))) 
      (do () ((or (= (iterate iter) 2) (iterator-at-end? iter)) (iterate iter)))))
  (test (fx1) 3))
(let ()
  (define (fx2)
    (let ((iter (make-iterator #(1 2 3)))) 
      (do () ((= (iterate iter) 2) (iterate iter)))))
  (test (fx2) 3))
(let ()
  (define (fdo1)
    (let ((abs (lambda (x) (+ x 1)))
	  (x '(1 2 3)))
      (do ((i 0 (+ i 1)))
	  ((= i 1))
	(if (not (equal? (map abs x) '(2 3 4)))
	    (format () "fdo1 map case: ~S" (map abs x))))
      (do ((i 0 (+ i 1)))
	  ((= i 1))
	(if (not (equal? (for-each abs x) #<unspecified>))
	    (display "fdo1 for-each case")))))
  (define (fdo2)
    (let ((abs (lambda (x y) (= x y)))
	  (x '(1 2 3)))
      (do ((i 0 (+ i 1)))
	  ((= i 1))
	(if (not (member 2 x abs))
	    (display "fdo2 member case")))))
  (define (fdo3)
    (let ((abs (lambda (x y) (= x y)))
	  (x '((1 a) (2 b) (3 c))))
      (do ((i 0 (+ i 1)))
	  ((= i 1))
	(if (not (assoc 2 x abs))
	    (display "fdo3 assoc case")))))
  (define (fdo4)
    (let ((abs (lambda (x y) (> x y)))
	  (x (list 1 2 3)))
      (do ((i 0 (+ i 1)))
	  ((= i 1))
	(if (not (equal? (sort! x abs) '(3 2 1)))
	    (display "fdo4 sort! case")))))
  (fdo1)
  (fdo2)
  (fdo3)
  (fdo4))

(let () (define (fdo5) (do ((si () '())) ((null? si) 'mi))) (test (fdo5) 'mi))
(let () (define (fdo5) (do ((si '() '())) ((null? si) 'mi))) (test (fdo5) 'mi))
(let () (define (fdo5) (do ((si () ())) ((null? si) 'mi))) (test (fdo5) 'mi))
(let () (define (fdo5) (do ((si () ())) ((null? si) 'mi))) (test (fdo5) 'mi))

(let () (define (f1 x) (let ((y 0)) (do ((i 0 (+ i 1))) ((= i 3) y) (if x (set! y (+ y 1)))))) (test (f1 #t) 3)) ; b_s -> if_bp
(let () (define (f1 x) (let ((y 0)) (do ((i 0 (+ i 1))) ((= i 3) y) (if (not x) (set! y (+ y 1)))))) (test (f1 #f) 3)) ; b_s -> if_nbp
(let () (define (f1 x) (let ((y 0)) (do ((i 0 (+ i 1))) ((= i 3) y) (cond (x (set! y (+ y 1))) (else 3))))) (test (f1 #t) 3)) ; b_s
(let () (define (f1 x) (let ((y 0)) (do ((i 0 (+ i 1))) ((= i 3) y) (cond ((zero? x) (set! y (+ y 1))) (else 3))))) (test (f1 0) 3)) ; b_i_s and b_t
(let () (define (f1 x) (let ((y 0)) (do ((i 0 (+ i 1))) ((= i 3) y) (cond ((positive? x) (set! y (+ y 1))) (else 3))))) (test (f1 1.0) 3)) ; b_d_s
(let () (define (f1 x) (let ((y 0)) (do ((i 0 (+ i 1))) ((= i 3) y) (cond ((positive? (car x)) (set! y (+ y 1))) (else 3))))) (test (f1 '(1)) 3)) ; b_p_f
(let () (define (f1 x) (let ((y 0)) (do ((i 0 (+ i 1))) ((= i 3) y) (cond ((= x 1) (set! y (+ y 1))) (else 3))))) (test (f1 1) 3)) ; b_ii_sc
(let () (define (f1 x) (let ((y 0) (z 0)) (do ((i 0 (+ i 1))) ((= i 3) y) (cond ((= x z) (set! y (+ y 1))) (else 3))))) (test (f1 0) 3)) ; b_ii_ss
(let () (define (f1 x) (let ((y 0) (z '(0))) (do ((i 0 (+ i 1))) ((= i 3) y) (cond ((= x (car z)) (set! y (+ y 1))) (else 3))))) (test (f1 0) 3)) ; b_pp_sfo
(let () (define (f1 x) (let ((y 0) (z '(0))) (do ((i 0 (+ i 1))) ((= i 3) y) (cond ((= (car z) x) (set! y (+ y 1))) (else 3))))) (test (f1 0) 3)) ; b_pi_fs
(let () (define (f1 x) (let ((y 0)) (do ((i 0 (+ i 1))) ((= i 3) y) (cond ((= x 1.0) (set! y (+ y 1))) (else 3))))) (test (f1 1.0) 3)) ; b_dd_sc
(let () (define (f1 x) (let ((y 0) (z 1.0)) (do ((i 0 (+ i 1))) ((= i 3) y) (cond ((= x z) (set! y (+ y 1))) (else 3))))) (test (f1 1.0) 3)) ; b_dd_ss

(let () (define (f1) (let ((y 0)) (do ((i 0 (+ i 1))) ((= i 3) y) (set! y (+ y 1))))) (test (f1) 3)) ; i_ii_sc set_i_i_f
(let () (define (f1) (let ((y 0) (z 1)) (do ((i 0 (+ i 1))) ((= i 3) y) (set! y (+ y z))))) (test (f1) 3)) ; i_ii_ss
(let () (define (f1) (let ((y 0)) (do ((i 0 (+ i 1))) ((= i 3) y) (set! y 1)))) (test (f1) 1)) ; i_c
(let () (define (f1) (let ((y 0) (z 1)) (do ((i 0 (+ i 1))) ((= i 3) y) (set! y z)))) (test (f1) 1)) ; i_s
(let () (define (f1) (let ((y 0) (z 1)) (do ((i 0 (+ i 1))) ((= i 3) y) (set! y (floor z))))) (test (f1) 1)) ; i_i_s
(let () (define (f1) (let ((y 0)) (do ((i 0 (+ i 1))) ((= i 3) y) (set! y (floor 1.1))))) (test (f1) 1)) ; i_d_c
(let () (define (f1) (let ((y 0)) (do ((i 0 (+ i 1))) ((= i 3) y) (set! y (floor 1))))) (test (f1) 1)) ; i_i_c
(let () (define (f1) (let ((y 0) (z 1)) (do ((i 0 (+ i 1))) ((= i 3) y) (set! y (floor (* 1.2 z)))))) (test (f1) 1)) ; i_d_f
(let () (define (f1) (let ((y 0) (z 1)) (do ((i 0 (+ i 1))) ((= i 3) y) (set! y (floor (* 1 z)))))) (test (f1) 1)) ; i_ii_cs i_i_f set_i_i_f
(let () (define (f1) (let ((y 0)) (do ((i 0 (+ i 1))) ((= i 3) y) (set! y (+ 1 1))))) (test (f1) 2)) ; i_ii_cc
(let () (define (f1) (let ((y 0)) (do ((i 0 (+ i 1))) ((= i 3) y) (set! y (+ 1 (abs 1)))))) (test (f1) 2)) ; i_ii_cf
(let () (define (f1) (let ((y 0)) (do ((i 0 (+ i 1))) ((= i 3) y) (set! y (+ (abs 1) 1))))) (test (f1) 2)) ; i_ii_fc
(let () (define (f1) (let ((y 0) (z 1)) (do ((i 0 (+ i 1))) ((= i 3) y) (set! y (+ z (abs 1)))))) (test (f1) 2)) ; i_ii_sf
(let () (define (f1) (let ((y 0) (z 1)) (do ((i 0 (+ i 1))) ((= i 3) y) (set! y (+ (abs 1) (abs 1)))))) (test (f1) 2)) ; i_ii_ff
(let () (define (f1) (let ((y 0) (z 1)) (do ((i 0 (+ i 1))) ((= i 3) y) (set! y (+ z 1 z 1))))) (test (f1) 4)) ; i_add2
(let () (define (f1) (let ((y 0) (z 1)) (do ((i 0 (+ i 1))) ((= i 3) y) (set! y (+ z 1 z 1 z 1))))) (test (f1) 6)) ; i_add_any_f
(let () (define (f1) (let ((y 0) (z 1)) (do ((i 0 (+ i 1))) ((= i 3) y) (set! y (* z 1 z 1))))) (test (f1) 1)) ; i_mul2
(let () (define (f1) (let ((y 0) (z 1)) (do ((i 0 (+ i 1))) ((= i 3) y) (set! y (* z 1 z 1 z 1))))) (test (f1) 1)) ; i_multiply_any_f

(let () (define (f1) (let ((y 0.0)) (do ((i 0 (+ i 1))) ((= i 3) y) (set! y (+ y 1.0))))) (test (f1) 3.0))  ; d_dd_sc set_d_d_f
(let () (define (f1) (let ((y 0.0) (z 1.0)) (do ((i 0 (+ i 1))) ((= i 3) y) (set! y (+ y z))))) (test (f1) 3.0)) ; d_dd_ss 
(let () (define (f1) (let ((y 0.0)) (do ((i 0 (+ i 1))) ((= i 3) y) (set! y 1.0)))) (test (f1) 1.0)) ; d_c
(let () (define (f1) (let ((y 0.0) (z 1.0)) (do ((i 0 (+ i 1))) ((= i 3) y) (set! y z)))) (test (f1) 1.0)) ; d_s
(let () (define (f1) (let ((y 0.0) (z 1.0)) (do ((i 0 (+ i 1))) ((= i 3) y) (set! y (abs z))))) (test (f1) 1.0)) ; d_d_s
(let () (define (f1) (let ((y 0.0)) (do ((i 0 (+ i 1))) ((= i 3) y) (set! y (abs 1.1))))) (test (f1) 1.1)) ; d_d_c
(let () (define (f1) (let ((y 0.0)) (do ((i 0 (+ i 1))) ((= i 3) y) (set! y (abs 1))))) (test (f1) 1.0)) ; d_d_c
(let () (define (f1) (let ((y 0.0) (z 1.0)) (do ((i 0 (+ i 1))) ((= i 3) y) (set! y (abs (* 1.2 z)))))) (test (f1) 1.2)) ;d_dd_cs
(let () (define (f1) (let ((y 0.0) (z 1.0)) (do ((i 0 (+ i 1))) ((= i 3) y) (set! y (abs (* 1 z)))))) (test (f1) 1.0)) ; d_dd_cs
(let () (define (f1) (let ((y 0.0)) (do ((i 0 (+ i 1))) ((= i 3) y) (set! y (+ 1.0 1.0))))) (test (f1) 2.0)) ; d_dd_cc
(let () (define (f1) (let ((y 0.0)) (do ((i 0 (+ i 1))) ((= i 3) y) (set! y (+ 1.0 (abs 1.0)))))) (test (f1) 2.0)) ; d_dd_cf
(let () (define (f1) (let ((y 0.0)) (do ((i 0 (+ i 1))) ((= i 3) y) (set! y (+ (abs 1.0) 1.0))))) (test (f1) 2.0)) ; d_d_c d_dd_fc
(let () (define (f1) (let ((y 0.0) (z 1.0)) (do ((i 0 (+ i 1))) ((= i 3) y) (set! y (+ z (abs 1.0)))))) (test (f1) 2.0)) ; d_dd_sf
(let () (define (f1) (let ((y 0.0) (z 1.0)) (do ((i 0 (+ i 1))) ((= i 3) y) (set! y (+ (abs 1.0) (abs 1.0)))))) (test (f1) 2.0)) ; d_dd_ff
(let () (define (f1) (let ((y 0.0) (z 1.0)) (do ((i 0 (+ i 1))) ((= i 3) y) (set! y (+ z 1.0 z 1.0))))) (test (f1) 4.0)) ; d_dddd_ffff
(let () (define (f1) (let ((y 0.0) (z 1.0)) (do ((i 0 (+ i 1))) ((= i 3) y) (set! y (+ z 1.0 z 1.0 z 1.0))))) (test (f1) 6.0)) ; d_add_any_f
(let () (define (f1) (let ((y 0.0) (z 1.0)) (do ((i 0 (+ i 1))) ((= i 3) y) (set! y (* z 1.0 z 1.0))))) (test (f1) 1.0)) ; d_dddd_ffff
(let () (define (f1) (let ((y 0.0) (z 1.0)) (do ((i 0 (+ i 1))) ((= i 3) y) (set! y (* z 1.0 z 1.0 z 1.0))))) (test (f1) 1.0)) ; d_multiply_any_f

(let () (define (f1) (let ((y #\b)) (do ((i 0 (+ i 1))) ((= i 3) y) (set! y #\a)))) (test (f1) #\a))  ; p_c set_p_p_f
(let () (define (f1) (let ((y #\b) (z 0)) (do ((i 0 (+ i 1))) ((= i 3) z) (set! z (char->integer y))))) (test (f1) 98))  ; p_s i_p_f set_i_i_f
(let () (define (f1) (let ((y #\b) (z 98)) (do ((i 0 (+ i 1))) ((= i 3) y) (set! y (integer->char z))))) (test (f1) #\b))  ; p_p_s
(let () (define (f1) (let ((y (list 2)) (z '(1))) (do ((i 0 (+ i 1))) ((= i 3) y) (list-set! y 0 (car z))))) (test (f1) '(1)))  ; i_c p_pip_sff
(let () (define (f1) (let ((y (list 2)) (z 0)) (do ((i 0 (+ i 1))) ((= i 3) y) (list-set! y z (car '(1)))))) (test (f1) '(1)))  ; p_pip_ssf
(let () (define (f1) (let ((y 2) (z 0) (x '(1))) (do ((i 0 (+ i 1))) ((= i 3) x) (set! x (list y z))))) (test (f1) '(2 0)))  ; p_cf_ss
(let () (define (f1) (let ((y 2) (z 0) (x '(1))) (do ((i 0 (+ i 1))) ((= i 3) x) (set! x (list 0 0))))) (test (f1) '(0 0)))  ; p_cf_ff
(let () (define (f1) (let ((y 2) (z 0) (x '(1))) (do ((i 0 (+ i 1))) ((= i 3) x) (set! x (list y 0))))) (test (f1) '(2 0)))  ; p_cf_sf
(let () (define (f1) (let ((y 2) (z 0) (x '(1))) (do ((i 0 (+ i 1))) ((= i 3) x) (set! x (list 2 z))))) (test (f1) '(2 0)))  ; p_cf_fs

(let () (define (f1) (let ((y 0) (z 1.1)) (do ((i 0 (+ i 1))) ((= i 3) y) (if (not (= (floor z) 1)) (display "oops"))))) (test (f1) 0)) ; b_ii_fc p_p_c if_nbp
(let () (define (f1) (let ((y 0) (z 1.1)) (do ((i 0 (+ i 1))) ((= i 3) y) (if (not (= (+ z z) 2.2)) (display (+ z z)))))) (test (f1) 0)) ; p_p_f b_dd_fc d_dd_ss p_pp_ss
(let () (define (f1) (let ((y 0) (z 1.1)) (do ((i 0 (+ i 1))) ((= i 3) y) (if (= (+ z 1) 2.2) (display (+ z 1)))))) (test (f1) 0)) ; if_bp p_pp_sc d_dd_sc
(let () (define (f1) (let ((y 0) (z 1.1)) (do ((i 0 (+ i 1))) ((= i 3) y) (when (= (+ 1 z) z) (display (+ 1 z)))))) (test (f1) 0)) ; when_p p_pp_cs b_dd_fs
(let () (define (f1) (let ((y 0) (z 1.1)) (do ((i 0 (+ i 1))) ((= i 3) y) (unless (= (+ z z 1) 3.2) (display (+ z z 1)))))) (test (f1) 0)) ; unless_p p_cf_ppp d_ddd_ssf
(let () (define (f1) (let ((y 0) (z 1.1)) (do ((i 0 (+ i 1))) ((= i 3) y) (cond ((= (+ z (- y)) 2.1) (display (+ z (- y)))))))) (test (f1) 0)) ; cond p_cf_s p_pp_sf

;;; check an optimizer bug
(define _do_call_cc_end_ 1)
(define (call-cc-do-test)
  (do ((i 0 (+ i 1)))
      ((= i _do_call_cc_end_))
    (let ((ctr 0)) 
      (call/cc (lambda (exit) 
		 (if (> 3 2) 
		     (let () 
		       (exit ctr) 
		       (set! ctr 100) ctr) 
		     #f)))))
  (do ((i 0 (+ 1 i)))
      ((= i _do_call_cc_end_))
    (let ((ctr 0)) 
      (call/cc (lambda (exit) 
		 (if (> 3 2) 
		     (let () 
		       (exit ctr) 
		       (set! ctr 100) ctr) 
		     #f))))))

(call-cc-do-test)

;;; and another
(let()
  (define (hi)
    (let ((checker (lambda (nlst v)
		     (let ((chr (car nlst)))
		       (if (not (char-alphabetic? chr))
			   (if (not (char=? v chr))
			       (format #t ";(char-downcase #\\~A) -> ~A" chr v))
			   (if (and (not (char=? chr v))
				    (not (char=? chr (char-upcase v))))
			       (format #t ";(char-downcase #\\~A) -> ~A~%" chr v))))))
	  (result 0))
      (let ((try 0))
	(do ((i 0 (+ i 1)))
	    ((> i 10))
	  (set! try i)
	  (checker '(#\a) #\a)
	  (checker '(#\a) #\a)))))
  (test (hi) #t))


(define (__a-func__ a)
  (format #t ";oops called first a-func by mistake: ~A~%" a)
  (if (> a 0)
      (__a-func__ (- a 1))))

(define (__a-func__ a)
  (if (> a 0)
      (__a-func__ (- a 1))))

(__a-func__ 3)

(define (__c-func__ a)
  (format #t ";oops called first __c-func__ by mistake: ~A~%" a)
  (if (> a 0)
      (__c-func__ (- a 1))))
  
(let ()
  (define (__c-func__ a)
    (if (> a 0)
	(__c-func__ (- a 1))))
  
  (__c-func__ 3))

;;; more optimizer checks
(let () 
  (define (do-test-1) (do ((i 0 (+ i 1))) ((= i 10)) (display i)))
  (test (with-output-to-string (lambda () (do-test-1))) "0123456789"))

(let () 
  (define (do-test-2) (do ((i 0 (+ 1 i))) ((= i 10)) (display i))) 
  (test (with-output-to-string (lambda () (do-test-2))) "0123456789"))

(let ((start 0)) 
  (define (do-test-3) (do ((i start (+ i 1))) ((= i 10)) (display i))) 
  (test (with-output-to-string (lambda () (do-test-3))) "0123456789"))

(let ((start 0) (end 10)) 
  (define (do-test-4) (do ((i start (+ i 1))) ((= i end)) (display i))) 
  (test (with-output-to-string (lambda () (do-test-4))) "0123456789"))

(let ((start 0) (end 10)) 
  (define (do-test-5) (do ((i start (+ i 1))) ((= end i)) (display i))) 
  (test (with-output-to-string (lambda () (do-test-5))) "0123456789"))

(let () 
  (define (do-test-6) (do ((i 0 (+ i 1))) ((= i 10)) (let ((k i)) (display k)))) 
  (test (with-output-to-string (lambda () (do-test-6))) "0123456789"))

(let () 
  (define (do-test-7) (do ((i 0 (+ i 2))) ((= i 20)) (display (/ i 2)))) 
  (test (with-output-to-string (lambda () (do-test-7))) "0123456789"))

(let () 
  (define (do-test-8) (do ((i 0 (+ i 1))) ((= i 10)) (let ((a (+ 1 2))) (display #\0)))) 
  (test (with-output-to-string (lambda () (do-test-8))) "0000000000"))

(let () 
  (define (do-test-9) (do ((i 0 (+ i 1))) ((= i 10)) (let ((j 0)) (set! j i) (display j)))) 
  (test (with-output-to-string (lambda () (do-test-9))) "0123456789"))

(let () 
  (define (do-test-10) (do ((i 0 (+ i 1))) ((= i 10)) (let ((j 0)) (display i)))) 
  (test (with-output-to-string (lambda () (do-test-10))) "0123456789"))

(let () 
  (define (do-test-11) (do ((i 0 (+ i 1))) ((= i 10)) (let ((j 0)) (set! j 32) (display i)))) 
  (test (with-output-to-string (lambda () (do-test-11))) "0123456789"))

(let ()
  (define (do-test-12) (do ((i 0 (+ i 1))) ((= i 10)) (let ((j i)) (display j)))) 
  (test (with-output-to-string (lambda () (do-test-12))) "0123456789"))

(let () 
  (define (do-test-13) (do ((i 0 (+ i 1))) ((= i 5)) (let ((j (+ i 1))) (let ((i j)) (display (- i 1)))))) 
  (test (with-output-to-string (lambda () (do-test-13))) "01234"))

(let () 
  (define (do-test-14) (do ((i 0 (+ i 1))) ((= i 10)) (set! i (+ i 1)) (display i))) 
  (test (with-output-to-string (lambda () (do-test-14))) "13579"))

(let ((lst ()))
  (define (do-test-15) (set! lst ()) (do ((i 0 (+ i 1))) ((= i 10)) (set! lst (cons i lst))) lst) 
  (test (do-test-15) '(9 8 7 6 5 4 3 2 1 0)))

(let ((lst ()))
  (define (do-test-15a) (set! lst ()) (do ((i 0 (+ i 1))) ((= i 10)) (set! lst (append (list i) lst))) lst) 
  (test (do-test-15a) '(9 8 7 6 5 4 3 2 1 0)))

(let ((lst (list 9 8 7 6 5 4 3 2 1 0))) 
  (define (do-test-16) (do ((i 0 (+ i 1))) ((= i 10)) (list-set! lst i i)) lst) 
  (test (do-test-16) '(0 1 2 3 4 5 6 7 8 9)))

(let ((lst ())) 
  (define (do-test-17) (set! lst ()) (do ((i 0 (+ i 1))) ((= i 10)) (let ((j i)) (set! lst (cons j lst)))) lst) 
  (test (do-test-17) '(9 8 7 6 5 4 3 2 1 0)))

(let ((lst ())) 
  (define (do-test-17a) (set! lst ()) (do ((i 0 (+ i 1))) ((= i 10)) (let ((j (min i 100))) (set! lst (cons j lst)))) lst) 
  (test (do-test-17a) '(9 8 7 6 5 4 3 2 1 0)))

(let () 
  (define (do-test-18) (do ((i 0 (+ i 1)) (j 0)) ((= i 10) j) (if (= i 3) (set! j i))))
  (test (do-test-18) 3))

(let ((end 10)) 
  (define (do-test-19) (do ((i 0 (+ i 1))) ((= i end)) (display i))) 
  (test (with-output-to-string (lambda () (do-test-19))) "0123456789"))

(let ((end 10)) 
  (define (do-test-19A) (do ((i 0 (+ 1 i))) ((= end i)) (display i))) 
  (test (with-output-to-string (lambda () (do-test-19A))) "0123456789"))

(let ((end 10)) 
  (define (do-test-20) (do ((i 0 (+ i 1))) ((= i end)) (set! end 8) (display i))) 
  (test (with-output-to-string (lambda () (do-test-20))) "01234567"))

(let ((end 10)) 
  (define (do-test-20A) (do ((i 0 (+ 1 i))) ((= end i)) (set! end 8) (display i))) 
  (test (with-output-to-string (lambda () (do-test-20A))) "01234567"))

(let () 
  (define (do-test-21) (do ((i 0 (+ i 1))) ((= i 3)) (with-let (rootlet) (+ 1 2)))) 
  (do-test-21))

(let ((v (vector 0 0 0))) 
  (define (hi a) (do ((i 0 (+ i 1))) ((> i a)) (vector-set! v i 1))) (hi 2) 
  (test v (vector 1 1 1)))

(let () ; dotimes_c_c case can't involve set so we use write-char
  (define (hi a) 
    (do ((i 0 (+ i 1))) 
	((= i a)) 
      (write-char #\a))) 
  (with-output-to-file tmp-output-file 
    (lambda () 
      (hi 3)))
  (let ((str (with-input-from-file tmp-output-file 
	       (lambda () 
		 (read-line)))))
    (test str "aaa")))

(let ()
  (define (do-test-22) (do ((i 0 (+ i 1))) ((= i 10)) (display i)))
  (test (with-output-to-string (lambda () (do-test-22))) "0123456789"))

(let ((v (make-list 10)))
  (define (do-test-23) (do ((i 0 (+ i 1))) ((= i 10)) (list-set! v i i)))
  (do-test-23) 
  (test v '(0 1 2 3 4 5 6 7 8 9)))

;;; safe simple h_safe_c_s
(let ()
  (define (do-test-24) (do ((i 0 (+ i 1))) ((> i 10)) (display i)))
  (test (with-output-to-string (lambda () (do-test-24))) "012345678910"))

;;; safe simple h_safe_c_ss
(let ()
  (define (do-test-25 p) (do ((i 0 (+ i 1))) ((> i 10)) (display i p)))
  (test (call-with-output-string (lambda (p) (do-test-25 p))) "012345678910"))

;;; safe simple h_safe_c_c
(let ()
  (define (do-test-26) (do ((i 0 (+ i 1))) ((> i 10)) (display 0)))
  (test (with-output-to-string (lambda () (do-test-26))) "00000000000"))

;;; safe simple h_safe_c_opsq_s
(let ()
  (define (do-test-27 p) (do ((i 0 (+ i 1))) ((> i 10)) (display (- i) p)))
  (test (call-with-output-string (lambda (p) (do-test-27 p))) "0-1-2-3-4-5-6-7-8-9-10"))

(let ()
  (define (do-test-22 i o) (catch #t (lambda () (do () () (write-char (read-char i) o))) (lambda err (get-output-string o))))
  (test (call-with-output-string (lambda (out) (call-with-input-string "0123" (lambda (in) (do-test-22 in out))))) "0123"))





;;; --------------------------------------------------------------------------------
;;; set!
;;; --------------------------------------------------------------------------------

(test (let ((a 1)) (set! a 2) a) 2)
(for-each
 (lambda (arg)
   (test (let ((a 0)) (set! a arg) a) arg))
 (list "hi" -1 #\a 1 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #f #t (list 1 2 3) '(1 . 2)))

(test (let ((a 1)) (call/cc (lambda (r) (set! a (let () (if (= a 1) (r 123)) 321)))) a) 1)
(test (let ((a (lambda (b) (+ b 1)))) (set! a (lambda (b) (+ b 2))) (a 3)) 5)
(test (let ((a (lambda (x) (set! x 3) x))) (a 1)) 3)

(test (let ((x (vector 1 2 3))) (set! (x 1) 32) x) #(1 32 3))
(test (let* ((x (vector 1 2 3))
	     (y (lambda () x)))
	(set! ((y) 1) 32)
	x)
      #(1 32 3))
(test (let* ((x (vector 1 2 3))
	     (y (lambda () x))
	     (z (lambda () y)))
	(set! (((z)) 1) 32)
	x)
      #(1 32 3))

(test (let ((a 1)) (set! a)) 'error)
(test (let ((a 1)) (set! a 2 3)) 'error)
(test (let ((a 1)) (set! a . 2)) 'error)
(test (let ((a 1)) (set! a 1 . 2)) 'error)
(test (let ((a 1)) (set! a a) a) 1)
(test (set! "hi" 1) 'error)
(test (set! 'a 1) 'error)
(test (set! 1 1) 'error)
(test (set! (list 1 2) 1) 'error)
(test (set! (let () 'a) 1) 'error)
(test (set!) 'error)
(test (set! #t #f) 'error)
(test (set! () #f) 'error)
(test (set! #(1 2 3) 1) 'error)
(test (set! (call/cc (lambda (a) a)) #f) 'error)
(test (set! 3 1) 'error)
(test (set! 3/4 1) 'error)
(test (set! 3.14 1) 'error)
(test (set! #\a 12) 'error)
(test (set! (1 2) #t) 'error)
(test (set! _not_a_var_ 1) 'error)
(test (set! (_not_a_pws_) 1) 'error)
(test (let ((x 1)) (set! ((lambda () 'x)) 3) x) 'error)
(test (let ((x '(1 2 3))) (set! (((lambda () 'x)) 0) 3) x) '(3 2 3))
(test (let ((x '(1 2 3))) (set! (((lambda () x)) 0) 3) x) '(3 2 3)) ; ?? 
(test (let ((x '(1 2 3))) (set! ('x 0) 3) x) '(3 2 3)) ; ???  I suppose that's similar to
(test (let ((x '((1 2 3)))) (set! ((car x) 0) 3) x) '((3 2 3)))
(test (let ((x '((1 2 3)))) (set! ('(1 2 3) 0) 32) x) '((1 2 3))) ; this still looks wrong... (expands to (list-set! '(1 2 3) 0 3) I guess)

(test (let ((a (lambda (x) (set! a 3) x))) (list (a 1) a)) 'error)
(test (let ((a (let ((b 1)) (set! a 3) b))) a) 'error)            
(test (let ((a (lambda () "hi"))) (set! (a) "ho")) 'error)
(test (let ((a (let ((b 1)) (set! a 3) b))) a) 'error) 

(let ((__asdf__ #f)) (set! __asdf__ if) (set! __asdf__ 3) (test __asdf__ 3)) ; make sure this doesn't get locked

(test (set! . -1) 'error)
(test (set!) 'error)
(test (let ((x 1)) (set! x x x)) 'error)
(test (let ((x 1)) (set! x x) x) 1)
(test (set! set! 123) 'error)
(test (set! (cons 1 2) 3) 'error)
(test (let ((var 1) (val 2)) (set! var set!) (var val 3) val) 3)
(test (let ((var 1) (val 2)) (set! var +) (var val 3)) 5)
(test (let ((sym0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 1)
	    (sym0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456780 3))
	(set! sym0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 2)
	sym0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789)
      2)

(test (let ((x '(1)) (y '(2))) (set! ((if #t x y) 0) 32) x) '(32))
(test (let ((hi 0)) (set! hi 32)) 32)
(test (let ((hi 0)) ((set! hi ('((1 2) (3 4)) 0)) 0)) 1)

(test (set! #<undefined> 1) 'error)
(test (set! #<eof> 1) 'error)
(test (set! #<unspecified> 1) 'error)
(test (let ((x 0)) (define-macro (hi) 'x) (set! (hi) 3) x) 'error)

(test (set! ("hi" . 1) #\a) 'error)
(test (set! (#(1 2) . 1) 0) 'error)
(test (set! ((1 . 2)) 3) 'error)
(test (let ((lst (list 1 2))) (set! (lst . 0) 3) lst) 'error)
(test (let ((lst (list 1 2))) (set! (list-ref lst . 1) 2)) 'error)
(test (let ((v #2d((1 2) (3 4)))) (set! (v 0 . 0) 2) v) 'error)
(test (set! ('(1 2) . 0) 1) 'error)
(test (set! ('(1 2) 0) 3) 3)
(test (set! (''(1 . 2)) 3) 'error)
(test (set! (''(1 2)) 3) 'error)
(test (set! ('(1 . 2)) 3) 'error)
(test (set! ('(1 2)) 3) 'error)
(test (set! (''(1 2) 0 0) 3) 'error)
(test (set! (#(1 2) 0 0) 3) 'error)
(test (let ((x 1)) (set! (quasiquote . x) 2) x) 'error)
(test (let ((x 1)) (set! (quasiquote x) 2) x) 'error)
(test (set! `,(1) 3) 'error)
(test (set! (1) 3) 'error)
(test (set! `,@(1) 3) 'error)
(test (let ((x 0)) (set! x 1 . 2)) 'error)
(test (let ((x 0)) (apply set! x '(3))) 'error) ; ;set!: can't alter immutable object: 0
(test (let ((x 0)) (apply set! 'x '(3)) x) 3)
(test (set! (#(a 0 (3)) 1) 0) 0)
(test (set! ('(a 0) 1) 0) 0)
(test (apply set! (apply list (list ''(1 2 3) 1)) '(32)) 32)
(test (set! (let ((x 1)) x) 3) 'error)
(test (set! (lambda () 1) 4) 'error)
(test (set! (with-baffle (display x)) 5) 'error)
(test (set! (define x 3) 6) 'error)

(let ()
  (define-macro (symbol-set! var val) `(apply set! ,var (list ,val))) ; but this evals twice
  (test (let ((x 32) (y 'x)) (symbol-set! y 123) (list x y)) '(123 x)))
(let ()
  (define-macro (symbol-set! var val) ; like CL's set
    `(apply set! ,var ',val ()))
  (test (let ((var '(+ 1 2)) (val 'var)) (symbol-set! val 3) (list var val)) '(3 var))
  (test (let ((var '(+ 1 2)) (val 'var)) (symbol-set! val '(+ 1 3)) (list var val)) '((+ 1 3) var)))

(test (set! ('(1 2) 1 . 2) 1) 'error)
(test (set! ('((1 2) 1) () . 1) 1) 'error)
(test (set! ('(1 1) () . 1) 1) 'error)

(test (let () (define (hi) (let ((x 1000)) (set! x (+ x 1)) x)) (hi) (hi)) 1001)
(test (let () (define (hi) (let ((x 1000.5)) (set! x (+ x 1)) x)) (hi) (hi)) 1001.5)
(test (let () (define (hi) (let ((x 3/2)) (set! x (+ x 1)) x)) (hi) (hi)) 5/2)
(test (let () (define (hi) (let ((x 3/2)) (set! x (- x 1)) x)) (hi) (hi)) 1/2)
(test (let () (define (hi) (let ((x 3/2)) (set! x (- x 2)) x)) (hi) (hi)) -1/2)
(test (let () (define (hi) (let ((x "asdf")) (set! x (+ x 1)) x)) (hi) (hi)) 'error)

(let ()
  ;; check an optimizer bug
  (define (bad-increment a b)
    (cons a b))

  (define (use-bad-increment b)
    (let ((x ()))
      (set! x (bad-increment x b))
      x))

  (use-bad-increment 1)
  (use-bad-increment 1)
  (use-bad-increment 1))

(when with-block
  (let ((b (block 0.0 1.0)))
    (define (f) (do ((i 0 (+ i 1))) ((= i 2)) (set! (b i) 3.0)))
    (set! (b 0) 2.0)
    (test b (block 2.0 1.0))
    (test (b 0) 2.0)
    (f)
    (test b (block 3.0 3.0))
    (immutable! b)
    (test (set! (b 0) 4.0) 'error)
    (test (f) 'error)))



;;; --------------------------------------------------------------------------------
;;; or
;;; --------------------------------------------------------------------------------

(test (or (= 2 2) (> 2 1)) #t)
(test (or (= 2 2) (< 2 1)) #t)
(test (or #f #f #f) #f)
(test (or) #f)
(test (or (memq 'b '(a b c)) (+ 3 0)) '(b c))
(test (or 3 9) 3)
(test (or #f 3 asdf) 3) ; "evaluation stops immediately"
(test (or 3 (/ 1 0) (display "or is about to exit!") (exit)) 3)

(for-each
 (lambda (arg)
   (test (or arg) arg)
   (test (or #f arg) arg)
   (test (or arg (error 'test-error "oops or ")) arg))
 (list "hi" -1 #\a 1 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #t (list 1 2 3) #<eof> #<unspecified> '(1 . 2)))

(test (call-with-input-file "s7test.scm"
	(lambda (p)
	  (let ((loc 0))
	    (let loop ((val (read-char p)))
	      (or (eof-object? val)
		  (> loc 1000) ; try to avoid the read-error stuff
		  (begin
		    (set! loc (+ loc 1))
		    (loop (read-char p)))))
	    (> loc 1000))))
      #t)

(test (or (and (or (> 3 2) (> 3 4)) (> 2 3)) 4) 4)
(test (or or) or)
(test (or (or (or))) #f)
(test (or (or (or) (and))) #t)
(test (let ((a 1)) (or (let () (set! a 2) #f) (= a 1) (let () (set! a 3) #f) (and (= a 3) a) (let () (set! a 4) #f) a)) 3)
(test (or '#f ()) ())
(test (call/cc (lambda (r) (or #f (> 3 2) (r 123) 321))) #t)
(test (call/cc (lambda (r) (or #f (< 3 2) (r 123) 321))) 123)
(test (+ (or #f (not (null? ())) 3) (or (zero? 1) 2)) 5)
(test (or 0) 0)
(test (if (or) 1 2) 2)

(test (or . 1) 'error)
(test (or #f . 1) 'error)
(test (or . (1 2)) 1)
(test (or . ()) (or))
; (test (or 1 . 2) 1) ; this fluctuates

(test (let () (or (define (hi a) a)) (hi 1)) 1)
(test (let () (or #t (define (hi a) a)) (hi 1)) 'error)
(test (let () (and (define (hi a) a) (define (hi a) (+ a 1))) (hi 1)) 2) ; guile agrees with this
(test ((lambda (arg) (arg #f 123)) or) 123)
(test (let ((oar or)) (oar #f 43)) 43)
(test (let ((oar #f)) (set! oar or) (oar #f #f 123)) 123)
(test (member 1 (list 2 3) (lambda (a b) (negative? (or (call/cc (lambda (return) (let ((x 1) (y 2)) (return x y)))) (string->keyword))))) #f)



;;; --------------------------------------------------------------------------------
;;; and
;;; --------------------------------------------------------------------------------

(test (and (= 2 2) (> 2 1)) #t)
(test (and (= 2 2) (< 2 1)) #f)
(test (and 1 2 'c '(f g)) '(f g))
(test (and) #t)
(test (and . ()) (and))
(test (and 3) 3)
(test (and (memq 'b '(a b c)) (+ 3 0)) 3)
(test (and 3 9) 9)
(test (and #f 3 asdf) #f) ; "evaluation stops immediately"
(test (and 3 (zero? 1) (/ 1 0) (display "and is about to exit!") (exit)) #f)
(test (if (and) 1 2) 1)
(test (if (+) 1 2) 1)
(test (if (*) 1 2) 1)
(test (and (if #f #f)) (if #f #f))
(test (let ((x '(1))) (eq? (and x) x)) #t)

(for-each
 (lambda (arg)
   (test (and arg) arg)
   (test (and #t arg) arg)
   (test (and arg #t) #t))
 (list "hi" -1 #\a 1 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #t (list 1 2 3) '(1 . 2)))

(test (call-with-input-file "s7test.scm"
	(lambda (p)
	  (let ((loc 0))
	    (let loop ((val (read-char p)))
	      (and (not (eof-object? val))
		   (< loc 1000)
		   (begin
		     (set! loc (+ loc 1))
		     (loop (read-char p)))))
	    (>= loc 1000))))
      #t)

(test (and (or (and (> 3 2) (> 3 4)) (> 2 3)) 4) #f)
(test (and and) and)
(test (and (and (and))) #t)
(test (and (and (and (and (or))))) #f)
(test (let ((a 1)) (and (let () (set! a 2) #t) (= a 1) (let () (set! a 3) #f) (and (= a 3) a) (let () (set! a 4) #f) a)) #f)
(test (and '#t ()) ())
(test (call/cc (lambda (r) (and #t (> 3 2) (r 123) 321))) 123)
(test (call/cc (lambda (r) (and #t (< 3 2) (r 123) 321))) #f)
(test (+ (and (null? ()) 3) (and (zero? 0) 2)) 5)

(test (and . #t) 'error)
(test (and 1 . 2) 'error)
(test (and . (1 2)) 2)

(test (let () (and (define (hi a) a)) (hi 1)) 1)
(test (let () (and #f (define (hi a) a)) (hi 1)) 'error)
(test (+ 1 (and (define (hi a) a) (hi 2))) 3)

;;; from some net site 
(let ()
  (define (fold fn accum list)
    (if (null? list)
	accum
	(fold fn
	      (fn accum
		  (car list))
	      (cdr list))))
  (test (fold and #t '(#t #f #t #t)) #f))

(test (let ((and! and)) (and! #f (error 'test-error "oops"))) #f)
(test (let ((and! #f)) (set! and! and) (and! #f (error 'test-error "oops"))) #f)
(test (let () (define (try and!) (and! #f (error 'test-error "oops"))) (try and)) #f)

;;; here are some tests from S. Lewis in the r7rs mailing list
(let ()
  (define myand and)
  (test (myand #t (+ 1 2 3)) 6)
  (define (return-op) and)
  (define myop (return-op))
  (test (myop #t (+ 1 2 3)) 6)
  (test (and #t (+ 1 2 3)) 6)
  (test ((return-op) #t (+ 1 2 3)) 6)
  (test ((and and) #t (+ 1 2 3)) 6)
  (define ops `(,* ,and))
  (test ((car ops) 2 3) 6)
  (test ((cadr ops) #t #f) #f)
  (test (and #f never) #f)
  (test (and #f and) #f)
  (test ((and #t and) #t (+ 1 2 3)) 6))





;;; --------------------------------------------------------------------------------
;;; cond
;;; --------------------------------------------------------------------------------

(test (cond ('a)) 'a)
(test (cond (3)) 3)
(test (cond (#f 'a) ('b)) 'b)
(test (cond (#t 'a) (#t 'b)) 'a)
(test (cond ((> 3 2) 'greater) ((< 3 2) 'less)) 'greater)
(test (cond((> 3 2)'greater)((< 3 2)'less)) 'greater)
(test (cond ((> 3 3) 'greater) ((< 3 3) 'less)  (else 'equal)) 'equal)
(test (cond ((assv 'b '((a 1) (b 2))) => cadr)  (else #f)) 2)
(test (cond (#f 2) (else 5)) 5)
(test (cond (1 2) (else 5)) 2)
(test (cond (1 => (lambda (x) (+ x 2))) (else 8)) 3)
(test (cond ((+ 1 2))) 3)
(test (cond ((zero? 1) 123) ((= 1 1) 321)) 321)
(test (cond ('() 1)) 1)
(test (let ((x 1)) (cond ((= 1 2) 3) (else (* x 2) (+ x 3)))) 4)
(test (let((x 1))(cond((= 1 2)3)(else(* x 2)(+ x 3)))) 4)
(test (let ((x 1)) (cond ((= x 1) (* x 2) (+ x 3)) (else 32))) 4)
(test (let ((x 1)) (cond ((= x 1) (let () (set! x (* x 2))) (+ x 3)) (else 32))) 5)
(test (let ((x 1)) (cond ((= x 2) (let () (set! x (* x 2))) (+ x 3)) (else 32))) 32)
(test (let ((x 1)) (cond ((= x 2) 3) (else (let () (set! x (* x 2))) (+ x 3)))) 5)
(test (cond ((= 1 2) 3) (else 4) (else 5)) 4) ; this should probably be an error
(test (cond (1 2 3)) 3)
(test (cond (1 2) (3 4)) 2)
(test (cond ((= 1 2) 3) ((+ 3 4))) 7)
(test (cond ((= 1 1) (abs -1) (+ 2 3) (* 10 2)) (else 123)) 20)
(test (let ((a 1)) (cond ((= a 1) (set! a 2) (+ a 3)))) 5)
(test (let ((a 1)) (cond ((= a 2) (+ a 2)) (else (set! a 3) (+ a 3)))) 6)
(test (cond ((= 1 1))) #t)
(test (cond ((= 1 2) #f) (#t)) #t)
(test (cond ((+ 1 2))) 3)
(test (cond ((cons 1 2))) '(1 . 2))
(test (cond (#f #t) ((string-append "hi" "ho"))) "hiho")
(test (cond ('() 3) (#t 4)) 3)
(test (cond ((list) 3) (#t 4)) 3)
;;; (cond (1 1) (asdf 3)) -- should this be an error?
(test (cond (+ 0)) 0)
(test (cond (lambda ())) ())
(test (cond . ((1 2) ((3 4)))) 2)
(test (cond (define #f)) #f)
(test (let () (cond ((> 2 1) (define x 32) x) (#t 1)) x) 32) ; ? a bit strange
(test (let ((x 1)) (+ x (cond ((> x 0) (define x 32) x)) x)) 65)
(test (cond (("hi" 1))) #\i)
(test (cond (()())) ())
(test (let ((a 0)) (let ((b (lambda () (set! a 1) #f))) (cond ((> a 0) 3) ((b) 4) ((> a 0) 5) (#t 6)))) 5)
(test (let ((a #t)) (let ((b (lambda () (set! a (not a)) a))) (cond ((b) 1) ((b) 2) (t 3)))) 2)
(test (let ((otherwise else)) (cond ((= 1 2) 1) (otherwise 3))) 3)
(test (let ((otherwise #t)) (cond ((= 1 2) 1) (otherwise 3))) 3) ; or actually anything... 12 for example
(test (let ((else #f)) (cond ((= 1 2) 1) (else 3))) #<unspecified>) ; was () -- 31-Dec-15
;(test (let ((else #f)) (cond ((= 1 2) 1) (#_else 3))) 3) ; currently returns #<unspecified>
(test (let ((else 1)) (let ((otherwise else)) (case 0 (otherwise 1)))) 'error)
(test (let ((x 1)) (cond ((< x 0) 1))) #<unspecified>)

(for-each
 (lambda (arg)
   (test (cond ((or arg) => (lambda (x) x))) arg))
 (list "hi" -1 #\a 1 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #t (list 1 2 3) '(1 . 2)))

(test (cond ((+ 1 2) => (lambda (x) (+ 1 x)))) 4)
(test (cond ((cons 1 2) => car)) 1)
(test (cond ((values 1 2) => +)) 3)
(test (cond (1 2 => +)) 'error)
(test (cond ((begin 1 2) => +)) 2)
(test (cond ((values -1) => abs)) 1)
(test (cond ((= 1 2) => +) (#t => not)) #f)
(test (cond ((* 2 3) => (let () -))) -6)
(test (cond ((* 2 3) => (cond ((+ 3 4) => (lambda (a) (lambda (b) (+ b a))))))) 13)
(test (let ((x 1)) ((cond ((let () (set! x 2) #f) => boolean?) (lambda => (lambda (a) (apply a '((b) (+ b 123)))))) x)) 125)
(test (cond ((values 1 2 3) => '(1 (2 3 (4 5 6 7 8))))) 7)
(test (cond ((values 1 2 3) => +)) 6)
(test (cond ((values #f #f) => equal?)) #t) ; (values #f #f) is not #f
(test (let () (cond (#t (define (hi a) a))) (hi 1)) 1)
(test (let () (cond (#f (define (hi a) a))) (hi 1)) 'error)
(test (let () (cond ((define (hi a) a) (hi 1)))) 1)
(test (cond ((assq 'x '((x . 1) (y . 0))) => abs (display 'oops)) (else #f)) 'error)

(test (cond (else 1)) 1)
(test (call/cc (lambda (r) (cond ((r 4) 3) (else 1)))) 4)
(test (cond ((cond (#t 1)))) 1)
(test (symbol? (cond (else else))) #t)
(test (equal? else (cond (else else))) #t)
(test (cond (#f 2) ((cond (else else)) 1)) 1)
(test (let ((x #f) (y #t)) (cond (x 1) (y 2))) 2)
(test (cond ((- 3 2)) ((< 2 3))) (or (- 3 2) (< 3 2))) ; (cond (e) ...)) is the same as (or e ...)

(for-each
 (lambda (arg)
   (test (cond (#t arg)) arg))
 (list "hi" -1 #\a 1 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #t (list 1 2 3) '(1 . 2)))

(for-each
 (lambda (arg)
   (test (cond (arg)) arg))
 (list "hi" -1 #\a 1 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #t (list 1 2 3) '(1 . 2)))

(for-each
 (lambda (arg)
   (test (cond (#f 1) (else arg)) arg))
 (list "hi" -1 #\a 1 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #t (list 1 2 3) '(1 . 2)))

(for-each
 (lambda (arg)
   (test (cond (arg => (lambda (x) x))) arg))
 (list "hi" -1 #\a 1 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #t (list 1 2 3) '(1 . 2)))

(test (cond ((let () 1) => (let ((x 2)) (lambda (n) (+ n x))))) 3)
(test (cond ((let () 1) => (let ((x 2)) (cond (3 => (let ((y 4)) (lambda (n) (lambda (m) (+ n m x y))))))))) 10)

(test (let ((=> 3)) (cond (=> =>))) 3)
(test (cond (cond 'cond)) 'cond)
(test (cond (3 => (lambda args (car args)))) 3)
(test (cond (3 => (lambda (a . b) a))) 3)
(test (cond ((list 3 4) => (lambda (a . b) b))) ())
(test (cond) 'error)
(test (let () (define-macro (mac x) `(+ ,x 1)) (cond (1 => mac))) 2)
					;(test (cond ((= 1 2) 3) (else 4) (4 5)) 'error) ; trailing ignored 
(test (cond ((+ 1 2) => (lambda (a b) (+ a b)))) 'error)
(test (equal? (cond (else)) else) #t)
(test (cond (#t => 'ok)) 'error)
(test (cond (else =>)) 'error)
(test (cond ((values -1) => => abs)) 'error)
(test (cond ((values -1) =>)) 'error)
(test (cond (cond (#t 1))) 'error)
(test (cond 1) 'error)
(test (cond) 'error)
(test (cond (1 . 2) (else 3)) 'error)
(test (cond (#f 2) (else . 4)) 'error)
(test (cond ((values 1 2) => (lambda (x y) #t))) #t)
(test (cond #t) 'error)
(test (cond 1 2) 'error)
(test (cond 1 2 3) 'error)
(test (cond 1 2 3 4) 'error)
(test (cond (1 => (lambda (x y) #t))) 'error)
(test (cond . 1) 'error)
(test (cond ((1 2)) . 3) 'error)
(test (cond (1 => + abs)) 'error)
(test (cond (1 =>)) 'error)
(test (cond ((values 1 2) => + abs)) 'error)
(test (cond (else => symbol?)) #t) ; (symbol? else) -> #t
(test (eq? (cond (else => or)) else) #t)
(test (cond ((values #f 1) => or)) 1)
(test (+ (cond ((values 1 2 3)))) 6)
(test (let ((else 3)) (cond ((= else 3) 32) (#t 1))) 32)
(test (let ((else #f)) (cond (else 32) (#t 1))) 1)
(test (cond #((1 2))) 'error)
(test (cond (/ 0)) 0) ; / is not #f, so return 0
(test (cond (string-ref 2)) 2) 

(test (let ((=> 3)) (cond (1 =>))) 3)
(test (let ((=> 3)) (cond (1 => abs))) abs)
(test (let ((=> 3) (else 4)) (cond (else => abs))) abs)
(test (let ((=> 3)) (cond (1 => "hi"))) "hi")

(test (let ((=> 3)) (cond (12 => abs) (else #f))) abs)              ; guile/chicken/chibi agree
(test (let ((else #f)) (cond ((< 2 1) 3) (else 4))) #<unspecified>) ;  same 
(test (let ((=> 3)) (case => ((3) => abs) (else #f))) abs)
(test (let ((else #f)) (case 3 ((2 1) 3) (else 4))) 4)              ; chibi says #f (its choice for the unspecified value), Guile 4, chicken error
(test (let ((else #f)) (cond ((< 2 1) 1) (else 3) (#t 4))) 4)       ; ! (same for chibi)
;; to run chibi repl, goto /home/bil/test/chibi-scheme-master, setenv LD_LIBRARY_PATH /home/bil/test/chibi-scheme-master, chibi-scheme
;; to run chicken, goto /home/bil/test/chicken-4.7.0.6/, csi

(test (let ((x 0))
	(cond ((let ((y x)) (set! x 1) (= y 1)) 0)
	      ((let ((y x)) (set! x 1) (= y 1)) 1)
	      (#t 2)))
      1)

(test (cond 
       ((cond 
          ((cond ((assoc 'x '((x 1 2 3))) => cdr)
                 (else #f))
            => apply-values) ; ouch!
          (else #f))
         => +)
       (else #f))
      6)

(let ((c1 #f)
      (x 1))
  (let ((y (cond ((let ()
		    (call/cc
		     (lambda (r)
		       (set! c1 r)
		       (r x))))
		  => (lambda (n) (+ n 3)))
		 (#t 123))))
    (if (= y 4) (begin (set! x 2) (c1 321)))
    (test (list x y) '(2 324))))

(let ((c1 #f)
      (x 1))
  (let ((y (cond (x => (lambda (n) 
			 (call/cc
			  (lambda (r)
			    (set! c1 r)
			    (r (+ 3 x))))))
		 (#t 123))))
    (if (= y 4) (begin (set! x 2) (c1 321)))
    (test (list x y) '(2 321))))




;;; -------- cond-expand --------
;;; cond-expand

(test (let ()
	(cond-expand (guile )
		     (s7 (define (hi a) a)))
	(hi 1))
      1)
(test (let ((x 0))
	(cond-expand (guile (format #t ";oops~%"))
		     (else (set! x 32)))
	x)
      32)
(test (let ()
	(cond-expand
	 (guile 
	  (define (hi a) (+ a 1)))
	 ((or common-lisp s7)
	  (define (hi a) a)))
	(hi 1))
      1)
(test (let ()
	(cond-expand
	 ((not guile)
	  (define (hi a) a))
	 (else 
	  (define (hi a) (+ a 1))))
	(hi 1))
      1)

(test (let ()
	(cond-expand 
	 ((and s7 dfls-exponents)
	  (define (hi a) a))
	 (else 
	  (define (hi a) (+ a 1))))
	(hi 1))
      (if (provided? 'dfls-exponents) 1 2))
(test (let ()
	(cond-expand 
	 ((or s7 guile)
	  (define (hi a) a))
	 (else 
	  (define (hi a) (+ a 1))))
	(hi 1))
      1)
(test (let ()
	(cond-expand 
	 ((and s7 dfls-exponents unlikely-feature)
	  (define (hi a) a))
	 (else 
	  (define (hi a) (+ a 1))))
	(hi 1))
      2)
(test (let ()
	(cond-expand
	 ((and s7 (not s7)) 'oops)
	 (else 1)))
      1)
(test (let ()
	(cond-expand
	 ("not a pair" 1)
	 (2 2)
	 (#t 3)
	 ((1 . 2) 4)
	 (() 6)
	 (list 7)
	 (else 5)))
      'error)




;;; --------------------------------------------------------------------------------
;;; case
;;; --------------------------------------------------------------------------------

(test (case (* 2 3) ((2 3 5 7) 'prime) ((1 4 6 8 9) 'composite))  'composite)
(test (case (car '(c d)) ((a e i o u) 'vowel) ((w y) 'semivowel) (else 'consonant)) 'consonant)
(test (case 3.1 ((1.3 2.4) 1) ((4.1 3.1 5.4) 2) (else 3)) 2)
(test (case 3/2 ((3/4 1/2) 1) ((3/2) 2) (else 3)) 2)
(test (case 3 ((1) 1 2 3) ((2) 2 3 4) ((3) 3 4 5)) 5)
(test (case 1+i ((1) 1) ((1/2) 1/2) ((1.0) 1.0) ((1+i) 1+i)) 1+i)
(test (case 'abs ((car cdr) 1) ((+ cond) 2) ((abs) 3) (else 4)) 3)
(test (case #\a ((#\b) 1) ((#\a) 2) ((#\c) 3)) 2)
(test (case (boolean? 1) ((#t) 2) ((#f) 1) (else 0)) 1)
(test (case 1 ((1 2 3) (case 2 ((1 2 3) 3)))) 3)
(test (case 1 ((1 2) 1) ((3.14 2/3) 2)) 1)
(test (case 1 ((1 2) 1) ((#\a) 2)) 1)
(test (case 1 ((1 2) 1) ((#\a) 2) ((car cdr) 3) ((#f #t) 4)) 1)
(test (case #f ((1 2) 1) ((#\a) 2) ((car cdr) 3) ((#f #t) 4)) 4)
(test (case 1 ((#t) 2) ((#f) 1) (else 0)) 0)
(test (let ((x 1)) (case x ((x) "hi") (else "ho"))) "ho")
(test (let ((x 1)) (case x ((1) "hi") (else "ho"))) "hi")
(test (let ((x 1)) (case x (('x) "hi") (else "ho"))) "ho")
(test (let ((x 1)) (case 'x ((x) "hi") (else "ho"))) "hi")
(test (case () ((()) 1)) 1)
(test (case #() ((#()) 1) (else 2)) 2)
(test (let ((x '(1))) (eval `(case ',x ((,x) 1) (else 0)))) 1)    ; but we can overcome that! (also via apply)
(test (let ((x #())) (eval `(case ',x ((,x) 1) (else 0)))) 1)
(test (case ''2 (('2) 1) (else 0)) 0)
(test (let ((otherwise else)) (case 1 ((0) 123) (otherwise 321))) 321)
(test (case 1 ((0) 123) (#t 321)) 'error)

(test (case else ((#f) 2) ((#t) 3) ((else) 4) (else 5)) 4)          ; (eqv? 'else else) is #t (Guile says "unbound variable: else")
(test (case #t ((#f) 2) ((else) 4) (else 5)) 5)                     ; else is a symbol here         
(test (equal? (case 0 ((0) else)) else) #t)
(test (cond ((case 0 ((0) else)) 1)) 1)
;(test (let () (case (define b 3) ((b) b))) 3) ; changed define 25-Jul-14

(test (let ((x 1)) (case x ((2) 3) (else (* x 2) (+ x 3)))) 4)
(test (let ((x 1)) (case x ((1) (* x 2) (+ x 3)) (else 32))) 4)
(test (let ((x 1)) (case x ((1) (let () (set! x (* x 2))) (+ x 3)) (else 32))) 5)
(test (let ((x 1)) (case x ((2) (let () (set! x (* x 2))) (+ x 3)) (else 32))) 32)
(test (let ((x 1)) (case x ((2) 3) (else (let () (set! x (* x 2))) (+ x 3)))) 5)
(test (let((x 1))(case x((2)3)(else(let()(set! x(* x 2)))(+ x 3)))) 5)
(test (let ((x 1)) (case x ((2) 3) (else 4) (else 5))) 'error)

(test (case () ((()) 2) (else 1)) 2)    ; car: (), value: (), eqv: 1, null: 1 1
(test (case () (('()) 2) (else 1)) 1)   ; car: (quote ()), value: (), eqv: 0, null: 0 1
(test (case () (('()) 2) (else 1)) 1)    ; car: (quote ()), value: (), eqv: 0, null: 0 1
(test (case () ((()) 2) (else 1)) 2)     ; car: (), value: (), eqv: 1, null: 1 1

;;; this is a difference between () and () ?
;;; (eqv? () ()) -> #t and (eqv? () ()) is #t so it's the lack of evaluation in the search case whereas the index is evaluated
;;; equivalent to:
 
(test (case 2 (('2) 3) (else 1)) 1)      ; car: (quote 2), value: 2, eqv: 0, null: 0 0
(test (case '2 (('2) 3) (else 1)) 1)     ; car: (quote 2), value: 2, eqv: 0, null: 0 0
(test (case '2 ((2) 3) (else 1)) 3)      ; car: 2, value: 2, eqv: 1, null: 0 0
(test (case 2 ((2) 3) (else 1)) 3)       ; car: 2, value: 2, eqv: 1, null: 0 0

(test (case '(()) ((()) 1) (((())) 2) (('()) 3) (('(())) 4) ((((()))) 5) (('((()))) 6) (else 7)) 7) ; (eqv? '(()) '(())) is #f

(test (let ((x 1)) (case (+ 1 x) ((0 "hi" #f) 3/4) ((#\a 1+3i '(1 . 2)) "3") ((-1 'hi 2 2.0) #\f))) #\f)
(test (case (case 1 ((0 2) 3) (else 2)) ((0 1) 2) ((4 2) 3) (else 45)) 3)
(test (case 3/4 ((0 1.0 5/6) 1) (("hi" 'hi 3/4) 2) (else 3)) 2)
(test (case (case (+ 1 2) (else 3)) ((3) (case (+ 2 2) ((2 3) 32) ((4) 33) ((5) 0)))) 33)
(test (let ((x 1)) (case x ((0) (set! x 12)) ((2) (set! x 32))) x) 1)

(test (case 1 (else #f)) #f)
(test (let () (case 0 ((0) (define (hi a) a)) (else (define (hi a) (+ a 1)))) (hi 1)) 1)
(test (let () (case 1 ((0) (define (hi a) a)) (else (define (hi a) (+ a 1)))) (hi 1)) 2)
;(test (let () (case (define (hi a) a) ((hi) (hi 1)))) 1) ; 25-Jul-14

(for-each
 (lambda (arg)
   (test (case 1 ((0) 'gad) ((1 2 3) arg) (else 'gad)) arg))
 (list "hi" -1 #\a 1 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #t (list 1 2 3) '(1 . 2)))

(for-each
 (lambda (arg)
   (test (case arg ((0) 'gad) ((1 2 3) arg) (else 'gad)) 'gad))
 (list "hi" -1 #\a 0 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #t (list 1 2 3) '(1 . 2)))

(test (call/cc (lambda (r) (case 1 ((1) (r 123) #t) (else #f)))) 123)
(test (call/cc (lambda (r) (case 1 ((0) 0) (else (r 123) #f)))) 123)

(test (case () ((1) 1) ('() 2)) 2)
(test (case (list) ((1) 1) ('() 2)) 2)
(test (case () ((1) 1) ((()) 2)) 2)
(test (case (list) ((1) 1) ((()) 2)) 2)
(test (case #<eof> ((#<eof>) 1)) 1)
(test (case #\newline ((#\newline) 1)) 1)
(test (case 'c (else => (lambda (x) (symbol? x)))) #t)
(test (case 1.0 ((1e0) 3) ((1.0) 4) (else 5)) 3)
(test (let ((x :a)) (case x ((:b) 1) ((:a) 0) (else 3))) 0)

(test (eval `(case ,+ ((,-) 0) ((,+) 1) (else 2))) 1)
(test (case + ((#_-) 0) ((#_+) 2) (else 3)) 2)

;; check multiple-value selector
(test (list (let ((x 1)) (case 1 ((1) (values 1 2 3)) (else 2)))) '(1 2 3))
(test (list (cond ((values 1 2 3)))) '(1 2 3))
(test (list (dynamic-wind (lambda () #f) (lambda () (case (values 1 2 3) (else))) (lambda () #f))) '(1 2 3))
(test (list ((lambda () (case (values 1 2 3) (else))))) '(1 2 3))
(test (list (case (values 1 2 3) (else))) '(1 2 3))
(test (+ (case (call-with-exit (lambda (ret) (ret 1 2 3))) (else))) 6)
(test (let ((m1 1)) (list (let-temporarily ((m1 1)) (values 1 2 3)))) '(1 2 3))
(test (let ((m1 1)) (list (call-with-exit (lambda (r) (let-temporarily ((m1 1)) (r 1 2 3)))))) '(1 2 3))
(test (let ((m1 1)) (list (call-with-exit (lambda (r) (let-temporarily ((m1 (r 1 2 3))) 4))))) '(1 2 3))

(let ()
  (define (c1 x)
    (case x
      ((3001) 1)
      ((12345) 2)
      ((8589934592) 3)
      (else 4)))
  (test (c1 3001) 1)
  (test (c1 12345) 2)
  (test (c1 8589934592) 3)
  (test (c1 -1) 4)

  (define (c2 x)
    (case x
      ((0 1 -1) 3)
      ((9223372036854775807 -9223372036854775808) 4)
      ((1.5) 5)
      ((2/3 1+i) 6)))

  (test (c2 -1) 3)
  (test (c2 most-positive-fixnum) 4)
  (test (c2 1.5) 5)
  (test (c2 2/3) 6)
  (test (c2 1+i) 6))

; case uses eqv? -- why not case-equal?
(test (case "" (("") 1)) #<unspecified>)
(test (case abs ((abs) 1)) #<unspecified>)
(test (case (if #f #f) ((1) 1) ((#<unspecified>) 2) (else 3)) 2)
;;; if case falls through, it should return #<unspecified> (not #f for example):
;;;   (case x ((a) 1)) should be equivalent to (if (eq? x 'a) 1)
(let ((x 'b)) (test (case x ((a) 1)) (if (eq? x 'a) 1)))

(test (case) 'error)
(test (case 1) 'error)
(test (case 1 . "hi") 'error)
(test (case 1 ("hi")) 'error)
(test (case 1 ("a" "b")) 'error)
(test (case 1 (else #f) ((1) #t)) 'error)
(test (case "hi" (("hi" "ho") 123) ("ha" 321)) 'error)
(test (case) 'error)
(test (case . 1) 'error)
(test (case 1 . 1) 'error)
(test (case 1 (#t #f) ((1) #t)) 'error)
(test (case 1 (#t #f)) 'error)
(test (case -1 ((-1) => abs)) 1)
(test (case 1 (else =>)) 'error)
(test (case 1 (else => + - *)) 'error)
(test (case #t ((1 2) (3 4)) -1) 'error)
(test (case 1 1) 'error)
(test (case 1 ((2) 1) . 1) 'error)
(test (case 1 (2 1) (1 1)) 'error)
(test (case 1 (else)) 1)   ; case null 4-Jan-17 
(test (case () ((1 . 2) . 1) . 1) 'error)
(test (case 1 ((1))) 1)                 ; case null
(test (case 1 ((else))) #<unspecified>) ; case null -- unexpected but ...
(test (case 1 ((2) 3) ((1))) 1)         ; case null
(test (case 1 ((1)) 1 . 2) 'error)
(test (case () ((()))) ())              ; case null
(test (case 1 (else 3) . 1) 'error)
(test (case 1 ((1 2)) (else 3)) 1)      ; case null
(test (case 1 ('(1 2) 3) (else 4)) 4)
(test (case 1 (('1 2) 3) (else 4)) 4)
(test (case 1 ((1 . 2) 3) (else 4)) 'error) ; ?? in guile it's an error
(test (case 1 ((1 2 . 3) 3) (else 4)) 'error)
(test (case 1 (('1 . 2) 3) (else 4)) 'error)
(test (case 1 ((1 . (2)) 3) (else 4)) 3)
(test (case 1 ((1 2) . (3)) (else 4)) 3)
(test (case 1 ((2) 3) (else)) 1)        ; case null
(test (case 1 ((2) 3) ()) 'error)
(test (case 1 ((2) 3) (() 2)) 'error) ; ?? in Guile this is #<unspecified>; our error is confusing: ;case clause key list () is not a list or 'else'
(test (case () ('() 2)) 2)            ; ?? error??
(test (case () ((()) 2)) 2) 
(test (case 1 else) 'error)
(test (case 1 (((1) 1) 2) (else 3)) 2) ; the (1) can't be matched -- should it be an error?
(test (case 1 ((1) . (else 3))) 3)     ; ?? guile says "unbound variable: else"
(test (case . (1 ((2) 3) ((1) 2))) 2)
(test (case 1 (#(1 2) 3)) 'error)
(test (case 1 #((1 2) 3)) 'error)
(test (case 1 ((2) 3) () ((1) 2)) 'error)
(test (case 1 ((2) 3) (1 2) ((1) 2)) 'error)
(test (case 1 ((2) 3) (1 . 2) ((1) 2)) 'error)
(test (case 1 ((2) 3) (1) ((1) 2)) 'error)
(test (case 1 ((2) 3) ((1)) ((1) 2)) 1)   ; case null 
(test (case 1 ((1) 2) ((1) 3)) 2) ; should this be an errror?
(test (let () (define-macro (mac x) `(+ ,x 1)) (case 1 ((1) => mac))) 2)

(test (let ((x 1)) (case x (else))) 1) 
(test (let ((x 1)) (case x ((0) 2) (else))) 1) 
(test (let ((x 1)) (case x ((1) 2) (else))) 2) 
(test (let ((x 1)) (case x ((0) 2))) #<unspecified>)
(test (let ((x 1)) (case x ((1)) ((2) 0))) 1)
(test (let ((x 1)) (case x ((lambda lambda*) (display "x") (+ 2 3)) ((case when) 3))) #<unspecified>)
(test (let ((x 'lambda)) (case x ((lambda lambda*)) ((case when) (display "x") 3))) 'lambda)
(test (let ((s "01234") (i 1)) (case (string-ref s i) ((#\3 #\4) 32) ((#\1 #\2)))) #\1)
(test (let ((s "01234") (i 3)) (case (string-ref s i) ((#\3 #\4) 32) ((#\1 #\2)))) 32)
(test (let ((head 'and)) (case head ((and if cond when)) ((or if2) (list 'not arg1)))) 'and)
(test (let ((s "01234") (i 1)) (case (string-ref s i) ((#\1)) ((#\2) 32))) #\1)
(test (let ((s "01234") (i 2)) (case (string-ref s i) ((#\1)) ((#\2) 32))) 32)
(test (let ((x 'a)) (case x ((a)))) 'a)
(test (case + ((-) 0) ((+)) (else 3)) 3)
(test (case + ((-) 0) ((#_+)) (else 3)) +)

;; check optimizer
(let () (define (c1 s i) (case (string-ref s i) ((#\a) 1) ((#\i)))) (define (c3 s i) (c1 s i)) (c3 "hiho" 1) (test (c3 "hiho" 1) #\i))
(let () (define (c1 s i) (case s (else))) (define (c3 s i) (c1 s i)) (c3 "hiho" 1) (test (c3 "hiho" 1) "hiho"))
(let () (define (c1 s i) (case s (else))) (define (c3 s i) (c1 s i)) (c3 2 1) (test (c3 2 1) 2))
(let () (define (c1 s i) (case s ((0) 2) (else))) (define (c3 s i) (c1 s i)) (c3 2 1) (test (c3 1 1) 1))
(let () (define (c1 s i) (case s ((0) 2) (else))) (define (c3 s i) (c1 s i)) (c3 2 1) (test (c3 0 1) 2))
(let () (define (c1 s i) (case s ((1) 2) (else))) (define (c3 s i) (c1 s i)) (c3 2 1) (test (c3 1 1) 2))
(let () (define (c1 s i) (case s ((1) 2) (else))) (define (c3 s i) (c1 s i)) (c3 2 1) (test (c3 3 1) 3))
(let () (define (c1 s i) (case s ((0) 2))) (define (c3 s i) (c1 s i)) (c3 2 1) (test (c3 1 1) #<unspecified>))
(let () (define (c1 s i) (case s ((1)) ((2) 0))) (define (c3 s i) (c1 s i)) (c3 2 1) (test (c3 1 1) 1))
(let () (define (c1 s i) (case s ((lambda lambda*)) ((case when) (display "x") 3))) (define (c3 s i) (c1 s i)) (c3 2 1) (test (c3 'lambda 1) 'lambda))
(let () (define (c1 s i) (case (string-ref s i) ((#\3 #\4) 32) ((#\1 #\2)))) (define (c3 s i) (c1 s i)) (c3 "0123" 1) (test (c3 "01234" 1) #\1))
(let () (define (c1 s i) (case s ((and if cond when)) ((or if2) (list 'not arg1)))) (define (c3 s i) (c1 s i)) (c3 2 1) (test (c3 'and 1) 'and))
(let () (define (c1 s i) (case (string-ref s i) ((#\1)) ((#\2) 32))) (define (c3 s i) (c1 s i)) (c3 "0123" 1) (test (c3 "01234" 1) #\1))
(let () (define (c1 s i) (case s ((a)))) (define (c3 s i) (c1 s i)) (c3 "0123" 1) (test (c3 'a 1) 'a))
(let () (define (c1 s i) (case + ((-) 0) ((+)) ((#_+)) (else 3))) (define (c3 s i) (c1 s i)) (c3 "0123" 1) (test (c3 'a 1) +))
(test (let () (define (f1) (let ((x 1)) (case 1 ((0) 0) ((1) 2) (else 3)))) (f1) (f1)) 2)
(test (let () (define (f2) (let ((x 1)) (case x ((0) 0) ((1) 2) (else 3)))) (f2) (f2)) 2)
(test (let () (define (f3) (let ((x 1)) (case (+ x (* x x) -1) ((0) 0) ((1) 2) (else 3)))) (f3) (f3)) 2)
(test (let () (define (f11) (let ((x 2)) (case 2 ((0) 0) ((1) 2) (else 3)))) (f11) (f11)) 3)
(test (let () (define (f12) (let ((x 2)) (case x ((0) 0) ((1) 2) (else 3)))) (f12) (f12)) 3)
(test (let () (define (f13) (let ((x 2)) (case (+ x (abs (* x x))) ((0) 0) ((1) 2) (else 3)))) (f13) (f13)) 3)
(test (let () (define (f21) (let ((x 2)) (case 2 ((0) 0) ((1) 2)))) (f21) (f21)) #<unspecified>)
(test (let () (define (f22) (let ((x 2)) (case x ((0) 0) ((1) 2)))) (f22) (f22)) #<unspecified>)
(test (let () (define (f23) (let ((x 2)) (case (+ x (abs (* x x))) ((0) 0) ((1) 2)))) (f23) (f23)) #<unspecified>)
(test (let () (define (f31) (let ((x 'a)) (case x ((a) 0) ((b) 2) (else 3)))) (f31) (f31)) 0)
(test (let () (define (f32) (let ((x '(a b))) (case (car x) ((a) 0) ((b) 2) (else 3)))) (f32) (f32)) 0)
(test (let () (define (f33) (let ((x 'a)) (case (car (car (list (list x x)))) ((a) 0) ((b) 2) (else 3)))) (f33) (f33)) 0)
(test (let () (define (f41) (let ((x 'c)) (case x ((a) 0) ((b) 2) (else 3)))) (f41) (f41)) 3)
(test (let () (define (f42) (let ((x '(c b))) (case (car x) ((a) 0) ((b) 2) (else 3)))) (f42) (f42)) 3)
(test (let () (define (f43) (let ((x 'c)) (case (car (car (list (list x x)))) ((a) 0) ((b) 2) (else 3)))) (f43) (f43)) 3)
(test (let () (define (f51) (let ((x 'c)) (case x ((a) 0) ((b) 2)))) (f51) (f51)) #<unspecified>)
(test (let () (define (f52) (let ((x '(c b))) (case (car x) ((a) 0) ((b) 2)))) (f52) (f52)) #<unspecified>)
(test (let () (define (f53) (let ((x 'c)) (case (car (car (list (list x x)))) ((a) 0) ((b) 2)))) (f53) (f53)) #<unspecified>)
(test (let () (define (f61) (let ((x 'a)) (case x ((a) 0) ((1) 2) (else 3)))) (f61) (f61)) 0)
(test (let () (define (f62) (let ((x '(a b))) (case (car x) ((a) 0) ((1) 2) (else 3)))) (f62) (f62)) 0)
(test (let () (define (f63) (let ((x 'a)) (case (car (car (list (list x x)))) ((a) 0) ((1) 2) (else 3)))) (f63) (f63)) 0)
(test (let () (define (f71) (let ((x 'b)) (case x ((a) 0) ((1) 2) (else 3)))) (f71) (f71)) 3)
(test (let () (define (f72) (let ((x '(b b))) (case (car x) ((a) 0) ((1) 2) (else 3)))) (f72) (f72)) 3)
(test (let () (define (f73) (let ((x 'b)) (case (car (car (list (list x x)))) ((a) 0) ((1) 2) (else 3)))) (f73) (f73)) 3)
(test (let () (define (f81) (let ((x 'b)) (case x ((a) 0) ((1) 2)))) (f81) (f81)) #<unspecified>)
(test (let () (define (f82) (let ((x '(b b))) (case (car x) ((a) 0) ((1) 2)))) (f82) (f82)) #<unspecified>)
(test (let () (define (f83) (let ((x 'b)) (case (car (car (list (list x x)))) ((a) 0) ((1) 2)))) (f83) (f83)) #<unspecified>)
(test (let () (define (f91) (let ((x 'a)) (case x ((a) 0) ((b c) 2) (else 3)))) (f91) (f91)) 0)
(test (let () (define (f92) (let ((x '(a b))) (case (car x) ((a) 0) ((b c) 2) (else 3)))) (f92) (f92)) 0)
(test (let () (define (f93) (let ((x 'a)) (case (car (car (list (list x x)))) ((a) 0) ((b c) 2) (else 3)))) (f93) (f93)) 0)
(test (let () (define (f101) (let ((x 'd)) (case x ((a) 0) ((b c) 2) (else 3)))) (f101) (f101)) 3)
(test (let () (define (f102) (let ((x '(d b))) (case (car x) ((a) 0) ((b c) 2) (else 3)))) (f102) (f102)) 3)
(test (let () (define (f103) (let ((x 'd)) (case (car (car (list (list x x)))) ((a) 0) ((b c) 2) (else 3)))) (f103) (f103)) 3)
(test (let () (define (f111) (let ((x 'd)) (case x ((a) 0) ((b c) 2)))) (f111) (f111)) #<unspecified>)
(test (let () (define (f112) (let ((x '(d b))) (case (car x) ((a) 0) ((b c) 2)))) (f112) (f112)) #<unspecified>)
(test (let () (define (f113) (let ((x 'd)) (case (car (car (list (list x x)))) ((a) 0) ((b c) 2)))) (f113) (f113)) #<unspecified>)
(test (let () (define (f121) (let ((x 'a)) (case x ((a) 0) ((b c 12) 2) (else 3)))) (f121) (f121)) 0)
(test (let () (define (f122) (let ((x '(a b))) (case (car x) ((a) 0) ((b c 12) 2) (else 3)))) (f122) (f122)) 0)
(test (let () (define (f123) (let ((x 'a)) (case (car (car (list (list x x)))) ((a) 0) ((b c 12) 2) (else 3)))) (f123) (f123)) 0)

;; newly optimized case
(let ((lt (inlet 'a 1 'b 2))) 
  (define (c1 s) (case (let-ref lt s) ((#<undefined>) 3) (else))) 
  (define (c3 s) (c1 s)) (c3 'a) 
  (test (c3 'b) 2)
  (test (c3 'a) 1)
  (test (c3 'c) 3))
(let ((lt (inlet 'a 1 'b 2))) 
  (define (c1 s) (case (let-ref lt s) ((#<eof> #<undefined>) 3) (else))) 
  (define (c3 s) (c1 s)) (c3 'a)
  (test (c3 'b) 2)
  (test (c3 'a) 1)
  (test (c3 'c) 3))
(let ((lt (inlet 'a 1 'b 2)))
  (define (c1 s) (let ((x 1)) (case (let-ref lt s) ((#<undefined>) (set! x 2) (+ x 1)) (else))))
  (define (c3 s) (c1 s))  (c3 'a)
  (test (c3 'a) 1)
  (test (c3 'c) 3))

(let ()
  (define (hi x) (case x ((a) 'a) ((b) 'b) (else 'c)))
  (test (hi 'a) 'a)
  (test (hi 'd) 'c))

(test (case 'case ((case) 1) ((cond) 3)) 1)
(test (case 101 ((0 1 2) 200) ((3 4 5 6) 600) ((7) 700) ((8) 800) ((9 10 11 12 13) 1300) ((14 15 16) 1600) ((17 18 19 20) 2000) ((21 22 23 24 25) 2500) ((26 27 28 29) 2900) ((30 31 32) 3200) ((33 34 35) 3500) ((36 37 38 39) 3900) ((40) 4000) ((41 42) 4200) ((43) 4300) ((44 45 46) 4600) ((47 48 49 50 51) 5100) ((52 53 54) 5400) ((55) 5500) ((56 57) 5700) ((58 59 60) 6000) ((61 62) 6200) ((63 64 65) 6500) ((66 67 68 69) 6900) ((70 71 72 73) 7300) ((74 75 76 77) 7700) ((78 79 80) 8000) ((81) 8100) ((82 83) 8300) ((84 85 86 87) 8700) ((88 89 90 91 92) 9200) ((93 94 95) 9500) ((96 97 98) 9800) ((99) 9900) ((100 101 102) 10200) ((103 104 105 106 107) 10700) ((108 109) 10900) ((110 111) 11100) ((112 113 114 115) 11500) ((116) 11600) ((117) 11700) ((118) 11800) ((119 120) 12000) ((121 122 123 124 125) 12500) ((126 127) 12700) ((128) 12800) ((129 130) 13000) ((131 132) 13200) ((133 134 135 136) 13600) ((137 138) 13800)) 10200)
(test (case most-positive-fixnum ((-1231234) 0) ((9223372036854775807) 1) (else 2)) 1)
(test (case most-negative-fixnum ((123123123) 0) ((-9223372036854775808) 1) (else 2)) 1)
(test (case 0 ((3/4 "hi" #t) 0) ((#f #() -1) 2) ((#\a 0 #t) 3) (else 4)) 3)
(test (case 3/4 ((3/4 "hi" #t) 0) ((#f #() hi) 2) ((#\a 0 #t) 3) (else 4)) 0)
(test (case 'hi ((3/4 "hi" #t) 0) ((#f #() hi) 2) ((#\a 0 #t) 3) (else 4)) 2)
(test (case #f ((3/4 "hi" #t) 0) ((#f #() hi) 2) ((#\a 0 #t) 3) (else 4)) 2)
(test (case 3 ((3/4 "hi" #t) 0) ((#f #() hi) 2) ((#\a 0 #t) 3) (else 4)) 4)
(test (case 0 ((values 0 1) 2) (else 3)) 2)
(test (+ (case 0 ((0) (values 1 2 3))) 4) 10)
(test (+ (case 1 ((0) (values 1 2 3)) (else (values 1 2))) 4) 7)

(test (let ((else 3)) (case 0 ((1) 2) (else 3))) 3) ; changed my mind about this -- else is not evaluated here unless it's some other symbol
(test (let ((otherwise else)) (case 0 ((1) 2) (otherwise 3))) 3) ; maybe this isn't a great idea...
(test (let ((else 3)) (case else ((3) else))) 3)
(test (case 0 ((1) 2) (else (let ((else 3)) else))) 3)
(test (case 0 ((1) #t) ((2 else 3) #f) ((0) 0)) 0) ; should this be an error? (it isn't in Guile)
(test (case 0 ((1) #t) ((else) #f) ((0) 0)) 0)
(test (apply case 1 '(((0) -1) ((1) 2))) 2)
(test (let ((x #(1))) (apply case x (list (list (list #()) 1) (list (list #(1)) 2) (list (list x) 3) (list 'else 4)))) 3)


(test (let ((x 0)) (let ((y (case 1 ((2) (set! x (+ x 3))) ((1) (set! x (+ x 4)) (+ x 2))))) (list x y))) '(4 6))
(let ()
  (define (hi a)
    (case a
      ((0) 1)
      ((1) 2)
      (else 3)))
  (test (hi 1) 2)
  (test (hi 2) 3)
  (test (hi "hi") 3))

(when with-bignums
  (test (case 8819522415901031498123 ((1) 2) ((8819522415901031498123) 3) (else 4)) 3) 
  (test (case -9223372036854775809 ((1 9223372036854775807) 2) (else 3)) 3))

;;; one thing that will hang case I think: circular key list

;;; C-style case
(define-macro (switch selector . clauses)
  `(call-with-exit
    (lambda (break)
      (case ,selector
	,@(do ((clause clauses (cdr clause))
	       (new-clauses ()))
	      ((null? clause) (reverse new-clauses))
	    (set! new-clauses (cons `(,(caar clause) 
				      ,@(cdar clause)
				      ,@(map (lambda (nc)
					       (apply values (cdr nc)))
					     (if (pair? clause) (cdr clause) ())))
				    new-clauses)))))))

(test (switch 1 ((1) (break 1)) ((2) 3) (else 4)) 1)
(test (switch 2 ((1) (break 1)) ((2) 3) (else 4)) 4)
(test (switch 4 ((1) (break 1)) ((2) 3) (else 4)) 4)

(let ()
  (call-with-output-file "test.scm"
    (lambda (p)
      (format p "(define (big-cond x)~%")
      (format p "  (cond~%")
      (do ((i 0 (+ i 1)))
	  ((= i 1000))
	(format p "    ((= x ~D) x)~%" i))
      (format p "  ))~%~%")
      (format p "(define (big-case x)~%")
      (format p "  (case x~%")
      (do ((i 0 (+ i 1)))
	  ((= i 1000))
	(format p "    ((~D) x)~%" i))
      (format p "  ))~%~%")))
  (load "test.scm" (curlet))
  (test (big-cond 541) 541)
  (test (big-case 541) 541))



;;; --------------------------------------------------------------------------------
;;; lambda
;;; --------------------------------------------------------------------------------

(test (procedure? (lambda (x) x)) #t)
(test ((lambda (x) (+ x x)) 4) 8)
(test (let ((reverse-subtract (lambda (x y) (- y x)))) (reverse-subtract 7 10)) 3)
(test (let ((add4 (let ((x 4)) (lambda (y) (+ x y))))) (add4 6)) 10)
(test ((lambda x x) 3 4 5 6) (list 3 4 5 6))
(test ((lambda (x y . z) z) 3 4 5 6) (list 5 6))
(test ((lambda (a b c d e f) (+ a b c d e f)) 1 2 3 4 5 6) 21)
(test (let ((foo (lambda () 9))) (+ (foo) 1)) 10)
(test (let ((a 1)) (let ((f (lambda (x) (set! a x) a))) (let ((c (f 123))) (list c a)))) (list 123 123))
(test (let ((a 1) (b (lambda (a) a))) (b 3)) 3)
(test (let ((ctr 0)) (letrec ((f (lambda (x) (if (> x 0) (begin (set! ctr (+ ctr 1)) (f (- x 1))) 0)))) (f 10) ctr)) 10)
(test (let ((f (lambda (x) (car x)))) (f '(4 5 6))) 4)
(test ((lambda () ((lambda (x y) ((lambda (z) (* (car z) (cdr z))) (cons x y))) 3 4))) 12)
(test (let ((ctr 0)) (define (f) (set! ctr (+ ctr 1)) ctr) (let ((x (f))) (let ((y (f))) (list x y ctr)))) (list 1 2 2))

(test (let ((x 5)) (define foo (lambda (y) (bar x y))) (define bar (lambda (a b) (+ (* a b) a))) (foo (+ x 3))) 45)
(test (let ((x 5)) (letrec ((foo (lambda (y) (bar x y))) (bar (lambda (a b) (+ (* a b) a)))) (foo (+ x 3)))) 45)

(num-test (let () (define compose (lambda (f g) (lambda args (f (apply g args))))) ((compose sqrt *) 12 75))  30.0)
(let ()
  (define (compose . args) ; this just removes parens
    (if (procedure? (car args))
	(if (null? (cdr args))
	    ((car args))
	    ((car args) (apply compose (cdr args))))
	(apply values args)))
  (test (compose - + (lambda (a b c) (values a (* b c))) 2 3 4) -14)
  (test (- (+ ((lambda (a b c) (values a (* b c))) 2 3 4))) -14)) ; I prefer this

(test (let ((f (lambda () (lambda (x y) (+ x y))))) ((f) 1 2)) 3)
(test ((lambda (x) (define y 4) (+ x y)) 1) 5)
(test ((lambda(x)(define y 4)(+ x y))1) 5)
(test ((lambda () (define (y x) (+ x 1)) (y 1))) 2)
(test ((lambda (x) 123 (let ((a (+ x 1))) a)) 2) 3)
(test ((lambda (x) "documentation" (let ((a (+ x 1))) a)) 2) 3)
(test ((lambda (x) (x 1)) (lambda (y) (+ y 1))) 2)
(test (let ((a 1)) (let ((b (lambda (x) (define y 1) (define z 2) (define a 3) (+ x y z a)))) (b a))) 7)
(test ((lambda (f x) (f x x)) + 11) 22)
(test ((lambda () (+ 2 3))) 5)
(test (let ((x (let () (lambda () (+ 1 2))))) (x)) 3)
(test (cond (0 => (lambda (x) x))) 0)
(test ((lambda () "hiho")) "hiho")
(test ((lambda()()))())
(test ((lambda () _undef_)) _undef_)
(test (procedure-source (apply lambda (list) (list (list)))) '(lambda () ()))

(test (letrec ((f (lambda (x) (g x)))
	       (g (lambda (x) x)))
	(let ((top (f 1)))
	  (set! g (lambda (x) (- x)))
	  (+ top (f 1))))
      0)

(for-each
 (lambda (arg)
   (test ((lambda (x) x) arg) arg))
 (list "hi" -1 #\a 1 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #t (list 1 2 3) '(1 . 2)))

(let ((list-length
       (lambda (obj)
	 (call-with-current-continuation
	  (lambda (return)
	    (letrec ((r (lambda (obj) (cond ((null? obj) 0)
					    ((pair? obj) (+ (r (cdr obj)) 1))
					    (else (return #f))))))
	      (r obj)))))))
  (test (list-length '(1 2 3 4)) 4)
  (test (list-length '(a b . c)) #f))

(test (let ((samples (vector 0 1 2 3 4 5 6 7 8 9 10)))
	(let ((make-scaler 
	       (lambda (start end)
		 (letrec ((ctr start)
			  (us (lambda (them)
				(vector-set! samples ctr (* 2 (vector-ref samples ctr)))
				(set! ctr (+ ctr 2))
				(if (<= ctr end)
				    (them us)))))
		   us))))
	  ((make-scaler 0 11)
	   (make-scaler 1 11))) 
	samples)
      (vector 0 2 4 6 8 10 12 14 16 18 20))

(test ((lambda (x . y) y) 1 2 '(3 . 4)) '(2 (3 . 4)))
(test ((lambda (x . y) y) 1) ())
(test ((lambda x x) ()) '(()))
(test ((lambda x x)) ())
(test ((lambda (x) x) ()) ())
(test ((lambda (x) (+ x ((lambda (x) (+ x 1)) 2))) 3) 6)
(test ((lambda (x) (define y 1) (+ x y)) 2) 3)
(test ((lambda (a) "this is a doc string" a) 1) 1)
;;; ideally ((lambda (a) "hiho" (define x 1) x) 1) -> 1 but I'm not sure it's r5rs-ish
(test (let ((g (lambda () '3))) (= (g) 3)) #t)
(test ((((lambda () lambda)) () 1)) 1)

(test (let () ; PLP Scott p168
	(define A
	  (lambda ()
	    (let* ((x 2)
		   (C (lambda (P)
			(let ((x 4))
			  (P))))
		   (D (lambda ()
			x))
		   (B (lambda ()
			(let ((x 3))
			  (C D)))))
	      (B))))
	(A))
      2)

#|
;;; here s7 "do" uses set!
(test (let ((funcs (make-vector 3 #f)))
	(do ((i 0 (+ i 1)))
	    ((= i 3))
	  (vector-set! funcs i (lambda () (+ i 1))))
	(+ ((vector-ref funcs 0))
	   ((vector-ref funcs 1))
	   ((vector-ref funcs 2))))
      6)
|#

;;; the equivalent named let version:
(test (let ((funcs (make-vector 3 #f)))
	(let loop ((i 0))
	  (if (< i 3)
	      (begin
		(vector-set! funcs i (lambda () (+ i 1)))
		(loop (+ i 1)))))
	(+ ((vector-ref funcs 0))
	   ((vector-ref funcs 1))
	   ((vector-ref funcs 2))))
      6)

(test (let ((i 1))
	(let ((func1 (lambda () i)))
	  (let ((i 2))
	    (let ((func2 (lambda () i)))
	      (+ (func1) (func2))))))
      3)

(test (let ((funcs (make-vector 3 #f)))
	(map
	 (lambda (i)
	   (vector-set! funcs i (lambda () (+ i 1))))
	 (list 0 1 2))
	(+ ((vector-ref funcs 0))
	   ((vector-ref funcs 1))
	   ((vector-ref funcs 2))))
      6)

(test (let ((funcs (make-vector 3 #f)))
	(for-each
	 (lambda (i)
	   (vector-set! funcs i (lambda () (+ i 1))))
	 (list 0 1 2))
	(+ ((vector-ref funcs 0))
	   ((vector-ref funcs 1))
	   ((vector-ref funcs 2))))
      6)

(test (let ((funcs (make-vector 3 #f)))
	(sort! (list 0 1 2)
	 (lambda (i j)
	   (vector-set! funcs i (lambda () (+ i 1))) 
	   (> i j)))
	(+ ((vector-ref funcs 0))
	   ((vector-ref funcs 1))
	   ((vector-ref funcs 2))))
      6)

(test (let ((funcs (make-vector 3 #f)))
	(member 4 (list 0 1 2)
	 (lambda (j i)
	   (vector-set! funcs i (lambda () (+ i 1)))
	   #f))
	(+ ((vector-ref funcs 0))
	   ((vector-ref funcs 1))
	   ((vector-ref funcs 2))))
      6)

(test (let ((funcs (make-vector 3 #f)))
	(assoc 4 (list (cons 0 0) (cons 1 0) (cons 2 0))
	 (lambda (j i) 
	   (vector-set! funcs i (lambda () (+ i 1)))
	   #f))
	(+ ((vector-ref funcs 0))
	   ((vector-ref funcs 1))
	   ((vector-ref funcs 2))))
      6)

(test (let ((func #f))
	(define (func1 x)
	  (set! func (lambda () (+ x 1))))
	(func1 1)
	(+ (func)
	   (let ()
	     (func1 2)
	     (func))))
      5)

(test (((lambda (x) (lambda () (+ x 1))) 32)) 33)

(test (let ((func #f))
	(define (func1 x)
	  (set! func (lambda () (string-append x "-"))))
	(func1 "hi")
	(string-append (func)
		       (let ()
			 (func1 "ho")
			 (func))))
      "hi-ho-")

(test (let ((func1 #f)
	    (func2 #f))
	(let ((x 1))
	  (set! func1 (lambda () x))
	  (set! func2 (lambda (y) (set! x y) y)))
	(+ (func1)
	   (let ()
	     (func2 32)
	     (func1))))
      33)

(test (let ((funcs (make-vector 3)))
	(let ((hi (lambda (a) (vector-set! funcs (- a 1) (lambda () a)))))
	  (hi 1) (hi 2) (hi 3)
	  (+ ((vector-ref funcs 0))
	     ((vector-ref funcs 1))
	     ((vector-ref funcs 2)))))
      6)

(test (let ((hi (lambda (a) (+ a 1)))
	    (ho (lambda (a) (a 32))))
	(+ (hi (hi (hi 1)))
	   (ho hi)))
      37)

(test (let ((x 0)
	    (b 4)
	    (f1 #f)
	    (f2 #f))
	(let ((x 1))
	  (let ((x 2))
	    (set! f1 (lambda (a) (+ a b x)))))
	(let ((x 3))
	  (let ((b 5))
	    (set! f2 (lambda (a) (+ a b x)))))
	(+ (f1 10) (f2 100)))  ; (+ 10 4 2) (+ 100 5 3)
      124)

(test ((if (> 3 2) + -) 3 2) 5)
(test (let ((op +)) (op 3 2)) 5)
(test (((lambda () +)) 3 2) 5)
(test ((car (cons + -)) 3 2) 5)
(test ((do ((i 0 (+ i 1))) ((= i 3) +) ) 3 2) 5)
(test (((lambda (x) x) (lambda (x) x)) 3) 3)
(test ((((lambda (x) x) (lambda (x) x)) (lambda (x) x)) 3) 3)
(test (((lambda (x) (lambda (y) x)) 3) 4) 3)
(test (((lambda (x) (lambda (x) x)) 3) 4) 4)
(test (let ((x 32)) (((lambda (x) (lambda (y) x)) 3) x)) 3)
(test ((call/cc (lambda (return) (return +))) 3 2) 5)
(test ((call-with-values (lambda () (values +)) (lambda (x) x)) 3 2) 5)
(test ((case '+ ((+) +)) 3 2) 5)
(test ((case '+ ((-) -) (else +)) 3 2) 5)
(test ((call/cc (lambda (return) (dynamic-wind (lambda () #f) (lambda () (return +)) (lambda () #f)))) 3 2) 5)
(test (+ 1 ((call/cc (lambda (return) (dynamic-wind (lambda () #f) (lambda () (return +)) (lambda () #f)))) 3 2) 2) 8)
(test (let ((lst (list + -))) ((car lst) 1 2 3)) 6)
(test (let ((a +)) ((let ((b -)) (if (eq? a b) a *)) 2 3)) 6)
(test ((list-ref (list + - * /) 0) 2 3) 5)
(test (((if #t list-ref oops) (list + - * /) 0) 2 3) 5)
(test ((((car (list car cdr)) (list car cdr)) (list + -)) 2 3) 5)
(test (let ()
	(define function lambda)
	(define hiho (function (a) (+ a 1)))
	(hiho 2))
      3)
(test ((lambda (a b c d e f g h i j k l m n o p q r s t u v x y z)
	 (+ a b c d e f g h i j k l m n o p q r s t u v x y z))
       1 2 3 4 5 6 7 8 9 11 12 13 14 15 16 17 18 19 21 22 23 24 25 26 27)
      348)
(test ((lambda (x) "a useless string" x) 32) 32)
(test ((lambda (>< =0=? .arg.) (+ >< =0=? .arg.)) 1 2 3) 6)
(test ((apply ((lambda () lambda)) ((lambda () (list 'a))) ((lambda () '((+ a 1))))) 3) 4)

(define-constant (_?_3 a) #f)
(let () (define (hi x) (_?_3 x)) (hi 1) (test (let ((x 1)) (hi x)) #f))
(let () (define (_?_4 x y) x) (define (hi x) (_?_4 x (* x x (+ 1 x)))) (hi 1) (test (let ((x 1)) (hi x)) 1))
(define-constant (_?_5 x) (if (zero? x) x (+ x (_?_5 (- x 1)))))
(let () (define (hi x) (_?_5 x)) (hi 1) (test (let ((x 1)) (hi x)) 1))
(let () (define (hi x) (_?_5 (_?_5 1))) (hi 1) (test (hi 1) 1))
(let ((x 1)) (define (hi y) (set! x (* y y y))) (hi 1) (test (hi 1) 1))

(test
 (let ()
   (begin
     (define f1 #f)
     (define f2 #f)
     (let ((lv 32))
       (set! f1 (lambda (a) (+ a lv)))
       (set! f2 (lambda (a) (- a lv)))))
   (+ (f1 1) (f2 1)))
 2)

(test ((lambda () => abs)) 'error)
(test ((lambda () => => 3)) 'error)
;; actually, both Guile and Gauche accept
;; ((lambda () + 3)) and (begin + 3)
;; but surely => is an undefined variable in this context?

(test (lambda) 'error)
(test (lambda (a) ) 'error)
;; should this be an error: (lambda (a) (define x 1)) ?
(test (lambda . 1) 'error)
(test ((lambda . (x 1))) 1)
(test ((lambda . ((x . y) 2)) 1) 2)
(test ((lambda (x) . (x)) 1) 1)
(test ((lambda . ((x) . (x))) 1) 1)
(test ((lambda . (x . (x))) 1) '(1))
(test ((lambda . ((x . ()) x)) 1) 1)
(test (eval-string "((lambda . (x 1 . 3)) 1)") 'error)
(test (let () (define x (lambda . 1))) 'error)

(test (lambda 1) 'error)
(test (lambda (x 1) x) 'error)
(test (lambda "hi" 1) 'error)
(test (lambda (x x) x) 'error)
(test ((lambda (x x) x) 1 2) 'error) 
(test (lambda (x "a")) 'error)
(test ((lambda (x y) (+ x y a)) 1 2) 'error)
(test ((lambda ())) 'error)
(test (lambda (x (y)) x) 'error)
(test ((lambda (x) x . 5) 2) 'error)
(test (lambda (1) #f) 'error)
(test (eval-string "(lambda (x . y z) x)") 'error) 
(test ((lambda () 1) 1) 'error)
(test ((lambda (()) 1) 1) 'error)
(test ((lambda (x) x) 1 2) 'error)
(test ((lambda (x) x)) 'error)
(test ((lambda ("x") x)) 'error)
(test ((lambda "x" x)) 'error)
(test ((lambda (x . "hi") x)) 'error)
(test (lambda ((:hi . "hi") . "hi") 1) 'error)
(test ((lambda (x) (* quote ((x . 1) . 2))) 1) 'error)
(test ((lambda* (a (quote . -1)) a)) 'error)
(test (let () (define x (lambda (= i 0) i))) 'error)

(test (let ((hi (lambda (a 0.0) (b 0.0) (+ a b)))) (hi)) 'error)
(test (object->string
       ((lambda (arg)
	  (list arg
		(list (quote quote)
		      arg)))
	(quote (lambda (arg)
		 (list arg
		       (list (quote quote)
			     arg))))))
      "((lambda (arg) (list arg (list 'quote arg))) '(lambda (arg) (list arg (list 'quote arg))))")
      ;; was "(#1=(lambda (arg) (list arg (list 'quote arg))) '#1#)"
      
(test ((apply lambda '((a) (+ a 1))) 2) 3)
(test ((apply lambda '(() #f))) #f)
(test ((apply lambda '(arg arg)) 3) '(3))
(test ((apply lambda* '((a (b 1)) (+ a b))) 3 4) 7)
(test ((apply lambda* '((a (b 1)) (+ a b))) 3) 4)

(let ()
  (define-macro (progv vars vals . body)
    `(apply (apply lambda ,vars ',body) ,vals))
  (test (let ((s '(one two)) (v '(1 2))) (progv s v (+ one two))) 3)
  (test (progv '(one two) '(1 2) (+ one two)) 3))

(test (lambda #(a b) a) 'error)
(test (lambda* (#(a 1)) a) 'error)

(test ((lambda (a) a) #<eof>) #<eof>)
(test ((lambda () (let ((a #<undefined>)) a))) #<undefined>)

(test (let () (define* (foo (a 0) (b (+ a 4)) (c (+ a 7))) (list a b c)) (foo :b 2 :a 60)) '(60 2 67))
(test (let () (define* (f1 (a 0) (b (* 2 a))) (+ a b)) (f1 2)) 6) ; this used to be 2
;; one oddness:
(test (let () (define* (f1 (a (* b 2)) (b 3)) (list a b)) (f1 :b 1)) '(2 1))
;; (f1) however would be an error?  or should we preset args if we can?

(let ()
  (define* (f1 (a (+ b 1)) (b (+ a 1))) (list a b))
  (test (f1 1) '(1 2))
  (test (f1 :b 1) '(2 1))
  (test (f1 :b 0 :a 1) '(1 0))
  (test (f1 :a 1) '(1 2))
  (test (f1 2 3) '(2 3))
  (test (f1) 'error))

(let ()
  (define* (f1 (a (if (number? b) (+ b 1) 3)) (b (+ a 1))) (list a b))
  (test (f1) '(3 4)))

(let ()
  (define* (f1 (a 1) (b (+ a 1))) (+ a b))
  (define* (f2 (a (f1))) a)
  (test (f2) 3))

(let ()
  (define* (f1 (a 1) (b (+ a 1))) (+ a b))
  (define* (f2 (a (f1)) (b (f1 2))) (list a b))
  (test (f2) '(3 5)))



;;; --------------------------------------------------------------------------------
;;; begin
;;; --------------------------------------------------------------------------------

(test (begin) ()) ; I think Guile returns #<unspecified> here
(test (begin (begin)) ())
(test ((lambda () (begin))) ())
(test (let () (begin) #f) #f)
(test (let () (begin (begin (begin (begin)))) #f) #f)
(test (let () (begin (define x 2) (define y 1)) (+ x y)) 3)
(test (let () (begin (define x 0)) (begin (set! x 5) (+ x 1)))  6)
(test (let () (begin (define first car)) (first '(1 2))) 1)
(test (let () (begin (define x 3)) (begin (set! x 4) (+ x x))) 8)
(test (let () (begin (define x 0) (define y x) (set! x 3) y)) 0)         ; the let's block confusing global defines
(test (let () (begin (define x 0) (define y x) (begin (define x 3) y))) 0)
(test (let () (begin (define y x) (define x 3) y)) 'error)               ; guile says 3
(test (let ((x 12)) (begin (define y x) (define x 3) y)) 12)             ; guile says 3 which is letrec-style?
(test (begin (define (x) y) (define y 4) (x)) 4)
;; (let ((x 12)) (begin (define y x) y)) is 12
(test (let ((x 3)) (begin x)) 3)
(test (begin 3) 3)
(test (begin . (1 2)) 2)
(test (begin . ()) (begin))
(test (begin . 1) 'error)
(test (begin 1 . 2) 'error)
(test (begin ("hi" 1)) #\i)

(when (equal? (begin 1) 1)
  (test (let () (begin (define x 0)) (set! x (begin (begin 5))) (begin ((begin +) (begin x) (begin (begin 1))))) 6)      
  
  (test (let ((x 5))
	  (begin (begin (begin)
			(begin (begin (begin) (define foo (lambda (y) (bar x y)))
				      (begin)))
			(begin))
		 (begin)
		 (begin)
		 (begin (define bar (lambda (a b) (+ (* a b) a))))
		 (begin))
	  (begin)
	  (begin (foo (+ x 3))))
	45)
  
  (for-each
   (lambda (arg)
     (test (begin arg) arg))
   (list "hi" -1 #\a 1 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #t (list 1 2 3) '(1 . 2)))
  
  (test (if (= 1 1) (begin 2) (begin 3)) 2))

(test ((lambda (x) (begin (set! x 1) (let ((a x)) (+ a 1)))) 2) 2)
;;; apparently these can be considered errors or not (guile says error, stklos and gauche do not)
(test (begin (define x 0) (+ x 1)) 1)
(test ((lambda () (begin (define x 0) (+ x 1)))) 1)
(test (let ((f (lambda () (begin (define x 0) (+ x 1))))) (f)) 1)

(test ((lambda () (begin (define x 0)) (+ x 1))) 1)
(test (let ((f (lambda () (begin (define x 0)) (+ x 1)))) (f)) 1)
(test (let ((x 32)) (begin (define x 3)) x) 3)
(test ((lambda (x) (begin (define x 3)) x) 32) 3)
(test (let* ((x 32) (y x)) (define x 3) y) 32)

(test (let ((z 0)) (begin (define x 32)) (begin (define y x)) (set! z y) z) 32)
(test (let((z 0))(begin(define x 32))(begin(define y x))(set! z y)z) 32)
(test (let ((z 0)) (begin (define x 32) (define y x)) (set! z y) z) 32)        
(test (let () (begin (define b 1) (begin (define a b) (define b 3)) a)) 1)
(test (let () (begin (begin (define a1 1) (begin (define a1 b1) (define b1 3))) a1)) 'error)
(test (let () (begin (begin (define (a3) 1)) (begin (define (a3) b3) (define b3 3)) (a3))) 3) ; yow
(test (let () (begin (begin (define (a) 1)) (a))) 1)
(test (let ((a 1)) (begin (define a 2)) a) 2)
(test (+ 1 (begin (values 2 3)) 4) 10)
(test (+ 1 (begin (values 5 6) (values 2 3)) 4) 10)
(test (let ((hi 0)) (begin (values (define (hi b) (+ b 1))) (hi 2))) 3)




;;; --------------------------------------------------------------------------------
;;; apply
;;; --------------------------------------------------------------------------------

(test (apply (lambda (a b) (+ a b)) (list 3 4)) 7)
(test (apply + 10 (list 3 4)) 17)
(test (apply list ()) ())
(test (apply + '(1 2)) 3)
(test (apply - '(1 2)) -1)
(test (apply max 3 5 '(2 7 3)) 7)
(test (apply cons '((+ 2 3) 4)) '((+ 2 3) . 4))
(test (apply + ()) 0)
(test (apply + (list 3 4)) 7)
(test (apply + ()) 0)
(test (apply + 2 '(3)) 5)
(test (apply + 2 3 ()) 5)
(test (apply + '(2 3)) 5)
(test (apply list 1 '(2 3)) (list 1 2 3))
(test (apply apply (list list 1 2 '(3))) (list 1 2 3))
(test (vector? (apply make-vector '(1))) #t)
(test (apply make-vector '(1 1)) #(1))
(test (apply make-vector '((1) 1)) #(1))
(test (let ((f +)) (apply f '(1 2))) 3)
(test (apply min '(1 2 3 5 4 0 9)) 0)
(test (apply min 1 2 4 3 '(4 0 9)) 0)
(test (apply vector 1 2 '(3)) #(1 2 3))
(test (apply vector ()) #())
(test (apply (lambda (x . y) x) (list 1 2 3)) 1)
(test (apply * (list 2 (apply + 1 2 '(3)))) 12)
(test (apply (if (> 3 2) + -) '(3 2)) 5)
(test (let ((x (list 1 2))) (eq? x (append () x))) #t) ;; ?? guile says #t also
(test (apply (lambda* args args) 1 2 3 '(4 5 6 (7))) '(1 2 3 4 5 6 (7))) ; from lisp bboard
(test (apply (list 1 2) '(0)) 1)

(test (apply (cons 1 2) '(0)) 1) ; ! (apply (cons 1 2) '(1)) is an error
(test (procedure? apply) #t)
(test (string? (help apply)) #t)
(let ((lst (list 'values '(procedure? sequence?) #t))) ; values rather than #t since (+ (apply values '(1 2))) -> 3
  (set-cdr! (cddr lst) (cddr lst))
  (test (equal? lst (signature apply)) #t))

(for-each
 (lambda (arg)
   (test (apply (lambda (x) x) (list arg)) arg))
 (list "hi" -1 #\a 1 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #t (list 1 2 3) '(1 . 2)))

(test (apply cadadr (list '''4)) 4)
(test (apply string-ref "hi" '(0)) #\h)
(test (let ((x (string-copy "hi"))) (apply string-set! x 0 '(#\c)) x) "ci")
(test (apply apply (list + '(3  2))) 5)
(test (apply apply apply apply (list (list (list + '(3  2))))) 5)
(test (apply + 1 2 (list 3 4)) 10)
(test ((apply cdr '((1 2) (3 4)) ()) 0) '(3 4))
(test ((apply car '((1 2) (3 4)) ()) 1) 2)
(test ((apply cadr '((1 2) (3 4)) ()) 1) 4)
(test (apply append ()) ())
(test (apply apply append ()) ())
(test (apply apply apply append '(())) ())
(test (apply apply + ()) 0)
(test (apply apply * ()) 1)
(test (apply apply not not () ()) #f)
(test (apply apply apply eq? eq? eq? () () ()) #t)
(test (apply apply apply list list list () () ()) (list list list))
(test (apply apply vector cons (list '1 '2) ()) (vector cons 1 2))

(test (let ((x '(((1 2)) ((3 4))))) (catch #t (lambda () (apply apply apply apply x)) (lambda args 'error)) x) '(((1 2)) ((3 4))))
(test (let ((x '((1 2) (3 4)))) (catch #t (lambda () (apply apply apply apply x)) (lambda args 'error)) x) '((1 2) (3 4)))
(test (let ((x '((1 2) 3 4))) (catch #t (lambda () (apply apply apply x)) (lambda args 'error)) x) '((1 2) 3 4))
(test (let ((x '((1 2) (3 4)))) (catch #t (lambda () (apply apply apply not x)) (lambda args 'error)) x) '((1 2) (3 4)))

(test (eq? (apply apply apply values '(())) #<unspecified>) #t)
(test (eqv? (apply apply apply values '(())) #<unspecified>) #t)
(test (equal? (apply apply apply values '(())) #<unspecified>) #t)

(test (apply apply apply + '(((1)))) 1)
(test (apply apply map + '(((1)))) '(1))
(test (apply apply map quote '(((1)))) '(1))
(test (apply apply map values '(((1)) ((2)))) '((1) 2))
(test (apply apply map append '(((1)) ((2)))) '((1 . 2)))
(test (apply apply apply quote '(((1)))) 1)
(test (apply map cdr '(((1 2) (3 4)))) '((2) (4)))
(test (apply apply + '((1 2))) 3)
(test (apply apply cons '(((1 2) (3 4)))) '((1 2) 3 4))
(test (apply apply append '(((1 2) (3 4)))) '(1 2 3 4))
(test (apply map + '((1 2) (3 4))) '(4 6))
(test (apply map reverse '(((1 2) (3 4)))) '((2 1) (4 3)))
(test (apply apply map cons '(((1 2) (3 4)))) '((1 . 3) (2 . 4)))
(test (apply apply map list-tail '(((1 2) (3 4))) '(((1)))) '(((3 4))))
(test (apply apply map reverse '((1 2) (3 4)) '(())) '((2 1) (4 3)))
(test (apply apply map values '(((1)) ((2))) '(((1 2) (3 4)))) '(((1)) 1 3 ((2)) 2 4))
(test (apply apply map append '(((1 2) (3 4))) '(((1)) ((2)))) '(((1 2) (3 4) 1 . 2)))
(test (apply apply map append '(()) '(((1)) ((2)))) '((1 . 2)))
(test (apply apply map cdr '(((1 2) (3 4))) ()) '((2) (4)))
(test (apply apply apply list-tail '((1 2) (3 4)) '(((1)))) '((3 4)))
(test (apply apply apply reverse '(((1 2) (3 4))) '(())) '((3 4) (1 2)))
(test (apply apply apply values '(1) '(())) 1)
(test (apply apply apply values '(1) '((()))) '(1))
(test (apply apply apply values '((1)) ()) 1)
(test (apply apply apply values '((1)) '(())) '(1))
(test (apply apply reverse '(((1 2) (3 4))) ()) '((3 4) (1 2)))
(test (apply apply append () '(((1 2) (3 4)))) '(1 2 3 4))
(test (apply apply length '(()) ()) 0)
(test (apply apply let () '((1))) 1)
(test (apply apply apply apply + '((()))) 0)
(test (apply apply apply map reverse '((1 2) (3 4)) '((()))) '((2 1) (4 3)))
(test (apply apply apply map values '(((1 2) (3 4))) ()) '(1 3 2 4))
(test (apply apply apply apply + '(1) '((()))) 1)

(test (apply apply apply append (reverse '(((1)) ((2))))) '((2) . 1))
(test (apply apply map append (reverse '(((1)) ((2))))) '((2 . 1)))
(test (apply (apply apply lambda (quote '(1)))) 1)
(test (apply quote (map reverse (reverse '((1 2))))) '(2 1))
(test (map quote (apply map + '((1 2) (3 4)))) '(4 6))
(test (map car (apply map quote '(((1 2) (3 4))))) '(1 3))
(test (apply length (apply map append '(((1)) ((2))) '((1)))) -1)
(test (apply append (apply map list-tail '(((1 2) (3 4))) '((1)))) '((3 4)))
(test (apply append (apply map values '(((1)) ((2))) '(((1 2) (3 4))))) '((1) 1 2 (2) 3 4))
(test (apply append (apply map values '((1 2) (3 4)) '(((1 2) (3 4))))) '(1 2 1 2 3 4 3 4))
(test (apply append '((1) () (2 3 4) (5 6) ())) '(1 2 3 4 5 6))
(test (apply append '((1) () (2 3 4) (5 6) 7)) '(1 2 3 4 5 6 . 7))

(test (apply +) 0)
(test (apply + #f) 'error)
(test (apply #f '(2 3)) 'error)
(test (apply make-vector '(1 2 3)) 'error)
(test (apply + 1) 'error)
(test (apply) 'error)
(test (apply 1) 'error)
(test (apply . 1) 'error)
(test (apply car ''foo) 'error)
(test (apply + '(1 . 2)) 'error)
(test (apply + '(1 2 . 3)) 'error)
(test (apply () ()) 'error)
(test (apply list '(1 . 2) ()) '((1 . 2)))
(test (apply (lambda (x) x) _ht_ _undef_ _null_ _c_obj_) 'error)
(test (apply + #(1 2 3)) 'error)
(test (apply (lambda (a b) (+ a b)) '(1 . 2)) 'error)
(test (apply (lambda args (apply + args)) 1 2 3) 'error)
(test (apply (lambda args (apply + args)) 1 2 #f) 'error)
(test (apply (lambda args (apply list args)) 1 2 #f) 'error)
(test (apply (lambda args (apply + args)) 1 2 ()) 3)
(test (apply (lambda args (apply list args)) 1 2 ()) '(1 2))
(test (apply (lambda args (apply list args)) 1 '(2)) '(1 2))
(test (apply (lambda args (apply list args)) 1 '2) 'error)
(test (apply (lambda args (apply list args)) 1 'abs) 'error)
(test (apply (lambda args (apply list args)) 1 ''2) '(1 quote 2))
(test (apply (lambda args (apply list args)) () ()) '(()))
(test (apply (lambda args (apply list args)) () (cons 1 2)) 'error)
(test (apply (lambda args (apply list args)) (cons 1 2)) 'error)
(test (apply (apply lambda (signature +) '('x)) #i(1)) 'error)

(test (apply "hi" '(1 2)) 'error)
(test ("hi" 1 2) 'error)
(test (apply '(1 2) '(1 2)) 'error)
(test ((list 1 2 3) 1 2) 'error)

(test (apply "hi" '(1)) #\i)
(test ("hi" 1) #\i)
(test (apply '(1 2) '(1)) 2)
(test ((list 1 2 3) 1) 2)

(for-each
 (lambda (arg)
   (test (apply arg '(1)) 'error)
   (test (apply abs arg) 'error))
 (list -1 #\a 1 'a-symbol 3.14 3/4 1.0+1.0i #t)) 

(test (apply "hi" '(1)) #\i)
(test (apply '(1 2 3) '(1)) 2)
(test (apply #(1 2 3) '(2)) 3)
(test (apply #2D((1 2) (3 4)) 0 0 ()) 1)
(test (apply '((1 2) (3 4)) 1 0 ()) 3)
(test (let ((ht (make-hash-table))) (set! (ht "hi") 32) (apply ht '("hi"))) 32)

(test (let ((x (list 1 2))) (set-cdr! x x) (apply + x)) 'error)
(test (apply + '(1 2 . 3)) 'error)
(test (apply + '(1 2) (list 3 4)) 'error)
(test (let () (define (mrec a b) (if (<= b 0) (list a) (apply mrec (list a) (list (- b 1))))) (mrec (list 1 2) 5)) '(((((((1 2))))))))

(let ((lst (list 1 2 3)))
   (set! (cdr (cddr lst)) lst)
   (test (apply + lst) 'error))

(test (let ((lst '(1 2 3))) (let ((lst1 (apply list lst))) (set! (car lst1) 21) lst)) '(1 2 3))
(test (let ((lst '(1 2))) (let ((lst1 (apply cons lst))) (set! (car lst1) 21) lst)) '(1 2))
(test (let* ((x '(1 2 3)) (y (apply list x))) (eq? x y)) #f) ; this was #t until 26-Sep-11

(test (apply values (values (cons 1 ()))) 1)
(test (+ (apply values (values (list 1 2)))) 3)
(test (port-filename) (apply port-filename (list)))
(num-test (apply atan (#(1 #\a (3)) (max (values 1 2)))) 1.2490457723983)
(test (apply #2D((1 2) (3 4)) (list (floor (acosh 1)))) #(1 2)) 
(test ((apply values (list + 1 2)) 3) 6)
(if with-complex (num-test (* 0-2i (acosh (asin 0.0))) pi))
(test (apply truncate (lognot (min 1)) (list)) -2)
(num-test (apply /(list 11 11)) 1)

(test (apply dynamic-wind (list (lambda () #f) (lambda () 1) (lambda () #f))) 1)
(test (apply call-with-exit (list (lambda (exit) 1))) 1)
(test (apply call-with-exit (list (lambda (exit) (exit 1) 32))) 1)
(test (apply catch (list #t (lambda () 1) (lambda args 'error))) 1)
(test (apply eval '((+ 1 2))) 3)
(test (apply eval ()) 'error) ; (eval) is an error -- should it be? (eval ()) is () so perhaps (following values), (eval) -> #<unspecified>?
(test (apply eval '(())) ())
(test (apply eval-string '("(+ 1 2)")) 3) 
(test (let () (apply begin '((define x 1) (define y x) (+ x y)))) 2)
(test (apply begin ()) (begin))
(test (apply if '(#f 1 2)) 2)
(test (apply if '(#f)) 'error)
(test (let ((x 1)) (apply set! '(x 3)) x) 3)
(test (let ((x 3)) (apply set! (list (values 'x 32))) x) 32)
(test (let ((x 1)) (apply cond '(((= x 2) 3) ((= x 1) 32)))) 32)
(test (apply and '((= 1 1) (> 2 3))) #f)
(test (apply and ()) (and))
(test (apply or '((= 1 1) (> 2 3))) #t)
(test (apply or ()) (or))
(test (let () (apply define '(x 32)) x) 32)
(test (let () (apply define* '((hi (a 1) (b 2)) (+ a b))) (hi 32)) 34)
(test ((apply lambda '((n) (+ n 1))) 2) 3)
(test ((apply lambda* '(((n 1)) (+ n 1)))) 2)
(test (apply let '(((x 1)) (+ x 2))) 3)
(test (apply let* '(((x 1) (y (* 2 x))) (+ x y))) 3)
(test (equal? (apply let* '((a 2) (b (+ a 3))) '(list + a b) ()) (list + 2 5)) #t)
(test (apply let 'func '((i 1) (j 2)) '((+ i j (if (> i 0) (func (- i 1) j) 0)))) 5)
(test (let () (apply define-macro `((hiho a) `(+ ,a 1))) (hiho 2)) 3)
(test (let () (apply defmacro `(hiho (a) `(+ ,a 1))) (hiho 2)) 3)
(test (let () (apply defmacro* `(hiho ((a 2)) `(+ ,a 1))) (hiho)) 3)
(test (let () (apply define-macro* `((hiho (a 2)) `(+ ,a 1))) (hiho)) 3)
(test (apply do '(((i 0 (+ i 1))) ((= i 3) i))) 3)
(test (apply case '(1 ((2 3) 4) ((1 5) 32))) 32)
(test (+ (apply values '(1 2 3))) 6)
(test (apply quote '(1)) 1)
(test (apply quote ()) 'error) ; (quote) is an error
(test (let () (apply letrec '(() (define x 9) x))) 9)
(test ((lambda (n) (apply n '(((x 1)) (+ x 2)))) let) 3)
(test ((apply lambda (list (apply let (list (list) (quote (list (apply case '(0 ((0 1) 'n))))))) (quasiquote (+ n 1)))) 2) 3)
(test (apply let '((x 1)) '((+ x 1))) 2)
(test ((apply dilambda (list (lambda (x) (+ x 1)) (lambda (x y) (+ x y)))) 23) 24)
(test (apply (apply dilambda (list (lambda (x) (+ x 1)) (lambda (x y) (+ x y)))) '(23)) 24)
(test (apply map list '((1 one) (2 two) (3 three))) '((1 2 3) (one two three))) ; from scheme bboard
;;; so (define (unzip l) (apply values (apply map list l)))

(test (apply 'begin) 'error)
(test (apply and) #t)
(test (apply begin) ())
(test (apply if '((> 1 2) 3 4)) 4)
(test (apply or) #f)
(test (apply quote '(1)) 1)

(let ()
  (define (min-max arg . args)
    (if (null? args)
	(apply max arg)
	(min (apply max arg) 
	     (apply min-max args))))

  (test (min-max '(1 2 3) '(0 -1 4)) 3)
  (test (min-max '(1 2 3) '(0 -1 4) '(1 2)) 2))





;;; --------------------------------------------------------------------------------
;;; define
;;; --------------------------------------------------------------------------------

;;; trying to avoid top-level definitions here

(let ()
  (define x 2)
  (test (+ x 1) 3)
  (set! x 4)
  (test (+ x 1) 5)
  (let ()
    (define (tprint x) #t)
    (test (tprint 56) #t)
    (let ()
      (define first car)
      (test (first '(1 2)) 1)
      (let ()
	(define foo (lambda () (define x 5) x))
	(test (foo) 5)
	(let ()
	  (define (foo x) ((lambda () (define x 5) x)) x)
	  (test (foo 88) 88))))))


(test (letrec ((foo (lambda (arg) (or arg (and (procedure? foo) (foo 99)))))) (define bar (foo #f)) (foo #f)) 99)
(test (letrec ((foo 77) (bar #f) (retfoo (lambda () foo))) (define baz (retfoo)) (retfoo)) 77)

(test (let () (define .. 1) ..) 1)

(test (let () (define (hi a) (+ a 1)) (hi 2)) 3)
(test (let () (define (hi a . b) (+ a (cadr b) 1)) (hi 2 3 4)) 7)
(test (let () (define (hi) 1) (hi)) 1)
(test (let () (define (hi . a) (apply + a)) (hi 1 2 3)) 6)

(for-each
 (lambda (arg)
   (test (let () (define x arg) x) arg))
 (list "hi" -1 #\a 1 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #t (list 1 2 3) '(1 . 2)))

(test ((lambda (x) (define (hi a) (+ a 1)) (hi x)) 1) 2)
(test (let ((x 2)) (define f (lambda (y) (+ y x))) (f 3)) 5)
(begin (define r5rstest-plus (lambda (x y) (+ x y))) (define r5rstest-x 32))
(test (r5rstest-plus r5rstest-x 3) 35)
(test (let ((x 2.0)) (define (hi a) (set! a 3.0)) (hi x) x) 2.0)

(test (let () (define (asdf a) (define (asdf a) (+ a 1)) (+ a (asdf a))) (asdf 4)) 9)
(test (let ((asdf 1)) (define (asdf a) (define (asdf a) (+ a 1)) (+ a (asdf a))) (asdf 4)) 9)
(test (let () (define (a1 a) (define (a2 a) (define (a3 a) (define (a4 a) (+ a 1)) (+ (a4 a) 1)) (+ (a3 a) 1)) (+ (a2 a) 1)) (a1 0)) 4)

(test (let () (define (hi1 a) (define (hi1 b) (+ b 1)) (hi1 a)) (hi1 1)) 2)
(test (let () (define (hi1 a) (begin (define (hi1 b) (+ b 1))) (hi1 a)) (hi1 1)) 2)
(test (let ((j 0) (k 0))
	(define (hi1 a)
	  (let ((hi1 (lambda (b) 
		       (set! k (+ k 1)) 
		       (hi1 (- b 1)))))
	    (if (<= a 0)
		(list j k)
		(begin
		  (set! j (+ j 1))
		  (hi1 (- a 1))))))
	(hi1 3))
      '(2 2))

(test (procedure? (let () (define (a) a) (a))) #t)
(let ((oddp (lambda (a) (not (even? a)))))
   (define (hi a) (and (a 123) (a 321))) 
   (test (hi oddp) #t))

(test (define) 'error)
(test (define*) 'error)
(test (define x) 'error)
(test (define . x) 'error)
(test (define x 1 2) 'error)
(test (define x x) 'error)
(test (define x x x) 'error)
(test (define x x . x) 'error)
(test (let ((x 0)) (define x (x . x))) 'error)
(test (define (x x) . x) 'error)
(test (eval-string "(define (x .) 1)") 'error) ; need eval-string else a read error that halts our tests
(test (eval-string "(define (x) (+ 1 .))") 'error)
(test (define (x x) x . x) 'error)
(test (let () (define (x x) x) (x 0)) 0)
(test (define (x 1)) 'error)
(test (define (x)) 'error)
(test (define 1 2) 'error)
(test (define "hi" 2) 'error)
(test (define :hi 2) 'error)
(test (define x 1 2) 'error)
(test (define x 1 . 2) 'error)
(test (define x . 1) 'error)
(test (define x (lambda ())) 'error)
(test (define #<eof> 3) 'error)
(test (define (#<undefined>) 4) 'error)
(test (define (:hi a) a) 'error)
(test (define (hi: a) a) 'error)
(test (define (#b1 a) a) 'error)
(test (define (hi #b1) #b1) 'error)
(test (define () 1) 'error)
(test (let() (define #(hi a) a)) 'error)
(test (let () (define hi (lambda args args)) (hi 1 . 2)) 'error)
(test (let () (define . 1) 1) 'error)
(test (let () (define func (do () (#t (lambda (y) 2)))) (func 1)) 2)
(test (let () (define* x 3)) 'error)
(test (let () (define (hi) 1 . 2)) 'error)
(test (let () (define (hi) (1) . "hi")) 'error)
(test (let () (define _definee_ (values))) #<unspecified>)
(test (let () (define _definee_ (values 1))) 1)
(test (let () (define _definee_ (values 1 2))) 'error)
(test ((lambda () (define _definee_ (values 1 2)))) 'error)

(test (let () (define (f f) f) (f 0)) 0)
(test (let () (define (f . f) f) (f 1 2)) '(1 2))
;(test (let () (define (f f) (define* (f1 (f f)) f) (f1)) (f 0)) 0)
(test (let () (define (f1 f) (define* (f (f f)) f) (f)) (procedure? (f1 0))) #f) ; either way is fine...
(test (let () (define (f f) (define* (f (f f)) f) (f)) (procedure? (f 0))) #f)
(test (let ((f1 (define f2 32))) (+ f1 f2)) 64)
(test (let () (define x (+ (define y 3) 2)) (list x y)) '(5 3))
(test (let ((a 1) (b 2)) (define (f a b) (let ((a a) (b b)) (+ a b))) (f 4 3)) 7)
(test (let () (define (f x . y) (if (> x 0) (f (- x 1) y) y)) (f 4 1)) '(((((1))))))

;;; --------
;;; check envs
(test (let () (do ((i 0 (+ i 1))) ((= i 3) (define xyz 37) i)) xyz) 'error)
(test (let () (do ((i 0 (+ i 1))) ((= i 3)) (define xyz 37)) xyz) 'error)
(test (let () (do ((i (begin (define xyz 37) 0) (+ i 1))) ((= i 3))) xyz) 37)
(test (let () (do ((i 0 (begin (define xyz 37) (+ i 1)))) ((= i 3))) xyz) 'error)

(test (let () (let ((i (begin (define xyz 37) 0))) i) xyz) 37)
(test (let () (let ((i 0)) (define xyz 37) i) xyz) 'error)

(test (let () (let* ((i (begin (define xyz 37) 0))) i) xyz) 37)
(test (let () (let* ((i 0)) (define xyz 37) i) xyz) 'error)
(test (let () (let* ((k 0) (i (begin (define xyz 37) 0))) i) xyz) 'error)

(test (let () (letrec ((i (begin (define xyz 37) 0))) i) xyz) 'error)
(test (let () (letrec ((i (begin (define xyz 37) 0))) xyz)) 37)
(test (let () (letrec ((i 0)) (define xyz 37) i) xyz) 'error)

(test (let () (letrec* ((i (begin (define xyz 37) 0))) i) xyz) 'error)
(test (let () (letrec* ((i (begin (define xyz 37) 0))) xyz)) 37)
(test (let () (letrec* ((i 0)) (define xyz 37) i) xyz) 'error)
(test (let () (letrec* ((k 0) (i (begin (define xyz 37) 0))) i) xyz) 'error)

(test (let () (cond ((define xyz 37) #f)) xyz) 37)
(test (let () (cond ((> 2 1) (define xyz 37) #f)) xyz) 37)
(test (let () (cond ((< 2 1) 0) (else (define xyz 37) #f)) xyz) 37)

(test (let () (if (define xyz 37) 0 1) xyz) 37)
(test (let () (if (> 2 1) (define xyz 37) 1) xyz) 37)
(test (let () (if (< 2 1) 0 (define xyz 37)) xyz) 37)

(test (let () (when (define xyz 37) #f) xyz) 37)
(test (let () (when (> 2 1) (define xyz 37) #f) xyz) 37)
(test (let () (unless (define xyz 37) #f) xyz) 37)
(test (let () (unless (< 2 1) (define xyz 37) #f) xyz) 37)

(test (let () (quote (define xyz 37)) xyz) 'error)
(test (let () (begin (define xyz 37) 0) xyz) 37)
(test (let () (and (define xyz 37) 0) xyz) 37)
(test (let () (or (define xyz 37) 0) xyz) 37)
(test (let ((x 0)) (set! x (define xyz 37)) xyz) 37)
(test (let () (with-let (curlet) (define xyz 37)) xyz) 37)
(test (let () (with-let (inlet 'a 1) (define xyz 37)) xyz) 'error)
(test (let () (with-baffle (define xyz 37) 2) xyz) 'error)                      ; with-baffle introduces a new frame

(test (let () (case (define xyz 37) ((0) 1) ((37) #t)) xyz) 37)
(test (let () (case 1 ((1) (define xyz 37)) ((0) 1)) xyz) 37)
(test (let () (case 1 ((0) 1) (else (define xyz 37) 2)) xyz) 37)

(test (let () (lambda () (define xyz 37)) xyz) 'error)
(test (let () (define* (fxyz (a (define xyz 37))) a) (fxyz) xyz) 'error)        ; ??? it's defined in fxyz!
(test (let () (define* (fxyz (a (define xyz 37))) xyz) (fxyz)) 37)              ; !
;;; --------

(let ()
  (define a#b 3)
  (define a'b 4)
  (define a,b 5)
  (define a[b 6)
  (define a@b 7)
  (define a\b 8)
  (define a|b 9)
  (test (+ a#b a'b a,b a[b a@b a\b a|b) 42))

(let ()
  (define (make-func) (define (a-func a) (+ a 1)))
  (test (procedure? (make-func)) #t))

(let () (test (if (and (define x 3) (define y 4)) (+ x y)) 7))
(let () (test (if (not (and (define x 2) (define y 4))) (+ x y) (if (define x 3) x)) 3))
(let () (test (if (and (define x 2) (not (define y 4))) (+ x y) (- x y)) -2))
(test (let () (define (f a) (lambda () a)) (+ ((f 1)) ((f 2)))) 3)
(test (let () (define (hi) (let ((a 1)) (set! a 2) (define (ho) a) (set! a 3) (ho))) (hi)) 3)
;;; (define-macro (make-lambda args . body) `(apply lambda* ',args '(,@body))): (make-lambda (a b) (+ a b))

;; y combinator example from some CS website
(let ()
  (define Y
    (lambda (X)
      ((lambda (procedure)
         (X (lambda (arg) ((procedure procedure) arg))))
       (lambda (procedure)
         (X (lambda (arg) ((procedure procedure) arg)))))))

  (define M
    (lambda (func-arg)
      (lambda (l)
        (if (null? l)
            'no-list
            (if (null? (cdr l))
                (car l)
                (max (car l) (func-arg (cdr l))))))))

  (test ((Y M) '(4 5 6 3 4 8 6 2)) 8))

(test (((lambda (X)
	  ((lambda (procedure)
	     (X (lambda (arg) ((procedure procedure) arg))))
	   (lambda (procedure)
	     (X (lambda (arg) ((procedure procedure) arg))))))
	(lambda (func-arg)
	  (lambda (n)
	    (if (zero? n)
		1
		(* n (func-arg (- n 1)))))))
       5)
      120)

;;; from a paper by Mayer Goldberg
(let ()
  (define curry-fps
    (lambda fs
      (let ((xs
	     (map
	      (lambda (fi)
		(lambda xs
		  (apply fi
			 (map
			  (lambda (xi)
			    (lambda args
			      (apply (apply xi xs) args)))
			  xs))))
	      fs)))
	(map (lambda (xi)
	       (apply xi xs)) xs))))
  
  (define E
    (lambda (even? odd?)
      (lambda (n)
        (if (zero? n) #t ; return Boolean True
            (odd? (- n 1))))))
  
  (define O
    (lambda (even? odd?)
      (lambda (n)
        (if (zero? n) #f ; return Boolean False
            (even? (- n 1))))))
  
  (define list-even?-odd? (curry-fps E O))
  (define new-even? (car list-even?-odd?))
  (define new-odd? (cadr list-even?-odd?))
  
  (test (new-even? 6) #t)
  (test (new-odd? 6) #f))

(let ()
  (define (Cholesky:decomp P)
    ;; from Marco Maggi based on a Scheme bboard post
    ;; (Cholesky:decomp '((2 -2) (-2 5))) -> ((1.4142135623731 0) (-1.4142135623731 1.7320508075689))
    (define (Cholesky:make-square L)
      (define (zero-vector n)
	(if (zero? n)
	    ()
	    (cons 0 (zero-vector (- n 1)))))
      (map (lambda (v)
	     (append v (zero-vector (- (length L) (length v)))))
	   L))
    (define (Cholesky:add-element P L i j)
      (define (Cholesky:smaller P)
	(if (null? (cdr P))
	    ()
	    (reverse (cdr (reverse P)))))
      (define (Cholesky:last-row L)
	(car (reverse L)))
      (define (matrix:element A i j)
	(list-ref (list-ref A i) j))
      (define (Cholesky:make-element P L i j)
	(define (Cholesky:partial-sum L i j)
	  (let loop ((k j))
	    (case k
	      ((0) 0)
	      ((1) (* (matrix:element L i 0)
		      (matrix:element L j 0)))
	      (else
	       (+ (* (matrix:element L i k)
		     (matrix:element L j k))
		  (loop (- k 1)))))))
	(let ((x (- (matrix:element P i j)
		    (Cholesky:partial-sum L i j))))
	  (if (= i j)
	      (sqrt x)
	      (/ x (matrix:element L j j)))))
      (if (zero? j)
	  (append L `((,(Cholesky:make-element P L i j))))
	  (append (Cholesky:smaller L)
		  (list (append
			 (Cholesky:last-row L)
			 (list (Cholesky:make-element P L i j)))))))
    (Cholesky:make-square
     (let iter ((i 0) (j 0) (L ()))
       (if (>= i (length P))
	   L
	   (iter (if (= i j) (+ 1 i) i)
		 (if (= i j) 0 (+ 1 j))
		 (Cholesky:add-element P L i j))))))
  (let* ((lst (Cholesky:decomp '((2 -2) (-2 5))))
	 (lst0 (car lst))
	 (lst1 (cadr lst)))
    (if (or (> (abs (- (car lst0) (sqrt 2))) .0001)
	    (not (= (cadr lst0) 0))
	    (> (abs (+ (car lst1) (sqrt 2))) .0001)
	    (> (abs (- (cadr lst1) (sqrt 3))) .0001))
	(format #t ";cholesky decomp: ~A~%" lst))))

(let () ; from Programming Praxis
  (define (A k x1 x2 x3 x4 x5)
    (define (B)
      (set! k (- k 1))
      (A k B x1 x2 x3 x4))
    (if (<= k 0) 
	(+ (x4) (x5))
	(B)))
  (test (A 10 (lambda () 1) (lambda () -1) (lambda () -1) (lambda () 1) (lambda () 0)) -67))

(let ()
  (define* (a1 (b (let ()
		    (define* (a1 (b 32)) b)
		    (a1))))
    b)
  (test (a1) 32)
  (test (a1 1) 1))

(test (let ((f1 (lambda (x) (+ x 1)))) 
	(define f1 (lambda (y) (if (zero? y) y (f1 (- y 1))))) 
	(f1 3))
      0)

(test (let ((x 1)) (cond (else (define x 2))) x) 2)
(test (let ((x 1)) (and (define x 2)) x) 2)
(test (let () (begin 1)) 1)
(test (let () (begin (define x 1) x)) 1)
(test (let () (let ((lst (define abc 1))) #f) abc) 1)                  ; ?? 
(test (let () (let ((lst (define abc 1))) abc)) 1)                     ; abcd is in the outer let
(test (let () (letrec ((lst (define abcd 1))) #f) abcd) 'error)        ; abcd: unbound variable
(test (let () (letrec ((lst (define abcd 1))) abcd)) 1)
(test (let? (let () (letrec ((lst (define abcd 1))) (curlet)))) #t)
(test (let () (letrec* ((lst (define abcd 1))) abcd)) 1)               ; unproblematic because no pending value
;(test (let () (define (f a) (if (symbol? a) b 0)) (f (define b 3))) 3) ; 25-Jul-14
(test (let () (+ (define b 1) (* b 2))) 3)
(test (let () (if (define b 3) b)) 3)
(test (let () (do ((i (define b 3)) (j 0 (+ j 1))) ((= j 0) b))) 3)
(test (let () (define* (f (a (define b 3))) a) (f) b) 'error)          ; ?? where is b?
(test (let () (define* (f (a (define b 3))) b) (f)) 3)                 ; inside the func apparently! 3 cases? let->outer letrec->cur, func->inner!
;(test (let () (define* (f (a (define a 3))) a) (f)) 'a)                ; yow -- no duplicate id check! 25-Jul-14
(test (let () (define* (f (a 1) (b (define a 3))) a) (f 2)) 3)
(test (let () (define-macro* (f (a 1) (b (define a 3))) a) (f 2)) 2)   ; also bacro -- b is '(define a 3)!
;(test (let () (letrec ((a (define a 3))) a)) 'a)                       ; letrec is the same (it checks normally) 25-Jul-14
(test (let () (letrec ((a 1) (b (define a 3))) a)) 1)
(test (let () (letrec* ((a 1) (b (define a 3))) a)) 3)                 ; same difference in let/let*
(test (let () (letrec ((a 1) (b (set! a 3))) a)) 1)
(test (let () (letrec* ((a 1) (b (set! a 3))) a)) 3)                   ; here the let case is an error, let* is 3
;(test (let () (list (with-let (sublet (curlet) (cons 'b (define b 3))) b) ((curlet) 'b))) '(b 3)) ; 2 b's with 1 define
;(test (let () (list (with-let (varlet (curlet) (cons 'b (define b 3))) b) ((curlet) 'b))) '(b b))

(let ()
  (define (f64 arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7 arg8 arg9 arg10 arg11 arg12 arg13 arg14 arg15 arg16 arg17 arg18 arg19 arg20 arg21 arg22 arg23 arg24 arg25 arg26 arg27 arg28 arg29 arg30 arg31 arg32 arg33 arg34 arg35 arg36 arg37 arg38 arg39 arg40 arg41 arg42 arg43 arg44 arg45 arg46 arg47 arg48 arg49 arg50 arg51 arg52 arg53 arg54 arg55 arg56 arg57 arg58 arg59 arg60 arg61 arg62 arg63 arg64) 
    (+ arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7 arg8 arg9 arg10 arg11 arg12 arg13 arg14 arg15 arg16 arg17 arg18 arg19 arg20 arg21 arg22 arg23 arg24 arg25 arg26 arg27 arg28 arg29 arg30 arg31 arg32 arg33 arg34 arg35 arg36 arg37 arg38 arg39 arg40 arg41 arg42 arg43 arg44 arg45 arg46 arg47 arg48 arg49 arg50 arg51 arg52 arg53 arg54 arg55 arg56 arg57 arg58 arg59 arg60 arg61 arg62 arg63 arg64))
  (test (f64 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64) 
	2080))

#|
(let ((n 12))
  (let ((nums (do ((lst () (cons i lst))
		   (i 0 (+ i 1)))
		  ((> i n) (reverse lst)))))
    (format #t "(let ((f~D (lambda (~{arg~D~^ ~})~%    (+ ~{arg~D~^ ~}))))~%  (f~D ~{~D~^ ~}))~%" n nums nums n nums)))
|#

(test (let ((f128 (lambda (arg128 arg127 arg126 arg125 arg124 arg123 arg122 arg121 arg120 arg119 arg118 arg117 arg116 arg115 arg114 arg113 arg112 arg111 arg110 arg109 arg108 arg107 arg106 arg105 arg104 arg103 arg102 arg101 arg100 arg99 arg98 arg97 arg96 arg95 arg94 arg93 arg92 arg91 arg90 arg89 arg88 arg87 arg86 arg85 arg84 arg83 arg82 arg81 arg80 arg79 arg78 arg77 arg76 arg75 arg74 arg73 arg72 arg71 arg70 arg69 arg68 arg67 arg66 arg65 arg64 arg63 arg62 arg61 arg60 arg59 arg58 arg57 arg56 arg55 arg54 arg53 arg52 arg51 arg50 arg49 arg48 arg47 arg46 arg45 arg44 arg43 arg42 arg41 arg40 arg39 arg38 arg37 arg36 arg35 arg34 arg33 arg32 arg31 arg30 arg29 arg28 arg27 arg26 arg25 arg24 arg23 arg22 arg21 arg20 arg19 arg18 arg17 arg16 arg15 arg14 arg13 arg12 arg11 arg10 arg9 arg8 arg7 arg6 arg5 arg4 arg3 arg2 arg1 arg0)
		    (+ arg128 arg127 arg126 arg125 arg124 arg123 arg122 arg121 arg120 arg119 arg118 arg117 arg116 arg115 arg114 arg113 arg112 arg111 arg110 arg109 arg108 arg107 arg106 arg105 arg104 arg103 arg102 arg101 arg100 arg99 arg98 arg97 arg96 arg95 arg94 arg93 arg92 arg91 arg90 arg89 arg88 arg87 arg86 arg85 arg84 arg83 arg82 arg81 arg80 arg79 arg78 arg77 arg76 arg75 arg74 arg73 arg72 arg71 arg70 arg69 arg68 arg67 arg66 arg65 arg64 arg63 arg62 arg61 arg60 arg59 arg58 arg57 arg56 arg55 arg54 arg53 arg52 arg51 arg50 arg49 arg48 arg47 arg46 arg45 arg44 arg43 arg42 arg41 arg40 arg39 arg38 arg37 arg36 arg35 arg34 arg33 arg32 arg31 arg30 arg29 arg28 arg27 arg26 arg25 arg24 arg23 arg22 arg21 arg20 arg19 arg18 arg17 arg16 arg15 arg14 arg13 arg12 arg11 arg10 arg9 arg8 arg7 arg6 arg5 arg4 arg3 arg2 arg1 arg0))))
	(f128 128 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0))
      8256)

(test (let ((f512 (lambda (arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7 arg8 arg9 arg10 arg11 arg12 arg13 arg14 arg15 arg16 arg17 arg18 arg19 arg20 arg21 arg22 arg23 arg24 arg25 arg26 arg27 arg28 arg29 arg30 arg31 arg32 arg33 arg34 arg35 arg36 arg37 arg38 arg39 arg40 arg41 arg42 arg43 arg44 arg45 arg46 arg47 arg48 arg49 arg50 arg51 arg52 arg53 arg54 arg55 arg56 arg57 arg58 arg59 arg60 arg61 arg62 arg63 arg64 arg65 arg66 arg67 arg68 arg69 arg70 arg71 arg72 arg73 arg74 arg75 arg76 arg77 arg78 arg79 arg80 arg81 arg82 arg83 arg84 arg85 arg86 arg87 arg88 arg89 arg90 arg91 arg92 arg93 arg94 arg95 arg96 arg97 arg98 arg99 arg100 arg101 arg102 arg103 arg104 arg105 arg106 arg107 arg108 arg109 arg110 arg111 arg112 arg113 arg114 arg115 arg116 arg117 arg118 arg119 arg120 arg121 arg122 arg123 arg124 arg125 arg126 arg127 arg128 arg129 arg130 arg131 arg132 arg133 arg134 arg135 arg136 arg137 arg138 arg139 arg140 arg141 arg142 arg143 arg144 arg145 arg146 arg147 arg148 arg149 arg150 arg151 arg152 arg153 arg154 arg155 arg156 arg157 arg158 arg159 arg160 arg161 arg162 arg163 arg164 arg165 arg166 arg167 arg168 arg169 arg170 arg171 arg172 arg173 arg174 arg175 arg176 arg177 arg178 arg179 arg180 arg181 arg182 arg183 arg184 arg185 arg186 arg187 arg188 arg189 arg190 arg191 arg192 arg193 arg194 arg195 arg196 arg197 arg198 arg199 arg200 arg201 arg202 arg203 arg204 arg205 arg206 arg207 arg208 arg209 arg210 arg211 arg212 arg213 arg214 arg215 arg216 arg217 arg218 arg219 arg220 arg221 arg222 arg223 arg224 arg225 arg226 arg227 arg228 arg229 arg230 arg231 arg232 arg233 arg234 arg235 arg236 arg237 arg238 arg239 arg240 arg241 arg242 arg243 arg244 arg245 arg246 arg247 arg248 arg249 arg250 arg251 arg252 arg253 arg254 arg255 arg256 arg257 arg258 arg259 arg260 arg261 arg262 arg263 arg264 arg265 arg266 arg267 arg268 arg269 arg270 arg271 arg272 arg273 arg274 arg275 arg276 arg277 arg278 arg279 arg280 arg281 arg282 arg283 arg284 arg285 arg286 arg287 arg288 arg289 arg290 arg291 arg292 arg293 arg294 arg295 arg296 arg297 arg298 arg299 arg300 arg301 arg302 arg303 arg304 arg305 arg306 arg307 arg308 arg309 arg310 arg311 arg312 arg313 arg314 arg315 arg316 arg317 arg318 arg319 arg320 arg321 arg322 arg323 arg324 arg325 arg326 arg327 arg328 arg329 arg330 arg331 arg332 arg333 arg334 arg335 arg336 arg337 arg338 arg339 arg340 arg341 arg342 arg343 arg344 arg345 arg346 arg347 arg348 arg349 arg350 arg351 arg352 arg353 arg354 arg355 arg356 arg357 arg358 arg359 arg360 arg361 arg362 arg363 arg364 arg365 arg366 arg367 arg368 arg369 arg370 arg371 arg372 arg373 arg374 arg375 arg376 arg377 arg378 arg379 arg380 arg381 arg382 arg383 arg384 arg385 arg386 arg387 arg388 arg389 arg390 arg391 arg392 arg393 arg394 arg395 arg396 arg397 arg398 arg399 arg400 arg401 arg402 arg403 arg404 arg405 arg406 arg407 arg408 arg409 arg410 arg411 arg412 arg413 arg414 arg415 arg416 arg417 arg418 arg419 arg420 arg421 arg422 arg423 arg424 arg425 arg426 arg427 arg428 arg429 arg430 arg431 arg432 arg433 arg434 arg435 arg436 arg437 arg438 arg439 arg440 arg441 arg442 arg443 arg444 arg445 arg446 arg447 arg448 arg449 arg450 arg451 arg452 arg453 arg454 arg455 arg456 arg457 arg458 arg459 arg460 arg461 arg462 arg463 arg464 arg465 arg466 arg467 arg468 arg469 arg470 arg471 arg472 arg473 arg474 arg475 arg476 arg477 arg478 arg479 arg480 arg481 arg482 arg483 arg484 arg485 arg486 arg487 arg488 arg489 arg490 arg491 arg492 arg493 arg494 arg495 arg496 arg497 arg498 arg499 arg500 arg501 arg502 arg503 arg504 arg505 arg506 arg507 arg508 arg509 arg510 arg511 arg512)
    (+ arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7 arg8 arg9 arg10 arg11 arg12 arg13 arg14 arg15 arg16 arg17 arg18 arg19 arg20 arg21 arg22 arg23 arg24 arg25 arg26 arg27 arg28 arg29 arg30 arg31 arg32 arg33 arg34 arg35 arg36 arg37 arg38 arg39 arg40 arg41 arg42 arg43 arg44 arg45 arg46 arg47 arg48 arg49 arg50 arg51 arg52 arg53 arg54 arg55 arg56 arg57 arg58 arg59 arg60 arg61 arg62 arg63 arg64 arg65 arg66 arg67 arg68 arg69 arg70 arg71 arg72 arg73 arg74 arg75 arg76 arg77 arg78 arg79 arg80 arg81 arg82 arg83 arg84 arg85 arg86 arg87 arg88 arg89 arg90 arg91 arg92 arg93 arg94 arg95 arg96 arg97 arg98 arg99 arg100 arg101 arg102 arg103 arg104 arg105 arg106 arg107 arg108 arg109 arg110 arg111 arg112 arg113 arg114 arg115 arg116 arg117 arg118 arg119 arg120 arg121 arg122 arg123 arg124 arg125 arg126 arg127 arg128 arg129 arg130 arg131 arg132 arg133 arg134 arg135 arg136 arg137 arg138 arg139 arg140 arg141 arg142 arg143 arg144 arg145 arg146 arg147 arg148 arg149 arg150 arg151 arg152 arg153 arg154 arg155 arg156 arg157 arg158 arg159 arg160 arg161 arg162 arg163 arg164 arg165 arg166 arg167 arg168 arg169 arg170 arg171 arg172 arg173 arg174 arg175 arg176 arg177 arg178 arg179 arg180 arg181 arg182 arg183 arg184 arg185 arg186 arg187 arg188 arg189 arg190 arg191 arg192 arg193 arg194 arg195 arg196 arg197 arg198 arg199 arg200 arg201 arg202 arg203 arg204 arg205 arg206 arg207 arg208 arg209 arg210 arg211 arg212 arg213 arg214 arg215 arg216 arg217 arg218 arg219 arg220 arg221 arg222 arg223 arg224 arg225 arg226 arg227 arg228 arg229 arg230 arg231 arg232 arg233 arg234 arg235 arg236 arg237 arg238 arg239 arg240 arg241 arg242 arg243 arg244 arg245 arg246 arg247 arg248 arg249 arg250 arg251 arg252 arg253 arg254 arg255 arg256 arg257 arg258 arg259 arg260 arg261 arg262 arg263 arg264 arg265 arg266 arg267 arg268 arg269 arg270 arg271 arg272 arg273 arg274 arg275 arg276 arg277 arg278 arg279 arg280 arg281 arg282 arg283 arg284 arg285 arg286 arg287 arg288 arg289 arg290 arg291 arg292 arg293 arg294 arg295 arg296 arg297 arg298 arg299 arg300 arg301 arg302 arg303 arg304 arg305 arg306 arg307 arg308 arg309 arg310 arg311 arg312 arg313 arg314 arg315 arg316 arg317 arg318 arg319 arg320 arg321 arg322 arg323 arg324 arg325 arg326 arg327 arg328 arg329 arg330 arg331 arg332 arg333 arg334 arg335 arg336 arg337 arg338 arg339 arg340 arg341 arg342 arg343 arg344 arg345 arg346 arg347 arg348 arg349 arg350 arg351 arg352 arg353 arg354 arg355 arg356 arg357 arg358 arg359 arg360 arg361 arg362 arg363 arg364 arg365 arg366 arg367 arg368 arg369 arg370 arg371 arg372 arg373 arg374 arg375 arg376 arg377 arg378 arg379 arg380 arg381 arg382 arg383 arg384 arg385 arg386 arg387 arg388 arg389 arg390 arg391 arg392 arg393 arg394 arg395 arg396 arg397 arg398 arg399 arg400 arg401 arg402 arg403 arg404 arg405 arg406 arg407 arg408 arg409 arg410 arg411 arg412 arg413 arg414 arg415 arg416 arg417 arg418 arg419 arg420 arg421 arg422 arg423 arg424 arg425 arg426 arg427 arg428 arg429 arg430 arg431 arg432 arg433 arg434 arg435 arg436 arg437 arg438 arg439 arg440 arg441 arg442 arg443 arg444 arg445 arg446 arg447 arg448 arg449 arg450 arg451 arg452 arg453 arg454 arg455 arg456 arg457 arg458 arg459 arg460 arg461 arg462 arg463 arg464 arg465 arg466 arg467 arg468 arg469 arg470 arg471 arg472 arg473 arg474 arg475 arg476 arg477 arg478 arg479 arg480 arg481 arg482 arg483 arg484 arg485 arg486 arg487 arg488 arg489 arg490 arg491 arg492 arg493 arg494 arg495 arg496 arg497 arg498 arg499 arg500 arg501 arg502 arg503 arg504 arg505 arg506 arg507 arg508 arg509 arg510 arg511 arg512))))
  (f512 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512))
      131328)


(let ((x 32))
  (define (f1) x)
  (define x 33)
  (test (f1) 33))

(let ()
  (define (c-2)
    (let ((v (vector 1 2 3)))
      (define (c-1 a b) (+ (vector-ref a 0) (* b 32)))
      (let ((c (c-1 v 1)))
	(test c 33)
	(set! c-1 vector-ref))
      (let ((d (c-1 v 1)))
	(test d 2))))
  (c-2))

(let ()
  (define (c-2)
    (let ((v (vector 1 2 3)))
      (let ()
	(define (c-1 a b) (+ (vector-ref a 0) (* b 32)))
	(let ((c (c-1 v 1)))
	  (set! c-1 vector-ref)))
      (test (c-1 v 1) 'error)))
  (c-2))
(let ()
  (define (f4 a b c d e) (list a b c d e))
  (test (f4 1 2 3 4 5) '(1 2 3 4 5)))

(let-temporarily (((*s7* 'safety) 1))
  (define (redef-1 a) (+ a 1))
  (define (use-redef-1 b) (+ (redef-1 b) 2))     ; [use-redef](+ [redef-1](+ b 1) 2)
  (test (use-redef-1 3) 6)                       ; b=6
  (define (redef-1 a) (+ a 4))
  (test (use-redef-1 3) 9)                       ; [use-redef-1](+ [redef-1](+ a 4) 2), a=3
  (let ()
    (define (use-redef-2 c) (+ (redef-1 c) 5))   ; [use-redef-2](+ [redef-1](+ a 4) 5)
    (test (use-redef-2 6) 15)                    ; a=6
    (define (redef-1 a) (+ a 7))                 ; so use-redef-1 is still [use-redef-1](+ [redef-1](+ a 4) 2)
    (test (use-redef-1 8) 14)                    ; a=8 -> 14
    (test (use-redef-2 8) 20)))                  ; but use-redef-2 (same let as shadowing use-redef-1) is (+ [new redef-1](+ a 7) 5), a=8 -> 20

(test (let () (define (f1 x) (abs x)) (define (f2 x) (f1 x)) (f2 -1)) 1) ; just trying to hit a portion of the s7 code

(when with-block
  (let ()
    (define (f1) ((lambda (x) (cf11 x)) 3)) (f1) 
    (define (f2) ((lambda () (cf21 3 4)))) (f2) 
    (define (f3) ((lambda () (cf11 3)))) (f3) 
    (define (f4) ((lambda (x) (cf11 'x)) 4)) (f4) 
    
    (define (f5) ((lambda (x) (cf21 x 4)) 3)) (f5) 
    (define (f6) ((lambda (x) (cf21 3 x)) 4)) (f6) 
    (define (f7) ((lambda (x) (cf21 3 4)) 4)) (f7) 
    (define (f8) ((lambda (x y) (cf21 x y)) 3 4)) (f8) 
    
    (define (f9) ((lambda (x) (cf21 x 'y)) 'x)) (f9) 
    (define (f10) ((lambda (x) (cf21 'y x)) 'x)) (f10) 
    (define (f11) ((lambda (x) (cf21 'y 'x)) 'x)) (f11) 
    (define (f12) ((lambda (x) (cf21 1 'x)) 'x)) (f12) 
    (define (f13) ((lambda (x) (cf21 'x 1)) 'x)) (f13) 
    
    (define (f14) ((lambda (x y z) (cf31 x y z)) 1 2 3)) (f14)
    (define (f15) ((lambda (x y z) (cf31 x 2 z)) 1 2 3)) (f15)
    (define (f16) ((lambda (x y z) (cf31 x y 2)) 1 2 3)) (f16)
    (define (f17) ((lambda (x y z) (cf31 2 y z)) 1 2 3)) (f17)
    
    (define (f18) ((lambda (w x y z) (cf41 w x y z)) 1 2 3 4)) (f18)
    (define (f19) ((lambda (x y z) (cf31 x 'y z)) 1 2 3)) (f19)
    (define (f20) ((lambda (x y z) (cf41 'q x y z)) 1 2 3)) (f20)
    (define (f21) ((lambda (x y) (cf31 x y (+ x 6))) 1 2)) (f21)
    (define (f22) ((lambda (x y) (cf31 1 y (+ x 6))) 1 2)) (f22)
    (define (f23) ((lambda (x y) (cf31 x 1 (+ x 6))) 1 2)) (f23)
    (define (f24) ((lambda (x y) (cf31 1 (+ x 6) y)) 1 2)) (f24)
    (define (f25) ((lambda (x) (cf11 (cf11 'x))) 1)) (f25)
    
    (define (f26) ((lambda (w x y z) (cf51 'q w x y z)) 1 2 3 4)) (f26)
    (define (f27) ((lambda (w x y) (cf21 (cf21 (cf11 w) (cf11 x)) (cf11 y))) 1 2 3)) (f27)
    (define (f28) ((lambda (w x y) (cf31 (cf21 w x) 2 y)) 1 2 3)) (f28)
    
    (define (f29) ((lambda () (cf11 (cf11 0))))) (f29)
    (define (f30) ((lambda (x) (cf11 (cf11 x))) 0)) (f30)
    (define (f31) ((lambda (x) (cf11 (cf10 x))) 0)) (f31)
    (define (f32) ((lambda (x) (cf11 (cf10 'x))) 1)) (f32)
    (define (f33) ((lambda (w x y) (cf31 (cf20 w x) 2 y)) 1 2 3)) (f33)
    (define (f34) ((lambda (w x y) (cf22 (cf21 (cf11 w) (cf11 x)) (cf10 y))) 1 2 3)) (f34)
    (define (f35) ((lambda (w x y) (cf21 (cf20 (cf11 w) (cf11 x)) (cf11 y))) 1 2 3)) (f35)
    (define (f36) ((lambda (w x y) (cf21 (cf21 (cf10 w) (cf11 x)) (cf11 y))) 1 2 3)) (f36)
    
    (define (f37) ((lambda (x y) (cf33 x y (cf20 x 6))) 1 2)) (f37)
    (define (f38) ((lambda (x y) (cf33 1 y (cf20 x 6))) 1 2)) (f38)
    (define (f39) ((lambda (x y) (cf33 x 1 (cf20 x 6))) 1 2)) (f39)
    (define (f40) ((lambda (x y) (cf32 1 (cf20 x 6) y)) 1 2)) (f40)
    
    (define (f41) ((lambda (x y) (cf11 (cf21 x y))) 1 2)) (f41)
    (define (f42) ((lambda (x y) (cf11 (cf21 x 2))) 1 2)) (f42)
    (define (f43) ((lambda (x y) (cf11 (cf21 1 x))) 1 2)) (f43)
    (define (f44) ((lambda (x y) (cf21 x (cf11 y))) 1 2)) (f44)
    (define (f45) ((lambda (x y) (cf21 (cf11 x) y)) 1 2)) (f45)
    (define (f46) ((lambda (x y) (cf21 (cf11 x) 2)) 1 2)) (f46)
    (define (f47) ((lambda (x y) (cf21 (cf11 x) (cf11 y))) 1 2)) (f47)
    
    (define (f48) ((lambda (x y) (cf11 (cf20 x y))) 1 2)) (f48)
    (define (f49) ((lambda (x y) (cf11 (cf20 x 2))) 1 2)) (f49)
    (define (f50) ((lambda (x y) (cf11 (cf20 1 x))) 1 2)) (f50)
    (define (f51) ((lambda (x y) (cf22 x (cf10 y))) 1 2)) (f51)
    (define (f52) ((lambda (x y) (cf21 (cf10 x) y)) 1 2)) (f52)
    (define (f53) ((lambda (x y) (cf21 (cf10 x) 2)) 1 2)) (f53)
    (define (f54) ((lambda (x y) (cf21 (cf10 x) (cf11 y))) 1 2)) (f54)
    (define (f55) ((lambda (x y) (cf22 (cf11 x) (cf10 y))) 1 2)) (f55)
    
    (define (f56) ((lambda (x y) (cf21 1 (cf11 y))) 1 2)) (f56)
    (define (f57) ((lambda (x y) (cf22 1 (cf10 y))) 1 2)) (f57)
    (define (f58) ((lambda (x y z) (cf21 x (cf21 y z))) 1 2 3)) (f58)
    (define (f59) ((lambda (x y z) (cf22 x (cf20 y z))) 1 2 3)) (f59)
    (define (f60) ((lambda (x y z) (cf21 x (cf21 2 z))) 1 2 3)) (f60)
    (define (f61) ((lambda (x y z) (cf22 x (cf20 2 z))) 1 2 3)) (f61)
    (define (f62) ((lambda (x y z) (cf21 x (cf21 y 3))) 1 2 3)) (f62)
    (define (f63) ((lambda (x y z) (cf22 x (cf20 y 3))) 1 2 3)) (f63)
    (define (f64) ((lambda (x y z) (cf21 1 (cf21 2 z))) 1 2 3)) (f64)
    (define (f65) ((lambda (x y z) (cf22 1 (cf20 2 z))) 1 2 3)) (f65)
    (define (f66) ((lambda (x y z) (cf21 1 (cf21 y 3))) 1 2 3)) (f66)
    (define (f67) ((lambda (x y z) (cf22 1 (cf20 y 3))) 1 2 3)) (f67)
    
    (define (f68) ((lambda (x) (cf21 (cf21 2 x) 3)) 1)) (f68)
    (define (f69) ((lambda (x) (cf21 (cf20 2 x) 3)) 1)) (f69)
    (define (f70) ((lambda (x y) (cf21 1 (cf21 x y))) 2 3)) (f70)
    (define (f71) ((lambda (x y) (cf22 1 (cf20 x y))) 2 3)) (f71)
    (define (f72) ((lambda (x y) (cf21 (cf21 x y) 3)) 1 2)) (f72)
    (define (f73) ((lambda (x y) (cf21 (cf20 x y) 3)) 1 2)) (f73)
    
    (define (f74) ((lambda (x) (cf11 (cf21 x 'y))) 1)) (f74)
    (define (f75) ((lambda (x) (cf11 (cf20 x 'y))) 1)) (f75)
    (define (f76) ((lambda (x) (cf21 x (cf11 2))) 1)) (f76)
    (define (f77) ((lambda (x) (cf22 x (cf10 2))) 1)) (f77)
    (define (f78) ((lambda (x) (cf21 1 (cf11 2))) 1)) (f78)
    (define (f79) ((lambda (x) (cf22 1 (cf10 2))) 1)) (f79)
    (define (f80) ((lambda (x) (cf21 (cf11 1) x)) 2)) (f80)
    (define (f81) ((lambda (x) (cf21 (cf10 1) x)) 2)) (f81)
    (define (f82) ((lambda (x y z) (cf21 (cf21 x y) z)) 1 2 3)) (f82)
    (define (f83) ((lambda (x y z) (cf21 (cf20 x y) z)) 1 2 3)) (f83)
    (define (f84) ((lambda (x y z) (cf21 (cf21 x 2) z)) 1 2 3)) (f84)
    (define (f85) ((lambda (x y z) (cf21 (cf20 x 2) z)) 1 2 3)) (f85)
    (define (f86) ((lambda (x y z) (cf21 (cf21 1 y) z)) 1 2 3)) (f86)
    (define (f87) ((lambda (x y z) (cf21 (cf20 1 y) z)) 1 2 3)) (f87)
    (define (f88) ((lambda (x y z) (cf21 (cf21 x 2) 3)) 1 2 3)) (f88)
    (define (f89) ((lambda (x y z) (cf21 (cf20 x 2) 3)) 1 2 3)) (f89)
    (define (f90) ((lambda (x) (cf21 (cf11 1) 2)) 2)) (f90)
    (define (f91) ((lambda (x) (cf21 (cf10 1) 2)) 2)) (f91)
    
    (define (f92) ((lambda (w x y z) (cf21 (cf21 w x) (cf21 y z))) 1 2 3 4)) (f92)
    (define (f93) ((lambda (w x y z) (cf22 (cf21 w x) (cf20 y z))) 1 2 3 4)) (f93)
    (define (f94) ((lambda (w x y z) (cf21 (cf20 w x) (cf21 y z))) 1 2 3 4)) (f94)
    (define (f95) ((lambda (w x y z) (cf21 (cf21 w 2) (cf21 y 4))) 1 2 3 4)) (f95)
    (define (f96) ((lambda (w x y z) (cf22 (cf21 w 2) (cf20 y 4))) 1 2 3 4)) (f96)
    (define (f97) ((lambda (w x y z) (cf21 (cf20 w 2) (cf21 y 4))) 1 2 3 4)) (f97)
    (define (f98) ((lambda (x y z) (cf21 (cf11 x) (cf21 y z))) 1 2 3)) (f98)
    (define (f99) ((lambda (x y z) (cf22 (cf11 x) (cf20 y z))) 1 2 3)) (f99)
    (define (f100) ((lambda (x y z) (cf21 (cf10 x) (cf21 y z))) 1 2 3)) (f100)
    (define (f101) ((lambda (x y z) (cf21 (cf21 x y) (cf11 z))) 1 2 3)) (f101)
    (define (f102) ((lambda (x y z) (cf22 (cf21 x y) (cf10 z))) 1 2 3)) (f102)
    (define (f103) ((lambda (x y z) (cf21 (cf20 x y) (cf11 z))) 1 2 3)) (f103)
    (define (f104) ((lambda (x y z) (cf21 (cf21 x y) (cf11 3))) 1 2 3)) (f104)
    (define (f105) ((lambda (x y z) (cf22 (cf21 x y) (cf10 3))) 1 2 3)) (f105)
    (define (f106) ((lambda (x y z) (cf21 (cf20 x y) (cf11 3))) 1 2 3)) (f106)
    (define (f107) ((lambda (x y z) (cf21 (cf11 1) (cf21 y z))) 1 2 3)) (f107)
    (define (f108) ((lambda (x y z) (cf22 (cf11 1) (cf20 y z))) 1 2 3)) (f108)
    (define (f109) ((lambda (x y z) (cf21 (cf10 1) (cf21 y z))) 1 2 3)) (f109)
    (define (f110) ((lambda () (cf21 (cf11 1) (cf11 2))))) (f110)
    (define (f111) ((lambda () (cf22 (cf11 1) (cf10 2))))) (f111)
    (define (f112) ((lambda () (cf21 (cf10 1) (cf11 2))))) (f112)
    
    (define (f113) ((lambda (x) (cf11 (cf11 (cf11 x)))) 1)) (f113)
    (define (f114) ((lambda (x) (cf11 (cf11 (cf10 x)))) 1)) (f114)
    (define (f115) ((lambda (x) (cf11 (cf10 (cf11 x)))) 1)) (f115)
    (define (f116) ((lambda (w x y z) (cf22 w (cf21 (cf21 x y) z))) 1 2 3 4)) (f116)
    (define (f117) ((lambda (w x y z) (cf22 w (cf20 (cf21 x y) z))) 1 2 3 4)) (f117)
    (define (f118) ((lambda (w x y z) (cf22 w (cf21 (cf20 x y) z))) 1 2 3 4)) (f118)
    
    (define (f119) ((lambda (w x y z) (cf22 w (cf22 x (cf21 y z)))) 1 2 3 4)) (f119)
    (define (f120) ((lambda (w x y z) (cf22 w (cf20 x (cf21 y z)))) 1 2 3 4)) (f120)
    (define (f121) ((lambda (w x y z) (cf22 w (cf22 x (cf20 y z)))) 1 2 3 4)) (f121)
    
    (define (f122) ((lambda (x y) (cf11 (cf32 1 (cf21 x y) 4))) 2 3)) (f122) ; c_z
    (define (f123) ((lambda (x y) (cf11 (cf32 1 (cf20 x y) 4))) 2 3)) (f123) 
    (define (f124) ((lambda (x y) (cf11 (cf30 1 (cf21 x y) 4))) 2 3)) (f124)
    
    (define (f125) ((lambda (x y) (cf21 (cf11 (cf21 x y)) 3)) 1 2)) (f125)
    (define (f126) ((lambda (x y) (cf21 (cf10 (cf21 x y)) 3)) 1 2)) (f126)
    (define (f127) ((lambda (x y) (cf21 (cf11 (cf20 x y)) 3)) 1 2)) (f127)
    
    (define (f128) ((lambda (x) (cf22 1 (cf21 x (cf11 3)))) 2)) (f128)
    (define (f129) ((lambda (x) (cf22 1 (cf20 x (cf11 3)))) 2)) (f129)
    (define (f130) ((lambda (x) (cf22 1 (cf22 x (cf10 3)))) 2)) (f130)
    
    (define (f131) ((lambda (x y z) (cf22 x (cf21 (cf21 y z) (cf21 z y)))) 1 2 3)) (f131)
    (define (f132) ((lambda (x y z) (cf22 x (cf20 (cf21 y z) (cf21 z y)))) 1 2 3)) (f132)
    (define (f133) ((lambda (x y z) (cf22 x (cf21 (cf20 y z) (cf21 z y)))) 1 2 3)) (f133)
    (define (f134) ((lambda (x y z) (cf22 x (cf22 (cf21 y z) (cf20 z y)))) 1 2 3)) (f134)
    
    (define (f135) ((lambda (x y z) (cf21 (cf21 x y) (cf11 (cf21 y z)))) 1 2 3)) (f135)
    (define (f136) ((lambda (x y z) (cf21 (cf20 x y) (cf11 (cf21 y z)))) 1 2 3)) (f136)
    (define (f137) ((lambda (x y z) (cf22 (cf21 x y) (cf10 (cf21 y z)))) 1 2 3)) (f137)
    (define (f138) ((lambda (x y z) (cf22 (cf21 x y) (cf11 (cf20 y z)))) 1 2 3)) (f138)
    
    (define (f139) ((lambda (x y z) (cf21 (cf21 (cf21 x y) z) (cf21 y z))) 1 2 3)) (f139)
    (define (f140) ((lambda (x y z) (cf21 (cf20 (cf21 x y) z) (cf21 y z))) 1 2 3)) (f140)
    (define (f141) ((lambda (x y z) (cf21 (cf21 (cf20 x y) z) (cf21 y z))) 1 2 3)) (f141)
    (define (f142) ((lambda (x y z) (cf22 (cf21 (cf21 x y) z) (cf20 y z))) 1 2 3)) (f142)
    
    (define (f143) ((lambda (x y z) (cf22 x (cf21 (cf11 (cf21 x y)) (cf11 (cf21 y z))))) 1 2 3)) (f143)
    (define (f144) ((lambda (x y z) (cf22 x (cf20 (cf11 (cf21 x y)) (cf11 (cf21 y z))))) 1 2 3)) (f144)
    (define (f145) ((lambda (x y z) (cf22 x (cf21 (cf10 (cf21 x y)) (cf11 (cf21 y z))))) 1 2 3)) (f145)
    (define (f146) ((lambda (x y z) (cf22 x (cf21 (cf11 (cf20 x y)) (cf11 (cf21 y z))))) 1 2 3)) (f146)
    (define (f147) ((lambda (x y z) (cf22 x (cf22 (cf11 (cf21 x y)) (cf10 (cf21 y z))))) 1 2 3)) (f147)
    (define (f148) ((lambda (x y z) (cf22 x (cf22 (cf11 (cf21 x y)) (cf11 (cf20 y z))))) 1 2 3)) (f148)
    
    (define (f149) ((lambda (x y z) (cf22 x (cf31 (cf11 y) (cf11 z) (cf11 z)))) 1 2 3)) (f149)
    (define (f150) ((lambda (x y z) (cf22 x (cf30 (cf11 y) (cf11 z) (cf11 z)))) 1 2 3)) (f150)
    (define (f151) ((lambda (x y z) (cf22 x (cf31 (cf10 y) (cf11 z) (cf11 z)))) 1 2 3)) (f151)
    (define (f152) ((lambda (x y z) (cf22 x (cf32 (cf11 y) (cf10 z) (cf11 z)))) 1 2 3)) (f152)
    (define (f153) ((lambda (x y z) (cf22 x (cf33 (cf11 y) (cf11 z) (cf10 z)))) 1 2 3)) (f153)
    
    (define (f154) ((lambda (x y z) (cf21 (cf32 1 (cf21 x y) 4) (cf32 1 (cf21 y z) 4))) 1 2 3)) (f154)
    (define (f155) ((lambda (x y z) (cf21 (cf32 1 (cf20 x y) 4) (cf32 1 (cf21 y z) 4))) 1 2 3)) (f155)
    (define (f156) ((lambda (x y z) (cf22 (cf32 1 (cf21 x y) 4) (cf30 1 (cf21 y z) 4))) 1 2 3)) (f156)
    
    (define (f157) ((lambda (x y z) (cf22 x (cf32 1 (cf21 y z) 4))) 1 2 3)) (f157)
    (define (f158) ((lambda (x y z) (cf22 x (cf32 1 (cf20 y z) 4))) 1 2 3)) (f158)
    
    (define (f159) ((lambda (x y z) (cf21 (cf32 1 (cf21 y z) 4) x)) 1 2 3)) (f159)
    (define (f160) ((lambda (x y z) (cf21 (cf30 1 (cf20 y z) 4) x)) 1 2 3)) (f160)
    
    (define (f161) ((lambda (x y z) (cf22 1 (cf32 1 (cf21 y z) 4))) 1 2 3)) (f161)
    (define (f162) ((lambda (x y z) (cf22 1 (cf32 1 (cf20 y z) 4))) 1 2 3)) (f162)
    
    (define (f163) ((lambda (x y z) (cf21 (cf32 1 (cf21 y z) 4) x)) 1 2 3)) (f163)
    (define (f164) ((lambda (x y z) (cf21 (cf30 1 (cf20 y z) 4) x)) 1 2 3)) (f164)
    
    ;; --------
    (test (f1) 3) (test (f2) 3) (test (f3) 3) (test (f4) 'x) (test (f5) 3) (test (f6) 3) (test (f7) 3)
    (test (f8) 3) (test (f9) 'x) (test (f10) 'y) (test (f11) 'y) (test (f12) 1) (test (f13) 'x) (test (f14) 1)
    (test (f15) 1) (test (f16) 1) (test (f17) 2) (test (f18) 1) (test (f19) 1) (test (f20) 'q) (test (f21) 1)
    (test (f22) 1) (test (f23) 1) (test (f24) 1) (test (f25) 'x) (test (f26) 'q) (test (f27) 1) (test (f28) 1)
    (test (f29) 0) (test (f30) 0) (test (f31) 0) (test (f32) 'x) (test (f33) 1) (test (f34) 3) (test (f35) 1)
    (test (f36) 1) (test (f37) 1) (test (f38) 1) (test (f39) 1) (test (f40) 1) (test (f41) 1) (test (f42) 1)
    (test (f43) 1) (test (f44) 1) (test (f45) 1) (test (f46) 1) (test (f47) 1) (test (f48) 1) (test (f49) 1)
    (test (f50) 1) (test (f51) 2) (test (f52) 1) (test (f53) 1) (test (f54) 1) (test (f55) 2) (test (f56) 1)
    (test (f57) 2) (test (f58) 1) (test (f59) 2) (test (f60) 1) (test (f61) 2) (test (f62) 1) (test (f63) 2) 
    (test (f64) 1) (test (f65) 2) (test (f66) 1) (test (f67) 2) (test (f68) 2) (test (f69) 2) (test (f70) 1)
    (test (f71) 2) (test (f72) 1) (test (f73) 1) (test (f74) 1) (test (f75) 1) (test (f76) 1) (test (f77) 2)
    (test (f78) 1) (test (f79) 2) (test (f80) 1) (test (f81) 1) (test (f82) 1) (test (f83) 1) (test (f84) 1) 
    (test (f85) 1) (test (f86) 1) (test (f87) 1) (test (f88) 1) (test (f89) 1) (test (f90) 1) (test (f91) 1)
    (test (f92) 1) (test (f93) 3) (test (f94) 1) (test (f95) 1) (test (f96) 3) (test (f97) 1) (test (f98) 1)
    (test (f99) 2) (test (f100) 1) (test (f101) 1) (test (f102) 3) (test (f103) 1) (test (f104) 1) (test (f105) 3) 
    (test (f106) 1) (test (f107) 1) (test (f108) 2) (test (f109) 1) (test (f110) 1) (test (f111) 2) (test (f112) 1) 
    (test (f113) 1) (test (f114) 1) (test (f115) 1) (test (f116) 2) (test (f117) 2) (test (f118) 2) 
    (test (f119) 3) (test (f120) 2) (test (f121) 3) (test (f122) 2) (test (f123) 2) (test (f124) 1) 
    (test (f125) 1) (test (f126) 1) (test (f127) 1) (test (f128) 2) (test (f129) 2) (test (f130) 3) 
    (test (f131) 2) (test (f132) 2) (test (f133) 2) (test (f134) 3) 
    (test (f135) 1) (test (f136) 1) (test (f137) 2) (test (f138) 2) 
    (test (f139) 1) (test (f140) 1) (test (f141) 1) (test (f142) 2) 
    (test (f143) 1) (test (f144) 1) (test (f145) 1) (test (f146) 1) (test (f147) 2) (test (f148) 2) 
    (test (f149) 2) (test (f150) 2) (test (f151) 2) (test (f152) 3) (test (f153) 3) 
    (test (f154) 1) (test (f155) 1) (test (f156) 1) (test (f157) 2) (test (f158) 2) (test (f159) 2) (test (f160) 1) 
    (test (f161) 2) (test (f162) 2) (test (f163) 2) (test (f164) 1) 
    ))
  
(when with-block
  (let ()
    (define (thunk1) 3)
    (define (thunk2) 4)
    (define (f1) ((lambda (x) (thunk1)) 0)) (f1) 
    (test (f1) 3)
    (define thunk1 thunk2)
    (test (f1) 4)
    
    (define (thunk3) (*s7* 'max-stack-size) 5)
    (define (thunk4) (*s7* 'max-stack-size) 6)
    (define (f2) ((lambda (x) (thunk3)) 0)) (f2) 
    (test (f2) 5)
    (define thunk3 thunk4)
    (test (f2) 6)
    
    (define (close1 x) (*s7* 'max-stack-size) (+ x 1))
    (define (close2 x) (*s7* 'max-stack-size) (+ x 2))
    (define (qclose1 x) (*s7* 'max-stack-size) (eq? x 'q))
    (define (qclose2 x) (*s7* 'max-stack-size) (eq? x 'r))
    (define (sclose1 x) (+ x 1))
    (define (sclose2 x) (+ x 2))
    (define (qsclose1 x) (eq? x 'q))
    (define (qsclose2 x) (eq? x 'r))
    (define* (s*close1 (x 1)) (+ x 1))
    (define* (s*close2 (x 1)) (+ x 2))
    (define* (u*close1 (x 1)) (*s7* 'max-stack-size) (+ x 1))
    (define* (u*close2 (x 1)) (*s7* 'max-stack-size) (+ x 2))
    
    (define (close3 x y) (*s7* 'max-stack-size) (+ x y))
    (define (close4 x y) (*s7* 'max-stack-size) (+ x y 1))
    (define (sclose3 x y) (+ x y))
    (define (sclose4 x y) (+ x y 1))
    (define* (s*close3 (x 1) (y 0.0)) (+ x y))
    (define* (s*close4 (x 1) (y 0.0)) (+ x y 1))
    (define* (u*close3 (x 1) (y 0)) (*s7* 'max-stack-size) (+ x y))
    (define* (u*close4 (x 1) (y 0)) (*s7* 'max-stack-size) (+ x y 1))
    
    (define (f3) (close1 1)) (f3)
    (define (f4) (sclose1 1)) (f4)
    (define (f5 x) (close1 x)) (f5 0)
    (define (f6 x) (sclose1 x)) (f6 0)
    (define (f7 x) (close1 ((lambda () (cs11 x))))) (f7 0)
    (define (f8 x) (sclose1 ((lambda () (cs11 x))))) (f8 0)
    (define (f9 x) (close1 ((lambda () (cs11 1))))) (f9 0)
    (define (f10 x) (sclose1 ((lambda () (cs11 1))))) (f10 0)
    (define (f11 x) (s*close1 x)) (f11 0)
    (define (f12 x) (s*close1)) (f12 0)
    (define (f13 x) (u*close1 x)) (f13 0)
    (define (f14 x) (u*close1)) (f14 0)
    (define (f15) (qclose1 'q)) (f15)
    (define (f16) (qsclose1 'q)) (f16)
    (define (f17 x) (close1 (cdr x))) (f17 '(0 . 0))
    (define (f18) (close3 1 2)) (f18)
    (define (f19) (sclose3 1 2)) (f19)
    (define (f20) (s*close3 1 2)) (f20)
    (define (f21) (u*close3 1 2)) (f21)
    (define (f22 x) (close3 x 2)) (f22 0)
    (define (f23 x) (sclose3 x 2)) (f23 0)
    (define (f24 x) (s*close3 x 2)) (f24 0)
    (define (f25 x) (u*close3 x 2)) (f25 0)
    (define (f26 x) (close3 1 x)) (f26 0)
    (define (f27 x) (sclose3 1 x)) (f27 0)
    (define (f28 x) (s*close3 1 x)) (f28 0)
    (define (f29 x) (u*close3 1 x)) (f29 0)
    (define (f30 x y) (close3 x y)) (f30 0 0)
    (define (f31 x y) (sclose3 x y)) (f31 0 0)
    (define (f32 x y) (s*close3 x y)) (f32 0 0)
    (define (f33 x y) (u*close3 x y)) (f33 0 0)
    
    (test (f3) 2) (test (f4) 2) (test (f5 1) 2) (test (f6 1) 2) (test (f7 1) 2) (test (f8 1) 2) (test (f9 1) 2) 
    (test (f10 1) 2) (test (f11 1) 2) (test (f12 1) 2) (test (f13 1) 2) (test (f14 1) 2) (test (f15) #t)
    (test (f16) #t) (test (f17 '(1 . 1)) 2) (test (f18) 3) (test (f19) 3) (test (f20) 3) (test (f21) 3)
    (test (f22 1) 3) (test (f23 1) 3) (test (f24 1) 3) (test (f25 1) 3) (test (f26 2) 3) (test (f27 2) 3)
    (test (f28 2) 3)
    (test (f29 2) 3)
    (test (f30 1 2) 3)
    (test (f31 1 2) 3)
    (test (f32 1 2) 3)
    (test (f33 1 2) 3)
    
    (define cs11 rs11)
    ;;;(test (f7 1) 3) (test (f8 1) 3) (test (f9 1) 3) (test (f10 1) 3)

    (define close1 close2)
    (define close3 close4)
    (define qclose1 qclose2)
    (define sclose1 sclose2)
    (define sclose3 sclose4)
    (define qsclose1 qsclose2)
    (define s*close1 s*close2)
    (define s*close3 s*close4)
    (define u*close1 u*close2)
    (define u*close3 u*close4)

    (define (f31 x y) (sclose3 x y))
    
    (test (f3) 3) (test (f4) 3) (test (f5 1) 3) (test (f6 1) 3) 
    ;;; (test (f7 -1) 2) (test (f8 -1) 2) (test (f9 -1) 4) (test (f10 -1) 4) 
    (test (f11 1) 3) (test (f12 1) 3) (test (f13 1) 3) (test (f14 1) 3) (test (f15) #f)
    (test (f16) #f) (test (f17 '(1 . 1)) 3) (test (f18) 4) (test (f19) 4) (test (f20) 4) (test (f21) 4)
    (test (f22 1) 4) (test (f23 1) 4) (test (f24 1) 4) (test (f25 1) 4) (test (f26 2) 4) (test (f27 2) 4)
    (test (f28 2) 4) (test (f29 2) 4) (test (f30 1 2) 4) (test (f31 1 2) 4) 
    (test (f32 1 2) 4) (test (f33 1 2) 4)
    ))

;;; global name opts (or lack thereof)
;;; the funny names used here must be nonce words

;;; op_unknown (thunk):
(define *x1* #f) (define (test*x1*) (*x1*)) (define (set*x1* n) (set! *x1* (lambda () n))) (set*x1* 1) (test (test*x1*) 1) (set*x1* 2) (test (test*x1*) 2)
(define *x2* #f) (define (test*x2*) (*x2*)) (define (set*x2* n) (set! *x2* (define* (_) n))) (set*x2* 1) (test (test*x2*) 1) (set*x2* 2) (test (test*x2*) 2)

;;; op_unknown_q:
(define *x3* #f) (define (test*x3*) (*x3* 'a)) (define (set*x3* n) (set! *x3* (lambda (x) n))) (set*x3* 1) (test (test*x3*) 1) (set*x3* 2) (test (test*x3*) 2)

;;; op_unknown_s:
(define *x4* #f) (define (test*x4* a) (*x4* a)) (define (set*x4* n) (set! *x4* (lambda (x) n))) (set*x4* 1) (test (test*x4* 0) 1) (set*x4* 2) (test (test*x4* 0) 2)
(define *x5* #f) (define (test*x5* a) (*x5* a)) (define (set*x5* n) (set! *x5* (define* (_ __) n))) (set*x5* 1) (test (test*x5* 0) 1) (set*x5* 2) (test (test*x5* 0) 2)

;;; op_unknown_c:
(define *x6* #f) (define (test*x6*) (*x6* 0)) (define (set*x6* n) (set! *x6* (lambda (x) n))) (set*x6* 1) (test (test*x6*) 1) (set*x6* 2) (test (test*x6*) 2)

;;; op_unknown_ss:
(define *x7* #f) (define (test*x7* a b) (*x7* a b)) (define (set*x7* n) (set! *x7* (lambda (x y) n))) 
    (set*x7* 1) (test (test*x7* 0 0) 1) (set*x7* 2) (test (test*x7* 0 0) 2)
(define *x8* #f) (define (test*x8* a b) (*x8* a b)) (define (set*x8* n) (set! *x8* (define* (_ x y) n))) 
    (set*x8* 1) (test (test*x8* 0 0) 1) (set*x8* 2) (test (test*x8* 0 0) 2)

;;; op_unknown_sc:
(define *x9* #f) (define (test*x9* a b) (*x9* a 0)) (define (set*x9* n) (set! *x9* (lambda (x y) n))) 
    (set*x9* 1) (test (test*x9* 0 0) 1) (set*x9* 2) (test (test*x9* 0 0) 2)
(define *x10* #f) (define (test*x10* a b) (*x10* a 0)) (define (set*x10* n) (set! *x10* (define* (_ x y) n))) 
    (set*x10* 1) (test (test*x10* 0 0) 1) (set*x10* 2) (test (test*x10* 0 0) 2)

;;; op_unknown_cs:
(define *x11* #f) (define (test*x11* a b) (*x11* 0 b)) (define (set*x11* n) (set! *x11* (lambda (x y) n))) 
    (set*x11* 1) (test (test*x11* 0 0) 1) (set*x11* 2) (test (test*x11* 0 0) 2)
(define *x12* #f) (define (test*x12* a b) (*x12* 0 b)) (define (set*x12* n) (set! *x12* (define* (_ x y) n))) 
    (set*x12* 1) (test (test*x12* 0 0) 1) (set*x12* 2) (test (test*x12* 0 0) 2)

;;; globals 
(test (let () (define (call-func func arg1 arg2) (define (call) (func arg1 arg2)) (call)) (call-func + 1 2.5) (call-func - 5 2)) 3)
(test (let () (define (call-func arg1 arg2) (let ((func (if (= arg1 1) + -))) (define (call) (func arg1 arg2)) (call))) (call-func 1 2.5) (call-func 5 2)) 3)

;;; safe/unsafe troubles
(let ()
  (define (testit)
    (define (f1 x y z) (car z))
    (define (f2 lst) (cond ((null? lst) ()) (else (f1 lst (f2 (cdr lst)) lst))))
    (test (f2 '(abs -1)) 'abs))
  (testit))
(let ()
  (define (testit)
    (define (f1 x y z) (car z))
    (define (f2 lst) (cond ((null? lst) ()) (else (f1 (f2 (cdr lst)) (f2 (cdr lst)) lst))))
    (test (f2 '(abs -1)) 'abs))
  (testit))

;;; changing a function's environment
(let ()
  (let ((e (let ((a 1) (b 2)) (curlet))))
    (define (f1 c)
      (+ a b c))
    (set! (outlet (funclet f1)) e)
  (test (f1 4) 7))

  (let ((e (let ((a 1) (b 2)) (curlet))))
    (define f2 (let ((d 10))
		 (lambda (c)
		   (+ a b c d))))
   ;; (set! (outlet (funclet f2)) e) ; 'd unbound
    (set! (outlet (outlet (funclet f2))) e)
    (test (f2 4) 17))

  (let ((e (let ((a 1) (b 2)) (curlet))))
    (define f3
      (with-let e
	(lambda (c)
	  (+ a b c))))
    (test (f3 4) 7)))




;;; --------------------------------------------------------------------------------
;;; values
;;; call-with-values
;;; --------------------------------------------------------------------------------


(test (call-with-values (lambda () (values 1 2 3)) +) 6)
(test (call-with-values (lambda () (values 4 5)) (lambda (a b) b))  5)
(test (call-with-values (lambda () (values 4 5)) (lambda (a b) (+ a b))) 9)
(test (call-with-values * -) -1) ; yeah, right... (- (*))
(test (values 1) 1)
(test (call-with-values (lambda () (values 1 2 3 4)) list) (list 1 2 3 4))
(test (+ (values 1) (values 2)) 3)
(test (+ (values '1) (values '2)) 3)
(test (if (values #t) 1 2) 1)
(test (if (values '#t) 1 2) 1)
(test (if (values #f) 1 2) 2)
(test (if (values #f #f) 1 2) 1)
(test (equal? (values #t #t)) #t)
(test (call-with-values (lambda () 4) (lambda (x) x)) 4)
(test (let () (values 1 2 3) 4) 4)
(test (apply + (values ())) 0)
(test (+ (values 1 2 3)) 6)
(test (let ((f (lambda () (values 1 2 3)))) (+ (f))) 6)
(num-test (log (values 8 2)) 3)
(test (* (values 2 (values 3 4))) 24)
(test (* (values (+ (values 1 2)) (- (values 3 4)))) -3)
(test (list (values 1 2) (values 3) 4) '(1 2 3 4))
(test (let ((f1 (lambda (x) (values x (+ x 1)))) (f2 (lambda () (values 2)))) (+ (f1 3) (* 2 (f2)))) 11)
(test (+ (let () (values 1 2)) 3) 6)
(test (let () (values 1 2) 4) 4)
(test (let () + (values 1 2) 4) 4)
(test (string-ref (values "hiho" 2)) #\h)
(test (vector-ref (values (vector 1 2 3)) 1) 2)
(test (+ (values (+ 1 (values 2 3)) 4) 5 (values 6) (values 7 8 (+ (values 9 10) 11))) 66)
(test (+ (if (values) (values 1 2) (values 3 4)) (if (null? (values)) (values 5 6) (values 7 8))) 18) ; (values) is now #<unspecified> (sort of)
(test (+ (cond (#f (values 1 2)) (#t (values 3 4))) 5) 12)
(test (+ (cond (#t (values 1 2)) (#f (values 3 4))) 5) 8)
(test (apply + (list (values 1 2))) 3)
(test (apply + (list ((lambda (n) (values n (+ n 1))) 1))) 3)
(test (+ (do ((i 0 (+ i 1))) ((= i 3) (values i (+ i 1))))) 7)
(test (+ (with-input-from-string "(values 1 2 3)" (lambda () (eval (read)))) 2) 8)
(test (< (values 1 2 3)) #t)
(test (apply (values + 1 2) '(3)) 6)
(test (let () (define-macro (hi a) `(+ 1 ,a)) (hi (values 1 2 3))) 7)
(test (+ 1 (eval-string "(values 2 3 4)")) 10)
(test (+ 1 (eval '(values 2 3 4))) 10)
(test (or (values #t) #f) #t)
(test (and (values #t) #f) #f)
(test (let ((x 1)) (set! x (values 32)) x) 32)
(test (let ((x #(32 33))) ((values x) 0)) 32)
(test (let ((x #(32 33))) (set! ((values x) 0) 123) x) #(123 33))
(test (list-ref '(1 (2 3)) (values 1 1)) 3)
(test (list-ref (values '(1 (2 3)) 1 1)) 3)
(test (list-ref ((lambda () (values '(1 (2 3)) 1 1)))) 3)
(test (set! (values) 1) 'error)
(test (+ (values (begin (values 1 2)) (let ((x 1)) (values x (+ x 1))))) 6)
(test (vector 1 (values 2 3) 4) #(1 2 3 4))
(test (vector (values 1 (values 2 3) (values (values 4)))) #(1 2 3 4))
(test(+ 1 (values (values (values 2) 3) (values (values (values 4)) 5) 6) 7) 28)
(test (map (values values #(1 2))) '(1 2))
(test ((values values) (values 0)) 0)
(test (((values values values) 0)) 0)
(test ((apply (values values values '((1 2))))) '(1 2))
(test (apply begin (values (list 1))) 1)
(test (apply begin (values '(values "hi"))) (apply (values begin '(values "hi"))))
(test ((object->string values) (abs 1)) #\a)
(test (list? (values 1 2 3)) 'error)
(test (list? (values 1)) #f)
(test (list? (values (list 1 2 3))) #t)

(test (+ (call-with-exit (lambda (ret) (values 1 2 3)))) 6)
(test (+ 4 (call-with-exit (lambda (ret) (values 1 2 3))) 5) 15)
(test (+ (call-with-exit (lambda (ret) (ret 1 2 3)))) 6)
(test (+ 4 (call-with-exit (lambda (ret) (ret 1 2 3))) 5) 15)
(test (+ (call/cc (lambda (ret) (values 1 2 3)))) 6)
(test (+ 4 (call/cc (lambda (ret) (values 1 2 3))) 5) 15)
(test (+ (call/cc (lambda (ret) (ret 1 2 3)))) 6)
(test (+ 4 (call/cc (lambda (ret) (ret 1 2 3))) 5) 15)
(test (+ (dynamic-wind (lambda () (values 1 2)) (lambda () (values 3 4)) (lambda () (values 5 6)))) 7)
(test (let ((g #f)) (+ (call-with-exit (lambda (ret) (set! g ret) (values 1 2 3)))) (g)) 'error)
(test (+ (call-with-exit (lambda (ret) (ret (values 1 2 3))))) 6)
(test (+ (call/cc (lambda (ret) (ret (values 1 2 3))))) 6)

(test (+ (with-input-from-string "123" (lambda () (values 1 2 3)))) 6)
(test (+ (call-with-input-string "123" (lambda (p) (values 1 2 3)))) 6)
(test (+ (eval-string "(values 1 2 3)")) 6)

(let ()
  (test (let ((x 1)) (set! x (apply values (signature (hash-table*))))) 'error)
  (test (signature (hash-table*)) '(#t hash-table? #t)))

(test (let ((x 1)) (set! x (values)) x) #<unspecified>)
(test ((lambda () (let ((x 1)) (set! x (boolean? (values)))))) #f)
(test (let ((x 1)) (set! x (values 1 2 3)) x) 'error)
(test (let ((x 1)) (set! x (values 2)) x) 2)
(test (let ((x 1)) (set! (values x) 2) x) 'error) ; (no generalized set for values, so (values x) is not the same as x
(test (let ((x #(0 1))) (set! (values x 0 32)) x) 'error)
(test (let ((var (values 1 2 3))) var) 'error)
(test (let* ((var (values 1 2 3))) var) 'error)
(test (letrec ((var (values 1 2 3))) var) 'error)
(test (let ((x ((lambda () (values 1 2))))) x) 'error)
(test (+ 1 ((lambda () ((lambda () (values 2 3)))))) 6)
(test (let () (define (hi) (symbol? (values 1 2 3))) (hi)) 'error)
(test (let () (define (hi) (symbol? (values))) (hi)) #f) ; this is consistent with earlier such cases: (boolean? (values))
(test (let () (define (hi) (symbol? (values 'a))) (hi)) #t)
(test (let () (define (hi) (symbol? (values 1))) (hi)) #f)
(test (let () (define (hi a) (log (values 1 2) a)) (hi 2)) 'error)
(test (let () (define (arg2 a) (let ((b 1)) (set! b (+ a b)) (values b a))) (define (hi c) (expt (abs c) (arg2 2))) (hi 2)) 'error)
(test (let () (define (arg2 a) (let ((b 1)) (set! b (+ a b)) (values b))) (define (hi c) (expt (abs c) (arg2 2))) (hi 2)) 8)
(test (let () (define (hi) (+ (values 1 2) (values 3 4))) (hi)) 10)

(test (let ((str "hi")) (string-set! (values str 0 #\x)) str) "xi")
(test (values if) if)
(test (values quote) quote)

(test ((values '(1 (2 3)) 1 1)) 3)
(test (let ((x #(32 33))) ((values x 0))) 32)
(test (+ 1 (apply values '(2 3 4))) 10)
(test (eq? (values) (apply values ())) #t)
(test (+ 1 ((lambda args (apply values args)) 2 3 4)) 10)
(test (apply begin '(1 2 3)) 3)
(test (let ((x 1)) ((values set!) x 32) x) 32)
(let ((x 0)) (test (list (set! x 10)) (call-with-values (lambda () (set! x 10)) list))) ; from r7rs discussion

(let ((v (vector 1))) 
  (catch #t 
    (lambda () 
      (set! (v 0) (values 1 2))
      (format *stderr* "(set! (v 0) (values 1 2)) -> no error?~%"))
    (lambda (type info)
      (if (not (eq? type 'wrong-number-of-args))
	  (format *stderr* "(set! (v 0) (values 1 2)): ~A ~A~%" type info)))))
(let ((p (list 1)))
  (catch #t
    (lambda ()
      (set! (p 0) (values 1 2))
      (format *stderr* "(set! (p 0) (values 1 2)) -> no error?~%"))
    (lambda (type info)
      (if (not (eq? type 'wrong-number-of-args))
	  (format *stderr* "(set! (p 0) (values 1 2)): ~A ~A~%" type info)))))
(let ((h (hash-table '(a . 1))))
  (catch #t
    (lambda ()
      (set! (h 'b) (values 1 2))
      (format *stderr* "(set! (h 'b) (values 1 2)) -> no error?~%"))
    (lambda (type info)
      (if (not (eq? type 'wrong-number-of-args))
	  (format *stderr* "(set! (h 'b) (values 1 2)): ~A ~A~%" type info)))))
;;; similarly string/int-vector/float-vector -- seem to be ok

(let ()
  (define (curry function . args) 
    (lambda more-args 
      (function (apply values args) (apply values more-args)))) ; unfortunately this doesn't handle 0 args
  (test ((curry + 1 2) 3 4) 10))

(let ()
  (define (curry function . args)
    (if (null? args)
	function
	(lambda more-args
	  (if (null? more-args)
	      (apply function args)
	      (function (apply values args) (apply values more-args))))))
  (test ((curry + 1 2) 3 4) 10)
  (test ((curry + 2) 3 4) 9)
  (test ((curry +) 3 4) 7)
  (test ((curry +)) 0)
  (test ((curry + 1 2)) 3)
  (test ((curry + 1)) 1)
  (test ((curry +) 1) 1))

(test (or (values #t #f) #f) #t)
(test (or (values #f #f) #f) #f)
(test (or (values #f #t) #f) #t)
(test (or (values #f #f) #t) #t)
(test (or (values 1 2) #f) 1)
(test (+ 1 (or (values 2 3) 4)) 3)
(test (+ 1 (and 2 (values 3 4)) 5) 13)
(test (and (values) 1) 1)
(test (and (values 1 2 #f) 4) #f)
(test (and (values 1 2 3) 4) 4)
(test (length (values ())) 0)
(test (length (values #(1 2 3 4))) 4)
(test (vector? (values #())) #t)
(test (map + (values '(1 2 3) #(1 2 3))) '(2 4 6))
(test (map + (values '(1 2 3)) (values #(1 2 3))) '(2 4 6))
(test (map + (values '(1 2 3) #(4 5 6)) (values '(7 8 9))) '(12 15 18))

(test (let ((x 1)) 
	(and (let () (set! x 2) #f) 
	     (let () (set! x 3) #f)) 
	x) 2)
(test (let ((x 1)) 
	(and (values (let () (set! x 2) #f) 
		     (let () (set! x 3) #f)))
	x) 3)

(test (+ (values 1 2) 3) 6)
(test (+ (values 1 (values 2))) 3)
(test (list (values 1 2)) '(1 2))
(test (+ 6 (values 1 (values 2 3) 4 ) 5) 21)
(test (+ ((lambda (x) (values (+ 1 x))) 2) 3) 6)
(test (list ((lambda (x) (values (+ 1 x))) 2)) '(3))
(test (+ (begin (values 1 2))) 3)
(test (+ 1 (let () (values 1 2))) 4)
(test (apply (values + 1 2) (list 3)) 6)
(test ((lambda* ((a 1) (b 2)) (list a b)) (values :a 3)) '(3 2))
(test (+ (values (values 1 2) (values 4 5))) 12)
(test (+ (begin 3 (values 1 2) 4)) 4)
(test (map (lambda (x) (if #f x (values))) (list 1 2)) ())
(test (map (lambda (x) (if #f x (begin (values)))) (list 1 2)) ())
(test (map (lambda (x) (if (odd? x) (values x (* x 20)) (values))) (list 1 2 3 4)) '(1 20 3 60))
(test (map (lambda (x) (if (odd? x) (values x (* x 20)) (if #f #f))) (list 1 2 3 4)) '(1 20 #<unspecified> 3 60 #<unspecified>))
(test (map (lambda (x) (if (odd? x) (apply values '(1 2 3)) (values))) (list 1 2 3 4)) '(1 2 3 1 2 3))
(test (object->string (map (lambda (x) (if (odd? x) (values x (* x 20)) (values))) (list 1 2 3 4))) "(1 20 3 60)") ; make sure no "values" floats through
(test (map (lambda (x) (if (odd? x) (values x (* x 20) (cons x (+ x 1))) (values))) (list 1 2 3 4 5 6)) '(1 20 (1 . 2) 3 60 (3 . 4) 5 100 (5 . 6)))
(test (* 2 (case 1 ((2) (values 3 4)) ((1) (values 5 6)))) 60)
(test (* 2 (case 1 ((2) (values 3 4)) (else (values 5 6)))) 60)
(test (* 2 (case 1 ((1) (values 3 4)) (else (values 5 6)))) 24)
(test (+ (values (* 3 2) (abs (values -1)))) 7)
(test (+ (let ((x 1)) (values x (+ x 1))) (if #f #f (values 2 3))) 8)

(test (let ((sum 0)) (for-each (lambda (n m p) (set! sum (+ sum n m p))) (values (list 1 2 3) (list 4 5 6) (list 7 8 9))) sum) 45)
(test (map (lambda (n m p) (+ n m p)) (values (list 1 2 3) (list 4 5 6) (list 7 8 9))) '(12 15 18))
(test (string-append (values "123" "4" "5") "6" (values "78" "90")) "1234567890")
(test (+ (dynamic-wind (lambda () #f) (lambda () (values 1 2 3)) (lambda () #f)) 4) 10)

(let ((x 'y)
      (y 32))
 (define (f1) (values #f))
 (test (if (values #f) x)               #<unspecified>)
 (test (if (values #t) x)               'y)
 (test (if (values #f) (values x))      #<unspecified>)
 (test (if (values #t) (values x))      'y)
 (test (if x (values x))                'y)
 (test (list (values x))                '(y))
 (test (list (values x y))              '(y 32))
 (test (cond ((values x) => list))      '(y))
 (test (cond ((values x y) => list))    '(y 32))
 (test (cond ((values #f) => list))     #<unspecified>)
 (test (cond ((values #t) => list))     '(#t))
 (test (cond ((f1) => list))            #<unspecified>)
 (test (list (cond ((values x))))       '(y))
 (test (list (cond ((values x y))))     '( y 32))
 (test (list (cond (#t (values x))))    '(y))
 (test (list (cond (#t (values x y))))  '(y 32))
 (test (cond ((values x) => (lambda args (apply list args))))    '(y))
 (test (cond ((values x y) => (lambda args (apply list args))))  '(y 32)))
 
(for-each
 (lambda (arg)
   (test (values arg) arg))
 (list "hi" -1 #\a 1 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #t (list 1 2 3) '(1 . 2)))

(for-each
 (lambda (arg)
   (test (apply values arg) 'error)
   (test (apply values (list arg)) arg))
 (list "hi" -1 #\a 1 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #t '(1 . 2)))

(for-each
 (lambda (arg)
   (test (call-with-values (lambda () (values arg arg)) (lambda (a b) b)) arg))
 (list "hi" -1 #\a 1 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #t (list 1 2 3) '(1 . 2)))

(test (call-with-values (lambda () (values "hi" 1 3/2 'a)) (lambda (a b c d) (+ b c))) 5/2)
					;(test (call-with-values values (lambda arg arg)) ())
(test (string-ref (values "hi") 1) #\i)
(test ((lambda (a b) (+ a b)) ((lambda () (values 1 2)))) 3)

(test (list (letrec ((split (lambda (ls)
			      (if (or (null? ls) (null? (cdr ls)))
				  (values ls ())
				  (call-with-values
				      (lambda () (split (cddr ls)))
				    (lambda (odds evens)
				      (values (cons (car ls) odds)
					      (cons (cadr ls) evens))))))))
	      (split '(a b c d e f))))
      '((a c e) (b d f)))

(let ()
  (define (f1 . args)
    (apply values (+ (car args) (cadr args)) (cddr args)))
  (test (* (f1 2 3 4)) 20)
  (test (* (f1 2 3 4) (f1 1 2 3)) 180)
  (test (- (f1 2 3 4) (f1 1 2 3)) -5))

(test (call-with-values (lambda () (call/cc (lambda (k) (k 2 3)))) (lambda (x y) (list x y))) '(2 3))
(test (+ (call/cc (lambda (return) (return (values 1 2 3)))) 4) 10)

(test (let ((values 3)) (+ 2 values)) 5)
(test (let ((a (values 1))) a) 1)

(test (call-with-values (lambda () 2) (lambda (x) x)) 2)
(test (call-with-values (lambda () -1) abs) 1)
(test (call-with-values (lambda () (values -1)) abs) 1)
(test (call-with-values (lambda () (values -1)) (lambda (a) (abs a))) 1)

(test (call-with-values 
	  (lambda ()
	    (values
	     (call-with-values (lambda () (values 1 2 3)) +)
	     (call-with-values (lambda () (values 1 2 3 4)) *)))
	(lambda (a b)
	  (- a b)))
      -18)

(test (call-with-values 
	  (lambda ()
	    (values
	     (call-with-values (lambda () (values 1 2 3)) +)
	     (call-with-values (lambda () (values 1 2 3 4)) *)))
	(lambda (a b)
	  (+ (* a (call-with-values (lambda () (values 1 2 3)) +))
	     (* b (call-with-values (lambda () (values 1 2 3 4)) *)))))
      612)

(test (call-with-values (lambda (x) (+ x 1)) (lambda (y) y)) 'error)
(test (+ (values . 1)) 'error)
(for-each
 (lambda (arg)
   (test (call-with-values arg arg) 'error))
 (list "hi" -1 #\a 1 'a-symbol 3.14 3/4 1.0+1.0i #t (list 1 2 3) '(1 . 2)))
(test (call-with-values (lambda () (values -1 2)) abs) 'error)

(test (multiple-value-bind (a b) (values 1 2) (+ a b)) 3)
(test (multiple-value-bind (a) 1 a) 1)
(test (multiple-value-bind (a . rest) (values 1 2 3) (+ a (apply + rest))) 6)
(test (multiple-value-bind a (values 1 2 3) a) '(1 2 3))
(test (multiple-value-bind (x y z) (values 1 2 3) (list z y x)) '(3 2 1))
(test (multiple-value-bind (x y z) (values 1 2 3) (let ((x 4)) (list x y z))) '(4 2 3))
(unless pure-s7
  (test (multiple-value-bind (x y z) (values 1 2 3 4 5 6) (list x y z)) 'error)                                     ; was '(1 2 3)) -- 25-Jan-16
  (test (multiple-value-bind (x y z) (values 1 2) (list x y z)) 'error)                                             ; was '(1 2 #f))
  (test (multiple-value-bind (x y z) (multiple-value-bind () (values 1 2) (values 'a 'b 'c)) (list x y z)) 'error)) ;was '(a b c))

(test (let ((add (lambda (a b) (values (+ a 1) (+ b 1))))) (+ 1 (add 2 3))) 8)
(test (min (values 1 2) (values 3 0)) 0)
(test ((lambda* ((a 1) (b 2)) (list a b)) (values :b 231)) '(1 231))
(test (cons (values 1 2) (values 3 4)) 'error)

(test (cond ((values) 3) (#t 4)) 3)          ; an error in Guile "zero values returned"
(test (cond ((values (values)) 3) (#t 4)) 3) ; same
(test (+ (cond (#t (values 1 2)))) 3)        ; 1 in guile
(test (+ (cond ((values 3 4) => (lambda (a) a)))) 'error)
(test (+ (cond ((values 3 4) => (lambda (a b) (values a b))))) 7)
(test (+ 1 (cond ((values 2 3))) 4) 10)
(test (+ 1 (values)) 'error)

(test (case (values 1) ((1) 2) (else 3)) 2)
(test (case (values 1 2) ((1) 2) (else 3)) 3)
(test (case (values 1) (((values 1)) 2) (else 3)) 3)
(test (case (values 1 2) (((values 1 2)) 2) (else 3)) 3)

(test ((values) 0) 'error)
(test ((values "hi") 1) #\i)
(test (string-ref (values "hi") 0) #\h)
(test (string-ref (values "hi" "ho") 0) 'error)
(test (let ((str "hi")) (set! ((values str) 0) #\x) str) "xi")
(test (let ((str "hi")) (string-set! (values str) 0 #\x) str) "xi")
(test (let ((str "hi")) (set! (values str 0) #\x) str) 'error)
(test (let ((str "hi")) (string-set! (values str 0) #\x) str) "xi")

(test ((values 1 2 3) 0) 'error)
(test ((values "hi" "ho") 1) 'error)
(test ((values + 1 2 3)) 6)
(test ((values + 1 2) 3) 6)
(test ((values +) 1 2 3) 6)
(test ((values "hi" 0)) #\h)
(test ((values + 1) (values 2 3) 4) 10)
(test ((values - 10)) -10)
(test ((values - -10) 0) -10) ; looks odd but it's (- -10 0) that is (- a) != (- a 0)
(test ((values - 2 3) 0) -1)
(test ((values - 2 3) 1) -2)
(test ((values - 2 3) 2) -3)  ; it's actually (- 2 3 2) -> -3

(test (let ((str "hi")) (set! ((values str 0) 0) #\x) str) 'error)
(test (let ((str "hi")) (set! ((values str) 0) #\x) str) "xi")
(test (+ (let ((x 0)) (do ((i (values 0) (+ i 1))) (((values = i 10)) (values x 2 3)) (set! x (+ x i)))) 4) 54)

(test (map values (list (values 1 2) (values 3 4))) '(1 2 3 4))
(test (let () (define-macro (hi a) `(+ 1 ,a)) (hi (values 2 3 4))) 10)
(test (let () (+ 4 (let () (values 1 2 3)) 5)) 15)
(test (let* () (+ 4 (let () (values 1 2 3)) 5)) 15)
(test (let () (+ 4 (let* () (values 1 2 3)) 5)) 15)
(test (letrec () (+ 4 (let () (values 1 2 3)) 5)) 15)
(test (let () (+ 4 (letrec () (values 1 2 3)) 5)) 15)
(test (letrec* () (+ 4 (let () (values 1 2 3)) 5)) 15)
(test (let* () (+ 4 (letrec* () (values 1 2 3)) 5)) 15)

(test (cons (values 1 2)) '(1 . 2))
(test (number->string (values 1 2)) "1")
(test (object->string (values)) (if (provided? 'debugging) "#<no-value>" "#<unspecified>"))
(test (equal? (values) #<unspecified>) #t)
(test (equal? (begin) (begin (values))) #f) ; () but #<unspecified>
(test (map (lambda (x) (if #f x #<unspecified>)) (list 1 2)) '(#<unspecified> #<unspecified>))
(test (equal? (values) (if #f #f)) #t)
(test (substring (values "hi") (values 1 2)) "i")
(test (cond (call-with-exit (values "hi"))) "hi")
(test (values (begin (values "hi"))) "hi")
(test (< (values (values 1 2))) #t)
(test (apply-values (cdr (list-values (values)))) 'error)
(test (apply values (cdr (list-values (values)))) 'error)
(test (apply-values) #<unspecified>)
(test (apply-values ()) #<unspecified>)
(test (apply values) #<unspecified>)
(test (apply values ()) #<unspecified>)
(test (list-values (values)) ())
(test (list-values (apply-values)) ())
(test (list-values (apply-values) (values)) ())
(test (list-values 1 (values) 2) '(1 2))
(test (list-values 1 2 (values)) '(1 2))
(test (list-values (values) 1 2) '(1 2))

(test (let ((lst (list 0)))
	(set-cdr! lst lst)
	(format (values #f "~A" lst)))
      "#1=(0 . #1#)")

(let ()
  (define (mv n)
    (define (mv-1 a)
      (values a (+ a 1)))
    (define (mv-2 b)
      (values b (* b 2)))
    (values n (mv-1 n) (mv-2 n)))
  (test (list (mv 2)) '(2 2 3 2 4))
  (test (+ (mv 1) (mv 3)) 26))

(let ()
  (define (fib n)
    (define (1st a b) 
      a)
    (define (fib-1 n)
      (if (< n 3)
	  (values 1 1)
	  (values (+ (fib-1 (- n 1))) 
		  (1st (fib-1 (- n 1))))))
    (1st (fib-1 n)))
  (test (fib 8) 21)
  (test (fib 13) 233))

(let ()
  (define (fib n)
    (define (1st a b) 
      a)
    (define (2nd a b) 
      (values (+ a b) a))
    (define (fib-1 n)
      (if (< n 3)
	  (2nd 1 0)
	  (2nd (fib-1 (- n 1)))))
    (1st (fib-1 n)))

  (define (real-fib n)
    (let ((phi (/ (+ 1 (sqrt 5)) 2)))
      (floor (real-part (/ (- (expt phi n)        ; "floor" to return an integer, real-part to guard against epsilonic imag-parts from expt
			      (expt (- 1 phi) n))
			   (sqrt 5))))))

  (test (fib 8) (real-fib 8))
  (test (fib 13) (real-fib 13)))

(let ()
  (define (cfib z) ; wikipedia "generalized fibonacci numbers"
    (let ((phi (/ (+ 1 (sqrt 5)) 2))) 
      (/ (- (expt phi z) 
	    (* (expt phi (- z)) (cos (* pi z))))
	 (sqrt 5))))
  
  (num-test (cfib 3) 2.0)
  (num-test (cfib 8) 21.0)
  (num-test (cfib 3+4i) -5248.5113072837-14195.962288353i))

(num-test (let ((f- -) (f+ +)) (define (fb n) (if (< n 2.0) n (f+ (fb (f- n 1.0)) (fb (f- n 2.0))))) (fb 12.0)) 144.0)

(let ()
  (define (flatten lst) 
    (map values (list (let flatten-1 ((lst lst))
                        (cond ((null? lst) (values))
                              ((not (pair? lst)) lst)
                             (else (values (flatten-1 (car lst)) 
                                            (flatten-1 (cdr lst)))))))))
#| 
  ;; old form
  (define (flatten lst) ; flatten via values and map
    (define (flatten-1 lst)
      (cond ((null? lst) (values))
	    ((not (pair? lst)) lst)
	    (#t (values (flatten-1 (car lst))
			(flatten-1 (cdr lst))))))
    (map values (list (flatten-1 lst))))
|#

  (test (flatten '(1 2 3)) '(1 2 3))
  (test (flatten ()) ())
  (test (flatten '((1) 2 (3 4) (6 (7)))) '(1 2 3 4 6 7))
  (test (flatten '(1 ((((2)) 3)))) '(1 2 3))
  (test (flatten '(1 () 2)) '(1 2))
  (test (flatten '((1 () 2) ())) '(1 2))
  (test (flatten '(() 1 ((2 (3)) () 4))) '(1 2 3 4))
  (test (flatten '((1) 2 ((3 4) 5) ((())) (((6))) 7 8 ())) '(1 2 3 4 5 6 7 8))
  (test (flatten '(() 1 () ((2 (1)) 4) (3 2) ())) '(1 2 1 4 3 2))
  )

(let ()
  (define (flatten! lst) ; in-place flatten
    (if (not (pair? lst))
	lst
	(let loop ((L lst))
	  (if (pair? (car L))
	      (let ((end (cdr L))
		    (p (car L)))
		(set! (car L) (car p))
		(set! (cdr L) (cdr p))
		(set! (cdr (list-tail L (- (length p) 1))) end)
		(loop L))
	      (if (not (null? (cdr L)))
		  (if (null? (car L))
		      (begin
			(set! (car L) (cadr L))
			(set! (cdr L) (cddr L))
			(loop L))
		      (loop (cdr L)))))
	  (if (equal? lst '(()))
	      ()
	      (let ((len (length lst)))
		(if (null? (car (list-tail lst (- len 1))))
		    (set! (cdr (list-tail lst (- len 2))) ()))
		lst)))))

  (test (flatten! '(1 2 3)) '(1 2 3))
  (test (flatten! ()) ())
  (test (flatten! '((1) 2 (3 4) (6 (7)))) '(1 2 3 4 6 7))
  (test (flatten! '(1 ((((2)) 3)))) '(1 2 3))
  (test (flatten! '(1 () 2)) '(1 2))
  (test (flatten! '((1 () 2) ())) '(1 2))
  (test (flatten! '(() 1 ((2 (3)) () 4))) '(1 2 3 4))
  (test (flatten! '((1) 2 ((3 4) 5) ((())) (((6))) 7 8 ())) '(1 2 3 4 5 6 7 8))
  (test (flatten! '(() 1 () ((2 (1)) 4) (3 2) ())) '(1 2 1 4 3 2))
  )

(let ()
  (define (flatten x) ; standard flatten
    (cond ((null? x) ())
          ((not (pair? x)) (list x))
          (#t (append (flatten (car x))
		      (flatten (cdr x))))))

  (test (flatten '(1 2 3)) '(1 2 3))
  (test (flatten ()) ())
  (test (flatten '((1) 2 (3 4) (6 (7)))) '(1 2 3 4 6 7))
  (test (flatten '(1 ((((2)) 3)))) '(1 2 3))
  (test (flatten '(1 () 2)) '(1 2))
  (test (flatten '((1 () 2) ())) '(1 2))
  (test (flatten '(() 1 ((2 (3)) () 4))) '(1 2 3 4))
  (test (flatten '((1) 2 ((3 4) 5) ((())) (((6))) 7 8 ())) '(1 2 3 4 5 6 7 8))
  (test (flatten '(() 1 () ((2 (1)) 4) (3 2) ())) '(1 2 1 4 3 2))
  )

(test (let () (define (hi a) (+ (abs a) (values 1 2 3))) (hi -4)) 10)
(let ()
  (define (hi a)
    (let ((x 0)
	  (again #f))
      (let ((y (+ (abs a) (call/cc (lambda (r) (set! again r) 1)))))
	(set! x (+ x y))
	(if (< x 3) (again 1))
	x)))
  (test (hi 0) 3))

(let ()
  (define-macro (define-values1 vars . body)
    `(apply begin (map (lambda (var val) `(define ,var ,val)) ',vars (list (begin ,@body)))))

  (define-macro (let*-values1 vars . body)
    `(let () 
       ,@(map (lambda (nvars . nbody)
	        `(apply define-values1 ',nvars ',@nbody))
	      (map car vars) (map cdr vars))
       ,@body))

  (let ()
    (define-values1 (a b) (values 3 2))
    (test (* a b) 6))

  (let ()
    (test (let*-values1 (((a b) (values 3 2))) (* a b)) 6)))

(define __p__ 123)
(define current-rootlet (curlet))

(let ((__p__ 321))
  (set! __p__ 432))

(if (not (= __p__ 123)) (format #t "__p__: ~A~%" __p__))

(let ()
  (define (args) (values __p__ (* __p__ 2)))
  (let ((__p__ 0)
	(q 1))
    (call-with-values args (lambda (a b) (set! __p__ a) (set! q b)))
    (if (not (= __p__ 123)) (format #t "    local __p__: ~A~%" __p__))
    (set! __p__ 432)
    (call-with-values args (lambda (__p__ q) (set! __p__ 321)))
    (if (not (= __p__ 432)) (format #t "    local __p__: ~A~%" __p__))))

(if (not (= __p__ 123)) (format #t "__p__: ~A~%" __p__))

(let ()
  (define-macro (args a b) `(values ,a ,b))
  (define (sp a b)
    (set! a 121))
  (define (pq __p__ q) 
    (set! __p__ q))
  (sp (args __p__ __p__))
  (pq (args __p__ 567)))

(if (not (= __p__ 123)) (format #t "__p__: ~A~%" __p__))

(let ((__p__ 321))
  (eval '(set! __p__ 432) current-rootlet)
  (if (not (= __p__ 321)) (format #t "    local __p__: ~A~%" __p__))
  (eval '(set! __p__ 123))
  (if (not (= __p__ 123)) (format #t "    local __p__: ~A~%" __p__)))

(if (not (= __p__ 432)) (format #t "__p__: ~A~%" __p__))

(let ()
  (eval '(let ((__p__ 321)) (set! __p__ 456)) current-rootlet))

(if (not (= __p__ 432)) (format #t "__p__: ~A~%" __p__))

(let ((__p__ (values __p__)))
  (if (not (= __p__ 432)) (format #t "    local __p__: ~A~%" __p__))
  (set! __p__ 123))

(if (not (= __p__ 432)) (format #t "__p__: ~A~%" __p__))

(let ()
  (define (sp __p__ q) (values __p__ q))
  (call-with-values (lambda () (sp __p__ (* __p__ 2))) (let ((__p__ 1)) (lambda (a b) (set! __p__ a)))))

(if (not (= __p__ 432)) (format #t "__p__: ~A~%" __p__))

(let ((lst (list __p__ (* __p__ 2))))
  (define-macro (sp a) `(set! __p__ ,a))
  (let ((__p__ 0)
	(q 1))
    (define (pq a) (set! __p__ a))
    (map sp (list __p__ q))
    (if (not (= __p__ 1)) (format #t "    local __p__: ~A~%" __p__))
    (for-each sp (list __p__ q))
    (if (not (= __p__ 1)) (format #t "    local __p__: ~A~%" __p__))
    (map sp lst)
    (if (not (= __p__ (* 432 2))) (format #t "    local __p__: ~A~%" __p__))
    (for-each sp lst)
    (if (not (= __p__ (* 432 2))) (format #t "    local __p__: ~A~%" __p__))
    (set! __p__ 0)
    (set! q 1)
    (map pq (list __p__ q))
    (if (not (= __p__ 1)) (format #t "    local __p__: ~A~%" __p__))
    (for-each pq (list __p__ q))
    (if (not (= __p__ 1)) (format #t "    local __p__: ~A~%" __p__))
    (map pq lst)
    (if (not (= __p__ (* 432 2))) (format #t "    local __p__: ~A~%" __p__))
    (for-each pq lst)
    (if (not (= __p__ (* 432 2))) (format #t "    local __p__: ~A~%" __p__))))

(if (not (= __p__ 432)) (format #t "__p__: ~A~%" __p__))

(when (eq? (curlet) (rootlet))
  (let ((__p__ 1))
    (eval `(define (__p__ a) (+ a ,__p__)) current-rootlet)
    (if (not (= __p__ 1)) (format #t "    local __p__: ~A~%" __p__)))
  
  (if (not (procedure? __p__)) (format #t "__p__: ~A~%" __p__))
  (if (not (= (__p__ 2) 3)) (format #t "(__p__ 2): ~A~%" (__p__ 2)))
  
  (let ((__p__ 1))
    (eval `(define __p__ 32))
    (if (not (= __p__ 32)) (format #t "    local __p__: ~A~%" __p__)))
  
  (if (not (procedure? __p__)) (format #t "__p__: ~A~%" __p__))
  (if (not (= (__p__ 2) 3)) (format #t "(__p__ 2): ~A~%" (__p__ 2)))
  
  (let ((__p__ 1))
    (eval `(define __p__ 32) (curlet))
    (if (not (= __p__ 32)) (format #t "    local __p__: ~A~%" __p__)))
  
  (if (not (procedure? __p__)) (format #t "__p__: ~A~%" __p__))
  (if (not (= (__p__ 2) 3)) (format #t "(__p__ 2): ~A~%" (__p__ 2))))

(let ()
  (define-macro (m1) (values))
  (define-macro (m2) (values 2 3))
  (define-macro (m3) (values '(+ 1 2) '(* 3 4)))
  (define-macro (m4) (values '(define a 1) '(define b 2)))
  (define-macro (m5 a b) (values `(define a ,a) `(define b (+ ,b 1))))

  (test (begin (m1)) #<unspecified>)
  (test (+ (m2)) 5)
  (test (+ 1 (m3) 3) 19)
  (test (let () (m4) (+ a b)) 3)
  (test (let () (m5 1 2) (+ a b)) 4))

(let ((lst (list 1)))
  (define (sf x y) (and (pair? x) (list x y)))
  (define (mv x) (values x x))
  (define (testsf)
    (test (sf lst lst) '((1) (1)))
    (test (sf (mv lst)) '((1) (1)))
    (test (sf lst (mv lst)) 'error)
    (test (sf (mv lst) lst) 'error))
  (testsf))

(let ((lst (list 1)))
  (define (sf x y) (and (pair? x) (pair? y)))
  (define (mv x) (values x x))
  (define (testsf)
    (test (sf lst lst) #t)
    (test (sf (mv lst)) #t)
    (test (sf lst (mv lst)) 'error)
    (test (sf (mv lst) lst) 'error))
  (testsf))

(let ((lst (list 1)))
  (define (sf x) (and (pair? x) (list x x)))
  (define (mv x) (values x x))
  (define (testsf)
    (test (sf lst) '((1) (1)))
    (test (sf (mv lst)) 'error))
  (testsf))

(let ((lst (list 1)))
  (define (sf x) (and (pair? x) (pair? x)))
  (define (mv x) (values x x))
  (define (testsf)
    (test (sf lst) #t)
    (test (sf (mv lst)) 'error))
  (testsf))



;;; --------------------------------------------------------------------------------
;;; let
;;; let*
;;; letrec
;;; letrec*
;;; --------------------------------------------------------------------------------

(test (let ((x 2) (y 3)) (* x y)) 6)
(test (let ((x 32)) (let ((x 3) (y x)) y)) 32)
(test (let ((x 32)) (let* ((x 3) (y x)) y)) 3)
(test (let ((x 2) (y 3)) (let ((x 7) (z (+ x y))) (* z x))) 35)
(test (let ((x 2) (y 3)) (let* ((x 7)  (z (+ x y))) (* z x))) 70)
(test (letrec ((is-even (lambda (n)  (if (zero? n) #t (is-odd (- n 1))))) (is-odd (lambda (n)  (if (zero? n) #f (is-even (- n 1)))))) (is-even 88))  #t)
(test (let loop ((numbers '(3 -2 1 6 -5)) 
		 (nonneg ()) 
		 (neg ())) 
	(cond ((null? numbers) 
	       (list nonneg neg)) 
	      ((>= (car numbers) 0)  
	       (loop (cdr numbers) (cons (car numbers) nonneg)  neg)) 
	      ((< (car numbers) 0)  
	       (loop (cdr numbers) nonneg (cons (car numbers) neg))))) 
      '((6 1 3) (-5 -2)))
(test(let((i 1)(j 2))(+ i j))3)

(test (let ((x 3)) (define x 5) x) 5)
(test (let* () (define x 8) x) 8)
(test (letrec () (define x 9) x) 9)
(test (letrec ((x 3)) (define x 10) x) 10)
(test (let foo () 1) 1)
(test (let ((f -)) (let f ((n (f 1))) n)) -1)
(test (let () 1 2 3 4) 4)
(test (+ 3 (let () (+ 1 2))) 6)

(test (let ((x 1)) (let ((x 32) (y x)) y)) 1)
(test (let ((x 1)) (letrec ((y (if #f x 1)) (x 32)) 1)) 1)
(test (let ((x 1)) (letrec ((y (lambda () (+ 1 x))) (x 32)) (y))) 33) 
(test (let ((x 1)) (letrec ((y (* 0 x)) (x 32)) y)) 'error)
(test (let* ((x 1) (f (letrec ((y (lambda () (+ 1 x))) (x 32)) y))) (f)) 33)
(test (letrec ((x 1) (y (let ((x 2)) x))) (+ x y)) 3)
(test (letrec ((f (lambda () (+ x 3))) (x 2)) (f)) 5)
(test (let* ((x 1) (x 2)) x) 2)
(test (let* ((x 1) (y x)) y) 1)
(test (let ((x 1)) (let ((x 32) (y x)) (+ x y))) 33)
(test (let ((x 1)) (let* ((x 32) (y x)) (+ x y))) 64)
(test (let ((x 'a) (y '(b c))) (cons x y)) '(a b c))
(test (let ((x 0) (y 1)) (let ((x y) (y x)) (list x y))) (list 1 0))
(test (let ((x 0) (y 1)) (let* ((x y) (y x)) (list x y))) (list 1 1))
(test (letrec ((sum (lambda (x) (if (zero? x) 0 (+ x (sum (- x 1))))))) (sum 5)) 15)
(test (let ((divisors (lambda (n) (let f ((i 2)) (cond ((>= i n) ()) ((integer? (/ n i)) (cons i (f (+ i 1)))) (else (f (+ i 1)))))))) (divisors 32)) '(2 4 8 16))
(test (let ((a -1)) (let loop () (if (not (positive? a)) (begin (set! a (+ a 1)) (loop)))) a) 1)
(test (let () (let () (let () ()))) ())
(test (let ((x 1)) (let ((y 0)) (begin (let ((x (* 2 x))) (set! y x))) y)) 2)
(test (let* ((x 1) (x (+ x 1)) (x (+ x 2))) x) 4)
(test (let ((.. 2) (.... 4) (..... +)) (..... .. ....)) 6)
(test (let ((\"a\"")) \) "a\"")

(test (let () (begin (define x 1)) x) 1)
(test (let ((define 1)) define) 1)
(test (let ((y 1)) (begin (define x 1)) (+ x y)) 2)
(test (let ((: 0)) (- :)) 0) 
(test (symbol? (with-input-from-string ":" read)) #t)
(test (let ((: 3)) :) 3)
(test (keyword? ':) #f)
(test (symbol->keyword ':) '::)
(test (let () (define : 3) :) 3)


;;; optimizer troubles
(test (let () (define (f x) (let asd ())) (f 1)) 'error)
(test (let () (define (f x) (let ())) (f 1)) 'error)

(test (let ((pi 3)) pi) 'error)
(test (let ((:key 1)) :key) 'error)
(test (let ((:3 1)) 1) 'error)
(test (let ((3 1)) 1) 'error)
(test (let ((3: 1)) 1) 'error)
(test (let ((optional: 1)) 1) 'error)
(test (let ((x_x_x 32)) (let () (define-constant x_x_x 3) x_x_x) (set! x_x_x 31) x_x_x) 31) ; changed 18-Sep-17
(test (let ((x 1)) (+ (let ((a (begin (define x 2) x))) a) x)) 4)
(test (let ((x 1)) (+ (letrec ((a (begin (define x 2) x))) a) x)) 3)
(test (let ((a #<eof>)) (eof-object? a)) #t)
(test (let ((a #<unspecified>)) (eq? a #<unspecified>)) #t)
(test (let* ((x 1) (x (+ x 1))) x) 2) ; ??

(test (let _name_ ((x 1) (y (_name_ 2))) (+ x y)) 'error)
(test (let* _name_ ((x 1) (y (_name_ 2))) (+ x y)) 'error)
(let () (define (hi) (let* named-let ((i 0) (j (+ i 1))) j)) (hi) (test (hi) 1))

;; from lisp bboard
(test (let ((x 1) (y 2)) (let ((x y) (y x)) (let ((x y) (y x)) (let ((x y) (y x)) (+ (* x x) y))))) 5)

(test (let* ((x 1) (fx (lambda () x)) (y (define x (* x 2))) (fy (lambda () (* x y)))) (list x y (fx) (fy))) '(2 2 1 4))

;; from r7rs errata
(let ()
  (let ((ton '(3 (1 4))))
    (letrec*
	((mean
	  (lambda (f g)
	    (f (/ (sum g ton) n))))
	 (sum
	  (lambda (g ton)
	    (if (null? ton)
		(+)
		(if (number? ton)
		    (g ton)
		    (+ (sum g (car ton))
		       (sum g (cdr ton)))))))
	 (n (sum (lambda (x) 1) ton)))
      (num-test (mean values values) 8/3)
      (num-test (mean exp log) 2.289428485106664)
      (num-test (mean / /) 36/19))))

(test ((let ((x 2))
	 (let ((x 3))
	   (lambda (arg) (+ arg x))))
       1)
      4)

(test ((let ((x 2))
	 (define (inner arg) (+ arg x))
	 (let ((x 32))
	   (lambda (arg) (inner (+ arg x)))))
       1)
      35)

(test ((let ((inner (lambda (arg) (+ arg 1))))
	 (let ((inner (lambda (arg) (inner (+ arg 2)))))
	   inner))
       3)
      6)

(test ((let ()
	 (define (inner arg) (+ arg 1))
	 (let ((inner (lambda (arg) (inner (+ arg 2)))))
	   inner))
       3)
      6)

(test ((let ((x 11))
	 (define (inner arg) (+ arg x))
	 (let ((inner (lambda (arg) (inner (+ (* 2 arg) x)))))
	   inner))
       3)
      28)

(test ((let ((x 11))
	 (define (inner arg) (+ arg x))
	 (let ((x 2))
	   (lambda (arg) (inner (+ (* 2 arg) x)))))
       3)
      19)

(test (let ((f1 (lambda (arg) (+ arg 1))))
	(let ((f1 (lambda (arg) (f1 (+ arg 2)))))
	  (f1 1)))
      4)

(test (let ((f1 (lambda (arg) (+ arg 1))))
	(let* ((f1 (lambda (arg) (f1 (+ arg 2)))))
	  (f1 1)))
      4)

(test (let ((f1 (lambda (arg) (+ arg 1))))
	(let* ((x 32)
	       (f1 (lambda (arg) (f1 (+ x arg)))))
	  (f1 1)))
      34)

(test ((let ((x 11))
	 (define (inner arg) (+ arg x))
	 (let ((x 2)
	       (inner (lambda (arg) (inner (+ (* 2 arg) x)))))
	   inner))
       3)
      28)

(test ((let ((x 11))
	 (define (inner arg) (+ arg x))
	 (let* ((x 2)
		(inner (lambda (arg) (inner (+ (* 2 arg) x)))))
	   inner))
       3)
      19)

(test (let ((x 1))
	(let* ((f1 (lambda (arg) (+ x arg)))
	       (x 32))
	  (f1 1)))
      2)

(test (let ((inner (lambda (arg) (+ arg 1))))
	(let ((inner (lambda (arg) (+ (inner arg) 1))))
	  (inner 1)))
      3)
(test (let ((inner (lambda (arg) (+ arg 1))))
	(let* ((inner (lambda (arg) (+ (inner arg) 1))))
	  (inner 1)))
      3)

(test (let ((caller #f)) (let ((inner (lambda (arg) (+ arg 1)))) (set! caller inner)) (caller 1)) 2)
(test (let ((caller #f)) (let ((x 11)) (define (inner arg) (+ arg x)) (set! caller inner)) (caller 1)) 12)

(test (let ((caller #f)) 
	(let ((x 11)) 
	  (define (inner arg) 
	    (+ arg x)) 
	  (let ((y 12))
	    (let ((inner (lambda (arg) 
			   (+ (inner x) y arg)))) ; 11 + 11 + 12 + arg
	      (set! caller inner))))
	(caller 1))
      35)

(test (let ((caller #f)) 
	(let ((x 11)) 
	  (define (inner arg) 
	    (+ arg x)) 
	  (let* ((y 12) 
		 (inner (lambda (arg) 
			  (+ (inner x) y arg)))) ; 11 + 11 + 12 + arg
	    (set! caller inner))) 
	(caller 1))
      35)

(let ()
  (define (f)
    (let ((f1 (lambda (arg) (+ arg 1))))
      (let* ((x 32)
	     (f1 (lambda (arg) (f1 (+ x arg)))))
	(f1 1))))
  (test (f) 34))

(test (let* ((f1 3) (f1 4)) f1) 4)
(test (let ((f1 (lambda () 4))) (define (f1) 3) (f1)) 3)

(test (let ((j -1)
	    (k 0))
	(do ((i 0 (+ i j))
	     (j 1))
	    ((= i 3) k)
	  (set! k (+ k i))))
      3)

(test (let ((j (lambda () -1))
	    (k 0))
	(do ((i 0 (+ i (j)))
	     (j (lambda () 1)))
	    ((= i 3) k)
	  (set! k (+ k i))))
      3)


(test (let ((j (lambda () 0))
	    (k 0))
	(do ((i (j) (j))
	     (j (lambda () 1) (lambda () (+ i 1))))
	    ((= i 3) k)
	  (set! k (+ k i))))
      3) ; 6 in Guile which follows the spec

(test (let ((k 0)) (do ((i 0 (+ i 1)) (j 0 (+ j i))) ((= i 3) k) (set! k (+ k j)))) 1)

#|
(test (let ((j (lambda () 0))
	    (i 2)
	    (k 0))
	(do ((i (j) (j))
	     (j (lambda () i) (lambda () (+ i 1))))
	    ((= i 3) k)
	  (set! k (+ k i))))
      3) ; or 2?

(test (let ((f #f))
	(do ((i 0 (+ i 1)))
	    ((= i 3))
	  (let ()
	    (define (x) i)
	    (if (= i 1) (set! f x))))
	(f))
      1)
|#

(test (let ((x 1))
	(let ()
	  (define (f) x)
	  (let ((x 0))
	    (define (g) (set! x 32) (f))
	    (g))))
      1)

(test (let ((a 1))
	(let ()
	  (if (> a 1)
	      (begin
		(define a 2)))
	  a))
      1)

(test (let ((a 1))
	(let ()
	  (if (= a 1)
	      (begin
		(define a 2)))
	  a))
      2)

(let ((x 123))
  (define (hi b) (+ b x))
  (let ((x 321))
    (test (hi 1) 124)
    (set! x 322)
    (test (hi 1) 124))
  (set! x 124)
  (test (hi 1) 125)
  (let ((x 321)
	(y (hi 1)))
    (test y 125))
  (let* ((x 321)
	 (y (hi 1)))
    (test y 125))
  (test (hi 1) 125))

(test (let ((j 0)
	    (k 0))
	(let xyz
	    ((i 0))
	  (let xyz
	      ((i 0))
	    (set! j (+ j 1))
	    (if (< i 3)
		(xyz (+ i 1))))
	  (set! k (+ k 1))
	  (if (< i 3)
	      (xyz (+ i 1))))
	(list j k))
      (list 16 4))

(test (let ((x 123)) (begin (define x 0)) x) 0) ; this strikes me as weird, since (let ((x 123) (x 0)) x) is illegal, so...
(test (let ((x 0)) (define x 1) (define x 2) x) 2) 
(test (let ((x 123)) (begin (define (hi a) (+ x a)) (define x 0)) (hi 1)) 1) ; is non-lexical reference?
(test (let ((x 123)) (define (hi a) (+ x a)) (define x 0) (hi 1)) 1)
(test (let ((x 123) (y 0)) (define (hi a) (+ y a)) (define y x) (define x 0) (hi 1)) 124)

(let () ; from scheme bboard
  (define (make-accum n) (lambda* (m) (if m (set! n (+ n m)) n)))
  (let ((x (make-accum 2)))
    (test (x) 2) (test (x 1) 3) (test (x) 3)
    (let ((y (make-accum 12))) (test (y) 12) (test (y 12) 24) (test (y) 24)
      (test (x) 3))))

(for-each
 (lambda (arg)
   (test (let ((x arg)) x) arg))
 (list "hi" -1 #\a "" () #() (current-output-port) 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #t abs (list 1 2 3) '(1 . 2)))

(test (let ((x 1)) (= 1 (let ((y 2)) (set! x y) x)) (+ x 1)) 3)
(test (let ((x 1)) (let ((xx (lambda (a) (set! x a) a))) (= 1 (xx 2))) (+ x 1)) 3)
(test (let ((x 32)) (begin (define x 123) (define (hi a) (+ a 1))) (hi x)) 124)
(test (let () (begin (define x 123) (define (hi a) (+ a 1))) (hi x)) 124)


					;(let ((initial-chars "aA!$%&*/:<=>?^_~")
					;      (subsequent-chars "9aA!$%&*+-./:<=>?@^_~")
					;      (ctr 0))
					;  (format #t ";(let (")
					;  (do ((i 0 (+ i 1)))
					;      ((= i (string-length initial-chars)))
					;    (format #t ";(~A ~D) " (string (string-ref initial-chars i)) ctr)
					;    (set! ctr (+ ctr 1)))
					;
					;  (do ((i 0 (+ i 1)))
					;      ((= i (string-length initial-chars)))
					;    (do ((k 0 (+ k 1)))
					;	((= k (string-length subsequent-chars)))
					;      (format #t ";(~A ~D) " (string (string-ref initial-chars i) (string-ref subsequent-chars k)) ctr)
					;      (set! ctr (+ ctr 1))))
					;
					;  (format #t ")~%  (+ ")
					;  (do ((i 0 (+ i 1)))
					;      ((= i (string-length initial-chars)))
					;    (format #t "~A " (string (string-ref initial-chars i))))
					;
					;  (do ((i 0 (+ i 1)))
					;      ((= i (string-length initial-chars)))
					;    (do ((k 0 (+ k 1)))
					;	((= k (string-length subsequent-chars)))
					;      (format #t "~A " (string (string-ref initial-chars i) (string-ref subsequent-chars k)))))
					;
					;  (format #t "))~%"))

(num-test (let ((a 0) (A 1) (! 2) ($ 3) (% 4) (& 5) (| 8) (? 12) (^ 13) (_ 14) (~ 15) (a9 16) (aa 17) (aA 18) (a! 19) (a$ 20) (a% 21) (a& 22) (a* 23) (a+ 24) (a- 25) (a. 26) (a/ 27) (a| 28) (a< 29) (a= 30) (a> 31) (a? 32) (a@ 33) (a^ 34) (a_ 35) (a~ 36) (A9 37) (Aa 38) (AA 39) (A! 40) (A$ 41) (A% 42) (A& 43) (A* 44) (A+ 45) (A- 46) (A. 47) (A/ 48) (A| 49) (A< 50) (A= 51) (A> 52) (A? 53) (A@ 54) (A^ 55) (A_ 56) (A~ 57) (!9 58) (!a 59) (!A 60) (!! 61) (!$ 62) (!% 63) (!& 64) (!* 65) (!+ 66) (!- 67) (!. 68) (!/ 69) (!| 70) (!< 71) (!= 72) (!> 73) (!? 74) (!@ 75) (!^ 76) (!_ 77) (!~ 78) ($9 79) ($a 80) ($A 81) ($! 82) ($$ 83) ($% 84) ($& 85) ($* 86) ($+ 87) ($- 88) ($. 89) ($/ 90) ($| 91) ($< 92) ($= 93) ($> 94) ($? 95) ($@ 96) ($^ 97) ($_ 98) ($~ 99) (%9 100) (%a 101) (%A 102) (%! 103) (%$ 104) (%% 105) (%& 106) (%* 107) (%+ 108) (%- 109) (%. 110) (%/ 111) (%| 112) (%< 113) (%= 114) (%> 115) (%? 116) (%@ 117) (%^ 118) (%_ 119) (%~ 120) (&9 121) (&a 122) (&A 123) (&! 124) (&$ 125) (&% 126) (&& 127) (&* 128) (&+ 129) (&- 130) (&. 131) (&/ 132) (&| 133) (&< 134) (&= 135) (&> 136) (&? 137) (&@ 138) (&^ 139) (&_ 140) (&~ 141) (*9 142) (*a 143) (*A 144) (*! 145) (*$ 146) (*% 147) (*& 148) (** 149) (*+ 150) (*- 151) (*. 152) (*/ 153) (*| 154) (*< 155) (*= 156) (*> 157) (*? 158) (*@ 159) (*^ 160) (*_ 161) (*~ 162) (/9 163) (/a 164) (/A 165) (/! 166) (/$ 167) (/% 168) (/& 169) (/* 170) (/+ 171) (/- 172) (/. 173) (// 174) (/| 175) (/< 176) (/= 177) (/> 178) (/? 179) (/@ 180) (/^ 181) (/_ 182) (/~ 183) (|9 184) (ca 185) (CA 186) (|! 187) (|$ 188) (|% 189) (|& 190) (|* 191) (|+ 192) (|- 193) (|. 194) (|/ 195) (cc 196) (|< 197) (|= 198) (|> 199) (|? 200) (|@ 201) (|^ 202) (|_ 203) (|~ 204) (<9 205) (<a 206) (<A 207) (<! 208) (<$ 209) (<% 210) (<& 211) (<* 212) (<+ 213) (<- 214) (<. 215) (</ 216) (<| 217) (<< 218) (<> 220) (<? 221) (<@ 222) (<^ 223) (<_ 224) (<~ 225) (=9 226) (=a 227) (=A 228) (=! 229) (=$ 230) (=% 231) (=& 232) (=* 233) (=+ 234) (=- 235) (=. 236) (=/ 237) (=| 238) (=< 239) (== 240) (=> 241) (=? 242) (=@ 243) (=^ 244) (=_ 245) (=~ 246) (>9 247) (>a 248) (>A 249) (>! 250) (>$ 251) (>% 252) (>& 253) (>* 254) (>+ 255) (>- 256) (>. 257) (>/ 258) (>| 259) (>< 260) (>> 262) (>? 263) (>@ 264) (>^ 265) (>_ 266) (>~ 267) (?9 268) (?a 269) (?A 270) (?! 271) (?$ 272) (?% 273) (?& 274) (?* 275) (?+ 276) (?- 277) (?. 278) (?/ 279) (?| 280) (?< 281) (?= 282) (?> 283) (?? 284) (?@ 285) (?^ 286) (?_ 287) (?~ 288) (^9 289) (^a 290) (^A 291) (^! 292) (^$ 293) (^% 294) (^& 295) (^* 296) (^+ 297) (^- 298) (^. 299) (^/ 300) (^| 301) (^< 302) (^= 303) (^> 304) (^? 305) (^@ 306) (^^ 307) (^_ 308) (^~ 309) (_9 310) (_a 311) (_A 312) (_! 313) (_$ 314) (_% 315) (_& 316) (_* 317) (_+ 318) (_- 319) (_. 320) (_/ 321) (_| 322) (_< 323) (_= 324) (_> 325) (_? 326) (_@ 327) (_^ 328) (__ 329) (_~ 330) (~9 331) (~a 332) (~A 333) (~! 334) (~$ 335) (~% 336) (~& 337) (~* 338) (~+ 339) (~- 340) (~. 341) (~/ 342) (~| 343) (~< 344) (~= 345) (~> 346) (~? 347) (~@ 348) (~^ 349) (~_ 350) (~~ 351) )
	    (+ a A ! $ % & | ? ^ _ ~ a9 aa aA a! a$ a% a& a* a+ a- a. a/ a| a< a= a> a? a@ a^ a_ a~ A9 Aa AA A! A$ A% A& A* A+ A- A. A/ A| A< A= A> A? A@ A^ A_ A~ !9 !a !A !! !$ !% !& !* !+ !- !. !/ !| !< != !> !? !@ !^ !_ !~ $9 $a $A $! $$ $% $& $* $+ $- $. $/ $| $< $= $> $? $@ $^ $_ $~ %9 %a %A %! %$ %% %& %* %+ %- %. %/ %| %< %= %> %? %@ %^ %_ %~ &9 &a &A &! &$ &% && &* &+ &- &. &/ &| &< &= &> &? &@ &^ &_ &~ *9 *a *A *! *$ *% *& ** *+ *- *. */ *| *< *= *> *? *@ *^ *_ *~ /9 /a /A /! /$ /% /& /* /+ /- /. // /| /< /= /> /? /@ /^ /_ /~ |9 ca CA |! |$ |% |& |* |+ |- |. |/ cc |< |= |> |? |@ |^ |_ |~ <9 <a <A <! <$ <% <& <* <+ <- <. </ <| << <> <? <@ <^ <_ <~ =9 =a =A =! =$ =% =& =* =+ =- =. =/ =| =< == => =? =@ =^ =_ =~ >9 >a >A >! >$ >% >& >* >+ >- >. >/ >| >< >> >? >@ >^ >_ >~ ?9 ?a ?A ?! ?$ ?% ?& ?* ?+ ?- ?. ?/ ?| ?< ?= ?> ?? ?@ ?^ ?_ ?~ ^9 ^a ^A ^! ^$ ^% ^& ^* ^+ ^- ^. ^/ ^| ^< ^= ^> ^? ^@ ^^ ^_ ^~ _9 _a _A _! _$ _% _& _* _+ _- _. _/ _| _< _= _> _? _@ _^ __ _~ ~9 ~a ~A ~! ~$ ~% ~& ~* ~+ ~- ~. ~/ ~| ~< ~= ~> ~? ~@ ~^ ~_ ~~ ))
	  61253)

(test (let ()(+ (let ((x 0) (y 1) (z 2) )(+ x y (let ((x 3) )(+ x (let ()(+ (let ()
									      (+ (let ((x 0) (y 1) (z 2) )(+ x y z (let ((x 3) )(+ x (let ((x 4) (y 5) (z 6) )
																       (+ x y z (let ()(+ (let ((x 7) )(+ x (let ()(+ (let ((x 8) (y 9) )
																							(+ x (let ((x 10) (y 11) (z 12) )(+ x  ))))))))))))))))))))))))))
      50)
(test  (let* ((x 0) (y x) )(+ x y (let ()(+ (let ((x 2) )(+ x (let ()(+ (let ((x 4) )
									  (+ x (let ((x 5) )(+ x (let ((x 6) (y x) (z y) )(+ x (let ((x 7) (y x) )
																 (+ x (let ((x 8) (y x) )(+ x y (let ((x 9) (y x) (z y) )(+ x ))))))))))))))))))))
       48)
(test (let* ((x 0) (y x) )(+ x y (let* ()(+ (let* ((x 2) )(+ x (let* ()(+ (let* ((x 4) )
									    (+ x (let* ((x 5) )(+ x (let* ((x 6) (y x) (z y) )(+ x (let* ((x 7) (y x) )
																     (+ x (let* ((x 8) (y x) )(+ x y (let* ((x 9) (y x) (z y) )(+ x ))))))))))))))))))))
      49)

(test (let ((!@$%^&*~|}{?><.,/`_-+=:! 1)) (+ !@$%^&*~|}{?><.,/`_-+=:! 1)) 2)
(test (let ((:hi 1)) :hi) 'error)
(test (let ((:hi: 1)) :hi:) 'error)
(test (let ((hi: 1)) hi) 'error)
(let ((1.0+2j (lambda (a) (+ a 1.0+2i))))
  (num-test (1.0+2j 3+i) 4.0+3i))
(test (let ((*1.11* 3)) *1.11*) 3)

(test (let func ((a 1) (b 2)) (set! b a) (if (> b 0) (func (- a 1) b)) b) 1)
(test (let func ((a 1) (b 2)) (set! b a) (if (> b 0) (func (- a 1) b) b)) 0)
(test (let loop ((numbers '(3 -2 1 6 -5))
		 (nonneg ())
		 (neg ()))
	(cond ((null? numbers) (list nonneg neg))
	      ((>= (car numbers) 0)
	       (loop (cdr numbers)
		     (cons (car numbers) nonneg)
		     neg))
	      ((< (car numbers) 0)
	       (loop (cdr numbers)
		     nonneg
		     (cons (car numbers) neg)))))   
      '((6 1 3) (-5 -2)))
(test (let ((b '(1 2 3)))
	(let* ((a b)
	       (b (cons 0 a)))
	  (let b ((a b))
	    (if (null? a)
		'done
		(b (cdr a))))))
      'done)
(test (let lp ((x 100))
	(if (positive? x)
	    (lp (- x 1))
	    x))
      0)
(test (let func ((a 1) (b 2) (c 3)) (+ a b c (if (> a 1) (func (- a 1) (- b 1) (- c 1)) 0))) 6)
(test (let func ((a 1) (b 2) (c 3)) (+ a b c (if (> a 1) (func (- a 1) (- b 1)) 0))) 6) ; these work only because we don't try to call func -- maybe they should anyway?
(test (let func ((a 1) (b 2) (c 3)) (+ a b c (if (> a 1) (func (- a 1)) 0))) 6)
(test (let func ((a 1) (b 2) (c 3)) (+ a b c (if (> a 1) (func) 0))) 6)
(test (let func ((a 1) (b 2) (c 3)) (+ a b c (if (> a 0) (func (- a 1) (- b 1) (- c 1)) 0))) 9)

(test (let func ((a 1) (b 2) (c 3)) (+ a b c (if (> a 0) (func (- a 1) (- b 1)) 0))) 'error)
(test (let func () 1) 1)
(test (let ((a 1)) (let func () (if (> a 1) (begin (set! a (- a 1)) (func)) 0))) 0)
(test (let func1 ((a 1)) (+ (let func2 ((a 2)) a) a)) 3)
(test (let func1 ((a 1)) (+ (if (> a 0) (func1 (- a 1)) (let func2 ((a 2)) (if (> a 0) (func2 (- a 1)) 0))) a)) 1)
(test (let func ((a (let func ((a 1)) a))) a) 1)
(test (let ((i 3)) (let func () (set! i (- i 1)) (if (> i 0) (func))) i) 0)
(test (let func ((a 1)) (define (func a) 2) (func 1)) 2)
(test (let func ((a 1)) (define func (lambda (a) (func a))) (if (> a 1) (func (- a 1)) 0)) 0)
(test (let loop ((i 0)) (let loop ((i 0)) (if (< i 1) (loop (+ i 1)))) i) 0)
(test (let ((j 123)) (define (f g) (set! j 0) (g 0)) (let loop ((i 1)) (if (> i 0) (f loop))) j) 0)
(test (procedure? (let loop () loop)) #t)
(test (let loop1 ((func 0)) (let loop2 ((i 0)) (if (not (procedure? func)) (loop1 loop2)) func)) 0)
(test (let ((k 0)) (let ((x (let xyz ((i 0)) (set! k (+ k 1)) xyz))) (x 0)) k) 2)
(test (let ((hi' 3) (a'b 2)) (+ hi' a'b)) 5)
(test (let ((hi''' 3) (a'''b 2)) (+ hi''' a'''b)) 5)
(test (let ((f (let func ((i 0)) (if (= i 0) func (if (> i 1) (+ i (func (- i 1))) 1))))) (map f '(1 2 3))) '(1 3 6))
(test (let ((x 0)) (let ((f (lambda (a) (+ a x)))) (map (let () (set! x (+ x 1)) f) '(1 2 3)))) '(2 3 4))
(test (let x ((x (lambda (y) y))) (x 2)) 2)

(test (let () (define (f4) (let loop ((i 0)) (set! loop 3) loop)) (f4)) 3)
(test (let () (define (f5) (let loop ((i 0)) (set! loop (lambda () 2)) (loop))) (f5)) 2)
(test (let () (define (f6) (let loop ((i 0)) (define (loop) 2) (loop))) (f6)) 2)

(let ((enter 0)
      (exit 0)
      (inner 0))
  (define (j1) 
    (set! enter (+ enter 1))
    (let ((result 
	   (let hiho
	       ((i 0))
	     (set! inner (+ inner 1))
	     (if (< i 3) 
		 hiho
		 i))))
      (set! exit (+ exit 1))
      result))

  (let ((j2 (j1)))
    (test (and (procedure? j2) (= enter 1) (= exit 1) (= inner 1)) #t)
    (let ((result (j2 1)))
      (test (and (procedure? result) (= enter 1) (= exit 1) (= inner 2)) #t)
      (set! result (j2 3))
      (test (and (= result 3) (= enter 1) (= exit 1) (= inner 3)) #t))))


(let ()
  (define (block-comment-test a b c)
    (+ a b c))

  (let ((val (block-comment-test 
#|
	    a comment
|#
	    1 #| this is a |# 
#|
            another comment
|#
 2 #| this is b |# 3)))

    (test val 6)))


(test (letrec* ((p (lambda (x)
		     (+ 1 (q (- x 1)))))
		(q (lambda (y)
		     (if (zero? y)
			 0
			 (+ 1 (p (- y 1))))))
		(x (p 5))
		(y x))
	y)
      5)
(test (letrec ((p (lambda (x)
		     (+ 1 (q (- x 1)))))
	       (q (lambda (y)
		    (if (zero? y)
			0
			(+ 1 (p (- y 1))))))
	       (x (p 5))
	       (y x))
	y)
      'error)
(test (let* ((p (lambda (x)
		     (+ 1 (q (- x 1)))))
	     (q (lambda (y)
		  (if (zero? y)
		      0
		      (+ 1 (p (- y 1))))))
	     (x (p 5))
	     (y x))
	y)
      'error)

(test (let ((x 1) ((y 2))) x) 'error)
(test (let ((x 1 2 3)) x) 'error)
(test (let ((+ 1 2)) 2) 'error)
(test (let* ((x 1 2)) x) 'error)
(test (letrec ((x 1 2)) x) 'error)
(test (letrec* ((x 1 2)) x) 'error)
(test (let ((x 1 . 2)) x) 'error)
(test (let ((x 1 , 2)) x) 'error)
(test (let ((x . 1)) x) 'error)
(test (let* ((x . 1)) x) 'error)
(test (letrec ((x . 1)) x) 'error)
(test (letrec* ((x . 1)) x) 'error)
(test (let hi ()) 'error)
(test (let* ((x -1) 2) 3) 'error)
(test (let ((x -1) 2) 3) 'error)
(test (letrec ((x -1) 2) 3) 'error)
(test (let ((pi 3)) pi) 'error)
(test (let* ((pi 3)) pi) 'error)
(test (letrec ((pi 3)) pi) 'error)

(test (let ((a 1) (a 2)) a) 'error)
(test (letrec ((a 1) (a 2)) a) 'error)
(test (letrec* ((a 1) (a 2)) a) 'error)
(test (let* ((a 1) (a (+ a 1))) a) 2) ; ??

(test (let* hi () . =>) 'error)
(test (let hi () . =>) 'error)

(test (let hiho ((a 3) (hiho 4)) a) 3)
(test (let hiho ((hiho 4)) hiho) 4)                ; guile=4
(test (let hiho ((hiho hiho)) hiho) 'error)        ; guile sez error
(test (let ((hiho 4) (hiho 5)) hiho) 'error)       ; guile sez error
(test (let hiho ((a (hiho 1))) a) 'error)          ; guile sez error
(test (let hiho ((hiho 3)) (hiho hiho)) 'error)    ; guile sez error

(test (let) 'error)
(test (let*) 'error)
(test (letrec) 'error)
(test (let . 1) 'error)
(test (let* (x)) 'error)
(test (let (x) 1) 'error)
(test (let ((x)) 3) 'error)
(test (let ((x 1) y) x) 'error)
(test (let* x ()) 'error)
(test (let* ((1 2)) 3) 'error)
(test (let () ) 'error)
(test (let '() 3) 'error)
(test (let* ((x 1))) 'error)
(test (let ((x 1)) (letrec ((x 32) (y x)) (+ 1 y))) 'error) ; #<unspecified> seems reasonable if not the 1+ 
(test (let ((x 1)) (letrec ((y x) (x 32)) (+ 1 y))) 'error)
(test (let ((x 1)) (letrec ((y x) (x 32)) 1)) 1)
(test (let ((x 1)) (letrec ((y (let () (+ x 1))) (x 32)) (+ 1 y))) 'error)
(test (let ((x 1)) (letrec ((y (let ((xx (+ x 1))) xx)) (x 32)) (+ 1 y))) 'error)
(test (let ((x 32)) (letrec ((y (apply list `(* ,x 2))) (x 1)) y)) '(* #<undefined> 2))
(test (letrec) 'error)
(test (letrec*) 'error)
(test (let ((x . 1)) x) 'error)
(test (letrec* ((and #2D((1 2) (3 4)) 3/4))) 'error)
(test (letrec* ((hi "" #\a))) 'error)

(let ((f2 #<undefined>))
  (letrec ((f1 (lambda (x)
		 (if (positive? x)
		     (f2 (- x 1))  ; this is a forward ref to f2 below, Guile (1.8.7)/Chicken say f2 unbound, s7/chibi are happy
		     0))))					
    (define (f2 x)
      (if (positive? x)
	  (f1 (- x 1))
	  0))
    (test (f1 3) 0)))

(let ((f2 #<undefined>))
  (let ((f1 (lambda (x)
	      (if (positive? x)
		  (f2 (- x 1)) 0)))) ; unbound -- this is the outer env
    (define (f2 x)
      (if (positive? x)
	  (f1 (- x 1)) 0))
    (test (f1 3) 'error)))

(let ((f2 #<undefined>))
  (letrec ((f1 (lambda (x)            ; s7/Chicken/Guile/chibi happy
		 (if (positive? x)
		     (f2 (- x 1)) 0)))
	   (f2 (lambda (x)
		 (if (positive? x)
		     (f1 (- x 1)) 0))))
    (test (f1 3) 0)))

(let ((f2 #<undefined>))
  (letrec ((f1 (lambda (x)
		 (if (positive? x)
		     (f1 (- x f2)) 0)))) ; so anything subsequently added to this env is already here ?
    (define f2 1)
    (test (f1 3) 0)))

(let ((f2 #<undefined>))
  (letrec ((f1 (lambda (x)
		 (if (positive? x)
		     (f1 (- x f2)) 0))))
    (test (f1 3) 'error)                ; nope -- depends on ordering
    (define f2 1)))

(let ((f2 0))
  (letrec ((f1 (lambda () f2)))
    (test (f1) 0)
    (define f2 1)
    (test (f1) 1)))                     ; s7: 0 1, Chicken: 0 0, chibi: 1 1, Guile 1.8: "bad define placement", Guile 2.0: define in expression context
					;  Gauche also complains about define's placement, as does chibi (a warning)

(let ((f2 0))                           ; s7 01, chibi #<undef>1, chicken/guile 1.8 no letrec*, Guile 2.0.13/Gauche: 00
  (letrec* ((f1 (lambda () f2))
	    (fx (begin (test (f1) 0) 3)))
    (define f2 1)
    (test (f1) 1)))

(let ((f2 0))
  (letrec ((f1 (lambda () f2)))
    (letrec ((fx (begin (test (f1) 0) 3)))
      (define f2 1)
      (test (f1) 0))))                  ; s7 00, guile 1.8/2.0 00, chicken 00, chibi 00, gauche 00

(let ((f2 0))
  (letrec ((f1 (lambda () f2)))
    (define f2 (let () (test (f1) 0) 1))
    (test (f1) 1)))                     ; s7 01, guile 1.8/2.0 00, chicken 00, chibi #<undef>1, gauche 00

(let ((f2 (lambda () 0)))
  (letrec ((f1 (lambda () (f2))))
    (define f2 (let () (test (f1) 0) (lambda () 1)))
    (test (f1) 1)))                     ; s7 01, chicken/guile/gauche 00, chibi: error #<undef> application

(let ((f2 0))
  (letrec* ((f1 (lambda () f2))
	    (f2 (let () (test (f1) #<undefined>) 1)))
    (test (f1) 1)))                     ; all undefined/unspecified 1

(let ((f2 (lambda () 0)))
  (letrec* ((f1 (lambda () (f2)))
	    (f2 (let () (test (f1) 'error) (lambda () 1)))) ; f2 undefined s7/chibi
    (test (f1) 1)))

(let ((f2 0))                           ; s7 01, guile 1.8/2.0 00, chicken no letrec*, chibi #<undef>1, gauche 00
  (letrec* ((f1 (lambda () f2)))
    (define f2 (let () (test (f1) 0) 1))
    (test (f1) 1)))

(let ((f2 0))                           ; all 00
  (let ((f1 (lambda () f2)))
    (define f2 (let () (test (f1) 0) 1))
    (test (f1) 0)))

(let ((f2 0))                           ; all 00
  (let ((f1 (lambda () f2)))
    ((lambda ()
       (define f2 (let () (test (f1) 0) 1))
       (test (f1) 0)))))

(let ((f2 0))                           ; s7 01, guile 1.8/2.0 00, chicken 00, chibi #<undef>1, gauche 00
  (letrec ((f1 (lambda () f2)))
    (define f2 (let () (test (f1) 0) 1))
    (test (f1) 1)))
 
(let ((f2 0))                           ; all 00
  (let ((f1 (lambda () f2)))
    ((lambda ()
       (letrec* ((f2 (let () (test (f1) 0) 1)))
	 (test (f1) 0))))))

(let ((f2 0))                           ; all 00
  (letrec ((f1 (lambda () f2)))
    (letrec* ((f2 (let () (test (f1) 0) 1)))
      (test (f1) 0))))

(let ((f1 0) (f2 1) (f3 2) (f4 3))
  (letrec* ((f1 (lambda () f2))
	    (f2 (let () 
		  (test (f1) #<undefined>)
		  4))
	    (f3 (lambda () (f4)))
	    (f4 (lambda () 5)))
    (test (f1) 4)
    (test (f3) 5)))

(let ((f1 0) (f2 1) (f3 2) (f4 3))
  (define (f1) f2)
  (define f2 (let () 
	       (test (f1) 1)
	       4))
  (define (f3) (f4))
  (define f4 (lambda () 5))
  (test (f1) 4)
  (test (f3) 5))

;;; s7/chibi do not treat a body as letrec*


(test (let #((a 1)) a) 'error)
(test (let* #((a 1)) a) 'error)
(test (letrec #((a 1)) a) 'error)
(test (letrec* #((a 1)) a) 'error)

;; (let *((a 1)) a) -> 1 ; * is named let name?
(test (letrec *((a 1)) a) 'error)
(test (letrec* *((a 1)) a) 'error)
(test (letrec* (((a 1) 2)) a) 'error)
(test (letrec* (#(a 1) 2) a) 'error)
(test (letrec* ((a a)) a) #<undefined>) ; hmm -- guile says Variable used before given a value: a
(test (let . (((a 1)) a)) 1)
(test (let '((a 1)) a) 'error)
(test (let (((x 1)) 2) 3) 'error)
(test (let ((#f 1)) #f) 'error)
(test (let (()) #f) 'error)
(test (let (lambda () ) #f) 'error)
(test (let ((f1 3) (f1 4)) f1) 'error) ; not sure about this
;;   (let () (define (f1) 3) (define (f1) 4) (f1))
(test (let ((asdf (lambda (a) (if (> a 0) (asdf (- a 1)) 0)))) (asdf 3)) 'error)
(test (let* ((asdf (lambda (a) (if (> a 0) (asdf (- a 1)) 0)))) (asdf 3)) 'error)
(test (let (('a 3)) 1) 'error)
(test (let ((#\a 3)) #\a) 'error)
;;      (test (let ((#z1 2)) 1) 'error)
(test (let ('a 3) 1) 'error)
(test (let 'a 1) 'error)
(test (let* func ((a 1)) a) 1)
(test (letrec func ((a 1)) a) 'error)
(test (letrec* func ((a 1)) a) 'error)

(test (let ((1 3)) 3) 'error)
(test (let ((#t 3)) 3) 'error)
(test (let ((() 3)) 3) 'error)
(test (let ((#\c 3)) 3) 'error)
(test (let (("hi" 3)) 3) 'error)
(test (let ((:hi 3)) 3) 'error)

(test (let 1 ((i 0)) i) 'error)
(test (let #f ((i 0)) i) 'error)
(test (let "hi" ((i 0)) i) 'error)
(test (let #\c ((i 0)) i) 'error)
(test (let :hi ((i 0)) i) 'error)
(test (let pi () #f) 'error)

(test (let func ((a 1) . b) a) 'error)
(test (let func a . b) 'error)
(test (let let func ((a 1)) func) 'error)
(test (let func 1 ((x 1)) x) 'error)
(test (let func ((a 1) . b) (if (> a 0) (func (- a 1) 2 3) b)) 'error)
(test (let func ((a . 1)) a) 'error)
(test (let func (a . 1) a) 'error)
(test (let ((a 1) . b) a) 'error)
(test (let* ((a 1) . b) a) 'error)
(test (let func ((a func) (i 1)) i) 'error)
(test (let func ((i 0)) (if (< i 1) (func))) 'error)
(test (let func (let ((i 0)) (if (< i 1) (begin (set! i (+ i 1)) (func))))) 'error)
(test (let ((x 0)) (set! x (+ x 1)) (begin (define y 1)) (+ x y)) 2)
(test (let loop loop) 'error)
(test (let loop (loop)) 'error)
(test (let loop ((i 0) (loop 1)) i) 0) ; this used to be an error, Guile also returns 0

(test (letrec ((cons 1 (quote ())) . #(1)) 1) 'error)
(test (letrec ((a 1) . 2) 1) 'error)
(test (let* ((a 1) (b . 2) . 1) (())) 'error)
(test (let "" 1) 'error)
(test (let "hi" 1) 'error)
(test (let #(1) 1) 'error)
(test (let __hi__ #t) 'error)
(test (letrec (1 2) #t) 'error)
(test (letrec* (1 2) #t) 'error)
(test (let hi (()) 1) 'error)
(test (let hi a 1) 'error)

;;; named let*
(test (let* hi #t) 'error)
(test (let* "hi" () #f) 'error)
(test (let* hi ()) 'error)
(test (let* pi () #f) 'error)
(test (let* hi x 1) 'error)
(test (let* hi (c) 1) 'error)
(test (let* hi ((x . 1)) #f) 'error)
;(test (let* hi . a 1) 'error) -- reader error in this context
(test (let* hi ((a 1) . b) a) 'error)
(test (let* hi ((a 1) :key b) a) 'error)
(test (let* hi ((a 1) :allow-other-keys) a) 'error)
(test (let* hi (a b) a) 'error)

(test (let* hi () 1) 1)
(test (let* func ((i 1) (j 2)) (+ i j (if (> i 0) (func (- i 1)) 0))) 5)
(test (let* func ((i 1) (j 2) (k (+ j 1))) (+ i j k (if (> i 0) (func (- i 1)) 0))) 11)
(test (let* func ((i 1) (j 2) (k (+ j 1))) (+ i j k (let () (set! j -123) (if (> i 0) (func (- i 1)) 0)))) 11)
(test (let* func1 ((a 1) (b 2)) (+ a b (let* func2 ((a -1) (b (- a 1))) (if (< a 0) (func2 (+ a 1)) b)))) 2) ; 2nd b is -1 -- this changed 8-Jan-14
(test (procedure? (let* func ((i 1) (j 2) (k (+ j 1))) func)) #t)
(test (let* func ((a 1) (b 2)) (+ a b (if (> a 0) (func (- a 1) (- b 1)) 0))) 4)
(test (let* func ((a 1) (b 2)) (+ a b)) 3)
(test (let* func ((a (+ 1 2)) (b (+ a 2))) (+ a b)) 8)
(test (let* func ((a 1) (b 2)) (+ a b (if (> a 0) (func (- a 1) :b (- b 1)) 0))) 4)
(test (let* func ((a 1) (b 2)) (+ a b (if (> a 0) (func :a (- a 1) :b (- b 1)) 0))) 4)
(test (let* func ((a 1) (b 2)) (+ a b (if (> a 0) (func :b (- b 1) :a (- a 1)) 0))) 4)
(test (let* func ((a 1) (b 2)) (+ a b (if (> a 0) (func :a (- a 1)) 0))) 5)

;;; these ought to work, but see s7.c under EVAL: (it's a speed issue)
;(test (let let ((i 0)) (if (< i 3) (let (+ i 1)) i)) 3)
;(test (let () (define (if a) a) (if 1)) 1)
;(test (let begin ((i 0)) (if (< i 3) (begin (+ i 1)) i)) 3)


;;; from the scheme wiki
;;; http://community.schemewiki.org/?sieve-of-eratosthenes

(let ((results '(2)))
  (define (primes n) 
    (let ((pvector (make-vector (+ 1 n) #t))) ; if slot k then 2k+1 is a prime 
      (let loop ((p 3) ; Maintains invariant p = 2j + 1 
		 (q 4) ; Maintains invariant q = 2j + 2jj 
		 (j 1) 
		 (k ()) 
		 (vec pvector)) 
	(letrec ((lp (lambda (p q j k vec) 
		       (loop (+ 2 p) 
			     (+ q (- (* 2 (+ 2 p)) 2)) 
			     (+ 1 j) 
			     k 
			     vec))) 
		 (eradicate (lambda (q p vec) 
			      (if (<= q n) 
				  (begin (vector-set! vec q #f) 
					 (eradicate (+ q p) p vec)) 
				  vec)))) 
          (if (<= j n) 
	      (if (eq? #t (vector-ref vec j)) 
		  (begin (set! results (cons p results))
			 (lp p q j q (eradicate q p vec))) 
		  (lp p q j k vec)) 
	      (reverse results))))))
  (test (primes 10) '(2 3 5 7 11 13 17 19)))

(test (let ((gvar 32)) (define (hi1 a) (+ a gvar)) (let ((gvar 0)) (hi1 2))) 34)
(test (let ((gvar 32)) (define-macro (hi2 b) `(* gvar ,b)) (define (hi1 a) (+ (hi2 a) gvar)) (let ((gvar 0)) (hi1 2))) 96)
(test (let ((gvar 32)) (define-macro (hi2 b) `(* gvar ,b)) (define (hi1 a) (+ a gvar)) (let ((gvar 0)) (hi1 (hi2 2)))) 32)
(test (let ((gvar 32)) (define-macro (hi2 b) `(* gvar ,b)) (define (hi1 a) (+ (a 2) gvar)) (let ((gvar 0)) (define (hi2 a) (* a 2)) (hi1 hi2))) 36)
(test (let ((gvar 32)) (define-macro (hi2 b) `(* gvar ,b)) (define (hi1 a) (+ (a 2) gvar)) (let ((gvar 0) (hi2 (lambda (a) (hi2 a)))) (hi1 hi2))) 96)
(test (let ((gvar 32)) (define-macro (hi2 b) `(* gvar ,b)) (define (hi1 a) (+ (a 2) gvar)) (let* ((gvar 0) (hi2 (lambda (a) (hi2 a)))) (hi1 hi2))) 32)
(test (let () ((let ((gvar 32)) (define-macro (hi2 b) `(* gvar ,b)) (define (hi1 a) (+ (hi2 2) gvar)) hi1) 2)) 96)
(test (let ((gvar 0)) ((let ((gvar 1)) (define-macro (hi2 b) `(+ gvar ,b)) (define (hi1 a) (let ((gvar 2)) (hi2 a))) hi1) 2)) 4)
(test (let ((gvar 0)) (define-macro (hi2 b) `(+ gvar ,b)) ((let ((gvar 1)) (define (hi1 a) (let ((gvar 2)) (a 2))) hi1) hi2)) 4)
(test (let ((gvar 0)) (define-macro (hi2 b) `(+ gvar ,b)) ((let ((gvar 1)) (define (hi1 a) (a 2)) hi1) hi2)) 3)
(test (let () (define-macro (hi2 b) `(+ gvar ,b)) ((let ((gvar 1)) (define (hi1 a) (a 2)) hi1) hi2)) 3)
(test (let ((y 1) (x (let ((y 2) (x (let ((y 3) (x 4)) (+ x y)))) (+ x y)))) (+ x y)) 10)
(test (let ((x 0)) 
	(+ (let ((x 1) (y (+ x 1))) 
	  (+ (let ((x 2) (y (+ x 1))) 
	    (+ (let ((x 3) (y (+ x 1))) 
	      (+ (let ((x 4) (y (+ x 1))) 
		(+ (let ((x 5) (y (+ x 1)))
		  (+ (let ((x 6) (y (+ x 1))) 
		    (+ (let ((x 7) (y (+ x 1)))
			 (+ x y)) x)) x)) x)) x)) x)) x)) x)) 35)

(test (let loop ((lst (list 1 2)) 
		 (i 0) 
		 (sum 0))
	(if (or (null? lst)
		(> i 10))
	    sum
	    (begin
	      (set-cdr! (cdr lst) lst)
	      (loop (cdr lst) (+ i 1) (+ sum (car lst))))))
      16)

;;; these are confusing:
;(letrec ((if 0.0)) ((lambda () (if #t "hi")))) -> "hi"
;(let ((let 0)) let) -> 0
;(let* ((lambda 0)) ((lambda () 1.5))) -> 1.5 ; syntax error in Guile
;(let* ((lambda 0)) lambda) -> 0

;; from test-submodel.scm, from MIT I think
(test (letrec ((factorial
		(lambda (n)
		  (if (<= n 0) 1 (* n (factorial (- n 1)))))))
	(factorial 3))
      6)

(test (letrec ((iter-fact
		(lambda (n)
		  (letrec
		      ((helper (lambda (n p)
				 (if (<= n 0) p (helper (- n 1) (* n p))))))
		    (helper n 1)))))
	(iter-fact 3))
      6)

(test (letrec ((y-factorial
		(lambda (n)
		  (letrec ((y
			    (lambda (f)
			      ((lambda (x)
				 (f (lambda (z) ((x x) z))))
			       (lambda (x)
				 (f (lambda (z) ((x x) z)))))))
			   (fact-def
			    (lambda (fact)
			      (lambda (n)
				(if (<= n 0)
				    1
				    (* n (fact (- n 1))))))))
		    ((y fact-def) n)))))
	(y-factorial 3))
      6)

(test (let ((x 1)) (let ((x 0) (y x)) (cons x y))) '(0 . 1))
(test (let ((x 1)) (let* ((x 0) (y x)) (cons x y))) '(0 . 0))
(test (let ((x 1)) (letrec ((x 0) (y x)) (cons x y))) '(0 . #<undefined>))
(test (let ((x 1)) (letrec* ((x 0) (y x)) (cons x y))) '(0 . 0))

(test (let ((x 1)) (let ((x 0) (y (let () (set! x 2) x))) (cons x y))) '(0 . 2))
(test (let ((x 1)) (letrec ((x 0) (y (let () (set! x 2) x))) (cons x y))) '(0 . 2))
(test (let ((x 1)) (let* ((x 0) (y (let () (set! x 2) x))) (cons x y))) '(2 . 2))
(test (let ((x 1)) (letrec* ((x 0) (y (let () (set! x 2) x))) (cons x y))) '(2 . 2))

(test (letrec ((x x)) x) #<undefined>) ; weird
(test (letrec ((x y) (y x)) x) #<undefined>)

(test (procedure? (letrec ((x (lambda () x))) x)) #t)
(test (procedure? (letrec ((x (lambda () x))) (x))) #t)
(test (letrec ((x (lambda () x))) (equal? x (x))) #t)  ; !
(test (letrec ((x (lambda () x))) (equal? x ((x)))) #t)  ; !

(test (letrec* ()) 'error)
(test (letrec* ((x 1 x)) x) 'error)
(test (letrec* ((x x)) x) #<undefined>) ;??
(test (let ((x 1)) (letrec* ((x x)) x)) #<undefined>)
(test (letrec ((x x)) x) #<undefined>)
(test (let ((x 1)) (letrec ((x x)) x)) #<undefined>)
;; here they are different:
(test (let ((x 1)) (letrec* ((x 0) (y x)) y)) 0)
(test (let ((x 1)) (letrec ((x 0) (y x)) y)) #<undefined>)
;(test (letrec ((x (let () (set! y 1) y)) (y (let () (set! y (+ y 1)) y))) (list x y)) '(1 2)) ; ! this depends on letrec binding order

(test (letrec ((x 1) (y x)) (list x y)) '(1 #<undefined>)) ; guile says '(1 1)
(test (letrec ((y x) (x 1)) (list x y)) '(1 #<undefined>)) ; guile says '(1 1)
(test (letrec ((x 1) (y (let () (set! x 2) x))) (list x y)) '(1 2))
(test (letrec ((history (list 9))) ((lambda (n) (begin (set! history (cons history n)) history)) 8)) '((9) . 8))
(test (((call/cc (lambda (k) k)) (lambda (x) x)) 'HEY!) 'HEY!)

(let ((sequence ()))
  ((call-with-current-continuation
    (lambda (goto)
      (letrec ((start
		(lambda ()
		  (set! sequence (cons 'start sequence))
		  (goto next)))
	       (froz
		(lambda ()
		  (set! sequence (cons 'froz sequence))
		  (goto last)))
	       (next
		(lambda ()
		  (set! sequence (cons 'next sequence))
		  (goto froz)))
	       (last
		(lambda ()
		  (set! sequence (cons 'last sequence))
		  #f)))
	start))))
  (test (reverse sequence) '(start next froz last)))

(let ()
  (define thunk 'dummy-thunk)

  (define (make-fringe-thunk tree)
    (call-with-exit
     (lambda (return-to-repl)
       (cond ((pair? tree) 
	      (make-fringe-thunk (car tree))
	      (make-fringe-thunk (cdr tree)))
	     ((null? tree) (begin (set! thunk (lambda () 'done)) 'null))
	     (else (call/cc
		    (lambda (cc)
		      (set! thunk
			    (lambda ()
			      (begin (display tree) (cc 'leaf))))
		      (return-to-repl 'thunk-set!))))))))

  (define tr '(() () (((1 (( (() 2 (3 4)) (((5))) )) ))) ))
  (test (make-fringe-thunk tr) 'null)
  (test (thunk) 'done))

;;; evaluation order matters, but in s7 it's always left -> right
(test (let ((x 1)) (+ x (let () (define x 2) x))) 3)
(test (let ((x 1)) (+ (begin (define x 2) x) x)) 4)
(test (let ((x 1)) (+ x (begin (define x 2) x))) 3) 
(test (let ((x 1)) (+ x (begin (set! x 2) x))) 3)
(test (let ((x 1)) (+ (begin (set! x 2) x) x)) 4)
(test (let ((x 1)) ((if (= x 1) + -) x (begin (set! x 2) x))) 3) 

(catch #t
  (lambda ()
    (let ()
      (define-constant _letrec_x_ 32)
      (test (letrec ((_letrec_x_ 1)) _letrec_x_) 'error))
    (let ()
      (define-constant _let_x_ 32)
      (test (let ((_let_x_ 1)) _let_x_) 'error))
    (let ()
      (define-constant _let*_x_ 32)
      (test (let* ((_let*_x_ 1)) _let*_x_) 'error)))
  (lambda args 'error))


#|
;;; here is the old letrec* macro:
(define-macro (letrec* bindings . body)                             
  (if (null? body)                                                  
      (error 'syntax-error "letrec* has no body")                 
      (if (not (list? bindings))                                    
	  (error 'syntax-error "letrec* variables are messed up") 
	  `(let (,@(map (lambda (var&init)                          
			  (list (car var&init) #<undefined>))       
			bindings))                                  
	     ,@(map (lambda (var&init)                              
		      (if (not (null? (cddr var&init)))             
			  (error 'syntax-error "letrec* variable has more than one value")) 
		      (list 'set! (car var&init) (cadr var&init)))  
		    bindings)                                      
	     ,@body))))
|#



;;; --------------------------------------------------------------------------------
;;; call/cc
;;; call-with-current-continuation
;;; --------------------------------------------------------------------------------
;;; some of these were originally from Al Petrovsky, Scott G Miller, Matthias Radestock, J H Brown, Dorai Sitaram, 
;;;   and probably others.

(let ((calls (make-vector 3 #f))
      (travels (make-vector 5 0))
      (ctr 0))
  (set! (travels 0) (+ (travels 0) 1))
  (call/cc (lambda (c0) (set! (calls 0) c0)))
  (set! (travels 1) (+ (travels 1) 1))
  (call/cc (lambda (c1) (set! (calls 1) c1)))
  (set! (travels 2) (+ (travels 2) 1))
  (call/cc (lambda (c2) (set! (calls 2) c2)))
  (set! (travels 3) (+ (travels 3) 1))
  (let ((ctr1 ctr))
    (set! ctr (+ ctr1 1))
    (if (< ctr1 3)
	((calls ctr1) ctr1)))
  (set! (travels 4) (+ (travels 4) 1))
  (test travels #(1 2 3 4 1)))

(let ((calls (make-vector 5 #f))
      (travels (make-vector 5 0))
      (ctr2 0))
  (let loop ((ctr 0))
    (if (< ctr 3)
	(begin
	  (set! (travels ctr) (+ (travels ctr) 1))
	  (call/cc (lambda (c0) (set! (calls ctr) c0)))
	  (loop (+ ctr 1)))))
  (set! (travels 3) (+ (travels 3) 1))
  (let ((ctr1 ctr2))
    (set! ctr2 (+ ctr1 1))
    (if (< ctr1 3)
	((calls ctr1) ctr1)))
  (set! (travels 4) (+ (travels 4) 1))
  (test travels #(1 2 3 4 1)))

(let ((c1 #f)
      (c2 #f)
      (c3 #f)
      (x0 0)
      (x1 0)
      (x2 0)
      (x3 0))
  (let ((x (+ 1 
	      (call/cc
	       (lambda (r1)
		 (set! c1 r1)
		 (r1 2)))
	      (call/cc
	       (lambda (r2)
		 (set! c2 r2)
		 (r2 3)))
	      (call/cc
	       (lambda (r3)
		 (set! c3 r3)
		 (r3 4)))
	      5)))
    (if (= x0 0) 
	(set! x0 x)
	(if (= x1 0)
	    (set! x1 x)
	    (if (= x2 0)
		(set! x2 x)
		(if (= x3 0)
		    (set! x3 x)))))
    (if (= x 15)
	(c1 6))
    (if (= x 19)
	(c2 7))
    (if (= x 23)
	(c3 8))
    (test (list x x0 x1 x2 x3) '(27 15 19 23 27))))

(let ((c1 #f) (c2 #f) (c3 #f) (x0 0) (x1 0) (x2 0) (x3 0) (y1 0) (z0 0) (z1 0) (z2 0) (z3 0))
  (let* ((y 101)
	 (x (+ y 
	      (call/cc
	       (lambda (r1)
		 (set! c1 r1)
		 (r1 2)))
	      (call/cc
	       (lambda (r2)
		 (set! c2 r2)
		 (r2 3)))
	      (call/cc
	       (lambda (r3)
		 (set! c3 r3)
		 (r3 4)))
	      5))
	 (z (+ x y)))
    (set! y1 y)
    (if (= x0 0) 
	(begin
	  (set! x0 x)
	  (set! z0 z))
	(if (= x1 0)
	    (begin
	      (set! x1 x)
	      (set! z1 z))
	    (if (= x2 0)
		(begin
		  (set! x2 x)
		  (set! z2 z))
		(if (= x3 0)
		    (begin
		      (set! x3 x)
		      (set! z3 z))))))
    (if (= x 115)
	(c1 6))
    (if (= x 119)
	(c2 7))
    (if (= x 123)
	(c3 8))
    (test (list x x0 x1 x2 x3 y1 z0 z1 z2 z3) '(127 115 119 123 127 101 216 220 224 228))))

(let ((c1 #f)
      (c2 #f)
      (c3 #f)
      (x0 0)
      (x1 0)
      (x2 0)
      (x3 0))
  (let ((x (+ 1 
	      (call/cc
	       (lambda (r1)
		 (set! c1 r1)
		 (r1 2)))
	      (call/cc
	       (lambda (r2)
		 (set! c2 r2)
		 (r2 3)))
	      (call/cc
	       (lambda (r3)
		 (set! c3 r3)
		 (r3 4)))
	      5)))
    (if (= x0 0) 
	(set! x0 x)
	(if (= x1 0)
	    (set! x1 x)
	    (if (= x2 0)
		(set! x2 x)
		(if (= x3 0)
		    (set! x3 x)))))
    (if (= x 15)
	(c1 6 1))
    (if (= x 20)
	(c2 7 2 3))
    (if (= x 29)
	(c3 8 3 4 5))
    (test (list x x0 x1 x2 x3) '(45 15 20 29 45))))
;; 45 = (+ 1 6 1 7 2 3 8 3 4 5 5)

(let ((x 0)
      (c1 #f)
      (results ()))
  (set! x (call/cc
	   (lambda (r1)
	     (set! c1 r1)
	     (r1 2))))
  (set! results (cons x results))
  (if (= x 2) (c1 32))
  (test results '(32 2)))

(let ((x #(0))
      (y #(0))
      (c1 #f))
  (set! ((call/cc
	   (lambda (r1)
	     (set! c1 r1)
	     (r1 x)))
	 0) 32)
  (if (= (y 0) 0) (c1 y))
  (test (and (equal? x #(32)) (equal? y #(32))) #t))

(test (call/cc (lambda (k) ((call/cc (lambda (top) (k (+ 1 (call/cc (lambda (inner) (top inner))))))) 2))) 3)

(let* ((next-leaf-generator (lambda (obj eot)
			      (letrec ((return #f)
				       (cont (lambda (x)
					       (recur obj)
					       (set! cont (lambda (x) (return eot)))
					       (cont #f)))
				       (recur (lambda (obj)
						(if (pair? obj)
						    (for-each recur obj)
						    (call-with-current-continuation
						     (lambda (c)
						       (set! cont c)
						       (return obj)))))))
				(lambda () (call-with-current-continuation
					    (lambda (ret) (set! return ret) (cont #f)))))))
       (leaf-eq? (lambda (x y)
		   (let* ((eot (list 'eot))
			  (xf (next-leaf-generator x eot))
			  (yf (next-leaf-generator y eot)))
		     (letrec ((loop (lambda (x y)
				      (cond ((not (eq? x y)) #f)
					    ((eq? eot x) #t)
					    (else (loop (xf) (yf)))))))
		       (loop (xf) (yf)))))))
  
  (test (leaf-eq? '(a (b (c))) '((a) b c)) #t)
  (test (leaf-eq? '(a (b (c))) '((a) b c d)) #f))

(test (let ((r #f)
	    (a #f)
	    (b #f)
	    (c #f)
	    (i 0))
	(let () 
	  (set! r (+ 1 (+ 2 (+ 3 (call/cc (lambda (k) (set! a k) 4))))
		     (+ 5 (+ 6 (call/cc (lambda (k) (set! b k) 7))))))
	  (if (not c) 
	      (set! c a))
	  (set! i (+ i 1))
	  (case i
	    ((1) (a 5))
	    ((2) (b 8))
	    ((3) (a 6))
	    ((4) (c 4)))
	  r))
      28)

(test (let ((r #f)
	    (a #f)
	    (b #f)
	    (c #f)
	    (i 0))
	(let () 
	  (set! r (+ 1 (+ 2 (+ 3 (call/cc (lambda (k) (set! a k) 4))))
		     (+ 5 (+ 6 (call/cc (lambda (k) (set! b k) 7))))))
	  (if (not c) 
	      (set! c a))
	  (set! i (+ i 1))
	  (case i
	    ((1) (b 8))
	    ((2) (a 5))
	    ((3) (b 7))
	    ((4) (c 4)))
	  r))
      28)

(test (let ((k1 #f)
	    (k2 #f)
	    (k3 #f)
	    (state 0))
	(define (identity x) x)
	(define (fn)
	  ((identity (if (= state 0)
			 (call/cc (lambda (k) (set! k1 k) +))
			 +))
	   (identity (if (= state 0)
			 (call/cc (lambda (k) (set! k2 k) 1))
			 1))
	   (identity (if (= state 0)
			 (call/cc (lambda (k) (set! k3 k) 2))
			 2))))
	(define (check states)
	  (set! state 0)
	  (let* ((res ())
		 (r (fn)))
	    (set! res (cons r res))
	    (if (null? states)
		res
		(begin (set! state (car states))
		       (set! states (cdr states))
		       (case state
			 ((1) (k3 4))
			 ((2) (k2 2))
			 ((3) (k1 -)))))))
	(map check '((1 2 3) (1 3 2) (2 1 3) (2 3 1) (3 1 2) (3 2 1))))
      '((-1 4 5 3) (4 -1 5 3) (-1 5 4 3) (5 -1 4 3) (4 5 -1 3) (5 4 -1 3)))

(let () ; Matt Might perhaps or maybe Paul Hollingsworth?
  (define (current-continuation)
    (call/cc (lambda (cc) (cc cc))))
  (define fail-stack ())
  (define (fail)
    (if (not (pair? fail-stack))
	(error 'test-error "back-tracking stack exhausted!")
	(begin
	  (let ((back-track-point (car fail-stack)))
	    (set! fail-stack (cdr fail-stack))
	    (back-track-point back-track-point)))))
  (define (amb choices)
    (let ((cc (current-continuation)))
      (cond
       ((null? choices)      (fail))
       ((pair? choices)      (let ((choice (car choices)))
			       (set! choices (cdr choices))
			       (set! fail-stack (cons cc fail-stack))
			       choice)))))
  (define (assert condition)
    (if (not condition)
	(fail)
	#t))
  (let ((a (amb (list 1 2 3 4 5 6 7)))
	(b (amb (list 1 2 3 4 5 6 7)))
	(c (amb (list 1 2 3 4 5 6 7))))
    (assert (= (* c c) (+ (* a a) (* b b))))
    (assert (< b a))
    (test (list a b c) (list 4 3 5))))

(let () ; a shorter version
  (define (current-continuation)
    (call/cc (lambda (cc) cc)))
  (define fail-stack ())
  (define (fail)
    (if (not (pair? fail-stack))
	(error 'test-error "back-tracking stack exhausted!")
	(let ((back-track-point (car fail-stack)))
	  (set! fail-stack (cdr fail-stack))
	  (back-track-point back-track-point))))
  (define (amb choices)
    (let ((cc (current-continuation)))
      (if (null? choices)
	  (fail)
	  (let ((choice (car choices)))
	    (set! choices (cdr choices))
	    (set! fail-stack (cons cc fail-stack))
	    choice))))
  (define (assert condition)
    (or condition (fail)))
  (let ((a (amb (list 1 2 3 4 5 6 7)))
	(b (amb (list 1 2 3 4 5 6 7)))
	(c (amb (list 1 2 3 4 5 6 7))))
    (assert (= (* c c) (+ (* a a) (* b b))))
    (assert (< b a))
    (test (list a b c) (list 4 3 5))))

(let ((c1 #f))
  (let ((x ((call/cc (lambda (r1) (set! c1 r1) (r1 "hiho"))) 0)))
    (if (char=? x #\h)
	(c1 "asdf"))
    (test x #\a)))

(test (let ((x ())
	    (y 0))
	(call/cc 
	 (lambda (escape)
	   (let* ((yin ((lambda (foo) 
			  (set! x (cons y x))
			  (if (= y 10)
			      (escape x)
			      (begin
				(set! y 0)
				foo)))
			(call/cc (lambda (bar) bar))))
		  (yang ((lambda (foo) 
			   (set! y (+ y 1))
			   foo)
			 (call/cc (lambda (baz) baz)))))
	     (yin yang)))))
      '(10 9 8 7 6 5 4 3 2 1 0))

(let ()
  ;; taken from wikipedia
  (define readyList ())
 
  (define (i-run)
    (if (not (null? readyList))
	(let ((cont (car readyList)))
	  (set! readyList (cdr readyList))
	  (cont ()))))
 
  (define (fork fn arg)
    (set! readyList
	  (append readyList
		  (cons
		   (lambda (x)
		     (fn arg)
		     (i-run))
		   ()))))
 
  (define (yield)
    (call-with-current-continuation
     (lambda (thisCont)
       (set! readyList
	     (append readyList
		     (cons thisCont ())))
       (let ((cont (car readyList)))
	 (set! readyList (cdr readyList))
	 (cont ())))))

  (define data (make-vector 10 0))
  (define data-loc 0)

  (define (process arg)
    (if (< data-loc 10)
	(begin
	  (set! (data data-loc) arg)
	  (set! data-loc (+ data-loc 1))
	  (yield)
	  (process (+ arg 1)))
	(i-run)))

  (fork process 0)
  (fork process 10)
  (fork process 20)
  (i-run)

  (test data #(0 10 20 1 11 21 2 12 22 3)))

(test (let ((c #f))
	(let ((r ()))
	  (let ((w (let ((v 1))
		     (set! v (+ (call-with-current-continuation
				 (lambda (c0) (set! c c0) v))
				v))
		     (set! r (cons v r))
		     v)))
	    (if (<= w 1024) (c w) r))))
      '(2048 1024 512 256 128 64 32 16 8 4 2))

(test (let ((c #f))
	(let ((r ()))
	  (let ((w (let ((v 1))
		     (set! v (+ (values v (call-with-current-continuation
				 (lambda (c0) (set! c c0) v)))
				v))
		     (set! r (cons v r))
		     v)))
	    (if (<= w 1024) (c w) r))))
      '(2047 1023 511 255 127 63 31 15 7 3))

;;; the first v is 1, the 3rd reflects the previous call/cc which reflects the
;;;    env+slot that had the subsequent set! -- weird.

(test (let ((cc #f)
	    (r ()))
	(let ((s (list 1 2 3 4 (call/cc (lambda (c) (set! cc c) 5)) 6 7 8)))
	  (if (null? r)
	      (begin (set! r s) (cc -1))
	      (list r s))))
      '((1 2 3 4 5 6 7 8) (1 2 3 4 -1 6 7 8)))

(test (let ((count 0))
        (let ((first-time? #t)
              (k (call/cc values)))
          (if first-time?
              (begin
                (set! first-time? #f)
                (set! count (+ count 1))
                (k values))
              (void))) ; what is this?
        count)
      2)

(let ((c #f)
      (vals ()))
  (let ((val (+ 1 2 (call/cc (lambda (r) (set! c r) (r 3))))))
    (set! vals (cons val vals))
    (if (< val 20) (c (+ val 1)))
    (test vals '(22 18 14 10 6))))
(let ((c #f)
      (vals ()))
  (let ((val (+ 1 2 (call/cc (lambda (r) (set! c r) (r 3))))))
    (set! vals (cons val vals))
    (if (< val 20) (apply c vals))
    (test vals '(36 18 9 6))))
(let ((c #f)
      (vals ()))
  (let ((val (+ 1 2 (call/cc (lambda (r) (set! c r) (r 3))))))
    (set! vals (cons val vals))
    (if (< val 20) (c (apply values vals)))
    (test vals '(36 18 9 6))))

(test (procedure? (call/cc call/cc)) #t)
(test (call/cc (lambda (c) (0 (c 1)))) 1)
(test (call/cc (lambda (k) (k "foo"))) "foo")
(test (call/cc (lambda (k) "foo")) "foo")
(test (call/cc (lambda (k) (k "foo") "oops")) "foo")
(test (call/cc (lambda (return) (catch #t (lambda () (error 'hi "")) (lambda args (return "oops"))))) "oops")
(test (call/cc (lambda (return) (catch #t (lambda () (return 1)) (lambda args (return "oops"))))) 1)
(test (catch #t (lambda () (call/cc (lambda (return) (return "oops")))) (lambda arg 1)) "oops")
(test (call/cc (if (< 2 1) (lambda (return) (return 1)) (lambda (return) (return 2) 3))) 2)
(test (call/cc (let ((a 1)) (lambda (return) (set! a (+ a 1)) (return a)))) 2)
(test (call/cc (lambda (return) (let ((hi return)) (hi 2) 3))) 2)
(test (let () (define (hi) (call/cc func)) (define (func a) (a 1)) (hi)) 1)
(test (((call/cc (call/cc call/cc)) call/cc) (lambda (a) 1)) 1)
(test (+ 1 (eval-string "(+ 2 (call-with-exit (lambda (return) (return 3))) 4)") 5) 15)
(test (+ 1 (eval '(+ 2 (call-with-exit (lambda (return) (return 3))) 4)) 5) 15)
(test (call-with-exit) 'error)
(test (call-with-exit s7-version s7-version) 'error)
(test (call/cc) 'error)
(test (call/cc s7-version s7-version) 'error)
(test (call/cc (lambda () 1)) 'error)
(test (call/cc (lambda (a b) (a 1))) 'error)
(test (+ 1 (call/cc (lambda (k) (k #\a)))) 'error)
(test (+ 1 (call-with-exit (lambda (k) (k #\a)))) 'error)
(test ((call/cc (lambda (return) (call/cc (lambda (cont) (return cont))) list)) 1) '(1)) ; from Guile mailing list -- this strikes me as very strange

(test (call/cc begin) 'error)
(test (call/cc quote) 'error)

(let ((p1 (dilambda (lambda (k) (k 3)) (lambda (k a) (k a)))))
  (test (call/cc p1) 3)
  (test (call-with-exit p1) 3))

;;; guile/s7 accept: (call/cc (lambda (a . b) (a 1))) -> 1
;;; same:            (call/cc (lambda arg ((car arg) 1))) -> 1

(test (let ((listindex (lambda (e l)
			 (call/cc (lambda (not_found)
				    (letrec ((loop 
					      (lambda (l)
						(cond
						 ((null? l) (not_found #f))
						 ((equal? e (car l)) 0)
						 (else (+ 1 (loop (cdr l))))))))
				      (loop l)))))))
	(listindex 1 '(0 3 2 4 8)))
      #f)

(test (let ((product (lambda (li)
		       (call/cc (lambda (return)
				  (let loop ((l li))
				    (cond
				     ((null? l) 1)
				     ((= (car l) 0) (return 0))
				     (else (* (car l) (loop (cdr l)))))))))))
	(product '(1 2 3 0 4 5 6)))
      0)

(test (let ((lst ()))
	((call/cc
	  (lambda (goto)
	    (letrec ((start (lambda () (set! lst (cons "start" lst)) (goto next)))
		     (next  (lambda () (set! lst (cons "next" lst))  (goto last)))
		     (last  (lambda () (set! lst (cons "last" lst)) (reverse lst))))
	      start)))))
      '("start" "next" "last"))

(test (let ((cont #f)) ; Al Petrovsky
	(letrec ((x (call-with-current-continuation (lambda (c) (set! cont c) 0)))
		 (y (call-with-current-continuation (lambda (c) (set! cont c) 0))))
	  (if cont
	      (let ((c cont))
		(set! cont #f)
		(set! x 1)
		(set! y 1)
		(c 0))
	      (+ x y))))
      0)

(test (letrec ((x (call-with-current-continuation
		   (lambda (c)
		     (list #t c)))))
	(if (car x)
	    ((cadr x) (list #f (lambda () x)))
	    (eq? x ((cadr x)))))
      #t)

(test (call/cc (lambda (c) (0 (c 1)))) 1)

(test (let ((member (lambda (x ls)
		      (call/cc
		       (lambda (return)
			 (do ((ls ls (cdr ls)))
			     ((null? ls) #f)
			   (if (equal? x (car ls))
			       (return ls))))))))
	(list (member 'd '(a b c))
	      (member 'b '(a b c))))
      '(#f (b c)))


;;; call-with-exit
(test (+ 2 (call/cc (lambda (k) (* 5 (k 4))))) 6)
(test (+ 2 (call/cc (lambda (k) (* 5 (k 4 5 6))))) 17)
(test (+ 2 (call/cc (lambda (k) (* 5 (k (values 4 5 6)))))) 17)
(test (+ 2 (call/cc (lambda (k) (* 5 (k 1 (values 4 5 6)))))) 18)
(test (+ 2 (call/cc (lambda (k) (* 5 (k 1 (values 4 5 6) 1))))) 19)
(test (+ 2 (call-with-exit (lambda (k) (* 5 (k 4))))) 6)
(test (+ 2 (call-with-exit (lambda (k) (* 5 (k 4 5 6))))) 17)
(test (+ 2 (call-with-exit (lambda (k) (* 5 (k (values 4 5 6)))))) 17)
(test (+ 2 (call-with-exit (lambda (k) (* 5 (k 1 (values 4 5 6)))))) 18)
(test (+ 2 (call-with-exit (lambda (k) (* 5 (k 1 (values 4 5 6) 1))))) 19)
(test (+ 2 (call-with-exit (lambda* ((hi 1)) (hi 1)))) 3)
(test (call-with-exit (lambda (hi) (((hi 1)) #t))) 1) ; !! (jumps out of list evaluation)
(test (call-with-exit (lambda* args ((car args) 1))) 1)
(test ((call-with-exit (lambda (return) (return + 1 2 3)))) 6)
(test ((call-with-exit (lambda (return) (apply return (list + 1 2 3))))) 6)
(test ((call/cc (lambda (return) (return + 1 2 3)))) 6)
(test (+ 2 (call-with-exit (lambda (return) (let ((rtn (copy return))) (* 5 (rtn 4)))))) 6)
(test (let () (define (f1) (+ (call-with-exit (lambda (return) (define (f2) (+ 1 (return 2))) (f2))) 3)) (f1)) 5)

(test (+ 2 (values 3 (call-with-exit (lambda (k1) (k1 4))) 5)) 14)
(test (+ 2 (call-with-exit (lambda (k1) (values 3 (k1 4) 5))) 8) 14)
(test (+ 2 (call-with-exit (lambda (k1) (values 3 (k1 4 -3) 5))) 8) 11)

(test (call-with-exit (let () (lambda (k1) (k1 2)))) 2)
(test (+ 2 (call/cc (let () (call/cc (lambda (k1) (k1 (lambda (k2) (k2 3)))))))) 5)
(test (+ 2 (call/cc (call/cc (lambda (k1) (k1 (lambda (k2) (k2 3))))))) 5)
(test (call-with-exit (lambda arg ((car arg) 32))) 32)
(test (call-with-exit (lambda arg ((car arg) 32)) "oops!") 'error)
(test (call-with-exit (lambda (a b) a)) 'error)
(test (call-with-exit (lambda (return) (apply return '(3)))) 3)
(test (call-with-exit (lambda (return) (apply return (list  (cons 1 2))) (format #t "; call-with-exit: we shouldn't be here!"))) (cons 1 2))
(test (call/cc (lambda (return) (apply return (list  (cons 1 2))) (format #t "; call/cc: we shouldn't be here!"))) (cons 1 2))
(test (procedure? (call-with-exit (lambda (return) (call-with-exit return)))) #t)
(test (call-with-exit (lambda (return) #f) 1) 'error)
(test (+ (call-with-exit ((lambda () (lambda (k) (k 1 2 3)))))) 6)

(test (call-with-exit (lambda (a . b) (a 1))) 1)
(test (call/cc (lambda (a . b) (a 1))) 1) 
(test (call-with-exit (lambda* (a b) (a 1))) 1)

(test (call-with-exit (lambda (c) (0 (c 1)))) 1)
(test (call-with-exit (lambda (k) (k "foo"))) "foo")
(test (call-with-exit (lambda (k) "foo")) "foo")
(test (call-with-exit (lambda (k) (k "foo") "oops")) "foo")
(test (call-with-exit (lambda (x) (set! x abs) (x -1))) 1)
(test (call/cc (lambda (x) (set! x abs) (x -1))) 1)
(test (let ((memb (lambda (x ls)
		    (call-with-exit
		     (lambda (break)
		       (do ((ls ls (cdr ls)))
			   ((null? ls) #f)
			 (if (equal? x (car ls))
			     (break ls))))))))
	(list (memb 'd '(a b c))
	      (memb 'b '(a b c))))
      '(#f (b c)))

(let* ((sum 0)
       (val1 (call-with-exit 
	      (lambda (return)
		(set! sum (+ sum 1))
		(let ((val2 (call-with-exit 
			     (lambda (return)
			       (set! sum (+ sum 1))
			       (if #t (return sum))
			       123))))
		  (set! sum (+ sum val2))
		  (return sum)
		  32)))))
  (test (list val1 sum) '(4 4)))

(let ()
  (define (fx ret)
    (do ((n 0 (+ n 1)))
	((= n 6) n)
      (if (> n 3)
	  (ret n))))
  (test (call-with-exit fx) 4))

(let ()
  (define c #f)
  (define (yow f)
    (call-with-exit
     (lambda (return)
       (set! c return)
       (f))))
  (test (yow (lambda () (c 32))) 32))

(let ((x 1))
  (define y (call-with-exit (lambda (return) (set! x (return 32)))))
  (test (and (= x 1) (= y 32)) #t)
  (set! y (call-with-exit (lambda (return) ((lambda (a b c) (set! x a)) 1 2 (return 33)))))
  (test (and (= x 1) (= y 33)) #t)
  (set! y (call-with-exit (lambda (return) ((lambda (a b) (return a) (set! x b)) 2 3))))
  (test (and (= x 1) (= y 2)) #t))

(test (let ((x 0))
	(define (quit z1) (z1 1) (set! x 1))
	(call-with-exit
	 (lambda (z)
	   (set! x 2)
	   (quit z)
	   (set! x 3)))
	x)
      2)

(test (let ((x (call/cc (lambda (k) k))))
	(x (lambda (y) "hi")))
      "hi")

(test (((call/cc (lambda (k) k)) (lambda (x) x)) "hi") "hi")

(test (let ((return #f)
	    (lst ()))
	(let ((val (+ 1 (call/cc 
			 (lambda (cont) 
			   (set! return cont) 
			   1)))))
	  (set! lst (cons val lst)))
	(if (= (length lst) 1)
	    (return 10)
	    (if (= (length lst) 2)
		(return 20)))
	(reverse lst))
      '(2 11 21))

(test (let ((r1 #f)
	    (r2 #f)
	    (lst ()))
	(define (somefunc x y)
	  (+ (* 2 (expt x 2)) (* 3 y) 1))
	(let ((val (somefunc (call/cc
			      (lambda (c1)
				(set! r1 c1)
				(c1 1)))
			     (call/cc
			      (lambda (c2)
				(set! r2 c2)
				(c2 1))))))
	  (set! lst (cons val lst)))
	(if (= (length lst) 1)
	    (r1 2)
	    (if (= (length lst) 2)
		(r2 3)))
	(reverse lst))
      '(6 12 18))

(let ((tree->generator
       (lambda (tree)
	 (let ((caller '*))
	   (letrec
	       ((generate-leaves
		 (lambda ()
		   (let loop ((tree tree))
		     (cond ((null? tree) 'skip)
			   ((pair? tree)
			    (loop (car tree))
			    (loop (cdr tree)))
			   (else
			    (call/cc
			     (lambda (rest-of-tree)
			       (set! generate-leaves
				     (lambda ()
				       (rest-of-tree 'resume)))
			       (caller tree))))))
		   (caller ()))))
	     (lambda ()
	       (call/cc
		(lambda (k)
		  (set! caller k)
		  (generate-leaves)))))))))
  (let ((same-fringe? 
	 (lambda (tree1 tree2)
	   (let ((gen1 (tree->generator tree1))
		 (gen2 (tree->generator tree2)))
	     (let loop ()
	       (let ((leaf1 (gen1))
		     (leaf2 (gen2)))
		 (if (eqv? leaf1 leaf2)
		     (if (null? leaf1) #t (loop))
		     #f)))))))
    
    (test (same-fringe? '(1 (2 3)) '((1 2) 3)) #t)
    (test (same-fringe? '(1 2 3) '(1 (3 2))) #f)))

(let ()
  (define (a-func)
    (call-with-exit
     (lambda (go)
       (lambda ()
	 (go + 32 1)))))

  (define (b-func)
    (call/cc
     (lambda (go)
       (lambda ()
	 (go + 32 1)))))

  (test ((a-func)) 'error) ;invalid-escape-function
  (test ((b-func)) 33))

#|
(test ((call-with-exit
	(lambda (go)
	  (lambda ()
	    (eval-string "(go + 32 1)")))))
      'error)
|#

(test ((call/cc (lambda (go) (lambda () (eval-string "(go + 32 1)"))))) 33)

(test ((call/cc
	(lambda (go-1)
	  (call/cc
	   (lambda (go)
	     (lambda ()
	       (go (go-1 + 32 1))))))))
      33)

(for-each
 (lambda (arg)
   (test (let ((ctr 0))
	   (let ((val (call/cc (lambda (exit)
				 (do ((i 0 (+ i 1)))
				     ((= i 10) 'gad)
				   (set! ctr (+ ctr 1))
				   (if (= i 1)
				       (exit arg)))))))
	     (and (equal? val arg)
		  (= ctr 2))))
	 #t))
 (list "hi" -1 #\a 1 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #t (list 1 2 3) '(1 . 2)))

(for-each
 (lambda (arg)
   (test (let ((ctr 0))
	   (let ((val (call/cc (lambda (exit)
				 (do ((i 0 (+ i 1)))
				     ((= i 10) arg)
				   (set! ctr (+ ctr 1))
				   (if (= i 11)
				       (exit 'gad)))))))
	     (and (equal? val arg)
		  (= ctr 10))))
	 #t))
 (list "hi" -1 #\a 1 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #t (list 1 2 3) '(1 . 2)))

(test (let ((c #f)
	    (r (string-copy "testing-hiho")))
	(let ((v (call/cc (lambda (c0) (set! c c0) (list #\a 0)))))
	  (let ((chr (car v))
		(index (cadr v)))
	    (string-set! r index chr)
	    (set! index (+ index 1))
	    (if (<= index 8) 
		(c (list (integer->char (+ 1 (char->integer chr))) index)) 
		r))))
      "abcdefghiiho")

(test (let ((x 0)
	    (again #f))
	(call/cc (lambda (r) (set! again r)))
	(set! x (+ x 1))
	(if (< x 3) (again))
	x)
      3)

(test (let* ((x 0)
	     (again #f)
	     (func (lambda (r) (set! again r))))
	(call/cc func)
	(set! x (+ x 1))
	(if (< x 3) (again))
	x)
      3)

(test (let* ((x 0)
	     (again #f))
	(call/cc (let ()
		   (lambda (r) (set! again r))))
	(set! x (+ x 1))
	(if (< x 3) (again))
	x)
      3)

(test (let ((x 0)
	    (xx 0))
	(let ((cont #f))
	  (call/cc (lambda (c) (set! xx x) (set! cont c)))
	  (set! x (+ x 1))
	  (if (< x 3)	(cont))
	  xx))
      0)

(test (call/cc procedure?) #t)
(test (procedure? (call/cc (lambda (a) a))) #t)

(for-each
 (lambda (arg)
   (test (call/cc (lambda (a) arg)) arg))
 (list "hi" -1 #\a 1 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #t (list 1 2 3) '(1 . 2)))

(let ((a (call/cc (lambda (a) a))))
  (test (eq? a a) #t)
  (test (eqv? a a) #t)
  (test (equal? a a) #t)
  (for-each
   (lambda (ques)
     (if (ques a)
	 (format #t ";(~A ~A) returned #t?~%" ques a)))
   question-ops))

(test (let ((conts (make-vector 4 #f)))
	(let ((lst ()))
	  (set! lst (cons (+ (call/cc (lambda (a) (vector-set! conts 0 a) 0))
			     (call/cc (lambda (a) (vector-set! conts 1 a) 0))
			     (call/cc (lambda (a) (vector-set! conts 2 a) 0))
			     (call/cc (lambda (a) (vector-set! conts 3 a) 0)))
			  lst))
	  (let ((len (length lst)))
	    (if (< len 4)
		((vector-ref conts (- len 1)) (+ len 1))
		(reverse lst)))))
      '(0 2 5 9))

(test (let ((conts ()))
	(let ((lst ()))
	  (set! lst (cons (+ (call/cc (lambda (a) (if (< (length conts) 4) (set! conts (cons a conts))) 1))
			     (* (call/cc (lambda (a) (if (< (length conts) 4) (set! conts (cons a conts))) 1))
				(+ (call/cc (lambda (a) (if (< (length conts) 4) (set! conts (cons a conts))) 1))
				   (* (call/cc (lambda (a) (if (< (length conts) 4) (set! conts (cons a conts))) 1)) 2))))
			  lst))
	  (let ((len (length lst)))
	    (if (<= len 4)
		((list-ref conts (- len 1)) (+ len 1))
		(reverse lst)))))
					; (+ 1 (* 1 (+ 1 (* 1 2)))) to start
					; (+ 1 ...          2     )
					; (+ 1 ...     3    [1]   )
					; (+ 1 ...4    [1]        )
					; (+ 5   [1]              )
      '(4 6 6 13 8))

(test (let ((conts (make-vector 4 #f)))
	(let ((lst ()))
	  (set! lst (cons (+ (call/cc (lambda (a) (if (not (vector-ref conts 0)) (vector-set! conts 0 a)) 0))
			     (call/cc (lambda (a) (if (not (vector-ref conts 1)) (vector-set! conts 1 a)) 0))
			     (call/cc (lambda (a) (if (not (vector-ref conts 2)) (vector-set! conts 2 a)) 0))
			     (call/cc (lambda (a) (if (not (vector-ref conts 3)) (vector-set! conts 3 a)) 0)))
			  lst))
	  (let ((len (length lst)))
	    (if (< len 4)
		((vector-ref conts (- len 1)) (+ len 1))
		(reverse lst)))))
      '(0 2 3 4))

(test (let ((conts ()))
	(let ((lst ()))
	  (set! lst (cons (+ (if (call/cc (lambda (a) (if (< (length conts) 4) (set! conts (cons a conts))) #f)) 1 0)
			     (* (if (call/cc (lambda (a) (if (< (length conts) 4) (set! conts (cons a conts))) #f)) 2 1)
				(+ (if (call/cc (lambda (a) (if (< (length conts) 4) (set! conts (cons a conts))) #f)) 1 0)
				   (* (if (call/cc (lambda (a) (if (< (length conts) 4) (set! conts (cons a conts))) #f)) 2 1) 2))))
			  lst))
	  (let ((len (length lst)))
	    (if (<= len 4)
		((list-ref conts (- len 1)) #t)
		(reverse lst)))))
					; (+ 0 (* 1 (+ 0 (* 1 2)))) to start
					; (+ 0 ...          2     )
					; (+ 0 ...     1   [1]    )
					; (+ 0 ...2   [0]         )
					; (+ 1   [1]              )
      '(2 4 3 4 3))

(test (let ((call/cc 2)) (+ call/cc 1)) 3)
(test (+ 1 (call/cc (lambda (r) (r 2 3 4))) 5) 15)
(test (string-ref (call/cc (lambda (s) (s "hiho" 1)))) #\i)

(let ((r5rs-ratify (lambda (ux err)
		     (if (= ux 0.0) 
			 0
			 (let ((tt 1) 
			       (a1 0) 
			       (b2 0) 
			       (a2 1) 
			       (b1 1) 
			       (a 0)  
			       (b 0)
			       (ctr 0)
			       (x (/ 1 ux)))
			   (call-with-current-continuation
			    (lambda (return)
			      (do ()
				  (#f)
				(set! a (+ (* a1 tt) a2)) 
				(set! b (+ (* tt b1) b2))
					;(format #t "~A ~A~%" a (- b a))
				(if (or (<= (abs (- ux (/ a b))) err)
					(> ctr 1000))
				    (return (/ a b)))
				(set! ctr (+ 1 ctr))
				(if (= x tt) (return))
				(set! x (/ 1 (- x tt))) 
				(set! tt (floor x))
				(set! a2 a1) 
				(set! b2 b1) 
				(set! a1 a) 
				(set! b1 b)))))))))
  
  (test (r5rs-ratify (/ (log 2.0) (log 3.0)) 1/10000000) 665/1054)
  (if (positive? 2147483648)
      (test (r5rs-ratify (/ (log 2.0) (log 3.0)) 1/100000000000) 190537/301994)))

#|
(let ((max-diff 0.0)
      (max-case 0.0)
      (err 0.01)
      (epsilon 1e-16))
  (do ((i 1 (+ i 1))) 
      ((= i 100)) 
    (let ((x (/ i 100.)))
      (let ((vals (cr x err))) 
	(if (not (= (car vals) (cadr vals))) 
	    (let ((r1 (car vals))
		  (r2 (cadr vals)))
	      (let ((diff (abs (- r1 r2))))
		(if (> diff max-diff)
		    (begin
		      (set! max-diff diff)
		      (set! max-case x))))
	      (if (> (abs (- r1 x)) (+ err epsilon))
		(format #t "(rationalize ~A ~A) is off: ~A -> ~A~%" x err r1 (abs (- r1 x))))
	      (if (> (abs (- r2 x)) (+ err epsilon))
		(format #t "(ratify ~A ~A) is off: ~A -> ~A~%" x err r2 (abs (- r2 x))))
	      (if (< (denominator r2) (denominator r1))
		  (format #t "(ratify ~A ~A) is simpler? ~A ~A~%" x err r1 r2)))))))
  (list max-case max-diff (cr max-case err)))
|#

(for-each
 (lambda (arg)
   (test (let ((ctr 0)) 
	   (let ((val (call/cc 
		       (lambda (exit) 
			 (for-each (lambda (a) 
				     (if (equal? a arg) (exit arg))
				     (set! ctr (+ ctr 1))) 
				   (list 0 1 2 3 arg 5)))))) 
	     (list ctr val)))
	 (list 4 arg)))
 (list "hi" -1 #\a 11 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #f #t '(1 . 2)))

(test (+ 2 (call/cc (lambda (rtn) (+ 1 (let () (begin (define x (+ 1 (rtn 3)))) x))))) 5)


;;; others from stackoverflow.com Paul Hollingsworth etc:

(test (procedure? (call/cc (lambda (k) k))) #t)
(test (call/cc (lambda (k) (+ 56 (k 3)))) 3)
(test (apply
       (lambda (k i) 
	 (if (> i 5) 
	     i 
	     (k (list k (* 2 i)))))
       (call/cc (lambda (k) (list k 1))))
      8)
(test (apply
       (lambda (k i n) (if (= i 0) n (k (list k (- i 1) (* i n)))))
       (call/cc (lambda (k) (list k 6 1))))
      720)
(test (let* ((ka (call/cc (lambda (k) `(,k 1)))) (k (car ka)) (a (cadr ka)))
	(if (< a 5) (k `(,k ,(* 2 a))) a))
      8)

(test (apply (lambda (k i n) (if (eq? i 0) n (k (list k (- i 1) (* i n))))) (call/cc (lambda (k) (list k 6 1)))) 720)
(test ((call/cc (lambda (k) k)) (lambda (x) 5)) 5)

(let ()
  (define (generate-one-element-at-a-time a-list)
    (define (generator)
      (call/cc control-state)) 
    (define (control-state return)
      (for-each 
       (lambda (an-element-from-a-list)
	 (set! return
	       (call/cc
		(lambda (resume-here)
		  (set! control-state resume-here)
		  (return an-element-from-a-list)))))
       a-list)
      (return 'you-fell-off-the-end-of-the-list))
    generator)
  (let ((gen (generate-one-element-at-a-time (list 3 2 1))))
    (test (gen) 3)
    (test (gen) 2)
    (test (gen) 1)
    (test (gen) 'you-fell-off-the-end-of-the-list)))

;;; from Ferguson and Duego "call with current continuation patterns"
(test (let ()
	(define count-to-n
	  (lambda (n)
	    (let ((receiver 
		   (lambda (exit-procedure)
		     (let ((count 0))
		       (letrec ((infinite-loop
				 (lambda ()
				   (if (= count n)
				       (exit-procedure count)
				       (begin
					 (set! count (+ count 1))
					 (infinite-loop))))))
			 (infinite-loop))))))
	      (call/cc receiver))))
	(count-to-n 10))
      10)

(test (let ()
	(define product-list
	  (lambda (nums)
	    (let ((receiver
		   (lambda (exit-on-zero)
		     (letrec ((product
			       (lambda (nums)
				 (cond ((null? nums) 1)
				       ((zero? (car nums)) (exit-on-zero 0))
				       (else (* (car nums)
						(product (cdr nums))))))))
		       (product nums)))))
	      (call/cc receiver))))
	(product-list '(1 2 3 0 4 5)))
      0)

(begin
  (define fact
    ((lambda (f)
       ((lambda (u) (u (lambda (x)
			 (lambda (n) ((f (u x)) n)))))
	(call/cc (call/cc (call/cc 
			   (call/cc (call/cc (lambda (x) x))))))))
     (lambda (f) (lambda (n)
		   (if (<= n 0) 1 (* n (f (- n 1))))))))
  (test (map fact '(5 6 7)) '(120 720 5040)))

;; http://okmij.org/ftp/Scheme/callcc-calc-page.html

(test (let ()
	(define product-list
	  (lambda (nums)
	    (let ((receiver
		   (lambda (exit-on-zero)
		     (letrec ((product
			       (lambda (nums) 
				 (cond ((null? nums) 1)
				       ((number? (car nums))
					(if (zero? (car nums))
					    (exit-on-zero 0)
					    (* (car nums)
					       (product (cdr nums)))))
				       (else (* (product (car nums))
						(product (cdr nums))))))))
		       (product nums)))))
	      (call/cc receiver))))
	(product-list '(1 2 (3 4) ((5)))))
      120)

(test (call/cc (lambda () 0)) 'error)
(test (call/cc (lambda (a) 0) 123) 'error)
(test (call/cc (lambda (3) 9)) 'error)
(test (call/cc (lambda arg 0)) 0)
(test (call-with-exit (lambda arg 0)) 0)
(test (call/cc) 'error)
(test (call/cc abs) 'error)
(for-each
 (lambda (arg)
   (test (call-with-exit arg) 'error)
   (test (call-with-current-continuation arg) 'error)
   (test (call/cc arg) 'error))
 (list "hi" -1 () #(1 2) _ht_ _undef_ _null_ _c_obj_ #\a 1 'a-symbol 3.14 3/4 1.0+1.0i #t (list 1 2 3) '(1 . 2)))

(test (call/cc . 1) 'error)
(test (call/cc abs) 'error)
(test (+ 1 (call/cc (lambda (r1) (call/cc (lambda (r2) (r1 2 3))))) 4) 10)
(test (+ 1 (call/cc (lambda (r1) (+ 5 (call/cc (lambda (r2) (r2 2 3)))))) 4) 15)

;;; from Andy Wingo's Guile blog
(let ()
  (define (test1 get)
    (let ((v (make-vector 2 #f)))
      (vector-set! v 0 (get 0))
      (vector-set! v 1 (get 1))
      v))
  
  (define (test2 get)
    (let* ((a (get 0))
	   (b (get 1)))
      (vector a b)))
  
  (define (discriminate f)
    (let ((get-zero-cont #t)
	  (first-result #f))
      (define (get n)
	(if (zero? n)
	    (call/cc (lambda (k)
		       (set! get-zero-cont k))))
	n)
      (let ((result (f get)))
	(cond
	 (first-result
	  (eq? result first-result))
	 (else
	  (set! first-result result)
	  (get-zero-cont))))))
  
  (test (discriminate test1) #t)
  (test (discriminate test2) #f)
  
  (define (discriminate2 f)
    (let ((get-zero-cont #f)
	  (escape #f))
      (define (get n)
	(case n
	  ((0) (call/cc (lambda (k)
			  (set! get-zero-cont k)
			  0)))
	  ((1) (if escape
		   (escape)
		   1))))
      (let ((result (f get)))
	(call/cc
	 (lambda (k)
	   (set! escape k)
	   (get-zero-cont 42)))
	result)))
  
  (test (discriminate2 test1) #(42 1))
  (test (discriminate2 test2) #(0 1)))
  
(let ()
  (define (gotof x)
    (x (cond ((continuation? x) 1)
	     ((procedure? x) 2)
	     ((macro? x) 3)
	     ((sequence? x) 0)
	     (else (throw 'oops 4)))))
  
  (test (call/cc gotof) 1)
  (test (call-with-exit gotof) 2)
  (test (gotof abs) 2)
  (test (gotof (define-macro (m1 a) `(+ ,a ))) 3)
  (test (catch 'oops (lambda () (gotof 21)) (lambda (type info) (car info))) 4)
  (test (gotof #(5 9 10 11 12)) 5))

#|
;;; from bug-guile
(define k #f)
(define result #f)
(define results ())
(set! result (map (lambda (x)
                    (if x x (call/cc (lambda (c)
                                       (set! k c)
                                       1))))
                  '(#t #f)))
(set! results (cons result results))
(write results)
(newline)
(if (< (cadr result) 5)
    (k (+ 1 (cadr result))))
(newline)

the claim is that this should return 

((#t 1))
((#t 2) (#t 1))
((#t 3) (#t 2) (#t 1))
((#t 4) (#t 3) (#t 2) (#t 1))
((#t 5) (#t 4) (#t 3) (#t 2) (#t 1))

but I think that depends on how we interpret the sequence of top-level statements.
The test should be written:

(let* ((k #f)
       (results ()))
  (let ((result (map (lambda (x)
		       (if x x (call/cc (lambda (c)
					  (set! k c)
					  1))))
		     '(#t #f))))
    (set! results (cons result results))
    (write results)
    (newline)
    (if (< (cadr result) 5)
	(k (+ 1 (cadr result))))
    (newline)))

and then s7 is not following r6rs because it stops at 

((#t 1))
((1 . #1=(#t 2)) #1#)

saying cadr is not a number. I don't think this example is correct in any case --
who says the continuation has to restart the map from the top?
|#

(let ((cont #f))
  (let ((x (* (call/cc
	       (lambda (return)
		 (set! cont return)
		 (return 3 4))))))
    (if (= x 12)
	(cont 5 6 7))
    (test x 210)))

;; Guile handles this very differently

(test (let ((cont #f)) (call-with-exit (lambda (return) (set! cont return))) (cont 1)) 'error)
(test (let ((cont #f)) (call-with-exit (lambda (return) (set! cont return))) (apply cont)) 'error)
(test (let ((cont #f)) (call-with-exit (lambda (return) (set! cont return) (cont 1))) (apply cont)) 'error)
(test (let ((cont #f)) (call-with-exit (lambda (return) (set! cont return) (cont 1))) (cont 1)) 'error)
(test (procedure? (call-with-exit append)) #t)
(test (procedure? (call-with-exit values)) #t)
(test (procedure? (car (call-with-exit list))) #t)
(test (call-with-exit (call-with-exit append)) 'error)
(test (continuation? (call/cc (call/cc append))) #t)
(test (procedure? (call-with-exit call-with-exit)) #t)
(test (vector? (call-with-exit vector)) #t)
(test (call-with-exit ((lambda args procedure?))) #t)
(test (call-with-exit (let ((x 3)) (define (return y) (y x)) return)) 3)
(test (call-with-exit (lambda (return) (with-input-from-string "hi" return))) ()) ; because thunk? -- does it close the port?
(test (call-with-exit (lambda (return) (call-with-input-string "hi" return))) 'error)
(test (call-with-exit (lambda (return) (set! (setter return) abs))) 'error)
(test (call-with-exit (lambda (return) (dynamic-wind return (lambda () 1) (lambda () (error 'test-error "oops"))))) ())
(test (call-with-exit (lambda (return) (map return '(1 2 3)))) 1)
(test (call-with-exit (lambda (return) (dynamic-wind (lambda () 2) (lambda () 1) return))) ())                ; ?? is this a bug?
(test (call-with-exit (lambda (return) (dynamic-wind (lambda () 2) (lambda () 1) (lambda () (return 3))))) 3) ; I guess not 

(test (let ((c1 #f)) (call-with-exit (lambda (c2) (call-with-exit (lambda (c3) (set! c1 c3) (c2))))) (c1)) 'error)
(test (let ((c1 #f)) (call/cc (lambda (c2) (call-with-exit (lambda (c3) (set! c1 c3) (c2))))) (c1)) 'error)
(test (let ((cont #f)) (catch #t (lambda () (call-with-exit (lambda (return) (set! cont return) (error 'testing " a test")))) (lambda args 'error)) (apply cont)) 'error)
(test (let ((cont #f)) (catch #t (lambda () (call-with-exit (lambda (return) (set! cont return) (error 'testing " a test")))) (lambda args 'error)) (cont 1)) 'error)
(test (let ((e (call-with-exit (lambda (go) (lambda () (go 1)))))) (e)) 'error)

(test (let ((cc #f)
	    (doit #t)
	    (ctr 0))
	(let ((ok (call-with-exit
		   (lambda (c3)
		     (call/cc (lambda (ret) (set! cc ret)))
		     (c3 (let ((res doit)) (set! ctr (+ ctr 1)) (set! doit #f) res))))))
	  (if ok (cc)))
	ctr)
      2)

(test (let ((val (call-with-exit (lambda (ret) (let ((ret1 ret)) (ret1 2) 3))))) val) 2)
(test (call-with-exit (lambda (return) (sort! '(3 2 1) return))) 'error) ; "sort! argument 2, #<goto>, is a goto ..."

;;; this one from Rick
(test (eval '(call/cc (lambda (go) (go 9) 0))) 9)
(test (eval-string "(call/cc (lambda (go) (go 9) 0))") 9)
(test (call-with-exit (lambda (return) (call/cc (lambda (go) (go 9) 0)) (return 1) 2)) 1)

(num-test (/ 1 (call/cc (lambda (go) (go 9) 0))) 1/9)

(test (call/cc (lambda (g) (call/cc (lambda (f) (f 1)) (g 2)))) 2) ; !! guile agrees! (evaluating the extraneous arg jumps)
(test (call/cc (lambda (g) (abs -1 (g 2)))) 2)                     ; perhaps this should be an error
(test (call/cc (lambda (g) (if #t #f #f (g 2)))) 'error)

(test ((call-with-exit (lambda (go) (go go))) eval) 'error)
(test ((call/cc (lambda (go) (go go))) eval) eval)
(test (call-with-exit quasiquote) 'error)

(test (call-with-exit (lambda (go) (if (go 1) (go 2) (go 3)))) 1)
(test (call-with-exit (lambda (go) (set! (go 1) 2))) 'error) 
(test (call-with-exit (lambda (go) (let ((x 1) (y (go x))) #f))) 'error)
(test (call-with-exit (lambda (go) (let* ((x 1) (y (go x))) #f))) 1)
(test (call-with-exit (lambda (go) (letrec ((x 1) (y (go x))) #f))) #<undefined>)
(test (call-with-exit (lambda (go) (letrec* ((x 1) (y (go x))) #f))) 1)
(test (call-with-exit (lambda (go) (case (go 1) ((go 2) 3) (else 4)))) 1)
(test (call-with-exit (lambda (go) (case go ((go 2) 3) (else 4)))) 4)
(test (call-with-exit (lambda (go) (case 2 ((go 2) 3) (else 4)))) 3)
(test (call-with-exit (lambda (go) (eq? go go))) #t)
(test (call-with-exit (lambda (go) (case 'go ((go 2) 3) (else 4)))) 3)
(test (call-with-exit (lambda (go) (go (go (go 1))))) 1)
(test (call-with-exit (lambda (go) (quasiquote (go 1)))) '(go 1))

;; these tests were messed up -- I forgot the outer parens
(test (call-with-exit (lambda (go) ((lambda* ((a (go 1))) a) (go 2) 3))) 2)
(test (call-with-exit (lambda (go) ((lambda* ((a (go 1))) a)))) 1)

(test (call-with-exit (lambda (go) ((lambda (go) go) 1))) 1)
(test (call-with-exit (lambda (go) (quote (go 1)) 2)) 2)
(test (call-with-exit (lambda (go) (and (go 1) #f))) 1)
(test (call-with-exit (lambda (go) (dynamic-wind (lambda () (go 1) 11) (lambda () (go 2) 12) (lambda () (go 3) 13)))) 1)

(test (eval '(call/cc (lambda (go) (if (go 1) (go 2) (go 3))))) 1)
(test (eval '(call/cc (lambda (go) (set! (go 1) 2)))) 'error) 
(test (eval '(call/cc (lambda (go) (let ((x 1) (y (go x))) #f)))) 'error)
(test (eval '(call/cc (lambda (go) (let* ((x 1) (y (go x))) #f)))) 1)
(test (eval '(call/cc (lambda (go) (letrec ((x 1) (y (go x))) #f)))) #<undefined>)
(test (eval '(call/cc (lambda (go) (letrec* ((x 1) (y (go x))) #f)))) 1)
(test (eval '(call/cc (lambda (go) (case (go 1) ((go 2) 3) (else 4))))) 1)
(test (eval '(call/cc (lambda (go) (case go ((go 2) 3) (else 4))))) 4)
(test (eval '(call/cc (lambda (go) (case 2 ((go 2) 3) (else 4))))) 3)
(test (eval '(call/cc (lambda (go) (eq? go go)))) #t)
(test (eval '(call/cc (lambda (go) (case 'go ((go 2) 3) (else 4))))) 3)
(test (eval '(call/cc (lambda (go) (go (go (go 1)))))) 1)
(test (eval '(call/cc (lambda (go) (quasiquote (go 1))))) '(go 1))
(test (eval '(call/cc (lambda (go) ((lambda* (a (go 1)) a) (go 2))))) 2)
(test (eval '(call/cc (lambda (go) ((lambda* (a (go 1)) a) 2)))) 2)
(test (eval '(call/cc (lambda (go) ((lambda* (a (go 1)) a))))) #f)
(test (eval '(call/cc (lambda (go) ((lambda (go) go) 1)))) 1)
(test (eval '(call/cc (lambda (go) (quote (go 1)) 2))) 2)
(test (eval '(call/cc (lambda (go) (and (go 1) #f)))) 1)
(test (eval '(call/cc (lambda (go) (dynamic-wind (lambda () (go 1) 11) (lambda () (go 2) 12) (lambda () (go 3) 13))))) 1)

(test (call-with-exit (lambda (go) (eval '(go 1)) 2)) 1) 
(test (call-with-exit (lambda (go) (eval-string "(go 1)") 2)) 1)
(test (call-with-exit (lambda (go) `(,(go 1) 2))) 1)
(test (call-with-exit (lambda (go) (case 0 ((0) (go 1) (go 2))))) 1)
(test (call-with-exit (lambda (go) (cond (1 => go)) 2)) 1)
(test (call-with-exit (lambda (go) (((cond ((go 1) => go)) 2)))) 1)
(test (call-with-exit (lambda (go) (cond (1 => (go 2))))) 2)

(test (call-with-exit (lambda (go) (go (eval '(go 1))) 2)) 1)
(test (+ 10 (call-with-exit (lambda (go) (go (eval '(go 1))) 2))) 11)
;(test (call-with-exit (lambda (go) (go (eval-string "(go 1)")) 2)) 1)
;(test (call-with-exit (lambda (go) (eval-string "(go 1)") 2)) 1) 
(test (call-with-exit (lambda (go) ((eval 'go) 1) 2)) 1)  
(test (eval-string "(call/cc (lambda (go) (if (go 1) (go 2) (go 3))))") 1)
(test (call-with-exit (lambda (quit) ((lambda* ((a (quit 32))) a)))) 32)
(test ((call-with-exit (lambda (go) (go quasiquote))) go) 'go)

(test (let ((x #f))
	((lambda ()
	   (let-temporarily ((x 1234))
	     (call/cc (lambda (return) (let ((x 1) (y 2)) (return x y)))))
	   (if x y) ; y unbound, so x better be #f
	   3))) 3)

(test (let ((x #f))
	((lambda ()
	   (call-with-exit 
	    (lambda (go)
	      (let-temporarily ((x 1234))
		(call/cc (lambda (return) (let ((x 1) (y 2)) (return x y)))))
	      (if x y)
	      (go 3)))))) 3)

(test (let ((x #f))
	((lambda ()
	   (let-temporarily ((x 1234))
	     (call-with-exit 
	      (lambda (go)
		(call/cc (lambda (return) (let ((x 1) (y 2)) (return x y)))))))
	   (if x y)
	   3))) 3)

(test (let ((x #f))
	(dynamic-wind
	    (lambda () #f)
	    (lambda ()
	      (let-temporarily ((x 1234))
		(call/cc (lambda (return) (let ((x 1) (y 2)) (return x y)))))
	      (if x y)
	      3)
	    (lambda () #f)))
      3)

(test (let ((c #f))
	(let ((val -1))
	  (set! val (call/cc 
		     (lambda (c1)
		       (call-with-exit 
			(lambda (c2)
			  (call-with-exit 
			   (lambda (c3)
			     (call/cc 
			      (lambda (c4)
				(set! c c4)
				(c1 (c2 0)))))))))))
	  (if (= val 0) (c 5))
	  val))
      5)

(let ()
#|
  (define-macro (while test . body)
    `(call-with-exit 
      (lambda (break) 
	(letrec ((continue (lambda () 
			     (if (let () ,test)
				 (begin 
				   (let () ,@body)
				   (continue))
				 (break)))))
	  (continue)))))
|#
  (define-macro (while test . body)      ; while loop with predefined break and continue
    `(call-with-exit
      (lambda (break) 
	(let continue ()
	  (if (let () ,test)
	      (begin 
		(let () ,@body)
		(continue))
	      (break))))))
  
  (test (let ((i 0)
	      (sum 0)
	      (break 32)
	      (continue 48))
	  (while (begin 
		   (define break 10)
		   (define continue 0) 
		   (< i (+ break continue)))
		 (set! sum (+ sum 1))
		 (set! i (+ i 1))
		 (if (< i 5) (continue))
		 (set! sum (+ sum 10))
		 (if (> i 7) (break))
		 (set! sum (+ sum 100)))
	  sum)
	348))

;;; (define-macro (while test . body) `(do () ((not ,test)) ,@body)) ?


;;; with-baffle

(test (with-baffle) ()) ; ?? -- like begin I guess
(test (with-baffle 0) 0)
(test (+ 1 (with-baffle (values 2 3)) 4) 10)
(test (with-baffle . 1) 'error)
(test (with-baffle 1 2 . 3) 'error)

(test (with-baffle
       (let ((x 0)
	     (c1 #f)
	     (results ()))
	 (set! x (call/cc
		  (lambda (r1)
		    (set! c1 r1)
		    (r1 2))))
	 (set! results (cons x results))
	 (if (= x 2) (c1 32))
	 results))
      '(32 2))

(test (let ((x 0)
	    (c1 #f)
	    (results ()))
	(with-baffle
	 (set! x (call/cc
		  (lambda (r1)
		    (set! c1 r1)
		    (r1 2))))
	 (set! results (cons x results)))
	(if (= x 2) (c1 32))
	results)
      'error)

(test (let ((what's-for-breakfast ())
	    (bad-dog 'fido))        ; bad-dog wonders what's for breakfast?
	(with-baffle                ; the syntax is (with-baffle . body)         
	  (set! what's-for-breakfast
		(call/cc
		 (lambda (biscuit?)
		   (set! bad-dog biscuit?) ; bad-dog smells a biscuit!
		   'biscuit!))))
	(if (eq? what's-for-breakfast 'biscuit!) 
	    (bad-dog 'biscuit!))     ; now, outside the baffled block, bad-dog wants that biscuit!
	what's-for-breakfast)        ;   but s7 says "No!": baffled! ("continuation can't jump into with-baffle")
      'error)

(test (+ (with-baffle (let ((c1 #f)) (call/cc (lambda (c2) (set! c1 c2) (c2 2))))) 1) 3)
(test (+ (let ((c1 #f)) (with-baffle (call/cc (lambda (c2) (set! c1 c2) (c2 2)))) (c1 3)) 1) 'error)
(test (let () (define (c3 a) (a 2)) (c3 (with-baffle (call/cc (lambda (c2) c2))))) 'error)
(test (call-with-exit (lambda (return) (with-baffle (do () () (return 1))))) 1)
(test (let () (define (hi) (null? (with-baffle))) (hi)) #t)



;;; --------------------------------------------------------------------------------
;;; dynamic-wind
;;; --------------------------------------------------------------------------------

(test (let ((ctr1 0)
	    (ctr2 0)
	    (ctr3 0))
	(let ((ctr4 (dynamic-wind
			(lambda () (set! ctr1 (+ ctr1 1)))
			(lambda () (set! ctr2 (+ ctr2 1)) (+ 1 ctr2))
			(lambda () (set! ctr3 (+ ctr3 1))))))
	  (= ctr1 ctr2 ctr3 (- ctr4 1) 1)))
      #t)

(test (let ((ctr1 0)
	    (ctr2 0)
	    (ctr3 0))
	(let ((ctr4 (catch 'dw
			   (lambda ()
			     (dynamic-wind
				 (lambda () (set! ctr1 (+ ctr1 1)))
				 (lambda () (set! ctr2 (+ ctr2 1)) (error 'dw "dw-error") ctr2)
				 (lambda () (set! ctr3 (+ ctr3 1)))))
			   (lambda args (car args)))))
	  (and (eq? ctr4 'dw)
	       (= ctr1 1) (= ctr2 1) (= ctr3 1))))
      #t)

(test (let ((ctr1 0)
	    (ctr2 0)
	    (ctr3 0))
	(let ((ctr4 (catch 'dw
			   (lambda ()
			     (dynamic-wind
				 (lambda () (set! ctr1 (+ ctr1 1)))
				 (lambda () (error 'dw "dw-error") (set! ctr2 (+ ctr2 1)) ctr2)
				 (lambda () (set! ctr3 (+ ctr3 1)))))
			   (lambda args (car args)))))
	  (and (eq? ctr4 'dw)
	       (= ctr1 1) (= ctr2 0) (= ctr3 1))))
      #t)

(test (let ((ctr1 0)
	    (ctr2 0)
	    (ctr3 0))
	(let ((ctr4 (catch #t
			   (lambda ()
			     (dynamic-wind
				 (lambda () (set! ctr1 (+ ctr1 1)) (error 'dw-init "dw-error"))
				 (lambda () (set! ctr2 (+ ctr2 1)) (error 'dw "dw-error") ctr2)
				 (lambda () (set! ctr3 (+ ctr3 1)))))
			   (lambda args (car args)))))
	  (and (eq? ctr4 'dw-init)
	       (= ctr1 1) (= ctr2 0) (= ctr3 0))))
      #t)

(test (let ((ctr1 0)
	    (ctr2 0)
	    (ctr3 0))
	(let ((ctr4 (catch #t
			   (lambda ()
			     (dynamic-wind
				 (lambda () (set! ctr1 (+ ctr1 1)))
				 (lambda () (set! ctr2 (+ ctr2 1)) ctr2)
				 (lambda () (set! ctr3 (+ ctr3 1)) (error 'dw-final "dw-error"))))
			   (lambda args (car args)))))
	  (and (eq? ctr4 'dw-final)
	       (= ctr1 1) (= ctr2 1) (= ctr3 1))))
      #t)

(test (let ((ctr1 0)
	    (ctr2 0)
	    (ctr3 0))
	(let ((ctr4 (catch #t
			   (lambda ()
			     (dynamic-wind
				 (lambda () (set! ctr1 (+ ctr1 1)))
				 (lambda () (set! ctr2 (+ ctr2 1)) ctr2)
				 (lambda () (error 'dw-final "dw-error") (set! ctr3 (+ ctr3 1)))))
			   (lambda args (car args)))))
	  (and (eq? ctr4 'dw-final)
	       (= ctr1 1) (= ctr2 1) (= ctr3 0))))
      #t)

(test (let ((ctr1 0)
	    (ctr2 0)
	    (ctr3 0))
	(let ((ctr4 (call/cc (lambda (exit)
			       (dynamic-wind
				   (lambda () (set! ctr1 (+ ctr1 1)))
				   (lambda () (exit ctr2) (set! ctr2 (+ ctr2 1)) ctr2)
				   (lambda () (set! ctr3 (+ ctr3 1)) 123))))))
	  (and (= ctr1 ctr3 1)
	       (= ctr2 ctr4 0))))
      #t)

(test (let ((ctr1 0)
	    (ctr2 0)
	    (ctr3 0))
	(let ((ctr4 (call/cc (lambda (exit)
			       (dynamic-wind
				   (lambda () (exit ctr1) (set! ctr1 (+ ctr1 1)))
				   (lambda () (set! ctr2 (+ ctr2 1)) ctr2)
				   (lambda () (set! ctr3 (+ ctr3 1))))))))
	  (= ctr1 ctr2 ctr3 ctr4 0)))
      #t)

(test (let ((ctr1 0)
	    (ctr2 0)
	    (ctr3 0))
	(let ((ctr4 (call/cc (lambda (exit)
			       (dynamic-wind
				   (lambda () (set! ctr1 (+ ctr1 1)))
				   (lambda () (set! ctr2 (+ ctr2 1)) ctr2)
				   (lambda () (exit ctr3) (set! ctr3 (+ ctr3 1))))))))
	  (and (= ctr1 ctr2 1)
	       (= ctr3 ctr4 0))))
      #t)

(test (let ((path ())  
	    (c #f)) 
	(let ((add (lambda (s)  
		     (set! path (cons s path))))) 
	  (dynamic-wind  
	      (lambda () (add 'connect))  
	      (lambda () (add (call-with-current-continuation  
			       (lambda (c0) (set! c c0) 'talk1))))  
	      (lambda () (add 'disconnect))) 
	  (if (< (length path) 4) 
	      (c 'talk2) 
	      (reverse path)))) 
      '(connect talk1 disconnect  connect talk2 disconnect))


(for-each
 (lambda (arg)
   (test (dynamic-wind (lambda () #f) (lambda () arg) (lambda () #f)) arg))
 (list "hi" -1 #\a 1 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #t (list 1 2 3) '(1 . 2)))

(test (dynamic-wind (lambda () #f) (lambda () #f) (lambda () #f)) #f)
(test (+ 1 (dynamic-wind (lambda () #f) (lambda () (values 2 3 4)) (lambda () #f)) 5) 15)
(test (let () (define-macro (makef val) `(lambda () ,val)) (dynamic-wind (lambda () #f) (makef 123) (lambda () #f))) 123)
(test (dynamic-wind (lambda () #f) (define-macro (_m_) 32) (lambda () #f)) 32)

(let ()
  (define-macro (m) `(+ 1 2 3))
  (test (dynamic-wind m m m) 6)
  (test (dynamic-wind m (lambda () 123) m) 123)
  (test (dynamic-wind (lambda () #f) m (lambda () #f)) 6)
  (test (dynamic-wind (lambda () #f) m m) 6))
;;; so... dynamic-wind init load quit would place the loaded defs in the current env -- transparent dw 
(let ()
  (define-macro* (m (a 1)) `(define __asdf__ ,a))
  (dynamic-wind (lambda () #f) m (lambda () #f))
  (test __asdf__ 1))

(test (let ((identity (lambda (a) a)))
        (let ((x ())
              (c #f))
          (dynamic-wind
	      (lambda () (set! x (cons 'a x)))
	      (lambda ()
		(dynamic-wind
		    (lambda () (set! x (cons 'b x)))
		    (lambda ()
		      (dynamic-wind
			  (lambda () (set! x (cons 'c x)))
			  (lambda () (set! c (call/cc identity)))
			  (lambda () (set! x (cons 'd x)))))
		    (lambda () (set! x (cons 'e x))))
		(dynamic-wind
		    (lambda () (set! x (cons 'f x)))
		    (lambda () (if c (c #f)))
		    (lambda () (set! x (cons 'g x)))))
	      (lambda () (set! x (cons 'h x))))
          (reverse x)))
      '(a b c d e f g b c d e f g h))


(test (dynamic-wind
	  (lambda args
	    (if (not (null? args))
		(format *stderr* "args: ~A~%": args)))
	  (lambda args
	    (if (not (null? args))
		(format *stderr* "args: ~A~%": args))
	    args)
	  (lambda args
	    (if (not (null? args))
		(format *stderr* "args: ~A~%": args))))
      ())

(test (list (dynamic-wind 
		(lambda () #f)
		(lambda () (values 'a 'b 'c))
		(lambda () #f)))
      (list 'a 'b 'c))

(test (let ((ctr1 0)
	    (ctr2 0)
	    (ctr3 0))
	(let ((val (dynamic-wind
		       (lambda () #f)
		       (lambda ()
			 (set! ctr1 1)
			 (call/cc
			  (lambda (exit)
			    (exit 123)
			    (set! ctr2 2)
			    321)))
		       (lambda ()
			 (set! ctr3 3)))))
	  (and (= ctr1 1) (= ctr2 0) (= ctr3 3) (= val 123))))
      #t)

(test (let ((ctr1 0))
	(let ((val (dynamic-wind
		       (let ((a 1))
			 (lambda ()
			   (set! ctr1 a)))
		       (let ((a 10))
			 (lambda ()
			   (set! ctr1 (+ ctr1 a))
			   ctr1))
		       (let ((a 100))
			 (lambda ()
			   (set! ctr1 (+ ctr1 a)))))))
	  (and (= ctr1 111) (= val 11))))
      #t)

(test (let ((ctr1 0))
	(let ((val (+ 3 (dynamic-wind
			    (let ((a 1))
			      (lambda ()
				(set! ctr1 a)))
			    (let ((a 10))
			      (lambda ()
				(set! ctr1 (+ ctr1 a))
				ctr1))
			    (let ((a 100))
			      (lambda ()
				(set! ctr1 (+ ctr1 a)))))
		      1000)))
	  (and (= ctr1 111) (= val 1014))))
      #t)

(test (let ((n 0))
	(call-with-current-continuation
	 (lambda (k)
	   (dynamic-wind
	       (lambda ()
		 (set! n (+ n 1))
		 (k))
	       (lambda ()
		 (set! n (+ n 2)))
	       (lambda ()
		 (set! n (+ n 4))))))
	n)
      1)

(test (let ((n 0))
	(call-with-current-continuation
	 (lambda (k)
	   (dynamic-wind
	       (lambda () #f)
	       (lambda ()
		 (dynamic-wind
		     (lambda () #f)
		     (lambda ()
		       (set! n (+ n 1))
		       (k))
		     (lambda ()
		       (set! n (+ n 2))
					;(k)
		       )))
	       (lambda ()
		 (set! n (+ n 4))))))
	n)
      7)

(test (let ((n 0))
	(call-with-current-continuation
	 (lambda (k)
	   (dynamic-wind
	       (lambda () #f)
	       (lambda ()
		 (dynamic-wind
		     (lambda () #f)
		     (lambda ()
		       (dynamic-wind
			   (lambda () #f)
			   (lambda ()
			     (set! n (+ n 1))
			     (k))
			   (lambda ()
			     (if (= n 1)
				 (set! n (+ n 2))))))
		     (lambda ()
		       (if (= n 3)
			   (set! n (+ n 4))))))
	       (lambda ()
		 (if (= n 7)
		     (set! n (+ n 8)))))))
	n)
      15)

(test (dynamic-wind) 'error)
(test (dynamic-wind (lambda () #f)) 'error)
(test (dynamic-wind (lambda () #f) (lambda () #f)) 'error)
(test (dynamic-wind (lambda (a) #f) (lambda () #f) (lambda () #f)) 'error)
(test (dynamic-wind (lambda () #f) (lambda (a b) #f) (lambda () #f)) 'error)
(test (dynamic-wind (lambda () #f) (lambda () #f) (lambda (a) #f)) 'error)
(test (dynamic-wind (lambda () 1) #f (lambda () 2)) 'error)
(test (dynamic-wind . 1) 'error)
(test (dynamic-wind () () ()) 'error)
(test (dynamic-wind () _ht_ _undef_ _null_ _c_obj_ ()) 'error)
(test (dynamic-wind + + +) 0)
(test (dynamic-wind (values + + +)) 0)
(test (dynamic-wind s7-version s7-version s7-version) (s7-version))
(test (+ (dynamic-wind (lambda () (values 1 2 3)) (lambda () (values 4 5 6)) (lambda () (values 7 8 9)))) 15)

(for-each
 (lambda (arg)
   (test (dynamic-wind arg (lambda () #f) (lambda () #f)) 'error)
   (test (dynamic-wind (lambda () #f) arg (lambda () #f)) 'error)
   (test (dynamic-wind (lambda () #f) (lambda () #f) arg) 'error))
 (list "hi" -1 #\a 1 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #t (list 1 2 3) '(1 . 2)))

(test (dynamic-wind (let ((x 1)) (lambda () x)) ((lambda () (lambda () 2))) s7-version) 2)
(test (let ((x 0)) (dynamic-wind (lambda () (set! x 1)) ((lambda () (set! x 32) (lambda () x))) (let () (set! x 44) (lambda () x)))) 1)
(test (let ((x 0)) (dynamic-wind (lambda () (set! x (+ x 1))) ((lambda () (set! x 32) (lambda () x))) (let () (set! x 44) (lambda () x)))) 45)
(test (let ((x 0)) (dynamic-wind (lambda () (set! x (+ x 1))) ((lambda () (set! x 32) (lambda () x))) (let () (lambda () x)))) 33)
(test (let ((x 0)) (dynamic-wind (lambda () (set! x (+ x 1))) ((lambda () (set! x (+ x 32)) (lambda () x))) (let () (lambda () (set! x (+ x 100)) x)))) 33)

(let ()
  (define-macro (make-thunk val) `(lambda () ,val))
  (test (dynamic-wind (make-thunk 0) (make-thunk 1) (make-thunk 2)) 1))

(let ((jumps 4))

  (define (test1 f)
    (let ((c #f) (ctr 0))
      (dynamic-wind
	  (lambda () #f)
	  (lambda () (when (not c) (call/cc (lambda (k) (set! c k)))) (set! ctr (+ ctr 1)))
	  (lambda () #f))
      (if (< ctr f) (c))
      ctr))
  
  (define (test2 f)
    (let ((c #f) (ctr 0))
      (dynamic-wind
	  (lambda () #f)
	  (lambda () (with-baffle (when (not c) (call/cc (lambda (k) (set! c k)))) (set! ctr (+ ctr 1))))
	  (lambda () #f))
      (if (< ctr f) (c))
      ctr))
  
  (test (catch #t (lambda () (test2 jumps)) (lambda args 'error)) 'error)
  (test (test1 jumps) 4)
  
  (define (test3 f)
    (let ((c #f) (ctr 0))
      (dynamic-wind
	  (lambda () #f)
	  (lambda () #f)
	  (lambda () (when (not c) (call/cc (lambda (k) (set! c k)))) (set! ctr (+ ctr 1))))
      (if (< ctr f) (c))
      ctr))
  
  (define (test4 f)
    (let ((c #f) (ctr 0))
      (dynamic-wind
	  (lambda () #f)
	  (lambda () #f)
	  (lambda () (with-baffle (when (not c) (call/cc (lambda (k) (set! c k)))) (set! ctr (+ ctr 1)))))
      (if (< ctr f) (c))
      ctr))
  
  (test (catch #t (lambda () (test4 jumps)) (lambda args 'error)) 'error)
  (test (test3 jumps) 5)
  
  (define (test5 f)
    (let ((c #f) (ctr 0))
      (dynamic-wind
	  (lambda () (when (not c) (call/cc (lambda (k) (set! c k)))) (set! ctr (+ ctr 1))) ; this is a very bad idea! (infinite loop etc)
	  (lambda () #f)
	  (lambda () #f))
      (if (< ctr f) (c))
      ctr))
  
  (define (test6 f)
    (let ((c #f) (ctr 0))
      (dynamic-wind
	  (lambda () (with-baffle (when (not c) (call/cc (lambda (k) (set! c k)))) (set! ctr (+ ctr 1))))
	  (lambda () #f)
	  (lambda () #f))
      (if (< ctr f) (c))
      ctr))
  
  (test (catch #t (lambda () (test6 jumps)) (lambda args 'error)) 'error)
  (test (test5 jumps) 5))
#|
;;; from scheme wiki
;;; http://community.schemewiki.org/?hose-the-repl
;;; jorgen-schafer

(test (let loop ()  
	(call-with-exit
	 (lambda (k)  
	   (dynamic-wind  
	       (lambda () #t)  
	       (lambda () (let loop () (loop)))  
	       k))) 
	(loop))
      'error)
;; that example calls to mind a bunch like it:
(test (call-with-exit (lambda (k) (dynamic-wind (lambda () #t) (lambda () (let loop () (loop))) k))) 'error)
(test (call-with-exit (lambda (k) (dynamic-wind (lambda () #t) k (lambda () #t)))) 'error)
(test (call-with-exit (lambda (k) (dynamic-wind k (lambda () #f) (lambda () #t)))) 'error)
|#




(test (call-with-exit (lambda (k) (documentation k))) "")
(test (call-with-exit (lambda (k) (procedure-source k))) ())

(test (let ((pws (dilambda vector-ref vector-set!))) 
	(let ((pws1 (dilambda pws vector-set!))) 
	  (let ((v (vector 1 2))) 
	    (set! (pws1 v 1) 32) 
	    (pws1 v 1))))
      32)
(test (call-with-exit (lambda (k) (map k '(1 2 3)))) 1)
(test (call-with-exit (lambda (k) (for-each k '(1 2 3)))) 1)
(test (call-with-exit (lambda (k) (catch #t k k))) ()) ; was 'error until 14-May-14
(test (call-with-exit (lambda (k) (catch #t (lambda () #f) k))) #f)
;(test (call-with-exit (lambda (k) (catch #t (lambda () (error 'an-error)) k))) 'error) ; this seems like it could be either
(test (procedure? (call-with-exit (lambda (return) (call-with-exit return)))) #t)
(test (call-with-exit (lambda (k) (sort! '(1 2 3) k))) 'error) ; "sort! argument 2, #<goto>, is a goto"
(test (sort! '(1 2 3) (lambda () #f)) 'error)
(test (sort! '(1 2 3) (lambda (a) #f)) 'error)
(test (sort! '(1 2 3) (lambda (a b c) #f)) 'error)
;(test (let () (define-macro (asdf a b) `(< ,a ,b)) (sort! '(1 2 3) asdf)) 'error)
(test (let () (let asdf () (sort! '(1 2 3) asdf))) 'error)
(test (let () (let asdf () (map asdf '(1 2 3)))) 'error)
(test (let () (let asdf () (for-each asdf '(1 2 3)))) 'error)
(test (dynamic-wind quasiquote s7-version s7-version) 'error)
(test (sort! '(1 2 3) (define-macro (_m_ a b) `(> ,a ,b))) '(3 2 1))
(test (sort! '(2 1 3) (define-macro (_m_ a b) `(< ,a ,b))) '(1 2 3))

(test (let ((ctr 0))
	(call-with-exit
	 (lambda (exit)
	   (let asdf
	       ()
	     (set! ctr (+ ctr 1))
	     (if (> ctr 2)
		 (exit ctr))
	     (dynamic-wind
		 (lambda () #f)
		 (lambda () #f)
		 asdf)))))
      3)

(test (let ((ctr 0))
	(dynamic-wind
	    (lambda () #f)
	    (lambda ()
	      (call-with-exit
	       (lambda (exit)
		 (catch #t
			(lambda ()
			  (error 'error))
			(lambda args
			  (exit 'error)))
		 (set! ctr 1))))
	    (lambda ()
	      (set! ctr (+ ctr 2))))
	ctr)
      2)
(test (call-with-exit (lambda (r1) (call-with-exit (lambda (r2) (call-with-exit (lambda (r3) (r1 12) (r2 1))) (r1 2))) 3)) 12)
(test (call-with-exit (lambda (r1) (call-with-exit (lambda (r2) (call-with-exit (lambda (r3) (r2 12) (r2 1))) (r1 2))) 3)) 3)
(test (call-with-exit (lambda (r1) (call-with-exit (lambda (r2) (call-with-exit (lambda (r3) (r3 12) (r2 1))) (r1 2))) 3)) 2)

;; make sure call-with-exit closes ports
(test (let ((p (call-with-exit (lambda (return) 
				 (call-with-input-file tmp-output-file 
				   (lambda (port) 
				     (return port))))))) 
	(port-closed? p)) 
      #t)
(test (let ((p (call-with-exit (lambda (return) 
				 (call-with-input-file tmp-output-file 
				   (lambda (port) 
				     (if (not (port-closed? port)) (return port))))))))
	(port-closed? p)) 
      #t)
(test (let ((p (call-with-exit (lambda (return) 
				 (with-input-from-file tmp-output-file 
				   (lambda () 
				     (return (current-input-port)))))))) 
	(port-closed? p)) 
      #t)
(test (let ((p (call-with-exit (lambda (return) 
				 (with-output-to-file "empty-file" 
				   (lambda () 
				     (return (current-output-port)))))))) 
	(port-closed? p)) 
      #t)
(test (let ((p (call-with-exit (lambda (return) 
				 (call-with-output-file "empty-file" 
				   (lambda (port) 
				     (return port)))))))
	(port-closed? p)) 
      #t)
(test (let ((p (call-with-exit (lambda (return) 
				 (call-with-input-string "this is a test" 
				   (lambda (port) 
				     (return port)))))))
	(port-closed? p)) 
      #t)
(test (let ((p (call-with-exit (lambda (return) 
				 (call-with-output-string
				   (lambda (port) 
				     (return port)))))))
	(port-closed? p)) 
      #t)

(let ((pws (dilambda < >))) (test (sort! '(2 3 1 4) pws) '(1 2 3 4)))
(test (call-with-exit (lambda (k) (call-with-input-string "123" k))) 'error)
(test (call-with-exit (lambda (k) (call-with-input-file tmp-output-file k))) 'error)
(test (call-with-exit (lambda (k) (call-with-output-file tmp-output-file k))) 'error)
(test (call-with-exit (lambda (k) (call-with-output-string k))) 'error)
(test (call-with-output-string (hash-table* 'b 2)) "") ;??
(let ((pws (dilambda (lambda (a) (+ a 1)) (lambda (a b) b))))
  (test (procedure? pws) #t)
  (test (map pws '(1 2 3)) '(2 3 4))
  (test (apply pws '(1)) 2))
(test (let ((ctr 0)) (call-with-exit (lambda (top-exit) (set! ctr (+ ctr 1)) (call-with-exit top-exit) (set! ctr (+ ctr 16)))) ctr) 1)

(test (let () (+ 5 (call-with-exit (lambda (return) (return 1 2 3) 4)))) 11)
(test (+ 5 (call-with-exit (lambda (return) (return 1)))) 6)
(test (+ 5 (call-with-exit (lambda (return) (return)))) 'error)

(test (let ((cur ()))
	(define (step pos)
	  (dynamic-wind
	      (lambda ()
		(set! cur (cons pos cur)))
	      (lambda ()
		(set! cur (cons (+ pos 1) cur))
		(if (< pos 40)
		    (step (+ pos 10)))
		(set! cur (cons (+ pos 2) cur))
		cur)
	      (lambda ()
		(set! cur (cons (+ pos 3) cur)))))
	(reverse (step 0)))
      '(0 1 10 11 20 21 30 31 40 41 42 43 32 33 22 23 12 13 2))


(test (let ((cur ()))
	(define (step pos)
	  (dynamic-wind
	      (lambda ()
		(set! cur (cons pos cur)))
	      (lambda ()
		(set! cur (cons (+ pos 1) cur))
		(if (< pos 40)
		    (step (+ pos 10))
		    (error 'all-done))
		(set! cur (cons (+ pos 2) cur))
		cur)
	      (lambda ()
		(set! cur (cons (+ pos 3) cur)))))
	(catch 'all-done
	       (lambda ()
		 (reverse (step 0)))
	       (lambda args (reverse cur))))
      '(0 1 10 11 20 21 30 31 40 41 43 33 23 13 3))

(test (let ((cur ()))
	(define (step pos ret)
	  (dynamic-wind
	      (lambda ()
		(set! cur (cons pos cur)))
	      (lambda ()
		(set! cur (cons (+ pos 1) cur))
		(if (< pos 40)
		    (step (+ pos 10) ret)
		    (ret (reverse cur)))
		(set! cur (cons (+ pos 2) cur))
		cur)
	      (lambda ()
		(set! cur (cons (+ pos 3) cur)))))
	(list (call-with-exit
	       (lambda (ret)
		 (step 0 ret)))
	      (reverse cur)))
      '((0 1 10 11 20 21 30 31 40 41) (0 1 10 11 20 21 30 31 40 41 43 33 23 13 3)))

(test (let ()
	(catch #t
	       (lambda ()
		 (eval-string "(error 'hi \"hi\")"))
	       (lambda args
		 'error)))
      'error)
(test (let ()
	(catch #t
	       (lambda ()
		 (eval-string "(+ 1 #\\a)"))
	       (lambda args
		 'oops)))
      'oops)
#|
(test (let ()
	(call-with-exit
	 (lambda (return)
	   (eval-string "(return 3)"))))
      3)

(test (let ()
	(call-with-exit
	 (lambda (return)
	   (eval-string "(abs (+ 1 (if #t (return 3))))"))))
      3)
|#
(test (let ()
	(call-with-exit
	 (lambda (return)
	   (eval '(return 3)))))
      3)

(test (let ()
	(call-with-exit
	 (lambda (return)
	   (eval '(abs (+ 1 (if #t (return 3))))))))
      3)
(test (let ((val (catch #t
			(lambda ()
			  (eval-string "(catch 'a (lambda () (+ 1 __asdf__)) (lambda args 'oops))"))
			(lambda args 'error))))
	val)
      'error)

(test (let ((val (catch #t
			(lambda ()
			  (eval `(catch 'a (lambda () (+ 1 __asdf__)) (lambda args 'oops))))
			(lambda args 'error))))
	val)
      'error)

(test ((lambda* ((x 1) (y 2)) (+ x y)) (eval-string "(values 3 4)")) 7)

(test (let ()
	(call/cc
	 (lambda (ret)
	   (eval-string "(ret 3)"))))
      3)

(test (let ()
	(call/cc
	 (lambda (ret)
	   (eval '(ret 3)))))
      3)
(test (let ()
	(call/cc
	 (lambda (ret)
	   (ret 3))))
      3)
(test (let ()
	(call-with-exit
	 (lambda (ret)
	   (eval-string "(ret 3)"))))
      3)

(let ((x 0)
      (y 0)
      (z 0))
  (define (dw1 a c) 
    (dynamic-wind
	(lambda ()
	  (set! x (+ x 1)))
	(lambda ()
	  (set! y (+ y 1))
	  (or (and (>= a c) a)
	      (dw1 (+ a 1) c)))
	(lambda ()
	  (set! z (+ z 1))
	  (set! y (- y 1)))))
  (let ((val (dw1 0 8)))
    (test (list val x y z) (list 8 9 0 9))))

(let ((x 0)
      (y 0)
      (z 0))
  (define (dw1 a c) 
    (catch #t
	   (lambda ()
	     (dynamic-wind
		 (lambda ()
		   (set! x (+ x 1)))
		 (lambda ()
		   (set! y (+ y 1))
		   (or (and (>= a c) a)
		       (dw1 (+ a 1) c)))
		 (lambda ()
		   (set! z (+ z 1))
		   (set! y (= y 1))))) ; an error after the first call because we have (= #f 1)
	   (lambda args 'error)))
  (let ((val (dw1 0 4)))
    (test val 'error)))

(let ((x 0)
      (y 0)
      (z 0))
  (define (dw1 a c) 
    (catch #t
	   (lambda ()
	     (dynamic-wind
		 (lambda ()
		   (set! x (+ x 1)))
		 (lambda ()
		   (set! y (= y 1)) ; an error after the first call because we have (= #f 1)
		   (or (and (>= a c) a)
		       (dw1 (+ a 1) c)))
		 (lambda ()
		   (set! z (+ z 1))
		   (set! y (= y 1)))))
	   (lambda args 'error)))
  (let ((val (dw1 0 4)))
    (test val 'error)))

(let ((x 0)
      (y 0)
      (z 0))
  (define (dw1 a c) 
    (catch #t
	   (lambda ()
	     (dynamic-wind
		 (lambda ()
		   (set! x (= x 1))) ; an error after the first call because we have (= #f 1)
		 (lambda ()
		   (set! y (= y 1)) 
		   (or (and (>= a c) a)
		       (dw1 (+ a 1) c)))
		 (lambda ()
		   (set! z (+ z 1))
		   (set! y (= y 1)))))
	   (lambda args 'error)))
  (let ((val (dw1 0 4)))
    (test val 'error)))

(let ((x 0)
      (y 0)
      (z 0))
  (let ((val (call-with-exit
	      (lambda (r)
		(catch #t
		       (lambda ()
			 (dynamic-wind
			     (lambda ()
			       (set! x (+ x 1)))
			     (lambda ()
			       (set! y (+ y 1))
			       (r y))
			     (lambda ()
			       (set! z (+ z 1)))))
		       (lambda args 'error))))))
    (test (list val z) '(1 1))))

(let ((x 0)
      (y 0)
      (z 0))
  (let ((val (catch #t
		    (lambda ()
		      (dynamic-wind
			  (lambda ()
			    (set! x (+ x 1)))
			  (lambda ()
			    (call-with-exit
			     (lambda (r)
			       (set! y r)
			       x)))
			  (lambda ()
			    (set! z (+ z 1))
			    (y z))))
		    (lambda args 'error))))
    (test val 'error)))

(test (dynamic-wind 
	  (lambda () (eq? (let ((lst (cons 1 2))) (set-cdr! lst lst) lst) (call/cc (lambda (k) k))))
	  (lambda () #f)
	  (lambda () #f))
      #f)




;;; --------------------------------------------------------------------------------
;;; quasiquote
;;; --------------------------------------------------------------------------------

(test `(1 2 3) '(1 2 3))
(test `() ())
(test `(list ,(+ 1 2) 4)  '(list 3 4))
(test `(1 ,@(list 1 2) 4) '(1 1 2 4))
(test `(a ,(+ 1 2) ,@(map abs '(4 -5 6)) b) '(a 3 4 5 6 b))
(test `(a `(b ,(+ 1 2) ,(foo ,(+ 1 3) d) e) f) '(a `(b ,(+ 1 2) ,(foo 4 d) e) f))
(test (let ((name1 'x) (name2 'y)) `(a `(b ,,name1 ,',name2 d) e)) '(a `(b ,x ,'y d) e))
(test `(1 2 ,(* 9 9) 3 4) '(1 2 81 3 4))
(test `(1 ,(+ 1 1) 3) '(1 2 3))                     
(test `(,(+ 1 2)) '(3))
(test `(,'a . ,'b) (cons 'a 'b))
(test `(,@'() . foo) 'foo)
(test `(1 , 2) '(1 2))
(test `(1 , @(list 2 3)) 'error) ; ?? this is an error in Guile and Clisp
(test `(1 ,@ (list 2 3)) '(1 2 3)) ; seems a bit arbitrary
(test `(1 ,@(list)) '(1))
(test `(1 ,@()) '(1))
(test `(1 ,@'()) '(1))
(test `(1 . ,()) '(1))
(test `(1 , #|a comment|# 2) '(1 2))
(test `(1 ,@ #|a comment|# (list 2 3)) '(1 2 3))
(test `(1 , ;a comment
                       2) '(1 2))
(test `(1 #||#,2) '(1 2))
(test `(1 #||#,@(list #||# 2 3 #||#)) '(1 2 3))
(test (eval ``(+ 1 ,@,@'('(2 3)))) '(+ 1 2 3))
(test (eval ``(+ 1   ,@ #||#  ,@   '('(2 3)))) '(+ 1 2 3))
(test `(,1 ,1) '(1 1))
(test `(,1 ,`,1) '(1 1))
(test `(,1 ,`,@(list 1)) '(1 1))
(test `(,1 ,`,`,1) '(1 1))
(test `(,1 ,`,@'(1)) '(1 1))
(test `(,1 ,`,@`(1)) '(1 1))
(test `(,1 ,`,@`(,1)) '(1 1))
(test `(,1 ,@`,@(list (list 1))) '(1 1))
(test (eval ``(,,1 ,@,@(list (quote (list 1))))) '(1 1))
(test (eval ``(,,1 ,@,@(list `(list 1)))) '(1 1))
(test (eval (eval ```(,,,1 ,@,@,@(list '(list '(list 1)))))) '(1 1))
(test (+ 1 (eval (eval ```,@,,@(list ''(list 2 3))))) 6)
(test (+ 1 (eval (eval (eval ````,@,,,@(list '''(list 2 3)))))) 6)
(test (apply + `(1 ,@`(2 ,@(list 3)))) 6)
(test (eval `(- ,@()',1)) -1)
(test (eval `(,- ,@()'1)) -1)
;(test (eval (eval ``(- ,@,@'(,1())))) -1)
;(test (eval (eval ``(,@,@'(- ,1())))) -1)
;(test (eval (eval ``(,- ,@,@'(1())))) -1)
(test (eval (eval ``(,- ,@'(,@()1)))) -1)
(test (eval (eval ``(- ,@,@',().(1)))) -1)
(test (quasiquote quote) 'quote)
(test (eval (list quasiquote (list values #t))) (list values #t))

(test (eq? (cadr `(a, b, c,)) 'b,) #t)
(test (eq? (cadr '(a, b, c,)) 'b,) #t)
(test (let ((b, 32)) `(a , b, c,)) '(a 32 c,))
(test (let ((b, 32)) `(a, , b, c,)) '(a, 32 c,))
(if (not (provided? 'immutable-unquote)) (test (equal? (let ((b, 32)) '(a, , b, c,)) '(a, (unquote b,) c,)) #t)) ; comma by itself (no symbol) is an error
(if (not (provided? 'immutable-unquote)) (test (equal? (let ((b, 32)) '(a, ,  , b, c,)) '(a, (unquote (unquote b,)) c,)) #t))
;(test (equal? (let ((b 32)) (let ((b, b)) ``(a, ,  , b, c,))) '(list-values 'a, 32 'c,)) #t)
(if (not pure-s7)
    (test (let ((func abs)) (quasiquote (sym . (unquote func)))) (cons 'sym abs))) ; guile mailing list
(test (eval ``(,@,@())) ())

(if (provided? 'immutable-unquote)
    (begin
      (test (let () (define* ,() (abs ))) 'error)
      (test (let (,'a) unquote) 'error)
      (test (let (, '1) unquote) 'error)
      (test (let (, (lambda (x) (+ x 1))) ,,,,'3) 'error)
      (test (let (,@ '(1)) unquote) 'error)
      (test (let (,@ ()) ,2) 'error)
      (test (let (' 1) quote) 1)
      )
    (begin
      (test (let () (define* ,() (abs ))) 'error)
      (test (let (,'a) unquote) 'a)
      (test (let (, '1) unquote) 1)
      (test (let (, (lambda (x) (+ x 1))) ,,,,'3) 7)
      (test (let (,@ '(1)) unquote) 1)
      (test (let (,@ ()) ,2) 2)
      (test (let (' 1) quote) 1)
      ))

;; mostly from gauche
(let ((quasi0 99)
      (quasi1 101)
      (quasi2 '(a b))
      (quasi3 '(c d)))
  (test `,quasi0 99)
  (test `,quasi1 101)
  (test `(,(cons 1 2)) '((1 . 2)))
  (test `(,(cons 1 2) 3) '((1 . 2) 3))
  (test `(,quasi0 3) '(99 3))
  (test `(3 ,quasi0) '(3 99))
  (test `(,(+ quasi0 1) 3) '(100 3))
  (test `(3 ,(+ quasi0 1)) '(3 100))
  (test `(,quasi1 3) '(101 3))
  (test `(3 ,quasi1) '(3 101))
  (test `(,(+ quasi1 1) 3) '(102 3))
  (test `(3 ,(+ quasi1 1)) '(3 102))
  (test `(1 ,@(list 2 3) 4) '(1 2 3 4))
  (test `(1 2 ,@(list 3 4)) '(1 2 3 4))
  (test `(,@quasi2 ,@quasi3) '(a b c d))
  (test `(1 2 . ,(list 3 4)) '(1 2 3 4))
  (test `(,@quasi2 . ,quasi3) '(a b c d))

  (test `#() #())
  (test `(,@(list 1 2) ,@(list 1 2)) '(1 2 1 2))
  (test `(,@(list 1 2) a ,@(list 1 2)) '(1 2 a 1 2))
  (test `(a ,@(list 1 2) ,@(list 1 2)) '(a 1 2 1 2))
  (test `(,@(list 1 2) ,@(list 1 2) a) '(1 2 1 2 a))
  (test `(,@(list 1 2) ,@(list 1 2) a b) '(1 2 1 2 a b))
  (test `(,@(list 1 2) ,@(list 1 2) . a) '(1 2 1 2 . a))
  (test `(,@(list 1 2) ,@(list 1 2) . ,(cons 1 2)) '(1 2 1 2 1 . 2))
  (test `(,@(list 1 2) ,@(list 1 2) . ,quasi2) '(1 2 1 2 a b))
  (test `(,@(list 1 2) ,@(list 1 2) a . ,(cons 1 2)) '(1 2 1 2 a 1 . 2))
  (test `(,@(list 1 2) ,@(list 1 2) a . ,quasi3) '(1 2 1 2 a c d))
;  (test `(1 `(1 ,2 ,,(+ 1 2)) 1) '(1 `(1 ,2 ,3) 1))
;  (test `(1 `(1 ,,quasi0 ,,quasi1) 1) '(1 `(1 ,99 ,101) 1))
  (test `(1 `(1 ,@2 ,@,(list 1 2))) '(1 `(1 ,@2 ,@(1 2))))
  (test `(1 `(1 ,@,quasi2 ,@,quasi3)) '(1 `(1 ,@(a b) ,@(c d))))
  (test `(1 `(1 ,(,@quasi2 x) ,(y ,@quasi3))) '(1 `(1 ,(a b x) ,(y c d))))
  )

(let ((x 3)
      (y '(a b c)))
  (test `(1 . ,2) '(1 . 2))
  (test `(1 2 . ,3) '(1 2 . 3))
  (test `(1 x . ,3) '(1 x . 3))
  (test `(1 x . ,x) '(1 x . 3))
  (test `(1 . ,(list 2 3)) '(1 2 3))
  (test `(1 ,@(list 2 3)) '(1 2 3))
;;;  (test `(1 . ,@('(2 3))) '(1 2 3))
  (test `(1 ,(list 2 3)) '(1 (2 3)))
  (test `(1 . (list 2 3)) '(1 list 2 3))
  (test `(x . ,x) '(x . 3))
  (test `(y . ,y) '(y a b c))
  (test `(,x ,@y ,x) '(3 a b c 3))
  (test `(,x ,@y . ,x) '(3 a b c . 3))
  (test `(,y ,@y) '((a b c) a b c))
  (test `(,@y . ,y) '(a b c a b c))

  (test (object->string `(,y . ,y)) "((a b c) a b c)") ; was "(#1=(a b c) . #1#)"
  (test (object->string `(y ,y ,@y ,y . y)) "(y (a b c) a b c (a b c) . y)") ; was "(y #1=(a b c) a b c #1# . y)"

  (test (eval ``(1 . ,,2)) '(1 . 2))
  (test (eval ``(y . ,,x)) '(y . 3))
  (test (eval ``(,y . ,x)) '((a b c) . 3))
  (test (eval ``(,@y . x)) '(a b c . x))
  (test (eval ``(,x . ,y)) '(3 a b c))
  (test (eval ``(,,x . y)) '(3 . y))
  (test (eval ``(,,x ,@y)) '(3 a b c))  ;; in clisp `(,y . ,@(y)) -> *** - READ: the syntax `( ... . ,@form) is invalid
  )

(test (let ((.' '(1 2))) `(,@.')) '(1 2))

(test (let ((hi (lambda (a) `(+ 1 ,a))))
	(hi 2))
      '(+ 1 2))

(test (let ((hi (lambda (a) `(+ 1 ,@a))))
	(hi (list 2 3)))
      '(+ 1 2 3))

(test (let ((hi (lambda (a) `(let ((b ,a)) ,(+ 1 a)))))
	(hi 3))
      '(let ((b 3)) 4))

(test (let ((x '(a b c)))
	`(x ,x ,@x foo ,(cadr x) bar ,(cdr x) baz ,@(cdr x)))
      '(x (a b c) a b c foo b bar (b c) baz b c))

(test (let ((x '(a b c)))
	`(,(car `(,x))))
      '((a b c)))

(test (let ((x '(a b c)))
	`(,@(car `(,x))))
      '(a b c))

(test (let ((x '(a b c)))
	`(,(car `(,@x))))
      '(a))

(test (let ((x '(a b c)))
	``,,x)
      '(a b c))

(test (let ((x '(a b c)))
	`,(car `,x))
      'a)

(test (let ((x '(2 3)))
	`(1 ,@x 4))
      '(1 2 3 4))

(test (let ((x '(2 3)))
	`(1 ,@(map (lambda (a) (+ a 1)) x)))
      '(1 3 4))

;;; these are from the scheme bboard
(test (let ((x '(1 2 3))) `(0 . ,x)) '(0 1 2 3))
(test (let ((x '(1 2 3))) `(0 ,x)) '(0 (1 2 3)))

;; unbound variable x, but (let ((x '(1 2 3))) (quasiquote #(0 . ,x))) -> #(0 unquote x)
;; so ` and (quasiquote...) are not the same in the vector case

(test (let () (define-macro (tryqv . lst) `(map abs ',lst)) (tryqv 1 2 3 -4 5)) '(1 2 3 4 5))
(test (let () (define-macro (tryqv . lst) `(map abs '(,@lst))) (tryqv 1 2 3 -4 5)) '(1 2 3 4 5))
(test (let () (define-macro (tryqv . lst) `(map abs (vector ,@lst))) (tryqv 1 2 3 -4 5)) '(1 2 3 4 5))

(for-each
 (lambda (str)
   (let ((val (catch #t
		     (lambda () (eval-string str))
		     (lambda args 'error))))
     (if (not (eqv? val -1))
	 (format #t "~S = ~S?~%" str val))))
 (list "( '(.1 -1)1)" "( - '`-00 1)" "( - .(,`1/1))" "( - .(`1) )" "( -(/ .(1)))" "( / 01 -1 )" "(' '` -1(/ ' 1))" "(' (-01 )0)" 
       "(' `'`` -1 1 01)" "(''-1 .(1))" "('(, -1 )0)" "('(,-1)'000)" "('(,-1)00)" "('(-1  -.0)0)" "('(-1 '1`)0)" "('(-1 .-/-)0)" "('(-1()),0)"
       "('(-1) 0)" "('(10. -1 )1)" "(-  '`1)" "(-  `1 1 1)" "(- '  1)" "(- ' 1)" "(- '1 .())" "(- '` ,``1)" "(- '` 1)" "(- '`, `1)" "(- '`,`1)" 
       "(- '``1)" "(- (''1 1))" "(- (- ' 1 0))" "(- (-(- `1)))" "(- (`  (1)0))" "(- ,`, `1)" "(- ,`1 . ,())" "(- . ( 0 1))" "(- . ( `001))" 
       "(- .(', 01))" "(- .('`,1))" "(- .('``1))" "(- .(,,1))" "(- .(01))" "(- .(1))" "(- .(`,1))" "(- .(`,`1))" "(- .(`1))" "(- ` ,'1)" 
       "(- ` -0 '1)" "(- ` 1 )" "(- ` `1)" "(- `, 1)" "(- `,1)" "(- `,`,1)" "(- `,`1)" "(- ``,,1)" "(- ``,1)" "(- ``1 )" "(- ```,1)" 
       "(- ```1)" "(-(  / 1))" "(-( -  -1 ))" "(-( `,- 1 0))" "(-(' (1)0))" "(-('(,1)00))" "(-(- '`1) 0)" "(-(- -1))" "(-(/(/(/ 1))))" 
       "(-(`'1 '1))" "(-(`(,1 )'0))" "(-(`,/ ,1))" "(/ '-1 '1 )" "(/ ,, `,-1)" "(/ ,11 -11)" "(/ 01 (- '1))" "(/ `1 '`-1)" 
       "(/(- '1)  )" "(/(- '1)1)" "(/(- 001)1)" "(/(- 1),,1)" "(/(/ -1))" "(` ,- 1)" "(` `,(-1)0)" "(`' , -1 1)" "(/(- -001(+)))"
       "(`' -1 '1/1)" "(`','-1 ,1)" "(`(,-1)-00)" "(`(-0 -1)1)" "(`(-1 -.')0)" "(`(-1 1')0)" "(`(` -1)'`0)" "(`, - 1)" "(`,- '1)" "(`,- .(1))" 
       "(`,- 1 )" "(`,- `,1)" "(`,- `1)" "(`,/ . (-1))" "(``,,- `01)" "('''-1 '1 '1)" "(/ `-1 1)" "(/ .( -1))" "(-(+(+)0)1)" "(/ ,`,`-1/1)" 
       "(-(*).())" "(*(- +1))" "(-(`,*))" "(-(+)'1)" "(+(-(*)))" "(-(+(*)))" "(-(+)(*))" "(-(/(*)))" "(*(-(*)))" "(-(*(*)))" "(/(-(*)))" "(-(+(*)))"
       "(/ .(-1))" "(-(*))" "(- 000(*))" "(-(*(+ 1)))" "(- .((*)))" "(- +0/10(*))" "(-(`,/ .(1)))" "(+ .(' -01))" "(-(''1 01))" "(- -1/1 +0)"
       "(- `,'0 `01)" "( - `,(+)'1)" "(+(- . (`1)))" "(* '`,``-1)" "(-(+ -0)1)" "(+ +0(-(*)))" "(+(- '+1 ))" "(+ '-01(+))" "(`, -(+)1)" 
       "(`,+ 0 -1)" "(-(/(/(*))))" "(`,* .( -1))" "(-(*(*(*))))" "(`,@(list +)-1)" "(* (- 1) )" "(`, - (* ))" "(/(- (* 1)))"
       "(- -0/1(*))" "(`(,-1)0)" "(/(-(*).()))" "(* ````-1)" "(-(+(*)0))" "(-(* `,(*)))" "(- +1(*)1)" "(- (` ,* ))" "(/(-(+ )1))" "(`,* -1(*))" 
       "(` ,- .(1))" "(+(`,-( *)))" "( /(`,- 1))" "(`(1 -1)1)" "(*( -(/(*))))" "(- -1(-(+)))" "(* ``,,-1)" "(-(+(+))1)" "( +(*(-(*))))"
       "(-(+)`0(*))" "(-(+(+(*))))" "(-(+ .(01)))" "(/(*(-(* ))))" "(/ (-(* 1)))" "( /(-(/(*))))" "(+ -1 0/1)" "(/(-( +(*))))" "(*( -(`,*)))"
       "(* 1(/ 1)-1)" "(+ 0(- ',01))" "(+(-(-(+ -1))))" "(- 0(/(+(* ))))" "(-(+)( *)0)"
       "(`,- '01/1)" "(`, - ',,1)"  "(/ .(`-1 1))"  "(- ``,,'`1)" "(- 10 0011)" "(-(- ``1 0))" "( -(/ 01/1))" "(-(- 1)`,0)" "(/(/ -1 .()))" 
       "(/ ,,``-1)" "( `,`, - 1)" "(- .(`1/01  ))" "('(-1) ',``0)" "('( ,/ -1 )1)" "(- ,,`,`0 +1)" "(`(-1) `,0)" "(+(* (-(*))))"
       "(-(`,* ,,1))" "(+(+ 0)-1)" "(+(-(+ ,1)))" "(* ,`-01/1)" "(*(- '` `1))" "(-(*(* 1 1)))" "(-(*(/ .(1))))" "(-(- 1(*)-1))" 
       "(- -00 (* 1))" "(- (*(+ ,01)))" "(-(*), +1(* ))" "(- `,@'(1))" "`,@`(-1)" "(`'`-1 1)" "`,@(list `,@`(-1))"
       ))

#|
(let ((chars (vector #\/ #\. #\0 #\1 #\- #\, #\( #\) #\' #\@ #\` #\space))
      (size 14))
  (let ((str (make-string size))
	(clen (length chars)))
    (do ((i 0 (+ i 1)))
	((= i 10000000))
      (let ((parens 0))
	(do ((k 0 (+ k 1)))
	    ((= k size))
	  (set! (str k) (chars (random clen)))
	  (if (char=? (str k) #\()
	      (set! parens (+ parens 1))
	      (if (char=? (str k) #\))
		  (begin
		    (set! parens (- parens 1))
		    (if (negative? parens)
			(begin
			  (set! (str k) #\space)
			  (set! parens 0)))))))
	(let ((str1 str)
	      (happy (char=? (str (- size 1)) #\))))
	  (if (> parens 0)
	      (begin
		(set! str1 (make-string (+ size parens) #\)))
		(set! happy #t)
		(do ((k 0 (+ k 1)))
		    ((= k size))
		  (set! (str1 k) (str k)))))
	  (if (and happy
		   (not (char=? (str1 1) #\))))
	      (catch #t 
		     (lambda ()
		       (let ((num (eval-string str1)))
			 (if (and (number? num)
				  (eqv? num -1))
			     (format *stderr* "~S ~%" str1))))
		     (lambda args
		       'error))))))))
|#

(test (= 1 '+1 `+1 '`1 `01 ``1) #t)
(test (''- 1) '-)
(test (`'- 1) '-)
(test (``- 1) '-)
(test ('`- 1) '-)
(test (''1 '1) 1)
(test ((quote (quote 1)) 1) 1) ; (quote (quote 1)) -> ''1 = (list 'quote 1), so ((list 'quote 1) 1) is 1!
(test (list 'quote 1) ''1) ; guile says #t
(test (list-ref ''1 1) 1)  ; same
(test (''1 ```1) 1)
(test (cond `'1) 1)
(test ```1 1)
(test ('''1 1 1) 1)
(test (`',1 1) 1)
(test (- `,-1) 1)
;;; some weirder cases...
(test (begin . `''1) ''1)
					;(test (`,@''1) 1) 
					;  (syntax-error ("attempt to apply the ~A ~S to ~S?" "symbol" quote (1))) ??
					;  ((apply-values ''values 1)) got error but expected 1
					;(test (`,@ `'1) 1)
					;  ((apply-values ''values 1)) got error but expected 1
					;(test (`,@''.'.) '.'.)
					;  ((apply-values ''values .'.)) got error but expected .'.
(test (apply . `''1) 'error) ; '(quote quote 1)) ; (apply list-values 'quote (list-values 'quote 1)) -> ;quote: too many arguments '1
(test (apply - 1( )) -1)               ; (apply - 1 ())
(num-test (apply - 1.()) -1.0)
(num-test (apply - .1()) -0.1)
(num-test (apply - .1 .(())) -0.1)
(num-test (apply - .1 .('(1))) -0.9)
(test (apply - -1()) 1)                ; (apply - -1 ())
(test (apply . `(())) ())             ; (apply list-values ())
(test (apply . ''(1)) 1)               ; (apply quote '(1))
(test (apply . '`(1)) 1)               ; (apply quote (list-values 1))
(test (apply . `(,())) ())            ; (apply list-values ())
(test (apply . `('())) ''())           ; (apply list-values (list-values 'quote ()))
(test (apply . `(`())) ())            ; (apply list-values ())
(test (apply - `,1()) -1)              ; (apply - 1 ())
(test (apply - ``1()) -1)              ; (apply - 1 ())
(test (apply ''1 1()) 1)               ; (apply ''1 1 ())
(test (apply .(- 1())) -1)             ; (apply - 1 ())
(test (apply - .(1())) -1)             ; (apply - 1 ())
(test (apply . `(1())) '(1))           ; (apply list-values 1 ())
(test (apply . ''(())) ())
(test (apply . `((()))) '(()))

;;; comp.lang.lisp (test (with-input-from-string "(a `(aaa ,(/ 0.9)))" read) '(a (list-values 'aaa (/ 0.9))))

;; make sure the macro funcs really are constants
(test (defined? 'list-values) #t)
(test (let () (set! list-values 2)) 'error)
(test (let ((list-values 2)) list-values) 'error)
(test (defined? 'apply-values) #t)
(test (let () (set! apply-values 2)) 'error)
(test (let ((apply-values 2)) apply-values) 'error)
;(test (defined? 'append) #t)
;(test (let () (set! append 2)) 'error)
;(test (let ((append 2)) append) 'error)
(test (list-values 1 2 (apply-values) 3) '(1 2 3))
(let ()
  (define (consume f . args) (apply f (apply list-values args)))
  (define (supply . args) (apply-values args))
  (test (consume + (supply)) 0)
  (test (consume + (supply 1 2) (supply 3 4 5) (supply)) 15)
  (test (consume + (supply 1 2) (supply) (supply 3 4 5)) 15))

(test (object->string (list 'quote 1 2)) "(quote 1 2)")
(test (object->string (list 'quote 'quote 1)) "(quote quote 1)")
(test (object->string (list 'quote 1 2 3)) "(quote 1 2 3)")
(test (object->string (list 'quote 1)) "'1") ; confusing but this is (quote 1)
(test (equal? (quote 1) '1) #t)
(test (equal? (list 'quote 1) ''1) #t)
(test (equal? (list 'quote 1) '''1) #f)
;;; see comment s7.c in list_to_c_string -- we're following Clisp here
(test (object->string (cons 'quote 1)) "(quote . 1)")
(test (object->string (list 'quote)) "(quote)")
(let ((lst (list 'quote 1)))
  (set! (cdr (cdr lst)) lst)
  (test (object->string lst) "#1=(quote 1 . #1#)"))
(let ((lst (list 'quote)))
  (set! (cdr lst) lst)
  (test (object->string lst) "#1=(quote . #1#)"))
(test (object->string quasiquote) "quasiquote")

;; from Guile mailing list -- just a bit strange, even confuses emacs!
(if (not with-windows)
    (test (let ((v '(\()))) ; i.e. '( (symbol "\\") ())
	    (and (pair? v)
		 (symbol? (car v)) ; \ -> (symbol "\\")
		 (null? (cadr v)))) #t))

(test #(,1) #(1))
(test #(,,,1) #(1))
(test #(`'`1) #(''1))
(test (',- 1) '-) ; this is implicit indexing

#|
(',,= 1) -> (unquote =)
(test (equal? (car (',,= 1)) 'unquote) #t) ; but that's kinda horrible

(',@1 1) -> (apply-values 1)
#(,@1) -> #((unquote (apply-values 1)))
(quasiquote #(,@(list 1 2 3))) -> #((unquote (apply-values (list 1 2 3))))

(quote ,@(for-each)) -> (unquote (apply-values (for-each)))
;;; when is (quote ...) not '...?
|#

(test (quasiquote) 'error)
(test (quasiquote 1 2 3) 'error)
(let ((d 1)) (test (quasiquote (a b c ,d)) '(a b c 1)))
(test (let ((a 2)) (quasiquote (a ,a))) (let ((a 2)) `(a ,a)))
(test (quasiquote 4) 4)
(if (not (provided? 'immutable-unquote)) (test (quasiquote (list (unquote (+ 1 2)) 4)) '(list 3 4)))
(test (quasiquote (1 2 3)) '(1 2 3))
(test (quasiquote ()) ())
(test (quasiquote (list ,(+ 1 2) 4))  '(list 3 4))
(test (quasiquote (1 ,@(list 1 2) 4)) '(1 1 2 4))
(test (quasiquote (a ,(+ 1 2) ,@(map abs '(4 -5 6)) b)) '(a 3 4 5 6 b))
(test (quasiquote (1 2 ,(* 9 9) 3 4)) '(1 2 81 3 4))
(test (quasiquote (1 ,(+ 1 1) 3)) '(1 2 3))                     
(test (quasiquote (,(+ 1 2))) '(3))
(test (quasiquote (,@'() . foo)) 'foo)
(test (quasiquote (1 , 2)) '(1 2))
(test (quasiquote (,1 ,1)) '(1 1))
(test (quasiquote (,1 ,(quasiquote ,1))) '(1 1))
(test (quasiquote (,1 ,(quasiquote ,@(list 1)))) '(1 1))
(test (quasiquote (,1 ,(quasiquote ,(quasiquote ,1)))) '(1 1))
(test (quasiquote (,1 ,(quasiquote ,@'(1)))) '(1 1))
(test (quasiquote (,1 ,(quasiquote ,@(quasiquote (1))))) '(1 1))
(test (quasiquote (,1 ,(quasiquote ,@(quasiquote (,1))))) '(1 1))
(test (quasiquote (,1 ,@(quasiquote ,@(list (list 1))))) '(1 1))
(test `(+ ,(apply values '(1 2))) '(+ 1 2))
(if (not (provided? 'immutable-unquote)) (test `(apply + (unquote '(1 2))) '(apply + (1 2))))
(test (eval (list (list quasiquote +) -1)) -1)

(test (apply quasiquote '((1 2 3))) '(1 2 3))
(test (quasiquote (',,= 1)) 'error)
(test (quasiquote (',,@(1 2) 1)) 'error)
(test (quasiquote 1.1 . -0) 'error)

(test `(1 ,@2) 'error)
(test `(1 ,@(2 . 3)) 'error)
(test `(1 ,@(2 3)) 'error)
(test `(1 , @ (list 2 3)) 'error) ; unbound @ ! (guile also)

(test (call-with-exit quasiquote) 'error)
(test (call-with-output-string quasiquote) "")
(test (map quasiquote '(1 2 3)) '(1 2 3)) ; changed 12-May-14
(test (for-each quasiquote '(1 2 3)) #<unspecified>)
(test (sort! '(1 2 3) quasiquote) 'error)
(test (quasiquote . 1) 'error)
(test (let ((x 3)) (quasiquote . x)) 'error)
(num-test `,,,-1 -1)
(num-test `,``,1 1)
(test (equal? ` 1 ' 1) #t)
(test (+ ` 1 `  2) `   3)
(test ` ( + ,(- 3 2) 2) '(+ 1 2))
(test (quasiquote #(1)) `#(1))

(test `(+ ,@(map sqrt '(1 4 9)) 2) '(+ 1 2 3 2))
(test `(+ ,(sqrt 9) 4) '(+ 3 4))
(test `(+ ,(apply values (map sqrt '(1 4 9))) 2) '(+ 1 2 3 2))

;; here is the difference between ,@ and apply values:
(test (let ((x ())) `(+ ,@x)) '(+))
(test (let ((x ())) (+ (apply values x))) 'error) ; ;+ argument, #<unspecified>, is untyped 
(test (let ((x ())) (list + (apply values x))) (list + (values)))

;; (apply + (list-values (apply-values ()))) -> 0 -- this is a special quasiquote list handling of ,@ that
;;   is not the same as (apply + (list-values (apply values ()))) -> error. quasiquote turns list into list-values
;;   and list-values treats (apply values...) specially. Maybe s7 should be less timid about (values).  I used to
;;   think (abs -1 (values)) had to be an error, but now it looks fine.
;;
;;   (let ((x ())) `(+ ,@x)) -> (+) 
;;        via (+ (unquote (apply-values x))) -> (list-values '+ (apply-values x))
;;
;;   (let ((x ())) (list + (apply values x))) -> (+ #<unspecified>)
;;        via (+ (apply values (unquote x))) -> (list-values '+ (list-values 'apply 'values x))
;; because (values) -> #<unspecified> but everywhere else ,@x is the same as (apply values x)
	    




;;; --------------------------------------------------------------------------------
;;; keywords
;;; --------------------------------------------------------------------------------

;;; keyword?
;;; string->keyword
;;; keyword->symbol
;;; symbol->keyword

(for-each
 (lambda (arg)
   (test (keyword? arg) #f))
 (list "hi" -1 #\a 1 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #t #f () #(()) (list 1 2 3) '(1 . 2)))

(test (cond ((cond (())) ':)) ':)
(test (keyword? :#t) #t)
(test (eq? #t :#t) #f)
;(test (keyword? '#:t) #f)  ; these 2 are fooled by the Guile-related #: business (which is still supported)
;(test (keyword? '#:#t) #f)
;#:1.0e8 is also a keyword(!) 
;#:# is also, so #:#() is interpreted as #:# ()

(test (keyword? :-1) #t)
(test (keyword? :0/0) #t)
(test (keyword? :1+i) #t)
(test (keyword? :1) #t)
(test (keyword? 0/0:) #t)
(test (keyword? 1+i:) #t)
(test (keyword? 1:) #t)
;;; bizarre...

(test (keyword? (symbol ":#(1 #\\a (3))")) #t)
(test (keyword? (string->keyword (object->string #(1 #\a (3)) #f))) #t)
(test (keyword? begin) #f)
(test (keyword? if) #f)

(let ((kw (string->keyword "hiho")))
  (test (keyword? kw) #t)
  (test (keyword->symbol kw) 'hiho)
  (test (symbol->keyword 'hiho) kw)
  (test (keyword->symbol (symbol->keyword 'key)) 'key)
  (test (symbol->keyword (keyword->symbol (string->keyword "hi"))) :hi)
  (test (keyword? :a-key) #t)
  (test (keyword? ':a-key) #t)
  (test (keyword? ':a-key:) #t)
  (test (keyword? 'a-key:) #t)
  (test (symbol? (keyword->symbol :hi)) #t)
  (test (keyword? (keyword->symbol :hi)) #f)
  (test (symbol? (symbol->keyword 'hi)) #t)
  (test (equal? kw :hiho) #t)
  (test ((lambda (arg) (keyword? arg)) :hiho) #t)
  (test ((lambda (arg) (keyword? arg)) 'hiho) #f)
  (test ((lambda (arg) (keyword? arg)) kw) #t)
  (test ((lambda (arg) (keyword? arg)) (symbol->keyword 'hiho)) #t)
  (test (string->keyword "3") :3)
  (test (keyword? :3) #t)
  (test (keyword? ':3) #t)
  (test (eq? (keyword->symbol :hi) (keyword->symbol hi:)) #t)
  (test (equal? :3 3) #f)
  (test (equal? (keyword->symbol :3) 3) #f)
  (test (equal? (symbol->value (keyword->symbol :3)) 3) #f) ; 3 as a symbol has value #<undefined>

 (test (keyword? (keyword->symbol :n:)) #t)
 (test (keyword? (keyword->symbol (keyword->symbol :n:))) #f)
 (test (symbol->keyword n:) :n:)

#|
  (let ()
    (apply define (symbol "3") '(32))
    (test (symbol->value (symbol "3")) 32) ; hmmm
    (apply define (list (symbol "3") (lambda () 32)))
    (test (symbol->value (symbol "3")) 32)
    (apply define (symbol ".") '(123))
    (test (+ (symbol->value (symbol ".")) 321) 444))
|#

  (test (keyword? '3) #f)
  (test (keyword? ':) #f)
  (test (keyword? '::) #t)
  (test (keyword? ::) #t)
  (test (keyword? ::a) #t)
  (test (eq? ::a ::a) #t)
  (test (eq? (keyword->symbol ::a) :a) #t)
  (test (eq? (symbol->keyword :a) ::a) #t) ; ?? -- :a is already a keyword
  (test (symbol->string ::a) "::a")
  (test ((lambda* (:a 32) ::a) 0) 'error) ; :a is a constant
  (test (eq? :::a::: :::a:::) #t)
  (test (keyword? a::) #t)
  (test (keyword->symbol ::) ':)
  (test (symbol->string (keyword->symbol hi:)) "hi")
  (test (symbol->string (keyword->symbol :hi)) "hi")
  (test (keyword? (string->keyword (string #\x (integer->char 128) #\x))) #t)
  (test (keyword? (string->keyword (string #\x (integer->char 200) #\x))) #t)
  (test (keyword? (string->keyword (string #\x (integer->char 255) #\x))) #t)
  (test (string->keyword ":") ::)
  (test (string->keyword (string #\")) (symbol ":\""))
  (test (keyword? (string->keyword (string #\"))) #t)
  (test (keyword->symbol (string->keyword (string #\"))) (symbol "\""))
  )

(test (string->keyword "a b") (symbol ":a b"))
(test (keyword? (symbol ":a b")) #t)
(test (symbol->keyword 'begin) :begin)
(test (symbol->keyword 'quote) :quote)
(test (symbol->keyword if) 'error)
(test (symbol->keyword quote) 'error)
(test (symbol->keyword :a) ::a)
(test (keyword->symbol ::a) :a)
(test (symbol->keyword (symbol "(a)")) (symbol ":(a)"))
(test (keyword? (symbol ":(a)")) #t)
(test (keyword? :|) #t)
(test (keyword? :,) #t)
(when full-test
  (do ((i 1 (+ i 1)))  ; not #\null -- : by itself is not a keyword in s7
      ((= i 128))  
    (if (not (keyword? (string->keyword (string (integer->char i))))) 
	(format *stderr* "not key: :~A~%" (integer->char i)))
    (if (not (keyword? (symbol (string #\: (integer->char i)))))
	(format *stderr* "not key: (symbol \":~A\")~%" (integer->char i)))
    (if (not (keyword? (symbol (string (integer->char i) #\:))))
	(format *stderr* "not key: (symbol \"~A:\")~%" (integer->char i)))))

(test (let ((:hi 3)) :hi) 'error)
(test (set! :hi 2) 'error)
(test (define :hi 3) 'error)

(let ((strlen 8))
  (let ((str (make-string strlen)))
    (do ((i 0 (+ i 1)))
	((= i 10))
      (do ((k 0 (+ k 1)))
	  ((= k strlen))
	(set! (str k) (integer->char (+ 1 (random 255)))))
      (let ((key (string->keyword str)))
	(let ((newstr (symbol->string (keyword->symbol key))))
	  (if (not (string=? newstr str))
	      (format #t ";string->keyword -> string: ~S -> ~A -> ~S~%" str key newstr)))))))

(let ()
  (define* (hi a b) (+ a b))
  (test (hi 1 2) 3)
  (test (hi :b 3 :a 1) 4)
  (test (hi b: 3 a: 1) 4))

(for-each
 (lambda (arg)
   (test (string->keyword arg) 'error))
 (list -1 #\a 1 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #t #f () #(()) (list 1 2 3) '(1 . 2)))

(for-each
 (lambda (arg)
   (test (keyword->symbol arg) 'error))
 (list "hi" -1 #\a 1 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #t #f () #(()) (list 1 2 3) '(1 . 2)))

(for-each
 (lambda (arg)
   (test (symbol->keyword arg) 'error))
 (list "hi" -1 #\a 1 #(1 2 3) 3.14 3/4 1.0+1.0i #t #f () #(()) (list 1 2 3) '(1 . 2)))

(test (keyword?) 'error)
(test (keyword? 1 2) 'error)
(test (string->keyword) 'error)
(test (string->keyword 'hi 'ho) 'error)
(test (keyword->symbol) 'error)
(test (keyword->symbol :hi :ho) 'error)
(test (symbol->keyword) 'error)
(test (symbol->keyword 'hi 'ho) 'error)



;;; --------------------------------------------------------------------------------
;;; gensym
(for-each
 (lambda (arg)
   (test (gensym arg) 'error))
 (list -1 #\a 1 'hi _ht_ _undef_ _null_ _c_obj_ #(1 2 3) 3.14 3/4 1.0+1.0i #t #f () #(()) (list 1 2 3) '(1 . 2)))

(test (gensym "hi" "ho") 'error)

(test (symbol? (gensym)) #t)
(test (symbol? (gensym "temp")) #t)
(test (eq? (gensym) (gensym)) #f)
(test (eqv? (gensym) (gensym)) #f)
(test (equal? (gensym) (gensym)) #f)
(test (keyword? (gensym)) #f)
(test (let* ((a (gensym)) (b a)) (eq? a b)) #t)
(test (let* ((a (gensym)) (b a)) (eqv? a b)) #t)
(test (keyword? (symbol->keyword (gensym))) #t)
(test (let ((g (gensym))) (set! g 12) g) 12)
(test (string->byte-vector (substring (symbol->string (gensym #u8(124 255 127))) 0 5)) #u8(123 124 255 127 125))
(test (string->byte-vector (substring (symbol->string (gensym #u8(124 0 127))) 0 3))   #u8(123 124         125)) ; nul->end of symbol string

(let ((sym (gensym)))
  (test (eval `(let ((,sym 32)) (+ ,sym 1))) 33))

(let ((sym1 (gensym))
      (sym2 (gensym)))
  (test (eval `(let ((,sym1 32) (,sym2 1)) (+ ,sym1 ,sym2))) 33))
(test (eval (let ((var (gensym "a b c"))) `(let ((,var 2)) (+ ,var 1)))) 3)
(test (eval (let ((var (gensym ""))) `(let ((,var 2)) (+ ,var 1)))) 3)
(test (eval (let ((var (gensym "."))) `(let ((,var 2)) (+ ,var 1)))) 3)
(test (eval (let ((var (gensym "{"))) `(let ((,var 2)) (+ ,var 1)))) 3)
(test (eval (let ((var (gensym "}"))) `(let ((,var 2)) (+ ,var 1)))) 3)
(test (eval (let ((var (gensym (string #\newline)))) `(let ((,var 2)) (+ ,var 1)))) 3)

(test (let ((hi (gensym))) (eq? hi (string->symbol (symbol->string hi)))) #t)
(test (let () (define-macro (hi a) (let ((var (gensym ";"))) `(let ((,var ,a)) (+ 1 ,var)))) (hi 1)) 2)
(test (let () (define-macro (hi a) (let ((funny-name (string->symbol (string #\;)))) `(let ((,funny-name ,a)) (+ 1 ,funny-name)))) (hi 1)) 2)
(test (let () (define-macro (hi a) (let ((funny-name (string->symbol "| e t c |"))) `(let ((,funny-name ,a)) (+ 1 ,funny-name)))) (hi 2)) 3)

(let ((funny-name (string->symbol "| e t c |")))
  (define-macro (hi a) 
    `(define* (,a (,funny-name 32)) (+ ,funny-name 1)))
  (hi func)
  (test (func) 33)
  (test (func 1) 2)
  ;(procedure-source func) '(lambda* ((| e t c | 32)) (+ | e t c | 1))
  (test (apply func (list (symbol->keyword funny-name) 2)) 3)
  )

(let ((funny-name (string->symbol "| e t c |")))
  (apply define* `((func (,funny-name 32)) (+ ,funny-name 1)))
  (test (apply func (list (symbol->keyword funny-name) 2)) 3))


;;; gensym?

(for-each
 (lambda (arg)
   (test (gensym? arg) #f))
 (list -1 #\a 1 #(1 2 3) 3.14 3/4 1.0+1.0i () car abs (lambda () 1) #2d((1 2) (3 4)) _ht_ _undef_ _null_ _c_obj_ #f 'hi #(()) (list 1 2 3) '(1 . 2) "hi"))
(test (gensym?) 'error)
(let ((g (gensym)))
  (test (gensym? g) #t)
  (test (gensym? g g) 'error))



;;; --------------------------------------------------------------------------------
;;; provided?
;;; provide
;;; require

(test (provided?) 'error)
(test (or (null? *features*) (pair? *features*)) #t)
(test (provided? 1 2 3) 'error)
(provide 's7test)
(test (provided? 's7test) #t)
(test (provided? 'not-provided!) #f)
(test (provided? 'begin) #f)
(test (provided? if) 'error)
(test (provided? quote) 'error)

(test (provide quote) 'error)
(test (provide 1 2 3) 'error)
(test (provide) 'error)
(test (provide lambda) 'error)

(test (require) 'error)
(test (require 1) 'error)
(test (require _asdf_) 'error)

(provide 's7test) ; should be a no-op??
(let ((count 0))
  (for-each
   (lambda (p)
     (if (eq? p 's7test)
	 (set! count (+ count 1)))
     (if (not (provided? p))
	 (format #t ";~A is in *features* but not provided? ~A~%" p *features*)))
   *features*)
  (if (not (= count 1))
      (format #t ";*features* has ~D 's7test entries? ~A~%" count *features*)))

(test (let ((*features* 123)) (provided? 's7)) #t)

(for-each
 (lambda (arg)
   (test (provide arg) 'error))
 (list -1 #\a 1 #(1 2 3) 3.14 3/4 1.0+1.0i #t #f () #(()) (list 1 2 3) '(1 . 2)))

(for-each
 (lambda (arg)
   (test (provided? arg) 'error))
 (list -1 #\a 1 #(1 2 3) 3.14 3/4 1.0+1.0i #t #f () #(()) (list 1 2 3) '(1 . 2)))

(for-each
 (lambda (arg)
   (test (set! (*s7* 'gc-stats) arg) 'error))
 (list #\a #(1 2 3) 3.14 3/4 1.0+1.0i () #(()) (list 1 2 3) '(1 . 2)))
(test (*s7* 'gc-stats) 0)

(let ((f (sort! (copy *features*) (lambda (a b) (string<? (object->string a #f) (object->string b #f))))))
  (let ((last 'not-in-*features*))
    (for-each
     (lambda (p)
       (if (eq? p last)
	   (format #t ";*features has multiple ~A? ~A~%" p *features*))
       (set! last p))
     f)))

(let ()
  (provide 'locals)
  (test (provided? 'locals) #t)
  (test (defined? 'locals) #t))
(test (provided? 'locals) #f)
(test (defined? 'locals) #f)

(let ()
  (require stuff.scm)
  (test (provided? 'stuff.scm) #t))
(test (provided? 'stuff.scm) #f)

(let ()
  (provide 'local-stuff)
  (call-with-output-file tmp-output-file
    (lambda (p)
      (format p "(provide 'tmp-output)~%(define (tmp-output-func a) a)~%")))
  (load tmp-output-file)
  (test (provided? 'tmp-output) #t))
(test (provided? 'local-stuff) #f)
(test (provided? 'tmp-output) #t)

(for-each
 (lambda (arg)
   (test (set! (*s7* 'safety) arg) 'error)
   (test (set! *features* arg) 'error)
   (test (set! *load-path* arg) 'error)
   (test (set! *#readers* arg) 'error))
 (list #\a #(1 2 3) 3.14 3/4 1.0+1.0i abs 'hi #t #f #(())))
;(test (let ((*features* 123)) *features*) 'error)
;(test (let (((*s7* 'safety) '(1 2 3))) (*s7* 'safety)) 'error)
;(test (let (((*s7* 'safety) 1)) 2) 'error)
(test (set! *load-path* (list 1 2 3)) 'error)
(set! *#readers* old-readers)

(define old-safety (*s7* 'safety))
(set! (*s7* 'safety) 2)

  (let ((v #(1 2 3))
	(iv #i(1 2 3))
	(rv #r(1.0 2.0 3.0))
	(str "123")
	(pair '(1 2 3)))
    (test (sort! v <) 'error)
    (test (sort! iv <) 'error)
    (test (sort! rv <) 'error)
    (test (sort! str char<?) 'error)
    (test (sort! pair <) 'error)
    (test (reverse! v) 'error)
    (test (reverse! iv) 'error)
    (test (reverse! rv) 'error)
    (test (reverse! str) 'error)
    (test (reverse! pair) 'error)
    (test (fill! v 0) 'error)
    (test (fill! iv 0) 'error)
    (test (fill! rv 0.0) 'error)
    (test (fill! str #\a) 'error)
    (test (fill! pair 0) 'error))

(set! (*s7* 'safety) old-safety)

;;; (*s7* 'print-length)

(test (integer? (*s7* 'print-length)) #t)
(test (or (null? *#readers*) (pair? *#readers*)) #t)
(test (or (null? *load-path*) (pair? *load-path*)) #t)

(let-temporarily (((*s7* 'print-length) 32))
  (for-each
   (lambda (arg)
     (test (set! (*s7* 'print-length) arg) 'error))
   (list -1 #\a #(1 2 3) 3.14 3/4 1.0+1.0i abs 'hi () #t #f #(()) (list 1 2 3) '(1 . 2))))

(let-temporarily (((*s7* 'print-length) 0))
  (test (format #f "~A" #()) "#()")
  (test (format #f "~A" #(1 2 3 4)) "#(...)")
  (set! (*s7* 'print-length) 1)
  (test (format #f "~A" #()) "#()")
  (test (format #f "~A" #(1)) "#(1)")
  (test (format #f "~A" #(1 2 3 4)) "#(1 ...)")
  (set! (*s7* 'print-length) 2)
  (test (format #f "~A" #(1 2 3 4)) "#(1 2 ...)"))

(when with-bignums
  (let-temporarily (((*s7* 'print-length) (bignum "0")))
    (test (format #f "~A" #()) "#()")
    (test (format #f "~A" #(1 2 3 4)) "#(1 ...)")
    (set! (*s7* 'print-length) (bignum "1"))
    (test (format #f "~A" #()) "#()")
    (test (format #f "~A" #(1)) "#(1)")
    (test (format #f "~A" #(1 2 3 4)) "#(1 ...)")
    (set! (*s7* 'print-length) (bignum "2"))
    (test (format #f "~A" #(1 2 3 4)) "#(1 ...)")))

(test (set! (*s7* 'safety) -1) 'error)
(test (set! (*s7* 'safety) 5) 'error)


;;; --------------------------------------------------------------------------------
;;; sort!

(test (sort! '(2 3) <) '(2 3))
(test (sort! '(3 2) <) '(2 3))
(test (sort! '(12 3) <) '(3 12))

(test (sort! '(1 2 3) <) '(1 2 3))
(test (sort! '(1 3 2) <) '(1 2 3))
(test (sort! '(2 1 3) <) '(1 2 3))
(test (sort! '(2 3 1) <) '(1 2 3))
(test (sort! '(3 1 2) <) '(1 2 3))
(test (sort! '(3 2 1) <) '(1 2 3))

(test (sort! '(1 2 3) (lambda (a b) (> a b))) '(3 2 1))
(test (sort! #(2 3) <) #(2 3))
(test (sort! #(12 3) <) #(3 12))

(test (sort! #(1 2 3) <) #(1 2 3))
(test (sort! #(1 3 2) <) #(1 2 3))
(test (sort! #(2 1 3) <) #(1 2 3))
(test (sort! #(2 3 1) <) #(1 2 3))
(test (sort! #(3 1 2) <) #(1 2 3))
(test (sort! #(3 2 1) <) #(1 2 3))

(test (sort! #(1 2 3 4) <) #(1 2 3 4))
(test (sort! #(1 2 4 3) <) #(1 2 3 4))
(test (sort! #(1 3 2 4) <) #(1 2 3 4))
(test (sort! #(1 3 4 2) <) #(1 2 3 4))
(test (sort! #(1 4 2 3) <) #(1 2 3 4))
(test (sort! #(1 4 3 2) <) #(1 2 3 4))
(test (sort! #(2 1 3 4) <) #(1 2 3 4))
(test (sort! #(2 1 4 3) <) #(1 2 3 4))
(test (sort! #(2 3 4 1) <) #(1 2 3 4))
(test (sort! #(2 3 1 4) <) #(1 2 3 4))
(test (sort! #(2 4 3 1) <) #(1 2 3 4))
(test (sort! #(2 4 1 3) <) #(1 2 3 4))
(test (sort! #(3 1 2 4) <) #(1 2 3 4))
(test (sort! #(3 1 4 2) <) #(1 2 3 4))
(test (sort! #(3 2 4 1) <) #(1 2 3 4))
(test (sort! #(3 2 1 4) <) #(1 2 3 4))
(test (sort! #(3 4 1 2) <) #(1 2 3 4))
(test (sort! #(3 4 2 1) <) #(1 2 3 4))
(test (sort! #(4 1 2 3) <) #(1 2 3 4))
(test (sort! #(4 1 3 2) <) #(1 2 3 4))
(test (sort! #(4 2 1 3) <) #(1 2 3 4))
(test (sort! #(4 2 3 1) <) #(1 2 3 4))
(test (sort! #(4 3 2 1) <) #(1 2 3 4))
(test (sort! #(4 3 1 2) <) #(1 2 3 4))

(let ((f (lambda (a b) 
	   (< (car a) (car b)))))
  (test (sort! (list (cons 1 "1") (cons 2 "2") (cons 3 "3") (cons 4 "4")) f) (list (cons 1 "1") (cons 2 "2") (cons 3 "3") (cons 4 "4")))
  (test (sort! (list (cons 1 "1") (cons 2 "2") (cons 4 "4") (cons 3 "3")) f) (list (cons 1 "1") (cons 2 "2") (cons 3 "3") (cons 4 "4")))
  (test (sort! (list (cons 1 "1") (cons 3 "3") (cons 2 "2") (cons 4 "4")) f) (list (cons 1 "1") (cons 2 "2") (cons 3 "3") (cons 4 "4")))
  (test (sort! (list (cons 1 "1") (cons 3 "3") (cons 4 "4") (cons 2 "2")) f) (list (cons 1 "1") (cons 2 "2") (cons 3 "3") (cons 4 "4")))
  (test (sort! (list (cons 1 "1") (cons 4 "4") (cons 2 "2") (cons 3 "3")) f) (list (cons 1 "1") (cons 2 "2") (cons 3 "3") (cons 4 "4")))
  (test (sort! (list (cons 1 "1") (cons 4 "4") (cons 3 "3") (cons 2 "2")) f) (list (cons 1 "1") (cons 2 "2") (cons 3 "3") (cons 4 "4")))
  (test (sort! (list (cons 2 "2") (cons 1 "1") (cons 3 "3") (cons 4 "4")) f) (list (cons 1 "1") (cons 2 "2") (cons 3 "3") (cons 4 "4")))
  (test (sort! (list (cons 2 "2") (cons 1 "1") (cons 4 "4") (cons 3 "3")) f) (list (cons 1 "1") (cons 2 "2") (cons 3 "3") (cons 4 "4")))
  (test (sort! (list (cons 2 "2") (cons 3 "3") (cons 4 "4") (cons 1 "1")) f) (list (cons 1 "1") (cons 2 "2") (cons 3 "3") (cons 4 "4")))
  (test (sort! (list (cons 2 "2") (cons 3 "3") (cons 1 "1") (cons 4 "4")) f) (list (cons 1 "1") (cons 2 "2") (cons 3 "3") (cons 4 "4")))
  (test (sort! (list (cons 2 "2") (cons 4 "4") (cons 3 "3") (cons 1 "1")) f) (list (cons 1 "1") (cons 2 "2") (cons 3 "3") (cons 4 "4")))
  (test (sort! (list (cons 2 "2") (cons 4 "4") (cons 1 "1") (cons 3 "3")) f) (list (cons 1 "1") (cons 2 "2") (cons 3 "3") (cons 4 "4")))
  (test (sort! (list (cons 3 "3") (cons 1 "1") (cons 2 "2") (cons 4 "4")) f) (list (cons 1 "1") (cons 2 "2") (cons 3 "3") (cons 4 "4")))
  (test (sort! (list (cons 3 "3") (cons 1 "1") (cons 4 "4") (cons 2 "2")) f) (list (cons 1 "1") (cons 2 "2") (cons 3 "3") (cons 4 "4")))
  (test (sort! (list (cons 3 "3") (cons 2 "2") (cons 4 "4") (cons 1 "1")) f) (list (cons 1 "1") (cons 2 "2") (cons 3 "3") (cons 4 "4")))
  (test (sort! (list (cons 3 "3") (cons 2 "2") (cons 1 "1") (cons 4 "4")) f) (list (cons 1 "1") (cons 2 "2") (cons 3 "3") (cons 4 "4")))
  (test (sort! (list (cons 3 "3") (cons 4 "4") (cons 1 "1") (cons 2 "2")) f) (list (cons 1 "1") (cons 2 "2") (cons 3 "3") (cons 4 "4")))
  (test (sort! (list (cons 3 "3") (cons 4 "4") (cons 2 "2") (cons 1 "1")) f) (list (cons 1 "1") (cons 2 "2") (cons 3 "3") (cons 4 "4")))
  (test (sort! (list (cons 4 "4") (cons 1 "1") (cons 2 "2") (cons 3 "3")) f) (list (cons 1 "1") (cons 2 "2") (cons 3 "3") (cons 4 "4")))
  (test (sort! (list (cons 4 "4") (cons 1 "1") (cons 3 "3") (cons 2 "2")) f) (list (cons 1 "1") (cons 2 "2") (cons 3 "3") (cons 4 "4")))
  (test (sort! (list (cons 4 "4") (cons 2 "2") (cons 1 "1") (cons 3 "3")) f) (list (cons 1 "1") (cons 2 "2") (cons 3 "3") (cons 4 "4")))
  (test (sort! (list (cons 4 "4") (cons 2 "2") (cons 3 "3") (cons 1 "1")) f) (list (cons 1 "1") (cons 2 "2") (cons 3 "3") (cons 4 "4")))
  (test (sort! (list (cons 4 "4") (cons 3 "3") (cons 2 "2") (cons 1 "1")) f) (list (cons 1 "1") (cons 2 "2") (cons 3 "3") (cons 4 "4")))
  (test (sort! (list (cons 4 "4") (cons 3 "3") (cons 1 "1") (cons 2 "2")) f) (list (cons 1 "1") (cons 2 "2") (cons 3 "3") (cons 4 "4"))))

(test (sort! #(5 1 2 3 4) <) #(1 2 3 4 5))
(test (sort! #(5 1 2 4 3) <) #(1 2 3 4 5))
(test (sort! #(5 1 3 2 4) <) #(1 2 3 4 5))
(test (sort! #(5 1 3 4 2) <) #(1 2 3 4 5))
(test (sort! #(5 1 4 2 3) <) #(1 2 3 4 5))
(test (sort! #(5 1 4 3 2) <) #(1 2 3 4 5))
(test (sort! #(5 2 1 3 4) <) #(1 2 3 4 5))
(test (sort! #(5 2 1 4 3) <) #(1 2 3 4 5))
(test (sort! #(5 2 3 4 1) <) #(1 2 3 4 5))
(test (sort! #(5 2 3 1 4) <) #(1 2 3 4 5))
(test (sort! #(5 2 4 3 1) <) #(1 2 3 4 5))
(test (sort! #(5 2 4 1 3) <) #(1 2 3 4 5))
(test (sort! #(5 3 1 2 4) <) #(1 2 3 4 5))
(test (sort! #(5 3 1 4 2) <) #(1 2 3 4 5))
(test (sort! #(5 3 2 4 1) <) #(1 2 3 4 5))
(test (sort! #(5 3 2 1 4) <) #(1 2 3 4 5))
(test (sort! #(5 3 4 1 2) <) #(1 2 3 4 5))
(test (sort! #(5 3 4 2 1) <) #(1 2 3 4 5))
(test (sort! #(5 4 1 2 3) <) #(1 2 3 4 5))
(test (sort! #(5 4 1 3 2) <) #(1 2 3 4 5))
(test (sort! #(5 4 2 1 3) <) #(1 2 3 4 5))
(test (sort! #(5 4 2 3 1) <) #(1 2 3 4 5))
(test (sort! #(5 4 3 2 1) <) #(1 2 3 4 5))
(test (sort! #(5 4 3 1 2) <) #(1 2 3 4 5))
(test (sort! #(1 5 2 3 4) <) #(1 2 3 4 5))
(test (sort! #(1 5 2 4 3) <) #(1 2 3 4 5))
(test (sort! #(1 5 3 2 4) <) #(1 2 3 4 5))
(test (sort! #(1 5 3 4 2) <) #(1 2 3 4 5))
(test (sort! #(1 5 4 2 3) <) #(1 2 3 4 5))
(test (sort! #(1 5 4 3 2) <) #(1 2 3 4 5))
(test (sort! #(2 5 1 3 4) <) #(1 2 3 4 5))
(test (sort! #(2 5 1 4 3) <) #(1 2 3 4 5))
(test (sort! #(2 5 3 4 1) <) #(1 2 3 4 5))
(test (sort! #(2 5 3 1 4) <) #(1 2 3 4 5))
(test (sort! #(2 5 4 3 1) <) #(1 2 3 4 5))
(test (sort! #(2 5 4 1 3) <) #(1 2 3 4 5))
(test (sort! #(3 5 1 2 4) <) #(1 2 3 4 5))
(test (sort! #(3 5 1 4 2) <) #(1 2 3 4 5))
(test (sort! #(3 5 2 4 1) <) #(1 2 3 4 5))
(test (sort! #(3 5 2 1 4) <) #(1 2 3 4 5))
(test (sort! #(3 5 4 1 2) <) #(1 2 3 4 5))
(test (sort! #(3 5 4 2 1) <) #(1 2 3 4 5))
(test (sort! #(4 5 1 2 3) <) #(1 2 3 4 5))
(test (sort! #(4 5 1 3 2) <) #(1 2 3 4 5))
(test (sort! #(4 5 2 1 3) <) #(1 2 3 4 5))
(test (sort! #(4 5 2 3 1) <) #(1 2 3 4 5))
(test (sort! #(4 5 3 2 1) <) #(1 2 3 4 5))
(test (sort! #(4 5 3 1 2) <) #(1 2 3 4 5))
(test (sort! #(1 2 5 3 4) <) #(1 2 3 4 5))
(test (sort! #(1 2 5 4 3) <) #(1 2 3 4 5))
(test (sort! #(1 3 5 2 4) <) #(1 2 3 4 5))
(test (sort! #(1 3 5 4 2) <) #(1 2 3 4 5))
(test (sort! #(1 4 5 2 3) <) #(1 2 3 4 5))
(test (sort! #(1 4 5 3 2) <) #(1 2 3 4 5))
(test (sort! #(2 1 5 3 4) <) #(1 2 3 4 5))
(test (sort! #(2 1 5 4 3) <) #(1 2 3 4 5))
(test (sort! #(2 3 5 4 1) <) #(1 2 3 4 5))
(test (sort! #(2 3 5 1 4) <) #(1 2 3 4 5))
(test (sort! #(2 4 5 3 1) <) #(1 2 3 4 5))
(test (sort! #(2 4 5 1 3) <) #(1 2 3 4 5))
(test (sort! #(3 1 5 2 4) <) #(1 2 3 4 5))
(test (sort! #(3 1 5 4 2) <) #(1 2 3 4 5))
(test (sort! #(3 2 5 4 1) <) #(1 2 3 4 5))
(test (sort! #(3 2 5 1 4) <) #(1 2 3 4 5))
(test (sort! #(3 4 5 1 2) <) #(1 2 3 4 5))
(test (sort! #(3 4 5 2 1) <) #(1 2 3 4 5))
(test (sort! #(4 1 5 2 3) <) #(1 2 3 4 5))
(test (sort! #(4 1 5 3 2) <) #(1 2 3 4 5))
(test (sort! #(4 2 5 1 3) <) #(1 2 3 4 5))
(test (sort! #(4 2 5 3 1) <) #(1 2 3 4 5))
(test (sort! #(4 3 5 2 1) <) #(1 2 3 4 5))
(test (sort! #(4 3 5 1 2) <) #(1 2 3 4 5))
(test (sort! #(1 2 3 5 4) <) #(1 2 3 4 5))
(test (sort! #(1 2 4 5 3) <) #(1 2 3 4 5))
(test (sort! #(1 3 2 5 4) <) #(1 2 3 4 5))
(test (sort! #(1 3 4 5 2) <) #(1 2 3 4 5))
(test (sort! #(1 4 2 5 3) <) #(1 2 3 4 5))
(test (sort! #(1 4 3 5 2) <) #(1 2 3 4 5))
(test (sort! #(2 1 3 5 4) <) #(1 2 3 4 5))
(test (sort! #(2 1 4 5 3) <) #(1 2 3 4 5))
(test (sort! #(2 3 4 5 1) <) #(1 2 3 4 5))
(test (sort! #(2 3 1 5 4) <) #(1 2 3 4 5))
(test (sort! #(2 4 3 5 1) <) #(1 2 3 4 5))
(test (sort! #(2 4 1 5 3) <) #(1 2 3 4 5))
(test (sort! #(3 1 2 5 4) <) #(1 2 3 4 5))
(test (sort! #(3 1 4 5 2) <) #(1 2 3 4 5))
(test (sort! #(3 2 4 5 1) <) #(1 2 3 4 5))
(test (sort! #(3 2 1 5 4) <) #(1 2 3 4 5))
(test (sort! #(3 4 1 5 2) <) #(1 2 3 4 5))
(test (sort! #(3 4 2 5 1) <) #(1 2 3 4 5))
(test (sort! #(4 1 2 5 3) <) #(1 2 3 4 5))
(test (sort! #(4 1 3 5 2) <) #(1 2 3 4 5))
(test (sort! #(4 2 1 5 3) <) #(1 2 3 4 5))
(test (sort! #(4 2 3 5 1) <) #(1 2 3 4 5))
(test (sort! #(4 3 2 5 1) <) #(1 2 3 4 5))
(test (sort! #(4 3 1 5 2) <) #(1 2 3 4 5))
(test (sort! #(1 2 3 4 5) <) #(1 2 3 4 5))
(test (sort! #(1 2 4 3 5) <) #(1 2 3 4 5))
(test (sort! #(1 3 2 4 5) <) #(1 2 3 4 5))
(test (sort! #(1 3 4 2 5) <) #(1 2 3 4 5))
(test (sort! #(1 4 2 3 5) <) #(1 2 3 4 5))
(test (sort! #(1 4 3 2 5) <) #(1 2 3 4 5))
(test (sort! #(2 1 3 4 5) <) #(1 2 3 4 5))
(test (sort! #(2 1 4 3 5) <) #(1 2 3 4 5))
(test (sort! #(2 3 4 1 5) <) #(1 2 3 4 5))
(test (sort! #(2 3 1 4 5) <) #(1 2 3 4 5))
(test (sort! #(2 4 3 1 5) <) #(1 2 3 4 5))
(test (sort! #(2 4 1 3 5) <) #(1 2 3 4 5))
(test (sort! #(3 1 2 4 5) <) #(1 2 3 4 5))
(test (sort! #(3 1 4 2 5) <) #(1 2 3 4 5))
(test (sort! #(3 2 4 1 5) <) #(1 2 3 4 5))
(test (sort! #(3 2 1 4 5) <) #(1 2 3 4 5))
(test (sort! #(3 4 1 2 5) <) #(1 2 3 4 5))
(test (sort! #(3 4 2 1 5) <) #(1 2 3 4 5))
(test (sort! #(4 1 2 3 5) <) #(1 2 3 4 5))
(test (sort! #(4 1 3 2 5) <) #(1 2 3 4 5))
(test (sort! #(4 2 1 3 5) <) #(1 2 3 4 5))
(test (sort! #(4 2 3 1 5) <) #(1 2 3 4 5))
(test (sort! #(4 3 2 1 5) <) #(1 2 3 4 5))
(test (sort! #(4 3 1 2 5) <) #(1 2 3 4 5))

(test (sort! #(3 1 2 1 4 1) <) #(1 1 1 2 3 4))
(test (sort! #(1 1 1) <) #(1 1 1))
(test (sort! #(1 2 3) (lambda (a b) (> a b))) #(3 2 1))
(test (sort! #((1 . 3) (1 . 1) (1 . 2) (1 . 1) (1 . 4) (1 . 1)) (lambda (a b) (< (cdr a) (cdr b)))) #((1 . 1) (1 . 1) (1 . 1) (1 . 2) (1 . 3) (1 . 4)))

(test (equal? (sort! (list 3 4 8 2 0 1 5 9 7 6) <) (list 0 1 2 3 4 5 6 7 8 9)) #t)
(test (equal? (sort! (list 3 4 8 2 0 1 5 9 7 6) (lambda (a b) (< a b))) (list 0 1 2 3 4 5 6 7 8 9)) #t)
(test (equal? (sort! (list) <) ()) #t)
(test (equal? (sort! (list 1) <) '(1)) #t)
(test (equal? (sort! (list 1 1 1) <) '(1 1 1)) #t)
(test (equal? (sort! (list 0 1 2 3 4 5 6 7 8 9) <) '(0 1 2 3 4 5 6 7 8 9)) #t)
(test (equal? (sort! (list #\a #\l #\o #\h #\a) char<?) '(#\a #\a #\h #\l #\o)) #t)
(test (equal? (sort! (list "tic" "tac" "toe") string<?) '("tac" "tic" "toe")) #t)
(test (equal? (sort! (list 3 4 8 2 0 1 5 9 7 6) >) (reverse (list 0 1 2 3 4 5 6 7 8 9))) #t)
(test (equal? (sort! '((3 . 1) (2 . 8) (5 . 9) (4 . 7) (6 . 0)) (lambda (a b) (< (car a) (car b)))) '((2 . 8) (3 . 1) (4 . 7) (5 . 9) (6 . 0))) #t)
(test (equal? (sort! '((3 . 1) (2 . 8) (5 . 9) (4 . 7) (6 . 0)) (lambda (a b) (< (cdr a) (cdr b)))) '((6 . 0) (3 . 1) (4 . 7) (2 . 8) (5 . 9))) #t)
(test (equal? (sort! (list (list 1 2) (list 4 3 2) (list) (list 1 2 3 4)) (lambda (a b) (> (length a) (length b)))) '((1 2 3 4) (4 3 2) (1 2) ())) #t)
(test (equal? (sort! '((1 2 3) (4 5 6) (7 8 9)) (lambda (a b) (> (car a) (car b)))) '((7 8 9) (4 5 6) (1 2 3))) #t)
(test (equal? (sort! (list #\b #\A #\B #\a #\c #\C) char<?) '(#\A #\B #\C #\a #\b #\c)) #t)
(test (equal? (sort! (list (list 'u 2) (list 'i 1) (list 'a 7) (list 'k 3) (list 'c 4) (list 'b 6))
		     (lambda (a b) (< (cadr a) (cadr b))))
	      '((i 1) (u 2) (k 3) (c 4) (b 6) (a 7)))
      #t)
(test (equal? (sort! (sort! '(1 2 3) >) <) '(1 2 3)) #t)
(test (sort! #2d((1 2) (3 4)) >) #2D((4 3) (2 1))) ; ?!?
(test (sort! #2d((1 4) (3 2)) >) #2D((4 3) (2 1))) ; ??!!?? this is not what anyone would expect
(test (sort! '(3 2 1) (lambda (a b c) #f)) 'error)
(test (sort! '(3 2 1) (lambda* (a b c) (< a b))) '(1 2 3))
(test (sort! '(3 2 1) (lambda (a b . c) (< a b))) '(1 2 3))
(test (sort! '(3 2 1) (lambda (a) #f)) 'error)
(test (sort! '(3 2 1) (lambda* (a) #f)) 'error)
(test (sort! '(3 1 2 4) (lambda args (< (car args) (cadr args)))) '(1 2 3 4))
(test (sort! (rootlet) <) 'error)
(test (sort! () #f) 'error)

(test (equal? (sort! (vector 3 4 8 2 0 1 5 9 7 6) <) (vector 0 1 2 3 4 5 6 7 8 9)) #t)
(test (equal? (sort! (make-int-vector 3 0) (lambda* (a b) (< a b))) (make-int-vector 3 0)) #t)
(test (equal? (sort! (make-float-vector 3 1.0) >) (float-vector 1.0 1.0 1.0)) #t)
(test (morally-equal? (let ((v (make-int-vector 3 0))) (set! (v 1) 3) (set! (v 2) -1) (sort! v <)) #(-1 0 3)) #t)
(test (morally-equal? (let ((v (make-int-vector 3 0))) (set! (v 1) 3) (set! (v 2) -1) (sort! v (lambda (a b) (< a b)))) #(-1 0 3)) #t)
(test (morally-equal? (let ((v (make-int-vector 3 0))) (set! (v 1) 3) (set! (v 2) -1) (sort! v (lambda* (a b) (< a b)))) #(-1 0 3)) #t)

(test (equal? (sort! #() <) #()) #t)
(test (sort! '(1 2 . 3) <) 'error)
(test (sort! #(1 3 8 7 5 6 4 2) (lambda (a b) (if (even? a) (or (odd? b) (< a b)) (and (odd? b) (< a b))))) #(2 4 6 8 1 3 5 7))
(let ((ninf (real-part (log 0.0))) (pinf (- (real-part (log 0.0))))) (test (sort! (list pinf 0.0 ninf) <) (list ninf 0.0 pinf)))
(test (sort! '(1 1 1) <) '(1 1 1))

(test (call/cc (lambda (return) (sort! '(1 2 3) (lambda (a b) (return "oops"))))) "oops")
(let ((p1 (dilambda (lambda (a b) (< a b)) (lambda (a b) (error 'oops)))))
  (test (sort! '(3 1 2 4) p1) '(1 2 3 4)))
(let ((p1 (dilambda (lambda* (a (b 2)) (< a b)) (lambda (a b) (error 'oops)))))
  (test (sort! '(3 1 2 4) p1) '(1 2 3 4)))
(let ((p1 (dilambda (lambda args (< (car args) (cadr args))) (lambda (a b) (error 'oops)))))
  (test (sort! '(3 1 2 4) p1) '(1 2 3 4)))

(test (let ((v (make-float-vector 1000)))
	(do ((i 0 (+ i 1)))
	    ((= i 1000))
	  (float-vector-set! v i (random 100.0)))
	(set! v (sort! v >))
	(call-with-exit
	 (lambda (return)
	   (do ((i 0 (+ i 1)))
	       ((= i 999) #t)
	     (if (< (v i) (v (+ i 1)))
		 (begin
		   (format #t "random vals after sort: ~A ~A~%" (v i) (v (+ i 1)))
		   (return #f)))))))
      #t)

(let ((v ()))
  (do ((i 0 (+ i 1)))
      ((= i 1000))
    (set! v (cons (random 100.0) v)))
  (set! v (sort! v >))
  (if (not (apply >= v))
      (format #t ";sort!: v not sorted by >: ~A~%" )))


(test (sort! (list 3 2 1) (lambda (m n) (let ((vals (sort! (list m n) <))) (< m n)))) '(1 2 3))

(test (let ((lst ()))
	(do ((i 0 (+ i 1)))
	    ((= i 4))
	  (set! lst (cons (random 1.0) lst)))
	(let ((vals (sort! lst (lambda (m n)
				 (let ((lst1 (list 1 2 3)))
				   (sort! lst1 <))
				 (< m n)))))
	  (apply < vals)))
      #t)


(let ((v (make-vector 8)))
  (do ((i 0 (+ i 1)))
      ((= i 10))
    (do ((k 0 (+ k 1)))
	((= k 8))
      (set! (v k) (- (random 1.0) 0.5)))
    (let ((v1 (copy v)))
      (sort! v <)
      (if (not (apply < (vector->list v)))
	  (format #t ";(sort! ~A <) -> ~A?" v1 v)))))

(test (sort!) 'error)
(test (sort! '(1 2 3) < '(3 2 1)) 'error)
(test (sort! '(1 2 3)) 'error)
(test (sort! '(1 2 3) 1) 'error)
(test (sort! '(1 2 3) < <) 'error)
(test (sort! (cons 3 2) <) 'error)
(test (sort! (list 1 0+i) <) 'error)
(test (sort! (list "hi" "ho") <) 'error)
(test (sort! '(1 2 #t) <) 'error)
(test (sort! '(1 2 . #t) <) 'error)
(test (sort! '(#\c #\a #\b) <) 'error)
(test (sort! (begin) if) 'error)

(test (let ((v #(1 2 3))) (let ((v1 (sort! v >))) (eq? v v1))) #t)
(test (let ((v (float-vector 1 2 3))) (let ((v1 (sort! v >))) (eq? v v1))) #t)
(test (let ((v (make-int-vector 3 0))) (let ((v1 (sort! v >))) (eq? v v1))) #t)
(test (let ((v #u8(0 1 2))) (let ((v1 (sort! v >))) (eq? v v1))) #t)
(test (let ((v (list 0 1 2))) (let ((v1 (sort! v >))) (eq? v v1))) #t)
(test (let ((v "012")) (let ((v1 (sort! v char>?))) (eq? v v1))) #t)

(test (let ((v "adcb")) (sort! v char>?) v) "dcba")
(test (let ((v "adcb")) (sort! v <) v) 'error)
(test (let ((v "adecb")) (sort! v char<?) v) "abcde")
(test (let ((v "db")) (sort! v char<?)) "bd")
(test (let ((v "d")) (sort! v char<?) v) "d")
(test (let ((v "")) (sort! v char<?) v) "")
(test (let ((v "adecfb")) (sort! v (lambda (a b) (char<? a b)))) "abcdef")

(test (let ((v #u8(3 0 1 2))) (sort! v <) v) #u8(0 1 2 3))
(test (let ((v #u8(3 0 1 2))) (sort! v >)) #u8(3 2 1 0))
(test (let ((v #u8(3 0 1 2))) (sort! v char>?) v) 'error)
(test (let ((v #u8(3))) (sort! v >) v) #u8(3))
(test (let ((v #u8(3 1))) (sort! v <) v) #u8(1 3))
(test (let ((v #u8())) (sort! v <) v) #u8())
(test (let ((v #u8(1 4 3 2 0))) (sort! v (lambda (a b) (< a b)))) #u8(0 1 2 3 4))
(test (let ((v #("123" "321" "132" "432" "0103" "123"))) (sort! v string>?)) #("432" "321" "132" "123" "123" "0103"))
 
(test (sort! (list) <) ())
(test (sort! (vector) <) #())
(test (sort! (string) char<?) (string))
(test (sort! (list #\a) <) '(#\a)) ; I guess this is reasonable
(test (sort! (list #("hi")) <) '(#("hi")))
(test (sort! (append (sort! (append (sort! () <) ()) <) ()) <) ())
(test (sort! (append (sort! (append (sort! '(1 2) <) '(1 2)) <) '(1 2)) <) '(1 1 1 2 2 2))
(test (let ((lst (list 3 1 12 4 1)))
      (sort! lst (lambda (a b)
                   (let ((val (map (lambda (n) (+ n 1)) (list a b))))
                     (apply < val)))))
      '(1 1 3 4 12))
(test (sort! '(#\c #\a #\b) (lambda (a b) (string<? (string a) (string b)))) '(#\a #\b #\c))

(test (let ((ov #(0 1 2)) (uv #(5 4 3 2 1))) (sort! uv (lambda (a b) (sort! ov >) (< a b))) ov) #(2 1 0))

(for-each
 (lambda (arg)
   (test (sort! arg <) 'error)
   (test (sort! () arg) 'error))
 (list -1 #\a 1 0 "hiho" (make-hash-table) :hi 'a-symbol 3.14 3/4 1.0+1.0i #f #t))

(for-each
 (lambda (arg)
   (test (sort! '(1 2 3) arg) 'error))
 (list -1 #\a 1 0 'a-symbol 3.14 3/4 1.0+1.0i #f #t #(1) '(1) "hi" abs :hi))

(test (sort! '(1 2 "hi" 3) <) 'error)
(test (sort! '(1 -2 "hi" 3) (lambda (a b) 
			     (let ((a1 (if (number? a) a (length a)))
				   (b1 (if (number? b) b (length b))))
			       (< a1 b1))))
      '(-2 1 "hi" 3))

(let ((ok #f))
  (catch #t
	 (lambda ()
	   (dynamic-wind
	       (lambda () #f)
	       (lambda () (sort! '(1 2 "hi" 3) <))
	       (lambda () (set! ok #t))))
	 (lambda args 'error))
  (if (not ok) (format #t "dynamic-wind out of sort! skipped cleanup?~%")))

(test (let ((v (float-vector 1 2 3))) (sort! v (lambda (a b) (call-with-exit (lambda (r) (> a b))))) v) (float-vector 3 2 1))
(test (let ((v (int-vector 1 2 3))) (sort! v (lambda (a b) (call-with-exit (lambda (r) (> a b))))) v) (int-vector 3 2 1))
(test (let ((v (list 1 2 3))) (sort! v (lambda (a b) (call-with-exit (lambda (r) (> a b))))) v) (list 3 2 1))
(test (let ((v "123")) (sort! v (lambda (a b) (call-with-exit (lambda (r) (char>? a b))))) v) "321")
(test (let ((v #u8(1 2 3))) (sort! v (lambda (a b) (call-with-exit (lambda (r) (> a b))))) v) #u8(3 2 1))

(let ((lst (list 1 2 3 9 8 7)))
  (let ((val (catch #t
		    (lambda ()
		      (sort! (copy lst)
			     (lambda (a b)
			       (if (< a b) (error 'sort-error "a < b"))
			       #t)))
		    (lambda args (car args)))))
    (if (not (eq? val 'sort-error))
	(format #t ";sort! with error: ~A~%" val)))

  (let ((val (call-with-exit
	      (lambda (return)
		(sort! (copy lst)
		       (lambda (a b)
			 (if (< a b) (return 'sort-error))
			 #t))))))
    (if (not (eq? val 'sort-error))
	(format #t ";sort! call-with-exit: ~A~%" val)))

  (let ((val (call/cc
	      (lambda (return)
		(sort! (copy lst)
		       (lambda (a b)
			 (if (< a b) (return 'sort-error))
			 #t))))))
    (if (not (eq? val 'sort-error))
	(format #t ";sort! call/cc: ~A~%" val))))

(let-temporarily (((*s7* 'safety) 1))
  (define (f1 x) (let ((y x)) y))
  (define (_sort_)
    (sort! #(1 2 3) (lambda (a b) (f1 (= a b)))))
  (test (_sort_) 'error))

(let ((size 100))
  
  (define (less a b)
    (< a b))
  (define (car-less a b)
    (< (car a) (car b)))
  
  (define (check-numbers vc)
    (do ((i 1 (+ i 1))
	 (x (vc 0))
	 (y (vc 1)))
	((or (= i (- size 1))
	     (and (> x y)
		  (or (format *stderr* "~A > ~A?~%" x y) #t))))
      (set! x y)
      (set! y (vc (+ i 1)))))
  
  (define (check-chars vc)
    (do ((i 1 (+ i 1))
	 (x (vc 0))
	 (y (vc 1)))
	((or (= i (- size 1))
	     (and (char>? x y)
		  (or (format *stderr* "~A > ~A?~%" x y) #t))))
      (set! x y)
      (set! y (vc (+ i 1)))))
  
  (define (check-strings vc)
    (do ((i 1 (+ i 1))
	 (x (vc 0))
	 (y (vc 1)))
	((or (= i (- size 1))
	     (and (string>? x y)
		  (or (format *stderr* "~A > ~A?~%" x y) #t))))
      (set! x y)
      (set! y (vc (+ i 1)))))
  
  (let ((v (make-vector size)))
    (do ((i 0 (+ i 1)))
	((= i size))
      (vector-set! v i (random 1.0)))
    (let ((vc (copy v)))
      (sort! vc <)
      (check-numbers vc))
    (let ((vc (copy v)))
      (sort! vc less)
      (check-numbers vc))
    (sort! v (lambda (a b) (< a b)))
    (check-numbers v))
    
  (let ((v (make-float-vector size)))
    (do ((i 0 (+ i 1)))
	((= i size))
      (vector-set! v i (random 100.0)))
    (let ((vc (copy v)))
      (sort! vc <)
      (check-numbers vc))
    (let ((vc (copy v)))
      (sort! vc less)
      (check-numbers vc))
    (sort! v (lambda (a b) (< a b)))
    (check-numbers v))
  
  (let ((v (make-int-vector size)))
    (do ((i 0 (+ i 1)))
	((= i size))
      (vector-set! v i (random 10000000)))
    (let ((vc (copy v)))
      (sort! vc <)
      (check-numbers vc))
    (let ((vc (copy v)))
      (sort! vc less)
      (check-numbers vc))
    (sort! v (lambda (a b) (< a b)))
    (check-numbers v))
  
  (let ((v (make-vector size)))	
    (do ((i 0 (+ i 1)))
	((= i size))
      (vector-set! v i (string (integer->char (random 256)) (integer->char (random 256)))))
    (let ((vc (copy v)))
      (sort! vc string<?)
      (check-strings vc))
    (sort! v (lambda (a b) (string<? a b)))
    (check-strings v)
    
    (do ((i 0 (+ i 1)))
	((= i size))
      (vector-set! v i (integer->char (random 256))))
    (let ((vc (copy v)))
      (sort! vc char<?)
      (check-chars vc))
    (sort! v (lambda (a b) (char<? a b)))
    (check-chars v)
    
    (do ((i 0 (+ i 1)))
	((= i size))
      (vector-set! v i (cons (random 1.0) (random 100000))))
    (let ((vc (copy v)))
      (sort! vc (lambda (a b) (< (car a) (car b))))
      (do ((i 1 (+ i 1))
	   (x (car (vc 0)))
	   (y (car (vc 1))))
	  ((or (= i (- size 1))
	       (and (> x y)
		    (or (format *stderr* "~A > ~A?~%" x y) #t))))
	(set! x y)
	(set! y (car (vc (+ i 1))))))
    (let ((vc (copy v)))
      (sort! vc car-less)
      (do ((i 1 (+ i 1))
	   (x (car (vc 0)))
	   (y (car (vc 1))))
	  ((or (= i (- size 1))
	       (and (> x y)
		    (or (format *stderr* "~A > ~A?~%" x y) #t))))
	(set! x y)
	(set! y (car (vc (+ i 1))))))
    (sort! v (lambda (a b) (< (cdr a) (cdr b))))
    (do ((i 1 (+ i 1))
	 (x (cdr (v 0)))
	 (y (cdr (v 1))))
	((or (= i (- size 1))
	     (and (> x y)
		  (or (format *stderr* "~A > ~A?~%" x y) #t))))
      (set! x y)
      (set! y (cdr (v (+ i 1)))))))


;;; --------------------------------------------------------------------------------
;;; catch

(define (catch-test sym)
  (let ((errs ()))
    (catch 'a1
	 (lambda ()
	   (catch 'a2
		  (lambda ()
		    (catch 'a3
			   (lambda ()
			     (catch 'a4
				    (lambda ()
				      (error sym "hit error!"))
				    (lambda args
				      (set! errs (cons 'a4 errs))
				      'a4)))
			   (lambda args
			     (set! errs (cons 'a3 errs))
			     'a3)))
		  (lambda args
		    (set! errs (cons 'a2 errs))
		    'a2)))
	 (lambda args
	   (set! errs (cons 'a1 errs))
	   'a1))
    errs))

(test (catch-test 'a1) '(a1))
(test (catch-test 'a2) '(a2))
(test (catch-test 'a3) '(a3))
(test (catch-test 'a4) '(a4))

(define (catch-test-1 sym)
  (let ((errs ()))
    (catch 'a1
	 (lambda ()
	   (catch 'a2
		  (lambda ()
		    (catch 'a3
			   (lambda ()
			     (catch 'a4
				    (lambda ()
				      (error sym "hit error!"))
				    (lambda args
				      (set! errs (cons 'a4 errs))
				      (error 'a3)
				      'a4)))
			   (lambda args
			     (set! errs (cons 'a3 errs))
			     (error 'a2)
			     'a3)))
		  (lambda args
		    (set! errs (cons 'a2 errs))
		    (error 'a1)
		    'a2)))
	 (lambda args
	   (set! errs (cons 'a1 errs))
	   'a1))
    errs))

(test (catch-test-1 'a1) '(a1))
(test (catch-test-1 'a2) '(a1 a2))
(test (catch-test-1 'a3) '(a1 a2 a3))
(test (catch-test-1 'a4) '(a1 a2 a3 a4))
(test (procedure? (catch #t make-hook /)) #t)
(test (catch #t (lambda* (:rest a) a) /) ())

(test (catch #t (catch #t (lambda () (lambda () 1)) (lambda args 'oops)) (lambda args 'error)) 1)
(test (catch #t (catch #t (lambda () (error 'oops)) (lambda args (lambda () 1))) (lambda args 'error)) 1)
(test ((catch #t (lambda () (error 'oops)) (lambda args (lambda () 1)))) 1)
(test ((catch #t (lambda () (error 'oops)) (catch #t (lambda () (lambda args (lambda () 1))) (lambda args 'error)))) 1)
(test (catch #t (dynamic-wind (lambda () #f) (lambda () (lambda () 1)) (lambda () #f)) (lambda args 'error)) 1)
(test (dynamic-wind (catch #t (lambda () (lambda () #f)) (lambda args 'error)) (lambda () 1) (lambda () #f)) 1)
(test (dynamic-wind ((lambda () (lambda () #f))) (lambda () 1) (((lambda () (lambda () (lambda () #t)))))) 1)
(test (catch #t ((lambda () (lambda () 1))) (lambda b a)) 1)
(test (map (catch #t (lambda () abs) abs) '(-1 -2 -3)) '(1 2 3))
(test (catch + (((lambda () lambda)) () 1) +) 1)
;(test (catch #t + +) 'error) ; changed 12-May-14
(test (string? (catch + s7-version +)) #t)
(test (string? (apply catch + s7-version (list +))) #t)
(test (catch #t (lambda () (catch '#t (lambda () (error '#t)) (lambda args 1))) (lambda args 2)) 1)
(test (catch #t (lambda () (catch "hi" (lambda () (error "hi")) (lambda args 1))) (lambda args 2)) 2) ; guile agrees with this
(test (let ((str (list 1 2))) (catch #t (lambda () (catch str (lambda () (error str)) (lambda args 1))) (lambda args 2))) 1)
(test (let () (abs (catch #t (lambda () -1) (lambda args 0)))) 1)
;(test (let ((e #f)) (catch #t (lambda () (+ 1 "asdf")) (lambda args (set! e (owlet)))) (eq? e (owlet))) #t)
(test (+ (catch 'oops (lambda () (error 'oops)) (lambda args (values 1 2 3)))) 6)
(test (catch #t (lambda () (error 1 2 3)) (lambda* ((a 2) (b 3) (c 4)) (list a b c))) '(1 (2 3) 4))

(test (let ((x (list 1 2))) (catch #t (lambda () (catch x (lambda () (throw x)) (lambda args x))) (lambda () 'oops))) '(1 2))

(let ()
  (define (f)
    (let ((val (catch #t (lambda () (throw 'oops)) (lambda args #f)))) (if val (format *stderr* "~A should be #f~%" val)))
    (let ((val (catch #t (lambda () (throw 'oops)) (lambda args 'a)))) (if (not (eq? val 'a)) (format *stderr* "~A should be 'a~%" val)))
    (let ((val (catch #t (lambda () (throw 'oops)) (lambda args (car args))))) (if (not (eq? val 'oops)) (format *stderr* "~A should be 'oops~%" val)))
    (let ((val (catch #t (lambda () (throw 'oops)) (lambda args (+ 1 2))))) (if (not (= val 3)) (format *stderr* "~A should be 3~%" val)))
    (let ((val (catch #t (lambda () (throw 'oops)) (lambda args args)))) (if (not (equal? val '(oops ()))) (format *stderr* "~A should be '(oops ())~%" val)))
    (let ((val (catch #t (lambda () (throw 'oops)) (lambda (type info) type)))) (if (not (eq? val 'oops)) (format *stderr* "~A should be 'oops~%" val)))
    (let ((val (catch #t (lambda () (throw 'oops)) (lambda (type info) info)))) (if (not (null? val)) (format *stderr* "~A should be ()~%" val)))
    (let ((val (catch #t (lambda () (throw 'oops)) (lambda (type info) #f)))) (if val (format *stderr* "~A should be #f~%" val)))
    
    (let ((val (catch 'oops (lambda () (throw 'oops)) (lambda args #f)))) (if val (format *stderr* "oops ~A should be #f~%" val)))
    (let ((val (catch 'oops (lambda () (throw 'oops)) (lambda args 'a)))) (if (not (eq? val 'a)) (format *stderr* "oops ~A should be 'a~%" val)))
    (let ((val (catch 'oops (lambda () (throw 'oops)) (lambda args (car args))))) (if (not (eq? val 'oops)) (format *stderr* "oops ~A should be 'oops~%" val)))
    (let ((val (catch 'oops (lambda () (throw 'oops)) (lambda args (+ 1 2))))) (if (not (= val 3)) (format *stderr* "oops ~A should be 3~%" val)))
    (let ((val (catch 'oops (lambda () (throw 'oops)) (lambda args args)))) (if (not (equal? val '(oops ()))) (format *stderr* "oops ~A should be '(oops ())~%" val)))
    (let ((val (catch 'oops (lambda () (throw 'oops)) (lambda (type info) type)))) (if (not (eq? val 'oops)) (format *stderr* "oops ~A should be 'oops~%" val)))
    (let ((val (catch 'oops (lambda () (throw 'oops)) (lambda (type info) info)))) (if (not (null? val)) (format *stderr* "oops ~A should be ()~%" val)))
    (let ((val (catch 'oops (lambda () (throw 'oops)) (lambda (type info) #f)))) (if val (format *stderr* "oops ~A should be #f~%" val))))
  (f))

;;; various catch macros from s7.html
(let ()
  (define-macro (catch-all . body) 
    `(catch #t (lambda () ,@body) (lambda args args)))
  (let ((val (catch-all (+ 1 asdf))))
    (test (car val) 'unbound-variable)
    (let ((x 32))
      (test (catch-all (set! x (+ x 1)) (* x 2)) 66)
      (test (car (catch-all (string=? x "hi"))) 'wrong-type-arg))))

(let ()
  (define-macro (catch-case clauses . body)
    (let ((base `(lambda () ,@body)))
      (for-each (lambda (clause)
		  (let ((tag (car clause)))
		    (set! base `(lambda () 
				  (catch ',(if (eq? tag 'else) #t tag)
				    ,base 
				    ,@(cdr clause))))))
		clauses)
      (caddr base)))
  
  (test (catch-case ((wrong-type-arg   (lambda args (format #t "got a bad arg~%") -1))
		     (division-by-zero (lambda args 0))
		     (else             (lambda args 123)))
	  (abs -1))
	1)
  (test (catch-case ((wrong-type-arg   (lambda args (format #t "got a bad arg~%") -1))
		     (division-by-zero (lambda args 0))
		     (else             (lambda args 123)))
	  (let ((x 0)) (/ 32 x)))
	0)
  (test (catch-case ((wrong-type-arg   (lambda args -1))
		     (division-by-zero (lambda args 0))
		     (else             (lambda args 123)))
	  (abs "hi"))
	-1)
  (test (catch-case ((wrong-type-arg   (lambda args (format #t "got a bad arg~%") -1))
		     (division-by-zero (lambda args 0))
		     (else             (lambda args 123)))
	  (throw 'oops -1))
	123))

(let ()
  (define (catch-if test func err)
    (catch #t
      func
      (lambda args
	(if (test (car args))
	    (apply err args)
	    (apply throw args))))) ; if not caught, re-raise the error

  (test (catch #t
	  (lambda ()
	    (catch-if
	     (lambda (tag)
	       (eq? tag 'oops))
	     (lambda ()
	       (error 'oops 123))
	     (lambda args
	       32)))
	  (lambda args 47))
	32)
  (test (catch #t
	  (lambda ()
	    (catch-if
	     (lambda (tag)
	       (eq? tag 'oops))
	     (lambda ()
	       (error 'err 123))
	     (lambda args
	       32)))
	  (lambda args (car args)))
	'err)

  (define (catch-member lst func err)
    (catch-if (lambda (tag) (member tag lst)) func err))
  (test (catch-member '(oops err)
	  (lambda ()
	    (error 'oops))
	  (lambda args 47))
	47))

(let ()
  (define-macro (catch* clauses . error) 
    (define (builder lst)
      (if (null? lst)
	  (apply values error)
	  `(catch #t (lambda () ,(car lst)) (lambda args ,(builder (cdr lst))))))
    (builder clauses))
  (test (catch* ((+ 1 2) (- 3 4)) 'error) 3)
  (test (catch* ((+ 1 "hi") (- 3 4)) 'error) -1)
  (test (catch* ((+ 1 "hi") (- 3 #\a)) 'error) 'error))


(multiple-value-bind (err-type err-data)
  (call-with-exit
   (lambda (return)
     (catch #t
       (lambda () _asdf_)
       return)))
  (test err-type 'unbound-variable)
  (test err-data '("~A: unbound variable" _asdf_)))

(test (catch #t (lambda () _asdf_) "asdf") 'error)
(when with-block (test (catch #t (lambda () _asdf_) blocks) '(unbound-variable ("~A: unbound variable" _asdf_))))

;;; since catch is a function, everything is evaluated:
(test
 (catch (#(0 #t 1) 1)
   ((lambda (a) 
      (lambda () 
	(+ a "asdf")))
    1)
   ((lambda (b) 
      (lambda args 
	(format #f "got: ~A" b)))
    2))
 "got: 2")

(let ()
  (define (hi c)
    (catch c
      ((lambda (a) 
	 (lambda () 
	   (+ a "asdf")))
       1)
      ((lambda (b) 
	 (lambda args 
	   (format #f "got: ~A" b)))
       2)))
  (test (hi #t) "got: 2"))

(test
 (catch (#(0 #t 1) 1)
   (values ((lambda (a) 
	      (lambda () 
		(+ a "asdf")))
	    1)
	   ((lambda (b) 
	      (lambda args 
		(format #f "got: ~A" b)))
	    2)))
 "got: 2")

(let ((x 0))
  (catch #t
	 (lambda ()
	   (catch #t
		  (lambda ()
		    (+ 1 __asdf__))
		  (lambda args
		    (set! x (+ x 1))
		    (+ 1 __asdf__))))
	 (lambda args
	   (set! x (+ x 1))))
  (test x 2))

(test (let ((x 0))
	(catch 'a
	     (lambda ()
	       (catch 'b
		      (lambda ()
			(catch 'a
			       (lambda ()
				 (error 'a))
			       (lambda args
				 (set! x 1))))
		      (lambda args
			(set! x 2))))
	     (lambda args
	       (set! x 3)))
	x)
      1)

(test (+ (catch #t (lambda () (values 3 4)) (lambda args (values 1 2 3)))) 7)

(test (catch) 'error)
(test (catch s7-version) 'error)
(test (catch #t s7-version) 'error)
(test (catch #t s7-version + +) 'error)
(let ()
  (define* (f1 a) a)
  (define (f2 . args) args)
  (define* (f3) 1)
  (define* (f4 (a 1) (b 2)) a)
  (test (catch #t s7-version f2) (s7-version))
  (test (catch #t f1 f2) #f)
  (test (catch #t f3 f2) 1)
  (test (catch #t f4 f2) 1)
  (define (f5 a) a)
  (test (catch #t f5 (lambda args 'local-error)) 'local-error))

(test (let () (define-macro (m) `(+ 1 2)) (catch #t m (lambda any any)))  3)
;(test (let () (define-macro (m) `(define __asdf__ 3)) (catch #t m (lambda any "__asdf__ must be a constant?"))) '__asdf__) ;25-Jul-14
(test (let () (define-macro* (m (a 1) (b 2)) `(define __asdf__ (+ ,a ,b))) (catch #t m (lambda any any)) __asdf__) 3)
;;; so this is useful where we want to call a macro that defines something in the current environment,
;;;   but might hit some error that we want to catch. 
(test (let () (define-macro (m . args) `(display ,args)) (catch #t (lambda () #f) m)) #f)
(test (let () (define-macro (m . args) (apply (car args) (cadr args))) (catch #t (lambda () (error abs -1)) m)) 1)
(test (let () (define-macro (m . args) `(apply ,(car args) ',(cadr args))) (catch #t (lambda () (error abs -1)) m)) 1)

;;; throw
(define (catch-test sym)
  (let ((errs ()))
    (catch 'a1
	 (lambda ()
	   (catch 'a2
		  (lambda ()
		    (catch 'a3
			   (lambda ()
			     (catch 'a4
				    (lambda ()
				      (throw sym "hit error!"))
				    (lambda args
				      (set! errs (cons 'a4 errs))
				      'a4)))
			   (lambda args
			     (set! errs (cons 'a3 errs))
			     'a3)))
		  (lambda args
		    (set! errs (cons 'a2 errs))
		    'a2)))
	 (lambda args
	   (set! errs (cons 'a1 errs))
	   'a1))
    errs))

(test (catch-test 'a1) '(a1))
(test (catch-test 'a2) '(a2))
(test (catch-test 'a3) '(a3))
(test (catch-test 'a4) '(a4))

(define (catch-test-1 sym)
  (let ((errs ()))
    (catch 'a1
	 (lambda ()
	   (catch 'a2
		  (lambda ()
		    (catch 'a3
			   (lambda ()
			     (catch 'a4
				    (lambda ()
				      (throw sym "hit error!"))
				    (lambda args
				      (set! errs (cons 'a4 errs))
				      (throw 'a3)
				      'a4)))
			   (lambda args
			     (set! errs (cons 'a3 errs))
			     (throw 'a2)
			     'a3)))
		  (lambda args
		    (set! errs (cons 'a2 errs))
		    (throw 'a1)
		    'a2)))
	 (lambda args
	   (set! errs (cons 'a1 errs))
	   'a1))
    errs))

(test (catch-test-1 'a1) '(a1))
(test (catch-test-1 'a2) '(a1 a2))
(test (catch-test-1 'a3) '(a1 a2 a3))
(test (catch-test-1 'a4) '(a1 a2 a3 a4))

(test (catch #t (catch #t (lambda () (throw 'oops)) (lambda args (lambda () 1))) (lambda args 'error)) 1)
(test ((catch #t (lambda () (throw 'oops)) (lambda args (lambda () 1)))) 1)
(test ((catch #t (lambda () (throw 'oops)) (catch #t (lambda () (lambda args (lambda () 1))) (lambda args 'error)))) 1)
(test (catch #t (lambda () (catch '#t (lambda () (throw '#t)) (lambda args 1))) (lambda args 2)) 1)
(test (catch #t (lambda () (catch "hi" (lambda () (throw "hi")) (lambda args 1))) (lambda args 2)) 2) ; guile agrees with this
(test (let ((str (list 1 2))) (catch #t (lambda () (catch str (lambda () (throw str)) (lambda args 1))) (lambda args 2))) 1)

(test (throw) 'error)
(test (catch #f (lambda () (throw #f 1 2 3)) (lambda args (cadr args))) '(1 2 3))

(for-each
 (lambda (arg) 
   (catch #t 
     (lambda ()
       (test (catch arg
	       (lambda () 
		 (throw arg 1 2 3)) 
	       (lambda args (cadr args)))
	     '(1 2 3)))
     (lambda args 
       (format #t "~A not caught~%" (car args)))))
 (list #\a 'a-symbol #f #t abs #<unspecified>))

(test (let ((e #f)) 
	(catch #t 
	  (lambda () 
	    (catch #t 
	      (lambda () (+ 1 "asdf")) 
	      (lambda args (set! e (let->list (owlet))))))
	  (lambda args #f)) (equal? e (let->list (owlet)))) #t)

(let ((e 1))
  (catch #t 
    (lambda ()
      (catch #t
	(lambda ()
	  (error 'an-error "an-error"))
	(lambda args
	  (set! e (let->list (owlet)))))
      (throw #t "not an error"))
    (lambda args
      #f))
  (test (equal? e (let->list (owlet))) #t))

(let ()
  (define (t1 x)
    (catch #t
      (lambda ()
	(throw x))
      (lambda args (car args))))
  (define (tt)
    (do ((i 0 (+ i 1)))
	((= i 100) i)
      (t1 'a)))
  (test (tt) 100))



;;; --------------------------------------------------------------------------------
;;; error

(test (catch #t (lambda () (error 'oops 1)) (let () (lambda args (caadr args)))) 1)
(test (catch #t (lambda () (error 'oops 1)) (let ((x 3)) (lambda args (+ x (caadr args))))) 4)
(test (catch #t (let () (lambda () (error 'oops 1))) (let ((x 3)) (lambda args (+ x (caadr args))))) 4)
(test (catch #t (let ((x 2)) (lambda () (error 'oops x))) (let ((x 3)) (lambda args (+ x (caadr args))))) 5)
(test (catch #t (let ((x 2)) ((lambda () (lambda () (error 'oops x))))) (let ((x 3)) (lambda args (+ x (caadr args))))) 5)

(test (let ((pws (dilambda (lambda () (+ 1 2)) (lambda (a) (+ a 2)))))
	(catch #t pws (lambda (tag type) tag)))
      3)
(test (let ((pws (dilambda (lambda () (error 'pws 3) 4) (lambda (a) (+ a 2)))))
	(catch #t pws (lambda (tag type) tag)))
      'pws)
(test (let ((pws (dilambda (lambda (a b) a) (lambda (a b) (+ a 2)))))
	(catch #t (lambda () (error 'pws-error 3)) pws))
      'pws-error)

(for-each
 (lambda (tag)
   (let ((val (catch tag (lambda () (error tag "an error") 123) (lambda args (car args)))))
     (if (not (equal? tag val))
	 (format #t ";catch ~A -> ~A~%" tag val))))
 (list :hi () #() #<eof> #f #t #<unspecified> car #\a 32 9/2))

(for-each
 (lambda (tag)
   (let ((val (catch #t (lambda () (error tag "an error") 123) (lambda args (car args)))))
     (if (not (equal? tag val))
	 (format #t ";catch #t (~A) -> ~A~%" tag val))))
 (list :hi () #<eof> #f #t #<unspecified> car #\a 32 9/2 '(1 2 3) '(1 . 2) #(1 2 3) #()))

(for-each
 (lambda (tag)
   (test (catch #t tag (lambda args 'local-error)) 'local-error)
   (test (catch #t (lambda () #f) tag) 'error))
 (list :hi () #<eof> #f #t #<unspecified> #\a 32 9/2)) ;'(1 2 3) '(1 . 2) #(1 2 3) #()

;; (error <string>...) throws 'no-catch which makes it harder to check
(let ((val (catch #t (lambda () (error "hi") 123) (lambda args (car args)))))
  (if (not (eq? val 'no-catch))
      (format #t ";catch #t, tag is string -> ~A~%" val)))

(for-each
 (lambda (tag)
   (let ((val (catch tag (lambda () (error #t "an error") 123) (lambda args (car args)))))
     (if (not (equal? #t val))
	 (format #t ";catch ~A -> ~A (#t)~%" tag val))))
 (list :hi () #<eof> #f #t #<unspecified> car #\a 32 9/2))

(let ((tag 'tag)) (test (catch (let () tag) (lambda () (set! tag 123) (error 'tag "tag") tag) (lambda args (car args))) 'tag))

(let ()
  (define (check-reerror x)
    (catch #t
      (lambda ()
	(define (our-func x)
	  (case x
	    ((0) (error 'zero))
	    ((1) (error 'one))
	    (else (error 'else))))
	(catch #t 
  	  (lambda () 
	    (our-func x))
	  (lambda args
	    (if (eq? (car args) 'one)
		(our-func (+ x 1))
		(apply error args)))))
      (lambda args
	(let ((type (car args)))
	  (case type
	    ((zero) 0)
	    ((one) 1)
	    (else 2))))))
  (test (check-reerror 0) 0)
  (test (check-reerror 1) 2)
  (test (check-reerror 2) 2))

(test (catch 'hiho
	     (lambda ()
	       (define (f1 a)
		 (error 'hiho a))
	       (* 2 (catch 'hiho
			   (lambda ()
			     (f1 3))
			   (lambda args (caadr args)))))
	     (lambda args (caadr args)))
      6)

(test (let ()
	(define (f1 a)
	  (error 'hiho a))
	(catch 'hiho
	       (lambda ()
		 (* 2 (catch 'hiho
			     (lambda ()
			       (f1 3))
			     (lambda args (caadr args)))))
	       (lambda args (caadr args))))
      6)

(test (catch 'hiho
	     (lambda ()
	       (let ((f1 (catch 'hiho
				(lambda ()
				  (lambda (a) (error 'hiho 3)))
				(lambda args args))))
		 (f1 3)))
	     (lambda args (caadr args)))
      3)


(test (error) 'error)
(test (let ((x 1))
	(let ((val (catch #\a
			  (lambda ()
			    (set! x 0)
			    (error #\a "an error")
			    (set! x 2))
			  (lambda args
			    (if (equal? (car args) #\a)
				(set! x (+ x 3)))
			    x))))
	  (= x val 3)))
      #t)
(test (let ((x 1))
	(let ((val (catch 32
			   (lambda ()
			     (catch #\a
				    (lambda ()
				      (set! x 0)
				      (error #\a "an error: ~A" (error 32 "another error!"))
				      (set! x 2))
				    (lambda args
				      (if (equal? (car args) #\a)
					  (set! x (+ x 3)))
				      x)))
			   (lambda args 
			     (if (equal? (car args) 32)
				 (set! x (+ x 30)))))))
	  (= x val 30)))
      #t)

(test (list (catch #t (lambda () (call-with-exit (lambda (goto) (values 1 2 3)))) (lambda args 'err))) '(1 2 3))
(test (let () (define (func) (list (catch #t (lambda () (call-with-exit (lambda (goto) (values 1 2 3)))) (lambda args 'err))) '(1 2 3)) (define (hi) (func)) (hi)) '(1 2 3))
(test (list (catch #t (lambda () (call-with-exit (lambda (goto) (goto 1 2 3)))) (lambda args 'err))) '(1 2 3))
(test (let () (define (func) (list (catch #t (lambda () (call-with-exit (lambda (goto) (goto 1 2 3)))) (lambda args 'err))) '(1 2 3)) (define (hi) (func)) (hi)) '(1 2 3))




;;; --------------------------------------------------------------------------------

(define (last-pair l) ; needed also by loop below
  (if (pair? (cdr l)) 
      (last-pair (cdr l)) l))
  

(let ()
  ;; from guile-user I think
  ;; (block LABEL FORMS...)
  ;;
  ;; Execute FORMS.  Within FORMS, a lexical binding named LABEL is
  ;; visible that contains an escape function for the block.  Calling
  ;; the function in LABEL with a single argument will immediatly stop
  ;; the execution of FORMS and return the argument as the value of the
  ;; block.  If the function in LABEL is not invoked, the value of the
  ;; block is the value of the last form in FORMS.
  
  (define-macro (block label . forms)
    `(let ((body (lambda (,label) ,@forms))
	   (tag (gensym "return-")))
       (catch tag
	      (lambda () (body (lambda (val) (throw tag val))))
	      (lambda (tag val) val))))
  
  ;; (with-return FORMS...)
  ;;
  ;; Equivalent to (block return FORMS...)
  
  (define-macro (with-return . forms)
    `(block return ,@forms))
  
  ;; (tagbody TAGS-AND-FORMS...)
  ;;
  ;; TAGS-AND-FORMS is a list of either tags or forms.  A TAG is a
  ;; symbol while a FORM is everything else.  Normally, the FORMS are
  ;; executed sequentially.  However, control can be transferred to the
  ;; forms following a TAG by invoking the tag as a function.  That is,
  ;; within the FORMS, there is a lexical binding for each TAG with the
  ;; symbol that is the tag as its name.  The bindings carry functions
  ;; that will execute the FORMS following the respective TAG.
  ;;
  ;; The value of a tagbody is always `#f'.
  
  (define (transform-tagbody forms)
    (let ((start-tag (gensym "start-"))
	  (block-tag (gensym "block-")))
      (let loop ((cur-tag start-tag)
		 (cur-code ())
		 (tags-and-code ())
		 (forms forms))
	(cond
	 ((null? forms)
	  `(block ,block-tag
		  (letrec ,(reverse! (cons (list cur-tag `(lambda () ,@(reverse! (cons `(,block-tag #f) cur-code)))) tags-and-code))
		    (,start-tag))))
	 ((symbol? (car forms))
	  (loop (car forms)
		'()
		(cons (list cur-tag `(lambda () ,@(reverse! (cons `(,(car forms)) cur-code)))) tags-and-code)
		(cdr forms)))
	 (else
	  (loop cur-tag
		(cons (car forms) cur-code)
		tags-and-code
		(cdr forms)))))))
  
  (define-macro (tagbody . forms)
    (transform-tagbody forms))
  
  (define (first_even l)
    (with-return
     (tagbody
      continue
      (if (not (not (null? l)))
	  (break))
      (let ((e (car l)))
	(if (not (number? e))
	    (break))
	(if (even? e)
	    (return e))
	(set! l (cdr l)))
      (continue)
      break)
     (return #f)))
  
  (let ((val (first_even '(1 3 5 6 7 8 9))))
    (if (not (equal? val (list 6)))
	(format #t "first_even (tagbody, gensym, reverse!) (6): '~A~%" val)))
  )

#|
so prog is something like (define-macro (prog vars . body) `(with-return (tagbody (let ,vars ,@body))))
or better (define-macro (prog vars . body) `(call-with-exit (lambda (return) (tagbody (let ,vars ,@body)))))
|#



;;; --------------------------------------------------------------------------------
;;; define* 
;;; lambda*

(let ((hi (lambda* (a) a)))
  (test (hi 1) 1)
  (test (hi) #f)          ; all args are optional
  (test (hi :a 32) 32)    ; all args are keywords
  (test (hi 1 2) 'error)  ; extra args
  
  (for-each
   (lambda (arg)
     (test (hi arg) arg)
     (test (hi :a arg) arg))
   (list -1 #\a 1 #(1 2 3) 3.14 3/4 1.0+1.0i () 'hi abs #(()) (list 1 2 3) '(1 . 2)))
  
  (test (hi :b 1) 'error))

(let ()
  (define* (f0) #f)
  (test (f0) #f)
  (test (f0 :a) 'error))

(let ()
  (define* (f00 a :allow-other-keys) a)
  (test (f00) #f)
  (test (f00 :a) 'error) ; key needs value 
  (test (f00 :a 1) 1)
  (test (let ((x 0)) (f00 :b (set! x 1)) x) 1)
  (test (f00 :a 1 :b :c :d 2) 1))

(let ()
  (define* (f000 :rest a) a) ; rest argname is not a keyword argname
  (test (f000 :a) '(:a))
  (test (f000 :a 1) '(:a 1))
  (test (f000 1) '(1))
  (test (f000 1 :a 2) '(1 :a 2)))

(let ()
  (define* (f1 (a 0)) a)
  ;;; (define (f2 x) (f1 x))
  (test (f1) 0)
  (test (f1 :a) 'error)
  (test (f1 :a 1) 1)
  (test (f1 :a :b) :b)
  (test (f1 :a :a) :a)
  (test (f1 :b) 'error)
  (test (f1 :a 0 :a) 'error)
  (test (f1 :a 0 :a 1) 'error)
  (test (f1 0) 0)
  (test (f1 0 :a) 'error)
  (test (f1 0 :a 1) 'error)
  (test (f1 'a) 'a)
  (test (f1 ':a) 'error)
  (test (f1 '':a) '':a)
  (test (f1 ':a 0) 0)
  (test (f1 a: 0) 0)
  (let ((x :a))
    (test (f1 x 0) 0)
    (test (f1 x) 'error)
    (test (apply f1 (list x 0)) 0)
    (test (apply f1 '(x)) 'x)
    (test (apply f1 '(:a)) 'error))
  (let ((x :b))
    (test (f1 x) 'error))
  (let ((mk (lambda () :a)))
    (test (f1 (mk)) 'error)
    (test (f1 (mk) 0) 0)
    (test (f1 (mk) (mk)) (mk)) ;!
    (test (apply f1 (list (mk) 0)) 0)))

(let ()
  (define* (f1u (a 0)) (car (member a (list a) (lambda (a b) a))))
  ;;; (define (f2 x) (f1u x))
  (test (f1u) 0)
  (test (f1u :a) 'error)
  (test (f1u :a 1) 1)
  (test (f1u :a :b) :b)
  (test (f1u :a :a) :a)
  (test (f1u :b) 'error)
  (test (f1u :a 0 :a) 'error)
  (test (f1u :a 0 :a 1) 'error)
  (test (f1u 0) 0)
  (test (f1u 0 :a) 'error)
  (test (f1u 0 :a 1) 'error)
  (test (f1u 'a) 'a)
  (test (f1u ':a) 'error)
  (test (f1u '':a) '':a)
  (test (f1u ':a 0) 0)
  (test (f1u a: 0) 0)
  (let ((x :a))
    (test (f1u x 0) 0)
    (test (f1u x) 'error)
    (test (apply f1u (list x 0)) 0)
    (test (apply f1u '(x)) 'x)
    (test (apply f1u '(:a)) 'error))
  (let ((x :b))
    (test (f1u x) 'error))
  (let ((mk (lambda () :a)))
    (test (f1u (mk)) 'error)
    (test (f1u (mk) 0) 0)
    (test (f1u (mk) (mk)) (mk)) ;!
    (test (apply f1u (list (mk) 0)) 0)))

(let ((x 1))
  (define fx (lambda* ((a (+ x 1)) (b (let ((y (+ x 1))) (+ y 1)))) (list a b)))
  (define* (fy (a (* x 2)) (b (fx :a 1 :b 2))) (list a b))
  (test (fx) '(2 3))
  (test (fy) '(2 (1 2)))
  (test (fy :a 0) '(0 (1 2))))

(let ()
  (define* (f a (b :c)) b) 
  (test (f :b 1 :d) 'error))

(let ()
  (define* (f1a (a :a)) a)
  (test (f1a) :a))

(let ()
  (define* (f2 (a 0) (b 1)) (list a b))
  (test (f2 :a) 'error)
  (test (f2 :a 1 :b) 'error)
  (test (f2 :a 1 :b 1 :c) 'error)
  (test (f2 (car '(:a)) 2) '(2 1))
  (test (f2 :b 2) '(0 2))
  (test (f2 :a 2) '(2 1))
  (test (f2 :a 1 :b 2) '(1 2))
  (test (let ((x :a)) (f2 x 2)) '(2 1))
  (test (let ((x :a)) (f2 x x)) '(:a 1)) ; (f2 :a :a) so a=:a b=1
  (test (let ((x -1) (y :a)) (f2 y x)) '(-1 1))
  (test (let ((x 3) (y :b)) (f2 y x)) '(0 3))
  (test (let ((x 3) (y :c)) (f2 y x)) 'error)
  (test (let ((x 3) (y :c)) (f2 x y)) 'error))

(let ()
  (define* (f3 (a :a) (b :a)) (list a b))
  (test (f3 :a) 'error)
  (test (f3) '(:a :a))
  (test (f3 :b 1) '(:a 1))) ; default value is a value not a keyword-as-parameter-indicator

(let ((hi (lambda* ((a 1)) a)))
  (test (hi 2) 2)
  (test (hi) 1)
  (test (hi :a 2) 2)
  
  (for-each
   (lambda (arg)
     (test (hi arg) arg)
     (test (hi :a arg) arg))
   (list -1 #\a 1 #(1 2 3) 3.14 3/4 1.0+1.0i () 'hi abs #(()) (list 1 2 3) '(1 . 2))))

(let ((hi (lambda* (a (b "hi")) (list a b))))
  (test (hi) (list #f "hi"))
  (test (hi 1) (list 1 "hi"))
  (test (hi 1 2) (list 1 2))
  (test (hi :b 1) (list #f 1))
  (test (hi :a 1) (list 1 "hi"))
  (test (hi 1 :b 2) (list 1 2))
  (test (hi :b 3 :a 1) (list 1 3))
  (test (hi :a 3 :b 1) (list 3 1))
  (test (hi 1 :a 3) 'error)
  (test (hi 1 2 :a 3) 'error) ; trailing (extra) args
  (test (hi :a 2 :c 1) 'error)
  (test (hi 1 :c 2) 'error)
  
  (for-each
   (lambda (arg)
     (test (hi :a 1 :b arg) (list 1 arg))
     (test (hi :a arg) (list arg "hi"))
     (test (hi :b arg) (list #f arg))
     (test (hi arg arg) (list arg arg)))
   (list -1 #\a 1 #(1 2 3) 3.14 3/4 1.0+1.0i () 'hi abs #(()) (list 1 2 3) '(1 . 2))))

(let ((hi (lambda* (a (b 3) c) (list a b c))))
  (test (hi) (list #f 3 #f))
  (test (hi 1) (list 1 3 #f))
  (test (hi :c 32) (list #f 3 32))
  (test (hi :c 32 :b 43 :a 54) (list 54 43 32))
  (test (hi 1 2 3) (list 1 2 3))
  (test (hi :b 32) (list #f 32 #f))
  (test (hi 1 2 :c 32) (list 1 2 32)))

(let ((hi (lambda* (a :rest b) (list a b))))
  (test (hi 1 2 3) (list 1 (list 2 3)))
  (test (hi) (list #f ()))
  (test (hi :a 2) (list 2 ()))
  (test (hi :b 3) (list #f 3)))

(let ((hi (lambda* (a :rest b :rest c) (list a b c))))
  (test (hi 1 2 3 4 5) (list 1 (list 2 3 4 5) (list 3 4 5))))

(let ((hi (lambda* ((a 3) (b #t) (c pi) :rest d) (list a b c d))))
  (test (hi) (list 3 #t pi ()))
  (test (hi 1 2 3 4) (list 1 2 3 (list 4))))

(let ((hi (lambda* ((a 'hi)) (equal? a 'hi))))
  (test (hi) #t)
  (test (hi 1) #f)
  (test (hi 'hi) #t)
  (test (hi :a 1) #f))

(let* ((x 32)
       (hi (lambda* (a (b x)) (list a b))))
  (test (hi) (list #f 32))
  (test (hi :a 1) (list 1 32)))

(let ((hi (lambda* (a . b) (list a b))))
  (test (hi 1 2 3) (list 1 (list 2 3)))
  (test (hi) (list #f ()))
  (test (hi :a 2) (list 2 ()))
  (test (hi :b 3) (list #f 3)))

(let ((hi (lambda* ((a 0.0) (b 0.0)) (+ a b))))
  (num-test (hi 1.0) 1.0)
  (num-test (hi 1.0 2.0) 3.0)
  (num-test (hi) 0.0)
  (num-test (+ (hi) (hi 1.0) (hi 1.0 2.0)) 4.0)
  (num-test (+ (hi 1.0) (hi) (hi 1.0 2.0)) 4.0)
  (num-test (+ (hi 1.0) (hi 1.0 2.0) (hi)) 4.0)
  (num-test (+ (hi 1.0 2.0) (hi) (hi 1.0)) 4.0))

(test (let ((hi (lambda*))) (hi)) 'error)
(test (let ((hi (lambda* #f))) (hi)) 'error)
(test (let ((hi (lambda* "hi" #f))) (hi)) 'error)
(test (let ((hi (lambda* ("hi") #f))) (hi)) 'error)
(test (let ((hi (lambda* (a 0.0) a))) (hi)) 'error)
(test (let ((hi (lambda* (a . 0.0) a))) (hi)) 'error)
(test (let ((hi (lambda* ((a . 0.0)) a))) (hi)) 'error)
(test (let ((hi (lambda* ((a 0.0 "hi")) a))) (hi)) 'error)
(test (let ((hi (lambda* ((a 0.0 . "hi")) a))) (hi)) 'error)
(test (let ((hi (lambda* ((a)) a))) (hi)) 'error)
(test (let ((hi (lambda* (a 0.0) (b 0.0) (+ a b)))) (hi)) 'error)
(test (lambda (:key) 1) 'error)
(test (let () (define hi (let ((x 1)) (lambda* ((y x)) y))) (hi)) 1)
(test (let () (define hi (let ((x 1)) (lambda* ((y x)) y))) (let ((x 2)) (hi))) 1)
(test ((lambda* (:key) 1)) 'error) 
(test (let ((akey :a) (bkey :b)) ((lambda* (a b) (list a b)) akey 32)) '(32 #f))
(test (let ((akey :a) (bkey :b)) ((lambda* (a b) (list a b)) bkey 12 akey 43)) '(43 12))
(test (let ((x 0)) (for-each (lambda* (a) (set! x (+ x a))) (list :a :a :a) (list 1 2 3)) x) 'error)

(test (let () (define* (hi) 0) (hi)) 0)
(test (let () (define* (hi) 0) (hi 1)) 'error)
(test (let () (define* (hi a . b) b) (hi 1 2 3)) '(2 3))
(test (let () (define* (hi a . b) b) (hi :a 1 2 3)) '(2 3))
(test (let () (define* (hi a . b) b) (hi 1)) ())
(test (let () (define* (hi a . b) b) (hi :a 1)) ())
(test (let () (define* (hi a . b) b) (hi)) ())
(test (let () (define* (hi a . a) a) (hi)) 'error)
(test (let () (define* (hi (a 1) . a) a) (hi)) 'error)
(test (let () (define* (hi (a 1) . b) b) (hi 2 3 4)) '(3 4))

(test (let () (define* (hi a :rest b) b) (hi 1 2 3)) '(2 3))
(test (let () (define* (hi a :rest b) b) (hi :a 1 2 3)) '(2 3))
(test (let () (define* (hi a :rest b) b) (hi 1)) ())
(test (let () (define* (hi a :rest b) b) (hi :a 1)) ())
(test (let () (define* (hi a :rest b) b) (hi)) ())

(test (let () (define* (hi (a 1) . b) b) (hi 1 2 3)) '(2 3))
(test (let () (define* (hi a (b 22) . c) (list a b c)) (hi)) '(#f 22 ()))
(test (let () (define* (hi a (b 22) . c) (list a b c)) (hi :a 1)) '(1 22 ()))
(test (let () (define* (hi a (b 22) . c) (list a b c)) (hi :b 1)) '(#f 1 ()))
(test (let () (define* (hi a (b 22) . c) (list a b c)) (hi :c 1)) '(#f 22 1))
(test (let () (define* (hi a (b 22) . c) (list a b c)) (hi :a 1 2)) '(1 2 ()))
(test (let () (define* (hi a (b 22) . c) (list a b c)) (hi :b 1 2 3)) 'error) ; b set twice
(test (let () (define* (hi a (b 22) . c) (list a b c)) (hi :c 1 2 3)) '(#f 2 (3)))
(test (let () (define* (hi a (b 22) . c) (list a b c)) (hi :b 1 :a 2 3)) '(2 1 (3)))

(test (let () (define* (hi (a 1) :allow-other-keys) a) (hi)) 1)
(test (let () (define* (hi (a 1) :allow-other-keys) a) (hi :b :a :a 3)) 3)
(test (let () (define* (hi (a 1) :allow-other-keys) a) (hi :b 3)) 1)
(test (let () (define* (hi (a 1) :allow-other-keys) a) (hi :a 3)) 3)
(test (let () (define* (hi (a 1) :allow-other-keys) a) (hi a: 3)) 3)
(test (let () (define* (hi (a 1) :allow-other-keys) a) (hi 3)) 3)
(test (let () (define* (hi (a 1) :allow-other-keys) a) (hi 3 :b 2)) 3)
(test (let () (define* (hi (a 1) :allow-other-keys) a) (hi :c 1 :a 3 :b 2)) 3)
(test (let () (define* (hi :rest a :allow-other-keys) a) (hi :c 1 :a 3 :b 2)) '(:c 1 :a 3 :b 2))

(test (let () (define* (hi (a 1) (b 2) :allow-other-keys :allow-other-keys) a)) 'error)
(test (let () (define* (hi (a 1) :allow-other-keys) a) (hi :a 2 32)) 'error)
(test (let () (define* (hi (a 1) :allow-other-keys) a) (hi 2 32)) 'error)

(test (let () (define* (hi (a 1) :rest c :allow-other-keys) (list a c)) (hi :a 3 :b 2)) '(3 (:b 2)))
(test (let () (define* (hi (a 1) :rest c) (list a c)) (hi :a 3 :b 2)) '(3 (:b 2)))

(test (let () (define* (hi (a 1) (b 2) :allow-other-keys) (list a b)) (hi :c 21 :b 2)) '(1 2))
(test (let () (define hi (lambda* ((a 1) (b 2) :allow-other-keys) (list a b))) (hi :c 21 :b 2)) '(1 2))
(test (let () (define-macro* (hi (a 1) (b 2) :allow-other-keys) `(list ,a ,b)) (hi :c 21 :b 2)) '(1 2))

(test (let () (define* (f1 :allow-other-keys) 123) (f1 :a 1 :b 2)) 'error)
(test (let ((f1 (lambda* (:allow-other-keys) 123))) (f1 :a 1 :b 2)) 'error)
(let ()
  (define* (f1 a :allow-other-keys) :allow-other-keys)
  (test (keyword? (f1 3)) #t)
  (test (eq? (f1) ':allow-other-keys) #t)
  (test (keyword? :allow-other-keys) #t))
(test (keyword? :allow-other-keys) #t)
(test (eq? :allow-other-keys ':allow-other-keys) #t)
(test (keyword? :rest) #t)
(test (eq? :rest ':rest) #t)

(test (let () (define* (f (a :b)) a) (list (f) (f 1) (f :a :c) (f :a 1) (f))) '(:b 1 :c 1 :b))
(test (let () (define* (f a (b :c)) b) (f :b 1 :d)) 'error)
(test ((lambda* (:rest (b 1)) b)) 'error) ; "lambda* :rest parameter can't have a default value." ?
(test ((lambda* ((a 1) (b 2)) ((lambda* ((c (+ a (* b 3)))) c)))) 7)
(test ((lambda* ((a 1) (b 2)) ((lambda* ((c (+ a (* b 3)))) c))) :b 3) 10)
(test (let ((a 123)) ((lambda* ((a 1) (b 2)) ((lambda* ((c (+ a (* b 3)))) c))) :b a)) 370)
(test (let ((a 123)) ((lambda* ((a 1) (b 2)) ((lambda* ((c (+ a (let ((a -2)) (* b a))))) c))))) -3)
(test (let ((a 123)) ((lambda* ((a 1) (b 2)) ((lambda* ((c (+ (let ((a -2)) (* b a)) a))) c))))) -3)
(test (let ((a 123)) ((lambda* ((a 1) (b 2)) ((lambda* ((c (+ (let ((a 0)) (/ b a)) a))) c))))) 'error)
(test ((lambda* ((c (call/cc (lambda (return) (return 3))))) c)) 3)
(test ((lambda* ((a (do ((i 0 (+ i 1)) (sum 0)) ((= i 3) sum) (set! sum (+ sum i))))) (+ a 100))) 103)
(test ((lambda* ((a (do ((i 0 (+ i 1)) (sum 0)) ((= i 3) sum) (set! sum (+ sum i)))) b) (+ a b)) 1 2) 3)

;; some of these are questionable
(test ((lambda* ((x (lambda () 1))) (x))) 1)
(test ((lambda* ((x x) else) (+ x else)) 1 2) 3) ; this has fluctuated between 3 and 'error (unbound variable 'x)
(test (symbol? ((lambda* ((y y)) y))) 'error) ; this used to be #t but now y is undefined
(test ((lambda* (:allow-other-keys) 34) :a 32) 'error)
(test ((lambda* ((y x) =>) (list y =>)) 1 2) '(1 2)) ; was also 'error 
(test ((lambda* (=> (y x)) (list y =>)) 1) 'error) ; used to be  '(x 1))
(test ((lambda* ((y #2D((1 2) (3 4)))) (y 1 0))) 3)
(test ((lambda* ((y (symbol "#(1 #\\a (3))")) x) -1)) -1)
(test ((lambda* ((y (symbol "#(1 #\\a (3))")) x) y)) (symbol "#(1 #\\a (3))"))
(test ((lambda* ((y #(1 #\a (3)))) (y 0))) 1)
(test ((lambda* ((y ()) ()) y)) 'error)
(test ((lambda* ((y ()) (x)) y)) 'error)
(test ((lambda* ((=> "") else) else) else) #f)
(test ((lambda* (x (y x)) y) 1) 1) ; was #f
(test ((lambda* (x (y x)) (let ((x 32)) y)) 1) 1) ; was #f
(test ((lambda* ((x 1) (y x)) y)) 1)
(test ((lambda* ((x 1) (y (+ x 1))) y)) 2)
(test ((lambda* ((x y) (y x)) y)) 'error) ; used to be 'y
(test (let ((z 2)) ((lambda* ((x z) (y x)) y))) 2) ; hmmm
(test (keyword? ((lambda* ((x :-)) x))) #t)
(test ((apply lambda* (list (list (list (string->symbol "a") 1)) (string->symbol "a"))) (symbol->keyword (string->symbol "a")) 3) 3)
(test ((lambda* (:allow-other-keys) 1) :a 321) 'error)
(test ((lambda* (:rest (a 1)) a)) 'error)
(test ((lambda* (:rest a) a)) ())
(test ((lambda* (:rest (a 1)) 1)) 'error)
(test (let ((b 2)) ((lambda* (:rest (a (let () (set! b 3) 4))) b))) 'error)
(test (let ((b 2)) ((lambda* ((a (let () (set! b 3) 4))) b))) 3)
(test ((lambda* (:rest hi :allow-other-keys (x x)) x)) 'error)
(test ((lambda* (:rest x y) (list x y)) 1 2 3) '((1 2 3) 2))
(test ((lambda* (:rest '((1 2) (3 4)) :rest (y 1)) 1)) 'error)
(test ((lambda* (:rest (list (quote (1 2) (3 4))) :rest (y 1)) 1)) 'error)
(test ((lambda* ((x ((list 1 2) 1))) x)) 2)
(test ((lambda* ((y ("hi" 0))) y)) #\h)
(test ((lambda* ((x ((lambda* ((x 1)) x)))) x)) 1)
(test ((lambda* (:rest) 3)) 'error)
(test ((lambda* (:rest 1) 3)) 'error)
(test ((lambda* (:rest :rest) 3)) 'error)
(test ((lambda* ((: 1)) :)) 1)
(test ((lambda* ((: 1)) :) :: 21) 21)
(test ((lambda* ((a 1)) a) a: 21) 21)
(test ((lambda* ((a 1)) a) :a: 21) 'error)
(test (let ((func (let ((a 3)) (lambda* ((b (+ a 1))) b)))) (let ((a 21)) (func))) 4)
(test (let ((a 21)) (let ((func (lambda* ((b (+ a 1))) b))) (let ((a 3)) (func)))) 22)
(test (let ((a 21)) (begin (define-macro* (func (b (+ a 1))) b) (let ((a 3)) (func)))) 4)
(test ((lambda* (:rest x :allow-other-keys y) x) 1) 'error)
(test ((lambda* (:allow-other-keys x) x) 1) 'error)
(test ((lambda* (:allow-other-keys . x) x) 1 2) 'error)
(test ((lambda* (:rest . (x)) x) 1 2) '(1 2))
(test ((lambda* (:rest . (x 1)) x) 1 2) 'error)
(test ((lambda* (:rest . (x)) x)) ())
(test ((lambda* x x) 1) '(1))
(test (lambda* (((x) 1)) x) 'error)
(test ((lambda* ((a: 3)) a:) :a: 4) 'error)
(test ((lambda* ((a 3)) a) a: 4) 4)
(test ((lambda* ((a (lambda* ((b 1)) (+ b 1)))) (a))) 2)
;(define hi (call-with-exit (lambda (return) (lambda* ((a (return "hey I need an argument"))) a)))) -> error call goto outside block?
(test (let () (define hi (with-let (inlet 'a 3) (lambda (b) (+ a b)))) (hi 2)) 5) ; but this blocks the local env chain:
;(let ((y 2)) (define hi (with-let (inlet) (lambda (a) (+ a y)))) (hi 1)) -> error y unbound
;quick circular env: (define* (hi (a (curlet))) a) (hi) -- need a lambda equivalent of bacro for defargs
(test (let () (define hi (do ((i 0 (+ i 1))) ((= i 3) (lambda (a) (+ a i))))) (hi 1)) 4)

(test ((lambda* a (list a)) 1 2 3) '((1 2 3)))
(test ((lambda* () #f) 1 2 3) 'error)
(test ((lambda* (a ) (list a)) 1) '(1))
(test ((lambda* (a b ) (list a b)) 1 2) '(1 2))
(test ((lambda* (a b :allow-other-keys ) (list a b)) 1 2 :c 3) '(1 2))
(test ((lambda* (a  . b ) (list a b)) 1 2 3) '(1 (2 3)))
(test ((lambda* (a :rest b ) (list a b)) 1 2 3) '(1 (2 3)))
(test ((lambda* (a :rest b :allow-other-keys ) (list a b)) 1 2 :c 3) '(1 (2 :c 3)))
(test ((lambda* (a b :allow-other-keys ) (list a b)) 1) '(1 #f))
(test ((lambda* (a :allow-other-keys ) (list a)) :b 2) '(#f))
(test ((lambda* (:rest a ) (list a)) 1 2 3) '((1 2 3)))
(test ((lambda* (:rest a b ) (list a b)) 1 2 3) '((1 2 3) 2))
(test ((lambda* (:rest a b :allow-other-keys ) (list a b)) :c 1 2 3) '((:c 1 2 3) 1)) ; seems inconsistent
(test ((lambda* (:rest a  . b ) (list a b)) 1 2 3) '((1 2 3) (2 3)))
(test ((lambda* (:rest a :rest b ) (list a b)) 1 2 3) '((1 2 3) (2 3)))
(test ((lambda* (:rest a :rest b :allow-other-keys ) (list a b)) 1 2 3) '((1 2 3) (2 3)))
(test ((lambda* (:rest a :allow-other-keys ) (list a)) 1 2 3) '((1 2 3)))
(test ((lambda* (:allow-other-keys ) (list)) :a 1 :c 3) 'error)

(test ((lambda* (:rest a :rest b) (map + a b)) 1 2 3 4 5) '(3 5 7 9))
(test ((lambda* (:rest a c :rest b) (map (lambda (a b) (+ a b c)) a b)) 1 2 3 4 5) '(6 8 10))
(test ((lambda* (a :rest (b 2)) (list a b)) 1 2 3 4) 'error)
(test ((lambda* ((x (values 1 2))) (+ x 1))) 'error)

(let ()
  (define* (f1 (a 0) :allow-other-keys) (+ a 1))
  (let ((f2 (copy f1)))
    (test (f2 :a 1) 2)
    (test (f2 :b 1) 1)))

;;; one place where :rest can't be handled by dotted list:
(let ()
  (define* (f1 :rest args :allow-other-keys) args)
  (test (f1 :a 1 :b 2) '(:a 1 :b 2)))
;;; but its :allow-other-keys isn't needed here anyway:
(let ()
  (define* (f1 . args) args)
  (test (f1 :a 1 :b 2) '(:a 1 :b 2)))
;;; but
(let ()
  (define* (f1 (c 0) . args) args)
  (test (f1 :a 1 :b 2) 'error)    ; unknown key
  (test (f1 :c 1 :b 2) '(:b 2)))

(define* (-nxy- gen (fm 0.0))  ; optimizer test (safe_closure_star_s0)
  (let-set! gen 'fm fm)
  (with-let gen
    fm))
(let ((g (inlet 'fm 1.0)))
  (test (-nxy- g) 0.0)
  (test (-nxy- g) 0.0)
  (test (-nxy- g 0.5) 0.5)
  (test (-nxy- g) 0.0))

#|
(let ()
  ;; quoted arg default bug (from K Matheussen)
  ;;   why is this sometimes an error and other times not??
  (define make-event
    (lambda* ((patternnum 'must-be-defined) (channel 'must-be-defined))
      (if #f (throw "strange"))))
  (define (call-make-event a b)
    (make-event a b))
  (call-make-event :a 0))
|#

(let ((x 1))
  (define fx (lambda* ((a (+ x 1)) (b (let ((y (+ x 1))) (+ y 1)))) (list a b)))
  (define* (fy (a (* x 2)) (b (fx :a 1 :b 2))) (list a b))
  (test (fx) '(2 3))
  (test (fy) '(2 (1 2)))
  (test (fy :a 0) '(0 (1 2))))

#|
(let ((choices (list "a " "b " " . " ":rest " ":allow-other-keys "))
      (args (list "1 " ":a " ":b " ":c ")))

  (define-bacro (display-abc)
    `(format #f "~A ~A" (if (defined? 'a) (symbol->value 'a) '?) (if (defined? 'b) (symbol->value 'b) '?)))

  (define (next-arg str n)

    (let ((expr (string-append str ")")))
      (catch #t
	(lambda ()
	  (let ((val (eval-string expr)))
	    (format #t "~A -> ~A~%" expr val)))
	(lambda args
	  ;(format #t "    ~A: ~A~%" expr (apply format #f (cadr args)))
	  'error)))

    (if (< n 6)
	(for-each
	 (lambda (arg)
	   (next-arg (string-append str arg) (+ n 1)))
	 args)))

  (define (next-choice str n)
    (next-arg (string-append str ") (display-abc)) ") 0)
    (if (< n 4)
	(for-each
	 (lambda (choice)
	   (next-choice (string-append str choice) (+ n 1)))
	 choices)))

  (for-each
   (lambda (choice)
     (next-arg (string-append "((lambda* " choice "(display-abc)) ") 0))
   choices)

  (next-choice "((lambda* (" 0))
|#

(let ()
  (define* (s0-test gen (fm 0.0))
    (let-set! gen 'fm fm)
    (with-let gen
      (+ fm 1.0)))
  (define (tst)
    (let ((g (inlet 'fm 0.0)))
      (num-test (s0-test g) 1.0))
    (let ((g (inlet 'fm 0.0)))
      (num-test (s0-test g 0.0) 1.0)))
  (tst))

;;; here be bugs...
(test ((lambda* a a) :a) '(:a))
(test ((lambda* (a . b) (list a b)) :b 1) '(#f 1)) ; ??? why doesn't the first arg work this way?
(test ((lambda* (a :rest b) (list a b)) :b 1) '(#f 1))
(test ((lambda* (:rest a) (list a)) :a 1) '((:a 1))) ; surely these are inconsistent
(test ((lambda* (a  . b ) (list a b)) :b 1 1) '(#f (1))) ; so if trailer, overwrite is not error?

(test ((lambda* (:rest a b ) (list a b)) 1 1) '((1 1) 1))
(test ((lambda* (:rest a :rest b ) (list a b)) :a 1) '((:a 1) (1)))
(test ((lambda* (:allow-other-keys) #f) :c 1) 'error)
(test ((lambda* (a :allow-other-keys) a) :a) 'error)
(test ((lambda* (a) a) :a) 'error)
(test ((lambda* (a :allow-other-keys) a) :a 1 :a 2) 1) ; this is very tricky to catch
(test ((lambda* (a :allow-other-keys) a) :c :c :c :c) #f)
(test ((lambda* (a :allow-other-keys) a) :c) 'error)
(test ((lambda* (a b :allow-other-keys ) (list a b)) :b :a :c 1) '(#f :a))

(test ((lambda* (a :allow-other-keys ) a) :c 1 1) 1) ; ??
(test ((lambda* (:rest b (a 1)) (list a b))) '(1 ()))
(test ((lambda* (:rest a b c) (list a b c)) 1 2 3 4) '((1 2 3 4) 2 3))

;(test (let ((x 3)) (define* (f (x x)) x) (let ((x 32)) (f))) 3)
(test (let ((x 3)) (define-macro* (f (x x)) `,x) (let ((x 32)) (f))) 32) ; ?? inconsistent with define* perhaps?

(test (let () (define (x x) x) (x 1)) 1)
(test (procedure? (let () (define* (x (x #t)) x) (x x))) #t)
(test (procedure? (let () (define* (x (x x)) x) (x (x x)))) #t)
;(test (procedure? (let () (define* (x (x x)) x) (x))) #t)
(test (apply + ((lambda* ((x (values 1 2 3))) x))) 'error) ; else mv plugged into every 'x in the body??
(test (let () (define* (f (x (values 1 2))) (+ x 1)) (f)) 'error)
(test ((lambda* ((x (lambda* ((y (+ 1 2))) y))) (x))) 3)

  ;;; define-macro
  ;;; define-macro*
  ;;; define-bacro
  ;;; define-bacro*

(test (let ((x 0)) (define-macro* (hi (a (let () (set! x (+ x 1)) x))) `(+ 1 ,a)) (list (let ((x -1)) (list (hi) x)) x)) '((1 0) 0))
(test (let ((x 0)) (define-bacro* (hi (a (let () (set! x (+ x 1)) x))) `(+ 1 ,a)) (list (let ((x -1)) (list (hi) x)) x)) '((1 0) 0))
(test (let ((x 0)) (define-macro* (hi (a (let () (set! x (+ x 1)) x))) `(+ x ,a)) (list (let ((x -1)) (list (hi) x)) x)) '((-1 0) 0))
(test (let ((x 0)) (define-bacro* (hi (a (let () (set! x (+ x 1)) x))) `(+ x ,a)) (list (let ((x -1)) (list (hi) x)) x)) '((-1 0) 0))

(test (let ((x 0)) (define-macro* (hi (a (let () (set! x (+ x 1)) x))) `(let ((x -1)) (+ x ,a))) (list (hi) x)) '(-1 0)) 
(test (let ((x 0)) (let ((x -1)) (+ x (let () (set! x (+ x 1)) x)))) -1)
(test (let ((x 0)) (define-macro (hi a) `(let ((x -1)) (+ x ,a))) (list (hi (let () (set! x (+ x 1)) x)) x)) '(-1 0))
(test (let () (define-macro (hi a) `(let ((b 1)) (+ ,a b))) (hi (+ 1 b))) 3)
(test (let ((b 321)) (define-macro (hi a) `(let ((b 1)) (+ ,a b))) (hi b)) 2)
(test (let ((b 321)) (define-macro* (hi (a b)) `(let ((b 1)) (+ ,a b))) (hi b)) 2)
(test (let ((b 321)) (define-macro* (hi (a b)) `(let ((b 1)) (+ ,a b))) (hi)) 2) ; ???
(test (let ((x 0)) (define-macro* (hi (a (let () (set! x (+ x 1)) x))) `(+ ,a ,a)) (hi)) 3) ; ??? -- default val is substituted directly
;; but (let () (define-macro* (hi a (b a)) `(+ ,a ,b)) (hi 1)) -> "a: unbound variable" -- "a" itself is substituted, but does not exist at expansion(?)

;; can we implement bacros via define-macro* default args?
;;  I don't think so -- macro arguments can't be evaluated in that environment because 
;;  only the default values have been set (on the previous parameters).

;; bacro ignores closure in expansion but macro does not:
(test (let ((x 1)) (define-macro (ho a) `(+ ,x ,a)) (let ((x 32)) (ho 3))) 4)
(test (let ((x 1)) (define-macro (ho a) `(+ x ,a)) (let ((x 32)) (ho 3))) 35)
(test (let ((x 1)) (define-bacro (ho a) `(+ ,x ,a)) (let ((x 32)) (ho 3))) 35)
(test (let ((x 1)) (define-bacro (ho a) `(+ x ,a)) (let ((x 32)) (ho 3))) 35)

(test (let ((x 1)) (define-macro* (ho (a x)) `(+ ,x ,a)) (let ((x 32)) (ho))) 33)
(test (let ((x 1)) (define-macro* (ho (a x)) `(+ x ,a)) (let ((x 32)) (ho))) 64)
(test (let ((x 1)) (define-bacro* (ho (a x)) `(+ x ,a)) (let ((x 32)) (ho))) 64)
(test (let ((x 1)) (define-bacro* (ho (a x)) `(+ ,x ,a)) (let ((x 32)) (ho))) 64)

(test (let ((x 1)) (define-macro* (ho (a (+ x 0))) `(+ ,x ,a)) (let ((x 32)) (ho))) 33)  ;; (+ 32 (+ x 0)) !?! macroexpand is confusing?
(test (let ((x 1)) (define-macro* (ho (a (+ x 0))) `(+ x ,a)) (let ((x 32)) (ho))) 64)   ;; (+ x (+ x 0))
(test (let ((x 1)) (define-bacro* (ho (a (+ x 0))) `(+ x ,a)) (let ((x 32)) (ho))) 64 )
(test (let ((x 1)) (define-bacro* (ho (a (+ x 0))) `(+ ,x ,a)) (let ((x 32)) (ho))) 64 )

(test (let () (define-macro* (hi :rest a) `(list ,@a)) (hi)) ())
(test (let () (define-macro* (hi :rest a) `(list ,@a)) (hi 1)) '(1))
(test (let () (define-macro* (hi :rest a) `(list ,@a)) (hi 1 2 3)) '(1 2 3))
(test (let () (define-macro* (hi a :rest b) `(list ,a ,@b)) (hi 1 2 3)) '(1 2 3))
(test (let () (define-macro* (hi (a 1) :rest b) `(list ,a ,@b)) (hi)) '(1))
(test (let () (define-macro* (hi (a 1) :rest b) `(list ,a ,@b)) (hi 2)) '(2))
(test (let () (define-macro* (hi (a 1) :rest b) `(list ,a ,@b)) (hi :a 2)) '(2))
(test (let () (define-macro* (hi (a 1) :rest b :allow-other-keys) `(list ,a ,@b)) (hi :a 2 :b 3)) '(2 :b 3))
(test (let () (define-macro* (mac1 a :rest b) `(,a ,@b)) (mac1 + 2 3 4)) 9)

					;  (test (let () (define-macro ,@a 23)) 'error)
					;  (test (let () (define-macro ,a 23)) 'error)
					; maybe this isn't right
(let ()
  (define-macro (dw-fs x)
    `(values (lambda () #f) (lambda () ,x) (lambda () #f)))
  (test (dynamic-wind (dw-fs 3)) 3))

(let ()
  (define-macro (flam . args) `(apply format #f "~{~A~^ ~}" '(,args)))
  (test (flam this is a test) "this is a test"))

(test ((lambda* ((a 1) :allow-other-keys) a) :b 1 :a 3) 3)
(test (let () (define-macro* (hi (a 1) :allow-other-keys) `(list ,a)) (hi :b 2 :a 3)) '(3))
(test ((lambda* ((a 1) :rest b :allow-other-keys) b) :c 1 :a 3) ())
(test ((lambda* ((a 1) :rest b :allow-other-keys) b) :b 1 :a 3) 'error) 
;; that is the rest arg is not settable via a keyword and it's an error to try to
;;   do so, even if :allow-other-keys -- ??

(test (let ((x 1)) (define* (hi (a x)) a) (let ((x 32)) (hi))) 1)
(test (let ((x 1)) (define* (hi (a (+ x 0))) a) (let ((x 32)) (hi))) 1)
(test (let ((x 1)) (define* (hi (a (+ x "hi"))) a) (let ((x 32)) (hi))) 'error)
(test (let ((x 1)) (define-macro* (ho (a (+ x "hi"))) `(+ x ,a)) (let ((x 32)) (ho))) 'error)
(test (let ((x 1)) (define-macro (f1) `(+ x 1)) (f1)) 2)

(let ()
  (define-macro (until test . body) `(do () (,test) ,@body))
  (test (let ((i 0) (sum 0)) (until (= i 4) (set! sum (+ sum i)) (set! i (+ i 1))) sum) 6))

(let ()
  (define-macro (glambda args) ; returns an anonymous macro that will return a function given a body
    `(define-macro (,(gensym) . body) 
       `(lambda ,',args ,@body)))

  (test (let ((gf (glambda (a b))))  ; gf is now ready for any body that involves arguments 'a and 'b
	  ((gf (+ a b)) 1 2))        ; apply (lambda (a b) (+ a b)) to '(1 2)
	3))

(let ()
  (define-macro (alambda pars . body)
    `(letrec ((self (lambda* ,pars ,@body)))
       self))
  
  (test ((alambda (n) (if (<= n 0) () (cons n (self (- n 1))))) 9) '(9 8 7 6 5 4 3 2 1))
  
  (define-macro* (aif test then (else #<unspecified>))
    `(let ((it ,test))
       (if it ,then ,else)))
  
  (test (aif (+ 3 2) it) 5)
  (test (aif (> 2 3) it) #<unspecified>)
  (test (aif (> 2 3) #f it) #f)
  )

(let ()
  (define-macro (enum . args)
    `(for-each (let ((ctr -1))
		 (define-macro (m a) 
		   (set! ctr (+ ctr 1)) 
		   `(apply define ',a ,ctr ())))
               ',args))

  (enum a b c)
  (test b 1)
  (test (+ a b c) 3))

(let ()
  (define-bacro* (m (a b)) a)
  (test (let ((b 2)) (m)) 2)
  (test (let ((b 2)) (let ((b 23)) (m))) 23))

(let ()
  (let ((x 1) (y 2)) 
    (define-bacro (bac1 a) `(+ ,x y ,a)) 
    (let ((x 32) (y 64)) 
      (test (bac1 3) 99)))

  (let ((x 1) (y 2)) 
    (define-bacro (bac2 a) 
      (with-let (sublet (funclet bac2) (cons 'a a))
	`(+ ,x y ,a)))
    (let ((x 32) (y 64)) 
      (test (bac2 3) 68)))

  (let ((x 1) (y 2)) 
    (define-bacro (bac3 a) 
      (with-let (sublet (funclet bac3) (cons 'a a))
	(eval `(+ ,x y ,a))))
    (let ((x 32) (y 64)) 
      (test (bac3 3) 6)))

  (let ((x 1) (y 2))
    (define-bacro (bac4 a) 
      (eval `(+ ,x y ,a) (sublet (funclet bac4) (cons 'a a))))
    (let ((x 32) (y 64))
      (test (bac4 3) 37)))

  (let ((x 1) (y 2)) 
    (define-bacro (bac1 a) 
      `(+ ,x y ,a))            ; -> (+ 32 y x)
    (let ((x 32) (y 64)) 
      (test (bac1 x) 128))) ; x=32

  (let ((x 1) (y 2)) 
    (define-bacro (bac2 a) 
      (with-let (sublet (funclet bac2) (cons 'a a))
	`(+ ,x y ,a)))         ; (+ 1 y x)
    (let ((x 32) (y 64)) 
      (test (bac2 x) 97))) ; x=32

  (let ((x 1) (y 2)) 
    (define-bacro (bac3 a) 
      (with-let (sublet (funclet bac3) (cons 'a a))
	(eval `(+ ,x y ,a))))  ; (eval (+ 1 2 1)) -> 4
    (let ((x 32) (y 64)) 
      (test (bac3 x) 4))) ; x=1

  (let ((x 1) (y 2))
    (define-bacro (bac4 a) 
      (eval `(+ ,x y ,a) (sublet (funclet bac4) (cons 'a a))))
					; (eval (+ 32 2 1)) -> 35
    (let ((x 32) (y 64))
      (test (bac4 x) 35))) ; x=1

  (let ((x 1) (y 2)) 
    (define-bacro (bac3 a) 
      (let ((e (with-let (sublet (funclet bac3) (cons 'a a))
		 `(+ ,x y ,a))))
	`(with-let ,(sublet (funclet bac3) (cons 'a a))
	   ,e)))
    (let ((x 32) (y 64)) 
      (test (bac3 3) 6)))

  (let ((x 1) (y 2))
    (define-bacro (bac4 a) 
      (let ((e `(+ ,x y ,a)))
	`(with-let ,(sublet (funclet bac4) (cons 'a a))
	   ,e)))
    (let ((x 32) (y 64))
      (test (bac4 3) 37))))
  
(let () ; need this, else the define-macro below leaks into rootlet
  (let ((e (inlet
	    'mac (apply define-macro 
			(list (list (gensym) 'a) '`(+ ,a 1))))))
    (test ((e 'mac) 3) 4)))

(let ()
  (define-macro (swap a b)
    `(with-let (inlet :e (curlet) :tmp ,a)
       (set! (e ',a) (e ',b))
       (set! (e ',b) tmp)))
  
  (let ((a 1) (b 2))   (swap b a)   (test (list a b)   '(2 1)))
  (let ((tmp 1) (b 2)) (swap b tmp) (test (list tmp b) '(2 1)))
  (let ((a 1) (tmp 2)) (swap a tmp) (test (list a tmp) '(2 1)))
  (let ((tmp 1) (b 2)) (swap tmp b) (test (list tmp b) '(2 1)))
  (let ((a 1) (tmp 2)) (swap tmp a) (test (list a tmp) '(2 1))))

(let ()
  (define-macro (swap a b)
    `(set! ,b (with-let (inlet 'e (curlet) 'tmp ,a) 
		(with-let e (set! ,a ,b))
		tmp)))

  (test (let ((v (vector 1 2))) (swap (v 0) (v 1)) v) #(2 1))
  (test (let ((tmp (cons 1 2))) (swap (car tmp) (cdr tmp)) tmp) '(2 . 1))

  (define-macro (set-swap a b c) `(set! ,b ,c))
  (set! (setter swap) set-swap)

  (test (let ((a 1) (b 2) (c 3) (d 4)) (swap a (swap b (swap c d))) (list a b c d)) '(2 3 4 1))

  (define-macro (rotate . args)
    `(set! ,(args (- (length args) 1))
	   (with-let (inlet 'e (curlet) 'tmp ,(car args))
	     (with-let e 
	       ,@(map (lambda (a b) `(set! ,a ,b)) args (cdr args)))
	     tmp)))

  (test (let ((a 1) (b 2) (c 3)) (rotate a b c) (list a b c)) '(2 3 1))

  (define-macro (mac a) `(+ ,a 1))
  (define-macro* (mac1 (a 32)) `(+ ,a 1))

  (define-macro (fm form)
    (define (expand form)
      (if (pair? form)
	  (if (and (symbol? (car form))
		   (macro? (symbol->value (car form))))
	      (expand (apply macroexpand (list form)))
	      (if (and (eq? (car form) 'set!)
		       (pair? (cdr form))
		       (pair? (cadr form))
		       (macro? (symbol->value (caadr form))))
		  (expand (apply (eval (copy (procedure-source (setter (symbol->value (caadr form)))) :readable))
				 (append (cdadr form) (copy (cddr form)))))
		  (cons (expand (car form))
			(expand (cdr form)))))
	  form))
    (list 'quote (expand form)))
  
  (test (fm (mac 2)) '(+ 2 1))
  (test (fm (mac x)) '(+ x 1))
  (test (fm (mac1 2)) '(+ 2 1))
  (test (fm (mac1)) '(+ 32 1))
  (test (fm (mac (mac1))) '(+ (+ 32 1) 1))
  (test (fm (+ (mac x) (mac1 y))) '(+ (+ x 1) (+ y 1)))
  (test (fm (swap a b)) '(set! b (with-let (inlet 'e (curlet) 'tmp a) (with-let e (set! a b)) tmp)))
  (test (fm (swap a (swap b c)))
	'(set! c (with-let (inlet 'e (curlet) 'tmp a)
		   (with-let e (set! a (set! c (with-let (inlet 'e (curlet) 'tmp b)
						 (with-let e (set! b c)) tmp)))) tmp)))
  (test (fm (rotate a b c)) '(set! c (with-let (inlet 'e (curlet) 'tmp a) (with-let e (set! a b) (set! b c)) tmp)))
  )

#|
;;; would this work in MIT-scheme?
(define-macro (swap a b)
  `(set! ,b (eval `(let ((e ,(the-environment)))
		     (eval `(set! ,',',a ,',',b) e) 
		     tmp) 
		  (let ((e (the-environment)) 
			(tmp ,a)) 
		    (the-environment)))))
|#

(let ()
  ;; how to protect a recursive macro call from being stepped on
  ;; (define-macro (mac a b) `(if (> ,b 0) (let ((,a (- ,b 1))) (mac ,a (- ,b 1))) ,b))
  ;; (mac mac 1)
  ;; attempt to apply the integer 0 to (0 1)?
  ;;    (mac mac 1)
  (define-macro (mac a b)
    (let ((gmac (gensym))) 
      (set! gmac mac) 
      `(if (> ,b 0) 
	   (let ((,a (- ,b 1))) 
	     (,gmac ,a (- ,b 1))) 
	   ,b)))
  (test (mac mac 10) 0))

(let ()
  (define-bacro* (incf var (inc 1)) `(set! ,var (+ ,var ,inc)))
  (define-bacro* (decf var (inc 1)) `(set! ,var (- ,var ,inc)))

  (test (let ((x 0)) (incf x)) 1)
  (test (let ((x 1.5)) (incf x 2.5) x) 4.0)
  (test (let ((x 10)) (decf x (decf x 1)) x) 1) 

  ;; ! -- left to right order I think (let ((x 10)) (set! x (- x (set! x (- x 1))))) so the 3rd x is 10
  ;; Clisp and sbcl return 0: (let ((x 10)) (decf x (decf x (decf x))) x) is also 0
  ;; but in clisp (let ((x 10)) (setf x (- x (setf x (- x 1)))) x) is 1
  ;; I didn't know these cases were different
  ;; (let ((x 10)) (set! x (- x (let () (set! x (- x 1)) x))) x) 1, Guile also says 1
  ;; cltl2 p 134ff is an unreadable discussion of this, but I think it says in this case CL goes right to left
  ;; weird! in CL (decf x (decf x)) != (setf x (- x (setf x (- x 1))))
  ;;   and (let ((x 10)) (let ((val (decf x))) (decf x val) x))?
  ;;   so by adhering to one evaluation order, we lose "referential transparency"? [the phrase is opaque, but that's intentional...]

  (test (let ((x 1+i)) (decf x 0+i)) 1.0))

(let ()

  ;; (define-bacro* (incf var (inc 1)) (set! var (+ (eval var) (eval inc))))
  ;; this form does not actually set the incoming variable (it sets the argument)
  ;; at OP_SET we see set (var (+ (eval var) (eval inc)))
  ;;                  set1 var 1
  ;;                  which leaves x unset
  ;; but below we see set (x 1)
  ;;                  set1 x 1

  (define-bacro* (incf var (inc 1)) (apply set! var (+ (eval var) (eval inc)) ()))
  (define-bacro* (decf var (inc 1)) (apply set! var (- (eval var) (eval inc)) ()))

  (test (let ((x 0)) (incf x)) 1)
  (test (let ((x 1.5)) (incf x 2.5) x) 4.0)
  (test (let ((x 10)) (decf x (decf x 1)) x) 1) 
  (test (let ((x 1+i)) (decf x 0+i)) 1.0))


(let ()
  (define-macro (and-call function . args)
    ;; apply function to each arg, stopping if returned value is #f
    `(and ,@(map (lambda (arg) `(,function ,arg)) args)))

  (let ((lst ()))
    (and-call (lambda (a) (and a (set! lst (cons a lst)))) (+ 1 2) #\a #f (format #t "oops!~%"))
    (test lst (list #\a 3))))

(let ()
  (define-macro (add a . b)
    `(if (null? ',b)
	 ,a
	 (+ ,a (add ,@b))))
  (test (add 1 2 3) 6)
  (test (add 1 (add 2 3) 4) 10))

(let ()
  (define mac (let ((var (gensym))) 
		(define-macro (mac-inner b) 
		  `(#_let ((,var 12)) (#_+ ,var ,b))) 
		mac-inner))
  (test (mac 1) 13)
  (test (let ((a 1)) (mac a)) 13))

(test (eq? call/cc #_call/cc) #t)

(let ((val #f))
  (define-macro (add-1 var)
    `(+ 1 (let ()
	    (set! val ',var)
	    ,var)))
  (define (add-2 var)
    (set! val var)
    (+ 1 var))
  (let ((free #t))
    (let ((res ((if free add-1 add-2) (+ 1 2 3))))
      (if (or (not (equal? val '(+ 1 2 3)))
	      (not (= res 7)))
	  (format #t ";mac/proc[#t]: ~A ~A~%" val res)))
    (set! free #f)
    (let ((res ((if free add-1 add-2) (+ 1 2 3))))
      (if (or (not (equal? val '6))
	      (not (= res 7)))
	  (format #t ";mac/proc[#f]: ~A ~A~%" val res)))))

;; define-macro* default arg expr does not see definition-time closure:
(test (let ((mac #f))
	(let ((a 32))
	  (define-macro* (hi (b (+ a 1))) `(+ ,b 2))
	  (set! mac hi))
	(mac))
      'error) ; ";a: unbound variable, line 4"

(test ((lambda* ((x (let ()
		      (define-macro (hi a)
			`(+ ,a 1))
		      (hi 2))))
		(+ x 1)))
      4)
(test (let () 
	(define-macro* (hi (x (let ()
				(define-macro (hi a)
				  `(+ ,a 1))
				(hi 2))))
	  `(+ ,x 1)) 
	(hi))
      4)

(test (let () (define* (hi b) b) (procedure? hi)) #t)

(test (let ()
	(define (hi a) a)
	(let ((tag (catch #t
			  (lambda () (hi 1 2 3))
			  (lambda args (car args)))))
	  (eq? tag 'wrong-number-of-args)))
      #t)

(test (let ()
	(define (hi a) a)
	(let ((tag (catch #t
			  (lambda () (hi))
			  (lambda args (car args)))))
	  (eq? tag 'wrong-number-of-args)))
      #t)

(test (let ()
	(define* (hi a) a)
	(let ((tag (catch #t
			  (lambda () (hi 1 2 3))
			  (lambda args (car args)))))
	  (eq? tag 'wrong-number-of-args)))
      #t)

(let ()
  ;; shouldn't this be let-if or let-if-and, not if-let?
  ;;   and why not add short-circuiting to it (at the variable bindings point)?
  ;;   not pretty, but we could do this via and-call + sublet
  ;; maybe use and-let* instead
  (define-macro* (if-let bindings true false) 
    (let* ((binding-list (if (and (pair? bindings) (symbol? (car bindings)))
			     (list bindings)
			     bindings))
	   (variables (map car binding-list)))
      `(let ,binding-list
	 (if (and ,@variables)
	     ,true
	     ,false))))

  (test (if-let ((a 1) (b 2)) (list a b) "oops") '(1 2)))

(let ()
  (defmacro old-and-let* (vars . body) ; from guile/1.8/ice-9/and-let-star.scm

  (define (expand vars body)
    (cond
     ((null? vars)
      (if (null? body)
	  #t
	  `(begin ,@body)))
     ((pair? vars)
      (let ((exp (car vars)))
        (cond
         ((pair? exp)
          (cond
           ((null? (cdr exp))
            `(and ,(car exp) ,(expand (cdr vars) body)))
           (else
            (let ((var (car exp)))
              `(let (,exp)
                 (and ,var ,(expand (cdr vars) body)))))))
         (else
          `(and ,exp ,(expand (cdr vars) body))))))
     (else
      (error 'wrong-type-arg "not a proper list" vars))))

  (expand vars body))

  (test (old-and-let* ((hi 3) (ho #f)) (+ hi 1)) #f))

(let ()
#|
  (define-macro (and-let* vars . body)
    `(let () 
       (and ,@(map (lambda (var) 
		     `(apply define ',var))
		   vars)
	    (begin ,@body))))
|#
  (define-macro (and-let* vars . body)      ; bind vars, if any is #f stop, else evaluate body with those bindings
    `(let () (and ,@(map (lambda (v) `(define ,@v)) vars) (begin ,@body))))

  (test (and-let* ((hi 3) (ho #f)) (+ hi 1)) #f)
  (test (and-let* ((hi 3) (ho #t)) (+ hi 1)) 4))


(let () ; from the pro CL mailing list
  (define-macro (do-leaves var tree . body)
    `(let ()
       (define (rec ,var)
	 (if (not (null? ,var))
	     (if (pair? ,var)
		 (begin
		   (rec (car ,var))
		   (rec (cdr ,var)))
		 (begin
		   ,@body))))
       (rec ,tree)))

  (test (let ((lst ())) 
	  (do-leaves hiho '(+ 1 (* 2 3)) 
	    (set! lst (cons hiho lst))) 
	  (reverse lst))
	'(+ 1 * 2 3)))


(test (let () (define (hi :a) :a) (hi 1)) 'error)
(test (let () (define* (hi :a) :a) (hi 1)) 'error)
(test (let () (define* (hi (:a 2)) a) (hi 1)) 'error)
(test (let () (define* (hi (a 1) (:a 2)) a) (hi 1)) 'error)
(test (let () (define* (hi (pi 1)) pi) (hi 2)) 'error)
(test (let () (define* (hi (:b 1) (:a 2)) a) (hi)) 'error)

(test (let () (define* (hi (a 1) (a 2)) a) (hi 2)) 'error)
(test (let () (define (hi a a) a) (hi 1 2)) 'error)
(test (let () (define hi (lambda (a a) a)) (hi 1 1)) 'error)
(test (let () (define hi (lambda* ((a 1) (a 2)) a)) (hi 1 2)) 'error)
(test (let () (define (hi (a 1)) a) (hi 1)) 'error)

(test (let ((_?_0 #f))
	(set! (symbol-setter '_?_0) (lambda args #f))
	(define-macro (_?_0 a) `(+ ,a 1))
	(_?_0 2))
      'error)

(test (let ((_?_1 #f))
	(set! (symbol-setter '_?_1) (lambda args 'error))
	(define-macro (_?_1 a) `(+ ,a 1))
	(_?_1 2))
      'error)

(test (let ((_?_2 #f))
	(set! (symbol-setter '_?_2) (lambda (s v) v))
	(define-macro (_?_2 a) `(+ ,a 1))
	(_?_2 2))
      3)

(let () 
  (define* (hi (a #2d((1 2) (3 4)))) (a 1 0))
  (test (hi) 3)
  (test (hi #2d((7 8) (9 10))) 9))

(let () (define* (f :rest a) a) (test (f :a 1) '(:a 1)))
(let () (define* (f :rest a :rest b) (list a b)) (test (f :a 1 :b 2) '((:a 1 :b 2) (1 :b 2))))

(test (lambda :hi 1) 'error)
(test (lambda (:hi) 1) 'error)
(test (lambda (:hi . :hi) 1) 'error)
(test (lambda (i . i) 1 . 2) 'error)
(test (lambda (i i i i) (i)) 'error)
(test (lambda "hi" 1) 'error)
(test (lambda* ((i 1) i i) i) 'error)
(test (lambda* ((a 1 2)) a) 'error)
(test (lambda* ((a . 1)) a) 'error)
(test (lambda* ((0.0 1)) 0.0) 'error)

(test ((lambda* ((b 3) :rest x (c 1)) (list b c x)) 32) '(32 1 ()))
(test ((lambda* ((b 3) :rest x (c 1)) (list b c x)) 1 2 3 4 5) '(1 3 (2 3 4 5)))
;; these are in s7.html
(test ((lambda* ((a 1) :rest b :rest c) (list a b c)) 1 2 3 4 5) '(1 (2 3 4 5) (3 4 5)))
(test (let () (define-macro (hi a a) `(+ ,a 1)) (hi 1 2)) 'error)
(test (let ((c 1)) (define* (a (b c)) b) (set! c 2) (a)) 2)
(test (let ((c 1)) (define* (a (b c)) b) (let ((c 32)) (a))) 1)
(test (let ((c 1)) (define* (a (b (+ c 1))) b) (set! c 2) (a)) 3)
(test (let ((c 1)) (define* (a (b (+ c 1))) b) (set! c 2) (let ((c 123)) (a))) 3)

(test (let* ((cc 1)
	     (c (lambda () (set! cc (+ cc 1)) cc)))
	(define* (a (b (c))) b)
	(list cc (a) cc))
      (list 1 2 2))

(let ()
  (define* (func (val ((lambda (a) (+ a 1)) 2))) val)
  (test (func) 3)
  (test (func 1) 1))

(let ()
  (define-macro (mac-free-x y)
    `(set! x ,y))
  
  (define (mac-y1)
    (let ((x .1))
      (do ((i 0 (+ i 1))
	   (y 0.5 (+ y x)))
	  ((= i 10) y)
	(if (= i 2)
	    (mac-free-x 1.1)))))
  
  (define (mac-y0)
    (let ((x .1))
      (do ((i 0 (+ i 1))
	   (y 0.5 (+ y x)))
	  ((= i 10) y)
	(if (= i 2)
	    (set! x 1.1)))))
  
  (define-macro (mac-free-v) 
    `(v 1))
  
  (define-macro (set-mac-free-v z)
    `(vector-set! v 1 ,z))
  
  (set! (setter mac-free-v) set-mac-free-v)
  
  (define (mac-y2)
    (let ((v (vector 1.0 0.1 1.2)))
      (do ((i 0 (+ i 1))
	   (y 0.5 (+ y (vector-ref v 1))))
	  ((= i 10) y)
	(if (= i 2)
	    (set! (mac-free-v) 1.1)))))
  
  (define (mac-y3)
    (let ((v (vector 1.0 0.1 1.2)))
      (do ((i 0 (+ i 1))
	   (y 0.5 (+ y (vector-ref v 1))))
	  ((= i 10) y)
	(if (= i 2)
	    (vector-set! v 1 1.1)))))
  
  (let ((y0 (mac-y0))
	(y1 (mac-y1))
	(y2 (mac-y2))
	(y3 (mac-y3)))
    (if (not (morally-equal? y0 y1))
	(format #t "~A: ~A got ~S but expected ~S~%~%" (port-line-number) 'mac-y0 y0 y1))
    (if (not (morally-equal? y2 y3))
	(format #t "~A: ~A got ~S but expected ~S~%~%" (port-line-number) 'mac-y2 y2 y3)))

  (let ((y (+ (mac-y0) (mac-y1) (mac-y2) (mac-y3))))
    (if (> (abs (- y (* 4 9.5))) 1e-9)
	(format #t "(2) ~A: ~A got ~S but expected ~S~%~%" (port-line-number) 'mac-y0 y (* 4 9.5)))))

(let ((val 0))
  (let ()
    (define (f x) 
      (+ x 1))
    (let ()
      (define-macro (m x)
	`(f ,x))
      (let ()
	(define (f x) 
	  (* x x))
	(let ()
	  (set! val (m 2))))))
  (test val 4))

(let ((val 0))
  (let ()
    (define (f x) 
      (+ x 1))
    (let ()
      (define-macro (m x)
	(with-let (inlet 'f f 'x x)
	  `(,f ,x)))
      (let ()
	(define (f x) 
	  (* x x))
	(let ()
	  (set! val (m 2))))))
  (test val 3))




;;; --------------------------------------------------------------------------------
;;; aritable?

(for-each
 (lambda (arg)
   (if (aritable? arg 0)
       (format #t ";(aritable? ~A) -> #t?~%" arg)))
 (list :hi (integer->char 65) 1 #t 3.14 3/4 1.0+1.0i #\f #<eof> #<unspecified>))

(for-each
 (lambda (arg)
   (let ((val (catch #t (lambda () (aritable? abs arg)) (lambda args 'error))))
     (if (not (eq? val 'error))
	 (format #t ";(aritable? abs ~A) -> ~A?~%" arg val))))
 (list :hi (integer->char 65) -1 most-negative-fixnum macroexpand quasiquote (lambda () #f) 
       car #() "hi" (list 1 2) 3.14 3/4 1.0+1.0i #\f #<eof> #<unspecified>))

(test (aritable?) 'error)
(test (aritable? abs) 'error)

(test (aritable? car 0) #f)
(test (aritable? car 1) #t)
(test (aritable? car 2) #f)
(test (aritable? car 3) #f)
(test (aritable? car most-negative-fixnum) 'error)
(test (aritable? car most-positive-fixnum) #f)
(test (aritable? + most-positive-fixnum) #t)
(test (aritable? + 0) #t)
(test (aritable? log 2) #t)
(test (aritable? catch 2) #f)
(test (aritable? set! 0) #f)
(test (aritable? begin 0) #t)
(test (aritable? (random-state 123) 0) #f)
;;; more tests under arity

(test (let () (define-macro (mac1 a b c) `(+ ,a ,b)) (aritable? mac1 2))   #f)
(test (let () (define-macro (mac1 a b . c) `(+ ,a ,b)) (aritable? mac1 2)) #t)
(test (let () (define-bacro (mac1 a b c) `(+ ,a ,b)) (aritable? mac1 1))   #f)
(test (let () (define-bacro (mac1 a b . c) `(+ ,a ,b)) (aritable? mac1 3)) #t)
(test (let () (defmacro mac1 (a b c) `(+ ,a ,b)) (aritable? mac1 4))       #f)
(test (let () (defmacro mac1 (a b . c) `(+ ,a ,b)) (aritable? mac1 2))     #t)
(test (let () (define-macro (mac1 a) `(+ 1 ,a)) (aritable? mac1 0))        #f)

(test (let () (define-macro* (mac1 . a) `(+ ,a ,b)) (aritable? mac1 3))    #t)
(test (let () (define-macro* (mac1 a) `(+ 1 ,a)) (aritable? mac1 0))       #t)

(test (let () (define-macro* (mac1 a :rest b) `(+ 1 ,a)) (aritable? mac1 21)) #t)
(test (let () (define-macro* (mac1 a . b) `(,a ,@b)) (aritable? mac1 4))   #t)
(test (let () (define-macro* (mac1 a b c) `(+ ,a ,b)) (aritable? mac1 2))  #t)

(test (aritable? "hiho" 0) #f)
(test (aritable? "" 1) #f)
(test (aritable? () 0) #f)
(test (aritable? #() 1) #f)
(test (aritable? #(1 2 3) 0) #f)
(test (aritable? #(1 2 3) -1) 'error)
(test (aritable? #(1 2 3) 1) #t)
(test (aritable? #(1 2 3) 2) #f)
(test (aritable? (hash-table '(a . 1)) 1) #t)
(test (aritable? (hash-table '(a . 1)) 2) #f)
(test (aritable? (curlet) 1) #t)
(test (let () (call-with-exit (lambda (goto) (aritable? goto 1)))) #t)
(test (aritable? (make-iterator (hash-table '(a . 1))) 0) #t)
(test (aritable? (make-iterator (hash-table '(a . 1))) 1) #f)
(test (aritable? "" 0) #f)
(test (aritable? "12" 2) #f)
(test (aritable? "12" 1) #t)
(test (aritable? #() 0) #f) ; since (#() 0) or any other arg is an error
(test (aritable? #2d((1 2) (3 4)) 0) #f)
(test (aritable? #2d((1 2) (3 4)) 1) #t)
(test (aritable? #2d((1 2) (3 4)) 2) #t)
(test (aritable? #2d((1 2) (3 4)) 3) #f)
(test (aritable? '((1 2) (3 4)) 2) #f)

(test (aritable? '(1 2 . 3) 9223372036854775806) #f)
(test (aritable? #2D((1 3) (2 4)) 9223372036854775807) #f)
(test (aritable? '2 1) #f)
(test (aritable? ''2 1) #t)




;;; --------------------------------------------------------------------------------
;;; arity

(test (arity) 'error)
(test (arity abs 1) 'error)

(for-each
 (lambda (arg)
   (if (arity arg)
       (format #t ";(arity ~A) -> ~A?~%" arg (arity arg))))
 (list :hi (integer->char 65) 1 #t 3.14 3/4 1.0+1.0i #\f #<eof> #<unspecified> #<undefined> () 'a))


#|
(let ((choices (list "a " "b " " . " ":rest " ":allow-other-keys ")))
  (define (next-arg expr)
    (catch #t
      (lambda ()
	;(format #t "expr: ~A~%" expr)
	(let ((func (eval-string expr)))
	  (let ((min-max (arity func)))
	    (format #t "(test (arity ~A) ~70T'~A)~%" expr min-max)
	    (if (> (cdr min-max) 6)
		(set! (cdr min-max) 6))
	    (do ((i 0 (+ i 1)))
		((= i (car min-max)))
	      (if (aritable? func i)
		  (format #t ";~A: arity: ~A, arg: ~A?~%" expr min-max i)))
	    (do ((i (car min-max) (+ i 1)))
		((> i (cdr min-max)))
	      (if (not (aritable? func i))
		  (format #t ";~A: arity: ~A, arg: ~A?~%" expr min-max i)))
	    (do ((i (+ 1 (cdr min-max)) (+ i 1)))
		((>= i 6))
	      (if (aritable? func i)
		  (format #t ";~A: arity: ~A, arg: ~A?~%" expr min-max i)))
	    )))
	(lambda args
	  ;(format #t "    ~A: ~A~%" expr (apply format #f (cadr args)))
	  'error)))

  (define (next-choice str n)
    (next-arg (string-append str ") #f)"))
    (if (< n 6)
	(for-each
	 (lambda (choice)
	   (next-choice (string-append str choice) (+ n 1)))
	 choices)))

  (for-each
   (lambda (choice)
     (next-arg (string-append "(lambda* " choice "#f)")))
   choices)

  (next-choice "(lambda* (" 0))
|#

(test (arity (lambda a a)) (cons 0 *max-arity*))
(test (arity (define (_m_ . a) a)) (cons 0 *max-arity*))
(test (arity (lambda (a . b) a)) (cons 1 *max-arity*))
(test (arity (define (_m_ a . b) a)) (cons 1 *max-arity*))
(test (arity (lambda (a b . c) a)) (cons 2 *max-arity*))
(test (arity (define (_m_ a b . c) a)) (cons 2 *max-arity*))
(test (arity (define* (a b . c) a)) (cons 0 *max-arity*))
(test (arity (define-macro (_m_ a . b) a)) (cons 1 *max-arity*))

(test (arity (lambda* a #f))                                         (cons 0 *max-arity*))
(test (arity (lambda* () #f))                                        '(0 . 0))
(test (arity (lambda* (a ) #f))                                      '(0 . 1))
(test (arity (lambda* (a b ) #f))                                    '(0 . 2))
(test (arity (lambda* (a b :allow-other-keys ) #f))                  (cons 0 *max-arity*))
(test (arity (lambda* (a  . b ) #f))                                 (cons 0 *max-arity*))
(test (arity (lambda* (a :rest b ) #f))                              (cons 0 *max-arity*))
(test (arity (lambda* (a :rest b :allow-other-keys ) #f))            (cons 0 *max-arity*))
(test (arity (lambda* (a :allow-other-keys ) #f))                    (cons 0 *max-arity*))
(test (arity (lambda* (:rest a ) #f))                                (cons 0 *max-arity*))
(test (arity (lambda* (:rest a b ) #f))                              (cons 0 *max-arity*))
(test (arity (lambda* (:rest a b :allow-other-keys ) #f))            (cons 0 *max-arity*))
(test (arity (lambda* (:rest a  . b ) #f))                           (cons 0 *max-arity*))
(test (arity (lambda* (:rest a :rest b ) #f))                        (cons 0 *max-arity*))
(test (arity (lambda* (:rest a :rest b :allow-other-keys ) #f))      (cons 0 *max-arity*))
(test (arity (lambda* (:rest a :allow-other-keys ) #f))              (cons 0 *max-arity*))

(test (arity (define* (__a_ . a) #f))                                (cons 0 *max-arity*))
(test (arity (define* (__a_) #f))                                    '(0 . 0))
(test (arity (define* (__a_ a) #f))                                  '(0 . 1))
(test (arity (define* (__a_ a b) #f))                                '(0 . 2))
(test (arity (define* (__a_ a b :allow-other-keys) #f))              (cons 0 *max-arity*))
(test (arity (define* (__a_ a . b) #f))                              (cons 0 *max-arity*))
(test (arity (define* (__a_ a :rest b) #f))                          (cons 0 *max-arity*))
(test (arity (define* (__a_ a :rest b :allow-other-keys) #f))        (cons 0 *max-arity*))
(test (arity (define* (__a_ a :allow-other-keys) #f))                (cons 0 *max-arity*))
(test (arity (define* (__a_ :rest a) #f))                            (cons 0 *max-arity*))
(test (arity (define* (__a_ :rest a b) #f))                          (cons 0 *max-arity*))
(test (arity (define* (__a_ :rest a b :allow-other-keys) #f))        (cons 0 *max-arity*))
(test (arity (define* (__a_ :rest a . b) #f))                        (cons 0 *max-arity*))
(test (arity (define* (__a_ :rest a :rest b) #f))                    (cons 0 *max-arity*))
(test (arity (define* (__a_ :rest a :rest b :allow-other-keys) #f))  (cons 0 *max-arity*))
(test (arity (define* (__a_ :rest a :allow-other-keys) #f))          (cons 0 *max-arity*))

#|
(let ((st (symbol-table)))
  (for-each 
       (lambda (sym)
	 (if (defined? sym)
	     (let ((func (symbol->value sym)))
	       
	       (catch #t
		 (lambda ()
		   (let ((min-max (arity func)))
		     (format #t "(test (arity ~A) ~70T'~A)~%" sym min-max)
		     (if min-max
			 (begin 
			   (if (> (cdr min-max) 6)
			       (set! (cdr min-max) 6))
			   (do ((i 0 (+ i 1)))
			       ((= i (car min-max)))
			     (if (aritable? func i)
				 (format #t ";~A: arity: ~A, arg: ~A?~%" sym min-max i)))
			   (do ((i (car min-max) (+ i 1)))
			       ((> i (cdr min-max)))
			     (if (not (aritable? func i))
				 (format #t ";~A: arity: ~A, arg: ~A?~%" sym min-max i)))
			   (do ((i (+ 1 (cdr min-max)) (+ i 1)))
			       ((>= i 6))
			     (if (aritable? func i)
				 (format #t ";~A: arity: ~A, arg: ~A?~%" sym min-max i)))
			   ))))
		     
		 (lambda args
		   (format #t "    ~A: ~A~%" sym (apply format #f (cadr args)))
		   'error)))))
	     st))
|#

(test (arity *)                                 (cons 0 *max-arity*))
(test (arity +)                                 (cons 0 *max-arity*))
(test (arity -)                                 (cons 1 *max-arity*))
(test (arity /)                                 (cons 1 *max-arity*))
(test (arity curlet)                            '(0 . 0))
(test (arity <)                                 (cons 2 *max-arity*))
(test (arity =)                                 (cons 2 *max-arity*))
(test (arity >)                                 (cons 2 *max-arity*))
(test (arity lambda*)                           (cons 2 *max-arity*))
(test (arity unlet)                             '(0 . 0))
(test (arity call-with-output-file)             '(2 . 2))
(test (arity round)                             '(1 . 1))
(test (arity keyword?)                          '(1 . 1))
(test (arity openlet)                           '(1 . 1))
(test (arity varlet)                            (cons 1 *max-arity*))
(test (arity quote)                             '(1 . 1))
(test (arity <=)                                (cons 2 *max-arity*))
(test (arity with-baffle)                       (cons 1 *max-arity*))
(test (arity >=)                                (cons 2 *max-arity*))
(test (arity sort!)                             '(2 . 2))
(test (arity let->list)                         '(1 . 1))
(test (arity cdaddr)                            '(1 . 1))
(test (arity do)                                (cons 2 *max-arity*))
(test (arity if)                                '(2 . 3))
(test (arity pi)                                '#f)
(test (arity or)                                (cons 0 *max-arity*))
(test (arity *stdin*)                           '#f)
(test (arity complex)                           '(2 . 2))
(test (arity values)                            (cons 0 *max-arity*))
(test (arity string->number)                    '(1 . 2))
(test (arity most-negative-fixnum)              '#f)
(test (arity char-downcase)                     '(1 . 1))
(test (arity char->integer)                     '(1 . 1))
(test (arity vector)                            (cons 0 *max-arity*))
(test (arity call/cc)                           '(1 . 1))
(when (not pure-s7) 
  (test (arity set-current-input-port)          '(1 . 1)))
(test (arity current-input-port)                '(0 . 0))
(test (arity write)                             '(1 . 2))
(test (arity zero?)                             '(1 . 1))
(test (arity char<?)                            (cons 2 *max-arity*))
(when (not pure-s7)
  (test (arity char-ci<?)                       (cons 2 *max-arity*)))
(test (arity infinite?)                         '(1 . 1))
(test (arity open-input-file)                   '(1 . 2))
(test (arity with-let)                          (cons 1 *max-arity*))
(test (arity write-char)                        '(1 . 2))
(test (arity car)                               '(1 . 1))
(test (arity and)                               (cons 0 *max-arity*))
(test (arity cdr)                               '(1 . 1))
(test (arity ash)                               '(2 . 2))
(test (arity define)                            (cons 2 *max-arity*))
(test (arity exp)                               '(1 . 1))
(test (arity lcm)                               (cons 0 *max-arity*))
(test (arity map)                               (cons 2 *max-arity*))
(test (arity let)                               (cons 2 *max-arity*))
(test (arity max)                               (cons 1 *max-arity*))
(test (arity write-byte)                        '(1 . 2))
(test (arity min)                               (cons 1 *max-arity*))
(test (arity log)                               '(1 . 2))
(test (arity not)                               '(1 . 1))
(test (arity append)                            (cons 0 *max-arity*))
(test (arity list-ref)                          (cons 2 *max-arity*))
(test (arity *stderr*)                          '#f)
(test (arity object->string)                    '(1 . 3))
(test (arity string)                            (cons 0 *max-arity*))
(test (arity dynamic-wind)                      '(3 . 3))
(test (arity symbol-setter)                     '(1 . 2))
(test (arity sublet)                            (cons 1 *max-arity*))
(test (arity vector-length)                     '(1 . 1))
(test (arity char-ready?)                       '(0 . 1))
(test (arity random-state->list)                '(0 . 1))
(test (arity with-output-to-file)               '(2 . 2))
(test (arity s7-version)                        '(0 . 0))
(test (arity peek-char)                         '(0 . 1))
(test (arity :rest)                             '#f)
(test (arity aritable?)                         '(2 . 2))
(test (arity ceiling)                           '(1 . 1))
(test (arity define-bacro*)                     (cons 2 *max-arity*))
(test (arity :allow-other-keys)                 '#f)
(test (arity call-with-exit)                    '(1 . 1))
(test (arity gensym)                            '(0 . 1))
(test (arity make-hash-table)                   '(0 . 2))
(test (arity multiple-value-bind)               (cons 2 *max-arity*))
(test (arity setter)                            '(1 . 1))
(test (arity define-bacro)                      (cons 2 *max-arity*))
(test (arity string-append)                     (cons 0 *max-arity*))
(test (arity port-line-number)                  '(0 . 1))
(test (arity dilambda)                          '(2 . 2))
(test (arity letrec*)                           (cons 2 *max-arity*))
(test (arity make-iterator)                     '(1 . 2))
(test (arity random-state)                      '(1 . 2))
(test (arity format)                            (cons 1 *max-arity*))
(test (arity vector-ref)                        (cons 2 *max-arity*))
(test (arity with-input-from-file)              '(2 . 2))
(test (arity cadr)                              '(1 . 1))
(test (arity cond-expand)                       (cons 0 *max-arity*))
(test (arity case)                              (cons 2 *max-arity*))
(test (arity string-set!)                       '(3 . 3))
(test (arity rationalize)                       '(1 . 2))
(test (arity atan)                              '(1 . 2))
(test (arity asin)                              '(1 . 1))
(test (arity assq)                              '(2 . 2))
(test (arity assv)                              '(2 . 2))
(test (arity cond)                              (cons 1 *max-arity*))
(test (arity cons)                              '(2 . 2))
(test (arity copy)                              '(1 . 4))
(test (arity else)                              '#f)
(test (arity eqv?)                              '(2 . 2))
(test (arity define*)                           (cons 2 *max-arity*))
(test (arity eval)                              '(1 . 2))
(test (arity let*)                              (cons 2 *max-arity*))
(test (arity define-macro)                      (cons 2 *max-arity*))
(test (arity nan?)                              '(1 . 1))
(test (arity memq)                              '(2 . 2))
(test (arity memv)                              '(2 . 2))
(test (arity list)                              (cons 0 *max-arity*))
(test (arity load)                              '(1 . 2))
(test (arity for-each)                          (cons 2 *max-arity*))
(test (arity read)                              '(0 . 1))
(test (arity set!)                              '(2 . 2))
(test (arity lambda)                            (cons 2 *max-arity*))
(test (arity set-car!)                          '(2 . 2))
(test (arity set-cdr!)                          '(2 . 2))
(test (arity *features*)                        (cons 1 *max-arity*))
(test (arity *load-hook*)                       '(0 . 1))
(test (arity list-set!)                         (cons 3 *max-arity*))
(test (arity list-tail)                         '(2 . 2))
(test (arity *error-hook*)                      '(0 . 2))
(test (arity current-error-port)                '(0 . 0))
(test (arity define-expansion)                  (cons 2 *max-arity*))
(test (arity symbol->value)                     '(1 . 2))
(test (arity letrec)                            (cons 2 *max-arity*))
(test (arity symbol->string)                    '(1 . 1))
(test (arity funclet)                           '(1 . 1))
(test (arity make-vector)                       '(1 . 2))
(test (arity member)                            '(2 . 3))
(unless pure-s7 (test (arity string-fill!)      '(2 . 4)))
(test (arity hook-functions)                    '(1 . 1))
(test (arity make-hook)                         (cons 0 *max-arity*))
(test (arity number->string)                    '(1 . 2))
(test (arity make-list)                         '(1 . 2))
(test (arity owlet)                             '(0 . 0))
(test (arity open-output-string)                '(0 . 0))
(test (arity rational?)                         '(1 . 1))
(test (arity open-input-string)                 '(1 . 1))
(test (arity documentation)                     '(1 . 1))
(test (arity hash-table-set!)                   '(3 . 3))
(test (arity hash-table-ref)                    (cons 2 *max-arity*))
(test (arity call-with-values)                  '(2 . 2))
(test (arity logand)                            (cons 0 *max-arity*))
(test (arity logior)                            (cons 0 *max-arity*))
(test (arity lognot)                            '(1 . 1))
(test (arity logbit?)                           '(2 . 2))
(test (arity make-string)                       '(1 . 2))
(test (arity logxor)                            (cons 0 *max-arity*))
(test (arity vector-set!)                       (cons 3 *max-arity*))
(test (arity modulo)                            '(2 . 2))
(test (arity begin)                             (cons 0 *max-arity*))
(test (arity catch)                             '(3 . 3))
(test (arity apply)                             (cons 1 *max-arity*))
(test (arity denominator)                       '(1 . 1))
(test (arity arity)                             '(1 . 1))
(test (arity most-positive-fixnum)              '#f)
(test (arity with-output-to-string)             '(1 . 1))
(test (arity assoc)                             '(2 . 3))
(test (arity call-with-input-file)              '(2 . 2))
(test (arity quasiquote)                        '(1 . 1))
(test (arity fill!)                             '(2 . 4))
(test (arity newline)                           '(0 . 1))
(test (arity provided?)                         '(1 . 1))
(test (arity call-with-current-continuation)    '(1 . 1))
(test (arity char-whitespace?)                  '(1 . 1))
(test (arity random)                            '(1 . 2))
(test (arity floor)                             '(1 . 1))
(test (arity read-char)                         '(0 . 1))
(test (arity even?)                             '(1 . 1))
(test (arity error)                             (cons 0 *max-arity*))
(test (arity defined?)                          '(1 . 3))
(test (arity read-byte)                         '(0 . 1))
(test (arity macroexpand)                       '(1 . 1))
(test (arity output-port?)                      '(1 . 1))
(test (arity substring)                         '(2 . 3))
(test (arity string-ref)                        '(2 . 2))
(test (arity *unbound-variable-hook*)           '(0 . 1))
(test (arity display)                           '(1 . 2))
(test (arity read-line)                         '(0 . 2))
(test (arity define-macro*)                     (cons 2 *max-arity*))
(test (arity eval-string)                       '(1 . 2))
(test (arity port-filename)                     '(0 . 1))
(test (arity define-constant)                   (cons 2 *max-arity*))
(test (arity list?)                             '(1 . 1))
(test (arity open-output-file)                  '(1 . 2))
(test (arity rootlet)                           '(0 . 0))
(test (arity quotient)                          '(2 . 2))
(test (arity pair?)                             '(1 . 1))
(test (arity call-with-input-string)            '(2 . 2))
(test (arity random-state?)                     '(1 . 1))
(test (arity with-input-from-string)            '(2 . 2))
(test (arity null?)                             '(1 . 1))
(test (arity eof-object?)                       '(1 . 1))
(test (arity hash-table?)                       '(1 . 1))
(test (arity hash-table)                        (cons 0 *max-arity*))
(test (arity close-output-port)                 '(1 . 1))
(test (arity type-of)                           '(1 . 1))
(test (arity c-pointer)                         '(1 . 3))
(test (arity c-pointer?)                        '(1 . 2))
(test (arity require)                           (cons 1 *max-arity*))
(test (arity provide)                           '(1 . 1))
(test (arity tree-count)                        '(2 . 3))
(test (arity tree-leaves)                       '(1 . 1))
(test (arity tree-memq)                         '(2 . 2))
(test (arity tree-set-memq)                     '(2 . 2))
(test (arity tree-cyclic?)                      '(1 . 1))

(test (let () (define-macro (mac1 a b c) `(+ ,a ,b)) (arity mac1))   '(3 . 3))
(test (let () (define-macro (mac1 a b . c) `(+ ,a ,b)) (arity mac1)) (cons 2 *max-arity*))
(test (let () (define-bacro (mac1 a b c) `(+ ,a ,b)) (arity mac1))   '(3 . 3))
(test (let () (define-bacro (mac1 a b . c) `(+ ,a ,b)) (arity mac1)) (cons 2 *max-arity*))
(test (let () (defmacro mac1 (a b c) `(+ ,a ,b)) (arity mac1))       '(3 . 3))
(test (let () (defmacro mac1 (a b . c) `(+ ,a ,b)) (arity mac1))     (cons 2 *max-arity*))
(test (let () (define-macro (mac1 a) `(+ 1 ,a)) (arity mac1))        '(1 . 1))

(test (let () (define-macro* (mac1 . a) `(+ ,a ,b)) (arity mac1))    (cons 0 *max-arity*))
(test (let () (define-macro* (mac1 a) `(+ 1 ,a)) (arity mac1))       '(0 . 1))

(test (let () (define-macro* (mac1 a :rest b) `(+ 1 ,a)) (arity mac1)) (cons 0 *max-arity*))
(test (let () (define-macro* (mac1 a . b) `(,a ,@b)) (arity mac1))   (cons 0 *max-arity*))
(test (let () (define-macro* (mac1 a b c) `(+ ,a ,b)) (arity mac1))  '(0 . 3))

(test (arity "hiho") '(1 . 1))
(test (arity "") #f) 
(test (arity ()) #f)
(test (arity #()) #f)
(test (arity #(1 2 3)) (cons 1 *max-arity*))
(test (arity (hash-table '(a . 1))) (cons 1 *max-arity*))
(test (arity (curlet)) '(1 . 1))
(test (let () (call-with-exit (lambda (goto) (arity goto)))) (cons 0 *max-arity*))
(test (arity (make-iterator (hash-table '(a . 1)))) (cons 0 0))
(test (arity (let ((a 1)) (make-iterator (curlet)))) (cons 0 0))
(test (arity (random-state 123)) #f)

(when with-block
  (test (procedure? _c_obj_) #t)
  (test (procedure? (setter _c_obj_)) #t)
  (test (signature _c_obj_) (let ((lst (list #t 'c-object? #t))) (set-cdr! (cddr lst) (cddr lst)) lst))
  (test (documentation _c_obj_) "")
  (test (procedure-source _c_obj_) ())
  (test (arity _c_obj_) (cons 0 *max-arity*))
  (test (aritable? _c_obj_ 1) #t))


(define (for-each-subset func args)
  (define (subset source dest len)
    (if (null? source)
	(if (aritable? func len)
	    (apply func dest))
	(begin
	  (subset (cdr source) (cons (car source) dest) (+ len 1))
	  (subset (cdr source) dest len))))
    (subset args () 0))
#|
(define (for-each-subset func args)
  (let ((subsets ()))
    (define (subset source dest len)
      (if (null? source)
	  (begin
	    (if (member dest subsets)
		(format #t ";got ~S twice in for-each-subset: ~S~%" dest args))
	    (set! subsets (cons dest subsets))
	    (if (aritable? func len)
		(apply func dest)))
	  (begin
	    (subset (cdr source) (cons (car source) dest) (+ len 1))
	    (subset (cdr source) dest len))))
    (subset args () 0)))
|#

(test (let ((ctr 0)) (for-each-subset (lambda args (set! ctr (+ ctr 1))) '(1 2 3 4)) ctr) 16)
(test (let ((ctr 0)) (for-each-subset (lambda (arg) (set! ctr (+ ctr 1))) '(1 2 3 4)) ctr) 4)
(test (let ((ctr 0)) (for-each-subset (lambda (arg1 arg2 arg3) (set! ctr (+ ctr 1))) '(1 2 3 4)) ctr) 4)
(test (let ((ctr 0)) (for-each-subset (lambda* (arg1 arg2 arg3) (set! ctr (+ ctr 1))) '(1 2 3 4)) ctr) 15)
(test (let ((ctr 0)) (for-each-subset (lambda () (set! ctr (+ ctr 1))) '(1 2 3 4)) ctr)  1)

;; from stackoverflow scheme
(define (power-set set) 
  (if (null? set) 
      '(()) 
      (let ((power-set-of-rest (power-set (cdr set)))) 
	(append power-set-of-rest 
		(map (lambda (subset) 
		       (cons (car set) subset)) 
		     power-set-of-rest)))))

(define (for-each-powerset f s)
  (for-each (lambda (lst) (apply f lst)) (power-set s)))

(test (let ((sum 0)) (for-each-powerset (lambda args (set! sum (apply + sum args)))  '(1)) sum) 1)
(test (let ((sum 0)) (for-each-powerset (lambda args (set! sum (apply + sum args)))  '(1 2)) sum) 6)
(test (let ((sum 0)) (for-each-powerset (lambda args (set! sum (apply + sum args)))  '(1 2 3)) sum) 24)


(define (snarf func lst)
  "(snarf func lst) repeatedly applies func to as many elements of lst as func can take"
  (let ((arity (arity func)))
    (if (> (cdr arity) 100)
	(apply func lst)
	(let ((n (cdr arity))
	      (lst-len (length lst)))
	  (if (< lst-len (car arity))
	      (error 'wrong-number-of-args ";snarf func requires ~A args, but got ~A, ~A" (car arity) lst-len lst)
	      (if (<= lst-len n)
		  (apply func lst)
		  (if (not (zero? (modulo (length lst) n)))
		      (error 'wrong-number-of-args ";snarf will take ~A args at a time, but got ~A in ~A" n lst-len lst)
		      ;; ideally this would accept partial lists (i.e. left-over < req),
		      ;;   but then we also need to notice that case in the list-tail below
		      (let ()
			
			(define (snarf-1 len f args)
			  (if (not (null? args))
			      (let* ((last (list-tail args (- len 1)))
				     (rest (cdr last)))
				(dynamic-wind
				    (lambda ()
				      (set! (cdr last) ()))
				    (lambda ()
				      (apply func args))
				    (lambda ()
				      (set! (cdr last) rest)))
				(snarf-1 len f rest))))
			
			(snarf-1 n func lst)))))))))

(test (let ((lst '(1 2 3 4))) (catch #t (lambda () (snarf (lambda (a b) (format #t "~A ~A~%" a b c)) lst)) (lambda args 'error)) lst) '(1 2 3 4))
(test (snarf (lambda (a b) (format #t "~A ~A~%" a b)) '(1 2 3 4 5)) 'error)
(test (snarf (lambda (a b) (format #t "~A ~A~%" a b)) '(1)) 'error)
(test (let ((x 0)) (snarf (lambda (a) (set! x (+ x a))) '(1 2 3)) x) 6)
(test (let ((x 0)) (snarf (lambda (a b) (set! x (+ x a b))) '(1 2 3 4)) x) 10)
(test (let ((x 0)) (snarf (lambda* (a b) (set! x (+ x a b))) '(1 2 3 4)) x) 10)
(test (let ((x 0)) (snarf (lambda a (set! x (apply + a))) '(1 2 3 4)) x) 10)
(test (let ((x 0)) (snarf (lambda* (a b (c 0)) (set! x (+ x a b c))) '(1 2)) x) 3)



;;; --------------------------------------------------------------------------------
;;; procedure-source

(for-each
 (lambda (arg)
   (eval-string (format #f "(define (func) ~S)" arg))
   (let ((source (procedure-source func)))
     (let ((val (func)))
       (test val arg))))
 (list -1 #\a 1 #(1 2 3) 3.14 3/4 1.0+1.0i #t #f () #(()) ':hi "hi"))

(for-each
 (lambda (arg)
   (test (procedure-source arg) 'error))
 (list -1 #\a 1 #(1 2 3) 3.14 3/4 1.0+1.0i () 'hi :hi #(()) (list 1 2 3) '(1 . 2) "hi"))

(test (let ((hi (lambda (x) (+ x 1)))) (procedure-source hi)) '(lambda (x) (+ x 1)))
(test (procedure-source) 'error)
(test (procedure-source abs abs) 'error)
(test (procedure-source quasiquote) ())
(test (procedure-source abs) ())
;(test (let () (define-macro (hi a) `(+ 1 ,a)) (cadr (caddr (procedure-source hi)))) '(lambda (a) (list-values '+ 1 a)))

(let ()
  (define (hi a) (+ a x))
  (test ((apply let '((x 32)) (list (procedure-source hi))) 12) 44))
;; i.e. make a closure from (let ((x 32)) <procedure-source hi>)

(let ()
  (define (arg-info f n) 
    ((procedure-source f) 1 n 1 0 2)) ; get the documentation string of f's n-th argument

  (define* (add-1 (arg ((lambda () "arg should be an integer" 0)))) 
    (+ arg 1))          ; the default value of arg is 0

  (test (add-1) 1)
  (test (add-1 1) 2)

  (test (arg-info add-1 0) "arg should be an integer"))



;;; --------------------------------------------------------------------------------
;;; setter

(test (setter) 'error)
(test (setter car cons) 'error)
(test (setter car) set-car!)
(test (setter vector-ref) vector-set!)
(test (setter make-string) #f)
(test (setter quasiquote) #f)

(test (setter cdr) set-cdr!)
(test (setter hash-table-ref) hash-table-set!)
(test (setter list-ref) list-set!)
(test (setter string-ref) string-set!)
(when (not pure-s7)
  (test (setter current-input-port) set-current-input-port)
  (test (setter current-output-port) set-current-output-port))
(test (setter current-error-port) set-current-error-port)

(for-each
 (lambda (arg)
   (test (setter arg) 'error))
 (list -1 #\a #f 1 3.14 3/4 1.0+1.0i ()))
(test (setter :hi) #f) ; setter -> symbol-setter here
(test (setter 'hi) #f)
(let ((sym 3)) (set! (symbol-setter 'sym) (lambda (x) x)) (test (procedure? (setter 'sym)) #t))

(for-each
 (lambda (arg)
   (test (set! (setter abs) arg) 'error))
 (list -1 #\a #t _ht_ _undef_ 1 #(1 2 3) 3.14 3/4 1.0+1.0i () 'hi 'car "car" :hi #(()) (list 1 2 3) '(1 . 2) "hi"))

(let ()
  (define (hiho a) a)
  (define-macro (hiha a) `(+ 1 ,a))
  (define-bacro* (hoha a) `(+ 1 ,a))
  (define pws (dilambda (lambda () 1) (lambda (x) x)))
  (test (setter hiho) #f)
  (test (setter hiha) #f)
  (test (setter hoha) #f)
  (test (procedure? (setter pws)) #t)
  (test ((setter pws) 32) 32)
  )

(test (let ((v #(1 2 3)))
	((setter vector-ref) v 0 32)
	v)
      #(32 2 3))
(test (let ((v #(1 2 3)))
	((setter vector-ref) (let () v) 0 32)
	v)
      #(32 2 3))
(let ()
  (define (vref v i) (vector-ref v i))
  (set! (setter vref) vector-set!)
  (test (let ((v (vector 1 2 3))) (set! (vref v 1) 32) v) #(1 32 3)))

(let-temporarily (((setter cadr)
		   (lambda (lst val) 
		     (set! (car (cdr lst)) val))))
  (test (let ((lst (list 1 2 3))) 
	  (set! (cadr lst) 4) 
	  lst)
	'(1 4 3))
  (test (procedure? (setter cadr)) #t)
  (gc) (gc) ; lint.scm tests this exhaustively
  (test (procedure? (setter cadr)) #t)
  (if (not (procedure? (setter cadr)))
      (format *stderr* "   setter: ~A~%" (setter cadr))))

(let ()
  (define-macro (vref v a) `(vector-ref ,v ,a))
  (define-macro (vset! v a x) `(vector-set! ,v ,a ,x))
  (set! (setter vref) vset!)

  (let ((v (vector 1 2 3)))
    (set! (vref v 1) 32)
    (test v #(1 32 3)))

  (define hi 0)
  (define-macro (xx) `hi)
  (define-macro (set-xx val) `(set! hi ,val))
  (set! (setter xx) set-xx)

  (set! (xx) 32)
  (test hi 32))

(let ()
  (set! (setter logbit?)
	(define-macro (m var index on) ; here we want to set "var", so we need a macro
	    `(if ,on
	         (set! ,var (logior ,var (ash 1 ,index)))
	         (set! ,var (logand ,var (lognot (ash 1 ,index)))))))
  (test (let ((int #b1010)) (set! (logbit? int 0) #t) int) 11))

(let-temporarily (((setter <) <))
  (test (set! (< 3 2) 3) #f)
  (test (set! (< 1) 2) #t))

(let ((old-setter (setter abs))) ; check gc protection
  (set! (setter abs) (define-macro (_m1_ x) `(+ ,x 1)))
  (define-macro (_m1_ x) `(- ,x 1))
  (gc)
  (gc)
  (test (macro? (setter abs)) #t)
  (set! (setter abs) old-setter))

(when with-block
  (let ((b (make-block 3)))
    ((setter b) b 0 1.0)
    (test b (block 1.0 0.0 0.0))))

(let ((str "123")) ((setter str) str 0 #\a) (test str "a23"))
(let ((bv #u8(0 1 2))) ((setter bv) bv 0 3) (test bv #u8(3 1 2)))
(let ((iv #i(0 1 2))) ((setter iv) iv 0 3) (test iv #i(3 1 2)))
(let ((v #(0 1 2))) ((setter v) v 0 3) (test v #(3 1 2)))
(let ((fv #r(0.0 1.0 2.0))) ((setter fv) fv 0 3.0) (test fv #r(3.0 1.0 2.0)))
(let ((lst (list 0 1 2))) ((setter lst) lst 0 3) (test lst '(3 1 2)))
(let ((lt (inlet 'a 3))) ((setter lt) lt 'a 4) (test lt (inlet 'a 4)))
(let ((ht (hash-table* 'a 3))) ((setter ht) ht 'a 4) (test ht (hash-table* 'a 4)))
(test (setter (make-iterator (list 1 2 3))) #f)
(test (setter (inlet)) let-set!)
(test (set! (setter (inlet) (lambda (lt sym val) val))) 'error)
(test (setter (hash-table)) hash-table-set!)

(let ()
  (define flocals
    (let ((x 1))
      (let ((+setter+ (lambda (val) (set! x val)))
	    (+documentation+ (immutable! "this is a test"))
	    (+signature+ '(#t procedure?)))
	(lambda ()
	  x))))

  (test (flocals) 1)
  (test (procedure? (setter flocals)) #t)
  (set! (flocals) 32)
  (test (flocals) 32)
  (test (signature flocals) '(#t procedure?))
  (test (documentation flocals) "this is a test"))

(let ((_x_ 1))
  (define fset (let ((+setter+ (lambda (x) (set! _x_ x)))) (lambda () _x_)))
  (set! (fset) 2) ; make sure this is found even if we haven't previously looked for it (as above)
  (if (not (= _x_ 2)) (format *stderr* "fset setter: ~A~%" _x_))
  (define (fset1) _x_)
  (if (setter fset1) (format *stderr* "fset1 setter: ~A~%" (setter fset1)))
  (set! (setter fset1) (lambda (x) (set! _x_ x)))
  (set! (fset1) 3)
  (if (not (= _x_ 3)) (format *stderr* "fset1 setter: ~A~%" _x_))
  (define fset2 (let ((setter (lambda (f) (lambda (x) (set! _x_ x))))) (lambda () _x_)))
  (set! (fset2) 4)
  (if (not (= _x_ 4)) (format *stderr* "fset2 setter: ~A~%" _x_))

  (define fset3 (let ((+setter+ (lambda (x y) (set! _x_ (+ x y))))) (lambda (y) (+ _x_ y))))
  (set! (fset3 3) 4)
  (if (not (= _x_ 7)) (format *stderr* "fset3 setter: ~A~%" _x_))
  (define fset4 (let ((setter (lambda (f) (lambda (x y) (set! _x_ (+ x y)))))) (lambda (y) (+ _x_ y))))
  (set! (fset4 3) 5)
  (if (not (= _x_ 8)) (format *stderr* "fset4 setter: ~A~%" _x_))

  (set! (setter fset3) #f)
  (test (setter fset3) #f)
  (test (set! (fset3 3) 4) 'error)
  (set! (setter fset3) (lambda (x y) (set! _x_ (+ x y))))
  (test (set! (fset3 3) 4) 7)
  )



;;; --------------------------------------------------------------------------------
;;; documentation

(test (let () (define hi  (let ((+documentation+ "this is a string")) (lambda () 1))) (documentation hi)) "this is a string")
(test (let () (define hi  (let ((+documentation+ "this is a string")) (lambda () 1))) (help hi)) "this is a string")
(test (let () (define hi (let ((+documentation+ "this is a string")) (lambda () 1))) (#_help hi)) "this is a string")
(test (let ((documentation "oops")) (let () (define hi (lambda () 1)) (help hi))) #f)
(test (let () (define hi (let ((+documentation+ "ok")) (lambda () 1))) (documentation hi)) "ok")
(test (let ((documentation "oops")) (define hi (let () (lambda () 1))) (documentation hi)) 'error) ; it's a string here!
(test (let () (define (hi) "this is a string") (hi)) "this is a string")

(test (set! (documentation abs) "X the unknown") 'error)
(test (let ((str (documentation abs))) (set! ((documentation abs) 1) #\x) (equal? str (documentation abs))) #t)
(test (let ((str (documentation abs))) (fill! (documentation abs) #\x) (equal? str (documentation abs))) #t)

(let ()
  (define amac (let ((+documentation+ "this is a string")) (define-macro (_ a) `(+ ,a 1))))
  (test (documentation amac) "this is a string"))
(let ()
  (define amac (let ((+documentation+ "this is a string")) (define-macro* (_ (a 1)) `(+ ,a 1))))
  (test (documentation amac) "this is a string"))
(let ()
  (define amac (let ((+documentation+ "this is a string")) (define-bacro (_ a) `(+ ,a 1))))
  (test (documentation amac) "this is a string"))
(let ()
  (define amac (let ((+documentation+ "this is a string")) (define-bacro* (_ (a 1)) `(+ ,a 1))))
  (test (documentation amac) "this is a string"))
(let ()
  (define-macro (amac a) `(+ ,a 1))
  (test (documentation amac) ""))
(let ()
  (define-bacro (amac a) ,a)
  (test (documentation amac) ""))

(test (documentation abs) "(abs x) returns the absolute value of the real number x")
(test (#_help abs) "(abs x) returns the absolute value of the real number x")
(test (documentation 'abs) "(abs x) returns the absolute value of the real number x")
(test (let ((hi (let ((+documentation+ "this is a test")) (lambda (x) (+ x 1)))))
	(list (hi 1) (documentation hi)))
      (list 2 "this is a test"))
(test (documentation (let ((+documentation+ "docs")) (lambda* (a b) a))) "docs")
(test (documentation (let ((+documentation+ "")) (lambda* (a b) a))) "")
(test (documentation (let ((+documentation+ "args: (a b)")) (lambda* (a b) a))) "args: (a b)")
(test (documentation (call-with-exit (lambda (c) c))) "")
(test (documentation (call/cc (lambda (c) c))) "")
(test (documentation) 'error)
(test (documentation abs abs) 'error)

(if (not (provided? 'snd))
    (for-each
     (lambda (arg)
       (test (documentation arg) 'error)
       (test (help arg) #f))
     (list -1 #\a #f _ht_ _undef_ 1 #(1 2 3) 3.14 3/4 1.0+1.0i () 'hi #(()) (list 1 2 3) '(1 . 2) "hi" :hi)))


(let ((p (dilambda (lambda (a) (+ a 1)) (lambda (a b) (+ a b)))))
  (test (object->string (procedure-source p)) "(lambda (a) (+ a 1))")
  (let ((p1 p)
	(p2 (dilambda (let ((+documentation+ "pws doc")) (lambda (a) (+ a 1))) (lambda (a b) (+ a b)))))
    (test (equal? p p1) #t)
    (test (equal? p1 p2) #f)
    (test (documentation p2) "pws doc")
    (test (apply p2 '(2)) 3)))

(let ((func (eval '(let ((+documentation+ "this is from eval")) (lambda (a) (+ a 1))))))
  (test (func 3) 4)
  (test (documentation func) "this is from eval"))
(test (let ((e (inlet '(x . 3)))) 
	(let ((func (eval '(lambda (a) (+ a x)) e)))
	  (func 2))) 
      5)

(let ((e (openlet (inlet 'help (lambda (obj) "this is helpful")))))
  (test ((if (provided? 'snd) s7-help help) e) "this is helpful"))

(let ()
  (define fdoc (let ((+documentation+ "this is fdoc's doc")) (lambda (x) (+ x 1))))
  (test (documentation fdoc) "this is fdoc's doc")

  (define fdoc* (let ((+documentation+ "this is fdoc*'s doc")) (lambda* ((x 0)) (+ x 1))))
  (test (documentation fdoc*) "this is fdoc*'s doc")

  (define gdoc (let ((documentation (lambda (f) (format #f "this is gdoc's doc: ~S" (funclet f))))) (lambda (x) (+ x 1))))
  (test (documentation gdoc) "this is gdoc's doc: (inlet 'x ())")

  (test (documentation (let ((documentation (lambda (f) "this is lambda's doc"))) (lambda (x) (+ x 1)))) "this is lambda's doc")

  (define mdoc (let ((+documentation+ "mdoc's doc")) (define-macro (_m_ x) `(+ 1 ,x))))
  (test (documentation mdoc) "mdoc's doc")
  
  ;; there is no built-in setter for 'documentation
  )


;;; --------------------------------------------------------------------------------
;;; signature

(test (signature boolean?) '(boolean? #t))
(if (not with-bignums)
    (test (signature round) '(integer? real?)))
(test (signature quasiquote) #f)
(test (signature test) #f)

(for-each
 (lambda (arg)
   (test (documentation arg) 'error))
 (list -1 #\a #f _ht_ _undef_ 1 #(1 2 3) 3.14 3/4 1.0+1.0i () 'hi #(()) (list 1 2 3) '(1 . 2) "hi" :hi))

(test (signature round abs) 'error)
(test (signature) 'error)
(test (signature :rest) #f)

(let ()
  (define f1 (let ((+signature+ '(real? boolean?)))
	       (lambda (x)
		 (if x 1.0 2.0))))
  (test (signature f1) '(real? boolean?))
  (define f2 f1)
  (test (signature f1) '(real? boolean?))
  (test (signature f2) '(real? boolean?))
  (test (f1 #t) (f2 #t))
  (define f3 f1)
  (test (signature f1) '(real? boolean?))
  (test (signature f2) '(real? boolean?))
  (define f4 f2)
  (test (signature f1) '(real? boolean?))
  (test (signature f2) '(real? boolean?)))

(let ()
  (define fsig (let ((+signature+ '(integer? integer?))) (lambda (x) (+ x 1))))
  (test (signature fsig) '(integer? integer?))

  (define fsig* (let ((+signature+ '(integer? integer?))) (lambda* ((x 0)) (+ x 1))))
  (test (signature fsig*) '(integer? integer?))

  (define gsig (let ((signature (lambda (f) (list 'integer? 'integer?)))) (lambda (x) (+ x 1))))
  (test (signature gsig) '(integer? integer?))

  (test (signature (let ((signature (lambda (f) (list 'integer? 'integer?)))) (lambda (x) (+ x 1)))) '(integer? integer?))

  (define msig (let ((+signature+ '(number? #t))) (define-macro (_m_ x) `(+ 1 ,x))))
  (test (signature msig) '(number? #t))
  
  ;; there is no built-in setter for 'signature
  )

(when (not pure-s7)
  (test (signature char-ci<=?) (let ((L (list 'boolean? 'char?))) (set-cdr! (cdr L) (cdr L)) L))
  (test (signature char-ci<?) (let ((L (list 'boolean? 'char?))) (set-cdr! (cdr L) (cdr L)) L))
  (test (signature char-ci=?) (let ((L (list 'boolean? 'char?))) (set-cdr! (cdr L) (cdr L)) L))
  (test (signature char-ci>=?) (let ((L (list 'boolean? 'char?))) (set-cdr! (cdr L) (cdr L)) L))
  (test (signature char-ci>?) (let ((L (list 'boolean? 'char?))) (set-cdr! (cdr L) (cdr L)) L))
  (test (signature char-ready?) '(boolean? input-port?))
  (test (signature exact->inexact) '(number? number?))
  (test (signature exact?) '(boolean? number?))
  (test (signature inexact->exact) '(rational? real?))
  (test (signature inexact?) '(boolean? number?))
  (test (signature integer-length) (let ((L (list 'integer?))) (set-cdr! L L) L))
  (test (signature let->list) '(pair? let?))
  (test (signature list->string) '(string? proper-list?))
  (test (signature list->vector) '(vector? proper-list?))
  (test (signature make-polar) '(number? real? real?))
  (test (signature set-current-error-port) '(output-port? (output-port? boolean?)))
  (test (signature set-current-input-port) '(input-port? input-port?))
  (test (signature set-current-output-port) '(output-port? (output-port? boolean?)))
  (test (signature string->list) (let ((L (list 'proper-list? 'string? 'integer?))) (set-cdr! (cddr L) (cddr L)) L))
  (test (signature string-ci<=?) (let ((L (list 'boolean? 'string?))) (set-cdr! (cdr L) (cdr L)) L))
  (test (signature string-ci<?) (let ((L (list 'boolean? 'string?))) (set-cdr! (cdr L) (cdr L)) L))
  (test (signature string-ci=?) (let ((L (list 'boolean? 'string?))) (set-cdr! (cdr L) (cdr L)) L))
  (test (signature string-ci>=?) (let ((L (list 'boolean? 'string?))) (set-cdr! (cdr L) (cdr L)) L))
  (test (signature string-ci>?) (let ((L (list 'boolean? 'string?))) (set-cdr! (cdr L) (cdr L)) L))
  (test (signature string-copy) '(string? string?))
  (test (signature string-fill!) (let ((L (list '(char? integer?) 'string? 'char? '(integer? boolean?)))) (set-cdr! (cdddr L) (cdddr L)) L))
  (test (signature string-length) '(integer? string?))
  (test (signature vector->list) (let ((L (list 'proper-list? 'vector? '(integer? boolean?)))) (set-cdr! (cddr L) (cddr L)) L))
  (test (signature vector-append) (let ((L (list 'vector?))) (set-cdr! L L) L))
  (test (signature vector-fill!) (let ((L (list #t 'vector? #t 'integer?))) (set-cdr! (cdddr L) (cdddr L)) L))
  (test (signature vector-length) '(integer? vector?))
  )

(test (signature #_exit) '(#t #t))
(test (signature (symbol "(c-object set)")) #f)
(test (signature *) (let ((L (list 'number?))) (set-cdr! L L) L))
(test (signature +) (let ((L (list 'number?))) (set-cdr! L L) L))
(test (signature -) (let ((L (list 'number?))) (set-cdr! L L) L))
(test (signature /) (let ((L (list 'number?))) (set-cdr! L L) L))
(test (signature <) (let ((L (list 'boolean? 'real?))) (set-cdr! (cdr L) (cdr L)) L))
(test (signature <=) (let ((L (list 'boolean? 'real?))) (set-cdr! (cdr L) (cdr L)) L))
(test (signature =) (let ((L (list 'boolean? 'number?))) (set-cdr! (cdr L) (cdr L)) L))
(test (signature >) (let ((L (list 'boolean? 'real?))) (set-cdr! (cdr L) (cdr L)) L))
(test (signature >=) (let ((L (list 'boolean? 'real?))) (set-cdr! (cdr L) (cdr L)) L))
(test (signature abs) '(real? real?))
(test (signature acos) (let ((L (list 'number?))) (set-cdr! L L) L))
(test (signature acosh) (let ((L (list 'number?))) (set-cdr! L L) L))
(test (signature angle) '(real? number?))
(test (signature append) (let ((L (list #t))) (set-cdr! L L) L))
(test (signature apply) (let ((L (list 'values '(procedure? sequence?) #t))) (set-cdr! (cddr L) (cddr L)) L))
(test (signature apply-values) '(#t list?))
(test (signature aritable?) '(boolean? #t integer?))
(test (signature arity) '((pair? boolean?) #t))
(test (signature ash) (let ((L (list 'integer?))) (set-cdr! L L) L))
(test (signature asin) (let ((L (list 'number?))) (set-cdr! L L) L))
(test (signature asinh) (let ((L (list 'number?))) (set-cdr! L L) L))
(test (signature assoc) '((pair? boolean?) #t list? procedure?))
(test (signature assq) '((pair? boolean?) #t list?))
(test (signature assv) '((pair? boolean?) #t list?))
(test (signature atan) '(number? number? real?))
(test (signature atanh) (let ((L (list 'number?))) (set-cdr! L L) L))
(test (signature autoload) '(#t symbol? #t))
(test (signature boolean?) '(boolean? #t))
(test (signature byte-vector) (let ((L (list 'byte-vector? 'integer?))) (set-cdr! (cdr L) (cdr L)) L))
(test (signature byte-vector-ref) '(integer? byte-vector? integer?))
(test (signature byte-vector-set!) '(integer? byte-vector? integer? integer?))
(test (signature byte-vector?) '(boolean? #t))
(test (signature c-object?) '(boolean? #t))
(test (signature c-pointer) '(c-pointer? integer? #t #t))
(test (signature c-pointer?) '(boolean? #t #t))
(test (signature caaaar) '(#t pair?))
(test (signature caaadr) '(#t pair?))
(test (signature caaar) '(#t pair?))
(test (signature caadar) '(#t pair?))
(test (signature caaddr) '(#t pair?))
(test (signature caadr) '(#t pair?))
(test (signature caar) '(#t pair?))
(test (signature cadaar) '(#t pair?))
(test (signature cadadr) '(#t pair?))
(test (signature cadar) '(#t pair?))
(test (signature caddar) '(#t pair?))
(test (signature cadddr) '(#t pair?))
(test (signature caddr) '(#t pair?))
(test (signature cadr) '(#t pair?))
(test (signature call-with-current-continuation) '(values procedure?))
(test (signature call-with-exit) '(values procedure?))
(test (signature call-with-input-file) '(#t string? procedure?))
(test (signature call-with-input-string) '(#t string? procedure?))
(test (signature call-with-output-file) '(#t string? procedure?))
(test (signature call-with-output-string) '(string? procedure?))
(test (signature call/cc) '(values procedure?))
(test (signature car) '(#t pair?))
(test (signature catch) '(values (symbol? boolean?) procedure? procedure?))
(test (signature cdaaar) '(#t pair?))
(test (signature cdaadr) '(#t pair?))
(test (signature cdaar) '(#t pair?))
(test (signature cdadar) '(#t pair?))
(test (signature cdaddr) '(#t pair?))
(test (signature cdadr) '(#t pair?))
(test (signature cdar) '(#t pair?))
(test (signature cddaar) '(#t pair?))
(test (signature cddadr) '(#t pair?))
(test (signature cddar) '(#t pair?))
(test (signature cdddar) '(#t pair?))
(test (signature cddddr) '(#t pair?))
(test (signature cdddr) '(#t pair?))
(test (signature cddr) '(#t pair?))
(test (signature cdr) '(#t pair?))
(test (signature ceiling) '(integer? real?))
(test (signature char->integer) '(integer? char?))
(test (signature char-alphabetic?) '(boolean? char?))
(test (signature char-downcase) (let ((L (list 'char?))) (set-cdr! L L) L))
(test (signature char-lower-case?) '(boolean? char?))
(test (signature char-numeric?) '(boolean? char?))
(test (signature char-position) '((integer? boolean?) (char? string?) string? integer?))
(test (signature char-upcase) (let ((L (list 'char?))) (set-cdr! L L) L))
(test (signature char-upper-case?) '(boolean? char?))
(test (signature char-whitespace?) '(boolean? char?))
(test (signature char<=?) (let ((L (list 'boolean? 'char?))) (set-cdr! (cdr L) (cdr L)) L))
(test (signature char<?) (let ((L (list 'boolean? 'char?))) (set-cdr! (cdr L) (cdr L)) L))
(test (signature char=?) (let ((L (list 'boolean? 'char?))) (set-cdr! (cdr L) (cdr L)) L))
(test (signature char>=?) (let ((L (list 'boolean? 'char?))) (set-cdr! (cdr L) (cdr L)) L))
(test (signature char>?) (let ((L (list 'boolean? 'char?))) (set-cdr! (cdr L) (cdr L)) L))
(test (signature char?) '(boolean? #t))
(test (signature close-input-port) '(unspecified? input-port?))
(test (signature close-output-port) '(unspecified? output-port?))
(test (signature complex) '(number? real? real?))
(test (signature complex?) '(boolean? #t))
(test (signature cons) '(pair? #t #t))
(test (signature continuation?) '(boolean? #t))
(test (signature copy) (let ((L (list #t #t #t 'integer?))) (set-cdr! (cdddr L) (cdddr L)) L))
(test (signature cos) (let ((L (list 'number?))) (set-cdr! L L) L))
(test (signature cosh) (let ((L (list 'number?))) (set-cdr! L L) L))
(test (signature coverlet) (let ((L (list (list 'let? 'procedure? 'macro? 'c-object?)))) (set-cdr! L L) L))
(test (signature curlet) '(let?))
(test (signature current-error-port) '(output-port?))
(test (signature current-input-port) '(input-port?))
(test (signature current-output-port) '(output-port?))
(test (signature cutlet) (let ((L (list 'let? 'let? 'symbol?))) (set-cdr! (cddr L) (cddr L)) L))
(test (signature cyclic-sequences) '(proper-list? #t))
(test (signature defined?) '(boolean? symbol? let? boolean?))
(test (signature delete-file) '(integer? string?))
(test (signature denominator) '(integer? rational?))
(test (signature dilambda) '(procedure? procedure? procedure?))
(test (signature dilambda?) '(boolean? #t))
(test (signature directory->list) '(list? string?))
(test (signature directory?) '(boolean? string?))
(test (signature display) '(#t #t (output-port? boolean?)))
(test (signature dynamic-wind) (let ((L (list 'values 'procedure?))) (set-cdr! (cdr L) (cdr L)) L))
(test (signature emergency-exit) '(#t #t))
(test (signature eof-object?) '(boolean? #t))
(test (signature eq?) (let ((L (list 'boolean? #t))) (set-cdr! (cdr L) (cdr L)) L))
(test (signature equal?) (let ((L (list 'boolean? #t))) (set-cdr! (cdr L) (cdr L)) L))
(test (signature eqv?) (let ((L (list 'boolean? #t))) (set-cdr! (cdr L) (cdr L)) L))
(test (signature error) (let ((L (list 'values 'symbol? #t))) (set-cdr! (cddr L) (cddr L)) L)) ; same
(test (signature eval) '(values #t let?))
(test (signature eval-string) '(values string? let?))
(test (signature even?) '(boolean? integer?))
(test (signature exp) (let ((L (list 'number?))) (set-cdr! L L) L))
(test (signature expt) (let ((L (list 'number?))) (set-cdr! L L) L))
(test (signature file-exists?) '(boolean? string?))
(test (signature file-mtime) '(integer? string?))
(test (signature fill!) (let ((L (list #t 'sequence? #t 'integer?))) (set-cdr! (cdddr L) (cdddr L)) L))
(test (signature float-vector) (let ((L (list 'float-vector? 'real?))) (set-cdr! (cdr L) (cdr L)) L))
(test (signature float-vector-ref) (let ((L (list '(float? float-vector?) 'float-vector? 'integer?))) (set-cdr! (cddr L) (cddr L)) L))
(test (signature float-vector-set!) (let ((L (list 'real? 'float-vector? 'integer? 'integer:real?))) (set-cdr! (cdddr L) (cdddr L)) L))
(test (signature float-vector?) '(boolean? #t))
(test (signature float?) '(boolean? #t))
(test (signature floor) '(integer? real?))
(test (signature flush-output-port) '(#t (output-port? boolean?)))
(test (signature for-each) (let ((L (list 'unspecified? 'procedure? 'sequence?))) (set-cdr! (cddr L) (cddr L)) L))
(test (signature format) (let ((L (list '(string? boolean?) #t))) (set-cdr! (cdr L) (cdr L)) L))
(test (signature funclet) '((let? null?) procedure?))
(test (signature gc) '(#t boolean?))
(test (signature gcd) (let ((L (list 'rational?))) (set-cdr! L L) L))
(test (signature gensym) '(gensym? string?))
(test (signature gensym?) '(boolean? #t))
(test (signature get-output-string) '(string? output-port? boolean?))
(test (signature getenv) (let ((L (list 'string?))) (set-cdr! L L) L))
(test (signature hash-table) (let ((L (list 'hash-table? 'list?))) (set-cdr! (cdr L) (cdr L)) L))
(test (signature hash-table*) (let ((L (list 'hash-table? #t))) (set-cdr! (cdr L) (cdr L)) L))
(test (signature hash-table-entries) '(integer? hash-table?))
(test (signature hash-table-ref) (let ((L (list #t 'hash-table? #t))) (set-cdr! (cddr L) (cddr L)) L))
(test (signature hash-table-set!) '(#t hash-table? #t #t))
(test (signature hash-table?) '(boolean? #t))
(test (signature imag-part) '(real? number?))
(test (signature immutable!) '(#t #t))
(test (signature immutable?) '(boolean? #t))
(test (signature infinite?) '(boolean? number?))
(test (signature inlet) (let ((L (list 'let? #t))) (set-cdr! (cdr L) (cdr L)) L))
(test (signature input-port?) '(boolean? #t))
(test (signature int-vector) (let ((L (list 'int-vector? 'integer?))) (set-cdr! (cdr L) (cdr L)) L))
(test (signature int-vector-ref) (let ((L (list '(integer? int-vector?) 'int-vector? 'integer?))) (set-cdr! (cddr L) (cddr L)) L))
(test (signature int-vector-set!) (let ((L (list 'integer? 'int-vector? 'integer?))) (set-cdr! (cddr L) (cddr L)) L))
(test (signature int-vector?) '(boolean? #t))
(test (signature integer->char) '(char? integer?))
(test (signature integer-decode-float) '(pair? float?))
(test (signature integer?) '(boolean? #t))
(test (signature iterate) '(#t iterator?))
(test (signature iterator-at-end?) '(boolean? iterator?))
(test (signature iterator-sequence) '(sequence? iterator?))
(test (signature iterator?) '(boolean? #t))
(test (signature keyword->symbol) '(symbol? keyword?))
(test (signature keyword?) '(boolean? #t))
(test (signature lcm) (let ((L (list 'rational?))) (set-cdr! L L) L))
(test (signature length) '((real? boolean?) #t))
(test (signature let-ref) '(#t let? symbol?))
(test (signature let-set!) '(#t let? symbol? #t))
(test (signature let?) '(boolean? #t))
(test (signature list) (let ((L (list 'proper-list? #t))) (set-cdr! (cdr L) (cdr L)) L))
(test (signature list-ref) (let ((L (list #t 'pair? 'integer?))) (set-cdr! (cddr L) (cddr L)) L))
(test (signature list-set!) (let ((L (list #t 'pair? 'integer? 'integer:any?))) (set-cdr! (cdddr L) (cdddr L)) L))
(test (signature list-tail) '(#t pair? integer?))
(test (signature list?) '(boolean? #t))
(test (signature load) '(values string? let?))
(test (signature log) (let ((L (list 'number?))) (set-cdr! L L) L))
(test (signature logand) (let ((L (list 'integer?))) (set-cdr! L L) L))
(test (signature logbit?) (let ((L (list 'boolean? 'integer?))) (set-cdr! (cdr L) (cdr L)) L))
(test (signature logior) (let ((L (list 'integer?))) (set-cdr! L L) L))
(test (signature lognot) (let ((L (list 'integer?))) (set-cdr! L L) L))
(test (signature logxor) (let ((L (list 'integer?))) (set-cdr! L L) L))
(test (signature macro?) '(boolean? #t))
(test (signature magnitude) '(real? number?))
(test (signature make-byte-vector) (let ((L (list 'byte-vector? 'integer?))) (set-cdr! (cdr L) (cdr L)) L))
(test (signature make-float-vector) '(float-vector? (integer? pair?) real?))
(test (signature make-hash-table) '(hash-table? integer? (procedure? pair?)))
(test (signature make-int-vector) '(int-vector? (integer? pair?) integer?))
(test (signature make-iterator) '(iterator? sequence? pair?))
(test (signature make-list) '(proper-list? integer? #t))
(test (signature make-rectangular) '(number? real? real?))
(test (signature make-shared-vector) '(vector? vector? (pair? integer?) integer?))
(test (signature make-string) '(string? integer? char?))
(test (signature make-vector) '(vector? (integer? pair?) #t))
(test (signature map) (let ((L (list 'list? 'procedure? 'sequence?))) (set-cdr! (cddr L) (cddr L)) L))
(test (signature max) (let ((L (list 'real?))) (set-cdr! L L) L))
(test (signature member) '((pair? boolean?) #t list? procedure?))
(test (signature memq) '((pair? boolean?) #t list?))
(test (signature memv) '((pair? boolean?) #t list?))
(test (signature min) (let ((L (list 'real?))) (set-cdr! L L) L))
(test (signature modulo) (let ((L (list 'real?))) (set-cdr! L L) L))
(test (signature morally-equal?) (let ((L (list 'boolean? #t))) (set-cdr! (cdr L) (cdr L)) L))
(test (signature nan?) '(boolean? number?))
(test (signature negative?) '(boolean? real?))
(test (signature newline) '(char? (output-port? boolean?)))
(test (signature not) '(boolean? #t))
(test (signature null?) '(boolean? #t))
(test (signature number->string) '(string? number? integer?))
(test (signature number?) '(boolean? #t))
(test (signature numerator) '(integer? rational?))
(test (signature object->string) '(string? #t (boolean? keyword?) integer?))
(test (signature odd?) '(boolean? integer?))
(test (signature open-input-file) '(input-port? string? string?))
(test (signature open-input-string) '(input-port? string?))
(test (signature open-output-file) '(output-port? string? string?))
(test (signature open-output-string) '(output-port?))
(test (signature openlet) (let ((L (list (list 'let? 'procedure? 'macro? 'c-object?)))) (set-cdr! L L) L))
(test (signature openlet?) '(boolean? #t))
(test (signature outlet) '(let? let?))
(test (signature output-port?) '(boolean? #t))
(test (signature owlet) '(let?))
(test (signature pair-filename) '((string? boolean?) pair?))
(test (signature pair-line-number) '((integer? boolean?) pair?))
(test (signature pair?) '(boolean? #t))
(test (signature peek-char) '((char? eof-object?) input-port?))
(test (signature port-closed?) '(boolean? (input-port? output-port?)))
(test (signature port-filename) '(string? (input-port? output-port?)))
(test (signature port-line-number) '(integer? input-port?))
(test (signature positive?) '(boolean? real?))
(test (signature documentation) '(string? procedure?))
(test (signature setter) '(#t procedure?))
(test (signature procedure-source) '(list? procedure?))
(test (signature procedure?) '(boolean? #t))
(test (signature proper-list?) '(boolean? #t))
(test (signature provide) '(symbol? symbol?))
(test (signature provided?) '(boolean? symbol?))
(test (signature quasiquote) #f)
(test (signature quotient) (let ((L (list 'real?))) (set-cdr! L L) L))
(test (signature random) '(number? number? random-state?))
(test (signature random-state) (let ((L (list 'random-state? 'integer?))) (set-cdr! (cdr L) (cdr L)) L))
(test (signature random-state->list) '(pair? random-state?))
(test (signature random-state?) '(boolean? #t))
(test (signature rational?) '(boolean? #t))
(test (signature rationalize) '(rational? real? real?))
(test (signature read) '(#t input-port?))
(test (signature read-byte) '((integer? eof-object?) input-port?))
(test (signature read-char) '((char? eof-object?) input-port?))
(test (signature read-line) '((string? eof-object?) input-port? boolean?))
(test (signature read-string) '((string? eof-object?) integer? input-port?))
(test (signature real-part) '(real? number?))
(test (signature real?) '(boolean? #t))
(test (signature remainder) (let ((L (list 'real?))) (set-cdr! L L) L))
(test (signature reverse!) '(sequence? sequence?))
(test (signature reverse) '(sequence? sequence?))
(test (signature rootlet) '(let?))
(test (signature round) '(integer? real?))
(test (signature s7-version) (let ((L (list 'string?))) (set-cdr! L L) L))
(test (signature sequence?) '(boolean? #t))
(test (signature set-car!) '(#t pair? #t))
(test (signature set-cdr!) '(#t pair? #t))
(test (signature signature) '((pair? boolean?) #t))
(test (signature sin) (let ((L (list 'number?))) (set-cdr! L L) L))
(test (signature sinh) (let ((L (list 'number?))) (set-cdr! L L) L))
(test (signature sort!) '(sequence? sequence? procedure?))
(test (signature sqrt) (let ((L (list 'number?))) (set-cdr! L L) L))
(test (signature stacktrace) '(string? integer? integer? integer? integer? boolean?))
(test (signature string) (let ((L (list 'string? 'char?))) (set-cdr! (cdr L) (cdr L)) L))
(test (signature string->byte-vector) '(byte-vector? string?))
(test (signature string->keyword) '(keyword? string?))
(test (signature string->number) '((number? boolean?) string? integer?))
(test (signature string->symbol) '(symbol? string?))
(test (signature string-append) (let ((L (list 'string?))) (set-cdr! L L) L))
(test (signature string-downcase) (let ((L (list 'string?))) (set-cdr! L L) L))
(test (signature string-position) '((integer? boolean?) string? string? integer?))
(test (signature string-ref) '(char? string? integer?))
(test (signature string-set!) '(char? string? integer? char?))
(test (signature string-upcase) (let ((L (list 'string?))) (set-cdr! L L) L))
(test (signature string<=?) (let ((L (list 'boolean? 'string?))) (set-cdr! (cdr L) (cdr L)) L))
(test (signature string<?) (let ((L (list 'boolean? 'string?))) (set-cdr! (cdr L) (cdr L)) L))
(test (signature string=?) (let ((L (list 'boolean? 'string?))) (set-cdr! (cdr L) (cdr L)) L))
(test (signature string>=?) (let ((L (list 'boolean? 'string?))) (set-cdr! (cdr L) (cdr L)) L))
(test (signature string>?) (let ((L (list 'boolean? 'string?))) (set-cdr! (cdr L) (cdr L)) L))
(test (signature string?) '(boolean? #t))
(test (signature sublet) (let ((L (list 'let? '(let? null?) '(pair? symbol? let?) #t))) (set-cdr! (cdddr L) (cddr L)) L))
(test (signature substring) (let ((L (list 'string? 'string? 'integer?))) (set-cdr! (cddr L) (cddr L)) L))
(test (signature symbol) (let ((L (list 'symbol? 'string?))) (set-cdr! (cdr L) (cdr L)) L))
(test (signature symbol->dynamic-value) '(#t symbol?))
(test (signature symbol->keyword) '(keyword? symbol?))
(test (signature symbol->string) '(string? symbol?))
(test (signature symbol->value) '(#t symbol? let?))
(test (signature symbol-setter) '((boolean? procedure?) symbol? let?))
(test (signature symbol-table) '(vector?))
(test (signature symbol?) '(boolean? #t))
(test (signature system) '((integer? string?) string? boolean?))
(test (signature tan) (let ((L (list 'number?))) (set-cdr! L L) L))
(test (signature tanh) (let ((L (list 'number?))) (set-cdr! L L) L))
(test (signature throw) (let ((L (list 'values 'symbol? #t))) (set-cdr! (cddr L) (cddr L)) L)) ; was pcl_t
(test (signature tree-count) '(integer? #t #t integer?))
(test (signature tree-leaves) '(integer? #t))
(test (signature tree-memq) '(boolean? #t #t))
(test (signature tree-set-memq) '(boolean? #t #t))
(test (signature tree-cyclic?) '(boolean? #t))
(test (signature truncate) '(integer? real?))
(test (signature type-of) '((symbol? boolean?) #t))
(test (signature unlet) '(let?))
(test (signature values) (let ((L (list 'values #t))) (set-cdr! (cdr L) (cdr L)) L))
(test (signature varlet) (let ((L (list 'let? '(let? null?) '(pair? symbol? let?) #t))) (set-cdr! (cdddr L) (cddr L)) L))
(test (signature vector) (let ((L (list 'vector? #t))) (set-cdr! (cdr L) (cdr L)) L))
(test (signature vector-dimensions) '(pair? vector?))
(test (signature vector-ref) (let ((L (list #t 'vector? 'integer?))) (set-cdr! (cddr L) (cddr L)) L))
(test (signature vector-set!) (let ((L (list #t 'vector? 'integer? 'integer:any?))) (set-cdr! (cdddr L) (cdddr L)) L))
(test (signature vector?) '(boolean? #t))
(test (signature with-input-from-file) '(#t string? procedure?))
(test (signature with-input-from-string) '(#t string? procedure?))
(test (signature with-output-to-file) '(#t string? procedure?))
(test (signature with-output-to-string) '(string? procedure?))
(test (signature write) '(#t #t (output-port? boolean?)))
(test (signature write-byte) '(integer? integer? (output-port? boolean?)))
(test (signature write-char) '(char? char? (output-port? boolean?)))
(test (signature write-string) (let ((L (list 'string? 'string? '(output-port? boolean?) 'integer?))) (set-cdr! (cdddr L) (cdddr L)) L))
(test (signature zero?) '(boolean? number?))
(test (signature make-hook) '(procedure?))
(test (signature hook-functions) '(#t procedure?))

(test (signature 'abs) (signature abs)) ; for lint mainly
(test (signature #(1 2)) (let ((lst (list #t 'vector? 'integer?))) (set-cdr! (cddr lst) (cddr lst)) lst))
(test (signature #i(1 2)) (let ((lst (list 'integer? 'int-vector? 'integer?))) (set-cdr! (cddr lst) (cddr lst)) lst))
(test (signature #r(1.0 2.0)) (let ((lst (list 'float? 'float-vector? 'integer?))) (set-cdr! (cddr lst) (cddr lst)) lst))
(test (signature #u8(1 2)) '(integer? byte-vector? integer?))
(test (signature "12") '(char? string? integer?))
(test (signature '(1 2)) (let ((lst (list #t 'pair? 'integer?))) (set-cdr! (cddr lst) (cddr lst)) lst))
(test (signature (hash-table* 'a 1)) '(#t hash-table? #t))
(test (signature (inlet 'a 1)) '(#t let? #t))
(test (signature (openlet (inlet 'a 1 'signature (lambda (obj) (list 'integer? 'let? 'symbol?))))) '(integer? let? symbol?))


#|
(define (show-cycle sig)
  (format *stderr* "(let ((L (list")
  (do ((L sig (cdr L))
       (k 0 (+ k 1))
       (done #f))
      (done)
    (if (not (boolean? (car L)))
	(format *stderr* " '~A" (car L))
	(format *stderr* " #t"))
    (let ((inner-done #f))
      (do ((LL sig (cdr LL))
	   (i 0 (+ i 1)))
	  (inner-done)
	(if (eq? LL (cdr L))
	    (begin
	      (set! done #t)
	      (set! inner-done #t)
	      (format *stderr* "))) (set-cdr! ~A ~A) L)"
		      (if (= k 0) "L" (format #f "(c~NCr L)" k #\d))
		      (if (= i 0) "L" (format #f "(c~NCr L)" i #\d))))
	    (if (eq? LL L)
		(set! inner-done #t)))))))

(define (test-sym sym)
  (let ((f (symbol->value sym)))
    (when (procedure? f)
      (let ((sig (signature f)))
	(if (pair? sig)
	    (if (infinite? (length sig))
		(begin (format *stderr* "(test (signature ~A) " sym) (show-cycle sig) (format *stderr* ")~%"))
		(format *stderr* "(test (signature ~A) '~A)~%" sym sig))
	    (format *stderr* "(test (signature ~A) ~A)~%" sym sig))))))
 
(let ((st (symbol-table)))
  (for-each test-sym st))
|#

(define (symbol->value-anywhere sym)
  (if (defined? sym)
      (symbol->value sym)
      (letrec ((libsearch 
		(lambda (sym libs)
		  (if (pair? libs)
		      (if (defined? sym (cdar libs))
			  (symbol->value sym (cdar libs))
			  (libsearch sym (cdr libs)))
		      #<undefined>))))
	(libsearch sym *libraries*))))

(let ((st (symbol-table)))
  (for-each (lambda (s)
	      (catch #t
		(lambda ()
		  (let ((f (symbol->value-anywhere s)))
		    (if (procedure? f)
			(let ((sig (signature f))
			      (ari (arity f)))
			  (if (and sig (not (pair? sig)))
			      (format *stderr* "signature ~A: ~A~%" s sig))
			  (when (pair? sig)
			    (if (and (pair? ari)
				     (> (cdr ari) (- (length sig) 1))
				     (or (< (cdr ari) 20)
					 (< (length sig) 10))
				     (not (eq? s 'make-hook)))
				(format *stderr* "signature is missing arg type: ~A: ~A ~A~%~%" s ari sig))
			    (when (and (pair? sig)
				       (pair? (car sig))
				       (or (null? (cdar sig))
					   (memq #t (car sig))
					   (let search ((lst (car sig)))
					     (and (pair? lst)
						  (or (memq (car lst) (cdr lst))
						      (search (cdr lst)))))))
			      (format *stderr* "arity/sig mismatch? ~A: ~A?~%" s sig)))))))
		(lambda args #f)))
	    st))


;;; --------------------------------------------------------------------------------
;;; funclet

(let ((f1 (lambda (a) (+ a 1)))
      (f2 (lambda* ((a 2)) (+ a 1))))
  (define (hi a) (+ a 1))
  (define* (ho (a 1)) (+ a 1))
  (test (let? (funclet hi)) #t)
  (test (let? (funclet ho)) #t)
  (test (let? (funclet f1)) #t)
  (test (let? (funclet f2)) #t)
  (test (let? (funclet abs)) #t)
  (test (> (length (funclet abs)) 100) #t)
  (test (fill! (funclet abs) 0) 'error)
  (test (reverse (funclet abs)) (rootlet))
  (test (fill! (funclet ho) 0) 'error)
  (test (let? (reverse (funclet ho))) #t))

(test (funclet quasiquote) (rootlet))
(test (funclet lambda) 'error)
(test (funclet abs) (rootlet))
(test (funclet cond-expand) (rootlet))

(let ()
  (define func (let ((lst (list 1 2 3))) 
		 (lambda (a) 
		   (((funclet func) 'lst) a))))
  (test (func 1) 2))

(let ()
  (define func (let ((lst (list 1 2 3))) 
		 (lambda (a) 
		   ((funclet func) 'lst a))))
  (test (func 1) 2))

(let  ((lt (inlet 'a #(1 2 3))))
  (test (lt 'a 1) 2))

(let ()
  (define func (let ((lst (list 1 2 3))) 
		 (lambda (a) 
		   ((list (funclet func)) 0 'lst))))
  (test (func 1) '(1 2 3)))


(for-each
 (lambda (arg)
   (test (funclet arg) 'error))
 (list -1 #\a 1 #(1 2 3) 3.14 3/4 1.0+1.0i () 'hi #(()) (list 1 2 3) '(1 . 2) "hi"))

(test (let ()
	(define (hi a)
	  (let ((func __func__))
	    (list (if (symbol? func) func (car func))
		  a)))
	(hi 1))
      (list 'hi 1))

(set! (hook-functions *unbound-variable-hook*) ())
(catch #t 
  (lambda ()
    (let ()
      (define (f1 e)
	(with-let e
	  (hash-table-set! ht :a (abs x))))
      (f1 (inlet :ht (make-hash-table) :x -1))
      (f1 (inlet :ht (make-hash-table) :x -1))
      (test (f1 (inlet :ht (make-hash-table))) 'error)))
  (lambda args #f))

(catch #t 
  (lambda ()
    (let ()
      (let ((x 1))
	(let ((ht (make-hash-table)))
	  (define (f1)
	    (hash-table-set! ht :a (abs x)))
	  (f1)
	  (set! (outlet (curlet)) (inlet))
	  (test (f1) 'error)))))
  (lambda args #f))

(let ()
  (define (f1)
    (with-output-to-string
      (lambda ()
	(do ((i 0 (+ i 1)))
	    ((= i 3))
	  (with-let (inlet 'x 1)
	    (display x))))))
  (test (f1) "111"))

(let () 
  (define (f1 e) 
    (do ((i 0 (+ i 1))) 
	((= i 3)) 
      (with-let e 
        (hash-table-set! ht :a (abs x)))))
  (f1 (inlet :ht (make-hash-table) :x -1)) 
  (test (f1 (inlet :ht (make-hash-table) :x -1)) #t))

(test (let ()
	(define hi (let ((a 32)) 
		     (lambda (b) 
		       (+ a b))))
	(define ho (with-let 
		    (funclet hi) 
		    (lambda (b) 
		      (+ a b))))
	(list (hi 1) (ho 1)))
      (list 33 33))

(test (let ()
	(define (hi a) (+ a 1))
	(with-let (funclet hi) 
			  ((eval (procedure-source hi)) 2)))
      3)

(let ()
  (define (where-is func)
    (let ((addr (with-let (funclet func) __func__)))
      (if (not (pair? addr))
	  ""
	  (list (format #f "~A[~D]" (cadr addr) (caddr addr))
		addr))))
  (let ((e (where-is ok?)))
    (test (and (pair? (cadr e))
	       (< ((cadr e) 2) 1000)) ; this depends on where ok? is in this file
	  #t)
    (test (and (pair? (cadr e))
	       (string=? (symbol->string (car (cadr e))) "ok?"))
	  #t)
    (test (and (pair? (cadr e))
	       (let ((name (cadr (cadr e))))
		 (and (string? name)
		      (call-with-exit
		       (lambda (oops)
			 (let ((len (length name)))
			   (do ((i 0 (+ i 1)))
			       ((= i len) #t)
			     (if (and (not (char-alphabetic? (name i)))
				      (not (char=? (name i) #\/))
				      (not (char=? (name i) #\\))
				      (not (char=? (name i) #\.))
				      (not (char=? (name i) #\-))
				      (not (char-numeric? (name i))))
				 (begin
				   (format #t "ok? file name: ~S~%" name)
				   (oops #f))))))))))
	  #t)))

(test (let () (define (f1 a) __func__) (let ((fe (f1 1))) (if (pair? fe) (car fe) fe))) 'f1)
(test (let () (define (f1 a) 
		(define (f2 b) __func__) 
		(f2 a)) 
	   (let ((fe (f1 1))) (if (pair? fe) (car fe) fe))) 
      'f2)
(test (let () (define (f1 a) 
		(define (f2 b) 
		  (define (f3 c) __func__) 
		  (f3 b)) 
		(f2 a)) 
	   (let ((fe (f1 2))) (if (pair? fe) (car fe) fe))) 
      'f3)
(test (let () (define (f1 a) 
		(define (f2 b) 
		  (define (f3 c) 
		    (define (f4 d) __func__) 
		    (f4 c)) 
		  (f3 b)) 
		(f2 a)) 
	   (let ((fe (f1 1))) 
	     (if (pair? fe) (car fe) fe)))
      'f4)
(test (let () (define (f1 a) (let () (define (f2 b) __func__) (f2 a))) (let ((fe (f1 1))) (if (pair? fe) (car fe) fe))) 'f2)
(test (with-let (funclet abs) __func__) #<undefined>)
(test (with-let (funclet quasiquote) __func__) #<undefined>)
(test (with-let (funclet reader-cond) __func__) #<undefined>)
(test (with-let (funclet *error-hook*) __func__) 'make-hook)

(let ()
  (define-macro (window func beg end . body)
    `(call-with-exit
      (lambda (quit)
	(do ((notes ',body (cdr notes)))
	    ((null? notes))
	  (let* ((note (car notes))
		 (note-beg (cadr note)))
	    (if (<= ,beg note-beg)
		(if (> note-beg (+ ,beg ,end))
		    (quit)
		    (,func note))))))))
  
  (test 
   (let ((n 0))
     (window (lambda (a-note) (set! n (+ n 1))) 0 1 
	     (fm-violin 0 1 440 .1) 
	     (fm-violin .5 1 550 .1) 
	     (fm-violin 3 1 330 .1))
     n)
   2)
  
  (test 
   (let ((notes 0)
	 (env #f))
     (set! env (curlet))
     (window (with-let env (lambda (n) (set! notes (+ notes 1)))) 0 1 
	     (fm-violin 0 1 440 .1) 
	     (fm-violin .5 1 550 .1) 
	     (fm-violin 3 1 330 .1))
     notes)
   2))

(test (let ()
	(define-macro (window func beg end . body)
	  `(let ((e (curlet)))
	     (call-with-exit
	      (lambda (quit)
		(do ((notes ',body (cdr notes)))
		    ((null? notes))
		  (let* ((note (car notes))
			 (note-beg (cadr note)))
		    (if (<= ,beg note-beg)
			(if (> note-beg (+ ,beg ,end))
			    (quit)
			    ((with-let e ,func) note)))))))))
	
	(let ((notes 0))
	  (window (lambda (n) (set! notes (+ notes 1))) 0 1 
		  (fm-violin 0 1 440 .1) 
		  (fm-violin .5 1 550 .1) 
		  (fm-violin 3 1 330 .1))
	  notes))
      2)

;;; this is version dependent
;;;(let ((a 32)) 
;;;  (define (hi x) (+ x a)) 
;;;  (test (defined? 'bbbbb (funclet hi)) #f)
;;;  (let ((xdef (defined? 'x (funclet hi))))
;;;    (test xdef #t))
;;;  (test (symbol->value 'a (funclet hi)) 32))

(let ()
  (let ((x 32))
    (define (hi a) (+ a x))
    (let ((xx ((funclet hi) 'x)))
      (test xx 32))
    (let ((s7-version 321))
      (test s7-version 321)
      (let ((xxx ((unlet) 'x)))
	(test xxx 32)
	(let ((str (with-let (unlet) (s7-version))))
	  (test (string? str) #t))))))

;;; funclet is a mess but it's hard to test mainly because it's different in different versions of s7
;;;    and the test macro affects it
;;; 
;;; (test (let () (define (func3 a b) (+ a b)) (let->list (funclet func3))) '((b) (a)))
;;; or is it ((__func__ . func3)) in context?
;;; 
;;; ;;; troubles:
;;; (let ((func1 (lambda (a b) (+ a b)))) (symbol->value '__func__ (funclet func1))) -> #<undefined>
;;; (let ((func1 (lambda (a b) (+ a b)))) (eq? (funclet func1) (rootlet))) -> #t
;;; 
;;; (letrec ((func1 (lambda (a b) (+ a b)))) (eq? (funclet func1) (rootlet))) -> #f
;;; (letrec ((func1 (lambda (a b) (+ a b)))) (let->list (funclet func1))) -> ((func1 . #<closure>))
;;; 
;;; (let () (define* (func4 (a 1) b) (+ a b)) (let->list (funclet func4))) -> ((__func__ . func4))
;;; (let () (define-macro (func4 a b) `(+ ,a ,b)) (let->list (funclet func4))) -> ((func4 . #<macro>))
;;; 
;;; (let () (let ((func2 (lambda (a b) (+ a b)))) (let->list (funclet func2)))) -> ()
;;; 
;;; (funclet #<continuation>) -> (rootlet)
;;; (funclet #<goto>) -> (rootlet)
;;; and setter of pws is either global or ()
;;; 
;;; ;;; this returns #t because the fallback in g_procedure_environment is the global env
;;; (eq? (rootlet)
;;;      (let ((a 32))
;;;        (call-with-exit ; or call/cc
;;; 	(lambda (return)
;;; 	  (funclet return)))))
;;; 
;;; (funclet values) -> global env! (like catch/dynamic-wind it's a procedure)
;;; this is also true of (funclet (lambda () 1)) 
;;; 
;;; :(funclet (float-vector 1 2))
;;; (inlet)
;;; :(funclet (vector 1 2))
;;; 					;funclet argument, #(1 2), is a vector but should be a procedure or a macro
;;; 					;    (vector 1 2)
;;; 
;;; :(let ((a 1)) (define-macro (m1 b) `(+ ,a ,b)) (let->list (funclet m1)))
;;; ((a . 1) (m1 . #<macro>))
;;; :(let ((a 1)) (define (m1 b) (+ a b)) (let->list (funclet m1)))
;;; ((b))
;;; :(let ((a 1)) (define (m1 b) (+ a b)) (let->list (outlet (funclet m1))))
;;; ((__func__ . m1))
;;; 
;;; (documentation macroexpand) -> ""  ; also cond-expand

#|
;;; this checks existing procedures
(let ((st (symbol-table)) 
      (p (open-output-file "pinfo")))
  (for-each 
       (lambda (sym)
	 (if (defined? sym)
	     (let ((val (symbol->value sym)))
	       (format p "---------------- ~A ----------------~%" sym)
	       (catch #t 
		      (lambda () 
			(let ((str (documentation val))
			      (sym-name (symbol->string sym)))
			  (if (procedure? val)
			      (if (= (length str) 0)
				  (format p "~A: [no doc]~%" sym)
				  (let ((pos (substring? sym-name str)))
				    (if (and (not pos)
					     (not (char-upper-case? (sym-name 0)))
					     (not (char=? (sym-name 0) #\.))
					     (not (char=? (sym-name 0) #\[)))
					(format p "~A documentation [no matched name]: ~A~%" sym str))))
			      (if (> (length str) 0)
				  (format p "~A (not a procedure) documentation: ~A~%" str)))))
		      (lambda args
			(if (procedure? val)
			    (format p "~A documentation: error: ~A~%" sym (apply format #f (cadr args))))))
	       (catch #t 
		      (lambda () 
			(let ((lst (procedure-source val)))
			  (if (not lst)
			      (if (procedure? val)
				  (format p "~A: [no source]~%" sym))
			      (if (and (not (pair? lst))
				       (not (null? lst)))
				  (format p "~A source: ~A~%" sym lst)))))
		      (lambda args
			(if (procedure? val)
			    (format p "~A source: error: ~A~%" sym (apply format #f (cadr args))))))
	       (catch #t 
		      (lambda () 
			(let ((pe (funclet val)))
			  (if (not pe)
			      (if (procedure? val)
				  (format p "~A: [no environment]~%" sym))
			      (if (not (let? pe))
				  (format p "~A environment:~%" sym pe)
				  (if (not (eq? (rootlet) pe))
				      (format p "~A env: ~A~%" sym (let->list pe)))))))
		      (lambda args
			(if (procedure? val)
			    (format p "~A environment: error: ~A~%" sym (apply format #f (cadr args))))))
	       )))
       st)
  (close-output-port p))
|#




;;; --------------------------------------------------------------------------------
;;; continuation?

(for-each
 (lambda (arg)
   (test (continuation? arg) #f))
 (list -1 #\a 1 #f _ht_ _undef_ #(1 2 3) 3.14 3/4 1.0+1.0i () 'hi abs #(()) (list 1 2 3) '(1 . 2) "hi" (lambda () 1)))
  
(test (let ((cont #f)) 
	(and (call/cc (lambda (x) (set! cont x) (continuation? x)))
	     (continuation? cont)))
      #t)
(test (let ((cont #f)) 
	(or (call-with-exit (lambda (x) (set! cont x) (continuation? x)))
	    (continuation? cont)))
      #f) ; x is not a continuation
	
(test (continuation?) 'error)
(test (continuation? 1 2) 'error)


  
;;; --------------------------------------------------------------------------------
;;; s7-version

(test (string? (s7-version)) #t)
(test (s7-version 1) 'error)
(test (s7-version) (s7-version))



;;; --------------------------------------------------------------------------------
;;; eval
;;; eval-string

;(test (eval-string "(list #b)") 'error)
(test (eval-string "(char? #\\spaces)") #f)
(test (eval-string "(car '( . 1))") 'error)
(test (eval-string "(car '(. ))") 'error)
(test (eval-string "(car '( . ))") 'error)
(test (eval-string "(car '(. . . ))") 'error)
(test (eval-string "#( . 1)") 'error)
(test (eval-string "'(1 2 . )") 'error)
(test (eval-string "#(1 2 . )") 'error)
;(test (eval-string "#'(1 2)") 'error)
;(test (eval-string "#`(1 2)") 'error)
;(test (eval-string "#,(1 2)") 'error)
;(test (eval-string "#`,(1 2)") 'error)
;(test (eval-string "#1(2)") 'error)
(test (eval-string "(+ 1 . . )") 'error)
(test (eval-string "(car '(1 . ))") 'error)
(test (eval-string "(car '(1 . . 2))") 'error)
(test (eval-string "#( . )") 'error)
(test (eval-string "#(1 . )") 'error)
(test (eval-string "#(. . . )") 'error)
(test (eval-string "#(1 . . 2)") 'error)
(test (eval-string "'(. 1)") 'error)
(test (eval-string "#(. 1)") 'error)
(test (eval-string "'(. )") 'error)
(test (eval-string "#(. )") 'error)
(test (eval-string "(list 1 . 2)") 'error)
(test (eval-string "(+ 1 . 2)") 'error)
(test (eval-string "(car '@#`')") 'error)
(test (eval-string "(list . )") 'error)
(test (eval-string "#( .)") 'error)
(test (eval-string "(car '( .))") 'error)
(test (eval-string "(let ((. 3)) .)") 'error)
(test (eval-string "#0d()") 'error)
(test (eval-string "`#0d()") 'error)
;(test (eval-string "'#t:") 'error) ; guile interprets this as #t : and complains unbound variable :
;(test (eval-string "#t1") 'error)  ;   similarly this is #t 1 in guile
(test (eval-string "#(1 . 2)") 'error)
(test (eval-string "#(1 2 . 3)") 'error)
;(test (eval-string "'#'") 'error)
;(test (eval-string "#b") 'error)
(test (eval-string "(+ 123") 'error)
(test (eval-string "(+ 123 0000000000") 'error)
(test (eval-string "(+ 1 2) a mistake") 'error)
(test (eval-string "(+ 1 2) ; a comment") 3)
(test (eval-string "(+ 1 2) #| a block \n  comment |# ; a normal comment\n") 3)
(test (eval-string "(+ 1 2) ()") 'error)
(test (eval-string "(+ 1 2) ; a comment\n a mistake") 'error)
(test (eval-string "(+ 1 2) ") 3)

(test (eval-string "(+ 1 2)") 3)
(test (eval '(+ 1 2)) 3)
(test (eval `(,+ ,1 ,2)) 3)
(test (eval (list + 1 2)) 3)
(test (eval `(+ 1 (eval `(* 2 3)))) 7)
(test (eval `(+ 1 (eval-string "(* 2 3)"))) 7)
(test (eval-string "(+ 1 (eval-string \"(* 2 3)\"))") 7)
(test (eval `(+ 1 2 . 3)) 'error)
(test (eval-string) 'error)
(test (eval) 'error)
(test (eval-string "") #f)
(test (eval ()) ())
(test (eval ()) ())
(test (eval-string "1" () ()) 'error)
(test (eval () () ()) 'error)
(test (eval "1") "1")
(test (eval-string #t) 'error)
(test (eval #(+ 1 2)) #(+ 1 2))
(test (+ 1 (values (eval-string "(catch #t (lambda () asdf) (lambda args 2))") (eval-string "(catch #t (lambda () asdf) (lambda args 3))"))) 6)

(let () (define e1 (let ((a 10)) (curlet))) (test (eval 'a e1) 10)) ; from andy wingo
(let () (define e1 (let ((a 10)) (curlet))) (eval '(set! a 32) e1) (test (eval 'a e1) 32))

(test (eval '(begin (define __eval_var__ 1) __eval_var__) (rootlet)) 1)
(test (let () __eval_var__) 1)
(test (eval-string "(begin (define __eval_var1__ 12) __eval_var1__)" (rootlet)) 12)
(test (let () __eval_var1__) 12)
(test (let () (eval '(begin (define __eval_var2__ 123) __eval_var__) (curlet)) __eval_var2__) 123)
(test (let () __eval_var2__) 'error)
(test (let ((x 1) (y 2)) (eval-string "(begin (set! x 3) (set! y 4))") (list x y)) '(3 4))

;; from scheme wg
(let ((x (list 'cons 1 2))
      (y (list (list 'quote 'cons) 1 2)))
  (set-car! x cons) 
  (set-car! (cdar y) cons)
  (test (eval x) (eval y)))
(test (eval (list 'cons 1 2)) (eval (list cons 1 2)))
(let ((f (lambda (a) (+ a 1))))
  (test (eval (list 'f 2)) (eval (list f 2))))

(test (apply "hi" 1 ()) #\i)
(test (eval ("hi" 1)) #\i)
(test (apply + 1 1 (cons 1 (quote ()))) 3)
(test (eq? (eval (quote (quote ()))) ()) #t)
(test (apply (cons (quote cons) (cons 1 (quote ((quote ()))))) 1 ()) 1) ; essentially ((list 'cons 1 ...) 1) => 1
(test (eval ((cons (quote cons) (cons 1 (quote ((quote ()))))) 1)) 1)
(test (eval (eval (list '+ 1 2))) 3)

(test (eval if) if)
(test (eval quote) quote)
(test (eval (eval (list define* #(1)))) 'error)
(test (eval (eval (list lambda* ()))) 'error)
(test (eval (eval (list letrec "hi"))) 'error)
(test (eval (eval (cons define-macro 1))) 'error)
(test (eval (eval (cons quote "hi"))) 'error)
(test (eval (eval (list and "hi"))) "hi")

(let-temporarily (((*s7* 'safety) 1))
  (test (eval (cdr (signature /))) 'error))

(test (apply + (+ 1) ()) 1)
(test (apply #(1) (+) ()) 1)
(test (apply + (+) ()) 0)
(test (eval #()) #())
(test (apply (lambda () #f)) #f)
(test (eval '(if #f #f)) (if #f #f))
(test (let ((ho 32)) (symbol? (eval (eval (eval (eval '''''ho)))))) #t)
(test (eval '(case 0 ((1) 2) ((0) 1))) 1)
(test (eval '(cond ((= 1 2) 3) (#t 4))) 4)

(test (eval-string (string-append "(list 1 2 3)" (string #\newline) (string #\newline))) (list 1 2 3))
(eval-string (string-append "(begin (define evalstr_1 32)" (string #\newline) "(define evalstr_2 2))"))
(test (eval-string "(+ evalstr_1 evalstr_2)") 34)
(eval-string (string-append "(begin (set! evalstr_1 3)" "(set! evalstr_2 12))"))
(test (eval-string "(+ evalstr_1 evalstr_2)") 15)

(test (+ (eval `(values 1 2 3)) 4) 10)
(test (+ (eval-string "(values 1 2 3)") 4) 10)
(test (+ 1 (eval-string "(+ 2 3)") 4) 10)
(test ((eval-string "(lambda (a) (+ a 1))") 2) 3)
(test (eval ((eval-string "(lambda (a) (list '+ a 1))") 2)) 3)
(test (eval-string "(+ 1 (eval (list '+ 1 2)))") 4)
(test (eval _undef_) _undef_)

(test (eq? (eval-string "else") else) #t)
(test (eq? (with-input-from-string "else" read) else) #t)
(test (eq? (with-input-from-string "lambda" read) lambda) #f)
(test (eq? (eval-string "lambda") lambda) #t)
(test (((eval-string "lambda") () (+ 1 2))) 3)
(test (symbol? (eval-string "lambda")) #f)
(test (symbol? (with-input-from-string "lambda" read)) #t)
(test (eq? (with-input-from-string "else" (lambda () (eval (read)))) else) #t)

(test (eval-string "'___a ; b") '___a)
(test (eval-string "'___a #| b |#") '___a)

(for-each
 (lambda (arg)
   (test (eval-string arg) 'error))
 (list -1 0 1 512 #\a #(1 2 3) 3.14 2/3 1.5+0.3i 1+i () 'hi :hi abs #(()) (list 1 2 3) '(1 . 2) (lambda () 1)))
(for-each
 (lambda (arg)
   (test (eval-string "(+ 1 2)" arg) 'error))
 (list -1 0 1 512 #\a #(1 2 3) 3.14 2/3 1.5+0.3i 1+i 'hi abs "hi" :hi #(()) (lambda () 1)))


(test (let () (define-macro (hiho a) `(+ ,a 1)) (hiho 3)) 4)
(test (let () (define-macro (hiho) `(+ 3 1)) (hiho)) 4)
(test (let () (define-macro (hiho) `(+ 3 1)) (hiho 1)) 'error)
(test (let () (define-macro (hi a) `(+ ,@a)) (hi (1 2 3))) 6)
(test (let () (define-macro (hi a) `(+ ,a 1) #f) (hi 2)) #f)
(test (let () (define-macro (mac1 a) `',a) (equal? (mac1 (+ 1 2)) '(+ 1 2))) #t)
(test (let () (define-macro (hi . a) `,@a) (hi 1)) 1)

(test (let () (define-macro (hi a) `(+ , a 1)) (hi 1)) 2)
(test (let () (define-macro (hi a) `(eval `(+ ,,a 1))) (hi 1)) 2)
(test (let () (define-macro (hi a) `(eval (let ((a 12)) `(+ ,,a 1)))) (hi 1)) 2)
(test (let () (define-macro (hi a) `(eval (let ((a 12)) `(+ ,a 1)))) (hi 1)) 13)
(test (let () (define-macro (hi a) `(eval (let ((a 12)) `(let ((a 100)) (+ ,a 1))))) (hi 1)) 13)
(test (let () (define-macro (hi a) `(eval (let ((a 12)) `(let ((a 100)) (+ a 1))))) (hi 1)) 101)

(test (let () (define-macro (hi q) ``(,,q)) (hi (* 2 3))) '(6))
(test (let () (define-macro (hi q) `(let ((q 32)) `(,,q))) (hi (* 2 3))) '(6))
(test (let () (define-macro (hi q) `(let ((q 32)) `(,q))) (hi (* 2 3))) '(32))
(test (let () (define-macro (hi q) `(let () ,@(list q))) (hi (* 2 3))) 6)

(test (let () (define-macro (tst a) ``(+ 1 ,,a)) (tst 2)) '(+ 1 2))
(test (let () (define-macro (tst a) ```(+ 1 ,,,a)) (eval (tst 2))) '(+ 1 2))
(test (let () (define-macro (tst a) ``(+ 1 ,,a)) (tst (+ 2 3))) '(+ 1 5))
(test (let () (define-macro (tst a) ``(+ 1 ,@,a)) (tst '(2 3))) '(+ 1 2 3))
(test (let () (define-macro (tst a) ``(+ 1 ,,@a)) (tst (2 3))) '(+ 1 2 3))
(test (let () (define-macro (tst a) ```(+ 1 ,,,@a)) (eval (tst (2 3)))) '(+ 1 2 3))
(test (let () (define-macro (tst a) ```(+ 1 ,,@,@a)) (eval (tst ('(2 3))))) '(+ 1 2 3))
(test (let () (define-macro (tst a) ````(+ 1 ,,,,@a)) (eval (eval (eval (tst (2 3)))))) 6)
(test (let () (define-macro (tst a) ``(+ 1 ,@,@a)) (tst ('(2 3)))) '(+ 1 2 3))
(test (let () (define-macro (tst a b) `(+ 1 ,a (apply * `(2 ,,@b)))) (tst 3 (4 5))) 44)
(test (let () (define-macro (tst . a) `(+ 1 ,@a)) (tst 2 3)) 6)
(test (let () (define-macro (tst . a) `(+ 1 ,@a (apply * `(2 ,,@a)))) (tst 2 3)) 18)
(test (let () (define-macro (tst a) ```(+ 1 ,@,@,@a)) (eval (tst ('('(2 3)))))) '(+ 1 2 3))

(test (let () (define-macro (hi a) `(+ ,a 1)) (procedure? hi)) #f)
(test (let () (define-macro (hi a) `(let ((@ 32)) (+ @ ,a))) (hi @)) 64)
(test (let () (define-macro (hi @) `(+ 1 ,@@)) (hi (2 3))) 6) ; ,@ is ambiguous
(test (let () (define-macro (tst a) `(+ 1 (if (> ,a 0) (tst (- ,a 1)) 0))) (tst 3)) 4)
(test (let () (define-macro (hi a) (if (list? a) `(+ 1 ,@a) `(+ 1 ,a))) (* (hi 1) (hi (2 3)))) 12)

(test (let ((x 1)) (eval `(+ 3 ,x))) 4)
(test (let ((x 1)) (eval (eval `(let ((x 2)) `(+ 3 ,x ,,x))))) 6)
(test (let ((x 1)) (eval (eval (eval `(let ((x 2)) `(let ((x 3)) `(+ 10 ,x ,,x ,,,x))))))) 16)
(test (let ((x 1)) (eval (eval (eval (eval `(let ((x 2)) `(let ((x 3)) `(let ((x 30)) `(+ 100 ,x ,,x ,,,x ,,,,x))))))))) 136)

(test (let () (define-bacro (hiho a) `(+ ,a 1)) (hiho 3)) 4)
(test (let () (define-bacro (hiho) `(+ 3 1)) (hiho)) 4)
(test (let () (define-bacro (hiho) `(+ 3 1)) (hiho 1)) 'error)
(test (let () (define-bacro (hi a) `(+ ,@a)) (hi (1 2 3))) 6)
(test (let () (define-bacro (hi a) `(+ ,a 1) #f) (hi 2)) #f)
(test (let () (define-bacro (mac1 a) `',a) (equal? (mac1 (+ 1 2)) '(+ 1 2))) #t)
(test (let () (define-bacro (tst a) ``(+ 1 ,,a)) (tst 2)) '(+ 1 2))
(test (let () (define-bacro (tst a) ```(+ 1 ,,,a)) (eval (tst 2))) '(+ 1 2))
(test (let () (define-bacro (tst a) ``(+ 1 ,,a)) (tst (+ 2 3))) '(+ 1 5))
(test (let () (define-bacro (tst a) ``(+ 1 ,@,a)) (tst '(2 3))) '(+ 1 2 3))
(test (let () (define-bacro (tst a) ``(+ 1 ,,@a)) (tst (2 3))) '(+ 1 2 3))
(test (let () (define-bacro (tst a) ```(+ 1 ,,,@a)) (eval (tst (2 3)))) '(+ 1 2 3))
(test (let () (define-bacro (tst a) ```(+ 1 ,,@,@a)) (eval (tst ('(2 3))))) '(+ 1 2 3))
(test (let () (define-bacro (tst a) ````(+ 1 ,,,,@a)) (eval (eval (eval (tst (2 3)))))) 6)
(test (let () (define-bacro (tst a) ``(+ 1 ,@,@a)) (tst ('(2 3)))) '(+ 1 2 3))
(test (let () (define-bacro (tst a b) `(+ 1 ,a (apply * `(2 ,,@b)))) (tst 3 (4 5))) 44)
(test (let () (define-bacro (tst . a) `(+ 1 ,@a)) (tst 2 3)) 6)
(test (let () (define-bacro (tst . a) `(+ 1 ,@a (apply * `(2 ,,@a)))) (tst 2 3)) 18)
(test (let () (define-bacro (tst a) ```(+ 1 ,@,@,@a)) (eval (tst ('('(2 3)))))) '(+ 1 2 3))
(test (let () (define-bacro (hi a) `(+ ,a 1)) (procedure? hi)) #f)
(test (let () (define-bacro (hi a) `(let ((@ 32)) (+ @ ,a))) (hi @)) 64)
(test (let () (define-bacro (hi @) `(+ 1 ,@@)) (hi (2 3))) 6) ; ,@ is ambiguous
(test (let () (define-bacro (tst a) `(+ 1 (if (> ,a 0) (tst (- ,a 1)) 0))) (tst 3)) 4)
(test (let () (define-bacro (hi a) (if (list? a) `(+ 1 ,@a) `(+ 1 ,a))) (* (hi 1) (hi (2 3)))) 12)

(test (let () (define-bacro (hiho a) `(+ ,a 1)) (macro? hiho)) #t)
(test (let () (define-bacro* (hiho (a 1)) `(+ ,a 1)) (macro? hiho)) #t)
(test (let () (define-macro (hiho a) `(+ ,a 1)) (macro? hiho)) #t)
(test (let () (define-macro* (hiho (a 1)) `(+ ,a 1)) (macro? hiho)) #t)

#|
(define-macro (when2 test . body)
  `((apply lambda (list '(test) '(if test (let () ,@body)))) ,test))

(define-macro (when2 test . body)
  `(if ,test (let () ,@body)))

(define-macro (when2 test . body)
  `((lambda (test) (if test (let () ,@body))) ,test))

(define-macro (when2 test . body)
  `(let ((func (apply lambda `(() ,,@body))))
     (if ,test (func))))
|#

(test (define-macro) 'error)
(test (define-macro 1) 'error)
(test (define-macro . 1) 'error)
(test (apply define-macro '(1)) 'error)
(test (define-macro (1 2 3)) 'error)
(test (define-macro (1 2) 3) 'error)
(test (define-macro (a)) 'error)
(test (define-macro (a)) 'error)
(test (define-macro (a 1) 2) 'error)
(test (define-macro . a) 'error)
(test (define :hi 1) 'error)
(test (define hi: 1) 'error)
(test (define-macro (:hi a) `(+ ,a 1)) 'error)
(test (define-macro (:hi a) `(+ ,a 1)) 'error)
(test (define-macro (hi 1 . 2) 1) 'error)
(test (define-macro (hi) 1 . 2) 'error)
(test (define-macro (:) "" . #(1)) 'error)
(test (defmacro : #(1) . :) 'error)
(test (defmacro hi ()) 'error)
(test (define-macro (mac . 1) 1) 'error)
(test (define-macro (mac 1) 1) 'error)
(test (define-macro (a #()) 1) 'error)
(test (define-macro (i 1) => (j 2)) 'error)
(test (define hi 1 . 2) 'error)
(test (defmacro hi hi . hi) 'error)
(test (define-macro (hi hi) . hi) 'error)
(test (((lambda () (define-macro (hi a) `(+ 1 ,a)) hi)) 3) 4)

(test (let () (define-macro (hi a b) `(list ,@a . ,@b)) (hi (1 2) ((2 3)))) '(1 2 2 3))
(test (let () (define-macro (hi a b) `(list ,@a . ,b)) (hi (1 2) (2 3))) '(1 2 2 3))
(test (let () (define-macro (hi a b) `(list ,@a ,@b)) (hi (1 2) (2 3))) '(1 2 2 3))


(let ((vals #(0 0)))
  
#|
  (let ()
      (define (hi a) (+ 1 a))
      (define (use-hi b) (hi b))
      (set! (vals 0) (use-hi 1))
      (define (hi a) (+ 2 a))
      (set! (vals 1) (use-hi 1))
      (test vals #(2 3))) ; hmmm, or possibly #(2 2)... see comment above (line 13494 or thereabouts)
|#

  (let ()
    (define-macro (hi a) `(+ 1 ,a))
    (define (use-hi b) (hi b))
    (set! (vals 0) (use-hi 1))
    (define-macro (hi a) `(+ 2 ,a))
    (set! (vals 1) (use-hi 1))
    (test vals #(2 3)))
  (let ()
    (define (use-hi b) (hhi b))
    (define-macro (hhi a) `(+ 1 ,a))
    (set! (vals 0) (use-hi 1))
    (define-macro (hhi a) `(+ 2 ,a))
    (set! (vals 1) (use-hi 1))
    (test vals #(2 3))))

(test (let ()
	(define-macro (hanger name-and-args)
	  `(define ,(car name-and-args)
	     (+ ,@(map (lambda (arg) arg) (cdr name-and-args)))))
	(hanger (hi 1 2 3))
	hi)
      6)
(test (let ()
	(define-macro (hanger name-and-args)
	  `(define-macro (,(car name-and-args))
	     `(+ ,@(map (lambda (arg) arg) (cdr ',name-and-args)))))
	(hanger (hi 1 2 3))
	(hi))
      6)

(let ()
  ;; inspired by Doug Hoyte, "Let Over Lambda"
  (define (mcxr path lst)
    (define (cxr-1 path lst)
      (if (null? path)
	  lst
	  (if (char=? (car path) #\a)
	      (cxr-1 (cdr path) (car lst))
	      (cxr-1 (cdr path) (cdr lst)))))
    (let ((p (string->list (symbol->string path))))
      (if (char=? (car p) #\c)
	  (set! p (cdr p)))
      (let ((p (reverse p)))
	(if (char=? (car p) #\r)
	    (set! p (cdr p)))
	(cxr-1 p lst))))
  
  (test (mcxr 'cr '(1 2 3)) '(1 2 3))
  (test (mcxr 'cadddddddr '(1 2 3 4 5 6 7 8)) 8)
  (test (mcxr 'caadadadadadadadr '(1 (2 (3 (4 (5 (6 (7 (8))))))))) 8)
  
  (define-macro (cxr path lst)
    (let ((p (string->list (symbol->string path))))
      (if (char=? (car p) #\c)
	  (set! p (cdr p)))
      (let ((p (reverse p)))
	(if (char=? (car p) #\r)
	    (set! p (cdr p)))
	(let ((func 'arg))
	  (for-each
	   (lambda (f)
	     (set! func (list (if (char=? f #\a) 'car 'cdr) func)))
	   p)
	  `((lambda (arg) ,func) ,lst)))))
  
  (test (cxr car '(1 2 3)) 1)
  (test (cxr cadddddddr '(1 2 3 4 5 6 7 8)) 8)
  (test (cxr caadadadadadadadr '(1 (2 (3 (4 (5 (6 (7 (8))))))))) 8)
  )

;; this is the best of them!
(let ()
  (define-macro (c?r path)
    ;; here "path" is a list and "X" marks the spot in it that we are trying to access
    ;; (a (b ((c X)))) -- anything after the X is ignored, other symbols are just placeholders
    ;; c?r returns a function that gets X
    
    ;; maybe ... for cdr? (c?r (a ...);  right now it's using dot: (c?r (a . X)) -> cdr
    
    ;; (c?r (a b X)) -> caddr, 
    ;; (c?r (a (b X))) -> cadadr
    ;; ((c?r (a a a X)) '(1 2 3 4 5 6)) -> 4
    ;; ((c?r (a (b c X))) '(1 (2 3 4))) -> 4
    ;; ((c?r (((((a (b (c (d (e X)))))))))) '(((((1 (2 (3 (4 (5 6)))))))))) -> 6
    ;; ((c?r (((((a (b (c (X (e f)))))))))) '(((((1 (2 (3 (4 (5 6)))))))))) -> 4
    ;; (procedure-source (c?r (((((a (b (c (X (e f))))))))))) -> (lambda (lst) (car (car (cdr (car (cdr (car (cdr (car (car (car (car lst))))))))))))
    
    (define (X-marks-the-spot accessor tree)
      (if (pair? tree)
	  (or (X-marks-the-spot (cons 'car accessor) (car tree))
	      (X-marks-the-spot (cons 'cdr accessor) (cdr tree)))
	  (if (eq? tree 'X)
	      accessor
	      #f)))
    
    (let ((accessor (X-marks-the-spot () path)))
      (if (not accessor)
	  (error 'test-error "can't find the spot! ~A" path)
	  (let ((len (length accessor)))
	    (if (< len 5)                   ; it's a built-in function
		(let ((name (make-string (+ len 2))))
		  (set! (name 0) #\c)
		  (set! (name (+ len 1)) #\r)
		  (do ((i 0 (+ i 1))
		       (a accessor (cdr a)))
		      ((= i len))
		    (set! (name (+ i 1)) (if (eq? (car a) 'car) #\a #\d)))
		  (string->symbol name))
		(let ((body 'lst))          ; make a new function to find the spot
		  (for-each
		   (lambda (f)
		     (set! body (list f body)))
		   (reverse accessor))
		  `(lambda (lst) ,body)))))))
  
  (test ((c?r (a b X)) (list 1 2 3 4)) 3)
  (test ((c?r (a (b X))) '(1 (2 3) ((4)))) 3)
  (test ((c?r (a a a X)) '(1 2 3 4 5 6)) 4)
  (test ((c?r (a (b c X))) '(1 (2 3 4))) 4)
  (test ((c?r (((((a (b (c (d (e X)))))))))) '(((((1 (2 (3 (4 (5 6)))))))))) 6)
  (test ((c?r (((((a (b (c (X (e f)))))))))) '(((((1 (2 (3 (4 (5 6)))))))))) 4))

(let ()
  (define-macro (nested-for-each args func . lsts)
    (let ((body `(,func ,@args)))
      (for-each
       (lambda (arg lst)
	 (set! body `(for-each
		      (lambda (,arg)
			,body)
		      ,lst)))
       args lsts)
      body))
  
  ;;(nested-for-each (a b) + '(1 2) '(3 4)) ->
  ;;  (for-each (lambda (b) (for-each (lambda (a) (+ a b)) '(1 2))) '(3 4))
  
  (define-macro (nested-map args func . lsts)
    (let ((body `(,func ,@args)))
      (for-each
       (lambda (arg lst)
	 (set! body `(map
		      (lambda (,arg)
			,body)
		      ,lst)))
       args lsts)
      body))
  
  ;;(nested-map (a b) + '(1 2) '(3 4))
  ;;   ((4 5) (5 6))
  ;;(nested-map (a b) / '(1 2) '(3 4))
  ;;   ((1/3 2/3) (1/4 1/2))
  
  (test (nested-map (a b) + '(1 2) '(3 4)) '((4 5) (5 6)))
  (test (nested-map (a b) / '(1 2) '(3 4)) '((1/3 2/3) (1/4 1/2)))
  )

(let ()
  (define-macro (define-curried name-and-args . body)	
    `(define ,@(let ((newlst `(begin ,@body)))
		 (define (rewrap lst)
		   (if (pair? (car lst))
		       (begin
			 (set! newlst (cons 'lambda (cons (cdr lst) (list newlst))))
			 (rewrap (car lst)))
		       (list (car lst) (list 'lambda (cdr lst) newlst))))
		 (rewrap name-and-args))))
  
  (define-curried (((((f a) b) c) d) e) (* a b c d e))
  (test (((((f 1) 2) 3) 4) 5) 120)
  (define-curried (((((f a b) c) d e) f) g) (* a b c d e f g))
  (test (((((f 1 2) 3) 4 5) 6) 7) 5040)
  (define-curried (((foo)) x) (+ x 34))
  (test (((foo)) 300) 334)
  (define-curried ((foo-1) x) (+ x 34))
  (test ((foo-1) 200) 234)
  )


(test (let ()
	(define (set-cadr! a b)
	  (set-car! (cdr a) b)
	  b)
	(let ((lst (list 1 2 3)))
	  (set-cadr! lst 32)
	  lst))
      '(1 32 3))

  ;;; macro?
(test (macro? pi) #f)
(test (macro? quasiquote) #t) ; s7_define_macro in s7.c
(test (let ((m quasiquote)) (macro? m)) #t)
(test (macro? macroexpand) #f) ; it's now syntactic
(test (macro? cond) #f)
(test (macro? letrec) #f)

(for-each
 (lambda (arg)
   (test (macro? arg) #f))
 (list -1 #\a 1 #(1 2 3) 3.14 3/4 1.0+1.0i () car abs (lambda () 1) #2d((1 2) (3 4)) _ht_ _undef_ _null_ _c_obj_ #f 'hi #(()) (list 1 2 3) '(1 . 2) "hi"))
(test (macro?) 'error)

(define-macro (fully-expand form)
  (define (expand form)
    (if (pair? form)
	(if (and (symbol? (car form))
		 (macro? (symbol->value (car form))))
	    (expand (apply (eval (procedure-source (symbol->value (car form)))) (cdr form)))
	    (cons (expand (car form))
		  (expand (cdr form))))
	form))
  (expand form)) ; use (list 'quote (expand form)) to get fully-macroexpand of s7.html (see below)

(define fe1-called #f)
(define-macro (fe1 a) (set! fe1-called #t) `(+ ,a 1))
(define fe2-called #f)
(define-macro (fe2 b) (set! fe2-called #f) `(+ (fe1 ,b) 2))
(fully-expand (define (fe3 c) (+ (fe2 c) (fe1 (+ c 1)))))
(set! fe1-called #f)
(set! fe2-called #f)
(let ((val (fe3 3)))
  (if (or (not (= val 11))
	  fe1-called
	  fe2-called)
      (format #t "fully-expand: ~A ~A ~A ~A~%" val (procedure-source fe3) fe1-called fe2-called)))

(let ()
  (define-macro (swap a b)
    `(set! ,b (with-let (inlet 'e (curlet) 'tmp ,a) 
		(with-let e (set! ,a ,b))
		tmp)))

  ;; this doesn't know when to use the setter
  (define-macro (fully-macroexpand form)
    (define (expand form)
      (if (pair? form)
	  (if (and (symbol? (car form))
		   (macro? (symbol->value (car form))))
	      (expand (apply (eval (procedure-source (symbol->value (car form)))) (cdr form)))
	      (cons (expand (car form))
		    (expand (cdr form))))
	  form))
    (list 'quote (expand form)))
  
  (define-macro (define-with-macros name&args . body)
    `(apply define ',name&args (fully-macroexpand `(begin ,,@body))))
  
  (define-with-macros (call3 x)
    (let ((a 1) (b x))
      (swap a b)
      (list a b)))

  (test (call3 4) '(4 1)))
#|
;;; here is the setter-aware form...

(define-macro (fm1 form)
  (define (expand form)
    (if (pair? form)
	(if (and (symbol? (car form))
		 (macro? (symbol->value (car form))))
	    (expand (apply macroexpand (list form)))
	    (if (and (eq? (car form) 'set!)
		     (pair? (cdr form))
		     (pair? (cadr form))
		     (macro? (symbol->value (caadr form))))
		(expand (apply (eval (procedure-source (setter (symbol->value (caadr form))))) 
			       (append (cdadr form) (cddr form))))
		(cons (expand (car form))
		      (expand (cdr form)))))
	form))
  (list 'quote (expand form)))

;this is broken
(define-macro (define-safe-macro name&args . body)
  `(define-macro ,name&args
     (with-let (#_inlet (unlet)
		 ,@(#_let ((rest (#_if (#_list? name&args) 
				       #f 
				       (#_list-tail name&args (#_abs (#_length name&args))))))
			  (#_append 
			   (#_map (#_lambda (b) 
				    `(#_cons ',b ,b))
				  (#_cdr name&args))
			   (#_if rest `((#_cons ',rest ,rest)) ()))))
       ,@body)))

|#

(test (let ()
	(define-macro (pop sym)
	  (let ((v (gensym "v")))
	    `(let ((,v (car ,sym)))
	       (set! ,sym (cdr ,sym))
	       ,v)))

	(test (macro? pop) #t)

	(let ((lst (list 1 2 3)))
	  (let ((val (pop lst)))
	    (and (= val 1)
		 (equal? lst (list 2 3))))))
      #t)

(define-macro (destructuring-bind lst expr . body)
  `(let ((ex ,expr))
     
     (define (flatten lst)
       (cond ((null? lst) ())
	     ((pair? lst)
	      (if (pair? (car lst))
		  (append (flatten (car lst)) (flatten (cdr lst)))
		  (cons (car lst) (flatten (cdr lst)))))
	     (#t lst)))
     
     (define (structures-equal? l1 l2)
       (if (pair? l1)
	   (and (pair? l2)
		(structures-equal? (car l1) (car l2))
		(structures-equal? (cdr l1) (cdr l2)))
	   (not (pair? l2))))
     
     (if (not (structures-equal? ',lst ex))
	 (error 'test-error "~A and ~A do not match" ',lst ex))
     
     (let ((names (flatten ',lst))
	   (vals (flatten ex)))
       (apply (eval (list 'lambda names ',@body)) vals))))

(test (destructuring-bind (a b) (list 1 2) (+ a b)) 3)
(test (destructuring-bind ((a) b) (list (list 1) 2) (+ a b)) 3)
(test (destructuring-bind (a (b c)) (list 1 (list 2 3)) (+ a b c)) 6)
(test (let ((x 1)) (destructuring-bind (a b) (list x 2) (+ a b))) 3)

#|
(define-macro (destructuring-bind lst expr . body)
  `(let ,(letrec ((flatten (lambda (lst1 lst2 args)
			     (cond ((null? lst1) args)
				   ((not (pair? lst1)) 
				    (cons (list lst1 lst2) args))
				   (#t (flatten (car lst1) (car lst2) 
					 (flatten (cdr lst1) (cdr lst2) args)))))))
	   (flatten lst expr ()))
     ,@body))

(format #t "~A~%" (destructuring-bind (a b) (1 2) (+ a b)))
(format #t "~A~%" (destructuring-bind (a (b)) (1 (2)) (+ a b)))
(format #t "~A~%" (destructuring-bind ((a b)) ((1 2)) (+ a b)))
(format #t "~A~%" (destructuring-bind ((a (b c))) ((1 (2 1))) (+ a b)))
(format #t "~A~%" (destructuring-bind (a b) (0 (+ 1 2)) (+ a b)))
(format #t "~A~%" (destructuring-bind (a ((b))) ((+ 1 3) (((- 1 2)))) (+ a b)))
(format #t "~A~%" (destructuring-bind (a ((b c)) d e) (1 ((2 3)) (+ 4 5) 6) (list a b c d e)))

;; CL version:
(define-macro (destructuring-bind-1 lst expr . body)
  `(let ,(letrec ((flatten (lambda (lst1 lst2 args)
			     (cond ((null? lst1) args)
				   ((not (pair? lst1)) 
				    (cons (list lst1 (list 'quote lst2)) args))
				   (#t (flatten (car lst1) (car lst2) 
					 (flatten (cdr lst1) (cdr lst2) args)))))))
	   (flatten lst (eval expr) ()))
     ,@body))

(format #t "~A~%" (destructuring-bind-1 (a b) '(1 2) (list a b)))
(format #t "~A~%" (destructuring-bind-1 (a (b)) '(1 (2)) (list a b)))
(format #t "~A~%" (destructuring-bind-1 ((a b)) '((1 2)) (list a b)))
(format #t "~A~%" (destructuring-bind-1 ((a (b c))) '((1 (2 1))) (list a b)))
(format #t "~A~%" (destructuring-bind-1 (a b) '(0 (+ 1 2)) (list a b)))
(format #t "~A~%" (destructuring-bind-1 (a ((b))) '((+ 1 3) (((- 1 2)))) (list a b)))
(format #t "~A~%" (destructuring-bind-1 (a ((b c)) d e) '(1 ((2 3)) (4 5) 6) (list a b c d e)))

;; CL version but values not quoted (I like this one)
(define-macro (destructuring-bind-2 lst expr . body)
  `(let ,(letrec ((flatten (lambda (lst1 lst2 args)
			     (cond ((null? lst1) args)
				   ((not (pair? lst1)) 
				    (cons (list lst1 lst2) args))
				   (#t (flatten (car lst1) (car lst2) 
					 (flatten (cdr lst1) (cdr lst2) args)))))))
	   (flatten lst (eval expr) ()))
     ,@body))

(format #t "~A~%" (destructuring-bind-2 (a b) (list 1 2) (+ a b)))
(format #t "~A~%" (destructuring-bind-2 (a (b)) '(1 (2)) (+ a b)))
(format #t "~A~%" (destructuring-bind-2 ((a b)) '((1 2)) (+ a b)))
(format #t "~A~%" (destructuring-bind-2 ((a (b c))) '((1 (2 1))) (+ a b)))
(format #t "~A~%" (destructuring-bind-2 (a b) '(0 (+ 1 2)) (+ a b)))
(format #t "~A~%" (destructuring-bind-2 (a ((b))) '((+ 1 3) (((- 1 2)))) (+ a b)))
(format #t "~A~%" (destructuring-bind-2 (a ((b c)) d e) '(1 ((2 3)) (+ 4 5) 6) (list a b c d e)))
(format #t "~A~%" (let ((x 1)) (destructuring-bind-2 (a ((b))) '((+ x 3) (((- x 2)))) (+ a b))))
|#


(define-macro (once-only names . body)
  (let ((gensyms (map (lambda (n) (gensym)) names)))
    `(let (,@(map (lambda (g) `(,g (gensym))) gensyms))
       `(let (,,@(map (lambda (g n) ``(,,g ,,n)) gensyms names))
	  ,(let (,@(map (lambda (n g) `(,n ,g)) names gensyms))
	     ,@body)))))

(let ()
  (define-macro (hiho start end) 
    (once-only (start end) 
	       `(list ,start ,end (+ 2 ,start) (+ ,end 2))))
  
  (test (let ((ctr 0)) 
	  (let ((lst (hiho (let () (set! ctr (+ ctr 1)) ctr) 
			   (let () (set! ctr (+ ctr 1)) ctr))))
	    (list ctr lst)))
	'(2 (1 2 3 4))))

(define-macro (once-only-2 names . body)
  (let ((gensyms (map (lambda (n) (gensym)) names)))
    `(let (,@(map (lambda (g) (list g '(gensym))) gensyms))
       `(let (,,@(map (lambda (g n) (list list g n)) gensyms names))
          ,(let (,@(map (lambda (n g) (list n g)) names gensyms))
             ,@body)))))

(let ()
  (define-macro (hiho start end) 
    (once-only-2 (start end) 
	       `(list ,start ,end (+ 2 ,start) (+ ,end 2))))
  
  (test (let ((ctr 0)) 
	  (let ((lst (hiho (let () (set! ctr (+ ctr 1)) ctr) 
			   (let () (set! ctr (+ ctr 1)) ctr))))
	    (list ctr lst)))
	'(2 (1 2 3 4))))

;;; (define-bacro (once-only-1 names . body)
;;;   `(let (,@(map (lambda (name) `(,name ,(eval name))) names))
;;;     ,@body))
;;; can't be right: (let ((names 1)) (once-only (names) (+ names 1)))
;;; if define-macro used here: syntax-error ("~A: unbound variable" start) in the example below

(define once-only-1
  (let ((names (gensym))
	(body (gensym)))
    (apply define-bacro 
	 `((once ,names . ,body)
	   `(let (,@(map (lambda (name) `(,name ,(eval name))) ,names))
	      ,@,body)))
    once))

(let ()
  (define-bacro (hiho start end) ; note the bacro!  not a macro here
    (once-only-1 (start end) 
		 `(list ,start ,end (+ 2 ,start) (+ ,end 2))))
  
  (test (let ((ctr 0)) 
	  (let ((lst (hiho (let () (set! ctr (+ ctr 1)) ctr) 
			   (let () (set! ctr (+ ctr 1)) ctr))))
	    (list ctr lst)))
	'(2 (1 2 3 4)))

  (test (let ((names 1)) (once-only-1 (names) (+ names 1))) 2)
  (test (let ((body 1)) (once-only-1 (body) (+ body 1))) 2) ; so body above also has to be gensym'd
  )


(define once-only-3
  (let ((names (gensym))
	(body (gensym)))
    (apply define-bacro `((,(gensym) ,names . ,body)
			  `(let (,@(map (lambda (name) `(,name ,(eval name))) ,names))
			     ,@,body)))))

(let ()
  (define-bacro (hiho start end) ; note the bacro!  not a macro here
    (once-only-3 (start end) 
		 `(list ,start ,end (+ 2 ,start) (+ ,end 2))))
  
  (test (let ((ctr 0)) 
	  (let ((lst (hiho (let () (set! ctr (+ ctr 1)) ctr) 
			   (let () (set! ctr (+ ctr 1)) ctr))))
	    (list ctr lst)))
	'(2 (1 2 3 4)))

  (test (let ((names 1)) (once-only-3 (names) (+ names 1))) 2)
  (test (let ((body 1)) (once-only-3 (body) (+ body 1))) 2) ; so body above also has to be gensym'd
  )
  

(let ()
#|
  (define setf
    (let ((args (gensym)))
      (apply define-bacro 
	     `((setf-1 . ,args)        
	       (if (not (null? ,args))
		   (begin
		     (apply set! (car ,args) (cadr ,args) ())
		     (apply setf (cddr ,args)))))) ; not setf-1 -- it's not defined except during the definition 
      setf-1))
|#
(define setf
  (let ((args (gensym))
	(name (gensym)))
    (apply define-bacro `((,name . ,args)        
			  (unless (null? ,args)
			    (apply set! (car ,args) (cadr ,args) ())
			    (apply setf (cddr ,args)))))))
#|
;; the bad form:
(define-bacro (setf . args)
      (if (not (null? args))
	  (begin
	    (apply set! (car args) (eval (cadr args)) ())
	    (apply setf (cddr args)))))
|#

  (define-macro (psetf . args)
    (let ((bindings ())
	  (settings ()))
      (do ((arglist args (cddr arglist)))
	  ((null? arglist))
	(let* ((g (gensym)))
	  (set! bindings (cons (list g (cadr arglist)) bindings))
	  (set! settings (cons `(set! ,(car arglist) ,g) settings))))
      `(let ,bindings ,@settings)))
  
  (test (let ((a 1) (b 2)) (setf a b b 3) (list a b)) '(2 3))
  (test (let ((a 1) (b 2)) (setf a b b (+ a 3)) (list a b)) '(2 5))
  (test (let ((a #(1)) (b 2)) (setf (a 0) b b (+ (a 0) 3)) (list a b)) '(#(2) 5))
  (test (let ((a 1) (b 2)) (setf a b b a) (list a b)) '(2 2))
  (test (let ((a 1) (b 2)) (setf a '(+ 1 2) b a) (list a b)) '((+ 1 2) (+ 1 2)))
  (test (let ((args 1) (arg 1)) (setf args 2 arg 3) (list args arg)) '(2 3))
  (test (let ((args 1) (arg 1)) (setf args (+ 2 3) arg args) (list args arg)) '(5 5))
  (test (let ((args 1) (arg 1)) (setf args '(+ 2 3) arg (car args)) (list args arg)) '((+ 2 3) +))
  
  (test (let ((a 1) (b 2)) (psetf a b b a) (list a b)) '(2 1))
  (test (let ((a #(1)) (b 2)) (psetf (a 0) b b (+ (a 0) 3)) (list a b)) '(#(2) 4))
  (test (let ((a 1) (b 2)) (psetf a '(+ 1 2) b a) (list a b)) '((+ 1 2) 1))
  (test (let ((new-args 1)) (psetf new-args (+ new-args 1)) new-args) 2)
  (test (let ((args 1) (arg 1)) (psetf args 2 arg 3) (list args arg)) '(2 3))
  (test (let ((args 1) (arg 1)) (psetf args (+ 2 3) arg args) (list args arg)) '(5 1))
  (test (let ((args 1) (arg 1)) (psetf args '(+ 2 3) arg (car args)) (list args arg)) 'error)
  (test (let ((args '(1 2)) (arg 1)) (psetf args '(+ 2 3) arg (car args)) (list args arg)) '((+ 2 3) 1))
  )

(define-macro (with-gensyms names . body)
  `(let ,(map (lambda (n) `(,n (gensym))) names)
     ,@body))

(define-macro (define-clean-macro name-and-args . body)
  ;; the new backquote implementation breaks this slightly -- it's currently confused about unquoted nil in the original
  (let ((syms ()))
    
    (define (walk func lst)
      (if (and (func lst)
	       (pair? lst))
	  (begin
	    (walk func (car lst))
	    (walk func (cdr lst)))))
    
    (define (car-member sym lst)
      (if (null? lst)
	  #f
	  (if (eq? sym (caar lst))
	      (cdar lst)
	      (car-member sym (cdr lst)))))
    
    (define (walker val)
      (if (pair? val)
	  (if (eq? (car val) 'quote)
	      (or (car-member (cadr val) syms)
		  (and (pair? (cadr val))
		       (or (and (eq? (caadr val) 'quote) ; 'sym -> (quote (quote sym))
				val)
			   (append (list 'list) 
				   (walker (cadr val)))))
		  (cadr val))
	      (cons (walker (car val))
		    (walker (cdr val))))
	  (or (car-member val syms)
	      val)))
    
    (walk (lambda (val)
	    (if (and (pair? val)
		     (eq? (car val) 'quote)
		     (symbol? (cadr val))
		     (not (car-member (cadr val) syms)))
		(set! syms (cons 
			    (cons (cadr val) 
				  (gensym (symbol->string (cadr val))))
			    syms)))
	    (or (not (pair? val))
		(not (eq? (car val) 'quote))
		(not (pair? (cadr val)))
		(not (eq? (caadr val) 'quote))))
	  body)
    
    (let* ((new-body (walker body))
	   (new-syms (map (lambda (slot)
			    (list (cdr slot) '(gensym)))
			  syms))
	   (new-globals 
	    (let ((result ()))
	      (for-each
	       (lambda (slot)
		 (if (defined? (car slot))
		     (set! result (cons
				   (list 'set! (cdr slot) (car slot))
				   result))))
	       syms)
	      result)))
      
      `(define-macro ,name-and-args 
	 (let ,new-syms
	   ,@new-globals
	   `(begin ,,@new-body))))))


(define-macro (define-immaculo name-and-args . body)
  (let* ((gensyms (map (lambda (g) (gensym)) (cdr name-and-args)))
	 (args (cdr (copy name-and-args)))
	 (name (car name-and-args))
	 (set-args (map (lambda (a g) `(list ',g ,a)) args gensyms))
	 (get-args (map (lambda (a g) `(quote (cons ',a ,g))) args gensyms))
	 (blocked-args (map (lambda (a) `(,a ',a)) args))
	 (new-body (list (apply let blocked-args body))))
    `(define-macro ,name-and-args
       `(let ,(list ,@set-args)
	  ,(list 'with-let 
		 (append (list 'sublet) 
			 (list (list 'funclet ,name)) 
			 (list ,@get-args))
		 ',@new-body)))))

;;; this is not perfect: if unquote is on expr involving an arg, it's going to be unhappy,
;;;   but we can always move the unquote in, so it's purely stylistic.  Another way would
;;;   be to remove one level of unquotes throughout -- then the blocked-args and new-body
;;;   would be unneeded.

;;; in fact, it's wrong -- in the body we need to make explicit let refs to avoid collisions
;;; these tests are pointless
(test (let () (define-clean-macro (hi a) `(+ ,a 1)) (hi 1)) 2)
(test (let () (define-immaculo (hi a) `(+ ,a 1)) (hi 1)) 2)
(test (let () (define-immaculo (hi a) `(let ((b 23)) (+ b ,a)))	(hi 2)) 25)
(test (let () (define-immaculo (mac a b) `(let ((c (+ ,a ,b))) (let ((d 12)) (* ,a ,b c d)))) (mac 2 3)) 360)
(test (let () (define-immaculo (mac a b) `(let ((c (+ ,a ,b))) (let ((d 12)) (* ,a ,b c d)))) (let ((c 2) (d 3)) (mac c d))) 360)
(test (let () (define-clean-macro (mac a . body) `(+ ,a ,@body)) (mac 2 3 4)) 9)
(test (let () (define-clean-macro (mac) (let ((a 1)) `(+ ,a 1))) (mac)) 2)
(test (let () (define-immaculo (mac) (let ((a 1)) `(+ ,a 1))) (mac)) 2)
(test (let () (define-immaculo (hi a) `(list 'a ,a)) (hi 1)) (list 'a 1))


(test (let () (define-macro (hi a) `(+ 1 (if ,(= a 0) 0 (hi ,(- a 1))))) (hi 3)) 4)
(test (let () (define-macro (hi a) `(+ 1 ,a)) ((if #t hi abs) -3)) -2)
(test (let () (apply define-macro '((m a) `(+ 1 ,a))) (m 2)) 3)
(test (let () (apply (eval (apply define-macro '((m a) `(+ 1 ,a)))) '(3))) 4)
(test (let () (apply (eval (apply define '((hi a) (+ a 1)))) '(2))) 3)
(test (let () ((eval (apply define '((hi a) (+ a 1)))) 3)) 4)
(test (let () ((eval (apply define-macro '((m a) `(+ 1 ,a)))) 3)) 4)
(test (let () ((apply define '((hi a) (+ a 1))) 3)) 4)
(test (let () ((apply define-macro '((m a) `(+ 1 ,a))) 3)) 4)
(test (let () 
	(define-macro (mu args . body)
	  (let ((m (gensym)))
	    `(apply define-macro '((,m ,@args) ,@body))))
	((mu (a) `(+ 1 ,a)) 3))
      4)
(test (let () (define-macro (hi a) `(+ 1 ,a)) (map hi '(1 2 3))) '(2 3 4))
(test (let () (define-macro (hi a) `(+ ,a 1)) (apply hi '(4))) 5)
(test (let () 
	(define-macro (hi a) `(+ ,a 1))
	(define (fmac mac) (apply mac '(4)))
	(fmac hi))
      5)
(test (let () 
	(define (make-mac)
	  (define-macro (hi a) `(+ ,a 1))
	  hi)
	(let ((x (make-mac)))
	  (x 2)))
      3)

(define-macro* (_mac1_) `(+ 1 2))
(test (_mac1_) 3)
(define-macro* (_mac2_ a) `(+ ,a 2))
(test (_mac2_ 1) 3)
(test (_mac2_ :a 2) 4)
(define-macro* (_mac3_ (a 1)) `(+ ,a 2))
(test (_mac3_) 3)
(test (_mac3_ 3) 5)
(test (_mac3_ :a 0) 2)
(define-macro* (_mac4_ (a 1) (b 2)) `(+ ,a ,b))
(test (_mac4_) 3)
(test (_mac4_ :b 3) 4)
(test (_mac4_ 2 :b 3) 5)
(test (_mac4_ :b 10 :a 12) 22)
(test (_mac4_ :a 4) 6)

(define-bacro* (_mac21_) `(+ 1 2))
(test (_mac21_) 3)
(define-bacro* (_mac22_ a) `(+ ,a 2))
(test (_mac22_ 1) 3)
(test (_mac22_ :a 2) 4)
(define-bacro* (_mac23_ (a 1)) `(+ ,a 2))
(test (_mac23_) 3)
(test (_mac23_ 3) 5)
(test (_mac23_ :a 0) 2)
(define-bacro* (_mac24_ (a 1) (b 2)) `(+ ,a ,b))
(test (_mac24_) 3)
(test (_mac24_ :b 3) 4)
(test (_mac24_ 2 :b 3) 5)
(test (_mac24_ :b 10 :a 12) 22)
(test (_mac24_ :a 4) 6)  

(define-macro* (_mac11_) `(+ 1 2))
(test (_mac11_) 3)
(define-macro* (_mac12_ a) `(+ ,a 2))
(test (_mac12_ 1) 3)
(test (_mac12_ :a 2) 4)
(define-macro* (_mac13_ (a 1)) `(+ ,a 2))
(test (_mac13_) 3)
(test (_mac13_ 3) 5)
(test (_mac13_ :a 0) 2)
(define-macro* (_mac14_ (a 1) (b 2)) `(+ ,a ,b))
(test (_mac14_) 3)
(test (_mac14_ :b 3) 4)
(test (_mac14_ 2 :b 3) 5)
(test (_mac14_ :b 10 :a 12) 22)
(test (_mac14_ :a 4) 6)

(define-bacro (symbol-set! var val) `(set! ,(symbol->value var) ,val))
(test (let ((x 32) (y 'x)) (symbol-set! y 123) (list x y)) '(123 x))

(define-bacro (symbol-eset! var val) `(set! ,(eval var) ,val))
(test (let ((x '(1 2 3)) (y `(x 1))) (symbol-eset! y 123) (list x y)) '((1 123 3) (x 1)))
(test (let ((x #(1 2 3)) (y `(x 1))) (symbol-eset! y 123) (list x y)) '(#(1 123 3) (x 1)))

(let ()
  (define-macro (hi a) `````(+ ,,,,,a 1))
  (test (eval (eval (eval (eval (hi 2))))) 3)
  
  (define-macro (hi a) `(+ ,@@a))
  (test (hi (1 2 3)) 'error)
  
  (define-macro (hi @a) `(+ ,@@a))
  (test (hi (1 2 3)) 6))


;;; --------------------------------------------------------------------------------
;;; # readers 
;;; *#readers*
;;;
;;; #\; reader: 

(let-temporarily ((*#readers* ()))
  
  ;; testing *#readers* is slightly tricky because the reader runs before we evaluate the test expression
  ;;    so in these cases, the new reader use is always in a string 
  
  (set! *#readers* (list (cons #\s (lambda (str) 123))))
  (let ((val (eval-string "(+ 1 #s1)"))) ; force this into the current reader
    (test val 124))
  (set! *#readers* ())
  
  (set! *#readers* 
	(cons (cons #\t (lambda (str) 
			  (string->number (substring str 1) 12)))
	      *#readers*))
  (num-test (string->number "#tb") 11)
  (num-test (string->number "#t11.3") 13.25)
  (num-test (string->number "#t#t1a") 22.0)
  (num-test (string->number "#t#t#t1a") 22.0)
  (test (eval-string "#t") #t)
;  (test (eval-string "#T1") 'error)
  
  (set! *#readers*
	(cons (cons #\. (lambda (str)
			  (if (string=? str ".") (eval (read)) #f)))
	      *#readers*))
  
  (test (eval-string "'(1 2 #.(* 3 4) 5)") '(1 2 12 5))
  (num-test (string->number "#t1a") 22)
  (test (eval-string "'(1 #t(2))") '(1 #t (2)))
  (test (string->number "#t1r") #f)
  
  (set! *#readers* (list (cons #\t (lambda (str) 
				     ;; in the duplicated case: "t#t..."
				     (if (< (length str) 3)
					 (string->number (substring str 1) 12)
					 (and (not (char=? (str 1) #\#)) 
					      (not (char=? (str 2) #\t)) 
					      (string->number (substring str 1) 12)))))))
  (test (string->number "#t#t1a") #f)
  
  (set! *#readers* (cons (cons #\x (lambda (str) 
				     (or (if (< (length str) 3)
					     (string->number (substring str 1) 7)
					     (and (not (char=? (str 1) #\#)) 
						  (not (char=? (str 2) #\x)) 
						  (string->number (substring str 1) 7)))
					 'error)))
			 *#readers*))
  
  (num-test (string->number "#x12") 9)
  (num-test (string->number "#x-142.1e-1") -11.30612244898)
  (num-test (string->number "#t460.88") 648.72222222222)
  (num-test (string->number "#x1") 1)
  (test (string->number "#te") #f)
  (num-test (string->number "#x10") 7)
  (test (string->number "#x17") #f)
  (num-test (string->number "#x106") 55)
  (test (string->number "#x#t1") #f)
  
  (let ()
    (define (read-in-radix str radix)
      ;; no error checking, only integers
      (define (char->digit c)
	(cond ((char-numeric? c)
	       (- (char->integer c) (char->integer #\0)))
	      ((char-lower-case? c)
	       (+ 10 (- (char->integer c) (char->integer #\a))))
	      (#t
	       (+ 10 (- (char->integer c) (char->integer #\A))))))
      (let* ((negative (char=? (str 0) #\-))
	     (len (length str))
	     (j (if (or negative (char=? (str 0) #\+)) 2 1))) ; first char is "z"
	(do ((sum (char->digit (str j))
		  (+ (* sum radix) (char->digit (str j)))))
	    ((= j (- len 1)) sum)
	  (set! j (+ j 1)))))
    
    (set! *#readers* (list (cons #\z (lambda (str) (read-in-radix str 32)))))
    (num-test (string->number "#z1p") 57)
    )
  
  (let ((p1 (dilambda (lambda (str) (string->number (substring str 1) 12)) (lambda (a) a))))
    (set! *#readers* (list (cons #\t p1)))
    (num-test (string->number "#ta") 10)
    (num-test (string->number "#t11.6") 13.5)))
  
(num-test (string->number "#x106") 262)
(num-test (string->number "#x17") 23)

(let ((old-readers *#readers*)
      (reader-file tmp-output-file))
  ;; to test readers in a file, we need to write the file and load it, so here we go...
  (set! *#readers* ())

  (define circular-list-reader
    (let ((known-vals #f)
	  (top-n -1))
      (lambda (str)
	
	(define (replace-syms lst)
	  ;; walk through the new list, replacing our special keywords 
	  ;;   with the associated locations
	  
	  (define (replace-sym tree getter)
	    (if (keyword? (getter tree))
		(let ((n (string->number (symbol->string (keyword->symbol (getter tree))))))
		  (if (integer? n)
		      (let ((lst (assoc n known-vals)))
			(if lst
			    (set! (getter tree) (cdr lst))
			    (format *stderr* "#~D# is not defined~%" n)))))))
	  
	  (define (walk-tree tree)
	    (if (pair? tree)
		(begin
		  (if (pair? (car tree)) (walk-tree (car tree)) (replace-sym tree car))
		  (if (pair? (cdr tree)) (walk-tree (cdr tree)) (replace-sym tree cdr))))
	    tree)
	  
	  (walk-tree (cdr lst)))
	
	;; str is whatever followed the #, first char is a digit
	(let* ((len (length str))
	       (last-char (str (- len 1))))
	  (and (memq last-char '(#\= #\#))             ; is it #n= or #n#?
	       (let ((n (string->number (substring str 0 (- len 1)))))
		 (and (integer? n)
		      (begin
			(if (not known-vals)
			    (begin
			      (set! known-vals ())
			      (set! top-n n))) 
			
			(if (char=? last-char #\=)      ; #n=
			    (and (char=? (peek-char) #\()
				 (let ((cur-val (assoc n known-vals)))
				   ;; associate the number and the list it points to
				   ;;    if cur-val, perhaps complain? (#n# redefined)
				   (let ((lst (catch #t 
						(lambda () 
						  (read))
						(lambda args             ; a read error
						  (set! known-vals #f)   ;   so clear our state
						  (apply throw args))))) ;   and pass the error on up
				     (if (not cur-val)
					 (set! known-vals 
					       (cons (set! cur-val (cons n lst)) known-vals))
					 (set! (cdr cur-val) lst)))
				   
				   (if (= n top-n)       ; replace our special keywords
				       (let ((result (replace-syms cur-val)))
					 (set! known-vals #f)
					 result)
				       (cdr cur-val))))
				                     ; #n=<not a list>?
			    
			    ;; else it's #n# -- set a marker for now since we may not 
			    ;;   have its associated value yet.  We use a symbol name that 
			    ;;   string->number accepts.
			    (symbol->keyword 
			     (symbol (string-append (number->string n) (string #\null) " ")))))))
		                                    ; #n<not an integer>?
	       )))))                                ; #n<something else>?
  
  (define (sharp-plus str)
    ;; str here is "+", we assume either a symbol or a expression involving symbols follows
    (let* ((e (if (string=? str "+")
		  (read)                                ; must be #+(...)
		  (string->symbol (substring str 1))))  ; #+feature
	   (expr (read)))
      (if (symbol? e)
	  (if (provided? e)
	      expr
	      (values))
	  (if (pair? e)
	      (begin
		(define (traverse tree)
		  (if (pair? tree)                                             
		      (cons (traverse (car tree))                             
			    (if (null? (cdr tree)) () (traverse (cdr tree))))
		      (if (memq tree '(and or not)) 
			  tree                 
			  (and (symbol? tree) 
			       (provided? tree)))))
		(if (eval (traverse e))
		    expr
		    (values)))
	      (error 'test-error "strange #+ chooser: ~S~%" e)))))
  
  (set! *#readers* 
	(cons (cons #\+ sharp-plus)
	      (cons (cons #\. (lambda (str) (if (string=? str ".") (eval (read)) #f)))
		    (cons (cons #\; (lambda (str) (if (string=? str ";") (read)) (values)))
			  *#readers*))))

  (when pure-s7 (set! *#readers* (append *#readers* old-readers)))

  (do ((i 0 (+ i 1)))
      ((= i 10))
    (set! *#readers* 
	  (cons (cons (integer->char (+ i (char->integer #\0))) circular-list-reader)
		*#readers*)))

  (call-with-output-file reader-file
    (lambda (port)
      (format port "(define x #.(+ 1 2 3))~%")
      (format port "(define xlst '(1 2 3 #.(* 2 2)))~%")

      (format port "(define y '#1=(2 . #1#))~%")
      (format port "(define y1 '#1=(2 #2=(3 #3=(#1#) . #3#) . #2#))~%")
      (format port "(define y2 #2D((1 2) (3 4)))~%")

      (format port "#+s7 (define z 32)~%#+asdf (define z 123)~%")
      (format port "#+(and complex-numbers (or snd s7)) (define z1 1)~%#+(and (not complex-numbers) (or asdf s7)) (define z1 123)~%")

      (format port "(define x2 (+ 1 #;(* 2 3) 4))~%")
      (format port "(define x3 (+ #;32 1 2))~%") 
      (format port "(define x4 (+ #; 32 1 2))~%")

      (format port "(define y3 (+ 1 (car '#1=(2 . #1#))))~%")
      (format port "(define y4 #.(+ 1 (car '#1=(2 . #1#))))~%")
      (format port "(define y5 (+ 1 #.(* 2 3) #.(* 4 #.(+ 5 6))))~%")

      (format port "(define r1 '(1 #. #;(+ 2 3) 4))~%")
      (format port "(define r2 '(1 #. #;(+ 2 3) (* 2 4)))~%")
      (format port "(define r3 '(1 #; #.(+ 2 3) (* 2 4)))~%")
      (format port "(define r4 '(1 #. #1=(+ 2 3) (* 2 4)))~%")
      (format port "(define r5 '(1 #. #1=(+ 2 #. 3) (* 2 4)))~%")
      ;; but #.3 is ambiguous: '(1 #. #1=(+ 2 #.3) (* 2 4))
      (format port "(define r6 '(1 #. #1=(+ 2 #+pi 3) (* 2 4)))~%")
      (format port "(define r7 '(1 #. #1=(+ 2 #+pi #1#) (* 2 4)))~%")
      (format port "(define r8 '(1 #+s7 #1=(1 2) 3))~%")
      (format port "(define r9 '(1 #+asdf #1=(1 2) 3))~%")
      (format port "(define r10 #. #1#)~%")
      (format port "(define r14 #. #o1)~%")
      (format port "(define r15 #. #_-)~%")
      (format port "(define r17 (#. #_- #o1))~%")
      (format port "(define r18 (#. #.  #_+))~%")
      (format port "(define r19 (#. #+s7  #_+))~%")
      (format port "(define r20 (#+s7 #+s7 #_+))~%")
      (format port "(define r21 (#_-(#_+ 1 2)3))~%")
      (format port "(define r22 (#(#_+ 1 2)#o1))~%")
      (format port "(define r23 (+ #;#1.##+asdf ))~%")
      (format port "(define r24 (+ #. #;(#_+ 1 2)))~%")
      (format port "(define r25 (+ #;#1=#2=))~%")
      (format port "(define r26 (+ #;#2#(#_+ 1 2)))~%")
      (format port "(define r27 (+ #;#1=.))~%")
      (format port "(define r28 (+ #; #; #; ()))~%")
      (format port "(define r29 (+ 3(#_+ 1 2)#;#. ))~%")
      (format port "(define r30 (+ #;#2=#+asdf#+s7))~%")
      (format port "(define r31 (+ #;#f#=#\\))~%")
      (format port "(define r32 (#. + (#_-(#_+ 1 2))))~%")
      (format port "(define r33 (+ 1 #+asdf #\\a 2))~%")
      (format port "(define r34 (+ #++(#. #\\a)))~%")
      (format port "(define r35 (+ #+s7 #; (33)))~%")

      (format port "(define r36 (cos #. #. #. `(string->symbol \"pi\")))~%")
      ))

  (let ()
    (load reader-file (curlet))
    (if (not (= x 6)) (format #t ";#.(+ 1 2 3) -> ~A~%" x))
    (if (not (equal? xlst '(1 2 3 4))) (format #t ";#.(* 2 2) -> ~A~%" xlst))
    (if (not (equal? (object->string y) "#1=(2 . #1#)")) (format #t ";'#1=(2 . #1#) -> ~S~%" (object->string y)))
    (if (not (equal? (object->string y1) "#1=(2 #3=(3 #2=(#1#) . #2#) . #3#)"))
	(format #t ";'#1=(2 #2=(3 #3=(#1#) . #3#) . #2#) -> ~S~%" (object->string y1)))
    (if (not (equal? y2 #2d((1 2) (3 4)))) (format #t ";#2d((1 2) (3 4)) -> ~A~%" y2))
    (if (not (= z 32)) (format #t ";#+asdf? -> ~A~%" z))
    (if (not (= z1 1)) (format #t ";#(or ... +asdf)? -> ~A~%" z1))
    (if (not (= x2 5)) (format #t ";(+ 1 #;(* 2 3) 4) -> ~A~%" x2))
    (if (not (= x3 3)) (format #t ";(+ #;32 1 2) -> ~A~%" x3))
    (if (not (= x4 3)) (format #t ";(+ #; 32 1 2) -> ~A~%" x4))
    (if (not (= y3 3)) (format #t ";(+ 1 (car '#1=(2 . #1#))) -> ~A~%" y3))
    (if (not (= y4 3)) (format #t ";#.(+ 1 (car '#1=(2 . #1#))) -> ~A~%" y4))
    (if (not (= y5 51)) (format #t ";(+ 1 #.(* 2 3) #.(* 4 #.(+ 5 6))) -> ~A~%" y5))

    (if (not (equal? r1 '(1 4))) (format #t ";'(1 #. #;(+ 2 3) 4) -> ~A~%" r1))
    (if (not (equal? r2 '(1 (* 2 4)))) (format #t ";'(1 #. #;(+ 2 3) (* 2 4)) -> ~A~%" r2))
    (if (not (equal? r3 '(1 (* 2 4)))) (format #t ";'(1 #; #.(+ 2 3) (* 2 4)) -> ~A~%" r3))
    (if (not (equal? r4 '(1 5 (* 2 4)))) (format #t ";'(1 #. #1=(+ 2 3) (* 2 4)) -> ~A~%" r4))
    (if (not (equal? r5 '(1 5 (* 2 4)))) (format #t ";'(1 #. #1=(+ 2 #. 3) (* 2 4)) -> ~A~%" r5))
    (if (not (equal? r6 '(1 2 (* 2 4)))) (format #t ";'(1 #. #1=(+ 2 #+pi 3) (* 2 4)) -> ~A~%" r6))
    (if (not (equal? r7 '(1 2 (* 2 4)))) (format #t ";'(1 #. #1=(+ 2 #+pi #1#) (* 2 4)) -> ~A~%" r7))
    (if (not (equal? r8 '(1 (1 2) 3))) (format #t ";'(1 #+s7 #1=(1 2) 3) -> ~A~%" r8))
    (if (not (equal? r9 '(1 3))) (format #t ";'(1 #+asdf #1=(1 2) 3)) -> ~A~%" r9))
    (if (not (equal? r10 ':1)) (format #t ";#. #1# -> ~A~%" r10)) 
    (if (not (equal? r14 1)) (format #t ";#. #o1 -> ~A~%" r14))
    (if (not (equal? r15 -)) (format #t ";#. #_- -> ~A~%" r15))
    (if (not (equal? r17 -1)) (format #t ";(#. #_- #o1) -> ~A~%" r17))
    (if (not (equal? r18 0)) (format #t ";(#. #.  #_+) -> ~A~%" r18))
    (if (not (equal? r19 0)) (format #t ";(#. #+s7  #_+) -> ~A~%" r19))
    (if (not (equal? r20 0)) (format #t ";(#+s7 #+s7 #_+) -> ~A~%" r20))
    (if (not (equal? r21 0)) (format #t ";(#_-(#_+ 1 2)3) -> ~A~%" r21))
    (if (not (equal? r22 1)) (format #t ";(#(#_+ 1 2)#o1) -> ~A~%" r22))
    (if (not (equal? r23 0)) (format #t ";(+ #;#1.##+asdf ) -> ~A~%" r23))
    (if (not (equal? r24 0)) (format #t ";(+ #. #;(#_+ 1 2)) -> ~A~%" r24))
    (if (not (equal? r25 0)) (format #t ";(+ #;#1=#2=) -> ~A~%" r25))
    (if (not (equal? r26 3)) (format #t ";(+ #;#2#(#_+ 1 2)) -> ~A~%" r26))
    (if (not (equal? r27 0)) (format #t ";(+ #;#1=.) -> ~A~%" r27))
    (if (not (equal? r28 0)) (format #t ";(+ #; #; #; ()) -> ~A~%" r28))
    (if (not (equal? r29 6)) (format #t ";(+ 3(#_+ 1 2)#;#. ) -> ~A~%" r29))
    (if (not (equal? r30 0)) (format #t ";(+ #;#2=#+asdf#+s7) -> ~A~%" r30))
    (if (not (equal? r31 0)) (format #t ";(+ #;#f#=#\\) -> ~A~%" r31))
    (if (not (equal? r32 -3)) (format #t ";(#. + (#_-(#_+ 1 2))) -> ~A~%" r32))
    (if (not (equal? r33 3)) (format #t ";(+ 1 #+asdf #\\a 2) -> ~A~%" r33))
    (if (not (equal? r34 0)) (format #t ";(+ #++(#. #\\a)) -> ~A~%" r34))
    (if (not (equal? r35 0)) (format #t ";(+ #+s7 #; (33)) -> ~A~%" r35))

    (if (not (morally-equal? r36 -1.0)) (format #t ";(cos #. #. #. `(string->symbol \"pi\")) -> ~A~%" r36))
    )

  (set! *#readers* old-readers)
  )



;;; --------------------------------------------------------------------------------

(begin
  (define-macro (hi a) `(+ ,a 1))
  (test (hi 2) 3)
  (let ()
    (define (ho b) (+ 1 (hi b)))
    (test (ho 1) 3))
  (let ((hi 32))
    (test (+ hi 1) 33))
  (letrec ((hi (lambda (a) (if (= a 0) 0 (+ 2 (hi (- a 1)))))))
    (test (hi 3) 6))
  (letrec* ((hi (lambda (a) (if (= a 0) 0 (+ 2 (hi (- a 1)))))))
	   (test (hi 3) 6))
  (test (equal? '(hi 1) (quote (hi 1))) #t)
  (test (list? '(hi 1)) #t)
  (test (list? '(((hi 1)))) #t)
  (test (equal? (vector (hi 1)) #(2)) #t)
  (test (symbol? (vector-ref #(hi) 0)) #t))

(define-macro (define-with-goto name-and-args . body)
  ;; run through the body collecting label accessors, (label name)
  ;; run through getting goto positions, (goto name)
  ;; tie all the goto's to their respective labels (via set-cdr! essentially)
  
  (define (find-accessor type)
    (let ((labels ()))
      (define (gather-labels accessor tree)
	(if (pair? tree)
	    (if (equal? (car tree) type)
		(begin
		  (set! labels (cons (cons (cadr tree) 
					   (let ((body 'lst))
					     (for-each
					      (lambda (f)
						(set! body (list f body)))
					      (reverse (cdr accessor)))
					     (dilambda
					      (apply lambda '(lst) (list body))
					      (apply lambda '(lst val) `((set! ,body val))))))
				     labels))
		  (gather-labels (cons 'cdr accessor) (cdr tree)))
		(begin
		  (gather-labels (cons 'car accessor) (car tree))
		  (gather-labels (cons 'cdr accessor) (cdr tree))))))
      (gather-labels () body)
      labels))
  (let ((labels (find-accessor 'label))
	(gotos (find-accessor 'goto)))
    (if (not (null? gotos))
	(for-each
	 (lambda (goto)
	   (let* ((name (car goto))
		  (goto-accessor (cdr goto))
		  (label (assoc name labels))
		  (label-accessor (and label (cdr label))))
	     (if label-accessor
		 (set! (goto-accessor body) (label-accessor body))
		 (error 'bad-goto "can't find label: ~S" name))))
	 gotos))
    `(define ,name-and-args
       (let ((label (lambda (name) #f))
	     (goto (lambda (name) #f)))
	 ,@body))))

(let ()
  (define-with-goto (g1 a)
    (let ((x 1))
      (if a
	  (begin
	    (set! x 2)
	    (goto 'the-end)
	    (set! x 3))
	  (set! x 4))
      (label 'the-end)
      x))
  
  (define-with-goto (g2 a)
    (let ((x a))
      (label 'start)
      (if (< x 4)
	  (begin
	    (set! x (+ x 1))
	    (goto 'start)))
      x))
  
  (test (g1 #f) 4)
  (test (g1 #t) 2)
  (test (g2 1) 4)
  (test (g2 32) 32))

(let ((sum 0))
  (define-macro (define-with-goto-and-come-froms name-and-args . body)
    (let ((labels ())
	  (gotos ())
	  (come-froms ()))
      
      (define (collect-jumps tree)
	(when (pair? tree)
	  (when (pair? (car tree))
	    (case (caar tree)
	      ((label)     (set! labels (cons tree labels)))
	      ((goto)      (set! gotos (cons tree gotos)))
	      ((come-from) (set! come-froms (cons tree come-froms)))
	      (else (collect-jumps (car tree)))))
	  (collect-jumps (cdr tree))))

      (collect-jumps body)
      
      (for-each
       (lambda (goto)
	 (let* ((name (cadr (cadar goto)))
		(label (member name labels (lambda (a b) (eq? a (cadr (cadar b)))))))
	   (if label
	       (set-cdr! goto (car label))
	       (error 'bad-goto "can't find label: ~S" name))))
       gotos)
      
      (for-each
       (lambda (from)
	 (let* ((name (cadr (cadar from)))
		(label (member name labels (lambda (a b) (eq? a (cadr (cadar b)))))))
	   (if label
	       (set-cdr! (car label) from)
	       (error 'bad-come-from "can't find label: ~S" name))))
       come-froms)
      
      `(define ,name-and-args
	 (let ((label (lambda (name) #f))
	       (goto (lambda (name) #f))
	       (come-from (lambda (name) #f)))
	   ,@body))))
  
  (define-with-goto-and-come-froms (hi)
    (set! sum (+ sum 1))
    (goto 'the-end)
    (set! sum (+ sum 2))
    (label 'the-end)
    (set! sum (+ sum 4))
    (label 'not-done)
    (set! sum (+ sum 8))
    (come-from 'not-done)
    (set! sum (+ sum 16))
    (newline)
    sum)
  
  (test (hi) 21))


;;; --------------------------------------------------------------------------------
;;; symbol-setter
  
(let ((p (open-output-string)))
  (define e      ; save environment for use below
    (let ((x 3)  ; always an integer
	  (y 3)  ; always 3
	  (z 3)) ; report set!
      (set! (symbol-setter 'x) (lambda (s v) (if (integer? v) v x)))
      (set! (symbol-setter 'y) (lambda (s v) y))
      (set! (symbol-setter 'z) (lambda (s v) (format p "z ~A -> ~A~%" z v) v))
      (set! x 3.3)
      (set! y 3.3)
      (set! z 3.3)
      (curlet)))
  (test (and (equal? (e 'x) 3) (equal? (e 'y) 3) (equal? (e 'z) 3.3)
	     (string=? (get-output-string p) "z 3 -> 3.3\n"))
	#t)
  (close-output-port p))

(for-each
 (lambda (arg)
   (test (symbol-setter arg) 'error)
   (test (set! (symbol-setter _int_) arg) 'error)
   (let ((x 1))
     (if (not (null? arg))
	 (test (set! (symbol-setter 'x arg) (lambda (s v) 1)) 'error)))
   (let ((_x_ 1))
     (set! (symbol-setter '_x_) (lambda (s v) v))
     (set! _x_ arg)
     (test _x_ arg)))
 (list -1 #\a 1 #(1 2 3) 3.14 3/4 1.0+1.0i () #(()) (list 1 2 3) '(1 . 2) "hi"))

(let ((_x_ 1))
  (set! (symbol-setter '_x_) (lambda (s v) v))
  (define _x_ 32)
  (test _x_ 32)
  (define (_x_) 32)
  (test (_x_) 32)
  (let ((_x_ 3))
    (test _x_ 3))
  (define (hi _x_) _x_)
  (test (hi 4) 4)
  (test (do ((_x_ 0 (+ _x_ 1))) ((= _x_ 2) _x_)) 2)
  (test ((inlet '_x_ -1) '_x_) -1)
  (set! _x_ 32)
  (test _x_ 32))

(let ((_x_ 1))
  (set! (symbol-setter '_x_) (lambda (s v) #f))
  (define _x_ 32) (test _x_ #f)
  (test (set! _x_ 32) #f))

(test (symbol-setter) 'error)
(let ((xyzzy 1)
      (_int_ 'xyzzy))
  (test (symbol-setter 'xyzzy) #f)
  (test (set! (symbol-setter _int_) ()) 'error)
  (test (set! (symbol-setter _int_) '(#f)) 'error))

(let ((_x1_ #f))
  (set! (symbol-setter '_x1_) (lambda (x y) 'error))
  (test (set! _x1_ 32) 'error))

(let ((x 1))
  (set! (symbol-setter 'x) (lambda (s v) x))
  (let ((x 2))
    (set! x 3)
    (test x 3)
    (set! (symbol-setter 'x (curlet)) (lambda (s v) 32))
    (set! x 1)
    (test x 32))
  (test x 1)
  (set! x 2)
  (test x 1))

(let ()
  (define (f1 x)
    (let ((a x)
	  (b 2)
	  (c 3))
      (set! (symbol-setter 'b) (lambda (s v) (set! a (+ v c)) v))
      (set! (symbol-setter 'c) (lambda (s v) (set! a (+ b v)) v))
      (set! a (+ b c))
      (set! b (+ b 1))
      (set! c 5)
      a))
  (f1 0)
  (test (f1 0) 8))

(test (symbol-setter :rest) #f)
(test (set! (symbol-setter :allow-other-keys) #f) 'error)

(let ()
  (define v_a_r 32)
  (let ((x #(1 2 3)))
    (set! (symbol-setter 'v_a_r)
	  (lambda (sym val)
	    (set! (x 1) val)
	    (+ val 2))))
  (do ((i 0 (+ i 1)))
      ((= i 5))
    (set! v_a_r (+ i 33))
    (test v_a_r (+ i 33 2))
    (gc)))

(define v_a_r 32)
(let ((x #(1 2 3)))
  (set! (symbol-setter 'v_a_r)
	(lambda (sym val)
	  (set! (x 1) val)
	  (+ val 1))))
(do ((i 0 (+ i 1)))
    ((= i 5))
  (set! v_a_r (+ i 33))
  (test v_a_r (+ i 33 1))
  (gc))

(let ((x (vector 1 2 3)))
  (let ((y (list 4 5 6)))
    (set! (symbol-setter 'v_a_r)
	  (lambda (sym val)
	    (+ (x val) (y val)))))
  (set! v_a_r 1)
  (test v_a_r 7))
(set! v_a_r 0)
(test v_a_r 5)
(gc) (gc)
(set! v_a_r 2)
(test v_a_r 9)
(gc) (gc)
(let ((err #f))
  (catch #t (lambda () (set! v_a_r 3)) (lambda args (set! err #t)))
  (test v_a_r 9)
  (if (not err) (format *stderr* "no error in symbol accessor!")))

(define v_a_r_1 0)
(let ((v_a_r_1 43)
      (x #(1 2 3)))
  (set! (symbol-setter 'v_a_r_1) (lambda (sym val) (x val)))
  (set! v_a_r_1 0)
  (test v_a_r_1 1))
(catch #t (lambda () (set! v_a_r_1 2)) (lambda args (apply format *stderr* (cadr args))))
(test v_a_r_1 2)

(let ((x (vector 1 2 3)))
  (let ((y 32))
    (let ((e1 (curlet))
	  (y 31))
      (let ((e2 (curlet)))
	(set! (symbol-setter 'y e1)
	      (lambda (sym val)
		(+ val (x 1)))))
      (set! y 3)
      (test y 3))
    (set! y 2)
    (test y 4)))
      
(let ()
  (define (symbol-documentation sym e) 
    (cond ((symbol-setter sym e) => documentation) 
	  (else #f)))
  
  (define (symbol-signature sym e) 
    (cond ((symbol-setter sym e) => signature) 
	  (else #f))) ; or car?
  
  (define (setter sym val e)
    (if (integer? val) 
	val 
	(symbol->value sym e)))
  
  (let ((x 3))
    (set! (symbol-setter 'x) setter)
    (set! x 4)
    (test x 4))
  
  (let ((x 5))
    (define setter 
      (let ((+signature+ '(integer? #t))
	    (+documentation+ "x is an integer"))
	(lambda (s v e)
	  (if (integer? v) 
	      v
	      (symbol->value s e)))))
    (let ((x 6))
      (set! (symbol-setter 'x) setter)
      (set! x 7)
      (test x 7)
      (test (symbol-documentation 'x (curlet)) "x is an integer")
      (test (symbol-signature 'x (curlet)) '(integer? #t)))
    (test x 5)))

(let ((x (inlet :a 1 :b 2))
      (set1 #f)
      (set2 #f))
  (set! (symbol-setter 'a x) 
	(lambda (s v e)
	  (set! set1 v)
	  (+ v 1)))
  (set! (symbol-setter 'b x) 
	(lambda (s v e)
	  (set! set2 v)
	  (* v 2)))
  (set! (x 'a) 32)
  (set! (x 'b) (+ (x 'a) 1))
  (test x (inlet :a 33 :b 68)))



;;; ----------------------------------------
#|
;;; these tests are problematic -- they might not fail as hoped, or they might generate unwanted troubles
(let ((bad-ideas "
                      (define (bad-idea)
                        (let ((lst '(1 2 3)))
                          (let ((result (list-ref lst 1)))
                            (list-set! lst 1 (* 2.0 16.6))
                            (gc)
                            result)))

                      (define (bad-idea-1)
                        (let ((lst #(1 2 3)))
                          (let ((result (vector-ref lst 1)))
                            (vector-set! lst 1 (* 2.0 16.6))
                            (gc)
                             result)))
                      "))
  (with-output-to-file tmp-output-file (lambda () (display bad-ideas)))
  (load tmp-output-file))

(num-test (bad-idea) 2)
(let ((val (bad-idea)))
  (if (equal? val 33.2)
      (set! val (bad-idea)))
  (if (equal? val 33.2)
      (format #t ";bad-idea 3rd time: ~A~%" val)))
(num-test (bad-idea-1) 2)
(let ((val (bad-idea-1)))
  (if (equal? val 33.2)
      (set! val (bad-idea-1)))
  (if (equal? val 33.2)
      (format #t ";bad-idea-1 3rd time: ~A~%" val)))
(set! (*s7* 'safety) 1)
(load tmp-output-file)
(num-test (bad-idea) 2)
(num-test (bad-idea) 33.2)
(num-test (bad-idea) 33.2)
(num-test (bad-idea-1) 2)
(num-test (bad-idea-1) 33.2)
(num-test (bad-idea-1) 33.2)
(set! (*s7* 'safety) 0)
|#

;(test (quit 0) 'error)

;;; ----------------------------------------
;;; macroexpand
(let () 
  (define-macro (hi a) `(+ ,a 1))
  (test (macroexpand (hi 2)) '(+ 2 1))
  (test (macroexpand (hi (abs 2))) '(+ (abs 2) 1))
  (define-macro (ho a) `(+ ,@a 1))
  (test (macroexpand (ho (2 3 4))) '(+ 2 3 4 1))
  (define-macro* (hi1 a (b 2)) `(+ ,a ,b))
  (test (macroexpand (hi1 3)) '(+ 3 2))
  (define-bacro* (hi2 a (b 2)) `(+ ,a ,b))
  (test (macroexpand (hi2 3)) '(+ 3 2))
  )

(let ()
  (define-macro (Let vars . body)
    `(with-let (sublet (curlet) 
		 ,@(map (lambda (var)
			  (values (symbol->keyword (car var)) (cadr var)))
			vars))
       ,@body))
  (test (Let ((c 4)) (Let ((a 2) (b (+ c 2))) (+ a b c))) 12)
  (test (macroexpand (Let ((a 2) (b (+ c 2))) (+ a b c))) '(with-let (sublet (curlet) :a 2 :b (+ c 2)) (+ a b c))))

(let ()
  (define-macro (m1 . args) `(begin ,@args))
  (test (macroexpand (m1 (display 1) (newline))) '(begin (display 1) (newline))))

(test (let ((a 3) (b (list 2 3 4))) (quasiquote (+ ,a 1 ,@b))) '(+ 3 1 2 3 4))
(test (let ((a 3) (b (list 2 3 4))) (macroexpand (quasiquote (+ ,a 1 ,@b)))) (list 'list-values ''+ 'a 1 (list 'apply-values 'b)))

(let ()
  (define-macro* (m2 (a 3) (b 2)) `(+ ,a ,b))
  (test (macroexpand (m2)) '(+ 3 2))
  (test (macroexpand ((symbol->value 'm2) (* 2 3))) '(+ (* 2 3) 2)))

(let ()
  (define-bacro (m3 b) `(+ ,a ,b))
  (test (let ((a 3)) (macroexpand (m3 2))) '(+ 3 2)))

(let ()
  (define-macro (progv vars vals . body) `(apply (apply lambda ,vars ',body) ,vals))
  (test (macroexpand (progv '(one two) '(1 2) (+ one two))) '(apply (apply lambda '(one two) '((+ one two))) '(1 2))))

(let ()
  (define-macro (Letrec* bindings . body)
    (if (null? body)
	(error 'syntax-error "letrec* has no body")
	(if (not (list? bindings))
	    (error 'syntax-error "letrec* variables are messed up")
	    `(let (,@(map (lambda (var&init)
			    (list (car var&init) #<undefined>))
			  bindings))
	       ,@(map (lambda (var&init)
			(if (not (null? (cddr var&init)))
			    (error 'syntax-error "letrec* variable has more than one value"))
			(list 'set! (car var&init) (cadr var&init)))  
		      bindings)
	       ,@body))))
  (test (macroexpand (Letrec* ((p (lambda (x) (+ 1 (q (- x 1)))))
			       (q (lambda (y) (if (zero? y) 0 (+ 1 (p (- y 1))))))
			       (x (p 5))
			       (y x))
		       y))
	'(let ((p #<undefined>) (q #<undefined>) (x #<undefined>) (y #<undefined>)) (set! p (lambda (x) (+ 1 (q (- x 1))))) (set! q (lambda (y) (if (zero? y) 0 (+ 1 (p (- y 1)))))) (set! x (p 5)) (set! y x) y)))

(let ()
  (define-macro (m5 a) `(define-macro (m6 b) `(+ 1 ,b ,,a)))
  (test (macroexpand ((m5 3) 4)) '(+ 1 4 3)))

(test (macroexpand) 'error)
(test (macroexpand 1) 'error)
(test (macroexpand . 1) 'error)
(test (macroexpand (* 1 2)) 'error)
(test (macroexpand (* 1 2) . 3) 'error)
(test (macroexpand (* 1 2) 3) 'error)
(test (macroexpand ((symbol->value 'abs) -1)) 'error)
(test (macroexpand (1 2)) 'error)

(let ()
  (define-macro (rmac . args)
    (if (null? args)
	()
	(if (null? (cdr args))
	    `(display ',(car args))
	    (append (list 'begin `(display ',(car args)))
		    (append (list (apply macroexpand (list (append '(rmac) (cdr args))))))))))
  (test (with-output-to-string
	  (lambda ()
	    (rmac a b c (+ 1 2) d)))
	"abc(+ 1 2)d"))



;;; define-expansion
(define-expansion (_expansion_ a) `(+ ,a 1))
(test (_expansion_ 3) 4)
(test (macroexpand (_expansion_ 3)) `(+ 3 1))
(test '(_expansion_ 3) (quote (_expansion_ 3)))
(test (_expansion_ (+ (_expansion_ 1) 2)) 5)
(test (let ((x _expansion_)) (x 3)) (+ 3 1))
(test (let ((x 3)) (define (hi a) (a x)) (hi _expansion_)) 4)

(define-expansion (whatever->zero . whatever) 0)
(let ((val (+ 1 (whatever->zero 2 3) 4)))
  (if (not (= val 5))
      (format *stderr* "whatever->zero: ~A?" val)))

(define (make-instrument-conf6) (<gui3>))
(define-expansion (<gui3>) `(+ 2 3))
(test (make-instrument-conf6) 5)

(define (make-instrument-conf5) (<gui2>))
(define-macro (<gui2>) `(+ 2 3))
(test (make-instrument-conf5) 5)

(define-expansion (<gui1>) `(+ 2 3))
(define (make-instrument-conf4) (<gui1>))
(test (make-instrument-conf4) 5)

(let ()
  (define-macro (_mac_ x) `(+ ,x 1))
  (test (member 1 (list 3 2) (lambda (a b) (null? (macroexpand (_mac_ (make-hash-table)))))) #f))



;;; --------------------------------------------------------------------------------
;;; define-constant
(test (let () (define-constant __c1__ 32) __c1__) 32)
(test (let () (define-constant __c1__ 32) (let ((__c1__ 3)) __c1__)) 'error)
(test (let () (define-constant __c1__ 32) (letrec ((__c1__ 3)) __c1__)) 'error)
(test (let () (define-constant __c1__ 32) (letrec* ((__c1__ 3)) __c1__)) 'error)
(test (let () (define-constant __c1__ 32) (let* ((__c1__ 3)) __c1__)) 'error)
(test (let () (define-constant __c1__ 32) (let () (define __c1__ 3) __c1__)) 'error)
(test (let () (define-constant __c1__ 32) (let () (set! __c1__ 3) __c1__)) 'error)
(test (let () (define-constant __c1__ 32) (do ((__c1__ 3)) (#t) __c1__)) 'error)
(test (let () (define-constant __c1__ 32) (let ((x (inlet :__c1__ 34))) x)) 'error)

(let ()
  (define (df1 a) (set! pi a)) 
  (test (df1 3.0) 'error)
  (test (df1 #\a) 'error)
  (define (df2 a b) (set! pi (+ a b)))
  (test (df2 1.0 2.0) 'error)
  (define (df3 a) (set! pi (+ pi 1)))
  (test (df3 1) 'error)
  (test (set! pi (abs pi)) 'error)
  (test (set! pi pi) 'error)         ; hmmm...
  (test (define-constant pi pi) pi) ;   but this is ok -- define-constant can be a no-op
  (test (define-constant pi 3.0) 'error)
  (test (define pi 3.0) 'error)
  (test (define (pi a) a) 'error)
  (test (define (f1 pi) pi) 'error)
  (test (let ((pi 3.0)) pi) 'error)
  (test (let* ((pi 3.0)) pi) 'error)
  (test (letrec ((pi 3.0)) pi) 'error)
  (test (letrec* ((pi 3.0)) pi) 'error)
  (test (do ((pi 0 (+ pi 1))) ((= pi 3))) 'error)
  )

(let ((xc 3))
  (let ()
    (define-constant xc 32)
    (test (constant? 'xc) #t)
    (test (let ((xc 3)) xc) 'error)
    (test (let* ((y 1) (xc y)) xc) 'error)
    (test (let ((y (lambda (xc) xc))) (y 1)) 'error)
    (test (let ((y (lambda (a . xc) xc))) (y 1 2)) 'error)
    (test (let ((y (lambda* (a :rest xc) xc))) (y 1 2)) 'error)
    (test (do ((xc 0 (+ xc 1))) ((= xc 2) xc) xc) 'error)
    (test (inlet 'xc 1) 'error)
    (test (varlet (inlet) 'xc 1) 'error)
    (test (set! xc 4) 'error)
    (test xc 32)
    (test (let () (define xc 5) xc) 'error)
    (test (let () (define-constant xc 5) xc) 'error)
    (test (let () (define* (xc y) 5) (xc)) 'error)
    (test (let () (define-macro (xc y) `(+ ,y 1)) (xc 2)) 'error)
    )
  (test xc 3)
  (test (constant? 'xc) #f)
  (test (let ((xc 3)) xc) 3)
  (test (let* ((y 1) (xc y)) xc) 1)
  (test (let ((y (lambda (xc) xc))) (y 1)) 1)
  (test (let ((y (lambda (a . xc) xc))) (y 1 2)) '(2))
  (test (let ((y (lambda* (a :rest xc) xc))) (y 1 2)) '(2))
  (test (do ((xc 0 (+ xc 1))) ((= xc 2) xc) xc) 2)
  (test (inlet 'xc 1) (inlet 'xc 1))
  (test (varlet (inlet) 'xc 1) (inlet 'xc 1))
  (test (set! xc 4) 4)
  (test xc 4)
  (test (let () (define xc 5) xc) 5)
  (test (let () (define-constant xc 5) xc) 5)
  (test (let () (define* (xc y) 5) (xc)) 5)
  (test (let () (define-macro (xc y) `(+ ,y 1)) (xc 2)) 3)
  (test xc 4)
  )

(test (let ((z (let () (define-constant xc 3) (lambda (y) (let ((xc y)) xc))))) (z 1)) 'error)
(test (let ((xc 1)) (define z (let () (define-constant xc 3) (lambda (y) (let ((xc y)) xc)))) (z 1)) 'error)
(test (let () (define-constant (xc xc) xc) (xc 1)) 1)

(let ()
  (define-constant (func) 1)
  (test (immutable? func) #t))

(let ((old-stdin *stdin*)
      (old-closed (port-closed? *stdin*)))
  (let ((tag (catch #t (lambda () (set! *stdin* #f)) (lambda args 'error))))
    (if (or (not (eq? *stdin* old-stdin))
	    (not (eq? old-closed (port-closed? *stdin*))))
	(format *stderr* ";*stdin* mutable?~%"))
    (if (not (eq? tag 'error))
	(format *stderr* ";set! *stdin* no error? ~A~%" tag))))

(let ((old-stdout *stdout*)
      (old-closed (port-closed? *stdout*)))
  (let ((tag (catch #t (lambda () (set! *stdout* #f)) (lambda args 'error))))
    (if (or (not (eq? *stdout* old-stdout))
	    (not (eq? old-closed (port-closed? *stdout*))))
	(format *stderr* ";*stdout* mutable?~%"))
    (if (not (eq? tag 'error))
	(format *stderr* ";set! *stdout* no error? ~A~%" tag))))

(let ((old-stderr *stderr*)
      (old-closed (port-closed? *stderr*)))
  (let ((tag (catch #t (lambda () (set! *stderr* #f)) (lambda args 'error))))
    (if (or (not (eq? *stderr* old-stderr))
	    (not (eq? old-closed (port-closed? *stderr*))))
	(format *stderr* ";*stderr* mutable?~%"))
    (if (not (eq? tag 'error))
	(format *stderr* ";set! *stderr* no error? ~A~%" tag))))

(let ((old-pi pi))
  (let ((tag (catch #t (lambda () (set! pi #f)) (lambda args 'error))))
    (if (not (eq? pi old-pi))
	(format pi ";pi mutable?~%"))
    (if (not (eq? tag 'error))
	(format pi ";set! pi no error? ~A~%" tag))))

(let ((old-with-let with-let))
  (let ((tag (catch #t (lambda () (set! with-let #f)) (lambda args 'error))))
    (if (not (eq? with-let old-with-let))
	(format with-let ";with-let mutable?~%"))
    (if (not (eq? tag 'error))
	(format with-let ";set! with-let no error? ~A~%" tag))))

(let ((old-*s7* *s7*))
  (let ((tag (catch #t (lambda () (set! *s7* #f)) (lambda args 'error))))
    (if (not (eq? *s7* old-*s7*))
	(format *s7* ";*s7* mutable?~%"))
    (if (not (eq? tag 'error))
	(format *s7* ";set! *s7* no error? ~A~%" tag))))


;;; --------------------------------------------------------------------------------
;;; constant?

(test (constant? '__c1__) #f)
(test (constant? pi) #t)
(test (constant? 'pi) #t) ; take that, Clisp!
(test (constant? 12345) #t)
(test (constant? 3.14) #t)
(test (constant? :asdf) #t) 
(test (constant? 'asdf) #f)
(test (constant? "hi") #t) 
(test (constant? #\a) #t) 
(test (constant? #f) #t) 
(test (constant? #t) #t) 
(test (constant? ()) #t) 
(test (constant? ()) #t) 
(test (constant? '(a)) #t) 
(test (constant? '*features*) #f)
(test (let ((a 3)) (constant? 'a)) #f)
(test (constant? 'abs) #f)
(test (constant? abs) #t)
(test (constant? most-positive-fixnum) #t)
(test (constant? (/ (log 0))) #t)       ; nan.0 is a constant as a number I guess
(test (constant? 1/0) #t)
(test (constant? (log 0)) #t)
(test (constant?) 'error)
(test (constant? 1 2) 'error)
(test (constant? #<eof>) #t) ; ?
(test (constant? #<undefined>) #t)
(test (constant? _undef_) #t)
(test (constant? #<unspecified>) #t)
(test (constant? '-) #f)
(test (constant? ''-) #t)
(test (constant? '''-) #t)
(test (constant? '1) #t)
(test (constant? 1/2) #t)
(test (constant? 'with-let) #t)
(test (constant? with-let) #t)
(test (constant? (cons 1 2)) #t)
(test (constant? #(1 2)) #t)
(test (constant? (list 1 2)) #t)
(test (constant? (vector 1 2)) #t)
(test (let ((v (vector 1 2))) (constant? v)) #t) ;!!
;; it's returning #t unless the arg is a symbol that is not a keyword or a defined constant
;; (it's seeing the value of v, not v):
(test (let ((v (vector 1 2))) (constant? 'v)) #f)
;; that is something that can be set! is not a constant?

(when with-bignums
  (test (constant? 1624540914719833702142058941) #t)
  (test (constant? 1624540914719833702142058941.4) #t)
  (test (constant? 7151305879464824441563197685/828567267217721441067369971) #t))

(test (constant? lambda) #t)   ; like abs?
(test (constant? (lambda () 1)) #t)
(test (constant? ''3) #t)
(test (constant? (if #f #f)) #t)
(test (constant? 'x) #f)
(test (let ((x 'x)) (and (not (constant? x)) (equal? x (eval x)))) #t)
(test (and (constant? (list + 1)) (not (equal? (list + 1) (eval (list + 1))))) #t)


;;; --------------------------------------------------------------------------------
;;; immutable! immutable?

(test (immutable? ()) #t)
(test (immutable? (list 1)) #f)
(test (immutable? (immutable! (list 1))) #t)
(test (immutable? '__c1__) #f)
(test (immutable? pi) #t)
(test (immutable? 'pi) #t) ; take that, Clisp!
(test (immutable? :asdf) #t) 
(test (immutable? 'asdf) #f)
(test (immutable? "hi") #f) 
(test (immutable? #\a) #t) 
(test (immutable? #f) #t) 
(test (immutable? #t) #t) 
(test (immutable? ()) #t) 
(test (immutable?) 'error)
(test (immutable? 1 2) 'error)
(test (immutable? #<eof>) #t)
(test (immutable? 'with-let) #t)
(test (immutable? (format #t #u8())) #f)
(test (immutable? (format #t "")) #f)
(test (immutable? "") #f)
(test (immutable? '"") #f)
(test (immutable? #<undefined>) #t)
(test (immutable? _undef_) #t)
(test (immutable? #<unspecified>) #t)

;; Clisp:
;;  (constantp (cons 1 2)) ->NIL
;;  (constantp #(1 2)) -> T
;;  (constantp '(1 . 2)) -> NIL
;;  (constantp (vector 1)) -> T


(test (sort! (immutable! (string #\a #\b #\c)) char>?) 'error)
(test (sort! (immutable! (vector #\a #\b #\c)) char>?) 'error)
(test (sort! (immutable! (byte-vector 0 1 2)) >) 'error)
(test (sort! (immutable! (int-vector 0 1 2)) >) 'error)
(test (sort! (immutable! (float-vector 0 1 2)) >) 'error)
(test (sort! (immutable! (list 0 1 2)) >) 'error)
(test (sort! () >) ())
(test (sort! (vector) >) #())

(test (reverse! (immutable! (string #\a #\b #\c))) 'error)
(test (reverse! (immutable! (vector #\a #\b #\c))) 'error)
(test (reverse! (immutable! (byte-vector 0 1 2))) 'error)
(test (reverse! (immutable! (int-vector 0 1 2))) 'error)
(test (reverse! (immutable! (float-vector 0 1 2))) 'error)
(test (reverse! (immutable! (hash-table* :a 1 :b 2))) 'error)
(test (reverse! (immutable! (inlet :a 1 :b 2))) 'error)
(test (reverse! (immutable! (list 1 2 3))) 'error)
(test (reverse! ()) ())
(test (reverse! (vector)) #())

(test (set-car! (immutable! (cons 1 2)) 3) 'error)
(test (set-cdr! (immutable! (cons 1 2)) 3) 'error)
(test (let ((c (immutable! (list 1 2)))) (set-car! c 0)) 'error)
(test (let ((c (cons 1 (immutable! (cons 2 ()))))) (set-car! (cdr c) 0)) 'error)
(test (let ((c (cons 1 (immutable! (cons 2 ()))))) (set-car! c 0) c) '(0 2))

(test (fill! (immutable! (string #\a #\b #\c)) #\a) 'error)
(test (string-fill! (immutable! (string #\a #\b #\c)) #\a) 'error)
(test (fill! (immutable! (vector #\a #\b #\c)) 1) 'error)
(test (vector-fill! (immutable! (vector #\a #\b #\c)) 1) 'error)
(test (fill! (immutable! (byte-vector 0 1 2)) 0) 'error)
(test (fill! (immutable! (int-vector 0 1 2)) 1) 'error)
(test (fill! (immutable! (float-vector 0 1 2)) 1.0) 'error)
(test (fill! (immutable! (hash-table* :a 1 :b 2)) #f) 'error)
(test (fill! (immutable! (inlet :a 1 :b 2)) #f) 'error)
(test (fill! (immutable! (list 1 2 3)) 0) 'error)

(test (reverse! (copy (immutable! (string #\a #\b #\c)))) "cba")
(test (immutable? (copy (immutable! (list 1 2)))) #f)
(test (immutable? (copy (immutable! "123"))) #f)

(test (let ((str (immutable! (string #\1 #\2)))) (string-set! str 0 #\a)) 'error)
(test (let ((str (immutable! (string #\1 #\2)))) (set! (str 0) #\a)) 'error)
(test (let ((bv (immutable! (byte-vector 1 2)))) (byte-vector-set! bv 0 2)) 'error)
(test (let ((lt (immutable! (inlet :a 1)))) (let-set! lt :a 2)) 'error)
(test (let ((lt (immutable! (inlet :a 1)))) (set! (lt :a) 2)) 'error)
(test (let ((lt (immutable! (hash-table* :a 1)))) (hash-table-set! lt :a 2)) 'error)
(test (let ((lt (immutable! (hash-table* :a 1)))) (set! (lt :a) 2)) 'error)

(test (let ((p (immutable! (list 1 2)))) (list-set! p 0 2)) 'error)
(test (let ((p (immutable! (list 1 2)))) (set! (p 0) 2)) 'error)
(test (let ((p (immutable! (vector 1 2)))) (vector-set! p 0 2)) 'error)
(test (let ((p (immutable! (vector 1 2)))) (set! (p 0) 2)) 'error)
(test (let ((p (immutable! (int-vector 1 2)))) (int-vector-set! p 0 2)) 'error)
(test (let ((p (immutable! (int-vector 1 2)))) (set! (p 0) 2)) 'error)
(test (let ((p (immutable! (float-vector 1 2)))) (float-vector-set! p 0 2)) 'error)
(test (let ((p (immutable! (float-vector 1 2)))) (set! (p 0) 2)) 'error)
(test (let ((ht (immutable! (hash-table* 'a 1)))) (hash-table-set! ht 'a #f)) 'error)
(test (let ((lt (immutable! (inlet 'a 1)))) (varlet lt 'b 2)) 'error)
(test (let ((lt (immutable! (inlet 'a 1 'b 2)))) (cutlet lt 'b)) 'error)

(let ((src (vector 0 0)))
  (test (let ((p1 (immutable! (list 1 2)))) (copy src p1)) 'error)
  (test (let ((p1 (immutable! (string #\a #\b)))) (copy src p1)) 'error)
  (test (let ((p1 (immutable! (byte-vector 1 2)))) (copy src p1)) 'error)
  (test (let ((p1 (immutable! (vector 1 2)))) (copy src p1)) 'error)
  (test (let ((p1 (immutable! (int-vector 1 2)))) (copy src p1)) 'error)
  (test (let ((p1 (immutable! (float-vector 1 2)))) (copy src p1)) 'error)
  (test (let ((p1 (immutable! (hash-table* 'a 1)))) (copy src p1)) 'error)
  (test (let ((p1 (immutable! (inlet 'a 1)))) (copy src p1)) 'error))
(test (copy (inlet 'a 1) (immutable! (inlet 'b 2))) 'error)
(test (copy (inlet 'a 1) (immutable! (vector 0 0))) 'error)
(test (copy (hash-table* 'a 1) (immutable! (vector 0 0))) 'error)

(test (let ((lt (immutable! (inlet 'a 1)))) (let-set! lt 'a 2)) 'error)
(test (let ((lt (immutable! (inlet 'a 1)))) (set! (lt 'a) 2)) 'error)
(test (let ((lt (immutable! (inlet 'a 1)))) (let-set! lt 'b 2)) 'error)
(test (let ((lt (immutable! (inlet 'a 1)))) (set! (lt 'b) 2)) 'error)

(test (let ((lt (immutable! (inlet 'a 1)))) (with-let lt (define b 2))) 'error)
(test (let ((lt (immutable! (inlet 'a 1)))) (with-let lt (define* (b x) (+ x 2)))) 'error)
(test (let ((lt (immutable! (inlet 'a 1)))) (with-let lt (apply define '(b 2)))) 'error)
(test (let ((a 1)) (immutable! (curlet)) (define b 2)) 'error)
(test (let ((lt (immutable! (inlet 'a 1)))) (with-let lt (define-macro (b x) `(+ ,x 2)))) 'error)
(test (let ((lt (immutable! (inlet 'a 1)))) (with-let lt (provide 'hiho))) 'error)
(test (let ((a 1)) (immutable! (curlet)) (provide 'hiho)) 'error)

(test (let () (let ((x 0)) (immutable! 'x)) (let ((x 0)) x)) 0)
(test (let () (let ((x 0)) (set! x 3) x)) 3)
(test (let () (let ((x 3)) (immutable! 'x) (set! x 31))) 'error)
(test (let ((a (openlet (immutable! (inlet 'asdf 1))))) (a 'asdf)) 1)

(test (let () (define (fstr) "fstr result") (let ((str (fstr))) (string-set! str 1 #\!) (fstr))) "f!tr result")
(test (let () (define (fstr) (immutable! "fstr result")) (let ((str (fstr))) (string-set! str 1 #\!) (fstr))) 'error)
(test (let () (define (fstr) "fstr result") (object->string fstr :readable))              "(lambda () \"fstr result\")")
(test (let () (define (fstr) (immutable! "fstr result")) (object->string fstr :readable)) "(lambda () (immutable! \"fstr result\"))")
(test (let ((str (immutable! "1234"))) (object->string str :readable))                "(immutable! \"1234\")")
(test (let ((seq (immutable! (list 1 2 3)))) (object->string seq :readable))          "(immutable! (list 1 2 3))")
(test (let ((seq (immutable! (vector 1 2 3)))) (object->string seq :readable))        "(immutable! (vector 1 2 3))")
(test (let ((seq (immutable! (int-vector 1 2 3)))) (object->string seq :readable))    "(immutable! #i(1 2 3)")
(test (let ((seq (immutable! (float-vector 1 2 3)))) (object->string seq :readable))  "(immutable! #r(1.0 2.0 3.0)")
(test (let ((seq (immutable! (inlet :a 1)))) (object->string seq :readable))          "(immutable! (inlet 'a 1))")
(test (let ((seq (immutable! (hash-table* :a 1)))) (object->string seq :readable))    "(immutable! (hash-table (cons :a 1)))")
(test (let ((seq (immutable! (byte-vector 1 2 3)))) (object->string seq :readable))   "(immutable! #u8(1 2 3))")
(test (let ((seq (immutable! (cons 1 2)))) (object->string seq :readable))            "(immutable! (cons 1 2))")
(test (let ((seq (immutable! '(1 2)))) (object->string seq :readable))                "(immutable! (list 1 2))")
(test (let ((seq (immutable! (list 1)))) (object->string (list seq 2) :readable))     "(list (immutable! (list 1)) 2)")
(test (let ((str (immutable! 1234))) (object->string str :readable)) "1234")
(test (let ((str (immutable! #\a))) (object->string str :readable)) "#\\a")

(test (let () (define (f str) (do ((i 0 (+ i 1))) ((= i 2)) (string-set! str 0 #\a)) str) (f (immutable! "1234"))) 'error)
(test (let () (define (f str) (do ((i 0 (+ i 1))) ((= i 2)) (string-set! str 0 #\a)) str) (f (immutable! (vector 1 2 3)))) 'error)
(test (let () (define (f str) (do ((i 0 (+ i 1))) ((= i 2)) (string-set! str 0 #\a)) str) (f (immutable! "1234"))) 'error)
(test (let () (define (f str) (do ((i 0 (+ i 1))) ((= i 2)) (set! (str 0) #\a)) str) (f (immutable! "1234"))) 'error)
(test (let () (define (f str) (do ((i 0 (+ i 1))) ((= i 2)) (do ((j 0 (+ j 1))) ((= j 2)) (string-set! str 0 #\a))) str) (f (immutable! "1234"))) 'error)
(test (let () (define (f str) (do ((i 0 (+ i 1))) ((= i 2)) (let-set! str :a 2)) str) (f (immutable! (inlet :a 1)))) 'error)
(test (let () (define (f str) (do ((i 0 (+ i 1))) ((= i 2)) (set! (str :a) 2)) str) (f (immutable! (inlet :a 1)))) 'error)
(test (let () (define (f str) (do ((i 0 (+ i 1))) ((= i 2)) (hash-table-set! str 'a 1)) str) (f (immutable! (hash-table* 'a 1)))) 'error)
(test (let () (define (f str) (do ((i 0 (+ i 1))) ((= i 2)) (set! (str 'a) 1)) str) (f (immutable! (hash-table* 'a 1)))) 'error)
(test (let () (define (f str) (do ((i 0 (+ i 1))) ((= i 2)) (list-set! str 1 2)) str) (f (immutable! (list 0 1 2)))) 'error)
(test (let () (define (f str) (do ((i 0 (+ i 1))) ((= i 2)) (set! (str 1) 2)) str) (f (immutable! (list 0 1 2)))) 'error)
(test (let () (define (f str) (do ((i 0 (+ i 1))) ((= i 2)) (set-car! str 1)) str) (f (immutable! (list 0 1 2)))) 'error)
(test (let () (define (f str) (do ((i 0 (+ i 1))) ((= i 2)) (set-cdr! str 1)) str) (f (immutable! (list 0 1 2)))) 'error)
(test (let () (define (f str) (do ((i 0 (+ i 1))) ((= i 2)) (vector-set! str 1 2)) str) (f (immutable! (vector 0 1 2)))) 'error)
(test (let () (define (f str) (do ((i 0 (+ i 1))) ((= i 2)) (set! (str 1) 2)) str) (f (immutable! (vector 0 1 2)))) 'error)
(test (let () (define (f str) (do ((i 0 (+ i 1))) ((= i 2)) (byte-vector-set! str 1 2)) str) (f (immutable! (byte-vector 0 1 2)))) 'error)
(test (let ((lt (immutable! (inlet 'a 1)))) (set! (outlet lt) (curlet))) 'error)
(test (let ((c (immutable! (cons 1 (immutable! (cons 2 ())))))) (set-car! (cdr c) 3)) 'error)
(test (let () (define (f str) (do ((i 0 (+ i 1))) ((= i 2)) (float-vector-set! str 1 2)) str) (f (immutable! (float-vector 0 1 2)))) 'error)
(test (let () (define (f str) (do ((i 0 (+ i 1))) ((= i 2)) (int-vector-set! str 1 2)) str) (f (immutable! (int-vector 0 1 2)))) 'error)

(test (let () (define (f str) (do ((i 0 (+ i 1))) ((= i 2)) (string-set! (car str) 0 #\a)) str) (f (list (immutable! "1234")))) 'error)
(test (let () (define (f str) (do ((i 0 (+ i 1))) ((= i 2)) (set! ((car str) 0) #\a)) str) (f (list (immutable! "1234")))) 'error)
(test (let () (define (f str) (do ((i 0 (+ i 1))) ((= i 2)) (do ((j 0 (+ j 1))) ((= j 2)) (string-set! (car str) 0 #\a))) str) (f (list (immutable! "1234")))) 'error)
(test (let () (define (f str) (do ((i 0 (+ i 1))) ((= i 2)) (let-set! (car str) :a 2)) str) (f (list (immutable! (inlet :a 1))))) 'error)
(test (let () (define (f str) (do ((i 0 (+ i 1))) ((= i 2)) (set! ((car str) :a) 2)) str) (f (list (immutable! (inlet :a 1))))) 'error)
(test (let () (define (f str) (do ((i 0 (+ i 1))) ((= i 2)) (hash-table-set! (car str) 'a 1)) str) (f (list (immutable! (hash-table* 'a 1))))) 'error)
(test (let () (define (f str) (do ((i 0 (+ i 1))) ((= i 2)) (set! ((car str) 'a) 1)) str) (f (list (immutable! (hash-table* 'a 1))))) 'error)
(test (let () (define (f str) (do ((i 0 (+ i 1))) ((= i 2)) (list-set! (car str) 1 2)) str) (f (list (immutable! (list 0 1 2))))) 'error)
(test (let () (define (f str) (do ((i 0 (+ i 1))) ((= i 2)) (set! ((car str) 1) 2)) str) (f (list (immutable! (list 0 1 2))))) 'error)
(test (let () (define (f str) (do ((i 0 (+ i 1))) ((= i 2)) (set-car! (car str) 1)) str) (f (list (immutable! (list 0 1 2))))) 'error)
(test (let () (define (f str) (do ((i 0 (+ i 1))) ((= i 2)) (set-cdr! (car str) 1)) str) (f (list (immutable! (list 0 1 2))))) 'error)
(test (let () (define (f str) (do ((i 0 (+ i 1))) ((= i 2)) (vector-set! (car str) 1 2)) str) (f (list (immutable! (vector 0 1 2))))) 'error)
(test (let () (define (f str) (do ((i 0 (+ i 1))) ((= i 2)) (set! ((car str) 1) 2)) str) (f (list (immutable! (vector 0 1 2))))) 'error)
(test (let () (define (f str) (do ((i 0 (+ i 1))) ((= i 2)) (float-vector-set! (car str) 1 2)) str) (f (list (immutable! (float-vector 0 1 2))))) 'error)
(test (let () (define (f str) (do ((i 0 (+ i 1))) ((= i 2)) (int-vector-set! (car str) 1 2)) str) (f (list (immutable! (int-vector 0 1 2))))) 'error)
(test (let () (define (f str) (do ((i 0 (+ i 1))) ((= i 2)) (byte-vector-set! (car str) 1 2)) str) (f (list (immutable! (byte-vector 0 1 2))))) 'error)

(test (immutable? (make-shared-vector (immutable! (vector 1 2 3 4)) 1)) #t)
(let ((lst (make-shared-vector (immutable! (vector 1 2 3 4)) 1)))
  (when (not (eq? 'error (let () (define (f) (catch #t (lambda () (vector-set! lst 1 32)) (lambda args 'error))) (define (h) (f)) (h))))
    (format *stderr* "vector-set! immutable ~S~%" lst))
  (when (not (eq? 'error (let () (define (f) (catch #t (lambda () (fill! lst 32)) (lambda args 'error))) (define (h) (f)) (h))))
    (format *stderr* "fill! immutable ~S~%" lst))
  (when (not (eq? 'error (let () (define (f) (catch #t (lambda () (reverse! lst)) (lambda args 'error))) (define (h) (f)) (h))))
    (format *stderr* "reverse! immutable ~S~%" lst))
  (when (not (eq? 'error (let () (define (f) (catch #t (lambda () (set! (lst 1) 32)) (lambda args 'error))) (define (h) (f)) (h))))
    (format *stderr* "set! immutable ~S~%" lst))
  (when (not (eq? 'error (let () (define (f) (catch #t (lambda () (sort! lst >)) (lambda args 'error))) (define (h) (f)) (h))))
    (format *stderr* "sort! immutable ~S~%" lst)))

#|
;; can't decide about this
(let ((lst (cons 1 (immutable! (cons 2 (immutable! (cons 3 ())))))))
  (when (not (eq? 'error (let () (define (f) (catch #t (lambda () (list-set! lst 1 32)) (lambda args 'error))) (define (h) (f)) (h))))
    (format *stderr* "list-set! ~S~%" lst))
  (when (not (eq? 'error (let () (define (f) (catch #t (lambda () (fill! lst 32)) (lambda args 'error))) (define (h) (f)) (h))))
    (format *stderr* "fill! ~S~%" lst))
  (when (not (eq? 'error (let () (define (f) (catch #t (lambda () (reverse! lst)) (lambda args 'error))) (define (h) (f)) (h)))) 
    (format *stderr* "reverse! ~S~%" lst))  ; ok
  (when (not (eq? 'error (let () (define (f) (catch #t (lambda () (set! (lst 1) 32)) (lambda args 'error))) (define (h) (f)) (h))))
    (format *stderr* "set! ~S~%" lst))
  (when (not (eq? 'error (let () (define (f) (catch #t (lambda () (sort! lst >)) (lambda args 'error))) (define (h) (f)) (h))))
    (format *stderr* "sort! ~S~%" lst))
  (when (not (eq? 'error (let () (define (f) (catch #t (lambda () (set-car! (cdr lst) 32)) (lambda args 'error))) (define (h) (f)) (h))))
    (format *stderr* "set-car! ~S~%" lst))  ; ok
  (when (not (eq? 'error (let () (define (f) (catch #t (lambda () (set-cdr! (cdr lst) 32)) (lambda args 'error))) (define (h) (f)) (h))))
    (format *stderr* "set-cdr! ~S~%" lst))) ; ok
|#

(let-temporarily (((*s7* 'safety) 2))
  (test (immutable? (eval (with-input-from-string "'(1 2)" read))) #t))

(test (catch #t 
	(lambda () 
	  (catch #t 1 
		 (lambda (type info)
		   (set-cdr! (cdr info) info))))
	(lambda args 'error))
      'error)

(test (catch #t 
	(lambda () 
	  (catch #t 1 
		 (lambda (type info)
		   (reverse! info))))
	(lambda args 'error))
      'error)

(test (let ((lst (immutable! (cons 1 2))))
	(define (f) (set! (cdr lst) 3))
	(define (h) (f)) (h))
      'error)
#|

;;; it's possible to clobber the built-in error cases:
(let ()
  (copy (catch #t 1 (lambda (type info) info)) (catch #t 1 cons))
  (catch #t 1 (lambda (type info) (apply format #f info))))
|#

;;; does this make sense?:
(test (let ((x 1)) (immutable! 'x) (let ((x x)) (set! x 2))) 2)
(test (let () (define-constant x 1) (let ((x x)) (set! x 2))) 'error)



;;; --------------------------------------------------------------------------------
;;; defined?

(test (defined? 'pi) #t)
(test (defined? 'pi (rootlet)) #t)
(test (defined? 'abs (rootlet)) #t)
(test (defined? 'abs (rootlet) #f) #t)
(test (defined? 'abs (rootlet) #t) #f) ;! #t=ignore rootlet
(test (defined? 'abs (curlet)) #t)
(test (defined? 'abs (curlet) #f) #t)
(test (defined? 'abs (curlet) #t) #f)
(test (let ((__c2__ 32)) (defined? '__c2__)) #t)
(test (let ((__c2__ 32)) (defined? '__c2__ (curlet))) #t)
(test (let ((__c2__ 32)) (defined? '__c3__ (curlet))) #f)
(test (let ((__c2__ 32)) (defined? '__c2__ (rootlet))) #f)
(test (let ((__c2__ 32)) (defined? '__c3__ (rootlet))) #f)
(test (let ((ge (rootlet))) (ge 'abs)) abs)
(test (let ((ge (rootlet))) (ge 'rootlet)) rootlet)
(test (let ((ge (rootlet))) (ge 'define)) define)
(test (let ((ge (rootlet))) (ge 'if)) if)
(test (let ((ge (rootlet))) (let ((abc 1)) (ge 'abc))) #<undefined>)
(test (defined?) 'error)
(test (defined? 'a 'b) 'error)
(test (defined? 'abs (curlet)) #t)
(test (defined? 'abs (curlet) #()) 'error)
(test (defined? 'abs 0) 'error)
(test (let () (defined? 'abs (curlet) #())) 'error)
(for-each
 (lambda (arg)
   (test (defined? arg) 'error)
   (test (defined? 'abs arg) 'error))
 (list -1 #\a 1 _ht_ _undef_ _null_ _c_obj_ #(1 2 3) 3.14 3/4 1.0+1.0i () #f #(()) (list 1 2 3) '(1 . 2) "hi"))
(test (defined? 'lambda car) 'error)
(test (defined? lambda gensym) 'error)
(test (defined? 'lambda defined?) 'error)
(test (defined? 'define car) 'error)
(test (defined? 'abs (sublet ())) #t) ; nil = global now
(test (defined? lambda) 'error)
(test (defined? 'lambda) #t)
(test (defined? 'dynamic-wind) #t)
(test (defined? 'asdaf) #f)
;(test (defined? ':asdaf) #f) ; keywords are defined in the sense that they evaluate to themselves
;(test (defined? :asdaf) #f)
(test (defined? 'ok?) #t)
(test (defined? 'test-t) #t)
(test (defined? 'quasiquote) #t)
(test (defined? (symbol "123")) #f)
(test (defined? (symbol "+")) #t)
(test (defined? ''+) 'error)
(test (defined? 'if) #t)
(test (defined? if) 'error)
(test (defined? quote) 'error)
(test (let () (defined? 'abs (curlet) #t)) #f)
(test (let () (defined? 'abs (curlet))) #t)
(test (let () (defined? 'abs (curlet) #f)) #t)

(test (let ((b 2))
	(let ((e (curlet)))
	  (let ((a 1))
	    (if (defined? 'a e)
		(format #f "a: ~A in ~{~A ~}" (symbol->value 'a e) e)))))
      #<unspecified>) ; not "a: 1 in (b . 2)")

(test (let ((b 2))
	(let ((e (curlet)))
	  (let ((a 1))
	    (format #f "~A: ~A" (defined? 'abs e) (eval '(abs -1) e)))))
      "#t: 1")


;;; --------------------------------------------------------------------------------
;;; undefined?

(for-each
 (lambda (arg)
   (test (undefined? arg) #f))
 (list #<eof> #<unspecified> -1 #\a 1 _ht_ _null_ _c_obj_ #(1 2 3) 3.14 3/4 1.0+1.0i () #f #(()) (list 1 2 3) '(1 . 2) "hi"))
(test (undefined? #<undefined>) #t)
(test (undefined? _undef_) #t)
(test (undefined?) 'error)
(test (undefined? 1 2) 'error)
(test (object->let _undef_) (inlet 'value _undef_ 'type 'undefined?))
(test (object->let #<undefined>) (inlet 'value #<undefined> 'type 'undefined?))


;;; --------------------------------------------------------------------------------
;;; unspecified?

(for-each
 (lambda (arg)
   (test (unspecified? arg) #f))
 (list -1 #\a 1 _ht_ _undef_ #<eof> _null_ _c_obj_ #(1 2 3) 3.14 3/4 1.0+1.0i () #f #(()) (list 1 2 3) '(1 . 2) "hi"))
(test (unspecified? #<unspecified>) #t)
(test (unspecified? (values)) #t)
(test (unspecified?) 'error)
(test (unspecified? 1 2) 'error)
(test (object->let #<unspecified>) (inlet 'value #<unspecified> 'type 'unspecified?))
(test (object->let (values)) (inlet 'value (values) 'type 'unspecified?))


;;; --------------------------------------------------------------------------------
;;; let?
;;; inlet
;;; rootlet
;;; curlet
;;; sublet
;;; with-let
;;; let->list
;;; outlet
;;; let-ref
;;; let-set!
;;; varlet
;;; cutlet
;;; coverlet
;;; openlet
;;; unlet

(test (let () (length (curlet))) 0)
(test (let ((a 1) (b 2) (c 3)) (length (curlet))) 3)

(for-each
 (lambda (arg)
   (test (let? arg) #f))
 (list -1 #\a 1 #(1 2 3) 3.14 3/4 1.0+1.0i () #f #(()) (list 1 2 3) '(1 . 2) "hi" '((a . 1))))
(let () (test (let? (unlet)) #t))
(test (let? (curlet)) #t)
(test (let? (rootlet)) #t)
(test (let? (sublet ())) #t)
(test (let? (varlet ())) #t)
(test (let? (sublet (sublet ()) '(a . 1))) #t)
(test (let? (sublet () '(a . 1))) #t)
(test (eq? abs ((rootlet) 'abs)) #t)
(test (eq? abs #_abs) #t)
(test (eq? abs (with-let (unlet) abs)) #t)
(test ((sublet () '(asdf . 32)) 'asdf) 32)
(test ((sublet () '(asdf . 32)) 'asd) #<undefined>)
(test (let? (sublet (curlet))) #t) ; no bindings is like (let () ...)
(test (varlet (rootlet) '(quote . 1)) 'error)
(test (varlet (rootlet) 'if 3) 'error)
(test (let-set! (rootlet) 'if 3) 'error)

(test (eq? (curlet) (let ((a (curlet))) a)) #t)
(test (eq? (curlet) (let* ((a (curlet))) a)) #t)
(test (eq? (curlet) (letrec ((a (curlet))) a)) #f)
(test (eq? (curlet) (letrec* ((a (curlet))) a)) #f)
(test (let ((a (curlet))) (eq? a (curlet))) #f)
(test (letrec ((a (curlet))) (eq? a (curlet))) #t)

(test (let ((e (inlet 'e (inlet '+ -)))) (((e 'e) '+) 2 3)) -1)
(test (let ((confused (inlet '+ -))) ((confused '+) 2 3)) -1)
;;;  (with-let (inlet '+ -) (+ 2 3)) -> 5
;;;  (with-let (inlet '+ -) (((curlet) '+) 2 3)) -> -1
;;;  (with-let (inlet 'plus -) (plus 2 3)) -> -1
;;; which is consistent, so to speak, with the (set! gcd +) example mentioned in s7.html

(test (((let ((x (lambda (y) (+ y 1)))) (curlet)) 'x) 2) 3)

(test (equal? (inlet 'a 1) (inlet 'a 1)) #t)
(test (morally-equal? (inlet 'a 1) (inlet 'a 1)) #t)
(test (equal? (inlet 'a 1) (inlet 'a 2 'a 1)) #t)
(test (equal? (inlet 'a 3 'a 1) (inlet 'a 2 'a 1)) #t)
(test (morally-equal? (inlet 'a 1) (inlet 'a 2 'a 1)) #t)
(test (equal? (inlet 'a 1 'b "hi") (inlet 'a 1 'b "hi")) #t)
(test (morally-equal? (inlet 'a 1 'b "hi") (inlet 'a 1 'b "hi")) #t)
(test (equal? (inlet 'b "hi" 'a 1) (inlet 'a 1 'b "hi")) #t)
(test (morally-equal? (inlet 'b "hi" 'a 1) (inlet 'a 1 'b "hi")) #t)
(test (equal? (inlet 'a 2 'b "hi" 'a 1) (inlet 'b "hi" 'a 2 'a 1)) #t)
(test (equal? (inlet 'a (vector 1.0)) (inlet 'a (float-vector 1.0))) #f)
(test (morally-equal? (inlet 'a (vector 1.0)) (inlet 'a (float-vector 1.0))) #t)
(test (equal? (inlet 'b "hi" 'a 1) (inlet 'b "hi" 'a 1.0)) #f)
(test (morally-equal? (inlet 'b "hi" 'a 1) (inlet 'b "hi" 'a 1.0)) #t)
(test (equal? (inlet 'b "hi" 'a 1) (inlet 'b "hi" 'a 1/2)) #f)
(test (morally-equal? (inlet 'b "hi" 'a 1) (inlet 'b "hi" 'a 1/2)) #f)
(test (equal? (inlet 'a 1) (inlet 'b "hi" 'a 1)) #f)
(test (equal? (inlet 'a 1 'b "hi") (inlet 'a 1)) #f)
(test (equal? (inlet 'a 1 'a 1) (inlet 'a 1)) #t)
(test (equal? (inlet 'a (inlet 'b 1)) (inlet 'a (inlet 'b 1))) #t)
(test (equal? (inlet 'a (inlet 'b 1)) (inlet 'a (inlet 'b 1))) #t)
(test (equal? (inlet 'b (inlet 'b 1)) (inlet 'b (inlet 'b 1))) #t)
(test (equal? (inlet) (inlet)) #t)
(test (equal? (inlet 'a 1) (inlet)) #f)
(test (equal? (inlet) (inlet 'a 1)) #f)
(test (object->string (inlet 'a 1 'a 3)) "(inlet 'a 1 'a 3)")
(test ((inlet 'a 1 'a 3) 'a) 3) ; so the print form follows the input order, but the earlier entries (as printed) are shadowed
(test (equal? (inlet) (sublet (inlet))) #t)
(test (equal? (inlet 'a 1) (inlet 'a 2)) #f)
(test (equal? (inlet 'a 1) (inlet 'b 1)) #f)
(test (equal? (inlet 'a 1) (inlet 'a 1 'b 1)) #f)
(test (equal? (inlet 'a 1 'b 1) (inlet 'a 1 'c 1)) #f)
(test (equal? (inlet 'a 1 'b 1) (inlet 'a 1 'b 1)) #t)
(test (equal? (inlet 'a 1) (inlet 'a 1 'a 1)) #t)
(test (equal? (inlet 'a 1) (inlet 'a 1 'a 2)) #f)
(test (equal? (sublet (inlet 'a 1) 'b 2) (sublet (inlet 'a 1) 'b 2)) #t)
(test (equal? (sublet (inlet 'a 1) 'b 2) (sublet (inlet 'a 2) 'b 2)) #f)
(test (equal? (sublet (inlet 'a 1) 'b 2) (sublet (inlet 'a 1) 'b 1)) #f)
(test (equal? (sublet (inlet 'a 1) 'b 2) (sublet (inlet 'a 1))) #f)
(test (equal? (sublet (inlet 'a 1)) (sublet (inlet))) #f)
(test (equal? (sublet (inlet 'a 1)) (inlet 'a 1)) #t)
(test (equal? (sublet (sublet (inlet 'a 1))) (sublet (inlet 'a 1))) #t)
(test (let ((e (inlet 'a 1))) (equal? (sublet e 'a 1) (sublet e 'a 1))) #t)
(test (equal? (inlet 'a 1 'b 2 'c 3) (inlet 'c 3 'b 2 'a 1)) #t)
(test (equal? (inlet 'a 1 'b 2 'c 3) (inlet 'c 3 'b 1 'a 1)) #f)
(test (equal? (inlet 'a 1 'a 2) (inlet 'a 3 'a 2)) #t)
(test (equal? (sublet (inlet 'a 1 'a 3) 'a 2) (sublet (inlet 'a 3) 'a 2)) #t)
(test (equal? (inlet 'a 1) (inlet 'a 1 'b 2)) #f)
(test (equal? (inlet 'a 1) (sublet (inlet 'a 1))) #t)
(test (equal? (sublet (inlet 'a 1)) (inlet 'a 1)) #t)

(test (equal? (inlet (cons 'a 1)) (inlet 'a 1)) #t)
(test (equal? (inlet (cons :a 1)) (inlet 'a 1)) #t)
(test (equal? (inlet :a 1) (inlet 'a 1)) #t)
(test (inlet 'if 3) 'error)
(test (inlet 'pi 3) 'error)

(test (varlet (immutable! (inlet 'a 1)) 'b 2) 'error)
(test (cutlet (immutable! (inlet 'a 1)) 'a) 'error)
(test (let ((a 1)) (immutable! (curlet)) (define b 2)) 'error)
(test (with-let (immutable! (inlet 'a 1)) (define b 2)) 'error)

(test (let ((e (inlet 'a 1 'a 2)))
	(let ((c (copy e)))
	  (list (e 'a) (c 'a))))
      '(2 2))

(test (equal? (inlet 'a 1) (sublet (inlet 'a 1))) #t)
(test (equal? (sublet (inlet 'a 1) 'b 2) (sublet (inlet 'a 1 'b 2) 'b 2)) #t)
(test (equal? (sublet (inlet 'a 3) 'a 2) (sublet (inlet 'a 1) 'a 2)) #t)  ; ((sublet (inlet 'a 1) 'a 2) 'a) -> 2
(test (equal? (sublet (inlet) 'a 2) (sublet (inlet 'a 1) 'a 2)) #t)
(test (equal? (inlet 'a 1) (inlet 'a 3 'a 2 'a 1)) #t)

(let ((f (inlet 'sym 'sam 'sam 'sym))
      (g (inlet 'sam 'sym 'sym 'sam)))
  (test (f (g 'sym)) 'sym)
  (test (f (f 'sym)) 'sym)
  (test (g (f 'sam)) 'sam)
  (test (g (f (g (f (f 'sym))))) 'sam))


(let ((f (inlet :a 1 :b 2)))
  (test (length f) 2)
  (fill! f #<undefined>)
  (test (length f) 0)
  (test (f 'b) #<undefined>)
  (test (let-ref f 'a) #<undefined>))


(test (apply inlet (map values (hash-table '(a . 1) '(b . 2)))) (inlet 'b 2 'a 1))
(test (apply hash-table (map values (inlet 'a 1 'b 2))) (hash-table '(a . 1) '(b . 2)))

(let ((e (inlet 'a 1 'a 2)))
  (test (e 'a) ((copy e) 'a)))

(let ((e1 (inlet 'a 1 'a 2))) 
  (let ((e2 (copy e1))) 
    (test (list (equal? e1 e2) (equal? (e1 'a) (e2 'a))) '(#t #t))))

(let ()    
  (define-bacro (let/ e . body)
    `(with-let (sublet (curlet) ,e)
       ,@body))
  (test (let ((a 1))
	  (let/ (inlet 'b 2)
	    (+ a b)))
	3))

(let ((e (inlet 'a (inlet 'b 1 'c 2) 'b (inlet 'b 3 'c 4))))
  (test (e 'a 'b) 1)
  (test (e 'b 'b) 3)
  (test (e 'b 'c) 4))

(let ()
  (define (f1) (let ((e (inlet 'a 1))) (e '(1))))
  (test (f1) 'error))

(test (equal? (inlet 'a 1) (cutlet (inlet 'a 1 'b 2) 'b)) #t)
(test (equal? (inlet 'a 1) (inlet 'a 1 'b 2)) #f)
(test (length (cutlet (inlet 'a 1 'b 2 'c 3) 'b 'a)) 1)
(test (length (cutlet (inlet 'a 1 'b 2 'c 3) 'd)) 3)
(test (let->list (cutlet (inlet 'a 1 'b 2 'c 3) 'b 'a)) '((c . 3)))
(test ((cutlet (inlet 'a 1 'b 2) 'a) 'a) #<undefined>)
(test ((cutlet (inlet 'a 1 'b 2 'c 3) 'a) 'b) 2)
(test ((cutlet (inlet 'a 1 'b 2) 'a) 'b) 2)
(test ((cutlet (inlet 'a 1 'b 2 'c 3) 'a 'b 'c) 'a) #<undefined>)
(test ((cutlet (inlet 'a 1 'b 2 'c 3 'a 4) 'a) 'a) 1)  ; shadowed in order added
(define ___a 32) (cutlet (rootlet) '___a) (test ___a #<undefined>)
(test (cutlet (inlet)) (inlet))
(test (cutlet (inlet 'a 1) 'a) (inlet))
(test ((cutlet (inlet 'a 1 'a 2) 'a) 'a) 1)
(test (let ((g (gensym))) (cutlet (inlet g '1) g)) (inlet))
(test (cutlet (sublet (inlet 'a 1) 'b 2) 'a) (sublet (inlet 'a 1) 'b 2))
(test (let ((b 2)) (cutlet (curlet) 'b) b) 'error) ; unbound variable
(test (let ((b 1)) (let ((b 2)) (cutlet (curlet) 'b)) b) 1)

(test (let ((#_+ 3)) #_+) 'error)
(test (define #_+ 3) 'error)
(test (set! #_+ 3) 'error)

(test (let ((a 21)) (let ((e (inlet (curlet)))) (set! a 32) (with-let e a))) 21)
(test (let ((a 21)) (let ((e (sublet (curlet)))) (set! a 32) (with-let e a))) 32)

(let ()
  (define hi (inlet 'x 12))
  (let ((x 32)
	(y 1))
    (let ((old-out (outlet hi)))
      (set! (outlet hi) (curlet))
      (with-let hi                              ; x 12 y 1
	(test (+ x y) 13))
      (set! (outlet hi) old-out)                ; x 32 y 1
      (test (+ x y) 33)
      (with-let hi                              ; x 12 y #<undefined>
	(test x 12)
	(test (defined? 'y) #f)))))

(test (let ()
	(with-let (curlet) (define hiho 43))
	hiho)
      43)
(let ()
  (define-macro (define! env . args) 
    `(with-let ,env (define ,@args)))
  (test (let ()
	  (define! (curlet) (hiho x) (+ x 1))
	  (hiho 2))
	3))

(test (let () (with-let (curlet) (define (f3 a) (+ a 2))) (f3 1)) 3)

(let ()
  (with-let (rootlet)
    (define (this-is-global a) (+ a 1))))

(test (this-is-global 2) 3)

(let ()
  (with-let (inlet)
    (define (this-is-not-global a) (+ a 1))))

(test (this-is-not-global 2) 'error)


(let ()
  (apply varlet (curlet)
	 (with-let (unlet)
	   (let ()
	     (define (lognor n1 n2) (lognot (logior n1 n2)))
	     (define (logit n1) n1)

	     (map (lambda (binding)
		    (cons (string->symbol 
			   (string-append "library:" (symbol->string (car binding))))
			  (cdr binding)))
		  (curlet)))))
  (test (library:lognor 1 2) -4))

(let ()
  (define (f1)
    (let ((a 0)
	  (v (make-vector 3)))
      (do ((i 0 (+ i 1)))
	  ((= i 3) v)
	(vector-set! v i a)
	(varlet (curlet) 'a i))))
  
  (test (f1) #(0 0 1))
  
  (define (f2)
    (let ((v (make-vector 3)))
      (do ((i 0 (+ i 1)))
	  ((= i 3) v)
	(varlet (curlet) 'a i)
	(vector-set! v i a))))
  
  (test (f2) #(0 1 2)))

(let ()
  (varlet (curlet)
    ((lambda (a b)
       (define (f1 x) (+ x a))
       (define (f2 x) (+ x a b))
       (curlet))
     1 2))
  (test (f1 3) 4)
  (test (f2 3) 6))

(test (null? (let->list (rootlet))) #f)

(test (let? (inlet)) #t)
(test (length (inlet)) 0)
(test (length (inlet '(a . 2))) 1)
(test (with-let (inlet '(a . 2)) a) 2)
(test (with-let (inlet '(a . 2) '(b . 3)) (+ a b)) 5)
(test (eq? (inlet) (rootlet)) #f)
(test ((inlet (inlet '(a . 1))) 'a) 1)
(test ((inlet (inlet '(a . 1)) '(b . 2)) 'b) 2)
(test ((inlet '(b . 3) (inlet '(a . 1))) 'b) 3)
(test (let ((a 1)) ((inlet (curlet)) 'a)) 1)
(test (let ((a 1)) ((inlet '(b . 2)) 'a)) #<undefined>)
(test (let ((a (inlet 'b 2))) (set! (let-ref a 'b) 3) (a 'b)) 3) ; let-ref setter is let-set!

(for-each
 (lambda (arg)
   (test (sublet arg) 'error)
   (test (varlet arg) 'error)
   (test (cutlet arg) 'error)
   (test (cutlet (curlet) arg) 'error))
 (list -1 #\a 1 #(1 2 3) 3.14 3/4 1.0+1.0i pi abs macroexpand #<eof> #<unspecified> #f #(()) (list 1 2 3) '(1 . 2) "hi" '((a . 1))))

(test (let ((e (inlet '(a . 1)))) ((lambda (x) (x *)) e)) 'error)
(test (let ((e (inlet '(a . 1)))) ((lambda (x) (x pi)) e)) 'error)
(test (let () (inlet (cons pi 1))) 'error)
(test (let () (inlet (cons "hi" 1))) 'error)


(test (let? (inlet)) #t)
(test (length (inlet)) 0)
(test (length (inlet 'a 2)) 1)
(test (with-let (inlet 'a 2) a) 2)
(test (with-let (inlet 'a 2 'b 3) (+ a b)) 5)
(test (eq? (inlet) (rootlet)) #f)
(test ((inlet (inlet 'a 1)) 'a) 1)
(test ((inlet (inlet 'a 1) '(b . 2)) 'b) 2)

(test (let ((c 1)) (set! (with-let (curlet) c) 32) c) 32)
(test (let ((c (list 1 2))) (set! (with-let (curlet) (c 1)) 32) c) '(1 32))
(test (let ((c (list 1 2))) (set! (with-let (curlet) (c 3)) 32) c) 'error)
(test (let ((a (inlet 'b #(0 1)))) (set! (with-let a (b 0)) 1) ((a 'b) 0)) 1)
(test (set! (with-let (curlet) 3) 2) 'error)
(test (let ((c (list 1 2))) (set! (with-let (curlet) (c 3)) 32 0)) 'error)
(test (abs (let ((abs (lambda (x) 32))) (openlet (curlet)))) 32)

(let ((a (inlet 'abc (let ((inx 0)) (dilambda (lambda () inx) (lambda (y) (set! inx y)))))))
  (set! ((a 'abc)) 32)
  (test ((a 'abc)) 32)
  (with-let a (set! (abc) 1))
  (test (with-let a (abc)) 1)
  (set! (with-let a (abc)) 3)
  (test ((a 'abc)) 3))

(let ((lt1 (inlet 'a 1 'b 2)))
  (set! (with-let lt1 a) 32)
  (test (lt1 'a) 32)
  (set! (with-let lt1 a) (with-let lt1 (+ a b)))
  (test (lt1 'a) 34)
  (set! (with-let (curlet) (*s7* 'print-length)) 16)
  (test (*s7* 'print-length) 16)
  (varlet lt1 'c (vector 1 2 3))
  (set! (with-let lt1 (c 1)) 12)
  (test ((lt1 'c) 1) 12)
  (let ((lt2 (list lt1)))
    (set! (with-let (car lt2) (c 0)) 11)
    (test ((lt1 'c) 0) 11))
  (let ((lt2 (list lt1))
	(d 100))
    (set! (with-let (car lt2) (c (sqrt 4))) (sqrt d))
    (test ((lt1 'c) 2) 10))
  (let ((lt3 (inlet 'a (vector 1 2 3))))
    (set! (with-let lt3 a) '(1 2))
    (test (lt3 'a) '(1 2)))
  (let ((lt3 (inlet 'a (vector 1 2 3) 'b 1)))
    (set! (with-let lt3 a) 'b)
    (test (lt3 'a) 'b)))

(for-each
 (lambda (arg)
   (test (inlet arg) 'error)
   (test (apply inlet arg) 'error))
 (list -1 #\a 1 #(1 2 3) 3.14 3/4 1.0+1.0i pi abs macroexpand #<eof> #<unspecified> #f #(()) (list 1 2 3) '(1 . 2) "hi"))

(test (inlet 'a) 'error)
(test (inlet 1 2) 'error)
(test (inlet 'a 2 'b) 'error)
(test (with-let (inlet 'a (let ((p (open-output-string))) (display "32" p) p)) (get-output-string a)) "32")

(test (set! (with-let) 1) 'error)
(test (set! (with-let (curlet)) 1) 'error)

(for-each
 (lambda (arg)
   (test (let->list arg) 'error))
 (list -1 #\a 1 #(1 2 3) 3.14 3/4 1.0+1.0i pi () #f #(()) (list 1 2 3) '(1 . 2) "hi" '((a . 1))))

(for-each
 (lambda (arg)
   (test (openlet arg) 'error)
   (test (coverlet arg) 'error))
 (list -1 #\a 1 #(1 2 3) 3.14 3/4 1.0+1.0i pi abs macroexpand () #<eof> #<unspecified> #f #(()) (list 1 2 3) '(1 . 2) "hi" '((a . 1))))

(let ()
  (let ((_xxx_ 0))
    (let ((e (curlet)))
      (for-each
       (lambda (arg)
	 (let-set! e '_xxx_ arg)
	 (test (let-ref e '_xxx_) arg))
       (list -1 #\a 1 #(1 2 3) 3.14 3/4 1.0+1.0i pi abs macroexpand () #<eof> #<unspecified> #f #(()) (list 1 2 3) '(1 . 2) "hi" '((a . 1)))))))

(test (let-ref) 'error)
(test (let-ref (curlet)) 'error)
(test (let-ref a b c) 'error)
(test (let-ref (sublet ()) '_asdf_) #<undefined>)
(test (let-ref (sublet () '(a . 3)) 'a) 3)
(test (let-ref (sublet () '(a . 3)) 'A) #<undefined>)
(test (let-ref (rootlet) '+) +)
(test (let-ref (rootlet) +) 'error)
(test (let-ref () '+) 'error)
(test (let-ref (funclet (let ((a 2)) (lambda (b) (+ a b)))) 'a) 2)
(let ((etest (let ((a 2)) (lambda (b) (+ a b))))) 
  (let-set! (funclet etest) 'a 32)
  (test (etest 1) 33))
(test (let-set!) 'error)
(test (let-set! a b) 'error)
(let ((e (inlet 'a 1))) (test (let-set! e 'b 2) 'error))
(let ((e (inlet (cons 'a 1))))
  (define (eref a) (e a))
  (define (eset a b) (set! (e a) b))
  (for-each
   (lambda (arg)
     (test (let-ref arg 'a) 'error)
     (test (let-set! arg 'a 1) 'error)
     (test (let-ref e arg) 'error)
     (test (let-set! e arg #f) 'error)
     (test (e arg) 'error)
     (test (set! (e arg) #f) 'error)
     (test (eref arg) 'error)
     (test (eset (e arg) #f) 'error))
 (list -1 #\a 1 #(1 2 3) 3.14 3/4 1.0+1.0i pi abs macroexpand () #<eof> #<unspecified> #f #(()) (list 1 2 3) '(1 . 2) "hi" '((a . 1)))))

(let () (define (ft) (let ((a (vector #f)) (b 0)) (*s7* (vector-ref a b)))) (test (ft) 'error))

(test (inlet :a 1) (inlet (cons 'a 1)))
(test (inlet :a 1 :b 2) (inlet 'a 1 'b 2))
(test (inlet 'pi 3.0) 'error)

#|
;; not sure about this...
(let ((e (inlet 'a 1)))
  (test (let-set! e :a 2) #<undefined>)
  (test (let-ref e :a) #<undefined>)
  (test (let-ref e 'a) 1))
|#

(for-each
 (lambda (arg)
   (test (openlet? arg) #f))
 (list -1 #\a 1 #(1 2 3) 3.14 3/4 1.0+1.0i () abs macroexpand #<eof> #<unspecified> #f #(()) (list 1 2 3) '(1 . 2) "hi" '((a . 1))))

(test (openlet) 'error)
(test (openlet 1 2) 'error)
(test (openlet?) 'error)
(test (openlet? 1 2) 'error)
(test (openlet (rootlet)) 'error)

(let ((e (openlet (inlet 'a 1))))
  (test (openlet? (sublet e '(b . 2))) #t))
(let ()
  (let ((f (lambda (x) (+ x 1))))
    (test (openlet? f) #f)
    (openlet f)
    (test (openlet? f) #t)
    (coverlet f)
    (test (openlet? f) #f))
  
  (let ((f (lambda* (x) (+ x 1))))
    (test (openlet? f) #f)
    (openlet f)
    (test (openlet? f) #t)
    (coverlet f)
    (test (openlet? f) #f))
  
  (let ((f (sublet ())))
    (test (openlet? f) #f)
    (openlet f)
    (test (openlet? f) #t)
    (coverlet f)
    (test (openlet? f) #f))
  
  (let ((e1 (openlet (inlet 'f1 (define-macro (f1 a) `(+ ,a 1))))))
    (test ((e1 'f1) 3) 4))
  
  (let ()
    (define-macro (f x) `(+ ,x 1))
    (test (openlet? f) #f)
    (test (openlet f) f)
    (test (openlet? f) #t)
    (test (coverlet f) f))
  
  (let ()
    (define-bacro* (f x) `(+ ,x 1))
    (test (openlet? f) #f)
    (test (openlet f) f)
    (test (openlet? f) #t)
    (test (coverlet f) f))
  )
(test (curlet 1) 'error)
(test (rootlet 1) 'error)
(test (unlet 1) 'error)
(test (set! (curlet) 1) 'error)
(test (set! (rootlet) 1) 'error)
(test (set! (unlet) 1) 'error)
(test (let () (set! unlet 2)) 'error)
(test (let ((unlet 2)) unlet) 'error)

(test (let ((e (sublet () '(a . 1)))) ((lambda (x) (x *)) e)) 'error)
(test (let ((e (sublet () '(a . 1)))) ((lambda (x) (x pi)) e)) 'error)
(test (let () (sublet () (cons pi 1))) 'error)
(test (let () (sublet () (cons "hi" 1))) 'error)
(test (let () (varlet () (cons pi 1))) 'error)
(test (let () (varlet () (cons "hi" 1))) 'error)

(test (let ((lt (openlet (inlet 'x (list 1 2 3) 'make-iterator (let ((iterator? #t)) (lambda (e) (#_make-iterator (e 'x)))))))) (format #f "~{~A~^ ~}" lt)) "1 2 3")
(when (not pure-s7) (test (let ((lt (openlet (inlet 'x (list 1 2 3) 'let->list (lambda (e) (e 'x)))))) (format #f "~{~A~^ ~}" lt)) "1 2 3"))

(test (eq? (rootlet) ()) #f)
(test (eq? (rootlet) (rootlet)) #t)
(test (eq? (rootlet) (unlet)) #f)
(test (eqv? (rootlet) (rootlet)) #t)
(test (eqv? (rootlet) (unlet)) #f)
(test (equal? (rootlet) (rootlet)) #t)
(test (equal? (rootlet) (unlet)) #f)
;(test (equal? (curlet) (unlet)) #f)
(let ((e #f) (g #f))
  (set! e (curlet))
  (set! g (rootlet))
  (if (not (equal? e (curlet))) ; test here introduces a new environment
      (format #t ";(equal? e (curlet)) -> #f?~%"))
  (test g (rootlet))
  (test (equal? e g) #f)
  (let ()
    (if (not (equal? e (curlet)))
	(format #t ";2nd case (equal? e (curlet)) -> #f?~%"))))

(let ()
  (define global-env (rootlet)) 
  (test (equal? global-env (rootlet)) #t)
  (test (equal? (list global-env) (list (rootlet))) #t)
  (test (morally-equal? global-env (rootlet)) #t)
  (test (morally-equal? (list global-env) (list (rootlet))) #t))

(test (pair? (member (let ((a 1) (b 2)) (map cdr (curlet))) '((1 2) (2 1)))) #t)
(test (let () (map cdr (curlet))) ())
(test (pair? (member (let ((vals ())) (let ((a 1) (b 2)) (for-each (lambda (slot) (set! vals (cons (cdr slot) vals))) (curlet))) vals) '((2 1) (1 2)))) #t)
(test (let ((a '(1 2 3)) (b '(3 4 5)) (c '(6 7 8))) (map + a b c (apply values (map cdr (curlet))))) '(20 26 32))
(test (pair? (member (let ((a 1) (b 2) (c 3)) (map (lambda (a b) (+ a (cdr b))) (list 1 2 3) (curlet))) '((2 4 6) (4 4 4)))) #t)

(test (let () (format #f "~A" (curlet))) "(inlet)") 
;(test (let ((a 32) (b '(1 2 3))) (format #f "~A" (curlet))) "(inlet)")
;(test (let ((a 1)) (object->string (curlet))) "(inlet)")
(test (let ((a 1)) (object->string (rootlet))) "(rootlet)")
(test (format #f "~A" (rootlet)) "(rootlet)")
(test (let ((a 32) (b #(1 2 3))) (format #f "~{~A~^ ~}" (curlet))) "(a . 32) (b . #(1 2 3))")

(test (object->string (rootlet)) "(rootlet)")
(test (let () (object->string (curlet))) "(inlet)")
(test (let ((a 3)) (object->string (curlet))) "(inlet 'a 3)")
(test (let ((a 3) (b "hi")) (object->string (curlet))) "(inlet 'a 3 'b \"hi\")")
(test (let ()
	(define (hi a b) (curlet))
	(object->string (hi 3 4))) "(inlet 'a 3 'b 4)")


(test (let () (varlet (unlet) (cons 'a 32)) (symbol->value 'a (unlet))) #<undefined>)
(test (let ((caar 123)) (+ caar (with-let (unlet) (caar '((2) 3))))) 125)
(test (let ()
	(+ (let ((caar 123)) 
	     (+ caar (with-let (unlet) 
                       (let ((val (caar '((2) 3)))) 
			 (set! caar -1) 
			 (+ val caar))))) ; 124
	   (let ((caar -123)) 
	     (+ caar (with-let (unlet) 
                       (let ((val (caar '((20) 3)))) 
			 (set! caar -2) 
			 (+ val caar))))) ; -105
	   (caar '((30) 3)))) ; 30 + 19
      49)

(test (let ((a 1)) (eval '(+ a b) (sublet (curlet) (cons 'b 32)))) 33)
(test (let ((a 1)) (+ (eval '(+ a b) (sublet (curlet) (cons 'b 32))) a)) 34)
(test (let ((a 1)) (+ (eval '(+ a b) (sublet (curlet) (cons 'b 32) (cons 'a 12))) a)) 45)
(test (let ((a 2)) (eval '(+ a 1) (sublet (curlet)))) 3)
(test (let ((a 1)) (+ (eval '(+ a b) (sublet (sublet (curlet) (cons 'b 32)) (cons 'a 12))) a)) 45)
(test (eval (list + 'a (eval (list - 'b) (sublet (unlet) (cons 'b 1)))) 
	    (sublet (unlet) (cons 'a 2))) 
      1)

(let ((e (openlet  ; make it appear to be empty to the rest of s7
  (inlet 'object->string    (lambda args "(inlet)")
                'map               (lambda args ())
                'for-each          (lambda args #<unspecified>)
  	        'let->list (lambda args ())
                'length            (lambda args 0)
		'copy              (lambda args (inlet))
		'open #t
		'coverlet (lambda (e) (set! (e 'open) #f) e)
		'openlet  (lambda (e) (set! (e 'open) #t) e)
		'openlet? (lambda (e) (e 'open))
                ;; your secret data here
		'secret 'gray-cat
                ))))
  (test (object->string e) "(inlet)")
  ;(test (map values e) ())
  (when (not pure-s7) (test (let->list e) ()))
  (test (length e) 0)
  (test (object->string (copy e)) "(inlet)")
  (coverlet e)
  (test (object->string e) "(inlet)")
  (test (openlet? e) #f)
  (openlet e)
  (test (openlet? e) #t))

(let ()
  (define (lets . args) 
    (apply sublet () args))
  (let ((e (lets '(a . 1) '(b . 2))))
    (test (eval '(+ a b 3) e) 6)))

;(test (eval 'a (sublet () '(a . 1) '(a . 2))) 'error) ; no longer an error, mainly for repl's convenience
;(test (eval 'a (varlet () '(a . 1) '(a . 2))) 'error)
(test (eval 'pi (sublet () '(pi . 1) '(a . 2))) 'error)
(test (eval 'pi (varlet () '(pi . 1) '(a . 2))) 'error)
(test (eval 'pi (sublet () (cons 'pi pi))) 'error) ; changed 25-Jun-14
(test (eval 'pi (varlet () (cons 'pi pi))) 'error)
(test (map (sublet () '(asdf . 32) '(bsdf . 3)) '(bsdf asdf)) '(3 32))
(test (equal? (map (rootlet) '(abs cons car)) (list abs cons car)) #t)

(test (with-let (sublet (inlet) '(a . 1)) a) 1)
(test (with-let (sublet (inlet '(b . 2)) '(a . 1)) (+ a b)) 3)
(test (with-let (sublet () (inlet) '(a . 1)) a) 1)
(test (with-let (sublet () (inlet '(b . 2)) '(a . 1)) (+ a b)) 3)
(test (with-let (sublet (inlet '(b . 2) '(c . 3)) '(a . 1)) (+ a b c)) 6)

(let ()
  (define (e1) (let ((e (curlet))) (with-let e 0)))
  (define (e2 a) (let ((e (curlet))) (with-let e a)))
  (define (e3) (let ((e (curlet))) (with-let e 1 . 2)))
  (define (e4) (let ((e (curlet))) (with-let e 0 1)))
  (define (e5) (let ((e (curlet))) (with-let e (+ 1 2) (+ 2 3))))
  (test (e2 10) 10) (e1)
  (test (e1) (e2 0))
  (test (e3) 'error) (e4)
  (test (e4) 1) (e5)
  (test (e5) 5))

(let ()
  (define-constant _a_constant_ 32)
  (test (eval '_a_constant_ (sublet () (cons '_a_constant_ 1))) 'error)
  (test (eval '_a_constant_ (sublet () (cons '_a_constant_ 32))) 'error))

(test (let ((a 1)) (eval-string "(+ a b)" (sublet (curlet) (cons 'b 32)))) 33)
(test (let ((a 1)) (+ (eval-string "(+ a b)" (sublet (curlet) (cons 'b 32))) a)) 34)
(test (let ((a 1)) (+ (eval-string "(+ a b)" (sublet (curlet) (cons 'b 32) (cons 'a 12))) a)) 45)
(test (let ((a 2)) (eval-string "(+ a 1)" (sublet (curlet)))) 3)
(test (let ((a 1)) (+ (eval-string "(+ a b)" (sublet (sublet (curlet) (cons 'b 32)) (cons 'a 12))) a)) 45)
(test (eval-string (string-append "(+ a " (number->string (eval (list - 'b) (sublet (unlet) (cons 'b 1)))) ")")
		   (sublet (unlet) (cons 'a 2)))
      1)

(test (sublet) 'error)
(for-each
 (lambda (arg)
   (test (sublet arg '(a . 32)) 'error)
   (test (varlet arg '(a . 32)) 'error))
 (list -1 #\a 1 3.14 3/4 1.0+1.0i "hi" 'hi #() #f _ht_ _undef_ _null_ _c_obj_))

(let ((e (sublet (curlet)
			      (cons 'a 32)
			      (cons 'b 12))))
  (test (eval '(+ a b) e) 44)
  (test (eval '(+ a b c) (sublet e (cons 'c 3))) 47)
  (test (eval '(+ a b) (sublet e (cons 'b 3))) 35)
  (test (eval-string "(+ a b)" e) 44)
  (test (eval-string "(+ a b c)" (sublet e (cons 'c 3))) 47)
  (test (eval-string "(+ a b)" (sublet e (cons 'b 3))) 35)
  )

(test (with-let (sublet () '(a . 1)) (defined? 'a)) #t)
(test (defined? 'a (sublet () '(a . 1))) #t)
(test (defined? 'b (sublet () '(a . 1))) #f)
(test (defined? 'a '((a . 1))) 'error)
(test (defined? 'a '((a . 1) 2)) 'error)
(test (defined? 'a (sublet ())) #f)

(test (symbol->value 'a (sublet () '(a . 1))) 1)
(test (symbol->value 'b (sublet () '(a . 1))) #<undefined>)
(test (symbol->value 'a '((a . 1))) 'error)
(test (symbol->value 'a '((a . 1) 2)) 'error)

(test (eval 'a (sublet () '(a . 1))) 1)
(test (eval 'a (sublet () '(b . 1))) 'error)
(test (eval 'a '((a . 1))) 'error)
(test (eval 'a '((a . 1) 2)) 'error)

(test (eval-string "a" (sublet () '(a . 1))) 1)
(test (eval-string "a" (sublet () '(b . 1))) 'error)
(test (eval-string "a" '((a . 1))) 'error)
(test (eval-string "a" '((a . 1) 2)) 'error)

(test (with-let (sublet () '(a . 1)) a) 1)
(test (with-let (sublet ()) 1) 1)
(test (with-let (sublet () '(b . 1)) a) 'error)
(test (with-let '((a . 1)) a) 'error)
(test (with-let '((a . 1) 2) a) 'error)
(test (let ((a 1)) (set! ((curlet) 'a) 32) a) 32)

(for-each
 (lambda (arg)
   (test (sublet (curlet) arg) 'error)
   (test (varlet (curlet) arg) 'error))
 (list -1 #\a #(1 2 3) 3.14 3/4 1.0+1.0i 'hi "hi" abs #(()) (list 1 2 3) '(1 . 2) (lambda () 1)))

(test (with-let (curlet) (let ((x 1)) x)) 1)

(let ()
  (define (hi)
    (let ((e (sublet (curlet)
	       (cons 'abs (lambda (a) (- a 1))))))
      (with-let e
	(abs -1))))
  (test (hi) -2)
  (test (hi) -2)
  (test (let ((e (sublet (curlet)
		   (cons 'abs (lambda (a) (- a 1))))))
	  (with-let e
	    (abs -1)))
	-2))

(test (let ((x 12))
	(let ((e (curlet)))
	  (let ((x 32))
	    (with-let e (* x 2)))))
      24)

(test (let ((e #f)) (let ((x 2) (y 3)) (set! e (curlet))) (let ((x 0) (y 0)) (with-let e (+ x y)))) 5)
(test (let ((e #f)) (let () (define (func a b) (set! e (curlet)) (+ a b)) (func 1 2)) (with-let e (+ a b))) 3)
(test (let ((e #f)
	    (f #f))
	(let ()
	  (define (func a b) 
	    (set! e (curlet)) 
	    (+ a b))
	  (set! f func)
	  (func 1 2))
	(let ((val (with-let e (+ a b))))
	  (f 3 4)
	  (list val (with-let e (+ a b)))))
      '(3 7))

(test (with-let) 'error)
(test (with-let 1) 'error)
(test (with-let () 1) 'error)
(test (with-let (curlet)) 'error) ; ?? perhaps this should be #<unspecified> but it's like (let) = error
(test (outlet) 'error)
(test (outlet (curlet) #f) 'error)
(test (eq? (outlet (rootlet)) (rootlet)) #t)
(test (set! (outlet (curlet)) #f) 'error)
(test (set! (outlet (curlet)) ()) 'error)
(test (set! (outlet) #f) 'error)
(test (let? (set! (outlet (inlet)) (rootlet))) #t)
(test (set! (outlet (inlet)) (rootlet)) (rootlet))

(let ()
  (test (let () 
	  (set! (outlet (curlet)) 
		(let ((a 1)
		      (b 2))
		  (set! (outlet (curlet)) (rootlet))
		  (curlet)))
	  (+ a b))
	3))
;; equivalent to (let ((a 1) (b 2)) (let () (curlet)))
;;   that is, we've turned the let structure inside out


(test (let () 
	(set! (outlet (curlet)) (rootlet))
	(eq? (outlet (curlet)) (rootlet)))
      #t)
(test (let ((a 1)) 
	(let ((b 2)) 
	  (set! (outlet (curlet)) (rootlet))
	  ((curlet) 'a)))
      #<undefined>)
(test (let ((a 1)
	    (e #f))
	(set! e (curlet))
	(let ((b 2))
	  (let ((c 3))
	    (set! (outlet (curlet)) e)
	    (and (equal? ((curlet) 'a) 1)
		 (equal? ((curlet) 'b) #<undefined>)
		 (equal? ((curlet) 'c) 3)
		 (equal? (outlet (curlet)) e)))))
      #t)

(for-each
 (lambda (arg)
   (test (with-let arg #f) 'error)
   (test (outlet arg) 'error)
   (test (set! (outlet (curlet)) arg) 'error))
 (list -1 #\a #(1 2 3) 3.14 3/4 1.0+1.0i () 'hi "hi" abs #(()) (list 1 2 3) '(1 . 2) (lambda () 1)))

(test (with-let (sublet (sublet ()) '(a . 1)) 1) 1)
(test (with-let (sublet (sublet ()) '(a . 1)) a) 1)
(test (with-let (curlet) 1) 1)
(test (let ((a 1))
	(+ (with-let
	    (sublet (curlet) (cons 'a 10))
	    a)
	   a))
      11)
(test (let ((a 1))
	(+ (with-let
	    (sublet (curlet) (cons 'a 10))
	    (+ a
	       (with-let
		(sublet (curlet) (cons 'a 100))
		a)))
	   a))
      111)
(test (let ((a 1))
	(+ (with-let
	    (sublet (curlet) (cons 'a 10))
	    (+ a
	       (with-let
		(sublet (curlet) (cons 'b 100))
		a)))
	   a))
      21)
(test (let ((a 1))
	(let ((e (curlet)))
	  (+ (with-let
	      (sublet (curlet) (cons 'a 10))
	      (+ a
		 (with-let e a)))
	   a)))
      12)
(test (let ((a 1))
	(let ((e (curlet)))
	  (+ (with-let
	      (varlet (sublet (curlet) (cons 'a 10)) (cons 'a 20))
	      (+ a
		 (with-let e a)))
	   a)))
      22)
(test (= ((inlet 'a 1 'a 2) 'a) (with-let (inlet 'a 1 'a 2) a)) #t)
(test (= ((varlet (inlet 'a 1) 'a 2) 'a) (with-let (varlet (inlet 'a 1) 'a 2) a)) #t)
(test (let ((a 1))
	(+ (with-let
	    (sublet (curlet) (cons 'a 10))
	    (+ (let ((b a))
		 (varlet (curlet) (cons 'a 20))
		 (+ a b))
	       a))
	   a))
      41)

(test (let ((a 1)) (+ (let ((a 2)) (+ (let ((a 3)) a) a)) a)) 6)
(test (let ((a 1)) (+ (let () (+ (let ((a 3)) (varlet (outlet (curlet)) '(a . 2)) a) a)) a)) 6)
(test (let () (let ((a 1)) (varlet (outlet (curlet)) '(a . 2))) a) 2)

(test (let ((a 1))
	(let ((e (curlet)))
	  (+ (with-let
	      (sublet e (cons 'a 10))
	      (+ a
		 (with-let e a)))
	   a)))
      'error) ; "e" is not in the curlet at the top, so it's not in the nested env

(test (let ((x 3))
	(varlet (curlet)
          (cons 'y 123))
	(+ x y))
      126)
#|
;; can't decide about these -- safe closures prebuild the funclet from the arglist so two of these fail
(test (let ()
	(define (hiho a) (+ a b))
	(varlet (funclet hiho) (cons 'b 21)) 
	(hiho 1))
      22)

(test (let ()
	(define hiho (let ((x 32)) (lambda (a) (+ a x b))))
	(varlet (funclet hiho) (cons 'b 10) (cons 'x 100))
	(hiho 1))
      111)

(test (let ()
	(define hiho (let ((x 32)) (lambda* (a) (+ a x b))))
	(varlet (funclet hiho) (cons 'b 10) (cons 'x 100))
	(hiho 1))
      111)

(test (let ()
	(define hiho (let () 
		       (define (hi b) 
			 (+ b 1)) 
		       (lambda (a) 
			 (hi a))))
	(varlet (funclet hiho) (cons 'hi (lambda (b) (+ b 123))))
	(hiho 2))
      125)
|#

(test (let () ; here's one way for multiple functions to share a normal scheme closure
	(define f1 (let ((x 23))
		     (lambda (a)
		       (+ x a))))
	(define f2
	  (with-let (outlet (funclet f1)) ; outlet is needed as of 28-Feb-16
            (lambda (b)
	      (+ b (* 2 x)))))
	(+ (f1 1) (f2 1)))
      71)


(test (varlet) 'error)
(test (sublet 3) 'error)
(test (varlet 3) 'error)

(test (let ((e (curlet))) (let? e)) #t)
(test (let ((f (lambda (x) (let? x)))) (f (curlet))) #t)
(test (let ((e (varlet () '(a . 1)))) (let? e)) #t)
(test (let ((e (varlet () '(a . 1)))) ((lambda (x) (let? x)) e)) #t)
(test (let? ((lambda () (curlet)))) #t)
(test (let? ((lambda (x) x) (curlet))) #t)
(test (let ((e (let ((x 32)) (lambda (y) (let ((z 123)) (curlet))))))
	(eval `(+ x y z) (e 1)))
      156)
(test (let ((e #f)) (set! e (let ((x 32)) (lambda (y) (let ((z 123)) (funclet e)))))
	   (eval `(+ x 1) (e 1)))
      33)

(test (let () ((curlet) 'abs)) abs) ; was #<undefined>)??
(test ((rootlet) 'abs) abs)

(test (catch #t
	     (lambda ()
	       (with-let (curlet)
		 (error 'testing "a test")
		 32))
	     (lambda args (car args)))
      'testing)
(test (call-with-exit
       (lambda (go)
	 (with-let (curlet)
	   (go 1)
	   32)))
      1)

(test (let ((x 0))
	(call-with-exit
	 (lambda (go)
	   (with-let (varlet (curlet) (cons 'x 123))
            (go 1))))
	x)
      0)
(test (let ((x 1))
	(+ x (call-with-exit
	      (lambda (go)
		(with-let (varlet (curlet) (cons 'x 123))
                  (go x))))
	   x))
      125)

(test (let ((x 0))
	(catch #t
          (lambda ()
	    (with-let (varlet (curlet) (cons 'x 123))
              (error 'oops) x)) 
	  (lambda args x)))
      0)

(let ((a 1)) 
  (test ((curlet) 'a) 1)
  (set! ((curlet) 'a) 32)
  (test ((curlet) 'a) 32))

(let () (test (equal? (curlet) (rootlet)) #f))
(test (let ((a 1)) (let ((e (curlet))) (set! (e 'a) 2)) a) 2)
(let () (define (hi e) (set! (e 'a) 2)) (test (let ((a 1)) (hi (curlet)) a) 2))
(let () (define (hi) (let ((a 1)) (let ((e (curlet)) (i 'a)) (set! (e i) #\a)) a)) (hi) (hi) (test (hi) #\a))

(let ((e1 #f) (e2 #f))
  (let ((a 1)) (set! e1 (curlet)))
  (let ((a 1)) (set! e2 (curlet))) 
  (test (equal? e1 e2) #t)
  (test (eqv? e1 e2) #f))

(let ((e1 #f) (e2 #f))
  (let ((a 1)) (set! e1 (curlet)))
  (let ((a 2)) (set! e2 (curlet))) 
  (test (equal? e1 e2) #f))

(let ((e1 #f) (e2 #f))
  (let ((a 1)) (set! e1 (curlet)))
  (let ((a 1) (b 2)) (set! e2 (curlet))) 
  (test (equal? e1 e2) #f))

(let ((e1 #f) (e2 #f))
  (let ((a 1) (b 2)) (set! e1 (curlet)))
  (let ((a 1) (b 2)) (set! e2 (curlet))) 
  (test (equal? e1 e2) #t))

(let ((e1 #f) (e2 #f))
  (let () (set! e1 (curlet)))
  (let ((a 1)) (set! e2 (curlet))) 
  (test (equal? e1 e2) #f))

(test (let ((a #(1 2 3))) ((curlet) 'a 1)) 2)
(test (let ((a #(1 2 3))) (let ((e (curlet))) ((curlet) 'e 'a 1))) 2)

(let ((x (openlet (inlet 'let-ref-fallback (lambda args args)))))
  (test (x) (list x #f)) ; let-ref expects 2 args
  (test (x 1) (list x 1)))

(let ((x (openlet (inlet 'let-set-fallback (lambda args args)))))
  ; (test (set! (x) 1) (list x 1)) ; doesn't work yet
  (test (set! (x 1) 2) (list x 1 2)))

(let ()
  (define (f1) 
    (let ((v (vector #f)) (X 0))
      (do ((i 0 (+ i 1))) ((= i 1) v) 
	(vector-set! v 0 (let-ref X 'a)))))
  (test (f1) 'error))

(let ((x '(a)))
  (let ((x '(c)))
    x)
  (let ((x '(b)))
    (define (transparent-memq sym var e)
      (let ((val (symbol->value var e)))
	(or (and (pair? val)
		 (memq sym val))
	    (and (not (eq? e (rootlet)))
		 (transparent-memq sym var (outlet e))))))
    (let ((ce (curlet)))
      (test (list (transparent-memq 'a 'x ce)
		  (transparent-memq 'b 'x ce)
		  (transparent-memq 'c 'x ce))
	    '((a) (b) #f)))))
    
(test (let-set! (rootlet) :rest #f) 'error) ; key->sym so this is not a constant
(test (let-set! (rootlet) 'pi #f) 'error)


(test (make-iterator) 'error)
(test (make-iterator (curlet) 1) 'error)
(test (iterator?) 'error)
(test (iterator? 1 2) 'error)
(test (arity make-iterator) '(1 . 2))

(for-each
 (lambda (arg)
   (test (iterator? arg) #f))
 (list "hi" () -1 #\a 1 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #t (list 1 2 3) '(1 . 2)))

(let ((a 1))
  (let ((lti (make-iterator (curlet))))
    (test (cdr (lti)) 1)
    (test (lti) #<eof>)
    (test (lti) #<eof>)))

(let () (let ((lti (make-iterator (curlet)))) (test (lti) #<eof>)))
(let ((lti (make-iterator (inlet 'a 1 'b 2))))
  ;(test (length lti) #f)
  (test (reverse lti) 'error)
  (test (iterator? lti) #t)
  (test (lti) '(b . 2))
  (test (lti) '(a . 1))
  (test (lti) #<eof>)
  (test (set! (lti) 32) 'error))

(let ((lti (make-iterator (rootlet))))
  (test (defined? (car (lti))) #t)
  (test (let ((b (lti))) (equal? (symbol->value (car b)) (cdr b))) #t))

;;; test keyword-as-let-ref-arg -- this is an experiment, see let_ref_1 and let_set_1
(let ((e (inlet :name 'hi)))
  (test (e :name) 'hi)
  (set! (e :name) 'ho)
  (test (e :name) 'ho)
  (test (let-ref e :name) 'ho)
  (let-set! e :name 'ha)
  (test (e 'name) 'ha))
(test ((rootlet) :abs) abs)
(test ((rootlet) :allow-other-keys) #<undefined>)
;;; but this only works directly, not in with-let:
(test (with-let (inlet :x 1 :y 2) (+ :x :y)) 'error) ; + argument 1, :x, is a symbol but should be a number
;;; but that's actually parallel to (+ 'x 'y) so I think it's not a show-stopper
(let ((y 12))
  (test ((curlet) :y) 12)
  (define f1 (let ((x 32)) (lambda (a) (+ a x))))
  (test ((funclet f1) :x) 32))
(let ((e (inlet :aaa 1)))
  (varlet e :b 2)
  (test (e 'b) 2)
  (cutlet e :aaa)
  (test (e 'aaa) #<undefined>))

(let ((e (inlet 'a 1 'b 2 'c 3 'd 4)))
  (test (object->string e) "(inlet 'a 1 'b 2 'c 3 'd 4)")
  (let-temporarily (((*s7* 'print-length) 2))
    (test (object->string e) "(inlet 'a 1 'b 2 ...)")
    (set! (*s7* 'print-length) 4)
    (test (object->string e) "(inlet 'a 1 'b 2 'c 3 'd 4)")
    (set! (*s7* 'print-length) 3)
    (test (object->string e) "(inlet 'a 1 'b 2 'c 3 ...)")))

(let ((hi (openlet (inlet 'a 1 
			  'let-ref (lambda (obj val)
				     (coverlet obj)
				     (let ((res (+ (obj val) 1)))
				       (openlet obj)
				       res))))))
  (test (hi 'a) 2))

(let ()
  (define (cowlet . fields) ; copy-on-write let
    (openlet (apply inlet 
		    'let-set! (lambda (obj field val)
				(let ((new-obj (copy (coverlet obj))))
				  (set! (new-obj field) val)
				  (openlet obj)
				  (openlet new-obj)))
		    fields)))
  (let ((hi (cowlet 'a 1 'b 2)))
    (let-set! hi 'b 1)
    (test (hi 'b) 2)
    (set! (hi 'b) 12)
    (test (hi 'b) 2)
    (let ((ho (let-set! hi 'b 32))
	  (ha (set! (hi 'b) 32)))
      (test (openlet? hi) #t)
      (test (openlet? ho) #t)
      (test (let? ho) #t)
      (test (eq? hi ho) #f)
      (test (hi 'b) 2)
      (test (ho 'b) 32)
      (test (eq? ho ha) #f)
      (test (ha 'b) 32))))
    

;;; make-type ----------------
(let ()
  (define (make-type . args)
    (let* ((type (gensym "make-type type"))   ; built-in type and value slots have gensym'd names
	   (value (gensym "make-type value"))
	   (obj (openlet 
		 (sublet ()
		   (cons type type)
		   (cons value #<unspecified>)))))
      
      ;; load up any methods/slots
      (do ((arg args (cddr arg)))
	  ((null? arg))
	(varlet obj
			      (cons (keyword->symbol (car arg)) (cadr arg))))
      
      ;; return a list of '(? make ref) funcs
      (list (lambda (x)
	      (and (let? x)
		   (eq? (x type) type)))
	    (lambda* (new-value)
		     (let ((new-obj (copy obj)))
		       (set! (new-obj value) new-value)
		       new-obj))
	    (lambda (x)
	      (x value)))))
  
  (define special-value
    (let ((type (make-type)))
      ((cadr type) 'special)))
  
  (test (eq? special-value special-value) #t)
  (test (eqv? special-value special-value) #t)
  (test (equal? special-value special-value) #t)
  (test (procedure? special-value) #f)
  (for-each
   (lambda (arg)
     (test (or (eq? arg special-value)
	       (eqv? arg special-value)
	       (equal? arg special-value))
	   #f))
   (list "hi" -1 #\a 1 'special 3.14 3/4 1.0+1.0i #f #t '(1 . 2) #<unspecified> #<undefined>))
  
  (test (let ((obj ((cadr (make-type :type "hi" :value 123)) 0))) (list (obj 'type) (obj 'value))) '("hi" 123))
  (test (let ((obj ((cadr (make-type :type "hi" :value 123))))) (list (obj 'type) (obj 'value))) '("hi" 123))

  (test (let* ((rec-type (make-type))
	       (? (car rec-type))
	       (make (cadr rec-type))
	       (ref (caddr rec-type)))
	  (let ((val-1 (make "hi")))
	    (let ((val-2 (make val-1)))
	      (let ((val-3 (make val-2)))
		(ref (ref (ref val-3)))))))
	"hi")

  (test (let* ((rec1-type (make-type))
	       (?1 (car rec1-type))
	       (make1 (cadr rec1-type))
	       (ref1 (caddr rec1-type)))
	  (let* ((rec2-type (make-type))
		 (?2 (car rec2-type))
		 (make2 (cadr rec2-type))
		 (ref2 (caddr rec2-type)))
	    (let ((val-1 (make1 "hi")))
	      (let ((val-2 (make2 "hi")))
		(let ((val-3 (make1 val-2)))
		  (and (string=? (ref2 (ref1 val-3)) "hi")
		       (not (equal? val-1 val-2))
		       (?1 val-1)
		       (?2 val-2)
		       (not (?2 val-3))))))))
	#t)

  (test (let* ((rec1-type (make-type))
	       (make1 (cadr rec1-type))
	       (ref1 (caddr rec1-type)))
	  (let* ((rec2-type (make-type))
		 (make2 (cadr rec2-type)))
	    (let ((val-1 (make1 "hi")))
	      (let ((val-2 (make2 val-1)))
		(ref1 val-2)))))
	#<undefined>)

  (test (make-type (make-type)) 'error)
  (let ((t (make-type)))
    (let ((t? (car t))
	  (make-t (cadr t))
	  (t-ref (caddr t)))
      (test (make-t 1 2) 'error)
      (test (t? (make-t)) #t)
      (test (t-ref (make-t)) #f)
      (test (t? 1 2) 'error)
      (test (t?) 'error)
      (test (t-ref) 'error)
      (test (t-ref 1 2) 'error)
      (for-each
       (lambda (arg)
	 (test (t-ref arg) 'error))
       (list #\a 'a-symbol 1.0+1.0i #t #(1 2) () 3/4 3.14 #() "hi" :hi 1 #f #t '(1 . 2)))))
  
  (begin
    (define rec? #f)
    (define make-rec #f)
    (define rec-a #f)
    (define rec-b #f)
    
    (let* ((rec-type (make-type))
	   (? (car rec-type))
	   (make (cadr rec-type))
	   (ref (caddr rec-type)))
      
      (set! make-rec (lambda* ((a 1) (b 2))
			      (make (vector a b))))
      
      (set! rec? (lambda (obj)
		   (? obj)))
      
      (set! rec-a (dilambda
		   (lambda (obj)
		     (and (rec? obj)
			  (vector-ref (ref obj) 0)))
		   (lambda (obj val)
		     (if (rec? obj)
			 (vector-set! (ref obj) 0 val)))))
      
      (set! rec-b (dilambda
		   (lambda (obj)
		     (and (rec? obj)
			  (vector-ref (ref obj) 1)))
		   (lambda (obj val)
		     (if (rec? obj)
			 (vector-set! (ref obj) 1 val)))))))
  
  (let ((hi (make-rec 32 '(1 2))))
    (test (rec? hi) #t)
    (test (equal? hi hi) #t)
    (test (rec? 32) #f)
    (test (rec-a hi) 32)
    (test (rec-b hi) '(1 2))
    (set! (rec-b hi) 123)
    (test (rec-b hi) 123)
    (let ((ho (make-rec 32 '(1 2))))
      (test (eq? hi ho) #f)
      (test (eqv? hi ho) #f)
      (test (equal? hi ho) #f)
      (set! (rec-b ho) 123)
      (test (equal? hi ho) #t))
    (let ((ho (make-rec 123 ())))
      (test (eq? hi ho) #f)
      (test (eqv? hi ho) #f)
      (test (equal? hi ho) #f))
    (test (equal? (copy hi) hi) #t)
    (test (fill! hi 1) 1)
    ;(test (object->string hi) "(inlet)")
    (test (length hi) 2)
    (test (let? (reverse hi)) #t)
    (test (for-each abs hi) 'error)
    (test (map abs hi) 'error)
    (test (hi 1) 'error)
    (test (set! (hi 1) 2) 'error)
    )

  (let ((rec3? (car (make-type)))
	(rec4? (car (make-type :value 21))))
    (for-each
     (lambda (arg)
       (test (rec3? arg) #f)
       (test (rec4? arg) #f))
     (list "hi" -1 #\a 1 'a-symbol 3.14 3/4 1.0+1.0i #f #t '(1 . 2))))

    )


;;; pfloat-vector
(let ()
  (begin
    (define pfloat-vector? #f)
    (define make-pfloat-vector #f)
    
    (let ((type (gensym))
	  (->float (lambda (x)
		     (if (real? x)
			 (* x 1.0)
			 (error 'wrong-type-arg "pfloat-vector new value is not a real: ~A" x)))))
      
      (varlet (curlet)
	(cons 'length (lambda (p) ((funclet p) 'len)))
	(cons 'object->string (lambda* (p (use-write #t)) "#<pfloat-vector>"))
	(cons 'vector? (lambda (p) #t))
	(cons 'vector-length (lambda (p) ((funclet p) 'len)))
	(cons 'vector-dimensions (lambda (p) (list ((funclet p) 'len))))
	(cons 'vector-ref (lambda (p ind) (#_vector-ref ((funclet p) 'obj) ind)))
	(cons 'vector-set! (lambda (p ind val) (#_vector-set! ((funclet p) 'obj) ind (->float val))))
	(cons 'vector-fill! (lambda (p val) (#_vector-fill! ((funclet p) 'obj) (->float val))))
	(cons 'fill! (lambda (p val) (#_vector-fill! ((funclet p) 'obj) (->float val))))
	(cons 'vector->list (lambda (p) (#_vector->list ((funclet p) 'obj))))
	(cons 'equal? (lambda (x y) (#_equal? ((funclet x) 'obj) ((funclet y) 'obj))))
	(cons 'morally-equal? (lambda (x y) (#_morally-equal? ((funclet x) 'obj) ((funclet y) 'obj))))
	(cons 'reverse (lambda (p) (vector->pfloat-vector (#_reverse ((funclet p) 'obj)))))
	(cons 'copy (lambda (p) (vector->pfloat-vector ((funclet p) 'obj))))
	(cons 'sort! (lambda (p f) (vector->pfloat-vector (#_sort! ((funclet p) 'obj) f))))
	)
      
      (set! make-pfloat-vector
	    (lambda* (len (init 0.0)) 
	      (let ((obj (make-vector len (->float init))))
		(openlet
		 (dilambda
		  (lambda (i) (#_vector-ref obj i))
		  (lambda (i val) (#_vector-set! obj i (->float val))))))))
      
      (set! pfloat-vector?
	    (lambda (obj)
	      (and (procedure? obj)
		   (eq? ((funclet obj) 'type) type))))))
  
  (define pfloat-vector
    (lambda args
      (let* ((len (length args))
	     (v (make-pfloat-vector len)))
	(do ((i 0 (+ i 1))
	     (arg args (cdr arg)))
	    ((= i len) v)
	  (set! (v i) (car arg))))))
  
  (define (vector->pfloat-vector v)
    (let* ((len (length v))
	   (fv (make-pfloat-vector len)))
      (do ((i 0 (+ i 1)))
	  ((= i len))
	(set! (fv i) (v i)))
      fv))
  
  (let ((v (make-pfloat-vector 3 0.0)))
    (test (length v) 3)
    (set! (v 1) 32.0)
    (test (v 0) 0.0)
    (test (v 1) 32.0)
    (test (eq? v v) #t)
    (test (eq? v (pfloat-vector 0.0 32.0 0.0)) #f)
    (test (equal? v (pfloat-vector 0.0 32.0 0.0)) #t)
    (test (morally-equal? v (pfloat-vector 0.0 32.0 0.0)) #t)
    (test (reverse (pfloat-vector 1.0 2.0 3.0)) (pfloat-vector 3.0 2.0 1.0))
    (test (copy (pfloat-vector 1.0 2.0 3.0)) (pfloat-vector 1.0 2.0 3.0))
    (test (let () (fill! v 1.0) v) (pfloat-vector 1.0 1.0 1.0))
    (test (object->string v) "#<pfloat-vector>")
    (test (let ((v (pfloat-vector 1.0 2.0 3.0))) (map v (list 2 1 0))) '(3.0 2.0 1.0))
    (test (v -1) 'error)
    (test (v 32) 'error)
    (for-each
     (lambda (arg)
       (test (v arg) 'error))
     (list #\a 'a-symbol 1.0+1.0i #f #t abs #(1 2) () 3/4 3.14 '(1 . 2)))
    
    (test (set! (v 0) "hi") 'error)
    (test (set! (v -1) "hi") 'error)
    (test (set! (v 32) "hi") 'error)
    (for-each
     (lambda (arg)
       (test (set! (v 0) arg) 'error))
     (list #\a 'a-symbol 1.0+1.0i #f #t abs #(1 2) () '(1 . 2)))
    (test (length v) 3)
    )
  
  (let ((v1 (pfloat-vector 3 1 4 8 2)))
    (let ((v2 (sort! v1 <))
	  (one 1))
      (test (equal? v2 (pfloat-vector 1 2 3 4 8)) #t)
      (test (vector? v1) #t)
      (test (pfloat-vector? v1) #t)
      (test (vector-length v1) 5)
      (if (not pure-s7) (test (vector->list v1) '(1.0 2.0 3.0 4.0 8.0)))
      (test (vector-ref v1 one) 2.0)
      (test (vector-set! v1 1 3/2) 1.5)
      (test (vector-ref v1 1) 1.5)
      (test (vector-dimensions v1) '(5))
      (fill! v1 32)
      (test v1 (pfloat-vector 32.0 32.0 32.0 32.0 32.0))
      (test (pfloat-vector? #(1 2 3)) #f)

      (for-each
       (lambda (arg)
	 (test (pfloat-vector? arg) #f))
       (list -1 #\a 1 #(1 2 3) 3.14 3/4 1.0+1.0i () #f #(()) (list 1 2 3) '(1 . 2) "hi" '((a . 1))))
      
      (for-each
       (lambda (arg)
	 (test (make-pfloat-vector arg) 'error))
       (list -1 #\a #(1 2 3) 3.14 3/4 1.0+1.0i () #f #(()) '(1 . 2) "hi" '((a . 1))))
      
      (for-each
       (lambda (arg)
	 (test (make-pfloat-vector 3 arg) 'error))
       (list #\a #(1 2 3) 1.0+1.0i () #f #(()) (list 1 2 3) '(1 . 2) "hi" '((a . 1))))
      
      (for-each
       (lambda (arg)
	 (test (pfloat-vector (list arg)) 'error))
       (list #\a #(1 2 3) 1.0+1.0i () #f #(()) (list 1 2 3) '(1 . 2) "hi" '((a . 1))))

      )))


;;; environments as objects

(define-macro* (define-class class-name inherited-classes (slots ()) (methods ()))
  `(let ((outer-env (outlet (curlet)))
	 (new-methods ())
	 (new-slots ())
	 (new-type (gensym "define-class")))

    (for-each
     (lambda (class)
       ;; each class is a set of nested environments, the innermost (first in the list)
       ;;   holds the local slots which are copied each time an instance is created,
       ;;   the next holds the class slots (global to all instances, not copied);
       ;;   these hold the class name and other such info.  The remaining environments
       ;;   hold the methods, with the localmost method first.  So in this loop, we
       ;;   are gathering the local slots and all the methods of the inherited
       ;;   classes, and will splice them together below as a new class.

       (set! new-slots (append (let->list class) new-slots))
       (do ((e (outlet (outlet class)) (outlet e)))
	   ((or (not (let? e))
		(eq? e (rootlet))))
	 (set! new-methods (append (let->list e) new-methods))))
     ,inherited-classes)

     (let ((remove-duplicates 
	    (lambda (lst)         ; if multiple local slots with same name, take the localmost
	      (letrec ((rem-dup
			(lambda (lst nlst)
			  (cond ((null? lst) nlst)
				((assq (caar lst) nlst) (rem-dup (cdr lst) nlst))
				(else (rem-dup (cdr lst) (cons (car lst) nlst)))))))
		(reverse (rem-dup lst ()))))))
       (set! new-slots 
	     (remove-duplicates
	      (append (map (lambda (slot)
			     (if (pair? slot)
				 (cons (car slot) (cadr slot))
				 (cons slot #f)))
			   ,slots)                    ; the incoming new slots, #f is the default value
		      new-slots))))                   ; the inherited slots

    (set! new-methods 
	  (append (map (lambda (method)
			 (if (pair? method)
			     (cons (car method) (cadr method))
			     (cons method #f)))
		       ,methods)                     ; the incoming new methods

		  ;; add an object->string method for this class. 
		  (list (cons 'object->string
                              (lambda* (obj (port #f))
				(format port "#<~A: ~{~A~^ ~}>" 
					',class-name
					(map (lambda (slot)
					       (list (car slot) (cdr slot)))
					     obj)))))
		  (reverse! new-methods)))           ; the inherited methods, shadowed automatically

    (let ((new-class (openlet
                       (apply sublet           ; the local slots
		         (sublet               ; the global slots
		           (apply sublet ()    ; the methods
			     (reverse new-methods))
		           (cons 'class-name ',class-name)  ; class-name slot
			   (cons 'class-type new-type)      ; save a unique type identifier (unneeded if class-names are unique)
			   (cons 'inherited ,inherited-classes)
			   (cons 'inheritors ()))           ; classes that inherit from this class
		         new-slots))))

      (varlet outer-env                  
        (cons ',class-name new-class)                       ; define the class as class-name in the calling environment

	;; define class-name? type check
	(cons (string->symbol (string-append (symbol->string ',class-name) "?"))
	      (lambda (obj)
		(and (let? obj)
		     (eq? (obj 'class-type) new-type)))))

      (varlet outer-env
        ;; define the make-instance function for this class.  
        ;;   Each slot is a keyword argument to the make function.
        (cons (string->symbol (string-append "make-" (symbol->string ',class-name)))
	      (apply lambda* (map (lambda (slot)
				    (if (pair? slot)
					(list (car slot) (cdr slot))
					(list slot #f)))
				  new-slots)
		     `((let ((new-obj (copy ,,class-name)))
			 ,@(map (lambda (slot)
				  `(set! (new-obj ',(car slot)) ,(car slot)))
				new-slots)
			 new-obj)))))

      ;; save inheritance info for this class for subsequent define-method
      (letrec ((add-inheritor (lambda (class)
				(for-each add-inheritor (class 'inherited))
				(if (not (memq new-class (class 'inheritors)))
				    (set! (class 'inheritors) (cons new-class (class 'inheritors)))))))
	(for-each add-inheritor ,inherited-classes))
    
      ',class-name)))


(define-macro (define-generic name)
  `(define ,name (lambda args (apply ((car args) ',name) args))))


(define-macro (define-slot-accessor name slot)
  `(define ,name (dilambda 
                   (lambda (obj) (obj ',slot)) 
		   (lambda (obj val) (set! (obj ',slot) val)))))


(define-macro (define-method name-and-args . body)
  `(let* ((outer-env (outlet (curlet)))
	  (method-name (car ',name-and-args))
	  (method-args (cdr ',name-and-args))
	  (object (caar method-args))
	  (class (symbol->value (cadar method-args)))
	  (old-method (class method-name))
	  (method (apply lambda* method-args ',body)))

     ;; define the method as a normal-looking function
     ;;   s7test.scm has define-method-with-next-method that implements call-next-method here
     ;;   it also has make-instance 
     (varlet outer-env
       (cons method-name 
	     (apply lambda* method-args 
		    `(((,object ',method-name)
		       ,@(map (lambda (arg)
				(if (pair? arg) (car arg) arg))
			      method-args))))))
     
     ;; add the method to the class
     (varlet (outlet (outlet class))
       (cons method-name method))

     ;; if there are inheritors, add it to them as well, but not if they have a shadowing version
     (for-each
      (lambda (inheritor) 
	(if (not (eq? (inheritor method-name) #<undefined>)) ; defined? goes to the global env
	    (if (eq? (inheritor method-name) old-method)
		(set! (inheritor method-name) method))
	    (varlet (outlet (outlet inheritor))
   	      (cons method-name method))))
      (class 'inheritors))

     method-name))


(define (all-methods obj method)
  ;; for arbitrary method combinations: this returns a list of all the methods of a given name
  ;;   in obj's class and the classes it inherits from (see example below)
  (let* ((base-method (obj method))
	 (methods (if (procedure? base-method) (list base-method) ())))
    (for-each 
     (lambda (ancestor)
       (let ((next-method (ancestor method)))
	 (if (and (procedure? next-method)
		  (not (memq next-method methods)))
	     (set! methods (cons next-method methods)))))
     (obj 'inherited))
    (reverse methods)))

(define-macro (make-instance class . args)
  `(let* ((cls (if (symbol? ,class) (symbol->value ,class) ,class))
	  (make (symbol->value (string->symbol (string-append "make-" (symbol->string (cls 'class-name)))))))
     (apply make ',args)))

(define-macro (define-method-with-next-method name-and-args . body)
  `(let* ((outer-env (outlet (curlet)))
	  (method-name (car ',name-and-args))
	  (method-args (cdr ',name-and-args))
	  (object (caar method-args))
	  (class (symbol->value (cadar method-args)))
	  (old-method (class method-name))
	  (arg-names (map (lambda (arg)
			    (if (pair? arg) (car arg) arg))
			  method-args))
	  (next-class (and (pair? (class 'inherited))
			   (car (class 'inherited)))) ; or perhaps the last member of this list?
	  (nwrap-body (if next-class
			  `((let ((call-next-method 
				   (lambda new-args 
				     (apply (,next-class ',method-name)
					    (or new-args ,arg-names)))))
			      ,@',body))
			  ',body))
	  (method (apply lambda* method-args nwrap-body)))

     ;; define the method as a normal-looking function
     (varlet outer-env
       (cons method-name 
	     (apply lambda* method-args 
		    `(((,object ',method-name) ,@arg-names)))))
     
     ;; add the method to the class
     (varlet (outlet (outlet class))
       (cons method-name method))

     ;; if there are inheritors, add it to them as well, but not if they have a shadowing version
     (for-each
      (lambda (inheritor) 
	(if (not (eq? (inheritor method-name) #<undefined>)) ; defined? goes to the global env
	    (if (eq? (inheritor method-name) old-method)
		(set! (inheritor method-name) method))
	    (varlet (outlet (outlet inheritor))
   	      (cons method-name method))))
      (class 'inheritors))

     method-name))

(let ()
(let ()
  (define-class class-1 () 
    '((a 1) (b 2)) 
    (list (list 'add (lambda (obj) 
		       (with-let obj
			 (+ a b))))))

  (define-slot-accessor slot-a a)

  (let ()
    (test (let? (outlet (curlet))) #t)
    (test (class-1? class-1) #t)
    (test (class-1 'a) 1)
    (test (class-1 'b) 2)
    (test (class-1 'class-name) 'class-1)
    (test (class-1 'divide) #<undefined>)
    (test (class-1 'inheritors) ())
    (test ((class-1 'add) class-1) 3)
    (test (pair? (member (object->string class-1) '("#<class-1: (a 1) (b 2)>" "#<class-1: (b 2) (a 1)>"))) #t)
    (test (format #f "~{~A~^ ~}" class-1) "(a . 1) (b . 2)"))

  (let ((v (make-class-1)))
    (test (class-1? v) #t)
    (test (v 'a) 1)
    (test (v 'b) 2)
    (test (v 'class-name) 'class-1)
    (test (v 'inheritors) ())
    (test ((v 'add) v) 3)
    (test (pair? (member (object->string v) '("#<class-1: (a 1) (b 2)>" "#<class-1: (b 2) (a 1)>"))) #t)
    (test (format #f "~{~A~^ ~}" v) "(a . 1) (b . 2)")
    (set! (v 'a) 32)
    (test ((v 'add) v) 34)
    (test (equal? v v) #t)
    (test (equal? v (make-class-1 :a 32)) #t)
    (test (slot-a v) 32)
    (set! (slot-a v) 1)
    (test (slot-a v) 1)
    (test (pair? (member (map cdr v) '((1 2) (2 1)))) #t))

  (let ((v (make-class-1 :a 32))
	(v1 (make-class-1))
	(v2 (make-class-1 :a 32)))
    (test (class-1? v) #t)
    (test (v 'a) 32)
    (test (v 'b) 2)
    (test (v 'class-name) 'class-1)
    (test (v 'inheritors) ())
    (test ((v 'add) v) 34)
    (test (pair? (member (object->string v) '("#<class-1: (a 32) (b 2)>" "#<class-1: (b 2) (a 32)>"))) #t)
    (test (eq? v v) #t)
    (test (eq? v v1) #f)
    (test (eqv? v v) #t)
    (test (eqv? v v1) #f)
    (test (eqv? v v2) #f)
    (test (equal? v v) #t)
    (test (equal? v v1) #f)
    (test (equal? v v2) #t))

  (let ((v (make-class-1 32 3)))
    (test (class-1? v) #t)
    (test (v 'a) 32)
    (test (v 'b) 3)
    (test (v 'class-name) 'class-1)
    (test (v 'inheritors) ())
    (test ((v 'add) v) 35)
    (test (pair? (member (object->string v) '("#<class-1: (a 32) (b 3)>" "#<class-1: (b 3) (a 32)>"))) #t))

  (define-generic add)

  (let ()
    (test (add class-1) 3)
    (test (add (make-class-1 :b 0)) 1)
    (test (add 2) 'error))

  (define-class class-2 (list class-1)
    '((c 3)) 
    (list (list 'multiply (lambda (obj) 
			    (with-let obj 
                              (* a b c))))))

  (let ((v (make-class-2 :a 32)))
    (test (class-1? v) #f)
    (test (class-2? v) #t)
    (test (equal? v (make-class-1 :a 32)) #f)
    (test (equal? v (make-class-2 :a 32)) #t)
    (test (v 'a) 32)
    (test (v 'b) 2)
    (test (v 'c) 3)
    (test (v 'class-name) 'class-2)
    (test (v 'inheritors) ())
    (test (class-1 'inheritors) (list class-2))
    (test ((v 'add) v) 34)
    (test (pair? (member (object->string v) '("#<class-2: (c 3) (a 32) (b 2)>" "#<class-2: (b 2) (a 32) (c 3)>"))) #t)
    (test ((v 'multiply) v) 192)
    (test (add v) 34))

  (let ((v1 (make-class-1))
	(v2 (make-class-1)))
    (test (add v1) 3)
    (test (add v2) 3)
    (varlet v2 (cons 'add (lambda (obj) (with-let obj (+ 1 a (* 2 b))))))
    (test (add v1) 3)
    (test (add v2) 6))

  (define-class class-3 (list class-2) 
    () 
    (list (list 'multiply (lambda (obj num) 
			    (* num 
			       ((class-2 'multiply) obj) 
			       (add obj))))))

  (let ((v (make-class-3)))
    (test (class-1? v) #f)
    (test (class-2? v) #f)
    (test (class-3? v) #t)
    (test (v 'a) 1)
    (test (v 'b) 2)
    (test (v 'c) 3)
    (test (v 'class-name) 'class-3)
    (test (v 'inheritors) ())
    (test (class-1 'inheritors) (list class-3 class-2))
    (test (class-2 'inheritors) (list class-3))
    (test ((v 'add) v) 3)
    (test (pair? (member (object->string v) '("#<class-3: (c 3) (a 1) (b 2)>" "#<class-3: (b 2) (a 1) (c 3)>"))) #t)
    (test ((v 'multiply) v) 'error)
    (test ((v 'multiply) v 4) (* 4 6 3))
    (test (add v) 3))

  (define-method (subtract (obj class-1)) 
    (with-let obj 
      (- a b)))

  (let ((v1 (make-class-1))
	(v2 (make-class-2))
	(v3 (make-class-3)))
    (test (subtract v1) -1)
    (test (subtract v2) -1)
    (test (subtract v3) -1))

  ;; class-2|3 have their own multiply so...
  (define-method (multiply (obj class-1)) (with-let obj (* a b 100)))

  (let ((v1 (make-class-1))
	(v2 (make-class-2))
	(v3 (make-class-3)))
    (test (multiply v1) 200)
    (test (multiply v2) 6)
    (test (multiply v3) 'error))

  (define-method-with-next-method (add-1 (obj class-1)) (+ (obj 'a) 1))
  (define-method-with-next-method (add-1 (obj class-2)) (+ 1 (call-next-method)))
  (define-method-with-next-method (add-1 (obj class-3)) (+ 1 (call-next-method obj)))
  
  (test (add-1 (make-class-1)) 2)
  (test (add-1 (make-class-2)) 3)
  (test (add-1 (make-class-3)) 4)

  (test ((make-instance class-1) 'class-name) 'class-1)
  (test ((make-instance 'class-1) 'class-name) 'class-1)
  (test ((make-instance class-2) 'class-name) 'class-2)
  (test ((make-instance class-1 :a 123) 'class-name) 'class-1)

  (test ((make-instance class-1) 'b) 2)
  (test ((make-instance 'class-1) 'b) 2)
  (test ((make-instance class-1 :b 12 :a 123) 'b) 12)

  (test ((make-instance 'class-3 :a "hi" :c 21) 'c) 21)

  ))

;;; let field writer
(let ()
  (define lt (let ((a 1))
	       (set! (symbol-setter 'a)
		     (lambda (s v)
		       (if (integer? v)
			   v
			   (error 'wrong-type-arg "'a value should be an integer"))))
	       (curlet)))
  (test (lt 'a) 1)
  (set! (lt 'a) 32)
  (test (lt 'a) 32)
  (test (catch #t (lambda () (set! (lt 'a) pi)) (lambda args 'error)) 'error)
  (define a 12)
  (test a 12)
  (set! a pi)
  (test a pi)
  (test (lt 'a) 32)
  (test (catch #t (lambda () (set! (lt 'a) pi)) (lambda args 'error)) 'error))


;;; --------------------------------------------------------------------------------
;;; owlet
(test (vector? (owlet)) #f)
(test (let? (owlet)) #t)
(test (let () (set! (owlet) 2)) 'error)
(test (owlet 123) 'error)

(let ((val (catch #t (lambda () (/ 1 0.0)) (lambda args args))))
  (with-let (owlet)
    (test error-type 'division-by-zero)
    (test (equal? error-code '(/ 1 0.0)) #t)
    (test (list? error-data) #t)
    (test (string? error-file) #t)
    (test (integer? error-line) #t)
    (test ((owlet) 'error-file) error-file)
    ))

;;; --------------------------------------------------------------------------------
;;; object->let

(test (object->let) 'error)
(test (object->let 12 21) 'error)

(test (object->let ()) (inlet :value () :type 'null?))
(test (object->let #<unspecified>) (inlet :value #<unspecified> :type 'unspecified?))
(test (object->let #<undefined>) (inlet :value #<undefined> :type 'undefined?))
(test (object->let else) (inlet :value else :type 'symbol? :setter #f))
(test (object->let with-baffle) (inlet :value with-baffle :type 'syntax?))
(test (object->let #<eof>) (inlet :value #<eof> :type 'eof-object?))
(test (object->let #t) (inlet :value #t :type 'boolean?))

(test (object->let 'abc) (inlet :value 'abc :type 'symbol? :setter #f))
(test (object->let :abc) (inlet :value :abc :type 'keyword? :setter #f))
(test (object->let #\space) (inlet :value #\space :type 'char?))
(let ((_sym_ 3)) (set! (symbol-setter '_sym_) abs) (test (object->let '_sym_) (inlet :value '_sym_ :type 'symbol? :setter abs)))

(test (object->let 123) (inlet :value 123 :type 'integer?))
(test (object->let 1/2) (inlet :value 1/2 :type 'rational?))
(test (object->let 1.0) (inlet :value 1.0 :type 'real?))
(test (object->let 1+i) (inlet :value 1+i :type 'complex?))
(when with-bignums
  (test (object->let (bignum "123")) (inlet :value (bignum "123") :type 'integer?))
  (test (object->let (bignum "1/2")) (inlet :value (bignum "1/2") :type 'rational?))
  (test (object->let (bignum "1.0")) (inlet :value (bignum "1.0") :type 'real?))
  (test (object->let (bignum "1+i")) (inlet :value (bignum "1+i") :type 'complex?)))

(test (object->let "abc") (inlet :value "abc" :type 'string? :length 3))  
(test (object->let (byte-vector 1 2 3)) (inlet :value (byte-vector 1 2 3) :type 'byte-vector? :length 3)) 
(test (object->let (cons 1 2)) (inlet :value (cons 1 2) :type 'pair? :length -1))  
(test (object->let (c-pointer 0)) (inlet :value (c-pointer 0) :type 'c-pointer? :c-pointer 0 :c-type #f :info #f))

(let ((c #f)) 
  (call/cc (lambda (f) (set! c f)))
  (let ((obj (object->let c)))
    (test (obj 'value) c)
    (test (obj 'type) 'continuation?)))
(let ((c #f))
  (call-with-exit (lambda (f) (set! c f)))
  (test (object->let c) (inlet :value c :type 'goto? :active #f)))
(call-with-exit (lambda (f) (test (object->let f) (inlet :value f :type 'goto? :active #t))))

(when (not with-bignums)
  (let ((r (random-state 1234))) 
    (test (object->let r) (inlet :value r :type 'random-state? :seed 1234 :carry 1675393560))))

(test (object->let (vector 1 2 3)) (inlet :value (vector 1 2 3) :type 'vector? :length 3 :dimensions '(3) :shared #f))
(test (object->let (int-vector 1 2 3)) (inlet :value (int-vector 1 2 3) :type 'int-vector? :length 3 :dimensions '(3) :shared #f))
(test (object->let (float-vector 1 2 3)) (inlet :value (float-vector 1 2 3) :type 'float-vector? :length 3 :dimensions '(3) :shared #f))
(let ((v (make-shared-vector (vector 1 2 3) 2 1)))
  (test (object->let v) (inlet :value (vector 2 3) :type 'vector? :length 2 :dimensions '(2) :shared #(1 2 3))))
(test (object->let (make-vector '(2 3 4) #f)) 
      (inlet :value (make-vector '(2 3 4) #f) :type 'vector? :length 24 :dimensions '(2 3 4) :shared #f))

(let ((iter (make-iterator '(1 2 3)))) 
  (test (object->let iter) (inlet :value iter :type 'iterator? :at-end #f :sequence '(1 2 3) :length 3 :position '(1 2 3))))
(let ((iter (make-iterator #(1 2 3))))
  (iter)
  (test (object->let iter) (inlet :value iter :type 'iterator? :at-end #f :sequence #(1 2 3) :length 3 :position 1)))
(let ((iter (make-iterator "1234")))
  (iter)
  (iter)
  (test (object->let iter) (inlet :value iter :type 'iterator? :at-end #f :sequence "1234" :length 4 :position 2)))
(let ((iter (make-iterator (int-vector 1 2))))
  (iter)
  (iter)
  (iter)
  (test (object->let iter) (inlet :value iter :type 'iterator? :at-end #t :sequence (int-vector 1 2) :length 2 :position 2)))

(let ((h (hash-table* :a 1 :b 2))) (test (object->let h) (inlet :value h :type 'hash-table? :length 8 :entries 2 :locked #f :function 'eq?)))
(let ((h (hash-table* 1 1 2 2))) (test (object->let h) (inlet :value h :type 'hash-table? :length 8 :entries 2 :locked #f :function '=)))
(let ((h (make-hash-table 8 string=?))) (test (object->let h) (inlet :value h :type 'hash-table? :length 8 :entries 0 :locked #t :function 'string=?)))

(let ((e (inlet 'a 1 'b 2))) (test (object->let e) (inlet :value e :type 'let? :length 2 :open #f :outlet ())))
(test (object->let (rootlet)) (inlet :value (rootlet) :type 'let? :length (length (rootlet)) :open #f :outlet () :alias 'rootlet))
;(test (object->let (owlet)) (inlet :value (owlet) :type 'let? :length (length (owlet)) :open #f :outlet () :alias 'owlet))

(let ((e (openlet (inlet 'a 1 'b 2 'object->let (lambda (p lt) (varlet lt 'a+b (+ (p 'a) (p 'b))))))))
  (test (object->let e) (inlet :value e :type 'let? :length 3 :open #t :outlet () 'a+b 3)))

(let () 
  (define (fff x) (+ x 1))
  (let ((e (funclet fff)))
    (test ((object->let e) :type) 'let?)))
;          (inlet 'value e :type 'let? :length 1 :open #f :outlet (inlet 'fff fff) :function 'fff :file "s7test.scm" :line (port-line-number)))))
(let ((e (openlet (inlet :abs (lambda (x) (- x 1))))))
  (test (object->let e) (inlet :value e :type 'let? :length 1 :open #t :outlet ())))

(when with-block
  (let* ((b (make-block 8))
	 (bl (object->let b)))
    (test (let? bl) #t)
    (test (bl 'value) b)
    (test (bl 'type) 'c-object?)
    (test (let? (bl 'class)) #t)
    (test ((bl 'class) 'name) "#<block>")
    (test (integer? (bl 'c-object-type)) #t)
    (test ((b 'empty) b) #f)
    (test (let? (bl 'c-object-let)) #t)
    (test (((bl 'c-object-let) 'empty) b) #f)))
(when (provided? 'snd)
  (when (or (provided? 'snd-gtk)
	    (provided? 'snd-motif))
    (let ((cl (object->let jet-colormap)))
      (test (let? cl) #t)
      (test (cl 'value) jet-colormap)
      (test (cl 'type) 'c-object?)
      (test (cl 'class) (inlet 'name "<colormap>" 'setter #f))
      (test (integer? (cl 'c-object-type)) #t)
      (test (null? (cl 'c-object-let)) #t)))
  (let ((cl (object->let fourier-transform)))
      (test (let? cl) #t)
      (test (cl 'value) fourier-transform)
      (test (cl 'type) 'c-object?)
      (test (cl 'class) (inlet 'name "<transform>" 'setter #f))
      (test (integer? (cl 'c-object-type)) #t)
      (test (null? (cl 'c-object-let)) #t)))

(test (object->let *stderr*) (inlet :value *stderr* :type 'output-port? :port-type 'file :closed #f :file "*stderr*"))
(test (object->let *stdin*) (inlet :value *stdin* :type 'input-port? :port-type 'file :closed #f :file "*stdin*" :line 0))
(with-input-from-string "1234" 
  (lambda () 
    (read-char) 
    (test (object->let (current-input-port))
	  (inlet :value (current-input-port) :type 'input-port? :port-type 'string :closed #f :length 4 :position 1 :data "1"))))
(call-with-output-string  
 (lambda (p) 
   (display 123 p) 
   (let ((e (object->let p)))
     (test (e 'type) 'output-port?)
     (test (e 'port-type) 'string)
     (test (e 'length) 128)
     (test (e 'position) 3)
     (test (substring (e 'data) 0 3) "123"))))
(let ((e #f)) 
  (call-with-output-string  
   (lambda (p) 
     (display 123 p) 
     (set! e p)))
  (test (object->let e) (inlet :value e :type 'output-port? :port-type 'string :closed #t)))

(let () 
  (define (ff1 x y) (+ x y))
  (test (object->let ff1) (inlet 'value ff1 'type 'procedure? 'arity '(2 . 2) 'file "s7test.scm" 'line (port-line-number) 'source '(lambda (x y) (+ x y)))))
(let () 
  (define (ff2 . x) (apply + x))
  (test (object->let ff2) (inlet 'value ff2 'type 'procedure? 'arity '(0 . 536870912) 'file "s7test.scm" 'line (port-line-number) 'source '(lambda x (apply + x)))))
(let () 
  (define* (ff3 x y) (+ x y))
  (test (object->let ff3) (inlet 'value ff3 'type 'procedure? 'arity '(0 . 2) 'file "s7test.scm" 'line (port-line-number) 'source '(lambda* (x y) (+ x y)))))
(call-with-output-file "empty-file"
  (lambda (p) 
    (format p ";;; this is a test of file/line data in object->let~%~%")
    (format p "(define (ff4 x)~%  (+ (log x) 1))~%~%(set! (setter ff4) set-car!)~%~%")))
(let ()
  (load "empty-file" (curlet))
  (test (object->let ff4)
	(inlet 'value ff4 'type 'procedure? 'arity '(1 . 1) 'file "empty-file" 'line 4 '+setter+ set-car! 'source '(lambda (x) (+ (log x) 1)))))
(test (object->let abs)
      (inlet 'value abs 'type 'procedure? 'arity '(1 . 1) '+signature+ '(real? real?) '+documentation+ "(abs x) returns the absolute value of the real number x"))
(if with-block
    (test (object->let make-block)
	  (inlet 'value make-block 'type 'procedure? 'arity '(1 . 1) '+documentation+ "(make-block size) returns a new block of the given size")))
(test (object->let string=?)
      (inlet 'value string=? 
	     'type 'procedure? 
	     'arity '(2 . 536870912) 
	     '+signature+ (let ((lst (list 'boolean? 'string?)))
			  (set-cdr! (cdr lst) (cdr lst))
			  lst)
	     '+documentation+ "(string=? str ...) returns #t if all the string arguments are equal"))
(test (object->let car)
      (inlet 'value car 'type 'procedure? 'arity '(1 . 1) '+signature+ '(#t pair?) 
	     '+documentation+ "(car pair) returns the first element of the pair" 
	     '+setter+ set-car!))
(test (object->let quasiquote)
      (inlet 'value quasiquote 'type 'macro? 'arity '(1 . 1) 
	     '+documentation+ "(quasiquote arg) is the same as `arg.  If arg is a list, it can contain comma (\"unquote\") and comma-atsign (\"apply values\") to pre-evaluate portions of the list. unquoted expressions are evaluated and plugged into the list, apply-values evaluates the expression and splices the resultant list into the outer list. `(1 ,(+ 1 1) ,@(list 3 4)) -> (1 2 3 4)."))
(let ()
  (define-macro (1+ x) `(+ ,x 1))
  (let ((e (object->let 1+)))
    (test (e 'value) 1+)
    (test (e 'type) 'macro?)
    (test (e 'arity) '(1 . 1))
    (test (e 'source) '(lambda (x) (list-values '+ x 1)))))


;;; --------------------------------------------------------------------------------
;;; let-temporarily

(let ((aaa 1)
      (bbb 0)
      (ccc 0))
  (let-temporarily ((aaa 2))
    (set! bbb aaa)
    (set! aaa 32)
    (set! ccc aaa))
  (test (list aaa bbb ccc) '(1 2 32)))

(test (let ((aaa 0)
	    (bbb 0))
	(let-temporarily ((aaa 32))
	  (set! bbb aaa)
	  (let-temporarily ((bbb 10))
	    (set! aaa bbb)))
	(list aaa bbb))
      '(0 32))

(let ()
  (define f2 (let ((x '(0 1)))
	       (dilambda (lambda () x)
			 (lambda (y) (set! x y)))))
  (let-temporarily (((f2) '(3 2)))
    (test (f2) '(3 2)))
  (test (f2) '(0 1)))

(let ()
  (define f3 (let ((x 'z))
	       (dilambda (lambda () x)
			 (lambda (y) (set! x y)))))
  (let ((z 32))
    (let-temporarily (((f3) 'z))
      (test (f3) 'z))
    (test (f3) 'z)))

(let ((z 1)
      (x 32))
  (let-temporarily ((z 'x))
    (test z 'x))
  (test z 1))

(let ((saved 0)
      (orig 1)
      (vars 2)
      (body 3))
  (let ((vals (list (let-temporarily ((saved 30)
				      (orig 31)
				      (vars 32)
				      (body 33))
		      (let ((inner (list saved orig vars body)))
			(set! saved 41)
			(set! orig 42)
			(set! vars 43)
			(set! body 44)
			inner))
		    (list saved orig vars body))))
    (test vals '((30 31 32 33) (0 1 2 3)))))

(let ((cons +)
      (curlet abs)
      (inlet call/cc)
      (saved 32)
      (inner-let -1))
  (let-temporarily ((saved *))
    (set! inner-let (cons (saved (abs inner-let) 2) 3)))
  (test inner-let 5)
  (test (eq? curlet abs) #t))

(let ((a (vector 1 2 3))
      (x 1)
      (y 32))
  (let-temporarily (((a x) y))
    (test (a x) y))
  (test (a x) 2))

(let ((a (inlet 'b (vector 1 2 3)))
      (x 32)
      (y 1))
  (let-temporarily ((((a 'b) 1) 32))
    (test (a 'b) #(1 32 3)))
  (test (a 'b) #(1 2 3)))

(let ((x 1)
      (y 2))
  (let-temporarily ((x 32) (y x))
    (test (list x y) '(32 1)))
  (test (list x y) '(1 2)))

(let ((a (vector 1 2 3))
      (x 1)
      (y 32)
      (z 0))
  (let-temporarily (((a x) y) (z (a x)))
    (test (list (a x) y z) '(32 32 2)))
  (test (list (a x) y z) '(2 32 0)))

(test (let ((x 1)) (let-temporarily ((x 32)))) ()) ; was #f when let-temporarily was a macro -- not sure what it should be

(test (let-temporarily . 1) 'error)
(test (let-temporarily 1 1) 'error)
(test (let-temporarily ((a 1) . 2) a) 'error)
(test (let-temporarily (1 2) #t) 'error)
(test (let-temporarily ((pi 3)) pi) 'error)
(test (let-temporarily ((if 3)) if) 'error)
(test (let-temporarily ((x . 1)) x) 'error)
(test (let-temporarily ((x 1 2 3)) x) 'error)
;; (let ((x 0) (y 0)) (let-temporarily ((x 1) (x 2)) (set! y x)) (list x y)) '(0 1) ? let*-temp -> '(0 2)
(test (let ((x 3)) (list (let-temporarily ((x 1)) (values x 2)))) '(1 2))
  
(let ()
  (define ourlet
    (let ((x 1))
      (define (a-func) x)
      (define b-func (let ((y 1))
		       (lambda ()
			 (+ x y))))
      (curlet)))
  (test (ourlet 'x) 1)
  (test (let-temporarily (((ourlet 'x) 2)) ((ourlet 'a-func))) 2)
  (test ((funclet (ourlet 'b-func)) 'y) 1)
  (test (let-temporarily ((((funclet (ourlet 'b-func)) 'y) 3)) ((ourlet 'b-func))) 4))

(let ((x 0))
  (let ((y (call-with-exit 
	    (lambda (go) 
	      (let-temporarily ((x 1)) 
		(go (+ x 1)))))))
    (test (list x y) '(0 2))))
(let ((x 0))
  (let ((y (let-temporarily ((x 1)) 
	     (call-with-exit 
	      (lambda (go) 
		(go (+ x 1)))))))
    (test (list x y) '(0 2))))
(let ((x 0))
  (let ((y (call/cc
	    (lambda (go) 
	      (let-temporarily ((x 1)) 
		(go (+ x 1)))))))
    (test (list x y) '(0 2))))
(let ((x 0))
  (let ((y (let-temporarily ((x 1)) 
	     (call/cc
	      (lambda (go) 
		(go (+ x 1)))))))
    (test (list x y) '(0 2))))
(let ((x 10)
      (y 10))
  (catch #t 
    (lambda ()
      (let-temporarily ((x 1))
	(set! y x)
	(error 'oops)))
    (lambda args 'error))
  (test (list x y) '(10 1)))
(let ((x 10)
      (y 10))
  (catch #t 
    (lambda ()
      (let-temporarily ((x 1))
	(set! y x)
	(throw 'oops)))
    (lambda args 'error))
  (test (list x y) '(10 1)))

(test (let ((x 1)) (immutable! 'x) (let-temporarily ((x 1234)) (+ x 1))) 'error)
(test (let ((x 1)) (let-temporarily ((x 1234)) (immutable! 'x) (+ x 1))) 'error)
(test (let ((x 1)) (define (f) (do ((i 0 (+ i 1))) ((= i 1)) (let-temporarily ((x 1234)) (+ x 1)))) (immutable! 'x) (f)) 'error)
(test (let () (define (g) (cadr ())) (let ((x #f) (y 0)) (let-temporarily ((x 1234) (y 1/2)) (g)))) 'error)



;;; --------------------------------------------------------------------------------
;;; stacktrace

(test (string? (stacktrace)) #t)
;(test (stacktrace 123) 'error)
(test (begin (stacktrace 0 -1 1 20100) #f) #f) ; segfault?
(do ((i 0 (+ i 1)))
    ((= i 10))
  (stacktrace (- (random 10) 50) (- (random 100) 50) (- (random 100) 50) (- (random 100) 50) (> (random 100) 50)))

(let ((str ""))

  (define testtrace (lambda () (set! str (stacktrace 3))))
  (define (hi1 a) (testtrace))
  (define (hi2 b) (string-append (hi1 b) ""))
  (define (hi3 c) (string-append (hi2 c) ""))
  (define (hi4 d) (string-append (hi3 d) ""))
  (define (hi5 e) (string-append (hi4 e) ""))
  (define (hi6 f) (string-append (hi5 f) ""))
  (hi6 12)
  (test str "hi2: (string-append (hi1 b) \"\")                   ; b: 12
hi3: (string-append (hi2 c) \"\")                   ; c: 12
hi4: (string-append (hi3 d) \"\")                   ; d: 12
"))

(let ((str ""))
  (define testtrace (lambda () (set! str (stacktrace 5))))
  (define (hi1 a) (testtrace))
  (define (hi2 b) (string-append (hi1 b) ""))
  (define (hi3 c) (string-append (hi2 c) ""))
  (define (hi4 d) (string-append (hi3 d) ""))
  (define (hi5 e) (string-append (hi4 e) ""))
  (define (hi6 f) (string-append (hi5 f) ""))
  (hi6 12)
  (test str "hi2: (string-append (hi1 b) \"\")                   ; b: 12
hi3: (string-append (hi2 c) \"\")                   ; c: 12
hi4: (string-append (hi3 d) \"\")                   ; d: 12
hi5: (string-append (hi4 e) \"\")                   ; e: 12
hi6: (string-append (hi5 f) \"\")                   ; f: 12
"))

(let ((str ""))
  (define testtrace (lambda () (set! str (stacktrace 5 20 40 20))))
  (define (hi1 a) (testtrace))
  (define (hi2 b) (string-append (hi1 b) ""))
  (define (hi3 c) (string-append (hi2 c) ""))
  (define (hi4 d) (string-append (hi3 d) ""))
  (define (hi5 e) (string-append (hi4 e) ""))
  (define (hi6 f) (string-append (hi5 f) ""))
  (hi6 12)
  (test str "hi2: (string-app... ; b: 12
hi3: (string-app... ; c: 12
hi4: (string-app... ; d: 12
hi5: (string-app... ; e: 12
hi6: (string-app... ; f: 12
"))

(let ((str ""))
  (define testtrace (lambda () (set! str (stacktrace 5 20 40 8))))
  (define (hi1 a) (testtrace))
  (define (hi2 b) (string-append (hi1 b) ""))
  (define (hi3 c) (string-append (hi2 c) ""))
  (define (hi4 d) (string-append (hi3 d) ""))
  (define (hi5 e) (string-append (hi4 e) ""))
  (define (hi6 f) (string-append (hi5 f) ""))
  (hi6 12)
  (test str "hi2: (string-app...
         ; b: 12
hi3: (string-app...
         ; c: 12
hi4: (string-app...
         ; d: 12
hi5: (string-app...
         ; e: 12
hi6: (string-app...
         ; f: 12
"))

(let ((str ""))
  (define testtrace (lambda () (set! str (stacktrace 5 20 40 8 #t))))
  (define (hi1 a) (testtrace))
  (define (hi2 b) (string-append (hi1 b) ""))
  (define (hi3 c) (string-append (hi2 c) ""))
  (define (hi4 d) (string-append (hi3 d) ""))
  (define (hi5 e) (string-append (hi4 e) ""))
  (define (hi6 f) (string-append (hi5 f) ""))
  (hi6 12)
  (test str "; hi2: (string-app...
;         b: 12
; hi3: (string-app...
;         c: 12
; hi4: (string-app...
;         d: 12
; hi5: (string-app...
;         e: 12
; hi6: (string-app...
;         f: 12
"))

(let ((str ""))
  (define testtrace (lambda () (set! str (stacktrace 5 40 80 8 #t))))
  (define (hi1 a) (testtrace))
  (define (hi2 b) (string-append (hi1 b) ""))
  (define (hi3 c) (string-append (hi2 c) ""))
  (define (hi4 d) (string-append (hi3 d) ""))
  (define (hi5 e) (string-append (hi4 e) ""))
  (define (hi6 f) (string-append (hi5 f) ""))
  (hi6 12)
  (test str "; hi2: (string-append (hi1 b) \"\")      
;         b: 12
; hi3: (string-append (hi2 c) \"\")      
;         c: 12
; hi4: (string-append (hi3 d) \"\")      
;         d: 12
; hi5: (string-append (hi4 e) \"\")      
;         e: 12
; hi6: (string-append (hi5 f) \"\")      
;         f: 12
"))

(test (set! (*s7* 'max-stack-size) -1) 'error)
(test (set! (*s7* 'max-stack-size) 0) 'error)
(test (set! (*s7* 'max-stack-size) 32) 'error) ; this depends on INITIAL_STACK_SIZE (512)
(test (set! (*s7* 'max-stack-size) #\a) 'error)
(test (set! (*s7* 'max-stack-size) 3/4) 'error)
(test (set! (*s7* 'max-stack-size) 123123.123) 'error)
(test (integer? (*s7* 'max-stack-size)) #t)
(test (> (*s7* 'max-stack-size) 256) #t)

(test (set! (*s7* 'max-heap-size) -1) 'error)
(test (set! (*s7* 'max-heap-size) 0) 'error)
(test (set! (*s7* 'max-heap-size) #\a) 'error)
(test (set! (*s7* 'max-heap-size) 3/4) 'error)
(test (set! (*s7* 'max-heap-size) 123123.123) 'error)
(test (integer? (*s7* 'max-heap-size)) #t)
(test (> (*s7* 'max-heap-size) (ash 1 20)) #t)


;;; --------------------------------------------------------------------------------
;;; dilambda

(test (let ((local 123))
	(define pws-test (dilambda
			  (lambda () local)
			  (lambda (val) (set! local val))))
	(pws-test))
      123)

(test (let ((local 123))
	(define pws-test (dilambda
			  (lambda () local)
			  (lambda (val) (set! local val))))
	(pws-test 32))
      'error)

(test (let ((local 123))
	(define pws-test (dilambda
			  (lambda () local)
			  (lambda (val) (set! local val))))
	(set! (pws-test 32) 123))
      'error)

(let ()
  (define-constant -dl1- (let ((x 1)) (dilambda (lambda () x) (lambda (y) (set! x y)))))
  (test (-dl1-) 1)
  (set! (-dl1-) 3)
  (test (-dl1-) 3)
  (define (f1) (set! (-dl1-) 32) (-dl1-))
  (test (f1) 32))

(test (call-with-exit 
       (lambda (return) 
	 (let ((local 123))
	   (define pws-test (dilambda
			     (lambda () (return "oops"))
			     (lambda (val) (set! local val))))
	   (pws-test))))
      "oops")
(test (call-with-exit 
       (lambda (return)
	 (let ((local 123))
	   (define pws-test (dilambda
			     (lambda () 123)
			     (lambda (val) (return "oops"))))
	   (set! (pws-test) 1))))
      "oops")

(test (let ((local 123))
	(define pws-test (dilambda
			  (lambda () local)
			  (lambda (val) (set! local val))))
	(set! (pws-test) 321)
	(pws-test))
      321)

(test (let ((v (vector 1 2 3)))
	(define vset (dilambda
		      (lambda (loc)
			(vector-ref v loc))
		      (lambda (loc val)
			(vector-set! v loc val))))
	(let ((lst (list vset)))
	  (let ((val (vset 1)))
	    (set! (vset 1) 32)
	    (let ((val1 (vset 1)))
	      (set! ((car lst) 1) 3)
	      (list val val1 (vset 1))))))
      (list 2 32 3))

(let ((local 123))
  (define pws-test (dilambda
		    (lambda () local)
		    (lambda (val) (set! local val))))
  (test (dilambda? pws-test) #t)
  (test (pws-test) 123)
  (set! (pws-test) 32)
  (test (pws-test) 32)
  (set! (pws-test) 0)
  (test (pws-test) 0))

(let ((local 123))
  (define pws-test (dilambda
		    (lambda (val) (+ local val))
		    (lambda (val new-val) (set! local new-val) (+ local val))))
  (test (pws-test 1) 124)
  (set! (pws-test 1) 32)
  (test (pws-test 2) 34)
  (set! (pws-test 3) 0)
  (test (pws-test 3) 3))

(let ((ho (dilambda (lambda* ((a 1)) a) (lambda* (a (b 2)) (set! a b) a))))
  (test (ho) 1)
  (test (ho 3) 3)
  (test (set! (ho) 32) 2)
  (test (set! (ho 3) 32) 32))


(test (dilambda) 'error)
(test (dilambda abs) 'error)
(test (dilambda 1 2) 'error)
(test (dilambda (lambda () 1) (lambda (a) a) (lambda () 2)) 'error)
(test (dilambda (lambda () 1) 2) 'error)
(test (call-with-exit (lambda (return) (let ((g (dilambda return (lambda (s v) s)))) (g 0)))) 'error)
(test (call-with-exit (lambda (return) (let ((g (dilambda (lambda (s) s) return))) (g 0)))) 'error)
(test (+ (call-with-exit (lambda (return) (let ((g (dilambda (lambda (s) s) return))) (set! (g 1) 2))))) 'error)

(for-each
 (lambda (arg)
   (test (dilambda arg (lambda () #f)) 'error)
   (test (dilambda (lambda () #f) arg) 'error))
 (list "hi" -1 #\a 1 'a-symbol #(1 2 3) 3.14 3/4 1.0+1.0i #t (list 1 2 3) '(1 . 2)))

(for-each
 (lambda (arg)
   (test (dilambda? arg) #f))
 (list -1 #\a 1 #(1 2 3) 3.14 3/4 1.0+1.0i () 'hi "hi" #(()) abs (lambda () #f) (list (lambda () #f) (lambda (val) val)) (list 1 2 3) '(1 . 2) #<eof> #<unspecified> #<undefined>))

(let ((pws (dilambda vector-ref vector-set!)))
  (let ((v (vector 1 2 3)))
    (test (dilambda? pws) #t)
    (test (dilambda? pws pws) 'error)
    (test (pws v 1) 2)
    (set! (pws v 1) 32)
    (test (pws v 1) 32)))

(test (dilambda?) 'error)

(let ()
  (define macfun (dilambda
		  (define-macro (_m_ a) `(+ ,a 1))
		  (define-macro (_m_ a b) `(- ,a 1))))
  
  (test (macfun (+ 2 3)) 6)
  (test (set! (macfun (+ 2 3)) 3) 4))

(let () ; reality check...
  (set! (setter logbit?) 
	(define-macro (_m_ var index on)
	  `(if ,on
	       (set! ,var (logior ,var (ash 1 ,index)))
	       (set! ,var (logand ,var (lognot (ash 1 ,index)))))))

  (define (mingle a b)
    (let ((r 0))
      (do ((i 0 (+ i 1)))
          ((= i 31) r)
        (set! (logbit? r (* 2 i)) (logbit? a i))
        (set! (logbit? r (+ (* 2 i) 1)) (logbit? b i)))))

  (test (mingle 6 3) 30)
  (set! (setter logbit?) #f))

(let ()
  (dilambda logbit?
	    (define-macro (_m_ var index on)
	      `(if ,on
		   (set! ,var (logior ,var (ash 1 ,index)))
		   (set! ,var (logand ,var (lognot (ash 1 ,index)))))))
  (define (mingle a b)
    (let ((r 0))
      (do ((i 0 (+ i 1)))
          ((= i 31) r)
        (set! (logbit? r (* 2 i)) (logbit? a i))
        (set! (logbit? r (+ (* 2 i) 1)) (logbit? b i)))))

  (test (mingle 6 3) 30)
  (set! (setter logbit?) #f))


#|
(let ()
  (define pws-args (dilambda
		    (lambda args args)
		    (lambda args (set-car! args 0) args)))
  (let ((lst (list 1 2 3)))
    (let ((l1 (apply pws-args lst)))
      (test l1 '(1 2 3))
      (set-car! l1 32)
      (test lst '(1 2 3))
      (set! (pws-args l1) 3)
      (test l1 '(32 2 3))
      (test lst '(1 2 3))
      (let ()
	(define (pws1)
	  (pws-args lst))
	(let ((l2 (pws1)))
	  (set! l2 (pws1))
	  (test lst '(1 2 3)))))))
|#

(test (call-with-exit (lambda (return) (dilambda? return))) #f)
(test (dilambda? quasiquote) #f)

(test (let ((pws (dilambda (lambda args (apply + args)) (lambda args (apply * args))))) (pws 2 3 4)) 9)
(test (let ((pws (dilambda (lambda args (apply + args)) (lambda args (apply * args))))) (set! (pws 2 3 4) 5)) 120)
(let ((x 0)) 
  (let ((pws (dilambda
	      (let ((y 1)) ((lambda () (set! x (+ x y)) (lambda () x))))
	      (let ((y 2)) ((lambda () (set! x (* x y)) (lambda (z) (set! x (+ x z)))))))))
    (test x 2)
    (set! (pws) 3)
    (test x 5)))

(let ((p1 (dilambda (lambda () 1) (lambda (a) a))))
  (let ((p2 (dilambda p1 p1)))
    (test (p2) 1)))
(test ((dilambda call-with-exit call/cc) (lambda (a) (a 1))) 1)
(test (length (dilambda < >)) #f)

(let ((p1 (dilambda (lambda (a) (+ a 1)) (lambda (a b) (+ a b)))))
  (let ((p2 (dilambda p1 p1)))
    (test (p2 1) 2)))

(let ()
  (define sf1 (let ((val 0))
	      (dilambda
	       (let ((+signature+ '(integer?))
		     (+documentation+ "getter help"))
		 (lambda () 
		   val))
	       (let ((+signature+ '(integer? integer?))
		     (+documentation+ "setter help"))
		 (lambda (new-val) 
		   (if (integer? new-val)
		       (set! val new-val)
		       (error 'wrong-type-arg ";sf1 new value should be an integer: ~A" new-val)))))))
  (test (documentation sf1) "getter help")
  (test (documentation (setter sf1)) "setter help")
  (test (signature sf1) '(integer?))
  (test (signature (setter sf1)) '(integer? integer?)))

;;; dilambda?
(test (dilambda? (dilambda (lambda () 1) (make-hook))) #t)
(test (dilambda? (dilambda (make-hook) (setter car))) #t)

(for-each
 (lambda (arg)
   (if (dilambda? arg)
       (format #t ";(dilambda? ~A) -> #t?~%" arg)))
 (list "hi" _ht_ _undef_ _null_ :hi (integer->char 65) 1 (list 1 2) '#t '3 (make-vector 3) 3.14 3/4 1.0+1.0i #\f #() (if #f #f)))

(test (dilambda?) 'error)
(test (dilambda? abs car) 'error)
(test (dilambda? abs) #f)
(test (dilambda? car) #t)



;;; --------------------------------------------------------------------------------
;;; copy

(test (copy 3) 3)
(test (copy 3/4) 3/4)
(test (copy "hi") "hi")
(test (copy 'hi) 'hi)
(test (copy (list 1 2 3)) (list 1 2 3))
(test (copy (vector 0.0)) (vector 0.0))
(test (copy #\f) #\f)
(test (copy (list 1 (list 2 3))) (list 1 (list 2 3)))
(test (copy (cons 1 2)) (cons 1 2))
(test (let ((x (list 1 2 3))) (eq? (copy x) x)) #f)
(test (let ((x (list 1 2 3))) (equal? (copy x) x)) #t)
(test (let ((x #(1 2 3))) (eq? (copy x) x)) #f)
(test (let ((x #(1 2 3))) (equal? (copy x) x)) #t)
(test (let ((x "hi")) (eq? (copy x) x)) #f)
(test (let ((x "hi")) (equal? (copy x) x)) #t)
(test (copy '(1 2 . 3)) '(1 2 . 3))
(test (copy (+)) 0)
(test (copy +) +)
(test (copy (#(#() #()) 1)) #())
(test (copy #f) #f)
(test (copy ()) ())
(test (copy #()) #())
(test (copy #2d((1 2) (3 4))) #2d((1 2) (3 4)))
(test (let ((f (lambda () 1))) ((copy f))) 1)
(test (let ((f (lambda () 1))) (eq? (copy f) f)) #f)
(test (let ((f (lambda* ((a 2)) (+ a 1)))) ((copy f))) 3)
(test (let ((f (lambda* ((a 2)) (+ a 1)))) (eq? (copy f) f)) #f)
(test (copy 1.0) 1.0)
(test (copy 1.0+i) 1.0+i)
(test (copy "") "")
(test (copy #t) #t)
(test (copy (string #\a #\null #\b)) "a\x00;b")
(test (copy #<eof>) #<eof>)
(test ((copy abs) -123) 123)
(test (copy ''1) ''1)
(test (copy '''1) '''1)
(test (copy not) not)
(test (copy "a\x00;b") "a\x00;b")
(test (infinite? (copy (log 0.0))) #t)
(test (nan? (copy 1/0)) #t)
(test (copy if) if)
(test (copy quote) quote)
(test (let ((a 1) (b 2)) (equal? (copy (curlet)) (curlet))) #t)
(test (copy (rootlet)) (rootlet))
(test (copy (funclet abs)) (rootlet))
(test (copy (funclet quasiquote)) (rootlet))
(test (eval '(+ a 1) (copy (sublet (curlet) '(a . 2)))) 3)
(test (copy #<undefined>) #<undefined>)
(test (copy _undef_) _undef_)

(test (copy (list 1 2 (list 3 4))) '(1 2 (3 4)))
(test (copy (cons 1 2)) '(1 . 2))
(test (copy '(1 2 (3 4) . 5)) '(1 2 (3 4) . 5))
(test (copy ()) ())

(test (copy) 'error)
(test (copy () () ()) 'error)
(test (copy (make-hash-table) pi) 'error)
(test (copy 1 3) 'error)
(test (copy #() abs) 'error)

;;; 2 arg version of copy
(test (copy (list 1 2) (vector 0 0)) #(1 2))
(test (copy (list 1 2) (vector 0)) #(1))
(test (copy (list 1 2) (vector)) #())
(test (copy (list) (vector)) #())
(test (copy (list 1 2) (vector 0 0 3 4)) #(1 2 3 4))
; should (copy 1 2) be an error?
(test (copy #2d((1 2) (3 4)) (vector 0 0 0 0 0)) #(1 2 3 4 0))
(test (copy (vector 0 0 0 0 0) #2d((1 2) (3 4))) #2d((0 0) (0 0)))
(test (copy (vector 1 2 3 4 5) #2d((0 0) (0 0))) #2d((1 2) (3 4)))
(test (copy "12345" (make-list 5)) '(#\1 #\2 #\3 #\4 #\5))
(test (copy (list #\0 #\1 #\2) (make-string 3)) "012")
(test (copy '(0 1 2 3) (list 4 3 2 1)) '(0 1 2 3))
(test (copy #(0 1 2 3) (vector 4 3 2 1)) #(0 1 2 3))
(test (copy "12345" (make-string 5)) "12345")
(test (copy '(4 3 2 1) '(1 . 2)) '(4 . 2))
(test (copy (string (integer->char 255)) (vector 0)) #(#\xff))
(test (copy (vector (integer->char 255)) (string #\a)) (string (integer->char 255)))
(test (copy #() "") "")
(test (copy "" #()) #())
(test (copy #() (vector 1 2 3)) #(1 2 3))
(test (copy (make-float-vector 3 0.0)) (make-float-vector 3 0.0))
(test (copy (make-int-vector 3 0)) (make-int-vector 3 0))
(test (copy (make-int-vector '(2 3) 0)) (make-int-vector '(2 3) 0))
(test (eq? (copy 1) 1) #f)
(test (eq? (copy 1.0) 1.0) #f)
(test (eq? (copy 2/3) 2/3) #f)
(test (eq? (copy "") "") #f)
(test (copy #u8(101 102) (vector 1 2)) #(101 102))
(if with-block (test (copy (block 1.0) (immutable! (block 2.0))) 'error))

(let ((lst (list 1 2 3))) ; segfault before source==dest check
  (test (copy lst lst) lst)
  (test (copy lst lst 1) (list 2 3 3)))

(when with-block
  (let ((b (copy (block 1 2 3 4))))
    (test b (block 1 2 3 4))
    (fill! b 0 1 3)
    (test b (block 1 0 0 4))
    (let ((b1 (block 1 1 1 1 1)))
      (copy b b1)
      (test b1 (block 1 0 0 4 1)))
    (let ((b2 (block 1 2 3)))
      (let ((b3 (copy b b2)))
	(test (eq? b2 b3) #t)
	(test b3 (block 1 0 0))))
    (let ((b4 (block 5 6 7 8)))
      (copy b4 b 1)
      (test b (block 6 7 8 4)))))

(let ((lst (list 1 2 3)))
   (set! (cdr (cddr lst)) lst)
   (test (copy lst lst) lst)
   (test (copy lst (make-list 15 5)) '(1 2 3 5 5 5 5 5 5 5 5 5 5 5 5))) ; was going around twice 

(let ((v (vector 1 2 3)))
  (test (copy v v) v)
  (test (copy v v 1 3) #(2 3 3)))

(test (copy #(1 2 3 4 5 6) (make-list 3) 0 3) '(1 2 3))
(test (copy #(1 2 3 4 5 6) (make-list 3) 0) '(1 2 3))
(test (copy #(1 2 3 4 5 6) (make-list 3) 1) '(2 3 4))
(test (copy #(1 2 3 4 5 6) (make-list 3 0) 5) '(6 0 0))
(test (copy #(1 2 3 4 5 6) (make-list 3)) '(1 2 3))
(test (copy #(1 2 3 4 5 6) (make-list 3) 1 4) '(2 3 4))
(test (copy #(1 2 3 4 5 6) (make-list 3 #f) 1 2) '(2 #f #f))
(test (copy #(1 2 3 4 5 6) (make-list 3 #f) 1 1) '(#f #f #f))
(test (copy #(1 2 3 4 5 6) (make-list 3 #f) -1 1) 'error)
(test (copy #(1 2 3 4 5 6) (make-list 3 #f) 1 7) 'error)
(test (copy #(1 2 3 4 5 6) (make-list 3 #f) 1 0) 'error)
(test (copy #(1 2 3 4 5 6) () 1 2) ())
(test (copy #(1 2 3 4 5 6) ()) ())
(test (copy #(1 2 3 4 5 6) (make-list 6 #f) 2) '(3 4 5 6 #f #f))
(test (copy #(1 2 3 4 5 6) '(0 0 0 . 3)) '(1 2 3 . 3))

(let ((lst (list 7 8 9)))
   (set! (cdr (cddr lst)) lst)
   (copy #(1 2 3 4 5 6) lst 0 1)
   (test (car lst) 1)
   (copy #(1 2 3 4 5 6) lst 1 4)
   (test (car lst) 2))

(test (copy #(#\a #\b #\c) (make-string 2) 1) "bc")
(test (copy '(#\a #\b #\c) (make-string 2) 1) "bc")
(test (copy "abc" (make-string 2) 1) "bc")
(test (copy "abc" (make-vector 2) 1) #(#\b #\c))
(test (copy "abc" (make-list 2) 1) '(#\b #\c))
(test (copy '(1 2 3) (make-list 2) 1) '(2 3))
(test (copy '(1 2 3) (make-vector 2) 1) #(2 3))
(test (copy #(1 2 3) (make-vector 2) 1) #(2 3))
(test (copy #(1 2 3) (make-list 2) 1) '(2 3))
(test (copy (make-int-vector 3 0)) (make-int-vector 3 0))
(let ((orig "0123456789"))
  (let ((iv (copy (string->byte-vector orig) (make-int-vector 10))))
    (test (copy iv (make-string 10)) orig)))
(test (copy "0123456789" (make-float-vector 10)) (float-vector 48 49 50 51 52 53 54 55 56 57))

(test (let ((e (inlet 'a 1 'b 2 'c 3)) (f (inlet 'd 4))) (copy e f)) (inlet 'd 4 'c 3 'b 2 'a 1))
(test (let ((e (inlet 'a 1 'b 2 'c 3)) (f (inlet 'd 4))) (copy e f 0)) (inlet 'd 4 'c 3 'b 2 'a 1))
(test (let ((e (inlet 'a 1 'b 2 'c 3)) (f (inlet 'd 4))) (copy e f 1)) (inlet 'd 4 'b 2 'a 1))
(test (let ((e (inlet 'a 1 'b 2 'c 3)) (f (inlet 'd 4))) (copy e f 1 2)) (inlet 'd 4 'b 2))
(test (let ((e (inlet 'a 1 'b 2 'c 3)) (f (inlet 'd 4))) (copy f e)) (inlet 'a 1 'b 2 'c 3 'd 4))
;; printout is confusing (is this a reversal in this slot list, or a let-id side-effect?)
(test (let ((e (inlet 'a 1 'b 2 'c 3)) (f (inlet 'a 100 'b 200 'c 300 'd 400))) ((copy e f) 'a)) 1)
(test (let ((e (inlet 'a 1 'b 2 'c 3)) (f (inlet 'a 100 'b 200 'c 300 'd 400))) (copy e f)) (inlet 'a 100 'b 200 'c 300 'd 400 'c 3 'b 2 'a 1))

(let ((e1 (inlet 'a 1 'b 2))
      (e2 (inlet 'a 3 'c 3))
      (v1 (vector 1 2))
      (v2 (vector 3 4))
      (i1 (int-vector 5 6))
      (i2 (int-vector 7 8))
      (h1 (hash-table* 'd 4 'e 5))
      (h2 (hash-table* 'f 6 'e 7))
      (f1 (float-vector 9 10))
      (f2 (float-vector 11 12))
      (p1 (list 13 14))
      (p2 (list 15 16))
      (b1 (if with-block (block 17 18) (float-vector 17 18)))
      (b2 (if with-block (block 19 20) (float-vector 19 20)))
      (s1 (make-string 2 #\a))
      (s2 (make-string 2 #\b)))
  (test (copy e1 e2) (inlet 'a 3 'c 3 'b 2 'a 1))
  (test (copy e1 v2) #((b . 2) (a . 1)))
  (test (copy e1 i2) 'error)
  (test (copy e1 f2) 'error)
  (test (copy e1 h2) (hash-table '(a . 1) '(b . 2) '(e . 7) '(f . 6)))
  (test (copy e1 p2) '((b . 2) (a . 1)))
  (if with-block (test (copy e1 b2) 'error))
  (test (copy e1 s2) 'error)
  (test (copy v1 e2) 'error)
  (test (copy v1 v2) #(1 2))
  (test (copy v1 i2) (int-vector 1 2))
  (test (copy v1 f2) (float-vector 1.0 2.0))
  (test (copy v1 h2) 'error)
  (test (copy v1 p2) '(1 2))
  (if with-block (test (copy v1 b2) (block 1.000 2.000)))
  (test (copy v1 s2) 'error)
  (test (copy i1 e2) 'error)
  (test (copy i1 v2) #(5 6))
  (test (copy i1 i2) (int-vector 5 6))
  (test (copy i1 f2) (float-vector 5.0 6.0))
  (test (copy i1 h2) 'error)
  (test (copy i1 p2) '(5 6))
  (if with-block (test (copy i1 b2) (block 5.000 6.000)))
  (test (copy i1 s2) "\x05;\x06;")
  (test (copy f1 e2) 'error)
  (test (copy f1 v2) #(9.0 10.0))
  (test (copy f1 i2) (int-vector 9 10))
  (test (copy f1 f2) (float-vector 9.0 10.0))
  (test (copy f1 h2) 'error)
  (test (copy f1 p2) '(9.0 10.0))
  (if with-block (test (copy f1 b2) (block 9.000 10.000)))
  (test (copy f1 s2) 'error)
  (test (copy h1 e2) (inlet 'a 3 'c 3 'b 2 'a 1 'd 4 'e 5))
  (test (let ((h (copy h1 v2)))
	  (or (equal? h #((d . 4) (e . 5)))
	      (equal? h #((e . 5) (d . 4)))))
	#t)
  (test (copy h1 i2) 'error)
  (test (copy h1 f2) 'error)
  (test (copy h1 h2) (hash-table '(a . 1) '(b . 2) '(d . 4) '(e . 5) '(f . 6)))
  (test (let ((p (copy h1 p2)))
	  (or (equal? p '((d . 4) (e . 5)))
	      (equal? p '((e . 5) (d . 4)))))
	#t)
  (test (copy h1 b2) 'error)
  (test (copy h1 s2) 'error)
  (test (copy p1 e2) 'error)
  (test (copy p1 v2) #(13 14))
  (test (copy p1 i2) (int-vector 13 14))
  (test (copy p1 f2) (float-vector 13.0 14.0))
  (test (copy p1 h2) 'error)
  (test (copy p1 p2) '(13 14))
  (test (copy p1 b2) (if with-block (block 13.000 14.000) (float-vector 13.0 14.0)))
  (test (copy p1 s2) 'error)
  (test (copy b1 e2) 'error)
  (test (copy b1 v2) #(17.0 18.0))
  (test (copy b1 i2) (int-vector 17 18))
  (test (copy b1 f2) (float-vector 17.0 18.0))
  (test (copy b1 h2) 'error)
  (test (copy b1 p2) '(17.0 18.0))
  (test (copy b1 b2) (if with-block (block 17.000 18.000) (float-vector 17.0 18.0)))
  (test (copy b1 s2) 'error)
  (test (copy s1 e2) 'error)
  (test (copy s1 v2) #(#\a #\a))
  (test (copy s1 i2) (int-vector 97 97))
  (test (copy s1 f2) (float-vector 97.0 97.0))
  (test (copy s1 h2) 'error)
  (test (copy s1 p2) '(#\a #\a))
  (if with-block (test (copy s1 b2) 'error))
  (test (copy s1 s2) "aa"))

(let ((e1 (inlet 'a 1 'b 2))
      (e2 (inlet 'a 3 'c 3))
      (v1 (vector 1 2))
      (v2 (vector 3 4))
      (i1 (int-vector 5 6))
      (i2 (int-vector 7 8))
      (h1 (hash-table* 'd 4 'e 5))
      (h2 (hash-table* 'f 6 'e 7))
      (f1 (float-vector 9 10))
      (f2 (float-vector 11 12))
      (p1 (list 13 14))
      (p2 (list 15 16))
      (b1 (if with-block (block 17 18) (float-vector 17 18)))
      (b2 (if with-block (block 19 20) (float-vector 19 20)))
      (s1 (make-string 2 #\a))
      (s2 (make-string 2 #\b)))
  (test (copy e1 e2 1) (inlet 'a 3 'c 3 'a 1))
  (test (copy e1 v2 1) #((a . 1) 4))
  (test (copy e1 i2 1) 'error)
  (test (copy e1 f2 1) 'error)
  (test (copy e1 h2 1) (hash-table '(a . 1) '(e . 7) '(f . 6)))
  (test (copy e1 p2 1) '((a . 1) 16))
  (if with-block (test (copy e1 b2 1) 'error))
  (test (copy e1 s2 1) 'error)
  (test (copy v1 e2 1) 'error)
  (test (copy v1 v2 1) #(2 4))
  (test (copy v1 i2 1) (int-vector 2 8))
  (test (copy v1 f2 1) (float-vector 2.0 12.0))
  (test (copy v1 h2 1) 'error)
  (test (copy v1 p2 1) '(2 16))
  (if with-block (test (copy v1 b2 1) (block 2.000 20.000)))
  (test (copy v1 s2 1) 'error)
  (test (copy i1 e2 1) 'error)
  (test (copy i1 v2 1) #(6 4))
  (test (copy i1 i2 1) (int-vector 6 8))
  (test (copy i1 f2 1) (float-vector 6.0 12.0))
  (test (copy i1 h2 1) 'error)
  (test (copy i1 p2 1) '(6 16))
  (if with-block (test (copy i1 b2 1) (block 6.000 20.000)))
  (test (copy i1 s2 1) "\x06;b")
  (test (copy f1 e2 1) 'error)
  (test (copy f1 v2 1) #(10.0 4))
  (test (copy f1 i2 1) (int-vector 10 8))
  (test (copy f1 f2 1) (float-vector 10.0 12.0))
  (test (copy f1 h2 1) 'error)
  (test (copy f1 p2 1) '(10.0 16))
  (if with-block (test (copy f1 b2 1) (block 10.000 20.000)))
  (test (copy f1 s2 1) 'error)
  (test (let ((e (copy h1 e2 1)))
	  (or (equal? e (inlet 'a 3 'c 3 'a 1 'e 5))
	      (equal? e (inlet 'a 3 'c 3 'a 1 'd 4))))
	#t)
  (test (let ((v (copy h1 v2 1)))
	  (or (equal? v #((e . 5) 4))
	      (equal? v #((d . 4) 4))))
	#t)
  (test (copy h1 i2 1) 'error)
  (test (copy h1 f2 1) 'error)
  (test (let ((h (copy h1 h2 1)))
	  (or (equal? h (hash-table '(a . 1) '(e . 5) '(f . 6)))
	      (equal? h (hash-table '(e . 7) '(a . 1) '(f . 6) '(d . 4))))) ; ??
	#t)
  (test (let ((p (copy h1 p2 1)))
	  (or (equal? p '((e . 5) 16))
	      (equal? p '((d . 4) 16))))
	#t)
  (test (copy h1 b2 1) 'error)
  (test (copy h1 s2 1) 'error)
  (test (copy p1 e2 1) 'error)
  (test (copy p1 v2 1) #(14 4))
  (test (copy p1 i2 1) (int-vector 14 8))
  (test (copy p1 f2 1) (float-vector 14.0 12.0))
  (test (copy p1 h2 1) 'error)
  (test (copy p1 p2 1) '(14 16))
  (test (copy p1 b2 1) (if with-block (block 14.000 20.000) (float-vector 14.0 20.0)))
  (test (copy p1 s2 1) 'error)
  (test (copy b1 e2 1) 'error)
  (test (copy b1 v2 1) #(18.0 4))
  (test (copy b1 i2 1) (int-vector 18 8))
  (test (copy b1 f2 1) (float-vector 18.0 12.0))
  (test (copy b1 h2 1) 'error)
  (test (copy b1 p2 1) '(18.0 16))
  (test (copy b1 b2 1) (if with-block (block 18.000 20.000) (float-vector 18.0 20.0)))
  (test (copy b1 s2 1) 'error)
  (test (copy s1 e2 1) 'error)
  (test (copy s1 v2 1) #(#\a 4))
  (test (copy s1 i2 1) (int-vector 97 8))
  (test (copy s1 f2 1) (float-vector 97.0 12.0))
  (test (copy s1 h2 1) 'error)
  (test (copy s1 p2 1) '(#\a 16))
  (if with-block (test (copy s1 b2 1) 'error))
  (test (copy s1 s2 1) "ab"))

#|
(let ((e1 (inlet 'a 1 'b 2))
      (e2 (inlet 'a 3 'c 3))
      (v1 (vector 1 2))
      (v2 (vector 3 4))
      (i1 (int-vector 5 6))
      (i2 (int-vector 7 8))
      (h1 (hash-table* 'd 4 'e 5))
      (h2 (hash-table* 'f 6 'e 7))
      (f1 (float-vector 9 10))
      (f2 (float-vector 11 12))
      (p1 (list 13 14))
      (p2 (list 15 16))
      (b1 (if with-block (block 17 18) (vector 17 18)))
      (b2 (if with-block (block 19 20) (vector 19 20)))
      (s1 (make-string 2 #\a))
      (s2 (make-string 2 #\b)))
  (for-each 
   (lambda (o1 o1name)
     (for-each 
      (lambda (o2 o2name)
	(let ((val (catch #t (lambda () (copy o1 o2)) (lambda any 'error))))
	  (format *stderr* "(test (copy ~S ~S) '~S)~%" o1name o2name val)))
      (list e2 v2 i2 f2 h2 p2 b2 s2)
      (list 'e2 'v2 'i2 'f2 'h2 'p2 'b2 's2)))
   (list e1 v1 i1 f1 h1 p1 b1 s1)
   (list 'e1 'v1 'i1 'f1 'h1 'p1 'b1 's1)))
|#

(let ()
  (define* (copy-1 s d start end)
    (let ((dend (length d))
	  (send (or end (length s))))
      (if (not end)
	  (set! end (length s)))
      (do ((i (or start 0) (+ i 1))
	   (j 0 (+ j 1)))
	  ((or (= i end)
	       (= j dend))
	   d)
	(set! (d j) (s i)))))
  
  (for-each
   (lambda (s1 s2)
     (for-each
      (lambda (start)
	(for-each
	 (lambda (end)
	   (for-each 
	    (lambda (d1 d2)
	      (catch #t
		(lambda ()
		  (if end
		      (copy s1 d1 (or start 0) end)
		      (if start
			  (copy s1 d1 start)
			  (copy s1 d1)))
		  (copy-1 s2 d2 start end)
		  (if (not (equal? d1 d2))
		      (format *stderr* "(copy ~A ~A ~A) -> ~A ~A?~%" s1 start end d1 d2)))
		(lambda args 'error)))
	    (list (vector 0 0 0)
		  (make-int-vector 2 1)
		  (make-float-vector 2 0.0)
		  (string #\a #\b #\c #\d #\e)
		  (string) (list) (vector) 
		  (if with-block (block 1.0 1.0) (float-vector 1.0 1.0))
		  (cons 1 2))
	    (list (vector 0 0 0)
		  (make-int-vector 2 1)
		  (make-float-vector 2 0.0)
		  (string #\a #\b #\c #\d #\e)
		  (string) (list) (vector) 
		  (if with-block (block 1.0 1.0) (float-vector 1.0 1.0))
		  (cons 1 2))))
	 (list #f 0 1 3)))
      (list #f 0 1 2)))
   (list (vector 1 2 3 4)
	 (let ((v (make-int-vector 3 0))) (set! (v 0) 32) (set! (v 1) 16) (set! (v 2) 8) v)
	 (list 1 2 3 4 5)
	 (string #\a #\b)
	 (string) (list) (vector) 
	 (cons 1 (cons 2 3))
	 (if with-block (block 1.0 2.0 3.0 4.0) (float-vector 1.0 2.0 3.0 4.0)))
   (list (vector 1 2 3 4)
	 (let ((v (make-int-vector 3 0))) (set! (v 0) 32) (set! (v 1) 16) (set! (v 2) 8) v)
	 (list 1 2 3 4 5)
	 (string #\a #\b)
	 (string) (list) (vector)
	 (cons 1 (cons 2 3))
	 (if with-block (block 1.0 2.0 3.0 4.0) (float-vector 1.0 2.0 3.0 4.0)))))

(test (copy -1 6) 'error)
(for-each
 (lambda (arg)
   (test (copy arg #(1 2 3)) 'error)
   (test (copy #(1 2 3) arg) 'error))
 (list -1 #\a 3.14 3/4 1.0+1.0i 'hi abs (lambda () #f) #<eof> #<unspecified> #<undefined>))

(let ((ht (hash-table (cons 'a 1))))
  (test (copy ht (make-vector 3 #f)) #((a . 1) #f #f))
  (let ((e (inlet)))
    (copy ht e)
    (test (eval '(+ a 2) e) 3)
    (test (copy e #(1 2 3)) #((a . 1) 2 3))
    (copy (list (cons 'b 2)) ht)
    (test (ht 'b) 2)))

(let ((ht1 (hash-table* 'a 1))
      (ht2 (hash-table* 123 2)))
  (copy ht2 ht1)
  (test (ht1 123) 2)
  (copy ht1 ht2)
  (test (ht2 'a) 1)
  (test (hash-table-entries ht2) 2)
  (test (let ((str (object->string ht2)))
	  (or (string=? str "(hash-table '(a . 1) '(123 . 2))")
	      (string=? str "(hash-table '(123 . 2) '(a . 1))")))
	#t)
  (test (equal? ht1 ht2) #t))

(let ((ht1 (hash-table* 'a 1))
      (ht2 (make-hash-table)))
  (copy ht1 ht2)
  (test (= (hash-table-entries ht1) (hash-table-entries ht2)) #t)
  (test (equal? ht1 ht2) #t))

(let ((ht1 (hash-table* 'a 1 'b 2 'c 3))
      (ht2 (make-hash-table)))
  (copy ht1 ht2)
  (test (= (hash-table-entries ht1) (hash-table-entries ht2)) #t)
  (test (equal? ht1 ht2) #t))

(let ((ht1 (hash-table* 'a 1 'b 2 'c 3))
      (ht2 (make-hash-table)))
  (copy ht1 ht2 0 3)
  (test (= (hash-table-entries ht1) (hash-table-entries ht2)) #t)
  (test (equal? ht1 ht2) #t))

(let ((ht1 (hash-table* 'a 1 'b 2 'c 3))
      (ht2 (make-hash-table)))
  (copy ht1 ht2 1) ; either can be skipped here
  (test (= (hash-table-entries ht1) (+ (hash-table-entries ht2) 1)) #t)
  (test (equal? ht1 ht2) #f)
  (test (ht1 'a) 1)
  (test (ht1 'c) 3))

(let ((ht1 (hash-table* 'a 1 'b 2 'c 3))
      (ht2 (make-hash-table)))
  (copy ht1 ht2 1 2)
  (test (= (hash-table-entries ht1) (+ (hash-table-entries ht2) 2)) #t)
  (test (equal? ht1 ht2) #f)
  (test (ht1 'a) 1)
  (test (ht1 'c) 3))

(let ((ht1 (hash-table* 'a 1))
      (ht2 (hash-table* "a" 2)))
  (copy ht1 ht2)
  (test (= (hash-table-entries ht1) (hash-table-entries ht2)) #f)
  (test (equal? ht1 ht2) #f)
  (test (ht2 "a") 2)
  (test (ht2 'a) 1)
  (test (hash-table-entries ht2) 2))

(let ((ht1 (hash-table* 'a 1 "a" 3))
      (ht2 (hash-table* "a" 2)))
  (copy ht1 ht2)
  (test (= (hash-table-entries ht1) (hash-table-entries ht2)) #t)
  (test (equal? ht1 ht2) #t)
  (test (ht2 "a") 3)
  (test (ht2 'a) 1)
  (test (hash-table-entries ht2) 2))

(when with-bignums
  (test (let ((x (bignum "1"))) (eq? x (copy x))) #f)
  (test (let ((x (bignum "1/2"))) (eq? x (copy x))) #f)
  (test (let ((x (bignum "1.0"))) (eq? x (copy x))) #f)
  (test (let ((x (bignum "1+i"))) (eq? x (copy x))) #f))

(test (let ((x 1)) (eq? x (copy x))) #f) 
(test (= 1 (copy 1)) #t)
(test (= 1.5 (copy 1.5)) #t)
(test (= 1/2 (copy 1/2)) #t)
(test (= 1+i (copy 1+i)) #t)
(test (let ((x "str")) (eq? x (copy x))) #f)

(if (not (provided? 'gmp))
    (let ((r1 (random-state 1234)))
      (random 1.0 r1)
      (let ((r2 (copy r1)))
	(let ((v1 (random 1.0 r1))
	      (v2 (random 1.0 r2)))
	  (test (= v1 v2) #t)
	  (let ((v3 (random 1.0 r1)))
	    (random 1.0 r1)
	    (random 1.0 r1)
	    (let ((v4 (random 1.0 r2)))
	      (test (= v3 v4) #t)))))))

(if (provided? 'gmp)
    (let ((i (copy (bignum "1")))
	  (r (copy (bignum "3/4")))
	  (f (copy (bignum "1.5")))
	  (c (copy (bignum "1.0+1.0i"))))
      (test (= i (bignum "1")) #t)
      (test (= r (bignum "3/4")) #t)
      (test (= f (bignum "1.5")) #t)
      (test (= c (bignum "1.0+1.0i")) #t)))

(let ()
  (define (f1 a) (+ a 1))
  (define f2 (copy f1))
  (test (f1 1) (f2 1))
  (define* (f3 (a 2)) (* a 2))
  (define f4 (copy f3))
  (test (f3 3) (f4 3))
  (test (f3) (f4))
  (define-macro (f5 a) `(+ ,a 1))
  (define f6 (copy f5))
  (test (f5 2) (f6 2)))

(let ()
  (define (engulph form)
    (let ((body `(let ((L ()))
		   (do ((i 0 (+ i 1)))
		       ((= i 10) (reverse L))
		     (set! L (cons ,form L))))))
      (define function (apply lambda () (list (copy body :readable)))) ; an optimizable no-macro macro?
      (function)))

  (test (engulph '(+ i 1)) '(1 2 3 4 5 6 7 8 9 10)))




;;; --------

(let ((c1 #f))
  (call/cc
   (lambda (c)
     (test (reverse c) 'error)
     (test (fill! c) 'error)
     (test (length c) #f)
     (test (eq? c c) #t) ; is this the norm?
     (test (equal? c c) #t)
     (test (equal? c (copy c)) #t)
     (set! c1 c)))
  (test (continuation? c1) #t))

(let ((c1 #f))
  (call-with-exit
   (lambda (c)
     (test (reverse c) 'error)
     (test (fill! c) 'error)
     (test (length c) #f)
     (test (eq? c c) #t) 
     (test (equal? c c) #t)
     (test (equal? c (copy c)) #t)
     (set! c1 c)))
  (test (procedure? c1) #t))


;;; length
(test (length (list 1 2)) 2)
(test (length "hiho") 4)
(test (length (vector 1 2)) 2)
(test (>= (length (make-hash-table 7)) 7) #t)
(test (length ()) 0)
(test (length (#(#() #()) 1)) 0)
(test (length abs) #f)
(when with-block (test (length (block 1.0 2.0 3.0)) 3))
(test (length (make-iterator "123")) 3) ; this is not completely correct in all cases






;;; --------------------------------------------------------------------------------
;;; fill!

(let ((str (string #\1 #\2 #\3)))
  (fill! str #\x)
  (test str "xxx"))
(let ((v (vector 1 2 3)))
  (fill! v 0.0)
  (test v (vector 0.0 0.0 0.0)))
(let ((lst (list 1 2 (list (list 3) 4))))
  (fill! lst 100)
  (test lst '(100 100 100)))
(let ((cn (cons 1 2)))
  (fill! cn 100)
  (test cn (cons 100 100)))
(test (fill! 1 0) 'error)
(test (fill! 'hi 0) 'error)
(test (let ((x (cons 1 2))) (fill! x 3) x) '(3 . 3))
(test (let ((x "")) (fill! x #\c) x) "") 
(test (let ((x ())) (fill! x #\c) x) ()) 
(test (let ((x #())) (fill! x #\c) x) #()) 
(test (let ((x #(0 1))) (fill! x -1) (set! (x 0) -2) x) #(-2 -1))
(test (let ((x #(0 0))) (fill! x #(1)) (object->string x)) "#(#(1) #(1))") ; was "#(#1=#(1) #1#)"
(test (let ((lst (list "hi" "hi" "hi"))) (fill! lst "hi") (equal? lst '("hi" "hi" "hi"))) #t)
(test (let ((lst (list "hi" "hi"))) (fill! lst "hi") (equal? lst '("hi" "hi"))) #t)
(test (let ((lst (list 1 2 3 4))) (fill! lst "hi") (equal? lst '("hi" "hi" "hi" "hi"))) #t)
(test (let ((lst (list 1 2 3))) (fill! lst lst) (object->string lst)) "#1=(#1# #1# #1#)")
(test (let ((lst (vector 1 2 3))) (fill! lst lst) (object->string lst)) "#1=#(#1# #1# #1#)")
(test (let ((lst #2d((1) (1)))) (fill! lst lst) (object->string lst)) "#1=#2D((#1#) (#1#))")
(test (let ((lst '(1 2 3))) (fill! lst (cons 1 2)) (set! (car (car lst)) 3) (caadr lst)) 3)

(test (let ((lst (list))) (fill! lst 0) lst) ())
(test (let ((lst (list 1))) (fill! lst 0) lst) '(0))
(test (let ((lst (list 1 2))) (fill! lst 0) lst) '(0 0))
(test (let ((lst (list 1 (list 2 3)))) (fill! lst 0) lst) '(0 0))
(test (let ((lst (cons 1 2))) (fill! lst 0) lst) '(0 . 0))
(test (let ((lst (cons 1 (cons 2 3)))) (fill! lst 0) lst) '(0 0 . 0))
(let ((lst (make-list 3)))
  (fill! lst lst)
  (test lst (lst 0))
  (set! (lst 1) 32)
  (test ((lst 0) 1) 32))

(when with-block
  (let ((b (make-block 4)))
    (fill! b 32.0)
    (test b (block 32.0 32.0 32.0 32.0))))

(test (fill!) 'error)
(test (fill! '"hi") 'error)
(test (fill! (begin) if) if)
(test (fill! (rootlet) 3) 'error)
(let ((a 2) (e #f)) (set! e (curlet)) (test (begin (fill! e 3) a) 3))
(test (fill! "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" #f) 'error)
(let ((v (make-int-vector 3 0))) (fill! v 32) (test v (make-int-vector 3 32)))

(for-each
 (lambda (arg)
   (test (fill! arg 1) 'error))
 (list (integer->char 65) #f 'a-symbol abs quasiquote macroexpand 1/0 (log 0) #<eof> #<unspecified> #<undefined> (lambda (a) (+ a 1))
       3.14 3/4 1.0+1.0i #\f #t :hi (if #f #f) (lambda (a) (+ a 1))))

(for-each
 (lambda (arg)
   (let ((str (string #\a #\b)))
     (test (fill! str arg) 'error)))
 (list "hi" '(1 2 3) #() #f 'a-symbol abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1))))

(let ((ht (hash-table* :a 1)))
  (for-each
   (lambda (arg)
     (test (fill! ht arg) arg)
     (test (ht :a) arg))
   (list "hi" '(1 2 3) #() 'a-symbol abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand (log 0) 
	 3.14 3/4 1.0+1.0i #t :hi (if #f #f) (lambda (a) (+ a 1)) #f)))

(let ((str (make-string 10 #\a)))
  (fill! str #\b 0 2)
  (test str "bbaaaaaaaa")
  (fill! str #\c 8)
  (test str "bbaaaaaacc")
  (test (fill! str #\d -1) 'error)
  (test (fill! str #\d 1 0) 'error)
  (fill! str #\d 4 4)
  (test str "bbaaaaaacc"))

(let ((v (vector 1 2 3 4)))
  (fill! v 5 2 3)
  (test v #(1 2 5 4))
  (fill! v 6 2)
  (test v #(1 2 6 6)))

(let ((v (float-vector 1.0 2.0 3.0)))
  (test (fill! v 0.0 0 4) 'error)
  (test (fill! v 0.0 4 4) 'error)
  (fill! v 0.0 1)
  (test v (float-vector 1.0 0.0 0.0)))

(let ((v (int-vector 1 2 3)))
  (test (fill! v 0 0 4) 'error)
  (test (fill! v 0 4 4) 'error)
  (fill! v 0 1)
  (test v (int-vector 1 0 0)))

(let ((p (list 0 1 2 3 4)))
  (fill! p 5 3)
  (test p (list 0 1 2 5 5))
  (fill! p 6 0 3)
  (test p (list 6 6 6 5 5)))

(let ((p (cons 1 2)))
  (fill! p 3 0)
  (test p (cons 3 3))
  (set! p (cons 0 (cons 1 2)))
  (fill! p 4 0 1) ; "end" is ambiguous here
  (test p '(4 1 . 2))
  (fill! p 5 1)
  (test p '(4 5 . 5)))


;; generic for-each/map
(test (let ((sum 0)) (for-each (lambda (n) (set! sum (+ sum n))) (vector 1 2 3)) sum) 6)      
(test (map (lambda (n) (+ n 1)) (vector 1 2 3)) '(2 3 4))
(test (map (lambda (a b) (/ a b)) (list 1 2 3) (list 4 5 6)) '(1/4 2/5 1/2))

(when with-block
  (let ((b (block 1.0 2.0 3.0)))
    (test (map (lambda (x) (floor x)) b) '(1 2 3))
    (let ((sum 0))
      (for-each
       (lambda (x)
	 (set! sum (+ sum (floor x))))
       b)
      (test sum 6))))

;; try some applicable stuff
(test (let ((lst (list 1 2 3)))
	(set! (lst 1) 32)
	(list (lst 0) (lst 1)))
      (list 1 32))

(test (let ((hash (make-hash-table)))
	(set! (hash 'hi) 32)
	(hash 'hi))
      32)

(test (let ((str (string #\1 #\2 #\3)))
	(set! (str 1) #\a)
	(str 1))
      #\a)

(test (let ((v (vector 1 2 3)))
	(set! (v 1) 0)
	(v 1))
      0)

(let ()
  (define (hiho a) __func__)
  (test (or (equal? (hiho 1) 'hiho)
	    (equal? (car (hiho 1)) 'hiho))
	#t))


;;; gc
(for-each
 (lambda (arg)
   (test (gc arg) 'error))
 (list "hi" '(1 2 3) #() 'a-symbol abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
       3.14 3/4 1.0+1.0i 1 () "" :hi (if #f #f) (lambda (a) (+ a 1))))

(test (gc #f #t) 'error)
(if with-block (test (fill! (immutable! (block 0)) 1.0) 'error))




;;; --------------------------------------------------------------------------------
;;; tail recursion tests

(let ((max-stack 0))
  (define (tc-1 a c) 
    (let ((b (+ a 1))) 
      (if (> (-s7-stack-top-) max-stack)
	  (set! max-stack (-s7-stack-top-)))
      (if (< b c) 
	  (tc-1 b c))))
  (tc-1 0 32)
  (if (> max-stack 12) (format #t "tc-1 max: ~D~%" max-stack))) ; 18 here and below in repl.scm

(let ((max-stack 0))
  (define (tc-1 a c) 
    (if (> (-s7-stack-top-) max-stack)
	(set! max-stack (-s7-stack-top-)))
    (if (< a c) 
	(tc-2 (+ a 1) c)))
  (define (tc-2 a c) 
    (if (> (-s7-stack-top-) max-stack)
	(set! max-stack (-s7-stack-top-)))
    (if (< a c) 
	(tc-1 (+ a 1) c)))
  (tc-1 0 32)
  (if (> max-stack 12) (format #t "tc-1-1 max: ~D~%" max-stack)))

(let ((max-stack 0))
  (define (tc-2 a c) 
    (let ((b (+ a 1))) 
      (if (> (-s7-stack-top-) max-stack)
	  (set! max-stack (-s7-stack-top-)))
      (if (= b c)
	  #f
	  (tc-2 b c))))
  (tc-2 0 32)
  (if (> max-stack 12) (format #t "tc-2 max: ~D~%" max-stack)))

(let ((max-stack 0))
  (define (tc-2 a c) 
    (let ((b (+ a 1))) 
      (if (> (-s7-stack-top-) max-stack)
	  (set! max-stack (-s7-stack-top-)))
      (if (< b c)
	  (tc-2 b c)
	  #f)))
  (tc-2 0 32)
  (if (> max-stack 12) (format #t "tc-2-1 max: ~D~%" max-stack)))

(let ((max-stack 0))
  (define (tc-3 a c) 
    (let ((b (+ a 1))) 
      (if (> (-s7-stack-top-) max-stack)
	  (set! max-stack (-s7-stack-top-)))
      (cond ((= b c) #f)
	    ((< b c)
	     (tc-3 b c)))))
  (tc-3 0 32)
  (if (> max-stack 12) (format #t "tc-3 max: ~D~%" max-stack)))

(let ((max-stack 0))
  (define (tc-4 a c) 
    (let ((b (+ a 1))) 
      (if (> (-s7-stack-top-) max-stack)
	  (set! max-stack (-s7-stack-top-)))
      (cond ((= b c) #f)
	    (else (tc-4 b c)))))
  (tc-4 0 32)
  (if (> max-stack 12) (format #t "tc-4 max: ~D~%" max-stack)))

(let ((max-stack 0))
  (define (tc-5 a c) 
    (let ((b (+ a 1))) 
      (if (> (-s7-stack-top-) max-stack)
	  (set! max-stack (-s7-stack-top-)))
      (case b
	((32) #f)
	(else (tc-5 b c)))))
  (tc-5 0 32)
  (if (> max-stack 12) (format #t "tc-5 max: ~D~%" max-stack)))

(let ((max-stack 0))
  (define (tc-6 a c) 
    (let ((b (+ a 1))) 
      (if (> (-s7-stack-top-) max-stack)
	  (set! max-stack (-s7-stack-top-)))
      (case b
	((17) #f)
	((0 1 2 3 4 5 6 7 8) (tc-6 b c))
	((9 10 11 12 13 14 15 16) (tc-6 b c)))))
  (tc-6 0 32)
  (if (> max-stack 12) (format #t "tc-6 max: ~D~%" max-stack)))

(let ((max-stack 0))
  (define (tc-7 a c) 
    (let ((b (+ a 1))) 
      (if (> (-s7-stack-top-) max-stack)
	  (set! max-stack (-s7-stack-top-)))
      (or (>= b c)
	  (tc-7 b c))))
  (tc-7 0 32)
  (if (> max-stack 12) (format #t "tc-7 max: ~D~%" max-stack)))

(let ((max-stack 0))
  (define (tc-8 a c) 
    (let ((b (+ a 1))) 
      (if (> (-s7-stack-top-) max-stack)
	  (set! max-stack (-s7-stack-top-)))
      (and (< b c)
	   (tc-8 b c))))
  (tc-8 0 32)
  (if (> max-stack 12) (format #t "tc-8 max: ~D~%" max-stack)))

(let ((max-stack 0))
  (define (tc-9 a c) 
    (let tc-9a ((b a))
      (if (> (-s7-stack-top-) max-stack)
	  (set! max-stack (-s7-stack-top-)))
      (if (< b c)
	  (tc-9a (+ b 1)))))
  (tc-9 0 32)
  (if (> max-stack 12) (format #t "tc-9 max: ~D~%" max-stack)))

(let ((max-stack 0))
  (define (tc-10 a c) 
    (let* ((b (+ a 1))) 
      (if (> (-s7-stack-top-) max-stack)
	  (set! max-stack (-s7-stack-top-)))
      (and (< b c)
	   (tc-10 b c))))
  (tc-10 0 32)
  (if (> max-stack 12) (format #t "tc-10 max: ~D~%" max-stack)))

(let ((max-stack 0))
  (define (tc-11 a c) 
    (letrec ((b (+ a 1))) 
      (if (> (-s7-stack-top-) max-stack)
	  (set! max-stack (-s7-stack-top-)))
      (and (< b c)
	   (tc-11 b c))))
  (tc-11 0 32)
  (if (> max-stack 12) (format #t "tc-11 max: ~D~%" max-stack)))

(let ((max-stack 0))
  (define (tc-12 a c) 
    (if (< a c)
	(begin
	  (if (> (-s7-stack-top-) max-stack)
	      (set! max-stack (-s7-stack-top-)))
	  (tc-12 (+ a 1) c))))
  (tc-12 0 32)
  (if (> max-stack 12) (format #t "tc-12 max: ~D~%" max-stack)))

(let ((max-stack 0))
  (define (tc-13 a c) 
    (if (> (-s7-stack-top-) max-stack)
	(set! max-stack (-s7-stack-top-)))
    (cond ((= a c) #f)
	  ((< a c)
	   (if (> a c) (display "oops"))
	   (tc-13 (+ a 1) c))))
  (tc-13 0 32)
  (if (> max-stack 12) (format #t "tc-13 max: ~D~%" max-stack)))

(let ((max-stack 0))
  (define (tc-14 a c) 
    (if (> (-s7-stack-top-) max-stack)
	(set! max-stack (-s7-stack-top-)))
    (cond ((>= a c) #f)
	  ((values (+ a 1) c) => tc-14)))
  (tc-14 0 32)
  (if (> max-stack 12) (format #t "tc-14 max: ~D~%" max-stack)))

(let ((max-stack 0))
  (define (tc-15 a c) 
    (if (> (-s7-stack-top-) max-stack)
	(set! max-stack (-s7-stack-top-)))
    (or (>= a c)
	(apply tc-15 (list (+ a 1) c))))
  (tc-15 0 32)
  (if (> max-stack 12) (format #t "tc-15 max: ~D~%" max-stack)))

(let ((max-stack 0)
      (e #f))
  (set! e (curlet))
  (define (tc-17 a c) 
    (if (> (-s7-stack-top-) max-stack)
	(set! max-stack (-s7-stack-top-)))
    (or (and (>= a c) a)
	(eval `(tc-17 (+ ,a 1) ,c) e)))
  (let ((val (tc-17 0 32)))
    (test (and (= val 32) (< max-stack 28)) #t)))

(when full-test
  (let ((max-stack 0))
    (define (tc-19 a c) 
      (if (> (-s7-stack-top-) max-stack)
	  (set! max-stack (-s7-stack-top-)))
      (call/cc
       (lambda (r)
	 (if (>= a c) (r a))
	 (tc-19 (+ a 1) c))))
    (let ((val (tc-19 0 16)))
      (test (and (= val 16) (< max-stack 8)) #t))))

(let ((max-stack 0))
  (define (tc-21 a) 
    (if (< a 32)
	(do ((i (- a 1) (+ i 1)))
	    ((= i a) 
	     (tc-21 (+ a 1)))
	  (if (> (-s7-stack-top-) max-stack)
	      (set! max-stack (-s7-stack-top-))))
	a))
  (let ((val (tc-21 0)))
    (if (> max-stack 12) (format #t "tc-21 max: ~D~%" max-stack))
    (if (not (= val 32)) (format #t "tc-21 returned: ~A~%" val))))

(let ((max-stack 0))
  (define (tc-env a c) 
    (with-let (sublet (curlet) (cons 'b (+ a 1)))
      (if (> (-s7-stack-top-) max-stack)
	  (set! max-stack (-s7-stack-top-)))
      (if (< b c) 
	  (tc-env b c))))
  (tc-env 0 32)
  (if (> max-stack 12) (format #t "tc-env max: ~D~%" max-stack)))

(let ((max-stack 0))
  (define (tc-env-1 a) 
    (if (> (-s7-stack-top-) max-stack)
	(set! max-stack (-s7-stack-top-)))
    (if (> a 0) 
	(with-let (curlet)
	  (tc-env-1 (- a 1)))))
  (tc-env-1 32)
  (if (> max-stack 12) (format #t "tc-env-1 max: ~D~%" max-stack)))


;;; make sure for-each and map aren't messed up

(let ((max-stack 0))
  (for-each
   (lambda (a)
     (if (> (-s7-stack-top-) max-stack)
	 (set! max-stack (-s7-stack-top-)))
     (if (not (= a 1))
	 (error 'wrong-type-arg ";for-each arg is ~A" a)))
   (make-list 100 1))
  (test (< max-stack 20) #t)) ; 10 is not snd-test (and below)

(let ((max-stack 0))
  (map
   (lambda (a)
     (if (> (-s7-stack-top-) max-stack)
	 (set! max-stack (-s7-stack-top-)))
     (if (not (= a 1))
	 (error 'wrong-type-arg ";map arg is ~A" a)))
   (make-list 100 1))
  (test (< max-stack 20) #t))


(let ((max-stack 0)
      (e #f))
  (set! e (curlet))
  (define (tc-17 a c) 
    (if (> (-s7-stack-top-) max-stack)
	(set! max-stack (-s7-stack-top-)))
    (or (and (>= a c) a)
	(eval-string (format #f "(tc-17 (+ ~A 1) ~A)" a c) e)))
  (let ((val (tc-17 0 32)))
    (test (and (= val 32) (< max-stack 28)) #t)))

;;; the next 2 are not tail-recursive
;;;   OP_DEACTIVATE_GOTO in call-with-exit
;;;   OP_DYNAMIC_WIND in the dynamic-wind case

(let ((max-stack 0))
  (define (tc-16 a c) 
    (if (> (-s7-stack-top-) max-stack)
	(set! max-stack (-s7-stack-top-)))
    (call-with-exit
     (lambda (r)
       (if (>= a c) (r a))
       (tc-16 (+ a 1) c))))
  (let ((val (tc-16 0 32)))
    (test (and (= val 32) (> max-stack 28)) #t)))

(let ((max-stack 0))
  (define (tc-18 a c) 
    (dynamic-wind
	(lambda ()
	  (if (> (-s7-stack-top-) max-stack)
	      (set! max-stack (-s7-stack-top-))))
	(lambda ()
	  (or (and (>= a c) a)
	      (tc-18 (+ a 1) c)))
	(lambda ()
	  #f)))
  (let ((val (tc-18 0 32)))
    (test (and (= val 32) (> max-stack 28)) #t)))

(test (let ((f #f)) (let tr ((i 10)) (if (= i 3) (set! f (lambda () i))) (if (> i 0) (tr (- i 1)))) (f)) 3)
(test (let ((f ())) (let tr ((i 4)) (set! f (cons i f)) (if (> i 0) (tr (- i 1)))) f) '(0 1 2 3 4))



;;; -------- miscellaneous amusements

(test ((number->string -1) 0) #\-)
(test ((reverse '(1 2)) 0) 2)
(test ((append begin) list) list)
(test ((begin object->string) car) "car")
(test ((and abs) -1) 1)
(test (((values begin) object->string) car) "car")
(test (((values (begin begin)) object->string) car) "car")
(test ((((values append) begin) object->string) car) "car")
(test ((((((values and) or) append) begin) object->string) car) "car")
(test (((((((values values) and) or) append) begin) object->string) car) "car")
(test (((append s7-version)) 0) #\s)
(test ((values (lambda hi #()))) #())
(test (((((lambda () (lambda () (lambda () (lambda () 1)))))))) 1)
(test ((object->string #f) (ceiling 3/4)) #\f)
(test (procedure? ((((((lambda* ((x (lambda () x))) x))))))) #t)
(test (procedure? ((((((letrec ((x (lambda () x))) x))))))) #t)
(test (procedure? ((((((letrec ((x (lambda () y)) (y (lambda () x))) x))))))) #t)
(test (procedure? ((((((let x () x))))))) #t)
(test (procedure? ((((((lambda (x) (set! x (lambda () x))) (lambda () x))))))) #t)
(test (procedure? ````,,,,((((let x () x))))) #t)
(test ((do ((i 0 (+ i 1))) ((= i 1) (lambda () 3)))) 3)
(test (dynamic-wind s7-version s7-version s7-version) (s7-version))
(num-test ((list .(log 0)) 1) 0)
(num-test (((cons .(log 0)) 0) 1) 0.0)

(test (+ (+) (*)) 1)
(test (modulo (lcm) (gcd)) 1)
(test (max (+) (*)) 1)
(test (min (gcd) (lcm)) 0)
(test (symbol->value (gensym) (rootlet)) #<undefined>)
(test (string-ref (s7-version) (*)) #\7)
(test (string>=? (string-append) (string)) #t)
(test (substring (string-append) (+)) "")
(test (ash (*) (+)) 1)
(test (> (*) (+)) #t)
(test ((or #f list)) ())
(test ((or #f lcm)) 1)
(test ((or begin symbol?)) ())
(test ((or begin make-polar)) ())
(test ((and #t begin)) ())
(test (begin) ())
(test ((or #f lcm) 2 3) 6)
(test ((or and) #f #t) #f)
(test ((and or) #f #t) #t)
(test (or (or) (and)) #t)
(test ((car '((1 2) (3 4))) 0) 1)
(test ((or apply) lcm) 1)
(test (- ((or *))) -1)
(test ((car (list lcm))) 1)
(test ((or (cond (lcm)))) 1)
(test ((cond (asin floor *))) 1)
(test (logior (#(1 #\a (3)) 0) (truncate 1.5)) 1)
(test (real? (*)) #t)
(test (- (lcm)) -1)
(test (* (*)) 1)
(test (+ (+) (+ (+)) (+ (+ (+)))) 0)
(test (+(*(+))(*)(+(+)(+)(*))) 2)
(num-test (+(-(*).(+1))(*(+).(-1))(*(+).(-10))(*(-(+)0)1.)(-(+)(*).01)(*(-(+)).01)(-(+)(*)1.0)(-(*(+))1.0)(*(-(+))1.0)(-(+(*)1).0))-2.01)
(num-test (+(-(*).(+1.0))(*(+).(-1.0))(-(+)1.(*)0.)(-(*(+)0.)1.)(-(+(*)1.)0.)(+(-(*)0.)1.))1.0)
;; float comparison so can't use direct '=' here

(test (nan? (asinh (cos (real-part (log 0.0))))) #t)
(num-test(cos(sin(log(tan(*))))) 0.90951841537482)
(num-test (asinh (- 9223372036854775807)) -44.361419555836)
(num-test (imag-part (asin -9223372036854775808)) 44.361419555836)
(num-test (apply * (map (lambda (r) (sin (* pi (/ r 130)))) (list 1 67 69 73 81 97))) (/ 1.0 64))
(num-test (max 0(+)(-(*))1) 1)

(test ((call-with-exit object->string) 0) #\#) ; #<goto>
(test ((begin begin) 1) 1)
(test ((values begin) 1) 1)
(test ((provide or) 3/4) 'error)
(test (string? cond) #f)
(test (list? or) #f)
(test (pair? define) #f)
(test (number? lambda*) #f)
(test ((s7-version) (rationalize 0)) #\s)
(test (cond (((values '(1 2) '(3 4)) 0 0))) 'error)
(test (cond (((#2d((1 2) (3 4)) 0) 0) 32)) 32)
(test (cond ((apply < '(1 2)))) #t)
(test (dynamic-wind lcm gcd *) 0) ; was 'error but Peter Bex tells me this is normal
(test (case 0 ((> 0 1) 32)) 32)
(test (char-downcase (char-downcase #\newline)) #\newline)
(test (and (and) (and (and)) (and (and (and (or))))) #f)
(test ((values begin #\a 1)) 1)
(test ((values and 1 3)) 3)
(test ((((lambda () begin)) (values begin 1))) 1)
(test (+ (((lambda* () values)) 1 2 3)) 6)
(test ((values ('((1 2) (3 4)) 1) (abs -1))) 4)
(test ((apply lambda () '(() ()))) ())
(test ((lambda* ((symbol "#(1 #\\a (3))")) #t)) #t)
(test (apply if ('((1 2) (3 4)) 1)) 4)

(test (((lambda #\newline gcd))) 'error)
(test (symbol? (let () (define (hi) (+ 1 2)))) #f)
(test (symbol? (begin (define (x y) y) (x (define (x y) y)))) #f) 
(test (symbol? (do () ((define (x) 1) (define (y) 2)))) #f)
(test (cond (0 (define (x) 3) (x))) 3)
(test (let ((x (lambda () 3))) (if (define (x) 4) (x) 0)) 4)
(test (and (define (x) 4) (+ (x) 1)) 5)
(test (do ((x (lambda () 3) (lambda () 4))) ((= (x) 4) (define (x) 5) (x))) 5)
(test (begin (if (define (x) 3) (define (x) 4) (define (x) 5)) (x)) 4)

(test (let ((1,1 3) (1'1 4) (1|1 5) (1#1 6) (1\1 7) (1?1 8)) (+ 1,1 1'1 1|1 1#1 1\1 1?1)) 33)
(test (let ((,a 3)) ,a) 'error)
(test (let ((@a 3)) @a) 3)
(test (let (("a" 3)) "a") 'error)
(test (let ((`a 3)) `a) 'error)
(test (let (('a 3)) 'a) 'error)
(test (let ((a`!@#$%^&*~.,<>?/'{}[]\|+=_-a 3)) a`!@#$%^&*~.,<>?/'{}[]\|+=_-a) 3)

(test (set! ((quote (1 2)) 0) #t) #t)
(test (set! (((lambda () (list 1 2))) 0) 2) 2)
(test (let ((x (list 1 2))) (set! (((lambda () x)) 0) 3) x) '(3 2))
(test (let ((x (list 1 2))) (set! (((vector x) 0) 1) 32) x) '(1 32))
(test (let ((x (list 1 2))) (set! ((((lambda () (vector x))) 0) 0) 3) x) '(3 2))
(test (let ((x (list 1 2))) (set! ((((lambda () (list x))) 0) 0) 3) x) '(3 2))
(test (let ((x (list 1 2))) (set! ((set! x (list 4 3)) 0) 32) x) '(32 3))
(test (let ((x (list 1 2))) (list-set! (set! x (list 4 3)) 0 32) x) '(32 3))
(test (let ((x (list 1 2))) (set! ((list-set! x 0 (list 4 3)) 0) 32) x) '((32 3) 2))
(test (let ((x (list 1 2))) (list-set! (list-set! x 0 (list 4 3)) 0 32) x) '((32 3) 2))
(test (set! (('((0 2) (3 4)) 0) 0) 0) 0)
(test (set! ((map abs '(1 2)) 1) 0) 0)
(test (let () (set! ((define x #(1 2)) 0) 12) x) #(12 2))
(test (let ((x (list 1 2))) (set! ((call-with-exit (lambda (k) (k x))) 0) 12) x) '(12 2))
(test (let ((x #2d((1 2) (3 4)))) (set! (((values x) 0) 1) 12) x) #2D((1 12) (3 4)))
(test (let ((x 0)) (set! ((dilambda (lambda () x) (lambda (y) (set! x y)))) 12) x) 12)
(test (let ((x 0) (str "hiho")) (string-set! (let () (set! x 32) str) 0 #\x) (list x str)) '(32 "xiho"))
(test (let ((x "hi") (y "ho")) (set! ((set! x y) 0) #\x) (list x y)) '("xo" "xo"))
(test (let ((x "hi") (y "ho")) (set! x y) (set! (y 0) #\x) (list x y)) '("xo" "xo")) ; Guile gets the same result
(test (let ((x (lambda (a) (a z 1) z))) (x define)) 1) ; !
(test (let ((x (lambda (a) (a z (lambda (b) (+ b 1))) (z 2)))) (x define)) 3)
(test (let ((x (lambda (a b c) (apply a (list b c))))) (x let () 3)) 3)
(test (let ((x (lambda (a b c) (apply a (list b c))))) (x let '((y 2)) '(+ y 1))) 3)

(let () (test ((values let '((x 1))) '(+ x 1)) 2)) ; !
(let () (test ((values begin '(define x 32)) '(+ x 1)) 33))
(let () (test (((values lambda '(x) '(+ x 1))) 32) 33))
(let () (test (let ((arg '(x)) (body '(+ x 1))) (((values lambda arg body)) 32)) 33))
(let () (test (let ((arg '(x)) (body '(+ x 1))) ((apply lambda arg (list body)) 32)) 33))
(let () (test (let ((x 12)) ((apply lambda '(x) (list (list '+ 1 x 'x))) 3)) 16))
(let () (test (let* ((x 3) (arg '(x)) (body `((+ ,x x 1)))) ((apply lambda arg body) 12)) 16))

(let ()
  (define (bcase start end func)
    (let ((body ()))
      (do ((i start (+ i 1)))
	  ((= i end))
	  (set! body (cons `((,i) ,(func i)) body)))
      (lambda (i) (apply case i body))))
  (test ((bcase 0 3 abs) 1) 1))




;;; ------ CLisms ------------------------------------------------------------------------


(let ()

      ;; **********************************************************************
      ;; 
      ;; Copyright (C) 2002 Heinrich Taube (taube@uiuc.edu) 
      ;; 
      ;; This program is free software; you can redistribute it and/or
      ;; modify it under the terms of the GNU General Public License
      ;; as published by the Free Software Foundation; either version 2
      ;; of the License, or (at your option) any later version.
      ;; 
      ;; This program is distributed in the hope that it will be useful,
      ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
      ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      ;; GNU General Public License for more details.
      ;; 
      ;; **********************************************************************
      
      ;; $Name:  $
      ;; $Revision: 1.6 $
      ;; $Date: 2005/11/17 13:29:37 $
      
      ;;
      ;; Implementation of the CLTL2 loop macro. The following 
      ;; non Rev 5 definitions need to be in effect before the file
      ;; is loaded:
      ;;
      ;; (define-macro (name . args) ...)
      ;; (error string)
      ;; (gensym string)
      ;;
      
;      (define-macro (when test . forms)
;	`(if ,test (begin ,@forms)))
	  
      (define-macro (loop . args)
	(let ()
	  
	  (define-macro (push val sym)
	    `(begin (set! ,sym (cons ,val ,sym)) ,sym))
	  
	  (define-macro (pop sym)
	    (let ((v (gensym "v")))
	      `(let ((,v (car ,sym)))
		 (set! ,sym (cdr ,sym))
		 ,v)))
	  
	  ;; this next one is a no-op but i need it as a marker for my cltl2
	  ;; translator.
	  
	  (define-macro (function sym) sym)     
	  
	  ;; getters and setters for the loop-clause "struct"
	  
	  (define (loop-operator c)          (vector-ref  c 0))
	  (define (loop-operator-set! c x)   (vector-set! c 0 x))
	  (define (loop-bindings c)          (vector-ref  c 1))
	  (define (loop-bindings-set! c x)   (vector-set! c 1 x))
	  (define (loop-collectors c)        (vector-ref  c 2))
	  (define (loop-collectors-set! c x) (vector-set! c 2 x))
	  (define (loop-initially c)         (vector-ref  c 3))
	  (define (loop-initially-set! c x)  (vector-set! c 3 x))
	  (define (loop-end-tests c)         (vector-ref  c 4))
	  (define (loop-end-tests-set! c x)  (vector-set! c 4 x))
	  (define (loop-looping c)           (vector-ref  c 5))
	  (define (loop-looping-set! c x)    (vector-set! c 5 x))
	  (define (loop-stepping c)          (vector-ref  c 6))
	  (define (loop-stepping-set! c x)   (vector-set! c 6 x))
	  (define (loop-finally c)           (vector-ref  c 7))
	  (define (loop-finally-set! c x)    (vector-set! c 7 x))
	  (define (loop-returning c)         (vector-ref  c 8))
	  (define (loop-returning-set! c x)  (vector-set! c 8 x))
	  
	  (define (make-loop-clause . args)
	    (let ((v (vector #f () () () () () () () ())))
	      (if (null? args) v
		  (do ((a args (cddr a)))
		      ((null? a) v)
		    (case (car a)
		      ((operator) (loop-operator-set! v (cadr a)))
		      ((bindings) (loop-bindings-set! v (cadr a)))
		      ((collectors) (loop-collectors-set! v (cadr a)))
		      ((initially) (loop-initially-set! v (cadr a)))
		      ((end-tests) (loop-end-tests-set! v (cadr a)))
		      ((looping) (loop-looping-set! v (cadr a)))
		      ((stepping) (loop-stepping-set! v (cadr a)))
		      ((finally) (loop-finally-set! v (cadr a)))
		      ((returning) (loop-returning-set! v (cadr a))))))))
	  
	  (define (gather-clauses caller clauses)
	    ;; nconc all clausal expressions into one structure
	    (let ((gather-clause 
		   (lambda (clauses accessor)
		     ;; append data from clauses
		     (do ((l ()))
			 ((null? clauses) l)
		       (set! l (append l (accessor (car clauses))))
		       (set! clauses (cdr clauses))))))
	      (make-loop-clause 'operator caller
				'bindings
				(gather-clause clauses 
					       (function loop-bindings))
				'collectors
				(gather-clause clauses 
					       (function loop-collectors))
				'initially 
				(gather-clause clauses 
					       (function loop-initially))
				'end-tests 
				(gather-clause clauses 
					       (function loop-end-tests))
				'looping 
				(gather-clause clauses 
					       (function loop-looping))
				'stepping 
				(gather-clause clauses 
					       (function loop-stepping))
				'finally 
				(gather-clause clauses
					       (function loop-finally))
				'returning 
				(gather-clause clauses
					       (function loop-returning)))))
	  
	  (define (loop-op? x ops)
	    (assoc x ops))
	  
	  (define (loop-variable? x)
	    (symbol? x))
	  
	  (define (make-binding var val)
	    (list var val))
	  
	  (define (loop-error ops forms . args)
	    ;; all error messages include error context.
	    (let ((loop-context
		   (lambda (lst ops)
		     ;; return tail of expr up to next op in cdr of tail
		     (do ((h lst)
			  (l ()))
			 ((or (null? lst)
			      ;; ignore op if in front.
			      (and (not (eq? h lst))
				   (loop-op? (car lst) ops)))
			  (reverse l))
		       (set! l (cons (car lst) l))
		       (set! lst (cdr lst))))))
	      (let ((forms (loop-context forms ops)))
		(newline)
		(display "LOOP ERROR: ")
		(do ((tail args (cdr tail)))
		    ((null? tail) #f)
		  (display (car tail)))
		(newline)
		(display "clause context: ")
		(if (null? forms) 
		    (display "()")
		    (do ((tail forms (cdr tail)))
			((null? tail) #f)
		      (if (eq? tail forms) (display "'"))
		      (display (car tail))
		      (display (if (null? (cdr tail)) "'" " "))))
		(newline)
		(error 'syntax-error "illegal loop syntax"))))
	  
	  (define (parse-for forms clauses ops)
	    ;; forms is (FOR ...)
	    (let ((op (loop-op? (car forms) ops)))
	      (if (null? (cdr forms))
		  (loop-error ops forms "Variable expected but source code ran out." )
		  (let ((var (cadr forms)))
		    (if (loop-variable? var)
			(if (null? (cddr forms))
			    (loop-error ops forms
					"'for' clause expected but source code ran out.")
			    ;; find the iteration path in the op
			    (let ((path (assoc (caddr forms) (cdddr op))))
			      ;; path is (<pathop> <parser>)
			      (if (not path)
				  (loop-error ops forms "'" (caddr forms) "'"
					      " is not valid with 'for'.")
				  ( (cadr path) forms clauses ops))))
			(loop-error ops forms "Found '" (cadr forms)
				    "' where a variable expected."))))))
	  
	  (define (parse-numerical-for forms clauses ops)
	    ;; forms is (FOR <var> <OP> ...)
	    ;; where <OP> is guaranteed to be one of: FROM TO BELOW ABOVE DOWNTO
	    ;; (bil) clauses
	    (let ((var (cadr forms))
		  (tail (cddr forms))
		  (bind ())
		  (from #f)
		  (head #f)
		  (last #f)
		  (stop #f)
		  (step #f)
		  (test #f)
		  (incr #f))
	      
	      (do ((next #f))
		  ((or (null? tail) (loop-op? (car tail) ops)))
		(set! next (pop tail))
		(if (null? tail)
		    (loop-error ops forms
				"Expected expression but source code ran out."))
		(case next
		  ((from downfrom)
		   (if head (loop-error ops forms "Found '" next "' when '"
					head "' in effect."))
		   (set! head next)
		   (set! from (pop tail)))
		  ((below)
		   (if last (loop-error ops forms "Found '" next "' when '"
					last "' in effect."))
		   (set! stop (pop tail))
		   (set! last next))
		  ((to)
		   (if last (loop-error ops forms "Found '" next "' when '"
					last "' in effect."))
		   (set! stop (pop tail) )
		   (set! last next))
		  ((above )
		   (if last (loop-error ops forms "Found '" next "' when '"
					last "' in effect."))
		   (set! stop (pop tail))
		   (set! last next))
		  ((downto )
		   (if last (loop-error ops forms "Found '" next "' when '"
					last "' in effect."))
		   (set! stop (pop tail))
		   (set! last next))
		  ((by)
		   (if step (loop-error ops forms "Found duplicate 'by'."))
		   (set! step (pop tail)))
		  (else
		   (loop-error ops forms 
			       "'" next "' is not valid with 'for'."))))
	      (if (not head)
		  (set! head 'from))
	      (if (or (eq? head 'downfrom)
		      (eq? last 'downto)
		      (eq? last 'above))
		  (begin
		    (set! incr '-)
		    (if (eq? last 'above)
			(set! test '<=)
			(set! test '<)))   ; allow to for downto
		  (begin
		    (set! incr '+)
		    (if (eq? last 'below)
			(set! test '>=)
			(set! test '>))))
	      
	      ;; add binding for initial value
	      (push (make-binding var (or from 0)) bind)
	      ;; add binding for non-constant stepping values.
	      (if (not step)
		  (set! step 1)
		  (if (not (number? step))
		      (let ((var (gensym "v")))
			(push (make-binding var step) bind)
			(set! step var))))
	      (set! step `(set! ,var (,incr ,var ,step)))
	      (if stop
		  (let ((end (gensym "v")))
		    (push (make-binding end stop) bind)
		    (set! stop (list test var end))))
	      (values (make-loop-clause 'operator 'for
					'bindings (reverse bind)
					'stepping (list step)
					'end-tests (if (not stop)
						       () (list stop)))
		      tail)))
	  
	  (define (parse-repeat forms clauses ops)
	    ;; forms is (REPEAT <FORM> ...)
	    (if (null? (cdr forms))
		(loop-error ops forms 
			    "'repeat' clause expected but source code ran out." )
		(call-with-values (lambda ()
				    (parse-numerical-for 
				     (list 'for (gensym "v") 'below (cadr forms))
				     clauses ops))
		  (lambda (clause ignore)
		    ignore
		    (values clause (cddr forms))))))
	  
	  (define (parse-sequence-iteration forms clauses ops)
	    ;; tail is (FOR <var> <OP> ...)
	    ;; <OP> is guaranteed to be one of: IN ON ACROSS
	    ;; (bil) clauses
	    (let ((head forms)
		  (var (cadr forms))
		  (seq (gensym "v"))
		  (tail (cddr forms))
		  (bind ())
		  (data #f) 
		  (init ()) 
		  (loop ()) 
		  (incr #f)
		  (stop ()) 
		  (step ()) 
		  (type #f))
	      
	      (do ((next #f))
		  ((or (null? tail) (loop-op? (car tail) ops)))
		(set! next (pop tail))
		(when (null? tail)
		      (loop-error ops head
				  "Expression expected but source code ran out." ))
		(case next
		  ((in on across)
		   (if type (loop-error ops head 
					"Extraneous '" next "' when '"
					type "' in effect."))
		   (set! type next)
		   (set! data (pop tail)))
		  ((by )
		   (if incr 
		       (loop-error ops head "Duplicate 'by'." )
		       (if (eq? type 'across)
			   (loop-error ops head "'by' is invalid with 'across'." )
			   (set! incr (pop tail)))))
		  (else
		   (loop-error ops head "'" next "' is not valid with 'for'."))))
					; add bindings for stepping var and source
	      (push (make-binding var #f) bind)
	      (push (make-binding seq data) bind)
	      (if (eq? type 'across)
		  (let ((pos (gensym "v"))
			(mx (gensym "v")))
		    (push (make-binding pos 0) bind)
		    (push (make-binding mx #f) bind)
		    (push `(set! ,mx (vector-length ,seq)) init)
		    (push `(set! ,pos (+ 1 ,pos)) step)
		    (push `(set! ,var (vector-ref ,seq ,pos)) loop)
		    (push `(>= ,pos ,mx) stop))
		  (begin
		    (if incr
			(if (and (list? incr) (eq? (car incr) 'quote))
			    (push `(set! ,seq (,(cadr incr) ,seq)) step)
			    (push `(set! ,seq (,incr ,seq)) step))
			(push `(set! ,seq (cdr ,seq)) step))
		    (push (if (eq? type 'in)
			      `(set! ,var (car ,seq))
			      `(set! ,var ,seq))
			  loop)
		    (push `(null? ,seq) stop)))
	      
	      (values (make-loop-clause 'operator 'for
					'bindings (reverse bind)
					'end-tests stop
					'initially init
					'looping loop
					'stepping step)
		      tail)))
	  
	  (define (parse-general-iteration forms clauses ops)
	    ;; forms is (FOR <var> = ...)
	    ;; (bil) clauses
	    (let ((head forms)
		  (var (cadr forms))
		  (tail (cddr forms))
		  (init #f)
		  (type #f)
		  (loop #f)
		  (step #f))
	      (do ((next #f))
		  ((or (null? tail) (loop-op? (car tail) ops)))
		(set! next (pop tail))
		(if (null? tail)
		    (loop-error ops head 
				"Expression expected but source code ran out."))
		(case next
		  ((= )
		   (if type (loop-error ops head "Duplicate '='."))
		   (set! loop `(set! ,var ,(pop tail)))
		   (set! type next))
		  ((then )
		   (if init (loop-error ops head "Duplicate 'then'."))
		   (set! init loop)
		   (set! loop #f)
		   (set! step `(set! ,var ,(pop tail)))
		   (set! type next))
		  (else
		   (loop-error ops head "'" next "' is not valid with 'for'."))))
	      
	      (values (make-loop-clause 'operator 'for
					'bindings (list (make-binding var #f))
					'initially (if init (list init) ())
					'looping (if loop (list loop) ())
					'stepping (if step (list step) ()))
		      tail)))
	  
	  (define (parse-with forms clauses ops)
	    ;; forms is (WITH <var> = ...)
	    ;; (bil) clauses
	    (let ((head forms)
		  (tail (cdr forms))
		  (var #f)
		  (expr #f)
		  (and? #f)
		  (bind ())
		  (init ()))
	      (do ((need #t) 
		   (next #f))
		  ((or (null? tail) (loop-op? (car tail) ops)))
		(set! next (pop tail))
		(cond ((and (loop-variable? next) need)
		       (if var
			   (loop-error ops head
				       "Found '" next "' where 'and' expected."))
		       (if expr
			   (loop-error ops head
				       "Found '" next "' where 'and' expected."))
		       (set! var next)
		       (set! expr #f)
		       (set! and? #f)
		       (set! need #f))
		      ((eq? next 'and)
		       (if and?
			   (loop-error ops head "Duplicate 'and'.")
			   (if var 
			       (if expr
				   (begin
				     (push (make-binding var #f) bind)
				     (push `(set! ,var ,expr) init))
				   (push (make-binding var #f) bind))
			       (loop-error ops head "Extraneous 'and'.")))
		       (set! var #f)
		       (set! expr #f)
		       (set! and? #t)
		       (set! need #t))
		      ((eq? next '=)
		       (if expr
			   (loop-error ops head 
				       "Found '=' where 'and' expected.")
			   (set! expr (pop tail))))
		      (else
		       (if need
			   (loop-error ops head
				       "Found '" next "' where variable expected.")
			   (loop-error ops head "Found '" next
				       "' where '=' or 'and' expected.")))))
	      (if and? 
		  (loop-error ops head "Extraneous 'and'.")
		  (if var 
		      (if expr
			  (begin (push (make-binding var #f) bind)
				 (push `(set! ,var ,expr) init))
			  (push (make-binding var #f) bind))))
	      
	      (values (make-loop-clause 'operator 'with
					'bindings (reverse bind)
					'initially (reverse init))
		      tail)))
	  
	  (define (parse-do forms clauses ops)
	    ;; (bil) clauses
	    (let ((head forms)
		  (oper (pop forms))
		  (body ()))
	      (do ()
		  ((or (null? forms)
		       (loop-op? (car forms) ops))
		   (if (null? body)
		       (loop-error ops head "Missing '" oper "' expression.")
		       (set! body (reverse body))))
		(push (car forms) body)
		(set! forms (cdr forms)))
	      (values
	       (make-loop-clause 'operator oper 'looping body)
	       forms)))
	  
	  (define (parse-finally forms clauses ops)
	    ;; (bil) clauses
	    (let ((oper (pop forms))
		  (expr #f))
	      (if (null? forms)
		  (loop-error ops forms "Missing '" oper "' expression."))
	      (set! expr (pop forms))
	      (values (make-loop-clause 'operator oper 'finally (list expr))
		      forms)))
	  
	  (define (parse-initially forms clauses ops)
	    ;; (bil) clauses
	    (let ((oper (pop forms))
		  (expr #f))
	      (if (null? forms)
		  (loop-error ops forms "Missing '" oper "' expression."))
	      (set! expr (pop forms))
	      (values (make-loop-clause 'operator oper 'initially (list expr))
		      forms)))
	  
	  (define (lookup-collector var clauses)
	    ;; collector is list: (<var> <type> <acc> <head>)
	    ;; returns the clause where the collect variable VAR is
	    ;; actually bound or nil if var hasn't already been bound
	    ;; if var is nil only the single system allocated collecter
	    ;; is possibly returned.
	    (let ((checkthem (lambda (var lis)
			       (do ((a #f)) 
				   ((or (null? lis) a) a)
				 (if (eq? var (car (car lis))) ;collector-var
				     (set! a (car lis)))
				 (set! lis (cdr lis))))))
	      (do ((c #f))
		  ((or (null? clauses) c) c)
		(set! c (checkthem var (loop-collectors (car clauses))))
		(set! clauses (cdr clauses)))))
	  
	  (define (compatible-accumulation? typ1 typ2)
	    (let ((l1 '(collect append nconc))
		  (l2 '(never always))
		  (l3 '(minimize maximize)))
	      (or (eq? typ1 typ2)
		  (and (member typ1 l1) (member typ2 l1))
		  (and (member typ1 l2) (member typ2 l2))
		  (and (member typ1 l3) (member typ2 l3)))))
	  
	  (define (parse-accumulation forms clauses ops)
	    ;; forms is (<op> form ...)
	    ;; where <op> is collect append nconc
	    (let ((save forms)
		  (oper (pop forms))
		  (make-collector (lambda (var type acc head)
				    (list var type acc head)))
		  ;; removed because noop
		  ;;(collector-var (lambda (col) (car col)))
		  (collector-type (lambda (col) (cadr col)))
		  (collector-acc (lambda (col) (caddr col)))
		  (collector-head (lambda (col) (cadddr col)))
		  (expr #f)
		  (coll #f)
		  (new? #f)
		  (into #f)
		  (loop ())
		  (bind ())
		  (init ())
		  (tests ())
		  (return ()))
	      
	      (if (null? forms)
		  (loop-error ops forms "Missing '" oper "' expression."))
	      (set! expr (pop forms))
	      (if (not (null? forms))
		  (if (eq? (car forms) 'into)
		      (begin
			(if (null? (cdr forms))
			    (loop-error ops save "Missing 'into' variable."))
			(if (loop-variable? (cadr forms))
			    (begin (set! into (cadr forms))
				   (set! forms (cddr forms)))
			    (loop-error ops save "Found '" (car forms)
					"' where 'into' variable expected.")))))
	      
	      ;; search for a clause that already binds either the user specified
	      ;; accumulator (into) or a system allocated one if no into.
	      ;; system collectors
	      ;;   o only one  allowed, all accumuations must be compatible
	      ;;   o returns value
	      ;;   value collector: (nil <op> <#:acc>)
	      ;;   list collector:  (nil <op> <#:tail> <#:head>)
	      ;; into collectors
	      ;;   o any number allowed
	      ;;   o returns nothing.
	      ;;   value collector: (<into> <op> <into> )
	      ;;   list collector:  (<into> <op> <#:tail> <#:head>)
	      (set! coll (lookup-collector into clauses))
	      (if (not coll)
		  (set! new? #t)
		  ;; accumulator already established by earlier clause
		  ;; check to make sure clauses are compatible.
		  (if (not (compatible-accumulation? oper (collector-type coll)))
		      (loop-error ops save "'" (collector-type coll)
				  "' and '" oper "' are incompatible accumulators.")))
	      (case oper 
		((sum count)
		 (let ((acc #f))
		   (if new?
		       (begin 
			 (set! acc (or into (gensym "v")))
			 (push (make-binding acc 0) bind)
			 ;; coll= (nil <op> <#:acc>) or (<into> <op> <into>)
			 (set! coll (make-collector into oper acc #f))
			 ;; only add a return value if new collector isnt into
			 (if (not into) (push acc return)))
		       (set! acc (collector-acc coll)))
		   (if (eq? oper 'sum)
		       (push `(set! ,acc (+ ,acc ,expr)) loop)
		       (push `(if ,expr (set! ,acc (+ ,acc 1))) loop))))
		((minimize maximize)
		 (let ((var (gensym "v"))
		       (opr (if (eq? oper 'minimize) '< '>))
		       (acc #f))
		   (if new?
		       (begin
			 (set! acc (or into (gensym "v")))
			 (push (make-binding acc #f) bind)
			 ;; coll= (nil <op> <#:acc>) or (<into> <op> <into>)
			 (set! coll (make-collector into oper acc #f))
			 ;; only add a return value if new collector isnt into
			 (if (not into) (push `(or ,acc 0) return)))
		       (set! acc (collector-acc coll)))
		   (push (make-binding var #f) bind)
		   (push `(begin (set! ,var ,expr)
				 (if (or (not ,acc) 
					 (,opr ,var ,acc))
				     (set! ,acc ,var)))
			 loop)))
		((append collect nconc)
		 ;; for list accumulation a pointer to the tail of the list
		 ;; is updated and the head of the list is returned. any
		 ;; into variable is set to the head inside the loop.
		 (let ((head #f)
		       (tail #f))
		   (if (not new?)
		       (begin (set! tail (collector-acc coll))
			      (set! head (collector-head coll)))
		       (begin
			 (if into (push (make-binding into '(list)) bind))
			 (set! tail (gensym "v"))
			 ;; allocate a pointer to the head of list
			 (set! head (gensym "v"))
			 (push (make-binding head '(list #f)) bind)
			 (push (make-binding tail #f) bind)
			 ;; initialize tail to head
			 (push `(set! ,tail ,head) init)
			 (set! coll (make-collector into oper tail head))
			 ;; only add a return value if new collector isnt into
			 (if (not into)
			     (push `(cdr ,head) return))))
		   ;; add loop accumulation forms
		   (if (eq? oper 'append)
		       (begin
			 (push `(set-cdr! ,tail (append ,expr (list))) loop)
			 (push `(set! ,tail (last-pair ,tail)) loop))
		       (if (eq? oper 'collect)
			   (begin
			     (push `(set-cdr! ,tail (list ,expr)) loop)
			     (push `(set! ,tail (cdr ,tail)) loop))
			   (begin 
			     (push `(set-cdr! ,tail ,expr) loop)
			     (push `(set! ,tail (last-pair ,tail)) loop))))
		   ;; update user into variable inside the main loop
		   ;; regardless of whether its a new collector or not
		   (if into
		       (push `(set! ,into (cdr ,head)) loop)))))
	      
	      (values (make-loop-clause 'operator oper
					'bindings (reverse bind)
					'initially (reverse init)
					'looping (reverse loop)
					'returning (reverse return)
					'collectors (if new? (list coll) ())
					'end-tests (reverse tests))
		      forms)))
	  
					;(define (loop-stop expr)
					;  `(%done% ,expr))
	  
	  (define (loop-return expr)
	    `(return ,expr))
	  
	  (define (parse-while-until forms clauses ops)
	    ;; (bil) clauses
	    (let ((head forms)
		  (oper (pop forms))
		  (test #f)
		  (stop '(go #t))) ; :done
	      (if (null? forms)
		  (loop-error ops head "Missing '" oper "' expression."))
	      
	      (case oper
		((until ) (set! test (pop forms)))
		((while ) (set! test `(not ,(pop forms)))))
	      ;; calls the DONE continuation.
	      (values (make-loop-clause 'operator oper
					'looping (list `(if ,test ,stop)))
		      forms)))
	  
	  (define (parse-thereis forms clauses ops)
	    ;; (bil) clauses
	    (let ((oper (car forms))
		  (expr #f)
		  (bool #f)
		  (func #f))
	      (if (null? (cdr forms))
		  (loop-error ops forms "Missing '" (car forms) "' expression." ))
	      (set! expr (cadr forms))
	      ;; fourth element of operator definition must be
	      ;; a function that returns the stop expression.
	      (set! func (cadddr (loop-op? oper ops) ))
	      
	      (case oper
		((thereis ) 
		 ;; return true as soon as expr is true or false at end
		 (set! bool #f))
		((always )
		 ;; return false as soon as expr is false, or true at end
		 (set! expr `(not ,expr))
		 (set! bool #t))
		((never )
		 ;; return false as soon as expr is true, or true at end
		 (set! bool #t)))
	      (set! forms (cddr forms))
	      ;; this calls the RETURN continuation
	      (values (make-loop-clause 'operator 'thereis
					'looping 
					(list `(if ,expr ,(func (not bool))))
					'returning 
					(list bool))
		      forms)))
	  
	  (define (parse-return forms clauses ops)
	    ;; (bil) clauses
	    (let ((oper (car forms))
		  (expr #f)
		  (func #f))
	      (if (null? (cdr forms))
		  (loop-error ops forms "Missing '" (car forms) "' expression."))
	      (set! expr (cadr forms))
	      (set! forms (cddr forms))
	      ;; fourth element of operator definition must be
	      ;; a function that returns the stop expression.
	      (set! func (cadddr (loop-op? oper ops) ))
	      ;; this calls the RETURN continuation
	      (values (make-loop-clause 'operator 'return
					'looping `(,(func expr)))
		      forms)))
	  
	  (define (legal-in-conditional? x ops)
	    ;; FIXED (member (loop-operator...))
	    (let ((op (loop-op? x ops)))
	      (if (and op 
		       (not (null? (cddr op)))
		       (eq? (caddr op) 'task)
		       (not (member (car op) '(thereis never always))))
		  op #f)))
	  
	  (define (parse-then-else-dependents forms clauses ops)
	    (let ((previous forms)
		  (stop? #f)
		  (parsed ()))
	      
	      (do ((op #f)
		   (clause #f)
		   (remains #f))
		  ((or (null? forms) stop?))
		(set! op (legal-in-conditional? (car forms) ops))
		(if (not op)
		    (loop-error ops previous "'" (car forms)
				"' is not conditional operator."))
					;(multiple-value-setq 
					; (clause remains)
					; ( (cadr op) forms (append clauses parsed) ops))
		(call-with-values
		    (lambda () ( (cadr op) forms (append clauses parsed) ops))
		  (lambda (a b) (set! clause a) (set! remains b)))
		
					;(format #t "~%after call clause=~s forms=~S" clause forms)      
		
		(set! parsed (append parsed (list clause)))
		(set! previous forms)
		(set! forms remains)
		
		(if (not (null? forms))
		    (if (eq? (car forms) 'and)
			(begin
			  (set! forms (cdr forms))
			  (if (null? forms)
			      (loop-error ops previous "Missing 'and' clause.")))
			(if (eq? (car forms) 'else)
			    (set! stop? #t)
			    (if (loop-op? (car forms) ops)
				(set! stop? #t))))))
	      (values parsed forms)))
	  
	  (define (parse-conditional forms clauses ops)
	    (let ((ops (cons '(else ) ops))
		  (save forms)
		  (oper (car forms))
		  (loop (list))  ; avoid () because of acl bug
		  (expr (list))
		  (then (list))
		  (else (list)))
	      (if (null? (cdr forms))
		  (loop-error ops save "Missing '" oper "' expression."))
	      (set! forms (cdr forms))
	      (set! expr (pop forms))
	      (if (null? forms)
		  (loop-error ops forms "Missing conditional clause."))
	      (if (eq? oper 'unless)
		  (set! expr (list 'not expr)))
	      (call-with-values
		  (lambda () (parse-then-else-dependents forms clauses ops))
		(lambda (a b)
		  (set! then a)
		  (set! forms b)))
	      
	      ;; combine dependant clauses if more than one
	      (if (not (null? (cdr then)))
		  (set! then (gather-clauses (list) then))
		  (set! then (car then)))
	      (loop-operator-set! then 'if)
	      
	      ;; this (if ...) is hacked so that it is a newly
	      ;; allocated list. otherwise acl and clisp have a
	      ;; nasty structure sharing problem.
	      (set! loop (list 'if expr 
			       (append `(begin ,@(loop-looping then)) (list))
			       #f))
	      (if (and (not (null? forms))
		       (eq? (car forms) 'else))
		  (begin
		    (set! forms (cdr forms))
		    (when (null? forms)
			  (loop-error ops save "Missing 'else' clause."))
		    (call-with-values 
			(lambda ()
			  (parse-then-else-dependents 
			   forms (append clauses (list then))
			   ops))
		      (lambda (a b) (set! else a) (set! forms b)))
		    (if (not (null? (cdr else)))
			(set! else (gather-clauses () else))
			(set! else (car else)))
		    (set-car! (cdddr loop) `(begin ,@(loop-looping else)))
		    ;; flush loop forms so we dont gather actions.
		    (loop-looping-set! then ())
		    (loop-looping-set! else ())
		    (set! then (gather-clauses 'if (list then else)))))
	      (loop-looping-set! then (list loop))
	      (values then forms)))
	  
	  (define (parse-clauses forms cond? ops)
	    (if (or (null? forms)
		    (not (symbol? (car forms))))
		(list (make-loop-clause 'operator 'do 'looping forms))
		(let ((op-type? (lambda (op type)
				  (and (not (null? (cddr op)))
				       (eq? (caddr op) type)))))
		  (let ((previous forms)
			(clauses ()))
		    (do ((op #f)
			 (clause #f)
			 (remains ())
			 (body ()) )
			((null? forms))
		      (if (and cond? (eq? (car forms) 'and))
			  (pop forms))
		      (set! op (loop-op? (car forms) ops))
		      (if (not op)
			  (loop-error ops previous "Found '" (car forms)
				      "' where operator expected."))
					;(multiple-value-setq (clause remains)
					;                     ((cadr op) forms clauses ops))
		      (call-with-values
			  (lambda () ( (cadr op) forms clauses ops))
			(lambda (a b)
			  (set! clause a)
			  (set! remains b)))
		      (if (op-type? op 'task)
			  (set! body op)
			  (if (op-type? op 'iter)
			      (if (not (null? body))
				  (loop-error ops previous "'" (car op)
					      "' clause cannot follow '"
					      (car body) "'."))))
		      (set! previous forms)
		      (set! forms remains)
		      (set! clauses (append clauses (list clause))))
		    clauses))))
	  
	  (define (parse-iteration caller forms ops)
	    (gather-clauses caller (parse-clauses forms () ops)))
	  
	  ;;
	  ;; loop implementation
	  ;;
	  
	  (define *loop-operators*
	    ;; each clause is (<op> <parser> <tag> . <whatever>)
	    (list (list 'with (function parse-with) #f)
		  (list 'initially (function parse-initially) #f)
		  (list 'repeat (function parse-repeat) 'iter)
		  (list 'for (function parse-for) 'iter
			(list 'from (function parse-numerical-for))
			(list 'downfrom (function parse-numerical-for))
			(list 'below (function parse-numerical-for))
			(list 'to (function parse-numerical-for))
			(list 'above (function parse-numerical-for))
			(list 'downto (function parse-numerical-for))
			(list 'in (function parse-sequence-iteration))
			(list 'on (function parse-sequence-iteration))
			(list 'across (function parse-sequence-iteration))
			(list '= (function parse-general-iteration)))
		  (list 'as (function parse-for) 'iter)
		  (list 'do (function parse-do) 'task)
		  (list 'collect (function parse-accumulation) 'task)
		  (list 'append (function parse-accumulation) 'task)
		  (list 'nconc (function parse-accumulation) 'task)
		  (list 'sum (function parse-accumulation) 'task)
		  (list 'count (function parse-accumulation) 'task)
		  (list 'minimize (function parse-accumulation) 'task)
		  (list 'maximize (function parse-accumulation) 'task)
		  (list 'thereis (function parse-thereis) 'task
			(function loop-return))
		  (list 'always (function parse-thereis) 'task
			(function loop-return))
		  (list 'never (function parse-thereis) 'task 
			(function loop-return))
		  (list 'return (function parse-return) 'task 
			(function loop-return))
		  (list 'while (function parse-while-until) #f )
		  (list 'until (function parse-while-until) #f )
		  (list 'when (function parse-conditional) 'task)
		  (list 'unless (function parse-conditional) 'task)
		  (list 'if (function parse-conditional) 'task)
		  (list 'finally (function parse-finally) #f)))
	  
	  ;;
	  ;; loop expansions for scheme and cltl2
	  ;;
	  
	  (define (scheme-loop forms)
	    (let ((name (gensym "v"))
		  (parsed (parse-iteration 'loop forms *loop-operators*))
		  (end-test ())
		  (done '(go #t))  ; :done
		  (return #f))
					;(write (list :parsed-> parsed))
	      ;; cltl2's loop needs a way to stop iteration from with the run
	      ;; block (the done form) and/or immediately return a value
	      ;; (the return form).  scheme doesnt have a block return or a
	      ;; go/tagbody mechanism these conditions are implemented using
	      ;; continuations.  The forms that done and return expand to are
	      ;; not hardwired into the code because this utility is also used
	      ;; by CM's 'process' macro. Instead, the done and return forms
	      ;; are returned by functions assocated with the relevant operator
	      ;; data. For example, the function that returns the return form
	      ;; is stored as the fourth element in the return operator data.
	      ;; and the done function is stored in the while and until op data.
	      
	      ;; the cadddr of the RETURN operator is a function that
	      ;; provides the form for immediately returning a value
	      ;; from the iteration.
	      
	      (let ((returnfn (cadddr (assoc 'return *loop-operators*))))
		(set! return (returnfn
			      (if (null? (loop-returning parsed))
				  #f
				  (car (loop-returning parsed))))))
	      
	      ;; combine any end-tests into a single IF expression
	      ;; that calls the (done) continuation if true. multiple
	      ;; tests are OR'ed togther
	      
	      (set! end-test
		    (let ((ends (loop-end-tests parsed)))
		      (if (null? ends)
			  ()
			  (list
			   `(if ,(if (null? (cdr ends))
				     (car ends)
				     (cons 'or ends))
				;;  calls the done continuation
				,done 
				#f)))))
	      `(let (,@ (loop-bindings parsed))
		 ,@(loop-initially parsed)
		 (call-with-exit
		  (lambda (return)     ; <- (return) returns from this lambda
		    (call-with-exit
		     (lambda (go)  ; <- (go #t) returns from this lambda
		       ;; a named let provides the actual looping mechanism.
		       ;; the various tests and actions may exit via the
		       ;; (done) or (return) continuations.
		       (let ,name () 
			    ,@end-test
			    ,@(loop-looping parsed)
			    ,@(loop-stepping parsed)
			    (,name))))
		    ;; this is the lexical point for (go #t) continuation.
		    ,@(loop-finally parsed)
		    ;; invoke the RETURN continuation with loop value or #f
		    ,return)))))
	  
	  
	  (scheme-loop args)))
      
      ;;
      ;; loop tests.
      ;;
      
      (test (loop for i below 10 collect i) '(0 1 2 3 4 5 6 7 8 9))
      (test (loop for i to 10 sum i) 55)
      (test (loop for i downto -10 count (even? i)) 6)
      (test (loop for x in '(0 1 2 3 4 5 6 7 8 9) by 'cddr collect x) '(0 2 4 6 8))
      (test (loop for x on '(0 1 2 3) by 'cddr collect x) '((0 1 2 3) (2 3)))
      (test (loop for x in '(0 1 2 3 4 5 6 7 8 9) thereis (= x 4)) #t)
      (test (loop for x in '(0 1 2 3 4 5 6 7 8 9) never (= x 4)) #f)
      (test (loop for x in '(0 1 2 3 4 5 6 7 8 9) never (= x 40)) #t)
      (test (loop for x in '(0 2 3 4 5 6 7 8 9) always (< x 40)) #t)
      (test (loop repeat 10 with x = 0 collect x do (set! x (+ x 1))) '(0 1 2 3 4 5 6 7 8 9))
      (test (loop repeat 10 for x = #t then (not x) collect x) '(#t #f #t #f #t #f #t #f #t #f))
      (test (loop repeat 10 count #t) 10)
      (test (loop repeat 10 count #f) 0)
      (test (loop for i to 10 collect i collect (* 2 i)) '(0 0 1 2 2 4 3 6 4 8 5 10 6 12 7 14 8 16 9 18 10 20))
      (test (loop for i from -10 to 10 by 2 nconc (list i (- i))) '(-10 10 -8 8 -6 6 -4 4 -2 2 0 0 2 -2 4 -4 6 -6 8 -8 10 -10))
      (test (loop for i from -10 downto 10 by -1 collect i) ())
      (test (loop for i downfrom 10 downto -10 by 2 collect i) '(10 8 6 4 2 0 -2 -4 -6 -8 -10))
      (test (loop for i from 10 to -10 by 1 collect i) ())
      (test (loop for i to 10 for j downfrom 10 collect i collect j) '(0 10 1 9 2 8 3 7 4 6 5 5 6 4 7 3 8 2 9 1 10 0))
      (test (loop for i below 0 collect i into foo finally (return foo)) ())
      (test (loop for i below 0 sum i into foo finally (return foo)) 0)
      (test (loop for i below 0 maximize i into foo finally (return foo)) #f)
      (test (loop with a and b = 'x and c = 2 repeat 10 for x = 1 then 'fred collect (list x a b c))
	    '((1 #f x 2) (fred #f x 2) (fred #f x 2) (fred #f x 2) (fred #f x 2) (fred #f x 2) (fred #f x 2) (fred #f x 2) (fred #f x 2) (fred #f x 2)))
      (test (loop for i across #(0 1 2 3) append (list i (expt 2 i))) '(0 1 1 2 2 4 3 8))
      (test (loop with a = 0 and b = -1 while (< a 10) sum a into foo do (set! a (+ a 1)) finally (return (list foo b))) '(45 -1))
      (test (loop for i from 0 until (> i 9) collect i) '(0 1 2 3 4 5 6 7 8 9))
      (test (loop for i from 0 while (< i 9) when (even? i) collect i) '(0 2 4 6 8))
      (test (loop with l = (list 0) for s in spec for k = s then (+ k s) do (push k l) finally (return l)) 'error)
      (test (loop with l = (list (encode-interval 'p 1)) for s in spec for k = (interval s) then (transpose k (interval s)) do (push k l) finally (return l)) 'error)
      ;; end loop

      ;; more macros from Rick's stuff
      (define-macro (dolist spec . body)	;; spec = (var list . return)
	(let ((v (gensym)))
	  `(do ((,v ,(cadr spec) (cdr ,v))
		(,(car spec) #f))
	       ((null? ,v) ,@(cddr spec))
	     (set! ,(car spec) (car ,v))
	     ,@body)))

      (test (let ((sum 0)) (dolist (v (list 1 2 3) sum) (set! sum (+ sum v)))) 6)
      
      (define-macro (dotimes spec . body)	;; spec = (var end . return)
	(let ((e (gensym))
	      (n (car spec)))
	  `(do ((,e ,(cadr spec))
		(,n 0 (+ ,n 1)))
	       ((>= ,n ,e) ,@(cddr spec))
	     ,@body)))

      (test (let ((sum 0)) (dotimes (i 3 sum) (set! sum (+ sum i)))) 3)
      
      (define-macro (do* spec end . body)
	`(let* (,@(map (lambda (var) (list (car var) (cadr var))) spec))
	   (do () ,end
	     ,@body
	     ,@(map (lambda (var) (if (pair? (cddr var))
				      `(set! ,(car var) ,(caddr var))
				      (values)))
		    spec))))

      (define (1+ x) (+ x 1))

      (test (let ((sum 0)) (do* ((i 0 (+ i 1)) (j i (+ i 1))) ((= i 3) sum) (set! sum (+ sum j)))) 5)
      (test (do* ((a 1 (+ a 1)) (b a)) ((> a 9) b)) 1)
      (test (let ((a 0)) (do* ((a 1 (+ a 1)) (b a)) ((> a 9) a)) a) 0)
      (test (do* ((i 0 (1+ i))) ((>= i 10) i)) 10)
      (test (do* ((i 0 (1+ j)) (j 0 (1+ i))) ((>= i 10) (+ i j))) 23)
      (test (let ((x ())) (do* ((i 0 (1+ i))) ((>= i 10) x) (set! x (cons i x)))) '(9 8 7 6 5 4 3 2 1 0))
      (test (call-with-exit (lambda (return) (do* ((i 0 (1+ i))) () (when (> i 10) (return i))))) 11)
      (test (do* ((i 0 (+ i 10))) ((> i -1) i) (error 'bad)) 0)
      (test (do* ((i 0 (1+ i)) (x ())) ((>= i 10) x) (set! x (cons 'a x))) '(a a a a a a a a a a))
      (test (let ((i 0)) (do* () ((>= i 10) i) (set! i (+ i 1)))) 10)
      (test (do* ((i 0 (1+ i))) ((> i 10) (values))) #<unspecified>)
      (test (+ 1 (do* ((i 0 (1+ i))) ((> i 10) (values i (1+ i))))) 24)
      (test (do* ((i 0 (1+ i))) ((> i 10) (set! i (+ i 1)) (set! i (+ i 1)) i)) 13)
      (test (do* ((i 0 (1+ i))) ((> i 10))) #t)
      (test (map (lambda (f) (f)) (let ((x ())) (do* ((i 0 (+ i 1))) ((= i 5) x) (set! x (cons (lambda () i) x))))) '(5 5 5 5 5))
      (test (do* ((lst (list 0 1 2 3 4 5 6 7 8 9) (cdr lst))
		  (elm (car lst) (and (pair? lst) (car lst)))
		  (n 0 (+ n (or elm 0))))
		 ((null? lst) n))
	    45)
      (test (do* ((lst (list 0 1 2 3 4 5 6 7 8 9) (cdr lst))
		  (elm (car lst) (and (pair? lst) (car lst)))
		  (n 0))
		 ((null? lst) n)
		 (set! n (+ n elm)))
	    45)
      (test (let ((vec (vector 0 1 2 3 4 5 6 7 8 9)))
	      (and (do* ((n #f)
			 (i 0 (+ i 1))
			 (j (- 9 i) (- 9 i)))
			((>= i j))
			(set! n (vec i))
			(set! (vec i) (vec j))
			(set! (vec j) n))
		   (equal? vec #(9 8 7 6 5 4 3 2 1 0))))
	    #t)

      (define-macro (fluid-let xexe . body)
	;; taken with changes from Teach Yourself Scheme
	(let ((xx (map car xexe))
	      (ee (map cadr xexe))
	      (old-xx (map (lambda (ig) (gensym)) xexe)))
	  `(let ,(map (lambda (old-x x) `(,old-x ,x)) 
		      old-xx xx)
	     (dynamic-wind
		 (lambda () #f)
		 (lambda ()
		   ,@(map (lambda (x e)
			    `(set! ,x ,e)) 
			  xx ee)
		   (let ()
		     ,@body))
		 (lambda ()
		   ,@(map (lambda (x old-x)
			    `(set! ,x ,old-x)) 
			  xx old-xx))))))
      
      (test (let ((x 32)
		  (y 0))
	      (define (gx) x)
	      (fluid-let ((x 12))
		(set! y (gx)))
	      (list x y))
	    '(32 12))
      
      (test (let ((x "hi")
		  (y 0)
		  (z '(1 2 3)))
	      (define (gx) (+ x z))
	      (fluid-let 
		  ((x 32) (z (+ 123 (car z))))
		(set! y (gx)))
	      (list x y z))
            '("hi" 156 (1 2 3)))
      
      (test (let ((x 32)
		  (y 0))
	      (define (gx) x)
	      (call-with-exit
	       (lambda (return)
		 (fluid-let ((x 12))
		   (set! y (gx))
		   (return))))
	      (list x y))
	    '(32 12))

      (test (let ((x 32)
		  (y 0))
	      (define (gx) x)
	      (let ((x 100))
		(fluid-let ((x 12))
		  (set! y (gx))))
	      (list x y))
	    '(32 32))
      ;; oops! fluid-let doesn't actually work

      ;; to make this work, use symbol->dynamic-value.  See also let-temporarily in stuff.scm.
      (test (let ((x 32)
		  (y 0))
	      (define (gx) (symbol->dynamic-value 'x))
	      (let ((x 100))
		(let ((x 12))   ; no need for fluid-let anymore
		  (set! y (gx))))
	      (list x y))
	    '(32 12))

      (test (let ((y 0)) 
	      (define (gx) (symbol->dynamic-value 'x)) 
	      (let ((x 100)) 
		(let ((x 12)) 
		  (set! y (gx)) 
		  (set! x 123))
		(list x y)))
	    '(100 12))

      ;; in CL: (defvar x 32) (let ((y 0)) (defun gx () x) (let ((x 12)) (setf y (gx))) (list x y)) -> '(32 12)
      ;;                      (let ((y 0)) (defun gx () x) (let ((x 100)) (let ((x 12)) (setf y (gx)))) (list x y)) -> '(32 12)
      ;;                      (let ((y 0)) (defun gx () x) (let ((x 100)) (let ((x 12)) (setf y (gx)) (setf x 123)) (list x y))) -> '(100 12) !
      ;; (the defvar makes x dynamic)
      
      ;; define** treats args before :optional as required args
      (define-macro (define** declarations . forms)
	(let ((name (car declarations))
	      (args (cdr declarations)))
	  (define (position thing lst count)
	    (if (or (null? lst)
		    (not (pair? (cdr lst))))
		#f
		(if (eq? thing (car lst))
		    count
		    (position thing (cdr lst) (+ count 1)))))
	  (define (no-opt old-args new-args)
	    (if (null? old-args)
		(reverse new-args)
		(no-opt (cdr old-args)
			(if (eq? (car old-args) :optional)
			    new-args
			    (cons (car old-args) new-args)))))
	  (let ((required-args (position :optional args 0)))
	    (if required-args
		`(define* (,name . func-args)
		   (if (< (length func-args) ,required-args)
		       (error 'syntax-error 
			      "~A requires ~D argument~A: ~A" 
			      ',name ,required-args (if (> ,required-args 1) "s" "") func-args)
		       (apply (lambda* ,(no-opt args ()) ,@forms) func-args)))
		`(define* ,declarations ,@forms)))))

      (let ()
	(define** (f1 a :optional b) (+ a (or b 1)))
	(test (f1 1) 2)
	(test (f1 1 2) 3)
	(test (f1) 'error))

      ;; Rick's with-optkeys

      (define-macro (with-optkeys spec . body)
	(
	 (lambda (user rawspec body)
	   
	   (define (string->keyword str) (symbol->keyword (string->symbol str)))
	   
	   (define (key-parse-clause info mode args argn user)
	     ;; return a cond clause that parses one keyword. info for each
	     ;; var is: (<got> <var> <val>)
	     (let* ((got (car info))
		    (var (cadr info))
		    (key (string->keyword (symbol->string var))))
	       `((eq? (car ,args) ,key )
		 (if ,got (error 'syntax-error "duplicate keyword: ~S" , key))
		 (set! ,var (if (null? (cdr ,args))
				(error 'syntax-error "missing value for keyword: ~S" 
				       , user)
				(cadr ,args)))
		 (set! ,got #t) ; mark that we have a value for this param
		 (set! ,mode #t) ; mark that we are now parsing keywords
		 (set! ,argn (+ ,argn 1))
		 (set! ,args (cddr ,args)))))
	   
	   (define (pos-parse-clause info mode args argn I)
	     ;; return a cond clause that parses one positional. info for
	     ;; each var is: (<got> <var> <val>)
	     (let ((got (car info))
		   (var (cadr info)))
	       `((= ,argn ,I)
		 (set! ,var (car ,args))
		 (set! ,got #t) ; mark that we have a value for this param
		 (set! ,argn (+ ,argn 1))
		 (set! ,args (cdr ,args)))))
	   
	   (let* ((otherkeys? (member '&allow-other-keys rawspec))
		  ;; remove &allow-other-keys from spec
		  (spec (if otherkeys? (reverse (cdr (reverse rawspec))) rawspec))
		  (data (map (lambda (v)
			       ;; for each optkey variable v return a list
			       ;; (<got> <var> <val>) where the <got>
			       ;; variable indicates that <var> has been
			       ;; set, <var> is the optkey variable itself
			       ;; and <val> is its default value
			       (if (pair? v)
				   (cons (gensym (symbol->string (car v))) v)
				   (list (gensym (symbol->string v)) v #f)))
			     spec))
		  (args (gensym "args")) ; holds arg data as its parsed
		  (argn (gensym "argn"))
		  (SIZE (length data))
		  (mode (gensym "keyp")) ; true if parsing keywords
		  ;; keyc are cond clauses that parse valid keyword
		  (keyc (map (lambda (d) (key-parse-clause d mode args argn user))
			     data))
		  (posc (let lup ((tail data) (I 0))
			  (if (null? tail) (list)
			      (cons (pos-parse-clause (car tail) mode args argn I)
				    (lup (cdr tail) (+ I 1))))))
		  (bindings (map cdr data)) ; optkey variable bindings
		  )
	     
	     (if otherkeys?
		 (set! bindings (cons '(&allow-other-keys (list)) bindings)))
	     
	     `(let* ,bindings ; bind all the optkey variables with default values
		;; bind status and parsing vars
		(let ,(append (map (lambda (i) (list (car i) #f)) data)
			      `((,args ,user)
				(,argn 0)
				(,mode #f)))
		  ;; iterate arglist and set opt/key values
		  (do ()
		      ((null? ,args) #f)
		    (cond 
		     ;; add valid keyword clauses first
		     ,@ keyc
			;; a keyword in (car args) is now either added to
			;; &allow-other-keys or an error
			, (if otherkeys?
			      `((keyword? (car ,args))
				(if (not (pair? (cdr ,args)))
				    (error 'syntax-error "missing value for keyword ~S" (car ,args)))
				(set! &allow-other-keys (append &allow-other-keys
								(list (car ,args)
								      (cadr ,args))))
				(set! ,mode #t) ; parsing keys now...
				(set! ,args (cddr ,args)) )
			      `((keyword? (car ,args)) ;(and ,mode (keyword? (car ,args)))
				(error 'syntax-error "invalid keyword: ~S" (car ,args)) )
			      )
			  ;; positional clauses illegal if keywords have happened
			  (,mode (error 'syntax-error "positional after keywords: ~S" (car ,args)))
			  ;; too many value specified
			  ((not (< ,argn ,SIZE)) (error 'wrong-number-of-args "too many args: ~S" , args))
			  ;; add the valid positional clauses
			  ,@ posc
			     ))
		  ,@ body))
	     ))
	 (car spec)
	 (cdr spec)
	 body
	 ))
      
      (test (let ((args '(1 2 3)))  (with-optkeys (args a b c) (list a b c))) '(1 2 3))
      (test (let ((args '(1 2 3 4)))  (with-optkeys (args a b c) (list a b c))) 'error)
      (test (let ((args '(1 2))) (with-optkeys (args a b (c 33)) (list a b c))) '(1 2 33))
      (test (let ((args ())) (with-optkeys (args a b (c 33)) (list a b c))) '(#f #f 33))
      (test (let ((args '(:b 22))) (with-optkeys (args a b (c 33)) (list a b c))) '(#f 22 33))
      (test (let ((args '(-1 :z 22))) (with-optkeys (args a b (c 33)) (list a b c))) 'error)
      (test (let ((args '(:b 99 :z 22))) (with-optkeys (args a b (c 33)) (list a b c))) 'error)
      (test (let ((args '(:z 22))) (with-optkeys (args a b (c 33) &allow-other-keys) (list a b c &allow-other-keys))) '(#f #f 33 (:z 22)))
      (test (let ((args '(:id "0" :inst "flute" :name "Flute"))) (with-optkeys (args id inst &allow-other-keys) (list id inst &allow-other-keys))) '("0" "flute" (:name "Flute")))
      (test (let ((args '(:inst "flute" :id "0" :name "Flute"))) (with-optkeys (args id inst &allow-other-keys) (list id inst &allow-other-keys))) '("0" "flute" (:name "Flute")))
      (test (let ((args '(:id "0" :name "Flute" :inst "flute"))) (with-optkeys (args id inst &allow-other-keys) (list id inst &allow-other-keys))) '("0" "flute" (:name "Flute")))
      (test (let ((args '(:name "Flute" :inst "flute" :id "0"))) (with-optkeys (args id inst &allow-other-keys) (list id inst &allow-other-keys))) '("0" "flute" (:name "Flute")))
      
      
      (let ()
	
	;; some common lispisms
	;;   where names are the same, but functions are different (abs for example), 
	;;   I'll prepend "cl-" to the CL version; otherwise we end up redefining
	;;   map and member, for example, which can only cause confusion.
	;;
	;; also I'm omitting the test-if-not and test-not args which strike me as ridiculous.
	;; If CLtL2 says something is deprecated, it's not included.
	;; Series and generators are ignored.
	;;
	;;  ... later ... I've run out of gas.
	
					;(define-macro (progn . body) `(let () ,@body))
	(define (null obj) (or (not obj) (null? obj)))
	(define t #t)
	(define nil ())

	(define eq eq?)
	(define eql eqv?)
	(define equal equal?)
	(define (equalp x y)
	  (or (equal x y)
	      (and (char? x) (char? y) (char-ci=? x y))
	      (and (number? x) (number? y) (= x y))
	      (and (string? x) (string? y) (string-ci=? x y))))

	(define (identity x) x)
	(define (complement fn) (lambda args (not (apply fn args))))

	;; -------- numbers

	(define (conjugate z) (complex (real-part z) (- (imag-part z))))
	(define zerop zero?)
	(define oddp odd?)
	(define evenp even?)
	(define plusp positive?)
	(define minusp negative?)
	(define realpart real-part)
	(define imagpart imag-part)
	(define* (float x ignore) (* 1.0 x))
	(define rational rationalize)
	(define mod modulo)
	(define rem remainder)

	(define (logtest i1 i2) (not (zero? (logand i1 i2))))
	(define (logbitp index integer) (logbit? integer index)) ;(logtest (expt 2 index) integer))
	(define (lognand n1 n2) (lognot (logand n1 n2)))
	(define (lognor n1 n2) (lognot (logior n1 n2)))
	(define (logandc1 n1 n2) (logand (lognot n1) n2))
	(define (logandc2 n1 n2) (logand n1 (lognot n2)))
	(define (logorc1 n1 n2) (logior (lognot n1) n2))
	(define (logorc2 n1 n2) (logior n1 (logior n2)))
	(define (logeqv . ints) (lognot (apply logxor ints)))

	;; from slib
	(define (logcount n)
	  (define bitwise-bit-count
	    (letrec ((logcnt (lambda (n tot)
			       (if (zero? n)
				   tot
				   (logcnt (quotient n 16)
					   (+ (vector-ref
					       #(0 1 1 2 1 2 2 3 1 2 2 3 2 3 3 4)
					       (modulo n 16))
					      tot))))))
	      (lambda (n)
		(cond ((negative? n) (lognot (logcnt (lognot n) 0)))
		      ((positive? n) (logcnt n 0))
		      (else 0)))))
	  (cond ((negative? n) (bitwise-bit-count (lognot n)))
		(else (bitwise-bit-count n))))

	(define-constant boole-clr 0)
	(define-constant boole-set 1)
	(define-constant boole-1 2)
	(define-constant boole-2 3)
	(define-constant boole-c1 4)
	(define-constant boole-c2 5)
	(define-constant boole-and 6)
	(define-constant boole-ior 7)
	(define-constant boole-xor 8)
	(define-constant boole-eqv 9)
	(define-constant boole-nand 10)
	(define-constant boole-nor 11)
	(define-constant boole-andc1 12)
	(define-constant boole-andc2 13)
	(define-constant boole-orc1 14)
	(define-constant boole-orc2 15)

	(define (boole op int1 int2)
	  (cond
	    ((= op boole-clr)   0)
	    ((= op boole-set)   -1) ;; all ones -- "always 1" is misleading
	    ((= op boole-1)     int1)
	    ((= op boole-2)     int2)
	    ((= op boole-c1)    (lognot int1))
	    ((= op boole-c2)    (lognot int2))
	    ((= op boole-and)   (logand int1 int2))
	    ((= op boole-ior)   (logior int1 int2))
	    ((= op boole-xor)   (logxor int1 int2))
	    ((= op boole-eqv)   (logeqv int1 int2))
	    ((= op boole-nand)  (lognot (logand int1 int2)))
	    ((= op boole-nor)   (lognot (logior int1 int2)))
	    ((= op boole-andc1) (logand (lognot int1) int2))
	    ((= op boole-andc2) (logand int1 (lognot int2)))
	    ((= op boole-orc1)  (logior (lognot int1) int2))
	    ((= op boole-orc2)  (logior int1 (lognot int2)))))

	;; from Rick
	(define (byte siz pos)
	  ;; cache size, position and mask.
	  (list siz pos (ash (- (ash 1 siz) 1) pos)))

	(define byte-size car)
	(define byte-position cadr)
	(define byte-mask caddr)

	(define (ldb bytespec integer)
	  (ash (logand integer (byte-mask bytespec))
	       (- (byte-position bytespec))))

	(define (dpb integer bytespec into)
	  (logior (ash (logand integer (- (ash 1 (byte-size bytespec)) 1)) (byte-position bytespec))
		  (logand into (lognot (byte-mask bytespec)))))

	(define (ldb-test byte int) (not (zero? (ldb byte int))))
	(define (mask-field byte int) (logand int (dpb -1 byte 0)))
	(define (deposit-field byte spec int) (logior (logand byte (byte-mask spec)) (logand int (lognot (byte-mask spec)))))
	(define (scale-float x k) (* x (expt 2.0 k)))
	
	;; from clisp -- can't see any point to most of these
	(define-constant double-float-epsilon 1.1102230246251568e-16)
	(define-constant double-float-negative-epsilon 5.551115123125784e-17)
	(define-constant least-negative-double-float -2.2250738585072014e-308)
	(define-constant least-negative-long-float -5.676615526003731344e-646456994)
	(define-constant least-negative-normalized-double-float -2.2250738585072014e-308)
	(define-constant least-negative-normalized-long-float -5.676615526003731344e-646456994)
	(define-constant least-negative-normalized-short-float -1.1755e-38)
	(define-constant least-negative-normalized-single-float -1.1754944e-38)
	(define-constant least-negative-short-float -1.1755e-38)
	(define-constant least-negative-single-float -1.1754944e-38)
	(define-constant least-positive-double-float 2.2250738585072014e-308)
	(define-constant least-positive-long-float 5.676615526003731344e-646456994)
	(define-constant least-positive-normalized-double-float 2.2250738585072014e-308)
	(define-constant least-positive-normalized-long-float 5.676615526003731344e-646456994)
	(define-constant least-positive-normalized-short-float 1.1755e-38)
	(define-constant least-positive-normalized-single-float 1.1754944e-38)
	(define-constant least-positive-short-float 1.1755e-38)
	(define-constant least-positive-single-float 1.1754944e-38)
	(define-constant long-float-epsilon 5.4210108624275221706e-20)
	(define-constant long-float-negative-epsilon 2.7105054312137610853e-20)
	(define-constant most-negative-double-float -1.7976931348623157e308)
	;; most-negative-fixnum 
	(define-constant most-negative-long-float -8.8080652584198167656e646456992) 
	(define-constant most-negative-short-float -3.4028e38)
	(define-constant most-negative-single-float -3.4028235e38)
	(define-constant most-positive-double-float 1.7976931348623157e308)
	;; most-positive-fixnum 
	(define-constant most-positive-long-float 8.8080652584198167656e646456992)
	(define-constant most-positive-short-float 3.4028e38)
	(define-constant most-positive-single-float 3.4028235e38)
	(define-constant short-float-epsilon 7.6295e-6)
	(define-constant short-float-negative-epsilon 3.81476e-6)
	(define-constant single-float-epsilon 5.960465e-8)
	(define-constant single-float-negative-epsilon 2.9802326e-8)

	(define (lisp-implementation-type) "s7")
	(define lisp-implementation-version s7-version)
	(define (software-type) "s7")
	(define software-version s7-version)

	(define (machine-version)
	  (if (and (defined? 'file-exists?)
                   (file-exists? "/proc/cpuinfo"))
	      (call-with-input-file "/proc/cpuinfo"
		(lambda (cpufile)
		  (do ((line (read-line cpufile) (read-line cpufile)))
		      ((or (eof-object? line)
			   (string=? (substring line 0 10) "model name"))
		       (if (string? line)
			   (string-trim " " (substring line (+ 1 (position #\: line))))
			   "unknown")))))
	      "unknown"))
	
	;; = < <= > >= are the same, also min max + - * / lcm gcd exp expt log sqrt
	;; sin cos tan acos asin atan pi sinh cosh tanh asinh acosh atanh
	;; numerator denominator logior logxor logand ash integer-length random

	;; slightly different: floor ceiling truncate round and the ff cases thereof
	;; abs of complex -> magnitude
	(define (cl-abs x) (if (not (zero? (imag-part x))) (magnitude x) (abs x)))

	;; these actually return multiple values
	(define* (cl-floor x (divisor 1)) (floor (/ x divisor)))
	(define* (cl-ceiling x (divisor 1)) (ceiling (/ x divisor)))
	(define* (cl-truncate x (divisor 1)) (truncate (/ x divisor)))
	(define* (cl-round x (divisor 1)) (round (/ x divisor)))
	(define* (ffloor x divisor) (* 1.0 (cl-floor x divisor)))
	(define* (fceling x divisor) (* 1.0 (cl-ceiling x divisor)))
	(define* (ftruncate x divisor) (* 1.0 (cl-truncate x divisor)))
	(define* (fround x divisor) (* 1.0 (cl-round x divisor)))
       
	(define (/= . args) 
	  (if (null? (cdr args))
	      #t 
	      (if (member (car args) (cdr args))
		  #f
		  (apply /= (cdr args)))))

	(define (1- x) (- x 1))
	(define (isqrt x) (floor (sqrt x)))
	(define phase angle)
	(define* (cl-complex rl (im 0.0)) (#_complex rl im))
	(define (signum x) (if (zerop x) x (/ x (abs x))))
	(define (cis x) (exp (cl-complex 0.0 x)))


	;; -------- characters

	(define char-code-limit 256)
	(define alpha-char-p char-alphabetic?)
	(define upper-case-p char-upper-case?)
	(define lower-case-p char-lower-case?)
	(define* (digit-char-p c (radix 10)) (string->number (string c) radix))
	(define (alphanumericp c) (or (char-alphabetic? c) (char-numeric? c)))

	(define* (char= . args) (or (< (length args) 2) (apply char=? args)))
	(define* (char< . args) (or (< (length args) 2) (apply char<? args)))
	(define* (char<= . args) (or (< (length args) 2) (apply char<=? args)))
	(define* (char> . args) (or (< (length args) 2) (apply char>? args)))
	(define* (char>= . args) (or (< (length args) 2) (apply char>=? args)))
	(define* (char-equal . args) (or (< (length args) 2) (apply char-ci=? args)))
	(define* (char-lessp . args) (or (< (length args) 2) (apply char-ci<? args)))
	(define* (char-greaterp . args) (or (< (length args) 2) (apply char-ci>? args)))
	(define* (char-not-lessp . args) (or (< (length args) 2) (apply char-ci>=? args)))
	(define* (char-not-greaterp . args) (or (< (length args) 2) (apply char-ci<=? args)))

	(define (char/= . args) 
	  (if (null? (cdr args))
	      #t 
	      (if (member (car args) (cdr args))
		  #f
		  (apply char/= (cdr args)))))

	(define (char-not-equal . args) 
	  (if (null? (cdr args))
	      #t 
	      (if (or (member (char-upcase (car args)) (cdr args))
		      (member (char-downcase (car args)) (cdr args)))
		  #f
		  (apply char-not-equal (cdr args)))))

	(define char-code char->integer)
	(define code-char integer->char)

	(define (character c) 
	  (if (char? c) 
	      c 
	      (if (integer? c)
		  (integer->char c)
		  (if (string? c)
		      (c 0)
		      (if (symbol? c)
			  ((symbol->string c) 0))))))

	;; char-upcase and char-downcase are ok
	(define char-int char->integer)
	(define int-char integer->char)

	(define* (digit-char w (radix 10))
	  (let ((str (number->string w radix)))
	    (and str (= (length str) 1) (str 0))))

	(define (both-case-p c) "unimplemented")
	(define (standard-char-p c) "unimplemented")
	(define (char-name c) "unimplemented")
	(define (name-char s) "unimplemented")

	;; --------

	(define terpri newline)


	;; -------- types

	(define vectorp vector?)
	(define simple-vector-p vector?)
	(define symbolp symbol?)
	(define (atom obj) (not (pair? obj)))
	(define consp pair?)
	(define (listp obj) (or (null? obj) (pair? obj)))
	(define numberp number?)
	(define integerp integer?)
	(define rationalp rational?)
	(define (floatp l) (and (number? l) (not (rational? l)) (zero? (imag-part l)))) ; clisp
	(define (complexp l) (and (complex? l) (not (real? l))))
	(define realp real?)
	(define characterp char?)
	(define stringp string?)
	(define simple-string-p string?)
	(define arrayp vector?)
	(define simple-bit-vector-p vector?)
	(define keywordp keyword?)
	(define functionp procedure?)

	(define symbol-value symbol->value)
	(define symbol-function symbol->value)
	(define fdefinition symbol->value)
	(define boundp defined?)
	(define fboundp defined?)
	(define (funcall fn . arguments) (apply fn arguments))
	(define-constant call-arguments-limit 65536)

	
	;; --------
	(define progn begin)
	(define-macro (prog1 first . body) (let ((result (gensym))) `(let ((,result ,first)) ,@body ,result)))
	(define-macro (prog2 first second . body) `(prog1 (progn ,first ,second) ,@body))

	(define-macro (the type form) form)
	(define-macro (defvar var . args) `(define ,var (or ,(and (not (null? args)) (car args)) #f)))

	(define-macro* (incf sym (inc 1))
	  `(set! ,sym (+ ,sym ,inc)))

	(define-macro* (decf sym (dec 1))
	  `(set! ,sym (- ,sym ,dec)))

	;; the simple version seems to work ok, but just for lafs:
	(define incf-b
	  (let ((arg (gensym))
		(inc (gensym))
		(name (gensym)))
	    (apply define-bacro* `((,name ,arg (,inc 1))
				   `(set! ,,arg (+ ,,arg ,,inc))))))

	(define-macro (push val sym) 
	  `(setf ,sym (cons ,val ,sym)))

	(define-macro (pop sym) 
	  (let ((v (gensym))) 
	    `(let ((,v (car ,sym))) 
	       (setf ,sym (cdr ,sym)) 
	       ,v)))

	(define-macro* (pushnew val sym (test equal?) (key identity))
	  (let ((g (gensym))
		(k (if (procedure? key) key identity))) ; can be explicit nil!
	    `(let ((,g ,val))
	       (if (null? (cl-member (,k ,g) ,sym ,test ,k))
		   (push ,g ,sym))
	       ,sym)))

	(define-macro (declare . args) #f)
	(define-macro (set a b) `(set! ,(symbol->value a) ,b))

	(define-macro (setf . pairs)
	  (if (not (even? (length pairs)))
	      (error 'syntax-error "setf has odd number of args"))
	  `(let () ,@(let ((var #f)) 
		       (map (lambda (p) 
			      (if var
				  (let ((val (if (pair? var)
						 (if (member (car var) '(aref svref elt char schar))
						     (list 'set! (cdr var) p)
						     (if (eq? (car var) 'car)
							 (list 'set-car! (cadr var) p)
							 (if (eq? (car var) 'cdr)
							     (list 'set-cdr! (cadr var) p)
							     (if (eq? (car var) 'nth)
								 (list 'set! (list (caddr var) (cadr var)) p)
								 (list 'set! var p)
								 ))))
						 (list 'set! var p))))
				    (set! var #f)
				    val)
				  (begin
				    (set! var p)
				    ())))
			    pairs))))

	(define-macro (setq . pairs)
	  (if (not (even? (length pairs)))
	      (error 'syntax-error "setq has odd number of args"))
	  `(let () ,@(let ((var #f)) 
		       (map (lambda (p) 
			      (if var
				  (let ((val (list 'set! var p)))
				    (set! var #f)
				    val)
				  (begin
				    (set! var p)
				    ())))
			    pairs))))

	(define-macro (psetq . pairs)
	  (let ((vals ())
		(vars ()))
	    (do ((var-val pairs (cddr var-val)))
		((null? var-val))
	      (let ((interval (gensym)))
		(set! vals (cons (list interval (cadr var-val)) vals))
		(set! vars (cons (list 'set! (car var-val) interval) vars))))
	    `(let ,(reverse vals)
	       ,@vars)))

	(define (mapcar func . lists)
	  ;; not scheme's map because lists can be different lengths
	  ;; and args can be any sequence type (all mixed together)
	  (define (mapcar-seqs func seqs)
	    (if (null? seqs)
		()
		(cons (func (car seqs))
		      (mapcar-seqs func (cdr seqs)))))

	  (define (mapcar-1 index lens func seqs)
	    (if (member index lens)
		()
		(cons (apply func (mapcar-seqs (lambda (obj) (obj index)) seqs))
		      (mapcar-1 (+ index 1) lens func seqs))))

	  (let ((lens (map length lists)))
	    (mapcar-1 0 lens func lists)))

	;; (define (mapcar func . lists)
	;; not scheme's map because lists can be different lengths
	;; (if (member () lists) () (cons (apply func (map car lists)) (apply mapcar func (map cdr lists)))))

	(define (maplist function . lists)
	  (if (member () lists)
	      ()
	      (cons (apply function lists)
		    (apply maplist function (map cdr lists)))))

	(define (mapc function . lists)
	  (define (mapc-1 function . lists)
	    (if (not (member () lists))
		(begin
		  (apply function (map car lists))
		  (apply mapc-1 function (map cdr lists)))))
	  (apply mapc-1 function lists)
	  (car lists))

	(define (mapl function . lists)
	  (define (mapl-1 function . lists)
	    (if (not (member () lists))
		(begin
		  (apply function lists)
		  (apply mapl-1 function (map cdr lists)))))
	  (apply mapl-1 function lists)
	  (car lists))

	(define (mapcon function . lists)
	  (apply nconc (apply maplist function lists)))

	(define (mapcan function . lists)
	  (apply nconc (apply mapcar function lists)))
	  
	(define* (map-into result-sequence function . sequences)
	  (if (or (null? result-sequence)
		  (null? sequences))
	      result-sequence
	      (let* ((vals (apply mapcar function sequences))
		     (len (min (length vals) (length result-sequence))))
		(do ((i 0 (+ i 1)))
		    ((= i len))
		  (set! (result-sequence i) (vals i)))
		result-sequence)))


	(define input-stream-p input-port?)
	(define output-stream-p output-port?)


	;; -------- vectors
	
	;; vector is ok
	
	(define svref vector-ref)
	(define aref vector-ref)
        (define array-dimensions vector-dimensions) 
	(define array-total-size vector-length)
        (define (array-dimension array num) (list-ref (vector-dimensions array) num))

	(define-constant array-dimension-limit 16777215)
	(define-constant array-rank-limit 4096)
	(define-constant array-total-size-limit 16777215)

	(define* (make-array dimensions element-type initial-element initial-contents adjustable fill-pointer displaced-to displaced-index-offset)
	  (if (eq? element-type 'character)
	      (or (and initial-contents
		       (string-copy initial-contents))
		  (cl-make-string dimensions initial-element))
	      (make-vector (or dimensions 1) initial-element)))

	(define (array-in-bounds-p array . subscripts)
	  (define (in-bounds dims subs)
	    (or (null? subs)
		(null? dims)
		(and (< (car subs) (car dims))
		     (in-bounds (cdr dims) (cdr subs)))))
	  (in-bounds (vector-dimensions array) subscripts))

	(define (row-major-index array . subscripts) 
	  (apply + (maplist (lambda (x y)
			      (* (car x) (apply * (cdr y))))
			    subscripts
			    (vector-dimensions array))))


	;; -------- lists

	;; in CL (cdr ()) is nil

	(define (first l) (if (not (null? l)) (list-ref l 0) ()))
	(define (second l) (if (> (length l) 1) (list-ref l 1) ()))
	(define (third l) (if (> (length l) 2) (list-ref l 2) ()))
	(define (fourth l) (if (> (length l) 3) (list-ref l 3) ()))
	(define (fifth l) (if (> (length l) 4) (list-ref l 4) ()))
	(define (sixth l) (if (> (length l) 5) (list-ref l 5) ()))
	(define (seventh l) (if (> (length l) 6) (list-ref l 6) ()))
	(define (eighth l) (if (> (length l) 7) (list-ref l 7) ()))
	(define (ninth l) (if (> (length l) 8) (list-ref l 8) ()))
	(define (tenth l) (if (> (length l) 9) (list-ref l 9) ()))
	(define (nth n l) (if (< n (length l)) (list-ref l n) ()))
	(define (endp val) (if (null? val) #t (if (pair? val) #f (error 'wrong-type-arg "bad arg to endp"))))
	(define rest cdr)
	(define list-length length)
	(define* (cl-make-list size (initial-element ())) (make-list size initial-element))

	(define (copy-list lis) 
	  (if (not (pair? lis))
	      lis
	      (cons (car lis) (copy-list (cdr lis)))))

	(define (rplaca x y) (set-car! x y) x)
	(define (rplacd x y) (set-cdr! x y) x)

	(define (copy-tree lis)
	  (if (pair? lis)
	      (cons (copy-tree (car lis))
		    (copy-tree (cdr lis)))
	      lis))

	(define* (butlast lis (n 1))
	  (let ((len (length lis)))
	    (if (<= len n)
		()
		(let ((result ()))
		  (do ((i 0 (+ i 1))
		       (lst lis (cdr lst)))
		      ((= i (- len n)) (reverse result))
		    (set! result (cons (car lst) result)))))))

	(define* (last lst (n 1))
	  (let ((len (length lst)))
	    (do ((i 0 (+ i 1))
		 (l lst (cdr l)))
		((or (null? l)
		     (>= i (- len n)))
		 l))))

	(define (nthcdr n lst) 
	  (do ((i n (- i 1)) 
	       (result lst (cdr result))) 
	      ((or (null? result) (zero? i)) result)))

	(define* (tree-equal a b (test eql)) 
	  (define (teq a b)
	    (if (not (pair? a))
		(and (not (pair? b))
		     (test a b))
		(and (pair? b)
		     (teq (car a) (car b))
		     (teq (cdr a) (cdr b)))))
	  (teq a b))

	(define (acons key datum alist) (cons (cons key datum) alist))

	(define (list* obj1 . objs)
	  (define (list-1 obj)
	    (if (null? (cdr obj))
		(car obj)
		(cons (car obj) (list-1 (cdr obj)))))
	  (if (null? objs)
	      obj1
	      (cons obj1 (list-1 objs))))

	(define* (assoc-if predicate alist (key car))
	  (if (null? alist)
	      ()
	      (if (and (not (null? (car alist)))
		       (predicate (key (car alist))))
		  (car alist)
		  (assoc-if predicate (cdr alist) key))))
	
	(define* (assoc-if-not predicate alist (key car))
	  (assoc-if (lambda (obj) (not (predicate obj))) alist key))

	(define* (cl-assoc item alist (test eql) (key car))
	  (assoc-if (lambda (obj) (test item obj)) alist key))
	
	(define* (rassoc-if predicate alist (key cdr))
	  (if (null? alist)
	      ()
	      (if (and (pair? (car alist))
		       (predicate (key (car alist))))
		  (car alist)
		  (rassoc-if predicate (cdr alist) key))))
	
	(define* (rassoc-if-not predicate alist (key cdr))
	  (rassoc-if (lambda (obj) (not (predicate obj))) alist key))

	(define* (rassoc item alist (test eql) (key cdr))
	  (rassoc-if (lambda (obj) (test item obj)) alist key))

	(define (copy-alist alist)
	  (if (null? alist)
	      ()
	      (cons (if (pair? (car alist))
			(cons (caar alist) (cdar alist))
			(car alist))
		    (copy-alist (cdr alist)))))

	(define (revappend x y) (append (reverse x) y))

	
	(define* (pairlis keys data alist)
	  (if (not (= (length keys) (length data)))
	      (error 'syntax-error "pairlis keys and data lists should have the same length"))
	  (let ((lst (or alist ())))
	    (if (null? keys)
		lst
		(do ((key keys (cdr key))
		     (datum data (cdr datum)))
		    ((null? key) lst)
		  (set! lst (cons (cons (car key) (car datum)) lst))))))

	(define* (sublis alist tree (test eql) (key car))
	  (let ((val (cl-assoc tree alist test key)))
	    (if (not (null? val))
		(cdr val)
		(if (not (pair? tree))
		    tree
		    (cons (sublis alist (car tree) test key)
			  (sublis alist (cdr tree) test key))))))

	(define* (nsublis alist tree (test eql) (key car)) ; sacla
	  (define (sub subtree)
	    (let ((ac (cl-assoc subtree alist test key)))
	      (if (not (null? ac))
		  (cdr ac)
		  (if (not (pair? subtree))
		      subtree
		      (let ()
			(set-car! subtree (sub (car subtree)))
			(set-cdr! subtree (sub (cdr subtree)))
			subtree)))))
	  (sub tree))

	(let ()
	  (define* (subst-if new test tree (key identity))
	    (if (test (key tree))
		new
		(if (not (pair? tree))
		    tree
		    (cons (subst-if new test (car tree) key)
			  (subst-if new test (cdr tree) key)))))
	  
	  (define* (subst-if-not new test tree (key identity))
	    (subst-if new (lambda (obj) (not (test obj))) tree key))
	  
	  (define* (subst new old tree (test eql) (key identity))
	    (subst-if new (lambda (obj) (test old obj)) tree key))
	  
	  (define* (nsubst-if new predicate tree (key identity)) ; sacla
	    (define (sub subtree)
	      (if (predicate (key subtree))
		  new
		  (if (not (pair? subtree))
		      subtree
		      (let ()
			(set-car! subtree (sub (car subtree)))
			(set-cdr! subtree (sub (cdr subtree)))
			subtree))))
	    (sub tree))
	  
	  (define* (nsubst-if-not new predicate tree (key identity))
	    (nsubst-if new (lambda (obj) (not (predicate obj))) tree key))
	  
	  (define* (nsubst new old tree (test eql) (key identity))
	    (nsubst-if new (lambda (obj) (test old obj)) tree key))
	  
	  (test-t (let ((tree '(old (old) ((old))))) (equal (subst 'new 'old tree) '(new (new) ((new))))))
	  (test-t (eq (subst 'new 'old 'old) 'new))
	  (test-t (eq (subst 'new 'old 'not-old) 'not-old))
	  (test-t (equal (subst 'new '(b) '(a ((b))) :test equal) '(a (new))))
	  (test-t (equal (subst 'x 3 '(1 (1 2) (1 2 3) (1 2 3 4)) :key (lambda (y) (and (listp y) (third y)))) '(1 (1 2) x x)))
	  (test-t (equal (subst 'x "D" '("a" ("a" "b") ("a" "b" "c") ("a" "b" "c" "d"))
				:test equalp
				:key (lambda (y) (and (listp y) (fourth y))))
			 '("a" ("a" "b") ("a" "b" "c") x)))
	  (test-t (equal (subst-if 'new (lambda (x) (eq x 'old)) '(old old)) '(new new)))
	  (test-t (eq (subst-if 'new (lambda (x) (eq x 'old)) 'old) 'new))
	  (test-t (equal (subst-if 'x (lambda (x) (eql x 3)) '(1 (1 2) (1 2 3) (1 2 3 4)) :key (lambda (y) (and (listp y) (third y)))) '(1 (1 2) x x)))
	  (test-t (let ((tree '(old (old) ((old))))) (equal (subst-if 'new (lambda (x) (eq x 'old)) tree) '(new (new) ((new))))))
	  (test-t (eq (subst-if 'new (lambda (x) (eq x 'old)) 'old) 'new))
	  (test-t (eq (subst-if 'new (lambda (x) (eq x 'old)) 'not-old) 'not-old))
	  (test-t (equal (subst-if 'new (lambda (x) (equal x '(b))) '(a ((b)))) '(a (new))))
	  (test-t (equal (subst-if 'x (lambda (x) (eql x 3)) '(1 (1 2) (1 2 3) (1 2 3 4)) :key (lambda (y) (and (listp y) (third y)))) '(1 (1 2) x x)))
	  (test-t (equal (subst-if 'x
				   (lambda (x) (equalp x "D"))
				   '("a" ("a" "b") ("a" "b" "c") ("a" "b" "c" "d"))
				   :key (lambda (y) (and (listp y) (fourth y))))
			 '("a" ("a" "b") ("a" "b" "c") x)))
	  (test-t (equal (subst-if-not 'new (lambda (x) (not (eq x 'old))) '(old old)) '(new new)))
	  (test-t (eq (subst-if-not 'new (lambda (x) (not (eq x 'old))) 'old) 'new))
	  (test-t (equal (subst-if-not 'x (lambda (x) (not (eql x 3)))
				       '(1 (1 2) (1 2 3) (1 2 3 4))
				       :key (lambda (y) (and (listp y) (third y))))
			 '(1 (1 2) x x)))
	  (test-t (let ((tree '(old (old) ((old)))))
		    (equal (subst-if-not 'new (lambda (x) (not (eq x 'old))) tree)
			   '(new (new) ((new))))))
	  (test-t (eq (subst-if-not 'new (lambda (x) (not (eq x 'old))) 'old) 'new))
	  (test-t (eq (subst-if-not 'new (lambda (x) (not (eq x 'old))) 'not-old) 'not-old))
	  (test-t (equal (subst-if-not 'new (lambda (x) (not (equal x '(b)))) '(a ((b)))) '(a (new))))
	  (test-t (equal (subst-if-not 'x
				       (lambda (x) (not (eql x 3)))
				       '(1 (1 2) (1 2 3) (1 2 3 4))
				       :key (lambda (y) (and (listp y) (third y))))
			 '(1 (1 2) x x)))
	  (test-t (equal (subst-if-not 'x
				       (lambda (x) (not (equalp x "D")))
				       '("a" ("a" "b") ("a" "b" "c") ("a" "b" "c" "d"))
				       :key (lambda (y) (and (listp y) (fourth y))))
			 '("a" ("a" "b") ("a" "b" "c") x)))
	  (test-t (let ((tree '(old (old) ((old)))))
		    (equal (nsubst 'new 'old (copy-tree tree))
			   '(new (new) ((new))))))
	  (test-t (let* ((tree (copy-tree '(old (old) ((old)))))
			 (new-tree (nsubst 'new 'old tree)))
		    (and (eq tree new-tree)
			 (equal tree '(new (new) ((new)))))))
	  (test-t (eq (nsubst 'new 'old 'old) 'new))
	  (test-t (eq (nsubst 'new 'old 'not-old) 'not-old))
	  (test-t (equal (nsubst 'new '(b) (copy-tree '(a ((b)))) :test equal) '(a (new))))
	  (test-t (equal (nsubst 'x 3 (copy-tree '(1 (1 2) (1 2 3) (1 2 3 4)))
				 :key (lambda (y) (and (listp y) (third y))))
			 '(1 (1 2) x x)))
	  (test-t (equal (nsubst 'x "D"
				 (copy-tree '("a" ("a" "b") ("a" "b" "c") ("a" "b" "c" "d")))
				 :test equalp
				 :key (lambda (y) (and (listp y) (fourth y))))
			 '("a" ("a" "b") ("a" "b" "c") x)))
	  (test-t (equal (nsubst-if 'new (lambda (x) (eq x 'old)) (list 'old 'old)) '(new new)))
	  (test-t (eq (nsubst-if 'new (lambda (x) (eq x 'old)) 'old) 'new))
	  (test-t (let* ((x (copy-tree '(old (old) ((old)) (old) old)))
			 (y (nsubst-if 'new (lambda (x) (eq x 'old)) x)))
		    (and (eq x y)
			 (equal x '(new (new) ((new)) (new) new)))))
	  (test-t (equal (nsubst-if 'x
				    (lambda (x) (eql x 3))
				    (copy-tree '(1 (1 2) (1 2 3) (1 2 3 4)))
				    :key (lambda (y) (and (listp y) (third y))))
			 '(1 (1 2) x x)))
	  (test-t (let ((tree '(old (old) ((old)))))
		    (equal (nsubst-if 'new (lambda (x) (eq x 'old)) (copy-tree tree))
			   '(new (new) ((new))))))
	  (test-t (eq (nsubst-if 'new (lambda (x) (eq x 'old)) 'old) 'new))
	  (test-t (eq (nsubst-if 'new (lambda (x) (eq x 'old)) 'not-old) 'not-old))
	  (test-t (equal (nsubst-if 'new (lambda (x) (equal x '(b))) (copy-tree '(a ((b))))) '(a (new))))
	  (test-t (equal (nsubst-if 'x
				    (lambda (x) (eql x 3))
				    (copy-tree '(1 (1 2) (1 2 3) (1 2 3 4)))
				    :key (lambda (y) (and (listp y) (third y))))
			 '(1 (1 2) x x)))
	  (test-t (equal (nsubst-if 'x
				    (lambda (x) (equalp x "D"))
				    (copy-tree '("a" ("a" "b") ("a" "b" "c") ("a" "b" "c" "d")))
				    :key (lambda (y) (and (listp y) (fourth y))))
			 '("a" ("a" "b") ("a" "b" "c") x)))
	  (test-t (equal (nsubst-if-not 'new (lambda (x) (not (eq x 'old)))
					(list 'old 'old))
			 '(new new)))
	  (test-t (eq (nsubst-if-not 'new (lambda (x) (not (eq x 'old))) 'old) 'new))
	  (test-t (let* ((x (copy-tree '(old (old) ((old)) (old) old)))
			 (y (nsubst-if-not 'new (lambda (x) (not (eq x 'old))) x)))
		    (and (eq x y)
			 (equal x '(new (new) ((new)) (new) new)))))
	  (test-t (equal (nsubst-if-not 'x (lambda (x) (not (eql x 3)))
					(copy-tree '(1 (1 2) (1 2 3) (1 2 3 4)))
					:key (lambda (y) (and (listp y) (third y))))
			 '(1 (1 2) x x)))
	  (test-t (let ((tree '(old (old) ((old)))))
		    (equal (nsubst-if-not 'new (lambda (x) (not (eq x 'old))) (copy-tree tree))
			   '(new (new) ((new))))))
	  (test-t (eq (nsubst-if-not 'new (lambda (x) (not (eq x 'old))) 'old) 'new))
	  (test-t (eq (nsubst-if-not 'new (lambda (x) (not (eq x 'old))) 'not-old) 'not-old))
	  (test-t (equal (nsubst-if-not 'new (lambda (x) (not (equal x '(b)))) (copy-tree '(a ((b))))) '(a (new))))
	  (test-t (equal (nsubst-if-not 'x
					(lambda (x) (not (eql x 3)))
					(copy-tree '(1 (1 2) (1 2 3) (1 2 3 4)))
					:key (lambda (y) (and (listp y) (third y))))
			 '(1 (1 2) x x)))
	  (test-t (equal
		   (nsubst-if-not 'x
				  (lambda (x) (not (equalp x "D")))
				  (copy-tree '("a" ("a" "b") ("a" "b" "c") ("a" "b" "c" "d")))
				  :key (lambda (y) (and (listp y) (fourth y))))
		   '("a" ("a" "b") ("a" "b" "c") x)))
	  )
	
	(define (ldiff lst object) ; sacla
	  (if (not (eqv? lst object))
	      (let* ((result (list (car lst)))
		     (splice result))
		(call-with-exit
		 (lambda (return)
		   (do ((l (cdr lst) (cdr l)))
		       ((not (pair? l))
			(if (eql l object) 
			    (set-cdr! splice ()))
			result)
		     (if (eqv? l object)
			 (return result)
			 (set! splice (cdr (rplacd splice (list (car l))))))))))
	      ()))
	
	(define* (member-if predicate list (key identity))
	  (if (null? list)
	      ()
	      (if (predicate (key (car list)))
		  list
		  (member-if predicate (cdr list) key))))

	(define* (member-if-not predicate list (key identity))
	  (member-if (lambda (obj) (not (predicate obj))) list key))

	(define* (cl-member item list (test eql) (key identity))
	  (if (null? list)
	      ()
	      (if (test item (key (car list)))
		  list
		  (cl-member item (cdr list) test key))))

	(define* (adjoin item list (test eql) (key identity))
	  (if (not (null? (cl-member (key item) list test key)))
	      list
	      (cons item list)))

	(define (tailp sublist list)
	  (or (eq? sublist list)
	      (and (not (null? list))
		   (tailp sublist (cdr list)))))


	(define* (nbutlast list (n 1)) ; sacla
	  (if (null? list)
	      ()
	      (let ((length (do ((p (cdr list) (cdr p))
				 (i 1 (+ i 1)))
				((not (pair? p)) i))))
		(if (> length n)
		    (do ((1st (cdr list) (cdr 1st))
			 (2nd list 1st)
			 (count (- length n 1) (- count 1)))
			((zero? count) 
			 (set-cdr! 2nd ())
			 list))
		    ()))))

	(define (nconc . lists) ; sacla sort of
	  (let ((ls (let ()
		      (define (strip-nulls lst)
			(if (null? lst)
			    ()
			    (if (null? (car lst))
				(strip-nulls (cdr lst))
				lst)))
		      (strip-nulls lists))))
	    (if (null? ls)
		()
	      (let* ((top (car ls))
		     (splice top))
		(do ((here (cdr ls) (cdr here)))
		    ((null? here) top)
		  (set-cdr! (last splice) (car here))
		  (if (not (null? (car here)))
		      (set! splice (car here))))))))

	(define (nreconc x y) (nconc (nreverse x) y))




	;; -------- sequences

        (define-macro (with-iterator it . body)
          `(let ((,(car it) (let ((f (make-iterator ,(cadr it)))
				  (iterator? #t))
                              (lambda ()
                                (let ((val (f)))
                                  (and val (values #t (car val) (cdr val))))))))
             ,@body))
        (define hash-table-p hash-table?)
        (define* (gethash k h (d ())) (or (hash-table-ref k h) d))
        (define maphash map)
        (define clrhash fill!)
        (define hash-table-count hash-table-entries)

	(let ()
	  (define* (count-if predicate sequence from-end (start 0) end (key identity))
	    (let* ((counts 0)
		   (len (length sequence))
		   (nd (or (and (number? end) end) len))) ; up to but not including end
	      (if (< nd start)
		  (error 'out-of-range "count-if :start ~A is greater than ~A ~A" start (if end ":end" "length") nd))
	      (if (not from-end)
		  (do ((i start (+ i 1)))
		      ((= i nd))
		    (if (predicate (key (sequence i)))
			(set! counts (+ counts 1))))
		  (do ((i (- nd 1) (- i 1)))
		      ((< i start))
		    (if (predicate (key (sequence i)))
			(set! counts (+ counts 1)))))
	      counts))
	  
	  (define* (count-if-not predicate sequence from-end (start 0) end (key identity))
	    (count-if (lambda (obj) (not (predicate obj))) sequence from-end start end key))
	  
	  (define* (count item sequence from-end (test eql) (start 0) end (key identity))
	    (count-if (lambda (arg) (test item arg)) sequence from-end start end key))
	  
	  (test-t (eql (count-if-not oddp '((1) (2) (3) (4)) :key car) 2))
	  (test-t (eql (count-if upper-case-p "The Crying of Lot 49" :start 4) 2))
					;(test-t (eql (count #\a (concatenate 'list "how many A's are there in here?")) 2))
	  (test-t (eql (count-if alpha-char-p "-a-b-c-0-1-2-3-4-") 3))
	  (test-t (eql (count-if alphanumericp "-a-b-c-0-1-2-3-4-") 8))
	  (test-t (eql (count nil (list t nil t nil t nil)) 3))
	  (test-t (eql (count nil (vector t nil t nil t nil)) 3))
	  (test-t (zerop (count 9 '(0 1 2 3 4))))
	  (test-t (zerop (count 'a '(0 1 2 3 4))))
	  (test-t (eql (count 0 '(0 0 0 0 0) :start 1) 4))
	  (test-t (eql (count 0 '(0 0 0 0 0) :start 1 :end nil) 4))
	  (test-t (eql (count 0 '(0 0 0 0 0) :start 2) 3))
	  (test-t (zerop (count 0 '(0 0 0 0) :start 0 :end 0)))
	  (test-t (zerop (count 0 '(0 0 0 0) :start 2 :end 2)))
	  (test-t (zerop (count 0 '(0 0 0 0) :start 4 :end 4)))
	  (test-t (eql (count 0 '(0 0 0 0) :start 2 :end 3) 1))
	  (test-t (eql (count #\a "abcABC" :test equalp) 2))
	  (test-t (eql (count #\a "abcABC" :test char-equal) 2))
	  (test-t (eql (count '(a) '((x) (y) (z) (a) (b) (c)) :test equalp) 1))
	  (test-t (eql (count 'a '((x) (y) (z) (a) (b) (c)) :key car :test eq) 1))
	  (test-t (eql (count nil '((x . x) (y) (z . z) (a) (b . b) (c)) :key cdr :test eq) 3))
	  (test-t (let ((list nil))
		    (and (eql (count 'a '(a b c d)
				     :test (lambda (a b) (setq list (cons b list)) (eq a b)))
			      1)
			 (equal list '(d c b a)))))
	  (test-t (let ((list nil))
		    (and (eql (count 'a '(a b c d)
				     :test (lambda (a b) (setq list (cons b list)) (eq a b))
				     :from-end t)
			      1)
			 (equal list '(a b c d)))))
	  (test-t (zerop (count 9 #(0 1 2 3 4))))
	  (test-t (zerop (count 'a #(0 1 2 3 4))))
	  (test-t (eql (count 0 #(0 0 0 0 0) :start 1) 4))
	  (test-t (eql (count 0 #(0 0 0 0 0) :start 1 :end nil) 4))
	  (test-t (eql (count 0 #(0 0 0 0 0) :start 2) 3))
	  (test-t (zerop (count 0 #(0 0 0 0) :start 0 :end 0)))
	  (test-t (zerop (count 0 #(0 0 0 0) :start 2 :end 2)))
	  (test-t (zerop (count 0 #(0 0 0 0) :start 4 :end 4)))
	  (test-t (eql (count 0 #(0 0 0 0) :start 2 :end 3) 1))
	  (test-t (eql (count '(a) #((x) (y) (z) (a) (b) (c)) :test equalp) 1))
	  (test-t (eql (count 'a #((x) (y) (z) (a) (b) (c)) :key car :test eq) 1))
	  (test-t (eql (count nil #((x . x) (y) (z . z) (a) (b . b) (c)) :key cdr :test eq) 3))
	  (test-t (let ((list nil))
		    (and (eql (count 'a #(a b c d)
				     :test (lambda (a b) (setq list (cons b list)) (eq a b)))
			      1)
			 (equal list '(d c b a)))))
	  (test-t (let ((list nil))
		    (and (eql (count 'a #(a b c d)
				     :test (lambda (a b) (setq list (cons b list)) (eq a b))
				     :from-end t)
			      1)
			 (equal list '(a b c d)))))
	  (test-t (eql (count-if null (list t nil t nil t nil)) 3))
	  (test-t (zerop (count-if (lambda (x) (eql x 9)) #(0 1 2 3 4))))
	  (test-t (zerop (count-if (lambda (a) (eq 'x a)) #(0 1 2 3 4))))
	  (test-t (eql (count-if zerop '(0 0 0 0 0) :start 1) 4))
	  (test-t (eql (count-if zerop '(0 0 0 0 0) :start 1 :end nil) 4))
	  (test-t (eql (count-if zerop '(0 0 0 0 0) :start 2) 3))
	  (test-t (zerop (count-if zerop '(0 0 0 0) :start 0 :end 0)))
	  (test-t (zerop (count-if zerop '(0 0 0 0) :start 2 :end 2)))
	  (test-t (zerop (count-if zerop '(0 0 0 0) :start 4 :end 4)))
	  (test-t (eql (count-if zerop '(0 0 0 0) :start 2 :end 3) 1))
	  (test-t (eql (count-if (lambda (x) (equalp #\a x)) "abcABC") 2))
	  (test-t (eql (count-if (lambda (x) (char-equal #\a x)) "abcABC") 2))
	  (test-t (eql (count-if (lambda (x) (equal x '(a))) '((x) (y) (z) (a) (b) (c))) 1))
	  (test-t (eql (count-if (lambda (x) (eq x 'a)) '((x) (y) (z) (a) (b) (c)) :key car) 1))
	  (test-t (eql (count-if null '((x . x) (y) (z . z) (a) (b . b) (c)) :key cdr) 3))
	  (test-t (eql (count-if (lambda (x) (equal x '(a))) '((x) (y) (z) (a) (b) (c))) 1))
	  (test-t (eql (count-if (lambda (x) (eq x 'a)) '((x) (y) (z) (a) (b) (c)) :key car) 1))
	  (test-t (eql (count-if null '((x . x) (y) (z . z) (a) (b . b) (c)) :key cdr) 3))
	  (test-t (let ((list nil))
		    (and (eql (count-if (lambda (x) (setq list (cons x list)) (eq x 'a))
					'(a b c d))
			      1)
			 (equal list '(d c b a)))))
	  (test-t (let ((list nil))
		    (and (eql (count-if (lambda (x) (setq list (cons x list)) (eq x 'a))
					'(a b c d)
					:from-end t)
			      1)
			 (equal list '(a b c d)))))
	  (test-t (eql (count-if null (vector t nil t nil t nil)) 3))
	  (test-t (eql (count-if zerop #(0 0 0 0 0) :start 1) 4))
	  (test-t (eql (count-if zerop #(0 0 0 0 0) :start 1 :end nil) 4))
	  (test-t (eql (count-if zerop #(0 0 0 0 0) :start 2) 3))
	  (test-t (zerop (count-if zerop #(0 0 0 0) :start 0 :end 0)))
	  (test-t (zerop (count-if zerop #(0 0 0 0) :start 2 :end 2)))
	  (test-t (zerop (count-if zerop #(0 0 0 0) :start 4 :end 4)))
	  (test-t (eql (count-if zerop #(0 0 0 0) :start 2 :end 3) 1))
	  (test-t (eql (count-if (lambda (x) (equal x '(a))) #((x) (y) (z) (a) (b) (c))) 1))
	  (test-t (eql (count-if (lambda (x) (eq x 'a)) #((x) (y) (z) (a) (b) (c)) :key car) 1))
	  (test-t (eql (count-if null #((x . x) (y) (z . z) (a) (b . b) (c)) :key cdr) 3))
	  (test-t (eql (count-if (lambda (x) (equal x '(a))) #((x) (y) (z) (a) (b) (c))) 1))
	  (test-t (eql (count-if (lambda (x) (eq x 'a)) #((x) (y) (z) (a) (b) (c)) :key car) 1))
	  (test-t (eql (count-if null #((x . x) (y) (z . z) (a) (b . b) (c)) :key cdr) 3))
	  (test-t (let ((list nil))
		    (and (eql (count-if (lambda (x) (setq list (cons x list)) (eq x 'a))
					#(a b c d))
			      1)
			 (equal list '(d c b a)))))
	  (test-t (let ((list nil))
		    (and (eql (count-if (lambda (x) (setq list (cons x list)) (eq x 'a))
					#(a b c d)
					:from-end t)
			      1)
			 (equal list '(a b c d)))))
	  (test-t (eql (count-if-not (complement null) (list t nil t nil t nil)) 3))
	  (test-t (zerop (count-if-not (lambda (x) (not (eql x 9))) #(0 1 2 3 4))))
	  (test-t (zerop (count-if-not (lambda (a) (not (eq 'x a))) #(0 1 2 3 4))))
	  (test-t (eql (count-if-not (complement zerop) '(0 0 0 0 0) :start 1) 4))
	  (test-t (eql (count-if-not (complement zerop) '(0 0 0 0 0) :start 1 :end nil) 4))
	  (test-t (eql (count-if-not (complement zerop) '(0 0 0 0 0) :start 2) 3))
	  (test-t (zerop (count-if-not (complement zerop) '(0 0 0 0) :start 0 :end 0)))
	  (test-t (zerop (count-if-not (complement zerop) '(0 0 0 0) :start 2 :end 2)))
	  (test-t (zerop (count-if-not (complement zerop) '(0 0 0 0) :start 4 :end 4)))
	  (test-t (eql (count-if-not (complement zerop) '(0 0 0 0) :start 2 :end 3) 1))
	  (test-t (eql (count-if-not (lambda (x) (not (equalp #\a x))) "abcABC") 2))
	  (test-t (eql (count-if-not (lambda (x) (not (char-equal #\a x))) "abcABC") 2))
	  (test-t (eql (count-if-not (lambda (x) (not (equal x '(a)))) '((x) (y) (z) (a) (b) (c))) 1))
	  (test-t (eql (count-if-not (lambda (x) (not (eq x 'a))) '((x) (y) (z) (a) (b) (c)) :key car) 1))
	  (test-t (eql (count-if-not (complement null) '((x . x) (y) (z . z) (a) (b . b) (c)) :key cdr) 3))
	  (test-t (eql (count-if-not (lambda (x) (not (equal x '(a)))) '((x) (y) (z) (a) (b) (c))) 1))
	  (test-t (eql (count-if-not (lambda (x) (not (eq x 'a))) '((x) (y) (z) (a) (b) (c)) :key car) 1))
	  (test-t (eql (count-if-not (complement null) '((x . x) (y) (z . z) (a) (b . b) (c)) :key cdr) 3))
	  (test-t (let ((list nil))
		    (and (eql (count-if-not (lambda (x)
					      (setq list (cons x list))
					      (not (eq x 'a)))
					    '(a b c d))
			      1)
			 (equal list '(d c b a)))))
	  (test-t (let ((list nil))
		    (and (eql (count-if-not (lambda (x)
					      (setq list (cons x list))
					      (not (eq x 'a)))
					    '(a b c d)
					    :from-end t)
			      1)
			 (equal list '(a b c d)))))
	  (test-t (eql (count-if-not (complement null) (vector t nil t nil t nil)) 3))
	  (test-t (eql (count-if-not (complement zerop) #(0 0 0 0 0) :start 1) 4))
	  (test-t (eql (count-if-not (complement zerop) #(0 0 0 0 0) :start 1 :end nil) 4))
	  (test-t (eql (count-if-not (complement zerop) #(0 0 0 0 0) :start 2) 3))
	  (test-t (zerop (count-if-not (complement zerop) #(0 0 0 0) :start 0 :end 0)))
	  (test-t (zerop (count-if-not (complement zerop) #(0 0 0 0) :start 2 :end 2)))
	  (test-t (zerop (count-if-not (complement zerop) #(0 0 0 0) :start 4 :end 4)))
	  (test-t (eql (count-if-not (complement zerop) #(0 0 0 0) :start 2 :end 3) 1))
	  (test-t (eql (count-if-not (lambda (x) (not (equal x '(a)))) #((x) (y) (z) (a) (b) (c))) 1))
	  (test-t (eql (count-if-not (lambda (x) (not (eq x 'a))) #((x) (y) (z) (a) (b) (c)) :key car) 1))
	  (test-t (eql (count-if-not (complement null) #((x . x) (y) (z . z) (a) (b . b) (c)) :key cdr) 3))
	  (test-t (eql (count-if-not (lambda (x) (not (equal x '(a)))) #((x) (y) (z) (a) (b) (c))) 1))
	  (test-t (eql (count-if-not (lambda (x) (not (eq x 'a))) #((x) (y) (z) (a) (b) (c)) :key car) 1))
	  (test-t (eql (count-if-not (complement null) #((x . x) (y) (z . z) (a) (b . b) (c)) :key cdr) 3))
	  (test-t (let ((list nil))
		    (and (eql (count-if-not (lambda (x)
					      (setq list (cons x list))
					      (not (eq x 'a)))
					    #(a b c d))
			      1)
			 (equal list '(d c b a)))))
	  (test-t (let ((list nil))
		    (and (eql (count-if-not (lambda (x)
					      (setq list (cons x list))
					      (not (eq x 'a)))
					    #(a b c d)
					    :from-end t)
			      1)
			 (equal list '(a b c d)))))
	  (test (count-if zero? '(0 1 2 0)) 2)
	  (test (count-if-not zero? '(0 1 2 0 3)) 3)
	  (test (count-if zero? #(0 1 2 0)) 2)
	  (test (count-if zero? '((0 1) (1 0) (2 3) (0 1)) :key car) 2)
	  (test (count-if zero? '(0 1 2 0) :from-end #t) 2)
	  (test (count-if zero? '(0 1 2 0) :start 1) 1)
	  (test (count-if zero? '(0 1 2 0) :start 1 :end 3) 0)
	  (test (count-if zero? '(0 1 2 0) :end 3) 1)
	  (test (count-if zero? '(0 1 2 0) :end 4) 2)
	  (test (count-if zero? '(0 1 2 0) :end 4 :from-end #t) 2)
	  (test-t (eql (count #\a "how many A's are there in here?") 2))
	  )
	
	(define* (find-if predicate sequence from-end (start 0) end (key identity))
	  (let* ((len (length sequence))
		 (nd (or (and (number? end) end) len))) ; up to but not including end
	    (if (< nd start)
		(error 'out-of-range "~A :start ~A is greater than ~A ~A" __func__ start (if end ":end" "length") nd))
	    (call-with-exit
	     (lambda (return)
	       (if (not from-end)
		   (do ((i start (+ i 1)))
		       ((= i nd) #f)
		     (if (predicate (key (sequence i)))
			 (return (sequence i))))
		   (do ((i (- nd 1) (- i 1)))
		       ((< i start) #f)
		     (if (predicate (key (sequence i)))
			 (return (sequence i)))))))))

	(define* (find item sequence from-end (test eql) (start 0) end (key identity))
	  (find-if (lambda (arg) (test item arg)) sequence from-end start end key))

	(let ()
	  (define* (find-if-not predicate sequence from-end (start 0) end (key identity))
	    (find-if (lambda (obj) (not (predicate obj))) sequence from-end start end key))
	  
	  (test-t (eq (find-if-not (lambda (x) (not (eq x 'a))) '(a b c)) 'a))
	  (test-t (eq (find-if-not (lambda (x) (not (eq x 'b))) '(a b c)) 'b))
	  (test-t (eq (find-if-not (lambda (x) (not (eq x 'c))) '(a b c)) 'c))
	  (test-t (null (find-if-not (lambda (arg) (not (eq arg 'x))) '(a b c))))
	  (test-t (null (find-if-not (lambda (x) (not (eq x 'a))) '(a b c) :start 1)))
	  (test-t (null (find-if-not (lambda (x) (not (eq x 'b))) '(a b c) :start 2)))
	  (test-t (null (find-if-not (lambda (x) (not (eq x 'c))) '(a b c) :start 3)))
	  (test-t (null (find-if-not (lambda (x) (not (eq x 'a))) '(a b c) :start 0 :end 0)))
	  (test-t (null (find-if-not (lambda (x) (not (eq x 'a))) '(a b c) :start 0 :end 0 :from-end t)))
	  (test-t (null (find-if-not (lambda (x) (not (eq x 'a))) '(a b c) :start 1 :end 1)))
	  (test-t (null (find-if-not (lambda (x) (not (eq x 'a))) '(a b c) :start 1 :end 1 :from-end t)))
	  (test-t (null (find-if-not (lambda (x) (not (eq x 'a))) '(a b c) :start 2 :end 2)))
	  (test-t (null (find-if-not (lambda (x) (not (eq x 'a))) '(a b c) :start 2 :end 2 :from-end t)))
	  (test-t (null (find-if-not (lambda (x) (not (eq x 'a))) '(a b c) :start 3 :end 3)))
	  (test-t (null (find-if-not (lambda (x) (not (eq x 'a))) '(a b c) :start 3 :end 3 :from-end t)))
	  (test-t (eq (find-if-not (lambda (x) (not (eq x 'a))) '(a b c) :end nil) 'a))
	  (test-t (eq (find-if-not (lambda (x) (not (eq x 'b))) '(a b c) :end nil) 'b))
	  (test-t (eq (find-if-not (lambda (x) (not (eq x 'c))) '(a b c) :end nil) 'c))
	  (test-t (eq (find-if-not (lambda (x) (not (eq x 'a))) '(a b c) :end 1) 'a))
	  (test-t (eq (find-if-not (lambda (x) (not (eq x 'b))) '(a b c) :end 2) 'b))
	  (test-t (eq (find-if-not (lambda (x) (not (eq x 'c))) '(a b c) :end 3) 'c))
	  (test-t (null (find-if-not (lambda (x) (not (eq x 'a))) '(a b c) :end 0)))
	  (test-t (null (find-if-not (lambda (x) (not (eq x 'b))) '(a b c) :end 1)))
	  (test-t (null (find-if-not (lambda (x) (not (eq x 'c))) '(a b c) :end 2)))
	  (test-t (null (find-if-not (lambda (x) (not (eq x 'a))) '((a) (b) (c)))))
	  (test-t (equal (find-if-not (lambda (x) (not (eq x 'a))) '((a) (b) (c)) :key car) '(a)))
	  (test-t (equal (find-if-not (lambda (x) (not (eq x 'b))) '((a) (b) (c)) :key car) '(b)))
	  (test-t (equal (find-if-not (lambda (x) (not (eq x 'c))) '((a) (b) (c)) :key car) '(c)))
	  (test-t (null (find-if-not (lambda (x) (not (eq x 'z))) '((a) (b) (c)) :key car)))
	  (test-t (let ((list '((a) (b) (c))))
		    (and (eq (find-if-not (lambda (x) (not (eq x 'a))) list :key car)
			     (car list))
			 (eq (find-if-not (lambda (x) (not (eq x 'b))) list :key car)
			     (cadr list))
			 (eq (find-if-not (lambda (x) (not (eq x 'c))) list :key car)
			     (caddr list))
			 (null (find-if-not (lambda (x) (not (eq x 'z))) list :key car)))))
	  (test-t (equal (find-if-not (lambda (x) (not (eq x 'a))) '((a) (b) (c) (a a) (b b) (c c)) :key car) '(a)))
	  (test-t (equal (find-if-not (lambda (x) (not (eq x 'a))) '((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t) '(a a)))
	  (test-t (equal (find-if-not (lambda (x) (not (eq x 'b))) '((a) (b) (c) (a a) (b b) (c c)) :key car) '(b)))
	  (test-t (equal (find-if-not (lambda (x) (not (eq x 'b))) '((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t) '(b b)))
	  (test-t (equal (find-if-not (lambda (x) (not (eq x 'c))) '((a) (b) (c) (a a) (b b) (c c)) :key car) '(c)))
	  (test-t (equal (find-if-not (lambda (x) (not (eq x 'c))) '((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t) '(c c)))
	  (test-t (null (find-if-not (lambda (x) (not (eq x 'z))) '((a) (b) (c) (a a) (b b) (c c)) :key car)))
	  (test-t (null (find-if-not (lambda (x) (not (eq x 'z))) '((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t)))
	  (test-t (equal (find-if-not (lambda (x) (not (eq x 'a))) '((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t) '(a a a)))
	  (test-t (equal (find-if-not (lambda (x) (not (eq x 'a))) '((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t :end nil) '(a a a)))
	  (test-t (equal (find-if-not (lambda (x) (not (eq x 'a))) '((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t :end 6) '(a a)))
	  (test-t (null (find-if-not (lambda (x) (not (eq x 'a))) '((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t :start 1 :end 3)))
	  (test-t (eq (find-if-not (lambda (x) (not (eq x 'a))) #(a b c)) 'a))
	  (test-t (eq (find-if-not (lambda (x) (not (eq x 'b))) #(a b c)) 'b))
	  (test-t (eq (find-if-not (lambda (x) (not (eq x 'c))) #(a b c)) 'c))
	  (test-t (null (find-if-not (lambda (arg) (not (eq arg 'x))) #(a b c))))
	  (test-t (null (find-if-not (lambda (x) (not (eq x 'a))) #(a b c) :start 1)))
	  (test-t (null (find-if-not (lambda (x) (not (eq x 'b))) #(a b c) :start 2)))
	  (test-t (null (find-if-not (lambda (x) (not (eq x 'c))) #(a b c) :start 3)))
	  (test-t (null (find-if-not (lambda (x) (not (eq x 'a))) #(a b c) :start 0 :end 0)))
	  (test-t (null (find-if-not (lambda (x) (not (eq x 'a))) #(a b c) :start 0 :end 0 :from-end t)))
	  (test-t (null (find-if-not (lambda (x) (not (eq x 'a))) #(a b c) :start 1 :end 1)))
	  (test-t (null (find-if-not (lambda (x) (not (eq x 'a))) #(a b c) :start 1 :end 1 :from-end t)))
	  (test-t (null (find-if-not (lambda (x) (not (eq x 'a))) #(a b c) :start 2 :end 2)))
	  (test-t (null (find-if-not (lambda (x) (not (eq x 'a))) #(a b c) :start 2 :end 2 :from-end t)))
	  (test-t (null (find-if-not (lambda (x) (not (eq x 'a))) #(a b c) :start 3 :end 3)))
	  (test-t (null (find-if-not (lambda (x) (not (eq x 'a))) #(a b c) :start 3 :end 3 :from-end t)))
	  (test-t (eq (find-if-not (lambda (x) (not (eq x 'a))) #(a b c) :end nil) 'a))
	  (test-t (eq (find-if-not (lambda (x) (not (eq x 'b))) #(a b c) :end nil) 'b))
	  (test-t (eq (find-if-not (lambda (x) (not (eq x 'c))) #(a b c) :end nil) 'c))
	  (test-t (eq (find-if-not (lambda (x) (not (eq x 'a))) #(a b c) :end 1) 'a))
	  (test-t (eq (find-if-not (lambda (x) (not (eq x 'b))) #(a b c) :end 2) 'b))
	  (test-t (eq (find-if-not (lambda (x) (not (eq x 'c))) #(a b c) :end 3) 'c))
	  (test-t (null (find-if-not (lambda (x) (not (eq x 'a))) #(a b c) :end 0)))
	  (test-t (null (find-if-not (lambda (x) (not (eq x 'b))) #(a b c) :end 1)))
	  (test-t (null (find-if-not (lambda (x) (not (eq x 'c))) #(a b c) :end 2)))
	  (test-t (null (find-if-not (lambda (x) (not (eq x 'a))) #((a) (b) (c)))))
	  (test-t (equal (find-if-not (lambda (x) (not (eq x 'a))) #((a) (b) (c)) :key car) '(a)))
	  (test-t (equal (find-if-not (lambda (x) (not (eq x 'b))) #((a) (b) (c)) :key car) '(b)))
	  (test-t (equal (find-if-not (lambda (x) (not (eq x 'c))) #((a) (b) (c)) :key car) '(c)))
	  (test-t (null (find-if-not (lambda (x) (not (eq x 'z))) #((a) (b) (c)) :key car)))
	  (test-t (let ((vector #((a) (b) (c))))
		    (and (eq (find-if-not (lambda (x) (not (eq x 'a))) vector :key car)
			     (aref vector 0))
			 (eq (find-if-not (lambda (x) (not (eq x 'b))) vector :key car)
			     (aref vector 1))
			 (eq (find-if-not (lambda (x) (not (eq x 'c))) vector :key car)
			     (aref vector 2))
			 (null (find-if-not (lambda (x) (not (eq x 'z))) vector :key car)))))
	  (test-t (equal (find-if-not (lambda (x) (not (eq x 'a))) #((a) (b) (c) (a a) (b b) (c c)) :key car) '(a)))
	  (test-t (equal (find-if-not (lambda (x) (not (eq x 'a))) #((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t) '(a a)))
	  (test-t (equal (find-if-not (lambda (x) (not (eq x 'b))) #((a) (b) (c) (a a) (b b) (c c)) :key car) '(b)))
	  (test-t (equal (find-if-not (lambda (x) (not (eq x 'b))) #((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t) '(b b)))
	  (test-t (equal (find-if-not (lambda (x) (not (eq x 'c))) #((a) (b) (c) (a a) (b b) (c c)) :key car) '(c)))
	  (test-t (equal (find-if-not (lambda (x) (not (eq x 'c))) #((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t) '(c c)))
	  (test-t (null (find-if-not (lambda (x) (not (eq x 'z))) #((a) (b) (c) (a a) (b b) (c c)) :key car)))
	  (test-t (null (find-if-not (lambda (x) (not (eq x 'z))) #((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t)))
	  (test-t (equal (find-if-not (lambda (x) (not (eq x 'a))) #((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t) '(a a a)))
	  (test-t (equal (find-if-not (lambda (x) (not (eq x 'a))) #((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t :end nil) '(a a a)))
	  (test-t (equal (find-if-not (lambda (x) (not (eq x 'a))) #((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t :end 6) '(a a)))
	  (test-t (null (find-if-not (lambda (x) (not (eq x 'a))) #((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t :start 1 :end 3)))
	  )
	
	(let ()
	  (define* (position-if predicate sequence from-end (start 0) end (key identity))
	    (let* ((len (length sequence))
		   (nd (or (and (number? end) end) len))) ; up to but not including end
	      (if (< nd start)
		  (error 'out-of-range "~A :start ~A is greater than ~A ~A" __func__ start (if end ":end" "length") nd))
	      (call-with-exit
	       (lambda (return)
		 (if (not from-end)
		     (do ((i start (+ i 1)))
			 ((= i nd) #f)
		       (if (predicate (key (sequence i)))
			   (return i)))
		     (do ((i (- nd 1) (- i 1)))
			 ((< i start) #f)
		       (if (predicate (key (sequence i)))
			   (return i))))))))
	  
	  (define* (position-if-not predicate sequence from-end (start 0) end (key identity))
	    (position-if (lambda (obj) (not (predicate obj))) sequence from-end start end key))
	  
	  (define* (position item sequence from-end (test eql) (start 0) end (key identity))
	    (position-if (lambda (arg) (test item arg)) sequence from-end start end key))
	  
	  (test-t (eql (position #\a "baobab" :from-end t) 4))
	  (test-t (eql (position-if oddp '((1) (2) (3) (4)) :start 1 :key car) 2))
	  (test-t (null (position 595 ())))
	  (test-t (eql (position-if-not integerp '(1 2 3 4 5.0)) 4))
	  (test-t (eql (position 'a '(a b c)) 0))
	  (test-t (eql (position 'b '(a b c)) 1))
	  (test-t (eql (position 'c '(a b c)) 2))
	  (test-t (null (position 'x '(a b c))))
	  (test-t (null (position 'a '(a b c) :start 1)))
	  (test-t (null (position 'b '(a b c) :start 2)))
	  (test-t (null (position 'c '(a b c) :start 3)))
	  (test-t (null (position 'a '(a b c) :start 0 :end 0)))
	  (test-t (null (position 'a '(a b c) :start 0 :end 0 :from-end t)))
	  (test-t (null (position 'a '(a b c) :start 1 :end 1)))
	  (test-t (null (position 'a '(a b c) :start 1 :end 1 :from-end t)))
	  (test-t (null (position 'a '(a b c) :start 2 :end 2)))
	  (test-t (null (position 'a '(a b c) :start 2 :end 2 :from-end t)))
	  (test-t (null (position 'a '(a b c) :start 3 :end 3)))
	  (test-t (null (position 'a '(a b c) :start 3 :end 3 :from-end t)))
	  (test-t (eql (position 'a '(a b c) :end nil) '0))
	  (test-t (eql (position 'b '(a b c) :end nil) '1))
	  (test-t (eql (position 'c '(a b c) :end nil) '2))
	  (test-t (eql (position 'a '(a b c) :end 1) '0))
	  (test-t (eql (position 'b '(a b c) :end 2) '1))
	  (test-t (eql (position 'c '(a b c) :end 3) '2))
	  (test-t (null (position 'a '(a b c) :end 0)))
	  (test-t (null (position 'b '(a b c) :end 1)))
	  (test-t (null (position 'c '(a b c) :end 2)))
	  (test-t (null (position 'a '((a) (b) (c)))))
	  (test-t (eql (position 'a '((a) (b) (c)) :key car) 0))
	  (test-t (eql (position 'b '((a) (b) (c)) :key car) 1))
	  (test-t (eql (position 'c '((a) (b) (c)) :key car) 2))
	  (test-t (null (position 'z '((a) (b) (c)) :key car)))
	  (test-t (null (position '(a) '((a) (b) (c)))))
	  (test-t (eql (position '(a) '((a) (b) (c)) :test equal) 0))
	  (test-t (null (position '("a") '(("a") ("b") ("c")))))
	  (test-t (eql (position 3 '(0 1 2 3 4 5)) 3))
	  (test-t (eql (position 3 '(0 1 2 3 4 5) :test <) 4))
	  (test-t (eql (position 3 '(0 1 2 3 4 5) :test >) 0))
	  (test-t (eql (position 'a '((a) (b) (c) (a a) (b b) (c c)) :key car) 0))
	  (test-t (eql (position 'a '((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t) 3))
	  (test-t (eql (position 'b '((a) (b) (c) (a a) (b b) (c c)) :key car) 1))
	  (test-t (eql (position 'b '((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t) 4))
	  (test-t (eql (position 'c '((a) (b) (c) (a a) (b b) (c c)) :key car) 2))
	  (test-t (eql (position 'c '((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t) 5))
	  (test-t (null (position 'z '((a) (b) (c) (a a) (b b) (c c)) :key car)))
	  (test-t (null (position 'z '((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t)))
	  (test-t (eql (position 'a '((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t) 6))
	  (test-t (eql (position 'a '((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t :end nil) 6))
	  (test-t (eql (position 'a '((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t :end 6) 3))
	  (test-t (null (position 'a '((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t :start 1 :end 3)))
	  (test-t (eql (position 'a #(a b c)) 0))
	  (test-t (eql (position 'b #(a b c)) 1))
	  (test-t (eql (position 'c #(a b c)) 2))
	  (test-t (null (position 'x #(a b c))))
	  (test-t (null (position 'a #(a b c) :start 1)))
	  (test-t (null (position 'b #(a b c) :start 2)))
	  (test-t (null (position 'c #(a b c) :start 3)))
	  (test-t (null (position 'a #(a b c) :start 0 :end 0)))
	  (test-t (null (position 'a #(a b c) :start 0 :end 0 :from-end t)))
	  (test-t (null (position 'a #(a b c) :start 1 :end 1)))
	  (test-t (null (position 'a #(a b c) :start 1 :end 1 :from-end t)))
	  (test-t (null (position 'a #(a b c) :start 2 :end 2)))
	  (test-t (null (position 'a #(a b c) :start 2 :end 2 :from-end t)))
	  (test-t (null (position 'a #(a b c) :start 3 :end 3)))
	  (test-t (null (position 'a #(a b c) :start 3 :end 3 :from-end t)))
	  (test-t (eql (position 'a #(a b c) :end nil) 0))
	  (test-t (eql (position 'b #(a b c) :end nil) 1))
	  (test-t (eql (position 'c #(a b c) :end nil) 2))
	  (test-t (eql (position 'a #(a b c) :end 1) 0))
	  (test-t (eql (position 'b #(a b c) :end 2) 1))
	  (test-t (eql (position 'c #(a b c) :end 3) 2))
	  (test-t (null (position 'a #(a b c) :end 0)))
	  (test-t (null (position 'b #(a b c) :end 1)))
	  (test-t (null (position 'c #(a b c) :end 2)))
	  (test-t (null (position 'a #((a) (b) (c)))))
	  (test-t (eql (position 'a #((a) (b) (c)) :key car) 0))
	  (test-t (eql (position 'b #((a) (b) (c)) :key car) 1))
	  (test-t (eql (position 'c #((a) (b) (c)) :key car) 2))
	  (test-t (null (position 'z #((a) (b) (c)) :key car)))
	  (test-t (null (position '(a) #((a) (b) (c)))))
	  (test-t (eql (position '(a) #((a) (b) (c)) :test equal) 0))
	  (test-t (null (position '("a") #(("a") ("b") ("c")))))
	  (test-t (eql (position 3 #(0 1 2 3 4 5)) 3))
	  (test-t (eql (position 3 #(0 1 2 3 4 5) :test <) 4))
	  (test-t (eql (position 3 #(0 1 2 3 4 5) :test >) 0))
	  (test-t (eql (position 'a #((a) (b) (c) (a a) (b b) (c c)) :key car) 0))
	  (test-t (eql (position 'a #((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t) 3))
	  (test-t (eql (position 'b #((a) (b) (c) (a a) (b b) (c c)) :key car) 1))
	  (test-t (eql (position 'b #((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t) 4))
	  (test-t (eql (position 'c #((a) (b) (c) (a a) (b b) (c c)) :key car) 2))
	  (test-t (eql (position 'c #((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t) 5))
	  (test-t (null (position 'z #((a) (b) (c) (a a) (b b) (c c)) :key car)))
	  (test-t (null (position 'z #((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t)))
	  (test-t (eql (position 'a #((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t) 6))
	  (test-t (eql (position 'a #((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t :end nil) 6))
	  (test-t (eql (position 'a #((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t :end 6) 3))
	  (test-t (null (position 'a #((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t :start 1 :end 3)))
	  (test-t (null (position #\z "abcABC")))
	  (test-t (eql (position #\a "abcABC") 0))
	  (test-t (eql (position #\A "abcABC") 3))
	  (test-t (eql (position #\A "abcABC" :test char-equal) 0))
	  (test-t (eql (position #\A "abcABC" :test char-equal :from-end t) 3))
	  (test-t (eql (position #\a "abcABC" :test char-equal :from-end t) 3))
	  (test-t (eql (position #\a "abcABC" :test char-equal :from-end t :end 4) 3))
	  (test-t (eql (position #\a "abcABC" :test char-equal :from-end t :end 3) 0))
	  (test-t (eql (position-if (lambda (x) (eq x 'a)) '(a b c)) 0))
	  (test-t (eql (position-if (lambda (x) (eq x 'b)) '(a b c)) 1))
	  (test-t (eql (position-if (lambda (x) (eq x 'c)) '(a b c)) 2))
	  (test-t (null (position-if (lambda (arg) (eq arg 'x)) '(a b c))))
	  (test-t (null (position-if (lambda (x) (eq x 'a)) '(a b c) :start 1)))
	  (test-t (null (position-if (lambda (x) (eq x 'b)) '(a b c) :start 2)))
	  (test-t (null (position-if (lambda (x) (eq x 'c)) '(a b c) :start 3)))
	  (test-t (null (position-if (lambda (x) (eq x 'a)) '(a b c) :start 0 :end 0)))
	  (test-t (null (position-if (lambda (x) (eq x 'a)) '(a b c) :start 0 :end 0 :from-end t)))
	  (test-t (null (position-if (lambda (x) (eq x 'a)) '(a b c) :start 1 :end 1)))
	  (test-t (null (position-if (lambda (x) (eq x 'a)) '(a b c) :start 1 :end 1 :from-end t)))
	  (test-t (null (position-if (lambda (x) (eq x 'a)) '(a b c) :start 2 :end 2)))
	  (test-t (null (position-if (lambda (x) (eq x 'a)) '(a b c) :start 2 :end 2 :from-end t)))
	  (test-t (null (position-if (lambda (x) (eq x 'a)) '(a b c) :start 3 :end 3)))
	  (test-t (null (position-if (lambda (x) (eq x 'a)) '(a b c) :start 3 :end 3 :from-end t)))
	  (test-t (eql (position-if (lambda (x) (eq x 'a)) '(a b c) :end nil) 0))
	  (test-t (eql (position-if (lambda (x) (eq x 'b)) '(a b c) :end nil) 1))
	  (test-t (eql (position-if (lambda (x) (eq x 'c)) '(a b c) :end nil) 2))
	  (test-t (eql (position-if (lambda (x) (eq x 'a)) '(a b c) :end 1) 0))
	  (test-t (eql (position-if (lambda (x) (eq x 'b)) '(a b c) :end 2) 1))
	  (test-t (eql (position-if (lambda (x) (eq x 'c)) '(a b c) :end 3) 2))
	  (test-t (null (position-if (lambda (x) (eq x 'a)) '(a b c) :end 0)))
	  (test-t (null (position-if (lambda (x) (eq x 'b)) '(a b c) :end 1)))
	  (test-t (null (position-if (lambda (x) (eq x 'c)) '(a b c) :end 2)))
	  (test-t (null (position-if (lambda (x) (eq x 'a)) '((a) (b) (c)))))
	  (test-t (eql (position-if (lambda (x) (eq x 'a)) '((a) (b) (c)) :key car) 0))
	  (test-t (eql (position-if (lambda (x) (eq x 'b)) '((a) (b) (c)) :key car) 1))
	  (test-t (eql (position-if (lambda (x) (eq x 'c)) '((a) (b) (c)) :key car) 2))
	  (test-t (null (position-if (lambda (x) (eq x 'z)) '((a) (b) (c)) :key car)))
	  (test-t (eql (position-if (lambda (x) (eq x 'a)) '((a) (b) (c) (a a) (b b) (c c)) :key car) 0))
	  (test-t (eql (position-if (lambda (x) (eq x 'a)) '((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t) 3))
	  (test-t (eql (position-if (lambda (x) (eq x 'b)) '((a) (b) (c) (a a) (b b) (c c)) :key car) 1))
	  (test-t (eql (position-if (lambda (x) (eq x 'b)) '((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t) 4))
	  (test-t (eql (position-if (lambda (x) (eq x 'c)) '((a) (b) (c) (a a) (b b) (c c)) :key car) 2))
	  (test-t (eql (position-if (lambda (x) (eq x 'c)) '((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t) 5))
	  (test-t (null (position-if (lambda (x) (eq x 'z)) '((a) (b) (c) (a a) (b b) (c c)) :key car)))
	  (test-t (null (position-if (lambda (x) (eq x 'z)) '((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t)))
	  (test-t (eql (position-if (lambda (x) (eq x 'a)) '((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t) 6))
	  (test-t (eql (position-if (lambda (x) (eq x 'a)) '((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t :end nil) 6))
	  (test-t (eql (position-if (lambda (x) (eq x 'a)) '((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t :end 6) 3))
	  (test-t (null (position-if (lambda (x) (eq x 'a)) '((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t :start 1 :end 3)))
	  (test-t (eql (position-if (lambda (x) (eq x 'a)) #(a b c)) 0))
	  (test-t (eql (position-if (lambda (x) (eq x 'b)) #(a b c)) 1))
	  (test-t (eql (position-if (lambda (x) (eq x 'c)) #(a b c)) 2))
	  (test-t (null (position-if (lambda (arg) (eq arg 'x)) #(a b c))))
	  (test-t (null (position-if (lambda (x) (eq x 'a)) #(a b c) :start 1)))
	  (test-t (null (position-if (lambda (x) (eq x 'b)) #(a b c) :start 2)))
	  (test-t (null (position-if (lambda (x) (eq x 'c)) #(a b c) :start 3)))
	  (test-t (null (position-if (lambda (x) (eq x 'a)) #(a b c) :start 0 :end 0)))
	  (test-t (null (position-if (lambda (x) (eq x 'a)) #(a b c) :start 0 :end 0 :from-end t)))
	  (test-t (null (position-if (lambda (x) (eq x 'a)) #(a b c) :start 1 :end 1)))
	  (test-t (null (position-if (lambda (x) (eq x 'a)) #(a b c) :start 1 :end 1 :from-end t)))
	  (test-t (null (position-if (lambda (x) (eq x 'a)) #(a b c) :start 2 :end 2)))
	  (test-t (null (position-if (lambda (x) (eq x 'a)) #(a b c) :start 2 :end 2 :from-end t)))
	  (test-t (null (position-if (lambda (x) (eq x 'a)) #(a b c) :start 3 :end 3)))
	  (test-t (null (position-if (lambda (x) (eq x 'a)) #(a b c) :start 3 :end 3 :from-end t)))
	  (test-t (eql (position-if (lambda (x) (eq x 'a)) #(a b c) :end nil) 0))
	  (test-t (eql (position-if (lambda (x) (eq x 'b)) #(a b c) :end nil) 1))
	  (test-t (eql (position-if (lambda (x) (eq x 'c)) #(a b c) :end nil) 2))
	  (test-t (eql (position-if (lambda (x) (eq x 'a)) #(a b c) :end 1) 0))
	  (test-t (eql (position-if (lambda (x) (eq x 'b)) #(a b c) :end 2) 1))
	  (test-t (eql (position-if (lambda (x) (eq x 'c)) #(a b c) :end 3) 2))
	  (test-t (null (position-if (lambda (x) (eq x 'a)) #(a b c) :end 0)))
	  (test-t (null (position-if (lambda (x) (eq x 'b)) #(a b c) :end 1)))
	  (test-t (null (position-if (lambda (x) (eq x 'c)) #(a b c) :end 2)))
	  (test-t (null (position-if (lambda (x) (eq x 'a)) #((a) (b) (c)))))
	  (test-t (eql (position-if (lambda (x) (eq x 'a)) #((a) (b) (c)) :key car) 0))
	  (test-t (eql (position-if (lambda (x) (eq x 'b)) #((a) (b) (c)) :key car) 1))
	  (test-t (eql (position-if (lambda (x) (eq x 'c)) #((a) (b) (c)) :key car) 2))
	  (test-t (null (position-if (lambda (x) (eq x 'z)) #((a) (b) (c)) :key car)))
	  (test-t (eql (position-if (lambda (x) (eq x 'a)) #((a) (b) (c) (a a) (b b) (c c)) :key car) 0))
	  (test-t (eql (position-if (lambda (x) (eq x 'a)) #((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t) 3))
	  (test-t (eql (position-if (lambda (x) (eq x 'b)) #((a) (b) (c) (a a) (b b) (c c)) :key car) 1))
	  (test-t (eql (position-if (lambda (x) (eq x 'b)) #((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t) 4))
	  (test-t (eql (position-if (lambda (x) (eq x 'c)) #((a) (b) (c) (a a) (b b) (c c)) :key car) 2))
	  (test-t (eql (position-if (lambda (x) (eq x 'c)) #((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t) 5))
	  (test-t (null (position-if (lambda (x) (eq x 'z)) #((a) (b) (c) (a a) (b b) (c c)) :key car)))
	  (test-t (null (position-if (lambda (x) (eq x 'z)) #((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t)))
	  (test-t (eql (position-if (lambda (x) (eq x 'a)) #((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t) 6))
	  (test-t (eql (position-if (lambda (x) (eq x 'a)) #((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t :end nil) 6))
	  (test-t (eql (position-if (lambda (x) (eq x 'a)) #((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t :end 6) 3))
	  (test-t (null (position-if (lambda (x) (eq x 'a)) #((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t :start 1 :end 3)))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'a))) '(a b c)) 0))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'b))) '(a b c)) 1))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'c))) '(a b c)) 2))
	  (test-t (null (position-if-not (lambda (arg) (not (eq arg 'x))) '(a b c))))
	  (test-t (null (position-if-not (lambda (x) (not (eq x 'a))) '(a b c) :start 1)))
	  (test-t (null (position-if-not (lambda (x) (not (eq x 'b))) '(a b c) :start 2)))
	  (test-t (null (position-if-not (lambda (x) (not (eq x 'c))) '(a b c) :start 3)))
	  (test-t (null (position-if-not (lambda (x) (not (eq x 'a))) '(a b c) :start 0 :end 0)))
	  (test-t (null (position-if-not (lambda (x) (not (eq x 'a))) '(a b c) :start 0 :end 0 :from-end t)))
	  (test-t (null (position-if-not (lambda (x) (not (eq x 'a))) '(a b c) :start 1 :end 1)))
	  (test-t (null (position-if-not (lambda (x) (not (eq x 'a))) '(a b c) :start 1 :end 1 :from-end t)))
	  (test-t (null (position-if-not (lambda (x) (not (eq x 'a))) '(a b c) :start 2 :end 2)))
	  (test-t (null (position-if-not (lambda (x) (not (eq x 'a))) '(a b c) :start 2 :end 2 :from-end t)))
	  (test-t (null (position-if-not (lambda (x) (not (eq x 'a))) '(a b c) :start 3 :end 3)))
	  (test-t (null (position-if-not (lambda (x) (not (eq x 'a))) '(a b c) :start 3 :end 3 :from-end t)))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'a))) '(a b c) :end nil) 0))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'b))) '(a b c) :end nil) 1))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'c))) '(a b c) :end nil) 2))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'a))) '(a b c) :end 1) 0))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'b))) '(a b c) :end 2) 1))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'c))) '(a b c) :end 3) 2))
	  (test-t (null (position-if-not (lambda (x) (not (eq x 'a))) '(a b c) :end 0)))
	  (test-t (null (position-if-not (lambda (x) (not (eq x 'b))) '(a b c) :end 1)))
	  (test-t (null (position-if-not (lambda (x) (not (eq x 'c))) '(a b c) :end 2)))
	  (test-t (null (position-if-not (lambda (x) (not (eq x 'a))) '((a) (b) (c)))))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'a))) '((a) (b) (c)) :key car) 0))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'b))) '((a) (b) (c)) :key car) 1))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'c))) '((a) (b) (c)) :key car) 2))
	  (test-t (null (position-if-not (lambda (x) (not (eq x 'z))) '((a) (b) (c)) :key car)))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'a))) '((a) (b) (c) (a a) (b b) (c c)) :key car) 0))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'a))) '((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t) 3))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'b))) '((a) (b) (c) (a a) (b b) (c c)) :key car) 1))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'b))) '((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t) 4))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'c))) '((a) (b) (c) (a a) (b b) (c c)) :key car) 2))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'c))) '((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t) 5))
	  (test-t (null (position-if-not (lambda (x) (not (eq x 'z))) '((a) (b) (c) (a a) (b b) (c c)) :key car)))
	  (test-t (null (position-if-not (lambda (x) (not (eq x 'z))) '((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t)))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'a))) '((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t) 6))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'a))) '((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t :end nil) 6))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'a))) '((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t :end 6) 3))
	  (test-t (null (position-if-not (lambda (x) (not (eq x 'a))) '((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t :start 1 :end 3)))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'a))) #(a b c)) 0))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'b))) #(a b c)) 1))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'c))) #(a b c)) 2))
	  (test-t (null (position-if-not (lambda (arg) (not (eq arg 'x))) #(a b c))))
	  (test-t (null (position-if-not (lambda (x) (not (eq x 'a))) #(a b c) :start 1)))
	  (test-t (null (position-if-not (lambda (x) (not (eq x 'b))) #(a b c) :start 2)))
	  (test-t (null (position-if-not (lambda (x) (not (eq x 'c))) #(a b c) :start 3)))
	  (test-t (null (position-if-not (lambda (x) (not (eq x 'a))) #(a b c) :start 0 :end 0)))
	  (test-t (null (position-if-not (lambda (x) (not (eq x 'a))) #(a b c) :start 0 :end 0 :from-end t)))
	  (test-t (null (position-if-not (lambda (x) (not (eq x 'a))) #(a b c) :start 1 :end 1)))
	  (test-t (null (position-if-not (lambda (x) (not (eq x 'a))) #(a b c) :start 1 :end 1 :from-end t)))
	  (test-t (null (position-if-not (lambda (x) (not (eq x 'a))) #(a b c) :start 2 :end 2)))
	  (test-t (null (position-if-not (lambda (x) (not (eq x 'a))) #(a b c) :start 2 :end 2 :from-end t)))
	  (test-t (null (position-if-not (lambda (x) (not (eq x 'a))) #(a b c) :start 3 :end 3)))
	  (test-t (null (position-if-not (lambda (x) (not (eq x 'a))) #(a b c) :start 3 :end 3 :from-end t)))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'a))) #(a b c) :end nil) 0))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'b))) #(a b c) :end nil) 1))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'c))) #(a b c) :end nil) 2))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'a))) #(a b c) :end 1) 0))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'b))) #(a b c) :end 2) 1))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'c))) #(a b c) :end 3) 2))
	  (test-t (null (position-if-not (lambda (x) (not (eq x 'a))) #(a b c) :end 0)))
	  (test-t (null (position-if-not (lambda (x) (not (eq x 'b))) #(a b c) :end 1)))
	  (test-t (null (position-if-not (lambda (x) (not (eq x 'c))) #(a b c) :end 2)))
	  (test-t (null (position-if-not (lambda (x) (not (eq x 'a))) #((a) (b) (c)))))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'a))) #((a) (b) (c)) :key car) 0))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'b))) #((a) (b) (c)) :key car) 1))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'c))) #((a) (b) (c)) :key car) 2))
	  (test-t (null (position-if-not (lambda (x) (not (eq x 'z))) #((a) (b) (c)) :key car)))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'a))) #((a) (b) (c) (a a) (b b) (c c)) :key car) 0))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'a))) #((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t) 3))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'b))) #((a) (b) (c) (a a) (b b) (c c)) :key car) 1))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'b))) #((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t) 4))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'c))) #((a) (b) (c) (a a) (b b) (c c)) :key car) 2))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'c))) #((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t) 5))
	  (test-t (null (position-if-not (lambda (x) (not (eq x 'z))) #((a) (b) (c) (a a) (b b) (c c)) :key car)))
	  (test-t (null (position-if-not (lambda (x) (not (eq x 'z))) #((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t)))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'a))) #((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t) 6))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'a))) #((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t :end nil) 6))
	  (test-t (eql (position-if-not (lambda (x) (not (eq x 'a))) #((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t :end 6) 3))
	  (test-t (null (position-if-not (lambda (x) (not (eq x 'a))) #((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t :start 1 :end 3)))
	)

	(define copy-seq copy)
	

	;; -------- strings
	
	(define char string-ref)
	(define schar string-ref)
	(define* (cl-make-string size (initial-element #\null)) (make-string size initial-element))
	
	(define (cl-string x)
	  (if (string? x) x
	      (if (char? x)
		  (string x)
		  (if (symbol? x)
		      (symbol->string x)
		      (error 'wrong-type-arg "string ~A?" x)))))
	
	(define* (string= str-1 str-2 (start1 0) end1 (start2 0) end2)
	  (let* ((str1 (cl-string str-1))
		 (str2 (cl-string str-2))
		 (nd1 (if (number? end1) end1 (length str1)))
		 (nd2 (if (number? end2) end2 (length str2))))
	    (if (and (not end1) (not end2) (= start1 0) (= start2 0))
		(string=? str1 str2)
		(string=? (subseq str1 start1 nd1)
			  (subseq str2 start2 nd2)))))
	
	(define* (string-equal str-1 str-2 (start1 0) end1 (start2 0) end2)
	  (let* ((str1 (cl-string str-1))
		 (str2 (cl-string str-2))
		 (nd1 (if (number? end1) end1 (length str1)))
		 (nd2 (if (number? end2) end2 (length str2))))
	    (if (and (not end1) (not end2) (= start1 0) (= start2 0))
		(string-ci=? str1 str2)
		(string-ci=? (subseq str1 start1 nd1)
			     (subseq str2 start2 nd2)))))
	
	(define (string-prefixes-equal str1 str2 start1 nd1 start2 nd2)
	  (do ((i start1 (+ i 1))
	       (j start2 (+ j 1)))
	      ((or (= i nd1)
		   (= j nd2)
		   (not (char=? (str1 i) (str2 j))))
	       i)))
	
	(define (string-prefixes-equal-ci str1 str2 start1 nd1 start2 nd2)
	  (do ((i start1 (+ i 1))
	       (j start2 (+ j 1)))
	      ((or (= i nd1)
		   (= j nd2)
		   (not (char-ci=? (str1 i) (str2 j))))
	       i)))
	
	(define* (string< str-1 str-2 (start1 0) end1 (start2 0) end2)
	  (let* ((str1 (cl-string str-1))
		 (str2 (cl-string str-2))
		 (nd1 (if (number? end1) end1 (length str1)))
		 (nd2 (if (number? end2) end2 (length str2)))
		 (val (if (and (not end1) (not end2) (= start1 0) (= start2 0))
			  (string<? str1 str2)
			  (string<? (subseq str1 start1 nd1)
				    (subseq str2 start2 nd2)))))
	    (and val (string-prefixes-equal str1 str2 start1 nd1 start2 nd2))))

	(define* (string-lessp str-1 str-2 (start1 0) end1 (start2 0) end2)
	  (let* ((str1 (cl-string str-1))
		 (str2 (cl-string str-2))
		 (nd1 (if (number? end1) end1 (length str1)))
		 (nd2 (if (number? end2) end2 (length str2)))
		 (val (if (and (not end1) (not end2) (= start1 0) (= start2 0))
			  (string-ci<? str1 str2)
			  (string-ci<? (subseq str1 start1 nd1)
				       (subseq str2 start2 nd2)))))
	    (and val (string-prefixes-equal-ci str1 str2 start1 nd1 start2 nd2))))

	(define* (string<= str-1 str-2 (start1 0) end1 (start2 0) end2)
	  (let* ((str1 (cl-string str-1))
		 (str2 (cl-string str-2))
		 (nd1 (if (number? end1) end1 (length str1)))
		 (nd2 (if (number? end2) end2 (length str2)))
		 (val (if (and (not end1) (not end2) (= start1 0) (= start2 0))
			  (string<=? str1 str2)
			  (string<=? (subseq str1 start1 nd1)
				     (subseq str2 start2 nd2)))))
	    (and val (string-prefixes-equal str1 str2 start1 nd1 start2 nd2))))

	(define* (string-not-greaterp str-1 str-2 (start1 0) end1 (start2 0) end2)
	  (let* ((str1 (cl-string str-1))
		 (str2 (cl-string str-2))
		 (nd1 (if (number? end1) end1 (length str1)))
		 (nd2 (if (number? end2) end2 (length str2)))
		 (val (if (and (not end1) (not end2) (= start1 0) (= start2 0))
			  (string-ci<=? str1 str2)
			  (string-ci<=? (subseq str1 start1 nd1)
					(subseq str2 start2 nd2)))))
	    (and val (string-prefixes-equal-ci str1 str2 start1 nd1 start2 nd2))))

	(define* (string> str-1 str-2 (start1 0) end1 (start2 0) end2)
	  (let* ((str1 (cl-string str-1))
		 (str2 (cl-string str-2))
		 (nd1 (if (number? end1) end1 (length str1)))
		 (nd2 (if (number? end2) end2 (length str2)))
		 (val (if (and (not end1) (not end2) (= start1 0) (= start2 0))
			  (string>? str1 str2)
			  (string>? (subseq str1 start1 nd1)
				    (subseq str2 start2 nd2)))))
	    (and val (string-prefixes-equal str1 str2 start1 nd1 start2 nd2))))

	(define* (string-greaterp str-1 str-2 (start1 0) end1 (start2 0) end2)
	  (let* ((str1 (cl-string str-1))
		 (str2 (cl-string str-2))
		 (nd1 (if (number? end1) end1 (length str1)))
		 (nd2 (if (number? end2) end2 (length str2)))
		 (val (if (and (not end1) (not end2) (= start1 0) (= start2 0))
			  (string-ci>? str1 str2)
			  (string-ci>? (subseq str1 start1 nd1)
				       (subseq str2 start2 nd2)))))
	    (and val (string-prefixes-equal-ci str1 str2 start1 nd1 start2 nd2))))

	(define* (string>= str-1 str-2 (start1 0) end1 (start2 0) end2)
	  (let* ((str1 (cl-string str-1))
		 (str2 (cl-string str-2))
		 (nd1 (if (number? end1) end1 (length str1)))
		 (nd2 (if (number? end2) end2 (length str2)))
		 (val (if (and (not end1) (not end2) (= start1 0) (= start2 0))
			  (string>=? str1 str2)
			  (string>=? (subseq str1 start1 nd1)
				     (subseq str2 start2 nd2)))))
	    (and val (string-prefixes-equal str1 str2 start1 nd1 start2 nd2))))

	(define* (string-not-lessp str-1 str-2 (start1 0) end1 (start2 0) end2)
	  (let* ((str1 (cl-string str-1))
		 (str2 (cl-string str-2))
		 (nd1 (if (number? end1) end1 (length str1)))
		 (nd2 (if (number? end2) end2 (length str2)))
		 (val (if (and (not end1) (not end2) (= start1 0) (= start2 0))
			  (string-ci>=? str1 str2)
			  (string-ci>=? (subseq str1 start1 nd1)
					(subseq str2 start2 nd2)))))
	    (and val (string-prefixes-equal-ci str1 str2 start1 nd1 start2 nd2))))

	(define* (string/= str-1 str-2 (start1 0) end1 (start2 0) end2)
	  (let* ((str1 (cl-string str-1))
		 (str2 (cl-string str-2))
		 (nd1 (if (number? end1) end1 (length str1)))
		 (nd2 (if (number? end2) end2 (length str2)))
		 (val (if (and (not end1) (not end2) (= start1 0) (= start2 0))
			  (not (string=? str1 str2))
			  (not (string=? (subseq str1 start1 nd1)
					 (subseq str2 start2 nd2))))))
	    (and val (string-prefixes-equal str1 str2 start1 nd1 start2 nd2))))
	
	(define* (string-not-equal str-1 str-2 (start1 0) end1 (start2 0) end2)
	  (let* ((str1 (cl-string str-1))
		 (str2 (cl-string str-2))
		 (nd1 (if (number? end1) end1 (length str1)))
		 (nd2 (if (number? end2) end2 (length str2)))
		 (val (if (and (not end1) (not end2) (= start1 0) (= start2 0))
			  (not (string-ci=? str1 str2))
			  (not (string-ci=? (subseq str1 start1 nd1)
					    (subseq str2 start2 nd2))))))
	    (and val (string-prefixes-equal-ci str1 str2 start1 nd1 start2 nd2))))

	(define (string-left-trim bag str-1)
	  (let ((str (cl-string str-1)))
	    (if (string? bag) (set! bag (string->list bag)))
	    (let ((len (length str)))
	      (do ((i 0 (+ i 1)))
		  ((or (= i len)
		       (not (member (str i) bag)))
		   (if (= i 0)
		       str
		       (subseq str i)))))))
		 
	(define (string-right-trim bag str-1)
	  (let ((str (cl-string str-1)))
	    (if (string? bag) (set! bag (string->list bag)))
	    (let ((len (length str)))
	      (do ((i (- len 1) (- i 1)))
		  ((or (< i 0)
		       (not (member (str i) bag)))
		   (if (= i (- len 1))
		       str
		       (subseq str 0 (+ i 1))))))))
		 
	(define (string-trim bag str)
	  (string-right-trim bag (string-left-trim bag str)))

	(define* (nstring-upcase str (start 0) end)
	  (let ((nd (if (number? end) end (length str))))
	    (do ((i start (+ i 1)))
		((= i nd) str)
	      (set! (str i) (char-upcase (str i))))))

	(define* (cl-string-upcase str-1 (start 0) end)
	  (let ((str (cl-string str-1)))
	    (nstring-upcase (copy str) start end)))

	(define* (nstring-downcase str (start 0) end)
	  (let ((nd (if (number? end) end (length str))))
	    (do ((i start (+ i 1)))
		((= i nd) str)
	      (set! (str i) (char-downcase (str i))))))

	(define* (cl-string-downcase str-1 (start 0) end)
	  (let ((str (cl-string str-1)))
	    (nstring-downcase (copy str) start end)))

	(define* (nstring-capitalize str-1 (start 0) end)
	  (define (alpha? c) 
	    (or (char-alphabetic? c) 
		(char-numeric? c)))
	  (let ((str (cl-string str-1)))
	    (let ((nd (if (number? end) end (length str))))
	      (do ((i start (+ i 1)))
		  ((= i nd) str)
		(if (alpha? (str i))
		    (if (or (= i 0)
			    (not (alpha? (str (- i 1)))))
			(set! (str i) (char-upcase (str i)))
			(set! (str i) (char-downcase (str i)))))))))

	(define* (string-capitalize str-1 (start 0) end)
	  (let ((str (cl-string str-1)))
	    (nstring-capitalize (copy str) start end)))

	(let ()
	  (define* (union list1 list2 (test eql) (key identity))
	    (let ((new-list (copy list1)))
	      (do ((obj list2 (cdr obj)))
		  ((null? obj) new-list)
		(set! new-list (adjoin (car obj) new-list test key)))))
	  
	  (define nunion union) ; this is not required to be destructive
	  
	  (define* (intersection list1 list2 (test eql) (key identity))
	    (let ((new-list ()))
	      (do ((obj list1 (cdr obj)))
		  ((null? obj) new-list)
		(if (not (null? (cl-member (key (car obj)) list2 test key)))
		    (set! new-list (adjoin (car obj) new-list test key))))))
	  
	  (define nintersection intersection)
	  
	  (define* (set-difference list1 list2 (test eql) (key identity))
	    (let ((new-list ()))
	      (do ((obj list1 (cdr obj)))
		  ((null? obj) new-list)
		(if (null? (cl-member (key (car obj)) list2 test key))
		    (set! new-list (adjoin (car obj) new-list test key))))))
	  
	  (define nset-difference set-difference)
	  
	  (define* (set-exclusive-or list1 list2 (test eql) (key identity))
	    (let ((new-list ()))
	      (do ((obj list1 (cdr obj)))
		  ((null? obj))
		(if (null? (cl-member (key (car obj)) list2 test key))
		    (set! new-list (adjoin (car obj) new-list test key))))
	      (do ((obj list2 (cdr obj)))
		  ((null? obj) new-list)
		(if (null? (cl-member (key (car obj)) list1 test key))
		    (set! new-list (adjoin (car obj) new-list test key))))))
	  
	  (define nset-exclusive-or set-exclusive-or)
	  
	  (define* (subsetp list1 list2 (test eql) (key identity))
	    (call-with-exit
	     (lambda (return)
	       (do ((obj list1 (cdr obj)))
		   ((null? obj) #t)
		 (if (null? (cl-member (key (car obj)) list2 test key))
		     (return nil))))))
	  
	  (test-t (subsetp '(1 2 3) '(1 2 3)))
	  (test-t (subsetp '(1 2 3) '(3 2 1)))
	  (test-t (subsetp '(1 2 3) '(2 1 3)))
	  (test-t (null (subsetp '(1 2 3 4) '(2 1 3))))
	  (test-t (subsetp '(1) '(2 1 3)))
	  (test-t (subsetp '(1 2) '(1 2 3 4 5 6 7 8)))
	  (test-t (subsetp '(1 2 3 4 5) '(8 7 6 5 4 3 2 1)))
	  (test-t (null (subsetp '("car" "ship" "airplane" "submarine") '("car" "ship" "horse" "airplane" "submarine" "camel"))))
	  (test-t (subsetp '("car" "ship" "airplane" "submarine")
			   '("car" "ship" "horse" "airplane" "submarine" "camel")
			   :test equal))
	  (test-t (subsetp '("CAR" "SHIP" "AIRPLANE" "SUBMARINE")
			   '("car" "ship" "horse" "airplane" "submarine" "camel")
			   :test equalp))
	  (test-t (subsetp '(("car") ("ship") ("airplane") ("submarine"))
			   '(("car") ("ship") ("horse") ("airplane") ("submarine") ("camel"))
			   :test string=
			   :key car))
	  
	  (test-t (null (union () ())))
	  (test-t (null (nunion () ())))
	  (test-t (null (set-difference (union '(1 2 3) '(2 3 4)) '(1 2 3 4))))
	  (test-t (null (set-difference (nunion (list 1 2 3) (list 2 3 4)) '(1 2 3 4))))
	  (test-t (null (set-difference (union '(1 2 3) '(1 2 3)) '(1 2 3))))
	  (test-t (null (set-difference (nunion (list 1 2 3) (list 1 2 3)) '(1 2 3))))
	  (test-t (null (set-difference (union '(1) '(3 2 1)) '(1 2 3))))
	  (test-t (null (set-difference (nunion (list 1) (list 3 2 1)) '(1 2 3))))
	  (test-t (null (set-difference (union '(1 2 3) ()) '(1 2 3))))
	  (test-t (null (set-difference (nunion (list 1 2 3) ()) '(1 2 3))))
	  (test-t (null (set-difference (union () '(1 2 3)) '(1 2 3))))
	  (test-t (null (set-difference (nunion () (list 1 2 3)) '(1 2 3))))
	  (test-t (null (set-difference (union '(1 2 3) '(2)) '(1 2 3))))
	  (test-t (null (set-difference (nunion (list 1 2 3) (list 2)) '(1 2 3))))
	  
	  (let ((list1 (list 1 1 2 3 4 'a 'b 'c "A" "B" "C" "d"))
		(list2 (list 1 4 5 'b 'c 'd "a" "B" "c" "D")))
	    (test-t (null (set-exclusive-or (intersection list1 list2) '(c b 4 1 1))))
	    (test-t (null (set-exclusive-or (intersection list1 list2 :test equal)
					    '("B" c b 4 1 1)
					    :test equal)))
	    (test-t (null (set-exclusive-or (intersection list1 list2 :test equalp)
					    '("d" "C" "B" "A" c b 4 1 1)
					    :test equalp))))
	  (test-t (null (intersection '(0 1 2) ())))
	  (test-t (null (intersection () ())))
	  (test-t (null (intersection () '(0 1 2))))
	  (test-t (equal (intersection '(0) '(0)) '(0)))
	  (test-t (equal (intersection '(0 1 2 3) '(2)) '(2)))
	  (test-t (cl-member 0 (intersection '(0 0 0 0 0) '(0 1 2 3 4 5))))
	  (test-t (null (set-exclusive-or (intersection '(0 1 2 3 4) '(4 3 2 1 0)) '(4 3 2 1 0))))
	  (test-t (null (set-exclusive-or (intersection '(0 1 2 3 4) '(0 1 2 3 4)) '(0 1 2 3 4))))
	  (test-t (null (set-exclusive-or (intersection '(0 1 2 3 4) '(4 3 2 1 0)) '(0 1 2 3 4))))
	  (test-t (let ((list1 (list "A" "B" "C" "d" "e" "F" "G" "h"))
			(list2 (list "a" "B" "c" "D" "E" "F" "g" "h")))
		    (null (set-exclusive-or (intersection list1 list2
							  :test char=
							  :key (lambda (x) (char x 0)))
					    '("B" "F" "h")
					    :test char=
					    :key (lambda (x) (char x 0))))))
	  (test-t (let ((list1 (list "A" "B" "C" "d" "e" "F" "G" "h"))
			(list2 (list "a" "B" "c" "D" "E" "F" "g" "h")))
		    (null (set-exclusive-or (intersection list1 list2
							  :test char-equal
							  :key (lambda (x) (char x 0)))
					    '("A" "B" "C" "d" "e" "F" "G" "h")
					    :test char-equal
					    :key (lambda (x) (char x 0))))))
	  (test-t (let ((list1 (list "A" "B" "C" "d"))
			(list2 (list "D" "E" "F" "g" "h")))
		    (null (set-exclusive-or (intersection list1 list2
							  :test char-equal
							  :key (lambda (x) (char x 0)))
					    '("d")
					    :test char-equal
					    :key (lambda (x) (char x 0))))))
	  (let ((list1 (list 1 1 2 3 4 'a 'b 'c "A" "B" "C" "d"))
		(list2 (list 1 4 5 'b 'c 'd "a" "B" "c" "D")))
	    (test-t (null (set-exclusive-or (nintersection (copy-list list1) list2) '(c b 4 1 1))))
	    (test-t (null (set-exclusive-or (nintersection (copy-list list1) list2 :test equal)
					    '("B" c b 4 1 1)
					    :test equal)))
	    (test-t (null (set-exclusive-or (nintersection (copy-list list1) list2 :test equalp)
					    '("d" "C" "B" "A" c b 4 1 1)
					    :test equalp))))
	  (test-t (null (nintersection (list 0 1 2) ())))
	  (test-t (null (nintersection () ())))
	  (test-t (null (nintersection () '(0 1 2))))
	  (test-t (equal (nintersection (list 0) '(0)) '(0)))
	  (test-t (equal (nintersection (list 0 1 2 3) '(2)) '(2)))
	  (test-t (cl-member 0 (nintersection (list 0 0 0 0 0) '(0 1 2 3 4 5))))
	  (test-t (null (set-exclusive-or (nintersection (list 0 1 2 3 4) '(4 3 2 1 0)) '(4 3 2 1 0))))
	  (test-t (null (set-exclusive-or (nintersection (list 0 1 2 3 4) '(0 1 2 3 4)) '(0 1 2 3 4))))
	  (test-t (null (set-exclusive-or (nintersection (list 0 1 2 3 4) '(4 3 2 1 0)) '(0 1 2 3 4))))
	  (test-t (let ((list1 (list "A" "B" "C" "d" "e" "F" "G" "h"))
			(list2 (list "a" "B" "c" "D" "E" "F" "g" "h")))
		    (null (set-exclusive-or (nintersection list1 list2
							   :test char=
							   :key (lambda (x) (char x 0)))
					    '("B" "F" "h")
					    :test char=
					    :key (lambda (x) (char x 0))))))
	  (test-t (let ((list1 (list "A" "B" "C" "d" "e" "F" "G" "h"))
			(list2 (list "a" "B" "c" "D" "E" "F" "g" "h")))
		    (null (set-exclusive-or (nintersection list1 list2
							   :test char-equal
							   :key (lambda (x) (char x 0)))
					    '("A" "B" "C" "d" "e" "F" "G" "h")
					    :test char-equal
					    :key (lambda (x) (char x 0))))))
	  (test-t (let ((list1 (list "A" "B" "C" "d"))
			(list2 (list "D" "E" "F" "g" "h")))
		    (null (set-exclusive-or (nintersection list1 list2
							   :test char-equal
							   :key (lambda (x) (char x 0)))
					    '("d")
					    :test char-equal
					    :key (lambda (x) (char x 0))))))
	  
	  
	  (test-t (null (set-difference (set-difference '(1 2 3 4 5 6 7 8 9)
							'(2 4 6 8))
					'(1 3 5 7 9))))
	  (test-t (null (nset-difference (set-difference (list 1 2 3 4 5 6 7 8 9)
							 '(2 4 6 8))
					 '(1 3 5 7 9))))
	  (test-t (null (set-difference () ())))
	  (test-t (null (set-difference () () :test equal :key 'identity)))
	  (test-t (null (nset-difference () ())))
	  (test-t (null (set-difference () '(1 2 3))))
	  (test-t (null (set-difference () '(1 2 3) :test equal :key 'identity)))
	  (test-t (null (nset-difference () '(1 2 3))))
	  (test-t (null (set-difference '(1 2 3 4) '(4 3 2 1))))
	  (test-t (null (nset-difference (list 1 2 3 4) '(4 3 2 1))))
	  (test-t (null (set-difference '(1 2 3 4) '(2 4 3 1))))
	  (test-t (null (nset-difference (list 1 2 3 4) '(2 4 3 1))))
	  (test-t (null (set-difference '(1 2 3 4) '(1 3 4 2))))
	  (test-t (null (nset-difference (list 1 2 3 4) '(1 3 4 2))))
	  (test-t (null (set-difference '(1 2 3 4) '(1 3 2 4))))
	  (test-t (null (nset-difference (list 1 2 3 4) '(1 3 2 4))))
	  (test-t (eq (set-difference (set-difference '(1 2 3) ()) '(1 2 3)) ()))
	  (test-t (eq (nset-difference (nset-difference (list 1 2 3) ()) '(1 2 3)) ()))
	  (test-t (eq (set-difference (set-difference '(1 2 3) '(1)) '(2 3)) ()))
	  (test-t (eq (nset-difference (nset-difference (list 1 2 3) '(1)) '(2 3)) ()))
	  (test-t (eq (set-difference (set-difference '(1 2 3) '(1 2)) '(3)) ()))
	  (test-t (eq (nset-difference (nset-difference (list 1 2 3) '(1 2)) '(3)) ()))
	  (test-t (null (set-exclusive-or (set-exclusive-or '(1 2 3) '(2 3 4)) '(1 4))))
	  (test-t (null (nset-exclusive-or (nset-exclusive-or (list 1 2 3) '(2 3 4)) '(1 4))))
	  (test-t (null (set-exclusive-or (set-exclusive-or '(1 2 3) '(1 3)) '(2))))
	  (test-t (null (nset-exclusive-or (nset-exclusive-or (list 1 2 3) '(1 3)) '(2))))
	  (test-t (null (set-exclusive-or () ())))
	  (test-t (null (nset-exclusive-or () ())))
	  (test-t (null (set-exclusive-or '(1 2 3) '(3 2 1))))
	  (test-t (null (nset-exclusive-or (list 1 2 3) '(3 2 1))))
	  (test-t (null (set-exclusive-or '(1 2 3) '(2 3 1))))
	  (test-t (null (nset-exclusive-or (list 1 2 3) '(2 3 1))))
	  (test-t (null (set-exclusive-or '(1 2 3) '(1 3 2))))
	  (test-t (null (nset-exclusive-or (list 1 2 3) '(1 3 2))))
	  (test-t (null (set-exclusive-or (set-exclusive-or '(1 2 3) ()) '(3 2 1))))
	  (test-t (null (nset-exclusive-or (nset-exclusive-or (list 1 2 3) ()) '(3 2 1))))
	  (test-t (null (set-exclusive-or (set-exclusive-or () '(1 2 3)) '(2 1 3))))
	  (test-t (null (nset-exclusive-or (nset-exclusive-or () '(1 2 3)) '(2 1 3))))
	  (test-t (null (set-exclusive-or '("car" "ship" "airplane" "submarine")
					  '("car" "ship" "airplane" "submarine")
					  :test equal)))
	  (test-t (null (nset-exclusive-or (copy-list '("car" "ship" "airplane" "submarine"))
					   '("car" "ship" "airplane" "submarine")
					   :test equal)))
	  (test-t (null (set-exclusive-or '("car" "ship" "airplane" "submarine")
					  '("CAR" "SHIP" "AIRPLANE" "SUBMARINE")
					  :test equalp)))
	  (test-t (null (nset-exclusive-or (copy-list '("car" "ship" "airplane" "submarine"))
					   '("CAR" "SHIP" "AIRPLANE" "SUBMARINE")
					   :test equalp)))
	  (test-t (null (set-exclusive-or '(("car") ("ship") ("airplane") ("submarine"))
					  '(("car") ("ship") ("airplane") ("submarine"))
					  :test string=
					  :key car)))
	  (test-t (null (nset-exclusive-or (copy-tree
					    '(("car") ("ship") ("airplane") ("submarine")))
					   '(("car") ("ship") ("airplane") ("submarine"))
					   :test string=
					   :key car)))
	  )
	
	(let ()
	  (define* (nsubstitute-if new-item test sequence from-end (start 0) end count (key identity))
	    (if (and (number? count)
		     (not (positive? count)))
		sequence
		(let* ((len (length sequence))
		       (nd (or (and (number? end) end) len))) ; up to but not including end
		  (if (< nd start)
		      (error 'out-of-range "~A :start ~A is greater than ~A ~A" __func__ start (if end ":end" "length") nd))
		  (let ((cur-count 0))
		    (if (not (number? count))
			(set! count len))
		    (if (not from-end)
			(do ((i start (+ i 1)))
			    ((or (= cur-count count)
				 (= i nd))
			     sequence)
			  (if (test (key (sequence i)))
			      (begin
				(set! cur-count (+ cur-count 1))
				(set! (sequence i) new-item))))
			(do ((i (- nd 1) (- i 1)))
			    ((or (= cur-count count)
				 (< i start))
			     sequence)
			  (if (test (key (sequence i)))
			      (begin
				(set! cur-count (+ cur-count 1))
				(set! (sequence i) new-item)))))))))
	  
	  (define* (nsubstitute-if-not new-item test sequence from-end (start 0) end count (key identity))
	    (nsubstitute-if new-item (lambda (obj) (not (test obj))) sequence from-end start end count key))
	  
	  (define* (nsubstitute new-item old-item sequence from-end (test eql) (start 0) end count (key identity))
	    (nsubstitute-if new-item (lambda (arg) (test old-item arg)) sequence from-end start end count key))
	  
	  (define* (substitute-if new-item test sequence from-end (start 0) end count (key identity))
	    (nsubstitute-if new-item test (copy sequence) from-end start end count key))
	  
	  (define* (substitute-if-not new-item test sequence from-end (start 0) end count (key identity))
	    (substitute-if new-item (lambda (obj) (not (test obj))) (copy sequence) from-end start end count key))
	  
	  (define* (substitute new-item old-item sequence from-end (test eql) (start 0) end count (key identity))
	    (nsubstitute new-item old-item (copy sequence) from-end test start end count key))


	  (test-t (equal (substitute #\. #\space "0 2 4 6") "0.2.4.6"))
	  (test-t (equal (substitute 9 4 '(1 2 4 1 3 4 5)) '(1 2 9 1 3 9 5)))
	  (test-t (equal (substitute 9 4 '(1 2 4 1 3 4 5) :count 1) '(1 2 9 1 3 4 5)))
	  (test-t (equal (substitute 9 4 '(1 2 4 1 3 4 5) :count 1 :from-end t) '(1 2 4 1 3 9 5)))
	  (test-t (equal (substitute 9 3 '(1 2 4 1 3 4 5) :test >) '(9 9 4 9 3 4 5)))
	  (test-t (equal (substitute-if 0 evenp '((1) (2) (3) (4)) :start 2 :key car) '((1) (2) (3) 0)))
	  (test-t (equal (substitute-if 9 oddp '(1 2 4 1 3 4 5)) '(9 2 4 9 9 4 9)))
	  (test-t (equal (substitute-if 9 evenp '(1 2 4 1 3 4 5) :count 1 :from-end t) '(1 2 4 1 3 9 5)))
	  
	  (test-t (let ((some-things (list 'a 'car 'b 'cdr 'c)))
		    (and (equal (nsubstitute-if "function was here" fboundp some-things
						:count 1 :from-end t)
				'(a car b "function was here" c))
			 (equal some-things '(a car b "function was here" c)))))
	  (test-t (let ((alpha-tester (copy-seq "ab "))) (and (equal (nsubstitute-if-not #\z alpha-char-p alpha-tester) "abz") (equal alpha-tester "abz"))))
	  (test-t (equal (substitute 'a 'x '(x y z)) '(a y z)))
	  (test-t (equal (substitute 'b 'y '(x y z)) '(x b z)))
	  (test-t (equal (substitute 'c 'z '(x y z)) '(x y c)))
	  (test-t (equal (substitute 'a 'p '(x y z)) '(x y z)))
	  (test-t (equal (substitute 'a 'x ()) ()))
	  (test-t (equal (substitute #\x #\b '(#\a #\b #\c #\d #\e) :test char<) '(#\a #\b #\x #\x #\x)))
	  (test-t (equal (substitute '(a) 'x '((x) (y) (z)) :key car) '((a) (y) (z))))
	  (test-t (equal (substitute 'c 'b '(a b a b a b a b)) '(a c a c a c a c)))
	  (test-t (equal (substitute 'a 'b '(b b b)) '(a a a)))
	  (define axbx-etc '(a x b x c x d x e x f))
	  (test-t (equal (substitute 'z 'x axbx-etc) '(a z b z c z d z e z f)))
	  (test-t (equal (substitute 'z 'x axbx-etc :count nil) '(a z b z c z d z e z f)))
	  (test-t (equal (substitute 'z 'x axbx-etc :count 0) axbx-etc))
	  (test-t (equal (substitute 'z 'x axbx-etc :count -100) axbx-etc))
	  (test-t (equal (substitute 'z 'x axbx-etc :count 1) '(a z b x c x d x e x f)))
	  (test-t (equal (substitute 'z 'x axbx-etc :count 2) '(a z b z c x d x e x f)))
	  (test-t (equal (substitute 'z 'x axbx-etc :count 3) '(a z b z c z d x e x f)))
	  (test-t (equal (substitute 'z 'x axbx-etc :count 4) '(a z b z c z d z e x f)))
	  (test-t (equal (substitute 'z 'x axbx-etc :count 5) '(a z b z c z d z e z f)))
	  (test-t (equal (substitute 'z 'x axbx-etc :count 6) '(a z b z c z d z e z f)))
	  (test-t (equal (substitute 'z 'x axbx-etc :count 7) '(a z b z c z d z e z f)))
	  (test-t (equal (substitute 'z 'x axbx-etc :count nil :from-end t) '(a z b z c z d z e z f)))
	  (test-t (equal (substitute 'z 'x axbx-etc :count 0 :from-end t) axbx-etc))
	  (test-t (equal (substitute 'z 'x axbx-etc :count -100 :from-end t) axbx-etc))
	  (test-t (equal (substitute 'z 'x axbx-etc :count 1 :from-end t) '(a x b x c x d x e z f)))
	  (test-t (equal (substitute 'z 'x axbx-etc :count 2 :from-end t) '(a x b x c x d z e z f)))
	  (test-t (equal (substitute 'z 'x axbx-etc :count 3 :from-end t) '(a x b x c z d z e z f)))
	  (test-t (equal (substitute 'z 'x axbx-etc :count 4 :from-end t) '(a x b z c z d z e z f)))
	  (test-t (equal (substitute 'z 'x axbx-etc :count 5 :from-end t) '(a z b z c z d z e z f)))
	  (test-t (equal (substitute 'z 'x axbx-etc :count 6 :from-end t) '(a z b z c z d z e z f)))
	  (test-t (equal (substitute 'z 'x axbx-etc :count 7 :from-end t) '(a z b z c z d z e z f)))
	  (test-t (equal (substitute 'z 'x axbx-etc :start 2 :count 1) '(a x b z c x d x e x f)))
	  (test-t (equal (substitute 'z 'x axbx-etc :start 2 :end nil :count 1) '(a x b z c x d x e x f)))
	  (test-t (equal (substitute 'z 'x axbx-etc :start 2 :end 6 :count 100) '(a x b z c z d x e x f)))
	  (test-t (equal (substitute 'z 'x axbx-etc :start 2 :end 11 :count 100) '(a x b z c z d z e z f)))
	  (test-t (equal (substitute 'z 'x axbx-etc :start 2 :end 8 :count 10) '(a x b z c z d z e x f)))
	  (test-t (equal (substitute 'z 'x axbx-etc :start 2 :end 8 :count 2 :from-end t) '(a x b x c z d z e x f)))
	  (test-t (equal (substitute #\z #\c '(#\a #\b #\c #\d #\e #\f) :test char<) '(#\a #\b #\c #\z #\z #\z)))
	  (test-t (equal (substitute "peace" "war" '("war" "War" "WAr" "WAR") :test string-equal) '("peace" "peace" "peace" "peace")))
	  (test-t (equal (substitute "peace" "WAR" '("war" "War" "WAr" "WAR") :test string=) '("war" "War" "WAr" "peace")))
	  (test-t (equal (substitute "peace" "WAR" '("war" "War" "WAr" "WAR") :test string= :key cl-string-upcase) '("peace" "peace" "peace" "peace")))
	  (test-t (equal (substitute "peace" "WAR" '("war" "War" "WAr" "WAR") :start 1 :end 2 :test string= :key cl-string-upcase) '("war" "peace" "WAr" "WAR")))
	  (test-t (equal (substitute "peace" "WAR" '("war" "War" "WAr" "WAR") :start 1 :end nil :test string= :key cl-string-upcase) '("war" "peace" "peace" "peace")))
	  (test-t (equal (substitute "peace" "war" '("war" "War" "WAr" "WAR") :test string= :key cl-string-upcase) '("war" "War" "WAr" "WAR")))
	  (test-t (equalp (substitute 'a 'x #(x y z)) #(a y z)))
	  (test-t (equalp (substitute 'b 'y #(x y z)) #(x b z)))
	  (test-t (equalp (substitute 'c 'z #(x y z)) #(x y c)))
	  (test-t (equalp (substitute 'a 'p #(x y z)) #(x y z)))
	  (test-t (equalp (substitute 'a 'x #()) #()))
	  (test-t (equalp (substitute #\x #\b #(#\a #\b #\c #\d #\e) :test char<) #(#\a #\b #\x #\x #\x)))
	  (test-t (equalp (substitute '(a) 'x #((x) (y) (z)) :key car) #((a) (y) (z))))
	  (test-t (equalp (substitute 'c 'b #(a b a b a b a b)) #(a c a c a c a c)))
	  (test-t (equalp (substitute 'a 'b #(b b b)) #(a a a)))
	  (test-t (equalp (substitute 'z 'x #(a x b x c x d x e x f)) #(a z b z c z d z e z f)))
	  (test-t (equalp (substitute 'z 'x #(a x b x c x d x e x f) :count nil) #(a z b z c z d z e z f)))
	  (test-t (equalp (substitute 'z 'x #(a x b x c x d x e x f) :count 0) #(a x b x c x d x e x f)))
	  (test-t (equalp (substitute 'z 'x #(a x b x c x d x e x f) :count -100) #(a x b x c x d x e x f)))
	  (test-t (equalp (substitute 'z 'x #(a x b x c x d x e x f) :count 1) #(a z b x c x d x e x f)))
	  (test-t (equalp (substitute 'z 'x #(a x b x c x d x e x f) :count 2) #(a z b z c x d x e x f)))
	  (test-t (equalp (substitute 'z 'x #(a x b x c x d x e x f) :count 3) #(a z b z c z d x e x f)))
	  (test-t (equalp (substitute 'z 'x #(a x b x c x d x e x f) :count 4) #(a z b z c z d z e x f)))
	  (test-t (equalp (substitute 'z 'x #(a x b x c x d x e x f) :count 5) #(a z b z c z d z e z f)))
	  (test-t (equalp (substitute 'z 'x #(a x b x c x d x e x f) :count 6) #(a z b z c z d z e z f)))
	  (test-t (equalp (substitute 'z 'x #(a x b x c x d x e x f) :count 7) #(a z b z c z d z e z f)))
	  (test-t (equalp (substitute 'z 'x #(a x b x c x d x e x f) :count nil :from-end t) #(a z b z c z d z e z f)))
	  (test-t (equalp (substitute 'z 'x #(a x b x c x d x e x f) :count 0 :from-end t) #(a x b x c x d x e x f)))
	  (test-t (equalp (substitute 'z 'x #(a x b x c x d x e x f) :count -100 :from-end t) #(a x b x c x d x e x f)))
	  (test-t (equalp (substitute 'z 'x #(a x b x c x d x e x f) :count 1 :from-end t) #(a x b x c x d x e z f)))
	  (test-t (equalp (substitute 'z 'x #(a x b x c x d x e x f) :count 2 :from-end t) #(a x b x c x d z e z f)))
	  (test-t (equalp (substitute 'z 'x #(a x b x c x d x e x f) :count 3 :from-end t) #(a x b x c z d z e z f)))
	  (test-t (equalp (substitute 'z 'x #(a x b x c x d x e x f) :count 4 :from-end t) #(a x b z c z d z e z f)))
	  (test-t (equalp (substitute 'z 'x #(a x b x c x d x e x f) :count 5 :from-end t) #(a z b z c z d z e z f)))
	  (test-t (equalp (substitute 'z 'x #(a x b x c x d x e x f) :count 6 :from-end t) #(a z b z c z d z e z f)))
	  (test-t (equalp (substitute 'z 'x #(a x b x c x d x e x f) :count 7 :from-end t) #(a z b z c z d z e z f)))
	  (test-t (equalp (substitute 'z 'x #(a x b x c x d x e x f) :start 2 :count 1) #(a x b z c x d x e x f)))
	  (test-t (equalp (substitute 'z 'x #(a x b x c x d x e x f) :start 2 :end nil :count 1) #(a x b z c x d x e x f)))
	  (test-t (equalp (substitute 'z 'x #(a x b x c x d x e x f) :start 2 :end 6 :count 100) #(a x b z c z d x e x f)))
	  (test-t (equalp (substitute 'z 'x #(a x b x c x d x e x f) :start 2 :end 11 :count 100) #(a x b z c z d z e z f)))
	  (test-t (equalp (substitute 'z 'x #(a x b x c x d x e x f) :start 2 :end 8 :count 10) #(a x b z c z d z e x f)))
	  (test-t (equalp (substitute 'z 'x #(a x b x c x d x e x f) :start 2 :end 8 :count 2 :from-end t) #(a x b x c z d z e x f)))
	  (test-t (equalp (substitute #\z #\c #(#\a #\b #\c #\d #\e #\f) :test char<) #(#\a #\b #\c #\z #\z #\z)))
	  (test-t (equalp (substitute "peace" "war" #("love" "hate" "war" "peace") :test equal) #("love" "hate" "peace" "peace")))
	  (test-t (equalp (substitute "peace" "war" #("war" "War" "WAr" "WAR") :test string-equal) #("peace" "peace" "peace" "peace")))
	  (test-t (equalp (substitute "peace" "WAR" #("war" "War" "WAr" "WAR") :test string=) #("war" "War" "WAr" "peace")))
	  (test-t (equalp (substitute "peace" "WAR" #("war" "War" "WAr" "WAR") :test string= :key cl-string-upcase) #("peace" "peace" "peace" "peace")))
	  (test-t (equalp (substitute "peace" "WAR" #("war" "War" "WAr" "WAR") :start 1 :end 2 :test string= :key cl-string-upcase) #("war" "peace" "WAr" "WAR")))
	  (test-t (equalp (substitute "peace" "WAR" #("war" "War" "WAr" "WAR") :start 1 :end nil :test string= :key cl-string-upcase) #("war" "peace" "peace" "peace")))
	  (test-t (equalp (substitute "peace" "war" #("war" "War" "WAr" "WAR") :test string= :key cl-string-upcase) #("war" "War" "WAr" "WAR")))
	  (test-t (string= (substitute #\A #\a "abcabc") "AbcAbc"))
	  (test-t (string= (substitute #\A #\a "") ""))
	  (test-t (string= (substitute #\A #\a "xyz") "xyz"))
	  (test-t (string= (substitute #\A #\a "aaaaaaaaaa" :start 5 :end nil) "aaaaaAAAAA"))
	  (test-t (string= (substitute #\x #\5 "0123456789" :test char<) "012345xxxx"))
	  (test-t (string= (substitute #\x #\5 "0123456789" :test char>) "xxxxx56789"))
	  (test-t (string= (substitute #\x #\D "abcdefg" :key char-upcase :test char>) "xxxdefg"))
	  (test-t (string= (substitute #\x #\D "abcdefg" :start 1 :end 2 :key char-upcase :test char>) "axcdefg"))
	  (test-t (string= (substitute #\A #\a "aaaaaaaaaa" :count 2) "AAaaaaaaaa"))
	  (test-t (string= (substitute #\A #\a "aaaaaaaaaa" :count -1) "aaaaaaaaaa"))
	  (test-t (string= (substitute #\A #\a "aaaaaaaaaa" :count 0) "aaaaaaaaaa"))
	  (test-t (string= (substitute #\A #\a "aaaaaaaaaa" :count nil) "AAAAAAAAAA"))
	  (test-t (string= (substitute #\A #\a "aaaaaaaaaa" :count 100) "AAAAAAAAAA"))
	  (test-t (string= (substitute #\A #\a "aaaaaaaaaa" :count 9) "AAAAAAAAAa"))
	  (test-t (string= (substitute #\A #\a "aaaaaaaaaa" :count 9 :from-end t) "aAAAAAAAAA"))
	  (test-t (string= (substitute #\A #\a "aaaaaaaaaa" :start 2 :end 8 :count 3) "aaAAAaaaaa"))
	  (test-t (string= (substitute #\A #\a "aaaaaaaaaa" :start 2 :end 8 :from-end t :count 3) "aaaaaAAAaa"))
	  (test-t (string= (substitute #\x #\A "aaaaaaaaaa" :start 2 :end 8 :from-end t :count 3) "aaaaaaaaaa"))
	  (test-t (string= (substitute #\X #\A "aaaaaaaaaa" :start 2 :end 8 :from-end t :key char-upcase :count 3) "aaaaaXXXaa"))
	  (test-t (string= (substitute #\X #\D "abcdefghij" :start 2 :end 8 :from-end t :key char-upcase :test char< :count 3) "abcdeXXXij"))
	  (test-t (equal (substitute-if 'a (lambda (arg) (eq arg 'x)) '(x y z)) '(a y z)))
	  (test-t (equal (substitute-if 'b (lambda (arg) (eq arg 'y)) '(x y z)) '(x b z)))
	  (test-t (equal (substitute-if 'c (lambda (arg) (eq arg 'z)) '(x y z)) '(x y c)))
	  (test-t (equal (substitute-if 'a (lambda (arg) (eq arg 'p)) '(x y z)) '(x y z)))
	  (test-t (equal (substitute-if 'a (lambda (arg) (eq arg 'x)) ()) ()))
	  (test-t (equal (substitute-if #\x (lambda (arg) (char< #\b arg)) '(#\a #\b #\c #\d #\e)) '(#\a #\b #\x #\x #\x)))
	  (test-t (equal (substitute-if '(a) (lambda (arg) (eq arg 'x)) '((x) (y) (z)) :key car) '((a) (y) (z))))
	  (test-t (equal (substitute-if 'c (lambda (arg) (eq arg 'b)) '(a b a b a b a b)) '(a c a c a c a c)))
	  (test-t (equal (substitute-if 'a (lambda (arg) (eq arg 'b)) '(b b b)) '(a a a)))
	  (test-t (equal (substitute-if 'z (lambda (arg) (eq arg 'x)) axbx-etc) '(a z b z c z d z e z f)))
	  (test-t (equal (substitute-if 'z (lambda (arg) (eq arg 'x)) axbx-etc :count nil) '(a z b z c z d z e z f)))
	  (test-t (equal (substitute-if 'z (lambda (arg) (eq arg 'x)) axbx-etc :count 0) axbx-etc))
	  (test-t (equal (substitute-if 'z (lambda (arg) (eq arg 'x)) axbx-etc :count -100) axbx-etc))
	  (test-t (equal (substitute-if 'z (lambda (arg) (eq arg 'x)) axbx-etc :count 1) '(a z b x c x d x e x f)))
	  (test-t (equal (substitute-if 'z (lambda (arg) (eq arg 'x)) axbx-etc :count 2) '(a z b z c x d x e x f)))
	  (test-t (equal (substitute-if 'z (lambda (arg) (eq arg 'x)) axbx-etc :count 3) '(a z b z c z d x e x f)))
	  (test-t (equal (substitute-if 'z (lambda (arg) (eq arg 'x)) axbx-etc :count 4) '(a z b z c z d z e x f)))
	  (test-t (equal (substitute-if 'z (lambda (arg) (eq arg 'x)) axbx-etc :count 5) '(a z b z c z d z e z f)))
	  (test-t (equal (substitute-if 'z (lambda (arg) (eq arg 'x)) axbx-etc :count 6) '(a z b z c z d z e z f)))
	  (test-t (equal (substitute-if 'z (lambda (arg) (eq arg 'x)) axbx-etc :count 7) '(a z b z c z d z e z f)))
	  (test-t (equal (substitute-if 'z (lambda (arg) (eq arg 'x)) axbx-etc :count nil :from-end t) '(a z b z c z d z e z f)))
	  (test-t (equal (substitute-if 'z (lambda (arg) (eq arg 'x)) axbx-etc :count 0 :from-end t) axbx-etc))
	  (test-t (equal (substitute-if 'z (lambda (arg) (eq arg 'x)) axbx-etc :count -100 :from-end t) axbx-etc))
	  (test-t (equal (substitute-if 'z (lambda (arg) (eq arg 'x)) axbx-etc :count 1 :from-end t) '(a x b x c x d x e z f)))
	  (test-t (equal (substitute-if 'z (lambda (arg) (eq arg 'x)) axbx-etc :count 2 :from-end t) '(a x b x c x d z e z f)))
	  (test-t (equal (substitute-if 'z (lambda (arg) (eq arg 'x)) axbx-etc :count 3 :from-end t) '(a x b x c z d z e z f)))
	  (test-t (equal (substitute-if 'z (lambda (arg) (eq arg 'x)) axbx-etc :count 4 :from-end t) '(a x b z c z d z e z f)))
	  (test-t (equal (substitute-if 'z (lambda (arg) (eq arg 'x)) axbx-etc :count 5 :from-end t) '(a z b z c z d z e z f)))
	  (test-t (equal (substitute-if 'z (lambda (arg) (eq arg 'x)) axbx-etc :count 6 :from-end t) '(a z b z c z d z e z f)))
	  (test-t (equal (substitute-if 'z (lambda (arg) (eq arg 'x)) axbx-etc :count 7 :from-end t) '(a z b z c z d z e z f)))
	  (test-t (equal (substitute-if 'z (lambda (arg) (eq arg 'x)) axbx-etc :start 2 :count 1) '(a x b z c x d x e x f)))
	  (test-t (equal (substitute-if 'z (lambda (arg) (eq arg 'x)) axbx-etc :start 2 :end nil :count 1) '(a x b z c x d x e x f)))
	  (test-t (equal (substitute-if 'z (lambda (arg) (eq arg 'x)) axbx-etc :start 2 :end 6 :count 100) '(a x b z c z d x e x f)))
	  (test-t (equal (substitute-if 'z (lambda (arg) (eq arg 'x)) axbx-etc :start 2 :end 11 :count 100) '(a x b z c z d z e z f)))
	  (test-t (equal (substitute-if 'z (lambda (arg) (eq arg 'x)) axbx-etc :start 2 :end 8 :count 10) '(a x b z c z d z e x f)))
	  (test-t (equal (substitute-if 'z (lambda (arg) (eq arg 'x)) axbx-etc :start 2 :end 8 :count 2 :from-end t) '(a x b x c z d z e x f)))
	  (test-t (equal (substitute-if #\z (lambda (arg) (char< #\c arg)) '(#\a #\b #\c #\d #\e #\f)) '(#\a #\b #\c #\z #\z #\z)))
	  (test-t (equal (substitute-if "peace" (lambda (arg) (equal "war" arg)) '("love" "hate" "war" "peace")) '("love" "hate" "peace" "peace")))
	  (test-t (equal (substitute-if "peace" (lambda (arg) (string-equal "war" arg)) '("war" "War" "WAr" "WAR")) '("peace" "peace" "peace" "peace")))
	  (test-t (equal (substitute-if "peace" (lambda (arg) (string= "WAR" arg)) '("war" "War" "WAr" "WAR") :key cl-string-upcase) '("peace" "peace" "peace" "peace")))
	  (test-t (equal (substitute-if "peace" (lambda (arg) (string= "WAR" arg)) '("war" "War" "WAr" "WAR") :start 1 :end 2 :key string-upcase) '("war" "peace" "WAr" "WAR")))
	  (test-t (equal (substitute-if "peace" (lambda (arg) (string= "WAR" arg)) '("war" "War" "WAr" "WAR") :start 1 :end nil :key string-upcase) '("war" "peace" "peace" "peace")))
	  (test-t (equal (substitute-if "peace" (lambda (arg) (string= "war" arg)) '("war" "War" "WAr" "WAR") :key string-upcase) '("war" "War" "WAr" "WAR")))
	  (test-t (equal (substitute-if "peace" (lambda (arg) (string= "WAR" arg)) '("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR") :start 1 :end 7 :count 1 :key string-upcase) '("war" "peace" "WAr" "WAR" "war" "War" "WAr" "WAR")))
	  (test-t (equal (substitute-if "peace" (lambda (arg) (string= "WAR" arg)) '("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR") :start 1 :end 7 :count 2 :key string-upcase) '("war" "peace" "peace" "WAR" "war" "War" "WAr" "WAR")))
	  (test-t (equal (substitute-if "peace" (lambda (arg) (string= "WAR" arg)) '("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR") :start 1 :end 7 :count 2 :from-end t :key string-upcase) '("war" "War" "WAr" "WAR" "war" "peace" "peace" "WAR")))
	  (test-t (equal (substitute-if "peace" (lambda (arg) (string= "WAR" arg)) '("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR") :start 1 :end 7 :count 0 :from-end t :key string-upcase) '("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR")))
	  (test-t (equal (substitute-if "peace" (lambda (arg) (string= "WAR" arg)) '("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR") :start 1 :end 7 :count -2 :from-end t :key string-upcase) '("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR")))
	  (test-t (equal (substitute-if "peace" (lambda (arg) (string= "WAR" arg)) '("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR") :start 1 :end 7 :count nil :from-end t :key string-upcase) '("war" "peace" "peace" "peace" "peace" "peace" "peace" "WAR")))
	  (test-t (equal (substitute-if "peace" (lambda (arg) (string= "WAR" arg)) '("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR") :start 1 :end 7 :count 6 :from-end t :key string-upcase) '("war" "peace" "peace" "peace" "peace" "peace" "peace" "WAR")))
	  (test-t (equal (substitute-if "peace" (lambda (arg) (string= "WAR" arg)) '("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR") :start 1 :end 7 :count 7 :from-end t :key string-upcase) '("war" "peace" "peace" "peace" "peace" "peace" "peace" "WAR")))
	  (test-t (equal (substitute-if "peace" (lambda (arg) (string= "WAR" arg)) '("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR") :start 1 :end 7 :count 100 :from-end t :key string-upcase) '("war" "peace" "peace" "peace" "peace" "peace" "peace" "WAR")))
	  
	  (test-t (equalp (substitute-if 'a (lambda (arg) (eq arg 'x)) #(x y z)) #(a y z)))
	  (test-t (equalp (substitute-if 'b (lambda (arg) (eq arg 'y)) #(x y z)) #(x b z)))
	  (test-t (equalp (substitute-if 'c (lambda (arg) (eq arg 'z)) #(x y z)) #(x y c)))
	  (test-t (equalp (substitute-if 'a (lambda (arg) (eq arg 'p)) #(x y z)) #(x y z)))
	  (test-t (equalp (substitute-if 'a (lambda (arg) (eq arg 'x)) #()) #()))
	  (test-t (equalp (substitute-if #\x (lambda (arg) (char< #\b arg)) #(#\a #\b #\c #\d #\e)) #(#\a #\b #\x #\x #\x)))
	  (test-t (equalp (substitute-if '(a) (lambda (arg) (eq arg 'x)) #((x) (y) (z)) :key car) #((a) (y) (z))))
	  (test-t (equalp (substitute-if 'c (lambda (arg) (eq arg 'b)) #(a b a b a b a b)) #(a c a c a c a c)))
	  (test-t (equalp (substitute-if 'a (lambda (arg) (eq arg 'b)) #(b b b)) #(a a a)))
	  (test-t (equalp (substitute-if 'z (lambda (arg) (eq arg 'x)) #(a x b x c x d x e x f)) #(a z b z c z d z e z f)))
	  (test-t (equalp (substitute-if 'z (lambda (arg) (eq arg 'x)) #(a x b x c x d x e x f) :count nil) #(a z b z c z d z e z f)))
	  (test-t (equalp (substitute-if 'z (lambda (arg) (eq arg 'x)) #(a x b x c x d x e x f) :count 0) #(a x b x c x d x e x f)))
	  (test-t (equalp (substitute-if 'z (lambda (arg) (eq arg 'x)) #(a x b x c x d x e x f) :count -100) #(a x b x c x d x e x f)))
	  (test-t (equalp (substitute-if 'z (lambda (arg) (eq arg 'x)) #(a x b x c x d x e x f) :count 1) #(a z b x c x d x e x f)))
	  (test-t (equalp (substitute-if 'z (lambda (arg) (eq arg 'x)) #(a x b x c x d x e x f) :count 2) #(a z b z c x d x e x f)))
	  (test-t (equalp (substitute-if 'z (lambda (arg) (eq arg 'x)) #(a x b x c x d x e x f) :count 3) #(a z b z c z d x e x f)))
	  (test-t (equalp (substitute-if 'z (lambda (arg) (eq arg 'x)) #(a x b x c x d x e x f) :count 4) #(a z b z c z d z e x f)))
	  (test-t (equalp (substitute-if 'z (lambda (arg) (eq arg 'x)) #(a x b x c x d x e x f) :count 5) #(a z b z c z d z e z f)))
	  (test-t (equalp (substitute-if 'z (lambda (arg) (eq arg 'x)) #(a x b x c x d x e x f) :count 6) #(a z b z c z d z e z f)))
	  (test-t (equalp (substitute-if 'z (lambda (arg) (eq arg 'x)) #(a x b x c x d x e x f) :count 7) #(a z b z c z d z e z f)))
	  (test-t (equalp (substitute-if 'z (lambda (arg) (eq arg 'x)) #(a x b x c x d x e x f) :count nil :from-end t) #(a z b z c z d z e z f)))
	  (test-t (equalp (substitute-if 'z (lambda (arg) (eq arg 'x)) #(a x b x c x d x e x f) :count 0 :from-end t) #(a x b x c x d x e x f)))
	  (test-t (equalp (substitute-if 'z (lambda (arg) (eq arg 'x)) #(a x b x c x d x e x f) :count -100 :from-end t) #(a x b x c x d x e x f)))
	  (test-t (equalp (substitute-if 'z (lambda (arg) (eq arg 'x)) #(a x b x c x d x e x f) :count 1 :from-end t) #(a x b x c x d x e z f)))
	  (test-t (equalp (substitute-if 'z (lambda (arg) (eq arg 'x)) #(a x b x c x d x e x f) :count 2 :from-end t) #(a x b x c x d z e z f)))
	  (test-t (equalp (substitute-if 'z (lambda (arg) (eq arg 'x)) #(a x b x c x d x e x f) :count 3 :from-end t) #(a x b x c z d z e z f)))
	  (test-t (equalp (substitute-if 'z (lambda (arg) (eq arg 'x)) #(a x b x c x d x e x f) :count 4 :from-end t) #(a x b z c z d z e z f)))
	  (test-t (equalp (substitute-if 'z (lambda (arg) (eq arg 'x)) #(a x b x c x d x e x f) :count 5 :from-end t) #(a z b z c z d z e z f)))
	  (test-t (equalp (substitute-if 'z (lambda (arg) (eq arg 'x)) #(a x b x c x d x e x f) :count 6 :from-end t) #(a z b z c z d z e z f)))
	  (test-t (equalp (substitute-if 'z (lambda (arg) (eq arg 'x)) #(a x b x c x d x e x f) :count 7 :from-end t) #(a z b z c z d z e z f)))
	  (test-t (equalp (substitute-if 'z (lambda (arg) (eq arg 'x)) #(a x b x c x d x e x f) :start 2 :count 1) #(a x b z c x d x e x f)))
	  (test-t (equalp (substitute-if 'z (lambda (arg) (eq arg 'x)) #(a x b x c x d x e x f) :start 2 :end nil :count 1) #(a x b z c x d x e x f)))
	  (test-t (equalp (substitute-if 'z (lambda (arg) (eq arg 'x)) #(a x b x c x d x e x f) :start 2 :end 6 :count 100) #(a x b z c z d x e x f)))
	  (test-t (equalp (substitute-if 'z (lambda (arg) (eq arg 'x)) #(a x b x c x d x e x f) :start 2 :end 11 :count 100) #(a x b z c z d z e z f)))
	  (test-t (equalp (substitute-if 'z (lambda (arg) (eq arg 'x)) #(a x b x c x d x e x f) :start 2 :end 8 :count 10) #(a x b z c z d z e x f)))
	  (test-t (equalp (substitute-if 'z (lambda (arg) (eq arg 'x)) #(a x b x c x d x e x f) :start 2 :end 8 :count 2 :from-end t) #(a x b x c z d z e x f)))
	  (test-t (equalp (substitute-if #\z (lambda (arg) (char< #\c arg)) #(#\a #\b #\c #\d #\e #\f)) #(#\a #\b #\c #\z #\z #\z)))
	  (test-t (equalp (substitute-if "peace" (lambda (arg) (equal "war" arg)) #("love" "hate" "war" "peace")) #("love" "hate" "peace" "peace")))
	  (test-t (equalp (substitute-if "peace" (lambda (arg) (string-equal "war" arg)) #("war" "War" "WAr" "WAR")) #("peace" "peace" "peace" "peace")))
	  (test-t (equalp (substitute-if "peace" (lambda (arg) (string= "WAR" arg)) #("war" "War" "WAr" "WAR") :key string-upcase) #("peace" "peace" "peace" "peace")))
	  (test-t (equalp (substitute-if "peace" (lambda (arg) (string= "WAR" arg)) #("war" "War" "WAr" "WAR") :start 1 :end 2 :key string-upcase) #("war" "peace" "WAr" "WAR")))
	  (test-t (equalp (substitute-if "peace" (lambda (arg) (string= "WAR" arg)) #("war" "War" "WAr" "WAR") :start 1 :end nil :key string-upcase) #("war" "peace" "peace" "peace")))
	  (test-t (equalp (substitute-if "peace" (lambda (arg) (string= "war" arg)) #("war" "War" "WAr" "WAR") :key string-upcase) #("war" "War" "WAr" "WAR")))
	  (test-t (equalp (substitute-if "peace" (lambda (arg) (string= "WAR" arg)) #("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR") :start 1 :end 7 :count 1 :key string-upcase) #("war" "peace" "WAr" "WAR" "war" "War" "WAr" "WAR")))
	  (test-t (equalp (substitute-if "peace" (lambda (arg) (string= "WAR" arg)) #("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR") :start 1 :end 7 :count 2 :key string-upcase) #("war" "peace" "peace" "WAR" "war" "War" "WAr" "WAR")))
	  (test-t (equalp (substitute-if "peace" (lambda (arg) (string= "WAR" arg)) #("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR") :start 1 :end 7 :count 2 :from-end t :key string-upcase) #("war" "War" "WAr" "WAR" "war" "peace" "peace" "WAR")))
	  (test-t (equalp (substitute-if "peace" (lambda (arg) (string= "WAR" arg)) #("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR") :start 1 :end 7 :count 0 :from-end t :key string-upcase) #("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR")))
	  (test-t (equalp (substitute-if "peace" (lambda (arg) (string= "WAR" arg)) #("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR") :start 1 :end 7 :count -2 :from-end t :key string-upcase) #("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR")))
	  (test-t (equalp (substitute-if "peace" (lambda (arg) (string= "WAR" arg)) #("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR") :start 1 :end 7 :count nil :from-end t :key string-upcase) #("war" "peace" "peace" "peace" "peace" "peace" "peace" "WAR")))
	  (test-t (equalp (substitute-if "peace" (lambda (arg) (string= "WAR" arg)) #("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR") :start 1 :end 7 :count 6 :from-end t :key string-upcase) #("war" "peace" "peace" "peace" "peace" "peace" "peace" "WAR")))
	  (test-t (equalp (substitute-if "peace" (lambda (arg) (string= "WAR" arg)) #("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR") :start 1 :end 7 :count 7 :from-end t :key string-upcase) #("war" "peace" "peace" "peace" "peace" "peace" "peace" "WAR")))
	  (test-t (equalp (substitute-if "peace" (lambda (arg) (string= "WAR" arg)) #("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR") :start 1 :end 7 :count 100 :from-end t :key string-upcase) #("war" "peace" "peace" "peace" "peace" "peace" "peace" "WAR")))
	  (test-t (string= (substitute-if #\A (lambda (arg) (eql #\a arg)) "abcabc") "AbcAbc"))
	  (test-t (string= (substitute-if #\A (lambda (arg) (eql #\a arg)) "") ""))
	  (test-t (string= (substitute-if #\A (lambda (arg) (eql #\a arg)) "xyz") "xyz"))
	  (test-t (string= (substitute-if #\A (lambda (arg) (eql #\a arg)) "aaaaaaaaaa" :start 5 :end nil) "aaaaaAAAAA"))
	  (test-t (string= (substitute-if #\x (lambda (arg) (char< #\5 arg)) "0123456789") "012345xxxx"))
	  (test-t (string= (substitute-if #\x (lambda (arg) (char> #\5 arg)) "0123456789") "xxxxx56789"))
	  (test-t (string= (substitute-if #\x (lambda (arg) (char> #\D arg)) "abcdefg" :key char-upcase) "xxxdefg"))
	  (test-t (string= (substitute-if #\x (lambda (arg) (char> #\D arg)) "abcdefg" :start 1 :end 2 :key char-upcase) "axcdefg"))
	  (test-t (string= (substitute-if #\A (lambda (arg) (eql #\a arg)) "aaaaaaaaaa" :count 2) "AAaaaaaaaa"))
	  (test-t (string= (substitute-if #\A (lambda (arg) (eql #\a arg)) "aaaaaaaaaa" :count -1) "aaaaaaaaaa"))
	  (test-t (string= (substitute-if #\A (lambda (arg) (eql #\a arg)) "aaaaaaaaaa" :count 0) "aaaaaaaaaa"))
	  (test-t (string= (substitute-if #\A (lambda (arg) (eql #\a arg)) "aaaaaaaaaa" :count nil) "AAAAAAAAAA"))
	  (test-t (string= (substitute-if #\A (lambda (arg) (eql #\a arg)) "aaaaaaaaaa" :count 100) "AAAAAAAAAA"))
	  (test-t (string= (substitute-if #\A (lambda (arg) (eql #\a arg)) "aaaaaaaaaa" :count 9) "AAAAAAAAAa"))
	  (test-t (string= (substitute-if #\A (lambda (arg) (eql #\a arg)) "aaaaaaaaaa" :count 9 :from-end t) "aAAAAAAAAA"))
	  (test-t (string= (substitute-if #\A (lambda (arg) (eql #\a arg)) "aaaaaaaaaa" :start 2 :end 8 :count 3) "aaAAAaaaaa"))
	  (test-t (string= (substitute-if #\A (lambda (arg) (eql #\a arg)) "aaaaaaaaaa" :start 2 :end 8 :from-end t :count 3) "aaaaaAAAaa"))
	  (test-t (string= (substitute-if #\x (lambda (arg) (eql #\A arg)) "aaaaaaaaaa" :start 2 :end 8 :from-end t :count 3) "aaaaaaaaaa"))
	  (test-t (string= (substitute-if #\X (lambda (arg) (eql #\A arg)) "aaaaaaaaaa" :start 2 :end 8 :from-end t :key char-upcase :count 3) "aaaaaXXXaa"))
	  (test-t (string= (substitute-if #\X (lambda (arg) (char< #\D arg)) "abcdefghij" :start 2 :end 8 :from-end t :key char-upcase :count 3) "abcdeXXXij"))
	  (test-t (equal (substitute-if-not 'a (lambda (arg) (not (eq arg 'x))) '(x y z)) '(a y z)))
	  (test-t (equal (substitute-if-not 'b (lambda (arg) (not (eq arg 'y))) '(x y z)) '(x b z)))
	  (test-t (equal (substitute-if-not 'c (lambda (arg) (not (eq arg 'z))) '(x y z)) '(x y c)))
	  (test-t (equal (substitute-if-not 'a (lambda (arg) (not (eq arg 'p))) '(x y z)) '(x y z)))
	  (test-t (equal (substitute-if-not 'a (lambda (arg) (not (eq arg 'x))) ()) ()))
	  (test-t (equal (substitute-if-not #\x (lambda (arg) (not (char< #\b arg))) '(#\a #\b #\c #\d #\e)) '(#\a #\b #\x #\x #\x)))
	  (test-t (equal (substitute-if-not '(a) (lambda (arg) (not (eq arg 'x))) '((x) (y) (z)) :key car) '((a) (y) (z))))
	  (test-t (equal (substitute-if-not 'c (lambda (arg) (not (eq arg 'b))) '(a b a b a b a b)) '(a c a c a c a c)))
	  (test-t (equal (substitute-if-not 'a (lambda (arg) (not (eq arg 'b))) '(b b b)) '(a a a)))
	  (test-t (equal (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) axbx-etc) '(a z b z c z d z e z f)))
	  (test-t (equal (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) axbx-etc :count nil) '(a z b z c z d z e z f)))
	  (test-t (equal (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) axbx-etc :count 0) axbx-etc))
	  (test-t (equal (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) axbx-etc :count -100) axbx-etc))
	  (test-t (equal (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) axbx-etc :count 1) '(a z b x c x d x e x f)))
	  (test-t (equal (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) axbx-etc :count 2) '(a z b z c x d x e x f)))
	  (test-t (equal (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) axbx-etc :count 3) '(a z b z c z d x e x f)))
	  (test-t (equal (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) axbx-etc :count 4) '(a z b z c z d z e x f)))
	  (test-t (equal (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) axbx-etc :count 5) '(a z b z c z d z e z f)))
	  (test-t (equal (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) axbx-etc :count 6) '(a z b z c z d z e z f)))
	  (test-t (equal (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) axbx-etc :count 7) '(a z b z c z d z e z f)))
	  (test-t (equal (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) axbx-etc :count nil :from-end t) '(a z b z c z d z e z f)))
	  (test-t (equal (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) axbx-etc :count 0 :from-end t) axbx-etc))
	  (test-t (equal (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) axbx-etc :count -100 :from-end t) axbx-etc))
	  (test-t (equal (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) axbx-etc :count 1 :from-end t) '(a x b x c x d x e z f)))
	  (test-t (equal (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) axbx-etc :count 2 :from-end t) '(a x b x c x d z e z f)))
	  (test-t (equal (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) axbx-etc :count 3 :from-end t) '(a x b x c z d z e z f)))
	  (test-t (equal (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) axbx-etc :count 4 :from-end t) '(a x b z c z d z e z f)))
	  (test-t (equal (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) axbx-etc :count 5 :from-end t) '(a z b z c z d z e z f)))
	  (test-t (equal (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) axbx-etc :count 6 :from-end t) '(a z b z c z d z e z f)))
	  (test-t (equal (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) axbx-etc :count 7 :from-end t) '(a z b z c z d z e z f)))
	  (test-t (equal (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) axbx-etc :start 2 :count 1) '(a x b z c x d x e x f)))
	  (test-t (equal (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) axbx-etc :start 2 :end nil :count 1) '(a x b z c x d x e x f)))
	  (test-t (equal (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) axbx-etc :start 2 :end 6 :count 100) '(a x b z c z d x e x f)))
	  (test-t (equal (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) axbx-etc :start 2 :end 11 :count 100) '(a x b z c z d z e z f)))
	  (test-t (equal (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) axbx-etc :start 2 :end 8 :count 10) '(a x b z c z d z e x f)))
	  (test-t (equal (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) axbx-etc :start 2 :end 8 :count 2 :from-end t) '(a x b x c z d z e x f)))
	  (test-t (equal (substitute-if-not #\z (lambda (arg) (not (char< #\c arg))) '(#\a #\b #\c #\d #\e #\f)) '(#\a #\b #\c #\z #\z #\z)))
	  (test-t (equal (substitute-if-not "peace" (lambda (arg) (not (equal "war" arg))) '("love" "hate" "war" "peace")) '("love" "hate" "peace" "peace")))
	  (test-t (equal (substitute-if-not "peace" (lambda (arg) (not (string-equal "war" arg))) '("war" "War" "WAr" "WAR")) '("peace" "peace" "peace" "peace")))
	  (test-t (equal (substitute-if-not "peace" (lambda (arg) (not (string= "WAR" arg))) '("war" "War" "WAr" "WAR") :key string-upcase) '("peace" "peace" "peace" "peace")))
	  (test-t (equal (substitute-if-not "peace" (lambda (arg) (not (string= "WAR" arg))) '("war" "War" "WAr" "WAR") :start 1 :end 2 :key string-upcase) '("war" "peace" "WAr" "WAR")))
	  (test-t (equal (substitute-if-not "peace" (lambda (arg) (not (string= "WAR" arg))) '("war" "War" "WAr" "WAR") :start 1 :end nil :key string-upcase) '("war" "peace" "peace" "peace")))
	  (test-t (equal (substitute-if-not "peace" (lambda (arg) (not (string= "war" arg))) '("war" "War" "WAr" "WAR") :key string-upcase) '("war" "War" "WAr" "WAR")))
	  (test-t (equal (substitute-if-not "peace" (lambda (arg) (not (string= "WAR" arg))) '("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR") :start 1 :end 7 :count 1 :key string-upcase) '("war" "peace" "WAr" "WAR" "war" "War" "WAr" "WAR")))
	  (test-t (equal (substitute-if-not "peace" (lambda (arg) (not (string= "WAR" arg))) '("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR") :start 1 :end 7 :count 2 :key string-upcase) '("war" "peace" "peace" "WAR" "war" "War" "WAr" "WAR")))
	  (test-t (equal (substitute-if-not "peace" (lambda (arg) (not (string= "WAR" arg))) '("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR") :start 1 :end 7 :count 2 :from-end t :key string-upcase) '("war" "War" "WAr" "WAR" "war" "peace" "peace" "WAR")))
	  (test-t (equal (substitute-if-not "peace" (lambda (arg) (not (string= "WAR" arg))) '("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR") :start 1 :end 7 :count 0 :from-end t :key string-upcase) '("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR")))
	  (test-t (equal (substitute-if-not "peace" (lambda (arg) (not (string= "WAR" arg))) '("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR") :start 1 :end 7 :count -2 :from-end t :key string-upcase) '("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR")))
	  (test-t (equal (substitute-if-not "peace" (lambda (arg) (not (string= "WAR" arg))) '("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR") :start 1 :end 7 :count nil :from-end t :key string-upcase) '("war" "peace" "peace" "peace" "peace" "peace" "peace" "WAR")))
	  (test-t (equal (substitute-if-not "peace" (lambda (arg) (not (string= "WAR" arg))) '("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR") :start 1 :end 7 :count 6 :from-end t :key string-upcase) '("war" "peace" "peace" "peace" "peace" "peace" "peace" "WAR")))
	  (test-t (equal (substitute-if-not "peace" (lambda (arg) (not (string= "WAR" arg))) '("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR") :start 1 :end 7 :count 7 :from-end t :key string-upcase) '("war" "peace" "peace" "peace" "peace" "peace" "peace" "WAR")))
	  (test-t (equal (substitute-if-not "peace" (lambda (arg) (not (string= "WAR" arg))) '("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR") :start 1 :end 7 :count 100 :from-end t :key string-upcase) '("war" "peace" "peace" "peace" "peace" "peace" "peace" "WAR")))
	  (test-t (equalp (substitute-if-not 'a (lambda (arg) (not (eq arg 'x))) #(x y z)) #(a y z)))
	  (test-t (equalp (substitute-if-not 'b (lambda (arg) (not (eq arg 'y))) #(x y z)) #(x b z)))
	  (test-t (equalp (substitute-if-not 'c (lambda (arg) (not (eq arg 'z))) #(x y z)) #(x y c)))
	  (test-t (equalp (substitute-if-not 'a (lambda (arg) (not (eq arg 'p))) #(x y z)) #(x y z)))
	  (test-t (equalp (substitute-if-not 'a (lambda (arg) (not (eq arg 'x))) #()) #()))
	  (test-t (equalp (substitute-if-not #\x (lambda (arg) (not (char< #\b arg))) #(#\a #\b #\c #\d #\e)) #(#\a #\b #\x #\x #\x)))
	  (test-t (equalp (substitute-if-not '(a) (lambda (arg) (not (eq arg 'x))) #((x) (y) (z)) :key car) #((a) (y) (z))))
	  (test-t (equalp (substitute-if-not 'c (lambda (arg) (not (eq arg 'b))) #(a b a b a b a b)) #(a c a c a c a c)))
	  (test-t (equalp (substitute-if-not 'a (lambda (arg) (not (eq arg 'b))) #(b b b)) #(a a a)))
	  (test-t (equalp (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) #(a x b x c x d x e x f)) #(a z b z c z d z e z f)))
	  (test-t (equalp (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) #(a x b x c x d x e x f) :count nil) #(a z b z c z d z e z f)))
	  (test-t (equalp (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) #(a x b x c x d x e x f) :count 0) #(a x b x c x d x e x f)))
	  (test-t (equalp (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) #(a x b x c x d x e x f) :count -100) #(a x b x c x d x e x f)))
	  (test-t (equalp (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) #(a x b x c x d x e x f) :count 1) #(a z b x c x d x e x f)))
	  (test-t (equalp (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) #(a x b x c x d x e x f) :count 2) #(a z b z c x d x e x f)))
	  (test-t (equalp (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) #(a x b x c x d x e x f) :count 3) #(a z b z c z d x e x f)))
	  (test-t (equalp (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) #(a x b x c x d x e x f) :count 4) #(a z b z c z d z e x f)))
	  (test-t (equalp (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) #(a x b x c x d x e x f) :count 5) #(a z b z c z d z e z f)))
	  (test-t (equalp (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) #(a x b x c x d x e x f) :count 6) #(a z b z c z d z e z f)))
	  (test-t (equalp (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) #(a x b x c x d x e x f) :count 7) #(a z b z c z d z e z f)))
	  (test-t (equalp (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) #(a x b x c x d x e x f) :count nil :from-end t) #(a z b z c z d z e z f)))
	  (test-t (equalp (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) #(a x b x c x d x e x f) :count 0 :from-end t) #(a x b x c x d x e x f)))
	  (test-t (equalp (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) #(a x b x c x d x e x f) :count -100 :from-end t) #(a x b x c x d x e x f)))
	  (test-t (equalp (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) #(a x b x c x d x e x f) :count 1 :from-end t) #(a x b x c x d x e z f)))
	  (test-t (equalp (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) #(a x b x c x d x e x f) :count 2 :from-end t) #(a x b x c x d z e z f)))
	  (test-t (equalp (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) #(a x b x c x d x e x f) :count 3 :from-end t) #(a x b x c z d z e z f)))
	  (test-t (equalp (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) #(a x b x c x d x e x f) :count 4 :from-end t) #(a x b z c z d z e z f)))
	  (test-t (equalp (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) #(a x b x c x d x e x f) :count 5 :from-end t) #(a z b z c z d z e z f)))
	  (test-t (equalp (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) #(a x b x c x d x e x f) :count 6 :from-end t) #(a z b z c z d z e z f)))
	  (test-t (equalp (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) #(a x b x c x d x e x f) :count 7 :from-end t) #(a z b z c z d z e z f)))
	  (test-t (equalp (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) #(a x b x c x d x e x f) :start 2 :count 1) #(a x b z c x d x e x f)))
	  (test-t (equalp (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) #(a x b x c x d x e x f) :start 2 :end nil :count 1) #(a x b z c x d x e x f)))
	  (test-t (equalp (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) #(a x b x c x d x e x f) :start 2 :end 6 :count 100) #(a x b z c z d x e x f)))
	  (test-t (equalp (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) #(a x b x c x d x e x f) :start 2 :end 11 :count 100) #(a x b z c z d z e z f)))
	  (test-t (equalp (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) #(a x b x c x d x e x f) :start 2 :end 8 :count 10) #(a x b z c z d z e x f)))
	  (test-t (equalp (substitute-if-not 'z (lambda (arg) (not (eq arg 'x))) #(a x b x c x d x e x f) :start 2 :end 8 :count 2 :from-end t) #(a x b x c z d z e x f)))
	  (test-t (equalp (substitute-if-not #\z (lambda (arg) (not (char< #\c arg))) #(#\a #\b #\c #\d #\e #\f)) #(#\a #\b #\c #\z #\z #\z)))
	  (test-t (equalp (substitute-if-not "peace" (lambda (arg) (not (equal "war" arg))) #("love" "hate" "war" "peace")) #("love" "hate" "peace" "peace")))
	  (test-t (equalp (substitute-if-not "peace" (lambda (arg) (not (string-equal "war" arg))) #("war" "War" "WAr" "WAR")) #("peace" "peace" "peace" "peace")))
	  (test-t (equalp (substitute-if-not "peace" (lambda (arg) (not (string= "WAR" arg))) #("war" "War" "WAr" "WAR") :key string-upcase) #("peace" "peace" "peace" "peace")))
	  (test-t (equalp (substitute-if-not "peace" (lambda (arg) (not (string= "WAR" arg))) #("war" "War" "WAr" "WAR") :start 1 :end 2 :key string-upcase) #("war" "peace" "WAr" "WAR")))
	  (test-t (equalp (substitute-if-not "peace" (lambda (arg) (not (string= "WAR" arg))) #("war" "War" "WAr" "WAR") :start 1 :end nil :key string-upcase) #("war" "peace" "peace" "peace")))
	  (test-t (equalp (substitute-if-not "peace" (lambda (arg) (not (string= "war" arg))) #("war" "War" "WAr" "WAR") :key string-upcase) #("war" "War" "WAr" "WAR")))
	  (test-t (equalp (substitute-if-not "peace" (lambda (arg) (not (string= "WAR" arg))) #("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR") :start 1 :end 7 :count 1 :key string-upcase) #("war" "peace" "WAr" "WAR" "war" "War" "WAr" "WAR")))
	  (test-t (equalp (substitute-if-not "peace" (lambda (arg) (not (string= "WAR" arg))) #("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR") :start 1 :end 7 :count 2 :key string-upcase) #("war" "peace" "peace" "WAR" "war" "War" "WAr" "WAR")))
	  (test-t (equalp (substitute-if-not "peace" (lambda (arg) (not (string= "WAR" arg))) #("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR") :start 1 :end 7 :count 2 :from-end t :key string-upcase) #("war" "War" "WAr" "WAR" "war" "peace" "peace" "WAR")))
	  (test-t (equalp (substitute-if-not "peace" (lambda (arg) (not (string= "WAR" arg))) #("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR") :start 1 :end 7 :count 0 :from-end t :key string-upcase) #("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR")))
	  (test-t (equalp (substitute-if-not "peace" (lambda (arg) (not (string= "WAR" arg))) #("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR") :start 1 :end 7 :count -2 :from-end t :key string-upcase) #("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR")))
	  (test-t (equalp (substitute-if-not "peace" (lambda (arg) (not (string= "WAR" arg))) #("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR") :start 1 :end 7 :count nil :from-end t :key string-upcase) #("war" "peace" "peace" "peace" "peace" "peace" "peace" "WAR")))
	  (test-t (equalp (substitute-if-not "peace" (lambda (arg) (not (string= "WAR" arg))) #("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR") :start 1 :end 7 :count 6 :from-end t :key string-upcase) #("war" "peace" "peace" "peace" "peace" "peace" "peace" "WAR")))
	  (test-t (equalp (substitute-if-not "peace" (lambda (arg) (not (string= "WAR" arg))) #("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR") :start 1 :end 7 :count 7 :from-end t :key string-upcase) #("war" "peace" "peace" "peace" "peace" "peace" "peace" "WAR")))
	  (test-t (equalp (substitute-if-not "peace" (lambda (arg) (not (string= "WAR" arg))) #("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR") :start 1 :end 7 :count 100 :from-end t :key string-upcase) #("war" "peace" "peace" "peace" "peace" "peace" "peace" "WAR")))
	  (test-t (string= (substitute-if-not #\A (lambda (arg) (not (eql #\a arg))) "abcabc") "AbcAbc"))
	  (test-t (string= (substitute-if-not #\A (lambda (arg) (not (eql #\a arg))) "") ""))
	  (test-t (string= (substitute-if-not #\A (lambda (arg) (not (eql #\a arg))) "xyz") "xyz"))
	  (test-t (string= (substitute-if-not #\A (lambda (arg) (not (eql #\a arg))) "aaaaaaaaaa" :start 5 :end nil) "aaaaaAAAAA"))
	  (test-t (string= (substitute-if-not #\x (lambda (arg) (not (char< #\5 arg))) "0123456789") "012345xxxx"))
	  (test-t (string= (substitute-if-not #\x (lambda (arg) (not (char> #\5 arg))) "0123456789") "xxxxx56789"))
	  (test-t (string= (substitute-if-not #\x (lambda (arg) (not (char> #\D arg))) "abcdefg" :key char-upcase) "xxxdefg"))
	  (test-t (string= (substitute-if-not #\x (lambda (arg) (not (char> #\D arg))) "abcdefg" :start 1 :end 2 :key char-upcase) "axcdefg"))
	  (test-t (string= (substitute-if-not #\A (lambda (arg) (not (eql #\a arg))) "aaaaaaaaaa" :count 2) "AAaaaaaaaa"))
	  (test-t (string= (substitute-if-not #\A (lambda (arg) (not (eql #\a arg))) "aaaaaaaaaa" :count -1) "aaaaaaaaaa"))
	  (test-t (string= (substitute-if-not #\A (lambda (arg) (not (eql #\a arg))) "aaaaaaaaaa" :count 0) "aaaaaaaaaa"))
	  (test-t (string= (substitute-if-not #\A (lambda (arg) (not (eql #\a arg))) "aaaaaaaaaa" :count nil) "AAAAAAAAAA"))
	  (test-t (string= (substitute-if-not #\A (lambda (arg) (not (eql #\a arg))) "aaaaaaaaaa" :count 100) "AAAAAAAAAA"))
	  (test-t (string= (substitute-if-not #\A (lambda (arg) (not (eql #\a arg))) "aaaaaaaaaa" :count 9) "AAAAAAAAAa"))
	  (test-t (string= (substitute-if-not #\A (lambda (arg) (not (eql #\a arg))) "aaaaaaaaaa" :count 9 :from-end t) "aAAAAAAAAA"))
	  (test-t (string= (substitute-if-not #\A (lambda (arg) (not (eql #\a arg))) "aaaaaaaaaa" :start 2 :end 8 :count 3) "aaAAAaaaaa"))
	  (test-t (string= (substitute-if-not #\A (lambda (arg) (not (eql #\a arg))) "aaaaaaaaaa" :start 2 :end 8 :from-end t :count 3) "aaaaaAAAaa"))
	  (test-t (string= (substitute-if-not #\x (lambda (arg) (not (eql #\A arg))) "aaaaaaaaaa" :start 2 :end 8 :from-end t :count 3) "aaaaaaaaaa"))
	  (test-t (string= (substitute-if-not #\X (lambda (arg) (not (eql #\A arg))) "aaaaaaaaaa" :start 2 :end 8 :from-end t :key char-upcase :count 3) "aaaaaXXXaa"))
	  (test-t (string= (substitute-if-not #\X (lambda (arg) (not (char< #\D arg))) "abcdefghij" :start 2 :end 8 :from-end t :key char-upcase :count 3) "abcdeXXXij"))
	  (test-t (equal (nsubstitute 'a 'x (copy-seq '(x y z))) '(a y z)))
	  (test-t (equal (nsubstitute 'b 'y (copy-seq '(x y z))) '(x b z)))
	  (test-t (equal (nsubstitute 'c 'z (copy-seq '(x y z))) '(x y c)))
	  (test-t (equal (nsubstitute 'a 'p (copy-seq '(x y z))) '(x y z)))
	  (test-t (equal (nsubstitute 'a 'x (copy-seq ())) ()))
	  (test-t (equal (nsubstitute #\x #\b (copy-seq '(#\a #\b #\c #\d #\e)) :test char<) '(#\a #\b #\x #\x #\x)))
	  (test-t (equal (nsubstitute '(a) 'x (copy-seq '((x) (y) (z))) :key car) '((a) (y) (z))))
	  (test-t (equal (nsubstitute 'c 'b (copy-seq '(a b a b a b a b))) '(a c a c a c a c)))
	  (test-t (equal (nsubstitute 'a 'b (copy-seq '(b b b))) '(a a a)))
	  (test-t (equal (nsubstitute 'z 'x (copy-seq axbx-etc)) '(a z b z c z d z e z f)))
	  (test-t (equal (nsubstitute 'z 'x (copy-seq axbx-etc) :count nil) '(a z b z c z d z e z f)))
	  (test-t (equal (nsubstitute 'z 'x (copy-seq axbx-etc) :count 0) axbx-etc))
	  (test-t (equal (nsubstitute 'z 'x (copy-seq axbx-etc) :count -100) axbx-etc))
	  (test-t (equal (nsubstitute 'z 'x (copy-seq axbx-etc) :count 1) '(a z b x c x d x e x f)))
	  (test-t (equal (nsubstitute 'z 'x (copy-seq axbx-etc) :count 2) '(a z b z c x d x e x f)))
	  (test-t (equal (nsubstitute 'z 'x (copy-seq axbx-etc) :count 3) '(a z b z c z d x e x f)))
	  (test-t (equal (nsubstitute 'z 'x (copy-seq axbx-etc) :count 4) '(a z b z c z d z e x f)))
	  (test-t (equal (nsubstitute 'z 'x (copy-seq axbx-etc) :count 5) '(a z b z c z d z e z f)))
	  (test-t (equal (nsubstitute 'z 'x (copy-seq axbx-etc) :count 6) '(a z b z c z d z e z f)))
	  (test-t (equal (nsubstitute 'z 'x (copy-seq axbx-etc) :count 7) '(a z b z c z d z e z f)))
	  (test-t (equal (nsubstitute 'z 'x (copy-seq axbx-etc) :count nil :from-end t) '(a z b z c z d z e z f)))
	  (test-t (equal (nsubstitute 'z 'x (copy-seq axbx-etc) :count 0 :from-end t) axbx-etc))
	  (test-t (equal (nsubstitute 'z 'x (copy-seq axbx-etc) :count -100 :from-end t) axbx-etc))
	  (test-t (equal (nsubstitute 'z 'x (copy-seq axbx-etc) :count 1 :from-end t) '(a x b x c x d x e z f)))
	  (test-t (equal (nsubstitute 'z 'x (copy-seq axbx-etc) :count 2 :from-end t) '(a x b x c x d z e z f)))
	  (test-t (equal (nsubstitute 'z 'x (copy-seq axbx-etc) :count 3 :from-end t) '(a x b x c z d z e z f)))
	  (test-t (equal (nsubstitute 'z 'x (copy-seq axbx-etc) :count 4 :from-end t) '(a x b z c z d z e z f)))
	  (test-t (equal (nsubstitute 'z 'x (copy-seq axbx-etc) :count 5 :from-end t) '(a z b z c z d z e z f)))
	  (test-t (equal (nsubstitute 'z 'x (copy-seq axbx-etc) :count 6 :from-end t) '(a z b z c z d z e z f)))
	  (test-t (equal (nsubstitute 'z 'x (copy-seq axbx-etc) :count 7 :from-end t) '(a z b z c z d z e z f)))
	  (test-t (equal (nsubstitute 'z 'x (copy-seq axbx-etc) :start 2 :count 1) '(a x b z c x d x e x f)))
	  (test-t (equal (nsubstitute 'z 'x (copy-seq axbx-etc) :start 2 :end nil :count 1) '(a x b z c x d x e x f)))
	  (test-t (equal (nsubstitute 'z 'x (copy-seq axbx-etc) :start 2 :end 6 :count 100) '(a x b z c z d x e x f)))
	  (test-t (equal (nsubstitute 'z 'x (copy-seq axbx-etc) :start 2 :end 11 :count 100) '(a x b z c z d z e z f)))
	  (test-t (equal (nsubstitute 'z 'x (copy-seq axbx-etc) :start 2 :end 8 :count 10) '(a x b z c z d z e x f)))
	  (test-t (equal (nsubstitute 'z 'x (copy-seq axbx-etc) :start 2 :end 8 :count 2 :from-end t) '(a x b x c z d z e x f)))
	  (test-t (equal (nsubstitute #\z #\c (copy-seq '(#\a #\b #\c #\d #\e #\f)) :test char<) '(#\a #\b #\c #\z #\z #\z)))
	  (test-t (equal (nsubstitute "peace" "war" (copy-seq '("love" "hate" "war" "peace")) :test equal) '("love" "hate" "peace" "peace")))
	  (test-t (equal (nsubstitute "peace" "war" (copy-seq '("war" "War" "WAr" "WAR")) :test string-equal) '("peace" "peace" "peace" "peace")))
	  (test-t (equal (nsubstitute "peace" "WAR" (copy-seq '("war" "War" "WAr" "WAR")) :test string=) '("war" "War" "WAr" "peace")))
	  (test-t (equal (nsubstitute "peace" "WAR" (copy-seq '("war" "War" "WAr" "WAR")) :test string= :key string-upcase) '("peace" "peace" "peace" "peace")))
	  (test-t (equal (nsubstitute "peace" "WAR" (copy-seq '("war" "War" "WAr" "WAR")) :start 1 :end 2 :test string= :key string-upcase) '("war" "peace" "WAr" "WAR")))
	  (test-t (equalp (nsubstitute 'a 'x (copy-seq #(x y z))) #(a y z)))
	  (test-t (equalp (nsubstitute 'b 'y (copy-seq #(x y z))) #(x b z)))
	  (test-t (equalp (nsubstitute 'c 'z (copy-seq #(x y z))) #(x y c)))
	  (test-t (equalp (nsubstitute 'a 'p (copy-seq #(x y z))) #(x y z)))
	  (test-t (equalp (nsubstitute 'a 'x (copy-seq #())) #()))
	  (test-t (equalp (nsubstitute #\x #\b (copy-seq #(#\a #\b #\c #\d #\e)) :test char<) #(#\a #\b #\x #\x #\x)))
	  (test-t (equalp (nsubstitute '(a) 'x (copy-seq #((x) (y) (z))) :key car) #((a) (y) (z))))
	  (test-t (equalp (nsubstitute 'c 'b (copy-seq #(a b a b a b a b))) #(a c a c a c a c)))
	  (test-t (equalp (nsubstitute 'a 'b (copy-seq #(b b b))) #(a a a)))
	  (test-t (equalp (nsubstitute 'z 'x (copy-seq #(a x b x c x d x e x f))) #(a z b z c z d z e z f)))
	  (test-t (equalp (nsubstitute 'z 'x (copy-seq #(a x b x c x d x e x f)) :count nil) #(a z b z c z d z e z f)))
	  (test-t (equalp (nsubstitute 'z 'x (copy-seq #(a x b x c x d x e x f)) :count 0) #(a x b x c x d x e x f)))
	  (test-t (equalp (nsubstitute 'z 'x (copy-seq #(a x b x c x d x e x f)) :count -100) #(a x b x c x d x e x f)))
	  (test-t (equalp (nsubstitute 'z 'x (copy-seq #(a x b x c x d x e x f)) :count 1) #(a z b x c x d x e x f)))
	  (test-t (equalp (nsubstitute 'z 'x (copy-seq #(a x b x c x d x e x f)) :count 2) #(a z b z c x d x e x f)))
	  (test-t (equalp (nsubstitute 'z 'x (copy-seq #(a x b x c x d x e x f)) :count 3) #(a z b z c z d x e x f)))
	  (test-t (equalp (nsubstitute 'z 'x (copy-seq #(a x b x c x d x e x f)) :count 4) #(a z b z c z d z e x f)))
	  (test-t (equalp (nsubstitute 'z 'x (copy-seq #(a x b x c x d x e x f)) :count 5) #(a z b z c z d z e z f)))
	  (test-t (equalp (nsubstitute 'z 'x (copy-seq #(a x b x c x d x e x f)) :count 6) #(a z b z c z d z e z f)))
	  (test-t (equalp (nsubstitute 'z 'x (copy-seq #(a x b x c x d x e x f)) :count 7) #(a z b z c z d z e z f)))
	  (test-t (equalp (nsubstitute 'z 'x (copy-seq #(a x b x c x d x e x f)) :count nil :from-end t) #(a z b z c z d z e z f)))
	  (test-t (equalp (nsubstitute 'z 'x (copy-seq #(a x b x c x d x e x f)) :count 0 :from-end t) #(a x b x c x d x e x f)))
	  (test-t (equalp (nsubstitute 'z 'x (copy-seq #(a x b x c x d x e x f)) :count -100 :from-end t) #(a x b x c x d x e x f)))
	  (test-t (equalp (nsubstitute 'z 'x (copy-seq #(a x b x c x d x e x f)) :count 1 :from-end t) #(a x b x c x d x e z f)))
	  (test-t (equalp (nsubstitute 'z 'x (copy-seq #(a x b x c x d x e x f)) :count 2 :from-end t) #(a x b x c x d z e z f)))
	  (test-t (equalp (nsubstitute 'z 'x (copy-seq #(a x b x c x d x e x f)) :count 3 :from-end t) #(a x b x c z d z e z f)))
	  (test-t (equalp (nsubstitute 'z 'x (copy-seq #(a x b x c x d x e x f)) :count 4 :from-end t) #(a x b z c z d z e z f)))
	  (test-t (equalp (nsubstitute 'z 'x (copy-seq #(a x b x c x d x e x f)) :count 5 :from-end t) #(a z b z c z d z e z f)))
	  (test-t (equalp (nsubstitute 'z 'x (copy-seq #(a x b x c x d x e x f)) :count 6 :from-end t) #(a z b z c z d z e z f)))
	  (test-t (equalp (nsubstitute 'z 'x (copy-seq #(a x b x c x d x e x f)) :count 7 :from-end t) #(a z b z c z d z e z f)))
	  (test-t (equalp (nsubstitute 'z 'x (copy-seq #(a x b x c x d x e x f)) :start 2 :count 1) #(a x b z c x d x e x f)))
	  (test-t (equalp (nsubstitute 'z 'x (copy-seq #(a x b x c x d x e x f)) :start 2 :end nil :count 1) #(a x b z c x d x e x f)))
	  (test-t (equalp (nsubstitute 'z 'x (copy-seq #(a x b x c x d x e x f)) :start 2 :end 6 :count 100) #(a x b z c z d x e x f)))
	  (test-t (equalp (nsubstitute 'z 'x (copy-seq #(a x b x c x d x e x f)) :start 2 :end 11 :count 100) #(a x b z c z d z e z f)))
	  (test-t (equalp (nsubstitute 'z 'x (copy-seq #(a x b x c x d x e x f)) :start 2 :end 8 :count 10) #(a x b z c z d z e x f)))
	  (test-t (equalp (nsubstitute 'z 'x (copy-seq #(a x b x c x d x e x f)) :start 2 :end 8 :count 2 :from-end t) #(a x b x c z d z e x f)))
	  (test-t (equalp (nsubstitute #\z #\c (copy-seq #(#\a #\b #\c #\d #\e #\f)) :test char<) #(#\a #\b #\c #\z #\z #\z)))
	  (test-t (equalp (nsubstitute "peace" "war" (copy-seq #("love" "hate" "war" "peace")) :test equal) #("love" "hate" "peace" "peace")))
	  (test-t (equalp (nsubstitute "peace" "war" (copy-seq #("war" "War" "WAr" "WAR")) :test string-equal) #("peace" "peace" "peace" "peace")))
	  (test-t (equalp (nsubstitute "peace" "WAR" (copy-seq #("war" "War" "WAr" "WAR")) :test string=) #("war" "War" "WAr" "peace")))
	  (test-t (equalp (nsubstitute "peace" "WAR" (copy-seq #("war" "War" "WAr" "WAR")) :test string= :key string-upcase) #("peace" "peace" "peace" "peace")))
	  (test-t (equalp (nsubstitute "peace" "WAR" (copy-seq #("war" "War" "WAr" "WAR")) :start 1 :end 2 :test string= :key string-upcase) #("war" "peace" "WAr" "WAR")))
	  (test-t (equalp (nsubstitute "peace" "WAR" (copy-seq #("war" "War" "WAr" "WAR")) :start 1 :end nil :test string= :key cl-string-upcase) #("war" "peace" "peace" "peace")))
	  (test-t (string= (nsubstitute #\A #\a (copy-seq "abcabc")) "AbcAbc"))
	  (test-t (string= (nsubstitute #\A #\a (copy-seq "")) ""))
	  (test-t (string= (nsubstitute #\A #\a (copy-seq "xyz")) "xyz"))
	  (test-t (string= (nsubstitute #\A #\a (copy-seq "aaaaaaaaaa") :start 5 :end nil) "aaaaaAAAAA"))
	  (test-t (string= (nsubstitute #\x #\5 (copy-seq "0123456789") :test char<) "012345xxxx"))
	  (test-t (string= (nsubstitute #\x #\5 (copy-seq "0123456789") :test char>) "xxxxx56789"))
	  (test-t (string= (nsubstitute #\x #\D (copy-seq "abcdefg") :key char-upcase :test char>) "xxxdefg"))
	  (test-t (string= (nsubstitute #\x #\D (copy-seq "abcdefg") :start 1 :end 2 :key char-upcase :test char>) "axcdefg"))
	  (test-t (string= (nsubstitute #\A #\a (copy-seq "aaaaaaaaaa") :count 2) "AAaaaaaaaa"))
	  (test-t (string= (nsubstitute #\A #\a (copy-seq "aaaaaaaaaa") :count -1) "aaaaaaaaaa"))
	  (test-t (string= (nsubstitute #\A #\a (copy-seq "aaaaaaaaaa") :count 0) "aaaaaaaaaa"))
	  (test-t (string= (nsubstitute #\A #\a (copy-seq "aaaaaaaaaa") :count nil) "AAAAAAAAAA"))
	  (test-t (string= (nsubstitute #\A #\a (copy-seq "aaaaaaaaaa") :count 100) "AAAAAAAAAA"))
	  (test-t (string= (nsubstitute #\A #\a (copy-seq "aaaaaaaaaa") :count 9) "AAAAAAAAAa"))
	  (test-t (string= (nsubstitute #\A #\a (copy-seq "aaaaaaaaaa") :count 9 :from-end t) "aAAAAAAAAA"))
	  (test-t (string= (nsubstitute #\A #\a (copy-seq "aaaaaaaaaa") :start 2 :end 8 :count 3) "aaAAAaaaaa"))
	  (test-t (string= (nsubstitute #\A #\a (copy-seq "aaaaaaaaaa") :start 2 :end 8 :from-end t :count 3) "aaaaaAAAaa"))
	  (test-t (string= (nsubstitute #\x #\A (copy-seq "aaaaaaaaaa") :start 2 :end 8 :from-end t :count 3) "aaaaaaaaaa"))
	  (test-t (string= (nsubstitute #\X #\A (copy-seq "aaaaaaaaaa") :start 2 :end 8 :from-end t :key char-upcase :count 3) "aaaaaXXXaa"))
	  (test-t (string= (nsubstitute #\X #\D (copy-seq "abcdefghij") :start 2 :end 8 :from-end t :key char-upcase :test char< :count 3) "abcdeXXXij"))
	  (test-t (equal (nsubstitute-if 'a (lambda (arg) (eq arg 'x)) (copy-seq '(x y z))) '(a y z)))
	  (test-t (equal (nsubstitute-if 'b (lambda (arg) (eq arg 'y)) (copy-seq '(x y z))) '(x b z)))
	  (test-t (equal (nsubstitute-if 'c (lambda (arg) (eq arg 'z)) (copy-seq '(x y z))) '(x y c)))
	  (test-t (equal (nsubstitute-if 'a (lambda (arg) (eq arg 'p)) (copy-seq '(x y z))) '(x y z)))
	  (test-t (equal (nsubstitute-if 'a (lambda (arg) (eq arg 'x)) (copy-seq ())) ()))
	  (test-t (equal (nsubstitute-if #\x (lambda (arg) (char< #\b arg)) (copy-seq '(#\a #\b #\c #\d #\e))) '(#\a #\b #\x #\x #\x)))
	  (test-t (equal (nsubstitute-if '(a) (lambda (arg) (eq arg 'x)) (copy-seq '((x) (y) (z))) :key car) '((a) (y) (z))))
	  (test-t (equal (nsubstitute-if 'c (lambda (arg) (eq arg 'b)) (copy-seq '(a b a b a b a b))) '(a c a c a c a c)))
	  (test-t (equal (nsubstitute-if 'a (lambda (arg) (eq arg 'b)) (copy-seq '(b b b))) '(a a a)))
	  (test-t (equal (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq axbx-etc)) '(a z b z c z d z e z f)))
	  (test-t (equal (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq axbx-etc) :count nil) '(a z b z c z d z e z f)))
	  (test-t (equal (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq axbx-etc) :count 0) axbx-etc))
	  (test-t (equal (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq axbx-etc) :count -100) axbx-etc))
	  (test-t (equal (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq axbx-etc) :count 1) '(a z b x c x d x e x f)))
	  (test-t (equal (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq axbx-etc) :count 2) '(a z b z c x d x e x f)))
	  (test-t (equal (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq axbx-etc) :count 3) '(a z b z c z d x e x f)))
	  (test-t (equal (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq axbx-etc) :count 4) '(a z b z c z d z e x f)))
	  (test-t (equal (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq axbx-etc) :count 5) '(a z b z c z d z e z f)))
	  (test-t (equal (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq axbx-etc) :count 6) '(a z b z c z d z e z f)))
	  (test-t (equal (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq axbx-etc) :count 7) '(a z b z c z d z e z f)))
	  (test-t (equal (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq axbx-etc) :count nil :from-end t) '(a z b z c z d z e z f)))
	  (test-t (equal (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq axbx-etc) :count 0 :from-end t) axbx-etc))
	  (test-t (equal (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq axbx-etc) :count -100 :from-end t) axbx-etc))
	  (test-t (equal (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq axbx-etc) :count 1 :from-end t) '(a x b x c x d x e z f)))
	  (test-t (equal (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq axbx-etc) :count 2 :from-end t) '(a x b x c x d z e z f)))
	  (test-t (equal (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq axbx-etc) :count 3 :from-end t) '(a x b x c z d z e z f)))
	  (test-t (equal (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq axbx-etc) :count 4 :from-end t) '(a x b z c z d z e z f)))
	  (test-t (equal (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq axbx-etc) :count 5 :from-end t) '(a z b z c z d z e z f)))
	  (test-t (equal (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq axbx-etc) :count 6 :from-end t) '(a z b z c z d z e z f)))
	  (test-t (equal (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq axbx-etc) :count 7 :from-end t) '(a z b z c z d z e z f)))
	  (test-t (equal (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq axbx-etc) :start 2 :count 1) '(a x b z c x d x e x f)))
	  (test-t (equal (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq axbx-etc) :start 2 :end nil :count 1) '(a x b z c x d x e x f)))
	  (test-t (equal (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq axbx-etc) :start 2 :end 6 :count 100) '(a x b z c z d x e x f)))
	  (test-t (equal (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq axbx-etc) :start 2 :end 11 :count 100) '(a x b z c z d z e z f)))
	  (test-t (equal (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq axbx-etc) :start 2 :end 8 :count 10) '(a x b z c z d z e x f)))
	  (test-t (equal (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq axbx-etc) :start 2 :end 8 :count 2 :from-end t) '(a x b x c z d z e x f)))
	  (test-t (equal (nsubstitute-if #\z (lambda (arg) (char< #\c arg)) (copy-seq '(#\a #\b #\c #\d #\e #\f))) '(#\a #\b #\c #\z #\z #\z)))
	  (test-t (equal (nsubstitute-if "peace" (lambda (arg) (equal "war" arg)) (copy-seq '("love" "hate" "war" "peace"))) '("love" "hate" "peace" "peace")))
	  (test-t (equal (nsubstitute-if "peace" (lambda (arg) (string-equal "war" arg)) (copy-seq '("war" "War" "WAr" "WAR"))) '("peace" "peace" "peace" "peace")))
	  (test-t (equal (nsubstitute-if "peace" (lambda (arg) (string= "WAR" arg)) (copy-seq '("war" "War" "WAr" "WAR")) :key string-upcase) '("peace" "peace" "peace" "peace")))
	  (test-t (equal (nsubstitute-if "peace" (lambda (arg) (string= "WAR" arg)) (copy-seq '("war" "War" "WAr" "WAR")) :start 1 :end 2 :key string-upcase) '("war" "peace" "WAr" "WAR")))
	  (test-t (equal (nsubstitute-if "peace" (lambda (arg) (string= "WAR" arg)) (copy-seq '("war" "War" "WAr" "WAR")) :start 1 :end nil :key string-upcase) '("war" "peace" "peace" "peace")))
	  (test-t (equal (nsubstitute-if "peace" (lambda (arg) (string= "war" arg)) (copy-seq '("war" "War" "WAr" "WAR")) :key string-upcase) '("war" "War" "WAr" "WAR")))
	  (test-t (equal (nsubstitute-if "peace" (lambda (arg) (string= "WAR" arg)) (copy-seq '("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR")) :start 1 :end 7 :count 1 :key string-upcase) '("war" "peace" "WAr" "WAR" "war" "War" "WAr" "WAR")))
	  (test-t (equal (nsubstitute-if "peace" (lambda (arg) (string= "WAR" arg)) (copy-seq '("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR")) :start 1 :end 7 :count 2 :key string-upcase) '("war" "peace" "peace" "WAR" "war" "War" "WAr" "WAR")))
	  (test-t (equal (nsubstitute-if "peace" (lambda (arg) (string= "WAR" arg)) (copy-seq '("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR")) :start 1 :end 7 :count 2 :from-end t :key string-upcase) '("war" "War" "WAr" "WAR" "war" "peace" "peace" "WAR")))
	  (test-t (equal (nsubstitute-if "peace" (lambda (arg) (string= "WAR" arg)) (copy-seq '("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR")) :start 1 :end 7 :count 0 :from-end t :key string-upcase) '("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR")))
	  (test-t (equal (nsubstitute-if "peace" (lambda (arg) (string= "WAR" arg)) (copy-seq '("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR")) :start 1 :end 7 :count -2 :from-end t :key string-upcase) '("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR")))
	  (test-t (equal (nsubstitute-if "peace" (lambda (arg) (string= "WAR" arg)) (copy-seq '("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR")) :start 1 :end 7 :count nil :from-end t :key string-upcase) '("war" "peace" "peace" "peace" "peace" "peace" "peace" "WAR")))
	  (test-t (equal (nsubstitute-if "peace" (lambda (arg) (string= "WAR" arg)) (copy-seq '("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR")) :start 1 :end 7 :count 6 :from-end t :key string-upcase) '("war" "peace" "peace" "peace" "peace" "peace" "peace" "WAR")))
	  (test-t (equal (nsubstitute-if "peace" (lambda (arg) (string= "WAR" arg)) (copy-seq '("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR")) :start 1 :end 7 :count 7 :from-end t :key string-upcase) '("war" "peace" "peace" "peace" "peace" "peace" "peace" "WAR")))
	  (test-t (equal (nsubstitute-if "peace" (lambda (arg) (string= "WAR" arg)) (copy-seq '("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR")) :start 1 :end 7 :count 100 :from-end t :key string-upcase) '("war" "peace" "peace" "peace" "peace" "peace" "peace" "WAR")))
	  (test-t (equalp (nsubstitute-if 'a (lambda (arg) (eq arg 'x)) (copy-seq #(x y z))) #(a y z)))
	  (test-t (equalp (nsubstitute-if 'b (lambda (arg) (eq arg 'y)) (copy-seq #(x y z))) #(x b z)))
	  (test-t (equalp (nsubstitute-if 'c (lambda (arg) (eq arg 'z)) (copy-seq #(x y z))) #(x y c)))
	  (test-t (equalp (nsubstitute-if 'a (lambda (arg) (eq arg 'p)) (copy-seq #(x y z))) #(x y z)))
	  (test-t (equalp (nsubstitute-if 'a (lambda (arg) (eq arg 'x)) (copy-seq #())) #()))
	  (test-t (equalp (nsubstitute-if #\x (lambda (arg) (char< #\b arg)) (copy-seq #(#\a #\b #\c #\d #\e))) #(#\a #\b #\x #\x #\x)))
	  (test-t (equalp (nsubstitute-if '(a) (lambda (arg) (eq arg 'x)) (copy-seq #((x) (y) (z))) :key car) #((a) (y) (z))))
	  (test-t (equalp (nsubstitute-if 'c (lambda (arg) (eq arg 'b)) (copy-seq #(a b a b a b a b))) #(a c a c a c a c)))
	  (test-t (equalp (nsubstitute-if 'a (lambda (arg) (eq arg 'b)) (copy-seq #(b b b))) #(a a a)))
	  (test-t (equalp (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq #(a x b x c x d x e x f))) #(a z b z c z d z e z f)))
	  (test-t (equalp (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq #(a x b x c x d x e x f)) :count nil) #(a z b z c z d z e z f)))
	  (test-t (equalp (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq #(a x b x c x d x e x f)) :count 0) #(a x b x c x d x e x f)))
	  (test-t (equalp (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq #(a x b x c x d x e x f)) :count -100) #(a x b x c x d x e x f)))
	  (test-t (equalp (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq #(a x b x c x d x e x f)) :count 1) #(a z b x c x d x e x f)))
	  (test-t (equalp (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq #(a x b x c x d x e x f)) :count 2) #(a z b z c x d x e x f)))
	  (test-t (equalp (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq #(a x b x c x d x e x f)) :count 3) #(a z b z c z d x e x f)))
	  (test-t (equalp (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq #(a x b x c x d x e x f)) :count 4) #(a z b z c z d z e x f)))
	  (test-t (equalp (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq #(a x b x c x d x e x f)) :count 5) #(a z b z c z d z e z f)))
	  (test-t (equalp (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq #(a x b x c x d x e x f)) :count 6) #(a z b z c z d z e z f)))
	  (test-t (equalp (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq #(a x b x c x d x e x f)) :count 7) #(a z b z c z d z e z f)))
	  (test-t (equalp (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq #(a x b x c x d x e x f)) :count nil :from-end t) #(a z b z c z d z e z f)))
	  (test-t (equalp (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq #(a x b x c x d x e x f)) :count 0 :from-end t) #(a x b x c x d x e x f)))
	  (test-t (equalp (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq #(a x b x c x d x e x f)) :count -100 :from-end t) #(a x b x c x d x e x f)))
	  (test-t (equalp (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq #(a x b x c x d x e x f)) :count 1 :from-end t) #(a x b x c x d x e z f)))
	  (test-t (equalp (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq #(a x b x c x d x e x f)) :count 2 :from-end t) #(a x b x c x d z e z f)))
	  (test-t (equalp (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq #(a x b x c x d x e x f)) :count 3 :from-end t) #(a x b x c z d z e z f)))
	  (test-t (equalp (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq #(a x b x c x d x e x f)) :count 4 :from-end t) #(a x b z c z d z e z f)))
	  (test-t (equalp (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq #(a x b x c x d x e x f)) :count 5 :from-end t) #(a z b z c z d z e z f)))
	  (test-t (equalp (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq #(a x b x c x d x e x f)) :count 6 :from-end t) #(a z b z c z d z e z f)))
	  (test-t (equalp (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq #(a x b x c x d x e x f)) :count 7 :from-end t) #(a z b z c z d z e z f)))
	  (test-t (equalp (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq #(a x b x c x d x e x f)) :start 2 :count 1) #(a x b z c x d x e x f)))
	  (test-t (equalp (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq #(a x b x c x d x e x f)) :start 2 :end nil :count 1) #(a x b z c x d x e x f)))
	  (test-t (equalp (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq #(a x b x c x d x e x f)) :start 2 :end 6 :count 100) #(a x b z c z d x e x f)))
	  (test-t (equalp (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq #(a x b x c x d x e x f)) :start 2 :end 11 :count 100) #(a x b z c z d z e z f)))
	  (test-t (equalp (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq #(a x b x c x d x e x f)) :start 2 :end 8 :count 10) #(a x b z c z d z e x f)))
	  (test-t (equalp (nsubstitute-if 'z (lambda (arg) (eq arg 'x)) (copy-seq #(a x b x c x d x e x f)) :start 2 :end 8 :count 2 :from-end t) #(a x b x c z d z e x f)))
	  (test-t (equalp (nsubstitute-if #\z (lambda (arg) (char< #\c arg)) (copy-seq #(#\a #\b #\c #\d #\e #\f))) #(#\a #\b #\c #\z #\z #\z)))
	  (test-t (equalp (nsubstitute-if "peace" (lambda (arg) (equal "war" arg)) (copy-seq #("love" "hate" "war" "peace"))) #("love" "hate" "peace" "peace")))
	  (test-t (equalp (nsubstitute-if "peace" (lambda (arg) (string-equal "war" arg)) (copy-seq #("war" "War" "WAr" "WAR"))) #("peace" "peace" "peace" "peace")))
	  (test-t (equalp (nsubstitute-if "peace" (lambda (arg) (string= "WAR" arg)) (copy-seq #("war" "War" "WAr" "WAR")) :key string-upcase) #("peace" "peace" "peace" "peace")))
	  (test-t (equalp (nsubstitute-if "peace" (lambda (arg) (string= "WAR" arg)) (copy-seq #("war" "War" "WAr" "WAR")) :start 1 :end 2 :key string-upcase) #("war" "peace" "WAr" "WAR")))
	  (test-t (equalp (nsubstitute-if "peace" (lambda (arg) (string= "WAR" arg)) (copy-seq #("war" "War" "WAr" "WAR")) :start 1 :end nil :key string-upcase) #("war" "peace" "peace" "peace")))
	  (test-t (equalp (nsubstitute-if "peace" (lambda (arg) (string= "war" arg)) (copy-seq #("war" "War" "WAr" "WAR")) :key string-upcase) #("war" "War" "WAr" "WAR")))
	  (test-t (equalp (nsubstitute-if "peace" (lambda (arg) (string= "WAR" arg)) (copy-seq #("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR")) :start 1 :end 7 :count 1 :key string-upcase) #("war" "peace" "WAr" "WAR" "war" "War" "WAr" "WAR")))
	  (test-t (equalp (nsubstitute-if "peace" (lambda (arg) (string= "WAR" arg)) (copy-seq #("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR")) :start 1 :end 7 :count 2 :key string-upcase) #("war" "peace" "peace" "WAR" "war" "War" "WAr" "WAR")))
	  (test-t (equalp (nsubstitute-if "peace" (lambda (arg) (string= "WAR" arg)) (copy-seq #("war" "War" "WAr" "WAR" "war" "War" "WAr" "WAR")) :start 1 :end 7 :count 2 :from-end t :key string-upcase) #("war" "War" "WAr" "WAR" "war" "peace" "peace" "WAR")))
	  (test-t (string= (nsubstitute-if #\A (lambda (arg) (eql #\a arg)) (copy-seq "abcabc")) "AbcAbc"))
	  (test-t (string= (nsubstitute-if #\A (lambda (arg) (eql #\a arg)) (copy-seq "")) ""))
	  (test-t (string= (nsubstitute-if #\A (lambda (arg) (eql #\a arg)) (copy-seq "xyz")) "xyz"))
	  (test-t (string= (nsubstitute-if #\A (lambda (arg) (eql #\a arg)) (copy-seq "aaaaaaaaaa") :start 5 :end nil) "aaaaaAAAAA"))
	  (test-t (string= (nsubstitute-if #\x (lambda (arg) (char< #\5 arg)) (copy-seq "0123456789")) "012345xxxx"))
	  (test-t (string= (nsubstitute-if #\x (lambda (arg) (char> #\5 arg)) (copy-seq "0123456789")) "xxxxx56789"))
	  (test-t (string= (nsubstitute-if #\x (lambda (arg) (char> #\D arg)) (copy-seq "abcdefg") :key char-upcase) "xxxdefg"))
	  (test-t (string= (nsubstitute-if #\x (lambda (arg) (char> #\D arg)) (copy-seq "abcdefg") :start 1 :end 2 :key char-upcase) "axcdefg"))
	  (test-t (string= (nsubstitute-if #\A (lambda (arg) (eql #\a arg)) (copy-seq "aaaaaaaaaa") :count 2) "AAaaaaaaaa"))
	  (test-t (string= (nsubstitute-if #\A (lambda (arg) (eql #\a arg)) (copy-seq "aaaaaaaaaa") :count -1) "aaaaaaaaaa"))
	  (test-t (string= (nsubstitute-if #\A (lambda (arg) (eql #\a arg)) (copy-seq "aaaaaaaaaa") :count 0) "aaaaaaaaaa"))
	  (test-t (string= (nsubstitute-if #\A (lambda (arg) (eql #\a arg)) (copy-seq "aaaaaaaaaa") :count nil) "AAAAAAAAAA"))
	  (test-t (string= (nsubstitute-if #\A (lambda (arg) (eql #\a arg)) (copy-seq "aaaaaaaaaa") :count 100) "AAAAAAAAAA"))
	  (test-t (string= (nsubstitute-if #\A (lambda (arg) (eql #\a arg)) (copy-seq "aaaaaaaaaa") :count 9) "AAAAAAAAAa"))
	  (test-t (string= (nsubstitute-if #\A (lambda (arg) (eql #\a arg)) (copy-seq "aaaaaaaaaa") :count 9 :from-end t) "aAAAAAAAAA"))
	  (test-t (equal (nsubstitute-if-not 'a (lambda (arg) (not (eq arg 'x))) (copy-seq '(x y z))) '(a y z)))
	  (test-t (equal (nsubstitute-if-not 'b (lambda (arg) (not (eq arg 'y))) (copy-seq '(x y z))) '(x b z)))
	  (test-t (equal (nsubstitute-if-not 'c (lambda (arg) (not (eq arg 'z))) (copy-seq '(x y z))) '(x y c)))
	  (test-t (equal (nsubstitute-if-not 'a (lambda (arg) (not (eq arg 'p))) (copy-seq '(x y z))) '(x y z)))
	  (test-t (equal (nsubstitute-if-not 'a (lambda (arg) (not (eq arg 'x))) (copy-seq ())) ()))
	  (test-t (equal (nsubstitute-if-not #\x (lambda (arg) (not (char< #\b arg))) (copy-seq '(#\a #\b #\c #\d #\e))) '(#\a #\b #\x #\x #\x)))
	  (test-t (equal (nsubstitute-if-not '(a) (lambda (arg) (not (eq arg 'x))) (copy-seq '((x) (y) (z))) :key car) '((a) (y) (z))))
	  (test-t (equal (nsubstitute-if-not 'c (lambda (arg) (not (eq arg 'b))) (copy-seq '(a b a b a b a b))) '(a c a c a c a c)))
	  (test-t (equal (nsubstitute-if-not 'a (lambda (arg) (not (eq arg 'b))) (copy-seq '(b b b))) '(a a a)))
	  (test-t (equal (nsubstitute-if-not 'z (lambda (arg) (not (eq arg 'x))) (copy-seq axbx-etc)) '(a z b z c z d z e z f)))
	  (test-t (equal (nsubstitute-if-not 'z (lambda (arg) (not (eq arg 'x))) (copy-seq axbx-etc) :count nil) '(a z b z c z d z e z f)))
	  (test-t (equal (nsubstitute-if-not 'z (lambda (arg) (not (eq arg 'x))) (copy-seq axbx-etc) :count 0) axbx-etc))
	  (test-t (equal (nsubstitute-if-not 'z (lambda (arg) (not (eq arg 'x))) (copy-seq axbx-etc) :count -100) axbx-etc))
	  (test-t (equal (nsubstitute-if-not 'z (lambda (arg) (not (eq arg 'x))) (copy-seq axbx-etc) :count 1) '(a z b x c x d x e x f)))
	  (test-t (equal (nsubstitute-if-not 'z (lambda (arg) (not (eq arg 'x))) (copy-seq axbx-etc) :count 2) '(a z b z c x d x e x f)))
	  (test-t (equal (nsubstitute-if-not 'z (lambda (arg) (not (eq arg 'x))) (copy-seq axbx-etc) :count 3) '(a z b z c z d x e x f)))
	  (test-t (equal (nsubstitute-if-not 'z (lambda (arg) (not (eq arg 'x))) (copy-seq axbx-etc) :count 4) '(a z b z c z d z e x f)))
	  (test-t (equal (nsubstitute-if-not 'z (lambda (arg) (not (eq arg 'x))) (copy-seq axbx-etc) :count 5) '(a z b z c z d z e z f)))
	  (test-t (equal (nsubstitute-if-not 'z (lambda (arg) (not (eq arg 'x))) (copy-seq axbx-etc) :count 6) '(a z b z c z d z e z f)))
	  (test-t (equal (nsubstitute-if-not 'z (lambda (arg) (not (eq arg 'x))) (copy-seq axbx-etc) :count 7) '(a z b z c z d z e z f)))
	  )
	
	(let ()
	  (define* (reduce function sequence from-end (start 0) end initial-value (key identity))
	    (let* ((slen (length sequence))
		   (nd (or (and (number? end) end) slen))
		   (len (min slen (- nd start))))
	      (if (< nd start)
		  (error 'out-of-range "~A :start ~A is greater than ~A ~A" __func__ start (if end ":end" "length") nd))
	      (if (not (positive? len))
		  (or initial-value
		      (function))
		  (if (and (= len 1)
			   (not initial-value))
		      (sequence start)
		      (if (and (not from-end) (not (null? from-end)))
			  (let* ((first-arg (or initial-value (key (sequence start))))
				 (second-arg (if initial-value (key (sequence start)) (key (sequence (+ start 1)))))
				 (val (function first-arg second-arg)))
			    (do ((i (if initial-value (+ start 1) (+ start 2)) (+ i 1)))
				((= i nd) val)
			      (set! val (function val (key (sequence i))))))
			  (let* ((second-arg (or initial-value (key (sequence (- nd 1)))))
				 (first-arg (if initial-value (key (sequence (- nd 1))) (key (sequence (- nd 2)))))
				 (val (function first-arg second-arg)))
			    (do ((i (if initial-value (- nd 2) (- nd 3)) (- i 1)))
				((< i start) val)
			      (set! val (function (key (sequence i)) val)))))))))
	  
	  (test-t (eql (reduce * '(1 2 3 4 5)) 120))
	  (test-t (equal (reduce append '((1) (2)) :initial-value '(i n i t)) '(i n i t 1 2)))
	  (test-t (equal (reduce append '((1) (2)) :from-end t :initial-value '(i n i t)) '(1 2 i n i t)))
	  (test-t (eql (reduce - '(1 2 3 4)) -8))
	  (test-t (eql (reduce - '(1 2 3 4) :from-end t) -2))
	  (test-t (eql (reduce + ()) 0))
	  (test-t (eql (reduce + '(3)) 3))
	  (test-t (eq (reduce + '(foo)) 'foo))
	  (test-t (equal (reduce list '(1 2 3 4)) '(((1 2) 3) 4)))
	  (test-t (equal (reduce list '(1 2 3 4) :from-end t) '(1 (2 (3 4)))))
	  (test-t (equal (reduce list '(1 2 3 4) :initial-value 'foo) '((((foo 1) 2) 3) 4)))
	  (test-t (equal (reduce list '(1 2 3 4) :from-end t :initial-value 'foo) '(1 (2 (3 (4 foo))))))
	  (test-t (equal (reduce list '(0 1 2 3)) '(((0 1) 2) 3)))
	  (test-t (equal (reduce list '(0 1 2 3) :start 1) '((1 2) 3)))
	  (test-t (equal (reduce list '(0 1 2 3) :start 1 :end nil) '((1 2) 3)))
	  (test-t (equal (reduce list '(0 1 2 3) :start 2) '(2 3)))
	  (test-t (eq (reduce list '(0 1 2 3) :start 0 :end 0) ()))
	  (test-t (eq (reduce list '(0 1 2 3) :start 0 :end 0 :initial-value 'initial-value) 'initial-value))
	  (test-t (eq (reduce list '(0 1 2 3) :start 2 :end 2) ()))
	  (test-t (eq (reduce list '(0 1 2 3) :start 2 :end 2 :initial-value 'initial-value) 'initial-value))
	  (test-t (eq (reduce list '(0 1 2 3) :start 4 :end 4) ()))
	  (test-t (eq (reduce list '(0 1 2 3) :start 4 :end 4 :initial-value 'initial-value) 'initial-value))
	  (test-t (eql (reduce list '(0 1 2 3) :start 2 :end 3) 2))
	  (test-t (equal (reduce list '(0 1 2 3) :start 2 :end 3 :initial-value 'initial-value) '(initial-value 2)))
	  (test-t (eql (reduce + '(0 1 2 3 4 5 6 7 8 9)) 45))
	  (test-t (eql (reduce - '(0 1 2 3 4 5 6 7 8 9)) -45))
	  (test-t (eql (reduce - '(0 1 2 3 4 5 6 7 8 9) :from-end t) -5))
	  (test-t (equal (reduce list '(0 1 2 3) :initial-value 'initial-value) '((((initial-value 0) 1) 2) 3)))
	  (test-t (equal (reduce list '(0 1 2 3) :from-end t) '(0 (1 (2 3)))))
	  (test-t (equal (reduce list '((1) (2) (3) (4)) :key car) '(((1 2) 3) 4)))
					;(test-t (equal (reduce list '((1) (2) (3) (4)) :key car :from-end nil) '(((1 2) 3) 4)))
	  (test-t (equal (reduce list '((1) (2) (3) (4)) :key car :initial-value 0) '((((0 1) 2) 3) 4)))
	  (test-t (equal (reduce list '((1) (2) (3) (4)) :key car :from-end t) '(1 (2 (3 4)))))
	  (test-t (equal (reduce list '((1) (2) (3) (4)) :key car :from-end t :initial-value 5) '(1 (2 (3 (4 5))))))
	  (test-t (equal (reduce list #(0 1 2 3)) '(((0 1) 2) 3)))
	  (test-t (equal (reduce list #(0 1 2 3) :start 1) '((1 2) 3)))
	  (test-t (equal (reduce list #(0 1 2 3) :start 1 :end nil) '((1 2) 3)))
	  (test-t (equal (reduce list #(0 1 2 3) :start 2) '(2 3)))
	  (test-t (eq (reduce list #(0 1 2 3) :start 0 :end 0) ()))
	  (test-t (eq (reduce list #(0 1 2 3) :start 0 :end 0 :initial-value 'initial-value) 'initial-value))
	  (test-t (eq (reduce list #(0 1 2 3) :start 2 :end 2) ()))
	  (test-t (eq (reduce list #(0 1 2 3) :start 2 :end 2 :initial-value 'initial-value) 'initial-value))
	  (test-t (eq (reduce list #(0 1 2 3) :start 4 :end 4) ()))
	  (test-t (eq (reduce list #(0 1 2 3) :start 4 :end 4 :initial-value 'initial-value) 'initial-value))
	  (test-t (eql (reduce list #(0 1 2 3) :start 2 :end 3) 2))
	  (test-t (equal (reduce list #(0 1 2 3) :start 2 :end 3 :initial-value 'initial-value) '(initial-value 2)))
	  (test-t (eql (reduce + #(0 1 2 3 4 5 6 7 8 9)) 45))
	  (test-t (eql (reduce - #(0 1 2 3 4 5 6 7 8 9)) -45))
	  (test-t (eql (reduce - #(0 1 2 3 4 5 6 7 8 9) :from-end t) -5))
	  (test-t (equal (reduce list #(0 1 2 3) :initial-value 'initial-value) '((((initial-value 0) 1) 2) 3)))
	  (test-t (equal (reduce list #(0 1 2 3) :from-end t) '(0 (1 (2 3)))))
	  (test-t (equal (reduce list #((1) (2) (3) (4)) :key car) '(((1 2) 3) 4)))
					;(test-t (equal (reduce list #((1) (2) (3) (4)) :key car :from-end nil) '(((1 2) 3) 4)))
	  (test-t (equal (reduce list #((1) (2) (3) (4)) :key car :initial-value 0) '((((0 1) 2) 3) 4)))
	  (test-t (equal (reduce list #((1) (2) (3) (4)) :key car :from-end t) '(1 (2 (3 4)))))
	  (test-t (equal (reduce list #((1) (2) (3) (4)) :key car :from-end t :initial-value 5) '(1 (2 (3 (4 5))))))
	  )

	(define (nreverse sequence)
	  (let ((len (length sequence)))
	    (do ((i 0 (+ i 1))
		 (j (- len 1) (- j 1)))
		((>= i j) sequence)
	      (let ((tmp (sequence i)))
		(set! (sequence i) (sequence j))
		(set! (sequence j) tmp)))))

	(define (cl-reverse sequence)
	  (nreverse (copy sequence)))
	
	(define (elt sequence index) (sequence index))
	;; length is ok

	(define* (some predicate . sequences)
	  (call-with-exit
	   (lambda (return)
		     (apply for-each 
		      (lambda args
			(let ((val (apply predicate args)))
			  (if val (return val))))
		      sequences)
		     #f)))

	(define* (notany predicate . sequences)
	  (not (apply some predicate sequences)))

	(define* (every predicate . sequences)
	  (call-with-exit
	   (lambda (return)
		     (apply for-each 
		      (lambda args
			(if (not (apply predicate args))
			    (return #f)))
		      sequences)
		     #t)))

	(define* (notevery predicate . sequences)
	  (not (apply every predicate sequences)))

	(define* (cl-fill sequence item (start 0) end) ; actuall "fill" doesn't collide, but it's confusing
	  (let ((nd (or (and (not (null? end)) end)
			(length sequence))))
	    (if (and (= start 0)
		     (= nd (length sequence)))
		(fill! sequence item)
		(do ((i start (+ i 1)))
		    ((= i nd))
		  (set! (sequence i) item)))
	    sequence))

	;; many of the sequence functions return a different length sequence, but
	;;   for user-defined sequence types, we can't use the 'type kludge (or
	;;   at least it's ugly), so we need either (make obj size initial-value)
	;;   where obj is a representative of the desired type, or another
	;;   arg to copy giving the new object's size.  For now, I'll cobble up
	;;   something explicit.
	;;
	;; perhaps the extended type could give its type symbol as well as the make function?

	(define (make obj size)
	  (cond ((vector? obj)     (make-vector size))
		((list? obj)       (make-list size))
		((string? obj)     (make-string size))
		((hash-table? obj) (make-hash-table size)))) ; does this make any sense?

	(define* (make-sequence type size initial-element)
	  (case type 
	    ((vector bit-vector simple-vector) (make-vector size initial-element))
	    ((hash-table) (make-hash-table size))
	    ((string) (cl-make-string size (or initial-element #\null))) ; not #f!
	    ((list) (cl-make-list size initial-element))
            (else ())))

	(define (cl-map type func . lists)
	  (let* ((vals (apply mapcar func lists))
		 (len (length vals)))
	    (let ((obj (make-sequence (or type 'list) len)))
	      (if (> (length obj) 0)
		  (do ((i 0 (+ i 1)))
		      ((= i len))
		    (set! (obj i) (vals i))))
	      obj)))

	(define* (subseq sequence start end)
	  (let* ((len (length sequence))
		 (nd (or (and (number? end) end) len))
		 (size (- nd start))
		 (obj (make sequence size)))
	    (do ((i start (+ i 1))
		 (j 0 (+ j 1)))
		((= i nd) obj)
	      (set! (obj j) (sequence i)))))
	
	(define (concatenate type . sequences)
	  (let* ((len (apply + (map length sequences)))
		 (new-obj (make-sequence type len))
		 (ctr 0))
	    (for-each
	     (lambda (sequence)
	       (for-each
		(lambda (obj)
		  (set! (new-obj ctr) obj)
		  (set! ctr (+ ctr 1)))
		sequence))
	     sequences)
	    new-obj))

	;; :(concatenate 'list "hiho" #(1 2)) -> (#\h #\i #\h #\o 1 2)

	(define* (replace seq1 seq2 (start1 0) end1 (start2 0) end2)
	  (let* ((len1 (length seq1))
		 (len2 (length seq2))
		 (nd1 (or (and (number? end1) end1) len1))
		 (nd2 (or (and (number? end2) end2) len2)))
	    (if (and (eq? seq1 seq2)
		     (> start1 start2))
		(let ((offset (- start1 start2)))
		  (do ((i (- nd1 1) (- i 1)))
		      ((< i start1) seq1)
		    (set! (seq1 i) (seq1 (- i offset)))))
		(do ((i start1 (+ i 1))
		     (j start2 (+ j 1)))
		    ((or (= i nd1)
			 (= j nd2))
		     seq1)
		  (set! (seq1 i) (seq2 j))))))
	
	(let ()
	  (define* (remove-if predicate sequence from-end (start 0) end count (key identity))
	    (let* ((len (length sequence))
		   (nd (or (and (number? end) end) len))
		   (num (if (number? count) count len))
		   (changed 0))
	      (if (not (positive? num))
		  sequence
		  (let ((result ()))
		    (if (null from-end)
			(do ((i 0 (+ i 1)))
			    ((= i len))
			  (if (or (< i start)
				  (>= i nd)
				  (>= changed num)
				  (not (predicate (key (sequence i)))))
			      (set! result (cons (sequence i) result))
			      (set! changed (+ changed 1))))
			(do ((i (- len 1) (- i 1)))
			    ((< i 0))
			  (if (or (< i start)
				  (>= i nd)
				  (>= changed num)
				  (not (predicate (key (sequence i)))))
			      (set! result (cons (sequence i) result))
			      (set! changed (+ changed 1)))))		    
		    (let* ((len (length result))
			   (obj (make sequence len))
			   (vals (if (null from-end) (reverse result) result)))
		      (do ((i 0 (+ i 1)))
			  ((= i len))
			(set! (obj i) (vals i)))
		      obj)))))
	  
	  (define* (remove-if-not predicate sequence from-end (start 0) end count (key identity))
	    (remove-if (lambda (obj) (not (predicate obj))) sequence from-end start end count key))
	  
	  (define* (remove item sequence from-end (test eql) (start 0) end count (key identity))
	    (remove-if (lambda (arg) (test item arg)) sequence from-end start end count key))
	  
	  (define-macro* (delete-if predicate sequence from-end (start 0) end count (key identity))
	    `(let ((obj (remove-if ,predicate ,sequence ,from-end ,start ,end ,count ,key)))
	       (if (symbol? ',sequence)
		   (set! ,sequence obj))
	       obj))
	  
	  (define-macro* (delete-if-not predicate sequence from-end (start 0) end count (key identity))
	    `(let ((obj (remove-if-not ,predicate ,sequence ,from-end ,start ,end ,count ,key)))
	       (if (symbol? ',sequence)
		   (set! ,sequence obj))
	       obj))
	  
	  (define-macro* (delete item sequence from-end (test eql) (start 0) end count (key identity))
	    `(let ((obj (remove ,item ,sequence ,from-end ,test ,start ,end ,count ,key)))
	       (if (symbol? ',sequence)
		   (set! ,sequence obj))
	       obj))
	  
	  (define* (remove-duplicates sequence from-end (test eql) (start 0) end (key identity))
	    (let* ((result ())
		   (start-seq (+ start 1))
		   (len (length sequence))
		   (nd (if (number? end) end len)))
	      (do ((i start (+ i 1)))
		  ((= i nd))
		(let* ((orig-obj (sequence i))
		       (obj (key orig-obj)))
		  (if (null from-end)
		      (begin
			(if (not (find obj sequence :start start-seq :end nd :test test :key key))
			    (set! result (cons orig-obj result)))
			(set! start-seq (+ start-seq 1)))
		      (if (not (find obj result :test test :key key))
			  (set! result (cons orig-obj result))))))
	      (let* ((res (reverse result))
		     (new-len (+ (length result) start (- len nd)))
		     (new-seq (make sequence new-len)))
		(let ((n 0))
		  (do ((i 0 (+ i 1)))
		      ((= i len) new-seq)
		    (if (or (< i start)
			    (>= i nd))
			(begin
			  (set! (new-seq n) (sequence i))
			  (set! n (+ n 1)))
			(if (not (null? res))
			    (begin
			      (set! (new-seq n) (car res))
			      (set! res (cdr res))
			      (set! n (+ n 1))))))))))
	  
	  (define-macro* (delete-duplicates sequence from-end (test eql) (start 0) end (key identity))
	    `(let ((obj (remove-duplicates ,sequence ,from-end ,test ,start ,end ,key)))
	       (if (symbol? ,sequence)
		   (set! ,sequence obj))
	       obj))
	  
	  
	  (test-t (equal (remove 4 '(1 3 4 5 9)) '(1 3 5 9)))
	  (test-t (equal (remove 4 '(1 2 4 1 3 4 5)) '(1 2 1 3 5)))
	  (test-t (equal (remove 4 '(1 2 4 1 3 4 5) :count 1) '(1 2 1 3 4 5)))
	  (test-t (equal (remove 4 '(1 2 4 1 3 4 5) :count 1 :from-end t) '(1 2 4 1 3 5)))
	  (test-t (equal (remove 3 '(1 2 4 1 3 4 5) :test >) '(4 3 4 5)))
	  (test-t (let* ((lst '(list of four elements)) (lst2 (copy-seq lst)) (lst3 (delete 'four lst))) (and (equal lst3 '(list of elements)) (not (equal lst lst2)))))
	  (test-t (equal (remove-if oddp '(1 2 4 1 3 4 5)) '(2 4 4)))
	  (test-t (equal (remove-if evenp '(1 2 4 1 3 4 5) :count 1 :from-end t) '(1 2 4 1 3 5)))
	  (test-t (equal (remove-if-not evenp '(1 2 3 4 5 6 7 8 9) :count 2 :from-end t) '(1 2 3 4 5 6 8)))
	  (test-t (equal (delete 4 (list 1 2 4 1 3 4 5)) '(1 2 1 3 5)))
	  (test-t (equal (delete 4 (list 1 2 4 1 3 4 5) :count 1) '(1 2 1 3 4 5)))
	  (test-t (equal (delete 4 (list 1 2 4 1 3 4 5) :count 1 :from-end t) '(1 2 4 1 3 5)))
	  (test-t (equal (delete 3 (list 1 2 4 1 3 4 5) :test >) '(4 3 4 5)))
	  (test-t (equal (delete-if oddp (list 1 2 4 1 3 4 5)) '(2 4 4)))
	  (test-t (equal (delete-if evenp (list 1 2 4 1 3 4 5) :count 1 :from-end t) '(1 2 4 1 3 5)))
	  (test-t (equal (delete-if evenp (list 1 2 3 4 5 6)) '(1 3 5)))
	  (test-t (let* ((list0 (list 0 1 2 3 4)) (list (remove 3 list0))) (and (not (eq list0 list)) (equal list0 '(0 1 2 3 4)) (equal list '(0 1 2 4)))))
	  (test-t (equal (remove 'a (list 'a 'b 'c 'a 'b 'c)) '(b c b c)))
	  (test-t (equal (remove 'b (list 'a 'b 'c 'a 'b 'c)) '(a c a c)))
	  (test-t (equal (remove 'c (list 'a 'b 'c 'a 'b 'c)) '(a b a b)))
	  (test-t (equal (remove 'a (list 'a 'a 'a)) ()))
	  (test-t (equal (remove 'z (list 'a 'b 'c)) '(a b c)))
	  (test-t (equal (remove 'a ()) ()))
	  (test-t (equal (remove 'a (list 'a 'b 'c 'a 'b 'c) :count 0) '(a b c a b c)))
	  (test-t (equal (remove 'a (list 'a 'b 'c 'a 'b 'c) :count 1) '(b c a b c)))
	  (test-t (equal (remove 'a (list 'a 'b 'c 'a 'b 'c) :count 1 :from-end t) '(a b c b c)))
	  (test-t (equal (remove 'a (list 'a 'b 'c 'a 'b 'c) :count 2) '(b c b c)))
	  (test-t (equal (remove 'a (list 'a 'b 'c 'a 'b 'c) :count 2 :from-end t) '(b c b c)))
	  (test-t (equal (remove 'a (list 'a 'b 'c 'a 'b 'c) :count 3) '(b c b c)))
	  (test-t (equal (remove 'a (list 'a 'b 'c 'a 'b 'c) :count 3 :from-end t) '(b c b c)))
	  (test-t (equal (remove 'a (list 'a 'b 'c 'a 'b 'c) :count 4) '(b c b c)))
	  (test-t (equal (remove 'a (list 'a 'b 'c 'a 'b 'c) :count 4 :from-end t) '(b c b c)))
	  (test-t (equal (remove 'a (list 'a 'b 'c 'a 'b 'c) :count -1) '(a b c a b c)))
	  (test-t (equal (remove 'a (list 'a 'b 'c 'a 'b 'c) :count -10) '(a b c a b c)))
	  (test-t (equal (remove 'a (list 'a 'b 'c 'a 'b 'c) :count -100) '(a b c a b c)))
	  (test-t (equal (remove 'a (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1) '(a b c b c b c b c)))
	  (test-t (equal (remove 'a (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :count 1) '(a b c b c a b c a b c)))
	  (test-t (equal (remove 'a (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :count 2) '(a b c b c b c a b c)))
	  (test-t (equal (remove 'a (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end nil :count 2) '(a b c b c b c a b c)))
	  (test-t (equal (remove 'a (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8) '(a b c b c b c a b c)))
	  (test-t (equal (remove 'a (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count 1) '(a b c b c a b c a b c)))
	  (test-t (equal (remove 'a (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count 1 :from-end t) '(a b c a b c b c a b c)))
	  (test-t (equal (remove 'a (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count 0 :from-end t) '(a b c a b c a b c a b c)))
	  (test-t (equal (remove 'a (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count -100 :from-end t) '(a b c a b c a b c a b c)))
	  (test-t (equal (remove 'a (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 1) '(a b c a b c a b c a b c)))
	  (test-t (equal (remove 'a (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 2 :end 2) '(a b c a b c a b c a b c)))
	  (test-t (equal (remove 'a (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 12 :end 12) '(a b c a b c a b c a b c)))
	  (test-t (equal (remove 'a (list '(a) '(b) '(c) '(a) '(b) '(c)) :key car) '((b) (c) (b) (c))))
	  (test-t (equal (remove 'a (list '(a . b) '(b . c) '(c . a) '(a . b) '(b . c) '(c . a)) :key cdr) '((a . b) (b . c) (a . b) (b . c))))
	  (test-t (equal (remove "love" (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car) '(("Love") ("LOve") ("LOVe") ("LOVE"))))
	  (test-t (equal (remove "love" (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count -10) '(("Love") ("LOve") ("LOVe") ("LOVE"))))
	  (test-t (equal (remove "love" (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :test string-equal) ()))
	  (test-t (equal (remove "love" (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :test string-equal :count 1) '(("LOve") ("LOVe") ("LOVE"))))
	  (test-t (equal (remove "love" (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :test string-equal :count 1 :from-end t) '(("Love") ("LOve") ("LOVe"))))
	  (test-t (equal (remove "love" (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :test string-equal :count 2 :from-end t) '(("Love") ("LOve"))))
	  (test-t (equal (remove "love" (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :test string-equal :start 1 :end 3) '(("Love") ("LOVE"))))
	  (test-t (equal (remove "love" (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :test string-equal :count 1 :start 1 :end 3) '(("Love") ("LOVe") ("LOVE"))))
	  (test-t (equal (remove "love" (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :test string-equal :count 1 :from-end t :start 1 :end 3) '(("Love") ("LOve") ("LOVE"))))
	  (test-t (equal (remove "love" (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :test string-equal :count 10 :from-end t :start 1 :end 3) '(("Love") ("LOVE"))))
	  (test-t (let* ((vector0 (vector 0 1 2 3 4)) (vector (remove 3 vector0))) (and (not (eq vector0 vector)) (equalp vector0 #(0 1 2 3 4)) (equalp vector #(0 1 2 4)))))
	  (test-t (equalp (remove 'a (vector 'a 'b 'c 'a 'b 'c)) #(b c b c)))
	  (test-t (equalp (remove 'b (vector 'a 'b 'c 'a 'b 'c)) #(a c a c)))
	  (test-t (equalp (remove 'c (vector 'a 'b 'c 'a 'b 'c)) #(a b a b)))
	  (test-t (equalp (remove 'a (vector 'a 'a 'a)) #()))
	  (test-t (equalp (remove 'z (vector 'a 'b 'c)) #(a b c)))
	  (test-t (equalp (remove 'a #()) #()))
	  (test-t (equalp (remove 'a (vector 'a 'b 'c 'a 'b 'c) :count 0) #(a b c a b c)))
	  (test-t (equalp (remove 'a (vector 'a 'b 'c 'a 'b 'c) :count 1) #(b c a b c)))
	  (test-t (equalp (remove 'a (vector 'a 'b 'c 'a 'b 'c) :count 1 :from-end t) #(a b c b c)))
	  (test-t (equalp (remove 'a (vector 'a 'b 'c 'a 'b 'c) :count 2) #(b c b c)))
	  (test-t (equalp (remove 'a (vector 'a 'b 'c 'a 'b 'c) :count 2 :from-end t) #(b c b c)))
	  (test-t (equalp (remove 'a (vector 'a 'b 'c 'a 'b 'c) :count 3) #(b c b c)))
	  (test-t (equalp (remove 'a (vector 'a 'b 'c 'a 'b 'c) :count 3 :from-end t) #(b c b c)))
	  (test-t (equalp (remove 'a (vector 'a 'b 'c 'a 'b 'c) :count 4) #(b c b c)))
	  (test-t (equalp (remove 'a (vector 'a 'b 'c 'a 'b 'c) :count 4 :from-end t) #(b c b c)))
	  (test-t (equalp (remove 'a (vector 'a 'b 'c 'a 'b 'c) :count -1) #(a b c a b c)))
	  (test-t (equalp (remove 'a (vector 'a 'b 'c 'a 'b 'c) :count -10) #(a b c a b c)))
	  (test-t (equalp (remove 'a (vector 'a 'b 'c 'a 'b 'c) :count -100) #(a b c a b c)))
	  (test-t (equalp (remove 'a (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1) #(a b c b c b c b c)))
	  (test-t (equalp (remove 'a (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :count 1) #(a b c b c a b c a b c)))
	  (test-t (equalp (remove 'a (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :count 2) #(a b c b c b c a b c)))
	  (test-t (equalp (remove 'a (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end nil :count 2) #(a b c b c b c a b c)))
	  (test-t (equalp (remove 'a (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8) #(a b c b c b c a b c)))
	  (test-t (equalp (remove 'a (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count 1) #(a b c b c a b c a b c)))
	  (test-t (equalp (remove 'a (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count 1 :from-end t) #(a b c a b c b c a b c)))
	  (test-t (equalp (remove 'a (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count 0 :from-end t) #(a b c a b c a b c a b c)))
	  (test-t (equalp (remove 'a (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count -100 :from-end t) #(a b c a b c a b c a b c)))
	  (test-t (equalp (remove 'a (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 1) #(a b c a b c a b c a b c)))
	  (test-t (equalp (remove 'a (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 2 :end 2) #(a b c a b c a b c a b c)))
	  (test-t (equalp (remove 'a (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 12 :end 12) #(a b c a b c a b c a b c)))
	  (test-t (equalp (remove 'a (vector '(a) '(b) '(c) '(a) '(b) '(c)) :key car) #((b) (c) (b) (c))))
	  (test-t (equalp (remove 'a (vector '(a . b) '(b . c) '(c . a) '(a . b) '(b . c) '(c . a)) :key cdr) #((a . b) (b . c) (a . b) (b . c))))
	  (test-t (equalp (remove "love" (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car) #(("Love") ("LOve") ("LOVe") ("LOVE"))))
	  (test-t (equalp (remove "love" (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count -10) #(("Love") ("LOve") ("LOVe") ("LOVE"))))
	  (test-t (equalp (remove "love" (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :test string-equal) #()))
	  (test-t (equalp (remove "love" (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :test string-equal :count 1) #(("LOve") ("LOVe") ("LOVE"))))
	  (test-t (equalp (remove "love" (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :test string-equal :count 1 :from-end t) #(("Love") ("LOve") ("LOVe"))))
	  (test-t (equalp (remove "love" (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :test string-equal :count 2 :from-end t) #(("Love") ("LOve"))))
	  (test-t (equalp (remove "love" (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :test string-equal :start 1 :end 3) #(("Love") ("LOVE"))))
	  (test-t (equalp (remove "love" (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :test string-equal :count 1 :start 1 :end 3) #(("Love") ("LOVe") ("LOVE"))))
	  (test-t (equalp (remove "love" (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :test string-equal :count 1 :from-end t :start 1 :end 3) #(("Love") ("LOve") ("LOVE"))))
	  (test-t (equalp (remove "love" (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :test string-equal :count 10 :from-end t :start 1 :end 3) #(("Love") ("LOVE"))))
	  (test-t (string= (remove #\a (copy-seq "abcabc")) "bcbc"))
	  (test-t (string= (remove #\a (copy-seq "")) ""))
	  (test-t (string= (remove #\a (copy-seq "xyz")) "xyz"))
	  (test-t (string= (remove #\a (copy-seq "ABCABC")) "ABCABC"))
	  (test-t (string= (remove #\a (copy-seq "ABCABC") :key char-downcase) "BCBC"))
	  (test-t (string= (remove #\a (copy-seq "abcabc") :count 1) "bcabc"))
	  (test-t (string= (remove #\a (copy-seq "abcabc") :count 1 :from-end t) "abcbc"))
	  (test-t (string= (remove #\a (copy-seq "abcabc") :count 0) "abcabc"))
	  (test-t (string= (remove #\a (copy-seq "abcabc") :count -10) "abcabc"))
	  (test-t (let* ((str0 (copy-seq "abc")) (str (remove #\a str0))) (and (not (eq str0 str)) (string= str0 "abc") (string= str "bc"))))
	  (test-t (string= (remove #\a (copy-seq "abcabc") :count 0) "abcabc"))
	  (test-t (string= (remove #\a (copy-seq "abcabc")) "bcbc"))
	  (test-t (string= (remove #\b (copy-seq "abcabc")) "acac"))
	  (test-t (string= (remove #\c (copy-seq "abcabc")) "abab"))
	  (test-t (string= (remove #\a (copy-seq "abcabc") :count 0) "abcabc"))
	  (test-t (string= (remove #\a (copy-seq "abcabc") :count 1) "bcabc"))
	  (test-t (string= (remove #\a (copy-seq "abcabc") :count 1 :from-end t) "abcbc"))
	  (test-t (string= (remove #\a (copy-seq "abcabc") :count 2) "bcbc"))
	  (test-t (string= (remove #\a (copy-seq "abcabc") :count 2 :from-end t) "bcbc"))
	  (test-t (string= (remove #\a (copy-seq "abcabc") :count 3) "bcbc"))
	  (test-t (string= (remove #\a (copy-seq "abcabc") :count 3 :from-end t) "bcbc"))
	  (test-t (string= (remove #\a (copy-seq "abcabc") :count 4) "bcbc"))
	  (test-t (string= (remove #\a (copy-seq "abcabc") :count 4 :from-end t) "bcbc"))
	  (test-t (string= (remove #\a (copy-seq "abcabc") :count -1) "abcabc"))
	  (test-t (string= (remove #\a (copy-seq "abcabc") :count -10) "abcabc"))
	  (test-t (string= (remove #\a (copy-seq "abcabc") :count -100) "abcabc"))
	  (test-t (string= (remove #\a (copy-seq "abcabcabcabc") :start 1) "abcbcbcbc"))
	  (test-t (string= (remove #\a (copy-seq "abcabcabcabc") :start 1 :count 1) "abcbcabcabc"))
	  (test-t (string= (remove #\a (copy-seq "abcabcabcabc") :start 1 :count 2) "abcbcbcabc"))
	  (test-t (string= (remove #\a (copy-seq "abcabcabcabc") :start 1 :end nil :count 2) "abcbcbcabc"))
	  (test-t (string= (remove #\a (copy-seq "abcabcabcabc") :start 1 :end 8) "abcbcbcabc"))
	  (test-t (string= (remove #\a (copy-seq "abcabcabcabc") :start 1 :end 8 :count 1) "abcbcabcabc"))
	  (test-t (string= (remove #\a (copy-seq "abcabcabcabc") :start 1 :end 8 :count 1 :from-end t) "abcabcbcabc"))
	  (test-t (string= (remove #\a (copy-seq "abcabcabcabc") :start 1 :end 8 :count 0 :from-end t) "abcabcabcabc"))
	  (test-t (string= (remove #\a (copy-seq "abcabcabcabc") :start 1 :end 8 :count -100 :from-end t) "abcabcabcabc"))
	  (test-t (string= (remove #\a (copy-seq "abcabcabcabc") :start 1 :end 1) "abcabcabcabc"))
	  (test-t (string= (remove #\a (copy-seq "abcabcabcabc") :start 2 :end 2) "abcabcabcabc"))
	  (test-t (string= (remove #\a (copy-seq "abcabcabcabc") :start 12 :end 12) "abcabcabcabc"))
	  (test-t (let* ((list0 (list 0 1 2 3 4)) (list (remove-if (lambda (arg) (eql arg 3)) list0))) (and (not (eq list0 list)) (equal list0 '(0 1 2 3 4)) (equal list '(0 1 2 4)))))
	  (test-t (equal (remove-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c)) '(b c b c)))
	  (test-t (equal (remove-if (lambda (arg) (eql arg 'b)) (list 'a 'b 'c 'a 'b 'c)) '(a c a c)))
	  (test-t (equal (remove-if (lambda (arg) (eql arg 'c)) (list 'a 'b 'c 'a 'b 'c)) '(a b a b)))
	  (test-t (equal (remove-if (lambda (arg) (eql arg 'a)) (list 'a 'a 'a)) ()))
	  (test-t (equal (remove-if (lambda (arg) (eql arg 'z)) (list 'a 'b 'c)) '(a b c)))
	  (test-t (equal (remove-if (lambda (arg) (eql arg 'a)) ()) ()))
	  (test-t (equal (remove-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c) :count 0) '(a b c a b c)))
	  (test-t (equal (remove-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c) :count 1) '(b c a b c)))
	  (test-t (equal (remove-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c) :count 1 :from-end t) '(a b c b c)))
	  (test-t (equal (remove-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c) :count 2) '(b c b c)))
	  (test-t (equal (remove-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c) :count 2 :from-end t) '(b c b c)))
	  (test-t (equal (remove-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c) :count 3) '(b c b c)))
	  (test-t (equal (remove-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c) :count 3 :from-end t) '(b c b c)))
	  (test-t (equal (remove-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c) :count 4) '(b c b c)))
	  (test-t (equal (remove-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c) :count 4 :from-end t) '(b c b c)))
	  (test-t (equal (remove-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c) :count -1) '(a b c a b c)))
	  (test-t (equal (remove-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c) :count -10) '(a b c a b c)))
	  (test-t (equal (remove-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c) :count -100) '(a b c a b c)))
	  (test-t (equal (remove-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1) '(a b c b c b c b c)))
	  (test-t (equal (remove-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :count 1) '(a b c b c a b c a b c)))
	  (test-t (equal (remove-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :count 2) '(a b c b c b c a b c)))
	  (test-t (equal (remove-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end nil :count 2) '(a b c b c b c a b c)))
	  (test-t (equal (remove-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8) '(a b c b c b c a b c)))
	  (test-t (equal (remove-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count 1) '(a b c b c a b c a b c)))
	  (test-t (equal (remove-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count 1 :from-end t) '(a b c a b c b c a b c)))
	  (test-t (equal (remove-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count 0 :from-end t) '(a b c a b c a b c a b c)))
	  (test-t (equal (remove-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count -100 :from-end t) '(a b c a b c a b c a b c)))
	  (test-t (equal (remove-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 1) '(a b c a b c a b c a b c)))
	  (test-t (equal (remove-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 2 :end 2) '(a b c a b c a b c a b c)))
	  (test-t (equal (remove-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 12 :end 12) '(a b c a b c a b c a b c)))
	  (test-t (equal (remove-if (lambda (arg) (eql arg 'a)) (list '(a) '(b) '(c) '(a) '(b) '(c)) :key car) '((b) (c) (b) (c))))
	  (test-t (equal (remove-if (lambda (arg) (eql arg 'a)) (list '(a . b) '(b . c) '(c . a) '(a . b) '(b . c) '(c . a)) :key cdr) '((a . b) (b . c) (a . b) (b . c))))
	  (test-t (equal (remove-if (lambda (arg) (eql arg "love")) (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car) '(("Love") ("LOve") ("LOVe") ("LOVE"))))
	  (test-t (equal (remove-if (lambda (arg) (eql arg "love")) (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count -10) '(("Love") ("LOve") ("LOVe") ("LOVE"))))
	  (test-t (equal (remove-if (lambda (arg) (string-equal arg "love")) (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car) ()))
	  (test-t (equal (remove-if (lambda (arg) (string-equal arg "love")) (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 1) '(("LOve") ("LOVe") ("LOVE"))))
	  (test-t (equal (remove-if (lambda (arg) (string-equal arg "love")) (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 1 :from-end t) '(("Love") ("LOve") ("LOVe"))))
	  (test-t (equal (remove-if (lambda (arg) (string-equal arg "love")) (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 2 :from-end t) '(("Love") ("LOve"))))
	  (test-t (equal (remove-if (lambda (arg) (string-equal arg "love")) (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :start 1 :end 3) '(("Love") ("LOVE"))))
	  (test-t (equal (remove-if (lambda (arg) (string-equal arg "love")) (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 1 :start 1 :end 3) '(("Love") ("LOVe") ("LOVE"))))
	  (test-t (equal (remove-if (lambda (arg) (string-equal arg "love")) (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 1 :from-end t :start 1 :end 3) '(("Love") ("LOve") ("LOVE"))))
	  (test-t (equal (remove-if (lambda (arg) (string-equal arg "love")) (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 10 :from-end t :start 1 :end 3) '(("Love") ("LOVE"))))
	  (test-t (let* ((vector0 (vector 0 1 2 3 4)) (vector (remove-if (lambda (arg) (eql arg 3)) vector0))) (and (not (eq vector0 vector)) (equalp vector0 #(0 1 2 3 4)) (equalp vector #(0 1 2 4)))))
	  (test-t (equalp (remove-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c)) #(b c b c)))
	  (test-t (equalp (remove-if (lambda (arg) (eql arg 'b)) (vector 'a 'b 'c 'a 'b 'c)) #(a c a c)))
	  (test-t (equalp (remove-if (lambda (arg) (eql arg 'c)) (vector 'a 'b 'c 'a 'b 'c)) #(a b a b)))
	  (test-t (equalp (remove-if (lambda (arg) (eql arg 'a)) (vector 'a 'a 'a)) #()))
	  (test-t (equalp (remove-if (lambda (arg) (eql arg 'z)) (vector 'a 'b 'c)) #(a b c)))
	  (test-t (equalp (remove-if (lambda (arg) (eql arg 'a)) #()) #()))
	  (test-t (equalp (remove-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c) :count 0) #(a b c a b c)))
	  (test-t (equalp (remove-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c) :count 1) #(b c a b c)))
	  (test-t (equalp (remove-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c) :count 1 :from-end t) #(a b c b c)))
	  (test-t (equalp (remove-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c) :count 2) #(b c b c)))
	  (test-t (equalp (remove-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c) :count 2 :from-end t) #(b c b c)))
	  (test-t (equalp (remove-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c) :count 3) #(b c b c)))
	  (test-t (equalp (remove-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c) :count 3 :from-end t) #(b c b c)))
	  (test-t (equalp (remove-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c) :count 4) #(b c b c)))
	  (test-t (equalp (remove-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c) :count 4 :from-end t) #(b c b c)))
	  (test-t (equalp (remove-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c) :count -1) #(a b c a b c)))
	  (test-t (equalp (remove-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c) :count -10) #(a b c a b c)))
	  (test-t (equalp (remove-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c) :count -100) #(a b c a b c)))
	  (test-t (equalp (remove-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1) #(a b c b c b c b c)))
	  (test-t (equalp (remove-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :count 1) #(a b c b c a b c a b c)))
	  (test-t (equalp (remove-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :count 2) #(a b c b c b c a b c)))
	  (test-t (equalp (remove-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end nil :count 2) #(a b c b c b c a b c)))
	  (test-t (equalp (remove-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8) #(a b c b c b c a b c)))
	  (test-t (equalp (remove-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count 1) #(a b c b c a b c a b c)))
	  (test-t (equalp (remove-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count 1 :from-end t) #(a b c a b c b c a b c)))
	  (test-t (equalp (remove-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count 0 :from-end t) #(a b c a b c a b c a b c)))
	  (test-t (equalp (remove-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count -100 :from-end t) #(a b c a b c a b c a b c)))
	  (test-t (equalp (remove-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 1) #(a b c a b c a b c a b c)))
	  (test-t (equalp (remove-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 2 :end 2) #(a b c a b c a b c a b c)))
	  (test-t (equalp (remove-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 12 :end 12) #(a b c a b c a b c a b c)))
	  (test-t (equalp (remove-if (lambda (arg) (eql arg 'a)) (vector '(a) '(b) '(c) '(a) '(b) '(c)) :key car) #((b) (c) (b) (c))))
	  (test-t (equalp (remove-if (lambda (arg) (eql arg 'a)) (vector '(a . b) '(b . c) '(c . a) '(a . b) '(b . c) '(c . a)) :key cdr) #((a . b) (b . c) (a . b) (b . c))))
	  (test-t (equalp (remove-if (lambda (arg) (eql arg "love")) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car) #(("Love") ("LOve") ("LOVe") ("LOVE"))))
	  (test-t (equalp (remove-if (lambda (arg) (eql arg "love")) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count -10) #(("Love") ("LOve") ("LOVe") ("LOVE"))))
	  (test-t (equalp (remove-if (lambda (arg) (string-equal arg "love")) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car) #()))
	  (test-t (equalp (remove-if (lambda (arg) (string-equal arg "love")) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car) #()))
	  (test-t (equalp (remove-if (lambda (arg) (string-equal arg "love")) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 1) #(("LOve") ("LOVe") ("LOVE"))))
	  (test-t (equalp (remove-if (lambda (arg) (string-equal arg "love")) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 1) #(("LOve") ("LOVe") ("LOVE"))))
	  (test-t (equalp (remove-if (lambda (arg) (string-equal arg "love")) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 1 :from-end t) #(("Love") ("LOve") ("LOVe"))))
	  (test-t (equalp (remove-if (lambda (arg) (string-equal arg "love")) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 1 :from-end t) #(("Love") ("LOve") ("LOVe"))))
	  (test-t (equalp (remove-if (lambda (arg) (string-equal arg "love")) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 2 :from-end t) #(("Love") ("LOve"))))
	  (test-t (equalp (remove-if (lambda (arg) (string-equal arg "love")) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 2 :from-end t) #(("Love") ("LOve"))))
	  (test-t (equalp (remove-if (lambda (arg) (string-equal arg "love")) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :start 1 :end 3) #(("Love") ("LOVE"))))
	  (test-t (equalp (remove-if (lambda (arg) (string-equal arg "love")) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 1 :start 1 :end 3) #(("Love") ("LOVe") ("LOVE"))))
	  (test-t (equalp (remove-if (lambda (arg) (string-equal arg "love")) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 1 :from-end t :start 1 :end 3) #(("Love") ("LOve") ("LOVE"))))
	  (test-t (equalp (remove-if (lambda (arg) (string-equal arg "love")) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 10 :from-end t :start 1 :end 3) #(("Love") ("LOVE"))))
	  (test-t (string= (remove-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabc")) "bcbc"))
	  (test-t (string= (remove-if (lambda (arg) (string-equal arg #\a)) (copy-seq "")) ""))
	  (test-t (string= (remove-if (lambda (arg) (string-equal arg #\a)) (copy-seq "xyz")) "xyz"))
	  (test-t (string= (remove-if (lambda (arg) (string-equal arg #\a)) (copy-seq "ABCABC") :key char-downcase) "BCBC"))
	  (test-t (string= (remove-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabc") :count 1) "bcabc"))
	  (test-t (string= (remove-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabc") :count 1 :from-end t) "abcbc"))
	  (test-t (string= (remove-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabc") :count 0) "abcabc"))
	  (test-t (string= (remove-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabc") :count -10) "abcabc"))
	  (test-t (let* ((str0 (copy-seq "abc")) (str (remove-if (lambda (arg) (string-equal arg #\a)) str0))) (and (not (eq str0 str)) (string= str0 "abc") (string= str "bc"))))
	  (test-t (string= (remove-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabc") :count 0) "abcabc"))
	  (test-t (string= (remove-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabc")) "bcbc"))
	  (test-t (string= (remove-if (lambda (arg) (string-equal arg #\b)) (copy-seq "abcabc")) "acac"))
	  (test-t (string= (remove-if (lambda (arg) (string-equal arg #\c)) (copy-seq "abcabc")) "abab"))
	  (test-t (string= (remove-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabc") :count 0) "abcabc"))
	  (test-t (string= (remove-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabc") :count 1) "bcabc"))
	  (test-t (string= (remove-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabc") :count 1 :from-end t) "abcbc"))
	  (test-t (string= (remove-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabc") :count 2) "bcbc"))
	  (test-t (string= (remove-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabc") :count 2 :from-end t) "bcbc"))
	  (test-t (string= (remove-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabc") :count 3) "bcbc"))
	  (test-t (string= (remove-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabc") :count 3 :from-end t) "bcbc"))
	  (test-t (string= (remove-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabc") :count 4) "bcbc"))
	  (test-t (string= (remove-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabc") :count 4 :from-end t) "bcbc"))
	  (test-t (string= (remove-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabc") :count -1) "abcabc"))
	  (test-t (string= (remove-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabc") :count -10) "abcabc"))
	  (test-t (string= (remove-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabc") :count -100) "abcabc"))
	  (test-t (string= (remove-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabcabcabc") :start 1) "abcbcbcbc"))
	  (test-t (string= (remove-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabcabcabc") :start 1 :count 1) "abcbcabcabc"))
	  (test-t (string= (remove-if (lambda (arg) (eql arg #\a)) (copy-seq "abcabcabcabc") :start 1 :count 2) "abcbcbcabc"))
	  (test-t (string= (remove-if (lambda (arg) (eql arg #\a)) (copy-seq "abcabcabcabc") :start 1 :end nil :count 2) "abcbcbcabc"))
	  (test-t (string= (remove-if (lambda (arg) (eql arg #\a)) (copy-seq "abcabcabcabc") :start 1 :end 8) "abcbcbcabc"))
	  (test-t (string= (remove-if (lambda (arg) (eql arg #\a)) (copy-seq "abcabcabcabc") :start 1 :end 8 :count 1) "abcbcabcabc"))
	  (test-t (string= (remove-if (lambda (arg) (eql arg #\a)) (copy-seq "abcabcabcabc") :start 1 :end 8 :count 1 :from-end t) "abcabcbcabc"))
	  (test-t (string= (remove-if (lambda (arg) (eql arg #\a)) (copy-seq "abcabcabcabc") :start 1 :end 8 :count 0 :from-end t) "abcabcabcabc"))
	  (test-t (string= (remove-if (lambda (arg) (eql arg #\a)) (copy-seq "abcabcabcabc") :start 1 :end 8 :count -100 :from-end t) "abcabcabcabc"))
	  (test-t (string= (remove-if (lambda (arg) (eql arg #\a)) (copy-seq "abcabcabcabc") :start 1 :end 1) "abcabcabcabc"))
	  (test-t (string= (remove-if (lambda (arg) (eql arg #\a)) (copy-seq "abcabcabcabc") :start 2 :end 2) "abcabcabcabc"))
	  (test-t (string= (remove-if (lambda (arg) (eql arg #\a)) (copy-seq "abcabcabcabc") :start 12 :end 12) "abcabcabcabc"))
	  (test-t (let* ((list0 (list 0 1 2 3 4)) (list (remove-if-not (lambda (arg) (not (eql arg 3))) list0))) (and (not (eq list0 list)) (equal list0 '(0 1 2 3 4)) (equal list '(0 1 2 4)))))
	  (test-t (equal (remove-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c)) '(b c b c)))
	  (test-t (equal (remove-if-not (lambda (arg) (not (eql arg 'b))) (list 'a 'b 'c 'a 'b 'c)) '(a c a c)))
	  (test-t (equal (remove-if-not (lambda (arg) (not (eql arg 'c))) (list 'a 'b 'c 'a 'b 'c)) '(a b a b)))
	  (test-t (equal (remove-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'a 'a)) ()))
	  (test-t (equal (remove-if-not (lambda (arg) (not (eql arg 'z))) (list 'a 'b 'c)) '(a b c)))
	  (test-t (equal (remove-if-not (lambda (arg) (not (eql arg 'a))) ()) ()))
	  (test-t (equal (remove-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c) :count 0) '(a b c a b c)))
	  (test-t (equal (remove-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c) :count 1) '(b c a b c)))
	  (test-t (equal (remove-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c) :count 1 :from-end t) '(a b c b c)))
	  (test-t (equal (remove-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c) :count 2) '(b c b c)))
	  (test-t (equal (remove-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c) :count 2 :from-end t) '(b c b c)))
	  (test-t (equal (remove-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c) :count 3) '(b c b c)))
	  (test-t (equal (remove-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c) :count 3 :from-end t) '(b c b c)))
	  (test-t (equal (remove-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c) :count 4) '(b c b c)))
	  (test-t (equal (remove-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c) :count 4 :from-end t) '(b c b c)))
	  (test-t (equal (remove-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c) :count -1) '(a b c a b c)))
	  (test-t (equal (remove-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c) :count -10) '(a b c a b c)))
	  (test-t (equal (remove-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c) :count -100) '(a b c a b c)))
	  (test-t (equal (remove-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1) '(a b c b c b c b c)))
	  (test-t (equal (remove-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :count 1) '(a b c b c a b c a b c)))
	  (test-t (equal (remove-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :count 2) '(a b c b c b c a b c)))
	  (test-t (equal (remove-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end nil :count 2) '(a b c b c b c a b c)))
	  (test-t (equal (remove-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8) '(a b c b c b c a b c)))
	  (test-t (equal (remove-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count 1) '(a b c b c a b c a b c)))
	  (test-t (equal (remove-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count 1 :from-end t) '(a b c a b c b c a b c)))
	  (test-t (equal (remove-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count 0 :from-end t) '(a b c a b c a b c a b c)))
	  (test-t (equal (remove-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count -100 :from-end t) '(a b c a b c a b c a b c)))
	  (test-t (equal (remove-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 1) '(a b c a b c a b c a b c)))
	  (test-t (equal (remove-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 2 :end 2) '(a b c a b c a b c a b c)))
	  (test-t (equal (remove-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 12 :end 12) '(a b c a b c a b c a b c)))
	  (test-t (equal (remove-if-not (lambda (arg) (not (eql arg 'a))) (list '(a) '(b) '(c) '(a) '(b) '(c)) :key car) '((b) (c) (b) (c))))
	  (test-t (equal (remove-if-not (lambda (arg) (not (eql arg 'a))) (list '(a . b) '(b . c) '(c . a) '(a . b) '(b . c) '(c . a)) :key cdr) '((a . b) (b . c) (a . b) (b . c))))
	  (test-t (equal (remove-if-not (lambda (arg) (not (eql arg "love"))) (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car) '(("Love") ("LOve") ("LOVe") ("LOVE"))))
	  (test-t (equal (remove-if-not (lambda (arg) (not (eql arg "love"))) (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count -10) '(("Love") ("LOve") ("LOVe") ("LOVE"))))
	  (test-t (equal (remove-if-not (lambda (arg) (not (string-equal arg "love"))) (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car) ()))
	  (test-t (equal (remove-if-not (lambda (arg) (not (string-equal arg "love"))) (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 1) '(("LOve") ("LOVe") ("LOVE"))))
	  (test-t (equal (remove-if-not (lambda (arg) (not (string-equal arg "love"))) (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 1 :from-end t) '(("Love") ("LOve") ("LOVe"))))
	  (test-t (equal (remove-if-not (lambda (arg) (not (string-equal arg "love"))) (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 2 :from-end t) '(("Love") ("LOve"))))
	  (test-t (equal (remove-if-not (lambda (arg) (not (string-equal arg "love"))) (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :start 1 :end 3) '(("Love") ("LOVE"))))
	  (test-t (equal (remove-if-not (lambda (arg) (not (string-equal arg "love"))) (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 1 :start 1 :end 3) '(("Love") ("LOVe") ("LOVE"))))
	  (test-t (equal (remove-if-not (lambda (arg) (not (string-equal arg "love"))) (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 1 :from-end t :start 1 :end 3) '(("Love") ("LOve") ("LOVE"))))
	  (test-t (equal (remove-if-not (lambda (arg) (not (string-equal arg "love"))) (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 10 :from-end t :start 1 :end 3) '(("Love") ("LOVE"))))
	  (test-t (let* ((vector0 (vector 0 1 2 3 4)) (vector (remove-if-not (lambda (arg) (not (eql arg 3))) vector0))) (and (not (eq vector0 vector)) (equalp vector0 #(0 1 2 3 4)) (equalp vector #(0 1 2 4)))))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c)) #(b c b c)))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (eql arg 'b))) (vector 'a 'b 'c 'a 'b 'c)) #(a c a c)))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (eql arg 'c))) (vector 'a 'b 'c 'a 'b 'c)) #(a b a b)))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'a 'a)) #()))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (eql arg 'z))) (vector 'a 'b 'c)) #(a b c)))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (eql arg 'a))) #()) #()))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c) :count 0) #(a b c a b c)))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c) :count 1) #(b c a b c)))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c) :count 1 :from-end t) #(a b c b c)))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c) :count 2) #(b c b c)))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c) :count 2 :from-end t) #(b c b c)))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c) :count 3) #(b c b c)))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c) :count 3 :from-end t) #(b c b c)))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c) :count 4) #(b c b c)))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c) :count 4 :from-end t) #(b c b c)))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c) :count -1) #(a b c a b c)))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c) :count -10) #(a b c a b c)))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c) :count -100) #(a b c a b c)))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1) #(a b c b c b c b c)))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :count 1) #(a b c b c a b c a b c)))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :count 2) #(a b c b c b c a b c)))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end nil :count 2) #(a b c b c b c a b c)))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8) #(a b c b c b c a b c)))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count 1) #(a b c b c a b c a b c)))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count 1 :from-end t) #(a b c a b c b c a b c)))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count 0 :from-end t) #(a b c a b c a b c a b c)))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count -100 :from-end t) #(a b c a b c a b c a b c)))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 1) #(a b c a b c a b c a b c)))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 2 :end 2) #(a b c a b c a b c a b c)))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 12 :end 12) #(a b c a b c a b c a b c)))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (eql arg 'a))) (vector '(a) '(b) '(c) '(a) '(b) '(c)) :key car) #((b) (c) (b) (c))))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (eql arg 'a))) (vector '(a . b) '(b . c) '(c . a) '(a . b) '(b . c) '(c . a)) :key cdr) #((a . b) (b . c) (a . b) (b . c))))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (eql arg "love"))) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car) #(("Love") ("LOve") ("LOVe") ("LOVE"))))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (eql arg "love"))) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count -10) #(("Love") ("LOve") ("LOVe") ("LOVE"))))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (string-equal arg "love"))) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car) #()))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (string-equal arg "love"))) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car) #()))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (string-equal arg "love"))) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 1) #(("LOve") ("LOVe") ("LOVE"))))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (string-equal arg "love"))) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 1) #(("LOve") ("LOVe") ("LOVE"))))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (string-equal arg "love"))) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 1 :from-end t) #(("Love") ("LOve") ("LOVe"))))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (string-equal arg "love"))) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 1 :from-end t) #(("Love") ("LOve") ("LOVe"))))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (string-equal arg "love"))) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 2 :from-end t) #(("Love") ("LOve"))))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (string-equal arg "love"))) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 2 :from-end t) #(("Love") ("LOve"))))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (string-equal arg "love"))) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :start 1 :end 3) #(("Love") ("LOVE"))))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (string-equal arg "love"))) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 1 :start 1 :end 3) #(("Love") ("LOVe") ("LOVE"))))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (string-equal arg "love"))) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 1 :from-end t :start 1 :end 3) #(("Love") ("LOve") ("LOVE"))))
	  (test-t (equalp (remove-if-not (lambda (arg) (not (string-equal arg "love"))) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 10 :from-end t :start 1 :end 3) #(("Love") ("LOVE"))))
	  (test-t (string= (remove-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabc")) "bcbc"))
	  (test-t (string= (remove-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "")) ""))
	  (test-t (string= (remove-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "xyz")) "xyz"))
	  (test-t (string= (remove-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "ABCABC") :key char-downcase) "BCBC"))
	  (test-t (string= (remove-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabc") :count 1) "bcabc"))
	  (test-t (string= (remove-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabc") :count 1 :from-end t) "abcbc"))
	  (test-t (string= (remove-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabc") :count 0) "abcabc"))
	  (test-t (string= (remove-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabc") :count -10) "abcabc"))
	  (test-t (let* ((str0 (copy-seq "abc")) (str (remove-if-not (lambda (arg) (not (string-equal arg #\a))) str0))) (and (not (eq str0 str)) (string= str0 "abc") (string= str "bc"))))
	  (test-t (string= (remove-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabc") :count 0) "abcabc"))
	  (test-t (string= (remove-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabc")) "bcbc"))
	  (test-t (string= (remove-if-not (lambda (arg) (not (string-equal arg #\b))) (copy-seq "abcabc")) "acac"))
	  (test-t (string= (remove-if-not (lambda (arg) (not (string-equal arg #\c))) (copy-seq "abcabc")) "abab"))
	  (test-t (string= (remove-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabc") :count 0) "abcabc"))
	  (test-t (string= (remove-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabc") :count 1) "bcabc"))
	  (test-t (string= (remove-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabc") :count 1 :from-end t) "abcbc"))
	  (test-t (string= (remove-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabc") :count 2) "bcbc"))
	  (test-t (string= (remove-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabc") :count 2 :from-end t) "bcbc"))
	  (test-t (string= (remove-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabc") :count 3) "bcbc"))
	  (test-t (string= (remove-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabc") :count 3 :from-end t) "bcbc"))
	  (test-t (string= (remove-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabc") :count 4) "bcbc"))
	  (test-t (string= (remove-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabc") :count 4 :from-end t) "bcbc"))
	  (test-t (string= (remove-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabc") :count -1) "abcabc"))
	  (test-t (string= (remove-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabc") :count -10) "abcabc"))
	  (test-t (string= (remove-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabc") :count -100) "abcabc"))
	  (test-t (string= (remove-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabcabcabc") :start 1) "abcbcbcbc"))
	  (test-t (string= (remove-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabcabcabc") :start 1 :count 1) "abcbcabcabc"))
	  (test-t (string= (remove-if-not (lambda (arg) (not (eql arg #\a))) (copy-seq "abcabcabcabc") :start 1 :count 2) "abcbcbcabc"))
	  (test-t (string= (remove-if-not (lambda (arg) (not (eql arg #\a))) (copy-seq "abcabcabcabc") :start 1 :end nil :count 2) "abcbcbcabc"))
	  (test-t (string= (remove-if-not (lambda (arg) (not (eql arg #\a))) (copy-seq "abcabcabcabc") :start 1 :end 8) "abcbcbcabc"))
	  (test-t (string= (remove-if-not (lambda (arg) (not (eql arg #\a))) (copy-seq "abcabcabcabc") :start 1 :end 8 :count 1) "abcbcabcabc"))
	  (test-t (string= (remove-if-not (lambda (arg) (not (eql arg #\a))) (copy-seq "abcabcabcabc") :start 1 :end 8 :count 1 :from-end t) "abcabcbcabc"))
	  (test-t (string= (remove-if-not (lambda (arg) (not (eql arg #\a))) (copy-seq "abcabcabcabc") :start 1 :end 8 :count 0 :from-end t) "abcabcabcabc"))
	  (test-t (string= (remove-if-not (lambda (arg) (not (eql arg #\a))) (copy-seq "abcabcabcabc") :start 1 :end 8 :count -100 :from-end t) "abcabcabcabc"))
	  (test-t (string= (remove-if-not (lambda (arg) (not (eql arg #\a))) (copy-seq "abcabcabcabc") :start 1 :end 1) "abcabcabcabc"))
	  (test-t (string= (remove-if-not (lambda (arg) (not (eql arg #\a))) (copy-seq "abcabcabcabc") :start 2 :end 2) "abcabcabcabc"))
	  (test-t (string= (remove-if-not (lambda (arg) (not (eql arg #\a))) (copy-seq "abcabcabcabc") :start 12 :end 12) "abcabcabcabc"))
	  (test-t (equal (delete 'a (list 'a 'b 'c 'a 'b 'c)) '(b c b c)))
	  (test-t (equal (delete 'b (list 'a 'b 'c 'a 'b 'c)) '(a c a c)))
	  (test-t (equal (delete 'c (list 'a 'b 'c 'a 'b 'c)) '(a b a b)))
	  (test-t (equal (delete 'a (list 'a 'a 'a)) ()))
	  (test-t (equal (delete 'z (list 'a 'b 'c)) '(a b c)))
	  (test-t (equal (delete 'a ()) ()))
	  (test-t (equal (delete 'a (list 'a 'b 'c 'a 'b 'c) :count 0) '(a b c a b c)))
	  (test-t (equal (delete 'a (list 'a 'b 'c 'a 'b 'c) :count 1) '(b c a b c)))
	  (test-t (equal (delete 'a (list 'a 'b 'c 'a 'b 'c) :count 1 :from-end t) '(a b c b c)))
	  (test-t (equal (delete 'a (list 'a 'b 'c 'a 'b 'c) :count 2) '(b c b c)))
	  (test-t (equal (delete 'a (list 'a 'b 'c 'a 'b 'c) :count 2 :from-end t) '(b c b c)))
	  (test-t (equal (delete 'a (list 'a 'b 'c 'a 'b 'c) :count 3) '(b c b c)))
	  (test-t (equal (delete 'a (list 'a 'b 'c 'a 'b 'c) :count 3 :from-end t) '(b c b c)))
	  (test-t (equal (delete 'a (list 'a 'b 'c 'a 'b 'c) :count 4) '(b c b c)))
	  (test-t (equal (delete 'a (list 'a 'b 'c 'a 'b 'c) :count 4 :from-end t) '(b c b c)))
	  (test-t (equal (delete 'a (list 'a 'b 'c 'a 'b 'c) :count -1) '(a b c a b c)))
	  (test-t (equal (delete 'a (list 'a 'b 'c 'a 'b 'c) :count -10) '(a b c a b c)))
	  (test-t (equal (delete 'a (list 'a 'b 'c 'a 'b 'c) :count -100) '(a b c a b c)))
	  (test-t (equal (delete 'a (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1) '(a b c b c b c b c)))
	  (test-t (equal (delete 'a (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :count 1) '(a b c b c a b c a b c)))
	  (test-t (equal (delete 'a (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :count 2) '(a b c b c b c a b c)))
	  (test-t (equal (delete 'a (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end nil :count 2) '(a b c b c b c a b c)))
	  (test-t (equal (delete 'a (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8) '(a b c b c b c a b c)))
	  (test-t (equal (delete 'a (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count 1) '(a b c b c a b c a b c)))
	  (test-t (equal (delete 'a (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count 1 :from-end t) '(a b c a b c b c a b c)))
	  (test-t (equal (delete 'a (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count 0 :from-end t) '(a b c a b c a b c a b c)))
	  (test-t (equal (delete 'a (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count -100 :from-end t) '(a b c a b c a b c a b c)))
	  (test-t (equal (delete 'a (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 1) '(a b c a b c a b c a b c)))
	  (test-t (equal (delete 'a (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 2 :end 2) '(a b c a b c a b c a b c)))
	  (test-t (equal (delete 'a (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 12 :end 12) '(a b c a b c a b c a b c)))
	  (test-t (equal (delete 'a (list '(a) '(b) '(c) '(a) '(b) '(c)) :key car) '((b) (c) (b) (c))))
	  (test-t (equal (delete 'a (list '(a . b) '(b . c) '(c . a) '(a . b) '(b . c) '(c . a)) :key cdr) '((a . b) (b . c) (a . b) (b . c))))
	  (test-t (equal (delete "love" (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car) '(("Love") ("LOve") ("LOVe") ("LOVE"))))
	  (test-t (equal (delete "love" (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count -10) '(("Love") ("LOve") ("LOVe") ("LOVE"))))
	  (test-t (equal (delete "love" (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :test string-equal) ()))
	  (test-t (equal (delete "love" (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :test string-equal :count 1) '(("LOve") ("LOVe") ("LOVE"))))
	  (test-t (equal (delete "love" (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :test string-equal :count 1 :from-end t) '(("Love") ("LOve") ("LOVe"))))
	  (test-t (equal (delete "love" (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :test string-equal :count 2 :from-end t) '(("Love") ("LOve"))))
	  (test-t (equal (delete "love" (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :test string-equal :start 1 :end 3) '(("Love") ("LOVE"))))
	  (test-t (equal (delete "love" (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :test string-equal :count 1 :start 1 :end 3) '(("Love") ("LOVe") ("LOVE"))))
	  (test-t (equal (delete "love" (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :test string-equal :count 1 :from-end t :start 1 :end 3) '(("Love") ("LOve") ("LOVE"))))
	  (test-t (equal (delete "love" (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :test string-equal :count 10 :from-end t :start 1 :end 3) '(("Love") ("LOVE"))))
	  (test-t (equalp (delete 'a (vector 'a 'b 'c 'a 'b 'c)) #(b c b c)))
	  (test-t (equalp (delete 'b (vector 'a 'b 'c 'a 'b 'c)) #(a c a c)))
	  (test-t (equalp (delete 'c (vector 'a 'b 'c 'a 'b 'c)) #(a b a b)))
	  (test-t (equalp (delete 'a (vector 'a 'a 'a)) #()))
	  (test-t (equalp (delete 'z (vector 'a 'b 'c)) #(a b c)))
	  (test-t (equalp (delete 'a #()) #()))
	  (test-t (equalp (delete 'a (vector 'a 'b 'c 'a 'b 'c) :count 0) #(a b c a b c)))
	  (test-t (equalp (delete 'a (vector 'a 'b 'c 'a 'b 'c) :count 1) #(b c a b c)))
	  (test-t (equalp (delete 'a (vector 'a 'b 'c 'a 'b 'c) :count 1 :from-end t) #(a b c b c)))
	  (test-t (equalp (delete 'a (vector 'a 'b 'c 'a 'b 'c) :count 2) #(b c b c)))
	  (test-t (equalp (delete 'a (vector 'a 'b 'c 'a 'b 'c) :count 2 :from-end t) #(b c b c)))
	  (test-t (equalp (delete 'a (vector 'a 'b 'c 'a 'b 'c) :count 3) #(b c b c)))
	  (test-t (equalp (delete 'a (vector 'a 'b 'c 'a 'b 'c) :count 3 :from-end t) #(b c b c)))
	  (test-t (equalp (delete 'a (vector 'a 'b 'c 'a 'b 'c) :count 4) #(b c b c)))
	  (test-t (equalp (delete 'a (vector 'a 'b 'c 'a 'b 'c) :count 4 :from-end t) #(b c b c)))
	  (test-t (equalp (delete 'a (vector 'a 'b 'c 'a 'b 'c) :count -1) #(a b c a b c)))
	  (test-t (equalp (delete 'a (vector 'a 'b 'c 'a 'b 'c) :count -10) #(a b c a b c)))
	  (test-t (equalp (delete 'a (vector 'a 'b 'c 'a 'b 'c) :count -100) #(a b c a b c)))
	  (test-t (equalp (delete 'a (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1) #(a b c b c b c b c)))
	  (test-t (equalp (delete 'a (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :count 1) #(a b c b c a b c a b c)))
	  (test-t (equalp (delete 'a (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :count 2) #(a b c b c b c a b c)))
	  (test-t (equalp (delete 'a (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end nil :count 2) #(a b c b c b c a b c)))
	  (test-t (equalp (delete 'a (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8) #(a b c b c b c a b c)))
	  (test-t (equalp (delete 'a (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count 1) #(a b c b c a b c a b c)))
	  (test-t (equalp (delete 'a (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count 1 :from-end t) #(a b c a b c b c a b c)))
	  (test-t (equalp (delete 'a (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count 0 :from-end t) #(a b c a b c a b c a b c)))
	  (test-t (equalp (delete 'a (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count -100 :from-end t) #(a b c a b c a b c a b c)))
	  (test-t (equalp (delete 'a (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 1) #(a b c a b c a b c a b c)))
	  (test-t (equalp (delete 'a (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 2 :end 2) #(a b c a b c a b c a b c)))
	  (test-t (equalp (delete 'a (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 12 :end 12) #(a b c a b c a b c a b c)))
	  (test-t (equalp (delete 'a (vector '(a) '(b) '(c) '(a) '(b) '(c)) :key car) #((b) (c) (b) (c))))
	  (test-t (equalp (delete 'a (vector '(a . b) '(b . c) '(c . a) '(a . b) '(b . c) '(c . a)) :key cdr) #((a . b) (b . c) (a . b) (b . c))))
	  (test-t (equalp (delete "love" (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car) #(("Love") ("LOve") ("LOVe") ("LOVE"))))
	  (test-t (equalp (delete "love" (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count -10) #(("Love") ("LOve") ("LOVe") ("LOVE"))))
	  (test-t (equalp (delete "love" (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :test string-equal) #()))
	  (test-t (equalp (delete "love" (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :test string-equal :count 1) #(("LOve") ("LOVe") ("LOVE"))))
	  (test-t (equalp (delete "love" (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :test string-equal :count 1 :from-end t) #(("Love") ("LOve") ("LOVe"))))
	  (test-t (equalp (delete "love" (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :test string-equal :count 2 :from-end t) #(("Love") ("LOve"))))
	  (test-t (equalp (delete "love" (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :test string-equal :start 1 :end 3) #(("Love") ("LOVE"))))
	  (test-t (equalp (delete "love" (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :test string-equal :count 1 :start 1 :end 3) #(("Love") ("LOVe") ("LOVE"))))
	  (test-t (equalp (delete "love" (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :test string-equal :count 1 :from-end t :start 1 :end 3) #(("Love") ("LOve") ("LOVE"))))
	  (test-t (equalp (delete "love" (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :test string-equal :count 10 :from-end t :start 1 :end 3) #(("Love") ("LOVE"))))
	  (test-t (string= (delete #\a (copy-seq "abcabc")) "bcbc"))
	  (test-t (string= (delete #\a (copy-seq "")) ""))
	  (test-t (string= (delete #\a (copy-seq "xyz")) "xyz"))
	  (test-t (string= (delete #\a (copy-seq "ABCABC")) "ABCABC"))
	  (test-t (string= (delete #\a (copy-seq "ABCABC") :key char-downcase) "BCBC"))
	  (test-t (string= (delete #\a (copy-seq "abcabc") :count 1) "bcabc"))
	  (test-t (string= (delete #\a (copy-seq "abcabc") :count 1 :from-end t) "abcbc"))
	  (test-t (string= (delete #\a (copy-seq "abcabc") :count 0) "abcabc"))
	  (test-t (string= (delete #\a (copy-seq "abcabc") :count -10) "abcabc"))
	  (test-t (string= (delete #\a (copy-seq "abcabc") :count 0) "abcabc"))
	  (test-t (string= (delete #\a (copy-seq "abcabc")) "bcbc"))
	  (test-t (string= (delete #\b (copy-seq "abcabc")) "acac"))
	  (test-t (string= (delete #\c (copy-seq "abcabc")) "abab"))
	  (test-t (string= (delete #\a (copy-seq "abcabc") :count 0) "abcabc"))
	  (test-t (string= (delete #\a (copy-seq "abcabc") :count 1) "bcabc"))
	  (test-t (string= (delete #\a (copy-seq "abcabc") :count 1 :from-end t) "abcbc"))
	  (test-t (string= (delete #\a (copy-seq "abcabc") :count 2) "bcbc"))
	  (test-t (string= (delete #\a (copy-seq "abcabc") :count 2 :from-end t) "bcbc"))
	  (test-t (string= (delete #\a (copy-seq "abcabc") :count 3) "bcbc"))
	  (test-t (string= (delete #\a (copy-seq "abcabc") :count 3 :from-end t) "bcbc"))
	  (test-t (string= (delete #\a (copy-seq "abcabc") :count 4) "bcbc"))
	  (test-t (string= (delete #\a (copy-seq "abcabc") :count 4 :from-end t) "bcbc"))
	  (test-t (string= (delete #\a (copy-seq "abcabc") :count -1) "abcabc"))
	  (test-t (string= (delete #\a (copy-seq "abcabc") :count -10) "abcabc"))
	  (test-t (string= (delete #\a (copy-seq "abcabc") :count -100) "abcabc"))
	  (test-t (string= (delete #\a (copy-seq "abcabcabcabc") :start 1) "abcbcbcbc"))
	  (test-t (string= (delete #\a (copy-seq "abcabcabcabc") :start 1 :count 1) "abcbcabcabc"))
	  (test-t (string= (delete #\a (copy-seq "abcabcabcabc") :start 1 :count 2) "abcbcbcabc"))
	  (test-t (string= (delete #\a (copy-seq "abcabcabcabc") :start 1 :end nil :count 2) "abcbcbcabc"))
	  (test-t (string= (delete #\a (copy-seq "abcabcabcabc") :start 1 :end 8) "abcbcbcabc"))
	  (test-t (string= (delete #\a (copy-seq "abcabcabcabc") :start 1 :end 8 :count 1) "abcbcabcabc"))
	  (test-t (string= (delete #\a (copy-seq "abcabcabcabc") :start 1 :end 8 :count 1 :from-end t) "abcabcbcabc"))
	  (test-t (string= (delete #\a (copy-seq "abcabcabcabc") :start 1 :end 8 :count 0 :from-end t) "abcabcabcabc"))
	  (test-t (string= (delete #\a (copy-seq "abcabcabcabc") :start 1 :end 8 :count -100 :from-end t) "abcabcabcabc"))
	  (test-t (string= (delete #\a (copy-seq "abcabcabcabc") :start 1 :end 1) "abcabcabcabc"))
	  (test-t (string= (delete #\a (copy-seq "abcabcabcabc") :start 2 :end 2) "abcabcabcabc"))
	  (test-t (string= (delete #\a (copy-seq "abcabcabcabc") :start 12 :end 12) "abcabcabcabc"))
	  (test-t (equal (delete-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c)) '(b c b c)))
	  (test-t (equal (delete-if (lambda (arg) (eql arg 'b)) (list 'a 'b 'c 'a 'b 'c)) '(a c a c)))
	  (test-t (equal (delete-if (lambda (arg) (eql arg 'c)) (list 'a 'b 'c 'a 'b 'c)) '(a b a b)))
	  (test-t (equal (delete-if (lambda (arg) (eql arg 'a)) (list 'a 'a 'a)) ()))
	  (test-t (equal (delete-if (lambda (arg) (eql arg 'z)) (list 'a 'b 'c)) '(a b c)))
	  (test-t (equal (delete-if (lambda (arg) (eql arg 'a)) ()) ()))
	  (test-t (equal (delete-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c) :count 0) '(a b c a b c)))
	  (test-t (equal (delete-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c) :count 1) '(b c a b c)))
	  (test-t (equal (delete-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c) :count 1 :from-end t) '(a b c b c)))
	  (test-t (equal (delete-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c) :count 2) '(b c b c)))
	  (test-t (equal (delete-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c) :count 2 :from-end t) '(b c b c)))
	  (test-t (equal (delete-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c) :count 3) '(b c b c)))
	  (test-t (equal (delete-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c) :count 3 :from-end t) '(b c b c)))
	  (test-t (equal (delete-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c) :count 4) '(b c b c)))
	  (test-t (equal (delete-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c) :count 4 :from-end t) '(b c b c)))
	  (test-t (equal (delete-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c) :count -1) '(a b c a b c)))
	  (test-t (equal (delete-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c) :count -10) '(a b c a b c)))
	  (test-t (equal (delete-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c) :count -100) '(a b c a b c)))
	  (test-t (equal (delete-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1) '(a b c b c b c b c)))
	  (test-t (equal (delete-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :count 1) '(a b c b c a b c a b c)))
	  (test-t (equal (delete-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :count 2) '(a b c b c b c a b c)))
	  (test-t (equal (delete-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end nil :count 2) '(a b c b c b c a b c)))
	  (test-t (equal (delete-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8) '(a b c b c b c a b c)))
	  (test-t (equal (delete-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count 1) '(a b c b c a b c a b c)))
	  (test-t (equal (delete-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count 1 :from-end t) '(a b c a b c b c a b c)))
	  (test-t (equal (delete-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count 0 :from-end t) '(a b c a b c a b c a b c)))
	  (test-t (equal (delete-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count -100 :from-end t) '(a b c a b c a b c a b c)))
	  (test-t (equal (delete-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 1) '(a b c a b c a b c a b c)))
	  (test-t (equal (delete-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 2 :end 2) '(a b c a b c a b c a b c)))
	  (test-t (equal (delete-if (lambda (arg) (eql arg 'a)) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 12 :end 12) '(a b c a b c a b c a b c)))
	  (test-t (equal (delete-if (lambda (arg) (eql arg 'a)) (list '(a) '(b) '(c) '(a) '(b) '(c)) :key car) '((b) (c) (b) (c))))
	  (test-t (equal (delete-if (lambda (arg) (eql arg 'a)) (list '(a . b) '(b . c) '(c . a) '(a . b) '(b . c) '(c . a)) :key cdr) '((a . b) (b . c) (a . b) (b . c))))
	  (test-t (equal (delete-if (lambda (arg) (eql arg "love")) (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car) '(("Love") ("LOve") ("LOVe") ("LOVE"))))
	  (test-t (equal (delete-if (lambda (arg) (eql arg "love")) (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count -10) '(("Love") ("LOve") ("LOVe") ("LOVE"))))
	  (test-t (equal (delete-if (lambda (arg) (string-equal arg "love")) (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car) ()))
	  (test-t (equal (delete-if (lambda (arg) (string-equal arg "love")) (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 1) '(("LOve") ("LOVe") ("LOVE"))))
	  (test-t (equal (delete-if (lambda (arg) (string-equal arg "love")) (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 1 :from-end t) '(("Love") ("LOve") ("LOVe"))))
	  (test-t (equal (delete-if (lambda (arg) (string-equal arg "love")) (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 2 :from-end t) '(("Love") ("LOve"))))
	  (test-t (equal (delete-if (lambda (arg) (string-equal arg "love")) (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :start 1 :end 3) '(("Love") ("LOVE"))))
	  (test-t (equal (delete-if (lambda (arg) (string-equal arg "love")) (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 1 :start 1 :end 3) '(("Love") ("LOVe") ("LOVE"))))
	  (test-t (equal (delete-if (lambda (arg) (string-equal arg "love")) (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 1 :from-end t :start 1 :end 3) '(("Love") ("LOve") ("LOVE"))))
	  (test-t (equal (delete-if (lambda (arg) (string-equal arg "love")) (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 10 :from-end t :start 1 :end 3) '(("Love") ("LOVE"))))
	  (test-t (equalp (delete-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c)) #(b c b c)))
	  (test-t (equalp (delete-if (lambda (arg) (eql arg 'b)) (vector 'a 'b 'c 'a 'b 'c)) #(a c a c)))
	  (test-t (equalp (delete-if (lambda (arg) (eql arg 'c)) (vector 'a 'b 'c 'a 'b 'c)) #(a b a b)))
	  (test-t (equalp (delete-if (lambda (arg) (eql arg 'a)) (vector 'a 'a 'a)) #()))
	  (test-t (equalp (delete-if (lambda (arg) (eql arg 'z)) (vector 'a 'b 'c)) #(a b c)))
	  (test-t (equalp (delete-if (lambda (arg) (eql arg 'a)) #()) #()))
	  (test-t (equalp (delete-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c) :count 0) #(a b c a b c)))
	  (test-t (equalp (delete-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c) :count 1) #(b c a b c)))
	  (test-t (equalp (delete-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c) :count 1 :from-end t) #(a b c b c)))
	  (test-t (equalp (delete-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c) :count 2) #(b c b c)))
	  (test-t (equalp (delete-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c) :count 2 :from-end t) #(b c b c)))
	  (test-t (equalp (delete-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c) :count 3) #(b c b c)))
	  (test-t (equalp (delete-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c) :count 3 :from-end t) #(b c b c)))
	  (test-t (equalp (delete-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c) :count 4) #(b c b c)))
	  (test-t (equalp (delete-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c) :count 4 :from-end t) #(b c b c)))
	  (test-t (equalp (delete-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c) :count -1) #(a b c a b c)))
	  (test-t (equalp (delete-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c) :count -10) #(a b c a b c)))
	  (test-t (equalp (delete-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c) :count -100) #(a b c a b c)))
	  (test-t (equalp (delete-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1) #(a b c b c b c b c)))
	  (test-t (equalp (delete-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :count 1) #(a b c b c a b c a b c)))
	  (test-t (equalp (delete-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :count 2) #(a b c b c b c a b c)))
	  (test-t (equalp (delete-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end nil :count 2) #(a b c b c b c a b c)))
	  (test-t (equalp (delete-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8) #(a b c b c b c a b c)))
	  (test-t (equalp (delete-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count 1) #(a b c b c a b c a b c)))
	  (test-t (equalp (delete-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count 1 :from-end t) #(a b c a b c b c a b c)))
	  (test-t (equalp (delete-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count 0 :from-end t) #(a b c a b c a b c a b c)))
	  (test-t (equalp (delete-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count -100 :from-end t) #(a b c a b c a b c a b c)))
	  (test-t (equalp (delete-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 1) #(a b c a b c a b c a b c)))
	  (test-t (equalp (delete-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 2 :end 2) #(a b c a b c a b c a b c)))
	  (test-t (equalp (delete-if (lambda (arg) (eql arg 'a)) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 12 :end 12) #(a b c a b c a b c a b c)))
	  (test-t (equalp (delete-if (lambda (arg) (eql arg 'a)) (vector '(a) '(b) '(c) '(a) '(b) '(c)) :key car) #((b) (c) (b) (c))))
	  (test-t (equalp (delete-if (lambda (arg) (eql arg 'a)) (vector '(a . b) '(b . c) '(c . a) '(a . b) '(b . c) '(c . a)) :key cdr) #((a . b) (b . c) (a . b) (b . c))))
	  (test-t (equalp (delete-if (lambda (arg) (eql arg "love")) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car) #(("Love") ("LOve") ("LOVe") ("LOVE"))))
	  (test-t (equalp (delete-if (lambda (arg) (eql arg "love")) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count -10) #(("Love") ("LOve") ("LOVe") ("LOVE"))))
	  (test-t (equalp (delete-if (lambda (arg) (string-equal arg "love")) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car) #()))
	  (test-t (equalp (delete-if (lambda (arg) (string-equal arg "love")) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car) #()))
	  (test-t (equalp (delete-if (lambda (arg) (string-equal arg "love")) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 1) #(("LOve") ("LOVe") ("LOVE"))))
	  (test-t (equalp (delete-if (lambda (arg) (string-equal arg "love")) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 1) #(("LOve") ("LOVe") ("LOVE"))))
	  (test-t (equalp (delete-if (lambda (arg) (string-equal arg "love")) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 1 :from-end t) #(("Love") ("LOve") ("LOVe"))))
	  (test-t (equalp (delete-if (lambda (arg) (string-equal arg "love")) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 1 :from-end t) #(("Love") ("LOve") ("LOVe"))))
	  (test-t (equalp (delete-if (lambda (arg) (string-equal arg "love")) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 2 :from-end t) #(("Love") ("LOve"))))
	  (test-t (equalp (delete-if (lambda (arg) (string-equal arg "love")) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 2 :from-end t) #(("Love") ("LOve"))))
	  (test-t (equalp (delete-if (lambda (arg) (string-equal arg "love")) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :start 1 :end 3) #(("Love") ("LOVE"))))
	  (test-t (equalp (delete-if (lambda (arg) (string-equal arg "love")) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 1 :start 1 :end 3) #(("Love") ("LOVe") ("LOVE"))))
	  (test-t (equalp (delete-if (lambda (arg) (string-equal arg "love")) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 1 :from-end t :start 1 :end 3) #(("Love") ("LOve") ("LOVE"))))
	  (test-t (equalp (delete-if (lambda (arg) (string-equal arg "love")) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 10 :from-end t :start 1 :end 3) #(("Love") ("LOVE"))))
	  (test-t (string= (delete-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabc")) "bcbc"))
	  (test-t (string= (delete-if (lambda (arg) (string-equal arg #\a)) (copy-seq "")) ""))
	  (test-t (string= (delete-if (lambda (arg) (string-equal arg #\a)) (copy-seq "xyz")) "xyz"))
	  (test-t (string= (delete-if (lambda (arg) (string-equal arg #\a)) (copy-seq "ABCABC") :key char-downcase) "BCBC"))
	  (test-t (string= (delete-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabc") :count 1) "bcabc"))
	  (test-t (string= (delete-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabc") :count 1 :from-end t) "abcbc"))
	  (test-t (string= (delete-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabc") :count 0) "abcabc"))
	  (test-t (string= (delete-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabc") :count -10) "abcabc"))
	  (test-t (string= (delete-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabc") :count 0) "abcabc"))
	  (test-t (string= (delete-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabc")) "bcbc"))
	  (test-t (string= (delete-if (lambda (arg) (string-equal arg #\b)) (copy-seq "abcabc")) "acac"))
	  (test-t (string= (delete-if (lambda (arg) (string-equal arg #\c)) (copy-seq "abcabc")) "abab"))
	  (test-t (string= (delete-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabc") :count 0) "abcabc"))
	  (test-t (string= (delete-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabc") :count 1) "bcabc"))
	  (test-t (string= (delete-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabc") :count 1 :from-end t) "abcbc"))
	  (test-t (string= (delete-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabc") :count 2) "bcbc"))
	  (test-t (string= (delete-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabc") :count 2 :from-end t) "bcbc"))
	  (test-t (string= (delete-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabc") :count 3) "bcbc"))
	  (test-t (string= (delete-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabc") :count 3 :from-end t) "bcbc"))
	  (test-t (string= (delete-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabc") :count 4) "bcbc"))
	  (test-t (string= (delete-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabc") :count 4 :from-end t) "bcbc"))
	  (test-t (string= (delete-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabc") :count -1) "abcabc"))
	  (test-t (string= (delete-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabc") :count -10) "abcabc"))
	  (test-t (string= (delete-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabc") :count -100) "abcabc"))
	  (test-t (string= (delete-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabcabcabc") :start 1) "abcbcbcbc"))
	  (test-t (string= (delete-if (lambda (arg) (string-equal arg #\a)) (copy-seq "abcabcabcabc") :start 1 :count 1) "abcbcabcabc"))
	  (test-t (string= (delete-if (lambda (arg) (eql arg #\a)) (copy-seq "abcabcabcabc") :start 1 :count 2) "abcbcbcabc"))
	  (test-t (string= (delete-if (lambda (arg) (eql arg #\a)) (copy-seq "abcabcabcabc") :start 1 :end nil :count 2) "abcbcbcabc"))
	  (test-t (string= (delete-if (lambda (arg) (eql arg #\a)) (copy-seq "abcabcabcabc") :start 1 :end 8) "abcbcbcabc"))
	  (test-t (string= (delete-if (lambda (arg) (eql arg #\a)) (copy-seq "abcabcabcabc") :start 1 :end 8 :count 1) "abcbcabcabc"))
	  (test-t (string= (delete-if (lambda (arg) (eql arg #\a)) (copy-seq "abcabcabcabc") :start 1 :end 8 :count 1 :from-end t) "abcabcbcabc"))
	  (test-t (string= (delete-if (lambda (arg) (eql arg #\a)) (copy-seq "abcabcabcabc") :start 1 :end 8 :count 0 :from-end t) "abcabcabcabc"))
	  (test-t (string= (delete-if (lambda (arg) (eql arg #\a)) (copy-seq "abcabcabcabc") :start 1 :end 8 :count -100 :from-end t) "abcabcabcabc"))
	  (test-t (string= (delete-if (lambda (arg) (eql arg #\a)) (copy-seq "abcabcabcabc") :start 1 :end 1) "abcabcabcabc"))
	  (test-t (string= (delete-if (lambda (arg) (eql arg #\a)) (copy-seq "abcabcabcabc") :start 2 :end 2) "abcabcabcabc"))
	  (test-t (string= (delete-if (lambda (arg) (eql arg #\a)) (copy-seq "abcabcabcabc") :start 12 :end 12) "abcabcabcabc"))
	  (test-t (equal (delete-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c)) '(b c b c)))
	  (test-t (equal (delete-if-not (lambda (arg) (not (eql arg 'b))) (list 'a 'b 'c 'a 'b 'c)) '(a c a c)))
	  (test-t (equal (delete-if-not (lambda (arg) (not (eql arg 'c))) (list 'a 'b 'c 'a 'b 'c)) '(a b a b)))
	  (test-t (equal (delete-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'a 'a)) ()))
	  (test-t (equal (delete-if-not (lambda (arg) (not (eql arg 'z))) (list 'a 'b 'c)) '(a b c)))
	  (test-t (equal (delete-if-not (lambda (arg) (not (eql arg 'a))) ()) ()))
	  (test-t (equal (delete-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c) :count 0) '(a b c a b c)))
	  (test-t (equal (delete-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c) :count 1) '(b c a b c)))
	  (test-t (equal (delete-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c) :count 1 :from-end t) '(a b c b c)))
	  (test-t (equal (delete-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c) :count 2) '(b c b c)))
	  (test-t (equal (delete-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c) :count 2 :from-end t) '(b c b c)))
	  (test-t (equal (delete-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c) :count 3) '(b c b c)))
	  (test-t (equal (delete-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c) :count 3 :from-end t) '(b c b c)))
	  (test-t (equal (delete-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c) :count 4) '(b c b c)))
	  (test-t (equal (delete-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c) :count 4 :from-end t) '(b c b c)))
	  (test-t (equal (delete-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c) :count -1) '(a b c a b c)))
	  (test-t (equal (delete-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c) :count -10) '(a b c a b c)))
	  (test-t (equal (delete-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c) :count -100) '(a b c a b c)))
	  (test-t (equal (delete-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1) '(a b c b c b c b c)))
	  (test-t (equal (delete-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :count 1) '(a b c b c a b c a b c)))
	  (test-t (equal (delete-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :count 2) '(a b c b c b c a b c)))
	  (test-t (equal (delete-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end nil :count 2) '(a b c b c b c a b c)))
	  (test-t (equal (delete-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8) '(a b c b c b c a b c)))
	  (test-t (equal (delete-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count 1) '(a b c b c a b c a b c)))
	  (test-t (equal (delete-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count 1 :from-end t) '(a b c a b c b c a b c)))
	  (test-t (equal (delete-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count 0 :from-end t) '(a b c a b c a b c a b c)))
	  (test-t (equal (delete-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count -100 :from-end t) '(a b c a b c a b c a b c)))
	  (test-t (equal (delete-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 1) '(a b c a b c a b c a b c)))
	  (test-t (equal (delete-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 2 :end 2) '(a b c a b c a b c a b c)))
	  (test-t (equal (delete-if-not (lambda (arg) (not (eql arg 'a))) (list 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 12 :end 12) '(a b c a b c a b c a b c)))
	  (test-t (equal (delete-if-not (lambda (arg) (not (eql arg 'a))) (list '(a) '(b) '(c) '(a) '(b) '(c)) :key car) '((b) (c) (b) (c))))
	  (test-t (equal (delete-if-not (lambda (arg) (not (eql arg 'a))) (list '(a . b) '(b . c) '(c . a) '(a . b) '(b . c) '(c . a)) :key cdr) '((a . b) (b . c) (a . b) (b . c))))
	  (test-t (equal (delete-if-not (lambda (arg) (not (eql arg "love"))) (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car) '(("Love") ("LOve") ("LOVe") ("LOVE"))))
	  (test-t (equal (delete-if-not (lambda (arg) (not (eql arg "love"))) (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count -10) '(("Love") ("LOve") ("LOVe") ("LOVE"))))
	  (test-t (equal (delete-if-not (lambda (arg) (not (string-equal arg "love"))) (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car) ()))
	  (test-t (equal (delete-if-not (lambda (arg) (not (string-equal arg "love"))) (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 1) '(("LOve") ("LOVe") ("LOVE"))))
	  (test-t (equal (delete-if-not (lambda (arg) (not (string-equal arg "love"))) (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 1 :from-end t) '(("Love") ("LOve") ("LOVe"))))
	  (test-t (equal (delete-if-not (lambda (arg) (not (string-equal arg "love"))) (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 2 :from-end t) '(("Love") ("LOve"))))
	  (test-t (equal (delete-if-not (lambda (arg) (not (string-equal arg "love"))) (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :start 1 :end 3) '(("Love") ("LOVE"))))
	  (test-t (equal (delete-if-not (lambda (arg) (not (string-equal arg "love"))) (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 1 :start 1 :end 3) '(("Love") ("LOVe") ("LOVE"))))
	  (test-t (equal (delete-if-not (lambda (arg) (not (string-equal arg "love"))) (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 1 :from-end t :start 1 :end 3) '(("Love") ("LOve") ("LOVE"))))
	  (test-t (equal (delete-if-not (lambda (arg) (not (string-equal arg "love"))) (list '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 10 :from-end t :start 1 :end 3) '(("Love") ("LOVE"))))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c)) #(b c b c)))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (eql arg 'b))) (vector 'a 'b 'c 'a 'b 'c)) #(a c a c)))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (eql arg 'c))) (vector 'a 'b 'c 'a 'b 'c)) #(a b a b)))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'a 'a)) #()))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (eql arg 'z))) (vector 'a 'b 'c)) #(a b c)))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (eql arg 'a))) #()) #()))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c) :count 0) #(a b c a b c)))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c) :count 1) #(b c a b c)))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c) :count 1 :from-end t) #(a b c b c)))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c) :count 2) #(b c b c)))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c) :count 2 :from-end t) #(b c b c)))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c) :count 3) #(b c b c)))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c) :count 3 :from-end t) #(b c b c)))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c) :count 4) #(b c b c)))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c) :count 4 :from-end t) #(b c b c)))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c) :count -1) #(a b c a b c)))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c) :count -10) #(a b c a b c)))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c) :count -100) #(a b c a b c)))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1) #(a b c b c b c b c)))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :count 1) #(a b c b c a b c a b c)))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :count 2) #(a b c b c b c a b c)))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end nil :count 2) #(a b c b c b c a b c)))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8) #(a b c b c b c a b c)))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count 1) #(a b c b c a b c a b c)))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count 1 :from-end t) #(a b c a b c b c a b c)))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count 0 :from-end t) #(a b c a b c a b c a b c)))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 8 :count -100 :from-end t) #(a b c a b c a b c a b c)))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 1 :end 1) #(a b c a b c a b c a b c)))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 2 :end 2) #(a b c a b c a b c a b c)))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (eql arg 'a))) (vector 'a 'b 'c 'a 'b 'c 'a 'b 'c 'a 'b 'c) :start 12 :end 12) #(a b c a b c a b c a b c)))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (eql arg 'a))) (vector '(a) '(b) '(c) '(a) '(b) '(c)) :key car) #((b) (c) (b) (c))))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (eql arg 'a))) (vector '(a . b) '(b . c) '(c . a) '(a . b) '(b . c) '(c . a)) :key cdr) #((a . b) (b . c) (a . b) (b . c))))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (eql arg "love"))) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car) #(("Love") ("LOve") ("LOVe") ("LOVE"))))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (eql arg "love"))) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count -10) #(("Love") ("LOve") ("LOVe") ("LOVE"))))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (string-equal arg "love"))) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car) #()))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (string-equal arg "love"))) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car) #()))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (string-equal arg "love"))) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 1) #(("LOve") ("LOVe") ("LOVE"))))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (string-equal arg "love"))) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 1) #(("LOve") ("LOVe") ("LOVE"))))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (string-equal arg "love"))) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 1 :from-end t) #(("Love") ("LOve") ("LOVe"))))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (string-equal arg "love"))) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 1 :from-end t) #(("Love") ("LOve") ("LOVe"))))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (string-equal arg "love"))) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 2 :from-end t) #(("Love") ("LOve"))))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (string-equal arg "love"))) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 2 :from-end t) #(("Love") ("LOve"))))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (string-equal arg "love"))) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :start 1 :end 3) #(("Love") ("LOVE"))))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (string-equal arg "love"))) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 1 :start 1 :end 3) #(("Love") ("LOVe") ("LOVE"))))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (string-equal arg "love"))) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 1 :from-end t :start 1 :end 3) #(("Love") ("LOve") ("LOVE"))))
	  (test-t (equalp (delete-if-not (lambda (arg) (not (string-equal arg "love"))) (vector '("Love") '("LOve") '("LOVe") '("LOVE")) :key car :count 10 :from-end t :start 1 :end 3) #(("Love") ("LOVE"))))
	  (test-t (string= (delete-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabc")) "bcbc"))
	  (test-t (string= (delete-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "")) ""))
	  (test-t (string= (delete-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "xyz")) "xyz"))
	  (test-t (string= (delete-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "ABCABC") :key char-downcase) "BCBC"))
	  (test-t (string= (delete-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabc") :count 1) "bcabc"))
	  (test-t (string= (delete-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabc") :count 1 :from-end t) "abcbc"))
	  (test-t (string= (delete-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabc") :count 0) "abcabc"))
	  (test-t (string= (delete-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabc") :count -10) "abcabc"))
	  (test-t (string= (delete-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabc") :count 0) "abcabc"))
	  (test-t (string= (delete-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabc")) "bcbc"))
	  (test-t (string= (delete-if-not (lambda (arg) (not (string-equal arg #\b))) (copy-seq "abcabc")) "acac"))
	  (test-t (string= (delete-if-not (lambda (arg) (not (string-equal arg #\c))) (copy-seq "abcabc")) "abab"))
	  (test-t (string= (delete-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabc") :count 0) "abcabc"))
	  (test-t (string= (delete-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabc") :count 1) "bcabc"))
	  (test-t (string= (delete-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabc") :count 1 :from-end t) "abcbc"))
	  (test-t (string= (delete-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabc") :count 2) "bcbc"))
	  (test-t (string= (delete-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabc") :count 2 :from-end t) "bcbc"))
	  (test-t (string= (delete-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabc") :count 3) "bcbc"))
	  (test-t (string= (delete-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabc") :count 3 :from-end t) "bcbc"))
	  (test-t (string= (delete-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabc") :count 4) "bcbc"))
	  (test-t (string= (delete-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabc") :count 4 :from-end t) "bcbc"))
	  (test-t (string= (delete-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabc") :count -1) "abcabc"))
	  (test-t (string= (delete-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabc") :count -10) "abcabc"))
	  (test-t (string= (delete-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabc") :count -100) "abcabc"))
	  (test-t (string= (delete-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabcabcabc") :start 1) "abcbcbcbc"))
	  (test-t (string= (delete-if-not (lambda (arg) (not (string-equal arg #\a))) (copy-seq "abcabcabcabc") :start 1 :count 1) "abcbcabcabc"))
	  (test-t (string= (delete-if-not (lambda (arg) (not (eql arg #\a))) (copy-seq "abcabcabcabc") :start 1 :count 2) "abcbcbcabc"))
	  (test-t (string= (delete-if-not (lambda (arg) (not (eql arg #\a))) (copy-seq "abcabcabcabc") :start 1 :end nil :count 2) "abcbcbcabc"))
	  (test-t (string= (delete-if-not (lambda (arg) (not (eql arg #\a))) (copy-seq "abcabcabcabc") :start 1 :end 8) "abcbcbcabc"))
	  (test-t (string= (delete-if-not (lambda (arg) (not (eql arg #\a))) (copy-seq "abcabcabcabc") :start 1 :end 8 :count 1) "abcbcabcabc"))
	  (test-t (string= (delete-if-not (lambda (arg) (not (eql arg #\a))) (copy-seq "abcabcabcabc") :start 1 :end 8 :count 1 :from-end t) "abcabcbcabc"))
	  (test-t (string= (delete-if-not (lambda (arg) (not (eql arg #\a))) (copy-seq "abcabcabcabc") :start 1 :end 8 :count 0 :from-end t) "abcabcabcabc"))
	  (test-t (string= (delete-if-not (lambda (arg) (not (eql arg #\a))) (copy-seq "abcabcabcabc") :start 1 :end 8 :count -100 :from-end t) "abcabcabcabc"))
	  (test-t (string= (delete-if-not (lambda (arg) (not (eql arg #\a))) (copy-seq "abcabcabcabc") :start 1 :end 1) "abcabcabcabc"))
	  (test-t (string= (delete-if-not (lambda (arg) (not (eql arg #\a))) (copy-seq "abcabcabcabc") :start 2 :end 2) "abcabcabcabc"))
	  (test-t (string= (delete-if-not (lambda (arg) (not (eql arg #\a))) (copy-seq "abcabcabcabc") :start 12 :end 12) "abcabcabcabc"))
	  (test-t (equal (remove-duplicates "aBcDAbCd" :test char-equal :from-end t) "aBcD"))
	  (test-t (equal (remove-duplicates '(a b c b d d e)) '(a c b d e)))
	  (test-t (equal (remove-duplicates '(a b c b d d e) :from-end t) '(a b c d e)))
	  (test-t (let* ((list0 (list 0 1 2 3 4 5 6)) (list (delete-duplicates list0 :key oddp :start 1 :end 6))) (equal list '(0 4 5 6))))
	  (test-t (let* ((list0 (list 2 1 0 1 0 1 2)) (list (remove-duplicates list0))) (and (not (eq list0 list)) (equal list0 '(2 1 0 1 0 1 2)) (equal list '(0 1 2)))))
	  (test-t (let* ((vector0 (vector 2 1 0 1 0 1 2)) (vector (remove-duplicates vector0))) (and (not (eq vector0 vector)) (equalp vector0 #(2 1 0 1 0 1 2)) (equalp vector #(0 1 2)))))
	  (test-t (equal (remove-duplicates (list 0 1 2 2 3 3 3)) '(0 1 2 3)))
	  (test-t (equal (remove-duplicates (list 0 0 0 2 0 1 1 2 2 2 1 1 1 1 2)) '(0 1 2)))
	  (test-t (equal (remove-duplicates (list 'a 'a 'b 'c 'c)) '(a b c)))
	  (test-t (equal (remove-duplicates (list 0 1 2)) '(0 1 2)))
	  (test-t (equal (remove-duplicates (list 2 0 2 1 1 1 0 0 0 1 2)) '(0 1 2)))
	  (test-t (equal (remove-duplicates (list)) ()))
	  (test-t (equal (remove-duplicates (list '(x . 0) '(y . 1) '(z . 2) '(a . 0) '(b . 1) '(c . 2)) :key cdr) '((a . 0) (b . 1) (c . 2))))
	  (test-t (equal (remove-duplicates (list '(x . 0) '(y . 1) '(z . 2) '(a . 0) '(b . 1) '(c . 2)) :key cdr :test (lambda (a b) (and (oddp a) (oddp b)))) '((x . 0) (z . 2) (a . 0) (b . 1) (c . 2))))
	  (test-t (equal (remove-duplicates (list '(x . 0) '(y . 1) '(z . 2) '(a . 0) '(b . 1) '(c . 2)) :key cdr :test (lambda (a b) (and (evenp a) (evenp b)))) '((y . 1) (b . 1) (c . 2))))
	  (test-t (equal (remove-duplicates (list 0 1 2 0 1 2 0 1 2 0 1 2) :start 3 :end 9) '(0 1 2 0 1 2 0 1 2)))
	  (test-t (equal (remove-duplicates (list '(0 . 0) '(1 . 1) '(2 . 2) '(0 . 3) '(1 . 4) '(2 . 5) '(0 . 6) '(1 . 7) '(2 . 8) '(0 . 9) '(1 . 10) '(2 . 11))) (list '(0 . 0) '(1 . 1) '(2 . 2) '(0 . 3) '(1 . 4) '(2 . 5) '(0 . 6) '(1 . 7) '(2 . 8) '(0 . 9) '(1 . 10) '(2 . 11))))
	  (test-t (equal (remove-duplicates (list '(0 . 0) '(1 . 1) '(2 . 2) '(0 . 3) '(1 . 4) '(2 . 5) '(0 . 6) '(1 . 7) '(2 . 8) '(0 . 9) '(1 . 10) '(2 . 11)) :key car) '((0 . 9) (1 . 10) (2 . 11))))
	  (test-t (equal (remove-duplicates (list '(0 . 0) '(1 . 1) '(2 . 2) '(0 . 3) '(1 . 4) '(2 . 5) '(0 . 6) '(1 . 7) '(2 . 8) '(0 . 9) '(1 . 10) '(2 . 11)) :key car :from-end t) (list '(0 . 0) '(1 . 1) '(2 . 2))))
	  (test-t (equal (remove-duplicates (list '(0 . 0) '(1 . 1) '(2 . 2) '(0 . 3) '(1 . 4) '(2 . 5) '(0 . 6) '(1 . 7) '(2 . 8) '(0 . 9) '(1 . 10) '(2 . 11)) :start 3 :key car) (list '(0 . 0) '(1 . 1) '(2 . 2) '(0 . 9) '(1 . 10) '(2 . 11))))
	  (test-t (equal (remove-duplicates (list '(0 . 0) '(1 . 1) '(2 . 2) '(0 . 3) '(1 . 4) '(2 . 5) '(0 . 6) '(1 . 7) '(2 . 8) '(0 . 9) '(1 . 10) '(2 . 11)) :start 3 :key car :from-end t) (list '(0 . 0) '(1 . 1) '(2 . 2) '(0 . 3) '(1 . 4) '(2 . 5))))
	  (test-t (equal (remove-duplicates (list '(0 . 0) '(1 . 1) '(2 . 2) '(0 . 3) '(1 . 4) '(2 . 5) '(0 . 6) '(1 . 7) '(2 . 8) '(0 . 9) '(1 . 10) '(2 . 11)) :start 3 :end nil :key car) (list '(0 . 0) '(1 . 1) '(2 . 2) '(0 . 9) '(1 . 10) '(2 . 11))))
	  (test-t (equal (remove-duplicates (list '(0 . 0) '(1 . 1) '(2 . 2) '(0 . 3) '(1 . 4) '(2 . 5) '(0 . 6) '(1 . 7) '(2 . 8) '(0 . 9) '(1 . 10) '(2 . 11)) :start 3 :end 9 :key car) '((0 . 0) (1 . 1) (2 . 2) (0 . 6) (1 . 7) (2 . 8) (0 . 9) (1 . 10) (2 . 11))))
	  (test-t (equal (remove-duplicates (list '(0 . 0) '(1 . 1) '(2 . 2) '(0 . 3) '(1 . 4) '(2 . 5) '(0 . 6) '(1 . 7) '(2 . 8) '(0 . 9) '(1 . 10) '(2 . 11)) :start 3 :end 9 :key car :from-end t) (list '(0 . 0) '(1 . 1) '(2 . 2) '(0 . 3) '(1 . 4) '(2 . 5) '(0 . 9) '(1 . 10) '(2 . 11))))
	  (test-t (equal (remove-duplicates (list "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday") :key length) (list "Tuesday" "Wednesday" "Saturday" "Sunday")))
	  (test-t (equal (remove-duplicates (list "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday") :key (lambda (arg) (char arg 0)) :test char=) (list "Monday" "Wednesday" "Thursday" "Friday" "Sunday")))
	  (test-t (equal (remove-duplicates (list #\a #\b #\c #\A #\B #\C) :key char-upcase) '(#\A #\B #\C)))
	  (test-t (equal (remove-duplicates (list #\a #\b #\c #\A #\B #\C) :key char-upcase :from-end t) '(#\a #\b #\c)))
	  (test-t (equal (remove-duplicates (list #\a #\b #\c #\A #\B #\C) :test char=) (list #\a #\b #\c #\A #\B #\C)))
	  (test-t (equal (remove-duplicates (list #\a #\b #\c #\A #\B #\C) :test char-equal) (list #\A #\B #\C)))
	  (test-t (equal (remove-duplicates (list #\a #\b #\c #\A #\B #\C) :test char-equal :from-end t) (list #\a #\b #\c)))
	  (test-t (equal (remove-duplicates (list #\a #\1 #\b #\1 #\2 #\c #\0 #\A #\0 #\B #\C #\9) :key alpha-char-p) (list #\C #\9)))
	  (test-t (equal (remove-duplicates (list #\a #\1 #\b #\1 #\2 #\c #\0 #\A #\0 #\B #\C #\9) :key alphanumericp) (list #\9)))
	  (test-t (equal (remove-duplicates (list '(#\A . 0) '(#\b . 1) '(#\C . 2) '(#\a . 3) '(#\B . 4) '(#\c . 5) '(#\A . 6) '(#\b . 7) '(#\C . 8) '(#\a . 9) '(#\B . 10) '(#\c . 11))) (list '(#\A . 0) '(#\b . 1) '(#\C . 2) '(#\a . 3) '(#\B . 4) '(#\c . 5) '(#\A . 6) '(#\b . 7) '(#\C . 8) '(#\a . 9) '(#\B . 10) '(#\c . 11))))
	  (test-t (equal (remove-duplicates (list '(#\A . 0) '(#\b . 1) '(#\C . 2) '(#\a . 3) '(#\B . 4) '(#\c . 5) '(#\A . 6) '(#\b . 7) '(#\C . 8) '(#\a . 9) '(#\B . 10) '(#\c . 11)) :key car) (list '(#\A . 6) '(#\b . 7) '(#\C . 8) '(#\a . 9) '(#\B . 10) '(#\c . 11))))
	  (test-t (equal (remove-duplicates (list '(#\A . 0) '(#\b . 1) '(#\C . 2) '(#\a . 3) '(#\B . 4) '(#\c . 5) '(#\A . 6) '(#\b . 7) '(#\C . 8) '(#\a . 9) '(#\B . 10) '(#\c . 11)) :key car :start 3 :end 9) (list '(#\A . 0) '(#\b . 1) '(#\C . 2) '(#\a . 3) '(#\B . 4) '(#\c . 5) '(#\A . 6) '(#\b . 7) '(#\C . 8) '(#\a . 9) '(#\B . 10) '(#\c . 11))))
	  (test-t (equal (remove-duplicates (list '(#\A . 0) '(#\b . 1) '(#\C . 2) '(#\a . 3) '(#\B . 4) '(#\c . 5) '(#\A . 6) '(#\b . 7) '(#\C . 8) '(#\a . 9) '(#\B . 10) '(#\c . 11)) :key car :start 3 :end 9 :test char-equal) (list '(#\A . 0) '(#\b . 1) '(#\C . 2) '(#\A . 6) '(#\b . 7) '(#\C . 8) '(#\a . 9) '(#\B . 10) '(#\c . 11))))
	  (test-t (equal (remove-duplicates (list '(#\A . 0) '(#\b . 1) '(#\C . 2) '(#\a . 3) '(#\B . 4) '(#\c . 5) '(#\A . 6) '(#\b . 7) '(#\C . 8) '(#\a . 9) '(#\B . 10) '(#\c . 11)) :key car :start 3 :end 9 :test char-equal :from-end t) (list '(#\A . 0) '(#\b . 1) '(#\C . 2) '(#\a . 3) '(#\B . 4) '(#\c . 5) '(#\a . 9) '(#\B . 10) '(#\c . 11))))
	  (test-t (equal (remove-duplicates (list '(#\A . 0) '(#\b . 1) '(#\C . 2) '(#\a . 3) '(#\B . 4) '(#\c . 5) '(#\A . 6) '(#\b . 7) '(#\C . 8) '(#\a . 9) '(#\B . 10) '(#\c . 11)) :key car :start 3) (list '(#\A . 0) '(#\b . 1) '(#\C . 2) '(#\A . 6) '(#\b . 7) '(#\C . 8) '(#\a . 9) '(#\B . 10) '(#\c . 11))))
	  (test-t (equal (remove-duplicates (list '(#\A . 0) '(#\b . 1) '(#\C . 2) '(#\a . 3) '(#\B . 4) '(#\c . 5) '(#\A . 6) '(#\b . 7) '(#\C . 8) '(#\a . 9) '(#\B . 10) '(#\c . 11)) :key car :start 3 :end nil) (list '(#\A . 0) '(#\b . 1) '(#\C . 2) '(#\A . 6) '(#\b . 7) '(#\C . 8) '(#\a . 9) '(#\B . 10) '(#\c . 11))))
	  (test-t (equal (remove-duplicates (list '(#\A . 0) '(#\b . 1) '(#\C . 2) '(#\a . 3) '(#\B . 4) '(#\c . 5) '(#\A . 6) '(#\b . 7) '(#\C . 8) '(#\a . 9) '(#\B . 10) '(#\c . 11)) :key car :start 3 :from-end t) (list '(#\A . 0) '(#\b . 1) '(#\C . 2) '(#\a . 3) '(#\B . 4) '(#\c . 5) '(#\A . 6) '(#\b . 7) '(#\C . 8))))
	  (test-t (equal (remove-duplicates (list '(#\A . 0) '(#\b . 1) '(#\C . 2) '(#\a . 3) '(#\B . 4) '(#\c . 5) '(#\A . 6) '(#\b . 7) '(#\C . 8) '(#\a . 9) '(#\B . 10) '(#\c . 11)) :key car :end 9) (list '(#\a . 3) '(#\B . 4) '(#\c . 5) '(#\A . 6) '(#\b . 7) '(#\C . 8) '(#\a . 9) '(#\B . 10) '(#\c . 11))))
	  (test-t (equalp (remove-duplicates (vector 0 1 2 2 3 3 3)) #(0 1 2 3)))
	  (test-t (equalp (remove-duplicates (vector 0 0 0 2 0 1 1 2 2 2 1 1 1 1 2)) #(0 1 2)))
	  (test-t (equalp (remove-duplicates (vector 'a 'a 'b 'c 'c)) #(a b c)))
	  (test-t (equalp (remove-duplicates (vector 0 1 2)) #(0 1 2)))
	  (test-t (equalp (remove-duplicates (vector 2 0 2 1 1 1 0 0 0 1 2)) #(0 1 2)))
	  (test-t (equalp (remove-duplicates (vector)) #()))
	  (test-t (equalp (remove-duplicates (vector '(x . 0) '(y . 1) '(z . 2) '(a . 0) '(b . 1) '(c . 2)) :key cdr) #((a . 0) (b . 1) (c . 2))))
	  (test-t (equalp (remove-duplicates (vector 0 1 2 0 1 2 0 1 2 0 1 2) :start 3 :end 9) #(0 1 2 0 1 2 0 1 2)))
	  (test-t (equalp (remove-duplicates (vector "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday") :key length) (vector "Tuesday" "Wednesday" "Saturday" "Sunday")))
	  (test-t (equalp (remove-duplicates (vector #\a #\b #\c #\A #\B #\C) :key char-upcase) #(#\A #\B #\C)))
	  (test-t (equalp (remove-duplicates (vector #\a #\b #\c #\A #\B #\C) :key char-upcase :from-end t) #(#\a #\b #\c)))
	  (test-t (equalp (remove-duplicates (vector #\a #\b #\c #\A #\B #\C) :test char=) (vector #\a #\b #\c #\A #\B #\C)))
	  (test-t (equalp (remove-duplicates (vector #\a #\b #\c #\A #\B #\C) :test char-equal) (vector #\A #\B #\C)))
	  (test-t (equalp (remove-duplicates (vector #\a #\b #\c #\A #\B #\C) :test char-equal :from-end t) (vector #\a #\b #\c)))
	  (test-t (equalp (remove-duplicates (vector #\a #\1 #\b #\1 #\2 #\c #\0 #\A #\0 #\B #\C #\9) :key alpha-char-p) (vector #\C #\9)))
	  (test-t (equalp (remove-duplicates (vector #\a #\1 #\b #\1 #\2 #\c #\0 #\A #\0 #\B #\C #\9) :key alphanumericp) (vector #\9)))
	  (test-t (string= (remove-duplicates (copy-seq "")) ""))
	  (test-t (string= (remove-duplicates (copy-seq "abc")) "abc"))
	  (test-t (string= (remove-duplicates (copy-seq "abcabc")) "abc"))
	  (test-t (string= (remove-duplicates (copy-seq "cbaabc")) "abc"))
	  (test-t (string= (remove-duplicates (copy-seq "cbaabc") :from-end t) "cba"))
	  (test-t (string= (remove-duplicates (copy-seq "cbaabcABCCBA")) "abcCBA"))
	  (test-t (string= (remove-duplicates (copy-seq "cbaabcABCCBA") :from-end t) "cbaABC"))
	  (test-t (string= (remove-duplicates (copy-seq "cbaabcABCCBA") :key char-downcase) "CBA"))
	  (test-t (string= (remove-duplicates (copy-seq "cbaabcABCCBA") :key char-downcase :from-end t) "cba"))
	  (test-t (string= (remove-duplicates (copy-seq "cbaabcABCCBA") :start 3) "cbaabcCBA"))
	  (test-t (string= (remove-duplicates (copy-seq "cbaabcABCCBA") :start 3 :from-end t) "cbaabcABC"))
	  (test-t (string= (remove-duplicates (copy-seq "cbaabcABCCBA") :start 3 :end 9) "cbaabcABCCBA"))
	  (test-t (string= (remove-duplicates (copy-seq "cbaabcABCCBA") :start 3 :end 9 :key char-upcase) "cbaABCCBA"))
	  (test-t (string= (remove-duplicates (copy-seq "cbaabcABCCBA") :start 3 :end 9 :key char-upcase :from-end t) "cbaabcCBA"))
	  (test-t (string= (remove-duplicates (copy-seq "cbaabcABCCBA") :start 3 :end 9 :test char-equal :from-end t) "cbaabcCBA"))
	  (test-t (string= (remove-duplicates (copy-seq "cbaabcABCCBA") :start 3 :end 9 :key upper-case-p :test eq) "cbacCCBA"))
	  (test-t (string= (remove-duplicates (copy-seq "cbaabcABCCBA") :start 3 :end 9 :key upper-case-p :test eq :from-end t) "cbaaACBA"))
	  )
	
	(let ()
	  (define* (merge result-type seq1 seq2 predicate (key identity))
	    (let* ((len1 (length seq1))
		   (len2 (length seq2))
		   (size (+ len1 len2))
		   (obj (make-sequence result-type size))
		   (i 0)
		   (j 0))
	      (do ((n 0 (+ n 1)))
		  ((or (= i len1)
		       (= j len2))
		   (if (< i len1)
		       (do ((k i (+ k 1)))
			   ((= k len1) obj)
			 (set! (obj n) (seq1 k))
			 (set! n (+ n 1)))
		       (if (< j len2)
			   (do ((k j (+ k 1)))
			       ((= k len2) obj)
			     (set! (obj n) (seq2 k))
			     (set! n (+ n 1)))
			   obj)))
		(if (null (predicate (key (seq1 i)) (key (seq2 j))))
		    (begin
		      (set! (obj n) (seq2 j))
		      (set! j (+ j 1)))
		    (begin
		      (set! (obj n) (seq1 i))
		      (set! i (+ i 1)))))))
	  
	  (test-t (let ((test1 (list 1 3 4 6 7)) (test2 (list 2 5 8))) (equal (merge 'list test1 test2 <) '(1 2 3 4 5 6 7 8))))
	  (test-t (let ((test1 (vector '(red . 1) '(blue . 4))) (test2 (vector '(yellow . 2) '(green . 7)))) (equalp (merge 'vector test1 test2 < :key cdr) #((red . 1) (yellow . 2) (blue . 4) (green . 7)))))
	  (test-t (equal (merge 'list (list 1 3 5 7 9) (list 0 2 4 6 8) <) '(0 1 2 3 4 5 6 7 8 9)))
	  (test-t (equal (merge 'list (list 0 1 2) nil <) '(0 1 2)))
	  (test-t (equal (merge 'list nil (list 0 1 2) <) '(0 1 2)))
	  (test-t (equal (merge 'list nil nil <) nil))
	  (test-t (equal (merge 'list (list '(1 1) '(2 1) '(3 1)) (list '(1 2) '(2 2) '(3 2)) <= :key car) '((1 1) (1 2) (2 1) (2 2) (3 1) (3 2))))
	  (test-t (equal (merge 'list (list '(1 1) '(2 1) '(2 1 1) '(3 1)) (list '(1 2) '(2 2) '(3 2)) <= :key car) '((1 1) (1 2) (2 1) (2 1 1) (2 2) (3 1) (3 2))))
	  (test-t (equal (merge 'list (list '(1 1) '(2 1) '(2 1 1) '(3 1)) (list '(1 2) '(2 2) '(3 2) '(3 2 2)) <= :key car) '((1 1) (1 2) (2 1) (2 1 1) (2 2) (3 1) (3 2) (3 2 2))))
	  (test-t (equal (merge 'list (list 3 1 9 5 7) (list 8 6 0 2 4) <) '(3 1 8 6 0 2 4 9 5 7)))
	  (test-t (equal (merge 'list (vector 1 3 5 7 9) (list 0 2 4 6 8) <) '(0 1 2 3 4 5 6 7 8 9)))
	  (test-t (equal (merge 'list (vector 0 1 2) nil <) '(0 1 2)))
	  (test-t (equal (merge 'list #() (list 0 1 2) <) '(0 1 2)))
	  (test-t (equal (merge 'list #() #() <) nil))
	  (test-t (equal (merge 'list (vector '(1 1) '(2 1) '(3 1)) (list '(1 2) '(2 2) '(3 2)) <= :key car) '((1 1) (1 2) (2 1) (2 2) (3 1) (3 2))))
	  (test-t (equal (merge 'list (vector '(1 1) '(2 1) '(2 1 1) '(3 1)) (list '(1 2) '(2 2) '(3 2)) <= :key car) '((1 1) (1 2) (2 1) (2 1 1) (2 2) (3 1) (3 2))))
	  (test-t (equal (merge 'list (vector '(1 1) '(2 1) '(2 1 1) '(3 1)) (list '(1 2) '(2 2) '(3 2) '(3 2 2)) <= :key car) '((1 1) (1 2) (2 1) (2 1 1) (2 2) (3 1) (3 2) (3 2 2))))
	  (test-t (equal (merge 'list (vector 3 1 9 5 7) (list 8 6 0 2 4) <) '(3 1 8 6 0 2 4 9 5 7)))
	  (test-t (equal (merge 'list (list 1 3 5 7 9) (vector 0 2 4 6 8) <) '(0 1 2 3 4 5 6 7 8 9)))
	  (test-t (equal (merge 'list (list 0 1 2) #() <) '(0 1 2)))
	  (test-t (equal (merge 'list nil (vector 0 1 2) <) '(0 1 2)))
	  (test-t (equal (merge 'list nil #() <) nil))
	  (test-t (equal (merge 'list (list '(1 1) '(2 1) '(3 1)) (vector '(1 2) '(2 2) '(3 2)) <= :key car) '((1 1) (1 2) (2 1) (2 2) (3 1) (3 2))))
	  (test-t (equal (merge 'list (list '(1 1) '(2 1) '(2 1 1) '(3 1)) (vector '(1 2) '(2 2) '(3 2)) <= :key car) '((1 1) (1 2) (2 1) (2 1 1) (2 2) (3 1) (3 2))))
	  (test-t (equal (merge 'list (list '(1 1) '(2 1) '(2 1 1) '(3 1)) (vector '(1 2) '(2 2) '(3 2) '(3 2 2)) <= :key car) '((1 1) (1 2) (2 1) (2 1 1) (2 2) (3 1) (3 2) (3 2 2))))
	  (test-t (equal (merge 'list (list 3 1 9 5 7) (vector 8 6 0 2 4) <) '(3 1 8 6 0 2 4 9 5 7)))
	  (test-t (equal (merge 'list (vector 1 3 5 7 9) (vector 0 2 4 6 8) <) '(0 1 2 3 4 5 6 7 8 9)))
	  (test-t (equal (merge 'list (vector 0 1 2) #() <) '(0 1 2)))
	  (test-t (equal (merge 'list #() (vector 0 1 2) <) '(0 1 2)))
	  (test-t (equal (merge 'list #() #() <) nil))
	  (test-t (equal (merge 'list (vector '(1 1) '(2 1) '(3 1)) (vector '(1 2) '(2 2) '(3 2)) <= :key car) '((1 1) (1 2) (2 1) (2 2) (3 1) (3 2))))
	  (test-t (equal (merge 'list (vector '(1 1) '(2 1) '(2 1 1) '(3 1)) (vector '(1 2) '(2 2) '(3 2)) <= :key car) '((1 1) (1 2) (2 1) (2 1 1) (2 2) (3 1) (3 2))))
	  (test-t (equal (merge 'list (vector '(1 1) '(2 1) '(2 1 1) '(3 1)) (vector '(1 2) '(2 2) '(3 2) '(3 2 2)) <= :key car) '((1 1) (1 2) (2 1) (2 1 1) (2 2) (3 1) (3 2) (3 2 2))))
	  (test-t (equal (merge 'list (vector 3 1 9 5 7) (vector 8 6 0 2 4) <) '(3 1 8 6 0 2 4 9 5 7)))
	  (test-t (equalp (merge 'vector (list 1 3 5 7 9) (list 0 2 4 6 8) <) #(0 1 2 3 4 5 6 7 8 9)))
	  (test-t (equalp (merge 'vector (list 1 3 5 7 9) (list 0 2 4 6 8) <) #(0 1 2 3 4 5 6 7 8 9)))
	  (test-t (equalp (merge 'vector (list 0 1 2) nil <) #(0 1 2)))
	  (test-t (equalp (merge 'vector nil (list 0 1 2) <) #(0 1 2)))
	  (test-t (equalp (merge 'vector nil nil <) #()))
	  (test-t (equalp (merge 'vector (list '(1 1) '(2 1) '(3 1)) (list '(1 2) '(2 2) '(3 2)) <= :key car) #((1 1) (1 2) (2 1) (2 2) (3 1) (3 2))))
	  (test-t (equalp (merge 'vector (list '(1 1) '(2 1) '(2 1 1) '(3 1)) (list '(1 2) '(2 2) '(3 2)) <= :key car) #((1 1) (1 2) (2 1) (2 1 1) (2 2) (3 1) (3 2))))
	  (test-t (equalp (merge 'vector (list '(1 1) '(2 1) '(2 1 1) '(3 1)) (list '(1 2) '(2 2) '(3 2) '(3 2 2)) <= :key car) #((1 1) (1 2) (2 1) (2 1 1) (2 2) (3 1) (3 2) (3 2 2))))
	  (test-t (equalp (merge 'vector (list 3 1 9 5 7) (list 8 6 0 2 4) <) #(3 1 8 6 0 2 4 9 5 7)))
	  (test-t (equalp (merge 'vector (vector 1 3 5 7 9) (list 0 2 4 6 8) <) #(0 1 2 3 4 5 6 7 8 9)))
	  (test-t (equalp (merge 'vector (vector 1 3 5 7 9) (list 0 2 4 6 8) <) #(0 1 2 3 4 5 6 7 8 9)))
	  (test-t (equalp (merge 'vector (vector 0 1 2) nil <) #(0 1 2)))
	  (test-t (equalp (merge 'vector #() (list 0 1 2) <) #(0 1 2)))
	  (test-t (equalp (merge 'vector #() #() <) #()))
	  (test-t (equalp (merge 'vector (vector '(1 1) '(2 1) '(3 1)) (list '(1 2) '(2 2) '(3 2)) <= :key car) #((1 1) (1 2) (2 1) (2 2) (3 1) (3 2))))
	  (test-t (equalp (merge 'vector (vector '(1 1) '(2 1) '(2 1 1) '(3 1)) (list '(1 2) '(2 2) '(3 2)) <= :key car) #((1 1) (1 2) (2 1) (2 1 1) (2 2) (3 1) (3 2))))
	  (test-t (equalp (merge 'vector (vector '(1 1) '(2 1) '(2 1 1) '(3 1)) (list '(1 2) '(2 2) '(3 2) '(3 2 2)) <= :key car) #((1 1) (1 2) (2 1) (2 1 1) (2 2) (3 1) (3 2) (3 2 2))))
	  (test-t (equalp (merge 'vector (vector 3 1 9 5 7) (list 8 6 0 2 4) <) #(3 1 8 6 0 2 4 9 5 7)))
	  (test-t (equalp (merge 'vector (list 1 3 5 7 9) (vector 0 2 4 6 8) <) #(0 1 2 3 4 5 6 7 8 9)))
	  (test-t (equalp (merge 'vector (list 1 3 5 7 9) (vector 0 2 4 6 8) <) #(0 1 2 3 4 5 6 7 8 9)))
	  (test-t (equalp (merge 'vector (list 0 1 2) #() <) #(0 1 2)))
	  (test-t (equalp (merge 'vector nil (vector 0 1 2) <) #(0 1 2)))
	  (test-t (equalp (merge 'vector nil #() <) #()))
	  (test-t (equalp (merge 'vector (list '(1 1) '(2 1) '(3 1)) (vector '(1 2) '(2 2) '(3 2)) <= :key car) #((1 1) (1 2) (2 1) (2 2) (3 1) (3 2))))
	  (test-t (equalp (merge 'vector (list '(1 1) '(2 1) '(2 1 1) '(3 1)) (vector '(1 2) '(2 2) '(3 2)) <= :key car) #((1 1) (1 2) (2 1) (2 1 1) (2 2) (3 1) (3 2))))
	  (test-t (equalp (merge 'vector (list '(1 1) '(2 1) '(2 1 1) '(3 1)) (vector '(1 2) '(2 2) '(3 2) '(3 2 2)) <= :key car) #((1 1) (1 2) (2 1) (2 1 1) (2 2) (3 1) (3 2) (3 2 2))))
	  (test-t (equalp (merge 'vector (list 3 1 9 5 7) (vector 8 6 0 2 4) <) #(3 1 8 6 0 2 4 9 5 7)))
	  (test-t (equalp (merge 'vector (vector 1 3 5 7 9) (vector 0 2 4 6 8) <) #(0 1 2 3 4 5 6 7 8 9)))
	  (test-t (equalp (merge 'vector (vector 0 1 2) #() <) #(0 1 2)))
	  (test-t (equalp (merge 'vector #() (vector 0 1 2) <) #(0 1 2)))
	  (test-t (equalp (merge 'vector #() #() <) #()))
	  (test-t (equalp (merge 'vector (vector '(1 1) '(2 1) '(3 1)) (vector '(1 2) '(2 2) '(3 2)) <= :key car) #((1 1) (1 2) (2 1) (2 2) (3 1) (3 2))))
	  (test-t (equalp (merge 'vector (vector '(1 1) '(2 1) '(2 1 1) '(3 1)) (vector '(1 2) '(2 2) '(3 2)) <= :key car) #((1 1) (1 2) (2 1) (2 1 1) (2 2) (3 1) (3 2))))
	  (test-t (equalp (merge 'vector (vector '(1 1) '(2 1) '(2 1 1) '(3 1)) (vector '(1 2) '(2 2) '(3 2) '(3 2 2)) <= :key car) #((1 1) (1 2) (2 1) (2 1 1) (2 2) (3 1) (3 2) (3 2 2))))
	  (test-t (equalp (merge 'vector (vector 3 1 9 5 7) (vector 8 6 0 2 4) <) #(3 1 8 6 0 2 4 9 5 7)))
	  (test-t (string= (merge 'string (list #\a #\c #\e) (list #\b #\d #\f) char<) "abcdef"))
	  (test-t (string= (merge 'string (list #\a #\b #\c) (list #\d #\e #\f) char<) "abcdef"))
	  (test-t (string= (merge 'string (list #\a #\b #\c) () char<) "abc"))
	  (test-t (string= (merge 'string () (list #\a #\b #\c) char<) "abc"))
	  (test-t (string= (merge 'string (list #\a #\b #\c) (copy-seq "") char<) "abc"))
	  (test-t (string= (merge 'string (list #\a #\b #\z) #(#\c #\x #\y) char<) "abcxyz"))
	)
	
	(let ()
	  (define* (search seq1 seq2 from-end (test eql) (key identity) (start1 0) (start2 0) end1 end2)
	    (let* ((len1 (length seq1))
		   (len2 (length seq2))
		   (nd1 (or (and (number? end1) end1) len1))
		   (nd2 (or (and (number? end2) end2) len2)))
	      (set! len1 (min len1 (- nd1 start1)))
	      (set! len2 (min len2 (- nd2 start2)))
	      (if (or (= len2 0)
		      (> len1 len2))
		  ()
		  (call-with-exit
		   (lambda (return)
		     (if (or (not from-end) (null? from-end))
			 (do ((i start2 (+ i 1)))
			     ((> i (- nd2 len1)) ())
			   (do ((j start1 (+ j 1))
				(k i (+ k 1)))
			       ((or (= j nd1)
				    (not (test (key (seq1 j)) (key (seq2 k)))))
				(if (= j nd1)
				    (return i)))))
			 (do ((i (- nd2 len1) (- i 1)))
			     ((< i start2) ())
			   (do ((j start1 (+ j 1))
				(k i (+ k 1)))
			       ((or (= j nd1)
				    (not (test (key (seq1 j)) (key (seq2 k)))))
				(if (= j nd1)
				    (return i)))))))))))
	  
	  (define* (mismatch seq1 seq2 from-end (test eql) (key identity) (start1 0) (start2 0) end1 end2)
	    (let* ((nd1 (or (and (number? end1) end1) (length seq1)))
		   (nd2 (or (and (number? end2) end2) (length seq2))))
	      (if (not from-end)
		  (do ((i start1 (+ i 1))
		       (j start2 (+ j 1)))
		      ((or (= i nd1)
			   (= j nd2)
			   (not (test (key (seq1 i)) (key (seq2 j)))))
		       (if (and (= i nd1) (= j nd2))
			   ()
			   i)))
		  (do ((i (- nd1 1) (- i 1))
		       (j (- nd2 1) (- j 1)))
		      ((or (< i start1)
			   (< j start2)
			   (not (test (key (seq1 i)) (key (seq2 j)))))
		       (if (and (< i start1) (< j start2))
			   ()
			   (+ i 1)))))))
	  
	  (test-t (eql (search "dog" "it's a dog's life") 7))
	  (test-t (eql (search '(0 1) '(2 4 6 1 3 5) :key oddp) 2))
	  (test-t (null (search '(a b c) '(x y z))))
	  (test-t (eql (search () '(x y z)) 0))
	  (test-t (eql (search '(a) '(a)) 0))
	  (test-t (eql (search '(a b c) '(a b c x y z)) 0))
	  (test-t (eql (search '(a b c) '(x a b c y z)) 1))
	  (test-t (eql (search '(a b c) '(x y a b c z)) 2))
	  (test-t (eql (search '(a b c) '(x y z a b c)) 3))
	  (test-t (eql (search '(a b c) '(a b c a b c) :start2 1) 3))
	  (test-t (eql (search '(a b c) '(a b c a b c) :start2 1 :end2 nil) 3))
	  (test-t (eql (search '(a b c) '(a b c a b c) :start1 1 :start2 1 :end2 nil) 1))
	  (test-t (eql (search '(a b c) '(a b c a b c) :start1 1 :end1 nil :start2 1 :end2 nil) 1))
	  (test-t (null (search '(a b c) '(a b c a b c) :start2 0 :end2 0)))
	  (test-t (null (search '(a b c) '(a b c a b c) :start2 1 :end2 1)))
	  (test-t (null (search '(a b c) '(a b c a b c) :start2 2 :end2 2)))
	  (test-t (null (search '(a b c) '(a b c a b c) :start2 3 :end2 3)))
	  (test-t (null (search '(a b c) '(a b c a b c) :start2 4 :end2 4)))
	  (test-t (null (search '(a b c) '(a b c a b c) :start2 5 :end2 5)))
	  (test-t (null (search '(a b c) '(a b c a b c) :start2 6 :end2 6)))
	  (test-t (eql (search '(a b c) '(a b c a b c)) 0))
	  (test-t (eql (search '(a b c) '(a b c a b c) :from-end t) 3))
	  (test-t (eql (search '(a b c) '(a b c a b c) :start2 3 :end2 6) 3))
	  (test-t (eql (search '(a b c) '(a b c a b c) :start2 3 :end2 6 :from-end t) 3))
	  (test-t (eql (search '(a b c) '(a b c a b c) :start1 0 :end1 2 :start2 0 :end2 6) 0))
	  (test-t (eql (search '(a b c) '(a b c a b c) :start1 0 :end1 2 :start2 0 :end2 6 :from-end t) 3))
	  (test-t (null (search '(#\a #\b #\c) '(#\A #\B #\C))))
	  (test-t (eql (search '(#\a #\b #\c) '(#\A #\B #\C) :test char-equal) 0))
	  (test-t (eql (search '(#\a #\b) '(#\a #\b #\x #\y #\z)) 0))
	  (test-t (eql (search '(#\a #\b) '(#\a #\b #\x #\y #\z) :test char<) 1))
	  (test-t (null (search '((a) (b)) '((x) (y) (z) (a) (b) (c)))))
	  (test-t (eql (search '((a) (b)) '((x) (y) (z) (a) (b) (c)) :key car) 3))
	  (test-t (eql (search '((a) (b)) '((a) (b) (c) (x) (y) (z) (a) (b) (c)) :key car) 0))
	  (test-t (eql (search '((a) (b)) '((a) (b) (c) (x) (y) (z) (a) (b) (c)) :key car :from-end t) 6))
	  (test-t (eql (search '((a a) (b b)) '((a) (b) (c) (x) (y) (z) (a) (b) (c)) :key car) 0))
	  (test-t (eql (search '((a a) (b b)) '((a nil) (b t) (c nil) (x) (y) (z) (a 0) (b 1) (c 2)) :key car :from-end t) 6))
	  (test-t (eql (search '(("a" a) ("b" b))
			       '(("a" nil) ("b" t) ("c" nil) ("x") ("y") ("z")
				 ("A" 0) ("B" 1) ("C" 2))
			       :start1 1
			       :end1 2
			       :start2 3
			       :end2 nil
			       :key car
			       :test string-equal
			       :from-end t)
		       7))
	  (test-t (null (search #(a b c) '(x y z))))
	  (test-t (eql (search #() '(x y z)) 0))
	  (test-t (eql (search #(a) '(a)) 0))
	  (test-t (eql (search #(a b c) '(a b c x y z)) 0))
	  (test-t (eql (search #(a b c) '(x a b c y z)) 1))
	  (test-t (eql (search #(a b c) '(x y a b c z)) 2))
	  (test-t (eql (search #(a b c) '(x y z a b c)) 3))
	  (test-t (eql (search #(a b c) '(a b c a b c) :start2 1) 3))
	  (test-t (eql (search #(a b c) '(a b c a b c) :start2 1 :end2 nil) 3))
	  (test-t (eql (search #(a b c) '(a b c a b c) :start1 1 :start2 1 :end2 nil) 1))
	  (test-t (eql (search #(a b c) '(a b c a b c) :start1 1 :end1 nil :start2 1 :end2 nil) 1))
	  (test-t (null (search #(a b c) '(a b c a b c) :start2 0 :end2 0)))
	  (test-t (null (search #(a b c) '(a b c a b c) :start2 1 :end2 1)))
	  (test-t (null (search #(a b c) '(a b c a b c) :start2 2 :end2 2)))
	  (test-t (null (search #(a b c) '(a b c a b c) :start2 3 :end2 3)))
	  (test-t (null (search #(a b c) '(a b c a b c) :start2 4 :end2 4)))
	  (test-t (null (search #(a b c) '(a b c a b c) :start2 5 :end2 5)))
	  (test-t (null (search #(a b c) '(a b c a b c) :start2 6 :end2 6)))
	  (test-t (eql (search #(a b c) '(a b c a b c)) 0))
	  (test-t (eql (search #(a b c) '(a b c a b c) :from-end t) 3))
	  (test-t (eql (search #(a b c) '(a b c a b c) :start2 3 :end2 6) 3))
	  (test-t (eql (search #(a b c) '(a b c a b c) :start2 3 :end2 6 :from-end t) 3))
	  (test-t (eql (search #(a b c) '(a b c a b c) :start1 0 :end1 2 :start2 0 :end2 6) 0))
	  (test-t (eql (search #(a b c) '(a b c a b c) :start1 0 :end1 2 :start2 0 :end2 6 :from-end t) 3))
	  (test-t (null (search #(#\a #\b #\c) '(#\A #\B #\C))))
	  (test-t (eql (search #(#\a #\b #\c) '(#\A #\B #\C) :test char-equal) 0))
	  (test-t (eql (search #(#\a #\b) '(#\a #\b #\x #\y #\z)) 0))
	  (test-t (eql (search #(#\a #\b) '(#\a #\b #\x #\y #\z) :test char<) 1))
	  (test-t (null (search #((a) (b)) '((x) (y) (z) (a) (b) (c)))))
	  (test-t (eql (search #((a) (b)) '((x) (y) (z) (a) (b) (c)) :key car) 3))
	  (test-t (eql (search #((a) (b)) '((a) (b) (c) (x) (y) (z) (a) (b) (c)) :key car) 0))
	  (test-t (eql (search #((a) (b)) '((a) (b) (c) (x) (y) (z) (a) (b) (c)) :key car :from-end t) 6))
	  (test-t (eql (search #((a a) (b b)) '((a) (b) (c) (x) (y) (z) (a) (b) (c)) :key car) 0))
	  (test-t (eql (search #((a a) (b b)) '((a nil) (b t) (c nil) (x) (y) (z) (a 0) (b 1) (c 2)) :key car :from-end t) 6))
	  (test-t (eql (search #(("a" a) ("b" b))
			       '(("a" nil) ("b" t) ("c" nil) ("x") ("y") ("z")
				 ("A" 0) ("B" 1) ("C" 2))
			       :start1 1
			       :end1 2
			       :start2 3
			       :end2 nil
			       :key car
			       :test string-equal
			       :from-end t)
		       7))
	  (test-t (null (search '(a b c) #(x y z))))
	  (test-t (eql (search () #(x y z)) 0))
	  (test-t (eql (search '(a) #(a)) 0))
	  (test-t (eql (search '(a b c) #(a b c x y z)) 0))
	  (test-t (eql (search '(a b c) #(x a b c y z)) 1))
	  (test-t (eql (search '(a b c) #(x y a b c z)) 2))
	  (test-t (eql (search '(a b c) #(x y z a b c)) 3))
	  (test-t (eql (search '(a b c) #(a b c a b c) :start2 1) 3))
	  (test-t (eql (search '(a b c) #(a b c a b c) :start2 1 :end2 nil) 3))
	  (test-t (eql (search '(a b c) #(a b c a b c) :start1 1 :start2 1 :end2 nil) 1))
	  (test-t (eql (search '(a b c) #(a b c a b c) :start1 1 :end1 nil :start2 1 :end2 nil) 1))
	  (test-t (null (search '(a b c) #(a b c a b c) :start2 0 :end2 0)))
	  (test-t (null (search '(a b c) #(a b c a b c) :start2 1 :end2 1)))
	  (test-t (null (search '(a b c) #(a b c a b c) :start2 2 :end2 2)))
	  (test-t (null (search '(a b c) #(a b c a b c) :start2 3 :end2 3)))
	  (test-t (null (search '(a b c) #(a b c a b c) :start2 4 :end2 4)))
	  (test-t (null (search '(a b c) #(a b c a b c) :start2 5 :end2 5)))
	  (test-t (null (search '(a b c) #(a b c a b c) :start2 6 :end2 6)))
	  (test-t (eql (search '(a b c) #(a b c a b c)) 0))
	  (test-t (eql (search '(a b c) #(a b c a b c) :from-end t) 3))
	  (test-t (eql (search '(a b c) #(a b c a b c) :start2 3 :end2 6) 3))
	  (test-t (eql (search '(a b c) #(a b c a b c) :start2 3 :end2 6 :from-end t) 3))
	  (test-t (eql (search '(a b c) #(a b c a b c) :start1 0 :end1 2 :start2 0 :end2 6) 0))
	  (test-t (eql (search '(a b c) #(a b c a b c) :start1 0 :end1 2 :start2 0 :end2 6 :from-end t) 3))
	  (test-t (null (search '(#\a #\b #\c) #(#\A #\B #\C))))
	  (test-t (eql (search '(#\a #\b #\c) #(#\A #\B #\C) :test char-equal) 0))
	  (test-t (eql (search '(#\a #\b) #(#\a #\b #\x #\y #\z)) 0))
	  (test-t (eql (search '(#\a #\b) #(#\a #\b #\x #\y #\z) :test char<) 1))
	  (test-t (null (search '((a) (b)) #((x) (y) (z) (a) (b) (c)))))
	  (test-t (eql (search '((a) (b)) #((x) (y) (z) (a) (b) (c)) :key car) 3))
	  (test-t (eql (search '((a) (b)) #((a) (b) (c) (x) (y) (z) (a) (b) (c)) :key car) 0))
	  (test-t (eql (search '((a) (b)) #((a) (b) (c) (x) (y) (z) (a) (b) (c)) :key car :from-end t) 6))
	  (test-t (eql (search '((a a) (b b)) #((a) (b) (c) (x) (y) (z) (a) (b) (c)) :key car) 0))
	  (test-t (eql (search '((a a) (b b)) #((a nil) (b t) (c nil) (x) (y) (z) (a 0) (b 1) (c 2)) :key car :from-end t) 6))
	  (test-t (eql (search '(("a" a) ("b" b))
			       #(("a" nil) ("b" t) ("c" nil) ("x") ("y") ("z")
				 ("A" 0) ("B" 1) ("C" 2))
			       :start1 1
			       :end1 2
			       :start2 3
			       :end2 nil
			       :key car
			       :test string-equal
			       :from-end t)
		       7))
	  (test-t (null (search #(a b c) #(x y z))))
	  (test-t (eql (search #() #(x y z)) 0))
	  (test-t (eql (search #(a) #(a)) 0))
	  (test-t (eql (search #(a b c) #(a b c x y z)) 0))
	  (test-t (eql (search #(a b c) #(x a b c y z)) 1))
	  (test-t (eql (search #(a b c) #(x y a b c z)) 2))
	  (test-t (eql (search #(a b c) #(x y z a b c)) 3))
	  (test-t (eql (search #(a b c) #(a b c a b c) :start2 1) 3))
	  (test-t (eql (search #(a b c) #(a b c a b c) :start2 1 :end2 nil) 3))
	  (test-t (eql (search #(a b c) #(a b c a b c) :start1 1 :start2 1 :end2 nil) 1))
	  (test-t (eql (search #(a b c) #(a b c a b c) :start1 1 :end1 nil :start2 1 :end2 nil) 1))
	  (test-t (null (search #(a b c) #(a b c a b c) :start2 0 :end2 0)))
	  (test-t (null (search #(a b c) #(a b c a b c) :start2 1 :end2 1)))
	  (test-t (null (search #(a b c) #(a b c a b c) :start2 2 :end2 2)))
	  (test-t (null (search #(a b c) #(a b c a b c) :start2 3 :end2 3)))
	  (test-t (null (search #(a b c) #(a b c a b c) :start2 4 :end2 4)))
	  (test-t (null (search #(a b c) #(a b c a b c) :start2 5 :end2 5)))
	  (test-t (null (search #(a b c) #(a b c a b c) :start2 6 :end2 6)))
	  (test-t (eql (search #(a b c) #(a b c a b c)) 0))
	  (test-t (eql (search #(a b c) #(a b c a b c) :from-end t) 3))
	  (test-t (eql (search #(a b c) #(a b c a b c) :start2 3 :end2 6) 3))
	  (test-t (eql (search #(a b c) #(a b c a b c) :start2 3 :end2 6 :from-end t) 3))
	  (test-t (eql (search #(a b c) #(a b c a b c) :start1 0 :end1 2 :start2 0 :end2 6) 0))
	  (test-t (eql (search #(a b c) #(a b c a b c) :start1 0 :end1 2 :start2 0 :end2 6 :from-end t) 3))
	  (test-t (null (search #(#\a #\b #\c) #(#\A #\B #\C))))
	  (test-t (eql (search #(#\a #\b #\c) #(#\A #\B #\C) :test char-equal) 0))
	  (test-t (eql (search #(#\a #\b) #(#\a #\b #\x #\y #\z)) 0))
	  (test-t (eql (search #(#\a #\b) #(#\a #\b #\x #\y #\z) :test char<) 1))
	  (test-t (null (search #((a) (b)) #((x) (y) (z) (a) (b) (c)))))
	  (test-t (eql (search #((a) (b)) #((x) (y) (z) (a) (b) (c)) :key car) 3))
	  (test-t (eql (search #((a) (b)) #((a) (b) (c) (x) (y) (z) (a) (b) (c)) :key car) 0))
	  (test-t (eql (search #((a) (b)) #((a) (b) (c) (x) (y) (z) (a) (b) (c)) :key car :from-end t) 6))
	  (test-t (eql (search #((a a) (b b)) #((a) (b) (c) (x) (y) (z) (a) (b) (c)) :key car) 0))
	  (test-t (eql (search #((a a) (b b)) #((a nil) (b t) (c nil) (x) (y) (z) (a 0) (b 1) (c 2)) :key car :from-end t) 6))
	  (test-t (eql (search #(("a" a) ("b" b))
			       #(("a" nil) ("b" t) ("c" nil) ("x") ("y") ("z")
				 ("A" 0) ("B" 1) ("C" 2))
			       :start1 1
			       :end1 2
			       :start2 3
			       :end2 nil
			       :key car
			       :test string-equal
			       :from-end t)
		       7))
	  (test-t (null (search "peace" "LOVE&PEACE")))
	  (test-t (eql (search "peace" "LOVE&PEACE" :test char-equal) 5))
	  (test-t (null (search "PeAcE" "LoVe&pEaCe")))
	  (test-t (eql (search "PeAcE" "LoVe&pEaCe" :key char-upcase) 5))
	  (test-t (eql (search "abc" "abc xyz abc" :from-end t) 8))
	  (test-t (eql (search "abc" "abc xyz abc xyz abc xyz abc" :start2 8 :end2 19) 8))
	  (test-t (eql (search "abc" "abc xyz abc xyz abc xyz abc" :from-end t :start2 8 :end2 19) 16))
	  (test-t (eql (mismatch "abcd" "ABCDE" :test char-equal) 4))
	  (test-t (eql (mismatch '(3 2 1 1 2 3) '(1 2 3) :from-end t) 3))
	  (test-t (null (mismatch '(1 2 3 4 5 6) '(3 4 5 6 7) :start1 2 :end2 4)))
	  (test-t (null (mismatch () ())))
	  (test-t (eql (mismatch '(a b c) '(x y z)) 0))
	  (test-t (eql (mismatch () '(x y z)) 0))
	  (test-t (eql (mismatch '(x y z) ()) 0))
	  (test-t (null (mismatch '(a) '(a))))
	  (test-t (eql (mismatch '(a b c x y z) '(a b c)) 3))
	  (test-t (null (mismatch '(a b c) '(a b c))))
	  (test-t (eql (mismatch '(a b c d e f) '(a b c)) 3))
	  (test-t (eql (mismatch '(a b c) '(a b c d e f)) 3))
	  (test-t (eql (mismatch '(a b c) '(a b x)) 2))
	  (test-t (eql (mismatch '(a b c) '(a x c)) 1))
	  (test-t (eql (mismatch '(a b c) '(x b c)) 0))
	  (test-t (eql (mismatch '(x y z a b c x y z) '(a b c) :start1 3) 6))
	  (test-t (eql (mismatch '(x y z a b c x y z) '(a b c) :start1 3 :end1 nil) 6))
	  (test-t (eql (mismatch '(x y z a b c x y z) '(a b c) :start1 3 :end1 4) 4))
	  (test-t (eql (mismatch '(x y z a b c x y z) '(a b c) :start1 3 :end1 3) 3))
	  (test-t (null (mismatch '(x y z) () :start1 0 :end1 0)))
	  (test-t (null (mismatch '(x y z) () :start1 1 :end1 1)))
	  (test-t (null (mismatch '(x y z) () :start1 2 :end1 2)))
	  (test-t (null (mismatch '(x y z) () :start1 3 :end1 3)))
	  (test-t (null (mismatch '(x y z) () :start1 0 :end1 0 :start2 0 :end2 0)))
	  (test-t (null (mismatch '(x y z) () :start1 1 :end1 1 :start2 1 :end2 1)))
	  (test-t (null (mismatch '(x y z) () :start1 2 :end1 2 :start2 2 :end2 2)))
	  (test-t (null (mismatch '(x y z) () :start1 3 :end1 3 :start2 3 :end2 3)))
	  (test-t (null (mismatch '(x y z) () :start1 0 :end1 0 :start2 3 :end2 3)))
	  (test-t (null (mismatch '(x y z) () :start1 1 :end1 1 :start2 2 :end2 2)))
	  (test-t (null (mismatch '(x y z) () :start1 2 :end1 2 :start2 1 :end2 1)))
	  (test-t (null (mismatch '(x y z) () :start1 3 :end1 3 :start2 0 :end2 0)))
	  (test-t (eql (mismatch '(x y z) '(a b c) :start1 0 :end1 0) 0))
	  (test-t (eql (mismatch '(x y z) '(a b c) :start1 1 :end1 1) 1))
	  (test-t (eql (mismatch '(x y z) '(a b c) :start1 2 :end1 2) 2))
	  (test-t (eql (mismatch '(x y z) '(a b c) :start1 3 :end1 3) 3))
	  (test-t (eql (mismatch '(x y z) '(x y z) :start1 0 :end1 1) 1))
	  (test-t (eql (mismatch '(x y z) '(x y z) :start1 0 :end1 2) 2))
	  (test-t (eql (mismatch '(x y z) '(x y z Z) :start1 0 :end1 3) 3))
	  (test-t (null (mismatch '(x y z) '(x y z) :start1 0 :end1 3)))
	  (test-t (eql (mismatch '(a b c x y z) '(x y z a b c)) 0))
	  (test-t (eql (mismatch '(a b c x y z) '(x y z a b c) :start1 3) 6))
	  (test-t (eql (mismatch '(a b c x y z a b c) '(x y z a b c x y z) :start1 3) 9))
	  (test-t (eql (mismatch '(a b c x y z a b c) '(x y z a b c x y z) :start1 6) 6))
	  (test-t (eql (mismatch '(a b c x y z a b c) '(x y z a b c x y z) :start1 6 :start2 3) 9))
	  (test-t (eql (mismatch '(a b c x y z a b c) '(x y z a b c x y z) :start1 0 :start2 3) 6))
	  (test-t (eql (mismatch '(a b c) '(a b c x y z)) 3))
	  (test-t (eql (mismatch '(a b c) '(x a b c y z)) 0))
	  (test-t (eql (mismatch '(a b c) '(x a b c y z) :start2 1) 3))
	  (test-t (eql (mismatch '(a b c) '(x a b c y z) :start2 1 :end2 nil) 3))
	  (test-t (null (mismatch '(a b c) '(x a b c y z) :start2 1 :end2 4)))
	  (test-t (eql (mismatch '(a b c d e) '(c d)) 0))
	  (test-t (eql (mismatch '(a b c d e) '(c d) :start1 2) 4))
	  (test-t (eql (mismatch '(a b c d e) '(c d) :start1 2 :end1 3) 3))
	  (test-t (eql (mismatch '(a b c d e) '(c d) :start1 2 :start2 1) 2))
	  (test-t (eql (mismatch '(a b c d e) '(c d) :start1 3 :start2 1) 4))
	  (test-t (eql (mismatch '(a b c d e) '(c d) :start1 2 :end2 1) 3))
	  (test-t (null (mismatch '(a b c d) '(a b c d) :start1 1 :end1 2 :start2 1 :end2 2)))
	  (test-t (null (mismatch '(a b c d) '(a b c d) :start1 1 :end1 3 :start2 1 :end2 3)))
	  (test-t (null (mismatch '(a b c d) '(a b c d) :start1 1 :end1 4 :start2 1 :end2 4)))
	  (test-t (eql (mismatch '(a b c d) '(a b c d) :start1 1 :end1 nil :start2 1 :end2 1) 1))
	  (test-t (eql (mismatch '(a b c d) '(a b c d) :start1 1 :end1 nil :start2 1 :end2 2) 2))
	  (test-t (eql (mismatch '(a b c d) '(a b c d) :start1 1 :end1 nil :start2 1 :end2 3) 3))
	  (test-t (null (mismatch '(a b c d) '(a b c d) :start1 1 :end1 nil :start2 1 :end2 4)))
	  (test-t (eql (mismatch '(a b c d) '(a b c d) :start1 1 :end1 1 :start2 1) 1))
	  (test-t (eql (mismatch '(a b c d) '(a b c d) :start1 1 :end1 2 :start2 1) 2))
	  (test-t (eql (mismatch '(a b c d) '(a b c d) :start1 1 :end1 3 :start2 1) 3))
	  (test-t (null (mismatch '(a b c d) '(a b c d) :start1 1 :end1 4 :start2 1)))
	  (test-t (null (mismatch '(a b c) '(a b c) :from-end t)))
	  (test-t (eql (mismatch '(a b c d) '(a b c) :from-end t) 4))
	  (test-t (eql (mismatch '(a b c) '(c) :from-end t) 2))
	  (test-t (eql (mismatch '(a b c) '(z a b c) :from-end t) 0))
	  (test-t (eql (mismatch '(a b c) '(x y z a b c) :from-end t) 0))
	  (test-t (eql (mismatch '(x y z a b c) '(a b c) :from-end t) 3))
	  (test-t (eql (mismatch '(x y z a b c) '(a b c) :end1 3 :from-end t) 3))
	  (test-t (eql (mismatch '(x y z a b c) '(a b c) :end1 5 :from-end t) 5))
	  (test-t (eql (mismatch '(x y z a b c x y z) '(a b c) :end1 6 :from-end t) 3))
	  (test-t (eql (mismatch '(x y z a b c x y z) '(a b c) :start1 2 :end1 6 :from-end t) 3))
	  (test-t (eql (mismatch '(x y z a b c x y z) '(a b c) :from-end t :start1 2 :end1 5 :start2 1 :end2 2 ) 4))
	  (test-t (eql (mismatch '(x y z a b c x y z) '(a b c) :start1 2 :end1 5 :start2 1 :end2 2 ) 2))
	  (test-t (eql (mismatch '((a) (b) (c)) '((a) (b) (c))) 0))
	  (test-t (null (mismatch '((a) (b) (c)) '((a) (b) (c)) :key car)))
	  (test-t (null (mismatch '((a) (b) (c)) '((a) (b) (c)) :test equal)))
	  (test-t (eql (mismatch '(#(a) #(b) #(c)) '(#(a) #(b) #(c))) 0))
	  (test-t (null (mismatch '(#(a) #(b) #(c)) '(#(a) #(b) #(c)) :test equalp)))
	  (test-t (eql (mismatch '((a) (b) (c) (d)) '((a) (b) (c)) :key car) 3))
	  (test-t (eql (mismatch '((a) (b) (c)) '((a) (b) (c) (d)) :key car) 3))
	  (test-t (eql (mismatch '(#\a #\b #\c) '(#\A #\B #\C)) 0))
	  (test-t (null (mismatch '(#\a #\b #\c) '(#\A #\B #\C) :key char-upcase)))
	  (test-t (null (mismatch '(#\a #\b #\c) '(#\A #\B #\C) :key char-downcase)))
	  (test-t (null (mismatch '(#\a #\b #\c) '(#\A #\B #\C) :key char-upcase :start1 1 :end1 2 :start2 1 :end2 2)))
	  (test-t (null (mismatch '(#\a #\b #\c) '(#\A #\B #\C) :key char-upcase :start1 2 :start2 2)))
	  (test-t (eql (mismatch '((a b c) (b c d) (d e f)) '((b b c) (c c d) (e e f))) 0))
	  (test-t (eql (mismatch '((a b c) (b c d) (d e f)) '((b b c) (c c d) (e e f)) :key cdr) 0))
	  (test-t (null (mismatch '((a b c) (b c d) (d e f)) '((b b c) (c c d) (e e f)) :key cdr :test equal)))
	  (test-t (eql (mismatch '((a b c) (b c d) (d e f) (e f g)) '((b b c) (c c d) (e e f)) :key cdr :test equal) 3))
	  (test-t (eql (mismatch '((a b c) (b c d) (d e f) (e f g)) '((b b c) (c c d) (e e f)) :key cdr :test equal :from-end t) 4))
	  (test-t (eql (mismatch '((a a a) (a b c) (b c d) (d e f)) '((b b c) (c c d) (e e f)) :key cdr :test equal :from-end t) 1))
	  (test-t (null (mismatch '((a a a) (a b c) (b c d) (d e f) (e f g)) '((b b c) (c c d) (e e f)) :key cdr :test equal :from-end t :start1 1 :end1 4)))
	  (test-t (eql (mismatch '((a a a) (a b c) (b c d) (d e f) (e f g)) '((b b c) (c c d) (e e f)) :key cdr :test equal :from-end t :start1 1) 5))
	  (test-t (eql (mismatch '((a a a) (a b c) (b c d) (d e f) (e f g)) '((b b c) (c c d) (e e f)) :key cdr :test equal :from-end t :end1 3 :start2 1 :end2 2) 2))
	  (test-t (null (mismatch #() ())))
	  (test-t (eql (mismatch #(a b c) '(x y z)) 0))
	  (test-t (eql (mismatch #() '(x y z)) 0))
	  (test-t (eql (mismatch #(x y z) ()) 0))
	  (test-t (null (mismatch #(a) '(a))))
	  (test-t (eql (mismatch #(a b c x y z) '(a b c)) 3))
	  (test-t (null (mismatch #(a b c) '(a b c))))
	  (test-t (eql (mismatch #(a b c d e f) '(a b c)) 3))
	  (test-t (eql (mismatch #(a b c) '(a b c d e f)) 3))
	  (test-t (eql (mismatch #(a b c) '(a b x)) 2))
	  (test-t (eql (mismatch #(a b c) '(a x c)) 1))
	  (test-t (eql (mismatch #(a b c) '(x b c)) 0))
	  (test-t (eql (mismatch #(x y z a b c x y z) '(a b c) :start1 3) 6))
	  (test-t (eql (mismatch #(x y z a b c x y z) '(a b c) :start1 3 :end1 nil) 6))
	  (test-t (eql (mismatch #(x y z a b c x y z) '(a b c) :start1 3 :end1 4) 4))
	  (test-t (eql (mismatch #(x y z a b c x y z) '(a b c) :start1 3 :end1 3) 3))
	  (test-t (null (mismatch #(x y z) () :start1 0 :end1 0)))
	  (test-t (null (mismatch #(x y z) () :start1 1 :end1 1)))
	  (test-t (null (mismatch #(x y z) () :start1 2 :end1 2)))
	  (test-t (null (mismatch #(x y z) () :start1 3 :end1 3)))
	  (test-t (eql (mismatch #(x y z) '(a b c) :start1 0 :end1 0) 0))
	  (test-t (eql (mismatch #(x y z) '(a b c) :start1 1 :end1 1) 1))
	  (test-t (eql (mismatch #(x y z) '(a b c) :start1 2 :end1 2) 2))
	  (test-t (eql (mismatch #(x y z) '(a b c) :start1 3 :end1 3) 3))
	  (test-t (eql (mismatch #(x y z) '(x y z) :start1 0 :end1 1) 1))
	  (test-t (eql (mismatch #(x y z) '(x y z) :start1 0 :end1 2) 2))
	  (test-t (eql (mismatch #(x y z) '(x y z Z) :start1 0 :end1 3) 3))
	  (test-t (null (mismatch #(x y z) '(x y z) :start1 0 :end1 3)))
	  (test-t (eql (mismatch #(a b c x y z) '(x y z a b c)) 0))
	  (test-t (eql (mismatch #(a b c x y z) '(x y z a b c) :start1 3) 6))
	  (test-t (eql (mismatch #(a b c x y z a b c) '(x y z a b c x y z) :start1 3) 9))
	  (test-t (eql (mismatch #(a b c x y z a b c) '(x y z a b c x y z) :start1 6) 6))
	  (test-t (eql (mismatch #(a b c x y z a b c) '(x y z a b c x y z) :start1 6 :start2 3) 9))
	  (test-t (eql (mismatch #(a b c x y z a b c) '(x y z a b c x y z) :start1 0 :start2 3) 6))
	  (test-t (eql (mismatch #(a b c) '(a b c x y z)) 3))
	  (test-t (eql (mismatch #(a b c) '(x a b c y z)) 0))
	  (test-t (eql (mismatch #(a b c) '(x a b c y z) :start2 1) 3))
	  (test-t (eql (mismatch #(a b c) '(x a b c y z) :start2 1 :end2 nil) 3))
	  (test-t (null (mismatch #(a b c) '(x a b c y z) :start2 1 :end2 4)))
	  (test-t (eql (mismatch #(a b c d e) '(c d)) 0))
	  (test-t (eql (mismatch #(a b c d e) '(c d) :start1 2) 4))
	  (test-t (eql (mismatch #(a b c d e) '(c d) :start1 2 :end1 3) 3))
	  (test-t (eql (mismatch #(a b c d e) '(c d) :start1 2 :start2 1) 2))
	  (test-t (eql (mismatch #(a b c d e) '(c d) :start1 3 :start2 1) 4))
	  (test-t (eql (mismatch #(a b c d e) '(c d) :start1 2 :end2 1) 3))
	  (test-t (null (mismatch #(a b c d) '(a b c d) :start1 1 :end1 2 :start2 1 :end2 2)))
	  (test-t (null (mismatch #(a b c d) '(a b c d) :start1 1 :end1 3 :start2 1 :end2 3)))
	  (test-t (null (mismatch #(a b c d) '(a b c d) :start1 1 :end1 4 :start2 1 :end2 4)))
	  (test-t (eql (mismatch #(a b c d) '(a b c d) :start1 1 :end1 nil :start2 1 :end2 1) 1))
	  (test-t (eql (mismatch #(a b c d) '(a b c d) :start1 1 :end1 nil :start2 1 :end2 2) 2))
	  (test-t (eql (mismatch #(a b c d) '(a b c d) :start1 1 :end1 nil :start2 1 :end2 3) 3))
	  (test-t (null (mismatch #(a b c d) '(a b c d) :start1 1 :end1 nil :start2 1 :end2 4)))
	  (test-t (eql (mismatch #(a b c d) '(a b c d) :start1 1 :end1 1 :start2 1) 1))
	  (test-t (eql (mismatch #(a b c d) '(a b c d) :start1 1 :end1 2 :start2 1) 2))
	  (test-t (eql (mismatch #(a b c d) '(a b c d) :start1 1 :end1 3 :start2 1) 3))
	  (test-t (null (mismatch #(a b c d) '(a b c d) :start1 1 :end1 4 :start2 1)))
	  (test-t (null (mismatch #(a b c) '(a b c) :from-end t)))
	  (test-t (eql (mismatch #(a b c d) '(a b c) :from-end t) 4))
	  (test-t (eql (mismatch #(a b c) '(c) :from-end t) 2))
	  (test-t (eql (mismatch #(a b c) '(z a b c) :from-end t) 0))
	  (test-t (eql (mismatch #(a b c) '(x y z a b c) :from-end t) 0))
	  (test-t (eql (mismatch #(x y z a b c) '(a b c) :from-end t) 3))
	  (test-t (eql (mismatch #(x y z a b c) '(a b c) :end1 3 :from-end t) 3))
	  (test-t (eql (mismatch #(x y z a b c) '(a b c) :end1 5 :from-end t) 5))
	  (test-t (eql (mismatch #(x y z a b c x y z) '(a b c) :end1 6 :from-end t) 3))
	  (test-t (eql (mismatch #(x y z a b c x y z) '(a b c) :start1 2 :end1 6 :from-end t) 3))
	  (test-t (eql (mismatch #(x y z a b c x y z) '(a b c) :from-end t :start1 2 :end1 5 :start2 1 :end2 2 ) 4))
	  (test-t (eql (mismatch #(x y z a b c x y z) '(a b c) :start1 2 :end1 5 :start2 1 :end2 2 ) 2))
	  (test-t (eql (mismatch #((a) (b) (c)) '((a) (b) (c))) 0))
	  (test-t (null (mismatch #((a) (b) (c)) '((a) (b) (c)) :key car)))
	  (test-t (null (mismatch #((a) (b) (c)) '((a) (b) (c)) :test equal)))
	  (test-t (eql (mismatch #(#(a) #(b) #(c)) '(#(a) #(b) #(c))) 0))
	  (test-t (null (mismatch #(#(a) #(b) #(c)) '(#(a) #(b) #(c)) :test equalp)))
	  (test-t (eql (mismatch #((a) (b) (c) (d)) '((a) (b) (c)) :key car) 3))
	  (test-t (eql (mismatch #((a) (b) (c)) '((a) (b) (c) (d)) :key car) 3))
	  (test-t (eql (mismatch #(#\a #\b #\c) '(#\A #\B #\C)) 0))
	  (test-t (null (mismatch #(#\a #\b #\c) '(#\A #\B #\C) :key char-upcase)))
	  (test-t (null (mismatch #(#\a #\b #\c) '(#\A #\B #\C) :key char-downcase)))
	  (test-t (null (mismatch #(#\a #\b #\c) '(#\A #\B #\C) :key char-upcase :start1 1 :end1 2 :start2 1 :end2 2)))
	  (test-t (null (mismatch #(#\a #\b #\c) '(#\A #\B #\C) :key char-upcase :start1 2 :start2 2)))
	  (test-t (eql (mismatch #((a b c) (b c d) (d e f)) '((b b c) (c c d) (e e f))) 0))
	  (test-t (eql (mismatch #((a b c) (b c d) (d e f)) '((b b c) (c c d) (e e f)) :key cdr) 0))
	  (test-t (null (mismatch #((a b c) (b c d) (d e f)) '((b b c) (c c d) (e e f)) :key cdr :test equal)))
	  (test-t (eql (mismatch #((a b c) (b c d) (d e f) (e f g)) '((b b c) (c c d) (e e f)) :key cdr :test equal) 3))
	  (test-t (eql (mismatch #((a b c) (b c d) (d e f) (e f g)) '((b b c) (c c d) (e e f)) :key cdr :test equal :from-end t) 4))
	  (test-t (eql (mismatch #((a a a) (a b c) (b c d) (d e f)) '((b b c) (c c d) (e e f)) :key cdr :test equal :from-end t) 1))
	  (test-t (null (mismatch #((a a a) (a b c) (b c d) (d e f) (e f g)) '((b b c) (c c d) (e e f)) :key cdr :test equal :from-end t :start1 1 :end1 4)))
	  (test-t (eql (mismatch #((a a a) (a b c) (b c d) (d e f) (e f g)) '((b b c) (c c d) (e e f)) :key cdr :test equal :from-end t :start1 1) 5))
	  (test-t (eql (mismatch #((a a a) (a b c) (b c d) (d e f) (e f g)) '((b b c) (c c d) (e e f)) :key cdr :test equal :from-end t :end1 3 :start2 1 :end2 2) 2))
	  (test-t (null (mismatch () #())))
	  (test-t (eql (mismatch '(a b c) #(x y z)) 0))
	  (test-t (eql (mismatch () #(x y z)) 0))
	  (test-t (eql (mismatch '(x y z) #()) 0))
	  (test-t (null (mismatch '(a) #(a))))
	  (test-t (eql (mismatch '(a b c x y z) #(a b c)) 3))
	  (test-t (null (mismatch '(a b c) #(a b c))))
	  (test-t (eql (mismatch '(a b c d e f) #(a b c)) 3))
	  (test-t (eql (mismatch '(a b c) #(a b c d e f)) 3))
	  (test-t (eql (mismatch '(a b c) #(a b x)) 2))
	  (test-t (eql (mismatch '(a b c) #(a x c)) 1))
	  (test-t (eql (mismatch '(a b c) #(x b c)) 0))
	  (test-t (eql (mismatch '(x y z a b c x y z) #(a b c) :start1 3) 6))
	  (test-t (eql (mismatch '(x y z a b c x y z) #(a b c) :start1 3 :end1 nil) 6))
	  (test-t (eql (mismatch '(x y z a b c x y z) #(a b c) :start1 3 :end1 4) 4))
	  (test-t (eql (mismatch '(x y z a b c x y z) #(a b c) :start1 3 :end1 3) 3))
	  (test-t (null (mismatch '(x y z) #() :start1 0 :end1 0)))
	  (test-t (null (mismatch '(x y z) #() :start1 1 :end1 1)))
	  (test-t (null (mismatch '(x y z) #() :start1 2 :end1 2)))
	  (test-t (null (mismatch '(x y z) #() :start1 3 :end1 3)))
	  (test-t (eql (mismatch '(x y z) #(a b c) :start1 0 :end1 0) 0))
	  (test-t (eql (mismatch '(x y z) #(a b c) :start1 1 :end1 1) 1))
	  (test-t (eql (mismatch '(x y z) #(a b c) :start1 2 :end1 2) 2))
	  (test-t (eql (mismatch '(x y z) #(a b c) :start1 3 :end1 3) 3))
	  (test-t (eql (mismatch '(x y z) #(x y z) :start1 0 :end1 1) 1))
	  (test-t (eql (mismatch '(x y z) #(x y z) :start1 0 :end1 2) 2))
	  (test-t (eql (mismatch '(x y z) #(x y z Z) :start1 0 :end1 3) 3))
	  (test-t (null (mismatch '(x y z) #(x y z) :start1 0 :end1 3)))
	  (test-t (eql (mismatch '(a b c x y z) #(x y z a b c)) 0))
	  (test-t (eql (mismatch '(a b c x y z) #(x y z a b c) :start1 3) 6))
	  (test-t (eql (mismatch '(a b c x y z a b c) #(x y z a b c x y z) :start1 3) 9))
	  (test-t (eql (mismatch '(a b c x y z a b c) #(x y z a b c x y z) :start1 6) 6))
	  (test-t (eql (mismatch '(a b c x y z a b c) #(x y z a b c x y z) :start1 6 :start2 3) 9))
	  (test-t (eql (mismatch '(a b c x y z a b c) #(x y z a b c x y z) :start1 0 :start2 3) 6))
	  (test-t (eql (mismatch '(a b c) #(a b c x y z)) 3))
	  (test-t (eql (mismatch '(a b c) #(x a b c y z)) 0))
	  (test-t (eql (mismatch '(a b c) #(x a b c y z) :start2 1) 3))
	  (test-t (eql (mismatch '(a b c) #(x a b c y z) :start2 1 :end2 nil) 3))
	  (test-t (null (mismatch '(a b c) #(x a b c y z) :start2 1 :end2 4)))
	  (test-t (eql (mismatch '(a b c d e) #(c d)) 0))
	  (test-t (eql (mismatch '(a b c d e) #(c d) :start1 2) 4))
	  (test-t (eql (mismatch '(a b c d e) #(c d) :start1 2 :end1 3) 3))
	  (test-t (eql (mismatch '(a b c d e) #(c d) :start1 2 :start2 1) 2))
	  (test-t (eql (mismatch '(a b c d e) #(c d) :start1 3 :start2 1) 4))
	  (test-t (eql (mismatch '(a b c d e) #(c d) :start1 2 :end2 1) 3))
	  (test-t (null (mismatch '(a b c d) #(a b c d) :start1 1 :end1 2 :start2 1 :end2 2)))
	  (test-t (null (mismatch '(a b c d) #(a b c d) :start1 1 :end1 3 :start2 1 :end2 3)))
	  (test-t (null (mismatch '(a b c d) #(a b c d) :start1 1 :end1 4 :start2 1 :end2 4)))
	  (test-t (eql (mismatch '(a b c d) #(a b c d) :start1 1 :end1 nil :start2 1 :end2 1) 1))
	  (test-t (eql (mismatch '(a b c d) #(a b c d) :start1 1 :end1 nil :start2 1 :end2 2) 2))
	  (test-t (eql (mismatch '(a b c d) #(a b c d) :start1 1 :end1 nil :start2 1 :end2 3) 3))
	  (test-t (null (mismatch '(a b c d) #(a b c d) :start1 1 :end1 nil :start2 1 :end2 4)))
	  (test-t (eql (mismatch '(a b c d) #(a b c d) :start1 1 :end1 1 :start2 1) 1))
	  (test-t (eql (mismatch '(a b c d) #(a b c d) :start1 1 :end1 2 :start2 1) 2))
	  (test-t (eql (mismatch '(a b c d) #(a b c d) :start1 1 :end1 3 :start2 1) 3))
	  (test-t (null (mismatch '(a b c d) #(a b c d) :start1 1 :end1 4 :start2 1)))
	  (test-t (null (mismatch '(a b c) #(a b c) :from-end t)))
	  (test-t (eql (mismatch '(a b c d) #(a b c) :from-end t) 4))
	  (test-t (eql (mismatch '(a b c) #(c) :from-end t) 2))
	  (test-t (eql (mismatch '(a b c) #(z a b c) :from-end t) 0))
	  (test-t (eql (mismatch '(a b c) #(x y z a b c) :from-end t) 0))
	  (test-t (eql (mismatch '(x y z a b c) #(a b c) :from-end t) 3))
	  (test-t (eql (mismatch '(x y z a b c) #(a b c) :end1 3 :from-end t) 3))
	  (test-t (eql (mismatch '(x y z a b c) #(a b c) :end1 5 :from-end t) 5))
	  (test-t (eql (mismatch '(x y z a b c x y z) #(a b c) :end1 6 :from-end t) 3))
	  (test-t (eql (mismatch '(x y z a b c x y z) #(a b c) :start1 2 :end1 6 :from-end t) 3))
	  (test-t (eql (mismatch '(x y z a b c x y z) #(a b c) :from-end t :start1 2 :end1 5 :start2 1 :end2 2 ) 4))
	  (test-t (eql (mismatch '(x y z a b c x y z) #(a b c) :start1 2 :end1 5 :start2 1 :end2 2 ) 2))
	  (test-t (eql (mismatch '((a) (b) (c)) #((a) (b) (c))) 0))
	  (test-t (null (mismatch '((a) (b) (c)) #((a) (b) (c)) :key car)))
	  (test-t (null (mismatch '((a) (b) (c)) #((a) (b) (c)) :test equal)))
	  (test-t (eql (mismatch '(#(a) #(b) #(c)) #(#(a) #(b) #(c))) 0))
	  (test-t (null (mismatch '(#(a) #(b) #(c)) #(#(a) #(b) #(c)) :test equalp)))
	  (test-t (eql (mismatch '((a) (b) (c) (d)) #((a) (b) (c)) :key car) 3))
	  (test-t (eql (mismatch '((a) (b) (c)) #((a) (b) (c) (d)) :key car) 3))
	  (test-t (eql (mismatch '(#\a #\b #\c) #(#\A #\B #\C)) 0))
	  (test-t (null (mismatch '(#\a #\b #\c) #(#\A #\B #\C) :key char-upcase)))
	  (test-t (null (mismatch '(#\a #\b #\c) #(#\A #\B #\C) :key char-downcase)))
	  (test-t (null (mismatch '(#\a #\b #\c) #(#\A #\B #\C) :key char-upcase :start1 1 :end1 2 :start2 1 :end2 2)))
	  (test-t (null (mismatch '(#\a #\b #\c) #(#\A #\B #\C) :key char-upcase :start1 2 :start2 2)))
	  (test-t (eql (mismatch '((a b c) (b c d) (d e f)) #((b b c) (c c d) (e e f))) 0))
	  (test-t (eql (mismatch '((a b c) (b c d) (d e f)) #((b b c) (c c d) (e e f)) :key cdr) 0))
	  (test-t (null (mismatch '((a b c) (b c d) (d e f)) #((b b c) (c c d) (e e f)) :key cdr :test equal)))
	  (test-t (eql (mismatch '((a b c) (b c d) (d e f) (e f g)) #((b b c) (c c d) (e e f)) :key cdr :test equal) 3))
	  (test-t (eql (mismatch '((a b c) (b c d) (d e f) (e f g)) #((b b c) (c c d) (e e f)) :key cdr :test equal :from-end t) 4))
	  (test-t (eql (mismatch '((a a a) (a b c) (b c d) (d e f)) #((b b c) (c c d) (e e f)) :key cdr :test equal :from-end t) 1))
	  (test-t (null (mismatch '((a a a) (a b c) (b c d) (d e f) (e f g)) #((b b c) (c c d) (e e f)) :key cdr :test equal :from-end t :start1 1 :end1 4)))
	  (test-t (eql (mismatch '((a a a) (a b c) (b c d) (d e f) (e f g)) #((b b c) (c c d) (e e f)) :key cdr :test equal :from-end t :start1 1) 5))
	  (test-t (eql (mismatch '((a a a) (a b c) (b c d) (d e f) (e f g)) #((b b c) (c c d) (e e f)) :key cdr :test equal :from-end t :end1 3 :start2 1 :end2 2) 2))
	  (test-t (null (mismatch #() #())))
	  (test-t (eql (mismatch #(a b c) #(x y z)) 0))
	  (test-t (eql (mismatch #() #(x y z)) 0))
	  (test-t (eql (mismatch #(x y z) #()) 0))
	  (test-t (null (mismatch #(a) #(a))))
	  (test-t (eql (mismatch #(a b c x y z) #(a b c)) 3))
	  (test-t (null (mismatch #(a b c) #(a b c))))
	  (test-t (eql (mismatch #(a b c d e f) #(a b c)) 3))
	  (test-t (eql (mismatch #(a b c) #(a b c d e f)) 3))
	  (test-t (eql (mismatch #(a b c) #(a b x)) 2))
	  (test-t (eql (mismatch #(a b c) #(a x c)) 1))
	  (test-t (eql (mismatch #(a b c) #(x b c)) 0))
	  (test-t (eql (mismatch #(x y z a b c x y z) #(a b c) :start1 3) 6))
	  (test-t (eql (mismatch #(x y z a b c x y z) #(a b c) :start1 3 :end1 nil) 6))
	  (test-t (eql (mismatch #(x y z a b c x y z) #(a b c) :start1 3 :end1 4) 4))
	  (test-t (eql (mismatch #(x y z a b c x y z) #(a b c) :start1 3 :end1 3) 3))
	  (test-t (null (mismatch #(x y z) #() :start1 0 :end1 0)))
	  (test-t (null (mismatch #(x y z) #() :start1 1 :end1 1)))
	  (test-t (null (mismatch #(x y z) #() :start1 2 :end1 2)))
	  (test-t (null (mismatch #(x y z) #() :start1 3 :end1 3)))
	  (test-t (eql (mismatch #(x y z) #(a b c) :start1 0 :end1 0) 0))
	  (test-t (eql (mismatch #(x y z) #(a b c) :start1 1 :end1 1) 1))
	  (test-t (eql (mismatch #(x y z) #(a b c) :start1 2 :end1 2) 2))
	  (test-t (eql (mismatch #(x y z) #(a b c) :start1 3 :end1 3) 3))
	  (test-t (eql (mismatch #(x y z) #(x y z) :start1 0 :end1 1) 1))
	  (test-t (eql (mismatch #(x y z) #(x y z) :start1 0 :end1 2) 2))
	  (test-t (eql (mismatch #(x y z) #(x y z Z) :start1 0 :end1 3) 3))
	  (test-t (null (mismatch #(x y z) #(x y z) :start1 0 :end1 3)))
	  (test-t (eql (mismatch #(a b c x y z) #(x y z a b c)) 0))
	  (test-t (eql (mismatch #(a b c x y z) #(x y z a b c) :start1 3) 6))
	  (test-t (eql (mismatch #(a b c x y z a b c) #(x y z a b c x y z) :start1 3) 9))
	  (test-t (eql (mismatch #(a b c x y z a b c) #(x y z a b c x y z) :start1 6) 6))
	  (test-t (eql (mismatch #(a b c x y z a b c) #(x y z a b c x y z) :start1 6 :start2 3) 9))
	  (test-t (eql (mismatch #(a b c x y z a b c) #(x y z a b c x y z) :start1 0 :start2 3) 6))
	  (test-t (eql (mismatch #(a b c) #(a b c x y z)) 3))
	  (test-t (eql (mismatch #(a b c) #(x a b c y z)) 0))
	  (test-t (eql (mismatch #(a b c) #(x a b c y z) :start2 1) 3))
	  (test-t (eql (mismatch #(a b c) #(x a b c y z) :start2 1 :end2 nil) 3))
	  (test-t (null (mismatch #(a b c) #(x a b c y z) :start2 1 :end2 4)))
	  (test-t (eql (mismatch #(a b c d e) #(c d)) 0))
	  (test-t (eql (mismatch #(a b c d e) #(c d) :start1 2) 4))
	  (test-t (eql (mismatch #(a b c d e) #(c d) :start1 2 :end1 3) 3))
	  (test-t (eql (mismatch #(a b c d e) #(c d) :start1 2 :start2 1) 2))
	  (test-t (eql (mismatch #(a b c d e) #(c d) :start1 3 :start2 1) 4))
	  (test-t (eql (mismatch #(a b c d e) #(c d) :start1 2 :end2 1) 3))
	  (test-t (null (mismatch #(a b c d) #(a b c d) :start1 1 :end1 2 :start2 1 :end2 2)))
	  (test-t (null (mismatch #(a b c d) #(a b c d) :start1 1 :end1 3 :start2 1 :end2 3)))
	  (test-t (null (mismatch #(a b c d) #(a b c d) :start1 1 :end1 4 :start2 1 :end2 4)))
	  (test-t (eql (mismatch #(a b c d) #(a b c d) :start1 1 :end1 nil :start2 1 :end2 1) 1))
	  (test-t (eql (mismatch #(a b c d) #(a b c d) :start1 1 :end1 nil :start2 1 :end2 2) 2))
	  (test-t (eql (mismatch #(a b c d) #(a b c d) :start1 1 :end1 nil :start2 1 :end2 3) 3))
	  (test-t (null (mismatch #(a b c d) #(a b c d) :start1 1 :end1 nil :start2 1 :end2 4)))
	  (test-t (eql (mismatch #(a b c d) #(a b c d) :start1 1 :end1 1 :start2 1) 1))
	  (test-t (eql (mismatch #(a b c d) #(a b c d) :start1 1 :end1 2 :start2 1) 2))
	  (test-t (eql (mismatch #(a b c d) #(a b c d) :start1 1 :end1 3 :start2 1) 3))
	  (test-t (null (mismatch #(a b c d) #(a b c d) :start1 1 :end1 4 :start2 1)))
	  (test-t (null (mismatch #(a b c) #(a b c) :from-end t)))
	  (test-t (eql (mismatch #(a b c d) #(a b c) :from-end t) 4))
	  (test-t (eql (mismatch #(a b c) #(c) :from-end t) 2))
	  (test-t (eql (mismatch #(a b c) #(z a b c) :from-end t) 0))
	  (test-t (eql (mismatch #(a b c) #(x y z a b c) :from-end t) 0))
	  (test-t (eql (mismatch #(x y z a b c) #(a b c) :from-end t) 3))
	  (test-t (eql (mismatch #(x y z a b c) #(a b c) :end1 3 :from-end t) 3))
	  (test-t (eql (mismatch #(x y z a b c) #(a b c) :end1 5 :from-end t) 5))
	  (test-t (eql (mismatch #(x y z a b c x y z) #(a b c) :end1 6 :from-end t) 3))
	  (test-t (eql (mismatch #(x y z a b c x y z) #(a b c) :start1 2 :end1 6 :from-end t) 3))
	  (test-t (eql (mismatch #(x y z a b c x y z) #(a b c) :from-end t :start1 2 :end1 5 :start2 1 :end2 2 ) 4))
	  (test-t (eql (mismatch #(x y z a b c x y z) #(a b c) :start1 2 :end1 5 :start2 1 :end2 2 ) 2))
	  (test-t (eql (mismatch #((a) (b) (c)) #((a) (b) (c))) 0))
	  (test-t (null (mismatch #((a) (b) (c)) #((a) (b) (c)) :key car)))
	  (test-t (null (mismatch #((a) (b) (c)) #((a) (b) (c)) :test equal)))
	  (test-t (eql (mismatch #(#(a) #(b) #(c)) #(#(a) #(b) #(c))) 0))
	  (test-t (null (mismatch #(#(a) #(b) #(c)) #(#(a) #(b) #(c)) :test equalp)))
	  (test-t (eql (mismatch #((a) (b) (c) (d)) #((a) (b) (c)) :key car) 3))
	  (test-t (eql (mismatch #((a) (b) (c)) #((a) (b) (c) (d)) :key car) 3))
	  (test-t (eql (mismatch #(#\a #\b #\c) #(#\A #\B #\C)) 0))
	  (test-t (null (mismatch #(#\a #\b #\c) #(#\A #\B #\C) :key char-upcase)))
	  (test-t (null (mismatch #(#\a #\b #\c) #(#\A #\B #\C) :key char-downcase)))
	  (test-t (null (mismatch #(#\a #\b #\c) #(#\A #\B #\C) :key char-upcase :start1 1 :end1 2 :start2 1 :end2 2)))
	  (test-t (null (mismatch #(#\a #\b #\c) #(#\A #\B #\C) :key char-upcase :start1 2 :start2 2)))
	  (test-t (eql (mismatch #((a b c) (b c d) (d e f)) #((b b c) (c c d) (e e f))) 0))
	  (test-t (eql (mismatch #((a b c) (b c d) (d e f)) #((b b c) (c c d) (e e f)) :key cdr) 0))
	  (test-t (null (mismatch #((a b c) (b c d) (d e f)) #((b b c) (c c d) (e e f)) :key cdr :test equal)))
	  (test-t (eql (mismatch #((a b c) (b c d) (d e f) (e f g)) #((b b c) (c c d) (e e f)) :key cdr :test equal) 3))
	  (test-t (eql (mismatch #((a b c) (b c d) (d e f) (e f g)) #((b b c) (c c d) (e e f)) :key cdr :test equal :from-end t) 4))
	  (test-t (eql (mismatch #((a a a) (a b c) (b c d) (d e f)) #((b b c) (c c d) (e e f)) :key cdr :test equal :from-end t) 1))
	  (test-t (null (mismatch #((a a a) (a b c) (b c d) (d e f) (e f g)) #((b b c) (c c d) (e e f)) :key cdr :test equal :from-end t :start1 1 :end1 4)))
	  (test-t (eql (mismatch #((a a a) (a b c) (b c d) (d e f) (e f g)) #((b b c) (c c d) (e e f)) :key cdr :test equal :from-end t :start1 1) 5))
	  (test-t (eql (mismatch #((a a a) (a b c) (b c d) (d e f) (e f g)) #((b b c) (c c d) (e e f)) :key cdr :test equal :from-end t :end1 3 :start2 1 :end2 2) 2))
	  (test-t (eql (mismatch "abc" "xyz") 0))
	  (test-t (null (mismatch "" "")))
	  (test-t (null (mismatch "a" "a")))
	  (test-t (null (mismatch "abc" "abc")))
	  (test-t (null (mismatch "abc" "ABC" :key char-downcase)))
	  (test-t (null (mismatch "abc" "ABC" :test char-equal)))
	  (test-t (eql (mismatch "abcde" "abc") 3))
	  (test-t (eql (mismatch "abc" "abcde") 3))
	  (test-t (eql (mismatch "abc" "abxyz") 2))
	  (test-t (eql (mismatch "abcde" "abx") 2))
	  (test-t (null (mismatch "abc" "abc" :from-end t)))
	  (test-t (eql (mismatch "abcxyz" "xyzxyz" :from-end t) 3))
	  (test-t (eql (mismatch "abcxyz" "xyz" :from-end t) 3))
	  (test-t (eql (mismatch "xyz" "abcxyz" :from-end t) 0))
	  (test-t (eql (mismatch "ayz" "abcxyz" :from-end t) 1))
	  (test-t (null (mismatch "abc" "xyz" :test char<)))
	  (test-t (eql (mismatch "abc" "xyz" :test char>) 0))
	  (test-t (eql (mismatch "abcxyz" "abcdefg") 3))
	  (test-t (eql (mismatch "1xyz" "22xyz" :from-end t) 1))
	  )
	
	;; -------- defstruct

	(defmacro defstruct (struct-name . fields)
	  (let* ((name (if (list? struct-name) (car struct-name) struct-name))
		 (sname (if (string? name) name (symbol->string name)))
		 
		 (fsname (if (list? struct-name)
			     (let ((cname (assoc :conc-name (cdr struct-name))))
			       (if cname 
				   (symbol->string (cadr cname))
				   sname))
			     sname))
		 
		 (make-name (if (list? struct-name)
				(let ((cname (assoc :constructor (cdr struct-name))))
				  (if cname 
				      (cadr cname)
				      (string->symbol (string-append "make-" sname))))
				(string->symbol (string-append "make-" sname))))
		 
		 (copy-name (if (list? struct-name)
				(let ((cname (assoc :copier (cdr struct-name))))
				  (if cname 
				      (cadr cname)
				      (string->symbol (string-append "copy-" sname))))
				(string->symbol (string-append "copy-" sname))))
		 
		 (field-names (map (lambda (n)
				     (symbol->string (if (list? n) (car n) n)))
				   fields))
		 
		 (field-types (map (lambda (field)
				     (if (list? field)
					 (apply (lambda* (val type read-only) type) (cdr field))
					 #f))
				   fields))
		 
		 (field-read-onlys (map (lambda (field)
					  (if (list? field)
					      (apply (lambda* (val type read-only) read-only) (cdr field))
					      #f))
					fields)))
	    `(begin
	       
	       (define ,(string->symbol (string-append sname "?"))
		 (lambda (obj)
		   (and (vector? obj)
			(eq? (obj 0) ',(string->symbol sname)))))
	       
	       (define* (,make-name
			 ,@(map (lambda (n)
				  (if (and (list? n)
					   (>= (length n) 2))
				      (list (car n) (cadr n))
				      (list n #f)))
				fields))
		 (vector ',(string->symbol sname) ,@(map string->symbol field-names)))
	       
	       (define ,copy-name copy)
	       
	       ,@(map (let ((ctr 1))
			(lambda (n type read-only)
			  (let ((val (if read-only
					 `(define ,(string->symbol (string-append fsname "-" n))
					    (lambda (arg) (arg ,ctr)))
					 `(define ,(string->symbol (string-append fsname "-" n))
					    (dilambda 
					     (lambda (arg) (arg ,ctr)) 
					     (lambda (arg val) (set! (arg ,ctr) val)))))))
			    (set! ctr (+ 1 ctr))
			    val)))
		      field-names field-types field-read-onlys))))
	
	;; not yet implemented: :print-function :include :named :type :initial-offset
	;;   also the explicit constructor business

	(define-macro (enum . args) ; (enum zero one two)
	  `(begin
	     ,@(let ((names ()))
		 (do ((arg args (cdr arg))
		      (i 0 (+ i 1)))
		     ((null? arg) names)
		   (set! names (cons
				`(define ,(car arg) ,i)
				names))))))

	(define-macro (let*-values vals . body)
	  (let ((args ())
		(exprs ()))
	    (for-each
	     (lambda (arg+expr)
	       (set! args (cons (car arg+expr) args))
	       (set! exprs (cons (cadr arg+expr) exprs)))
	     vals)
	    (let ((form `((lambda ,(car args) ,@body) ,(car exprs))))
	      (if (not (null? (cdr args)))
		  (for-each
		   (lambda (arg expr)
		     (set! form `((lambda ,arg ,form) ,expr)))
		   (cdr args)
		   (cdr exprs)))
	      form)))

        (let ()

          ;; this is the nbody computer shootout benchmark taken from mzscheme
	  (define +days-per-year+ 365.24)
	  (define +solar-mass+ (* 4 pi pi))
	  (defstruct body x y z vx vy vz mass)
	  
	  (define *sun*
	    (make-body 0.0 0.0 0.0 0.0 0.0 0.0 +solar-mass+))
	  
	  (define *jupiter*
	    (make-body 4.84143144246472090
		       -1.16032004402742839
		       -1.03622044471123109e-1
		       (* 1.66007664274403694e-3 +days-per-year+)
		       (* 7.69901118419740425e-3 +days-per-year+)
		       (* -6.90460016972063023e-5 +days-per-year+)
		       (* 9.54791938424326609e-4 +solar-mass+)))
	  
	  (define *saturn*
	    (make-body 8.34336671824457987
		       4.12479856412430479
		       -4.03523417114321381e-1
		       (* -2.76742510726862411e-3 +days-per-year+)
		       (* 4.99852801234917238e-3 +days-per-year+)
		       (* 2.30417297573763929e-5 +days-per-year+)
		       (* 2.85885980666130812e-4 +solar-mass+)))
	  
	  (define *uranus*
	    (make-body 1.28943695621391310e1
		       -1.51111514016986312e1
		       -2.23307578892655734e-1
		       (* 2.96460137564761618e-03 +days-per-year+)
		       (* 2.37847173959480950e-03 +days-per-year+)
		       (* -2.96589568540237556e-05 +days-per-year+)
		       (*  4.36624404335156298e-05 +solar-mass+)))
	  
	  (define *neptune*
	    (make-body 1.53796971148509165e+01
		       -2.59193146099879641e+01
		       1.79258772950371181e-01
		       (* 2.68067772490389322e-03 +days-per-year+)
		       (* 1.62824170038242295e-03 +days-per-year+)
		       (* -9.51592254519715870e-05 +days-per-year+)
		       (* 5.15138902046611451e-05 +solar-mass+)))
	  
	  (define (offset-momentum system)
	    (let loop-i ((i system) (px 0.0) (py 0.0) (pz 0.0))
	      (if (null? i)
		  (begin
		    (set! (body-vx (car system)) (/ (- px) +solar-mass+))
		    (set! (body-vy (car system)) (/ (- py) +solar-mass+))
		    (set! (body-vz (car system)) (/ (- pz) +solar-mass+)))
		  (loop-i (cdr i)
			  (+ px (* (body-vx (car i)) (body-mass (car i))))
			  (+ py (* (body-vy (car i)) (body-mass (car i))))
			  (+ pz (* (body-vz (car i)) (body-mass (car i))))))))
	  
	  (define (energy system)
	    (let loop-o ((o system) (e 0.0))
	      (if (null? o)
		  e
		  (let ((e (+ e (* 0.5 (body-mass (car o))
				   (+ (* (body-vx (car o)) (body-vx (car o)))
				      (* (body-vy (car o)) (body-vy (car o)))
				      (* (body-vz (car o)) (body-vz (car o))))))))
		    (let loop-i ((i (cdr o)) (e e))
		      (if (null? i)
			  (loop-o (cdr o) e)
			  (let* ((dx (- (body-x (car o)) (body-x (car i))))
				 (dy (- (body-y (car o)) (body-y (car i))))
				 (dz (- (body-z (car o)) (body-z (car i))))
				 (distance (sqrt (+ (* dx dx) (* dy dy) (* dz dz)))))
			    (let ((e  (- e (/ (* (body-mass (car o)) (body-mass (car i))) distance))))
			      (loop-i (cdr i) e)))))))))
	  
	  (define (advance system dt)
	    (let loop-o ((o system))
	      (unless (null? o)
		      (let loop-i ((i (cdr o)))
			(unless (null? i)
				(let* ((o1 (car o))
				       (i1 (car i))
				       (dx (- (body-x o1) (body-x i1)))
				       (dy (- (body-y o1) (body-y i1)))
				       (dz (- (body-z o1) (body-z i1)))
				       (distance (sqrt (+ (* dx dx) (* dy dy) (* dz dz))))
				       (mag (/ dt (* distance distance distance)))
				       (dxmag (* dx mag))
				       (dymag (* dy mag))
				       (dzmag (* dz mag))
				       (om (body-mass o1))
				       (im (body-mass i1)))
				  (set! (body-vx o1) (- (body-vx o1) (* dxmag im)))
				  (set! (body-vy o1) (- (body-vy o1) (* dymag im)))
				  (set! (body-vz o1) (- (body-vz o1) (* dzmag im)))
				  (set! (body-vx i1) (+ (body-vx i1) (* dxmag om)))
				  (set! (body-vy i1) (+ (body-vy i1) (* dymag om)))
				  (set! (body-vz i1) (+ (body-vz i1) (* dzmag om)))
				  (loop-i (cdr i)))))
		      (loop-o (cdr o))))
	    (let loop-o ((o system))
	      (unless (null? o)
		      (let ((o1 (car o)))
			(set! (body-x o1) (+ (body-x o1) (* dt (body-vx o1))))
			(set! (body-y o1) (+ (body-y o1) (* dt (body-vy o1))))
			(set! (body-z o1) (+ (body-z o1) (* dt (body-vz o1))))
			(loop-o (cdr o))))))
	  
	  ;; (define (nbody-test)
	  
	  (let ((n 10) ;(n 1000) ; (command-line #:args (n) (string->number n)))
		(system (list *sun* *jupiter* *saturn* *uranus* *neptune*)))
	    (offset-momentum system)
	    (let ((initial (energy system)))
	      (do ((i 1 (+ i 1)))
		  ((< n i))
		(advance system 0.01))
	      (let ((final (energy system)))
		(num-test initial -0.16907516382852)
		(num-test final -0.16908760523461)
					;(list initial final))))) ; (-0.16907516382852 -0.16908760523461)
		))))
	

	;;; ----------------
	;;; some of these tests are taken (with modifications) from sacla which has 
	;;;  the following copyright notice:
	;;;
	;; Copyright (C) 2002-2004, Yuji Minejima <ggb01164@nifty.ne.jp>
	;; ALL RIGHTS RESERVED.
	;;
	;; Redistribution and use in source and binary forms, with or without
	;; modification, are permitted provided that the following conditions
	;; are met:
	;; 
	;;  * Redistributions of source code must retain the above copyright
	;;    notice, this list of conditions and the following disclaimer.
	;;  * Redistributions in binary form must reproduce the above copyright
	;;    notice, this list of conditions and the following disclaimer in
	;;    the documentation and/or other materials provided with the
	;;    distribution.
	;; 
	;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
	;; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
	;; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
	;; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
	;; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
	;; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
	;; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
	;; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
	;; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
	;; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
	;; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

	(test-t (equal 'a 'a))
	(test-t (not (equal 'a 'b)))
	(test-t (equal 'abc 'abc))
	(test-t (equal 1 1))
	(test-t (equal 2 2))
	(test-t (equal 0.1 0.1))
	(test-t (equal 1/3 1/3))
	(test-t (not (equal 0 1)))
	(test-t (not (equal 1 1.0)))
	(test-t (not (equal 1/3 1/4)))
	(test-t (equal #\a #\a))
	(test-t (equal #\b #\b))
	(test-t (not (equal #\b #\B)))
	(test-t (not (equal #\C #\c)))
	(test-t (equal '(0) '(0)))
	(test-t (equal '(0 #\a) '(0 #\a)))
	(test-t (equal '(0 #\a x) '(0 #\a x)))
	(test-t (equal '(0 #\a x (0)) '(0 #\a x (0))))

	(test-t (eql (identity 101) 101))
	(test-t (eq (identity 'x) 'x))

	;; chars
	(test-t (char= #\d #\d))
	(test-t (not (char= #\A #\a)))
	(test-t (not (char= #\d #\x)))
	(test-t (not (char= #\d #\D)))
	(test-t (not (char/= #\d #\d)))
	(test-t (char/= #\d #\x))
	(test-t (char/= #\d #\D))
	(test-t (char= #\d #\d #\d #\d))
	(test-t (not (char/= #\d #\d #\d #\d)))
	(test-t (not (char= #\d #\d #\x #\d)))
	(test-t (not (char/= #\d #\d #\x #\d)))
	(test-t (not (char= #\d #\y #\x #\c)))
	(test-t (char/= #\d #\y #\x #\c))
	(test-t (not (char= #\d #\c #\d)))
	(test-t (not (char/= #\d #\c #\d)))
	(test-t (char< #\d #\x))
	(test-t (char<= #\d #\x))
	(test-t (not (char< #\d #\d)))
	(test-t (char<= #\d #\d))
	(test-t (char< #\a #\e #\y #\z))
	(test-t (char<= #\a #\e #\y #\z))
	(test-t (not (char< #\a #\e #\e #\y)))
	(test-t (char<= #\a #\e #\e #\y))
	(test-t (char> #\e #\d))
	(test-t (char>= #\e #\d))
	(test-t (char> #\d #\c #\b #\a))
	(test-t (char>= #\d #\c #\b #\a))
	(test-t (not (char> #\d #\d #\c #\a)))
	(test-t (char>= #\d #\d #\c #\a))
	(test-t (not (char> #\e #\d #\b #\c #\a)))
	(test-t (not (char>= #\e #\d #\b #\c #\a)))
	(test-t (char-equal #\A #\a))
	(test-t (char= #\a))
	(test-t (char= #\a #\a))
	(test-t (char= #\a #\a #\a))
	(test-t (char= #\a #\a #\a #\a))
	(test-t (char= #\a #\a #\a #\a #\a))
	(test-t (char= #\a #\a #\a #\a #\a #\a))
	(test-t (let ((c #\z))  (and (eq c c)       (char= c c))))
	(test-t (not (char= #\Z #\z)))
	(test-t (not (char= #\z #\z #\z #\a)))
	(test-t (not (char= #\a #\z #\z #\z #\a)))
	(test-t (not (char= #\z #\i #\z #\z)))
	(test-t (not (char= #\z #\z #\Z #\z)))
	(test-t (char/= #\a))
	(test-t (char/= #\a #\b))
	(test-t (char/= #\a #\b #\c))
	(test-t (char/= #\a #\b #\c #\d))
	(test-t (char/= #\a #\b #\c #\d #\e))
	(test-t (char/= #\a #\b #\c #\d #\e #\f))
	(test-t (let ((c #\z))  (and (eq c c)       (not (char/= c c)))))
	(test-t (char/= #\Z #\z))
	(test-t (not (char/= #\z #\z #\z #\a)))
	(test-t (not (char= #\a #\z #\z #\z #\a)))
	(test-t (not (char= #\z #\i #\z #\z)))
	(test-t (not (char= #\z #\z #\Z #\z)))
	(test-t (not (char/= #\a #\a #\b #\c)))
	(test-t (not (char/= #\a #\b #\a #\c)))
	(test-t (not (char/= #\a #\b #\c #\a)))
	(test-t (char< #\a))
	(test-t (char< #\a #\z))
	(test-t (char< #\a #\b #\c #\d #\e #\f #\g #\h #\i #\j #\k #\l #\m       #\n #\o #\p #\q #\r #\s #\t #\u #\v #\w #\x #\y #\z))
	(test-t (not (char< #\z #\y #\x #\w #\v #\u #\t #\s #\r #\q #\p #\o #\n	    #\m #\l #\k #\j #\i #\h #\g #\f #\e #\d #\c #\b #\a)))
	(test-t (char< #\A #\B #\C #\D #\E #\F #\G #\H #\I #\J #\K #\L #\M       #\N #\O #\P #\Q #\R #\S #\T #\U #\V #\W #\X #\Y #\Z))
	(test-t (not (char< #\Z #\Y #\X #\W #\V #\U #\T #\S #\R #\Q #\P #\O #\N	    #\M #\L #\K #\J #\I #\H #\G #\F #\E #\D #\C #\B #\A)))
	(test-t (char< #\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9))
	(test-t (not (char< #\9 #\8 #\7 #\6 #\5 #\4 #\3 #\2 #\1 #\0)))
	(test-t (or (char< #\9 #\A)    (char< #\Z #\0)))
	(test-t (or (char< #\9 #\a)    (char< #\z #\0)))
	(test-t (not (char< #\a #\a #\b #\c)))
	(test-t (not (char< #\a #\b #\a #\c)))
	(test-t (not (char< #\a #\b #\c #\a)))
	(test-t (not (char< #\9 #\0)))
	(test-t (char> #\a))
	(test-t (not (char> #\a #\z)))
	(test-t (char> #\z #\a))
	(test-t (not (char> #\a #\b #\c #\d #\e #\f #\g #\h #\i #\j #\k #\l #\m	    #\n #\o #\p #\q #\r #\s #\t #\u #\v #\w #\x #\y #\z)))
	(test-t (char> #\z #\y #\x #\w #\v #\u #\t #\s #\r #\q #\p #\o #\n       #\m #\l #\k #\j #\i #\h #\g #\f #\e #\d #\c #\b #\a))
	(test-t (not (char> #\A #\B #\C #\D #\E #\F #\G #\H #\I #\J #\K #\L #\M	    #\N #\O #\P #\Q #\R #\S #\T #\U #\V #\W #\X #\Y #\Z)))
	(test-t (char> #\Z #\Y #\X #\W #\V #\U #\T #\S #\R #\Q #\P #\O #\N      #\M #\L #\K #\J #\I #\H #\G #\F #\E #\D #\C #\B #\A))
	(test-t (not (char> #\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9)))
	(test-t (char> #\9 #\8 #\7 #\6 #\5 #\4 #\3 #\2 #\1 #\0))
	(test-t (or (char> #\A #\9)    (char> #\0 #\Z)))
	(test-t (or (char> #\a #\9)    (char> #\0 #\z)))
	(test-t (not (char> #\a #\a #\b #\c)))
	(test-t (not (char> #\a #\b #\a #\c)))
	(test-t (not (char> #\a #\b #\c #\a)))
	(test-t (char> #\9 #\0))
	(test-t (char<= #\a))
	(test-t (char<= #\a #\z))
	(test-t (char<= #\a #\a))
	(test-t (char<= #\Z #\Z))
	(test-t (char<= #\a #\b #\c #\d #\e #\f #\g #\h #\i #\j #\k #\l #\m	#\n #\o #\p #\q #\r #\s #\t #\u #\v #\w #\x #\y #\z))
	(test-t (char<= #\a #\a #\b #\b #\c #\c #\d #\d #\e #\e #\f #\f #\g #\g #\h #\h 
			#\i #\i #\j #\j #\k #\k #\l #\l #\m #\m	#\n #\n #\o #\o #\p #\p #\q #\q #\r #\r #\s #\s	
			#\t #\t #\u #\u #\v #\v #\w #\w #\x #\x #\y #\y #\z #\z))
	(test-t (not (char<= #\z #\y #\x #\w #\v #\u #\t #\s #\r #\q #\p #\o #\n     #\m #\l #\k #\j #\i #\h #\g #\f #\e #\d #\c #\b #\a)))
	(test-t (char<= #\A #\B #\C #\D #\E #\F #\G #\H #\I #\J #\K #\L #\M	#\N #\O #\P #\Q #\R #\S #\T #\U #\V #\W #\X #\Y #\Z))
	(test-t (char<= #\A #\B #\B #\C #\D #\E #\E #\F #\G #\H #\I #\I #\J #\K #\L #\M	#\N #\N #\O #\P #\Q #\R #\S #\T #\T #\U #\V #\W #\X #\Y #\Z))
	(test-t (not (char<= #\Z #\Y #\X #\W #\V #\U #\T #\S #\R #\Q #\P #\O #\N     #\M #\L #\K #\J #\I #\H #\G #\F #\E #\D #\C #\B #\A)))
	(test-t (char<= #\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9))
	(test-t (char<= #\0 #\1 #\2 #\2 #\3 #\3 #\3 #\3 #\4 #\5 #\6 #\7 #\8 #\9 #\9))
	(test-t (not (char<= #\9 #\8 #\7 #\6 #\5 #\4 #\3 #\2 #\1 #\0)))
	(test-t (or (char<= #\9 #\A)    (char<= #\Z #\0)))
	(test-t (or (char<= #\9 #\a)    (char<= #\z #\0)))
	(test-t (char<= #\a #\a #\b #\c))
	(test-t (not (char<= #\a #\b #\a #\c)))
	(test-t (not (char<= #\a #\b #\c #\a)))
	(test-t (not (char<= #\9 #\0)))
	(test-t (char>= #\a))
	(test-t (not (char>= #\a #\z)))
	(test-t (char>= #\z #\a))
	(test-t (char>= #\a #\a))
	(test-t (char>= #\Z #\Z))
	(test-t (not (char>= #\a #\b #\c #\d #\e #\f #\g #\h #\i #\j #\k #\l #\m     #\n #\o #\p #\q #\r #\s #\t #\u #\v #\w #\x #\y #\z)))
	(test-t (char>= #\z #\y #\x #\w #\v #\u #\t #\s #\r #\q #\p #\o #\n	#\m #\l #\k #\j #\i #\h #\g #\f #\e #\d #\c #\b #\a))
	(test-t (char>= #\z #\z #\y #\x #\w #\v #\u #\t #\s #\r #\q #\p #\o #\n #\n	#\m #\m #\l #\k #\j #\i #\h #\g #\f #\e #\d #\c #\b #\a #\a))
	(test-t (not (char>= #\A #\B #\C #\D #\E #\F #\G #\H #\I #\J #\K #\L #\M     #\N #\O #\P #\Q #\R #\S #\T #\U #\V #\W #\X #\Y #\Z)))
	(test-t (char>= #\Z #\Y #\X #\W #\V #\U #\T #\S #\R #\Q #\P #\O #\N	#\M #\L #\K #\J #\I #\H #\G #\F #\E #\D #\C #\B #\A))
	(test-t (char>= #\Z #\Y #\X #\W #\V #\U #\U #\T #\T #\S #\S #\R #\Q #\P #\O #\N	#\M #\L #\K #\J #\I #\H #\H #\G #\G #\F #\F #\E #\D #\C #\B #\A))
	(test-t (not (char>= #\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9)))
	(test-t (char>= #\9 #\8 #\7 #\6 #\5 #\4 #\3 #\2 #\1 #\0))
	(test-t (char>= #\9 #\8 #\8 #\8 #\7 #\6 #\5 #\4 #\3 #\3 #\3 #\2 #\1 #\0))
	(test-t (or (char>= #\A #\9)    (char>= #\0 #\Z)))
	(test-t (or (char>= #\a #\9)    (char>= #\0 #\z)))
	(test-t (char>= #\c #\b #\a #\a))
	(test-t (not (char>= #\c #\b #\a #\a #\b #\c)))
	(test-t (not (char>= #\c #\b #\a #\c)))
	(test-t (not (char>= #\c #\b #\c #\a)))
	(test-t (char>= #\9 #\0))
	(test-t (not (char>= #\0 #\9)))
	(test-t (char-equal #\a))
	(test-t (char-equal #\a #\a))
	(test-t (char-equal #\a #\a #\a))
	(test-t (char-equal #\a #\a #\a #\a))
	(test-t (char-equal #\a #\a #\a #\a #\a))
	(test-t (char-equal #\a #\a #\a #\a #\a #\a))
	(test-t (char-equal #\a #\A))
	(test-t (char-equal #\a #\A #\a))
	(test-t (char-equal #\a #\a #\A #\a))
	(test-t (char-equal #\a #\a #\a #\A #\a))
	(test-t (char-equal #\a #\a #\a #\a #\A #\a))
	(test-t (let ((c #\z))  (and (eq c c)       (char-equal c c))))
	(test-t (char-equal #\Z #\z))
	(test-t (not (char-equal #\z #\z #\z #\a)))
	(test-t (not (char-equal #\a #\z #\z #\z #\a)))
	(test-t (not (char-equal #\z #\i #\z #\z)))
	(test-t (char-equal #\z #\z #\Z #\z))
	(test-t (char-equal #\a #\A #\a #\A #\a #\A #\a #\A #\a #\A))
	(test-t (char-not-equal #\a))
	(test-t (char-not-equal #\a #\b))
	(test-t (char-not-equal #\a #\b #\c))
	(test-t (char-not-equal #\a #\b #\c #\d))
	(test-t (char-not-equal #\a #\b #\c #\d #\e))
	(test-t (char-not-equal #\a #\b #\c #\d #\e #\f))
	(test-t (let ((c #\z))  (and (eq c c)       (not (char-not-equal c c)))))
	(test-t (not (char-not-equal #\Z #\z)))
	(test-t (not (char-not-equal #\z #\z #\z #\a)))
	(test-t (not (char= #\a #\z #\z #\z #\a)))
	(test-t (not (char= #\z #\i #\z #\z)))
	(test-t (not (char= #\z #\z #\Z #\z)))
	(test-t (not (char-not-equal #\a #\a #\b #\c)))
	(test-t (not (char-not-equal #\a #\b #\a #\c)))
	(test-t (not (char-not-equal #\a #\b #\c #\a)))
	(test-t (not (char-not-equal #\a #\A #\a #\A)))
	(test-t (char-lessp #\a))
	(test-t (char-lessp #\a #\z))
	(test-t (char-lessp #\a #\b #\c #\d #\e #\f #\g #\h #\i #\j #\k #\l #\m       #\n #\o #\p #\q #\r #\s #\t #\u #\v #\w #\x #\y #\z))
	(test-t (not (char-lessp #\z #\y #\x #\w #\v #\u #\t #\s #\r #\q #\p #\o #\n	    #\m #\l #\k #\j #\i #\h #\g #\f #\e #\d #\c #\b #\a)))
	(test-t (char-lessp #\A #\B #\C #\D #\E #\F #\G #\H #\I #\J #\K #\L #\M       #\N #\O #\P #\Q #\R #\S #\T #\U #\V #\W #\X #\Y #\Z))
	(test-t (not (char-lessp #\Z #\Y #\X #\W #\V #\U #\T #\S #\R #\Q #\P #\O #\N	    #\M #\L #\K #\J #\I #\H #\G #\F #\E #\D #\C #\B #\A)))
	(test-t (char-lessp #\a #\B #\c #\D #\e #\F #\g #\H #\i #\J #\k #\L #\m       #\N #\o #\P #\q #\R #\s #\T #\u #\V #\w #\X #\y #\Z))
	(test-t (char-lessp #\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9))
	(test-t (not (char-lessp #\9 #\8 #\7 #\6 #\5 #\4 #\3 #\2 #\1 #\0)))
	(test-t (or (char-lessp #\9 #\A)    (char-lessp #\Z #\0)))
	(test-t (or (char-lessp #\9 #\a)    (char-lessp #\z #\0)))
	(test-t (not (char-lessp #\a #\a #\b #\c)))
	(test-t (not (char-lessp #\a #\b #\a #\c)))
	(test-t (not (char-lessp #\a #\b #\c #\a)))
	(test-t (not (char-lessp #\9 #\0)))
	(test-t (and (char-lessp #\a #\Z)     (char-lessp #\A #\z)))
	(test-t (char-greaterp #\a))
	(test-t (not (char-greaterp #\a #\z)))
	(test-t (char-greaterp #\z #\a))
	(test-t (not (char-greaterp #\a #\b #\c #\d #\e #\f #\g #\h #\i #\j #\k #\l #\m	    #\n #\o #\p #\q #\r #\s #\t #\u #\v #\w #\x #\y #\z)))
	(test-t (char-greaterp #\z #\y #\x #\w #\v #\u #\t #\s #\r #\q #\p #\o #\n       #\m #\l #\k #\j #\i #\h #\g #\f #\e #\d #\c #\b #\a))
	(test-t (not (char-greaterp #\A #\B #\C #\D #\E #\F #\G #\H #\I #\J #\K #\L #\M	    #\N #\O #\P #\Q #\R #\S #\T #\U #\V #\W #\X #\Y #\Z)))
	(test-t (char-greaterp #\Z #\Y #\X #\W #\V #\U #\T #\S #\R #\Q #\P #\O #\N   #\M #\L #\K #\J #\I #\H #\G #\F #\E #\D #\C #\B #\A))
	(test-t (char-greaterp #\z #\Y #\x #\W #\v #\U #\t #\S #\r #\Q #\p #\O #\n   #\M #\l #\K #\j #\I #\h #\G #\f #\E #\d #\C #\b #\A))
	(test-t (not (char-greaterp #\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9)))
	(test-t (char-greaterp #\9 #\8 #\7 #\6 #\5 #\4 #\3 #\2 #\1 #\0))
	(test-t (or (char-greaterp #\A #\9)    (char-greaterp #\0 #\Z)))
	(test-t (or (char-greaterp #\a #\9)    (char-greaterp #\0 #\z)))
	(test-t (not (char-greaterp #\a #\a #\b #\c)))
	(test-t (not (char-greaterp #\a #\b #\a #\c)))
	(test-t (not (char-greaterp #\a #\b #\c #\a)))
	(test-t (char-greaterp #\9 #\0))
	(test-t (and (char-greaterp #\z #\A)     (char-greaterp #\Z #\a)))
	(test-t (char-not-greaterp #\a))
	(test-t (char-not-greaterp #\a #\z))
	(test-t (char-not-greaterp #\a #\a))
	(test-t (char-not-greaterp #\Z #\Z))
	(test-t (char-not-greaterp #\a #\b #\c #\d #\e #\f #\g #\h #\i #\j #\k #\l #\m #\n #\o #\p #\q #\r #\s #\t #\u #\v #\w #\x #\y #\z))
	(test-t (char-not-greaterp #\a #\a #\b #\b #\c #\c #\d #\d #\e #\e #\f #\f #\g #\g #\h #\h #\i #\i 
				   #\j #\j #\k #\k #\l #\l #\m #\m #\n #\n #\o #\o #\p #\p #\q #\q #\r #\r #\s #\s #\t 
				   #\t #\u #\u #\v #\v #\w #\w #\x #\x #\y #\y #\z #\z))
	(test-t (char-not-greaterp #\a #\A #\b #\B #\c #\C #\d #\D #\e #\E #\f #\F #\g #\G #\h #\H #\i #\I #\j #\J 
				   #\k #\K #\l #\L #\m #\M #\n #\N #\o #\O #\p #\P #\q #\Q #\r #\R #\s #\S #\t #\T 
				   #\u #\U #\v #\V #\w #\W #\x #\X #\y #\Y #\z #\z))
	(test-t (not (char-not-greaterp      #\z #\y #\x #\w #\v #\u #\t #\s #\r #\q #\p #\o #\n      #\m #\l #\k #\j #\i #\h #\g #\f #\e #\d #\c #\b #\a)))
	(test-t (char-not-greaterp #\A #\B #\C #\D #\E #\F #\G #\H #\I #\J #\K #\L #\M #\N #\O #\P #\Q #\R #\S #\T #\U #\V #\W #\X #\Y #\Z))
	(test-t (char-not-greaterp #\A #\B #\B #\C #\D #\E #\E #\F #\G #\H #\I #\I #\J #\K #\L #\M #\N #\N #\O #\P #\Q #\R #\S #\T #\T #\U #\V #\W #\X #\Y #\Z))
	(test-t (not (char-not-greaterp      #\Z #\Y #\X #\W #\V #\U #\T #\S #\R #\Q #\P #\O #\N      #\M #\L #\K #\J #\I #\H #\G #\F #\E #\D #\C #\B #\A)))
	(test-t (char-not-greaterp #\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9))
	(test-t (char-not-greaterp #\0 #\1 #\2 #\2 #\3 #\3 #\3 #\3 #\4 #\5 #\6 #\7 #\8 #\9 #\9))
	(test-t (not (char-not-greaterp #\9 #\8 #\7 #\6 #\5 #\4 #\3 #\2 #\1 #\0)))
	(test-t (or (char-not-greaterp #\9 #\A)    (char-not-greaterp #\Z #\0)))
	(test-t (or (char-not-greaterp #\9 #\a)    (char-not-greaterp #\z #\0)))
	(test-t (char-not-greaterp #\a #\a #\b #\c))
	(test-t (not (char-not-greaterp #\a #\b #\a #\c)))
	(test-t (not (char-not-greaterp #\a #\b #\c #\a)))
	(test-t (not (char-not-greaterp #\9 #\0)))
	(test-t (and (char-not-greaterp #\A #\z)     (char-not-greaterp #\a #\Z)))
	(test-t (char-not-lessp #\a))
	(test-t (not (char-not-lessp #\a #\z)))
	(test-t (char-not-lessp #\z #\a))
	(test-t (char-not-lessp #\a #\a))
	(test-t (char-not-lessp #\Z #\Z))
	(test-t (not (char-not-lessp #\a #\b #\c #\d #\e #\f #\g #\h #\i #\j #\k #\l #\m  #\n #\o #\p #\q #\r #\s #\t #\u #\v #\w #\x #\y #\z)))
	(test-t (char-not-lessp #\z #\y #\x #\w #\v #\u #\t #\s #\r #\q #\p #\o #\n	#\m #\l #\k #\j #\i #\h #\g #\f #\e #\d #\c #\b #\a))
	(test-t (char-not-lessp #\z #\z #\y #\x #\w #\v #\u #\t #\s #\r #\q #\p #\o #\n #\n	#\m #\m #\l #\k #\j #\i #\h #\g #\f #\e #\d #\c #\b #\a #\a))
	(test-t (not (char-not-lessp #\A #\B #\C #\D #\E #\F #\G #\H #\I #\J #\K #\L #\m     #\N #\O #\P #\Q #\R #\S #\T #\U #\V #\W #\X #\Y #\Z)))
	(test-t (char-not-lessp #\Z #\Y #\X #\W #\V #\U #\T #\S #\R #\Q #\P #\O #\N	#\M #\L #\K #\J #\I #\H #\G #\F #\E #\D #\C #\B #\A))
	(test-t (char-not-lessp #\Z #\Y #\X #\W #\V #\U #\U #\T #\T #\S #\S #\R #\Q #\P #\O #\N	#\M #\L #\K #\J #\I #\H #\H #\G #\G #\F #\F #\E #\D #\C #\B #\A))
	(test-t (char-not-lessp #\z #\Z #\y #\x #\w #\V #\v #\u #\t #\s #\r #\q #\p #\o #\n #\n	#\m #\M #\l #\k #\K #\j #\i #\h #\g #\f #\e #\d #\c #\b #\A #\a))
	(test-t (not (char-not-lessp #\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9)))
	(test-t (char-not-lessp #\9 #\8 #\7 #\6 #\5 #\4 #\3 #\2 #\1 #\0))
	(test-t (char-not-lessp #\9 #\8 #\8 #\8 #\7 #\6 #\5 #\4 #\3 #\3 #\3 #\2 #\1 #\0))
	(test-t (or (char-not-lessp #\A #\9)    (char-not-lessp #\0 #\Z)))
	(test-t (or (char-not-lessp #\a #\9)    (char-not-lessp #\0 #\z)))
	(test-t (char-not-lessp #\c #\b #\a #\a))
	(test-t (not (char-not-lessp #\c #\b #\a #\a #\b #\c)))
	(test-t (not (char-not-lessp #\c #\b #\a #\c)))
	(test-t (not (char-not-lessp #\c #\b #\c #\a)))
	(test-t (char-not-lessp #\9 #\0))
	(test-t (not (char-not-lessp #\0 #\9)))
	(test-t (and (char-not-lessp #\z #\A)     (char-not-lessp #\Z #\a)))
	(test-t (char= (character #\a) #\a))
	(test-t (char= (character #\b) #\b))
;	(test-t (char= (character #\Space) #\Space))
	(test-t (char= (character "a") #\a))
	(test-t (char= (character "X") #\X))
	(test-t (char= (character "z") #\z))
	(test-t (char= (character 'a) #\a))
;	(test-t (char= (character '\a) #\a))
	(test-t (alpha-char-p #\a))
	(test-t (every alpha-char-p '(#\a #\b #\c #\d #\e #\f #\g #\h #\i #\j #\k #\l #\m #\n #\o #\p #\q #\r #\s #\t #\u #\v #\w #\x #\y #\z)))
	(test-t (every alpha-char-p '(#\A #\B #\C #\D #\E #\F #\G #\H #\I #\J #\K #\L #\M #\N #\O #\P #\Q #\R #\S #\T #\U #\V #\W #\X #\Y #\Z)))
	(test-t (notany alpha-char-p '(#\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9)))
;	(test-t (not (alpha-char-p #\Newline)))
	(test-t (alphanumericp #\Z))
	(test-t (alphanumericp #\9))
	(test-t (every alphanumericp '(#\a #\b #\c #\d #\e #\f #\g #\h #\i #\j #\k #\l #\m  #\n #\o #\p #\q #\r #\s #\t #\u #\v #\w #\x #\y #\z)))
	(test-t (every alphanumericp '(#\A #\B #\C #\D #\E #\F #\G #\H #\I #\J #\K #\L #\M  #\N #\O #\P #\Q #\R #\S #\T #\U #\V #\W #\X #\Y #\Z)))
	(test-t (every alphanumericp '(#\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9)))
;	(test-t (not (alphanumericp #\Newline)))
	(test-t (not (alphanumericp #\#)))
	(test-t (char= (digit-char 0) #\0))
;	(test-t (char= (digit-char 10 11) #\A))
	(test-t (null (digit-char 10 10)))
	(test-t (char= (digit-char 7) #\7))
	(test-t (null (digit-char 12)))
;	(test-t (char= (digit-char 12 16) #\C))
	(test-t (null (digit-char 6 2))) 
	(test-t (char= (digit-char 1 2) #\1))
;	(test-t (char= (digit-char 35 36) #\Z))
	(test-t (= (digit-char-p #\0) 0))
	(test-t (= (digit-char-p #\5) 5))
	(test-t (not (digit-char-p #\5 2)))
	(test-t (not (digit-char-p #\A)))
	(test-t (not (digit-char-p #\a)))
;	(test-t (= (digit-char-p #\A 11) 10))
	(test-t (= (digit-char-p #\a 11) 10))
;	(test-t (standard-char-p #\a))
;	(test-t (standard-char-p #\z))
;	(test-t (standard-char-p #\Newline))
;	(test-t (every standard-char-p " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_'abcdefghijklmnopqrstuvwxyz{|}~"))
	(test-t (char= (char-upcase #\a) #\A))
	(test-t (char= (char-upcase #\A) #\A))
	(test-t (char= (char-upcase #\-) #\-))
	(test-t (char= (char-downcase #\A) #\a))
	(test-t (char= (char-downcase #\a) #\a))
	(test-t (char= (char-downcase #\-) #\-))
	(test-t (not (upper-case-p #\a)))
	(test-t (upper-case-p #\A))
	(test-t (not (upper-case-p #\-)))
	(test-t (not (lower-case-p #\A)))
	(test-t (lower-case-p #\a))
	(test-t (not (lower-case-p #\-)))
;	(test-t (char= #\Space (name-char (char-name #\Space))))
;	(test-t (char= #\Newline (name-char (char-name #\Newline))))


	(test-t (simple-string-p ""))
	(test-t (simple-string-p "abc"))
	(test-t (not (simple-string-p 'not-a-string)))
	(test-t (char= (char "abc" 0) #\a))
	(test-t (char= (char "abc" 1) #\b))
	(test-t (char= (char "abc" 2) #\c))
	(test-t (char= (schar "abc" 0) #\a))
	(test-t (char= (schar "abc" 1) #\b))
	(test-t (char= (schar "abc" 2) #\c))
	(test-t (string= (cl-string "") ""))
	(test-t (string= (cl-string "abc") "abc"))
	(test-t (string= (cl-string "a") "a"))
	(test-t (string= (cl-string 'abc) "abc"))
	(test-t (string= (cl-string 'a) "a"))
	(test-t (string= (cl-string #\a) "a"))
	(test-t (string= (cl-string-upcase "abcde") "ABCDE"))
	(test-t (string= (cl-string-upcase "Dr. Livingston, I presume?")	 "DR. LIVINGSTON, I PRESUME?"))
	(test-t (string= (cl-string-upcase "Dr. Livingston, I presume?" :start 6 :end 10)	 "Dr. LiVINGston, I presume?"))
	(test-t (string= (cl-string-upcase 'Kludgy-HASH-Search) "KLUDGY-HASH-SEARCH"))
	(test-t (string= (cl-string-upcase "abcde" :start 2 :end nil) "abCDE"))
	(test-t (string= (cl-string-downcase "Dr. Livingston, I presume?")	 "dr. livingston, i presume?"))
	(test-t (string= (cl-string-downcase 'Kludgy-HASH-Search) "kludgy-hash-search"))
	(test-t (string= (cl-string-downcase "A FOOL" :start 2 :end nil) "A fool"))
	(test-t (string= (string-capitalize "elm 13c arthur;fig don't")	 "Elm 13c Arthur;Fig Don'T"))
	(test-t (string= (string-capitalize " hello ") " Hello "))
	(test-t (string= (string-capitalize  "occlUDeD cASEmenTs FOreSTAll iNADVertent DEFenestraTION") "Occluded Casements Forestall Inadvertent Defenestration"))
	(test-t (string= (string-capitalize 'kludgy-hash-search) "Kludgy-Hash-Search"))
	(test-t (string= (string-capitalize "DON'T!") "Don'T!"))
	(test-t (string= (string-capitalize "pipe 13a, foo16c") "Pipe 13a, Foo16c"))
	(test-t (string= (string-capitalize "a fool" :start 2 :end nil) "a Fool"))
	(test-t (let ((str (copy-seq "0123ABCD890a")))  (and (string= (nstring-downcase str :start 5 :end 7) "0123AbcD890a")       (string= str "0123AbcD890a"))))
	(test-t (let* ((str0 (copy-seq "abcde"))  (str  (nstring-upcase str0)))  (and (eq str0 str)       (string= str "ABCDE"))))
	(test-t (let* ((str0 (copy-seq "Dr. Livingston, I presume?")) (str  (nstring-upcase str0))) (and (eq str0 str) (string= str "DR. LIVINGSTON, I PRESUME?"))))
	(test-t (let* ((str0 (copy-seq "Dr. Livingston, I presume?")) (str  (nstring-upcase str0 :start 6 :end 10))) (and (eq str0 str) (string= str "Dr. LiVINGston, I presume?"))))
	(test-t (let* ((str0 (copy-seq "abcde")) (str (nstring-upcase str0 :start 2 :end nil)))  (string= str "abCDE")))
	(test-t (let* ((str0 (copy-seq "Dr. Livingston, I presume?")) (str  (nstring-downcase str0))) (and (eq str0 str) (string= str "dr. livingston, i presume?"))))
	(test-t (let* ((str0 (copy-seq "ABCDE")) (str (nstring-downcase str0 :start 2 :end nil)))  (string= str "ABcde")))
	(test-t (let* ((str0 (copy-seq "elm 13c arthur;fig don't")) (str  (nstring-capitalize str0))) (and (eq str0 str) (string= str "Elm 13c Arthur;Fig Don'T"))))
	(test-t (let* ((str0 (copy-seq " hello ")) (str  (nstring-capitalize str0)))  (and (eq str0 str) (string= str " Hello "))))
	(test-t (let* ((str0 (copy-seq "occlUDeD cASEmenTs FOreSTAll iNADVertent DEFenestraTION")) (str (nstring-capitalize str0))) (and (eq str0 str) (string= str		"Occluded Casements Forestall Inadvertent Defenestration"))))
	(test-t (let* ((str0 (copy-seq "DON'T!"))  (str  (nstring-capitalize str0))) (and (eq str0 str)  (string= str "Don'T!"))))
	(test-t (let* ((str0 (copy-seq "pipe 13a, foo16c"))       (str  (nstring-capitalize str0)))  (and (eq str0 str)       (string= str "Pipe 13a, Foo16c"))))
	(test-t (let* ((str0 (copy-seq "a fool"))       (str (nstring-capitalize str0 :start 2 :end nil)))  (string= str "a Fool")))
	(test-t (string= (string-trim "abc" "abcaakaaakabcaaa") "kaaak"))
	(test-t (string= (string-trim '(#\space) " garbanzo beans        ") "garbanzo beans"))
	(test-t (string= (string-trim " (*)" " ( *three (silly) words* ) ")	 "three (silly) words"))
	(test-t (string= (string-left-trim "abc" "labcabcabc") "labcabcabc"))
	(test-t (string= (string-left-trim " (*)" " ( *three (silly) words* ) ")	 "three (silly) words* ) "))
	(test-t (string= (string-right-trim " (*)" " ( *three (silly) words* ) ") 	 " ( *three (silly) words"))
	(test-t (string= (string-trim "ABC" "abc") "abc"))
	(test-t (string= (string-trim "AABBCC" "abc") "abc"))
	(test-t (string= (string-trim "" "abc") "abc"))
	(test-t (string= (string-trim "ABC" "") ""))
	(test-t (string= (string-trim "cba" "abc") ""))
	(test-t (string= (string-trim "cba" "abccba") ""))
	(test-t (string= (string-trim "ccbbba" "abccba") ""))
	(test-t (string= (string-trim "cba" "abcxabc") "x"))
	(test-t (string= (string-trim "xyz" "xxyabcxyyz") "abc"))
	(test-t (string= (string-trim "a" #\a) ""))
	(test-t (string= (string-left-trim "ABC" "abc") "abc"))
	(test-t (string= (string-left-trim "" "abc") "abc"))
	(test-t (string= (string-left-trim "ABC" "") ""))
	(test-t (string= (string-left-trim "cba" "abc") ""))
	(test-t (string= (string-left-trim "cba" "abccba") ""))
	(test-t (string= (string-left-trim "cba" "abcxabc") "xabc"))
	(test-t (string= (string-left-trim "xyz" "xxyabcxyz") "abcxyz"))
	(test-t (string= (string-left-trim "a" #\a) ""))
	(test-t (string= (string-right-trim "ABC" "abc") "abc"))
	(test-t (string= (string-right-trim "" "abc") "abc"))
	(test-t (string= (string-right-trim "ABC" "") ""))
	(test-t (string= (string-right-trim "cba" "abc") ""))
	(test-t (string= (string-right-trim "cba" "abccba") ""))
	(test-t (string= (string-right-trim "cba" "abcxabc") "abcx"))
	(test-t (string= (string-right-trim "xyz" "xxyabcxyz") "xxyabc"))
	(test-t (string= (string-right-trim "a" #\a) ""))
	(test-t (string= (cl-string "already a string") "already a string"))
	(test-t (string=  (cl-string #\c) "c"))
	(test-t (string= "foo" "foo"))
	(test-t (not (string= "foo" "Foo")))
	(test-t (not (string= "foo" "bar")))
	(test-t (string= "together" "frog" :start1 1 :end1 3 :start2 2))
	(test-t (string-equal "foo" "Foo"))
	(test-t (string= "abcd" "01234abcd9012" :start2 5 :end2 9))
	(test-t (eql (string< "aaaa" "aaab") 3))
	(test-t (eql (string>= "aaaaa" "aaaa") 4))
	(test-t (eql (string-not-greaterp "Abcde" "abcdE") 5))
	(test-t (eql (string-lessp "012AAAA789" "01aaab6"   :start1 3 :end1 7   :start2 2 :end2 6) 6))
	(test-t (not (string-not-equal "AAAA" "aaaA")))
	(test-t (string= "" ""))
	(test-t (not (string= "abc" "")))
	(test-t (not (string= "" "abc")))
	(test-t (not (string= "A" "a")))
	(test-t (string= "abc" "xyz" :start1 3 :start2 3))
	(test-t (string= "abc" "xyz" :start1 1 :end1 1 :start2 0 :end2 0))
	(test-t (string= "axyza" "xyz" :start1 1 :end1 4))
	(test-t (string= "axyza" "xyz" :start1 1 :end1 4 :start2 0 :end2 nil))
	(test-t (string= "abxyz" "xyabz" :end1 2 :start2 2 :end2 4))
	(test-t (not (string= "love" "hate")))
	(test-t (string= 'love 'love))
	(test-t (not (string= 'love "hate")))
	(test-t (string= #\a #\a))
	(test-t (not (string/= "" "")))
	(test-t (eql (string/= "abc" "") 0))
	(test-t (eql (string/= "" "abc") 0))
	(test-t (eql (string/= "A" "a") 0))
	(test-t (not (string/= "abc" "xyz" :start1 3 :start2 3)))
	(test-t (not (string/= "abc" "xyz" :start1 1 :end1 1 :start2 0 :end2 0)))
	(test-t (not (string/= "axyza" "xyz" :start1 1 :end1 4)))
	(test-t (not (string/= "axyza" "xyz" :start1 1 :end1 4 :start2 0 :end2 nil)))
	(test-t (not (string/= "abxyz" "xyabz" :end1 2 :start2 2 :end2 4)))
	(test-t (eql (string/= "love" "hate") 0))
	(test-t (eql (string/= "love" "loVe") 2))
	(test-t (not (string/= "life" "death" :start1 3 :start2 1 :end2 2)))
	(test-t (eql (string/= "abcxyz" "ABCxyZ" :start1 3 :start2 3) 5))
	(test-t (eql (string/= "abcxyz" "ABCxyZ" :start1 3 :end1 nil :start2 3 :end2 nil) 5))
	(test-t (eql (string/= "abcxyz" "ABCxyZ" :end1 nil :start2 3 :end2 3) 0))
	(test-t (eql (string/= "abc" "abcxyz") 3))
	(test-t (eql (string/= "abcxyz" "abc") 3))
	(test-t (eql (string/= "abcxyz" "") 0))
	(test-t (eql (string/= "AbcDef" "cdef" :start1 2) 3))
	(test-t (eql (string/= "cdef" "AbcDef" :start2 2) 1))
	(test-t (= (string/= 'love "hate") 0))
	(test-t (not (string/= 'love 'love)))
	(test-t (not (string/= #\a #\a)))
	(test-t (= (string/= #\a #\b) 0))
	(test-t (not (string< "" "")))
	(test-t (not (string< "dog" "dog")))
	(test-t (not (string< " " " ")))
	(test-t (not (string< "abc" "")))
	(test-t (eql (string< "" "abc") 0))
	(test-t (eql (string< "ab" "abc") 2))
	(test-t (not (string< "abc" "ab")))
	(test-t (eql (string< "aaa" "aba") 1))
	(test-t (not (string< "aba" "aaa")))
	(test-t (not (string< "my cat food" "your dog food" :start1 6 :start2 8)))
	(test-t (not (string< "cat food 2 dollars" "dog food 3 dollars"	      :start1 3 :end1 9 :start2 3 :end2 9)))
	(test-t (eql (string< "xyzabc" "abcd" :start1 3) 6))
	(test-t (eql (string< "abc" "abc" :end1 1) 1))
	(test-t (eql (string< "xyzabc" "abc" :start1 3 :end1 5) 5))
	(test-t (eql (string< "xyz" "abcxyzXYZ" :start2 3) 3))
	(test-t (not (string< "abc" "abcxyz" :end2 3)))
	(test-t (eql (string< "xyz" "abcxyz" :end1 2 :start2 3) 2))
	(test-t (not (string< "xyzabc" "abcdef" :start1 3 :end2 3)))
	(test-t (eql (string< "aaaa" "z") 0))
	(test-t (eql (string< "pppTTTaTTTqqq" "pTTTxTTT" :start1 3 :start2 1) 6))
	(test-t (eql (string< "pppTTTaTTTqqq" "pTTTxTTT"     :start1 6 :end1 7     :start2 4 :end2 5) 6))
	(test-t (not (string< 'love 'hate)))
	(test-t (= (string< 'peace 'war) 0))
	(test-t (not (string< 'love 'love)))
	(test-t (not (string< #\a #\a)))
	(test-t (= (string< #\a #\b) 0))
	(test-t (not (string> "" "")))
	(test-t (not (string> "dog" "dog")))
	(test-t (not (string> " " " ")))
	(test-t (eql (string> "abc" "") 0))
	(test-t (not (string> "" "abc")))
	(test-t (not (string> "ab" "abc")))
	(test-t (eql (string> "abc" "ab") 2))
	(test-t (eql (string> "aba" "aaa") 1))
	(test-t (not (string> "aaa" "aba")))
	(test-t (not (string> "my cat food" "your dog food" :start1 6 :start2 8)))
	(test-t (not (string> "cat food 2 dollars" "dog food 3 dollars"	     :start1 3 :end1 9 :start2 3 :end2 9)))
	(test-t (eql (string> "xyzabcde" "abcd" :start1 3) 7))
	(test-t (not (string> "abc" "abc" :end1 1)))
	(test-t (eql (string> "xyzabc" "a" :start1 3 :end1 5) 4))
	(test-t (eql (string> "xyzXYZ" "abcxyz" :start2 3) 3))
	(test-t (eql (string> "abcxyz" "abcxyz" :end2 3) 3))
	(test-t (not (string> "xyzXYZ" "abcxyz" :end1 2 :start2 3)))
	(test-t (not (string> "xyzabc" "abcdef" :start1 3 :end2 3)))
	(test-t (eql (string> "z" "aaaa") 0))
	(test-t (eql (string> "pTTTxTTTqqq" "pppTTTaTTT" :start1 1 :start2 3) 4))
	(test-t (eql (string> "pppTTTxTTTqqq" "pTTTaTTT"     :start1 6 :end1 7      :start2 4 :end2 5) 6))
	(test-t (= (string> 'love 'hate) 0))
	(test-t (not (string> 'peace 'war)))
	(test-t (not (string> 'love 'love)))
	(test-t (not (string> #\a #\a)))
	(test-t (not (string> #\a #\b)))
	(test-t (= (string> #\z #\a) 0))
	(test-t (eql (string<= "" "") 0))
	(test-t (eql (string<= "dog" "dog") 3))
	(test-t (eql (string<= " " " ") 1))
	(test-t (not (string<= "abc" "")))
	(test-t (eql (string<= "ab" "abc") 2))
	(test-t (eql (string<= "aaa" "aba") 1))
	(test-t (not (string<= "aba" "aaa")))
	(test-t (eql (string<= "my cat food" "your dog food" :start1 6 :start2 8) 11))
	(test-t (eql (string<= "cat food 2 dollars" "dog food 3 dollars"      :start1 3 :end1 9 :start2 3 :end2 9) 9))
	(test-t (eql (string<= "xyzabc" "abcd" :start1 3) 6))
	(test-t (eql (string<= "abc" "abc" :end1 1) 1))
	(test-t (eql (string<= "xyzabc" "abc" :start1 3 :end1 5) 5))
	(test-t (eql (string<= "xyz" "abcxyzXYZ" :start2 3) 3))
	(test-t (eql (string<= "abc" "abcxyz" :end2 3) 3))
	(test-t (eql (string<= "xyz" "abcxyz" :end1 2 :start2 3) 2))
	(test-t (eql (string<= "xyzabc" "abcdef" :start1 3 :end2 3) 6))
	(test-t (eql (string<= "aaaa" "z") 0))
	(test-t (eql (string<= "pppTTTaTTTqqq" "pTTTxTTT" :start1 3 :start2 1) 6))
	(test-t (eql (string<= "pppTTTaTTTqqq" "pTTTxTTT"      :start1 6 :end1 7     :start2 4 :end2 5) 6))
	(test-t (not (string<= 'love 'hate)))
	(test-t (= (string<= 'peace 'war) 0))
	(test-t (= (string<= 'love 'love) 4))
	(test-t (= (string<= #\a #\a) 1))
	(test-t (= (string<= #\a #\b) 0))
	(test-t (not (string<= #\z #\a)))
	(test-t (eql (string>= "" "") 0))
	(test-t (eql (string>= "dog" "dog") 3))
	(test-t (eql (string>= " " " ") 1))
	(test-t (eql (string>= "abc" "") 0))
	(test-t (not (string>= "" "abc")))
	(test-t (not (string>= "ab" "abc")))
	(test-t (eql (string>= "abc" "ab") 2))
	(test-t (eql (string>= "aba" "aaa") 1))
	(test-t (not (string>= "aaa" "aba")))
	(test-t (eql (string>= "my cat food" "your dog food" :start1 6 :start2 8) 11))
	(test-t (eql (string>= "cat food 2 dollars" "dog food 3 dollars"      :start1 3 :end1 9 :start2 3 :end2 9) 9))
	(test-t (eql (string>= "xyzabcde" "abcd" :start1 3) 7))
	(test-t (not (string>= "abc" "abc" :end1 1)))
	(test-t (eql (string>= "xyzabc" "a" :start1 3 :end1 5) 4))
	(test-t (eql (string>= "xyzXYZ" "abcxyz" :start2 3) 3))
	(test-t (eql (string>= "abcxyz" "abcxyz" :end2 3) 3))
	(test-t (not (string>= "xyzXYZ" "abcxyz" :end1 2 :start2 3)))
	(test-t (eql (string>= "xyzabc" "abcdef" :start1 3 :end2 3) 6))
	(test-t (eql (string>= "z" "aaaa") 0))
	(test-t (eql (string>= "pTTTxTTTqqq" "pppTTTaTTT" :start1 1 :start2 3) 4))
	(test-t (eql (string>= "pppTTTxTTTqqq" "pTTTaTTT"     :start1 6 :end1 7      :start2 4 :end2 5) 6))
	(test-t (= (string>= 'love 'hate) 0))
	(test-t (not (string>= 'peace 'war)))
	(test-t (= (string>= 'love 'love) 4))
	(test-t (= (string>= #\a #\a) 1))
	(test-t (not (string>= #\a #\b)))
	(test-t (= (string>= #\z #\a) 0))
	(test-t (string-equal "" ""))
	(test-t (not (string-equal "abc" "")))
	(test-t (not (string-equal "" "abc")))
	(test-t (string-equal "A" "a"))
	(test-t (string-equal "abc" "xyz" :start1 3 :start2 3))
	(test-t (string-equal "abc" "xyz" :start1 1 :end1 1 :start2 0 :end2 0))
	(test-t (string-equal "axyza" "xyz" :start1 1 :end1 4))
	(test-t (string-equal "axyza" "xyz" :start1 1 :end1 4 :start2 0 :end2 nil))
	(test-t (string-equal "abxyz" "xyabz" :end1 2 :start2 2 :end2 4))
	(test-t (not (string-equal "love" "hate")))
	(test-t (string-equal "xyz" "XYZ"))
	(test-t (not (string-equal 'love 'hate)))
	(test-t (not (string-equal 'peace 'war)))
	(test-t (string-equal 'love 'love))
	(test-t (string-equal #\a #\a))
	(test-t (not (string-equal #\a #\b)))
	(test-t (not (string-equal #\z #\a)))
	(test-t (not (string-not-equal "" "")))
	(test-t (eql (string-not-equal "abc" "") 0))
	(test-t (eql (string-not-equal "" "abc") 0))
	(test-t (not (string-not-equal "A" "a")))
	(test-t (not (string-not-equal "abc" "xyz" :start1 3 :start2 3)))
	(test-t (not (string-not-equal "abc" "xyz" :start1 1 :end1 1 :start2 0 :end2 0)))
	(test-t (not (string-not-equal "axyza" "xyz" :start1 1 :end1 4)))
	(test-t (not (string-not-equal "axyza" "xyz" :start1 1 :end1 4 :start2 0 :end2 nil)))
	(test-t (not (string-not-equal "abxyz" "xyabz" :end1 2 :start2 2 :end2 4)))
	(test-t (eql (string-not-equal "love" "hate") 0))
	(test-t (not (string-not-equal "love" "loVe")))
	(test-t (not (string-not-equal "life" "death" :start1 3 :start2 1 :end2 2)))
	(test-t (not (string-not-equal "abcxyz" "ABCxyZ" :start1 3 :start2 3)))
	(test-t (not (string-not-equal "abcxyz" "ABCxyZ" :start1 3 :end1 nil :start2 3 :end2 nil)))
	(test-t (eql (string-not-equal "abcxyz" "ABCxyZ" :end1 nil :start2 3 :end2 3) 0))
	(test-t (eql (string-not-equal "abc" "abcxyz") 3))
	(test-t (eql (string-not-equal "abcxyz" "abc") 3))
	(test-t (eql (string-not-equal "abcxyz" "") 0))
	(test-t (not (string-not-equal "AbcDef" "cdef" :start1 2)))
	(test-t (not (string-not-equal "cdef" "AbcDef" :start2 2)))
	(test-t (not (string-not-equal "ABC" "abc")))
	(test-t (= (string-not-equal 'love 'hate) 0))
	(test-t (= (string-not-equal 'peace 'war) 0))
	(test-t (not (string-not-equal 'love 'love)))
	(test-t (not (string-not-equal #\a #\a)))
	(test-t (= (string-not-equal #\a #\b) 0))
	(test-t (= (string-not-equal #\z #\a) 0))
	(test-t (not (string-lessp "" "")))
	(test-t (not (string-lessp "dog" "dog")))
	(test-t (not (string-lessp " " " ")))
	(test-t (not (string-lessp "abc" "")))
	(test-t (eql (string-lessp "" "abc") 0))
	(test-t (eql (string-lessp "ab" "abc") 2))
	(test-t (not (string-lessp "abc" "ab")))
	(test-t (eql (string-lessp "aaa" "aba") 1))
	(test-t (not (string-lessp "aba" "aaa")))
	(test-t (not (string-lessp "my cat food" "your dog food" :start1 6 :start2 8)))
	(test-t (not (string-lessp "cat food 2 dollars" "dog food 3 dollars"   :start1 3 :end1 9 :start2 3 :end2 9)))
	(test-t (eql (string-lessp "xyzabc" "abcd" :start1 3) 6))
	(test-t (eql (string-lessp "abc" "abc" :end1 1) 1))
	(test-t (eql (string-lessp "xyzabc" "abc" :start1 3 :end1 5) 5))
	(test-t (eql (string-lessp "xyz" "abcxyzXYZ" :start2 3) 3))
	(test-t (not (string-lessp "abc" "abcxyz" :end2 3)))
	(test-t (eql (string-lessp "xyz" "abcxyz" :end1 2 :start2 3) 2))
	(test-t (not (string-lessp "xyzabc" "abcdef" :start1 3 :end2 3)))
	(test-t (eql (string-lessp "aaaa" "z") 0))
	(test-t (eql (string-lessp "pppTTTaTTTqqq" "pTTTxTTT" :start1 3 :start2 1) 6))
	(test-t (eql (string-lessp "pppTTTaTTTqqq" "pTTTxTTT"   :start1 6 :end1 7   :start2 4 :end2 5) 6))
	(test-t (and (not (string-lessp "abc" "ABC"))     (not (string-lessp "ABC" "abc"))))
	(test-t (not (string-lessp 'love 'hate)))
	(test-t (= (string-lessp 'peace 'war) 0))
	(test-t (not (string-lessp 'love 'love)))
	(test-t (not (string-lessp #\a #\a)))
	(test-t (= (string-lessp #\a #\b) 0))
	(test-t (not (string-lessp #\z #\a)))
	(test-t (not (string-greaterp "" "")))
	(test-t (not (string-greaterp "dog" "dog")))
	(test-t (not (string-greaterp " " " ")))
	(test-t (eql (string-greaterp "abc" "") 0))
	(test-t (not (string-greaterp "" "abc")))
	(test-t (not (string-greaterp "ab" "abc")))
	(test-t (eql (string-greaterp "abc" "ab") 2))
	(test-t (eql (string-greaterp "aba" "aaa") 1))
	(test-t (not (string-greaterp "aaa" "aba")))
	(test-t (not (string-greaterp "my cat food" "your dog food" :start1 6 :start2 8)))
	(test-t (not (string-greaterp "cat food 2 dollars" "dog food 3 dollars"      :start1 3 :end1 9 :start2 3 :end2 9)))
	(test-t (eql (string-greaterp "xyzabcde" "abcd" :start1 3) 7))
	(test-t (not (string-greaterp "abc" "abc" :end1 1)))
	(test-t (eql (string-greaterp "xyzabc" "a" :start1 3 :end1 5) 4))
	(test-t (eql (string-greaterp "xyzXYZ" "abcxyz" :start2 3) 3))
	(test-t (eql (string-greaterp "abcxyz" "abcxyz" :end2 3) 3))
	(test-t (not (string-greaterp "xyzXYZ" "abcxyz" :end1 2 :start2 3)))
	(test-t (not (string-greaterp "xyzabc" "abcdef" :start1 3 :end2 3)))
	(test-t (eql (string-greaterp "z" "aaaa") 0))
	(test-t (eql (string-greaterp "pTTTxTTTqqq" "pppTTTaTTT" :start1 1 :start2 3) 4))
	(test-t (eql (string-greaterp "pppTTTxTTTqqq" "pTTTaTTT"     :start1 6 :end1 7	     :start2 4 :end2 5) 6))
	(test-t (and (not (string-greaterp "abc" "ABC"))     (not (string-greaterp "ABC" "abc"))))
	(test-t (= (string-greaterp 'love 'hate) 0))
	(test-t (not (string-greaterp 'peace 'war)))
	(test-t (not (string-greaterp 'love 'love)))
	(test-t (not (string-greaterp #\a #\a)))
	(test-t (not (string-greaterp #\a #\b)))
	(test-t (= (string-greaterp #\z #\a) 0))
	(test-t (eql (string-not-greaterp "" "") 0))
	(test-t (eql (string-not-greaterp "dog" "dog") 3))
	(test-t (eql (string-not-greaterp " " " ") 1))
	(test-t (not (string-not-greaterp "abc" "")))
	(test-t (eql (string-not-greaterp "ab" "abc") 2))
	(test-t (eql (string-not-greaterp "aaa" "aba") 1))
	(test-t (not (string-not-greaterp "aba" "aaa")))
	(test-t (eql (string-not-greaterp "my cat food" "your dog food" :start1 6 :start2 8) 11))
	(test-t (eql (string-not-greaterp "cat food 2 dollars" "dog food 3 dollars"  :start1 3 :end1 9 :start2 3 :end2 9) 9))
	(test-t (eql (string-not-greaterp "xyzabc" "abcd" :start1 3) 6))
	(test-t (eql (string-not-greaterp "abc" "abc" :end1 1) 1))
	(test-t (eql (string-not-greaterp "xyzabc" "abc" :start1 3 :end1 5) 5))
	(test-t (eql (string-not-greaterp "xyz" "abcxyzXYZ" :start2 3) 3))
	(test-t (eql (string-not-greaterp "abc" "abcxyz" :end2 3) 3))
	(test-t (eql (string-not-greaterp "xyz" "abcxyz" :end1 2 :start2 3) 2))
	(test-t (eql (string-not-greaterp "xyzabc" "abcdef" :start1 3 :end2 3) 6))
	(test-t (eql (string-not-greaterp "aaaa" "z") 0))
	(test-t (eql (string-not-greaterp "pppTTTaTTTqqq" "pTTTxTTT" :start1 3 :start2 1) 6))
	(test-t (eql (string-not-greaterp "pppTTTaTTTqqq" "pTTTxTTT"  :start1 6 :end1 7	  :start2 4 :end2 5) 6))
	(test-t (and (eql (string-not-greaterp "abc" "ABC") 3)    (eql (string-not-greaterp "ABC" "abc") 3)))
	(test-t (not (string-not-greaterp 'love 'hate)))
	(test-t (= (string-not-greaterp 'peace 'war) 0))
	(test-t (= (string-not-greaterp 'love 'love) 4))
	(test-t (= (string-not-greaterp #\a #\a) 1))
	(test-t (= (string-not-greaterp #\a #\b) 0))
	(test-t (not (string-not-greaterp #\z #\a)))
	(test-t (eql (string-not-lessp "" "") 0))
	(test-t (eql (string-not-lessp "dog" "dog") 3))
	(test-t (eql (string-not-lessp " " " ") 1))
	(test-t (eql (string-not-lessp "abc" "") 0))
	(test-t (not (string-not-lessp "" "abc")))
	(test-t (not (string-not-lessp "ab" "abc")))
	(test-t (eql (string-not-lessp "abc" "ab") 2))
	(test-t (eql (string-not-lessp "aba" "aaa") 1))
	(test-t (not (string-not-lessp "aaa" "aba")))
	(test-t (eql (string-not-lessp "my cat food" "your dog food" :start1 6 :start2 8) 11))
	(test-t (eql (string-not-lessp "cat food 2 dollars" "dog food 3 dollars"  :start1 3 :end1 9 :start2 3 :end2 9) 9))
	(test-t (eql (string-not-lessp "xyzabcde" "abcd" :start1 3) 7))
	(test-t (not (string-not-lessp "abc" "abc" :end1 1)))
	(test-t (eql (string-not-lessp "xyzabc" "a" :start1 3 :end1 5) 4))
	(test-t (eql (string-not-lessp "xyzXYZ" "abcxyz" :start2 3) 3))
	(test-t (eql (string-not-lessp "abcxyz" "abcxyz" :end2 3) 3))
	(test-t (not (string-not-lessp "xyzXYZ" "abcxyz" :end1 2 :start2 3)))
	(test-t (eql (string-not-lessp "xyzabc" "abcdef" :start1 3 :end2 3) 6))
	(test-t (eql (string-not-lessp "z" "aaaa") 0))
	(test-t (eql (string-not-lessp "pTTTxTTTqqq" "pppTTTaTTT" :start1 1 :start2 3) 4))
	(test-t (eql (string-not-lessp "pppTTTxTTTqqq" "pTTTaTTT"       :start1 6 :end1 7       :start2 4 :end2 5) 6))
	(test-t (and (eql (string-not-lessp "abc" "ABC") 3)    (eql (string-not-lessp "ABC" "abc") 3)))
	(test-t (= (string-not-lessp 'love 'hate) 0))
	(test-t (not (string-not-lessp 'peace 'war)))
	(test-t (= (string-not-lessp 'love 'love) 4))
	(test-t (= (string-not-lessp #\a #\a) 1))
	(test-t (not (string-not-lessp #\a #\b)))
	(test-t (= (string-not-lessp #\z #\a) 0))
	(test-t (stringp "aaaaaa"))
	(test-t (not (stringp #\a)))
	(test-t (not (stringp 'a)))
	(test-t (not (stringp '(string))))
	(test-t (string= (cl-make-string 3 :initial-element #\a) "aaa"))
	(test-t (string= (cl-make-string 1 :initial-element #\space) " "))
	(test-t (string= (cl-make-string 0) ""))
	
	(test-t (dotimes (i 10)))
	(test-t (= (dotimes (temp-one 10 temp-one)) 10))
	(test-t (let ((temp-two 0)) (and (eq t (dotimes (temp-one 10 t) (incf temp-two)))  (eql temp-two 10))))
	(test-t (let ((count 0))  (eql (dotimes (i 5 count) (incf count)) 5)))
	(test-t (let ((count 0))  (eql (dotimes (i 1 count) (incf count)) 1)))
	(test-t (let ((count 0))  (zerop (dotimes (i 0 count) (incf count)))))
	(test-t (let ((count 0))  (zerop (dotimes (i -1 count) (incf count)))))
	(test-t (let ((count 0))  (zerop (dotimes (i -100 count) (incf count)))))
	(test-t (eql (dotimes (i 3 i)) 3))
	(test-t (eql (dotimes (i 2 i)) 2))
	(test-t (eql (dotimes (i 1 i)) 1))
	(test-t (eql (dotimes (i 0 i)) 0))
	(test-t (eql (dotimes (i -1 i)) 0))
	(test-t (eql (dotimes (i -2 i)) 0))
	(test-t (eql (dotimes (i -10 i)) 0))
	(test-t (let ((list nil))  (and (eq (dotimes (i 10 t) (push i list)) t)       (equal list '(9 8 7 6 5 4 3 2 1 0)))))
	(test-t (let ((list nil))  (equal (dotimes (i 10 (push i list)) (push i list))	 '(10 9 8 7 6 5 4 3 2 1 0))))
	(test-t (let ((list nil))  (equal (dotimes (i '10 (push i list)) (push i list))	 '(10 9 8 7 6 5 4 3 2 1 0))))
	(test-t (let ((list nil))  (equal (dotimes (i (/ 100 10) (push i list)) (push i list))	 '(10 9 8 7 6 5 4 3 2 1 0))))
	(test-t (= 3 (let ((i 3)) (dotimes (i i i) ))))
	(test-t (= 3 (let ((x 0)) (dotimes (i 3 x) (incf x)))))
	(test-t (= 3 (dotimes (i 3 i) )))
	(test-t (= 3 (let ((x 0)) (dotimes (i 3 x) (declare (fixnum i)) (incf x)))))
	(test-t (dolist (x ())))
	(test-t (dolist (x '(a))))
	(test-t (eq t (dolist (x nil t))))
	(test-t (= 6 (let ((sum 0))       (dolist (x '(0 1 2 3) sum)	 (incf sum x)))))
	(test-t (let ((temp-two ()))  (equal (dolist (temp-one '(1 2 3 4) temp-two) (push temp-one temp-two))	 '(4 3 2 1))))
	(test-t (let ((temp-two 0))  (and (dolist (temp-one '(1 2 3 4)) (incf temp-two)) (eql temp-two 4))))
	(test-t (not (dolist (var nil var))))
	(test-t (let ((list nil))  (equal (dolist (var '(0 1 2 3) list)	   (push var list))	 '(3 2 1 0))))
	(test-t (dolist (var '(0 1 2 3))))
	(test-t (eql (do ((temp-one 1 (1+ temp-one))	  (temp-two 0 (1- temp-two)))	 ((> (- temp-one temp-two) 5) temp-one))     4))
	(test-t (eql (do ((temp-one 1 (1+ temp-one))	  (temp-two 0 (1+ temp-one)))     	 ((= 3 temp-two) temp-one))     3))
	(test-t (eql (do* ((temp-one 1 (1+ temp-one))	   (temp-two 0 (1+ temp-one)))	 ((= 3 temp-two) temp-one))     2))
	
	(test-t (let ((a-vector (vector 1 nil 3 nil)))
		  (do ((i 0 (+ i 1))
		       (n (array-dimension a-vector 0)))
		      ((= i n))
		    (when (null (aref a-vector i))
			  (setf (aref a-vector i) 0)))
		  (equalp a-vector #(1 0 3 0))))
	
	(test-t (let ((vec (vector 0 1 2 3 4 5 6 7 8 9)))
		  (equalp (do ((i 0 (1+ i))
			       (n #f)
			       (j 9 (1- j)))
			      ((>= i j) vec)
			    (setq n (aref vec i))
			    (setf (aref vec i) (aref vec j))
			    (setf (aref vec j) n))
			  #(9 8 7 6 5 4 3 2 1 0))))
	
	(test-t (let ((vec (vector 0 1 2 3 4 5 6 7 8 9)))
		  (and (do ((i 0 (1+ i))
			    (n #f)
			    (j 9 (1- j)))
			   ((>= i j))
			 (setq n (aref vec i))
			 (setf (aref vec i) (aref vec j))
			 (setf (aref vec j) n))
		       (equalp vec #(9 8 7 6 5 4 3 2 1 0)))))
	
	(test-t (let ((vec (vector 0 1 2 3 4 5 6 7 8 9)))
		  (and (do ((i 0 (1+ i))
			    (n #f)
			    (j 9 (1- j)))
			   ((>= i j))
			 (setq n (aref vec i))
			 (setf (aref vec i) (aref vec j))
			 (setf (aref vec j) n))
		       (equalp vec #(9 8 7 6 5 4 3 2 1 0)))))
	
	(test-t (let ((vec (vector 0 1 2 3 4 5 6 7 8 9)))
		  (and (do ((i 0 (1+ i))
			    (n #f)
			    (j 9 (1- j)))
			   ((>= i j))
			 (setq n (aref vec i))
			 (setf (aref vec i) (aref vec j))
			 (setf (aref vec j) n))
		       (equalp vec #(9 8 7 6 5 4 3 2 1 0)))))
	
	(test-t (let ((vec (vector 0 1 2 3 4 5 6 7 8 9)))
		  (and (do ((n #f)
			    (i 0 (1+ i))
			    (j 9 (1- j)))
			   ((>= i j))
			 (setq n (aref vec i))
			 (setf (aref vec i) (aref vec j))
			 (setf (aref vec j) n))
		       (equalp vec #(9 8 7 6 5 4 3 2 1 0)))))
	
	(test-t (let ((vec (vector 0 1 2 3 4 5 6 7 8 9)))
		  (and (do ((i 0 (1+ i))
			    (j 9 (1- j))
			    (n #f))
			   ((>= i j))
			 (setq n (aref vec i))
			 (setf (aref vec i) (aref vec j))
			 (setf (aref vec j) n))
		       (equalp vec #(9 8 7 6 5 4 3 2 1 0)))))
	
	(test-t (= (funcall (lambda (x) (+ x 3)) 4) 7))
	(test-t (= (funcall (lambda args (apply + args)) 1 2 3 4) 10))
	(test-t (functionp (lambda args (apply + args))))
	
	(test-t (consp (cons 'a 'b)))
	(test-t (consp '(1 . 2)))
	(test-t (consp (list nil)))
	(test-t (not (consp 'a)))
	(test-t (not (consp nil)))
	(test-t (not (consp 1)))
	(test-t (not (consp #\a)))
	(test-t (let ((a (cons 1 2))) (and (eql (car a) 1) (eql (cdr a) 2))))
	(test-t (equal (cons 1 nil) '(1)))
	(test-t (equal (cons nil nil) '(())))
	(test-t (equal (cons 'a (cons 'b (cons 'c ()))) '(a b c)))
	(test-t (atom 'a))
	(test-t (atom nil))
	(test-t (atom 1))
	(test-t (atom #\a))
	(test-t (not (atom (cons 1 2))))
	(test-t (not (atom '(a . b))))
	(test-t (not (atom (list nil))))
	(test-t (listp nil))
	(test-t (listp '(a b c)))
	(test-t (listp '(a . b)))
	(test-t (listp (cons 'a 'b)))
	(test-t (not (listp 1)))
	(test-t (not (listp 't)))
	(test-t (null ()))
	(test-t (null nil))
	(test-t (not (null t)))
	(test-t (null (cdr '(a))))
	(test-t (not (null (cdr '(1 . 2)))))
	(test-t (not (null 'a)))
	(test-t (endp ()))
	(test-t (not (endp '(1))))
	(test-t (not (endp '(1 2))))
	(test-t (not (endp '(1 2 3))))
	(test-t (not (endp (cons 1 2))))
	(test-t (endp (cddr '(1 2))))
	(test-t (let ((a (cons 1 2))) (and (eq (rplaca a 0) a) (equal a '(0 . 2)))))
	(test-t (let ((a (list 1 2 3))) (and (eq (rplaca a 0) a) (equal a '(0 2 3)))))
	(test-t (let ((a (cons 1 2))) (and (eq (rplacd a 0) a) (equal a '(1 . 0)))))
	(test-t (let ((a (list 1 2 3))) (and (eq (rplacd a 0) a) (equal a '(1 . 0)))))
	(test-t (eq (car '(a . b)) 'a))
	(test-t (let ((a (cons 1 2))) (eq (car (list a)) a)))
	(test-t (eq (cdr '(a . b)) 'b))
	(test-t (eq (rest '(a . b)) 'b))
	(test-t (let ((a (cons 1 2))) (eq (cdr (cons 1 a)) a)))
	(test-t (let ((a (cons 1 2))) (eq (rest (cons 1 a)) a)))
	(test-t (eq (caar '((a) b c)) 'a))
	(test-t (eq (cadr '(a b c)) 'b))
	(test-t (eq (cdar '((a . aa) b c)) 'aa))
	(test-t (eq (cddr '(a b . c)) 'c))
	(test-t (eq (caaar '(((a)) b c)) 'a))
	(test-t (eq (caadr '(a (b) c)) 'b))
	(test-t (eq (cadar '((a aa) b c)) 'aa))
	(test-t (eq (caddr '(a b c)) 'c))
	(test-t (eq (cdaar '(((a . aa)) b c)) 'aa))
	(test-t (eq (cdadr '(a (b . bb) c)) 'bb))
	(test-t (eq (cddar '((a aa . aaa) b c)) 'aaa))
	(test-t (eq (cdddr '(a b c . d)) 'd))
	(test-t (eq (caaaar '((((a))) b c)) 'a))
	(test-t (eq (caaadr '(a ((b)) c)) 'b))
	(test-t (eq (caadar '((a (aa)) b c)) 'aa))
	(test-t (eq (caaddr '(a b (c))) 'c))
	(test-t (eq (cadaar '(((a aa)) b c)) 'aa))
	(test-t (eq (cadadr '(a (b bb) c)) 'bb))
	(test-t (eq (caddar '((a aa aaa) b c)) 'aaa))
	(test-t (eq (cadddr '(a b c d)) 'd))
	(test-t (eq (cdaaar '((((a . aa))) b c)) 'aa))
	(test-t (eq (cdaadr '(a ((b . bb)) c)) 'bb))
	(test-t (eq (cdadar '((a (aa . aaa)) b c)) 'aaa))
	(test-t (eq (cdaddr '(a b (c . cc))) 'cc))
	(test-t (eq (cddaar '(((a aa . aaa)) b c)) 'aaa))
	(test-t (eq (cddadr '(a (b bb . bbb) c)) 'bbb))
	(test-t (eq (cdddar '((a aa aaa . aaaa) b c)) 'aaaa))
	(test-t (eq (cddddr '(a b c d . e)) 'e))
	(test-t (eq (copy-tree nil) nil))
	(test-t (let* ((a (list 'a))
		       (b (list 'b))
		       (c (list 'c))
		       (x3 (cons c nil))
		       (x2 (cons b x3))
		       (x (cons a x2))
		       (y (copy-tree x)))
		  (and (not (eq x y))
		       (not (eq (car x) (car y)))
		       (not (eq (cdr x) (cdr y)))
		       (not (eq (cadr x) (cadr y)))
		       (not (eq (cddr x) (cddr y)))
		       (not (eq (caddr x) (caddr y)))
		       (eq (cdddr x) (cdddr y))
		       (equal x y)
		       (eq (car x) a) (eq (car a) 'a) (eq (cdr a) nil)
		       (eq (cdr x) x2)
		       (eq (car x2) b) (eq (car b) 'b) (eq (cdr b) nil)
		       (eq (cdr x2) x3)
		       (eq (car x3) c) (eq (car c) 'c) (eq (cdr c) nil)
		       (eq (cdr x3) nil))))
	(test-t (let* ((x (list (list 'a 1) (list 'b 2) (list 'c 3)))
		       (y (copy-tree x)))
		  (and (not (eq (car x) (car y)))
		       (not (eq (cadr x) (cadr y)))
		       (not (eq (caddr x) (caddr y))))))
	(test-t (let* ((x (list (list (list 1))))
		       (y (copy-tree x)))
		  (and (not (eq x y))
		       (not (eq (car x) (car y)))
		       (not (eq (caar x) (caar y))))))
	(test-t (let ((x (list 'a 'b 'c 'd)))
		  (and (equal (sublis '((a . 1) (b . 2) (c . 3)) x)
			      '(1 2 3 d))
		       (equal x '(a b c d)))))
	(test-t (eq (sublis () ()) ()))
	(test-t (equal (sublis () '(1 2 3)) '(1 2 3)))
	(test-t (eq (sublis '((a . 1) (b . 2)) ()) nil))
	(test-t (equal (sublis '((a . 1) (b . 2) (c . 3)) '(((a)) (b) c)) '(((1)) (2) 3)))
	(test-t (equal (sublis '(((a) . 1) ((b) . 2) ((c) . 3)) '((((a))) ((b)) (c))) '((((a))) ((b)) (c))))
	(test-t (equal (sublis '(((a) . 1) ((b) . 2) ((c) . 3)) '((((a))) ((b)) (c)) :test equal) '(((1)) (2) 3)))
	(test-t (equal (nsublis '((a . 1) (b . 2) (c . 3)) (list 'a 'b 'c 'd)) '(1 2 3 d)))
	(test-t (let* ((x (list 'a 'b 'c 'd)) (y (nsublis '((a . 1) (b . 2) (c . 3)) x))) (and (eq x y) (equal x '(1 2 3 d)))))
	(test-t (let ((x (list 'l 'm 'n))) (and (eq (nsublis '((a . 1) (b . 2) (c . 3)) x) x) (equal x '(l m n)))))
	(test-t (let* ((n (cons 'n nil))
		       (m (cons 'm n))
		       (l (cons 'l m))
		       (x (nsublis '((a . 1) (b . 2) (c . 3)) l)))
		  (and (eq x l)
		       (eq (car l) 'l)
		       (eq (cdr l) m)
		       (eq (car m) 'm)
		       (eq (cdr m) n)
		       (eq (car n) 'n)
		       (eq (cdr n) nil))))
	(test-t (eq (nsublis () ()) ()))
	(test-t (equal (nsublis () '(1 2 3)) '(1 2 3)))
	(test-t (eq (nsublis '((a . 1) (b . 2)) ()) nil))
	(test-t (equal (nsublis '((a b c) (b c d) (c d e)) (list 'a 'b 'c)) '((b c) (c d) (d e))))
	(test-t (equal (nsublis '((a . 1) (b . 2) (c . 3)) (copy-tree '(((a)) (b) c))) '(((1)) (2) 3)))
	(test-t (equal (nsublis '(((a) . 1) ((b) . 2) ((c) . 3)) (copy-tree '((((a))) ((b)) (c)))) '((((a))) ((b)) (c))))
	(test-t (equal (nsublis '(((a) . 1) ((b) . 2) ((c) . 3)) (copy-tree '((((a))) ((b)) (c))) :test equal) '(((1)) (2) 3)))
	(test-t (tree-equal 'a 'a))
	(test-t (not (tree-equal 'a 'b)))
	(test-t (tree-equal '(a (b (c))) '(a (b (c)))))
	(test-t (tree-equal '(a (b (c))) '(a (b (c))) :test eq))
	(test-t (not (tree-equal '("a" ("b" ("c"))) '("a" ("b" ("c"))))))
	(test-t (tree-equal '("a" ("b" ("c"))) '("a" ("b" ("c"))) :test equal))
	(test-t (not (tree-equal '(a b) '(a (b)))))
	(test-t (eq (copy-list ()) ()))
	(test-t (equal (copy-list '(a b c)) '(a b c)))
	(test-t (equal (copy-list '(a . b)) '(a . b)))
	(test-t (let* ((x '(a b c)) (y (copy-list x))) (and (equal x y) (not (eq x y)))))
	(test-t (let* ((a (list 'a))
		       (b (list 'b))
		       (c (list 'c))
		       (x (list a b c))
		       (y (copy-list x)))
		  (and (equal x y)
		       (not (eq x y))
		       (eq (car x) (car y))
		       (eq (cadr x) (cadr y))
		       (eq (caddr x) (caddr y))
		       (eq (caar x) 'a)
		       (eq (caadr x) 'b)
		       (eq (caaddr x) 'c))))
	(test-t (null (list)))
	(test-t (equal (list 1) '(1)))
	(test-t (equal (list 1 2 3) '(1 2 3)))
	(test-t (equal (list* 1 2 '(3)) '(1 2 3)))
	(test-t (equal (list* 1 2 'x) '(1 2 . x)))
	(test-t (equal (list* 1 2 '(3 4)) '(1 2 3 4)))
	(test-t (eq (list* 'x) 'x))
	(test-t (eql (list-length ()) 0))
	(test-t (eql (list-length '(1)) 1))
	(test-t (eql (list-length '(1 2)) 2))
	(test-t (equal (cl-make-list 5) '(() () () () ())))
	(test-t (equal (cl-make-list 3 :initial-element 'rah) '(rah rah rah)))
	(test-t (equal (cl-make-list 2 :initial-element '(1 2 3)) '((1 2 3) (1 2 3))))
	(test-t (null (cl-make-list 0)))
	(test-t (null (cl-make-list 0 :initial-element 'new-element)))
	(test-t (let ((place nil)) (and (equal (push 0 place) '(0)) (equal place '(0)))))
	(test-t (let ((place (list 1 2 3))) (and (equal (push 0 place) '(0 1 2 3)) (equal place '(0 1 2 3)))))
	(test-t (let ((a (list (list 1 2 3) 9))) (and (equal (push 0 (car a)) '(0 1 2 3)) (equal a '((0 1 2 3) 9)))))
	(test-t (let ((place (list 1 2 3))) (and (eql (pop place) 1) (equal place '(2 3)))))
	(test-t (let ((a (list (list 1 2 3) 9))) (and (eql (pop (car a)) 1) (equal a '((2 3) 9)))))
	(test-t (let ((x (list 'a 'b 'c))) (and (eq (pop (cdr x)) 'b) (equal x '(a c)))))
	(test-t (eq (first '(a . b)) 'a))
	(test-t (null (first nil)))
	(test-t (let ((a (cons 1 2))) (eq (first (list a)) a)))
	(test-t (eql (first '(1 2 3)) '1))
	(test-t (eql (second '(1 2 3)) '2))
	(test-t (eql (third '(1 2 3)) '3))
	(test-t (eql (fourth '(1 2 3 4)) '4))
	(test-t (eql (fifth '(1 2 3 4 5)) '5))
	(test-t (eql (sixth '(1 2 3 4 5 6)) '6))
	(test-t (eql (seventh '(1 2 3 4 5 6 7)) '7))
	(test-t (eql (eighth '(1 2 3 4 5 6 7 8)) '8))
	(test-t (eql (ninth '(1 2 3 4 5 6 7 8 9)) '9))
	(test-t (eql (tenth '(1 2 3 4 5 6 7 8 9 10)) '10))
	(test-t (let ((x '(a b c))) (eq (nthcdr 0 x) x)))
	(test-t (let ((x '(a b c))) (eq (nthcdr 1 x) (cdr x))))
	(test-t (let ((x '(a b c))) (eq (nthcdr 2 x) (cddr x))))
	(test-t (let ((x '(a b c))) (eq (nthcdr 2 x) (cddr x))))
	(test-t (let ((x '(a b c))) (eq (nthcdr 3 x) (cdddr x))))
	(test-t (equal (nthcdr 0 '(0 1 2)) '(0 1 2)))
	(test-t (equal (nthcdr 1 '(0 1 2)) '(1 2)))
	(test-t (equal (nthcdr 2 '(0 1 2)) '(2)))
	(test-t (equal (nthcdr 3 '(0 1 2)) ()))
	(test-t (eql (nthcdr 1 '(0 . 1)) 1))
	(test-t (eql (nth 0 '(a b c)) 'a))
	(test-t (eql (nth 1 '(a b c)) 'b))
	(test-t (eql (nth 2 '(a b c)) 'c))
	(test-t (eql (nth 3 '(a b c)) ()))
	(test-t (eql (nth 4 '(a b c)) ()))
	(test-t (eql (nth 5 '(a b c)) ()))
	(test-t (eql (nth 6 '(a b c)) ()))
	(test-t (let ((x (list 'a 'b 'c))) (and (eq (setf (nth 0 x) 'z) 'z) (equal x '(z b c)))))
	(test-t (let ((x (list 'a 'b 'c))) (and (eq (setf (nth 1 x) 'z) 'z) (equal x '(a z c)))))
	(test-t (let ((x (list 'a 'b 'c))) (and (eq (setf (nth 2 x) 'z) 'z) (equal x '(a b z)))))
	(test-t (let ((0-to-3 (list 0 1 2 3))) (and (equal (setf (nth 2 0-to-3) "two") "two") (equal 0-to-3 '(0 1 "two" 3)))))
	(test-t (let* ((x (list 'a 'b 'c))) (eq (nconc x) x)))
	(test-t (let* ((x (list 'a 'b 'c))
		       (y (list 'd 'e 'f))
		       (list (nconc x y)))
		  (and (eq list x)
		       (eq (nthcdr 3 list) y)
		       (equal list '(a b c d e f)))))
	(test-t (let* ((x (list 'a))
		       (y (list 'b))
		       (z (list 'c))
		       (list (nconc x y z)))
		  (and (eq x list)
		       (eq (first list) 'a)
		       (eq y (cdr list))
		       (eq (second list) 'b)
		       (eq z (cddr list))
		       (eq (third list) 'c))))
	(test-t (equal (append '(a b) () '(c d) '(e f)) '(a b c d e f)))
	(test-t (null (append)))
	(test-t (null (append ())))
	(test-t (null (append () ())))
	(test-t (eq (append 'a) 'a))
	(test-t (eq (append () 'a) 'a))
	(test-t (eq (append () () 'a) 'a))
	(test-t (equal (append '(a b) 'c) '(a b . c)))
	(test-t (let* ((x '(a b c))
		       (y '(d e f))
		       (z (append x y)))
		  (and (equal z '(a b c d e f))
		       (eq (nthcdr 3 z) y)
		       (not (eq x z)))))
	(test-t (equal (revappend '(a b c) '(d e f)) '(c b a d e f)))
	(test-t (let* ((x '(a b c))
		       (y '(d e f))
		       (z (revappend x y)))
		  (and (equal z '(c b a d e f))
		       (not (eq x z))
		       (eq (nthcdr 3 z) y))))
	(test-t (let ((x '(a b c))) (eq (revappend () x) x)))
	(test-t (null (revappend () ())))
	(test-t (eq (revappend () 'a) 'a))
	(test-t (equal (revappend '(a) 'b) '(a . b)))
	(test-t (equal (revappend '(a) ()) '(a)))
	(test-t (equal (revappend '(1 2 3) ()) '(3 2 1)))
	(test-t (equal (nreconc (list 'a 'b 'c) '(d e f)) '(c b a d e f)))
	(test-t (let* ((x (list 'a 'b 'c))
		       (y '(d e f))
		       (z (nreconc x y)))
		  (and (equal z '(c b a d e f))
		       (eq (nthcdr 3 z) y))))
	(test-t (equal (nreconc (list 'a) 'b) '(a . b)))
	(test-t (equal (nreconc (list 'a) ()) '(a)))
	(test-t (equal (nreconc (list 1 2 3) ()) '(3 2 1)))
	(test-t (null (butlast nil)))
	(test-t (null (butlast nil 1)))
	(test-t (null (butlast nil 2)))
	(test-t (null (butlast nil 3)))
	(test-t (equal (butlast '(1 2 3 4 5)) '(1 2 3 4)))
	(test-t (equal (butlast '(1 2 3 4 5) 1) '(1 2 3 4)))
	(test-t (equal (butlast '(1 2 3 4 5) 2) '(1 2 3)))
	(test-t (equal (butlast '(1 2 3 4 5) 3) '(1 2)))
	(test-t (equal (butlast '(1 2 3 4 5) 4) '(1)))
	(test-t (equal (butlast '(1 2 3 4 5) 5) ()))
	(test-t (equal (butlast '(1 2 3 4 5) 6) ()))
	(test-t (equal (butlast '(1 2 3 4 5) 7) ()))
	(test-t (let ((a '(1 2 3 4 5))) (equal (butlast a 3) '(1 2)) (equal a '(1 2 3 4 5))))
	(test-t (null (nbutlast nil)))
	(test-t (null (nbutlast nil 1)))
	(test-t (null (nbutlast nil 2)))
	(test-t (null (nbutlast nil 3)))
	(test-t (equal (nbutlast (list 1 2 3 4 5)) '(1 2 3 4)))
	(test-t (equal (nbutlast (list 1 2 3 4 5) 1) '(1 2 3 4)))
	(test-t (equal (nbutlast (list 1 2 3 4 5) 2) '(1 2 3)))
	(test-t (equal (nbutlast (list 1 2 3 4 5) 3) '(1 2)))
	(test-t (equal (nbutlast (list 1 2 3 4 5) 4) '(1)))
	(test-t (equal (nbutlast (list 1 2 3 4 5) 5) ()))
	(test-t (equal (nbutlast (list 1 2 3 4 5) 6) ()))
	(test-t (equal (nbutlast (list 1 2 3 4 5) 7) ()))
	(test-t (equal (nbutlast (list* 1 2 3 4 5 6)) '(1 2 3 4)))
	(test-t (equal (nbutlast (list* 1 2 3 4 5 6) 1) '(1 2 3 4)))
	(test-t (equal (nbutlast (list* 1 2 3 4 5 6) 2) '(1 2 3)))
	(test-t (equal (nbutlast (list* 1 2 3 4 5 6) 3) '(1 2)))
	(test-t (equal (nbutlast (list* 1 2 3 4 5 6) 4) '(1)))
	(test-t (equal (nbutlast (list* 1 2 3 4 5 6) 5) ()))
	(test-t (equal (nbutlast (list* 1 2 3 4 5 6) 6) ()))
	(test-t (equal (nbutlast (list* 1 2 3 4 5 6) 7) ()))
	(test-t (let* ((a '(1 2 3 4 5)) (b (nbutlast a 3))) (and (eq a b) (equal a '(1 2)))))
	(test-t (let ((x '(0 1 2 3 4 5 6 7 8 9))) (eq (last x) (nthcdr 9 x))))
	(test-t (let ((x '(0 1 2 3 4))) (eq (last x 0) nil)))
	(test-t (let ((x '(0 1 2 3 4))) (eq (last x) (nthcdr 4 x))))
	(test-t (let ((x '(0 1 2 3 4))) (eq (last x 1) (nthcdr 4 x))))
	(test-t (let ((x '(0 1 2 3 4))) (eq (last x 2) (cdddr x))))
	(test-t (let ((x '(0 1 2 3 4))) (eq (last x 3) (cddr x))))
	(test-t (let ((x '(0 1 2 3 4))) (eq (last x 4) (cdr x))))
	(test-t (let ((x '(0 1 2 3 4))) (eq (last x 5) x)))
	(test-t (let ((x '(0 1 2 3 4))) (eq (last x 6) x)))
	(test-t (let ((x '(0 1 2 3 4))) (eq (last x 7) x)))
	(test-t (let ((x '(0 1 2 3 4))) (eq (last x 8) x)))
	(test-t (tailp () ()))
	(test-t (tailp () '(1)))
	(test-t (tailp () '(1 2 3 4 5 6 7 8 9)))
	(test-t (let ((x '(1 2 3))) (and (tailp x x) (tailp (cdr x) x) (tailp (cddr x) x) (tailp (cdddr x) x))))
	(test-t (let ((x '(1 . 2))) (and (tailp x x) (tailp (cdr x) x))))
	(test-t (not (tailp 'x '(1 2 3 4 5 6))))
	(test-t (not (tailp (list 1 2 3) '(1 2 3))))
	(test-t (define (ldiff . args) #f))
	(test-t (null (ldiff () ())))
	(test-t (equal (ldiff '(1 . 2) 2) '(1)))
	(test-t (equal (ldiff '(1 2 3 4 5 6 7 8 9) ()) '(1 2 3 4 5 6 7 8 9)))
	(test-t (let ((x '(1 2 3)))
		  (and (null (ldiff x x))
		       (equal (ldiff x (cdr x)) '(1))
		       (equal (ldiff x (cddr x)) '(1 2))
		       (equal (ldiff x (cdddr x)) '(1 2 3)))))
	(test-t (let* ((x '(1 2 3))
		       (y '(a b c))
		       (z (ldiff x y)))
		  (and (not (eq x z))
		       (equal z '(1 2 3)))))
	(test-t (equal (cl-member 'a '(a b c d)) '(a b c d)))
	(test-t (equal (cl-member 'b '(a b c d)) '(b c d)))
	(test-t (equal (cl-member 'c '(a b c d)) '(c d)))
	(test-t (equal (cl-member 'd '(a b c d)) '(d)))
	(test-t (equal (cl-member 'e '(a b c d)) ()))
	(test-t (equal (cl-member 'f '(a b c d)) ()))
	(test-t (let ((x '(a b c d)))
		  (eq (cl-member 'a x) x)
		  (eq (cl-member 'b x) (cdr x))
		  (eq (cl-member 'c x) (cddr x))
		  (eq (cl-member 'd x) (cdddr x))
		  (eq (cl-member 'e x) nil)))
	(test-t (equal (cl-member 'a '(a b c d) :test eq) '(a b c d)))
	(test-t (equal (cl-member 'b '(a b c d) :test eq) '(b c d)))
	(test-t (equal (cl-member 'c '(a b c d) :test eq) '(c d)))
	(test-t (equal (cl-member 'd '(a b c d) :test eq) '(d)))
	(test-t (equal (cl-member 'e '(a b c d) :test eq) ()))
	(test-t (equal (cl-member 'f '(a b c d) :test eq) ()))
	(test-t (null (cl-member 'a ())))
	(test-t (let* ((x '((1 . a) (2 . b) (3 . c) (4 . d) (5 . e)))
		       (y (cl-member 'd x :key cdr :test eq)))
		  (and (equal y '((4 . d) (5 . e)))
		       (eq y (nthcdr 3 x)))))
	(test-t (let* ((x '((1 . a) (2 . b) (3 . c) (4 . d) (5 . e)))
		       (y (cl-member 'd x :key cdr)))
		  (and (equal y '((4 . d) (5 . e)))
		       (eq y (nthcdr 3 x)))))
	(test-t (equal (member-if (lambda (x) (eql x 'a)) '(a b c d)) '(a b c d)))
	(test-t (equal (member-if (lambda (x) (eql x 'b)) '(a b c d)) '(b c d)))
	(test-t (equal (member-if (lambda (x) (eql x 'c)) '(a b c d)) '(c d)))
	(test-t (equal (member-if (lambda (x) (eql x 'd)) '(a b c d)) '(d)))
	(test-t (equal (member-if (lambda (x) (eql x 'e)) '(a b c d)) ()))
	(test-t (equal (member-if (lambda (x) (eql x 'f)) '(a b c d)) ()))
	(test-t (null (member-if (lambda (x) (eql x 'a)) ())))
	(test-t (let* ((x '((1 . a) (2 . b) (3 . c) (4 . d) (5 . e)))
		       (y (member-if (lambda (p) (eq p 'd)) x :key cdr)))
		  (and (equal y '((4 . d) (5 . e)))
		       (eq y (nthcdr 3 x)))))
	(test-t (null (member-if zerop '(7 8 9))))
	(test-t (equal (member-if-not (lambda (x) (not (eql x 'a))) '(a b c d)) '(a b c d)))
	(test-t (equal (member-if-not (lambda (x) (not (eql x 'b))) '(a b c d)) '(b c d)))
	(test-t (equal (member-if-not (lambda (x) (not (eql x 'c))) '(a b c d)) '(c d)))
	(test-t (equal (member-if-not (lambda (x) (not (eql x 'd))) '(a b c d)) '(d)))
	(test-t (equal (member-if-not (lambda (x) (not (eql x 'e))) '(a b c d)) ()))
	(test-t (equal (member-if-not (lambda (x) (not (eql x 'f))) '(a b c d)) ()))
	(test-t (null (member-if-not (lambda (x) (not (eql x 'a))) ())))
	
	(test-t (let* ((x '((1 . a) (2 . b) (3 . c) (4 . d) (5 . e)))
		       (y (member-if-not (lambda (p) (not (eq p 'd))) x :key cdr)))
		  (and (equal y '((4 . d) (5 . e)))
		       (eq y (nthcdr 3 x)))))
	
	(test-t (let ((dummy nil)
		      (list-1 '(1 2 3 4)))
		  (and (eq (mapc (lambda x (setq dummy (append dummy x)))
				 list-1
				 '(a b c d e)
				 '(x y z))
			   list-1)
		       (equal dummy '(1 a x 2 b y 3 c z)))))
	(test-t (let* ((x '(0 1 2 3))
		       (y nil)
		       (z (mapc (lambda (a b c) (push (list a b c) y))
				x '(1 2 3 4) '(2 3 4 5))))
		  (and (eq z x)
		       (equal y '((3 4 5) (2 3 4) (1 2 3) (0 1 2))))))
	(test-t (let* ((x '(0 1 2 3))
		       (y nil)
		       (z (mapc (lambda (a b c) (push (list a b c) y))
				nil x '(1 2 3 4) '(2 3 4 5))))
		  (and (null z)
		       (null y))))
	(test-t (let ((sum 0))
		  (mapc (lambda rest (setq sum (+ sum (apply + rest))))
			'(0 1 2)
			'(1 2 0)
			'(2 0 1))
		  (eql sum 9)))
	(test-t (let ((result 'initial-value)
		      (list-1 nil))
		  (and (eq (mapc (lambda (a b) (setq result (cons (cons a b) result))) list-1) list-1)
		       (eq result 'initial-value))))
	(test-t (let ((result 'initial-value)
		      (list-1 nil))
		  (and (eq (mapc (lambda (a b) (setq result (cons (cons a b) result)))
				 list-1
				 '(1 2 3))
			   list-1)
		       (eq result 'initial-value))))
	(test-t (let ((result 'initial-value)
		      (list-1 '(1 2 3)))
		  (and (eq (mapc (lambda (a b) (setq result (cons (cons a b) result)))
				 list-1
				 ())
			   list-1)
		       (eq result 'initial-value))))
	(test-t (equal (mapcar car '((1 2) (2 3) (3 4) (4 5))) '(1 2 3 4)))
	(test-t (null (mapcar identity ())))
	(test-t (equal (mapcar list '(0 1 2 3) '(a b c d) '(w x y z)) '((0 a w) (1 b x) (2 c y) (3 d z))))
	(test-t (null (mapcar list () '(0 1 2 3) '(1 2 3 4) '(2 3 4 5))))
	(test-t (null (mapcar list '(0 1 2 3) () '(1 2 3 4) '(2 3 4 5))))
	(test-t (null (mapcar list '(0 1 2 3) '(1 2 3 4) () '(2 3 4 5))))
	(test-t (null (mapcar list '(0 1 2 3) '(1 2 3 4) '(2 3 4 5) ())))
	(test-t (equal (mapcar list '(0) '(a b) '(x y z)) '((0 a x))))
	(test-t (equal (mapcar list '(a b) '(0) '(x y z)) '((a 0 x))))
	(test-t (equal (mapcar list '(a b) '(x y z) '(0)) '((a x 0))))
	(test-t (equal (mapcar cons '(a b c) '(1 2 3)) '((a . 1) (b . 2) (c . 3))))
	(test-t (equal (mapcan cdr (copy-tree '((1 2) (2 3) (3 4) (4 5)))) '(2 3 4 5)))
	(test-t (equal (mapcan append
			       '((1 2 3) (4 5 6) (7 8 9))
			       '((a) (b c) (d e f))
			       (list (list 'x 'y 'z) (list 'y 'z) (list 'z)))
		       '(1 2 3 a x y z 4 5 6 b c y z 7 8 9 d e f z)))
	(test-t (null (mapcan append '((1 2 3) (4 5 6) (7 8 9)) '((a) (b c)) ())))
	(test-t (null (mapcan append '((1 2 3) (4 5 6) (7 8 9)) () '((a) (b c)))))
	(test-t (null (mapcan append () '((1 2 3) (4 5 6) (7 8 9)) '((a) (b c)))))
	(test-t (equal (mapcan list
			       (list 1 2 3 4 5)
			       (list 2 3 4 5 6)
			       (list 3 4 5 6 7)
			       (list 4 5 6 7 8))
		       '(1 2 3 4 2 3 4 5 3 4 5 6 4 5 6 7 5 6 7 8)))
	(test-t (equal (mapcan (lambda (x y) (if (null x) () (list x y)))
			       '(() () () d e)
			       '(1 2 3 4 5 6))
		       '(d 4 e 5)))
	(test-t (equal (mapcan (lambda (x) (if (numberp x) (list x) ()))
			       '(a 1 b c 3 4 d 5))
		       '(1 3 4 5)))
	(test-t (equal (maplist identity '(a b c d)) '((a b c d) (b c d) (c d) (d))))
	(test-t (equal (maplist car '((1 2) (2 3) (3 4) (4 5))) '((1 2) (2 3) (3 4) (4 5))))
	(test-t (equal (maplist list '(a b c) '(b c d) '(c d e))
		       '(((a b c) (b c d) (c d e))
			 ((b c) (c d) (d e))
			 ((c) (d) (e)))))
	(test-t (equal (maplist append '(a b c) '(b c d) '(c d e)) '((a b c b c d c d e) (b c c d d e) (c d e))))
	(test-t (equal (maplist append '(a b c) '(b c) '(c)) '((a b c b c c))))
	(test-t (null (maplist append () '(a b c) '(b c) '(c))))
	(test-t (null (maplist append '(a b c) () '(b c) '(c))))
	(test-t (null (maplist append '(a b c) '(b c) '(c) ())))
	(test-t (let ((x '((1 2) (2 3) (3 4) (4 5)))
		      (y nil))
		  (and (eq (mapl (lambda (a) (push (car a) y)) x) x)
		       (equal y '((4 5) (3 4) (2 3) (1 2))))))
	(test-t (let ((x nil))
		  (and (null (mapl (lambda rest (push rest x)) () '(0) '(0 1)))
		       (null x))))
	(test-t (let ((x nil))
		  (and (equal (mapl (lambda rest (push rest x)) '(0) () '(0 1))
			      '(0))
		       (null x))))
	(test-t (let ((x nil))
		  (and (equal (mapl (lambda rest (push rest x)) '(0) '(0 1) ())
			      '(0))
		       (null x))))
	(test-t (equal (mapcon car (copy-tree '((1 2) (2 3) (3 4) (4 5)))) '(1 2 2 3 3 4 4 5)))
	(test-t (equal (mapcon list '(0 1 2 3) '(1 2 3 4) '(2 3 4 5) '(3 4 5 6))
		       '((0 1 2 3) (1 2 3 4) (2 3 4 5) (3 4 5 6) (1 2 3) (2 3 4) (3 4 5)
			 (4 5 6) (2 3) (3 4) (4 5) (5 6) (3) (4) (5) (6))))
	(test-t (null (mapcon list () '(0 1 2 3) '(1 2 3 4) '(2 3 4 5) '(3 4 5 6))))
	(test-t (null (mapcon list '(0 1 2 3) () '(1 2 3 4) '(2 3 4 5) '(3 4 5 6))))
	(test-t (null (mapcon list '(0 1 2 3) '(1 2 3 4) () '(2 3 4 5) '(3 4 5 6))))
	(test-t (null (mapcon list '(0 1 2 3) '(1 2 3 4) '(2 3 4 5) () '(3 4 5 6))))
	(test-t (null (mapcon list '(0 1 2 3) '(1 2 3 4) '(2 3 4 5) '(3 4 5 6) ())))
	(test-t (let* ((x '((apple . 1) (orange . 2) (grapes . 3)))
		       (y (acons 'plum 9 x)))
		  (and (equal y '((plum . 9) (apple . 1) (orange . 2) (grapes . 3)))
		       (eq x (cdr y)))))
	(test-t (equal (acons 'a '0 nil) '((a . 0))))
	(test-t (equal (acons 'apple 1 (acons 'orange 2 (acons 'grapes '3 nil))) '((apple . 1) (orange . 2) (grapes . 3))))
	(test-t (equal (acons () () ()) '((()))))
	(test-t (let ((alist '((x . 100) (y . 200) (z . 50)))) (eq (cl-assoc 'y alist) (cadr alist))))
	(test-t (null (cl-assoc 'no-such-key '((x . 100) (y . 200) (z . 50)))))
	(test-t (let ((alist '((x . 100) (y . 200) (z . 50)))) (eq (cl-assoc 'y alist :test eq) (cadr alist))))
	(test-t (null (cl-assoc 'key ())))
	(test-t (null (cl-assoc () '(()))))
	(test-t (null (cl-assoc () '(() ()))))
	(test-t (let ((alist '(() () () (x . 100) (y . 200) (z . 50)))) (eq (cl-assoc 'y alist) (car (cddddr alist)))))
	(test-t (let ((alist '((1 . a) () (2 . b) (())))) (eq (cl-assoc () alist) (cadddr alist))))
	(test-t (let ((alist '((x . 100) (y . 200) (x . 100) (z . 50)))) (eq (cl-assoc 'y alist) (cadr alist))))
	(test-t (let ((alist '((x . 100) (y . 200) (z . 50)))) (eq (assoc-if (lambda (arg) (eq arg 'y)) alist) (cadr alist))))
	(test-t (null (assoc-if consp '((x . 100) (y . 200) (z . 50)))))
	(test-t (null (assoc-if (lambda (x) (eq x 'key)) ())))
	(test-t (null (assoc-if identity '(()))))
	(test-t (null (assoc-if identity '(() ()))))
	(test-t (let ((alist '(() () () (x . 100) (y . 200) (z . 50)))) (eq (assoc-if (lambda (arg) (eq arg 'y)) alist) (car (cddddr alist)))))
	(test-t (let ((alist '((1 . a) () (2 . b) (())))) (eq (assoc-if (lambda (arg) (null arg)) alist) (cadddr alist))))
	(test-t (let ((alist '((x . 100) (y . 200) (z . 50)))) (eq (assoc-if-not (lambda (arg) (not (eq arg 'y))) alist) (cadr alist))))
	(test-t (null (assoc-if-not (complement consp) '((x . 100) (y . 200) (z . 50)))))
	(test-t (null (assoc-if-not (lambda (x) (not (eq x 'key))) ())))
	(test-t (null (assoc-if-not identity '(()))))
	(test-t (null (assoc-if-not identity '(() ()))))
	(test-t (let ((alist '(() () () (x . 100) (y . 200) (z . 50))))
		  (eq (assoc-if-not (lambda (arg) (not (eq arg 'y))) alist)
		      (car (cddddr alist)))))
	(test-t (equal (copy-alist '((a . 10) (b . 100) (c . 1000)))
		       '((a . 10) (b . 100) (c . 1000))))
	(test-t (let* ((alist '((a . 10) (b . 100) (c . 1000)))
		       (copy (copy-alist alist)))
		  (and (not (eq alist copy))
		       (not (eq (cdr alist) (cdr copy)))
		       (not (eq (cddr alist) (cddr copy)))
		       (not (eq (car alist) (car copy)))
		       (not (eq (cadr alist) (cadr copy)))
		       (not (eq (caddr alist) (caddr copy))))))
	(test-t (let* ((alist '((a 10 x) (b 100 y) (c 1000 z)))
		       (copy (copy-alist alist)))
		  (and (not (eq alist copy))
		       (not (eq (cdr alist) (cdr copy)))
		       (not (eq (cddr alist) (cddr copy)))
		       (not (eq (car alist) (car copy)))
		       (not (eq (cadr alist) (cadr copy)))
		       (not (eq (caddr alist) (caddr copy)))
		       (eq (cdar alist) (cdar copy))
		       (eq (cdadr alist) (cdadr copy))
		       (eq (cdaddr alist) (cdaddr copy)))))
	(test-t (let* ((alist (pairlis '(x y z) '(xx yy zz) '((a . aa) (b . bb)))))
		  (and (equal (cl-assoc 'x alist) '(x . xx))
		       (equal (cl-assoc 'y alist) '(y . yy))
		       (equal (cl-assoc 'z alist) '(z . zz))
		       (equal (cl-assoc 'a alist) '(a . aa))
		       (equal (cl-assoc 'b alist) '(b . bb))
		       (null (cl-assoc 'key alist)))))
	(test-t (let* ((alist (pairlis '(x y z) '(xx yy zz))))
		  (and (equal (cl-assoc 'x alist) '(x . xx))
		       (equal (cl-assoc 'y alist) '(y . yy))
		       (equal (cl-assoc 'z alist) '(z . zz))
		       (null (cl-assoc 'key alist)))))
	(test-t (let ((alist '((x . 100) (y . 200) (z . 50)))) (eq (rassoc '200 alist) (cadr alist))))
	(test-t (null (rassoc 'no-such-datum '((x . 100) (y . 200) (z . 50)))))
	(test-t (let ((alist '((x . 100) (y . 200) (z . 50)))) (eq (rassoc '200 alist :test =) (cadr alist))))
	(test-t (null (rassoc 'key ())))
	(test-t (null (rassoc () '(()))))
	(test-t (null (rassoc () '(() ()))))
	(test-t (let ((alist '(() () () (x . 100) (y . 200) (z . 50)))) (eq (rassoc '200 alist) (car (cddddr alist)))))
	(test-t (let ((alist '((1 . a) () (2 . b) (())))) (eq (rassoc () alist) (cadddr alist))))
	(test-t (let ((alist '((x . 100) (y . 200) (x . 100) (z . 50)))) (eq (rassoc '200 alist) (cadr alist))))
	(test-t (let ((alist '((x . 100) (y . 200) (z . 50)))) (eq (rassoc-if (lambda (arg) (= arg 200)) alist) (cadr alist))))
	(test-t (null (rassoc-if consp '((x . 100) (y . 200) (z . 50)))))
	(test-t (null (rassoc-if (lambda (x) (eq x 'key)) ())))
	(test-t (null (rassoc-if identity '(()))))
	(test-t (null (rassoc-if identity '(() ()))))
	(test-t (let ((alist '(() () () (x . 100) (y . 200) (z . 50)))) (eq (rassoc-if (lambda (arg) (= arg 200)) alist) (car (cddddr alist)))))
	(test-t (let ((alist '((1 . a) () (2 . b) (())))) (eq (rassoc-if (lambda (arg) (null arg)) alist) (cadddr alist))))
	(test-t (let ((alist '((x . 100) (y . 200) (z . 50)))) (eq (rassoc-if-not (lambda (arg) (not (= arg 200))) alist) (cadr alist))))
	(test-t (null (rassoc-if-not (complement consp) '((x . 100) (y . 200) (z . 50)))))
	(test-t (null (rassoc-if-not (lambda (x) (not (eq x 'key))) ())))
	(test-t (null (rassoc-if-not identity '(()))))
	(test-t (null (rassoc-if-not identity '(() ()))))
	(test-t (let ((alist '(() () () (x . 100) (y . 200) (z . 50))))
		  (eq (rassoc-if-not (lambda (arg) (not (= arg 200))) alist)
		      (car (cddddr alist)))))
	(test-t (let ((set '(a b c))) (eq (adjoin 'a set) set)))
	(test-t (let* ((set '(a b c)) (new-set (adjoin 'x set))) (and (equal new-set '(x a b c)) (eq set (cdr new-set)))))
	(test-t (equal (adjoin 1 nil) '(1)))
	(test-t (let ((set '((test-item 1)))) (equal (adjoin '(test-item 1) set) '((test-item 1) (test-item 1)))))
	(test-t (let ((set '((test-item 1)))) (equal (adjoin '(test-item 1) set) '((test-item 1) (test-item 1)))))
	(test-t (let ((set '((test-item 1)))) (eq (adjoin '(test-item 1) set :test equal) set)))
	(test-t (let ((set '((test-item 1)))) (eq (adjoin '(test-item) set :key car) set)))
	(test-t (let ((set '((test-item 1)))) (eq (adjoin '(test-item) set :key car :test eq) set)))
	(test-t (let ((set '(("test-item" 1)))) (eq (adjoin '("test-item") set :key car :test equal) set)))
	(test-t (let ((place nil)) (and (equal (pushnew 'a place) '(a)) (equal place '(a)))))
	(test-t (let ((place nil)) (and (equal (pushnew 'a place) '(a)) (equal place '(a)))))
	(test-t (let ((place '("love" "peace")))
		  (equal (pushnew "war" place :test equal) '("war" "love" "peace"))))
	(test-t (let ((place '("love" "peace")))
		  (and (eq (pushnew "peace" place :test equal) place)
		       (equal place '("love" "peace")))))
	(test-t (let ((place '(("love" . l) ("peace" . p))))
		  (equal (pushnew '("war" . w) place :test equal :key car)
			 '(("war" . w) ("love" . l) ("peace" . p)))))
	(test-t (let ((place '(("love" . l) ("peace" . p))))
		  (and (eq (pushnew '("love" . l) place :test equal :key car) place)
		       (equal place '(("love" . l) ("peace" . p))))))
	(test-t (let* ((list '((1) (1 2) (1 2 3)))
		       (original list))
		  (and (equal (pushnew '(1) list :test equal) '((1) (1 2) (1 2 3)))
		       (eq list original))))
	(test-t (let* ((list '((1) (1 2) (1 2 3)))
		       (original list))
		  (and (equal (pushnew '(1) list :test equal :key nil) '((1) (1 2) (1 2 3)))
		       (eq list original))))
	
	(test-t (eql (length "abc") 3))
	(test-t (zerop (length "")))
	(test-t (zerop (length #())))
	(test-t (zerop (length ())))
	(test-t (eql (length '(0)) 1))
	(test-t (eql (length '(0 1)) 2))
	(test-t (eql (length '(0 1 2)) 3))
	(test-t (eql (length '(0 1 2 3)) 4))
	(test-t (eql (length '(0 1 2 3 4)) 5))
	(test-t (eql (length '(0 1 2 3 4 5)) 6))
	(test-t (eql (length '(0 1 2 3 4 5 6)) 7))
	(test-t (eql (length #(0)) 1))
	(test-t (eql (length #(0 1)) 2))
	(test-t (eql (length #(0 1 2)) 3))
	(test-t (eql (length #(0 1 2 3)) 4))
	(test-t (eql (length #(0 1 2 3 4)) 5))
	(test-t (eql (length #(0 1 2 3 4 5)) 6))
	(test-t (eql (length #(0 1 2 3 4 5 6)) 7))
	(test-t (eql (length (make-array 100)) 100))
	(test-t (eql (length (make-sequence 'list 20)) 20))
	(test-t (eql (length (make-sequence 'string 10)) 10))
	(test-t (eql (length (make-sequence 'bit-vector 3)) 3))
	(test-t (eql (length (make-sequence 'bit-vector 64)) 64))
	(test-t (eql (length (make-sequence 'simple-vector 64)) 64))
	(test-t (string= (copy-seq "love") "love"))
	(test-t (equalp (copy-seq #(a b c d)) #(a b c d)))
	(test-t (equal (copy-seq '(love)) '(love)))
	(test-t (equal (copy-seq '(love hate war peace)) '(love hate war peace)))
	(test-t (null (copy-seq nil)))
	(test-t (string= (copy-seq "") ""))
	(test-t (let* ((seq0 "love&peace") (seq (copy-seq seq0))) (and (not (eq seq0 seq)) (string= seq0 seq))))
	(test-t (let* ((seq0 (list 'love 'and 'peace)) (seq (copy-seq seq0))) (and (not (eq seq0 seq)) (equal seq0 seq))))
	(test-t (let* ((c0 (list 'love))
		       (c1 (list 'peace))
		       (seq (copy-seq (list c0 c1))))
		  (and (equal seq '((love) (peace)))
		       (eq (car seq) c0)
		       (eq (cadr seq) c1))))
	(test-t (let* ((seq0 #(t nil t nil))
		       (seq (copy-seq seq0)))
		  (and (not (eq seq0 seq))
		       (equalp seq seq0))))
	(test-t (vectorp (copy-seq (vector))))
	(test-t (simple-vector-p (copy-seq (vector))))
	(test-t (simple-vector-p (copy-seq (vector 0 1))))
	(test-t (simple-string-p (copy-seq "xyz")))
	(test-t (char= (elt "0123456789" 6) #\6))
	(test-t (eq (elt #(a b c d e f g) 0) 'a))
	(test-t (eq (elt '(a b c d e f g) 4) 'e))
	(test-t (let ((str (copy-seq "0123456789"))) (and (char= (elt str 6) #\6) (setf (elt str 0) #\#) (string= str "#123456789"))))
	(test-t (let ((list (list 0 1 2 3)))
		  (and (= (elt list 2) 2)
		       (setf (elt list 1) 9)
		       (= (elt list 1) 9)
		       (equal list '(0 9 2 3)))))
	(test-t (let ((vec (vector 'a 'b 'c)))
		  (and (eq (elt vec 0) 'a)
		       (eq (elt vec 1) 'b)
		       (eq (elt vec 2) 'c))))
	(test-t (let ((list (list 0 1 2 3))) (and (eq (cl-fill list nil) list) (every null list))))
	(test-t (let ((vector (vector 'x 'y 'z))) (and (eq (cl-fill vector 'a) vector) (every (lambda (arg) (eq arg 'a)) vector))))
	(test-t (let ((list (list 0 1 2 3))) (and (eq (cl-fill list '9 :start 2) list) (equal list '(0 1 9 9)))))
	(test-t (let ((list (list 0 1 2 3))) (and (eq (cl-fill list '9 :start 1 :end 3) list) (equal list '(0 9 9 3)))))
	(test-t (let ((list (list 0 1 2 3))) (and (eq (cl-fill list '9 :start 1 :end nil) list) (equal list '(0 9 9 9)))))
	(test-t (let ((list (list 0 1 2 3))) (and (eq (cl-fill list '9 :end 1) list) (equal list '(9 1 2 3)))))
	(test-t (let ((vector (vector 0 1 2 3))) (and (eq (cl-fill vector 't :start 3) vector) (equalp vector #(0 1 2 t)))))
	(test-t (let ((vector (vector 0 1 2 3))) (and (eq (cl-fill vector 't :start 2 :end 4) vector) (equalp vector #(0 1 t t)))))
	(test-t (let ((vector (vector 0 1 2 3))) (and (eq (cl-fill vector 't :start 2 :end nil) vector) (equalp vector #(0 1 t t)))))
	(test-t (let ((vector (vector 0 1 2 3))) (and (eq (cl-fill vector 't :end 3) vector) (equalp vector #(t t t 3)))))
	(test-t (null (make-sequence 'list 0)))
	(test-t (string= (make-sequence 'string 26 :initial-element #\.) ".........................."))
	(test-t (equal (make-sequence 'list 3 :initial-element 'a) '(a a a)))
	(test-t (null (make-sequence 'null 0 :initial-element 'a)))
	(test-t (equalp (make-sequence 'vector 3 :initial-element 'z) #(z z z)))
	(test-t (string= (make-sequence 'string 4 :initial-element '#\z) "zzzz"))
	(test-t (vectorp (make-sequence 'vector 10)))
	(test-t (string= (subseq "012345" 2) "2345"))
	(test-t (string= (subseq "012345" 3 5) "34"))
	(test-t (equal (subseq '(0 1 2 3) 0) '(0 1 2 3)))
	(test-t (equal (subseq '(0 1 2 3) 1) '(1 2 3)))
	(test-t (equal (subseq '(0 1 2 3) 2) '(2 3)))
	(test-t (equal (subseq '(0 1 2 3) 3) '(3)))
	(test-t (equal (subseq '(0 1 2 3) 4) ()))
	(test-t (equalp (subseq #(a b c d) 0) #(a b c d)))
	(test-t (equalp (subseq #(a b c d) 1) #(b c d)))
	(test-t (equalp (subseq #(a b c d) 2) #(c d)))
	(test-t (equalp (subseq #(a b c d) 3) #(d)))
	(test-t (equalp (subseq #(a b c d) 4) #()))
	(test-t (string= (subseq "0123" 0) "0123"))
	(test-t (string= (subseq "0123" 1) "123"))
	(test-t (string= (subseq "0123" 2) "23"))
	(test-t (string= (subseq "0123" 3) "3"))
	(test-t (string= (subseq "0123" 4) ""))
	(test-t (equal (subseq '(0 1 2 3) 0 4) '(0 1 2 3)))
	(test-t (equal (subseq '(0 1 2 3) 0 nil) '(0 1 2 3)))
	(test-t (let* ((list0 '(0 1 2 3)) (list (subseq list0 0 4))) (and (not (eq list0 list)) (equal list0 list))))
	(test-t (let* ((list0 '(0 1 2 3)) (list (subseq list0 0 nil))) (and (not (eq list0 list)) (equal list0 list))))
	(test-t (equal (subseq '(0 1 2 3) 1 3) '(1 2)))
	(test-t (equal (subseq '(0 1 2 3) 2 2) ()))
	(test-t (equal (subseq '(0 1 2 3) 0 0) ()))
	(test-t (equal (subseq '(0 1 2 3) 1 1) ()))
	(test-t (equal (subseq '(0 1 2 3) 2 2) ()))
	(test-t (equal (subseq '(0 1 2 3) 3 3) ()))
	(test-t (equal (subseq '(0 1 2 3) 4 4) ()))
	(test-t (equalp (subseq #(0 1 2 3) 0 4) #(0 1 2 3)))
	(test-t (equalp (subseq #(0 1 2 3) 0 nil) #(0 1 2 3)))
	(test-t (let* ((vec0 #(0 1 2 3)) (vec (subseq vec0 0 4))) (and (not (eq vec0 vec)) (equalp vec0 vec))))
	(test-t (let* ((vec0 #(0 1 2 3)) (vec (subseq vec0 0 nil))) (and (not (eq vec0 vec)) (equalp vec0 vec))))
	(test-t (equalp (subseq #(0 1 2 3) 1 3) #(1 2)))
	(test-t (equalp (subseq #(0 1 2 3) 2 2) #()))
	(test-t (equalp (subseq #(0 1 2 3) 0 0) #()))
	(test-t (equalp (subseq #(0 1 2 3) 1 1) #()))
	(test-t (equalp (subseq #(0 1 2 3) 2 2) #()))
	(test-t (equalp (subseq #(0 1 2 3) 3 3) #()))
	(test-t (equalp (subseq #(0 1 2 3) 4 4) #()))
	(test-t (string= (cl-map 'string (lambda (x y) (char "01234567890ABCDEF" (mod (+ x y) 16))) '(1 2 3 4) '(10 9 8 7)) "AAAA"))
	(test-t (equal (cl-map 'list - '(1 2 3 4)) '(-1 -2 -3 -4)))
	(test-t (string= (cl-map 'string (lambda (x) (if (oddp x) #\1 #\0)) '(1 2 3 4)) "1010"))
	(test-t (equal (cl-map 'list + '(0 1) '(1 0)) '(1 1)))
	(test-t (equal (cl-map 'list - '(0 1) '(1 0)) '(-1 1)))
	(test-t (every null (list (cl-map 'list + ())
				  (cl-map 'list + () ())
				  (cl-map 'list + () () ())
				  (cl-map 'list + () () () ())
				  (cl-map 'list + () () () () ()))))
	(test-t (equal (cl-map 'list + '(0 1 2)) '(0 1 2)))
	(test-t (equal (cl-map 'list + '(0 1 2) '(1 2 3)) '(1 3 5)))
	(test-t (equal (cl-map 'list + '(0 1 2) '(1 2 3) '(2 3 4)) '(3 6 9)))
	(test-t (equal (cl-map 'list + '(0 1 2) '(1 2 3) '(2 3 4) '(3 4 5)) '(6 10 14)))
	(test-t (equal (cl-map 'list + '(1 2) '(1 2 3)) '(2 4)))
	(test-t (equal (cl-map 'list + '(0 1 2) '(2 3) '(2 3 4)) '(4 7)))
	(test-t (equal (cl-map 'list + '(0 1 2) '(1 2 3) '(2) '(3 4 5)) '(6)))
	(test-t (equal (cl-map 'list + '(0 1 2) '(1 2 3) '(2 3 4) '(3 4 5) ()) ()))
	(test-t (null (cl-map 'null + ())))
	(test-t (equalp (cl-map 'vector + #()) #()))
	(test-t (equalp (cl-map 'vector + #() #()) #()))
	(test-t (equalp (cl-map 'vector + #() #() #()) #()))
	(test-t (equalp (cl-map 'vector + #() #() #() #()) #()))
	(test-t (equalp (cl-map 'vector + #() #() #() #() #()) #()))
	(test-t (equalp (cl-map 'vector + () #()) #()))
	(test-t (equalp (cl-map 'vector + () #() "") #()))
	(test-t (equalp (cl-map 'vector + '(0 1 2)) #(0 1 2)))
	(test-t (equalp (cl-map 'vector + '(0 1 2) #(1 2 3)) #(1 3 5)))
	(test-t (equalp (cl-map 'vector + #(0 1 2) '(1 2 3) #(2 3 4)) #(3 6 9)))
	(test-t (equalp (cl-map 'vector + '(0 1 2) #(1 2 3) '(2 3 4) #(3 4 5)) #(6 10 14)))
	(test-t (equalp (cl-map 'vector + '(1 2) '(1 2 3)) #(2 4)))
	(test-t (equalp (cl-map 'vector + '(0 1 2) '(2 3) '(2 3 4)) #(4 7)))
	(test-t (equalp (cl-map 'vector + '(0 1 2) '(1 2 3) '(2) '(3 4 5)) #(6)))
	(test-t (equalp (cl-map 'vector + '(0 1 2) '(1 2 3) '(2 3 4) '(3 4 5) ()) #()))
	(test-t (equalp (cl-map 'vector + #(1 2) #(1 2 3)) #(2 4)))
	(test-t (equalp (cl-map 'vector + #(0 1 2) #(2 3) #(2 3 4)) #(4 7)))
	(test-t (equalp (cl-map 'vector + #(0 1 2) '(1 2 3) #(2) '(3 4 5)) #(6)))
	(test-t (equalp (cl-map 'vector + '(0 1 2) #(1 2 3) '(2 3 4) '(3 4 5) ()) #()))
	(test-t (string= (cl-map 'string (lambda rest (char-upcase (car rest))) "") ""))
	(test-t (string= (cl-map 'string (lambda rest (char-upcase (car rest))) "" "") ""))
	(test-t (string= (cl-map 'string (lambda rest (char-upcase (car rest))) "" "" "") ""))
	(test-t (string= (cl-map 'string (lambda rest (char-upcase (car rest))) "" "" "" "") ""))
	(test-t (string= (cl-map 'string (lambda rest (char-upcase (car rest))) "" "" "" "" "") ""))
	(test-t (string= (cl-map 'string (lambda rest (char-upcase (car rest))) "") ""))
	(test-t (string= (cl-map 'string (lambda rest (char-upcase (car rest))) "" ()) ""))
	(test-t (string= (cl-map 'string (lambda rest (char-upcase (car rest))) "" #() ()) ""))
	(test-t (string= (cl-map 'string (lambda rest (char-upcase (car rest))) () () "" "") ""))
	(test-t (string= (cl-map 'string (lambda rest (char-upcase (car rest))) #() #() #() #() #()) ""))
	(test-t (string= (cl-map 'string (lambda (a b) (if (char< a b) b a)) "axbycz" "xaybzc") "xxyyzz"))
	(test-t (string= (cl-map 'string (lambda (a b) (if (char< a b) b a)) "axbycz" "xayb") "xxyy"))
	(test-t (let ((list ()))
		  (and (null (cl-map nil
				     (lambda rest
				       (setq list (cons (apply + rest) list)))
				     '(0 1 2 3)
				     '(1 2 3 4)))
		       (equal list '(7 5 3 1)))))
	(test-t (let ((list ()))
		  (and (null (cl-map nil
				     (lambda rest
				       (setq list (cons (apply + rest) list)))
				     '(0 1 2 3)
				     '(1 2 3 4)
				     '(2 3 4 5)))
		       (equal list (cl-reverse '(3 6 9 12))))))
	(test-t (let ((list ()))
		  (and (null (cl-map nil
				     (lambda rest
				       (setq list (cons (apply + rest) list)))
				     '(0 1 2 3)
				     '(1)
				     '(2 3 4 5)))
		       (equal list '(3)))))
	(test-t (string= (cl-map 'string char-upcase "abc") "ABC"))
	(test-t (let ((a (list 1 2 3 4))
		      (b (list 10 10 10 10)))
		  (and (equal (map-into a + a b) '(11 12 13 14))
		       (equal a '(11 12 13 14))
		       (equal b '(10 10 10 10)))))
	(test-t (let ((a '(11 12 13 14)) (k '(one two three))) (equal (map-into a cons k a) '((one . 11) (two . 12) (three . 13) 14))))
	(test-t (null (map-into nil identity)))
	(test-t (null (map-into nil identity)))
	(test-t (null (map-into nil identity ())))
	(test-t (null (map-into nil identity '(0 1 2) '(9 8 7))))
	(test-t (let ((list (list 0 1 2))) (and (eq (map-into list identity) list) (equal list '(0 1 2)))))
	(test-t (let ((list (list 0 1 2))) (and (eq (map-into list identity ()) list) (equal list '(0 1 2)))))
	(test-t (let ((vec (vector 0 1 2))) (and (eq (map-into vec identity) vec) (equalp vec #(0 1 2)))))
	(test-t (let ((vec (vector 0 1 2))) (and (eq (map-into vec identity #()) vec) (equalp vec #(0 1 2)))))
	(test-t (let ((vec (vector 0 1 2))) (and (eq (map-into vec + #() () #()) vec) (equalp vec #(0 1 2)))))
	(test-t (equal (map-into (list nil nil) + '(0 1) '(1 0)) '(1 1)))
	(test-t (equal (map-into (list nil nil) - '(0 1) '(1 0)) '(-1 1)))
	(test-t (let ((list (cl-make-list 3 :initial-element nil))) (and (eq (map-into list + '(0 1 2)) list) (equal list '(0 1 2)))))
	(test-t (let ((list (cl-make-list 3 :initial-element nil))) (and (eq (map-into list + '(0 1 2) '(1 2 3)) list) (equal list '(1 3 5)))))
	(test-t (let ((list (cl-make-list 3 :initial-element nil))) (and (eq (map-into list + '(0 1 2) '(1 2 3) '(2 3 4)) list) (equal list '(3 6 9)))))
	(test-t (let ((list (cl-make-list 3 :initial-element nil))) (and (eq (map-into list + '(1 2) '(1 2 3)) list) (equal list '(2 4 ())))))
	(test-t (let ((list (cl-make-list 1 :initial-element nil))) (and (eq (map-into list + '(1 2 3) '(1 2 3)) list) (equal list '(2)))))
	(test-t (let ((list (cl-make-list 3 :initial-element nil))) (and (eq (map-into list + '(1 2 3 4) '(1 2 3) '(0)) list) (equal list '(2 () ())))))
	(test-t (let ((vec (make-sequence 'vector 3 :initial-element nil))) (and (eq (map-into vec + '(0 1 2)) vec) (equalp vec #(0 1 2)))))
	(test-t (let ((vec (make-sequence 'vector 3 :initial-element nil))) (and (eq (map-into vec + '(0 1 2) #(1 2 3)) vec) (equalp vec #(1 3 5)))))
	(test-t (let ((vec (make-sequence 'vector 3 :initial-element nil))) (and (eq (map-into vec + '(0 1 2) '(1 2 3) #(2 3 4)) vec) (equalp vec #(3 6 9)))))
	(test-t (let ((vec (make-sequence 'vector 3 :initial-element nil))) (and (eq (map-into vec + '(1 2) #(1 2 3)) vec) (equalp vec #(2 4 ())))))
	(test-t (let ((vec (make-sequence 'vector 1 :initial-element nil))) (and (eq (map-into vec + '(1 2) #(1 2 3)) vec) (equalp vec #(2)))))
	(test-t (let ((vec (make-sequence 'vector 3 :initial-element nil))) (and (eq (map-into vec + '(1 2 3 4) #(1 2 3) '(0)) vec) (equalp vec #(2 () ())))))
	(test-t (null (cl-reverse nil)))
	(test-t (string= (cl-reverse "") ""))
	(test-t (equalp (cl-reverse #()) #()))
	(test-t (equal (cl-reverse '(0 1 2 3)) '(3 2 1 0)))
	(test-t (string= (cl-reverse "0123") "3210"))
	(test-t (equalp (cl-reverse #(a b c d)) #(d c b a)))
	(test-t (null (nreverse nil)))
	(test-t (string= (nreverse (copy-seq "")) ""))
	(test-t (equalp (nreverse (copy-seq #())) #()))
	(test-t (equal (nreverse (list 0 1 2 3)) '(3 2 1 0)))
	(test-t (string= (nreverse (copy-seq "0123")) "3210"))
	(test-t (equalp (cl-reverse (copy-seq #(a b c d))) #(d c b a)))
	(test-t (char= (find #\d "edcba" :test char>) #\c))
	(test-t (eql (find-if oddp '(1 2 3 4 5) :end 3 :from-end t) 3))
	(test-t (eq (find 'a '(a b c)) 'a))
	(test-t (eq (find 'b '(a b c)) 'b))
	(test-t (eq (find 'c '(a b c)) 'c))
	(test-t (null (find 'x '(a b c))))
	(test-t (null (find 'a '(a b c) :start 1)))
	(test-t (null (find 'b '(a b c) :start 2)))
	(test-t (null (find 'c '(a b c) :start 3)))
	(test-t (null (find 'a '(a b c) :start 0 :end 0)))
	(test-t (null (find 'a '(a b c) :start 0 :end 0 :from-end t)))
	(test-t (null (find 'a '(a b c) :start 1 :end 1)))
	(test-t (null (find 'a '(a b c) :start 1 :end 1 :from-end t)))
	(test-t (null (find 'a '(a b c) :start 2 :end 2)))
	(test-t (null (find 'a '(a b c) :start 2 :end 2 :from-end t)))
	(test-t (null (find 'a '(a b c) :start 3 :end 3)))
	(test-t (null (find 'a '(a b c) :start 3 :end 3 :from-end t)))
	(test-t (eq (find 'a '(a b c) :end nil) 'a))
	(test-t (eq (find 'b '(a b c) :end nil) 'b))
	(test-t (eq (find 'c '(a b c) :end nil) 'c))
	(test-t (eq (find 'a '(a b c) :end 1) 'a))
	(test-t (eq (find 'b '(a b c) :end 2) 'b))
	(test-t (eq (find 'c '(a b c) :end 3) 'c))
	(test-t (null (find 'a '(a b c) :end 0)))
	(test-t (null (find 'b '(a b c) :end 1)))
	(test-t (null (find 'c '(a b c) :end 2)))
	(test-t (null (find 'a '((a) (b) (c)))))
	(test-t (equal (find 'a '((a) (b) (c)) :key car) '(a)))
	(test-t (equal (find 'b '((a) (b) (c)) :key car) '(b)))
	(test-t (equal (find 'c '((a) (b) (c)) :key car) '(c)))
	(test-t (null (find 'z '((a) (b) (c)) :key car)))
	(test-t (let ((list '((a) (b) (c))))
		  (and (eq (find 'a list :key car) (car list))
		       (eq (find 'b list :key car) (cadr list))
		       (eq (find 'c list :key car) (caddr list))
		       (null (find 'z list :key car)))))
	(test-t (null (find '(a) '((a) (b) (c)))))
	(test-t (equal (find '(a) '((a) (b) (c)) :test equal) '(a)))
	(test-t (null (find '("a") '(("a") ("b") ("c")))))
	(test-t (null (find '("a") '(("A") ("B") ("c")) :test equal)))
	(test-t (eql (find 3 '(0 1 2 3 4 5)) 3))
	(test-t (eql (find 3 '(0 1 2 3 4 5) :test <) 4))
	(test-t (eql (find 3 '(0 1 2 3 4 5) :test >) 0))
	(test-t (equal (find 'a '((a) (b) (c) (a a) (b b) (c c)) :key car) '(a)))
	(test-t (equal (find 'a '((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t) '(a a)))
	(test-t (equal (find 'b '((a) (b) (c) (a a) (b b) (c c)) :key car) '(b)))
	(test-t (equal (find 'b '((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t) '(b b)))
	(test-t (equal (find 'c '((a) (b) (c) (a a) (b b) (c c)) :key car) '(c)))
	(test-t (equal (find 'c '((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t) '(c c)))
	(test-t (null (find 'z '((a) (b) (c) (a a) (b b) (c c)) :key car)))
	(test-t (null (find 'z '((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t)))
	(test-t (equal (find 'a '((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t) '(a a a)))
	(test-t (equal (find 'a '((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t :end nil) '(a a a)))
	(test-t (equal (find 'a '((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t :end 6) '(a a)))
	(test-t (null (find 'a '((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t :start 1 :end 3)))
	(test-t (null (find #\c '("abc" "bcd" "cde"))))
	(test-t (string= (find #\c '("abc" "bcd" "cde") :key (lambda (arg) (char arg 0)) :test char=) "cde"))
	(test-t (eq (find 'a #(a b c)) 'a))
	(test-t (eq (find 'b #(a b c)) 'b))
	(test-t (eq (find 'c #(a b c)) 'c))
	(test-t (null (find 'x #(a b c))))
	(test-t (null (find 'a #(a b c) :start 1)))
	(test-t (null (find 'b #(a b c) :start 2)))
	(test-t (null (find 'c #(a b c) :start 3)))
	(test-t (null (find 'a #(a b c) :start 0 :end 0)))
	(test-t (null (find 'a #(a b c) :start 0 :end 0 :from-end t)))
	(test-t (null (find 'a #(a b c) :start 1 :end 1)))
	(test-t (null (find 'a #(a b c) :start 1 :end 1 :from-end t)))
	(test-t (null (find 'a #(a b c) :start 2 :end 2)))
	(test-t (null (find 'a #(a b c) :start 2 :end 2 :from-end t)))
	(test-t (null (find 'a #(a b c) :start 3 :end 3)))
	(test-t (null (find 'a #(a b c) :start 3 :end 3 :from-end t)))
	(test-t (eq (find 'a #(a b c) :end nil) 'a))
	(test-t (eq (find 'b #(a b c) :end nil) 'b))
	(test-t (eq (find 'c #(a b c) :end nil) 'c))
	(test-t (eq (find 'a #(a b c) :end 1) 'a))
	(test-t (eq (find 'b #(a b c) :end 2) 'b))
	(test-t (eq (find 'c #(a b c) :end 3) 'c))
	(test-t (null (find 'a #(a b c) :end 0)))
	(test-t (null (find 'b #(a b c) :end 1)))
	(test-t (null (find 'c #(a b c) :end 2)))
	(test-t (null (find 'a #((a) (b) (c)))))
	(test-t (equal (find 'a #((a) (b) (c)) :key car) '(a)))
	(test-t (equal (find 'b #((a) (b) (c)) :key car) '(b)))
	(test-t (equal (find 'c #((a) (b) (c)) :key car) '(c)))
	(test-t (null (find 'z #((a) (b) (c)) :key car)))
	(test-t (let ((vector #((a) (b) (c))))
		  (and (eq (find 'a vector :key car) (aref vector 0))
		       (eq (find 'b vector :key car) (aref vector 1))
		       (eq (find 'c vector :key car) (aref vector 2))
		       (null (find 'z vector :key car)))))
	(test-t (null (find '(a) #((a) (b) (c)))))
	(test-t (equal (find '(a) #((a) (b) (c)) :test equal) '(a)))
	(test-t (null (find '("a") #(("a") ("b") ("c")))))
	(test-t (null (find '("a") #(("A") ("B") ("c")) :test equal)))
	(test-t (eql (find 3 #(0 1 2 3 4 5)) 3))
	(test-t (eql (find 3 #(0 1 2 3 4 5) :test <) 4))
	(test-t (eql (find 3 #(0 1 2 3 4 5) :test >) 0))
	(test-t (equal (find 'a #((a) (b) (c) (a a) (b b) (c c)) :key car) '(a)))
	(test-t (equal (find 'a #((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t) '(a a)))
	(test-t (equal (find 'b #((a) (b) (c) (a a) (b b) (c c)) :key car) '(b)))
	(test-t (equal (find 'b #((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t) '(b b)))
	(test-t (equal (find 'c #((a) (b) (c) (a a) (b b) (c c)) :key car) '(c)))
	(test-t (equal (find 'c #((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t) '(c c)))
	(test-t (null (find 'z #((a) (b) (c) (a a) (b b) (c c)) :key car)))
	(test-t (null (find 'z #((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t)))
	(test-t (equal (find 'a #((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t) '(a a a)))
	(test-t (equal (find 'a #((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t :end nil) '(a a a)))
	(test-t (equal (find 'a #((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t :end 6) '(a a)))
	(test-t (null (find 'a #((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t :start 1 :end 3)))
	(test-t (null (find #\c #("abc" "bcd" "cde"))))
	(test-t (null (find #\z "abcABC")))
	(test-t (eql (find #\a "abcABC") #\a))
	(test-t (eql (find #\A "abcABC") #\A))
	(test-t (eql (find #\A "abcABC" :test char-equal) #\a))
	(test-t (eql (find #\A "abcABC" :test char-equal :from-end t) #\A))
	(test-t (eql (find #\a "abcABC" :test char-equal :from-end t) #\A))
	(test-t (eql (find #\a "abcABC" :test char-equal :from-end t :end 4) #\A))
	(test-t (eql (find #\a "abcABC" :test char-equal :from-end t :end 3) #\a))
	(test-t (eq (find-if (lambda (x) (eq x 'a)) '(a b c)) 'a))
	(test-t (eq (find-if (lambda (x) (eq x 'b)) '(a b c)) 'b))
	(test-t (eq (find-if (lambda (x) (eq x 'c)) '(a b c)) 'c))
	(test-t (null (find-if (lambda (arg) (eq arg 'x)) '(a b c))))
	(test-t (null (find-if (lambda (x) (eq x 'a)) '(a b c) :start 1)))
	(test-t (null (find-if (lambda (x) (eq x 'b)) '(a b c) :start 2)))
	(test-t (null (find-if (lambda (x) (eq x 'c)) '(a b c) :start 3)))
	(test-t (null (find-if (lambda (x) (eq x 'a)) '(a b c) :start 0 :end 0)))
	(test-t (null (find-if (lambda (x) (eq x 'a)) '(a b c) :start 0 :end 0 :from-end t)))
	(test-t (null (find-if (lambda (x) (eq x 'a)) '(a b c) :start 1 :end 1)))
	(test-t (null (find-if (lambda (x) (eq x 'a)) '(a b c) :start 1 :end 1 :from-end t)))
	(test-t (null (find-if (lambda (x) (eq x 'a)) '(a b c) :start 2 :end 2)))
	(test-t (null (find-if (lambda (x) (eq x 'a)) '(a b c) :start 2 :end 2 :from-end t)))
	(test-t (null (find-if (lambda (x) (eq x 'a)) '(a b c) :start 3 :end 3)))
	(test-t (null (find-if (lambda (x) (eq x 'a)) '(a b c) :start 3 :end 3 :from-end t)))
	(test-t (eq (find-if (lambda (x) (eq x 'a)) '(a b c) :end nil) 'a))
	(test-t (eq (find-if (lambda (x) (eq x 'b)) '(a b c) :end nil) 'b))
	(test-t (eq (find-if (lambda (x) (eq x 'c)) '(a b c) :end nil) 'c))
	(test-t (eq (find-if (lambda (x) (eq x 'a)) '(a b c) :end 1) 'a))
	(test-t (eq (find-if (lambda (x) (eq x 'b)) '(a b c) :end 2) 'b))
	(test-t (eq (find-if (lambda (x) (eq x 'c)) '(a b c) :end 3) 'c))
	(test-t (null (find-if (lambda (x) (eq x 'a)) '(a b c) :end 0)))
	(test-t (null (find-if (lambda (x) (eq x 'b)) '(a b c) :end 1)))
	(test-t (null (find-if (lambda (x) (eq x 'c)) '(a b c) :end 2)))
	(test-t (null (find-if (lambda (x) (eq x 'a)) '((a) (b) (c)))))
	(test-t (equal (find-if (lambda (x) (eq x 'a)) '((a) (b) (c)) :key car) '(a)))
	(test-t (equal (find-if (lambda (x) (eq x 'b)) '((a) (b) (c)) :key car) '(b)))
	(test-t (equal (find-if (lambda (x) (eq x 'c)) '((a) (b) (c)) :key car) '(c)))
	(test-t (null (find-if (lambda (x) (eq x 'z)) '((a) (b) (c)) :key car)))
	(test-t (let ((list '((a) (b) (c))))
		  (and (eq (find-if (lambda (x) (eq x 'a)) list :key car) (car list))
		       (eq (find-if (lambda (x) (eq x 'b)) list :key car) (cadr list))
		       (eq (find-if (lambda (x) (eq x 'c)) list :key car) (caddr list))
		       (null (find-if (lambda (x) (eq x 'z)) list :key car)))))
	(test-t (equal (find-if (lambda (x) (eq x 'a)) '((a) (b) (c) (a a) (b b) (c c)) :key car) '(a)))
	(test-t (equal (find-if (lambda (x) (eq x 'a)) '((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t) '(a a)))
	(test-t (equal (find-if (lambda (x) (eq x 'b)) '((a) (b) (c) (a a) (b b) (c c)) :key car) '(b)))
	(test-t (equal (find-if (lambda (x) (eq x 'b)) '((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t) '(b b)))
	(test-t (equal (find-if (lambda (x) (eq x 'c)) '((a) (b) (c) (a a) (b b) (c c)) :key car) '(c)))
	(test-t (equal (find-if (lambda (x) (eq x 'c)) '((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t) '(c c)))
	(test-t (null (find-if (lambda (x) (eq x 'z)) '((a) (b) (c) (a a) (b b) (c c)) :key car)))
	(test-t (null (find-if (lambda (x) (eq x 'z)) '((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t)))
	(test-t (equal (find-if (lambda (x) (eq x 'a)) '((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t) '(a a a)))
	(test-t (equal (find-if (lambda (x) (eq x 'a)) '((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t :end nil) '(a a a)))
	(test-t (equal (find-if (lambda (x) (eq x 'a)) '((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t :end 6) '(a a)))
	(test-t (null (find-if (lambda (x) (eq x 'a)) '((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t :start 1 :end 3)))
	(test-t (eq (find-if (lambda (x) (eq x 'a)) #(a b c)) 'a))
	(test-t (eq (find-if (lambda (x) (eq x 'b)) #(a b c)) 'b))
	(test-t (eq (find-if (lambda (x) (eq x 'c)) #(a b c)) 'c))
	(test-t (null (find-if (lambda (arg) (eq arg 'x)) #(a b c))))
	(test-t (null (find-if (lambda (x) (eq x 'a)) #(a b c) :start 1)))
	(test-t (null (find-if (lambda (x) (eq x 'b)) #(a b c) :start 2)))
	(test-t (null (find-if (lambda (x) (eq x 'c)) #(a b c) :start 3)))
	(test-t (null (find-if (lambda (x) (eq x 'a)) #(a b c) :start 0 :end 0)))
	(test-t (null (find-if (lambda (x) (eq x 'a)) #(a b c) :start 0 :end 0 :from-end t)))
	(test-t (null (find-if (lambda (x) (eq x 'a)) #(a b c) :start 1 :end 1)))
	(test-t (null (find-if (lambda (x) (eq x 'a)) #(a b c) :start 1 :end 1 :from-end t)))
	(test-t (null (find-if (lambda (x) (eq x 'a)) #(a b c) :start 2 :end 2)))
	(test-t (null (find-if (lambda (x) (eq x 'a)) #(a b c) :start 2 :end 2 :from-end t)))
	(test-t (null (find-if (lambda (x) (eq x 'a)) #(a b c) :start 3 :end 3)))
	(test-t (null (find-if (lambda (x) (eq x 'a)) #(a b c) :start 3 :end 3 :from-end t)))
	(test-t (eq (find-if (lambda (x) (eq x 'a)) #(a b c) :end nil) 'a))
	(test-t (eq (find-if (lambda (x) (eq x 'b)) #(a b c) :end nil) 'b))
	(test-t (eq (find-if (lambda (x) (eq x 'c)) #(a b c) :end nil) 'c))
	(test-t (eq (find-if (lambda (x) (eq x 'a)) #(a b c) :end 1) 'a))
	(test-t (eq (find-if (lambda (x) (eq x 'b)) #(a b c) :end 2) 'b))
	(test-t (eq (find-if (lambda (x) (eq x 'c)) #(a b c) :end 3) 'c))
	(test-t (null (find-if (lambda (x) (eq x 'a)) #(a b c) :end 0)))
	(test-t (null (find-if (lambda (x) (eq x 'b)) #(a b c) :end 1)))
	(test-t (null (find-if (lambda (x) (eq x 'c)) #(a b c) :end 2)))
	(test-t (null (find-if (lambda (x) (eq x 'a)) #((a) (b) (c)))))
	(test-t (equal (find-if (lambda (x) (eq x 'a)) #((a) (b) (c)) :key car) '(a)))
	(test-t (equal (find-if (lambda (x) (eq x 'b)) #((a) (b) (c)) :key car) '(b)))
	(test-t (equal (find-if (lambda (x) (eq x 'c)) #((a) (b) (c)) :key car) '(c)))
	(test-t (null (find-if (lambda (x) (eq x 'z)) #((a) (b) (c)) :key car)))
	(test-t (let ((vector #((a) (b) (c))))
		  (and (eq (find-if (lambda (x) (eq x 'a)) vector :key car) (aref vector 0))
		       (eq (find-if (lambda (x) (eq x 'b)) vector :key car) (aref vector 1))
		       (eq (find-if (lambda (x) (eq x 'c)) vector :key car) (aref vector 2))
		       (null (find-if (lambda (x) (eq x 'z)) vector :key car)))))
	(test-t (equal (find-if (lambda (x) (eq x 'a)) #((a) (b) (c) (a a) (b b) (c c)) :key car) '(a)))
	(test-t (equal (find-if (lambda (x) (eq x 'a)) #((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t) '(a a)))
	(test-t (equal (find-if (lambda (x) (eq x 'b)) #((a) (b) (c) (a a) (b b) (c c)) :key car) '(b)))
	(test-t (equal (find-if (lambda (x) (eq x 'b)) #((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t) '(b b)))
	(test-t (equal (find-if (lambda (x) (eq x 'c)) #((a) (b) (c) (a a) (b b) (c c)) :key car) '(c)))
	(test-t (equal (find-if (lambda (x) (eq x 'c)) #((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t) '(c c)))
	(test-t (null (find-if (lambda (x) (eq x 'z)) #((a) (b) (c) (a a) (b b) (c c)) :key car)))
	(test-t (null (find-if (lambda (x) (eq x 'z)) #((a) (b) (c) (a a) (b b) (c c)) :key car :from-end t)))
	(test-t (equal (find-if (lambda (x) (eq x 'a)) #((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t) '(a a a)))
	(test-t (equal (find-if (lambda (x) (eq x 'a)) #((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t :end nil) '(a a a)))
	(test-t (equal (find-if (lambda (x) (eq x 'a)) #((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t :end 6) '(a a)))
	(test-t (null (find-if (lambda (x) (eq x 'a)) #((a) (b) (c) (a a) (b b) (c c) (a a a)) :key car :from-end t :start 1 :end 3)))
	
	(test-t (let ((lst (copy-seq "012345678"))) (and (equal (replace lst lst :start1 2 :start2 0) "010123456") (equal lst "010123456"))))
	(test-t (let* ((list0 (list 'a 'b 'c 'd 'e)) (list (replace list0 '(x y z)))) (and (eq list0 list) (equal list0 '(x y z d e)))))
	(test-t (let* ((list0 (list 'a 'b 'c 'd 'e)) (list (replace list0 '(x y z) :start1 1))) (and (eq list0 list) (equal list0 '(a x y z e)))))
	(test-t (let* ((list0 (list 'a 'b 'c 'd 'e)) (list (replace list0 '(x y z) :start1 1 :end1 nil))) (and (eq list0 list) (equal list0 '(a x y z e)))))
	(test-t (let* ((list0 (list 'a 'b 'c 'd 'e)) (list (replace list0 '(x y z) :start1 1 :start2 1))) (and (eq list0 list) (equal list0 '(a y z d e)))))
	(test-t (let* ((list0 (list 'a 'b 'c 'd 'e)) (list (replace list0 '(x y z) :start1 1 :start2 1 :end2 nil))) (and (eq list0 list) (equal list0 '(a y z d e)))))
	(test-t (let* ((list0 (list 'a 'b 'c 'd 'e)) (list (replace list0 '(x y z) :start1 1 :end1 nil :start2 1 :end2 nil))) (and (eq list0 list) (equal list0 '(a y z d e)))))
	(test-t (let* ((list0 (list 'a 'b 'c 'd 'e)) (list (replace list0 '(x y z) :start1 1 :end1 2 :start2 1))) (and (eq list0 list) (equal list0 '(a y c d e)))))
	(test-t (let* ((list0 (list 'a 'b 'c 'd 'e)) (list (replace list0 '(x y z) :start1 1 :end1 1))) (and (eq list0 list) (equal list0 '(a b c d e)))))
	(test-t (let* ((list0 (list 'a 'b 'c 'd 'e)) (list (replace list0 '(x y z) :start1 2 :end1 2))) (and (eq list0 list) (equal list0 '(a b c d e)))))
	(test-t (let* ((list0 (list 'a 'b 'c 'd 'e)) (list (replace list0 '(x y z) :start1 3 :end1 3))) (and (eq list0 list) (equal list0 '(a b c d e)))))
	(test-t (let* ((list0 (list 'a 'b 'c 'd 'e)) (list (replace list0 '(x y z) :start1 4 :end1 4))) (and (eq list0 list) (equal list0 '(a b c d e)))))
	(test-t (let* ((list0 (list 'a 'b 'c 'd 'e)) (list (replace list0 '(x y z) :start1 5 :end1 5))) (and (eq list0 list) (equal list0 '(a b c d e)))))
	(test-t (null (replace nil nil)))
	(test-t (null (replace nil '(a b c))))
	(test-t (let* ((list0 (list 'a 'b 'c)) (list (replace list0 ()))) (and (eq list0 list) (equal list0 '(a b c)))))
	(test-t (let* ((list0 (list 'a 'b 'c 'd 'e)) (list (replace list0 list0))) (and (eq list0 list) (equal list0 '(a b c d e)))))
	(test-t (let* ((list0 (list 'a 'b 'c 'd 'e)) (list (replace list0 list0 :start1 3))) (and (eq list0 list) (equal list0 '(a b c a b)))))
	(test-t (let* ((list0 (list 'a 'b 'c 'd 'e)) (list (replace list0 list0 :start1 1))) (and (eq list0 list) (equal list0 '(a a b c d)))))
	(test-t (let* ((list0 (list 'a 'b 'c 'd 'e)) (list (replace list0 list0 :start1 1 :end1 3))) (and (eq list0 list) (equal list0 '(a a b d e)))))
	(test-t (let* ((list0 (list 'a 'b 'c)) (list (replace list0 '(x y z)))) (and (eq list0 list) (equal list0 '(x y z)))))
	(test-t (let* ((vector0 (vector 'a 'b 'c 'd 'e)) (vector (replace vector0 '(x y z)))) (and (eq vector0 vector) (equalp vector0 #(x y z d e)))))
	(test-t (let* ((vector0 (vector 'a 'b 'c 'd 'e)) (vector (replace vector0 '(x y z) :start1 1))) (and (eq vector0 vector) (equalp vector0 #(a x y z e)))))
	(test-t (let* ((vector0 (vector 'a 'b 'c 'd 'e)) (vector (replace vector0 '(x y z) :start1 1 :end1 nil))) (and (eq vector0 vector) (equalp vector0 #(a x y z e)))))
	(test-t (let* ((vector0 (vector 'a 'b 'c 'd 'e)) (vector (replace vector0 '(x y z) :start1 1 :start2 1))) (and (eq vector0 vector) (equalp vector0 #(a y z d e)))))
	(test-t (let* ((vector0 (vector 'a 'b 'c 'd 'e)) (vector (replace vector0 '(x y z) :start1 1 :start2 1 :end2 nil))) (and (eq vector0 vector) (equalp vector0 #(a y z d e)))))
	(test-t (let* ((vector0 (vector 'a 'b 'c 'd 'e)) (vector (replace vector0 '(x y z) :start1 1 :end1 nil :start2 1 :end2 nil))) (and (eq vector0 vector) (equalp vector0 #(a y z d e)))))
	(test-t (let* ((vector0 (vector 'a 'b 'c 'd 'e)) (vector (replace vector0 '(x y z) :start1 1 :end1 2 :start2 1))) (and (eq vector0 vector) (equalp vector0 #(a y c d e)))))
	(test-t (let* ((vector0 (vector 'a 'b 'c 'd 'e)) (vector (replace vector0 '(x y z) :start1 1 :end1 1))) (and (eq vector0 vector) (equalp vector0 #(a b c d e)))))
	(test-t (let* ((vector0 (vector 'a 'b 'c 'd 'e)) (vector (replace vector0 '(x y z) :start1 2 :end1 2))) (and (eq vector0 vector) (equalp vector0 #(a b c d e)))))
	(test-t (let* ((vector0 (vector 'a 'b 'c 'd 'e)) (vector (replace vector0 '(x y z) :start1 3 :end1 3))) (and (eq vector0 vector) (equalp vector0 #(a b c d e)))))
	(test-t (let* ((vector0 (vector 'a 'b 'c 'd 'e)) (vector (replace vector0 '(x y z) :start1 4 :end1 4))) (and (eq vector0 vector) (equalp vector0 #(a b c d e)))))
	(test-t (let* ((vector0 (vector 'a 'b 'c 'd 'e)) (vector (replace vector0 '(x y z) :start1 5 :end1 5))) (and (eq vector0 vector) (equalp vector0 #(a b c d e)))))
	(test-t (null (replace nil #())))
	(test-t (null (replace nil #(a b c))))
	(test-t (let* ((vector0 (vector 'a 'b 'c)) (vector (replace vector0 ()))) (and (eq vector0 vector) (equalp vector0 #(a b c)))))
	(test-t (let* ((vector0 (vector 'a 'b 'c 'd 'e)) (vector (replace vector0 vector0))) (and (eq vector0 vector) (equalp vector0 #(a b c d e)))))
	(test-t (let* ((vector0 (vector 'a 'b 'c 'd 'e)) (vector (replace vector0 vector0 :start1 3))) (and (eq vector0 vector) (equalp vector0 #(a b c a b)))))
	(test-t (let* ((vector0 (vector 'a 'b 'c 'd 'e)) (vector (replace vector0 vector0 :start1 1))) (and (eq vector0 vector) (equalp vector0 #(a a b c d)))))
	(test-t (let* ((vector0 (vector 'a 'b 'c 'd 'e)) (vector (replace vector0 vector0 :start1 1 :end1 3))) (and (eq vector0 vector) (equalp vector0 #(a a b d e)))))
	(test-t (let* ((vector0 (vector 'a 'b 'c)) (vector (replace vector0 '(x y z)))) (and (eq vector0 vector) (equalp vector0 #(x y z)))))
	(test-t (let* ((vector0 (vector 'a 'b 'c 'd 'e)) (vector (replace vector0 #(x y z)))) (and (eq vector0 vector) (equalp vector0 #(x y z d e)))))
	(test-t (let* ((vector0 (vector 'a 'b 'c 'd 'e)) (vector (replace vector0 #(x y z) :start1 1))) (and (eq vector0 vector) (equalp vector0 #(a x y z e)))))
	(test-t (let* ((vector0 (vector 'a 'b 'c 'd 'e)) (vector (replace vector0 #(x y z) :start1 1 :end1 nil))) (and (eq vector0 vector) (equalp vector0 #(a x y z e)))))
	(test-t (let* ((vector0 (vector 'a 'b 'c 'd 'e)) (vector (replace vector0 #(x y z) :start1 1 :start2 1))) (and (eq vector0 vector) (equalp vector0 #(a y z d e)))))
	(test-t (let* ((vector0 (vector 'a 'b 'c 'd 'e)) (vector (replace vector0 #(x y z) :start1 1 :start2 1 :end2 nil))) (and (eq vector0 vector) (equalp vector0 #(a y z d e)))))
	(test-t (let* ((vector0 (vector 'a 'b 'c 'd 'e)) (vector (replace vector0 #(x y z) :start1 1 :end1 nil :start2 1 :end2 nil))) (and (eq vector0 vector) (equalp vector0 #(a y z d e)))))
	(test-t (let* ((vector0 (vector 'a 'b 'c 'd 'e)) (vector (replace vector0 #(x y z) :start1 1 :end1 2 :start2 1))) (and (eq vector0 vector) (equalp vector0 #(a y c d e)))))
	(test-t (let* ((vector0 (vector 'a 'b 'c 'd 'e)) (vector (replace vector0 #(x y z) :start1 1 :end1 1))) (and (eq vector0 vector) (equalp vector0 #(a b c d e)))))
	(test-t (let* ((vector0 (vector 'a 'b 'c 'd 'e)) (vector (replace vector0 #(x y z) :start1 2 :end1 2))) (and (eq vector0 vector) (equalp vector0 #(a b c d e)))))
	(test-t (let* ((vector0 (vector 'a 'b 'c 'd 'e)) (vector (replace vector0 #(x y z) :start1 3 :end1 3))) (and (eq vector0 vector) (equalp vector0 #(a b c d e)))))
	(test-t (let* ((vector0 (vector 'a 'b 'c 'd 'e)) (vector (replace vector0 #(x y z) :start1 4 :end1 4))) (and (eq vector0 vector) (equalp vector0 #(a b c d e)))))
	(test-t (let* ((vector0 (vector 'a 'b 'c 'd 'e)) (vector (replace vector0 #(x y z) :start1 5 :end1 5))) (and (eq vector0 vector) (equalp vector0 #(a b c d e)))))
	(test-t (null (replace nil #())))
	(test-t (null (replace nil #(a b c))))
	(test-t (let* ((vector0 (vector 'a 'b 'c)) (vector (replace vector0 #()))) (and (eq vector0 vector) (equalp vector0 #(a b c)))))
	(test-t (let* ((vector0 (vector 'a 'b 'c 'd 'e)) (vector (replace vector0 vector0))) (and (eq vector0 vector) (equalp vector0 #(a b c d e)))))
	(test-t (let* ((vector0 (vector 'a 'b 'c 'd 'e)) (vector (replace vector0 vector0 :start1 3))) (and (eq vector0 vector) (equalp vector0 #(a b c a b)))))
	(test-t (let* ((vector0 (vector 'a 'b 'c 'd 'e)) (vector (replace vector0 vector0 :start1 1))) (and (eq vector0 vector) (equalp vector0 #(a a b c d)))))
	(test-t (let* ((vector0 (vector 'a 'b 'c 'd 'e)) (vector (replace vector0 vector0 :start1 1 :end1 3))) (and (eq vector0 vector) (equalp vector0 #(a a b d e)))))
	(test-t (let* ((vector0 (vector 'a 'b 'c)) (vector (replace vector0 #(x y z)))) (and (eq vector0 vector) (equalp vector0 #(x y z)))))
	(test-t (let* ((str0 (copy-seq "abc")) (str (replace str0 "xyz"))) (and (eq str0 str) (equalp str0 "xyz"))))
	(test-t (let* ((str0 (copy-seq "")) (str (replace str0 ""))) (and (eq str0 str) (equalp str0 ""))))
	(test-t (let* ((str0 (copy-seq "")) (str (replace str0 "xyz"))) (and (eq str0 str) (equalp str0 ""))))
	(test-t (let* ((str0 (copy-seq "abc")) (str (replace str0 ""))) (and (eq str0 str) (equalp str0 "abc"))))
	(test-t (let* ((str0 (copy-seq "abcdef")) (str (replace str0 "xyz" :start1 3))) (and (eq str0 str) (equalp str0 "abcxyz"))))
	(test-t (let* ((str0 (copy-seq "abcdef")) (str (replace str0 "xyz" :start1 4 :start2 1))) (and (eq str0 str) (equalp str0 "abcdyz"))))
	(test-t (let* ((str0 (copy-seq "abcdef")) (str (replace str0 "xyz" :start1 1 :end1 2 :start2 1))) (and (eq str0 str) (equalp str0 "aycdef"))))
	(test-t (let* ((str0 (copy-seq "abcdef")) (str (replace str0 "xyz" :start1 1 :start2 1 :end2 2))) (and (eq str0 str) (equalp str0 "aycdef"))))
	(test-t (let* ((str0 (copy-seq "abcdef")) (str (replace str0 str0 :start1 1))) (and (eq str0 str) (equalp str0 "aabcde"))))
	
	(test-t (string= (concatenate 'string "all" " " "together" " " "now") "all together now"))
	(test-t (equal (concatenate 'list () '(a b c) '(x y z)) '(a b c x y z)))
	(test-t (equal (concatenate 'list '(a) #(b) '(c) #(x y) '(z)) '(a b c x y z)))
	(test-t (null (concatenate 'list)))
	(test-t (let* ((list0 '(a b c)) (list (concatenate 'list list0))) (and (not (eq list0 list)) (equal list list0) (equal list '(a b c)))))
	(test-t (equalp (concatenate 'vector () '(a b c) '(x y z)) #(a b c x y z)))
	(test-t (equalp (concatenate 'vector '(a) #(b) '(c) #(x y) '(z)) #(a b c x y z)))
	(test-t (equalp (concatenate 'vector) #()))
	(test-t (let* ((vector0 #(a b c)) (vector (concatenate 'vector vector0))) (and (not (eq vector0 vector)) (equalp vector vector0) (equalp vector #(a b c)))))
	(test-t (string= (concatenate 'string "abc" "def" "ghi" "jkl" "mno" "pqr") "abcdefghijklmnopqr"))
	(test-t (string= (concatenate 'string "" "abc" "" "def" "" "ghi" "" "" "jkl" "" "mno" "" "pqr" "" "") "abcdefghijklmnopqr"))
	(test-t (string= (concatenate 'string) ""))
	(test-t (string= (concatenate 'string "abc" '(#\d #\e #\f #\g) #(#\h #\i #\j #\k #\l)) "abcdefghijkl"))
	;;	
	;; ----------------------------------- end sacla --------------------------------------------- 
	;; 
	
	(let ((boole-n-vector
	       (vector boole-clr   boole-and  boole-andc1 boole-2
		       boole-andc2 boole-1    boole-xor   boole-ior
		       boole-nor   boole-eqv  boole-c1    boole-orc1
		       boole-c2    boole-orc2 boole-nand  boole-set)))
	  (do ((n 0 (+ n 1)))
	      ((= n 16))
	    (if (not (= n (logand (boole (boole-n-vector n) #b0101 #b0011) #b1111)))
		(format #t "~A: ~A ~A~%" n (boole-n-vector n) (logand (boole (boole-n-vector n) #b0101 #b0011) #b1111))))
	  (let ((lst ()))
	    (do ((n #b0000 (+ n 1)))
		((> n #b1111))
	      (set! lst (cons (boole (boole-n-vector n) 5 3) lst)))
	    (if (not (equal? (reverse lst)
			     (list 0 1 2 3 4 5 6 7 -8 -7 -6 -5 -4 -3 -2 -1)))
		(format #t ";boole: ~A~%" (reverse lst)))))
	
	(test (digit-char-p #\a) #f)
	(test (digit-char-p #\a 16) 10)
	(test (let ((v (vector 1 2 3 4 5))) (cl-fill v 32 :start 2 :end 3)) #(1 2 32 4 5))
	(test (let ((v (vector 1 2 3 4 5))) (cl-fill v 32 :start 2)) #(1 2 32 32 32))
	(test (let ((v (vector 1 2 3))) (cl-fill v 32)) #(32 32 32))
	(test (let ((lst (list 1 2 3))) (cl-fill lst "hi")) '("hi" "hi" "hi"))
	(test (some zero? '(1 2 3)) #f)
	(test (some zero? '(1 0 3)) #t)
	(test (some (lambda args (apply > args)) #(1 2 3) #(2 3 4)) #f)
	(test (some (lambda args (apply > args)) #(1 2 3) #(2 3 1)) #t)
	(test (some (lambda (a) (and (positive? a) a)) '(0 -3 1 2)) 1)
	(test (notany zero? '(1 2 3)) #t)
	(test (notany zero? '(1 0 3)) #f)
	(test (notany (lambda args (apply > args)) #(1 2 3) #(2 3 4)) #t)
	(test (notany (lambda args (apply > args)) #(1 2 3) #(2 3 1)) #f)
	(test (notany (lambda (a) (and (positive? a) a)) '(0 -3 1 2)) #f)
	(test (every zero? '(1 2 3)) #f)
	(test (every zero? '(0 0)) #t)
	(test (every (lambda args (apply < args)) #(1 2 3) #(2 3 4)) #t)
	(test (every (lambda args (apply < args)) #(1 2 3) #(2 3 1)) #f)
	(test (notevery zero? '(1 2 3)) #t)
	(test (notevery zero? '(0 0)) #f)
	(test (notevery (lambda args (apply < args)) #(1 2 3) #(2 3 4)) #f)
	(test (notevery (lambda args (apply < args)) #(1 2 3) #(2 3 1)) #t)
	(test ((complement >) 1 2 3) #t)
	(test (cl-abs -1) 1)
	(test (cl-abs 1.0) 1.0)
	(test (cl-abs 1+i) (magnitude 1+i))
	(test (signum 3) 1)
	(test (signum 0) 0)
	(test (signum -3) -1)
	(test (signum 3.0) 1.0)
	(test (isqrt 12) 3)
	(test (1+ 1) 2)
	(test (1- 1) 0)
	(test (/= 0 0) #f)
	(test (/= 1 2 3) #t)
	(test (/= 3 45 3) #f)
	(test (zerop 0) #t)
	(test (zerop 1) #f)
	(test (minusp -1) #t)
	(test (minusp 1) #f)
	(test (plusp 1) #t)
	(test (plusp -1) #f)
	(test (oddp 3) #t)
	(test (oddp 4) #f)
	(test (evenp 3) #f)
	(test (evenp 4) #t)
	(test (conjugate 1+i) 1-i)
	(test (conjugate 3.7) 3.7)
	(test (ldb (byte 8 8) #x123) 1)
	(test (ldb (byte 8 0) #x123) #x23)
	(test (ldb (byte 4 4) #x123) 2)
	(test (ldb (byte 1 4) #x123) 0)
	(test (ldb (byte 1 5) #x123) 1)
	(test (ldb (byte 16 16) -1) 65535)
	(test (ldb (byte 12 18) #x12345678) 1165)
	(test (dpb 1 (byte 8 0) #x100) #x101)
	(test (dpb #x22 (byte 8 1) #x100) #x44) ;!
	(test (dpb #x22 (byte 8 8) #x100) #x2200) ; not #x2300
	(test (dpb #x1001 (byte 16 0) -1) -61439)
	(test (dpb #x1 (byte 8 8) #xffffff) #xff01ff)
	(test (dpb #x1 (byte 8 16) #xffffff) #x1ffff)	
	(test (dpb #x1 (byte 8 16) #xffffffff) #xff01ffff) 
	(test (dpb -1 (byte 8 0) 0) 255)
	(test (dpb -1 (byte 8 2) 0) 1020)
	(test (dpb 0 (byte 16 16) #xffffffff) 65535)
	(test (mask-field (byte 8 8) #xfffffff) #xff00)
	(test (mask-field (byte 1 8) #xfffffff) #x100)
	(test (ldb-test (byte 1 8) #xfffffff) #t)
	(test (ldb-test (byte 1 8) #x10ff) #f)
	(test (deposit-field #xabcdef (byte 8 8) 0) #xcd00)
	(test (deposit-field #xabcdef (byte 8 4) 0) #xde0)
	(test (deposit-field #xabcdef (byte 8 8) #xffffffff) #xffffcdff)
	(test (identity 1) 1)
	(test (stringp "hi") #t)
	(test (stringp #\h) #f)
	(test (characterp #\a) #t)
	(test (characterp "a") #f)
	(test (realp 1) #t)
	(test (realp 3.14) #t)
	(test (realp 1.0+i) #f)
	(test (complexp 1) #f)
	(test (complexp 1.0+i) #t)
	(test (floatp 1) #f)
	(test (floatp 3.14) #t)
	(test (rationalp 1) #t)
	(test (rationalp 1.12) #f)
	(test (rationalp 3/4) #t)
	(test (rationalp "hiho") #f)
	(test (integerp "hiho") #f)
	(test (integerp 3.14) #f)
	(test (integerp 3) #t)
	(test (numberp 3) #t)
	(test (numberp "hiho") #f)
	(test (consp ()) #f)
	(test (consp '(1 2)) #t)
	(test (consp 3) #f)
	(test (atom 3) #t)
	(test (atom ()) #t)
	(test (atom '(1 2 3)) #f)
	(test (vectorp #(1 2 3)) #t)
	(test (vectorp "hiho") #f)
	(test (symbolp 'hi) #t)
	(test (symbolp "hiho") #f)
	(test (last '(1 2 3)) '(3))
	(test (last ()) ())
	(test (tree-equal () ()) #t)
	(test (tree-equal (list 1 2 (list 3 5) 5) (list 1 2 (list 3 4) 5)) #f)
	(test (tree-equal (list 1 2 (list 3 4) 5) (list 1 2 (list 3 4) 5)) #t)
	(test (nthcdr 0 '(1 2 3)) '(1 2 3))
	(test (nthcdr 2 '(1 2 3)) '(3))
	(test (nthcdr 4 '(1 2 3)) ())
	(test (listp ()) #t)
	(test (listp 3) #f)
	(test (listp '(1 . 2)) #t)
	(test (listp (list 1 2)) #t)
	(test (null ()) #t)
	(test (null '(1 2 3)) #f)
	(test (butlast '(1 2 3 4)) '(1 2 3))
	(test (butlast '((1 2) (3 4))) '((1 2)))
	(test (butlast '(1)) ())
	(test (butlast ()) ())
	(test (copy-list ()) ())
	(test (copy-list '(1 2 3)) '(1 2 3))
	(test (copy-tree '(1 (2 3) 4)) '(1 (2 3) 4))
	(test (rest '(1 2 3)) '(2 3))
	(test (let ((i1 1) (i2 2)) (setf i1 3) (list i1 i2)) (list 3 2))
	(test (let ((i1 1) (i2 2)) (setf i1 123 i2 32) (list i1 i2)) (list 123 32))
	(test (let ((hi (vector 1 2 3))) (setf (hi 0) (+ 1 2) (hi 2) (* 2 3)) hi) (vector 3 2 6))
	(test (let ((val 0)) (progn (+ val 1))) 1)
	(test (let ((val 0)) (prog1 (+ val 1) (+ val 2))) 1)
	(test (let ((val 0)) (prog2 (+ val 1) (+ val 2) (+ val 3))) 2)
	(test (let ((lst (list 1))) (push 2 lst)) (list 2 1))
	(test (let ((lst (list 1 2 3))) (list (pop lst) lst)) (list 1 (list 2 3)))
	(test (let ((x 0)) (incf x) x) 1)
	(test (let ((x 0)) (incf x 2) x) 2)	
	(test (let ((x 0)) (decf x) x) -1)
	(test (let ((x 0)) (decf x 2) x) -2)	
	(test (let ((lst (list 1 2))) (pushnew 1 lst)) (list 1 2))
	(test (let ((lst (list 1 2))) (pushnew 3 lst)) (list 3 1 2))
	(test (let ((a 1) (b 2)) (psetq a b b a) (list a b)) '(2 1))
	(test (let ((a 1) (b 2) (c 3)) (psetq a (+ b c) b (+ a c) c (+ a b)) (list a b c)) '(5 4 3))
	(test (let ((val #f)) (unless val 1)) 1)
	(test (let ((val (list 1 2 3 4 5 6 7 8 9 10))) (first val)) 1)
	(test (let ((val (list 1 2 3 4 5 6 7 8 9 10))) (second val)) 2)
	(test (let ((val (list 1 2 3 4 5 6 7 8 9 10))) (third val)) 3)
	(test (let ((val (list 1 2 3 4 5 6 7 8 9 10))) (fourth val)) 4)
	(test (let ((val (list 1 2 3 4 5 6 7 8 9 10))) (fifth val)) 5)
	(test (let ((val (list 1 2 3 4 5 6 7 8 9 10))) (sixth val)) 6)
	(test (let ((val (list 1 2 3 4 5 6 7 8 9 10))) (seventh val)) 7)
	(test (let ((val (list 1 2 3 4 5 6 7 8 9 10))) (eighth val)) 8)
	(test (let ((val (list 1 2 3 4 5 6 7 8 9 10))) (ninth val)) 9)
	(test (let ((val (list 1 2 3 4 5 6 7 8 9 10))) (tenth val)) 10)
	(test (let ((val (list 1 2 3 4 5 6 7 8 9 10))) (nth 7 val)) 8)
	(test (let ((val (list 1 2 3 4 5 6 7 8 9 10))) (nth 17 val)) ())
	
	(test (let () (enum one two three) (list one two three)) '(0 1 2))
	
	(test (let () (defstruct x1 a b c) (let ((xx1 (make-x1 1 2 3))) (list (x1-a xx1) (x1-b xx1) (x1-c xx1) (x1? xx1)))) '(1 2 3 #t))
	(test (let () (defstruct x1 a (b "hi") (c 3/4)) (let ((xx1 (make-x1 1))) (list (x1-a xx1) (x1-b xx1) (x1-c xx1) (x1? xx1)))) '(1 "hi" 3/4 #t))
	(test (let () (defstruct x1 a (b "hi") (c 3/4)) (let ((xx1 (make-x1 :b 1))) (list (x1-a xx1) (x1-b xx1) (x1-c xx1) (x1? xx1)))) '(#f 1 3/4 #t))
	(test (let () (defstruct x1 a b c) (let ((xx1 (make-x1 1 2 3))) (set! (x1-a xx1) 32) (list (x1-a xx1) (x1-b xx1) (x1-c xx1)))) '(32 2 3))
	
	(let ()
	  (defstruct ship (x 0.0) (y 0.0 :type 'real))
	  (test (let ((s1 (make-ship 1.0 2.0)))
		  (let ((s2 (copy-ship s1)))
		    (list (ship-x s2) (ship-y s2))))
		'(1.0 2.0))
	  (test (let ((s3 (make-ship :y 1.0 :x 2.0)))
		  (list (ship-x s3) (ship-y s3)))
		'(2.0 1.0)))
	
	(let()
	  (defstruct ship1 x y)
	  (let ((s1 (make-ship1 "hi" (list 1 2 3))))
	    (let ((s2 (copy-ship1 s1)))
	      (test (list (ship1-x s2) (ship1-y s2)) '("hi" (1 2 3))))))
	
	(let ()
	  (defstruct ship2 (x 0.0) (y 1.0 :read-only #t))
	  (let ((s1 (make-ship2)))
	    (test (let ((tag (catch #t
				    (lambda ()
				      (set! (ship2-y s1) 123.0))
				    (lambda args (car args)))))
		    tag)
		  'syntax-error)
	    (set! (ship2-x s1) 123.0)
	    (test (ship2-x s1)  123.0)))
	
	(let ()
	  (defstruct (ship3 (:conc-name hi)) (x 0.0) (y 1.0 :read-only #t))
	  (let ((s1 (make-ship3 :x 3.0)))
	    (test (list (hi-x s1) (hi-y s1)) '(3.0 1.0))))
	
	(let ()
	  (defstruct (ship4 (:constructor new-ship)) (x 0.0) (y 1.0 :read-only #t))
	  (let ((s1 (new-ship 1.0 2.0)))
	    (test (list (ship4-x s1) (ship4-y s1)) '(1.0 2.0))))
	
	)
     ) ; end CL
(if (not (eq? else #_else)) (set! else #_else)) ; loop sets else!



;;; --------------------------------------------------------------------------------
;;; NUMBERS
;;; --------------------------------------------------------------------------------


(test (let () (set! most-positive-fixnum 2)) 'error)
(test (let ((most-positive-fixnum 2)) most-positive-fixnum) 'error)
(test (let () (set! most-negative-fixnum 2)) 'error)
(test (let ((most-negative-fixnum 2)) most-negative-fixnum) 'error)
(test (let () (set! pi 2)) 'error)
(test (let ((pi 2)) pi) 'error)

;;; already a constant now (define-constant nan.0 (string->number "nan.0"))
(if (not (nan? nan.0)) (format #t ";(string->number \"nan.0\") returned ~A~%" nan.0))
(if (infinite? nan.0) (format #t ";nan.0 is infinite?~%"))

(define-constant +inf.0 (string->number "+inf.0"))
(if (not (infinite? +inf.0)) (format #t ";(string->number \"+inf.0\") returned ~A~%" +inf.0))
(if (nan? +inf.0) (format #t ";+inf.0 is NaN?~%"))

;;; (define-constant -inf.0 (string->number "-inf.0"))
(if (not (infinite? -inf.0)) (format #t ";(string->number \"-inf.0\") returned ~A~%" -inf.0))
(if (nan? -inf.0) (format #t ";-inf.0 is NaN?~%"))

;;; (define-constant inf.0 +inf.0)
(define-constant inf+infi (complex inf.0 inf.0))
(define-constant nan+nani (complex nan.0 nan.0))
(define-constant 0+infi (complex 0 inf.0))
(define-constant 0+nani (complex 0 nan.0))

(test (equal? +inf.0 inf.0) #t)
(test (equal? +inf.0 -inf.0) #f)
(test (equal? nan.0 inf.0) #f)
(test (= nan.0 nan.0) #f) 
(test (equal? inf.0 nan.0) #f)
; (test (equal? nan.0 nan.0) (eqv? nan.0 nan.0)) ; these are confusing: (equal? 0/0 0/0) is a different case



;;; --------------------------------------------------------------------------------
;;; number?
;;; --------------------------------------------------------------------------------
;;; (synonym for complex?)

(test (number? -) #f)
(test (number? +) #f)
(test (number? 12) #t)
(test (number? 3) #t )
(test (number? (expt 2 130)) #t)
(test (number? 5/3+7.2i) #t)
(test (number? #f) #f)
(test (number? (cons 1 2)) #f)
(test (number? 2.5-.5i) #t)
(test (number? most-negative-fixnum) #t)
(test (number? 1e-308) #t)
(test (number? 1e308) #t)
(test (number? 0+0i) #t)
(test (number? (log 0)) #t)
(test (number? (real-part (log 0))) #t)
(test (number? '-1-i) #t)
(test (number? -1.797693134862315699999999999999999999998E308) #t)
(test (number? -2.225073858507201399999999999999999999996E-308) #t)
(test (number? -9223372036854775808) #t)
(test (number? 1.110223024625156799999999999999999999997E-16) #t)
(test (number? 9223372036854775807) #t)
(test (number? +inf.0) #t)
(test (number? -inf.0) #t)
(test (number? nan.0) #t)
(test (number? inf+infi) #t)
(test (number? nan+nani) #t)
(test (number? 0+infi) #t)
(test (number? 0+nani) #t)
(test (number? pi) #t)
(test (number? 0/0) #t)
(test (number? 1/-4) 'error)

(for-each
 (lambda (n)
   (let ((nb (catch #t (lambda () (number? n)) (lambda args 'error))))
     (if (not nb) (format #t ";(number? ~A) -> #f?~%" n))))
 (list '1e311 '1e-311 '0e311 '2.1e40000))

(when with-bignums
  (test (number? 1234567891234567890/1234567) #t)
  (test (number? 9223372036854775808) #t)
  (test (number? 9223372036854775808.1) #t)
  (test (number? 9223372036854775808.1+1.5i) #t)
  (test (number? 9223372036854775808/3) #t))

(test (number?) 'error)
(test (number? 1 2) 'error)

(for-each
 (lambda (op opname)
   (for-each
    (lambda (arg)
      (if (op arg)
	  (format #t ";(~A ~A) -> #t?~%" op arg)))
    (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
	  #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>)))
 (list number? complex? real? rational? integer? float?)
 (list 'number? 'complex? 'real? 'rational? 'integer? float?))


;;; --------------------------------------------------------------------------------
;;; complex?
;;; --------------------------------------------------------------------------------

(test (complex? 1/2) #t)
(test (complex? 2) #t)
(test (complex? (sqrt 2)) #t)
(test (complex? 1.0) #t)
(test (complex? 1+i) #t)
(test (complex? most-negative-fixnum) #t)
(test (complex? 1/0) #t) ; nan is complex?? I guess so -- it's a "real"...
(test (complex? (log 0.0)) #t)
(test (complex? 0/0) #t)
(test (complex? 1+0/0i) #t)
(test (complex? -1.797693134862315699999999999999999999998E308) #t)
(test (complex? -2.225073858507201399999999999999999999996E-308) #t)
(test (complex? -9223372036854775808) #t)
(test (complex? 1.110223024625156799999999999999999999997E-16) #t)
(test (complex? 9223372036854775807) #t)
(test (complex? 3) #t )
(test (complex? +inf.0) #t)
(test (complex? -inf.0) #t)
(test (complex? nan.0) #t) ; this should be #f
(test (complex? pi) #t)

(for-each
 (lambda (arg) 
   (if (not (complex? arg))
       (format #t ";(complex? ~A) -> #f?~%" arg)))
 (list 1 1.0 1.0+0.5i 1/2))

(when with-bignums
  (test (complex? 1234567891234567890/1234567) #t)
  (test (complex? 9223372036854775808) #t)
  (test (complex? 9223372036854775808.1) #t)
  (test (complex? 9223372036854775808.1+1.5i) #t)
  (test (complex? 0+92233720368547758081.0i) #t)
  (test (complex? 9223372036854775808/3) #t))

(test (complex?) 'error)
(test (complex? 1 2) 'error)



;;; --------------------------------------------------------------------------------
;;; real?
;;; --------------------------------------------------------------------------------

(test (real? 1) #t)
(test (real? most-negative-fixnum) #t)
(test (real? 1/2) #t)
(test (real? 1.0) #t)
(test (real? (+ 1+i 1-i)) #t)
(test (real? (- 1+i 1+i)) #t)
(test (real? (+ 1+i -1-i)) #t)
(test (real? (/ 1+i 1+i)) #t)
(test (real? (* 0+i 0+i)) #t)
(test (real? (magnitude 1+i)) #t)
(test (real? (string->number "1+0i")) #t)
(test (real? (complex 1 0)) #t)
(test (real? (complex 0 0)) #t)
(test (real? (complex 1 0.0)) #t)
(test (real? (complex 0.0 -0.0)) #t)
(test (real? (make-polar 0 0)) #t)
(test (real? (make-polar 1 0)) #t)
(test (real? (angle 1+i)) #t)
(test (real? (real-part 1+i)) #t)
(test (real? (imag-part 1+i)) #t)
(test (real? (expt 0+i 0+i)) #t)
(test (real? (log 0)) #f)
(test (real? (real-part (log 0))) #t)
(test (real? +inf.0) #t)
(test (real? -inf.0) #t)
(test (real? nan.0) #t) ; see below
(test (real? pi) #t)
(test (real? 0+i) #f)
(test (real? 1.0-0.1i) #f)
(test (real? (sqrt 2)) #t)
(test (real? 1+i) #f)
(test (real? 1e9-0i) #t)
(test (real? 0+0i) #t)
(test (real? 1.0+0i) #t)
(test (real? 1.0+0.0i) #t)
(test (real? 1+0.0i) #t)
(test (real? 1-0.0i) #t)
(test (real? 1+0i) #t)
(test (real? -0+1e22i) #f)
(test (real? -0+1e-22i) #f)
(test (real? 0+1e-322i) #f)
(test (real? 1+0/0i) #f) ; bignum direct 1+0/0i -> 1.0
(test (real? 1.0000000000000000000000000000+0.0000000000000000000000000000i) #t)
(test (real? 1.0+0.0000000000000000000000000000i) #t)
(test (real? 1.0000000000000000000000000000+0.0i) #t)
(test (real? 1.0000000000000000000000000000+0e10i) #t)
(test (real? 1.0+0.0000000000000000000000000000e10i) #t)
(test (real? 1.0000000000000000000000000000+0.0e10i) #t)
(test (real? 0+00000000000000000000000000000000/123456789012345678901234567890i) #t)
(test (real? -1.797693134862315699999999999999999999998E308) #t)
(test (real? -2.225073858507201399999999999999999999996E-308) #t)
(test (real? -9223372036854775808) #t)
(test (real? 1.110223024625156799999999999999999999997E-16) #t)
(test (real? 9223372036854775807) #t)

(when with-bignums 
  (test (real? 9.92209574402351949043519108941671096176E-1726-4.788930572030484370393069119625570107346E-1726i) #f)
  (test (real? 1234567891234567890/1234567) #t)
  (test (real? 9223372036854775808) #t)
  (test (real? 9223372036854775808.1) #t)
  (test (real? 9223372036854775808.1+1.5i) #f)
  (test (real? 9223372036854775808/3) #t))

(test (real? case) #f)
(test (real?) 'error)
(test (real? 1 2) 'error)

(test (real? (real-part (log 0.0))) #t) ; -inf
(test (real? (/ (real-part (log 0.0)) (real-part (log 0.0)))) #t) ; nan -- I think this should be #f
(test (real? (real-part (log 0))) #t)


;;; float?

(test (float? 1) #f)
(test (float? 1/2) #f)
(test (float? 1.4) #t)
(test (float? 1+i) #f)
(test (float?) 'error)
(test (float? 1.0 1.0) 'error)
(test (float? #\a) #f)
(test (float? (real-part (log 0.0))) #t)
(test (float? 1/0) #t)
(when (not with-bignums)
  (test (float? pi) #t)
  (test (float? 1e-308) #t))



;;; --------------------------------------------------------------------------------
;;; rational?
;;; --------------------------------------------------------------------------------

(test (rational? 3) #t)
(test (rational? 1/2) #t)
(test (rational? 2) #t)
(test (rational? (sqrt 2)) #f)
(test (rational? 1.0) #f)
(test (rational? 1+i) #f)
(test (rational? most-negative-fixnum) #t)
(test (rational? 0/0) #f)  ; I like this
(test (rational? 1/0) #f)
(test (rational? (/ 1 2)) #t)
(test (rational? (/ 1 2/3)) #t)
(test (rational? (/ 2/5 2/3)) #t)
(test (rational? (/ 2/5 -3)) #t)
(test (rational? (/ -4 4)) #t)
(test (rational? (/ 1.0 2)) #f)
(test (rational? 1/2+i) #f)
(test (rational? -1.797693134862315699999999999999999999998E308) #f)
(test (rational? -2.225073858507201399999999999999999999996E-308) #f)
(test (rational? -9223372036854775808) #t)
(test (rational? 1.110223024625156799999999999999999999997E-16) #f)
(test (rational? 9223372036854775807) #t)
(test (rational? +inf.0) #f)
(test (rational? -inf.0) #f)
(test (rational? nan.0) #f) ; guile says #t! 
(test (rational? pi) #f)
(test (rational? 9223372036854775806/9223372036854775807) #t)
(test (rational? 1+0i) #f) ; ?? 
(test (rational? 1+0.0i) #f) ; ?? see integer? 

(when with-bignums
  (test (rational? 1234567891234567890/1234567) #t)
  (test (rational? 9223372036854775808) #t)
  (test (rational? 9223372036854775808.1) #f)
  (test (rational? 9223372036854775808.1+1.5i) #f)
  (test (rational? 9223372036854775808/3) #t))

(test (rational?) 'error)
(test (rational? 1 2) 'error)



;;; --------------------------------------------------------------------------------
;;; integer?
;;; --------------------------------------------------------------------------------

(test (integer? 0.0) #f)
(test (integer? 3) #t)
(test (integer? 1/2) #f)
(test (integer? 1/1) #t)
(test (integer? 2) #t)
(test (integer? (sqrt 2)) #f)
(test (integer? 1.0) #f)
(test (integer? 1+i) #f)
(test (integer? most-negative-fixnum) #t)
(test (integer? 250076005727/500083) #t)
(test (integer? 1+0i) #f) ; hmmm -- guile says #t, but it thinks 1.0 is an integer
(test (integer? 0/0) #f)
(test (integer? 1/0) #f)
(test (integer? (/ 2 1)) #t)
(test (integer? (/ 2 1.0)) #f)
(test (integer? -1.797693134862315699999999999999999999998E308) #f)
(test (integer? -2.225073858507201399999999999999999999996E-308) #f)
(test (integer? -9223372036854775808) #t)
(test (integer? 1.110223024625156799999999999999999999997E-16) #f)
(test (integer? 9223372036854775807) #t)
(test (integer? (expt 2.3 54)) #f)
(test (integer? 10000000000000000.5) #f)
(test (integer? (expt 2 54)) #t)
(test (integer? (expt 2.0 54)) #f)
(test (integer? most-positive-fixnum) #t)
(test (integer? (/ most-positive-fixnum most-positive-fixnum)) #t)
(test (integer? +inf.0) #f)
(test (integer? -inf.0) #f)
(test (integer? nan.0) #f)
(test (integer? pi) #f)
(test (integer? 9223372036854775806/9223372036854775807) #f)
(test (integer? 1+0.0i) #f)

(when with-bignums
  (test (integer? 1234567891234567890/1234567) #f)
  (test (integer? 9223372036854775808) #t)
  (test (integer? 9223372036854775808.1) #f)
  (test (integer? 9223372036854775808.1+1.5i) #f)
  (test (integer? 9223372036854775808/3) #f)
  (test (integer? 9223372036854775808/9223372036854775808) #t)
  (test (integer? 21345678912345678912345678913456789123456789123456789) #t))

(test (integer?) 'error)
(test (integer? 1 2) 'error)



;;; --------------------------------------------------------------------------------
;;; infinite?
;;; --------------------------------------------------------------------------------
;;; (define (infinite? x) (and (number? x) (or (= x inf.0) (= x -inf.0)))) but this misses complex cases
;;;
;;; a number can be both NaN and infinite...:
(test (nan? (complex 0/0 (real-part (log 0)))) #t)
(test (infinite? (complex 0/0 (real-part (log 0)))) #t)
;;; maybe we should restrict nan? and infinite? to reals?

(test (infinite? 0) #f)
(test (infinite? 1.0) #f)
(test (infinite? 1/2) #f)
(test (infinite? 1+i) #f)
(test (infinite? most-positive-fixnum) #f)
(test (infinite? +inf.0) #t)
(test (infinite? -inf.0) #t)
(test (infinite? nan.0) #f)
(test (infinite? pi) #f)
(test (infinite? (imag-part (sinh (log 0.0)))) #t)
(test (infinite? (complex -inf.0 inf.0)) #t)
(test (infinite? (+ (complex 1 inf.0))) #t)
(test (infinite? most-negative-fixnum) #f)
(test (infinite? -1.797693134862315699999999999999999999998E308) #f)
(test (infinite? -2.225073858507201399999999999999999999996E-308) #f)
(test (infinite? (real-part inf+infi)) #t)
(test (infinite? (real-part 0+infi)) #f)
(test (infinite? (imag-part inf+infi)) #t)
(test (infinite? (imag-part 0+infi)) #t)

(test (infinite? (imag-part (complex 0.0 (real-part (log 0))))) #t)
(test (infinite? (real-part (complex 0.0 (real-part (log 0))))) #f)
(test (infinite? (complex 0.0 (real-part (log 0)))) #t)
(test (infinite? (real-part (complex (real-part (log 0)) 1.0))) #t)
(test (infinite? (imag-part (complex (real-part (log 0)) 1.0))) #f)
(test (infinite? (complex (real-part (log 0)) 1.0)) #t)
(test (infinite? (imag-part (complex (real-part (log 0)) (real-part (log 0))))) #t)
(test (infinite? (real-part (complex (real-part (log 0)) (real-part (log 0))))) #t)
(test (infinite? (complex (real-part (log 0)) (real-part (log 0)))) #t)

;; if mpc version > 0.8.2
;; (test (infinite? (sin 1+1e10i)) #t)
;; this hangs in earlier versions

(when with-bignums
  (test (infinite? (log (bignum "0.0"))) #t)
  (test (infinite? 1e310) #f)
  (test (infinite? 1e400) #f)
  (test (infinite? 1.695681258519314941339000000000000000003E707) #f)
  (test (infinite? 7151305879464824441563197685/828567267217721441067369971) #f))

(test (infinite?) 'error)
(test (infinite? 1 2) 'error)



;;; --------------------------------------------------------------------------------
;;; nan?
;;; --------------------------------------------------------------------------------
;;; (define (nan? x) (and (number? x) (not (= x x))))

(test (nan? +inf.0) #f)
(test (nan? -inf.0) #f)
(test (nan? nan.0) #t)
(test (nan? pi) #f)
(test (nan? (imag-part 0+0/0i)) #t)
(test (nan? (imag-part (sinh 0+0/0i))) #t)
(test (nan? (imag-part (sinh 1-0/0i))) #t)
(test (nan? (log 10 0/0)) #t)
(test (nan? (* 0 inf.0)) #t)
(test (nan? (real-part nan+nani)) #t)
(test (nan? (imag-part nan+nani)) #t)
(test (nan? (real-part 0+nani)) #f)
(test (nan? (imag-part 0+nani)) #t)

(when with-bignums
  (test (nan? (bignum "1/0")) #t)
  (test (nan? 7151305879464824441563197685/828567267217721441067369971) #f)
  (test (nan? 1624540914719833702142058941.4) #f))

(test (nan?) 'error)
(test (nan? 1 2) 'error)

#|
(define digits (vector #\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9))

(do ((i 0 (+ i 1)))
    ((= i 10000))
  (let ((int-digits (random 80))
	(frac-digits (random 80))
	(exp-digits (+ 1 (random 5)))
	(signed (> (random 10) 5))
	(signed-exponent (> (random 10) 5)))
    (let ((str (make-string (+ 1 int-digits 1 frac-digits 2 exp-digits) #\space))
	  (j 0))

      (if signed
	  (begin
	    (set! (str j) #\-)
	    (set! j (+ j 1))))

      (do ((k 0 (+ k 1)))
	  ((= k int-digits))
	(set! (str j) (digits (random 10)))
	(set! j (+ j 1)))

      (set! (str j) #\.)
      (set! j (+ j 1))

       (do ((k 0 (+ k 1)))
	  ((= k frac-digits))
	(set! (str j) (digits (random 10)))
	(set! j (+ j 1)))

      (set! (str j) #\e)
      (set! j (+ j 1))

      (if signed-exponent
	  (begin
	    (set! (str j) #\-)
	    (set! j (+ j 1))))

      (do ((k 0 (+ k 1)))
	  ((= k exp-digits))
	 (if (< k 3)
	     (set! (str j) (digits (random 10)))
	     (set! (str j) (digits (random 4))))
	 (set! j (+ j 1)))

      (let ((num (string->number (substring str 0 j))))
	(if (or (nan? num)
		(infinite? num))
	    (format #t "~A: ~S -> ~A~%" (if (infinite? num) 'inf 'nan) str num)))
      )))
|#

;;; these all relate to inf/nan

(unless with-bignums
  (test (* 1e12000 1e12000) inf.0)
  (test (<= 0 inf.0 nan.0) #f)
  (test (<= 1 nan.0) #f)
  (test (<= nan.0 1) #f)
  (test (<= nan.0 inf.0) #f)
  (test (<= nan.0 nan.0) #f)
  (test (>= 1 nan.0) #f)
  (test (>= nan.0 1) #f)
  (test (>= nan.0 inf.0) #f)
  (test (>= nan.0 nan.0) #f)
  (test (floor inf.0) 'error)
  (test (inexact->exact (complex 1 inf.0)) 'error)
  (test (nan? (expt 0 nan.0)) #t)
  (test (nan? (expt 1 nan.0)) #t)
  (test (nan? (expt nan.0 inf.0)) #t)
  (test (nan? (expt nan.0 nan.0)) #t)
  (test (rationalize 1e19) 'error)
  (test (round inf.0) 'error)
  (test (truncate inf.0) 'error))

(num-test (/ -1 -inf.0 -9223372036854775808) 0.0)
(num-test (angle -inf.0) pi)
(num-test (angle inf.0) 0.0)
(num-test (atan inf.0) 1.5707963267949)
(num-test (atanh inf.0) 0+1.5707963267949i)
(num-test (tanh -inf.0) -1.0)
(num-test (tanh inf.0) 1.0)
(test (* -inf.0 inf.0) -inf.0)
(test (* inf.0) inf.0)
(test (+ 0 inf.0) inf.0)
(test (+ inf.0) inf.0)
(test (- -inf.0 inf.0) -inf.0)
(test (- 0 inf.0) -inf.0)
(test (- inf.0) -inf.0)
(test (/ 0 inf.0) 0.0)
(test (/ inf.0) 0.0)
(test (/ nan.0 0) 'error)
(test (< -inf.0 0.0) #t)
(test (< -inf.0 inf.0) #t)
(test (< -inf.0 inf.0) #t)
(test (< 0 inf.0 -inf.0) #f)
(test (< 0 inf.0) #t)
(test (< inf.0 -inf.0) #f)
(test (< nan.0 inf.0) #f)
(test (< nan.0 nan.0) #f)
(test (<= -inf.0 0.0 inf.0 inf.0) #t)
(test (<= -inf.0 inf.0) #t)
(test (<= 0 inf.0 -inf.0) #f)
(test (<= 0 inf.0) #t)
(test (= (* (+ inf.0 inf.0) -inf.0) -inf.0) #t)
(test (= (* -3.4 -inf.0) inf.0) #t)
(test (= (* -inf.0 -inf.0) inf.0) #t)
(test (= (* inf.0 -inf.0) -inf.0) #t)
(test (= (* inf.0 inf.0) inf.0) #t)
(test (= (+ 1 inf.0) inf.0) #t)
(test (= (+ inf.0 inf.0) inf.0) #t)
(test (= (- -inf.0) inf.0) #t)
(test (= (- 0.0 inf.0) -inf.0) #t)
(test (= (- inf.0) -inf.0) #t)
(test (= (/ 0.0 inf.0) 0.0) #t)
(test (= (abs -inf.0) inf.0) #t)
(test (= (abs inf.0) inf.0) #t)
(test (= (exp -inf.0) 0.0) #t)
(test (= (exp inf.0) inf.0) #t)
(test (= (exp most-negative-fixnum) 0.0) #t)
(test (= (exp most-positive-fixnum) inf.0) #t)
(test (= (expt -inf.0 0) 1.0) #t)
(test (= (expt 0.0 inf.0) 0.0) #t)
(test (= (expt 1 -inf.0) 1.0) #t)
(test (= (expt 1 inf.0) 1.0) #t)
(test (= (expt 2 -inf.0) 0.0) #t)
(test (= (expt inf.0 0) 1.0) #t)
(test (= (log inf.0) inf.0) #t)
(test (= (magnitude -inf.0) inf.0) #t)
(test (= (magnitude inf.0) inf.0) #t)
(if (not (provided? 'pure-s7)) (test (= (make-polar inf.0 0) inf.0) #t))
(test (= (complex 0 inf.0) (sqrt -inf.0)) #t)   ; (sqrt -inf.0) -> 0+infi !
(test (= (complex inf.0 0) inf.0) #t)
(test (= (max -inf.0 inf.0) inf.0) #t)
(test (= (min -inf.0 inf.0) -inf.0) #t)
(test (= (sqrt inf.0) inf.0) #t)
(test (infinite? (imag-part (sqrt -inf.0))) #t)
(test (= -inf.0 -inf.0) #t)
(test (= -inf.0 inf.0) #f)
(test (= -inf.0 inf.0) #f)
(test (= 0 inf.0 -inf.0) #f)
(test (= 0 inf.0) #f)
(test (= 0.0 nan.0) #f)
(test (= inf.0 0.0) #f)
(test (= inf.0 inf.0) #t)
(test (= inf.0 most-positive-fixnum) #f)
(test (= inf.0 nan.0) #f)
(test (nan? (real-part nan+nani)) #t) 
(test (= nan.0 inf.0) #f)
(test (nan? nan+nani) #t)
(test (nan? nan.0) #t)
(test (> -inf.0 inf.0) #f)
(test (> 0 inf.0 -inf.0) #f)
(test (> 0 inf.0) #f)
(test (> inf.0 0.0) #t)
(test (> inf.0 1.0e308) #t)
(test (> inf.0 most-positive-fixnum) #t)
(test (> nan.0 inf.0) #f)
(test (> nan.0 nan.0) #f)
(test (>= -inf.0 inf.0) #f)
(test (>= 0 inf.0) #f)
(test (>= inf.0 -inf.0 0.0) #f)
(test (abs inf.0) inf.0)
(test (acosh inf.0) inf.0)
(test (angle inf.0) 0.0)
(test (ash -inf.0 inf.0) 'error)
(test (ash nan.0 inf.0) 'error)
(test (ash nan.0 nan.0) 'error)
(test (asinh inf.0) inf.0)
(test (ceiling inf.0) 'error)
(test (ceiling nan.0) 'error)
(test (complex? nan+nani) #t)
(test (cosh inf.0) inf.0)
(test (even? inf.0) 'error)
(test (exact? (complex 1 inf.0)) #f)
(test (exp inf.0) inf.0)
(test (expt nan.0) 'error)
(test (floor inf.0) 'error)
(test (floor nan.0) 'error)
(test (gcd -inf.0 inf.0) 'error)
(test (gcd nan.0 inf.0) 'error)
(test (gcd nan.0 nan.0) 'error)
(test (imag-part (complex 1 inf.0)) inf.0)
(test (imag-part nan.0) 0.0)
(test (inexact? (complex 1 inf.0)) #t)
(test (infinite? 1 2) 'error)
(test (infinite?) 'error)
(test (lcm -inf.0 inf.0) 'error)
(test (lcm nan.0 inf.0) 'error)
(test (lcm nan.0 nan.0) 'error)
(test (lcm nan.0) 'error)
(test (log 8.0 inf.0) 0.0) 
(test (log inf.0) inf.0)
(test (logand -inf.0 inf.0) 'error)
(test (logand nan.0 inf.0) 'error)
(test (logand nan.0 nan.0) 'error)
(test (logior -inf.0 inf.0) 'error)
(test (logior nan.0 inf.0) 'error)
(test (logior nan.0 nan.0) 'error)
(test (lognot -inf.0) 'error)
(test (lognot nan.0) 'error)
(test (logbit? -inf.0 inf.0) 'error)
(test (logbit? nan.0 inf.0) 'error)
(test (logbit? nan.0 nan.0) 'error)
(test (logxor -inf.0 inf.0) 'error)
(test (logxor nan.0 inf.0) 'error)
(test (logxor nan.0 nan.0) 'error)
(test (magnitude inf.0) inf.0)
(test (random-state inf.0) 'error)
(test (random-state nan.0) 'error)
(test (max -inf.0 inf.0) inf.0)
(test (max 0 inf.0 -inf.0) inf.0)
(test (max 0 inf.0) inf.0)
(test (max inf.0) inf.0)
(test (min -inf.0 inf.0) -inf.0)
(test (min 0 inf.0 -inf.0) -inf.0)
(test (min 0 inf.0) 0)
(test (min inf.0) inf.0)
(test (nan? (* 0 nan.0)) #t)
(test (nan? (+ (values inf.0 -inf.0) inf.0)) #t)
(test (nan? (- -inf.0 -inf.0)) #t)
(test (nan? (- inf.0 inf.0)) #t)
(test (nan? (- nan.0 nan.0)) #t)
(test (nan? (- nan.0)) #t)
(test (nan? (* 0 (log 0))) #t)
(test (nan? (/ -1 nan.0 -inf.0)) #t)
(test (nan? (/ -inf.0 -inf.0)) #t)
(test (nan? (/ 0 nan.0)) #t)
;(test (nan? (/ 0 (log 0))) #t) ;why not just 0.0?
(test (nan? (/ inf.0 -inf.0)) #t)
(test (nan? (/ inf.0 inf.0)) #t)
(test (nan? (/ inf.0 nan.0)) #t)
(test (nan? (/ nan.0 inf.0)) #t)
(test (nan? (/ nan.0 nan.0)) #t)
(test (nan? (/ nan.0)) #t)
(test (nan? (abs nan.0)) #t)
;(test (nan? (acos inf.0)) #t)
(test (nan? (angle nan.0)) #t)
;(test (nan? (asin inf.0)) #t)
(test (nan? (asin nan.0)) #t)
(test (nan? (exp nan.0)) #t)
(test (nan? (imag-part (complex 0 nan.0))) #t)
(test (nan? (imag-part nan+nani)) #t)
(test (nan? (imag-part nan+nani)) #t)
(test (nan? (log 8.0 nan.0)) #t)
(test (nan? (log nan.0 nan.0)) #t)
(test (nan? (magnitude nan+nani)) #t)
(test (nan? (magnitude nan.0)) #t)
(test (nan? (make-polar -inf.0 inf.0)) #t)
(test (nan? (make-polar nan.0 0)) #t)
(test (nan? (complex nan.0 0)) #t)
(test (nan? (max 0 inf.0 nan.0)) #t)
(test (nan? (max 1 nan.0)) #t)
(test (nan? (min 0 inf.0 nan.0)) #t)
(test (nan? (min 1 nan.0)) #t)
;(test (nan? (modulo 1 inf.0)) #t)
;(test (nan? (modulo 1 nan.0)) #t)
;(test (nan? (modulo inf.0 1)) #t)
;(test (nan? (modulo nan.0 1)) #t)
(test (nan? (random nan.0)) #t)
(test (nan? (real-part (exp nan+nani))) #t)
(test (nan? (real-part (log nan+nani))) #t)
(test (nan? (real-part (log nan.0))) #t)
(test (nan? (real-part (complex -inf.0 0))) #f)
(test (nan? (real-part (sqrt nan.0))) #t)
(test (nan? (real-part nan+nani)) #t)
(test (nan? (sin -inf.0)) #t)
(test (nan? (sin inf.0)) #t)
(test (nan? (sin nan.0)) #t)
(test (nan? (string->number "nan.0")) #t)
(test (nan? -inf.0) #f)
(test (nan? 1 2) 'error)
(test (nan? inf.0) #f)
(test (nan? most-negative-fixnum) #f)
(test (nan? most-positive-fixnum) #f)
(test (nan?) 'error)
(test (negative? (/ (real-part (log 0.0)) (real-part (log 0.0)))) #f) ; and yet it prints as -nan.0
(test (number? nan+nani) #t)
(test (quotient 1 nan.0) 'error)
(test (quotient nan.0 1) 'error)
(test (random nan.0 inf.0) 'error)
(test (rationalize -inf.0) 'error)
(test (rationalize 0.5 inf.0) 0)
(test (rationalize 178978.5 -inf.0) 0)
(test (rationalize 178987.5 nan.0) 'error)
(test (rationalize 198797.5 inf.0) 0)
(test (rationalize inf.0) 'error)
(test (rationalize inf.0) 'error)
(test (rationalize nan.0 nan.0) 'error)
(test (rationalize nan.0) 'error)
(test (rationalize nan.0) 'error)
(test (real-part (complex 1 inf.0)) 1.0)
(test (real? nan+nani) #f)
(test (remainder 1 nan.0) 'error)
(test (remainder nan.0 1) 'error)
(test (round inf.0) 'error)
(test (round nan.0)'error)
(test (sinh inf.0) inf.0)
(test (sqrt inf.0) inf.0)
(test (tanh inf.0) 1.0)
(test (truncate inf.0) 'error)
(test (truncate nan.0) 'error)
(test (zero? (complex 1 inf.0)) #f)
(test (zero? (real-part (complex 0 -inf.0))) #t)
(test (zero? 0/0) #f)
(test (zero? inf.0) #f)
(test (zero? nan.0) #f)
;; (test (nan? (angle nan.0)) #t)
;; but (* 0 (expt 10 310)) -> -nan if not GMP -- is this a bug?
;;(atanh -inf.0) 0+1.5707963267949i
;;(test (/ 0 inf.0 -inf.0) 0.0)
;;(test (= (expt 1 nan+nani) 1) #t) ; or maybe NaN?
;;(test (= (expt 1 nan.0) 1) #t)
;;(test (= (expt 2 inf.0) inf.0) #t)
;;(test (= (expt inf.0 -inf.0) 0.0) #t)
;;(test (= (expt inf.0 inf.0) inf.0) #t)
;;(test (= (expt nan.0 0) 1.0) #t) ;hmmm
;;(test (= (expt nan.0 nan.0) 0) #t)
;;(test (>= 0 inf.0 -inf.0) #t)
;;(test (angle (complex 1 inf.0)) 1.5707963267949)
;;(test (atanh (complex 1 inf.0)) -0+1.5707963267949i)
;;(test (nan? (atan -inf.0 inf.0)) #t) ; ??
;;(test (nan? (expt 0 inf.0)) #t)
;;(test (nan? (quotient -inf.0 inf.0)) #t)
;;(test (nan? (quotient 1 nan.0)) #t)
;;(test (nan? (quotient nan.0 1)) #t)
;;(test (nan? (quotient nan.0 inf.0)) #t)
;;(test (nan? (quotient nan.0 nan.0)) #t)
;;(test (tan (complex 1 inf.0)) 0+1i)
;;(log nan.0 0) (log 0 inf.0) (log 0 -inf.0) 

(for-each
 (lambda (x)
   (test (infinite? x) 'error)
   (test (nan? x) 'error))
 (list #\a "hi" #f #(1 2) () '(1 . 2) _ht_ _undef_ _null_ _c_obj_ 'hi abs #<eof> #<unspecified>))

(for-each
 (lambda (n)
   (test (infinite? n) #f)
   (test (nan? n) #f))
 (list 0.0 -0.0 .1 1+i 0-i 1/10))

(for-each
 (lambda (op)
   (test (number? (op inf.0)) #t)
   (test (number? (op -inf.0)) #t)
   (test (number? (op nan.0)) #t))
 (list magnitude abs exp angle sin cos tan sinh cosh tanh atan sqrt log asinh acosh atanh acos asin
       real-part imag-part exact->inexact))

(for-each
 (lambda (op)
   (test (op inf.0) 'error)
   (test (op -inf.0) 'error)
   (test (op nan.0) 'error))
 (list floor ceiling truncate round))

(for-each
 (lambda (op)
   (test (number? (op inf.0 inf.0)) #t)
   (test (number? (op nan.0 -inf.0)) #t))
 (list + - * / expt complex make-polar))

(for-each
 (lambda (op)
   (test (boolean? (op inf.0)) #t)
   (test (boolean? (op nan.0)) #t)
   (test (op) 'error))
 (list number? integer? real? complex? rational? zero? positive? negative? inexact? exact?))

(for-each
 (lambda (op)
   (test (boolean? (op inf.0 -inf.0)) #t)
   (test (boolean? (op nan.0 -inf.0)) #t))
 (list  = < > <= >=))

(for-each
 (lambda (op)
   (test (op inf.0) 'error)
   (test (op nan.0) 'error))
 (list even? odd? numerator denominator lcm gcd inexact->exact
       logior logxor logand lognot logbit? ash integer-length))

(let ((d1 1e-312)
      (d2 1e-316)
      (d3 1e-320))
  (when (not (zero? d3))
    (when (not with-bignums) 
      (test (= d1 d2 d3) #f)
      (test (not (= d2 (* 2 d1))) #t))
    (test (< d1 d2 d3) #f)
    (test (> d1 d2 d3) #t)
    (test (rationalize d1) 0)
    (test (rationalize d3) 0)
    (test (rationalize (- d1)) 0)
    (num-test (string->number (number->string d1)) d1)
    
    (test (< (sin d3) (sin d2) (sin d1)) #t)
    (test (< (log d3) (log d2) (log d1)) #t)
    (test (< (abs d3) (abs d2) (abs d1)) #t)
    (test (< (sqrt d3) (sqrt d2) (sqrt d1)) #t)
    (test (<= (exp d3) (exp d2) (exp d3)) #t) ; all might be 1.0
    ))




;;; --------------------------------------------------------------------------------
;;; zero?
;;; --------------------------------------------------------------------------------

(test (zero? 0) #t )
(test (zero? 0/1) #t )
(test (zero? -0) #t )
(test (zero? -0.0) #t )
(test (zero? 0.0) #t )
(test (zero? 1) #f )
(test (zero? -1) #f )
(test (zero? -100) #f )
(test (zero? -0/4) #t)
(test (zero? 0+0i) #t)
(test (zero?) 'error)
(test (zero? "hi") 'error)
(test (zero? 1.0+23.0i 1.0+23.0i) 'error)
(test (zero? 0+i) #f)
(test (zero? 0-0i) #t)
(test (zero? 0.0-0.0i) #t)
(test (zero? +0.0) #t)
(test (zero? 1e-20) #f)
(test (zero? -1.797693134862315699999999999999999999998E308) #f)
(test (zero? -2.225073858507201399999999999999999999996E-308) #f)
(test (zero? 2.2250738585072012e-308) #f) ; gauche says one of these can hang
(test (zero? 2.2250738585072013e-308) #f) 
(test (zero? 2.2250738585072014e-308) #f) 
(test (zero? 2.2250738585072015e-308) #f) 
(test (zero? 2.2250738585072011e-308) #f)
(test (zero? 2.2250738585072010e-308) #f)
(test (zero? 2.2250738585072010e-309) #f)
(test (zero? 2.2250738585072010e-310) #f)
(test (zero? -9223372036854775808) #f)
(test (zero? 1.110223024625156799999999999999999999997E-16) #f)
(test (zero? 9223372036854775807) #f)
(test (zero? +inf.0) #f)
(test (zero? -inf.0) #f)
(test (zero? nan.0) #f)
(test (zero? pi) #f)
(test (zero? -1/9223372036854775807) #f)
(test (zero? 1/2) #f)
(test (zero? 0-i) #f)
(test (zero? 0.00001) #f)
(test (zero? most-negative-fixnum) #f)
(test (zero? most-positive-fixnum) #f)
(test (zero? 18446744073709551616) #f)
(test (zero? (* 0 most-positive-fixnum most-positive-fixnum)) #t)
(test (zero? (* 0.0 most-positive-fixnum most-positive-fixnum)) #t)
(test (zero? (* most-positive-fixnum most-negative-fixnum 0)) #t)
(test (zero? (* most-positive-fixnum most-negative-fixnum 0.0)) #t)
(test (zero? 1000000000000000000000000000000000) #f)
(test (zero? 000000000000000000000000000000000) #t)

(when with-bignums 
  (test (zero? (- (expt 2.3 54) (floor (expt 2.3 54)))) #f)
  (test (zero? 1e-600) #f)
  (test (zero? 9.92209574402351949043519108941671096176E-1726) #f)
  (test (zero? 12345678901234567890) #f)
  (test (zero? 9223372036854775808) #f)
  (test (zero? 9223372036854775808.1) #f)
  (test (zero? 9223372036854775808.1+1.5i) #f)
  (test (zero? 9223372036854775808/3) #f))

(test (zero?) 'error)
(test (zero? 1 2) 'error)
(test (zero? 0.@2211) #t)
(test (zero? 0@0) #t) ; ?? (expt 0 0) -> 1 but 0@0 -> 0.0 because (expt 0.0 0) -> 0.0?

(for-each
 (lambda (arg)
   (test (zero? arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))



;;; --------------------------------------------------------------------------------
;;; positive?
;;; --------------------------------------------------------------------------------

(test (positive? 4/3) #t )
(test (positive? 4) #t )
(test (positive? -4) #f )
(test (positive? -4/3) #f )
(test (positive? 0) #f )
(test (positive? 0.0) #f )
(test (positive? -0) #f )
(test (positive? 1-0.0i) #t)
(test (positive? 1.0) #t)
(test (positive? -1.797693134862315699999999999999999999998E308) #f)
(test (positive? -2.225073858507201399999999999999999999996E-308) #f)
(test (positive? -9223372036854775808) #f)
(test (positive? 1.110223024625156799999999999999999999997E-16) #t)
(test (positive? 9223372036854775807) #t)
(test (positive? most-negative-fixnum) #f)
(test (positive? most-positive-fixnum) #t)
(test (positive? +inf.0) #t)
(test (positive? -inf.0) #f)
(test (positive? nan.0) #f)

(for-each
 (lambda (n)
   (if (not (positive? n))
       (format #t ";(positive? ~A) -> #f?~%") n))
 (list 1 123 123456123 1.4 0.001 1/2 124124124.2))

(for-each
 (lambda (n)
   (if (positive? n)
       (format #t ";(positive? ~A) -> #t?~%" n)))
 (list -1 -123 -123456123 -3/2 -0.00001 -1.4 -123124124.1))

(when with-bignums
  (test (positive? 1000000000000000000000000000000000) #t)
  (test (positive? -1000000000000000000000000000000000) #f)
  (test (positive? 9.92209574402351949043519108941671096176E-1726) #t)
  (test (positive? 12345678901234567890) #t)
  (test (positive? -12345678901234567890) #f)
  (test (positive? 9223372036854775808) #t)
  (test (positive? 9223372036854775808.1) #t)
  (test (positive? 9223372036854775808/3) #t)
  (test (positive? (/ most-positive-fixnum most-negative-fixnum)) #f)
  (test (positive? 0+92233720368547758081.0i) 'error))

(test (positive? 1.23+1.0i) 'error)
(test (positive? 1.23 1.23) 'error)
(test (positive?) 'error)
(test (positive? 1 2) 'error)

(for-each
 (lambda (arg)
   (test (positive? arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))



;;; --------------------------------------------------------------------------------
;;; negative?
;;; --------------------------------------------------------------------------------

(test (negative? 4) #f )
(test (negative? 4/3) #f )
(test (negative? -4) #t )
(test (negative? -4/3) #t )
(test (negative? -0/4) #f)
(test (negative? 0) #f )
(test (negative? -0) #f )
(test (negative? 0.0) #f )
(test (negative? -0.0) #f )
(test (negative? (- 0.0)) #f )
(test (negative? (expt -0.0 1)) #f)
(test (negative? (/ -0.0 1.0)) #f)
(test (negative? (* -0.0 1.0)) #f)
(test (negative?) 'error)
(test (negative? 1-0i) #f)
(test (negative? -1.797693134862315699999999999999999999998E308) #t)
(test (negative? -2.225073858507201399999999999999999999996E-308) #t)
(test (negative? -9223372036854775808) #t)
(test (negative? 1.110223024625156799999999999999999999997E-16) #f)
(test (negative? 9223372036854775807) #f)
(test (negative? most-negative-fixnum) #t)
(test (negative? most-positive-fixnum) #f)
(test (negative? +inf.0) #f)
(test (negative? -inf.0) #t)
(test (negative? nan.0) #f)
(test (negative? most-negative-fixnum) #t)
(test (negative? most-positive-fixnum) #f)

;; (negative? -1/0): #f? (positive? 1/0) is also #f, but (negative? -nan.0): #f (guile agrees) -- so what's the point of -nan.0??
;;    chibi says (negative? -nan.0) #t, but (positive? +nan.0) #f??

(for-each
 (lambda (n)
   (if (negative? n)
       (format #t ";(negative? ~A) -> #t?~%" n)))
 (list 1 123 123456123 1.4 0.001 1/2 12341243124.2))

(for-each
 (lambda (n)
   (if (not (negative? n))
       (format #t ";(negative? ~A) -> #f?~%" n)))
 (list -1 -123 -123456123 -2/3 -0.00001 -1.4 -123124124.1))

(let ((val1 (catch #t (lambda () (negative? 0.0)) (lambda args 'error)))
      (val2 (catch #t (lambda () (negative? -0.0)) (lambda args 'error))))
  (test (equal? val1 val2) #t))

(when with-bignums
  (test (negative? 1000000000000000000000000000000000) #f)
  (test (negative? -1000000000000000000000000000000000) #t)
  (test (negative? -9.92209574402351949043519108941671096176E-1726) #t)
  (test (negative? 12345678901234567890) #f)
  (test (negative? -12345678901234567890) #t)
  (test (negative? 9223372036854775808) #f)
  (test (negative? 9223372036854775808.1) #f)
  (test (negative? 9223372036854775808/3) #f)
  (test (negative? 0+92233720368547758081.0i) 'error))

(test (negative? -1-i) 'error)
(test (negative? 1.23+1.0i) 'error)
(test (negative? 1.23 1.23) 'error)
(test (negative?) 'error)
(test (negative? 1 2) 'error)

(for-each
 (lambda (arg)
   (test (negative? arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))




;;; --------------------------------------------------------------------------------
;;; odd?
;;; --------------------------------------------------------------------------------

(test (odd? 3) #t )
(test (odd? 2) #f )
(test (odd? -4) #f )
(test (odd? -1) #t )
(test (odd? 0) #f)
(test (odd? -0) #f)
(test (odd? -9223372036854775808) #f)
(test (odd? 9223372036854775807) #t)
(test (odd? most-positive-fixnum) #t)
(test (odd? most-negative-fixnum) #f)
(test (odd? -2147483647) #t)
(test (odd? -2147483648) #f)
(test (odd? -2147483649) #t)
(test (odd? 2147483647) #t)
(test (odd? 2147483648) #f)
(test (odd? 2147483649) #t)

(for-each
 (lambda (n)
   (if (odd? n)
       (format #t ";(odd? ~A) -> #t?~%" n)))
 (list 0 2 1234 -4 -10000002 1000000006))

(for-each
 (lambda (n)
   (if (not (odd? n))
       (format #t ";(odd? ~A) -> #f?~%" n)))
 (list 1 -1 31 50001 543321))

(when with-bignums
  (test (odd? 12345678901234567891) #t)
  (test (odd? 12345678901234567890) #f)
  (test (odd? -1231234567891234567891) #t)
  (test (odd? -1231234567891234567891) #t)
  (test (odd? -1239223372036854775808) #f)
  (test (odd? -9223372036854775808) #f)
  (test (odd? 1231234567891234567891) #t)
  (test (odd? 1234567891234567891) #t)
  (test (odd? 1239223372036854775808) #f)
  (test (odd? 9223372036854775808) #f)
  (test (odd? 9223372036854775808/9223372036854775807) 'error)
  (test (odd? 0+92233720368547758081.0i) 'error))

(test (odd?) 'error)
(test (odd? 1.23) 'error)
(test (odd? 1.0) 'error)
(test (odd? 1+i) 'error)
(test (odd? 123 123) 'error)
(test (odd? inf.0) 'error)
(test (odd? nan.0) 'error)
(test (odd? 1/2) 'error)

(for-each
 (lambda (arg)
   (test (odd? arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))



;;; --------------------------------------------------------------------------------
;;; even?
;;; --------------------------------------------------------------------------------

(test (even? 3) #f )
(test (even? 2) #t )
(test (even? -4) #t )
(test (even? -1) #f )
(test (even? -0) #t)
(test (even? -9223372036854775808) #t)
(test (even? 9223372036854775807) #f)
(test (even? most-positive-fixnum) #f)
(test (even? most-negative-fixnum) #t)
(test (even? -2147483647) #f)
(test (even? -2147483648) #t)
(test (even? -2147483649) #f)
(test (even? 2147483647) #f)
(test (even? 2147483648) #t)
(test (even? 2147483649) #f)

(for-each
 (lambda (n)
   (if (not (even? n))
       (format #t ";(even? ~A) -> #f?~%" n)))
 (list 0 2 1234 -4 -10000002 1000000006))

(for-each
 (lambda (n)
   (if (even? n)
       (format #t ";(even? ~A) -> #t?~%" n)))
 (list 1 -1 31 50001 543321))

(let ((top-exp 60))
  (let ((happy #t))
    (do ((i 2 (+ i 1)))
	((or (not happy) (> i top-exp)))
      (let* ((val1 (+ 2 (inexact->exact (expt 2 i))))
	     (val2 (- val1 1))
	     (ev1 (even? val1))
	     (ov1 (odd? val1))
	     (ev2 (even? val2))
	     (ov2 (odd? val2)))
	(if (not ev1)
	    (begin (set! happy #f) (display "not (even? ") (display val1) (display ")?") (newline)))
	(if ev2
	    (begin (set! happy #f) (display "(even? ") (display val2) (display ")?") (newline)))
	(if ov1
	    (begin (set! happy #f) (display "(odd? ") (display val1) (display ")?") (newline)))
	(if (not ov2)
	    (begin (set! happy #f) (display "not (odd? ") (display val2) (display ")?") (newline)))))))

(when with-bignums
  (test (even? 12345678901234567890) #t)
  (test (even? 12345678901234567891) #f)
  (test (even? -1231234567891234567891) #f)
  (test (even? -1234567891234567891) #f)
  (test (even? -1239223372036854775808) #t)
  (test (even? -9223372036854775808) #t)
  (test (even? 1231234567891234567891) #f)
  (test (even? 1234567891234567891) #f)
  (test (even? 1239223372036854775808) #t)
  (test (even? 9223372036854775808) #t)
  (test (even? 9223372036854775808/9223372036854775807) 'error)
  (test (even? 0+92233720368547758081.0i) 'error))

(test (even?) 'error)
(test (even? 1.23) 'error)
(test (even? 1.0) 'error)
(test (even? 123 123) 'error)
(test (even? 1+i) 'error)
(test (even? 1+0i) 'error)
(test (even? inf.0) 'error)
(test (even? nan.0) 'error)
(test (even? 1/2) 'error)

(for-each
 (lambda (arg)
   (test (even? arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))




;;; --------------------------------------------------------------------------------
;;; exact?
;;; --------------------------------------------------------------------------------

(test (exact? 1/0) #f)
(test (exact? '0/1) #t)
(test (exact? (/ 1 2)) #t)
(test (exact? -0) #t)
(test (exact? -1.797693134862315699999999999999999999998E308) #f)
(test (exact? -2.225073858507201399999999999999999999996E-308) #f)
(test (exact? -9223372036854775808) #t)
(test (exact? 0/0) #f)
(test (exact? 0/1) #t)
(test (exact? 1.0) #f)
(test (exact? 1.110223024625156799999999999999999999997E-16) #f)
(test (exact? 1.5+0.123i) #f)
(test (exact? 1/2) #t)
(test (exact? 3) #t )
(test (exact? 3.123) #f)
(test (exact? 9223372036854775807) #t)
(test (exact? most-positive-fixnum) #t)
(test (exact? pi) #f)
(test (exact? +inf.0) #f)
(test (exact? -inf.0) #f)
(test (exact? nan.0) #f)
(test (exact? (imag-part 1+0i)) #f)
(test (exact? (imag-part 1+0.0i)) #f)
(test (exact? (imag-part 1+1i)) #f)

(when with-bignums
  (test (exact? 12345678901234567890) #t)
  (test (exact? 9223372036854775808.1) #f)
  (test (exact? 9223372036854775808) #t)
  (test (exact? 9223372036854775808/3) #t)
  (test (exact? 9223372036854775808.1+1.0i) #f))

(test (exact?) 'error)
(test (exact? "hi") 'error)
(test (exact? 1.0+23.0i 1.0+23.0i) 'error)

(for-each
 (lambda (arg)
   (test (exact? arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))



;;; --------------------------------------------------------------------------------
;;; inexact?
;;; --------------------------------------------------------------------------------

(test (inexact? -1) #f)
(test (inexact? -1.797693134862315699999999999999999999998E308) #t)
(test (inexact? -2.225073858507201399999999999999999999996E-308) #t)
(test (inexact? -9223372036854775808) #f)
(test (inexact? 1.0) #t)
(test (inexact? 1.110223024625156799999999999999999999997E-16) #t)
(test (inexact? 1.5+0.123i) #t)
(test (inexact? 1/2) #f)
(test (inexact? 3) #f)
(test (inexact? 3.123) #t)
(test (inexact? 9223372036854775807) #f)
(test (inexact? +inf.0) #t)
(test (inexact? -inf.0) #t)
(test (inexact? nan.0) #t)

(when with-bignums
  (test (inexact? 12345678901234567890) #f)
  (test (inexact? 9223372036854775808.1) #t)
  (test (inexact? 9223372036854775808) #f)
  (test (inexact? 9223372036854775808/3) #f)
  (test (inexact? 9223372036854775808.1+1.0i) #t))

(test (inexact? "hi") 'error)
(test (inexact? 1.0+23.0i 1.0+23.0i) 'error)
(test (inexact?) 'error)

(for-each
 (lambda (arg)
   (test (inexact? arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))




;;; --------------------------------------------------------------------------------
;;; exact->inexact
;;; --------------------------------------------------------------------------------

(num-test (exact->inexact 0+1.5i) 0+1.5i)
(num-test (exact->inexact 1) 1.0)
(num-test (exact->inexact 1.0) 1.0)
(num-test (exact->inexact 3/2) 1.5)
(num-test (exact->inexact -3/2) -1.5)
(test (infinite? (exact->inexact inf.0)) #t)
(test (nan? (exact->inexact nan.0)) #t)
(num-test (exact->inexact most-positive-fixnum) 9.223372036854775807E18)
(num-test (exact->inexact most-negative-fixnum) -9.223372036854775808E18)

(num-test (exact->inexact 17/12) 1.416666666666666666666666666666666666665E0)
(num-test (exact->inexact 41/29) 1.413793103448275862068965517241379310344E0)
(num-test (exact->inexact 99/70) 1.414285714285714285714285714285714285714E0)
(num-test (exact->inexact 577/408) 1.414215686274509803921568627450980392157E0)
(num-test (exact->inexact 1393/985) 1.414213197969543147208121827411167512692E0)
(num-test (exact->inexact 3363/2378) 1.414213624894869638351555929352396972245E0)
(num-test (exact->inexact 19601/13860) 1.414213564213564213564213564213564213564E0)
(num-test (exact->inexact 47321/33461) 1.414213562057320462628134245838438779476E0)
(num-test (exact->inexact 114243/80782) 1.414213562427273402490653858532841474586E0)
(num-test (exact->inexact 275807/195025) 1.414213562363799512882963722599666709396E0)
(num-test (exact->inexact 1607521/1136689) 1.414213562372821413772808569450394962913E0)
(num-test (exact->inexact 3880899/2744210) 1.414213562373141997150363856993451667326E0)
(num-test (exact->inexact 9369319/6625109) 1.414213562373086993738518113437831739826E0)
(num-test (exact->inexact 54608393/38613965) 1.414213562373094811682768138418315757008E0)
(num-test (exact->inexact 131836323/93222358) 1.414213562373095089484863706193743779791E0)
(num-test (exact->inexact 318281039/225058681) 1.414213562373095041821559418096829599746E0)
(num-test (exact->inexact 1855077841/1311738121) 1.414213562373095048596212902163571413046E0)
(num-test (exact->inexact 4478554083/3166815962) 1.414213562373095048836942801793292211529E0)

(num-test (exact->inexact -1.797693134862315699999999999999999999998E308) -1.797693134862315699999999999999999999998E308)
(num-test (exact->inexact -2.225073858507201399999999999999999999996E-308) -2.225073858507201399999999999999999999996E-308)
(num-test (exact->inexact -9223372036854775808) -9.223372036854775808E18)
(num-test (exact->inexact 1.110223024625156799999999999999999999997E-16) 1.110223024625156799999999999999999999997E-16)
(num-test (exact->inexact 9223372036854775807) 9.223372036854775807E18)

(num-test (exact->inexact 9007199254740991) 9.007199254740991E15)
(test (= (exact->inexact 9007199254740992) (exact->inexact 9007199254740991)) #f)

(when with-bignums 
  (num-test (truncate (exact->inexact most-positive-fixnum)) 9223372036854775807)
  (test (= (exact->inexact 9007199254740993) (exact->inexact 9007199254740992)) #f)
  (num-test (exact->inexact 73786976294838206464) (expt 2.0 66))
  (num-test (exact->inexact (bignum "0+1.5i")) 0+1.5i)
  (test (< (abs (- (expt 2 66.5) (exact->inexact 19459393535087060477929284/186481))) 1e-9) #t)
  (test (< (abs (- (exact->inexact -186198177976134811212136169603791619/103863) (- (expt 2 100.5)))) 1e-9) #t))

(test (exact->inexact "hi") 'error)
(test (exact->inexact 1.0+23.0i 1.0+23.0i) 'error)
(test (exact->inexact) 'error)

(for-each
 (lambda (arg)
   (test (exact->inexact arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))

(test (integer? (* 0 1.0)) #f) ; s7.html check -- we want 0.0 here, not 0 [for exact->inexact replacement code]
(test (rational? (* 1.0 0)) #f)



;;; --------------------------------------------------------------------------------
;;; inexact->exact
;;; --------------------------------------------------------------------------------

(num-test (inexact->exact 0.0) 0)
(num-test (inexact->exact 1) 1)
(num-test (inexact->exact 1.0) 1)
(num-test (inexact->exact 1.5) 3/2)
(test (inexact->exact most-negative-fixnum) most-negative-fixnum)

(num-test (inexact->exact 1.0000000000000000000000000000+0.0000000000000000000000000000i) 1)
(num-test (inexact->exact 1.0+0.0000000000000000000000000000i) 1)
(num-test (inexact->exact 1.0000000000000000000000000000+0.0i) 1)
(num-test (inexact->exact 1.0000000000000000000000000000+0e10i) 1)
(num-test (inexact->exact 1.0+0.0000000000000000000000000000e10i) 1)
(num-test (inexact->exact 1.0000000000000000000000000000+0.0e10i) 1)
(num-test (inexact->exact -2.225073858507201399999999999999999999996E-308) 0)
(num-test (inexact->exact -9223372036854775808) -9223372036854775808)
(num-test (inexact->exact 1.110223024625156799999999999999999999997E-16) 0)
(num-test (inexact->exact 9223372036854775807) 9223372036854775807)
(num-test (inexact->exact -2305843009213693952/4611686018427387903) -2305843009213693952/4611686018427387903)

;(num-test (inexact->exact 9007199254740995.0) 9007199254740995)
;this can't work in the non-gmp case -- see s7.c under BIGNUM_PLUS

(if with-bignums
    (begin
      (num-test (inexact->exact .1e20) 10000000000000000000)
      (num-test (inexact->exact 1e19) 10000000000000000000)
      (num-test (inexact->exact 1e20) 100000000000000000000)
      (num-test (inexact->exact 9007199254740995.0) 9007199254740995)
      (num-test (inexact->exact 4611686018427388404.0) 4611686018427388404)
      (test (inexact->exact (bignum "0+1.5i")) 'error))
    (begin
      (test (inexact->exact 1.1e54) 'error)
      (test (inexact->exact 1.1e564) 'error)
      (test (inexact->exact .1e20) 'error)
      (test (inexact->exact 1e19) 'error)
      (test (inexact->exact 1e20) 'error)))

(test (inexact->exact inf.0) 'error)
(test (inexact->exact nan.0) 'error)
(test (inexact->exact "hi") 'error)
(test (inexact->exact 0+1.5i) 'error)
(test (inexact->exact 1+i) 'error)
(test (inexact->exact 1.0+23.0i 1.0+23.0i) 'error)
(test (inexact->exact) 'error)

(for-each
 (lambda (arg)
   (test (inexact->exact arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))




;;; --------------------------------------------------------------------------------
;;; numerator
;;; --------------------------------------------------------------------------------

(num-test (numerator (/ 8 -6)) -4)
(num-test (numerator -1/10) -1)
(num-test (numerator -1/1234000000) -1)
(num-test (numerator -1/2) -1)
(num-test (numerator -1/362880) -1)
(num-test (numerator -10/1) -10)
(num-test (numerator -10/1234) -5)
(num-test (numerator -10/3) -10)
(num-test (numerator -10/500029) -10)
(num-test (numerator -1234/10) -617)
(num-test (numerator -1234/1234000000) -1)
(num-test (numerator -1234/2) -617)
(num-test (numerator -1234/362880) -617)
(num-test (numerator -1234000000/1) -1234000000)
(num-test (numerator -1234000000/1234) -1000000)
(num-test (numerator -1234000000/3) -1234000000)
(num-test (numerator -1234000000/500029) -1234000000)
(num-test (numerator -2/1) -2)
(num-test (numerator -2/1234) -1)
(num-test (numerator -2/3) -2)
(num-test (numerator -2/500029) -2)
(num-test (numerator -2/6) -1)
(num-test (numerator -3/10) -3)
(num-test (numerator -3/1234000000) -3)
(num-test (numerator -3/2) -3)
(num-test (numerator -3/362880) -1)
(num-test (numerator -362880/1) -362880)
(num-test (numerator -362880/1234) -181440)
(num-test (numerator -362880/3) -120960)
(num-test (numerator -362880/500029) -362880)
(num-test (numerator -500029/10) -500029)
(num-test (numerator -500029/1234000000) -500029)
(num-test (numerator -500029/2) -500029)
(num-test (numerator -500029/362880) -500029)
(num-test (numerator 0/1) 0)
(num-test (numerator 0/10) 0)
(num-test (numerator 0/1234) 0)
(num-test (numerator 0/1234000000) 0)
(num-test (numerator 0/2) 0)
(num-test (numerator 0/3) 0)
(num-test (numerator 0/362880) 0)
(num-test (numerator 0/500029) 0)
(num-test (numerator 1) 1)
(num-test (numerator 1/1) 1)
(num-test (numerator 1/1234) 1)
(num-test (numerator 1/3) 1)
(num-test (numerator 1/500029) 1)
(num-test (numerator 10/10) 1)
(num-test (numerator 10/1234000000) 1)
(num-test (numerator 10/2) 5)
(num-test (numerator 10/362880) 1)
(num-test (numerator 12/6000996) 1)
(num-test (numerator 1234/1) 1234)
(num-test (numerator 1234/1234) 1)
(num-test (numerator 1234/3) 1234)
(num-test (numerator 1234/500029) 1234)
(num-test (numerator 1234000000/10) 123400000)
(num-test (numerator 1234000000/1234000000) 1)
(num-test (numerator 1234000000/2) 617000000)
(num-test (numerator 1234000000/362880) 1928125)
(num-test (numerator 2/10) 1)
(num-test (numerator 2/1234000000) 1)
(num-test (numerator 2/2) 1)
(num-test (numerator 2/3) 2)
(num-test (numerator 2/362880) 1)
(num-test (numerator 2/4) 1)
(num-test (numerator 3/1) 3)
(num-test (numerator 3/1234) 3)
(num-test (numerator 3/3) 1)
(num-test (numerator 3/500029) 3)
(num-test (numerator 362880/10) 36288)
(num-test (numerator 362880/1234000000) 567)
(num-test (numerator 362880/2) 181440)
(num-test (numerator 362880/362880) 1)
(num-test (numerator 5/2) 5)
(num-test (numerator 500029/1) 500029)
(num-test (numerator 500029/1234) 500029)
(num-test (numerator 500029/3) 500029)
(num-test (numerator 500029/500029) 1)
(num-test (numerator -9223372036854775808) -9223372036854775808)
(num-test (numerator 9223372036854775807) 9223372036854775807)
(num-test (numerator (/ 2 -1)) -2)
(num-test (numerator (/ most-positive-fixnum 2)) most-positive-fixnum)
(num-test (numerator (/ most-negative-fixnum 3)) most-negative-fixnum)
(num-test (numerator (/ most-negative-fixnum most-positive-fixnum)) most-negative-fixnum)

(when with-bignums
  (num-test (numerator 1195068768795265792518361315725116351898245581/48889032896862784894921) 24444516448431392447461)
  (num-test (numerator 24444516448431392447461/1195068768795265792518361315725116351898245581) 1)
  (num-test (numerator -46116860184273879035/27670116110564327424) -46116860184273879035)
  (num-test (numerator (/ 9223372036854775808 -9223372036854775807)) -9223372036854775808)
  (num-test (numerator 1234567891234567890/1234567) 1234567891234567890)
  (num-test (numerator 9223372036854775808/9223372036854775807) 9223372036854775808)
  (test (numerator 0+92233720368547758081.0i) 'error))

(test (numerator 0.0) 'error) ; guile thinks this is ok
(test (numerator 1.23 1.23) 'error)
(test (numerator 1.23+1.0i) 'error)
(test (numerator) 'error)
(test (numerator inf.0) 'error)
(test (numerator nan.0) 'error)
(test (numerator "hi") 'error)
(test (numerator 1+i) 'error)
(test (numerator 2.3+0.5i) 'error)

(for-each
 (lambda (arg)
   (test (numerator arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))




;;; --------------------------------------------------------------------------------
;;; denominator
;;; --------------------------------------------------------------------------------

(num-test (denominator (/ 8 -6)) 3)
(num-test (denominator -1/10) 10)
(num-test (denominator -1/1234000000) 1234000000)
(num-test (denominator -1/2) 2)
(num-test (denominator -1/362880) 362880)
(num-test (denominator -10/1) 1)
(num-test (denominator -10/1234) 617)
(num-test (denominator -10/3) 3)
(num-test (denominator -10/500029) 500029)
(num-test (denominator -1234/10) 5)
(num-test (denominator -1234/1234000000) 1000000)
(num-test (denominator -1234/2) 1)
(num-test (denominator -1234/362880) 181440)
(num-test (denominator -1234000000/1) 1)
(num-test (denominator -1234000000/1234) 1)
(num-test (denominator -1234000000/3) 3)
(num-test (denominator -1234000000/500029) 500029)
(num-test (denominator -2/1) 1)
(num-test (denominator -2/1234) 617)
(num-test (denominator -2/3) 3)
(num-test (denominator -2/500029) 500029)
(num-test (denominator -2/6) 3)
(num-test (denominator -3/10) 10)
(num-test (denominator -3/1234000000) 1234000000)
(num-test (denominator -3/2) 2)
(num-test (denominator -3/362880) 120960)
(num-test (denominator -362880/1) 1)
(num-test (denominator -362880/1234) 617)
(num-test (denominator -362880/3) 1)
(num-test (denominator -362880/500029) 500029)
(num-test (denominator -500029/10) 10)
(num-test (denominator -500029/1234000000) 1234000000)
(num-test (denominator -500029/2) 2)
(num-test (denominator -500029/362880) 362880)
(num-test (denominator 0) 1)
(num-test (denominator 0/1) 1)
(num-test (denominator 0/10) 1)
(num-test (denominator 0/1234) 1)
(num-test (denominator 0/1234000000) 1)
(num-test (denominator 0/2) 1)
(num-test (denominator 0/3) 1)
(num-test (denominator 0/362880) 1)
(num-test (denominator 0/500029) 1)
(num-test (denominator 1) 1)
(num-test (denominator 1/1) 1)
(num-test (denominator 1/1234) 1234)
(num-test (denominator 1/3) 3)
(num-test (denominator 1/500029) 500029)
(num-test (denominator 10/10) 1)
(num-test (denominator 10/1234000000) 123400000)
(num-test (denominator 10/2) 1)
(num-test (denominator 10/362880) 36288)
(num-test (denominator 12/6000996) 500083)
(num-test (denominator 1234/1) 1)
(num-test (denominator 1234/1234) 1)
(num-test (denominator 1234/3) 3)
(num-test (denominator 1234/500029) 500029)
(num-test (denominator 1234000000/10) 1)
(num-test (denominator 1234000000/1234000000) 1)
(num-test (denominator 1234000000/2) 1)
(num-test (denominator 1234000000/362880) 567)
(num-test (denominator 2/10) 5)
(num-test (denominator 2/1234000000) 617000000)
(num-test (denominator 2/2) 1)
(num-test (denominator 2/3) 3)
(num-test (denominator 2/362880) 181440)
(num-test (denominator 2/4) 2)
(num-test (denominator 3/1) 1)
(num-test (denominator 3/1234) 1234)
(num-test (denominator 3/3) 1)
(num-test (denominator 3/500029) 500029)
(num-test (denominator 362880/10) 1)
(num-test (denominator 362880/1234000000) 1928125)
(num-test (denominator 362880/2) 1)
(num-test (denominator 362880/362880) 1)
(num-test (denominator 5/2) 2)
(num-test (denominator 500029/1) 1)
(num-test (denominator 500029/1234) 1234)
(num-test (denominator 500029/3) 3)
(num-test (denominator 500029/500029) 1)
(num-test (denominator -9223372036854775808) 1)
(num-test (denominator 9223372036854775807) 1)
(num-test (denominator (/ 2 -1)) 1)
(num-test (denominator (/ 1 most-positive-fixnum)) most-positive-fixnum)
(num-test (denominator (/ most-negative-fixnum most-positive-fixnum)) most-positive-fixnum)

(when with-bignums
  (num-test (denominator 1195068768795265792518361315725116351898245581/48889032896862784894921) 1)
  (num-test (denominator 24444516448431392447461/1195068768795265792518361315725116351898245581) 48889032896862784894921)
  (num-test (denominator -46116860184273879035/27670116110564327424) 27670116110564327424)
  (num-test (denominator (/ 9223372036854775808 -9223372036854775807)) 9223372036854775807)
  (num-test (denominator 1234567891234567890/1234567) 1234567)
  (num-test (denominator 9223372036854775808/9223372036854775807) 9223372036854775807)
  (test (denominator 0+92233720368547758081.0i) 'error))

(test (denominator 0.0) 'error)
(test (denominator 1.23 1.23) 'error)
(test (denominator 1.23+1.0i) 'error)
(test (denominator) 'error)
(test (denominator inf.0) 'error)
(test (denominator nan.0) 'error)
(test (denominator "hi") 'error)
(test (denominator 1+i) 'error)
(test (denominator 2.3+0.5i) 'error)

(for-each
 (lambda (arg)
   (test (denominator arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))




;;; --------------------------------------------------------------------------------
;;; real-part
;;; --------------------------------------------------------------------------------

(num-test (real-part -0.0+0.00000001i) 0.0)
(num-test (real-part -0.0+1234.0i) 0.0)
(num-test (real-part -0.0-3.14159265358979i) 0.0)
(num-test (real-part -0.00000001+1.0i) -0.00000001)
(num-test (real-part -0.00000001+1234000000.0i) -0.00000001)
(num-test (real-part -0.00000001-0.0i) -0.00000001)
(num-test (real-part -0.00000001-2.71828182845905i) -0.00000001)
(num-test (real-part -1.0+3.14159265358979i) -1.0)
(num-test (real-part -1.0-0.00000001i) -1.0)
(num-test (real-part -1.0-1234.0i) -1.0)
(num-test (real-part -1234.0+1.0i) -1234.0)
(num-test (real-part -1234.0+1234000000.0i) -1234.0)
(num-test (real-part -1234.0-0.0i) -1234.0)
(num-test (real-part -1234.0-2.71828182845905i) -1234.0)
(num-test (real-part -1234000000.0+3.14159265358979i) -1234000000.0)
(num-test (real-part -1234000000.0-0.00000001i) -1234000000.0)
(num-test (real-part -1234000000.0-1234.0i) -1234000000.0)
(num-test (real-part -2.71828182845905+0.00000001i) -2.71828182845905)
(num-test (real-part -2.71828182845905+1234.0i) -2.71828182845905)
(num-test (real-part -2.71828182845905-3.14159265358979i) -2.71828182845905)
(num-test (real-part -3.14159265358979+0.0i) -3.14159265358979)
(num-test (real-part -3.14159265358979+2.71828182845905i) -3.14159265358979)
(num-test (real-part -3.14159265358979-1.0i) -3.14159265358979)
(num-test (real-part -3.14159265358979-1234000000.0i) -3.14159265358979)
(num-test (real-part 0.0+0.0i) 0.0)
(num-test (real-part 0.0+2.71828182845905i) 0.0)
(num-test (real-part 0.0-1.0i) 0.0)
(num-test (real-part 0.0-1234000000.0i) 0.0)
(num-test (real-part 0.00000001+0.00000001i) 0.00000001)
(num-test (real-part 0.00000001+1234.0i) 0.00000001)
(num-test (real-part 0.00000001-3.14159265358979i) 0.00000001)
(num-test (real-part 1) 1)
(num-test (real-part 1.0+1.0i) 1.0)
(num-test (real-part 1.0+1234000000.0i) 1.0)
(num-test (real-part 1.0-0.0i) 1.0)
(num-test (real-part 1.0-2.71828182845905i) 1.0)
(num-test (real-part 1.4+0.0i) 1.4)
(num-test (real-part 1234.0+0.00000001i) 1234.0)
(num-test (real-part 1234.0+1234.0i) 1234.0)
(num-test (real-part 1234.0-3.14159265358979i) 1234.0)
(num-test (real-part 1234000000.0+1.0i) 1234000000.0)
(num-test (real-part 1234000000.0+1234000000.0i) 1234000000.0)
(num-test (real-part 1234000000.0-0.0i) 1234000000.0)
(num-test (real-part 1234000000.0-2.71828182845905i) 1234000000.0)
(num-test (real-part 2.0) 2.0)
(num-test (real-part 2.71828182845905+0.0i) 2.71828182845905)
(num-test (real-part 2.71828182845905+2.71828182845905i) 2.71828182845905)
(num-test (real-part 2.71828182845905-1.0i) 2.71828182845905)
(num-test (real-part 2.71828182845905-1234000000.0i) 2.71828182845905)
(num-test (real-part 2/3) 2/3)
(num-test (real-part 3.14159265358979+3.14159265358979i) 3.14159265358979)
(num-test (real-part 3.14159265358979-0.00000001i) 3.14159265358979)
(num-test (real-part 3.14159265358979-1234.0i) 3.14159265358979)
(num-test (real-part 3/4+1/2i) 0.75)
(num-test (real-part 5) 5)
(num-test (real-part -1.797693134862315699999999999999999999998E308) -1.797693134862315699999999999999999999998E308)
(num-test (real-part -2.225073858507201399999999999999999999996E-308) -2.225073858507201399999999999999999999996E-308)
(num-test (real-part -9223372036854775808) -9223372036854775808)
(num-test (real-part 1.110223024625156799999999999999999999997E-16) 1.110223024625156799999999999999999999997E-16)
(num-test (real-part 9223372036854775807) 9223372036854775807)
(test (real-part inf.0) inf.0)
(num-test (real-part (+ 2 0+1/0i)) 2)

(when with-bignums
  (num-test (real-part 0+1e400i) 0.0)
  (num-test (real-part 0+9223372036854775808.0i) 0.0)
  (num-test (real-part 1.5+9223372036854775808.0i) 1.5)
  (num-test (real-part 9223372036854775808.0) 9223372036854775808.0)
  (num-test (real-part 9223372036854775808.0+1.5i) 9.223372036854775808E18))

(test (denominator (real-part 3/4+1/2i)) 'error)
(num-test (denominator (real-part 01/100)) 100)
(test (real-part "hi") 'error)
(test (real-part 1.0+23.0i 1.0+23.0i) 'error)
(test (real-part) 'error)

(for-each
 (lambda (arg)
   (test (real-part arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))




;;; --------------------------------------------------------------------------------
;;; imag-part
;;; --------------------------------------------------------------------------------

(num-test (imag-part -0.0+0.00000001i) 0.00000001)
(num-test (imag-part -0.0+1234.0i) 1234.0)
(num-test (imag-part -0.0-3.14159265358979i) -3.14159265358979)
(num-test (imag-part -0.00000001+1.0i) 1.0)
(num-test (imag-part -0.00000001+1234000000.0i) 1234000000.0)
(num-test (imag-part -0.00000001-0.0i) 0.0)
(num-test (imag-part -0.00000001-2.71828182845905i) -2.71828182845905)
(num-test (imag-part -1.0+3.14159265358979i) 3.14159265358979)
(num-test (imag-part -1.0-0.00000001i) -0.00000001)
(num-test (imag-part -1.0-1234.0i) -1234.0)
(num-test (imag-part -1234.0+1.0i) 1.0)
(num-test (imag-part -1234.0+1234000000.0i) 1234000000.0)
(num-test (imag-part -1234.0-0.0i) 0.0)
(num-test (imag-part -1234.0-2.71828182845905i) -2.71828182845905)
(num-test (imag-part -1234000000.0+3.14159265358979i) 3.14159265358979)
(num-test (imag-part -1234000000.0-0.00000001i) -0.00000001)
(num-test (imag-part -1234000000.0-1234.0i) -1234.0)
(num-test (imag-part -2.0) 0.0)
(num-test (imag-part -2.71828182845905+0.00000001i) 0.00000001)
(num-test (imag-part -2.71828182845905+1234.0i) 1234.0)
(num-test (imag-part -2.71828182845905-3.14159265358979i) -3.14159265358979)
(num-test (imag-part -3.14159265358979+0.0i) 0.0)
(num-test (imag-part -3.14159265358979+2.71828182845905i) 2.71828182845905)
(num-test (imag-part -3.14159265358979-1.0i) -1.0)
(num-test (imag-part -3.14159265358979-1234000000.0i) -1234000000.0)
(num-test (imag-part 0+i) 1.0)
(num-test (imag-part 0.0+0.0i) 0.0)
(num-test (imag-part 0.0+2.71828182845905i) 2.71828182845905)
(num-test (imag-part 0.0-1.0i) -1.0)
(num-test (imag-part 0.0-1234000000.0i) -1234000000.0)
(num-test (imag-part 0.00000001+0.00000001i) 0.00000001)
(num-test (imag-part 0.00000001+1234.0i) 1234.0)
(num-test (imag-part 0.00000001-3.14159265358979i) -3.14159265358979)
(num-test (imag-part 1) 0.0)
(num-test (imag-part 1+i) 1.0)
(num-test (imag-part 1-i) -1.0)
(num-test (imag-part 1.0+1.0i) 1.0)
(num-test (imag-part 1.0+1234000000.0i) 1234000000.0)
(num-test (imag-part 1.0-0.0i) 0.0)
(num-test (imag-part 1.0-2.71828182845905i) -2.71828182845905)
(num-test (imag-part 1.4+0.0i) 0.0)
(num-test (imag-part 1234.0+0.00000001i) 0.00000001)
(num-test (imag-part 1234.0+1234.0i) 1234.0)
(num-test (imag-part 1234.0-3.14159265358979i) -3.14159265358979)
(num-test (imag-part 1234000000.0+1.0i) 1.0)
(num-test (imag-part 1234000000.0+1234000000.0i) 1234000000.0)
(num-test (imag-part 1234000000.0-0.0i) 0.0)
(num-test (imag-part 1234000000.0-2.71828182845905i) -2.71828182845905)
(num-test (imag-part 2.71828182845905+0.0i) 0.0)
(num-test (imag-part 2.71828182845905+2.71828182845905i) 2.71828182845905)
(num-test (imag-part 2.71828182845905-1.0i) -1.0)
(num-test (imag-part 2.71828182845905-1234000000.0i) -1234000000.0)
(num-test (imag-part 2/3) 0.0)
(num-test (imag-part 3.14159265358979+3.14159265358979i) 3.14159265358979)
(num-test (imag-part 3.14159265358979-0.00000001i) -0.00000001)
(num-test (imag-part 3.14159265358979-1234.0i) -1234.0)
(num-test (imag-part 5) 0.0)
(num-test (imag-part -1.797693134862315699999999999999999999998E308) 0.0)
(num-test (imag-part -2.225073858507201399999999999999999999996E-308) 0.0)
(num-test (imag-part -9223372036854775808) 0)
(num-test (imag-part 1.110223024625156799999999999999999999997E-16) 0.0)
(num-test (imag-part 9223372036854775807) 0)
(if (not with-bignums) (test (nan? (imag-part (+ 2 0+1/0i))) #t))
(num-test (imag-part 0/0+0i) 0.0)
(num-test (imag-part 1/0) 0.0)
;(num-test (imag-part (log 1/0)) pi) ; hmmm -- I could imagine other choices here and below
;(num-test (imag-part (sqrt 1/0)) 0.0)
;(test (nan? (imag-part (sqrt (log 1/0)))) #t)

(when with-bignums
  (num-test (imag-part 0+1e400i) 1e400)
  (num-test (imag-part 0+9223372036854775808.0i) 9223372036854775808.0)
  (num-test (imag-part 1.5+9223372036854775808.0i) 9.223372036854775808E18)
  (num-test (imag-part 9223372036854775808.0) 0)
  (num-test (imag-part 9223372036854775808.0+1.5i) 1.5))

(test (imag-part "hi") 'error)
(test (imag-part 1.0+23.0i 1.0+23.0i) 'error)
(test (imag-part) 'error)

(for-each
 (lambda (arg)
   (test (imag-part arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))





;;; --------------------------------------------------------------------------------
;;; complex
;;; --------------------------------------------------------------------------------

(num-test (complex -0 -1) -0.0-1.0i)
(num-test (complex -0 -10) -0.0-10.0i)
(num-test (complex -0 -1234) -0.0-1234.0i)
(num-test (complex -0 -1234000000) -0.0-1234000000.0i)
(num-test (complex -0 -2) -0.0-2.0i)
(num-test (complex -0 -3) -0.0-3.0i)
(num-test (complex -0 -362880) -0.0-362880.0i)
(num-test (complex -0 -500029) -0.0-500029.0i)
(num-test (complex -0 1) -0.0+1.0i)
(num-test (complex -0 10) -0.0+10.0i)
(num-test (complex -0 1234) -0.0+1234.0i)
(num-test (complex -0 1234000000) -0.0+1234000000.0i)
(num-test (complex -0 2) -0.0+2.0i)
(num-test (complex -0 3) -0.0+3.0i)
(num-test (complex -0 362880) -0.0+362880.0i)
(num-test (complex -0 500029) -0.0+500029.0i)
(num-test (complex -0.0 -0.00000001) -0.0-0.00000001i)
(num-test (complex -0.0 -1.0) -0.0-1.0i)
(num-test (complex -0.0 -1234.0) -0.0-1234.0i)
(num-test (complex -0.0 -1234000000.0) -0.0-1234000000.0i)
(num-test (complex -0.0 -2.71828182845905) -0.0-2.71828182845905i)
(num-test (complex -0.0 -3.14159265358979) -0.0-3.14159265358979i)
(num-test (complex -0.0 0.00000001) -0.0+0.00000001i)
(num-test (complex -0.0 1.0) -0.0+1.0i)
(num-test (complex -0.0 1234.0) -0.0+1234.0i)
(num-test (complex -0.0 1234000000.0) -0.0+1234000000.0i)
(num-test (complex -0.0 2.71828182845905) -0.0+2.71828182845905i)
(num-test (complex -0.0 pi) -0.0+3.14159265358979i)
(num-test (complex -0.00000001 -0.00000001) -0.00000001-0.00000001i)
(num-test (complex -0.00000001 -1.0) -0.00000001-1.0i)
(num-test (complex -0.00000001 -1234.0) -0.00000001-1234.0i)
(num-test (complex -0.00000001 -1234000000.0) -0.00000001-1234000000.0i)
(num-test (complex -0.00000001 -2.71828182845905) -0.00000001-2.71828182845905i)
(num-test (complex -0.00000001 -3.14159265358979) -0.00000001-3.14159265358979i)
(num-test (complex -0.00000001 0.00000001) -0.00000001+0.00000001i)
(num-test (complex -0.00000001 1.0) -0.00000001+1.0i)
(num-test (complex -0.00000001 1234.0) -0.00000001+1234.0i)
(num-test (complex -0.00000001 1234000000.0) -0.00000001+1234000000.0i)
(num-test (complex -0.00000001 2.71828182845905) -0.00000001+2.71828182845905i)
(num-test (complex -0.00000001 pi) -0.00000001+3.14159265358979i)
(num-test (complex -1 -1) -1.0-1.0i)
(num-test (complex -1 -10) -1.0-10.0i)
(num-test (complex -1 -1234) -1.0-1234.0i)
(num-test (complex -1 -1234000000) -1.0-1234000000.0i)
(num-test (complex -1 -2) -1.0-2.0i)
(num-test (complex -1 -3) -1.0-3.0i)
(num-test (complex -1 -362880) -1.0-362880.0i)
(num-test (complex -1 -500029) -1.0-500029.0i)
(num-test (complex -1 1) -1.0+1.0i)
(num-test (complex -1 10) -1.0+10.0i)
(num-test (complex -1 1234) -1.0+1234.0i)
(num-test (complex -1 1234000000) -1.0+1234000000.0i)
(num-test (complex -1 2) -1.0+2.0i)
(num-test (complex -1 3) -1.0+3.0i)
(num-test (complex -1 362880) -1.0+362880.0i)
(num-test (complex -1 500029) -1.0+500029.0i)
(num-test (complex -1.0 -0.00000001) -1.0-0.00000001i)
(num-test (complex -1.0 -1.0) -1.0-1.0i)
(num-test (complex -1.0 -1234.0) -1.0-1234.0i)
(num-test (complex -1.0 -1234000000.0) -1.0-1234000000.0i)
(num-test (complex -1.0 -2.71828182845905) -1.0-2.71828182845905i)
(num-test (complex -1.0 -3.14159265358979) -1.0-3.14159265358979i)
(num-test (complex -1.0 0.00000001) -1.0+0.00000001i)
(num-test (complex -1.0 1.0) -1.0+1.0i)
(num-test (complex -1.0 1234.0) -1.0+1234.0i)
(num-test (complex -1.0 1234000000.0) -1.0+1234000000.0i)
(num-test (complex -1.0 2.71828182845905) -1.0+2.71828182845905i)
(num-test (complex -1.0 pi) -1.0+3.14159265358979i)
(num-test (complex -10 -1) -10.0-1.0i)
(num-test (complex -10 -10) -10.0-10.0i)
(num-test (complex -10 -1234) -10.0-1234.0i)
(num-test (complex -10 -1234000000) -10.0-1234000000.0i)
(num-test (complex -10 -2) -10.0-2.0i)
(num-test (complex -10 -3) -10.0-3.0i)
(num-test (complex -10 -362880) -10.0-362880.0i)
(num-test (complex -10 -500029) -10.0-500029.0i)
(num-test (complex -10 1) -10.0+1.0i)
(num-test (complex -10 10) -10.0+10.0i)
(num-test (complex -10 1234) -10.0+1234.0i)
(num-test (complex -10 1234000000) -10.0+1234000000.0i)
(num-test (complex -10 2) -10.0+2.0i)
(num-test (complex -10 3) -10.0+3.0i)
(num-test (complex -10 362880) -10.0+362880.0i)
(num-test (complex -10 500029) -10.0+500029.0i)
(num-test (complex -1234 -1) -1234.0-1.0i)
(num-test (complex -1234 -10) -1234.0-10.0i)
(num-test (complex -1234 -1234) -1234.0-1234.0i)
(num-test (complex -1234 -1234000000) -1234.0-1234000000.0i)
(num-test (complex -1234 -2) -1234.0-2.0i)
(num-test (complex -1234 -3) -1234.0-3.0i)
(num-test (complex -1234 -362880) -1234.0-362880.0i)
(num-test (complex -1234 -500029) -1234.0-500029.0i)
(num-test (complex -1234 1) -1234.0+1.0i)
(num-test (complex -1234 10) -1234.0+10.0i)
(num-test (complex -1234 1234) -1234.0+1234.0i)
(num-test (complex -1234 1234000000) -1234.0+1234000000.0i)
(num-test (complex -1234 2) -1234.0+2.0i)
(num-test (complex -1234 3) -1234.0+3.0i)
(num-test (complex -1234 362880) -1234.0+362880.0i)
(num-test (complex -1234 500029) -1234.0+500029.0i)
(num-test (complex -1234.0 -0.00000001) -1234.0-0.00000001i)
(num-test (complex -1234.0 -1.0) -1234.0-1.0i)
(num-test (complex -1234.0 -1234.0) -1234.0-1234.0i)
(num-test (complex -1234.0 -1234000000.0) -1234.0-1234000000.0i)
(num-test (complex -1234.0 -2.71828182845905) -1234.0-2.71828182845905i)
(num-test (complex -1234.0 -3.14159265358979) -1234.0-3.14159265358979i)
(num-test (complex -1234.0 0.00000001) -1234.0+0.00000001i)
(num-test (complex -1234.0 1.0) -1234.0+1.0i)
(num-test (complex -1234.0 1234.0) -1234.0+1234.0i)
(num-test (complex -1234.0 1234000000.0) -1234.0+1234000000.0i)
(num-test (complex -1234.0 2.71828182845905) -1234.0+2.71828182845905i)
(num-test (complex -1234.0 pi) -1234.0+3.14159265358979i)
(num-test (complex -1234000000 -1) -1234000000.0-1.0i)
(num-test (complex -1234000000 -10) -1234000000.0-10.0i)
(num-test (complex -1234000000 -1234) -1234000000.0-1234.0i)
(num-test (complex -1234000000 -1234000000) -1234000000.0-1234000000.0i)
(num-test (complex -1234000000 -2) -1234000000.0-2.0i)
(num-test (complex -1234000000 -3) -1234000000.0-3.0i)
(num-test (complex -1234000000 -362880) -1234000000.0-362880.0i)
(num-test (complex -1234000000 -500029) -1234000000.0-500029.0i)
(num-test (complex -1234000000 1) -1234000000.0+1.0i)
(num-test (complex -1234000000 10) -1234000000.0+10.0i)
(num-test (complex -1234000000 1234) -1234000000.0+1234.0i)
(num-test (complex -1234000000 1234000000) -1234000000.0+1234000000.0i)
(num-test (complex -1234000000 2) -1234000000.0+2.0i)
(num-test (complex -1234000000 3) -1234000000.0+3.0i)
(num-test (complex -1234000000 362880) -1234000000.0+362880.0i)
(num-test (complex -1234000000 500029) -1234000000.0+500029.0i)
(num-test (complex -1234000000.0 -0.00000001) -1234000000.0-0.00000001i)
(num-test (complex -1234000000.0 -1.0) -1234000000.0-1.0i)
(num-test (complex -1234000000.0 -1234.0) -1234000000.0-1234.0i)
(num-test (complex -1234000000.0 -1234000000.0) -1234000000.0-1234000000.0i)
(num-test (complex -1234000000.0 -2.71828182845905) -1234000000.0-2.71828182845905i)
(num-test (complex -1234000000.0 -3.14159265358979) -1234000000.0-3.14159265358979i)
(num-test (complex -1234000000.0 0.00000001) -1234000000.0+0.00000001i)
(num-test (complex -1234000000.0 1.0) -1234000000.0+1.0i)
(num-test (complex -1234000000.0 1234.0) -1234000000.0+1234.0i)
(num-test (complex -1234000000.0 1234000000.0) -1234000000.0+1234000000.0i)
(num-test (complex -1234000000.0 2.71828182845905) -1234000000.0+2.71828182845905i)
(num-test (complex -1234000000.0 pi) -1234000000.0+3.14159265358979i)
(num-test (complex -2 -1) -2.0-1.0i)
(num-test (complex -2 -10) -2.0-10.0i)
(num-test (complex -2 -1234) -2.0-1234.0i)
(num-test (complex -2 -1234000000) -2.0-1234000000.0i)
(num-test (complex -2 -2) -2.0-2.0i)
(num-test (complex -2 -3) -2.0-3.0i)
(num-test (complex -2 -362880) -2.0-362880.0i)
(num-test (complex -2 -500029) -2.0-500029.0i)
(num-test (complex -2 1) -2.0+1.0i)
(num-test (complex -2 10) -2.0+10.0i)
(num-test (complex -2 1234) -2.0+1234.0i)
(num-test (complex -2 1234000000) -2.0+1234000000.0i)
(num-test (complex -2 2) -2.0+2.0i)
(num-test (complex -2 3) -2.0+3.0i)
(num-test (complex -2 362880) -2.0+362880.0i)
(num-test (complex -2 500029) -2.0+500029.0i)
(num-test (complex -2.71828182845905 -0.00000001) -2.71828182845905-0.00000001i)
(num-test (complex -2.71828182845905 -1.0) -2.71828182845905-1.0i)
(num-test (complex -2.71828182845905 -1234.0) -2.71828182845905-1234.0i)
(num-test (complex -2.71828182845905 -1234000000.0) -2.71828182845905-1234000000.0i)
(num-test (complex -2.71828182845905 -2.71828182845905) -2.71828182845905-2.71828182845905i)
(num-test (complex -2.71828182845905 -3.14159265358979) -2.71828182845905-3.14159265358979i)
(num-test (complex -2.71828182845905 0.00000001) -2.71828182845905+0.00000001i)
(num-test (complex -2.71828182845905 1.0) -2.71828182845905+1.0i)
(num-test (complex -2.71828182845905 1234.0) -2.71828182845905+1234.0i)
(num-test (complex -2.71828182845905 1234000000.0) -2.71828182845905+1234000000.0i)
(num-test (complex -2.71828182845905 2.71828182845905) -2.71828182845905+2.71828182845905i)
(num-test (complex -2.71828182845905 pi) -2.71828182845905+3.14159265358979i)
(num-test (complex -3 -1) -3.0-1.0i)
(num-test (complex -3 -10) -3.0-10.0i)
(num-test (complex -3 -1234) -3.0-1234.0i)
(num-test (complex -3 -1234000000) -3.0-1234000000.0i)
(num-test (complex -3 -2) -3.0-2.0i)
(num-test (complex -3 -3) -3.0-3.0i)
(num-test (complex -3 -362880) -3.0-362880.0i)
(num-test (complex -3 -500029) -3.0-500029.0i)
(num-test (complex -3 1) -3.0+1.0i)
(num-test (complex -3 10) -3.0+10.0i)
(num-test (complex -3 1234) -3.0+1234.0i)
(num-test (complex -3 1234000000) -3.0+1234000000.0i)
(num-test (complex -3 2) -3.0+2.0i)
(num-test (complex -3 3) -3.0+3.0i)
(num-test (complex -3 362880) -3.0+362880.0i)
(num-test (complex -3 500029) -3.0+500029.0i)
(num-test (complex -3.14159265358979 -0.00000001) -3.14159265358979-0.00000001i)
(num-test (complex -3.14159265358979 -1.0) -3.14159265358979-1.0i)
(num-test (complex -3.14159265358979 -1234.0) -3.14159265358979-1234.0i)
(num-test (complex -3.14159265358979 -1234000000.0) -3.14159265358979-1234000000.0i)
(num-test (complex -3.14159265358979 -2.71828182845905) -3.14159265358979-2.71828182845905i)
(num-test (complex -3.14159265358979 -3.14159265358979) -3.14159265358979-3.14159265358979i)
(num-test (complex -3.14159265358979 0.00000001) -3.14159265358979+0.00000001i)
(num-test (complex -3.14159265358979 1.0) -3.14159265358979+1.0i)
(num-test (complex -3.14159265358979 1234.0) -3.14159265358979+1234.0i)
(num-test (complex -3.14159265358979 1234000000.0) -3.14159265358979+1234000000.0i)
(num-test (complex -3.14159265358979 2.71828182845905) -3.14159265358979+2.71828182845905i)
(num-test (complex -3.14159265358979 pi) -3.14159265358979+3.14159265358979i)
(num-test (complex -362880 -1) -362880.0-1.0i)
(num-test (complex -362880 -10) -362880.0-10.0i)
(num-test (complex -362880 -1234) -362880.0-1234.0i)
(num-test (complex -362880 -1234000000) -362880.0-1234000000.0i)
(num-test (complex -362880 -2) -362880.0-2.0i)
(num-test (complex -362880 -3) -362880.0-3.0i)
(num-test (complex -362880 -362880) -362880.0-362880.0i)
(num-test (complex -362880 -500029) -362880.0-500029.0i)
(num-test (complex -362880 1) -362880.0+1.0i)
(num-test (complex -362880 10) -362880.0+10.0i)
(num-test (complex -362880 1234) -362880.0+1234.0i)
(num-test (complex -362880 1234000000) -362880.0+1234000000.0i)
(num-test (complex -362880 2) -362880.0+2.0i)
(num-test (complex -362880 3) -362880.0+3.0i)
(num-test (complex -362880 362880) -362880.0+362880.0i)
(num-test (complex -362880 500029) -362880.0+500029.0i)
(num-test (complex -500029 -1) -500029.0-1.0i)
(num-test (complex -500029 -10) -500029.0-10.0i)
(num-test (complex -500029 -1234) -500029.0-1234.0i)
(num-test (complex -500029 -1234000000) -500029.0-1234000000.0i)
(num-test (complex -500029 -2) -500029.0-2.0i)
(num-test (complex -500029 -3) -500029.0-3.0i)
(num-test (complex -500029 -362880) -500029.0-362880.0i)
(num-test (complex -500029 -500029) -500029.0-500029.0i)
(num-test (complex -500029 1) -500029.0+1.0i)
(num-test (complex -500029 10) -500029.0+10.0i)
(num-test (complex -500029 1234) -500029.0+1234.0i)
(num-test (complex -500029 1234000000) -500029.0+1234000000.0i)
(num-test (complex -500029 2) -500029.0+2.0i)
(num-test (complex -500029 3) -500029.0+3.0i)
(num-test (complex -500029 362880) -500029.0+362880.0i)
(num-test (complex -500029 500029) -500029.0+500029.0i)
(num-test (complex 0 -1) 0.0-1.0i)
(num-test (complex 0 -10) 0.0-10.0i)
(num-test (complex 0 -1234) 0.0-1234.0i)
(num-test (complex 0 -1234000000) 0.0-1234000000.0i)
(num-test (complex 0 -2) 0.0-2.0i)
(num-test (complex 0 -3) 0.0-3.0i)
(num-test (complex 0 -362880) 0.0-362880.0i)
(num-test (complex 0 -500029) 0.0-500029.0i)
(num-test (complex 0 0) 0)
(num-test (complex 0 1) 0.0+1.0i)
(num-test (complex 0 10) 0.0+10.0i)
(num-test (complex 0 1234) 0.0+1234.0i)
(num-test (complex 0 1234000000) 0.0+1234000000.0i)
(num-test (complex 0 2) 0.0+2.0i)
(num-test (complex 0 3) 0.0+3.0i)
(num-test (complex 0 362880) 0.0+362880.0i)
(num-test (complex 0 500029) 0.0+500029.0i)
(num-test (complex 0.0 -0.00000001) 0.0-0.00000001i)
(num-test (complex 0.0 -1.0) 0.0-1.0i)
(num-test (complex 0.0 -1234.0) 0.0-1234.0i)
(num-test (complex 0.0 -1234000000.0) 0.0-1234000000.0i)
(num-test (complex 0.0 -2.71828182845905) 0.0-2.71828182845905i)
(num-test (complex 0.0 -3.14159265358979) 0.0-3.14159265358979i)
(num-test (complex 0.0 0.0) 0.0)
(num-test (complex 0.0 0.00000001) 0.0+0.00000001i)
(num-test (complex 0.0 1.0) 0.0+1.0i)
(num-test (complex 0.0 1234.0) 0.0+1234.0i)
(num-test (complex 0.0 1234000000.0) 0.0+1234000000.0i)
(num-test (complex 0.0 2.71828182845905) 0.0+2.71828182845905i)
(num-test (complex 0.0 pi) 0.0+3.14159265358979i)
(num-test (complex 0.00000001 -0.00000001) 0.00000001-0.00000001i)
(num-test (complex 0.00000001 -1.0) 0.00000001-1.0i)
(num-test (complex 0.00000001 -1234.0) 0.00000001-1234.0i)
(num-test (complex 0.00000001 -1234000000.0) 0.00000001-1234000000.0i)
(num-test (complex 0.00000001 -2.71828182845905) 0.00000001-2.71828182845905i)
(num-test (complex 0.00000001 -3.14159265358979) 0.00000001-3.14159265358979i)
(num-test (complex 0.00000001 0.00000001) 0.00000001+0.00000001i)
(num-test (complex 0.00000001 1.0) 0.00000001+1.0i)
(num-test (complex 0.00000001 1234.0) 0.00000001+1234.0i)
(num-test (complex 0.00000001 1234000000.0) 0.00000001+1234000000.0i)
(num-test (complex 0.00000001 2.71828182845905) 0.00000001+2.71828182845905i)
(num-test (complex 0.00000001 pi) 0.00000001+3.14159265358979i)
(num-test (complex 1 -1) 1.0-1.0i)
(num-test (complex 1 -10) 1.0-10.0i)
(num-test (complex 1 -1234) 1.0-1234.0i)
(num-test (complex 1 -1234000000) 1.0-1234000000.0i)
(num-test (complex 1 -2) 1.0-2.0i)
(num-test (complex 1 -3) 1.0-3.0i)
(num-test (complex 1 -362880) 1.0-362880.0i)
(num-test (complex 1 -500029) 1.0-500029.0i)
(num-test (complex 1 1) 1.0+1.0i)
(num-test (complex 1 10) 1.0+10.0i)
(num-test (complex 1 1234) 1.0+1234.0i)
(num-test (complex 1 1234000000) 1.0+1234000000.0i)
(num-test (complex 1 2) 1.0+2.0i)
(num-test (complex 1 3) 1.0+3.0i)
(num-test (complex 1 362880) 1.0+362880.0i)
(num-test (complex 1 500029) 1.0+500029.0i)
(num-test (complex 1.0 -0.00000001) 1.0-0.00000001i)
(num-test (complex 1.0 -1.0) 1.0-1.0i)
(num-test (complex 1.0 -1234.0) 1.0-1234.0i)
(num-test (complex 1.0 -1234000000.0) 1.0-1234000000.0i)
(num-test (complex 1.0 -2.71828182845905) 1.0-2.71828182845905i)
(num-test (complex 1.0 -3.14159265358979) 1.0-3.14159265358979i)
(num-test (complex 1.0 0.00000001) 1.0+0.00000001i)
(num-test (complex 1.0 1.0) 1.0+1.0i)
(num-test (complex 1.0 1234.0) 1.0+1234.0i)
(num-test (complex 1.0 1234000000.0) 1.0+1234000000.0i)
(num-test (complex 1.0 2.71828182845905) 1.0+2.71828182845905i)
(num-test (complex 1.0 pi) 1.0+3.14159265358979i)
(num-test (complex 10 -1) 10.0-1.0i)
(num-test (complex 10 -10) 10.0-10.0i)
(num-test (complex 10 -1234) 10.0-1234.0i)
(num-test (complex 10 -1234000000) 10.0-1234000000.0i)
(num-test (complex 10 -2) 10.0-2.0i)
(num-test (complex 10 -3) 10.0-3.0i)
(num-test (complex 10 -362880) 10.0-362880.0i)
(num-test (complex 10 -500029) 10.0-500029.0i)
(num-test (complex 10 1) 10.0+1.0i)
(num-test (complex 10 10) 10.0+10.0i)
(num-test (complex 10 1234) 10.0+1234.0i)
(num-test (complex 10 1234000000) 10.0+1234000000.0i)
(num-test (complex 10 2) 10.0+2.0i)
(num-test (complex 10 3) 10.0+3.0i)
(num-test (complex 10 362880) 10.0+362880.0i)
(num-test (complex 10 500029) 10.0+500029.0i)
(num-test (complex 1234 -1) 1234.0-1.0i)
(num-test (complex 1234 -10) 1234.0-10.0i)
(num-test (complex 1234 -1234) 1234.0-1234.0i)
(num-test (complex 1234 -1234000000) 1234.0-1234000000.0i)
(num-test (complex 1234 -2) 1234.0-2.0i)
(num-test (complex 1234 -3) 1234.0-3.0i)
(num-test (complex 1234 -362880) 1234.0-362880.0i)
(num-test (complex 1234 -500029) 1234.0-500029.0i)
(num-test (complex 1234 1) 1234.0+1.0i)
(num-test (complex 1234 10) 1234.0+10.0i)
(num-test (complex 1234 1234) 1234.0+1234.0i)
(num-test (complex 1234 1234000000) 1234.0+1234000000.0i)
(num-test (complex 1234 2) 1234.0+2.0i)
(num-test (complex 1234 3) 1234.0+3.0i)
(num-test (complex 1234 362880) 1234.0+362880.0i)
(num-test (complex 1234 500029) 1234.0+500029.0i)
(num-test (complex 1234.0 -0.00000001) 1234.0-0.00000001i)
(num-test (complex 1234.0 -1.0) 1234.0-1.0i)
(num-test (complex 1234.0 -1234.0) 1234.0-1234.0i)
(num-test (complex 1234.0 -1234000000.0) 1234.0-1234000000.0i)
(num-test (complex 1234.0 -2.71828182845905) 1234.0-2.71828182845905i)
(num-test (complex 1234.0 -3.14159265358979) 1234.0-3.14159265358979i)
(num-test (complex 1234.0 0.00000001) 1234.0+0.00000001i)
(num-test (complex 1234.0 1.0) 1234.0+1.0i)
(num-test (complex 1234.0 1234.0) 1234.0+1234.0i)
(num-test (complex 1234.0 1234000000.0) 1234.0+1234000000.0i)
(num-test (complex 1234.0 2.71828182845905) 1234.0+2.71828182845905i)
(num-test (complex 1234.0 pi) 1234.0+3.14159265358979i)
(num-test (complex 1234000000 -1) 1234000000.0-1.0i)
(num-test (complex 1234000000 -10) 1234000000.0-10.0i)
(num-test (complex 1234000000 -1234) 1234000000.0-1234.0i)
(num-test (complex 1234000000 -1234000000) 1234000000.0-1234000000.0i)
(num-test (complex 1234000000 -2) 1234000000.0-2.0i)
(num-test (complex 1234000000 -3) 1234000000.0-3.0i)
(num-test (complex 1234000000 -362880) 1234000000.0-362880.0i)
(num-test (complex 1234000000 -500029) 1234000000.0-500029.0i)
(num-test (complex 1234000000 1) 1234000000.0+1.0i)
(num-test (complex 1234000000 10) 1234000000.0+10.0i)
(num-test (complex 1234000000 1234) 1234000000.0+1234.0i)
(num-test (complex 1234000000 1234000000) 1234000000.0+1234000000.0i)
(num-test (complex 1234000000 2) 1234000000.0+2.0i)
(num-test (complex 1234000000 3) 1234000000.0+3.0i)
(num-test (complex 1234000000 362880) 1234000000.0+362880.0i)
(num-test (complex 1234000000 500029) 1234000000.0+500029.0i)
(num-test (complex 1234000000.0 -0.00000001) 1234000000.0-0.00000001i)
(num-test (complex 1234000000.0 -1.0) 1234000000.0-1.0i)
(num-test (complex 1234000000.0 -1234.0) 1234000000.0-1234.0i)
(num-test (complex 1234000000.0 -1234000000.0) 1234000000.0-1234000000.0i)
(num-test (complex 1234000000.0 -2.71828182845905) 1234000000.0-2.71828182845905i)
(num-test (complex 1234000000.0 -3.14159265358979) 1234000000.0-3.14159265358979i)
(num-test (complex 1234000000.0 0.00000001) 1234000000.0+0.00000001i)
(num-test (complex 1234000000.0 1.0) 1234000000.0+1.0i)
(num-test (complex 1234000000.0 1234.0) 1234000000.0+1234.0i)
(num-test (complex 1234000000.0 1234000000.0) 1234000000.0+1234000000.0i)
(num-test (complex 1234000000.0 2.71828182845905) 1234000000.0+2.71828182845905i)
(num-test (complex 1234000000.0 pi) 1234000000.0+3.14159265358979i)
(num-test (complex 2 -1) 2.0-1.0i)
(num-test (complex 2 -10) 2.0-10.0i)
(num-test (complex 2 -1234) 2.0-1234.0i)
(num-test (complex 2 -1234000000) 2.0-1234000000.0i)
(num-test (complex 2 -2) 2.0-2.0i)
(num-test (complex 2 -3) 2.0-3.0i)
(num-test (complex 2 -362880) 2.0-362880.0i)
(num-test (complex 2 -500029) 2.0-500029.0i)
(num-test (complex 2 1) 2.0+1.0i)
(num-test (complex 2 10) 2.0+10.0i)
(num-test (complex 2 1234) 2.0+1234.0i)
(num-test (complex 2 1234000000) 2.0+1234000000.0i)
(num-test (complex 2 2) 2.0+2.0i)
(num-test (complex 2 3) 2.0+3.0i)
(num-test (complex 2 362880) 2.0+362880.0i)
(num-test (complex 2 500029) 2.0+500029.0i)
(num-test (complex 2.71828182845905 -0.00000001) 2.71828182845905-0.00000001i)
(num-test (complex 2.71828182845905 -1.0) 2.71828182845905-1.0i)
(num-test (complex 2.71828182845905 -1234.0) 2.71828182845905-1234.0i)
(num-test (complex 2.71828182845905 -1234000000.0) 2.71828182845905-1234000000.0i)
(num-test (complex 2.71828182845905 -2.71828182845905) 2.71828182845905-2.71828182845905i)
(num-test (complex 2.71828182845905 -3.14159265358979) 2.71828182845905-3.14159265358979i)
(num-test (complex 2.71828182845905 0.00000001) 2.71828182845905+0.00000001i)
(num-test (complex 2.71828182845905 1.0) 2.71828182845905+1.0i)
(num-test (complex 2.71828182845905 1234.0) 2.71828182845905+1234.0i)
(num-test (complex 2.71828182845905 1234000000.0) 2.71828182845905+1234000000.0i)
(num-test (complex 2.71828182845905 2.71828182845905) 2.71828182845905+2.71828182845905i)
(num-test (complex 2.71828182845905 pi) 2.71828182845905+3.14159265358979i)
(num-test (complex 3 -1) 3.0-1.0i)
(num-test (complex 3 -10) 3.0-10.0i)
(num-test (complex 3 -1234) 3.0-1234.0i)
(num-test (complex 3 -1234000000) 3.0-1234000000.0i)
(num-test (complex 3 -2) 3.0-2.0i)
(num-test (complex 3 -3) 3.0-3.0i)
(num-test (complex 3 -362880) 3.0-362880.0i)
(num-test (complex 3 -500029) 3.0-500029.0i)
(num-test (complex 3 1) 3.0+1.0i)
(num-test (complex 3 10) 3.0+10.0i)
(num-test (complex 3 1234) 3.0+1234.0i)
(num-test (complex 3 1234000000) 3.0+1234000000.0i)
(num-test (complex 3 2) 3.0+2.0i)
(num-test (complex 3 3) 3.0+3.0i)
(num-test (complex 3 362880) 3.0+362880.0i)
(num-test (complex 3 500029) 3.0+500029.0i)
(num-test (complex 3.14159265358979 -0.00000001) 3.14159265358979-0.00000001i)
(num-test (complex 3.14159265358979 -1.0) 3.14159265358979-1.0i)
(num-test (complex 3.14159265358979 -1234.0) 3.14159265358979-1234.0i)
(num-test (complex 3.14159265358979 -1234000000.0) 3.14159265358979-1234000000.0i)
(num-test (complex 3.14159265358979 -2.71828182845905) 3.14159265358979-2.71828182845905i)
(num-test (complex 3.14159265358979 -3.14159265358979) 3.14159265358979-3.14159265358979i)
(num-test (complex 3.14159265358979 0.00000001) 3.14159265358979+0.00000001i)
(num-test (complex 3.14159265358979 1.0) 3.14159265358979+1.0i)
(num-test (complex 3.14159265358979 1234.0) 3.14159265358979+1234.0i)
(num-test (complex 3.14159265358979 1234000000.0) 3.14159265358979+1234000000.0i)
(num-test (complex 3.14159265358979 2.71828182845905) 3.14159265358979+2.71828182845905i)
(num-test (complex 3.14159265358979 pi) 3.14159265358979+3.14159265358979i)
(num-test (complex 362880 -1) 362880.0-1.0i)
(num-test (complex 362880 -10) 362880.0-10.0i)
(num-test (complex 362880 -1234) 362880.0-1234.0i)
(num-test (complex 362880 -1234000000) 362880.0-1234000000.0i)
(num-test (complex 362880 -2) 362880.0-2.0i)
(num-test (complex 362880 -3) 362880.0-3.0i)
(num-test (complex 362880 -362880) 362880.0-362880.0i)
(num-test (complex 362880 -500029) 362880.0-500029.0i)
(num-test (complex 362880 1) 362880.0+1.0i)
(num-test (complex 362880 10) 362880.0+10.0i)
(num-test (complex 362880 1234) 362880.0+1234.0i)
(num-test (complex 362880 1234000000) 362880.0+1234000000.0i)
(num-test (complex 362880 2) 362880.0+2.0i)
(num-test (complex 362880 3) 362880.0+3.0i)
(num-test (complex 362880 362880) 362880.0+362880.0i)
(num-test (complex 362880 500029) 362880.0+500029.0i)
(num-test (complex 500029 -1) 500029.0-1.0i)
(num-test (complex 500029 -10) 500029.0-10.0i)
(num-test (complex 500029 -1234) 500029.0-1234.0i)
(num-test (complex 500029 -1234000000) 500029.0-1234000000.0i)
(num-test (complex 500029 -2) 500029.0-2.0i)
(num-test (complex 500029 -3) 500029.0-3.0i)
(num-test (complex 500029 -362880) 500029.0-362880.0i)
(num-test (complex 500029 -500029) 500029.0-500029.0i)
(num-test (complex 500029 1) 500029.0+1.0i)
(num-test (complex 500029 10) 500029.0+10.0i)
(num-test (complex 500029 1234) 500029.0+1234.0i)
(num-test (complex 500029 1234000000) 500029.0+1234000000.0i)
(num-test (complex 500029 2) 500029.0+2.0i)
(num-test (complex 500029 3) 500029.0+3.0i)
(num-test (complex 500029 362880) 500029.0+362880.0i)
(num-test (complex 500029 500029) 500029.0+500029.0i)
(num-test (complex 1/2 0) 1/2)
(num-test (complex 1/2 1/2) 0.5+0.5i)
(num-test (complex 0 1/2) 0+0.5i)

(test (nan? (complex nan.0 nan.0)) #t)
(test (nan? (complex nan.0 inf.0)) #t)

(when with-bignums
  (test (nan? (complex (bignum "0/0") 0)) #t)
  (test (nan? (complex 0 (bignum "0/0"))) #t)
  (num-test (complex 0 (* 2 most-positive-fixnum)) 0.0+1.8446744073709551614E19i)
  (num-test (- (complex 2e20 (* 2 most-positive-fixnum)) 0+1.8446744073709551614E19i) 2e20)
  (num-test (imag-part (complex 1.0 1180591620717411303424/717897987691852588770249)) 1.644511672909387396372163624382128338027E-3)
  (test (complex 0.0 0+92233720368547758081.0i) 'error))

(test (complex 0 0+0/0i) 'error)
(test (complex 0+0/0i 0) 'error)
(test (complex 1.23 1.23 1.23) 'error)
(test (complex 1.23) 'error)
(test (complex 1.23+1.0i 1.23+1.0i) 'error)
(test (complex) 'error)
(test (complex 1.0 1.0+0.1i) 'error)
(test (complex 1.0+0.1i 1.0) 'error)
(for-each
 (lambda (x)
   (test (complex x 0-i) 'error))
 (list 0 1 1/2 1.0 0.0 0+i))
(for-each
 (lambda (x)
   (test (complex 0-i x) 'error))
 (list 0 1 pi (- pi) 1/2 0.0 1.0 0+i))

(for-each
 (lambda (arg)
   (test (complex arg 0.0) 'error)
   (test (complex 0.0 arg) 'error)
   (test (complex arg nan.0) 'error)
   (test (complex nan.0 arg) 'error)
   (test (complex arg inf.0) 'error)
   (test (complex inf.0 arg) 'error)
   (test (complex 1 arg) 'error)
   (test (complex 1/2 arg) 'error)
   (test (complex 1+i arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))




;;; --------------------------------------------------------------------------------
;;; make-polar
;;; --------------------------------------------------------------------------------

(num-test (make-polar -0 -1) 0)
(num-test (make-polar -0 -10) 0)
(num-test (make-polar -0 -1234) 0)
(num-test (make-polar -0 -1234000000) 0)
(num-test (make-polar -0 -2) 0)
(num-test (make-polar -0 -3) 0)
(num-test (make-polar -0 -362880) 0)
(num-test (make-polar -0 -500029) 0)
(num-test (make-polar -0 1) 0)
(num-test (make-polar -0 10) 0)
(num-test (make-polar -0 1234) 0)
(num-test (make-polar -0 1234000000) 0)
(num-test (make-polar -0 2) 0)
(num-test (make-polar -0 3) 0)
(num-test (make-polar -0 362880) 0)
(num-test (make-polar -0 500029) 0)
(num-test (make-polar -0.0 -0.00000001) 0.0)
(num-test (make-polar -0.0 -1.0) 0.0)
(num-test (make-polar -0.0 -1234.0) 0.0)
(num-test (make-polar -0.0 -1234000000.0) 0.0)
(num-test (make-polar -0.0 -2.71828182845905) 0.0)
(num-test (make-polar -0.0 -3.14159265358979) 0.0)
(num-test (make-polar -0.0 0.00000001) 0.0)
(num-test (make-polar -0.0 1.0) 0.0)
(num-test (make-polar -0.0 1234.0) 0.0)
(num-test (make-polar -0.0 1234000000.0) 0.0)
(num-test (make-polar -0.0 2.71828182845905) 0.0)
(num-test (make-polar -0.0 pi) 0.0)
(num-test (make-polar -0.00000001 -0.00000001) -0.00000001+1e-16i)
(num-test (make-polar -0.00000001 -1.0) -0.00000000540302+0.00000000841471i)
(num-test (make-polar -0.00000001 -1234.0) 0.00000000798551+0.00000000601928i)
(num-test (make-polar -0.00000001 -1234000000.0) -0.00000000158909-0.00000000987293i)
(num-test (make-polar -0.00000001 -2.71828182845905) 0.00000000911734+0.00000000410781i)
(num-test (make-polar -0.00000001 (- pi)) 0.00000001)
(num-test (make-polar -0.00000001 0.00000001) -0.00000001-1e-16i)
(num-test (make-polar -0.00000001 1.0) -0.00000000540302-0.00000000841471i)
(num-test (make-polar -0.00000001 1234.0) 0.00000000798551-0.00000000601928i)
(num-test (make-polar -0.00000001 1234000000.0) -0.00000000158909+0.00000000987293i)
(num-test (make-polar -0.00000001 2.71828182845905) 0.00000000911734-0.00000000410781i)
(num-test (make-polar -0.00000001 pi) 0.00000001-0.0i)
(num-test (make-polar -1 -1) -0.54030230586814+0.84147098480790i)
(num-test (make-polar -1 -10) 0.83907152907645-0.54402111088937i)
(num-test (make-polar -1 -1234) 0.79855062358758+0.60192765476250i)
(num-test (make-polar -1 -1234000000) -0.15890913095152-0.98729321283003i)
(num-test (make-polar -1 -2) 0.41614683654714+0.90929742682568i)
(num-test (make-polar -1 -3) 0.98999249660045+0.14112000805987i)
(num-test (make-polar -1 -362880) -0.60918079547638+0.79303137291204i)
(num-test (make-polar -1 -500029) -0.85414905629947+0.52002825848479i)
(num-test (make-polar -1 1) -0.54030230586814-0.84147098480790i)
(num-test (make-polar -1 10) 0.83907152907645+0.54402111088937i)
(num-test (make-polar -1 1234) 0.79855062358758-0.60192765476250i)
(num-test (make-polar -1 1234000000) -0.15890913095152+0.98729321283003i)
(num-test (make-polar -1 2) 0.41614683654714-0.90929742682568i)
(num-test (make-polar -1 3) 0.98999249660045-0.14112000805987i)
(num-test (make-polar -1 362880) -0.60918079547638-0.79303137291204i)
(num-test (make-polar -1 500029) -0.85414905629947-0.52002825848479i)
(num-test (make-polar -1.0 -0.00000001) -1.0+0.00000001i)
(num-test (make-polar -1.0 -1.0) -0.54030230586814+0.84147098480790i)
(num-test (make-polar -1.0 -1234.0) 0.79855062358758+0.60192765476250i)
(num-test (make-polar -1.0 -1234000000.0) -0.15890913095152-0.98729321283003i)
(num-test (make-polar -1.0 -2.71828182845905) 0.91173391478697+0.41078129050291i)
(num-test (make-polar -1.0 (- pi)) 1.0)
(num-test (make-polar -1.0 0.00000001) -1.0-0.00000001i)
(num-test (make-polar -1.0 1.0) -0.54030230586814-0.84147098480790i)
(num-test (make-polar -1.0 1234.0) 0.79855062358758-0.60192765476250i)
(num-test (make-polar -1.0 1234000000.0) -0.15890913095152+0.98729321283003i)
(num-test (make-polar -1.0 2.71828182845905) 0.91173391478697-0.41078129050291i)
(num-test (make-polar -1.0 pi) 1.0-0.0i)
(num-test (make-polar -10 -1) -5.40302305868140+8.41470984807897i)
(num-test (make-polar -10 -10) 8.39071529076452-5.44021110889370i)
(num-test (make-polar -10 -1234) 7.98550623587584+6.01927654762497i)
(num-test (make-polar -10 -1234000000) -1.58909130951517-9.87293212830025i)
(num-test (make-polar -10 -2) 4.16146836547142+9.09297426825682i)
(num-test (make-polar -10 -3) 9.89992496600445+1.41120008059867i)
(num-test (make-polar -10 -362880) -6.09180795476385+7.93031372912042i)
(num-test (make-polar -10 -500029) -8.54149056299473+5.20028258484786i)
(num-test (make-polar -10 1) -5.40302305868140-8.41470984807897i)
(num-test (make-polar -10 10) 8.39071529076452+5.44021110889370i)
(num-test (make-polar -10 1234) 7.98550623587584-6.01927654762497i)
(num-test (make-polar -10 1234000000) -1.58909130951517+9.87293212830025i)
(num-test (make-polar -10 2) 4.16146836547142-9.09297426825682i)
(num-test (make-polar -10 3) 9.89992496600445-1.41120008059867i)
(num-test (make-polar -10 362880) -6.09180795476385-7.93031372912042i)
(num-test (make-polar -10 500029) -8.54149056299473-5.20028258484786i)
(num-test (make-polar -1234 -1) -666.73304544128450+1038.37519525294420i)
(num-test (make-polar -1234 -10) 1035.41426688034221-671.32205083748227i)
(num-test (make-polar -1234 -1234) 985.41146950707912+742.77872597692169i)
(num-test (make-polar -1234 -1234000000) -196.09386759417183-1218.31982463225131i)
(num-test (make-polar -1234 -2) 513.52519629917379+1122.07302470289119i)
(num-test (make-polar -1234 -3) 1221.65074080494969+174.14208994587614i)
(num-test (make-polar -1234 -362880) -751.72910161785899+978.60071417346035i)
(num-test (make-polar -1234 -500029) -1054.01993547355005+641.71487097022577i)
(num-test (make-polar -1234 1) -666.73304544128450-1038.37519525294420i)
(num-test (make-polar -1234 10) 1035.41426688034221+671.32205083748227i)
(num-test (make-polar -1234 1234) 985.41146950707912-742.77872597692169i)
(num-test (make-polar -1234 1234000000) -196.09386759417183+1218.31982463225131i)
(num-test (make-polar -1234 2) 513.52519629917379-1122.07302470289119i)
(num-test (make-polar -1234 3) 1221.65074080494969-174.14208994587614i)
(num-test (make-polar -1234 362880) -751.72910161785899-978.60071417346035i)
(num-test (make-polar -1234 500029) -1054.01993547355005-641.71487097022577i)
(num-test (make-polar -1234.0 -0.00000001) -1234.0+0.00001234000000i)
(num-test (make-polar -1234.0 -1.0) -666.73304544128450+1038.37519525294420i)
(num-test (make-polar -1234.0 -1234.0) 985.41146950707912+742.77872597692169i)
(num-test (make-polar -1234.0 -1234000000.0) -196.09386759417183-1218.31982463225131i)
(num-test (make-polar -1234.0 -2.71828182845905) 1125.07965084711486+506.90411248058950i)
(num-test (make-polar -1234.0 (- pi)) 1234.0+0.00000000000015i)
(num-test (make-polar -1234.0 0.00000001) -1234.0-0.00001234000000i)
(num-test (make-polar -1234.0 1.0) -666.73304544128450-1038.37519525294420i)
(num-test (make-polar -1234.0 1234.0) 985.41146950707912-742.77872597692169i)
(num-test (make-polar -1234.0 1234000000.0) -196.09386759417183+1218.31982463225131i)
(num-test (make-polar -1234.0 2.71828182845905) 1125.07965084711486-506.90411248058950i)
(num-test (make-polar -1234.0 pi) 1234.0-0.00000000000015i)
(num-test (make-polar -1234000000 -1) -666733045.44128441810608+1038375195.25294423103333i)
(num-test (make-polar -1234000000 -10) 1035414266.88034236431122-671322050.83748233318329i)
(num-test (make-polar -1234000000 -1234) 985411469.50707900524139+742778725.97692167758942i)
(num-test (make-polar -1234000000 -1234000000) -196093867.59417182207108-1218319824.63225126266479i)
(num-test (make-polar -1234000000 -2) 513525196.29917371273041+1122073024.70289111137390i)
(num-test (make-polar -1234000000 -3) 1221650740.80494976043701+174142089.94587615132332i)
(num-test (make-polar -1234000000 -362880) -751729101.61785900592804+978600714.17346036434174i)
(num-test (make-polar -1234000000 -500029) -1054019935.47354996204376+641714870.97022569179535i)
(num-test (make-polar -1234000000 1) -666733045.44128441810608-1038375195.25294423103333i)
(num-test (make-polar -1234000000 10) 1035414266.88034236431122+671322050.83748233318329i)
(num-test (make-polar -1234000000 1234) 985411469.50707900524139-742778725.97692167758942i)
(num-test (make-polar -1234000000 1234000000) -196093867.59417182207108+1218319824.63225126266479i)
(num-test (make-polar -1234000000 2) 513525196.29917371273041-1122073024.70289111137390i)
(num-test (make-polar -1234000000 3) 1221650740.80494976043701-174142089.94587615132332i)
(num-test (make-polar -1234000000 362880) -751729101.61785900592804-978600714.17346036434174i)
(num-test (make-polar -1234000000 500029) -1054019935.47354996204376-641714870.97022569179535i)
(num-test (make-polar -1234000000.0 -0.00000001) -1234000000.0+12.34000000000000i)
(num-test (make-polar -1234000000.0 -1.0) -666733045.44128441810608+1038375195.25294423103333i)
(num-test (make-polar -1234000000.0 -1234.0) 985411469.50707900524139+742778725.97692167758942i)
(num-test (make-polar -1234000000.0 -1234000000.0) -196093867.59417182207108-1218319824.63225126266479i)
(num-test (make-polar -1234000000.0 -2.71828182845905) 1125079650.84711480140686+506904112.48058950901031i)
(num-test (make-polar -1234000000.0 (- pi)) 1234000000.0+0.00000015111642i)
(num-test (make-polar -1234000000.0 0.00000001) -1234000000.0-12.34000000000000i)
(num-test (make-polar -1234000000.0 1.0) -666733045.44128441810608-1038375195.25294423103333i)
(num-test (make-polar -1234000000.0 1234.0) 985411469.50707900524139-742778725.97692167758942i)
(num-test (make-polar -1234000000.0 1234000000.0) -196093867.59417182207108+1218319824.63225126266479i)
(num-test (make-polar -1234000000.0 2.71828182845905) 1125079650.84711480140686-506904112.48058950901031i)
(num-test (make-polar -1234000000.0 pi) 1234000000.0-0.00000015111642i)
(num-test (make-polar -2 -1) -1.08060461173628+1.68294196961579i)
(num-test (make-polar -2 -10) 1.67814305815290-1.08804222177874i)
(num-test (make-polar -2 -1234) 1.59710124717517+1.20385530952499i)
(num-test (make-polar -2 -1234000000) -0.31781826190303-1.97458642566005i)
(num-test (make-polar -2 -2) 0.83229367309428+1.81859485365136i)
(num-test (make-polar -2 -3) 1.97998499320089+0.28224001611973i)
(num-test (make-polar -2 -362880) -1.21836159095277+1.58606274582408i)
(num-test (make-polar -2 -500029) -1.70829811259895+1.04005651696957i)
(num-test (make-polar -2 1) -1.08060461173628-1.68294196961579i)
(num-test (make-polar -2 10) 1.67814305815290+1.08804222177874i)
(num-test (make-polar -2 1234) 1.59710124717517-1.20385530952499i)
(num-test (make-polar -2 1234000000) -0.31781826190303+1.97458642566005i)
(num-test (make-polar -2 2) 0.83229367309428-1.81859485365136i)
(num-test (make-polar -2 3) 1.97998499320089-0.28224001611973i)
(num-test (make-polar -2 362880) -1.21836159095277-1.58606274582408i)
(num-test (make-polar -2 500029) -1.70829811259895-1.04005651696957i)
(num-test (make-polar -2.71828182845905 -0.00000001) -2.71828182845905+0.00000002718282i)
(num-test (make-polar -2.71828182845905 -1.0) -1.46869393991589+2.28735528717884i)
(num-test (make-polar -2.71828182845905 -1234.0) 2.17068564920277+1.63620900598787i)
(num-test (make-polar -2.71828182845905 -1234000000.0) -0.43195980304173-2.68374119979681i)
(num-test (make-polar -2.71828182845905 -2.71828182845905) 2.47834973295523+1.11661931744501i)
(num-test (make-polar -2.71828182845905 -3.14159265358979) 2.71828182845905)
(num-test (make-polar -2.71828182845905 0.00000001) -2.71828182845905-0.00000002718282i)
(num-test (make-polar -2.71828182845905 1.0) -1.46869393991589-2.28735528717884i)
(num-test (make-polar -2.71828182845905 1234.0) 2.17068564920277-1.63620900598787i)
(num-test (make-polar -2.71828182845905 1234000000.0) -0.43195980304173+2.68374119979681i)
(num-test (make-polar -2.71828182845905 2.71828182845905) 2.47834973295523-1.11661931744501i)
(num-test (make-polar -2.71828182845905 pi) 2.71828182845905-0.0i)
(num-test (make-polar -3 -1) -1.62090691760442+2.52441295442369i)
(num-test (make-polar -3 -10) 2.51721458722936-1.63206333266811i)
(num-test (make-polar -3 -1234) 2.39565187076275+1.80578296428749i)
(num-test (make-polar -3 -1234000000) -0.47672739285455-2.96187963849008i)
(num-test (make-polar -3 -2) 1.24844050964143+2.72789228047704i)
(num-test (make-polar -3 -3) 2.96997748980134+0.42336002417960i)
(num-test (make-polar -3 -362880) -1.82754238642915+2.37909411873613i)
(num-test (make-polar -3 -500029) -2.56244716889842+1.56008477545436i)
(num-test (make-polar -3 1) -1.62090691760442-2.52441295442369i)
(num-test (make-polar -3 10) 2.51721458722936+1.63206333266811i)
(num-test (make-polar -3 1234) 2.39565187076275-1.80578296428749i)
(num-test (make-polar -3 1234000000) -0.47672739285455+2.96187963849008i)
(num-test (make-polar -3 2) 1.24844050964143-2.72789228047704i)
(num-test (make-polar -3 3) 2.96997748980134-0.42336002417960i)
(num-test (make-polar -3 362880) -1.82754238642915-2.37909411873613i)
(num-test (make-polar -3 500029) -2.56244716889842-1.56008477545436i)
(num-test (make-polar -3.14159265358979 -0.00000001) -3.14159265358979+0.00000003141593i)
(num-test (make-polar -3.14159265358979 -1.0) -1.69740975483297+2.64355906408146i)
(num-test (make-polar -3.14159265358979 -1234.0) 2.50872077258230+1.89101149819439i)
(num-test (make-polar -3.14159265358979 -1234000000.0) -0.49922775838562-3.10167310436587i)
(num-test (make-polar -3.14159265358979 -2.71828182845905) 2.86429656872339+1.29050748447607i)
(num-test (make-polar -3.14159265358979 -3.14159265358979) 3.14159265358979)
(num-test (make-polar -3.14159265358979 0.00000001) -3.14159265358979-0.00000003141593i)
(num-test (make-polar -3.14159265358979 1.0) -1.69740975483297-2.64355906408146i)
(num-test (make-polar -3.14159265358979 1234.0) 2.50872077258230-1.89101149819439i)
(num-test (make-polar -3.14159265358979 1234000000.0) -0.49922775838562+3.10167310436587i)
(num-test (make-polar -3.14159265358979 2.71828182845905) 2.86429656872339-1.29050748447607i)
(num-test (make-polar -3.14159265358979 pi) 3.14159265358979-0.0i)
(num-test (make-polar -362880 -1) -196064.90075343055651+305352.99096708948491i)
(num-test (make-polar -362880 -10) 304482.27647126308875-197414.38071953449980i)
(num-test (make-polar -362880 -1234) 289778.05028746259632+218427.50736021503690i)
(num-test (make-polar -362880 -1234000000) -57664.94543968644575-358268.96107175957877i)
(num-test (make-polar -362880 -2) 151011.36404622704140+329965.85024650336709i)
(num-test (make-polar -362880 -3) 359248.47716636961559+51209.62852476461558i)
(num-test (make-polar -362880 -362880) -221059.52706247055903+287775.22460232191952i)
(num-test (make-polar -362880 -500029) -309953.60954995284555+188707.85443895909702i)
(num-test (make-polar -362880 1) -196064.90075343055651-305352.99096708948491i)
(num-test (make-polar -362880 10) 304482.27647126308875+197414.38071953449980i)
(num-test (make-polar -362880 1234) 289778.05028746259632-218427.50736021503690i)
(num-test (make-polar -362880 1234000000) -57664.94543968644575+358268.96107175957877i)
(num-test (make-polar -362880 2) 151011.36404622704140-329965.85024650336709i)
(num-test (make-polar -362880 3) 359248.47716636961559-51209.62852476461558i)
(num-test (make-polar -362880 362880) -221059.52706247055903-287775.22460232191952i)
(num-test (make-polar -362880 500029) -309953.60954995284555-188707.85443895909702i)
(num-test (make-polar -500029 -1) -270166.82170094008325+420759.89506250765407i)
(num-test (make-polar -500029 -10) 419560.09761256945785-272026.33205690066097i)
(num-test (make-polar -500029 -1234) 399298.46976187621476+300981.28328323678579i)
(num-test (make-polar -500029 -1234000000) -79459.17384055603179-493675.23791818472091i)
(num-test (make-polar -500029 -2) 208085.48653183106217+454675.08303821878508i)
(num-test (make-polar -500029 -3) 495024.95808262412902+70564.09651016735006i)
(num-test (make-polar -500029 -362880) -304608.06398126127897+396538.68436583562288i)
(num-test (make-polar -500029 -500029) -427099.29847236932255+260029.21006188896718i)
(num-test (make-polar -500029 1) -270166.82170094008325-420759.89506250765407i)
(num-test (make-polar -500029 10) 419560.09761256945785+272026.33205690066097i)
(num-test (make-polar -500029 1234) 399298.46976187621476-300981.28328323678579i)
(num-test (make-polar -500029 1234000000) -79459.17384055603179+493675.23791818472091i)
(num-test (make-polar -500029 2) 208085.48653183106217-454675.08303821878508i)
(num-test (make-polar -500029 3) 495024.95808262412902-70564.09651016735006i)
(num-test (make-polar -500029 362880) -304608.06398126127897-396538.68436583562288i)
(num-test (make-polar -500029 500029) -427099.29847236932255-260029.21006188896718i)
(num-test (make-polar 0 -1) 0)
(num-test (make-polar 0 -10) 0)
(num-test (make-polar 0 -1234) 0)
(num-test (make-polar 0 -1234000000) 0)
(num-test (make-polar 0 -2) 0)
(num-test (make-polar 0 -3) 0)
(num-test (make-polar 0 -362880) 0)
(num-test (make-polar 0 -500029) 0)
(num-test (make-polar 0 0) 0)
(num-test (make-polar 0 1) 0)
(num-test (make-polar 0 10) 0)
(num-test (make-polar 0 1234) 0)
(num-test (make-polar 0 1234000000) 0)
(num-test (make-polar 0 2) 0)
(num-test (make-polar 0 3) 0)
(num-test (make-polar 0 362880) 0)
(num-test (make-polar 0 500029) 0)
(num-test (make-polar 0 922337203685477) 0)
(num-test (make-polar 0 1/922337203685477) 0)
(num-test (make-polar 0.0 -0.00000001) 0.0)
(num-test (make-polar 0.0 -1.0) 0.0)
(num-test (make-polar 0.0 -1234.0) 0.0)
(num-test (make-polar 0.0 -1234000000.0) 0.0)
(num-test (make-polar 0.0 -2.71828182845905) 0.0)
(num-test (make-polar 0.0 -3.14159265358979) 0.0)
(num-test (make-polar 0.0 0.0) 0.0)
(num-test (make-polar 0.0 0.00000001) 0.0)
(num-test (make-polar 0.0 1.0) 0.0)
(num-test (make-polar 0.0 1234.0) 0.0)
(num-test (make-polar 0.0 1234000000.0) 0.0)
(num-test (make-polar 0.0 2.71828182845905) 0.0)
(num-test (make-polar 0.0 pi) 0.0)
(num-test (make-polar 0.00000001 -0.00000001) 0.00000001-1e-16i)
(num-test (make-polar 0.00000001 -1.0) 0.00000000540302-0.00000000841471i)
(num-test (make-polar 0.00000001 -1234.0) -0.00000000798551-0.00000000601928i)
(num-test (make-polar 0.00000001 -1234000000.0) 0.00000000158909+0.00000000987293i)
(num-test (make-polar 0.00000001 -2.71828182845905) -0.00000000911734-0.00000000410781i)
(num-test (make-polar 0.00000001 -3.14159265358979) -0.00000001-0.0i)
(num-test (make-polar 0.00000001 0.00000001) 0.00000001+1e-16i)
(num-test (make-polar 0.00000001 1.0) 0.00000000540302+0.00000000841471i)
(num-test (make-polar 0.00000001 1234.0) -0.00000000798551+0.00000000601928i)
(num-test (make-polar 0.00000001 1234000000.0) 0.00000000158909-0.00000000987293i)
(num-test (make-polar 0.00000001 2.71828182845905) -0.00000000911734+0.00000000410781i)
(num-test (make-polar 0.00000001 pi) -0.00000001)
(num-test (make-polar 1 -1) 0.54030230586814-0.84147098480790i)
(num-test (make-polar 1 -10) -0.83907152907645+0.54402111088937i)
(num-test (make-polar 1 -1234) -0.79855062358758-0.60192765476250i)
(num-test (make-polar 1 -1234000000) 0.15890913095152+0.98729321283003i)
(num-test (make-polar 1 -2) -0.41614683654714-0.90929742682568i)
(num-test (make-polar 1 -3) -0.98999249660045-0.14112000805987i)
(num-test (make-polar 1 -362880) 0.60918079547638-0.79303137291204i)
(num-test (make-polar 1 -500029) 0.85414905629947-0.52002825848479i)
(num-test (make-polar 1 1) 0.54030230586814+0.84147098480790i)
(num-test (make-polar 1 10) -0.83907152907645-0.54402111088937i)
(num-test (make-polar 1 1234) -0.79855062358758+0.60192765476250i)
(num-test (make-polar 1 1234000000) 0.15890913095152-0.98729321283003i)
(num-test (make-polar 1 2) -0.41614683654714+0.90929742682568i)
(num-test (make-polar 1 3) -0.98999249660045+0.14112000805987i)
(num-test (make-polar 1 362880) 0.60918079547638+0.79303137291204i)
(num-test (make-polar 1 500029) 0.85414905629947+0.52002825848479i)
(num-test (make-polar 1.0 -0.00000001) 1.0-0.00000001i)
(num-test (make-polar 1.0 -1.0) 0.54030230586814-0.84147098480790i)
(num-test (make-polar 1.0 -1234.0) -0.79855062358758-0.60192765476250i)
(num-test (make-polar 1.0 -1234000000.0) 0.15890913095152+0.98729321283003i)
(num-test (make-polar 1.0 -2.71828182845905) -0.91173391478697-0.41078129050291i)
(num-test (make-polar 1.0 -3.14159265358979) -1.0-0.0i)
(num-test (make-polar 1.0 0.00000001) 1.0+0.00000001i)
(num-test (make-polar 1.0 1.0) 0.54030230586814+0.84147098480790i)
(num-test (make-polar 1.0 1234.0) -0.79855062358758+0.60192765476250i)
(num-test (make-polar 1.0 1234000000.0) 0.15890913095152-0.98729321283003i)
(num-test (make-polar 1.0 2.71828182845905) -0.91173391478697+0.41078129050291i)
(num-test (make-polar 1.0 pi) -1.0)
(num-test (make-polar 10 -1) 5.40302305868140-8.41470984807897i)
(num-test (make-polar 10 -10) -8.39071529076452+5.44021110889370i)
(num-test (make-polar 10 -1234) -7.98550623587584-6.01927654762497i)
(num-test (make-polar 10 -1234000000) 1.58909130951517+9.87293212830025i)
(num-test (make-polar 10 -2) -4.16146836547142-9.09297426825682i)
(num-test (make-polar 10 -3) -9.89992496600445-1.41120008059867i)
(num-test (make-polar 10 -362880) 6.09180795476385-7.93031372912042i)
(num-test (make-polar 10 -500029) 8.54149056299473-5.20028258484786i)
(num-test (make-polar 10 1) 5.40302305868140+8.41470984807897i)
(num-test (make-polar 10 10) -8.39071529076452-5.44021110889370i)
(num-test (make-polar 10 1234) -7.98550623587584+6.01927654762497i)
(num-test (make-polar 10 1234000000) 1.58909130951517-9.87293212830025i)
(num-test (make-polar 10 2) -4.16146836547142+9.09297426825682i)
(num-test (make-polar 10 3) -9.89992496600445+1.41120008059867i)
(num-test (make-polar 10 362880) 6.09180795476385+7.93031372912042i)
(num-test (make-polar 10 500029) 8.54149056299473+5.20028258484786i)
(num-test (make-polar 1234 -1) 666.73304544128450-1038.37519525294420i)
(num-test (make-polar 1234 -10) -1035.41426688034221+671.32205083748227i)
(num-test (make-polar 1234 -1234) -985.41146950707912-742.77872597692169i)
(num-test (make-polar 1234 -1234000000) 196.09386759417183+1218.31982463225131i)
(num-test (make-polar 1234 -2) -513.52519629917379-1122.07302470289119i)
(num-test (make-polar 1234 -3) -1221.65074080494969-174.14208994587614i)
(num-test (make-polar 1234 -362880) 751.72910161785899-978.60071417346035i)
(num-test (make-polar 1234 -500029) 1054.01993547355005-641.71487097022577i)
(num-test (make-polar 1234 1) 666.73304544128450+1038.37519525294420i)
(num-test (make-polar 1234 10) -1035.41426688034221-671.32205083748227i)
(num-test (make-polar 1234 1234) -985.41146950707912+742.77872597692169i)
(num-test (make-polar 1234 1234000000) 196.09386759417183-1218.31982463225131i)
(num-test (make-polar 1234 2) -513.52519629917379+1122.07302470289119i)
(num-test (make-polar 1234 3) -1221.65074080494969+174.14208994587614i)
(num-test (make-polar 1234 362880) 751.72910161785899+978.60071417346035i)
(num-test (make-polar 1234 500029) 1054.01993547355005+641.71487097022577i)
(num-test (make-polar 1234.0 -0.00000001) 1234.0-0.00001234000000i)
(num-test (make-polar 1234.0 -1.0) 666.73304544128450-1038.37519525294420i)
(num-test (make-polar 1234.0 -1234.0) -985.41146950707912-742.77872597692169i)
(num-test (make-polar 1234.0 -1234000000.0) 196.09386759417183+1218.31982463225131i)
(num-test (make-polar 1234.0 -2.71828182845905) -1125.07965084711486-506.90411248058950i)
(num-test (make-polar 1234.0 -3.14159265358979) -1234.0-0.00000000000015i)
(num-test (make-polar 1234.0 0.00000001) 1234.0+0.00001234000000i)
(num-test (make-polar 1234.0 1.0) 666.73304544128450+1038.37519525294420i)
(num-test (make-polar 1234.0 1234.0) -985.41146950707912+742.77872597692169i)
(num-test (make-polar 1234.0 1234000000.0) 196.09386759417183-1218.31982463225131i)
(num-test (make-polar 1234.0 2.71828182845905) -1125.07965084711486+506.90411248058950i)
(num-test (make-polar 1234.0 pi) -1234.0+0.00000000000015i)
(num-test (make-polar 1234000000 -1) 666733045.44128441810608-1038375195.25294423103333i)
(num-test (make-polar 1234000000 -10) -1035414266.88034236431122+671322050.83748233318329i)
(num-test (make-polar 1234000000 -1234) -985411469.50707900524139-742778725.97692167758942i)
(num-test (make-polar 1234000000 -1234000000) 196093867.59417182207108+1218319824.63225126266479i)
(num-test (make-polar 1234000000 -2) -513525196.29917371273041-1122073024.70289111137390i)
(num-test (make-polar 1234000000 -3) -1221650740.80494976043701-174142089.94587615132332i)
(num-test (make-polar 1234000000 -362880) 751729101.61785900592804-978600714.17346036434174i)
(num-test (make-polar 1234000000 -500029) 1054019935.47354996204376-641714870.97022569179535i)
(num-test (make-polar 1234000000 1) 666733045.44128441810608+1038375195.25294423103333i)
(num-test (make-polar 1234000000 10) -1035414266.88034236431122-671322050.83748233318329i)
(num-test (make-polar 1234000000 1234) -985411469.50707900524139+742778725.97692167758942i)
(num-test (make-polar 1234000000 1234000000) 196093867.59417182207108-1218319824.63225126266479i)
(num-test (make-polar 1234000000 2) -513525196.29917371273041+1122073024.70289111137390i)
(num-test (make-polar 1234000000 3) -1221650740.80494976043701+174142089.94587615132332i)
(num-test (make-polar 1234000000 362880) 751729101.61785900592804+978600714.17346036434174i)
(num-test (make-polar 1234000000 500029) 1054019935.47354996204376+641714870.97022569179535i)
(num-test (make-polar 1234000000.0 -0.00000001) 1234000000.0-12.34000000000000i)
(num-test (make-polar 1234000000.0 -1.0) 666733045.44128441810608-1038375195.25294423103333i)
(num-test (make-polar 1234000000.0 -1234.0) -985411469.50707900524139-742778725.97692167758942i)
(num-test (make-polar 1234000000.0 -1234000000.0) 196093867.59417182207108+1218319824.63225126266479i)
(num-test (make-polar 1234000000.0 -2.71828182845905) -1125079650.84711480140686-506904112.48058950901031i)
(num-test (make-polar 1234000000.0 -3.14159265358979) -1234000000.0-0.00000015111642i)
(num-test (make-polar 1234000000.0 0.00000001) 1234000000.0+12.34000000000000i)
(num-test (make-polar 1234000000.0 1.0) 666733045.44128441810608+1038375195.25294423103333i)
(num-test (make-polar 1234000000.0 1234.0) -985411469.50707900524139+742778725.97692167758942i)
(num-test (make-polar 1234000000.0 1234000000.0) 196093867.59417182207108-1218319824.63225126266479i)
(num-test (make-polar 1234000000.0 2.71828182845905) -1125079650.84711480140686+506904112.48058950901031i)
(num-test (make-polar 1234000000.0 pi) -1234000000.0+0.00000015111642i)
(num-test (make-polar 2 -1) 1.08060461173628-1.68294196961579i)
(num-test (make-polar 2 -10) -1.67814305815290+1.08804222177874i)
(num-test (make-polar 2 -1234) -1.59710124717517-1.20385530952499i)
(num-test (make-polar 2 -1234000000) 0.31781826190303+1.97458642566005i)
(num-test (make-polar 2 -2) -0.83229367309428-1.81859485365136i)
(num-test (make-polar 2 -3) -1.97998499320089-0.28224001611973i)
(num-test (make-polar 2 -362880) 1.21836159095277-1.58606274582408i)
(num-test (make-polar 2 -500029) 1.70829811259895-1.04005651696957i)
(num-test (make-polar 2 1) 1.08060461173628+1.68294196961579i)
(num-test (make-polar 2 10) -1.67814305815290-1.08804222177874i)
(num-test (make-polar 2 1234) -1.59710124717517+1.20385530952499i)
(num-test (make-polar 2 1234000000) 0.31781826190303-1.97458642566005i)
(num-test (make-polar 2 2) -0.83229367309428+1.81859485365136i)
(num-test (make-polar 2 3) -1.97998499320089+0.28224001611973i)
(num-test (make-polar 2 362880) 1.21836159095277+1.58606274582408i)
(num-test (make-polar 2 500029) 1.70829811259895+1.04005651696957i)
(num-test (make-polar 2.71828182845905 -0.00000001) 2.71828182845905-0.00000002718282i)
(num-test (make-polar 2.71828182845905 -1.0) 1.46869393991589-2.28735528717884i)
(num-test (make-polar 2.71828182845905 -1234.0) -2.17068564920277-1.63620900598787i)
(num-test (make-polar 2.71828182845905 -1234000000.0) 0.43195980304173+2.68374119979681i)
(num-test (make-polar 2.71828182845905 -2.71828182845905) -2.47834973295523-1.11661931744501i)
(num-test (make-polar 2.71828182845905 -3.14159265358979) -2.71828182845905-0.0i)
(num-test (make-polar 2.71828182845905 0.00000001) 2.71828182845905+0.00000002718282i)
(num-test (make-polar 2.71828182845905 1.0) 1.46869393991589+2.28735528717884i)
(num-test (make-polar 2.71828182845905 1234.0) -2.17068564920277+1.63620900598787i)
(num-test (make-polar 2.71828182845905 1234000000.0) 0.43195980304173-2.68374119979681i)
(num-test (make-polar 2.71828182845905 2.71828182845905) -2.47834973295523+1.11661931744501i)
(num-test (make-polar 2.71828182845905 pi) -2.71828182845905)
(num-test (make-polar 3 -1) 1.62090691760442-2.52441295442369i)
(num-test (make-polar 3 -10) -2.51721458722936+1.63206333266811i)
(num-test (make-polar 3 -1234) -2.39565187076275-1.80578296428749i)
(num-test (make-polar 3 -1234000000) 0.47672739285455+2.96187963849008i)
(num-test (make-polar 3 -2) -1.24844050964143-2.72789228047704i)
(num-test (make-polar 3 -3) -2.96997748980134-0.42336002417960i)
(num-test (make-polar 3 -362880) 1.82754238642915-2.37909411873613i)
(num-test (make-polar 3 -500029) 2.56244716889842-1.56008477545436i)
(num-test (make-polar 3 1) 1.62090691760442+2.52441295442369i)
(num-test (make-polar 3 10) -2.51721458722936-1.63206333266811i)
(num-test (make-polar 3 1234) -2.39565187076275+1.80578296428749i)
(num-test (make-polar 3 1234000000) 0.47672739285455-2.96187963849008i)
(num-test (make-polar 3 2) -1.24844050964143+2.72789228047704i)
(num-test (make-polar 3 3) -2.96997748980134+0.42336002417960i)
(num-test (make-polar 3 362880) 1.82754238642915+2.37909411873613i)
(num-test (make-polar 3 500029) 2.56244716889842+1.56008477545436i)
(num-test (make-polar 3.14159265358979 -0.00000001) 3.14159265358979-0.00000003141593i)
(num-test (make-polar 3.14159265358979 -1.0) 1.69740975483297-2.64355906408146i)
(num-test (make-polar 3.14159265358979 -1234.0) -2.50872077258230-1.89101149819439i)
(num-test (make-polar 3.14159265358979 -1234000000.0) 0.49922775838562+3.10167310436587i)
(num-test (make-polar 3.14159265358979 -2.71828182845905) -2.86429656872339-1.29050748447607i)
(num-test (make-polar 3.14159265358979 -3.14159265358979) -3.14159265358979-0.0i)
(num-test (make-polar 3.14159265358979 0.00000001) 3.14159265358979+0.00000003141593i)
(num-test (make-polar 3.14159265358979 1.0) 1.69740975483297+2.64355906408146i)
(num-test (make-polar 3.14159265358979 1234.0) -2.50872077258230+1.89101149819439i)
(num-test (make-polar 3.14159265358979 1234000000.0) 0.49922775838562-3.10167310436587i)
(num-test (make-polar 3.14159265358979 2.71828182845905) -2.86429656872339+1.29050748447607i)
(num-test (make-polar 3.14159265358979 pi) -3.14159265358979)
(num-test (make-polar 362880 -1) 196064.90075343055651-305352.99096708948491i)
(num-test (make-polar 362880 -10) -304482.27647126308875+197414.38071953449980i)
(num-test (make-polar 362880 -1234) -289778.05028746259632-218427.50736021503690i)
(num-test (make-polar 362880 -1234000000) 57664.94543968644575+358268.96107175957877i)
(num-test (make-polar 362880 -2) -151011.36404622704140-329965.85024650336709i)
(num-test (make-polar 362880 -3) -359248.47716636961559-51209.62852476461558i)
(num-test (make-polar 362880 -362880) 221059.52706247055903-287775.22460232191952i)
(num-test (make-polar 362880 -500029) 309953.60954995284555-188707.85443895909702i)
(num-test (make-polar 362880 1) 196064.90075343055651+305352.99096708948491i)
(num-test (make-polar 362880 10) -304482.27647126308875-197414.38071953449980i)
(num-test (make-polar 362880 1234) -289778.05028746259632+218427.50736021503690i)
(num-test (make-polar 362880 1234000000) 57664.94543968644575-358268.96107175957877i)
(num-test (make-polar 362880 2) -151011.36404622704140+329965.85024650336709i)
(num-test (make-polar 362880 3) -359248.47716636961559+51209.62852476461558i)
(num-test (make-polar 362880 362880) 221059.52706247055903+287775.22460232191952i)
(num-test (make-polar 362880 500029) 309953.60954995284555+188707.85443895909702i)
(num-test (make-polar 500029 -1) 270166.82170094008325-420759.89506250765407i)
(num-test (make-polar 500029 -10) -419560.09761256945785+272026.33205690066097i)
(num-test (make-polar 500029 -1234) -399298.46976187621476-300981.28328323678579i)
(num-test (make-polar 500029 -1234000000) 79459.17384055603179+493675.23791818472091i)
(num-test (make-polar 500029 -2) -208085.48653183106217-454675.08303821878508i)
(num-test (make-polar 500029 -3) -495024.95808262412902-70564.09651016735006i)
(num-test (make-polar 500029 -362880) 304608.06398126127897-396538.68436583562288i)
(num-test (make-polar 500029 -500029) 427099.29847236932255-260029.21006188896718i)
(num-test (make-polar 500029 1) 270166.82170094008325+420759.89506250765407i)
(num-test (make-polar 500029 10) -419560.09761256945785-272026.33205690066097i)
(num-test (make-polar 500029 1234) -399298.46976187621476+300981.28328323678579i)
(num-test (make-polar 500029 1234000000) 79459.17384055603179-493675.23791818472091i)
(num-test (make-polar 500029 2) -208085.48653183106217+454675.08303821878508i)
(num-test (make-polar 500029 3) -495024.95808262412902+70564.09651016735006i)
(num-test (make-polar 500029 362880) 304608.06398126127897+396538.68436583562288i)
(num-test (make-polar 500029 500029) 427099.29847236932255+260029.21006188896718i)
(num-test (angle (make-polar 1.0 4.0)) (- 4 (* 2 pi)))
(num-test (make-polar 1/2 0) 1/2)
(num-test (make-polar 1/2 pi) -1/2)
(num-test (make-polar 1 0) 1)
(num-test (make-polar 1 1/2) 0.87758256189037+0.4794255386042i)
(num-test (make-polar 0 1/2) 0.0)
  
(test (nan? (make-polar 0 0/0)) #t)
(test (nan? (make-polar nan.0 nan.0)) #t)
(num-test (make-polar 1.0 (* 200 pi)) 1.0)
(num-test (make-polar 1.0 (* 2000000 pi)) 1.0)
(num-test (make-polar 1.0 (* 2000000000 pi)) 1.0)

(let ((val1 (catch #t (lambda () (make-polar 1.0 0.0)) (lambda args 'error)))
      (val2 (catch #t (lambda () (make-polar 1.0 -0.0)) (lambda args 'error))))
  (test (equal? val1 val2) #t))

(when with-bignums
  (test (nan? (make-polar (bignum "0/0") 0)) #t)
  (test (nan? (make-polar 0 (bignum "0/0"))) #t)
  (num-test (make-polar (bignum "1.0") (bignum "0.0")) 1.0)
  (num-test (make-polar 1000000000000000000000000.0 0.0) 1e24)
  (num-test (make-polar 1000000000000000000000000.0 pi) -1e24)
  (num-test (angle (make-polar 1000000000000000000000000.0 4.0)) (- 4 (* 2 pi)))
  (num-test (make-polar 1000000000000000000000000.0 4.0) -6.536436208636119146391681830977503814246E23-7.568024953079282513726390945118290941345E23i)
  (num-test (make-polar 1000000000000000000000000.0 -4.0) -6.536436208636119146391681830977503814246E23+7.568024953079282513726390945118290941345E23i)
  (num-test (magnitude (make-polar 1e24 (* 1e19 pi))) 1e24)
  (num-test (magnitude (make-polar 100000000000000000000000000000000000000.0 (* 1.5 pi))) 1e38)
  (num-test (magnitude (make-polar 100000000000000000000000000000000000000.0 .01)) 1e38)
  (num-test (angle (make-polar 100000000000000000000000000000000000000.0 (* 100 pi))) 0.0)
  (test (make-polar 0.0 0+92233720368547758081.0i) 'error))

(test (make-polar 0 0+0/0i) 'error)
(test (make-polar 0+0/0i 0) 'error)
(test (make-polar 1.23 1.23 1.23) 'error)
(test (make-polar 1.23) 'error)
(test (make-polar 1.23+1.0i 1.23+1.0i) 'error)
(test (make-polar) 'error)
(test (make-polar 1.0 1.0+0.1i) 'error)
(test (make-polar 1.0+0.1i 0.0) 'error)
(for-each
 (lambda (x)
   (test (make-polar x 0-i) 'error))
 (list 0 1 1/2 1.0 0.0 0+i))
(for-each
 (lambda (x)
   (test (make-polar 0-i x) 'error))
 (list 0 1 1/2 pi (- pi) 0.0 1.0 0+i))

(for-each
 (lambda (arg)
   (test (make-polar arg 0.0) 'error)
   (test (make-polar 0.0 arg) 'error)
   (test (make-polar 1 arg) 'error)
   (test (make-polar 1/2 arg) 'error)
   (test (make-polar 1+i arg) 'error)
   (test (make-polar arg nan.0) 'error)
   (test (make-polar nan.0 arg) 'error)
   (test (make-polar arg inf.0) 'error)
   (test (make-polar inf.0 arg) 'error))
 (list "hi" () (integer->char 65) #f #t 0+i '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))




;;; --------------------------------------------------------------------------------
;;; abs
;;; --------------------------------------------------------------------------------

(num-test (abs -0) 0)
(num-test (abs -0.0) 0.0)
(num-test (abs -0.00000001) 0.00000001)
(num-test (abs -0/1) 0/1)
(num-test (abs -0/10) 0/10)
(num-test (abs -0/1234) 0/1234)
(num-test (abs -0/1234000000) 0/1234000000)
(num-test (abs -0/2) 0/2)
(num-test (abs -0/3) 0/3)
(num-test (abs -0/362880) 0/362880)
(num-test (abs -0/500029) 0/500029)
(num-test (abs -1) 1)
(num-test (abs -1.0) 1.0)
(num-test (abs -1/1) 1/1)
(num-test (abs -1/10) 1/10)
(num-test (abs -1/1234) 1/1234)
(num-test (abs -1/1234000000) 1/1234000000)
(num-test (abs -1/2) 1/2)
(num-test (abs -1/3) 1/3)
(num-test (abs -1/362880) 1/362880)
(num-test (abs -1/500029) 1/500029)
(num-test (abs -1/9223372036854775807) 1/9223372036854775807)
(num-test (abs -10) 10)
(num-test (abs -10/1) 10/1)
(num-test (abs -10/10) 10/10)
(num-test (abs -10/1234) 10/1234)
(num-test (abs -10/1234000000) 10/1234000000)
(num-test (abs -10/2) 10/2)
(num-test (abs -10/3) 10/3)
(num-test (abs -10/362880) 10/362880)
(num-test (abs -10/500029) 10/500029)
(num-test (abs -1234) 1234)
(num-test (abs -1234.0) 1234.0)
(num-test (abs -1234/1) 1234/1)
(num-test (abs -1234/10) 1234/10)
(num-test (abs -1234/1234) 1234/1234)
(num-test (abs -1234/1234000000) 1234/1234000000)
(num-test (abs -1234/2) 1234/2)
(num-test (abs -1234/3) 1234/3)
(num-test (abs -1234/362880) 1234/362880)
(num-test (abs -1234/500029) 1234/500029)
(num-test (abs -1234000000) 1234000000)
(num-test (abs -1234000000.0) 1234000000.0)
(num-test (abs -1234000000/1) 1234000000/1)
(num-test (abs -1234000000/10) 1234000000/10)
(num-test (abs -1234000000/1234) 1234000000/1234)
(num-test (abs -1234000000/1234000000) 1234000000/1234000000)
(num-test (abs -1234000000/2) 1234000000/2)
(num-test (abs -1234000000/3) 1234000000/3)
(num-test (abs -1234000000/362880) 1234000000/362880)
(num-test (abs -1234000000/500029) 1234000000/500029)
(num-test (abs -123456789) 123456789)
(num-test (abs -1234567890) 1234567890)
(num-test (abs -2) 2)
(num-test (abs -2.71828182845905) 2.71828182845905)
(num-test (abs -2/1) 2/1)
(num-test (abs -2/10) 2/10)
(num-test (abs -2/1234) 2/1234)
(num-test (abs -2/1234000000) 2/1234000000)
(num-test (abs -2/2) 2/2)
(num-test (abs -2/3) 2/3)
(num-test (abs -2/362880) 2/362880)
(num-test (abs -2/500029) 2/500029)
(num-test (abs -3) 3)
(num-test (abs -3.14159265358979) pi)
(num-test (abs -3/1) 3/1)
(num-test (abs -3/10) 3/10)
(num-test (abs -3/1234) 3/1234)
(num-test (abs -3/1234000000) 3/1234000000)
(num-test (abs -3/2) 3/2)
(num-test (abs -3/3) 3/3)
(num-test (abs -3/362880) 3/362880)
(num-test (abs -3/500029) 3/500029)
(num-test (abs -362880) 362880)
(num-test (abs -362880/1) 362880/1)
(num-test (abs -362880/10) 362880/10)
(num-test (abs -362880/1234) 362880/1234)
(num-test (abs -362880/1234000000) 362880/1234000000)
(num-test (abs -362880/2) 362880/2)
(num-test (abs -362880/3) 362880/3)
(num-test (abs -362880/362880) 362880/362880)
(num-test (abs -362880/500029) 362880/500029)
(num-test (abs -500029) 500029)
(num-test (abs -500029/1) 500029/1)
(num-test (abs -500029/10) 500029/10)
(num-test (abs -500029/1234) 500029/1234)
(num-test (abs -500029/1234000000) 500029/1234000000)
(num-test (abs -500029/2) 500029/2)
(num-test (abs -500029/3) 500029/3)
(num-test (abs -500029/362880) 500029/362880)
(num-test (abs -500029/500029) 500029/500029)
(num-test (abs -6) 6)
(num-test (abs -7) 7)
(num-test (abs 0) 0)
(num-test (abs 0.0) 0.0)
(num-test (abs 0.00000001) 0.00000001)
(num-test (abs 0/1) 0/1)
(num-test (abs 0/10) 0/10)
(num-test (abs 0/1234) 0/1234)
(num-test (abs 0/1234000000) 0/1234000000)
(num-test (abs 0/2) 0/2)
(num-test (abs 0/3) 0/3)
(num-test (abs 0/362880) 0/362880)
(num-test (abs 0/500029) 0/500029)
(num-test (abs 1) 1)
(num-test (abs 1.0) 1.0)
(num-test (abs 1/1) 1/1)
(num-test (abs 1/10) 1/10)
(num-test (abs 1/1234) 1/1234)
(num-test (abs 1/1234000000) 1/1234000000)
(num-test (abs 1/2) 1/2)
(num-test (abs 1/3) 1/3)
(num-test (abs 1/362880) 1/362880)
(num-test (abs 1/500029) 1/500029)
(num-test (abs 10) 10)
(num-test (abs 10/1) 10/1)
(num-test (abs 10/10) 10/10)
(num-test (abs 10/1234) 10/1234)
(num-test (abs 10/1234000000) 10/1234000000)
(num-test (abs 10/2) 10/2)
(num-test (abs 10/3) 10/3)
(num-test (abs 10/362880) 10/362880)
(num-test (abs 10/500029) 10/500029)
(num-test (abs 1234) 1234)
(num-test (abs 1234.0) 1234.0)
(num-test (abs 1234/1) 1234/1)
(num-test (abs 1234/10) 1234/10)
(num-test (abs 1234/1234) 1234/1234)
(num-test (abs 1234/1234000000) 1234/1234000000)
(num-test (abs 1234/2) 1234/2)
(num-test (abs 1234/3) 1234/3)
(num-test (abs 1234/362880) 1234/362880)
(num-test (abs 1234/500029) 1234/500029)
(num-test (abs 1234000000) 1234000000)
(num-test (abs 1234000000.0) 1234000000.0)
(num-test (abs 1234000000/1) 1234000000/1)
(num-test (abs 1234000000/10) 1234000000/10)
(num-test (abs 1234000000/1234) 1234000000/1234)
(num-test (abs 1234000000/1234000000) 1234000000/1234000000)
(num-test (abs 1234000000/2) 1234000000/2)
(num-test (abs 1234000000/3) 1234000000/3)
(num-test (abs 1234000000/362880) 1234000000/362880)
(num-test (abs 1234000000/500029) 1234000000/500029)
(num-test (abs 2) 2)
(num-test (abs 2.71828182845905) 2.71828182845905)
(num-test (abs 2/1) 2/1)
(num-test (abs 2/10) 2/10)
(num-test (abs 2/1234) 2/1234)
(num-test (abs 2/1234000000) 2/1234000000)
(num-test (abs 2/2) 2/2)
(num-test (abs 2/3) 2/3)
(num-test (abs 2/362880) 2/362880)
(num-test (abs 2/500029) 2/500029)
(num-test (abs 3) 3)
(num-test (abs 3/1) 3/1)
(num-test (abs 3/10) 3/10)
(num-test (abs 3/1234) 3/1234)
(num-test (abs 3/1234000000) 3/1234000000)
(num-test (abs 3/2) 3/2)
(num-test (abs 3/3) 3/3)
(num-test (abs 3/362880) 3/362880)
(num-test (abs 3/500029) 3/500029)
(num-test (abs 362880) 362880)
(num-test (abs 362880/1) 362880/1)
(num-test (abs 362880/10) 362880/10)
(num-test (abs 362880/1234) 362880/1234)
(num-test (abs 362880/1234000000) 362880/1234000000)
(num-test (abs 362880/2) 362880/2)
(num-test (abs 362880/3) 362880/3)
(num-test (abs 362880/362880) 362880/362880)
(num-test (abs 362880/500029) 362880/500029)
(num-test (abs 500029) 500029)
(num-test (abs 500029/1) 500029/1)
(num-test (abs 500029/10) 500029/10)
(num-test (abs 500029/1234) 500029/1234)
(num-test (abs 500029/1234000000) 500029/1234000000)
(num-test (abs 500029/2) 500029/2)
(num-test (abs 500029/3) 500029/3)
(num-test (abs 500029/362880) 500029/362880)
(num-test (abs 500029/500029) 500029/500029)
(num-test (abs 6) 6)
(num-test (abs 7) 7)
(num-test (abs pi) pi)

(num-test (abs -2.225073858507201399999999999999999999996E-308) 2.225073858507201399999999999999999999996E-308)
(num-test (abs -9223372036854775808) (if with-bignums 9223372036854775808 9223372036854775807)) ; changed 28-Apr-15
(num-test (abs 1.110223024625156799999999999999999999997E-16) 1.110223024625156799999999999999999999997E-16)
(num-test (abs 9223372036854775807) 9223372036854775807)
(test (= (abs (+ most-negative-fixnum 1)) most-positive-fixnum) #t)
(test (abs most-positive-fixnum) most-positive-fixnum)
(num-test (abs -922337203685477580) 922337203685477580)

(for-each
 (lambda (num-and-val)
   (let ((num (car num-and-val)) (val (cadr num-and-val))) (num-test-1 'abs num (abs num) val)))
 (vector (list 0 0) (list 1 1) (list 2 2) (list 3 3) (list -1 1) (list -2 2) (list -3 3) (list 9223372036854775807 9223372036854775807) 
	 (list 1/2 1/2) (list 1/3 1/3) (list -1/2 1/2) 
	 (list -1/3 1/3) (list 1/9223372036854775807 1/9223372036854775807) (list 0.0 0.0) 
	 (list 1.0 1.0) (list 2.0 2.0) (list -2.0 2.0) (list 1.000000000000000000000000000000000000002E-309 1.000000000000000000000000000000000000002E-309) 
	 (list 1e+16 1e+16) ))
  
(when with-bignums
  (num-test (abs -1e310) 1e310)
  (num-test (abs -.1e310) 1e309)
  (num-test (abs -.00001e309) 1e304)
  (num-test (abs most-negative-fixnum) 9223372036854775808)
  (num-test (abs -.1e-400) 1.000000000000000000000000000000000000001E-401)
  (num-test (abs -1.797693134862315699999999999999999999998E308) 1.797693134862315699999999999999999999998E308)
  (num-test (abs -12345678901234567890) 12345678901234567890)
  (num-test (abs 12345678901234567890) 12345678901234567890)
  (num-test (abs 9223372036854775808.0) 9223372036854775808.0)
  (num-test (abs -9223372036854775808.0) 9223372036854775808.0)
  (num-test (abs 9223372036854775808/3) 9223372036854775808/3)
  (num-test (abs -9223372036854775808/3) 9223372036854775808/3)
  (num-test (abs 9223372036854775808) 9223372036854775808)
  (num-test (abs -9223372036854775808) 9223372036854775808)
  (num-test (abs 1231234567891234567895/4924938271564938271564) 1231234567891234567895/4924938271564938271564)
  (num-test (abs -1231234567891234567895/4924938271564938271564) 1231234567891234567895/4924938271564938271564)
  (num-test (abs 5/4924938271564938271564) 5/4924938271564938271564)
  (num-test (abs -5/4924938271564938271564) 5/4924938271564938271564)
  (num-test (abs 1231234567891234567895.4924938271564938271564) 1231234567891234567895.4924938271564938271564)
  (num-test (abs -1231234567891234567895.4924938271564938271564) 1231234567891234567895.4924938271564938271564)
  
  (test (< (abs (- 217307123869033896670383722255101771944951615456222473725950809456844385078286527901170732595082536915607499776643486838126400154358628745576030002134993982282420557293291331398770482226850626076965834765751024210059623687394545134173058036837172944503241193618487196846261991269480351798163386073355597133702428176134419602160051931823812274538708325328119629419660293102211559158897247464223430070715316610068188075169995173607390273159413073729599663002285391560133032803005324145809498542320942319/69171005865679080805116192745197553936743146778127491628445014149228719516632195993428601364184241694325570308897501794466504355763015991674090032275753543906386364041957503000266249940077862458146827521257517440768326138892186263673940157476537922438310169667984623997354774657585797547359740040386280140433453254961653602051204994301868729700341678413408419088335979860854285428030584998257285624659397393914631805389952520897186723117920856639645035858695810847480593484518166856238091362466500961 pi)) 1e-30) #t)
  (test (< (abs (- 86506249226122124054607019515040072569389309675677090446756879032293209564976057920114008345082990143050895371432654098617595803586181179031736344131661104245709204440599410618785461104070923873664766537405043170624321277708803595336768044461421851475181966244993926088957647640608814315524675779027527947452743019231877030652479460288601395608061537360792381908211008391170537372395545350366754911899795085297260398105485029514527793853213999006311528934617756311568188335120606938078206683552323219/31823870623143321794788842272907994994917601540780651644441590671647399038540853367332145707942720183928541015066510539504636213034857780420049324239395126123695561521079512763516656025946557452382852551302156382716241918690232497805575429042492016743374932252325803315778289435501557305339709678335435100310171257145989526559485407857600325792028152511795618358674583299689136950642929744615564346477399823659926550178426308547711386364571735861738189405232059295317994009776897697526162381026548407 (exp 1.0))) 1e-10) #t)
  
  (test (< (abs (- 394372834342725903069943709807632345074473102456264/125532772013612015195543173729505082616186012726141 pi)) 1e-100) #t)
  (test (< (abs (- 37263594917349868210957473113622483286895975031882232950275573404793068492510874215659862655765029385/11861370656940517106115970314230542917832783292279765360251185207749769595904108589726721941267812387 pi)) 1e-200) #t)
  (test (< (abs (- 9723120205746844213570925835953968530586731050832362731080980958991370971563630998369876152193644009314571826202389376113741653418445346223192649145551112347805140423409409719828584948506325652698166338315337526327656688617124164275819596889301942895/3094965286042593318538169915190725425595617454610327314732861344227207817775353866654459841280603529756895813991351842180977260125352058245398197717632118060786828996125027995519815695529226138848308047979443033939320415958110104195587441744710374021 pi)) 1e-500) #t)
  (test (< (abs (- 217307123869033896670383722255101771944951615456222473725950809456844385078286527901170732595082536915607499776643486838126400154358628745576030002134993982282420557293291331398770482226850626076965834765751024210059623687394545134173058036837172944503241193618487196846261991269480351798163386073355597133702428176134419602160051931823812274538708325328119629419660293102211559158897247464223430070715316610068188075169995173607390273159413073729599663002285391560133032803005324145809498542320942319/69171005865679080805116192745197553936743146778127491628445014149228719516632195993428601364184241694325570308897501794466504355763015991674090032275753543906386364041957503000266249940077862458146827521257517440768326138892186263673940157476537922438310169667984623997354774657585797547359740040386280140433453254961653602051204994301868729700341678413408419088335979860854285428030584998257285624659397393914631805389952520897186723117920856639645035858695810847480593484518166856238091362466500961 pi)) 1e-1000) #t)
  (test (< (abs (- 86506249226122124054607019515040072569389309675677090446756879032293209564976057920114008345082990143050895371432654098617595803586181179031736344131661104245709204440599410618785461104070923873664766537405043170624321277708803595336768044461421851475181966244993926088957647640608814315524675779027527947452743019231877030652479460288601395608061537360792381908211008391170537372395545350366754911899795085297260398105485029514527793853213999006311528934617756311568188335120606938078206683552323219/31823870623143321794788842272907994994917601540780651644441590671647399038540853367332145707942720183928541015066510539504636213034857780420049324239395126123695561521079512763516656025946557452382852551302156382716241918690232497805575429042492016743374932252325803315778289435501557305339709678335435100310171257145989526559485407857600325792028152511795618358674583299689136950642929744615564346477399823659926550178426308547711386364571735861738189405232059295317994009776897697526162381026548407 (exp (bignum "1.0")))) 1e-1000) #t))

(test (abs 0+0i) 0.0)
(test (abs 1.23 1.23) 'error)
(test (abs 1.23+1.0i) 'error)
(test (abs) 'error)
(test (nan? (abs 1/0)) #t)
(test (positive? (abs (real-part (log 0.0)))) #t)
(if (not pure-s7) (test (abs 1.0+0.1i) 'error))

;; an optimizer bug
(let () (define (t1) (let ((a 1+i) (b 0+i)) (abs (- a b)))) (num-test (t1) 1.0))

(for-each
 (lambda (arg)
   (test (abs arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))



;;; --------------------------------------------------------------------------------
;;; magnitude
;;; --------------------------------------------------------------------------------

(num-test (magnitude (complex (expt 2 62) (expt 2 62))) 6.521908912666391106174785903126254184439E18)
(num-test (magnitude (complex most-positive-fixnum most-negative-fixnum)) 1.30438178253327822116424650250659608445E19)
(num-test (magnitude (complex most-positive-fixnum most-positive-fixnum)) 1.304381782533278221093535824387941332006E19)
(num-test (magnitude -0) 0)
(num-test (magnitude -0.0) 0.0)
(num-test (magnitude -0.0+0.00000001i) 0.00000001)
(num-test (magnitude -0.0+1.0i) 1.0)
(num-test (magnitude -0.0+1234.0i) 1234.0)
(num-test (magnitude -0.0+1234000000.0i) 1234000000.0)
(num-test (magnitude -0.0+2.71828182845905i) 2.71828182845905)
(num-test (magnitude -0.0+3.14159265358979i) 3.14159265358979)
(num-test (magnitude -0.0-0.00000001i) 0.00000001)
(num-test (magnitude -0.0-1.0i) 1.0)
(num-test (magnitude -0.0-1234.0i) 1234.0)
(num-test (magnitude -0.0-1234000000.0i) 1234000000.0)
(num-test (magnitude -0.0-2.71828182845905i) 2.71828182845905)
(num-test (magnitude -0.0-3.14159265358979i) 3.14159265358979)
(num-test (magnitude -0.00000001) 0.00000001)
(num-test (magnitude -0.00000001+0.00000001i) 0.00000001414214)
(num-test (magnitude -0.00000001+1.0i) 1.0)
(num-test (magnitude -0.00000001+1234.0i) 1234.0)
(num-test (magnitude -0.00000001+1234000000.0i) 1234000000.0)
(num-test (magnitude -0.00000001+2.71828182845905i) 2.71828182845905)
(num-test (magnitude -0.00000001+3.14159265358979i) pi)
(num-test (magnitude -0.00000001-0.00000001i) 0.00000001414214)
(num-test (magnitude -0.00000001-1.0i) 1.0)
(num-test (magnitude -0.00000001-1234.0i) 1234.0)
(num-test (magnitude -0.00000001-1234000000.0i) 1234000000.0)
(num-test (magnitude -0.00000001-2.71828182845905i) 2.71828182845905)
(num-test (magnitude -0.00000001-3.14159265358979i) pi)
(num-test (magnitude -0/1) 0/1)
(num-test (magnitude -0/10) 0/10)
(num-test (magnitude -0/1234) 0/1234)
(num-test (magnitude -0/1234000000) 0/1234000000)
(num-test (magnitude -0/2) 0/2)
(num-test (magnitude -0/3) 0/3)
(num-test (magnitude -0/362880) 0/362880)
(num-test (magnitude -0/500029) 0/500029)
(num-test (magnitude -1) 1)
(num-test (magnitude -1.0) 1.0)
(num-test (magnitude -1.0+0.00000001i) 1.0)
(num-test (magnitude -1.0+1.0i) 1.41421356237310)
(num-test (magnitude -1.0+1234.0i) 1234.00040518631931)
(num-test (magnitude -1.0+1234000000.0i) 1234000000.0)
(num-test (magnitude -1.0+2.71828182845905i) 2.89638673159001)
(num-test (magnitude -1.0+3.14159265358979i) 3.29690830947562)
(num-test (magnitude -1.0-0.00000001i) 1.0)
(num-test (magnitude -1.0-1.0i) 1.41421356237310)
(num-test (magnitude -1.0-1234.0i) 1234.00040518631931)
(num-test (magnitude -1.0-1234000000.0i) 1234000000.0)
(num-test (magnitude -1.0-2.71828182845905i) 2.89638673159001)
(num-test (magnitude -1.0-3.14159265358979i) 3.29690830947562)
(num-test (magnitude -1.0e+00+0.0e+00i) 1e0)
(num-test (magnitude -1.0e+00+1.0e+00i) 1.4142135623730950488e0)
(num-test (magnitude -1.0e+00+1.19209289550781250e-07i) 1.0000000000000071054e0)
(num-test (magnitude -1.0e+00+2.0e+00i) 2.2360679774997896964e0)
(num-test (magnitude -1.0e+00+5.0e-01i) 1.1180339887498948482e0)
(num-test (magnitude -1.0e+00+8.3886080e+06i) 8.3886080000000596046e6)
(num-test (magnitude -1.0e+00-1.0e+00i) 1.4142135623730950488e0)
(num-test (magnitude -1.0e+00-1.19209289550781250e-07i) 1.0000000000000071054e0)
(num-test (magnitude -1.0e+00-2.0e+00i) 2.2360679774997896964e0)
(num-test (magnitude -1.0e+00-5.0e-01i) 1.1180339887498948482e0)
(num-test (magnitude -1.0e+00-8.3886080e+06i) 8.3886080000000596046e6)
(num-test (magnitude -1.19209289550781250e-07+0.0e+00i) 1.1920928955078125e-7)
(num-test (magnitude -1.19209289550781250e-07+1.0e+00i) 1.0000000000000071054e0)
(num-test (magnitude -1.19209289550781250e-07+1.19209289550781250e-07i) 1.6858739404357612715e-7)
(num-test (magnitude -1.19209289550781250e-07+2.0e+00i) 2.0000000000000035527e0)
(num-test (magnitude -1.19209289550781250e-07+5.0e-01i) 5.0000000000001421085e-1)
(num-test (magnitude -1.19209289550781250e-07+8.3886080e+06i) 8.3886080e6)
(num-test (magnitude -1.19209289550781250e-07-1.0e+00i) 1.0000000000000071054e0)
(num-test (magnitude -1.19209289550781250e-07-1.19209289550781250e-07i) 1.6858739404357612715e-7)
(num-test (magnitude -1.19209289550781250e-07-2.0e+00i) 2.0000000000000035527e0)
(num-test (magnitude -1.19209289550781250e-07-5.0e-01i) 5.0000000000001421085e-1)
(num-test (magnitude -1.19209289550781250e-07-8.3886080e+06i) 8.3886080e6)
(num-test (magnitude -1/1) 1/1)
(num-test (magnitude -1/10) 1/10)
(num-test (magnitude -1/1234) 1/1234)
(num-test (magnitude -1/1234000000) 1/1234000000)
(num-test (magnitude -1/2) 1/2)
(num-test (magnitude -1/3) 1/3)
(num-test (magnitude -1/362880) 1/362880)
(num-test (magnitude -1/500029) 1/500029)
(num-test (magnitude -10) 10)
(num-test (magnitude -10/1) 10/1)
(num-test (magnitude -10/10) 10/10)
(num-test (magnitude -10/1234) 10/1234)
(num-test (magnitude -10/1234000000) 10/1234000000)
(num-test (magnitude -10/2) 10/2)
(num-test (magnitude -10/3) 10/3)
(num-test (magnitude -10/362880) 10/362880)
(num-test (magnitude -10/500029) 10/500029)
(num-test (magnitude -1234) 1234)
(num-test (magnitude -1234.0) 1234.0)
(num-test (magnitude -1234.0+0.00000001i) 1234.0)
(num-test (magnitude -1234.0+1.0i) 1234.00040518631931)
(num-test (magnitude -1234.0+1234.0i) 1745.13953596839929)
(num-test (magnitude -1234.0+1234000000.0i) 1234000000.00061702728271)
(num-test (magnitude -1234.0+2.71828182845905i) 1234.00299394130275)
(num-test (magnitude -1234.0+3.14159265358979i) 1234.00399902285608)
(num-test (magnitude -1234.0-0.00000001i) 1234.0)
(num-test (magnitude -1234.0-1.0i) 1234.00040518631931)
(num-test (magnitude -1234.0-1234.0i) 1745.13953596839929)
(num-test (magnitude -1234.0-1234000000.0i) 1234000000.00061702728271)
(num-test (magnitude -1234.0-2.71828182845905i) 1234.00299394130275)
(num-test (magnitude -1234.0-3.14159265358979i) 1234.00399902285608)
(num-test (magnitude -1234/1) 1234/1)
(num-test (magnitude -1234/10) 1234/10)
(num-test (magnitude -1234/1234) 1234/1234)
(num-test (magnitude -1234/1234000000) 1234/1234000000)
(num-test (magnitude -1234/2) 1234/2)
(num-test (magnitude -1234/3) 1234/3)
(num-test (magnitude -1234/362880) 1234/362880)
(num-test (magnitude -1234/500029) 1234/500029)
(num-test (magnitude -1234000000) 1234000000)
(num-test (magnitude -1234000000.0) 1234000000.0)
(num-test (magnitude -1234000000.0+0.00000001i) 1234000000.0)
(num-test (magnitude -1234000000.0+1.0i) 1234000000.0)
(num-test (magnitude -1234000000.0+1234.0i) 1234000000.00061702728271)
(num-test (magnitude -1234000000.0+1234000000.0i) 1745139535.96839928627014)
(num-test (magnitude -1234000000.0+2.71828182845905i) 1234000000.0)
(num-test (magnitude -1234000000.0+3.14159265358979i) 1234000000.0)
(num-test (magnitude -1234000000.0-0.00000001i) 1234000000.0)
(num-test (magnitude -1234000000.0-1.0i) 1234000000.0)
(num-test (magnitude -1234000000.0-1234.0i) 1234000000.00061702728271)
(num-test (magnitude -1234000000.0-1234000000.0i) 1745139535.96839928627014)
(num-test (magnitude -1234000000.0-2.71828182845905i) 1.23400000000000000299394493473690280451E9)
(num-test (magnitude -1234000000.0-3.14159265358979i) 1.234000000000000003999029335935712420981E9)
(num-test (magnitude -1234000000/1) 1234000000/1)
(num-test (magnitude -1234000000/10) 1234000000/10)
(num-test (magnitude -1234000000/1234) 1234000000/1234)
(num-test (magnitude -1234000000/1234000000) 1234000000/1234000000)
(num-test (magnitude -1234000000/2) 1234000000/2)
(num-test (magnitude -1234000000/3) 1234000000/3)
(num-test (magnitude -1234000000/362880) 1234000000/362880)
(num-test (magnitude -1234000000/500029) 1234000000/500029)
(num-test (magnitude -2) 2)
(num-test (magnitude -2.0e+00+0.0e+00i) 2e0)
(num-test (magnitude -2.0e+00+1.0e+00i) 2.2360679774997896964e0)
(num-test (magnitude -2.0e+00+1.19209289550781250e-07i) 2.0000000000000035527e0)
(num-test (magnitude -2.0e+00+2.0e+00i) 2.8284271247461900976e0)
(num-test (magnitude -2.0e+00+5.0e-01i) 2.0615528128088302749e0)
(num-test (magnitude -2.0e+00+8.3886080e+06i) 8.3886080000002384186e6)
(num-test (magnitude -2.0e+00-1.0e+00i) 2.2360679774997896964e0)
(num-test (magnitude -2.0e+00-1.19209289550781250e-07i) 2.0000000000000035527e0)
(num-test (magnitude -2.0e+00-2.0e+00i) 2.8284271247461900976e0)
(num-test (magnitude -2.0e+00-5.0e-01i) 2.0615528128088302749e0)
(num-test (magnitude -2.0e+00-8.3886080e+06i) 8.3886080000002384186e6)
(num-test (magnitude -2.71828182845905) 2.71828182845905)
(num-test (magnitude -2.71828182845905+0.00000001i) 2.71828182845905)
(num-test (magnitude -2.71828182845905+1.0i) 2.89638673159001)
(num-test (magnitude -2.71828182845905+1234.0i) 1234.00299394130275)
(num-test (magnitude -2.71828182845905+1234000000.0i) 1234000000.0)
(num-test (magnitude -2.71828182845905+2.71828182845905i) 3.84423102815912)
(num-test (magnitude -2.71828182845905+3.14159265358979i) 4.15435440231331)
(num-test (magnitude -2.71828182845905+3.14159265358979i) 4.15435440231331)
(num-test (magnitude -2.71828182845905-0.00000001i) 2.71828182845905)
(num-test (magnitude -2.71828182845905-1.0i) 2.89638673159001)
(num-test (magnitude -2.71828182845905-1234.0i) 1234.00299394130275)
(num-test (magnitude -2.71828182845905-1234000000.0i) 1234000000.0)
(num-test (magnitude -2.71828182845905-2.71828182845905i) 3.84423102815912)
(num-test (magnitude -2.71828182845905-3.14159265358979i) 4.15435440231331)
(num-test (magnitude -2/1) 2/1)
(num-test (magnitude -2/10) 2/10)
(num-test (magnitude -2/1234) 2/1234)
(num-test (magnitude -2/1234000000) 2/1234000000)
(num-test (magnitude -2/2) 2/2)
(num-test (magnitude -2/3) 2/3)
(num-test (magnitude -2/362880) 2/362880)
(num-test (magnitude -2/500029) 2/500029)
(num-test (magnitude -3) 3)
(num-test (magnitude -3.14159265358979) pi)
(num-test (magnitude -3.14159265358979+0.00000001i) pi)
(num-test (magnitude -3.14159265358979+1.0i) 3.29690830947562)
(num-test (magnitude -3.14159265358979+1234.0i) 1234.00399902285608)
(num-test (magnitude -3.14159265358979+1234000000.0i) 1234000000.0)
(num-test (magnitude -3.14159265358979+2.71828182845905i) 4.15435440231331)
(num-test (magnitude -3.14159265358979+3.14159265358979i) 4.44288293815837)
(num-test (magnitude -3.14159265358979-0.00000001i) pi)
(num-test (magnitude -3.14159265358979-1.0i) 3.29690830947562)
(num-test (magnitude -3.14159265358979-1234.0i) 1234.00399902285608)
(num-test (magnitude -3.14159265358979-1234000000.0i) 1234000000.0)
(num-test (magnitude -3.14159265358979-2.71828182845905i) 4.15435440231331)
(num-test (magnitude -3.14159265358979-3.14159265358979i) 4.44288293815837)
(num-test (magnitude -3/1) 3/1)
(num-test (magnitude -3/10) 3/10)
(num-test (magnitude -3/1234) 3/1234)
(num-test (magnitude -3/1234000000) 3/1234000000)
(num-test (magnitude -3/2) 3/2)
(num-test (magnitude -3/3) 3/3)
(num-test (magnitude -3/362880) 3/362880)
(num-test (magnitude -3/500029) 3/500029)
(num-test (magnitude -362880) 362880)
(num-test (magnitude -362880/1) 362880/1)
(num-test (magnitude -362880/10) 362880/10)
(num-test (magnitude -362880/1234) 362880/1234)
(num-test (magnitude -362880/1234000000) 362880/1234000000)
(num-test (magnitude -362880/2) 362880/2)
(num-test (magnitude -362880/3) 362880/3)
(num-test (magnitude -362880/362880) 362880/362880)
(num-test (magnitude -362880/500029) 362880/500029)
(num-test (magnitude -5.0e-01+0.0e+00i) 5e-1)
(num-test (magnitude -5.0e-01+1.0e+00i) 1.1180339887498948482e0)
(num-test (magnitude -5.0e-01+1.19209289550781250e-07i) 5.0000000000001421085e-1)
(num-test (magnitude -5.0e-01+2.0e+00i) 2.0615528128088302749e0)
(num-test (magnitude -5.0e-01+5.0e-01i) 7.0710678118654752440e-1)
(num-test (magnitude -5.0e-01+8.3886080e+06i) 8.3886080000000149012e6)
(num-test (magnitude -5.0e-01-1.0e+00i) 1.1180339887498948482e0)
(num-test (magnitude -5.0e-01-1.19209289550781250e-07i) 5.0000000000001421085e-1)
(num-test (magnitude -5.0e-01-2.0e+00i) 2.0615528128088302749e0)
(num-test (magnitude -5.0e-01-5.0e-01i) 7.0710678118654752440e-1)
(num-test (magnitude -5.0e-01-8.3886080e+06i) 8.3886080000000149012e6)
(num-test (magnitude -500029) 500029)
(num-test (magnitude -500029/1) 500029/1)
(num-test (magnitude -500029/10) 500029/10)
(num-test (magnitude -500029/1234) 500029/1234)
(num-test (magnitude -500029/1234000000) 500029/1234000000)
(num-test (magnitude -500029/2) 500029/2)
(num-test (magnitude -500029/3) 500029/3)
(num-test (magnitude -500029/362880) 500029/362880)
(num-test (magnitude -500029/500029) 500029/500029)
(num-test (magnitude -8.3886080e+06+0.0e+00i) 8.388608e6)
(num-test (magnitude -8.3886080e+06+1.0e+00i) 8.3886080000000596046e6)
(num-test (magnitude -8.3886080e+06+1.19209289550781250e-07i) 8.3886080e6)
(num-test (magnitude -8.3886080e+06+2.0e+00i) 8.3886080000002384186e6)
(num-test (magnitude -8.3886080e+06+5.0e-01i) 8.3886080000000149012e6)
(num-test (magnitude -8.3886080e+06+8.3886080e+06i) 1.1863283203031444111e7)
(num-test (magnitude -8.3886080e+06-1.0e+00i) 8.3886080000000596046e6)
(num-test (magnitude -8.3886080e+06-1.19209289550781250e-07i) 8.3886080e6)
(num-test (magnitude -8.3886080e+06-2.0e+00i) 8.3886080000002384186e6)
(num-test (magnitude -8.3886080e+06-5.0e-01i) 8.3886080000000149012e6)
(num-test (magnitude -8.3886080e+06-8.3886080e+06i) 1.1863283203031444111e7)
(num-test (magnitude .1e-18-.1e-18i) 1.4142135623731e-19)
(num-test (magnitude .1e200+.1e200i) 1.4142135623731e+199)
(num-test (magnitude 0) 0)
(num-test (magnitude 0.0) 0.0)
(num-test (magnitude 0.0+0.00000001i) 0.00000001)
(num-test (magnitude 0.0+0.00000001i) 0.00000001)
(num-test (magnitude 0.0+1.0i) 1.0)
(num-test (magnitude 0.0+1234.0i) 1234.0)
(num-test (magnitude 0.0+1234000000.0i) 1234000000.0)
(num-test (magnitude 0.0+2.71828182845905i) 2.71828182845905)
(num-test (magnitude 0.0+3.14159265358979i) 3.14159265358979)
(num-test (magnitude 0.0-0.00000001i) 0.00000001)
(num-test (magnitude 0.0-1.0i) 1.0)
(num-test (magnitude 0.0-1234.0i) 1234.0)
(num-test (magnitude 0.0-1234000000.0i) 1234000000.0)
(num-test (magnitude 0.0-2.71828182845905i) 2.71828182845905)
(num-test (magnitude 0.0-3.14159265358979i) 3.14159265358979)
(num-test (magnitude 0.00000001) 0.00000001)
(num-test (magnitude 0.00000001+0.00000001i) 0.00000001414214)
(num-test (magnitude 0.00000001+1.0i) 1.0)
(num-test (magnitude 0.00000001+1234.0i) 1234.0)
(num-test (magnitude 0.00000001+1234000000.0i) 1234000000.0)
(num-test (magnitude 0.00000001+2.71828182845905i) 2.71828182845905)
(num-test (magnitude 0.00000001+3.14159265358979i) pi)
(num-test (magnitude 0.00000001-0.00000001i) 0.00000001414214)
(num-test (magnitude 0.00000001-1.0i) 1.0)
(num-test (magnitude 0.00000001-1234.0i) 1234.0)
(num-test (magnitude 0.00000001-1234000000.0i) 1234000000.0)
(num-test (magnitude 0.00000001-2.71828182845905i) 2.71828182845905)
(num-test (magnitude 0.00000001-3.14159265358979i) pi)
(num-test (magnitude 0.0e+00+0.0e+00i) 0e0)
(num-test (magnitude 0.0e+00+1.0e+00i) 1e0)
(num-test (magnitude 0.0e+00+1.19209289550781250e-07i) 1.1920928955078125e-7)
(num-test (magnitude 0.0e+00+2.0e+00i) 2e0)
(num-test (magnitude 0.0e+00+5.0e-01i) 5e-1)
(num-test (magnitude 0.0e+00+8.3886080e+06i) 8.388608e6)
(num-test (magnitude 0.0e+00-1.0e+00i) 1e0)
(num-test (magnitude 0.0e+00-1.19209289550781250e-07i) 1.1920928955078125e-7)
(num-test (magnitude 0.0e+00-2.0e+00i) 2e0)
(num-test (magnitude 0.0e+00-5.0e-01i) 5e-1)
(num-test (magnitude 0.0e+00-8.3886080e+06i) 8.388608e6)
(num-test (magnitude 0/1) 0/1)
(num-test (magnitude 0/10) 0/10)
(num-test (magnitude 0/1234) 0/1234)
(num-test (magnitude 0/1234000000) 0/1234000000)
(num-test (magnitude 0/2) 0/2)
(num-test (magnitude 0/3) 0/3)
(num-test (magnitude 0/362880) 0/362880)
(num-test (magnitude 0/500029) 0/500029)
(num-test (magnitude 1) 1)
(num-test (magnitude 1.0) 1.0)
(num-test (magnitude 1.0+0.00000001i) 1.0)
(num-test (magnitude 1.0+1.0i) 1.41421356237310)
(num-test (magnitude 1.0+1.0i) 1.41421356237310)
(num-test (magnitude 1.0+1234.0i) 1234.00040518631931)
(num-test (magnitude 1.0+1234000000.0i) 1234000000.0)
(num-test (magnitude 1.0+2.71828182845905i) 2.89638673159001)
(num-test (magnitude 1.0+3.14159265358979i) 3.29690830947562)
(num-test (magnitude 1.0-0.00000001i) 1.0)
(num-test (magnitude 1.0-1.0i) 1.41421356237310)
(num-test (magnitude 1.0-1234.0i) 1234.00040518631931)
(num-test (magnitude 1.0-1234000000.0i) 1234000000.0)
(num-test (magnitude 1.0-2.71828182845905i) 2.89638673159001)
(num-test (magnitude 1.0-3.14159265358979i) 3.29690830947562)
(num-test (magnitude 1.0e+00+0.0e+00i) 1e0)
(num-test (magnitude 1.0e+00+1.0e+00i) 1.4142135623730950488e0)
(num-test (magnitude 1.0e+00+1.19209289550781250e-07i) 1.0000000000000071054e0)
(num-test (magnitude 1.0e+00+2.0e+00i) 2.2360679774997896964e0)
(num-test (magnitude 1.0e+00+5.0e-01i) 1.1180339887498948482e0)
(num-test (magnitude 1.0e+00+8.3886080e+06i) 8.3886080000000596046e6)
(num-test (magnitude 1.0e+00-1.0e+00i) 1.4142135623730950488e0)
(num-test (magnitude 1.0e+00-1.19209289550781250e-07i) 1.0000000000000071054e0)
(num-test (magnitude 1.0e+00-2.0e+00i) 2.2360679774997896964e0)
(num-test (magnitude 1.0e+00-5.0e-01i) 1.1180339887498948482e0)
(num-test (magnitude 1.0e+00-8.3886080e+06i) 8.3886080000000596046e6)
(num-test (magnitude 1.19209289550781250e-07+0.0e+00i) 1.1920928955078125e-7)
(num-test (magnitude 1.19209289550781250e-07+1.0e+00i) 1.0000000000000071054e0)
(num-test (magnitude 1.19209289550781250e-07+1.19209289550781250e-07i) 1.6858739404357612715e-7)
(num-test (magnitude 1.19209289550781250e-07+2.0e+00i) 2.0000000000000035527e0)
(num-test (magnitude 1.19209289550781250e-07+5.0e-01i) 5.0000000000001421085e-1)
(num-test (magnitude 1.19209289550781250e-07+8.3886080e+06i) 8.3886080e6)
(num-test (magnitude 1.19209289550781250e-07-1.0e+00i) 1.0000000000000071054e0)
(num-test (magnitude 1.19209289550781250e-07-1.19209289550781250e-07i) 1.6858739404357612715e-7)
(num-test (magnitude 1.19209289550781250e-07-2.0e+00i) 2.0000000000000035527e0)
(num-test (magnitude 1.19209289550781250e-07-5.0e-01i) 5.0000000000001421085e-1)
(num-test (magnitude 1.19209289550781250e-07-8.3886080e+06i) 8.3886080e6)
(num-test (magnitude 1/1) 1/1)
(num-test (magnitude 1/10) 1/10)
(num-test (magnitude 1/1234) 1/1234)
(num-test (magnitude 1/1234000000) 1/1234000000)
(num-test (magnitude 1/2) 1/2)
(num-test (magnitude 1/3) 1/3)
(num-test (magnitude 1/362880) 1/362880)
(num-test (magnitude 1/500029) 1/500029)
(num-test (magnitude 10) 10)
(num-test (magnitude 10/1) 10/1)
(num-test (magnitude 10/10) 10/10)
(num-test (magnitude 10/1234) 10/1234)
(num-test (magnitude 10/1234000000) 10/1234000000)
(num-test (magnitude 10/2) 10/2)
(num-test (magnitude 10/3) 10/3)
(num-test (magnitude 10/362880) 10/362880)
(num-test (magnitude 10/500029) 10/500029)
(num-test (magnitude 1234) 1234)
(num-test (magnitude 1234.0) 1234.0)
(num-test (magnitude 1234.0+0.00000001i) 1234.0)
(num-test (magnitude 1234.0+1.0i) 1234.00040518631931)
(num-test (magnitude 1234.0+1234.0i) 1745.13953596839929)
(num-test (magnitude 1234.0+1234000000.0i) 1234000000.00061702728271)
(num-test (magnitude 1234.0+2.71828182845905i) 1234.00299394130275)
(num-test (magnitude 1234.0+3.14159265358979i) 1234.00399902285608)
(num-test (magnitude 1234.0-0.00000001i) 1234.0)
(num-test (magnitude 1234.0-1.0i) 1234.00040518631931)
(num-test (magnitude 1234.0-1234.0i) 1745.13953596839929)
(num-test (magnitude 1234.0-1234000000.0i) 1234000000.00061702728271)
(num-test (magnitude 1234.0-2.71828182845905i) 1234.00299394130275)
(num-test (magnitude 1234.0-3.14159265358979i) 1234.00399902285608)
(num-test (magnitude 1234/1) 1234/1)
(num-test (magnitude 1234/10) 1234/10)
(num-test (magnitude 1234/1234) 1234/1234)
(num-test (magnitude 1234/1234000000) 1234/1234000000)
(num-test (magnitude 1234/2) 1234/2)
(num-test (magnitude 1234/3) 1234/3)
(num-test (magnitude 1234/362880) 1234/362880)
(num-test (magnitude 1234/500029) 1234/500029)
(num-test (magnitude 1234000000) 1234000000)
(num-test (magnitude 1234000000.0) 1234000000.0)
(num-test (magnitude 1234000000.0+0.00000001i) 1234000000.0)
(num-test (magnitude 1234000000.0+1.0i) 1234000000.0)
(num-test (magnitude 1234000000.0+1234.0i) 1234000000.00061702728271)
(num-test (magnitude 1234000000.0+1234000000.0i) 1745139535.96839928627014)
(num-test (magnitude 1234000000.0+2.71828182845905i) 1234000000.0)
(num-test (magnitude 1234000000.0-0.00000001i) 1234000000.0)
(num-test (magnitude 1234000000.0-1.0i) 1234000000.0)
(num-test (magnitude 1234000000.0-1234.0i) 1234000000.00061702728271)
(num-test (magnitude 1234000000.0-1234000000.0i) 1745139535.96839928627014)
(num-test (magnitude 1234000000.0-2.71828182845905i) 1234000000.0)
(num-test (magnitude 1234000000.0-3.14159265358979i) 1234000000.0)
(num-test (magnitude 1234000000/1) 1234000000/1)
(num-test (magnitude 1234000000/10) 1234000000/10)
(num-test (magnitude 1234000000/1234) 1234000000/1234)
(num-test (magnitude 1234000000/1234000000) 1234000000/1234000000)
(num-test (magnitude 1234000000/2) 1234000000/2)
(num-test (magnitude 1234000000/3) 1234000000/3)
(num-test (magnitude 1234000000/362880) 1234000000/362880)
(num-test (magnitude 1234000000/500029) 1234000000/500029)
(num-test (magnitude 1e18+1e18i) 1.414213562373095048801688724209698078569E18)
(num-test (magnitude 2) 2)
(num-test (magnitude 2.0e+00+0.0e+00i) 2e0)
(num-test (magnitude 2.0e+00+1.0e+00i) 2.2360679774997896964e0)
(num-test (magnitude 2.0e+00+1.19209289550781250e-07i) 2.0000000000000035527e0)
(num-test (magnitude 2.0e+00+2.0e+00i) 2.8284271247461900976e0)
(num-test (magnitude 2.0e+00+5.0e-01i) 2.0615528128088302749e0)
(num-test (magnitude 2.0e+00+8.3886080e+06i) 8.3886080000002384186e6)
(num-test (magnitude 2.0e+00-1.0e+00i) 2.2360679774997896964e0)
(num-test (magnitude 2.0e+00-1.19209289550781250e-07i) 2.0000000000000035527e0)
(num-test (magnitude 2.0e+00-2.0e+00i) 2.8284271247461900976e0)
(num-test (magnitude 2.0e+00-5.0e-01i) 2.0615528128088302749e0)
(num-test (magnitude 2.0e+00-8.3886080e+06i) 8.3886080000002384186e6)
(num-test (magnitude 2.71828182845905) 2.71828182845905)
(num-test (magnitude 2.71828182845905+0.00000001i) 2.71828182845905)
(num-test (magnitude 2.71828182845905+1.0i) 2.89638673159001)
(num-test (magnitude 2.71828182845905+1234.0i) 1234.00299394130275)
(num-test (magnitude 2.71828182845905+1234000000.0i) 1234000000.0)
(num-test (magnitude 2.71828182845905+2.71828182845905i) 3.84423102815912)
(num-test (magnitude 2.71828182845905+3.14159265358979i) 4.15435440231331)
(num-test (magnitude 2.71828182845905+3.14159265358979i) 4.15435440231331)
(num-test (magnitude 2.71828182845905-0.00000001i) 2.71828182845905)
(num-test (magnitude 2.71828182845905-1.0i) 2.89638673159001)
(num-test (magnitude 2.71828182845905-1234.0i) 1234.00299394130275)
(num-test (magnitude 2.71828182845905-1234000000.0i) 1234000000.0)
(num-test (magnitude 2.71828182845905-2.71828182845905i) 3.84423102815912)
(num-test (magnitude 2.71828182845905-3.14159265358979i) 4.15435440231331)
(num-test (magnitude 2/1) 2/1)
(num-test (magnitude 2/10) 2/10)
(num-test (magnitude 2/1234) 2/1234)
(num-test (magnitude 2/1234000000) 2/1234000000)
(num-test (magnitude 2/2) 2/2)
(num-test (magnitude 2/3) 2/3)
(num-test (magnitude 2/362880) 2/362880)
(num-test (magnitude 2/500029) 2/500029)
(num-test (magnitude 3) 3)
(num-test (magnitude 3.14159265358979+0.00000001i) pi)
(num-test (magnitude 3.14159265358979+1.0i) 3.29690830947562)
(num-test (magnitude 3.14159265358979+1234.0i) 1234.00399902285608)
(num-test (magnitude 3.14159265358979+1234000000.0i) 1234000000.0)
(num-test (magnitude 3.14159265358979+2.71828182845905i) 4.15435440231331)
(num-test (magnitude 3.14159265358979+3.14159265358979i) 4.44288293815837)
(num-test (magnitude 3.14159265358979-0.00000001i) pi)
(num-test (magnitude 3.14159265358979-1.0i) 3.29690830947562)
(num-test (magnitude 3.14159265358979-1234.0i) 1234.00399902285608)
(num-test (magnitude 3.14159265358979-1234000000.0i) 1234000000.0)
(num-test (magnitude 3.14159265358979-2.71828182845905i) 4.15435440231331)
(num-test (magnitude 3.14159265358979-3.14159265358979i) 4.44288293815837)
(num-test (magnitude 3/1) 3/1)
(num-test (magnitude 3/10) 3/10)
(num-test (magnitude 3/1234) 3/1234)
(num-test (magnitude 3/1234000000) 3/1234000000)
(num-test (magnitude 3/2) 3/2)
(num-test (magnitude 3/3) 3/3)
(num-test (magnitude 3/362880) 3/362880)
(num-test (magnitude 3/500029) 3/500029)
(num-test (magnitude 362880) 362880)
(num-test (magnitude 362880/1) 362880/1)
(num-test (magnitude 362880/10) 362880/10)
(num-test (magnitude 362880/1234) 362880/1234)
(num-test (magnitude 362880/1234000000) 362880/1234000000)
(num-test (magnitude 362880/2) 362880/2)
(num-test (magnitude 362880/3) 362880/3)
(num-test (magnitude 362880/362880) 362880/362880)
(num-test (magnitude 362880/500029) 362880/500029)
(num-test (magnitude 5.0e-01+0.0e+00i) 5e-1)
(num-test (magnitude 5.0e-01+1.0e+00i) 1.1180339887498948482e0)
(num-test (magnitude 5.0e-01+1.19209289550781250e-07i) 5.0000000000001421085e-1)
(num-test (magnitude 5.0e-01+2.0e+00i) 2.0615528128088302749e0)
(num-test (magnitude 5.0e-01+5.0e-01i) 7.0710678118654752440e-1)
(num-test (magnitude 5.0e-01+8.3886080e+06i) 8.3886080000000149012e6)
(num-test (magnitude 5.0e-01-1.0e+00i) 1.1180339887498948482e0)
(num-test (magnitude 5.0e-01-1.19209289550781250e-07i) 5.0000000000001421085e-1)
(num-test (magnitude 5.0e-01-2.0e+00i) 2.0615528128088302749e0)
(num-test (magnitude 5.0e-01-5.0e-01i) 7.0710678118654752440e-1)
(num-test (magnitude 5.0e-01-8.3886080e+06i) 8.3886080000000149012e6)
(num-test (magnitude 500029) 500029)
(num-test (magnitude 500029/1) 500029/1)
(num-test (magnitude 500029/10) 500029/10)
(num-test (magnitude 500029/1234) 500029/1234)
(num-test (magnitude 500029/1234000000) 500029/1234000000)
(num-test (magnitude 500029/2) 500029/2)
(num-test (magnitude 500029/3) 500029/3)
(num-test (magnitude 500029/362880) 500029/362880)
(num-test (magnitude 500029/500029) 500029/500029)
(num-test (magnitude 8.3886080e+06+0.0e+00i) 8.388608e6)
(num-test (magnitude 8.3886080e+06+1.0e+00i) 8.3886080000000596046e6)
(num-test (magnitude 8.3886080e+06+1.19209289550781250e-07i) 8.3886080e6)
(num-test (magnitude 8.3886080e+06+2.0e+00i) 8.3886080000002384186e6)
(num-test (magnitude 8.3886080e+06+5.0e-01i) 8.3886080000000149012e6)
(num-test (magnitude 8.3886080e+06+8.3886080e+06i) 1.1863283203031444111e7)
(num-test (magnitude 8.3886080e+06-1.0e+00i) 8.3886080000000596046e6)
(num-test (magnitude 8.3886080e+06-1.19209289550781250e-07i) 8.3886080e6)
(num-test (magnitude 8.3886080e+06-2.0e+00i) 8.3886080000002384186e6)
(num-test (magnitude 8.3886080e+06-5.0e-01i) 8.3886080000000149012e6)
(num-test (magnitude 8.3886080e+06-8.3886080e+06i) 1.1863283203031444111e7)
(num-test (magnitude most-positive-fixnum) most-positive-fixnum)
(num-test (magnitude pi) pi)
(num-test (magnitude -2.225073858507201399999999999999999999996E-308) 2.225073858507201399999999999999999999996E-308)
(if (not with-bignums)
    (num-test (magnitude -9223372036854775808) 9223372036854775807)) ; changed 28-Apr-15
(num-test (magnitude 1.110223024625156799999999999999999999997E-16) 1.110223024625156799999999999999999999997E-16)
(num-test (magnitude 9223372036854775807) 9223372036854775807)

(for-each
 (lambda (num-and-val)
   (let ((num (car num-and-val)) (val (cadr num-and-val))) (num-test-1 'magnitude num (magnitude num) val)))
 (vector (list 0 0) (list 1 1) (list 2 2) (list 3 3) (list -1 1) (list -2 2) (list -3 3) (list 9223372036854775807 9223372036854775807) 
	 (list 1/2 1/2) (list 1/3 1/3) (list -1/2 1/2) 
	 (list -1/3 1/3) (list 1/9223372036854775807 1/9223372036854775807) (list 0.0 0.0) 
	 (list 1.0 1.0) (list 2.0 2.0) (list -2.0 2.0) (list 1.000000000000000000000000000000000000002E-309 1.000000000000000000000000000000000000002E-309) 
	 (list 1e+16 1e+16) (list 0+1i 1.0) (list 0+2i 2.0) (list 0-1i 1.0) (list 1+1i 1.4142135623731) 
	 (list 1-1i 1.4142135623731) (list -1+1i 1.4142135623731) (list -1-1i 1.4142135623731) 
	 (list 0.1+0.1i 0.14142135623731) (list 1e+16+1e+16i 1.4142135623731e+16) (list 1e-16+1e-16i 1.4142135623731e-16) 
	 ))
  
(when with-bignums
  (num-test (magnitude (complex (expt 2 63) (expt 2 63))) 1.304381782533278221234957180625250836888E19)
  (num-test (magnitude most-negative-fixnum) 9223372036854775808)
  (num-test (magnitude 1e400+1e400i) 1.414213562373095048801688724209698078569E400)
  (num-test (magnitude .1e400+.1e400i) 1.41421356237309504880168872420969807857E399)
  (num-test (magnitude .001e310+.001e310i) 1.414213562373095048801688724209698078572E307)
  (num-test (magnitude 1e-310+1e-310i) 1.414213562373095048801688724209698078569E-310)
  (num-test (magnitude 1e-400+1e-400i) 1.414213562373095048801688724209698078568E-400)
  (num-test (magnitude -1.797693134862315699999999999999999999998E308) 1.797693134862315699999999999999999999998E308)
  (num-test (magnitude 9223372036854775808.1) 9223372036854775808.1)
  (num-test (magnitude 9223372036854775808) 9223372036854775808) 
  (num-test (magnitude 9223372036854775808/3) 9223372036854775808/3) 
  (num-test (magnitude 9223372036854775808.1+1.0e19i) 1.360406526484765934746566522678055771386E19)
  (num-test (magnitude 1.0e19+9223372036854775808.1i) 1.360406526484765934746566522678055771386E19)
  (num-test (magnitude 14142135623730950488.0168872420969+14142135623730950488.0168872420969i) 1.9999999999999999999999999999999885751772054578776001965575456E19))

(test (magnitude "hi") 'error)
(test (magnitude 1.0+23.0i 1.0+23.0i) 'error)
(test (magnitude) 'error)

(for-each
 (lambda (arg)
   (test (magnitude arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))

;;; (magnitude -9223372036854775808) -> -9223372036854775808?



;;; --------------------------------------------------------------------------------
;;; angle
;;; --------------------------------------------------------------------------------

(num-test (angle (make-polar 1.0 (+ pi .0001))) (- .0001 pi))
(num-test (angle (make-polar 1.0 (- pi .0001))) (- pi .0001))
(num-test (angle -0) 0)
(num-test (angle -0.0+0.00000001i) 1.57079632679490)
(num-test (angle -0.0+1.0i) 1.57079632679490)
(num-test (angle -0.0+1234.0i) 1.57079632679490)
(num-test (angle -0.0+1234000000.0i) 1.57079632679490)
(num-test (angle -0.0+2.71828182845905i) 1.57079632679490)
(num-test (angle -0.0+3.14159265358979i) 1.57079632679490)
(num-test (angle -0.0-0.00000001i) -1.57079632679490)
(num-test (angle -0.0-1.0i) -1.57079632679490)
(num-test (angle -0.0-1234.0i) -1.57079632679490)
(num-test (angle -0.0-1234000000.0i) -1.57079632679490)
(num-test (angle -0.0-2.71828182845905i) -1.57079632679490)
(num-test (angle -0.0-3.14159265358979i) -1.57079632679490)
(num-test (angle -0.00000001) pi)
(num-test (angle -0.00000001+0.00000001i) 2.35619449019234)
(num-test (angle -0.00000001+1.0i) 1.57079633679490)
(num-test (angle -0.00000001+1234.0i) 1.57079632680300)
(num-test (angle -0.00000001+1234000000.0i) 1.57079632679490)
(num-test (angle -0.00000001+2.71828182845905i) 1.57079633047369)
(num-test (angle -0.00000001+3.14159265358979i) 1.57079632997800)
(num-test (angle -0.00000001-0.00000001i) -2.35619449019234)
(num-test (angle -0.00000001-1.0i) -1.57079633679490)
(num-test (angle -0.00000001-1234.0i) -1.57079632680300)
(num-test (angle -0.00000001-1234000000.0i) -1.57079632679490)
(num-test (angle -0.00000001-2.71828182845905i) -1.57079633047369)
(num-test (angle -0.00000001-3.14159265358979i) -1.57079632997800)
(num-test (angle -1) pi)
(num-test (angle -1.0) pi)
(num-test (angle -1.0+0.00000001i) 3.14159264358979)
(num-test (angle -1.0+1.0i) 2.35619449019234)
(num-test (angle -1.0+1234.0i) 1.57160669938898)
(num-test (angle -1.0+1234000000.0i) 1.57079632760527)
(num-test (angle -1.0+2.71828182845905i) 1.92330974857252)
(num-test (angle -1.0+3.14159265358979i) 1.87896539791088)
(num-test (angle -1.0-0.00000001i) -3.14159264358979)
(num-test (angle -1.0-1.0i) -2.35619449019234)
(num-test (angle -1.0-1234.0i) -1.57160669938898)
(num-test (angle -1.0-1234000000.0i) -1.57079632760527)
(num-test (angle -1.0-2.71828182845905i) -1.92330974857252)
(num-test (angle -1.0-3.14159265358979i) -1.87896539791088)
(num-test (angle -1.0e+00+0.0e+00i) 3.1415926535897932385e0)
(num-test (angle -1.0e+00+1.0e+00i) 2.3561944901923449288e0)
(num-test (angle -1.0e+00+1.19209289550781250e-07i) 3.1415925343805036877e0)
(num-test (angle -1.0e+00+2.0e+00i) 2.0344439357957027354e0)
(num-test (angle -1.0e+00+5.0e-01i) 2.6779450445889871222e0)
(num-test (angle -1.0e+00+8.3886080e+06i) 1.570796446004186170e0)
(num-test (angle -1.0e+00-1.0e+00i) -2.3561944901923449288e0)
(num-test (angle -1.0e+00-1.19209289550781250e-07i) -3.1415925343805036877e0)
(num-test (angle -1.0e+00-2.0e+00i) -2.0344439357957027354e0)
(num-test (angle -1.0e+00-5.0e-01i) -2.6779450445889871222e0)
(num-test (angle -1.0e+00-8.3886080e+06i) -1.570796446004186170e0)
(num-test (angle -1.19209289550781250e-07+0.0e+00i) 3.1415926535897932385e0)
(num-test (angle -1.19209289550781250e-07+1.0e+00i) 1.570796446004186170e0)
(num-test (angle -1.19209289550781250e-07+1.19209289550781250e-07i) 2.3561944901923449288e0)
(num-test (angle -1.19209289550781250e-07+2.0e+00i) 1.5707963863995413946e0)
(num-test (angle -1.19209289550781250e-07+5.0e-01i) 1.5707965652134757208e0)
(num-test (angle -1.19209289550781250e-07+8.3886080e+06i) 1.5707963267949108301e0)
(num-test (angle -1.19209289550781250e-07-1.0e+00i) -1.570796446004186170e0)
(num-test (angle -1.19209289550781250e-07-1.19209289550781250e-07i) -2.3561944901923449288e0)
(num-test (angle -1.19209289550781250e-07-2.0e+00i) -1.5707963863995413946e0)
(num-test (angle -1.19209289550781250e-07-5.0e-01i) -1.5707965652134757208e0)
(num-test (angle -1.19209289550781250e-07-8.3886080e+06i) -1.5707963267949108301e0)
(num-test (angle -1/1) pi)
(num-test (angle -1/10) pi)
(num-test (angle -1/1234) pi)
(num-test (angle -1/1234000000) pi)
(num-test (angle -1/2) pi)
(num-test (angle -1/3) pi)
(num-test (angle -1/362880) pi)
(num-test (angle -1/500029) pi)
(num-test (angle -10) pi)
(num-test (angle -10/1) pi)
(num-test (angle -10/10) pi)
(num-test (angle -10/1234) pi)
(num-test (angle -10/1234000000) pi)
(num-test (angle -10/2) pi)
(num-test (angle -10/3) pi)
(num-test (angle -10/362880) pi)
(num-test (angle -10/500029) pi)
(num-test (angle -1234) pi)
(num-test (angle -1234.0) pi)
(num-test (angle -1234.0+0.00000001i) 3.14159265358169)
(num-test (angle -1234.0+1.0i) 3.14078228099571)
(num-test (angle -1234.0+1234.0i) 2.35619449019234)
(num-test (angle -1234.0+1234000000.0i) 1.57079732679490)
(num-test (angle -1234.0+2.71828182845905i) 3.13938983557381)
(num-test (angle -1234.0+3.14159265358979i) 3.13904679794449)
(num-test (angle -1234.0-0.00000001i) -3.14159265358169)
(num-test (angle -1234.0-1.0i) -3.14078228099571)
(num-test (angle -1234.0-1234.0i) -2.35619449019234)
(num-test (angle -1234.0-1234000000.0i) -1.57079732679490)
(num-test (angle -1234.0-2.71828182845905i) -3.13938983557381)
(num-test (angle -1234.0-3.14159265358979i) -3.13904679794449)
(num-test (angle -1234/1) pi)
(num-test (angle -1234/10) pi)
(num-test (angle -1234/1234) pi)
(num-test (angle -1234/1234000000) pi)
(num-test (angle -1234/2) pi)
(num-test (angle -1234/3) pi)
(num-test (angle -1234/362880) pi)
(num-test (angle -1234/500029) pi)
(num-test (angle -1234000000) pi)
(num-test (angle -1234000000.0) pi)
(num-test (angle -1234000000.0+0.00000001i) pi)
(num-test (angle -1234000000.0+1.0i) 3.14159265277942)
(num-test (angle -1234000000.0+1234.0i) 3.14159165358979)
(num-test (angle -1234000000.0+1234000000.0i) 2.35619449019234)
(num-test (angle -1234000000.0+2.71828182845905i) 3.14159265138697)
(num-test (angle -1234000000.0+3.14159265358979i) 3.14159265104393)
(num-test (angle -1234000000.0-0.00000001i) -3.14159265358979)
(num-test (angle -1234000000.0-1.0i) -3.14159265277942)
(num-test (angle -1234000000.0-1234.0i) -3.14159165358979)
(num-test (angle -1234000000.0-1234000000.0i) -2.35619449019234)
(num-test (angle -1234000000.0-2.71828182845905i) -3.14159265138697)
(num-test (angle -1234000000.0-3.14159265358979i) -3.14159265104393)
(num-test (angle -1234000000/1) pi)
(num-test (angle -1234000000/10) pi)
(num-test (angle -1234000000/1234) pi)
(num-test (angle -1234000000/1234000000) pi)
(num-test (angle -1234000000/2) pi)
(num-test (angle -1234000000/3) pi)
(num-test (angle -1234000000/362880) pi)
(num-test (angle -1234000000/500029) pi)
(num-test (angle -2) pi)
(num-test (angle -2.0e+00+0.0e+00i) 3.1415926535897932385e0)
(num-test (angle -2.0e+00+1.0e+00i) 2.6779450445889871222e0)
(num-test (angle -2.0e+00+1.19209289550781250e-07i) 3.1415925939851484631e0)
(num-test (angle -2.0e+00+2.0e+00i) 2.3561944901923449288e0)
(num-test (angle -2.0e+00+5.0e-01i) 2.8966139904629290843e0)
(num-test (angle -2.0e+00+8.3886080e+06i) 1.5707965652134757208e0)
(num-test (angle -2.0e+00-1.0e+00i) -2.6779450445889871222e0)
(num-test (angle -2.0e+00-1.19209289550781250e-07i) -3.1415925939851484631e0)
(num-test (angle -2.0e+00-2.0e+00i) -2.3561944901923449288e0)
(num-test (angle -2.0e+00-5.0e-01i) -2.8966139904629290843e0)
(num-test (angle -2.0e+00-8.3886080e+06i) -1.5707965652134757208e0)
(num-test (angle -2.225073858507201399999999999999999999996E-308) 3.141592653589793238462643383279502884195E0)
(num-test (angle -2.71828182845905) pi)
(num-test (angle -2.71828182845905+0.00000001i) 3.14159264991100)
(num-test (angle -2.71828182845905+1.0i) 2.78907923181217)
(num-test (angle -2.71828182845905+1234.0i) 1.57299914481088)
(num-test (angle -2.71828182845905+1234000000.0i) 1.57079632899772)
(num-test (angle -2.71828182845905+2.71828182845905i) 2.35619449019234)
(num-test (angle -2.71828182845905+3.14159265358979i) 2.28408086723395)
(num-test (angle -2.71828182845905-0.00000001i) -3.14159264991100)
(num-test (angle -2.71828182845905-1.0i) -2.78907923181217)
(num-test (angle -2.71828182845905-1234.0i) -1.57299914481088)
(num-test (angle -2.71828182845905-1234000000.0i) -1.57079632899772)
(num-test (angle -2.71828182845905-2.71828182845905i) -2.35619449019234)
(num-test (angle -2.71828182845905-3.14159265358979i) -2.28408086723395)
(num-test (angle -2/1) pi)
(num-test (angle -2/10) pi)
(num-test (angle -2/1234) pi)
(num-test (angle -2/1234000000) pi)
(num-test (angle -2/2) pi)
(num-test (angle -2/3) pi)
(num-test (angle -2/362880) pi)
(num-test (angle -2/500029) pi)
(num-test (angle -3) pi)
(num-test (angle -3.14159265358979) pi)
(num-test (angle -3.14159265358979+0.00000001i) 3.14159265040669)
(num-test (angle -3.14159265358979+1.0i) 2.83342358247381)
(num-test (angle -3.14159265358979+1234.0i) 1.57334218244020)
(num-test (angle -3.14159265358979+1234000000.0i) 1.57079632934076)
(num-test (angle -3.14159265358979+2.71828182845905i) 2.42830811315074)
(num-test (angle -3.14159265358979+3.14159265358979i) 2.35619449019234)
(num-test (angle -3.14159265358979-0.00000001i) -3.14159265040669)
(num-test (angle -3.14159265358979-1.0i) -2.83342358247381)
(num-test (angle -3.14159265358979-1234.0i) -1.57334218244020)
(num-test (angle -3.14159265358979-1234000000.0i) -1.57079632934076)
(num-test (angle -3.14159265358979-2.71828182845905i) -2.42830811315074)
(num-test (angle -3.14159265358979-3.14159265358979i) -2.35619449019234)
(num-test (angle -3/1) pi)
(num-test (angle -3/10) pi)
(num-test (angle -3/1234) pi)
(num-test (angle -3/1234000000) pi)
(num-test (angle -3/2) pi)
(num-test (angle -3/3) pi)
(num-test (angle -3/362880) pi)
(num-test (angle -3/500029) pi)
(num-test (angle -362880) pi)
(num-test (angle -362880/1) pi)
(num-test (angle -362880/10) pi)
(num-test (angle -362880/1234) pi)
(num-test (angle -362880/1234000000) pi)
(num-test (angle -362880/2) pi)
(num-test (angle -362880/3) pi)
(num-test (angle -362880/362880) pi)
(num-test (angle -362880/500029) pi)
(num-test (angle -5.0e-01+0.0e+00i) 3.1415926535897932385e0)
(num-test (angle -5.0e-01+1.0e+00i) 2.0344439357957027354e0)
(num-test (angle -5.0e-01+1.19209289550781250e-07i) 3.1415924151712141369e0)
(num-test (angle -5.0e-01+2.0e+00i) 1.8157749899217607734e0)
(num-test (angle -5.0e-01+5.0e-01i) 2.3561944901923449288e0)
(num-test (angle -5.0e-01+8.3886080e+06i) 1.5707963863995413946e0)
(num-test (angle -5.0e-01-1.0e+00i) -2.0344439357957027354e0)
(num-test (angle -5.0e-01-1.19209289550781250e-07i) -3.1415924151712141369e0)
(num-test (angle -5.0e-01-2.0e+00i) -1.8157749899217607734e0)
(num-test (angle -5.0e-01-5.0e-01i) -2.3561944901923449288e0)
(num-test (angle -5.0e-01-8.3886080e+06i) -1.5707963863995413946e0)
(num-test (angle -500029) pi)
(num-test (angle -500029/1) pi)
(num-test (angle -500029/10) pi)
(num-test (angle -500029/1234) pi)
(num-test (angle -500029/1234000000) pi)
(num-test (angle -500029/2) pi)
(num-test (angle -500029/3) pi)
(num-test (angle -500029/362880) pi)
(num-test (angle -500029/500029) pi)
(num-test (angle -8.3886080e+06+0.0e+00i) 3.1415926535897932385e0)
(num-test (angle -8.3886080e+06+1.0e+00i) 3.1415925343805036877e0)
(num-test (angle -8.3886080e+06+1.19209289550781250e-07i) 3.1415926535897790276e0)
(num-test (angle -8.3886080e+06+2.0e+00i) 3.1415924151712141369e0)
(num-test (angle -8.3886080e+06+5.0e-01i) 3.1415925939851484631e0)
(num-test (angle -8.3886080e+06+8.3886080e+06i) 2.3561944901923449288e0)
(num-test (angle -8.3886080e+06-1.0e+00i) -3.1415925343805036877e0)
(num-test (angle -8.3886080e+06-1.19209289550781250e-07i) -3.1415926535897790276e0)
(num-test (angle -8.3886080e+06-2.0e+00i) -3.1415924151712141369e0)
(num-test (angle -8.3886080e+06-5.0e-01i) -3.1415925939851484631e0)
(num-test (angle -8.3886080e+06-8.3886080e+06i) -2.3561944901923449288e0)
(num-test (angle -9223372036854775808) 3.141592653589793238462643383279502884195E0)
(num-test (angle 0) 0)
(num-test (angle 0.0) 0.0)
(num-test (angle 0.0+0.00000001i) 1.57079632679490)
(num-test (angle 0.0+1.0i) 1.57079632679490)
(num-test (angle 0.0+1234.0i) 1.57079632679490)
(num-test (angle 0.0+1234000000.0i) 1.57079632679490)
(num-test (angle 0.0+2.71828182845905i) 1.57079632679490)
(num-test (angle 0.0+3.14159265358979i) 1.57079632679490)
(num-test (angle 0.0-0.00000001i) -1.57079632679490)
(num-test (angle 0.0-1.0i) -1.57079632679490)
(num-test (angle 0.0-1234.0i) -1.57079632679490)
(num-test (angle 0.0-1234000000.0i) -1.57079632679490)
(num-test (angle 0.0-2.71828182845905i) -1.57079632679490)
(num-test (angle 0.0-3.14159265358979i) -1.57079632679490)
(num-test (angle 0.00000001) 0.0)
(num-test (angle 0.00000001+0.00000001i) 0.78539816339745)
(num-test (angle 0.00000001+1.0i) 1.57079631679490)
(num-test (angle 0.00000001+1234.0i) 1.57079632678679)
(num-test (angle 0.00000001+1234000000.0i) 1.57079632679490)
(num-test (angle 0.00000001+2.71828182845905i) 1.57079632311610)
(num-test (angle 0.00000001+3.14159265358979i) 1.57079632361180)
(num-test (angle 0.00000001-0.00000001i) -0.78539816339745)
(num-test (angle 0.00000001-1.0i) -1.57079631679490)
(num-test (angle 0.00000001-1234.0i) -1.57079632678679)
(num-test (angle 0.00000001-1234000000.0i) -1.57079632679490)
(num-test (angle 0.00000001-2.71828182845905i) -1.57079632311610)
(num-test (angle 0.00000001-3.14159265358979i) -1.57079632361180)
(num-test (angle 0.0e+00+0.0e+00i) 0e0)
(num-test (angle 0.0e+00+1.0e+00i) 1.5707963267948966192e0)
(num-test (angle 0.0e+00+1.19209289550781250e-07i) 1.5707963267948966192e0)
(num-test (angle 0.0e+00+2.0e+00i) 1.5707963267948966192e0)
(num-test (angle 0.0e+00+5.0e-01i) 1.5707963267948966192e0)
(num-test (angle 0.0e+00+8.3886080e+06i) 1.5707963267948966192e0)
(num-test (angle 0.0e+00-1.0e+00i) -1.5707963267948966192e0)
(num-test (angle 0.0e+00-1.19209289550781250e-07i) -1.5707963267948966192e0)
(num-test (angle 0.0e+00-2.0e+00i) -1.5707963267948966192e0)
(num-test (angle 0.0e+00-5.0e-01i) -1.5707963267948966192e0)
(num-test (angle 0.0e+00-8.3886080e+06i) -1.5707963267948966192e0)
(num-test (angle 1) 0)
(num-test (angle 1.0) 0.0)
(num-test (angle 1.0+0.00000001i) 0.00000001)
(num-test (angle 1.0+1.0i) 0.78539816339745)
(num-test (angle 1.0+1234.0i) 1.56998595420081)
(num-test (angle 1.0+1234000000.0i) 1.57079632598452)
(num-test (angle 1.0+2.71828182845905i) 1.21828290501728)
(num-test (angle 1.0+3.14159265358979i) 1.26262725567891)
(num-test (angle 1.0-0.00000001i) -0.00000001)
(num-test (angle 1.0-1.0i) -0.78539816339745)
(num-test (angle 1.0-1234.0i) -1.56998595420081)
(num-test (angle 1.0-1234000000.0i) -1.57079632598452)
(num-test (angle 1.0-2.71828182845905i) -1.21828290501728)
(num-test (angle 1.0-3.14159265358979i) -1.26262725567891)
(num-test (angle 1.0e+00+0.0e+00i) 0e0)
(num-test (angle 1.0e+00+1.0e+00i) 7.8539816339744830962e-1)
(num-test (angle 1.0e+00+1.19209289550781250e-07i) 1.1920928955078068531e-7)
(num-test (angle 1.0e+00+2.0e+00i) 1.1071487177940905030e0)
(num-test (angle 1.0e+00+5.0e-01i) 4.6364760900080611621e-1)
(num-test (angle 1.0e+00+8.3886080e+06i) 1.5707962075856070685e0)
(num-test (angle 1.0e+00-1.0e+00i) -7.8539816339744830962e-1)
(num-test (angle 1.0e+00-1.19209289550781250e-07i) -1.1920928955078068531e-7)
(num-test (angle 1.0e+00-2.0e+00i) -1.1071487177940905030e0)
(num-test (angle 1.0e+00-5.0e-01i) -4.6364760900080611621e-1)
(num-test (angle 1.0e+00-8.3886080e+06i) -1.5707962075856070685e0)
(num-test (angle 1.110223024625156799999999999999999999997E-16) 0.0)
(num-test (angle 1.19209289550781250e-07+0.0e+00i) 0e0)
(num-test (angle 1.19209289550781250e-07+1.0e+00i) 1.5707962075856070685e0)
(num-test (angle 1.19209289550781250e-07+1.19209289550781250e-07i) 7.8539816339744830962e-1)
(num-test (angle 1.19209289550781250e-07+2.0e+00i) 1.5707962671902518438e0)
(num-test (angle 1.19209289550781250e-07+5.0e-01i) 1.5707960883763175177e0)
(num-test (angle 1.19209289550781250e-07+8.3886080e+06i) 1.5707963267948824084e0)
(num-test (angle 1.19209289550781250e-07-1.0e+00i) -1.5707962075856070685e0)
(num-test (angle 1.19209289550781250e-07-1.19209289550781250e-07i) -7.8539816339744830962e-1)
(num-test (angle 1.19209289550781250e-07-2.0e+00i) -1.5707962671902518438e0)
(num-test (angle 1.19209289550781250e-07-5.0e-01i) -1.5707960883763175177e0)
(num-test (angle 1.19209289550781250e-07-8.3886080e+06i) -1.5707963267948824084e0)
(num-test (angle 1/1) 0)
(num-test (angle 1/10) 0)
(num-test (angle 1/1234) 0)
(num-test (angle 1/1234000000) 0)
(num-test (angle 1/2) 0)
(num-test (angle 1/3) 0)
(num-test (angle 1/362880) 0)
(num-test (angle 1/500029) 0)
(num-test (angle 10) 0)
(num-test (angle 10/1) 0)
(num-test (angle 10/10) 0)
(num-test (angle 10/1234) 0)
(num-test (angle 10/1234000000) 0)
(num-test (angle 10/2) 0)
(num-test (angle 10/3) 0)
(num-test (angle 10/362880) 0)
(num-test (angle 10/500029) 0)
(num-test (angle 1234) 0)
(num-test (angle 1234.0) 0.0)
(num-test (angle 1234.0+0.00000001i) 0.00000000000810)
(num-test (angle 1234.0+1.0i) 0.00081037259408)
(num-test (angle 1234.0+1234.0i) 0.78539816339745)
(num-test (angle 1234.0+1234000000.0i) 1.57079532679490)
(num-test (angle 1234.0+2.71828182845905i) 0.00220281801598)
(num-test (angle 1234.0+3.14159265358979i) 0.00254585564530)
(num-test (angle 1234.0-0.00000001i) -0.00000000000810)
(num-test (angle 1234.0-1.0i) -0.00081037259408)
(num-test (angle 1234.0-1234.0i) -0.78539816339745)
(num-test (angle 1234.0-1234000000.0i) -1.57079532679490)
(num-test (angle 1234.0-2.71828182845905i) -0.00220281801598)
(num-test (angle 1234.0-3.14159265358979i) -0.00254585564530)
(num-test (angle 1234/1) 0)
(num-test (angle 1234/10) 0)
(num-test (angle 1234/1234) 0)
(num-test (angle 1234/1234000000) 0)
(num-test (angle 1234/2) 0)
(num-test (angle 1234/3) 0)
(num-test (angle 1234/362880) 0)
(num-test (angle 1234/500029) 0)
(num-test (angle 1234000000) 0)
(num-test (angle 1234000000.0) 0.0)
(num-test (angle 1234000000.0+0.00000001i) 0.0)
(num-test (angle 1234000000.0+1.0i) 0.00000000081037)
(num-test (angle 1234000000.0+1234.0i) 0.00000100000000)
(num-test (angle 1234000000.0+1234000000.0i) 0.78539816339745)
(num-test (angle 1234000000.0+2.71828182845905i) 0.00000000220282)
(num-test (angle 1234000000.0+3.14159265358979i) 0.00000000254586)
(num-test (angle 1234000000.0-0.00000001i) 0.0)
(num-test (angle 1234000000.0-1.0i) -0.00000000081037)
(num-test (angle 1234000000.0-1234.0i) -0.00000100000000)
(num-test (angle 1234000000.0-1234000000.0i) -0.78539816339745)
(num-test (angle 1234000000.0-2.71828182845905i) -0.00000000220282)
(num-test (angle 1234000000.0-3.14159265358979i) -0.00000000254586)
(num-test (angle 1234000000/1) 0)
(num-test (angle 1234000000/10) 0)
(num-test (angle 1234000000/1234) 0)
(num-test (angle 1234000000/1234000000) 0)
(num-test (angle 1234000000/2) 0)
(num-test (angle 1234000000/3) 0)
(num-test (angle 1234000000/362880) 0)
(num-test (angle 1234000000/500029) 0)
(num-test (angle 2) 0)
(num-test (angle 2.0e+00+0.0e+00i) 0e0)
(num-test (angle 2.0e+00+1.0e+00i) 4.6364760900080611621e-1)
(num-test (angle 2.0e+00+1.19209289550781250e-07i) 5.9604644775390554414e-8)
(num-test (angle 2.0e+00+2.0e+00i) 7.8539816339744830962e-1)
(num-test (angle 2.0e+00+5.0e-01i) 2.4497866312686415417e-1)
(num-test (angle 2.0e+00+8.3886080e+06i) 1.5707960883763175177e0)
(num-test (angle 2.0e+00-1.0e+00i) -4.6364760900080611621e-1)
(num-test (angle 2.0e+00-1.19209289550781250e-07i) -5.9604644775390554414e-8)
(num-test (angle 2.0e+00-2.0e+00i) -7.8539816339744830962e-1)
(num-test (angle 2.0e+00-5.0e-01i) -2.4497866312686415417e-1)
(num-test (angle 2.0e+00-8.3886080e+06i) -1.5707960883763175177e0)
(num-test (angle 2.71828182845905) 0.0)
(num-test (angle 2.71828182845905+0.00000001i) 0.00000000367879)
(num-test (angle 2.71828182845905+1.0i) 0.35251342177762)
(num-test (angle 2.71828182845905+1234.0i) 1.56859350877892)
(num-test (angle 2.71828182845905+1234000000.0i) 1.57079632459208)
(num-test (angle 2.71828182845905+2.71828182845905i) 0.78539816339745)
(num-test (angle 2.71828182845905+3.14159265358979i) 0.85751178635585)
(num-test (angle 2.71828182845905-0.00000001i) -0.00000000367879)
(num-test (angle 2.71828182845905-1.0i) -0.35251342177762)
(num-test (angle 2.71828182845905-1234.0i) -1.56859350877892)
(num-test (angle 2.71828182845905-1234000000.0i) -1.57079632459208)
(num-test (angle 2.71828182845905-2.71828182845905i) -0.78539816339745)
(num-test (angle 2.71828182845905-3.14159265358979i) -0.85751178635585)
(num-test (angle 2/1) 0)
(num-test (angle 2/10) 0)
(num-test (angle 2/1234) 0)
(num-test (angle 2/1234000000) 0)
(num-test (angle 2/2) 0)
(num-test (angle 2/3) 0)
(num-test (angle 2/362880) 0)
(num-test (angle 2/500029) 0)
(num-test (angle 3) 0)
(num-test (angle 3.14159265358979+0.00000001i) 0.00000000318310)
(num-test (angle 3.14159265358979+1.0i) 0.30816907111598)
(num-test (angle 3.14159265358979+1234.0i) 1.56825047114960)
(num-test (angle 3.14159265358979+1234000000.0i) 1.57079632424904)
(num-test (angle 3.14159265358979+2.71828182845905i) 0.71328454043905)
(num-test (angle 3.14159265358979+3.14159265358979i) 0.78539816339745)
(num-test (angle 3.14159265358979-0.00000001i) -0.00000000318310)
(num-test (angle 3.14159265358979-1.0i) -0.30816907111598)
(num-test (angle 3.14159265358979-1234.0i) -1.56825047114960)
(num-test (angle 3.14159265358979-1234000000.0i) -1.57079632424904)
(num-test (angle 3.14159265358979-2.71828182845905i) -0.71328454043905)
(num-test (angle 3.14159265358979-3.14159265358979i) -0.78539816339745)
(num-test (angle 3/1) 0)
(num-test (angle 3/10) 0)
(num-test (angle 3/1234) 0)
(num-test (angle 3/1234000000) 0)
(num-test (angle 3/2) 0)
(num-test (angle 3/3) 0)
(num-test (angle 3/362880) 0)
(num-test (angle 3/500029) 0)
(num-test (angle 362880) 0)
(num-test (angle 362880/1) 0)
(num-test (angle 362880/10) 0)
(num-test (angle 362880/1234) 0)
(num-test (angle 362880/1234000000) 0)
(num-test (angle 362880/2) 0)
(num-test (angle 362880/3) 0)
(num-test (angle 362880/362880) 0)
(num-test (angle 362880/500029) 0)
(num-test (angle 5.0e-01+0.0e+00i) 0.0)
(num-test (angle 5.0e-01+1.0e+00i) 1.1071487177940905030e0)
(num-test (angle 5.0e-01+1.19209289550781250e-07i) 2.3841857910155798249e-7)
(num-test (angle 5.0e-01+2.0e+00i) 1.3258176636680324651e0)
(num-test (angle 5.0e-01+5.0e-01i) 7.8539816339744830962e-1)
(num-test (angle 5.0e-01+8.3886080e+06i) 1.5707962671902518438e0)
(num-test (angle 5.0e-01-1.0e+00i) -1.1071487177940905030e0)
(num-test (angle 5.0e-01-1.19209289550781250e-07i) -2.3841857910155798249e-7)
(num-test (angle 5.0e-01-2.0e+00i) -1.3258176636680324651e0)
(num-test (angle 5.0e-01-5.0e-01i) -7.8539816339744830962e-1)
(num-test (angle 5.0e-01-8.3886080e+06i) -1.5707962671902518438e0)
(num-test (angle 500029) 0)
(num-test (angle 500029/1) 0)
(num-test (angle 500029/10) 0)
(num-test (angle 500029/1234) 0)
(num-test (angle 500029/1234000000) 0)
(num-test (angle 500029/2) 0)
(num-test (angle 500029/3) 0)
(num-test (angle 500029/362880) 0)
(num-test (angle 500029/500029) 0)
(num-test (angle 8.3886080e+06+0.0e+00i) 0e0)
(num-test (angle 8.3886080e+06+1.0e+00i) 1.1920928955078068531e-7)
(num-test (angle 8.3886080e+06+1.19209289550781250e-07i) 1.4210854715202003717e-14)
(num-test (angle 8.3886080e+06+2.0e+00i) 2.3841857910155798249e-7)
(num-test (angle 8.3886080e+06+5.0e-01i) 5.9604644775390554414e-8)
(num-test (angle 8.3886080e+06+8.3886080e+06i) 7.8539816339744830962e-1)
(num-test (angle 8.3886080e+06-1.0e+00i) -1.1920928955078068531e-7)
(num-test (angle 8.3886080e+06-1.19209289550781250e-07i) -1.4210854715202003717e-14)
(num-test (angle 8.3886080e+06-2.0e+00i) -2.3841857910155798249e-7)
(num-test (angle 8.3886080e+06-5.0e-01i) -5.9604644775390554414e-8)
(num-test (angle 8.3886080e+06-8.3886080e+06i) -7.8539816339744830962e-1)
(num-test (angle 9223372036854775807) 0)
(num-test (angle pi) 0.0)

(let ((val1 (catch #t (lambda () (angle 0.0)) (lambda args 'error)))
      (val2 (catch #t (lambda () (angle -0.0)) (lambda args 'error))))
  (test (equal? val1 val2) #t))

(when with-bignums
  (num-test (angle -1.797693134862315699999999999999999999998E308) 3.141592653589793238462643383279502884195E0)
  (num-test (angle (complex 1.0 1.0)) (angle (complex (expt 2 70) (expt 2 70))))
  (num-test (angle (make-polar 1000000000000000000000000.0 (* .1 pi))) (* .1 pi))
  (num-test (angle (complex most-positive-fixnum most-positive-fixnum)) 7.853981633974483096156608458198757210488E-1))

(test (angle) 'error)
(test (angle "hi") 'error)
(test (angle 1.0+23.0i 1.0+23.0i) 'error)

(for-each
 (lambda (arg)
   (test (angle arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))




;;; --------------------------------------------------------------------------------
;;; integer-length
;;; --------------------------------------------------------------------------------

;;; integer-length
(num-test (integer-length 0) 0)
(num-test (integer-length 1) 1)
(num-test (integer-length 2) 2)
(num-test (integer-length 3) 2)
(num-test (integer-length 4) 3)
(num-test (integer-length 7) 3)
(num-test (integer-length 8) 4)
(num-test (integer-length 21) 5)
(num-test (integer-length 215) 8)
(num-test (integer-length 12341234) 24)

(num-test (integer-length -1) 0)
(num-test (integer-length -2) 1)
(num-test (integer-length -3) 2)
(num-test (integer-length -4) 2)
(num-test (integer-length -7) 3)
(num-test (integer-length -8) 3)
(num-test (integer-length -9) 4)
(num-test (integer-length -21) 5)
(num-test (integer-length -215) 8)
(num-test (integer-length -12341234) 24)

(num-test (integer-length 127) 7)
(num-test (integer-length 128) 8)
(num-test (integer-length 129) 8)
(num-test (integer-length -127) 7)
(num-test (integer-length -128) 7)
(num-test (integer-length -129) 8)
(when (or (not with-bignums) (not pure-s7))
  (num-test (integer-length most-negative-fixnum) 63)
  (num-test (integer-length -9223372036854775808) 63))
(num-test (integer-length most-positive-fixnum) 63)
(num-test (integer-length 9223372036854775807) 63)

(test (integer-length) 'error)
(test (integer-length 1 2) 'error)
(test (integer-length 1/2) 'error)
(test (integer-length 1.2) 'error)
(test (integer-length 1+2i) 'error)
(test (integer-length 1/0) 'error)
(test (integer-length (log 0)) 'error)

(when with-bignums
  (test (integer-length (bignum "100000000000000000000000000000000000")) (ceiling (log (bignum "100000000000000000000000000000000000") 2)))
  (num-test (integer-length (+ (expt 2 48) (expt 2 46))) 49)
  (num-test (integer-length (ash 1 64)) 65)
  (num-test (integer-length 9223372036854775808) 64) ; ??
  (num-test (integer-length (* 4 most-positive-fixnum)) 65)
  (num-test (integer-length (* most-positive-fixnum most-positive-fixnum)) 126)
  (test (integer-length 0+92233720368547758081.0i) 'error)
  (test (integer-length 92233720368547758081.0) 'error))

(for-each
 (lambda (arg)
   (test (integer-length arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))




;;; --------------------------------------------------------------------------------
;;; integer-decode-float
;;; --------------------------------------------------------------------------------

(let ()
  (define (idf-test val1 val2)
    (test (cadr val1) (cadr val2))
    (test (caddr val1) (caddr val2))
    (test (< (abs (- (car val1) (car val2))) 1000) #t))
  
  (idf-test (integer-decode-float 0.0) '(0 0 1))
  (idf-test (integer-decode-float -0.0) '(0 0 1))
  (idf-test (integer-decode-float 1.0) '(4503599627370496 -52 1))
  (idf-test (integer-decode-float -1.0) '(4503599627370496 -52 -1))
  (idf-test (integer-decode-float 0.2) '(7205759403792794 -55 1))
  (idf-test (integer-decode-float -0.2) '(7205759403792794 -55 -1))
  (idf-test (integer-decode-float 3.0) '(6755399441055744 -51 1))
  (idf-test (integer-decode-float -3.0) '(6755399441055744 -51 -1))
  (idf-test (integer-decode-float 0.04) '(5764607523034235 -57 1))
  (idf-test (integer-decode-float -0.04) '(5764607523034235 -57 -1))
  (idf-test (integer-decode-float 50.0) '(7036874417766400 -47 1))
  (idf-test (integer-decode-float -50.0) '(7036874417766400 -47 -1))
  (idf-test (integer-decode-float 0.006) '(6917529027641082 -60 1))
  (idf-test (integer-decode-float -0.006) '(6917529027641082 -60 -1))
  (idf-test (integer-decode-float 7000.0) '(7696581394432000 -40 1))
  (idf-test (integer-decode-float -7000.0) '(7696581394432000 -40 -1))
  (idf-test (integer-decode-float 0.0008) '(7378697629483821 -63 1))
  (idf-test (integer-decode-float -0.0008) '(7378697629483821 -63 -1))
  (idf-test (integer-decode-float 90000.0) '(6184752906240000 -36 1))
  (idf-test (integer-decode-float -90000.0) '(6184752906240000 -36 -1))
  (idf-test (integer-decode-float 0.00001) '(5902958103587057 -69 1))
  (idf-test (integer-decode-float 1.0e-6) '(4722366482869645 -72 1))
  (idf-test (integer-decode-float 1.0e-8) '(6044629098073146 -79 1))
  (idf-test (integer-decode-float 1.0e-12) '(4951760157141521 -92 1))
  (idf-test (integer-decode-float 1.0e-16) '(8112963841460668 -106 1))
  (idf-test (integer-decode-float 1.0e-17) '(6490371073168535 -109 1))
  (idf-test (integer-decode-float 1.0e-18) '(5192296858534828 -112 1))
  (idf-test (integer-decode-float 1.0e-19) '(8307674973655724 -116 1))
  (idf-test (integer-decode-float 1.0e-25) '(8711228593176025 -136 1))
  (idf-test (integer-decode-float 1.0e6)  '(8589934592000000 -33 1))
  (idf-test (integer-decode-float 1.0e12) '(8192000000000000 -13 1))
  (idf-test (integer-decode-float 1.0e17) '(6250000000000000 4 1))
  (idf-test (integer-decode-float 1.0e18) '(7812500000000000 7 1))
  (idf-test (integer-decode-float 1.0e19) '(4882812500000000 11 1))
  (idf-test (integer-decode-float 1.0e20) '(6103515625000000 14 1))
  (idf-test (integer-decode-float 1.0e-100) '(7880401239278896 -385 1))
  (idf-test (integer-decode-float 1.0e100) '(5147557589468029 280 1))
  (idf-test (integer-decode-float 1.0e200) '(5883593420661338 612 1))
  (idf-test (integer-decode-float 1.0e-200) '(6894565328877484 -717 1))
  (idf-test (integer-decode-float 1.0e307) '(8016673440035891 967 1))
  )

(let ((val (integer-decode-float 1.0e-307)))
  (if (and (not (equal? val '(5060056332682765 -1072 1)))
	   (not (equal? val '(5060056332682766 -1072 1))))
      (format #t ";(integer-decode-float 1.0e-307) got ~A?~%" val)))

(test (integer-decode-float (/ 1.0e-307 100.0e0)) '(4706001880677807 -1075 1)) ; denormal
(test (integer-decode-float (/ (log 0.0))) '(6755399441055744 972 -1)) ; nan
(test (integer-decode-float (- (real-part (log 0.0)))) '(4503599627370496 972 1)) ; +inf
(test (integer-decode-float (real-part (log 0.0))) '(4503599627370496 972 -1)) ; -inf
(test (integer-decode-float 1.797e308) '(9003726357340310 971 1))
(test (integer-decode-float 1.0e-322) '(4503599627370516 -1075 1))
(test (integer-decode-float (expt 2.0 31)) (list #x10000000000000 -21 1))
(test (integer-decode-float (expt 2.0 52)) (list #x10000000000000 0 1))
(test (integer-decode-float 1e23) '(5960464477539062 24 1))

(if with-bignums
    (begin
      (test (integer-decode-float 2.225e-308) '(9007049763458157 -1075 1))
      (test (integer-decode-float (bignum "3.1")) (integer-decode-float 3.1))
      (test (integer-decode-float (bignum "1E430")) '(4503599627370496 972 1))
      (test (integer-decode-float (bignum "1E310")) '(4503599627370496 972 1))
      (test (integer-decode-float (bignum "-1E310")) '(4503599627370496 972 -1))
      (test (integer-decode-float 0+92233720368547758081.0i) 'error)
      (test (integer-decode-float 92233720368547758081/123) 'error))
    (begin
      (test (integer-decode-float 1/0) '(6755399441055744 972 1)) ; nan
      (test (integer-decode-float (real-part (log 0))) '(4503599627370496 972 -1)) ; -inf
      (test (integer-decode-float (- (real-part (log 0)))) '(4503599627370496 972 1)) ; inf
      (test (integer-decode-float (/ (real-part (log 0)) (real-part (log 0)))) '(6755399441055744 972 1)) ; nan
      (test (integer-decode-float (- (/ (real-part (log 0)) (real-part (log 0))))) '(6755399441055744 972 -1)) ; -nan
      ))

(do ((i 0 (+ i 1)))
    ((= i 100))
  (let ((val (- 1.0e6 (random 2.0e6))))
    (let* ((data (integer-decode-float val))
	   (signif (car data))
	   (expon (cadr data))
	   (sign (caddr data))) 
      (num-test (* sign signif (expt 2.0 expon)) val))))

(test (integer-decode-float) 'error)
(for-each
 (lambda (arg)
   (test (integer-decode-float arg) 'error))
 (list -1 0 #\a #(1 2 3) 2/3 1.5+0.3i 1+i () 'hi abs "hi" #(()) (list 1 2 3) '(1 . 2) (lambda () 1)))
(test (integer-decode-float 1.0 1.0) 'error)




;;; --------------------------------------------------------------------------------
;;; lognot
;;; --------------------------------------------------------------------------------

(for-each
 (lambda (op)
   (for-each
    (lambda (arg)
      (let ((val (catch #t (lambda () (op arg)) (lambda args 'error))))
	(if (not (equal? val 'error))
	    (format #t ";(~A ~A) -> ~A?~%" op arg val))))
    (list "hi" _ht_ _undef_ _null_ _c_obj_ () '(1 2) #f (integer->char 65) 'a-symbol (make-vector 3) 3.14 3/4 3.1+i abs #\f (lambda (a) (+ a 1)))))
 (list logior logand lognot logxor logbit? ash integer-length))

(for-each
 (lambda (op)
   (for-each
    (lambda (arg)
      (let ((val (catch #t (lambda () (op 1 arg)) (lambda args 'error))))
	(if (not (equal? val 'error))
	    (format #t ";(~A ~A) -> ~A?~%" op arg val))))
    (list "hi" _ht_ _undef_ _null_ _c_obj_ () '(1 2) #f (integer->char 65) 'a-symbol (make-vector 3) 3.14 -1/2 1+i abs #\f (lambda (a) (+ a 1)))))
 (list logior logand logxor lognot logbit?))


(num-test (lognot 0) -1)
(num-test (lognot -1) 0)
(num-test (lognot 1) -2)
(num-test (lognot #b101) -6)
(num-test (lognot -6) #b101)
(num-test (lognot 12341234) -12341235)
(num-test (lognot #b-101) 4)
(num-test (lognot (+ 1 (lognot 1000))) 999)
(num-test (lognot -9223372036854775808) 9223372036854775807)
(num-test (lognot 9223372036854775807) -9223372036854775808)
(num-test (lognot most-positive-fixnum) most-negative-fixnum)

(when with-bignums
  (test (lognot 9223372036854775808) -9223372036854775809)
  (test (lognot 618970019642690137449562111) (- (expt 2 89)))
  (num-test (lognot (+ (expt 2 48) (expt 2 46))) -351843720888321)
  (test (lognot 0+92233720368547758081.0i) 'error)
  (test (lognot 92233720368547758081.0) 'error))

(test (lognot) 'error)
(test (lognot 1.0) 'error)
(test (lognot 1+i) 'error)
(test (lognot 1/2) 'error)
(test (lognot #f) 'error)
(test (lognot 1/1) -2)



;;; --------------------------------------------------------------------------------
;;; logior
;;; --------------------------------------------------------------------------------

;;; logior
(num-test (logior 0 1) 1)
(num-test (logior #b101 #b10001) 21)
(num-test (logior 1 3 6) 7)
(num-test (logior -6 1) -5)
(num-test (logior -6 3) -5)
(num-test (logior #b1 #b11 #b111 #b1111) #b1111)
(num-test (logior -1 0 -1 -1) -1)
(num-test (logior 3 3 3 3) 3)
(num-test (logior 1) 1)
(num-test (logior -1) -1)
(num-test (logior 12341234 10001111) 12378103)
(num-test (logior 1 2 4 8) 15)
(num-test (logior 0 1/1) 1)
(num-test (logior 1/1 0) 1)
(num-test (logior -1 1 0) -1)
(num-test (logior 1 2 3 4) 7)
(num-test (logior 1 3 5 7) 7)
(num-test (logior -9223372036854775808 -9223372036854775808) -9223372036854775808)
(num-test (logior -9223372036854775808 9223372036854775807 -9223372036854775808) -1)
(num-test (logior 9223372036854775807 -9223372036854775808) -1)
(num-test (logior 9223372036854775807 9223372036854775807) 9223372036854775807)
(num-test (logior) 0)

(when with-bignums
  (test (logior (expt 2 63) (expt 2 75)) (+ (expt 2 63) (expt 2 75)))
  (num-test (logior (+ (expt 2 48) (expt 2 46)) (expt 2 48)) 351843720888320)
  (test (logior 0+92233720368547758081.0i) 'error)
  (test (logior 92233720368547758081.0) 'error))

(test (logior 0 1.0) 'error)
(test (logior 0 1/2) 'error)
(test (logior 1.0 0) 'error)
(test (logior 1/2 0) 'error)
(test (logior 1+i) 'error)
(test (logior -1 #\a) 'error)
(test (logior -1 "hi") 'error)
(test (logior #f "hi") 'error)

(let ()
  (define (make-bit-vector n)
    (make-int-vector (ceiling (/ n 63))))
  
  (define (bit-vector-ref v n)
    (logbit? (int-vector-ref v (quotient n 63)) (remainder n 63)))
  
  (define (bit-vector-set! v n t-or-f)
    (int-vector-set! v (quotient n 63)
		     (let ((cur (int-vector-ref v (quotient n 63)))
			   (bit (ash 1 (remainder n 63))))
		       (if t-or-f
			   (logior cur bit)
			   (logand cur (lognot bit))))))
  
  (let ((bv (make-bit-vector 128)))
    (if (bit-vector-ref bv 72)
	(format *stderr* "default #f: ~A~%" (bit-vector-ref bv 72)))
    (bit-vector-set! bv 72 #t)
    (if (not (bit-vector-ref bv 72))
	(format *stderr* "set: ~A~%" (bit-vector-ref bv 72)))
    (bit-vector-set! bv 72 #f)
    (if (bit-vector-ref bv 72)
	(format *stderr* "clear #f: ~A~%" (bit-vector-ref bv 72)))))



;;; --------------------------------------------------------------------------------
;;; logand
;;; --------------------------------------------------------------------------------

(num-test (logand 0 1) 0)
(num-test (logand 0 -1) 0)
(num-test (logand #b101 #b10001) 1)
(num-test (logand 1 3 6) 0)
(num-test (logand -1 3 6) 2)
(num-test (logand -6 1) 0)
(num-test (logand -6 3) 2)
(num-test (logand #b1 #b11 #b111 #b1111) #b1)
(num-test (logand -1 0 -1 -1) 0)
(num-test (logand 3 3 3 3) 3)
(num-test (logand 0) 0)
(num-test (logand -1) -1)
(num-test (logand 12341234 10001111) 9964242)
(num-test (logand -1 1) 1)
(num-test (logand -1 -1) -1)
(num-test (logand 1 -1) 1)
(num-test (logand 1 1) 1)
(num-test (logand 16 31) 16)
(num-test (logand 0 1/1) 0)
(num-test (logand 1/1 0) 0)
(num-test (logand 1 -1 -1) 1)
(num-test (logand 1 2 3 4) 0)
(num-test (logand 1 3 5 7) 1)
(num-test (logand -9223372036854775808 -1) -9223372036854775808)
(num-test (logand -9223372036854775808 -9223372036854775808) -9223372036854775808)
(num-test (logand -9223372036854775808 1) 0)
(num-test (logand -9223372036854775808 9223372036854775807 -9223372036854775808) 0)
(num-test (logand 9223372036854775807 -1) 9223372036854775807)
(num-test (logand 9223372036854775807 -9223372036854775808) 0)
(num-test (logand 9223372036854775807 1) 1)
(num-test (logand 9223372036854775807 9223372036854775807) 9223372036854775807)
(num-test (logand) -1)

(when with-bignums
  (test (logand 9223372036854775808 -9223372036854775809) 0)
  (test (logand 618970019642690137449562111 (expt 2 88)) (expt 2 88))
  (num-test (logand (+ (expt 2 48) (expt 2 46)) (expt 2 48)) 281474976710656)
  (test (logand 0+92233720368547758081.0i) 'error)
  (test (logand 92233720368547758081.0) 'error))

(test (logand 0 1.0) 'error)
(test (logand 1+i) 'error)
(test (logand 0 1/2) 'error)
(test (logand 1.0 0) 'error)
(test (logand 1/2 0) 'error)
(test (logand 0 #\a) 'error)
(test (logand 0 "hi") 'error)
(test (logand #f ()) 'error)



;;; --------------------------------------------------------------------------------
;;; logxor
;;; --------------------------------------------------------------------------------

(num-test (logxor 0 1) 1)
(num-test (logxor #b101 #b10001) 20)
(num-test (logxor 1 3 6) 4)
(num-test (logxor -6 1) -5)
(num-test (logxor -6 3) -7)
(num-test (logxor #b1 #b11 #b111 #b1111) #b1010)
(num-test (logxor 12341234 10001111) 2413861)
(num-test (logxor 1 3 7 15) 10)
(num-test (logxor 0 1/1) 1)
(num-test (logxor 1/1 0) 1)
(num-test (logxor 0 1 -1) -2)
(num-test (logxor -1 -1 -1) -1) 
;; to get the bits that are on in just 1 argument? (logxor (logxor a b c) (logand a b c))
(num-test (logxor 1 2 3 4) 4)
(num-test (logxor 1 3 5 7) 0)
(num-test (logxor -1 8 8) -1)
(num-test (logxor 8 8 8) 8)
(num-test (logxor -1 most-positive-fixnum) most-negative-fixnum)
(num-test (logxor most-negative-fixnum most-positive-fixnum) -1)
(num-test (logxor -100 -100 -100) -100)
(num-test (logxor -100 -100 -100 -1) 99)
(num-test (logxor -100 -100 -100 -1 -1) -100)
(num-test (logxor 4/2 11/11) 3)
(num-test (logxor -9223372036854775808 -9223372036854775808) 0)
(num-test (logxor -9223372036854775808 9223372036854775807 -9223372036854775808) 9223372036854775807)
(num-test (logxor 9223372036854775807 -9223372036854775808) -1)
(num-test (logxor 9223372036854775807 9223372036854775807) 0)
(num-test (logxor) 0)

(when with-bignums
  (test (logxor 37788155234994016485376 (+ (expt 2 63) 1)) (+ 1 (expt 2 75)))
  (num-test (logxor (+ (expt 2 48) (expt 2 46)) (expt 2 48)) 70368744177664)
  (test (logxor 0+92233720368547758081.0i) 'error)
  (test (logxor 92233720368547758081.0) 'error))

(test (logxor 0 1.0) 'error)
(test (logxor 0 1/2) 'error)
(test (logxor 1.0 0) 'error)
(test (logxor 1/2 0) 'error)


;;; log-n-of
(let ((top-checked-bit (if with-bignums 64 63)))

  (define (log-none-of . ints)  ; bits on in none of ints
    (lognot (apply logior ints)))

  (define (log-all-of . ints)   ; bits on in all of ints
    (apply logand ints))

  (define (log-any-of . ints)   ; bits on in at least 1 of ints
    (apply logior ints))

  (define (log-1-of . ints)     ; bits on in exactly 1 of ints
    (let ((len (length ints)))
      (cond ((= len 0) 
	     0)
	    ((= len 1) 
	     (car ints))
	    ((= len 2) 
	     (apply logxor ints))
	    ((= len 3) 
	     (logxor (apply logxor ints) (apply logand ints)))
	    (#t 
	     (do ((iors ())
		  (i 0 (+ i 1)))
		 ((= i len) (apply logior iors))
	       (let ((cur (ints i)))
		 (set! (ints i) 0)
		 (set! iors (cons (logand cur (lognot (apply logior ints))) iors))
		 (set! (ints i) cur)))))))

  (test (log-1-of 1 1) 0)
  (test (log-1-of 1 2) 3)
  (test (log-1-of 1 2 2) 1)
  (test (log-1-of 1 2 2 1) 0)
  (test (log-1-of 1 2 3 4 8 9) 4)
  (test (log-1-of -1 1 2 3) -4)
  (test (log-1-of 1 2 3 5) 4)
  (test (log-1-of -6 -31 -19 -9) 0)
  (test (log-1-of -45 -15 -7 -3) 6)
  (test (log-1-of -1 most-positive-fixnum -1) 0)
  (test (log-1-of -1 most-negative-fixnum -1) 0)
  (test (log-1-of 1 most-negative-fixnum 1) most-negative-fixnum)
  (test (log-1-of 31 11 27 -38) -60)
  (test (log-1-of -254) #b-11111110) ; (-254)
  (test (log-1-of 406 26 439 -361 -133 -480 312) #b1000000) ; (64)
  (test (log-1-of 47 110) #b1000001) ; (65)
  (test (log-1-of) 0)
  (test (log-1-of -52 108 97 48) #b-1101111) ; (-111)
  (test (log-1-of -113 -391 -129 -58 -374 -297 -498) #b0) ; (0)
  (test (log-1-of -251 138 418 494 -300 -224) #b10001) ; (17)
  (test (log-1-of 385 364 372) #b10011001) ; (153)
  (test (log-1-of -221 -56 173) #b1000110) ; (70)
  (test (log-1-of 31 -309 244 -478 396 -352 162 -479 -500) #b100000000) ; (256)
  (test (log-1-of -152 495 80 -403 -439 387) #b10000) ; (16)
  (test (log-1-of 115 71 110 568 10 382 124 378 23) #b1000000000) ; (512)
  (test (log-1-of 766 332 285 280 489 229) #b1000000010) ; (514)
  (test (log-1-of 424 935) #b1000001111) ; (527)
  (test (log-1-of 788 268 388) #b1010011000) ; (664)
  (test (log-1-of 389 237 398 530) #b1001110000) ; (624)
  (test (log-1-of 554 550 215 44 892 668) #b100000001) ; (257)
  (test (log-1-of 562 171 772 480 6 211 542 678) #b0) ; (0)

  (do ((i 0 (+ i 1)))
      ((= i 10))
    
    (let ((len (+ 1 (random 10)))
	  (ints ()))
      (do ((k 0 (+ k 1)))
	  ((= k len))
	(set! ints (cons (- (random 1000) 500) ints)))
      
      (let ((result (apply log-1-of ints)))
	;;(format #t "(test (log-1-of ~{~D~^ ~}) #b~B) ; (~D)~%" ints result result)
	
	(do ((b 0 (+ b 1)))
	    ((= b top-checked-bit))
	  (let ((counts 0))
	    (for-each
	     (lambda (int)
	       (if (logbit? int b) ;(not (zero? (logand int (ash 1 b))))
		   (set! counts (+ counts 1))))
	     ints)
	    
	    (if (logbit? result b) ;(not (zero? (logand result (ash 1 b))))
		(if (not (= counts 1))
		    (format #t ";(log-1-of ~{~D~^ ~}) -> ~A,  [#b~B, counts: ~D but we're on]~%" ints result (ash 1 b) counts))
		(if (= counts 1)
		    (format #t ";(log-1-of ~{~D~^ ~}) -> ~A,  [#b~B, counts = 1 but we're off]~%" ints result (ash 1 b)))))))))
  

  (define (log-n-1-of . ints) ; bits on in exactly n-1 of ints
    (let ((len (length ints)))
      (cond ((= len 0) 
	     0)
	    ((= len 1) 
	     0)
	    ((= len 2) 
	     (apply logxor ints))
	    ((= len 3) 
	     (logand (lognot (apply logxor ints)) (apply logior ints)))
	    (#t 
	     (do ((iors ())
		  (i 0 (+ i 1)))
		 ((= i len) (apply logior iors))
	       (let ((cur (ints i)))
		 (set! (ints i) -1)
		 (set! iors (cons (logand (lognot cur) (apply logand ints)) iors))
		 (set! (ints i) cur)))))))
  
  (test (log-n-1-of 1 1) 0)
  (test (log-n-1-of 1 2) 3)
  (test (log-n-1-of 1 2 2) 2)
  (test (log-n-1-of 1 2 2 3) 2)
  (test (log-n-1-of -336 -225 275) #b-11111101) ; (-253)
  (test (log-n-1-of -35 32 -17 -310 256 -360 171 -370) #b0) ; (0)
  (test (log-n-1-of 311 237) #b111011010) ; (474)
  (test (log-n-1-of 32 348 -340 147) #b0) ; (0)
  (test (log-n-1-of -334 -267 -478 -93 239 423 18 496) #b100000) ; (32)
  (test (log-n-1-of -347 149 135 107 -436) #b101) ; (5)
  (test (log-n-1-of -181 406 480 390 207 13 0) #b0) ; (0)
  (test (log-n-1-of 348) #b0) ; (0)
  (test (log-n-1-of -498 226) #b-100010100) ; (-276)
  (test (log-n-1-of 259 -171 146 -344 63 -240 290 -418) #b0) ; (0)
  (test (log-n-1-of 86 -74 61 -138 215 -277 358) #b110) ; (6)
  (test (log-n-1-of -144 425 -356 -341 211 -390) #b0) ; (0)
  (test (log-n-1-of -223 390 195 265) #b100000001) ; (257)
  (test (log-n-1-of 103 263 -92 -7) #b100100101) ; (293)
  (test (log-n-1-of -78 -199 68 218 -98 -464 307 301) #b0) ; (0)
  (test (log-n-1-of -355 258 -134 -371 211) #b0) ; (0)
  (test (log-n-1-of -222 -39 408 -50 -207 58) #b100000000) ; (256)
  (test (log-n-1-of 66 93 484) #b100) ; (4)
  (test (log-n-1-of 36 -384 3 49 359 -284 -284 -133 268) #b0) ; (0)
  (test (log-n-1-of -339 -50 243 -159 -159) #b-110011111) ; (-415)
  (test (log-n-1-of 154 -260 -219 400 -196 -236 421 -277 375 -67) #b0) ; (0)
  (test (log-n-1-of 45 112) #b1011101) ; (93)
  (test (log-n-1-of -493 131 48 45 311 197 491 -86 164) #b0) ; (0)
  (test (log-n-1-of 371 -75 -107 -348 -9 7 -129) #b101) ; (5)
  (test (log-n-1-of 349 -219 -160) #b-110011011) ; (-411)
  (test (log-n-1-of 412 456 407 -13 352 467 327 147) #b100000000) ; (256)
  (test (log-n-1-of 133 -133 -471 -284 -58 -266) #b-1000000000) ; (-512)
  (test (log-n-1-of 43 -339 22 150 49 259) #b0) ; (0)
  (test (log-n-1-of 258 -138 185 400 -476 -312 69 380) #b0) ; (0)
  (test (log-n-1-of 260 -85 -208 -21) #b-111100000) ; (-480)
  (test (log-n-1-of -294 177 -78) #b-111011110) ; (-478)
  (test (log-n-1-of -40 81 445 -300) #b11000000) ; (192)
  (test (log-n-1-of -325 -393 411 -441 -221 -43 -231 -283 -223) #b-1000000000) ; (-512)
  (test (log-n-1-of 18 -36 -351 -160 211 412) #b0) ; (0)
  
  (do ((i 0 (+ i 1)))
      ((= i 10))
    
    (let ((len (+ 1 (random 10)))
	  (ints ()))
      (do ((k 0 (+ k 1)))
	  ((= k len))
	(set! ints (cons (- (random 1000) 500) ints)))
      
      (let ((result (apply log-n-1-of ints)))
	;;(format #t "(test (log-n-1-of ~{~D~^ ~}) #b~B) ; (~D)~%" ints result result)
	
	(do ((b 0 (+ b 1)))
	    ((= b top-checked-bit))
	  (let ((counts 0))
	    (for-each
	     (lambda (int)
	       (if (logbit? int b) ;(not (zero? (logand int (ash 1 b))))
		   (set! counts (+ counts 1))))
	     ints)
	    
	    (if (logbit? result b) ;(not (zero? (logand result (ash 1 b))))
		(if (not (= counts (- len 1)))
		    (format #t ";(log-n-1-of ~{~D~^ ~}) -> ~A,  [#b~B, counts: ~D but we're on]~%" ints result (ash 1 b) counts))
		(if (and (> len 1) (= counts (- len 1)))
		    (format #t ";(log-n-1-of ~{~D~^ ~}) -> ~A,  [#b~B, counts: ~D but we're off]~%" ints result (ash 1 b) counts))))))))
  
  (define (log-n-of n . ints) ; bits on in exactly n of ints
    (let ((len (length ints)))
      (cond ((= len 0)
	     (if (= n 0) -1 0))
	    
	    ((= n 0)
	     (apply log-none-of ints))
	    
	    ((= n len)
	     (apply log-all-of ints))
	    
	    ((> n len)
	     0)
	    
	    ((= n 1)
	     (apply log-1-of ints))
	    
	    ((= n (- len 1))
	     (apply log-n-1-of ints))
	    
	    ;; now n is between 2 and len-2, and len is 3 or more
	    ;;   I think it would be less inefficient here to choose either this or the n-1 case based on n<=len/2
	    (#t 
	     (do ((1s ())
		  (prev ints)
		  (i 0 (+ i 1)))
		 ((= i len) (apply logior 1s))
	       (let ((cur (ints i)))
		 (if (= i 0)
		     (set! 1s (cons (logand cur (apply log-n-of (- n 1) (cdr ints))) 1s))
		     (let ((mid (cdr prev)))
		       (set! (cdr prev) (if (= i (- len 1)) () (cdr mid)))
		       (set! 1s (cons (logand cur (apply log-n-of (- n 1) ints)) 1s))
		       (set! (cdr prev) mid)
		       (set! prev mid)))))))))

  (test (log-n-of 1) 0)
  (test (log-n-of 0) -1)
  (test (log-n-of 0 -2) 1)
  (test (log-n-of 0 92 -451 317 -269 -300 245 461 -64) #b0)
  (test (log-n-of 0 287) #b-100100000) ; (-288)
  (test (log-n-of 0 -180 441 -487) #b10) ; (2)
  (test (log-n-of 0 274 150) #b-110010111) ; (-407)
  (test (log-n-of 0 140 -307 8 216 -392 8 -486 147 -469) #b100000000) ; (256)

  (test (log-n-of 1 1 1) 0)
  (test (log-n-of 1 1 2) 3)
  (test (log-n-of 2 1 2) 0)
  (test (log-n-of 2 2 2) 2)
  (test (log-n-of 2 2 2 2) 0)
  (test (log-n-of 3 2 2 2) 2)
  (test (log-n-of 3 2 2 3) 2)
  (test (log-n-of 3 2 1 3 3) 3)

  (test (log-n-of 1 158 172 -4 432 147 497 -236 85 -454 -447) #b0) ; (0)
  (test (log-n-of 1 377 -232 295) #b-110111010) ; (-442)
  (test (log-n-of 1 -110) #b-1101110) ; (-110)
  (test (log-n-of 1 304 -36 64 -140 -165 -85) #b0) ; (0)
  (test (log-n-of 1 226 -135 -392 55 -358 260 -447) #b0) ; (0)
  (test (log-n-of 1 -241 454 178 107 312) #b-1000000000) ; (-512)
  (test (log-n-of 1 -122 419 -121) #b100000) ; (32)
  (test (log-n-of 1 378 -233 -332 -308) #b1) ; (1)
  (test (log-n-of 1 -381 44 -99 -161 338) #b100000) ; (32)
  
  (test (log-n-of 2 6 -45 331 339 156 207 -308) #b-1000000000) ; (-512)
  (test (log-n-of 2 -483) #b0) ; (0)
  (test (log-n-of 2 -113 75 465 -434 -164 291) #b10010000) ; (144)
  (test (log-n-of 2 -95 -314 187 40) #b-111110101) ; (-501)
  (test (log-n-of 2 126 -254) #b10) ; (2)
  (test (log-n-of 2 -228) #b0) ; (0)
  (test (log-n-of 2 -472 163 6 -185 -208 -481 -60 -331 479) #b0) ; (0)
  (test (log-n-of 2 357 -468 490 -423 33) #b-11111100) ; (-252)
  (test (log-n-of 2 13 343 -276 148 -425 -116 361 -305 344 -361) #b100000) ; (32)
  (test (log-n-of 2 -79) #b0) ; (0)
  
  (test (log-n-of 3 268 134 46 -207 414) #b100001010) ; (266)
  (test (log-n-of 3 455 -138 58 -225 -250) #b-111110000) ; (-496)
  (test (log-n-of 3 -267 154 -217 468 -455 43 307 364) #b-101000000) ; (-320)
  (test (log-n-of 3 14 197 65 -327 -86 -438) #b-100111101) ; (-317)
  (test (log-n-of 3 229 452 434 -75 -405 440 -420 40) #b-111111111) ; (-511)
  (test (log-n-of 3 -24 -450 437 -467 -487 -479 14 394 -433 53) #b110000000) ; (384)
  (test (log-n-of 3 474 442 303 -203 -59) #b10111111) ; (191)
  (test (log-n-of 3 -401 104 66) #b1000000) ; (64)
  (test (log-n-of 3 -129 79 215 -272 -259) #b-101010110) ; (-342)
  (test (log-n-of 3 -139 36 -489 352 -364 498 -11) #b10000001) ; (129)
  
  (test (log-n-of 4 23) #b0) ; (0)
  (test (log-n-of 4 407 225 417 269 -174 181 -332) #b100110100) ; (308)
  (test (log-n-of 4 439 480 -278 168 189) #b0) ; (0)
  (test (log-n-of 4 -206 295) #b0) ; (0)
  (test (log-n-of 4 -260 24 -320) #b0) ; (0)
  (test (log-n-of 4 354 -463 -66 137 -364) #b0) ; (0)
  (test (log-n-of 4 -117 -68 -343 -285) #b-110000000) ; (-384)
  (test (log-n-of 4 -206 -449 118 -211 -125 391 232) #b-11111011) ; (-251)
  (test (log-n-of 4 -164 -499 -291 325 -143 -268 135 103) #b10000) ; (16)
  
  (do ((i 0 (+ i 1)))
      ((= i 10))
    
    (let ((len (+ 1 (random 10)))
	  (ints ())
	  (n (random 5)))
      
      (do ((k 0 (+ k 1)))
	  ((= k len))
	(set! ints (cons (- (random 1000) 500) ints)))
      
      (let ((result (apply log-n-of n ints)))
	;;(format #t "(test (log-n-of ~D ~{~D~^ ~}) #b~B) ; (~D)~%" n ints result result)
	
	(do ((b 0 (+ b 1)))
	    ((= b top-checked-bit))
	  (let ((counts 0))
	    (for-each
	     (lambda (int)
	       (if (logbit? int b) ;(not (zero? (logand int (ash 1 b))))
		   (set! counts (+ counts 1))))
	     ints)
	    
	    (if (logbit? result b) ;(not (zero? (logand result (ash 1 b))))
		(if (not (= counts n))
		    (format #t ";(log-n-of ~D ~{~D~^ ~}) -> ~A,  [#b~B, counts: ~D but we're on]~%" n ints result (ash 1 b) counts))
		(if (and (> len 1) (= counts n))
		    (format #t ";(log-n-of ~D ~{~D~^ ~}) -> ~A,  [#b~B, counts: ~D but we're off]~%" n ints result (ash 1 b) counts))))))))


  (define (simple-log-n-of n . ints)     ; bits on in exactly n of ints
    (let ((len (length ints)))
      (cond ((= len 0) (if (= n 0) -1 0))
	    ((= n 0)   (lognot (apply logior ints)))
	    ((= n len) (apply logand ints))
	    ((> n len) 0)
	    (#t 
	     (do ((1s 0)
		  (prev ints)
		  (i 0 (+ i 1)))
		 ((= i len) 1s)
	       (let ((cur (ints i)))
		 (if (= i 0)
		     (set! 1s (logior 1s (logand cur (apply simple-log-n-of (- n 1) (cdr ints)))))
		     (let* ((mid (cdr prev))
			    (nxt (if (= i (- len 1)) () (cdr mid))))
		       (set! (cdr prev) nxt)
		       (set! 1s (logior 1s (logand cur (apply simple-log-n-of (- n 1) ints))))
		       (set! (cdr prev) mid)
		       (set! prev mid)))))))))

  (num-test (simple-log-n-of 1 0 0 -1 0) -1)
  (num-test (simple-log-n-of 1 0 -1 -1 0) 0)
  (num-test (simple-log-n-of 2 0 -1 -1 0) -1)
  (num-test (simple-log-n-of 2 0 -1 -1 -1) 0)
  (num-test (simple-log-n-of 3 0 -1 -1 -1) -1)
  (num-test (simple-log-n-of 4 0 -1 -1 -1) 0)
  
  (do ((i 0 (+ i 1)))
      ((= i 10))
    
    (let ((len (+ 1 (random 10)))
	  (ints ())
	  (n (random 5)))
      
      (do ((k 0 (+ k 1)))
	  ((= k len))
	(set! ints (cons (- (random 1000) 500) ints)))
      
      (let ((result (apply simple-log-n-of n ints)))
	(do ((b 0 (+ b 1)))
	    ((= b top-checked-bit))
	  (let ((counts 0))
	    (for-each
	     (lambda (int)
	       (if (logbit? int b) ;(not (zero? (logand int (ash 1 b))))
		   (set! counts (+ counts 1))))
	     ints)
	    
	    (if (logbit? result b) ;(not (zero? (logand result (ash 1 b))))
		(if (not (= counts n))
		    (format #t ";(simple-log-n-of ~D ~{~D~^ ~}) -> ~A,  [#b~B, counts: ~D but we're on]~%" n ints result (ash 1 b) counts))
		(if (and (> len 1) (= counts n))
		    (format #t ";(simple-log-n-of ~D ~{~D~^ ~}) -> ~A,  [#b~B, counts: ~D but we're off]~%" n ints result (ash 1 b) counts)))))))))

(let () ; from sbcl/contrib/sb-rotate-byte
  (define (rotate-byte count bytespec integer)  ; logrot?
    (let* ((size (car bytespec))
	   (count (- count (* (round (/ count size)) size)))
	   (mask (ash (- (ash 1 size) 1) (cdr bytespec)))
	   (field (logand mask integer)))
      (logior (logand integer (lognot mask))
	      (logand mask
		      (logior (ash field count)
			      (ash field ((if (positive? count) - +) count size)))))))

  (test (rotate-byte 6 (cons 8 0) -3) -129)
  (test (rotate-byte 3 (cons 32 0) 3) 24)
  (test (rotate-byte 3 (cons 16 0) 3) 24)
  (test (rotate-byte 5 (cons 32 0) 5) 160)
  (test (rotate-byte 5 (cons 32 0) (ash 1 26)) (ash 1 31)))

  

;;; --------------------------------------------------------------------------------
;;; logbit?
;;; --------------------------------------------------------------------------------

(test (logbit? 0 1) #f)
(test (logbit? 0 0) #f)
(test (logbit? 0 -1) 'error)
(test (logbit? #b101 1) #f)
(test (logbit? #b101 0) #t)
(test (logbit? 1 3 6) 'error)
(test (logbit? -1 3) #t)
(test (logbit? -1 0) #t)
(test (logbit? -6 0) #f)
(test (logbit? -6 3) #t)
(test (logbit? 4 1) #f)
(test (logbit? 1 1) #f)
(test (logbit? 1 0) #t)
(test (logbit? -9223372036854775808 1) #f)
(test (logbit? most-positive-fixnum 31) #t)
(test (logbit? most-positive-fixnum 68) #f)
(test (logbit? most-positive-fixnum 63) #f)
(test (logbit? most-positive-fixnum 62) #t)
(test (logbit? (ash 1 12) 12) #t)
(test (logbit? (ash 1 12) 11) #f)
(test (logbit? (ash 1 32) 32) #t)
(test (logbit? (ash 1 31) 31) #t)
(test (logbit? (ash 1 31) 30) #f)
(test (logbit? (ash 1 31) 32) #f)
(test (logbit? (ash 1 32) 31) #f)
(test (logbit? (ash 1 62) 62) #t)
(test (logbit? (ash 1 62) 61) #f)
(test (logbit? -1 most-negative-fixnum) 'error)
(test (logbit? most-negative-fixnum 63) #t)
(test (logbit? most-negative-fixnum 62) #f)
(test (logbit? -31 63) #t)
(test (logbit? 1 most-positive-fixnum) #f)
(test (logbit? 0 most-positive-fixnum) #f)
(test (logbit? -1 most-positive-fixnum) #t)
(test (logbit? -1 64) #t)
(test (logbit? 1 64) #f)

;;; (test (logbit? most-negative-fixnum most-positive-fixnum) #t) ;??
(test (logbit? most-negative-fixnum most-negative-fixnum) 'error)
(test (logbit? most-positive-fixnum most-positive-fixnum) #f)
(test (logbit? (ash most-negative-fixnum 1) 1) #f)

(when with-bignums
  (test (logbit? (ash 1 64) 64) #t)
  (test (logbit? (ash 1 64) 63) #f)
  (test (logbit? most-negative-fixnum 63) #t)
  (test (logbit? (bignum "-1") 64) #t))

(test (logbit? 0 1.0) 'error)
(test (logbit? 1+i) 'error)
(test (logbit? 1+i 0) 'error)
(test (logbit? 0 1/2) 'error)
(test (logbit? 1.0 0) 'error)
(test (logbit? 1/2 0) 'error)
(test (logbit? -1/2 0) 'error)
(test (logbit? 1/2 123123123) 'error)
(test (logbit? 0 #\a) 'error)
(test (logbit? 0 "hi") 'error)
(test (logbit? #f ()) 'error)
(test (logbit?) 'error)
(test (logbit? 0) 'error)

(test (logbit? -1/9223372036854775807 7) 'error)
(test (logbit? -1/9223372036854775807 123123123) 'error)
(test (logbit? 1/0 123123123) 'error)
(test (logbit? (c-pointer 0) 123123123) 'error)

(do ((i 0 (+ i 1))) 
    ((= i 100)) 
  (let ((x (random most-positive-fixnum)) ; or most-negative-fixnum
	(index (random 63))) 
    (let ((on? (logbit? x index))
	  (ash? (not (zero? (logand x (ash 1 index))))))
      (if (not (eq? on? ash?))
	  (format #t "(logbit? ~A ~A): ~A ~A~%" x index on? ash?)))))





;;; --------------------------------------------------------------------------------
;;; ash
;;; --------------------------------------------------------------------------------

(num-test (ash #b-1100 -2) -3)
(num-test (ash #b-1100 2) -48)
(num-test (ash (ash 1 31) -31) 1)
(num-test (ash (expt 2 31) (- (expt 2 31))) 0)
(num-test (ash -0 -10) 0)
(num-test (ash -1 -12)  -1)
(num-test (ash -1 -3) -1)
(num-test (ash -1 -8) -1)
(num-test (ash -1 0) -1)
(num-test (ash -1 30) -1073741824)
(num-test (ash -1 8) -256)
(num-test (ash -129876 -1026) -1)
(num-test (ash -2 -3) -1)
(num-test (ash -3 -3) -1)
(num-test (ash -3 3) -24)
(num-test (ash -31 -100) -1)
(num-test (ash -31 -20) -1)
(num-test (ash -31 -60) -1)
(num-test (ash -31 -70) -1)
(num-test (ash -31 most-negative-fixnum) -1)
(num-test (ash 0 (expt 2 32)) 0)
(num-test (ash 0 -10) 0)
(num-test (ash 0 0) 0)
(num-test (ash 0 1) 0)
(num-test (ash 0 100) 0)
(num-test (ash 1 (- (expt 2 31))) 0)
(num-test (ash 1 (- (expt 2 32))) 0)
(num-test (ash 1 -1) 0)
(num-test (ash 1 -100) 0)
(num-test (ash 1 10) 1024)
(num-test (ash 1 31) 2147483648)
(num-test (ash 1 32) 4294967296)
(num-test (ash 1/1 10) 1024)
(num-test (ash 1024 -8) 4)
(num-test (ash 123 0) 123)
(num-test (ash 1234 -6) 19)
(num-test (ash 1234 6) 78976)
(num-test (ash 12341234 -16) 188)
(num-test (ash 12341234 6) 789838976)
(num-test (ash 2 -1) 1)
(num-test (ash 2 -2) 0)
(test (> (ash 1 30) 1) #t)
(test (> (ash 1 62) 1) #t)
(test (ash most-positive-fixnum -2) 2305843009213693951)
(test (ash most-positive-fixnum -62) 1)
(test (ash (ash most-negative-fixnum -2) 2) most-negative-fixnum)
;; (test (ash most-positive-fixnum 2) 'error) if not bignums?
(num-test (ash 1000000000 -100000000000) 0)

(do ((i 0 (+ i 1))) 
    ((= i 15)) 
  (test (= (expt (ash 1 i) 2)
	   (ash 1 (* 2 i)) 
	   (expt 2 (* 2 i))
	   (* (- (expt 2 i)) (- (ash 1 i)))
	   (ash 2 (- (* i 2) 1)))
	#t))

(when with-bignums
  (num-test (ash 1 48) 281474976710656)
  (num-test (ash most-positive-fixnum 2) 36893488147419103228)
  (num-test (ash 281474976710656 -48) 1)
  (num-test (ash -100000000000000000000000000000000 -100) -79)
  ;; (floor (/ -100000000000000000000000000000000 (expt 2 100))) = -79
  (num-test (ash -100000000000000000000000000000000 -200) -1)
  (num-test (ash 1 63) 9223372036854775808)
  (num-test (ash 1 64) 18446744073709551616)
  (num-test (ash 1 100) 1267650600228229401496703205376)
  (num-test (ash 18446744073709551616 -63) 2)
  (num-test (ash 1267650600228229401496703205376 -100) 1)
  (test (ash 1 89) (expt 2 89))
  (test (ash 1 0+92233720368547758081.0i) 'error)
  (test (ash 1 92233720368547758081.0) 'error)
  (test (ash 0+92233720368547758081.0i -1) 'error)
  (test (ash 92233720368547758081.0 1) 'error)
  (num-test (ash 9223372036854775807 1) 18446744073709551614)
  (num-test (ash -9223372036854775807 1) -18446744073709551614))

(test (ash 1 (expt 2 32)) 'error)
(test (ash) 'error)
(test (ash 1) 'error)
(test (ash 1 2 3) 'error)

(for-each
 (lambda (arg)
   (test (ash 1 arg) 'error)
   (test (ash arg 1) 'error))
 (list #\a #f _ht_ _undef_ _null_ _c_obj_ #(1 2 3) 3.14 2/3 1.5+0.3i 1+i () 'hi abs "hi" #(()) (list 1 2 3) '(1 . 2) (lambda () 1)))

(let ()
  ;; fails if x=0: (define (2^n? x) (zero? (logand x (- x 1))))
  (define (2^n? x) (and (not (zero? x)) (zero? (logand x (- x 1)))))
  (define (2^n-1? x) (zero? (logand x (+ x 1))))
  (define (x+y x y) (- x (lognot y) 1))
  (define (0? x) (negative? (logand (lognot x) (- x 1))))
  (define (<=0? x) (negative? (logior x (- x 1))))
  (define (>=0? x) (negative? (lognot x)))
  (define (>0? x) (negative? (logand (- x) (lognot x))))
  (define-macro (<=> x y) `(begin (set! ,x (logxor ,x ,y)) (set! ,y (logxor ,y ,x)) (set! ,x (logxor ,x ,y))))
  
  (test (2^n? 32) #t)
  (test (2^n? 0) #f)
  (test (2^n? 2305843009213693952) #t)
  (test (2^n? 2305843009213693950) #f)
  (test (2^n? 17) #f)
  (test (2^n? 1) #t)
  (test (2^n-1? 31) #t)
  (test (2^n-1? 32) #f)
  (test (2^n-1? 18014398509481985) #f)
  (test (2^n-1? 18014398509481983) #t)
  (test (x+y 41 3) 44)
  (test (0? 0) #t)
  (test (0? 123) #f)
  (test (<=0? 0) #t)
  (test (<=0? -2) #t)
  (test (<=0? 2) #f)
  (test (>=0? -1) #f)
  (test (>0? 1) #t)
  (test (let ((x 1) (y 321)) (<=> x y) (list x y)) (list 321 1))
  )


;; these added 28-Jan-18 but maybe they're a bad idea
(num-test #xffffffffffffffff -1)
(num-test #x7fffffffffffffff most-positive-fixnum)
(num-test #x7ffffffffffffffe (- most-positive-fixnum 1))
(num-test #x8000000000000000 most-negative-fixnum)
(num-test #x8000000000000001 (+ most-negative-fixnum 1))
(num-test #xfffffffffffffffe -2)

(define (bit-reverse int)
  ;; from "Hacker's Delight" Henry Warren p101, but 64 bit
  (let ((x int))
    (set! x (logior (ash (logand x #x5555555555555555) 1)
		    (ash (logand x #xAAAAAAAAAAAAAAAA) -1)))
    (set! x (logior (ash (logand x #x3333333333333333) 2)
		    (ash (logand x #xCCCCCCCCCCCCCCCC) -2)))
    (set! x (logior (ash (logand x #x0F0F0F0F0F0F0F0F) 4)
		    (ash (logand x #xF0F0F0F0F0F0F0F0) -4)))
    (set! x (logior (ash (logand x #x00FF00FF00FF00FF) 8)
		    (ash (logand x #xFF00FF00FF00FF00) -8)))
    (set! x (logior (ash (logand x #x0000FFFF0000FFFF) 16)
		    (ash (logand x #xFFFF0000FFFF0000) -16)))
    (logior (ash (logand x #x00000000FFFFFFFF) 32)
	    (ash (logand x #xFFFFFFFF00000000) -32))))

(let ((x (ash (bit-reverse #x01234566) -32)))
  (num-test x  1721943168))


(test (let () (define (func) ((lambda* ((x 1)) (do ((i 0 (+ i 1))) ((= i 1) 1) (ash x 1234))))) (define (hi) (func)) (hi)) 'error)

;; from CL spec
(test (let ((str ""))
	(let ((show (lambda (m x y)
		      (set! str (string-append str (format #f "[m = #o~6,'0O, x = #o~6,'0O, y = #o~6,'0O] " m x y))))))
	  (let ((m #o007750)
		(x #o452576)
		(y #o317407))
	    (show m x y)
	    (let ((z (logand (logxor x y) m)))
	      (set! x (logxor z x))
	      (set! y (logxor z y))
	      (show m x y)))) str)
      "[m = #o007750, x = #o452576, y = #o317407] [m = #o007750, x = #o457426, y = #o312557] ")


#|
    (DEFUN HAULONG (ARG)
      (INTEGER-LENGTH (ABS ARG)))

    (DEFUN HAIPART (X N)
      (SETQ X (ABS X))
      (IF (MINUSP N) 
          (LOGAND X (- (ASH 1 (- N)) 1))
          (ASH X (MIN (- N (HAULONG X)) 0))))
|#




;;; --------------------------------------------------------------------------------
;;; truncate
;;; --------------------------------------------------------------------------------

(num-test (truncate (- (+ 1 -1/123400000))) 0)
(num-test (truncate (- 1 1/123400000)) 0)
(num-test (truncate (/ (- most-positive-fixnum 1) most-positive-fixnum)) 0)
(num-test (truncate (/ -1 most-positive-fixnum)) 0)
(num-test (truncate (/ 1 most-positive-fixnum)) 0)
(num-test (truncate (/ most-negative-fixnum most-positive-fixnum)) -1)
(num-test (truncate (/ most-positive-fixnum (- most-positive-fixnum 1))) 1)
(num-test (truncate -0) 0)
(num-test (truncate -0.0) 0)
(num-test (truncate -0.1) 0)
(num-test (truncate -0.9) 0)
(num-test (truncate -1) -1)
(num-test (truncate -1.1) -1)
(num-test (truncate -1.9) -1)
(num-test (truncate -1/10) 0)
(num-test (truncate -1/123400000) 0)
(num-test (truncate -1/2) 0)
(num-test (truncate -100/3) -33)
(num-test (truncate -11/10) -1)
(num-test (truncate -17/2) -8)
(num-test (truncate -19/10) -1)
(num-test (truncate -2.225073858507201399999999999999999999996E-308) 0)
(num-test (truncate -2/3) 0)
(num-test (truncate -200/3) -66)
(num-test (truncate -3/2) -1)
(num-test (truncate -9/10) 0)
(num-test (truncate -9223372036854775808) -9223372036854775808)
(num-test (truncate 0) 0)
(num-test (truncate 0.0) 0)
(num-test (truncate 0.1) 0)
(num-test (truncate 0.9) 0)
(num-test (truncate 1) 1)
(num-test (truncate 1.1) 1)
(num-test (truncate 1.110223024625156799999999999999999999997E-16) 0)
(num-test (truncate 1.9) 1)
(num-test (truncate 1/10) 0)
(num-test (truncate 1/123400000) 0)
(num-test (truncate 1/2) 0)
(num-test (truncate 100/3) 33)
(num-test (truncate 11/10) 1)
(num-test (truncate 17.3) 17)
(num-test (truncate 19) 19)
(num-test (truncate 19/10) 1)
(num-test (truncate 2.4) 2)
(num-test (truncate 2.5) 2)
(num-test (truncate 2.6) 2)
(num-test (truncate 2/3) 0)
(num-test (truncate 200/3) 66)
(num-test (truncate 3/2) 1)
(num-test (truncate 9/10) 0)
(num-test (truncate 9223372036854775807) 9223372036854775807)
(num-test (truncate most-negative-fixnum) most-negative-fixnum)
(num-test (truncate most-positive-fixnum) most-positive-fixnum)
(num-test (truncate 1+0i) 1)

(when with-bignums
  (num-test (truncate 8388608.9999999995) 8388608)
  (num-test (truncate -8388609.0000000005) -8388609)
  (num-test (truncate -8388609.9999999995) -8388609))

(test (= (truncate (* 111738283365989051/177100989030047175 1.0)) (truncate 130441933147714940/206745572560704147)) #t)
(test (= (truncate (* 114243/80782 114243/80782 1.0)) (truncate (* 275807/195025 275807/195025))) #f)
(test (= (truncate (* 131836323/93222358 131836323/93222358 1.0)) (truncate (* 318281039/225058681 318281039/225058681))) #f)
(test (= (truncate (* 1393/985 1393/985 1.0)) (truncate (* 3363/2378 3363/2378))) #f)
(test (= (truncate (* 1607521/1136689 1607521/1136689 1.0)) (truncate (* 3880899/2744210 3880899/2744210))) #f)
(if with-bignums (test (= (truncate (* 1855077841/1311738121 1855077841/1311738121 1.0)) (truncate (* 4478554083/3166815962 4478554083/3166815962))) #f))
(test (= (truncate (* 19601/13860 19601/13860 1.0)) (truncate (* 47321/33461 47321/33461))) #f)
(test (= (truncate (* 275807/195025 275807/195025 1.0)) (truncate (* 1607521/1136689 1607521/1136689))) #t)
(if with-bignums (test (= (truncate (* 318281039/225058681 318281039/225058681 1.0)) (truncate (* 1855077841/1311738121 1855077841/1311738121))) #t))
(test (= (truncate (* 3363/2378 3363/2378 1.0)) (truncate (* 19601/13860 19601/13860))) #t)
(test (= (truncate (* 3880899/2744210 3880899/2744210 1.0)) (truncate (* 9369319/6625109 9369319/6625109))) #f)
(test (= (truncate (* 47321/33461 47321/33461 1.0)) (truncate (* 114243/80782 114243/80782))) #f)
(test (= (truncate (* 54608393/38613965 54608393/38613965 1.0)) (truncate (* 131836323/93222358 131836323/93222358))) #f)
(test (= (truncate (* 9369319/6625109 9369319/6625109 1.0)) (truncate (* 54608393/38613965 54608393/38613965))) #t)

(when with-bignums
  (num-test (truncate (+ (expt 2.0 62) 512)) 4611686018427388416)
  (num-test (truncate (+ (expt 2.0 62) 513)) 4611686018427388417)
  (num-test (truncate (exact->inexact most-negative-fixnum)) most-negative-fixnum)
  (test (truncate (exact->inexact most-positive-fixnum)) most-positive-fixnum)
  
  (num-test (truncate 1e19) 10000000000000000000)
  (num-test (truncate 1e32) 100000000000000000000000000000000)
  (num-test (truncate -1e19) -10000000000000000000)
  (num-test (truncate -1e32) -100000000000000000000000000000000)
  (num-test (truncate 100000000000000000000000000000000/3) 33333333333333333333333333333333)
  (num-test (truncate -100000000000000000000000000000000/3) -33333333333333333333333333333333)
  (num-test (truncate 200000000000000000000000000000000/3) 66666666666666666666666666666666)
  (num-test (truncate -200000000000000000000000000000000/3) -66666666666666666666666666666666)
  
  (let-temporarily (((*s7* 'bignum-precision) 512))
    (test (= (truncate (* 111760107268250945908601/79026329715516201199301 111760107268250945908601/79026329715516201199301 1.0)) 
	     (truncate (* 269812766699283348307203/190786436983767147107902 269812766699283348307203/190786436983767147107902))) #f)
    (test (= (truncate (* 1180872205318713601/835002744095575440 1180872205318713601/835002744095575440 1.0)) 
	     (truncate (* 2850877693509864481/2015874949414289041 2850877693509864481/2015874949414289041))) #f)
    (test (= (truncate (* 1362725501650887306817/963592443113182178088 1362725501650887306817/963592443113182178088 1.0)) 
	     (truncate (* 3289910387877251662993/2326317944764069484905 3289910387877251662993/2326317944764069484905))) #f)
    (test (= (truncate (* 14398739476117879/10181446324101389 14398739476117879/10181446324101389 1.0)) 
	     (truncate (* 34761632124320657/24580185800219268 34761632124320657/24580185800219268))) #f)
    (test (= (truncate (* 1572584048032918633353217/1111984844349868137938112 1572584048032918633353217/1111984844349868137938112 1.0)) 
	     (truncate (* 3796553736732654909229441/2684568892382786771291329 3796553736732654909229441/2684568892382786771291329))) #f)
    (test (= (truncate (* 16616132878186749607/11749380235262596085 16616132878186749607/11749380235262596085 1.0)) 
	     (truncate (* 40114893348711941777/28365513113449345692 40114893348711941777/28365513113449345692))) #f)
    (test (= (truncate (* 19175002942688032928599/13558774610046711780701 19175002942688032928599/13558774610046711780701 1.0)) 
	     (truncate (* 46292552162781456490001/32733777552734744709300 46292552162781456490001/32733777552734744709300))) #f)
    (test (= (truncate (* 202605639573839043/143263821649299118 202605639573839043/143263821649299118 1.0)) 
	     (truncate (* 489133282872437279/345869461223138161 489133282872437279/345869461223138161))) #f)
    (test (= (truncate (* 269812766699283348307203/190786436983767147107902 269812766699283348307203/190786436983767147107902 1.0)) 
	     (truncate (* 1572584048032918633353217/1111984844349868137938112 1572584048032918633353217/1111984844349868137938112))) #t)
    (test (= (truncate (* 2850877693509864481/2015874949414289041 2850877693509864481/2015874949414289041 1.0)) 
	     (truncate (* 16616132878186749607/11749380235262596085 16616132878186749607/11749380235262596085))) #t)
    (test (= (truncate (* 3289910387877251662993/2326317944764069484905 3289910387877251662993/2326317944764069484905 1.0)) 
	     (truncate (* 19175002942688032928599/13558774610046711780701 19175002942688032928599/13558774610046711780701))) #t)
    (test (= (truncate (* 34761632124320657/24580185800219268 34761632124320657/24580185800219268 1.0)) 
	     (truncate (* 202605639573839043/143263821649299118 202605639573839043/143263821649299118))) #t)
    (test (= (truncate (* 46292552162781456490001/32733777552734744709300 46292552162781456490001/32733777552734744709300 1.0)) 
	     (truncate (* 111760107268250945908601/79026329715516201199301 111760107268250945908601/79026329715516201199301))) #f)
    (test (= (truncate (* 489133282872437279/345869461223138161 489133282872437279/345869461223138161 1.0)) 
	     (truncate (* 1180872205318713601/835002744095575440 1180872205318713601/835002744095575440))) #f)
    (test (= (truncate (* 564459384575477049359/399133058537705128729 564459384575477049359/399133058537705128729 1.0)) 
	     (truncate (* 1362725501650887306817/963592443113182178088 1362725501650887306817/963592443113182178088))) #f)
    (test (= (truncate (* 5964153172084899/4217293152016490 5964153172084899/4217293152016490 1.0)) 
	     (truncate (* 14398739476117879/10181446324101389 14398739476117879/10181446324101389))) #f)))

(test (truncate) 'error)
(test (truncate 1.23+1.0i) 'error)

(for-each
 (lambda (arg)
   (test (truncate arg) 'error))
  (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
        #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))
 



;;; --------------------------------------------------------------------------------
;;; floor
;;; --------------------------------------------------------------------------------

(num-test (floor (+ 1 (expt 2 30))) 1073741825)
(num-test (floor (- (+ 1 -1/123400000))) -1)
(num-test (floor (- 1 1/123400000)) 0)
(num-test (floor (/ (- most-positive-fixnum 1) most-positive-fixnum)) 0)
(num-test (floor (/ -1 most-positive-fixnum)) -1)
(num-test (floor (/ 1 most-positive-fixnum)) 0)
(num-test (floor (/ most-negative-fixnum most-positive-fixnum)) -2)
(num-test (floor -0) 0)
(num-test (floor -0.0) 0)
(num-test (floor -0.1) -1)
(num-test (floor -0.9) -1)
(num-test (floor -1) -1)
(num-test (floor -1.1) -2)
(num-test (floor -1.9) -2)
(num-test (floor -1/10) -1)
(num-test (floor -1/123400000) -1)
(num-test (floor -1/2) -1)
(num-test (floor -100/3) -34)
(num-test (floor -11/10) -2)
(num-test (floor -17/2) -9)
(num-test (floor -19/10) -2)
(num-test (floor -2.225073858507201399999999999999999999996E-308) -1)
(num-test (floor -2/3) -1)
(num-test (floor -200/3) -67)
(num-test (floor -3/2) -2)
(num-test (floor -9/10) -1)
(num-test (floor -9223372036854775808) -9223372036854775808)
(num-test (floor 0) 0)
(num-test (floor 0.0) 0)
(num-test (floor 0.1) 0)
(num-test (floor 0.9) 0)
(num-test (floor 1) 1)
(num-test (floor 1.0-00.i) 1)
(num-test (floor 1.1) 1)
(num-test (floor 1.110223024625156799999999999999999999997E-16) 0)
(num-test (floor 1.9) 1)
(num-test (floor 1/10) 0)
(num-test (floor 1/123400000) 0)
(num-test (floor 1/2) 0)
(num-test (floor 100/3) 33)
(num-test (floor 11/10) 1)
(num-test (floor 17.3) 17)
(num-test (floor 19) 19)
(num-test (floor 19/10) 1)
(num-test (floor 2.5) 2)
(num-test (floor 2.6) 2)
(num-test (floor 2/3) 0)
(num-test (floor 200/3) 66)
(num-test (floor 3/2) 1)
(num-test (floor 9/10) 0)
(num-test (floor 9223372036854775807) 9223372036854775807)
(num-test (floor most-negative-fixnum) most-negative-fixnum)
(num-test (floor most-positive-fixnum) most-positive-fixnum)

(num-test (floor (+ 0.7 8388608.0)) 8388608)

(if with-bignums 
    (begin
      (num-test (floor 8388608.9999999995) 8388608)
      (num-test (floor 8388607.9999999995) 8388607)
      (num-test (floor 8388608.0000000005) 8388608)
      (num-test (floor 9007199254740992.95) 9007199254740992)
      (num-test (floor 9007199254740990.95) 9007199254740990)
      (num-test (floor 9007199254740993.95) 9007199254740993)
      (num-test (floor (+ 0.995 (expt 2.0 46))) 70368744177664)
      (num-test (floor (+ 0.9995 (expt 2.0 45))) 35184372088832))
    (begin
      (test (floor 1e308) 'error)
      (test (floor 1e19) 'error)
      (test (floor -1e308) 'error)
      (test (floor -1e19) 'error)))

(test (= (floor (* 111738283365989051/177100989030047175 1.0)) (floor 130441933147714940/206745572560704147)) #t)
(test (= (floor (* 114243/80782 114243/80782 1.0)) (floor (* 275807/195025 275807/195025))) #f)
(test (= (floor (* 131836323/93222358 131836323/93222358 1.0)) (floor (* 318281039/225058681 318281039/225058681))) #f)
(test (= (floor (* 1393/985 1393/985 1.0)) (floor (* 3363/2378 3363/2378))) #f)
(test (= (floor (* 1607521/1136689 1607521/1136689 1.0)) (floor (* 3880899/2744210 3880899/2744210))) #f)
(if with-bignums (test (= (floor (* 1855077841/1311738121 1855077841/1311738121 1.0)) (floor (* 4478554083/3166815962 4478554083/3166815962))) #f))
(test (= (floor (* 19601/13860 19601/13860 1.0)) (floor (* 47321/33461 47321/33461))) #f)
(test (= (floor (* 275807/195025 275807/195025 1.0)) (floor (* 1607521/1136689 1607521/1136689))) #t)
(if with-bignums (test (= (floor (* 318281039/225058681 318281039/225058681 1.0)) (floor (* 1855077841/1311738121 1855077841/1311738121))) #t))
(test (= (floor (* 3363/2378 3363/2378 1.0)) (floor (* 19601/13860 19601/13860))) #t)
(test (= (floor (* 3880899/2744210 3880899/2744210 1.0)) (floor (* 9369319/6625109 9369319/6625109))) #f)
(test (= (floor (* 47321/33461 47321/33461 1.0)) (floor (* 114243/80782 114243/80782))) #f)
(test (= (floor (* 54608393/38613965 54608393/38613965 1.0)) (floor (* 131836323/93222358 131836323/93222358))) #f)
(test (= (floor (* 9369319/6625109 9369319/6625109 1.0)) (floor (* 54608393/38613965 54608393/38613965))) #t)

(when with-bignums 
  (num-test (floor (+ (expt 2.0 62) 512)) 4611686018427388416)
  (num-test (floor (+ (expt 2.0 62) 513)) 4611686018427388417)
  (num-test (floor (exact->inexact most-negative-fixnum)) most-negative-fixnum)
  (test (floor (exact->inexact most-positive-fixnum)) most-positive-fixnum)
  
  (num-test (floor 1e19) 10000000000000000000)
  (num-test (floor 1e32) 100000000000000000000000000000000)
  (num-test (floor -1e19) -10000000000000000000)
  (num-test (floor -1e32) -100000000000000000000000000000000)
  (num-test (floor 100000000000000000000000000000000/3) 33333333333333333333333333333333)
  (num-test (floor -100000000000000000000000000000000/3) -33333333333333333333333333333334)
  (num-test (floor 200000000000000000000000000000000/3) 66666666666666666666666666666666)
  (num-test (floor -200000000000000000000000000000000/3) -66666666666666666666666666666667)
  
  (test (= (floor (* 1180872205318713601/835002744095575440 1180872205318713601/835002744095575440 1.0)) 
	   (floor (* 2850877693509864481/2015874949414289041 2850877693509864481/2015874949414289041))) #f)
  (test (= (floor (* 1362725501650887306817/963592443113182178088 1362725501650887306817/963592443113182178088 1.0)) 
	   (floor (* 3289910387877251662993/2326317944764069484905 3289910387877251662993/2326317944764069484905))) #f)
  (test (= (floor (* 14398739476117879/10181446324101389 14398739476117879/10181446324101389 1.0)) 
	   (floor (* 34761632124320657/24580185800219268 34761632124320657/24580185800219268))) #f)
  (test (= (floor (* 202605639573839043/143263821649299118 202605639573839043/143263821649299118 1.0)) 
	   (floor (* 489133282872437279/345869461223138161 489133282872437279/345869461223138161))) #f)
  (test (= (floor (* 2850877693509864481/2015874949414289041 2850877693509864481/2015874949414289041 1.0)) 
	   (floor (* 16616132878186749607/11749380235262596085 16616132878186749607/11749380235262596085))) #t)
  (test (= (floor (* 34761632124320657/24580185800219268 34761632124320657/24580185800219268 1.0)) 
	   (floor (* 202605639573839043/143263821649299118 202605639573839043/143263821649299118))) #t)
  (test (= (floor (* 40114893348711941777/28365513113449345692 40114893348711941777/28365513113449345692 1.0)) 
	   (floor (* 96845919575610633161/68480406462161287469 96845919575610633161/68480406462161287469))) #f)
  (test (= (floor (* 46292552162781456490001/32733777552734744709300 46292552162781456490001/32733777552734744709300 1.0)) 
	   (floor (* 111760107268250945908601/79026329715516201199301 111760107268250945908601/79026329715516201199301))) #f)
  (test (= (floor (* 489133282872437279/345869461223138161 489133282872437279/345869461223138161 1.0)) 
	   (floor (* 1180872205318713601/835002744095575440 1180872205318713601/835002744095575440))) #f)
  (test (= (floor (* 5964153172084899/4217293152016490 5964153172084899/4217293152016490 1.0)) 
	   (floor (* 14398739476117879/10181446324101389 14398739476117879/10181446324101389))) #f))

(let ((val1 (catch #t (lambda () (floor 0.0)) (lambda args 'error)))
      (val2 (catch #t (lambda () (floor -0.0)) (lambda args 'error))))
  (test (equal? val1 val2) #t))

(test (floor) 'error)
(test (floor 1.23+1.0i) 'error)
(test (floor 1.23 1.23) 'error)

(let ()
  (define (f1 x) (floor (/ x 3)))
  (test (f1 6) 2)
  (test (f1 7) 2)
  (test (f1 7.3) 2))

(for-each
 (lambda (arg)
   (test (floor arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))

(test (let () (define (func) (do ((i 0 (+ i 1))) ((= i 1)) (floor (atanh (logand))))) (define (hi) (func)) (hi)) 'error) ; floor_i_p real arg case



;;; --------------------------------------------------------------------------------
;;; ceiling
;;; --------------------------------------------------------------------------------

(num-test (ceiling (- (+ 1 -1/123400000))) 0)
(num-test (ceiling (- 1 1/123400000)) 1)
(num-test (ceiling (/ (- most-positive-fixnum 1) most-positive-fixnum)) 1)
(num-test (ceiling (/ -1 most-positive-fixnum)) 0)
(num-test (ceiling (/ 1 most-positive-fixnum)) 1)
(num-test (ceiling (/ most-negative-fixnum most-positive-fixnum)) -1)
(num-test (ceiling (/ most-positive-fixnum (- most-positive-fixnum 1))) 2)
(num-test (ceiling -.0001) 0)
(num-test (ceiling -0) 0)
(num-test (ceiling -0.0) 0)
(num-test (ceiling -0.1) 0)
(num-test (ceiling -0.9) 0)
(num-test (ceiling -1) -1)
(num-test (ceiling -1.1) -1)
(num-test (ceiling -1.9) -1)
(num-test (ceiling -1/10) 0)
(num-test (ceiling -1/123400000) 0)
(num-test (ceiling -1/2) 0)
(num-test (ceiling -100/3) -33)
(num-test (ceiling -11/10) -1)
(num-test (ceiling -17/2) -8)
(num-test (ceiling -19/10) -1)
(num-test (ceiling -2.225073858507201399999999999999999999996E-308) 0)
(num-test (ceiling -2/3) 0)
(num-test (ceiling -200/3) -66)
(num-test (ceiling -2147483647.8) -2147483647)
(num-test (ceiling -3/2) -1)
(num-test (ceiling -9/10) 0)
(num-test (ceiling -9223372036854775808) -9223372036854775808)
(num-test (ceiling .0001) 1)
(num-test (ceiling 0) 0)
(num-test (ceiling 0.0) 0)
(num-test (ceiling 0.1) 1)
(num-test (ceiling 0.9) 1)
(num-test (ceiling 1) 1)
(num-test (ceiling 1.01e-123) 1)
(num-test (ceiling 1.1) 2)
(num-test (ceiling 1.110223024625156799999999999999999999997E-16) 1)
(num-test (ceiling 1.9) 2)
(num-test (ceiling 1/10) 1)
(num-test (ceiling 1/123400000) 1)
(num-test (ceiling 1/2) 1)
(num-test (ceiling 100/3) 34)
(num-test (ceiling 11/10) 2)
(num-test (ceiling 17.3) 18)
(num-test (ceiling 19) 19)
(num-test (ceiling 19/10) 2)
(num-test (ceiling 2.4) 3)
(num-test (ceiling 2.5) 3)
(num-test (ceiling 2.6) 3)
(num-test (ceiling 2/3) 1)
(num-test (ceiling 200/3) 67)
(num-test (ceiling 2147483646.8) 2147483647)
(num-test (ceiling 3/2) 2)
(num-test (ceiling 9/10) 1)
(num-test (ceiling 9223372036854775807) 9223372036854775807)
(num-test (ceiling most-negative-fixnum) most-negative-fixnum)
(num-test (ceiling most-positive-fixnum) most-positive-fixnum)
(num-test (ceiling 8922337203685477.9) 8922337203685478)

(if with-bignums
    (begin
      (num-test (ceiling 8388608.0000000005) 8388609)
      (num-test (ceiling 8388609.0000000005) 8388610)
      (num-test (ceiling 8388607.9999999995) 8388608)
      (num-test (ceiling 9223372036854775806.9) 9223372036854775807))
    (begin
      (test (ceiling 1e308) 'error)
      (test (ceiling 1e19) 'error)
      (test (ceiling -1e308) 'error)
      (test (ceiling -1e19) 'error)

      ;; but unfortunately (ceiling 9223372036854775806.9) => -9223372036854775808
      ;;                   (ceiling 922337203685477580.9)  => 922337203685477632
      ;;                   (ceiling 9223372036854770.9)    => 9223372036854770
      ))

(test (= (ceiling (* 111738283365989051/177100989030047175 1.0)) (ceiling 130441933147714940/206745572560704147)) #t)
(test (= (ceiling (* 114243/80782 114243/80782 1.0)) (ceiling (* 275807/195025 275807/195025))) #f)
(if with-bignums (test (= (ceiling (* 131836323/93222358 131836323/93222358 1.0)) (ceiling (* 318281039/225058681 318281039/225058681))) #f))
(test (= (ceiling (* 1393/985 1393/985 1.0)) (ceiling (* 3363/2378 3363/2378))) #f)
(test (= (ceiling (* 1607521/1136689 1607521/1136689 1.0)) (ceiling (* 3880899/2744210 3880899/2744210))) #f)
(if with-bignums (test (= (ceiling (* 1855077841/1311738121 1855077841/1311738121 1.0)) (ceiling (* 4478554083/3166815962 4478554083/3166815962))) #f))
(test (= (ceiling (* 19601/13860 19601/13860 1.0)) (ceiling (* 47321/33461 47321/33461))) #f)
(test (= (ceiling (* 275807/195025 275807/195025 1.0)) (ceiling (* 1607521/1136689 1607521/1136689))) #t)
(test (= (ceiling (* 318281039/225058681 318281039/225058681 1.0)) (ceiling (* 1855077841/1311738121 1855077841/1311738121))) #t)
(test (= (ceiling (* 3363/2378 3363/2378 1.0)) (ceiling (* 19601/13860 19601/13860))) #t)
(test (= (ceiling (* 3880899/2744210 3880899/2744210 1.0)) (ceiling (* 9369319/6625109 9369319/6625109))) #f)
(test (= (ceiling (* 47321/33461 47321/33461 1.0)) (ceiling (* 114243/80782 114243/80782))) #f)
(test (= (ceiling (* 54608393/38613965 54608393/38613965 1.0)) (ceiling (* 131836323/93222358 131836323/93222358))) #f)
(test (= (ceiling (* 9369319/6625109 9369319/6625109 1.0)) (ceiling (* 54608393/38613965 54608393/38613965))) #t)

(when with-bignums
  (num-test (ceiling (+ (expt 2.0 62) 512)) 4611686018427388416)
  (num-test (ceiling (+ (expt 2.0 62) 513)) 4611686018427388417)
  (num-test (ceiling (exact->inexact most-negative-fixnum)) most-negative-fixnum)
  (test (ceiling (exact->inexact most-positive-fixnum)) most-positive-fixnum)
  (num-test (ceiling 123456789012345678901234567890.1) 123456789012345678901234567891)
  (num-test (ceiling -123456789012345678901234567890.1) -123456789012345678901234567890)
  
  (num-test (ceiling  9223372036854775806.7)  9223372036854775807)
  (num-test (ceiling -9223372036854775807.9) -9223372036854775807)
  (num-test (ceiling -1e19) -10000000000000000000)
  (num-test (ceiling -1e32) -100000000000000000000000000000000)
  (num-test (ceiling 100000000000000000000000000000000/3) 33333333333333333333333333333334)
  (num-test (ceiling -100000000000000000000000000000000/3) -33333333333333333333333333333333)
  (num-test (ceiling 200000000000000000000000000000000/3) 66666666666666666666666666666667)
  (num-test (ceiling -200000000000000000000000000000000/3) -66666666666666666666666666666666)
  
  (test (= (ceiling (* 1180872205318713601/835002744095575440 1180872205318713601/835002744095575440 1.0)) 
	   (ceiling (* 2850877693509864481/2015874949414289041 2850877693509864481/2015874949414289041))) #f)
  
  ;;      (test (= (ceiling (* 1362725501650887306817/963592443113182178088 1362725501650887306817/963592443113182178088 1.0)) 
  ;;	       (ceiling (* 3289910387877251662993/2326317944764069484905 3289910387877251662993/2326317944764069484905))) #f)
  ;; this requires much more precision (2048 bits)
  (test (= (ceiling (* 1362725501650887306817/963592443113182178088 1362725501650887306817/963592443113182178088)) 
	   (ceiling (* 3289910387877251662993/2326317944764069484905 3289910387877251662993/2326317944764069484905))) #f)
  
  (test (= (ceiling (* 14398739476117879/10181446324101389 14398739476117879/10181446324101389 1.0)) 
	   (ceiling (* 34761632124320657/24580185800219268 34761632124320657/24580185800219268))) #f)
  (test (= (ceiling (* 16616132878186749607/11749380235262596085 16616132878186749607/11749380235262596085 1.0)) 
	   (ceiling (* 40114893348711941777/28365513113449345692 40114893348711941777/28365513113449345692))) #f)
  (test (= (ceiling (* 19175002942688032928599/13558774610046711780701 19175002942688032928599/13558774610046711780701 1.0)) 
	   (ceiling (* 46292552162781456490001/32733777552734744709300 46292552162781456490001/32733777552734744709300))) #f)
  (test (= (ceiling (* 202605639573839043/143263821649299118 202605639573839043/143263821649299118 1.0)) 
	   (ceiling (* 489133282872437279/345869461223138161 489133282872437279/345869461223138161))) #f)
  (test (= (ceiling (* 2850877693509864481/2015874949414289041 2850877693509864481/2015874949414289041 1.0)) 
	   (ceiling (* 16616132878186749607/11749380235262596085 16616132878186749607/11749380235262596085))) #t)
  (test (= (ceiling (* 34761632124320657/24580185800219268 34761632124320657/24580185800219268 1.0)) 
	   (ceiling (* 202605639573839043/143263821649299118 202605639573839043/143263821649299118))) #t)
  (test (= (ceiling (* 489133282872437279/345869461223138161 489133282872437279/345869461223138161 1.0)) 
	   (ceiling (* 1180872205318713601/835002744095575440 1180872205318713601/835002744095575440))) #f)
  (test (= (ceiling (* 564459384575477049359/399133058537705128729 564459384575477049359/399133058537705128729 1.0)) 
	   (ceiling (* 1362725501650887306817/963592443113182178088 1362725501650887306817/963592443113182178088))) #f)
  (test (= (ceiling (* 5964153172084899/4217293152016490 5964153172084899/4217293152016490 1.0)) 
	   (ceiling (* 14398739476117879/10181446324101389 14398739476117879/10181446324101389))) #f)
  (test (= (ceiling (* 96845919575610633161/68480406462161287469 96845919575610633161/68480406462161287469 1.0)) 
	   (ceiling (* 564459384575477049359/399133058537705128729 564459384575477049359/399133058537705128729))) #t))

(let ((val1 (catch #t (lambda () (ceiling 0.0)) (lambda args 'error)))
      (val2 (catch #t (lambda () (ceiling -0.0)) (lambda args 'error))))
  (test (equal? val1 val2) #t))

(test (ceiling) 'error)
(test (ceiling 1.23+1.0i) 'error)
(test (ceiling 1.23 1.23) 'error)

(for-each
 (lambda (arg)
   (test (ceiling arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))

(test (let () (define (func) (do ((i 0 (+ i 1))) ((= i 1)) (ceiling (atanh (logand))))) (define (hi) (func)) (hi)) 'error)



;;; --------------------------------------------------------------------------------
;;; round
;;; --------------------------------------------------------------------------------

(num-test (round (- (+ 1 -1/123400000))) -1)
(num-test (round (- 1 1/123400000)) 1)
(num-test (round (/ (- most-positive-fixnum 1) most-positive-fixnum)) 1)
(num-test (round (/ -1 most-positive-fixnum)) 0)
(num-test (round (/ 1 most-positive-fixnum)) 0)
(num-test (round (/ most-negative-fixnum most-positive-fixnum)) -1)
(num-test (round -0) 0)
(num-test (round -0.0) 0)
(num-test (round -0.1) 0)
(num-test (round -0.9) -1)
(num-test (round -1) -1)
(num-test (round -1.1) -1)
(num-test (round -1.9) -2)
(num-test (round -1/10) 0)
(num-test (round -1/123400000) 0)
(num-test (round -1/2) 0)
(num-test (round -100/3) -33)
(num-test (round -11/10) -1)
(num-test (round -17/2) -8)
(num-test (round -19/10) -2)
(num-test (round -2.225073858507201399999999999999999999996E-308) 0)
(num-test (round -2/3) -1)
(num-test (round -200/3) -67)
(num-test (round -3/2) -2)
(num-test (round -9/10) -1)
(num-test (round -9223372036854775808) -9223372036854775808)
(num-test (round 0) 0)
(num-test (round 0.0) 0)
(num-test (round 0.1) 0)
(num-test (round 0.9) 1)
(num-test (round 1) 1)
(num-test (round 1.1) 1)
(num-test (round 1.110223024625156799999999999999999999997E-16) 0)
(num-test (round 1.9) 2)
(num-test (round 1/10) 0)
(num-test (round 1/123400000) 0)
(num-test (round 1/2) 0)
(num-test (round 100/3) 33)
(num-test (round 11/10) 1)
(num-test (round 17.3) 17)
(num-test (round 19) 19)
(num-test (round 19/10) 2)
(num-test (round 2.4) 2)
(num-test (round 2.5) 2)
(num-test (round 2.5) 2)
(num-test (round 2.6) 3)
(num-test (round 2/3) 1)
(num-test (round 200/3) 67)
(num-test (round 3.5) 4)
(num-test (round 3/2) 2)
(num-test (round 9/10) 1)
(num-test (round 9223372036854775807) 9223372036854775807)
(num-test (round most-negative-fixnum) most-negative-fixnum)
(num-test (round most-positive-fixnum) most-positive-fixnum)

(num-test (round (+ 8388608 .1)) 8388608)
(num-test (round (+ 8388608 .9)) 8388609)
(num-test (round (- 8388608 .1)) 8388608)
(num-test (round (- 8388608 .9)) 8388607)

(num-test (round 9007199254740990.501) 9007199254740991)
(num-test (round 9007199254740990.499) 9007199254740990)

(if with-bignums
    (begin
      (num-test (round 9007199254740992.51) 9007199254740993)
      (num-test (round 9007199254740993.99) 9007199254740994))
    (begin
      (test (round 1e308) 'error)
      (test (round 1e19) 'error)
      (test (round -1e308) 'error)
      (test (round -1e19) 'error)))

(test (= (round (* 111738283365989051/177100989030047175 1.0)) (round 130441933147714940/206745572560704147)) #t)
(test (= (round (* 114243/80782 114243/80782 1.0)) (round (* 275807/195025 275807/195025))) #t)
(test (= (round (* 131836323/93222358 131836323/93222358 1.0)) (round (* 318281039/225058681 318281039/225058681))) #t)
(test (= (round (* 1393/985 1393/985 1.0)) (round (* 3363/2378 3363/2378))) #t)
(test (= (round (* 1607521/1136689 1607521/1136689 1.0)) (round (* 3880899/2744210 3880899/2744210))) #t)
(if (provided? 'overflow-checks) 
    (test (= (round (* 1855077841/1311738121 1855077841/1311738121 1.0)) (round (* 4478554083/3166815962 4478554083/3166815962))) #t))
(test (= (round (* 19601/13860 19601/13860 1.0)) (round (* 47321/33461 47321/33461))) #t)
(test (= (round (* 275807/195025 275807/195025 1.0)) (round (* 1607521/1136689 1607521/1136689))) #t)
(test (= (round (* 318281039/225058681 318281039/225058681 1.0)) (round (* 1855077841/1311738121 1855077841/1311738121))) #t)
(test (= (round (* 3363/2378 3363/2378 1.0)) (round (* 19601/13860 19601/13860))) #t)
(test (= (round (* 3880899/2744210 3880899/2744210 1.0)) (round (* 9369319/6625109 9369319/6625109))) #t)
(test (= (round (* 47321/33461 47321/33461 1.0)) (round (* 114243/80782 114243/80782))) #t)
(test (= (round (* 54608393/38613965 54608393/38613965 1.0)) (round (* 131836323/93222358 131836323/93222358))) #t)
(test (= (round (* 9369319/6625109 9369319/6625109 1.0)) (round (* 54608393/38613965 54608393/38613965))) #t)

(test (round 1.23 1.23) 'error)
(test (round 1.23+1.0i) 'error)
(test (round) 'error)

(for-each
 (lambda (arg)
   (test (round arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))

(num-test (round 400000000000000000/800000000000000001) 0)
(num-test (round 400000000000000000/800000000000000000) 0)
(num-test (round 400000000000000000/799999999999999999) 1)

(when with-bignums
  (num-test (round (+ (expt 2.0 62) 512)) 4611686018427388416)
  (num-test (round (+ (expt 2.0 62) 513)) 4611686018427388417)
  (num-test (round (exact->inexact most-negative-fixnum)) most-negative-fixnum)
  (test (round (exact->inexact most-positive-fixnum)) most-positive-fixnum)
  
  (num-test (round -1e19) -10000000000000000000)
  (num-test (round -1e32) -100000000000000000000000000000000)
  (num-test (round 100000000000000000000000000000000/3) 33333333333333333333333333333333)
  (num-test (round -100000000000000000000000000000000/3) -33333333333333333333333333333333)
  (num-test (round 200000000000000000000000000000000/3) 66666666666666666666666666666667)
  (num-test (round -200000000000000000000000000000000/3) -66666666666666666666666666666667)
  
  (test (= (round (* 1180872205318713601/835002744095575440 1180872205318713601/835002744095575440 1.0)) 
	   (round (* 2850877693509864481/2015874949414289041 2850877693509864481/2015874949414289041))) #t)
  (test (= (round (* 1362725501650887306817/963592443113182178088 1362725501650887306817/963592443113182178088 1.0)) 
	   (round (* 3289910387877251662993/2326317944764069484905 3289910387877251662993/2326317944764069484905))) #t)
  (test (= (round (* 14398739476117879/10181446324101389 14398739476117879/10181446324101389 1.0)) 
	   (round (* 34761632124320657/24580185800219268 34761632124320657/24580185800219268))) #t)
  (test (= (round (* 16616132878186749607/11749380235262596085 16616132878186749607/11749380235262596085 1.0)) 
	   (round (* 40114893348711941777/28365513113449345692 40114893348711941777/28365513113449345692))) #t)
  (test (= (round (* 202605639573839043/143263821649299118 202605639573839043/143263821649299118 1.0)) 
	   (round (* 489133282872437279/345869461223138161 489133282872437279/345869461223138161))) #t)
  (test (= (round (* 2850877693509864481/2015874949414289041 2850877693509864481/2015874949414289041 1.0)) 
	   (round (* 16616132878186749607/11749380235262596085 16616132878186749607/11749380235262596085))) #t)
  (test (= (round (* 34761632124320657/24580185800219268 34761632124320657/24580185800219268 1.0)) 
	   (round (* 202605639573839043/143263821649299118 202605639573839043/143263821649299118))) #t)
  (test (= (round (* 40114893348711941777/28365513113449345692 40114893348711941777/28365513113449345692 1.0)) 
	   (round (* 96845919575610633161/68480406462161287469 96845919575610633161/68480406462161287469))) #t)
  (test (= (round (* 489133282872437279/345869461223138161 489133282872437279/345869461223138161 1.0)) 
	   (round (* 1180872205318713601/835002744095575440 1180872205318713601/835002744095575440))) #t)
  (test (= (round (* 5964153172084899/4217293152016490 5964153172084899/4217293152016490 1.0)) 
	   (round (* 14398739476117879/10181446324101389 14398739476117879/10181446324101389))) #t)
  (test (= (round (* 96845919575610633161/68480406462161287469 96845919575610633161/68480406462161287469 1.0)) 
	   (round (* 564459384575477049359/399133058537705128729 564459384575477049359/399133058537705128729))) #t))

(test (equal? (let ((vals ())) 
		(do ((k 1/3 (+ k 1/3))) ((> k 2) (reverse vals)) 
		  (set! vals (cons (round k) vals)))) 
	      (list 0 1 1 1 2 2)) 
      #t)
(test (equal? (let ((vals ())) 
		(do ((k 1/3 (+ k 1/3))) ((> k 2) (reverse vals)) 
		  (set! vals (cons (round (- k)) vals)))) 
	      (list 0 -1 -1 -1 -2 -2)) 
      #t)
(test (equal? (let ((vals ())) 
		(do ((k 1/2 (+ k 1/2))) ((> k 3) (reverse vals)) 
		  (set! vals (cons (round k) vals)))) 
	      (list 0 1 2 2 2 3)) 
      #t)
(test (equal? (let ((vals ())) 
		(do ((k 1/2 (+ k 1/2))) ((> k 3) (reverse vals))
		  (set! vals (cons (round (- k)) vals))))
	      (list 0 -1 -2 -2 -2 -3)) 
      #t)

(let ((top-exp 60))
  (if with-bignums 
      (set! top-exp 150))
  
  (let ((happy #t))
    (do ((i 2 (+ i 1)))
	((or (not happy) (> i top-exp)))
      (let* ((val1 (/ (- (expt 2 i) 1) 2))
	     (val2 (expt 2 (- i 1)))
	     (fv (floor val1))
	     (rv (round val1))
	     (cv (ceiling val1))
	     (tv (truncate val1)))
	(if (not (= fv (- val2 1)))
	    (begin (set! happy #f) (format #t ";(floor ~S) = ~S?~%" val1 fv)))
	(if (not (= cv val2))
	    (begin (set! happy #f) (format #t ";(ceiling ~S) = ~S?~%" val1 cv)))
	(if (not (= tv (- val2 1)))
	    (begin (set! happy #f) (format #t ";(truncate ~S) = ~S?~%" val1 tv)))
	(if (not (= rv val2))
	    (begin (set! happy #f) (format #t ";(round ~S) = ~S?~%" val1 rv))))))
  
  (let ((happy #t))
    (do ((i 2 (+ i 1)))
	((or (not happy) (> i top-exp)))
      (let* ((val1 (/ (+ (expt 2 i) 1) 2))
	     (val2 (expt 2 (- i 1)))
	     (fv (floor val1))
	     (rv (round val1))
	     (cv (ceiling val1))
	     (tv (truncate val1)))
	(if (not (= fv val2))
	    (begin (set! happy #f) (format #t ";(floor ~S) = ~S?~%" val1 fv)))
	(if (not (= cv (+ val2 1)))
	    (begin (set! happy #f) (format #t ";(ceiling ~S) = ~S?~%" val1 cv)))
	(if (not (= tv val2))
	    (begin (set! happy #f) (format #t ";(truncate ~S) = ~S?~%" val1 tv)))
	(if (not (= rv val2))
	    (begin (set! happy #f) (format #t ";(round ~S) = ~S?~%" val1 rv))))))
  
  (let ((happy #t))
    (do ((i 2 (+ i 1)))
	((or (not happy) (> i top-exp)))
      (let* ((val1 (expt 2 i))
	     (val2 (- val1 1)))
	(if (= (floor val1) (floor val2))
	    (begin (set! happy #f) (format #t ";(floor ~S) = (floor ~S)?~%" val1 val2)))
	(if (= (ceiling val1) (ceiling val2))
	    (begin (set! happy #f) (format #t ";(ceiling ~S) = (ceiling ~S)?~%" val1 val2)))
	(if (= (truncate val1) (truncate val2))
	    (begin (set! happy #f) (format #t ";(truncate ~S) = (truncate ~S)?~%" val1 val2)))
	(if (= (round val1) (round val2))
	    (begin (set! happy #f) (format #t ";(round ~S) = (round ~S)?~%" val1 val2))))))
  
  (let ((happy #t))
    (do ((i 2 (+ i 1)))
	((or (not happy) (> i top-exp)))
      (let* ((val1 (/ (- (expt 2 i) 1) 2))
	     (val2 (/ (- (expt 2 i) 3) 2)))
	(if (= (floor val1) (floor val2))
	    (begin (set! happy #f) (format #t ";(floor ~S) = (floor ~S)?~%" val1 val2)))
	(if (= (ceiling val1) (ceiling val2))
	    (begin (set! happy #f) (format #t ";(ceiling ~S) = (ceiling ~S)?~%" val1 val2)))
	(if (= (truncate val1) (truncate val2))
	    (begin (set! happy #f) (format #t ";(truncate ~S) = (truncate ~S)?~%" val1 val2)))
	(if (= (round val1) (round val2))
	    (begin (set! happy #f) (format #t ";(round ~S) = (round ~S)?~%" val1 val2))))))
  
  (let ((happy #t)
	(off-by 1/3))
    (do ((i 2 (+ i 1)))
	((or (not happy) (>= i top-exp)))
      (let* ((val1 (/ (expt 2 i) 3))
	     (fv (floor val1))
	     (cv (ceiling val1))
	     (tv (truncate val1))
	     (rv (round val1)))
	(if (not (= fv (- val1 off-by)))
	    (begin (set! happy #f) (format #t ";(floor ~S) = ~S?~%" val1 fv)))
	(if (not (= cv (+ val1 (- 1 off-by))))
	    (begin (set! happy #f) (format #t ";(ceiling ~S) = ~S?~%" val1 cv)))
	(if (not (= tv (- val1 off-by)))
	    (begin (set! happy #f) (format #t ";(truncate ~S) = ~S?~%" val1 tv)))
	(if (= off-by 1/3)
	    (if (not (= rv (- val1 off-by)))
		(begin (set! happy #f) (format #t ";(round ~S) = ~S?~%" val1 rv)))
	    (if (not (= rv (+ val1 (- 1 off-by))))
		(begin (set! happy #f) (format #t ";(round ~S) = ~S?~%" val1 rv))))
	(if (= off-by 1/3)
	    (set! off-by 2/3)
	    (set! off-by 1/3)))))
  
  (let ((happy #t))
    (do ((i 2 (+ i 1)))
	((or (not happy) (> i top-exp)))
      (let* ((val1 (- (/ (- (expt 2 i) 1) 2)))
	     (val2 (- (expt 2 (- i 1))))
	     (fv (floor val1))
	     (rv (round val1))
	     (cv (ceiling val1))
	     (tv (truncate val1)))
	(if (not (= fv val2))
	    (begin (set! happy #f) (format #t ";(floor ~S) = ~S?~%" val1 fv)))
	(if (not (= cv (+ val2 1)))
	    (begin (set! happy #f) (format #t ";(ceiling ~S) = ~S?~%" val1 cv)))
	(if (not (= tv (+ val2 1)))
	    (begin (set! happy #f) (format #t ";(truncate ~S) = ~S?~%" val1 tv)))
	(if (not (= rv val2))
	    (begin (set! happy #f) (format #t ";(round ~S) = ~S?~%" val1 rv))))))
  
  (let ((happy #t))
    (do ((i 2 (+ i 1)))
	((or (not happy) (> i top-exp)))
      (let* ((val1 (- (/ (+ (expt 2 i) 1) 2)))
	     (val2 (- (expt 2 (- i 1))))
	     (fv (floor val1))
	     (rv (round val1))
	     (cv (ceiling val1))
	     (tv (truncate val1)))
	(if (not (= fv (- val2 1)))
	    (begin (set! happy #f) (format #t ";(floor ~S) = ~S?~%" val1 fv)))
	(if (not (= cv val2))
	    (begin (set! happy #f) (format #t ";(ceiling ~S) = ~S?~%" val1 cv)))
	(if (not (= tv val2))
	    (begin (set! happy #f) (format #t ";(truncate ~S) = ~S?~%" val1 tv)))
	(if (not (= rv val2))
	    (begin (set! happy #f) (format #t ";(round ~S) = ~S?~%" val1 rv))))))
  
  (let ((happy #t))
    (do ((i 2 (+ i 1)))
	((or (not happy) (> i top-exp)))
      (let* ((val1 (- (expt 2 i)))
	     (val2 (+ val1 1)))
	(if (= (floor val1) (floor val2))
	    (begin (set! happy #f) (format #t ";(floor ~S) = (floor ~S)?~%" val1 val2)))
	(if (= (ceiling val1) (ceiling val2))
	    (begin (set! happy #f) (format #t ";(ceiling ~S) = (ceiling ~S)?~%" val1 val2)))
	(if (= (truncate val1) (truncate val2))
	    (begin (set! happy #f) (format #t ";(truncate ~S) = (truncate ~S)?~%" val1 val2)))
	(if (= (round val1) (round val2))
	    (begin (set! happy #f) (format #t ";(round ~S) = (round ~S)?~%" val1 val2))))))
  
  (let ((happy #t))
    (do ((i 2 (+ i 1)))
	((or (not happy) (> i top-exp)))
      (let* ((val1 (- (/ (- (expt 2 i) 1) 2)))
	     (val2 (- (/ (- (expt 2 i) 3) 2))))
	(if (= (floor val1) (floor val2))
	    (begin (set! happy #f) (format #t ";(floor ~S) = (floor ~S)?~%" val1 val2)))
	(if (= (ceiling val1) (ceiling val2))
	    (begin (set! happy #f) (format #t ";(ceiling ~S) = (ceiling ~S)?~%" val1 val2)))
	(if (= (truncate val1) (truncate val2))
	    (begin (set! happy #f) (format #t ";(truncate ~S) = (truncate ~S)?~%" val1 val2)))
	(if (= (round val1) (round val2))
	    (begin (set! happy #f) (format #t ";(round ~S) = (round ~S)?~%" val1 val2))))))
  
  (let ((happy #t)
	(off-by 2/3))
    (do ((i 2 (+ i 1)))
	((or (not happy) (>= i top-exp)))
      (let* ((val1 (- (/ (expt 2 i) 3)))
	     (fv (floor val1))
	     (cv (ceiling val1))
	     (tv (truncate val1))
	     (rv (round val1)))
	(if (not (= fv (- val1 off-by)))
	    (begin (set! happy #f) (format #t ";(floor ~S) = ~S?~%" val1 fv)))
	(if (not (= cv (+ val1 (- 1 off-by))))
	    (begin (set! happy #f) (format #t ";(ceiling ~S) = ~S?~%" val1 cv)))
	(if (not (= tv (+ val1 (- 1 off-by))))
	    (begin (set! happy #f) (format #t ";(truncate ~S) = ~S?~%" val1 tv)))
	(if (= off-by 1/3)
	    (if (not (= rv (- val1 off-by)))
		(begin (set! happy #f) (format #t ";(round ~S) = ~S?~%" val1 rv)))
	    (if (not (= rv (+ val1 (- 1 off-by))))
		(begin (set! happy #f) (format #t ";(round ~S) = ~S?~%" val1 rv))))
	(if (= off-by 1/3)
	    (set! off-by 2/3)
	    (set! off-by 1/3)))))
  )



;;; --------------------------------------------------------------------------------
;;; modulo
;;; --------------------------------------------------------------------------------
;;; (modulo x 0) -> x?  I seem to be getting errors instead; maxima returns x and refers to Section 3.4, of "Concrete Mathematics," by Graham, Knuth, and Patashnik
;;; (mod x 1.0) = sawtooth

(num-test (modulo (/ (expt 2 61)) (/ (expt 3 10))) 1/2305843009213693952)
(num-test (modulo (/ (expt 2 61)) (/ (expt 3 20))) 1/2305843009213693952)
(num-test (modulo (/ (expt 2 61)) 1/512) 1/2305843009213693952)
(num-test (modulo -0.5 -1) -0.5)
(num-test (modulo -1 -1) 0)
(num-test (modulo -1 -10) -1)
(num-test (modulo -1 -1234) -1)
(num-test (modulo -1 -1234000000) -1)
(num-test (modulo -1 -2) -1)
(num-test (modulo -1 -3) -1)
(num-test (modulo -1 -362880) -1)
(num-test (modulo -1 -500029) -1)
(num-test (modulo -1 1) 0)
(num-test (modulo -1 10) 9)
(num-test (modulo -1 1234) 1233)
(num-test (modulo -1 1234000000) 1233999999)
(num-test (modulo -1 2) 1)
(num-test (modulo -1 3) 2)
(num-test (modulo -1 362880) 362879)
(num-test (modulo -1 500029) 500028)
(num-test (modulo -1.5 -2) -1.5)
(num-test (modulo -1.5 2) 0.5)
(num-test (modulo -1/2 -1) -1/2)
(num-test (modulo -1/2 -1.0) -0.5)
(num-test (modulo -1/2 2) 3/2)
(num-test (modulo -1/9223372036854775807 -1/3) -1/9223372036854775807)
(num-test (modulo -10 -1) 0)
(num-test (modulo -10 -10) 0)
(num-test (modulo -10 -1234) -10)
(num-test (modulo -10 -1234000000) -10)
(num-test (modulo -10 -2) 0)
(num-test (modulo -10 -3) -1)
(num-test (modulo -10 -362880) -10)
(num-test (modulo -10 -500029) -10)
(num-test (modulo -10 1) 0)
(num-test (modulo -10 10) 0)
(num-test (modulo -10 1234) 1224)
(num-test (modulo -10 1234000000) 1233999990)
(num-test (modulo -10 2) 0)
(num-test (modulo -10 3) 2)
(num-test (modulo -10 362880) 362870)
(num-test (modulo -10 500029) 500019)
(num-test (modulo -1234 -1) 0)
(num-test (modulo -1234 -10) -4)
(num-test (modulo -1234 -1234) 0)
(num-test (modulo -1234 -1234000000) -1234)
(num-test (modulo -1234 -2) 0)
(num-test (modulo -1234 -3) -1)
(num-test (modulo -1234 -362880) -1234)
(num-test (modulo -1234 -500029) -1234)
(num-test (modulo -1234 1) 0)
(num-test (modulo -1234 10) 6)
(num-test (modulo -1234 1234) 0)
(num-test (modulo -1234 1234000000) 1233998766)
(num-test (modulo -1234 2) 0)
(num-test (modulo -1234 3) 2)
(num-test (modulo -1234 362880) 361646)
(num-test (modulo -1234 500029) 498795)
(num-test (modulo -1234000000 -1) 0)
(num-test (modulo -1234000000 -10) 0)
(num-test (modulo -1234000000 -1234) 0)
(num-test (modulo -1234000000 -1234000000) 0)
(num-test (modulo -1234000000 -2) 0)
(num-test (modulo -1234000000 -3) -1)
(num-test (modulo -1234000000 -362880) -208000)
(num-test (modulo -1234000000 -500029) -428457)
(num-test (modulo -1234000000 1) 0)
(num-test (modulo -1234000000 10) 0)
(num-test (modulo -1234000000 1234) 0)
(num-test (modulo -1234000000 1234000000) 0)
(num-test (modulo -1234000000 2) 0)
(num-test (modulo -1234000000 3) 2)
(num-test (modulo -1234000000 362880) 154880)
(num-test (modulo -1234000000 500029) 71572)
(num-test (modulo -13 -4) -1)
(num-test (modulo -13 4) 3)
(num-test (modulo -13 4) 3)
(num-test (modulo -2 -1) 0)
(num-test (modulo -2 -10) -2)
(num-test (modulo -2 -1234) -2)
(num-test (modulo -2 -1234000000) -2)
(num-test (modulo -2 -2) 0)
(num-test (modulo -2 -3) -2)
(num-test (modulo -2 -362880) -2)
(num-test (modulo -2 -500029) -2)
(num-test (modulo -2 1) 0)
(num-test (modulo -2 10) 8)
(num-test (modulo -2 1234) 1232)
(num-test (modulo -2 1234000000) 1233999998)
(num-test (modulo -2 2) 0)
(num-test (modulo -2 3) 1)
(num-test (modulo -2 362880) 362878)
(num-test (modulo -2 500029) 500027)
(num-test (modulo -2/9223372036854775807 -2/3) -2/9223372036854775807)
(num-test (modulo -3 -1) 0)
(num-test (modulo -3 -10) -3)
(num-test (modulo -3 -1234) -3)
(num-test (modulo -3 -1234000000) -3)
(num-test (modulo -3 -2) -1)
(num-test (modulo -3 -3) 0)
(num-test (modulo -3 -362880) -3)
(num-test (modulo -3 -500029) -3)
(num-test (modulo -3 1) 0)
(num-test (modulo -3 1) 0)
(num-test (modulo -3 10) 7)
(num-test (modulo -3 1234) 1231)
(num-test (modulo -3 1234000000) 1233999997)
(num-test (modulo -3 2) 1)
(num-test (modulo -3 3) 0)
(num-test (modulo -3 362880) 362877)
(num-test (modulo -3 500029) 500026)
(num-test (modulo -3.1 -2.0) -1.1)
(num-test (modulo -3.1 2.0) 0.9) ; parallels (modulo -3 2) -> 1
(num-test (modulo -3.1 2.5) 1.9)
(num-test (modulo -3.5 1.5) 1.0)
(num-test (modulo -3/2 -2) -3/2)
(num-test (modulo -3/2 2) 1/2)
(num-test (modulo -362880 -1) 0)
(num-test (modulo -362880 -10) 0)
(num-test (modulo -362880 -1234) -84)
(num-test (modulo -362880 -1234000000) -362880)
(num-test (modulo -362880 -2) 0)
(num-test (modulo -362880 -3) 0)
(num-test (modulo -362880 -362880) 0)
(num-test (modulo -362880 -500029) -362880)
(num-test (modulo -362880 1) 0)
(num-test (modulo -362880 10) 0)
(num-test (modulo -362880 1234) 1150)
(num-test (modulo -362880 1234000000) 1233637120)
(num-test (modulo -362880 2) 0)
(num-test (modulo -362880 3) 0)
(num-test (modulo -362880 362880) 0)
(num-test (modulo -362880 500029) 137149)
(num-test (modulo -500029 -1) 0)
(num-test (modulo -500029 -10) -9)
(num-test (modulo -500029 -1234) -259)
(num-test (modulo -500029 -1234000000) -500029)
(num-test (modulo -500029 -2) -1)
(num-test (modulo -500029 -3) -1)
(num-test (modulo -500029 -362880) -137149)
(num-test (modulo -500029 -500029) 0)
(num-test (modulo -500029 1) 0)
(num-test (modulo -500029 10) 1)
(num-test (modulo -500029 1234) 975)
(num-test (modulo -500029 1234000000) 1233499971)
(num-test (modulo -500029 2) 1)
(num-test (modulo -500029 3) 2)
(num-test (modulo -500029 362880) 225731)
(num-test (modulo -500029 500029) 0)
(num-test (modulo 0 -1) 0)
(num-test (modulo 0 -1) 0)
(num-test (modulo 0 -10) 0)
(num-test (modulo 0 -10) 0)
(num-test (modulo 0 -1234) 0)
(num-test (modulo 0 -1234) 0)
(num-test (modulo 0 -1234000000) 0)
(num-test (modulo 0 -1234000000) 0)
(num-test (modulo 0 -2) 0)
(num-test (modulo 0 -2) 0)
(num-test (modulo 0 -3) 0)
(num-test (modulo 0 -3) 0)
(num-test (modulo 0 -362880) 0)
(num-test (modulo 0 -362880) 0)
(num-test (modulo 0 -500029) 0)
(num-test (modulo 0 -500029) 0)
(num-test (modulo 0 -86400) 0)
(num-test (modulo 0 1) 0)
(num-test (modulo 0 1) 0)
(num-test (modulo 0 10) 0)
(num-test (modulo 0 10) 0)
(num-test (modulo 0 1234) 0)
(num-test (modulo 0 1234) 0)
(num-test (modulo 0 1234000000) 0)
(num-test (modulo 0 1234000000) 0)
(num-test (modulo 0 2) 0)
(num-test (modulo 0 2) 0)
(num-test (modulo 0 3) 0)
(num-test (modulo 0 3) 0)
(num-test (modulo 0 362880) 0)
(num-test (modulo 0 362880) 0)
(num-test (modulo 0 500029) 0)
(num-test (modulo 0 500029) 0)
(num-test (modulo 0 86400) 0)
(num-test (modulo 0.5 -2) -1.5)
(num-test (modulo 0.5 -2.0) -1.5)
(num-test (modulo 0.5 2.0) 0.5)
(num-test (modulo 1 -1) 0)
(num-test (modulo 1 -10) -9)
(num-test (modulo 1 -1234) -1233)
(num-test (modulo 1 -1234000000) -1233999999)
(num-test (modulo 1 -2) -1)
(num-test (modulo 1 -3) -2)
(num-test (modulo 1 -362880) -362879)
(num-test (modulo 1 -4) -3)
(num-test (modulo 1 -500029) -500028)
(num-test (modulo 1 1) 0)
(num-test (modulo 1 10) 1)
(num-test (modulo 1 1234) 1)
(num-test (modulo 1 1234000000) 1)
(num-test (modulo 1 2) 1)
(num-test (modulo 1 3) 1)
(num-test (modulo 1 362880) 1)
(num-test (modulo 1 500029) 1)
(num-test (modulo 1.5 1/3) 0.16666666666667)
(num-test (modulo 1.5 1/4) 0.0)
(num-test (modulo 1/2 -2) -3/2)
(num-test (modulo 1/2 2) 1/2)
(num-test (modulo 1/2305843009213693952 1/4) 1/2305843009213693952)
(num-test (modulo 1/9223372036854775807 1/2) 1/9223372036854775807)
(num-test (modulo 1/9223372036854775807 1/3) 1/9223372036854775807)
(num-test (modulo 10 -1) 0)
(num-test (modulo 10 -10) 0)
(num-test (modulo 10 -1234) -1224)
(num-test (modulo 10 -1234000000) -1233999990)
(num-test (modulo 10 -2) 0)
(num-test (modulo 10 -3) -2)
(num-test (modulo 10 -362880) -362870)
(num-test (modulo 10 -500029) -500019)
(num-test (modulo 10 1) 0)
(num-test (modulo 10 10) 0)
(num-test (modulo 10 1234) 10)
(num-test (modulo 10 1234000000) 10)
(num-test (modulo 10 2) 0)
(num-test (modulo 10 3) 1)
(num-test (modulo 10 362880) 10)
(num-test (modulo 10 500029) 10)
(num-test (modulo 11/9223372036854775807 3/9223372036854775807) 2/9223372036854775807)
(num-test (modulo 1234 -1) 0)
(num-test (modulo 1234 -10) -6)
(num-test (modulo 1234 -1234) 0)
(num-test (modulo 1234 -1234000000) -1233998766)
(num-test (modulo 1234 -2) 0)
(num-test (modulo 1234 -3) -2)
(num-test (modulo 1234 -362880) -361646)
(num-test (modulo 1234 -500029) -498795)
(num-test (modulo 1234 1) 0)
(num-test (modulo 1234 10) 4)
(num-test (modulo 1234 1234) 0)
(num-test (modulo 1234 1234000000) 1234)
(num-test (modulo 1234 2) 0)
(num-test (modulo 1234 3) 1)
(num-test (modulo 1234 362880) 1234)
(num-test (modulo 1234 500029) 1234)
(num-test (modulo 1234000000 -1) 0)
(num-test (modulo 1234000000 -10) 0)
(num-test (modulo 1234000000 -1234) 0)
(num-test (modulo 1234000000 -1234000000) 0)
(num-test (modulo 1234000000 -2) 0)
(num-test (modulo 1234000000 -3) -2)
(num-test (modulo 1234000000 -362880) -154880)
(num-test (modulo 1234000000 -500029) -71572)
(num-test (modulo 1234000000 1) 0)
(num-test (modulo 1234000000 10) 0)
(num-test (modulo 1234000000 1234) 0)
(num-test (modulo 1234000000 1234000000) 0)
(num-test (modulo 1234000000 2) 0)
(num-test (modulo 1234000000 3) 1)
(num-test (modulo 1234000000 362880) 208000)
(num-test (modulo 1234000000 500029) 428457)
(num-test (modulo 13 -4) -3)
(num-test (modulo 13 4) 1)
(num-test (modulo 13 4) 1)
(num-test (modulo 19439282 4409.5) 2206.0)
(num-test (modulo 2 -1) 0)
(num-test (modulo 2 -10) -8)
(num-test (modulo 2 -1234) -1232)
(num-test (modulo 2 -1234000000) -1233999998)
(num-test (modulo 2 -2) 0)
(num-test (modulo 2 -3) -1)
(num-test (modulo 2 -362880) -362878)
(num-test (modulo 2 -500029) -500027)
(num-test (modulo 2 1) 0)
(num-test (modulo 2 10) 2)
(num-test (modulo 2 1234) 2)
(num-test (modulo 2 1234000000) 2)
(num-test (modulo 2 2) 0)
(num-test (modulo 2 3) 2)
(num-test (modulo 2 362880) 2)
(num-test (modulo 2 500029) 2)
(num-test (modulo 2/9223372036854775807 2/3) 2/9223372036854775807)
(num-test (modulo 3 -1) 0)
(num-test (modulo 3 -1) 0)
(num-test (modulo 3 -10) -7)
(num-test (modulo 3 -1234) -1231)
(num-test (modulo 3 -1234000000) -1233999997)
(num-test (modulo 3 -2) -1)
(num-test (modulo 3 -3) 0)
(num-test (modulo 3 -362880) -362877)
(num-test (modulo 3 -500029) -500026)
(num-test (modulo 3 1) 0)
(num-test (modulo 3 1) 0)
(num-test (modulo 3 10) 3)
(num-test (modulo 3 1234) 3)
(num-test (modulo 3 1234000000) 3)
(num-test (modulo 3 2) 1)
(num-test (modulo 3 2.5) 0.5)
(num-test (modulo 3 3) 0)
(num-test (modulo 3 362880) 3)
(num-test (modulo 3 500029) 3)
(num-test (modulo 3.1 -2.0) -0.9)
(num-test (modulo 3.1 2) 1.1)
(num-test (modulo 3.1 2.0) 1.1)
(num-test (modulo 3.5 1.5) 0.5)
(num-test (modulo 3/2 1/3) 1/6)
(num-test (modulo 3/2 1/4) 0)
(num-test (modulo 3/2 3/10) 0)
(num-test (modulo 3/3037000501 2/3037000501) 1/3037000501)
(num-test (modulo 3/9223372036854775807 2/9223372036854775807) 1/9223372036854775807)
(num-test (modulo 362880 -1) 0)
(num-test (modulo 362880 -10) 0)
(num-test (modulo 362880 -1234) -1150)
(num-test (modulo 362880 -1234000000) -1233637120)
(num-test (modulo 362880 -2) 0)
(num-test (modulo 362880 -3) 0)
(num-test (modulo 362880 -362880) 0)
(num-test (modulo 362880 -500029) -137149)
(num-test (modulo 362880 1) 0)
(num-test (modulo 362880 10) 0)
(num-test (modulo 362880 1234) 84)
(num-test (modulo 362880 1234000000) 362880)
(num-test (modulo 362880 2) 0)
(num-test (modulo 362880 3) 0)
(num-test (modulo 362880 362880) 0)
(num-test (modulo 362880 500029) 362880)
(num-test (modulo 500029 -1) 0)
(num-test (modulo 500029 -10) -1)
(num-test (modulo 500029 -1234) -975)
(num-test (modulo 500029 -1234000000) -1233499971)
(num-test (modulo 500029 -2) -1)
(num-test (modulo 500029 -3) -2)
(num-test (modulo 500029 -362880) -225731)
(num-test (modulo 500029 -500029) 0)
(num-test (modulo 500029 1) 0)
(num-test (modulo 500029 10) 9)
(num-test (modulo 500029 1234) 259)
(num-test (modulo 500029 1234000000) 500029)
(num-test (modulo 500029 2) 1)
(num-test (modulo 500029 3) 1)
(num-test (modulo 500029 362880) 137149)
(num-test (modulo 500029 500029) 0)
(num-test (modulo 922337203685477 1/3) 0)
(num-test (modulo 9223372036854775 1/3) 0)
(num-test (modulo 92233720368547758 1/3) 0)
(num-test (modulo 92233720368547758/23 1/3) 1/69)
(num-test (modulo 922337203685477580 1/3) 0)
(num-test (modulo 2755 13) 12)
(num-test (modulo 56 2) 0)
(num-test (modulo 148665 2) 1)
(num-test (modulo 71862 203) 0)
(num-test (modulo 21568911 41) 0)
(num-test (modulo 15295874 111) 74)
(num-test (modulo 20430054 41) 0)
(num-test (modulo 248255254 767) 364)
(num-test (modulo 510104442 5453) 3557)
(num-test (modulo 242162410 41) 10)
(num-test (modulo 660070972 74) 0)
(num-test (modulo 6542405452 117) 37)
(num-test (modulo 629448534 2) 0)
(num-test (modulo 163873565922 155) 62)
(num-test (modulo 1563464979842 442) 272)
(num-test (modulo 3712337724 576173) 55085)
(num-test (modulo 4380921044390 5) 0)
(num-test (modulo 4097970629150 86) 16)
(num-test (modulo 2090198664 1118) 398)
(num-test (modulo 5275411661289 31857) 10521)
(num-test (modulo 38602581835881 19) 8)
(num-test (modulo 82578867500655 319) 174)
(num-test (modulo 363169800 20) 0)
(num-test (modulo 2033404107084 23374) 16730)
(num-test (modulo 7438317458260 31213) 22165)
(num-test (modulo 390609000 11) 1)
(num-test (modulo 406117800 57) 39)
(num-test (modulo 1008217762344 4403) 3922)
(num-test (modulo 136581511784536 67022) 19220)
(num-test (modulo 43293168048 1344610) 759878)
(num-test (modulo 608503422693864 47) 0)
(num-test (modulo 6945109296864 779) 722)
(num-test (modulo 1346702251365156 435) 261)
(num-test (modulo 1388225063690465 644) 525)
(num-test (modulo 1200780158492850 91686) 60534)
(num-test (modulo 1551193257090906 2656731) 2347158)
(num-test (modulo 386512944051107445 17) 0)
(num-test (modulo 1111364125679340 6) 0)
(num-test (modulo 15858537083857314 21793) 0)
(num-test (modulo 44179338013272 280645) 48872)
(num-test (modulo 64149298745840 43808357) 20657028)
(num-test (modulo 4412914630225794 515823) 281358)
(num-test (modulo 169216424701305960 17) 14)
(num-test (modulo 178335507754891305 817) 0)
(num-test (modulo -9223372036854775808 -9223372036854775808) 0)
(num-test (modulo 1.110223024625156799999999999999999999997E-16 -9223372036854775808) -9.223372036854775807999999999999999888978E18)
(num-test (modulo 5.551115123125783999999999999999999999984E-17 1.110223024625156799999999999999999999997E-16) 5.551115123125783999999999999999999999984E-17)
(num-test (modulo 9223372036854775807 -9223372036854775808) -1)
(num-test (modulo 9223372036854775807 9223372036854775807) 0)

(num-test (modulo 8/3 3/2) 7/6)
(num-test (modulo 37/8 17/12) 3/8)
(num-test (modulo 12/19 41/29) 12/19)
(num-test (modulo 389/84 99/70) 163/420)
(num-test (modulo 1456/401 577/408) 65647/81804)
(num-test (modulo 9097/1054 1393/985) 151213/1038190)
(num-test (modulo 53963/20511 3363/2378) 59345521/48775158)
(num-test (modulo 163963/24727 19601/13860) 83457868/85679055)
(num-test (modulo 456564/125743 47321/33461) 3376518998/4207486523)
(num-test (modulo 794525/301994 114243/80782) 7420654502/6098919827)
(num-test (modulo 75261245/11350029 275807/195025) 2156154512513/2213539405725)
(num-test (modulo 92819835/16483927 1607521/1136689) 26012508981414/18737098497703)
(num-test (modulo 44957104/17087915 3880899/2744210) 11411052426451/9378565444430)
(num-test (modulo 53715833/85137581 9369319/6625109) 53715833/85137581)
(num-test (modulo 171928773/272500658 54608393/38613965) 171928773/272500658)
(num-test (modulo 4178406761/630138897 131836323/93222358) 28610075152269757/29371516922929563)

(num-test (modulo 1/9223372036 9223372036) 1/9223372036)
(num-test (modulo 1/9223372036854775807 9223372036854775807) 1/9223372036854775807)
(num-test (modulo 3/2 most-positive-fixnum) 3/2)
(num-test (modulo most-negative-fixnum -1) 0)

(if (not with-bignums)
    (num-test (modulo 3/2 most-negative-fixnum) 'error))

(when with-bignums
  (num-test (modulo 3/2 most-negative-fixnum) -18446744073709551613/2)
  (num-test (modulo (+ 2 (* 3 499127 495037 490459 468803)) (* 499127 495037 490459 468803)) 2)
  (num-test (modulo -9223372036854775808 5.551115123125783999999999999999999999984E-17) 3.258027528318940824192395666614174842834E-17)
  (num-test (modulo 12345678901234567890 12345678901234567) 890)
  (num-test (modulo 12345678901234567890 3123) 1071)
  (num-test (modulo 460683358924445799142 518) 0)
  (num-test (modulo 113021475230160 74635) 67850)
  (num-test (modulo 74228340534140364 363909) 357201)
  (num-test (modulo 69242022961311060 48305942) 17170072)
  (num-test (modulo 286967952870300 2273388) 2067312)
  (num-test (modulo 302822258393413362492399 29) 0)
  (num-test (modulo 10491072879382200 133) 0)
  (num-test (modulo 167206737423420464 609) 539)
  (num-test (modulo 72212583812867784 4888799) 1883149)
  (num-test (modulo 4170116471639397292390 1798025) 1078815)
  (num-test (modulo 83910330283522050 35224) 9282)
  (num-test (modulo 275373383775647594346 66884092) 19813626)
  (num-test (modulo 14656657495570695990 37) 7)
  (num-test (modulo 95470974177676509874110 1219) 0)
  (num-test (modulo 619506317623001424 5957) 3304)
  (num-test (modulo 11268171656665155960 9858) 372)
  (num-test (modulo 6172860073826160 5167394) 906830)
  (num-test (modulo 26457493095663264 1491412) 1103724)
  (num-test (modulo 8481384175941103284 313836405) 93136149)
  (num-test (modulo 60356595775749199080 176098815946) 156894620552)
  (num-test (modulo 611492274956002440 37) 0)
  (num-test (modulo 164614611843685080 1711) 177)
  (num-test (modulo 93177516542679418720 62197) 37333)
  (num-test (modulo 938959746797519770440 127558) 0)
  (num-test (modulo 137670522526899326250 200) 50)
  (num-test (modulo 852063402206742880 41643478) 23771242)
  (num-test (modulo 55947291202307909360 188546228) 125937196)
  (num-test (modulo 12877971214039423262680 9832253830) 8120608300)
  (num-test (modulo 192158415774146059920 53) 0)
  (num-test (modulo 902814024155808960 1829) 434)
  (num-test (modulo 1265864304573235487120 4921) 1295)
  (num-test (modulo 14172662463567665400 95817) 38076)
  (num-test (modulo 32171996211745702482324 2368555) 459984)
  (num-test (modulo 971324258606045826300 4576748) 342908)
  (num-test (modulo 2400649320046378377000 1704690) 165540)
  (num-test (modulo 953233796456393760 18342152493) 178603257)
  (num-test (modulo 28906333140964843080 236206740) 140736420)
  (num-test (modulo 775403093708557121609032 41) 0)
  (num-test (modulo 12587009808135760402860 2491) 1410)
  (num-test (modulo 510685807527370566909720 76) 44)
  (num-test (modulo 9842598153710524682146590 10089) 3363)
  (num-test (modulo 44936631038618189620242012 30740) 24592)
  (num-test (modulo 934589372977008750144 373650) 202194)
  (num-test (modulo 33027125273398900134069150 840577803) 0)
  (num-test (modulo 4428219127938822420288 1695783782) 1071746452)
  (num-test (modulo 29316428815807608915440 560764380) 415244720)
  (num-test (modulo 1364397376360544429904 19) 0)
  (num-test (modulo 4991450791697293128313385277 329) 133)
  (num-test (modulo 75448279792981695149550 3009) 2385)
  (num-test (modulo 181031604499464166188731133 3364) 1641)
  (num-test (modulo 405831142402606479845286 2746214) 1938504)
  (num-test (modulo 89170366469003867207160 25337230) 23157930)
  (num-test (modulo 13523725766340619200 1490114045) 621483730)
  (num-test (modulo 104705939487154940255412 192200052) 48253032)
  (num-test (modulo 7232591421499800642000 16584679460) 4668328860)
  (num-test (modulo 14043796716396386984750160 33382708236) 717907704)
  (num-test (modulo 13894638105872256412416 23) 0)
  (num-test (modulo 147611447155643499428400 118) 68)
  (num-test (modulo 13356594697070649024 4558) 1802)
  (num-test (modulo 15089731174706036171537760 90) 60)
  (num-test (modulo 307230141273924828960 1971507) 1430805)
  (num-test (modulo 2582563944548247741930009096 22873474) 3518996)
  (num-test (modulo 1074296602920111687342072 146235518) 73672588)
  (num-test (modulo 774058642832724262993980 407557010) 187324340)
  (num-test (modulo 291091930213008490369569480 13412544348) 10762778160)
  (num-test (modulo 2089068565149831833568 7302038455228) 470177842332)
  (num-test (modulo 1064437567441124038217970656 5) 1)
  (num-test (modulo 142557826750459447787460 1333) 527)
  (num-test (modulo 311779340580033594160200 23693) 0)
  (num-test (modulo 29314187023691666530559664 110143) 0)
  (num-test (modulo 222003853016244177637944900 857463) 0)
  (num-test (modulo 6247776111945111006243552 77976501) 12576855)
  (num-test (modulo 1140058514761397155259712 5530338) 502758)
  (num-test (modulo 580962736822969724865449808 55686036) 13545252)
  (num-test (modulo 4100502596989506786787500 45333475410) 13925822190)
  (num-test (modulo 1497378750311599979536944 262630276090) 236984817664)
  (num-test (modulo 105637634198318524045536 2633013240) 452166936)
  (num-test (modulo 11415822547029425161364106595632 7) 3)
  (num-test (modulo 198305933339312916107438448 177) 15)
  (num-test (modulo 3127415425979879537134790928 3335) 2668)
  (num-test (modulo 589703503861221139260034914750 13209) 4641)
  (num-test (modulo 3108579252052448504121792 14322) 12936)
  (num-test (modulo 636976201153021006473464400 66264077) 55801328)
  (num-test (modulo 9544425315508129998909285900 1488396) 850512)
  (num-test (modulo 458100280193857502802977376 260747103934) 17656078468)
  (num-test (modulo 114208186302155358124900650 22076867505) 6602131305)
  (num-test (modulo 90107067439719108194114160 28566806069714) 24735629596458)
  (num-test (modulo 2976572787365723002218245484 110104803958578) 49695655366500)
  (num-test (modulo 53453375725613238735360 17) 7)
  (num-test (modulo 888822833524306124874229800 106) 0)
  (num-test (modulo 21275338550698297089687698855820 3021) 0)
  (num-test (modulo 417525245705449941528380320750068 5828) 0)
  (num-test (modulo 1954871230146370370001829871352 22765249) 0)
  (num-test (modulo 903057827710908645847577520 648545995) 631903275)
  (num-test (modulo 6002846634833433581621040 28493572159) 8965596645)
  (num-test (modulo 26428903214964558277189300080 100428856) 20778384)
  (num-test (modulo 470486531607553676511206181180 28495896) 23264436)
  (num-test (modulo 483599554429365539310928369206620 5577334078910) 3472679709510)
  (num-test (modulo 134511400157705323668887400 1285071093558916) 114037248705380)
  (num-test (modulo 25897125642468049125349982599216 1183846707540) 999692775256)
  (num-test (modulo 1118034209930460291955200 3) 0)
  (num-test (modulo 16297594064835666104344589410644 413) 0)
  (num-test (modulo 536762539932642345554192060100 1378) 0)
  (num-test (modulo 933250179448203335817687635834340 58029) 55821)
  (num-test (modulo 65573457048202714607131200 486115) 32895)
  (num-test (modulo 85664559165674439863772868932 322014) 0)
  (num-test (modulo 7232817686074320060728552759760 11307940) 0)
  (num-test (modulo 78400098291720425971762131120 5646921093) 0)
  (num-test (modulo 345445746644065669842240 19727989065) 1869036660)
  (num-test (modulo 627854758484491743169777558200 750371721805653) 32673867918264)
  (num-test (modulo 788233263079483492974876830792850 7170146100) 1202847750)
  (num-test (modulo 18378856389802641496737518160 6247594493140) 1385698158460)
  (num-test (modulo 9620902642431357480148667659080 59) 0)
  (num-test (modulo 16008524600631853118144316000 629) 620)
  (num-test (modulo 4342138447708715023205684275423920 53041) 5133)
  (num-test (modulo 2431833161592653384508687244500 47541) 0)
  (num-test (modulo 39424620224103957589082132160 1671734) 0)
  (num-test (modulo 652830233576052788654372406432 552231327) 231166602)
  (num-test (modulo 6892963340916411083970414000 3662431431) 935088876)
  (num-test (modulo 29102758215190063506219566460000 10565720) 0)
  (num-test (modulo 21253900104556838003127171970777418412 1182797770) 1026303562)
  (num-test (modulo 3964268932242030284914943132662620 21244177854110) 13576270590290)
  (num-test (modulo 6070388091189460078138338240 40809131994181213) 6560348180153677)
  (num-test (modulo 9685989954133695108793384134000 964113514382876) 108668324726468)
  (num-test (modulo 56468122001858834917195045500 429400787158167902) 411466139739284938)
  (num-test (modulo 18843408973202596901221568364900 47) 0)
  (num-test (modulo 7800980538292163259967028613764250 6) 0)
  (num-test (modulo 270433907726619219545089642715200 3422) 3132)
  (num-test (modulo 45771666919597903071546708768 2342359) 1698374)
  (num-test (modulo 47198294949461301503537593835384892 314502) 130548)
  (num-test (modulo 3165335901519110207943908102359110 14953473) 10646010)
  (num-test (modulo 189219585097956261544520863361400 35605794) 0)
  (num-test (modulo 38532137569034426600955256933810890813 1341358608707) 100754920326)
  (num-test (modulo 1396277868664090735481380981225896 312520860) 187512516)
  (num-test (modulo 864038349500762576564773759109700 714136202724) 614489290716)
  (num-test (modulo 12514185871591242579049167322464 10706997440178) 749897068284)
  (num-test (modulo 1981802660405609330969478067056636 33312289752) 27681419124)
  (num-test (modulo 979313401024175219420658240 125278417383795) 92954907481995)
  (num-test (modulo 4074026154111369481048033354344 29) 0)
  (num-test (modulo 599666571180604695702511920885005100 129) 0)
  (num-test (modulo 5703263639326551702474610108800 1978) 0)
  (num-test (modulo 134137932950214683609064669163440 190619) 115401)
  (num-test (modulo 344735091370772631136645455600 1048985) 0)
  (num-test (modulo 6759508339299085316106145385400 4969610) 1763410)
  (num-test (modulo 700334422308861928135313594400 228529587) 194401350)
  (num-test (modulo 10277417891211405957191810814198480 2516552038) 1372664748)
  (num-test (modulo 490099971577877358878082782880 9282588354) 7843699422)
  (num-test (modulo 1954558750269048828645390249600 5575829490) 2295929790)
  (num-test (modulo 1360588454560018295496656378989200 7868178296420) 3049105010900)
  (num-test (modulo 4337552841738910859248770564912480 17722936528737830) 1203686858124400)
  (num-test (modulo 215913068853045803981566931862756 7009479781500) 1803638466756)
  (num-test (modulo 44890707654126305940250882318870941900 18329973480720) 7637488950300)
  (num-test (modulo 28579720891831355496720656680837200 3) 0)
  (num-test (modulo 29332703209780553199747293473184160 1711) 551)
  (num-test (modulo 3648979393315349438003046604440000 186) 0)
  (num-test (modulo 1159760236369472473822068077011807878780 25714) 0)
  (num-test (modulo 158186359726371025615685433600 31395) 17940)
  (num-test (modulo 331091450443070201468559735703944 28424) 0)
  (num-test (modulo 9734443639363161342241553023288200 1961348207) 1708271019)
  (num-test (modulo 701896612128009033011419603540080 51300) 47880)
  (num-test (modulo 86169288128517384618860929451245320 5032162527446) 925322642976)
  (num-test (modulo 64828800524794653881296183831741773624 4645294472) 311380888)
  (num-test (modulo 49068907706533938991402184550000 268183371225) 262983139650)
  (num-test (modulo 1708602980304476478496020543612288 4083128544) 131713824)
  (num-test (modulo 17608179287674151740172985536160 980399424528) 962337263616)
  (num-test (modulo 43194437079731225735521919644800 178119261126453036) 70796157206439912)
  (num-test (modulo 817555977437791699707628651571149344 59) 0)
  (num-test (modulo 19062946261334997559157066059536 533) 287)
  (num-test (modulo 6533849124840489114353090499099000 598) 130)
  (num-test (modulo 427663965127849896842400211428345149025 234) 117)
  (num-test (modulo 352395507261316174741530450071590608 154734) 26418)
  (num-test (modulo 391579493632653867660919800000 9221565) 1166160)
  (num-test (modulo 2618798923882923048581401148931738000 681876) 419616)
  (num-test (modulo 174712575449141140214591110997980800 233260339838) 37341839152)
  (num-test (modulo 88598141227372995032227898284800 1929763976) 1797148024)
  (num-test (modulo 210110141308655567793064872567302676320 720390430628) 523536832148)
  (num-test (modulo 668425085137718599277317523827419000 19898594339442) 17330916357006)
  (num-test (modulo 89533471731097208414073727453200 4173840860670546) 1611748174428756)
  (num-test (modulo 113987439157802480362236410675251462620 21548296273949445) 20414175417425790)
  (num-test (modulo 48129335993995093308894209644253760 1009442888504820) 947047755795120)
  (num-test (modulo 3497836376962291922989777163497680 138736290091634664) 23686683674181528)
  (num-test (modulo 11371924962562208722154622794880 3) 0)
  (num-test (modulo 9451631862008339290824315653784000 703) 171)
  (num-test (modulo 16869347753325980368094612370435598560 806) 0)
  (num-test (modulo 4701845646467068759127854100132739552 3198) 504)
  (num-test (modulo 1029865193584911347147121232800485280 1005771) 24531)
  (num-test (modulo 10657125216930337802109861408000 2415138) 2210802)
  (num-test (modulo 14382707743772734802155022983680 247913634) 7969170)
  (num-test (modulo 60134748581470366378101904574533857248 54828228) 9878960)
  (num-test (modulo 214830664120540781167218700750596000 505665810) 223433730)
  (num-test (modulo 48933004118344447687599112101802800 6263883444) 849340128)
  (num-test (modulo 5498670161558110606435630054129739400 262699548132) 255270333864)
  (num-test (modulo 35941673649029587182509620977230062500 25622409466332) 7911836749404)
  (num-test (modulo 1592802602494326390643157055239113248 736377633395508) 260180363298804)
  (num-test (modulo 4043816553144402557587143272522043028314 5011466158645380) 1781651263267134)
  (num-test (modulo 7171921165220830707276631005512550 1765284492289500) 1588756043060550)
  (num-test (modulo 2402189359210218692854826119405968750 23) 22)
  (num-test (modulo 26149068753160488131648964110990162400 1147) 868)
  (num-test (modulo 556184059176863945810376239306506311552 4089) 0)
  (num-test (modulo 67871323087036310486238021899264593800 13395) 0)
  (num-test (modulo 12750401179065252879838440979200 7177173) 0)
  (num-test (modulo 278110245000092733617125071646080 17748) 0)
  (num-test (modulo 13408203364935178481017292708752000 50619404) 13680920)
  (num-test (modulo 124271828931784534297423756437875067000 8839796595) 1143112215)
  (num-test (modulo 11893442806922081156953529319100769836176 972789007267) 210492262442)
  (num-test (modulo 352581052555284857902053030133344488264100 923561430099) 488944286523)
  (num-test (modulo 6108908012714804315575319947340956346976 31944833628092) 28158060036920)
  (num-test (modulo 67475643422116264959949054821520228800 22515435540) 8157766500)
  (num-test (modulo 470601888939348535946408832 5135943991060962937) 4475576385383445628)
  (num-test (modulo 110759232155568113345545635903016614000 30159198663300) 0)
  (num-test (modulo 146100914712024458707469587112300146320 26868173101560) 24880219882560)
  (num-test (modulo 12173192708601511002951184416658091200 466645866900785428350) 288583529752854077950)
  (num-test (modulo 5784684831478746253226687170890240 13) 0)
  (num-test (modulo 35042260655085685815432622412891903767500 667) 0)
  (num-test (modulo 2903871349270676921837488659419545120987500 530) 0)
  (num-test (modulo 630123969240840167098426767919876491188000 77691) 51794)
  (num-test (modulo 33192703032132982013024959634241667249800 4684718) 4051648)
  (num-test (modulo 4731525733734729472809717145544850000 90706055) 0)
  (num-test (modulo 214011009809686092216200126896120006823232 50400042) 45006552)
  (num-test (modulo 5854250735296111435541950856160000 24357777002) 2121729090)
  (num-test (modulo 35348208247612761916374738259136697649608 156806713508) 8948839908)
  (num-test (modulo 612558317420289618714916924536521515286100 2377007388) 375316956)
  (num-test (modulo 181857299802925368992522029882739454720 21606337755618) 0)
  (num-test (modulo 4731635341196946327443020710970699860000 58092526675092) 44387995860156)
  (num-test (modulo 22081740554432638182773611616166588288192 61419768950540) 49135815160432)
  (num-test (modulo 125627844706077784535328068665849312000 30482033400) 19356933400)
  (num-test (modulo 1225504716872819103560254268197955520 510813364186125) 233201076344145)
  (num-test (modulo 5209185280578468690281136425214396728400 2327880739319250103818) 518788605323339989776)
  (num-test (modulo 230425011604643097634961294406535254400 31) 0)
  (num-test (modulo 13222608481676137093434201748083744000 893) 0)
  (num-test (modulo 13348198818240350339028224064019716678960 651) 117)
  (num-test (modulo 7236172685650198160266777676385295337308176 23426) 14144)
  (num-test (modulo 756264162229440667711265021676693350760 28899) 0)
  (num-test (modulo 40915062421030872924283823601517905600 36345062) 0)
  (num-test (modulo 1174590526522170015825602834292923520 4991486258) 1554170940)
  (num-test (modulo 2891892862328155581145450075391651333218020 35138529818) 0)
  (num-test (modulo 1993335355070485984559797658834121810059400 535644500) 433741400)
  (num-test (modulo 6324295450641455215591954662726515160 367472693133) 134441229195)
  (num-test (modulo 6576388154814679090356195121505112000 15901952377630) 3827367890390)
  (num-test (modulo 117828556355409428513249595788296238400 565992666495795) 106570976318730)
  (num-test (modulo 592831716700236607285748949860604000 139641978135660) 133123065151440)
  (num-test (modulo 106766839071170184723986891291602032000 1584924526628112) 785519540106048)
  (num-test (modulo 21677148858122146832326483307664860804937400 247815827510760) 183567279637600)
  (num-test (modulo 14079549844487257384278196623697173813600 160967604100961853832) 160644118308938243512)
  (num-test (modulo 2696480372014145687016224877963234647656980 2219319031453896088860) 1749775073012430835800)
  (num-test (modulo 13545431257849875145060979241270859310160 29) 0)
  (num-test (modulo 137485634482479300158725199474868559498162500 329) 188)
  (num-test (modulo 529252417743761759027305009539254400 3243) 0)
  (num-test (modulo 133897419738958073238580385894509887148800 330455) 0)
  (num-test (modulo 3896215507210178905244623173635584334007288624 1005238) 0)
  (num-test (modulo 17654511984514518592175290794029073043800 1060530) 511980)
  (num-test (modulo 16470780256339082688310222474503880382858400 913836) 0)
  (num-test (modulo 57267105834722825210001789897760395576000 2958974018) 2329405078)
  (num-test (modulo 521977833444747522001426544601807810543216 1066521690) 625031316)
  (num-test (modulo 1699559962174727325529414216960251941390400 25883611479) 16915574049)
  (num-test (modulo 10654036597801063717295948399628964800 317449894126222) 116812646389120)
  (num-test (modulo 381902381115592200811990304316262139150724960 4640335440216) 0)
  (num-test (modulo 425968526187959807410151867411382902838703889232 1882826315615025) 1191718303295157)
  (num-test (modulo 174609167728518272531601927200939868792000 1712923655178450) 541648883945400)
  (num-test (modulo 3325168366561555458817274989681612518000 1699726139891780) 1568977975284720)
  (num-test (modulo 11429650426242566426919762928176000 7414967839104) 1771142792832)
  (num-test (modulo 2104794191230056678355480848036599377844400 16946684823025584) 9111120872594400)
  (num-test (modulo 11894522530167763519415142641640874994880 7) 0)
  (num-test (modulo 5906329981690378696996009087718418780000 185) 0)
  (num-test (modulo 3056294774178096513474941936265025440000 658) 0)
  (num-test (modulo 10491907660880423349353457742257185280 123369) 0)
  (num-test (modulo 673239479595593149777212259021965839229225628776 15470) 12376)
  (num-test (modulo 1506608574369860432616005754109397877696 1474070) 1179256)
  (num-test (modulo 4849814041048623250005708880379694793905000 2172220582) 0)
  (num-test (modulo 21154344928580705924176101470087564940000 5023204186) 0)
  (num-test (modulo 346448039376394135288065831861806112294000 776147372) 25037012)
  (num-test (modulo 2339009760844587560470606952218133142645504 194201967414) 78730527330)
  (num-test (modulo 2242982161480922111384667548175169152 21419749763490) 17054708275722)
  (num-test (modulo 4717315265246821759830981157482117120 45609714193992) 45557259088536)
  (num-test (modulo 16628111321698075419789804224660024289936 4643626415880804) 3203755070835528)
  (num-test (modulo 115557531507210992033160068979962880 88406536976058378) 13997397131802546)
  (num-test (modulo 21059511907771200155093927745003762840000 180298981648603620) 88715511648941760)
  (num-test (modulo 2124921015128697258800067298086064536000 2282525112298516782924) 1050493715522523120240)
  (num-test (modulo 16015671538624533047089928322348864000 49817926936366875) 31511531988217125)
  (num-test (modulo 166517667014186289390514558017250969134523800 43413708621878528404068) 4443969735426840626952)
  (num-test (modulo 2780796292789128359666429021610464935722000 47) 0)
  (num-test (modulo 21297913114430245153455383503409684916193317960 58) 0)
  (num-test (modulo 1516745257039775143654568869485529015398000 6293) 0)
  (num-test (modulo 8447692776411453120390905608381515479808 2030) 518)
  (num-test (modulo 958876033949638283967045624731391031146081240 9834415) 9667730)
  (num-test (modulo 4731349833403602529573388098680617532624192 14868) 0)
  (num-test (modulo 6375001358038970462026761077388061675464000 430513678) 0)
  (num-test (modulo 254088526608579040642428151389718385042344800 4799428101) 294233472)
  (num-test (modulo 21140490542258031885408065086507444825621023648 164778747198) 63851269926)
  (num-test (modulo 34214837305812460226811046733375808000 4312787868) 2681970660)
  (num-test (modulo 11450197571956515037245443769386989035470896800 75585518430279) 69771247781796)
  (num-test (modulo 1211397915863796187148880114197307052796506376580 538601201880) 128795939580)
  (num-test (modulo 5454139401260819402160859765169199667337088 30452838731872) 22996976784800)
  (num-test (modulo 744935981632690384026127091216926530879171660 1032747922358460) 630836297950320)
  (num-test (modulo 324574326062026951443376280715122947502400 103751223626207988025) 7552030128655111125)
  (num-test (modulo 15272163751269260921486082393684080908800 6484309049057400) 4436632507249800)
  (num-test (modulo 386527546655781220813671331401971490218262720 3481571963427119100) 243571263764902920)
  (num-test (modulo 3189682029126430413458911948222943640000 6724598925622907976570) 2607219061590696572250)
  (num-test (modulo 709403542855323660533377490060722241678400 7) 0)
  (num-test (modulo 139803787314578422635552652090095842837312147438904 123) 0)
  (num-test (modulo 171985399350431759069945935900956183322827030835560 18241) 0)
  (num-test (modulo 33090522521924986387051477884789600000 26187) 25578)
  (num-test (modulo 1733723010009930088165729903139785699319986530 372945) 23805)
  (num-test (modulo 56408303994570817306318494803635460247582000 5761730) 3307860)
  (num-test (modulo 25845509336769185412951159262424903513866295760 64371378271) 0)
  (num-test (modulo 624970361450506104794172455132584603069611058500 108222780) 0)
  (num-test (modulo 82823962548382643645255524843049561752323600 135325929794) 123023572540)
  (num-test (modulo 170620453449723034746079844571491973300000 9460614789626) 4845680745906)
  (num-test (modulo 125144597811313015929871740675462711600000 12764411911636) 5714078712188)
  (num-test (modulo 257193319319332344553297882967977761077115600 6510126541380) 1111485019260)
  (num-test (modulo 879624546681838385457288074812140664728758550 10045784120501316) 5303606126868522)
  (num-test (modulo 18300938860777100857669855248554588369659200 118088077425391892) 94617840861501464)
  (num-test (modulo 8394780474625841647581984803260010511075000 746584618179400) 91432008031000)
  (num-test (modulo 146802334713757872619395774222116859916800 718775571956687400) 62390745247132200)
  (num-test (modulo 240155883351717999820072393833707008014911556000 1350921510529331832) 1096988895768179232)
  (num-test (modulo 918942437243241528855354123800826649596480 74343962238703160850) 1608809218075839780)
  (num-test (modulo 1361069299753299783990135442290762165844800 8281085446358585640) 7375208194228544280)
  
  (num-test (modulo 1/9223372036854775807 -1/3) -9223372036854775804/27670116110564327421)
  (num-test (modulo -1/9223372036854775807 1/3) 9223372036854775804/27670116110564327421)
  (num-test (modulo 9223372036854775807 1/3) 0)
  (num-test (modulo (/ (expt 3 10)) (/ (expt 2 61))) 1991/136157723851059414171648)
  (num-test (modulo (/ (expt 3 20)) (/ (expt 2 61))) 487228559/2009994358920301836855410688)
  (num-test (modulo -2/9223372036854775807 2/3) 18446744073709551608/27670116110564327421)
  (num-test (modulo 2/9223372036854775807 -2/3) -18446744073709551608/27670116110564327421)
  (num-test (modulo 57473596068/6659027209 318281039/225058681) 218279130532125402/1498671880400651329)
  (num-test (modulo 25808688679/9809721694 1855077841/1311738121) 15656443452349049505/12867785902420496974)
  (num-test (modulo 17026679261/10439860591 4478554083/3166815962) 7164879387815321029/33061117160633553542)
  (num-test (modulo 480544481373/103768467013 10812186007/7645370045) 308048482161795610512/793348329316760825585)
  (num-test (modulo 137528045312/217976794617 63018038201/44560482149) 137528045312/217976794617)
  (num-test (modulo 1591258440050/975675645481 152139002499/107578520350) 22746909008980882960481/104961742282377144038350)
  (num-test (modulo 6721373040371/1193652440098 367296043199/259717522849) 430386901580727488556473/310012454884916918799202)
  (num-test (modulo 56850567176297/8573543875303 886731088897/627013566048) 1309091318011705591580273/1343932079730680866628136)
  (num-test (modulo 176638380405175/18340740190704 5168247530883/3654502875938) 38394278980353599950554679/33513143886879715286440176)
  (num-test (modulo 551230231989018/83130157078217 12477253282759/8822750406821) 714422652331325234782048966/733436627180932669467318157)
  (num-test (modulo 1360510821127147/517121682660006 30122754096401/21300003689580) 2233626037506212134611298309/1835782291436657618117489580)
  (num-test (modulo 5849200401628882/766512153894657 175568277047523/124145519261542) 53275930148683942294955132989/95159049365535186345899381094)
  (num-test (modulo 15914407453568626/6048967074079039 423859315570607/299713796309065) 2205856429990054302964180188017/1812958885520765991472282188535)
  (num-test (modulo 25997605614346611/9881527843552324 1023286908188737/723573111879672) 127934269420347558776141264953/105147174292423231311078293496)
  (num-test (modulo 1528546195606366451/177100989030047175 5964153172084899/4217293152016490) 10878285025401489444908608411504/74688678825176546867355107791575)
  (num-test (modulo 1991152086194052263/206745572560704147 14398739476117879/10181446324101389) 2411554265852820467970218680028029/2104968949772418231181062860760183)
  (num-test (modulo 1657796840421716313/630118245525664765 34761632124320657/24580185800219268) 18845015710796719738302110345968279/15488423551129023359673258461692020)
  (num-test (modulo 30769194397037159797/5464318637170278738 202605639573839043/143263821649299118) 271701765358086704077048080811413961/195709792667626007806640474599388271)
  (num-test (modulo 63477669249275110720/7354673373747273033 489133282872437279/345869461223138161) 370494072414302426447989361648602678/2543756917250129165517177396348512313)
  (num-test (modulo 275806591309589148297/36143248623210700400 1180872205318713601/835002744095575440) 9600268203288030825290513354903593/17147563511880433985428780967862600)
  
  (num-test (modulo 1e19 10) 0.0)
  (num-test (modulo .1e20 10) 0.0)
  (num-test (modulo 1e20 10) 0.0)
  (num-test (modulo 1e21 10) 0.0)
  (num-test (modulo 1e19 -1) 0.0)
  (num-test (modulo 1e19 1) 0.0)
  (num-test (modulo .1e20 1) 0.0)
  (num-test (modulo 1e20 1) 0.0)
  (num-test (modulo 10000000000000000000 1) 0)
  (num-test (modulo 100000000000000000000 1) 0)
  (num-test (modulo 10000000000000000000 10) 0)
  (num-test (modulo 100000000000000000000 10) 0)
  
  (test (modulo 1361069299753299783990135442290762165844800+i 8281085446358585640) 'error))
      
(test (modulo 123 123 123) 'error)
(test (modulo 123) 'error)
(test (modulo) 'error)
(test (mod 2 0) 'error)
(test (modulo 2.3 1.0+0.1i) 'error)
(test (modulo 3.0+2.3i 3) 'error)

(for-each
 (lambda (arg)
   (test (modulo arg nan.0) 'error)
   (test (modulo nan.0 arg) 'error)
   (test (modulo arg inf.0) 'error)
   (test (modulo inf.0 arg) 'error)
   (test (modulo arg 2) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))

(for-each
 (lambda (arg)
   (test (modulo 2 arg) 'error)
   (test (modulo 1/2 arg) 'error)
   (test (modulo 2.0 arg) 'error)
   (test (modulo 2+i arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))

;; check an optimizer bug
(test (let () (define (f x) (modulo x 12)) (f 3/4)) 3/4)



;;; --------------------------------------------------------------------------------
;;; quotient
;;; --------------------------------------------------------------------------------

(num-test (quotient -0.5 -1) 0)
(num-test (quotient -1 -1) 1)
(num-test (quotient -1 -10) 0)
(num-test (quotient -1 -1234) 0)
(num-test (quotient -1 -1234000000) 0)
(num-test (quotient -1 -2) 0)
(num-test (quotient -1 -3) 0)
(num-test (quotient -1 -362880) 0)
(num-test (quotient -1 -500029) 0)
(num-test (quotient -1 1) -1)
(num-test (quotient -1 10) 0)
(num-test (quotient -1 1234) 0)
(num-test (quotient -1 1234000000) 0)
(num-test (quotient -1 2) 0)
(num-test (quotient -1 3) 0)
(num-test (quotient -1 362880) 0)
(num-test (quotient -1 500029) 0)
(num-test (quotient -1.5 -2) 0)
(num-test (quotient -1.5 2) 0)
(num-test (quotient -1/2 -1) 0)
(num-test (quotient -1/2 -1.0) 0)
(num-test (quotient -10 -1) 10)
(num-test (quotient -10 -10) 1)
(num-test (quotient -10 -1234) 0)
(num-test (quotient -10 -1234000000) 0)
(num-test (quotient -10 -2) 5)
(num-test (quotient -10 -3) 3)
(num-test (quotient -10 -362880) 0)
(num-test (quotient -10 -500029) 0)
(num-test (quotient -10 1) -10)
(num-test (quotient -10 10) -1)
(num-test (quotient -10 1234) 0)
(num-test (quotient -10 1234000000) 0)
(num-test (quotient -10 2) -5)
(num-test (quotient -10 3) -3)
(num-test (quotient -10 362880) 0)
(num-test (quotient -10 500029) 0)
(num-test (quotient -1234 -1) 1234)
(num-test (quotient -1234 -10) 123)
(num-test (quotient -1234 -1234) 1)
(num-test (quotient -1234 -1234000000) 0)
(num-test (quotient -1234 -2) 617)
(num-test (quotient -1234 -3) 411)
(num-test (quotient -1234 -362880) 0)
(num-test (quotient -1234 -500029) 0)
(num-test (quotient -1234 1) -1234)
(num-test (quotient -1234 10) -123)
(num-test (quotient -1234 1234) -1)
(num-test (quotient -1234 1234000000) 0)
(num-test (quotient -1234 2) -617)
(num-test (quotient -1234 3) -411)
(num-test (quotient -1234 362880) 0)
(num-test (quotient -1234 500029) 0)
(num-test (quotient -1234000000 -1) 1234000000)
(num-test (quotient -1234000000 -10) 123400000)
(num-test (quotient -1234000000 -1234) 1000000)
(num-test (quotient -1234000000 -1234000000) 1)
(num-test (quotient -1234000000 -2) 617000000)
(num-test (quotient -1234000000 -3) 411333333)
(num-test (quotient -1234000000 -362880) 3400)
(num-test (quotient -1234000000 -500029) 2467)
(num-test (quotient -1234000000 1) -1234000000)
(num-test (quotient -1234000000 10) -123400000)
(num-test (quotient -1234000000 1234) -1000000)
(num-test (quotient -1234000000 1234000000) -1)
(num-test (quotient -1234000000 2) -617000000)
(num-test (quotient -1234000000 3) -411333333)
(num-test (quotient -1234000000 362880) -3400)
(num-test (quotient -1234000000 500029) -2467)
(num-test (quotient -2 -1) 2)
(num-test (quotient -2 -10) 0)
(num-test (quotient -2 -1234) 0)
(num-test (quotient -2 -1234000000) 0)
(num-test (quotient -2 -2) 1)
(num-test (quotient -2 -3) 0)
(num-test (quotient -2 -362880) 0)
(num-test (quotient -2 -500029) 0)
(num-test (quotient -2 1) -2)
(num-test (quotient -2 10) 0)
(num-test (quotient -2 1234) 0)
(num-test (quotient -2 1234000000) 0)
(num-test (quotient -2 2) -1)
(num-test (quotient -2 3) 0)
(num-test (quotient -2 362880) 0)
(num-test (quotient -2 500029) 0)
(num-test (quotient -3 -1) 3)
(num-test (quotient -3 -10) 0)
(num-test (quotient -3 -1234) 0)
(num-test (quotient -3 -1234000000) 0)
(num-test (quotient -3 -2) 1)
(num-test (quotient -3 -3) 1)
(num-test (quotient -3 -362880) 0)
(num-test (quotient -3 -500029) 0)
(num-test (quotient -3 1) -3)
(num-test (quotient -3 10) 0)
(num-test (quotient -3 1234) 0)
(num-test (quotient -3 1234000000) 0)
(num-test (quotient -3 2) -1)
(num-test (quotient -3 3) -1)
(num-test (quotient -3 362880) 0)
(num-test (quotient -3 500029) 0)
(num-test (quotient -3.1 -2.0) 1)
(num-test (quotient -3.1 2.0) -1)
(num-test (quotient -3.1 2.5) -1)
(num-test (quotient -3/2 -2) 0)
(num-test (quotient -3/2 2) 0)
(num-test (quotient -35 -7) 5)
(num-test (quotient -35 7) -5)
(num-test (quotient -362880 -1) 362880)
(num-test (quotient -362880 -10) 36288)
(num-test (quotient -362880 -1234) 294)
(num-test (quotient -362880 -1234000000) 0)
(num-test (quotient -362880 -2) 181440)
(num-test (quotient -362880 -3) 120960)
(num-test (quotient -362880 -362880) 1)
(num-test (quotient -362880 -500029) 0)
(num-test (quotient -362880 1) -362880)
(num-test (quotient -362880 10) -36288)
(num-test (quotient -362880 1234) -294)
(num-test (quotient -362880 1234000000) 0)
(num-test (quotient -362880 2) -181440)
(num-test (quotient -362880 3) -120960)
(num-test (quotient -362880 362880) -1)
(num-test (quotient -362880 500029) 0)
(num-test (quotient -500029 -1) 500029)
(num-test (quotient -500029 -10) 50002)
(num-test (quotient -500029 -1234) 405)
(num-test (quotient -500029 -1234000000) 0)
(num-test (quotient -500029 -2) 250014)
(num-test (quotient -500029 -3) 166676)
(num-test (quotient -500029 -362880) 1)
(num-test (quotient -500029 -500029) 1)
(num-test (quotient -500029 1) -500029)
(num-test (quotient -500029 10) -50002)
(num-test (quotient -500029 1234) -405)
(num-test (quotient -500029 1234000000) 0)
(num-test (quotient -500029 2) -250014)
(num-test (quotient -500029 3) -166676)
(num-test (quotient -500029 362880) -1)
(num-test (quotient -500029 500029) -1)
(num-test (quotient 0 -1) 0)
(num-test (quotient 0 -1) 0)
(num-test (quotient 0 -10) 0)
(num-test (quotient 0 -10) 0)
(num-test (quotient 0 -1234) 0)
(num-test (quotient 0 -1234) 0)
(num-test (quotient 0 -1234000000) 0)
(num-test (quotient 0 -1234000000) 0)
(num-test (quotient 0 -2) 0)
(num-test (quotient 0 -2) 0)
(num-test (quotient 0 -3) 0)
(num-test (quotient 0 -3) 0)
(num-test (quotient 0 -362880) 0)
(num-test (quotient 0 -362880) 0)
(num-test (quotient 0 -500029) 0)
(num-test (quotient 0 -500029) 0)
(num-test (quotient 0 1) 0)
(num-test (quotient 0 1) 0)
(num-test (quotient 0 10) 0)
(num-test (quotient 0 10) 0)
(num-test (quotient 0 1234) 0)
(num-test (quotient 0 1234) 0)
(num-test (quotient 0 1234000000) 0)
(num-test (quotient 0 1234000000) 0)
(num-test (quotient 0 2) 0)
(num-test (quotient 0 2) 0)
(num-test (quotient 0 3) 0)
(num-test (quotient 0 3) 0)
(num-test (quotient 0 362880) 0)
(num-test (quotient 0 362880) 0)
(num-test (quotient 0 500029) 0)
(num-test (quotient 0 500029) 0)
(num-test (quotient 0.5 -2) 0)
(num-test (quotient 0.5 -2.0) 0)
(num-test (quotient 0.5 2.0) 0)
(num-test (quotient 1 -1) -1)
(num-test (quotient 1 -10) 0)
(num-test (quotient 1 -1234) 0)
(num-test (quotient 1 -1234000000) 0)
(num-test (quotient 1 -2) 0)
(num-test (quotient 1 -3) 0)
(num-test (quotient 1 -362880) 0)
(num-test (quotient 1 -4) 0)
(num-test (quotient 1 -500029) 0)
(num-test (quotient 1 1) 1)
(num-test (quotient 1 10) 0)
(num-test (quotient 1 1234) 0)
(num-test (quotient 1 1234000000) 0)
(num-test (quotient 1 2) 0)
(num-test (quotient 1 3) 0)
(num-test (quotient 1 362880) 0)
(num-test (quotient 1 500029) 0)
(num-test (quotient 1.5 1/3) 4)
(num-test (quotient 1.5 1/4) 6)
(num-test (quotient 1/2 -2) 0)
(num-test (quotient 1/2 2) 0)
(num-test (quotient 1/9223372036854775807 1/3) 0)
(num-test (quotient 10 -1) -10)
(num-test (quotient 10 -10) -1)
(num-test (quotient 10 -1234) 0)
(num-test (quotient 10 -1234000000) 0)
(num-test (quotient 10 -2) -5)
(num-test (quotient 10 -3) -3)
(num-test (quotient 10 -362880) 0)
(num-test (quotient 10 -500029) 0)
(num-test (quotient 10 1) 10)
(num-test (quotient 10 10) 1)
(num-test (quotient 10 1234) 0)
(num-test (quotient 10 1234000000) 0)
(num-test (quotient 10 2) 5)
(num-test (quotient 10 3) 3)
(num-test (quotient 10 362880) 0)
(num-test (quotient 10 500029) 0)
(num-test (quotient 11/9223372036854775807 3/9223372036854775807) 3)
(num-test (quotient 1234 -1) -1234)
(num-test (quotient 1234 -10) -123)
(num-test (quotient 1234 -1234) -1)
(num-test (quotient 1234 -1234000000) 0)
(num-test (quotient 1234 -2) -617)
(num-test (quotient 1234 -3) -411)
(num-test (quotient 1234 -362880) 0)
(num-test (quotient 1234 -500029) 0)
(num-test (quotient 1234 1) 1234)
(num-test (quotient 1234 10) 123)
(num-test (quotient 1234 1234) 1)
(num-test (quotient 1234 1234000000) 0)
(num-test (quotient 1234 2) 617)
(num-test (quotient 1234 3) 411)
(num-test (quotient 1234 362880) 0)
(num-test (quotient 1234 500029) 0)
(num-test (quotient 1234000000 -1) -1234000000)
(num-test (quotient 1234000000 -10) -123400000)
(num-test (quotient 1234000000 -1234) -1000000)
(num-test (quotient 1234000000 -1234000000) -1)
(num-test (quotient 1234000000 -2) -617000000)
(num-test (quotient 1234000000 -3) -411333333)
(num-test (quotient 1234000000 -362880) -3400)
(num-test (quotient 1234000000 -500029) -2467)
(num-test (quotient 1234000000 1) 1234000000)
(num-test (quotient 1234000000 10) 123400000)
(num-test (quotient 1234000000 1234) 1000000)
(num-test (quotient 1234000000 1234000000) 1)
(num-test (quotient 1234000000 2) 617000000)
(num-test (quotient 1234000000 3) 411333333)
(num-test (quotient 1234000000 362880) 3400)
(num-test (quotient 1234000000 500029) 2467)
(num-test (quotient 19439282 4409.5) 4408)
(num-test (quotient 2 -1) -2)
(num-test (quotient 2 -10) 0)
(num-test (quotient 2 -1234) 0)
(num-test (quotient 2 -1234000000) 0)
(num-test (quotient 2 -2) -1)
(num-test (quotient 2 -3) 0)
(num-test (quotient 2 -362880) 0)
(num-test (quotient 2 -500029) 0)
(num-test (quotient 2 1) 2)
(num-test (quotient 2 10) 0)
(num-test (quotient 2 1234) 0)
(num-test (quotient 2 1234000000) 0)
(num-test (quotient 2 2) 1)
(num-test (quotient 2 3) 0)
(num-test (quotient 2 362880) 0)
(num-test (quotient 2 500029) 0)
(num-test (quotient 3 -1) -3)
(num-test (quotient 3 -10) 0)
(num-test (quotient 3 -1234) 0)
(num-test (quotient 3 -1234000000) 0)
(num-test (quotient 3 -2) -1)
(num-test (quotient 3 -3) -1)
(num-test (quotient 3 -362880) 0)
(num-test (quotient 3 -500029) 0)
(num-test (quotient 3 1) 3)
(num-test (quotient 3 10) 0)
(num-test (quotient 3 1234) 0)
(num-test (quotient 3 1234000000) 0)
(num-test (quotient 3 2) 1)
(num-test (quotient 3 2.5) 1)
(num-test (quotient 3 3) 1)
(num-test (quotient 3 362880) 0)
(num-test (quotient 3 500029) 0)
(num-test (quotient 3.1 -2.0) -1)
(num-test (quotient 3.1 2) 1)
(num-test (quotient 3.1 2.0) 1)
(num-test (quotient 3/2 1/3) 4)
(num-test (quotient 3/2 1/4) 6)
(num-test (quotient 3/2 3/10) 5)
(num-test (quotient 3/9223372036854775807 -2/9223372036854775807) -1)
(num-test (quotient 3/9223372036854775807 1/9223372036854775807) 3)
(num-test (quotient 35 -7) -5)
(num-test (quotient 35 7) 5 )
(num-test (quotient 362880 -1) -362880)
(num-test (quotient 362880 -10) -36288)
(num-test (quotient 362880 -1234) -294)
(num-test (quotient 362880 -1234000000) 0)
(num-test (quotient 362880 -2) -181440)
(num-test (quotient 362880 -3) -120960)
(num-test (quotient 362880 -362880) -1)
(num-test (quotient 362880 -500029) 0)
(num-test (quotient 362880 1) 362880)
(num-test (quotient 362880 10) 36288)
(num-test (quotient 362880 1234) 294)
(num-test (quotient 362880 1234000000) 0)
(num-test (quotient 362880 2) 181440)
(num-test (quotient 362880 3) 120960)
(num-test (quotient 362880 362880) 1)
(num-test (quotient 362880 500029) 0)
(num-test (quotient 500029 -1) -500029)
(num-test (quotient 500029 -10) -50002)
(num-test (quotient 500029 -1234) -405)
(num-test (quotient 500029 -1234000000) 0)
(num-test (quotient 500029 -2) -250014)
(num-test (quotient 500029 -3) -166676)
(num-test (quotient 500029 -362880) -1)
(num-test (quotient 500029 -500029) -1)
(num-test (quotient 500029 1) 500029)
(num-test (quotient 500029 10) 50002)
(num-test (quotient 500029 1234) 405)
(num-test (quotient 500029 1234000000) 0)
(num-test (quotient 500029 2) 250014)
(num-test (quotient 500029 3) 166676)
(num-test (quotient 500029 362880) 1)
(num-test (quotient 500029 500029) 1)
(num-test (quotient 512/1350851717672992089 512/4052555153018976267) 3)
(num-test (quotient 9223372036854775 1/3) 27670116110564325)
(num-test (quotient 9223372036854775807/2 9223372036854775807/8) 4)
(num-test (quotient 9223372036854775807/8 9223372036854775807/2) 0)
(num-test (quotient -9223372036854775808 -9223372036854775808) 1)
(num-test (quotient 1.110223024625156799999999999999999999997E-16 -9223372036854775808) 0)
(num-test (quotient 5.551115123125783999999999999999999999984E-17 1.110223024625156799999999999999999999997E-16) 0)
(num-test (quotient 9223372036854775807 -9223372036854775808) 0)
(num-test (quotient 9223372036854775807 9223372036854775807) 1)

(if (not with-bignums)
    (test (quotient most-negative-fixnum -1) 'error)
    (num-test (quotient most-negative-fixnum -1) 9223372036854775808))

(num-test (quotient 3 1.5) 2)
(num-test (quotient 3 1.75) 1)
(num-test (quotient pi 1) 3)
(num-test (quotient pi 1.5) 2)
(num-test (quotient pi 1.6) 1)
(num-test (quotient pi 3.0) 1)
(num-test (quotient pi 4.0) 0)

(num-test (quotient 0.0 1) 0)
(num-test (quotient 0.0 2) 0)
(num-test (quotient 0.0 3) 0)
(num-test (quotient 0.0 4) 0)
(num-test (quotient 0.0 pi) 0)
(num-test (quotient 0.0 2.5) 0)
(num-test (quotient 0.0 4.0) 0)
(num-test (quotient 0.0 1000.1) 0)
(num-test (quotient pi 1) 3)
(num-test (quotient pi 2) 1)
(num-test (quotient pi 3) 1)
(num-test (quotient pi 4) 0)
(num-test (quotient pi pi) 1)
(num-test (quotient pi 2.5) 1)
(num-test (quotient pi 4.0) 0)
(num-test (quotient pi 1000.1) 0)
(num-test (quotient 1.5 1) 1)
(num-test (quotient 1.5 2) 0)
(num-test (quotient 1.5 3) 0)
(num-test (quotient 1.5 4) 0)
(num-test (quotient 1.5 pi) 0)
(num-test (quotient 1.5 2.5) 0)
(num-test (quotient 1.5 4.0) 0)
(num-test (quotient 1.5 1000.1) 0)
(num-test (quotient -1.5 1) -1)
(num-test (quotient -1.5 2) 0)
(num-test (quotient -1.5 3) 0)
(num-test (quotient -1.5 4) 0)
(num-test (quotient -1.5 pi) 0)
(num-test (quotient -1.5 2.5) 0)
(num-test (quotient -1.5 4.0) 0)
(num-test (quotient -1.5 1000.1) 0)
(num-test (quotient 3.0 1) 3)
(num-test (quotient 3.0 2) 1)
(num-test (quotient 3.0 3) 1)
(num-test (quotient 3.0 4) 0)
(num-test (quotient 3.0 pi) 0)
(num-test (quotient 3.0 2.5) 1)
(num-test (quotient 3.0 4.0) 0)
(num-test (quotient 3.0 1000.1) 0)
(num-test (quotient 110.123 1) 110)
(num-test (quotient 110.123 2) 55)
(num-test (quotient 110.123 3) 36)
(num-test (quotient 110.123 4) 27)
(num-test (quotient 110.123 pi) 35)
(num-test (quotient 110.123 2.5) 44)
(num-test (quotient 110.123 4.0) 27)
(num-test (quotient 110.123 1000.1) 0)

(num-test (quotient 1e+18 8) 125000000000000000)
(num-test (quotient 1/9223372036854775807 -1/9223372036854775807) -1)
(num-test (quotient -4611686018427387904 1/2) -9223372036854775808)

(test (= (quotient (* 99/70 99/70) 2) (quotient (* 577/408 577/408) 2)) #t)
(test (= (quotient 2.0 (* 99/70 99/70)) (quotient (* 577/408 577/408) 2.0)) #f)
(test (= (quotient 99/70 577/408) (floor (/ 99/70 577/408))) #t)
(test (= (quotient (* 577/408 577/408) 2) (quotient (* 1393/985 1393/985) 2)) #f)
(test (= (quotient 2.0 (* 577/408 577/408)) (quotient (* 1393/985 1393/985) 2.0)) #t)
(test (= (quotient 577/408 1393/985) (floor (/ 577/408 1393/985))) #t)
(test (= (quotient (* 3363/2378 3363/2378) 2) (quotient (* 19601/13860 19601/13860) 2)) #t)
(test (= (quotient 2.0 (* 3363/2378 3363/2378)) (quotient (* 19601/13860 19601/13860) 2.0)) #f)
(test (= (quotient 3363/2378 19601/13860) (floor (/ 3363/2378 19601/13860))) #t)
(test (= (quotient (* 47321/33461 47321/33461) 2) (quotient (* 114243/80782 114243/80782) 2)) #f)
(test (= (quotient 2.0 (* 47321/33461 47321/33461)) (quotient (* 114243/80782 114243/80782) 2.0)) #t)
(test (= (quotient 47321/33461 114243/80782) (floor (/ 47321/33461 114243/80782))) #t)
(test (= (quotient (* 275807/195025 275807/195025) 2) (quotient (* 1607521/1136689 1607521/1136689) 2)) #t)
(test (= (quotient 2.0 (* 275807/195025 275807/195025)) (quotient (* 1607521/1136689 1607521/1136689) 2.0)) #f)
(test (= (quotient 275807/195025 1607521/1136689) (floor (/ 275807/195025 1607521/1136689))) #t)
(test (= (quotient (* 3880899/2744210 3880899/2744210) 2) (quotient (* 9369319/6625109 9369319/6625109) 2)) #f)
(test (= (quotient 2.0 (* 3880899/2744210 3880899/2744210)) (quotient (* 9369319/6625109 9369319/6625109) 2.0)) #t)
(test (= (quotient 3880899/2744210 9369319/6625109) (floor (/ 3880899/2744210 9369319/6625109))) #t)
(test (= (quotient (* 54608393/38613965 54608393/38613965) 2) (quotient (* 131836323/93222358 131836323/93222358) 2)) #f)
(test (= (quotient 2.0 (* 54608393/38613965 54608393/38613965)) (quotient (* 131836323/93222358 131836323/93222358) 2.0)) #t)
(test (= (quotient 54608393/38613965 131836323/93222358) (floor (/ 54608393/38613965 131836323/93222358))) #t)
(test (= (quotient (* 131836323/93222358 131836323/93222358) 2) (quotient (* 318281039/225058681 318281039/225058681) 2)) #f)
;(if with-bignums (test (= (quotient 2.0 (* 131836323/93222358 131836323/93222358)) ; this should be 1 I think
;			  (quotient (* 318281039/225058681 318281039/225058681) 2.0)) #f))
(test (= (quotient 131836323/93222358 318281039/225058681) (floor (/ 131836323/93222358 318281039/225058681))) #t)
(if with-bignums (test (= (quotient (* 318281039/225058681 318281039/225058681) 2) (quotient (* 1855077841/1311738121 1855077841/1311738121) 2)) #t))
(if with-bignums (test (= (quotient 2.0 (* 318281039/225058681 318281039/225058681)) (quotient (* 1855077841/1311738121 1855077841/1311738121) 2.0)) #f))
(test (= (quotient 318281039/225058681 1855077841/1311738121) (floor (/ 318281039/225058681 1855077841/1311738121))) #t)
(if with-bignums (test (= (quotient (* 1855077841/1311738121 1855077841/1311738121) 2) (quotient (* 4478554083/3166815962 4478554083/3166815962) 2)) #f))
(if (provided? 'overflow-checks)
    (test (= (quotient 2.0 (* 1855077841/1311738121 1855077841/1311738121)) (quotient (* 4478554083/3166815962 4478554083/3166815962) 2.0)) #t))
(test (= (quotient 1855077842/1311738121 4478554083/3166815962) (floor (/ 1855077842/1311738121 4478554083/3166815962))) #t)

;;; there's one really dumb problem here:
;;;  (quotient 1e-12 1E-16) -> 9999
;;;  (quotient 1.0000000000000e-12 1E-16) -> 9999 but
;;;  (quotient 1.00000000000000e-12 1E-16) -> 10000
;;;  for 1e-14 however, there is no number of zeros that will work, but you can set precision to 1024
;;;  or you can spell it out: (quotient 0.0000000000001 0.00000000000000001) -> 10000

;;;  (quotient 1e+18 3/4) -> 1333333333333333248
;;;  which should be 333 at the end of course
;;;  (quotient 1e+15 3/4) -> 1333333333333333

(num-test (quotient 1e16 1e14) 100)

(when with-bignums
  (num-test (quotient 1.00000000000000e-12 1E-16) 10000)
  
  (num-test (quotient -1.797693134862315699999999999999999999998E308 -9223372036854775808) 19490628022799995908501125008172039088075481712089442747863503837260448050616338003410135413043522984719682345909025832711116783129727902847513862872544943321023332545672815506523677443663683097294005030046422806743414556504424564204282517830151319186021046775247332737488676655598816722944)
  (num-test (quotient -9223372036854775808 5.551115123125783999999999999999999999984E-17) -166153499473114445265356059994784304)
  (num-test (quotient 295147905149568077200 34359738366) 8589934591)
  (num-test (quotient 696898287454081973170944403677937368733396 1180591620717411303422) 590295810358705651711)
  (num-test (quotient 1e19 10) 1000000000000000000)
  (num-test (quotient .1e20 10) 1000000000000000000)
  (num-test (quotient 1e20 10) 10000000000000000000)
  (num-test (quotient 1e21 10) 100000000000000000000)
  (num-test (quotient 1e19 -1) -10000000000000000000)
  (num-test (quotient 1e19 1) 10000000000000000000)
  (num-test (quotient .1e20 1) 10000000000000000000)
  (num-test (quotient 1e20 1) 100000000000000000000)
  (num-test (quotient 10000000000000000000 1) 10000000000000000000)
  (num-test (quotient 100000000000000000000 1) 100000000000000000000)
  (num-test (quotient 10000000000000000000 10) 1000000000000000000)
  (num-test (quotient 100000000000000000000 10) 10000000000000000000)
  
  (num-test (quotient 1 1/9223372036854775807) 9223372036854775807)
  (num-test (quotient 9223372036854775807 2/3) 13835058055282163710)
  (test (quotient 1361069299753299783990135442290762165844800+i 8281085446358585640) 'error)
  (test (quotient 1231231231231231232123 0.0) 'error)
  (test (quotient 1231231231231231232123 0) 'error)
  
  ;; the tests that multiply by 2.0 may be on the edge of the 128 bit default precision
  (test (= (quotient (* 4478554083/3166815962 4478554083/3166815962) 2) (quotient (* 10812186007/7645370045 10812186007/7645370045) 2)) #f)
  (test (= (quotient 2.0 (* 4478554083/3166815962 4478554083/3166815962)) (quotient (* 10812186007/7645370045 10812186007/7645370045) 2.0)) #t)
  (test (= (quotient 4478554083/3166815962 10812186007/7645370045) (floor (/ 4478554083/3166815962 10812186007/7645370045))) #t)
  (test (= (quotient (* 63018038201/44560482149 63018038201/44560482149) 2) (quotient (* 152139002499/107578520350 152139002499/107578520350) 2)) #f)
  (test (= (quotient 2.0 (* 63018038201/44560482149 63018038201/44560482149)) (quotient (* 152139002499/107578520350 152139002499/107578520350) 2.0)) #t)
  (test (= (quotient 63018038201/44560482149 152139002499/107578520350) (floor (/ 63018038201/44560482149 152139002499/107578520350))) #t)
  (test (= (quotient (* 367296043199/259717522849 367296043199/259717522849) 2) (quotient (* 886731088897/627013566048 886731088897/627013566048) 2)) #f)
  (test (= (quotient 2.0 (* 367296043199/259717522849 367296043199/259717522849)) (quotient (* 886731088897/627013566048 886731088897/627013566048) 2.0)) #t)
  (test (= (quotient 367296043199/259717522849 886731088897/627013566048) (floor (/ 367296043199/259717522849 886731088897/627013566048))) #t)
  (test (= (quotient (* 5168247530883/3654502875938 5168247530883/3654502875938) 2) (quotient (* 12477253282759/8822750406821 12477253282759/8822750406821) 2)) #f)
  (test (= (quotient 2.0 (* 5168247530883/3654502875938 5168247530883/3654502875938)) (quotient (* 12477253282759/8822750406821 12477253282759/8822750406821) 2.0)) #t)
  (test (= (quotient 5168247530883/3654502875938 12477253282759/8822750406821) (floor (/ 5168247530883/3654502875938 12477253282759/8822750406821))) #t)
  (test (= (quotient (* 30122754096401/21300003689580 30122754096401/21300003689580) 2) (quotient (* 175568277047523/124145519261542 175568277047523/124145519261542) 2)) #t)
  (test (= (quotient 2.0 (* 30122754096401/21300003689580 30122754096401/21300003689580)) (quotient (* 175568277047523/124145519261542 175568277047523/124145519261542) 2.0)) #f)
  (test (= (quotient 30122754096401/21300003689580 175568277047523/124145519261542) (floor (/ 30122754096401/21300003689580 175568277047523/124145519261542))) #t)
  
  (test (= (quotient (* 423859315570607/299713796309065 423859315570607/299713796309065) 2) 
	   (quotient (* 1023286908188737/723573111879672 1023286908188737/723573111879672) 2)) #f)
  (test (= (quotient 423859315570607/299713796309065 1023286908188737/723573111879672) 
	   (floor (/ 423859315570607/299713796309065 1023286908188737/723573111879672))) #t)
  (test (= (quotient (* 1023286908188737/723573111879672 1023286908188737/723573111879672) 2) 
	   (quotient (* 5964153172084899/4217293152016490 5964153172084899/4217293152016490) 2)) #t)
  (test (= (quotient (* 3289910387877251662993/2326317944764069484905 3289910387877251662993/2326317944764069484905) 2) 
	   (quotient (* 19175002942688032928599/13558774610046711780701 19175002942688032928599/13558774610046711780701) 2)) #t)
  (test (= (quotient 3289910387877251662993/2326317944764069484905 19175002942688032928599/13558774610046711780701) 
	   (floor (/ 3289910387877251662993/2326317944764069484905 19175002942688032928599/13558774610046711780701))) #t)
  (test (= (quotient (* 46292552162781456490001/32733777552734744709300 46292552162781456490001/32733777552734744709300) 2) 
	   (quotient (* 111760107268250945908601/79026329715516201199301 111760107268250945908601/79026329715516201199301) 2)) #f)
  (test (= (quotient 46292552162781456490001/32733777552734744709300 111760107268250945908601/79026329715516201199301) 
	   (floor (/ 46292552162781456490001/32733777552734744709300 111760107268250945908601/79026329715516201199301))) #t)
  (test (= (quotient (* 269812766699283348307203/190786436983767147107902 269812766699283348307203/190786436983767147107902) 2) 
	   (quotient (* 1572584048032918633353217/1111984844349868137938112 1572584048032918633353217/1111984844349868137938112) 2)) #t)
  (test (= (quotient 269812766699283348307203/190786436983767147107902 1572584048032918633353217/1111984844349868137938112) 
	   (floor (/ 269812766699283348307203/190786436983767147107902 1572584048032918633353217/1111984844349868137938112))) #t)
  (test (= (quotient (* 1572584048032918633353217/1111984844349868137938112 1572584048032918633353217/1111984844349868137938112) 2) 
	   (quotient (* 3796553736732654909229441/2684568892382786771291329 3796553736732654909229441/2684568892382786771291329) 2)) #f)
  (test (= (quotient 1572584048032918633353217/1111984844349868137938112 3796553736732654909229441/2684568892382786771291329) 
	   (floor (/ 1572584048032918633353217/1111984844349868137938112 3796553736732654909229441/2684568892382786771291329))) #t))

(test (quotient 123 123 123) 'error)
(test (quotient 123) 'error)
(test (quotient 3 0) 'error)
(test (quotient) 'error)
(test (quotient 3 1+i) 'error)
(test (quotient 3 0.0) 'error)

(for-each
 (lambda (arg)
   (test (quotient arg nan.0) 'error)
   (test (quotient nan.0 arg) 'error)
   (test (quotient arg inf.0) 'error)
   (test (quotient inf.0 arg) 'error)
   (test (quotient arg 2) 'error))
 (list "hi" () (integer->char 65) #f #t 0+i '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))

(for-each
 (lambda (arg)
   (test (quotient 2 arg) 'error)
   (test (quotient 1/2 arg) 'error)
   (test (quotient 2.0 arg) 'error)
   (test (quotient 2+i arg) 'error))
 (list "hi" () (integer->char 65) #f #t 0 0.0 0+i '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))





;;; --------------------------------------------------------------------------------
;;; remainder
;;; --------------------------------------------------------------------------------

(num-test (remainder -0.5 -1) -0.5)
(num-test (remainder -1 -1) 0)
(num-test (remainder -1 -10) -1)
(num-test (remainder -1 -1234) -1)
(num-test (remainder -1 -1234000000) -1)
(num-test (remainder -1 -2) -1)
(num-test (remainder -1 -3) -1)
(num-test (remainder -1 -362880) -1)
(num-test (remainder -1 -500029) -1)
(num-test (remainder -1 1) 0)
(num-test (remainder -1 10) -1)
(num-test (remainder -1 1234) -1)
(num-test (remainder -1 1234000000) -1)
(num-test (remainder -1 2) -1)
(num-test (remainder -1 3) -1)
(num-test (remainder -1 362880) -1)
(num-test (remainder -1 500029) -1)
(num-test (remainder -1.5 -2) -1.5)
(num-test (remainder -1.5 2) -1.5)
(num-test (remainder -1/2 -1) -1/2)
(num-test (remainder -1/2 -1.0) -0.5)
(num-test (remainder -10 -1) 0)
(num-test (remainder -10 -10) 0)
(num-test (remainder -10 -1234) -10)
(num-test (remainder -10 -1234000000) -10)
(num-test (remainder -10 -2) 0)
(num-test (remainder -10 -3) -1)
(num-test (remainder -10 -362880) -10)
(num-test (remainder -10 -500029) -10)
(num-test (remainder -10 1) 0)
(num-test (remainder -10 10) 0)
(num-test (remainder -10 1234) -10)
(num-test (remainder -10 1234000000) -10)
(num-test (remainder -10 2) 0)
(num-test (remainder -10 3) -1)
(num-test (remainder -10 362880) -10)
(num-test (remainder -10 500029) -10)
(num-test (remainder -1234 -1) 0)
(num-test (remainder -1234 -10) -4)
(num-test (remainder -1234 -1234) 0)
(num-test (remainder -1234 -1234000000) -1234)
(num-test (remainder -1234 -2) 0)
(num-test (remainder -1234 -3) -1)
(num-test (remainder -1234 -362880) -1234)
(num-test (remainder -1234 -500029) -1234)
(num-test (remainder -1234 1) 0)
(num-test (remainder -1234 10) -4)
(num-test (remainder -1234 1234) 0)
(num-test (remainder -1234 1234000000) -1234)
(num-test (remainder -1234 2) 0)
(num-test (remainder -1234 3) -1)
(num-test (remainder -1234 362880) -1234)
(num-test (remainder -1234 500029) -1234)
(num-test (remainder -1234000000 -1) 0)
(num-test (remainder -1234000000 -10) 0)
(num-test (remainder -1234000000 -1234) 0)
(num-test (remainder -1234000000 -1234000000) 0)
(num-test (remainder -1234000000 -2) 0)
(num-test (remainder -1234000000 -3) -1)
(num-test (remainder -1234000000 -362880) -208000)
(num-test (remainder -1234000000 -500029) -428457)
(num-test (remainder -1234000000 1) 0)
(num-test (remainder -1234000000 10) 0)
(num-test (remainder -1234000000 1234) 0)
(num-test (remainder -1234000000 1234000000) 0)
(num-test (remainder -1234000000 2) 0)
(num-test (remainder -1234000000 3) -1)
(num-test (remainder -1234000000 362880) -208000)
(num-test (remainder -1234000000 500029) -428457)
(num-test (remainder -13 -4) -1)
(num-test (remainder -13 4) -1)
(num-test (remainder -2 -1) 0)
(num-test (remainder -2 -10) -2)
(num-test (remainder -2 -1234) -2)
(num-test (remainder -2 -1234000000) -2)
(num-test (remainder -2 -2) 0)
(num-test (remainder -2 -3) -2)
(num-test (remainder -2 -362880) -2)
(num-test (remainder -2 -500029) -2)
(num-test (remainder -2 1) 0)
(num-test (remainder -2 10) -2)
(num-test (remainder -2 1234) -2)
(num-test (remainder -2 1234000000) -2)
(num-test (remainder -2 2) 0)
(num-test (remainder -2 3) -2)
(num-test (remainder -2 362880) -2)
(num-test (remainder -2 500029) -2)
(num-test (remainder -3 -1) 0)
(num-test (remainder -3 -10) -3)
(num-test (remainder -3 -1234) -3)
(num-test (remainder -3 -1234000000) -3)
(num-test (remainder -3 -2) -1)
(num-test (remainder -3 -3) 0)
(num-test (remainder -3 -362880) -3)
(num-test (remainder -3 -500029) -3)
(num-test (remainder -3 1) 0)
(num-test (remainder -3 10) -3)
(num-test (remainder -3 1234) -3)
(num-test (remainder -3 1234000000) -3)
(num-test (remainder -3 2) -1)
(num-test (remainder -3 3) 0)
(num-test (remainder -3 362880) -3)
(num-test (remainder -3 500029) -3)
(num-test (remainder -3.1 -2.0) -1.1)
(num-test (remainder -3.1 2.0) -1.1)
(num-test (remainder -3.1 2.5) -0.6)
(num-test (remainder -3/2 -2) -3/2)
(num-test (remainder -3/2 2) -3/2)
(num-test (remainder -362880 -1) 0)
(num-test (remainder -362880 -10) 0)
(num-test (remainder -362880 -1234) -84)
(num-test (remainder -362880 -1234000000) -362880)
(num-test (remainder -362880 -2) 0)
(num-test (remainder -362880 -3) 0)
(num-test (remainder -362880 -362880) 0)
(num-test (remainder -362880 -500029) -362880)
(num-test (remainder -362880 1) 0)
(num-test (remainder -362880 10) 0)
(num-test (remainder -362880 1234) -84)
(num-test (remainder -362880 1234000000) -362880)
(num-test (remainder -362880 2) 0)
(num-test (remainder -362880 3) 0)
(num-test (remainder -362880 362880) 0)
(num-test (remainder -362880 500029) -362880)
(num-test (remainder -500029 -1) 0)
(num-test (remainder -500029 -10) -9)
(num-test (remainder -500029 -1234) -259)
(num-test (remainder -500029 -1234000000) -500029)
(num-test (remainder -500029 -2) -1)
(num-test (remainder -500029 -3) -1)
(num-test (remainder -500029 -362880) -137149)
(num-test (remainder -500029 -500029) 0)
(num-test (remainder -500029 1) 0)
(num-test (remainder -500029 10) -9)
(num-test (remainder -500029 1234) -259)
(num-test (remainder -500029 1234000000) -500029)
(num-test (remainder -500029 2) -1)
(num-test (remainder -500029 3) -1)
(num-test (remainder -500029 362880) -137149)
(num-test (remainder -500029 500029) 0)
(num-test (remainder 0 -1) 0)
(num-test (remainder 0 -1) 0)
(num-test (remainder 0 -10) 0)
(num-test (remainder 0 -10) 0)
(num-test (remainder 0 -1234) 0)
(num-test (remainder 0 -1234) 0)
(num-test (remainder 0 -1234000000) 0)
(num-test (remainder 0 -1234000000) 0)
(num-test (remainder 0 -2) 0)
(num-test (remainder 0 -2) 0)
(num-test (remainder 0 -3) 0)
(num-test (remainder 0 -3) 0)
(num-test (remainder 0 -362880) 0)
(num-test (remainder 0 -362880) 0)
(num-test (remainder 0 -500029) 0)
(num-test (remainder 0 -500029) 0)
(num-test (remainder 0 1) 0)
(num-test (remainder 0 1) 0)
(num-test (remainder 0 10) 0)
(num-test (remainder 0 10) 0)
(num-test (remainder 0 1234) 0)
(num-test (remainder 0 1234) 0)
(num-test (remainder 0 1234000000) 0)
(num-test (remainder 0 1234000000) 0)
(num-test (remainder 0 2) 0)
(num-test (remainder 0 2) 0)
(num-test (remainder 0 3) 0)
(num-test (remainder 0 3) 0)
(num-test (remainder 0 362880) 0)
(num-test (remainder 0 362880) 0)
(num-test (remainder 0 500029) 0)
(num-test (remainder 0 500029) 0)
(num-test (remainder 0.5 -2) 0.5)
(num-test (remainder 0.5 -2.0) 0.5)
(num-test (remainder 0.5 2.0) 0.5)
(num-test (remainder 1 -1) 0)
(num-test (remainder 1 -10) 1)
(num-test (remainder 1 -1234) 1)
(num-test (remainder 1 -1234000000) 1)
(num-test (remainder 1 -2) 1)
(num-test (remainder 1 -3) 1)
(num-test (remainder 1 -362880) 1)
(num-test (remainder 1 -4) 1)
(num-test (remainder 1 -500029) 1)
(num-test (remainder 1 1) 0)
(num-test (remainder 1 10) 1)
(num-test (remainder 1 1234) 1)
(num-test (remainder 1 1234000000) 1)
(num-test (remainder 1 2) 1)
(num-test (remainder 1 3) 1)
(num-test (remainder 1 362880) 1)
(num-test (remainder 1 500029) 1)
(num-test (remainder 1.5 1/3) 0.16666666666667)
(num-test (remainder 1.5 1/4) 0.0)
(num-test (remainder 1/2 -2) 1/2)
(num-test (remainder 1/2 2) 1/2)
(num-test (remainder 1/9223372036854775807 1/3) 1/9223372036854775807)
(num-test (remainder 10 -1) 0)
(num-test (remainder 10 -10) 0)
(num-test (remainder 10 -1234) 10)
(num-test (remainder 10 -1234000000) 10)
(num-test (remainder 10 -2) 0)
(num-test (remainder 10 -3) 1)
(num-test (remainder 10 -362880) 10)
(num-test (remainder 10 -500029) 10)
(num-test (remainder 10 1) 0)
(num-test (remainder 10 10) 0)
(num-test (remainder 10 1234) 10)
(num-test (remainder 10 1234000000) 10)
(num-test (remainder 10 2) 0)
(num-test (remainder 10 3) 1)
(num-test (remainder 10 362880) 10)
(num-test (remainder 10 500029) 10)
(num-test (remainder 11/9223372036854775807 3/9223372036854775807) 2/9223372036854775807)
(num-test (remainder 1234 -1) 0)
(num-test (remainder 1234 -10) 4)
(num-test (remainder 1234 -1234) 0)
(num-test (remainder 1234 -1234000000) 1234)
(num-test (remainder 1234 -2) 0)
(num-test (remainder 1234 -3) 1)
(num-test (remainder 1234 -362880) 1234)
(num-test (remainder 1234 -500029) 1234)
(num-test (remainder 1234 1) 0)
(num-test (remainder 1234 10) 4)
(num-test (remainder 1234 1234) 0)
(num-test (remainder 1234 1234000000) 1234)
(num-test (remainder 1234 2) 0)
(num-test (remainder 1234 3) 1)
(num-test (remainder 1234 362880) 1234)
(num-test (remainder 1234 500029) 1234)
(num-test (remainder 1234000000 -1) 0)
(num-test (remainder 1234000000 -10) 0)
(num-test (remainder 1234000000 -1234) 0)
(num-test (remainder 1234000000 -1234000000) 0)
(num-test (remainder 1234000000 -2) 0)
(num-test (remainder 1234000000 -3) 1)
(num-test (remainder 1234000000 -362880) 208000)
(num-test (remainder 1234000000 -500029) 428457)
(num-test (remainder 1234000000 1) 0)
(num-test (remainder 1234000000 10) 0)
(num-test (remainder 1234000000 1234) 0)
(num-test (remainder 1234000000 1234000000) 0)
(num-test (remainder 1234000000 2) 0)
(num-test (remainder 1234000000 3) 1)
(num-test (remainder 1234000000 362880) 208000)
(num-test (remainder 1234000000 500029) 428457)
(num-test (remainder 13 -4) 1)
(num-test (remainder 13 4) 1)
(num-test (remainder 19439282 4409.5) 2206.0)
(num-test (remainder 2 -1) 0)
(num-test (remainder 2 -10) 2)
(num-test (remainder 2 -1234) 2)
(num-test (remainder 2 -1234000000) 2)
(num-test (remainder 2 -2) 0)
(num-test (remainder 2 -3) 2)
(num-test (remainder 2 -362880) 2)
(num-test (remainder 2 -500029) 2)
(num-test (remainder 2 1) 0)
(num-test (remainder 2 10) 2)
(num-test (remainder 2 1234) 2)
(num-test (remainder 2 1234000000) 2)
(num-test (remainder 2 2) 0)
(num-test (remainder 2 3) 2)
(num-test (remainder 2 362880) 2)
(num-test (remainder 2 500029) 2)
(num-test (remainder 3 -1) 0)
(num-test (remainder 3 -10) 3)
(num-test (remainder 3 -1234) 3)
(num-test (remainder 3 -1234000000) 3)
(num-test (remainder 3 -2) 1)
(num-test (remainder 3 -3) 0)
(num-test (remainder 3 -362880) 3)
(num-test (remainder 3 -500029) 3)
(num-test (remainder 3 1) 0)
(num-test (remainder 3 10) 3)
(num-test (remainder 3 1234) 3)
(num-test (remainder 3 1234000000) 3)
(num-test (remainder 3 2) 1)
(num-test (remainder 3 2.5) 0.5)
(num-test (remainder 3 3) 0)
(num-test (remainder 3 362880) 3)
(num-test (remainder 3 500029) 3)
(num-test (remainder 3.1 -2.0) 1.1)
(num-test (remainder 3.1 2) 1.1)
(num-test (remainder 3.1 2.0) 1.1)
(num-test (remainder 3/2 1/3) 1/6)
(num-test (remainder 3/2 1/4) 0)
(num-test (remainder 3/2 3/10) 0)
(num-test (remainder 362880 -1) 0)
(num-test (remainder 362880 -10) 0)
(num-test (remainder 362880 -1234) 84)
(num-test (remainder 362880 -1234000000) 362880)
(num-test (remainder 362880 -2) 0)
(num-test (remainder 362880 -3) 0)
(num-test (remainder 362880 -362880) 0)
(num-test (remainder 362880 -500029) 362880)
(num-test (remainder 362880 1) 0)
(num-test (remainder 362880 10) 0)
(num-test (remainder 362880 1234) 84)
(num-test (remainder 362880 1234000000) 362880)
(num-test (remainder 362880 2) 0)
(num-test (remainder 362880 3) 0)
(num-test (remainder 362880 362880) 0)
(num-test (remainder 362880 500029) 362880)
(num-test (remainder 500029 -1) 0)
(num-test (remainder 500029 -10) 9)
(num-test (remainder 500029 -1234) 259)
(num-test (remainder 500029 -1234000000) 500029)
(num-test (remainder 500029 -2) 1)
(num-test (remainder 500029 -3) 1)
(num-test (remainder 500029 -362880) 137149)
(num-test (remainder 500029 -500029) 0)
(num-test (remainder 500029 1) 0)
(num-test (remainder 500029 10) 9)
(num-test (remainder 500029 1234) 259)
(num-test (remainder 500029 1234000000) 500029)
(num-test (remainder 500029 2) 1)
(num-test (remainder 500029 3) 1)
(num-test (remainder 500029 362880) 137149)
(num-test (remainder 500029 500029) 0)
(num-test (remainder -9223372036854775808 -9223372036854775808) 0)
(num-test (remainder 1.110223024625156799999999999999999999997E-16 -9223372036854775808) 1.110223024625156799999999999999999999997E-16)
(num-test (remainder 5.551115123125783999999999999999999999984E-17 1.110223024625156799999999999999999999997E-16) 5.551115123125783999999999999999999999984E-17)
(num-test (remainder 9223372036854775807 -9223372036854775808) 9223372036854775807)
(num-test (remainder 9223372036854775807 9223372036854775807) 0)

(num-test (remainder 0.0 1) 0.0)
(num-test (remainder 0.0 2) 0.0)
(num-test (remainder 0.0 3) 0.0)
(num-test (remainder 0.0 4) 0.0)
(num-test (remainder 0.0 pi) 0.0)
(num-test (remainder 0.0 2.5) 0.0)
(num-test (remainder 0.0 4.0) 0.0)
(num-test (remainder 0.0 1000.1) 0.0)
(num-test (remainder pi 1) 1.415926535897932384626433832795028841953E-1)
(num-test (remainder pi 2) 1.141592653589793238462643383279502884195E0)
(num-test (remainder pi 3) 1.415926535897932384626433832795028841953E-1)
(num-test (remainder pi 4) pi)
(num-test (remainder pi pi) 0.0)
(num-test (remainder pi 2.5) 6.415926535897932384626433832795028841953E-1)
(num-test (remainder pi 4.0) pi)
(num-test (remainder pi 1000.1) pi)
(num-test (remainder 1.5 1) 0.5)
(num-test (remainder 1.5 2) 1.5)
(num-test (remainder 1.5 3) 1.5)
(num-test (remainder 1.5 4) 1.5)
(num-test (remainder 1.5 pi) 1.500E0)
(num-test (remainder 1.5 2.5) 1.5)
(num-test (remainder 1.5 4.0) 1.5)
(num-test (remainder 1.5 1000.1) 1.5)
(num-test (remainder -1.5 1) -0.5)
(num-test (remainder -1.5 2) -1.5)
(num-test (remainder -1.5 3) -1.5)
(num-test (remainder -1.5 4) -1.5)
(num-test (remainder -1.5 pi) -1.50E0)
(num-test (remainder -1.5 2.5) -1.5)
(num-test (remainder -1.5 4.0) -1.5)
(num-test (remainder -1.5 1000.1) -1.5)
(num-test (remainder 3.0 1) 0.0)
(num-test (remainder 3.0 2) 1.0)
(num-test (remainder 3.0 3) 0.0)
(num-test (remainder 3.0 4) 3.0)
(num-test (remainder 3.0 pi) 3.000E0)
(num-test (remainder 3.0 2.5) 0.5)
(num-test (remainder 3.0 4.0) 3.0)
(num-test (remainder 3.0 1000.1) 3.0)
(num-test (remainder 110.123 1) 0.123)
(num-test (remainder 110.123 2) 0.123)
(num-test (remainder 110.123 3) 2.123)
(num-test (remainder 110.123 4) 2.123)
(num-test (remainder 110.123 pi) 1.672571243572413149678281714746183675874E-1)
(num-test (remainder 110.123 2.5) 0.123)
(num-test (remainder 110.123 4.0) 2.123)
(num-test (remainder 110.123 1000.1) 110.123)

(when (provided? 'overflow-checks)
  (num-test (remainder 3/2 most-negative-fixnum) 3/2)
  (num-test (remainder 3/2 most-positive-fixnum) 3/2)
  (num-test (remainder most-negative-fixnum -1) 0))

(test (= (remainder (* 577/408 577/408) 2) (remainder (* 1393/985 1393/985) 2)) #f)
(test (= (remainder 2.0 (* 577/408 577/408)) (remainder (* 1393/985 1393/985) 2.0)) #f)
(test (= (remainder 577/408 1393/985) (floor (/ 577/408 1393/985))) #f)
(test (= (remainder (* 3363/2378 3363/2378) 2) (remainder (* 19601/13860 19601/13860) 2)) #f)
(test (= (remainder 2.0 (* 47321/33461 47321/33461)) (remainder (* 114243/80782 114243/80782) 2.0)) #f)
(test (= (remainder 47321/33461 114243/80782) (floor (/ 47321/33461 114243/80782))) #f)
(test (= (remainder (* 275807/195025 275807/195025) 2) (remainder (* 1607521/1136689 1607521/1136689) 2)) #f)
(test (= (remainder 2.0 (* 275807/195025 275807/195025)) (remainder (* 1607521/1136689 1607521/1136689) 2.0)) #f)
(test (= (remainder 275807/195025 1607521/1136689) (floor (/ 275807/195025 1607521/1136689))) #f)
(test (= (remainder (* 3880899/2744210 3880899/2744210) 2) (remainder (* 9369319/6625109 9369319/6625109) 2)) #f)
(test (= (remainder 2.0 (* 3880899/2744210 3880899/2744210)) (remainder (* 9369319/6625109 9369319/6625109) 2.0)) #f)
(test (= (remainder 3880899/2744210 9369319/6625109) (floor (/ 3880899/2744210 9369319/6625109))) #f)
(test (= (remainder (* 54608393/38613965 54608393/38613965) 2) (remainder (* 131836323/93222358 131836323/93222358) 2)) #f)
(test (= (remainder 2.0 (* 54608393/38613965 54608393/38613965)) (remainder (* 131836323/93222358 131836323/93222358) 2.0)) #f)
(test (= (remainder 54608393/38613965 131836323/93222358) (floor (/ 54608393/38613965 131836323/93222358))) #f)
(if with-bignums (test (= (remainder (* 318281039/225058681 318281039/225058681) 2) (remainder (* 1855077841/1311738121 1855077841/1311738121) 2)) #f))
(if with-bignums (test (= (remainder 2.0 (* 318281039/225058681 318281039/225058681)) (remainder (* 1855077841/1311738121 1855077841/1311738121) 2.0)) #f))
(if with-bignums (test (= (remainder 318281039/225058681 1855077841/1311738121) (floor (/ 318281039/225058681 1855077841/1311738121))) #f))

(num-test (+ (remainder 23/3 3/2) (* 3/2 (quotient 23/3 3/2))) 23/3)
(num-test (+ (remainder 29/8 17/12) (* 17/12 (quotient 29/8 17/12))) 29/8)
(num-test (+ (remainder 164/19 41/29) (* 41/29 (quotient 164/19 41/29))) 164/19)
(num-test (+ (remainder 725/84 99/70) (* 99/70 (quotient 725/84 99/70))) 725/84)
(num-test (+ (remainder 3862/401 577/408) (* 577/408 (quotient 3862/401 577/408))) 3862/401)
(num-test (+ (remainder 4881/1054 1393/985) (* 1393/985 (quotient 4881/1054 1393/985))) 4881/1054)
(num-test (+ (remainder 53963/20511 3363/2378) (* 3363/2378 (quotient 53963/20511 3363/2378))) 53963/20511)
(num-test (+ (remainder 188690/24727 19601/13860) (* 19601/13860 (quotient 188690/24727 19601/13860))) 188690/24727)
(num-test (+ (remainder 959536/125743 47321/33461) (* 47321/33461 (quotient 959536/125743 47321/33461))) 959536/125743)
(num-test (+ (remainder 2606489/301994 114243/80782) (* 114243/80782 (quotient 2606489/301994 114243/80782))) 2606489/301994)
(num-test (+ (remainder 97961303/11350029 275807/195025) (* 275807/195025 (quotient 97961303/11350029 275807/195025))) 97961303/11350029)
(when (provided? 'overflow-checks)
  (num-test (+ (remainder 109303762/16483927 1607521/1136689) (* 1607521/1136689 (quotient 109303762/16483927 1607521/1136689))) 109303762/16483927)
  (num-test (+ (remainder 27869189/17087915 3880899/2744210) (* 3880899/2744210 (quotient 27869189/17087915 3880899/2744210))) 27869189/17087915)
  (num-test (+ (remainder 564541319/85137581 9369319/6625109) (* 9369319/6625109 (quotient 564541319/85137581 9369319/6625109))) 564541319/85137581)
  (num-test (+ (remainder 2351934037/272500658 54608393/38613965) (* 54608393/38613965 (quotient 2351934037/272500658 54608393/38613965))) 2351934037/272500658)
  (num-test (+ (remainder 1657851173/630138897 131836323/93222358) (* 131836323/93222358 (quotient 1657851173/630138897 131836323/93222358))) 1657851173/630138897))

(when with-bignums
  (num-test (remainder -9223372036854775808 5.551115123125783999999999999999999999984E-17) -2.295798100238055639010781305842101573944E-17)
  (num-test (remainder 295147905149568077200 34359738366) 21754858894)
  (num-test (remainder 696898287454081973170944403677937368733396 1180591620717411303422) 314390899110894278354)
  (num-test (remainder 1e19 10) 0.0)
  (num-test (remainder .1e20 10) 0.0)
  (num-test (remainder 1e20 10) 0.0)
  (num-test (remainder 1e21 10) 0.0)
  (num-test (remainder 1e19 -1) 0.0)
  (num-test (remainder 1e19 1) 0.0)
  (num-test (remainder .1e20 1) 0.0)
  (num-test (remainder 1e20 1) 0.0)
  (num-test (remainder 10000000000000000000 1) 0)
  (num-test (remainder 100000000000000000000 1) 0)
  (num-test (remainder 10000000000000000000 10) 0)
  (num-test (remainder 100000000000000000000 10) 0)
  
  (num-test (remainder 9223372036854775807 1/3) 0)
  (num-test (remainder 9223372036854775807 2/3) 1/3)
  (num-test (remainder 922337203685477580 1/3) 0)
  (test (remainder 1361069299753299783990135442290762165844800+i 8281085446358585640) 'error)
  (test (remainder 1231231231231231232123 0.0) 'error)
  (test (remainder 1231231231231231232123 0) 'error)
  
  (test (= (remainder (* 4478554083/3166815962 4478554083/3166815962) 2) 
	   (remainder (* 10812186007/7645370045 10812186007/7645370045) 2)) #f)
  (test (= (remainder 2.0 (* 4478554083/3166815962 4478554083/3166815962)) 
	   (remainder (* 10812186007/7645370045 10812186007/7645370045) 2.0)) #f)
  (test (= (remainder 367296043199/259717522849 886731088897/627013566048) 
	   (floor (/ 367296043199/259717522849 886731088897/627013566048))) #f)
  (test (= (remainder (* 5168247530883/3654502875938 5168247530883/3654502875938) 2) 
	   (remainder (* 12477253282759/8822750406821 12477253282759/8822750406821) 2)) #f)
  (test (= (remainder 2.0 (* 423859315570607/299713796309065 423859315570607/299713796309065)) 
	   (remainder (* 1023286908188737/723573111879672 1023286908188737/723573111879672) 2.0)) #f)
  (test (= (remainder 2.0 (* 34761632124320657/24580185800219268 34761632124320657/24580185800219268)) 
	   (remainder (* 202605639573839043/143263821649299118 202605639573839043/143263821649299118) 2.0)) #f)
  (test (= (remainder 34761632124320657/24580185800219268 202605639573839043/143263821649299118) 
	   (floor (/ 34761632124320657/24580185800219268 202605639573839043/143263821649299118))) #f)
  (test (= (remainder (* 489133282872437279/345869461223138161 489133282872437279/345869461223138161) 2) 
	   (remainder (* 1180872205318713601/835002744095575440 1180872205318713601/835002744095575440) 2)) #f)
  (test (= (remainder (* 2850877693509864481/2015874949414289041 2850877693509864481/2015874949414289041) 2) 
	   (remainder (* 16616132878186749607/11749380235262596085 16616132878186749607/11749380235262596085) 2)) #f)
  (test (= (remainder (* 564459384575477049359/399133058537705128729 564459384575477049359/399133058537705128729) 2) 
	   (remainder (* 1362725501650887306817/963592443113182178088 1362725501650887306817/963592443113182178088) 2)) #f)
  (test (= (remainder 564459384575477049359/399133058537705128729 1362725501650887306817/963592443113182178088) 
	   (floor (/ 564459384575477049359/399133058537705128729 1362725501650887306817/963592443113182178088))) #f)
  (test (= (remainder (* 3289910387877251662993/2326317944764069484905 3289910387877251662993/2326317944764069484905) 2) 
	   (remainder (* 19175002942688032928599/13558774610046711780701 19175002942688032928599/13558774610046711780701) 2)) #f)
  (test (= (remainder (* 46292552162781456490001/32733777552734744709300 46292552162781456490001/32733777552734744709300) 2) 
	   (remainder (* 111760107268250945908601/79026329715516201199301 111760107268250945908601/79026329715516201199301) 2)) #f)
  (test (= (remainder 46292552162781456490001/32733777552734744709300 111760107268250945908601/79026329715516201199301) 
	   (floor (/ 46292552162781456490001/32733777552734744709300 111760107268250945908601/79026329715516201199301))) #f)
  (test (= (remainder (* 269812766699283348307203/190786436983767147107902 269812766699283348307203/190786436983767147107902) 2) 
	   (remainder (* 1572584048032918633353217/1111984844349868137938112 1572584048032918633353217/1111984844349868137938112) 2)) #f)
  (test (= (remainder 269812766699283348307203/190786436983767147107902 1572584048032918633353217/1111984844349868137938112) 
	   (floor (/ 269812766699283348307203/190786436983767147107902 1572584048032918633353217/1111984844349868137938112))) #f)
  
  (num-test (+ (remainder 37496514441/6659027209 318281039/225058681) 
	       (* 318281039/225058681 (quotient 37496514441/6659027209 318281039/225058681))) 37496514441/6659027209)
  (num-test (+ (remainder 74857297149/9809721694 1855077841/1311738121) 
	       (* 1855077841/1311738121 (quotient 74857297149/9809721694 1855077841/1311738121))) 74857297149/9809721694)
  (num-test (+ (remainder 48346261034/10439860591 4478554083/3166815962) 
	       (* 4478554083/3166815962 (quotient 48346261034/10439860591 4478554083/3166815962))) 48346261034/10439860591)
  (num-test (+ (remainder 584312948386/103768467013 10812186007/7645370045) 
	       (* 10812186007/7645370045 (quotient 584312948386/103768467013 10812186007/7645370045))) 584312948386/103768467013)
  (num-test (+ (remainder 1663365607631/217976794617 63018038201/44560482149) 
	       (* 63018038201/44560482149 (quotient 1663365607631/217976794617 63018038201/44560482149))) 1663365607631/217976794617)
  (num-test (+ (remainder 4518285376493/975675645481 152139002499/107578520350) 
	       (* 152139002499/107578520350 (quotient 4518285376493/975675645481 152139002499/107578520350))) 4518285376493/975675645481)
  (num-test (+ (remainder 10302330360665/1193652440098 367296043199/259717522849) 
	       (* 367296043199/259717522849 (quotient 10302330360665/1193652440098 367296043199/259717522849))) 10302330360665/1193652440098)
  (num-test (+ (remainder 73997654926903/8573543875303 886731088897/627013566048) 
	       (* 886731088897/627013566048 (quotient 73997654926903/8573543875303 886731088897/627013566048))) 73997654926903/8573543875303)
  (num-test (+ (remainder 176638380405175/18340740190704 5168247530883/3654502875938) 
	       (* 5168247530883/3654502875938 (quotient 176638380405175/18340740190704 5168247530883/3654502875938))) 176638380405175/18340740190704)
  (num-test (+ (remainder 468100074910801/83130157078217 12477253282759/8822750406821) 
	       (* 12477253282759/8822750406821 (quotient 468100074910801/83130157078217 12477253282759/8822750406821))) 468100074910801/83130157078217)
  (num-test (+ (remainder 843389138467141/517121682660006 30122754096401/21300003689580) 
	       (* 30122754096401/21300003689580 (quotient 843389138467141/517121682660006 30122754096401/21300003689580))) 843389138467141/517121682660006)
  (num-test (+ (remainder 1250127478260940/766512153894657 175568277047523/124145519261542) 
	       (* 175568277047523/124145519261542 (quotient 1250127478260940/766512153894657 175568277047523/124145519261542))) 1250127478260940/766512153894657)
  (num-test (+ (remainder 21963374527647665/6048967074079039 423859315570607/299713796309065) 
	       (* 423859315570607/299713796309065 (quotient 21963374527647665/6048967074079039 423859315570607/299713796309065))) 21963374527647665/6048967074079039)
  (num-test (+ (remainder 45760661301451259/9881527843552324 1023286908188737/723573111879672) 
	       (* 1023286908188737/723573111879672 (quotient 45760661301451259/9881527843552324 1023286908188737/723573111879672))) 45760661301451259/9881527843552324)
  (num-test (+ (remainder 1528546195606366451/177100989030047175 5964153172084899/4217293152016490) 
	       (* 5964153172084899/4217293152016490 (quotient 1528546195606366451/177100989030047175 5964153172084899/4217293152016490))) 1528546195606366451/177100989030047175)
  (num-test (+ (remainder 543933078269123234/206745572560704147 14398739476117879/10181446324101389) 
	       (* 14398739476117879/10181446324101389 (quotient 543933078269123234/206745572560704147 14398739476117879/10181446324101389))) 543933078269123234/206745572560704147)
  (num-test (+ (remainder 4808388068050040138/630118245525664765 34761632124320657/24580185800219268) 
	       (* 34761632124320657/24580185800219268 (quotient 4808388068050040138/630118245525664765 34761632124320657/24580185800219268))) 4808388068050040138/630118245525664765))
  

(test (remainder 123 123 123) 'error)
(test (remainder 123) 'error)
(test (remainder 3 0) 'error)
(test (remainder) 'error)
(test (remainder 2.3 1.0+0.1i) 'error)
(test (remainder 3.0+2.3i 3) 'error)
(test (remainder 3 0.0) 'error)

(for-each
 (lambda (arg)
   (test (remainder arg nan.0) 'error)
   (test (remainder nan.0 arg) 'error)
   (test (remainder arg inf.0) 'error)
   (test (remainder inf.0 arg) 'error)
   (test (remainder arg 2) 'error))
 (list "hi" () (integer->char 65) 0+i #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))

(for-each
 (lambda (arg)
   (test (remainder 2 arg) 'error)
   (test (remainder 2.0 arg) 'error)
   (test (remainder 1/2 arg) 'error)
   (test (remainder 2+i arg) 'error))
 (list "hi" () (integer->char 65) #f #t 0 0+i '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))


(when with-bignums
  (let ((top-exp 60))
    (let ((happy #t))
      (do ((i 2 (+ i 1)))
	  ((or (not happy) (> i top-exp)))
	(let* ((val1 (inexact->exact (expt 2 i)))
	       (val2 (+ val1 1))
	       (mv (modulo val2 2))
	       (qv (quotient val2 2))
	       (rv (remainder val2 2)))
	  (if (not (= mv 1))
	      (begin (set! happy #f) (display "(modulo ") (display val2) (display " 2) = ") (display mv) (display "?") (newline)))
	  (if (not (= qv (/ val1 2)))
	      (begin (set! happy #f) (display "(quotient ") (display val2) (display " 2) = ") (display qv) (display "?") (newline)))
	  (if (not (= rv 1))
	      (begin (set! happy #f) (display "(remainder ") (display val2) (display " 2) = ") (display rv) (display "?") (newline))))))
    
    (let ((happy #t))
      (do ((i 2 (+ i 1)))
	  ((or (not happy) (> i top-exp)))
	(let* ((val1 (inexact->exact (expt 2 i)))
	       (val2 (/ (+ val1 1) 2))
	       (mv (modulo val2 2))
	       (qv (quotient val2 2))
	       (rv (remainder val2 2)))
	  (if (not (= mv 1/2))
	      (begin (set! happy #f) (display "(modulo ") (display val2) (display " 2) = ") (display mv) (display "?") (newline)))
	  (if (not (= qv (/ val1 4)))
	      (begin (set! happy #f) (display "(quotient ") (display val2) (display " 2) = ") (display qv) (display "?") (newline)))
	  (if (not (= rv 1/2))
	      (begin (set! happy #f) (display "(remainder ") (display val2) (display " 2) = ") (display rv) (display "?") (newline))))))))

(unless with-bignums
  (test (remainder 1e20 10) 'error)
  (test (quotient 1e20 10) 'error))




;;; --------------------------------------------------------------------------------
;;; gcd
;;; --------------------------------------------------------------------------------

(num-test (gcd (* 512 500057) (* 128 500057) (* 2048 500057)) 64007296)
(num-test (gcd (- (expt 2 11) 1) (- (expt 2 19) 1)) (- (expt 2 (gcd 11 19)) 1))
(num-test (gcd (- (expt 2 11) 1) (- (expt 2 22) 1)) (- (expt 2 (gcd 11 22)) 1))
(num-test (gcd (- (expt 2 12) 1) (- (expt 2 18) 1)) (- (expt 2 (gcd 12 18)) 1))
(num-test (gcd (- (expt 2 52) 1) (- (expt 2 39) 1)) (- (expt 2 (gcd 52 39)) 1))
(num-test (gcd (numerator 7/9) (denominator 7/9)) 1)
(num-test (gcd -1 -1) 1)
(num-test (gcd -1 -10) 1)
(num-test (gcd -1 -1234) 1)
(num-test (gcd -1 -1234000000) 1)
(num-test (gcd -1 -2) 1)
(num-test (gcd -1 -3) 1)
(num-test (gcd -1 -362880) 1)
(num-test (gcd -1 -500029) 1)
(num-test (gcd -1 0) 1)
(num-test (gcd -1 1) 1)
(num-test (gcd -1 10) 1)
(num-test (gcd -1 1234) 1)
(num-test (gcd -1 1234000000) 1)
(num-test (gcd -1 2) 1)
(num-test (gcd -1 3) 1)
(num-test (gcd -1 362880) 1)
(num-test (gcd -1 500029) 1)
(num-test (gcd -1) 1)
(num-test (gcd -10 -1) 1)
(num-test (gcd -10 -10) 10)
(num-test (gcd -10 -1234) 2)
(num-test (gcd -10 -1234000000) 10)
(num-test (gcd -10 -2) 2)
(num-test (gcd -10 -3) 1)
(num-test (gcd -10 -362880) 10)
(num-test (gcd -10 -500029) 1)
(num-test (gcd -10 0) 10)
(num-test (gcd -10 1) 1)
(num-test (gcd -10 10) 10)
(num-test (gcd -10 1234) 2)
(num-test (gcd -10 1234000000) 10)
(num-test (gcd -10 2) 2)
(num-test (gcd -10 3) 1)
(num-test (gcd -10 362880) 10)
(num-test (gcd -10 500029) 1)
(num-test (gcd -10) 10)
(num-test (gcd -1234 -1) 1)
(num-test (gcd -1234 -10) 2)
(num-test (gcd -1234 -1234) 1234)
(num-test (gcd -1234 -1234000000) 1234)
(num-test (gcd -1234 -2) 2)
(num-test (gcd -1234 -3) 1)
(num-test (gcd -1234 -362880) 2)
(num-test (gcd -1234 -500029) 1)
(num-test (gcd -1234 0) 1234)
(num-test (gcd -1234 1) 1)
(num-test (gcd -1234 10) 2)
(num-test (gcd -1234 1234) 1234)
(num-test (gcd -1234 1234000000) 1234)
(num-test (gcd -1234 2) 2)
(num-test (gcd -1234 3) 1)
(num-test (gcd -1234 362880) 2)
(num-test (gcd -1234 500029) 1)
(num-test (gcd -1234) 1234)
(num-test (gcd -1234000000 -1) 1)
(num-test (gcd -1234000000 -10) 10)
(num-test (gcd -1234000000 -1234) 1234)
(num-test (gcd -1234000000 -1234000000) 1234000000)
(num-test (gcd -1234000000 -2) 2)
(num-test (gcd -1234000000 -3) 1)
(num-test (gcd -1234000000 -362880) 640)
(num-test (gcd -1234000000 -500029) 1)
(num-test (gcd -1234000000 0) 1234000000)
(num-test (gcd -1234000000 1) 1)
(num-test (gcd -1234000000 10) 10)
(num-test (gcd -1234000000 1234) 1234)
(num-test (gcd -1234000000 1234000000) 1234000000)
(num-test (gcd -1234000000 2) 2)
(num-test (gcd -1234000000 3) 1)
(num-test (gcd -1234000000 362880) 640)
(num-test (gcd -1234000000 500029) 1)
(num-test (gcd -1234000000) 1234000000)
(num-test (gcd -2 -1) 1)
(num-test (gcd -2 -10) 2)
(num-test (gcd -2 -1234) 2)
(num-test (gcd -2 -1234000000) 2)
(num-test (gcd -2 -2) 2)
(num-test (gcd -2 -3) 1)
(num-test (gcd -2 -362880) 2)
(num-test (gcd -2 -500029) 1)
(num-test (gcd -2 0) 2)
(num-test (gcd -2 1) 1)
(num-test (gcd -2 10) 2)
(num-test (gcd -2 1234) 2)
(num-test (gcd -2 1234000000) 2)
(num-test (gcd -2 2) 2)
(num-test (gcd -2 3) 1)
(num-test (gcd -2 362880) 2)
(num-test (gcd -2 500029) 1)
(num-test (gcd -2) 2)
(num-test (gcd -3 -1) 1)
(num-test (gcd -3 -10) 1)
(num-test (gcd -3 -1234) 1)
(num-test (gcd -3 -1234000000) 1)
(num-test (gcd -3 -2) 1)
(num-test (gcd -3 -3) 3)
(num-test (gcd -3 -362880) 3)
(num-test (gcd -3 -500029) 1)
(num-test (gcd -3 0) 3)
(num-test (gcd -3 1) 1)
(num-test (gcd -3 10) 1)
(num-test (gcd -3 1234) 1)
(num-test (gcd -3 1234000000) 1)
(num-test (gcd -3 2) 1)
(num-test (gcd -3 3) 3)
(num-test (gcd -3 362880) 3)
(num-test (gcd -3 500029) 1)
(num-test (gcd -3) 3)
(num-test (gcd -362880 -1) 1)
(num-test (gcd -362880 -10) 10)
(num-test (gcd -362880 -1234) 2)
(num-test (gcd -362880 -1234000000) 640)
(num-test (gcd -362880 -2) 2)
(num-test (gcd -362880 -3) 3)
(num-test (gcd -362880 -362880) 362880)
(num-test (gcd -362880 -500029) 1)
(num-test (gcd -362880 0) 362880)
(num-test (gcd -362880 0) 362880)
(num-test (gcd -362880 1) 1)
(num-test (gcd -362880 10) 10)
(num-test (gcd -362880 1234) 2)
(num-test (gcd -362880 1234000000) 640)
(num-test (gcd -362880 2) 2)
(num-test (gcd -362880 3) 3)
(num-test (gcd -362880 362880) 362880)
(num-test (gcd -362880 500029) 1)
(num-test (gcd -362880) 362880)
(num-test (gcd -4 0) 4 )
(num-test (gcd -500029 -1) 1)
(num-test (gcd -500029 -10) 1)
(num-test (gcd -500029 -1234) 1)
(num-test (gcd -500029 -1234000000) 1)
(num-test (gcd -500029 -2) 1)
(num-test (gcd -500029 -3) 1)
(num-test (gcd -500029 -362880) 1)
(num-test (gcd -500029 -500029) 500029)
(num-test (gcd -500029 0) 500029)
(num-test (gcd -500029 0) 500029)
(num-test (gcd -500029 1) 1)
(num-test (gcd -500029 10) 1)
(num-test (gcd -500029 1234) 1)
(num-test (gcd -500029 1234000000) 1)
(num-test (gcd -500029 2) 1)
(num-test (gcd -500029 3) 1)
(num-test (gcd -500029 362880) 1)
(num-test (gcd -500029 500029) 500029)
(num-test (gcd -500029) 500029)
(num-test (gcd 0 -1) 1)
(num-test (gcd 0 -10) 10)
(num-test (gcd 0 -1234) 1234)
(num-test (gcd 0 -1234000000) 1234000000)
(num-test (gcd 0 -2) 2)
(num-test (gcd 0 -3) 3)
(num-test (gcd 0 -362880) 362880)
(num-test (gcd 0 -500029) 500029)
(num-test (gcd 0 0 0 10) 10)
(num-test (gcd 0 0) 0)
(num-test (gcd 0 1 -1 362880) 1)
(num-test (gcd 0 1) 1)
(num-test (gcd 0 10 10 1234) 2)
(num-test (gcd 0 10) 10)
(num-test (gcd 0 1234 -1234 10) 2)
(num-test (gcd 0 1234) 1234)
(num-test (gcd 0 1234000000 1234000000 -3) 1)
(num-test (gcd 0 1234000000) 1234000000)
(num-test (gcd 0 2 2 -500029) 1)
(num-test (gcd 0 2) 2)
(num-test (gcd 0 2) 2)
(num-test (gcd 0 3 -3 -1234000000) 1)
(num-test (gcd 0 3) 3)
(num-test (gcd 0 362880 362880 1) 1)
(num-test (gcd 0 362880) 362880)
(num-test (gcd 0 4) 4 )
(num-test (gcd 0 500029 -500029 -2) 1)
(num-test (gcd 0 500029) 500029)
(num-test (gcd 0) 0)
(num-test (gcd 1 -1) 1)
(num-test (gcd 1 -10) 1)
(num-test (gcd 1 -1234) 1)
(num-test (gcd 1 -1234000000) 1)
(num-test (gcd 1 -2) 1)
(num-test (gcd 1 -3) 1)
(num-test (gcd 1 -362880) 1)
(num-test (gcd 1 -500029) 1)
(num-test (gcd 1 0 -1 1) 1)
(num-test (gcd 1 0) 1)
(num-test (gcd 1 1 2 -10) 1)
(num-test (gcd 1 1) 1)
(num-test (gcd 1 10 -1234 1234000000) 1)
(num-test (gcd 1 10) 1)
(num-test (gcd 1 1234 1234000000 -1234) 1)
(num-test (gcd 1 1234) 1)
(num-test (gcd 1 1234000000 -500029 -10) 1)
(num-test (gcd 1 1234000000) 1)
(num-test (gcd 1 2 -3 -362880) 1)
(num-test (gcd 1 2) 1)
(num-test (gcd 1 3 10 500029) 1)
(num-test (gcd 1 3) 1)
(num-test (gcd 1 362880 0 2) 1)
(num-test (gcd 1 362880) 1)
(num-test (gcd 1 500029 362880 3) 1)
(num-test (gcd 1 500029) 1)
(num-test (gcd 1) 1)
(num-test (gcd 1/10 1/1000000000) 1/1000000000)
(num-test (gcd 1/1024 1/9765625) 1/10000000000)
(num-test (gcd 1/131072 1/762939453125) 1/100000000000000000)
(num-test (gcd 1/2 1/3) 1/6)
(num-test (gcd 1/2 2) 1/2)
(num-test (gcd 1/262144 1/3814697265625) 1/1000000000000000000)
(num-test (gcd 1/3 1/6 5/12 2) 1/12)
(num-test (gcd 1/3 1/6 5/12) 1/12)
(num-test (gcd 1/3 2/3) 1/3)
(num-test (gcd 1/3 3/4 5/8) 1/24)
(num-test (gcd 1/3 3/4) 1/12)
(num-test (gcd 10 -1) 1)
(num-test (gcd 10 -10) 10)
(num-test (gcd 10 -1234) 2)
(num-test (gcd 10 -1234000000) 10)
(num-test (gcd 10 -2) 2)
(num-test (gcd 10 -3) 1)
(num-test (gcd 10 -362880) 10)
(num-test (gcd 10 -500029) 1)
(num-test (gcd 10 0 10 10) 10)
(num-test (gcd 10 0) 10)
(num-test (gcd 10 1 -1234 3) 1)
(num-test (gcd 10 1) 1)
(num-test (gcd 10 10 362880 10) 10)
(num-test (gcd 10 10) 10)
(num-test (gcd 10 1234 0 362880) 2)
(num-test (gcd 10 1234) 2)
(num-test (gcd 10 1234000000 1 -500029) 1)
(num-test (gcd 10 1234000000) 10)
(num-test (gcd 10 2 1234000000 -2) 2)
(num-test (gcd 10 2) 2)
(num-test (gcd 10 3 -500029 -1) 1)
(num-test (gcd 10 3) 1)
(num-test (gcd 10 362880 3 1234) 1)
(num-test (gcd 10 362880) 10)
(num-test (gcd 10 500029 -2 -1234000000) 1)
(num-test (gcd 10 500029) 1)
(num-test (gcd 10) 10)
(num-test (gcd 1008217762344 4403) 37)
(num-test (gcd 1111364125679340 6) 6)
(num-test (gcd 1200780158492850 91686) 354)
(num-test (gcd 1234 -1) 1)
(num-test (gcd 1234 -10) 2)
(num-test (gcd 1234 -1234) 1234)
(num-test (gcd 1234 -1234000000) 1234)
(num-test (gcd 1234 -2) 2)
(num-test (gcd 1234 -3) 1)
(num-test (gcd 1234 -362880) 2)
(num-test (gcd 1234 -500029) 1)
(num-test (gcd 1234 0 -1234 1234) 1234)
(num-test (gcd 1234 0) 1234)
(num-test (gcd 1234 1 1234000000 -10) 1)
(num-test (gcd 1234 1) 1)
(num-test (gcd 1234 10 0 1) 1)
(num-test (gcd 1234 10) 2)
(num-test (gcd 1234 1234 1 -10) 1)
(num-test (gcd 1234 1234) 1234)
(num-test (gcd 1234 1234000000 -2 -362880) 2)
(num-test (gcd 1234 1234000000) 1234)
(num-test (gcd 1234 2 -500029 -3) 1)
(num-test (gcd 1234 2) 2)
(num-test (gcd 1234 3 362880 2) 1)
(num-test (gcd 1234 3) 1)
(num-test (gcd 1234 362880 -10 1234000000) 2)
(num-test (gcd 1234 362880) 2)
(num-test (gcd 1234 500029 3 500029) 1)
(num-test (gcd 1234 500029) 1)
(num-test (gcd 1234) 1234)
(num-test (gcd 1234000000 -1) 1)
(num-test (gcd 1234000000 -10) 10)
(num-test (gcd 1234000000 -1234) 1234)
(num-test (gcd 1234000000 -1234000000) 1234000000)
(num-test (gcd 1234000000 -2) 2)
(num-test (gcd 1234000000 -3) 1)
(num-test (gcd 1234000000 -362880) 640)
(num-test (gcd 1234000000 -500029) 1)
(num-test (gcd 1234000000 0 1234000000 -1234000000) 1234000000)
(num-test (gcd 1234000000 0) 1234000000)
(num-test (gcd 1234000000 1 -500029 -1234) 1)
(num-test (gcd 1234000000 1) 1)
(num-test (gcd 1234000000 10 1 -2) 1)
(num-test (gcd 1234000000 10) 10)
(num-test (gcd 1234000000 1234 -2 -1) 1)
(num-test (gcd 1234000000 1234) 1234)
(num-test (gcd 1234000000 1234000000 3 10) 1)
(num-test (gcd 1234000000 1234000000) 1234000000)
(num-test (gcd 1234000000 2 362880 10) 2)
(num-test (gcd 1234000000 2) 2)
(num-test (gcd 1234000000 3 0 3) 1)
(num-test (gcd 1234000000 3) 1)
(num-test (gcd 1234000000 362880 1234 -500029) 1)
(num-test (gcd 1234000000 362880) 640)
(num-test (gcd 1234000000 500029 -10 362880) 1)
(num-test (gcd 1234000000 500029) 1)
(num-test (gcd 1234000000) 1234000000)
(num-test (gcd 1346702251365156 435) 87)
(num-test (gcd 136581511784536 67022) 62)
(num-test (gcd 1388225063690465 644) 7)
(num-test (gcd 15295874 111) 37)
(num-test (gcd 1551193257090906 2656731) 1749)
(num-test (gcd 1563464979842 442) 34)
(num-test (gcd 15858537083857314 21793) 21793)
(num-test (gcd 163873565922 155) 31)
(num-test (gcd 178335507754891305 817) 817)
(num-test (gcd 2 -1) 1)
(num-test (gcd 2 -10) 2)
(num-test (gcd 2 -1234) 2)
(num-test (gcd 2 -1234000000) 2)
(num-test (gcd 2 -2) 2)
(num-test (gcd 2 -3) 1)
(num-test (gcd 2 -362880) 2)
(num-test (gcd 2 -500029) 1)
(num-test (gcd 2 0 2 -2) 2)
(num-test (gcd 2 0) 2)
(num-test (gcd 2 1 -3 -1) 1)
(num-test (gcd 2 1) 1)
(num-test (gcd 2 10 1234000000 -500029) 1)
(num-test (gcd 2 10) 2)
(num-test (gcd 2 1234 -500029 -1234000000) 1)
(num-test (gcd 2 1234) 2)
(num-test (gcd 2 1234000000 362880 1234) 2)
(num-test (gcd 2 1234000000) 2)
(num-test (gcd 2 2 10 10) 2)
(num-test (gcd 2 2) 2)
(num-test (gcd 2 3 -1234 362880) 1)
(num-test (gcd 2 3) 1)
(num-test (gcd 2 3/4) 1/4)
(num-test (gcd 2 362880 1 -3) 1)
(num-test (gcd 2 362880) 2)
(num-test (gcd 2 500029 0 10) 1)
(num-test (gcd 2 500029) 1)
(num-test (gcd 2) 2)
(num-test (gcd 2033404107084 23374) 2)
(num-test (gcd 20430054 41) 41)
(num-test (gcd 2090198664 1118) 2)
(num-test (gcd 21568911 41) 41)
(num-test (gcd 248255254 767) 13)
(num-test (gcd 2755 13) 1)
(num-test (gcd 3 -1) 1)
(num-test (gcd 3 -10) 1)
(num-test (gcd 3 -1234) 1)
(num-test (gcd 3 -1234000000) 1)
(num-test (gcd 3 -2) 1)
(num-test (gcd 3 -3) 3)
(num-test (gcd 3 -362880) 3)
(num-test (gcd 3 -500029) 1)
(num-test (gcd 3 0 -3 -3) 3)
(num-test (gcd 3 0) 3)
(num-test (gcd 3 1 10 2) 1)
(num-test (gcd 3 1) 1)
(num-test (gcd 3 10 -500029 -362880) 1)
(num-test (gcd 3 10) 1)
(num-test (gcd 3 1234 362880 500029) 1)
(num-test (gcd 3 1234) 1)
(num-test (gcd 3 1234000000 0 1234000000) 1)
(num-test (gcd 3 1234000000) 1)
(num-test (gcd 3 2 -1234 1) 1)
(num-test (gcd 3 2) 1)
(num-test (gcd 3 3 1234000000 -10) 1)
(num-test (gcd 3 3) 3)
(num-test (gcd 3 362880 -2 -10) 1)
(num-test (gcd 3 362880) 3)
(num-test (gcd 3 500029 1 -1234) 1)
(num-test (gcd 3 500029) 1)
(num-test (gcd 3) 3)
(num-test (gcd 3/4 2) 1/4)
(num-test (gcd 32 -36) 4 )
(num-test (gcd 323 28747 27113) 19)
(num-test (gcd 3333 -33 1002001) 11)
(num-test (gcd 3333 -33 101) 1)
(num-test (gcd 362880 -1) 1)
(num-test (gcd 362880 -10) 10)
(num-test (gcd 362880 -1234) 2)
(num-test (gcd 362880 -1234000000) 640)
(num-test (gcd 362880 -2) 2)
(num-test (gcd 362880 -3) 3)
(num-test (gcd 362880 -362880) 362880)
(num-test (gcd 362880 -500029) 1)
(num-test (gcd 362880 0 362880 362880) 362880)
(num-test (gcd 362880 0) 362880)
(num-test (gcd 362880 1 0 500029) 1)
(num-test (gcd 362880 1) 1)
(num-test (gcd 362880 10 3 10) 1)
(num-test (gcd 362880 10) 10)
(num-test (gcd 362880 1234 -10 3) 1)
(num-test (gcd 362880 1234) 2)
(num-test (gcd 362880 1234000000 1234 -2) 2)
(num-test (gcd 362880 1234000000) 640)
(num-test (gcd 362880 2 1 -1234000000) 1)
(num-test (gcd 362880 2) 2)
(num-test (gcd 362880 3 -2 -1234) 1)
(num-test (gcd 362880 3) 3)
(num-test (gcd 362880 362880 500029 10) 1)
(num-test (gcd 362880 362880) 362880)
(num-test (gcd 362880 500029 -1234000000 -1) 1)
(num-test (gcd 362880 500029) 1)
(num-test (gcd 362880) 362880)
(num-test (gcd 363169800 20) 20)
(num-test (gcd 3712337724 576173) 23)
(num-test (gcd 386512944051107445 17) 17)
(num-test (gcd 406117800 57) 3)
(num-test (gcd 4097970629150 86) 2)
(num-test (gcd 4294967298 3) 3)
(num-test (gcd 43293168048 1344610) 2)
(num-test (gcd 4380921044390 5) 5)
(num-test (gcd 4412914630225794 515823) 46893)
(num-test (gcd 44179338013272 280645) 41)
(num-test (gcd 500029 -1) 1)
(num-test (gcd 500029 -10) 1)
(num-test (gcd 500029 -1234) 1)
(num-test (gcd 500029 -1234000000) 1)
(num-test (gcd 500029 -2) 1)
(num-test (gcd 500029 -3) 1)
(num-test (gcd 500029 -362880) 1)
(num-test (gcd 500029 -500029) 500029)
(num-test (gcd 500029 0 -500029 -500029) 500029)
(num-test (gcd 500029 0) 500029)
(num-test (gcd 500029 0) 500029)
(num-test (gcd 500029 1 362880 1234000000) 1)
(num-test (gcd 500029 1) 1)
(num-test (gcd 500029 10 -2 -3) 1)
(num-test (gcd 500029 10) 1)
(num-test (gcd 500029 1234 3 2) 1)
(num-test (gcd 500029 1234) 1)
(num-test (gcd 500029 1234000000 -10 1) 1)
(num-test (gcd 500029 1234000000) 1)
(num-test (gcd 500029 2 0 1234) 1)
(num-test (gcd 500029 2) 1)
(num-test (gcd 500029 3 1 -10) 1)
(num-test (gcd 500029 3) 1)
(num-test (gcd 500029 362880 -1234000000 -362880) 1)
(num-test (gcd 500029 362880) 1)
(num-test (gcd 500029 500029 1234 -10) 1)
(num-test (gcd 500029 500029) 500029)
(num-test (gcd 500029) 500029)
(num-test (gcd 510104442 5453) 1)
(num-test (gcd 524288/5 19073486328125/2) 1/10)
(num-test (gcd 5275411661289 31857) 21)
(num-test (gcd 56 2) 2)
(num-test (gcd 60 42) 6)
(num-test (gcd 608503422693864 47) 47)
(num-test (gcd 629448534 2) 2)
(num-test (gcd 63 -42 35) 7)
(num-test (gcd 64149298745840 43808357) 35131)
(num-test (gcd 660070972 74) 74)
(num-test (gcd 6945109296864 779) 19)
(num-test (gcd 71862 203) 203)
(num-test (gcd 7438317458260 31213) 13)
(num-test (gcd 77874422 32223899) 1)
(num-test (gcd 82578867500655 319) 29)
(num-test (gcd 91 -49) 7)
(num-test (gcd 91 -49) 7)
(num-test (gcd) 0 )
(num-test (gcd) 0)
(num-test (gcd 9223372036854775807 -9223372036854775808) 1)

(num-test (gcd 10400200/16483927 1607521/1136689) 1/18737098497703)
(num-test (gcd 10781274/17087915 3880899/2744210) 3/9378565444430)
(num-test (gcd 12/19 41/29) 1/551)
(num-test (gcd 12941/20511 3363/2378) 1/48775158)
(num-test (gcd 15601/24727 19601/13860) 1/342716220)
(num-test (gcd 171928773/272500658 54608393/38613965) 1/10522330870488970)
(num-test (gcd 190537/301994 114243/80782) 1/12197839654)
(num-test (gcd 2/3 3/2) 1/6)
(num-test (gcd 253/401 577/408) 1/163608)
(num-test (gcd 397573379/630138897 131836323/93222358) 1/58743033845859126)
(num-test (gcd 4201378396/6659027209 318281039/225058681) 1/1498671880400651329)
(num-test (gcd 5/8 17/12) 1/24)
(num-test (gcd 53/84 99/70) 1/420)
(num-test (gcd 53715833/85137581 9369319/6625109) 1/564045754121329)
(num-test (gcd 665/1054 1393/985) 7/1038190)
(num-test (gcd 7161071/11350029 275807/195025) 1/2213539405725)
(num-test (gcd 79335/125743 47321/33461) 1/4207486523)

(num-test (gcd -2305843009213693952/4611686018427387903) 2305843009213693952/4611686018427387903)

(test (gcd 0 "hi") 'error)
(test (gcd 1 "hi") 'error)
(test (gcd 3 5 #\a) 'error)
(test (gcd 1.4 2.3) 'error)
(test (gcd 1.0) 'error)
(test (gcd 0/0) 'error)
(test (gcd 2 1.0+0.5i) 'error)

(for-each
 (lambda (arg)
   (test (gcd arg nan.0) 'error)
   (test (gcd nan.0 arg) 'error)
   (test (gcd arg inf.0) 'error)
   (test (gcd inf.0 arg) 'error)
   (test (gcd arg 2) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))

(for-each
 (lambda (arg)
   (test (gcd 2 arg) 'error)
   (test (gcd 1/2 arg) 'error)
   (test (gcd 2.0 arg) 'error)
   (test (gcd 2+i arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))

(when with-bignums 
  (num-test (gcd -9223372036854775808 -9223372036854775808) 9223372036854775808)
  (num-test (gcd -9223372036854775808 9223372036854775807 -9223372036854775808) 1)
  (num-test (gcd 12345678901234567890 12345) 15)
  (num-test (gcd 2155967190204955525121 -12850565775361 93458656690177) 557057)
  (num-test (gcd 2155967190204955525121 0) 2155967190204955525121)
  (num-test (gcd 2155967190204955525121 12850565775361 93458656690177) 557057)
  (num-test (gcd 2346026393680644703525505657 17293822570713318399) 11)
  (num-test (gcd 974507656412513757857315037382926980395082974811562770185617915360 -1539496810360685510909469177732386446833404488164283) 1)
  (num-test (gcd 460683358924445799142 518) 518)
  (num-test (gcd 113021475230160 74635) 6785)
  (num-test (gcd 74228340534140364 363909) 1677)
  (num-test (gcd 69242022961311060 48305942) 60458)
  (num-test (gcd -286967952870300 2273388) 156)
  (num-test (gcd 302822258393413362492399 29) 29)
  (num-test (gcd 10491072879382200 133) 133)
  (num-test (gcd 167206737423420464 609) 7)
  (num-test (gcd 72212583812867784 4888799) 47)
  (num-test (gcd 4170116471639397292390 1798025) 359605)
  (num-test (gcd 83910330283522050 35224) 238)
  (num-test (gcd 275373383775647594346 66884092) 104834)
  (num-test (gcd 14656657495570695990 37) 1)
  (num-test (gcd 95470974177676509874110 1219) 1219)
  (num-test (gcd 619506317623001424 -5957) 7)
  (num-test (gcd 11268171656665155960 9858) 186)
  (num-test (gcd 6172860073826160 5167394) 3074)
  (num-test (gcd 26457493095663264 1491412) 3956)
  (num-test (gcd -8481384175941103284 313836405) 51)
  (num-test (gcd 60356595775749199080 -176098815946) 1716346)
  (num-test (gcd 611492274956002440 37) 37)
  (num-test (gcd 164614611843685080 1711) 59)
  (num-test (gcd 93177516542679418720 62197) 37)
  (num-test (gcd 938959746797519770440 127558) 127558)
  (num-test (gcd 137670522526899326250 200) 50)
  (num-test (gcd 852063402206742880 41643478) 58406)
  (num-test (gcd 55947291202307909360 188546228) 6364)
  (num-test (gcd 12877971214039423262680 9832253830) 121730)
  (num-test (gcd 192158415774146059920 53) 53)
  (num-test (gcd 902814024155808960 1829) 31)
  (num-test (gcd 1265864304573235487120 4921) 259)
  (num-test (gcd -14172662463567665400 95817) 57)
  (num-test (gcd 32171996211745702482324 2368555) 259)
  (num-test (gcd 971324258606045826300 4576748) 236)
  (num-test (gcd 2400649320046378377000 1704690) 930)
  (num-test (gcd 953233796456393760 18342152493) 574287)
  (num-test (gcd 28906333140964843080 236206740) 823020)
  (num-test (gcd 775403093708557121609032 41) 41)
  (num-test (gcd 12587009808135760402860 2491) 47)
  (num-test (gcd 510685807527370566909720 76) 4)
  (num-test (gcd 9842598153710524682146590 10089) 3363)
  (num-test (gcd 44936631038618189620242012 30740) 6148)
  (num-test (gcd 934589372977008750144 373650) 282)
  (num-test (gcd 33027125273398900134069150 840577803) 840577803)
  (num-test (gcd 4428219127938822420288 1695783782) 12502)
  (num-test (gcd 29316428815807608915440 560764380) 153340)
  (num-test (gcd 1364397376360544429904 19) 19)
  (num-test (gcd 4991450791697293128313385277 329) 7)
  (num-test (gcd 75448279792981695149550 3009) 3)
  (num-test (gcd 181031604499464166188731133 3364) 1)
  (num-test (gcd 405831142402606479845286 2746214) 161542)
  (num-test (gcd 89170366469003867207160 25337230) 11470)
  (num-test (gcd 13523725766340619200 1490114045) 28595)
  (num-test (gcd 104705939487154940255412 192200052) 26196)
  (num-test (gcd 7232591421499800642000 16584679460) 7820)
  (num-test (gcd 14043796716396386984750160 -33382708236) 358953852)
  (num-test (gcd 13894638105872256412416 23) 23)
  (num-test (gcd 147611447155643499428400 118) 2)
  (num-test (gcd 13356594697070649024 4558) 106)
  (num-test (gcd 15089731174706036171537760 90) 30)
  (num-test (gcd 307230141273924828960 1971507) 1581)
  (num-test (gcd 2582563944548247741930009096 22873474) 1759498)
  (num-test (gcd 1074296602920111687342072 146235518) 21758)
  (num-test (gcd 774058642832724262993980 -407557010) 2531410)
  (num-test (gcd 291091930213008490369569480 13412544348) 26508)
  (num-test (gcd 2089068565149831833568 7302038455228) 68171356)
  (num-test (gcd 1064437567441124038217970656 5) 1)
  (num-test (gcd 142557826750459447787460 1333) 31)
  (num-test (gcd 311779340580033594160200 23693) 23693)
  (num-test (gcd 29314187023691666530559664 110143) 110143)
  (num-test (gcd 222003853016244177637944900 857463) 857463)
  (num-test (gcd 6247776111945111006243552 77976501) 2515371)
  (num-test (gcd 1140058514761397155259712 5530338) 502758)
  (num-test (gcd 580962736822969724865449808 55686036) 1505028)
  (num-test (gcd 4100502596989506786787500 45333475410) 563730)
  (num-test (gcd 1497378750311599979536944 262630276090) 361046)
  (num-test (gcd 105637634198318524045536 2633013240) 150072)
  (num-test (gcd 11415822547029425161364106595632 7) 1)
  (num-test (gcd 198305933339312916107438448 177) 3)
  (num-test (gcd 3127415425979879537134790928 3335) 667)
  (num-test (gcd 589703503861221139260034914750 13209) 357)
  (num-test (gcd 3108579252052448504121792 14322) 462)
  (num-test (gcd 636976201153021006473464400 66264077) 3487583)
  (num-test (gcd 9544425315508129998909285900 1488396) 212628)
  (num-test (gcd 458100280193857502802977376 260747103934) 6212554)
  (num-test (gcd 114208186302155358124900650 22076867505) 6342105)
  (num-test (gcd 90107067439719108194114160 28566806069714) 3408519994)
  (num-test (gcd 2976572787365723002218245484 -110104803958578) 2966904798)
  (num-test (gcd 53453375725613238735360 17) 1)
  (num-test (gcd 888822833524306124874229800 106) 106)
  (num-test (gcd 21275338550698297089687698855820 3021) 3021)
  (num-test (gcd 417525245705449941528380320750068 5828) 5828)
  (num-test (gcd 1954871230146370370001829871352 22765249) 22765249)
  (num-test (gcd 903057827710908645847577520 648545995) 520085)
  (num-test (gcd 6002846634833433581621040 28493572159) 27869)
  (num-test (gcd 26428903214964558277189300080 100428856) 3463064)
  (num-test (gcd 470486531607553676511206181180 28495896) 2964)
  (num-test (gcd 483599554429365539310928369206620 5577334078910) 105232718470)
  (num-test (gcd 134511400157705323668887400 -1285071093558916) 340069628)
  (num-test (gcd -25897125642468049125349982599216 1183846707540) 26307704612)
  (num-test (gcd 1118034209930460291955200 3) 3)
  (num-test (gcd 16297594064835666104344589410644 413) 413)
  (num-test (gcd 536762539932642345554192060100 1378) 1378)
  (num-test (gcd 933250179448203335817687635834340 58029) 69)
  (num-test (gcd 65573457048202714607131200 486115) 3655)
  (num-test (gcd 85664559165674439863772868932 322014) 322014)
  (num-test (gcd 7232817686074320060728552759760 11307940) 11307940)
  (num-test (gcd 78400098291720425971762131120 5646921093) 5646921093)
  (num-test (gcd 345445746644065669842240 19727989065) 2193705)
  (num-test (gcd 627854758484491743169777558200 -750371721805653) 156322329)
  (num-test (gcd 788233263079483492974876830792850 7170146100) 5867550)
  (num-test (gcd 18378856389802641496737518160 6247594493140) 824329660)
  (num-test (gcd 9620902642431357480148667659080 59) 59)
  (num-test (gcd 16008524600631853118144316000 629) 1)
  (num-test (gcd 4342138447708715023205684275423920 53041) 1711)
  (num-test (gcd 2431833161592653384508687244500 47541) 47541)
  (num-test (gcd 39424620224103957589082132160 1671734) 1671734)
  (num-test (gcd 652830233576052788654372406432 552231327) 12842589)
  (num-test (gcd 6892963340916411083970414000 3662431431) 77924073)
  (num-test (gcd 29102758215190063506219566460000 10565720) 10565720)
  (num-test (gcd 21253900104556838003127171970777418412 1182797770) 62698)
  (num-test (gcd 3964268932242030284914943132662620 21244177854110) 18521515130)
  (num-test (gcd 6070388091189460078138338240 40809131994181213) 274113073169)
  (num-test (gcd 9685989954133695108793384134000 964113514382876) 169529367748)
  (num-test (gcd 56468122001858834917195045500 -429400787158167902) 2090772606538)
  (num-test (gcd 18843408973202596901221568364900 47) 47)
  (num-test (gcd 7800980538292163259967028613764250 6) 6)
  (num-test (gcd 270433907726619219545089642715200 3422) 58)
  (num-test (gcd 45771666919597903071546708768 2342359) 2183)
  (num-test (gcd 47198294949461301503537593835384892 314502) 5934)
  (num-test (gcd 3165335901519110207943908102359110 14953473) 207)
  (num-test (gcd 189219585097956261544520863361400 35605794) 35605794)
  (num-test (gcd -38532137569034426600955256933810890813 -1341358608707) 6436369)
  (num-test (gcd 1396277868664090735481380981225896 312520860) 62504172)
  (num-test (gcd -864038349500762576564773759109700 714136202724) 16607818668)
  (num-test (gcd 12514185871591242579049167322464 10706997440178) 200614518)
  (num-test (gcd 1981802660405609330969478067056636 33312289752) 14779188)
  (num-test (gcd 979313401024175219420658240 125278417383795) 1551032145)
  (num-test (gcd 4074026154111369481048033354344 29) 29)
  (num-test (gcd 599666571180604695702511920885005100 129) 129)
  (num-test (gcd 5703263639326551702474610108800 1978) 1978)
  (num-test (gcd 134137932950214683609064669163440 190619) 143)
  (num-test (gcd 344735091370772631136645455600 1048985) 1048985)
  (num-test (gcd 6759508339299085316106145385400 4969610) 160310)
  (num-test (gcd 700334422308861928135313594400 228529587) 432003)
  (num-test (gcd 10277417891211405957191810814198480 2516552038) 228777458)
  (num-test (gcd 490099971577877358878082782880 9282588354) 17547426)
  (num-test (gcd 1954558750269048828645390249600 5575829490) 327989970)
  (num-test (gcd 1360588454560018295496656378989200 7868178296420) 14873682980)
  (num-test (gcd 4337552841738910859248770564912480 17722936528737830) 338114285990)
  (num-test (gcd 215913068853045803981566931862756 7009479781500) 2930844)
  (num-test (gcd 44890707654126305940250882318870941900 18329973480720) 1527497790060)
  (num-test (gcd 28579720891831355496720656680837200 3) 3)
  (num-test (gcd 29332703209780553199747293473184160 1711) 29)
  (num-test (gcd 3648979393315349438003046604440000 186) 186)
  (num-test (gcd 1159760236369472473822068077011807878780 25714) 25714)
  (num-test (gcd 158186359726371025615685433600 31395) 4485)
  (num-test (gcd 331091450443070201468559735703944 28424) 28424)
  (num-test (gcd 9734443639363161342241553023288200 1961348207) 63269297)
  (num-test (gcd 701896612128009033011419603540080 51300) 3420)
  (num-test (gcd 86169288128517384618860929451245320 5032162527446) 180164066)
  (num-test (gcd 64828800524794653881296183831741773624 4645294472) 6354712)
  (num-test (gcd 49068907706533938991402184550000 268183371225) 742890225)
  (num-test (gcd 1708602980304476478496020543612288 4083128544) 131713824)
  (num-test (gcd 17608179287674151740172985536160 980399424528) 91686096)
  (num-test (gcd 43194437079731225735521919644800 -178119261126453036) 80633436453804)
  (num-test (gcd 817555977437791699707628651571149344 59) 59)
  (num-test (gcd 19062946261334997559157066059536 533) 41)
  (num-test (gcd 6533849124840489114353090499099000 598) 26)
  (num-test (gcd 427663965127849896842400211428345149025 234) 117)
  (num-test (gcd 352395507261316174741530450071590608 154734) 3774)
  (num-test (gcd 391579493632653867660919800000 9221565) 645)
  (num-test (gcd 2618798923882923048581401148931738000 681876) 52452)
  (num-test (gcd 174712575449141140214591110997980800 233260339838) 126154862)
  (num-test (gcd 88598141227372995032227898284800 1929763976) 155288)
  (num-test (gcd 210110141308655567793064872567302676320 720390430628) 468699044)
  (num-test (gcd 668425085137718599277317523827419000 19898594339442) 58711254)
  (num-test (gcd 89533471731097208414073727453200 4173840860670546) 2257350384354)
  (num-test (gcd 113987439157802480362236410675251462620 21548296273949445)  1134120856523655)
  (num-test (gcd 48129335993995093308894209644253760 1009442888504820) 84891337020)
  (num-test (gcd -3497836376962291922989777163497680 138736290091634664)  3383811953454504)
  (num-test (gcd 11371924962562208722154622794880 3) 3)
  (num-test (gcd 9451631862008339290824315653784000 703) 19)
  (num-test (gcd 16869347753325980368094612370435598560 806) 806)
  (num-test (gcd 4701845646467068759127854100132739552 3198) 6)
  (num-test (gcd 1029865193584911347147121232800485280 1005771) 24531)
  (num-test (gcd 10657125216930337802109861408000 2415138) 2838)
  (num-test (gcd 14382707743772734802155022983680 247913634) 144894)
  (num-test (gcd 60134748581470366378101904574533857248 54828228) 493948)
  (num-test (gcd 214830664120540781167218700750596000 505665810) 11759670)
  (num-test (gcd 48933004118344447687599112101802800 6263883444) 106167516)
  (num-test (gcd 5498670161558110606435630054129739400 262699548132) 1346604)
  (num-test (gcd 35941673649029587182509620977230062500 25622409466332) 525598668)
  (num-test (gcd 1592802602494326390643157055239113248 736377633395508) 960075141324)
  (num-test (gcd 4043816553144402557587143272522043028314 5011466158645380)  366067652202)
  (num-test (gcd 7171921165220830707276631005512550 1765284492289500) 176528449228950)
  (num-test (gcd 2402189359210218692854826119405968750 23) 1)
  (num-test (gcd 26149068753160488131648964110990162400 1147) 31)
  (num-test (gcd 556184059176863945810376239306506311552 4089) 4089)
  (num-test (gcd 67871323087036310486238021899264593800 13395) 13395)
  (num-test (gcd 12750401179065252879838440979200 -7177173) 7177173)
  (num-test (gcd 278110245000092733617125071646080 17748) 17748)
  (num-test (gcd 13408203364935178481017292708752000 50619404) 1368092)
  (num-test (gcd 124271828931784534297423756437875067000 -8839796595) 4068015)
  (num-test (gcd 11893442806922081156953529319100769836176 972789007267) 983608703)
  (num-test (gcd 352581052555284857902053030133344488264100 923561430099) 54327142947)
  (num-test (gcd 6108908012714804315575319947340956346976 31944833628092) 97096758748)
  (num-test (gcd 67475643422116264959949054821520228800 22515435540) 326310660)
  (num-test (gcd 470601888939348535946408832 5135943991060962937) 36905011)
  (num-test (gcd -110759232155568113345545635903016614000 30159198663300)  30159198663300)
  (num-test (gcd 146100914712024458707469587112300146320 26868173101560) 10304280)
  (num-test (gcd 12173192708601511002951184416658091200 466645866900785428350)  1496624001041650)
  (num-test (gcd 5784684831478746253226687170890240 13) 13)
  (num-test (gcd 35042260655085685815432622412891903767500 667) 667)
  (num-test (gcd 2903871349270676921837488659419545120987500 530) 530)
  (num-test (gcd 630123969240840167098426767919876491188000 77691) 25897)
  (num-test (gcd 33192703032132982013024959634241667249800 4684718) 126614)
  (num-test (gcd 4731525733734729472809717145544850000 90706055) 90706055)
  (num-test (gcd 214011009809686092216200126896120006823232 50400042) 258)
  (num-test (gcd 5854250735296111435541950856160000 24357777002) 817622)
  (num-test (gcd 35348208247612761916374738259136697649608 156806713508) 8596388)
  (num-test (gcd 612558317420289618714916924536521515286100 2377007388) 125105652)
  (num-test (gcd 181857299802925368992522029882739454720 21606337755618)  21606337755618)
  (num-test (gcd 4731635341196946327443020710970699860000 58092526675092) 776108892)
  (num-test (gcd 22081740554432638182773611616166588288192 61419768950540)  12283953790108)
  (num-test (gcd 125627844706077784535328068665849312000 30482033400) 32200)
  (num-test (gcd 1225504716872819103560254268197955520 510813364186125) 168863922045)
  (num-test (gcd 5209185280578468690281136425214396728400 2327880739319250103818)  829166238)
  (num-test (gcd 230425011604643097634961294406535254400 31) 31)
  (num-test (gcd 13222608481676137093434201748083744000 893) 893)
  (num-test (gcd 13348198818240350339028224064019716678960 651) 3)
  (num-test (gcd 7236172685650198160266777676385295337308176 23426) 442)
  (num-test (gcd 756264162229440667711265021676693350760 28899) 28899)
  (num-test (gcd 40915062421030872924283823601517905600 36345062) 36345062)
  (num-test (gcd 1174590526522170015825602834292923520 4991486258) 145114)
  (num-test (gcd 2891892862328155581145450075391651333218020 35138529818) 35138529818)
  (num-test (gcd 1993335355070485984559797658834121810059400 535644500) 2612900)
  (num-test (gcd 6324295450641455215591954662726515160 367472693133) 8962748613)
  (num-test (gcd 6576388154814679090356195121505112000 15901952377630) 969690370)
  (num-test (gcd 117828556355409428513249595788296238400 565992666495795) 33126555)
  (num-test (gcd 592831716700236607285748949860604000 139641978135660) 343100683380)
  (num-test (gcd 106766839071170184723986891291602032000 1584924526628112)  1983635202288)
  (num-test (gcd 21677148858122146832326483307664860804937400 247815827510760)  9178363981880)
  (num-test (gcd 14079549844487257384278196623697173813600 160967604100961853832)  42959600534344)
  (num-test (gcd 2696480372014145687016224877963234647656980 -2219319031453896088860)  1258830987778727220)
  (num-test (gcd 13545431257849875145060979241270859310160 29) 29)
  (num-test (gcd 137485634482479300158725199474868559498162500 329) 47)
  (num-test (gcd 529252417743761759027305009539254400 3243) 3243)
  (num-test (gcd 133897419738958073238580385894509887148800 330455) 330455)
  (num-test (gcd 3896215507210178905244623173635584334007288624 1005238) 1005238)
  (num-test (gcd 17654511984514518592175290794029073043800 1060530) 36570)
  (num-test (gcd 16470780256339082688310222474503880382858400 913836) 913836)
  (num-test (gcd 57267105834722825210001789897760395576000 2958974018) 62956894)
  (num-test (gcd 521977833444747522001426544601807810543216 1066521690) 4960566)
  (num-test (gcd 1699559962174727325529414216960251941390400 25883611479) 30924267)
  (num-test (gcd 10654036597801063717295948399628964800 317449894126222) 19212606314)
  (num-test (gcd 381902381115592200811990304316262139150724960 4640335440216)  4640335440216)
  (num-test (gcd 425968526187959807410151867411382902838703889232 1882826315615025)  4430179566153)
  (num-test (gcd 174609167728518272531601927200939868792000 1712923655178450) 6189150)
  (num-test (gcd 3325168366561555458817274989681612518000 1699726139891780)  130748164607060)
  (num-test (gcd 11429650426242566426919762928176000 7414967839104) 5416338816)
  (num-test (gcd 2104794191230056678355480848036599377844400 -16946684823025584)  182222417451888)
  (num-test (gcd 11894522530167763519415142641640874994880 7) 7)
  (num-test (gcd 5906329981690378696996009087718418780000 185) 185)
  (num-test (gcd 3056294774178096513474941936265025440000 658) 658)
  (num-test (gcd 10491907660880423349353457742257185280 123369) 123369)
  (num-test (gcd 673239479595593149777212259021965839229225628776 15470) 3094)
  (num-test (gcd 1506608574369860432616005754109397877696 1474070) 294814)
  (num-test (gcd 4849814041048623250005708880379694793905000 2172220582) 2172220582)
  (num-test (gcd 21154344928580705924176101470087564940000 5023204186) 5023204186)
  (num-test (gcd 346448039376394135288065831861806112294000 776147372) 25037012)
  (num-test (gcd 2339009760844587560470606952218133142645504 194201967414) 5248701822)
  (num-test (gcd 2242982161480922111384667548175169152 21419749763490) 2316901002)
  (num-test (gcd 4717315265246821759830981157482117120 45609714193992) 26227552728)
  (num-test (gcd 16628111321698075419789804224660024289936 4643626415880804)  1653124391556)
  (num-test (gcd 115557531507210992033160068979962880 88406536976058378)  36546728803662)
  (num-test (gcd 21059511907771200155093927745003762840000 180298981648603620)  191197223381340)
  (num-test (gcd 2124921015128697258800067298086064536000 2282525112298516782924)  15103625661372)
  (num-test (gcd 16015671538624533047089928322348864000 49817926936366875)  69075001125)
  (num-test (gcd 166517667014186289390514558017250969134523800 -43413708621878528404068)  1188862957578074004)
  (num-test (gcd -2780796292789128359666429021610464935722000 47) 47)
  (num-test (gcd 21297913114430245153455383503409684916193317960 58) 58)
  (num-test (gcd 1516745257039775143654568869485529015398000 6293) 6293)
  (num-test (gcd 8447692776411453120390905608381515479808 2030) 14)
  (num-test (gcd 958876033949638283967045624731391031146081240 9834415) 166685)
  (num-test (gcd 4731349833403602529573388098680617532624192 14868) 14868)
  (num-test (gcd 6375001358038970462026761077388061675464000 430513678) 430513678)
  (num-test (gcd 254088526608579040642428151389718385042344800 4799428101) 255411)
  (num-test (gcd 21140490542258031885408065086507444825621023648 164778747198)  13189686)
  (num-test (gcd 34214837305812460226811046733375808000 4312787868) 746028)
  (num-test (gcd 11450197571956515037245443769386989035470896800 75585518430279)  5814270648483)
  (num-test (gcd 1211397915863796187148880114197307052796506376580 538601201880)  11708721780)
  (num-test (gcd 5454139401260819402160859765169199667337088 30452838731872)  48414687968)
  (num-test (gcd 744935981632690384026127091216926530879171660 1032747922358460)  60868033380)
  (num-test (gcd 324574326062026951443376280715122947502400 103751223626207988025)  3334229637375325)
  (num-test (gcd 15272163751269260921486082393684080908800 6484309049057400)  341279423634600)
  (num-test (gcd 386527546655781220813671331401971490218262720 3481571963427119100)  1915440648660)
  (num-test (gcd 3189682029126430413458911948222943640000 -6724598925622907976570)  829921474949490)
  (num-test (gcd -709403542855323660533377490060722241678400 7) 7)
  (num-test (gcd 139803787314578422635552652090095842837312147438904 123) 123)
  (num-test (gcd 171985399350431759069945935900956183322827030835560 18241) 18241)
  (num-test (gcd 33090522521924986387051477884789600000 26187) 609)
  (num-test (gcd 1733723010009930088165729903139785699319986530 372945) 7935)
  (num-test (gcd 56408303994570817306318494803635460247582000 5761730) 10810)
  (num-test (gcd 25845509336769185412951159262424903513866295760 64371378271)  64371378271)
  (num-test (gcd 624970361450506104794172455132584603069611058500 108222780)  108222780)
  (num-test (gcd 82823962548382643645255524843049561752323600 135325929794)  12302357254)
  (num-test (gcd 170620453449723034746079844571491973300000 9460614789626)  230746702186)
  (num-test (gcd 125144597811313015929871740675462711600000 12764411911636)  12726233212)
  (num-test (gcd 257193319319332344553297882967977761077115600 6510126541380)  158783574180)
  (num-test (gcd 879624546681838385457288074812140664728758550 10045784120501316)  80757786714)
  (num-test (gcd 18300938860777100857669855248554588369659200 118088077425391892)  1433647093268)
  (num-test (gcd 8394780474625841647581984803260010511075000 746584618179400)  11198041400)
  (num-test (gcd 146802334713757872619395774222116859916800 718775571956687400)  854667743111400)
  (num-test (gcd 240155883351717999820072393833707008014911556000 -1350921510529331832)  10157304590446104)
  (num-test (gcd -918942437243241528855354123800826649596480 -74343962238703160850)  3476056267530)
  (num-test (gcd 1361069299753299783990135442290762165844800 8281085446358585640)  8546011812547560)
  
  (num-test (gcd 111738283365989051/177100989030047175 5964153172084899/4217293152016490) 1/149377357650353093734710215583150)
  (num-test (gcd 11571718688839/18340740190704 5168247530883/3654502875938) 1/33513143886879715286440176)
  (num-test (gcd 130441933147714940/206745572560704147 14398739476117879/10181446324101389) 1/2104968949772418231181062860760183)
  (num-test (gcd 137528045312/217976794617 63018038201/44560482149) 1/9713151065427067791933)
  (num-test (gcd 205632218873398596256/325919355854421968365 16616132878186749607/11749380235262596085) 1/5590292610168557896833020882635974965)
  (num-test (gcd 22803850947114245497/36143248623210700400 1180872205318713601/835002744095575440) 1/34295127023760867970857561935725200)
  (num-test (gcd 326267455807135/517121682660006 30122754096401/21300003689580) 1/1835782291436657618117489580)
  (num-test (gcd 3447601211185766107/5464318637170278738 202605639573839043/143263821649299118) 1/391419585335252015613280949198776542)
  (num-test (gcd 3816473305410548/6048967074079039 423859315570607/299713796309065) 313/1812958885520765991472282188535)
  (num-test (gcd 397560349370386783/630118245525664765 34761632124320657/24580185800219268) 17/15488423551129023359673258461692020)
  (num-test (gcd 4640282259296926456/7354673373747273033 489133282872437279/345869461223138161) 1/2543756917250129165517177396348512313)
  (num-test (gcd 483615324366283/766512153894657 175568277047523/124145519261542) 1/95159049365535186345899381094)
  (num-test (gcd 50247984153525417450/79641170620168673833 2850877693509864481/2015874949414289041) 1/160546640795227287934843564657515364153)
  (num-test (gcd 5409303924479/8573543875303 886731088897/627013566048) 1/5375728318922723466512544)
  (num-test (gcd 5680010011095224105765/9002602871306688466954 40114893348711941777/28365513113449345692) 1/127681724900613301985499022520606932131084)
  (num-test (gcd 615582794569/975675645481 152139002499/107578520350) 19/104961742282377144038350)
  (num-test (gcd 6189245291/9809721694 1855077841/1311738121) 1/12867785902420496974)
  (num-test (gcd 6234549927241963/9881527843552324 1023286908188737/723573111879672) 1/105147174292423231311078293496)
  (num-test (gcd 65470613321/103768467013 10812186007/7645370045) 1/793348329316760825585)
  (num-test (gcd 6586818670/10439860591 4478554083/3166815962) 1/33061117160633553542)
  (num-test (gcd 7530699980955811472069/11935877073996486182239 96845919575610633161/68480406462161287469) 1/817373713509671731923053344199644801063091)
  (num-test (gcd 753110839881/1193652440098 367296043199/259717522849) 1/310012454884916918799202))



;;; --------------------------------------------------------------------------------
;;; lcm
;;; --------------------------------------------------------------------------------

(num-test (lcm (* 512 500057) (* 128 500057) (* 2048 500057)) 1024116736)
(num-test (lcm (/ (expt 2 10)) (/ (expt 3 10))) 1)
(num-test (lcm (/ (expt 2 57) 3) (/ 63 11)) 9079256848778919936)
(num-test (lcm (/ 3 (expt 2 10)) (/ 2 (expt 3 10))) 6)
(num-test (lcm (/ 3 (expt 2 40)) (/ 2 (expt 3 10))) 6)
(num-test (lcm (/ 3 (expt 2 60)) (/ 2 (expt 2 30))) 3/536870912)
(num-test (lcm (/ 3 (expt 2 60)) (/ 2 (expt 3 30))) 6)
(num-test (lcm -1 -1) 1)
(num-test (lcm -1 -10) 10)
(num-test (lcm -1 -1234) 1234)
(num-test (lcm -1 -1234000000) 1234000000)
(num-test (lcm -1 -2) 2)
(num-test (lcm -1 -3) 3)
(num-test (lcm -1 -362880) 362880)
(num-test (lcm -1 -500029) 500029)
(num-test (lcm -1 0) 0)
(num-test (lcm -1 1) 1)
(num-test (lcm -1 10) 10)
(num-test (lcm -1 1234) 1234)
(num-test (lcm -1 1234000000) 1234000000)
(num-test (lcm -1 2) 2)
(num-test (lcm -1 3) 3)
(num-test (lcm -1 362880) 362880)
(num-test (lcm -1 500029) 500029)
(num-test (lcm -1) 1)
(num-test (lcm -1/2 -2) 2)
(num-test (lcm -10 -1) 10)
(num-test (lcm -10 -10) 10)
(num-test (lcm -10 -1234) 6170)
(num-test (lcm -10 -1234000000) 1234000000)
(num-test (lcm -10 -2) 10)
(num-test (lcm -10 -3) 30)
(num-test (lcm -10 -362880) 362880)
(num-test (lcm -10 -500029) 5000290)
(num-test (lcm -10 0) 0)
(num-test (lcm -10 1) 10)
(num-test (lcm -10 10) 10)
(num-test (lcm -10 1234) 6170)
(num-test (lcm -10 1234000000) 1234000000)
(num-test (lcm -10 2) 10)
(num-test (lcm -10 3) 30)
(num-test (lcm -10 362880) 362880)
(num-test (lcm -10 500029) 5000290)
(num-test (lcm -10) 10)
(num-test (lcm -1234 -1) 1234)
(num-test (lcm -1234 -10) 6170)
(num-test (lcm -1234 -1234) 1234)
(num-test (lcm -1234 -1234000000) 1234000000)
(num-test (lcm -1234 -2) 1234)
(num-test (lcm -1234 -3) 3702)
(num-test (lcm -1234 -362880) 223896960)
(num-test (lcm -1234 -500029) 617035786)
(num-test (lcm -1234 0) 0)
(num-test (lcm -1234 1) 1234)
(num-test (lcm -1234 10) 6170)
(num-test (lcm -1234 1234) 1234)
(num-test (lcm -1234 1234000000) 1234000000)
(num-test (lcm -1234 2) 1234)
(num-test (lcm -1234 3) 3702)
(num-test (lcm -1234 362880) 223896960)
(num-test (lcm -1234 500029) 617035786)
(num-test (lcm -1234) 1234)
(num-test (lcm -1234000000 -1) 1234000000)
(num-test (lcm -1234000000 -10) 1234000000)
(num-test (lcm -1234000000 -1234) 1234000000)
(num-test (lcm -1234000000 -1234000000) 1234000000)
(num-test (lcm -1234000000 -2) 1234000000)
(num-test (lcm -1234000000 -3) 3702000000)
(num-test (lcm -1234000000 -362880) 699678000000)
(num-test (lcm -1234000000 -500029) 617035786000000)
(num-test (lcm -1234000000 0) 0)
(num-test (lcm -1234000000 1) 1234000000)
(num-test (lcm -1234000000 10) 1234000000)
(num-test (lcm -1234000000 1234) 1234000000)
(num-test (lcm -1234000000 1234000000) 1234000000)
(num-test (lcm -1234000000 2) 1234000000)
(num-test (lcm -1234000000 3) 3702000000)
(num-test (lcm -1234000000 362880) 699678000000)
(num-test (lcm -1234000000 500029) 617035786000000)
(num-test (lcm -1234000000) 1234000000)
(num-test (lcm -2 -1) 2)
(num-test (lcm -2 -10) 10)
(num-test (lcm -2 -1234) 1234)
(num-test (lcm -2 -1234000000) 1234000000)
(num-test (lcm -2 -2) 2)
(num-test (lcm -2 -3) 6)
(num-test (lcm -2 -362880) 362880)
(num-test (lcm -2 -500029) 1000058)
(num-test (lcm -2 0) 0)
(num-test (lcm -2 1) 2)
(num-test (lcm -2 10) 10)
(num-test (lcm -2 1234) 1234)
(num-test (lcm -2 1234000000) 1234000000)
(num-test (lcm -2 2) 2)
(num-test (lcm -2 3) 6)
(num-test (lcm -2 362880) 362880)
(num-test (lcm -2 500029) 1000058)
(num-test (lcm -2) 2)
(num-test (lcm -3 -1) 3)
(num-test (lcm -3 -10) 30)
(num-test (lcm -3 -1234) 3702)
(num-test (lcm -3 -1234000000) 3702000000)
(num-test (lcm -3 -2) 6)
(num-test (lcm -3 -3) 3)
(num-test (lcm -3 -362880) 362880)
(num-test (lcm -3 -500029) 1500087)
(num-test (lcm -3 0) 0)
(num-test (lcm -3 1) 3)
(num-test (lcm -3 10) 30)
(num-test (lcm -3 1234) 3702)
(num-test (lcm -3 1234000000) 3702000000)
(num-test (lcm -3 2) 6)
(num-test (lcm -3 3) 3)
(num-test (lcm -3 362880) 362880)
(num-test (lcm -3 500029) 1500087)
(num-test (lcm -3) 3)
(num-test (lcm -362880 -1) 362880)
(num-test (lcm -362880 -10) 362880)
(num-test (lcm -362880 -1234) 223896960)
(num-test (lcm -362880 -1234000000) 699678000000)
(num-test (lcm -362880 -2) 362880)
(num-test (lcm -362880 -3) 362880)
(num-test (lcm -362880 -362880) 362880)
(num-test (lcm -362880 -500029) 181450523520)
(num-test (lcm -362880 0) 0)
(num-test (lcm -362880 1) 362880)
(num-test (lcm -362880 10) 362880)
(num-test (lcm -362880 1234) 223896960)
(num-test (lcm -362880 1234000000) 699678000000)
(num-test (lcm -362880 2) 362880)
(num-test (lcm -362880 3) 362880)
(num-test (lcm -362880 362880) 362880)
(num-test (lcm -362880 500029) 181450523520)
(num-test (lcm -362880) 362880)
(num-test (lcm -500029 -1) 500029)
(num-test (lcm -500029 -10) 5000290)
(num-test (lcm -500029 -1234) 617035786)
(num-test (lcm -500029 -1234000000) 617035786000000)
(num-test (lcm -500029 -2) 1000058)
(num-test (lcm -500029 -3) 1500087)
(num-test (lcm -500029 -362880) 181450523520)
(num-test (lcm -500029 -500029) 500029)
(num-test (lcm -500029 0) 0)
(num-test (lcm -500029 1) 500029)
(num-test (lcm -500029 10) 5000290)
(num-test (lcm -500029 1234) 617035786)
(num-test (lcm -500029 1234000000) 617035786000000)
(num-test (lcm -500029 2) 1000058)
(num-test (lcm -500029 3) 1500087)
(num-test (lcm -500029 362880) 181450523520)
(num-test (lcm -500029 500029) 500029)
(num-test (lcm -500029) 500029)
(num-test (lcm 0 -1) 0)
(num-test (lcm 0 -10) 0)
(num-test (lcm 0 -1234) 0)
(num-test (lcm 0 -1234000000) 0)
(num-test (lcm 0 -2) 0)
(num-test (lcm 0 -3) 0)
(num-test (lcm 0 -362880) 0)
(num-test (lcm 0 -500029) 0)
(num-test (lcm 0 0 0 10) 0)
(num-test (lcm 0 0) 0)
(num-test (lcm 0 1) 0)
(num-test (lcm 0 10 10 1234) 0)
(num-test (lcm 0 10) 0)
(num-test (lcm 0 1234 -1234 10) 0)
(num-test (lcm 0 1234) 0)
(num-test (lcm 0 1234000000) 0)
(num-test (lcm 0 2) 0)
(num-test (lcm 0 3) 0)
(num-test (lcm 0 362880) 0)
(num-test (lcm 0 500029) 0)
(num-test (lcm 0) 0)
(num-test (lcm 1 -1) 1)
(num-test (lcm 1 -10) 10)
(num-test (lcm 1 -1234) 1234)
(num-test (lcm 1 -1234000000) 1234000000)
(num-test (lcm 1 -2) 2)
(num-test (lcm 1 -3) 3)
(num-test (lcm 1 -362880) 362880)
(num-test (lcm 1 -500029) 500029)
(num-test (lcm 1 0 -1 1) 0)
(num-test (lcm 1 0) 0)
(num-test (lcm 1 1 2 -10) 10)
(num-test (lcm 1 1) 1)
(num-test (lcm 1 10) 10)
(num-test (lcm 1 1234) 1234)
(num-test (lcm 1 1234000000) 1234000000)
(num-test (lcm 1 2) 2)
(num-test (lcm 1 3) 3)
(num-test (lcm 1 362880) 362880)
(num-test (lcm 1 500029) 500029)
(num-test (lcm 1) 1)
(num-test (lcm 1/2 -2) 2)
(num-test (lcm 1/2 2) 2)
(num-test (lcm 1/21 1/33) 1/3)
(num-test (lcm 1/3 1/6 5/12 2) 10)
(num-test (lcm 1/3 1/6 5/12) 5/3)
(num-test (lcm 1/3 2/3) 2/3)
(num-test (lcm 1/3 3/4 5/8) 15)
(num-test (lcm 1/3 3/4) 3)
(num-test (lcm 10 -1) 10)
(num-test (lcm 10 -10) 10)
(num-test (lcm 10 -1234) 6170)
(num-test (lcm 10 -1234000000) 1234000000)
(num-test (lcm 10 -2) 10)
(num-test (lcm 10 -3) 30)
(num-test (lcm 10 -362880) 362880)
(num-test (lcm 10 -500029) 5000290)
(num-test (lcm 10 0 10 10) 0)
(num-test (lcm 10 0) 0)
(num-test (lcm 10 1 -1234 3) 18510)
(num-test (lcm 10 1) 10)
(num-test (lcm 10 10) 10)
(num-test (lcm 10 1234) 6170)
(num-test (lcm 10 1234000000) 1234000000)
(num-test (lcm 10 2) 10)
(num-test (lcm 10 3) 30)
(num-test (lcm 10 362880) 362880)
(num-test (lcm 10 500029) 5000290)
(num-test (lcm 10) 10)
(num-test (lcm 1024 9765625) 10000000000)
(num-test (lcm 1234 -1) 1234)
(num-test (lcm 1234 -10) 6170)
(num-test (lcm 1234 -1234) 1234)
(num-test (lcm 1234 -1234000000) 1234000000)
(num-test (lcm 1234 -2) 1234)
(num-test (lcm 1234 -3) 3702)
(num-test (lcm 1234 -362880) 223896960)
(num-test (lcm 1234 -500029) 617035786)
(num-test (lcm 1234 0 -1234 1234) 0)
(num-test (lcm 1234 0) 0)
(num-test (lcm 1234 1) 1234)
(num-test (lcm 1234 10 0 1) 0)
(num-test (lcm 1234 10) 6170)
(num-test (lcm 1234 1234 1 -10) 6170)
(num-test (lcm 1234 1234) 1234)
(num-test (lcm 1234 1234000000) 1234000000)
(num-test (lcm 1234 2) 1234)
(num-test (lcm 1234 3) 3702)
(num-test (lcm 1234 362880) 223896960)
(num-test (lcm 1234 500029) 617035786)
(num-test (lcm 1234) 1234)
(num-test (lcm 1234000000 -1) 1234000000)
(num-test (lcm 1234000000 -10) 1234000000)
(num-test (lcm 1234000000 -1234) 1234000000)
(num-test (lcm 1234000000 -1234000000) 1234000000)
(num-test (lcm 1234000000 -2) 1234000000)
(num-test (lcm 1234000000 -3) 3702000000)
(num-test (lcm 1234000000 -362880) 699678000000)
(num-test (lcm 1234000000 -500029) 617035786000000)
(num-test (lcm 1234000000 0) 0)
(num-test (lcm 1234000000 1) 1234000000)
(num-test (lcm 1234000000 10) 1234000000)
(num-test (lcm 1234000000 1234) 1234000000)
(num-test (lcm 1234000000 1234000000) 1234000000)
(num-test (lcm 1234000000 2) 1234000000)
(num-test (lcm 1234000000 3) 3702000000)
(num-test (lcm 1234000000 362880) 699678000000)
(num-test (lcm 1234000000 500029) 617035786000000)
(num-test (lcm 1234000000) 1234000000)
(num-test (lcm 131072 762939453125) 100000000000000000)
(num-test (lcm 14 35) 70)
(num-test (lcm 1741 2063 3137 3797 3251 3 19) 7927658615618708709)
(num-test (lcm 2 -1) 2)
(num-test (lcm 2 -10) 10)
(num-test (lcm 2 -1234) 1234)
(num-test (lcm 2 -1234000000) 1234000000)
(num-test (lcm 2 -2) 2)
(num-test (lcm 2 -3) 6)
(num-test (lcm 2 -362880) 362880)
(num-test (lcm 2 -500029) 1000058)
(num-test (lcm 2 0 2 -2) 0)
(num-test (lcm 2 0) 0)
(num-test (lcm 2 1 -3 -1) 6)
(num-test (lcm 2 1) 2)
(num-test (lcm 2 10) 10)
(num-test (lcm 2 1234) 1234)
(num-test (lcm 2 1234000000) 1234000000)
(num-test (lcm 2 2 10 10) 10)
(num-test (lcm 2 2) 2)
(num-test (lcm 2 3) 6)
(num-test (lcm 2 3/4) 6)
(num-test (lcm 2 362880) 362880)
(num-test (lcm 2 500029) 1000058)
(num-test (lcm 2) 2)
(num-test (lcm 262144 3814697265625) 1000000000000000000)
(num-test (lcm 3 -1) 3)
(num-test (lcm 3 -10) 30)
(num-test (lcm 3 -1234) 3702)
(num-test (lcm 3 -1234000000) 3702000000)
(num-test (lcm 3 -2) 6)
(num-test (lcm 3 -3) 3)
(num-test (lcm 3 -362880) 362880)
(num-test (lcm 3 -500029) 1500087)
(num-test (lcm 3 0 -3 -3) 0)
(num-test (lcm 3 0) 0)
(num-test (lcm 3 1 10 2) 30)
(num-test (lcm 3 1) 3)
(num-test (lcm 3 10) 30)
(num-test (lcm 3 1234) 3702)
(num-test (lcm 3 1234000000) 3702000000)
(num-test (lcm 3 2 -1234 1) 3702)
(num-test (lcm 3 2) 6)
(num-test (lcm 3 3) 3)
(num-test (lcm 3 362880) 362880)
(num-test (lcm 3 500029) 1500087)
(num-test (lcm 3) 3)
(num-test (lcm 3/4 2) 6)
(num-test (lcm 32 -36) 288 )
(num-test (lcm 323 28747 27113) 41021969)
(num-test (lcm 362880 -1) 362880)
(num-test (lcm 362880 -10) 362880)
(num-test (lcm 362880 -1234) 223896960)
(num-test (lcm 362880 -1234000000) 699678000000)
(num-test (lcm 362880 -2) 362880)
(num-test (lcm 362880 -3) 362880)
(num-test (lcm 362880 -362880) 362880)
(num-test (lcm 362880 -500029) 181450523520)
(num-test (lcm 362880 0) 0)
(num-test (lcm 362880 1) 362880)
(num-test (lcm 362880 10) 362880)
(num-test (lcm 362880 1234) 223896960)
(num-test (lcm 362880 1234000000) 699678000000)
(num-test (lcm 362880 2) 362880)
(num-test (lcm 362880 362880) 362880)
(num-test (lcm 362880 500029) 181450523520)
(num-test (lcm 362880) 362880)
(num-test (lcm 4242884/3 1907348632815/7) 8092658996592638460)
(num-test (lcm 500029 -1) 500029)
(num-test (lcm 500029 -10) 5000290)
(num-test (lcm 500029 -1234) 617035786)
(num-test (lcm 500029 -1234000000) 617035786000000)
(num-test (lcm 500029 -2) 1000058)
(num-test (lcm 500029 -3) 1500087)
(num-test (lcm 500029 -362880) 181450523520)
(num-test (lcm 500029 -500029) 500029)
(num-test (lcm 500029 0) 0)
(num-test (lcm 500029 1) 500029)
(num-test (lcm 500029 10) 5000290)
(num-test (lcm 500029 1234) 617035786)
(num-test (lcm 500029 1234000000) 617035786000000)
(num-test (lcm 500029 2) 1000058)
(num-test (lcm 500029 3) 1500087)
(num-test (lcm 500029 362880) 181450523520)
(num-test (lcm 500029 500029) 500029)
(num-test (lcm 500029) 500029)
(num-test (lcm 524288 -17500000000001) 9175040000000524288)
(num-test (lcm 524288 17500000000001) 9175040000000524288)
(num-test (lcm 524288/3 1907348632815/7) 1000000000001310720)
(num-test (lcm) 1 )
(num-test (lcm) 1)
(num-test (lcm 2755 13) 35815)
(num-test (lcm 56 2) 56)
(num-test (lcm 148665 2) 297330)
(num-test (lcm 71862 203) 71862)
(num-test (lcm 21568911 41) 21568911)
(num-test (lcm 15295874 111) 45887622)
(num-test (lcm 20430054 41) 20430054)
(num-test (lcm 248255254 767) 14647059986)
(num-test (lcm 510104442 5453) 2781599522226)
(num-test (lcm 242162410 41) 9928658810)
(num-test (lcm 660070972 74) 660070972)
(num-test (lcm 6542405452 117) 765461437884)
(num-test (lcm 629448534 2) 629448534)
(num-test (lcm 163873565922 155) 819367829610)
(num-test (lcm 1563464979842 442) 20325044737946)
(num-test (lcm 3712337724 576173) 92997772323924)
(num-test (lcm 4380921044390 5) 4380921044390)
(num-test (lcm 4097970629150 86) 176212737053450)
(num-test (lcm 2090198664 1118) 1168421053176)
(num-test (lcm 5275411661289 31857) 8002799490175413)
(num-test (lcm 38602581835881 19) 733449054881739)
(num-test (lcm 82578867500655 319) 908367542507205)
(num-test (lcm 363169800 20) 363169800)
(num-test (lcm 2033404107084 23374) 23764393799490708)
(num-test (lcm 7438317458260 31213) 17859400217282260)
(num-test (lcm 390609000 11) 4296699000)
(num-test (lcm 406117800 57) 7716238200)
(num-test (lcm 1008217762344 4403) 119977913718936)
(num-test (lcm 136581511784536 67022) 147644614239083416)
(num-test (lcm 43293168048 1344610) 29106213344510640)
(num-test (lcm 608503422693864 47) 608503422693864)
(num-test (lcm 6945109296864 779) 284749481171424)
(num-test (lcm 1346702251365156 435) 6733511256825780)
(num-test (lcm 1388225063690465 644) 127716705859522780)
(num-test (lcm 1200780158492850 91686) 311002061049648150)
(num-test (lcm 1551193257090906 2656731) 2356262557521086214)
(num-test (lcm 386512944051107445 17) 386512944051107445)
(num-test (lcm 1111364125679340 6) 1111364125679340)
(num-test (lcm 15858537083857314 21793) 15858537083857314)
(num-test (lcm 44179338013272 280645) 302407568700846840)
(num-test (lcm 64149298745840 43808357) 79994175536062480)
(num-test (lcm 4412914630225794 515823) 48542060932483734)
(num-test (lcm 169216424701305960 17) 2876679219922201320)
(num-test (lcm 178335507754891305 817) 178335507754891305)

(when (provided? 'overflow-checks)
  (num-test (lcm 10781274/17087915 3880899/2744210) (/ (* 10781274/17087915 3880899/2744210) (gcd 10781274/17087915 3880899/2744210)))
  (num-test (lcm 190537/301994 114243/80782) (/ (* 190537/301994 114243/80782) (gcd 190537/301994 114243/80782)))
  (num-test (lcm 397573379/630138897 131836323/93222358) (/ (* 397573379/630138897 131836323/93222358) (gcd 397573379/630138897 131836323/93222358))))

(num-test (lcm 10400200/16483927 1607521/1136689) (/ (* 10400200/16483927 1607521/1136689) (gcd 10400200/16483927 1607521/1136689)))
(num-test (lcm 12/19 41/29) (/ (* 12/19 41/29) (gcd 12/19 41/29)))
(num-test (lcm 12941/20511 3363/2378) (/ (* 12941/20511 3363/2378) (gcd 12941/20511 3363/2378)))
(num-test (lcm 15601/24727 19601/13860) (/ (* 15601/24727 19601/13860) (gcd 15601/24727 19601/13860)))
(num-test (lcm 171928773/272500658 54608393/38613965) (/ (* 171928773/272500658 54608393/38613965) (gcd 171928773/272500658 54608393/38613965)))
(num-test (lcm 2/3 3/2) (/ (* 2/3 3/2) (gcd 2/3 3/2)))
(num-test (lcm 253/401 577/408) (/ (* 253/401 577/408) (gcd 253/401 577/408)))
(num-test (lcm 4201378396/6659027209 318281039/225058681) (/ (* 4201378396/6659027209 318281039/225058681) (gcd 4201378396/6659027209 318281039/225058681)))
(num-test (lcm 5/8 17/12) (/ (* 5/8 17/12) (gcd 5/8 17/12)))
(num-test (lcm 53/84 99/70) (/ (* 53/84 99/70) (gcd 53/84 99/70)))
(num-test (lcm 53715833/85137581 9369319/6625109) (/ (* 53715833/85137581 9369319/6625109) (gcd 53715833/85137581 9369319/6625109)))
(num-test (lcm 665/1054 1393/985) (/ (* 665/1054 1393/985) (gcd 665/1054 1393/985)))
(num-test (lcm 7161071/11350029 275807/195025) (/ (* 7161071/11350029 275807/195025) (gcd 7161071/11350029 275807/195025)))
(num-test (lcm 79335/125743 47321/33461) (/ (* 79335/125743 47321/33461) (gcd 79335/125743 47321/33461)))

(num-test (lcm -2305843009213693951/4611686018427387903) 2305843009213693951/4611686018427387903)

(let ()
  (define (flcm n) (if (<= n 1) 1 (lcm n (flcm (- n 1)))))
  (num-test (flcm 9) 2520)
  (num-test (flcm 40) 5342931457063200)
  (if with-bignums (num-test (flcm 100) 69720375229712477164533808935312303556800)))

(when with-bignums 
  (num-test (let ((n 1)) (do ((i 2 (+ i 1))) ((= i 100)) (set! n (lcm n i))) n) 69720375229712477164533808935312303556800)
  (num-test (lcm -9223372036854775808 -9223372036854775808) 9223372036854775808)
  (num-test (lcm -9223372036854775808 9223372036854775807 -9223372036854775808) 85070591730234615856620279821087277056)
  (num-test (lcm 1/21 1/2432902008176640001) 1)
  (num-test (lcm 132120577 33292289 260046847) 1143841133453061178785791)
  (num-test (lcm 132120577 33292289) 4398596432330753)
  (num-test (lcm 132120577/12 33292289/6 260046847/4) 1143841133453061178785791/2)
  (num-test (lcm 2/132120577 3/33292289 4/260046847) 12)
  (num-test (lcm 21 2432902008176640001) 51090942171709440021)
  (num-test (lcm 2353913150770005286438421033702874906038383291674012942337 9641628265553941653251772554046975615133217962696757011808257)
	    22695555569123220026272727097682721551725929819788097280747860983024240452040931523149698041303750665450606153441476609)
  (num-test (lcm 2432902008176640001 21) 51090942171709440021)
  (num-test (lcm 2432902008176640001/21 21/2432902008176640001) 51090942171709440021)
  (num-test (lcm 557057 23068673 167772161) 2155967190204955525121)
  (num-test (lcm 9223372036854775807 -9223372036854775808) 85070591730234615856620279821087277056)
  (num-test (lcm 524288 19073486328125) 10000000000000000000)
  (num-test (lcm 2147483648 4656612873077392578125) 10000000000000000000000000000000)
  (num-test (lcm (/ (expt 2 57) 3) (/ 65 11)) 9367487224930631680)
  (num-test (lcm 460683358924445799142 518) 460683358924445799142)
  (num-test (lcm 113021475230160 74635) 1243236227531760)
  (num-test (lcm 74228340534140364 363909) 16107549895908458988)
  (num-test (lcm 69242022961311060 48305942) 55324376346087536940)
  (num-test (lcm 286967952870300 2273388) 4181983977178881900)
  (num-test (lcm 302822258393413362492399 29) 302822258393413362492399)
  (num-test (lcm 10491072879382200 133) 10491072879382200)
  (num-test (lcm 167206737423420464 609) 14546986155837580368)
  (num-test (lcm 72212583812867784 4888799) 7511336330463068288328)
  (num-test (lcm 4170116471639397292390 1798025) 20850582358196986461950)
  (num-test (lcm 83910330283522050 35224) 12418728881961263400)
  (num-test (lcm 275373383775647594346 66884092) 175688218848863165192748)
  (num-test (lcm 14656657495570695990 37) 542296327336115751630)
  (num-test (lcm 95470974177676509874110 1219) 95470974177676509874110)
  (num-test (lcm 619506317623001424 5957) 527199876297174211824)
  (num-test (lcm 11268171656665155960 9858) 597213097803253265880)
  (num-test (lcm 6172860073826160 5167394) 10376577784101774960)
  (num-test (lcm 26457493095663264 1491412) 9974474897065050528)
  (num-test (lcm 8481384175941103284 313836405) 52191512141200849929103020)
  (num-test (lcm 60356595775749199080 176098815946) 6192647083187643574807080)
  (num-test (lcm 611492274956002440 37) 611492274956002440)
  (num-test (lcm 164614611843685080 1711) 4773823743466867320)
  (num-test (lcm 93177516542679418720 62197) 156631405308244102868320)
  (num-test (lcm 938959746797519770440 127558) 938959746797519770440)
  (num-test (lcm 137670522526899326250 200) 550682090107597305000)
  (num-test (lcm 852063402206742880 41643478) 607521205773407673440)
  (num-test (lcm 55947291202307909360 188546228) 1657550396450776430608720)
  (num-test (lcm 12877971214039423262680 9832253830) 1040166612929178256349926280)
  (num-test (lcm 192158415774146059920 53) 192158415774146059920)
  (num-test (lcm 902814024155808960 1829) 53266027425192728640)
  (num-test (lcm 1265864304573235487120 4921) 24051421786891474255280)
  (num-test (lcm 14172662463567665400 95817) 23824245601257245537400)
  (num-test (lcm 32171996211745702482324 2368555) 294212905356414449200852980)
  (num-test (lcm 971324258606045826300 4576748) 18836891347147046709435900)
  (num-test (lcm 2400649320046378377000 1704690) 4400390203645011565041000)
  (num-test (lcm 953233796456393760 18342152493) 30445334225020760300640)
  (num-test (lcm 28906333140964843080 236206740) 8296117611456909963960)
  (num-test (lcm 775403093708557121609032 41) 775403093708557121609032)
  (num-test (lcm 12587009808135760402860 2491) 667111519831195301351580)
  (num-test (lcm 510685807527370566909720 76) 9703030343020040771284680)
  (num-test (lcm 9842598153710524682146590 10089) 29527794461131574046439770)
  (num-test (lcm 44936631038618189620242012 30740) 224683155193090948101210060)
  (num-test (lcm 934589372977008750144 373650) 1238330919194536593940800)
  (num-test (lcm 33027125273398900134069150 840577803) 33027125273398900134069150)
  (num-test (lcm 4428219127938822420288 1695783782) 600648070732749811910284608)
  (num-test (lcm 29316428815807608915440 560764380) 107210180179408425803764080)
  (num-test (lcm 1364397376360544429904 19) 1364397376360544429904)
  (num-test (lcm 4991450791697293128313385277 329) 234598187209772777030729108019)
  (num-test (lcm 75448279792981695149550 3009) 75674624632360640234998650)
  (num-test (lcm 181031604499464166188731133 3364) 608990317536197455058891531412)
  (num-test (lcm 405831142402606479845286 2746214) 6899129420844310157369862)
  (num-test (lcm 89170366469003867207160 25337230) 196977339530029542660616440)
  (num-test (lcm 13523725766340619200 1490114045) 704734873409776007131200)
  (num-test (lcm 104705939487154940255412 192200052) 768227478017255796653957844)
  (num-test (lcm 7232591421499800642000 16584679460) 15338901584491041700955526000)
  (num-test (lcm 14043796716396386984750160 33382708236) 1306073094624863989581764880)
  (num-test (lcm 13894638105872256412416 23) 13894638105872256412416)
  (num-test (lcm 147611447155643499428400 118) 8709075382182966466275600)
  (num-test (lcm 13356594697070649024 4558) 574333571974037908032)
  (num-test (lcm 15089731174706036171537760 90) 45269193524118108514613280)
  (num-test (lcm 307230141273924828960 1971507) 383115986168584261713120)
  (num-test (lcm 2582563944548247741930009096 22873474) 33573331279127220645090118248)
  (num-test (lcm 1074296602920111687342072 146235518) 7220347468226070650626065912)
  (num-test (lcm 774058642832724262993980 407557010) 124623441496068606342030780)
  (num-test (lcm 291091930213008490369569480 13412544348) 147286985941108248965685135059880)
  (num-test (lcm 2089068565149831833568 7302038455228) 223766401218893937188969184)
  (num-test (lcm 1064437567441124038217970656 5) 5322187837205620191089853280)
  (num-test (lcm 142557826750459447787460 1333) 6129986550269756254860780)
  (num-test (lcm 311779340580033594160200 23693) 311779340580033594160200)
  (num-test (lcm 29314187023691666530559664 110143) 29314187023691666530559664)
  (num-test (lcm 222003853016244177637944900 857463) 222003853016244177637944900)
  (num-test (lcm 6247776111945111006243552 77976501) 193681059470298441193550112)
  (num-test (lcm 1140058514761397155259712 5530338) 12540643662375368707856832)
  (num-test (lcm 580962736822969724865449808 55686036) 21495621262449879820021642896)
  (num-test (lcm 4100502596989506786787500 45333475410) 329750117342105167273090387500)
  (num-test (lcm 1497378750311599979536944 262630276090) 1089215763657912499114866119760)
  (num-test (lcm 105637634198318524045536 2633013240) 1853412292009498504378929120)
  (num-test (lcm 11415822547029425161364106595632 7) 79910757829205976129548746169424)
  (num-test (lcm 198305933339312916107438448 177) 11700050067019462050338868432)
  (num-test (lcm 3127415425979879537134790928 3335) 15637077129899397685673954640)
  (num-test (lcm 589703503861221139260034914750 13209) 21819029642865182152621291845750)
  (num-test (lcm 3108579252052448504121792 14322) 96365956813625903627775552)
  (num-test (lcm 636976201153021006473464400 66264077) 12102547821907399122995823600)
  (num-test (lcm 9544425315508129998909285900 1488396) 66810977208556909992365001300)
  (num-test (lcm 458100280193857502802977376 260747103934) 19226926860016393250143763448096)
  (num-test (lcm 114208186302155358124900650 22076867505) 397558696517802801632779162650)
  (num-test (lcm 90107067439719108194114160 28566806069714) 755187332212285845774870774960)
  (num-test (lcm 2976572787365723002218245484 110104803958578) 110463592711929346335321308156724)
  (num-test (lcm 53453375725613238735360 17) 908707387335425058501120)
  (num-test (lcm 888822833524306124874229800 106) 888822833524306124874229800)
  (num-test (lcm 21275338550698297089687698855820 3021) 21275338550698297089687698855820)
  (num-test (lcm 417525245705449941528380320750068 5828) 417525245705449941528380320750068)
  (num-test (lcm 1954871230146370370001829871352 22765249) 1954871230146370370001829871352)
  (num-test (lcm 903057827710908645847577520 648545995) 1126113111155503081371929167440)
  (num-test (lcm 6002846634833433581621040 28493572159) 6137376430766685661618749127440)
  (num-test (lcm 26428903214964558277189300080 100428856) 766438193233972190038489702320)
  (num-test (lcm 470486531607553676511206181180 28495896) 4523257514875021045978736225864520)
  (num-test (lcm 483599554429365539310928369206620 5577334078910) 25630776384756373583479203567950860)
  (num-test (lcm 134511400157705323668887400 1285071093558916) 508298000951744289230204144827800)
  (num-test (lcm 25897125642468049125349982599216 1183846707540) 1165370653911062210640749216964720)
  (num-test (lcm 1118034209930460291955200 3) 1118034209930460291955200)
  (num-test (lcm 16297594064835666104344589410644 413) 16297594064835666104344589410644)
  (num-test (lcm 536762539932642345554192060100 1378) 536762539932642345554192060100)
  (num-test (lcm 933250179448203335817687635834340 58029) 784863400915939005422675301736679940)
  (num-test (lcm 65573457048202714607131200 486115) 8721269787410961042748449600)
  (num-test (lcm 85664559165674439863772868932 322014) 85664559165674439863772868932)
  (num-test (lcm 7232817686074320060728552759760 11307940) 7232817686074320060728552759760)
  (num-test (lcm 78400098291720425971762131120 5646921093) 78400098291720425971762131120)
  (num-test (lcm 345445746644065669842240 19727989065) 3106593599570082568891264320)
  (num-test (lcm 627854758484491743169777558200 750371721805653) 3013801413922642432418609934436637400)
  (num-test (lcm 788233263079483492974876830792850 7170146100) 963221047483128828415299487228862700)
  (num-test (lcm 18378856389802641496737518160 6247594493140) 139293352578314219903773650134640)
  (num-test (lcm 9620902642431357480148667659080 59) 9620902642431357480148667659080)
  (num-test (lcm 16008524600631853118144316000 629) 10069361973797435611312774764000)
  (num-test (lcm 4342138447708715023205684275423920 53041) 134606291878970165719376212538141520)
  (num-test (lcm 2431833161592653384508687244500 47541) 2431833161592653384508687244500)
  (num-test (lcm 39424620224103957589082132160 1671734) 39424620224103957589082132160)
  (num-test (lcm 652830233576052788654372406432 552231327) 28071700043770269912138013476576)
  (num-test (lcm 6892963340916411083970414000 3662431431) 323969277023071320946609458000)
  (num-test (lcm 29102758215190063506219566460000 10565720) 29102758215190063506219566460000)
  (num-test (lcm 21253900104556838003127171970777418412 1182797770) 400954825472464748928994099228715998342380)
  (num-test (lcm 3964268932242030284914943132662620 21244177854110) 4547016465281608736797439773164025140)
  (num-test (lcm 6070388091189460078138338240 40809131994181213) 903741167852013248053001382156480)
  (num-test (lcm 9685989954133695108793384134000 964113514382876) 55084224869158324083707975570058000)
  (num-test (lcm 56468122001858834917195045500 429400787158167902) 11597366428619765656458601249744500)
  (num-test (lcm 18843408973202596901221568364900 47) 18843408973202596901221568364900)
  (num-test (lcm 7800980538292163259967028613764250 6) 7800980538292163259967028613764250)
  (num-test (lcm 270433907726619219545089642715200 3422) 15955600555870533953160288920196800)
  (num-test (lcm 45771666919597903071546708768 2342359) 49112998604728549995769618508064)
  (num-test (lcm 47198294949461301503537593835384892 314502) 2501509632321448979687492473275399276)
  (num-test (lcm 3165335901519110207943908102359110 14953473) 228660700189839002311659977406319747290)
  (num-test (lcm 189219585097956261544520863361400 35605794) 189219585097956261544520863361400)
  (num-test (lcm 38532137569034426600955256933810890813 1341358608707) 8030213065799481606918878410776991078101639)
  (num-test (lcm 1396277868664090735481380981225896 312520860) 6981389343320453677406904906129480)
  (num-test (lcm 864038349500762576564773759109700 714136202724) 37153649028532790792285271641717100)
  (num-test (lcm 12514185871591242579049167322464 10706997440178) 667894614152696207686433109167226144)
  (num-test (lcm 1981802660405609330969478067056636 33312289752) 4466983196554243432005203563145657544)
  (num-test (lcm 979313401024175219420658240 125278417383795) 79100122714123656647825986703040)
  (num-test (lcm 4074026154111369481048033354344 29) 4074026154111369481048033354344)
  (num-test (lcm 599666571180604695702511920885005100 129) 599666571180604695702511920885005100)
  (num-test (lcm 5703263639326551702474610108800 1978) 5703263639326551702474610108800)
  (num-test (lcm 134137932950214683609064669163440 190619) 178805864622636173250883203994865520)
  (num-test (lcm 344735091370772631136645455600 1048985) 344735091370772631136645455600)
  (num-test (lcm 6759508339299085316106145385400 4969610) 209544758518271644799290506947400)
  (num-test (lcm 700334422308861928135313594400 228529587) 370476909401387959983580891437600)
  (num-test (lcm 10277417891211405957191810814198480 2516552038) 113051596803325465529109918956183280)
  (num-test (lcm 490099971577877358878082782880 9282588354) 259262884964697122846505792143520)
  (num-test (lcm 1954558750269048828645390249600 5575829490) 33227498754573830086971634243200)
  (num-test (lcm 1360588454560018295496656378989200 7868178296420) 719751292462249678317731224485286800)
  (num-test (lcm 4337552841738910859248770564912480 17722936528737830) 227361507305428490509242806701017464160)
  (num-test (lcm 215913068853045803981566931862756 7009479781500) 516383093295665670947415013416263818500)
  (num-test (lcm 44890707654126305940250882318870941900 18329973480720) 538688491849515671283010587826451302800)
  (num-test (lcm 28579720891831355496720656680837200 3) 28579720891831355496720656680837200)
  (num-test (lcm 29332703209780553199747293473184160 1711) 1730629489377052638785090314917865440)
  (num-test (lcm 3648979393315349438003046604440000 186) 3648979393315349438003046604440000)
  (num-test (lcm 1159760236369472473822068077011807878780 25714) 1159760236369472473822068077011807878780)
  (num-test (lcm 158186359726371025615685433600 31395) 1107304518084597179309798035200)
  (num-test (lcm 331091450443070201468559735703944 28424) 331091450443070201468559735703944)
  (num-test (lcm 9734443639363161342241553023288200 1961348207) 301767752820258001609488143721934200)
  (num-test (lcm 701896612128009033011419603540080 51300) 10528449181920135495171294053101200)
  (num-test (lcm 86169288128517384618860929451245320 5032162527446) 2406794386717619069789404620502733032920)
  (num-test (lcm 64828800524794653881296183831741773624 4645294472) 47389853183624891987227510381003236519144)
  (num-test (lcm 49068907706533938991402184550000 268183371225) 17713875682058751975896188622550000)
  (num-test (lcm 1708602980304476478496020543612288 4083128544) 52966692389438770833376636851980928)
  (num-test (lcm 17608179287674151740172985536160 980399424528) 188284261123099704557669734338158880)
  (num-test (lcm 43194437079731225735521919644800 178119261126453036) 95416511509126277649767920495363200)
  (num-test (lcm 817555977437791699707628651571149344 59) 817555977437791699707628651571149344)
  (num-test (lcm 19062946261334997559157066059536 533) 247818301397354968269041858773968)
  (num-test (lcm 6533849124840489114353090499099000 598) 150278529871331249630121081479277000)
  (num-test (lcm 427663965127849896842400211428345149025 234) 855327930255699793684800422856690298050)
  (num-test (lcm 352395507261316174741530450071590608 154734) 14448215797713963164402748452935214928)
  (num-test (lcm 391579493632653867660919800000 9221565) 5598412020466052345948170380600000)
  (num-test (lcm 2618798923882923048581401148931738000 681876) 34044386010477999631558214936112594000)
  (num-test (lcm 174712575449141140214591110997980800 233260339838) 323043552005461968256778964235266499200)
  (num-test (lcm 88598141227372995032227898284800 1929763976) 1101009101032564209265496091985209600)
  (num-test (lcm 210110141308655567793064872567302676320 720390430628) 322939287191403607697940709135944213503840)
  (num-test (lcm 668425085137718599277317523827419000 19898594339442) 226544635130131000822866287128160329737000)
  (num-test (lcm 89533471731097208414073727453200 4173840860670546) 165547389230798738357622322060966800)
  (num-test (lcm 113987439157802480362236410675251462620 21548296273949445) 2165761343998247126882491802829777789780)
  (num-test (lcm 48129335993995093308894209644253760 1009442888504820) 572305934304595654536061046879821460160)
  (num-test (lcm 3497836376962291922989777163497680 138736290091634664) 143411291455453968842580863703404880)
  (num-test (lcm 11371924962562208722154622794880 3) 11371924962562208722154622794880)
  (num-test (lcm 9451631862008339290824315653784000 703) 349710378894308553760499679190008000)
  (num-test (lcm 16869347753325980368094612370435598560 806) 16869347753325980368094612370435598560)
  (num-test (lcm 4701845646467068759127854100132739552 3198) 2506083729566947648615146235370750181216)
  (num-test (lcm 1029865193584911347147121232800485280 1005771) 42224472936981365233031970544819896480)
  (num-test (lcm 10657125216930337802109861408000 2415138) 9069213559607717469595492058208000)
  (num-test (lcm 14382707743772734802155022983680 247913634) 24608812949595149246487244325076480)
  (num-test (lcm 60134748581470366378101904574533857248 54828228) 6674957092543210667969311407773258154528)
  (num-test (lcm 214830664120540781167218700750596000 505665810) 9237718557183253590190404132275628000)
  (num-test (lcm 48933004118344447687599112101802800 6263883444) 2887047242982322413568347614006365200)
  (num-test (lcm 5498670161558110606435630054129739400 262699548132) 1072697071127240891435282017849791951370200)
  (num-test (lcm 35941673649029587182509620977230062500 25622409466332) 1752120648716543345560161513018988316812500)
  (num-test (lcm 1592802602494326390643157055239113248 736377633395508) 1221679596113148341623301461368399861216)
  (num-test (lcm 4043816553144402557587143272522043028314 5011466158645380) 55359848612546871013367991400826769057618660)
  (num-test (lcm 7171921165220830707276631005512550 1765284492289500) 71719211652208307072766310055125500)
  (num-test (lcm 2402189359210218692854826119405968750 23) 55250355261835029935661000746337281250)
  (num-test (lcm 26149068753160488131648964110990162400 1147) 967515543866938060871011672106636008800)
  (num-test (lcm 556184059176863945810376239306506311552 4089) 556184059176863945810376239306506311552)
  (num-test (lcm 67871323087036310486238021899264593800 13395) 67871323087036310486238021899264593800)
  (num-test (lcm 12750401179065252879838440979200 7177173) 12750401179065252879838440979200)
  (num-test (lcm 278110245000092733617125071646080 17748) 278110245000092733617125071646080)
  (num-test (lcm 13408203364935178481017292708752000 50619404) 496103524502601603797639830223824000)
  (num-test (lcm 124271828931784534297423756437875067000 8839796595) 270042684268767793028301822739502520591000)
  (num-test (lcm 11893442806922081156953529319100769836176 972789007267) 11762614936045938264227040496590661367978064)
  (num-test (lcm 352581052555284857902053030133344488264100 923561430099) 5993877893439842584334901512266856300489700)
  (num-test (lcm 6108908012714804315575319947340956346976 31944833628092) 2009830736183170619824280262675174638155104)
  (num-test (lcm 67475643422116264959949054821520228800 22515435540) 4655819396126022282236484782684895787200)
  (num-test (lcm 470601888939348535946408832 5135943991060962937) 65492053197870222825732159796881558144)
  (num-test (lcm 110759232155568113345545635903016614000 30159198663300) 110759232155568113345545635903016614000)
  (num-test (lcm 146100914712024458707469587112300146320 26868173101560) 380954774790565399517176676594819048626034640)
  (num-test (lcm 12173192708601511002951184416658091200 466645866900785428350) 3795589313349242529209176349929576178068800)
  (num-test (lcm 5784684831478746253226687170890240 13) 5784684831478746253226687170890240)
  (num-test (lcm 35042260655085685815432622412891903767500 667) 35042260655085685815432622412891903767500)
  (num-test (lcm 2903871349270676921837488659419545120987500 530) 2903871349270676921837488659419545120987500)
  (num-test (lcm 630123969240840167098426767919876491188000 77691) 1890371907722520501295280303759629473564000)
  (num-test (lcm 33192703032132982013024959634241667249800 4684718) 1228130012188920334481923506466941688242600)
  (num-test (lcm 4731525733734729472809717145544850000 90706055) 4731525733734729472809717145544850000)
  (num-test (lcm 214011009809686092216200126896120006823232 50400042) 41806836755312368428342478589030147212911547968)
  (num-test (lcm 5854250735296111435541950856160000 24357777002) 174403983655206455776230257955862560000)
  (num-test (lcm 35348208247612761916374738259136697649608 156806713508) 644786666644704390116591600584912501826499528)
  (num-test (lcm 612558317420289618714916924536521515286100 2377007388) 11638608030985502755583421566193908790435900)
  (num-test (lcm 181857299802925368992522029882739454720 21606337755618) 181857299802925368992522029882739454720)
  (num-test (lcm 4731635341196946327443020710970699860000 58092526675092) 354167636923932629555437543236867855220860000)
  (num-test (lcm 22081740554432638182773611616166588288192 61419768950540) 110408702772163190913868058080832941440960)
  (num-test (lcm 125627844706077784535328068665849312000 30482033400) 118925222307474416497014710218320253656864000)
  (num-test (lcm 1225504716872819103560254268197955520 510813364186125) 3707151768540277788269769161298815448000)
  (num-test (lcm 5209185280578468690281136425214396728400 2327880739319250103818) 14624765850878700374498228867533344237423825059372400)
  (num-test (lcm 230425011604643097634961294406535254400 31) 230425011604643097634961294406535254400)
  (num-test (lcm 13222608481676137093434201748083744000 893) 13222608481676137093434201748083744000)
  (num-test (lcm 13348198818240350339028224064019716678960 651) 2896559143558156023569124621892278519334320)
  (num-test (lcm 7236172685650198160266777676385295337308176 23426) 383517152339460502494139216848420652877333328)
  (num-test (lcm 756264162229440667711265021676693350760 28899) 756264162229440667711265021676693350760)
  (num-test (lcm 40915062421030872924283823601517905600 36345062) 40915062421030872924283823601517905600)
  (num-test (lcm 1174590526522170015825602834292923520 4991486258) 40402390340783082034353260691173690317440)
  (num-test (lcm 2891892862328155581145450075391651333218020 35138529818) 2891892862328155581145450075391651333218020)
  (num-test (lcm 1993335355070485984559797658834121810059400 535644500) 408633747789449626834758520060994971062177000)
  (num-test (lcm 6324295450641455215591954662726515160 367472693133) 259296113476299663839270141171787121560)
  (num-test (lcm 6576388154814679090356195121505112000 15901952377630) 107846189350805922402751243797562331688000)
  (num-test (lcm 117828556355409428513249595788296238400 565992666495795) 2013191495492007395999396032982202432871329600)
  (num-test (lcm 592831716700236607285748949860604000 139641978135660) 241282508696996299165299822593265828000)
  (num-test (lcm 106766839071170184723986891291602032000 1584924526628112) 85306704417864977594465526141990023568000)
  (num-test (lcm 21677148858122146832326483307664860804937400 247815827510760) 585283019169297964472815049306951241733309800)
  (num-test (lcm 14079549844487257384278196623697173813600 160967604100961853832) 52755411528451062517793341673751996512389960800)
  (num-test (lcm 2696480372014145687016224877963234647656980 2219319031453896088860) 4753894895860938846209604459849182683819255740)
  (num-test (lcm 13545431257849875145060979241270859310160 29) 13545431257849875145060979241270859310160)
  (num-test (lcm 137485634482479300158725199474868559498162500 329) 962399441377355101111076396324079916487137500)
  (num-test (lcm 529252417743761759027305009539254400 3243) 529252417743761759027305009539254400)
  (num-test (lcm 133897419738958073238580385894509887148800 330455) 133897419738958073238580385894509887148800)
  (num-test (lcm 3896215507210178905244623173635584334007288624 1005238) 3896215507210178905244623173635584334007288624)
  (num-test (lcm 17654511984514518592175290794029073043800 1060530) 511980847550921039173083433026843118270200)
  (num-test (lcm 16470780256339082688310222474503880382858400 913836) 16470780256339082688310222474503880382858400)
  (num-test (lcm 57267105834722825210001789897760395576000 2958974018) 2691553974231972784870084125194738592072000)
  (num-test (lcm 521977833444747522001426544601807810543216 1066521690) 112225234190620717230306707089388679266791440)
  (num-test (lcm 1699559962174727325529414216960251941390400 25883611479) 1422531688340246771468119699595730874943764800)
  (num-test (lcm 10654036597801063717295948399628964800 317449894126222) 176036646705466975800880955407069385390400)
  (num-test (lcm 381902381115592200811990304316262139150724960 4640335440216) 381902381115592200811990304316262139150724960)
  (num-test (lcm 425968526187959807410151867411382902838703889232 1882826315615025) 181036623629882918149314543649837733706449152923600)
  (num-test (lcm 174609167728518272531601927200939868792000 1712923655178450) 48325242369824705024158690915447549888986499656000)
  (num-test (lcm 3325168366561555458817274989681612518000 1699726139891780) 43227188765300220964624574865860962734000)
  (num-test (lcm 11429650426242566426919762928176000 7414967839104) 15647191433526073438453155448672944000)
  (num-test (lcm 2104794191230056678355480848036599377844400 16946684823025584) 195745859784395271087059718867403742139529200)
  (num-test (lcm 11894522530167763519415142641640874994880 7) 11894522530167763519415142641640874994880)
  (num-test (lcm 5906329981690378696996009087718418780000 185) 5906329981690378696996009087718418780000)
  (num-test (lcm 3056294774178096513474941936265025440000 658) 3056294774178096513474941936265025440000)
  (num-test (lcm 10491907660880423349353457742257185280 123369) 10491907660880423349353457742257185280)
  (num-test (lcm 673239479595593149777212259021965839229225628776 15470) 3366197397977965748886061295109829196146128143880)
  (num-test (lcm 1506608574369860432616005754109397877696 1474070) 7533042871849302163080028770546989388480)
  (num-test (lcm 4849814041048623250005708880379694793905000 2172220582) 4849814041048623250005708880379694793905000)
  (num-test (lcm 21154344928580705924176101470087564940000 5023204186) 21154344928580705924176101470087564940000)
  (num-test (lcm 346448039376394135288065831861806112294000 776147372) 10739889220668218193930040787715989481114000)
  (num-test (lcm 2339009760844587560470606952218133142645504 194201967414) 86543361151249739737412457232070926277883648)
  (num-test (lcm 2242982161480922111384667548175169152 21419749763490) 20736370082891124919751251482879438810240)
  (num-test (lcm 4717315265246821759830981157482117120 45609714193992) 8203411246264223040346076232861401671680)
  (num-test (lcm 16628111321698075419789804224660024289936 4643626415880804) 46708364702649893854189560067070008230430224)
  (num-test (lcm 115557531507210992033160068979962880 88406536976058378) 279533668715943389728214206862530206720)
  (num-test (lcm 21059511907771200155093927745003762840000 180298981648603620) 19859119729028241746253573863538548358120000)
  (num-test (lcm 2124921015128697258800067298086064536000 2282525112298516782924) 321127237090271040335932409977291910220921912000)
  (num-test (lcm 16015671538624533047089928322348864000 49817926936366875) 11550742548729092601556962655002835949760000)
  (num-test (lcm 166517667014186289390514558017250969134523800 43413708621878528404068) 6080725646357040729673420115115953639885405604600)
  (num-test (lcm 2780796292789128359666429021610464935722000 47) 2780796292789128359666429021610464935722000)
  (num-test (lcm 21297913114430245153455383503409684916193317960 58) 21297913114430245153455383503409684916193317960)
  (num-test (lcm 1516745257039775143654568869485529015398000 6293) 1516745257039775143654568869485529015398000)
  (num-test (lcm 8447692776411453120390905608381515479808 2030) 1224915452579660702456681313215319744572160)
  (num-test (lcm 958876033949638283967045624731391031146081240 9834415) 56573686003028658754055691859152070837618793160)
  (num-test (lcm 4731349833403602529573388098680617532624192 14868) 4731349833403602529573388098680617532624192)
  (num-test (lcm 6375001358038970462026761077388061675464000 430513678) 6375001358038970462026761077388061675464000)
  (num-test (lcm 254088526608579040642428151389718385042344800 4799428101) 4774577503501808752711867392764198173330701136800)
  (num-test (lcm 21140490542258031885408065086507444825621023648 164778747198) 264108148344429592344402957125737508206483448434464)
  (num-test (lcm 34214837305812460226811046733375808000 4312787868) 197795974464901832571194661165645546048000)
  (num-test (lcm 11450197571956515037245443769386989035470896800 75585518430279) 148852568435434695484190769002030857461121658400)
  (num-test (lcm 1211397915863796187148880114197307052796506376580 538601201880) 55724304129734624608848485253076124428639293322680)
  (num-test (lcm 5454139401260819402160859765169199667337088 30452838731872) 3430653683393055403959180792291426590755028352)
  (num-test (lcm 744935981632690384026127091216926530879171660 1032747922358460) 12639328800361857745771298356677592449426905555220)
  (num-test (lcm 324574326062026951443376280715122947502400 103751223626207988025) 10099779304072092648063539727012480757432180800)
  (num-test (lcm 15272163751269260921486082393684080908800 6484309049057400) 290171111274115957508235565479997537267200)
  (num-test (lcm 386527546655781220813671331401971490218262720 3481571963427119100) 702565997265680899293657490452822449622871959067200)
  (num-test (lcm 3189682029126430413458911948222943640000 6724598925622907976570) 25845014249628523826120631630482407871222520000)
  (num-test (lcm 709403542855323660533377490060722241678400 7) 709403542855323660533377490060722241678400)
  (num-test (lcm 139803787314578422635552652090095842837312147438904 123) 139803787314578422635552652090095842837312147438904)
  (num-test (lcm 171985399350431759069945935900956183322827030835560 18241) 171985399350431759069945935900956183322827030835560)
  (num-test (lcm 33090522521924986387051477884789600000 26187) 1422892468442774414643213549045952800000)
  (num-test (lcm 1733723010009930088165729903139785699319986530 372945) 81484981470466714143789305447569927868039366910)
  (num-test (lcm 56408303994570817306318494803635460247582000 5761730) 30065626029106245624267757730337700311961206000)
  (num-test (lcm 25845509336769185412951159262424903513866295760 64371378271) 25845509336769185412951159262424903513866295760)
  (num-test (lcm 624970361450506104794172455132584603069611058500 108222780) 624970361450506104794172455132584603069611058500)
  (num-test (lcm 82823962548382643645255524843049561752323600 135325929794) 911063588032209080097810773273545179275559600)
  (num-test (lcm 170620453449723034746079844571491973300000 9460614789626) 6995438591438644424589273627431170905300000)
  (num-test (lcm 125144597811313015929871740675462711600000 12764411911636) 125520031604746954977661355897489099734800000)
  (num-test (lcm 257193319319332344553297882967977761077115600 6510126541380) 10544926092092626126685213201687088204161739600)
  (num-test (lcm 879624546681838385457288074812140664728758550 10045784120501316) 109420015859940604120573892778181425848269191068700)
  (num-test (lcm 18300938860777100857669855248554588369659200 118088077425391892) 1507430033023349020545408306968192889420458644800)
  (num-test (lcm 8394780474625841647581984803260010511075000 746584618179400) 559688409023779488485938508818148160783881325000)
  (num-test (lcm 146802334713757872619395774222116859916800 718775571956687400) 123460763494270370872911846120800279190028800)
  (num-test (lcm 240155883351717999820072393833707008014911556000 1350921510529331832) 31940732485778493976069628379883032065983236948000)
  (num-test (lcm 918942437243241528855354123800826649596480 74343962238703160850) 19653830834705779820109799278313370922778988193600)
  (num-test (lcm 1361069299753299783990135442290762165844800 8281085446358585640) 1318876151460947490686441243579748538703611200)
  
  (num-test (lcm 111738283365989051/177100989030047175 5964153172084899/4217293152016490)
	    (/ (* 111738283365989051/177100989030047175 5964153172084899/4217293152016490) 
	       (gcd 111738283365989051/177100989030047175 5964153172084899/4217293152016490)))
  (num-test (lcm 11571718688839/18340740190704 5168247530883/3654502875938) 
	    (/ (* 11571718688839/18340740190704 5168247530883/3654502875938) (gcd 11571718688839/18340740190704 5168247530883/3654502875938)))
  (num-test (lcm 130441933147714940/206745572560704147 14398739476117879/10181446324101389) 
	    (/ (* 130441933147714940/206745572560704147 14398739476117879/10181446324101389) 
	       (gcd 130441933147714940/206745572560704147 14398739476117879/10181446324101389)))
  (num-test (lcm 137528045312/217976794617 63018038201/44560482149) 
	    (/ (* 137528045312/217976794617 63018038201/44560482149) (gcd 137528045312/217976794617 63018038201/44560482149)))
  (num-test (lcm 326267455807135/517121682660006 30122754096401/21300003689580) 
	    (/ (* 326267455807135/517121682660006 30122754096401/21300003689580) (gcd 326267455807135/517121682660006 30122754096401/21300003689580)))
  (num-test (lcm 3816473305410548/6048967074079039 423859315570607/299713796309065) 
	    (/ (* 3816473305410548/6048967074079039 423859315570607/299713796309065) (gcd 3816473305410548/6048967074079039 423859315570607/299713796309065)))
  (num-test (lcm 397560349370386783/630118245525664765 34761632124320657/24580185800219268) 
	    (/ (* 397560349370386783/630118245525664765 34761632124320657/24580185800219268) 
	       (gcd 397560349370386783/630118245525664765 34761632124320657/24580185800219268)))
  (num-test (lcm 483615324366283/766512153894657 175568277047523/124145519261542) 
	    (/ (* 483615324366283/766512153894657 175568277047523/124145519261542) (gcd 483615324366283/766512153894657 175568277047523/124145519261542)))
  (num-test (lcm 52449289519716/83130157078217 12477253282759/8822750406821) 
	    (/ (* 52449289519716/83130157078217 12477253282759/8822750406821) (gcd 52449289519716/83130157078217 12477253282759/8822750406821)))
  (num-test (lcm 5409303924479/8573543875303 886731088897/627013566048) 
	    (/ (* 5409303924479/8573543875303 886731088897/627013566048) (gcd 5409303924479/8573543875303 886731088897/627013566048)))
  (num-test (lcm 615582794569/975675645481 152139002499/107578520350) 
	    (/ (* 615582794569/975675645481 152139002499/107578520350) (gcd 615582794569/975675645481 152139002499/107578520350)))
  (num-test (lcm 6189245291/9809721694 1855077841/1311738121) 
	    (/ (* 6189245291/9809721694 1855077841/1311738121) (gcd 6189245291/9809721694 1855077841/1311738121)))
  (num-test (lcm 65470613321/103768467013 10812186007/7645370045) 
	    (/ (* 65470613321/103768467013 10812186007/7645370045) (gcd 65470613321/103768467013 10812186007/7645370045)))
  (num-test (lcm 6586818670/10439860591 4478554083/3166815962) 
	    (/ (* 6586818670/10439860591 4478554083/3166815962) (gcd 6586818670/10439860591 4478554083/3166815962)))
  (num-test (lcm 7530699980955811472069/11935877073996486182239 96845919575610633161/68480406462161287469) 
	    (/ (* 7530699980955811472069/11935877073996486182239 96845919575610633161/68480406462161287469) 
	       (gcd 7530699980955811472069/11935877073996486182239 96845919575610633161/68480406462161287469)))
  (num-test (lcm 753110839881/1193652440098 367296043199/259717522849) 
	    (/ (* 753110839881/1193652440098 367296043199/259717522849) (gcd 753110839881/1193652440098 367296043199/259717522849))))
  
(test (lcm 0 "hi") 'error)
(test (lcm 0 1 "hi") 'error)
(test (lcm 1.4 2.3) 'error)
(test (lcm 2 1.0+0.5i) 'error)

(for-each
 (lambda (arg)
   (test (lcm arg nan.0) 'error)
   (test (lcm nan.0 arg) 'error)
   (test (lcm arg inf.0) 'error)
   (test (lcm inf.0 arg) 'error)
   (test (lcm 2 arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))

(for-each
 (lambda (arg)
   (test (lcm arg 2) 'error)
   (test (lcm arg 1/2) 'error)
   (test (lcm arg 2.0) 'error)
   (test (lcm arg 2+i) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))




;;; --------------------------------------------------------------------------------
;;; rationalize
;;; --------------------------------------------------------------------------------

(num-test (rationalize 0.0 1.0001) 0)
(num-test (rationalize -0.0 1.0001) 0)
(num-test (rationalize 0.0 0.50000000000000) 0)
(num-test (rationalize -0.0 0.50000000000000) 0)
(num-test (rationalize 0.0 0.1) 0)
(num-test (rationalize -0.0 0.1) 0)
(num-test (rationalize 0.0 0.001) 0)
(num-test (rationalize -0.0 0.001) 0)
(num-test (rationalize 0.0 0.00300000000000) 0)
(num-test (rationalize -0.0 0.00300000000000) 0)
(num-test (rationalize 0.0 0.00002000000000) 0)
(num-test (rationalize -0.0 0.00002000000000) 0)
(num-test (rationalize 0.0 0.00000001) 0)
(num-test (rationalize -0.0 0.00000001) 0)
(num-test (rationalize 0.00000001 1.0) 0)
(num-test (rationalize -0.00000001 1.0) 0)
(num-test (rationalize 0.00000001 0.50000000000000) 0)
(num-test (rationalize -0.00000001 0.50000000000000) 0)
(num-test (rationalize 0.00000001 0.1) 0)
(num-test (rationalize -0.00000001 0.1) 0)
(num-test (rationalize 0.00000001 0.001) 0)
(num-test (rationalize -0.00000001 0.001) 0)
(num-test (rationalize 0.00000001 0.00300000000000) 0)
(num-test (rationalize -0.00000001 0.00300000000000) 0)
(num-test (rationalize 0.00000001 0.00002000000000) 0)
(num-test (rationalize -0.00000001 0.00002000000000) 0)
(num-test (rationalize 0.00000001 0.000000011) 0)
(num-test (rationalize -0.00000001 0.000000011) 0)
(num-test (rationalize 1.0 1.0001) 0)
(num-test (rationalize -1.0 1.0001) 0)
(num-test (rationalize 1.0 0.999) 1)
(num-test (rationalize -1.0 0.999) -1)
(num-test (rationalize 1.0 0.50000000000000) 1)
(num-test (rationalize -1.0 0.50000000000000) -1)
(num-test (rationalize 1.0 0.1) 1)
(num-test (rationalize -1.0 0.1) -1)
(num-test (rationalize 1.0 0.001) 1)
(num-test (rationalize -1.0 0.001) -1)
(num-test (rationalize 1.0 0.00300000000000) 1)
(num-test (rationalize -1.0 0.00300000000000) -1)
(num-test (rationalize 1.0 0.00002000000000) 1)
(num-test (rationalize -1.0 0.00002000000000) -1)
(num-test (rationalize 1.0 0.00000001) 1)
(num-test (rationalize -1.0 0.00000001) -1)
(num-test (rationalize 3.14159265358979 1.0) 3)
(num-test (rationalize -3.14159265358979 1.0) -3)
(num-test (rationalize 3.14159265358979 0.50000000000000) 3)
(num-test (rationalize -3.14159265358979 0.50000000000000) -3)
(num-test (rationalize 3.14159265358979 0.1) 16/5)
(num-test (rationalize -3.14159265358979 0.1) -16/5)
(num-test (rationalize 3.14159265358979 0.001) 201/64)
(num-test (rationalize -3.14159265358979 0.001) -201/64)
(num-test (rationalize 3.14159265358979 0.00300000000000) 22/7)
(num-test (rationalize -3.14159265358979 0.00300000000000) -22/7)
(num-test (rationalize 3.14159265358979 0.00002000000000) 355/113)
(num-test (rationalize -3.14159265358979 0.00002000000000) -355/113)
(num-test (rationalize 3.14159265358979 0.00000001) 100798/32085)
(num-test (rationalize -3.14159265358979 0.00000001) -100798/32085)
(num-test (rationalize 2.71828182845905 1.0) 2)
(num-test (rationalize -2.71828182845905 1.0) -2)
(num-test (rationalize 2.71828182845905 0.50000000000000) 3)
(num-test (rationalize -2.71828182845905 0.50000000000000) -3)
(num-test (rationalize 2.71828182845905 0.1) 8/3)
(num-test (rationalize -2.71828182845905 0.1) -8/3)
(num-test (rationalize 2.71828182845905 0.001) 87/32)
(num-test (rationalize -2.71828182845905 0.001) -87/32)
(num-test (rationalize 2.71828182845905 0.00300000000000) 68/25)
(num-test (rationalize -2.71828182845905 0.00300000000000) -68/25)
(num-test (rationalize 2.71828182845905 0.00002000000000) 878/323)
(num-test (rationalize -2.71828182845905 0.00002000000000) -878/323)
(num-test (rationalize 2.71828182845905 0.00000001) 23225/8544)
(num-test (rationalize -2.71828182845905 0.00000001) -23225/8544)
(num-test (rationalize 1234.12339999999995 1.0) 1234)
(num-test (rationalize -1234.12339999999995 1.0) -1234)
(num-test (rationalize 1234.12339999999995 0.50000000000000) 1234)
(num-test (rationalize -1234.12339999999995 0.50000000000000) -1234)
(num-test (rationalize 1234.12339999999995 0.1) 6171/5)
(num-test (rationalize -1234.12339999999995 0.1) -6171/5)
(num-test (rationalize 1234.12339999999995 0.001) 60472/49)
(num-test (rationalize -1234.12339999999995 0.001) -60472/49)
(num-test (rationalize 1234.12339999999995 0.00300000000000) 9873/8)
(num-test (rationalize -1234.12339999999995 0.00300000000000) -9873/8)
(num-test (rationalize 1234.12339999999995 0.00002000000000) 290019/235)
(num-test (rationalize -1234.12339999999995 0.00002000000000) -290019/235)
(num-test (rationalize 1234.12339999999995 0.00000001) 6170617/5000)
(num-test (rationalize -1234.12339999999995 0.00000001) -6170617/5000)
(num-test (rationalize 1234000000.01234006881714 1.0) 1234000000/1)
(num-test (rationalize -1234000000.01234006881714 1.0) -1234000000/1)
(num-test (rationalize 1234000000.01234006881714 0.50000000000000) 1234000000/1)
(num-test (rationalize -1234000000.01234006881714 0.50000000000000) -1234000000/1)
(num-test (rationalize 1234000000.01234006881714 0.1) 1234000000/1)
(num-test (rationalize -1234000000.01234006881714 0.1) -1234000000/1)
(num-test (rationalize 1234000000.01234006881714 0.001) 92550000001/75)
(num-test (rationalize -1234000000.01234006881714 0.001) -92550000001/75)
(num-test (rationalize 1234000000.01234006881714 0.00300000000000) 81444000001/66)
(num-test (rationalize -1234000000.01234006881714 0.00300000000000) -81444000001/66)
(num-test (rationalize 1234000000.01234006881714 0.00002000000000) 99954000001/81)
(num-test (rationalize -1234000000.01234006881714 0.00002000000000) -99954000001/81)
(num-test (rationalize 1234000000.01234006881714 0.000001) 2400130000024/1945)
(num-test (rationalize -1234000000.01234006881714 0.000001) -2400130000024/1945)
(num-test (rationalize 0.33 1.0) 0)
(num-test (rationalize -0.33 1.0) 0)
(num-test (rationalize 0.33 0.50000000000000) 0)
(num-test (rationalize -0.33 0.50000000000000) 0)
(num-test (rationalize 0.33 0.1) 1/3)
(num-test (rationalize -0.33 0.1) -1/3)
(num-test (rationalize 0.33 0.001) 26/79)
(num-test (rationalize -0.33 0.001) -26/79)
(num-test (rationalize 0.33 0.00300000000000) 18/55)
(num-test (rationalize -0.33 0.00300000000000) -18/55)
(num-test (rationalize 0.33 0.00002000000000) 33/100)
(num-test (rationalize -0.33 0.00002000000000) -33/100)
(num-test (rationalize 0.33 0.00000001) 33/100)
(num-test (rationalize -0.33 0.00000001) -33/100)
(num-test (rationalize 0.99990 1.0) 0)
(num-test (rationalize -0.99990 1.0) 0)
(num-test (rationalize 0.99990 0.50000000000000) 1)
(num-test (rationalize -0.99990 0.50000000000000) -1)
(num-test (rationalize 0.99990 0.1) 1)
(num-test (rationalize -0.99990 0.1) -1)
(num-test (rationalize 0.99990 0.001) 1)
(num-test (rationalize -0.99990 0.001) -1)
(num-test (rationalize 0.99990 0.00300000000000) 1)
(num-test (rationalize -0.99990 0.00300000000000) -1)
(num-test (rationalize 0.99990 0.00002000000000) 8333/8334)
(num-test (rationalize -0.99990 0.00002000000000) -8333/8334)
(num-test (rationalize 0.99990 0.00000001) 9999/10000)
(num-test (rationalize -0.99990 0.00000001) -9999/10000)
(num-test (rationalize 0.5010 1.0) 0)
(num-test (rationalize -0.5010 1.0) 0)
(num-test (rationalize 0.5010 0.50000000000000) 1)
(num-test (rationalize -0.5010 0.50000000000000) -1)
(num-test (rationalize 0.5010 0.1) 1/2)
(num-test (rationalize -0.5010 0.1) -1/2)
(num-test (rationalize 0.5010 0.00099) 127/253)
(num-test (rationalize -0.5010 0.00099) -127/253)
(num-test (rationalize 0.5010 0.00300000000000) 1/2)
(num-test (rationalize -0.5010 0.00300000000000) -1/2)
(num-test (rationalize 0.5010 0.00002000000000) 246/491)
(num-test (rationalize -0.5010 0.00002000000000) -246/491)
(num-test (rationalize 0.5010 0.00000001) 501/1000)
(num-test (rationalize -0.5010 0.00000001) -501/1000)
(num-test (rationalize 0.499 1.0) 0)
(num-test (rationalize -0.499 1.0) 0)
(num-test (rationalize 0.499 0.50000000000000) 0)
(num-test (rationalize -0.499 0.50000000000000) 0)
(num-test (rationalize 0.499 0.1) 1/2)
(num-test (rationalize -0.499 0.1) -1/2)
(num-test (rationalize 0.499 0.00099) 126/253)
(num-test (rationalize -0.499 0.00099) -126/253)
(num-test (rationalize 0.499 0.00300000000000) 1/2)
(num-test (rationalize -0.499 0.00300000000000) -1/2)
(num-test (rationalize 0.499 0.00002000000000) 245/491)
(num-test (rationalize -0.499 0.00002000000000) -245/491)
(num-test (rationalize 0.499 0.00000001) 499/1000)
(num-test (rationalize -0.499 0.00000001) -499/1000)
(num-test (rationalize 1.501 1.0) 1)
(num-test (rationalize -1.501 1.0) -1)
(num-test (rationalize 1.501 0.50000000000000) 2)
(num-test (rationalize -1.501 0.50000000000000) -2)
(num-test (rationalize 1.501 0.1) 3/2)
(num-test (rationalize -1.501 0.1) -3/2)
(num-test (rationalize 1.501 0.01) 3/2)
(num-test (rationalize -1.501 0.01) -3/2)
(num-test (rationalize 1.501 0.00300000000000) 3/2)
(num-test (rationalize -1.501 0.00300000000000) -3/2)
(num-test (rationalize 1.501 0.00002000000000) 737/491)
(num-test (rationalize -1.501 0.00002000000000) -737/491)
(num-test (rationalize 1.501 0.00000001) 1501/1000)
(num-test (rationalize -1.501 0.00000001) -1501/1000)
(num-test (rationalize 1.499 1.0) 1)
(num-test (rationalize -1.499 1.0) -1)
(num-test (rationalize 1.499 0.50000000000000) 1)
(num-test (rationalize -1.499 0.50000000000000) -1)
(num-test (rationalize 1.499 0.1) 3/2)
(num-test (rationalize -1.499 0.1) -3/2)
(num-test (rationalize 1.499 0.001) 3/2)
(num-test (rationalize -1.499 0.001) -3/2)
(num-test (rationalize 1.499 0.00300000000000) 3/2)
(num-test (rationalize -1.499 0.00300000000000) -3/2)
(num-test (rationalize 1.499 0.00002000000000) 736/491)
(num-test (rationalize -1.499 0.00002000000000) -736/491)
(num-test (rationalize 1.499 0.00000001) 1499/1000)
(num-test (rationalize -1.499 0.00000001) -1499/1000)

(num-test (rationalize 1.16 .2) 1)
(num-test (rationalize 1.16 .1) 5/4)
(num-test (rationalize 1.16 .041) 6/5)
(num-test (rationalize 1.16 .039) 7/6)
(num-test (rationalize 1.16 .007) 7/6)
(num-test (rationalize 1.16 .006) 22/19)
(num-test (rationalize 1.16 .0022) 22/19)
(num-test (rationalize 1.16 .002) 29/25)
(num-test (rationalize 1.16 .0000001) 29/25)
(num-test (rationalize .1 .1) 0)
(num-test (rationalize .1 .0999) 1/6)
(num-test (rationalize .1 .065) 1/7)
(num-test (rationalize .1 .067) 1/6)
(num-test (rationalize .1 .04) 1/8)
(num-test (rationalize .1 .02) 1/9)
(num-test (rationalize .1 .01) 1/10)

(num-test (rationalize 23.1 22.0) 2)
(num-test (rationalize 23.1 22) 2)
(num-test (rationalize 23.1 .5) 23)
(num-test (rationalize 23.1 1/2) 23)

(num-test (rationalize 1/2 3/4) 0)
(num-test (rationalize 1/2 1/4) 1/2)
(num-test (rationalize 1 3) 0)
(num-test (rationalize 11/10 1/5) 1)
(num-test (rationalize 3/4 1/2) 1)
(num-test (rationalize 1/4 1/3) 0)
(num-test (rationalize 1/4 1/6) 1/3)
(num-test (rationalize 2/3 1/4) 1/2)
(num-test (rationalize 1/3 1/3) 0)
(num-test (rationalize 1/3 1/4) 1/2)
(num-test (rationalize 3/10 1/10) 1/3)

(num-test (rationalize 1/4 1/11) 1/3)
(num-test (rationalize 1/4 1/12) 1/4)
(num-test (rationalize pi 1/10) 16/5)
(num-test (rationalize pi 1/100) 22/7)
(num-test (rationalize pi 1/10000) 333/106)

;; currently (rationalize pi 0) -> 245850922/78256779, but should it return the actual (float-style) ratio?

(num-test (rationalize 1 .1) 1)
(num-test (rationalize 1 1) 0)
(num-test (rationalize 1 1/2) 1)
(num-test (rationalize 1 0) 1)
(num-test (rationalize 0 -.1) 0)
(num-test (rationalize 0 1) 0)
(num-test (rationalize 0 0) 0)
(num-test (rationalize -1 .1) -1)
(num-test (rationalize -1 -1) 0)

(num-test (rationalize (exact->inexact 1/2) 3/4) 0)
(num-test (rationalize (exact->inexact 1/2) 1/4) 1/2)
(num-test (rationalize (exact->inexact 1) 3) 0)
(num-test (rationalize (exact->inexact 11/10) 1/5) 1)
(num-test (rationalize (exact->inexact 3/4) 1/2) 1)
(num-test (rationalize (exact->inexact 1/4) 1/3) 0)
(num-test (rationalize (exact->inexact 1/4) 1/6) 1/3)
(num-test (rationalize (exact->inexact 2/3) 1/4) 1/2)
(num-test (rationalize (exact->inexact 1/3) 1/4) 1/2)
(num-test (rationalize (exact->inexact 3/10) 1/10) 1/3)

(num-test (rationalize 1/2 (exact->inexact 3/4)) 0)
(num-test (rationalize 1/2 (exact->inexact 1/4)) 1/2)
(num-test (rationalize 1 (exact->inexact 3)) 0)
(num-test (rationalize 11/10 (exact->inexact 1/5)) 1)
(num-test (rationalize 3/4 (exact->inexact 1/2)) 1)
(num-test (rationalize 1/4 (exact->inexact 1/3)) 0)
(num-test (rationalize 1/4 (exact->inexact 1/6)) 1/3)
(num-test (rationalize 2/3 (exact->inexact 1/4)) 1/2)
(num-test (rationalize 1/3 (exact->inexact 1/4)) 1/2)
(num-test (rationalize 3/10 (exact->inexact 1/10)) 1/3)

(num-test (rationalize (exact->inexact 1/2) (exact->inexact 3/4)) 0)
(num-test (rationalize (exact->inexact 1/2) (exact->inexact 1/4)) 1/2)
(num-test (rationalize (exact->inexact 1) (exact->inexact 3)) 0)
(num-test (rationalize (exact->inexact 11/10) (exact->inexact 1/5)) 1)
(num-test (rationalize (exact->inexact 3/4) (exact->inexact 1/2)) 1)
(num-test (rationalize (exact->inexact 1/4) (exact->inexact 1/3)) 0)
(num-test (rationalize (exact->inexact 1/4) (exact->inexact 1/6)) 1/3)
(num-test (rationalize (exact->inexact 2/3) (exact->inexact 1/4)) 1/2)
(num-test (rationalize (exact->inexact 1/3) (exact->inexact 1/4)) 1/2)
(num-test (rationalize (exact->inexact 3/10) (exact->inexact 1/10)) 1/3)

(num-test (rationalize -1/2 3/4) 0)
(num-test (rationalize -1/2 1/4) -1/2)
(num-test (rationalize -1 3) 0)
(num-test (rationalize -11/10 1/5) -1)
(num-test (rationalize -3/4 1/2) -1)
(num-test (rationalize -1/4 1/3) 0)
(num-test (rationalize -1/4 1/6) -1/3)
(num-test (rationalize -2/3 1/4) -1/2)
(num-test (rationalize -1/3 1/4) -1/2)
(num-test (rationalize -1/3 1/3) 0)
(num-test (rationalize -3/10 1/10) -1/3)
(num-test (rationalize .0999 .1) 0)
(num-test (rationalize -.0999 .1) 0)
(num-test (rationalize 1.0999 .1) 1)
(num-test (rationalize -1.0999 .1) -1)

(num-test (rationalize .239 .0005) 11/46) ;baseball of course... the average .001 is the hardest to get: 1/667
(num-test (rationalize .001 .0005) 1/667)
(num-test (rationalize .334 .0005) 96/287)

(num-test (rationalize 1.0000001 0.00000001) 9090911/9090910)
(num-test (rationalize 0.000000015 0.0000000009999999) 1/62500001)
(num-test (rationalize 0.00000001 1e-16) 1/100000000)
(num-test (rationalize 0.1 0) (if with-bignums 3602879701896397/36028797018963968 1/10))
(num-test (rationalize 0.1 .00000000000000001) 1/10)
(num-test (/ 0.(rationalize .1)) 0.0)

(when (not with-bignums)
  (num-test (rationalize .1 0) 1/10)
  ;; but (rationalize 0.1 0) -> 1526457681181556/15264576811815559? independent of precision
  ;; and (rationalize 0.1000000000000000 0) -> 1/10 so once again it's either the idiotic reader or the bignum promotion process
  ;;     (rationalize 0.00000001 0) 3022314549036573/302231454903657293676544? 

  (num-test (rationalize 1e-3 0) 1/1000)
  (num-test (rationalize 1e-12 0) 1/1000000000000)
  (num-test (rationalize 1e-15 0) 1/1000000000000000)
  (num-test (rationalize (+ 1e2 1e-2) 0) 10001/100))

(num-test (rationalize -1 -1) 0) ;; spec says "differs by no more than", but that seems to imply a comparison
;; on either side, so a negative error doesn't change the result??
(num-test (rationalize 1/4 -1/6) 1/3)
(num-test (rationalize -3/10 -1/10) -1/3)
(num-test (rationalize (exact->inexact 1/3) (exact->inexact -1/4)) 1/2)
(num-test (rationalize 0.5 0.02) 1/2)
(num-test (rationalize 1073741824 1) 1073741823) ; perverse
(num-test (rationalize -2.225073858507201399999999999999999999996E-308) 0)
(num-test (rationalize -9223372036854775808) -9223372036854775808)
(num-test (rationalize 1.110223024625156799999999999999999999997E-16) 0)
(num-test (rationalize 9223372036854775807) 9223372036854775807)
(num-test (rationalize -3037000503.0 -3037000500.0) -3)

(num-test (rationalize 33309123021416.7508179322803e-25 1e-20) 1/300218050279)
(num-test (rationalize 33309123021416.7508179322803e-25 1e-12) 1/230898233499)
(num-test (rationalize 33309123021416.7508179322803e-25 1e-23) 1/300218051179)

(num-test (rationalize 9223372036854775807 0) 9223372036854775807)
(num-test (rationalize 9223372036854775807 -1) 9223372036854775806)
(num-test (rationalize 9223372036854775807 -1/2) 9223372036854775807)
(num-test (rationalize 9223372036854775807 1/2) 9223372036854775807)
(num-test (rationalize 9223372036854775807 3/2) 9223372036854775806)
(num-test (rationalize 9223372036854775807 -3/2) 9223372036854775806)
(num-test (rationalize 9223372036854775807 1) 9223372036854775806)
(num-test (rationalize 9223372036854775807 inf.0) 0)

(test (rationalize (/ pi) 1e-8) 24288/76303)
(test (rationalize (/ pi) 1e-10) 33102/103993)
(num-test (rationalize 1e8 1e9) 0)
(num-test (rationalize 1e16 most-positive-fixnum) 0)
(num-test (rationalize most-positive-fixnum 1e20) 0)
(num-test (rationalize most-positive-fixnum most-positive-fixnum) 0)
(num-test (rationalize (/ 1 most-positive-fixnum) 0) (/ 1 most-positive-fixnum))
(num-test (rationalize 1e20 -1e21) 0)
(num-test (rationalize -1e20 1e21) 0)
(num-test (rationalize 1e20 inf.0) 0)

(num-test (rationalize (/ (expt 2 60) (expt 3 20)) .01) 2314582608/7)
(num-test (rationalize (/ (expt 2 60) (expt 3 20)) .001) 8266366457/25)
(num-test (rationalize 33309123021416.7508179322803e-25 1e-23) 1/300218051179)
(num-test (rationalize 11/30 .1) 1/3)
(num-test (rationalize 11/30 .2) 1/2)
(num-test (rationalize 11/30 .365) 1/2)
(num-test (rationalize 11/30 .367) 0)

;; these differ from the ratify result
(num-test (rationalize 0.02 .01) 1/34)
(num-test (rationalize 0.05 .01) 1/17)
(num-test (rationalize 0.06 .01) 1/15)
(num-test (rationalize 0.07 .01) 1/13)
(num-test (rationalize 0.32 .01) 5/16)
(num-test (rationalize 0.35 .01) 5/14)
(num-test (rationalize 0.39 .01) 2/5)
(num-test (rationalize 0.47 .01) 6/13)
(num-test (rationalize 0.48 .01) 8/17)
(num-test (rationalize 0.52 .01) 9/17)
(num-test (rationalize 0.53 .01) 7/13)
(num-test (rationalize 0.61 .01) 3/5)
(num-test (rationalize 0.65 .01) 9/14)
(num-test (rationalize 0.68 .01) 11/16)
(num-test (rationalize 0.93 .01) 12/13)
(num-test (rationalize 0.94 .01) 14/15)
(num-test (rationalize 0.95 .01) 16/17)
(num-test (rationalize 0.96 .01) 19/20)
(num-test (rationalize 0.97 .01) 24/25)
(num-test (rationalize 0.98 .01) 33/34)

(num-test (rationalize 0.01 .001) 1/91)
(num-test (rationalize 0.02 .001) 1/48)
(num-test (rationalize 0.06 .001) 2/33)
(num-test (rationalize 0.11 .001) 6/55)
(num-test (rationalize 0.14 .001) 6/43)
(num-test (rationalize 0.17 .001) 7/41)
(num-test (rationalize 0.18 .001) 7/39)
(num-test (rationalize 0.33 .001) 26/79)
(num-test (rationalize 0.34 .001) 15/44)
(num-test (rationalize 0.43 .001) 28/65)
(num-test (rationalize 0.46 .001) 17/37)
(num-test (rationalize 0.49 .001) 23/47)
(num-test (rationalize 0.51 .001) 24/47)
(num-test (rationalize 0.57 .001) 37/65)
(num-test (rationalize 0.58 .001) 18/31)
(num-test (rationalize 0.66 .001) 29/44)
(num-test (rationalize 0.67 .001) 53/79)
(num-test (rationalize 0.83 .001) 34/41)
(num-test (rationalize 0.86 .001) 37/43)
(num-test (rationalize 0.89 .001) 49/55)
(num-test (rationalize 0.94 .001) 31/33)
(num-test (rationalize 0.98 .001) 47/48)
(num-test (rationalize 0.99 .001) 90/91)

(num-test (rationalize 0.1001 .1) 1/5)
(num-test (rationalize 0.101 .1) 1/5)
(num-test (rationalize 0.451 .0010001) 9/20)
(num-test (rationalize 0.9876 .0001) 80/81)

(num-test (rationalize (expt 2 1/3) (expt 10 -10)) 96389/76504)
(num-test (rationalize (expt 2 1/3) (expt 10 -15)) 15240955/12096754)

(for-each
 (lambda (num-and-val)
   (let ((num (car num-and-val)) (val (cadr num-and-val))) (num-test-1 'rationalize num (rationalize num) val)))
 (vector (list 0 0) (list 1 1) (list 2 2) (list 3 3) (list -1 -1) (list -2 -2) (list -3 -3) 
	 (list 9223372036854775807 9223372036854775807) (list -9223372036854775808 -9223372036854775808) 
	 (list 1/2 1/2) (list 1/3 1/3) (list -1/2 -1/2) (list -1/3 -1/3) (list 1/9223372036854775807 0) 
	 (list 0.0 0) (list 1.0 1) (list 2.0 2) (list -2.0 -2) (list 1.000000000000000000000000000000000000002E-309 0))) 
  
(if (not with-bignums)
    (begin
      (test (< (abs (- (rationalize (/ pi) 1e-17) (/ pi))) 1e-10) #t) ; make sure we don't hang!
      (test (< (abs (- (rationalize (/ pi) 1e-18) (/ pi))) 1e-10) #t)
      (test (< (abs (- (rationalize (/ pi) 1e-20) (/ pi))) 1e-10) #t)

      (num-test (rationalize 1e-19 1e-21) 0)
      (num-test (rationalize 1e-19 1e-30) 0)
      (num-test (rationalize 1e-19 1e-50) 0)
      (num-test (rationalize 1e-19 0.0) 0)
      (num-test (rationalize 1e-19 1e-19) 0)
      (num-test (rationalize 1e-30 0.0) 0)
      (num-test (rationalize (+ .1 1e-18) 1e-17) 1/10)
      (num-test (rationalize (- .1 1e-18) 1e-17) 1/10)
      )
    (begin
      (test (rationalize (/ pi) 1e-17) 78256779/245850922) 
      (test (rationalize (/ pi) 1e-18) 340262731/1068966896)
      (test (rationalize (/ pi) 1e-20) 1963319607/6167950454)
      (test (rationalize (/ pi) 1e-30) 136308121570117/428224593349304)
      (num-test (rationalize (/ 1 most-negative-fixnum) 0) (/ 1 most-negative-fixnum))

      (num-test (rationalize 1e-19 1e-21) 1/9900990099009900991)
      (num-test (rationalize 1e-19 1e-30) 1/9999999999900000001)
      (num-test (rationalize 1e-30 0.0) 1/1000000000000000000000000000000)
      (num-test (rationalize (+ .1 1e-18) 0) 1894333982346309985/18943339823463098609)
      (num-test (rationalize (+ .1 1e-18) 1e-20) 1524131159466061/15241311594660609)
      (num-test (rationalize (- .1 1e-18) 1e-20) 2192446305355891/21924463053558909)
      (num-test (rationalize 1e18 1e19) 0)
      
      (num-test (rationalize 1180591620717411303424) 1180591620717411303424)
      (num-test (rationalize 1180591620717411303424 .9) 1180591620717411303424)
      (num-test (rationalize -1180591620717411303424 1.9) -1180591620717411303423)
      (test (rationalize -1180591620717411303424 nan.0) 'error)
      (num-test (rationalize -1180591620717411303424 inf.0) 0)
      (num-test (rationalize most-negative-fixnum 1) (+ most-negative-fixnum 1))

      (num-test (rationalize (/ 3.0 most-positive-fixnum) 1e-50) 3/9223372036854775807)
      (num-test (rationalize (/ 3.0 most-positive-fixnum) 1e-38) 3/9223372036854775807)

      (num-test (rationalize (expt 2 1/3) (expt 10 -20)) 11952836413/9486972548)
      (num-test (rationalize (expt 2 1/3) (expt 10 -30)) 2566462403285413/2037002559406049)
      (test (< (abs (- (expt (rationalize (expt 2 1/3) (expt 10 -30)) 3.0) 2)) 1e-29) #t)

      (test (rationalize 3796553736732654909229441/2684568892382786771291329) 1607521/1136689) ; default error?
      (test (< (abs (- (rationalize 3796553736732654909229441/2684568892382786771291329)3796553736732654909229441/2684568892382786771291329)) 1e-12) #t)
      (num-test (rationalize 3796553736732654909229441/2684568892382786771291329 1) 1)

      (let-temporarily (((*s7* 'bignum-precision) 1024))
	(num-test (rationalize (expt 2 1/3) 1e-40) 77270484057362988877/61329623839374997455)
	(num-test (rationalize 3796553736732654909229441/2684568892382786771291329 0) 3796553736732654909229441/2684568892382786771291329))))


(let ()
  (define (check-rationalize val n)
    (call-with-exit
     (lambda (return)
       (let* ((diffs (make-vector n 0.0))
	      (ratios (make-vector n 0)))
	 (do ((i 0 (+ i 1)))
	     ((= i n))
	   (let* ((err (expt 2 (- (+ i 1))))
		  (rat (rationalize val err))
		  (diff (abs (- rat val))))
	     (vector-set! ratios i rat)
	     (vector-set! diffs i diff)
	     (if (> diff err)
		 (begin
		   (format #t "|~A - ~A| = ~A > ~A (2^~A -> 2^~A)?~%" val rat diff err (log diff 2) (log err 2))
		   (return #f)))))
	 (and (apply >= (vector->list diffs))
	      (apply <= (map denominator ratios)))))))

  (for-each
   (lambda (val)
     (test (check-rationalize val 40) #t))
   (list pi (/ pi) (- pi) (- (/ pi)) (* 10 pi) (* -1000 pi) (exp 1.0) (exp -1.0) (exp 4.0) (exp -4.0)))

  (do ((i 0 (+ i 1))) 
      ((= i 100)) 
    (let ((val (- (random 2.0) 1.0))) 
      (let ((rat (check-rationalize val 40)))
	(if (not rat) 
	    (format #t "rationalize trouble with ~A~%" val)))))

  (when with-bignums
    (let-temporarily (((*s7* 'bignum-precision) 4096))
      (test (*s7* 'bignum-precision) 4096)
      
      (test (check-rationalize pi 100) #t)
      (test (check-rationalize (/ pi) 100) #t)
      
      (for-each
       (lambda (arg)
	 (test (set! (*s7* 'bignum-precision) arg) 'error))
       (list "hi" #\a 'a-symbol #(1 2 3) -1 0 1 3.14 3/4 1.0+1.0i #t abs #<eof> #<unspecified> (lambda () 1)))
      
      (test (bignum-precision 213) 'error)
      (test (set! (bignum-precision 213) 123) 'error)
      
      (set! (*s7* 'bignum-precision) 2)
      (test (*s7* 'bignum-precision) 2)
      (test (object->string pi) "3.0E0"))))

(test (rationalize) 'error)
(test (rationalize 1.23+1.0i 1.23+1.0i) 'error)
(test (rationalize 1.23 1.23 1.23) 'error)
(test (rationalize 0 nan.0) 'error) ; ??
(test (rationalize 1 nan.0) 'error)
(test (rationalize (expt 2 60) -) 'error)

(for-each
 (lambda (arg)
   (test (rationalize arg 0.1) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))

(for-each
 (lambda (arg)
   (test (rationalize arg nan.0) 'error)
   (test (rationalize nan.0 arg) 'error)
   (test (rationalize arg inf.0) 'error)
   (test (rationalize inf.0 arg) 'error)
   (test (rationalize 0.1 arg) 'error)
   (test (rationalize 1 arg) 'error)
   (test (rationalize 1/2 arg) 'error)
   (test (rationalize 0+i arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))

(if with-bignums
    (begin
      (num-test (rationalize .1e20) 10000000000000000000)
      (num-test (rationalize 1e19) 10000000000000000000)
      (num-test (rationalize 1e20) 100000000000000000000))
    (begin
      (num-test (rationalize .1e20) 'error)
      (num-test (rationalize 1e19) 'error)
      (num-test (rationalize 1e20) 'error)))

(call-with-exit
 (lambda (done)
   (do ((k -6 (- k 1)))
       ((= k -17))
     (call-with-exit
      (lambda (ok)
	(let ((fraction (rationalize (expt 10.0 k) 1e-18)))
	  (do ((i 0 (+ i 1)))
	      ((= i 100))
	    (if (not (zero? (random fraction)))
		(ok))))
	(format #t ";random of small ratios is always 0 below ca. ~A~%" (expt 10.0 k))
	(done))))))


;;; Bill Gosper's farint:

(let ()
  (define* (farint x (err 1/1000000)) ; this err term is not the same as the s7 rationalize error term
    
    (define* (farint-1 x nhi dhi (ln 0) (ld 1) (hn 1) (hd 0))
      (if (> (+ ln hn) (* (+ ld hd) x))
	  (let* ((m (min (if (= 0 ln) 
			     nhi 
			     (floor (/ (- nhi hn) ln)))
			 (floor (/ (- dhi hd) ld))))
		 (d (- (* x ld) ln))
		 (k (if (= 0 d) 
			m 
			(ceiling (/ (- hn (* x hd)) d)))))
	    (if (< k m)
		(let ((hn1 (+ (* k ln) hn))
		      (hd1 (+ (* k ld) hd)))
		  (farint-1 x nhi dhi hn1 hd1 (- hn1 ln) (- hd1 ld)))
		
		(let* ((n (+ (* m ln) hn)) (d (+ (* m ld) hd)))
		  (if (< (* 2 d ld x) (+ (* ld n) (* ln d)))
		      (/ ln ld) 
		      (/ n d)))))
	  
	  (let* ((m (min (floor (/ (- nhi ln) hn))
			 (if (= 0 hd) 
			     dhi 
			     (floor (/ (- dhi ld) hd)))))
		 (d (- hn (* x hd)))
		 (k (if (= 0 d) 
			m 
			(ceiling (/ (- (* x ld) ln) d)))))
	    (if (< k m)
		(let ((ln1 (+ (* k hn) ln))
		      (ld1 (+ (* k hd) ld)))
		  (farint-1 x nhi dhi (- ln1 hn) (- ld1 hd) ln1 ld1))
		(let* ((n (+ (* m hn) ln)) (d (+ (* m hd) ld)))
		  (if (< (* 2 d hd x) (+ (* hd n) (* hn d)))
		      (/ n d) 
		      (/ hn hd)))))))
    
    (farint-1 x (/ err) (/ err)))

  (num-test (farint .1) 1/10))
  



;;; --------------------------------------------------------------------------------
;;; min
;;; --------------------------------------------------------------------------------

(num-test (min -0.0) 0.0)
(num-test (min -1 -1/2) -1)
(num-test (min -1/2 0) -1/2)
(num-test (min 0 -1/2) -1/2)
(num-test (min -1 1/2) -1)
(num-test (min -1 1/2) -1)
(num-test (min -1.0) -1.0)
(num-test (min -1.797693134862315699999999999999999999998E308 -9223372036854775808) -1.797693134862315699999999999999999999998E308)
(num-test (min -1/2 -1) -1)
(num-test (min -1/2 1) -1/2)
(num-test (min -10) -10)
(num-test (min -10/3) -10/3)
(num-test (min -1234000000) -1234000000)
(num-test (min -1234000000.0) -1234000000.0)
(num-test (min -1234000000/10) -1234000000/10)
(num-test (min -2 3 0 7) -2)
(num-test (min -2) -2)
(num-test (min -2.71828182845905) -2.71828182845905)
(num-test (min -2/2) -2/2)
(num-test (min -3/2 -1/2) -3/2)
(num-test (min -3/2 -6/5) -3/2)
(num-test (min -3/2 1/2) -3/2)
(num-test (min -3/2 6/5) -3/2)
(num-test (min -362880) -362880)
(num-test (min -362880/1234) -362880/1234)
(num-test (min -6 -12) -12)
(num-test (min -9223372036854775808 -9223372036854775808) -9223372036854775808)
(num-test (min -9223372036854775808 5.551115123125783999999999999999999999984E-17) -9.223372036854775808E18)
(num-test (min -9223372036854775808 9223372036854775807 -9223372036854775808) -9223372036854775808)
(num-test (min 0 1 1) 0)
(num-test (min 0 1 1.0) 0.0)
(num-test (min 0 1 1/1) 0)
(num-test (min 0 1 123.4) 0.0)
(num-test (min 0 1 1234) 0)
(num-test (min 0 1 1234/11) 0)
(num-test (min 0 1) 0)
(num-test (min 0 1.0 1) 0.0)
(num-test (min 0 1.0 1.0) 0.0)
(num-test (min 0 1.0 1/1) 0.0)
(num-test (min 0 1.0 123.4) 0.0)
(num-test (min 0 1.0 1234) 0.0)
(num-test (min 0 1.0 1234/11) 0.0)
(num-test (min 0 1.0) 0.0)
(num-test (min 0 1/1) 0)
(num-test (min 0 123.4 1) 0.0)
(num-test (min 0 123.4 1.0) 0.0)
(num-test (min 0 123.4 1/1) 0.0)
(num-test (min 0 123.4 123.4) 0.0)
(num-test (min 0 123.4 1234) 0.0)
(num-test (min 0 123.4 1234/11) 0.0)
(num-test (min 0 123.4) 0.0)
(num-test (min 0 1234 1) 0)
(num-test (min 0 1234 1.0) 0.0)
(num-test (min 0 1234 1/1) 0)
(num-test (min 0 1234 123.4) 0.0)
(num-test (min 0 1234 1234) 0)
(num-test (min 0 1234 1234/11) 0)
(num-test (min 0 1234) 0)
(num-test (min 0 1234/11 1) 0)
(num-test (min 0 1234/11 1.0) 0.0)
(num-test (min 0 1234/11 1/1) 0)
(num-test (min 0 1234/11 123.4) 0.0)
(num-test (min 0 1234/11 1234) 0)
(num-test (min 0 1234/11 1234/11) 0)
(num-test (min 0 1234/11) 0)
(num-test (min 0) 0)
(num-test (min 0.0 1 1) 0.0)
(num-test (min 0.0 1 1.0) 0.0)
(num-test (min 0.0 1 1/1) 0.0)
(num-test (min 0.0 1 123.4) 0.0)
(num-test (min 0.0 1 1234) 0.0)
(num-test (min 0.0 1 1234/11) 0.0)
(num-test (min 0.0 1) 0.0)
(num-test (min 0.0 1.0 1) 0.0)
(num-test (min 0.0 1.0 1.0) 0.0)
(num-test (min 0.0 1.0 1/1) 0.0)
(num-test (min 0.0 1.0 123.4) 0.0)
(num-test (min 0.0 1.0 1234) 0.0)
(num-test (min 0.0 1.0 1234/11) 0.0)
(num-test (min 0.0 1.0) 0.0)
(num-test (min 0.0 1/1) 0.0)
(num-test (min 0.0 123.4 1) 0.0)
(num-test (min 0.0 123.4 1.0) 0.0)
(num-test (min 0.0 123.4 1/1) 0.0)
(num-test (min 0.0 123.4 123.4) 0.0)
(num-test (min 0.0 123.4 1234) 0.0)
(num-test (min 0.0 123.4 1234/11) 0.0)
(num-test (min 0.0 123.4) 0.0)
(num-test (min 0.0 1234 1) 0.0)
(num-test (min 0.0 1234 1.0) 0.0)
(num-test (min 0.0 1234 1/1) 0.0)
(num-test (min 0.0 1234 123.4) 0.0)
(num-test (min 0.0 1234 1234) 0.0)
(num-test (min 0.0 1234 1234/11) 0.0)
(num-test (min 0.0 1234) 0.0)
(num-test (min 0.0 1234/11 1) 0.0)
(num-test (min 0.0 1234/11 1.0) 0.0)
(num-test (min 0.0 1234/11 1/1) 0.0)
(num-test (min 0.0 1234/11 123.4) 0.0)
(num-test (min 0.0 1234/11 1234) 0.0)
(num-test (min 0.0 1234/11 1234/11) 0.0)
(num-test (min 0.0 1234/11) 0.0)
(num-test (min 0.0) 0.0)
(num-test (min 0/1) 0/1)
(num-test (min 0/1) 0/1)
(num-test (min 1 -1/2) -1/2)
(num-test (min 1 1 1) 1)
(num-test (min 1 1 1.0) 1.0)
(num-test (min 1 1 1/1) 1)
(num-test (min 1 1 123.4) 1.0)
(num-test (min 1 1 1234) 1)
(num-test (min 1 1 1234/11) 1)
(num-test (min 1 1) 1)
(num-test (min 1 1.0 1) 1.0)
(num-test (min 1 1.0 1.0) 1.0)
(num-test (min 1 1.0 1/1) 1.0)
(num-test (min 1 1.0 123.4) 1.0)
(num-test (min 1 1.0 1234) 1.0)
(num-test (min 1 1.0 1234/11) 1.0)
(num-test (min 1 1.0) 1.0)
(num-test (min 1 1/1) 1)
(num-test (min 1 1/2) 1/2)
(num-test (min 1 123.4 1) 1.0)
(num-test (min 1 123.4 1.0) 1.0)
(num-test (min 1 123.4 1/1) 1.0)
(num-test (min 1 123.4 123.4) 1.0)
(num-test (min 1 123.4 1234) 1.0)
(num-test (min 1 123.4 1234/11) 1.0)
(num-test (min 1 123.4) 1.0)
(num-test (min 1 1234 1) 1)
(num-test (min 1 1234 1.0) 1.0)
(num-test (min 1 1234 1/1) 1)
(num-test (min 1 1234 123.4) 1.0)
(num-test (min 1 1234 1234) 1)
(num-test (min 1 1234 1234/11) 1)
(num-test (min 1 1234) 1)
(num-test (min 1 1234/11 1) 1)
(num-test (min 1 1234/11 1.0) 1.0)
(num-test (min 1 1234/11 1/1) 1)
(num-test (min 1 1234/11 123.4) 1.0)
(num-test (min 1 1234/11 1234) 1)
(num-test (min 1 1234/11 1234/11) 1)
(num-test (min 1 1234/11) 1)
(num-test (min 1 3 2 -7) -7)
(num-test (min 1.0 1 1) 1.0)
(num-test (min 1.0 1 1.0) 1.0)
(num-test (min 1.0 1 1/1) 1.0)
(num-test (min 1.0 1 123.4) 1.0)
(num-test (min 1.0 1 1234) 1.0)
(num-test (min 1.0 1 1234/11) 1.0)
(num-test (min 1.0 1) 1.0)
(num-test (min 1.0 1.0 1) 1.0)
(num-test (min 1.0 1.0 1.0) 1.0)
(num-test (min 1.0 1.0 1/1) 1.0)
(num-test (min 1.0 1.0 123.4) 1.0)
(num-test (min 1.0 1.0 1234) 1.0)
(num-test (min 1.0 1.0 1234/11) 1.0)
(num-test (min 1.0 1.0) 1.0)
(num-test (min 1.0 1/1) 1.0)
(num-test (min 1.0 123.4 1) 1.0)
(num-test (min 1.0 123.4 1.0) 1.0)
(num-test (min 1.0 123.4 1/1) 1.0)
(num-test (min 1.0 123.4 123.4) 1.0)
(num-test (min 1.0 123.4 1234) 1.0)
(num-test (min 1.0 123.4 1234/11) 1.0)
(num-test (min 1.0 123.4) 1.0)
(num-test (min 1.0 1234 1) 1.0)
(num-test (min 1.0 1234 1.0) 1.0)
(num-test (min 1.0 1234 1/1) 1.0)
(num-test (min 1.0 1234 123.4) 1.0)
(num-test (min 1.0 1234 1234) 1.0)
(num-test (min 1.0 1234 1234/11) 1.0)
(num-test (min 1.0 1234) 1.0)
(num-test (min 1.0 1234/11 1) 1.0)
(num-test (min 1.0 1234/11 1.0) 1.0)
(num-test (min 1.0 1234/11 1/1) 1.0)
(num-test (min 1.0 1234/11 123.4) 1.0)
(num-test (min 1.0 1234/11 1234) 1.0)
(num-test (min 1.0 1234/11 1234/11) 1.0)
(num-test (min 1.0 1234/11) 1.0)
(num-test (min 1.0) 1.0)
(num-test (min 1.110223024625156799999999999999999999997E-16 -9223372036854775808) -9.223372036854775808E18)
(num-test (min 1.110223024625156799999999999999999999997E-16 5.551115123125783999999999999999999999984E-17 5.42101086242752217060000000000000000001E-20) 5.42101086242752217060000000000000000001E-20)
(num-test (min 1/2 -1) -1)
(num-test (min 1/2 1) 1/2)
(num-test (min 1/46116860184273883 1/46116860184273879) 1/46116860184273883)
(num-test (min 1/9223372036854775807 1/9223372036854775300) 1/9223372036854775807)
(num-test (min 1/9223372036854775807 2/9223372036854775807) 1/9223372036854775807)
(num-test (min 10) 10)
(num-test (min 10/3) 10/3)
(num-test (min 1010-0.i) 1010.0)
(num-test (min 123.4 1 1) 1.0)
(num-test (min 123.4 1 1.0) 1.0)
(num-test (min 123.4 1 1/1) 1.0)
(num-test (min 123.4 1 123.4) 1.0)
(num-test (min 123.4 1 1234) 1.0)
(num-test (min 123.4 1 1234/11) 1.0)
(num-test (min 123.4 1) 1.0)
(num-test (min 123.4 1.0 1) 1.0)
(num-test (min 123.4 1.0 1.0) 1.0)
(num-test (min 123.4 1.0 1/1) 1.0)
(num-test (min 123.4 1.0 123.4) 1.0)
(num-test (min 123.4 1.0 1234) 1.0)
(num-test (min 123.4 1.0 1234/11) 1.0)
(num-test (min 123.4 1.0) 1.0)
(num-test (min 123.4 1/1) 1.0)
(num-test (min 123.4 123.4 1) 1.0)
(num-test (min 123.4 123.4 1.0) 1.0)
(num-test (min 123.4 123.4 1/1) 1.0)
(num-test (min 123.4 123.4 123.4) 123.4)
(num-test (min 123.4 123.4 1234) 123.4)
(num-test (min 123.4 123.4 1234/11) 112.18181818181819)
(num-test (min 123.4 123.4) 123.4)
(num-test (min 123.4 1234 1) 1.0)
(num-test (min 123.4 1234 1.0) 1.0)
(num-test (min 123.4 1234 1/1) 1.0)
(num-test (min 123.4 1234 123.4) 123.4)
(num-test (min 123.4 1234 1234) 123.4)
(num-test (min 123.4 1234 1234/11) 112.18181818181819)
(num-test (min 123.4 1234) 123.4)
(num-test (min 123.4 1234/11 1) 1.0)
(num-test (min 123.4 1234/11 1.0) 1.0)
(num-test (min 123.4 1234/11 1/1) 1.0)
(num-test (min 123.4 1234/11 123.4) 112.18181818181819)
(num-test (min 123.4 1234/11 1234) 112.18181818181819)
(num-test (min 123.4 1234/11 1234/11) 112.18181818181819)
(num-test (min 123.4 1234/11) 112.18181818181819)
(num-test (min 1234 1 1) 1)
(num-test (min 1234 1 1.0) 1.0)
(num-test (min 1234 1 1/1) 1)
(num-test (min 1234 1 123.4) 1.0)
(num-test (min 1234 1 1234) 1)
(num-test (min 1234 1 1234/11) 1)
(num-test (min 1234 1) 1)
(num-test (min 1234 1.0 1) 1.0)
(num-test (min 1234 1.0 1.0) 1.0)
(num-test (min 1234 1.0 1/1) 1.0)
(num-test (min 1234 1.0 123.4) 1.0)
(num-test (min 1234 1.0 1234) 1.0)
(num-test (min 1234 1.0 1234/11) 1.0)
(num-test (min 1234 1.0) 1.0)
(num-test (min 1234 1/1) 1)
(num-test (min 1234 123.4 1) 1.0)
(num-test (min 1234 123.4 1.0) 1.0)
(num-test (min 1234 123.4 1/1) 1.0)
(num-test (min 1234 123.4 123.4) 123.4)
(num-test (min 1234 123.4 1234) 123.4)
(num-test (min 1234 123.4 1234/11) 112.18181818181819)
(num-test (min 1234 123.4) 123.4)
(num-test (min 1234 1234 1) 1)
(num-test (min 1234 1234 1.0) 1.0)
(num-test (min 1234 1234 1/1) 1)
(num-test (min 1234 1234 123.4) 123.4)
(num-test (min 1234 1234 1234) 1234)
(num-test (min 1234 1234 1234/11) 1234/11)
(num-test (min 1234 1234) 1234)
(num-test (min 1234 1234/11 1) 1)
(num-test (min 1234 1234/11 1.0) 1.0)
(num-test (min 1234 1234/11 1/1) 1)
(num-test (min 1234 1234/11 123.4) 112.18181818181819)
(num-test (min 1234 1234/11 1234) 1234/11)
(num-test (min 1234 1234/11 1234/11) 1234/11)
(num-test (min 1234 1234/11) 1234/11)
(num-test (min 1234/11 1 1) 1)
(num-test (min 1234/11 1 1.0) 1.0)
(num-test (min 1234/11 1 1/1) 1)
(num-test (min 1234/11 1 123.4) 1.0)
(num-test (min 1234/11 1 1234) 1)
(num-test (min 1234/11 1 1234/11) 1)
(num-test (min 1234/11 1) 1)
(num-test (min 1234/11 1.0 1) 1.0)
(num-test (min 1234/11 1.0 1.0) 1.0)
(num-test (min 1234/11 1.0 1/1) 1.0)
(num-test (min 1234/11 1.0 123.4) 1.0)
(num-test (min 1234/11 1.0 1234) 1.0)
(num-test (min 1234/11 1.0 1234/11) 1.0)
(num-test (min 1234/11 1.0) 1.0)
(num-test (min 1234/11 1/1) 1)
(num-test (min 1234/11 123.4 1) 1.0)
(num-test (min 1234/11 123.4 1.0) 1.0)
(num-test (min 1234/11 123.4 1/1) 1.0)
(num-test (min 1234/11 123.4 123.4) 112.18181818181819)
(num-test (min 1234/11 123.4 1234) 112.18181818181819)
(num-test (min 1234/11 123.4 1234/11) 112.18181818181819)
(num-test (min 1234/11 123.4) 112.18181818181819)
(num-test (min 1234/11 1234 1) 1)
(num-test (min 1234/11 1234 1.0) 1.0)
(num-test (min 1234/11 1234 1/1) 1)
(num-test (min 1234/11 1234 123.4) 112.18181818181819)
(num-test (min 1234/11 1234 1234) 1234/11)
(num-test (min 1234/11 1234 1234/11) 1234/11)
(num-test (min 1234/11 1234) 1234/11)
(num-test (min 1234/11 1234/11 1) 1)
(num-test (min 1234/11 1234/11 1.0) 1.0)
(num-test (min 1234/11 1234/11 1/1) 1)
(num-test (min 1234/11 1234/11 123.4) 112.18181818181819)
(num-test (min 1234/11 1234/11 1234) 1234/11)
(num-test (min 1234/11 1234/11 1234/11) 1234/11)
(num-test (min 1234/11 1234/11) 1234/11)
(num-test (min 1234000000) 1234000000)
(num-test (min 1234000000.0) 1234000000.0)
(num-test (min 1234000000/10) 1234000000/10)
(num-test (min 2 1+0i) 1.0)
(num-test (min 2) 2)
(num-test (min 2.71828182845905) 2.71828182845905)
(num-test (min 2/2) 2/2)
(num-test (min 2/9223372036854775807 1/9223372036854775807) 1/9223372036854775807)
(num-test (min 3  5 5 330 4 -24) -24 )
(num-test (min 3) 3)
(num-test (min 3.0 7 1) 1.0)
(num-test (min 3/2 -1/2) -1/2)
(num-test (min 3/2 -6/5) -6/5)
(num-test (min 3/2 1/2) 1/2)
(num-test (min 3/2 6/5) 6/5)
(num-test (min 362880) 362880)
(num-test (min 362880/1234) 362880/1234)
(num-test (min 5.0 2) 2.0)  ; why not 2?
(num-test (min 5.551115123125783999999999999999999999984E-17 1.110223024625156799999999999999999999997E-16) 5.551115123125783999999999999999999999984E-17)
(num-test (min 6 12) 6)
(num-test (min 92233720368547758/9223372036854775807 92233720368547757/9223372036854775807) 92233720368547757/9223372036854775807)
(num-test (min 9223372036854775807 -9223372036854775808) -9223372036854775808)

(when with-bignums
  (num-test (min 12345678901234567890 12345678901234567891) 12345678901234567890)
  (num-test (min 2.168404344971008681816600431489558149231E-17 2.168404344971008869895696563055543437233E-17) 2.168404344971008681816600431489558149231E-17)
  (num-test (min 2.168404344971008869895696563055543437233E-17 2.168404344971008681816600431489558149231E-17 ) 2.168404344971008681816600431489558149231E-17)
  (num-test (min 2.168404344971008681816600431489558149231E-17 1/46116860184273879) 2.168404344971008681816600431489558149231E-17)
  (num-test (min 1/46116860184273883 2.168404344971008869895696563055543437233E-17) 2.168404344971008681816600431489558149231E-17)
  
  (num-test (let ((n (list 2.0 (bignum "3")))) (eval `(let () (define (f1) (min ,@n)) (f1)))) 2.0)
  (num-test (let ((n (list 2.0 (bignum "0")))) (eval `(let () (define (f1) (min ,@n)) (f1)))) 0)
  (num-test (let ((n (list 2.0 (bignum "3")))) (eval `(let () (define (f1) (max ,@n)) (f1)))) 3)
  (num-test (let ((n (list 2.0 (bignum "0")))) (eval `(let () (define (f1) (max ,@n)) (f1)))) 2.0))

(test (min 1.23+1.0i) 'error)
(test (min) 'error)
(test (min 1234000000.0+2.71828182845905i) 'error)
(test (min 2.71828182845905+3.14159265358979i) 'error)
(test (min 1.0+1.0i) 'error)
(test (min 0.0+0.00000001i) 'error)
(test (min -0.0+0.00000001i) 'error)
(test (min -1.0+1.0i) 'error)
(test (min -1234000000.0+2.71828182845905i) 'error)
(test (min -2.71828182845905+3.14159265358979i) 'error)
(test (min nan.0 1+i) 'error)
(test (min nan.0 1 1+i) 'error)
(test (min 1 nan.0 2 1+i) 'error)
(test (min inf.0 1+i) 'error)
(test (min inf.0 nan.0 0-i 1) 'error)

(test (nan? (min 3/4 1/0)) #t)
(test (nan? (min 3/4 nan.0)) #t)
(test (min 3/4 nan.0 #\a) 'error)

(for-each
 (lambda (arg)
   (test (min arg nan.0) 'error)
   (test (min nan.0 arg) 'error)
   (test (min arg inf.0) 'error)
   (test (min inf.0 arg) 'error)
   (test (min 0 arg) 'error)
   (test (min 0.0 arg) 'error)
   (test (min 1/2 arg) 'error)
   (test (min 1+i arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))




;;; --------------------------------------------------------------------------------
;;; max
;;; --------------------------------------------------------------------------------

(num-test (max -0.0) 0.0)
(num-test (max -1 -1/2) -1/2)
(num-test (max -1/2 0) 0)
(num-test (max -1/2 -1) -1/2)
(num-test (max 0 -1/2) 0)
(num-test (max -1 -1/2) -1/2)
(num-test (max -1 1/2) 1/2)
(num-test (max -1.0) -1.0)
(num-test (max -1.797693134862315699999999999999999999998E308 -9223372036854775808) -9.223372036854775808E18)
(num-test (max -1/2 -1) -1/2)
(num-test (max -1/2 1) 1)
(num-test (max -10) -10)
(num-test (max -10/3) -10/3)
(num-test (max -1234000000) -1234000000)
(num-test (max -1234000000.0) -1234000000.0)
(num-test (max -1234000000/10) -1234000000/10)
(num-test (max -2 3 0 7) 7)
(num-test (max -2) -2)
(num-test (max -2.71828182845905) -2.71828182845905)
(num-test (max -2/2) -2/2)
(num-test (max -3/2 -1/2) -1/2)
(num-test (max -3/2 -6/5) -6/5)
(num-test (max -3/2 1/2) 1/2)
(num-test (max -3/2 6/5) 6/5)
(num-test (max -362880) -362880)
(num-test (max -362880/1234) -362880/1234)
(num-test (max -6 -12) -6)
(num-test (max -9223372036854775808 -9223372036854775808) -9223372036854775808)
(num-test (max -9223372036854775808 5.551115123125783999999999999999999999984E-17) 5.551115123125783999999999999999999999984E-17)
(num-test (max -9223372036854775808 9223372036854775807 -9223372036854775808) 9223372036854775807)
(num-test (max 0 1 1) 1)
(num-test (max 0 1 1.0) 1.0)
(num-test (max 0 1 1/1) 1)
(num-test (max 0 1 123.4) 123.4)
(num-test (max 0 1 1234) 1234)
(num-test (max 0 1 1234/11) 1234/11)
(num-test (max 0 1) 1)
(num-test (max 0 1.0 1) 1.0)
(num-test (max 0 1.0 1.0) 1.0)
(num-test (max 0 1.0 1/1) 1.0)
(num-test (max 0 1.0 123.4) 123.4)
(num-test (max 0 1.0 1234) 1234.0)
(num-test (max 0 1.0 1234/11) 112.18181818181819)
(num-test (max 0 1.0) 1.0)
(num-test (max 0 1/1) 1)
(num-test (max 0 123.4 1) 123.4)
(num-test (max 0 123.4 1.0) 123.4)
(num-test (max 0 123.4 1/1) 123.4)
(num-test (max 0 123.4 123.4) 123.4)
(num-test (max 0 123.4 1234) 1234.0)
(num-test (max 0 123.4 1234/11) 123.4)
(num-test (max 0 123.4) 123.4)
(num-test (max 0 1234 1) 1234)
(num-test (max 0 1234 1.0) 1234.0)
(num-test (max 0 1234 1/1) 1234)
(num-test (max 0 1234 123.4) 1234.0)
(num-test (max 0 1234 1234) 1234)
(num-test (max 0 1234 1234/11) 1234)
(num-test (max 0 1234) 1234)
(num-test (max 0 1234/11 1) 1234/11)
(num-test (max 0 1234/11 1.0) 112.18181818181819)
(num-test (max 0 1234/11 1/1) 1234/11)
(num-test (max 0 1234/11 123.4) 123.4)
(num-test (max 0 1234/11 1234) 1234)
(num-test (max 0 1234/11 1234/11) 1234/11)
(num-test (max 0 1234/11) 1234/11)
(num-test (max 0) 0)
(num-test (max 0.0 1 1) 1.0)
(num-test (max 0.0 1 1.0) 1.0)
(num-test (max 0.0 1 1/1) 1.0)
(num-test (max 0.0 1 123.4) 123.4)
(num-test (max 0.0 1 1234) 1234.0)
(num-test (max 0.0 1 1234/11) 112.18181818181819)
(num-test (max 0.0 1) 1.0)
(num-test (max 0.0 1.0 1) 1.0)
(num-test (max 0.0 1.0 1.0) 1.0)
(num-test (max 0.0 1.0 1/1) 1.0)
(num-test (max 0.0 1.0 123.4) 123.4)
(num-test (max 0.0 1.0 1234) 1234.0)
(num-test (max 0.0 1.0 1234/11) 112.18181818181819)
(num-test (max 0.0 1.0) 1.0)
(num-test (max 0.0 1/1) 1.0)
(num-test (max 0.0 123.4 1) 123.4)
(num-test (max 0.0 123.4 1.0) 123.4)
(num-test (max 0.0 123.4 1/1) 123.4)
(num-test (max 0.0 123.4 123.4) 123.4)
(num-test (max 0.0 123.4 1234) 1234.0)
(num-test (max 0.0 123.4 1234/11) 123.4)
(num-test (max 0.0 123.4) 123.4)
(num-test (max 0.0 1234 1) 1234.0)
(num-test (max 0.0 1234 1.0) 1234.0)
(num-test (max 0.0 1234 1/1) 1234.0)
(num-test (max 0.0 1234 123.4) 1234.0)
(num-test (max 0.0 1234 1234) 1234.0)
(num-test (max 0.0 1234 1234/11) 1234.0)
(num-test (max 0.0 1234) 1234.0)
(num-test (max 0.0 1234/11 1) 112.18181818181819)
(num-test (max 0.0 1234/11 1.0) 112.18181818181819)
(num-test (max 0.0 1234/11 1/1) 112.18181818181819)
(num-test (max 0.0 1234/11 123.4) 123.4)
(num-test (max 0.0 1234/11 1234) 1234.0)
(num-test (max 0.0 1234/11 1234/11) 112.18181818181819)
(num-test (max 0.0 1234/11) 112.18181818181819)
(num-test (max 0.0) 0.0)
(num-test (max 0/1) 0/1)
(num-test (max 0/1) 0/1)
(num-test (max 1 -1/2) 1)
(num-test (max 1 1 1) 1)
(num-test (max 1 1 1.0) 1.0)
(num-test (max 1 1 1/1) 1)
(num-test (max 1 1 123.4) 123.4)
(num-test (max 1 1 1234) 1234)
(num-test (max 1 1 1234/11) 1234/11)
(num-test (max 1 1) 1)
(num-test (max 1 1.0 1) 1.0)
(num-test (max 1 1.0 1.0) 1.0)
(num-test (max 1 1.0 1/1) 1.0)
(num-test (max 1 1.0 123.4) 123.4)
(num-test (max 1 1.0 1234) 1234.0)
(num-test (max 1 1.0 1234/11) 112.18181818181819)
(num-test (max 1 1.0) 1.0)
(num-test (max 1 1/1) 1)
(num-test (max 1 1/2) 1)
(num-test (max 1 123.4 1) 123.4)
(num-test (max 1 123.4 1.0) 123.4)
(num-test (max 1 123.4 1/1) 123.4)
(num-test (max 1 123.4 123.4) 123.4)
(num-test (max 1 123.4 1234) 1234.0)
(num-test (max 1 123.4 1234/11) 123.4)
(num-test (max 1 123.4) 123.4)
(num-test (max 1 1234 1) 1234)
(num-test (max 1 1234 1.0) 1234.0)
(num-test (max 1 1234 1/1) 1234)
(num-test (max 1 1234 123.4) 1234.0)
(num-test (max 1 1234 1234) 1234)
(num-test (max 1 1234 1234/11) 1234)
(num-test (max 1 1234) 1234)
(num-test (max 1 1234/11 1) 1234/11)
(num-test (max 1 1234/11 1.0) 112.18181818181819)
(num-test (max 1 1234/11 1/1) 1234/11)
(num-test (max 1 1234/11 123.4) 123.4)
(num-test (max 1 1234/11 1234) 1234)
(num-test (max 1 1234/11 1234/11) 1234/11)
(num-test (max 1 1234/11) 1234/11)
(num-test (max 1 3 2 -7) 3)
(num-test (max 1 3 2 -7) 3)
(num-test (max 1.0 1 1) 1.0)
(num-test (max 1.0 1 1.0) 1.0)
(num-test (max 1.0 1 1/1) 1.0)
(num-test (max 1.0 1 123.4) 123.4)
(num-test (max 1.0 1 1234) 1234.0)
(num-test (max 1.0 1 1234/11) 112.18181818181819)
(num-test (max 1.0 1) 1.0)
(num-test (max 1.0 1.0 1) 1.0)
(num-test (max 1.0 1.0 1.0) 1.0)
(num-test (max 1.0 1.0 1/1) 1.0)
(num-test (max 1.0 1.0 123.4) 123.4)
(num-test (max 1.0 1.0 1234) 1234.0)
(num-test (max 1.0 1.0 1234/11) 112.18181818181819)
(num-test (max 1.0 1.0) 1.0)
(num-test (max 1.0 1/1) 1.0)
(num-test (max 1.0 123.4 1) 123.4)
(num-test (max 1.0 123.4 1.0) 123.4)
(num-test (max 1.0 123.4 1/1) 123.4)
(num-test (max 1.0 123.4 123.4) 123.4)
(num-test (max 1.0 123.4 1234) 1234.0)
(num-test (max 1.0 123.4 1234/11) 123.4)
(num-test (max 1.0 123.4) 123.4)
(num-test (max 1.0 1234 1) 1234.0)
(num-test (max 1.0 1234 1.0) 1234.0)
(num-test (max 1.0 1234 1/1) 1234.0)
(num-test (max 1.0 1234 123.4) 1234.0)
(num-test (max 1.0 1234 1234) 1234.0)
(num-test (max 1.0 1234 1234/11) 1234.0)
(num-test (max 1.0 1234) 1234.0)
(num-test (max 1.0 1234/11 1) 112.18181818181819)
(num-test (max 1.0 1234/11 1.0) 112.18181818181819)
(num-test (max 1.0 1234/11 1/1) 112.18181818181819)
(num-test (max 1.0 1234/11 123.4) 123.4)
(num-test (max 1.0 1234/11 1234) 1234.0)
(num-test (max 1.0 1234/11 1234/11) 112.18181818181819)
(num-test (max 1.0 1234/11) 112.18181818181819)
(num-test (max 1.0) 1.0)
(num-test (max 1.110223024625156799999999999999999999997E-16 -9223372036854775808) 1.110223024625156799999999999999999999997E-16)
(num-test (max 1.110223024625156799999999999999999999997E-16 5.551115123125783999999999999999999999984E-17 5.42101086242752217060000000000000000001E-20) 1.110223024625156799999999999999999999997E-16)
(num-test (max 1/2 -1) 1/2)
(num-test (max 1/2 1) 1)
(num-test (max 1/461168601842738841 1/461168601842738790) 1/461168601842738790)
(num-test (max 1/4611686018427388416 1/4611686018427387904) 1/4611686018427387904)
(num-test (max 1/461168601842738848 1/461168601842738790) 1/461168601842738790)
(num-test (max 1/9223372036854775300 1/9223372036854775807) 1/9223372036854775300)
(num-test (max 1/9223372036854775807 1/9223372036854775300) 1/9223372036854775300)
(num-test (max 1/9223372036854775807 1/9223372036854775806) 1/9223372036854775806)
(num-test (max 1/9223372036854775807 2/9223372036854775807) 2/9223372036854775807)
(num-test (max 10) 10)
(num-test (max 10/3) 10/3)
(num-test (max 123.4 1 1) 123.4)
(num-test (max 123.4 1 1.0) 123.4)
(num-test (max 123.4 1 1/1) 123.4)
(num-test (max 123.4 1 123.4) 123.4)
(num-test (max 123.4 1 1234) 1234.0)
(num-test (max 123.4 1 1234/11) 123.4)
(num-test (max 123.4 1) 123.4)
(num-test (max 123.4 1.0 1) 123.4)
(num-test (max 123.4 1.0 1.0) 123.4)
(num-test (max 123.4 1.0 1/1) 123.4)
(num-test (max 123.4 1.0 123.4) 123.4)
(num-test (max 123.4 1.0 1234) 1234.0)
(num-test (max 123.4 1.0 1234/11) 123.4)
(num-test (max 123.4 1.0) 123.4)
(num-test (max 123.4 1/1) 123.4)
(num-test (max 123.4 123.4 1) 123.4)
(num-test (max 123.4 123.4 1.0) 123.4)
(num-test (max 123.4 123.4 1/1) 123.4)
(num-test (max 123.4 123.4 123.4) 123.4)
(num-test (max 123.4 123.4 1234) 1234.0)
(num-test (max 123.4 123.4 1234/11) 123.4)
(num-test (max 123.4 123.4) 123.4)
(num-test (max 123.4 1234 1) 1234.0)
(num-test (max 123.4 1234 1.0) 1234.0)
(num-test (max 123.4 1234 1/1) 1234.0)
(num-test (max 123.4 1234 123.4) 1234.0)
(num-test (max 123.4 1234 1234) 1234.0)
(num-test (max 123.4 1234 1234/11) 1234.0)
(num-test (max 123.4 1234) 1234.0)
(num-test (max 123.4 1234/11 1) 123.4)
(num-test (max 123.4 1234/11 1.0) 123.4)
(num-test (max 123.4 1234/11 1/1) 123.4)
(num-test (max 123.4 1234/11 123.4) 123.4)
(num-test (max 123.4 1234/11 1234) 1234.0)
(num-test (max 123.4 1234/11 1234/11) 123.4)
(num-test (max 123.4 1234/11) 123.4)
(num-test (max 1234 1 1) 1234)
(num-test (max 1234 1 1.0) 1234.0)
(num-test (max 1234 1 1/1) 1234)
(num-test (max 1234 1 123.4) 1234.0)
(num-test (max 1234 1 1234) 1234)
(num-test (max 1234 1 1234/11) 1234)
(num-test (max 1234 1) 1234)
(num-test (max 1234 1.0 1) 1234.0)
(num-test (max 1234 1.0 1.0) 1234.0)
(num-test (max 1234 1.0 1/1) 1234.0)
(num-test (max 1234 1.0 123.4) 1234.0)
(num-test (max 1234 1.0 1234) 1234.0)
(num-test (max 1234 1.0 1234/11) 1234.0)
(num-test (max 1234 1.0) 1234.0)
(num-test (max 1234 1/1) 1234)
(num-test (max 1234 123.4 1) 1234.0)
(num-test (max 1234 123.4 1.0) 1234.0)
(num-test (max 1234 123.4 1/1) 1234.0)
(num-test (max 1234 123.4 123.4) 1234.0)
(num-test (max 1234 123.4 1234) 1234.0)
(num-test (max 1234 123.4 1234/11) 1234.0)
(num-test (max 1234 123.4) 1234.0)
(num-test (max 1234 1234 1) 1234)
(num-test (max 1234 1234 1.0) 1234.0)
(num-test (max 1234 1234 1/1) 1234)
(num-test (max 1234 1234 123.4) 1234.0)
(num-test (max 1234 1234 1234) 1234)
(num-test (max 1234 1234 1234/11) 1234)
(num-test (max 1234 1234) 1234)
(num-test (max 1234 1234/11 1) 1234)
(num-test (max 1234 1234/11 1.0) 1234.0)
(num-test (max 1234 1234/11 1/1) 1234)
(num-test (max 1234 1234/11 123.4) 1234.0)
(num-test (max 1234 1234/11 1234) 1234)
(num-test (max 1234 1234/11 1234/11) 1234)
(num-test (max 1234 1234/11) 1234)
(num-test (max 1234/11 1 1) 1234/11)
(num-test (max 1234/11 1 1.0) 112.18181818181819)
(num-test (max 1234/11 1 1/1) 1234/11)
(num-test (max 1234/11 1 123.4) 123.4)
(num-test (max 1234/11 1 1234) 1234)
(num-test (max 1234/11 1 1234/11) 1234/11)
(num-test (max 1234/11 1) 1234/11)
(num-test (max 1234/11 1.0 1) 112.18181818181819)
(num-test (max 1234/11 1.0 1.0) 112.18181818181819)
(num-test (max 1234/11 1.0 1/1) 112.18181818181819)
(num-test (max 1234/11 1.0 123.4) 123.4)
(num-test (max 1234/11 1.0 1234) 1234.0)
(num-test (max 1234/11 1.0 1234/11) 112.18181818181819)
(num-test (max 1234/11 1.0) 112.18181818181819)
(num-test (max 1234/11 1/1) 1234/11)
(num-test (max 1234/11 123.4 1) 123.4)
(num-test (max 1234/11 123.4 1.0) 123.4)
(num-test (max 1234/11 123.4 1/1) 123.4)
(num-test (max 1234/11 123.4 123.4) 123.4)
(num-test (max 1234/11 123.4 1234) 1234.0)
(num-test (max 1234/11 123.4 1234/11) 123.4)
(num-test (max 1234/11 123.4) 123.4)
(num-test (max 1234/11 1234 1) 1234)
(num-test (max 1234/11 1234 1.0) 1234.0)
(num-test (max 1234/11 1234 1/1) 1234)
(num-test (max 1234/11 1234 123.4) 1234.0)
(num-test (max 1234/11 1234 1234) 1234)
(num-test (max 1234/11 1234 1234/11) 1234)
(num-test (max 1234/11 1234) 1234)
(num-test (max 1234/11 1234/11 1) 1234/11)
(num-test (max 1234/11 1234/11 1.0) 112.18181818181819)
(num-test (max 1234/11 1234/11 1/1) 1234/11)
(num-test (max 1234/11 1234/11 123.4) 123.4)
(num-test (max 1234/11 1234/11 1234) 1234)
(num-test (max 1234/11 1234/11 1234/11) 1234/11)
(num-test (max 1234/11 1234/11) 1234/11)
(num-test (max 1234000000) 1234000000)
(num-test (max 1234000000.0) 1234000000.0)
(num-test (max 1234000000/10) 1234000000/10)
(num-test (max 1e+16 9223372036854775807 1e+17) 9223372036854775807)
(num-test (max 2 1+0i) 2)
(num-test (max 2) 2)
(num-test (max 2.71828182845905) 2.71828182845905)
(num-test (max 2/2) 2/2)
(num-test (max 2/9223372036854775807 1/9223372036854775807) 2/9223372036854775807)
(num-test (max 3) 3)
(num-test (max 3.0 7 1) 7.0)
(num-test (max 3/2 -1/2) 3/2)
(num-test (max 3/2 -6/5) 3/2)
(num-test (max 3/2 1/2) 3/2)
(num-test (max 3/2 6/5) 3/2)
(num-test (max 34 5 7 38 6) 38 )
(num-test (max 362880) 362880)
(num-test (max 362880/1234) 362880/1234)
(num-test (max 5.0 2) 5.0)
(num-test (max 5.551115123125783999999999999999999999984E-17 1.110223024625156799999999999999999999997E-16) 1.110223024625156799999999999999999999997E-16)
(num-test (max 6 12) 12)
(num-test (max 92233720368547758/9223372036854775807 92233720368547757/9223372036854775807) 13176245766935394/1317624576693539401)
(num-test (max 9223372036854775805/9223372036854775807 9223372036854775806/9223372036854775807) 9223372036854775806/9223372036854775807)
(num-test (max 9223372036854775806/9223372036854775807 9223372036854775805/9223372036854775807) 9223372036854775806/9223372036854775807)
(num-test (max 9223372036854775807 -9223372036854775808) 9223372036854775807)

(num-test (max 92233720368547757/9223372036854775807 92233720368547758/9223372036854775807) 13176245766935394/1317624576693539401)
;; after reduction this is 13176245766935394/1317624576693539401 and 92233720368547757/9223372036854775807 ->
;; 9.999999999999999992410584792601468961145E-3 
;; 9.999999999999999883990367544051025548645E-3
;; but in doubles-land, they're exactly the same, so we have to hope long doubles work in the non-gmp case

(num-test (max 9223372036854776/9223372036854775807 9223372036854775/9223372036854775807) 9223372036854776/9223372036854775807)
(num-test (max 9223372036854776/9223372036854775807 9223372036854775/922337203685477500) 1/100)
(num-test (max 9223372036854775/922337203685477500 9223372036854776/9223372036854775807) 1/100)
(num-test (max 9223372036854776/9223372036854775807 9223372036854775/9223372036854774806) 9223372036854775/9223372036854774806)
(num-test (max 9223372036854775/9223372036854774806 9223372036854776/9223372036854775807) 9223372036854775/9223372036854774806)
(num-test (max 9223372036854776/9223372036854775807 9223372036854775/9223372036854775000) 9223372036854776/9223372036854775807)
;; mpfr says the first fraction is 1.000000000000000020925101928970235578612E-3
(num-test (max 1e18 most-positive-fixnum) most-positive-fixnum) ; in bignum case there's type confusion here I think (hence num-test)

(test (max) 'error)
(test (max 1.23+1.0i) 'error)
(test (max -0.0+0.00000001i) 'error)
(test (max -1.0+1.0i) 'error)
(test (max -1234000000.0+2.71828182845905i) 'error)
(test (max -2.71828182845905+3.14159265358979i) 'error)
(test (max 0.0+0.00000001i) 'error)
(test (max 1.0+1.0i) 'error)
(test (max 1234000000.0+2.71828182845905i) 'error)
(test (max 2.71828182845905+3.14159265358979i) 'error)
(test (max nan.0 1+i) 'error)
(test (max nan.0 1 1+i) 'error)
(test (max 1 nan.0 2 1+i) 'error)
(test (max inf.0 1+i) 'error)
(test (max inf.0 nan.0 0-i 1) 'error)

(test (nan? (max 3/4 1/0)) #t)
(test (nan? (max 3/4 nan.0)) #t)
(test (max 3/4 nan.0 #\a) 'error)

(for-each
 (lambda (arg)
   (test (max arg nan.0) 'error)
   (test (max nan.0 arg) 'error)
   (test (max arg inf.0) 'error)
   (test (max inf.0 arg) 'error)
   (test (max 0 arg) 'error)
   (test (max 0.0 arg) 'error)
   (test (max 1/2 arg) 'error)
   (test (max 0+i arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))

(let ((top-exp 60))  
  (let ((happy #t))
    (do ((i 2 (+ i 1)))
	((or (not happy) (> i top-exp)))
      (let* ((val1 (+ 2 (expt 2 i)))
	     (val2 (- val1 1)))
	(if (not (= val1 (max val1 val2)))
	    (begin (set! happy #f) (display "(max ") (display val1) (display " ") (display val2) (display ") -> ") (display (max val1 val2)) (display "?") (newline)))
	(if (not (= val2 (min val1 val2)))
	    (begin (set! happy #f) (display "(min ") (display val1) (display " ") (display val2) (display ") -> ") (display (min val1 val2)) (display "?") (newline))))))
  
  (let ((happy #t))
    (do ((i 2 (+ i 1)))
	((or (not happy) (> i top-exp)))
      (let* ((val1 (/ (expt 2 i) 3))
	     (val2 (/ (+ 1 (expt 2 i)) 3)))
	(if (not (= val2 (max val1 val2)))
	    (begin (set! happy #f) (display "(max ") (display val1) (display " ") (display val2) (display ") -> ") (display (max val1 val2)) (display "?") (newline)))
	(if (not (= val2 (max val2 val1)))
	    (begin (set! happy #f) (display "(max ") (display val1) (display " ") (display val2) (display ") -> ") (display (max val2 val1)) (display "?") (newline)))
	(if (not (= val1 (min val1 val2)))
	    (begin (set! happy #f) (display "(min ") (display val1) (display " ") (display val2) (display ") -> ") (display (min val1 val2)) (display "?") (newline)))
	(if (not (= val1 (min val2 val1)))
	    (begin (set! happy #f) (display "(min ") (display val1) (display " ") (display val2) (display ") -> ") (display (min val2 val1)) (display "?") (newline)))
	))))

(let ()
  (define (tmin . args) 
    (let ((val (apply min args)))
      (if (number? val)
	  (for-each 
	   (lambda (arg)
	     (if (< arg val)
		 (format *stderr* "(min ~{~^~A ~}) -> ~A~%" args val)))
	   args))
      val))
  
  (define (tmax . args) 
    (let ((val (apply max args)))
      (if (number? val)
	  (for-each 
	   (lambda (arg)
	     (if (> arg val)
		 (format *stderr* "(max ~{~^~A ~}) -> ~A~%" args val)))
	   args))
      val))
  
  (do ((i 0 (+ i 1)))
      ((= i 10))
    (tmin (- (random 10) 5) (- (random 99/100) 49/100))
    (tmax (- (random 10) 5) (- (random 99/100) 49/100))
    (tmin (- (random 99/100) 49/100) (- (random 10) 5))
    (tmax (- (random 99/100) 49/100) (- (random 10) 5))
    (tmin (- (random 10) 5) 0)
    (tmax (- (random 10) 5) 0)
    (tmin (- (random 99/100) 49/100) 0)
    (tmax (- (random 99/100) 49/100) 0)
    (tmin 0 (- (random 10) 5))
    (tmax 0 (- (random 10) 5))
    (tmin 0 (- (random 99/100) 49/100))
    (tmax 0 (- (random 99/100) 49/100)) 
    
    (tmin (- (random 10) 5) 1)
    (tmax (- (random 10) 5) 1)
    (tmin (- (random 99/100) 49/100) 1)
    (tmax (- (random 99/100) 49/100) 1)
    (tmin 1 (- (random 10) 5))
    (tmax 1 (- (random 10) 5))
    (tmin 1 (- (random 99/100) 49/100))
    (tmax 1 (- (random 99/100) 49/100))
    
    (tmin (- (random 10) 5) -1/4)
    (tmax (- (random 10) 5) -1/4)
    (tmin (- (random 99/100) 49/100) -1/4)
    (tmax (- (random 99/100) 49/100) -1/4)
    (tmin -3/4 (- (random 10) 5))
    (tmax -3/4 (- (random 10) 5))
    (tmin -3/4 (- (random 99/100) 49/100))
    (tmax -3/4 (- (random 99/100) 49/100))
    
    (tmin (- (random 299/100) 149/100) (- (random 199/100) 1))
    (tmax (- (random 299/100) 149/100) (- (random 199/100) 1))
    (tmin 0 (- (random 10) 5) (- (random 99/100) 49/100))
    (tmax 0 (- (random 10) 5) (- (random 99/100) 49/100))
    (tmin 0 (- (random 99/100) 49/100) (- (random 10) 5))
    (tmax 0 (- (random 99/100) 49/100) (- (random 10) 5))
    (tmin (- (random 10) 5) -1/2)
    (tmax (- (random 10) 5) -1/2)
    (tmin (- (random 99/100) 49/100) -1/2)
    (tmax (- (random 99/100) 49/100) -1/2)
    (tmin -1/2 (- (random 10) 5))
    (tmax -1/2 (- (random 10) 5))
    (tmin -1/2 (- (random 99/100) 49/100))
    (tmax -1/2 (- (random 99/100) 49/100))))



;;; --------------------------------------------------------------------------------
;;; <
;;; --------------------------------------------------------------------------------

(test (< 0 1 1) #f)
(test (< 0 1 1.0) #f)
(test (< 0 1 1/1) #f)
(test (< 0 1 123.4) #t)
(test (< 0 1 1234) #t)
(test (< 0 1 1234/11) #t)
(test (< 0 1) #t)
(test (< 0 1.0 1) #f)
(test (< 0 1.0 1.0) #f)
(test (< 0 1.0 1/1) #f)
(test (< 0 1.0 123.4) #t)
(test (< 0 1.0 1234) #t)
(test (< 0 1.0 1234/11) #t)
(test (< 0 1.0) #t)
(test (< 0 123.4) #t)
(test (< 0 1234) #t)
(test (< 0 1234/11) #t)
(test (< 0.0 1 1.0) #f)
(test (< 0.0 1 1/1) #f)
(test (< 0.0 1 123.4) #t)
(test (< 0.0 1 1234) #t)
(test (< 0.0 1 1234/11) #t)
(test (< 0.0 1) #t)
(test (< 0.0 1.0 1) #f)
(test (< 0.0 1.0 1.0) #f)
(test (< 0.0 1.0 1/1) #f)
(test (< 0.0 1.0 123.4) #t)
(test (< 0.0 1.0 1234) #t)
(test (< 0.0 1.0 1234/11) #t)
(test (< 0.0 1.0) #t)
(test (< 0.0 123.4 1) #f)
(test (< 0.0 123.4 1.0) #f)
(test (< 0.0 123.4 1/1) #f)
(test (< 0.0 123.4 123.4) #f)
(test (< 0.0 123.4 1234) #t)
(test (< 0.0 123.4 1234/11) #f)
(test (< 0.0 123.4) #t)
(test (< 0.0 1234 1) #f)
(test (< 0.0 1234 1.0) #f)
(test (< 0.0 1234 1/1) #f)
(test (< 0.0 1234 123.4) #f)
(test (< 0.0 1234 1234) #f)
(test (< 0.0 1234 1234/11) #f)
(test (< 0.0 1234) #t)
(test (< 0.0 1234/11 1) #f)
(test (< 0.0 1234/11 1.0) #f)
(test (< 0.0 1234/11 1/1) #f)
(test (< 0.0 1234/11 123.4) #t)
(test (< 0.0 1234/11 1234) #t)
(test (< 0.0 1234/11 1234/11) #f)
(test (< 0.0 1234/11) #t)
(test (< 1 1 1) #f)
(test (< 1 1 1.0) #f)
(test (< 1 1 1/1) #f)
(test (< 1 1 123.4) #f)
(test (< 1 1 1234) #f)
(test (< 1 1 1234/11) #f)
(test (< 1 1) #f)
(test (< 1 1.0 1) #f)
(test (< 1 1.0 1.0) #f)
(test (< 1 1.0 1/1) #f)
(test (< 1 1.0 123.4) #f)
(test (< 1 1.0 1234) #f)
(test (< 1 1.0 1234/11) #f)
(test (< 1 1.0) #f)
(test (< 1 1/1) #f)
(test (< 1 123.4) #t)
(test (< 1 1234) #t)
(test (< 1 1234/11) #t)
(test (< 1.0 1 1) #f)
(test (< 1.0 1 1.0) #f)
(test (< 1.0 1 1/1) #f)
(test (< 1.0 1 123.4) #f)
(test (< 1.0 1 1234) #f)
(test (< 1.0 1 1234/11) #f)
(test (< 1.0 1) #f)
(test (< 1.0 1.0 1) #f)
(test (< 1.0 1.0 1.0) #f)
(test (< 1.0 1.0 1/1) #f)
(test (< 1.0 1.0 123.4) #f)
(test (< 1.0 1.0 1234) #f)
(test (< 1.0 1.0 1234/11) #f)
(test (< 1.0 1.0) #f)
(test (< 1.0 123.4 1) #f)
(test (< 1.0 123.4 1.0) #f)
(test (< 1.0 123.4 1/1) #f)
(test (< 1.0 123.4 123.4) #f)
(test (< 1.0 123.4 1234) #t)
(test (< 1.0 123.4 1234/11) #f)
(test (< 1.0 123.4) #t)
(test (< 1.0 1234 1) #f)
(test (< 1.0 1234 1.0) #f)
(test (< 1.0 1234 1/1) #f)
(test (< 1.0 1234 123.4) #f)
(test (< 1.0 1234 1234) #f)
(test (< 1.0 1234 1234/11) #f)
(test (< 1.0 1234) #t)
(test (< 1.0 1234/11 1) #f)
(test (< 1.0 1234/11 1.0) #f)
(test (< 1.0 1234/11 1/1) #f)
(test (< 1.0 1234/11 123.4) #t)
(test (< 1.0 1234/11 1234) #t)
(test (< 1.0 1234/11 1234/11) #f)
(test (< 1.0 1234/11) #t)
(test (< 123.4 1 1) #f)
(test (< 123.4 1 1.0) #f)
(test (< 123.4 1 1/1) #f)
(test (< 123.4 1 123.4) #f)
(test (< 123.4 1 1234) #f)
(test (< 123.4 1 1234/11) #f)
(test (< 123.4 1) #f)
(test (< 123.4 1.0 1) #f)
(test (< 123.4 1.0 1.0) #f)
(test (< 123.4 1.0 1/1) #f)
(test (< 123.4 1.0 123.4) #f)
(test (< 123.4 1.0 1234) #f)
(test (< 123.4 1.0 1234/11) #f)
(test (< 123.4 1.0) #f)
(test (< 123.4 123.4 1) #f)
(test (< 123.4 123.4 1.0) #f)
(test (< 123.4 123.4 1/1) #f)
(test (< 123.4 123.4 123.4) #f)
(test (< 123.4 123.4 1234) #f)
(test (< 123.4 123.4 1234/11) #f)
(test (< 123.4 123.4) #f)
(test (< 123.4 1234 1) #f)
(test (< 123.4 1234 1.0) #f)
(test (< 123.4 1234 1/1) #f)
(test (< 123.4 1234 123.4) #f)
(test (< 123.4 1234 1234) #f)
(test (< 123.4 1234 1234/11) #f)
(test (< 123.4 1234) #t)
(test (< 123.4 1234/11 1) #f)
(test (< 123.4 1234/11 1.0) #f)
(test (< 123.4 1234/11 1/1) #f)
(test (< 123.4 1234/11 123.4) #f)
(test (< 123.4 1234/11 1234) #f)
(test (< 123.4 1234/11 1234/11) #f)
(test (< 123.4 1234/11) #f)
(test (< 1234 1) #f)
(test (< 1234 1.0) #f)
(test (< 1234 1/1) #f)
(test (< 1234 123.4) #f)
(test (< 1234 1234) #f)
(test (< 1234 1234/11) #f)
(test (< 1234/11 1) #f)
(test (< 1234/11 1.0) #f)
(test (< 1234/11 1/1) #f)
(test (< 1234/11 123.4) #t)
(test (< 1234/11 1234) #t)
(test (< 1234/11 1234/11) #f)

(test (< -0 0) #f)
(test (< -0.0 0.0) #f)
(test (< -1 2 3 4 4 5 6 7) #f )
(test (< -1 2 3 4 5 6 7 8) #t )
(test (< 0 -0) #f)
(test (< 0.0 -0.0) #f)
(test (< 1 0+i) 'error)
(test (< 1 0-i) 'error)
(test (< 1 1 2) #f)
(test (< 1 3 2) #f )
(test (< 1+i 0+i) 'error)
(test (< 1+i 0-i) 'error)
(test (< 2 1 #\a) 'error)
(test (< nan.0 1+i) 'error)
(test (< nan.0 1 1+i) 'error)
(test (< 1 nan.0 1+i) 'error)
(test (< inf.0 1+i) 'error)
(test (< inf.0 nan.0 0-i 1) 'error)
(test (< 2 1+0/2i) #f)
(test (< 2 1+0i) #f)
(test (< 2 1-0i) #f)

(test (< -5 -4 -2 0 4 5) #t)
(test (< 0 3 4 4 6) #f)
(test (< 0 3 4 6 7) #t)
(test (< 0) 'error)
(test (<) 'error)
(test (< 0.0) 'error)
(test (< 0.0+0.00000001i) 'error)
(test (< 0/1) 'error)
(test (< 1.0) 'error)
(test (< 1.0+1.0i) 'error)
(test (< 10/3) 'error)
(test (< 1234000000.0+2.71828182845905i) 'error)
(test (< 2 1 #\a) 'error)
(test (< 2 1 1.0+1.0i) 'error)
(test (< 2) 'error)
(test (< 2.71828182845905+3.14159265358979i) 'error)
(test (< 3 -5) #f)
(test (< 3 3) #f)
(test (< 3 3.0 3 3.0+1.0i) 'error)
(test (< 3 5) #t)
(test (< 3.0 3) #f)

(for-each
 (lambda (arg)
   (test (< arg nan.0) 'error)
   (test (< nan.0 arg) 'error)
   (test (< arg inf.0) 'error)
   (test (< inf.0 arg) 'error)
   (test (< 1 0 arg) 'error)
   (test (< 1 arg) 'error)
   (test (< 1.0 arg) 'error)
   (test (< 1/2 arg) 'error)
   (test (< arg 1) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))

(test (< 1/123400000000 .000000000001) #f)
(test (< -1/9223372036854775807 -1/9223372036854775806) #f)
(test (< -10/3147483647 -40/12345678901) #f)
(test (< -101/3147483647 40/12345678901) #t)
(test (< -1047483646/11111111111111 -1234567890213/12345678901123123) #f)
(test (< -1047483646/11111111111111 1234567890213/12345678901123123) #t)
(test (< -11/3147483647 -40/12345678901) #t)
(test (< -1282469252763/12824692526603504 -1234567890213/12345678901123123) #f)
(test (< -1282469252763/12824692526603504 1234567890213/12345678901123123) #t)
(test (< -1282469252765/12824692526603504 -1234567890213/12345678901123123) #t)
(test (< -1282469252765/12824692526603504 1234567890213/12345678901123123) #t)
(test (< -2/3 -3147483547123/4) #f)
(test (< -2/3 3147483547123/4) #t)
(test (< -2/3147483547 -3147483547/3) #f)
(test (< -2/3147483547 3147483547/3) #t)
(test (< -2147483646/11111111111111 -1234567890213/12345678901123123) #t)
(test (< -2147483646/11111111111111 1234567890213/12345678901123123) #t)
(test (< -3147483547/2 -3/3147483547) #t)
(test (< -3147483547/2 -3147483547/3) #t)
(test (< -3147483547/2 3/3147483547) #t)
(test (< -3147483547/2 3147483547/3) #t)
(test (< -3147483646/11 -12345678901/40) #f)
(test (< -3147483646/11 -1234567890213/12345678901123123) #t)
(test (< -3147483646/11 -40/12345678901) #t)
(test (< -3147483646/11 12345678901/40) #t)
(test (< -3147483646/11 1234567890213/12345678901123123) #t)
(test (< -3147483646/11 40/12345678901) #t)
(test (< -3147483646/11111111111111 -1234567890213/12345678901123123) #t)
(test (< -3147483646/11111111111111 1234567890213/12345678901123123) #t)
(test (< -3147483646/111111111111111 -1234567890213/12345678901123123) #f)
(test (< -3147483646/111111111111111 1234567890213/12345678901123123) #t)
(test (< 1/9223372036854775807 1/9223372036854775806) #t)
(test (< 10/3147483647 40/12345678901) #t)
(test (< 100000000000000.0 100000000000001.0) #t)
(test (< 100000000000000/3 100000000000001/3) #t)
(test (< 1000000000000000000/3 1000000000000000001/3) #t)
(test (< 1047483646/11111111111111 -1234567890213/12345678901123123) #f)
(test (< 1047483646/11111111111111 1234567890213/12345678901123123) #t)
(test (< 11/3147483647 40/12345678901) #f)
(test (< 1282469252763/12824692526603504 -1234567890213/12345678901123123) #f)
(test (< 1282469252763/12824692526603504 1234567890213/12345678901123123) #t)
(test (< 1282469252765/12824692526603504 -1234567890213/12345678901123123) #f)
(test (< 1282469252765/12824692526603504 1234567890213/12345678901123123) #f)
(test (< 2/3 -3147483547123/4) #f)
(test (< 2/3 3147483547123/4) #t)
(test (< 2/3147483547 -3147483547/3) #f)
(test (< 2/3147483547 3147483547/3) #t)
(test (< 2147483646/11111111111111 -1234567890213/12345678901123123) #f)
(test (< 2147483646/11111111111111 1234567890213/12345678901123123) #f)
(test (< 3/147483647 40/3) #t)
(test (< 3/3147483647 -40/12345678901) #f)
(test (< 3/3147483647 40/12345678901) #t)
(test (< 3/3147483647 40/3) #t)
(test (< 3147483547/2 -3/3147483547) #f)
(test (< 3147483547/2 -3147483547/3) #f)
(test (< 3147483547/2 3/3147483547) #f)
(test (< 3147483547/2 3147483547/3) #f)
(test (< 3147483646/11 -12345678901/40) #f)
(test (< 3147483646/11 -1234567890213/12345678901123123) #f)
(test (< 3147483646/11 -40/12345678901) #f)
(test (< 3147483646/11 12345678901/40) #t)
(test (< 3147483646/11 1234567890213/12345678901123123) #f)
(test (< 3147483646/11 40/12345678901) #f)
(test (< 3147483646/11111111111111 -1234567890213/12345678901123123) #f)
(test (< 3147483646/11111111111111 1234567890213/12345678901123123) #f)
(test (< 3147483646/111111111111111 -1234567890213/12345678901123123) #f)
(test (< 3147483646/111111111111111 1234567890213/12345678901123123) #t)
(test (< -1.797693134862315699999999999999999999998E308 -9223372036854775808) #t)
(test (< -9223372036854775808 -9223372036854775808) #f)
(test (< -9223372036854775808 5.551115123125783999999999999999999999984E-17) #t)
(test (< -9223372036854775808 9223372036854775807 -9223372036854775808) #f)
(test (< 1.110223024625156799999999999999999999997E-16 -9223372036854775808) #f)
(test (< 1.110223024625156799999999999999999999997E-16 5.551115123125783999999999999999999999984E-17 5.42101086242752217060000000000000000001E-20) #f)
(test (< 5.551115123125783999999999999999999999984E-17 1.110223024625156799999999999999999999997E-16) #t)
(test (< 9223372036854775807 -9223372036854775808) #f)
(test (< 9223372036854775807 9223372036854775807) #f)
(test (< (- 1237940039285380274899124223 1237940039285380000000000000) (- 1.2379400392853803e+27 1237940039285380000000000000) (- 1237940039285380274899124225 1237940039285380000000000000)) #f)
(test (< 0 most-negative-fixnum) #f)
(test (< 0 most-positive-fixnum) #t)
(test (< 1 3 . 2) 'error)
(test (< 1237940039285380274899124223 1.2379400392853803e+27 1237940039285380274899124225) #f)
(test (< 274899124223 3.0E11 274899124225) #f)
(test (< most-negative-fixnum (real-part (log 0.0))) #f)
(test (< most-negative-fixnum 0) #t)
(test (< most-negative-fixnum most-positive-fixnum) #t)
(test (< most-positive-fixnum (- (real-part (log 0.0)))) #t)
(test (< most-positive-fixnum 0) #f)
(test (< most-positive-fixnum most-negative-fixnum) #f)

(test (< -1 1/9223372036854775807 9223372036854775807) #t)
(test (< -9223372036854775807 -1/9223372036854775807 1) #t)
(test (< -9223372036854775807 -1/9223372036854775807) #t)
(test (< 1 9223372036 1/9223372036 1.0) #f)
(test (< 1 9223372036 1/9223372036) #f)
(test (< 1 922337203685 1/922337203685 1.0) #f)
(test (< 1 922337203685 1/922337203685) #f)
(test (< 1.0 9223372036 1/9223372036 1) #f)
(test (< 1.0 9223372036 1/9223372036) #f)
(test (< 1.0 922337203685 1/922337203685 1) #f)
(test (< 1.0 922337203685 1/922337203685) #f)
(test (< 1/9223372036 9223372036) #t)
(test (< 1/922337203685 922337203685) #t)
(test (< 1/9223372036854775807 9223372036854775807) #t)
(test (< 9223372036 1/9223372036 1) #f)
(test (< 9223372036 1/9223372036 1.0) #f)
(test (< 9223372036 1/9223372036) #f)
(test (< 922337203685 1/922337203685 1) #f)
(test (< 922337203685 1/922337203685 1.0) #f)
(test (< 922337203685 1/922337203685) #f)
(test (< 1.0 9223372036854775807/9223372036854775806) #t)
(test (< 9223372036854775806/9223372036854775807 1.0 9223372036854775807/9223372036854775806) #t)
(test (< 9223372036854775806/9223372036854775807 1.0) #t)

;;; there are cases that look innocuous that the non-gmp version can't get right:
;;;    (< 21053343141/6701487259 3587785776203/1142027682075)
;;; I'll put a few of these in the bignum section
(test (< (* 10400200/16483927 1.0) (* 10781274/17087915 1.0)) #f)
(test (< (* 10400200/16483927 1.0) 10781274/17087915) #f)
(test (< (* 10781274/17087915 1.0) (* 53715833/85137581 1.0)) #t)
(test (< (* 10781274/17087915 1.0) 53715833/85137581) #t)
(test (< (* 12/19 1.0) (* 53/84 1.0)) #f)
(test (< (* 12/19 1.0) 53/84) #f)
(test (< (* 12941/20511 1.0) (* 15601/24727 1.0)) #t)
(test (< (* 12941/20511 1.0) 15601/24727) #t)
(test (< (* 15601/24727 1.0) (* 79335/125743 1.0)) #t)
(test (< (* 15601/24727 1.0) 79335/125743) #t)

;;; (if with-bignums (test (< (* 171928773/272500658 1.0) (* 397573379/630138897 1.0)) #t))
;;; this requires more precision than 128 bits
(test (negative? (- 171928773/272500658 397573379/630138897)) #t) ; so the first is less
;; clisp, sbcl, guile, non-gmp s7 all say #f for the < comparison of reals
(test (< 171928773/272500658 397573379/630138897) #t)
;;; (= (* 171928773/272500658 1.0D0) (* 397573379/630138897 1.0D0)) -- clisp, sbcl, non-gmp s7, and guile say true

(test (< (* 171928773/272500658 1.0) 397573379/630138897) #t)
(test (< (* 190537/301994 1.0) (* 7161071/11350029 1.0)) #t)
(test (< (* 190537/301994 1.0) 7161071/11350029) #t)
(test (< (* 2/3 1.0) (* 5/8 1.0)) #f)
(test (< (* 2/3 1.0) 5/8) #f)
(test (< (* 253/401 1.0) (* 665/1054 1.0)) #t)
(test (< (* 253/401 1.0) 665/1054) #t)
(if with-bignums (test (< (* 397573379/630138897 1.0) (* 4201378396/6659027209 1.0)) #t))
;;; fraction -> double troubles -- this is ok if s7_double is long double in s7.h
(test (< (* 397573379/630138897 1.0) 4201378396/6659027209) #t)
(test (< (* 4201378396/6659027209 1.0) (* 6189245291/9809721694 1.0)) #f)
(if with-bignums (test (< (* 4201378396/6659027209 1.0) 6189245291/9809721694) #f))
(test (< (* 5/8 1.0) (* 12/19 1.0)) #t)
(test (< (* 5/8 1.0) 12/19) #t)
(test (< (* 53/84 1.0) (* 253/401 1.0)) #f)
(test (< (* 53/84 1.0) 253/401) #f)

(test (< (* 53715833/85137581 1.0) (* 171928773/272500658 1.0)) #f)
;;; (if with-bignums (test (< (* 53715833/85137581 1.0) 171928773/272500658) #f)) -- needs more than 128 bits
(test (< 53715833/85137581 171928773/272500658) #f)

(test (< (* 665/1054 1.0) (* 12941/20511 1.0)) #f)
(test (< (* 665/1054 1.0) 12941/20511) #f)
(test (< (* 7161071/11350029 1.0) (* 10400200/16483927 1.0)) #f)
(test (< (* 7161071/11350029 1.0) 10400200/16483927) #f)
(test (< (* 79335/125743 1.0) (* 190537/301994 1.0)) #t)
(test (< (* 79335/125743 1.0) 190537/301994) #t)
(test (< 10400200/16483927 10781274/17087915) #f)
(test (< 10781274/17087915 53715833/85137581) #t)
(test (< 12/19 53/84) #f)
(test (< 12941/20511 15601/24727) #t)
(test (< 15601/24727 79335/125743) #t)
(test (< 171928773/272500658 397573379/630138897) #t)
(test (< 190537/301994 7161071/11350029) #t)
(test (< 2/3 5/8) #f)
(test (< 253/401 665/1054) #t)
(test (< 397573379/630138897 4201378396/6659027209) #t)
(test (< 4201378396/6659027209 6189245291/9809721694) #f)
(test (< 5/8 12/19) #t)
(test (< 53/84 253/401) #f)
(test (< 53715833/85137581 171928773/272500658) #f)
(test (< 665/1054 12941/20511) #f)
(test (< 7161071/11350029 10400200/16483927) #f)
(test (< 79335/125743 190537/301994) #t)

(test (< 131836323/93222358 110442295/78088974 125383891/88652904 61328902/43362679 138113653/97653429 254989762/180290825 
	 393920845/278522218 100728653/71220318 175072959/123785551 278215191/196712393 )
      #t)
(test (< 10812186007/7645370045 18338419250/12967220607 13343405959/9435212837 11079453630/7834356793 6071445385/4293160203 
	 14707776949/10399968816 22357396263/15809066506 77901127500/55084415513 2284381030/1615301317 10340752226/7312016021 )
      #t)
(test (< 886731088897/627013566048 1534756075495/1085236428449 244625906708/172976637487 1462171251759/1033911207374 
	 1743861030874/1233095960377 954593412651/674999475361 )
      #t)

(test (< 10651773591371/984771132841 1.081649758092772603273242802490196379734E1 22691355773217/2095909383391
	 1.082649668092772603273242802490196379733E1 11269199657045/1040794570824 1.08274965909277260327324280249019637973E1 ) #t)
(test (< 11320859/1046629 1.081649758092772603273242802490196379734E1 10021556/926421 1.081749668092772603273242802490196379733E1 
	 12893515/1191902 1.08175965909277260327324280249019637973E1 ) #t)
(test (< 11320859/1046629 1.081649659092772603273242802490196379732E1 6398591/591558 1.081650658192772603273242802490196379729E1 
	 14562686/1346339 1.081650758102772603273242802490196379731E1 ) #t)
(test (< 11320859/1046629 1.081649658102772603273242802490196379729E1 8517115/787419 1.081649668093772603273242802490196379735E1 
	 9667298/893755 1.081649669092872603273242802490196379734E1 ) #t)
(test (< 1109328651/102558961 1.08164965809278260327324280249019637973E1 1412995811/130633408 1.081649658102773603273242802490196379729E1 
	 753823853/69692053 1.081649658103772703273242802490196379731E1 ) #t)

(when with-bignums
  (test (< 12345678901234567890 12345678901234567891) #t)
  (test (< -9223372036854775808 -9223372036854775809) #f)
  (test (< -9223372036854775809 -9223372036854775808) #t)
  (test (< 9223372036854775808 9223372036854775807) #f)
  (test (< 9223372036854775808 1e19) #t)
  (test (< 9223372036854775807 85070591730234615865843651857942052865/9223372036854775807) #t)
  (test (< 1.000e19 1267650600228229401496703205376 1e20) #f)
  
  (test (< 4272943/1360120 21053343141/6701487259 3587785776203/1142027682075 2646693125139304345/842468587426513207) #t)
  (test (< 4272943/1360120 21053343141/6701487259 3587785776203/1142027682075) #t)
  (test (< 4272943/1360120 21053343141/6701487259 3587785776203/1142027682075 355/113) #t)
  (test (< 21053343141/6701487259 3587785776203/1142027682075 355/113) #t)
  (test (< 4272943/1360120 21053343141/6701487259 3587785776203/1142027682075) #t)
  (test (< 21053343141/6701487259 3587785776203/1142027682075) #t)
  
  (test (< 886731088897/627013566048 1534756075495/1085236428449 244625906708/172976637487 1462171251759/1033911207374 
	   1743861030874/1233095960377 954593412651/674999475361 902779846866/638361751637 2968095823096/2098760683721 
	   1684058273173/1190809024873 2947786590277/2084399887474 )
	#t)
  (test (< 1023286908188737/723573111879672 1763020673688684/1246643873737343 1430528867885681/1011536663165079 
	   2711447141769903/1917282660774379 575142878279173/406687429382352 935610884438753/661576800938585 
	   2339755998541282/1654457332890441 1443730843578617/1020871869702614 478219565475493/338152297643805 2026075188260327/1432651504812687 )
	#t)
  
  (test (< 1267650600228229401496703205376) 'error)
  (test (< 1.0 1267650600228229401496703205376+i) 'error))



;;; --------------------------------------------------------------------------------
;;; <=
;;; --------------------------------------------------------------------------------

(test (<= 0 1 1) #t)
(test (<= 0 1 1.0) #t)
(test (<= 0 1 1/1) #t)
(test (<= 0 1 123.4) #t)
(test (<= 0 1 1234) #t)
(test (<= 0 1 1234/11) #t)
(test (<= 0 1) #t)
(test (<= 0 1.0 1) #t)
(test (<= 0 1.0 1.0) #t)
(test (<= 0 1.0 1/1) #t)
(test (<= 0 1.0 123.4) #t)
(test (<= 0 1.0 1234) #t)
(test (<= 0 1.0 1234/11) #t)
(test (<= 0 1.0) #t)
(test (<= 0 123.4) #t)
(test (<= 0 1234) #t)
(test (<= 0 1234/11) #t)
(test (<= 0.0 1 1.0) #t)
(test (<= 0.0 1 1/1) #t)
(test (<= 0.0 1 123.4) #t)
(test (<= 0.0 1 1234) #t)
(test (<= 0.0 1 1234/11) #t)
(test (<= 0.0 1) #t)
(test (<= 0.0 1.0 1) #t)
(test (<= 0.0 1.0 1.0) #t)
(test (<= 0.0 1.0 1/1) #t)
(test (<= 0.0 1.0 123.4) #t)
(test (<= 0.0 1.0 1234) #t)
(test (<= 0.0 1.0 1234/11) #t)
(test (<= 0.0 1.0) #t)
(test (<= 0.0 123.4 1) #f)
(test (<= 0.0 123.4 1.0) #f)
(test (<= 0.0 123.4 1/1) #f)
(test (<= 0.0 123.4 123.4) #t)
(test (<= 0.0 123.4 1234) #t)
(test (<= 0.0 123.4 1234/11) #f)
(test (<= 0.0 123.4) #t)
(test (<= 0.0 1234 1) #f)
(test (<= 0.0 1234 1.0) #f)
(test (<= 0.0 1234 1/1) #f)
(test (<= 0.0 1234 123.4) #f)
(test (<= 0.0 1234 1234) #t)
(test (<= 0.0 1234 1234/11) #f)
(test (<= 0.0 1234) #t)
(test (<= 0.0 1234/11 1) #f)
(test (<= 0.0 1234/11 1.0) #f)
(test (<= 0.0 1234/11 1/1) #f)
(test (<= 0.0 1234/11 123.4) #t)
(test (<= 0.0 1234/11 1234) #t)
(test (<= 0.0 1234/11 1234/11) #t)
(test (<= 0.0 1234/11) #t)
(test (<= 1 1 1) #t)
(test (<= 1 1 1.0) #t)
(test (<= 1 1 1/1) #t)
(test (<= 1 1 123.4) #t)
(test (<= 1 1 1234) #t)
(test (<= 1 1 1234/11) #t)
(test (<= 1 1) #t)
(test (<= 1 1.0 1) #t)
(test (<= 1 1.0 1.0) #t)
(test (<= 1 1.0 1/1) #t)
(test (<= 1 1.0 123.4) #t)
(test (<= 1 1.0 1234) #t)
(test (<= 1 1.0 1234/11) #t)
(test (<= 1 1.0) #t)
(test (<= 1 123.4) #t)
(test (<= 1 1234) #t)
(test (<= 1 1234/11) #t)
(test (<= 1.0 1 1) #t)
(test (<= 1.0 1 1.0) #t)
(test (<= 1.0 1 1/1) #t)
(test (<= 1.0 1 123.4) #t)
(test (<= 1.0 1 1234) #t)
(test (<= 1.0 1 1234/11) #t)
(test (<= 1.0 1) #t)
(test (<= 1.0 1.0 1) #t)
(test (<= 1.0 1.0 1.0) #t)
(test (<= 1.0 1.0 1/1) #t)
(test (<= 1.0 1.0 123.4) #t)
(test (<= 1.0 1.0 1234) #t)
(test (<= 1.0 1.0 1234/11) #t)
(test (<= 1.0 1.0) #t)
(test (<= 1.0 123.4 1) #f)
(test (<= 1.0 123.4 1.0) #f)
(test (<= 1.0 123.4 1/1) #f)
(test (<= 1.0 123.4 123.4) #t)
(test (<= 1.0 123.4 1234) #t)
(test (<= 1.0 123.4 1234/11) #f)
(test (<= 1.0 123.4) #t)
(test (<= 1.0 1234 1) #f)
(test (<= 1.0 1234 1.0) #f)
(test (<= 1.0 1234 1/1) #f)
(test (<= 1.0 1234 123.4) #f)
(test (<= 1.0 1234 1234) #t)
(test (<= 1.0 1234 1234/11) #f)
(test (<= 1.0 1234) #t)
(test (<= 1.0 1234/11 1) #f)
(test (<= 1.0 1234/11 1.0) #f)
(test (<= 1.0 1234/11 1/1) #f)
(test (<= 1.0 1234/11 123.4) #t)
(test (<= 1.0 1234/11 1234) #t)
(test (<= 1.0 1234/11 1234/11) #t)
(test (<= 1.0 1234/11) #t)
(test (<= 123.4 1 1) #f)
(test (<= 123.4 1 1.0) #f)
(test (<= 123.4 1 1/1) #f)
(test (<= 123.4 1 123.4) #f)
(test (<= 123.4 1 1234) #f)
(test (<= 123.4 1 1234/11) #f)
(test (<= 123.4 1) #f)
(test (<= 123.4 1.0 1) #f)
(test (<= 123.4 1.0 1.0) #f)
(test (<= 123.4 1.0 1/1) #f)
(test (<= 123.4 1.0 123.4) #f)
(test (<= 123.4 1.0 1234) #f)
(test (<= 123.4 1.0 1234/11) #f)
(test (<= 123.4 1.0) #f)
(test (<= 123.4 123.4 1) #f)
(test (<= 123.4 123.4 1.0) #f)
(test (<= 123.4 123.4 1/1) #f)
(test (<= 123.4 123.4 123.4) #t)
(test (<= 123.4 123.4 1234) #t)
(test (<= 123.4 123.4 1234/11) #f)
(test (<= 123.4 123.4) #t)
(test (<= 123.4 1234 1) #f)
(test (<= 123.4 1234 1.0) #f)
(test (<= 123.4 1234 1/1) #f)
(test (<= 123.4 1234 123.4) #f)
(test (<= 123.4 1234 1234) #t)
(test (<= 123.4 1234 1234/11) #f)
(test (<= 123.4 1234) #t)
(test (<= 123.4 1234/11 1) #f)
(test (<= 123.4 1234/11 1.0) #f)
(test (<= 123.4 1234/11 1/1) #f)
(test (<= 123.4 1234/11 123.4) #f)
(test (<= 123.4 1234/11 1234) #f)
(test (<= 123.4 1234/11 1234/11) #f)
(test (<= 123.4 1234/11) #f)
(test (<= 1234 1) #f)
(test (<= 1234 1.0) #f)
(test (<= 1234 1/1) #f)
(test (<= 1234 123.4) #f)
(test (<= 1234 1234) #t)
(test (<= 1234 1234/11) #f)
(test (<= 1234/11 1) #f)
(test (<= 1234/11 1.0) #f)
(test (<= 1234/11 1/1) #f)
(test (<= 1234/11 123.4) #t)
(test (<= 1234/11 1234) #t)
(test (<= 1234/11 1234/11) #t)

(test (<= -1 2 3 4 4 5 6 7) #t )
(test (<= -1 2 3 4 5 6 7 8) #t )
(test (<= 1 0+i) 'error)
(test (<= 1 0-i) 'error)
(test (<= 1+i 0+i) 'error)
(test (<= 1+i 0-i) 'error)
(test (<= 2 1 #\a) 'error)
(test (<= 2 1+0/2i) #f)
(test (<= 2 1+0i) #f)
(test (<= 2 1-0i) #f)
(test (<= 2 2 1) #f)

(test (<= 0 3 4 4 6) #t)
(test (<= 0 3 4 6 7) #t)
(test (<= 0) 'error)
(test (<=) 'error)
(test (<= 0.0) 'error)
(test (<= 0.0+0.00000001i) 'error)
(test (<= 0/1) 'error)
(test (<= 1 3 3 2 5) #f)
(test (<= 1.0) 'error)
(test (<= 1.0+1.0i) 'error)
(test (<= nan.0 1+i) 'error)
(test (<= nan.0 1 1+i) 'error)
(test (<= 1 nan.0 1+i) 'error)
(test (<= inf.0 1+i) 'error)
(test (<= inf.0 nan.0 0-i 1) 'error)
(test (<= 10/3) 'error)
(test (<= 1234000000.0+2.71828182845905i) 'error)
(test (<= 2 1 #\a) 'error)
(test (<= 2 1 1.0+1.0i) 'error)
(test (<= 2) 'error)
(test (<= 2.71828182845905+3.14159265358979i) 'error)
(test (<= 3 -5) #f)
(test (<= 3 3) #t)
(test (<= 3 3) #t)
(test (<= 3 5) #t)
(test (<= 3.0 3) #t)
(test (<= 5/2 2.5) #t)
(test (<= -1.797693134862315699999999999999999999998E308 -9223372036854775808) #t)
(test (<= -9223372036854775808 -9223372036854775808) #t)
(test (<= -9223372036854775808 5.551115123125783999999999999999999999984E-17) #t)
(test (<= -9223372036854775808 9223372036854775807 -9223372036854775808) #f)
(test (<= 1.110223024625156799999999999999999999997E-16 -9223372036854775808) #f)
(test (<= 1.110223024625156799999999999999999999997E-16 5.551115123125783999999999999999999999984E-17 5.42101086242752217060000000000000000001E-20) #f)
(test (<= 5.551115123125783999999999999999999999984E-17 1.110223024625156799999999999999999999997E-16) #t)
(test (<= 9223372036854775807 -9223372036854775808) #f)
(test (<= 9223372036854775807 9223372036854775807) #t)

(test (<= -1 -1/9223372036854775807 -9223372036854775807 1) #f)
(test (<= -1 -1/9223372036854775807 -9223372036854775807) #f)
(test (<= -1 1 9223372036854775807 1/9223372036854775807) #f)
(test (<= -1 9223372036854775807 1/9223372036854775807 1) #f)
(test (<= -1 9223372036854775807 1/9223372036854775807) #f)
(test (<= -1/9223372036854775807 -9223372036854775807 -1 1) #f)
(test (<= -1/9223372036854775807 -9223372036854775807 -1) #f)
(test (<= -1/9223372036854775807 -9223372036854775807 1) #f)
(test (<= -1/9223372036854775807 -9223372036854775807) #f)
(test (<= 1 1.0 9223372036 1/9223372036) #f)
(test (<= 1 1.0 922337203685 1/922337203685) #f)
(test (<= 1 9223372036 1/9223372036 1.0) #f)
(test (<= 1 9223372036 1/9223372036) #f)
(test (<= 1 922337203685 1/922337203685 1.0) #f)
(test (<= 1 922337203685 1/922337203685) #f)
(test (<= 1 9223372036854775807 1/9223372036854775807) #f)
(test (<= 1.0 1 9223372036 1/9223372036) #f)
(test (<= 1.0 1 922337203685 1/922337203685) #f)
(test (<= 1.0 9223372036 1/9223372036 1) #f)
(test (<= 1.0 9223372036 1/9223372036) #f)
(test (<= 1.0 922337203685 1/922337203685 1) #f)
(test (<= 1.0 922337203685 1/922337203685) #f)
(test (<= 1/9223372036 9223372036) #t)
(test (<= 1/922337203685 922337203685) #t)
(test (<= 9223372036 1/9223372036 1 1.0) #f)
(test (<= 9223372036 1/9223372036 1) #f)
(test (<= 9223372036 1/9223372036 1.0 1) #f)
(test (<= 9223372036 1/9223372036 1.0) #f)
(test (<= 9223372036 1/9223372036) #f)
(test (<= 922337203685 1/922337203685 1 1.0) #f)
(test (<= 922337203685 1/922337203685 1) #f)
(test (<= 922337203685 1/922337203685 1.0 1) #f)
(test (<= 922337203685 1/922337203685 1.0) #f)
(test (<= 922337203685 1/922337203685) #f)
(test (<= 9223372036854775807 1/9223372036854775807 1) #f)
(test (<= 9223372036854775807 1/9223372036854775807) #f)
(test (<= 1 1.0 9223372036854775806/9223372036854775807 9223372036854775807/9223372036854775806) #f)
(test (<= 1 1.0 9223372036854775806/9223372036854775807) #f)
(test (<= 1 9223372036854775807/9223372036854775806 1.0 9223372036854775806/9223372036854775807) #f)
(test (<= 1 9223372036854775807/9223372036854775806 1.0) #f)
(test (<= 1.0 9223372036854775806/9223372036854775807 1 9223372036854775807/9223372036854775806) #f)
(test (<= 1.0 9223372036854775806/9223372036854775807 1) #f)
(test (<= 1.0 9223372036854775806/9223372036854775807 9223372036854775807/9223372036854775806) #f)
(test (<= 1.0 9223372036854775806/9223372036854775807) #f)
(test (<= 9223372036854775806/9223372036854775807 1 9223372036854775807/9223372036854775806 1.0) #f)
(test (<= 9223372036854775806/9223372036854775807 9223372036854775807/9223372036854775806 1.0 1) #f)
(test (<= 9223372036854775806/9223372036854775807 9223372036854775807/9223372036854775806 1.0) #f)
(test (<= 9223372036854775807/9223372036854775806 1.0 1) #f)
(test (<= 9223372036854775807/9223372036854775806 1.0 9223372036854775806/9223372036854775807 1) #f)
(test (<= 9223372036854775807/9223372036854775806 1.0 9223372036854775806/9223372036854775807) #f)
(test (<= 9223372036854775807/9223372036854775806 1.0) #f)

(when with-bignums
  (test (<= 12345678901234567890 12345678901234567891) #t)
  
  (test (<= 4272943/1360120 21053343141/6701487259 2646693125139304345/842468587426513207 3587785776203/1142027682075) #f)
  (test (<= 4272943/1360120 3587785776203/1142027682075 21053343141/6701487259 2646693125139304345/842468587426513207) #f)
  (test (<= 4272943/1360120 3587785776203/1142027682075 21053343141/6701487259) #f)
  (test (<= 4272943/1360120 2646693125139304345/842468587426513207 3587785776203/1142027682075) #f)
  (test (<= 21053343141/6701487259 2646693125139304345/842468587426513207 3587785776203/1142027682075) #f)
  (test (<= 3587785776203/1142027682075 21053343141/6701487259 2646693125139304345/842468587426513207) #f)
  (test (<= 3587785776203/1142027682075 21053343141/6701487259) #f)
  (test (<= 2646693125139304345/842468587426513207 21053343141/6701487259) #f)
  (test (<= 4272943/1360120 3587785776203/1142027682075 21053343141/6701487259 355/113) #f)
  (test (<= 3587785776203/1142027682075 21053343141/6701487259 355/113) #f)
  (test (<= 4272943/1360120 3587785776203/1142027682075 21053343141/6701487259) #f)
  (test (<= 3587785776203/1142027682075 21053343141/6701487259) #f)
  
  (test (<= 1267650600228229401496703205376) 'error))

(for-each
 (lambda (arg)
   (test (<= arg nan.0) 'error)
   (test (<= nan.0 arg) 'error)
   (test (<= arg inf.0) 'error)
   (test (<= inf.0 arg) 'error)
   (test (<= 1 0 arg) 'error)
   (test (<= 1 arg) 'error)
   (test (<= 1.0 arg) 'error)
   (test (<= 1/2 arg) 'error)
   (test (<= arg 1) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))




;;; --------------------------------------------------------------------------------
;;; =
;;; --------------------------------------------------------------------------------

(test (= -1.0+1.0i -1.0+1.0i) #t)
(test (= -1.0+1.0i 0.0+1.0i) #f)
(test (= -1.0+1.0i 1) #f)
(test (= -1.0+1.0i 1.0) #f)
(test (= -1.0+1.0i 1.0+1.0i) #f)
(test (= -1.0+1.0i 1.234+1.234i) #f)
(test (= -1.0+1.0i 1/1) #f)
(test (= -1.0+1.0i 123.4) #f)
(test (= -1.0+1.0i 1234) #f)
(test (= -1.0+1.0i 1234/11) #f)
(test (= 0 -1.0+1.0i) #f)
(test (= 0 0.0+1.0i) #f)
(test (= 0 1 -1.0+1.0i) #f)
(test (= 0 1 0.0+1.0i) #f)
(test (= 0 1 1) #f)
(test (= 0 1 1.0) #f)
(test (= 0 1 1.0+1.0i) #f)
(test (= 0 1 1.234+1.234i) #f)
(test (= 0 1 1/1) #f)
(test (= 0 1 123.4) #f)
(test (= 0 1 1234) #f)
(test (= 0 1 1234/11) #f)
(test (= 0 1) #f)
(test (= 0 -0) #t)
(test (= 0 1.0 -1.0+1.0i) #f)
(test (= 0 1.0 0.0+1.0i) #f)
(test (= 0 1.0 1) #f)
(test (= 0 1.0 1.0) #f)
(test (= 0 1.0 1.0+1.0i) #f)
(test (= 0 1.0 1.234+1.234i) #f)
(test (= 0 1.0 1/1) #f)
(test (= 0 1.0 123.4) #f)
(test (= 0 1.0 1234) #f)
(test (= 0 1.0 1234/11) #f)
(test (= 0 1.0) #f)
(test (= 0 1.0+1.0i -1.0+1.0i) #f)
(test (= 0 1.0+1.0i 0.0+1.0i) #f)
(test (= 0 1.0+1.0i 1) #f)
(test (= 0 1.0+1.0i 1.0) #f)
(test (= 0 1.0+1.0i 1.0+1.0i) #f)
(test (= 0 1.0+1.0i 1.234+1.234i) #f)
(test (= 0 1.0+1.0i 1/1) #f)
(test (= 0 1.0+1.0i 123.4) #f)
(test (= 0 1.0+1.0i 1234) #f)
(test (= 0 1.0+1.0i 1234/11) #f)
(test (= 0 1.0+1.0i) #f)
(test (= 0 1.234+1.234i) #f)
(test (= 0 123.4) #f)
(test (= 0 1234) #f)
(test (= 0 1234/11) #f)
(test (= 0.0 -1.0+1.0i -1.0+1.0i) #f)
(test (= 0.0 -1.0+1.0i 0.0+1.0i) #f)
(test (= 0.0 -1.0+1.0i 1) #f)
(test (= 0.0 -1.0+1.0i 1.0) #f)
(test (= 0.0 -1.0+1.0i 1.0+1.0i) #f)
(test (= 0.0 -1.0+1.0i 1.234+1.234i) #f)
(test (= 0.0 -1.0+1.0i 1/1) #f)
(test (= 0.0 -1.0+1.0i 123.4) #f)
(test (= 0.0 -1.0+1.0i 1234) #f)
(test (= 0.0 -1.0+1.0i 1234/11) #f)
(test (= 0.0 -1.0+1.0i) #f)
(test (= 0.0 0.0+1.0i -1.0+1.0i) #f)
(test (= 0.0 0.0+1.0i 0.0+1.0i) #f)
(test (= 0.0 0.0+1.0i 1) #f)
(test (= 0.0 0.0+1.0i 1.0) #f)
(test (= 0.0 0.0+1.0i 1.0+1.0i) #f)
(test (= 0.0 0.0+1.0i 1.234+1.234i) #f)
(test (= 0.0 0.0+1.0i 1/1) #f)
(test (= 0.0 0.0+1.0i 123.4) #f)
(test (= 0.0 0.0+1.0i 1234) #f)
(test (= 0.0 0.0+1.0i 1234/11) #f)
(test (= 0.0 0.0+1.0i) #f)
(test (= 0.0 1 -1.0+1.0i) #f)
(test (= 0.0 1 0.0+1.0i) #f)
(test (= 0.0 1 1.0) #f)
(test (= 0.0 1 1.0+1.0i) #f)
(test (= 0.0 1 1.234+1.234i) #f)
(test (= 0.0 1 1/1) #f)
(test (= 0.0 1 123.4) #f)
(test (= 0.0 1 1234) #f)
(test (= 0.0 1 1234/11) #f)
(test (= 0.0 1) #f)
(test (= 0.0 1.0 -1.0+1.0i) #f)
(test (= 0.0 1.0 0.0+1.0i) #f)
(test (= 0.0 1.0 1) #f)
(test (= 0.0 1.0 1.0) #f)
(test (= 0.0 1.0 1.0+1.0i) #f)
(test (= 0.0 1.0 1.234+1.234i) #f)
(test (= 0.0 1.0 1/1) #f)
(test (= 0.0 1.0 123.4) #f)
(test (= 0.0 1.0 1234) #f)
(test (= 0.0 1.0 1234/11) #f)
(test (= 0.0 1.0) #f)
(test (= 0.0 1.0+1.0i -1.0+1.0i) #f)
(test (= 0.0 1.0+1.0i 0.0+1.0i) #f)
(test (= 0.0 1.0+1.0i 1) #f)
(test (= 0.0 1.0+1.0i 1.0) #f)
(test (= 0.0 1.0+1.0i 1.0+1.0i) #f)
(test (= 0.0 1.0+1.0i 1.234+1.234i) #f)
(test (= 0.0 1.0+1.0i 1/1) #f)
(test (= 0.0 1.0+1.0i 123.4) #f)
(test (= 0.0 1.0+1.0i 1234) #f)
(test (= 0.0 1.0+1.0i 1234/11) #f)
(test (= 0.0 1.0+1.0i) #f)
(test (= 0.0 1.234+1.234i -1.0+1.0i) #f)
(test (= 0.0 1.234+1.234i 0.0+1.0i) #f)
(test (= 0.0 1.234+1.234i 1) #f)
(test (= 0.0 1.234+1.234i 1.0) #f)
(test (= 0.0 1.234+1.234i 1.0+1.0i) #f)
(test (= 0.0 1.234+1.234i 1.234+1.234i) #f)
(test (= 0.0 1.234+1.234i 1/1) #f)
(test (= 0.0 1.234+1.234i 123.4) #f)
(test (= 0.0 1.234+1.234i 1234) #f)
(test (= 0.0 1.234+1.234i 1234/11) #f)
(test (= 0.0 1.234+1.234i) #f)
(test (= 0.0 123.4 -1.0+1.0i) #f)
(test (= 0.0 123.4 0.0+1.0i) #f)
(test (= 0.0 123.4 1) #f)
(test (= 0.0 123.4 1.0) #f)
(test (= 0.0 123.4 1.0+1.0i) #f)
(test (= 0.0 123.4 1.234+1.234i) #f)
(test (= 0.0 123.4 1/1) #f)
(test (= 0.0 123.4 123.4) #f)
(test (= 0.0 123.4 1234) #f)
(test (= 0.0 123.4 1234/11) #f)
(test (= 0.0 123.4) #f)
(test (= 0.0 1234 -1.0+1.0i) #f)
(test (= 0.0 1234 0.0+1.0i) #f)
(test (= 0.0 1234 1) #f)
(test (= 0.0 1234 1.0) #f)
(test (= 0.0 1234 1.0+1.0i) #f)
(test (= 0.0 1234 1.234+1.234i) #f)
(test (= 0.0 1234 1/1) #f)
(test (= 0.0 1234 123.4) #f)
(test (= 0.0 1234 1234) #f)
(test (= 0.0 1234 1234/11) #f)
(test (= 0.0 1234) #f)
(test (= 0.0 1234/11 -1.0+1.0i) #f)
(test (= 0.0 1234/11 0.0+1.0i) #f)
(test (= 0.0 1234/11 1) #f)
(test (= 0.0 1234/11 1.0) #f)
(test (= 0.0 1234/11 1.0+1.0i) #f)
(test (= 0.0 1234/11 1.234+1.234i) #f)
(test (= 0.0 1234/11 1/1) #f)
(test (= 0.0 1234/11 123.4) #f)
(test (= 0.0 1234/11 1234) #f)
(test (= 0.0 1234/11 1234/11) #f)
(test (= 0.0 1234/11) #f)
(test (= 0.0+1.0i -1.0+1.0i) #f)
(test (= 0.0+1.0i 0.0+1.0i) #t)
(test (= 0.0+1.0i 1) #f)
(test (= 0.0+1.0i 1.0) #f)
(test (= 0.0+1.0i 1.0+1.0i) #f)
(test (= 0.0+1.0i 1.234+1.234i) #f)
(test (= 0.0+1.0i 1/1) #f)
(test (= 0.0+1.0i 123.4) #f)
(test (= 0.0+1.0i 1234) #f)
(test (= 0.0+1.0i 1234/11) #f)
(test (= 1 -1) #f)
(test (= 1 -1.0+1.0i) #f)
(test (= 1 -2) #f)
(test (= 1 0.0+1.0i) #f)
(test (= 1 1 -1.0+1.0i) #f)
(test (= 1 1 0.0+1.0i) #f)
(test (= 1 1 1) #t)
(test (= 1 1 1.0) #t)
(test (= 1 1 1.0+1.0i) #f)
(test (= 1 1 1.234+1.234i) #f)
(test (= 1 1 1/1) #t)
(test (= 1 1 123.4) #f)
(test (= 1 1 1234) #f)
(test (= 1 1 1234/11) #f)
(test (= 1 1) #t)
(test (= 1 1.0 -1.0+1.0i) #f)
(test (= 1 1.0 0.0+1.0i) #f)
(test (= 1 1.0 1) #t)
(test (= 1 1.0 1.0) #t)
(test (= 1 1.0 1.0+1.0i) #f)
(test (= 1 1.0 1.234+1.234i) #f)
(test (= 1 1.0 1/1) #t)
(test (= 1 1.0 123.4) #f)
(test (= 1 1.0 1234) #f)
(test (= 1 1.0 1234/11) #f)
(test (= 1 1.0) #t)
(test (= 1 1.0+1.0i -1.0+1.0i) #f)
(test (= 1 1.0+1.0i 0.0+1.0i) #f)
(test (= 1 1.0+1.0i 1) #f)
(test (= 1 1.0+1.0i 1.0) #f)
(test (= 1 1.0+1.0i 1.0+1.0i) #f)
(test (= 1 1.0+1.0i 1.234+1.234i) #f)
(test (= 1 1.0+1.0i 1/1) #f)
(test (= 1 1.0+1.0i 123.4) #f)
(test (= 1 1.0+1.0i 1234) #f)
(test (= 1 1.0+1.0i 1234/11) #f)
(test (= 1 1.0+1.0i) #f)
(test (= 1 1.234+1.234i) #f)
(test (= 1 123.4) #f)
(test (= 1 1234) #f)
(test (= 1 1234/11) #f)
(test (= 1.0 -1.0) #f)
(test (= 1.0 -1.0+1.0i -1.0+1.0i) #f)
(test (= 1.0 -1.0+1.0i 0.0+1.0i) #f)
(test (= 1.0 -1.0+1.0i 1) #f)
(test (= 1.0 -1.0+1.0i 1.0) #f)
(test (= 1.0 -1.0+1.0i 1.0+1.0i) #f)
(test (= 1.0 -1.0+1.0i 1.234+1.234i) #f)
(test (= 1.0 -1.0+1.0i 1/1) #f)
(test (= 1.0 -1.0+1.0i 123.4) #f)
(test (= 1.0 -1.0+1.0i 1234) #f)
(test (= 1.0 -1.0+1.0i 1234/11) #f)
(test (= 1.0 -1.0+1.0i) #f)
(test (= 1.0 0.0+1.0i -1.0+1.0i) #f)
(test (= 1.0 0.0+1.0i 0.0+1.0i) #f)
(test (= 1.0 0.0+1.0i 1) #f)
(test (= 1.0 0.0+1.0i 1.0) #f)
(test (= 1.0 0.0+1.0i 1.0+1.0i) #f)
(test (= 1.0 0.0+1.0i 1.234+1.234i) #f)
(test (= 1.0 0.0+1.0i 1/1) #f)
(test (= 1.0 0.0+1.0i 123.4) #f)
(test (= 1.0 0.0+1.0i 1234) #f)
(test (= 1.0 0.0+1.0i 1234/11) #f)
(test (= 1.0 0.0+1.0i) #f)
(test (= 1.0 1 -1.0+1.0i) #f)
(test (= 1.0 1 0.0+1.0i) #f)
(test (= 1.0 1 1) #t)
(test (= 1.0 1 1.0) #t)
(test (= 1.0 1 1.0+1.0i) #f)
(test (= 1.0 1 1.234+1.234i) #f)
(test (= 1.0 1 1/1) #t)
(test (= 1.0 1 123.4) #f)
(test (= 1.0 1 1234) #f)
(test (= 1.0 1 1234/11) #f)
(test (= 1.0 1) #t)
(test (= 1.0 1.0 -1.0+1.0i) #f)
(test (= 1.0 1.0 0.0+1.0i) #f)
(test (= 1.0 1.0 1) #t)
(test (= 1.0 1.0 1.0) #t)
(test (= 1.0 1.0 1.0+1.0i) #f)
(test (= 1.0 1.0 1.234+1.234i) #f)
(test (= 1.0 1.0 1/1) #t)
(test (= 1.0 1.0 123.4) #f)
(test (= 1.0 1.0 1234) #f)
(test (= 1.0 1.0 1234/11) #f)
(test (= 1.0 1.0) #t)
(test (= 1.0 1.0+1.0i -1.0+1.0i) #f)
(test (= 1.0 1.0+1.0i 0.0+1.0i) #f)
(test (= 1.0 1.0+1.0i 1) #f)
(test (= 1.0 1.0+1.0i 1.0) #f)
(test (= 1.0 1.0+1.0i 1.0+1.0i) #f)
(test (= 1.0 1.0+1.0i 1.234+1.234i) #f)
(test (= 1.0 1.0+1.0i 1/1) #f)
(test (= 1.0 1.0+1.0i 123.4) #f)
(test (= 1.0 1.0+1.0i 1234) #f)
(test (= 1.0 1.0+1.0i 1234/11) #f)
(test (= 1.0 1.0+1.0i) #f)
(test (= 1.0 1.234+1.234i -1.0+1.0i) #f)
(test (= 1.0 1.234+1.234i 0.0+1.0i) #f)
(test (= 1.0 1.234+1.234i 1) #f)
(test (= 1.0 1.234+1.234i 1.0) #f)
(test (= 1.0 1.234+1.234i 1.0+1.0i) #f)
(test (= 1.0 1.234+1.234i 1.234+1.234i) #f)
(test (= 1.0 1.234+1.234i 1/1) #f)
(test (= 1.0 1.234+1.234i 123.4) #f)
(test (= 1.0 1.234+1.234i 1234) #f)
(test (= 1.0 1.234+1.234i 1234/11) #f)
(test (= 1.0 1.234+1.234i) #f)
(test (= 1.0 123.4 -1.0+1.0i) #f)
(test (= 1.0 123.4 0.0+1.0i) #f)
(test (= 1.0 123.4 1) #f)
(test (= 1.0 123.4 1.0) #f)
(test (= 1.0 123.4 1.0+1.0i) #f)
(test (= 1.0 123.4 1.234+1.234i) #f)
(test (= 1.0 123.4 1/1) #f)
(test (= 1.0 123.4 123.4) #f)
(test (= 1.0 123.4 1234) #f)
(test (= 1.0 123.4 1234/11) #f)
(test (= 1.0 123.4) #f)
(test (= 1.0 1234 -1.0+1.0i) #f)
(test (= 1.0 1234 0.0+1.0i) #f)
(test (= 1.0 1234 1) #f)
(test (= 1.0 1234 1.0) #f)
(test (= 1.0 1234 1.0+1.0i) #f)
(test (= 1.0 1234 1.234+1.234i) #f)
(test (= 1.0 1234 1/1) #f)
(test (= 1.0 1234 123.4) #f)
(test (= 1.0 1234 1234) #f)
(test (= 1.0 1234 1234/11) #f)
(test (= 1.0 1234) #f)
(test (= 1.0 1234/11 -1.0+1.0i) #f)
(test (= 1.0 1234/11 0.0+1.0i) #f)
(test (= 1.0 1234/11 1) #f)
(test (= 1.0 1234/11 1.0) #f)
(test (= 1.0 1234/11 1.0+1.0i) #f)
(test (= 1.0 1234/11 1.234+1.234i) #f)
(test (= 1.0 1234/11 1/1) #f)
(test (= 1.0 1234/11 123.4) #f)
(test (= 1.0 1234/11 1234) #f)
(test (= 1.0 1234/11 1234/11) #f)
(test (= 1.0 1234/11) #f)
(test (= 1.0+1.0i -1.0+1.0i -1.0+1.0i) #f)
(test (= 1.0+1.0i -1.0+1.0i 0.0+1.0i) #f)
(test (= 1.0+1.0i -1.0+1.0i 1) #f)
(test (= 1.0+1.0i -1.0+1.0i 1.0) #f)
(test (= 1.0+1.0i -1.0+1.0i 1.0+1.0i) #f)
(test (= 1.0+1.0i -1.0+1.0i 1.234+1.234i) #f)
(test (= 1.0+1.0i -1.0+1.0i 1/1) #f)
(test (= 1.0+1.0i -1.0+1.0i 123.4) #f)
(test (= 1.0+1.0i -1.0+1.0i 1234) #f)
(test (= 1.0+1.0i -1.0+1.0i 1234/11) #f)
(test (= 1.0+1.0i -1.0+1.0i) #f)
(test (= 1.0+1.0i 0.0+1.0i -1.0+1.0i) #f)
(test (= 1.0+1.0i 0.0+1.0i 0.0+1.0i) #f)
(test (= 1.0+1.0i 0.0+1.0i 1) #f)
(test (= 1.0+1.0i 0.0+1.0i 1.0) #f)
(test (= 1.0+1.0i 0.0+1.0i 1.0+1.0i) #f)
(test (= 1.0+1.0i 0.0+1.0i 1.234+1.234i) #f)
(test (= 1.0+1.0i 0.0+1.0i 1/1) #f)
(test (= 1.0+1.0i 0.0+1.0i 123.4) #f)
(test (= 1.0+1.0i 0.0+1.0i 1234) #f)
(test (= 1.0+1.0i 0.0+1.0i 1234/11) #f)
(test (= 1.0+1.0i 0.0+1.0i) #f)
(test (= 1.0+1.0i 1 -1.0+1.0i) #f)
(test (= 1.0+1.0i 1 0.0+1.0i) #f)
(test (= 1.0+1.0i 1 1) #f)
(test (= 1.0+1.0i 1 1.0) #f)
(test (= 1.0+1.0i 1 1.0+1.0i) #f)
(test (= 1.0+1.0i 1 1.234+1.234i) #f)
(test (= 1.0+1.0i 1 1/1) #f)
(test (= 1.0+1.0i 1 123.4) #f)
(test (= 1.0+1.0i 1 1234) #f)
(test (= 1.0+1.0i 1 1234/11) #f)
(test (= 1.0+1.0i 1) #f)
(test (= 1.0+1.0i 1.0 -1.0+1.0i) #f)
(test (= 1.0+1.0i 1.0 0.0+1.0i) #f)
(test (= 1.0+1.0i 1.0 1) #f)
(test (= 1.0+1.0i 1.0 1.0) #f)
(test (= 1.0+1.0i 1.0 1.0+1.0i) #f)
(test (= 1.0+1.0i 1.0 1.234+1.234i) #f)
(test (= 1.0+1.0i 1.0 1/1) #f)
(test (= 1.0+1.0i 1.0 123.4) #f)
(test (= 1.0+1.0i 1.0 1234) #f)
(test (= 1.0+1.0i 1.0 1234/11) #f)
(test (= 1.0+1.0i 1.0) #f)
(test (= 1.0+1.0i 1.0+1.0i -1.0+1.0i) #f)
(test (= 1.0+1.0i 1.0+1.0i 0.0+1.0i) #f)
(test (= 1.0+1.0i 1.0+1.0i 1) #f)
(test (= 1.0+1.0i 1.0+1.0i 1.0) #f)
(test (= 1.0+1.0i 1.0+1.0i 1.0+1.0i) #t)
(test (= 1.0+1.0i 1.0+1.0i 1.234+1.234i) #f)
(test (= 1.0+1.0i 1.0+1.0i 1/1) #f)
(test (= 1.0+1.0i 1.0+1.0i 123.4) #f)
(test (= 1.0+1.0i 1.0+1.0i 1234) #f)
(test (= 1.0+1.0i 1.0+1.0i 1234/11) #f)
(test (= 1.0+1.0i 1.0+1.0i) #t)
(test (= 1.0+1.0i 1.234+1.234i -1.0+1.0i) #f)
(test (= 1.0+1.0i 1.234+1.234i 0.0+1.0i) #f)
(test (= 1.0+1.0i 1.234+1.234i 1) #f)
(test (= 1.0+1.0i 1.234+1.234i 1.0) #f)
(test (= 1.0+1.0i 1.234+1.234i 1.0+1.0i) #f)
(test (= 1.0+1.0i 1.234+1.234i 1.234+1.234i) #f)
(test (= 1.0+1.0i 1.234+1.234i 1/1) #f)
(test (= 1.0+1.0i 1.234+1.234i 123.4) #f)
(test (= 1.0+1.0i 1.234+1.234i 1234) #f)
(test (= 1.0+1.0i 1.234+1.234i 1234/11) #f)
(test (= 1.0+1.0i 1.234+1.234i) #f)
(test (= 1.0+1.0i 123.4 -1.0+1.0i) #f)
(test (= 1.0+1.0i 123.4 0.0+1.0i) #f)
(test (= 1.0+1.0i 123.4 1) #f)
(test (= 1.0+1.0i 123.4 1.0) #f)
(test (= 1.0+1.0i 123.4 1.0+1.0i) #f)
(test (= 1.0+1.0i 123.4 1.234+1.234i) #f)
(test (= 1.0+1.0i 123.4 1/1) #f)
(test (= 1.0+1.0i 123.4 123.4) #f)
(test (= 1.0+1.0i 123.4 1234) #f)
(test (= 1.0+1.0i 123.4 1234/11) #f)
(test (= 1.0+1.0i 123.4) #f)
(test (= 1.0+1.0i 1234 -1.0+1.0i) #f)
(test (= 1.0+1.0i 1234 0.0+1.0i) #f)
(test (= 1.0+1.0i 1234 1) #f)
(test (= 1.0+1.0i 1234 1.0) #f)
(test (= 1.0+1.0i 1234 1.0+1.0i) #f)
(test (= 1.0+1.0i 1234 1.234+1.234i) #f)
(test (= 1.0+1.0i 1234 1/1) #f)
(test (= 1.0+1.0i 1234 123.4) #f)
(test (= 1.0+1.0i 1234 1234) #f)
(test (= 1.0+1.0i 1234 1234/11) #f)
(test (= 1.0+1.0i 1234) #f)
(test (= 1.0+1.0i 1234/11 -1.0+1.0i) #f)
(test (= 1.0+1.0i 1234/11 0.0+1.0i) #f)
(test (= 1.0+1.0i 1234/11 1) #f)
(test (= 1.0+1.0i 1234/11 1.0) #f)
(test (= 1.0+1.0i 1234/11 1.0+1.0i) #f)
(test (= 1.0+1.0i 1234/11 1.234+1.234i) #f)
(test (= 1.0+1.0i 1234/11 1/1) #f)
(test (= 1.0+1.0i 1234/11 123.4) #f)
(test (= 1.0+1.0i 1234/11 1234) #f)
(test (= 1.0+1.0i 1234/11 1234/11) #f)
(test (= 1.0+1.0i 1234/11) #f)
(test (= 1.234+1.234i -1.0+1.0i) #f)
(test (= 1.234+1.234i 0.0+1.0i) #f)
(test (= 1.234+1.234i 1) #f)
(test (= 1.234+1.234i 1.0) #f)
(test (= 1.234+1.234i 1.0+1.0i) #f)
(test (= 1.234+1.234i 1.234+1.234i) #t)
(test (= 1.234+1.234i 1/1) #f)
(test (= 1.234+1.234i 123.4) #f)
(test (= 1.234+1.234i 1234) #f)
(test (= 1.234+1.234i 1234/11) #f)
(test (= 123.4 -1.0+1.0i -1.0+1.0i) #f)
(test (= 123.4 -1.0+1.0i 0.0+1.0i) #f)
(test (= 123.4 -1.0+1.0i 1) #f)
(test (= 123.4 -1.0+1.0i 1.0) #f)
(test (= 123.4 -1.0+1.0i 1.0+1.0i) #f)
(test (= 123.4 -1.0+1.0i 1.234+1.234i) #f)
(test (= 123.4 -1.0+1.0i 1/1) #f)
(test (= 123.4 -1.0+1.0i 123.4) #f)
(test (= 123.4 -1.0+1.0i 1234) #f)
(test (= 123.4 -1.0+1.0i 1234/11) #f)
(test (= 123.4 -1.0+1.0i) #f)
(test (= 123.4 0.0+1.0i -1.0+1.0i) #f)
(test (= 123.4 0.0+1.0i 0.0+1.0i) #f)
(test (= 123.4 0.0+1.0i 1) #f)
(test (= 123.4 0.0+1.0i 1.0) #f)
(test (= 123.4 0.0+1.0i 1.0+1.0i) #f)
(test (= 123.4 0.0+1.0i 1.234+1.234i) #f)
(test (= 123.4 0.0+1.0i 1/1) #f)
(test (= 123.4 0.0+1.0i 123.4) #f)
(test (= 123.4 0.0+1.0i 1234) #f)
(test (= 123.4 0.0+1.0i 1234/11) #f)
(test (= 123.4 0.0+1.0i) #f)
(test (= 123.4 1 -1.0+1.0i) #f)
(test (= 123.4 1 0.0+1.0i) #f)
(test (= 123.4 1 1) #f)
(test (= 123.4 1 1.0) #f)
(test (= 123.4 1 1.0+1.0i) #f)
(test (= 123.4 1 1.234+1.234i) #f)
(test (= 123.4 1 1/1) #f)
(test (= 123.4 1 123.4) #f)
(test (= 123.4 1 1234) #f)
(test (= 123.4 1 1234/11) #f)
(test (= 123.4 1) #f)
(test (= 123.4 1.0 -1.0+1.0i) #f)
(test (= 123.4 1.0 0.0+1.0i) #f)
(test (= 123.4 1.0 1) #f)
(test (= 123.4 1.0 1.0) #f)
(test (= 123.4 1.0 1.0+1.0i) #f)
(test (= 123.4 1.0 1.234+1.234i) #f)
(test (= 123.4 1.0 1/1) #f)
(test (= 123.4 1.0 123.4) #f)
(test (= 123.4 1.0 1234) #f)
(test (= 123.4 1.0 1234/11) #f)
(test (= 123.4 1.0) #f)
(test (= 123.4 1.0+1.0i -1.0+1.0i) #f)
(test (= 123.4 1.0+1.0i 0.0+1.0i) #f)
(test (= 123.4 1.0+1.0i 1) #f)
(test (= 123.4 1.0+1.0i 1.0) #f)
(test (= 123.4 1.0+1.0i 1.0+1.0i) #f)
(test (= 123.4 1.0+1.0i 1.234+1.234i) #f)
(test (= 123.4 1.0+1.0i 1/1) #f)
(test (= 123.4 1.0+1.0i 123.4) #f)
(test (= 123.4 1.0+1.0i 1234) #f)
(test (= 123.4 1.0+1.0i 1234/11) #f)
(test (= 123.4 1.0+1.0i) #f)
(test (= 123.4 1.234+1.234i -1.0+1.0i) #f)
(test (= 123.4 1.234+1.234i 0.0+1.0i) #f)
(test (= 123.4 1.234+1.234i 1) #f)
(test (= 123.4 1.234+1.234i 1.0) #f)
(test (= 123.4 1.234+1.234i 1.0+1.0i) #f)
(test (= 123.4 1.234+1.234i 1.234+1.234i) #f)
(test (= 123.4 1.234+1.234i 1/1) #f)
(test (= 123.4 1.234+1.234i 123.4) #f)
(test (= 123.4 1.234+1.234i 1234) #f)
(test (= 123.4 1.234+1.234i 1234/11) #f)
(test (= 123.4 1.234+1.234i) #f)
(test (= 123.4 123.4 -1.0+1.0i) #f)
(test (= 123.4 123.4 0.0+1.0i) #f)
(test (= 123.4 123.4 1) #f)
(test (= 123.4 123.4 1.0) #f)
(test (= 123.4 123.4 1.0+1.0i) #f)
(test (= 123.4 123.4 1.234+1.234i) #f)
(test (= 123.4 123.4 1/1) #f)
(test (= 123.4 123.4 123.4) #t)
(test (= 123.4 123.4 1234) #f)
(test (= 123.4 123.4 1234/11) #f)
(test (= 123.4 123.4) #t)
(test (= 123.4 1234 -1.0+1.0i) #f)
(test (= 123.4 1234 0.0+1.0i) #f)
(test (= 123.4 1234 1) #f)
(test (= 123.4 1234 1.0) #f)
(test (= 123.4 1234 1.0+1.0i) #f)
(test (= 123.4 1234 1.234+1.234i) #f)
(test (= 123.4 1234 1/1) #f)
(test (= 123.4 1234 123.4) #f)
(test (= 123.4 1234 1234) #f)
(test (= 123.4 1234 1234/11) #f)
(test (= 123.4 1234) #f)
(test (= 123.4 1234/11 -1.0+1.0i) #f)
(test (= 123.4 1234/11 0.0+1.0i) #f)
(test (= 123.4 1234/11 1) #f)
(test (= 123.4 1234/11 1.0) #f)
(test (= 123.4 1234/11 1.0+1.0i) #f)
(test (= 123.4 1234/11 1.234+1.234i) #f)
(test (= 123.4 1234/11 1/1) #f)
(test (= 123.4 1234/11 123.4) #f)
(test (= 123.4 1234/11 1234) #f)
(test (= 123.4 1234/11 1234/11) #f)
(test (= 123.4 1234/11) #f)
(test (= 1234 -1.0+1.0i) #f)
(test (= 1234 0.0+1.0i) #f)
(test (= 1234 1) #f)
(test (= 1234 1.0) #f)
(test (= 1234 1.0+1.0i) #f)
(test (= 1234 1.234+1.234i) #f)
(test (= 1234 1/1) #f)
(test (= 1234 123.4) #f)
(test (= 1234 1234) #t)
(test (= 1234 1234/11) #f)
(test (= 1234/11 -1.0+1.0i) #f)
(test (= 1234/11 0.0+1.0i) #f)
(test (= 1234/11 1) #f)
(test (= 1234/11 1.0) #f)
(test (= 1234/11 1.0+1.0i) #f)
(test (= 1234/11 1.234+1.234i) #f)
(test (= 1234/11 1/1) #f)
(test (= 1234/11 123.4) #f)
(test (= 1234/11 1234) #f)
(test (= 1234/11 1234/11) #t)
(test (= 2 -1) #f)
(test (= 2 -2) #f)

(test (= -0 0) #t)
(test (= -0-0i 0.0) #t)
(test (= -0.0 0.0) #t)
(test (= -0.0-0.0i 0.0) #t)
(test (= .6 .6) #t)
(test (= 0.11 0.11) #t)
(test (= 0.18 0.18) #t)
(test (= 0.3 0.3) #t)
(test (= 0.333 0.333) #t)
(test (= 0.60 0.60) #t)
(test (= 0.999 0.999) #t)
(test (= 1 2 #\a) 'error)
(test (= 1+0i 1-0i) #t)
(test (= 1+i 0+i) #f)
(test (= 1+i 0-i) #f)
(test (= 1/2 1/2+0i) #t) ; gmp reads 1/2+0i as 1.0
(test (= 100.000 100.000) #t)
(test (= 1e10 1e10) #t)
(test (= 22 22 22) #t )
(test (= 22 22) #t )
(test (= 34 34 35) #f )
(test (= 34 35) #f )
(test (= 60e-2 60e-2) #t)

(test (= 0 0.0) #t)
(test (= 0 1 "hi") 'error)
(test (= 0) 'error)
(test (=) 'error)
(test (= 0.0 0.0) #t)
(test (= 0.0 1.0 "hi") 'error)
(test (= 0.0) 'error)
(test (= 0.0+0.00000001i) 'error)
(test (= 0/1) 'error)
(test (= 1.0) 'error)
(test (= 1.0+1.0i) 'error)
(test (= 1 lambda) 'error)
(test (= 10/3) 'error)
(test (= 1234000000.0+2.71828182845905i) 'error)
(test (= 2) 'error)
(test (= 2.5 5/2) #t)
(test (= 2.5+0.0i 5/2) #t)
(test (= 2.5+1.0i 5/2) #f)
(test (= 2.71828182845905+3.14159265358979i) 'error)
(test (= pi '(1)) 'error) ; for gmp
(test (= 3 2 3) #f)
(test (= 3 3 3 3) #t)
(test (= 3 3 5 3) #f)
(test (= 3 3) #t)
(test (= 3 3.0) #t)
(test (= 3 5) #f)
(test (= 3 6 5 2) #f)
(test (= 3.0 3.0+0.0i) #t)
(test (= 5/2 2.5) #t)
(test (= 5/2 2.5) #t)
(test (= 5/2 2.5+0.0i) #t)
(test (= 5/2 2.5+1.0i) #f)

(for-each
 (lambda (arg)
   (test (= arg nan.0) 'error)
   (test (= nan.0 arg) 'error)
   (test (= arg inf.0) 'error)
   (test (= inf.0 arg) 'error)
   (test (= 1 0 arg) 'error)
   (test (= 1 arg) 'error)
   (test (= 1.0 arg) 'error)
   (test (= 1/2 arg) 'error)
   (test (= 1+i arg) 'error)
   (test (= arg 1) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))

(test (= +0 -0 0/100 00 -0/9223372036854775807) #t)
(test (= +1/2 1/2) #t)
(test (= 0 0) #t)
(test (= 0.0 0.0+0.0i +0.0 -0.0 +.0 -.0 +0. -0. 0. .0 0.e1 0e1 0e+1 +0.0e+1+0.0e+1i 0-0i) #t)
(test (= 1.0 1.0+0.0i +1.0 1. 1e0 1-0i) #t)
(test (= 0.0+0.0i 0.0+0.0i) #t)
(test (= 1+1i 1+1i) #t)
(test (= 1.0+1.0i 1.0+1.0i) #t)
(test (= 1.0+1i 1.0+1.0i) #t)
(test (= 100000000000000.0 100000000000001.0) #f)
(test (= -1.797693134862315699999999999999999999998E308 -9223372036854775808) #f)
(test (= -9223372036854775808 -9223372036854775808) #t)
(test (= -9223372036854775808 5.551115123125783999999999999999999999984E-17) #f)
(test (= -9223372036854775808 9223372036854775807 -9223372036854775808) #f)
(test (= 1.110223024625156799999999999999999999997E-16 -9223372036854775808) #f)
(test (= 1.110223024625156799999999999999999999997E-16 5.551115123125783999999999999999999999984E-17 5.42101086242752217060000000000000000001E-20) #f)
(test (= 5.551115123125783999999999999999999999984E-17 1.110223024625156799999999999999999999997E-16) #f)
(test (= 9223372036854775807 -9223372036854775808) #f)
(test (= 9223372036854775807 9223372036854775807) #t)
(test (= (* most-negative-fixnum 1) (- (* -1 most-positive-fixnum) 1)) #t)
(test (= (* most-positive-fixnum -1) (+ most-negative-fixnum 1)) #t)
(test (= (+ most-negative-fixnum 1) (- most-positive-fixnum)) #t)
(test (= (+ most-negative-fixnum most-positive-fixnum) -1) #t)
(test (= (- most-negative-fixnum (- most-positive-fixnum)) -1) #t)
(test (= 0 1/0 0/0) #f)
(test (= 0/1 -0/1) #t)
(test (= 1/0 (log 0)) #f)
(test (= 1/0 -1/0) #f)
(test (= 1e100 1e+100) #t)
(test (= most-negative-fixnum (/ (log 0) (log 0))) #f)
(test (= most-negative-fixnum 0/0) #f)
(test (= most-negative-fixnum 0/0+0/0i) #f)
(test (= most-negative-fixnum 1/0) #f)
(test (= most-positive-fixnum (/ (log 0) (log 0))) #f)
(test (= most-positive-fixnum 0/0) #f)
(test (= most-positive-fixnum 0/0+0/0i) #f)
(test (= most-positive-fixnum 1/0) #f)
(test (= most-positive-fixnum most-negative-fixnum) #f)
(test (= most-positive-fixnum most-positive-fixnum) #t)

;; these are a mess -- they depend on optimizer choices, etc
(test (= 9223372036854775807/9223372036854775806 1.0 9223372036854775806/9223372036854775807) #f)
(test (= 9223372036854775806/9223372036854775807 1.0 9223372036854775807/9223372036854775806) #f)
(test (= 1 1.0 9223372036854775806/9223372036854775807) #f)
(test (= 9223372036854775806/9223372036854775807 1.0 1) #f)
(test (= 9223372036854775806/9223372036854775807 1.0) #f)
(test (= 1.0 9223372036854775806/9223372036854775807) #f)
(test (= 1 1.0 9223372036854775807/9223372036854775806) #f)
(test (= 9223372036854775807/9223372036854775806 1.0 1) #f)
(test (= 9223372036854775807/9223372036854775806 1.0) #f)
(test (= 1.0 9223372036854775807/9223372036854775806) #f)
;(test (= 1.0 9223372036854775807/9223372036854775806) (= 9223372036854775807/9223372036854775806 1.0))
;(test (= (* 397573379/630138897 1.0) 4201378396/6659027209) (= 4201378396/6659027209 (* 397573379/630138897 1.0)))

(test (= (* 10400200/16483927 1.0) (* 10781274/17087915 1.0)) #f)
(test (= (* 10400200/16483927 1.0) 10781274/17087915) #f)
(test (= (* 10781274/17087915 1.0) (* 53715833/85137581 1.0)) #f)
(test (= (* 10781274/17087915 1.0) 53715833/85137581) #f)
(test (= (* 12/19 1.0) (* 53/84 1.0)) #f)
(test (= (* 12/19 1.0) 53/84) #f)
(test (= (* 12941/20511 1.0) (* 15601/24727 1.0)) #f)
(test (= (* 12941/20511 1.0) 15601/24727) #f)
(test (= (* 15601/24727 1.0) (* 79335/125743 1.0)) #f)
(test (= (* 15601/24727 1.0) 79335/125743) #f)

;;; (if with-bignums (test (= (* 171928773/272500658 1.0) (* 397573379/630138897 1.0)) #f)) -- needs more bits
;;; (test (= (* 171928773/272500658 1.0) 397573379/630138897) #f)

(test (= (* 190537/301994 1.0) (* 7161071/11350029 1.0)) #f)
(test (= (* 190537/301994 1.0) 7161071/11350029) #f)
(test (= (* 2/3 1.0) (* 5/8 1.0)) #f)
(test (= (* 2/3 1.0) 5/8) #f)
(test (= (* 253/401 1.0) (* 665/1054 1.0)) #f)
(test (= (* 253/401 1.0) 665/1054) #f)
(if with-bignums (test (= (* 397573379/630138897 1.0) (* 4201378396/6659027209 1.0)) #f))
(test (= (* 397573379/630138897 1.0) 4201378396/6659027209) #f)
(if with-bignums (test (= (* 4201378396/6659027209 1.0) (* 6189245291/9809721694 1.0)) #f))
(test (= (* 4201378396/6659027209 1.0) 6189245291/9809721694) #f)
(test (= (* 5/8 1.0) (* 12/19 1.0)) #f)
(test (= (* 5/8 1.0) 12/19) #f)
(test (= (* 53/84 1.0) (* 253/401 1.0)) #f)
(test (= (* 53/84 1.0) 253/401) #f)

;;; (if with-bignums (test (= (* 53715833/85137581 1.0) (* 171928773/272500658 1.0)) #f)) -- more bits
;;; (if with-bignums (test (= (* 53715833/85137581 1.0) 171928773/272500658) #f))

(test (= (* 665/1054 1.0) (* 12941/20511 1.0)) #f)
(test (= (* 665/1054 1.0) 12941/20511) #f)
(test (= (* 7161071/11350029 1.0) (* 10400200/16483927 1.0)) #f)
(test (= (* 7161071/11350029 1.0) 10400200/16483927) #f)
(test (= (* 79335/125743 1.0) (* 190537/301994 1.0)) #f)
(test (= (* 79335/125743 1.0) 190537/301994) #f)
(test (= 10400200/16483927 10781274/17087915) #f)
(test (= 10781274/17087915 53715833/85137581) #f)
(test (= 12/19 53/84) #f)
(test (= 12941/20511 15601/24727) #f)
(test (= 15601/24727 79335/125743) #f)
(test (= 171928773/272500658 397573379/630138897) #f)
(test (= 190537/301994 7161071/11350029) #f)
(test (= 2/3 5/8) #f)
(test (= 253/401 665/1054) #f)
(test (= 397573379/630138897 4201378396/6659027209) #f)
(test (= 4201378396/6659027209 6189245291/9809721694) #f)
(test (= 5/8 12/19) #f)
(test (= 53/84 253/401) #f)
(test (= 53715833/85137581 171928773/272500658) #f)
(test (= 665/1054 12941/20511) #f)
(test (= 7161071/11350029 10400200/16483927) #f)
(test (= 79335/125743 190537/301994) #f)
(test (= 10.000000000 10.000000000000001) #f)

(when with-bignums
  (test (= 10.000000000 10.0000000000000001) #f)
  (test (= 8388608.9999999995 8388609) #f)
  (test (= (* 1.0 16743730547042864/1996007985) 8388609) #f)
  (test (= (* 1.0 13981015002796202/1666666667) 8388609) #f)
  
  (test (= (bignum "3") 1/0) #f)
  (test (= 12345678901234567890 12345678901234567891) #f)
  (test (= most-positive-fixnum (- (/ most-negative-fixnum -1) 1)) #t)
  (test (= 1267650600228229401496703205376) 'error))

;;; non-gmp strangeness: 
;;;    (zero? (- (sqrt 2) 5964153172084899/4217293152016490)) -> #t, but
;;;    (= (sqrt 2) 5964153172084899/4217293152016490) -> #f


(test (= 0 '(1 . 2) . 3) 'error)
(test (append 0 '(1 . 2) . 3) 'error)
(test (= 0 ''0  . 0) 'error)
(test (= . 0) 'error)
(test (= 0 . (0)) #t)




;;; --------------------------------------------------------------------------------
;;; >
;;; --------------------------------------------------------------------------------

(test (> 0 1 1) #f)
(test (> 0 1 1.0) #f)
(test (> 0 1 1/1) #f)
(test (> 0 1 123.4) #f)
(test (> 0 1 1234) #f)
(test (> 0 1 1234/11) #f)
(test (> 0 1) #f)
(test (> 0 1.0 1) #f)
(test (> 0 1.0 1.0) #f)
(test (> 0 1.0 1/1) #f)
(test (> 0 1.0 123.4) #f)
(test (> 0 1.0 1234) #f)
(test (> 0 1.0 1234/11) #f)
(test (> 0 1.0) #f)
(test (> 0 123.4) #f)
(test (> 0 1234) #f)
(test (> 0 1234/11) #f)
(test (> 0.0 1 1.0) #f)
(test (> 0.0 1 1/1) #f)
(test (> 0.0 1 123.4) #f)
(test (> 0.0 1 1234) #f)
(test (> 0.0 1 1234/11) #f)
(test (> 0.0 1) #f)
(test (> 0.0 1.0 1) #f)
(test (> 0.0 1.0 1.0) #f)
(test (> 0.0 1.0 1/1) #f)
(test (> 0.0 1.0 123.4) #f)
(test (> 0.0 1.0 1234) #f)
(test (> 0.0 1.0 1234/11) #f)
(test (> 0.0 1.0) #f)
(test (> 0.0 123.4 1) #f)
(test (> 0.0 123.4 1.0) #f)
(test (> 0.0 123.4 1/1) #f)
(test (> 0.0 123.4 123.4) #f)
(test (> 0.0 123.4 1234) #f)
(test (> 0.0 123.4 1234/11) #f)
(test (> 0.0 123.4) #f)
(test (> 0.0 1234 1) #f)
(test (> 0.0 1234 1.0) #f)
(test (> 0.0 1234 1/1) #f)
(test (> 0.0 1234 123.4) #f)
(test (> 0.0 1234 1234) #f)
(test (> 0.0 1234 1234/11) #f)
(test (> 0.0 1234) #f)
(test (> 0.0 1234/11 1) #f)
(test (> 0.0 1234/11 1.0) #f)
(test (> 0.0 1234/11 1/1) #f)
(test (> 0.0 1234/11 123.4) #f)
(test (> 0.0 1234/11 1234) #f)
(test (> 0.0 1234/11 1234/11) #f)
(test (> 0.0 1234/11) #f)
(test (> 1 1 1) #f)
(test (> 1 1 1.0) #f)
(test (> 1 1 1/1) #f)
(test (> 1 1 123.4) #f)
(test (> 1 1 1234) #f)
(test (> 1 1 1234/11) #f)
(test (> 1 1) #f)
(test (> 1 1.0 1) #f)
(test (> 1 1.0 1.0) #f)
(test (> 1 1.0 1/1) #f)
(test (> 1 1.0 123.4) #f)
(test (> 1 1.0 1234) #f)
(test (> 1 1.0 1234/11) #f)
(test (> 1 1.0) #f)
(test (> 1 123.4) #f)
(test (> 1 1234) #f)
(test (> 1 1234/11) #f)
(test (> 1.0 1 1) #f)
(test (> 1.0 1 1.0) #f)
(test (> 1.0 1 1/1) #f)
(test (> 1.0 1 123.4) #f)
(test (> 1.0 1 1234) #f)
(test (> 1.0 1 1234/11) #f)
(test (> 1.0 1) #f)
(test (> 1.0 1.0 1) #f)
(test (> 1.0 1.0 1.0) #f)
(test (> 1.0 1.0 1/1) #f)
(test (> 1.0 1.0 123.4) #f)
(test (> 1.0 1.0 1234) #f)
(test (> 1.0 1.0 1234/11) #f)
(test (> 1.0 1.0) #f)
(test (> 1.0 123.4 1) #f)
(test (> 1.0 123.4 1.0) #f)
(test (> 1.0 123.4 1/1) #f)
(test (> 1.0 123.4 123.4) #f)
(test (> 1.0 123.4 1234) #f)
(test (> 1.0 123.4 1234/11) #f)
(test (> 1.0 123.4) #f)
(test (> 1.0 1234 1) #f)
(test (> 1.0 1234 1.0) #f)
(test (> 1.0 1234 1/1) #f)
(test (> 1.0 1234 123.4) #f)
(test (> 1.0 1234 1234) #f)
(test (> 1.0 1234 1234/11) #f)
(test (> 1.0 1234) #f)
(test (> 1.0 1234/11 1) #f)
(test (> 1.0 1234/11 1.0) #f)
(test (> 1.0 1234/11 1/1) #f)
(test (> 1.0 1234/11 123.4) #f)
(test (> 1.0 1234/11 1234) #f)
(test (> 1.0 1234/11 1234/11) #f)
(test (> 1.0 1234/11) #f)
(test (> 123.4 1 1) #f)
(test (> 123.4 1 1.0) #f)
(test (> 123.4 1 1/1) #f)
(test (> 123.4 1 123.4) #f)
(test (> 123.4 1 1234) #f)
(test (> 123.4 1 1234/11) #f)
(test (> 123.4 1) #t)
(test (> 123.4 1.0 1) #f)
(test (> 123.4 1.0 1.0) #f)
(test (> 123.4 1.0 1/1) #f)
(test (> 123.4 1.0 123.4) #f)
(test (> 123.4 1.0 1234) #f)
(test (> 123.4 1.0 1234/11) #f)
(test (> 123.4 1.0) #t)
(test (> 123.4 123.4 1) #f)
(test (> 123.4 123.4 1.0) #f)
(test (> 123.4 123.4 1/1) #f)
(test (> 123.4 123.4 123.4) #f)
(test (> 123.4 123.4 1234) #f)
(test (> 123.4 123.4 1234/11) #f)
(test (> 123.4 123.4) #f)
(test (> 123.4 1234 1) #f)
(test (> 123.4 1234 1.0) #f)
(test (> 123.4 1234 1/1) #f)
(test (> 123.4 1234 123.4) #f)
(test (> 123.4 1234 1234) #f)
(test (> 123.4 1234 1234/11) #f)
(test (> 123.4 1234) #f)
(test (> 123.4 1234/11 1) #t)
(test (> 123.4 1234/11 1.0) #t)
(test (> 123.4 1234/11 1/1) #t)
(test (> 123.4 1234/11 123.4) #f)
(test (> 123.4 1234/11 1234) #f)
(test (> 123.4 1234/11 1234/11) #f)
(test (> 123.4 1234/11) #t)
(test (> 1234 1) #t)
(test (> 1234 1.0) #t)
(test (> 1234 1/1) #t)
(test (> 1234 123.4) #t)
(test (> 1234 1234) #f)
(test (> 1234 1234/11) #t)
(test (> 1234/11 1) #t)
(test (> 1234/11 1.0) #t)
(test (> 1234/11 1/1) #t)
(test (> 1234/11 123.4) #f)
(test (> 1234/11 1234) #f)
(test (> 1234/11 1234/11) #f)

(test (> 1 0+i) 'error)
(test (> 1 0-i) 'error)
(test (> 1 2 #\a) 'error)
(test (> 1+i 0+i) 'error)
(test (> 1+i 0-i) 'error)
(test (> nan.0 1+i) 'error)
(test (> nan.0 1 1+i) 'error)
(test (> 1 nan.0 1+i) 'error)
(test (> inf.0 1+i) 'error)
(test (> inf.0 nan.0 0-i 1) 'error)
(test (> 2 1+0/2i) #t)
(test (> 2 1+0i) #t)
(test (> 2 1-0i) #t)
(test (> 2 2 1) #f)
(test (> 3 -6246) #t )
(test (> 9 9 -2424) #f )
(test (> quote if) 'error)

(test (> 0) 'error)
(test (> 0.0 0.0) #f)
(test (> 0.0) 'error)
(test (>) 'error)
(test (> 0.0+0.00000001i) 'error)
(test (> 0/1) 'error)
(test (> 1 2 #\a) 'error)
(test (> 1 2 1.0+1.0i) 'error)
(test (> 1.0) 'error)
(test (> 1.0+1.0i) 'error)
(test (> 10/3) 'error)
(test (> 1234000000.0+2.71828182845905i) 'error)
(test (> 2) 'error)
(test (> 2.71828182845905+3.14159265358979i) 'error)
(test (> 3 3.0 3 3.0+1.0i) 'error)
(test (> 4 3 1 2 0) #f)
(test (> 4 3 2 1 0) #t)
(test (> 4 3 3 2 0) #f)
(test (> 4 3) #t)
(test (> 8 7 6 5 4) #t)

(test (> -10/3147483647 -40/12345678901) #t)
(test (> -101/3147483647 40/12345678901) #f)
(test (> -11/3147483647 -40/12345678901) #f)
(test (> 1/9223372036854775807 1/9223372036854775806) #f)
(test (> 10/3147483647 40/12345678901) #f)
(test (> 1047483646/11111111111111 1234567890213/12345678901123123) #f)
(test (> 11/3147483647 40/12345678901) #t)
(test (> 1282469252763/12824692526603504 1234567890213/12345678901123123) #f)
(test (> 1282469252765/12824692526603504 1234567890213/12345678901123123) #t)
(test (> 2/3 3147483547123/4) #f)
(test (> 2/3147483547 3147483547/3) #f)
(test (> 2147483646/11111111111111 1234567890213/12345678901123123) #t)
(test (> 3/147483647 40/3) #f)
(test (> 3/3147483647 -40/12345678901) #t)
(test (> 3/3147483647 40/12345678901) #f)
(test (> 3/3147483647 40/3) #f)
(test (> 3147483547/2 3/3147483547) #t)
(test (> 3147483547/2 3147483547/3) #t)
(test (> 3147483646/11 12345678901/40) #f)
(test (> 3147483646/11 1234567890213/12345678901123123) #t)
(test (> 3147483646/11 40/12345678901) #t)
(test (> 3147483646/11111111111111 1234567890213/12345678901123123) #t)
(test (> 3147483646/111111111111111 1234567890213/12345678901123123) #f)
(test (> -1.797693134862315699999999999999999999998E308 -9223372036854775808) #f)
(test (> -9223372036854775808 -9223372036854775808) #f)
(test (> -9223372036854775808 5.551115123125783999999999999999999999984E-17) #f)
(test (> -9223372036854775808 9223372036854775807 -9223372036854775808) #f)
(test (> 1.110223024625156799999999999999999999997E-16 -9223372036854775808) #t)
(test (> 1.110223024625156799999999999999999999997E-16 5.551115123125783999999999999999999999984E-17 5.42101086242752217060000000000000000001E-20) #t)
(test (> 5.551115123125783999999999999999999999984E-17 1.110223024625156799999999999999999999997E-16) #f)
(test (> 9223372036854775807 -9223372036854775808) #t)
(test (> 9223372036854775807 9223372036854775807) #f)
(test (> 0 most-negative-fixnum) #t)
(test (> 0 most-positive-fixnum) #f)
(test (> 1e18 most-positive-fixnum) #f)
(test (> 9007199254740992.0 9007199254740991.0) #t)
(test (> most-negative-fixnum (real-part (log 0.0))) #t)
(test (> most-negative-fixnum 0) #f)
(test (> most-negative-fixnum most-positive-fixnum) #f)
(test (> most-positive-fixnum (- (real-part (log 0.0)))) #f)
(test (> most-positive-fixnum 0) #t)
(test (> most-positive-fixnum most-negative-fixnum) #t)
(test (> most-positive-fixnum most-negative-fixnum) #t)
(num-test (> 1/123400000000 .000000000001) #t)
; these can go either way I guess -- 1/0 might be NaN?
;(test (< most-positive-fixnum 1/0) #t)
;(test (> most-positive-fixnum 1/0) #f)
(test (> 10.000000000 9.99999999999999) #t)

(test (> -1/9223372036854775807 -9223372036854775807) #t)
(test (> 1 -1/9223372036854775807 -9223372036854775807) #t)
(test (> 1 1/9223372036 9223372036 1.0) #f)
(test (> 1 1/9223372036 9223372036) #f)
(test (> 1 1/922337203685 922337203685 1.0) #f)
(test (> 1 1/922337203685 922337203685) #f)
(test (> 1.0 1/9223372036 9223372036 1) #f)
(test (> 1.0 1/9223372036 9223372036) #f)
(test (> 1.0 1/922337203685 922337203685 1) #f)
(test (> 1.0 1/922337203685 922337203685) #f)
(test (> 1/9223372036 9223372036 1) #f)
(test (> 1/9223372036 9223372036 1.0) #f)
(test (> 1/9223372036 9223372036) #f)
(test (> 1/922337203685 922337203685 1) #f)
(test (> 1/922337203685 922337203685 1.0) #f)
(test (> 1/922337203685 922337203685) #f)
(test (> 9223372036 1/9223372036) #t)
(test (> 922337203685 1/922337203685) #t)
(test (> 9223372036854775807 1/9223372036854775807 -1) #t)
(test (> 9223372036854775807 1/9223372036854775807) #t)
(test (> 1.0 9223372036854775806/9223372036854775807) #t)
(test (> 9223372036854775807/9223372036854775806 1.0 9223372036854775806/9223372036854775807) #t)
(test (> 9223372036854775807/9223372036854775806 1.0) #t)

(test (> (* 10400200/16483927 1.0) (* 10781274/17087915 1.0)) #t)
(test (> (* 10400200/16483927 1.0) 10781274/17087915) #t)
(test (> (* 10781274/17087915 1.0) (* 53715833/85137581 1.0)) #f)
(test (> (* 10781274/17087915 1.0) 53715833/85137581) #f)
(test (> (* 12/19 1.0) (* 53/84 1.0)) #t)
(test (> (* 12/19 1.0) 53/84) #t)
(test (> (* 12941/20511 1.0) (* 15601/24727 1.0)) #f)
(test (> (* 12941/20511 1.0) 15601/24727) #f)
(test (> (* 15601/24727 1.0) (* 79335/125743 1.0)) #f)
(test (> (* 15601/24727 1.0) 79335/125743) #f)

(test (> (* 171928773/272500658 1.0) (* 397573379/630138897 1.0)) #f)
(test (> (* 171928773/272500658 1.0) 397573379/630138897) #f)

(test (> (* 190537/301994 1.0) (* 7161071/11350029 1.0)) #f)
(test (> (* 190537/301994 1.0) 7161071/11350029) #f)
(test (> (* 2/3 1.0) (* 5/8 1.0)) #t)
(test (> (* 2/3 1.0) 5/8) #t)
(test (> (* 253/401 1.0) (* 665/1054 1.0)) #f)
(test (> (* 253/401 1.0) 665/1054) #f)
(test (> (* 397573379/630138897 1.0) (* 4201378396/6659027209 1.0)) #f)
(test (> (* 397573379/630138897 1.0) 4201378396/6659027209) #f)
(test (> (* 5/8 1.0) (* 12/19 1.0)) #f)
(test (> (* 5/8 1.0) 12/19) #f)
(test (> (* 53/84 1.0) (* 253/401 1.0)) #t)
(test (> (* 53/84 1.0) 253/401) #t)
(test (> (abs (- .1 .2)) .3) #f)
(test (> (abs (- .1 .2)) .03) #t)

;;; (if with-bignums (test (> (* 53715833/85137581 1.0) (* 171928773/272500658 1.0)) #t)) -- more bits
;;; (if with-bignums (test (> (* 53715833/85137581 1.0) 171928773/272500658) #t))
(test (> 53715833/85137581 171928773/272500658) #t)

(test (> (* 665/1054 1.0) (* 12941/20511 1.0)) #t)
(test (> (* 665/1054 1.0) 12941/20511) #t)
(test (> (* 7161071/11350029 1.0) (* 10400200/16483927 1.0)) #t)
(test (> (* 7161071/11350029 1.0) 10400200/16483927) #t)
(test (> (* 79335/125743 1.0) (* 190537/301994 1.0)) #f)
(test (> (* 79335/125743 1.0) 190537/301994) #f)
(test (> 10400200/16483927 10781274/17087915) #t)
(test (> 10781274/17087915 53715833/85137581) #f)
(test (> 12/19 53/84) #t)
(test (> 12941/20511 15601/24727) #f)
(test (> 15601/24727 79335/125743) #f)
(test (> 171928773/272500658 397573379/630138897) #f)
(test (> 190537/301994 7161071/11350029) #f)
(test (> 2/3 5/8) #t)
(test (> 253/401 665/1054) #f)
(test (> 397573379/630138897 4201378396/6659027209) #f)
(test (> 4201378396/6659027209 6189245291/9809721694) #t)
(test (> 5/8 12/19) #f)
(test (> 53/84 253/401) #t)
(test (> 53715833/85137581 171928773/272500658) #t)
(test (> 665/1054 12941/20511) #t)
(test (> 7161071/11350029 10400200/16483927) #t)
(test (> 79335/125743 190537/301994) #f)

(when with-bignums
  (test (> (* 4201378396/6659027209 1.0) (* 6189245291/9809721694 1.0)) #t)
  (test (> (* 4201378396/6659027209 1.0) 6189245291/9809721694) #t)
  (test (> 10.000000000 9.999999999999999) #t)
  (test (> 12345678901234567890 12345678901234567891) #f)
  (test (> 9007199254740993.0 9007199254740992.0) #t)
  (test (> 1267650600228229401496703205376) 'error)
  
  (test (> 355/113 3587785776203/1142027682075 21053343141/6701487259) #t)
  (test (> 3587785776203/1142027682075 21053343141/6701487259 4272943/1360120) #t)
  (test (> 22/7 2646693125139304345/842468587426513207 21053343141/6701487259) #t)
  (test (> 2646693125139304345/842468587426513207 21053343141/6701487259 4272943/1360120) #t)
  (test (> 2646693125139304345/842468587426513207 3587785776203/1142027682075 21053343141/6701487259 4272943/1360120) #t)
  (test (> 3587785776203/1142027682075 21053343141/6701487259 4272943/1360120) #t)
  (test (> 2646693125139304345/842468587426513207 21053343141/6701487259 4272943/1360120) #t)
  (test (> 2646693125139304345/842468587426513207 3587785776203/1142027682075 21053343141/6701487259) #t)
  (test (> 3587785776203/1142027682075 21053343141/6701487259) #t)
  (test (> 2646693125139304345/842468587426513207 21053343141/6701487259) #t))

(for-each
 (lambda (arg)
   (test (> arg nan.0) 'error)
   (test (> nan.0 arg) 'error)
   (test (> arg inf.0) 'error)
   (test (> inf.0 arg) 'error)
   (test (> 0 1 arg) 'error)
   (test (> 1 arg) 'error)
   (test (> 1/2 arg) 'error)
   (test (> 1.0 arg) 'error)
   (test (> 1+i arg) 'error)
   (test (> arg 1) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))



;;; --------------------------------------------------------------------------------
;;; >=
;;; --------------------------------------------------------------------------------

(test (>= 0 1 1) #f)
(test (>= 0 1 1.0) #f)
(test (>= 0 1 1/1) #f)
(test (>= 0 1 123.4) #f)
(test (>= 0 1 1234) #f)
(test (>= 0 1 1234/11) #f)
(test (>= 0 1) #f)
(test (>= 0 1.0 1) #f)
(test (>= 0 1.0 1.0) #f)
(test (>= 0 1.0 1/1) #f)
(test (>= 0 1.0 123.4) #f)
(test (>= 0 1.0 1234) #f)
(test (>= 0 1.0 1234/11) #f)
(test (>= 0 1.0) #f)
(test (>= 0 123.4) #f)
(test (>= 0 1234) #f)
(test (>= 0 1234/11) #f)
(test (>= 0.0 1 1) #f)
(test (>= 0.0 1 1.0) #f)
(test (>= 0.0 1 1/1) #f)
(test (>= 0.0 1 123.4) #f)
(test (>= 0.0 1 1234) #f)
(test (>= 0.0 1 1234/11) #f)
(test (>= 0.0 1) #f)
(test (>= 0.0 1.0 1) #f)
(test (>= 0.0 1.0 1.0) #f)
(test (>= 0.0 1.0 1/1) #f)
(test (>= 0.0 1.0 123.4) #f)
(test (>= 0.0 1.0 1234) #f)
(test (>= 0.0 1.0 1234/11) #f)
(test (>= 0.0 1.0) #f)
(test (>= 0.0 123.4 1) #f)
(test (>= 0.0 123.4 1.0) #f)
(test (>= 0.0 123.4 1/1) #f)
(test (>= 0.0 123.4 123.4) #f)
(test (>= 0.0 123.4 1234) #f)
(test (>= 0.0 123.4 1234/11) #f)
(test (>= 0.0 123.4) #f)
(test (>= 0.0 1234 1) #f)
(test (>= 0.0 1234 1.0) #f)
(test (>= 0.0 1234 1/1) #f)
(test (>= 0.0 1234 123.4) #f)
(test (>= 0.0 1234 1234) #f)
(test (>= 0.0 1234 1234/11) #f)
(test (>= 0.0 1234) #f)
(test (>= 0.0 1234/11 1) #f)
(test (>= 0.0 1234/11 1.0) #f)
(test (>= 0.0 1234/11 1/1) #f)
(test (>= 0.0 1234/11 123.4) #f)
(test (>= 0.0 1234/11 1234) #f)
(test (>= 0.0 1234/11 1234/11) #f)
(test (>= 0.0 1234/11) #f)
(test (>= 1 1 1) #t)
(test (>= 1 1 1.0) #t)
(test (>= 1 1 1/1) #t)
(test (>= 1 1 123.4) #f)
(test (>= 1 1 1234) #f)
(test (>= 1 1 1234/11) #f)
(test (>= 1 1) #t)
(test (>= 1 1.0 1) #t)
(test (>= 1 1.0 1.0) #t)
(test (>= 1 1.0 1/1) #t)
(test (>= 1 1.0 123.4) #f)
(test (>= 1 1.0 1234) #f)
(test (>= 1 1.0 1234/11) #f)
(test (>= 1 1.0) #t)
(test (>= 1 123.4) #f)
(test (>= 1 1234) #f)
(test (>= 1 1234/11) #f)
(test (>= 1.0 1 1) #t)
(test (>= 1.0 1 1.0) #t)
(test (>= 1.0 1 1/1) #t)
(test (>= 1.0 1 123.4) #f)
(test (>= 1.0 1 1234) #f)
(test (>= 1.0 1 1234/11) #f)
(test (>= 1.0 1) #t)
(test (>= 1.0 1.0 1) #t)
(test (>= 1.0 1.0 1.0) #t)
(test (>= 1.0 1.0 1/1) #t)
(test (>= 1.0 1.0 123.4) #f)
(test (>= 1.0 1.0 1234) #f)
(test (>= 1.0 1.0 1234/11) #f)
(test (>= 1.0 1.0) #t)
(test (>= 1.0 1/1 1) #t)
(test (>= 1.0 123.4 1) #f)
(test (>= 1.0 123.4 1.0) #f)
(test (>= 1.0 123.4 1/1) #f)
(test (>= 1.0 123.4 123.4) #f)
(test (>= 1.0 123.4 1234) #f)
(test (>= 1.0 123.4 1234/11) #f)
(test (>= 1.0 123.4) #f)
(test (>= 1.0 1234 1) #f)
(test (>= 1.0 1234 1.0) #f)
(test (>= 1.0 1234 1/1) #f)
(test (>= 1.0 1234 123.4) #f)
(test (>= 1.0 1234 1234) #f)
(test (>= 1.0 1234 1234/11) #f)
(test (>= 1.0 1234) #f)
(test (>= 1.0 1234/11 1) #f)
(test (>= 1.0 1234/11 1.0) #f)
(test (>= 1.0 1234/11 1/1) #f)
(test (>= 1.0 1234/11 123.4) #f)
(test (>= 1.0 1234/11 1234) #f)
(test (>= 1.0 1234/11 1234/11) #f)
(test (>= 1.0 1234/11) #f)
(test (>= 123.4 1 1) #t)
(test (>= 123.4 1 1.0) #t)
(test (>= 123.4 1 1/1) #t)
(test (>= 123.4 1 123.4) #f)
(test (>= 123.4 1 1234) #f)
(test (>= 123.4 1 1234/11) #f)
(test (>= 123.4 1) #t)
(test (>= 123.4 1.0 1) #t)
(test (>= 123.4 1.0 1.0) #t)
(test (>= 123.4 1.0 1/1) #t)
(test (>= 123.4 1.0 123.4) #f)
(test (>= 123.4 1.0 1234) #f)
(test (>= 123.4 1.0 1234/11) #f)
(test (>= 123.4 1.0) #t)
(test (>= 123.4 123.4 1) #t)
(test (>= 123.4 123.4 1.0) #t)
(test (>= 123.4 123.4 1/1) #t)
(test (>= 123.4 123.4 123.4) #t)
(test (>= 123.4 123.4 1234) #f)
(test (>= 123.4 123.4 1234/11) #t)
(test (>= 123.4 123.4) #t)
(test (>= 123.4 1234 1) #f)
(test (>= 123.4 1234 1.0) #f)
(test (>= 123.4 1234 1/1) #f)
(test (>= 123.4 1234 123.4) #f)
(test (>= 123.4 1234 1234) #f)
(test (>= 123.4 1234 1234/11) #f)
(test (>= 123.4 1234) #f)
(test (>= 123.4 1234/11 1) #t)
(test (>= 123.4 1234/11 1.0) #t)
(test (>= 123.4 1234/11 1/1) #t)
(test (>= 123.4 1234/11 123.4) #f)
(test (>= 123.4 1234/11 1234) #f)
(test (>= 123.4 1234/11 1234/11) #t)
(test (>= 123.4 1234/11) #t)
(test (>= 1234 1) #t)
(test (>= 1234 1.0) #t)
(test (>= 1234 1/1) #t)
(test (>= 1234 123.4) #t)
(test (>= 1234 1234) #t)
(test (>= 1234 1234/11) #t)
(test (>= 1234/11 1) #t)
(test (>= 1234/11 1.0) #t)
(test (>= 1234/11 1/1) #t)
(test (>= 1234/11 123.4) #f)
(test (>= 1234/11 1234) #f)
(test (>= 1234/11 1234/11) #t)

(test (>= 0+i 0+i) 'error) ;??
(test (>= 1 0+i) 'error)
(test (>= 1 0-i) 'error)
(test (>= 1 1 2) #f)
(test (>= 1 2 #\a) 'error)
(test (>= 1 3 2) #f )
(test (>= 1+i 0+i) 'error)
(test (>= 1+i 0-i) 'error)
(test (>= nan.0 1+i) 'error)
(test (>= nan.0 1 1+i) 'error)
(test (>= 1 nan.0 1+i) 'error)
(test (>= inf.0 1+i) 'error)
(test (>= inf.0 nan.0 0-i 1) 'error)
(test (>= 2 1+0/2i) #t)
(test (>= 2 1+0i) #t)
(test (>= 2 1-0i) #t)
(test (>= 3 -4 -6246) #t )
(test (>= 8 9) #f )
(test (>= 9 9) #t )

(test (>= -5 -4 -2 0 4 5) #f)
(test (>= 0) 'error)
(test (>=) 'error)
(test (>= 0.0) 'error)
(test (>= 0.0+0.00000001i) 'error)
(test (>= 0/1) 'error)
(test (>= 1 2 #\a) 'error)
(test (>= 1 2 1.0+1.0i) 'error)
(test (>= 1.0) 'error)
(test (>= 1.0+1.0i) 'error)
(test (>= 10/3) 'error)
(test (>= 1234000000.0+2.71828182845905i) 'error)
(test (>= 2) 'error)
(test (>= 2.71828182845905+3.14159265358979i) 'error)
(test (>= 4 3 1 2 0) #f)
(test (>= 4 3 2 1 0) #t)
(test (>= 4 3 3 2 0) #t)
(test (>= 4 3) #t)
(test (>= -1.797693134862315699999999999999999999998E308 -9223372036854775808) #f)
(test (>= -9223372036854775808 -9223372036854775808) #t)
(test (>= -9223372036854775808 5.551115123125783999999999999999999999984E-17) #f)
(test (>= -9223372036854775808 9223372036854775807 -9223372036854775808) #f)
(test (>= 1.110223024625156799999999999999999999997E-16 -9223372036854775808) #t)
(test (>= 1.110223024625156799999999999999999999997E-16 5.551115123125783999999999999999999999984E-17 5.42101086242752217060000000000000000001E-20) #t)
(test (>= 5.551115123125783999999999999999999999984E-17 1.110223024625156799999999999999999999997E-16) #f)
(test (>= 9223372036854775807 -9223372036854775808) #t)
(test (>= 9223372036854775807 9223372036854775807) #t)

(test (>= -1 -9223372036854775807 -1/9223372036854775807) #f)
(test (>= -9223372036854775807 -1/9223372036854775807 -1) #f)
(test (>= -9223372036854775807 -1/9223372036854775807) #f)
(test (>= 1 -1 -9223372036854775807 -1/9223372036854775807) #f)
(test (>= 1 -9223372036854775807 -1/9223372036854775807 -1) #f)
(test (>= 1 -9223372036854775807 -1/9223372036854775807) #f)
(test (>= 1 1.0 1/9223372036 9223372036) #f)
(test (>= 1 1.0 1/922337203685 922337203685) #f)
(test (>= 1 1/9223372036 9223372036 1.0) #f)
(test (>= 1 1/9223372036 9223372036) #f)
(test (>= 1 1/922337203685 922337203685 1.0) #f)
(test (>= 1 1/922337203685 922337203685) #f)
(test (>= 1 1/9223372036854775807 9223372036854775807 -1) #f)
(test (>= 1 1/9223372036854775807 9223372036854775807) #f)
(test (>= 1.0 1 1/9223372036 9223372036) #f)
(test (>= 1.0 1 1/922337203685 922337203685) #f)
(test (>= 1.0 1/9223372036 9223372036 1) #f)
(test (>= 1.0 1/9223372036 9223372036) #f)
(test (>= 1.0 1/922337203685 922337203685 1) #f)
(test (>= 1.0 1/922337203685 922337203685) #f)
(test (>= 1/9223372036 9223372036 1 1.0) #f)
(test (>= 1/9223372036 9223372036 1) #f)
(test (>= 1/9223372036 9223372036 1.0 1) #f)
(test (>= 1/9223372036 9223372036 1.0) #f)
(test (>= 1/9223372036 9223372036) #f)
(test (>= 1/922337203685 922337203685 1 1.0) #f)
(test (>= 1/922337203685 922337203685 1) #f)
(test (>= 1/922337203685 922337203685 1.0 1) #f)
(test (>= 1/922337203685 922337203685 1.0) #f)
(test (>= 1/922337203685 922337203685) #f)
(test (>= 1/9223372036854775807 9223372036854775807 -1) #f)
(test (>= 1/9223372036854775807 9223372036854775807 1 -1) #f)
(test (>= 1/9223372036854775807 9223372036854775807 1) #f)
(test (>= 1/9223372036854775807 9223372036854775807) #f)
(test (>= 9223372036 1/9223372036) #t)
(test (>= 922337203685 1/922337203685) #t)
(test (>= 1 1.0 9223372036854775807/9223372036854775806 9223372036854775806/9223372036854775807) #f)
(test (>= 1 1.0 9223372036854775807/9223372036854775806) #f)
(test (>= 1 9223372036854775806/9223372036854775807 1.0 9223372036854775807/9223372036854775806) #f)
(test (>= 1 9223372036854775806/9223372036854775807 1.0) #f)
(test (>= 1.0 9223372036854775807/9223372036854775806 1 9223372036854775806/9223372036854775807) #f)
(test (>= 1.0 9223372036854775807/9223372036854775806 1) #f)
(test (>= 1.0 9223372036854775807/9223372036854775806 9223372036854775806/9223372036854775807) #f)
(test (>= 1.0 9223372036854775807/9223372036854775806) #f)
(test (>= 9223372036854775806/9223372036854775807 1.0 1) #f)
(test (>= 9223372036854775806/9223372036854775807 1.0 9223372036854775807/9223372036854775806 1) #f)
(test (>= 9223372036854775806/9223372036854775807 1.0 9223372036854775807/9223372036854775806) #f)
(test (>= 9223372036854775806/9223372036854775807 1.0) #f)
(test (>= 9223372036854775807/9223372036854775806 1 9223372036854775806/9223372036854775807 1.0) #f)
(test (>= 9223372036854775807/9223372036854775806 9223372036854775806/9223372036854775807 1.0 1) #f)
(test (>= 9223372036854775807/9223372036854775806 9223372036854775806/9223372036854775807 1.0) #f)

(when with-bignums
  (test (>= 12345678901234567890 12345678901234567891) #f)
  (test (>= 1267650600228229401496703205376) 'error)
  
  (test (>= 21053343141/6701487259 2646693125139304345/842468587426513207 3587785776203/1142027682075 4272943/1360120) #f)
  (test (>= 21053343141/6701487259 3587785776203/1142027682075 4272943/1360120) #f)
  (test (>= 3587785776203/1142027682075 2646693125139304345/842468587426513207 4272943/1360120) #f)
  (test (>= 21053343141/6701487259 2646693125139304345/842468587426513207 3587785776203/1142027682075) #f)
  (test (>= 21053343141/6701487259 3587785776203/1142027682075 2646693125139304345/842468587426513207) #f)
  (test (>= 21053343141/6701487259 3587785776203/1142027682075) #f)
  (test (>= 21053343141/6701487259 2646693125139304345/842468587426513207) #f)
  (test (>= 3587785776203/1142027682075 2646693125139304345/842468587426513207) #f)
  (test (>= 22/7 21053343141/6701487259 2646693125139304345/842468587426513207 4272943/1360120) #f)
  (test (>= 21053343141/6701487259 2646693125139304345/842468587426513207 4272943/1360120) #f)
  (test (>= 21053343141/6701487259 2646693125139304345/842468587426513207) #f)
  (test (>= 355/113 21053343141/6701487259 3587785776203/1142027682075) #f)
  (test (>= 21053343141/6701487259 3587785776203/1142027682075 4272943/1360120) #f))

(test (>= - 1 2) 'error)
(test (>=- 1 2) 'error)

(for-each
 (lambda (arg)
   (test (>= arg nan.0) 'error)
   (test (>= nan.0 arg) 'error)
   (test (>= arg inf.0) 'error)
   (test (>= inf.0 arg) 'error)
   (test (>= 0 1 arg) 'error)
   (test (>= 1 arg) 'error)
   (test (>= 1/2 arg) 'error)
   (test (>= 1.0 arg) 'error)
   (test (>= 1+i arg) 'error)
   (test (>= arg 1) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))

(for-each
 (lambda (op)
   (for-each 
    (lambda (arg1)
      (test (op arg1) 'error)
      (test (op 0 arg1) 'error)
      (test (op 0.0 arg1) 'error)
      (for-each
       (lambda (arg2)
	 (test (op arg1 arg2) 'error))
       (list "hi" () 1 1.5 3/2 1+i (cons 1 2) (list 1 2) #\a 'a-symbol #(1) abs #f (lambda (a) (+ a 1)) #<unspecified> :hi #<eof> #<undefined>)))
    (list "hi" () (cons 1 2) (list 1 2) #\a 'a-symbol #(1) abs #f (lambda (a) (+ a 1)) #<unspecified> :hi #<eof> #<undefined>)))
 (list + - * / > < >= <= ))

(for-each
 (lambda (op)
   (let ((val1 (catch #t (lambda () (op 1.0)) (lambda args 'error)))
	 (val2 (catch #t (lambda () (op 1.0+0i)) (lambda args 'error))))
     (if (not (morally-equal? val1 val2)) ; ignore nans
	 (format #t ";(~A 1) != (~A 1+0i)? (~A ~A)~%" op op val1 val2))))
 (list magnitude angle rationalize abs exp log sin cos tan asin acos atan
       sinh cosh tanh asinh acosh atanh sqrt floor ceiling truncate round + - * /
       max min number? integer? real? complex? rational?
       even? odd? zero? positive? negative? real-part imag-part numerator denominator))




;;; --------------------------------------------------------------------------------
;;; sin
;;; --------------------------------------------------------------------------------

(num-test (sin -0.0+0.00000001i) 0.0+0.00000001i)
(num-test (sin -0.0+0.0i) 0.0)
(num-test (sin -0.0+1.0i) 0.0+1.17520119364380i)
(num-test (sin -0.0+2.71828182845905i) 0.0+7.54413710281697i)
(num-test (sin -0.0+3.14159265358979i) 0.0+11.54873935725775i)
(num-test (sin -0.0-0.00000001i) -0.0-0.00000001i)
(num-test (sin -0.0-0.0i) 0.0)
(num-test (sin -0.0-1.0i) -0.0-1.17520119364380i)
(num-test (sin -0.0-2.71828182845905i) -0.0-7.54413710281697i)
(num-test (sin -0.0-3.14159265358979i) -0.0-11.54873935725775i)
(num-test (sin -0.00000001) -0.00000001)
(num-test (sin -0.00000001+0.00000001i) -0.00000001+0.00000001i)
(num-test (sin -0.00000001+0.0i) -0.00000001)
(num-test (sin -0.00000001+1.0i) -0.00000001543081+1.17520119364380i)
(num-test (sin -0.00000001+2.71828182845905i) -0.00000007610125+7.54413710281697i)
(num-test (sin -0.00000001+3.14159265358979i) -0.00000011591953+11.54873935725775i)
(num-test (sin -0.00000001-0.00000001i) -0.00000001-0.00000001i)
(num-test (sin -0.00000001-0.0i) -0.00000001)
(num-test (sin -0.00000001-1.0i) -0.00000001543081-1.17520119364380i)
(num-test (sin -0.00000001-2.71828182845905i) -0.00000007610125-7.54413710281697i)
(num-test (sin -0.00000001-3.14159265358979i) -0.00000011591953-11.54873935725775i)
(num-test (sin -1) -0.84147098480790)
(num-test (sin -1.0) -0.84147098480790)
(num-test (sin -1.0+0.00000001i) -0.84147098480790+0.00000000540302i)
(num-test (sin -1.0+0.0i) -0.84147098480790)
(num-test (sin -1.0+1.0i) -1.29845758141598+0.63496391478474i)
(num-test (sin -1.0+2.71828182845905i) -6.40369949494148+4.07611467243740i)
(num-test (sin -1.0+3.14159265358979i) -9.75429233860021+6.23981050459650i)
(num-test (sin -1.0-0.00000001i) -0.84147098480790-0.00000000540302i)
(num-test (sin -1.0-0.0i) -0.84147098480790)
(num-test (sin -1.0-1.0i) -1.29845758141598-0.63496391478474i)
(num-test (sin -1.0-2.71828182845905i) -6.40369949494148-4.07611467243740i)
(num-test (sin -1.0-3.14159265358979i) -9.75429233860021-6.23981050459650i)
(num-test (sin -1.57045105981189525579e+00+0.0e+00i) -9.9999994039535581669e-1)
(num-test (sin -1.57045105981189525579e+00+1.0e+00i) -1.5430805428404715942e0+4.0575816248730593018e-4i)
(num-test (sin -1.57045105981189525579e+00+1.19209289550781250e-07i) -9.9999994039536292211e-1+4.1159030931177815679e-11i)
(num-test (sin -1.57045105981189525579e+00+2.0e+00i) -3.7621954668392959445e0+1.2522351259047577385e-3i)
(num-test (sin -1.57045105981189525579e+00+5.0e-01i) -1.1276258979946363572e0+1.7991700040937027667e-4i)
(num-test (sin -1.57045105981189525579e+00-1.0e+00i) -1.5430805428404715942e0-4.0575816248730593018e-4i)
(num-test (sin -1.57045105981189525579e+00-1.19209289550781250e-07i) -9.9999994039536292211e-1-4.1159030931177815679e-11i)
(num-test (sin -1.57045105981189525579e+00-2.0e+00i) -3.7621954668392959445e0-1.2522351259047577385e-3i)
(num-test (sin -1.57045105981189525579e+00-5.0e-01i) -1.1276258979946363572e0-1.7991700040937027667e-4i)
(num-test (sin -1.57114159377789786021e+00+0.0e+00i) -9.9999994039535581673e-1)
(num-test (sin -1.57114159377789786021e+00+1.0e+00i) -1.5430805428404715942e0-4.0575816248716200955e-4i)
(num-test (sin -1.57114159377789786021e+00+1.19209289550781250e-07i) -9.9999994039536292216e-1-4.1159030931163216752e-11i)
(num-test (sin -1.57114159377789786021e+00+2.0e+00i) -3.7621954668392959447e0-1.2522351259043135762e-3i)
(num-test (sin -1.57114159377789786021e+00+5.0e-01i) -1.1276258979946363573e0-1.7991700040930646090e-4i)
(num-test (sin -1.57114159377789786021e+00-1.0e+00i) -1.5430805428404715942e0+4.0575816248716200955e-4i)
(num-test (sin -1.57114159377789786021e+00-1.19209289550781250e-07i) -9.9999994039536292216e-1+4.1159030931163216752e-11i)
(num-test (sin -1.57114159377789786021e+00-2.0e+00i) -3.7621954668392959447e0+1.2522351259043135762e-3i)
(num-test (sin -1.57114159377789786021e+00-5.0e-01i) -1.1276258979946363573e0+1.7991700040930646090e-4i)
(num-test (sin -1/1) -0.84147098480790)
(num-test (sin -1/10) -0.09983341664683)
(num-test (sin -1/1234) -0.00081037268278)
(num-test (sin -1/1234000000) -0.00000000081037)
(num-test (sin -1/2) -0.47942553860420)
(num-test (sin -1/3) -0.32719469679615)
(num-test (sin -1/362880) -0.00000275573192)
(num-test (sin -1/500029) -0.00000199988401)
(num-test (sin -10/1234) -0.00810363901920)
(num-test (sin -10/1234000000) -0.00000000810373)
(num-test (sin -10/362880) -0.00002755731922)
(num-test (sin -10/500029) -0.00001999884007)
(num-test (sin -1234/1234000000) -0.00000100000000)
(num-test (sin -1234/362880) -0.00340056663826)
(num-test (sin -1234/500029) -0.00246785435930)
(num-test (sin -1234000000/1234000000) -0.84147098480790)
(num-test (sin -2) -0.90929742682568)
(num-test (sin -2.225073858507201399999999999999999999996E-308) -2.225073858507201399999999999999999999996E-308)
(num-test (sin -2/1) -0.90929742682568)
(num-test (sin -2/10) -0.19866933079506)
(num-test (sin -2/1234) -0.00162074483338)
(num-test (sin -2/1234000000) -0.00000000162075)
(num-test (sin -2/3) -0.61836980306974)
(num-test (sin -2/362880) -0.00000551146384)
(num-test (sin -2/500029) -0.00000399976801)
(num-test (sin -3.14124738660679181379e+00+0.0e+00i) -3.4526697614158608860e-4)
(num-test (sin -3.14124738660679181379e+00+1.0e+00i) -5.3277478472529828958e-4-1.1752011235963524659e0i)
(num-test (sin -3.14124738660679181379e+00+1.19209289550781250e-07i) -3.4526697614158854187e-4-1.1920928244535424532e-7i)
(num-test (sin -3.14124738660679181379e+00+2.0e+00i) -1.2989619299133501696e-3-3.6268601916692946553e0i)
(num-test (sin -3.14124738660679181379e+00+5.0e-01i) -3.8933200722554445944e-4-5.2109527443404709206e-1i)
(num-test (sin -3.14124738660679181379e+00-1.0e+00i) -5.3277478472529828958e-4+1.1752011235963524659e0i)
(num-test (sin -3.14124738660679181379e+00-1.19209289550781250e-07i) -3.4526697614158854187e-4+1.1920928244535424532e-7i)
(num-test (sin -3.14124738660679181379e+00-2.0e+00i) -1.2989619299133501696e-3+3.6268601916692946553e0i)
(num-test (sin -3.14124738660679181379e+00-5.0e-01i) -3.8933200722554445944e-4+5.2109527443404709206e-1i)
(num-test (sin -3.14193792057279441821e+00+0.0e+00i) 3.4526697614134115926e-4)
(num-test (sin -3.14193792057279441821e+00+1.0e+00i) 5.3277478472492034385e-4-1.1752011235963524660e0i)
(num-test (sin -3.14193792057279441821e+00+1.19209289550781250e-07i) 3.4526697614134361253e-4-1.1920928244535424533e-7i)
(num-test (sin -3.14193792057279441821e+00+2.0e+00i) 1.2989619299124286975e-3-3.6268601916692946556e0i)
(num-test (sin -3.14193792057279441821e+00+5.0e-01i) 3.8933200722526827075e-4-5.2109527443404709211e-1i)
(num-test (sin -3.14193792057279441821e+00-1.0e+00i) 5.3277478472492034385e-4+1.1752011235963524660e0i)
(num-test (sin -3.14193792057279441821e+00-1.19209289550781250e-07i) 3.4526697614134361253e-4+1.1920928244535424533e-7i)
(num-test (sin -3.14193792057279441821e+00-2.0e+00i) 1.2989619299124286975e-3+3.6268601916692946556e0i)
(num-test (sin -3.14193792057279441821e+00-5.0e-01i) 3.8933200722526827075e-4+5.2109527443404709211e-1i)
(num-test (sin -3.45266983001243932001e-04+0.0e+00i) -3.4526697614140534807e-4)
(num-test (sin -3.45266983001243932001e-04+1.0e+00i) -5.3277478472501939236e-4+1.1752011235963524660e0i)
(num-test (sin -3.45266983001243932001e-04+1.19209289550781250e-07i) -3.4526697614140780134e-4+1.1920928244535424533e-7i)
(num-test (sin -3.45266983001243932001e-04+2.0e+00i) -1.2989619299126701883e-3+3.6268601916692946556e0i)
(num-test (sin -3.45266983001243932001e-04+5.0e-01i) -3.8933200722534065172e-4+5.2109527443404709209e-1i)
(num-test (sin -3.45266983001243932001e-04-1.0e+00i) -5.3277478472501939236e-4-1.1752011235963524660e0i)
(num-test (sin -3.45266983001243932001e-04-1.19209289550781250e-07i) -3.4526697614140780134e-4-1.1920928244535424533e-7i)
(num-test (sin -3.45266983001243932001e-04-2.0e+00i) -1.2989619299126701883e-3-3.6268601916692946556e0i)
(num-test (sin -3.45266983001243932001e-04-5.0e-01i) -3.8933200722534065172e-4-5.2109527443404709209e-1i)
(num-test (sin -3/10) -0.29552020666134)
(num-test (sin -3/1234) -0.00243111591964)
(num-test (sin -3/1234000000) -0.00000000243112)
(num-test (sin -3/2) -0.99749498660405)
(num-test (sin -3/362880) -0.00000826719577)
(num-test (sin -3/500029) -0.00000599965202)
(num-test (sin -362880/1234000000) -0.00029406806707)
(num-test (sin -4.71204371340168837179e+00+0.0e+00i) 9.9999994039535581664e-1)
(num-test (sin -4.71204371340168837179e+00+1.0e+00i) 1.5430805428404715941e0-4.0575816248744985081e-4i)
(num-test (sin -4.71204371340168837179e+00+1.19209289550781250e-07i) 9.9999994039536292207e-1-4.1159030931192414605e-11i)
(num-test (sin -4.71204371340168837179e+00+2.0e+00i) 3.7621954668392959444e0-1.2522351259052019007e-3i)
(num-test (sin -4.71204371340168837179e+00+5.0e-01i) 1.1276258979946363572e0-1.7991700040943409243e-4i)
(num-test (sin -4.71204371340168837179e+00-1.0e+00i) 1.5430805428404715941e0+4.0575816248744985081e-4i)
(num-test (sin -4.71204371340168837179e+00-1.19209289550781250e-07i) 9.9999994039536292207e-1+4.1159030931192414605e-11i)
(num-test (sin -4.71204371340168837179e+00-2.0e+00i) 3.7621954668392959444e0+1.2522351259052019007e-3i)
(num-test (sin -4.71204371340168837179e+00-5.0e-01i) 1.1276258979946363572e0+1.7991700040943409243e-4i)
(num-test (sin -4.71273424736769097620e+00+0.0e+00i) 9.9999994039535581677e-1)
(num-test (sin -4.71273424736769097620e+00+1.0e+00i) 1.5430805428404715943e0+4.0575816248701808892e-4i)
(num-test (sin -4.71273424736769097620e+00+1.19209289550781250e-07i) 9.9999994039536292220e-1+4.1159030931148617825e-11i)
(num-test (sin -4.71273424736769097620e+00+2.0e+00i) 3.7621954668392959448e0+1.2522351259038694139e-3i)
(num-test (sin -4.71273424736769097620e+00+5.0e-01i) 1.1276258979946363573e0+1.7991700040924264514e-4i)
(num-test (sin -4.71273424736769097620e+00-1.0e+00i) 1.5430805428404715943e0-4.0575816248701808892e-4i)
(num-test (sin -4.71273424736769097620e+00-1.19209289550781250e-07i) 9.9999994039536292220e-1-4.1159030931148617825e-11i)
(num-test (sin -4.71273424736769097620e+00-2.0e+00i) 3.7621954668392959448e0-1.2522351259038694139e-3i)
(num-test (sin -4.71273424736769097620e+00-5.0e-01i) 1.1276258979946363573e0-1.7991700040924264514e-4i)
(num-test (sin -500029/1234000000) -0.00040520987546)
(num-test (sin -500029/362880) -0.98146191370834)
(num-test (sin -6.28284004019658492979e+00+0.0e+00i) 3.4526697614170855328e-4)
(num-test (sin -6.28284004019658492979e+00+1.0e+00i) 5.3277478472548726245e-4+1.1752011235963524659e0i)
(num-test (sin -6.28284004019658492979e+00+1.19209289550781250e-07i) 3.4526697614171100655e-4+1.1920928244535424532e-7i)
(num-test (sin -6.28284004019658492979e+00+2.0e+00i) 1.2989619299138109057e-3+3.6268601916692946552e0i)
(num-test (sin -6.28284004019658492979e+00+5.0e-01i) 3.8933200722568255379e-4+5.2109527443404709204e-1i)
(num-test (sin -6.28284004019658492979e+00-1.0e+00i) 5.3277478472548726245e-4-1.1752011235963524659e0i)
(num-test (sin -6.28284004019658492979e+00-1.19209289550781250e-07i) 3.4526697614171100655e-4-1.1920928244535424532e-7i)
(num-test (sin -6.28284004019658492979e+00-2.0e+00i) 1.2989619299138109057e-3-3.6268601916692946552e0i)
(num-test (sin -6.28284004019658492979e+00-5.0e-01i) 3.8933200722568255379e-4-5.2109527443404709204e-1i)
(num-test (sin -6.28353057416258753420e+00+0.0e+00i) -3.4526697614121869459e-4)
(num-test (sin -6.28353057416258753420e+00+1.0e+00i) -5.3277478472473137099e-4+1.1752011235963524661e0i)
(num-test (sin -6.28353057416258753420e+00+1.19209289550781250e-07i) -3.4526697614122114786e-4+1.1920928244535424534e-7i)
(num-test (sin -6.28353057416258753420e+00+2.0e+00i) -1.2989619299119679614e-3+3.6268601916692946558e0i)
(num-test (sin -6.28353057416258753420e+00+5.0e-01i) -3.8933200722513017641e-4+5.2109527443404709213e-1i)
(num-test (sin -6.28353057416258753420e+00-1.0e+00i) -5.3277478472473137099e-4-1.1752011235963524661e0i)
(num-test (sin -6.28353057416258753420e+00-1.19209289550781250e-07i) -3.4526697614122114786e-4-1.1920928244535424534e-7i)
(num-test (sin -6.28353057416258753420e+00-2.0e+00i) -1.2989619299119679614e-3-3.6268601916692946558e0i)
(num-test (sin -6.28353057416258753420e+00-5.0e-01i) -3.8933200722513017641e-4-5.2109527443404709213e-1i)
(num-test (sin -9.42443269378637893396e+00+0.0e+00i) -3.4526697614094283958e-4)
(num-test (sin -9.42443269378637893396e+00+1.0e+00i) -5.3277478472430570447e-4-1.1752011235963524662e0i)
(num-test (sin -9.42443269378637893396e+00+1.19209289550781250e-07i) -3.4526697614094529285e-4-1.1920928244535424535e-7i)
(num-test (sin -9.42443269378637893396e+00+2.0e+00i) -1.2989619299109301409e-3-3.6268601916692946561e0i)
(num-test (sin -9.42443269378637893396e+00+5.0e-01i) -3.8933200722481911514e-4-5.2109527443404709218e-1i)
(num-test (sin -9.42443269378637893396e+00-1.0e+00i) -5.3277478472430570447e-4+1.1752011235963524662e0i)
(num-test (sin -9.42443269378637893396e+00-1.19209289550781250e-07i) -3.4526697614094529285e-4+1.1920928244535424535e-7i)
(num-test (sin -9.42443269378637893396e+00-2.0e+00i) -1.2989619299109301409e-3+3.6268601916692946561e0i)
(num-test (sin -9.42443269378637893396e+00-5.0e-01i) -3.8933200722481911514e-4+5.2109527443404709218e-1i)
(num-test (sin -9.42512322775237976202e+00+0.0e+00i) 3.4526697614020805155e-4)
(num-test (sin -9.42512322775237976202e+00+1.0e+00i) 5.3277478472317186729e-4-1.1752011235963524665e0i)
(num-test (sin -9.42512322775237976202e+00+1.19209289550781250e-07i) 3.4526697614021050482e-4-1.1920928244535424538e-7i)
(num-test (sin -9.42512322775237976202e+00+2.0e+00i) 1.2989619299081657245e-3-3.6268601916692946571e0i)
(num-test (sin -9.42512322775237976202e+00+5.0e-01i) 3.8933200722399054908e-4-5.2109527443404709231e-1i)
(num-test (sin -9.42512322775237976202e+00-1.0e+00i) 5.3277478472317186729e-4+1.1752011235963524665e0i)
(num-test (sin -9.42512322775237976202e+00-1.19209289550781250e-07i) 3.4526697614021050482e-4+1.1920928244535424538e-7i)
(num-test (sin -9.42512322775237976202e+00-2.0e+00i) 1.2989619299081657245e-3+3.6268601916692946571e0i)
(num-test (sin -9.42512322775237976202e+00-5.0e-01i) 3.8933200722399054908e-4+5.2109527443404709231e-1i)
(num-test (sin 0) 0.0)
(num-test (sin 0.0) 0.0)
(num-test (sin 0.0+0.00000001i) 0.0+0.00000001i)
(num-test (sin 0.0+0.0i) 0.0)
(num-test (sin 0.0+1.0i) 0.0+1.17520119364380i)
(num-test (sin 0.0+2.71828182845905i) 0.0+7.54413710281697i)
(num-test (sin 0.0+3.14159265358979i) 0.0+11.54873935725775i)
(num-test (sin 0.0-0.00000001i) 0.0-0.00000001i)
(num-test (sin 0.0-0.0i) 0.0)
(num-test (sin 0.0-1.0i) 0.0-1.17520119364380i)
(num-test (sin 0.0-2.71828182845905i) 0.0-7.54413710281697i)
(num-test (sin 0.0-3.14159265358979i) 0.0-11.54873935725775i)
(num-test (sin 0.00000001) 0.00000001)
(num-test (sin 0.00000001+0.00000001i) 0.00000001+0.00000001i)
(num-test (sin 0.00000001+0.0i) 0.00000001)
(num-test (sin 0.00000001+1.0i) 0.00000001543081+1.17520119364380i)
(num-test (sin 0.00000001+2.71828182845905i) 0.00000007610125+7.54413710281697i)
(num-test (sin 0.00000001+3.14159265358979i) 0.00000011591953+11.54873935725775i)
(num-test (sin 0.00000001-0.00000001i) 0.00000001-0.00000001i)
(num-test (sin 0.00000001-0.0i) 0.00000001)
(num-test (sin 0.00000001-1.0i) 0.00000001543081-1.17520119364380i)
(num-test (sin 0.00000001-2.71828182845905i) 0.00000007610125-7.54413710281697i)
(num-test (sin 0.00000001-3.14159265358979i) 0.00000011591953-11.54873935725775i)
(num-test (sin 0/1) 0.0)
(num-test (sin 0/1234000000) 0.0)
(num-test (sin 0/500029) 0.0)
(num-test (sin 1) 0.84147098480790)
(num-test (sin 1.0) 0.84147098480790)
(num-test (sin 1.0+0.00000001i) 0.84147098480790+0.00000000540302i)
(num-test (sin 1.0+0.0i) 0.84147098480790)
(num-test (sin 1.0+1.0i) 1.29845758141598+0.63496391478474i)
(num-test (sin 1.0+2.71828182845905i) 6.40369949494148+4.07611467243740i)
(num-test (sin 1.0+3.14159265358979i) 9.75429233860021+6.23981050459650i)
(num-test (sin 1.0-0.00000001i) 0.84147098480790-0.00000000540302i)
(num-test (sin 1.0-0.0i) 0.84147098480790)
(num-test (sin 1.0-1.0i) 1.29845758141598-0.63496391478474i)
(num-test (sin 1.0-2.71828182845905i) 6.40369949494148-4.07611467243740i)
(num-test (sin 1.0-3.14159265358979i) 9.75429233860021-6.23981050459650i)
(num-test (sin 1.110223024625156799999999999999999999997E-16) 1.11022302462515679999999999999999771924E-16)
(num-test (sin 1.57045105981189525579e+00+0.0e+00i) 9.9999994039535581669e-1)
(num-test (sin 1.57045105981189525579e+00+1.0e+00i) 1.5430805428404715942e0+4.0575816248730593018e-4i)
(num-test (sin 1.57045105981189525579e+00+1.19209289550781250e-07i) 9.9999994039536292211e-1+4.1159030931177815679e-11i)
(num-test (sin 1.57045105981189525579e+00+2.0e+00i) 3.7621954668392959445e0+1.2522351259047577385e-3i)
(num-test (sin 1.57045105981189525579e+00+5.0e-01i) 1.1276258979946363572e0+1.7991700040937027667e-4i)
(num-test (sin 1.57045105981189525579e+00-1.0e+00i) 1.5430805428404715942e0-4.0575816248730593018e-4i)
(num-test (sin 1.57045105981189525579e+00-1.19209289550781250e-07i) 9.9999994039536292211e-1-4.1159030931177815679e-11i)
(num-test (sin 1.57045105981189525579e+00-2.0e+00i) 3.7621954668392959445e0-1.2522351259047577385e-3i)
(num-test (sin 1.57045105981189525579e+00-5.0e-01i) 1.1276258979946363572e0-1.7991700040937027667e-4i)
(num-test (sin 1.57114159377789786021e+00+0.0e+00i) 9.9999994039535581673e-1)
(num-test (sin 1.57114159377789786021e+00+1.0e+00i) 1.5430805428404715942e0-4.0575816248716200955e-4i)
(num-test (sin 1.57114159377789786021e+00+1.19209289550781250e-07i) 9.9999994039536292216e-1-4.1159030931163216752e-11i)
(num-test (sin 1.57114159377789786021e+00+2.0e+00i) 3.7621954668392959447e0-1.2522351259043135762e-3i)
(num-test (sin 1.57114159377789786021e+00+5.0e-01i) 1.1276258979946363573e0-1.7991700040930646090e-4i)
(num-test (sin 1.57114159377789786021e+00-1.0e+00i) 1.5430805428404715942e0+4.0575816248716200955e-4i)
(num-test (sin 1.57114159377789786021e+00-1.19209289550781250e-07i) 9.9999994039536292216e-1+4.1159030931163216752e-11i)
(num-test (sin 1.57114159377789786021e+00-2.0e+00i) 3.7621954668392959447e0+1.2522351259043135762e-3i)
(num-test (sin 1.57114159377789786021e+00-5.0e-01i) 1.1276258979946363573e0+1.7991700040930646090e-4i)
(num-test (sin 1/1) 0.84147098480790)
(num-test (sin 1/10) 0.09983341664683)
(num-test (sin 1/1234) 0.00081037268278)
(num-test (sin 1/1234000000) 0.00000000081037)
(num-test (sin 1/2) 0.47942553860420)
(num-test (sin 1/3) 0.32719469679615)
(num-test (sin 1/362880) 0.00000275573192)
(num-test (sin 1/500029) 0.00000199988401)
(num-test (sin 10/1234) 0.00810363901920)
(num-test (sin 10/1234000000) 0.00000000810373)
(num-test (sin 10/3) -0.1905679628754527) 
(num-test (sin 10/362880) 0.00002755731922)
(num-test (sin 10/500029) 0.00001999884007)
(num-test (sin 1234.0+0.00000001i) .6019276547624973-7.985506235875843E-9i) 
(num-test (sin 1234.0+12.0i) 48983.30495194942-64983.97008730317i)
(num-test (sin 1234.0+2.71828182845905i) 4.58074477716391-6.024375387884452i) 
(num-test (sin 1234.0+3.14159265358979i) 6.977517249251167-9.222253015388718i) 
(num-test (sin 1234/10) -0.7693905459455223) 
(num-test (sin 1234/1234000000) 0.00000100000000)
(num-test (sin 1234/3) 0.213644699569724) 
(num-test (sin 1234/362880) 0.00340056663826)
(num-test (sin 1234/500029) 0.00246785435930)
(num-test (sin 1234000000.0+0.00000001i) -0.9872932128398908+1.5890913089022285E-9i) 
(num-test (sin 1234000000.0+2.71828182845905i) -7.513424898263172+1.198832270325275i) 
(num-test (sin 1234000000.0+3.14159265358979i) -11.44465679247962+1.835200134139553i) 
(num-test (sin 1234000000/1234000000) 0.84147098480790)
(num-test (sin 1234000000/3) 9.98585468017658e-1)
(num-test (sin 1234000000/362880) .9798963032808383) 
(num-test (sin 1234000000/500029) -0.9907886154453116) 
(num-test (sin 2) 0.90929742682568)
(num-test (sin 2.71828182845905) .4107812905029501) 
(num-test (sin 2.71828182845905+0.00000001i) .4107812905029501-9.117339147869465E-9i) 
(num-test (sin 2.71828182845905+0.0i) .4107812905029501) 
(num-test (sin 2.71828182845905+1.0i) .6338686545195173-1.071470784943156i) 
(num-test (sin 2.71828182845905+2.71828182845905i) 3.126097025348496-6.878245654440458i) 
(num-test (sin 2.71828182845905+3.14159265358979i) 4.761757525968664-10.52937734504676i) 
(num-test (sin 2/10) 0.19866933079506)
(num-test (sin 2/1234) 0.00162074483338)
(num-test (sin 2/1234000000) 0.00000000162075)
(num-test (sin 2/3) 0.61836980306974)
(num-test (sin 2/362880) 0.00000551146384)
(num-test (sin 2/500029) 0.00000399976801)
(num-test (sin 3.14124738660679181379e+00+0.0e+00i) 3.4526697614158608860e-4)
(num-test (sin 3.14124738660679181379e+00+1.0e+00i) 5.3277478472529828958e-4-1.1752011235963524659e0i)
(num-test (sin 3.14124738660679181379e+00+1.19209289550781250e-07i) 3.4526697614158854187e-4-1.1920928244535424532e-7i)
(num-test (sin 3.14124738660679181379e+00+2.0e+00i) 1.2989619299133501696e-3-3.6268601916692946553e0i)
(num-test (sin 3.14124738660679181379e+00+5.0e-01i) 3.8933200722554445944e-4-5.2109527443404709206e-1i)
(num-test (sin 3.14124738660679181379e+00-1.0e+00i) 5.3277478472529828958e-4+1.1752011235963524659e0i)
(num-test (sin 3.14124738660679181379e+00-1.19209289550781250e-07i) 3.4526697614158854187e-4+1.1920928244535424532e-7i)
(num-test (sin 3.14124738660679181379e+00-2.0e+00i) 1.2989619299133501696e-3+3.6268601916692946553e0i)
(num-test (sin 3.14124738660679181379e+00-5.0e-01i) 3.8933200722554445944e-4+5.2109527443404709206e-1i)
(num-test (sin 3.14159265358979+0.00000001i) -6.982889851335445E-15-1.0E-8i) 
(num-test (sin 3.14159265358979+0.0i) -6.982889851335445E-15) 
(num-test (sin 3.14159265358979+1.0i) -1.077516210464362E-14-1.175201193643801i) 
(num-test (sin 3.14159265358979+2.71828182845905i) -5.314066559815525E-14-7.54413710281663i) 
(num-test (sin 3.14159265358979+3.14159265358979i) -8.094533288479446E-14-11.54873935725783i) 
(num-test (sin 3.14193792057279441821e+00+0.0e+00i) -3.4526697614134115926e-4)
(num-test (sin 3.14193792057279441821e+00+1.0e+00i) -5.3277478472492034385e-4-1.1752011235963524660e0i)
(num-test (sin 3.14193792057279441821e+00+1.19209289550781250e-07i) -3.4526697614134361253e-4-1.1920928244535424533e-7i)
(num-test (sin 3.14193792057279441821e+00+2.0e+00i) -1.2989619299124286975e-3-3.6268601916692946556e0i)
(num-test (sin 3.14193792057279441821e+00+5.0e-01i) -3.8933200722526827075e-4-5.2109527443404709211e-1i)
(num-test (sin 3.14193792057279441821e+00-1.0e+00i) -5.3277478472492034385e-4+1.1752011235963524660e0i)
(num-test (sin 3.14193792057279441821e+00-1.19209289550781250e-07i) -3.4526697614134361253e-4+1.1920928244535424533e-7i)
(num-test (sin 3.14193792057279441821e+00-2.0e+00i) -1.2989619299124286975e-3+3.6268601916692946556e0i)
(num-test (sin 3.14193792057279441821e+00-5.0e-01i) -3.8933200722526827075e-4+5.2109527443404709211e-1i)
(num-test (sin 3.45266983001243932001e-04+0.0e+00i) 3.4526697614140534807e-4)
(num-test (sin 3.45266983001243932001e-04+1.0e+00i) 5.3277478472501939236e-4+1.1752011235963524660e0i)
(num-test (sin 3.45266983001243932001e-04+1.19209289550781250e-07i) 3.4526697614140780134e-4+1.1920928244535424533e-7i)
(num-test (sin 3.45266983001243932001e-04+2.0e+00i) 1.2989619299126701883e-3+3.6268601916692946556e0i)
(num-test (sin 3.45266983001243932001e-04+5.0e-01i) 3.8933200722534065172e-4+5.2109527443404709209e-1i)
(num-test (sin 3.45266983001243932001e-04-1.0e+00i) 5.3277478472501939236e-4-1.1752011235963524660e0i)
(num-test (sin 3.45266983001243932001e-04-1.19209289550781250e-07i) 3.4526697614140780134e-4-1.1920928244535424533e-7i)
(num-test (sin 3.45266983001243932001e-04-2.0e+00i) 1.2989619299126701883e-3-3.6268601916692946556e0i)
(num-test (sin 3.45266983001243932001e-04-5.0e-01i) 3.8933200722534065172e-4-5.2109527443404709209e-1i)
(num-test (sin 3/10) 0.29552020666134)
(num-test (sin 3/1234) 0.00243111591964)
(num-test (sin 3/1234000000) 0.00000000243112)
(num-test (sin 3/2) 0.99749498660405)
(num-test (sin 3/362880) 0.00000826719577)
(num-test (sin 3/500029) 0.00000599965202)
(num-test (sin 362880/1234) -0.9463147870254296) 
(num-test (sin 362880/1234000000) 0.00029406806707)
(num-test (sin 362880/500029) 0.66367262572318)
(num-test (sin 4.71204371340168837179e+00+0.0e+00i) -9.9999994039535581664e-1)
(num-test (sin 4.71204371340168837179e+00+1.0e+00i) -1.5430805428404715941e0-4.0575816248744985081e-4i)
(num-test (sin 4.71204371340168837179e+00+1.19209289550781250e-07i) -9.9999994039536292207e-1-4.1159030931192414605e-11i)
(num-test (sin 4.71204371340168837179e+00+2.0e+00i) -3.7621954668392959444e0-1.2522351259052019007e-3i)
(num-test (sin 4.71204371340168837179e+00+5.0e-01i) -1.1276258979946363572e0-1.7991700040943409243e-4i)
(num-test (sin 4.71204371340168837179e+00-1.0e+00i) -1.5430805428404715941e0+4.0575816248744985081e-4i)
(num-test (sin 4.71204371340168837179e+00-1.19209289550781250e-07i) -9.9999994039536292207e-1+4.1159030931192414605e-11i)
(num-test (sin 4.71204371340168837179e+00-2.0e+00i) -3.7621954668392959444e0+1.2522351259052019007e-3i)
(num-test (sin 4.71204371340168837179e+00-5.0e-01i) -1.1276258979946363572e0+1.7991700040943409243e-4i)
(num-test (sin 4.71273424736769097620e+00+0.0e+00i) -9.9999994039535581677e-1)
(num-test (sin 4.71273424736769097620e+00+1.0e+00i) -1.5430805428404715943e0+4.0575816248701808892e-4i)
(num-test (sin 4.71273424736769097620e+00+1.19209289550781250e-07i) -9.9999994039536292220e-1+4.1159030931148617825e-11i)
(num-test (sin 4.71273424736769097620e+00+2.0e+00i) -3.7621954668392959448e0+1.2522351259038694139e-3i)
(num-test (sin 4.71273424736769097620e+00+5.0e-01i) -1.1276258979946363573e0+1.7991700040924264514e-4i)
(num-test (sin 4.71273424736769097620e+00-1.0e+00i) -1.5430805428404715943e0-4.0575816248701808892e-4i)
(num-test (sin 4.71273424736769097620e+00-1.19209289550781250e-07i) -9.9999994039536292220e-1-4.1159030931148617825e-11i)
(num-test (sin 4.71273424736769097620e+00-2.0e+00i) -3.7621954668392959448e0-1.2522351259038694139e-3i)
(num-test (sin 4.71273424736769097620e+00-5.0e-01i) -1.1276258979946363573e0-1.7991700040924264514e-4i)
(num-test (sin 500029/10) .9665258739436294) 
(num-test (sin 500029/1234) .05553717596791147) 
(num-test (sin 500029/1234000000) 0.00040520987546)
(num-test (sin 500029/2) 0.270047165973401) 
(num-test (sin 500029/3) 7.610322596690986e-1)
(num-test (sin 500029/362880) 0.98146191370834)
(num-test (sin 6.28284004019658492979e+00+0.0e+00i) -3.4526697614170855328e-4)
(num-test (sin 6.28284004019658492979e+00+1.0e+00i) -5.3277478472548726245e-4+1.1752011235963524659e0i)
(num-test (sin 6.28284004019658492979e+00+1.19209289550781250e-07i) -3.4526697614171100655e-4+1.1920928244535424532e-7i)
(num-test (sin 6.28284004019658492979e+00+2.0e+00i) -1.2989619299138109057e-3+3.6268601916692946552e0i)
(num-test (sin 6.28284004019658492979e+00+5.0e-01i) -3.8933200722568255379e-4+5.2109527443404709204e-1i)
(num-test (sin 6.28284004019658492979e+00-1.0e+00i) -5.3277478472548726245e-4-1.1752011235963524659e0i)
(num-test (sin 6.28284004019658492979e+00-1.19209289550781250e-07i) -3.4526697614171100655e-4-1.1920928244535424532e-7i)
(num-test (sin 6.28284004019658492979e+00-2.0e+00i) -1.2989619299138109057e-3-3.6268601916692946552e0i)
(num-test (sin 6.28284004019658492979e+00-5.0e-01i) -3.8933200722568255379e-4-5.2109527443404709204e-1i)
(num-test (sin 6.28353057416258753420e+00+0.0e+00i) 3.4526697614121869459e-4)
(num-test (sin 6.28353057416258753420e+00+1.0e+00i) 5.3277478472473137099e-4+1.1752011235963524661e0i)
(num-test (sin 6.28353057416258753420e+00+1.19209289550781250e-07i) 3.4526697614122114786e-4+1.1920928244535424534e-7i)
(num-test (sin 6.28353057416258753420e+00+2.0e+00i) 1.2989619299119679614e-3+3.6268601916692946558e0i)
(num-test (sin 6.28353057416258753420e+00+5.0e-01i) 3.8933200722513017641e-4+5.2109527443404709213e-1i)
(num-test (sin 6.28353057416258753420e+00-1.0e+00i) 5.3277478472473137099e-4-1.1752011235963524661e0i)
(num-test (sin 6.28353057416258753420e+00-1.19209289550781250e-07i) 3.4526697614122114786e-4-1.1920928244535424534e-7i)
(num-test (sin 6.28353057416258753420e+00-2.0e+00i) 1.2989619299119679614e-3-3.6268601916692946558e0i)
(num-test (sin 6.28353057416258753420e+00-5.0e-01i) 3.8933200722513017641e-4-5.2109527443404709213e-1i)
(num-test (sin 9.42443269378637893396e+00+0.0e+00i) 3.4526697614094283958e-4)
(num-test (sin 9.42443269378637893396e+00+1.0e+00i) 5.3277478472430570447e-4-1.1752011235963524662e0i)
(num-test (sin 9.42443269378637893396e+00+1.19209289550781250e-07i) 3.4526697614094529285e-4-1.1920928244535424535e-7i)
(num-test (sin 9.42443269378637893396e+00+2.0e+00i) 1.2989619299109301409e-3-3.6268601916692946561e0i)
(num-test (sin 9.42443269378637893396e+00+5.0e-01i) 3.8933200722481911514e-4-5.2109527443404709218e-1i)
(num-test (sin 9.42443269378637893396e+00-1.0e+00i) 5.3277478472430570447e-4+1.1752011235963524662e0i)
(num-test (sin 9.42443269378637893396e+00-1.19209289550781250e-07i) 3.4526697614094529285e-4+1.1920928244535424535e-7i)
(num-test (sin 9.42443269378637893396e+00-2.0e+00i) 1.2989619299109301409e-3+3.6268601916692946561e0i)
(num-test (sin 9.42443269378637893396e+00-5.0e-01i) 3.8933200722481911514e-4+5.2109527443404709218e-1i)
(num-test (sin 9.42512322775237976202e+00+0.0e+00i) -3.4526697614020805155e-4)
(num-test (sin 9.42512322775237976202e+00+1.0e+00i) -5.3277478472317186729e-4-1.1752011235963524665e0i)
(num-test (sin 9.42512322775237976202e+00+1.19209289550781250e-07i) -3.4526697614021050482e-4-1.1920928244535424538e-7i)
(num-test (sin 9.42512322775237976202e+00+2.0e+00i) -1.2989619299081657245e-3-3.6268601916692946571e0i)
(num-test (sin 9.42512322775237976202e+00+5.0e-01i) -3.8933200722399054908e-4-5.2109527443404709231e-1i)
(num-test (sin 9.42512322775237976202e+00-1.0e+00i) -5.3277478472317186729e-4+1.1752011235963524665e0i)
(num-test (sin 9.42512322775237976202e+00-1.19209289550781250e-07i) -3.4526697614021050482e-4+1.1920928244535424538e-7i)
(num-test (sin 9.42512322775237976202e+00-2.0e+00i) -1.2989619299081657245e-3+3.6268601916692946571e0i)
(num-test (sin 9.42512322775237976202e+00-5.0e-01i) -3.8933200722399054908e-4+5.2109527443404709231e-1i)
(num-test (sin pi) -6.982889851335445E-15) 
(num-test (sin 32767.) 1.8750655394138942394239E-1)
(num-test (sin 8388607.) 9.9234509376961249835628E-1)
(num-test (sin 2147483647.) -7.2491655514455639054829E-1)
(num-test (sin 80143857.0000000149) 1.283143758817470627530994988383551176295E-10)

(num-test (sin (- (/ pi 2) (* 0+i (log (/ (+ 1 (sqrt 5)) 2))))) (/ (sqrt 5) 2))
(num-test (sin (/ pi 10)) (/ (- (sqrt 5) 1) 4))
(num-test (sin (/ pi 12)) (* (/ (sqrt 2) 4) (- (sqrt 3) 1)))
(num-test (sin (/ pi 12)) (/ (- (sqrt 6) (sqrt 2)) 4))
(num-test (sin (/ pi 15)) (/ (sqrt (- 7 (sqrt 5) (sqrt (- 30 (* 6 (sqrt 5)))))) 4))
(num-test (sin (/ pi 16)) (/ (sqrt (- 2 (sqrt (+ 2 (sqrt 2))))) 2))
(num-test (sin (/ pi 20)) (/ (sqrt (- 8 (* 2 (sqrt (+ 10 (* 2 (sqrt 5))))))) 4))
(num-test (sin (/ pi 24)) (/ (sqrt (- 2 (sqrt (+ 2 (sqrt 3))))) 2))
(num-test (sin (/ pi 3)) (/ (sqrt 3) 2))
(num-test (sin (/ pi 3)) (/ (sqrt 3) 2))
(num-test (sin (/ pi 30)) (/ (+ -1 (- (sqrt 5)) (sqrt (- 30 (* 6 (sqrt 5))))) 8))
(num-test (sin (/ pi 32)) (/ (sqrt (- 2 (sqrt (+ 2 (sqrt (+ 2 (sqrt 2))))))) 2))
(num-test (sin (/ pi 4)) (/ (sqrt 2) 2))
(num-test (sin (/ pi 5)) (/ (sqrt (- 10 (* 2 (sqrt 5)))) 4))
(num-test (sin (/ pi 6)) 1/2)
(num-test (sin (/ pi 8)) (/ (sqrt (- 2 (sqrt 2))) 2))
(num-test (* (sin (/ pi 11)) (sin (/ (* 2 pi) 11)) (sin (/ (* 3 pi) 11)) (sin (/ (* 4 pi) 11)) (sin (/ (* 5 pi) 11))) (sqrt (/ 11 1024)))
(num-test (* (sin (/ pi 7)) (sin (/ (* 2 pi) 7)) (sin (/ (* 3 pi) 7))) (/ (sqrt 7) 8))
(num-test (* (sin (/ pi 9)) (sin (/ (* 2 pi) 9)) (sin (/ (* 4 pi) 9))) (/ (sqrt 3) 8))
(num-test (* pi (+ 1.0 (atan (tan (acos (cos (asin (sin (/ 1.0 (/ 1.0 pi)))))))))) pi)
(num-test (+ (* (sin 0.1) (sin 0.1)) (* (cos 0.1) (cos 0.1))) 1.0)
(num-test (/ (- (sqrt 5) 1) 2) (/ (sin (* pi 1/5)) (sin (* pi 2/5))))

(let ((val1 (sin (/ pi 60)))
      (val2 (* 1/16 (- (* (+ (sqrt 6) (sqrt 2)) (- (sqrt 5) 1)) (* 2 (- (sqrt 3) 1) (sqrt (+ 5 (sqrt 5))))))))
  (num-test (- val1 val2) 0.0))

(let ((val1 (sin (/ (* 4 pi) 15)))
      (val2 (* 1/8 (+ (sqrt (+ 10 (* 2 (sqrt 5)))) (sqrt 15) (- (sqrt 3))))))
  (num-test (- val1 val2) 0.0))

(num-test (sin 22) -8.851309290403875921690256815772332463307E-3)
(when with-bignums
  (num-test (sin 1e22) -8.522008497671888017727058937530293682616E-1)
  (num-test (sin 1+100i) 1.130986289301505745599509129978056149094E43+7.261979450834655624032117190441273726075E42i)
  (num-test (sin 0+100i) 0.0+1.34405857090806772420631277579000679368E43i)
  (num-test (sin 0+1000i) 0.0+9.850355570085234969444396761216615626576E433i)
  (num-test (sin 1+1000i) 8.288788402267571487966465808315066740252E433+5.322169828138126401369949836048836144292E433i)
  (num-test (sin 1e-100+1e-100i) 9.999999999999999999999999999999999999992E-101+9.999999999999999999999999999999999999992E-101i))

;; not even close if not bignums: 0.4626130407646
;; we start to lose around 1e18 -- running out of bits of fraction?

(test (>= 0.0000001 (sin 0.0000001)) #t)
(test (>= 0.000000001 (sin 0.000000001)) #t)
;(test (>= 0.0000001 (sin (+ (* 2 pi) 0.0000001))) #t)
; this fails because "pi" is inaccurate?
(num-test (sin 31415926.0) -0.5106132968486)
(num-test (sin (+ (* 200 pi) 0.001)) 9.999998333333416874831395573527051109993E-4)
(test (< (abs (- (sin (+ (* 200 pi) 0.001)) (- (sin (- (* 200 pi) 0.001))))) 5e-13) #t)

(for-each
 (lambda (num-and-val)
   (let ((num (car num-and-val)) (val (cadr num-and-val))) (num-test-1 'sin num (sin num) val)))
 (vector (list 0 0) (list 1 0.8414709848079) (list 2 0.90929742682568) (list 3 0.14112000805987) 
	 (list -1 -0.8414709848079) (list -2 -0.90929742682568) (list -3 -0.14112000805987) 
	 (list 1/2 0.4794255386042) (list 1/3 0.32719469679615) (list -1/2 -0.4794255386042) 
	 (list -1/3 -0.32719469679615) (list 1/9223372036854775807 1.0842021724855e-19) (list 0.0 0.0) 
	 (list 1.0 0.8414709848079) (list 2.0 0.90929742682568) (list -2.0 -0.90929742682568) 
	 (list 1.000000000000000000000000000000000000002E-309 1.000000000000000000000000000000000000002E-309) 
	 (list 0+1i 0+1.1752011936438i) (list 0+2i 0+3.626860407847i) 
	 (list 0-1i 0-1.1752011936438i) (list 1+1i 1.298457581416+0.63496391478474i) (list 1-1i 1.298457581416-0.63496391478474i) 
	 (list -1+1i -1.298457581416+0.63496391478474i) (list -1-1i -1.298457581416-0.63496391478474i) 
	 (list 0.1+0.1i 0.10033299984131+0.099666333492108i) (list 1e-16+1e-16i 1e-16+1e-16i) 
	 ))

(test (sin) 'error)
(test (sin "hi") 'error)
(test (sin 1.0+23.0i 1.0+23.0i) 'error)
(test (sin 0 1) 'error)

(for-each
 (lambda (arg)
   (test (sin arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))

(when with-bignums	
  (letrec ((sin-m*pi/n 
	    (lambda (m1 n1)
	      
	      ;; this returns an expression giving the exact value of sin(m*pi/n), m and n integer
	      ;;   if we can handle n -- currently it can be anything of the form 2^a 3^b 5^c 7^d 11^h 13^e 17^f 257^g
	      ;;   so (sin-m*pi/n 1 60) returns an exact expression for sin(pi/60).
	      
	      (let ((m (numerator (/ m1 n1)))
		    (n (denominator (/ m1 n1))))
		
		(set! m (modulo m (* 2 n)))
		;; now it's in lowest terms without extra factors of 2*pi
		
		(cond ((zero? m) 0)
		      
		      ((zero? n) (error 'divide-by-zero "divide by zero (sin-m*pi/n n = 0)"))
		      
		      ((= n 1) 0)
		      
		      ((negative? n)
		       (let ((val (sin-m*pi/n m (- n))))
			 (and val `(- ,val))))
		      
		      ((> m n) 
		       (let ((val (sin-m*pi/n (- m n) n)))
			 (and val `(- ,val))))
		      
		      ((= n 2) (if (= m 0) 0 1))
		      
		      ((= n 3) `(sqrt 3/4))
		      
		      ((> m 1)
		       (let ((m1 (sin-m*pi/n (- m 1) n))
			     (n1 (sin-m*pi/n 1 n))
			     (m2 (sin-m*pi/n (- m 2) n)))
			 (and m1 m2 n1
			      `(- (* 2 ,m1 (sqrt (- 1 (* ,n1 ,n1)))) ,m2))))
		      
		      ((= n 5) `(/ (sqrt (- 10 (* 2 (sqrt 5)))) 4))
		      
		      ((= n 7) `(let ((A1 (expt (+ -7/3456 (sqrt -49/442368)) 1/3))
				      (A2 (expt (- -7/3456 (sqrt -49/442368)) 1/3)))
				  (sqrt (+ 7/12 (* -1/2 (+ A1 A2)) (* 1/2 0+i (sqrt 3) (- A1 A2))))))
		      
		      ((= n 17) `(let* ((A1 (sqrt (- 17 (sqrt 17))))
					(A2 (sqrt (+ 17 (sqrt 17))))
					(A3 (sqrt (+ 34 (* 6 (sqrt 17)) (* (sqrt 2) (- (sqrt 17) 1) A1) (* -8 (sqrt 2) A2)))))
				   (* 1/8 (sqrt 2) (sqrt (- 17 (sqrt 17) (* (sqrt 2) (+ A1 A3)))))))
		      
		      
		      ((= n 11) `(let* ((SQRT5 (* 1/2 (- (sqrt 5) 1)))
					(B5 (sqrt (+ 2 (* 1/2 (+ (sqrt 5) 1)))))
					(B6 (+ SQRT5 (* 0+i B5)))
					(B6_2 (* B6 B6))
					(B6_3 (* B6 B6 B6))
					(B6_4 (* B6 B6 B6 B6)) 
					(D1 (+ 6 (* 3/2 B6) (* 3/4 B6_2)))
					(D2 (+ SQRT5 (* 0+i B5) (* 1/4 B6_2)))
					(D3 (* 1/2 (- (+ 1 (* 0+i (sqrt 11))))))
					(D4 (* 1/2 (- (* 0+i (sqrt 11)) 1)))
					(D6 (+ 1 (* 1/4 B6_2) (* 1/8 B6_3)))
					(D7 (+ (* 1/2 B6) (* 1/16 B6_4)))
					(D8 (+ 2 (* 1/2 B6)))
					(D9 (+ 13 (* 21 B6) (* 67/4 B6_2) (* 21/4 B6_3) (* 2 B6_4)))
					(D11 (+ 129 (* 109/2 B6) (* 59/4 B6_2) (* 9/8 B6_3) (* 9/16 B6_4)))
					(D13 (+ (* 3 B6) B6_2))
					(D14 (+ (* 3 B6) (* 3/4 B6_2) (* 3/8 B6_3)))
					(D15 (+ 79 (* 27 B6) (* 39/4 B6_2) (* 37/4 B6_3) (* 21/4 B6_4)))
					(D16 (+ D11 (* D3 D9) (* D4 D15)))
					(D17 (+ D11 (* D4 D9) (* D3 D15)))
					(D30 (/ (* B6_2 (+ (* D3 D6) (* D4 D7))) (* 4 (expt D17 1/5))))
					(D32 (* 1/2 (+ 1 (* 0+i (sqrt 11)))))
					(D33 (/ (* B6_3 (+ (* D4 D6) (* D3 D7))) (* 8 (expt D16 1/5))))
					(D34 (* 1/4 B6_2 (expt D16 1/5)))
					(D35 (+ 2 (* 1/8 B6_4) (* 1/2 B6 D8) (* 1/8 B6_3 D2)))
					(D36 (+ SQRT5 (* 0+i B5) (* 1/2 B6_2) (* 1/4 B6_3) (* 1/2 B6 D2) (* 1/4 B6_2 (+ (* 1/4 B6_3) (* 1/16 B6_4)))))
					(D38 (* 1/2 (+ -1 (* 0+i (sqrt 11)))))
					(D39 (* 1/8 B6_3 (expt D17 1/5)))
					(D40 (+ 3 (* 3/2 B6) (* 9/4 B6_2) (* 7/8 B6_3) (* 3/16 B6_4) (* 1/2 B6 (+ 6 (* 2 B6)))
						(* 1/16 B6_4 D1) (* 1/4 B6_2 D13) (* 1/8 B6_3 (+ 3 (* 3/4 B6_3) (* 3/16 B6_4)))))
					(D41 (+ (* 1/4 B6_2 D1) (* 1/8 B6_3 D13) (* 1/16 B6_4 D14) (* 1/2 B6 (+ 4 (* 3/8 B6_4)))))
					(D42 (+ 3 (* 3/4 B6_3) (* 3/16 B6_4) (* 1/8 B6_3 D1) (* 1/4 B6_2 D14) 
						(* 1/2 B6 (+ (* 3/2 B6_2) (* 3/8 B6_3) (* 3/16 B6_4))) (* 1/16 B6_4 (+ 3 (* 3/2 B6) (* 3/8 B6_4)))))
					(D43 (+ (* 1/4 B6_3) (* 1/16 B6_4) (* 1/8 B6_3 D8) (* 1/4 B6_2 D2) 
						(* 1/2 B6 (+ (* 1/2 B6_2) (* 1/8 B6_3))) (* 1/16 B6_4 (+ 1 (* 1/8 B6_4)))))
					(D44 (/ (* B6_4 (+ D42 (* D4 D40) (* D3 D41))) (* 16 (expt D16 3/5))))
					(D45 (/ (* B6 (+ D42 (* D3 D40) (* D4 D41))) (* 2 (expt D17 3/5))))
					(D48 (/ (* B6 (+ D43 (* D3 D35) (* D4 D36))) (* 2 (expt D16 2/5))))
					(D49 (/ (* B6_4 (+ D43 (* D4 D35) (* D3 D36))) (* 16 (expt D17 2/5)))))
				   (* -1/2 0+i 
				      (+ (* 1/5 (- D32 D33 D34 D48 D44))
					 (* 1/5 (+ D38 D30 D39 D49 D45))))))
		      
		      ((= n 13)
		       `(let* ((A1 (/ (- -1 (sqrt 13)) 2))
			       (A2 (/ (+ -1 (sqrt 13)) 2))
			       (A3 (/ (+ -1 (* 0+i (sqrt 3))) 2))
			       (A4 (+ -1 (* 0+i (sqrt 3))))
			       (A5 (* 0+i (sqrt (+ 7 (sqrt 13) A2))))
			       (A6 (* 0+i (sqrt (+ 7 (- (sqrt 13)) A1))))
			       (A8  (* 1/2 (- A2 A6)))
			       (A9  (* 1/2 (+ A1 A5)))
			       (A11 (* 1/2 (+ A2 A6)))
			       (A12 (* 1/2 (- A1 A5)))
			       (A13 (* 3/2 A4 A8))
			       (A14 (* 3/2 A4 A11))
			       (A15 (* 3/4 A4 A4 A11))
			       (A16 (* 3/4 A4 A4 A8))
			       (A17 (+ A3 (* 1/4 A4 A4))))
			  (* -1/6 0+i (+ (- A9 A12)
					 (* A4 (+ (/ (+ A8 (* A17 A12)) (* 2 (expt (+ 6 A13 A15 A9) 1/3)))
						  (/ (+ A11 (* A17 A9)) (* -2 (expt (+ 6 A16 A14 A12) 1/3)))
						  (* 1/4 A4 (- (expt (+ 6 A13 A15 A9) 1/3) (expt (+ 6 A16 A14 A12) 1/3)))))))))
		      
		      ((= n 257)
		       `(let* ((A1 (sqrt (- 514 (* 2 (sqrt 257)))))
			       (A2 (- 257 (* 15 (sqrt 257))))
			       (A3 (+ 257 (* 15 (sqrt 257))))
			       (A4 (- 257 (sqrt 257)))
			       (A5 (+ (sqrt 257) 257))
			       (A7 (+ 257 (* 9 (sqrt 257))))
			       (A8 (- 514 (* 18 (sqrt 257))))
			       (AA (sqrt (* 2 A5)))
			       (A9 (sqrt (+ A2 (* 8 A1) (* -7 AA))))
			       (A10 (sqrt (+ A2 (* -8 A1) (* 7 AA))))
			       (A11 (sqrt (+ A3 (* 7 A1) (* 8 AA))))
			       (A12 (sqrt (+ A3 (* -7 A1) (* -8 AA))))
			       (A13 (sqrt (+ A8 (* 6 A1) (* 8 A9) (* -24 A10) (* 12 A11))))
			       (A14 (* 4 (sqrt (+ A8 (* 6 A1) (* -8 A9) (* 24 A10) (* -12 A11)))))
			       (A15 (* 4 (sqrt (+ A8 (* -6 A1) (* -12 A12) (* 24 A9) (* 8 A10)))))
			       (A16 (* 4 (sqrt (* 2 (+ (- 257 (* 9 (sqrt 257))) (* -3 A1) (* 6 A12) (* -12 A9) (* -4 A10))))))
			       (A17 (sqrt (* 2 (+ A7 (* -3 AA) (* -4 A12) (* 6 A9) (* 12 A11)))))
			       (A18 (sqrt (* 2 (+ A7 (* 3 AA) (* 12 A12) (* -6 A10) (* 4 A11)))))
			       (A19 (* 4 (sqrt (* 2 (+ A7 (* 3 AA) (* -12 A12) (* 6 A10) (* -4 A11))))))
			       (A20 (* 4 (sqrt (* 2 (+ A7 (* -3 AA) (* 4 A12) (* -6 A9) (* -12 A11))))))
			       (A22 (+ A4 (* 3 A1) (* -4 AA) (* -4 A12) (* 4 A9) (* -4 A10) (* 2 A11)))
			       (A23 (+ A5 (* -4 A1) (* -3 AA) (* -4 A12) (* 2 A9) (* 4 A10) (* 4 A11)))
			       (A24 (+ A5 (* 4 A1) (* 3 AA) (* 4 A12) (* 4 A9) (* -2 A10) (* 4 A11)))
			       (A26 (sqrt (+ A22 (+ (- A16) (- A19) (* 4 A17) (* -6 A13)))))
			       (A27 (sqrt (+ A22 (+ A16 A19 (* -4 A17) (* 6 A13)))))
			       (A28 (+ 257 (* 7 (sqrt 257)) (* 3 A1) (* -4 A9) (* 4 A10) (* 6 A11)))
			       (A29 (* 8 (sqrt (+ A24 A15 (- A20) (* -6 A18) (* -4 A13)))))
			       (A30 (+ A28 (* -4 A18) (* -4 A17) (* -2 A13)))
			       (A31 (+ (* 8 (sqrt (+ A23 A15 A14 (* 4 A18) (* -6 A17)))) (* 4 A26) A29 (* -8 A27))))
			  (* 1/16 (sqrt (* 1/2 (+ A4 (- A1) (* -2 A11) (* -2 A13) (* -4 A26)
						  (* -4 (sqrt (* 2 (+ A30 (- A31)))))
						  (* -8 (sqrt (+ A4 (- A1) (* -2 A11) (* 6 A13) (* -4 A26) (* -8 A27)
								 (* 4 (sqrt (* 2 (+ A30 A31))))
								 (* -8 (sqrt (* 2 (+ A28 (* 4 A18) (* 4 A17) (* 2 A13) (* -8 A26) (* -4 A27)
										     (* -8 (sqrt (+ A23 (- A15) (- A14) (* -4 A18) (* 6 A17))))
										     (* -8 (sqrt (+ A24 (- A15) A20 (* 6 A18) (* 4 A13)))))))))))))))))
		      
		      ((or (= (modulo n 2) 0) (= (modulo n 3) 0) (= (modulo n 5) 0) (= (modulo n 7) 0) 
			   (= (modulo n 17) 0) (= (modulo n 13) 0) (= (modulo n 257) 0) (= (modulo n 11) 0))
		       (let ((divisor (if (= (modulo n 2) 0) 2
					  (if (= (modulo n 3) 0) 3
					      (if (= (modulo n 5) 0) 5
						  (if (= (modulo n 7) 0) 7
						      (if (= (modulo n 17) 0) 17
							  (if (= (modulo n 13) 0) 13
							      (if (= (modulo n 11) 0) 11
								  257)))))))))
			 (let ((val (sin-m*pi/n 1 (/ n divisor))))
			   (and val
				`(let ((ex ,val))
				   (/ (- (expt (+ (sqrt (- 1 (* ex ex))) (* 0+i ex)) (/ 1 ,divisor))
					 (expt (- (sqrt (- 1 (* ex ex))) (* 0+i ex)) (/ 1 ,divisor)))
				      0+2i))))))
		      
		      (else #f))))))
    
    (let ((maxerr 0.0)
	  (max-case #f)
	  (cases 0))
      (do ((n 1 (+ n 1)))
	  ((= n 100))
	(do ((m 1 (+ m 1)))
	    ((= m 4))
	  (letrec ((bigify (lambda (lst)
			     (if (pair? lst)
				 (cons (if (number? (car lst))
					   (list 'bignum (number->string (car lst)))
					   (bigify (car lst)))
				       (bigify (cdr lst)))
				 lst))))
	    (let ((val (sin (/ (* m pi) n)))
		  (expr (bigify (sin-m*pi/n m n))))
	      (if expr 
		  (let ((err (magnitude (- val (eval expr)))))
		    (set! cases (+ cases 1))
		    (if (> err maxerr) 
			(begin
			  (set! max-case (/ m n))
			  (set! maxerr err)))))))))
      (if (> maxerr 1e-35)
	  (format #t "sin-m*pi/n (~A cases) max err ~A at ~A~%" cases maxerr max-case)))))

(let ((sins (list 
	     0.00000000000000000000000000000000000000000000000000000000000000000000
	     0.09983341664682815230681419841062202698991538801798225999276686156165
	     0.19866933079506121545941262711838975037020672954020540398639599139797
	     0.29552020666133957510532074568502737367783211174261844850153103617326
	     0.38941834230865049166631175679570526459306018344395889511584896585734
	     0.47942553860420300027328793521557138808180336794060067518861661312553
	     0.56464247339503535720094544565865790710988808499415177102426589426735
	     0.64421768723769105367261435139872018306581384457368964474396308809382
	     0.71735609089952276162717461058138536619278523779142282098968252068287
	     0.78332690962748338846138231571354862314014792572030960356048515256195
	     0.84147098480789650665250232163029899962256306079837106567275170999191
	     0.89120736006143533995180257787170353831890931945282652766035329176720
	     0.93203908596722634967013443549482599541507058820873073536659789445024
	     0.96355818541719296470134863003955481534204849131773911795564922309212
	     0.98544972998846018065947457880609751735626167234736563194021894560084
	     0.99749498660405443094172337114148732270665142592211582194997482405934
	     0.99957360304150516434211382554623417197949791475491995534260751586102
	     0.99166481045246861534613339864787565240681957116712372532710249102330
	     0.97384763087819518653237317884335760670293947136523395566725825917196
	     0.94630008768741448848970961163495776211399866559491176443047155279581
	     0.90929742682568169539601986591174484270225497144789026837897301153096
	     0.86320936664887377068075931326902458492047242489508107697183045949721
	     0.80849640381959018430403691041611906515855960597557707903336060873485
	     0.74570521217672017738540621164349953894264877802047425750762828050000
	     0.67546318055115092656577152534128337425336495789352584226890212866520
	     0.59847214410395649405185470218616227170359717157722357330262703263874
	     0.51550137182146423525772693520936824389387858775426312126259173008382
	     0.42737988023382993455605308585788064749647642266670256499017776070511
	     0.33498815015590491954385375271242210603030652888358671068410107309479
	     0.23924932921398232818425691873957537221555293029961877411621026588071
	     0.14112000805986722210074480280811027984693326425226558415188264123242
	     0.04158066243329057919469827159667310055461342296380675064800900076588
	     -0.05837414342757990913721741461909518512512509908292656970935025422273)))
  (let ((mxerr 0.0))
    (do ((i 0 (+ i 1))
	 (x 0.0 (+ x 0.1)))
	((= i 32))
      (let ((err (abs (- (sin x) (list-ref sins i)))))
	(if (> err mxerr)
	    (set! mxerr err))))
    (if (> mxerr 1e-12) (format #t "sin err: ~A~%" mxerr))))
	    
(when with-bignums
  (let-temporarily (((*s7* 'bignum-precision) 500))
    (let ((sin-vals (list   ;arprec mathtool table[Sin[k/10], {k, 0, 30}]
		     "0.00000000000000000000000000000000000000000000000000000000000000000000"
		     "0.09983341664682815230681419841062202698991538801798225999276686156165"
		     "0.19866933079506121545941262711838975037020672954020540398639599139797"
		     "0.29552020666133957510532074568502737367783211174261844850153103617326"
		     "0.38941834230865049166631175679570526459306018344395889511584896585734"
		     "0.47942553860420300027328793521557138808180336794060067518861661312553"
		     "0.56464247339503535720094544565865790710988808499415177102426589426735"
		     "0.64421768723769105367261435139872018306581384457368964474396308809382"
		     "0.71735609089952276162717461058138536619278523779142282098968252068287"
		     "0.78332690962748338846138231571354862314014792572030960356048515256195"
		     "0.84147098480789650665250232163029899962256306079837106567275170999191"
		     "0.89120736006143533995180257787170353831890931945282652766035329176720"
		     "0.93203908596722634967013443549482599541507058820873073536659789445024"
		     "0.96355818541719296470134863003955481534204849131773911795564922309212"
		     "0.98544972998846018065947457880609751735626167234736563194021894560084"
		     "0.99749498660405443094172337114148732270665142592211582194997482405934"
		     "0.99957360304150516434211382554623417197949791475491995534260751586102"
		     "0.99166481045246861534613339864787565240681957116712372532710249102330"
		     "0.97384763087819518653237317884335760670293947136523395566725825917196"
		     "0.94630008768741448848970961163495776211399866559491176443047155279581"
		     "0.90929742682568169539601986591174484270225497144789026837897301153096"
		     "0.86320936664887377068075931326902458492047242489508107697183045949721"
		     "0.80849640381959018430403691041611906515855960597557707903336060873485"
		     "0.74570521217672017738540621164349953894264877802047425750762828050000"
		     "0.67546318055115092656577152534128337425336495789352584226890212866520"
		     "0.59847214410395649405185470218616227170359717157722357330262703263874"
		     "0.51550137182146423525772693520936824389387858775426312126259173008382"
		     "0.42737988023382993455605308585788064749647642266670256499017776070511"
		     "0.33498815015590491954385375271242210603030652888358671068410107309479"
		     "0.23924932921398232818425691873957537221555293029961877411621026588071"
		     "0.14112000805986722210074480280811027984693326425226558415188264123242")))
      (do ((k 2 (+ k 1)))
	  ((= k 30))
	(let ((sin-val-2 (number->string (sin (/ k (bignum "10"))))))
	  (if (not (string=? (substring (list-ref sin-vals k) 3 60) (substring sin-val-2 2 59)))
	      (format #t ";(sin (/ ~A 10)) mp: ~A does not match~%~A~%" k (substring (list-ref sin-vals k) 3 60) (substring sin-val-2 2 59))))))
    
    (let ((sin-vals (list   ;arprec mathtool table[Sin[k/10], {k, 0, 30}]
		     0.00000000000000000000000000000000000000000000000000000000000000000000
		     0.09983341664682815230681419841062202698991538801798225999276686156165
		     0.19866933079506121545941262711838975037020672954020540398639599139797
		     0.29552020666133957510532074568502737367783211174261844850153103617326
		     0.38941834230865049166631175679570526459306018344395889511584896585734
		     0.47942553860420300027328793521557138808180336794060067518861661312553
		     0.56464247339503535720094544565865790710988808499415177102426589426735
		     0.64421768723769105367261435139872018306581384457368964474396308809382
		     0.71735609089952276162717461058138536619278523779142282098968252068287
		     0.78332690962748338846138231571354862314014792572030960356048515256195
		     0.84147098480789650665250232163029899962256306079837106567275170999191
		     0.89120736006143533995180257787170353831890931945282652766035329176720
		     0.93203908596722634967013443549482599541507058820873073536659789445024
		     0.96355818541719296470134863003955481534204849131773911795564922309212
		     0.98544972998846018065947457880609751735626167234736563194021894560084
		     0.99749498660405443094172337114148732270665142592211582194997482405934
		     0.99957360304150516434211382554623417197949791475491995534260751586102
		     0.99166481045246861534613339864787565240681957116712372532710249102330
		     0.97384763087819518653237317884335760670293947136523395566725825917196
		     0.94630008768741448848970961163495776211399866559491176443047155279581
		     0.90929742682568169539601986591174484270225497144789026837897301153096
		     0.86320936664887377068075931326902458492047242489508107697183045949721
		     0.80849640381959018430403691041611906515855960597557707903336060873485
		     0.74570521217672017738540621164349953894264877802047425750762828050000
		     0.67546318055115092656577152534128337425336495789352584226890212866520
		     0.59847214410395649405185470218616227170359717157722357330262703263874
		     0.51550137182146423525772693520936824389387858775426312126259173008382
		     0.42737988023382993455605308585788064749647642266670256499017776070511
		     0.33498815015590491954385375271242210603030652888358671068410107309479
		     0.23924932921398232818425691873957537221555293029961877411621026588071
		     0.14112000805986722210074480280811027984693326425226558415188264123242))
	  (mxerr 0.0))
      (do ((x 0 (+ x 1)))
	  ((= x 20))
	(let ((phase (* 2 pi (expt 10 x))))
	  (do ((k 0 (+ k 1)))
	      ((= k 30))
	    (let ((sin-val-2 (sin (+ phase (/ k (bignum "10"))))))
	      (let ((err (magnitude (- sin-val-2 (list-ref sin-vals k)))))
		(if (> err mxerr)
		    (set! mxerr err)))))))
      (if (> mxerr 1e-35)
	  (format #t ";(sin big-angle) max error: ~A" mxerr)))))



;;; --------------------------------------------------------------------------------
;;; cos
;;; --------------------------------------------------------------------------------

(num-test (cos 0) 1.0)
(num-test (cos 1) 0.54030230586814)
(num-test (cos 2) -0.41614683654714)
(num-test (cos 3) -0.98999249660045)
(num-test (cos 0/1) 1.0)
(num-test (cos 0/2) 1.0)
(num-test (cos 0/3) 1.0)
(num-test (cos 0/10) 1.0)
(num-test (cos 0/1234) 1.0)
(num-test (cos 0/1234000000) 1.0)
(num-test (cos 0/500029) 1.0)
(num-test (cos 0/362880) 1.0)
(num-test (cos 1/1) 0.54030230586814)
(num-test (cos 1/2) 0.87758256189037)
(num-test (cos -1/2) 0.87758256189037)
(num-test (cos 1/3) 0.94495694631474)
(num-test (cos -1/3) 0.94495694631474)
(num-test (cos 1/10) 0.99500416527803)
(num-test (cos -1/10) 0.99500416527803)
(num-test (cos 1/1234) 0.99999967164800)
(num-test (cos -1/1234) 0.99999967164800)
(num-test (cos 1/1234000000) 1.0)
(num-test (cos -1/1234000000) 1.0)
(num-test (cos 1/500029) 0.99999999999800)
(num-test (cos -1/500029) 0.99999999999800)
(num-test (cos 1/362880) 0.99999999999620)
(num-test (cos -1/362880) 0.99999999999620)
(num-test (cos 2/1) -0.41614683654714)
(num-test (cos 2/2) 0.54030230586814)
(num-test (cos 2/3) 0.78588726077695)
(num-test (cos 2/10) 0.98006657784124)
(num-test (cos -2/10) 0.98006657784124)
(num-test (cos 2/1234) 0.99999868659223)
(num-test (cos -2/1234) 0.99999868659223)
(num-test (cos 2/1234000000) 1.0)
(num-test (cos -2/1234000000) 1.0)
(num-test (cos 2/500029) 0.99999999999200)
(num-test (cos -2/500029) 0.99999999999200)
(num-test (cos 2/362880) 0.99999999998481)
(num-test (cos -2/362880) 0.99999999998481)
(num-test (cos 3/1) -0.98999249660045)
(num-test (cos 3/2) 0.07073720166770)
(num-test (cos 3/3) 0.54030230586814)
(num-test (cos 3/10) 0.95533648912561)
(num-test (cos -3/10) 0.95533648912561)
(num-test (cos 3/1234) 0.99999704483333)
(num-test (cos -3/1234) 0.99999704483333)
(num-test (cos 3/1234000000) 1.0)
(num-test (cos -3/1234000000) 1.0)
(num-test (cos 3/500029) 0.99999999998200)
(num-test (cos -3/500029) 0.99999999998200)
(num-test (cos 3/362880) 0.99999999996583)
(num-test (cos -3/362880) 0.99999999996583)
(num-test (cos 10/3) -0.98167400471108)
(num-test (cos 10/10) 0.54030230586814)
(num-test (cos 10/1234) 0.99996716497825)
(num-test (cos -10/1234) 0.99996716497825)
(num-test (cos 10/1234000000) 1.0)
(num-test (cos -10/1234000000) 1.0)
(num-test (cos 10/500029) 0.99999999980002)
(num-test (cos -10/500029) 0.99999999980002)
(num-test (cos 10/362880) 0.99999999962030)
(num-test (cos -10/362880) 0.99999999962030)
(num-test (cos 1234/1234) 0.54030230586814)
(num-test (cos 1234/1234000000) 0.99999999999950)
(num-test (cos -1234/1234000000) 0.99999999999950)
(num-test (cos 1234/500029) 0.99999695484279)
(num-test (cos -1234/500029) 0.99999695484279)
(num-test (cos 1234/362880) 0.99999421805655)
(num-test (cos -1234/362880) 0.99999421805655)
(num-test (cos 1234000000/1234000000) 0.54030230586814)
(num-test (cos 500029/1234000000) 0.99999991790247)
(num-test (cos -500029/1234000000) 0.99999991790247)
(num-test (cos 500029/500029) 0.54030230586814)
(num-test (cos 500029/362880) 0.19165727729458)
(num-test (cos 362880/1234000000) 0.99999995676199)
(num-test (cos -362880/1234000000) 0.99999995676199)
(num-test (cos 362880/500029) 0.74802315864263)
(num-test (cos 362880/362880) 0.54030230586814)
(num-test (cos 0.0) 1.0)
(num-test (cos 0.00000001) 1.0)
(num-test (cos -0.00000001) 1.0)
(num-test (cos 1.0) 0.54030230586814)
(num-test (cos pi) -1.0)
(num-test (cos 2.71828182845905) -0.91173391478697)
(num-test (cos 0.0+0.0i) 1.0)
(num-test (cos -0.0+0.0i) 1.0)
(num-test (cos 0.0-0.0i) 1.0)
(num-test (cos -0.0-0.0i) 1.0)
(num-test (cos 0.0+0.00000001i) 1.0)
(num-test (cos -0.0+0.00000001i) 1.0)
(num-test (cos 0.0-0.00000001i) 1.0)
(num-test (cos -0.0-0.00000001i) 1.0)
(num-test (cos 0.0+1.0i) 1.54308063481524)
(num-test (cos -0.0+1.0i) 1.54308063481524)
(num-test (cos 0.0-1.0i) 1.54308063481524)
(num-test (cos 0.0+3.14159265358979i) 11.59195327552152)
(num-test (cos -0.0+3.14159265358979i) 11.59195327552152)
(num-test (cos 0.0-3.14159265358979i) 11.59195327552152)
(num-test (cos 0.0+2.71828182845905i) 7.61012513866229)
(num-test (cos -0.0+2.71828182845905i) 7.61012513866229)
(num-test (cos 0.0-2.71828182845905i) 7.61012513866229)
(num-test (cos 0.00000001+0.0i) 1.0)
(num-test (cos -0.00000001+0.0i) 1.0)
(num-test (cos 0.00000001-0.0i) 1.0)
(num-test (cos -0.00000001-0.0i) 1.0)
(num-test (cos 0.00000001+0.00000001i) 1.0-1e-16i) ; maxima
(num-test (cos -0.00000001+0.00000001i) 1.0+1e-16i)
(num-test (cos 0.00000001-0.00000001i) 1.0+1e-16i)
(num-test (cos -0.00000001-0.00000001i) 1.0-1e-16i)
(num-test (cos 0.00000001+1.0i) 1.54308063481524-0.00000001175201i)
(num-test (cos 0.00000001-1.0i) 1.54308063481524+0.00000001175201i)
(num-test (cos 0.00000001+3.14159265358979i) 11.59195327552152-0.00000011548739i)
(num-test (cos 0.00000001-3.14159265358979i) 11.59195327552152+0.00000011548739i)
(num-test (cos 0.00000001+2.71828182845905i) 7.61012513866229-0.00000007544137i)
(num-test (cos 0.00000001-2.71828182845905i) 7.61012513866229+0.00000007544137i)
(num-test (cos 1.0+0.0i) 0.54030230586814)
(num-test (cos 1.0-0.0i) 0.54030230586814)
(num-test (cos 1.0+0.00000001i) 0.54030230586814-0.00000000841471i)
(num-test (cos 1.0-0.00000001i) 0.54030230586814+0.00000000841471i)
(num-test (cos 1.0+1.0i) 0.83373002513115-0.98889770576287i)
(num-test (cos 1.0-1.0i) 0.83373002513115+0.98889770576287i)
(num-test (cos 1.0+3.14159265358979i) 6.26315908428001-9.71792908024139i)
(num-test (cos 1.0-3.14159265358979i) 6.26315908428001+9.71792908024139i)
(num-test (cos 1.0+2.71828182845905i) 4.11176816036433-6.34817247743319i)
(num-test (cos 1.0-2.71828182845905i) 4.11176816036433+6.34817247743319i)
(num-test (cos 3.14159265358979+0.0i) -1.0)
(num-test (cos 3.14159265358979-0.0i) -1.0)
(num-test (cos 3.14159265358979+0.00000001i) -1.0-3.23121723694911E-23i) ; maxima
(num-test (cos 3.14159265358979-0.00000001i) -1.0+3.23121723694911E-23i) ; maxima
(num-test (cos 3.14159265358979+1.0i) -1.54308063481524)
(num-test (cos 3.14159265358979-1.0i) -1.54308063481524)
(num-test (cos 3.14159265358979+3.14159265358979i) -11.5919532755216+8.064357485351393E-14i) ; maxima
(num-test (cos 3.14159265358979-3.14159265358979i) -11.59195327552152+3.73164856762037E-14i)
(num-test (cos 3.14159265358979+2.71828182845905i) -7.61012513866229-2.437674584452965E-14i)
(num-test (cos 3.14159265358979-2.71828182845905i) -7.61012513866229+2.437674584452965E-14i)
(num-test (cos 2.71828182845905+0.0i) -0.91173391478697)
(num-test (cos 2.71828182845905-0.0i) -0.91173391478697)
(num-test (cos 2.71828182845905+0.00000001i) -0.91173391478697-0.00000000410781i)
(num-test (cos 2.71828182845905-0.00000001i) -0.91173391478697+0.00000000410781i)
(num-test (cos 2.71828182845905+1.0i) -1.40687894801206-0.48275066292556i)
(num-test (cos 2.71828182845905-1.0i) -1.40687894801206+0.48275066292556i)
(num-test (cos 2.71828182835905+3.14159265358979i) -10.56877693991882-4.74400605685607i)
(num-test (cos 2.71828182845905-3.14159265358979i) -10.56877693991882+4.74400605685607i)
(num-test (cos 2.71828182845905+2.71828182845905i) -6.93840918469126-3.09899037482603i)
(num-test (cos 2.71828182845905-2.71828182845905i) -6.93840918469126+3.09899037482603i)
(num-test (cos -2/3) .7858872607769459) 
(num-test (cos -3/2) 0.0707372016677029) 
(num-test (cos -10/3) -0.9816740047110853) 
(num-test (cos 1234/3) -0.9769114301438807) 
(num-test (cos 1234/10) -0.6387786688749486) 
(num-test (cos 1234000000/3) -5.317013319482049e-2)
(num-test (cos 1234000000/500029) .1354175745756898) 
(num-test (cos 1234000000/362880) .1995074806029773) 
(num-test (cos 500029/2) 0.962847094896035) 
(num-test (cos 500029/3) -0.6487140328750399) 
(num-test (cos 500029/10) .2565691622107056) 
(num-test (cos 500029/1234) -0.9984566200318916) 
(num-test (cos -500029/362880) .1916572772946199) 
(num-test (cos 362880/1234) .3232465372699541) 
(num-test (cos -362880/500029) .7480231586426291) 
(num-test (cos -3.14159265358979) -1.0) 
(num-test (cos -2.71828182845905) -0.9117339147869464) 
(num-test (cos 0.0+3.14159265358979i) 11.5919532755216) 
(num-test (cos 0.0+2.71828182845905i) 7.610125138661946) 
(num-test (cos 0.00000001+1.0i) 1.543080634815244-1.1752011936438014E-8i) 
(num-test (cos 0.00000001+3.14159265358979i) 11.5919532755216-1.154873935725783E-7i) 
(num-test (cos 0.00000001+2.71828182845905i) 7.610125138661945-7.54413710281663E-8i) 
(num-test (cos 1.0+0.00000001i) .5403023058681398-8.414709848078964E-9i) 
(num-test (cos 1.0+3.14159265358979i) 6.263159084280057-9.71792908024146i) 
(num-test (cos 1.0+2.71828182845905i) 4.111768160364146-6.348172477432901i) 
(num-test (cos 3.14159265358979+0.0i) -1.0) 
(num-test (cos 3.14159265358979+0.00000001i) -1.0+6.982889851335445E-23i) 
(num-test (cos 3.14159265358979+1.0i) -1.543080634815244+8.206300488372603E-15i) 
(num-test (cos 3.14159265358979+3.14159265358979i) -11.5919532755216+8.064357485351393E-14i) 
(num-test (cos 3.14159265358979+2.71828182845905i) -7.610125138661946+5.267987841234144E-14i) 
(num-test (cos 2.71828182845905+0.0i) -0.9117339147869464) 
(num-test (cos 2.71828182845905+0.00000001i) -0.9117339147869464-4.1078129050295015E-9i) 
(num-test (cos 2.71828182845905+1.0i) -1.406878948012029-0.4827506629256081i) 
(num-test (cos 2.71828182845905+3.14159265358979i) -10.56877693991868-4.744006056856582i) 
(num-test (cos 2.71828182845905+2.71828182845905i) -6.93840918469081-3.098990374826203i) 
(num-test (cos 1234.0+0.00000001i) -0.7985506235875843-6.019276547624973E-9i) 
(num-test (cos 1234.0+3.14159265358979i) -9.256761516765916-6.951505596777556i) 
(num-test (cos 1234.0+2.71828182845905i) -6.077070175058048-4.541024753505155i) 
(num-test (cos 1234000000.0+0.00000001i) +0.1589091308902228+9.872932128398908E-9i) 
(num-test (cos 1234000000.0+3.14159265358979i) +1.84206722033321+11.40199198427758i) 
(num-test (cos 1234000000.0+2.71828182845905i) +1.209318371750606+7.448275358344457i) 
(num-test (cos 1234.0+12.0i) -64983.97009220963-48983.30494825104i)
(num-test (cos -3.45266983001243932001e-04+0.0e+00i) 9.9999994039535581673e-1)
(num-test (cos 3.45266983001243932001e-04+0.0e+00i) 9.9999994039535581673e-1)
(num-test (cos -3.45266983001243932001e-04+1.19209289550781250e-07i) 9.9999994039536292216e-1+4.1159030931163569191e-11i)
(num-test (cos -3.45266983001243932001e-04-1.19209289550781250e-07i) 9.9999994039536292216e-1-4.1159030931163569191e-11i)
(num-test (cos 3.45266983001243932001e-04+1.19209289550781250e-07i) 9.9999994039536292216e-1-4.1159030931163569191e-11i)
(num-test (cos 3.45266983001243932001e-04-1.19209289550781250e-07i) 9.9999994039536292216e-1+4.1159030931163569191e-11i)
(num-test (cos -3.45266983001243932001e-04+5.0e-01i) 1.1276258979946363573e0+1.7991700040930800151e-4i)
(num-test (cos -3.45266983001243932001e-04-5.0e-01i) 1.1276258979946363573e0-1.7991700040930800151e-4i)
(num-test (cos 3.45266983001243932001e-04+5.0e-01i) 1.1276258979946363573e0-1.7991700040930800151e-4i)
(num-test (cos 3.45266983001243932001e-04-5.0e-01i) 1.1276258979946363573e0+1.7991700040930800151e-4i)
(num-test (cos -3.45266983001243932001e-04+1.0e+00i) 1.5430805428404715942e0+4.057581624871654840e-4i)
(num-test (cos -3.45266983001243932001e-04-1.0e+00i) 1.5430805428404715942e0-4.057581624871654840e-4i)
(num-test (cos 3.45266983001243932001e-04+1.0e+00i) 1.5430805428404715942e0-4.057581624871654840e-4i)
(num-test (cos 3.45266983001243932001e-04-1.0e+00i) 1.5430805428404715942e0+4.057581624871654840e-4i)
(num-test (cos -3.45266983001243932001e-04+2.0e+00i) 3.7621954668392959447e0+1.2522351259043242989e-3i)
(num-test (cos -3.45266983001243932001e-04-2.0e+00i) 3.7621954668392959447e0-1.2522351259043242989e-3i)
(num-test (cos 3.45266983001243932001e-04+2.0e+00i) 3.7621954668392959447e0-1.2522351259043242989e-3i)
(num-test (cos 3.45266983001243932001e-04-2.0e+00i) 3.7621954668392959447e0+1.2522351259043242989e-3i)
(num-test (cos 1.57045105981189525579e+00+0.0e+00i) 3.4526697614152485627e-4)
(num-test (cos -1.57045105981189525579e+00+0.0e+00i) 3.4526697614152485627e-4)
(num-test (cos 1.57045105981189525579e+00+1.19209289550781250e-07i) 3.4526697614152730954e-4-1.1920928244535424532e-7i)
(num-test (cos 1.57045105981189525579e+00-1.19209289550781250e-07i) 3.4526697614152730954e-4+1.1920928244535424532e-7i)
(num-test (cos -1.57045105981189525579e+00+1.19209289550781250e-07i) 3.4526697614152730954e-4+1.1920928244535424532e-7i)
(num-test (cos -1.57045105981189525579e+00-1.19209289550781250e-07i) 3.4526697614152730954e-4-1.1920928244535424532e-7i)
(num-test (cos 1.57045105981189525579e+00+5.0e-01i) 3.8933200722547541227e-4-5.2109527443404709207e-1i)
(num-test (cos 1.57045105981189525579e+00-5.0e-01i) 3.8933200722547541227e-4+5.2109527443404709207e-1i)
(num-test (cos -1.57045105981189525579e+00+5.0e-01i) 3.8933200722547541227e-4+5.2109527443404709207e-1i)
(num-test (cos -1.57045105981189525579e+00-5.0e-01i) 3.8933200722547541227e-4-5.2109527443404709207e-1i)
(num-test (cos 1.57045105981189525579e+00+1.0e+00i) 5.3277478472520380315e-4-1.1752011235963524659e0i)
(num-test (cos 1.57045105981189525579e+00-1.0e+00i) 5.3277478472520380315e-4+1.1752011235963524659e0i)
(num-test (cos -1.57045105981189525579e+00+1.0e+00i) 5.3277478472520380315e-4+1.1752011235963524659e0i)
(num-test (cos -1.57045105981189525579e+00-1.0e+00i) 5.3277478472520380315e-4-1.1752011235963524659e0i)
(num-test (cos 1.57045105981189525579e+00+2.0e+00i) 1.2989619299131198016e-3-3.6268601916692946554e0i)
(num-test (cos 1.57045105981189525579e+00-2.0e+00i) 1.2989619299131198016e-3+3.6268601916692946554e0i)
(num-test (cos -1.57045105981189525579e+00+2.0e+00i) 1.2989619299131198016e-3+3.6268601916692946554e0i)
(num-test (cos -1.57045105981189525579e+00-2.0e+00i) 1.2989619299131198016e-3-3.6268601916692946554e0i)
(num-test (cos 1.57114159377789786021e+00+0.0e+00i) -3.4526697614140239160e-4)
(num-test (cos -1.57114159377789786021e+00+0.0e+00i) -3.4526697614140239160e-4)
(num-test (cos 1.57114159377789786021e+00+1.19209289550781250e-07i) -3.4526697614140484486e-4-1.1920928244535424533e-7i)
(num-test (cos 1.57114159377789786021e+00-1.19209289550781250e-07i) -3.4526697614140484486e-4+1.1920928244535424533e-7i)
(num-test (cos -1.57114159377789786021e+00+1.19209289550781250e-07i) -3.4526697614140484486e-4+1.1920928244535424533e-7i)
(num-test (cos -1.57114159377789786021e+00-1.19209289550781250e-07i) -3.4526697614140484486e-4-1.1920928244535424533e-7i)
(num-test (cos 1.57114159377789786021e+00+5.0e-01i) -3.8933200722533731792e-4-5.2109527443404709209e-1i)
(num-test (cos 1.57114159377789786021e+00-5.0e-01i) -3.8933200722533731792e-4+5.2109527443404709209e-1i)
(num-test (cos -1.57114159377789786021e+00+5.0e-01i) -3.8933200722533731792e-4+5.2109527443404709209e-1i)
(num-test (cos -1.57114159377789786021e+00-5.0e-01i) -3.8933200722533731792e-4-5.2109527443404709209e-1i)
(num-test (cos 1.57114159377789786021e+00+1.0e+00i) -5.3277478472501483029e-4-1.1752011235963524660e0i)
(num-test (cos 1.57114159377789786021e+00-1.0e+00i) -5.3277478472501483029e-4+1.1752011235963524660e0i)
(num-test (cos -1.57114159377789786021e+00+1.0e+00i) -5.3277478472501483029e-4+1.1752011235963524660e0i)
(num-test (cos -1.57114159377789786021e+00-1.0e+00i) -5.3277478472501483029e-4-1.1752011235963524660e0i)
(num-test (cos 1.57114159377789786021e+00+2.0e+00i) -1.2989619299126590655e-3-3.6268601916692946556e0i)
(num-test (cos 1.57114159377789786021e+00-2.0e+00i) -1.2989619299126590655e-3+3.6268601916692946556e0i)
(num-test (cos -1.57114159377789786021e+00+2.0e+00i) -1.2989619299126590655e-3+3.6268601916692946556e0i)
(num-test (cos -1.57114159377789786021e+00-2.0e+00i) -1.2989619299126590655e-3-3.6268601916692946556e0i)
(num-test (cos 3.14124738660679181379e+00+0.0e+00i) -9.9999994039535581667e-1)
(num-test (cos -3.14124738660679181379e+00+0.0e+00i) -9.9999994039535581667e-1)
(num-test (cos 3.14124738660679181379e+00+1.19209289550781250e-07i) -9.9999994039536292209e-1-4.1159030931185115142e-11i)
(num-test (cos 3.14124738660679181379e+00-1.19209289550781250e-07i) -9.9999994039536292209e-1+4.1159030931185115142e-11i)
(num-test (cos -3.14124738660679181379e+00+1.19209289550781250e-07i) -9.9999994039536292209e-1+4.1159030931185115142e-11i)
(num-test (cos -3.14124738660679181379e+00-1.19209289550781250e-07i) -9.9999994039536292209e-1-4.1159030931185115142e-11i)
(num-test (cos 3.14124738660679181379e+00+5.0e-01i) -1.1276258979946363572e0-1.7991700040940218455e-4i)
(num-test (cos 3.14124738660679181379e+00-5.0e-01i) -1.1276258979946363572e0+1.7991700040940218455e-4i)
(num-test (cos -3.14124738660679181379e+00+5.0e-01i) -1.1276258979946363572e0+1.7991700040940218455e-4i)
(num-test (cos -3.14124738660679181379e+00-5.0e-01i) -1.1276258979946363572e0-1.7991700040940218455e-4i)
(num-test (cos 3.14124738660679181379e+00+1.0e+00i) -1.5430805428404715941e0-4.0575816248737789049e-4i)
(num-test (cos 3.14124738660679181379e+00-1.0e+00i) -1.5430805428404715941e0+4.0575816248737789049e-4i)
(num-test (cos -3.14124738660679181379e+00+1.0e+00i) -1.5430805428404715941e0+4.0575816248737789049e-4i)
(num-test (cos -3.14124738660679181379e+00-1.0e+00i) -1.5430805428404715941e0-4.0575816248737789049e-4i)
(num-test (cos 3.14124738660679181379e+00+2.0e+00i) -3.7621954668392959444e0-1.2522351259049798196e-3i)
(num-test (cos 3.14124738660679181379e+00-2.0e+00i) -3.7621954668392959444e0+1.2522351259049798196e-3i)
(num-test (cos -3.14124738660679181379e+00+2.0e+00i) -3.7621954668392959444e0+1.2522351259049798196e-3i)
(num-test (cos -3.14124738660679181379e+00-2.0e+00i) -3.7621954668392959444e0-1.2522351259049798196e-3i)
(num-test (cos 3.14193792057279441821e+00+0.0e+00i) -9.9999994039535581675e-1)
(num-test (cos -3.14193792057279441821e+00+0.0e+00i) -9.9999994039535581675e-1)
(num-test (cos 3.14193792057279441821e+00+1.19209289550781250e-07i) -9.9999994039536292218e-1+4.1159030931155917289e-11i)
(num-test (cos 3.14193792057279441821e+00-1.19209289550781250e-07i) -9.9999994039536292218e-1-4.1159030931155917289e-11i)
(num-test (cos -3.14193792057279441821e+00+1.19209289550781250e-07i) -9.9999994039536292218e-1-4.1159030931155917289e-11i)
(num-test (cos -3.14193792057279441821e+00-1.19209289550781250e-07i) -9.9999994039536292218e-1+4.1159030931155917289e-11i)
(num-test (cos 3.14193792057279441821e+00+5.0e-01i) -1.1276258979946363573e0+1.7991700040927455302e-4i)
(num-test (cos 3.14193792057279441821e+00-5.0e-01i) -1.1276258979946363573e0-1.7991700040927455302e-4i)
(num-test (cos -3.14193792057279441821e+00+5.0e-01i) -1.1276258979946363573e0-1.7991700040927455302e-4i)
(num-test (cos -3.14193792057279441821e+00-5.0e-01i) -1.1276258979946363573e0+1.7991700040927455302e-4i)
(num-test (cos 3.14193792057279441821e+00+1.0e+00i) -1.5430805428404715943e0+4.0575816248709004923e-4i)
(num-test (cos 3.14193792057279441821e+00-1.0e+00i) -1.5430805428404715943e0-4.0575816248709004923e-4i)
(num-test (cos -3.14193792057279441821e+00+1.0e+00i) -1.5430805428404715943e0-4.0575816248709004923e-4i)
(num-test (cos -3.14193792057279441821e+00-1.0e+00i) -1.5430805428404715943e0+4.0575816248709004923e-4i)
(num-test (cos 3.14193792057279441821e+00+2.0e+00i) -3.7621954668392959448e0+1.2522351259040914950e-3i)
(num-test (cos 3.14193792057279441821e+00-2.0e+00i) -3.7621954668392959448e0-1.2522351259040914950e-3i)
(num-test (cos -3.14193792057279441821e+00+2.0e+00i) -3.7621954668392959448e0-1.2522351259040914950e-3i)
(num-test (cos -3.14193792057279441821e+00-2.0e+00i) -3.7621954668392959448e0+1.2522351259040914950e-3i)
(num-test (cos 4.71204371340168837179e+00+0.0e+00i) -3.4526697614164732094e-4)
(num-test (cos -4.71204371340168837179e+00+0.0e+00i) -3.4526697614164732094e-4)
(num-test (cos 4.71204371340168837179e+00+1.19209289550781250e-07i) -3.4526697614164977421e-4+1.1920928244535424532e-7i)
(num-test (cos 4.71204371340168837179e+00-1.19209289550781250e-07i) -3.4526697614164977421e-4-1.1920928244535424532e-7i)
(num-test (cos -4.71204371340168837179e+00+1.19209289550781250e-07i) -3.4526697614164977421e-4-1.1920928244535424532e-7i)
(num-test (cos -4.71204371340168837179e+00-1.19209289550781250e-07i) -3.4526697614164977421e-4+1.1920928244535424532e-7i)
(num-test (cos 4.71204371340168837179e+00+5.0e-01i) -3.8933200722561350661e-4+5.2109527443404709205e-1i)
(num-test (cos 4.71204371340168837179e+00-5.0e-01i) -3.8933200722561350661e-4-5.2109527443404709205e-1i)
(num-test (cos -4.71204371340168837179e+00+5.0e-01i) -3.8933200722561350661e-4-5.2109527443404709205e-1i)
(num-test (cos -4.71204371340168837179e+00-5.0e-01i) -3.8933200722561350661e-4+5.2109527443404709205e-1i)
(num-test (cos 4.71204371340168837179e+00+1.0e+00i) -5.3277478472539277601e-4+1.1752011235963524659e0i)
(num-test (cos 4.71204371340168837179e+00-1.0e+00i) -5.3277478472539277601e-4-1.1752011235963524659e0i)
(num-test (cos -4.71204371340168837179e+00+1.0e+00i) -5.3277478472539277601e-4-1.1752011235963524659e0i)
(num-test (cos -4.71204371340168837179e+00-1.0e+00i) -5.3277478472539277601e-4+1.1752011235963524659e0i)
(num-test (cos 4.71204371340168837179e+00+2.0e+00i) -1.2989619299135805376e-3+3.6268601916692946552e0i)
(num-test (cos 4.71204371340168837179e+00-2.0e+00i) -1.2989619299135805376e-3-3.6268601916692946552e0i)
(num-test (cos -4.71204371340168837179e+00+2.0e+00i) -1.2989619299135805376e-3-3.6268601916692946552e0i)
(num-test (cos -4.71204371340168837179e+00-2.0e+00i) -1.2989619299135805376e-3+3.6268601916692946552e0i)
(num-test (cos 4.71273424736769097620e+00+0.0e+00i) 3.4526697614127992692e-4)
(num-test (cos -4.71273424736769097620e+00+0.0e+00i) 3.4526697614127992692e-4)
(num-test (cos 4.71273424736769097620e+00+1.19209289550781250e-07i) 3.4526697614128238019e-4+1.1920928244535424533e-7i)
(num-test (cos 4.71273424736769097620e+00-1.19209289550781250e-07i) 3.4526697614128238019e-4-1.1920928244535424533e-7i)
(num-test (cos -4.71273424736769097620e+00+1.19209289550781250e-07i) 3.4526697614128238019e-4-1.1920928244535424533e-7i)
(num-test (cos -4.71273424736769097620e+00-1.19209289550781250e-07i) 3.4526697614128238019e-4+1.1920928244535424533e-7i)
(num-test (cos 4.71273424736769097620e+00+5.0e-01i) 3.8933200722519922358e-4+5.2109527443404709212e-1i)
(num-test (cos 4.71273424736769097620e+00-5.0e-01i) 3.8933200722519922358e-4-5.2109527443404709212e-1i)
(num-test (cos -4.71273424736769097620e+00+5.0e-01i) 3.8933200722519922358e-4-5.2109527443404709212e-1i)
(num-test (cos -4.71273424736769097620e+00-5.0e-01i) 3.8933200722519922358e-4+5.2109527443404709212e-1i)
(num-test (cos 4.71273424736769097620e+00+1.0e+00i) 5.3277478472482585742e-4+1.1752011235963524660e0i)
(num-test (cos 4.71273424736769097620e+00-1.0e+00i) 5.3277478472482585742e-4-1.1752011235963524660e0i)
(num-test (cos -4.71273424736769097620e+00+1.0e+00i) 5.3277478472482585742e-4-1.1752011235963524660e0i)
(num-test (cos -4.71273424736769097620e+00-1.0e+00i) 5.3277478472482585742e-4+1.1752011235963524660e0i)
(num-test (cos 4.71273424736769097620e+00+2.0e+00i) 1.2989619299121983294e-3+3.6268601916692946557e0i)
(num-test (cos 4.71273424736769097620e+00-2.0e+00i) 1.2989619299121983294e-3-3.6268601916692946557e0i)
(num-test (cos -4.71273424736769097620e+00+2.0e+00i) 1.2989619299121983294e-3-3.6268601916692946557e0i)
(num-test (cos -4.71273424736769097620e+00-2.0e+00i) 1.2989619299121983294e-3+3.6268601916692946557e0i)
(num-test (cos 6.28284004019658492979e+00+0.0e+00i) 9.9999994039535581662e-1)
(num-test (cos -6.28284004019658492979e+00+0.0e+00i) 9.9999994039535581662e-1)
(num-test (cos 6.28284004019658492979e+00+1.19209289550781250e-07i) 9.9999994039536292205e-1+4.1159030931199714069e-11i)
(num-test (cos 6.28284004019658492979e+00-1.19209289550781250e-07i) 9.9999994039536292205e-1-4.1159030931199714069e-11i)
(num-test (cos -6.28284004019658492979e+00+1.19209289550781250e-07i) 9.9999994039536292205e-1-4.1159030931199714069e-11i)
(num-test (cos -6.28284004019658492979e+00-1.19209289550781250e-07i) 9.9999994039536292205e-1+4.1159030931199714069e-11i)
(num-test (cos 6.28284004019658492979e+00+5.0e-01i) 1.1276258979946363572e0+1.7991700040946600032e-4i)
(num-test (cos 6.28284004019658492979e+00-5.0e-01i) 1.1276258979946363572e0-1.7991700040946600032e-4i)
(num-test (cos -6.28284004019658492979e+00+5.0e-01i) 1.1276258979946363572e0-1.7991700040946600032e-4i)
(num-test (cos -6.28284004019658492979e+00-5.0e-01i) 1.1276258979946363572e0+1.7991700040946600032e-4i)
(num-test (cos 6.28284004019658492979e+00+1.0e+00i) 1.5430805428404715941e0+4.0575816248752181112e-4i)
(num-test (cos 6.28284004019658492979e+00-1.0e+00i) 1.5430805428404715941e0-4.0575816248752181112e-4i)
(num-test (cos -6.28284004019658492979e+00+1.0e+00i) 1.5430805428404715941e0-4.0575816248752181112e-4i)
(num-test (cos -6.28284004019658492979e+00-1.0e+00i) 1.5430805428404715941e0+4.0575816248752181112e-4i)
(num-test (cos 6.28284004019658492979e+00+2.0e+00i) 3.7621954668392959443e0+1.2522351259054239819e-3i)
(num-test (cos 6.28284004019658492979e+00-2.0e+00i) 3.7621954668392959443e0-1.2522351259054239819e-3i)
(num-test (cos -6.28284004019658492979e+00+2.0e+00i) 3.7621954668392959443e0-1.2522351259054239819e-3i)
(num-test (cos -6.28284004019658492979e+00-2.0e+00i) 3.7621954668392959443e0+1.2522351259054239819e-3i)
(num-test (cos 6.28353057416258753420e+00+0.0e+00i) 9.9999994039535581679e-1)
(num-test (cos -6.28353057416258753420e+00+0.0e+00i) 9.9999994039535581679e-1)
(num-test (cos 6.28353057416258753420e+00+1.19209289550781250e-07i) 9.9999994039536292222e-1-4.1159030931141318362e-11i)
(num-test (cos 6.28353057416258753420e+00-1.19209289550781250e-07i) 9.9999994039536292222e-1+4.1159030931141318362e-11i)
(num-test (cos -6.28353057416258753420e+00+1.19209289550781250e-07i) 9.9999994039536292222e-1+4.1159030931141318362e-11i)
(num-test (cos -6.28353057416258753420e+00-1.19209289550781250e-07i) 9.9999994039536292222e-1-4.1159030931141318362e-11i)
(num-test (cos 6.28353057416258753420e+00+5.0e-01i) 1.1276258979946363574e0-1.7991700040921073725e-4i)
(num-test (cos 6.28353057416258753420e+00-5.0e-01i) 1.1276258979946363574e0+1.7991700040921073725e-4i)
(num-test (cos -6.28353057416258753420e+00+5.0e-01i) 1.1276258979946363574e0+1.7991700040921073725e-4i)
(num-test (cos -6.28353057416258753420e+00-5.0e-01i) 1.1276258979946363574e0-1.7991700040921073725e-4i)
(num-test (cos 6.28353057416258753420e+00+1.0e+00i) 1.5430805428404715943e0-4.0575816248694612861e-4i)
(num-test (cos 6.28353057416258753420e+00-1.0e+00i) 1.5430805428404715943e0+4.0575816248694612861e-4i)
(num-test (cos -6.28353057416258753420e+00+1.0e+00i) 1.5430805428404715943e0+4.0575816248694612861e-4i)
(num-test (cos -6.28353057416258753420e+00-1.0e+00i) 1.5430805428404715943e0-4.0575816248694612861e-4i)
(num-test (cos 6.28353057416258753420e+00+2.0e+00i) 3.7621954668392959449e0-1.2522351259036473328e-3i)
(num-test (cos 6.28353057416258753420e+00-2.0e+00i) 3.7621954668392959449e0+1.2522351259036473328e-3i)
(num-test (cos -6.28353057416258753420e+00+2.0e+00i) 3.7621954668392959449e0+1.2522351259036473328e-3i)
(num-test (cos -6.28353057416258753420e+00-2.0e+00i) 3.7621954668392959449e0-1.2522351259036473328e-3i)
(num-test (cos 9.42443269378637893396e+00+0.0e+00i) -9.9999994039535581689e-1)
(num-test (cos -9.42443269378637893396e+00+0.0e+00i) -9.9999994039535581689e-1)
(num-test (cos 9.42443269378637893396e+00+1.19209289550781250e-07i) -9.9999994039536292231e-1-4.1159030931108433883e-11i)
(num-test (cos 9.42443269378637893396e+00-1.19209289550781250e-07i) -9.9999994039536292231e-1+4.1159030931108433883e-11i)
(num-test (cos -9.42443269378637893396e+00+1.19209289550781250e-07i) -9.9999994039536292231e-1+4.1159030931108433883e-11i)
(num-test (cos -9.42443269378637893396e+00-1.19209289550781250e-07i) -9.9999994039536292231e-1-4.1159030931108433883e-11i)
(num-test (cos 9.42443269378637893396e+00+5.0e-01i) -1.1276258979946363575e0-1.7991700040906699050e-4i)
(num-test (cos 9.42443269378637893396e+00-5.0e-01i) -1.1276258979946363575e0+1.7991700040906699050e-4i)
(num-test (cos -9.42443269378637893396e+00+5.0e-01i) -1.1276258979946363575e0+1.7991700040906699050e-4i)
(num-test (cos -9.42443269378637893396e+00-5.0e-01i) -1.1276258979946363575e0-1.7991700040906699050e-4i)
(num-test (cos 9.42443269378637893396e+00+1.0e+00i) -1.5430805428404715945e0-4.0575816248662194348e-4i)
(num-test (cos 9.42443269378637893396e+00-1.0e+00i) -1.5430805428404715945e0+4.0575816248662194348e-4i)
(num-test (cos -9.42443269378637893396e+00+1.0e+00i) -1.5430805428404715945e0+4.0575816248662194348e-4i)
(num-test (cos -9.42443269378637893396e+00-1.0e+00i) -1.5430805428404715945e0-4.0575816248662194348e-4i)
(num-test (cos 9.42443269378637893396e+00+2.0e+00i) -3.7621954668392959453e0-1.2522351259026468452e-3i)
(num-test (cos 9.42443269378637893396e+00-2.0e+00i) -3.7621954668392959453e0+1.2522351259026468452e-3i)
(num-test (cos -9.42443269378637893396e+00+2.0e+00i) -3.7621954668392959453e0+1.2522351259026468452e-3i)
(num-test (cos -9.42443269378637893396e+00-2.0e+00i) -3.7621954668392959453e0-1.2522351259026468452e-3i)
(num-test (cos 9.42512322775237976202e+00+0.0e+00i) -9.9999994039535581714e-1)
(num-test (cos -9.42512322775237976202e+00+0.0e+00i) -9.9999994039535581714e-1)
(num-test (cos 9.42512322775237976202e+00+1.19209289550781250e-07i) -9.9999994039536292257e-1+4.1159030931020840323e-11i)
(num-test (cos 9.42512322775237976202e+00-1.19209289550781250e-07i) -9.9999994039536292257e-1-4.1159030931020840323e-11i)
(num-test (cos -9.42512322775237976202e+00+1.19209289550781250e-07i) -9.9999994039536292257e-1-4.1159030931020840323e-11i)
(num-test (cos -9.42512322775237976202e+00-1.19209289550781250e-07i) -9.9999994039536292257e-1+4.1159030931020840323e-11i)
(num-test (cos 9.42512322775237976202e+00+5.0e-01i) -1.1276258979946363577e0+1.7991700040868409591e-4i)
(num-test (cos 9.42512322775237976202e+00-5.0e-01i) -1.1276258979946363577e0-1.7991700040868409591e-4i)
(num-test (cos -9.42512322775237976202e+00+5.0e-01i) -1.1276258979946363577e0-1.7991700040868409591e-4i)
(num-test (cos -9.42512322775237976202e+00-5.0e-01i) -1.1276258979946363577e0+1.7991700040868409591e-4i)
(num-test (cos 9.42512322775237976202e+00+1.0e+00i) -1.5430805428404715949e0+4.0575816248575841970e-4i)
(num-test (cos 9.42512322775237976202e+00-1.0e+00i) -1.5430805428404715949e0-4.0575816248575841970e-4i)
(num-test (cos -9.42512322775237976202e+00+1.0e+00i) -1.5430805428404715949e0-4.0575816248575841970e-4i)
(num-test (cos -9.42512322775237976202e+00-1.0e+00i) -1.5430805428404715949e0+4.0575816248575841970e-4i)
(num-test (cos 9.42512322775237976202e+00+2.0e+00i) -3.7621954668392959462e0+1.2522351258999818715e-3i)
(num-test (cos 9.42512322775237976202e+00-2.0e+00i) -3.7621954668392959462e0-1.2522351258999818715e-3i)
(num-test (cos -9.42512322775237976202e+00+2.0e+00i) -3.7621954668392959462e0-1.2522351258999818715e-3i)
(num-test (cos -9.42512322775237976202e+00-2.0e+00i) -3.7621954668392959462e0+1.2522351258999818715e-3i)
(num-test (cos 0) 1.0)
(num-test (cos -2.225073858507201399999999999999999999996E-308) 1.000E0)
(num-test (cos 1.110223024625156799999999999999999999997E-16) 9.999999999999999999999999999999938370242E-1)

(num-test (cos 22) -9.999608263946371264541747392126937741354E-1)
(num-test (cos 32767.) 9.8226335176928229845654E-1)
(num-test (cos 8388607.) -1.2349580912475928183718E-1)
(num-test (cos 2147483647.) -6.8883669187794383467976E-1)
(num-test (cos (* pi (cos (* pi (cos (log (+ pi 20))))))) -1.0) ; actually there's a 3.93216e-35 imag part
(num-test (cos (/ pi 10)) (/ (sqrt (+ 10 (* 2 (sqrt 5)))) 4))
(num-test (cos (/ pi 12)) (* (/ (sqrt 2) 4) (+ (sqrt 3) 1)))
(num-test (cos (/ pi 12)) (/ (+ (sqrt 6) (sqrt 2)) 4))
(num-test (cos (/ pi 128)) (* 1/2 (sqrt (+ 2 (sqrt (+ 2 (sqrt (+ 2 (sqrt (+ 2 (sqrt (+ 2 (sqrt 2)))))))))))))
(num-test (cos (/ pi 15)) (/ (+ (sqrt (+ 30 (* 6 (sqrt 5)))) (sqrt 5) -1) 8))
(num-test (cos (/ pi 16)) (/ (sqrt (+ 2 (sqrt (+ 2 (sqrt 2))))) 2))
(num-test (cos (/ pi 20)) (/ (sqrt (+ 8 (* 2 (sqrt (+ 10 (* 2 (sqrt 5))))))) 4))
(num-test (cos (/ pi 24)) (/ (sqrt (+ 2 (sqrt (+ 2 (sqrt 3))))) 2))
(num-test (cos (/ pi 3)) 1/2)
(num-test (cos (/ pi 3)) 1/2)
(num-test (cos (/ pi 30)) (/ (sqrt (+ 7 (sqrt 5) (sqrt (* 6 (+ 5 (sqrt 5)))))) 4))
(num-test (cos (/ pi 32))      (/ (sqrt (+ 2 (sqrt (+ 2 (sqrt (+ 2 (sqrt 2))))))) 2))
(num-test (cos (/ pi 4)) (/ (sqrt 2) 2))
(num-test (cos (/ pi 5)) (/ (+ 1 (sqrt 5)) 4))
(num-test (cos (/ pi 6)) (/ (sqrt 3) 2))
(num-test (cos (/ pi 64))  (* 1/2 (sqrt (+ 2 (sqrt (+ 2 (sqrt (+ 2 (sqrt (+ 2 (sqrt 2)))))))))))
(num-test (cos (/ pi 8)) (/ (sqrt (+ 2 (sqrt 2))) 2))
(num-test (cos (log (+ pi 20))) -0.99999999924368)
(num-test (* (cos (/ pi 11)) (cos (/ (* 2 pi) 11)) (cos (/ (* 3 pi) 11)) (cos (/ (* 4 pi) 11)) (cos (/ (* 5 pi) 11))) 1/32)
(num-test (* (cos (/ pi 7)) (cos (/ (* 2 pi) 7)) (cos (/ (* 3 pi) 7))) 1/8)
(num-test (* (cos (/ pi 9)) (cos (/ (* 2 pi) 9)) (cos (/ (* 4 pi) 9))) 1/8)
(num-test (* (cos (/ pi 9)) (cos (/ (* 2 pi) 9)) (cos (/ (* 4 pi) 9))) 1/8)
(num-test (do ((i 1 (+ i 1)) (sum 0.0 (+ sum (cos (/ (* 2 pi i) 11))))) ((= i 6) sum)) -0.5)
(num-test (let ((a (/ (* 2 pi) 13))) (* 8 (+ (cos a) (cos (* 5 a))) (+ (cos (* 2 a)) (cos (* 3 a))) (+ (cos (* 4 a)) (cos (* 6 a))))) -1.0)

(for-each
 (lambda (num-and-val)
   (let ((num (car num-and-val)) (val (cadr num-and-val))) (num-test-1 'cos num (cos num) val)))
 (vector (list 0 1) (list 1 0.54030230586814) (list 2 -0.41614683654714) (list 3 -0.98999249660045) 
	 (list -1 0.54030230586814) (list -2 -0.41614683654714) (list -3 -0.98999249660045) 
	 (list 1/2 0.87758256189037) (list 1/3 0.94495694631474) (list -1/2 0.87758256189037) 
	 (list -1/3 0.94495694631474) (list 1/9223372036854775807 1.0) (list 0.0 1.0) (list 1.0 0.54030230586814) 
	 (list 2.0 -0.41614683654714) (list -2.0 -0.41614683654714) (list 1.000000000000000000000000000000000000002E-309 1.000E0) 
	 (list 0+1i 1.5430806348152) (list 0+2i 3.7621956910836) 
	 (list 0-1i 1.5430806348152) (list 1+1i 0.83373002513115-0.98889770576287i) (list 1-1i 0.83373002513115+0.98889770576287i) 
	 (list -1+1i 0.83373002513115+0.98889770576287i) (list -1-1i 0.83373002513115-0.98889770576287i) 
	 (list 0.1+0.1i 0.9999833333373-0.0099999888888898i) (list 1e-16+1e-16i 1-1e-32i) 
	 ))
  
;; these are from the error analysis package from ETH, Gaston H. Gonnet
(num-test (cos -1.79424124483688191e-11) 9.999999999999999999998390349177663098196E-1)
(num-test (sqrt 3.63861067050296029e-308) 1.907514264822929257351751954551699751189E-154)
(if with-bignums (num-test (tan 10526671570.5) 1.140653720398103887405511659009364634384E12))
(if with-bignums (num-test (tan (modulo 10526671570.5 (* 2 pi))) 1.140653720398103899436689297531030608688E12))
(num-test (modulo 10526671570.5 (* 2 pi)) 4.712388980383813167439843967777959731718E0)
;; this is so sensitive because (cos 4.712388980383813167439843967777959731718E0) = -8.766902541211071412945944658266052999824E-13
;; unfair!

(test (cos) 'error)
(test (cos "hi") 'error)
(test (cos 1.0+23.0i 1.0+23.0i) 'error)
(test (cos 0 1) 'error)

(for-each
 (lambda (arg)
   (test (cos arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))

(let* ((angle 0.0) 
       (z 1.18)
       (result (* z (cos angle))))
  (do ((k 0 (+ 1 k)))
      ((= k 1000))
    (set! result (* z (cos result))))
  ;;result: 0.81194462369499
  ;;(let ((x 0.0))
  ;;  (do ((i 0 (+ 1 i)))
  ;;      ((= i 10000))
  ;;    (set! x (+ x (* (expt -1 i)
  ;;		        (/ (bes-jn (+ 1 (* 2 i)) (* z (+ 1 (* 2 i))))
  ;;		        (+ 1 (* 2 i)))))))
  ;;  (* 2 x))
  ;; 0.81194498071946
  (let ((x (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos 0.0))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
    ;; 47? calls here so we're at around .812 (oscillating around .8119)
    (test (< (abs (- x result)) .001) #t)))

(when full-test
(let () ; this is trying to cause a stack overflow
  (define (f1 z)
    (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z   (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos (* z (cos 0.0)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))

  (num-test (f1 0.5) 0.4501836112948736)
  (let ((c #f) (i 0)) (call/cc (lambda (c1) (set! c c1))) (set! i (+ i 1)) (let ((result (f1 0.5))) (if (< i 2) (c)) (num-test result 0.4501836112948736)))))


(let ()
  (define (dht data) 
    ;; the Hartley transform of 'data'
    (let* ((len (vector-length data)) 
	   (arr (make-vector len 0.0))
	   (w (/ (* 2.0 pi) len)))
      (do ((i 0 (+ 1 i)))
	  ((= i len))
	(do ((j 0 (+ 1 j)))
	    ((= j len))
	  (vector-set! arr i (+ (vector-ref arr i) 
				(* (vector-ref data j) 
				   (+ (cos (* i j w)) 
				      (sin (* i j w))))))))
      arr))
  (let ((data (list->vector '(0.9196 0.9457 0.0268 0.0839 0.1974 0.1060 0.1463 0.3513 0.0391 0.6310 
				     0.9556 0.6259 0.9580 0.8848 0.0104 0.1440 0.0542 0.3001 0.1844 0.3781 
				     0.9641 0.6051 0.3319 0.6143 0.1828 0.2290 0.4026 0.5990 0.7906 0.0403 
				     0.7882 0.1591)))
	(saved-data (make-vector 32 0.0)))
    (do ((i 0 (+ i 1))) 
	((= i 32)) 
      (vector-set! saved-data i (vector-ref data i)))
    (dht data) 
    (dht data)
    (let ((mx 0.0))
      (do ((i 0 (+ i 1)))
	  ((= i 32))
	(let ((err (abs (- (vector-ref data i) (vector-ref saved-data i)))))
	  (if (> err mx)
	      (set! mx err))))
      (if (> mx 1e-6)
	  (format #t "dht error: ~A~%" mx)))))
    
(let ((coss (list 
	     1.00000000000000000000000000000000000000000000000000000000000000000000
	     0.99500416527802576609556198780387029483857622541508403595935274468526
	     0.98006657784124163112419651674816887739352436080656799405254829012618
	     0.95533648912560601964231022756804989824421408263203767451761361222758
	     0.92106099400288508279852673205180161402585956931985044561508926713514
	     0.87758256189037271611628158260382965199164519710974405299761086831595
	     0.82533561490967829724095249895537603887809103918847038136974977367156
	     0.76484218728448842625585999019186490926821055037370335607293245825206
	     0.69670670934716542092074998164232492610178601370806078363714489414924
	     0.62160996827066445648471615140713350872176136659123900757638348453897
	     0.54030230586813971740093660744297660373231042061792222767009725538110
	     0.45359612142557738777137005178471612212146729566259504745593805541880
	     0.36235775447667357763837335562307602033994778557664862648774972093613
	     0.26749882862458740699798410929287135927592992167912966191725336742182
	     0.16996714290024093861674803520364980292818392102853430898236521149464
	     0.07073720166770291008818985143426870908509102756334686942264541719092
	     -0.02919952230128872620577046294649852444486472109384694500313007908245
	     -0.12884449429552468408764285733487351410164007964520297633178213994289
	     -0.22720209469308705531667430653058073247695158653826107158496911100681
	     -0.32328956686350342227883369508031017459419076544223959990115436505106
	     -0.41614683654714238699756822950076218976600077107554489075514997378196
	     -0.50484610459985745162093852371916747040702337674136205964819622353659
	     -0.58850111725534570852414261265492841629376036669872798974753517400616
	     -0.66627602127982419331788057116601723016327537100376988865266957182167
	     -0.73739371554124549960882222733478290843301289199228479878436568873073
	     -0.80114361554693371483350279046735166442856784876782013507459799166202
	     -0.85688875336894723379770215164520111235392263823324404910501242714241
	     -0.90407214201706114798252728194333012633184973516362471104126694868604
	     -0.94222234066865815258678811736615401246341423446824662018098201995710
	     -0.97095816514959052178110666934553217911761475942423954213867099245327
	     -0.98999249660044545727157279473126130239367909661558832881408593292832
	     -0.99913515027327946449237605454146626283664166994794274354471598254947
	     -0.99829477579475308466166072228358269144701258595166016759508002045139)))
  (let ((mxerr 0.0))
    (do ((i 0 (+ i 1))
	 (x 0.0 (+ x 0.1)))
	((= i 32))
      (let ((err (abs (- (cos x) (list-ref coss i)))))
	(if (> err mxerr)
	    (set! mxerr err))))
    (if (> mxerr 1e-12) (format #t "cos err: ~A~%" mxerr))))

(when with-bignums
  (num-test (cos 100000000000000000000000000000000)   -9.207313839241906875982573440296245746235E-1)
  (num-test (cos 100000000000000000000000000000000.0) -9.207313839241906875982573440296245746235E-1)
  (let-temporarily (((*s7* 'bignum-precision) 500))
    (let ((cos-vals (list ; arprec mathtool table[Cos[k/20], {k, 0, 30}]
		     "1.00000000000000000000000000000000000000000000000000000000000000000000"
		     "0.99875026039496624656287081115652109495898026202467575301500996478674"
		     "0.99500416527802576609556198780387029483857622541508403595935274468526"
		     "0.98877107793604228673498099865433895791835001710693704356129574806756"
		     "0.98006657784124163112419651674816887739352436080656799405254829012618"
		     "0.96891242171064478414459544949418919980413419028744283114812812428894"
		     "0.95533648912560601964231022756804989824421408263203767451761361222758"
		     "0.93937271284737892003503235730366558297406104641303414382897205809282"
		     "0.92106099400288508279852673205180161402585956931985044561508926713514"
		     "0.90044710235267692166884061148644643975762309272876915613354673932299"
		     "0.87758256189037271611628158260382965199164519710974405299761086831595"
		     "0.85252452205950574280498179761777305104031900079223767166865534849083"
		     "0.82533561490967829724095249895537603887809103918847038136974977367156"
		     "0.79608379854905582891760457067990587351049589381429244823834230313846"
		     "0.76484218728448842625585999019186490926821055037370335607293245825206"
		     "0.73168886887382088631183875300008454384054127605077248250768322022075"
		     "0.69670670934716542092074998164232492610178601370806078363714489414924"
		     "0.65998314588498217039541602946146607363862433893076798146474793887138"
		     "0.62160996827066445648471615140713350872176136659123900757638348453897"
		     "0.58168308946388349416618097376045571713934034193760200851355170750073"
		     "0.54030230586813971740093660744297660373231042061792222767009725538110"
		     "0.49757104789172699029084957281210067725147811164693171708781576506313"
		     "0.45359612142557738777137005178471612212146729566259504745593805541880"
		     "0.40848744088415729815257671880991853998462713510786075458328732035938"
		     "0.36235775447667357763837335562307602033994778557664862648774972093613"
		     "0.31532236239526866544753855243803801372798570798275680751499914045328"
		     "0.26749882862458740699798410929287135927592992167912966191725336742182"
		     "0.21900668709304158142002217301062666089672421266400567061594451723594"
		     "0.16996714290024093861674803520364980292818392102853430898236521149464"
		     "0.12050276936736657053286662724801883979155423770384722087315404654227"
		     "0.07073720166770291008818985143426870908509102756334686942264541719092")))
      (do ((k 1 (+ k 1)))
	  ((= k 30))
	(let ((cos-val-2 (number->string (cos (/ k (bignum "20"))))))
	  (if (not (string=? (substring (list-ref cos-vals k) 3 60) (substring cos-val-2 2 59)))
	      (format #t ";(cos (/ ~A 20)) mp: ~A does not match~%~A~%" k (substring (list-ref cos-vals k) 3 60) (substring cos-val-2 2 59))))))))



;;; --------------------------------------------------------------------------------
;;; tan
;;; --------------------------------------------------------------------------------

(num-test (tan 0) 0.0)
(num-test (tan 1) 1.55740772465490)
(num-test (tan -1) -1.55740772465490)
(num-test (tan 0/1) 0.0)
(num-test (tan 0/2) 0.0)
(num-test (tan 0/3) 0.0)
(num-test (tan 0/10) 0.0)
(num-test (tan 0/1234) 0.0)
(num-test (tan 0/1234000000) 0.0)
(num-test (tan 0/500029) 0.0)
(num-test (tan 0/362880) 0.0)
(num-test (tan 1/1) 1.55740772465490)
(num-test (tan -1/1) -1.55740772465490)
(num-test (tan 1/2) 0.54630248984379)
(num-test (tan -1/2) -0.54630248984379)
(num-test (tan 1/3) 0.34625354951058)
(num-test (tan -1/3) -0.34625354951058)
(num-test (tan 1/10) 0.10033467208545)
(num-test (tan -1/10) -0.10033467208545)
(num-test (tan 1/1234) 0.00081037294887)
(num-test (tan -1/1234) -0.00081037294887)
(num-test (tan 1/1234000000) 0.00000000081037)
(num-test (tan -1/1234000000) -0.00000000081037)
(num-test (tan 1/500029) 0.00000199988401)
(num-test (tan -1/500029) -0.00000199988401)
(num-test (tan 1/362880) 0.00000275573192)
(num-test (tan -1/362880) -0.00000275573192)
(num-test (tan 2/2) 1.55740772465490)
(num-test (tan -2/2) -1.55740772465490)
(num-test (tan 2/3) 0.78684288947298)
(num-test (tan -2/3) -0.78684288947298)
(num-test (tan 2/10) 0.20271003550867)
(num-test (tan -2/10) -0.20271003550867)
(num-test (tan 2/1234) 0.00162074696208)
(num-test (tan -2/1234) -0.00162074696208)
(num-test (tan 2/1234000000) 0.00000000162075)
(num-test (tan -2/1234000000) -0.00000000162075)
(num-test (tan 2/500029) 0.00000399976801)
(num-test (tan -2/500029) -0.00000399976801)
(num-test (tan 2/362880) 0.00000551146384)
(num-test (tan -2/362880) -0.00000551146384)
(num-test (tan 3/2) 14.10141994717166)
(num-test (tan -3/2) -14.10141994717166)
(num-test (tan 3/3) 1.55740772465490)
(num-test (tan -3/3) -1.55740772465490)
(num-test (tan 3/10) 0.30933624960962)
(num-test (tan -3/10) -0.30933624960962)
(num-test (tan 3/1234) 0.00243112310401)
(num-test (tan -3/1234) -0.00243112310401)
(num-test (tan 3/1234000000) 0.00000000243112)
(num-test (tan -3/1234000000) -0.00000000243112)
(num-test (tan 3/500029) 0.00000599965202)
(num-test (tan -3/500029) -0.00000599965202)
(num-test (tan 3/362880) 0.00000826719577)
(num-test (tan -3/362880) -0.00000826719577)
(num-test (tan 10/10) 1.55740772465490)
(num-test (tan -10/10) -1.55740772465490)
(num-test (tan 10/1234) 0.00810390511110)
(num-test (tan -10/1234) -0.00810390511110)
(num-test (tan 10/1234000000) 0.00000000810373)
(num-test (tan -10/1234000000) -0.00000000810373)
(num-test (tan 10/500029) 0.00001999884007)
(num-test (tan -10/500029) -0.00001999884007)
(num-test (tan 10/362880) 0.00002755731923)
(num-test (tan -10/362880) -0.00002755731923)
(num-test (tan 1234/1234) 1.55740772465490)
(num-test (tan -1234/1234) -1.55740772465490)
(num-test (tan 1234/1234000000) 0.00000100000000)
(num-test (tan -1234/1234000000) -0.00000100000000)
(num-test (tan 1234/500029) 0.00246786187432)
(num-test (tan -1234/500029) -0.00246786187432)
(num-test (tan 1234/362880) 0.00340058630026)
(num-test (tan -1234/362880) -0.00340058630026)
(num-test (tan 1234000000/1234000000) 1.55740772465490)
(num-test (tan -1234000000/1234000000) -1.55740772465490)
(num-test (tan 500029/1234000000) 0.00040520990873)
(num-test (tan -500029/1234000000) -0.00040520990873)
(num-test (tan 500029/500029) 1.55740772465490)
(num-test (tan -500029/500029) -1.55740772465490)
(num-test (tan 500029/362880) 5.12092171798848)
(num-test (tan -500029/362880) -5.12092171798848)
(num-test (tan 362880/1234000000) 0.00029406807979)
(num-test (tan -362880/1234000000) -0.00029406807979)
(num-test (tan 362880/500029) 0.88723539913856)
(num-test (tan -362880/500029) -0.88723539913856)
(num-test (tan 362880/362880) 1.55740772465490)
(num-test (tan -362880/362880) -1.55740772465490)
(num-test (tan 0.0) 0.0)
(num-test (tan 0.00000001) 0.00000001)
(num-test (tan -0.00000001) -0.00000001)
(num-test (tan 1.0) 1.55740772465490)
(num-test (tan -1.0) -1.55740772465490)
(num-test (tan 0.0+0.0i) 0.0)
(num-test (tan -0.0+0.0i) 0.0)
(num-test (tan 0.0-0.0i) 0.0)
(num-test (tan -0.0-0.0i) 0.0)
(num-test (tan 0.0+0.00000001i) 0.0+0.00000001i)
(num-test (tan -0.0+0.00000001i) 0.0+0.00000001i)
(num-test (tan 0.0-0.00000001i) 0.0-0.00000001i)
(num-test (tan -0.0-0.00000001i) -0.0-0.00000001i)
(num-test (tan 0.0+1.0i) 0.0+0.76159415595576i)
(num-test (tan -0.0+1.0i) 0.0+0.76159415595576i)
(num-test (tan 0.0-1.0i) 0.0-0.76159415595576i)
(num-test (tan -0.0-1.0i) -0.0-0.76159415595576i)
(num-test (tan 0.0+3.14159265358979i) 0.0+0.99627207622075i)
(num-test (tan -0.0+3.14159265358979i) 0.0+0.99627207622075i)
(num-test (tan 0.0-3.14159265358979i) 0.0-0.99627207622075i)
(num-test (tan -0.0-3.14159265358979i) -0.0-0.99627207622075i)
(num-test (tan 0.0+2.71828182845905i) 0.0+0.99132891580060i)
(num-test (tan -0.0+2.71828182845905i) 0.0+0.99132891580060i)
(num-test (tan 0.0-2.71828182845905i) 0.0-0.99132891580060i)
(num-test (tan -0.0-2.71828182845905i) -0.0-0.99132891580060i)
(num-test (tan 0.00000001+0.0i) 0.00000001)
(num-test (tan -0.00000001+0.0i) -0.00000001)
(num-test (tan 0.00000001-0.0i) 0.00000001)
(num-test (tan -0.00000001-0.0i) -0.00000001)
(num-test (tan 0.00000001+0.00000001i) 0.00000001+0.00000001i)
(num-test (tan -0.00000001+0.00000001i) -0.00000001+0.00000001i)
(num-test (tan 0.00000001-0.00000001i) 0.00000001-0.00000001i)
(num-test (tan -0.00000001-0.00000001i) -0.00000001-0.00000001i)
(num-test (tan 0.00000001+1.0i) 0.00000000419974+0.76159415595576i)
(num-test (tan -0.00000001+1.0i) -0.00000000419974+0.76159415595576i)
(num-test (tan 0.00000001-1.0i) 0.00000000419974-0.76159415595576i)
(num-test (tan -0.00000001-1.0i) -0.00000000419974-0.76159415595576i)
(num-test (tan 0.00000001+3.14159265358979i) 0.00000000007442+0.99627207622075i)
(num-test (tan -0.00000001+3.14159265358979i) -0.00000000007442+0.99627207622075i)
(num-test (tan 0.00000001-3.14159265358979i) 0.00000000007442-0.99627207622075i)
(num-test (tan -0.00000001-3.14159265358979i) -0.00000000007442-0.99627207622075i)
(num-test (tan 0.00000001+2.71828182845905i) 0.00000000017267+0.99132891580060i)
(num-test (tan -0.00000001+2.71828182845905i) -0.00000000017267+0.99132891580060i)
(num-test (tan 0.00000001-2.71828182845905i) 0.00000000017267-0.99132891580060i)
(num-test (tan -0.00000001-2.71828182845905i) -0.00000000017267-0.99132891580060i)
(num-test (tan 1.0+0.0i) 1.55740772465490)
(num-test (tan -1.0+0.0i) -1.55740772465490)
(num-test (tan 1.0-0.0i) 1.55740772465490)
(num-test (tan -1.0-0.0i) -1.55740772465490)
(num-test (tan 1.0+0.00000001i) 1.55740772465490+0.00000003425519i)
(num-test (tan -1.0+0.00000001i) -1.55740772465490+0.00000003425519i)
(num-test (tan 1.0-0.00000001i) 1.55740772465490-0.00000003425519i)
(num-test (tan -1.0-0.00000001i) -1.55740772465490-0.00000003425519i)
(num-test (tan 1.0+1.0i) 0.27175258531951+1.08392332733869i)
(num-test (tan -1.0+1.0i) -0.27175258531951+1.08392332733869i)
(num-test (tan 1.0-1.0i) 0.27175258531951-1.08392332733869i)
(num-test (tan -1.0-1.0i) -0.27175258531951-1.08392332733869i)
(num-test (tan 1.0+3.14159265358979i) 0.00340139653674+1.00154968930275i)
(num-test (tan -1.0+3.14159265358979i) -0.00340139653674+1.00154968930275i)
(num-test (tan 1.0-3.14159265358979i) 0.00340139653674-1.00154968930275i)
(num-test (tan -1.0-3.14159265358979i) -0.00340139653674-1.00154968930275i)
(num-test (tan 1.0+2.71828182845905i) 0.00794757997665+1.00359921084211i)
(num-test (tan -1.0+2.71828182845905i) -0.00794757997665+1.00359921084211i)
(num-test (tan 1.0-2.71828182845905i) 0.00794757997665-1.00359921084211i)
(num-test (tan -1.0-2.71828182845905i) -0.00794757997665-1.00359921084211i)
(num-test (tan 1234.0+1234.0i) 2.7e-20+1.0i)
(num-test (tan 1234.0-1234.0i) 2.7e-20-1.0i)
(num-test (tan 10/3) .1941255059835657) 
(num-test (tan 1234/3) -0.2186940320047828) 
(num-test (tan 1234/10) 1.204471256531804) 
(num-test (tan 1234000000/3) -1.878094815124064721190472976913242128538E1) ; the ratio->float computation is inaccurate here I think
(num-test (tan 1234000000/500029) -7.31654379832009) 
(num-test (tan 1234000000/362880) 4.911576750502133) 
(num-test (tan 500029/2) .2804673425353792) 
(num-test (tan 500029/3) -1.173139817032177) 
(num-test (tan 500029/10) 3.767116303516932) 
(num-test (tan 500029/1234) -0.05562302342803592) 
(num-test (tan 362880/1234) -2.927532635052267) 
(num-test (tan pi) 6.982889851335445E-15) 
(num-test (tan 2.71828182845905) -0.4505495340698621) 
(num-test (tan 0.00000001+1234.0i) +8.077935669463161E-28+1.0i) 
(num-test (tan 0.00000001+1234000000.0i) 0.0+1.0i) 
(num-test (tan 3.14159265358979+0.0i) 6.982889851335445E-15) 
(num-test (tan 3.14159265358979+0.00000001i) +6.982889851335444E-15+1.0E-8i) 
(num-test (tan 3.14159265358979+1.0i) +2.932634567877868E-15+0.7615941559557649i) 
(num-test (tan 3.14159265358979+3.14159265358979i) +5.196631812627532E-17+0.99627207622075i) 
(num-test (tan 3.14159265358979+2.71828182845905i) +1.205734242765375E-16+0.991328915800599i) 
(num-test (tan 3.14159265358979+1234.0i) 0.0+1.0i) 
(num-test (tan 3.14159265358979+1234000000.0i) -7.703719777548943E-34+1.0i) 
(num-test (tan 2.71828182845905+0.0i) -0.4505495340698621) 
(num-test (tan 2.71828182845905+0.00000001i) -0.4505495340698621+1.2029948826505699E-8i) 
(num-test (tan 2.71828182845905+1.0i) -0.1692870118766369+0.8196826057997404i) 
(num-test (tan 2.71828182845905+3.14159265358979i) -0.002790687681003331+0.9975247319761639i) 
(num-test (tan 2.71828182845905+2.71828182845905i) -0.00648578276962794+0.9942257438545914i) 
(num-test (tan 2.71828182845905+1234.0i) +2.710505431213761E-20+1.0i) 
(num-test (tan 2.71828182845905+1234000000.0i) +2.710505431213761E-20+1.0i) 
(num-test (tan 1234.0+0.00000001i) -0.7537751984442328+1.5681770497896427E-8i) 
(num-test (tan 1234.0+3.14159265358979i) -0.003586791196867043+0.9989656315245496i) 
(num-test (tan 1234.0+2.71828182845905i) -0.008351965390936033+0.9975698313220817i) 
(num-test (tan 1234000000.0+0.00000001i) -6.212941995900324+3.9600648244422054E-7i) 
(num-test (tan 1234000000.0+3.14159265358979i) -0.001176098307980411+1.003551866736695i) 
(num-test (tan 1234000000.0+2.71828182845905i) -0.002755390838840499+1.008299558244272i) 
					;(num-test (tan 1.5707963259845+2.0630965522972e-18i) 1.234000079689074E+9+3.141593059344448i)
(num-test (tan -3.45266983001243932001e-04+0.0e+00i) -3.4526699672092183585e-4)
(num-test (tan 3.45266983001243932001e-04+0.0e+00i) 3.4526699672092183585e-4)
(num-test (tan -3.45266983001243932001e-04+1.19209289550781250e-07i) -3.4526699672091692931e-4+1.1920930376163652989e-7i)
(num-test (tan -3.45266983001243932001e-04-1.19209289550781250e-07i) -3.4526699672091692931e-4-1.1920930376163652989e-7i)
(num-test (tan 3.45266983001243932001e-04+1.19209289550781250e-07i) 3.4526699672091692931e-4+1.1920930376163652989e-7i)
(num-test (tan 3.45266983001243932001e-04-1.19209289550781250e-07i) 3.4526699672091692931e-4-1.1920930376163652989e-7i)
(num-test (tan -3.45266983001243932001e-04+5.0e-01i) -2.7153443992655805934e-4+4.6211720058436229979e-1i)
(num-test (tan -3.45266983001243932001e-04-5.0e-01i) -2.7153443992655805934e-4-4.6211720058436229979e-1i)
(num-test (tan 3.45266983001243932001e-04+5.0e-01i) 2.7153443992655805934e-4+4.6211720058436229979e-1i)
(num-test (tan 3.45266983001243932001e-04-5.0e-01i) 2.7153443992655805934e-4-4.6211720058436229979e-1i)
(num-test (tan -3.45266983001243932001e-04+1.0e+00i) -1.4500326960274960880e-4+7.6159419408485704836e-1i)
(num-test (tan -3.45266983001243932001e-04-1.0e+00i) -1.4500326960274960880e-4-7.6159419408485704836e-1i)
(num-test (tan 3.45266983001243932001e-04+1.0e+00i) 1.4500326960274960880e-4+7.6159419408485704836e-1i)
(num-test (tan 3.45266983001243932001e-04-1.0e+00i) 1.4500326960274960880e-4-7.6159419408485704836e-1i)
(num-test (tan -3.45266983001243932001e-04+2.0e+00i) -2.4393395410435306874e-5+9.6402758819508310556e-1i)
(num-test (tan -3.45266983001243932001e-04-2.0e+00i) -2.4393395410435306874e-5-9.6402758819508310556e-1i)
(num-test (tan 3.45266983001243932001e-04+2.0e+00i) 2.4393395410435306874e-5+9.6402758819508310556e-1i)
(num-test (tan 3.45266983001243932001e-04-2.0e+00i) 2.4393395410435306874e-5-9.6402758819508310556e-1i)
(num-test (tan 1.57045105981189525579e+00+0.0e+00i) 2.8963092606501007060e3)
(num-test (tan -1.57045105981189525579e+00+0.0e+00i) -2.8963092606501007060e3)
(num-test (tan 1.57045105981189525579e+00+1.19209289550781250e-07i) 2.8963089153831588642e3+9.9999992052646305569e-1i)
(num-test (tan 1.57045105981189525579e+00-1.19209289550781250e-07i) 2.8963089153831588642e3-9.9999992052646305569e-1i)
(num-test (tan -1.57045105981189525579e+00+1.19209289550781250e-07i) -2.8963089153831588642e3+9.9999992052646305569e-1i)
(num-test (tan -1.57045105981189525579e+00-1.19209289550781250e-07i) -2.8963089153831588642e3-9.9999992052646305569e-1i)
(num-test (tan 1.57045105981189525579e+00+5.0e-01i) 1.2715121175455623363e-3+2.1639524637389325996e0i)
(num-test (tan 1.57045105981189525579e+00-5.0e-01i) 1.2715121175455623363e-3-2.1639524637389325996e0i)
(num-test (tan -1.57045105981189525579e+00+5.0e-01i) -1.2715121175455623363e-3+2.1639524637389325996e0i)
(num-test (tan -1.57045105981189525579e+00-5.0e-01i) -1.2715121175455623363e-3-2.1639524637389325996e0i)
(num-test (tan 1.57045105981189525579e+00+1.0e+00i) 2.4999454374276273814e-4+1.3130351721648674823e0i)
(num-test (tan 1.57045105981189525579e+00-1.0e+00i) 2.4999454374276273814e-4-1.3130351721648674823e0i)
(num-test (tan -1.57045105981189525579e+00+1.0e+00i) -2.4999454374276273814e-4+1.3130351721648674823e0i)
(num-test (tan -1.57045105981189525579e+00-1.0e+00i) -2.4999454374276273814e-4-1.3130351721648674823e0i)
(num-test (tan 1.57045105981189525579e+00+2.0e+00i) 2.6247825506572821595e-5+1.0373147113268752620e0i)
(num-test (tan 1.57045105981189525579e+00-2.0e+00i) 2.6247825506572821595e-5-1.0373147113268752620e0i)
(num-test (tan -1.57045105981189525579e+00+2.0e+00i) -2.6247825506572821595e-5+1.0373147113268752620e0i)
(num-test (tan -1.57045105981189525579e+00-2.0e+00i) -2.6247825506572821595e-5-1.0373147113268752620e0i)
(num-test (tan 1.57114159377789786021e+00+0.0e+00i) -2.8963092606511280143e3)
(num-test (tan -1.57114159377789786021e+00+0.0e+00i) 2.8963092606511280143e3)
(num-test (tan 1.57114159377789786021e+00+1.19209289550781250e-07i) -2.8963089153841861720e3+9.9999992052717244672e-1i)
(num-test (tan 1.57114159377789786021e+00-1.19209289550781250e-07i) -2.8963089153841861720e3-9.9999992052717244672e-1i)
(num-test (tan -1.57114159377789786021e+00+1.19209289550781250e-07i) 2.8963089153841861720e3+9.9999992052717244672e-1i)
(num-test (tan -1.57114159377789786021e+00-1.19209289550781250e-07i) 2.8963089153841861720e3-9.9999992052717244672e-1i)
(num-test (tan 1.57114159377789786021e+00+5.0e-01i) -1.2715121175451113370e-3+2.1639524637389326002e0i)
(num-test (tan 1.57114159377789786021e+00-5.0e-01i) -1.2715121175451113370e-3-2.1639524637389326002e0i)
(num-test (tan -1.57114159377789786021e+00+5.0e-01i) 1.2715121175451113370e-3+2.1639524637389326002e0i)
(num-test (tan -1.57114159377789786021e+00-5.0e-01i) 1.2715121175451113370e-3-2.1639524637389326002e0i)
(num-test (tan 1.57114159377789786021e+00+1.0e+00i) -2.4999454374267406620e-4+1.3130351721648674824e0i)
(num-test (tan 1.57114159377789786021e+00-1.0e+00i) -2.4999454374267406620e-4-1.3130351721648674824e0i)
(num-test (tan -1.57114159377789786021e+00+1.0e+00i) 2.4999454374267406620e-4+1.3130351721648674824e0i)
(num-test (tan -1.57114159377789786021e+00-1.0e+00i) 2.4999454374267406620e-4-1.3130351721648674824e0i)
(num-test (tan 1.57114159377789786021e+00+2.0e+00i) -2.6247825506563511609e-5+1.0373147113268752620e0i)
(num-test (tan 1.57114159377789786021e+00-2.0e+00i) -2.6247825506563511609e-5-1.0373147113268752620e0i)
(num-test (tan -1.57114159377789786021e+00+2.0e+00i) 2.6247825506563511609e-5+1.0373147113268752620e0i)
(num-test (tan -1.57114159377789786021e+00-2.0e+00i) 2.6247825506563511609e-5-1.0373147113268752620e0i)
(num-test (tan 3.14124738660679181379e+00+0.0e+00i) -3.4526699672110257641e-4)
(num-test (tan -3.14124738660679181379e+00+0.0e+00i) 3.4526699672110257641e-4)
(num-test (tan 3.14124738660679181379e+00+1.19209289550781250e-07i) -3.4526699672109766987e-4+1.1920930376163652991e-7i)
(num-test (tan 3.14124738660679181379e+00-1.19209289550781250e-07i) -3.4526699672109766987e-4-1.1920930376163652991e-7i)
(num-test (tan -3.14124738660679181379e+00+1.19209289550781250e-07i) 3.4526699672109766987e-4+1.1920930376163652991e-7i)
(num-test (tan -3.14124738660679181379e+00-1.19209289550781250e-07i) 3.4526699672109766987e-4-1.1920930376163652991e-7i)
(num-test (tan 3.14124738660679181379e+00+5.0e-01i) -2.7153443992670020234e-4+4.6211720058436229984e-1i)
(num-test (tan 3.14124738660679181379e+00-5.0e-01i) -2.7153443992670020234e-4-4.6211720058436229984e-1i)
(num-test (tan -3.14124738660679181379e+00+5.0e-01i) 2.7153443992670020234e-4+4.6211720058436229984e-1i)
(num-test (tan -3.14124738660679181379e+00-5.0e-01i) 2.7153443992670020234e-4-4.6211720058436229984e-1i)
(num-test (tan 3.14124738660679181379e+00+1.0e+00i) -1.4500326960282551519e-4+7.6159419408485704840e-1i)
(num-test (tan 3.14124738660679181379e+00-1.0e+00i) -1.4500326960282551519e-4-7.6159419408485704840e-1i)
(num-test (tan -3.14124738660679181379e+00+1.0e+00i) 1.4500326960282551519e-4+7.6159419408485704840e-1i)
(num-test (tan -3.14124738660679181379e+00-1.0e+00i) 1.4500326960282551519e-4-7.6159419408485704840e-1i)
(num-test (tan 3.14124738660679181379e+00+2.0e+00i) -2.4393395410448076340e-5+9.6402758819508310557e-1i)
(num-test (tan 3.14124738660679181379e+00-2.0e+00i) -2.4393395410448076340e-5-9.6402758819508310557e-1i)
(num-test (tan -3.14124738660679181379e+00+2.0e+00i) 2.4393395410448076340e-5+9.6402758819508310557e-1i)
(num-test (tan -3.14124738660679181379e+00-2.0e+00i) 2.4393395410448076340e-5-9.6402758819508310557e-1i)
(num-test (tan 3.14193792057279441821e+00+0.0e+00i) 3.4526699672085764703e-4)
(num-test (tan -3.14193792057279441821e+00+0.0e+00i) -3.4526699672085764703e-4)
(num-test (tan 3.14193792057279441821e+00+1.19209289550781250e-07i) 3.4526699672085274049e-4+1.1920930376163652989e-7i)
(num-test (tan 3.14193792057279441821e+00-1.19209289550781250e-07i) 3.4526699672085274049e-4-1.1920930376163652989e-7i)
(num-test (tan -3.14193792057279441821e+00+1.19209289550781250e-07i) -3.4526699672085274049e-4+1.1920930376163652989e-7i)
(num-test (tan -3.14193792057279441821e+00-1.19209289550781250e-07i) -3.4526699672085274049e-4-1.1920930376163652989e-7i)
(num-test (tan 3.14193792057279441821e+00+5.0e-01i) 2.7153443992650757820e-4+4.6211720058436229978e-1i)
(num-test (tan 3.14193792057279441821e+00-5.0e-01i) 2.7153443992650757820e-4-4.6211720058436229978e-1i)
(num-test (tan -3.14193792057279441821e+00+5.0e-01i) -2.7153443992650757820e-4+4.6211720058436229978e-1i)
(num-test (tan -3.14193792057279441821e+00-5.0e-01i) -2.7153443992650757820e-4-4.6211720058436229978e-1i)
(num-test (tan 3.14193792057279441821e+00+1.0e+00i) 1.4500326960272265115e-4+7.6159419408485704835e-1i)
(num-test (tan 3.14193792057279441821e+00-1.0e+00i) 1.4500326960272265115e-4-7.6159419408485704835e-1i)
(num-test (tan -3.14193792057279441821e+00+1.0e+00i) -1.4500326960272265115e-4+7.6159419408485704835e-1i)
(num-test (tan -3.14193792057279441821e+00-1.0e+00i) -1.4500326960272265115e-4-7.6159419408485704835e-1i)
(num-test (tan 3.14193792057279441821e+00+2.0e+00i) 2.4393395410430771882e-5+9.6402758819508310556e-1i)
(num-test (tan 3.14193792057279441821e+00-2.0e+00i) 2.4393395410430771882e-5-9.6402758819508310556e-1i)
(num-test (tan -3.14193792057279441821e+00+2.0e+00i) -2.4393395410430771882e-5+9.6402758819508310556e-1i)
(num-test (tan -3.14193792057279441821e+00-2.0e+00i) -2.4393395410430771882e-5-9.6402758819508310556e-1i)
(num-test (tan 4.71204371340168837179e+00+0.0e+00i) 2.8963092606490733978e3)
(num-test (tan -4.71204371340168837179e+00+0.0e+00i) -2.8963092606490733978e3)
(num-test (tan 4.71204371340168837179e+00+1.19209289550781250e-07i) 2.8963089153821315563e3+9.9999992052575366466e-1i)
(num-test (tan 4.71204371340168837179e+00-1.19209289550781250e-07i) 2.8963089153821315563e3-9.9999992052575366466e-1i)
(num-test (tan -4.71204371340168837179e+00+1.19209289550781250e-07i) -2.8963089153821315563e3+9.9999992052575366466e-1i)
(num-test (tan -4.71204371340168837179e+00-1.19209289550781250e-07i) -2.8963089153821315563e3-9.9999992052575366466e-1i)
(num-test (tan 4.71204371340168837179e+00+5.0e-01i) 1.2715121175460133355e-3+2.1639524637389325989e0i)
(num-test (tan 4.71204371340168837179e+00-5.0e-01i) 1.2715121175460133355e-3-2.1639524637389325989e0i)
(num-test (tan -4.71204371340168837179e+00+5.0e-01i) -1.2715121175460133355e-3+2.1639524637389325989e0i)
(num-test (tan -4.71204371340168837179e+00-5.0e-01i) -1.2715121175460133355e-3-2.1639524637389325989e0i)
(num-test (tan 4.71204371340168837179e+00+1.0e+00i) 2.4999454374285141007e-4+1.3130351721648674822e0i)
(num-test (tan 4.71204371340168837179e+00-1.0e+00i) 2.4999454374285141007e-4-1.3130351721648674822e0i)
(num-test (tan -4.71204371340168837179e+00+1.0e+00i) -2.4999454374285141007e-4+1.3130351721648674822e0i)
(num-test (tan -4.71204371340168837179e+00-1.0e+00i) -2.4999454374285141007e-4-1.3130351721648674822e0i)
(num-test (tan 4.71204371340168837179e+00+2.0e+00i) 2.6247825506582131582e-5+1.0373147113268752620e0i)
(num-test (tan 4.71204371340168837179e+00-2.0e+00i) 2.6247825506582131582e-5-1.0373147113268752620e0i)
(num-test (tan -4.71204371340168837179e+00+2.0e+00i) -2.6247825506582131582e-5+1.0373147113268752620e0i)
(num-test (tan -4.71204371340168837179e+00-2.0e+00i) -2.6247825506582131582e-5-1.0373147113268752620e0i)
(num-test (tan 4.71273424736769097620e+00+0.0e+00i) -2.8963092606521553225e3)
(num-test (tan -4.71273424736769097620e+00+0.0e+00i) 2.8963092606521553225e3)
(num-test (tan 4.71273424736769097620e+00+1.19209289550781250e-07i) -2.8963089153852134799e3+9.9999992052788183776e-1i)
(num-test (tan 4.71273424736769097620e+00-1.19209289550781250e-07i) -2.8963089153852134799e3-9.9999992052788183776e-1i)
(num-test (tan -4.71273424736769097620e+00+1.19209289550781250e-07i) 2.8963089153852134799e3+9.9999992052788183776e-1i)
(num-test (tan -4.71273424736769097620e+00-1.19209289550781250e-07i) 2.8963089153852134799e3-9.9999992052788183776e-1i)
(num-test (tan 4.71273424736769097620e+00+5.0e-01i) -1.2715121175446603377e-3+2.1639524637389326009e0i)
(num-test (tan 4.71273424736769097620e+00-5.0e-01i) -1.2715121175446603377e-3-2.1639524637389326009e0i)
(num-test (tan -4.71273424736769097620e+00+5.0e-01i) 1.2715121175446603377e-3+2.1639524637389326009e0i)
(num-test (tan -4.71273424736769097620e+00-5.0e-01i) 1.2715121175446603377e-3-2.1639524637389326009e0i)
(num-test (tan 4.71273424736769097620e+00+1.0e+00i) -2.4999454374258539427e-4+1.3130351721648674825e0i)
(num-test (tan 4.71273424736769097620e+00-1.0e+00i) -2.4999454374258539427e-4-1.3130351721648674825e0i)
(num-test (tan -4.71273424736769097620e+00+1.0e+00i) 2.4999454374258539427e-4+1.3130351721648674825e0i)
(num-test (tan -4.71273424736769097620e+00-1.0e+00i) 2.4999454374258539427e-4-1.3130351721648674825e0i)
(num-test (tan 4.71273424736769097620e+00+2.0e+00i) -2.6247825506554201622e-5+1.0373147113268752620e0i)
(num-test (tan 4.71273424736769097620e+00-2.0e+00i) -2.6247825506554201622e-5-1.0373147113268752620e0i)
(num-test (tan -4.71273424736769097620e+00+2.0e+00i) 2.6247825506554201622e-5+1.0373147113268752620e0i)
(num-test (tan -4.71273424736769097620e+00-2.0e+00i) 2.6247825506554201622e-5-1.0373147113268752620e0i)
(num-test (tan 6.28284004019658492979e+00+0.0e+00i) -3.4526699672122504111e-4)
(num-test (tan -6.28284004019658492979e+00+0.0e+00i) 3.4526699672122504111e-4)
(num-test (tan 6.28284004019658492979e+00+1.19209289550781250e-07i) -3.4526699672122013457e-4+1.1920930376163652992e-7i)
(num-test (tan 6.28284004019658492979e+00-1.19209289550781250e-07i) -3.4526699672122013457e-4-1.1920930376163652992e-7i)
(num-test (tan -6.28284004019658492979e+00+1.19209289550781250e-07i) 3.4526699672122013457e-4+1.1920930376163652992e-7i)
(num-test (tan -6.28284004019658492979e+00-1.19209289550781250e-07i) 3.4526699672122013457e-4-1.1920930376163652992e-7i)
(num-test (tan 6.28284004019658492979e+00+5.0e-01i) -2.7153443992679651442e-4+4.6211720058436229987e-1i)
(num-test (tan 6.28284004019658492979e+00-5.0e-01i) -2.7153443992679651442e-4-4.6211720058436229987e-1i)
(num-test (tan -6.28284004019658492979e+00+5.0e-01i) 2.7153443992679651442e-4+4.6211720058436229987e-1i)
(num-test (tan -6.28284004019658492979e+00-5.0e-01i) 2.7153443992679651442e-4-4.6211720058436229987e-1i)
(num-test (tan 6.28284004019658492979e+00+1.0e+00i) -1.4500326960287694721e-4+7.6159419408485704843e-1i)
(num-test (tan 6.28284004019658492979e+00-1.0e+00i) -1.4500326960287694721e-4-7.6159419408485704843e-1i)
(num-test (tan -6.28284004019658492979e+00+1.0e+00i) 1.4500326960287694721e-4+7.6159419408485704843e-1i)
(num-test (tan -6.28284004019658492979e+00-1.0e+00i) 1.4500326960287694721e-4-7.6159419408485704843e-1i)
(num-test (tan 6.28284004019658492979e+00+2.0e+00i) -2.4393395410456728569e-5+9.6402758819508310558e-1i)
(num-test (tan 6.28284004019658492979e+00-2.0e+00i) -2.4393395410456728569e-5-9.6402758819508310558e-1i)
(num-test (tan -6.28284004019658492979e+00+2.0e+00i) 2.4393395410456728569e-5+9.6402758819508310558e-1i)
(num-test (tan -6.28284004019658492979e+00-2.0e+00i) 2.4393395410456728569e-5-9.6402758819508310558e-1i)
(num-test (tan 6.28353057416258753420e+00+0.0e+00i) 3.4526699672073518233e-4)
(num-test (tan -6.28353057416258753420e+00+0.0e+00i) -3.4526699672073518233e-4)
(num-test (tan 6.28353057416258753420e+00+1.19209289550781250e-07i) 3.4526699672073027579e-4+1.1920930376163652988e-7i)
(num-test (tan 6.28353057416258753420e+00-1.19209289550781250e-07i) 3.4526699672073027579e-4-1.1920930376163652988e-7i)
(num-test (tan -6.28353057416258753420e+00+1.19209289550781250e-07i) -3.4526699672073027579e-4+1.1920930376163652988e-7i)
(num-test (tan -6.28353057416258753420e+00-1.19209289550781250e-07i) -3.4526699672073027579e-4-1.1920930376163652988e-7i)
(num-test (tan 6.28353057416258753420e+00+5.0e-01i) 2.7153443992641126612e-4+4.6211720058436229974e-1i)
(num-test (tan 6.28353057416258753420e+00-5.0e-01i) 2.7153443992641126612e-4-4.6211720058436229974e-1i)
(num-test (tan -6.28353057416258753420e+00+5.0e-01i) -2.7153443992641126612e-4+4.6211720058436229974e-1i)
(num-test (tan -6.28353057416258753420e+00-5.0e-01i) -2.7153443992641126612e-4-4.6211720058436229974e-1i)
(num-test (tan 6.28353057416258753420e+00+1.0e+00i) 1.4500326960267121913e-4+7.6159419408485704832e-1i)
(num-test (tan 6.28353057416258753420e+00-1.0e+00i) 1.4500326960267121913e-4-7.6159419408485704832e-1i)
(num-test (tan -6.28353057416258753420e+00+1.0e+00i) -1.4500326960267121913e-4+7.6159419408485704832e-1i)
(num-test (tan -6.28353057416258753420e+00-1.0e+00i) -1.4500326960267121913e-4-7.6159419408485704832e-1i)
(num-test (tan 6.28353057416258753420e+00+2.0e+00i) 2.4393395410422119654e-5+9.6402758819508310555e-1i)
(num-test (tan 6.28353057416258753420e+00-2.0e+00i) 2.4393395410422119654e-5-9.6402758819508310555e-1i)
(num-test (tan -6.28353057416258753420e+00+2.0e+00i) -2.4393395410422119654e-5+9.6402758819508310555e-1i)
(num-test (tan -6.28353057416258753420e+00-2.0e+00i) -2.4393395410422119654e-5-9.6402758819508310555e-1i)
(num-test (tan 9.42443269378637893396e+00+0.0e+00i) -3.4526699672045932728e-4)
(num-test (tan -9.42443269378637893396e+00+0.0e+00i) 3.4526699672045932728e-4)
(num-test (tan 9.42443269378637893396e+00+1.19209289550781250e-07i) -3.4526699672045442074e-4+1.1920930376163652985e-7i)
(num-test (tan 9.42443269378637893396e+00-1.19209289550781250e-07i) -3.4526699672045442074e-4-1.1920930376163652985e-7i)
(num-test (tan -9.42443269378637893396e+00+1.19209289550781250e-07i) 3.4526699672045442074e-4+1.1920930376163652985e-7i)
(num-test (tan -9.42443269378637893396e+00-1.19209289550781250e-07i) 3.4526699672045442074e-4-1.1920930376163652985e-7i)
(num-test (tan 9.42443269378637893396e+00+5.0e-01i) -2.7153443992619432056e-4+4.6211720058436229968e-1i)
(num-test (tan 9.42443269378637893396e+00-5.0e-01i) -2.7153443992619432056e-4-4.6211720058436229968e-1i)
(num-test (tan -9.42443269378637893396e+00+5.0e-01i) 2.7153443992619432056e-4+4.6211720058436229968e-1i)
(num-test (tan -9.42443269378637893396e+00-5.0e-01i) 2.7153443992619432056e-4-4.6211720058436229968e-1i)
(num-test (tan 9.42443269378637893396e+00+1.0e+00i) -1.4500326960255536711e-4+7.6159419408485704826e-1i)
(num-test (tan 9.42443269378637893396e+00-1.0e+00i) -1.4500326960255536711e-4-7.6159419408485704826e-1i)
(num-test (tan -9.42443269378637893396e+00+1.0e+00i) 1.4500326960255536711e-4+7.6159419408485704826e-1i)
(num-test (tan -9.42443269378637893396e+00-1.0e+00i) 1.4500326960255536711e-4-7.6159419408485704826e-1i)
(num-test (tan 9.42443269378637893396e+00+2.0e+00i) -2.4393395410402630273e-5+9.6402758819508310554e-1i)
(num-test (tan 9.42443269378637893396e+00-2.0e+00i) -2.4393395410402630273e-5-9.6402758819508310554e-1i)
(num-test (tan -9.42443269378637893396e+00+2.0e+00i) 2.4393395410402630273e-5+9.6402758819508310554e-1i)
(num-test (tan -9.42443269378637893396e+00-2.0e+00i) 2.4393395410402630273e-5-9.6402758819508310554e-1i)
(num-test (tan 9.42512322775237976202e+00+0.0e+00i) 3.4526699671972453911e-4)
(num-test (tan -9.42512322775237976202e+00+0.0e+00i) -3.4526699671972453911e-4)
(num-test (tan 9.42512322775237976202e+00+1.19209289550781250e-07i) 3.4526699671971963257e-4+1.1920930376163652979e-7i)
(num-test (tan 9.42512322775237976202e+00-1.19209289550781250e-07i) 3.4526699671971963257e-4-1.1920930376163652979e-7i)
(num-test (tan -9.42512322775237976202e+00+1.19209289550781250e-07i) -3.4526699671971963257e-4+1.1920930376163652979e-7i)
(num-test (tan -9.42512322775237976202e+00-1.19209289550781250e-07i) -3.4526699671971963257e-4-1.1920930376163652979e-7i)
(num-test (tan 9.42512322775237976202e+00+5.0e-01i) 2.7153443992561644811e-4+4.6211720058436229949e-1i)
(num-test (tan 9.42512322775237976202e+00-5.0e-01i) 2.7153443992561644811e-4-4.6211720058436229949e-1i)
(num-test (tan -9.42512322775237976202e+00+5.0e-01i) -2.7153443992561644811e-4+4.6211720058436229949e-1i)
(num-test (tan -9.42512322775237976202e+00-5.0e-01i) -2.7153443992561644811e-4-4.6211720058436229949e-1i)
(num-test (tan 9.42512322775237976202e+00+1.0e+00i) 1.450032696022467750e-4+7.6159419408485704810e-1i)
(num-test (tan 9.42512322775237976202e+00-1.0e+00i) 1.450032696022467750e-4-7.6159419408485704810e-1i)
(num-test (tan -9.42512322775237976202e+00+1.0e+00i) -1.450032696022467750e-4+7.6159419408485704810e-1i)
(num-test (tan -9.42512322775237976202e+00-1.0e+00i) -1.450032696022467750e-4-7.6159419408485704810e-1i)
(num-test (tan 9.42512322775237976202e+00+2.0e+00i) 2.439339541035071690e-5+9.6402758819508310550e-1i)
(num-test (tan 9.42512322775237976202e+00-2.0e+00i) 2.439339541035071690e-5-9.6402758819508310550e-1i)
(num-test (tan -9.42512322775237976202e+00+2.0e+00i) -2.439339541035071690e-5+9.6402758819508310550e-1i)
(num-test (tan -9.42512322775237976202e+00-2.0e+00i) -2.439339541035071690e-5-9.6402758819508310550e-1i)
(num-test (tan 32767.) 1.9089234430221485740826E-1)
(num-test (tan 8388607.) -8.0354556223613614748329E0)
(num-test (tan 2147483647.) 1.0523779637351339136698E0)
(num-test (tan -2.225073858507201399999999999999999999996E-308) -2.225073858507201399999999999999999999996E-308)
(num-test (tan 1.110223024625156799999999999999999999997E-16) 1.110223024625156800000000000000004561517E-16)
(num-test (tan (* 1/4 (atan 4))) (* 2 (+ (cos (/ (* 6 pi) 17)) (cos (/ (* 10 pi) 17)))))
(num-test (tan (/ pi 10)) (/ (sqrt (- 25 (* 10 (sqrt 5)))) 5))
(num-test (tan (/ pi 12)) (- 2 (sqrt 3)))
(num-test (tan (/ pi 12)) (- 2 (sqrt 3)))
(num-test (tan (/ pi 16)) (- (sqrt (+ 4 (* 2 (sqrt 2)))) (sqrt 2) 1))
(num-test (tan (/ pi 20)) (+ 1 (sqrt 5) (- (sqrt (+ 5 (* 2 (sqrt 5)))))))
(num-test (tan (/ pi 24)) (+ -2 (sqrt 2) (- (sqrt 3)) (sqrt 6)))
(num-test (tan (/ pi 3)) (sqrt 3))
(num-test (tan (/ pi 3)) (sqrt 3))
(num-test (tan (/ pi 30)) (sqrt (- 7 (* 2 (sqrt 5)) (* 2 (sqrt (- 15 (* 6 (sqrt 5))))))))
(num-test (tan (/ pi 4)) 1)
(num-test (tan (/ pi 4)) 1.0)
(num-test (tan (/ pi 4)) 1.0)
(num-test (tan (/ pi 5)) (sqrt (- 5 (* 2 (sqrt 5)))))
(num-test (tan (/ pi 6)) (/ (sqrt 3) 3))
(num-test (tan (/ pi 6)) (/ (sqrt 3)))
(num-test (tan (/ pi 8)) (- (sqrt 2) 1))
(num-test (* (tan (/ pi 11)) (tan (/ (* 2 pi) 11)) (tan (/ (* 3 pi) 11)) (tan (/ (* 4 pi) 11)) (tan (/ (* 5 pi) 11))) (sqrt 11))
(num-test (* (tan (/ pi 9)) (tan (/ (* 2 pi) 9)) (tan (/ (* 4 pi) 9))) (sqrt 3))
(num-test (tan 0-1000i) 0-i)
(num-test (tan 0+1000i) 0+i)
(num-test (tan (complex 0 inf.0)) 0+i)

(when with-bignums
  (letrec ((sum-cot (lambda (n)
		      (let ((sum 0.0))
			(do ((k 1 (+ k 1)))
			    ((= k n) sum)
			  (set! sum (+ sum (sin (/ (* k pi) n)))))))))
    (let ((mxerr 0.0)
	  (mxcase 0))
      (do ((i 2 (+ i 1)))
	  ((= i 100))
	(let ((val1 (sum-cot i))
	      (val2 (/ 1.0 (tan (/ pi (* 2 i))))))
	  (let ((err (magnitude (- val1 val2))))
	    (if (> err mxerr)
		(begin
		  (set! mxerr err)
		  (set! mxcase i))))))
      (if (> mxerr 1e-35)
	  (format #t "sum-cot max error ~A at ~A~%" mxerr mxcase)))))

(for-each
 (lambda (num-and-val)
   (let ((num (car num-and-val)) (val (cadr num-and-val))) (num-test-1 'tan num (tan num) val)))
 (vector (list 0 0) (list 1 1.5574077246549) (list 2 -2.1850398632615) (list 3 -0.14254654307428) 
	 (list -1 -1.5574077246549) (list -2 2.1850398632615) (list -3 0.14254654307428) 
	 (list 1/2 0.54630248984379) 
	 (list 1/3 0.34625354951058) (list -1/2 -0.54630248984379) (list -1/3 -0.34625354951058) 
	 (list 1/9223372036854775807 1.0842021724855e-19) (list 0.0 0.0) (list 1.0 1.5574077246549) 
	 (list 2.0 -2.1850398632615) (list -2.0 2.1850398632615) (list 1.000000000000000000000000000000000000002E-309 1.000000000000000000000000000000000000002E-309) 
	 (list 0+1i 0+0.76159415595576i) 
	 (list 0+2i 0+0.96402758007582i) (list 0-1i 0-0.76159415595576i) (list 1+1i 0.27175258531951+1.0839233273387i) 
	 (list 1-1i 0.27175258531951-1.0839233273387i) (list -1+1i -0.27175258531951+1.0839233273387i) 
	 (list -1-1i -0.27175258531951-1.0839233273387i) (list 0.1+0.1i 0.099328043521656+0.10066129051146i) 
	 (list 1e+16+1e+16i 0+1i) (list 1e-16+1e-16i 1e-16+1e-16i) ))

(when with-bignums
  (let-temporarily (((*s7* 'bignum-precision) 500))
    (let ((tans (list ; table[Tan[k/10], {k, 0, 30}]
		 0.00000000000000000000000000000000000000000000000000000000000000000000e0
		 0.10033467208545054505808004578111153681900480457644204002220806579803
		 0.20271003550867248332135827164753448262687566965163133004781996689038
		 0.30933624960962323303530367969829466725781590680046134075142272636569
		 0.42279321873816176198163542716529033394198977271569358984733094139266
		 0.54630248984379051325517946578028538329755172017979124616409138593290
		 0.68413680834169231707092541746333574524265408075678204603738401651742
		 0.84228838046307944812813500221293771718722125080419899879692251366850
		 1.02963855705036401274636117282036528416821960677230780766895721581894
		 1.26015821755033913713457548539574847783362583439629440734976898386523
		 1.55740772465490223050697480745836017308725077238152003838394660569886
		 1.96475965724865195093092278177937824371908489378986426895526379547792
		 2.57215162212631893540999423603336395652940930604338927922563726223880
		 3.60210244796797815123114551507651373970302582865487479569579648938869
		 5.79788371548288964370772024360369904599369751893967972517934732424182
		 14.10141994717171938764608365198775644565954357723586186612326758608969
		 -34.23253273555741705801487543047619090177569941115323597430813746321248
		 -7.69660213945915841412819296829866091636528991430764756294574142318097
		 -4.28626167462806352545188895228026668020736003385824824436108662437549
		 -2.92709751467777270368689918927087330066328793602580283437505670792996
		 -2.18503986326151899164330610231368254343201774622766316456295586996677
		 -1.70984654290450774834778079380390375776090098123394621314534682027235
		 -1.37382305676879516014003676333346987430263329223370049420804295416122
		 -1.11921364173413217123235669407622790313829418580200248125375565107236
		 -0.91601428967341051273086324750810579399364554997699617941685909082222
		 -0.74702229723866027935535268782527455790411695688301127906659308970027
		 -0.60159661308975872273608189269127978293417758666969145078057164875561
		 -0.47272762910303750795198918126389516105797171531608327694222778882857
		 -0.35552983165117587757735260363543503816953711960914396739605909199266
		 -0.24640539397196625534356707388530576476208894415934539659747894722272
		 -0.14254654307427780529563541053391349322609228490180464763323897668885)))
      (do ((i 0 (+ i 1)))
	  ((= i 30))
	(let ((val (tan (/ i (bignum "10")))))
	  (if (> (magnitude (- val (list-ref tans i))) 1e-35)
	      (format #t ";(tan ~A) -> ~A ~A~%[~A]~%" (/ i 10) val (list-ref tans i) (magnitude (- val (list-ref tans i))))))))))

(test (tan) 'error)
(test (tan "hi") 'error)
(test (tan 1.0+23.0i 1.0+23.0i) 'error)
(test (tan 0 1) 'error)

(for-each
 (lambda (arg)
   (test (tan arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))



;;; --------------------------------------------------------------------------------
;;; asin
;;; --------------------------------------------------------------------------------

(num-test (asin 0) 0.0)
(num-test (asin 1) 1.57079632679490)
(num-test (asin -1) -1.57079632679490)
(num-test (asin 2) 1.57079632679490+1.31695789692482i)
(num-test (asin -2) -1.57079632679490+1.31695789692482i)
(num-test (asin 3) 1.57079632679490+1.76274717403909i)
(num-test (asin -3) -1.57079632679490+1.76274717403909i)
(num-test (asin 10) 1.57079632679490+2.99322284612638i)
(num-test (asin -10) -1.57079632679490+2.99322284612638i)
(num-test (asin 1234) 1.57079632679490+7.81116322068415i)
(num-test (asin -1234) -1.57079632679490+7.81116322068415i)
(num-test (asin 0/1) 0.0)
(num-test (asin 0/2) 0.0)
(num-test (asin 0/3) 0.0)
(num-test (asin 0/10) 0.0)
(num-test (asin 0/1234) 0.0)
(num-test (asin 0/1234000000) 0.0)
(num-test (asin 0/500029) 0.0)
(num-test (asin 0/362880) 0.0)
(num-test (asin 1/1) 1.57079632679490)
(num-test (asin -1/1) -1.57079632679490)
(num-test (asin 1/2) 0.52359877559830)
(num-test (asin -1/2) -0.52359877559830)
(num-test (asin 1/3) 0.33983690945412)
(num-test (asin -1/3) -0.33983690945412)
(num-test (asin 1/10) 0.10016742116156)
(num-test (asin -1/10) -0.10016742116156)
(num-test (asin 1/1234) 0.00081037286017)
(num-test (asin -1/1234) -0.00081037286017)
(num-test (asin 1/1234000000) 0.00000000081037)
(num-test (asin -1/1234000000) -0.00000000081037)
(num-test (asin 1/500029) 0.00000199988401)
(num-test (asin -1/500029) -0.00000199988401)
(num-test (asin 1/362880) 0.00000275573192)
(num-test (asin -1/362880) -0.00000275573192)
(num-test (asin 2/1) 1.57079632679490+1.31695789692482i)
(num-test (asin -2/1) -1.57079632679490+1.31695789692482i)
(num-test (asin 2/2) 1.57079632679490)
(num-test (asin -2/2) -1.57079632679490)
(num-test (asin 2/3) 0.72972765622697)
(num-test (asin -2/3) -0.72972765622697)
(num-test (asin 2/10) 0.20135792079033)
(num-test (asin -2/10) -0.20135792079033)
(num-test (asin 2/1234) 0.00162074625252)
(num-test (asin -2/1234) -0.00162074625252)
(num-test (asin 2/1234000000) 0.00000000162075)
(num-test (asin -2/1234000000) -0.00000000162075)
(num-test (asin 2/500029) 0.00000399976801)
(num-test (asin -2/500029) -0.00000399976801)
(num-test (asin 2/362880) 0.00000551146384)
(num-test (asin -2/362880) -0.00000551146384)
(num-test (asin 3/1) 1.57079632679490+1.76274717403909i)
(num-test (asin -3/1) -1.57079632679490+1.76274717403909i)
(num-test (asin 3/2) 1.57079632679490+0.96242365011921i)
(num-test (asin -3/2) -1.57079632679490+0.96242365011921i)
(num-test (asin 3/3) 1.57079632679490)
(num-test (asin -3/3) -1.57079632679490)
(num-test (asin 3/10) 0.30469265401540)
(num-test (asin -3/10) -0.30469265401540)
(num-test (asin 3/1234) 0.00243112070922)
(num-test (asin -3/1234) -0.00243112070922)
(num-test (asin 3/1234000000) 0.00000000243112)
(num-test (asin -3/1234000000) -0.00000000243112)
(num-test (asin 3/500029) 0.00000599965202)
(num-test (asin -3/500029) -0.00000599965202)
(num-test (asin 3/362880) 0.00000826719577)
(num-test (asin -3/362880) -0.00000826719577)
(num-test (asin 10/1) 1.57079632679490+2.99322284612638i)
(num-test (asin -10/1) -1.57079632679490+2.99322284612638i)
(num-test (asin 10/2) 1.57079632679490+2.29243166956117i)
(num-test (asin -10/2) -1.57079632679490+2.29243166956117i)
(num-test (asin 10/3) 1.57079632679490+1.87382024252741i)
(num-test (asin -10/3) -1.57079632679490+1.87382024252741i)
(num-test (asin 10/10) 1.57079632679490)
(num-test (asin -10/10) -1.57079632679490)
(num-test (asin 10/1234) 0.00810381641321)
(num-test (asin -10/1234) -0.00810381641321)
(num-test (asin 10/1234000000) 0.00000000810373)
(num-test (asin -10/1234000000) -0.00000000810373)
(num-test (asin 10/500029) 0.00001999884007)
(num-test (asin -10/500029) -0.00001999884007)
(num-test (asin 10/362880) 0.00002755731923)
(num-test (asin -10/362880) -0.00002755731923)
(num-test (asin 1234/1) 1.57079632679490+7.81116322068415i)
(num-test (asin -1234/1) -1.57079632679490+7.81116322068415i)
(num-test (asin 1234/2) 1.57079632679490+7.11801554770806i)
(num-test (asin -1234/2) -1.57079632679490+7.11801554770806i)
(num-test (asin 1234/3) 1.57079632679490+6.71254961876657i)
(num-test (asin -1234/3) -1.57079632679490+6.71254961876657i)
(num-test (asin 1234/10) 1.57079632679490+5.50856187402751i)
(num-test (asin -1234/10) -1.57079632679490+5.50856187402751i)
(num-test (asin 1234/1234) 1.57079632679490)
(num-test (asin -1234/1234) -1.57079632679490)
(num-test (asin 1234/1234000000) 0.00000100000000)
(num-test (asin -1234/1234000000) -0.00000100000000)
(num-test (asin 1234/500029) 0.00246785936931)
(num-test (asin -1234/500029) -0.00246785936931)
(num-test (asin 1234/362880) 0.00340057974625)
(num-test (asin -1234/362880) -0.00340057974625)
(num-test (asin 1234000000/1234000000) 1.57079632679490)
(num-test (asin -1234000000/1234000000) -1.57079632679490)
(num-test (asin 1234000000/500029) 1.57079632679490+8.50425252675189i)
(num-test (asin -1234000000/500029) -1.57079632679490+8.50425252675189i)
(num-test (asin 1234000000/362880) 1.57079632679490+8.82484644053502i)
(num-test (asin -1234000000/362880) -1.57079632679490+8.82484644053502i)
(num-test (asin 500029/3) 1.570796326794897-12.71695626760523i)
(num-test (asin -500029/3) -1.570796326794897+12.71695626760523i)
(num-test (asin 500029/10) 1.570796326794897-1.151298346318831e1i)
(num-test (asin -500029/10) -1.57079632679490+1.151298346318831e1i)
(num-test (asin 500029/1234) 1.57079632679490+6.69755082925184i)
(num-test (asin -500029/1234) -1.57079632679490+6.69755082925184i)
(num-test (asin 500029/1234000000) 0.00040520989764)
(num-test (asin -500029/1234000000) -0.00040520989764)
(num-test (asin 500029/500029) 1.57079632679490)
(num-test (asin -500029/500029) -1.57079632679490)
(num-test (asin 500029/362880) 1.57079632679490+0.84413377868249i)
(num-test (asin -500029/362880) -1.57079632679490+0.84413377868249i)
(num-test (asin 362880/2) 1.570796326794896619231321691639751442098E0-1.280182748007387555277950474671339683536E1i)
(num-test (asin -362880/2) -1.570796326794897+12.80182748007388i)
(num-test (asin 362880/3) 1.570796326794896619231321691639751442098E0-1.239636237195621859776598192721440899765E1i)
(num-test (asin -362880/3) -1.570796326794897+12.39636237195622i)
(num-test (asin 362880/10) 1.570796326794897-1.119238956745752e1i)
(num-test (asin -362880/10) -1.57079632679490+1.119238956745752e1i)
(num-test (asin 362880/1234) 1.57079632679490+6.37695556516894i)
(num-test (asin -362880/1234) -1.57079632679490+6.37695556516894i)
(num-test (asin 362880/1234000000) 0.00029406807555)
(num-test (asin -362880/1234000000) -0.00029406807555)
(num-test (asin 362880/500029) 0.81207730383580)
(num-test (asin -362880/500029) -0.81207730383580)
(num-test (asin 362880/362880) 1.57079632679490)
(num-test (asin -362880/362880) -1.57079632679490)
(num-test (asin 0.0) 0.0)
(num-test (asin 0.00000001) 0.00000001)
(num-test (asin -0.00000001) -0.00000001)
(num-test (asin 1.0) 1.57079632679490)
(num-test (asin -1.0) -1.57079632679490)
(num-test (asin pi) 1.57079632679490+1.81152627246085i)
(num-test (asin -3.14159265358979) -1.57079632679490+1.81152627246085i)
(num-test (asin 2.71828182845905) 1.57079632679490+1.65745445415308i)
(num-test (asin -2.71828182845905) -1.57079632679490+1.65745445415308i)
(num-test (asin 1234.0) 1.57079632679490+7.81116322068415i)
(num-test (asin -1234.0) -1.57079632679490+7.81116322068415i)
(num-test (asin 0.0+0.0i) 0.0)
(num-test (asin -0.0+0.0i) 0.0)
(num-test (asin 0.0-0.0i) 0.0)
(num-test (asin -0.0-0.0i) 0.0)
(num-test (asin 0.0+0.00000001i) 0.0+0.00000001i)
(num-test (asin -0.0+0.00000001i) 0.0+0.00000001i)
(num-test (asin 0.0-0.00000001i) 0.0-0.00000001i)
(num-test (asin -0.0-0.00000001i) -0.0-0.00000001i)
(num-test (asin 0.0+1.0i) 0.0+0.88137358701954i)
(num-test (asin -0.0+1.0i) 0.0+0.88137358701954i)
(num-test (asin 0.0-1.0i) 0.0-0.88137358701954i)
(num-test (asin -0.0-1.0i) -0.0-0.88137358701954i)
(num-test (asin 0.0+3.14159265358979i) 0.0+1.86229574331085i)
(num-test (asin -0.0+3.14159265358979i) 0.0+1.86229574331085i)
(num-test (asin 0.0-3.14159265358979i) 0.0-1.86229574331085i)
(num-test (asin -0.0-3.14159265358979i) -0.0-1.86229574331085i)
(num-test (asin 0.0+2.71828182845905i) 0.0+1.72538255885232i)
(num-test (asin -0.0+2.71828182845905i) 0.0+1.72538255885232i)
(num-test (asin 0.0-2.71828182845905i) 0.0-1.72538255885231i)
(num-test (asin -0.0-2.71828182845905i) -0.0-1.72538255885231i)
(num-test (asin 0.0+1234.0i) 0.0+7.81116354896171i)
(num-test (asin -0.0+1234.0i) 0.0+7.81116354896171i)
(num-test (asin 0.0-1234.0i) 0.0-7.81116354920125i)
(num-test (asin -0.0-1234.0i) -0.0-7.81116354920125i)
(num-test (asin 0.0-1234000000.0i) 0.0-21.62667394298955i)
(num-test (asin -0.0-1234000000.0i) -0.0-21.62667394298955i)
(num-test (asin 0.00000001+0.0i) 0.00000001)
(num-test (asin -0.00000001+0.0i) -0.00000001)
(num-test (asin 0.00000001-0.0i) 0.00000001)
(num-test (asin -0.00000001-0.0i) -0.00000001)
(num-test (asin 0.00000001+0.00000001i) 0.00000001+0.00000001i)
(num-test (asin -0.00000001+0.00000001i) -0.00000001+0.00000001i)
(num-test (asin 0.00000001-0.00000001i) 0.00000001-0.00000001i)
(num-test (asin -0.00000001-0.00000001i) -0.00000001-0.00000001i)
(num-test (asin 0.00000001+1.0i) 0.00000000707107+0.88137358701954i)
(num-test (asin -0.00000001+1.0i) -0.00000000707107+0.88137358701954i)
(num-test (asin 0.00000001-1.0i) 0.00000000707107-0.88137358701954i)
(num-test (asin -0.00000001-1.0i) -0.00000000707107-0.88137358701954i)
(num-test (asin 0.00000001+3.14159265358979i) 0.00000000303314+1.86229574331085i)
(num-test (asin -0.00000001+3.14159265358979i) -0.00000000303314+1.86229574331085i)
(num-test (asin 0.00000001-3.14159265358979i) 0.00000000303314-1.86229574331085i)
(num-test (asin -0.00000001-3.14159265358979i) -0.00000000303314-1.86229574331085i)
(num-test (asin 0.00000001+2.71828182845905i) 0.00000000345258+1.72538255885232i)
(num-test (asin -0.00000001+2.71828182845905i) -0.00000000345258+1.72538255885232i)
(num-test (asin 0.00000001-2.71828182845905i) 0.00000000345258-1.72538255885231i)
(num-test (asin -0.00000001-2.71828182845905i) -0.00000000345258-1.72538255885231i)
(num-test (asin 0.00000001+1234.0i) 0.00000000000810+7.81116354896171i)
(num-test (asin -0.00000001+1234.0i) -0.00000000000810+7.81116354896171i)
(num-test (asin 0.00000001-1234.0i) 0.00000000000810-7.81116354920125i)
(num-test (asin -0.00000001-1234.0i) -0.00000000000810-7.81116354920125i)
(num-test (asin 0.00000001-1234000000.0i) 0.0-21.62667394298955i)
(num-test (asin -0.00000001-1234000000.0i) -0.0-21.62667394298955i)
(num-test (asin 1.0+0.0i) 1.57079632679490)
(num-test (asin -1.0+0.0i) -1.57079632679490)
(num-test (asin 1.0-0.0i) 1.57079632679490)
(num-test (asin -1.0-0.0i) -1.57079632679490)
(num-test (asin 1.0+0.00000001i) 1.57069632679498+0.00010000000008i)
(num-test (asin -1.0+0.00000001i) -1.57069632679498+0.00010000000008i)
(num-test (asin 1.0-0.00000001i) 1.57069632679498-0.00010000000008i)
(num-test (asin -1.0-0.00000001i) -1.57069632679498-0.00010000000008i)
(num-test (asin 1.0+1.0i) 0.66623943249252+1.06127506190504i)
(num-test (asin -1.0+1.0i) -0.66623943249252+1.06127506190504i)
(num-test (asin 1.0-1.0i) 0.66623943249252-1.06127506190504i)
(num-test (asin -1.0-1.0i) -0.66623943249252-1.06127506190504i)
(num-test (asin 1.0+3.14159265358979i) 0.29558503421163+1.90462768697066i)
(num-test (asin -1.0+3.14159265358979i) -0.29558503421163+1.90462768697066i)
(num-test (asin 1.0-3.14159265358979i) 0.29558503421163-1.90462768697066i)
(num-test (asin -1.0-3.14159265358979i) -0.29558503421163-1.90462768697066i)
(num-test (asin 1.0+2.71828182845905i) 0.33444277187637+1.77905438385935i)
(num-test (asin -1.0+2.71828182845905i) -0.33444277187637+1.77905438385935i)
(num-test (asin 1.0-2.71828182845905i) 0.33444277187637-1.77905438385935i)
(num-test (asin -1.0-2.71828182845905i) -0.33444277187637-1.77905438385935i)
(num-test (asin 1.0+1234.0i) 0.00081037232806+7.81116387772663i)
(num-test (asin -1.0+1234.0i) -0.00081037232806+7.81116387772663i)
(num-test (asin 1.0-1234.0i) 0.00081037232800-7.81116387755283i)
(num-test (asin -1.0-1234.0i) -0.00081037232800-7.81116387755283i)
(num-test (asin 1.0-1234000000.0i) 0.00000000081037-21.62667394298955i)
(num-test (asin -1.0-1234000000.0i) -0.00000000081037-21.62667394298955i)
(num-test (asin 3.14159265358979+0.0i) 1.57079632679490+1.81152627246085i)
(num-test (asin -3.14159265358979+0.0i) -1.57079632679490+1.81152627246085i)
(num-test (asin 3.14159265358979-0.0i) 1.57079632679490+1.81152627246085i)
(num-test (asin -3.14159265358979-0.0i) -1.57079632679490+1.81152627246085i)
(num-test (asin 3.14159265358979+0.00000001i) 1.57079632343715+1.81152627246085i)
(num-test (asin -3.14159265358979+0.00000001i) -1.57079632343715+1.81152627246085i)
(num-test (asin 3.14159265358979-0.00000001i) 1.57079632343715-1.81152627246085i)
(num-test (asin -3.14159265358979-0.00000001i) -1.57079632343715-1.81152627246085i)
(num-test (asin 3.14159265358979+1.0i) 1.24854303281344+1.86711439316026i)
(num-test (asin -3.14159265358979+1.0i) -1.24854303281344+1.86711439316026i)
(num-test (asin 3.14159265358979-1.0i) 1.24854303281344-1.86711439316026i)
(num-test (asin -3.14159265358979-1.0i) -1.24854303281344-1.86711439316026i)
(num-test (asin 3.14159265358979+3.14159265358979i) 0.77273977912748+2.18469104082751i)
(num-test (asin -3.14159265358979+3.14159265358979i) -0.77273977912748+2.18469104082751i)
(num-test (asin 3.14159265358979-3.14159265358979i) 0.77273977912748-2.18469104082751i)
(num-test (asin -3.14159265358979-3.14159265358979i) -0.77273977912748-2.18469104082751i)
(num-test (asin 3.14159265358979+2.71828182845905i) 0.84309656416035+2.11552790803290i)
(num-test (asin -3.14159265358979+2.71828182845905i) -0.84309656416035+2.11552790803290i)
(num-test (asin 3.14159265358979-2.71828182845905i) 0.84309656416035-2.11552790803290i)
(num-test (asin -3.14159265358979-2.71828182845905i) -0.84309656416035-2.11552790803290i)
(num-test (asin 3.14159265358979+1234.0i) 0.00254585480900+7.81116678966949i)
(num-test (asin -3.14159265358979+1234.0i) -0.00254585480900+7.81116678966949i)
(num-test (asin 3.14159265358979-1234.0i) 0.00254585480937-7.81116678989204i)
(num-test (asin -3.14159265358979-1234.0i) -0.00254585480937-7.81116678989204i)
(num-test (asin 3.14159265358979-1234000000.0i) 0.00000000254586-21.62667394298955i)
(num-test (asin -3.14159265358979-1234000000.0i) -0.00000000254586-21.62667394298955i)
(num-test (asin 2.71828182845905+0.0i) 1.57079632679490+1.65745445415308i)
(num-test (asin -2.71828182845905+0.0i) -1.57079632679490+1.65745445415308i)
(num-test (asin 2.71828182845905-0.0i) 1.57079632679490+1.65745445415308i)
(num-test (asin -2.71828182845905-0.0i) -1.57079632679490+1.65745445415308i)
(num-test (asin 2.71828182845905+0.00000001i) 1.57079632283867+1.65745445415308i)
(num-test (asin -2.71828182845905+0.00000001i) -1.57079632283867+1.65745445415308i)
(num-test (asin 2.71828182845905-0.00000001i) 1.57079632283867-1.65745445415308i)
(num-test (asin -2.71828182845905-0.00000001i) -1.57079632283867-1.65745445415308i)
(num-test (asin 2.71828182845905+1.0i) 1.19757808518581+1.73375471569385i)
(num-test (asin -2.71828182845905+1.0i) -1.19757808518581+1.73375471569385i)
(num-test (asin 2.71828182845905-1.0i) 1.19757808518581-1.73375471569385i)
(num-test (asin -2.71828182845905-1.0i) -1.19757808518581-1.73375471569385i)
(num-test (asin 2.71828182845905+3.14159265358979i) 0.69904796994656+2.11968336368048i)
(num-test (asin -2.71828182845905+3.14159265358979i) -0.69904796994656+2.11968336368048i)
(num-test (asin 2.71828182845905-3.14159265358979i) 0.69904796994655-2.11968336368048i)
(num-test (asin -2.71828182845905-3.14159265358979i) -0.69904796994655-2.11968336368048i)
(num-test (asin 2.71828182845905+2.71828182845905i) 0.76849735588475+2.04014932880026i)
(num-test (asin -2.71828182845905+2.71828182845905i) -0.76849735588475+2.04014932880026i)
(num-test (asin 2.71828182845905-2.71828182845905i) 0.76849735588475-2.04014932880026i)
(num-test (asin -2.71828182845905-2.71828182845905i) -0.76849735588475-2.04014932880026i)
(num-test (asin 2.71828182845905+1234.0i) 0.00220281729236+7.81116597510553i)
(num-test (asin -2.71828182845905+1234.0i) -0.00220281729236+7.81116597510553i)
(num-test (asin 2.71828182845905-1234.0i) 0.00220281729269-7.81116597540442i)
(num-test (asin -2.71828182845905-1234.0i) -0.00220281729269-7.81116597540442i)
(num-test (asin 2.71828182845905-1234000000.0i) 0.00000000220282-21.62667394298955i)
(num-test (asin -2.71828182845905-1234000000.0i) -0.00000000220282-21.62667394298955i)
(num-test (asin 1234.0+0.0i) 1.57079632679490+7.81116322068415i)
(num-test (asin -1234.0+0.0i) -1.57079632679490+7.81116322068415i)
(num-test (asin 1234.0-0.0i) 1.57079632679490+7.81116322068415i)
(num-test (asin -1234.0-0.0i) -1.57079632679490+7.81116322068415i)
(num-test (asin 1234.0+0.00000001i) 1.57079632678679+7.81116322068415i)
(num-test (asin -1234.0+0.00000001i) -1.57079632678679+7.81116322068415i)
(num-test (asin 1234.0-0.00000001i) 1.57079632678679-7.81116322084923i)
(num-test (asin -1234.0-0.00000001i) -1.57079632678679-7.81116322084923i)
(num-test (asin 1234.0+1.0i) 1.56998595393442+7.81116354944842i)
(num-test (asin -1234.0+1.0i) -1.56998595393442+7.81116354944842i)
(num-test (asin 1234.0-1.0i) 1.56998595393473-7.81116354920146i)
(num-test (asin -1234.0-1.0i) -1.56998595393473-7.81116354920146i)
(num-test (asin 1234.0+3.14159265358979i) 1.56825047031506+7.81116646138554i)
(num-test (asin -1234.0+3.14159265358979i) -1.56825047031506+7.81116646138554i)
(num-test (asin 1234.0-3.14159265358979i) 1.56825047031367-7.81116646154641i)
(num-test (asin -1234.0-3.14159265358979i) -1.56825047031367-7.81116646154641i)
(num-test (asin 1234.0+2.71828182845905i) 1.56859350805543+7.81116564738434i)
(num-test (asin -1234.0+2.71828182845905i) -1.56859350805543+7.81116564738434i)
(num-test (asin 1234.0-2.71828182845905i) 1.56859350805562-7.81116564705719i)
(num-test (asin -1234.0-2.71828182845905i) -1.56859350805562-7.81116564705719i)
(num-test (asin 1234.0+1234.0i) 0.78539808146835+8.15773697538346i)
(num-test (asin -1234.0+1234.0i) -0.78539808146835+8.15773697538346i)
(num-test (asin 1234.0-1234.0i) 0.78539808130944-8.15773697530526i)
(num-test (asin -1234.0-1234.0i) -0.78539808130944-8.15773697530526i)
(num-test (asin 1234.0-1234000000.0i) 0.00000100000000-21.62667394299005i)
(num-test (asin -1234.0-1234000000.0i) -0.00000100000000-21.62667394299005i)
(num-test (asin 1234000000.0-0.00000001i) 1.57079632679490-21.62667394298955i)
(num-test (asin -1234000000.0-0.00000001i) -1.57079632679490-21.62667394298955i)
(num-test (asin 1234000000.0-1.0i) 1.57079632598452-21.62667394298955i)
(num-test (asin -1234000000.0-1.0i) -1.57079632598452-21.62667394298955i)
(num-test (asin 1234000000.0-3.14159265358979i) 1.57079632424904-21.62667394298955i)
(num-test (asin -1234000000.0-3.14159265358979i) -1.57079632424904-21.62667394298955i)
(num-test (asin 1234000000.0-2.71828182845905i) 1.57079632459208-21.62667394298955i)
(num-test (asin -1234000000.0-2.71828182845905i) -1.57079632459208-21.62667394298955i)
(num-test (asin 1234000000.0-1234.0i) 1.57079532679490-21.62667394299005i)
(num-test (asin -1234000000.0-1234.0i) -1.57079532679490-21.62667394299005i)
(num-test (asin 1234000000.0-1234000000.0i) 0.78539816339745-21.97324753326953i)
(num-test (asin -1234000000.0-1234000000.0i) -0.78539816339745-21.97324753326953i)
(num-test (asin 8.2729394e-17) 8.2729394e-17)
(num-test (asin 1.821832e-231) 1.821832e-231)
(num-test (asin 48983.30495194942-64983.97008730317i) 0.6459128607940432-12i)
(num-test (asin 1234000000/3) 1.570796326794897-20.52806165432143i) 
(num-test (asin 500029/2) 1.570796326794897-13.12242137571839i) 
(num-test (asin 0.00000001+1234000000.0i) +8.103725052149596E-18+21.62667380877375i) 
(num-test (asin 3.14159265358979+1234000000.0i) +2.545860611523387E-9+21.62667380877375i) 
(num-test (asin 2.71828182845905+1234000000.0i) +2.2028207814967068E-9+21.62667380877375i) 
(num-test (asin 1234000000.0+0.00000001i) +1.570796327200083+21.62667394298955i) 
(num-test (asin 1234000000.0+3.14159265358979i) +1.570796327200083+21.62667394298955i) 
(num-test (asin 0.0e+00+0.0e+00i) 0e0+0.0i)
(num-test (asin 0.0e+00+1.19209289550781250e-07i) 0+1.1920928955078096766e-7i)
(num-test (asin 0.0e+00-1.19209289550781250e-07i) 0-1.1920928955078096766e-7i)
(num-test (asin 0.0e+00+5.0e-01i) 0+4.8121182505960344750e-1i)
(num-test (asin 0.0e+00-5.0e-01i) 0-4.8121182505960344750e-1i)
(num-test (asin 0.0e+00+1.0e+00i) 0+8.8137358701954302523e-1i)
(num-test (asin 0.0e+00-1.0e+00i) 0-8.8137358701954302523e-1i)
(num-test (asin 0.0e+00+2.0e+00i) 0+1.4436354751788103425e0i)
(num-test (asin 0.0e+00-2.0e+00i) 0-1.4436354751788103425e0i)
(num-test (asin 0.0e+00+8.3886080e+06i) 0+1.6635532333438690979e1i)
(num-test (asin 0.0e+00-8.3886080e+06i) 0-1.6635532333438690979e1i)
(num-test (asin 1.19209289550781250e-07+0.0e+00i) 1.1920928955078153234e-7)
(num-test (asin -1.19209289550781250e-07+0.0e+00i) -1.1920928955078153234e-7)
(num-test (asin 1.19209289550781250e-07+1.19209289550781250e-07i) 1.1920928955078068531e-7+1.1920928955078181469e-7i)
(num-test (asin 1.19209289550781250e-07-1.19209289550781250e-07i) 1.1920928955078068531e-7-1.1920928955078181469e-7i)
(num-test (asin -1.19209289550781250e-07+1.19209289550781250e-07i) -1.1920928955078068531e-7+1.1920928955078181469e-7i)
(num-test (asin -1.19209289550781250e-07-1.19209289550781250e-07i) -1.1920928955078068531e-7-1.1920928955078181469e-7i)
(num-test (asin 1.19209289550781250e-07+5.0e-01i) 1.0662402999400097805e-7+4.8121182505960598961e-1i)
(num-test (asin 1.19209289550781250e-07-5.0e-01i) 1.0662402999400097805e-7-4.8121182505960598961e-1i)
(num-test (asin -1.19209289550781250e-07+5.0e-01i) -1.0662402999400097805e-7+4.8121182505960598961e-1i)
(num-test (asin -1.19209289550781250e-07-5.0e-01i) -1.0662402999400097805e-7-4.8121182505960598961e-1i)
(num-test (asin 1.19209289550781250e-07+1.0e+00i) 8.4293697021788013662e-8+8.8137358701954553738e-1i)
(num-test (asin 1.19209289550781250e-07-1.0e+00i) 8.4293697021788013662e-8-8.8137358701954553738e-1i)
(num-test (asin -1.19209289550781250e-07+1.0e+00i) -8.4293697021788013662e-8+8.8137358701954553738e-1i)
(num-test (asin -1.19209289550781250e-07-1.0e+00i) -8.4293697021788013662e-8-8.8137358701954553738e-1i)
(num-test (asin 1.19209289550781250e-07+2.0e+00i) 5.3312014997000413263e-8+1.4436354751788116136e0i)
(num-test (asin 1.19209289550781250e-07-2.0e+00i) 5.3312014997000413263e-8-1.4436354751788116136e0i)
(num-test (asin -1.19209289550781250e-07+2.0e+00i) -5.3312014997000413263e-8+1.4436354751788116136e0i)
(num-test (asin -1.19209289550781250e-07-2.0e+00i) -5.3312014997000413263e-8-1.4436354751788116136e0i)
(num-test (asin 1.19209289550781250e-07+8.3886080e+06i) 1.4210854715201902743e-14+1.6635532333438690979e1i)
(num-test (asin 1.19209289550781250e-07-8.3886080e+06i) 1.4210854715201902743e-14-1.6635532333438690979e1i)
(num-test (asin -1.19209289550781250e-07+8.3886080e+06i) -1.4210854715201902743e-14+1.6635532333438690979e1i)
(num-test (asin -1.19209289550781250e-07-8.3886080e+06i) -1.4210854715201902743e-14-1.6635532333438690979e1i)
(num-test (asin 5.0e-01+0.0e+00i) 5.2359877559829887308e-1)
(num-test (asin -5.0e-01+0.0e+00i) -5.2359877559829887308e-1)
(num-test (asin 5.0e-01+1.19209289550781250e-07i) 5.2359877559829340332e-1+1.3765103082409432364e-7i)
(num-test (asin 5.0e-01-1.19209289550781250e-07i) 5.2359877559829340332e-1-1.3765103082409432364e-7i)
(num-test (asin -5.0e-01+1.19209289550781250e-07i) -5.2359877559829340332e-1+1.3765103082409432364e-7i)
(num-test (asin -5.0e-01-1.19209289550781250e-07i) -5.2359877559829340332e-1-1.3765103082409432364e-7i)
(num-test (asin 5.0e-01+5.0e-01i) 4.5227844715119068206e-1+5.3063753095251782602e-1i)
(num-test (asin 5.0e-01-5.0e-01i) 4.5227844715119068206e-1-5.3063753095251782602e-1i)
(num-test (asin -5.0e-01+5.0e-01i) -4.5227844715119068206e-1+5.3063753095251782602e-1i)
(num-test (asin -5.0e-01-5.0e-01i) -4.5227844715119068206e-1-5.3063753095251782602e-1i)
(num-test (asin 5.0e-01+1.0e+00i) 3.4943906285721329363e-1+9.2613303135018242455e-1i)
(num-test (asin 5.0e-01-1.0e+00i) 3.4943906285721329363e-1-9.2613303135018242455e-1i)
(num-test (asin -5.0e-01+1.0e+00i) -3.4943906285721329363e-1+9.2613303135018242455e-1i)
(num-test (asin -5.0e-01-1.0e+00i) -3.4943906285721329363e-1-9.2613303135018242455e-1i)
(num-test (asin 5.0e-01+2.0e+00i) 2.2101863562288385890e-1+1.4657153519472905218e0i)
(num-test (asin 5.0e-01-2.0e+00i) 2.2101863562288385890e-1-1.4657153519472905218e0i)
(num-test (asin -5.0e-01+2.0e+00i) -2.2101863562288385890e-1+1.4657153519472905218e0i)
(num-test (asin -5.0e-01-2.0e+00i) -2.2101863562288385890e-1-1.4657153519472905218e0i)
(num-test (asin 5.0e-01+8.3886080e+06i) 5.9604644775390130897e-8+1.6635532333438692755e1i)
(num-test (asin 5.0e-01-8.3886080e+06i) 5.9604644775390130897e-8-1.6635532333438692755e1i)
(num-test (asin -5.0e-01+8.3886080e+06i) -5.9604644775390130897e-8+1.6635532333438692755e1i)
(num-test (asin -5.0e-01-8.3886080e+06i) -5.9604644775390130897e-8-1.6635532333438692755e1i)
(num-test (asin 1.0e+00+0.0e+00i) 1.5707963267948966192e0)
(num-test (asin -1.0e+00+0.0e+00i) -1.5707963267948966192e0)
(num-test (asin 1.0e+00+1.19209289550781250e-07i) 1.5704510598153252947e0+3.4526698643116312881e-4i)
(num-test (asin 1.0e+00-1.19209289550781250e-07i) 1.5704510598153252947e0-3.4526698643116312881e-4i)
(num-test (asin -1.0e+00+1.19209289550781250e-07i) -1.5704510598153252947e0+3.4526698643116312881e-4i)
(num-test (asin -1.0e+00-1.19209289550781250e-07i) -1.5704510598153252947e0-3.4526698643116312881e-4i)
(num-test (asin 1.0e+00+5.0e-01i) 8.9590748120889023907e-1+7.3285767597364526089e-1i)
(num-test (asin 1.0e+00-5.0e-01i) 8.9590748120889023907e-1-7.3285767597364526089e-1i)
(num-test (asin -1.0e+00+5.0e-01i) -8.9590748120889023907e-1+7.3285767597364526089e-1i)
(num-test (asin -1.0e+00-5.0e-01i) -8.9590748120889023907e-1-7.3285767597364526089e-1i)
(num-test (asin 1.0e+00+1.0e+00i) 6.6623943249251525510e-1+1.0612750619050356520e0i)
(num-test (asin 1.0e+00-1.0e+00i) 6.6623943249251525510e-1-1.0612750619050356520e0i)
(num-test (asin -1.0e+00+1.0e+00i) -6.6623943249251525510e-1+1.0612750619050356520e0i)
(num-test (asin -1.0e+00-1.0e+00i) -6.6623943249251525510e-1-1.0612750619050356520e0i)
(num-test (asin 1.0e+00+2.0e+00i) 4.2707858639247612548e-1+1.5285709194809981613e0i)
(num-test (asin 1.0e+00-2.0e+00i) 4.2707858639247612548e-1-1.5285709194809981613e0i)
(num-test (asin -1.0e+00+2.0e+00i) -4.2707858639247612548e-1+1.5285709194809981613e0i)
(num-test (asin -1.0e+00-2.0e+00i) -4.2707858639247612548e-1-1.5285709194809981613e0i)
(num-test (asin 1.0e+00+8.3886080e+06i) 1.1920928955077983828e-7+1.6635532333438698084e1i)
(num-test (asin 1.0e+00-8.3886080e+06i) 1.1920928955077983828e-7-1.6635532333438698084e1i)
(num-test (asin -1.0e+00+8.3886080e+06i) -1.1920928955077983828e-7+1.6635532333438698084e1i)
(num-test (asin -1.0e+00-8.3886080e+06i) -1.1920928955077983828e-7-1.6635532333438698084e1i)
(num-test (asin 2.0e+00+0.0e+00i) 1.5707963267948966192e0-1.3169578969248167086e0i)
(num-test (asin -2.0e+00+0.0e+00i) -1.5707963267948966192e0+1.3169578969248167086e0i)
(num-test (asin 2.0e+00+1.19209289550781250e-07i) 1.5707962579693812072e0+1.3169578969248194435e0i)
(num-test (asin 2.0e+00-1.19209289550781250e-07i) 1.5707962579693812072e0-1.3169578969248194435e0i)
(num-test (asin -2.0e+00+1.19209289550781250e-07i) -1.5707962579693812072e0+1.3169578969248194435e0i)
(num-test (asin -2.0e+00-1.19209289550781250e-07i) -1.5707962579693812072e0-1.3169578969248194435e0i)
(num-test (asin 2.0e+00+5.0e-01i) 1.2930420702371826591e0+1.3618009008578457882e0i)
(num-test (asin 2.0e+00-5.0e-01i) 1.2930420702371826591e0-1.3618009008578457882e0i)
(num-test (asin -2.0e+00+5.0e-01i) -1.2930420702371826591e0+1.3618009008578457882e0i)
(num-test (asin -2.0e+00-5.0e-01i) -1.2930420702371826591e0-1.3618009008578457882e0i)
(num-test (asin 2.0e+00+1.0e+00i) 1.0634400235777520562e0+1.4693517443681852733e0i)
(num-test (asin 2.0e+00-1.0e+00i) 1.0634400235777520562e0-1.4693517443681852733e0i)
(num-test (asin -2.0e+00+1.0e+00i) -1.0634400235777520562e0+1.4693517443681852733e0i)
(num-test (asin -2.0e+00-1.0e+00i) -1.0634400235777520562e0-1.4693517443681852733e0i)
(num-test (asin 2.0e+00+2.0e+00i) 7.5424914469804604071e-1+1.7343245214879664480e0i)
(num-test (asin 2.0e+00-2.0e+00i) 7.5424914469804604071e-1-1.7343245214879664480e0i)
(num-test (asin -2.0e+00+2.0e+00i) -7.5424914469804604071e-1+1.7343245214879664480e0i)
(num-test (asin -2.0e+00-2.0e+00i) -7.5424914469804604071e-1-1.7343245214879664480e0i)
(num-test (asin 2.0e+00+8.3886080e+06i) 2.3841857910155628843e-7+1.663553233343871940e1i)
(num-test (asin 2.0e+00-8.3886080e+06i) 2.3841857910155628843e-7-1.663553233343871940e1i)
(num-test (asin -2.0e+00+8.3886080e+06i) -2.3841857910155628843e-7+1.663553233343871940e1i)
(num-test (asin -2.0e+00-8.3886080e+06i) -2.3841857910155628843e-7-1.663553233343871940e1i)
(num-test (asin 8.3886080e+06+0.0e+00i) 1.5707963267948966192e0-1.6635532333438683873e1i)
(num-test (asin -8.3886080e+06+0.0e+00i) -1.5707963267948966192e0+1.6635532333438683873e1i)
(num-test (asin 8.3886080e+06+1.19209289550781250e-07i) 1.5707963267948824084e0+1.6635532333438683873e1i)
(num-test (asin 8.3886080e+06-1.19209289550781250e-07i) 1.5707963267948824084e0-1.6635532333438683873e1i)
(num-test (asin -8.3886080e+06+1.19209289550781250e-07i) -1.5707963267948824084e0+1.6635532333438683873e1i)
(num-test (asin -8.3886080e+06-1.19209289550781250e-07i) -1.5707963267948824084e0-1.6635532333438683873e1i)
(num-test (asin 8.3886080e+06+5.0e-01i) 1.5707962671902518438e0+1.6635532333438685650e1i)
(num-test (asin 8.3886080e+06-5.0e-01i) 1.5707962671902518438e0-1.6635532333438685650e1i)
(num-test (asin -8.3886080e+06+5.0e-01i) -1.5707962671902518438e0+1.6635532333438685650e1i)
(num-test (asin -8.3886080e+06-5.0e-01i) -1.5707962671902518438e0-1.6635532333438685650e1i)
(num-test (asin 8.3886080e+06+1.0e+00i) 1.5707962075856070684e0+1.6635532333438690979e1i)
(num-test (asin 8.3886080e+06-1.0e+00i) 1.5707962075856070684e0-1.6635532333438690979e1i)
(num-test (asin -8.3886080e+06+1.0e+00i) -1.5707962075856070684e0+1.6635532333438690979e1i)
(num-test (asin -8.3886080e+06-1.0e+00i) -1.5707962075856070684e0-1.6635532333438690979e1i)
(num-test (asin 8.3886080e+06+2.0e+00i) 1.5707960883763175177e0+1.6635532333438712295e1i)
(num-test (asin 8.3886080e+06-2.0e+00i) 1.5707960883763175177e0-1.6635532333438712295e1i)
(num-test (asin -8.3886080e+06+2.0e+00i) -1.5707960883763175177e0+1.6635532333438712295e1i)
(num-test (asin -8.3886080e+06-2.0e+00i) -1.5707960883763175177e0-1.6635532333438712295e1i)
(num-test (asin 8.3886080e+06+8.3886080e+06i) 7.8539816339744653326e-1+1.6982105923718660081e1i)
(num-test (asin 8.3886080e+06-8.3886080e+06i) 7.8539816339744653326e-1-1.6982105923718660081e1i)
(num-test (asin -8.3886080e+06+8.3886080e+06i) -7.8539816339744653326e-1+1.6982105923718660081e1i)
(num-test (asin -8.3886080e+06-8.3886080e+06i) -7.8539816339744653326e-1-1.6982105923718660081e1i)
(num-test (asin -1.0e+01) -1.5707963267948966192e0+2.9932228461263808979e0i)
(num-test (asin -2.0e+00) -1.5707963267948966192e0+1.3169578969248167086e0i)
(num-test (asin -1.0e+00) -1.5707963267948966192e0)
(num-test (asin -7.50e-01) -8.4806207898148100805e-1)
(num-test (asin -5.0e-01) -5.2359877559829887308e-1)
(num-test (asin -1.250e-01) -1.2532783116806539687e-1)
(num-test (asin -3.45266983001243932001e-04) -3.4526698986108292481e-4)
(num-test (asin -1.19209289550781250e-07) -1.1920928955078153234e-7)
(num-test (asin 0.0e+00) 0e0)
(num-test (asin 1.19209289550781250e-07) 1.1920928955078153234e-7)
(num-test (asin 3.45266983001243932001e-04) 3.4526698986108292481e-4)
(num-test (asin 1.250e-01) 1.2532783116806539687e-1)
(num-test (asin 5.0e-01) 5.2359877559829887308e-1)
(num-test (asin 7.50e-01) 8.4806207898148100805e-1)
(num-test (asin 1.0e+00) 1.5707963267948966192e0)
(num-test (asin 2.0e+00) 1.5707963267948966192e0-1.3169578969248167086e0i)
(num-test (asin 1.0e+01) 1.5707963267948966192e0-2.9932228461263808979e0i)
(num-test (asin 0) 0.0)
(num-test (asin 2) 1.570796326794897-1.316957896924817i)
(num-test (asin 3.0+70000000i) 4.2857142400327436E-8+18.7571529895002i)
(num-test (asin 70000000+3i) 1.570796279536826+18.75715298057358i)
(num-test (asin 3.0-70000000i) 4.2857142400327436E-8-18.7571529895002i)
(num-test (asin -70000000+3i) -1.570796279536826+18.75715298057358i)
(num-test (asin 1e17+1e17i) 0.78539816339745+40.183667351739i)
(num-test (asin 1+1e17i) 1e-17+39.837093761459i)
(num-test (asin -2.225073858507201399999999999999999999996E-308) -2.225073858507201399999999999999999999996E-308)
(num-test (asin 1.110223024625156799999999999999999999997E-16) 1.110223024625156800000000000000002280754E-16)
(num-test (asin (/ (sqrt 2) 2)) (/ pi 4))
(num-test (asin (/ (sqrt 3) -2)) (/ pi -3))
(num-test (* 10 (asin (/ (- (sqrt 5) 1) 4))) pi)
(num-test (* 2 (asin 1)) pi)

(for-each
 (lambda (num-and-val)
   (let ((num (car num-and-val)) (val (cadr num-and-val))) (num-test-1 'asin num (asin num) val)))
 (vector (list 0 0) (list 1 1.5707963267949) (list 2 1.5707963267949-1.3169578969248i) (list 3 1.5707963267949-1.7627471740391i) 
	 (list -1 -1.5707963267949) (list -2 -1.5707963267949+1.3169578969248i) (list -3 -1.5707963267949+1.7627471740391i) 
	 (list 9223372036854775807 1.5707963267949-44.361419555836i) (list -9223372036854775808 -1.5707963267949+44.361419555836i) 
	 (list 1/2 0.5235987755983) (list 1/3 0.33983690945412) (list -1/2 -0.5235987755983) 
	 (list -1/3 -0.33983690945412) (list 1/9223372036854775807 1.0842021724855e-19) (list 0.0 0.0) 
	 (list 1.0 1.5707963267949) (list 2.0 1.5707963267949-1.3169578969248i) (list -2.0 -1.5707963267949+1.3169578969248i) 
	 (list 1.000000000000000000000000000000000000002E-309 1.000000000000000000000000000000000000002E-309) 
	 (list 1e+16 1.5707963267949-37.534508668465i) (list 0+1i 0+0.88137358701954i) (list 0+2i 0+1.4436354751788i) 
	 (list 0-1i 0-0.88137358701954i) (list 1+1i 0.66623943249252+1.061275061905i) (list 1-1i 0.66623943249252-1.061275061905i) 
	 (list -1+1i -0.66623943249252+1.061275061905i) (list -1-1i -0.66623943249252-1.061275061905i) 
	 (list 0.1+0.1i 0.099663702859795+0.10033029811221i) (list 1e+16+1e+16i 0.78539816339745+37.881082258745i) 
	 (list 1e-16+1e-16i 1e-16+1.1102230246252e-16i) ))
  
(let ((err 0.0)
      (mx 0.0))
  (do ((i 0 (+ i 1))
       (x -10.0 (+ x .1)))
      ((= i 200))
    (let ((y (magnitude (- x (sin (asin x))))))
      (if (> y err) (begin (set! mx x) (set! err y)))))
  (if (> err 1e-12)
      (format #t ";(sin (asin ~A)) error: ~A~%" mx err)))

(let ((err 0.0)
      (mx 0.0))
  (do ((i 0 (+ i 1))
       (x 1.0-i (+ x -.1+i)))
      ((= i 100))
    (let ((y (magnitude (- x (sin (asin x))))))
      (if (> y err) (begin (set! mx x) (set! err y)))))
  (if (> err 1e-9)
      (format #t ";(sin (asin ~A)) error: ~A~%" mx err)))

(test (asin) 'error)
(test (asin "hi") 'error)
(test (asin 1.0+23.0i 1.0+23.0i) 'error)
(test (asin 0 1) 'error)

(for-each
 (lambda (arg)
   (test (asin arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))

(let ((asins (list
	      0.00000000000000000000000000000000000000000000000000000000000000000000
	      0.02500260489936113599406838915349107150195748368840710160729904233944
	      0.05002085680577001466274438682046411497780608049468789272874398055703
	      0.07507049107671654265775143572317089898194705496817785120910161299955
	      0.10016742116155979634552317945269331856867597222962954139102385503640
	      0.12532783116806539687456698635708471804814772683867237523396403098649
	      0.15056827277668602642326030146739539047425784470580485344319902595849
	      0.17590576816371628737774199743846051972730948209298253171964068749984
	      0.20135792079033079145512555221762341024003808140222838625725124345560
	      0.22694303617851994909359260763689579636930963064761339672521677581090
	      0.25268025514207865348565743699371097225219373309683819363392377874057
	      0.27858970239165058217050815183568882129133935843106227203280647300877
	      0.30469265401539750797200296122752916695456003170677638739297794874647
	      0.33101172808929452771961639961139035858195303667932389628972377319123
	      0.35757110364551028671483849232064256784674132498948776325141270863037
	      0.38439677449563908303819487296704697375277948430656504155058375479079
	      0.41151684606748801938473789761733560485570113512702585178394678070009
	      0.43896188560976067483321619602147236009843505358239561712817387552271
	      0.46676533904729636185033976030413712126156503909241369925276357159851
	      0.49496403171689461363027991615293072605447706550005723007748628111125
	      0.52359877559829887307710723054658381403286156656251763682915743205130
	      0.55271511309678317285035596261806027710654731438452549350875265730232
	      0.58236423786874344183204729090997636797897358751436418853659347126034
	      0.61260414804862246566851988030718610964520075565860642564808142300476
	      0.64350110879328438680280922871732263804151059111531238286560611871351
	      0.67513153293703164720905626529438801420418535124967921737841984904557
	      0.70758443672535557545286474430459468476197717933193633785448106190261
	      0.74096470220302000164595109317351452207440076171206748884906746063949
	      0.77539749661075306374035335271498711355578873864116199359771996373272
	      0.81103439428758154765966499519016990220446846078107874166646027112837
	      0.84806207898148100805294433899841808007336621326311264286071816357020
	      0.88671509499956738294114522105877020358977872696702934222169938478807
	      0.92729521800161223242851246292242880405707410857224052762186617744039
	      0.97020219992884564627294507144637975649395034794671876838355202607208
	      1.01598529381482513116231792163105149400316379682053508778250056579494
	      1.06543581651073931226000681765232949759419723349387652321962473867275
	      1.11976951499863418668667705584539961589516218640330288237568186391443
	      1.18103559399742179696187441797151603545275866323114802494551011137296
	      1.25323589750337525873710391866600599574114067342736145636046515573871
	      1.34672104149307735953151290762049740983950868154764854526693662237423
	      1.57079632679489661923132169163975144209858469968755291048747229615390)))
  (let ((mxerr 0.0))
    (do ((i 0 (+ i 1))
	 (x 0.0 (+ x (/ 1.0 40.0))))
	((= i 40))
      (let ((err (abs (- (asin x) (list-ref asins i)))))
	(if (> err mxerr)
	    (set! mxerr err))))
    (if (> mxerr 1e-12) (format #t "asin err: ~A~%" mxerr))))

(when with-bignums
  (let-temporarily (((*s7* 'bignum-precision) 500))
    (let ((asins (list ; table[Arcsin[k/30], {k, 0, 30}]
		  0.00000000000000000000000000000000000000000000000000000000000000000000e0
		  0.03333950926130208699143488077083860917565937855129663393680393744362
		  0.06671614841022525954540510327036927409184944434654403274652597117428
		  0.10016742116155979634552317945269331856867597222962954139102385503640
		  0.13373158940994152865632332716309743011405498274444165545458875924377
		  0.16744807921968933055327460604363822091495716231623832046578730373329
		  0.20135792079033079145512555221762341024003808140222838625725124345560
		  0.23550423672079979129288448393723556648106234259531297814541683051663
		  0.26993279583340344442461498978851864365647337427020501782962042633379
		  0.30469265401539750797200296122752916695456003170677638739297794874647
		  0.33983690945412193709639251339176406638824469033245807143192396248991
		  0.37542360798103940368516545708214708494670535320625397496008012654413
		  0.41151684606748801938473789761733560485570113512702585178394678070009
		  0.44818813597943128994043756304906477118029918046343080720212217855713
		  0.48551812229559116327223435902482444763168509494201196125953547218486
		  0.52359877559829887307710723054658381403286156656251763682915743205130
		  0.56253624454385561973132565694853319169977493405170278279550382560769
		  0.60245463338499055124863378781466897272136400811697167837514413874507
		  0.64350110879328438680280922871732263804151059111531238286560611871351
		  0.68585296461871075596328071793021108476903703940127104404158318225766
		  0.72972765622696636345479665981332069539650591404771369070894949146181
		  0.77539749661075306374035335271498711355578873864116199359771996373272
		  0.82321197712587582143797706006235798228453830885144107684904792594002
		  0.87363319315266432351068180914720023973456695459982111043494836254140
		  0.92729521800161223242851246292242880405707410857224052762186617744039
		  0.98511078333774565961356415316223367589822363251591140783691296893264
		  1.04848150498884799670722286578404816608970376214442109090268484725633
		  1.11976951499863418668667705584539961589516218640330288237568186391443
		  1.20358830623705947672584877793852613585139977949919656045114461770445
		  1.31187478478867540346593147633958737932614651512288222488818316043445
		  1.57079632679489661923132169163975144209858469968755291048747229615390)))
      (do ((i 0 (+ i 1)))
	  ((= i 30))
	(let ((val (asin (/ i (bignum "30")))))
	  (if (> (magnitude (- val (list-ref asins i))) 1e-36)
	      (format #t ";(asin ~A) -> ~A ~A~%[~A]~%" (/ i 30) val (list-ref asins i) (magnitude (- val (list-ref asins i))))))))))





;;;--------------------------------------------------------------------------------
;;; acos
;;; --------------------------------------------------------------------------------

(num-test (acos 0) 1.57079632679490)
(num-test (acos 1) 0.0)
(num-test (acos -1) pi)
(num-test (acos 2) 0.0-1.31695789692482i)
(num-test (acos -2) 3.14159265358979-1.31695789692482i)
(num-test (acos 3) 0.0-1.76274717403909i)
(num-test (acos -3) 3.14159265358979-1.76274717403909i)
(num-test (acos 10) 0.0-2.99322284612638i)
(num-test (acos -10) 3.14159265358979-2.99322284612638i)
(num-test (acos 1234) 0.0-7.81116322068415i)
(num-test (acos -1234) 3.14159265358979-7.81116322068415i)
(num-test (acos 0/1) 1.57079632679490)
(num-test (acos 0/2) 1.57079632679490)
(num-test (acos 0/3) 1.57079632679490)
(num-test (acos 0/10) 1.57079632679490)
(num-test (acos 0/1234) 1.57079632679490)
(num-test (acos 0/1234000000) 1.57079632679490)
(num-test (acos 0/500029) 1.57079632679490)
(num-test (acos 0/362880) 1.57079632679490)
(num-test (acos 1/1) 0.0)
(num-test (acos -1/1) pi)
(num-test (acos 1/2) 1.04719755119660)
(num-test (acos -1/2) 2.09439510239320)
(num-test (acos 1/3) 1.23095941734077)
(num-test (acos -1/3) 1.91063323624902)
(num-test (acos 1/10) 1.47062890563334)
(num-test (acos -1/10) 1.67096374795646)
(num-test (acos 1/1234) 1.56998595393473)
(num-test (acos -1/1234) 1.57160669965507)
(num-test (acos 1/1234000000) 1.57079632598452)
(num-test (acos -1/1234000000) 1.57079632760527)
(num-test (acos 1/500029) 1.57079432691089)
(num-test (acos -1/500029) 1.57079832667890)
(num-test (acos 1/362880) 1.57079357106297)
(num-test (acos -1/362880) 1.57079908252682)
(num-test (acos 2/1) 0.0-1.31695789692482i)
(num-test (acos -2/1) 3.14159265358979-1.31695789692482i)
(num-test (acos 2/2) 0.0)
(num-test (acos -2/2) pi)
(num-test (acos 2/3) 0.84106867056793)
(num-test (acos -2/3) 2.30052398302186)
(num-test (acos 2/10) 1.36943840600457)
(num-test (acos -2/10) 1.77215424758523)
(num-test (acos 2/1234) 1.56917558054238)
(num-test (acos -2/1234) 1.57241707304741)
(num-test (acos 2/1234000000) 1.57079632517415)
(num-test (acos -2/1234000000) 1.57079632841564)
(num-test (acos 2/500029) 1.57079232702688)
(num-test (acos -2/500029) 1.57080032656291)
(num-test (acos 2/362880) 1.57079081533105)
(num-test (acos -2/362880) 1.57080183825874)
(num-test (acos 3/1) 0.0-1.76274717403909i)
(num-test (acos -3/1) 3.14159265358979-1.76274717403909i)
(num-test (acos 3/2) 0.0-0.96242365011921i)
(num-test (acos -3/2) 3.14159265358979-0.96242365011921i)
(num-test (acos 3/3) 0.0)
(num-test (acos -3/3) pi)
(num-test (acos 3/10) 1.26610367277950)
(num-test (acos -3/10) 1.87548898081029)
(num-test (acos 3/1234) 1.56836520608568)
(num-test (acos -3/1234) 1.57322744750412)
(num-test (acos 3/1234000000) 1.57079632436378)
(num-test (acos -3/1234000000) 1.57079632922601)
(num-test (acos 3/500029) 1.57079032714288)
(num-test (acos -3/500029) 1.57080232644692)
(num-test (acos 3/362880) 1.57078805959913-0.0i)
(num-test (acos -3/362880) 1.57080459399066-0.0i)
(num-test (acos 10/1) 0.0-2.99322284612638i)
(num-test (acos -10/1) 3.14159265358979-2.99322284612638i)
(num-test (acos 10/2) 0.0-2.29243166956117i)
(num-test (acos -10/2) 3.14159265358979-2.29243166956117i)
(num-test (acos 10/3) 0.0-1.87382024252741i)
(num-test (acos -10/3) 3.14159265358979-1.87382024252741i)
(num-test (acos 10/10) 0.0)
(num-test (acos -10/10) pi)
(num-test (acos 10/1234) 1.56269251038168)
(num-test (acos -10/1234) 1.57890014320811)
(num-test (acos 10/1234000000) 1.57079631869117)
(num-test (acos -10/1234000000) 1.57079633489862)
(num-test (acos 10/500029) 1.57077632795483)
(num-test (acos -10/500029) 1.57081632563497)
(num-test (acos 10/362880) 1.57076876947567)
(num-test (acos -10/362880) 1.57082388411412)
(num-test (acos 1234/1) 0.0-7.81116322068415i)
(num-test (acos -1234/1) 3.14159265358979-7.81116322068415i)
(num-test (acos 1234/2) 0.0-7.11801554770806i)
(num-test (acos -1234/2) 3.14159265358979-7.11801554770806i)
(num-test (acos 1234/3) 0.0-6.71254961876657i)
(num-test (acos -1234/3) 3.14159265358979-6.71254961876657i)
(num-test (acos 1234/10) 0.0-5.50856187402751i)
(num-test (acos -1234/10) 3.14159265358979-5.50856187402751i)
(num-test (acos 1234/1234) 0.0)
(num-test (acos -1234/1234) pi)
(num-test (acos 1234/1234000000) 1.57079532679490)
(num-test (acos -1234/1234000000) 1.57079732679490)
(num-test (acos 1234/500029) 1.56832846742558)
(num-test (acos -1234/500029) 1.57326418616421)
(num-test (acos 1234/362880) 1.56739574704864)
(num-test (acos -1234/362880) 1.57419690654115)
(num-test (acos 1234000000/1234000000) 0.0)
(num-test (acos -1234000000/1234000000) pi)
(num-test (acos 1234000000/500029) 0.0-8.50425252675189i)
(num-test (acos -1234000000/500029) 3.14159265358979-8.50425252675189i)
(num-test (acos 1234000000/362880) 0.0-8.82484644053502i)
(num-test (acos -1234000000/362880) 3.14159265358979-8.82484644053502i)
(num-test (acos 500029/3) 0+12.7169561400958i)
(num-test (acos -500029/3) 3.14159265358979-12.7169561400958i)
(num-test (acos 500029/10) 0.0+11.51298346318831i) ; maxima
(num-test (acos -500029/10) 3.14159265358979-11.51298333576987i)
(num-test (acos 500029/1234) 0.0-6.69755082925184i)
(num-test (acos -500029/1234) 3.14159265358979-6.69755082925184i)
(num-test (acos 500029/1234000000) 1.57039111689726)
(num-test (acos -500029/1234000000) 1.57120153669253)
(num-test (acos 500029/500029) 0.0)
(num-test (acos -500029/500029) pi)
(num-test (acos 500029/362880) 0.0-0.84413377868249i)
(num-test (acos -500029/362880) 3.14159265358979-0.84413377868249i)
(num-test (acos 362880/2) 0.0+1.280182724631953e1i)
(num-test (acos -362880/2) 3.141592653589793-12.80182748007388i)
(num-test (acos 362880/3) 0.0+12.39636237195622i)
(num-test (acos -362880/3) 3.141592653589793-12.39636237195622i)
(num-test (acos 362880/10) 0.0-11.19238956745752i)
(num-test (acos -362880/10) 3.14159265358979-11.19238956745752i)
(num-test (acos 362880/1234) 0.0-6.37695556516894i)
(num-test (acos -362880/1234) 3.14159265358979-6.37695556516894i)
(num-test (acos 362880/1234000000) 1.57050225871935)
(num-test (acos -362880/1234000000) 1.57109039487045)
(num-test (acos 362880/500029) 0.75871902295910)
(num-test (acos -362880/500029) 2.38287363063069)
(num-test (acos 362880/362880) 0.0)
(num-test (acos -362880/362880) pi)
(num-test (acos 0.0) 1.57079632679490)
(num-test (acos 0.00000001) 1.57079631679490)
(num-test (acos -0.00000001) 1.57079633679490)
(num-test (acos 1.0) 0.0)
(num-test (acos -1.0) pi)
(num-test (acos pi) 0.0-1.81152627246085i)
(num-test (acos -3.14159265358979) 3.14159265358979-1.81152627246085i)
(num-test (acos 2.71828182845905) 0.0-1.65745445415308i)
(num-test (acos -2.71828182845905) 3.14159265358979-1.65745445415308i)
(num-test (acos 1234.0) 0.0-7.81116322068415i)
(num-test (acos -1234.0) 3.14159265358979-7.81116322068415i)
(num-test (acos 0.0+0.0i) 1.57079632679490)
(num-test (acos -0.0+0.0i) 1.57079632679490)
(num-test (acos 0.0-0.0i) 1.57079632679490)
(num-test (acos -0.0-0.0i) 1.57079632679490)
(num-test (acos 0.0+0.00000001i) 1.57079632679490-0.00000001i)
(num-test (acos -0.0+0.00000001i) 1.57079632679490-0.00000001i)
(num-test (acos 0.0-0.00000001i) 1.57079632679490+0.00000001i)
(num-test (acos -0.0-0.00000001i) 1.57079632679490+0.00000001i)
(num-test (acos 0.0+1.0i) 1.57079632679490-0.88137358701954i)
(num-test (acos -0.0+1.0i) 1.57079632679490-0.88137358701954i)
(num-test (acos 0.0-1.0i) 1.57079632679490+0.88137358701954i)
(num-test (acos -0.0-1.0i) 1.57079632679490+0.88137358701954i)
(num-test (acos 0.0+3.14159265358979i) 1.57079632679490-1.86229574331085i)
(num-test (acos -0.0+3.14159265358979i) 1.57079632679490-1.86229574331085i)
(num-test (acos 0.0-3.14159265358979i) 1.57079632679490+1.86229574331085i)
(num-test (acos -0.0-3.14159265358979i) 1.57079632679490+1.86229574331085i)
(num-test (acos 0.0+2.71828182845905i) 1.57079632679490-1.72538255885232i)
(num-test (acos -0.0+2.71828182845905i) 1.57079632679490-1.72538255885232i)
(num-test (acos 0.0-2.71828182845905i) 1.57079632679490+1.72538255885231i)
(num-test (acos -0.0-2.71828182845905i) 1.57079632679490+1.72538255885231i)
(num-test (acos 0.0+1234.0i) 1.57079632679490-7.81116354896171i)
(num-test (acos -0.0+1234.0i) 1.57079632679490-7.81116354896171i)
(num-test (acos 0.0-1234.0i) 1.57079632679490+7.81116354920125i)
(num-test (acos -0.0-1234.0i) 1.57079632679490+7.81116354920125i)
(num-test (acos 0.0-1234000000.0i) 1.57079632679490+21.62667394298955i)
(num-test (acos -0.0-1234000000.0i) 1.57079632679490+21.62667394298955i)
(num-test (acos 0.00000001+0.0i) 1.57079631679490)
(num-test (acos -0.00000001+0.0i) 1.57079633679490)
(num-test (acos 0.00000001-0.0i) 1.57079631679490)
(num-test (acos -0.00000001-0.0i) 1.57079633679490)
(num-test (acos 0.00000001+0.00000001i) 1.57079631679490-0.00000001i)
(num-test (acos -0.00000001+0.00000001i) 1.57079633679490-0.00000001i)
(num-test (acos 0.00000001-0.00000001i) 1.57079631679490+0.00000001i)
(num-test (acos -0.00000001-0.00000001i) 1.57079633679490+0.00000001i)
(num-test (acos 0.00000001+1.0i) 1.57079631972383-0.88137358701954i)
(num-test (acos -0.00000001+1.0i) 1.57079633386596-0.88137358701954i)
(num-test (acos 0.00000001-1.0i) 1.57079631972383+0.88137358701954i)
(num-test (acos -0.00000001-1.0i) 1.57079633386596+0.88137358701954i)
(num-test (acos 0.00000001+3.14159265358979i) 1.57079632376175-1.86229574331085i)
(num-test (acos -0.00000001+3.14159265358979i) 1.57079632982804-1.86229574331085i)
(num-test (acos 0.00000001-3.14159265358979i) 1.57079632376175+1.86229574331085i)
(num-test (acos -0.00000001-3.14159265358979i) 1.57079632982804+1.86229574331085i)
(num-test (acos 0.00000001+2.71828182845905i) 1.57079632334232-1.72538255885232i)
(num-test (acos -0.00000001+2.71828182845905i) 1.57079633024747-1.72538255885232i)
(num-test (acos 0.00000001-2.71828182845905i) 1.57079632334232+1.72538255885231i)
(num-test (acos -0.00000001-2.71828182845905i) 1.57079633024747+1.72538255885231i)
(num-test (acos 0.00000001+1234.0i) 1.57079632678679-7.81116354896171i)
(num-test (acos -0.00000001+1234.0i) 1.57079632680300-7.81116354896171i)
(num-test (acos 0.00000001-1234.0i) 1.57079632678679+7.81116354920125i)
(num-test (acos -0.00000001-1234.0i) 1.57079632680300+7.81116354920125i)
(num-test (acos 0.00000001-1234000000.0i) 1.57079632679490+21.62667394298955i)
(num-test (acos -0.00000001-1234000000.0i) 1.57079632679490+21.62667394298955i)
(num-test (acos 1.0+0.0i) 0.0)
(num-test (acos -1.0+0.0i) pi)
(num-test (acos 1.0-0.0i) 0.0)
(num-test (acos -1.0-0.0i) pi)
(num-test (acos 1.0+0.00000001i) 0.00009999999992-0.00010000000008i)
(num-test (acos -1.0+0.00000001i) 3.14149265358988-0.00010000000008i)
(num-test (acos 1.0-0.00000001i) 0.00009999999992+0.00010000000008i)
(num-test (acos -1.0-0.00000001i) 3.14149265358988+0.00010000000008i)
(num-test (acos 1.0+1.0i) 0.90455689430238-1.06127506190504i)
(num-test (acos -1.0+1.0i) 2.23703575928741-1.06127506190504i)
(num-test (acos 1.0-1.0i) 0.90455689430238+1.06127506190504i)
(num-test (acos -1.0-1.0i) 2.23703575928741+1.06127506190504i)
(num-test (acos 1.0+3.14159265358979i) 1.27521129258327-1.90462768697066i)
(num-test (acos -1.0+3.14159265358979i) 1.86638136100653-1.90462768697066i)
(num-test (acos 1.0-3.14159265358979i) 1.27521129258327+1.90462768697066i)
(num-test (acos -1.0-3.14159265358979i) 1.86638136100653+1.90462768697066i)
(num-test (acos 1.0+2.71828182845905i) 1.23635355491853-1.77905438385935i)
(num-test (acos -1.0+2.71828182845905i) 1.90523909867127-1.77905438385935i)
(num-test (acos 1.0-2.71828182845905i) 1.23635355491853+1.77905438385935i)
(num-test (acos -1.0-2.71828182845905i) 1.90523909867127+1.77905438385935i)
(num-test (acos 1.0+1234.0i) 1.56998595446684-7.81116387772663i)
(num-test (acos -1.0+1234.0i) 1.57160669912296-7.81116387772663i)
(num-test (acos 1.0-1234.0i) 1.56998595446690+7.81116387755283i)
(num-test (acos -1.0-1234.0i) 1.57160669912289+7.81116387755283i)
(num-test (acos 1.0-1234000000.0i) 1.57079632598452+21.62667394298955i)
(num-test (acos -1.0-1234000000.0i) 1.57079632760527+21.62667394298955i)
(num-test (acos 3.14159265358979+0.0i) 0.0-1.81152627246085i)
(num-test (acos -3.14159265358979+0.0i) 3.14159265358979-1.81152627246085i)
(num-test (acos 3.14159265358979-0.0i) 0.0-1.81152627246085i)
(num-test (acos -3.14159265358979-0.0i) 3.14159265358979-1.81152627246085i)
(num-test (acos 3.14159265358979+0.00000001i) 0.00000000335775-1.81152627246085i)
(num-test (acos -3.14159265358979+0.00000001i) 3.14159265023205-1.81152627246085i)
(num-test (acos 3.14159265358979-0.00000001i) 0.00000000335775+1.81152627246085i)
(num-test (acos -3.14159265358979-0.00000001i) 3.14159265023205+1.81152627246085i)
(num-test (acos 3.14159265358979+1.0i) 0.32225329398146-1.86711439316026i)
(num-test (acos -3.14159265358979+1.0i) 2.81933935960833-1.86711439316026i)
(num-test (acos 3.14159265358979-1.0i) 0.32225329398146+1.86711439316026i)
(num-test (acos -3.14159265358979-1.0i) 2.81933935960833+1.86711439316026i)
(num-test (acos 3.14159265358979+3.14159265358979i) 0.79805654766741-2.18469104082751i)
(num-test (acos -3.14159265358979+3.14159265358979i) 2.34353610592238-2.18469104082751i)
(num-test (acos 3.14159265358979-3.14159265358979i) 0.79805654766741+2.18469104082751i)
(num-test (acos -3.14159265358979-3.14159265358979i) 2.34353610592238+2.18469104082751i)
(num-test (acos 3.14159265358979+2.71828182845905i) 0.72769976263454-2.11552790803290i)
(num-test (acos -3.14159265358979+2.71828182845905i) 2.41389289095525-2.11552790803290i)
(num-test (acos 3.14159265358979-2.71828182845905i) 0.72769976263454+2.11552790803290i)
(num-test (acos -3.14159265358979-2.71828182845905i) 2.41389289095525+2.11552790803290i)
(num-test (acos 3.14159265358979+1234.0i) 1.56825047198589-7.81116678966949i)
(num-test (acos -3.14159265358979+1234.0i) 1.57334218160390-7.81116678966949i)
(num-test (acos 3.14159265358979-1234.0i) 1.56825047198552+7.81116678989204i)
(num-test (acos -3.14159265358979-1234.0i) 1.57334218160427+7.81116678989204i)
(num-test (acos 3.14159265358979-1234000000.0i) 1.57079632424904+21.62667394298955i)
(num-test (acos -3.14159265358979-1234000000.0i) 1.57079632934076+21.62667394298955i)
(num-test (acos 2.71828182845905+0.0i) 0.0-1.65745445415308i)
(num-test (acos -2.71828182845905+0.0i) 3.14159265358979-1.65745445415308i)
(num-test (acos 2.71828182845905-0.0i) 0.0-1.65745445415308i)
(num-test (acos -2.71828182845905-0.0i) 3.14159265358979-1.65745445415308i)
(num-test (acos 2.71828182845905+0.00000001i) 0.00000000395623-1.65745445415308i)
(num-test (acos -2.71828182845905+0.00000001i) 3.14159264963356-1.65745445415308i)
(num-test (acos 2.71828182845905-0.00000001i) 0.00000000395623+1.65745445415308i)
(num-test (acos -2.71828182845905-0.00000001i) 3.14159264963356+1.65745445415308i)
(num-test (acos 2.71828182845905+1.0i) 0.37321824160908-1.73375471569385i)
(num-test (acos -2.71828182845905+1.0i) 2.76837441198071-1.73375471569385i)
(num-test (acos 2.71828182845905-1.0i) 0.37321824160908+1.73375471569385i)
(num-test (acos -2.71828182845905-1.0i) 2.76837441198071+1.73375471569385i)
(num-test (acos 2.71828182835905+3.14159265358979i) 0.87174835684834-2.11968336368048i)
(num-test (acos -2.71828182845905+3.14159265358979i) 2.26984429674145-2.11968336368048i)
(num-test (acos 2.71828182845905-3.14159265358979i) 0.87174835684834+2.11968336368048i)
(num-test (acos -2.71828182845905-3.14159265358979i) 2.26984429674145+2.11968336368048i)
(num-test (acos 2.71828182845905+2.71828182845905i) 0.80229897091015-2.04014932880026i)
(num-test (acos -2.71828182845905+2.71828182845905i) 2.33929368267965-2.04014932880026i)
(num-test (acos 2.71828182845905-2.71828182845905i) 0.80229897091014+2.04014932880026i)
(num-test (acos -2.71828182845905-2.71828182845905i) 2.33929368267965+2.04014932880026i)
(num-test (acos 2.71828182845905+1234.0i) 1.56859350950254-7.81116597510553i)
(num-test (acos -2.71828182845905+1234.0i) 1.57299914408725-7.81116597510553i)
(num-test (acos 2.71828182845905-1234.0i) 1.56859350950221+7.81116597540442i)
(num-test (acos -2.71828182845905-1234.0i) 1.57299914408758+7.81116597540442i)
(num-test (acos 2.71828182845905-1234000000.0i) 1.57079632459208+21.62667394298955i)
(num-test (acos -2.71828182845905-1234000000.0i) 1.57079632899772+21.62667394298955i)
(num-test (acos 1234.0+0.0i) 0.0-7.81116322068415i)
(num-test (acos -1234.0+0.0i) 3.14159265358979-7.81116322068415i)
(num-test (acos 1234.0-0.0i) 0.0-7.81116322068415i)
(num-test (acos -1234.0-0.0i) 3.14159265358979-7.81116322068415i)
(num-test (acos 1234.0+0.00000001i) 0.00000000000810-7.81116322068415i)
(num-test (acos -1234.0+0.00000001i) 3.14159265358169-7.81116322068415i)
(num-test (acos 1234.0-0.00000001i) 0.00000000000810+7.81116322084923i)
(num-test (acos -1234.0-0.00000001i) 3.14159265358169+7.81116322084923i)
(num-test (acos 1234.0+1.0i) 0.00081037286048-7.81116354944842i)
(num-test (acos -1234.0+1.0i) 3.14078228072931-7.81116354944842i)
(num-test (acos 1234.0-1.0i) 0.00081037286017+7.81116354920146i)
(num-test (acos -1234.0-1.0i) 3.14078228072962+7.81116354920146i)
(num-test (acos 1234.0+3.14159265358979i) 0.00254585647983-7.81116646138554i)
(num-test (acos -1234.0+3.14159265358979i) 3.13904679710996-7.81116646138554i)
(num-test (acos 1234.0-3.14159265358979i) 0.00254585648123+7.81116646154641i)
(num-test (acos -1234.0-3.14159265358979i) 3.13904679710856+7.81116646154641i)
(num-test (acos 1234.0+2.71828182845905i) 0.00220281873947-7.81116564738434i)
(num-test (acos -1234.0+2.71828182845905i) 3.13938983485033-7.81116564738434i)
(num-test (acos 1234.0-2.71828182845905i) 0.00220281873928+7.81116564705719i)
(num-test (acos -1234.0-2.71828182845905i) 3.13938983485052+7.81116564705719i)
(num-test (acos 1234.0+1234.0i) 0.78539824532655-8.15773697538346i)
(num-test (acos -1234.0+1234.0i) 2.35619440826324-8.15773697538346i)
(num-test (acos 1234.0-1234.0i) 0.78539824548545+8.15773697530526i)
(num-test (acos -1234.0-1234.0i) 2.35619440810434+8.15773697530526i)
(num-test (acos 1234.0-1234000000.0i) 1.57079532679490+21.62667394299005i)
(num-test (acos -1234.0-1234000000.0i) 1.57079732679490+21.62667394299005i)
(num-test (acos 1234000000.0-0.00000001i) 0.0+21.62667394298955i)
(num-test (acos -1234000000.0-0.00000001i) 3.14159265358979+21.62667394298955i)
(num-test (acos 1234000000.0-1.0i) 0.00000000081037+21.62667394298955i)
(num-test (acos -1234000000.0-1.0i) 3.14159265277942+21.62667394298955i)
(num-test (acos 1234000000.0-3.14159265358979i) 0.00000000254586+21.62667394298955i)
(num-test (acos -1234000000.0-3.14159265358979i) 3.14159265104393+21.62667394298955i)
(num-test (acos 1234000000.0-2.71828182845905i) 0.00000000220282+21.62667394298955i)
(num-test (acos -1234000000.0-2.71828182845905i) 3.14159265138697+21.62667394298955i)
(num-test (acos 1234000000.0-1234.0i) 0.00000100000000+21.62667394299005i)
(num-test (acos -1234000000.0-1234.0i) 3.14159165358979+21.62667394299005i)
(num-test (acos 1234000000.0-1234000000.0i) 0.78539816339745+21.97324753326953i)
(num-test (acos -1234000000.0-1234000000.0i) 2.35619449019234+21.97324753326953i)
(num-test (acos -2.0) 3.141592653589793-1.316957896924817i)
(num-test (acos 3.0+70000000i) 1.570796283937754-18.7571529895002i) ; C breaks near here
(num-test (acos 70000000+3i) 4.725807101202406E-8-18.75715298057358i)
(num-test (acos 3.0-70000000i) 1.570796283937754+18.7571529895002i)
(num-test (acos -70000000+3i) 3.141592606331722-18.75715298057358i)
(num-test (acos 1.5) 0.0+0.9624236501192069i)
(num-test (acos -1.5) 3.141592653589793-0.9624236501192069i)
(num-test (acos -1.0e+01) 3.1415926535897932385e0-2.9932228461263808979e0i)
(num-test (acos -2.0e+00) 3.1415926535897932385e0-1.3169578969248167086e0i)
(num-test (acos -1.0e+00) 3.1415926535897932385e0)
(num-test (acos -7.50e-01) 2.4188584057763776273e0)
(num-test (acos -5.0e-01) 2.0943951023931954923e0)
(num-test (acos -1.250e-01) 1.6961241579629620161e0)
(num-test (acos -3.45266983001243932001e-04) 1.5711415937847577022e0)
(num-test (acos -1.19209289550781250e-07) 1.570796446004186170e0)
(num-test (acos 0.0e+00) 1.5707963267948966192e0)
(num-test (acos 1.19209289550781250e-07) 1.5707962075856070684e0)
(num-test (acos 3.45266983001243932001e-04) 1.5704510598050355363e0)
(num-test (acos 1.250e-01) 1.4454684956268312224e0)
(num-test (acos 5.0e-01) 1.0471975511965977462e0)
(num-test (acos 7.50e-01) 7.2273424781341561118e-1)
(num-test (acos 1.0e+00) 0e0)
(num-test (acos 2.0e+00) 0+1.3169578969248167086e0i)
(num-test (acos 1.0e+01) 0+2.9932228461263808979e0i)
(num-test (acos 0.0e+00+0.0e+00i) 1.5707963267948966192e0)
(num-test (acos 0.0e+00+1.19209289550781250e-07i) 1.5707963267948966192e0-1.1920928955078096766e-7i)
(num-test (acos 0.0e+00-1.19209289550781250e-07i) 1.5707963267948966192e0+1.1920928955078096766e-7i)
(num-test (acos 0.0e+00+5.0e-01i) 1.5707963267948966192e0-4.8121182505960344750e-1i)
(num-test (acos 0.0e+00-5.0e-01i) 1.5707963267948966192e0+4.8121182505960344750e-1i)
(num-test (acos 0.0e+00+1.0e+00i) 1.5707963267948966192e0-8.8137358701954302523e-1i)
(num-test (acos 0.0e+00-1.0e+00i) 1.5707963267948966192e0+8.8137358701954302523e-1i)
(num-test (acos 0.0e+00+2.0e+00i) 1.5707963267948966192e0-1.4436354751788103425e0i)
(num-test (acos 0.0e+00-2.0e+00i) 1.5707963267948966192e0+1.4436354751788103425e0i)
(num-test (acos 0.0e+00+8.3886080e+06i) 1.5707963267948966192e0-1.6635532333438690979e1i)
(num-test (acos 0.0e+00-8.3886080e+06i) 1.5707963267948966192e0+1.6635532333438690979e1i)
(num-test (acos 1.19209289550781250e-07+0.0e+00i) 1.5707962075856070684e0)
(num-test (acos -1.19209289550781250e-07+0.0e+00i) 1.570796446004186170e0)
(num-test (acos 1.19209289550781250e-07+1.19209289550781250e-07i) 1.5707962075856070685e0-1.1920928955078181469e-7i)
(num-test (acos 1.19209289550781250e-07-1.19209289550781250e-07i) 1.5707962075856070685e0+1.1920928955078181469e-7i)
(num-test (acos -1.19209289550781250e-07+1.19209289550781250e-07i) 1.570796446004186170e0-1.1920928955078181469e-7i)
(num-test (acos -1.19209289550781250e-07-1.19209289550781250e-07i) 1.570796446004186170e0+1.1920928955078181469e-7i)
(num-test (acos 1.19209289550781250e-07+5.0e-01i) 1.5707962201708666252e0-4.8121182505960598961e-1i)
(num-test (acos 1.19209289550781250e-07-5.0e-01i) 1.5707962201708666252e0+4.8121182505960598961e-1i)
(num-test (acos -1.19209289550781250e-07+5.0e-01i) 1.5707964334189266132e0-4.8121182505960598961e-1i)
(num-test (acos -1.19209289550781250e-07-5.0e-01i) 1.5707964334189266132e0+4.8121182505960598961e-1i)
(num-test (acos 1.19209289550781250e-07+1.0e+00i) 1.5707962425011995974e0-8.8137358701954553738e-1i)
(num-test (acos 1.19209289550781250e-07-1.0e+00i) 1.5707962425011995974e0+8.8137358701954553738e-1i)
(num-test (acos -1.19209289550781250e-07+1.0e+00i) 1.5707964110885936410e0-8.8137358701954553738e-1i)
(num-test (acos -1.19209289550781250e-07-1.0e+00i) 1.5707964110885936410e0+8.8137358701954553738e-1i)
(num-test (acos 1.19209289550781250e-07+2.0e+00i) 1.5707962734828816222e0-1.4436354751788116136e0i)
(num-test (acos 1.19209289550781250e-07-2.0e+00i) 1.5707962734828816222e0+1.4436354751788116136e0i)
(num-test (acos -1.19209289550781250e-07+2.0e+00i) 1.5707963801069116162e0-1.4436354751788116136e0i)
(num-test (acos -1.19209289550781250e-07-2.0e+00i) 1.5707963801069116162e0+1.4436354751788116136e0i)
(num-test (acos 1.19209289550781250e-07+8.3886080e+06i) 1.5707963267948824084e0-1.6635532333438690979e1i)
(num-test (acos 1.19209289550781250e-07-8.3886080e+06i) 1.5707963267948824084e0+1.6635532333438690979e1i)
(num-test (acos -1.19209289550781250e-07+8.3886080e+06i) 1.5707963267949108301e0-1.6635532333438690979e1i)
(num-test (acos -1.19209289550781250e-07-8.3886080e+06i) 1.5707963267949108301e0+1.6635532333438690979e1i)
(num-test (acos 5.0e-01+0.0e+00i) 1.0471975511965977462e0)
(num-test (acos -5.0e-01+0.0e+00i) 2.0943951023931954923e0)
(num-test (acos 5.0e-01+1.19209289550781250e-07i) 1.0471975511966032159e0-1.3765103082409432364e-7i)
(num-test (acos 5.0e-01-1.19209289550781250e-07i) 1.0471975511966032159e0+1.3765103082409432364e-7i)
(num-test (acos -5.0e-01+1.19209289550781250e-07i) 2.0943951023931900225e0-1.3765103082409432364e-7i)
(num-test (acos -5.0e-01-1.19209289550781250e-07i) 2.0943951023931900225e0+1.3765103082409432364e-7i)
(num-test (acos 5.0e-01+5.0e-01i) 1.1185178796437059372e0-5.3063753095251782602e-1i)
(num-test (acos 5.0e-01-5.0e-01i) 1.1185178796437059372e0+5.3063753095251782602e-1i)
(num-test (acos -5.0e-01+5.0e-01i) 2.0230747739460873013e0-5.3063753095251782602e-1i)
(num-test (acos -5.0e-01-5.0e-01i) 2.0230747739460873013e0+5.3063753095251782602e-1i)
(num-test (acos 5.0e-01+1.0e+00i) 1.2213572639376833256e0-9.2613303135018242455e-1i)
(num-test (acos 5.0e-01-1.0e+00i) 1.2213572639376833256e0+9.2613303135018242455e-1i)
(num-test (acos -5.0e-01+1.0e+00i) 1.9202353896521099129e0-9.2613303135018242455e-1i)
(num-test (acos -5.0e-01-1.0e+00i) 1.9202353896521099129e0+9.2613303135018242455e-1i)
(num-test (acos 5.0e-01+2.0e+00i) 1.3497776911720127603e0-1.4657153519472905218e0i)
(num-test (acos 5.0e-01-2.0e+00i) 1.3497776911720127603e0+1.4657153519472905218e0i)
(num-test (acos -5.0e-01+2.0e+00i) 1.7918149624177804781e0-1.4657153519472905218e0i)
(num-test (acos -5.0e-01-2.0e+00i) 1.7918149624177804781e0+1.4657153519472905218e0i)
(num-test (acos 5.0e-01+8.3886080e+06i) 1.5707962671902518438e0-1.6635532333438692755e1i)
(num-test (acos 5.0e-01-8.3886080e+06i) 1.5707962671902518438e0+1.6635532333438692755e1i)
(num-test (acos -5.0e-01+8.3886080e+06i) 1.5707963863995413946e0-1.6635532333438692755e1i)
(num-test (acos -5.0e-01-8.3886080e+06i) 1.5707963863995413946e0+1.6635532333438692755e1i)
(num-test (acos 1.0e+00+0.0e+00i) 0e0)
(num-test (acos -1.0e+00+0.0e+00i) 3.1415926535897932385e0)
(num-test (acos 1.0e+00+1.19209289550781250e-07i) 3.4526697957132450399e-4-3.4526698643116312881e-4i)
(num-test (acos 1.0e+00-1.19209289550781250e-07i) 3.4526697957132450399e-4+3.4526698643116312881e-4i)
(num-test (acos -1.0e+00+1.19209289550781250e-07i) 3.1412473866102219140e0-3.4526698643116312881e-4i)
(num-test (acos -1.0e+00-1.19209289550781250e-07i) 3.1412473866102219140e0+3.4526698643116312881e-4i)
(num-test (acos 1.0e+00+5.0e-01i) 6.7488884558600638016e-1-7.3285767597364526089e-1i)
(num-test (acos 1.0e+00-5.0e-01i) 6.7488884558600638016e-1+7.3285767597364526089e-1i)
(num-test (acos -1.0e+00+5.0e-01i) 2.4667038080037868583e0-7.3285767597364526089e-1i)
(num-test (acos -1.0e+00-5.0e-01i) 2.4667038080037868583e0+7.3285767597364526089e-1i)
(num-test (acos 1.0e+00+1.0e+00i) 9.0455689430238136413e-1-1.0612750619050356520e0i)
(num-test (acos 1.0e+00-1.0e+00i) 9.0455689430238136413e-1+1.0612750619050356520e0i)
(num-test (acos -1.0e+00+1.0e+00i) 2.2370357592874118743e0-1.0612750619050356520e0i)
(num-test (acos -1.0e+00-1.0e+00i) 2.2370357592874118743e0+1.0612750619050356520e0i)
(num-test (acos 1.0e+00+2.0e+00i) 1.1437177404024204938e0-1.5285709194809981613e0i)
(num-test (acos 1.0e+00-2.0e+00i) 1.1437177404024204938e0+1.5285709194809981613e0i)
(num-test (acos -1.0e+00+2.0e+00i) 1.9978749131873727447e0-1.5285709194809981613e0i)
(num-test (acos -1.0e+00-2.0e+00i) 1.9978749131873727447e0+1.5285709194809981613e0i)
(num-test (acos 1.0e+00+8.3886080e+06i) 1.5707962075856070685e0-1.6635532333438698084e1i)
(num-test (acos 1.0e+00-8.3886080e+06i) 1.5707962075856070685e0+1.6635532333438698084e1i)
(num-test (acos -1.0e+00+8.3886080e+06i) 1.570796446004186170e0-1.6635532333438698084e1i)
(num-test (acos -1.0e+00-8.3886080e+06i) 1.570796446004186170e0+1.6635532333438698084e1i)
(num-test (acos 2.0e+00+0.0e+00i) 0+1.3169578969248167086e0i)
(num-test (acos -2.0e+00+0.0e+00i) 3.1415926535897932385e0-1.3169578969248167086e0i)
(num-test (acos 2.0e+00+1.19209289550781250e-07i) 6.8825515412047433504e-8-1.3169578969248194435e0i)
(num-test (acos 2.0e+00-1.19209289550781250e-07i) 6.8825515412047433504e-8+1.3169578969248194435e0i)
(num-test (acos -2.0e+00+1.19209289550781250e-07i) 3.1415925847642778264e0-1.3169578969248194435e0i)
(num-test (acos -2.0e+00-1.19209289550781250e-07i) 3.1415925847642778264e0+1.3169578969248194435e0i)
(num-test (acos 2.0e+00+5.0e-01i) 2.7775425655771396018e-1-1.3618009008578457882e0i)
(num-test (acos 2.0e+00-5.0e-01i) 2.7775425655771396018e-1+1.3618009008578457882e0i)
(num-test (acos -2.0e+00+5.0e-01i) 2.8638383970320792783e0-1.3618009008578457882e0i)
(num-test (acos -2.0e+00-5.0e-01i) 2.8638383970320792783e0+1.3618009008578457882e0i)
(num-test (acos 2.0e+00+1.0e+00i) 5.0735630321714456304e-1-1.4693517443681852733e0i)
(num-test (acos 2.0e+00-1.0e+00i) 5.0735630321714456304e-1+1.4693517443681852733e0i)
(num-test (acos -2.0e+00+1.0e+00i) 2.6342363503726486754e0-1.4693517443681852733e0i)
(num-test (acos -2.0e+00-1.0e+00i) 2.6342363503726486754e0+1.4693517443681852733e0i)
(num-test (acos 2.0e+00+2.0e+00i) 8.1654718209685057852e-1-1.7343245214879664480e0i)
(num-test (acos 2.0e+00-2.0e+00i) 8.1654718209685057852e-1+1.7343245214879664480e0i)
(num-test (acos -2.0e+00+2.0e+00i) 2.3250454714929426599e0-1.7343245214879664480e0i)
(num-test (acos -2.0e+00-2.0e+00i) 2.3250454714929426599e0+1.7343245214879664480e0i)
(num-test (acos 2.0e+00+8.3886080e+06i) 1.5707960883763175177e0-1.663553233343871940e1i)
(num-test (acos 2.0e+00-8.3886080e+06i) 1.5707960883763175177e0+1.663553233343871940e1i)
(num-test (acos -2.0e+00+8.3886080e+06i) 1.5707965652134757208e0-1.663553233343871940e1i)
(num-test (acos -2.0e+00-8.3886080e+06i) 1.5707965652134757208e0+1.663553233343871940e1i)
(num-test (acos 8.3886080e+06+0.0e+00i) 0+1.6635532333438683873e1i)
(num-test (acos -8.3886080e+06+0.0e+00i) 3.1415926535897932385e0-1.6635532333438683873e1i)
(num-test (acos 8.3886080e+06+1.19209289550781250e-07i) 1.4210854715202104692e-14-1.6635532333438683873e1i)
(num-test (acos 8.3886080e+06-1.19209289550781250e-07i) 1.4210854715202104692e-14+1.6635532333438683873e1i)
(num-test (acos -8.3886080e+06+1.19209289550781250e-07i) 3.1415926535897790276e0-1.6635532333438683873e1i)
(num-test (acos -8.3886080e+06-1.19209289550781250e-07i) 3.1415926535897790276e0+1.6635532333438683873e1i)
(num-test (acos 8.3886080e+06+5.0e-01i) 5.9604644775390977930e-8-1.6635532333438685650e1i)
(num-test (acos 8.3886080e+06-5.0e-01i) 5.9604644775390977930e-8+1.6635532333438685650e1i)
(num-test (acos -8.3886080e+06+5.0e-01i) 3.1415925939851484631e0-1.6635532333438685650e1i)
(num-test (acos -8.3886080e+06-5.0e-01i) 3.1415925939851484631e0+1.6635532333438685650e1i)
(num-test (acos 8.3886080e+06+1.0e+00i) 1.1920928955078153234e-7-1.6635532333438690979e1i)
(num-test (acos 8.3886080e+06-1.0e+00i) 1.1920928955078153234e-7+1.6635532333438690979e1i)
(num-test (acos -8.3886080e+06+1.0e+00i) 3.1415925343805036877e0-1.6635532333438690979e1i)
(num-test (acos -8.3886080e+06-1.0e+00i) 3.1415925343805036877e0+1.6635532333438690979e1i)
(num-test (acos 8.3886080e+06+2.0e+00i) 2.3841857910155967656e-7-1.6635532333438712295e1i)
(num-test (acos 8.3886080e+06-2.0e+00i) 2.3841857910155967656e-7+1.6635532333438712295e1i)
(num-test (acos -8.3886080e+06+2.0e+00i) 3.1415924151712141369e0-1.6635532333438712295e1i)
(num-test (acos -8.3886080e+06-2.0e+00i) 3.1415924151712141369e0+1.6635532333438712295e1i)
(num-test (acos 8.3886080e+06+8.3886080e+06i) 7.8539816339745008597e-1-1.6982105923718660081e1i)
(num-test (acos 8.3886080e+06-8.3886080e+06i) 7.8539816339745008597e-1+1.6982105923718660081e1i)
(num-test (acos -8.3886080e+06+8.3886080e+06i) 2.3561944901923431525e0-1.6982105923718660081e1i)
(num-test (acos -8.3886080e+06-8.3886080e+06i) 2.3561944901923431525e0+1.6982105923718660081e1i)
(num-test (acos 1234000000/3) 0+20.52806165432143i) 
(num-test (acos 0.00000001+1234000000.0i) 1.570796326794897-21.62667380877375i) 
(num-test (acos 3.14159265358979+1234000000.0i) 1.570796324249036-21.62667380877375i) 
(num-test (acos 2.71828182845905+1234000000.0i) 1.570796324592076-21.62667380877375i) 
(num-test (acos 1234000000.0+0.00000001i) -4.051865509779873E-10-21.62667394298955i) 
(num-test (acos 1234000000.0+3.14159265358979i) -4.051865509779873E-10-21.62667394298955i) 
(num-test (acos 1234000000.0+2.71828182845905i) -4.051865509779873E-10-21.62667394298955i) 
(num-test (acos -64983.97009220963-48983.30494825104i) 2.495679792792491+12.0i)
(num-test (acos -2.225073858507201399999999999999999999996E-308) 1.570796326794896619231321691639751442098E0)
(num-test (acos 1.110223024625156799999999999999999999997E-16) 1.570796326794896508209019229124071442098E0)
(num-test (acos (/ (sqrt 2) 2)) (/ pi 4))
(num-test (acos (/ (sqrt 3) -2)) (- pi (/ pi 6)))
(num-test (acos 1.00001) 0.0+0.004472132228240686i)

(for-each
 (lambda (num-and-val)
   (let ((num (car num-and-val)) (val (cadr num-and-val))) (num-test-1 'acos num (acos num) val)))
 (vector (list 0 1.5707963267949) (list 1 0) (list 2 0+1.3169578969248i) (list 3 0+1.7627471740391i) 
	 (list -1 3.1415926535898) (list -2 3.1415926535898-1.3169578969248i) (list -3 3.1415926535898-1.7627471740391i) 
	 (list 9223372036854775807 0+44.361419555836i) (list -9223372036854775808 3.1415926535898-44.361419555836i) 
	 (list 1/2 1.0471975511966) (list 1/3 1.2309594173408) (list -1/2 2.0943951023932) 
	 (list -1/3 1.910633236249) (list 1/9223372036854775807 1.5707963267949) (list 0.0 1.5707963267949) 
	 (list 1.0 0.0) (list 2.0 0+1.3169578969248i) (list -2.0 3.1415926535898-1.3169578969248i) 
	 (list 1.000000000000000000000000000000000000002E-309 1.570796326794896619231321691639751442098E0) 
	 (list 1e+16 0+37.534508668465i) (list 0+1i 1.5707963267949-0.88137358701954i) (list 0+2i 1.5707963267949-1.4436354751788i) 
	 (list 0-1i 1.5707963267949+0.88137358701954i) (list 1+1i 0.90455689430238-1.061275061905i) 
	 (list 1-1i 0.90455689430238+1.061275061905i) (list -1+1i 2.2370357592874-1.061275061905i) 
	 (list -1-1i 2.2370357592874+1.061275061905i) (list 0.1+0.1i 1.4711326239351-0.10033029811221i) 
	 (list 1e+16+1e+16i 0.78539816339745-37.881082258745i) (list 1e-16+1e-16i 1.5707963267949-1.1102230246252e-16i) 
	 ))
  
(let ((err 0.0)
      (mx 0.0))
  (do ((i 0 (+ i 1))
       (x -10.0 (+ x .1)))
      ((= i 200))
    (let ((y (magnitude (- x (cos (acos x))))))
      (if (> y err) (begin (set! mx x) (set! err y)))))
  (if (> err 1e-12)
      (format #t ";(cos (acos ~A)) error: ~A~%" mx err)))

(let ((err 0.0)
      (mx 0.0))
  (do ((i 0 (+ i 1))
       (x 1.0-i (+ x -0.1+0.1i)))
      ((= i 200))
    (let ((y (magnitude (- x (cos (acos x))))))
      (if (> y err) (begin (set! mx x) (set! err y)))))
  (if (> err 1e-10)
      (format #t ";(cos (acos ~A)) error: ~A~%" mx err)))

(test (acos) 'error)
(test (acos "hi") 'error)
(test (acos 1.0+23.0i 1.0+23.0i) 'error)
(test (acos 0 1) 'error)

(for-each
 (lambda (arg)
   (test (acos arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))

(when with-bignums
  (let-temporarily (((*s7* 'bignum-precision) 500))
    (let ((acoss (list ; table[Arccos[k/30], {k, 0, 30}]
		  1.57079632679489661923132169163975144209858469968755291048747229615390
		  1.53745681753359453223988681086891283292292532113625627655066835871028
		  1.50408017838467135968591658836938216800673525534100887774094632497961
		  1.47062890563333682288579851218705812352990872745792336909644844111750
		  1.43706473738495509057499836447665401198452971694311125503288353691013
		  1.40334824757520728867804708559611322118362753737131459002168499242061
		  1.36943840600456582777619613942212803185854661828532452423022105269829
		  1.33529209007409682793843720770251587561752235709223993234205546563727
		  1.30086353096149317480670670185123279844211132541734789265785186982011
		  1.26610367277949911125931873041222227514402466798077652309449434740743
		  1.23095941734077468213492917824798737571034000935509483905554833366399
		  1.19537271881385721554615623455760435715187934648129893552739216960977
		  1.15927948072740859984658379402241583724288356456052705870352551545381
		  1.12260819081546532929088412859068667091828551922412210328535011759677
		  1.08527820449930545595908733261492699446689960474554094922793682396904
		  1.04719755119659774615421446109316762806572313312503527365831486410260
		  1.00826008225104099949999603469121825039880976563585012769196847054621
		  0.96834169340990606798268790382508246937722069157058123211232815740883
		  0.92729521800161223242851246292242880405707410857224052762186617744039
		  0.88494336217618586326804097370954035732954766028628186644588911389624
		  0.84106867056793025577652503182643074670207878563983921977852280469208
		  0.79539883018414355549096833892476432854279596104639091688975233242118
		  0.74758434966902079779334463157739345981404639083611183363842437021388
		  0.69716313364223229572063988249255120236401774508773180005252393361250
		  0.64350110879328438680280922871732263804151059111531238286560611871351
		  0.58568554345715095961775753847751776620036106717164150265055932722126
		  0.52231482180604862252409882585570327600888093754313181958478744889757
		  0.45102681179626243254464463579435182620342251328425002811179043223947
		  0.36720802055783714250547291370122530624718492018835635003632767844945
		  0.25892154200622121576539021530016406277243818456467068559928913571945
		  0.00000000000000000000000000000000000000000000000000000000000000000000e0)))
      (do ((i 0 (+ i 1)))
	  ((= i 30))
	(let ((val (acos (/ i (bignum "30")))))
	  (if (> (magnitude (- val (list-ref acoss i))) 1e-36)
	      (format #t ";(acos ~A) -> ~A ~A~%[~A]~%" (/ i 30) val (list-ref acoss i) (magnitude (- val (list-ref acoss i))))))))))



;;; --------------------------------------------------------------------------------
;;; atan
;;; --------------------------------------------------------------------------------

(num-test (atan 0) 0.0)
(num-test (atan 1) 0.78539816339745)
(num-test (atan -1) -0.78539816339745)
(num-test (atan 2) 1.10714871779409)
(num-test (atan -2) -1.10714871779409)
(num-test (atan 3) 1.24904577239825)
(num-test (atan -3) -1.24904577239825)
(num-test (atan 10) 1.47112767430373)
(num-test (atan -10) -1.47112767430373)
(num-test (atan 1234) 1.56998595420081)
(num-test (atan -1234) -1.56998595420081)
(num-test (atan 0/1) 0.0)
(num-test (atan 0/2) 0.0)
(num-test (atan 0/3) 0.0)
(num-test (atan 0/10) 0.0)
(num-test (atan 0/1234) 0.0)
(num-test (atan 0/1234000000) 0.0)
(num-test (atan 0/500029) 0.0)
(num-test (atan 0/362880) 0.0)
(num-test (atan 1/1) 0.78539816339745)
(num-test (atan -1/1) -0.78539816339745)
(num-test (atan 1/2) 0.46364760900081)
(num-test (atan -1/2) -0.46364760900081)
(num-test (atan 1/3) 0.32175055439664)
(num-test (atan -1/3) -0.32175055439664)
(num-test (atan 1/10) 0.09966865249116)
(num-test (atan -1/10) -0.09966865249116)
(num-test (atan 1/1234) 0.00081037259408)
(num-test (atan -1/1234) -0.00081037259408)
(num-test (atan 1/1234000000) 0.00000000081037)
(num-test (atan -1/1234000000) -0.00000000081037)
(num-test (atan 1/500029) 0.00000199988401)
(num-test (atan -1/500029) -0.00000199988401)
(num-test (atan 1/362880) 0.00000275573192)
(num-test (atan -1/362880) -0.00000275573192)
(num-test (atan 2/1) 1.10714871779409)
(num-test (atan -2/1) -1.10714871779409)
(num-test (atan 2/2) 0.78539816339745)
(num-test (atan -2/2) -0.78539816339745)
(num-test (atan 2/3) 0.58800260354757)
(num-test (atan -2/3) -0.58800260354757)
(num-test (atan 2/10) 0.19739555984988)
(num-test (atan -2/10) -0.19739555984988)
(num-test (atan 2/1234) 0.00162074412382)
(num-test (atan -2/1234) -0.00162074412382)
(num-test (atan 2/1234000000) 0.00000000162075)
(num-test (atan -2/1234000000) -0.00000000162075)
(num-test (atan 2/500029) 0.00000399976801)
(num-test (atan -2/500029) -0.00000399976801)
(num-test (atan 2/362880) 0.00000551146384)
(num-test (atan -2/362880) -0.00000551146384)
(num-test (atan 3/1) 1.24904577239825)
(num-test (atan -3/1) -1.24904577239825)
(num-test (atan 3/2) 0.98279372324733)
(num-test (atan -3/2) -0.98279372324733)
(num-test (atan 3/3) 0.78539816339745)
(num-test (atan -3/3) -0.78539816339745)
(num-test (atan 3/10) 0.29145679447787)
(num-test (atan -3/10) -0.29145679447787)
(num-test (atan 3/1234) 0.00243111352487)
(num-test (atan -3/1234) -0.00243111352487)
(num-test (atan 3/1234000000) 0.00000000243112)
(num-test (atan -3/1234000000) -0.00000000243112)
(num-test (atan 3/500029) 0.00000599965202)
(num-test (atan -3/500029) -0.00000599965202)
(num-test (atan 3/362880) 0.00000826719577)
(num-test (atan -3/362880) -0.00000826719577)
(num-test (atan 10/1) 1.47112767430373)
(num-test (atan -10/1) -1.47112767430373)
(num-test (atan 10/2) 1.37340076694502)
(num-test (atan -10/2) -1.37340076694502)
(num-test (atan 10/3) 1.27933953231703)
(num-test (atan -10/3) -1.27933953231703)
(num-test (atan 10/10) 0.78539816339745)
(num-test (atan -10/10) -0.78539816339745)
(num-test (atan 10/1234) 0.00810355033005)
(num-test (atan -10/1234) -0.00810355033005)
(num-test (atan 10/1234000000) 0.00000000810373)
(num-test (atan -10/1234000000) -0.00000000810373)
(num-test (atan 10/500029) 0.00001999884006)
(num-test (atan -10/500029) -0.00001999884006)
(num-test (atan 10/362880) 0.00002755731922)
(num-test (atan -10/362880) -0.00002755731922)
(num-test (atan 1234/1) 1.56998595420081)
(num-test (atan -1234/1) -1.56998595420081)
(num-test (atan 1234/2) 1.56917558267108)
(num-test (atan -1234/2) -1.56917558267108)
(num-test (atan 1234/3) 1.56836521327003)
(num-test (atan -1234/3) -1.56836521327003)
(num-test (atan 1234/10) 1.56269277646485)
(num-test (atan -1234/10) -1.56269277646485)
(num-test (atan 1234/1234) 0.78539816339745)
(num-test (atan -1234/1234) -0.78539816339745)
(num-test (atan 1234/1234000000) 0.00000100000000)
(num-test (atan -1234/1234000000) -0.00000100000000)
(num-test (atan 1234/500029) 0.00246785185431)
(num-test (atan -1234/500029) -0.00246785185431)
(num-test (atan 1234/362880) 0.00340056008437)
(num-test (atan -1234/362880) -0.00340056008437)
(num-test (atan 1234000000/1234000000) 0.78539816339745)
(num-test (atan -1234000000/1234000000) -0.78539816339745)
(num-test (atan 1234000000/500029) 1.57039111693053)
(num-test (atan -1234000000/500029) -1.57039111693053)
(num-test (atan 1234000000/362880) 1.57050225873206)
(num-test (atan -1234000000/362880) -1.57050225873206)
(num-test (atan 500029/2) 1.57079232702688)
(num-test (atan -500029/2) -1.57079232702688)
(num-test (atan 500029/3) 1.57079032714288)
(num-test (atan -500029/3) -1.57079032714288)
(num-test (atan 500029/10) 1.57077632795483)
(num-test (atan -500029/10) -1.57077632795483)
(num-test (atan 500029/1234) 1.56832847494059)
(num-test (atan -500029/1234) -1.56832847494059)
(num-test (atan 500029/1234000000) 0.00040520986437)
(num-test (atan -500029/1234000000) -0.00040520986437)
(num-test (atan 500029/500029) 0.78539816339745)
(num-test (atan -500029/500029) -0.78539816339745)
(num-test (atan 500029/362880) 0.94301772831206)
(num-test (atan -500029/362880) -0.94301772831206)
(num-test (atan 362880/2) 1.57079081533105)
(num-test (atan -362880/2) -1.57079081533105)
(num-test (atan 362880/3) 1.57078805959913)
(num-test (atan -362880/3) -1.57078805959913)
(num-test (atan 362880/10) 1.57076876947568)
(num-test (atan -362880/10) -1.57076876947568)
(num-test (atan 362880/1234) 1.56739576671053)
(num-test (atan -362880/1234) -1.56739576671053)
(num-test (atan 362880/1234000000) 0.00029406806284)
(num-test (atan -362880/1234000000) -0.00029406806284)
(num-test (atan 362880/500029) 0.62777859848283)
(num-test (atan -362880/500029) -0.62777859848283)
(num-test (atan 362880/362880) 0.78539816339745)
(num-test (atan -362880/362880) -0.78539816339745)
(num-test (atan 0.0) 0.0)
(num-test (atan 0.00000001) 0.00000001)
(num-test (atan -0.00000001) -0.00000001)
(num-test (atan 1.0) 0.78539816339745)
(num-test (atan -1.0) -0.78539816339745)
(num-test (atan pi) 1.26262725567891)
(num-test (atan -3.14159265358979) -1.26262725567891)
(num-test (atan 2.71828182845905) 1.21828290501728)
(num-test (atan -2.71828182845905) -1.21828290501728)
(num-test (atan 1234.0) 1.56998595420081)
(num-test (atan -1234.0) -1.56998595420081)
(num-test (atan 0.0+0.0i) 0.0)
(num-test (atan -0.0+0.0i) 0.0)
(num-test (atan 0.0-0.0i) 0.0)
(num-test (atan -0.0-0.0i) 0.0)
(num-test (atan 0.0+0.00000001i) 0.0+0.00000001i)
(num-test (atan -0.0+0.00000001i) 0.0+0.00000001i)
(num-test (atan 0.0-0.00000001i) 0.0-0.00000001i)
(num-test (atan -0.0-0.00000001i) -0.0-0.00000001i)
(num-test (atan 0.0+3.14159265358979i) 1.57079632679490+0.32976531495670i)
(num-test (atan -0.0+3.14159265358979i) 1.57079632679490+0.32976531495670i)
(num-test (atan 0.0-3.14159265358979i) 1.57079632679490-0.32976531495670i)
(num-test (atan -0.0-3.14159265358979i) -1.57079632679490-0.32976531495670i)
(num-test (atan 0.0+2.71828182845905i) 1.57079632679490+0.38596841645265i)
(num-test (atan -0.0+2.71828182845905i) 1.57079632679490+0.38596841645265i)
(num-test (atan 0.0-2.71828182845905i) 1.57079632679490-0.38596841645265i)
(num-test (atan -0.0-2.71828182845905i) -1.57079632679490-0.38596841645265i)
(num-test (atan 0.0+1234.0i) 1.57079632679490+0.00081037294887i)
(num-test (atan -0.0+1234.0i) 1.57079632679490+0.00081037294887i)
(num-test (atan 0.0-1234.0i) 1.57079632679490-0.00081037294887i)
(num-test (atan -0.0-1234.0i) -1.57079632679490-0.00081037294887i)
(num-test (atan 0.00000001+0.0i) 0.00000001)
(num-test (atan -0.00000001+0.0i) -0.00000001)
(num-test (atan 0.00000001-0.0i) 0.00000001)
(num-test (atan -0.00000001-0.0i) -0.00000001)
(num-test (atan 0.00000001+0.00000001i) 0.00000001+0.00000001i)
(num-test (atan -0.00000001+0.00000001i) -0.00000001+0.00000001i)
(num-test (atan 0.00000001-0.00000001i) 0.00000001-0.00000001i)
(num-test (atan -0.00000001-0.00000001i) -0.00000001-0.00000001i)
(num-test (atan 0.00000001+1.0i) 0.78539816589789+9.55691396225616i)
(num-test (atan -0.00000001+1.0i) -0.78539816589789+9.55691396225616i)
(num-test (atan 0.00000001-1.0i) 0.78539816589789-9.55691396225616i)
(num-test (atan -0.00000001-1.0i) -0.78539816589789-9.55691396225616i)
(num-test (atan 0.00000001+3.14159265358979i) 1.57079632566745+0.32976531495670i)
(num-test (atan -0.00000001+3.14159265358979i) -1.57079632566745+0.32976531495670i)
(num-test (atan 0.00000001-3.14159265358979i) 1.57079632566745-0.32976531495670i)
(num-test (atan -0.00000001-3.14159265358979i) -1.57079632566745-0.32976531495670i)
(num-test (atan 0.00000001+2.71828182845905i) 1.57079632522972+0.38596841645265i)
(num-test (atan -0.00000001+2.71828182845905i) -1.57079632522972+0.38596841645265i)
(num-test (atan 0.00000001-2.71828182845905i) 1.57079632522972-0.38596841645265i)
(num-test (atan -0.00000001-2.71828182845905i) -1.57079632522972-0.38596841645265i)
(num-test (atan 0.00000001+1234.0i) 1.57079632679489+0.00081037294887i)
(num-test (atan -0.00000001+1234.0i) -1.57079632679489+0.00081037294887i)
(num-test (atan 0.00000001-1234.0i) 1.57079632679489-0.00081037294887i)
(num-test (atan -0.00000001-1234.0i) -1.57079632679489-0.00081037294887i)
(num-test (atan 1.0+0.0i) 0.78539816339745)
(num-test (atan -1.0+0.0i) -0.78539816339745)
(num-test (atan 1.0-0.0i) 0.78539816339745)
(num-test (atan -1.0-0.0i) -0.78539816339745)
(num-test (atan 1.0+0.00000001i) 0.78539816339745+0.00000000500000i)
(num-test (atan -1.0+0.00000001i) -0.78539816339745+0.00000000500000i)
(num-test (atan 1.0-0.00000001i) 0.78539816339745-0.00000000500000i)
(num-test (atan -1.0-0.00000001i) -0.78539816339745-0.00000000500000i)
(num-test (atan 1.0+1.0i) 1.01722196789785+0.40235947810853i)
(num-test (atan -1.0+1.0i) -1.01722196789785+0.40235947810853i)
(num-test (atan 1.0-1.0i) 1.01722196789785-0.40235947810853i)
(num-test (atan -1.0-1.0i) -1.01722196789785-0.40235947810853i)
(num-test (atan 1.0+3.14159265358979i) 1.47082882591946+0.29462144034086i)
(num-test (atan -1.0+3.14159265358979i) -1.47082882591946+0.29462144034086i)
(num-test (atan 1.0-3.14159265358979i) 1.47082882591946-0.29462144034086i)
(num-test (atan -1.0-3.14159265358979i) -1.47082882591946-0.29462144034086i)
(num-test (atan 1.0+2.71828182845905i) 1.43862796047891+0.33050259272341i)
(num-test (atan -1.0+2.71828182845905i) -1.43862796047891+0.33050259272341i)
(num-test (atan 1.0-2.71828182845905i) 1.43862796047891-0.33050259272341i)
(num-test (atan -1.0-2.71828182845905i) -1.43862796047891-0.33050259272341i)
(num-test (atan 1.0+1234.0i) 1.57079567009087+0.00081037241669i)
(num-test (atan -1.0+1234.0i) -1.57079567009087+0.00081037241669i)
(num-test (atan 1.0-1234.0i) 1.57079567009087-0.00081037241669i)
(num-test (atan -1.0-1234.0i) -1.57079567009087-0.00081037241669i)
(num-test (atan 3.14159265358979+0.0i) 1.26262725567891)
(num-test (atan -3.14159265358979+0.0i) -1.26262725567891)
(num-test (atan 3.14159265358979-0.0i) 1.26262725567891)
(num-test (atan -3.14159265358979-0.0i) -1.26262725567891)
(num-test (atan 3.14159265358979+0.00000001i) 1.26262725567891+0.00000000092000i)
(num-test (atan -3.14159265358979+0.00000001i) -1.26262725567891+0.00000000092000i)
(num-test (atan 3.14159265358979-0.00000001i) 1.26262725567891-0.00000000092000i)
(num-test (atan -3.14159265358979-0.00000001i) -1.26262725567891-0.00000000092000i)
(num-test (atan 3.14159265358979+1.0i) 1.28734057432439+0.08505998507745i)
(num-test (atan -3.14159265358979+1.0i) -1.28734057432439+0.08505998507745i)
(num-test (atan 3.14159265358979-1.0i) 1.28734057432439-0.08505998507745i)
(num-test (atan -3.14159265358979-1.0i) -1.28734057432439-0.08505998507745i)
(num-test (atan 3.14159265358979+3.14159265358979i) 1.40903828502376+0.15638868878130i)
(num-test (atan -3.14159265358979+3.14159265358979i) -1.40903828502376+0.15638868878130i)
(num-test (atan 3.14159265358979-3.14159265358979i) 1.40903828502376-0.15638868878130i)
(num-test (atan -3.14159265358979-3.14159265358979i) -1.40903828502376-0.15638868878130i)
(num-test (atan 3.14159265358979+2.71828182845905i) 1.38641010899673+0.15352587926173i)
(num-test (atan -3.14159265358979+2.71828182845905i) -1.38641010899673+0.15352587926173i)
(num-test (atan 3.14159265358979-2.71828182845905i) 1.38641010899673-0.15352587926173i)
(num-test (atan -3.14159265358979-2.71828182845905i) -1.38641010899673-0.15352587926173i)
(num-test (atan 3.14159265358979+1234.0i) 1.57079426371036+0.00081036769654i)
(num-test (atan -3.14159265358979+1234.0i) -1.57079426371036+0.00081036769654i)
(num-test (atan 3.14159265358979-1234.0i) 1.57079426371036-0.00081036769654i)
(num-test (atan -3.14159265358979-1234.0i) -1.57079426371036-0.00081036769654i)
(num-test (atan 2.71828182845905+0.0i) 1.21828290501728)
(num-test (atan -2.71828182845905+0.0i) -1.21828290501728)
(num-test (atan 2.71828182845905-0.0i) 1.21828290501728)
(num-test (atan -2.71828182845905-0.0i) -1.21828290501728)
(num-test (atan 2.71828182845905+0.00000001i) 1.21828290501728+0.00000000119203i)
(num-test (atan -2.71828182845905+0.00000001i) -1.21828290501728+0.00000000119203i)
(num-test (atan 2.71828182845905-0.00000001i) 1.21828290501728-0.00000000119203i)
(num-test (atan -2.71828182845905-0.00000001i) -1.21828290501728-0.00000000119203i)
(num-test (atan 2.71828182845905+1.0i) 1.25363416718071+0.10816322574795i)
(num-test (atan -2.71828182845905+1.0i) -1.25363416718071+0.10816322574795i)
(num-test (atan 2.71828182845905-1.0i) 1.25363416718071-0.10816322574795i)
(num-test (atan -2.71828182845905-1.0i) -1.25363416718071-0.10816322574795i)
(num-test (atan 2.71828182845905+3.14159265358979i) 1.40945039787275+0.17937970703436i)
(num-test (atan -2.71828182845905+3.14159265358979i) -1.40945039787275+0.17937970703436i)
(num-test (atan 2.71828182845905-3.14159265358979i) 1.40945039787275-0.17937970703436i)
(num-test (atan -2.71828182845905-3.14159265358979i) -1.40945039787275-0.17937970703436i)
(num-test (atan 2.71828182845905+2.71828182845905i) 1.38288382352616+0.17963089485802i)
(num-test (atan -2.71828182845905+2.71828182845905i) -1.38288382352616+0.17963089485802i)
(num-test (atan 2.71828182845905-2.71828182845905i) 1.38288382352616-0.17963089485802i)
(num-test (atan -2.71828182845905-2.71828182845905i) -1.38288382352616-0.17963089485802i)
(num-test (atan 2.71828182845905+1234.0i) 1.57079454169576+0.00081036901661i)
(num-test (atan -2.71828182845905+1234.0i) -1.57079454169576+0.00081036901661i)
(num-test (atan 2.71828182845905-1234.0i) 1.57079454169576-0.00081036901661i)
(num-test (atan -2.71828182845905-1234.0i) -1.57079454169576-0.00081036901661i)
(num-test (atan 1234.0+0.0i) 1.56998595420081)
(num-test (atan -1234.0+0.0i) -1.56998595420081)
(num-test (atan 1234.0-0.0i) 1.56998595420081)
(num-test (atan -1234.0-0.0i) -1.56998595420081)
(num-test (atan 1234.0+0.00000001i) 1.56998595420081+0.00000000000001i)
(num-test (atan -1234.0+0.00000001i) -1.56998595420081+0.00000000000001i)
(num-test (atan 1234.0-0.00000001i) 1.56998595420081-0.00000000000001i)
(num-test (atan -1234.0-0.00000001i) -1.56998595420081-0.00000000000001i)
(num-test (atan 1234.0+1.0i) 1.56998595473299+0.00000065670317i)
(num-test (atan -1234.0+1.0i) -1.56998595473299+0.00000065670317i)
(num-test (atan 1234.0-1.0i) 1.56998595473299-0.00000065670317i)
(num-test (atan -1234.0-1.0i) -1.56998595473299-0.00000065670317i)
(num-test (atan 1234.0+3.14159265358979i) 1.56998595945313+0.00000206308183i)
(num-test (atan -1234.0+3.14159265358979i) -1.56998595945313+0.00000206308183i)
(num-test (atan 1234.0-3.14159265358979i) 1.56998595945313-0.00000206308183i)
(num-test (atan -1234.0-3.14159265358979i) -1.56998595945313-0.00000206308183i)
(num-test (atan 1234.0+2.71828182845905i) 1.56998595813306+0.00000178509679i)
(num-test (atan -1234.0+2.71828182845905i) -1.56998595813306+0.00000178509679i)
(num-test (atan 1234.0-2.71828182845905i) 1.56998595813306-0.00000178509679i)
(num-test (atan -1234.0-2.71828182845905i) -1.56998595813306-0.00000178509679i)
(num-test (atan 1234.0+1234.0i) 1.57039114036481+0.00040518634139i)
(num-test (atan -1234.0+1234.0i) -1.57039114036481+0.00040518634139i)
(num-test (atan 1234.0-1234.0i) 1.57039114036481-0.00040518634139i)
(num-test (atan -1234.0-1234.0i) -1.57039114036481-0.00040518634139i)
(num-test (atan 6.9279836e-17) 6.9279836e-17)
(num-test (atan 1.7976931e+308) 1.5707963267949)
(num-test (atan 0 0) 0.0)
(num-test (atan 0 1.0) 0.0)
(num-test (atan 0 -1.0) pi)
(num-test (atan 1.0 0) (/ pi 2))
(num-test (atan -1.0 0) (/ pi -2))
(num-test (atan 0.0 0.0) 0.0)
(num-test (atan 0.0 0.00000001) 0.0)
(num-test (atan 0.0 1.0) 0.0)
(num-test (atan 0.0 pi) 0.0)
(num-test (atan 0.0 2.71828182845905) 0.0)
(num-test (atan 0.0 1234.0) 0.0)
(num-test (atan 0.0 1234000000.0) 0.0)
(num-test (atan 0.00000001 0.0) 1.57079632679490)
(num-test (atan 0.00000001 0.00000001) 0.78539816339745)
(num-test (atan 0.00000001 1.0) 0.00000001)
(num-test (atan 0.00000001 pi) 0.00000000318310)
(num-test (atan 0.00000001 2.71828182845905) 0.00000000367879)
(num-test (atan 0.00000001 1234.0) 0.00000000000810)
(num-test (atan 0.00000001 1234000000.0) 0.0)
(num-test (atan 1.0 0.0) 1.57079632679490)
(num-test (atan 1.0 0.00000001) 1.57079631679490)
(num-test (atan 1.0 1.0) 0.78539816339745)
(num-test (atan 1.0 pi) 0.30816907111598)
(num-test (atan 1.0 2.71828182845905) 0.35251342177762)
(num-test (atan 1.0 1234.0) 0.00081037259408)
(num-test (atan 1.0 1234000000.0) 0.00000000081037)
(num-test (atan 3.14159265358979 0.0) 1.57079632679490)
(num-test (atan 3.14159265358979 0.00000001) 1.57079632361180)
(num-test (atan 3.14159265358979 1.0) 1.26262725567891)
(num-test (atan 3.14159265358979 pi) 0.78539816339745)
(num-test (atan 3.14159265358979 2.71828182845905) 0.85751178635585)
(num-test (atan 3.14159265358979 1234.0) 0.00254585564530)
(num-test (atan 3.14159265358979 1234000000.0) 0.00000000254586)
(num-test (atan 2.71828182845905 0.0) 1.57079632679490)
(num-test (atan 2.71828182845905 0.00000001) 1.57079632311610)
(num-test (atan 2.71828182845905 1.0) 1.21828290501728)
(num-test (atan 2.71828182845905 pi) 0.71328454043905)
(num-test (atan 2.71828182845905 2.71828182845905) 0.78539816339745)
(num-test (atan 2.71828182845905 1234.0) 0.00220281801598)
(num-test (atan 2.71828182845905 1234000000.0) 0.00000000220282)
(num-test (atan 1234.0 0.0) 1.57079632679490)
(num-test (atan 1234.0 0.00000001) 1.57079632678679)
(num-test (atan 1234.0 1.0) 1.56998595420081)
(num-test (atan 1234.0 pi) 1.56825047114960)
(num-test (atan 1234.0 2.71828182845905) 1.56859350877892)
(num-test (atan 1234.0 1234.0) 0.78539816339745)
(num-test (atan 1234.0 1234000000.0) 0.00000100000000)
(num-test (atan 1234000000.0 0.0) 1.57079632679490)
(num-test (atan 1234000000.0 0.00000001) 1.57079632679490)
(num-test (atan 1234000000.0 1.0) 1.57079632598452)
(num-test (atan 1234000000.0 pi) 1.57079632424904)
(num-test (atan 1234000000.0 2.71828182845905) 1.57079632459208)
(num-test (atan 1234000000.0 1234.0) 1.57079532679490)
(num-test (atan 1234000000.0 1234000000.0) 0.78539816339745)
(num-test (atan 1234000000/3) 1.570796324363778) 
(num-test (atan 0.00000001+1234000000.0i) +1.570796326794897+8.103727714748784E-10i) 
(num-test (atan 3.14159265358979+1234000000.0i) +1.570796326794897+8.103727714748784E-10i) 
(num-test (atan 2.71828182845905+1234000000.0i) +1.570796326794897+8.103727714748784E-10i) 
(num-test (atan 1234000000.0+0.00000001i) +1.570796325984524+6.567040287478756E-27i) 
(num-test (atan 1234000000.0+3.14159265358979i) +1.570796325984524+2.063096552297151E-18i) 
(num-test (atan 1234000000.0+2.71828182845905i) +1.570796325984524+1.785106628021167E-18i)
(num-test (atan 1) 0.7853981633974483)
(num-test (atan 0.0e+00+0.0e+00i) 0e0)
(num-test (atan 0.0e+00+1.19209289550781250e-07i) 0+1.1920928955078181469e-7i)
(num-test (atan 0.0e+00-1.19209289550781250e-07i) 0-1.1920928955078181469e-7i)
(num-test (atan 0.0e+00+5.0e-01i) 0+5.4930614433405484570e-1i)
(num-test (atan 0.0e+00-5.0e-01i) 0-5.4930614433405484570e-1i)
(num-test (atan 0.0e+00+2.0e+00i) 1.5707963267948966192e0+5.4930614433405484570e-1i)
(num-test (atan 0.0e+00-2.0e+00i) -1.5707963267948966192e0-5.4930614433405484570e-1i)
(num-test (atan 0.0e+00+8.3886080e+06i) 1.5707963267948966192e0+1.1920928955078181469e-7i)
(num-test (atan 0.0e+00-8.3886080e+06i) -1.5707963267948966192e0-1.1920928955078181469e-7i)
(num-test (atan 1.19209289550781250e-07+0.0e+00i) 1.1920928955078068531e-7)
(num-test (atan -1.19209289550781250e-07+0.0e+00i) -1.1920928955078068531e-7)
(num-test (atan 1.19209289550781250e-07+1.19209289550781250e-07i) 1.1920928955078237938e-7+1.1920928955078012062e-7i)
(num-test (atan 1.19209289550781250e-07-1.19209289550781250e-07i) 1.1920928955078237938e-7-1.1920928955078012062e-7i)
(num-test (atan -1.19209289550781250e-07+1.19209289550781250e-07i) -1.1920928955078237938e-7+1.1920928955078012062e-7i)
(num-test (atan -1.19209289550781250e-07-1.19209289550781250e-07i) -1.1920928955078237938e-7-1.1920928955078012062e-7i)
(num-test (atan 1.19209289550781250e-07+5.0e-01i) 1.5894571940103932425e-7+5.4930614433404221383e-1i)
(num-test (atan 1.19209289550781250e-07-5.0e-01i) 1.5894571940103932425e-7-5.4930614433404221383e-1i)
(num-test (atan -1.19209289550781250e-07+5.0e-01i) -1.5894571940103932425e-7+5.4930614433404221383e-1i)
(num-test (atan -1.19209289550781250e-07-5.0e-01i) -1.5894571940103932425e-7-5.4930614433404221383e-1i)
(num-test (atan 1.19209289550781250e-07+1.0e+00i) 7.8539819319977069731e-1+8.3177661667193446012e0i)
(num-test (atan 1.19209289550781250e-07-1.0e+00i) 7.8539819319977069731e-1-8.3177661667193446012e0i)
(num-test (atan -1.19209289550781250e-07+1.0e+00i) -7.8539819319977069731e-1+8.3177661667193446012e0i)
(num-test (atan -1.19209289550781250e-07-1.0e+00i) -7.8539819319977069731e-1-8.3177661667193446012e0i)
(num-test (atan 1.19209289550781250e-07+2.0e+00i) 1.5707962870584667690e0+5.4930614433405168773e-1i)
(num-test (atan 1.19209289550781250e-07-2.0e+00i) 1.5707962870584667690e0-5.4930614433405168773e-1i)
(num-test (atan -1.19209289550781250e-07+2.0e+00i) -1.5707962870584667690e0+5.4930614433405168773e-1i)
(num-test (atan -1.19209289550781250e-07-2.0e+00i) -1.5707962870584667690e0-5.4930614433405168773e-1i)
(num-test (atan 1.19209289550781250e-07+8.3886080e+06i) 1.5707963267948966192e0+1.1920928955078181469e-7i)
(num-test (atan 1.19209289550781250e-07-8.3886080e+06i) 1.5707963267948966192e0-1.1920928955078181469e-7i)
(num-test (atan -1.19209289550781250e-07+8.3886080e+06i) -1.5707963267948966192e0+1.1920928955078181469e-7i)
(num-test (atan -1.19209289550781250e-07-8.3886080e+06i) -1.5707963267948966192e0-1.1920928955078181469e-7i)
(num-test (atan 5.0e-01+0.0e+00i) 4.6364760900080611621e-1)
(num-test (atan -5.0e-01+0.0e+00i) -4.6364760900080611621e-1)
(num-test (atan 5.0e-01+1.19209289550781250e-07i) 4.6364760900081066369e-1+9.5367431640625072280e-8i)
(num-test (atan 5.0e-01-1.19209289550781250e-07i) 4.6364760900081066369e-1-9.5367431640625072280e-8i)
(num-test (atan -5.0e-01+1.19209289550781250e-07i) -4.6364760900081066369e-1+9.5367431640625072280e-8i)
(num-test (atan -5.0e-01-1.19209289550781250e-07i) -4.6364760900081066369e-1-9.5367431640625072280e-8i)
(num-test (atan 5.0e-01+5.0e-01i) 5.5357435889704525151e-1+4.0235947810852509365e-1i)
(num-test (atan 5.0e-01-5.0e-01i) 5.5357435889704525151e-1-4.0235947810852509365e-1i)
(num-test (atan -5.0e-01+5.0e-01i) -5.5357435889704525151e-1+4.0235947810852509365e-1i)
(num-test (atan -5.0e-01-5.0e-01i) -5.5357435889704525151e-1-4.0235947810852509365e-1i)
(num-test (atan 5.0e-01+1.0e+00i) 9.0788749496088038670e-1+7.0830333601405402006e-1i)
(num-test (atan 5.0e-01-1.0e+00i) 9.0788749496088038670e-1-7.0830333601405402006e-1i)
(num-test (atan -5.0e-01+1.0e+00i) -9.0788749496088038670e-1+7.0830333601405402006e-1i)
(num-test (atan -5.0e-01-1.0e+00i) -9.0788749496088038670e-1-7.0830333601405402006e-1i)
(num-test (atan 5.0e-01+2.0e+00i) 1.4215468610018069803e0+5.0037000005253101744e-1i)
(num-test (atan 5.0e-01-2.0e+00i) 1.4215468610018069803e0-5.0037000005253101744e-1i)
(num-test (atan -5.0e-01+2.0e+00i) -1.4215468610018069803e0+5.0037000005253101744e-1i)
(num-test (atan -5.0e-01-2.0e+00i) -1.4215468610018069803e0-5.0037000005253101744e-1i)
(num-test (atan 5.0e-01+8.3886080e+06i) 1.5707963267948895138e0+1.1920928955078139117e-7i)
(num-test (atan 5.0e-01-8.3886080e+06i) 1.5707963267948895138e0-1.1920928955078139117e-7i)
(num-test (atan -5.0e-01+8.3886080e+06i) -1.5707963267948895138e0+1.1920928955078139117e-7i)
(num-test (atan -5.0e-01-8.3886080e+06i) -1.5707963267948895138e0-1.1920928955078139117e-7i)
(num-test (atan 1.0e+00+0.0e+00i) 7.8539816339744830962e-1)
(num-test (atan -1.0e+00+0.0e+00i) -7.8539816339744830962e-1)
(num-test (atan 1.0e+00+1.19209289550781250e-07i) 7.8539816339745186233e-1+5.9604644775390483828e-8i)
(num-test (atan 1.0e+00-1.19209289550781250e-07i) 7.8539816339745186233e-1-5.9604644775390483828e-8i)
(num-test (atan -1.0e+00+1.19209289550781250e-07i) -7.8539816339745186233e-1+5.9604644775390483828e-8i)
(num-test (atan -1.0e+00-1.19209289550781250e-07i) -7.8539816339745186233e-1-5.9604644775390483828e-8i)
(num-test (atan 1.0e+00+5.0e-01i) 8.4757566067082902713e-1+2.3887786125685909036e-1i)
(num-test (atan 1.0e+00-5.0e-01i) 8.4757566067082902713e-1-2.3887786125685909036e-1i)
(num-test (atan -1.0e+00+5.0e-01i) -8.4757566067082902713e-1+2.3887786125685909036e-1i)
(num-test (atan -1.0e+00-5.0e-01i) -8.4757566067082902713e-1-2.3887786125685909036e-1i)
(num-test (atan 1.0e+00+1.0e+00i) 1.0172219678978513677e0+4.0235947810852509365e-1i)
(num-test (atan 1.0e+00-1.0e+00i) 1.0172219678978513677e0-4.0235947810852509365e-1i)
(num-test (atan -1.0e+00+1.0e+00i) -1.0172219678978513677e0+4.0235947810852509365e-1i)
(num-test (atan -1.0e+00-1.0e+00i) -1.0172219678978513677e0-4.0235947810852509365e-1i)
(num-test (atan 1.0e+00+2.0e+00i) 1.3389725222944935611e0+4.0235947810852509365e-1i)
(num-test (atan 1.0e+00-2.0e+00i) 1.3389725222944935611e0-4.0235947810852509365e-1i)
(num-test (atan -1.0e+00+2.0e+00i) -1.3389725222944935611e0+4.0235947810852509365e-1i)
(num-test (atan -1.0e+00-2.0e+00i) -1.3389725222944935611e0-4.0235947810852509365e-1i)
(num-test (atan 1.0e+00+8.3886080e+06i) 1.5707963267948824084e0+1.1920928955078012062e-7i)
(num-test (atan 1.0e+00-8.3886080e+06i) 1.5707963267948824084e0-1.1920928955078012062e-7i)
(num-test (atan -1.0e+00+8.3886080e+06i) -1.5707963267948824084e0+1.1920928955078012062e-7i)
(num-test (atan -1.0e+00-8.3886080e+06i) -1.5707963267948824084e0-1.1920928955078012062e-7i)
(num-test (atan 2.0e+00+0.0e+00i) 1.1071487177940905030e0)
(num-test (atan -2.0e+00+0.0e+00i) -1.1071487177940905030e0)
(num-test (atan 2.0e+00+1.19209289550781250e-07i) 1.1071487177940916399e0+2.3841857910156200307e-8i)
(num-test (atan 2.0e+00-1.19209289550781250e-07i) 1.1071487177940916399e0-2.3841857910156200307e-8i)
(num-test (atan -2.0e+00+1.19209289550781250e-07i) -1.1071487177940916399e0+2.3841857910156200307e-8i)
(num-test (atan -2.0e+00-1.19209289550781250e-07i) -1.1071487177940916399e0-2.3841857910156200307e-8i)
(num-test (atan 2.0e+00+5.0e-01i) 1.1265564408348223487e0+9.6415620202996167238e-2i)
(num-test (atan 2.0e+00-5.0e-01i) 1.1265564408348223487e0-9.6415620202996167238e-2i)
(num-test (atan -2.0e+00+5.0e-01i) -1.1265564408348223487e0+9.6415620202996167238e-2i)
(num-test (atan -2.0e+00-5.0e-01i) -1.1265564408348223487e0-9.6415620202996167238e-2i)
(num-test (atan 2.0e+00+1.0e+00i) 1.1780972450961724644e0+1.7328679513998632735e-1i)
(num-test (atan 2.0e+00-1.0e+00i) 1.1780972450961724644e0-1.7328679513998632735e-1i)
(num-test (atan -2.0e+00+1.0e+00i) -1.1780972450961724644e0+1.7328679513998632735e-1i)
(num-test (atan -2.0e+00-1.0e+00i) -1.1780972450961724644e0-1.7328679513998632735e-1i)
(num-test (atan 2.0e+00+2.0e+00i) 1.3112232696716351433e0+2.3887786125685909036e-1i)
(num-test (atan 2.0e+00-2.0e+00i) 1.3112232696716351433e0-2.3887786125685909036e-1i)
(num-test (atan -2.0e+00+2.0e+00i) -1.3112232696716351433e0+2.3887786125685909036e-1i)
(num-test (atan -2.0e+00-2.0e+00i) -1.3112232696716351433e0-2.3887786125685909036e-1i)
(num-test (atan 2.0e+00+8.3886080e+06i) 1.5707963267948681975e0+1.1920928955077503843e-7i)
(num-test (atan 2.0e+00-8.3886080e+06i) 1.5707963267948681975e0-1.1920928955077503843e-7i)
(num-test (atan -2.0e+00+8.3886080e+06i) -1.5707963267948681975e0+1.1920928955077503843e-7i)
(num-test (atan -2.0e+00-8.3886080e+06i) -1.5707963267948681975e0-1.1920928955077503843e-7i)
(num-test (atan 8.3886080e+06+0.0e+00i) 1.5707962075856070685e0)
(num-test (atan -8.3886080e+06+0.0e+00i) -1.5707962075856070685e0)
(num-test (atan 8.3886080e+06+1.19209289550781250e-07i) 1.5707962075856070685e0+1.6940658945085766040e-21i)
(num-test (atan 8.3886080e+06-1.19209289550781250e-07i) 1.5707962075856070685e0-1.6940658945085766040e-21i)
(num-test (atan -8.3886080e+06+1.19209289550781250e-07i) -1.5707962075856070685e0+1.6940658945085766040e-21i)
(num-test (atan -8.3886080e+06-1.19209289550781250e-07i) -1.5707962075856070685e0-1.6940658945085766040e-21i)
(num-test (atan 8.3886080e+06+5.0e-01i) 1.5707962075856070685e0+7.1054273576008756410e-15i)
(num-test (atan 8.3886080e+06-5.0e-01i) 1.5707962075856070685e0-7.1054273576008756410e-15i)
(num-test (atan -8.3886080e+06+5.0e-01i) -1.5707962075856070685e0+7.1054273576008756410e-15i)
(num-test (atan -8.3886080e+06-5.0e-01i) -1.5707962075856070685e0-7.1054273576008756410e-15i)
(num-test (atan 8.3886080e+06+1.0e+00i) 1.5707962075856070685e0+1.4210854715201599821e-14i)
(num-test (atan 8.3886080e+06-1.0e+00i) 1.5707962075856070685e0-1.4210854715201599821e-14i)
(num-test (atan -8.3886080e+06+1.0e+00i) -1.5707962075856070685e0+1.4210854715201599821e-14i)
(num-test (atan -8.3886080e+06-1.0e+00i) -1.5707962075856070685e0-1.4210854715201599821e-14i)
(num-test (atan 8.3886080e+06+2.0e+00i) 1.5707962075856070685e0+2.8421709430401987951e-14i)
(num-test (atan 8.3886080e+06-2.0e+00i) 1.5707962075856070685e0-2.8421709430401987951e-14i)
(num-test (atan -8.3886080e+06+2.0e+00i) -1.5707962075856070685e0+2.8421709430401987951e-14i)
(num-test (atan -8.3886080e+06-2.0e+00i) -1.5707962075856070685e0-2.8421709430401987951e-14i)
(num-test (atan 8.3886080e+06+8.3886080e+06i) 1.5707962671902518438e0+5.9604644775390483828e-8i)
(num-test (atan 8.3886080e+06-8.3886080e+06i) 1.5707962671902518438e0-5.9604644775390483828e-8i)
(num-test (atan -8.3886080e+06+8.3886080e+06i) -1.5707962671902518438e0+5.9604644775390483828e-8i)
(num-test (atan -8.3886080e+06-8.3886080e+06i) -1.5707962671902518438e0-5.9604644775390483828e-8i)
(num-test (atan -2.225073858507201399999999999999999999996E-308) -2.225073858507201399999999999999999999996E-308)
(num-test (atan 1.110223024625156799999999999999999999997E-16) 1.110223024625156799999999999999995438476E-16)
(num-test (/ pi 2) (+ (* 2 (atan (/ (sqrt 2)))) (atan (/ (sqrt 8)))))
(num-test (/ pi 4) (+ (* 12 (atan (/ 18))) (* 8 (atan (/ 57))) (* -5 (atan (/ 239)))))
(num-test (/ pi 4) (+ (* 2 (atan 1/3)) (atan 1/7)))
(num-test (/ pi 4) (+ (* 5 (atan 1/7)) (* 2 (atan 3/79))))
(num-test (/ pi 4) (+ (atan 1/2) (atan 1/3)))
(num-test (/ pi 4) (- (* 2 (atan 1/2)) (atan 1/7)))
(num-test (/ pi 4) (- (* 4 (atan (/ 1 5))) (atan (/ 1 239))))
(num-test (* 4 (+ (* 3 (atan 1/4)) (atan 1/20) (atan 1/1985))) pi)
(num-test (+ (* 176 (atan (/ 57))) (* 28 (atan (/ 239))) (* -48 (atan (/ 682))) (* 96 (atan (/ 12943)))) pi)
(num-test (+ (* 2 (atan (/ (sqrt 2)))) (atan (/ (sqrt 8)))) (/ pi 2))
(num-test (+ (* 48 (atan (/ 49))) (* 128 (atan (/ 57))) (* -20 (atan (/ 239))) (* 48 (atan (/ 110443)))) pi)
(num-test (/ (+ (atan (/ 239)) (atan (/ 70)) (- (atan (/ 99)))) 2) (+ (atan (/ 408)) (atan (/ 577))))
(num-test (atan (/ -1 (sqrt 3))) (/ pi -6))
(num-test (atan (sqrt 3)) (/ pi 3))
(num-test (atan 1/2 1/2) 0.78539816339745)

(for-each
 (lambda (num-and-val)
   (let ((num (car num-and-val)) (val (cadr num-and-val))) (num-test-1 'atan num (atan num) val)))
 (vector (list 0 0) (list 1 0.78539816339745) (list 2 1.1071487177941) (list 3 1.2490457723983) 
	 (list -1 -0.78539816339745) (list -2 -1.1071487177941) (list -3 -1.2490457723983) 
	 (list 9223372036854775807 1.5707963267949) (list -9223372036854775808 -1.5707963267949) 
	 (list 1/2 0.46364760900081) (list 1/3 0.32175055439664) (list -1/2 -0.46364760900081) 
	 (list -1/3 -0.32175055439664) (list 1/9223372036854775807 1.0842021724855e-19) (list 0.0 0.0) 
	 (list 1.0 0.78539816339745) (list 2.0 1.1071487177941) (list -2.0 -1.1071487177941) 
	 (list 1.000000000000000000000000000000000000002E-309 1.000000000000000000000000000000000000002E-309) 
	 (list 1e+16 1.5707963267949) (list inf.0 1.5707963267949) (list -inf.0 -1.5707963267949) 
	 (list 0+2i 1.5707963267949+0.54930614433405i) (list 1+1i 1.0172219678979+0.40235947810853i) 
	 (list 1-1i 1.0172219678979-0.40235947810853i) (list -1+1i -1.0172219678979+0.40235947810853i) 
	 (list -1-1i -1.0172219678979-0.40235947810853i) (list 0.1+0.1i 0.10065855418732+0.099325449367251i) 
	 (list 1e+16+1e+16i 1.5707963267949+5.5511151231258e-17i) (list 1e-16+1e-16i 1e-16+1.1102230246252e-16i) 
	 ))

;; the x=0 cases are errors in clisp
(num-test (atan 0 0) 0.0)
(num-test (atan 0 0.0) 0.0)
(num-test (atan 0 1) 0.0)
(num-test (atan 0 -1) pi)
(num-test (atan 0 2) 0.0)
(num-test (atan 0 -2) pi)
(num-test (atan 0 1.5) 0.0)
(num-test (atan 0 -1.5) pi)
(num-test (atan 0 3.0) 0.0)
(num-test (atan 0 -3.0) pi)
(num-test (atan 0 4.0) 0.0)
(num-test (atan 0 -4.0) pi)
(num-test (atan 0 pi) 0.0)
(num-test (atan 0 (- pi)) pi)
(num-test (atan 0.0 0) 0.0)
(num-test (atan 0.0 0.0) 0.0)
(num-test (atan 0.0 1) 0.0)
(num-test (atan 0.0 -1) pi)
(num-test (atan 0.0 2) 0.0)
(num-test (atan 0.0 -2) pi)
(num-test (atan 0.0 1.5) 0.0)
(num-test (atan 0.0 -1.5) pi)
(num-test (atan 0.0 3.0) 0.0)
(num-test (atan 0.0 -3.0) pi)
(num-test (atan 0.0 4.0) 0.0)
(num-test (atan 0.0 -4.0) pi)
(num-test (atan 0.0 pi) 0.0)
(num-test (atan 0.0 (- pi)) pi)
(num-test (atan 1 0) 1.5707963267949)
(num-test (atan 1 0.0) 1.5707963267949)
(num-test (atan 1 1) 0.78539816339745)
(num-test (atan 1 -1) 2.3561944901923)
(num-test (atan 1 2) 0.46364760900081)
(num-test (atan 1 -2) 2.677945044589)
(num-test (atan 1 1.5) 0.58800260354757)
(num-test (atan 1 -1.5) 2.5535900500422)
(num-test (atan 1 3.0) 0.32175055439664)
(num-test (atan 1 -3.0) 2.8198420991932)
(num-test (atan 1 4.0) 0.24497866312686)
(num-test (atan 1 -4.0) 2.8966139904629)
(num-test (atan 1 pi) 3.081690711159849357869996080340530985905E-1)
(num-test (atan 1 (- pi)) 2.833423582473808302675643775245449785612E0)
(num-test (atan -1 0) -1.5707963267949)
(num-test (atan -1 0.0) -1.5707963267949)
(num-test (atan -1 1) -0.78539816339745)
(num-test (atan -1 -1) -2.3561944901923)
(num-test (atan -1 2) -0.46364760900081)
(num-test (atan -1 -2) -2.677945044589)
(num-test (atan -1 1.5) -0.58800260354757)
(num-test (atan -1 -1.5) -2.5535900500422)
(num-test (atan -1 3.0) -0.32175055439664)
(num-test (atan -1 -3.0) -2.8198420991932)
(num-test (atan -1 4.0) -0.24497866312686)
(num-test (atan -1 -4.0) -2.8966139904629)
(num-test (atan -1 pi) -3.081690711159849357869996080340530985905E-1)
(num-test (atan -1 (- pi)) -2.833423582473808302675643775245449785612E0)
(num-test (atan 2 0) 1.5707963267949)
(num-test (atan 2 0.0) 1.5707963267949)
(num-test (atan 2 1) 1.1071487177941)
(num-test (atan 2 -1) 2.0344439357957)
(num-test (atan 2 2) 0.78539816339745)
(num-test (atan 2 -2) 2.3561944901923)
(num-test (atan 2 1.5) 0.92729521800161)
(num-test (atan 2 -1.5) 2.2142974355882)
(num-test (atan 2 3.0) 0.58800260354757)
(num-test (atan 2 -3.0) 2.5535900500422)
(num-test (atan 2 4.0) 0.46364760900081)
(num-test (atan 2 -4.0) 2.677945044589)
(num-test (atan 2 pi) 5.669115049410094050828977467226191538068E-1)
(num-test (atan 2 (- pi)) 2.574681148648783833379745636556883730391E0)
(num-test (atan -2 0) -1.5707963267949)
(num-test (atan -2 0.0) -1.5707963267949)
(num-test (atan -2 1) -1.1071487177941)
(num-test (atan -2 -1) -2.0344439357957)
(num-test (atan -2 2) -0.78539816339745)
(num-test (atan -2 -2) -2.3561944901923)
(num-test (atan -2 1.5) -0.92729521800161)
(num-test (atan -2 -1.5) -2.2142974355882)
(num-test (atan -2 3.0) -0.58800260354757)
(num-test (atan -2 -3.0) -2.5535900500422)
(num-test (atan -2 4.0) -0.46364760900081)
(num-test (atan -2 -4.0) -2.677945044589)
(num-test (atan -2 pi) -5.669115049410094050828977467226191538068E-1)
(num-test (atan -2 (- pi)) -2.574681148648783833379745636556883730391E0)
(num-test (atan 1.5 0) 1.5707963267949)
(num-test (atan 1.5 0.0) 1.5707963267949)
(num-test (atan 1.5 1) 0.98279372324733)
(num-test (atan 1.5 -1) 2.1587989303425)
(num-test (atan 1.5 2) 0.64350110879328)
(num-test (atan 1.5 -2) 2.4980915447965)
(num-test (atan 1.5 1.5) 0.78539816339745)
(num-test (atan 1.5 -1.5) 2.3561944901923)
(num-test (atan 1.5 3.0) 0.46364760900081)
(num-test (atan 1.5 -3.0) 2.677945044589)
(num-test (atan 1.5 4.0) 0.35877067027057)
(num-test (atan 1.5 -4.0) 2.7828219833192)
(num-test (atan 1.5 pi) 4.454574939105981596935303215574368401686E-1)
(num-test (atan 1.5 (- pi)) 2.696135159679195078769113061722066044025E0)
(num-test (atan -1.5 0) -1.5707963267949)
(num-test (atan -1.5 0.0) -1.5707963267949)
(num-test (atan -1.5 1) -0.98279372324733)
(num-test (atan -1.5 -1) -2.1587989303425)
(num-test (atan -1.5 2) -0.64350110879328)
(num-test (atan -1.5 -2) -2.4980915447965)
(num-test (atan -1.5 1.5) -0.78539816339745)
(num-test (atan -1.5 -1.5) -2.3561944901923)
(num-test (atan -1.5 3.0) -0.46364760900081)
(num-test (atan -1.5 -3.0) -2.677945044589)
(num-test (atan -1.5 4.0) -0.35877067027057)
(num-test (atan -1.5 -4.0) -2.7828219833192)
(num-test (atan -1.5 pi) -4.454574939105981596935303215574368401686E-1)
(num-test (atan -1.5 (- pi)) -2.696135159679195078769113061722066044025E0)
(num-test (atan 3.0 0) 1.5707963267949)
(num-test (atan 3.0 0.0) 1.5707963267949)
(num-test (atan 3.0 1) 1.2490457723983)
(num-test (atan 3.0 -1) 1.8925468811915)
(num-test (atan 3.0 2) 0.98279372324733)
(num-test (atan 3.0 -2) 2.1587989303425)
(num-test (atan 3.0 1.5) 1.1071487177941)
(num-test (atan 3.0 -1.5) 2.0344439357957)
(num-test (atan 3.0 3.0) 0.78539816339745)
(num-test (atan 3.0 -3.0) 2.3561944901923)
(num-test (atan 3.0 4.0) 0.64350110879328)
(num-test (atan 3.0 -4.0) 2.4980915447965)
(num-test (atan 3.0 pi) 7.623475341648745879175385302461797760774E-1)
(num-test (atan 3.0 (- pi)) 2.379245119424918650545104853033323108118E0)
(num-test (atan -3.0 0) -1.5707963267949)
(num-test (atan -3.0 0.0) -1.5707963267949)
(num-test (atan -3.0 1) -1.2490457723983)
(num-test (atan -3.0 -1) -1.8925468811915)
(num-test (atan -3.0 2) -0.98279372324733)
(num-test (atan -3.0 -2) -2.1587989303425)
(num-test (atan -3.0 1.5) -1.1071487177941)
(num-test (atan -3.0 -1.5) -2.0344439357957)
(num-test (atan -3.0 3.0) -0.78539816339745)
(num-test (atan -3.0 -3.0) -2.3561944901923)
(num-test (atan -3.0 4.0) -0.64350110879328)
(num-test (atan -3.0 -4.0) -2.4980915447965)
(num-test (atan -3.0 pi) -7.623475341648745879175385302461797760774E-1)
(num-test (atan -3.0 (- pi)) -2.379245119424918650545104853033323108118E0)
(num-test (atan 4.0 0) 1.5707963267949)
(num-test (atan 4.0 0.0) 1.5707963267949)
(num-test (atan 4.0 1) 1.325817663668)
(num-test (atan 4.0 -1) 1.8157749899218)
(num-test (atan 4.0 2) 1.1071487177941)
(num-test (atan 4.0 -2) 2.0344439357957)
(num-test (atan 4.0 1.5) 1.2120256565243)
(num-test (atan 4.0 -1.5) 1.9295669970655)
(num-test (atan 4.0 3.0) 0.92729521800161)
(num-test (atan 4.0 -3.0) 2.2142974355882)
(num-test (atan 4.0 4.0) 0.78539816339745)
(num-test (atan 4.0 -4.0) 2.3561944901923)
(num-test (atan 4.0 pi) 9.050225767665427556408039831275762329032E-1)
(num-test (atan 4.0 (- pi)) 2.236570076823250482821839400151926651295E0)
(num-test (atan -4.0 0) -1.5707963267949)
(num-test (atan -4.0 0.0) -1.5707963267949)
(num-test (atan -4.0 1) -1.325817663668)
(num-test (atan -4.0 -1) -1.8157749899218)
(num-test (atan -4.0 2) -1.1071487177941)
(num-test (atan -4.0 -2) -2.0344439357957)
(num-test (atan -4.0 1.5) -1.2120256565243)
(num-test (atan -4.0 -1.5) -1.9295669970655)
(num-test (atan -4.0 3.0) -0.92729521800161)
(num-test (atan -4.0 -3.0) -2.2142974355882)
(num-test (atan -4.0 4.0) -0.78539816339745)
(num-test (atan -4.0 -4.0) -2.3561944901923)
(num-test (atan -4.0 pi) -9.050225767665427556408039831275762329032E-1)
(num-test (atan -4.0 (- pi)) -2.236570076823250482821839400151926651295E0)
(num-test (atan pi 0) 1.570796326794896619231321691639751442098E0)
(num-test (atan pi 0.0) 1.570796326794896619231321691639751442098E0)
(num-test (atan pi 1) 1.262627255678911683444322083605698343509E0)
(num-test (atan pi -1) 1.878965397910881555018321299673804540687E0)
(num-test (atan pi 2) 1.003884821853887214148423944917132288294E0)
(num-test (atan pi -2) 2.137707831735906024314219438362370595907E0)
(num-test (atan pi 1.5) 1.125338832884298459537791370082314601928E0)
(num-test (atan pi -1.5) 2.016253820705494778924852013197188282274E0)
(num-test (atan pi 3.0) 8.084487926300220313137831613935716660202E-1)
(num-test (atan pi -3.0) 2.333143860959771207148860221885931218181E0)
(num-test (atan pi 4.0) 6.657737500283538635905177085121752091944E-1)
(num-test (atan pi -4.0) 2.475818903561439374872125674767327675004E0)
(num-test (atan pi pi) 7.853981633974483096156608458198757210488E-1)
(num-test (atan pi (- pi)) 2.356194490192344928846982537459627163149E0)
(num-test (atan (- pi) 0) -1.570796326794896619231321691639751442098E0)
(num-test (atan (- pi) 0.0) -1.570796326794896619231321691639751442098E0)
(num-test (atan (- pi) 1) -1.262627255678911683444322083605698343509E0)
(num-test (atan (- pi) -1) -1.878965397910881555018321299673804540687E0)
(num-test (atan (- pi) 2) -1.003884821853887214148423944917132288294E0)
(num-test (atan (- pi) -2) -2.137707831735906024314219438362370595907E0)
(num-test (atan (- pi) 1.5) -1.125338832884298459537791370082314601928E0)
(num-test (atan (- pi) -1.5) -2.016253820705494778924852013197188282274E0)
(num-test (atan (- pi) 3.0) -8.084487926300220313137831613935716660202E-1)
(num-test (atan (- pi) -3.0) -2.333143860959771207148860221885931218181E0)
(num-test (atan (- pi) 4.0) -6.657737500283538635905177085121752091944E-1)
(num-test (atan (- pi) -4.0) -2.475818903561439374872125674767327675004E0)
(num-test (atan (- pi) pi) -7.853981633974483096156608458198757210488E-1)
(num-test (atan (- pi) (- pi)) -2.356194490192344928846982537459627163149E0)

(num-test (atan 3037000500 1/3037000500) 1.570796326794896619122901474392911039606E0)
(num-test (atan most-positive-fixnum) 1.570796326794896619122901474391200998685E0)
(num-test (atan 1/3037000500 3037000500) 1.084202172468404024919078833314741441372E-19)
  
(test (atan) 'error)
(test (atan "hi") 'error)
(test (atan 1.0+23.0i 1.0+23.0i) 'error)
(test (atan 0 1 2) 'error)
(test (atan 0 0-i) 'error)
(test (atan 1+i 0-i) 'error)
(test (atan 1 0-i) 'error)

(for-each
 (lambda (arg)
   (test (atan arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))

(for-each
 (lambda (arg)
   (test (atan arg nan.0) 'error)
   (test (atan nan.0 arg) 'error)
   (test (atan arg inf.0) 'error)
   (test (atan inf.0 arg) 'error)
   (test (atan 1 arg) 'error)
   (test (atan 1.0 arg) 'error)
   (test (atan 1/2 arg) 'error)
   (test (atan 1+i arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))

(for-each
 (lambda (arg)
   (test (atan arg 1) 'error)
   (test (atan arg 1/2) 'error)
   (test (atan arg 1.0) 'error)
   (test (atan arg 1+i) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))



(let ((formulas 
       '((1/4  (1 1))
	 
	 (1/4  (1 2) (1 3))  
	 (1/4  (2 2) (-1 7))  
	 (1/4  (2 3) (1 7))  
	 (1/4  (4 5) (-1 239)) 
	 
	 (1/4  (1 2) (1 4) (1 13))    
	 (1/4  (1 2) (1 5) (1 8))    
	 (1/4  (1 2) (2 6) (-1 117))    
	 (1/4  (1 3) (2 4) (-1 38))  
	 (1/4  (2 2) (-2 12) (1 41))  
	 (1/4  (2 2) (-2 14) (1 1393))  
	 (1/4  (2 2) (-2 17) (-1 41))  
	 (1/4  (2 2) (-1 5) (1 18))  
	 (1/4  (2 2) (-1 6) (1 43))  
	 (1/4  (2 2) (-1 8) (-1 57))  
	 (1/4  (2 2) (-1 9) (-1 32))  
	 (1/4  (2 2) (-1 12) (-1 17))  
	 (1/4  (2 3) (1 5) (-1 18))  
	 (1/4  (2 3) (1 6) (-1 43))  
	 (1/4  (2 3) (1 8) (1 57))  
	 (1/4  (2 3) (1 9) (1 32))  
	 (1/4  (2 3) (1 12) (1 17))  
	 (1/4  (2 3) (2 12) (-1 41))  
	 (1/4  (2 3) (2 14) (-1 1393))  
	 (1/4  (2 3) (2 17) (1 41))  
	 (1/4  (2 4) (1 7) (2 13))  
	 (1/4  (2 5) (1 7) (2 8))  
	 (1/4  (2 5) (3 7) (-2 57))  
	 (1/4  (2 5) (3 8) (1 57))  
	 (1/4  (2 6) (3 7) (2 68))  
	 (1/4  (2 7) (4 8) (1 239))  
	 (1/4  (3 3) (-2 11) (1 682))  
	 (1/4  (3 3) (-2 13) (-1 38))  
	 (1/4  (3 3) (-1 5) (1 57))  
	 (1/4  (3 3) (-1 6) (-1 68))  
	 (1/4  (3 3) (-1 8) (-1 18))  
	 (1/4  (3 4) (1 13) (-1 38))  
	 (1/4  (3 4) (1 20) (1 1985))  
	 (1/4  (3 5) (2 8) (-1 18))  
	 (1/4  (3 7) (2 8) (2 18))  
	 (1/4  (3 7) (4 11) (-2 682))  
	 (1/4  (3 7) (4 13) (2 38))  
	 (1/4  (4 3) (-4 8) (-1 239))     
	 (1/4  (4 4) (-1 7) (-2 38))  
	 (1/4  (4 4) (-4 21) (-1 239))  
	 (1/4  (4 5) (-2 408) (1 1393))  
	 (1/4  (4 5) (-2 478) (1 54608393))  
	 (1/4  (4 5) (-2 577) (-1 1393))  
	 (1/4  (4 5) (-1 41) (2 99))      
	 (1/4  (4 5) (-1 70) (1 99))      
	 (1/4  (4 5) (-1 213) (1 1958))   
	 (1/4  (4 5) (-1 226) (1 4155))   
	 (1/4  (4 5) (-1 237) (1 28322))  
	 (1/4  (4 5) (-1 238) (1 56883))  
	 (1/4  (4 5) (-1 240) (-1 57361))  
	 (1/4  (4 5) (-1 241) (-1 28800))  
	 (1/4  (4 5) (-1 252) (-1 4633))  
	 (1/4  (4 5) (-1 265) (-1 2436))  
	 (1/4  (4 5) (-1 408) (-1 577))   
	 (1/4  (4 5) (1 41) (-2 70))      
	 (1/4  (4 6) (1 7) (-2 117))      
	 (1/4  (4 6) (4 31) (-1 239))     
	 (1/4  (4 7) (4 18) (-1 239))     
	 (1/4  (5 5) (-3 18) (-2 57))  
	 (1/4  (5 6) (-1 43) (-2 117))  
	 (1/4  (5 6) (-1 68) (-3 117))  
	 
	 (1/4  (-29 239) (256 378) (200 829) (244 882) (-388 993) (324 2943) (-144 18543))  
	 (1/4  (-4 307) (394 577) (163 1393) (-12 12238) (-24 58911) (-68 1999509) (-68 11653127))  
	 (1/4  (7 10) (2 50) (4 100) (1 682) (4 1000) (3 1303) (-4 90109))    
	 (1/4  (7 10) (8 100) (1 682) (4 1000) (3 1303) (-4 90109) (-2 500150))    
	 (1/4  (12 18) (8 307) (46 577) (19 1393) (-8 2827807) (-16 11653127) (-8 16480443))  
	 (1/4  (17 23) (11 882) (24 931) (10 1143) (-2 34208) (-8 44179) (-13 485298))  
	 (1/4  (29 268) (198 378) (142 829) (186 882) (-301 993) (237 2943) (-115 18543))  
	 (1/4  (43 57) (22 746) (-2 1568) (1 4662) (28 12943) (14 32807) (11 157318))  
	 (1/4  (44 515) (95 538) (127 682) (176 782) (95 1068) (88 4030) (17 12943))                   
	 (1/4  (76 682) (190 746) (271 882) (315 2917) (-132 9466) (295 12943) (-95 19703))  
	 (1/4  (83 107) (17 4443) (68 11343) (-5 113568) (-34 595667) (-5 23481902) (5 168925949733307))  
	 (1/4  (83 107) (17 4443) (68 11343) (-5 111693) (-34 595667) (5 9503057) (5 232633636378307))  
	 (1/4  (95 418) (171 682) (176 882) (315 2917) (-132 9466) (105 12943) (95 16693))  
	 (1/4  (100 437) (254 577) (127 1393) (44 2072) (24 2943) (-12 16432) (-100 28800))  
	 (1/4  (122 162) (22 568) (-29 1432) (83 5087) (-7 6107) (-10 27493) (-29 30027))  
	 (1/4  (122 183) (108 1177) (29 1393) (22 4443) (54 5087) (-64 7078) (-10 27493))  
	 (1/4  (122 418) (237 557) (29 1068) (144 3458) (-61 5087) (122 16452) (105 27493))  
	 (1/4  (127 239) (100 343) (-56 2072) (-76 2943) (100 7983) (-12 16432) (100 28322))  
	 (1/4  (127 239) (212 1068) (-144 2072) (188 2309) (-200 6105) (376 6807) (288 13637))  
	 (1/4  (127 239) (400 1068) (44 2072) (-376 2943) (-200 6105) (100 13637) (188 16432))  
	 (1/4  (127 682) (227 788) (227 843) (44 2072) (51 2943) (-27 12943) (88 16432))  
	 (1/4  (127 682) (454 818) (271 1303) (-403 2943) (-44 6118) (-254 12943) (-183 3014557))  
	 (1/4  (171 239) (68 788) (-56 1744) (36 2943) (44 6613) (-112 13603) (144 28322))  
	 (1/4  (171 239) (68 993) (-20 2943) (56 4443) (-44 13252) (-112 17088) (156 28322))  
	 (1/4  (171 239) (124 993) (-56 1252) (56 2855) (-76 2943) (-100 13252) (100 28322))  
	 (1/4  (171 682) (183 788) (227 843) (95 2943) (44 6613) (-115 12943) (88 28322))  
	 (1/4  (171 682) (271 882) (95 993) (315 2917) (95 2943) (-227 9466) (200 12943))  
	 (1/4  (171 682) (366 1068) (139 2436) (271 5357) (315 5507) (227 6962) (-71 12943))  
	 (1/4  (176 463) (32 682) (241 798) (241 3141) (-58 5357) (-122 12943) (-51 390112))  
	 (1/4  (176 557) (244 757) (90 1068) (61 1393) (22 3458) (122 11018) (44 27493))  
	 (1/4  (179 239) (44 5357) (80 5507) (156 12943) (8 17923) (48 32807) (-40 157318))  
	 (1/4  (179 239) (120 4662) (4 5357) (116 12943) (-32 17923) (88 32807) (40 390112))  
	 (1/4  (179 233) (120 4662) (4 5357) (-63 12943) (-32 17923) (-91 32807) (40 390112))  
	 (1/4  (183 239) (32 682) (-88 1143) (132 2673) (68 12943) (-132 34208) (-44 44179))  
	 (1/4  (183 239) (32 1023) (-68 5832) (12 111693) (-100 6826318) (-12 9503057) (-12 232633636378307))  
	 (1/4  (183 239) (32 1023) (-68 5832) (12 112068) (-100 6826318) (-12 13288972) (-12 49541920807))  
	 (1/4  (183 239) (32 1023) (-68 5832) (12 113568) (-100 6826318) (12 23476958) (-12 111432033307))  
	 (1/4  (183 239) (32 1023) (-68 5832) (12 113568) (-100 6826318) (12 23481005) (-12 612463280182))  
	 (1/4  (183 239) (32 1023) (-68 5832) (12 113568) (-100 6826318) (12 23463218) (-12 29483238307))  
	 (1/4  (183 239) (32 1023) (-68 5832) (12 113568) (-100 6826318) (12 23481902) (-12 168925949733307))  
	 (1/4  (183 294) (44 905) (115 1292) (88 3957) (-32 12238) (68 12943) (51 114483))  
	 (1/4  (183 307) (32 682) (95 1143) (132 2673) (68 12943) (51 34208) (139 44179))  
	 (1/4  (183 378) (115 557) (29 1068) (122 2943) (144 3458) (-244 14318) (44 27493))  
	 (1/4  (183 378) (144 606) (86 1772) (122 2943) (-115 6118) (-71 14318) (-71 27493))  
	 (1/4  (183 378) (144 905) (115 1057) (151 2943) (-29 3957) (-100 14318) (-100 27493))  
	 (1/4  (183 378) (215 682) (44 1432) (51 2943) (-315 5257) (-71 12943) (44 13043))  
	 (1/4  (183 538) (215 682) (51 1068) (44 2309) (88 2673) (88 3039) (17 12943))  
	 (1/4  (183 568) (215 682) (278 1636) (-139 6107) (112 12943) (-234 19703) (132 32807))  
	 (1/4  (186 307) (41 378) (27 829) (-13 1713) (122 2943) (42 12238) (71 58911))  
	 (1/4  (190 577) (76 682) (176 882) (95 1393) (220 2917) (-132 9466) (200 12943))  
	 (1/4  (198 577) (200 606) (127 1393) (-20 2943) (112 3740) (-44 6118) (56 11018))  
	 (1/4  (199 233) (-60 1393) (-76 5357) (-43 12943) (-152 17923) (9 32807) (120 1049433))  
	 (1/4  (215 233) (-216 1568) (12 4662) (-64 6898) (113 12943) (-51 32807) (-32 534568))  
	 (1/4  (215 239) (-248 1568) (76 4662) (296 12943) (132 32807) (64 83270) (32 1493208))  
	 
	 (1/4  (160 200) (-1 239) (-4 515) (-8 4030) (-16 50105) (-16 62575) (-32 500150) (-80 4000300))    
	 (1/4  (215 682) (644 1568) (227 5767) (366 6898) (-532 12943)  (227 24331) (-51 32807) (183 534568))  
	 (1/4  (295 4193) (3767 5507) (593 18543) (-1228 39307) (2068 55603) (-962 211050) (-708 390112) (-1587 2867938)) 
	 (1/4  (537 1393) (1118 5357) (952 12943) (3032 17923) (-1384 32807) (-1194 157318) (-1870 1049433) (796 21638297)) 
	 (1/4  (581 1023) (183 4443) (664 5832) (732 11343) (-171 110443) (-366 595667) (171 4841182) (83 6826318)) 
	 (1/4  (581 1252) (764 4853) (1030 5832) (-398 58898) (-764 97232) (195 110443) (537 4841182) (266 6826318)) 
	 (1/4  (581 1252) (764 5593) (1030 5827) (366 58898) (195 110443) (537 4841182) (-764 6826318) (-1030 1561886607)) 
	 (1/4  (581 1252) (764 5618) (1030 5832) (366 58898) (195 110443) (764 1256859) (537 4841182) (266 6826318)) 
	 (1/4  (581 1252) (764 5593) (1030 5832) (366 69051) (195 110443) (366 369957) (171 4841182) (266 6826318)) 
	 (1/4  (581 1252) (764 5593) (1030 11557) (1030 11773) (366 58898) (195 110443) (537 4841182) (266 6826318)) 
	 (1/4  (581 1252) (1030 5507) (764 5593) (366 58898) (-1030 98821) (195 110443) (537 4841182) (266 6826318)) 
	 (1/4  (764 1068) (298 5832) (581 26307) (-183 78813) (-171 110443) (215 314982) (171 4841182) (83 6826318)) 
	 (1/4  (808 1477) (1308 2436) (-1635 5283) (-417 5507) (593 6962) (632 390112) (-561 2733307) (266 23747457))  
	 (1/4  (1074 1568) (840 5357) (-779 12943) (625 17923) (-1106 32807) (657 198505) (-259 390112) (657 24185182)) 
	 (1/4  (1074 4246) (1257 5357) (1731 6107) (295 12943) (625 19703) (-481 32807) (-1042 39307) (398 390112))  
	 (1/4  (1484 4693) (2097 4831) (366 18543) (1189 49457) (-227 123093) (-879 128643) (481 27872057) (-266 31895807)) 
	 (1/4  (1738 4193) (1699 4246) (144 6687) (-1443 32318) (-266 39307) (337 235318) (-227 390112) (-481 2282363)) 
	 (1/4  (2363 4557) (1218 5507) (1850 18543) (-266 39307) (-2658 49457) (1257 123093) (-1484 390112) (481 27872057))
	 
	 (1/4  (-31739656 201229582) (38819595 231373438) (110380200 284862638) (122355452 312322593) (-134055653 496651953) (5301720 509435077) (63861353 543644509) (68679613 934981432) (130575087 1845907403) (-32548340 2189376182) (-71616726 2539791558) (98822066 4732978887) (119051879 7804016832) (48482068 9233371207) (-99832073 41734246913) (-99143267 66492889557) (-25601898 73276714818) (-79323772 579766497643)) 
	 (1/4  (16106659 103224943) (48702787 196047454) (18674705 199762118) (8786524 201229582) (-16824928 244653118) (-9582339 261221282) (33092716 266981905) (50379909 270684757) (24748365 909140573) (31675677 1770638022) (1576733 2189376182) (-4742586 2701984943) (-34586991 5475957057) (10864048 14033378718) (-13079131 18986886768) (22266057 25220059245) (17791526 34840696582) (-12650410 193100304493)) 
	 (1/4  (154370374 124845505) (-90941691 193788912) (64454803 196047454) (-82996236 201229582) (109691394 244653118) (-15562779 462333568) (6518215 553806443) (-169821027 1134156517) (-244516782 1222853176) (100563577 2154947322) (-47118309 2189376182) (-35713908 4006581229) (60656646 5475957057) (-4001125 18986886768) (-68810571 37093513413) (-20888958 100083704193) (16990004 250645741818) (-62587614 5142102426318)) 
	 (1/4  (-119375678 193788912) (61799442 201229582) (-19991865 272525023) (20438744 321390012) (88331413 331905423) (103467976 343841922) (88464202 378026293) (138122046 600536193) (44232101 653023206) (115219328 846974497) (-81969855 1033937133) (-63521464 1454097393) (-118694678 2189376182) (117332455 2322170807) (-26482877 6884660047) (-18702052 29546599818) (7415308 250645741818) (166718050 512223806648)) 
	 (1/4  (-85386445 101859193) (4420755 112519818) (43555859 193788912) (15003774 194195097) (108912996 201229582) (61225652 231373438) (16824928 262992072) (73421340 284862638) (123118321 1057929843) (-10593254 2189376182) (40618746 2539791558) (73863237 2616939213) (-30947737 14811180432) (58354910 41734246913) (19908612 66492889557) (5345839 73276714818) (-90280386 120563046313) (61328880 579766497643)) 
	 (1/4  (-75143577 193788912) (17567341 201229582) (64670845 321390012) (88331413 331905423) (103467976 343841922) (68472337 372954564) (49657844 600536193) (115219328 846974497) (24240236 1012047353) (-81969855 1033937133) (24942738 1454097393) (-118694678 2189376182) (73100354 2322170807) (-88464202 4549886677) (-26482877 6884660047) (-18702052 29546599818) (7415308 250645741818) (34021747 512223806648)) 
	 (1/4  (-9761163 108220762) (13910116 144252856) (12032992 157157432) (55358773 167207057) (6697039 168623905) (-28651627 193788912) (1825738 201229582) (67020547 215266693) (-1575761 216260702) (45238607 284862638) (10024910 934981432) (20338355 2189376182) (-450675 4832545807) (-27703534 4935283579) (-25688998 7804016832) (-58020549 18986886768) (-28330426 120563046313) (-20446387 69971515635443)) 
	 (1/4  (-9719634 193788912) (17567341 201229582) (70452403 204415882) (12270610 244653118) (18184957 313467682) (44573394 426775692) (3945487 600536193) (33076315 892642643) (62731148 919331002) (18631836 1012047353) (58964485 1454097393) (32836016 2032914193) (-3430506 2189376182) (-19017973 5475957057) (60427493 6884660047) (-9222216 16406542707) (25467476 22827763470) (-8020348 29546599818)) 
	 (1/4  (-7707046 100457781) (102467557 168623905) (-37989469 201229582) (-19264491 216904033) (74130709 231373438) (9117882 262992072) (61898132 284862638) (-26046661 314198789) (20721724 327012132) (-6893934 1111885489) (-40541219 1183092682) (-40255386 2189376182) (82347539 2296713307) (31354293 12988236682) (27538131 18221678207) (-68243977 41734246913) (12646329 73276714818) (-45544955 193100304493)) 
	 (1/4  (-6829481 193788912) (49141523 227661182) (80561462 231373438) (12671730 244653118) (29897458 284862638) (-73630486 355671793) (58626712 398795108) (62468573 509435077) (24454447 543644509) (-19908612 657922943) (28905471 1057929843) (35237534 1845907403) (26678061 2189376182) (-117350972 4866438247) (-61240161 5475957057) (23212961 9075730623) (-20886351 9233371207) (-65421299 60402345333)) 
	 (1/4  (-6249813 193788912) (56771042 201229582) (28076746 231373438) (-19468648 262992072) (30639871 266981905) (19911270 284862638) (130457979 532399876) (96830507 672554667) (-25661007 1057929843) (13459441 1111885489) (-45480502 1183092682) (5693286 1770638022) (-21577251 2170952313) (-67486342 2189376182) (2925523 2701984943) (27538131 18221678207) (-7198038 193100304493) (36293576 307026452057)) 
	 (1/4  (-60656646 143846482) (38271221 144309885) (138138220 157565949) (35739707 193788912) (-42115413 201229582) (-49270023 231373438) (94471578 278263393) (-68287996 398795108) (87062724 462333568) (-21411533 593897943) (-13257608 1057929843) (-106971336 1206519637) (34427295 2189376182) (166256019 4006581229) (111296506 4832545807) (58999250 18986886768) (100563577 373139596292) (100694535 5142102426318)) 
	 (1/4  (-5621437 103224943) (81294931 115811807) (23943179 193788912) (33709426 199762118) (-2077524 201229582) (-31310435 261221282) (4978864 266981905) (-15147806 282218776) (-1688365 909140573) (20050974 1047764193) (-18279356 1770638022) (-1777511 2189376182) (19200593 2701984943) (-21507860 5475957057) (30332696 34840696582) (26011854 48312162432) (7938525 193100304493) (9186926 250645741818)) 
	 (1/4  (-5497394 101057042) (65180148 144309885) (53832596 193788912) (48554212 201229582) (52075350 447821668) (-105963621 539290393) (-8554603 2060228568) (7313117 2112819717) (-57858314 2189376182) (-3891660 2572149874) (7518287 3261365450) (-19908612 4044044333) (12568802 4866438247) (-83992146 5494891577) (-68408704 9233371207) (6071631 20336334426) (26993421 45384196187) (-20080982 71617196968)) 
	 (1/4  (-52897653 193788912) (17567341 201229582) (88637360 214539684) (16824928 329492391) (87365276 426775692) (89084239 434859193) (64670845 478798161) (-60879340 600536193) (51820567 706366957) (25661007 1033937133) (-7721255 1119211358) (-11874055 1454097393) (-46608525 2189376182) (-7415308 2674664693) (38361126 6884660047) (-54246761 29546599818) (29095538 42354792693) (55834766 512223806648)) 
	 (1/4  (-51730315 193788912) (50509639 201229582) (-2925523 224497457) (34338149 231373438) (56651725 266981905) (88974774 284862638) (6009207 367829623) (44851350 532399876) (77361859 672554667) (-36293576 1047764193) (19819495 1057929843) (-26011854 1695830317) (-10691678 1770638022) (-51609424 2170952313) (-31380534 2189376182) (21276728 18221678207) (9186926 250645741818) (-16384964 4125516427007)) 
	 (1/4  (-50738726 193788912) (95363435 196047454) (69453144 225823278) (69510447 227661182) (22432893 244653118) (-32772323 266981905) (-17689880 284862638) (-25151223 657922943) (45597610 672554667) (-15126313 934981432) (76492809 1770638022) (84039104 2189376182) (-104948381 4832545807) (-85627080 5475957057) (-40656362 5684017953) (-5242611 7804016832) (-197723175 18986886768) (42533486 25220059245)) 
	 (1/4  (-28765620 120868561) (44046442 160007778) (67427201 167207057) (37325093 191800592) (70499068 270090468) (-57543499 289008998) (17519675 361632045) (-4374603 747769833) (-52576452 2674664693) (-7666625 2971354082) (83775059 3069221943) (44136928 4549886677) (-7704241 4832545807) (109211041 4935283579) (43406332 5271470807) (-4967047 8815417307) (24253605 14033378718) (72936300 69392205693)) 
	 (1/4  (-19504206 100457781) (24986381 107793452) (26438497 121042733) (40255386 160007778) (28377269 168623905) (23815821 314198789) (-2374068 361632045) (25057307 672554667) (-9351768 773302059) (11008080 1479406293) (574237 2296713307) (-3020779 2701984943) (17648998 4038832337) (-9422284 12139595709) (27538131 12957904393) (20007517 12988236682) (23727647 18710140581) (-4711783 120563046313))       
	 (1/4  (-42543389 193788912) (74917830 201229582) (28076746 231373438) (16824928 262992072) (30639871 266981905) (74351634 284862638) (21577251 640348873) (78683719 672554667) (-25661007 1057929843) (-4687347 1111885489) (-27333714 1183092682) (5693286 1770638022) (8531273 2189376182) (-76017615 2674664693) (2925523 2701984943) (-39724039 4309606382) (27538131 18221678207) (68819577 193100304493)) 
	 (1/4  (-41665661 138884933) (61863206 168623905) (-24923249 201229582) (1860735 231373438) (152322833 244685917) (16824928 262992072) (45004160 284862638) (6816407 306903943) (-25731933 2189376182) (-2937113 2539791558) (-80514719 4100676432) (-30142453 5157407572) (88702086 17249711432) (10077565 18986886768) (-34456033 41734246913) (19908612 66492889557) (66436029 73276714818) (-10644159 579766497643)) 
	 (1/4  (-39775463 119742462) (20197545 168623905) (93476735 201229582) (1860735 231373438) (58490589 262992072) (86669821 284862638) (-4706801 437768635) (41665661 1258140850) (-35068662 1396533757) (-56669435 1624720807) (61079955 2189376182) (69090409 2539791558) (-73253757 3712239557) (42278290 41734246913) (-46591870 52254287493) (59684075 66492889557) (-12188492 73276714818) (-15350960 579766497643)) 
	 (1/4  (-3944315 103224943) (48706548 136899993) (18362609 186695067) (14767496 193788912) (-25501467 201229582) (-15136563 244653118) (29933522 261221282) (30079929 266981905) (117267526 480808760) (-30911261 1012047353) (40320881 1770638022) (53656250 2189376182) (20888958 2701984943) (-63283169 5475957057) (-32599626 37093513413) (-43463674 43917943025) (-64759288 193100304493) (21735578 5142102426318)) 
	 (1/4  (-3908713 100351813) (64565359 115453918) (26685223 201229582) (-8153925 214539684) (96935488 385231007) (15853328 459637173) (-19281720 539290393) (-48760063 883337939) (62688235 909140573) (-67639108 1282794079) (-5891323 1304967682) (-10583319 2189376182) (34749426 2572149874) (-55437542 3508373380) (-90085473 4427365493) (-35842901 5494891577) (-35317011 18986886768) (-22926686 45119420807)) 
	 (1/4  (-36515828 110175338) (5722932 193788912) (17567341 201229582) (83804410 203283777) (85603231 244653118) (79850836 273202197) (68353757 345311195) (-87424385 549758463) (-63893191 1454097393) (-111387800 1459933093) (69893108 1725455932) (-61767440 2189376182) (-19017973 5475957057) (102875038 6930719818) (47464799 16406542707) (21866697 29546599818) (-15003774 37093513413) (-46223313 5142102426318)) 
	 (1/4  (-36293576 132095062) (57870827 168623905) (-42543389 193788912) (35193791 201229582) (-8216830 231373438) (53118504 262992072) (30639871 266981905) (128791998 284862638) (60536931 672554667) (-25661007 1057929843) (49753017 1111885489) (-45480502 1183092682) (-30600290 1770638022) (-9615515 2189376182) (-69661629 2701984943) (63831707 18221678207) (29095538 193100304493) (-36293576 5142102426318)) 
	 (1/4  (-35775309 107793452) (-7119735 111530944) (127376638 115811807) (66649464 193788912) (-21949674 201229582) (-43413311 244653118) (-45561148 261221282) (49941099 266981905) (-9186926 396134107) (-886843 1770638022) (73138594 2189376182) (-39140796 2296713307) (61906878 2701984943) (-3565489 5458840213) (-21696619 5475957057) (-7498561 55237647473) (75356069 193100304493) (-1877124 579766497643)) 
	 (1/4  (-35368492 144309885) (-13432309 201229582) (124560353 231373438) (-8671679 284862638) (3303573 398795108) (141414744 509435077) (203277950 543644509) (-124589816 1845907403) (-32548340 2189376182) (-53309379 2539791558) (115883211 4732978887) (68679613 9075730623) (-1890198 9233371207) (19219806 41734246913) (19908612 66492889557) (60138860 73276714818) (-53675839 102428655030) (-10644159 579766497643)) 
	 (1/4  (-35368492 110911039) (50372266 113561432) (3303573 168623905) (-16735882 201229582) (74188087 231373438) (30000386 284862638) (106046252 509435077) (99229845 543644509) (-89221324 1845907403) (-67916832 2189376182) (-53309379 2539791558) (-15003774 3658567505) (65510945 4732978887) (-16893972 9233371207) (-19452259 41734246913) (-30463654 66492889557) (75142634 73276714818) (-10644159 579766497643)) 
	 (1/4  (-34897469 115453918) (87164915 118708522) (27407173 168623905) (87908983 193788912) (-27111639 201229582) (25214128 284862638) (-104763374 426775692) (55687060 600536193) (-49901243 909140573) (3434531 975229968) (-44950370 1454097393) (75180138 2189376182) (27482161 3508373380) (-68146942 4866438247) (-85620582 6884660047) (15583442 9233371207) (30725109 29546599818) (2193045 1442060060693)) 
	 (1/4  (-32461025 169937257) (42456472 193788912) (60136529 201229582) (45652872 230845763) (-11582317 231373438) (-12390325 448235443) (44415233 539290393) (59855124 595484173) (64938439 1057929843) (30600290 1500534537) (71357041 2189376182) (45920466 2616939213) (48826263 2701984943) (27854052 5494891577) (22522061 7193374037) (-21720539 11115923863) (1241486 14811180432) (-44678980 58240834569)) 
	 (1/4  (-30911476 193788912) (17567341 201229582) (68472337 272525023) (64670845 321390012) (88331413 331905423) (15003774 343841922) (5425743 600536193) (70987227 846974497) (-37737754 1033937133) (69174839 1454097393) (-30230476 2189376182) (28868253 2322170807) (-26482877 6884660047) (-44232101 24139206772) (-18702052 29546599818) (-44232101 50443911578) (7415308 250645741818) (-10210354 512223806648)) 
	 (1/4  (-30692741 227661182) (12504894 231373438) (-39446702 244653118) (114600079 262992072) (92590873 284862638) (113856011 314198789) (86140179 346369967) (-22467890 355671793) (-141382552 398795108) (59415160 657922943) (-7326899 1620933557) (-1037771 2189376182) (-79323772 8895085098) (-27205340 17997844652) (-10574983 41734246913) (-27904591 60402345333) (-79821190 73276714818) (16893972 102428655030)) 
	 (1/4  (-30361861 113561432) (85628068 168623905) (20493345 231373438) (53783788 262992072) (46894358 284862638) (65430523 1172624874) (36958860 1258140850) (-16893972 1624720807) (21304492 2189376182) (-1046915 2539791558) (-16436052 3658567505) (20222978 3712239557) (18632610 9549201618) (-27859034 41734246913) (-6816407 52254287493) (50270473 66492889557) (22880170 73276714818) (-10644159 579766497643)) 
	 (1/4  (-29735286 115453918) (-1890198 149299093) (12010178 168623905) (30661691 195053432) (7109402 201229582) (55743030 213255960) (32522426 231373438) (65751551 262992072) (35890388 284862638) (40220018 687606629) (-29216048 909140573) (-63654586 2189376182) (44099312 2539791558) (-33529628 41734246913) (-20830644 66492889557) (26660566 73276714818) (28204899 579766497643) (-48926623 1197009532318)) 
	 
	 (1/2  (94283734 231373438) (147962666 262992072) (211308992 284862638) (-26800082 318942476) (-69173113 610076381) (-137945216 1111885489) (126007473 1183092682) (333203505 2189376182) (-250903561 2296713307) (248078871 2539791558) (-379960570 5458840213) (-73879914 18221678207) (132652425 30446482737) (68447160 41734246913) (-28954879 66492889557) (35907922 73276714818) (124495078 193100304493) (118351969 579766497643) (18339615 69971515635443))
	 
	 (1/4  (-177112869 1047764193) (690072825 1057929843) (94777525 1082548618) (102841728 1770638022) (254740469 1845907403) (-7897447 2189376182) (-276135745 4866438247) (382919489 8634733487) (364832031 9233371207) (-255036003 18221678207) (-47281269 30446482737) (-14754756 31147706551) (145805470 35587716432) (-60553945 41734246913) (275062833 73276714818) (130937707 73745675437) (225667081 91140429801) (-58222931 120563046313) (217205407 250645741818) (-335335373 69971515635443)) 
	 (1/4  (48554212 1047764193) (-8064203 1695830317) (273129107 1845907403) (256152120 2060228568) (387484239 2170952313) (522262813 2189376182) (139928940 2426435870) (35269543 6249781117) (-116987170 9233371207) (-153310392 14885462059) (243523167 16346803247) (-191276069 18221678207) (-114320902 30446482737) (430509851 31147706551) (-62448154 35587716432) (118676670 41734246913) (-206756368 73276714818) (103732367 73745675437) (887580 250645741818) (-42628659 69971515635443)) 
	 (1/4  (59529729 1111885489) (411801489 1183092682) (-11697838 1770638022) (-10217933 2189376182) (178183864 2420845318) (481604223 2674664693) (200815307 2701984943) (18311409 4309606382) (-54066665 5684017953) (391091355 9566096322) (433050011 14033378718) (155959834 14474950443) (123563452 18221678207) (-322558047 18986886768) (-187246484 41734246913) (182267620 73276714818) (70949047 120563046313) (85657566 134237866432) (150508360 193100304493) (16824928 804006285737))
	 (1/4  (79674619 1057929843) (430112898 1183092682) (103029535 1770638022) (419995354 1845907403) (161719567 2189376182) (25897285 2701984943) (-165526275 3651666474) (-450635225 4866438247) (418811986 5684017953) (520079918 9233371207) (-370946465 11079391432) (11498734 14033378718) (1575319 15548138481) (-17734177 18221678207) (310673925 18986886768) (179773324 91140429801) (10643092 193100304493) (158038974 250645741818) (-165442692 804006285737) (119720378 11484937157318)) 
	 (1/4  (210413195 1047764193) (49034748 1057929843) (129893399 1111885489) (920835218 1222853176) (-367170458 1770638022) (-460082449 2154947322) (471386290 2189376182) (-4742586 2701984943) (-385386694 3651666474) (239038662 5684017953) (399473027 12988236682) (-298167989 14033378718) (111903950 15548138481) (-327400900 18221678207) (-789934617 18986886768) (-490722320 34352737807) (-639330225 193100304493) (-182267620 250645741818) (264670206 804006285737) (460026972 11484937157318)) 
	 (1/4  (245117311 1057929843) (-441536832 1111885489) (694624721 1183092682) (357582197 1845907403) (993878808 2189376182) (-264511823 2296713307) (279266579 2701984943) (-1351244216 4866438247) (255211890 9233371207) (142361641 10855443178) (-647040605 11079391432) (-55648319 15548138481) (-29232911 18221678207) (533067633 35587716432) (34223580 41734246913) (165442692 73276714818) (-215957611 91140429801) (786436927 120563046313) (939525243 193100304493) (311982932 250645741818)) 
	 (1/4  (290087814 1057929843) (129893399 1111885489) (189059832 1183092682) (312611694 1770638022) (-177755991 2189376182) (30639871 2539791558) (236310480 2701984943) (285108950 3651666474) (-530648699 5458840213) (208398791 5684017953) (381614163 14033378718) (81264079 15548138481) (-679782152 17249711432) (321741381 18221678207) (130900601 18986886768) (210413195 66492889557) (250865122 193100304493) (28145575 250645741818) (44970503 804006285737) (-460808246 11484937157318)) 
	 (1/4  (719865552 1057929843) (-120111015 1111885489) (-210078035 1183092682) (62607280 1770638022) (322252837 2189376182) (486314894 2701984943) (254469079 3651666474) (149133453 4832545807) (-401152271 5684017953) (491057480 7804016832) (-30639871 8995467682) (-328807860 14033378718) (392548235 15548138481) (-311284156 17058320068) (-669324927 18221678207) (-180383555 18986886768) (-60419034 193100304493) (278149989 250645741818) (325614788 804006285737) (-180163961 11484937157318)) 
	 (1/4  (764256596 1183092682) (340757269 1770638022) (82030807 2189376182) (-651971659 2296713307) (188678845 2539791558) (371182743 2701984943) (-541133952 5458840213) (282350263 5684017953) (261942239 9566096322) (414738602 14033378718) (-578034328 17249711432) (219993557 18221678207) (-126062774 18986886768) (-58097368 41734246913) (129149116 66492889557) (53118504 73276714818) (-68972608 120563046313) (210038089 193100304493) (285108950 579766497643) (16824928 804006285737)) 
	 (1/2  (-389355483 1111885489) (-85198635 1770638022) (942772580 2189376182) (860225796 2296713307) (958295292 2439473093) (1701938869 2701984943) (570217900 3651666474) (-653171089 5684017953) (1290597651 9566096322) (632981931 14033378718) (-258298232 15548138481) (-716081542 18221678207) (-448620821 18986886768) (-1711424041 41734246913) (1131248413 73276714818) (1650144299 120563046313) (1441452520 193100304493) (766713173 250645741818) (800363029 804006285737) (-1590316151 11484937157318)) 
	 (1/2  (-383575951 1082548618) (367447545 1695830317) (470326860 1845907403) (302791880 2060228568) (1332608020 2170952313) (1886585069 2189376182) (-562201563 2426435870) (610170129 2539791558) (-707278553 4732978887) (-215928441 6249781117) (-232950527 9233371207) (201602620 16346803247) (172870593 31147706551) (-125920121 35587716432) (696860645 41734246913) (207464734 66492889557) (-412488923 73276714818) (689924269 250645741818) (305596971 579766497643) (199162583 69971515635443))
	 
	 (1/2  (468218462 2189376182) (1818521088 2439473093) (1312583386 2701984943) (121856072 5684017953) (-1109476277 6327662603) (570217900 8634733487) (1720710549 9566096322) (718180566 14033378718) (601927564 15548138481) (-1921221601 18221678207) (-59265338 18986886768) (1164382644 30446482737) (-936396880 41734246913) (701135515 73276714818) (1205140059 73745675437) (875117138 120563046313) (236312461 193100304493) (336600275 250645741818) (715164394 804006285737) (-815288990 11484937157318) (-860225796 69971515635443))
	 )))
  (for-each 
   (lambda (formula)
     (let ((r (/ 1 (car formula)))
	   (sum 0.0))
       (for-each
	(lambda (arg)
	  (set! sum (+ sum (* (car arg) (atan (/ 1 (cadr arg)))))))
	(cdr formula))
       
       (if (> (abs (- (* r sum) pi)) 1e-12)
	   (begin (display formula) (display " = ") (display (* r sum)) (newline)))))
   formulas)
  
  (when with-bignums
    (let ((mxerr 0.0))
      (for-each 
       (lambda (formula)
	 (let ((r (/ (bignum "1") (car formula)))
	       (sum (bignum "0.0")))
	   (for-each
	    (lambda (arg)
	      (set! sum (+ sum (* (car arg) (atan (/ (bignum "1") (cadr arg)))))))
	    (cdr formula))
	   
	   (let ((err (abs (- (* r sum) (* 4 (atan (bignum "1.0") 1.0))))))
	     (if (> err mxerr)
		 (set! mxerr err)))))
       formulas)
      (if (> mxerr 1e-30)
	  (format #t "big max error: ~A~%" mxerr)))))

(let ((atans (list
	      0.00000000000000000000000000000000000000000000000000000000000000000000
	      0.04995839572194276141000628703484488149127708042350717441085345482998
	      0.09966865249116202737844611987802059024327832250431464801550877681002
	      0.14888994760949725058653039165586728099052584656913639751654183508627
	      0.19739555984988075837004976519479029344758510378785210151768894024103
	      0.24497866312686415417208248121127581091414409838118406712737591466735
	      0.29145679447786709199560462143289119350316759901206541927220608308729
	      0.33667481938672718139669863134176645842796861176681965716976593102220
	      0.38050637711236488630358791681043310449740571365810083757630562232420
	      0.42285392613294071296648279098114197360332058559089653470801277782477
	      0.46364760900080611621425623146121440202853705428612026381093308872019
	      0.50284321092786082733088202924527755577645581499776483101147435179592
	      0.54041950027058415544357836460859991013514825146259238811636023340959
	      0.57637522059118368022757047839377004593402018294846332167674413471879
	      0.61072596438920861654375887649023609381850306612882761584286773000023
	      0.64350110879328438680280922871732263804151059111531238286560611871351
	      0.67474094222355266305652097360981361507400625484071242312092170496930
	      0.70449406424221771665748034078199625698360683805607748632242138272858
	      0.73281510178650659164079207273428025198575567935825608631050693192821
	      0.75976275487577082892296119539998182400552294838843900175686400378812
	      0.78539816339744830961566084581987572104929234984377645524373614807695
	      0.80978357257016684662414585801888523310377327237135123533486105150550
	      0.83298126667443170541769356183636123851585134443710842085342312250327
	      0.85505273712601651097815432807058769283799489703232752323972864020297
	      0.87605805059819342311404752112834133907534524616033200346065614838499
	      0.89605538457134395617480071802993782702457844484684048736655059118459
	      0.91510070055336041656680197245527296654755880944161873770852665151657
	      0.93324752865620386989366255071265925262560793377140310475404520234906
	      0.95054684081207514789478913546381917504767901030880427426177057808809
	      0.96704699339746024466331914650201513140746494542545306371969751473184
	      0.98279372324732906798571061101466601449687745363162855676142508831798
	      0.99783018390619045494496187944270463542510496590550026609871776901127
	      1.01219701145133418325981347523809017175213711715353810435383625801215
	      1.02593241134335292660599590143869494280346122674543977431139573494988
	      1.03907225953609102762125033790727884531233378855364699989530509706554
	      1.05165021254837366745986731208629982963024430034204461753698029655611
	      1.06369782240255966094389111605254547856256296541932752568273985366635
	      1.07524465330906808242086208732184320752064516718532174460312177009311
	      1.08631839775787341806397958192567762897580047046812780208748680606431
	      1.09694499030013626798639002132512259906130967805041989207206852796014
	      1.10714871779409050301706546017853704007004764540143264667653920743371)))
  (let ((mxerr 0.0))
    (do ((i 0 (+ i 1))
	 (x 0.0 (+ x 0.05)))
	((= i 40))
      (let ((err (abs (- (atan x) (list-ref atans i)))))
	(if (> err mxerr)
	    (set! mxerr err))))
    (if (> mxerr 1e-12) (format #t "atan err: ~A~%" mxerr))))
    
(when with-bignums
  (let-temporarily (((*s7* 'bignum-precision) 500))
    (let ((atans (list ; table[Arctan[k/10], {k, 0, 30}]
		  0.00000000000000000000000000000000000000000000000000000000000000000000e0
		  0.09966865249116202737844611987802059024327832250431464801550877681002
		  0.19739555984988075837004976519479029344758510378785210151768894024103
		  0.29145679447786709199560462143289119350316759901206541927220608308729
		  0.38050637711236488630358791681043310449740571365810083757630562232420
		  0.46364760900080611621425623146121440202853705428612026381093308872019
		  0.54041950027058415544357836460859991013514825146259238811636023340959
		  0.61072596438920861654375887649023609381850306612882761584286773000023
		  0.67474094222355266305652097360981361507400625484071242312092170496930
		  0.73281510178650659164079207273428025198575567935825608631050693192821
		  0.78539816339744830961566084581987572104929234984377645524373614807695
		  0.83298126667443170541769356183636123851585134443710842085342312250327
		  0.87605805059819342311404752112834133907534524616033200346065614838499
		  0.91510070055336041656680197245527296654755880944161873770852665151657
		  0.95054684081207514789478913546381917504767901030880427426177057808809
		  0.98279372324732906798571061101466601449687745363162855676142508831798
		  1.01219701145133418325981347523809017175213711715353810435383625801215
		  1.03907225953609102762125033790727884531233378855364699989530509706554
		  1.06369782240255966094389111605254547856256296541932752568273985366635
		  1.08631839775787341806397958192567762897580047046812780208748680606431
		  1.10714871779409050301706546017853704007004764540143264667653920743371
		  1.12637711689379770989641767275145325372112241040085015241064879177491
		  1.14416883366802053001158090974633622082626800572469223488413501483165
		  1.16066898625340562678011092078453217718605394084134102434206195147540
		  1.17600520709513510249122216125017085520341449211184870745209441567184
		  1.19028994968253173292773377482931833760117898602945207291116667382970
		  1.20362249297667741080683267484687578339840429857832439350850411338551
		  1.21609067478395630285892632134113779481025954203667431449700610948231
		  1.22777238637419322215779309222594182541102155201281262388880100298534
		  1.23873685925201114137796025438808735907407693977120210817129118165791
		  1.24904577239825442582991707728109012307782940412989671905466923679715)))
      (do ((i 0 (+ i 1)))
	  ((= i 30))
	(let ((val (atan (/ i (bignum "10")))))
	  (if (> (magnitude (- val (list-ref atans i))) 1e-36)
	      (format #t ";(atan ~A) -> ~A ~A~%[~A]~%" (/ i 10) val (list-ref atans i) (magnitude (- val (list-ref atans i))))))))))



;;; --------------------------------------------------------------------------------
;;; sinh
;;; --------------------------------------------------------------------------------

(num-test (sinh 0) 0.0)
(num-test (sinh 1) 1.17520119364380)
(num-test (sinh -1) -1.17520119364380)
(num-test (sinh 2) 3.62686040784702)
(num-test (sinh -2) -3.62686040784702)
(num-test (sinh 3) 10.01787492740990)
(num-test (sinh -3) -10.01787492740990)
(num-test (sinh 10) 11013.23287470339346)
(num-test (sinh -10) -11013.23287470339346)
(num-test (sinh 0/1) 0.0)
(num-test (sinh 0/2) 0.0)
(num-test (sinh 0/3) 0.0)
(num-test (sinh 0/10) 0.0)
(num-test (sinh 0/1234) 0.0)
(num-test (sinh 0/1234000000) 0.0)
(num-test (sinh 0/500029) 0.0)
(num-test (sinh 0/362880) 0.0)
(num-test (sinh 1/1) 1.17520119364380)
(num-test (sinh -1/1) -1.17520119364380)
(num-test (sinh 1/2) 0.52109530549375)
(num-test (sinh -1/2) -0.52109530549375)
(num-test (sinh 1/3) 0.33954055725615)
(num-test (sinh -1/3) -0.33954055725615)
(num-test (sinh 1/10) 0.10016675001984)
(num-test (sinh -1/10) -0.10016675001984)
(num-test (sinh 1/1234) 0.00081037286017)
(num-test (sinh -1/1234) -0.00081037286017)
(num-test (sinh 1/1234000000) 0.00000000081037)
(num-test (sinh -1/1234000000) -0.00000000081037)
(num-test (sinh 1/500029) 0.00000199988401)
(num-test (sinh -1/500029) -0.00000199988401)
(num-test (sinh 1/362880) 0.00000275573192)
(num-test (sinh -1/362880) -0.00000275573192)
(num-test (sinh 2/1) 3.62686040784702)
(num-test (sinh -2/1) -3.62686040784702)
(num-test (sinh 2/2) 1.17520119364380)
(num-test (sinh -2/2) -1.17520119364380)
(num-test (sinh 2/3) 0.71715846101104)
(num-test (sinh -2/3) -0.71715846101104)
(num-test (sinh 2/10) 0.20133600254109)
(num-test (sinh -2/10) -0.20133600254109)
(num-test (sinh 2/1234) 0.00162074625252)
(num-test (sinh -2/1234) -0.00162074625252)
(num-test (sinh 2/1234000000) 0.00000000162075)
(num-test (sinh -2/1234000000) -0.00000000162075)
(num-test (sinh 2/500029) 0.00000399976801)
(num-test (sinh -2/500029) -0.00000399976801)
(num-test (sinh 2/362880) 0.00000551146384)
(num-test (sinh -2/362880) -0.00000551146384)
(num-test (sinh 3/1) 10.01787492740990)
(num-test (sinh -3/1) -10.01787492740990)
(num-test (sinh 3/2) 2.12927945509482)
(num-test (sinh -3/2) -2.12927945509482)
(num-test (sinh 3/3) 1.17520119364380)
(num-test (sinh -3/3) -1.17520119364380)
(num-test (sinh 3/10) 0.30452029344714)
(num-test (sinh -3/10) -0.30452029344714)
(num-test (sinh 3/1234) 0.00243112070921)
(num-test (sinh -3/1234) -0.00243112070921)
(num-test (sinh 3/1234000000) 0.00000000243112)
(num-test (sinh -3/1234000000) -0.00000000243112)
(num-test (sinh 3/500029) 0.00000599965202)
(num-test (sinh -3/500029) -0.00000599965202)
(num-test (sinh 3/362880) 0.00000826719577)
(num-test (sinh -3/362880) -0.00000826719577)
(num-test (sinh 10/1) 11013.23287470339346)
(num-test (sinh -10/1) -11013.23287470339346)
(num-test (sinh 10/2) 74.20321057778875)
(num-test (sinh -10/2) -74.20321057778875)
(num-test (sinh 10/3) 13.99797545058944)
(num-test (sinh -10/3) -13.99797545058944)
(num-test (sinh 10/10) 1.17520119364380)
(num-test (sinh -10/10) -1.17520119364380)
(num-test (sinh 10/1234) 0.00810381641088)
(num-test (sinh -10/1234) -0.00810381641088)
(num-test (sinh 10/1234000000) 0.00000000810373)
(num-test (sinh -10/1234000000) -0.00000000810373)
(num-test (sinh 10/500029) 0.00001999884007)
(num-test (sinh -10/500029) -0.00001999884007)
(num-test (sinh 10/362880) 0.00002755731923)
(num-test (sinh -10/362880) -0.00002755731923)
(num-test (sinh 1234/1234) 1.17520119364380)
(num-test (sinh -1234/1234) -1.17520119364380)
(num-test (sinh 1234/1234000000) 0.00000100000000)
(num-test (sinh -1234/1234000000) -0.00000100000000)
(num-test (sinh 1234/500029) 0.00246785936931)
(num-test (sinh -1234/500029) -0.00246785936931)
(num-test (sinh 1234/362880) 0.00340057974622)
(num-test (sinh -1234/362880) -0.00340057974622)
(num-test (sinh 1234000000/1234000000) 1.17520119364380)
(num-test (sinh -1234000000/1234000000) -1.17520119364380)
(num-test (sinh 500029/1234000000) 0.00040520989764)
(num-test (sinh -500029/1234000000) -0.00040520989764)
(num-test (sinh 500029/500029) 1.17520119364380)
(num-test (sinh -500029/500029) -1.17520119364380)
(num-test (sinh 500029/362880) 1.85732460755603)
(num-test (sinh -500029/362880) -1.85732460755603)
(num-test (sinh 362880/1234000000) 0.00029406807555)
(num-test (sinh -362880/1234000000) -0.00029406807555)
(num-test (sinh 362880/500029) 0.79111846340564)
(num-test (sinh -362880/500029) -0.79111846340564)
(num-test (sinh 362880/362880) 1.17520119364380)
(num-test (sinh -362880/362880) -1.17520119364380)
(num-test (sinh 0.0) 0.0)
(num-test (sinh 0.00000001) 0.00000001)
(num-test (sinh -0.00000001) -0.00000001)
(num-test (sinh 1.0) 1.17520119364380)
(num-test (sinh -1.0) -1.17520119364380)
(num-test (sinh pi) 11.54873935725775)
(num-test (sinh -3.14159265358979) -11.54873935725775)
(num-test (sinh 2.71828182845905) 7.54413710281697)
(num-test (sinh -2.71828182845905) -7.54413710281697)
(num-test (sinh 0.0+0.0i) 0.0)
(num-test (sinh -0.0+0.0i) 0.0)
(num-test (sinh 0.0-0.0i) 0.0)
(num-test (sinh -0.0-0.0i) 0.0)
(num-test (sinh 0.0+0.00000001i) 0.0+0.00000001i)
(num-test (sinh -0.0+0.00000001i) 0.0+0.00000001i)
(num-test (sinh 0.0-0.00000001i) 0.0-0.00000001i)
(num-test (sinh -0.0-0.00000001i) -0.0-0.00000001i)
(num-test (sinh 0.0+1.0i) 0.0+0.84147098480790i)
(num-test (sinh -0.0+1.0i) 0.0+0.84147098480790i)
(num-test (sinh 0.0-1.0i) 0.0-0.84147098480790i)
(num-test (sinh -0.0-1.0i) -0.0-0.84147098480790i)
(num-test (sinh 0.00000001+0.0i) 0.00000001)
(num-test (sinh -0.00000001+0.0i) -0.00000001)
(num-test (sinh 0.00000001-0.0i) 0.00000001)
(num-test (sinh -0.00000001-0.0i) -0.00000001)
(num-test (sinh 0.00000001+0.00000001i) 0.00000001+0.00000001i)
(num-test (sinh -0.00000001+0.00000001i) -0.00000001+0.00000001i)
(num-test (sinh 0.00000001-0.00000001i) 0.00000001-0.00000001i)
(num-test (sinh -0.00000001-0.00000001i) -0.00000001-0.00000001i)
(num-test (sinh 0.00000001+1.0i) 0.00000000540302+0.84147098480790i)
(num-test (sinh -0.00000001+1.0i) -0.00000000540302+0.84147098480790i)
(num-test (sinh 0.00000001-1.0i) 0.00000000540302-0.84147098480790i)
(num-test (sinh -0.00000001-1.0i) -0.00000000540302-0.84147098480790i)
(num-test (sinh 1.0+0.0i) 1.17520119364380)
(num-test (sinh -1.0+0.0i) -1.17520119364380)
(num-test (sinh 1.0-0.0i) 1.17520119364380)
(num-test (sinh -1.0-0.0i) -1.17520119364380)
(num-test (sinh 1.0+0.00000001i) 1.17520119364380+0.00000001543081i)
(num-test (sinh -1.0+0.00000001i) -1.17520119364380+0.00000001543081i)
(num-test (sinh 1.0-0.00000001i) 1.17520119364380-0.00000001543081i)
(num-test (sinh -1.0-0.00000001i) -1.17520119364380-0.00000001543081i)
(num-test (sinh 1.0+1.0i) 0.63496391478474+1.29845758141598i)
(num-test (sinh -1.0+1.0i) -0.63496391478474+1.29845758141598i)
(num-test (sinh 1.0-1.0i) 0.63496391478474-1.29845758141598i)
(num-test (sinh -1.0-1.0i) -0.63496391478474-1.29845758141598i)
(num-test (sinh 3.14159265358979+0.0i) 11.54873935725775)
(num-test (sinh -3.14159265358979+0.0i) -11.54873935725775)
(num-test (sinh 3.14159265358979-0.0i) 11.54873935725775)
(num-test (sinh -3.14159265358979-0.0i) -11.54873935725775)
(num-test (sinh 3.14159265358979+0.00000001i) 11.54873935725775+0.00000011591953i)
(num-test (sinh -3.14159265358979+0.00000001i) -11.54873935725775+0.00000011591953i)
(num-test (sinh 3.14159265358979-0.00000001i) 11.54873935725775-0.00000011591953i)
(num-test (sinh -3.14159265358979-0.00000001i) -11.54873935725775-0.00000011591953i)
(num-test (sinh 3.14159265358979+1.0i) 6.23981050459650+9.75429233860021i)
(num-test (sinh -3.14159265358979+1.0i) -6.23981050459650+9.75429233860021i)
(num-test (sinh 3.14159265358979-1.0i) 6.23981050459650-9.75429233860021i)
(num-test (sinh -3.14159265358979-1.0i) -6.23981050459650-9.75429233860021i)
(num-test (sinh 2.71828182845905+0.0i) 7.54413710281697)
(num-test (sinh -2.71828182845905+0.0i) -7.54413710281697)
(num-test (sinh 2.71828182845905-0.0i) 7.54413710281697)
(num-test (sinh -2.71828182845905-0.0i) -7.54413710281697)
(num-test (sinh 2.71828182845905+0.00000001i) 7.54413710281697+0.00000007610125i)
(num-test (sinh -2.71828182845905+0.00000001i) -7.54413710281697+0.00000007610125i)
(num-test (sinh 2.71828182845905-0.00000001i) 7.54413710281697-0.00000007610125i)
(num-test (sinh -2.71828182845905-0.00000001i) -7.54413710281697-0.00000007610125i)
(num-test (sinh 2.71828182845905+1.0i) 4.07611467243740+6.40369949494148i)
(num-test (sinh -2.71828182845905+1.0i) -4.07611467243740+6.40369949494148i)
(num-test (sinh 2.71828182845905-1.0i) 4.07611467243740-6.40369949494148i)
(num-test (sinh -2.71828182845905-1.0i) -4.07611467243740-6.40369949494148i)
(num-test (sinh 1234/3) 2.18155865313939E+178) 
(num-test (sinh 1234/10) 1.953930316004457E+53) 
(num-test (sinh 0.0+3.14159265358979i) 0.0-6.982889851335445E-15i) 
(num-test (sinh 0.0+2.71828182845905i) 0.0+0.4107812905029501i) 
(num-test (sinh 0.00000001+3.14159265358979i) -1.00000000000000003758922749678992050291E-8+3.231089148865173792463232707134864571569E-15i)
(num-test (sinh 0.00000001+2.71828182845905i) -9.117339147869465E-9+0.4107812905029501i) 
(num-test (sinh 0.00000001+1234.0i) -7.985506235875843E-9+0.6019276547624973i) 
(num-test (sinh 0.00000001+1234000000.0i) 1.5890913089022285E-9-0.9872932128398908i) 
(num-test (sinh 1.0+3.14159265358979i) -1.175201193643801-1.077516210464362E-14i) 
(num-test (sinh 1.0+2.71828182845905i) -1.071470784943156+0.6338686545195173i) 
(num-test (sinh 3.14159265358979+3.14159265358979i) -11.54873935725783-8.094533288479446E-14i) 
(num-test (sinh 3.14159265358979+2.71828182845905i) -10.52937734504676+4.761757525968664i) 
(num-test (sinh 3.14159265358979+1234.0i) -9.222253015388718+6.977517249251167i) 
(num-test (sinh 3.14159265358979+1234000000.0i) 1.835200134139553-11.44465679247962i) 
(num-test (sinh 2.71828182845905+3.14159265358979i) -7.54413710281663-5.314066559815525E-14i) 
(num-test (sinh 2.71828182845905+2.71828182845905i) -6.878245654440458+3.126097025348496i) 
(num-test (sinh 2.71828182845905+1234.0i) -6.024375387884452+4.58074477716391i) 
(num-test (sinh 2.71828182845905+1234000000.0i) 1.198832270325275-7.513424898263172i) 
(num-test (sinh 0.0e+00-3.45266983001243932001e-04i) 0-3.4526697614140534807e-4i)
(num-test (sinh 0.0e+00+3.45266983001243932001e-04i) 0+3.4526697614140534807e-4i)
(num-test (sinh 0.0e+00+1.57045105981189525579e+00i) 0+9.9999994039535581669e-1i)
(num-test (sinh 0.0e+00-1.57045105981189525579e+00i) 0-9.9999994039535581669e-1i)
(num-test (sinh 0.0e+00+1.57114159377789786021e+00i) 0+9.9999994039535581673e-1i)
(num-test (sinh 0.0e+00-1.57114159377789786021e+00i) 0-9.9999994039535581673e-1i)
(num-test (sinh 0.0e+00+3.14124738660679181379e+00i) 0+3.4526697614158608860e-4i)
(num-test (sinh 0.0e+00-3.14124738660679181379e+00i) 0-3.4526697614158608860e-4i)
(num-test (sinh 0.0e+00+3.14193792057279441821e+00i) 0-3.4526697614134115926e-4i)
(num-test (sinh 0.0e+00-3.14193792057279441821e+00i) 0+3.4526697614134115926e-4i)
(num-test (sinh 0.0e+00+4.71204371340168837179e+00i) 0-9.9999994039535581664e-1i)
(num-test (sinh 0.0e+00-4.71204371340168837179e+00i) 0+9.9999994039535581664e-1i)
(num-test (sinh 0.0e+00+4.71273424736769097620e+00i) 0-9.9999994039535581677e-1i)
(num-test (sinh 0.0e+00-4.71273424736769097620e+00i) 0+9.9999994039535581677e-1i)
(num-test (sinh 0.0e+00+6.28284004019658492979e+00i) 0-3.4526697614170855328e-4i)
(num-test (sinh 0.0e+00-6.28284004019658492979e+00i) 0+3.4526697614170855328e-4i)
(num-test (sinh 0.0e+00+6.28353057416258753420e+00i) 0+3.4526697614121869459e-4i)
(num-test (sinh 0.0e+00-6.28353057416258753420e+00i) 0-3.4526697614121869459e-4i)
(num-test (sinh 0.0e+00+9.42443269378637893396e+00i) 0+3.4526697614094283958e-4i)
(num-test (sinh 0.0e+00-9.42443269378637893396e+00i) 0-3.4526697614094283958e-4i)
(num-test (sinh 0.0e+00+9.42512322775237976202e+00i) 0-3.4526697614020805155e-4i)
(num-test (sinh 0.0e+00-9.42512322775237976202e+00i) 0+3.4526697614020805155e-4i)
(num-test (sinh 1.19209289550781250e-07-3.45266983001243932001e-04i) 1.1920928244535424533e-7-3.4526697614140780134e-4i)
(num-test (sinh 1.19209289550781250e-07+3.45266983001243932001e-04i) 1.1920928244535424533e-7+3.4526697614140780134e-4i)
(num-test (sinh -1.19209289550781250e-07-3.45266983001243932001e-04i) -1.1920928244535424533e-7-3.4526697614140780134e-4i)
(num-test (sinh -1.19209289550781250e-07+3.45266983001243932001e-04i) -1.1920928244535424533e-7+3.4526697614140780134e-4i)
(num-test (sinh 1.19209289550781250e-07+1.57045105981189525579e+00i) 4.1159030931177815679e-11+9.9999994039536292211e-1i)
(num-test (sinh 1.19209289550781250e-07-1.57045105981189525579e+00i) 4.1159030931177815679e-11-9.9999994039536292211e-1i)
(num-test (sinh -1.19209289550781250e-07+1.57045105981189525579e+00i) -4.1159030931177815679e-11+9.9999994039536292211e-1i)
(num-test (sinh -1.19209289550781250e-07-1.57045105981189525579e+00i) -4.1159030931177815679e-11-9.9999994039536292211e-1i)
(num-test (sinh 1.19209289550781250e-07+1.57114159377789786021e+00i) -4.1159030931163216752e-11+9.9999994039536292216e-1i)
(num-test (sinh 1.19209289550781250e-07-1.57114159377789786021e+00i) -4.1159030931163216752e-11-9.9999994039536292216e-1i)
(num-test (sinh -1.19209289550781250e-07+1.57114159377789786021e+00i) 4.1159030931163216752e-11+9.9999994039536292216e-1i)
(num-test (sinh -1.19209289550781250e-07-1.57114159377789786021e+00i) 4.1159030931163216752e-11-9.9999994039536292216e-1i)
(num-test (sinh 1.19209289550781250e-07+3.14124738660679181379e+00i) -1.1920928244535424532e-7+3.4526697614158854187e-4i)
(num-test (sinh 1.19209289550781250e-07-3.14124738660679181379e+00i) -1.1920928244535424532e-7-3.4526697614158854187e-4i)
(num-test (sinh -1.19209289550781250e-07+3.14124738660679181379e+00i) 1.1920928244535424532e-7+3.4526697614158854187e-4i)
(num-test (sinh -1.19209289550781250e-07-3.14124738660679181379e+00i) 1.1920928244535424532e-7-3.4526697614158854187e-4i)
(num-test (sinh 1.19209289550781250e-07+3.14193792057279441821e+00i) -1.1920928244535424533e-7-3.4526697614134361253e-4i)
(num-test (sinh 1.19209289550781250e-07-3.14193792057279441821e+00i) -1.1920928244535424533e-7+3.4526697614134361253e-4i)
(num-test (sinh -1.19209289550781250e-07+3.14193792057279441821e+00i) 1.1920928244535424533e-7-3.4526697614134361253e-4i)
(num-test (sinh -1.19209289550781250e-07-3.14193792057279441821e+00i) 1.1920928244535424533e-7+3.4526697614134361253e-4i)
(num-test (sinh 1.19209289550781250e-07+4.71204371340168837179e+00i) -4.1159030931192414605e-11-9.9999994039536292207e-1i)
(num-test (sinh 1.19209289550781250e-07-4.71204371340168837179e+00i) -4.1159030931192414605e-11+9.9999994039536292207e-1i)
(num-test (sinh -1.19209289550781250e-07+4.71204371340168837179e+00i) 4.1159030931192414605e-11-9.9999994039536292207e-1i)
(num-test (sinh -1.19209289550781250e-07-4.71204371340168837179e+00i) 4.1159030931192414605e-11+9.9999994039536292207e-1i)
(num-test (sinh 1.19209289550781250e-07+4.71273424736769097620e+00i) 4.1159030931148617825e-11-9.9999994039536292220e-1i)
(num-test (sinh 1.19209289550781250e-07-4.71273424736769097620e+00i) 4.1159030931148617825e-11+9.9999994039536292220e-1i)
(num-test (sinh -1.19209289550781250e-07+4.71273424736769097620e+00i) -4.1159030931148617825e-11-9.9999994039536292220e-1i)
(num-test (sinh -1.19209289550781250e-07-4.71273424736769097620e+00i) -4.1159030931148617825e-11+9.9999994039536292220e-1i)
(num-test (sinh 1.19209289550781250e-07+6.28284004019658492979e+00i) 1.1920928244535424532e-7-3.4526697614171100655e-4i)
(num-test (sinh 1.19209289550781250e-07-6.28284004019658492979e+00i) 1.1920928244535424532e-7+3.4526697614171100655e-4i)
(num-test (sinh -1.19209289550781250e-07+6.28284004019658492979e+00i) -1.1920928244535424532e-7-3.4526697614171100655e-4i)
(num-test (sinh -1.19209289550781250e-07-6.28284004019658492979e+00i) -1.1920928244535424532e-7+3.4526697614171100655e-4i)
(num-test (sinh 1.19209289550781250e-07+6.28353057416258753420e+00i) 1.1920928244535424534e-7+3.4526697614122114786e-4i)
(num-test (sinh 1.19209289550781250e-07-6.28353057416258753420e+00i) 1.1920928244535424534e-7-3.4526697614122114786e-4i)
(num-test (sinh -1.19209289550781250e-07+6.28353057416258753420e+00i) -1.1920928244535424534e-7+3.4526697614122114786e-4i)
(num-test (sinh -1.19209289550781250e-07-6.28353057416258753420e+00i) -1.1920928244535424534e-7-3.4526697614122114786e-4i)
(num-test (sinh 1.19209289550781250e-07+9.42443269378637893396e+00i) -1.1920928244535424535e-7+3.4526697614094529285e-4i)
(num-test (sinh 1.19209289550781250e-07-9.42443269378637893396e+00i) -1.1920928244535424535e-7-3.4526697614094529285e-4i)
(num-test (sinh -1.19209289550781250e-07+9.42443269378637893396e+00i) 1.1920928244535424535e-7+3.4526697614094529285e-4i)
(num-test (sinh -1.19209289550781250e-07-9.42443269378637893396e+00i) 1.1920928244535424535e-7-3.4526697614094529285e-4i)
(num-test (sinh 1.19209289550781250e-07+9.42512322775237976202e+00i) -1.1920928244535424538e-7-3.4526697614021050482e-4i)
(num-test (sinh 1.19209289550781250e-07-9.42512322775237976202e+00i) -1.1920928244535424538e-7+3.4526697614021050482e-4i)
(num-test (sinh -1.19209289550781250e-07+9.42512322775237976202e+00i) 1.1920928244535424538e-7-3.4526697614021050482e-4i)
(num-test (sinh -1.19209289550781250e-07-9.42512322775237976202e+00i) 1.1920928244535424538e-7+3.4526697614021050482e-4i)
(num-test (sinh 5.0e-01-3.45266983001243932001e-04i) 5.2109527443404709209e-1-3.8933200722534065172e-4i)
(num-test (sinh 5.0e-01+3.45266983001243932001e-04i) 5.2109527443404709209e-1+3.8933200722534065172e-4i)
(num-test (sinh -5.0e-01-3.45266983001243932001e-04i) -5.2109527443404709209e-1-3.8933200722534065172e-4i)
(num-test (sinh -5.0e-01+3.45266983001243932001e-04i) -5.2109527443404709209e-1+3.8933200722534065172e-4i)
(num-test (sinh 5.0e-01+1.57045105981189525579e+00i) 1.7991700040937027667e-4+1.1276258979946363572e0i)
(num-test (sinh 5.0e-01-1.57045105981189525579e+00i) 1.7991700040937027667e-4-1.1276258979946363572e0i)
(num-test (sinh -5.0e-01+1.57045105981189525579e+00i) -1.7991700040937027667e-4+1.1276258979946363572e0i)
(num-test (sinh -5.0e-01-1.57045105981189525579e+00i) -1.7991700040937027667e-4-1.1276258979946363572e0i)
(num-test (sinh 5.0e-01+1.57114159377789786021e+00i) -1.7991700040930646090e-4+1.1276258979946363573e0i)
(num-test (sinh 5.0e-01-1.57114159377789786021e+00i) -1.7991700040930646090e-4-1.1276258979946363573e0i)
(num-test (sinh -5.0e-01+1.57114159377789786021e+00i) 1.7991700040930646090e-4+1.1276258979946363573e0i)
(num-test (sinh -5.0e-01-1.57114159377789786021e+00i) 1.7991700040930646090e-4-1.1276258979946363573e0i)
(num-test (sinh 5.0e-01+3.14124738660679181379e+00i) -5.2109527443404709206e-1+3.8933200722554445944e-4i)
(num-test (sinh 5.0e-01-3.14124738660679181379e+00i) -5.2109527443404709206e-1-3.8933200722554445944e-4i)
(num-test (sinh -5.0e-01+3.14124738660679181379e+00i) 5.2109527443404709206e-1+3.8933200722554445944e-4i)
(num-test (sinh -5.0e-01-3.14124738660679181379e+00i) 5.2109527443404709206e-1-3.8933200722554445944e-4i)
(num-test (sinh 5.0e-01+3.14193792057279441821e+00i) -5.2109527443404709211e-1-3.8933200722526827075e-4i)
(num-test (sinh 5.0e-01-3.14193792057279441821e+00i) -5.2109527443404709211e-1+3.8933200722526827075e-4i)
(num-test (sinh -5.0e-01+3.14193792057279441821e+00i) 5.2109527443404709211e-1-3.8933200722526827075e-4i)
(num-test (sinh -5.0e-01-3.14193792057279441821e+00i) 5.2109527443404709211e-1+3.8933200722526827075e-4i)
(num-test (sinh 5.0e-01+4.71204371340168837179e+00i) -1.7991700040943409243e-4-1.1276258979946363572e0i)
(num-test (sinh 5.0e-01-4.71204371340168837179e+00i) -1.7991700040943409243e-4+1.1276258979946363572e0i)
(num-test (sinh -5.0e-01+4.71204371340168837179e+00i) 1.7991700040943409243e-4-1.1276258979946363572e0i)
(num-test (sinh -5.0e-01-4.71204371340168837179e+00i) 1.7991700040943409243e-4+1.1276258979946363572e0i)
(num-test (sinh 5.0e-01+4.71273424736769097620e+00i) 1.7991700040924264514e-4-1.1276258979946363573e0i)
(num-test (sinh 5.0e-01-4.71273424736769097620e+00i) 1.7991700040924264514e-4+1.1276258979946363573e0i)
(num-test (sinh -5.0e-01+4.71273424736769097620e+00i) -1.7991700040924264514e-4-1.1276258979946363573e0i)
(num-test (sinh -5.0e-01-4.71273424736769097620e+00i) -1.7991700040924264514e-4+1.1276258979946363573e0i)
(num-test (sinh 5.0e-01+6.28284004019658492979e+00i) 5.2109527443404709204e-1-3.8933200722568255379e-4i)
(num-test (sinh 5.0e-01-6.28284004019658492979e+00i) 5.2109527443404709204e-1+3.8933200722568255379e-4i)
(num-test (sinh -5.0e-01+6.28284004019658492979e+00i) -5.2109527443404709204e-1-3.8933200722568255379e-4i)
(num-test (sinh -5.0e-01-6.28284004019658492979e+00i) -5.2109527443404709204e-1+3.8933200722568255379e-4i)
(num-test (sinh 5.0e-01+6.28353057416258753420e+00i) 5.2109527443404709213e-1+3.8933200722513017641e-4i)
(num-test (sinh 5.0e-01-6.28353057416258753420e+00i) 5.2109527443404709213e-1-3.8933200722513017641e-4i)
(num-test (sinh -5.0e-01+6.28353057416258753420e+00i) -5.2109527443404709213e-1+3.8933200722513017641e-4i)
(num-test (sinh -5.0e-01-6.28353057416258753420e+00i) -5.2109527443404709213e-1-3.8933200722513017641e-4i)
(num-test (sinh 5.0e-01+9.42443269378637893396e+00i) -5.2109527443404709218e-1+3.8933200722481911514e-4i)
(num-test (sinh 5.0e-01-9.42443269378637893396e+00i) -5.2109527443404709218e-1-3.8933200722481911514e-4i)
(num-test (sinh -5.0e-01+9.42443269378637893396e+00i) 5.2109527443404709218e-1+3.8933200722481911514e-4i)
(num-test (sinh -5.0e-01-9.42443269378637893396e+00i) 5.2109527443404709218e-1-3.8933200722481911514e-4i)
(num-test (sinh 5.0e-01+9.42512322775237976202e+00i) -5.2109527443404709231e-1-3.8933200722399054908e-4i)
(num-test (sinh 5.0e-01-9.42512322775237976202e+00i) -5.2109527443404709231e-1+3.8933200722399054908e-4i)
(num-test (sinh -5.0e-01+9.42512322775237976202e+00i) 5.2109527443404709231e-1-3.8933200722399054908e-4i)
(num-test (sinh -5.0e-01-9.42512322775237976202e+00i) 5.2109527443404709231e-1+3.8933200722399054908e-4i)
(num-test (sinh 1.0e+00-3.45266983001243932001e-04i) 1.1752011235963524660e0-5.3277478472501939236e-4i)
(num-test (sinh 1.0e+00+3.45266983001243932001e-04i) 1.1752011235963524660e0+5.3277478472501939236e-4i)
(num-test (sinh -1.0e+00-3.45266983001243932001e-04i) -1.1752011235963524660e0-5.3277478472501939236e-4i)
(num-test (sinh -1.0e+00+3.45266983001243932001e-04i) -1.1752011235963524660e0+5.3277478472501939236e-4i)
(num-test (sinh 1.0e+00+1.57045105981189525579e+00i) 4.0575816248730593018e-4+1.5430805428404715942e0i)
(num-test (sinh 1.0e+00-1.57045105981189525579e+00i) 4.0575816248730593018e-4-1.5430805428404715942e0i)
(num-test (sinh -1.0e+00+1.57045105981189525579e+00i) -4.0575816248730593018e-4+1.5430805428404715942e0i)
(num-test (sinh -1.0e+00-1.57045105981189525579e+00i) -4.0575816248730593018e-4-1.5430805428404715942e0i)
(num-test (sinh 1.0e+00+1.57114159377789786021e+00i) -4.0575816248716200955e-4+1.5430805428404715942e0i)
(num-test (sinh 1.0e+00-1.57114159377789786021e+00i) -4.0575816248716200955e-4-1.5430805428404715942e0i)
(num-test (sinh -1.0e+00+1.57114159377789786021e+00i) 4.0575816248716200955e-4+1.5430805428404715942e0i)
(num-test (sinh -1.0e+00-1.57114159377789786021e+00i) 4.0575816248716200955e-4-1.5430805428404715942e0i)
(num-test (sinh 1.0e+00+3.14124738660679181379e+00i) -1.1752011235963524659e0+5.3277478472529828958e-4i)
(num-test (sinh 1.0e+00-3.14124738660679181379e+00i) -1.1752011235963524659e0-5.3277478472529828958e-4i)
(num-test (sinh -1.0e+00+3.14124738660679181379e+00i) 1.1752011235963524659e0+5.3277478472529828958e-4i)
(num-test (sinh -1.0e+00-3.14124738660679181379e+00i) 1.1752011235963524659e0-5.3277478472529828958e-4i)
(num-test (sinh 1.0e+00+3.14193792057279441821e+00i) -1.1752011235963524660e0-5.3277478472492034385e-4i)
(num-test (sinh 1.0e+00-3.14193792057279441821e+00i) -1.1752011235963524660e0+5.3277478472492034385e-4i)
(num-test (sinh -1.0e+00+3.14193792057279441821e+00i) 1.1752011235963524660e0-5.3277478472492034385e-4i)
(num-test (sinh -1.0e+00-3.14193792057279441821e+00i) 1.1752011235963524660e0+5.3277478472492034385e-4i)
(num-test (sinh 1.0e+00+4.71204371340168837179e+00i) -4.0575816248744985081e-4-1.5430805428404715941e0i)
(num-test (sinh 1.0e+00-4.71204371340168837179e+00i) -4.0575816248744985081e-4+1.5430805428404715941e0i)
(num-test (sinh -1.0e+00+4.71204371340168837179e+00i) 4.0575816248744985081e-4-1.5430805428404715941e0i)
(num-test (sinh -1.0e+00-4.71204371340168837179e+00i) 4.0575816248744985081e-4+1.5430805428404715941e0i)
(num-test (sinh 1.0e+00+4.71273424736769097620e+00i) 4.0575816248701808892e-4-1.5430805428404715943e0i)
(num-test (sinh 1.0e+00-4.71273424736769097620e+00i) 4.0575816248701808892e-4+1.5430805428404715943e0i)
(num-test (sinh -1.0e+00+4.71273424736769097620e+00i) -4.0575816248701808892e-4-1.5430805428404715943e0i)
(num-test (sinh -1.0e+00-4.71273424736769097620e+00i) -4.0575816248701808892e-4+1.5430805428404715943e0i)
(num-test (sinh 1.0e+00+6.28284004019658492979e+00i) 1.1752011235963524659e0-5.3277478472548726245e-4i)
(num-test (sinh 1.0e+00-6.28284004019658492979e+00i) 1.1752011235963524659e0+5.3277478472548726245e-4i)
(num-test (sinh -1.0e+00+6.28284004019658492979e+00i) -1.1752011235963524659e0-5.3277478472548726245e-4i)
(num-test (sinh -1.0e+00-6.28284004019658492979e+00i) -1.1752011235963524659e0+5.3277478472548726245e-4i)
(num-test (sinh 1.0e+00+6.28353057416258753420e+00i) 1.1752011235963524661e0+5.3277478472473137099e-4i)
(num-test (sinh 1.0e+00-6.28353057416258753420e+00i) 1.1752011235963524661e0-5.3277478472473137099e-4i)
(num-test (sinh -1.0e+00+6.28353057416258753420e+00i) -1.1752011235963524661e0+5.3277478472473137099e-4i)
(num-test (sinh -1.0e+00-6.28353057416258753420e+00i) -1.1752011235963524661e0-5.3277478472473137099e-4i)
(num-test (sinh 1.0e+00+9.42443269378637893396e+00i) -1.1752011235963524662e0+5.3277478472430570447e-4i)
(num-test (sinh 1.0e+00-9.42443269378637893396e+00i) -1.1752011235963524662e0-5.3277478472430570447e-4i)
(num-test (sinh -1.0e+00+9.42443269378637893396e+00i) 1.1752011235963524662e0+5.3277478472430570447e-4i)
(num-test (sinh -1.0e+00-9.42443269378637893396e+00i) 1.1752011235963524662e0-5.3277478472430570447e-4i)
(num-test (sinh 1.0e+00+9.42512322775237976202e+00i) -1.1752011235963524665e0-5.3277478472317186729e-4i)
(num-test (sinh 1.0e+00-9.42512322775237976202e+00i) -1.1752011235963524665e0+5.3277478472317186729e-4i)
(num-test (sinh -1.0e+00+9.42512322775237976202e+00i) 1.1752011235963524665e0-5.3277478472317186729e-4i)
(num-test (sinh -1.0e+00-9.42512322775237976202e+00i) 1.1752011235963524665e0+5.3277478472317186729e-4i)
(num-test (sinh 2.0e+00-3.45266983001243932001e-04i) 3.6268601916692946556e0-1.2989619299126701883e-3i)
(num-test (sinh 2.0e+00+3.45266983001243932001e-04i) 3.6268601916692946556e0+1.2989619299126701883e-3i)
(num-test (sinh -2.0e+00-3.45266983001243932001e-04i) -3.6268601916692946556e0-1.2989619299126701883e-3i)
(num-test (sinh -2.0e+00+3.45266983001243932001e-04i) -3.6268601916692946556e0+1.2989619299126701883e-3i)
(num-test (sinh 2.0e+00+1.57045105981189525579e+00i) 1.2522351259047577385e-3+3.7621954668392959445e0i)
(num-test (sinh 2.0e+00-1.57045105981189525579e+00i) 1.2522351259047577385e-3-3.7621954668392959445e0i)
(num-test (sinh -2.0e+00+1.57045105981189525579e+00i) -1.2522351259047577385e-3+3.7621954668392959445e0i)
(num-test (sinh -2.0e+00-1.57045105981189525579e+00i) -1.2522351259047577385e-3-3.7621954668392959445e0i)
(num-test (sinh 2.0e+00+1.57114159377789786021e+00i) -1.2522351259043135762e-3+3.7621954668392959447e0i)
(num-test (sinh 2.0e+00-1.57114159377789786021e+00i) -1.2522351259043135762e-3-3.7621954668392959447e0i)
(num-test (sinh -2.0e+00+1.57114159377789786021e+00i) 1.2522351259043135762e-3+3.7621954668392959447e0i)
(num-test (sinh -2.0e+00-1.57114159377789786021e+00i) 1.2522351259043135762e-3-3.7621954668392959447e0i)
(num-test (sinh 2.0e+00+3.14124738660679181379e+00i) -3.6268601916692946553e0+1.2989619299133501696e-3i)
(num-test (sinh 2.0e+00-3.14124738660679181379e+00i) -3.6268601916692946553e0-1.2989619299133501696e-3i)
(num-test (sinh -2.0e+00+3.14124738660679181379e+00i) 3.6268601916692946553e0+1.2989619299133501696e-3i)
(num-test (sinh -2.0e+00-3.14124738660679181379e+00i) 3.6268601916692946553e0-1.2989619299133501696e-3i)
(num-test (sinh 2.0e+00+3.14193792057279441821e+00i) -3.6268601916692946556e0-1.2989619299124286975e-3i)
(num-test (sinh 2.0e+00-3.14193792057279441821e+00i) -3.6268601916692946556e0+1.2989619299124286975e-3i)
(num-test (sinh -2.0e+00+3.14193792057279441821e+00i) 3.6268601916692946556e0-1.2989619299124286975e-3i)
(num-test (sinh -2.0e+00-3.14193792057279441821e+00i) 3.6268601916692946556e0+1.2989619299124286975e-3i)
(num-test (sinh 2.0e+00+4.71204371340168837179e+00i) -1.2522351259052019007e-3-3.7621954668392959444e0i)
(num-test (sinh 2.0e+00-4.71204371340168837179e+00i) -1.2522351259052019007e-3+3.7621954668392959444e0i)
(num-test (sinh -2.0e+00+4.71204371340168837179e+00i) 1.2522351259052019007e-3-3.7621954668392959444e0i)
(num-test (sinh -2.0e+00-4.71204371340168837179e+00i) 1.2522351259052019007e-3+3.7621954668392959444e0i)
(num-test (sinh 2.0e+00+4.71273424736769097620e+00i) 1.2522351259038694139e-3-3.7621954668392959448e0i)
(num-test (sinh 2.0e+00-4.71273424736769097620e+00i) 1.2522351259038694139e-3+3.7621954668392959448e0i)
(num-test (sinh -2.0e+00+4.71273424736769097620e+00i) -1.2522351259038694139e-3-3.7621954668392959448e0i)
(num-test (sinh -2.0e+00-4.71273424736769097620e+00i) -1.2522351259038694139e-3+3.7621954668392959448e0i)
(num-test (sinh 2.0e+00+6.28284004019658492979e+00i) 3.6268601916692946552e0-1.2989619299138109057e-3i)
(num-test (sinh 2.0e+00-6.28284004019658492979e+00i) 3.6268601916692946552e0+1.2989619299138109057e-3i)
(num-test (sinh -2.0e+00+6.28284004019658492979e+00i) -3.6268601916692946552e0-1.2989619299138109057e-3i)
(num-test (sinh -2.0e+00-6.28284004019658492979e+00i) -3.6268601916692946552e0+1.2989619299138109057e-3i)
(num-test (sinh 2.0e+00+6.28353057416258753420e+00i) 3.6268601916692946558e0+1.2989619299119679614e-3i)
(num-test (sinh 2.0e+00-6.28353057416258753420e+00i) 3.6268601916692946558e0-1.2989619299119679614e-3i)
(num-test (sinh -2.0e+00+6.28353057416258753420e+00i) -3.6268601916692946558e0+1.2989619299119679614e-3i)
(num-test (sinh -2.0e+00-6.28353057416258753420e+00i) -3.6268601916692946558e0-1.2989619299119679614e-3i)
(num-test (sinh 2.0e+00+9.42443269378637893396e+00i) -3.6268601916692946561e0+1.2989619299109301409e-3i)
(num-test (sinh 2.0e+00-9.42443269378637893396e+00i) -3.6268601916692946561e0-1.2989619299109301409e-3i)
(num-test (sinh -2.0e+00+9.42443269378637893396e+00i) 3.6268601916692946561e0+1.2989619299109301409e-3i)
(num-test (sinh -2.0e+00-9.42443269378637893396e+00i) 3.6268601916692946561e0-1.2989619299109301409e-3i)
(num-test (sinh 2.0e+00+9.42512322775237976202e+00i) -3.6268601916692946571e0-1.2989619299081657245e-3i)
(num-test (sinh 2.0e+00-9.42512322775237976202e+00i) -3.6268601916692946571e0+1.2989619299081657245e-3i)
(num-test (sinh -2.0e+00+9.42512322775237976202e+00i) 3.6268601916692946571e0-1.2989619299081657245e-3i)
(num-test (sinh -2.0e+00-9.42512322775237976202e+00i) 3.6268601916692946571e0+1.2989619299081657245e-3i)
(num-test (sinh 0) 0.0)
(num-test (sinh 0+i) (* 0+i (sin 1)))
(num-test (sinh -2.225073858507201399999999999999999999996E-308) -2.225073858507201399999999999999999999996E-308)
(num-test (sinh 1.110223024625156799999999999999999999997E-16) 1.110223024625156800000000000000002280754E-16)
(num-test (sinh 1/9223372036854775807) 1.084202172485504434125002235952170462235E-19)

(for-each
 (lambda (num-and-val)
   (let ((num (car num-and-val)) (val (cadr num-and-val))) (num-test-1 'sinh num (sinh num) val)))
 (vector (list 0 0) (list 1 1.1752011936438) (list 2 3.626860407847) (list 3 10.01787492741) 
	 (list -1 -1.1752011936438) (list -2 -3.626860407847) (list -3 -10.01787492741) (list 1/2 0.52109530549375) 
	 (list 1/3 0.33954055725615) (list -1/2 -0.52109530549375) (list -1/3 -0.33954055725615) 
	 (list 1/9223372036854775807 1.0842021724855e-19) (list 0.0 0.0) (list 1.0 1.1752011936438) 
	 (list 2.0 3.626860407847) (list -2.0 -3.626860407847) (list 1.000000000000000000000000000000000000002E-309 1.000000000000000000000000000000000000002E-309) 
	 (list 0+1i 0+0.8414709848079i) (list 0+2i -0+0.90929742682568i) (list 0-1i 0-0.8414709848079i) 
	 (list 1+1i 0.63496391478474+1.298457581416i) (list 1-1i 0.63496391478474-1.298457581416i) 
	 (list -1+1i -0.63496391478474+1.298457581416i) (list -1-1i -0.63496391478474-1.298457581416i) 
	 (list 0.1+0.1i 0.099666333492108+0.10033299984131i) (list 1e-16+1e-16i 1e-16+1e-16i) 
	 ))
  
(test (sinh) 'error)
(test (sinh "hi") 'error)
(test (sinh 1.0+23.0i 1.0+23.0i) 'error)
(test (sinh 0 1) 'error)

(for-each
 (lambda (arg)
   (test (sinh arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))



;;; --------------------------------------------------------------------------------
;;; cosh
;;; --------------------------------------------------------------------------------

(num-test (cosh 0) 1.0)
(num-test (cosh 1) 1.54308063481524)
(num-test (cosh 2) 3.76219569108363)
(num-test (cosh 3) 10.06766199577777)
(num-test (cosh 10) 11013.23292010332261)
(num-test (cosh 0/1) 1.0)
(num-test (cosh 0/2) 1.0)
(num-test (cosh 0/3) 1.0)
(num-test (cosh 0/10) 1.0)
(num-test (cosh 0/1234) 1.0)
(num-test (cosh 0/1234000000) 1.0)
(num-test (cosh 0/500029) 1.0)
(num-test (cosh 0/362880) 1.0)
(num-test (cosh 1/1) 1.54308063481524)
(num-test (cosh 1/2) 1.12762596520638)
(num-test (cosh -1/2) 1.12762596520638)
(num-test (cosh 1/3) 1.05607186782994)
(num-test (cosh -1/3) 1.05607186782994)
(num-test (cosh 1/10) 1.00500416805580)
(num-test (cosh -1/10) 1.00500416805580)
(num-test (cosh 1/1234) 1.00000032835203)
(num-test (cosh -1/1234) 1.00000032835203)
(num-test (cosh 1/1234000000) 1.0)
(num-test (cosh -1/1234000000) 1.0)
(num-test (cosh 1/500029) 1.00000000000200)
(num-test (cosh -1/500029) 1.00000000000200)
(num-test (cosh 1/362880) 1.00000000000380)
(num-test (cosh -1/362880) 1.00000000000380)
(num-test (cosh 2/1) 3.76219569108363)
(num-test (cosh 2/2) 1.54308063481524)
(num-test (cosh 2/3) 1.23057558004363)
(num-test (cosh 2/10) 1.02006675561908)
(num-test (cosh -2/10) 1.02006675561908)
(num-test (cosh 2/1234) 1.00000131340834)
(num-test (cosh -2/1234) 1.00000131340834)
(num-test (cosh 2/1234000000) 1.0)
(num-test (cosh -2/1234000000) 1.0)
(num-test (cosh 2/500029) 1.00000000000800)
(num-test (cosh -2/500029) 1.00000000000800)
(num-test (cosh 2/362880) 1.00000000001519)
(num-test (cosh -2/362880) 1.00000000001519)
(num-test (cosh 3/1) 10.06766199577777)
(num-test (cosh 3/2) 2.35240961524325)
(num-test (cosh 3/3) 1.54308063481524)
(num-test (cosh 3/10) 1.04533851412886)
(num-test (cosh -3/10) 1.04533851412886)
(num-test (cosh 3/1234) 1.00000295516958)
(num-test (cosh -3/1234) 1.00000295516958)
(num-test (cosh 3/1234000000) 1.0)
(num-test (cosh -3/1234000000) 1.0)
(num-test (cosh 3/500029) 1.00000000001800)
(num-test (cosh -3/500029) 1.00000000001800)
(num-test (cosh 3/362880) 1.00000000003417)
(num-test (cosh -3/362880) 1.00000000003417)
(num-test (cosh 10/1) 11013.23292010332261)
(num-test (cosh 10/2) 74.20994852478785)
(num-test (cosh 10/3) 14.03364944393670)
(num-test (cosh 10/10) 1.54308063481524)
(num-test (cosh 10/1234) 1.00003283538113)
(num-test (cosh -10/1234) 1.00003283538113)
(num-test (cosh 10/1234000000) 1.0)
(num-test (cosh -10/1234000000) 1.0)
(num-test (cosh 10/500029) 1.00000000019998)
(num-test (cosh -10/500029) 1.00000000019998)
(num-test (cosh 10/362880) 1.00000000037970)
(num-test (cosh -10/362880) 1.00000000037970)
(num-test (cosh 1234/1234) 1.54308063481524)
(num-test (cosh 1234/1234000000) 1.00000000000050)
(num-test (cosh -1234/1234000000) 1.00000000000050)
(num-test (cosh 1234/500029) 1.00000304516030)
(num-test (cosh -1234/500029) 1.00000304516030)
(num-test (cosh 1234/362880) 1.00000578195459)
(num-test (cosh -1234/362880) 1.00000578195459)
(num-test (cosh 1234000000/1234000000) 1.54308063481524)
(num-test (cosh 500029/1234000000) 1.00000008209753)
(num-test (cosh -500029/1234000000) 1.00000008209753)
(num-test (cosh 500029/500029) 1.54308063481524)
(num-test (cosh 500029/362880) 2.10942046492234)
(num-test (cosh 362880/1234000000) 1.00000004323802)
(num-test (cosh -362880/1234000000) 1.00000004323802)
(num-test (cosh 362880/500029) 1.27509545648210)
(num-test (cosh 362880/362880) 1.54308063481524)
(num-test (cosh 0.0) 1.0)
(num-test (cosh 0.00000001) 1.0)
(num-test (cosh -0.00000001) 1.0)
(num-test (cosh 1.0) 1.54308063481524)
(num-test (cosh pi) 11.59195327552152)
(num-test (cosh 2.71828182845905) 7.61012513866229)
(num-test (cosh 0.0+0.0i) 1.0)
(num-test (cosh -0.0+0.0i) 1.0)
(num-test (cosh 0.0-0.0i) 1.0)
(num-test (cosh -0.0-0.0i) 1.0)
(num-test (cosh 0.0+0.00000001i) 1.0)
(num-test (cosh -0.0+0.00000001i) 1.0)
(num-test (cosh 0.0-0.00000001i) 1.0)
(num-test (cosh -0.0-0.00000001i) 1.0)
(num-test (cosh 0.0+1.0i) 0.54030230586814)
(num-test (cosh -0.0+1.0i) 0.54030230586814)
(num-test (cosh 0.0-1.0i) 0.54030230586814)
(num-test (cosh 0.0+3.14159265358979i) -1.0)
(num-test (cosh -0.0+3.14159265358979i) -1.0)
(num-test (cosh 0.0-3.14159265358979i) -1.0)
(num-test (cosh 0.0+2.71828182845905i) -0.91173391478697)
(num-test (cosh -0.0+2.71828182845905i) -0.91173391478697)
(num-test (cosh 0.0-2.71828182845905i) -0.91173391478697)
(num-test (cosh 0.00000001+0.0i) 1.0)
(num-test (cosh -0.00000001+0.0i) 1.0)
(num-test (cosh 0.00000001-0.0i) 1.0)
(num-test (cosh -0.00000001-0.0i) 1.0)
(num-test (cosh 0.00000001+0.00000001i) 1.0+1e-16i) ; maxima
(num-test (cosh -0.00000001+0.00000001i) 1.0-1e-16i)
(num-test (cosh 0.00000001-0.00000001i) 1.0-1e-16i)
(num-test (cosh -0.00000001-0.00000001i) 1.0+1e-16i)
(num-test (cosh 0.00000001+1.0i) 0.54030230586814+0.00000000841471i)
(num-test (cosh 0.00000001-1.0i) 0.54030230586814-0.00000000841471i)
(num-test (cosh 0.00000001+3.14159265358979i) -1.0-6.982889851335445E-23i) ;maxima -- stopped here
(num-test (cosh 0.00000001-3.14159265358979i) -1.0-0.0i)
(num-test (cosh 0.00000001+2.71828182845905i) -0.91173391478697+0.00000000410781i)
(num-test (cosh 0.00000001-2.71828182845905i) -0.91173391478697-0.00000000410781i)
(num-test (cosh 1.0+0.0i) 1.54308063481524)
(num-test (cosh 1.0-0.0i) 1.54308063481524)
(num-test (cosh 1.0+0.00000001i) 1.54308063481524+0.00000001175201i)
(num-test (cosh 1.0-0.00000001i) 1.54308063481524-0.00000001175201i)
(num-test (cosh 1.0+1.0i) 0.83373002513115+0.98889770576287i)
(num-test (cosh 1.0-1.0i) 0.83373002513115-0.98889770576287i)
(num-test (cosh 1.0+3.14159265358979i) -1.54308063481524+0.0i)
(num-test (cosh 1.0-3.14159265358979i) -1.54308063481524-0.0i)
(num-test (cosh 1.0+2.71828182845905i) -1.40687894801206+0.48275066292556i)
(num-test (cosh 1.0-2.71828182845905i) -1.40687894801206-0.48275066292556i)
(num-test (cosh 3.14159265358979+0.0i) 11.59195327552152)
(num-test (cosh 3.14159265358979-0.0i) 11.59195327552152)
(num-test (cosh 3.14159265358979+0.00000001i) 11.59195327552152+0.00000011548739i)
(num-test (cosh 3.14159265358979-0.00000001i) 11.59195327552152-0.00000011548739i)
(num-test (cosh 3.14159265358979+1.0i) 6.26315908428001+9.71792908024139i)
(num-test (cosh 3.14159265358979-1.0i) 6.26315908428001-9.71792908024139i)
(num-test (cosh 3.14159265358979+3.14159265358979i) -11.59195327552152+0.0i)
(num-test (cosh 3.14159265358979-3.14159265358979i) -11.59195327552152-0.0i)
(num-test (cosh 3.14159265358979+2.71828182845905i) -10.56877693991882+4.74400605685607i)
(num-test (cosh 3.14159265358979-2.71828182845905i) -10.56877693991882-4.74400605685607i)
(num-test (cosh 2.71828182845905+0.0i) 7.61012513866229)
(num-test (cosh 2.71828182845905-0.0i) 7.61012513866229)
(num-test (cosh 2.71828182845905+0.00000001i) 7.61012513866229+0.00000007544137i)
(num-test (cosh 2.71828182845905-0.00000001i) 7.61012513866229-0.00000007544137i)
(num-test (cosh 2.71828182845905+1.0i) 4.11176816036433+6.34817247743319i)
(num-test (cosh 2.71828182845905-1.0i) 4.11176816036433-6.34817247743319i)
(num-test (cosh 2.71828182835905+3.14159265358979i) -7.61012513866229+0.0i)
(num-test (cosh 2.71828182845905-3.14159265358979i) -7.61012513866229-0.0i)
(num-test (cosh 2.71828182845905+2.71828182845905i) -6.93840918469126+3.09899037482603i)
(num-test (cosh 2.71828182845905-2.71828182845905i) -6.93840918469126-3.09899037482603i)
(num-test (cosh -2/3) 1.230575580043636) 
(num-test (cosh -3/2) 2.352409615243247) 
(num-test (cosh -10/3) 14.03364944393623) 
(num-test (cosh 1234/3) 2.18155865313939E+178) 
(num-test (cosh 1234/10) 1.953930316004457E+53) 
(num-test (cosh 500029/1234) 4.77955809407816E+175) 
(num-test (cosh -500029/362880) 2.109420464922257) 
(num-test (cosh 362880/1234) 2.57697781296564E+127) 
(num-test (cosh -362880/500029) 1.275095456482107) 
(num-test (cosh -3.14159265358979) 11.5919532755216) 
(num-test (cosh -2.71828182845905) 7.610125138661946) 
(num-test (cosh 0.0+3.14159265358979i) -1.0) 
(num-test (cosh 0.0+2.71828182845905i) -0.9117339147869464) 
(num-test (cosh 0.00000001+1.0i) +0.5403023058681398+8.414709848078964E-9i) 
(num-test (cosh 0.00000001+3.14159265358979i) -1.0-6.982889851335445E-23i) 
(num-test (cosh 0.00000001+2.71828182845905i) -0.9117339147869464+4.1078129050295015E-9i) 
(num-test (cosh 0.00000001+1234.0i) -0.7985506235875843+6.019276547624973E-9i) 
(num-test (cosh 0.00000001+1234000000.0i) .1589091308902228-9.872932128398908E-9i) 
(num-test (cosh 1.0+0.00000001i) +1.543080634815244+1.1752011936438014E-8i) 
(num-test (cosh 1.0+3.14159265358979i) -1.543080634815244-8.206300488372603E-15i) 
(num-test (cosh 1.0+2.71828182845905i) -1.406878948012029+0.4827506629256081i) 
(num-test (cosh 3.14159265358979+0.0i) 11.5919532755216) 
(num-test (cosh 3.14159265358979+0.00000001i) +11.5919532755216+1.154873935725783E-7i) 
(num-test (cosh 3.14159265358979+1.0i) +6.263159084280057+9.71792908024146i) 
(num-test (cosh 3.14159265358979+3.14159265358979i) -11.5919532755216-8.064357485351393E-14i) 
(num-test (cosh 3.14159265358979+2.71828182845905i) -10.56877693991868+4.744006056856582i) 
(num-test (cosh 3.14159265358979+1234.0i) -9.256761516765916+6.951505596777556i) 
(num-test (cosh 3.14159265358979+1234000000.0i) 1.84206722033321-11.40199198427758i) 
(num-test (cosh 2.71828182845905+0.0i) 7.610125138661946) 
(num-test (cosh 2.71828182845905+0.00000001i) +7.610125138661945+7.54413710281663E-8i) 
(num-test (cosh 2.71828182845905+1.0i) +4.111768160364146+6.348172477432901i) 
(num-test (cosh 2.71828182845905+3.14159265358979i) -7.610125138661946-5.267987841234144E-14i) 
(num-test (cosh 2.71828182845905+2.71828182845905i) -6.93840918469081+3.098990374826203i) 
(num-test (cosh 2.71828182845905+1234.0i) -6.077070175058048+4.541024753505155i) 
(num-test (cosh 2.71828182845905+1234000000.0i) 1.209318371750606-7.448275358344457i) 
(num-test (cosh 0.0e+00-3.45266983001243932001e-04i) 9.9999994039535581673e-1+0.0i)
(num-test (cosh 0.0e+00+3.45266983001243932001e-04i) 9.9999994039535581673e-1+0.0i)
(num-test (cosh 0.0e+00+1.57045105981189525579e+00i) 3.4526697614152485627e-4+0.0i)
(num-test (cosh 0.0e+00-1.57045105981189525579e+00i) 3.4526697614152485627e-4+0.0i)
(num-test (cosh 0.0e+00+1.57114159377789786021e+00i) -3.4526697614140239160e-4+0.0i)
(num-test (cosh 0.0e+00-1.57114159377789786021e+00i) -3.4526697614140239160e-4+0.0i)
(num-test (cosh 0.0e+00+3.14124738660679181379e+00i) -9.9999994039535581667e-1+0.0i)
(num-test (cosh 0.0e+00-3.14124738660679181379e+00i) -9.9999994039535581667e-1+0.0i)
(num-test (cosh 0.0e+00+3.14193792057279441821e+00i) -9.9999994039535581675e-1+0.0i)
(num-test (cosh 0.0e+00-3.14193792057279441821e+00i) -9.9999994039535581675e-1+0.0i)
(num-test (cosh 0.0e+00+4.71204371340168837179e+00i) -3.4526697614164732094e-4+0.0i)
(num-test (cosh 0.0e+00-4.71204371340168837179e+00i) -3.4526697614164732094e-4+0.0i)
(num-test (cosh 0.0e+00+4.71273424736769097620e+00i) 3.4526697614127992692e-4+0.0i)
(num-test (cosh 0.0e+00-4.71273424736769097620e+00i) 3.4526697614127992692e-4+0.0i)
(num-test (cosh 0.0e+00+6.28284004019658492979e+00i) 9.9999994039535581662e-1+0.0i)
(num-test (cosh 0.0e+00-6.28284004019658492979e+00i) 9.9999994039535581662e-1+0.0i)
(num-test (cosh 0.0e+00+6.28353057416258753420e+00i) 9.9999994039535581679e-1+0.0i)
(num-test (cosh 0.0e+00-6.28353057416258753420e+00i) 9.9999994039535581679e-1+0.0i)
(num-test (cosh 0.0e+00+9.42443269378637893396e+00i) -9.9999994039535581689e-1+0.0i)
(num-test (cosh 0.0e+00-9.42443269378637893396e+00i) -9.9999994039535581689e-1+0.0i)
(num-test (cosh 0.0e+00+9.42512322775237976202e+00i) -9.9999994039535581714e-1+0.0i)
(num-test (cosh 0.0e+00-9.42512322775237976202e+00i) -9.9999994039535581714e-1+0.0i)
(num-test (cosh 1.19209289550781250e-07-3.45266983001243932001e-04i) 9.9999994039536292216e-1-4.1159030931163569191e-11i)
(num-test (cosh 1.19209289550781250e-07+3.45266983001243932001e-04i) 9.9999994039536292216e-1+4.1159030931163569191e-11i)
(num-test (cosh -1.19209289550781250e-07-3.45266983001243932001e-04i) 9.9999994039536292216e-1+4.1159030931163569191e-11i)
(num-test (cosh -1.19209289550781250e-07+3.45266983001243932001e-04i) 9.9999994039536292216e-1-4.1159030931163569191e-11i)
(num-test (cosh 1.19209289550781250e-07+1.57045105981189525579e+00i) 3.4526697614152730954e-4+1.1920928244535424532e-7i)
(num-test (cosh 1.19209289550781250e-07-1.57045105981189525579e+00i) 3.4526697614152730954e-4-1.1920928244535424532e-7i)
(num-test (cosh -1.19209289550781250e-07+1.57045105981189525579e+00i) 3.4526697614152730954e-4-1.1920928244535424532e-7i)
(num-test (cosh -1.19209289550781250e-07-1.57045105981189525579e+00i) 3.4526697614152730954e-4+1.1920928244535424532e-7i)
(num-test (cosh 1.19209289550781250e-07+1.57114159377789786021e+00i) -3.4526697614140484486e-4+1.1920928244535424533e-7i)
(num-test (cosh 1.19209289550781250e-07-1.57114159377789786021e+00i) -3.4526697614140484486e-4-1.1920928244535424533e-7i)
(num-test (cosh -1.19209289550781250e-07+1.57114159377789786021e+00i) -3.4526697614140484486e-4-1.1920928244535424533e-7i)
(num-test (cosh -1.19209289550781250e-07-1.57114159377789786021e+00i) -3.4526697614140484486e-4+1.1920928244535424533e-7i)
(num-test (cosh 1.19209289550781250e-07+3.14124738660679181379e+00i) -9.9999994039536292209e-1+4.1159030931185115142e-11i)
(num-test (cosh 1.19209289550781250e-07-3.14124738660679181379e+00i) -9.9999994039536292209e-1-4.1159030931185115142e-11i)
(num-test (cosh -1.19209289550781250e-07+3.14124738660679181379e+00i) -9.9999994039536292209e-1-4.1159030931185115142e-11i)
(num-test (cosh -1.19209289550781250e-07-3.14124738660679181379e+00i) -9.9999994039536292209e-1+4.1159030931185115142e-11i)
(num-test (cosh 1.19209289550781250e-07+3.14193792057279441821e+00i) -9.9999994039536292218e-1-4.1159030931155917289e-11i)
(num-test (cosh 1.19209289550781250e-07-3.14193792057279441821e+00i) -9.9999994039536292218e-1+4.1159030931155917289e-11i)
(num-test (cosh -1.19209289550781250e-07+3.14193792057279441821e+00i) -9.9999994039536292218e-1+4.1159030931155917289e-11i)
(num-test (cosh -1.19209289550781250e-07-3.14193792057279441821e+00i) -9.9999994039536292218e-1-4.1159030931155917289e-11i)
(num-test (cosh 1.19209289550781250e-07+4.71204371340168837179e+00i) -3.4526697614164977421e-4-1.1920928244535424532e-7i)
(num-test (cosh 1.19209289550781250e-07-4.71204371340168837179e+00i) -3.4526697614164977421e-4+1.1920928244535424532e-7i)
(num-test (cosh -1.19209289550781250e-07+4.71204371340168837179e+00i) -3.4526697614164977421e-4+1.1920928244535424532e-7i)
(num-test (cosh -1.19209289550781250e-07-4.71204371340168837179e+00i) -3.4526697614164977421e-4-1.1920928244535424532e-7i)
(num-test (cosh 1.19209289550781250e-07+4.71273424736769097620e+00i) 3.4526697614128238019e-4-1.1920928244535424533e-7i)
(num-test (cosh 1.19209289550781250e-07-4.71273424736769097620e+00i) 3.4526697614128238019e-4+1.1920928244535424533e-7i)
(num-test (cosh -1.19209289550781250e-07+4.71273424736769097620e+00i) 3.4526697614128238019e-4+1.1920928244535424533e-7i)
(num-test (cosh -1.19209289550781250e-07-4.71273424736769097620e+00i) 3.4526697614128238019e-4-1.1920928244535424533e-7i)
(num-test (cosh 1.19209289550781250e-07+6.28284004019658492979e+00i) 9.9999994039536292205e-1-4.1159030931199714069e-11i)
(num-test (cosh 1.19209289550781250e-07-6.28284004019658492979e+00i) 9.9999994039536292205e-1+4.1159030931199714069e-11i)
(num-test (cosh -1.19209289550781250e-07+6.28284004019658492979e+00i) 9.9999994039536292205e-1+4.1159030931199714069e-11i)
(num-test (cosh -1.19209289550781250e-07-6.28284004019658492979e+00i) 9.9999994039536292205e-1-4.1159030931199714069e-11i)
(num-test (cosh 1.19209289550781250e-07+6.28353057416258753420e+00i) 9.9999994039536292222e-1+4.1159030931141318362e-11i)
(num-test (cosh 1.19209289550781250e-07-6.28353057416258753420e+00i) 9.9999994039536292222e-1-4.1159030931141318362e-11i)
(num-test (cosh -1.19209289550781250e-07+6.28353057416258753420e+00i) 9.9999994039536292222e-1-4.1159030931141318362e-11i)
(num-test (cosh -1.19209289550781250e-07-6.28353057416258753420e+00i) 9.9999994039536292222e-1+4.1159030931141318362e-11i)
(num-test (cosh 1.19209289550781250e-07+9.42443269378637893396e+00i) -9.9999994039536292231e-1+4.1159030931108433883e-11i)
(num-test (cosh 1.19209289550781250e-07-9.42443269378637893396e+00i) -9.9999994039536292231e-1-4.1159030931108433883e-11i)
(num-test (cosh -1.19209289550781250e-07+9.42443269378637893396e+00i) -9.9999994039536292231e-1-4.1159030931108433883e-11i)
(num-test (cosh -1.19209289550781250e-07-9.42443269378637893396e+00i) -9.9999994039536292231e-1+4.1159030931108433883e-11i)
(num-test (cosh 1.19209289550781250e-07+9.42512322775237976202e+00i) -9.9999994039536292257e-1-4.1159030931020840323e-11i)
(num-test (cosh 1.19209289550781250e-07-9.42512322775237976202e+00i) -9.9999994039536292257e-1+4.1159030931020840323e-11i)
(num-test (cosh -1.19209289550781250e-07+9.42512322775237976202e+00i) -9.9999994039536292257e-1+4.1159030931020840323e-11i)
(num-test (cosh -1.19209289550781250e-07-9.42512322775237976202e+00i) -9.9999994039536292257e-1-4.1159030931020840323e-11i)
(num-test (cosh 5.0e-01-3.45266983001243932001e-04i) 1.1276258979946363573e0-1.7991700040930800151e-4i)
(num-test (cosh 5.0e-01+3.45266983001243932001e-04i) 1.1276258979946363573e0+1.7991700040930800151e-4i)
(num-test (cosh -5.0e-01-3.45266983001243932001e-04i) 1.1276258979946363573e0+1.7991700040930800151e-4i)
(num-test (cosh -5.0e-01+3.45266983001243932001e-04i) 1.1276258979946363573e0-1.7991700040930800151e-4i)
(num-test (cosh 5.0e-01+1.57045105981189525579e+00i) 3.8933200722547541227e-4+5.2109527443404709207e-1i)
(num-test (cosh 5.0e-01-1.57045105981189525579e+00i) 3.8933200722547541227e-4-5.2109527443404709207e-1i)
(num-test (cosh -5.0e-01+1.57045105981189525579e+00i) 3.8933200722547541227e-4-5.2109527443404709207e-1i)
(num-test (cosh -5.0e-01-1.57045105981189525579e+00i) 3.8933200722547541227e-4+5.2109527443404709207e-1i)
(num-test (cosh 5.0e-01+1.57114159377789786021e+00i) -3.8933200722533731792e-4+5.2109527443404709209e-1i)
(num-test (cosh 5.0e-01-1.57114159377789786021e+00i) -3.8933200722533731792e-4-5.2109527443404709209e-1i)
(num-test (cosh -5.0e-01+1.57114159377789786021e+00i) -3.8933200722533731792e-4-5.2109527443404709209e-1i)
(num-test (cosh -5.0e-01-1.57114159377789786021e+00i) -3.8933200722533731792e-4+5.2109527443404709209e-1i)
(num-test (cosh 5.0e-01+3.14124738660679181379e+00i) -1.1276258979946363572e0+1.7991700040940218455e-4i)
(num-test (cosh 5.0e-01-3.14124738660679181379e+00i) -1.1276258979946363572e0-1.7991700040940218455e-4i)
(num-test (cosh -5.0e-01+3.14124738660679181379e+00i) -1.1276258979946363572e0-1.7991700040940218455e-4i)
(num-test (cosh -5.0e-01-3.14124738660679181379e+00i) -1.1276258979946363572e0+1.7991700040940218455e-4i)
(num-test (cosh 5.0e-01+3.14193792057279441821e+00i) -1.1276258979946363573e0-1.7991700040927455302e-4i)
(num-test (cosh 5.0e-01-3.14193792057279441821e+00i) -1.1276258979946363573e0+1.7991700040927455302e-4i)
(num-test (cosh -5.0e-01+3.14193792057279441821e+00i) -1.1276258979946363573e0+1.7991700040927455302e-4i)
(num-test (cosh -5.0e-01-3.14193792057279441821e+00i) -1.1276258979946363573e0-1.7991700040927455302e-4i)
(num-test (cosh 5.0e-01+4.71204371340168837179e+00i) -3.8933200722561350661e-4-5.2109527443404709205e-1i)
(num-test (cosh 5.0e-01-4.71204371340168837179e+00i) -3.8933200722561350661e-4+5.2109527443404709205e-1i)
(num-test (cosh -5.0e-01+4.71204371340168837179e+00i) -3.8933200722561350661e-4+5.2109527443404709205e-1i)
(num-test (cosh -5.0e-01-4.71204371340168837179e+00i) -3.8933200722561350661e-4-5.2109527443404709205e-1i)
(num-test (cosh 5.0e-01+4.71273424736769097620e+00i) 3.8933200722519922358e-4-5.2109527443404709212e-1i)
(num-test (cosh 5.0e-01-4.71273424736769097620e+00i) 3.8933200722519922358e-4+5.2109527443404709212e-1i)
(num-test (cosh -5.0e-01+4.71273424736769097620e+00i) 3.8933200722519922358e-4+5.2109527443404709212e-1i)
(num-test (cosh -5.0e-01-4.71273424736769097620e+00i) 3.8933200722519922358e-4-5.2109527443404709212e-1i)
(num-test (cosh 5.0e-01+6.28284004019658492979e+00i) 1.1276258979946363572e0-1.7991700040946600032e-4i)
(num-test (cosh 5.0e-01-6.28284004019658492979e+00i) 1.1276258979946363572e0+1.7991700040946600032e-4i)
(num-test (cosh -5.0e-01+6.28284004019658492979e+00i) 1.1276258979946363572e0+1.7991700040946600032e-4i)
(num-test (cosh -5.0e-01-6.28284004019658492979e+00i) 1.1276258979946363572e0-1.7991700040946600032e-4i)
(num-test (cosh 5.0e-01+6.28353057416258753420e+00i) 1.1276258979946363574e0+1.7991700040921073725e-4i)
(num-test (cosh 5.0e-01-6.28353057416258753420e+00i) 1.1276258979946363574e0-1.7991700040921073725e-4i)
(num-test (cosh -5.0e-01+6.28353057416258753420e+00i) 1.1276258979946363574e0-1.7991700040921073725e-4i)
(num-test (cosh -5.0e-01-6.28353057416258753420e+00i) 1.1276258979946363574e0+1.7991700040921073725e-4i)
(num-test (cosh 5.0e-01+9.42443269378637893396e+00i) -1.1276258979946363575e0+1.7991700040906699050e-4i)
(num-test (cosh 5.0e-01-9.42443269378637893396e+00i) -1.1276258979946363575e0-1.7991700040906699050e-4i)
(num-test (cosh -5.0e-01+9.42443269378637893396e+00i) -1.1276258979946363575e0-1.7991700040906699050e-4i)
(num-test (cosh -5.0e-01-9.42443269378637893396e+00i) -1.1276258979946363575e0+1.7991700040906699050e-4i)
(num-test (cosh 5.0e-01+9.42512322775237976202e+00i) -1.1276258979946363577e0-1.7991700040868409591e-4i)
(num-test (cosh 5.0e-01-9.42512322775237976202e+00i) -1.1276258979946363577e0+1.7991700040868409591e-4i)
(num-test (cosh -5.0e-01+9.42512322775237976202e+00i) -1.1276258979946363577e0+1.7991700040868409591e-4i)
(num-test (cosh -5.0e-01-9.42512322775237976202e+00i) -1.1276258979946363577e0-1.7991700040868409591e-4i)
(num-test (cosh 1.0e+00-3.45266983001243932001e-04i) 1.5430805428404715942e0-4.057581624871654840e-4i)
(num-test (cosh 1.0e+00+3.45266983001243932001e-04i) 1.5430805428404715942e0+4.057581624871654840e-4i)
(num-test (cosh -1.0e+00-3.45266983001243932001e-04i) 1.5430805428404715942e0+4.057581624871654840e-4i)
(num-test (cosh -1.0e+00+3.45266983001243932001e-04i) 1.5430805428404715942e0-4.057581624871654840e-4i)
(num-test (cosh 1.0e+00+1.57045105981189525579e+00i) 5.3277478472520380315e-4+1.1752011235963524659e0i)
(num-test (cosh 1.0e+00-1.57045105981189525579e+00i) 5.3277478472520380315e-4-1.1752011235963524659e0i)
(num-test (cosh -1.0e+00+1.57045105981189525579e+00i) 5.3277478472520380315e-4-1.1752011235963524659e0i)
(num-test (cosh -1.0e+00-1.57045105981189525579e+00i) 5.3277478472520380315e-4+1.1752011235963524659e0i)
(num-test (cosh 1.0e+00+1.57114159377789786021e+00i) -5.3277478472501483029e-4+1.1752011235963524660e0i)
(num-test (cosh 1.0e+00-1.57114159377789786021e+00i) -5.3277478472501483029e-4-1.1752011235963524660e0i)
(num-test (cosh -1.0e+00+1.57114159377789786021e+00i) -5.3277478472501483029e-4-1.1752011235963524660e0i)
(num-test (cosh -1.0e+00-1.57114159377789786021e+00i) -5.3277478472501483029e-4+1.1752011235963524660e0i)
(num-test (cosh 1.0e+00+3.14124738660679181379e+00i) -1.5430805428404715941e0+4.0575816248737789049e-4i)
(num-test (cosh 1.0e+00-3.14124738660679181379e+00i) -1.5430805428404715941e0-4.0575816248737789049e-4i)
(num-test (cosh -1.0e+00+3.14124738660679181379e+00i) -1.5430805428404715941e0-4.0575816248737789049e-4i)
(num-test (cosh -1.0e+00-3.14124738660679181379e+00i) -1.5430805428404715941e0+4.0575816248737789049e-4i)
(num-test (cosh 1.0e+00+3.14193792057279441821e+00i) -1.5430805428404715943e0-4.0575816248709004923e-4i)
(num-test (cosh 1.0e+00-3.14193792057279441821e+00i) -1.5430805428404715943e0+4.0575816248709004923e-4i)
(num-test (cosh -1.0e+00+3.14193792057279441821e+00i) -1.5430805428404715943e0+4.0575816248709004923e-4i)
(num-test (cosh -1.0e+00-3.14193792057279441821e+00i) -1.5430805428404715943e0-4.0575816248709004923e-4i)
(num-test (cosh 1.0e+00+4.71204371340168837179e+00i) -5.3277478472539277601e-4-1.1752011235963524659e0i)
(num-test (cosh 1.0e+00-4.71204371340168837179e+00i) -5.3277478472539277601e-4+1.1752011235963524659e0i)
(num-test (cosh -1.0e+00+4.71204371340168837179e+00i) -5.3277478472539277601e-4+1.1752011235963524659e0i)
(num-test (cosh -1.0e+00-4.71204371340168837179e+00i) -5.3277478472539277601e-4-1.1752011235963524659e0i)
(num-test (cosh 1.0e+00+4.71273424736769097620e+00i) 5.3277478472482585742e-4-1.1752011235963524660e0i)
(num-test (cosh 1.0e+00-4.71273424736769097620e+00i) 5.3277478472482585742e-4+1.1752011235963524660e0i)
(num-test (cosh -1.0e+00+4.71273424736769097620e+00i) 5.3277478472482585742e-4+1.1752011235963524660e0i)
(num-test (cosh -1.0e+00-4.71273424736769097620e+00i) 5.3277478472482585742e-4-1.1752011235963524660e0i)
(num-test (cosh 1.0e+00+6.28284004019658492979e+00i) 1.5430805428404715941e0-4.0575816248752181112e-4i)
(num-test (cosh 1.0e+00-6.28284004019658492979e+00i) 1.5430805428404715941e0+4.0575816248752181112e-4i)
(num-test (cosh -1.0e+00+6.28284004019658492979e+00i) 1.5430805428404715941e0+4.0575816248752181112e-4i)
(num-test (cosh -1.0e+00-6.28284004019658492979e+00i) 1.5430805428404715941e0-4.0575816248752181112e-4i)
(num-test (cosh 1.0e+00+6.28353057416258753420e+00i) 1.5430805428404715943e0+4.0575816248694612861e-4i)
(num-test (cosh 1.0e+00-6.28353057416258753420e+00i) 1.5430805428404715943e0-4.0575816248694612861e-4i)
(num-test (cosh -1.0e+00+6.28353057416258753420e+00i) 1.5430805428404715943e0-4.0575816248694612861e-4i)
(num-test (cosh -1.0e+00-6.28353057416258753420e+00i) 1.5430805428404715943e0+4.0575816248694612861e-4i)
(num-test (cosh 1.0e+00+9.42443269378637893396e+00i) -1.5430805428404715945e0+4.0575816248662194348e-4i)
(num-test (cosh 1.0e+00-9.42443269378637893396e+00i) -1.5430805428404715945e0-4.0575816248662194348e-4i)
(num-test (cosh -1.0e+00+9.42443269378637893396e+00i) -1.5430805428404715945e0-4.0575816248662194348e-4i)
(num-test (cosh -1.0e+00-9.42443269378637893396e+00i) -1.5430805428404715945e0+4.0575816248662194348e-4i)
(num-test (cosh 1.0e+00+9.42512322775237976202e+00i) -1.5430805428404715949e0-4.0575816248575841970e-4i)
(num-test (cosh 1.0e+00-9.42512322775237976202e+00i) -1.5430805428404715949e0+4.0575816248575841970e-4i)
(num-test (cosh -1.0e+00+9.42512322775237976202e+00i) -1.5430805428404715949e0+4.0575816248575841970e-4i)
(num-test (cosh -1.0e+00-9.42512322775237976202e+00i) -1.5430805428404715949e0-4.0575816248575841970e-4i)
(num-test (cosh 2.0e+00-3.45266983001243932001e-04i) 3.7621954668392959447e0-1.2522351259043242989e-3i)
(num-test (cosh 2.0e+00+3.45266983001243932001e-04i) 3.7621954668392959447e0+1.2522351259043242989e-3i)
(num-test (cosh -2.0e+00-3.45266983001243932001e-04i) 3.7621954668392959447e0+1.2522351259043242989e-3i)
(num-test (cosh -2.0e+00+3.45266983001243932001e-04i) 3.7621954668392959447e0-1.2522351259043242989e-3i)
(num-test (cosh 2.0e+00+1.57045105981189525579e+00i) 1.2989619299131198016e-3+3.6268601916692946554e0i)
(num-test (cosh 2.0e+00-1.57045105981189525579e+00i) 1.2989619299131198016e-3-3.6268601916692946554e0i)
(num-test (cosh -2.0e+00+1.57045105981189525579e+00i) 1.2989619299131198016e-3-3.6268601916692946554e0i)
(num-test (cosh -2.0e+00-1.57045105981189525579e+00i) 1.2989619299131198016e-3+3.6268601916692946554e0i)
(num-test (cosh 2.0e+00+1.57114159377789786021e+00i) -1.2989619299126590655e-3+3.6268601916692946556e0i)
(num-test (cosh 2.0e+00-1.57114159377789786021e+00i) -1.2989619299126590655e-3-3.6268601916692946556e0i)
(num-test (cosh -2.0e+00+1.57114159377789786021e+00i) -1.2989619299126590655e-3-3.6268601916692946556e0i)
(num-test (cosh -2.0e+00-1.57114159377789786021e+00i) -1.2989619299126590655e-3+3.6268601916692946556e0i)
(num-test (cosh 2.0e+00+3.14124738660679181379e+00i) -3.7621954668392959444e0+1.2522351259049798196e-3i)
(num-test (cosh 2.0e+00-3.14124738660679181379e+00i) -3.7621954668392959444e0-1.2522351259049798196e-3i)
(num-test (cosh -2.0e+00+3.14124738660679181379e+00i) -3.7621954668392959444e0-1.2522351259049798196e-3i)
(num-test (cosh -2.0e+00-3.14124738660679181379e+00i) -3.7621954668392959444e0+1.2522351259049798196e-3i)
(num-test (cosh 2.0e+00+3.14193792057279441821e+00i) -3.7621954668392959448e0-1.2522351259040914950e-3i)
(num-test (cosh 2.0e+00-3.14193792057279441821e+00i) -3.7621954668392959448e0+1.2522351259040914950e-3i)
(num-test (cosh -2.0e+00+3.14193792057279441821e+00i) -3.7621954668392959448e0+1.2522351259040914950e-3i)
(num-test (cosh -2.0e+00-3.14193792057279441821e+00i) -3.7621954668392959448e0-1.2522351259040914950e-3i)
(num-test (cosh 2.0e+00+4.71204371340168837179e+00i) -1.2989619299135805376e-3-3.6268601916692946552e0i)
(num-test (cosh 2.0e+00-4.71204371340168837179e+00i) -1.2989619299135805376e-3+3.6268601916692946552e0i)
(num-test (cosh -2.0e+00+4.71204371340168837179e+00i) -1.2989619299135805376e-3+3.6268601916692946552e0i)
(num-test (cosh -2.0e+00-4.71204371340168837179e+00i) -1.2989619299135805376e-3-3.6268601916692946552e0i)
(num-test (cosh 2.0e+00+4.71273424736769097620e+00i) 1.2989619299121983294e-3-3.6268601916692946557e0i)
(num-test (cosh 2.0e+00-4.71273424736769097620e+00i) 1.2989619299121983294e-3+3.6268601916692946557e0i)
(num-test (cosh -2.0e+00+4.71273424736769097620e+00i) 1.2989619299121983294e-3+3.6268601916692946557e0i)
(num-test (cosh -2.0e+00-4.71273424736769097620e+00i) 1.2989619299121983294e-3-3.6268601916692946557e0i)
(num-test (cosh 2.0e+00+6.28284004019658492979e+00i) 3.7621954668392959443e0-1.2522351259054239819e-3i)
(num-test (cosh 2.0e+00-6.28284004019658492979e+00i) 3.7621954668392959443e0+1.2522351259054239819e-3i)
(num-test (cosh -2.0e+00+6.28284004019658492979e+00i) 3.7621954668392959443e0+1.2522351259054239819e-3i)
(num-test (cosh -2.0e+00-6.28284004019658492979e+00i) 3.7621954668392959443e0-1.2522351259054239819e-3i)
(num-test (cosh 2.0e+00+6.28353057416258753420e+00i) 3.7621954668392959449e0+1.2522351259036473328e-3i)
(num-test (cosh 2.0e+00-6.28353057416258753420e+00i) 3.7621954668392959449e0-1.2522351259036473328e-3i)
(num-test (cosh -2.0e+00+6.28353057416258753420e+00i) 3.7621954668392959449e0-1.2522351259036473328e-3i)
(num-test (cosh -2.0e+00-6.28353057416258753420e+00i) 3.7621954668392959449e0+1.2522351259036473328e-3i)
(num-test (cosh 2.0e+00+9.42443269378637893396e+00i) -3.7621954668392959453e0+1.2522351259026468452e-3i)
(num-test (cosh 2.0e+00-9.42443269378637893396e+00i) -3.7621954668392959453e0-1.2522351259026468452e-3i)
(num-test (cosh -2.0e+00+9.42443269378637893396e+00i) -3.7621954668392959453e0-1.2522351259026468452e-3i)
(num-test (cosh -2.0e+00-9.42443269378637893396e+00i) -3.7621954668392959453e0+1.2522351259026468452e-3i)
(num-test (cosh 2.0e+00+9.42512322775237976202e+00i) -3.7621954668392959462e0-1.2522351258999818715e-3i)
(num-test (cosh 2.0e+00-9.42512322775237976202e+00i) -3.7621954668392959462e0+1.2522351258999818715e-3i)
(num-test (cosh -2.0e+00+9.42512322775237976202e+00i) -3.7621954668392959462e0+1.2522351258999818715e-3i)
(num-test (cosh -2.0e+00-9.42512322775237976202e+00i) -3.7621954668392959462e0-1.2522351258999818715e-3i)
(num-test (cosh (log (/ (+ 1 (sqrt 5)) 2))) (/ (sqrt 5) 2))
(num-test (/ (+ (cos (/ 10)) (cosh (/ 10)) (* 2 (cos (/ (sqrt 2) 20)) (cosh (/ (sqrt 2) 20)))) 4) 1.0000000000002480)
(num-test (cosh 0) 1.0)
(num-test (cosh -2.225073858507201399999999999999999999996E-308) 1.000E0)
(num-test (cosh 1.110223024625156799999999999999999999997E-16) 1.000000000000000000000000000000006162976E0)

(for-each
 (lambda (num-and-val)
   (let ((num (car num-and-val)) (val (cadr num-and-val))) (num-test-1 'cosh num (cosh num) val)))
 (vector (list 0 1) (list 1 1.5430806348152) (list 2 3.7621956910836) (list 3 10.067661995778) 
	 (list -1 1.5430806348152) (list -2 3.7621956910836) (list -3 10.067661995778) (list 1/2 1.1276259652064) 
	 (list 1/3 1.0560718678299) (list -1/2 1.1276259652064) (list -1/3 1.0560718678299) 
	 (list 1/9223372036854775807 1.0) (list 0.0 1.0) (list 1.0 1.5430806348152) (list 2.0 3.7621956910836) 
	 (list -2.0 3.7621956910836) (list 1.000000000000000000000000000000000000002E-309 1.000E0) 
	 (list 0+1i 0.54030230586814) (list 0+2i -0.41614683654714) (list 0-1i 0.54030230586814) 
	 (list 1+1i 0.83373002513115+0.98889770576287i) (list 1-1i 0.83373002513115-0.98889770576287i) 
	 (list -1+1i 0.83373002513115-0.98889770576287i) (list -1-1i 0.83373002513115+0.98889770576287i) 
	 (list 0.1+0.1i 0.9999833333373+0.0099999888888898i) (list 1e-16+1e-16i 1+1e-32i) 
	 ))
  
(when with-bignums
  (let ((max-s-error 0.0)
	(max-s-error-case 0)
	(max-sh-error 0.0)
	(max-sh-error-case 0))
    (do ((x 0.10000000000000000000000 (+ x 0.1000000000000000000000)))
	((> x (* 2 pi)))
      (let ((s (sin x))
	    (sh (sinh x))
	    (c (cos x))
	    (ch (cosh x)))
	(let ((err (magnitude (- (+ (* s s) (* c c)) 1))))
	  (if (> err max-s-error)
	      (begin
		(set! max-s-error err)
		(set! max-s-error-case x))))
	(let ((err (magnitude (+ (- (* sh sh) (* ch ch)) 1))))
	  (if (> err max-sh-error)
	      (begin
		(set! max-sh-error err)
		(set! max-sh-error-case x))))))
    (if (> max-s-error 1e-35)
	(format #t "s^2 + c^2 error: ~A at ~A~%" max-s-error max-s-error-case))
    (if (> max-sh-error 1e-33)
	(format #t "sh^2 + ch^2 error: ~A at ~A~%" max-sh-error max-sh-error-case)))
  
  (num-test (sinh 1000.0) 9.850355570085234969444396761216615626576E433)
  (num-test (cosh 1000.0) 9.850355570085234969444396761216615626576E433))

(test (cosh) 'error)
(test (cosh "hi") 'error)
(test (cosh 1.0+23.0i 1.0+23.0i) 'error)
(test (cosh 0 1) 'error)
(num-test (cosh 1/9223372036854775807) 1.000000000000000000000000000000000000006E0)

(for-each
 (lambda (arg)
   (test (cosh arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))




;;; --------------------------------------------------------------------------------
;;; tanh
;;; --------------------------------------------------------------------------------

(num-test (tanh 0) 0.0)
(num-test (tanh 1) 0.76159415595576)
(num-test (tanh -1) -0.76159415595576)
(num-test (tanh 2) 0.96402758007582)
(num-test (tanh -2) -0.96402758007582)
(num-test (tanh 3) 0.99505475368673)
(num-test (tanh -3) -0.99505475368673)
(num-test (tanh 10) 0.99999999587769)
(num-test (tanh -10) -0.99999999587769)
(num-test (tanh 0/1) 0.0)
(num-test (tanh 0/2) 0.0)
(num-test (tanh 0/3) 0.0)
(num-test (tanh 0/10) 0.0)
(num-test (tanh 0/1234) 0.0)
(num-test (tanh 0/1234000000) 0.0)
(num-test (tanh 0/500029) 0.0)
(num-test (tanh 0/362880) 0.0)
(num-test (tanh 1/1) 0.76159415595576)
(num-test (tanh -1/1) -0.76159415595576)
(num-test (tanh 1/2) 0.46211715726001)
(num-test (tanh -1/2) -0.46211715726001)
(num-test (tanh 1/3) 0.32151273753163)
(num-test (tanh -1/3) -0.32151273753163)
(num-test (tanh 1/10) 0.09966799462496)
(num-test (tanh -1/10) -0.09966799462496)
(num-test (tanh 1/1234) 0.00081037259408)
(num-test (tanh -1/1234) -0.00081037259408)
(num-test (tanh 1/1234000000) 0.00000000081037)
(num-test (tanh -1/1234000000) -0.00000000081037)
(num-test (tanh 1/500029) 0.00000199988401)
(num-test (tanh -1/500029) -0.00000199988401)
(num-test (tanh 1/362880) 0.00000275573192)
(num-test (tanh -1/362880) -0.00000275573192)
(num-test (tanh 2/1) 0.96402758007582)
(num-test (tanh -2/1) -0.96402758007582)
(num-test (tanh 2/2) 0.76159415595576)
(num-test (tanh -2/2) -0.76159415595576)
(num-test (tanh 2/3) 0.58278294534791)
(num-test (tanh -2/3) -0.58278294534791)
(num-test (tanh 2/10) 0.19737532022490)
(num-test (tanh -2/10) -0.19737532022490)
(num-test (tanh 2/1234) 0.00162074412382)
(num-test (tanh -2/1234) -0.00162074412382)
(num-test (tanh 2/1234000000) 0.00000000162075)
(num-test (tanh -2/1234000000) -0.00000000162075)
(num-test (tanh 2/500029) 0.00000399976801)
(num-test (tanh -2/500029) -0.00000399976801)
(num-test (tanh 2/362880) 0.00000551146384)
(num-test (tanh -2/362880) -0.00000551146384)
(num-test (tanh 3/1) 0.99505475368673)
(num-test (tanh -3/1) -0.99505475368673)
(num-test (tanh 3/2) 0.90514825364487)
(num-test (tanh -3/2) -0.90514825364487)
(num-test (tanh 3/3) 0.76159415595576)
(num-test (tanh -3/3) -0.76159415595576)
(num-test (tanh 3/10) 0.29131261245159)
(num-test (tanh -3/10) -0.29131261245159)
(num-test (tanh 3/1234) 0.00243111352486)
(num-test (tanh -3/1234) -0.00243111352486)
(num-test (tanh 3/1234000000) 0.00000000243112)
(num-test (tanh -3/1234000000) -0.00000000243112)
(num-test (tanh 3/500029) 0.00000599965202)
(num-test (tanh -3/500029) -0.00000599965202)
(num-test (tanh 3/362880) 0.00000826719577)
(num-test (tanh -3/362880) -0.00000826719577)
(num-test (tanh 10/1) 0.99999999587769)
(num-test (tanh -10/1) -0.99999999587769)
(num-test (tanh 10/2) 0.99990920426260)
(num-test (tanh -10/2) -0.99990920426260)
(num-test (tanh 10/3) 0.99745796747384)
(num-test (tanh -10/3) -0.99745796747384)
(num-test (tanh 10/10) 0.76159415595576)
(num-test (tanh -10/10) -0.76159415595576)
(num-test (tanh 10/1234) 0.00810355032772)
(num-test (tanh -10/1234) -0.00810355032772)
(num-test (tanh 10/1234000000) 0.00000000810373)
(num-test (tanh -10/1234000000) -0.00000000810373)
(num-test (tanh 10/500029) 0.00001999884006)
(num-test (tanh -10/500029) -0.00001999884006)
(num-test (tanh 10/362880) 0.00002755731922)
(num-test (tanh -10/362880) -0.00002755731922)
(num-test (tanh 1234/10) 1.0)
(num-test (tanh -1234/10) -1.0)
(num-test (tanh 1234/1234) 0.76159415595576)
(num-test (tanh -1234/1234) -0.76159415595576)
(num-test (tanh 1234/1234000000) 0.00000100000000)
(num-test (tanh -1234/1234000000) -0.00000100000000)
(num-test (tanh 1234/500029) 0.00246785185430)
(num-test (tanh -1234/500029) -0.00246785185430)
(num-test (tanh 1234/362880) 0.00340056008434)
(num-test (tanh -1234/362880) -0.00340056008434)
(num-test (tanh 1234000000/1234000000) 0.76159415595576)
(num-test (tanh -1234000000/1234000000) -0.76159415595576)
(num-test (tanh 500029/1234000000) 0.00040520986437)
(num-test (tanh -500029/1234000000) -0.00040520986437)
(num-test (tanh 500029/500029) 0.76159415595576)
(num-test (tanh -500029/500029) -0.76159415595576)
(num-test (tanh 500029/362880) 0.88049046571870)
(num-test (tanh -500029/362880) -0.88049046571870)
(num-test (tanh 362880/1234) 1.0)
(num-test (tanh -362880/1234) -1.0)
(num-test (tanh 362880/1234000000) 0.00029406806284)
(num-test (tanh -362880/1234000000) -0.00029406806284)
(num-test (tanh 362880/500029) 0.62043861844530)
(num-test (tanh -362880/500029) -0.62043861844530)
(num-test (tanh 362880/362880) 0.76159415595576)
(num-test (tanh -362880/362880) -0.76159415595576)
(num-test (tanh 0.0) 0.0)
(num-test (tanh 0.00000001) 0.00000001)
(num-test (tanh -0.00000001) -0.00000001)
(num-test (tanh 1.0) 0.76159415595576)
(num-test (tanh -1.0) -0.76159415595576)
(num-test (tanh pi) 0.99627207622075)
(num-test (tanh -3.14159265358979) -0.99627207622075)
(num-test (tanh 2.71828182845905) 0.99132891580060)
(num-test (tanh -2.71828182845905) -0.99132891580060)
(num-test (tanh 0.0+0.0i) 0.0)
(num-test (tanh -0.0+0.0i) 0.0)
(num-test (tanh 0.0-0.0i) 0.0)
(num-test (tanh -0.0-0.0i) 0.0)
(num-test (tanh 0.0+0.00000001i) 0.0+0.00000001i)
(num-test (tanh -0.0+0.00000001i) 0.0+0.00000001i)
(num-test (tanh 0.0-0.00000001i) 0.0-0.00000001i)
(num-test (tanh -0.0-0.00000001i) -0.0-0.00000001i)
(num-test (tanh 0.0+1.0i) 0.0+1.55740772465490i)
(num-test (tanh -0.0+1.0i) 0.0+1.55740772465490i)
(num-test (tanh 0.0-1.0i) 0.0-1.55740772465490i)
(num-test (tanh -0.0-1.0i) -0.0-1.55740772465490i)
(num-test (tanh 0.00000001+0.0i) 0.00000001)
(num-test (tanh -0.00000001+0.0i) -0.00000001)
(num-test (tanh 0.00000001-0.0i) 0.00000001)
(num-test (tanh -0.00000001-0.0i) -0.00000001)
(num-test (tanh 0.00000001+0.00000001i) 0.00000001+0.00000001i)
(num-test (tanh -0.00000001+0.00000001i) -0.00000001+0.00000001i)
(num-test (tanh 0.00000001-0.00000001i) 0.00000001-0.00000001i)
(num-test (tanh -0.00000001-0.00000001i) -0.00000001-0.00000001i)
(num-test (tanh 0.00000001+1.0i) 0.00000003425519+1.55740772465490i)
(num-test (tanh -0.00000001+1.0i) -0.00000003425519+1.55740772465490i)
(num-test (tanh 0.00000001-1.0i) 0.00000003425519-1.55740772465490i)
(num-test (tanh -0.00000001-1.0i) -0.00000003425519-1.55740772465490i)
(num-test (tanh 1.0+0.0i) 0.76159415595576)
(num-test (tanh -1.0+0.0i) -0.76159415595576)
(num-test (tanh 1.0-0.0i) 0.76159415595576)
(num-test (tanh -1.0-0.0i) -0.76159415595576)
(num-test (tanh 1.0+0.00000001i) 0.76159415595576+0.00000000419974i)
(num-test (tanh -1.0+0.00000001i) -0.76159415595576+0.00000000419974i)
(num-test (tanh 1.0-0.00000001i) 0.76159415595576-0.00000000419974i)
(num-test (tanh -1.0-0.00000001i) -0.76159415595576-0.00000000419974i)
(num-test (tanh 1.0+1.0i) 1.08392332733869+0.27175258531951i)
(num-test (tanh -1.0+1.0i) -1.08392332733869+0.27175258531951i)
(num-test (tanh 1.0-1.0i) 1.08392332733869-0.27175258531951i)
(num-test (tanh -1.0-1.0i) -1.08392332733869-0.27175258531951i)
(num-test (tanh 3.14159265358979+0.0i) 0.99627207622075)
(num-test (tanh -3.14159265358979+0.0i) -0.99627207622075)
(num-test (tanh 3.14159265358979-0.0i) 0.99627207622075)
(num-test (tanh -3.14159265358979-0.0i) -0.99627207622075)
(num-test (tanh 3.14159265358979+0.00000001i) 0.99627207622075+0.00000000007442i)
(num-test (tanh -3.14159265358979+0.00000001i) -0.99627207622075+0.00000000007442i)
(num-test (tanh 3.14159265358979-0.00000001i) 0.99627207622075-0.00000000007442i)
(num-test (tanh -3.14159265358979-0.00000001i) -0.99627207622075-0.00000000007442i)
(num-test (tanh 3.14159265358979+1.0i) 1.00154968930275+0.00340139653674i)
(num-test (tanh -3.14159265358979+1.0i) -1.00154968930275+0.00340139653674i)
(num-test (tanh 3.14159265358979-1.0i) 1.00154968930275-0.00340139653674i)
(num-test (tanh -3.14159265358979-1.0i) -1.00154968930275-0.00340139653674i)
(num-test (tanh 2.71828182845905+0.0i) 0.99132891580060)
(num-test (tanh -2.71828182845905+0.0i) -0.99132891580060)
(num-test (tanh 2.71828182845905-0.0i) 0.99132891580060)
(num-test (tanh -2.71828182845905-0.0i) -0.99132891580060)
(num-test (tanh 2.71828182845905+0.00000001i) 0.99132891580060+0.00000000017267i)
(num-test (tanh -2.71828182845905+0.00000001i) -0.99132891580060+0.00000000017267i)
(num-test (tanh 2.71828182845905-0.00000001i) 0.99132891580060-0.00000000017267i)
(num-test (tanh -2.71828182845905-0.00000001i) -0.99132891580060-0.00000000017267i)
(num-test (tanh 2.71828182845905+1.0i) 1.00359921084211+0.00794757997665i)
(num-test (tanh -2.71828182845905+1.0i) -1.00359921084211+0.00794757997665i)
(num-test (tanh 2.71828182845905-1.0i) 1.00359921084211-0.00794757997665i)
(num-test (tanh -2.71828182845905-1.0i) -1.00359921084211-0.00794757997665i)
(num-test (tanh 1234/3) 1.0) 
(num-test (tanh 1234000000/3) 1.0) 
(num-test (tanh 1234000000/500029) 1.0) 
(num-test (tanh 1234000000/362880) 1.0) 
(num-test (tanh 500029/2) 1.0) 
(num-test (tanh 500029/3) 1.0) 
(num-test (tanh 500029/10) 1.0) 
(num-test (tanh 500029/1234) 1.0) 
(num-test (tanh 0.0+3.14159265358979i) 0.0+6.982889851335445E-15i) 
(num-test (tanh 0.0+2.71828182845905i) 0.0-0.4505495340698621i) 
(num-test (tanh 0.00000001+3.14159265358979i) 1.0e-8+6.982889851335444E-15i) 
(num-test (tanh 0.00000001+2.71828182845905i) 1.2029948826505699E-8-0.4505495340698621i) 
(num-test (tanh 0.00000001+1234.0i) 1.5681770497896427E-8-0.7537751984442328i) 
(num-test (tanh 0.00000001+1234000000.0i) 3.9600648244422054E-7-6.212941995900324i) 
(num-test (tanh 1.0+3.14159265358979i) +0.7615941559557649+2.932634567877868E-15i) 
(num-test (tanh 1.0+2.71828182845905i) .8196826057997404-0.1692870118766369i) 
(num-test (tanh 3.14159265358979+3.14159265358979i) +0.99627207622075+5.196631812627532E-17i) 
(num-test (tanh 3.14159265358979+2.71828182845905i) .9975247319761639-0.002790687681003331i) 
(num-test (tanh 3.14159265358979+1234.0i) .9989656315245496-0.003586791196867043i) 
(num-test (tanh 3.14159265358979+1234000000.0i) 1.003551866736695-0.001176098307980411i) 
(num-test (tanh 2.71828182845905+3.14159265358979i) +0.991328915800599+1.205734242765375E-16i) 
(num-test (tanh 2.71828182845905+2.71828182845905i) .9942257438545914-0.00648578276962794i) 
(num-test (tanh 2.71828182845905+1234.0i) .9975698313220817-0.008351965390936033i) 
(num-test (tanh 2.71828182845905+1234000000.0i) 1.008299558244272-0.002755390838840499i) 
(num-test (tanh 1234.0+0.00000001i) +1.0+8.077935669463161E-28i) 
(num-test (tanh 1234.0+3.14159265358979i) 1.0) 
(num-test (tanh 1234.0+2.71828182845905i) +1.0+2.710505431213761E-20i) 
(num-test (tanh 1234000000.0+0.00000001i) 1.0) 
(num-test (tanh 1234000000.0+3.14159265358979i) 1.0-7.703719777548943E-34i) 
(num-test (tanh 1234000000.0+2.71828182845905i) +1.0+2.710505431213761E-20i) 
(num-test (tanh 0.0e+00-3.45266983001243932001e-04i) 0-3.4526699672092183585e-4i)
(num-test (tanh 0.0e+00+3.45266983001243932001e-04i) 0+3.4526699672092183585e-4i)
(num-test (tanh 0.0e+00+1.57045105981189525579e+00i) 0+2.8963092606501007060e3i)
(num-test (tanh 0.0e+00-1.57045105981189525579e+00i) 0-2.8963092606501007060e3i)
(num-test (tanh 0.0e+00+1.57114159377789786021e+00i) 0-2.8963092606511280143e3i)
(num-test (tanh 0.0e+00-1.57114159377789786021e+00i) 0+2.8963092606511280143e3i)
(num-test (tanh 0.0e+00+3.14124738660679181379e+00i) 0-3.4526699672110257641e-4i)
(num-test (tanh 0.0e+00-3.14124738660679181379e+00i) 0+3.4526699672110257641e-4i)
(num-test (tanh 0.0e+00+3.14193792057279441821e+00i) 0+3.4526699672085764703e-4i)
(num-test (tanh 0.0e+00-3.14193792057279441821e+00i) 0-3.4526699672085764703e-4i)
(num-test (tanh 0.0e+00+4.71204371340168837179e+00i) 0+2.8963092606490733978e3i)
(num-test (tanh 0.0e+00-4.71204371340168837179e+00i) 0-2.8963092606490733978e3i)
(num-test (tanh 0.0e+00+4.71273424736769097620e+00i) 0-2.8963092606521553225e3i)
(num-test (tanh 0.0e+00-4.71273424736769097620e+00i) 0+2.8963092606521553225e3i)
(num-test (tanh 0.0e+00+6.28284004019658492979e+00i) 0-3.4526699672122504111e-4i)
(num-test (tanh 0.0e+00-6.28284004019658492979e+00i) 0+3.4526699672122504111e-4i)
(num-test (tanh 0.0e+00+6.28353057416258753420e+00i) 0+3.4526699672073518233e-4i)
(num-test (tanh 0.0e+00-6.28353057416258753420e+00i) 0-3.4526699672073518233e-4i)
(num-test (tanh 0.0e+00+9.42443269378637893396e+00i) 0-3.4526699672045932728e-4i)
(num-test (tanh 0.0e+00-9.42443269378637893396e+00i) 0+3.4526699672045932728e-4i)
(num-test (tanh 0.0e+00+9.42512322775237976202e+00i) 0+3.4526699671972453911e-4i)
(num-test (tanh 0.0e+00-9.42512322775237976202e+00i) 0-3.4526699671972453911e-4i)
(num-test (tanh 1.19209289550781250e-07-3.45266983001243932001e-04i) 1.1920930376163652989e-7-3.4526699672091692931e-4i)
(num-test (tanh 1.19209289550781250e-07+3.45266983001243932001e-04i) 1.1920930376163652989e-7+3.4526699672091692931e-4i)
(num-test (tanh -1.19209289550781250e-07-3.45266983001243932001e-04i) -1.1920930376163652989e-7-3.4526699672091692931e-4i)
(num-test (tanh -1.19209289550781250e-07+3.45266983001243932001e-04i) -1.1920930376163652989e-7+3.4526699672091692931e-4i)
(num-test (tanh 1.19209289550781250e-07+1.57045105981189525579e+00i) 9.9999992052646305569e-1+2.8963089153831588642e3i)
(num-test (tanh 1.19209289550781250e-07-1.57045105981189525579e+00i) 9.9999992052646305569e-1-2.8963089153831588642e3i)
(num-test (tanh -1.19209289550781250e-07+1.57045105981189525579e+00i) -9.9999992052646305569e-1+2.8963089153831588642e3i)
(num-test (tanh -1.19209289550781250e-07-1.57045105981189525579e+00i) -9.9999992052646305569e-1-2.8963089153831588642e3i)
(num-test (tanh 1.19209289550781250e-07+1.57114159377789786021e+00i) 9.9999992052717244672e-1-2.8963089153841861720e3i)
(num-test (tanh 1.19209289550781250e-07-1.57114159377789786021e+00i) 9.9999992052717244672e-1+2.8963089153841861720e3i)
(num-test (tanh -1.19209289550781250e-07+1.57114159377789786021e+00i) -9.9999992052717244672e-1-2.8963089153841861720e3i)
(num-test (tanh -1.19209289550781250e-07-1.57114159377789786021e+00i) -9.9999992052717244672e-1+2.8963089153841861720e3i)
(num-test (tanh 1.19209289550781250e-07+3.14124738660679181379e+00i) 1.1920930376163652991e-7-3.4526699672109766987e-4i)
(num-test (tanh 1.19209289550781250e-07-3.14124738660679181379e+00i) 1.1920930376163652991e-7+3.4526699672109766987e-4i)
(num-test (tanh -1.19209289550781250e-07+3.14124738660679181379e+00i) -1.1920930376163652991e-7-3.4526699672109766987e-4i)
(num-test (tanh -1.19209289550781250e-07-3.14124738660679181379e+00i) -1.1920930376163652991e-7+3.4526699672109766987e-4i)
(num-test (tanh 1.19209289550781250e-07+3.14193792057279441821e+00i) 1.1920930376163652989e-7+3.4526699672085274049e-4i)
(num-test (tanh 1.19209289550781250e-07-3.14193792057279441821e+00i) 1.1920930376163652989e-7-3.4526699672085274049e-4i)
(num-test (tanh -1.19209289550781250e-07+3.14193792057279441821e+00i) -1.1920930376163652989e-7+3.4526699672085274049e-4i)
(num-test (tanh -1.19209289550781250e-07-3.14193792057279441821e+00i) -1.1920930376163652989e-7-3.4526699672085274049e-4i)
(num-test (tanh 1.19209289550781250e-07+4.71204371340168837179e+00i) 9.9999992052575366466e-1+2.8963089153821315563e3i)
(num-test (tanh 1.19209289550781250e-07-4.71204371340168837179e+00i) 9.9999992052575366466e-1-2.8963089153821315563e3i)
(num-test (tanh -1.19209289550781250e-07+4.71204371340168837179e+00i) -9.9999992052575366466e-1+2.8963089153821315563e3i)
(num-test (tanh -1.19209289550781250e-07-4.71204371340168837179e+00i) -9.9999992052575366466e-1-2.8963089153821315563e3i)
(num-test (tanh 1.19209289550781250e-07+4.71273424736769097620e+00i) 9.9999992052788183776e-1-2.8963089153852134799e3i)
(num-test (tanh 1.19209289550781250e-07-4.71273424736769097620e+00i) 9.9999992052788183776e-1+2.8963089153852134799e3i)
(num-test (tanh -1.19209289550781250e-07+4.71273424736769097620e+00i) -9.9999992052788183776e-1-2.8963089153852134799e3i)
(num-test (tanh -1.19209289550781250e-07-4.71273424736769097620e+00i) -9.9999992052788183776e-1+2.8963089153852134799e3i)
(num-test (tanh 1.19209289550781250e-07+6.28284004019658492979e+00i) 1.1920930376163652992e-7-3.4526699672122013457e-4i)
(num-test (tanh 1.19209289550781250e-07-6.28284004019658492979e+00i) 1.1920930376163652992e-7+3.4526699672122013457e-4i)
(num-test (tanh -1.19209289550781250e-07+6.28284004019658492979e+00i) -1.1920930376163652992e-7-3.4526699672122013457e-4i)
(num-test (tanh -1.19209289550781250e-07-6.28284004019658492979e+00i) -1.1920930376163652992e-7+3.4526699672122013457e-4i)
(num-test (tanh 1.19209289550781250e-07+6.28353057416258753420e+00i) 1.1920930376163652988e-7+3.4526699672073027579e-4i)
(num-test (tanh 1.19209289550781250e-07-6.28353057416258753420e+00i) 1.1920930376163652988e-7-3.4526699672073027579e-4i)
(num-test (tanh -1.19209289550781250e-07+6.28353057416258753420e+00i) -1.1920930376163652988e-7+3.4526699672073027579e-4i)
(num-test (tanh -1.19209289550781250e-07-6.28353057416258753420e+00i) -1.1920930376163652988e-7-3.4526699672073027579e-4i)
(num-test (tanh 1.19209289550781250e-07+9.42443269378637893396e+00i) 1.1920930376163652985e-7-3.4526699672045442074e-4i)
(num-test (tanh 1.19209289550781250e-07-9.42443269378637893396e+00i) 1.1920930376163652985e-7+3.4526699672045442074e-4i)
(num-test (tanh -1.19209289550781250e-07+9.42443269378637893396e+00i) -1.1920930376163652985e-7-3.4526699672045442074e-4i)
(num-test (tanh -1.19209289550781250e-07-9.42443269378637893396e+00i) -1.1920930376163652985e-7+3.4526699672045442074e-4i)
(num-test (tanh 1.19209289550781250e-07+9.42512322775237976202e+00i) 1.1920930376163652979e-7+3.4526699671971963257e-4i)
(num-test (tanh 1.19209289550781250e-07-9.42512322775237976202e+00i) 1.1920930376163652979e-7-3.4526699671971963257e-4i)
(num-test (tanh -1.19209289550781250e-07+9.42512322775237976202e+00i) -1.1920930376163652979e-7+3.4526699671971963257e-4i)
(num-test (tanh -1.19209289550781250e-07-9.42512322775237976202e+00i) -1.1920930376163652979e-7-3.4526699671971963257e-4i)
(num-test (tanh 5.0e-01-3.45266983001243932001e-04i) 4.6211720058436229979e-1-2.7153443992655805934e-4i)
(num-test (tanh 5.0e-01+3.45266983001243932001e-04i) 4.6211720058436229979e-1+2.7153443992655805934e-4i)
(num-test (tanh -5.0e-01-3.45266983001243932001e-04i) -4.6211720058436229979e-1-2.7153443992655805934e-4i)
(num-test (tanh -5.0e-01+3.45266983001243932001e-04i) -4.6211720058436229979e-1+2.7153443992655805934e-4i)
(num-test (tanh 5.0e-01+1.57045105981189525579e+00i) 2.1639524637389325996e0+1.2715121175455623363e-3i)
(num-test (tanh 5.0e-01-1.57045105981189525579e+00i) 2.1639524637389325996e0-1.2715121175455623363e-3i)
(num-test (tanh -5.0e-01+1.57045105981189525579e+00i) -2.1639524637389325996e0+1.2715121175455623363e-3i)
(num-test (tanh -5.0e-01-1.57045105981189525579e+00i) -2.1639524637389325996e0-1.2715121175455623363e-3i)
(num-test (tanh 5.0e-01+1.57114159377789786021e+00i) 2.1639524637389326002e0-1.2715121175451113370e-3i)
(num-test (tanh 5.0e-01-1.57114159377789786021e+00i) 2.1639524637389326002e0+1.2715121175451113370e-3i)
(num-test (tanh -5.0e-01+1.57114159377789786021e+00i) -2.1639524637389326002e0-1.2715121175451113370e-3i)
(num-test (tanh -5.0e-01-1.57114159377789786021e+00i) -2.1639524637389326002e0+1.2715121175451113370e-3i)
(num-test (tanh 5.0e-01+3.14124738660679181379e+00i) 4.6211720058436229984e-1-2.7153443992670020234e-4i)
(num-test (tanh 5.0e-01-3.14124738660679181379e+00i) 4.6211720058436229984e-1+2.7153443992670020234e-4i)
(num-test (tanh -5.0e-01+3.14124738660679181379e+00i) -4.6211720058436229984e-1-2.7153443992670020234e-4i)
(num-test (tanh -5.0e-01-3.14124738660679181379e+00i) -4.6211720058436229984e-1+2.7153443992670020234e-4i)
(num-test (tanh 5.0e-01+3.14193792057279441821e+00i) 4.6211720058436229978e-1+2.7153443992650757820e-4i)
(num-test (tanh 5.0e-01-3.14193792057279441821e+00i) 4.6211720058436229978e-1-2.7153443992650757820e-4i)
(num-test (tanh -5.0e-01+3.14193792057279441821e+00i) -4.6211720058436229978e-1+2.7153443992650757820e-4i)
(num-test (tanh -5.0e-01-3.14193792057279441821e+00i) -4.6211720058436229978e-1-2.7153443992650757820e-4i)
(num-test (tanh 5.0e-01+4.71204371340168837179e+00i) 2.1639524637389325989e0+1.2715121175460133355e-3i)
(num-test (tanh 5.0e-01-4.71204371340168837179e+00i) 2.1639524637389325989e0-1.2715121175460133355e-3i)
(num-test (tanh -5.0e-01+4.71204371340168837179e+00i) -2.1639524637389325989e0+1.2715121175460133355e-3i)
(num-test (tanh -5.0e-01-4.71204371340168837179e+00i) -2.1639524637389325989e0-1.2715121175460133355e-3i)
(num-test (tanh 5.0e-01+4.71273424736769097620e+00i) 2.1639524637389326009e0-1.2715121175446603377e-3i)
(num-test (tanh 5.0e-01-4.71273424736769097620e+00i) 2.1639524637389326009e0+1.2715121175446603377e-3i)
(num-test (tanh -5.0e-01+4.71273424736769097620e+00i) -2.1639524637389326009e0-1.2715121175446603377e-3i)
(num-test (tanh -5.0e-01-4.71273424736769097620e+00i) -2.1639524637389326009e0+1.2715121175446603377e-3i)
(num-test (tanh 5.0e-01+6.28284004019658492979e+00i) 4.6211720058436229987e-1-2.7153443992679651442e-4i)
(num-test (tanh 5.0e-01-6.28284004019658492979e+00i) 4.6211720058436229987e-1+2.7153443992679651442e-4i)
(num-test (tanh -5.0e-01+6.28284004019658492979e+00i) -4.6211720058436229987e-1-2.7153443992679651442e-4i)
(num-test (tanh -5.0e-01-6.28284004019658492979e+00i) -4.6211720058436229987e-1+2.7153443992679651442e-4i)
(num-test (tanh 5.0e-01+6.28353057416258753420e+00i) 4.6211720058436229974e-1+2.7153443992641126612e-4i)
(num-test (tanh 5.0e-01-6.28353057416258753420e+00i) 4.6211720058436229974e-1-2.7153443992641126612e-4i)
(num-test (tanh -5.0e-01+6.28353057416258753420e+00i) -4.6211720058436229974e-1+2.7153443992641126612e-4i)
(num-test (tanh -5.0e-01-6.28353057416258753420e+00i) -4.6211720058436229974e-1-2.7153443992641126612e-4i)
(num-test (tanh 5.0e-01+9.42443269378637893396e+00i) 4.6211720058436229968e-1-2.7153443992619432056e-4i)
(num-test (tanh 5.0e-01-9.42443269378637893396e+00i) 4.6211720058436229968e-1+2.7153443992619432056e-4i)
(num-test (tanh -5.0e-01+9.42443269378637893396e+00i) -4.6211720058436229968e-1-2.7153443992619432056e-4i)
(num-test (tanh -5.0e-01-9.42443269378637893396e+00i) -4.6211720058436229968e-1+2.7153443992619432056e-4i)
(num-test (tanh 5.0e-01+9.42512322775237976202e+00i) 4.6211720058436229949e-1+2.7153443992561644811e-4i)
(num-test (tanh 5.0e-01-9.42512322775237976202e+00i) 4.6211720058436229949e-1-2.7153443992561644811e-4i)
(num-test (tanh -5.0e-01+9.42512322775237976202e+00i) -4.6211720058436229949e-1+2.7153443992561644811e-4i)
(num-test (tanh -5.0e-01-9.42512322775237976202e+00i) -4.6211720058436229949e-1-2.7153443992561644811e-4i)
(num-test (tanh 1.0e+00-3.45266983001243932001e-04i) 7.6159419408485704836e-1-1.4500326960274960880e-4i)
(num-test (tanh 1.0e+00+3.45266983001243932001e-04i) 7.6159419408485704836e-1+1.4500326960274960880e-4i)
(num-test (tanh -1.0e+00-3.45266983001243932001e-04i) -7.6159419408485704836e-1-1.4500326960274960880e-4i)
(num-test (tanh -1.0e+00+3.45266983001243932001e-04i) -7.6159419408485704836e-1+1.4500326960274960880e-4i)
(num-test (tanh 1.0e+00+1.57045105981189525579e+00i) 1.3130351721648674823e0+2.4999454374276273814e-4i)
(num-test (tanh 1.0e+00-1.57045105981189525579e+00i) 1.3130351721648674823e0-2.4999454374276273814e-4i)
(num-test (tanh -1.0e+00+1.57045105981189525579e+00i) -1.3130351721648674823e0+2.4999454374276273814e-4i)
(num-test (tanh -1.0e+00-1.57045105981189525579e+00i) -1.3130351721648674823e0-2.4999454374276273814e-4i)
(num-test (tanh 1.0e+00+1.57114159377789786021e+00i) 1.3130351721648674824e0-2.4999454374267406620e-4i)
(num-test (tanh 1.0e+00-1.57114159377789786021e+00i) 1.3130351721648674824e0+2.4999454374267406620e-4i)
(num-test (tanh -1.0e+00+1.57114159377789786021e+00i) -1.3130351721648674824e0-2.4999454374267406620e-4i)
(num-test (tanh -1.0e+00-1.57114159377789786021e+00i) -1.3130351721648674824e0+2.4999454374267406620e-4i)
(num-test (tanh 1.0e+00+3.14124738660679181379e+00i) 7.6159419408485704840e-1-1.4500326960282551519e-4i)
(num-test (tanh 1.0e+00-3.14124738660679181379e+00i) 7.6159419408485704840e-1+1.4500326960282551519e-4i)
(num-test (tanh -1.0e+00+3.14124738660679181379e+00i) -7.6159419408485704840e-1-1.4500326960282551519e-4i)
(num-test (tanh -1.0e+00-3.14124738660679181379e+00i) -7.6159419408485704840e-1+1.4500326960282551519e-4i)
(num-test (tanh 1.0e+00+3.14193792057279441821e+00i) 7.6159419408485704835e-1+1.4500326960272265115e-4i)
(num-test (tanh 1.0e+00-3.14193792057279441821e+00i) 7.6159419408485704835e-1-1.4500326960272265115e-4i)
(num-test (tanh -1.0e+00+3.14193792057279441821e+00i) -7.6159419408485704835e-1+1.4500326960272265115e-4i)
(num-test (tanh -1.0e+00-3.14193792057279441821e+00i) -7.6159419408485704835e-1-1.4500326960272265115e-4i)
(num-test (tanh 1.0e+00+4.71204371340168837179e+00i) 1.3130351721648674822e0+2.4999454374285141007e-4i)
(num-test (tanh 1.0e+00-4.71204371340168837179e+00i) 1.3130351721648674822e0-2.4999454374285141007e-4i)
(num-test (tanh -1.0e+00+4.71204371340168837179e+00i) -1.3130351721648674822e0+2.4999454374285141007e-4i)
(num-test (tanh -1.0e+00-4.71204371340168837179e+00i) -1.3130351721648674822e0-2.4999454374285141007e-4i)
(num-test (tanh 1.0e+00+4.71273424736769097620e+00i) 1.3130351721648674825e0-2.4999454374258539427e-4i)
(num-test (tanh 1.0e+00-4.71273424736769097620e+00i) 1.3130351721648674825e0+2.4999454374258539427e-4i)
(num-test (tanh -1.0e+00+4.71273424736769097620e+00i) -1.3130351721648674825e0-2.4999454374258539427e-4i)
(num-test (tanh -1.0e+00-4.71273424736769097620e+00i) -1.3130351721648674825e0+2.4999454374258539427e-4i)
(num-test (tanh 1.0e+00+6.28284004019658492979e+00i) 7.6159419408485704843e-1-1.4500326960287694721e-4i)
(num-test (tanh 1.0e+00-6.28284004019658492979e+00i) 7.6159419408485704843e-1+1.4500326960287694721e-4i)
(num-test (tanh -1.0e+00+6.28284004019658492979e+00i) -7.6159419408485704843e-1-1.4500326960287694721e-4i)
(num-test (tanh -1.0e+00-6.28284004019658492979e+00i) -7.6159419408485704843e-1+1.4500326960287694721e-4i)
(num-test (tanh 1.0e+00+6.28353057416258753420e+00i) 7.6159419408485704832e-1+1.4500326960267121913e-4i)
(num-test (tanh 1.0e+00-6.28353057416258753420e+00i) 7.6159419408485704832e-1-1.4500326960267121913e-4i)
(num-test (tanh -1.0e+00+6.28353057416258753420e+00i) -7.6159419408485704832e-1+1.4500326960267121913e-4i)
(num-test (tanh -1.0e+00-6.28353057416258753420e+00i) -7.6159419408485704832e-1-1.4500326960267121913e-4i)
(num-test (tanh 1.0e+00+9.42443269378637893396e+00i) 7.6159419408485704826e-1-1.4500326960255536711e-4i)
(num-test (tanh 1.0e+00-9.42443269378637893396e+00i) 7.6159419408485704826e-1+1.4500326960255536711e-4i)
(num-test (tanh -1.0e+00+9.42443269378637893396e+00i) -7.6159419408485704826e-1-1.4500326960255536711e-4i)
(num-test (tanh -1.0e+00-9.42443269378637893396e+00i) -7.6159419408485704826e-1+1.4500326960255536711e-4i)
(num-test (tanh 1.0e+00+9.42512322775237976202e+00i) 7.6159419408485704810e-1+1.450032696022467750e-4i)
(num-test (tanh 1.0e+00-9.42512322775237976202e+00i) 7.6159419408485704810e-1-1.450032696022467750e-4i)
(num-test (tanh -1.0e+00+9.42512322775237976202e+00i) -7.6159419408485704810e-1+1.450032696022467750e-4i)
(num-test (tanh -1.0e+00-9.42512322775237976202e+00i) -7.6159419408485704810e-1-1.450032696022467750e-4i)
(num-test (tanh 2.0e+00-3.45266983001243932001e-04i) 9.6402758819508310556e-1-2.4393395410435306874e-5i)
(num-test (tanh 2.0e+00+3.45266983001243932001e-04i) 9.6402758819508310556e-1+2.4393395410435306874e-5i)
(num-test (tanh -2.0e+00-3.45266983001243932001e-04i) -9.6402758819508310556e-1-2.4393395410435306874e-5i)
(num-test (tanh -2.0e+00+3.45266983001243932001e-04i) -9.6402758819508310556e-1+2.4393395410435306874e-5i)
(num-test (tanh 2.0e+00+1.57045105981189525579e+00i) 1.0373147113268752620e0+2.6247825506572821595e-5i)
(num-test (tanh 2.0e+00-1.57045105981189525579e+00i) 1.0373147113268752620e0-2.6247825506572821595e-5i)
(num-test (tanh -2.0e+00+1.57045105981189525579e+00i) -1.0373147113268752620e0+2.6247825506572821595e-5i)
(num-test (tanh -2.0e+00-1.57045105981189525579e+00i) -1.0373147113268752620e0-2.6247825506572821595e-5i)
(num-test (tanh 2.0e+00+1.57114159377789786021e+00i) 1.0373147113268752620e0-2.6247825506563511609e-5i)
(num-test (tanh 2.0e+00-1.57114159377789786021e+00i) 1.0373147113268752620e0+2.6247825506563511609e-5i)
(num-test (tanh -2.0e+00+1.57114159377789786021e+00i) -1.0373147113268752620e0-2.6247825506563511609e-5i)
(num-test (tanh -2.0e+00-1.57114159377789786021e+00i) -1.0373147113268752620e0+2.6247825506563511609e-5i)
(num-test (tanh 2.0e+00+3.14124738660679181379e+00i) 9.6402758819508310557e-1-2.4393395410448076340e-5i)
(num-test (tanh 2.0e+00-3.14124738660679181379e+00i) 9.6402758819508310557e-1+2.4393395410448076340e-5i)
(num-test (tanh -2.0e+00+3.14124738660679181379e+00i) -9.6402758819508310557e-1-2.4393395410448076340e-5i)
(num-test (tanh -2.0e+00-3.14124738660679181379e+00i) -9.6402758819508310557e-1+2.4393395410448076340e-5i)
(num-test (tanh 2.0e+00+3.14193792057279441821e+00i) 9.6402758819508310556e-1+2.4393395410430771882e-5i)
(num-test (tanh 2.0e+00-3.14193792057279441821e+00i) 9.6402758819508310556e-1-2.4393395410430771882e-5i)
(num-test (tanh -2.0e+00+3.14193792057279441821e+00i) -9.6402758819508310556e-1+2.4393395410430771882e-5i)
(num-test (tanh -2.0e+00-3.14193792057279441821e+00i) -9.6402758819508310556e-1-2.4393395410430771882e-5i)
(num-test (tanh 2.0e+00+4.71204371340168837179e+00i) 1.0373147113268752620e0+2.6247825506582131582e-5i)
(num-test (tanh 2.0e+00-4.71204371340168837179e+00i) 1.0373147113268752620e0-2.6247825506582131582e-5i)
(num-test (tanh -2.0e+00+4.71204371340168837179e+00i) -1.0373147113268752620e0+2.6247825506582131582e-5i)
(num-test (tanh -2.0e+00-4.71204371340168837179e+00i) -1.0373147113268752620e0-2.6247825506582131582e-5i)
(num-test (tanh 2.0e+00+4.71273424736769097620e+00i) 1.0373147113268752620e0-2.6247825506554201622e-5i)
(num-test (tanh 2.0e+00-4.71273424736769097620e+00i) 1.0373147113268752620e0+2.6247825506554201622e-5i)
(num-test (tanh -2.0e+00+4.71273424736769097620e+00i) -1.0373147113268752620e0-2.6247825506554201622e-5i)
(num-test (tanh -2.0e+00-4.71273424736769097620e+00i) -1.0373147113268752620e0+2.6247825506554201622e-5i)
(num-test (tanh 2.0e+00+6.28284004019658492979e+00i) 9.6402758819508310558e-1-2.4393395410456728569e-5i)
(num-test (tanh 2.0e+00-6.28284004019658492979e+00i) 9.6402758819508310558e-1+2.4393395410456728569e-5i)
(num-test (tanh -2.0e+00+6.28284004019658492979e+00i) -9.6402758819508310558e-1-2.4393395410456728569e-5i)
(num-test (tanh -2.0e+00-6.28284004019658492979e+00i) -9.6402758819508310558e-1+2.4393395410456728569e-5i)
(num-test (tanh 2.0e+00+6.28353057416258753420e+00i) 9.6402758819508310555e-1+2.4393395410422119654e-5i)
(num-test (tanh 2.0e+00-6.28353057416258753420e+00i) 9.6402758819508310555e-1-2.4393395410422119654e-5i)
(num-test (tanh -2.0e+00+6.28353057416258753420e+00i) -9.6402758819508310555e-1+2.4393395410422119654e-5i)
(num-test (tanh -2.0e+00-6.28353057416258753420e+00i) -9.6402758819508310555e-1-2.4393395410422119654e-5i)
(num-test (tanh 2.0e+00+9.42443269378637893396e+00i) 9.6402758819508310554e-1-2.4393395410402630273e-5i)
(num-test (tanh 2.0e+00-9.42443269378637893396e+00i) 9.6402758819508310554e-1+2.4393395410402630273e-5i)
(num-test (tanh -2.0e+00+9.42443269378637893396e+00i) -9.6402758819508310554e-1-2.4393395410402630273e-5i)
(num-test (tanh -2.0e+00-9.42443269378637893396e+00i) -9.6402758819508310554e-1+2.4393395410402630273e-5i)
(num-test (tanh 2.0e+00+9.42512322775237976202e+00i) 9.6402758819508310550e-1+2.439339541035071690e-5i)
(num-test (tanh 2.0e+00-9.42512322775237976202e+00i) 9.6402758819508310550e-1-2.439339541035071690e-5i)
(num-test (tanh -2.0e+00+9.42512322775237976202e+00i) -9.6402758819508310550e-1+2.439339541035071690e-5i)
(num-test (tanh -2.0e+00-9.42512322775237976202e+00i) -9.6402758819508310550e-1-2.439339541035071690e-5i)
(num-test (tanh 50) 1.0)
(num-test (tanh -2.225073858507201399999999999999999999996E-308) -2.225073858507201399999999999999999999996E-308)
(num-test (tanh 1.110223024625156799999999999999999999997E-16) 1.110223024625156799999999999999995438476E-16)

(test (nan? (tanh 1/0)) #t)
;(test (nan? (tanh 1/0+i)) #t)
;(test (nan? (tanh 1/0+1/0i)) #t)
(test (nan? (tanh 1+1/0i)) #t)
(test (nan? (tanh 0+1/0i)) #t)
;(test (nan? (tanh 1/0+0i)) #t)

(for-each
 (lambda (num-and-val)
   (let ((num (car num-and-val)) (val (cadr num-and-val))) (num-test-1 'tanh num (tanh num) val)))
 (vector (list 0 0) (list 1 0.76159415595576) (list 2 0.96402758007582) (list 3 0.99505475368673) 
	 (list -1 -0.76159415595576) (list -2 -0.96402758007582) (list -3 -0.99505475368673) 
	 (list 9223372036854775807 1.0) (list -9223372036854775808 -1.0) (list 1/2 0.46211715726001) 
	 (list 1/3 0.32151273753163) (list -1/2 -0.46211715726001) (list -1/3 -0.32151273753163) 
	 (list 1/9223372036854775807 1.0842021724855e-19) (list 0.0 0.0) (list 1.0 0.76159415595576) 
	 (list 2.0 0.96402758007582) (list -2.0 -0.96402758007582) (list 1.000000000000000000000000000000000000002E-309 1.000000000000000000000000000000000000002E-309) 
	 (list 1e+16 1.0) (list inf.0 1.0) (list -inf.0 -1.0) (list 0+1i 0+1.5574077246549i) 
	 (list 0+2i 0-2.1850398632615i) (list 0-1i 0-1.5574077246549i) (list 1+1i 1.0839233273387+0.27175258531951i) 
	 (list 1-1i 1.0839233273387-0.27175258531951i) (list -1+1i -1.0839233273387+0.27175258531951i) 
	 (list -1-1i -1.0839233273387-0.27175258531951i) (list 0.1+0.1i 0.10066129051146+0.099328043521656i) 
	 (list 1e+16+1e+16i 1.0) (list 1e-16+1e-16i 1e-16+1e-16i) ))
  
(test (tanh) 'error)
(test (tanh "hi") 'error)
(test (tanh 1.0+23.0i 1.0+23.0i) 'error)
(test (tanh 0 1) 'error)

(for-each
 (lambda (arg)
   (test (tanh arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))



;;; --------------------------------------------------------------------------------
;;; asinh
;;; --------------------------------------------------------------------------------

(num-test (asinh 0) 0.0)
(num-test (asinh 1) 0.88137358701954)
(num-test (asinh -1) -0.88137358701954)
(num-test (asinh 2) 1.44363547517881)
(num-test (asinh -2) -1.44363547517881)
(num-test (asinh 3) 1.81844645923207)
(num-test (asinh -3) -1.81844645923207)
(num-test (asinh 10) 2.99822295029797)
(num-test (asinh -10) -2.99822295029798)
(num-test (asinh 1234) 7.81116354920125)
(num-test (asinh -1234) -7.81116354896171)
(num-test (asinh 1234000000) 21.62667394298955)
(num-test (asinh 500029) 13.81556855628334)
(num-test (asinh 362880) 13.49497466064331)
(num-test (asinh 0/1) 0.0)
(num-test (asinh 0/2) 0.0)
(num-test (asinh 0/3) 0.0)
(num-test (asinh 0/10) 0.0)
(num-test (asinh 0/1234) 0.0)
(num-test (asinh 0/1234000000) 0.0)
(num-test (asinh 0/500029) 0.0)
(num-test (asinh 0/362880) 0.0)
(num-test (asinh 1/1) 0.88137358701954)
(num-test (asinh -1/1) -0.88137358701954)
(num-test (asinh 1/2) 0.48121182505960)
(num-test (asinh -1/2) -0.48121182505960)
(num-test (asinh 1/3) 0.32745015023726)
(num-test (asinh -1/3) -0.32745015023726)
(num-test (asinh 1/10) 0.09983407889921)
(num-test (asinh -1/10) -0.09983407889921)
(num-test (asinh 1/1234) 0.00081037268278)
(num-test (asinh -1/1234) -0.00081037268278)
(num-test (asinh 1/1234000000) 0.00000000081037)
(num-test (asinh -1/1234000000) -0.00000000081037)
(num-test (asinh 1/500029) 0.00000199988401)
(num-test (asinh -1/500029) -0.00000199988401)
(num-test (asinh 1/362880) 0.00000275573192)
(num-test (asinh -1/362880) -0.00000275573192)
(num-test (asinh 2/1) 1.44363547517881)
(num-test (asinh -2/1) -1.44363547517881)
(num-test (asinh 2/2) 0.88137358701954)
(num-test (asinh -2/2) -0.88137358701954)
(num-test (asinh 2/3) 0.62514511725042)
(num-test (asinh -2/3) -0.62514511725042)
(num-test (asinh 2/10) 0.19869011034924)
(num-test (asinh -2/10) -0.19869011034924)
(num-test (asinh 2/1234) 0.00162074483338)
(num-test (asinh -2/1234) -0.00162074483338)
(num-test (asinh 2/1234000000) 0.00000000162075)
(num-test (asinh -2/1234000000) -0.00000000162075)
(num-test (asinh 2/500029) 0.00000399976801)
(num-test (asinh -2/500029) -0.00000399976801)
(num-test (asinh 2/362880) 0.00000551146384)
(num-test (asinh -2/362880) -0.00000551146384)
(num-test (asinh 3/1) 1.81844645923207)
(num-test (asinh -3/1) -1.81844645923207)
(num-test (asinh 3/2) 1.19476321728711)
(num-test (asinh -3/2) -1.19476321728711)
(num-test (asinh 3/3) 0.88137358701954)
(num-test (asinh -3/3) -0.88137358701954)
(num-test (asinh 3/10) 0.29567304756342)
(num-test (asinh -3/10) -0.29567304756342)
(num-test (asinh 3/1234) 0.00243111591964)
(num-test (asinh -3/1234) -0.00243111591964)
(num-test (asinh 3/1234000000) 0.00000000243112)
(num-test (asinh -3/1234000000) -0.00000000243112)
(num-test (asinh 3/500029) 0.00000599965202)
(num-test (asinh -3/500029) -0.00000599965202)
(num-test (asinh 3/362880) 0.00000826719577)
(num-test (asinh -3/362880) -0.00000826719577)
(num-test (asinh 10/1) 2.99822295029797)
(num-test (asinh -10/1) -2.99822295029798)
(num-test (asinh 10/2) 2.31243834127275)
(num-test (asinh -10/2) -2.31243834127276)
(num-test (asinh 10/3) 1.91889647209853)
(num-test (asinh -10/3) -1.91889647209853)
(num-test (asinh 10/10) 0.88137358701954)
(num-test (asinh -10/10) -0.88137358701954)
(num-test (asinh 10/1234) 0.00810363902153)
(num-test (asinh -10/1234) -0.00810363902153)
(num-test (asinh 10/1234000000) 0.00000000810373)
(num-test (asinh -10/1234000000) -0.00000000810373)
(num-test (asinh 10/500029) 0.00001999884007)
(num-test (asinh -10/500029) -0.00001999884007)
(num-test (asinh 10/362880) 0.00002755731922)
(num-test (asinh -10/362880) -0.00002755731922)
(num-test (asinh 1234/1) 7.81116354920125)
(num-test (asinh -1234/1) -7.81116354896171)
(num-test (asinh 1234/2) 7.11801686116871)
(num-test (asinh -1234/2) -7.11801686109890)
(num-test (asinh 1234/3) 6.71255257393796)
(num-test (asinh -1234/3) -6.71255257391934)
(num-test (asinh 1234/10) 5.50859470922766)
(num-test (asinh -1234/10) -5.50859470922637)
(num-test (asinh 1234/1234) 0.88137358701954)
(num-test (asinh -1234/1234) -0.88137358701954)
(num-test (asinh 1234/1234000000) 0.00000100000000)
(num-test (asinh -1234/1234000000) -0.00000100000000)
(num-test (asinh 1234/500029) 0.00246785435930)
(num-test (asinh -1234/500029) -0.00246785435930)
(num-test (asinh 1234/362880) 0.00340056663829)
(num-test (asinh -1234/362880) -0.00340056663829)
(num-test (asinh 1234000000/1) 21.62667394298955)
(num-test (asinh 1234000000/2) 20.93352676242961)
(num-test (asinh 1234000000/3) 20.52806165432144)
(num-test (asinh 1234000000/10) 19.32408884999551)
(num-test (asinh 1234000000/1234) 14.50865773852447)
(num-test (asinh 1234000000/1234000000) 0.88137358701954)
(num-test (asinh -1234000000/1234000000) -0.88137358701954)
(num-test (asinh 1234000000/500029) 8.50425260831592)
(num-test (asinh -1234000000/500029) -8.50425260755399)
(num-test (asinh 1234000000/362880) 8.82484648452709)
(num-test (asinh -1234000000/362880) -8.82484648383427)
(num-test (asinh 500029/1) 13.81556855628334)
(num-test (asinh 500029/2) 13.12242137572639)
(num-test (asinh 500029/3) 12.71695626762323)
(num-test (asinh -500029/3) -12.71695626762323)
(num-test (asinh 500029/10) 11.51298346338828)
(num-test (asinh -500029/10) -11.51298333576987)
(num-test (asinh 500029/1234) 6.69755387439290)
(num-test (asinh -500029/1234) -6.69755387437470)
(num-test (asinh 500029/1234000000) 0.00040520987546)
(num-test (asinh -500029/1234000000) -0.00040520987546)
(num-test (asinh 500029/500029) 0.88137358701954)
(num-test (asinh -500029/500029) -0.88137358701954)
(num-test (asinh 500029/362880) 1.12509614482188)
(num-test (asinh -500029/362880) -1.12509614482188)
(num-test (asinh 362880/1) 13.49497466064331)
(num-test (asinh 362880/2) 12.80182748008906)
(num-test (asinh -362880/2) -12.80182748008906)
(num-test (asinh 362880/3) 12.39636237199039)
(num-test (asinh -362880/3) -12.39636125811213)
(num-test (asinh 362880/10) 11.19238956783722)
(num-test (asinh -362880/10) -11.19238933388543)
(num-test (asinh 362880/1234) 6.37696134713805)
(num-test (asinh -362880/1234) -6.37696134714268)
(num-test (asinh 362880/1234000000) 0.00029406806707)
(num-test (asinh -362880/1234000000) -0.00029406806707)
(num-test (asinh 362880/500029) 0.67360821551802)
(num-test (asinh -362880/500029) -0.67360821551802)
(num-test (asinh 362880/362880) 0.88137358701954)
(num-test (asinh -362880/362880) -0.88137358701954)
(num-test (asinh 0.0) 0.0)
(num-test (asinh 0.00000001) 0.00000001)
(num-test (asinh -0.00000001) -0.00000001)
(num-test (asinh 1.0) 0.88137358701954)
(num-test (asinh -1.0) -0.88137358701954)
(num-test (asinh pi) 1.86229574331085)
(num-test (asinh -3.14159265358979) -1.86229574331085)
(num-test (asinh 2.71828182845905) 1.72538255885231)
(num-test (asinh -2.71828182845905) -1.72538255885232)
(num-test (asinh 1234.0) 7.81116354920125)
(num-test (asinh -1234.0) -7.81116354896171)
(num-test (asinh 1234000000.0) 21.62667394298955)
(num-test (asinh 0.0+0.0i) 0.0)
(num-test (asinh -0.0+0.0i) 0.0)
(num-test (asinh 0.0-0.0i) 0.0)
(num-test (asinh -0.0-0.0i) 0.0)
(num-test (asinh 0.0+0.00000001i) 0.0+0.00000001i)
(num-test (asinh -0.0+0.00000001i) 0.0+0.00000001i)
(num-test (asinh 0.0-0.00000001i) 0.0-0.00000001i)
(num-test (asinh -0.0-0.00000001i) 0.0-0.00000001i)
(num-test (asinh 0.0+1.0i) 0.0+1.57079632679490i)
(num-test (asinh -0.0+1.0i) 0.0+1.57079632679490i)
(num-test (asinh 0.0-1.0i) 0.0-1.57079632679490i)
(num-test (asinh -0.0-1.0i) 0.0-1.57079632679490i)
(num-test (asinh 0.0+3.14159265358979i) 1.81152627246085+1.57079632679490i)
(num-test (asinh -0.0+3.14159265358979i) 1.81152627246085+1.57079632679490i)
(num-test (asinh 0.0-3.14159265358979i) 1.81152627246085-1.57079632679490i)
(num-test (asinh -0.0-3.14159265358979i) -1.81152627246085-1.57079632679490i)
(num-test (asinh 0.0+2.71828182845905i) 1.65745445415308+1.57079632679490i)
(num-test (asinh -0.0+2.71828182845905i) 1.65745445415308+1.57079632679490i)
(num-test (asinh 0.0-2.71828182845905i) 1.65745445415308-1.57079632679490i)
(num-test (asinh -0.0-2.71828182845905i) -1.65745445415308-1.57079632679490i)
(num-test (asinh 0.0+1234.0i) 7.81116322084923+1.57079632679490i)
(num-test (asinh -0.0+1234.0i) 7.81116322084923+1.57079632679490i)
(num-test (asinh 0.0-1234.0i) 7.81116322084923-1.57079632679490i)
(num-test (asinh -0.0-1234.0i) -7.81116322068415-1.57079632679490i)
(num-test (asinh 0.0+1234000000.0i) 21.62667394298955+1.57079632679490i)
(num-test (asinh -0.0+1234000000.0i) 21.62667394298955+1.57079632679490i)
(num-test (asinh 0.0-1234000000.0i) 21.62667394298955-1.57079632679490i)
(num-test (asinh 0.00000001+0.0i) 0.00000001)
(num-test (asinh -0.00000001+0.0i) -0.00000001)
(num-test (asinh 0.00000001-0.0i) 0.00000001)
(num-test (asinh -0.00000001-0.0i) -0.00000001)
(num-test (asinh 0.00000001+0.00000001i) 0.00000001+0.00000001i)
(num-test (asinh -0.00000001+0.00000001i) -0.00000001+0.00000001i)
(num-test (asinh 0.00000001-0.00000001i) 0.00000001-0.00000001i)
(num-test (asinh -0.00000001-0.00000001i) -0.00000001-0.00000001i)
(num-test (asinh 0.00000001+1.0i) 0.00010000000008+1.57069632679498i)
(num-test (asinh -0.00000001+1.0i) -0.00010000000008+1.57069632679498i)
(num-test (asinh 0.00000001-1.0i) 0.00010000000008-1.57069632679498i)
(num-test (asinh -0.00000001-1.0i) -0.00010000000008-1.57069632679498i)
(num-test (asinh 0.00000001+3.14159265358979i) 1.81152627246085+1.57079632343715i)
(num-test (asinh -0.00000001+3.14159265358979i) -1.81152627246085+1.57079632343715i)
(num-test (asinh 0.00000001-3.14159265358979i) 1.81152627246085-1.57079632343715i)
(num-test (asinh -0.00000001-3.14159265358979i) -1.81152627246085-1.57079632343715i)
(num-test (asinh 0.00000001+2.71828182845905i) 1.65745445415308+1.57079632283867i)
(num-test (asinh -0.00000001+2.71828182845905i) -1.65745445415308+1.57079632283867i)
(num-test (asinh 0.00000001-2.71828182845905i) 1.65745445415308-1.57079632283867i)
(num-test (asinh -0.00000001-2.71828182845905i) -1.65745445415308-1.57079632283867i)
(num-test (asinh 0.00000001+1234.0i) 7.81116322084923+1.57079632678679i)
(num-test (asinh -0.00000001+1234.0i) -7.81116322068415+1.57079632678679i)
(num-test (asinh 0.00000001-1234.0i) 7.81116322084923-1.57079632678679i)
(num-test (asinh -0.00000001-1234.0i) -7.81116322068415-1.57079632678679i)
(num-test (asinh 0.00000001+1234000000.0i) 21.62667394298955+1.57079632679490i)
(num-test (asinh 0.00000001-1234000000.0i) 21.62667394298955-1.57079632679490i)
(num-test (asinh 1.0+0.0i) 0.88137358701954)
(num-test (asinh -1.0+0.0i) -0.88137358701954)
(num-test (asinh 1.0-0.0i) 0.88137358701954)
(num-test (asinh -1.0-0.0i) -0.88137358701954)
(num-test (asinh 1.0+0.00000001i) 0.88137358701954+0.00000000707107i)
(num-test (asinh -1.0+0.00000001i) -0.88137358701954+0.00000000707107i)
(num-test (asinh 1.0-0.00000001i) 0.88137358701954-0.00000000707107i)
(num-test (asinh -1.0-0.00000001i) -0.88137358701954-0.00000000707107i)
(num-test (asinh 1.0+1.0i) 1.06127506190504+0.66623943249252i)
(num-test (asinh -1.0+1.0i) -1.06127506190504+0.66623943249252i)
(num-test (asinh 1.0-1.0i) 1.06127506190504-0.66623943249252i)
(num-test (asinh -1.0-1.0i) -1.06127506190504-0.66623943249252i)
(num-test (asinh 1.0+3.14159265358979i) 1.86711439316026+1.24854303281344i)
(num-test (asinh -1.0+3.14159265358979i) -1.86711439316026+1.24854303281344i)
(num-test (asinh 1.0-3.14159265358979i) 1.86711439316026-1.24854303281344i)
(num-test (asinh -1.0-3.14159265358979i) -1.86711439316026-1.24854303281344i)
(num-test (asinh 1.0+2.71828182845905i) 1.73375471569385+1.19757808518581i)
(num-test (asinh -1.0+2.71828182845905i) -1.73375471569385+1.19757808518581i)
(num-test (asinh 1.0-2.71828182845905i) 1.73375471569385-1.19757808518581i)
(num-test (asinh -1.0-2.71828182845905i) -1.73375471569385-1.19757808518581i)
(num-test (asinh 1.0+1234.0i) 7.81116354920146+1.56998595393473i)
(num-test (asinh -1.0+1234.0i) -7.81116354944842+1.56998595393442i)
(num-test (asinh 1.0-1234.0i) 7.81116354920146-1.56998595393473i)
(num-test (asinh -1.0-1234.0i) -7.81116354944842-1.56998595393442i)
(num-test (asinh 1.0+1234000000.0i) 21.62667394298955+1.57079632598452i)
(num-test (asinh 1.0-1234000000.0i) 21.62667394298955-1.57079632598452i)
(num-test (asinh 3.14159265358979+0.0i) 1.86229574331085)
(num-test (asinh -3.14159265358979+0.0i) -1.86229574331085)
(num-test (asinh 3.14159265358979-0.0i) 1.86229574331085)
(num-test (asinh -3.14159265358979-0.0i) -1.86229574331085)
(num-test (asinh 3.14159265358979+0.00000001i) 1.86229574331085+0.00000000303314i)
(num-test (asinh -3.14159265358979+0.00000001i) -1.86229574331085+0.00000000303314i)
(num-test (asinh 3.14159265358979-0.00000001i) 1.86229574331085-0.00000000303314i)
(num-test (asinh -3.14159265358979-0.00000001i) -1.86229574331085-0.00000000303314i)
(num-test (asinh 3.14159265358979+1.0i) 1.90462768697066+0.29558503421163i)
(num-test (asinh -3.14159265358979+1.0i) -1.90462768697066+0.29558503421163i)
(num-test (asinh 3.14159265358979-1.0i) 1.90462768697066-0.29558503421163i)
(num-test (asinh -3.14159265358979-1.0i) -1.90462768697066-0.29558503421163i)
(num-test (asinh 3.14159265358979+3.14159265358979i) 2.18469104082751+0.77273977912748i)
(num-test (asinh -3.14159265358979+3.14159265358979i) -2.18469104082751+0.77273977912748i)
(num-test (asinh 3.14159265358979-3.14159265358979i) 2.18469104082751-0.77273977912748i)
(num-test (asinh -3.14159265358979-3.14159265358979i) -2.18469104082751-0.77273977912748i)
(num-test (asinh 3.14159265358979+2.71828182845905i) 2.11968336368048+0.69904796994655i)
(num-test (asinh -3.14159265358979+2.71828182845905i) -2.11968336368048+0.69904796994656i)
(num-test (asinh 3.14159265358979-2.71828182845905i) 2.11968336368048-0.69904796994655i)
(num-test (asinh -3.14159265358979-2.71828182845905i) -2.11968336368048-0.69904796994656i)
(num-test (asinh 3.14159265358979+1234.0i) 7.81116646154641+1.56825047031367i)
(num-test (asinh -3.14159265358979+1234.0i) -7.81116646138554+1.56825047031506i)
(num-test (asinh 3.14159265358979-1234.0i) 7.81116646154641-1.56825047031367i)
(num-test (asinh -3.14159265358979-1234.0i) -7.81116646138554-1.56825047031506i)
(num-test (asinh 3.14159265358979+1234000000.0i) 21.62667394298955+1.57079632424904i)
(num-test (asinh 3.14159265358979-1234000000.0i) 21.62667394298955-1.57079632424904i)
(num-test (asinh 2.71828182845905+0.0i) 1.72538255885231)
(num-test (asinh -2.71828182845905+0.0i) -1.72538255885232)
(num-test (asinh 2.71828182845905-0.0i) 1.72538255885231)
(num-test (asinh -2.71828182845905-0.0i) -1.72538255885232)
(num-test (asinh 2.71828182845905+0.00000001i) 1.72538255885231+0.00000000345258i)
(num-test (asinh -2.71828182845905+0.00000001i) -1.72538255885232+0.00000000345258i)
(num-test (asinh 2.71828182845905-0.00000001i) 1.72538255885231-0.00000000345258i)
(num-test (asinh -2.71828182845905-0.00000001i) -1.72538255885232-0.00000000345258i)
(num-test (asinh 2.71828182845905+1.0i) 1.77905438385935+0.33444277187637i)
(num-test (asinh -2.71828182845905+1.0i) -1.77905438385935+0.33444277187637i)
(num-test (asinh 2.71828182845905-1.0i) 1.77905438385935-0.33444277187637i)
(num-test (asinh -2.71828182845905-1.0i) -1.77905438385935-0.33444277187637i)
(num-test (asinh 2.71828182845905+3.14159265358979i) 2.11552790803290+0.84309656416035i)
(num-test (asinh -2.71828182845905+3.14159265358979i) -2.11552790803290+0.84309656416035i)
(num-test (asinh 2.71828182845905-3.14159265358979i) 2.11552790803290-0.84309656416035i)
(num-test (asinh -2.71828182845905-3.14159265358979i) -2.11552790803290-0.84309656416035i)
(num-test (asinh 2.71828182845905+2.71828182845905i) 2.04014932880026+0.76849735588475i)
(num-test (asinh -2.71828182845905+2.71828182845905i) -2.04014932880026+0.76849735588475i)
(num-test (asinh 2.71828182845905-2.71828182845905i) 2.04014932880026-0.76849735588475i)
(num-test (asinh -2.71828182845905-2.71828182845905i) -2.04014932880026-0.76849735588475i)
(num-test (asinh 2.71828182845905+1234.0i) 7.81116564705719+1.56859350805562i)
(num-test (asinh -2.71828182845905+1234.0i) -7.81116564738434+1.56859350805543i)
(num-test (asinh 2.71828182845905-1234.0i) 7.81116564705719-1.56859350805562i)
(num-test (asinh -2.71828182845905-1234.0i) -7.81116564738434-1.56859350805543i)
(num-test (asinh 2.71828182845905+1234000000.0i) 21.62667394298955+1.57079632459208i)
(num-test (asinh 2.71828182845905-1234000000.0i) 21.62667394298955-1.57079632459208i)
(num-test (asinh 1234.0+0.0i) 7.81116354920125)
(num-test (asinh -1234.0+0.0i) -7.81116354896171)
(num-test (asinh 1234.0-0.0i) 7.81116354920125)
(num-test (asinh -1234.0-0.0i) -7.81116354896171)
(num-test (asinh 1234.0+0.00000001i) 7.81116354920125+0.00000000000810i)
(num-test (asinh -1234.0+0.00000001i) -7.81116354896171+0.00000000000810i)
(num-test (asinh 1234.0-0.00000001i) 7.81116354920125-0.00000000000810i)
(num-test (asinh -1234.0-0.00000001i) -7.81116354896171-0.00000000000810i)
(num-test (asinh 1234.0+1.0i) 7.81116387755283+0.00081037232800i)
(num-test (asinh -1234.0+1.0i) -7.81116387772663+0.00081037232806i)
(num-test (asinh 1234.0-1.0i) 7.81116387755283-0.00081037232800i)
(num-test (asinh -1234.0-1.0i) -7.81116387772663-0.00081037232806i)
(num-test (asinh 1234.0+3.14159265358979i) 7.81116678989204+0.00254585480937i)
(num-test (asinh -1234.0+3.14159265358979i) -7.81116678966949+0.00254585480900i)
(num-test (asinh 1234.0-3.14159265358979i) 7.81116678989204-0.00254585480937i)
(num-test (asinh -1234.0-3.14159265358979i) -7.81116678966949-0.00254585480900i)
(num-test (asinh 1234.0+2.71828182845905i) 7.81116597540442+0.00220281729269i)
(num-test (asinh -1234.0+2.71828182845905i) -7.81116597510553+0.00220281729236i)
(num-test (asinh 1234.0-2.71828182845905i) 7.81116597540442-0.00220281729269i)
(num-test (asinh -1234.0-2.71828182845905i) -7.81116597510553-0.00220281729236i)
(num-test (asinh 1234.0+1234.0i) 8.15773697530526+0.78539808130944i)
(num-test (asinh -1234.0+1234.0i) -8.15773697538346+0.78539808146835i)
(num-test (asinh 1234.0-1234.0i) 8.15773697530526-0.78539808130944i)
(num-test (asinh -1234.0-1234.0i) -8.15773697538346-0.78539808146835i)
(num-test (asinh 1234.0+1234000000.0i) 21.62667394299005+1.57079532679490i)
(num-test (asinh 1234.0-1234000000.0i) 21.62667394299005-1.57079532679490i)
(num-test (asinh 1234000000.0+0.0i) 21.62667394298955)
(num-test (asinh 1234000000.0-0.0i) 21.62667394298955)
(num-test (asinh 1234000000.0+0.00000001i) 21.62667394298955+0.0i)
(num-test (asinh 1234000000.0-0.00000001i) 21.62667394298955-0.0i)
(num-test (asinh 1234000000.0+1.0i) 21.62667394298955+0.00000000081037i)
(num-test (asinh 1234000000.0-1.0i) 21.62667394298955-0.00000000081037i)
(num-test (asinh 1234000000.0+3.14159265358979i) 21.62667394298955+0.00000000254586i)
(num-test (asinh 1234000000.0-3.14159265358979i) 21.62667394298955-0.00000000254586i)
(num-test (asinh 1234000000.0+2.71828182845905i) 21.62667394298955+0.00000000220282i)
(num-test (asinh 1234000000.0-2.71828182845905i) 21.62667394298955-0.00000000220282i)
(num-test (asinh 1234000000.0+1234.0i) 21.62667394299005+0.00000100000000i)
(num-test (asinh 1234000000.0-1234.0i) 21.62667394299005-0.00000100000000i)
(num-test (asinh 1234000000.0+1234000000.0i) 21.97324753326953+0.78539816339745i)
(num-test (asinh 1234000000.0-1234000000.0i) 21.97324753326953-0.78539816339745i)
(num-test (asinh -1234000000/3) -20.52806165432143) 
(num-test (asinh -500029/2) -13.12242137572639) 
(num-test (asinh 0.00000001+1234000000.0i) +21.62667394298955+1.570796327200083i) 
(num-test (asinh 3.14159265358979+1234000000.0i) +21.62667394298955+1.570796327200083i) 
(num-test (asinh 2.71828182845905+1234000000.0i) +21.62667394298955+1.570796327200083i) 
(num-test (asinh 1234000000.0+0.00000001i) 2.162667394298955253710416065681969812992E1+8.103727714748784607732648425887640725255E-18i)
(num-test (asinh 1234000000.0+2.71828182845905i) 2.162667394298955253953037211122561608564E1+2.202821578978160449522443825215175823101E-9i)
(num-test (asinh 0.0e+00+0.0e+00i) 0e0+0.0i)
(num-test (asinh 0.0e+00+1.19209289550781250e-07i) 0+1.1920928955078153234e-7i)
(num-test (asinh 0.0e+00-1.19209289550781250e-07i) 0-1.1920928955078153234e-7i)
(num-test (asinh 0.0e+00+5.0e-01i) 0+5.2359877559829887308e-1i)
(num-test (asinh 0.0e+00-5.0e-01i) 0-5.2359877559829887308e-1i)
(num-test (asinh 0.0e+00+1.0e+00i) 0+1.5707963267948966192e0i)
(num-test (asinh 0.0e+00-1.0e+00i) 0-1.5707963267948966192e0i)
(num-test (asinh 0.0e+00+2.0e+00i) 1.3169578969248167086e0+1.5707963267948966192e0i)
(num-test (asinh 0.0e+00-2.0e+00i) -1.3169578969248167086e0-1.5707963267948966192e0i)
(num-test (asinh 0.0e+00+8.3886080e+06i) 1.6635532333438683873e1+1.5707963267948966192e0i)
(num-test (asinh 0.0e+00-8.3886080e+06i) -1.6635532333438683873e1-1.5707963267948966192e0i)
(num-test (asinh 1.19209289550781250e-07+0.0e+00i) 1.1920928955078096766e-7+0.0i)
(num-test (asinh -1.19209289550781250e-07+0.0e+00i) -1.1920928955078096766e-7+0.0i)
(num-test (asinh 1.19209289550781250e-07+1.19209289550781250e-07i) 1.1920928955078181469e-7+1.1920928955078068531e-7i)
(num-test (asinh 1.19209289550781250e-07-1.19209289550781250e-07i) 1.1920928955078181469e-7-1.1920928955078068531e-7i)
(num-test (asinh -1.19209289550781250e-07+1.19209289550781250e-07i) -1.1920928955078181469e-7+1.1920928955078068531e-7i)
(num-test (asinh -1.19209289550781250e-07-1.19209289550781250e-07i) -1.1920928955078181469e-7-1.1920928955078068531e-7i)
(num-test (asinh 1.19209289550781250e-07+5.0e-01i) 1.3765103082409432364e-7+5.2359877559829340332e-1i)
(num-test (asinh 1.19209289550781250e-07-5.0e-01i) 1.3765103082409432364e-7-5.2359877559829340332e-1i)
(num-test (asinh -1.19209289550781250e-07+5.0e-01i) -1.3765103082409432364e-7+5.2359877559829340332e-1i)
(num-test (asinh -1.19209289550781250e-07-5.0e-01i) -1.3765103082409432364e-7-5.2359877559829340332e-1i)
(num-test (asinh 1.19209289550781250e-07+1.0e+00i) 3.4526698643116312881e-4+1.5704510598153252947e0i)
(num-test (asinh 1.19209289550781250e-07-1.0e+00i) 3.4526698643116312881e-4-1.5704510598153252947e0i)
(num-test (asinh -1.19209289550781250e-07+1.0e+00i) -3.4526698643116312881e-4+1.5704510598153252947e0i)
(num-test (asinh -1.19209289550781250e-07-1.0e+00i) -3.4526698643116312881e-4-1.5704510598153252947e0i)
(num-test (asinh 1.19209289550781250e-07+2.0e+00i) 1.3169578969248194435e0+1.5707962579693812072e0i)
(num-test (asinh 1.19209289550781250e-07-2.0e+00i) 1.3169578969248194435e0-1.5707962579693812072e0i)
(num-test (asinh -1.19209289550781250e-07+2.0e+00i) -1.3169578969248194435e0+1.5707962579693812072e0i)
(num-test (asinh -1.19209289550781250e-07-2.0e+00i) -1.3169578969248194435e0-1.5707962579693812072e0i)
(num-test (asinh 1.19209289550781250e-07+8.3886080e+06i) 1.6635532333438683873e1+1.5707963267948824084e0i)
(num-test (asinh 1.19209289550781250e-07-8.3886080e+06i) 1.6635532333438683873e1-1.5707963267948824084e0i)
(num-test (asinh -1.19209289550781250e-07+8.3886080e+06i) -1.6635532333438683873e1+1.5707963267948824084e0i)
(num-test (asinh -1.19209289550781250e-07-8.3886080e+06i) -1.6635532333438683873e1-1.5707963267948824084e0i)
(num-test (asinh 5.0e-01+0.0e+00i) 4.8121182505960344750e-1+0.0i)
(num-test (asinh -5.0e-01+0.0e+00i) -4.8121182505960344750e-1+0.0i)
(num-test (asinh 5.0e-01+1.19209289550781250e-07i) 4.8121182505960598961e-1+1.0662402999400097805e-7i)
(num-test (asinh 5.0e-01-1.19209289550781250e-07i) 4.8121182505960598961e-1-1.0662402999400097805e-7i)
(num-test (asinh -5.0e-01+1.19209289550781250e-07i) -4.8121182505960598961e-1+1.0662402999400097805e-7i)
(num-test (asinh -5.0e-01-1.19209289550781250e-07i) -4.8121182505960598961e-1-1.0662402999400097805e-7i)
(num-test (asinh 5.0e-01+5.0e-01i) 5.3063753095251782602e-1+4.5227844715119068206e-1i)
(num-test (asinh 5.0e-01-5.0e-01i) 5.3063753095251782602e-1-4.5227844715119068206e-1i)
(num-test (asinh -5.0e-01+5.0e-01i) -5.3063753095251782602e-1+4.5227844715119068206e-1i)
(num-test (asinh -5.0e-01-5.0e-01i) -5.3063753095251782602e-1-4.5227844715119068206e-1i)
(num-test (asinh 5.0e-01+1.0e+00i) 7.3285767597364526089e-1+8.9590748120889023907e-1i)
(num-test (asinh 5.0e-01-1.0e+00i) 7.3285767597364526089e-1-8.9590748120889023907e-1i)
(num-test (asinh -5.0e-01+1.0e+00i) -7.3285767597364526089e-1+8.9590748120889023907e-1i)
(num-test (asinh -5.0e-01-1.0e+00i) -7.3285767597364526089e-1-8.9590748120889023907e-1i)
(num-test (asinh 5.0e-01+2.0e+00i) 1.3618009008578457882e0+1.2930420702371826591e0i)
(num-test (asinh 5.0e-01-2.0e+00i) 1.3618009008578457882e0-1.2930420702371826591e0i)
(num-test (asinh -5.0e-01+2.0e+00i) -1.3618009008578457882e0+1.2930420702371826591e0i)
(num-test (asinh -5.0e-01-2.0e+00i) -1.3618009008578457882e0-1.2930420702371826591e0i)
(num-test (asinh 5.0e-01+8.3886080e+06i) 1.6635532333438685650e1+1.5707962671902518438e0i)
(num-test (asinh 5.0e-01-8.3886080e+06i) 1.6635532333438685650e1-1.5707962671902518438e0i)
(num-test (asinh -5.0e-01+8.3886080e+06i) -1.6635532333438685650e1+1.5707962671902518438e0i)
(num-test (asinh -5.0e-01-8.3886080e+06i) -1.6635532333438685650e1-1.5707962671902518438e0i)
(num-test (asinh 1.0e+00+0.0e+00i) 8.8137358701954302523e-1+0.0i)
(num-test (asinh -1.0e+00+0.0e+00i) -8.8137358701954302523e-1+0.0i)
(num-test (asinh 1.0e+00+1.19209289550781250e-07i) 8.8137358701954553738e-1+8.4293697021788013662e-8i)
(num-test (asinh 1.0e+00-1.19209289550781250e-07i) 8.8137358701954553738e-1-8.4293697021788013662e-8i)
(num-test (asinh -1.0e+00+1.19209289550781250e-07i) -8.8137358701954553738e-1+8.4293697021788013662e-8i)
(num-test (asinh -1.0e+00-1.19209289550781250e-07i) -8.8137358701954553738e-1-8.4293697021788013662e-8i)
(num-test (asinh 1.0e+00+5.0e-01i) 9.2613303135018242455e-1+3.4943906285721329363e-1i)
(num-test (asinh 1.0e+00-5.0e-01i) 9.2613303135018242455e-1-3.4943906285721329363e-1i)
(num-test (asinh -1.0e+00+5.0e-01i) -9.2613303135018242455e-1+3.4943906285721329363e-1i)
(num-test (asinh -1.0e+00-5.0e-01i) -9.2613303135018242455e-1-3.4943906285721329363e-1i)
(num-test (asinh 1.0e+00+1.0e+00i) 1.0612750619050356520e0+6.6623943249251525510e-1i)
(num-test (asinh 1.0e+00-1.0e+00i) 1.0612750619050356520e0-6.6623943249251525510e-1i)
(num-test (asinh -1.0e+00+1.0e+00i) -1.0612750619050356520e0+6.6623943249251525510e-1i)
(num-test (asinh -1.0e+00-1.0e+00i) -1.0612750619050356520e0-6.6623943249251525510e-1i)
(num-test (asinh 1.0e+00+2.0e+00i) 1.4693517443681852733e0+1.0634400235777520562e0i)
(num-test (asinh 1.0e+00-2.0e+00i) 1.4693517443681852733e0-1.0634400235777520562e0i)
(num-test (asinh -1.0e+00+2.0e+00i) -1.4693517443681852733e0+1.0634400235777520562e0i)
(num-test (asinh -1.0e+00-2.0e+00i) -1.4693517443681852733e0-1.0634400235777520562e0i)
(num-test (asinh 1.0e+00+8.3886080e+06i) 1.6635532333438690979e1+1.5707962075856070684e0i)
(num-test (asinh 1.0e+00-8.3886080e+06i) 1.6635532333438690979e1-1.5707962075856070684e0i)
(num-test (asinh -1.0e+00+8.3886080e+06i) -1.6635532333438690979e1+1.5707962075856070684e0i)
(num-test (asinh -1.0e+00-8.3886080e+06i) -1.6635532333438690979e1-1.5707962075856070684e0i)
(num-test (asinh 2.0e+00+0.0e+00i) 1.4436354751788103425e0+0.0i)
(num-test (asinh -2.0e+00+0.0e+00i) -1.4436354751788103425e0+0.0i)
(num-test (asinh 2.0e+00+1.19209289550781250e-07i) 1.4436354751788116136e0+5.3312014997000413263e-8i)
(num-test (asinh 2.0e+00-1.19209289550781250e-07i) 1.4436354751788116136e0-5.3312014997000413263e-8i)
(num-test (asinh -2.0e+00+1.19209289550781250e-07i) -1.4436354751788116136e0+5.3312014997000413263e-8i)
(num-test (asinh -2.0e+00-1.19209289550781250e-07i) -1.4436354751788116136e0-5.3312014997000413263e-8i)
(num-test (asinh 2.0e+00+5.0e-01i) 1.4657153519472905218e0+2.2101863562288385890e-1i)
(num-test (asinh 2.0e+00-5.0e-01i) 1.4657153519472905218e0-2.2101863562288385890e-1i)
(num-test (asinh -2.0e+00+5.0e-01i) -1.4657153519472905218e0+2.2101863562288385890e-1i)
(num-test (asinh -2.0e+00-5.0e-01i) -1.4657153519472905218e0-2.2101863562288385890e-1i)
(num-test (asinh 2.0e+00+1.0e+00i) 1.5285709194809981613e0+4.2707858639247612548e-1i)
(num-test (asinh 2.0e+00-1.0e+00i) 1.5285709194809981613e0-4.2707858639247612548e-1i)
(num-test (asinh -2.0e+00+1.0e+00i) -1.5285709194809981613e0+4.2707858639247612548e-1i)
(num-test (asinh -2.0e+00-1.0e+00i) -1.5285709194809981613e0-4.2707858639247612548e-1i)
(num-test (asinh 2.0e+00+2.0e+00i) 1.7343245214879664480e0+7.5424914469804604071e-1i)
(num-test (asinh 2.0e+00-2.0e+00i) 1.7343245214879664480e0-7.5424914469804604071e-1i)
(num-test (asinh -2.0e+00+2.0e+00i) -1.7343245214879664480e0+7.5424914469804604071e-1i)
(num-test (asinh -2.0e+00-2.0e+00i) -1.7343245214879664480e0-7.5424914469804604071e-1i)
(num-test (asinh 2.0e+00+8.3886080e+06i) 1.6635532333438712295e1+1.5707960883763175177e0i)
(num-test (asinh 2.0e+00-8.3886080e+06i) 1.6635532333438712295e1-1.5707960883763175177e0i)
(num-test (asinh -2.0e+00+8.3886080e+06i) -1.6635532333438712295e1+1.5707960883763175177e0i)
(num-test (asinh -2.0e+00-8.3886080e+06i) -1.6635532333438712295e1-1.5707960883763175177e0i)
(num-test (asinh 8.3886080e+06+0.0e+00i) 1.6635532333438690979e1+0.0i)
(num-test (asinh -8.3886080e+06+0.0e+00i) -1.6635532333438690979e1+0.0i)
(num-test (asinh 8.3886080e+06+1.19209289550781250e-07i) 1.6635532333438690979e1+1.4210854715201902743e-14i)
(num-test (asinh 8.3886080e+06-1.19209289550781250e-07i) 1.6635532333438690979e1-1.4210854715201902743e-14i)
(num-test (asinh -8.3886080e+06+1.19209289550781250e-07i) -1.6635532333438690979e1+1.4210854715201902743e-14i)
(num-test (asinh -8.3886080e+06-1.19209289550781250e-07i) -1.6635532333438690979e1-1.4210854715201902743e-14i)
(num-test (asinh 8.3886080e+06+5.0e-01i) 1.6635532333438692755e1+5.9604644775390130897e-8i)
(num-test (asinh 8.3886080e+06-5.0e-01i) 1.6635532333438692755e1-5.9604644775390130897e-8i)
(num-test (asinh -8.3886080e+06+5.0e-01i) -1.6635532333438692755e1+5.9604644775390130897e-8i)
(num-test (asinh -8.3886080e+06-5.0e-01i) -1.6635532333438692755e1-5.9604644775390130897e-8i)
(num-test (asinh 8.3886080e+06+1.0e+00i) 1.6635532333438698084e1+1.1920928955077983828e-7i)
(num-test (asinh 8.3886080e+06-1.0e+00i) 1.6635532333438698084e1-1.1920928955077983828e-7i)
(num-test (asinh -8.3886080e+06+1.0e+00i) -1.6635532333438698084e1+1.1920928955077983828e-7i)
(num-test (asinh -8.3886080e+06-1.0e+00i) -1.6635532333438698084e1-1.1920928955077983828e-7i)
(num-test (asinh 8.3886080e+06+2.0e+00i) 1.663553233343871940e1+2.3841857910155628843e-7i)
(num-test (asinh 8.3886080e+06-2.0e+00i) 1.663553233343871940e1-2.3841857910155628843e-7i)
(num-test (asinh -8.3886080e+06+2.0e+00i) -1.663553233343871940e1+2.3841857910155628843e-7i)
(num-test (asinh -8.3886080e+06-2.0e+00i) -1.663553233343871940e1-2.3841857910155628843e-7i)
(num-test (asinh 8.3886080e+06+8.3886080e+06i) 1.6982105923718660081e1+7.8539816339744653326e-1i)
(num-test (asinh 8.3886080e+06-8.3886080e+06i) 1.6982105923718660081e1-7.8539816339744653326e-1i)
(num-test (asinh -8.3886080e+06+8.3886080e+06i) -1.6982105923718660081e1+7.8539816339744653326e-1i)
(num-test (asinh -8.3886080e+06-8.3886080e+06i) -1.6982105923718660081e1-7.8539816339744653326e-1i)
(num-test (asinh -2.225073858507201399999999999999999999996E-308) -2.225073858507201399999999999999999999996E-308)
(num-test (asinh 1.110223024625156799999999999999999999997E-16) 1.11022302462515679999999999999999771924E-16)

(for-each
 (lambda (num-and-val)
   (let ((num (car num-and-val)) (val (cadr num-and-val))) (num-test-1 'asinh num (asinh num) val)))
 (vector (list 0 0) (list 1 0.88137358701954) (list 2 1.4436354751788) (list 3 1.8184464592321) 
	 (list -1 -0.88137358701954) (list -2 -1.4436354751788) (list -3 -1.8184464592321) 
	 (list 9223372036854775807 44.361419555836) (list -9223372036854775808 -44.361419555836) 
	 (list 1/2 0.4812118250596) (list 1/3 0.32745015023726) (list -1/2 -0.4812118250596) 
	 (list -1/3 -0.32745015023726) (list 1/9223372036854775807 1.0842021724855e-19) (list 0.0 0.0) 
	 (list 1.0 0.88137358701954) (list 2.0 1.4436354751788) (list -2.0 -1.4436354751788) 
	 (list 1.000000000000000000000000000000000000002E-309 1.000000000000000000000000000000000000002E-309) 
	 (list 1e+16 37.534508668465) (list 0+1i 0+1.5707963267949i) (list 0+2i 1.3169578969248+1.5707963267949i) 
	 (list 0-1i 0-1.5707963267949i) (list 1+1i 1.061275061905+0.66623943249252i) (list 1-1i 1.061275061905-0.66623943249252i) 
	 (list -1+1i -1.061275061905+0.66623943249252i) (list -1-1i -1.061275061905-0.66623943249252i) 
	 (list 0.1+0.1i 0.10033029811221+0.099663702859795i) (list 1e+16+1e+16i 37.881082258745+0.78539816339745i) 
	 (list 1e-16+1e-16i 0+1e-16i) ))

(test (asinh) 'error)
(test (asinh "hi") 'error)
(test (asinh 1.0+23.0i 1.0+23.0i) 'error)
(test (asinh 0 1) 'error)

(for-each
 (lambda (arg)
   (test (asinh arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))




;;; --------------------------------------------------------------------------------
;;; acosh
;;; --------------------------------------------------------------------------------

(num-test (acosh 0) 0.0+1.57079632679490i)
(num-test (acosh 1) 0.0)
(num-test (acosh -1) 0.0+3.14159265358979i)
(num-test (acosh 2) 1.31695789692482)
(num-test (acosh -2) 1.31695789692482+3.14159265358979i)
(num-test (acosh 3) 1.76274717403909)
(num-test (acosh -3) 1.76274717403909+3.14159265358979i)
(num-test (acosh 10) 2.99322284612638)
(num-test (acosh -10) 2.99322284612638+3.14159265358979i)
(num-test (acosh 1234) 7.81116322084923)
(num-test (acosh -1234) 7.81116322084923+3.14159265358979i)
(num-test (acosh 1234000000) 21.62667394298955)
(num-test (acosh -1234000000) 21.62667394298955+3.14159265358979i)
(num-test (acosh 500029) 13.81556855628134)
(num-test (acosh -500029) 13.81556855628134+3.14159265358979i)
(num-test (acosh 362880) 13.49497466063952)
(num-test (acosh -362880) 13.49497466063952+3.14159265358979i)
(num-test (acosh 0/1) 0.0+1.57079632679490i)
(num-test (acosh 0/2) 0.0+1.57079632679490i)
(num-test (acosh 0/3) 0.0+1.57079632679490i)
(num-test (acosh 0/10) 0.0+1.57079632679490i)
(num-test (acosh 0/1234) 0.0+1.57079632679490i)
(num-test (acosh 0/1234000000) 0.0+1.57079632679490i)
(num-test (acosh 0/500029) 0.0+1.57079632679490i)
(num-test (acosh 0/362880) 0.0+1.57079632679490i)
(num-test (acosh 1/1) 0.0)
(num-test (acosh -1/1) 0.0+3.14159265358979i)
(num-test (acosh 1/2) 0.0+1.04719755119660i)
(num-test (acosh -1/2) 0.0+2.09439510239320i)
(num-test (acosh 1/3) 0.0+1.23095941734077i)
(num-test (acosh -1/3) 0.0+1.91063323624902i)
(num-test (acosh 1/10) 0.0+1.47062890563334i)
(num-test (acosh -1/10) 0.0+1.67096374795646i)
(num-test (acosh 1/1234) 0.0+1.56998595393473i)
(num-test (acosh -1/1234) 0.0+1.57160669965507i)
(num-test (acosh 1/1234000000) 0.0+1.57079632598452i)
(num-test (acosh -1/1234000000) 0.0+1.57079632760527i)
(num-test (acosh 1/500029) 0.0+1.57079432691089i)
(num-test (acosh -1/500029) 0.0+1.57079832667890i)
(num-test (acosh 1/362880) 0.0+1.57079357106297i)
(num-test (acosh -1/362880) 0.0+1.57079908252682i)
(num-test (acosh 2/1) 1.31695789692482)
(num-test (acosh -2/1) 1.31695789692482+3.14159265358979i)
(num-test (acosh 2/2) 0.0)
(num-test (acosh -2/2) 0.0+3.14159265358979i)
(num-test (acosh 2/3) 0.0+0.84106867056793i)
(num-test (acosh -2/3) 0.0+2.30052398302186i)
(num-test (acosh 2/10) 0.0+1.36943840600457i)
(num-test (acosh -2/10) 0.0+1.77215424758523i)
(num-test (acosh 2/1234) 0.0+1.56917558054238i)
(num-test (acosh -2/1234) 0.0+1.57241707304741i)
(num-test (acosh 2/1234000000) 0.0+1.57079632517415i)
(num-test (acosh -2/1234000000) 0.0+1.57079632841564i)
(num-test (acosh 2/500029) 0.0+1.57079232702688i)
(num-test (acosh -2/500029) 0.0+1.57080032656291i)
(num-test (acosh 2/362880) 0.0+1.57079081533105i)
(num-test (acosh -2/362880) 0.0+1.57080183825874i)
(num-test (acosh 3/1) 1.76274717403909)
(num-test (acosh -3/1) 1.76274717403909+3.14159265358979i)
(num-test (acosh 3/2) 0.96242365011921)
(num-test (acosh -3/2) 0.96242365011921+3.14159265358979i)
(num-test (acosh 3/3) 0.0)
(num-test (acosh -3/3) 0.0+3.14159265358979i)
(num-test (acosh 3/10) 0.0+1.26610367277950i)
(num-test (acosh -3/10) 0.0+1.87548898081029i)
(num-test (acosh 3/1234) 0.0+1.56836520608568i)
(num-test (acosh -3/1234) 0.0+1.57322744750412i)
(num-test (acosh 3/1234000000) 0.0+1.57079632436378i)
(num-test (acosh -3/1234000000) 0.0+1.57079632922601i)
(num-test (acosh 3/500029) 0.0+1.57079032714288i)
(num-test (acosh -3/500029) 0.0+1.57080232644692i)
(num-test (acosh 3/362880) 0.0-1.57078805959913i)
(num-test (acosh -3/362880) 0.0-1.57080459399066i)
(num-test (acosh 10/1) 2.99322284612638)
(num-test (acosh -10/1) 2.99322284612638+3.14159265358979i)
(num-test (acosh 10/2) 2.29243166956118)
(num-test (acosh -10/2) 2.29243166956118+3.14159265358979i)
(num-test (acosh 10/3) 1.87382024252741)
(num-test (acosh -10/3) 1.87382024252741+3.14159265358979i)
(num-test (acosh 10/10) 0.0)
(num-test (acosh -10/10) 0.0+3.14159265358979i)
(num-test (acosh 10/1234) 0.0+1.56269251038168i)
(num-test (acosh -10/1234) 0.0+1.57890014320811i)
(num-test (acosh 10/1234000000) 0.0+1.57079631869117i)
(num-test (acosh -10/1234000000) 0.0+1.57079633489862i)
(num-test (acosh 10/500029) 0.0+1.57077632795483i)
(num-test (acosh -10/500029) 0.0+1.57081632563497i)
(num-test (acosh 10/362880) 0.0+1.57076876947567i)
(num-test (acosh -10/362880) 0.0+1.57082388411412i)
(num-test (acosh 1234/1) 7.81116322084923)
(num-test (acosh -1234/1) 7.81116322084923+3.14159265358979i)
(num-test (acosh 1234/2) 7.11801554776066)
(num-test (acosh -1234/2) 7.11801554776066+3.14159265358979i)
(num-test (acosh 1234/3) 6.71254961876983)
(num-test (acosh -1234/3) 6.71254961876983+3.14159265358979i)
(num-test (acosh 1234/10) 5.50856187402619)
(num-test (acosh -1234/10) 5.50856187402619+3.14159265358979i)
(num-test (acosh 1234/1234) 0.0)
(num-test (acosh -1234/1234) 0.0+3.14159265358979i)
(num-test (acosh 1234/1234000000) 0.0+1.57079532679490i)
(num-test (acosh -1234/1234000000) 0.0+1.57079732679490i)
(num-test (acosh 1234/500029) 0.0+1.56832846742558i)
(num-test (acosh -1234/500029) 0.0+1.57326418616421i)
(num-test (acosh 1234/362880) 0.0+1.56739574704864i)
(num-test (acosh -1234/362880) 0.0+1.57419690654115i)
(num-test (acosh 1234000000/1) 21.62667394298955)
(num-test (acosh -1234000000/1) 21.62667394298955+3.14159265358979i)
(num-test (acosh 1234000000/2) 20.93352676242961)
(num-test (acosh -1234000000/2) 20.93352676242961+3.14159265358979i)
(num-test (acosh 1234000000/3) 20.52806165432144)
(num-test (acosh -1234000000/3) 20.52806165432144+3.14159265358979i)
(num-test (acosh 1234000000/10) 19.32408884999551)
(num-test (acosh -1234000000/10) 19.32408884999551+3.14159265358979i)
(num-test (acosh 1234000000/1234) 14.50865773852397)
(num-test (acosh -1234000000/1234) 14.50865773852397+3.14159265358979i)
(num-test (acosh 1234000000/1234000000) 0.0)
(num-test (acosh -1234000000/1234000000) 0.0+3.14159265358979i)
(num-test (acosh 1234000000/500029) 8.50425252621839)
(num-test (acosh -1234000000/500029) 8.50425252621839+3.14159265358979i)
(num-test (acosh 1234000000/362880) 8.82484644128907)
(num-test (acosh -1234000000/362880) 8.82484644128907+3.14159265358979i)
(num-test (acosh 500029/1) 13.81556855628134)
(num-test (acosh -500029/1) 13.81556855628134+3.14159265358979i)
(num-test (acosh 500029/2) 13.12242137571839)
(num-test (acosh -500029/2) 13.12242137571839+3.14159265358979i)
(num-test (acosh 500029/3) 12.71695626760523)
(num-test (acosh -500029/3) 12.71695626760523+3.14159265358979i)
(num-test (acosh 500029/10) 11.51298346318831)
(num-test (acosh -500029/10) 11.51298346318831+3.14159265358979i)
(num-test (acosh 500029/1234) 6.69755082923415)
(num-test (acosh -500029/1234) 6.69755082923415+3.14159265358979i)
(num-test (acosh 500029/1234000000) 0.0+1.57039111689726i)
(num-test (acosh -500029/1234000000) 0.0+1.57120153669253i)
(num-test (acosh 500029/500029) 0.0)
(num-test (acosh -500029/500029) 0.0+3.14159265358979i)
(num-test (acosh 500029/362880) 0.84413377868249)
(num-test (acosh -500029/362880) 0.84413377868249+3.14159265358979i)
(num-test (acosh 362880/1) 13.49497466063952)
(num-test (acosh -362880/1) 13.49497466063952+3.14159265358979i)
(num-test (acosh 362880/2) 12.80182748007388)
(num-test (acosh -362880/2) 12.80182748007388+3.14159265358979i)
(num-test (acosh 362880/3) 12.39636237195622)
(num-test (acosh -362880/3) 12.39636237195622+3.14159265358979i)
(num-test (acosh 362880/10) 11.19238956745752)
(num-test (acosh -362880/10) 11.19238956745752+3.14159265358979i)
(num-test (acosh 362880/1234) 6.37695556518904)
(num-test (acosh -362880/1234) 6.37695556518904+3.14159265358979i)
(num-test (acosh 362880/1234000000) 0.0+1.57050225871935i)
(num-test (acosh -362880/1234000000) 0.0+1.57109039487045i)
(num-test (acosh 362880/500029) 0.0+0.75871902295910i)
(num-test (acosh -362880/500029) 0.0+2.38287363063069i)
(num-test (acosh 362880/362880) 0.0)
(num-test (acosh -362880/362880) 0.0+3.14159265358979i)
(num-test (acosh 0.0) 0.0+1.57079632679490i)
(num-test (acosh 0.00000001) 0.0+1.57079631679490i)
(num-test (acosh -0.00000001) 0.0+1.57079633679490i)
(num-test (acosh 1.0) 0.0)
(num-test (acosh -1.0) 0.0+3.14159265358979i)
(num-test (acosh pi) 1.81152627246085)
(num-test (acosh -3.14159265358979) 1.81152627246085+3.14159265358979i)
(num-test (acosh 2.71828182845905) 1.65745445415308)
(num-test (acosh -2.71828182845905) 1.65745445415308+3.14159265358979i)
(num-test (acosh 1234.0) 7.81116322084923)
(num-test (acosh -1234.0) 7.81116322084923+3.14159265358979i)
(num-test (acosh 1234000000.0) 21.62667394298955)
(num-test (acosh -1234000000.0) 21.62667394298955+3.14159265358979i)
(num-test (acosh 0.0+0.0i) 0.0+1.57079632679490i)
(num-test (acosh -0.0+0.0i) 0.0+1.57079632679490i)
(num-test (acosh 0.0-0.0i) 0.0+1.57079632679490i)
(num-test (acosh -0.0-0.0i) 0.0+1.57079632679490i)
(num-test (acosh 0.0+0.00000001i) 0.00000001+1.57079632679490i)
(num-test (acosh -0.0+0.00000001i) 0.00000001+1.57079632679490i)
(num-test (acosh 0.0-0.00000001i) 0.00000001-1.57079632679490i)
(num-test (acosh -0.0-0.00000001i) 0.00000001-1.57079632679490i)
(num-test (acosh 0.0+1.0i) 0.88137358701954+1.57079632679490i)
(num-test (acosh -0.0+1.0i) 0.88137358701954+1.57079632679490i)
(num-test (acosh 0.0-1.0i) 0.88137358701954-1.57079632679490i)
(num-test (acosh -0.0-1.0i) 0.88137358701954-1.57079632679490i)
(num-test (acosh 0.0+3.14159265358979i) 1.86229574331085+1.57079632679490i)
(num-test (acosh -0.0+3.14159265358979i) 1.86229574331085+1.57079632679490i)
(num-test (acosh 0.0-3.14159265358979i) 1.86229574331085-1.57079632679490i)
(num-test (acosh -0.0-3.14159265358979i) 1.86229574331085-1.57079632679490i)
(num-test (acosh 0.0+2.71828182845905i) 1.72538255885231+1.57079632679490i)
(num-test (acosh -0.0+2.71828182845905i) 1.72538255885231+1.57079632679490i)
(num-test (acosh 0.0-2.71828182845905i) 1.72538255885231-1.57079632679490i)
(num-test (acosh -0.0-2.71828182845905i) 1.72538255885232-1.57079632679490i)
(num-test (acosh 0.0+1234.0i) 7.81116354920125+1.57079632679490i)
(num-test (acosh -0.0+1234.0i) 7.81116354920125+1.57079632679490i)
(num-test (acosh 0.0-1234.0i) 7.81116354920125-1.57079632679490i)
(num-test (acosh -0.0-1234.0i) 7.81116354896171-1.57079632679490i)
(num-test (acosh 0.0+1234000000.0i) 21.62667394298955+1.57079632679490i)
(num-test (acosh -0.0+1234000000.0i) 21.62667394298955+1.57079632679490i)
(num-test (acosh 0.0-1234000000.0i) 21.62667394298955-1.57079632679490i)
(num-test (acosh 0.00000001+0.0i) 0.0+1.57079631679490i)
(num-test (acosh -0.00000001+0.0i) 0.0+1.57079633679490i)
(num-test (acosh 0.00000001-0.0i) 0.0+1.57079631679490i)
(num-test (acosh -0.00000001-0.0i) 0.0+1.57079633679490i)
(num-test (acosh 0.00000001+0.00000001i) 0.00000001+1.57079631679490i)
(num-test (acosh -0.00000001+0.00000001i) 0.00000001+1.57079633679490i)
(num-test (acosh 0.00000001-0.00000001i) 0.00000001-1.57079631679490i)
(num-test (acosh -0.00000001-0.00000001i) 0.00000001-1.57079633679490i)
(num-test (acosh 0.00000001+1.0i) 0.88137358701954+1.57079631972383i)
(num-test (acosh -0.00000001+1.0i) 0.88137358701954+1.57079633386596i)
(num-test (acosh 0.00000001-1.0i) 0.88137358701954-1.57079631972383i)
(num-test (acosh -0.00000001-1.0i) 0.88137358701954-1.57079633386596i)
(num-test (acosh 0.00000001+3.14159265358979i) 1.86229574331085+1.57079632376175i)
(num-test (acosh -0.00000001+3.14159265358979i) 1.86229574331085+1.57079632982804i)
(num-test (acosh 0.00000001-3.14159265358979i) 1.86229574331085-1.57079632376175i)
(num-test (acosh -0.00000001-3.14159265358979i) 1.86229574331085-1.57079632982804i)
(num-test (acosh 0.00000001+2.71828182845905i) 1.72538255885231+1.57079632334232i)
(num-test (acosh -0.00000001+2.71828182845905i) 1.72538255885231+1.57079633024747i)
(num-test (acosh 0.00000001-2.71828182845905i) 1.72538255885231-1.57079632334232i)
(num-test (acosh -0.00000001-2.71828182845905i) 1.72538255885231-1.57079633024747i)
(num-test (acosh 0.00000001+1234.0i) 7.81116354920125+1.57079632678679i)
(num-test (acosh -0.00000001+1234.0i) 7.81116354920125+1.57079632680300i)
(num-test (acosh 0.00000001-1234.0i) 7.81116354920125-1.57079632678679i)
(num-test (acosh -0.00000001-1234.0i) 7.81116354920125-1.57079632680300i)
(num-test (acosh 0.00000001+1234000000.0i) 21.62667394298955+1.57079632679490i)
(num-test (acosh -0.00000001+1234000000.0i) 21.62667394298955+1.57079632679490i)
(num-test (acosh 0.00000001-1234000000.0i) 21.62667394298955-1.57079632679490i)
(num-test (acosh -0.00000001-1234000000.0i) 21.62667394298955-1.57079632679490i)
(num-test (acosh 1.0+0.0i) 0.0)
(num-test (acosh -1.0+0.0i) 0.0+3.14159265358979i)
(num-test (acosh 1.0-0.0i) 0.0)
(num-test (acosh -1.0-0.0i) 0.0+3.14159265358979i)
(num-test (acosh 1.0+0.00000001i) 0.00010000000008+0.00009999999992i)
(num-test (acosh -1.0+0.00000001i) 0.00010000000008+3.14149265358988i)
(num-test (acosh 1.0-0.00000001i) 0.00010000000008-0.00009999999992i)
(num-test (acosh -1.0-0.00000001i) 0.00010000000008-3.14149265358988i)
(num-test (acosh 1.0+1.0i) 1.06127506190504+0.90455689430238i)
(num-test (acosh -1.0+1.0i) 1.06127506190504+2.23703575928741i)
(num-test (acosh 1.0-1.0i) 1.06127506190504-0.90455689430238i)
(num-test (acosh -1.0-1.0i) 1.06127506190504-2.23703575928741i)
(num-test (acosh 1.0+3.14159265358979i) 1.90462768697066+1.27521129258327i)
(num-test (acosh -1.0+3.14159265358979i) 1.90462768697066+1.86638136100653i)
(num-test (acosh 1.0-3.14159265358979i) 1.90462768697066-1.27521129258327i)
(num-test (acosh -1.0-3.14159265358979i) 1.90462768697066-1.86638136100653i)
(num-test (acosh 1.0+2.71828182845905i) 1.77905438385935+1.23635355491853i)
(num-test (acosh -1.0+2.71828182845905i) 1.77905438385935+1.90523909867127i)
(num-test (acosh 1.0-2.71828182845905i) 1.77905438385935-1.23635355491853i)
(num-test (acosh -1.0-2.71828182845905i) 1.77905438385935-1.90523909867127i)
(num-test (acosh 1.0+1234.0i) 7.81116387755283+1.56998595446690i)
(num-test (acosh -1.0+1234.0i) 7.81116387755283+1.57160669912289i)
(num-test (acosh 1.0-1234.0i) 7.81116387755283-1.56998595446690i)
(num-test (acosh -1.0-1234.0i) 7.81116387755283-1.57160669912289i)
(num-test (acosh 1.0+1234000000.0i) 21.62667394298955+1.57079632598452i)
(num-test (acosh -1.0+1234000000.0i) 21.62667394298955+1.57079632760527i)
(num-test (acosh 1.0-1234000000.0i) 21.62667394298955-1.57079632598452i)
(num-test (acosh -1.0-1234000000.0i) 21.62667394298955-1.57079632760527i)
(num-test (acosh 3.14159265358979+0.0i) 1.81152627246085)
(num-test (acosh -3.14159265358979+0.0i) 1.81152627246085+3.14159265358979i)
(num-test (acosh 3.14159265358979-0.0i) 1.81152627246085)
(num-test (acosh -3.14159265358979-0.0i) 1.81152627246085+3.14159265358979i)
(num-test (acosh 3.14159265358979+0.00000001i) 1.81152627246085+0.00000000335775i)
(num-test (acosh -3.14159265358979+0.00000001i) 1.81152627246085+3.14159265023205i)
(num-test (acosh 3.14159265358979-0.00000001i) 1.81152627246085-0.00000000335775i)
(num-test (acosh -3.14159265358979-0.00000001i) 1.81152627246085-3.14159265023205i)
(num-test (acosh 3.14159265358979+1.0i) 1.86711439316026+0.32225329398146i)
(num-test (acosh -3.14159265358979+1.0i) 1.86711439316026+2.81933935960833i)
(num-test (acosh 3.14159265358979-1.0i) 1.86711439316026-0.32225329398146i)
(num-test (acosh -3.14159265358979-1.0i) 1.86711439316026-2.81933935960833i)
(num-test (acosh 3.14159265358979+3.14159265358979i) 2.18469104082751+0.79805654766741i)
(num-test (acosh -3.14159265358979+3.14159265358979i) 2.18469104082751+2.34353610592238i)
(num-test (acosh 3.14159265358979-3.14159265358979i) 2.18469104082751-0.79805654766741i)
(num-test (acosh -3.14159265358979-3.14159265358979i) 2.18469104082751-2.34353610592238i)
(num-test (acosh 3.14159265358979+2.71828182845905i) 2.11552790803290+0.72769976263454i)
(num-test (acosh -3.14159265358979+2.71828182845905i) 2.11552790803290+2.41389289095525i)
(num-test (acosh 3.14159265358979-2.71828182845905i) 2.11552790803290-0.72769976263454i)
(num-test (acosh -3.14159265358979-2.71828182845905i) 2.11552790803290-2.41389289095525i)
(num-test (acosh 3.14159265358979+1234.0i) 7.81116678989204+1.56825047198552i)
(num-test (acosh -3.14159265358979+1234.0i) 7.81116678989204+1.57334218160427i)
(num-test (acosh 3.14159265358979-1234.0i) 7.81116678989204-1.56825047198552i)
(num-test (acosh -3.14159265358979-1234.0i) 7.81116678989204-1.57334218160427i)
(num-test (acosh 3.14159265358979+1234000000.0i) 21.62667394298955+1.57079632424904i)
(num-test (acosh -3.14159265358979+1234000000.0i) 21.62667394298955+1.57079632934076i)
(num-test (acosh 3.14159265358979-1234000000.0i) 21.62667394298955-1.57079632424904i)
(num-test (acosh -3.14159265358979-1234000000.0i) 21.62667394298955-1.57079632934076i)
(num-test (acosh 2.71828182845905+0.0i) 1.65745445415308)
(num-test (acosh -2.71828182845905+0.0i) 1.65745445415308+3.14159265358979i)
(num-test (acosh 2.71828182845905-0.0i) 1.65745445415308)
(num-test (acosh -2.71828182845905-0.0i) 1.65745445415308+3.14159265358979i)
(num-test (acosh 2.71828182845905+0.00000001i) 1.65745445415308+0.00000000395623i)
(num-test (acosh -2.71828182845905+0.00000001i) 1.65745445415308+3.14159264963356i)
(num-test (acosh 2.71828182845905-0.00000001i) 1.65745445415308-0.00000000395623i)
(num-test (acosh -2.71828182845905-0.00000001i) 1.65745445415308-3.14159264963356i)
(num-test (acosh 2.71828182845905+1.0i) 1.73375471569385+0.37321824160908i)
(num-test (acosh -2.71828182845905+1.0i) 1.73375471569385+2.76837441198071i)
(num-test (acosh 2.71828182845905-1.0i) 1.73375471569385-0.37321824160908i)
(num-test (acosh -2.71828182845905-1.0i) 1.73375471569385-2.76837441198071i)
(num-test (acosh 2.71828182845905+3.14159265358979i) 2.11968336368048+0.87174835684834i)
(num-test (acosh -2.71828182845905+3.14159265358979i) 2.11968336368048+2.26984429674145i)
(num-test (acosh 2.71828182845905-3.14159265358979i) 2.11968336368048-0.87174835684834i)
(num-test (acosh -2.71828182845905-3.14159265358979i) 2.11968336368048-2.26984429674145i)
(num-test (acosh 2.71828182845905+2.71828182845905i) 2.04014932880026+0.80229897091014i)
(num-test (acosh -2.71828182845905+2.71828182845905i) 2.04014932880026+2.33929368267965i)
(num-test (acosh 2.71828182845905-2.71828182845905i) 2.04014932880026-0.80229897091014i)
(num-test (acosh -2.71828182845905-2.71828182845905i) 2.04014932880026-2.33929368267965i)
(num-test (acosh 2.71828182845905+1234.0i) 7.81116597540442+1.56859350950221i)
(num-test (acosh -2.71828182845905+1234.0i) 7.81116597540442+1.57299914408758i)
(num-test (acosh 2.71828182845905-1234.0i) 7.81116597540442-1.56859350950221i)
(num-test (acosh -2.71828182845905-1234.0i) 7.81116597540442-1.57299914408758i)
(num-test (acosh 2.71828182845905+1234000000.0i) 21.62667394298955+1.57079632459208i)
(num-test (acosh -2.71828182845905+1234000000.0i) 21.62667394298955+1.57079632899772i)
(num-test (acosh 2.71828182845905-1234000000.0i) 21.62667394298955-1.57079632459208i)
(num-test (acosh -2.71828182845905-1234000000.0i) 21.62667394298955-1.57079632899772i)
(num-test (acosh 1234.0+0.0i) 7.81116322084923)
(num-test (acosh -1234.0+0.0i) 7.81116322084923+3.14159265358979i)
(num-test (acosh 1234.0-0.0i) 7.81116322084923)
(num-test (acosh -1234.0-0.0i) 7.81116322084923+3.14159265358979i)
(num-test (acosh 1234.0+0.00000001i) 7.81116322084923+0.00000000000810i)
(num-test (acosh -1234.0+0.00000001i) 7.81116322084923+3.14159265358169i)
(num-test (acosh 1234.0-0.00000001i) 7.81116322084923-0.00000000000810i)
(num-test (acosh -1234.0-0.00000001i) 7.81116322084923-3.14159265358169i)
(num-test (acosh 1234.0+1.0i) 7.81116354920146+0.00081037286017i)
(num-test (acosh -1234.0+1.0i) 7.81116354920146+3.14078228072962i)
(num-test (acosh 1234.0-1.0i) 7.81116354920146-0.00081037286017i)
(num-test (acosh -1234.0-1.0i) 7.81116354920146-3.14078228072962i)
(num-test (acosh 1234.0+3.14159265358979i) 7.81116646154641+0.00254585648123i)
(num-test (acosh -1234.0+3.14159265358979i) 7.81116646154641+3.13904679710856i)
(num-test (acosh 1234.0-3.14159265358979i) 7.81116646154641-0.00254585648123i)
(num-test (acosh -1234.0-3.14159265358979i) 7.81116646154641-3.13904679710856i)
(num-test (acosh 1234.0+2.71828182845905i) 7.81116564705719+0.00220281873928i)
(num-test (acosh -1234.0+2.71828182845905i) 7.81116564705719+3.13938983485052i)
(num-test (acosh 1234.0-2.71828182845905i) 7.81116564705719-0.00220281873928i)
(num-test (acosh -1234.0-2.71828182845905i) 7.81116564705719-3.13938983485052i)
(num-test (acosh 1234.0+1234.0i) 8.15773697530526+0.78539824548545i)
(num-test (acosh -1234.0+1234.0i) 8.15773697530526+2.35619440810434i)
(num-test (acosh 1234.0-1234.0i) 8.15773697530526-0.78539824548545i)
(num-test (acosh -1234.0-1234.0i) 8.15773697530526-2.35619440810434i)
(num-test (acosh 1234.0+1234000000.0i) 21.62667394299005+1.57079532679490i)
(num-test (acosh -1234.0+1234000000.0i) 21.62667394299005+1.57079732679490i)
(num-test (acosh 1234.0-1234000000.0i) 21.62667394299005-1.57079532679490i)
(num-test (acosh -1234.0-1234000000.0i) 21.62667394299005-1.57079732679490i)
(num-test (acosh 1234000000.0+0.0i) 21.62667394298955)
(num-test (acosh -1234000000.0+0.0i) 21.62667394298955+3.14159265358979i)
(num-test (acosh 1234000000.0-0.0i) 21.62667394298955)
(num-test (acosh -1234000000.0-0.0i) 21.62667394298955+3.14159265358979i)
(num-test (acosh 1234000000.0+0.00000001i) 21.62667394298955+0.0i)
(num-test (acosh -1234000000.0+0.00000001i) 21.62667394298955+3.14159265358979i)
(num-test (acosh 1234000000.0-0.00000001i) 21.62667394298955-0.0i)
(num-test (acosh -1234000000.0-0.00000001i) 21.62667394298955-3.14159265358979i)
(num-test (acosh 1234000000.0+1.0i) 21.62667394298955+0.00000000081037i)
(num-test (acosh -1234000000.0+1.0i) 21.62667394298955+3.14159265277942i)
(num-test (acosh 1234000000.0-1.0i) 21.62667394298955-0.00000000081037i)
(num-test (acosh -1234000000.0-1.0i) 21.62667394298955-3.14159265277942i)
(num-test (acosh 1234000000.0+3.14159265358979i) 21.62667394298955+0.00000000254586i)
(num-test (acosh -1234000000.0+3.14159265358979i) 21.62667394298955+3.14159265104393i)
(num-test (acosh 1234000000.0-3.14159265358979i) 21.62667394298955-0.00000000254586i)
(num-test (acosh -1234000000.0-3.14159265358979i) 21.62667394298955-3.14159265104393i)
(num-test (acosh 1234000000.0+2.71828182845905i) 21.62667394298955+0.00000000220282i)
(num-test (acosh -1234000000.0+2.71828182845905i) 21.62667394298955+3.14159265138697i)
(num-test (acosh 1234000000.0-2.71828182845905i) 21.62667394298955-0.00000000220282i)
(num-test (acosh -1234000000.0-2.71828182845905i) 21.62667394298955-3.14159265138697i)
(num-test (acosh 1234000000.0+1234.0i) 21.62667394299005+0.00000100000000i)
(num-test (acosh -1234000000.0+1234.0i) 21.62667394299005+3.14159165358979i)
(num-test (acosh 1234000000.0-1234.0i) 21.62667394299005-0.00000100000000i)
(num-test (acosh -1234000000.0-1234.0i) 21.62667394299005-3.14159165358979i)
(num-test (acosh 1234000000.0+1234000000.0i) 21.97324753326953+0.78539816339745i)
(num-test (acosh -1234000000.0+1234000000.0i) 21.97324753326953+2.35619449019234i)
(num-test (acosh 1234000000.0-1234000000.0i) 21.97324753326953-0.78539816339745i)
(num-test (acosh -1234000000.0-1234000000.0i) 21.97324753326953-2.35619449019234i)
(num-test (acosh 0) 0+1.570796326794897i)
(num-test (acosh 1) 0)
(num-test (acosh -1) 0+3.141592653589793i)
(num-test (acosh -1.0e+01) 2.9932228461263808979e0+3.1415926535897932385e0i)
(num-test (acosh -2.0e+00) 1.3169578969248167086e0+3.1415926535897932385e0i)
(num-test (acosh -1.0e+00) 0+3.1415926535897932385e0i)
(num-test (acosh -7.50e-01) 0+2.4188584057763776273e0i)
(num-test (acosh -5.0e-01) 0+2.0943951023931954923e0i)
(num-test (acosh -1.250e-01) 0+1.6961241579629620161e0i)
(num-test (acosh -3.45266983001243932001e-04) 0+1.5711415937847577022e0i)
(num-test (acosh -1.19209289550781250e-07) 0+1.570796446004186170e0i)
(num-test (acosh 0.0e+00) 0+1.5707963267948966192e0i)
(num-test (acosh 1.19209289550781250e-07) 0+1.5707962075856070684e0i)
(num-test (acosh 3.45266983001243932001e-04) 0+1.5704510598050355363e0i)
(num-test (acosh 1.250e-01) 0+1.4454684956268312224e0i)
(num-test (acosh 5.0e-01) 0+1.0471975511965977462e0i)
(num-test (acosh 7.50e-01) 0+7.2273424781341561118e-1i)
(num-test (acosh 1.0e+00) 0e0+0.0i)
(num-test (acosh 2.0e+00) 1.3169578969248167086e0+0.0i)
(num-test (acosh 1.0e+01) 2.9932228461263808979e0+0.0i)
(num-test (acosh 0.0e+00+0.0e+00i) 0+1.5707963267948966192e0i)
(num-test (acosh 0.0e+00+1.19209289550781250e-07i) 1.1920928955078096766e-7+1.5707963267948966192e0i)
(num-test (acosh 0.0e+00-1.19209289550781250e-07i) 1.1920928955078096766e-7-1.5707963267948966192e0i)
(num-test (acosh 0.0e+00+5.0e-01i) 4.8121182505960344750e-1+1.5707963267948966192e0i)
(num-test (acosh 0.0e+00-5.0e-01i) 4.8121182505960344750e-1-1.5707963267948966192e0i)
(num-test (acosh 0.0e+00+1.0e+00i) 8.8137358701954302523e-1+1.5707963267948966192e0i)
(num-test (acosh 0.0e+00-1.0e+00i) 8.8137358701954302523e-1-1.5707963267948966192e0i)
(num-test (acosh 0.0e+00+2.0e+00i) 1.4436354751788103425e0+1.5707963267948966192e0i)
(num-test (acosh 0.0e+00-2.0e+00i) 1.4436354751788103425e0-1.5707963267948966192e0i)
(num-test (acosh 0.0e+00+8.3886080e+06i) 1.6635532333438690979e1+1.5707963267948966192e0i)
(num-test (acosh 0.0e+00-8.3886080e+06i) 1.6635532333438690979e1-1.5707963267948966192e0i)
(num-test (acosh 1.19209289550781250e-07+0.0e+00i) 0+1.5707962075856070684e0i)
(num-test (acosh -1.19209289550781250e-07+0.0e+00i) 0+1.570796446004186170e0i)
(num-test (acosh 1.19209289550781250e-07+1.19209289550781250e-07i) 1.1920928955078181469e-7+1.5707962075856070685e0i)
(num-test (acosh 1.19209289550781250e-07-1.19209289550781250e-07i) 1.1920928955078181469e-7-1.5707962075856070685e0i)
(num-test (acosh -1.19209289550781250e-07+1.19209289550781250e-07i) 1.1920928955078181469e-7+1.570796446004186170e0i)
(num-test (acosh -1.19209289550781250e-07-1.19209289550781250e-07i) 1.1920928955078181469e-7-1.570796446004186170e0i)
(num-test (acosh 1.19209289550781250e-07+5.0e-01i) 4.8121182505960598961e-1+1.5707962201708666252e0i)
(num-test (acosh 1.19209289550781250e-07-5.0e-01i) 4.8121182505960598961e-1-1.5707962201708666252e0i)
(num-test (acosh -1.19209289550781250e-07+5.0e-01i) 4.8121182505960598961e-1+1.5707964334189266132e0i)
(num-test (acosh -1.19209289550781250e-07-5.0e-01i) 4.8121182505960598961e-1-1.5707964334189266132e0i)
(num-test (acosh 1.19209289550781250e-07+1.0e+00i) 8.8137358701954553738e-1+1.5707962425011995974e0i)
(num-test (acosh 1.19209289550781250e-07-1.0e+00i) 8.8137358701954553738e-1-1.5707962425011995974e0i)
(num-test (acosh -1.19209289550781250e-07+1.0e+00i) 8.8137358701954553738e-1+1.5707964110885936410e0i)
(num-test (acosh -1.19209289550781250e-07-1.0e+00i) 8.8137358701954553738e-1-1.5707964110885936410e0i)
(num-test (acosh 1.19209289550781250e-07+2.0e+00i) 1.4436354751788116136e0+1.5707962734828816222e0i)
(num-test (acosh 1.19209289550781250e-07-2.0e+00i) 1.4436354751788116136e0-1.5707962734828816222e0i)
(num-test (acosh -1.19209289550781250e-07+2.0e+00i) 1.4436354751788116136e0+1.5707963801069116162e0i)
(num-test (acosh -1.19209289550781250e-07-2.0e+00i) 1.4436354751788116136e0-1.5707963801069116162e0i)
(num-test (acosh 1.19209289550781250e-07+8.3886080e+06i) 1.6635532333438690979e1+1.5707963267948824084e0i)
(num-test (acosh 1.19209289550781250e-07-8.3886080e+06i) 1.6635532333438690979e1-1.5707963267948824084e0i)
(num-test (acosh -1.19209289550781250e-07+8.3886080e+06i) 1.6635532333438690979e1+1.5707963267949108301e0i)
(num-test (acosh -1.19209289550781250e-07-8.3886080e+06i) 1.6635532333438690979e1-1.5707963267949108301e0i)
(num-test (acosh 5.0e-01+0.0e+00i) 0+1.0471975511965977462e0i)
(num-test (acosh -5.0e-01+0.0e+00i) 0+2.0943951023931954923e0i)
(num-test (acosh 5.0e-01+1.19209289550781250e-07i) 1.3765103082409432364e-7+1.0471975511966032159e0i)
(num-test (acosh 5.0e-01-1.19209289550781250e-07i) 1.3765103082409432364e-7-1.0471975511966032159e0i)
(num-test (acosh -5.0e-01+1.19209289550781250e-07i) 1.3765103082409432364e-7+2.0943951023931900225e0i)
(num-test (acosh -5.0e-01-1.19209289550781250e-07i) 1.3765103082409432364e-7-2.0943951023931900225e0i)
(num-test (acosh 5.0e-01+5.0e-01i) 5.3063753095251782602e-1+1.1185178796437059372e0i)
(num-test (acosh 5.0e-01-5.0e-01i) 5.3063753095251782602e-1-1.1185178796437059372e0i)
(num-test (acosh -5.0e-01+5.0e-01i) 5.3063753095251782602e-1+2.0230747739460873013e0i)
(num-test (acosh -5.0e-01-5.0e-01i) 5.3063753095251782602e-1-2.0230747739460873013e0i)
(num-test (acosh 5.0e-01+1.0e+00i) 9.2613303135018242455e-1+1.2213572639376833256e0i)
(num-test (acosh 5.0e-01-1.0e+00i) 9.2613303135018242455e-1-1.2213572639376833256e0i)
(num-test (acosh -5.0e-01+1.0e+00i) 9.2613303135018242455e-1+1.9202353896521099129e0i)
(num-test (acosh -5.0e-01-1.0e+00i) 9.2613303135018242455e-1-1.9202353896521099129e0i)
(num-test (acosh 5.0e-01+2.0e+00i) 1.4657153519472905218e0+1.3497776911720127603e0i)
(num-test (acosh 5.0e-01-2.0e+00i) 1.4657153519472905218e0-1.3497776911720127603e0i)
(num-test (acosh -5.0e-01+2.0e+00i) 1.4657153519472905218e0+1.7918149624177804781e0i)
(num-test (acosh -5.0e-01-2.0e+00i) 1.4657153519472905218e0-1.7918149624177804781e0i)
(num-test (acosh 5.0e-01+8.3886080e+06i) 1.6635532333438692755e1+1.5707962671902518438e0i)
(num-test (acosh 5.0e-01-8.3886080e+06i) 1.6635532333438692755e1-1.5707962671902518438e0i)
(num-test (acosh -5.0e-01+8.3886080e+06i) 1.6635532333438692755e1+1.5707963863995413946e0i)
(num-test (acosh -5.0e-01-8.3886080e+06i) 1.6635532333438692755e1-1.5707963863995413946e0i)
(num-test (acosh 1.0e+00+0.0e+00i) 0e0+0.0i)
(num-test (acosh -1.0e+00+0.0e+00i) 0+3.1415926535897932385e0i)
(num-test (acosh 1.0e+00+1.19209289550781250e-07i) 3.4526698643116312881e-4+3.4526697957132450399e-4i)
(num-test (acosh 1.0e+00-1.19209289550781250e-07i) 3.4526698643116312881e-4-3.4526697957132450399e-4i)
(num-test (acosh -1.0e+00+1.19209289550781250e-07i) 3.4526698643116312881e-4+3.1412473866102219140e0i)
(num-test (acosh -1.0e+00-1.19209289550781250e-07i) 3.4526698643116312881e-4-3.1412473866102219140e0i)
(num-test (acosh 1.0e+00+5.0e-01i) 7.3285767597364526089e-1+6.7488884558600638016e-1i)
(num-test (acosh 1.0e+00-5.0e-01i) 7.3285767597364526089e-1-6.7488884558600638016e-1i)
(num-test (acosh -1.0e+00+5.0e-01i) 7.3285767597364526089e-1+2.4667038080037868583e0i)
(num-test (acosh -1.0e+00-5.0e-01i) 7.3285767597364526089e-1-2.4667038080037868583e0i)
(num-test (acosh 1.0e+00+1.0e+00i) 1.0612750619050356520e0+9.0455689430238136413e-1i)
(num-test (acosh 1.0e+00-1.0e+00i) 1.0612750619050356520e0-9.0455689430238136413e-1i)
(num-test (acosh -1.0e+00+1.0e+00i) 1.0612750619050356520e0+2.2370357592874118743e0i)
(num-test (acosh -1.0e+00-1.0e+00i) 1.0612750619050356520e0-2.2370357592874118743e0i)
(num-test (acosh 1.0e+00+2.0e+00i) 1.5285709194809981613e0+1.1437177404024204938e0i)
(num-test (acosh 1.0e+00-2.0e+00i) 1.5285709194809981613e0-1.1437177404024204938e0i)
(num-test (acosh -1.0e+00+2.0e+00i) 1.5285709194809981613e0+1.9978749131873727447e0i)
(num-test (acosh -1.0e+00-2.0e+00i) 1.5285709194809981613e0-1.9978749131873727447e0i)
(num-test (acosh 1.0e+00+8.3886080e+06i) 1.6635532333438698084e1+1.5707962075856070685e0i)
(num-test (acosh 1.0e+00-8.3886080e+06i) 1.6635532333438698084e1-1.5707962075856070685e0i)
(num-test (acosh -1.0e+00+8.3886080e+06i) 1.6635532333438698084e1+1.570796446004186170e0i)
(num-test (acosh -1.0e+00-8.3886080e+06i) 1.6635532333438698084e1-1.570796446004186170e0i)
(num-test (acosh 2.0e+00+0.0e+00i) 1.3169578969248167086e0+0.0i)
(num-test (acosh -2.0e+00+0.0e+00i) 1.3169578969248167086e0+3.1415926535897932385e0i)
(num-test (acosh 2.0e+00+1.19209289550781250e-07i) 1.3169578969248194435e0+6.8825515412047433504e-8i)
(num-test (acosh 2.0e+00-1.19209289550781250e-07i) 1.3169578969248194435e0-6.8825515412047433504e-8i)
(num-test (acosh -2.0e+00+1.19209289550781250e-07i) 1.3169578969248194435e0+3.1415925847642778264e0i)
(num-test (acosh -2.0e+00-1.19209289550781250e-07i) 1.3169578969248194435e0-3.1415925847642778264e0i)
(num-test (acosh 2.0e+00+5.0e-01i) 1.3618009008578457882e0+2.7775425655771396018e-1i)
(num-test (acosh 2.0e+00-5.0e-01i) 1.3618009008578457882e0-2.7775425655771396018e-1i)
(num-test (acosh -2.0e+00+5.0e-01i) 1.3618009008578457882e0+2.8638383970320792783e0i)
(num-test (acosh -2.0e+00-5.0e-01i) 1.3618009008578457882e0-2.8638383970320792783e0i)
(num-test (acosh 2.0e+00+1.0e+00i) 1.4693517443681852733e0+5.0735630321714456304e-1i)
(num-test (acosh 2.0e+00-1.0e+00i) 1.4693517443681852733e0-5.0735630321714456304e-1i)
(num-test (acosh -2.0e+00+1.0e+00i) 1.4693517443681852733e0+2.6342363503726486754e0i)
(num-test (acosh -2.0e+00-1.0e+00i) 1.4693517443681852733e0-2.6342363503726486754e0i)
(num-test (acosh 2.0e+00+2.0e+00i) 1.7343245214879664480e0+8.1654718209685057852e-1i)
(num-test (acosh 2.0e+00-2.0e+00i) 1.7343245214879664480e0-8.1654718209685057852e-1i)
(num-test (acosh -2.0e+00+2.0e+00i) 1.7343245214879664480e0+2.3250454714929426599e0i)
(num-test (acosh -2.0e+00-2.0e+00i) 1.7343245214879664480e0-2.3250454714929426599e0i)
(num-test (acosh 2.0e+00+8.3886080e+06i) 1.663553233343871940e1+1.5707960883763175177e0i)
(num-test (acosh 2.0e+00-8.3886080e+06i) 1.663553233343871940e1-1.5707960883763175177e0i)
(num-test (acosh -2.0e+00+8.3886080e+06i) 1.663553233343871940e1+1.5707965652134757208e0i)
(num-test (acosh -2.0e+00-8.3886080e+06i) 1.663553233343871940e1-1.5707965652134757208e0i)
(num-test (acosh 8.3886080e+06+0.0e+00i) 1.6635532333438683873e1+0.0i)
(num-test (acosh -8.3886080e+06+0.0e+00i) 1.6635532333438683873e1+3.1415926535897932385e0i)
(num-test (acosh 8.3886080e+06+1.19209289550781250e-07i) 1.6635532333438683873e1+1.4210854715202104692e-14i)
(num-test (acosh 8.3886080e+06-1.19209289550781250e-07i) 1.6635532333438683873e1-1.4210854715202104692e-14i)
(num-test (acosh -8.3886080e+06+1.19209289550781250e-07i) 1.6635532333438683873e1+3.1415926535897790276e0i)
(num-test (acosh -8.3886080e+06-1.19209289550781250e-07i) 1.6635532333438683873e1-3.1415926535897790276e0i)
(num-test (acosh 8.3886080e+06+5.0e-01i) 1.6635532333438685650e1+5.9604644775390977930e-8i)
(num-test (acosh 8.3886080e+06-5.0e-01i) 1.6635532333438685650e1-5.9604644775390977930e-8i)
(num-test (acosh -8.3886080e+06+5.0e-01i) 1.6635532333438685650e1+3.1415925939851484631e0i)
(num-test (acosh -8.3886080e+06-5.0e-01i) 1.6635532333438685650e1-3.1415925939851484631e0i)
(num-test (acosh 8.3886080e+06+1.0e+00i) 1.6635532333438690979e1+1.1920928955078153234e-7i)
(num-test (acosh 8.3886080e+06-1.0e+00i) 1.6635532333438690979e1-1.1920928955078153234e-7i)
(num-test (acosh -8.3886080e+06+1.0e+00i) 1.6635532333438690979e1+3.1415925343805036877e0i)
(num-test (acosh -8.3886080e+06-1.0e+00i) 1.6635532333438690979e1-3.1415925343805036877e0i)
(num-test (acosh 8.3886080e+06+2.0e+00i) 1.6635532333438712295e1+2.3841857910155967656e-7i)
(num-test (acosh 8.3886080e+06-2.0e+00i) 1.6635532333438712295e1-2.3841857910155967656e-7i)
(num-test (acosh -8.3886080e+06+2.0e+00i) 1.6635532333438712295e1+3.1415924151712141369e0i)
(num-test (acosh -8.3886080e+06-2.0e+00i) 1.6635532333438712295e1-3.1415924151712141369e0i)
(num-test (acosh 8.3886080e+06+8.3886080e+06i) 1.6982105923718660081e1+7.8539816339745008597e-1i)
(num-test (acosh 8.3886080e+06-8.3886080e+06i) 1.6982105923718660081e1-7.8539816339745008597e-1i)
(num-test (acosh -8.3886080e+06+8.3886080e+06i) 1.6982105923718660081e1+2.3561944901923431525e0i)
(num-test (acosh -8.3886080e+06-8.3886080e+06i) 1.6982105923718660081e1-2.3561944901923431525e0i)
(num-test (acosh -2.225073858507201399999999999999999999996E-308) 0.0+1.570796326794896619231321691639751442098E0i)
(num-test (acosh 1.110223024625156799999999999999999999997E-16) 0.0+1.570796326794896508209019229124071442098E0i)

(for-each
 (lambda (num-and-val)
   (let ((num (car num-and-val)) (val (cadr num-and-val))) (num-test-1 'acosh num (acosh num) val)))
 (vector (list 0 0+1.5707963267949i) (list 1 0) (list 2 1.3169578969248) (list 3 1.7627471740391) 
	 (list -1 0+3.1415926535898i) (list -2 1.3169578969248+3.1415926535898i) (list -3 1.7627471740391+3.1415926535898i) 
	 (list 9223372036854775807 44.361419555836) (list -9223372036854775808 44.361419555836+3.1415926535898i) 
	 (list 1/2 0+1.0471975511966i) (list 1/3 0+1.2309594173408i) (list -1/2 0+2.0943951023932i) 
	 (list -1/3 0+1.910633236249i) (list 1/9223372036854775807 0+1.5707963267949i) (list 0.0 0+1.5707963267949i) 
	 (list 1.0 0.0) (list 2.0 1.3169578969248) (list -2.0 1.3169578969248+3.1415926535898i) 
	 (list 1.000000000000000000000000000000000000002E-309 0.0+1.570796326794896619231321691639751442098E0i) 
	 (list 1e+16 37.534508668465) (list 0+1i 0.88137358701954+1.5707963267949i) (list 0+2i 1.4436354751788+1.5707963267949i) 
	 (list 0-1i 0.88137358701954-1.5707963267949i) (list 1+1i 1.061275061905+0.90455689430238i) 
	 (list 1-1i 1.061275061905-0.90455689430238i) (list -1+1i 1.061275061905+2.2370357592874i) 
	 (list -1-1i 1.061275061905-2.2370357592874i) (list 0.1+0.1i 0.10033029811221+1.4711326239351i) 
	 (list 1e+16+1e+16i 37.881082258745+0.78539816339745i) (list 1e-16+1e-16i 0+1.5707963267949i) 
	 ))
  
(test (acosh) 'error)
(test (acosh "hi") 'error)
(test (acosh 1.0+23.0i 1.0+23.0i) 'error)
(test (acosh 0 1) 'error)

(for-each
 (lambda (arg)
   (test (acosh arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))




;;; --------------------------------------------------------------------------------
;;; atanh
;;; --------------------------------------------------------------------------------

(num-test (atanh 0) 0.0)
(num-test (atanh 2) 0.54930614433405+1.57079632679490i)
(num-test (atanh -2) -0.54930614433405+1.57079632679490i)
(num-test (atanh 3) 0.34657359027997+1.57079632679490i)
(num-test (atanh -3) -0.34657359027997+1.57079632679490i)
(num-test (atanh 10) 0.10033534773108+1.57079632679490i)
(num-test (atanh -10) -0.10033534773108+1.57079632679490i)
(num-test (atanh 1234) 0.00081037294887+1.57079632679490i)
(num-test (atanh -1234) -0.00081037294887+1.57079632679490i)
(num-test (atanh 500029) 0.00000199988401+1.57079632679490i)
(num-test (atanh -500029) -0.00000199988401+1.57079632679490i)
(num-test (atanh 362880) 0.00000275573192+1.57079632679490i)
(num-test (atanh -362880) -0.00000275573192+1.57079632679490i)
(num-test (atanh 0/1) 0.0)
(num-test (atanh 0/2) 0.0)
(num-test (atanh 0/3) 0.0)
(num-test (atanh 0/10) 0.0)
(num-test (atanh 0/1234) 0.0)
(num-test (atanh 0/1234000000) 0.0)
(num-test (atanh 0/500029) 0.0)
(num-test (atanh 0/362880) 0.0)
(num-test (atanh 1/2) 0.54930614433405)
(num-test (atanh -1/2) -0.54930614433405)
(num-test (atanh 1/3) 0.34657359027997)
(num-test (atanh -1/3) -0.34657359027997)
(num-test (atanh 1/10) 0.10033534773108)
(num-test (atanh -1/10) -0.10033534773108)
(num-test (atanh 1/1234) 0.00081037294887)
(num-test (atanh -1/1234) -0.00081037294887)
(num-test (atanh 1/1234000000) 0.00000000081037)
(num-test (atanh -1/1234000000) -0.00000000081037)
(num-test (atanh 1/500029) 0.00000199988401)
(num-test (atanh -1/500029) -0.00000199988401)
(num-test (atanh 1/362880) 0.00000275573192)
(num-test (atanh -1/362880) -0.00000275573192)
(num-test (atanh 2/1) 0.54930614433405+1.57079632679490i)
(num-test (atanh -2/1) -0.54930614433405+1.57079632679490i)
(num-test (atanh 2/3) 0.80471895621705)
(num-test (atanh -2/3) -0.80471895621705)
(num-test (atanh 2/10) 0.20273255405408)
(num-test (atanh -2/10) -0.20273255405408)
(num-test (atanh 2/1234) 0.00162074696209)
(num-test (atanh -2/1234) -0.00162074696209)
(num-test (atanh 2/1234000000) 0.00000000162075)
(num-test (atanh -2/1234000000) -0.00000000162075)
(num-test (atanh 2/500029) 0.00000399976801)
(num-test (atanh -2/500029) -0.00000399976801)
(num-test (atanh 2/362880) 0.00000551146384)
(num-test (atanh -2/362880) -0.00000551146384)
(num-test (atanh 3/1) 0.34657359027997+1.57079632679490i)
(num-test (atanh -3/1) -0.34657359027997+1.57079632679490i)
(num-test (atanh 3/2) 0.80471895621705+1.57079632679490i)
(num-test (atanh -3/2) -0.80471895621705+1.57079632679490i)
(num-test (atanh 3/10) 0.30951960420311)
(num-test (atanh -3/10) -0.30951960420311)
(num-test (atanh 3/1234) 0.00243112310402)
(num-test (atanh -3/1234) -0.00243112310402)
(num-test (atanh 3/1234000000) 0.00000000243112)
(num-test (atanh -3/1234000000) -0.00000000243112)
(num-test (atanh 3/500029) 0.00000599965202)
(num-test (atanh -3/500029) -0.00000599965202)
(num-test (atanh 3/362880) 0.00000826719577)
(num-test (atanh -3/362880) -0.00000826719577)
(num-test (atanh 10/1) 0.10033534773108+1.57079632679490i)
(num-test (atanh -10/1) -0.10033534773108+1.57079632679490i)
(num-test (atanh 10/2) 0.20273255405408+1.57079632679490i)
(num-test (atanh -10/2) -0.20273255405408+1.57079632679490i)
(num-test (atanh 10/3) 0.30951960420311+1.57079632679490i)
(num-test (atanh -10/3) -0.30951960420311+1.57079632679490i)
(num-test (atanh 10/1234) 0.00810390511343)
(num-test (atanh -10/1234) -0.00810390511343)
(num-test (atanh 10/1234000000) 0.00000000810373)
(num-test (atanh -10/1234000000) -0.00000000810373)
(num-test (atanh 10/500029) 0.00001999884007)
(num-test (atanh -10/500029) -0.00001999884007)
(num-test (atanh 10/362880) 0.00002755731923)
(num-test (atanh -10/362880) -0.00002755731923)
(num-test (atanh 1234/1) 0.00081037294887+1.57079632679490i)
(num-test (atanh -1234/1) -0.00081037294887+1.57079632679490i)
(num-test (atanh 1234/2) 0.00162074696209+1.57079632679490i)
(num-test (atanh -1234/2) -0.00162074696209+1.57079632679490i)
(num-test (atanh 1234/3) 0.00243112310402+1.57079632679490i)
(num-test (atanh -1234/3) -0.00243112310402+1.57079632679490i)
(num-test (atanh 1234/10) 0.00810390511343+1.57079632679490i)
(num-test (atanh -1234/10) -0.00810390511343+1.57079632679490i)
(num-test (atanh 1234/1234000000) 0.00000100000000)
(num-test (atanh -1234/1234000000) -0.00000100000000)
(num-test (atanh 1234/500029) 0.00246786187433)
(num-test (atanh -1234/500029) -0.00246786187433)
(num-test (atanh 1234/362880) 0.00340058630029)
(num-test (atanh -1234/362880) -0.00340058630029)
(num-test (atanh 1234000000/1234) 0.00000100000000+1.57079632679490i)
(num-test (atanh -1234000000/1234) -0.00000100000000+1.57079632679490i)
(num-test (atanh 1234000000/500029) 0.00040520990873+1.57079632679490i)
(num-test (atanh -1234000000/500029) -0.00040520990873+1.57079632679490i)
(num-test (atanh 1234000000/362880) 0.00029406807979+1.57079632679490i)
(num-test (atanh -1234000000/362880) -0.00029406807979+1.57079632679490i)
(num-test (atanh 500029/1) 0.00000199988401+1.57079632679490i)
(num-test (atanh -500029/1) -0.00000199988401+1.57079632679490i)
(num-test (atanh 500029/2) 0.00000399976801+1.57079632679490i)
(num-test (atanh -500029/2) -0.00000399976801+1.57079632679490i)
(num-test (atanh 500029/3) 0.00000599965202+1.57079632679490i)
(num-test (atanh -500029/3) -0.00000599965202+1.57079632679490i)
(num-test (atanh 500029/10) 0.00001999884007+1.57079632679490i)
(num-test (atanh -500029/10) -0.00001999884007+1.57079632679490i)
(num-test (atanh 500029/1234) 0.00246786187433+1.57079632679490i)
(num-test (atanh -500029/1234) -0.00246786187433+1.57079632679490i)
(num-test (atanh 500029/1234000000) 0.00040520990873)
(num-test (atanh -500029/1234000000) -0.00040520990873)
(num-test (atanh 500029/362880) 0.91962065666764+1.57079632679490i)
(num-test (atanh -500029/362880) -0.91962065666764+1.57079632679490i)
(num-test (atanh 362880/1) 0.00000275573192+1.57079632679490i)
(num-test (atanh -362880/1) -0.00000275573192+1.57079632679490i)
(num-test (atanh 362880/2) 0.00000551146384+1.57079632679490i)
(num-test (atanh -362880/2) -0.00000551146385+1.57079632679490i)
(num-test (atanh 362880/3) 0.00000826719577+1.57079632679490i)
(num-test (atanh -362880/3) -0.00000826719577+1.57079632679490i)
(num-test (atanh 362880/10) 0.00002755731923+1.57079632679490i)
(num-test (atanh -362880/10) -0.00002755731923+1.57079632679490i)
(num-test (atanh 362880/1234) 0.00340058630029+1.57079632679490i)
(num-test (atanh -362880/1234) -0.00340058630029+1.57079632679490i)
(num-test (atanh 362880/1234000000) 0.00029406807979)
(num-test (atanh -362880/1234000000) -0.00029406807979)
(num-test (atanh 362880/500029) 0.91962065666764)
(num-test (atanh -362880/500029) -0.91962065666764)
(num-test (atanh 0.0) 0.0)
(num-test (atanh 0.00000001) 0.00000001)
(num-test (atanh -0.00000001) -0.00000001)
(num-test (atanh pi) 0.32976531495670+1.57079632679490i)
(num-test (atanh -3.14159265358979) -0.32976531495670+1.57079632679490i)
(num-test (atanh 2.71828182845905) 0.38596841645265+1.57079632679490i)
(num-test (atanh -2.71828182845905) -0.38596841645265+1.57079632679490i)
(num-test (atanh 1234.0) 0.00081037294887+1.57079632679490i)
(num-test (atanh -1234.0) -0.00081037294887+1.57079632679490i)
(num-test (atanh 0.0+0.0i) 0.0)
(num-test (atanh -0.0+0.0i) 0.0)
(num-test (atanh 0.0-0.0i) 0.0)
(num-test (atanh -0.0-0.0i) 0.0)
(num-test (atanh 0.0+0.00000001i) 0.0+0.00000001i)
(num-test (atanh -0.0+0.00000001i) 0.0+0.00000001i)
(num-test (atanh 0.0-0.00000001i) 0.0-0.00000001i)
(num-test (atanh -0.0-0.00000001i) 0.0-0.00000001i)
(num-test (atanh 0.0+1.0i) -0.0+0.78539816339745i)
(num-test (atanh -0.0+1.0i) -0.0+0.78539816339745i)
(num-test (atanh 0.0-1.0i) -0.0-0.78539816339745i)
(num-test (atanh -0.0-1.0i) -0.0-0.78539816339745i)
(num-test (atanh 0.0+3.14159265358979i) -0.0+1.26262725567891i)
(num-test (atanh -0.0+3.14159265358979i) -0.0+1.26262725567891i)
(num-test (atanh 0.0-3.14159265358979i) -0.0-1.26262725567891i)
(num-test (atanh -0.0-3.14159265358979i) -0.0-1.26262725567891i)
(num-test (atanh 0.0+2.71828182845905i) -0.0+1.21828290501728i)
(num-test (atanh -0.0+2.71828182845905i) -0.0+1.21828290501728i)
(num-test (atanh 0.0-2.71828182845905i) -0.0-1.21828290501728i)
(num-test (atanh -0.0-2.71828182845905i) -0.0-1.21828290501728i)
(num-test (atanh 0.0+1234.0i) 0.0+1.56998595420081i)
(num-test (atanh -0.0+1234.0i) 0.0+1.56998595420081i)
(num-test (atanh 0.0-1234.0i) 0.0-1.56998595420081i)
(num-test (atanh -0.0-1234.0i) 0.0-1.56998595420081i)
(num-test (atanh 0.00000001+0.0i) 0.00000001)
(num-test (atanh -0.00000001+0.0i) -0.00000001)
(num-test (atanh 0.00000001-0.0i) 0.00000001)
(num-test (atanh -0.00000001-0.0i) -0.00000001)
(num-test (atanh 0.00000001+0.00000001i) 0.00000001+0.00000001i)
(num-test (atanh -0.00000001+0.00000001i) -0.00000001+0.00000001i)
(num-test (atanh 0.00000001-0.00000001i) 0.00000001-0.00000001i)
(num-test (atanh -0.00000001-0.00000001i) -0.00000001-0.00000001i)
(num-test (atanh 0.00000001+1.0i) 0.00000000500000+0.78539816339745i)
(num-test (atanh -0.00000001+1.0i) -0.00000000500000+0.78539816339745i)
(num-test (atanh 0.00000001-1.0i) 0.00000000500000-0.78539816339745i)
(num-test (atanh -0.00000001-1.0i) -0.00000000500000-0.78539816339745i)
(num-test (atanh 0.00000001+3.14159265358979i) 0.00000000092000+1.26262725567891i)
(num-test (atanh -0.00000001+3.14159265358979i) -0.00000000092000+1.26262725567891i)
(num-test (atanh 0.00000001-3.14159265358979i) 0.00000000092000-1.26262725567891i)
(num-test (atanh -0.00000001-3.14159265358979i) -0.00000000092000-1.26262725567891i)
(num-test (atanh 0.00000001+2.71828182845905i) 0.00000000119203+1.21828290501728i)
(num-test (atanh -0.00000001+2.71828182845905i) -0.00000000119203+1.21828290501728i)
(num-test (atanh 0.00000001-2.71828182845905i) 0.00000000119203-1.21828290501728i)
(num-test (atanh -0.00000001-2.71828182845905i) -0.00000000119203-1.21828290501728i)
(num-test (atanh 0.00000001+1234.0i) 0.00000000000001+1.56998595420081i)
(num-test (atanh -0.00000001+1234.0i) -0.00000000000001+1.56998595420081i)
(num-test (atanh 0.00000001-1234.0i) 0.00000000000001-1.56998595420081i)
(num-test (atanh -0.00000001-1234.0i) -0.00000000000001-1.56998595420081i)
(num-test (atanh 1.0+0.00000001i) 9.55691396225616+0.78539816589745i)
(num-test (atanh -1.0+0.00000001i) -9.55691396225615+0.78539816589745i)
(num-test (atanh 1.0-0.00000001i) 9.55691396225616-0.78539816589745i)
(num-test (atanh -1.0-0.00000001i) -9.55691396225615-0.78539816589745i)
(num-test (atanh 1.0+1.0i) 0.40235947810853+1.01722196789785i)
(num-test (atanh -1.0+1.0i) -0.40235947810853+1.01722196789785i)
(num-test (atanh 1.0-1.0i) 0.40235947810853-1.01722196789785i)
(num-test (atanh -1.0-1.0i) -0.40235947810853-1.01722196789785i)
(num-test (atanh 1.0+3.14159265358979i) 0.08505998507745+1.28734057432439i)
(num-test (atanh -1.0+3.14159265358979i) -0.08505998507745+1.28734057432439i)
(num-test (atanh 1.0-3.14159265358979i) 0.08505998507745-1.28734057432439i)
(num-test (atanh -1.0-3.14159265358979i) -0.08505998507745-1.28734057432439i)
(num-test (atanh 1.0+2.71828182845905i) 0.10816322574795+1.25363416718071i)
(num-test (atanh -1.0+2.71828182845905i) -0.10816322574795+1.25363416718071i)
(num-test (atanh 1.0-2.71828182845905i) 0.10816322574795-1.25363416718071i)
(num-test (atanh -1.0-2.71828182845905i) -0.10816322574795-1.25363416718071i)
(num-test (atanh 1.0+1234.0i) 0.00000065670317+1.56998595473299i)
(num-test (atanh -1.0+1234.0i) -0.00000065670317+1.56998595473299i)
(num-test (atanh 1.0-1234.0i) 0.00000065670317-1.56998595473299i)
(num-test (atanh -1.0-1234.0i) -0.00000065670317-1.56998595473299i)
(num-test (atanh 3.14159265358979+0.0i) 0.32976531495670+1.57079632679490i)
(num-test (atanh -3.14159265358979+0.0i) -0.32976531495670+1.57079632679490i)
(num-test (atanh 3.14159265358979-0.0i) 0.32976531495670+1.57079632679490i)
(num-test (atanh -3.14159265358979-0.0i) -0.32976531495670+1.57079632679490i)
(num-test (atanh 3.14159265358979+0.00000001i) 0.32976531495670+1.57079632566745i)
(num-test (atanh -3.14159265358979+0.00000001i) -0.32976531495670+1.57079632566745i)
(num-test (atanh 3.14159265358979-0.00000001i) 0.32976531495670-1.57079632566745i)
(num-test (atanh -3.14159265358979-0.00000001i) -0.32976531495670-1.57079632566745i)
(num-test (atanh 3.14159265358979+1.0i) 0.29462144034086+1.47082882591946i)
(num-test (atanh -3.14159265358979+1.0i) -0.29462144034086+1.47082882591946i)
(num-test (atanh 3.14159265358979-1.0i) 0.29462144034086-1.47082882591946i)
(num-test (atanh -3.14159265358979-1.0i) -0.29462144034086-1.47082882591946i)
(num-test (atanh 3.14159265358979+3.14159265358979i) 0.15638868878130+1.40903828502376i)
(num-test (atanh -3.14159265358979+3.14159265358979i) -0.15638868878130+1.40903828502376i)
(num-test (atanh 3.14159265358979-3.14159265358979i) 0.15638868878130-1.40903828502376i)
(num-test (atanh -3.14159265358979-3.14159265358979i) -0.15638868878130-1.40903828502376i)
(num-test (atanh 3.14159265358979+2.71828182845905i) 0.17937970703436+1.40945039787275i)
(num-test (atanh -3.14159265358979+2.71828182845905i) -0.17937970703436+1.40945039787275i)
(num-test (atanh 3.14159265358979-2.71828182845905i) 0.17937970703436-1.40945039787275i)
(num-test (atanh -3.14159265358979-2.71828182845905i) -0.17937970703436-1.40945039787275i)
(num-test (atanh 3.14159265358979+1234.0i) 0.00000206308183+1.56998595945313i)
(num-test (atanh -3.14159265358979+1234.0i) -0.00000206308183+1.56998595945313i)
(num-test (atanh 3.14159265358979-1234.0i) 0.00000206308183-1.56998595945313i)
(num-test (atanh -3.14159265358979-1234.0i) -0.00000206308183-1.56998595945313i)
(num-test (atanh 2.71828182845905+0.0i) 0.38596841645265+1.57079632679490i)
(num-test (atanh -2.71828182845905+0.0i) -0.38596841645265+1.57079632679490i)
(num-test (atanh 2.71828182845905-0.0i) 0.38596841645265+1.57079632679490i)
(num-test (atanh -2.71828182845905-0.0i) -0.38596841645265+1.57079632679490i)
(num-test (atanh 2.71828182845905+0.00000001i) 0.38596841645265+1.57079632522972i)
(num-test (atanh -2.71828182845905+0.00000001i) -0.38596841645265+1.57079632522972i)
(num-test (atanh 2.71828182845905-0.00000001i) 0.38596841645265-1.57079632522972i)
(num-test (atanh -2.71828182845905-0.00000001i) -0.38596841645265-1.57079632522972i)
(num-test (atanh 2.71828182845905+1.0i) 0.33050259272341+1.43862796047891i)
(num-test (atanh -2.71828182845905+1.0i) -0.33050259272341+1.43862796047891i)
(num-test (atanh 2.71828182845905-1.0i) 0.33050259272341-1.43862796047891i)
(num-test (atanh -2.71828182845905-1.0i) -0.33050259272341-1.43862796047891i)
(num-test (atanh 2.71828182845905+3.14159265358979i) 0.15352587926173+1.38641010899673i)
(num-test (atanh -2.71828182845905+3.14159265358979i) -0.15352587926173+1.38641010899673i)
(num-test (atanh 2.71828182845905-3.14159265358979i) 0.15352587926173-1.38641010899673i)
(num-test (atanh -2.71828182845905-3.14159265358979i) -0.15352587926173-1.38641010899673i)
(num-test (atanh 2.71828182845905+2.71828182845905i) 0.17963089485802+1.38288382352616i)
(num-test (atanh -2.71828182845905+2.71828182845905i) -0.17963089485802+1.38288382352616i)
(num-test (atanh 2.71828182845905-2.71828182845905i) 0.17963089485802-1.38288382352616i)
(num-test (atanh -2.71828182845905-2.71828182845905i) -0.17963089485802-1.38288382352616i)
(num-test (atanh 2.71828182845905+1234.0i) 0.00000178509679+1.56998595813306i)
(num-test (atanh -2.71828182845905+1234.0i) -0.00000178509679+1.56998595813306i)
(num-test (atanh 2.71828182845905-1234.0i) 0.00000178509679-1.56998595813306i)
(num-test (atanh -2.71828182845905-1234.0i) -0.00000178509679-1.56998595813306i)
(num-test (atanh 1234.0+0.0i) 0.00081037294887+1.57079632679490i)
(num-test (atanh -1234.0+0.0i) -0.00081037294887+1.57079632679490i)
(num-test (atanh 1234.0-0.0i) 0.00081037294887+1.57079632679490i)
(num-test (atanh -1234.0-0.0i) -0.00081037294887+1.57079632679490i)
(num-test (atanh 1234.0+0.00000001i) 0.00081037294887+1.57079632679489i)
(num-test (atanh -1234.0+0.00000001i) -0.00081037294887+1.57079632679489i)
(num-test (atanh 1234.0-0.00000001i) 0.00081037294887-1.57079632679489i)
(num-test (atanh -1234.0-0.00000001i) -0.00081037294887-1.57079632679489i)
(num-test (atanh 1234.0+1.0i) 0.00081037241669+1.57079567009087i)
(num-test (atanh -1234.0+1.0i) -0.00081037241669+1.57079567009087i)
(num-test (atanh 1234.0-1.0i) 0.00081037241669-1.57079567009087i)
(num-test (atanh -1234.0-1.0i) -0.00081037241669-1.57079567009087i)
(num-test (atanh 1234.0+3.14159265358979i) 0.00081036769654+1.57079426371036i)
(num-test (atanh -1234.0+3.14159265358979i) -0.00081036769654+1.57079426371036i)
(num-test (atanh 1234.0-3.14159265358979i) 0.00081036769654-1.57079426371036i)
(num-test (atanh -1234.0-3.14159265358979i) -0.00081036769654-1.57079426371036i)
(num-test (atanh 1234.0+2.71828182845905i) 0.00081036901661+1.57079454169576i)
(num-test (atanh -1234.0+2.71828182845905i) -0.00081036901661+1.57079454169576i)
(num-test (atanh 1234.0-2.71828182845905i) 0.00081036901661-1.57079454169576i)
(num-test (atanh -1234.0-2.71828182845905i) -0.00081036901661-1.57079454169576i)
(num-test (atanh 1234.0+1234.0i) 0.00040518634139+1.57039114036481i)
(num-test (atanh -1234.0+1234.0i) -0.00040518634139+1.57039114036481i)
(num-test (atanh 1234.0-1234.0i) 0.00040518634139-1.57039114036481i)
(num-test (atanh -1234.0-1234.0i) -0.00040518634139-1.57039114036481i)
(num-test (atanh -1.0e+01) -1.0033534773107558064e-1+1.5707963267948966192e0i)
(num-test (atanh -2.0e+00) -5.4930614433405484570e-1+1.5707963267948966192e0i)
(num-test (atanh -7.50e-01) -9.7295507452765665255e-1+0.0i)
(num-test (atanh -5.0e-01) -5.4930614433405484570e-1+0.0i)
(num-test (atanh -1.250e-01) -1.2565721414045303884e-1+0.0i)
(num-test (atanh -3.45266983001243932001e-04) -3.4526699672092216295e-4+0.0i)
(num-test (atanh -1.19209289550781250e-07) -1.1920928955078181469e-7+0.0i)
(num-test (atanh 0.0e+00) 0e0+0.0i)
(num-test (atanh 1.19209289550781250e-07) 1.1920928955078181469e-7+0.0i)
(num-test (atanh 3.45266983001243932001e-04) 3.4526699672092216295e-4+0.0i)
(num-test (atanh 1.250e-01) 1.2565721414045303884e-1+0.0i)
(num-test (atanh 5.0e-01) 5.4930614433405484570e-1+0.0i)
(num-test (atanh 7.50e-01) 9.7295507452765665255e-1+0.0i)
(num-test (atanh 2.0e+00) 5.4930614433405484570e-1-1.5707963267948966192e0i)
(num-test (atanh 1.0e+01) 1.0033534773107558064e-1-1.5707963267948966192e0i)
(num-test (atanh 2.8147497671066e+14) 3.552713678800501e-15-1.570796326794897i)
(num-test (atanh 0.0e+00+0.0e+00i) 0e0+0.0i)
(num-test (atanh 0.0e+00+1.19209289550781250e-07i) 0+1.1920928955078068531e-7i)
(num-test (atanh 0.0e+00-1.19209289550781250e-07i) 0-1.1920928955078068531e-7i)
(num-test (atanh 0.0e+00+5.0e-01i) 0+4.6364760900080611621e-1i)
(num-test (atanh 0.0e+00-5.0e-01i) 0-4.6364760900080611621e-1i)
(num-test (atanh 0.0e+00+1.0e+00i) 0+7.8539816339744830962e-1i)
(num-test (atanh 0.0e+00-1.0e+00i) 0-7.8539816339744830962e-1i)
(num-test (atanh 0.0e+00+2.0e+00i) 0+1.1071487177940905030e0i)
(num-test (atanh 0.0e+00-2.0e+00i) 0-1.1071487177940905030e0i)
(num-test (atanh 0.0e+00+8.3886080e+06i) 0+1.5707962075856070685e0i)
(num-test (atanh 0.0e+00-8.3886080e+06i) 0-1.5707962075856070685e0i)
(num-test (atanh 1.19209289550781250e-07+0.0e+00i) 1.1920928955078181469e-7+0.0i)
(num-test (atanh -1.19209289550781250e-07+0.0e+00i) -1.1920928955078181469e-7+0.0i)
(num-test (atanh 1.19209289550781250e-07+1.19209289550781250e-07i) 1.1920928955078012062e-7+1.1920928955078237938e-7i)
(num-test (atanh 1.19209289550781250e-07-1.19209289550781250e-07i) 1.1920928955078012062e-7-1.1920928955078237938e-7i)
(num-test (atanh -1.19209289550781250e-07+1.19209289550781250e-07i) -1.1920928955078012062e-7+1.1920928955078237938e-7i)
(num-test (atanh -1.19209289550781250e-07-1.19209289550781250e-07i) -1.1920928955078012062e-7-1.1920928955078237938e-7i)
(num-test (atanh 1.19209289550781250e-07+5.0e-01i) 9.5367431640625072280e-8+4.6364760900081066369e-1i)
(num-test (atanh 1.19209289550781250e-07-5.0e-01i) 9.5367431640625072280e-8-4.6364760900081066369e-1i)
(num-test (atanh -1.19209289550781250e-07+5.0e-01i) -9.5367431640625072280e-8+4.6364760900081066369e-1i)
(num-test (atanh -1.19209289550781250e-07-5.0e-01i) -9.5367431640625072280e-8-4.6364760900081066369e-1i)
(num-test (atanh 1.19209289550781250e-07+1.0e+00i) 5.9604644775390483828e-8+7.8539816339745186233e-1i)
(num-test (atanh 1.19209289550781250e-07-1.0e+00i) 5.9604644775390483828e-8-7.8539816339745186233e-1i)
(num-test (atanh -1.19209289550781250e-07+1.0e+00i) -5.9604644775390483828e-8+7.8539816339745186233e-1i)
(num-test (atanh -1.19209289550781250e-07-1.0e+00i) -5.9604644775390483828e-8-7.8539816339745186233e-1i)
(num-test (atanh 1.19209289550781250e-07+2.0e+00i) 2.3841857910156200307e-8+1.1071487177940916399e0i)
(num-test (atanh 1.19209289550781250e-07-2.0e+00i) 2.3841857910156200307e-8-1.1071487177940916399e0i)
(num-test (atanh -1.19209289550781250e-07+2.0e+00i) -2.3841857910156200307e-8+1.1071487177940916399e0i)
(num-test (atanh -1.19209289550781250e-07-2.0e+00i) -2.3841857910156200307e-8-1.1071487177940916399e0i)
(num-test (atanh 1.19209289550781250e-07+8.3886080e+06i) 1.6940658945085766040e-21+1.5707962075856070685e0i)
(num-test (atanh 1.19209289550781250e-07-8.3886080e+06i) 1.6940658945085766040e-21-1.5707962075856070685e0i)
(num-test (atanh -1.19209289550781250e-07+8.3886080e+06i) -1.6940658945085766040e-21+1.5707962075856070685e0i)
(num-test (atanh -1.19209289550781250e-07-8.3886080e+06i) -1.6940658945085766040e-21-1.5707962075856070685e0i)
(num-test (atanh 5.0e-01+0.0e+00i) 5.4930614433405484570e-1+0.0i)
(num-test (atanh -5.0e-01+0.0e+00i) -5.4930614433405484570e-1+0.0i)
(num-test (atanh 5.0e-01+1.19209289550781250e-07i) 5.4930614433404221383e-1+1.5894571940103932425e-7i)
(num-test (atanh 5.0e-01-1.19209289550781250e-07i) 5.4930614433404221383e-1-1.5894571940103932425e-7i)
(num-test (atanh -5.0e-01+1.19209289550781250e-07i) -5.4930614433404221383e-1+1.5894571940103932425e-7i)
(num-test (atanh -5.0e-01-1.19209289550781250e-07i) -5.4930614433404221383e-1-1.5894571940103932425e-7i)
(num-test (atanh 5.0e-01+5.0e-01i) 4.0235947810852509365e-1+5.5357435889704525151e-1i)
(num-test (atanh 5.0e-01-5.0e-01i) 4.0235947810852509365e-1-5.5357435889704525151e-1i)
(num-test (atanh -5.0e-01+5.0e-01i) -4.0235947810852509365e-1+5.5357435889704525151e-1i)
(num-test (atanh -5.0e-01-5.0e-01i) -4.0235947810852509365e-1-5.5357435889704525151e-1i)
(num-test (atanh 5.0e-01+1.0e+00i) 2.3887786125685909036e-1+8.4757566067082902713e-1i)
(num-test (atanh 5.0e-01-1.0e+00i) 2.3887786125685909036e-1-8.4757566067082902713e-1i)
(num-test (atanh -5.0e-01+1.0e+00i) -2.3887786125685909036e-1+8.4757566067082902713e-1i)
(num-test (atanh -5.0e-01-1.0e+00i) -2.3887786125685909036e-1-8.4757566067082902713e-1i)
(num-test (atanh 5.0e-01+2.0e+00i) 9.6415620202996167238e-2+1.1265564408348223487e0i)
(num-test (atanh 5.0e-01-2.0e+00i) 9.6415620202996167238e-2-1.1265564408348223487e0i)
(num-test (atanh -5.0e-01+2.0e+00i) -9.6415620202996167238e-2+1.1265564408348223487e0i)
(num-test (atanh -5.0e-01-2.0e+00i) -9.6415620202996167238e-2-1.1265564408348223487e0i)
(num-test (atanh 5.0e-01+8.3886080e+06i) 7.1054273576008756410e-15+1.5707962075856070685e0i)
(num-test (atanh 5.0e-01-8.3886080e+06i) 7.1054273576008756410e-15-1.5707962075856070685e0i)
(num-test (atanh -5.0e-01+8.3886080e+06i) -7.1054273576008756410e-15+1.5707962075856070685e0i)
(num-test (atanh -5.0e-01-8.3886080e+06i) -7.1054273576008756410e-15-1.5707962075856070685e0i)
(num-test (atanh 1.0e+00+1.19209289550781250e-07i) 8.3177661667193446012e0+7.8539819319977069731e-1i)
(num-test (atanh 1.0e+00-1.19209289550781250e-07i) 8.3177661667193446012e0-7.8539819319977069731e-1i)
(num-test (atanh -1.0e+00+1.19209289550781250e-07i) -8.3177661667193446012e0+7.8539819319977069731e-1i)
(num-test (atanh -1.0e+00-1.19209289550781250e-07i) -8.3177661667193446012e0-7.8539819319977069731e-1i)
(num-test (atanh 1.0e+00+5.0e-01i) 7.0830333601405402006e-1+9.0788749496088038670e-1i)
(num-test (atanh 1.0e+00-5.0e-01i) 7.0830333601405402006e-1-9.0788749496088038670e-1i)
(num-test (atanh -1.0e+00+5.0e-01i) -7.0830333601405402006e-1+9.0788749496088038670e-1i)
(num-test (atanh -1.0e+00-5.0e-01i) -7.0830333601405402006e-1-9.0788749496088038670e-1i)
(num-test (atanh 1.0e+00+1.0e+00i) 4.0235947810852509365e-1+1.0172219678978513677e0i)
(num-test (atanh 1.0e+00-1.0e+00i) 4.0235947810852509365e-1-1.0172219678978513677e0i)
(num-test (atanh -1.0e+00+1.0e+00i) -4.0235947810852509365e-1+1.0172219678978513677e0i)
(num-test (atanh -1.0e+00-1.0e+00i) -4.0235947810852509365e-1-1.0172219678978513677e0i)
(num-test (atanh 1.0e+00+2.0e+00i) 1.7328679513998632735e-1+1.1780972450961724644e0i)
(num-test (atanh 1.0e+00-2.0e+00i) 1.7328679513998632735e-1-1.1780972450961724644e0i)
(num-test (atanh -1.0e+00+2.0e+00i) -1.7328679513998632735e-1+1.1780972450961724644e0i)
(num-test (atanh -1.0e+00-2.0e+00i) -1.7328679513998632735e-1-1.1780972450961724644e0i)
(num-test (atanh 1.0e+00+8.3886080e+06i) 1.4210854715201599821e-14+1.5707962075856070685e0i)
(num-test (atanh 1.0e+00-8.3886080e+06i) 1.4210854715201599821e-14-1.5707962075856070685e0i)
(num-test (atanh -1.0e+00+8.3886080e+06i) -1.4210854715201599821e-14+1.5707962075856070685e0i)
(num-test (atanh -1.0e+00-8.3886080e+06i) -1.4210854715201599821e-14-1.5707962075856070685e0i)
(num-test (atanh 2.0e+00+0.0e+00i) 5.4930614433405484570e-1-1.5707963267948966192e0i)
(num-test (atanh -2.0e+00+0.0e+00i) -5.4930614433405484570e-1+1.5707963267948966192e0i)
(num-test (atanh 2.0e+00+1.19209289550781250e-07i) 5.4930614433405168773e-1+1.5707962870584667690e0i)
(num-test (atanh 2.0e+00-1.19209289550781250e-07i) 5.4930614433405168773e-1-1.5707962870584667690e0i)
(num-test (atanh -2.0e+00+1.19209289550781250e-07i) -5.4930614433405168773e-1+1.5707962870584667690e0i)
(num-test (atanh -2.0e+00-1.19209289550781250e-07i) -5.4930614433405168773e-1-1.5707962870584667690e0i)
(num-test (atanh 2.0e+00+5.0e-01i) 5.0037000005253101744e-1+1.4215468610018069803e0i)
(num-test (atanh 2.0e+00-5.0e-01i) 5.0037000005253101744e-1-1.4215468610018069803e0i)
(num-test (atanh -2.0e+00+5.0e-01i) -5.0037000005253101744e-1+1.4215468610018069803e0i)
(num-test (atanh -2.0e+00-5.0e-01i) -5.0037000005253101744e-1-1.4215468610018069803e0i)
(num-test (atanh 2.0e+00+1.0e+00i) 4.0235947810852509365e-1+1.3389725222944935611e0i)
(num-test (atanh 2.0e+00-1.0e+00i) 4.0235947810852509365e-1-1.3389725222944935611e0i)
(num-test (atanh -2.0e+00+1.0e+00i) -4.0235947810852509365e-1+1.3389725222944935611e0i)
(num-test (atanh -2.0e+00-1.0e+00i) -4.0235947810852509365e-1-1.3389725222944935611e0i)
(num-test (atanh 2.0e+00+2.0e+00i) 2.3887786125685909036e-1+1.3112232696716351433e0i)
(num-test (atanh 2.0e+00-2.0e+00i) 2.3887786125685909036e-1-1.3112232696716351433e0i)
(num-test (atanh -2.0e+00+2.0e+00i) -2.3887786125685909036e-1+1.3112232696716351433e0i)
(num-test (atanh -2.0e+00-2.0e+00i) -2.3887786125685909036e-1-1.3112232696716351433e0i)
(num-test (atanh 2.0e+00+8.3886080e+06i) 2.8421709430401987951e-14+1.5707962075856070685e0i)
(num-test (atanh 2.0e+00-8.3886080e+06i) 2.8421709430401987951e-14-1.5707962075856070685e0i)
(num-test (atanh -2.0e+00+8.3886080e+06i) -2.8421709430401987951e-14+1.5707962075856070685e0i)
(num-test (atanh -2.0e+00-8.3886080e+06i) -2.8421709430401987951e-14-1.5707962075856070685e0i)
(num-test (atanh 8.3886080e+06+0.0e+00i) 1.1920928955078181469e-7-1.5707963267948966192e0i)
(num-test (atanh -8.3886080e+06+0.0e+00i) -1.1920928955078181469e-7+1.5707963267948966192e0i)
(num-test (atanh 8.3886080e+06+1.19209289550781250e-07i) 1.1920928955078181469e-7+1.5707963267948966192e0i)
(num-test (atanh 8.3886080e+06-1.19209289550781250e-07i) 1.1920928955078181469e-7-1.5707963267948966192e0i)
(num-test (atanh -8.3886080e+06+1.19209289550781250e-07i) -1.1920928955078181469e-7+1.5707963267948966192e0i)
(num-test (atanh -8.3886080e+06-1.19209289550781250e-07i) -1.1920928955078181469e-7-1.5707963267948966192e0i)
(num-test (atanh 8.3886080e+06+5.0e-01i) 1.1920928955078139117e-7+1.5707963267948895138e0i)
(num-test (atanh 8.3886080e+06-5.0e-01i) 1.1920928955078139117e-7-1.5707963267948895138e0i)
(num-test (atanh -8.3886080e+06+5.0e-01i) -1.1920928955078139117e-7+1.5707963267948895138e0i)
(num-test (atanh -8.3886080e+06-5.0e-01i) -1.1920928955078139117e-7-1.5707963267948895138e0i)
(num-test (atanh 8.3886080e+06+1.0e+00i) 1.1920928955078012062e-7+1.5707963267948824084e0i)
(num-test (atanh 8.3886080e+06-1.0e+00i) 1.1920928955078012062e-7-1.5707963267948824084e0i)
(num-test (atanh -8.3886080e+06+1.0e+00i) -1.1920928955078012062e-7+1.5707963267948824084e0i)
(num-test (atanh -8.3886080e+06-1.0e+00i) -1.1920928955078012062e-7-1.5707963267948824084e0i)
(num-test (atanh 8.3886080e+06+2.0e+00i) 1.1920928955077503843e-7+1.5707963267948681975e0i)
(num-test (atanh 8.3886080e+06-2.0e+00i) 1.1920928955077503843e-7-1.5707963267948681975e0i)
(num-test (atanh -8.3886080e+06+2.0e+00i) -1.1920928955077503843e-7+1.5707963267948681975e0i)
(num-test (atanh -8.3886080e+06-2.0e+00i) -1.1920928955077503843e-7-1.5707963267948681975e0i)
(num-test (atanh 8.3886080e+06+8.3886080e+06i) 5.9604644775390483828e-8+1.5707962671902518438e0i)
(num-test (atanh 8.3886080e+06-8.3886080e+06i) 5.9604644775390483828e-8-1.5707962671902518438e0i)
(num-test (atanh -8.3886080e+06+8.3886080e+06i) -5.9604644775390483828e-8+1.5707962671902518438e0i)
(num-test (atanh -8.3886080e+06-8.3886080e+06i) -5.9604644775390483828e-8-1.5707962671902518438e0i)
(num-test (atanh -2.225073858507201399999999999999999999996E-308) -2.225073858507201399999999999999999999996E-308)
(num-test (atanh 1.110223024625156799999999999999999999997E-16) 1.110223024625156800000000000000004561517E-16)

(when with-bignums
  (num-test (atanh 9223372036854775/9223372036854776) 1.872683213842718135862772724835833552118E1)
  (num-test (atanh 92233720368547758/92233720368547757) 1.987812468492420421418925039646711911969E1+1.570796326794896619231321691639751442098E0i)
  (num-test (atanh 9223372036854775806/9223372036854775807) 2.218070977791824990127011272372523734584E1)
  (num-test (atanh 9223372036854775807/9223372036854775806) 2.218070977791824990127013919350483904273E1+1.570796326794896619231321691639751442098E0i))

(test (atanh) 'error)
(test (atanh "hi") 'error)
(test (atanh 1.0+23.0i 1.0+23.0i) 'error)
(test (atanh 0 1) 'error)

(for-each
 (lambda (arg)
   (test (atanh arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))

(let ((err 0.0)
      (mx 0.0))
  (do ((i 0 (+ i 1))
       (x 1.0 (+ x .1)))
      ((= i 100))
    (let ((y (abs (- x (cosh (acosh x))))))
      (if (> y err) (begin (set! mx x) (set! err y)))))
  (if (> err 1e-14)
      (format #t ";(cosh (acosh ~A)) error: ~A~%" mx err)))

(let ((err 0.0)
      (mx 0.0))
  (do ((i 0 (+ i 1))
       (x 1.0+i (+ x 0.1-0.1i)))
      ((= i 100))
    (let ((y (magnitude (- x (cosh (acosh x))))))
      (if (> y err) (begin (set! mx x) (set! err y)))))
  (if (> err 1e-14)
      (format #t ";(cosh (acosh ~A)) error: ~A~%" mx err)))

(let ((err 0.0)
      (mx 0.0))
  (do ((i 0 (+ i 1))
       (x 1.0 (+ x .1)))
      ((= i 100))
    (let ((y (abs (- x (sinh (asinh x))))))
      (if (> y err) (begin (set! mx x) (set! err y)))))
  (if (> err 1e-14)
      (format #t ";(sinh (asinh ~A)) error: ~A~%" mx err)))

(let ((err 0.0)
      (mx 0.0))
  (do ((i 0 (+ i 1))
       (x 1.0-i (+ x -0.1+i)))
      ((= i 100))
    (let ((y (magnitude (- x (sinh (asinh x))))))
      (if (> y err) (begin (set! mx x) (set! err y)))))
  (if (> err 1e-9)
      (format #t ";(sinh (asinh ~A)) error: ~A~%" mx err)))

(let ((err 0.0)
      (mx 0.0))
  (do ((i 0 (+ i 1))
       (x 0.0 (+ x .1)))
      ((= i 100))
    (let ((y (magnitude (- x (tanh (atanh x))))))
      (if (> y err) (begin (set! mx x) (set! err y)))))
  (if (> err 1e-12)
      (format #t ";(tanh (atanh ~A)) error: ~A~%" mx err)))

(for-each
 (lambda (num-and-val)
   (let ((num (car num-and-val)) (val (cadr num-and-val))) (num-test-1 'atanh num (atanh num) val)))
 (vector (list 0 0) (list 2 0.54930614433405+1.5707963267949i) (list 3 0.34657359027997+1.5707963267949i) 
	 (list -2 -0.54930614433405+1.5707963267949i) (list -3 -0.34657359027997+1.5707963267949i) 
	 (list 9223372036854775807 -1.6740081543176e-15+1.5707963267949i) (list -9223372036854775808 -1.6740081543176e-15+1.5707963267949i) 
	 (list 1/2 0.54930614433405) (list 1/3 0.34657359027997) (list -1/2 -0.54930614433405) 
	 (list -1/3 -0.34657359027997) (list 1/9223372036854775807 1.0842021724855e-19) (list 0.0 0.0) 
	 (list 2.0 0.54930614433405+1.5707963267949i) (list -2.0 -0.54930614433405+1.5707963267949i) 
	 (list 1.000000000000000000000000000000000000002E-309 1.000000000000000000000000000000000000002E-309) 
	 (list 1e+16 1.7676832220204e-15+1.5707963267949i) (list inf.0 0+1.5707963267949i) 
	 (list -inf.0 -0+1.5707963267949i) (list 0+1i -5.8004816227974e-18+0.78539816339745i) 
	 (list 0+2i -2.320192649119e-17+1.1071487177941i) (list 0-1i -5.8004816227974e-18-0.78539816339745i) 
	 (list 1+1i 0.40235947810853+1.0172219678979i) (list 1-1i 0.40235947810853-1.0172219678979i) 
	 (list -1+1i -0.40235947810853+1.0172219678979i) (list -1-1i -0.40235947810853-1.0172219678979i) 
	 (list 0.1+0.1i 0.099325449367251+0.10065855418732i) (list 1e+16+1e+16i -1.3183898417424e-15+1.5707963267949i) 
	 (list 1e-16+1e-16i 1.1102230246252e-16+1e-16i) ))
  



;;; --------------------------------------------------------------------------------
;;; sqrt
;;; --------------------------------------------------------------------------------

(num-test (sqrt 0) 0)
(num-test (sqrt 1) 1)
(num-test (sqrt -1) 0.0+1.0i)
(num-test (sqrt 2) 1.41421356237310)
(num-test (sqrt -2) 0.0+1.41421356237310i)
(num-test (sqrt 3) 1.73205080756888)
(num-test (sqrt -3) 0.0+1.73205080756888i)
(num-test (sqrt 10) 3.16227766016838)
(num-test (sqrt -10) 0.0+3.16227766016838i)
(num-test (sqrt 1234) 35.12833614050059)
(num-test (sqrt -1234) 0.0+35.12833614050059i)
(num-test (sqrt 1234000000) 35128.33614050059259)
(num-test (sqrt -1234000000) 0.0+35128.33614050059259i)
(num-test (sqrt 500029) 707.12728698587216)
(num-test (sqrt -500029) 0.0+707.12728698587216i)
(num-test (sqrt 362880) 602.39521910453436)
(num-test (sqrt -362880) 0.0+602.39521910453436i)
(num-test (sqrt 0/1) 0)
(num-test (sqrt 0/2) 0)
(num-test (sqrt 0/3) 0)
(num-test (sqrt 0/10) 0)
(num-test (sqrt 0/1234) 0)
(num-test (sqrt 0/1234000000) 0)
(num-test (sqrt 0/500029) 0)
(num-test (sqrt 0/362880) 0)
(num-test (sqrt 1/1) 1)
(num-test (sqrt -1/1) 0.0+1.0i)
(num-test (sqrt 1/2) 0.70710678118655)
(num-test (sqrt -1/2) 0.0+0.70710678118655i)
(num-test (sqrt 1/3) 0.57735026918963)
(num-test (sqrt -1/3) 0.0+0.57735026918963i)
(num-test (sqrt 1/10) 0.31622776601684)
(num-test (sqrt -1/10) 0.0+0.31622776601684i)
(num-test (sqrt 1/1234) 0.02846704711548)
(num-test (sqrt -1/1234) 0.0+0.02846704711548i)
(num-test (sqrt 1/1234000000) 0.00002846704712)
(num-test (sqrt -1/1234000000) 0.0+0.00002846704712i)
(num-test (sqrt 1/500029) 0.00141417255196)
(num-test (sqrt -1/500029) 0.0+0.00141417255196i)
(num-test (sqrt 1/362880) 0.00166003973519)
(num-test (sqrt -1/362880) 0.0+0.00166003973519i)
(num-test (sqrt 2/1) 1.41421356237310)
(num-test (sqrt -2/1) 0.0+1.41421356237310i)
(num-test (sqrt 2/2) 1)
(num-test (sqrt -2/2) 0.0+1.0i)
(num-test (sqrt 2/3) 0.81649658092773)
(num-test (sqrt -2/3) 0.0+0.81649658092773i)
(num-test (sqrt 2/10) 0.44721359549996)
(num-test (sqrt -2/10) 0.0+0.44721359549996i)
(num-test (sqrt 2/1234) 0.04025848411142)
(num-test (sqrt -2/1234) 0.0+0.04025848411142i)
(num-test (sqrt 2/1234000000) 0.00004025848411)
(num-test (sqrt -2/1234000000) 0.0+0.00004025848411i)
(num-test (sqrt 2/500029) 0.00199994200252)
(num-test (sqrt -2/500029) 0.0+0.00199994200252i)
(num-test (sqrt 2/362880) 0.00234765070758)
(num-test (sqrt -2/362880) 0.0+0.00234765070758i)
(num-test (sqrt 3/1) 1.73205080756888)
(num-test (sqrt -3/1) 0.0+1.73205080756888i)
(num-test (sqrt 3/2) 1.22474487139159)
(num-test (sqrt -3/2) 0.0+1.22474487139159i)
(num-test (sqrt 3/3) 1)
(num-test (sqrt -3/3) 0.0+1.0i)
(num-test (sqrt 3/10) 0.54772255750517)
(num-test (sqrt -3/10) 0.0+0.54772255750517i)
(num-test (sqrt 3/1234) 0.04930637194547)
(num-test (sqrt -3/1234) 0.0+0.04930637194547i)
(num-test (sqrt 3/1234000000) 0.00004930637195)
(num-test (sqrt -3/1234000000) 0.0+0.00004930637195i)
(num-test (sqrt 3/500029) 0.00244941871067)
(num-test (sqrt -3/500029) 0.0+0.00244941871067i)
(num-test (sqrt 3/362880) 0.00287527316393)
(num-test (sqrt -3/362880) 0.0+0.00287527316393i)
(num-test (sqrt 10/1) 3.16227766016838)
(num-test (sqrt -10/1) 0.0+3.16227766016838i)
(num-test (sqrt 10/2) 2.23606797749979)
(num-test (sqrt -10/2) 0.0+2.23606797749979i)
(num-test (sqrt 10/3) 1.82574185835055)
(num-test (sqrt -10/3) 0.0+1.82574185835055i)
(num-test (sqrt 10/10) 1)
(num-test (sqrt -10/10) 0.0+1.0i)
(num-test (sqrt 10/1234) 0.09002070714424)
(num-test (sqrt -10/1234) 0.0+0.09002070714424i)
(num-test (sqrt 10/1234000000) 0.00009002070714)
(num-test (sqrt -10/1234000000) 0.0+0.00009002070714i)
(num-test (sqrt 10/500029) 0.00447200626870)
(num-test (sqrt -10/500029) 0.0+0.00447200626870i)
(num-test (sqrt 10/362880) 0.00524950656957)
(num-test (sqrt -10/362880) 0.0+0.00524950656957i)
(num-test (sqrt 1234/1) 35.12833614050059)
(num-test (sqrt -1234/1) 0.0+35.12833614050059i)
(num-test (sqrt 1234/2) 24.83948469674844)
(num-test (sqrt -1234/2) 0.0+24.83948469674844i)
(num-test (sqrt 1234/3) 20.28135432690167)
(num-test (sqrt -1234/3) 0.0+20.28135432690167i)
(num-test (sqrt 1234/10) 11.10855526159905)
(num-test (sqrt -1234/10) 0.0+11.10855526159905i)
(num-test (sqrt 1234/1234) 1)
(num-test (sqrt -1234/1234) 0.0+1.0i)
(num-test (sqrt 1234/1234000000) 0.001)
(num-test (sqrt -1234/1234000000) 0.0+0.001i)
(num-test (sqrt 1234/500029) 0.04967752876605)
(num-test (sqrt -1234/500029) 0.0+0.04967752876605i)
(num-test (sqrt 1234/362880) 0.05831443382422)
(num-test (sqrt -1234/362880) 0.0+0.05831443382422i)
(num-test (sqrt 1234000000/1) 35128.33614050059259)
(num-test (sqrt -1234000000/1) 0.0+35128.33614050059259i)
(num-test (sqrt 1234000000/2) 24839.48469674844091)
(num-test (sqrt -1234000000/2) 0.0+24839.48469674844091i)
(num-test (sqrt 1234000000/3) 20281.35432690167727)
(num-test (sqrt -1234000000/3) 0.0+20281.35432690167727i)
(num-test (sqrt 1234000000/10) 11108.55526159905276)
(num-test (sqrt -1234000000/10) 0.0+11108.55526159905276i)
(num-test (sqrt 1234000000/1234) 1000)
(num-test (sqrt -1234000000/1234) 0.0+1000.0i)
(num-test (sqrt 1234000000/1234000000) 1)
(num-test (sqrt -1234000000/1234000000) 0.0+1.0i)
(num-test (sqrt 1234000000/500029) 49.67752876605147)
(num-test (sqrt -1234000000/500029) 0.0+49.67752876605147i)
(num-test (sqrt 1234000000/362880) 58.31443382422451)
(num-test (sqrt -1234000000/362880) 0.0+58.31443382422451i)
(num-test (sqrt 500029/1) 707.12728698587216)
(num-test (sqrt -500029/1) 0.0+707.12728698587216i)
(num-test (sqrt 500029/2) 500.01449978975609)
(num-test (sqrt -500029/2) 0.0+500.01449978975609i)
(num-test (sqrt 500029/3) 408.26012949262304)
(num-test (sqrt -500029/3) 0.0+408.26012949262304i)
(num-test (sqrt 500029/10) 223.61328225308978)
(num-test (sqrt -500029/10) 0.0+223.61328225308978i)
(num-test (sqrt 500029/1234) 20.12982579526738)
(num-test (sqrt -500029/1234) 0.0+20.12982579526738i)
(num-test (sqrt 500029/1234000000) 0.02012982579527)
(num-test (sqrt -500029/1234000000) 0.0+0.02012982579527i)
(num-test (sqrt 500029/500029) 1)
(num-test (sqrt -500029/500029) 0.0+1.0i)
(num-test (sqrt 500029/362880) 1.17385939423129)
(num-test (sqrt -500029/362880) 0.0+1.17385939423129i)
(num-test (sqrt 362880/1) 602.39521910453436)
(num-test (sqrt -362880/1) 0.0+602.39521910453436i)
(num-test (sqrt 362880/2) 425.95774438317238)
(num-test (sqrt -362880/2) 0.0+425.95774438317238i)
(num-test (sqrt 362880/3) 347.79304190854651)
(num-test (sqrt -362880/3) 0.0+347.79304190854651i)
(num-test (sqrt 362880/10) 190.49409439665052)
(num-test (sqrt -362880/10) 0.0+190.49409439665052i)
(num-test (sqrt 362880/1234) 17.14841308438784)
(num-test (sqrt -362880/1234) 0.0+17.14841308438784i)
(num-test (sqrt 362880/1234000000) 0.01714841308439)
(num-test (sqrt -362880/1234000000) 0.0+0.01714841308439i)
(num-test (sqrt 362880/500029) 0.85189078429181)
(num-test (sqrt -362880/500029) 0.0+0.85189078429181i)
(num-test (sqrt 362880/362880) 1)
(num-test (sqrt -362880/362880) 0.0+1.0i)
(num-test (sqrt 0.0) 0.0)
(num-test (sqrt 0.00000001) 0.00010000000000)
(num-test (sqrt -0.00000001) 0.0+0.00010000000000i)
(num-test (sqrt 1.0) 1.0)
(num-test (sqrt -1.0) 0.0+1.0i)
(num-test (sqrt pi) 1.77245385090552)
(num-test (sqrt -3.14159265358979) 0.0+1.77245385090552i)
(num-test (sqrt 2.71828182845905) 1.64872127070013)
(num-test (sqrt -2.71828182845905) 0.0+1.64872127070013i)
(num-test (sqrt 1234.0) 35.12833614050059)
(num-test (sqrt -1234.0) 0.0+35.12833614050059i)
(num-test (sqrt 1234000000.0) 35128.33614050059259)
(num-test (sqrt -1234000000.0) 0.0+35128.33614050059259i)
(num-test (sqrt 0.0+0.0i) 0.0)
(num-test (sqrt -0.0+0.0i) 0.0)
(num-test (sqrt 0.0-0.0i) 0.0)
(num-test (sqrt -0.0-0.0i) 0.0)
(num-test (sqrt 0.0+0.00000001i) 0.00007071067812+0.00007071067812i)
(num-test (sqrt -0.0+0.00000001i) 0.00007071067812+0.00007071067812i)
(num-test (sqrt 0.0-0.00000001i) 0.00007071067812-0.00007071067812i)
(num-test (sqrt -0.0-0.00000001i) 0.00007071067812-0.00007071067812i)
(num-test (sqrt 0.0+1.0i) 0.70710678118655+0.70710678118655i)
(num-test (sqrt -0.0+1.0i) 0.70710678118655+0.70710678118655i)
(num-test (sqrt 0.0-1.0i) 0.70710678118655-0.70710678118655i)
(num-test (sqrt -0.0-1.0i) 0.70710678118655-0.70710678118655i)
(num-test (sqrt 0.0+3.14159265358979i) 1.25331413731550+1.25331413731550i)
(num-test (sqrt -0.0+3.14159265358979i) 1.25331413731550+1.25331413731550i)
(num-test (sqrt 0.0-3.14159265358979i) 1.25331413731550-1.25331413731550i)
(num-test (sqrt -0.0-3.14159265358979i) 1.25331413731550-1.25331413731550i)
(num-test (sqrt 0.0+2.71828182845905i) 1.16582199079856+1.16582199079856i)
(num-test (sqrt -0.0+2.71828182845905i) 1.16582199079856+1.16582199079856i)
(num-test (sqrt 0.0-2.71828182845905i) 1.16582199079856-1.16582199079856i)
(num-test (sqrt -0.0-2.71828182845905i) 1.16582199079856-1.16582199079856i)
(num-test (sqrt 0.0+1234.0i) 24.83948469674844+24.83948469674844i)
(num-test (sqrt -0.0+1234.0i) 24.83948469674844+24.83948469674844i)
(num-test (sqrt 0.0-1234.0i) 24.83948469674844-24.83948469674844i)
(num-test (sqrt -0.0-1234.0i) 24.83948469674844-24.83948469674844i)
(num-test (sqrt 0.0+1234000000.0i) 24839.48469674844091+24839.48469674844091i)
(num-test (sqrt -0.0+1234000000.0i) 24839.48469674844091+24839.48469674844091i)
(num-test (sqrt 0.0-1234000000.0i) 24839.48469674844091-24839.48469674844091i)
(num-test (sqrt -0.0-1234000000.0i) 24839.48469674844091-24839.48469674844091i)
(num-test (sqrt 0.00000001+0.0i) 0.00010000000000)
(num-test (sqrt -0.00000001+0.0i) 0.0+0.00010000000000i)
(num-test (sqrt 0.00000001-0.0i) 0.00010000000000)
(num-test (sqrt -0.00000001-0.0i) 0.0+0.00010000000000i)
(num-test (sqrt 0.00000001+0.00000001i) 0.00010986841135+0.00004550898606i)
(num-test (sqrt -0.00000001+0.00000001i) 0.00004550898606+0.00010986841135i)
(num-test (sqrt 0.00000001-0.00000001i) 0.00010986841135-0.00004550898606i)
(num-test (sqrt -0.00000001-0.00000001i) 0.00004550898606-0.00010986841135i)
(num-test (sqrt 0.00000001+1.0i) 0.70710678472208+0.70710677765101i)
(num-test (sqrt -0.00000001+1.0i) 0.70710677765101+0.70710678472208i)
(num-test (sqrt 0.00000001-1.0i) 0.70710678472208-0.70710677765101i)
(num-test (sqrt -0.00000001-1.0i) 0.70710677765101-0.70710678472208i)
(num-test (sqrt 0.00000001+3.14159265358979i) 1.25331413931021+1.25331413532079i)
(num-test (sqrt -0.00000001+3.14159265358979i) 1.25331413532079+1.25331413931021i)
(num-test (sqrt 0.00000001-3.14159265358979i) 1.25331413931021-1.25331413532079i)
(num-test (sqrt -0.00000001-3.14159265358979i) 1.25331413532079-1.25331413931021i)
(num-test (sqrt 0.00000001+2.71828182845905i) 1.16582199294297+1.16582198865415i)
(num-test (sqrt -0.00000001+2.71828182845905i) 1.16582198865415+1.16582199294297i)
(num-test (sqrt 0.00000001-2.71828182845905i) 1.16582199294297-1.16582198865415i)
(num-test (sqrt -0.00000001-2.71828182845905i) 1.16582198865415-1.16582199294297i)
(num-test (sqrt 0.00000001+1234.0i) 24.83948469684909+24.83948469664779i)
(num-test (sqrt -0.00000001+1234.0i) 24.83948469664779+24.83948469684909i)
(num-test (sqrt 0.00000001-1234.0i) 24.83948469684909-24.83948469664779i)
(num-test (sqrt -0.00000001-1234.0i) 24.83948469664779-24.83948469684909i)
(num-test (sqrt 0.00000001+1234000000.0i) 24839.48469674844091+24839.48469674844091i)
(num-test (sqrt -0.00000001+1234000000.0i) 24839.48469674844091+24839.48469674844091i)
(num-test (sqrt 0.00000001-1234000000.0i) 24839.48469674844091-24839.48469674844091i)
(num-test (sqrt -0.00000001-1234000000.0i) 24839.48469674844091-24839.48469674844091i)
(num-test (sqrt 1.0+0.0i) 1.0)
(num-test (sqrt -0.0) 0.0)
(num-test (sqrt 0.0) 0.0)
(num-test (sqrt -1.0+0.0i) 0.0+1.0i)
(num-test (sqrt 1.0-0.0i) 1.0)
(num-test (sqrt -1.0-0.0i) 0.0+1.0i)
(num-test (sqrt 1.0+0.00000001i) 1.0+0.00000000500000i)
(num-test (sqrt -1.0+0.00000001i) 0.00000000500000+1.0i)
(num-test (sqrt 1.0-0.00000001i) 1.0-0.00000000500000i)
(num-test (sqrt -1.0-0.00000001i) 0.00000000500000-1.0i)
(num-test (sqrt 1.0+1.0i) 1.09868411346781+0.45508986056223i)
(num-test (sqrt -1.0+1.0i) 0.45508986056223+1.09868411346781i)
(num-test (sqrt 1.0-1.0i) 1.09868411346781-0.45508986056223i)
(num-test (sqrt -1.0-1.0i) 0.45508986056223-1.09868411346781i)
(num-test (sqrt 1.0+3.14159265358979i) 1.46576060621706+1.07165953303174i)
(num-test (sqrt -1.0+3.14159265358979i) 1.07165953303174+1.46576060621706i)
(num-test (sqrt 1.0-3.14159265358979i) 1.46576060621706-1.07165953303174i)
(num-test (sqrt -1.0-3.14159265358979i) 1.07165953303174-1.46576060621706i)
(num-test (sqrt 1.0+2.71828182845905i) 1.39577697566445+0.97375220964833i)
(num-test (sqrt -1.0+2.71828182845905i) 0.97375220964833+1.39577697566445i)
(num-test (sqrt 1.0-2.71828182845905i) 1.39577697566445-0.97375220964833i)
(num-test (sqrt -1.0-2.71828182845905i) 0.97375220964833-1.39577697566445i)
(num-test (sqrt 1.0+1234.0i) 24.84955135597340+24.82942211557006i)
(num-test (sqrt -1.0+1234.0i) 24.82942211557006+24.84955135597340i)
(num-test (sqrt 1.0-1234.0i) 24.84955135597340-24.82942211557006i)
(num-test (sqrt -1.0-1234.0i) 24.82942211557006-24.84955135597340i)
(num-test (sqrt 1.0+1234000000.0i) 24839.48470681306208+24839.48468668381975i)
(num-test (sqrt -1.0+1234000000.0i) 24839.48468668381975+24839.48470681306208i)
(num-test (sqrt 1.0-1234000000.0i) 24839.48470681306208-24839.48468668381975i)
(num-test (sqrt -1.0-1234000000.0i) 24839.48468668381975-24839.48470681306208i)
(num-test (sqrt 3.14159265358979+0.0i) 1.77245385090552)
(num-test (sqrt -3.14159265358979+0.0i) 0.0+1.77245385090552i)
(num-test (sqrt 3.14159265358979-0.0i) 1.77245385090552)
(num-test (sqrt -3.14159265358979-0.0i) 0.0+1.77245385090552i)
(num-test (sqrt 3.14159265358979+0.00000001i) 1.77245385090552+0.00000000282095i)
(num-test (sqrt -3.14159265358979+0.00000001i) 0.00000000282095+1.77245385090552i)
(num-test (sqrt 3.14159265358979-0.00000001i) 1.77245385090552-0.00000000282095i)
(num-test (sqrt -3.14159265358979-0.00000001i) 0.00000000282095-1.77245385090552i)
(num-test (sqrt 3.14159265358979+1.0i) 1.79422698718214+0.27867154132224i)
(num-test (sqrt -3.14159265358979+1.0i) 0.27867154132224+1.79422698718214i)
(num-test (sqrt 3.14159265358979-1.0i) 1.79422698718214-0.27867154132224i)
(num-test (sqrt -3.14159265358979-1.0i) 0.27867154132224-1.79422698718214i)
(num-test (sqrt 3.14159265358979+3.14159265358979i) 1.94736688784473+0.80662577586157i)
(num-test (sqrt -3.14159265358979+3.14159265358979i) 0.80662577586157+1.94736688784473i)
(num-test (sqrt 3.14159265358979-3.14159265358979i) 1.94736688784473-0.80662577586157i)
(num-test (sqrt -3.14159265358979-3.14159265358979i) 0.80662577586157-1.94736688784473i)
(num-test (sqrt 3.14159265358979+2.71828182845905i) 1.90996689184696+0.71160443672153i)
(num-test (sqrt -3.14159265358979+2.71828182845905i) 0.71160443672153+1.90996689184696i)
(num-test (sqrt 3.14159265358979-2.71828182845905i) 1.90996689184696-0.71160443672153i)
(num-test (sqrt -3.14159265358979-2.71828182845905i) 0.71160443672153-1.90996689184696i)
(num-test (sqrt 3.14159265358979+1234.0i) 24.87112373493049+24.80788590719961i)
(num-test (sqrt -3.14159265358979+1234.0i) 24.80788590719961+24.87112373493049i)
(num-test (sqrt 3.14159265358979-1234.0i) 24.87112373493049-24.80788590719961i)
(num-test (sqrt -3.14159265358979-1234.0i) 24.80788590719961-24.87112373493049i)
(num-test (sqrt 3.14159265358979+1234000000.0i) 24839.48472836738074+24839.48466512950108i)
(num-test (sqrt -3.14159265358979+1234000000.0i) 24839.48466512950108+24839.48472836738074i)
(num-test (sqrt 3.14159265358979-1234000000.0i) 24839.48472836738074-24839.48466512950108i)
(num-test (sqrt -3.14159265358979-1234000000.0i) 24839.48466512950108-24839.48472836738074i)
(num-test (sqrt 2.71828182845905+0.0i) 1.64872127070013)
(num-test (sqrt -2.71828182845905+0.0i) 0.0+1.64872127070013i)
(num-test (sqrt 2.71828182845905-0.0i) 1.64872127070013)
(num-test (sqrt -2.71828182845905-0.0i) 0.0+1.64872127070013i)
(num-test (sqrt 2.71828182845905+0.00000001i) 1.64872127070013+0.00000000303265i)
(num-test (sqrt -2.71828182845905+0.00000001i) 0.00000000303265+1.64872127070013i)
(num-test (sqrt 2.71828182845905-0.00000001i) 1.64872127070013-0.00000000303265i)
(num-test (sqrt -2.71828182845905-0.00000001i) 0.00000000303265-1.64872127070013i)
(num-test (sqrt 2.71828182845905+1.0i) 1.67551015515410+0.29841657387867i)
(num-test (sqrt -2.71828182845905+1.0i) 0.29841657387867+1.67551015515410i)
(num-test (sqrt 2.71828182845905-1.0i) 1.67551015515410-0.29841657387867i)
(num-test (sqrt -2.71828182845905-1.0i) 0.29841657387867-1.67551015515410i)
(num-test (sqrt 2.71828182845905+3.14159265358979i) 1.85373086379501+0.84737021833856i)
(num-test (sqrt -2.71828182845905+3.14159265358979i) 0.84737021833856+1.85373086379501i)
(num-test (sqrt 2.71828182845905-3.14159265358979i) 1.85373086379501-0.84737021833856i)
(num-test (sqrt -2.71828182845905-3.14159265358979i) 0.84737021833856-1.85373086379501i)
(num-test (sqrt 2.71828182845905+2.71828182845905i) 1.81142386765469+0.75031633318890i)
(num-test (sqrt -2.71828182845905+2.71828182845905i) 0.75031633318890+1.81142386765469i)
(num-test (sqrt 2.71828182845905-2.71828182845905i) 1.81142386765469-0.75031633318890i)
(num-test (sqrt -2.71828182845905-2.71828182845905i) 0.75031633318890-1.81142386765469i)
(num-test (sqrt 2.71828182845905+1234.0i) 24.86685822304219+24.81214130333015i)
(num-test (sqrt -2.71828182845905+1234.0i) 24.81214130333015+24.86685822304219i)
(num-test (sqrt 2.71828182845905-1234.0i) 24.86685822304219-24.81214130333015i)
(num-test (sqrt -2.71828182845905-1234.0i) 24.81214130333015-24.86685822304219i)
(num-test (sqrt 2.71828182845905+1234000000.0i) 24839.48472410691829+24839.48466938996353i)
(num-test (sqrt -2.71828182845905+1234000000.0i) 24839.48466938996353+24839.48472410691829i)
(num-test (sqrt 2.71828182845905-1234000000.0i) 24839.48472410691829-24839.48466938996353i)
(num-test (sqrt -2.71828182845905-1234000000.0i) 24839.48466938996353-24839.48472410691829i)
(num-test (sqrt 1234.0+0.0i) 35.12833614050059)
(num-test (sqrt -1234.0+0.0i) 0.0+35.12833614050059i)
(num-test (sqrt 1234.0-0.0i) 35.12833614050059)
(num-test (sqrt -1234.0-0.0i) 0.0+35.12833614050059i)
(num-test (sqrt 1234.0+0.00000001i) 35.12833614050059+0.00000000014234i)
(num-test (sqrt -1234.0+0.00000001i) 0.00000000014234+35.12833614050059i)
(num-test (sqrt 1234.0-0.00000001i) 35.12833614050059-0.00000000014234i)
(num-test (sqrt -1234.0-0.00000001i) 0.00000000014234-35.12833614050059i)
(num-test (sqrt 1234.0+1.0i) 35.12833902411499+0.01423352238934i)
(num-test (sqrt -1234.0+1.0i) 0.01423352238934+35.12833902411499i)
(num-test (sqrt 1234.0-1.0i) 35.12833902411499-0.01423352238934i)
(num-test (sqrt -1234.0-1.0i) 0.01423352238934-35.12833902411499i)
(num-test (sqrt 1234.0+3.14159265358979i) 35.12836460058208+0.04471589681601i)
(num-test (sqrt -1234.0+3.14159265358979i) 0.04471589681601+35.12836460058208i)
(num-test (sqrt 1234.0-3.14159265358979i) 35.12836460058208-0.04471589681601i)
(num-test (sqrt -1234.0-3.14159265358979i) 0.04471589681601-35.12836460058208i)
(num-test (sqrt 1234.0+2.71828182845905i) 35.12835744766116+0.03869070497402i)
(num-test (sqrt -1234.0+2.71828182845905i) 0.03869070497402+35.12835744766116i)
(num-test (sqrt 1234.0-2.71828182845905i) 35.12835744766116-0.03869070497402i)
(num-test (sqrt -1234.0-2.71828182845905i) 0.03869070497402-35.12835744766116i)
(num-test (sqrt 1234.0+1234.0i) 38.59494485012512+15.98654959596347i)
(num-test (sqrt -1234.0+1234.0i) 15.98654959596347+38.59494485012512i)
(num-test (sqrt 1234.0-1234.0i) 38.59494485012512-15.98654959596347i)
(num-test (sqrt -1234.0-1234.0i) 15.98654959596347-38.59494485012512i)
(num-test (sqrt 1234.0+1234000000.0i) 24839.49711649389428+24839.47227700919757i)
(num-test (sqrt -1234.0+1234000000.0i) 24839.47227700919757+24839.49711649389428i)
(num-test (sqrt 1234.0-1234000000.0i) 24839.49711649389428-24839.47227700919757i)
(num-test (sqrt -1234.0-1234000000.0i) 24839.47227700919757-24839.49711649389428i)
(num-test (sqrt 1234000000.0+0.0i) 35128.33614050059259)
(num-test (sqrt -1234000000.0+0.0i) 0.0+35128.33614050059259i)
(num-test (sqrt 1234000000.0-0.0i) 35128.33614050059259)
(num-test (sqrt -1234000000.0-0.0i) 0.0+35128.33614050059259i)
(num-test (sqrt 1234000000.0+0.00000001i) 35128.33614050059259+0.00000000000014i)
(num-test (sqrt -1234000000.0+0.00000001i) 0.00000000000014+35128.33614050059259i)
(num-test (sqrt 1234000000.0-0.00000001i) 35128.33614050059259-0.00000000000014i)
(num-test (sqrt -1234000000.0-0.00000001i) 0.00000000000014-35128.33614050059259i)
(num-test (sqrt 1234000000.0+1.0i) 35128.33614050059259+0.00001423352356i)
(num-test (sqrt -1234000000.0+1.0i) 0.00001423352356+35128.33614050059259i)
(num-test (sqrt 1234000000.0-1.0i) 35128.33614050059259-0.00001423352356i)
(num-test (sqrt -1234000000.0-1.0i) 0.00001423352356-35128.33614050059259i)
(num-test (sqrt 1234000000.0+3.14159265358979i) 35128.33614050059259+0.00004471593304i)
(num-test (sqrt -1234000000.0+3.14159265358979i) 0.00004471593304+35128.33614050059259i)
(num-test (sqrt 1234000000.0-3.14159265358979i) 35128.33614050059259-0.00004471593304i)
(num-test (sqrt -1234000000.0-3.14159265358979i) 0.00004471593304-35128.33614050059259i)
(num-test (sqrt 1234000000.0+2.71828182845905i) 35128.33614050059259+0.00003869072844i)
(num-test (sqrt -1234000000.0+2.71828182845905i) 0.00003869072844+35128.33614050059259i)
(num-test (sqrt 1234000000.0-2.71828182845905i) 35128.33614050059259-0.00003869072844i)
(num-test (sqrt -1234000000.0-2.71828182845905i) 0.00003869072844-35128.33614050059259i)
(num-test (sqrt 1234000000.0+1234.0i) 35128.33614050497999+0.01756416807025i)
(num-test (sqrt -1234000000.0+1234.0i) 0.01756416807025+35128.33614050497999i)
(num-test (sqrt 1234000000.0-1234.0i) 35128.33614050497999-0.01756416807025i)
(num-test (sqrt -1234000000.0-1234.0i) 0.01756416807025-35128.33614050497999i)
(num-test (sqrt 1234000000.0+1234000000.0i) 38594.94485012512450+15986.54959596346634i)
(num-test (sqrt -1234000000.0+1234000000.0i) 15986.54959596346634+38594.94485012512450i)
(num-test (sqrt 1234000000.0-1234000000.0i) 38594.94485012512450-15986.54959596346634i)
(num-test (sqrt -1234000000.0-1234000000.0i) 15986.54959596346634-38594.94485012512450i)
(num-test (sqrt 2.2250739e-308) 1.4916681e-154)
(num-test (sqrt 1.7976931e+308) 1.3407808e+154)
(num-test (sqrt 0.0e+00+0.0e+00i) 0e0+0.0i)
(num-test (sqrt 0.0e+00+1.19209289550781250e-07i) 2.44140625e-4+2.44140625e-4i)
(num-test (sqrt 0.0e+00-1.19209289550781250e-07i) 2.44140625e-4-2.44140625e-4i)
(num-test (sqrt 0.0e+00+5.0e-01i) 5e-1+5e-1i)
(num-test (sqrt 0.0e+00-5.0e-01i) 5e-1-5e-1i)
(num-test (sqrt 0.0e+00+1.0e+00i) 7.0710678118654752440e-1+7.0710678118654752440e-1i)
(num-test (sqrt 0.0e+00-1.0e+00i) 7.0710678118654752440e-1-7.0710678118654752440e-1i)
(num-test (sqrt 0.0e+00+2.0e+00i) 1+1i)
(num-test (sqrt 0.0e+00-2.0e+00i) 1-1i)
(num-test (sqrt 0.0e+00+8.3886080e+06i) 2048+2048i)
(num-test (sqrt 0.0e+00-8.3886080e+06i) 2048-2048i)
(num-test (sqrt 1.19209289550781250e-07+0.0e+00i) 3.4526698300124390840e-4+0.0i)
(num-test (sqrt -1.19209289550781250e-07+0.0e+00i) 0+3.4526698300124390840e-4i)
(num-test (sqrt 1.19209289550781250e-07+1.19209289550781250e-07i) 3.7933934912842707699e-4+1.5712750315077700799e-4i)
(num-test (sqrt 1.19209289550781250e-07-1.19209289550781250e-07i) 3.7933934912842707699e-4-1.5712750315077700799e-4i)
(num-test (sqrt -1.19209289550781250e-07+1.19209289550781250e-07i) 1.5712750315077700799e-4+3.7933934912842707699e-4i)
(num-test (sqrt -1.19209289550781250e-07-1.19209289550781250e-07i) 1.5712750315077700799e-4-3.7933934912842707699e-4i)
(num-test (sqrt 1.19209289550781250e-07+5.0e-01i) 5.0000005960464832810e-1+4.9999994039535877732e-1i)
(num-test (sqrt 1.19209289550781250e-07-5.0e-01i) 5.0000005960464832810e-1-4.9999994039535877732e-1i)
(num-test (sqrt -1.19209289550781250e-07+5.0e-01i) 4.9999994039535877732e-1+5.0000005960464832810e-1i)
(num-test (sqrt -1.19209289550781250e-07-5.0e-01i) 4.9999994039535877732e-1-5.0000005960464832810e-1i)
(num-test (sqrt 1.19209289550781250e-07+1.0e+00i) 7.0710682333339729137e-1+7.0710673903970026958e-1i)
(num-test (sqrt 1.19209289550781250e-07-1.0e+00i) 7.0710682333339729137e-1-7.0710673903970026958e-1i)
(num-test (sqrt -1.19209289550781250e-07+1.0e+00i) 7.0710673903970026958e-1+7.0710682333339729137e-1i)
(num-test (sqrt -1.19209289550781250e-07-1.0e+00i) 7.0710673903970026958e-1-7.0710682333339729137e-1i)
(num-test (sqrt 1.19209289550781250e-07+2.0e+00i) 1.0000000298023228318e0+9.9999997019767805639e-1i)
(num-test (sqrt 1.19209289550781250e-07-2.0e+00i) 1.0000000298023228318e0-9.9999997019767805639e-1i)
(num-test (sqrt -1.19209289550781250e-07+2.0e+00i) 9.9999997019767805639e-1+1.0000000298023228318e0i)
(num-test (sqrt -1.19209289550781250e-07-2.0e+00i) 9.9999997019767805639e-1-1.0000000298023228318e0i)
(num-test (sqrt 1.19209289550781250e-07+8.3886080e+06i) 2.0480000000000145519e3+2.0479999999999854481e3i)
(num-test (sqrt 1.19209289550781250e-07-8.3886080e+06i) 2.0480000000000145519e3-2.0479999999999854481e3i)
(num-test (sqrt -1.19209289550781250e-07+8.3886080e+06i) 2.0479999999999854481e3+2.0480000000000145519e3i)
(num-test (sqrt -1.19209289550781250e-07-8.3886080e+06i) 2.0479999999999854481e3-2.0480000000000145519e3i)
(num-test (sqrt 5.0e-01+0.0e+00i) 7.0710678118654752440e-1+0.0i)
(num-test (sqrt -5.0e-01+0.0e+00i) 0+7.0710678118654752440e-1i)
(num-test (sqrt 5.0e-01+1.19209289550781250e-07i) 7.0710678118655254870e-1+8.4293697021787464631e-8i)
(num-test (sqrt 5.0e-01-1.19209289550781250e-07i) 7.0710678118655254870e-1-8.4293697021787464631e-8i)
(num-test (sqrt -5.0e-01+1.19209289550781250e-07i) 8.4293697021787464631e-8+7.0710678118655254870e-1i)
(num-test (sqrt -5.0e-01-1.19209289550781250e-07i) 8.4293697021787464631e-8-7.0710678118655254870e-1i)
(num-test (sqrt 5.0e-01+5.0e-01i) 7.7688698701501865367e-1+3.2179712645279131237e-1i)
(num-test (sqrt 5.0e-01-5.0e-01i) 7.7688698701501865367e-1-3.2179712645279131237e-1i)
(num-test (sqrt -5.0e-01+5.0e-01i) 3.2179712645279131237e-1+7.7688698701501865367e-1i)
(num-test (sqrt -5.0e-01-5.0e-01i) 3.2179712645279131237e-1-7.7688698701501865367e-1i)
(num-test (sqrt 5.0e-01+1.0e+00i) 8.9945371997393363613e-1+5.5589297025142117199e-1i)
(num-test (sqrt 5.0e-01-1.0e+00i) 8.9945371997393363613e-1-5.5589297025142117199e-1i)
(num-test (sqrt -5.0e-01+1.0e+00i) 5.5589297025142117199e-1+8.9945371997393363613e-1i)
(num-test (sqrt -5.0e-01-1.0e+00i) 5.5589297025142117199e-1-8.9945371997393363613e-1i)
(num-test (sqrt 5.0e-01+2.0e+00i) 1.1317139242778694103e0+8.8361553087551326576e-1i)
(num-test (sqrt 5.0e-01-2.0e+00i) 1.1317139242778694103e0-8.8361553087551326576e-1i)
(num-test (sqrt -5.0e-01+2.0e+00i) 8.8361553087551326576e-1+1.1317139242778694103e0i)
(num-test (sqrt -5.0e-01-2.0e+00i) 8.8361553087551326576e-1-1.1317139242778694103e0i)
(num-test (sqrt 5.0e-01+8.3886080e+06i) 2.0480000610351571595e3+2.0479999389648446595e3i)
(num-test (sqrt 5.0e-01-8.3886080e+06i) 2.0480000610351571595e3-2.0479999389648446595e3i)
(num-test (sqrt -5.0e-01+8.3886080e+06i) 2.0479999389648446595e3+2.0480000610351571595e3i)
(num-test (sqrt -5.0e-01-8.3886080e+06i) 2.0479999389648446595e3-2.0480000610351571595e3i)
(num-test (sqrt 1.0e+00+0.0e+00i) 1e0+0.0i)
(num-test (sqrt -1.0e+00+0.0e+00i) 0+1i)
(num-test (sqrt 1.0e+00+1.19209289550781250e-07i) 1.0000000000000017764e0+5.9604644775390519121e-8i)
(num-test (sqrt 1.0e+00-1.19209289550781250e-07i) 1.0000000000000017764e0-5.9604644775390519121e-8i)
(num-test (sqrt -1.0e+00+1.19209289550781250e-07i) 5.9604644775390519121e-8+1.0000000000000017764e0i)
(num-test (sqrt -1.0e+00-1.19209289550781250e-07i) 5.9604644775390519121e-8-1.0000000000000017764e0i)
(num-test (sqrt 1.0e+00+5.0e-01i) 1.0290855136357461252e0+2.4293413587832283909e-1i)
(num-test (sqrt 1.0e+00-5.0e-01i) 1.0290855136357461252e0-2.4293413587832283909e-1i)
(num-test (sqrt -1.0e+00+5.0e-01i) 2.4293413587832283909e-1+1.0290855136357461252e0i)
(num-test (sqrt -1.0e+00-5.0e-01i) 2.4293413587832283909e-1-1.0290855136357461252e0i)
(num-test (sqrt 1.0e+00+1.0e+00i) 1.0986841134678099660e0+4.5508986056222734130e-1i)
(num-test (sqrt 1.0e+00-1.0e+00i) 1.0986841134678099660e0-4.5508986056222734130e-1i)
(num-test (sqrt -1.0e+00+1.0e+00i) 4.5508986056222734130e-1+1.0986841134678099660e0i)
(num-test (sqrt -1.0e+00-1.0e+00i) 4.5508986056222734130e-1-1.0986841134678099660e0i)
(num-test (sqrt 1.0e+00+2.0e+00i) 1.2720196495140689643e0+7.8615137775742328607e-1i)
(num-test (sqrt 1.0e+00-2.0e+00i) 1.2720196495140689643e0-7.8615137775742328607e-1i)
(num-test (sqrt -1.0e+00+2.0e+00i) 7.8615137775742328607e-1+1.2720196495140689643e0i)
(num-test (sqrt -1.0e+00-2.0e+00i) 7.8615137775742328607e-1-1.2720196495140689643e0i)
(num-test (sqrt 1.0e+00+8.3886080e+06i) 2.0480001220703161380e3+2.0479998779296911380e3i)
(num-test (sqrt 1.0e+00-8.3886080e+06i) 2.0480001220703161380e3-2.0479998779296911380e3i)
(num-test (sqrt -1.0e+00+8.3886080e+06i) 2.0479998779296911380e3+2.0480001220703161380e3i)
(num-test (sqrt -1.0e+00-8.3886080e+06i) 2.0479998779296911380e3-2.0480001220703161380e3i)
(num-test (sqrt 2.0e+00+0.0e+00i) 1.4142135623730950488e0+0.0i)
(num-test (sqrt -2.0e+00+0.0e+00i) 0+1.4142135623730950488e0i)
(num-test (sqrt 2.0e+00+1.19209289550781250e-07i) 1.4142135623730956768e0+4.2146848510894013070e-8i)
(num-test (sqrt 2.0e+00-1.19209289550781250e-07i) 1.4142135623730956768e0-4.2146848510894013070e-8i)
(num-test (sqrt -2.0e+00+1.19209289550781250e-07i) 4.2146848510894013070e-8+1.4142135623730956768e0i)
(num-test (sqrt -2.0e+00-1.19209289550781250e-07i) 4.2146848510894013070e-8-1.4142135623730956768e0i)
(num-test (sqrt 2.0e+00+5.0e-01i) 1.4250531240639470060e0+1.7543205637629383228e-1i)
(num-test (sqrt 2.0e+00-5.0e-01i) 1.4250531240639470060e0-1.7543205637629383228e-1i)
(num-test (sqrt -2.0e+00+5.0e-01i) 1.7543205637629383228e-1+1.4250531240639470060e0i)
(num-test (sqrt -2.0e+00-5.0e-01i) 1.7543205637629383228e-1-1.4250531240639470060e0i)
(num-test (sqrt 2.0e+00+1.0e+00i) 1.4553466902253548081e0+3.4356074972251246414e-1i)
(num-test (sqrt 2.0e+00-1.0e+00i) 1.4553466902253548081e0-3.4356074972251246414e-1i)
(num-test (sqrt -2.0e+00+1.0e+00i) 3.4356074972251246414e-1+1.4553466902253548081e0i)
(num-test (sqrt -2.0e+00-1.0e+00i) 3.4356074972251246414e-1-1.4553466902253548081e0i)
(num-test (sqrt 2.0e+00+2.0e+00i) 1.5537739740300373073e0+6.4359425290558262474e-1i)
(num-test (sqrt 2.0e+00-2.0e+00i) 1.5537739740300373073e0-6.4359425290558262474e-1i)
(num-test (sqrt -2.0e+00+2.0e+00i) 6.4359425290558262474e-1+1.5537739740300373073e0i)
(num-test (sqrt -2.0e+00-2.0e+00i) 6.4359425290558262474e-1-1.5537739740300373073e0i)
(num-test (sqrt 2.0e+00+8.3886080e+06i) 2.0480002441406395519e3+2.0479997558593895519e3i)
(num-test (sqrt 2.0e+00-8.3886080e+06i) 2.0480002441406395519e3-2.0479997558593895519e3i)
(num-test (sqrt -2.0e+00+8.3886080e+06i) 2.0479997558593895519e3+2.0480002441406395519e3i)
(num-test (sqrt -2.0e+00-8.3886080e+06i) 2.0479997558593895519e3-2.0480002441406395519e3i)
(num-test (sqrt 8.3886080e+06+0.0e+00i) 2.8963093757400986599e3+0.0i)
(num-test (sqrt -8.3886080e+06+0.0e+00i) 0+2.8963093757400986599e3i)
(num-test (sqrt 8.3886080e+06+1.19209289550781250e-07i) 2.8963093757400986599e3+2.0579515874459976458e-11i)
(num-test (sqrt 8.3886080e+06-1.19209289550781250e-07i) 2.8963093757400986599e3-2.0579515874459976458e-11i)
(num-test (sqrt -8.3886080e+06+1.19209289550781250e-07i) 2.0579515874459976458e-11+2.8963093757400986599e3i)
(num-test (sqrt -8.3886080e+06-1.19209289550781250e-07i) 2.0579515874459976458e-11-2.8963093757400986599e3i)
(num-test (sqrt 8.3886080e+06+5.0e-01i) 2.8963093757400999462e3+8.6316745750310938767e-5i)
(num-test (sqrt 8.3886080e+06-5.0e-01i) 2.8963093757400999462e3-8.6316745750310938767e-5i)
(num-test (sqrt -8.3886080e+06+5.0e-01i) 8.6316745750310938767e-5+2.8963093757400999462e3i)
(num-test (sqrt -8.3886080e+06-5.0e-01i) 8.6316745750310938767e-5-2.8963093757400999462e3i)
(num-test (sqrt 8.3886080e+06+1.0e+00i) 2.8963093757401038048e3+1.7263349150062164754e-4i)
(num-test (sqrt 8.3886080e+06-1.0e+00i) 2.8963093757401038048e3-1.7263349150062164754e-4i)
(num-test (sqrt -8.3886080e+06+1.0e+00i) 1.7263349150062164754e-4+2.8963093757401038048e3i)
(num-test (sqrt -8.3886080e+06-1.0e+00i) 1.7263349150062164754e-4-2.8963093757401038048e3i)
(num-test (sqrt 8.3886080e+06+2.0e+00i) 2.8963093757401192395e3+3.4526698300124145513e-4i)
(num-test (sqrt 8.3886080e+06-2.0e+00i) 2.8963093757401192395e3-3.4526698300124145513e-4i)
(num-test (sqrt -8.3886080e+06+2.0e+00i) 3.4526698300124145513e-4+2.8963093757401192395e3i)
(num-test (sqrt -8.3886080e+06-2.0e+00i) 3.4526698300124145513e-4-2.8963093757401192395e3i)
(num-test (sqrt 8.3886080e+06+8.3886080e+06i) 3.1821290988135164054e3+1.3180810299506332155e3i)
(num-test (sqrt 8.3886080e+06-8.3886080e+06i) 3.1821290988135164054e3-1.3180810299506332155e3i)
(num-test (sqrt -8.3886080e+06+8.3886080e+06i) 1.3180810299506332155e3+3.1821290988135164054e3i)
(num-test (sqrt -8.3886080e+06-8.3886080e+06i) 1.3180810299506332155e3-3.1821290988135164054e3i)
(num-test (sqrt -1.0e+01) 0+3.1622776601683793320e0i)
(num-test (sqrt -2.0e+00) 0+1.4142135623730950488e0i)
(num-test (sqrt -1.0e+00) 0+1i)
(num-test (sqrt -7.50e-01) 0+8.6602540378443864676e-1i)
(num-test (sqrt -5.0e-01) 0+7.0710678118654752440e-1i)
(num-test (sqrt -1.250e-01) 0+3.5355339059327376220e-1i)
(num-test (sqrt -3.45266983001243932001e-04) 0+1.8581361171917517303e-2i)
(num-test (sqrt -1.19209289550781250e-07) 0+3.4526698300124390840e-4i)
(num-test (sqrt 0.0e+00) 0e0+0.0i)
(num-test (sqrt 1.19209289550781250e-07) 3.4526698300124390840e-4+0.0i)
(num-test (sqrt 3.45266983001243932001e-04) 1.8581361171917517303e-2+0.0i)
(num-test (sqrt 1.250e-01) 3.5355339059327376220e-1+0.0i)
(num-test (sqrt 5.0e-01) 7.0710678118654752440e-1+0.0i)
(num-test (sqrt 7.50e-01) 8.6602540378443864676e-1+0.0i)
(num-test (sqrt 1.0e+00) 1e0+0.0i)
(num-test (sqrt 2.0e+00) 1.4142135623730950488e0+0.0i)
(num-test (sqrt 1.0e+01) 3.1622776601683793320e0+0.0i)
(num-test (sqrt 9) 3)
(num-test (sqrt -9.0) 0.0+3.0i)
(num-test (sqrt (sqrt (sqrt 256))) 2)
(num-test (sqrt (sqrt (sqrt 1/256))) 1/2)
(num-test (sqrt 0.1-111i) 7.4531887486175-7.4464771887462i)
(num-test (sqrt -2.225073858507201399999999999999999999996E-308) 0.0+1.49166814624004135432626585974344862306E-154i)
(num-test (sqrt -9223372036854775808) 0.0+3.037000499976049692451388530026308346744E9i)
(num-test (sqrt 1.110223024625156799999999999999999999997E-16) 1.053671212772350917851343014434652692451E-8)
(num-test (sqrt 9223372036854775807) 3.037000499976049692286752403030628535068E9)

(num-test (sqrt (* 64686/26264 64686/26264)) 32343/13132)
(num-test (sqrt (* 64812/61611 64812/61611)) 1964/1867)
(num-test (sqrt (* 38868/48261 38868/48261)) 12956/16087)
(num-test (sqrt (* 39537/63628 39537/63628)) 39537/63628)
(num-test (sqrt (* 1238/47077 1238/47077)) 1238/47077)
(num-test (sqrt (* 51490/46936 51490/46936)) 25745/23468)
(num-test (sqrt (* 35778/34583 35778/34583)) 35778/34583)
(num-test (sqrt (* 19920/16774 19920/16774)) 9960/8387)
(num-test (sqrt (* 29100/37656 29100/37656)) 2425/3138)
(num-test (sqrt (* 64906/58229 64906/58229)) 64906/58229)
(num-test (sqrt 144) 12)
(num-test (sqrt 9000000000000000000) 3000000000)
;; but unfortunately in non-gmp, 9400000000000000000 -> -9046744073709551616

(test (and (integer? (sqrt 9007199136250226)) (exact? (sqrt 9007199136250226))) #f)
(test (and (integer? (sqrt 9007199136250225)) (exact? (sqrt 9007199136250225))) #t)

(when (integer? (sqrt 4))
  (for-each
   (lambda (n sqn)
     (if (positive? n) ; in case 32 bit int
	 (let ((val (sqrt n)))
	   (if (or (not (integer? val))
		   (not (eqv? sqn val)))
	       (format #t ";(sqrt ~A) expected ~A but got ~A~%" n sqn val)))))
   (list 9 491401 19439281 1248844921 235565593201)
   (list 3 701 4409 35339 485351))
  
  (for-each
   (lambda (n)
     (if (positive? n)
	 (let ((val (sqrt n)))
	   (if (or (integer? val)
		   (> (abs (- (* val val) n)) .001))
	       (format #t ";(sqrt ~A) expected ~A but got ~A~%" n (sqrt (* 1.0 n)) val)))))
   (list 10 491400 19439282 1248844920 235565593200))
  
  (test (eqv? (expt 2 3) 8) #t)
					;(test (eqv? (log 8 2) 3) #t) ; optimization in C (-O2) changes this
  (num-test (log 8 2) 3)
  (num-test (log 1/8 2) -3)
  (test (eqv? (expt 701 2) 491401) #t)
  (test (eqv? (log 491401 701) 2) #t))

(let ((err 0.0)
      (mx 0.0))
  (do ((i 0 (+ i 1))
       (x -10.0 (+ x .1)))
      ((= i 200))
    (let ((y (magnitude (- x (* (sqrt x) (sqrt x))))))
      (if (> y err) (begin (set! mx x) (set! err y)))))
  (if (> err 1e-14)
      (format #t ";(sqr (sqrt ~A)) error: ~A~%" mx err)))

(let ((err 0.0)
      (mx 0.0))
  (do ((i 0 (+ i 1))
       (x -10.0+i (+ x .1+i)))
      ((= i 200))
    (let ((y (magnitude (- x (* (sqrt x) (sqrt x))))))
      (if (> y err) (begin (set! mx x) (set! err y)))))
  (if (> err 1e-12)
      (format #t ";(sqr (sqrt ~A)) error: ~A~%" mx err)))

(num-test (* (/ 4 (sqrt 522)) 
	     (log (* (expt (/ (+ 5 (sqrt 29)) (sqrt 2)) 3) 
		     (+ (* 5 (sqrt 29)) (* 11 (sqrt 6))) 
		     (expt (+ (sqrt (/ (+ 9 (* 3 (sqrt 6))) 4))
			      (sqrt (/ (+ 5 (* 3 (sqrt 6))) 4))) 6)))) ;31 digits
	  pi)

(num-test (let* ((N 3502)
		 (D (* 1/2 (+ 1071 (* 184 (sqrt 34)))))
		 (E (* 1/2 (+ 1553 (* 266 (sqrt 34)))))
		 (F (+ 429 (* 304 (sqrt 2))))
		 (G (* 1/2 (+ 627 (* 442 (sqrt 2)))))
		 (d1 (+ D (sqrt (- (* D D) 1))))
		 (e1 (+ E (sqrt (- (* E E) 1))))
		 (f1 (+ F (sqrt (- (* F F) 1))))
		 (g1 (+ G (sqrt (- (* G G) 1))))
		 (defg (* 2 d1 e1 f1 g1)))
	    (* (/ (sqrt N)) (- (log (expt defg -6)))))
	  pi)

(num-test (let* ((N 2737)
		 (D (* 1/2 (+ 621 (* 49 (sqrt 161)))))
		 (E (* 1/4 (+ 321 (* 25 (sqrt 161)))))
		 (F (* 1/4 (+ 393 (* 31 (sqrt 161)))))
		 (G (* 1/4 (+ 2529 (* 199 (sqrt 161)))))
		 (d (+ D (sqrt (- (* D D) 1))))
		 (e (+ E (sqrt (- (* E E) 1))))
		 (f (+ F (sqrt (- (* F F) 1))))
		 (g (+ G (sqrt (- (* G G) 1))))
		 (defg (* 2 d e f g)))
	    (* (/ (sqrt N)) (- (log (abs (* -1 (expt defg -6)))))))
	  pi) ; Newman and Shanks "On a Sequence Arising in Series for pi"

(num-test (let* ((an (sqrt 2)) ; Borwein and Borwein "AGM Mean and Fast Computation"
		 (bn 0)
		 (pn (+ 2 (sqrt 2))))
	    (do ((i 0 (+ i 1)))
		((= i 4) pn)
	      (let* ((sqa (sqrt an))
		     (an1 (* 1/2 (+ sqa (/ 1.0 sqa))))
		     (bn1 (* sqa (/ (+ bn 1) (+ bn an))))
		     (pn1 (* pn bn1 (/ (+ an1 1) (+ bn1 1)))))
		(set! pn pn1)
		(set! bn bn1)
		(set! an an1))))
	  pi)

(when with-bignums
  (num-test (sqrt 340282366920938463463374607431768211456) 18446744073709551616)
  (num-test (sqrt 32317006071311007300714876688669951960444102669715484032130345427524655138867890893197201411522913463688717960921898019494119559150490921095088152386448283120630877367300996091750197750389652106796057638384067568276792218642619756161838094338476170470581645852036305042887575891541065808607552399123930385521914333389668342420684974786564569494856176035326322058077805659331026192708460314150258592864177116725943603718461857357598351152301645904403697613233287231227125684710820209725157101726931323469678542580656697935045997268352998638215525166389437335543602135433229604645318478604952148193555853611059596230656) 179769313486231590772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357658789768814416622492847430639474124377767893424865485276302219601246094119453082952085005768838150682342462881473913110540827237163350510684586298239947245938479716304835356329624224137216)
  (num-test (sqrt 1208925819614629174706176/717897987691852588770249) 1099511627776/847288609443)
  (num-test (sqrt (/ (* 1.0 (expt 2 80)) (expt 3 50))) 1.297682531692252029863335918836296060669E0)
  (num-test (sqrt -340282366920938463463374607431768211456) 0.0+1.8446744073709551616E19i)
  (num-test (sqrt 0+340282366920938463463374607431768211456i) 1.304381782533278221234957180625250836888E19+1.304381782533278221234957180625250836888E19i))

(test (sqrt) 'error)
(test (sqrt "hi") 'error)
(test (sqrt 1.0+23.0i 1.0+23.0i) 'error)

(for-each
 (lambda (arg)
   (test (sqrt arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))

(num-test (sqrt 1/1073741824) 1/32768)
(num-test (sqrt 1/274877906944) 1/524288)
(num-test (sqrt 9223372030926249001) 3037000499)
(num-test (sqrt 1/274877906944) 1/524288)
(num-test (sqrt 1/1099511627776) 1/1048576)
(num-test (sqrt 1/4398046511104) (sqrt (/ (expt 2 42))))
(num-test (sqrt 1/4611686018427387904) 1/2147483648)
(num-test (sqrt 1/1152921504606846976) 1/1073741824)
(num-test (sqrt 1/9223372030926249001) 1/3037000499)
(num-test (sqrt 0+i) (/ 1+i (sqrt 2)))
(num-test (+ 0-i(sqrt 00)) 0-i)
(num-test (sqrt (* 1.2345e-127 1.2345e-127)) 1.2345e-127)
(num-test (sqrt (* 1.2345e-27 1.2345e-27)) 1.2345e-27)
(num-test (sqrt 13) (do ((i 1 (+ i 1)) (prod 1.0 (* prod (tan (/ (* i pi) 13))))) ((= i 7) prod)))
(num-test (* 768 (sqrt (- 2 (sqrt (+ 2 (sqrt (+ 2 (sqrt (+ 2 (sqrt (+ 2 (sqrt (+ 2 (sqrt (+ 2 (sqrt (+ 2 (sqrt (+ 2 1))))))))))))))))))) 3.1415904632368)

(for-each
 (lambda (num-and-val)
   (let ((num (car num-and-val)) (val (cadr num-and-val))) (num-test-1 'sqrt num (sqrt num) val)))
 (vector (list 0 0) (list 1 1) (list 2 1.4142135623731) (list 3 1.7320508075689) (list -1 0+1i) 
	 (list -2 0+1.4142135623731i) (list -3 0+1.7320508075689i) (list 9223372036854775807 3037000499.976) 
	 (list -9223372036854775808 0+3037000499.976i) (list 1/2 0.70710678118655) (list 1/3 0.57735026918963) 
	 (list -1/2 0+0.70710678118655i) (list -1/3 0+0.57735026918963i) (list 1/9223372036854775807 3.2927225399136e-10) 
	 (list 0.0 0.0) (list 1.0 1.0) (list 2.0 1.4142135623731) (list -2.0 0+1.4142135623731i) 
	 (list 1.000000000000000000000000000000000000002E-309 3.162277660168379331998893544432718533725E-155) 
	 (list 1e+16 100000000.0) (list 0+1i 0.70710678118655+0.70710678118655i) (list 0+2i 1+1i) 
	 (list 0-1i 0.70710678118655-0.70710678118655i) (list 1+1i 1.0986841134678+0.45508986056223i) 
	 (list 1-1i 1.0986841134678-0.45508986056223i) (list -1+1i 0.45508986056223+1.0986841134678i) 
	 (list -1-1i 0.45508986056223-1.0986841134678i) (list 0.1+0.1i 0.34743442276012+0.14391204994251i) 
	 (list 1e+16+1e+16i 109868411.34678+45508986.056223i) (list 1e-16+1e-16i 1.0986841134678e-08+4.5508986056223e-09i) 
	 ))
  
(let ((sqrts (list
	      1.00000000000000000000000000000000000000000000000000000000000000000000
	      1.41421356237309504880168872420969807856967187537694807317667973799073
	      1.73205080756887729352744634150587236694280525381038062805580697945193
	      2.00000000000000000000000000000000000000000000000000000000000000000000
	      2.23606797749978969640917366873127623544061835961152572427089724541052
	      2.44948974278317809819728407470589139196594748065667012843269256725096
	      2.64575131106459059050161575363926042571025918308245018036833445920106
	      2.82842712474619009760337744841939615713934375075389614635335947598146
	      3.00000000000000000000000000000000000000000000000000000000000000000000
	      3.16227766016837933199889354443271853371955513932521682685750485279259
	      3.31662479035539984911493273667068668392708854558935359705868214611648
	      3.46410161513775458705489268301174473388561050762076125611161395890386
	      3.60555127546398929311922126747049594625129657384524621271045305622716
	      3.74165738677394138558374873231654930175601980777872694630374546732003
	      3.87298334620741688517926539978239961083292170529159082658757376611348
	      4.00000000000000000000000000000000000000000000000000000000000000000000
	      4.12310562561766054982140985597407702514719922537362043439863357309495
	      4.24264068711928514640506617262909423570901562613084421953003921397219
	      4.35889894354067355223698198385961565913700392523244493689034413815955
	      4.47213595499957939281834733746255247088123671922305144854179449082104
	      4.58257569495584000658804719372800848898445657676797190260724212390686
	      4.69041575982342955456563011354446628058822835341173715360570189101702
	      4.79583152331271954159743806416269391999670704190412934648530911444825
	      4.89897948556635619639456814941178278393189496131334025686538513450192
	      5.00000000000000000000000000000000000000000000000000000000000000000000
	      5.09901951359278483002822410902278198956377094609959640758497080442593
	      5.19615242270663188058233902451761710082841576143114188416742093835579
	      5.29150262212918118100323150727852085142051836616490036073666891840213
	      5.38516480713450403125071049154032955629512016164478883768038867001664
	      5.47722557505166113456969782800802133952744694997983254226894449732493
	      5.56776436283002192211947129891854952047639337757041430396843258560358
	      5.65685424949238019520675489683879231427868750150779229270671895196292
	      5.74456264653802865985061146821892931822026445798279236769987747056590
	      5.83095189484530047087415287754558307652139833488597195445000674486781
	      5.91607978309961604256732829156161704841550123079434032287971966914282
	      6.00000000000000000000000000000000000000000000000000000000000000000000
	      6.08276253029821968899968424520206706208497009478641118641915304648633
	      6.16441400296897645025019238145424422523562402344457454487457207245839
	      6.24499799839839820584689312093979446107295997799165630845297193060961
	      6.32455532033675866399778708886543706743911027865043365371500970558518)))
  (let ((mxerr 0.0))
    (do ((i 1 (+ i 1)))
	((> i 40))
      (let ((err (abs (- (sqrt i) (list-ref sqrts (- i 1))))))
	(if (> err mxerr)
	    (set! mxerr err))))
    (if (> mxerr 1e-12) (format #t "sqrt err: ~A~%" mxerr))))

(when with-bignums
  (num-test (/ (sqrt (* 1.2345e-170 1.2345e-170))) 8.100445524503847216161209708816501953798E169)
  (num-test (sqrt (expt 2 32)) 65536)
  (num-test (sqrt -1.797693134862315699999999999999999999998E308) 0.0+1.34078079299425963249160560140156653105E154i)
  (num-test (exp (* pi (sqrt (bignum "163")))) 2.625374126407687439999999999992500725895E17)
  (let-temporarily (((*s7* 'bignum-precision) 500))
    (let ((sqrts (list ; table[Sqrt[k/10], {k, 0, 30}]
		  0.00000000000000000000000000000000000000000000000000000000000000000000e0
		  0.31622776601683793319988935444327185337195551393252168268575048527925
		  0.44721359549995793928183473374625524708812367192230514485417944908210
		  0.54772255750516611345696978280080213395274469499798325422689444973249
		  0.63245553203367586639977870888654370674391102786504336537150097055851
		  0.70710678118654752440084436210484903928483593768847403658833986899536
		  0.77459666924148337703585307995647992216658434105831816531751475322269
		  0.83666002653407554797817202578518748939281536929867219981119154308041
		  0.89442719099991587856366946749251049417624734384461028970835889816420
		  0.94868329805051379959966806332981556011586654179756504805725145583777
		  1.00000000000000000000000000000000000000000000000000000000000000000000
		  1.04880884817015154699145351367993759847527185768150398487575576358000
		  1.09544511501033222691393956560160426790548938999596650845378889946498
		  1.14017542509913797913604902556675447907600531091641037529746941724956
		  1.18321595661992320851346565831232340968310024615886806457594393382856
		  1.22474487139158904909864203735294569598297374032833506421634628362548
		  1.26491106406735173279955741777308741348782205573008673074300194111703
		  1.30384048104052974291659431148583688330561875578201309179007936989676
		  1.34164078649987381784550420123876574126437101576691543456253834724631
		  1.37840487520902217679559125529341754271981635583990014790642120179806
		  1.41421356237309504880168872420969807856967187537694807317667973799073
		  1.44913767461894385737186641571697717231401328747589730886959248071181
		  1.48323969741913258974227948816014261219598086381950031974652465286876
		  1.51657508881031011085136508725641431090992842790349245064524200355844
		  1.54919333848296675407170615991295984433316868211663633063502950644539
		  1.58113883008418966599944677221635926685977756966260841342875242639629
		  1.61245154965970993047332264606075422622687926112171467758731847785277
		  1.64316767251549834037090934840240640185823408499394976268068334919747
		  1.67332005306815109595634405157037497878563073859734439962238308616083
		  1.70293863659264011661333218238773227063897151909784216273026969624657
		  1.73205080756887729352744634150587236694280525381038062805580697945193)))
      (do ((i 0 (+ i 1)))
	  ((= i 30))
	(let ((val (sqrt (/ i (bignum "10")))))
	  (if (> (magnitude (- val (list-ref sqrts i))) 1e-36)
	      (format #t ";(sqrt ~A) -> ~A ~A~%[~A]~%" (/ i 10) val (list-ref sqrts i) (magnitude (- val (list-ref sqrts i))))))))))




;;; --------------------------------------------------------------------------------
;;; exp
;;; --------------------------------------------------------------------------------

(num-test (exp 0) 1.0)
(num-test (exp 1) 2.71828182845905)
(num-test (exp -1) 0.36787944117144)
(num-test (exp 2) 7.38905609893065)
(num-test (exp -2) 0.13533528323661)
(num-test (exp 3) 20.08553692318767)
(num-test (exp -3) 0.04978706836786)
(num-test (exp 10) 22026.46579480671789)
(num-test (exp -10) 0.00004539992976)
(num-test (exp 0/1) 1.0)
(num-test (exp 0/2) 1.0)
(num-test (exp 0/3) 1.0)
(num-test (exp 0/10) 1.0)
(num-test (exp 0/1234) 1.0)
(num-test (exp 0/1234000000) 1.0)
(num-test (exp 0/500029) 1.0)
(num-test (exp 0/362880) 1.0)
(num-test (exp 1/1) 2.71828182845905)
(num-test (exp -1/1) 0.36787944117144)
(num-test (exp 1/2) 1.64872127070013)
(num-test (exp -1/2) 0.60653065971263)
(num-test (exp 1/3) 1.39561242508609)
(num-test (exp -1/3) 0.71653131057379)
(num-test (exp 1/10) 1.10517091807565)
(num-test (exp -1/10) 0.90483741803596)
(num-test (exp 1/1234) 1.00081070121220)
(num-test (exp -1/1234) 0.99918995549186)
(num-test (exp 1/1234000000) 1.00000000081037)
(num-test (exp -1/1234000000) 0.99999999918963)
(num-test (exp 1/500029) 1.00000199988601)
(num-test (exp -1/500029) 0.99999800011799)
(num-test (exp 1/362880) 1.00000275573572)
(num-test (exp -1/362880) 0.99999724427187)
(num-test (exp 2/1) 7.38905609893065)
(num-test (exp -2/1) 0.13533528323661)
(num-test (exp 2/2) 2.71828182845905)
(num-test (exp -2/2) 0.36787944117144)
(num-test (exp 2/3) 1.94773404105468)
(num-test (exp -2/3) 0.51341711903259)
(num-test (exp 2/10) 1.22140275816017)
(num-test (exp -2/10) 0.81873075307798)
(num-test (exp 2/1234) 1.00162205966086)
(num-test (exp -2/1234) 0.99838056715583)
(num-test (exp 2/1234000000) 1.00000000162075)
(num-test (exp -2/1234000000) 0.99999999837925)
(num-test (exp 2/500029) 1.00000399977601)
(num-test (exp -2/500029) 0.99999600023999)
(num-test (exp 2/362880) 1.00000551147903)
(num-test (exp -2/362880) 0.99999448855134)
(num-test (exp 3/1) 20.08553692318767)
(num-test (exp -3/1) 0.04978706836786)
(num-test (exp 3/2) 4.48168907033806)
(num-test (exp -3/2) 0.22313016014843)
(num-test (exp 3/3) 2.71828182845905)
(num-test (exp -3/3) 0.36787944117144)
(num-test (exp 3/10) 1.34985880757600)
(num-test (exp -3/10) 0.74081822068172)
(num-test (exp 3/1234) 1.00243407587880)
(num-test (exp -3/1234) 0.99757183446037)
(num-test (exp 3/1234000000) 1.00000000243112)
(num-test (exp -3/1234000000) 0.99999999756888)
(num-test (exp 3/500029) 1.00000599967002)
(num-test (exp -3/500029) 0.99999400036598)
(num-test (exp 3/362880) 1.00000826722994)
(num-test (exp -3/362880) 0.99999173283841)
(num-test (exp 10/1) 22026.46579480671789)
(num-test (exp -10/1) 0.00004539992976)
(num-test (exp 10/2) 148.41315910257660)
(num-test (exp -10/2) 0.00673794699909)
(num-test (exp 10/3) 28.03162489452614)
(num-test (exp -10/3) 0.03567399334725)
(num-test (exp 10/10) 2.71828182845905)
(num-test (exp -10/10) 0.36787944117144)
(num-test (exp 10/1234) 1.00813665179201)
(num-test (exp -10/1234) 0.99192901897025)
(num-test (exp 10/1234000000) 1.00000000810373)
(num-test (exp -10/1234000000) 0.99999999189627)
(num-test (exp 10/500029) 1.00001999904005)
(num-test (exp -10/500029) 0.99998000135991)
(num-test (exp 10/362880) 1.00002755769893)
(num-test (exp -10/362880) 0.99997244306048)
(num-test (exp 1234/1234) 2.71828182845905)
(num-test (exp -1234/1234) 0.36787944117144)
(num-test (exp 1234/1234000000) 1.00000100000050)
(num-test (exp -1234/1234000000) 0.99999900000050)
(num-test (exp 1234/500029) 1.00247090452960)
(num-test (exp -1234/500029) 0.99753518579099)
(num-test (exp 1234/362880) 1.00340636170081)
(num-test (exp -1234/362880) 0.99660520220837)
(num-test (exp 1234000000/1234000000) 2.71828182845905)
(num-test (exp -1234000000/1234000000) 0.36787944117144)
(num-test (exp 500029/1234000000) 1.00040529199516)
(num-test (exp -500029/1234000000) 0.99959487219989)
(num-test (exp 500029/500029) 2.71828182845905)
(num-test (exp -500029/500029) 0.36787944117144)
(num-test (exp 500029/362880) 3.96674507247837)
(num-test (exp -500029/362880) 0.25209585736630)
(num-test (exp 362880/1234000000) 1.00029411131357)
(num-test (exp -362880/1234000000) 0.99970597516246)
(num-test (exp 362880/500029) 2.06621391988774)
(num-test (exp -362880/500029) 0.48397699307646)
(num-test (exp 362880/362880) 2.71828182845905)
(num-test (exp -362880/362880) 0.36787944117144)
(num-test (exp 0.0) 1.0)
(num-test (exp 0.00000001) 1.00000001)
(num-test (exp -0.00000001) 0.99999999000000)
(num-test (exp 1.0) 2.71828182845905)
(num-test (exp -1.0) 0.36787944117144)
(num-test (exp pi) 23.14069263277927)
(num-test (exp -3.14159265358979) 0.04321391826377)
(num-test (exp 2.71828182845905) 15.15426224147926)
(num-test (exp -2.71828182845905) 0.06598803584531)
(num-test (exp 0.0+0.0i) 1.0)
(num-test (exp -0.0+0.0i) 1.0)
(num-test (exp 0.0-0.0i) 1.0)
(num-test (exp -0.0-0.0i) 1.0)
(num-test (exp 0.0+0.00000001i) 1.0+0.00000001i)
(num-test (exp -0.0+0.00000001i) 1.0+0.00000001i)
(num-test (exp 0.0-0.00000001i) 1.0-0.00000001i)
(num-test (exp -0.0-0.00000001i) 1.0-0.00000001i)
(num-test (exp 0.0+1.0i) 0.54030230586814+0.84147098480790i)
(num-test (exp -0.0+1.0i) 0.54030230586814+0.84147098480790i)
(num-test (exp 0.0-1.0i) 0.54030230586814-0.84147098480790i)
(num-test (exp -0.0-1.0i) 0.54030230586814-0.84147098480790i)
(num-test (exp 0.0+3.14159265358979i) -1.0+0.0i)
(num-test (exp -0.0+3.14159265358979i) -1.0+0.0i)
(num-test (exp 0.0-3.14159265358979i) -1.0-0.0i)
(num-test (exp -0.0-3.14159265358979i) -1.0-0.0i)
(num-test (exp 0.0+2.71828182845905i) -0.91173391478697+0.41078129050291i)
(num-test (exp -0.0+2.71828182845905i) -0.91173391478697+0.41078129050291i)
(num-test (exp 0.0-2.71828182845905i) -0.91173391478697-0.41078129050291i)
(num-test (exp -0.0-2.71828182845905i) -0.91173391478697-0.41078129050291i)
(num-test (exp 0.00000001+0.0i) 1.00000001)
(num-test (exp -0.00000001+0.0i) 0.99999999000000)
(num-test (exp 0.00000001-0.0i) 1.00000001)
(num-test (exp -0.00000001-0.0i) 0.99999999000000)
(num-test (exp 0.00000001+0.00000001i) 1.00000001+0.00000001i)
(num-test (exp -0.00000001+0.00000001i) 0.99999999000000+0.00000001i)
(num-test (exp 0.00000001-0.00000001i) 1.00000001-0.00000001i)
(num-test (exp -0.00000001-0.00000001i) 0.99999999000000-0.00000001i)
(num-test (exp 0.00000001+1.0i) 0.54030231127116+0.84147099322261i)
(num-test (exp -0.00000001+1.0i) 0.54030230046512+0.84147097639319i)
(num-test (exp 0.00000001-1.0i) 0.54030231127116-0.84147099322261i)
(num-test (exp -0.00000001-1.0i) 0.54030230046512-0.84147097639319i)
(num-test (exp 0.00000001+3.14159265358979i) -1.00000001+0.0i)
(num-test (exp -0.00000001+3.14159265358979i) -0.99999999000000+0.0i)
(num-test (exp 0.00000001-3.14159265358979i) -1.00000001-0.0i)
(num-test (exp -0.00000001-3.14159265358979i) -0.99999999000000-0.0i)
(num-test (exp 0.00000001+2.71828182845905i) -0.91173392390430+0.41078129461072i)
(num-test (exp -0.00000001+2.71828182845905i) -0.91173390566963+0.41078128639510i)
(num-test (exp 0.00000001-2.71828182845905i) -0.91173392390430-0.41078129461072i)
(num-test (exp -0.00000001-2.71828182845905i) -0.91173390566963-0.41078128639510i)
(num-test (exp 1.0+0.0i) 2.71828182845905)
(num-test (exp -1.0+0.0i) 0.36787944117144)
(num-test (exp 1.0-0.0i) 2.71828182845905)
(num-test (exp -1.0-0.0i) 0.36787944117144)
(num-test (exp 1.0+0.00000001i) 2.71828182845905+0.00000002718282i)
(num-test (exp -1.0+0.00000001i) 0.36787944117144+0.00000000367879i)
(num-test (exp 1.0-0.00000001i) 2.71828182845905-0.00000002718282i)
(num-test (exp -1.0-0.00000001i) 0.36787944117144-0.00000000367879i)
(num-test (exp 1.0+1.0i) 1.46869393991589+2.28735528717884i)
(num-test (exp -1.0+1.0i) 0.19876611034641+0.30955987565311i)
(num-test (exp 1.0-1.0i) 1.46869393991589-2.28735528717884i)
(num-test (exp -1.0-1.0i) 0.19876611034641-0.30955987565311i)
(num-test (exp 1.0+3.14159265358979i) -2.71828182845905+0.0i)
(num-test (exp -1.0+3.14159265358979i) -0.36787944117144+0.0i)
(num-test (exp 1.0-3.14159265358979i) -2.71828182845905-0.0i)
(num-test (exp -1.0-3.14159265358979i) -0.36787944117144-0.0i)
(num-test (exp 1.0+2.71828182845905i) -2.47834973295523+1.11661931744501i)
(num-test (exp -1.0+2.71828182845905i) -0.33540816306888+0.15111799159389i)
(num-test (exp 1.0-2.71828182845905i) -2.47834973295523-1.11661931744501i)
(num-test (exp -1.0-2.71828182845905i) -0.33540816306888-0.15111799159389i)
(num-test (exp 3.14159265358979+0.0i) 23.14069263277927)
(num-test (exp -3.14159265358979+0.0i) 0.04321391826377)
(num-test (exp 3.14159265358979-0.0i) 23.14069263277927)
(num-test (exp -3.14159265358979-0.0i) 0.04321391826377)
(num-test (exp 3.14159265358979+0.00000001i) 23.14069263277926+0.00000023140693i)
(num-test (exp -3.14159265358979+0.00000001i) 0.04321391826377+0.00000000043214i)
(num-test (exp 3.14159265358979-0.00000001i) 23.14069263277926-0.00000023140693i)
(num-test (exp -3.14159265358979-0.00000001i) 0.04321391826377-0.00000000043214i)
(num-test (exp 3.14159265358979+1.0i) 12.50296958887651+19.47222141884161i)
(num-test (exp -3.14159265358979+1.0i) 0.02334857968351+0.03636325835882i)
(num-test (exp 3.14159265358979-1.0i) 12.50296958887651-19.47222141884161i)
(num-test (exp -3.14159265358979-1.0i) 0.02334857968351-0.03636325835882i)
(num-test (exp 3.14159265358979+3.14159265358979i) -23.14069263277927+0.0i)
(num-test (exp -3.14159265358979+3.14159265358979i) -0.04321391826377+0.0i)
(num-test (exp 3.14159265358979-3.14159265358979i) -23.14069263277927-0.0i)
(num-test (exp -3.14159265358979-3.14159265358979i) -0.04321391826377-0.0i)
(num-test (exp 3.14159265358979+2.71828182845905i) -21.09815428496572+9.50576358282422i)
(num-test (exp -3.14159265358979+2.71828182845905i) -0.03939959487191+0.01775146911208i)
(num-test (exp 3.14159265358979-2.71828182845905i) -21.09815428496572-9.50576358282422i)
(num-test (exp -3.14159265358979-2.71828182845905i) -0.03939959487191-0.01775146911208i)
(num-test (exp 2.71828182845905+0.0i) 15.15426224147926)
(num-test (exp -2.71828182845905+0.0i) 0.06598803584531)
(num-test (exp 2.71828182845905-0.0i) 15.15426224147926)
(num-test (exp -2.71828182845905-0.0i) 0.06598803584531)
(num-test (exp 2.71828182845905+0.00000001i) 15.15426224147926+0.00000015154262i)
(num-test (exp -2.71828182845905+0.00000001i) 0.06598803584531+0.00000000065988i)
(num-test (exp 2.71828182845905-0.00000001i) 15.15426224147926-0.00000015154262i)
(num-test (exp -2.71828182845905-0.00000001i) 0.06598803584531-0.00000000065988i)
(num-test (exp 2.71828182845905+1.0i) 8.18788283280173+12.75187197237468i)
(num-test (exp -2.71828182845905+1.0i) 0.03565348792693+0.05552701750829i)
(num-test (exp 2.71828182845905-1.0i) 8.18788283280173-12.75187197237468i)
(num-test (exp -2.71828182845905-1.0i) 0.03565348792693-0.05552701750829i)
(num-test (exp 2.71828182845905+3.14159265358979i) -15.15426224147926+0.0i)
(num-test (exp -2.71828182845905+3.14159265358979i) -0.06598803584531+0.0i)
(num-test (exp 2.71828182845905-3.14159265358979i) -15.15426224147926-0.0i)
(num-test (exp -2.71828182845905-3.14159265358979i) -0.06598803584531-0.0i)
(num-test (exp 2.71828182845905+2.71828182845905i) -13.81665483913218+6.22508740017436i)
(num-test (exp -2.71828182845905+2.71828182845905i) -0.06016353025035+0.02710665052229i)
(num-test (exp 2.71828182845905-2.71828182845905i) -13.81665483913218-6.22508740017436i)
(num-test (exp -2.71828182845905-2.71828182845905i) -0.06016353025035-0.02710665052229i)
(num-test (exp -1234.0+0.0i) 0.0)
(num-test (exp -1234.0-0.0i) 0.0)
(num-test (exp -1234.0+0.00000001i) 0.0)
(num-test (exp -1234.0-0.00000001i) 0.0)
(num-test (exp -1234.0+3.14159265358979i) 0.0)
(num-test (exp -1234.0-3.14159265358979i) 0.0)
(num-test (exp -1234.0+2.71828182845905i) 0.0)
(num-test (exp -1234.0-2.71828182845905i) 0.0)
(num-test (exp -1234000000.0+0.0i) 0.0)
(num-test (exp -1234000000.0-0.0i) 0.0)
(num-test (exp -1234000000.0+0.00000001i) 0.0)
(num-test (exp -1234000000.0-0.00000001i) 0.0)
(num-test (exp -1234000000.0+3.14159265358979i) 0.0)
(num-test (exp -1234000000.0-3.14159265358979i) 0.0)
(num-test (exp -1234000000.0+2.71828182845905i) 0.0)
(num-test (exp -1234000000.0-2.71828182845905i) 0.0)
(num-test (exp 10.0) 22026.46579480672)
(num-test (exp 100.0) 2.688117141816135E+43)
(num-test (exp -10.0) 4.5399929762484853E-5)
(num-test (exp -100.0) 3.720075976020836E-44)
(num-test (exp -7.080000e+02) 3.307553e-308)
(num-test (exp 7.090000e+02) 8.218407461554972189241372386597816393254E307)
(num-test (exp 0.00000001+1234.0i) -0.7985506315730906+0.601927660781774i) 
(num-test (exp 0.00000001+1234000000.0i) .1589091324793142-0.987293222712823i) 
(num-test (exp 3.14159265358979+1234.0i) -18.47901453215463+13.92902284602872i) 
(num-test (exp 3.14159265358979+1234000000.0i) 3.677267354472762-22.8466487767572i) 
(num-test (exp 2.71828182845905+1234.0i) -12.1014455629425+9.121769530669065i) 
(num-test (exp 2.71828182845905+1234000000.0i) 2.408150642075881-14.96170025660763i)
(num-test (exp 0.0e+00-3.45266983001243932001e-04i) 9.9999994039535581673e-1-3.4526697614140534807e-4i)
(num-test (exp 0.0e+00+3.45266983001243932001e-04i) 9.9999994039535581673e-1+3.4526697614140534807e-4i)
(num-test (exp 0.0e+00+1.57045105981189525579e+00i) 3.4526697614152485627e-4+9.9999994039535581669e-1i)
(num-test (exp 0.0e+00-1.57045105981189525579e+00i) 3.4526697614152485627e-4-9.9999994039535581669e-1i)
(num-test (exp 0.0e+00+1.57114159377789786021e+00i) -3.4526697614140239160e-4+9.9999994039535581673e-1i)
(num-test (exp 0.0e+00-1.57114159377789786021e+00i) -3.4526697614140239160e-4-9.9999994039535581673e-1i)
(num-test (exp 0.0e+00+3.14124738660679181379e+00i) -9.9999994039535581667e-1+3.4526697614158608860e-4i)
(num-test (exp 0.0e+00-3.14124738660679181379e+00i) -9.9999994039535581667e-1-3.4526697614158608860e-4i)
(num-test (exp 0.0e+00+3.14193792057279441821e+00i) -9.9999994039535581675e-1-3.4526697614134115926e-4i)
(num-test (exp 0.0e+00-3.14193792057279441821e+00i) -9.9999994039535581675e-1+3.4526697614134115926e-4i)
(num-test (exp 0.0e+00+4.71204371340168837179e+00i) -3.4526697614164732094e-4-9.9999994039535581664e-1i)
(num-test (exp 0.0e+00-4.71204371340168837179e+00i) -3.4526697614164732094e-4+9.9999994039535581664e-1i)
(num-test (exp 0.0e+00+4.71273424736769097620e+00i) 3.4526697614127992692e-4-9.9999994039535581677e-1i)
(num-test (exp 0.0e+00-4.71273424736769097620e+00i) 3.4526697614127992692e-4+9.9999994039535581677e-1i)
(num-test (exp 0.0e+00+6.28284004019658492979e+00i) 9.9999994039535581662e-1-3.4526697614170855328e-4i)
(num-test (exp 0.0e+00-6.28284004019658492979e+00i) 9.9999994039535581662e-1+3.4526697614170855328e-4i)
(num-test (exp 0.0e+00+6.28353057416258753420e+00i) 9.9999994039535581679e-1+3.4526697614121869459e-4i)
(num-test (exp 0.0e+00-6.28353057416258753420e+00i) 9.9999994039535581679e-1-3.4526697614121869459e-4i)
(num-test (exp 0.0e+00+9.42443269378637893396e+00i) -9.9999994039535581689e-1+3.4526697614094283958e-4i)
(num-test (exp 0.0e+00-9.42443269378637893396e+00i) -9.9999994039535581689e-1-3.4526697614094283958e-4i)
(num-test (exp 0.0e+00+9.42512322775237976202e+00i) -9.9999994039535581714e-1-3.4526697614020805155e-4i)
(num-test (exp 0.0e+00-9.42512322775237976202e+00i) -9.9999994039535581714e-1+3.4526697614020805155e-4i)
(num-test (exp 1.19209289550781250e-07-3.45266983001243932001e-04i) 1.0000000596046453675e0-3.4526701730043873250e-4i)
(num-test (exp 1.19209289550781250e-07+3.45266983001243932001e-04i) 1.0000000596046453675e0+3.4526701730043873250e-4i)
(num-test (exp -1.19209289550781250e-07-3.45266983001243932001e-04i) 9.9999982118608047680e-1-3.4526693498237687017e-4i)
(num-test (exp -1.19209289550781250e-07+3.45266983001243932001e-04i) 9.9999982118608047680e-1+3.4526693498237687017e-4i)
(num-test (exp 1.19209289550781250e-07+1.57045105981189525579e+00i) 3.4526701730055824072e-4+1.0000000596046453675e0i)
(num-test (exp 1.19209289550781250e-07-1.57045105981189525579e+00i) 3.4526701730055824072e-4-1.0000000596046453675e0i)
(num-test (exp -1.19209289550781250e-07+1.57045105981189525579e+00i) 3.4526693498249637836e-4+9.9999982118608047676e-1i)
(num-test (exp -1.19209289550781250e-07-1.57045105981189525579e+00i) 3.4526693498249637836e-4-9.9999982118608047676e-1i)
(num-test (exp 1.19209289550781250e-07+1.57114159377789786021e+00i) -3.4526701730043577603e-4+1.0000000596046453675e0i)
(num-test (exp 1.19209289550781250e-07-1.57114159377789786021e+00i) -3.4526701730043577603e-4-1.0000000596046453675e0i)
(num-test (exp -1.19209289550781250e-07+1.57114159377789786021e+00i) -3.4526693498237391370e-4+9.9999982118608047680e-1i)
(num-test (exp -1.19209289550781250e-07-1.57114159377789786021e+00i) -3.4526693498237391370e-4-9.9999982118608047680e-1i)
(num-test (exp 1.19209289550781250e-07+3.14124738660679181379e+00i) -1.0000000596046453674e0+3.4526701730061947306e-4i)
(num-test (exp 1.19209289550781250e-07-3.14124738660679181379e+00i) -1.0000000596046453674e0-3.4526701730061947306e-4i)
(num-test (exp -1.19209289550781250e-07+3.14124738660679181379e+00i) -9.9999982118608047674e-1+3.4526693498255761069e-4i)
(num-test (exp -1.19209289550781250e-07-3.14124738660679181379e+00i) -9.9999982118608047674e-1-3.4526693498255761069e-4i)
(num-test (exp 1.19209289550781250e-07+3.14193792057279441821e+00i) -1.0000000596046453675e0-3.4526701730037454368e-4i)
(num-test (exp 1.19209289550781250e-07-3.14193792057279441821e+00i) -1.0000000596046453675e0+3.4526701730037454368e-4i)
(num-test (exp -1.19209289550781250e-07+3.14193792057279441821e+00i) -9.9999982118608047682e-1-3.4526693498231268137e-4i)
(num-test (exp -1.19209289550781250e-07-3.14193792057279441821e+00i) -9.9999982118608047682e-1+3.4526693498231268137e-4i)
(num-test (exp 1.19209289550781250e-07+4.71204371340168837179e+00i) -3.4526701730068070540e-4-1.0000000596046453674e0i)
(num-test (exp 1.19209289550781250e-07-4.71204371340168837179e+00i) -3.4526701730068070540e-4+1.0000000596046453674e0i)
(num-test (exp -1.19209289550781250e-07+4.71204371340168837179e+00i) -3.4526693498261884302e-4-9.9999982118608047672e-1i)
(num-test (exp -1.19209289550781250e-07-4.71204371340168837179e+00i) -3.4526693498261884302e-4+9.9999982118608047672e-1i)
(num-test (exp 1.19209289550781250e-07+4.71273424736769097620e+00i) 3.4526701730031331134e-4-1.0000000596046453676e0i)
(num-test (exp 1.19209289550781250e-07-4.71273424736769097620e+00i) 3.4526701730031331134e-4+1.0000000596046453676e0i)
(num-test (exp -1.19209289550781250e-07+4.71273424736769097620e+00i) 3.4526693498225144904e-4-9.9999982118608047684e-1i)
(num-test (exp -1.19209289550781250e-07-4.71273424736769097620e+00i) 3.4526693498225144904e-4+9.9999982118608047684e-1i)
(num-test (exp 1.19209289550781250e-07+6.28284004019658492979e+00i) 1.0000000596046453674e0-3.4526701730074193775e-4i)
(num-test (exp 1.19209289550781250e-07-6.28284004019658492979e+00i) 1.0000000596046453674e0+3.4526701730074193775e-4i)
(num-test (exp -1.19209289550781250e-07+6.28284004019658492979e+00i) 9.9999982118608047670e-1-3.4526693498268007535e-4i)
(num-test (exp -1.19209289550781250e-07-6.28284004019658492979e+00i) 9.9999982118608047670e-1+3.4526693498268007535e-4i)
(num-test (exp 1.19209289550781250e-07+6.28353057416258753420e+00i) 1.0000000596046453676e0+3.452670173002520790e-4i)
(num-test (exp 1.19209289550781250e-07-6.28353057416258753420e+00i) 1.0000000596046453676e0-3.452670173002520790e-4i)
(num-test (exp -1.19209289550781250e-07+6.28353057416258753420e+00i) 9.9999982118608047687e-1+3.4526693498219021671e-4i)
(num-test (exp -1.19209289550781250e-07-6.28353057416258753420e+00i) 9.9999982118608047687e-1-3.4526693498219021671e-4i)
(num-test (exp 1.19209289550781250e-07+9.42443269378637893396e+00i) -1.0000000596046453677e0+3.4526701729997622396e-4i)
(num-test (exp 1.19209289550781250e-07-9.42443269378637893396e+00i) -1.0000000596046453677e0-3.4526701729997622396e-4i)
(num-test (exp -1.19209289550781250e-07+9.42443269378637893396e+00i) -9.9999982118608047696e-1+3.4526693498191436174e-4i)
(num-test (exp -1.19209289550781250e-07-9.42443269378637893396e+00i) -9.9999982118608047696e-1-3.4526693498191436174e-4i)
(num-test (exp 1.19209289550781250e-07+9.42512322775237976202e+00i) -1.0000000596046453679e0-3.4526701729924143584e-4i)
(num-test (exp 1.19209289550781250e-07-9.42512322775237976202e+00i) -1.0000000596046453679e0+3.4526701729924143584e-4i)
(num-test (exp -1.19209289550781250e-07+9.42512322775237976202e+00i) -9.9999982118608047721e-1-3.4526693498117957380e-4i)
(num-test (exp -1.19209289550781250e-07-9.42512322775237976202e+00i) -9.9999982118608047721e-1+3.4526693498117957380e-4i)
(num-test (exp 5.0e-01-3.45266983001243932001e-04i) 1.6487211724286834494e0-5.6924900763464865323e-4i)
(num-test (exp 5.0e-01+3.45266983001243932001e-04i) 1.6487211724286834494e0+5.6924900763464865323e-4i)
(num-test (exp -5.0e-01-3.45266983001243932001e-04i) 6.0653062356058926519e-1-2.0941500681603265022e-4i)
(num-test (exp -5.0e-01+3.45266983001243932001e-04i) 6.0653062356058926519e-1+2.0941500681603265022e-4i)
(num-test (exp 5.0e-01+1.57045105981189525579e+00i) 5.6924900763484568894e-4+1.6487211724286834493e0i)
(num-test (exp 5.0e-01-1.57045105981189525579e+00i) 5.6924900763484568894e-4-1.6487211724286834493e0i)
(num-test (exp -5.0e-01+1.57045105981189525579e+00i) 2.0941500681610513560e-4+6.0653062356058926516e-1i)
(num-test (exp -5.0e-01-1.57045105981189525579e+00i) 2.0941500681610513560e-4-6.0653062356058926516e-1i)
(num-test (exp 5.0e-01+1.57114159377789786021e+00i) -5.6924900763464377883e-4+1.6487211724286834494e0i)
(num-test (exp 5.0e-01-1.57114159377789786021e+00i) -5.6924900763464377883e-4-1.6487211724286834494e0i)
(num-test (exp -5.0e-01+1.57114159377789786021e+00i) -2.0941500681603085702e-4+6.0653062356058926519e-1i)
(num-test (exp -5.0e-01-1.57114159377789786021e+00i) -2.0941500681603085702e-4-6.0653062356058926519e-1i)
(num-test (exp 5.0e-01+3.14124738660679181379e+00i) -1.6487211724286834493e0+5.6924900763494664399e-4i)
(num-test (exp 5.0e-01-3.14124738660679181379e+00i) -1.6487211724286834493e0-5.6924900763494664399e-4i)
(num-test (exp -5.0e-01+3.14124738660679181379e+00i) -6.0653062356058926515e-1+2.0941500681614227489e-4i)
(num-test (exp -5.0e-01-3.14124738660679181379e+00i) -6.0653062356058926515e-1-2.0941500681614227489e-4i)
(num-test (exp 5.0e-01+3.14193792057279441821e+00i) -1.6487211724286834494e0-5.6924900763454282377e-4i)
(num-test (exp 5.0e-01-3.14193792057279441821e+00i) -1.6487211724286834494e0+5.6924900763454282377e-4i)
(num-test (exp -5.0e-01+3.14193792057279441821e+00i) -6.0653062356058926520e-1-2.0941500681599371773e-4i)
(num-test (exp -5.0e-01-3.14193792057279441821e+00i) -6.0653062356058926520e-1+2.0941500681599371773e-4i)
(num-test (exp 5.0e-01+4.71204371340168837179e+00i) -5.6924900763504759905e-4-1.6487211724286834492e0i)
(num-test (exp 5.0e-01-4.71204371340168837179e+00i) -5.6924900763504759905e-4+1.6487211724286834492e0i)
(num-test (exp -5.0e-01+4.71204371340168837179e+00i) -2.0941500681617941418e-4-6.0653062356058926514e-1i)
(num-test (exp -5.0e-01-4.71204371340168837179e+00i) -2.0941500681617941418e-4+6.0653062356058926514e-1i)
(num-test (exp 5.0e-01+4.71273424736769097620e+00i) 5.6924900763444186872e-4-1.6487211724286834494e0i)
(num-test (exp 5.0e-01-4.71273424736769097620e+00i) 5.6924900763444186872e-4+1.6487211724286834494e0i)
(num-test (exp -5.0e-01+4.71273424736769097620e+00i) 2.0941500681595657844e-4-6.0653062356058926521e-1i)
(num-test (exp -5.0e-01-4.71273424736769097620e+00i) 2.0941500681595657844e-4+6.0653062356058926521e-1i)
(num-test (exp 5.0e-01+6.28284004019658492979e+00i) 1.6487211724286834492e0-5.6924900763514855410e-4i)
(num-test (exp 5.0e-01-6.28284004019658492979e+00i) 1.6487211724286834492e0+5.6924900763514855410e-4i)
(num-test (exp -5.0e-01+6.28284004019658492979e+00i) 6.0653062356058926512e-1-2.0941500681621655347e-4i)
(num-test (exp -5.0e-01-6.28284004019658492979e+00i) 6.0653062356058926512e-1+2.0941500681621655347e-4i)
(num-test (exp 5.0e-01+6.28353057416258753420e+00i) 1.6487211724286834495e0+5.6924900763434091366e-4i)
(num-test (exp 5.0e-01-6.28353057416258753420e+00i) 1.6487211724286834495e0-5.6924900763434091366e-4i)
(num-test (exp -5.0e-01+6.28353057416258753420e+00i) 6.0653062356058926523e-1+2.0941500681591943916e-4i)
(num-test (exp -5.0e-01-6.28353057416258753420e+00i) 6.0653062356058926523e-1-2.0941500681591943916e-4i)
(num-test (exp 5.0e-01+9.42443269378637893396e+00i) -1.6487211724286834496e0+5.6924900763388610565e-4i)
(num-test (exp 5.0e-01-9.42443269378637893396e+00i) -1.6487211724286834496e0-5.6924900763388610565e-4i)
(num-test (exp -5.0e-01+9.42443269378637893396e+00i) -6.0653062356058926528e-1+2.0941500681575212464e-4i)
(num-test (exp -5.0e-01-9.42443269378637893396e+00i) -6.0653062356058926528e-1-2.0941500681575212464e-4i)
(num-test (exp 5.0e-01+9.42512322775237976202e+00i) -1.6487211724286834501e0-5.6924900763267464498e-4i)
(num-test (exp 5.0e-01-9.42512322775237976202e+00i) -1.6487211724286834501e0+5.6924900763267464498e-4i)
(num-test (exp -5.0e-01+9.42512322775237976202e+00i) -6.0653062356058926544e-1-2.0941500681530645317e-4i)
(num-test (exp -5.0e-01-9.42512322775237976202e+00i) -6.0653062356058926544e-1+2.0941500681530645317e-4i)
(num-test (exp 1.0e+00-3.45266983001243932001e-04i) 2.7182816664368240602e0-9.3853294721218487636e-4i)
(num-test (exp 1.0e+00+3.45266983001243932001e-04i) 2.7182816664368240602e0+9.3853294721218487636e-4i)
(num-test (exp -1.0e+00-3.45266983001243932001e-04i) 3.6787941924411912823e-1-1.2701662223785390836e-4i)
(num-test (exp -1.0e+00+3.45266983001243932001e-04i) 3.6787941924411912823e-1+1.2701662223785390836e-4i)
(num-test (exp 1.0e+00+1.57045105981189525579e+00i) 9.3853294721250973333e-4+2.7182816664368240601e0i)
(num-test (exp 1.0e+00-1.57045105981189525579e+00i) 9.3853294721250973333e-4-2.7182816664368240601e0i)
(num-test (exp -1.0e+00+1.57045105981189525579e+00i) 1.2701662223789787297e-4+3.6787941924411912822e-1i)
(num-test (exp -1.0e+00-1.57045105981189525579e+00i) 1.2701662223789787297e-4-3.6787941924411912822e-1i)
(num-test (exp 1.0e+00+1.57114159377789786021e+00i) -9.3853294721217683983e-4+2.7182816664368240602e0i)
(num-test (exp 1.0e+00-1.57114159377789786021e+00i) -9.3853294721217683983e-4-2.7182816664368240602e0i)
(num-test (exp -1.0e+00+1.57114159377789786021e+00i) -1.2701662223785282074e-4+3.6787941924411912823e-1i)
(num-test (exp -1.0e+00-1.57114159377789786021e+00i) -1.2701662223785282074e-4-3.6787941924411912823e-1i)
(num-test (exp 1.0e+00+3.14124738660679181379e+00i) -2.718281666436824060e0+9.3853294721267618008e-4i)
(num-test (exp 1.0e+00-3.14124738660679181379e+00i) -2.718281666436824060e0-9.3853294721267618008e-4i)
(num-test (exp -1.0e+00+3.14124738660679181379e+00i) -3.6787941924411912821e-1+1.2701662223792039909e-4i)
(num-test (exp -1.0e+00-3.14124738660679181379e+00i) -3.6787941924411912821e-1-1.2701662223792039909e-4i)
(num-test (exp 1.0e+00+3.14193792057279441821e+00i) -2.7182816664368240603e0-9.3853294721201039309e-4i)
(num-test (exp 1.0e+00-3.14193792057279441821e+00i) -2.7182816664368240603e0+9.3853294721201039309e-4i)
(num-test (exp -1.0e+00+3.14193792057279441821e+00i) -3.6787941924411912824e-1-1.2701662223783029462e-4i)
(num-test (exp -1.0e+00-3.14193792057279441821e+00i) -3.6787941924411912824e-1+1.2701662223783029462e-4i)
(num-test (exp 1.0e+00+4.71204371340168837179e+00i) -9.3853294721284262682e-4-2.718281666436824060e0i)
(num-test (exp 1.0e+00-4.71204371340168837179e+00i) -9.3853294721284262682e-4+2.718281666436824060e0i)
(num-test (exp -1.0e+00+4.71204371340168837179e+00i) -1.2701662223794292521e-4-3.6787941924411912820e-1i)
(num-test (exp -1.0e+00-4.71204371340168837179e+00i) -1.2701662223794292521e-4+3.6787941924411912820e-1i)
(num-test (exp 1.0e+00+4.71273424736769097620e+00i) 9.3853294721184394634e-4-2.7182816664368240603e0i)
(num-test (exp 1.0e+00-4.71273424736769097620e+00i) 9.3853294721184394634e-4+2.7182816664368240603e0i)
(num-test (exp -1.0e+00+4.71273424736769097620e+00i) 1.2701662223780776850e-4-3.6787941924411912825e-1i)
(num-test (exp -1.0e+00-4.71273424736769097620e+00i) 1.2701662223780776850e-4+3.6787941924411912825e-1i)
(num-test (exp 1.0e+00+6.28284004019658492979e+00i) 2.7182816664368240599e0-9.3853294721300907357e-4i)
(num-test (exp 1.0e+00-6.28284004019658492979e+00i) 2.7182816664368240599e0+9.3853294721300907357e-4i)
(num-test (exp -1.0e+00+6.28284004019658492979e+00i) 3.6787941924411912819e-1-1.2701662223796545132e-4i)
(num-test (exp -1.0e+00-6.28284004019658492979e+00i) 3.6787941924411912819e-1+1.2701662223796545132e-4i)
(num-test (exp 1.0e+00+6.28353057416258753420e+00i) 2.7182816664368240604e0+9.3853294721167749959e-4i)
(num-test (exp 1.0e+00-6.28353057416258753420e+00i) 2.7182816664368240604e0-9.3853294721167749959e-4i)
(num-test (exp -1.0e+00+6.28353057416258753420e+00i) 3.6787941924411912825e-1+1.2701662223778524238e-4i)
(num-test (exp -1.0e+00-6.28353057416258753420e+00i) 3.6787941924411912825e-1-1.2701662223778524238e-4i)
(num-test (exp 1.0e+00+9.42443269378637893396e+00i) -2.7182816664368240606e0+9.3853294721092764795e-4i)
(num-test (exp 1.0e+00-9.42443269378637893396e+00i) -2.7182816664368240606e0-9.3853294721092764795e-4i)
(num-test (exp -1.0e+00+9.42443269378637893396e+00i) -3.6787941924411912829e-1+1.270166222376837610e-4i)
(num-test (exp -1.0e+00-9.42443269378637893396e+00i) -3.6787941924411912829e-1-1.270166222376837610e-4i)
(num-test (exp 1.0e+00+9.42512322775237976202e+00i) -2.7182816664368240613e0-9.3853294720893028698e-4i)
(num-test (exp 1.0e+00-9.42512322775237976202e+00i) -2.7182816664368240613e0+9.3853294720893028698e-4i)
(num-test (exp -1.0e+00+9.42512322775237976202e+00i) -3.6787941924411912838e-1-1.2701662223741344759e-4i)
(num-test (exp -1.0e+00-9.42512322775237976202e+00i) -3.6787941924411912838e-1+1.2701662223741344759e-4i)
(num-test (exp 2.0e+00-3.45266983001243932001e-04i) 7.3890556585085906002e0-2.5511970558169944872e-3i)
(num-test (exp 2.0e+00+3.45266983001243932001e-04i) 7.3890556585085906002e0+2.5511970558169944872e-3i)
(num-test (exp -2.0e+00-3.45266983001243932001e-04i) 1.3533527517000128913e-1-4.6726804008345889445e-5i)
(num-test (exp -2.0e+00+3.45266983001243932001e-04i) 1.3533527517000128913e-1+4.6726804008345889445e-5i)
(num-test (exp 2.0e+00+1.57045105981189525579e+00i) 2.551197055817877540e-3+7.3890556585085905999e0i)
(num-test (exp 2.0e+00-1.57045105981189525579e+00i) 2.551197055817877540e-3-7.3890556585085905999e0i)
(num-test (exp -2.0e+00+1.57045105981189525579e+00i) 4.6726804008362063122e-5+1.3533527517000128913e-1i)
(num-test (exp -2.0e+00-1.57045105981189525579e+00i) 4.6726804008362063122e-5-1.3533527517000128913e-1i)
(num-test (exp 2.0e+00+1.57114159377789786021e+00i) -2.5511970558169726417e-3+7.3890556585085906002e0i)
(num-test (exp 2.0e+00-1.57114159377789786021e+00i) -2.5511970558169726417e-3-7.3890556585085906002e0i)
(num-test (exp -2.0e+00+1.57114159377789786021e+00i) -4.6726804008345489330e-5+1.3533527517000128913e-1i)
(num-test (exp -2.0e+00-1.57114159377789786021e+00i) -4.6726804008345489330e-5-1.3533527517000128913e-1i)
(num-test (exp 2.0e+00+3.14124738660679181379e+00i) -7.3890556585085905998e0+2.5511970558183299892e-3i)
(num-test (exp 2.0e+00-3.14124738660679181379e+00i) -7.3890556585085905998e0-2.5511970558183299892e-3i)
(num-test (exp -2.0e+00+3.14124738660679181379e+00i) -1.3533527517000128912e-1+4.6726804008370350017e-5i)
(num-test (exp -2.0e+00-3.14124738660679181379e+00i) -1.3533527517000128912e-1-4.6726804008370350017e-5i)
(num-test (exp 2.0e+00+3.14193792057279441821e+00i) -7.3890556585085906004e0-2.5511970558165201925e-3i)
(num-test (exp 2.0e+00-3.14193792057279441821e+00i) -7.3890556585085906004e0+2.5511970558165201925e-3i)
(num-test (exp -2.0e+00+3.14193792057279441821e+00i) -1.3533527517000128914e-1-4.6726804008337202435e-5i)
(num-test (exp -2.0e+00-3.14193792057279441821e+00i) -1.3533527517000128914e-1+4.6726804008337202435e-5i)
(num-test (exp 2.0e+00+4.71204371340168837179e+00i) -2.5511970558187824384e-3-7.3890556585085905996e0i)
(num-test (exp 2.0e+00-4.71204371340168837179e+00i) -2.5511970558187824384e-3+7.3890556585085905996e0i)
(num-test (exp -2.0e+00+4.71204371340168837179e+00i) -4.6726804008378636913e-5-1.3533527517000128912e-1i)
(num-test (exp -2.0e+00-4.71204371340168837179e+00i) -4.6726804008378636913e-5+1.3533527517000128912e-1i)
(num-test (exp 2.0e+00+4.71273424736769097620e+00i) 2.5511970558160677434e-3-7.3890556585085906006e0i)
(num-test (exp 2.0e+00-4.71273424736769097620e+00i) 2.5511970558160677434e-3+7.3890556585085906006e0i)
(num-test (exp -2.0e+00+4.71273424736769097620e+00i) 4.6726804008328915539e-5-1.3533527517000128914e-1i)
(num-test (exp -2.0e+00-4.71273424736769097620e+00i) 4.6726804008328915539e-5+1.3533527517000128914e-1i)
(num-test (exp 2.0e+00+6.28284004019658492979e+00i) 7.3890556585085905995e0-2.5511970558192348875e-3i)
(num-test (exp 2.0e+00-6.28284004019658492979e+00i) 7.3890556585085905995e0+2.5511970558192348875e-3i)
(num-test (exp -2.0e+00+6.28284004019658492979e+00i) 1.3533527517000128912e-1-4.6726804008386923808e-5i)
(num-test (exp -2.0e+00-6.28284004019658492979e+00i) 1.3533527517000128912e-1+4.6726804008386923808e-5i)
(num-test (exp 2.0e+00+6.28353057416258753420e+00i) 7.3890556585085906007e0+2.5511970558156152942e-3i)
(num-test (exp 2.0e+00-6.28353057416258753420e+00i) 7.3890556585085906007e0-2.5511970558156152942e-3i)
(num-test (exp -2.0e+00+6.28353057416258753420e+00i) 1.3533527517000128914e-1+4.6726804008320628644e-5i)
(num-test (exp -2.0e+00-6.28353057416258753420e+00i) 1.3533527517000128914e-1-4.6726804008320628644e-5i)
(num-test (exp 2.0e+00+9.42443269378637893396e+00i) -7.3890556585085906014e0+2.5511970558135769861e-3i)
(num-test (exp 2.0e+00-9.42443269378637893396e+00i) -7.3890556585085906014e0-2.5511970558135769861e-3i)
(num-test (exp -2.0e+00+9.42443269378637893396e+00i) -1.3533527517000128916e-1+4.6726804008283295729e-5i)
(num-test (exp -2.0e+00-9.42443269378637893396e+00i) -1.3533527517000128916e-1-4.6726804008283295729e-5i)
(num-test (exp 2.0e+00+9.42512322775237976202e+00i) -7.3890556585085906033e0-2.5511970558081475961e-3i)
(num-test (exp 2.0e+00-9.42512322775237976202e+00i) -7.3890556585085906033e0+2.5511970558081475961e-3i)
(num-test (exp -2.0e+00+9.42512322775237976202e+00i) -1.3533527517000128919e-1-4.6726804008183852982e-5i)
(num-test (exp -2.0e+00-9.42512322775237976202e+00i) -1.3533527517000128919e-1+4.6726804008183852982e-5i)
(num-test (exp -1000) 0.0)
(num-test (exp -1000000) 0.0)
(num-test (exp (complex 0.0 (* 0.5 pi))) 0+i)
(num-test (exp (complex 0.0 pi)) -1)
(num-test (exp 100.0) 2.688117141816135e43)
(num-test (exp 500.0) 1.40359221785284E+217)
(num-test (exp -100.0) 3.720075976020836E-44)
(num-test (exp -500.0) 7.12457640674129E-218)
(num-test (exp 5e-10) 1.000000000500000000125000031161629077797E0)
(num-test (- (expt (exp 5e-8) 2e7) (exp 1)) 0.0)
(num-test (exp -2.225073858507201399999999999999999999996E-308) 1.000E0)
(num-test (exp 1.110223024625156799999999999999999999997E-16) 1.000000000000000111022302462515686162976E0)
(num-test (exp 1/9223372036854775807) 1.000000000000000000108420217248550443418E0)
(num-test (exp -1/9223372036854775807) 9.999999999999999998915797827514495565934E-1)
(num-test (exp (* pi (sqrt 163))) 262537412640768743.999999999999)
(num-test (exp (* pi (sqrt 17))) 422150.99767568)
(num-test (exp (* pi (sqrt 18))) 614551.992885619)
(num-test (exp (* pi (sqrt 22))) 2508951.998257424)
(num-test (exp (* pi (sqrt 6))) 2197.9908695437)
(num-test (exp (* pi (sqrt 719))) 3.8426143735395488914902942778058291929999e+36)
(num-test (exp (complex 0.0 pi)) -1.0)

(for-each
 (lambda (num-and-val)
   (let ((num (car num-and-val)) (val (cadr num-and-val))) (num-test-1 'exp num (exp num) val)))
 (vector (list 0 1) (list 1 2.718281828459) (list 2 7.3890560989307) (list 3 20.085536923188) 
	 (list -1 0.36787944117144) (list -2 0.13533528323661) (list -3 0.049787068367864) 
	 (list -9223372036854775808 0.0) (list 1/2 1.6487212707001) (list 1/3 1.3956124250861) 
	 (list -1/2 0.60653065971263) (list -1/3 0.71653131057379) (list 1/9223372036854775807 1.0) 
	 (list 0.0 1.0) (list 1.0 2.718281828459) (list 2.0 7.3890560989307) (list -2.0 0.13533528323661) 
	 (list 1.000000000000000000000000000000000000002E-309 1.000E0) (list -inf.0 0.0) (list 0+1i 0.54030230586814+0.8414709848079i) 
	 (list 0+2i -0.41614683654714+0.90929742682568i) (list 0-1i 0.54030230586814-0.8414709848079i) 
	 (list 1+1i 1.4686939399159+2.2873552871788i) (list 1-1i 1.4686939399159-2.2873552871788i) 
	 (list -1+1i 0.19876611034641+0.30955987565311i) (list -1-1i 0.19876611034641-0.30955987565311i) 
	 (list 0.1+0.1i 1.0996496668294+0.1103329887302i) (list 1e-16+1e-16i 1+1e-16i) ))
  
(test (exp) 'error)
(test (exp "hi") 'error)
(test (exp 1.0+23.0i 1.0+23.0i) 'error)

(for-each
 (lambda (arg)
   (test (exp arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))

(unless with-bignums
  (test (infinite? (exp (expt 2 16))) #t)
  (test (infinite? (exp (expt 2 54))) #t)
  (test (infinite? (exp (exp 1e3))) #t))

(when with-bignums
  (let ((val1 (* 1000 (- (exp 30) 10686474581524)))
	(val2 (* 1000 (- (exp (bignum "30")) 10686474581524))))
    (if (> (abs (- val1 val2)) 1)
	(format #t "(exp 30): ~A ~A~%" val1 val2)))
  (num-test (exp (* 172.60813659204 (log 172.60813659204))) 1.364508485146898675293943657160611234948E386) ; not inf!
  (num-test (exp 800.0) 2.726374572112566567364779546367269757963E347)
  (num-test (exp -800.0) 3.667874584177687213455495654260798215465E-348)
  (num-test (exp 100) 2.688117141816135448412625551580013587359E43)
  (num-test (exp 50.0) 5.184705528587072464087453322933485384827E21)

  (let-temporarily (((*s7* 'bignum-precision) 500))
    (let ((exps (list  ; table[Exp[k/10], {k, 0, 30}]
		 1.00000000000000000000000000000000000000000000000000000000000000000000
		 1.10517091807564762481170782649024666822454719473751871879286328944096
		 1.22140275816016983392107199463967417030758094152050364127342509859920
		 1.34985880757600310398374431332800733037829969735936580304991798993961
		 1.49182469764127031782485295283722228064328277393742528159563315007236
		 1.64872127070012814684865078781416357165377610071014801157507931164066
		 1.82211880039050897487536766816286451338223880854643538632054747658881
		 2.01375270747047652162454938858306527001754239414586731156898930087978
		 2.22554092849246760457953753139507675705363413504848459611858395555662
		 2.45960311115694966380012656360247069542177230644008302074854573665746
		 2.71828182845904523536028747135266249775724709369995957496696762772407
		 3.00416602394643311205840795358867239328268102601627276212975286052863
		 3.32011692273654748953076742960164432007363176479282675728202180154077
		 3.66929666761924422045748991601148625143151888455755146725622649459660
		 4.05519996684467458722410889522862025216756114168404107165223289450693
		 4.48168907033806482260205546011927581900574986836966705677265008278593
		 4.95303242439511480365428635642396425641303112355664964787158190112430
		 5.47394739172719976079086266300909670070076114490748605875498633804484
		 6.04964746441294608373102395302772533816116344511729126161486476549696
		 6.68589444227926941607253072769286145380311864710852264561241990317501
		 7.38905609893065022723042746057500781318031557055184732408712782252257
		 8.16616991256765007344972741047863128518315260430523695926385375737882
		 9.02501349943412092647177716688866402972021659669817926079803719255720
		 9.97418245481472073995761515690885800147870119368402956369142191697585
		 11.02317638064160165223793976966780200851716306933940388430829005877357
		 12.18249396070347343807017595116796618318276779006316131156039834183818
		 13.46373803500169039775082533258411724479408609657822907153993787261197
		 14.87973172487283411186899301946839578068879752075547683852481232002013
		 16.44464677109704987149801601092501556372435769719962288653996273295166
		 18.17414536944306094267625657412806698753309200930534632364757918918540
		 20.08553692318766774092852965458171789698790783855415014437893422969884)))
      (do ((i 0 (+ i 1)))
	  ((= i 30))
	(let ((val (exp (/ i (bignum "10")))))
	  (if (> (magnitude (- val (list-ref exps i))) 1e-36)
	      (format #t ";(exp ~A) -> ~A ~A~%[~A]~%" (/ i 10) val (list-ref exps i) (magnitude (- val (list-ref exps i))))))))))




;;; --------------------------------------------------------------------------------
;;; log
;;; --------------------------------------------------------------------------------

(num-test (* 0-2i (log 0+i)) pi)	
(num-test (* 2  0+i (log (/ 1-i 1+i))) pi)
(num-test (+ 100 (expt 10.0 15) (- (expt 10.0 15))) 100.0)
(num-test (/ (log -1) (sqrt -1)) pi)
(num-test (/ (log -8) (log 2)) 3+4.5323601418272i)
(num-test (/ 53453 (log 53453)) 4910.0000012208)
(num-test (exp (log (expt 10.0 -16))) 1e-16)
(num-test (exp (log (expt 10.0 -36))) 1e-36)
(num-test (exp (log (expt 10.0 16))) 1e16)
(num-test (exp (log (expt 10.0 36))) 1e36)
(num-test (exp (log 1000)) 1000.0)
(num-test (exp (log 1000000)) 1000000.0)
(num-test (exp (log 1000000000)) 1000000000.0)
(num-test (exp (log 8)) 8.0)
(num-test (expt (+ 1 1e-10) (log 100.0 (+ 1 1e-10))) 100.0)
(num-test (expt (+ 1 1e-15) (log 100.0 (+ 1 1e-15))) 100.0) ; 16 doesn't work if not gmp
(num-test (expt -2.0 0.13926097063622-0.63118087262379i) 8.0)
(num-test (expt -2.0 0.26160508088635-0.052598406051983i) 1.0+i)
(num-test (expt 1.0+i 0.97790391649038-2.2161063668189i) 8.0)
(num-test (log (/ (+ 1 (sqrt 5)) 2)) (acosh (/ (sqrt 5) 2)))
(num-test (log (exp 0.0000001)) 0.0000001)
(num-test (log (exp 0.0001)) 0.0001)
(num-test (log (exp 0.1)) 0.1)
(num-test (log (exp 8)) 8.0)
(num-test (log (expt 2 1022)) 7.083964185322641062244112281302564525734E2)
(num-test (log (expt 2 125)) 8.664339756999316367715401518227207100938E1)
(num-test (log (expt 3/2 10) 3/2) 10.0)
(num-test (log (log (log -1))) 0.66457192224882+0.9410294873126i)
(num-test (log (sqrt (- (expt 10 17) 1))) 1.957197329044938830915292736481709573957E1)
(num-test (log (sqrt (- (expt 10 20) 1))) 2.302585092994045684017491454684364207599E1)
(num-test (log (sqrt (- (expt 10 9) 1))) 1.036163291797320557783096154591297226743E1)
(num-test (log (sqrt -2) -2) 0.5)
(num-test (log (sqrt 1+i) 1+i) 0.5)
(num-test (log (sqrt 2) 2) 0.5)
(num-test (log -0.0+0.00000001i) -18.42068074395237+1.57079632679490i)
(num-test (log -0.0+1.0i) 0.0+1.57079632679490i)
(num-test (log -0.0+1234.0i) 7.11801620446533+1.57079632679490i)
(num-test (log -0.0+1234000000.0i) 20.93352676242961+1.57079632679490i)
(num-test (log -0.0+2.71828182845905i) 1.0+1.57079632679490i)
(num-test (log -0.0+3.14159265358979i) 1.14472988584940+1.57079632679490i)
(num-test (log -0.0-0.00000001i) -18.42068074395237-1.57079632679490i)
(num-test (log -0.0-1.0i) 0.0-1.57079632679490i)
(num-test (log -0.0-1234.0i) 7.11801620446533-1.57079632679490i)
(num-test (log -0.0-1234000000.0i) 20.93352676242961-1.57079632679490i)
(num-test (log -0.0-2.71828182845905i) 1.0-1.57079632679490i)
(num-test (log -0.0-3.14159265358979i) 1.14472988584940-1.57079632679490i)
(num-test (log -0.00000001) -18.42068074395237+3.14159265358979i)
(num-test (log -0.00000001+0.00000001i) -18.07410715367239+2.35619449019234i)
(num-test (log -0.00000001+0.0i) -18.42068074395237+3.14159265358979i)
(num-test (log -0.00000001+1.0i) 0.0+1.57079633679490i)
(num-test (log -0.00000001+1234.0i) 7.11801620446533+1.57079632680300i)
(num-test (log -0.00000001+1234000000.0i) 20.93352676242961+1.57079632679490i)
(num-test (log -0.00000001+2.71828182845905i) 1.0+1.57079633047369i)
(num-test (log -0.00000001+3.14159265358979i) 1.14472988584940+1.57079632997800i)
(num-test (log -0.00000001-0.00000001i) -18.07410715367239-2.35619449019234i)
(num-test (log -0.00000001-0.0i) -18.42068074395237+3.14159265358979i)
(num-test (log -0.00000001-1.0i) 0.0-1.57079633679490i)
(num-test (log -0.00000001-1234.0i) 7.11801620446533-1.57079632680300i)
(num-test (log -0.00000001-1234000000.0i) 20.93352676242961-1.57079632679490i)
(num-test (log -0.00000001-2.71828182845905i) 1.0-1.57079633047369i)
(num-test (log -0.00000001-3.14159265358979i) 1.14472988584940-1.57079632997800i)
(num-test (log -0.1e001) (complex 0.0 pi))
(num-test (log -1 -1) 1.0)
(num-test (log -1) 0.0+3.141592653589793238462643383279502884197169399375105820974944592307816406286198E0i)
(num-test (log -1) 0.0+3.14159265358979i)
(num-test (log -1.0) 0.0+3.14159265358979i)
(num-test (log -1.0+0.00000001i) 0.0+3.14159264358979i)
(num-test (log -1.0+0.0i) 0.0+3.14159265358979i)
(num-test (log -1.0+1.0i) 0.34657359027997+2.35619449019234i)
(num-test (log -1.0+1234.0i) 7.11801653281724+1.57160669938898i)
(num-test (log -1.0+1234000000.0i) 20.93352676242961+1.57079632760527i)
(num-test (log -1.0+2.71828182845905i) 1.06346400552149+1.92330974857252i)
(num-test (log -1.0+3.14159265358979i) 1.19298515341341+1.87896539791088i)
(num-test (log -1.0-0.00000001i) 0.0-3.14159264358979i)
(num-test (log -1.0-0.0i) 0.0+3.14159265358979i)
(num-test (log -1.0-1.0i) 0.34657359027997-2.35619449019234i)
(num-test (log -1.0-1234.0i) 7.11801653281724-1.57160669938898i)
(num-test (log -1.0-1234000000.0i) 20.93352676242961-1.57079632760527i)
(num-test (log -1.0-2.71828182845905i) 1.06346400552149-1.92330974857252i)
(num-test (log -1.0-3.14159265358979i) 1.19298515341341-1.87896539791088i)
(num-test (log -1.0e+00+0.0e+00i) 0+3.1415926535897932385e0i)
(num-test (log -1.0e+00+1.0e+00i) 3.4657359027997265471e-1+2.3561944901923449288e0i)
(num-test (log -1.0e+00+1.0e+00i) 3.4657359027997265471e-1+2.3561944901923449288e0i)
(num-test (log -1.0e+00+1.19209289550781250e-07i) 7.1054273576009513716e-15+3.1415925343805036877e0i)
(num-test (log -1.0e+00+1.19209289550781250e-07i) 7.1054273576009513716e-15+3.1415925343805036877e0i)
(num-test (log -1.0e+00+2.0e+00i) 8.0471895621705018730e-1+2.0344439357957027354e0i)
(num-test (log -1.0e+00+2.0e+00i) 8.0471895621705018730e-1+2.0344439357957027354e0i)
(num-test (log -1.0e+00+5.0e-01i) 1.1157177565710487788e-1+2.6779450445889871222e0i)
(num-test (log -1.0e+00+5.0e-01i) 1.1157177565710487788e-1+2.6779450445889871222e0i)
(num-test (log -1.0e+00+8.3886080e+06i) 1.5942385152878749222e1+1.570796446004186170e0i)
(num-test (log -1.0e+00+8.3886080e+06i) 1.5942385152878749222e1+1.570796446004186170e0i)
(num-test (log -1.0e+00-1.0e+00i) 3.4657359027997265471e-1-2.3561944901923449288e0i)
(num-test (log -1.0e+00-1.0e+00i) 3.4657359027997265471e-1-2.3561944901923449288e0i)
(num-test (log -1.0e+00-1.19209289550781250e-07i) 7.1054273576009513716e-15-3.1415925343805036877e0i)
(num-test (log -1.0e+00-1.19209289550781250e-07i) 7.1054273576009513716e-15-3.1415925343805036877e0i)
(num-test (log -1.0e+00-2.0e+00i) 8.0471895621705018730e-1-2.0344439357957027354e0i)
(num-test (log -1.0e+00-2.0e+00i) 8.0471895621705018730e-1-2.0344439357957027354e0i)
(num-test (log -1.0e+00-5.0e-01i) 1.1157177565710487788e-1-2.6779450445889871222e0i)
(num-test (log -1.0e+00-5.0e-01i) 1.1157177565710487788e-1-2.6779450445889871222e0i)
(num-test (log -1.0e+00-8.3886080e+06i) 1.5942385152878749222e1-1.570796446004186170e0i)
(num-test (log -1.0e+00-8.3886080e+06i) 1.5942385152878749222e1-1.570796446004186170e0i)
(num-test (log -1.19209289550781250e-07+0.0e+00i) -1.5942385152878742117e1+3.1415926535897932385e0i)
(num-test (log -1.19209289550781250e-07+1.0e+00i) 7.1054273576009513716e-15+1.570796446004186170e0i)
(num-test (log -1.19209289550781250e-07+1.0e+00i) 7.1054273576009513716e-15+1.570796446004186170e0i)
(num-test (log -1.19209289550781250e-07+1.19209289550781250e-07i) -1.5595811562598769462e1+2.3561944901923449288e0i)
(num-test (log -1.19209289550781250e-07+1.19209289550781250e-07i) -1.5595811562598769462e1+2.3561944901923449288e0i)
(num-test (log -1.19209289550781250e-07+2.0e+00i) 6.9314718055994708577e-1+1.5707963863995413946e0i)
(num-test (log -1.19209289550781250e-07+2.0e+00i) 6.9314718055994708577e-1+1.5707963863995413946e0i)
(num-test (log -1.19209289550781250e-07+5.0e-01i) -6.9314718055991688771e-1+1.5707965652134757208e0i)
(num-test (log -1.19209289550781250e-07+5.0e-01i) -6.9314718055991688771e-1+1.5707965652134757208e0i)
(num-test (log -1.19209289550781250e-07+8.3886080e+06i) 1.5942385152878742117e1+1.5707963267949108301e0i)
(num-test (log -1.19209289550781250e-07+8.3886080e+06i) 1.5942385152878742117e1+1.5707963267949108301e0i)
(num-test (log -1.19209289550781250e-07-1.0e+00i) 7.1054273576009513716e-15-1.570796446004186170e0i)
(num-test (log -1.19209289550781250e-07-1.0e+00i) 7.1054273576009513716e-15-1.570796446004186170e0i)
(num-test (log -1.19209289550781250e-07-1.19209289550781250e-07i) -1.5595811562598769462e1-2.3561944901923449288e0i)
(num-test (log -1.19209289550781250e-07-1.19209289550781250e-07i) -1.5595811562598769462e1-2.3561944901923449288e0i)
(num-test (log -1.19209289550781250e-07-2.0e+00i) 6.9314718055994708577e-1-1.5707963863995413946e0i)
(num-test (log -1.19209289550781250e-07-2.0e+00i) 6.9314718055994708577e-1-1.5707963863995413946e0i)
(num-test (log -1.19209289550781250e-07-5.0e-01i) -6.9314718055991688771e-1-1.5707965652134757208e0i)
(num-test (log -1.19209289550781250e-07-5.0e-01i) -6.9314718055991688771e-1-1.5707965652134757208e0i)
(num-test (log -1.19209289550781250e-07-8.3886080e+06i) 1.5942385152878742117e1-1.5707963267949108301e0i)
(num-test (log -1.19209289550781250e-07-8.3886080e+06i) 1.5942385152878742117e1-1.5707963267949108301e0i)
(num-test (log -1/1) 0.0+3.14159265358979i)
(num-test (log -1/10) -2.30258509299405+3.14159265358979i)
(num-test (log -1/1234) -7.11801620446533+3.14159265358979i)
(num-test (log -1/1234000000) -20.93352676242961+3.14159265358979i)
(num-test (log -1/2) -0.69314718055995+3.14159265358979i)
(num-test (log -1/3) -1.09861228866811+3.14159265358979i)
(num-test (log -1/362880) -12.80182748008147+3.14159265358979i)
(num-test (log -1/500029) -13.12242137572239+3.14159265358979i)
(num-test (log -10) 2.30258509299405+3.14159265358979i)
(num-test (log -10/1) 2.30258509299405+3.14159265358979i)
(num-test (log -10/10) 0.0+3.14159265358979i)
(num-test (log -10/1234) -4.81543111147129+3.14159265358979i)
(num-test (log -10/1234000000) -18.63094166943556+3.14159265358979i)
(num-test (log -10/2) 1.60943791243410+3.14159265358979i)
(num-test (log -10/3) 1.20397280432594+3.14159265358979i)
(num-test (log -10/362880) -10.49924238708742+3.14159265358979i)
(num-test (log -10/500029) -10.81983628272835+3.14159265358979i)
(num-test (log -1234) 7.11801620446533+3.14159265358979i)
(num-test (log -1234.0) 7.11801620446533+3.14159265358979i)
(num-test (log -1234.0+0.00000001i) 7.11801620446533+3.14159265358169i)
(num-test (log -1234.0+0.0i) 7.11801620446533+3.14159265358979i)
(num-test (log -1234.0+1.0i) 7.11801653281724+3.14078228099571i)
(num-test (log -1234.0+1234.0i) 7.46458979474531+2.35619449019234i)
(num-test (log -1234.0+1234000000.0i) 20.93352676243011+1.57079732679490i)
(num-test (log -1234.0+2.71828182845905i) 7.11801863067090+3.13938983557381i)
(num-test (log -1234.0+3.14159265358979i) 7.11801944515932+3.13904679794449i)
(num-test (log -1234.0-0.00000001i) 7.11801620446533-3.14159265358169i)
(num-test (log -1234.0-0.0i) 7.11801620446533+3.14159265358979i)
(num-test (log -1234.0-1.0i) 7.11801653281724-3.14078228099571i)
(num-test (log -1234.0-1234.0i) 7.46458979474531-2.35619449019234i)
(num-test (log -1234.0-1234000000.0i) 20.93352676243011-1.57079732679490i)
(num-test (log -1234.0-2.71828182845905i) 7.11801863067090-3.13938983557381i)
(num-test (log -1234.0-3.14159265358979i) 7.11801944515932-3.13904679794449i)
(num-test (log -1234/1) 7.11801620446533+3.14159265358979i)
(num-test (log -1234/10) 4.81543111147129+3.14159265358979i)
(num-test (log -1234/1234) 0.0+3.14159265358979i)
(num-test (log -1234/1234000000) -13.81551055796427+3.14159265358979i)
(num-test (log -1234/2) 6.42486902390539+3.14159265358979i)
(num-test (log -1234/3) 6.01940391579722+3.14159265358979i)
(num-test (log -1234/362880) -5.68381127561614+3.14159265358979i)
(num-test (log -1234/500029) -6.00440517125706+3.14159265358979i)
(num-test (log -1234000000) 20.93352676242961+3.14159265358979i)
(num-test (log -1234000000.0) 20.93352676242961+3.14159265358979i)
(num-test (log -1234000000.0+0.00000001i) 20.93352676242961+3.14159265358979i)
(num-test (log -1234000000.0+0.0i) 20.93352676242961+3.14159265358979i)
(num-test (log -1234000000.0+1.0i) 20.93352676242961+3.14159265277942i)
(num-test (log -1234000000.0+1234.0i) 20.93352676243011+3.14159165358979i)
(num-test (log -1234000000.0+1234000000.0i) 21.28010035270958+2.35619449019234i)
(num-test (log -1234000000.0+2.71828182845905i) 20.93352676242961+3.14159265138697i)
(num-test (log -1234000000.0+3.14159265358979i) 20.93352676242961+3.14159265104393i)
(num-test (log -1234000000.0-0.00000001i) 20.93352676242961-3.14159265358979i)
(num-test (log -1234000000.0-0.0i) 20.93352676242961+3.14159265358979i)
(num-test (log -1234000000.0-1.0i) 20.93352676242961-3.14159265277942i)
(num-test (log -1234000000.0-1234.0i) 20.93352676243011-3.14159165358979i)
(num-test (log -1234000000.0-1234000000.0i) 21.28010035270958-2.35619449019234i)
(num-test (log -1234000000.0-2.71828182845905i) 20.93352676242961-3.14159265138697i)
(num-test (log -1234000000.0-3.14159265358979i) 20.93352676242961-3.14159265104393i)
(num-test (log -1234000000/1) 20.93352676242961+3.14159265358979i)
(num-test (log -1234000000/10) 18.63094166943556+3.14159265358979i)
(num-test (log -1234000000/1234) 13.81551055796427+3.14159265358979i)
(num-test (log -1234000000/1234000000) 0.0+3.14159265358979i)
(num-test (log -1234000000/2) 20.24037958186966+3.14159265358979i)
(num-test (log -1234000000/3) 19.83491447376150+3.14159265358979i)
(num-test (log -1234000000/362880) 8.13169928234814+3.14159265358979i)
(num-test (log -1234000000/500029) 7.81110538670721+3.14159265358979i)
(num-test (log -2 -2) 1)
(num-test (log -2) 0.69314718055995+3.14159265358979i)
(num-test (log -2.0e+00+0.0e+00i) 6.9314718055994530942e-1+3.1415926535897932385e0i)
(num-test (log -2.0e+00+1.0e+00i) 8.0471895621705018730e-1+2.6779450445889871222e0i)
(num-test (log -2.0e+00+1.0e+00i) 8.0471895621705018730e-1+2.6779450445889871222e0i)
(num-test (log -2.0e+00+1.19209289550781250e-07i) 6.9314718055994708577e-1+3.1415925939851484631e0i)
(num-test (log -2.0e+00+1.19209289550781250e-07i) 6.9314718055994708577e-1+3.1415925939851484631e0i)
(num-test (log -2.0e+00+2.0e+00i) 1.0397207708399179641e0+2.3561944901923449288e0i)
(num-test (log -2.0e+00+2.0e+00i) 1.0397207708399179641e0+2.3561944901923449288e0i)
(num-test (log -2.0e+00+5.0e-01i) 7.2345949146816273071e-1+2.8966139904629290843e0i)
(num-test (log -2.0e+00+5.0e-01i) 7.2345949146816273071e-1+2.8966139904629290843e0i)
(num-test (log -2.0e+00+8.3886080e+06i) 1.5942385152878770538e1+1.5707965652134757208e0i)
(num-test (log -2.0e+00+8.3886080e+06i) 1.5942385152878770538e1+1.5707965652134757208e0i)
(num-test (log -2.0e+00-1.0e+00i) 8.0471895621705018730e-1-2.6779450445889871222e0i)
(num-test (log -2.0e+00-1.0e+00i) 8.0471895621705018730e-1-2.6779450445889871222e0i)
(num-test (log -2.0e+00-1.19209289550781250e-07i) 6.9314718055994708577e-1-3.1415925939851484631e0i)
(num-test (log -2.0e+00-1.19209289550781250e-07i) 6.9314718055994708577e-1-3.1415925939851484631e0i)
(num-test (log -2.0e+00-2.0e+00i) 1.0397207708399179641e0-2.3561944901923449288e0i)
(num-test (log -2.0e+00-2.0e+00i) 1.0397207708399179641e0-2.3561944901923449288e0i)
(num-test (log -2.0e+00-5.0e-01i) 7.2345949146816273071e-1-2.8966139904629290843e0i)
(num-test (log -2.0e+00-5.0e-01i) 7.2345949146816273071e-1-2.8966139904629290843e0i)
(num-test (log -2.0e+00-8.3886080e+06i) 1.5942385152878770538e1-1.5707965652134757208e0i)
(num-test (log -2.0e+00-8.3886080e+06i) 1.5942385152878770538e1-1.5707965652134757208e0i)
(num-test (log -2.71828182845905) 1.0+3.14159265358979i)
(num-test (log -2.71828182845905+0.00000001i) 1.0+3.14159264991100i)
(num-test (log -2.71828182845905+0.0i) 1.0+3.14159265358979i)
(num-test (log -2.71828182845905+1.0i) 1.06346400552149+2.78907923181217i)
(num-test (log -2.71828182845905+1234.0i) 7.11801863067090+1.57299914481088i)
(num-test (log -2.71828182845905+1234000000.0i) 20.93352676242961+1.57079632899772i)
(num-test (log -2.71828182845905+2.71828182845905i) 1.34657359027997+2.35619449019234i)
(num-test (log -2.71828182845905+3.14159265358979i) 1.42415703773030+2.28408086723395i)
(num-test (log -2.71828182845905-0.00000001i) 1.0-3.14159264991100i)
(num-test (log -2.71828182845905-0.0i) 1.0+3.14159265358979i)
(num-test (log -2.71828182845905-1.0i) 1.06346400552149-2.78907923181217i)
(num-test (log -2.71828182845905-1234.0i) 7.11801863067090-1.57299914481088i)
(num-test (log -2.71828182845905-1234000000.0i) 20.93352676242961-1.57079632899772i)
(num-test (log -2.71828182845905-2.71828182845905i) 1.34657359027997-2.35619449019234i)
(num-test (log -2.71828182845905-3.14159265358979i) 1.42415703773030-2.28408086723395i)
(num-test (log -2/1) 0.69314718055995+3.14159265358979i)
(num-test (log -2/10) -1.60943791243410+3.14159265358979i)
(num-test (log -2/1234) -6.42486902390539+3.14159265358979i)
(num-test (log -2/1234000000) -20.24037958186966+3.14159265358979i)
(num-test (log -2/2) 0.0+3.14159265358979i)
(num-test (log -2/3) -0.40546510810816+3.14159265358979i)
(num-test (log -2/362880) -12.10868029952152+3.14159265358979i)
(num-test (log -2/500029) -12.42927419516245+3.14159265358979i)
(num-test (log -3) 1.09861228866811+3.14159265358979i)
(num-test (log -3.14159265358979) 1.14472988584940+3.14159265358979i)
(num-test (log -3.14159265358979+0.00000001i) 1.14472988584940+3.14159265040669i)
(num-test (log -3.14159265358979+0.0i) 1.14472988584940+3.14159265358979i)
(num-test (log -3.14159265358979+1.0i) 1.19298515341341+2.83342358247381i)
(num-test (log -3.14159265358979+1234.0i) 7.11801944515932+1.57334218244020i)
(num-test (log -3.14159265358979+1234000000.0i) 20.93352676242961+1.57079632934076i)
(num-test (log -3.14159265358979+2.71828182845905i) 1.42415703773030+2.42830811315074i)
(num-test (log -3.14159265358979+3.14159265358979i) 1.49130347612937+2.35619449019234i)
(num-test (log -3.14159265358979-0.00000001i) 1.14472988584940-3.14159265040669i)
(num-test (log -3.14159265358979-0.0i) 1.14472988584940+3.14159265358979i)
(num-test (log -3.14159265358979-1.0i) 1.19298515341341-2.83342358247381i)
(num-test (log -3.14159265358979-1234.0i) 7.11801944515932-1.57334218244020i)
(num-test (log -3.14159265358979-1234000000.0i) 20.93352676242961-1.57079632934076i)
(num-test (log -3.14159265358979-2.71828182845905i) 1.42415703773030-2.42830811315074i)
(num-test (log -3.14159265358979-3.14159265358979i) 1.49130347612937-2.35619449019234i)
(num-test (log -3/1) 1.09861228866811+3.14159265358979i)
(num-test (log -3/10) -1.20397280432594+3.14159265358979i)
(num-test (log -3/1234) -6.01940391579722+3.14159265358979i)
(num-test (log -3/1234000000) -19.83491447376150+3.14159265358979i)
(num-test (log -3/2) 0.40546510810816+3.14159265358979i)
(num-test (log -3/3) 0.0+3.14159265358979i)
(num-test (log -3/362880) -11.70321519141336+3.14159265358979i)
(num-test (log -3/500029) -12.02380908705428+3.14159265358979i)
(num-test (log -362880) 12.80182748008147+3.14159265358979i)
(num-test (log -362880/1) 12.80182748008147+3.14159265358979i)
(num-test (log -362880/10) 10.49924238708742+3.14159265358979i)
(num-test (log -362880/1234) 5.68381127561614+3.14159265358979i)
(num-test (log -362880/1234000000) -8.13169928234814+3.14159265358979i)
(num-test (log -362880/2) 12.10868029952152+3.14159265358979i)
(num-test (log -362880/3) 11.70321519141336+3.14159265358979i)
(num-test (log -362880/362880) 0.0+3.14159265358979i)
(num-test (log -362880/500029) -0.32059389564092+3.14159265358979i)
(num-test (log -5.0e-01+0.0e+00i) -6.9314718055994530942e-1+3.1415926535897932385e0i)
(num-test (log -5.0e-01+1.0e+00i) 1.1157177565710487788e-1+2.0344439357957027354e0i)
(num-test (log -5.0e-01+1.0e+00i) 1.1157177565710487788e-1+2.0344439357957027354e0i)
(num-test (log -5.0e-01+1.19209289550781250e-07i) -6.9314718055991688771e-1+3.1415924151712141369e0i)
(num-test (log -5.0e-01+1.19209289550781250e-07i) -6.9314718055991688771e-1+3.1415924151712141369e0i)
(num-test (log -5.0e-01+2.0e+00i) 7.2345949146816273071e-1+1.8157749899217607734e0i)
(num-test (log -5.0e-01+2.0e+00i) 7.2345949146816273071e-1+1.8157749899217607734e0i)
(num-test (log -5.0e-01+5.0e-01i) -3.4657359027997265471e-1+2.3561944901923449288e0i)
(num-test (log -5.0e-01+5.0e-01i) -3.4657359027997265471e-1+2.3561944901923449288e0i)
(num-test (log -5.0e-01+8.3886080e+06i) 1.5942385152878743893e1+1.5707963863995413946e0i)
(num-test (log -5.0e-01+8.3886080e+06i) 1.5942385152878743893e1+1.5707963863995413946e0i)
(num-test (log -5.0e-01-1.0e+00i) 1.1157177565710487788e-1-2.0344439357957027354e0i)
(num-test (log -5.0e-01-1.0e+00i) 1.1157177565710487788e-1-2.0344439357957027354e0i)
(num-test (log -5.0e-01-1.19209289550781250e-07i) -6.9314718055991688771e-1-3.1415924151712141369e0i)
(num-test (log -5.0e-01-1.19209289550781250e-07i) -6.9314718055991688771e-1-3.1415924151712141369e0i)
(num-test (log -5.0e-01-2.0e+00i) 7.2345949146816273071e-1-1.8157749899217607734e0i)
(num-test (log -5.0e-01-2.0e+00i) 7.2345949146816273071e-1-1.8157749899217607734e0i)
(num-test (log -5.0e-01-5.0e-01i) -3.4657359027997265471e-1-2.3561944901923449288e0i)
(num-test (log -5.0e-01-5.0e-01i) -3.4657359027997265471e-1-2.3561944901923449288e0i)
(num-test (log -5.0e-01-8.3886080e+06i) 1.5942385152878743893e1-1.5707963863995413946e0i)
(num-test (log -5.0e-01-8.3886080e+06i) 1.5942385152878743893e1-1.5707963863995413946e0i)
(num-test (log -500029) 13.12242137572239+3.14159265358979i)
(num-test (log -500029/1) 13.12242137572239+3.14159265358979i)
(num-test (log -500029/10) 10.81983628272835+3.14159265358979i)
(num-test (log -500029/1234) 6.00440517125706+3.14159265358979i)
(num-test (log -500029/1234000000) -7.81110538670721+3.14159265358979i)
(num-test (log -500029/2) 12.42927419516245+3.14159265358979i)
(num-test (log -500029/3) 12.02380908705428+3.14159265358979i)
(num-test (log -500029/362880) 0.32059389564092+3.14159265358979i)
(num-test (log -500029/500029) 0.0+3.14159265358979i)
(num-test (log -8.3886080e+06+0.0e+00i) 1.5942385152878742117e1+3.1415926535897932385e0i)
(num-test (log -8.3886080e+06+1.0e+00i) 1.5942385152878749222e1+3.1415925343805036877e0i)
(num-test (log -8.3886080e+06+1.0e+00i) 1.5942385152878749222e1+3.1415925343805036877e0i)
(num-test (log -8.3886080e+06+1.19209289550781250e-07i) 1.5942385152878742117e1+3.1415926535897790276e0i)
(num-test (log -8.3886080e+06+1.19209289550781250e-07i) 1.5942385152878742117e1+3.1415926535897790276e0i)
(num-test (log -8.3886080e+06+2.0e+00i) 1.5942385152878770538e1+3.1415924151712141369e0i)
(num-test (log -8.3886080e+06+2.0e+00i) 1.5942385152878770538e1+3.1415924151712141369e0i)
(num-test (log -8.3886080e+06+5.0e-01i) 1.5942385152878743893e1+3.1415925939851484631e0i)
(num-test (log -8.3886080e+06+5.0e-01i) 1.5942385152878743893e1+3.1415925939851484631e0i)
(num-test (log -8.3886080e+06+8.3886080e+06i) 1.6288958743158714771e1+2.3561944901923449288e0i)
(num-test (log -8.3886080e+06+8.3886080e+06i) 1.6288958743158714771e1+2.3561944901923449288e0i)
(num-test (log -8.3886080e+06-1.0e+00i) 1.5942385152878749222e1-3.1415925343805036877e0i)
(num-test (log -8.3886080e+06-1.0e+00i) 1.5942385152878749222e1-3.1415925343805036877e0i)
(num-test (log -8.3886080e+06-1.19209289550781250e-07i) 1.5942385152878742117e1-3.1415926535897790276e0i)
(num-test (log -8.3886080e+06-1.19209289550781250e-07i) 1.5942385152878742117e1-3.1415926535897790276e0i)
(num-test (log -8.3886080e+06-2.0e+00i) 1.5942385152878770538e1-3.1415924151712141369e0i)
(num-test (log -8.3886080e+06-2.0e+00i) 1.5942385152878770538e1-3.1415924151712141369e0i)
(num-test (log -8.3886080e+06-5.0e-01i) 1.5942385152878743893e1-3.1415925939851484631e0i)
(num-test (log -8.3886080e+06-5.0e-01i) 1.5942385152878743893e1-3.1415925939851484631e0i)
(num-test (log -8.3886080e+06-8.3886080e+06i) 1.6288958743158714771e1-2.3561944901923449288e0i)
(num-test (log -8.3886080e+06-8.3886080e+06i) 1.6288958743158714771e1-2.3561944901923449288e0i)
(num-test (log -9223372036854775808) 4.366827237527655449328562365186512378885E1+3.141592653589793238462643383279502884195E0i)
(num-test (log .3678794411714423) -1.0)
(num-test (log 0+i) (complex 0.0 (* 0.5 pi)))
(num-test (log 0-i) (complex 0.0 (* -0.5 pi)))
(num-test (log 0.0+0.00000001i) -18.42068074395237+1.57079632679490i)
(num-test (log 0.0+1.0i) 0.0+1.57079632679490i)
(num-test (log 0.0+1234.0i) 7.11801620446533+1.57079632679490i)
(num-test (log 0.0+1234000000.0i) 20.93352676242961+1.57079632679490i)
(num-test (log 0.0+2.71828182845905i) 1.0+1.57079632679490i)
(num-test (log 0.0+3.14159265358979i) 1.14472988584940+1.57079632679490i)
(num-test (log 0.0-0.00000001i) -18.42068074395237-1.57079632679490i)
(num-test (log 0.0-1.0i) 0.0-1.57079632679490i)
(num-test (log 0.0-1234.0i) 7.11801620446533-1.57079632679490i)
(num-test (log 0.0-1234000000.0i) 20.93352676242961-1.57079632679490i)
(num-test (log 0.0-2.71828182845905i) 1.0-1.57079632679490i)
(num-test (log 0.0-3.14159265358979i) 1.14472988584940-1.57079632679490i)
(num-test (log 0.00000001) -18.42068074395237)
(num-test (log 0.00000001+0.00000001i) -18.07410715367239+0.78539816339745i)
(num-test (log 0.00000001+0.0i) -18.42068074395237)
(num-test (log 0.00000001+1.0i) 0.0+1.57079631679490i)
(num-test (log 0.00000001+1234.0i) 7.11801620446533+1.57079632678679i)
(num-test (log 0.00000001+1234000000.0i) 20.93352676242961+1.57079632679490i)
(num-test (log 0.00000001+2.71828182845905i) 1.0+1.57079632311610i)
(num-test (log 0.00000001+3.14159265358979i) 1.14472988584940+1.57079632361180i)
(num-test (log 0.00000001-0.00000001i) -18.07410715367239-0.78539816339745i)
(num-test (log 0.00000001-0.0i) -18.42068074395237)
(num-test (log 0.00000001-1.0i) 0.0-1.57079631679490i)
(num-test (log 0.00000001-1234.0i) 7.11801620446533-1.57079632678679i)
(num-test (log 0.00000001-1234000000.0i) 20.93352676242961-1.57079632679490i)
(num-test (log 0.00000001-2.71828182845905i) 1.0-1.57079632311610i)
(num-test (log 0.00000001-3.14159265358979i) 1.14472988584940-1.57079632361180i)
(num-test (log 0.0e+00+1.0e+00i) 0+1.5707963267948966192e0i)
(num-test (log 0.0e+00+1.19209289550781250e-07i) -1.5942385152878742117e1+1.5707963267948966192e0i)
(num-test (log 0.0e+00+2.0e+00i) 6.9314718055994530942e-1+1.5707963267948966192e0i)
(num-test (log 0.0e+00+5.0e-01i) -6.9314718055994530942e-1+1.5707963267948966192e0i)
(num-test (log 0.0e+00+8.3886080e+06i) 1.5942385152878742117e1+1.5707963267948966192e0i)
(num-test (log 0.0e+00-1.0e+00i) 0-1.5707963267948966192e0i)
(num-test (log 0.0e+00-1.19209289550781250e-07i) -1.5942385152878742117e1-1.5707963267948966192e0i)
(num-test (log 0.0e+00-2.0e+00i) 6.9314718055994530942e-1-1.5707963267948966192e0i)
(num-test (log 0.0e+00-5.0e-01i) -6.9314718055994530942e-1-1.5707963267948966192e0i)
(num-test (log 0.0e+00-8.3886080e+06i) 1.5942385152878742117e1-1.5707963267948966192e0i)
(num-test (log 1 -1) 0.0)
(num-test (log 1) 0.0)
(num-test (log 1.0) 0.0)
(num-test (log 1.0+0.00000001i) 0.0+0.00000001i)
(num-test (log 1.0+0.0i) 0.0)
(num-test (log 1.0+1.0i) 0.34657359027997+0.78539816339745i)
(num-test (log 1.0+1234.0i) 7.11801653281724+1.56998595420081i)
(num-test (log 1.0+1234000000.0i) 20.93352676242961+1.57079632598452i)
(num-test (log 1.0+2.71828182845905i) 1.06346400552149+1.21828290501728i)
(num-test (log 1.0+3.14159265358979i) 1.19298515341341+1.26262725567891i)
(num-test (log 1.0+i -2.0) 0.26160508088635-0.052598406051983i)
(num-test (log 1.0-0.00000001i) 0.0-0.00000001i)
(num-test (log 1.0-0.0i) 0.0)
(num-test (log 1.0-1.0i) 0.34657359027997-0.78539816339745i)
(num-test (log 1.0-1234.0i) 7.11801653281724-1.56998595420081i)
(num-test (log 1.0-1234000000.0i) 20.93352676242961-1.57079632598452i)
(num-test (log 1.0-2.71828182845905i) 1.06346400552149-1.21828290501728i)
(num-test (log 1.0-3.14159265358979i) 1.19298515341341-1.26262725567891i)
(num-test (log 1.0e+00+0.0e+00i) 0e0+0.0i)
(num-test (log 1.0e+00+1.0e+00i) 3.4657359027997265471e-1+7.8539816339744830962e-1i)
(num-test (log 1.0e+00+1.0e+00i) 3.4657359027997265471e-1+7.8539816339744830962e-1i)
(num-test (log 1.0e+00+1.19209289550781250e-07i) 7.1054273576009513716e-15+1.1920928955078068531e-7i)
(num-test (log 1.0e+00+1.19209289550781250e-07i) 7.1054273576009513716e-15+1.1920928955078068531e-7i)
(num-test (log 1.0e+00+2.0e+00i) 8.0471895621705018730e-1+1.1071487177940905030e0i)
(num-test (log 1.0e+00+2.0e+00i) 8.0471895621705018730e-1+1.1071487177940905030e0i)
(num-test (log 1.0e+00+5.0e-01i) 1.1157177565710487788e-1+4.6364760900080611621e-1i)
(num-test (log 1.0e+00+5.0e-01i) 1.1157177565710487788e-1+4.6364760900080611621e-1i)
(num-test (log 1.0e+00+8.3886080e+06i) 1.5942385152878749222e1+1.5707962075856070685e0i)
(num-test (log 1.0e+00+8.3886080e+06i) 1.5942385152878749222e1+1.5707962075856070685e0i)
(num-test (log 1.0e+00-1.0e+00i) 3.4657359027997265471e-1-7.8539816339744830962e-1i)
(num-test (log 1.0e+00-1.0e+00i) 3.4657359027997265471e-1-7.8539816339744830962e-1i)
(num-test (log 1.0e+00-1.19209289550781250e-07i) 7.1054273576009513716e-15-1.1920928955078068531e-7i)
(num-test (log 1.0e+00-1.19209289550781250e-07i) 7.1054273576009513716e-15-1.1920928955078068531e-7i)
(num-test (log 1.0e+00-2.0e+00i) 8.0471895621705018730e-1-1.1071487177940905030e0i)
(num-test (log 1.0e+00-2.0e+00i) 8.0471895621705018730e-1-1.1071487177940905030e0i)
(num-test (log 1.0e+00-5.0e-01i) 1.1157177565710487788e-1-4.6364760900080611621e-1i)
(num-test (log 1.0e+00-5.0e-01i) 1.1157177565710487788e-1-4.6364760900080611621e-1i)
(num-test (log 1.0e+00-8.3886080e+06i) 1.5942385152878749222e1-1.5707962075856070685e0i)
(num-test (log 1.0e+00-8.3886080e+06i) 1.5942385152878749222e1-1.5707962075856070685e0i)
(num-test (log 1.0e-12) -27.63102111592855)
(num-test (log 1.0e-8) -18.42068074395237)
(num-test (log 1.110223024625156799999999999999999999997E-16) -3.673680056967710116530769529852882544059E1)
(num-test (log 1.19209289550781250e-07+0.0e+00i) -1.5942385152878742117e1+0.0i)
(num-test (log 1.19209289550781250e-07+1.0e+00i) 7.1054273576009513716e-15+1.5707962075856070685e0i)
(num-test (log 1.19209289550781250e-07+1.0e+00i) 7.1054273576009513716e-15+1.5707962075856070685e0i)
(num-test (log 1.19209289550781250e-07+1.19209289550781250e-07i) -1.5595811562598769462e1+7.8539816339744830962e-1i)
(num-test (log 1.19209289550781250e-07+1.19209289550781250e-07i) -1.5595811562598769462e1+7.8539816339744830962e-1i)
(num-test (log 1.19209289550781250e-07+2.0e+00i) 6.9314718055994708577e-1+1.5707962671902518438e0i)
(num-test (log 1.19209289550781250e-07+2.0e+00i) 6.9314718055994708577e-1+1.5707962671902518438e0i)
(num-test (log 1.19209289550781250e-07+5.0e-01i) -6.9314718055991688771e-1+1.5707960883763175177e0i)
(num-test (log 1.19209289550781250e-07+5.0e-01i) -6.9314718055991688771e-1+1.5707960883763175177e0i)
(num-test (log 1.19209289550781250e-07+8.3886080e+06i) 1.5942385152878742117e1+1.5707963267948824084e0i)
(num-test (log 1.19209289550781250e-07+8.3886080e+06i) 1.5942385152878742117e1+1.5707963267948824084e0i)
(num-test (log 1.19209289550781250e-07-1.0e+00i) 7.1054273576009513716e-15-1.5707962075856070685e0i)
(num-test (log 1.19209289550781250e-07-1.0e+00i) 7.1054273576009513716e-15-1.5707962075856070685e0i)
(num-test (log 1.19209289550781250e-07-1.19209289550781250e-07i) -1.5595811562598769462e1-7.8539816339744830962e-1i)
(num-test (log 1.19209289550781250e-07-1.19209289550781250e-07i) -1.5595811562598769462e1-7.8539816339744830962e-1i)
(num-test (log 1.19209289550781250e-07-2.0e+00i) 6.9314718055994708577e-1-1.5707962671902518438e0i)
(num-test (log 1.19209289550781250e-07-2.0e+00i) 6.9314718055994708577e-1-1.5707962671902518438e0i)
(num-test (log 1.19209289550781250e-07-5.0e-01i) -6.9314718055991688771e-1-1.5707960883763175177e0i)
(num-test (log 1.19209289550781250e-07-5.0e-01i) -6.9314718055991688771e-1-1.5707960883763175177e0i)
(num-test (log 1.19209289550781250e-07-8.3886080e+06i) 1.5942385152878742117e1-1.5707963267948824084e0i)
(num-test (log 1.19209289550781250e-07-8.3886080e+06i) 1.5942385152878742117e1-1.5707963267948824084e0i)
(num-test (log 1.5 -1) 0-0.12906355241341i)
(num-test (log 1.7976931e+308) 709.78271287399)
(num-test (log 1/1) 0.0)
(num-test (log 1/10) -2.30258509299405)
(num-test (log 1/1073741824 2) -30)
(num-test (log 1/1152921504606846976 8) -20)
(num-test (log 1/1234) -7.11801620446533)
(num-test (log 1/1234000000) -20.93352676242961)
(num-test (log 1/16777216 2) -24)
(num-test (log 1/18014398509481984 512) -6)
(num-test (log 1/2 1/4) 1/2)
(num-test (log 1/2 1/8) 1/3) 
(num-test (log 1/2 8) -1/3) 
(num-test (log 1/2) -0.69314718055995)
(num-test (log 1/2147483648 2) -31)
(num-test (log 1/256 2) -8)
(num-test (log 1/3) -1.09861228866811)
(num-test (log 1/362880) -12.80182748008147)
(num-test (log 1/4 1/2) 2)
(num-test (log 1/4 1/2) 2)
(num-test (log 1/500029) -13.12242137572239)
(num-test (log 1/65536 2) -16)
(num-test (log 1/8192 2) -13)
;(num-test (log 10 (real-part (log 0))) 0.0) ; ??? -- this returns -nan-nani in clang, 0.0 in gcc
(num-test (log 10) 2.30258509299405)
(num-test (log 10.0 (exp -1)) (- (log 10.0)))
(num-test (log 10.0 (exp 1)) (log 10.0))
(num-test (log 10.0 -0.001) -0.27620436338394-0.12561556740966i)
(num-test (log 10.0 0.001) -0.33333333333333)
(num-test (log 10.0 100.0) 0.5)
(num-test (log 10.0 1e-20) -0.05)
(num-test (log 10.0 1e20) 0.05)
(num-test (log 10.0 2124008553358849/781379079653017) 2.302585092994045684017991454684419658469E0)
(num-test (log 10/1) 2.30258509299405)
(num-test (log 10/10) 0.0)
(num-test (log 10/1234) -4.81543111147129)
(num-test (log 10/1234000000) -18.63094166943556)
(num-test (log 10/2) 1.60943791243410)
(num-test (log 10/3) 1.20397280432594)
(num-test (log 10/362880) -10.49924238708742)
(num-test (log 10/500029) -10.81983628272835)
(num-test (log 12/8 3/2) 1.0)
(num-test (log 1234) 7.11801620446533)
(num-test (log 1234.0) 7.11801620446533)
(num-test (log 1234.0+0.00000001i) 7.11801620446533+0.00000000000810i)
(num-test (log 1234.0+0.0i) 7.11801620446533)
(num-test (log 1234.0+1.0i) 7.11801653281724+0.00081037259408i)
(num-test (log 1234.0+1234.0i) 7.46458979474531+0.78539816339745i)
(num-test (log 1234.0+1234000000.0i) 20.93352676243011+1.57079532679490i)
(num-test (log 1234.0+2.71828182845905i) 7.11801863067090+0.00220281801598i)
(num-test (log 1234.0+3.14159265358979i) 7.11801944515932+0.00254585564530i)
(num-test (log 1234.0-0.00000001i) 7.11801620446533-0.00000000000810i)
(num-test (log 1234.0-0.0i) 7.11801620446533)
(num-test (log 1234.0-1.0i) 7.11801653281724-0.00081037259408i)
(num-test (log 1234.0-1234.0i) 7.46458979474531-0.78539816339745i)
(num-test (log 1234.0-1234000000.0i) 20.93352676243011-1.57079532679490i)
(num-test (log 1234.0-2.71828182845905i) 7.11801863067090-0.00220281801598i)
(num-test (log 1234.0-3.14159265358979i) 7.11801944515932-0.00254585564530i)
(num-test (log 1234/1) 7.11801620446533)
(num-test (log 1234/10) 4.81543111147129)
(num-test (log 1234/1234) 0.0)
(num-test (log 1234/1234000000) -13.81551055796427)
(num-test (log 1234/2) 6.42486902390539)
(num-test (log 1234/3) 6.01940391579722)
(num-test (log 1234/362880) -5.68381127561614)
(num-test (log 1234/500029) -6.00440517125706)
(num-test (log 1234000000) 20.93352676242961)
(num-test (log 1234000000.0) 20.93352676242961)
(num-test (log 1234000000.0+0.00000001i) 20.93352676242961+0.0i)
(num-test (log 1234000000.0+0.0i) 20.93352676242961)
(num-test (log 1234000000.0+1.0i) 20.93352676242961+0.00000000081037i)
(num-test (log 1234000000.0+1234.0i) 20.93352676243011+0.00000100000000i)
(num-test (log 1234000000.0+1234000000.0i) 21.28010035270958+0.78539816339745i)
(num-test (log 1234000000.0+2.71828182845905i) 20.93352676242961+0.00000000220282i)
(num-test (log 1234000000.0+3.14159265358979i) 20.93352676242961+0.00000000254586i)
(num-test (log 1234000000.0-0.00000001i) 20.93352676242961-0.0i)
(num-test (log 1234000000.0-0.0i) 20.93352676242961)
(num-test (log 1234000000.0-1.0i) 20.93352676242961-0.00000000081037i)
(num-test (log 1234000000.0-1234.0i) 20.93352676243011-0.00000100000000i)
(num-test (log 1234000000.0-1234000000.0i) 21.28010035270958-0.78539816339745i)
(num-test (log 1234000000.0-2.71828182845905i) 20.93352676242961-0.00000000220282i)
(num-test (log 1234000000.0-3.14159265358979i) 20.93352676242961-0.00000000254586i)
(num-test (log 1234000000/1) 20.93352676242961)
(num-test (log 1234000000/10) 18.63094166943556)
(num-test (log 1234000000/1234) 13.81551055796427)
(num-test (log 1234000000/1234000000) 0.0)
(num-test (log 1234000000/2) 20.24037958186966)
(num-test (log 1234000000/3) 19.83491447376150)
(num-test (log 1234000000/362880) 8.13169928234814)
(num-test (log 1234000000/500029) 7.81110538670721)
(num-test (log 15693/12583 24271/35566) -5.78025354982372501902371206100042173188E-1)
(num-test (log 1e-100) -2.302585092994045684017991454684364207602E2)
(num-test (log 1e-18) -4.144653167389282231232384618431855573682E1)
(num-test (log 1e-300) -6.907755278982137052053974364053092622806E2)
(num-test (log 1e-50 10) -50.0)
(num-test (log 1e100) 2.302585092994045684017991454684364207602E2)
(num-test (log 1e18) 4.144653167389282231232384618431855573682E1)
(num-test (log 1e300) 6.907755278982137052053974364053092622806E2)
(num-test (log 1e50 10) 50.0)
(num-test (log 2 1/8) -1/3) 
(num-test (log 2 2) 1)
(num-test (log 2 8) 1/3) 
(num-test (log 2) 0.69314718055995)
(num-test (log 2.0e+00+0.0e+00i) 6.9314718055994530942e-1+0.0i)
(num-test (log 2.0e+00+1.0e+00i) 8.0471895621705018730e-1+4.6364760900080611621e-1i)
(num-test (log 2.0e+00+1.0e+00i) 8.0471895621705018730e-1+4.6364760900080611621e-1i)
(num-test (log 2.0e+00+1.19209289550781250e-07i) 6.9314718055994708577e-1+5.9604644775390554414e-8i)
(num-test (log 2.0e+00+1.19209289550781250e-07i) 6.9314718055994708577e-1+5.9604644775390554414e-8i)
(num-test (log 2.0e+00+2.0e+00i) 1.0397207708399179641e0+7.8539816339744830962e-1i)
(num-test (log 2.0e+00+2.0e+00i) 1.0397207708399179641e0+7.8539816339744830962e-1i)
(num-test (log 2.0e+00+5.0e-01i) 7.2345949146816273071e-1+2.4497866312686415417e-1i)
(num-test (log 2.0e+00+5.0e-01i) 7.2345949146816273071e-1+2.4497866312686415417e-1i)
(num-test (log 2.0e+00+8.3886080e+06i) 1.5942385152878770538e1+1.5707960883763175177e0i)
(num-test (log 2.0e+00+8.3886080e+06i) 1.5942385152878770538e1+1.5707960883763175177e0i)
(num-test (log 2.0e+00-1.0e+00i) 8.0471895621705018730e-1-4.6364760900080611621e-1i)
(num-test (log 2.0e+00-1.0e+00i) 8.0471895621705018730e-1-4.6364760900080611621e-1i)
(num-test (log 2.0e+00-1.19209289550781250e-07i) 6.9314718055994708577e-1-5.9604644775390554414e-8i)
(num-test (log 2.0e+00-1.19209289550781250e-07i) 6.9314718055994708577e-1-5.9604644775390554414e-8i)
(num-test (log 2.0e+00-2.0e+00i) 1.0397207708399179641e0-7.8539816339744830962e-1i)
(num-test (log 2.0e+00-2.0e+00i) 1.0397207708399179641e0-7.8539816339744830962e-1i)
(num-test (log 2.0e+00-5.0e-01i) 7.2345949146816273071e-1-2.4497866312686415417e-1i)
(num-test (log 2.0e+00-5.0e-01i) 7.2345949146816273071e-1-2.4497866312686415417e-1i)
(num-test (log 2.0e+00-8.3886080e+06i) 1.5942385152878770538e1-1.5707960883763175177e0i)
(num-test (log 2.0e+00-8.3886080e+06i) 1.5942385152878770538e1-1.5707960883763175177e0i)
(num-test (log 2.2250739e-308) -708.39641851362)
(num-test (log 2.688117141816135E+43) 100.0)
(num-test (log 2.71828182845905) 1.0)
(num-test (log 2.71828182845905+0.00000001i) 1.0+0.00000000367879i)
(num-test (log 2.71828182845905+0.0i) 1.0)
(num-test (log 2.71828182845905+1.0i) 1.06346400552149+0.35251342177762i)
(num-test (log 2.71828182845905+1234.0i) 7.11801863067090+1.56859350877892i)
(num-test (log 2.71828182845905+1234000000.0i) 20.93352676242961+1.57079632459208i)
(num-test (log 2.71828182845905+2.71828182845905i) 1.34657359027997+0.78539816339745i)
(num-test (log 2.71828182845905+3.14159265358979i) 1.42415703773030+0.85751178635585i)
(num-test (log 2.71828182845905-0.00000001i) 1.0-0.00000000367879i)
(num-test (log 2.71828182845905-0.0i) 1.0)
(num-test (log 2.71828182845905-1.0i) 1.06346400552149-0.35251342177762i)
(num-test (log 2.71828182845905-1234.0i) 7.11801863067090-1.56859350877892i)
(num-test (log 2.71828182845905-1234000000.0i) 20.93352676242961-1.57079632459208i)
(num-test (log 2.71828182845905-2.71828182845905i) 1.34657359027997-0.78539816339745i)
(num-test (log 2.71828182845905-3.14159265358979i) 1.42415703773030-0.85751178635585i)
(num-test (log 2/1) 0.69314718055995)
(num-test (log 2/10) -1.60943791243410)
(num-test (log 2/1234) -6.42486902390539)
(num-test (log 2/1234000000) -20.24037958186966)
(num-test (log 2/2) 0.0)
(num-test (log 2/3) -0.40546510810816)
(num-test (log 2/362880) -12.10868029952152)
(num-test (log 2/500029) -12.42927419516245)
(num-test (log 22026.46579480672) 10.0)
(num-test (log 24998/50401 24728/63453) 7.441028498776462417495086765025452881649E-1)
(num-test (log 25438/28960 36472/54817) 3.182468797561633550530828023298618520944E-1)
(num-test (log 2921/7914 2921/7914) 1)
(num-test (log 3) 1.09861228866811)
(num-test (log 3.14159265358979+0.00000001i) 1.14472988584940+0.00000000318310i)
(num-test (log 3.14159265358979+0.0i) 1.14472988584940)
(num-test (log 3.14159265358979+1.0i) 1.19298515341341+0.30816907111598i)
(num-test (log 3.14159265358979+1234.0i) 7.11801944515932+1.56825047114960i)
(num-test (log 3.14159265358979+1234000000.0i) 20.93352676242961+1.57079632424904i)
(num-test (log 3.14159265358979+2.71828182845905i) 1.42415703773030+0.71328454043905i)
(num-test (log 3.14159265358979+3.14159265358979i) 1.49130347612937+0.78539816339745i)
(num-test (log 3.14159265358979-0.00000001i) 1.14472988584940-0.00000000318310i)
(num-test (log 3.14159265358979-0.0i) 1.14472988584940)
(num-test (log 3.14159265358979-1.0i) 1.19298515341341-0.30816907111598i)
(num-test (log 3.14159265358979-1234.0i) 7.11801944515932-1.56825047114960i)
(num-test (log 3.14159265358979-1234000000.0i) 20.93352676242961-1.57079632424904i)
(num-test (log 3.14159265358979-2.71828182845905i) 1.42415703773030-0.71328454043905i)
(num-test (log 3.14159265358979-3.14159265358979i) 1.49130347612937-0.78539816339745i)
(num-test (log 3.720075976020836E-44) -100.0)
(num-test (log 3/1) 1.09861228866811)
(num-test (log 3/10) -1.20397280432594)
(num-test (log 3/1234) -6.01940391579722)
(num-test (log 3/1234000000) -19.83491447376150)
(num-test (log 3/2) 0.40546510810816)
(num-test (log 3/3) 0.0)
(num-test (log 3/362880) -11.70321519141336)
(num-test (log 3/500029) -12.02380908705428)
(num-test (log 362880) 12.80182748008147)
(num-test (log 362880/1) 12.80182748008147)
(num-test (log 362880/10) 10.49924238708742)
(num-test (log 362880/1234) 5.68381127561614)
(num-test (log 362880/1234000000) -8.13169928234814)
(num-test (log 362880/2) 12.10868029952152)
(num-test (log 362880/3) 11.70321519141336)
(num-test (log 362880/362880) 0.0)
(num-test (log 362880/500029) -0.32059389564092)
(num-test (log 4 1/2) -2)
(num-test (log 4.5399929762484853E-5) -10.0)
(num-test (log 42665/30784 48270/29769) 6.752638664357152674138191677370820431573E-1)
(num-test (log 43340/27863 27919/48593) -7.971826992064755184257579917033070384525E-1)
(num-test (log 43686/40844 3924/13265) -5.522724914533037935994124583907811339125E-2)
(num-test (log 46770/6899 56965/50618) 1.620137763694524415676013256791616662615E1)
(num-test (log 5.0e-01+0.0e+00i) -6.9314718055994530942e-1+0.0i)
(num-test (log 5.0e-01+1.0e+00i) 1.1157177565710487788e-1+1.1071487177940905030e0i)
(num-test (log 5.0e-01+1.0e+00i) 1.1157177565710487788e-1+1.1071487177940905030e0i)
(num-test (log 5.0e-01+1.19209289550781250e-07i) -6.9314718055991688771e-1+2.3841857910155798249e-7i)
(num-test (log 5.0e-01+1.19209289550781250e-07i) -6.9314718055991688771e-1+2.3841857910155798249e-7i)
(num-test (log 5.0e-01+2.0e+00i) 7.2345949146816273071e-1+1.3258176636680324651e0i)
(num-test (log 5.0e-01+2.0e+00i) 7.2345949146816273071e-1+1.3258176636680324651e0i)
(num-test (log 5.0e-01+5.0e-01i) -3.4657359027997265471e-1+7.8539816339744830962e-1i)
(num-test (log 5.0e-01+5.0e-01i) -3.4657359027997265471e-1+7.8539816339744830962e-1i)
(num-test (log 5.0e-01+8.3886080e+06i) 1.5942385152878743893e1+1.5707962671902518438e0i)
(num-test (log 5.0e-01+8.3886080e+06i) 1.5942385152878743893e1+1.5707962671902518438e0i)
(num-test (log 5.0e-01-1.0e+00i) 1.1157177565710487788e-1-1.1071487177940905030e0i)
(num-test (log 5.0e-01-1.0e+00i) 1.1157177565710487788e-1-1.1071487177940905030e0i)
(num-test (log 5.0e-01-1.19209289550781250e-07i) -6.9314718055991688771e-1-2.3841857910155798249e-7i)
(num-test (log 5.0e-01-1.19209289550781250e-07i) -6.9314718055991688771e-1-2.3841857910155798249e-7i)
(num-test (log 5.0e-01-2.0e+00i) 7.2345949146816273071e-1-1.3258176636680324651e0i)
(num-test (log 5.0e-01-2.0e+00i) 7.2345949146816273071e-1-1.3258176636680324651e0i)
(num-test (log 5.0e-01-5.0e-01i) -3.4657359027997265471e-1-7.8539816339744830962e-1i)
(num-test (log 5.0e-01-5.0e-01i) -3.4657359027997265471e-1-7.8539816339744830962e-1i)
(num-test (log 5.0e-01-8.3886080e+06i) 1.5942385152878743893e1-1.5707962671902518438e0i)
(num-test (log 5.0e-01-8.3886080e+06i) 1.5942385152878743893e1-1.5707962671902518438e0i)
(num-test (log 500029) 13.12242137572239)
(num-test (log 500029/1) 13.12242137572239)
(num-test (log 500029/10) 10.81983628272835)
(num-test (log 500029/1234) 6.00440517125706)
(num-test (log 500029/1234000000) -7.81110538670721)
(num-test (log 500029/2) 12.42927419516245)
(num-test (log 500029/3) 12.02380908705428)
(num-test (log 500029/362880) 0.32059389564092)
(num-test (log 500029/500029) 0.0)
(num-test (log 54595/38975 21029/18267) 2.393514540234982342775959084446190967875E0)
(num-test (log 55510/63095 55510/63095) 1)
(num-test (log 60726/29873 34251/53142) -1.615057368690198504993598764304726754524E0)
(num-test (log 62092/33540 1958/6237) -5.315823311016084206705945306286559292707E-1)
(num-test (log 8 2) 3)
(num-test (log 8.0 -2.0) 0.13926097063622-0.63118087262379i)
(num-test (log 8.0 1.0+i) 0.97790391649038-2.2161063668189i)
(num-test (log 8.0 2) 3.0)
(num-test (log 8.3886080e+06+0.0e+00i) 1.5942385152878742117e1+0.0i)
(num-test (log 8.3886080e+06+1.0e+00i) 1.5942385152878749222e1+1.1920928955078068531e-7i)
(num-test (log 8.3886080e+06+1.0e+00i) 1.5942385152878749222e1+1.1920928955078068531e-7i)
(num-test (log 8.3886080e+06+1.19209289550781250e-07i) 1.5942385152878742117e1+1.4210854715202003717e-14i)
(num-test (log 8.3886080e+06+1.19209289550781250e-07i) 1.5942385152878742117e1+1.4210854715202003717e-14i)
(num-test (log 8.3886080e+06+2.0e+00i) 1.5942385152878770538e1+2.3841857910155798249e-7i)
(num-test (log 8.3886080e+06+2.0e+00i) 1.5942385152878770538e1+2.3841857910155798249e-7i)
(num-test (log 8.3886080e+06+5.0e-01i) 1.5942385152878743893e1+5.9604644775390554414e-8i)
(num-test (log 8.3886080e+06+5.0e-01i) 1.5942385152878743893e1+5.9604644775390554414e-8i)
(num-test (log 8.3886080e+06+8.3886080e+06i) 1.6288958743158714771e1+7.8539816339744830962e-1i)
(num-test (log 8.3886080e+06+8.3886080e+06i) 1.6288958743158714771e1+7.8539816339744830962e-1i)
(num-test (log 8.3886080e+06-1.0e+00i) 1.5942385152878749222e1-1.1920928955078068531e-7i)
(num-test (log 8.3886080e+06-1.0e+00i) 1.5942385152878749222e1-1.1920928955078068531e-7i)
(num-test (log 8.3886080e+06-1.19209289550781250e-07i) 1.5942385152878742117e1-1.4210854715202003717e-14i)
(num-test (log 8.3886080e+06-1.19209289550781250e-07i) 1.5942385152878742117e1-1.4210854715202003717e-14i)
(num-test (log 8.3886080e+06-2.0e+00i) 1.5942385152878770538e1-2.3841857910155798249e-7i)
(num-test (log 8.3886080e+06-2.0e+00i) 1.5942385152878770538e1-2.3841857910155798249e-7i)
(num-test (log 8.3886080e+06-5.0e-01i) 1.5942385152878743893e1-5.9604644775390554414e-8i)
(num-test (log 8.3886080e+06-5.0e-01i) 1.5942385152878743893e1-5.9604644775390554414e-8i)
(num-test (log 8.3886080e+06-8.3886080e+06i) 1.6288958743158714771e1-7.8539816339744830962e-1i)
(num-test (log 8.3886080e+06-8.3886080e+06i) 1.6288958743158714771e1-7.8539816339744830962e-1i)
(num-test (log 9.0 3.0) 2.0)
(num-test (log 9223372036854775807) 4.366827237527655449317720343461657334526E1)
(num-test (log pi) 1.14472988584940)
(num-test (log (/ 1+i)) (log (/ 1 1+i)))
(test (< (real-part (log 0.0)) (real-part (- (log 0.0)))) #t)

(test (infinite? (random (log 0.0))) #t)
(test (infinite? (random inf.0)) #t)
;(num-test (log 1 1) 'error) ; (expt 1 0) is 1 but so is (expt 1 1) -- an ambiguous case (returns NaN in gmp)
;(num-test (log 2 1) 'error) ; now returns infinity
;; this is actually inconsistent in one way:
;; (log 1/0 2) -> nannani, (log 1/0 1) -> inf.0

(num-test (log -1) (complex 0 pi))

(do ((i 0 (+ i 1))
     (n 1 (* n 2)))
    ((= i 60))
  (let ((x (log n 2)))
    (if (not (= (expt 2 i) n))
	(format *stderr* "(log ~D 2): ~A~%" n x))))

(for-each
 (lambda (num-and-val)
   (let ((num (car num-and-val)) (val (cadr num-and-val))) (num-test-1 'log num (log num) val)))
 (vector (list 1 0.0) (list 2 0.69314718055995) (list 3 1.0986122886681) (list -1 0+3.1415926535898i) 
	 (list -2 0.69314718055995+3.1415926535898i) (list -3 1.0986122886681+3.1415926535898i) 
	 (list 9223372036854775807 43.668272375277) (list -9223372036854775808 43.668272375277+3.1415926535898i) 
	 (list 1/2 -0.69314718055995) (list 1/3 -1.0986122886681) (list -1/2 -0.69314718055995+3.1415926535898i) 
	 (list -1/3 -1.0986122886681+3.1415926535898i) (list 1/9223372036854775807 -43.668272375277) 
	 (list 1.0 0.0) (list 2.0 0.69314718055995) (list -2.0 0.69314718055995+3.1415926535898i) 
	 (list 1.000000000000000000000000000000000000002E-309 -7.114987937351601163615593594974685401477E2) 
	 (list 1e+16 36.841361487905) (list 0+1i 0+1.5707963267949i) (list 0+2i 0.69314718055995+1.5707963267949i) 
	 (list 0-1i 0-1.5707963267949i) (list 1+1i 0.34657359027997+0.78539816339745i) (list 1-1i 0.34657359027997-0.78539816339745i) 
	 (list -1+1i 0.34657359027997+2.3561944901923i) (list -1-1i 0.34657359027997-2.3561944901923i) 
	 (list 0.1+0.1i -1.9560115027141+0.78539816339745i) (list 1e+16+1e+16i 37.187935078185+0.78539816339745i) 
	 (list 1e-16+1e-16i -36.494787897625+0.78539816339745i) ))
  
(let ((err 0.0)
      (mx 0.0))
  (do ((i 0 (+ i 1))
       (x -10.0 (+ x .1)))
      ((= i 200))
    (if (not (zero? x))
	(let ((y (magnitude (- x (exp (log x))))))
	  (if (> y err) (begin (set! mx x) (set! err y))))))
  (if (> err 1e-14)
      (format #t ";(exp (log ~A)) error: ~A~%" mx err)))

(let ((err 0.0)
      (mx 0.0))
  (do ((i 0 (+ i 1))
       (x -10.0+i (+ x 0.1-0.1i)))
      ((= i 200))
    (if (not (zero? x))
	(let ((y (magnitude (- x (exp (log x))))))
	  (if (> y err) (begin (set! err y) (set! mx x))))))
  (if (> err 1e-14)
      (format #t ";(exp (log ~A)) error: ~A~%" mx err)))

(do ((i 0 (+ i 1)))
    ((= i 100))
  (let ((val (+ .001 (random 100.0)))
	(base (+ 2 (random 20))))
    (num-test (log val base) (/ (log val) (log base)))))

(do ((i 0 (+ i 1)))
    ((= i 100))
  (let ((val (+ .001 (random 10000.0)))
	(base (+ 1.0 (random 20.0))))
    (num-test (log val base) (/ (log val) (log base)))))

(let ((val1 (catch #t (lambda () (log 0.0)) (lambda args 'error)))
      (val2 (catch #t (lambda () (log -0.0)) (lambda args 'error))))
  (test (equal? val1 val2) #t))

(do ((i 0 (+ i 1)))
    ((= i 100))
  (let ((val (+ .001 (random 100.0)))
	(base (+ 2 (random 20))))
    (if (> (random 1.0) 0.5) (set! val (- val)))
    (if (> (random 1.0) 0.5) (set! base (- base)))
    (num-test (log val base) (/ (log val) (log base)))))

(do ((i 0 (+ i 1)))
    ((= i 100))
  (let ((val (+ .001 (random 10000.0)))
	(base (+ 1.0 (random 20.0))))
    (if (> (random 1.0) 0.5) (set! val (- val)))
    (if (> (random 1.0) 0.5) (set! base (- base)))
    (num-test (log val base) (/ (log val) (log base)))))

(do ((i 0 (+ i 1)))
    ((= i 100))
  (let ((val1 (+ .001 (random 10000.0)))
	(val2 (+ .001 (random 10000.0)))
	(base1 (+ 1.0 (random 20.0)))
	(base2 (+ 1.0 (random 20.0))))
    (if (> (random 1.0) 0.5) (set! val1 (- val1)))
    (if (> (random 1.0) 0.5) (set! val2 (- val2)))
    (if (> (random 1.0) 0.5) (set! base1 (- base1)))
    (if (> (random 1.0) 0.5) (set! base2 (- base2)))
    (let ((val (complex val1 val2))
	  (base (complex base1 base2)))
      (num-test (log val base) (/ (log val) (log base))))))

(if (not with-bignums) 
    (num-test (log 1 0) 0)) ; since (expt 0 0) is 1

(when with-bignums
  (num-test (log (expt 2 16382)) 1.135513711193302405887309661372784853823E4)
  (num-test (log -1.797693134862315699999999999999999999998E308) 7.097827128933839967276924307167005609752E2+3.141592653589793238462643383279502884195E0i)
  (num-test (log -2.225073858507201399999999999999999999996E-308) -7.083964185322641062168115849912137186655E2+3.141592653589793238462643383279502884195E0i)
  (num-test (log 69720375229712477164533808935312303556800) 9.40453112293573922460049312446069272415E1)
  (num-test (log 100.0 (+ 1.0 (bignum "1e-16"))) 4.605170185988091598294419229104461919985E16)
  (num-test (expt (+ 1.0 (bignum "1e-16")) 4.605170185988091598294419229104461919985E16) 100.0)
  (num-test (log 100.0 (+ 1.0 (bignum "1e-34"))) 4.60520221864866031976806443342804401709E34)
  (num-test (expt (+ 1.0 (bignum "1e-34")) 4.60520221864866031976806443342804401709E34) 100.0)
  (num-test (expt (+ 1 1e-16) (log 100.0 (+ 1 1e-16))) 100.0)
  (num-test (+ 100 (expt 10.0 35) (- (expt 10.0 35))) 100.0)
  (num-test (log 1/9223372036854775808 2) -63) 
  (num-test (log 9223372036854775808 2) 63)
  (num-test (log 9223372036854775807/9223372036854775806 9223372036854775806/9223372036854775807) -9.999999999999999999999999999999999999647E-1))

(let ((logs-1 (list
	       -4.60517018598809136803598290936872841520220297725754595206665580193514
	       -3.91202300542814605861875078791055184712670284289729069794597579244175
	       -3.50655789731998167664073767244620271055471241943479650033196146829765
	       -3.21887582486820074920151866645237527905120270853703544382529578294835
	       -2.99573227355399099343522357614254077567660162298902823015400791046096
	       -2.81341071676003636722350555098802614247921228507454124621128145880425
	       -2.65926003693277806293063016592554868556511824767568476360726565199756
	       -2.52572864430825543978428654499419871097570257417678018970461577345496
	       -2.40794560865187198524549243552367700590722186161204704859726713466015
	       -2.30258509299404568401799145468436420760110148862877297603332790096757
	       -2.20727491318972082397403933140359911538049612332012877684808809280457
	       -2.12026353620009105780627342952984957440371215071428599209060144931086
	       -2.04022082852655463198249546780340981039693503249733883564761029127168
	       -1.96611285637283275351339804446737211748961811331542950948658564250417
	       -1.89711998488588130203997833922001507102911106516627877841931357682347
	       -1.83258146374831013036705442353602214290020243981652493558393576396157
	       -1.77195684193187528778644829149560187961399996467180116476941806405285
	       -1.71479842809192667582826031406550043783172172725179179447658712516676
	       -1.66073120682165090802695547748087487796482371595841713352869556552585
	       -1.60943791243410037460075933322618763952560135426851772191264789147417))
      (logs-2 (list
	       2.30258509299404568401799145468436420760110148862877297603332790096757
	       2.99573227355399099343522357614254077567660162298902823015400791046096
	       3.40119738166215537541323669160688991224859204645152242776802223460506
	       3.68887945411393630285245569760071734375210175734928348427468791995435
	       3.91202300542814605861875078791055184712670284289729069794597579244175
	       4.09434456222210068483046881306506648032409218081177768188870224409846
	       4.24849524204935898912334419812754393723818621821063416449271805090515
	       4.38202663467388161226968781905889391182760189170953873839536792944775
	       4.49980967033026506680848192852941561689608260427427187950271656824256
	       4.60517018598809136803598290936872841520220297725754595206665580193514
	       4.70048036579241622807993503264949350742280834256619015125189561009814
	       4.78749174278204599424770093452324304839959231517203293600938225359185
	       4.86753445045558242007147889624968281240636943338898009245237341163103
	       4.94164242260930429854057631958572050531368635257088941861339806039854
	       5.01063529409625575001399602483307755177419340072004014968067012607924
	       5.07517381523382692168691994051707047990310202606979399251604793894114
	       5.13579843705026176426752607255749074318930450121451776333056563884986
	       5.19295685089021037622571404998759218497158273863452713362339657773595
	       5.24702407216048614402701888657221774483848074992790179457128813737686
	       5.29831736654803667745321503082690498327770311161780120618733581142853)))
  (let ((mxerr 0.0))
    (do ((i 0 (+ i 1))
	 (x 0.01 (+ x 0.01))
	 (y 10.0 (+ y 10.0)))
	((= i 20))
      (let ((err (max (abs (- (log x) (list-ref logs-1 i)))
		      (abs (- (log y) (list-ref logs-2 i))))))
	(if (> err mxerr)
	    (set! mxerr err))))
    (if (> mxerr 1e-12) (format #t "log err: ~A~%" mxerr))))

(when with-bignums
  (let-temporarily (((*s7* 'bignum-precision) 500))
    (let ((logs (list ; table[Log[k/10 + 1.0], {k, 0, 30}]
		 0.00000000000000000000000000000000000000000000000000000000000000000000e0
		 0.09531017980432486004395212328076509222060536530864419918523980816300
		 0.18232155679395462621171802515451463319738933791448698394272645165670
		 0.26236426446749105203549598688095439720416645613143414038571760969589
		 0.33647223662121293050459341021699209011148337531334346654674225846340
		 0.40546510810816438197801311546434913657199042346249419761401432414410
		 0.47000362924573555365093703114834206470089904881224804044939213700600
		 0.53062825106217039623154316318876232798710152395697181126390983691471
		 0.58778666490211900818973114061886376976937976137698118155674077580080
		 0.64185388617239477599103597720348932963627777267035584250463233544172
		 0.69314718055994530941723212145817656807550013436025525412068000949339
		 0.74193734472937731248260652568134122668347379877583766416075658260750
		 0.78845736036427016946118424473894166029610549966889945330591981765639
		 0.83290912293510400678876137712583191084127882621166276596530747651542
		 0.87546873735389993562895014661269120127288947227474223806340646115010
		 0.91629073187415506518352721176801107145010121990826246779196788198078
		 0.95551144502743636145272810833913096527966659049168939450639761918928
		 0.99325177301028339016774425608321290634137018483947537917075509994491
		 1.02961941718115823992182553167516865818698350967359872066742226795679
		 1.06471073699242834316528057767754739789341142529397110288834245067520
		 1.09861228866810969139524523692252570464749055782274945173469433363749
		 1.13140211149110056191117286985799300284883744185181899572339017150740
		 1.16315080980568086306816915260651863277639918317250329457007214649939
		 1.19392246847243455143919736020329079686809592313139365091993414180049
		 1.22377543162211570564877528464693889606260165831722706538458984640811
		 1.25276296849536799568812062198500316156158459522160593433871014044418
		 1.28093384546206431760696326207704033784487989573723643567742078529420
		 1.30833281965017876035010421634708295629897609853886318761158478022541
		 1.33500106673234008540826809866166589771177790703061109662531234493511
		 1.36097655313560074343074122380348010185165701395418359212041194333338
		 1.38629436111989061883446424291635313615100026872051050824136001898678)))
      
      (do ((i 0 (+ i 1)))
	  ((= i 30))
	(let ((val (log (+ (/ i (bignum "10")) (bignum "1.0")))))
	  (if (> (magnitude (- val (list-ref logs i))) 1e-36)
	      (format #t ";(log ~A) -> ~A ~A~%[~A]~%" (+ 1.0 (/ i 10)) val (list-ref logs i) (magnitude (- val (list-ref logs i))))))))))
	
(test (log) 'error)
(test (log "hi") 'error)
(test (log 1.0+23.0i 1.0+23.0i 1.0+23.0i) 'error)
(test (log "hi" (expt 2 30)) 'error)
(test (log (expt 2 30) #t) 'error)
(test (log 0 0) 'error)
(test (log 3 0) 'error)

(for-each
 (lambda (arg)
   (test (log arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))

(for-each
 (lambda (arg)
   (test (log arg nan.0) 'error)
   (test (log nan.0 arg) 'error)
   (test (log arg inf.0) 'error)
   (test (log inf.0 arg) 'error)
   (test (log 10 arg) 'error)
   (test (log arg 10) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))


;;; do these make sense?
;;;   (log -nan.0 1) -> inf.0
;;;   (log 1+infi 1) -> inf.0





;;; --------------------------------------------------------------------------------
;;; expt
;;; --------------------------------------------------------------------------------

(num-test (* (/ (expt 2 11) (+ (expt 2 10) 1)) (/ (+ (expt 2 11) 1) (expt 2 10))) 4098/1025)
(num-test (* (/ (expt 2 21) (+ (expt 2 20) 1)) (/ (+ (expt 2 21) 1) (expt 2 20))) 4194306/1048577)
(num-test (* (sqrt 2) (sqrt (- 31 (* 4 (sqrt (sqrt 3)) (sqrt (sqrt 5)))))) (+ (* (expt 3 1/4) (expt 5 3/4)) (- (* 2 (sqrt 5))) (* (expt 3 3/4) (expt 5 1/4)) (* 2 (sqrt 3))))
(num-test (* 1/18014398509481984 1/2) (expt 2 -55))
(num-test (+ (/ (expt 2 11) (+ (expt 2 10) 1)) (/ (+ (expt 2 11) 1) (expt 2 10))) 4197377/1049600)
(num-test (+ (/ (expt 2 21) (+ (expt 2 20) 1)) (/ (+ (expt 2 21) 1) (expt 2 20))) 4398049656833/1099512676352)
(num-test (+ (/ (expt 2 28)) (/ (expt 3 17)) 1/7 1/29) 1247968828249346465/7037157104192323584)
(num-test (+ (/ (expt 2 28)) (/ (expt 3 17)) 1/7 1/31) 1317300430901043787/7522478283791794176)
(num-test (+ (/ (expt 2 29)) (/ (expt 3 18)) 1/31) 207994819909949399/6447838528964395008)
(num-test (+ (/ (expt 2 30)) (/ (expt 3 18)) 1/13) 415989601508942005/5407864572679815168)
(num-test (+ (/ (expt 2 30)) (/ (expt 3 18)) 1/5) 415989589819643501/2079947912569159680)
(num-test (+ (/ (expt 2 30)) (/ (expt 3 20))) 4560526225/3743906242624487424)
(num-test (+ (/ (expt 2 31) (+ (expt 2 20) 1)) (/ (+ (expt 2 31) 1) (expt 2 20))) 4503601775902721/1099512676352)
(num-test (+ (expt (+ 1/2 (/ (sqrt 69) 18)) 1/3) (/ (expt (+ 1/2 (/ (sqrt 69) 18)) -1/3) 3)) (* (/ (* 2 (sqrt 3)) 3) (cos (/ (acos (/ (* 3 (sqrt 3)) 2)) 3))))
(num-test (+ (expt 2 5) (expt 298 5) (expt 351 5) (expt 474 5) (expt 500 5)) (expt 575 5))
(num-test (+ (expt 2230 4) (expt 3196 4) (expt 5620 4) (expt 6995 4)) (expt 7703 4))
(num-test (+ (expt 415280564497/348671682660 3) (expt 676702467503/348671682660 3)) 9)
(num-test (+ (expt 510 3) (expt 580 3)) (+ (expt 300 3) (expt 670 3)))
(num-test (+ 1 (expt 2 54)) 18014398509481985)
(num-test (+ 10000000000000000 1) 10000000000000001)
(num-test (+ 2 (expt 276694819753963/226588 1/158)) pi) ; 23 digits
(num-test (- (/ (expt 2 11) (+ (expt 2 10) 1)) (/ (+ (expt 2 11) 1) (expt 2 10))) -3073/1049600)
(num-test (- (/ (expt 2 21) (+ (expt 2 20) 1)) (/ (+ (expt 2 21) 1) (expt 2 20))) -3145729/1099512676352)
(num-test (- (/ (expt 2 31) (+ (expt 2 20) 1)) (/ (+ (expt 2 31) 1) (expt 2 20))) -2148532225/1099512676352)
(num-test (- (expt 2 54) 18014398509481983) 1)
(num-test (- (expt 2 54) 18014398509481984) 0)
(num-test (- 10000000000000000 9999999999999999) 1)
(num-test (/ (/ (expt 2 11) (+ (expt 2 10) 1)) (/ (+ (expt 2 11) 1) (expt 2 10))) 2097152/2100225)
(num-test (/ (/ (expt 2 21) (+ (expt 2 20) 1)) (/ (+ (expt 2 21) 1) (expt 2 20))) 2199023255552/2199026401281)
(num-test (/ (/ (expt 2 31) (+ (expt 2 20) 1)) (/ (+ (expt 2 31) 1) (expt 2 20))) 2251799813685248/2251801962217473)
(num-test (/ (expt 10 -20) (expt 10 -20)) 1)
(num-test (/ (expt 10 -200) (expt 10 -200)) 1)
(num-test (/ (expt 2 -53) 2) (expt 2 -54))
(num-test (/ (expt 2.3 50) (expt 2.3 49)) 2.3)
(num-test (/ (sqrt (* 7 (- 2 (expt 2 1/7)))) (expt 2 1/14)) (+ -1 (* 2 (expt 2 1/7)) (expt 2 3/7) (expt 2 5/7) (- (expt 2 6/7))))
(num-test (do ((i 1 (+ i 1)) (sum 0.0 (+ sum (expt (sin (/ (* pi i) (* 2 10))) 4)))) ((= i 11) sum)) 4.25)
(num-test (expt (+ (cos (/ (* 2 pi) 20)) (* 0+i (sin (/ (* 2 pi) 20)))) 20) 1.0)
(num-test (expt (+ pi 20) 0+i) -0.99999999924368-3.8892669402222e-05i)
(num-test (expt (- (expt 2 1/3) 1) 1/3) (+ (expt 1/9 1/3) (- (expt 2/9 1/3)) (expt 4/9 1/3)))
(num-test (expt (- (expt 2 1/3) 1) 1/3) (+ (expt 1/9 1/3) (- (expt 2/9 1/3)) (expt 4/9 1/3)))
(num-test (expt (- (expt 3 3/5) (expt 2 1/5)) 1/3) (/ (+ (- (* (expt 2 1/5) (expt 3 3/5))) (* (expt 2 3/5) (expt 3 2/5)) (expt 3 1/5) (expt 2 2/5)) (expt 5 2/3)))
(num-test (expt (/ (+ 1 (sqrt 5)) 2) 5) (/ (+ 11 (* 5 (sqrt 5))) 2))
(num-test (expt (/ (log (+ (expt 640320 3) 744)) pi) 2) 163.0) ; rest is 2.32167e-29
(num-test (expt (expt -1 -1/2) -2) -1)
(num-test (expt (expt -1 1/123) 123) -1)
(num-test (expt (expt -1/2 -1/2) -2) -1/2)
(num-test (expt (expt -1/2 1/2) 2) -1/2)
(num-test (expt (expt -1/3 -1/2) -2) -1/3)
(num-test (expt (expt -1/3 1/2) 2) -1/3)
(num-test (expt (expt -1/3 1/3) 3) -1/3)
(num-test (expt (expt -2 -1/2) -2) -2)
(num-test (expt (expt -2 1/2) 2) -2)
(num-test (expt (expt 0+i -1/2) -2) 0+i)
(num-test (expt (expt 0+i -1/3) -3) 0+i)
(num-test (expt (expt 0+i -1/4) -4) 0+i)
(num-test (expt (expt 0+i 0.5) 2) 0+i)
(num-test (expt (expt 0+i 1/10) 10) 0+i)
(num-test (expt (expt 0+i 1/3) 3) 0+i)
(num-test (expt (expt 0+i 1/4) 4) 0+i)
(num-test (expt (expt 1 -1/2) -2) 1)
(num-test (expt (expt 1 1/123) 123) 1)
(num-test (expt (expt 1+i 1/2) 2) 1+i)
(num-test (expt (expt 1+i 1/3) 3) 1+i)
(num-test (expt (expt 1+i 1/4) 4) 1+i)
(num-test (expt (expt 1-i 1/2) 2) 1-i)
(num-test (expt (expt 1-i 1/3) 3) 1-i)
(num-test (expt (expt 1-i 1/4) 4) 1-i)
(num-test (expt (expt 1/2 -1/2) -2) 1/2)
(num-test (expt (expt 2 0+i) (/ 0+i)) 2)
(num-test (expt (expt 2 1/10) 10) 2)
(num-test (expt (expt 2 1/30) 30) 2)
(num-test (expt (expt 2 30) 1/30) 2)
(num-test (expt (expt 2 50) 1/50) 2)
(num-test (expt (expt 20 10) 1/10) 20)
(num-test (expt (expt 40 10) 1/10) 40)
(num-test (expt -0 -0) 1)
(num-test (expt -0.0 -0.0) 0.0)
(num-test (expt -0.0 0) 0.0)
(num-test (expt -0.0 0-i) 0.0)
(num-test (expt -0.0 0.00000001) 0.0)
(num-test (expt -0.0 1.0) 0.0)
(num-test (expt -0.0 1234.0) 0.0)
(num-test (expt -0.0 1234000000.0) 0.0)
(num-test (expt -0.0 2.71828182845905) 0.0)
(num-test (expt -0.0 pi) 0.0)
(num-test (expt -0.0-1234000000.0i -1234000000.0-0.00000001i) 0.0)
(num-test (expt -0.00000001 -0.0) 1.0)
(num-test (expt -0.00000001 -0.00000001) 1.00000018420682-0.00000003141593i)
(num-test (expt -0.00000001 -1) -100000000.00000017881393-0.00000001224606i)
(num-test (expt -0.00000001 -1.0) -100000000.00000017881393-0.00000001224606i)
(num-test (expt -0.00000001 0) 1.0)
(num-test (expt -0.00000001 0.0) 1.0)
(num-test (expt -0.00000001 0.00000001) 0.99999981579321+0.00000003141592i)
(num-test (expt -0.00000001 1) -0.00000001+0.0i)
(num-test (expt -0.00000001 1.0) -0.00000001+0.0i)
(num-test (expt -0.00000001 10) 1e-80)
(num-test (expt -0.00000001 1234) 0.0)
(num-test (expt -0.00000001 1234.0) 0.0)
(num-test (expt -0.00000001 1234000000) 0.0)
(num-test (expt -0.00000001 1234000000.0) 0.0)
(num-test (expt -0.00000001 2) 1e-16)
(num-test (expt -0.00000001 2.71828182845905) -1.135859060227e-22+1.388206815575e-22i)
(num-test (expt -0.00000001 3) -1e-24)
(num-test (expt -0.00000001 362880) 0.0)
(num-test (expt -0.00000001 500029) 0.0)
(num-test (expt -0.00000001 pi) -6.6495946361558e-26-3.1697962381573e-26i)
(num-test (expt -0.00000001+0.00000001i 1.0-0.0i) -0.00000001+0.00000001i)
(num-test (expt -0.00000001+0.0i 0.00000001-0.00000001i) 0.99999984720911+0.00000021562270i)
(num-test (expt -0.00000001-0.00000001i -1.0-0.0i) -50000000.00000003725290+50000000.00000004470348i)
(num-test (expt -0.00000001-0.0i -0.00000001-0.00000001i) 1.00000021562275+0.00000015279091i)
(num-test (expt -1 (+ 1 (expt 2 32))) -1)
(num-test (expt -1 (- (expt 2 32))) 1)
(num-test (expt -1 (expt 2 32)) 1)
(num-test (expt -1 -0.0) 1.0)
(num-test (expt -1 -100) 1)
(num-test (expt -1 -1000) 1)
(num-test (expt -1 -1001) -1)
(num-test (expt -1 -101) -1)
(num-test (expt -1 -255) -1)
(num-test (expt -1 -256) 1)
(num-test (expt -1 0) 1)
(num-test (expt -1 0+i) 4.321391826377224977441773717172801127572810981063308298071968740105076575701806E-2)
(num-test (expt -1 0-i) 2.314069263277926900572908636794854738026610624260021199344504640952434235069032E1)
(num-test (expt -1 0.0) 1.0)
(num-test (expt -1 0.00000001) 1.0+0.00000003141593i)
(num-test (expt -1 1) -1)
(num-test (expt -1 1.0) -1.0+0.0i)
(num-test (expt -1 1/2) 0+i)
(num-test (expt -1 10) 1)
(num-test (expt -1 100) 1)
(num-test (expt -1 1000) 1)
(num-test (expt -1 1001) -1)
(num-test (expt -1 101) -1)
(num-test (expt -1 1234) 1)
(num-test (expt -1 1234.0) 1.0)
(num-test (expt -1 1234000000) 1)
(num-test (expt -1 1234000000.0) 1.0)
(num-test (expt -1 2) 1)
(num-test (expt -1 2.71828182845905) -0.63325565131482+0.77394268526671i)
(num-test (expt -1 255) -1)
(num-test (expt -1 256) 1)
(num-test (expt -1 3) -1)
(num-test (expt -1 362880) 1)
(num-test (expt -1 500029) -1)
(num-test (expt -1 pi) -0.90268536193307-0.43030121700009i)
(num-test (expt -1.0 -0.0) 1.0)
(num-test (expt -1.0 -0.00000001) 1.0-0.00000003141593i)
(num-test (expt -1.0 -1) -1.0-0.0i)
(num-test (expt -1.0 -1.0) -1.0-0.0i)
(num-test (expt -1.0 -10) 1.0+0.0i)
(num-test (expt -1.0 -1234) 1.0)
(num-test (expt -1.0 -1234.0) 1.0)
(num-test (expt -1.0 -1234000000) 1.0)
(num-test (expt -1.0 -1234000000.0) 1.0)
(num-test (expt -1.0 -2) 1.0+0.0i)
(num-test (expt -1.0 -2.71828182845905) -0.63325565131482-0.77394268526671i)
(num-test (expt -1.0 -3) -1.0-0.0i)
(num-test (expt -1.0 -3.14159265358979) -0.90268536193307+0.43030121700009i)
(num-test (expt -1.0 -362880) 1.0)
(num-test (expt -1.0 -500029) -1.0)
(num-test (expt -1.0 0) 1.0)
(num-test (expt -1.0 0.0) 1.0)
(num-test (expt -1.0 0.00000001) 1.0+0.00000003141593i)
(num-test (expt -1.0 1) -1.0+0.0i)
(num-test (expt -1.0 1.0) -1.0+0.0i)
(num-test (expt -1.0 1/2) 0+i)
(num-test (expt -1.0 10) 1.0-0.0i)
(num-test (expt -1.0 1234) 1.0)
(num-test (expt -1.0 1234.0) 1.0)
(num-test (expt -1.0 1234000000) 1.0)
(num-test (expt -1.0 1234000000.0) 1.0)
(num-test (expt -1.0 2) 1.0-0.0i)
(num-test (expt -1.0 2.71828182845905) -0.63325565131482+0.77394268526671i)
(num-test (expt -1.0 3) -1.0+0.0i)
(num-test (expt -1.0 362880) 1.0)
(num-test (expt -1.0 500029) -1.0)
(num-test (expt -1.0 pi) -0.90268536193307-0.43030121700009i)
(num-test (expt -1.0+0.00000001i 3.14159265358979-0.00000001i) -0.90268540381008-0.43030120215971i)
(num-test (expt -1.0+1.0i 2.71828182845905-0.0i) 2.54637618158683+0.31121428769451i)
(num-test (expt -1.0-0.00000001i -3.14159265358979-0.00000001i) -0.90268534709269-0.43030117512308i)
(num-test (expt -1.0-1.0i -2.71828182845905-0.0i) 0.38693516117166+0.04729063656767i)
(num-test (expt -1.0e+00+0.0e+00i -1.0e+00+0.0e+00i) -1e0+0.0i)
(num-test (expt -1.0e+00+0.0e+00i 0.0e+00+0.0e+00i) 1e0+0.0i)
(num-test (expt -1.0e+00+0.0e+00i 0.0e+00+1.0e+00i) 4.3213918263772249774e-2+0.0i)
(num-test (expt -1.0e+00+0.0e+00i 0.0e+00-1.0e+00i) 2.3140692632779269006e1+0.0i)
(num-test (expt -1.0e+00+0.0e+00i 1.0e+00+0.0e+00i) -1e0+0.0i)
(num-test (expt -1.0e+00+0.0e+00i 5.0e-01+1.00000000000000005551e-01i) 0+7.3040269104864559813e-1i)
(num-test (expt -1.0e+00+0.0e+00i 5.0e-01-1.00000000000000005551e-01i) 0+1.3691077706248469087e0i)
(num-test (expt -1/10 1234/1234000000) 0.99999769741262+0.00000314158542i)
(if (not (provided? 'freebsd)) (num-test (expt -1/2 (- (real-part (log 0)))) (expt -0.5 (- (real-part (log 0))))))
(num-test (expt -1/2 3/362880) 0.99999426929571+0.00002597201266i)
(num-test (expt -1/3 10/500029) 0.99997802729625+0.00006282682861i)
(num-test (expt -1/362880 0/2) 1)
(num-test (expt -1/500029 362880/3) 0.0)
(num-test (expt -1/8 -3) -512)
(num-test (expt -10 0) 1)
(num-test (expt -10 0.0) 1.0)
(num-test (expt -10 0.00000001) 1.00000002302585+0.00000003141593i)
(num-test (expt -10 1) -10)
(num-test (expt -10 1.0) -10.0+0.0i)
(num-test (expt -10 2) 100)
(num-test (expt -10 2.71828182845905) -331.02508265804954+404.56716151063557i)
(num-test (expt -10 3) -1000)
(num-test (expt -10 pi) -1250.63060831127905-596.16328730697728i)
(num-test (expt -10/1234 0/362880) 1)
(num-test (expt -10/1234000000 1/500029) 0.99996274095212+0.00000628258681i)
(num-test (expt -10/362880 3/1234) 0.97476967459219+0.00744502948457i)
(num-test (expt -10/500029 2/1234000000) 0.99999998246380+0.00000000509172i)
(num-test (expt -1234 0) 1)
(num-test (expt -1234 0.0) 1.0)
(num-test (expt -1234 0.00000001) 1.00000007118016+0.00000003141593i)
(num-test (expt -1234 1) -1234)
(num-test (expt -1234 1.0) -1234.00000000000045+0.00000000000015i)
(num-test (expt -1234 2) 1522756)
(num-test (expt -1234 2.71828182845905) -160193503.19500353932381+195782840.25985893607140i)
(num-test (expt -1234.0 -0.0) 1.0)
(num-test (expt -1234.0 -0.00000001) 0.99999992881984-0.00000003141592i)
(num-test (expt -1234.0 -1) -0.00081037277147-0.0i)
(num-test (expt -1234.0 -1.0) -0.00081037277147-0.0i)
(num-test (expt -1234.0 -2) 0.00000065670403+0.0i)
(num-test (expt -1234.0 -2.71828182845905) -0.00000000250330-0.00000000305945i)
(num-test (expt -1234.0 -3) -0.00000000053218-0.0i)
(num-test (expt -1234.0 -3.14159265358979) -0.00000000017534+0.00000000008358i)
(num-test (expt -1234.0 0) 1.0)
(num-test (expt -1234.0 0.0) 1.0)
(num-test (expt -1234.0 0.00000001) 1.00000007118016+0.00000003141593i)
(num-test (expt -1234.0 1) -1234.00000000000045+0.00000000000015i)
(num-test (expt -1234.0 1.0) -1234.00000000000045+0.00000000000015i)
(num-test (expt -1234.0 2) 1522756.00000000093132-0.00000000037296i)
(num-test (expt -1234.0 2.71828182845905) -160193503.19500353932381+195782840.25985893607140i)
(num-test (expt -1234.0+1234.0i 3.14159265358979-0.0i) 6676669154.05054950714111+13759228759.84499740600586i)
(num-test (expt -1234.0+2.71828182845905i 1.0-0.00000001i) -1234.00003854658053+2.71836975014915i)
(num-test (expt -1234.0-1234.0i -3.14159265358979-0.0i) 2.854567008891443E-11+5.882669873167984E-11i)
(num-test (expt -1234.0-2.71828182845905i -1.0-0.00000001i) -0.00081036881365+0.00000178515559i)
(num-test (expt -1234/10 0/1) 1)
(num-test (expt -1234/1234000000 2/362880) 0.99992385906203+0.00001731345596i)
(num-test (expt -1234/362880 10/1234000000) 0.99999995393994+0.00000002545861i)
(num-test (expt -1234/500029 3/500029) 0.99996397612963+0.00001884778372i)
(num-test (expt -1234000000 0) 1)
(num-test (expt -1234000000 0.0) 1.0)
(num-test (expt -1234000000 0.00000001) 1.00000020933529+0.00000003141593i)
(num-test (expt -1234000000.0 -0.0) 1.0)
(num-test (expt -1234000000.0 -0.00000001) 0.99999979066475-0.00000003141592i)
(num-test (expt -1234000000.0 -1) -0.00000000081037-0.0i)
(num-test (expt -1234000000.0 -1.0) -0.00000000081037-0.0i)
(num-test (expt -1234000000.0 0) 1.0)
(num-test (expt -1234000000.0 0.0) 1.0)
(num-test (expt -1234000000.0 0.00000001) 1.00000020933529+0.00000003141593i)
(num-test (expt -1234000000.0-1234.0i -2.71828182845905-0.00000001i) -1.2269326149532e-25+1.4995226540245e-25i) 
(num-test (expt -1234000000/10 1/2) 0.00000000000068+11108.55526159905094i)
(num-test (expt -1234000000/3 0/3) 1)
(num-test (expt -1234000000/362880 1234/500029) 1.02023991975054+0.00791007960266i)
(num-test (expt -1234000000/500029 10/362880) 1.00021527254493+0.00008659250882i)
(num-test (expt -2 0) 1)
(num-test (expt -2 0.0) 1.0)
(num-test (expt -2 0.00000001) 1.00000000693147+0.00000003141593i)
(num-test (expt -2 1) -2)
(num-test (expt -2 1.0) -2.0+0.0i)
(num-test (expt -2 10) 1024)
(num-test (expt -2 2) 4)
(num-test (expt -2 2.71828182845905) -4.16738324447062+5.09322857532248i)
(num-test (expt -2 3) -8)
(num-test (expt -2 pi) -7.96617830388569-3.79739869898975i)
(num-test (expt -2.71828182845905 -0.0) 1.0)
(num-test (expt -2.71828182845905 -0.00000001) 0.99999999000000-0.00000003141593i)
(num-test (expt -2.71828182845905 -1) -0.36787944117144-0.0i)
(num-test (expt -2.71828182845905 -1.0) -0.36787944117144-0.0i)
(num-test (expt -2.71828182845905 -10) 0.00004539992976+0.0i)
(num-test (expt -2.71828182845905 -2) 0.13533528323661+0.0i)
(num-test (expt -2.71828182845905 -2.71828182845905) -0.04178729661821-0.05107095765760i)
(num-test (expt -2.71828182845905 -3) -0.04978706836786-0.0i)
(num-test (expt -2.71828182845905 -3.14159265358979) -0.03900857144848+0.01859500162024i)
(num-test (expt -2.71828182845905 0) 1.0)
(num-test (expt -2.71828182845905 0.0) 1.0)
(num-test (expt -2.71828182845905 0.00000001) 1.00000001+0.00000003141593i)
(num-test (expt -2.71828182845905 1) -2.71828182845905+0.0i)
(num-test (expt -2.71828182845905 1.0) -2.71828182845905+0.0i)
(num-test (expt -2.71828182845905 10) 22026.46579480671789-0.00000000002697i)
(num-test (expt -2.71828182845905 2) 7.38905609893065-0.0i)
(num-test (expt -2.71828182845905 2.71828182845905) -9.59652220592352+11.72853041240636i)
(num-test (expt -2.71828182845905 3) -20.08553692318767+0.00000000000001i)
(num-test (expt -2.71828182845905 pi) -20.88876450460231-9.95746820210997i)
(num-test (expt -2.71828182845905+2.71828182845905i 0.00000001-0.0i) 1.00000001346574+0.00000002356195i)
(num-test (expt -2.71828182845905+3.14159265358979i 0.0-0.00000001i) 1.00000002284081-0.00000001424157i)
(num-test (expt -2.71828182845905-2.71828182845905i -0.00000001-0.0i) 0.99999998653426+0.00000002356194i)
(num-test (expt -2.71828182845905-3.14159265358979i -0.0-0.00000001i) 0.99999997715919-0.00000001424157i)
(num-test (expt -2/1 3/1) -8)
(num-test (expt -2/1234 500029/1234000000) 0.99739915734849+0.00126969420446i)
(num-test (expt -2/3 1234/362880) 0.99856514997103+0.01066829281071i)
(num-test (expt -2/500029 0/10) 1)
(num-test (expt -256 0) 1)
(num-test (expt -256 1) -256)
(num-test (expt -2742638075.5 1/2) (sqrt -2742638075.5))
(num-test (expt -2742638075.5 2) (* -2742638075.5 -2742638075.5)) ; from bug-guile
(num-test (expt -3 0) 1)
(num-test (expt -3 0.0) 1.0)
(num-test (expt -3 0.00000001) 1.00000001098612+0.00000003141593i)
(num-test (expt -3 1) -3)
(num-test (expt -3 1.0) -3.0+0.0i)
(num-test (expt -3 10) 59049)
(num-test (expt -3 2) 9)
(num-test (expt -3 2.71828182845905) -12.54668835889338+15.33411926056231i)
(num-test (expt -3 3) -27)
(num-test (expt -3 pi) -28.47456044077623-13.57354237468751i)
(num-test (expt -3.14159265358979 -0.0) 1.0)
(num-test (expt -3.14159265358979 -0.00000001) 0.99999998855270-0.00000003141593i)
(num-test (expt -3.14159265358979 -1) -0.31830988618379-0.0i)
(num-test (expt -3.14159265358979 -1.0) -0.31830988618379-0.0i)
(num-test (expt -3.14159265358979 -10) 0.00001067827923+0.0i)
(num-test (expt -3.14159265358979 -2) 0.10132118364234+0.0i)
(num-test (expt -3.14159265358979 -2.71828182845905) -0.02819587712308-0.03446000491078i)
(num-test (expt -3.14159265358979 -3) -0.03225153443320-0.0i)
(num-test (expt -3.14159265358979 -3.14159265358979) -0.02475677172327+0.01180130912803i)
(num-test (expt -3.14159265358979 0) 1.0)
(num-test (expt -3.14159265358979 0.0) 1.0)
(num-test (expt -3.14159265358979 0.00000001) 1.00000001144730+0.00000003141593i)
(num-test (expt -3.14159265358979 1) -3.14159265358979+0.0i)
(num-test (expt -3.14159265358979 1.0) -3.14159265358979+0.0i)
(num-test (expt -3.14159265358979 10) 93648.04747608296748)
(num-test (expt -3.14159265358979 2) 9.86960440108936-0.0i)
(num-test (expt -3.14159265358979 2.71828182845905) -14.22238854892297+17.38210083337688i)
(num-test (expt -3.14159265358979 3) -31.00627668029983)
(num-test (expt -3.14159265358979 pi) -32.91385774189388-15.68971165343314i)
(num-test (expt -3.14159265358979-3.14159265358979i -1234000000.0-0.0i) 0.0)
(num-test (expt -3/1 10/2) -243)
(num-test (expt -3/10 500029/362880) -0.07120470796705-0.17650615015342i)
(num-test (expt -3/1234 362880/500029) -0.00825127977478+0.00961700186370i)
(num-test (expt -3/1234000000 0/1234000000) 1)
(num-test (expt -3/362880 2/10) 0.07788060004397+0.05658356803852i)
(num-test (expt -3/500029 1/1234) 0.99030033992383+0.00252117260474i)
(num-test (expt -362880 0) 1)
(num-test (expt -362880 0.0) 1.0)
(num-test (expt -362880 0.00000001) 1.00000012801828+0.00000003141593i)
(num-test (expt -362880 1) -362880)
(num-test (expt -362880 1.0) -362879.99999999982538+0.00000000004444i)
(num-test (expt -362880/1 0/500029) 1)
(num-test (expt -362880/10 3/10) 13.71347740072436+18.87498236114703i)
(num-test (expt -362880/1234 10/3) -84553109.08903615176678-146450280.88012450933456i)
(num-test (expt -362880/1234000000 1234/2) 0.0)
(num-test (expt -362880/2 1/1234000000) 1.00000000981254+0.00000000254586i)
(num-test (expt -362880/3 2/1234) 1.01913575690562+0.00518920109559i)
(num-test (expt -500029 0) 1)
(num-test (expt -500029 0.0) 1.0)
(num-test (expt -500029 0.00000001) 1.00000013122422+0.00000003141593i)
(num-test (expt -500029 1) -500029)
(num-test (expt -500029 1.0) -500029.00000000040745+0.00000000006123i)
(num-test (expt -500029/1 362880/1234000000) 1.00386591183654+0.00092741384842i)
(num-test (expt -500029/10 2/3) -678.63064326537926+1175.42275370878747i)
(num-test (expt -500029/1234 3/2) -0.00000000000150-8156.80442672750178i)
(num-test (expt -500029/1234000000 10/1) 0.0)
(num-test (expt -500029/2 0/1234) 1)
(num-test (expt -500029/3 1/10) 3.16514579334680+1.02841820970710i)
(num-test (expt .1 -1) 10.0)
(num-test (expt .1 -2) 100.0)
(num-test (expt 0 (expt 2 31)) 0)
(num-test (expt 0 (expt 2 32)) 0)
(num-test (expt 0 (expt 2 33)) 0)
(num-test (expt 0 (expt 2 63)) 0)
(num-test (expt 0 (expt 2 64)) 0)
(num-test (expt 0 (expt 2 65)) 0)
(num-test (expt 0 -0.0) 0.0)
(num-test (expt 0 -0/4) 1)
(num-test (expt 0 0) 1)
(num-test (expt 0 -0) 1)
(num-test (expt 0 0.0) 0.0)
(num-test (expt 0 -0.0) 0.0)
(num-test (expt 0 0.00000001) 0.0)
(num-test (expt 0 1) 0)
(num-test (expt 0 1.0) 0.0)
(num-test (expt 0 1.0+i) 0.0) ; ??
(num-test (expt 0 1/10) 0)
(num-test (expt 0 1/4) 0)
(num-test (expt 0 10) 0)
(num-test (expt 0 100) 0)
(num-test (expt 0 1000) 0)
(num-test (expt 0 1001) 0)
(num-test (expt 0 101) 0)
(num-test (expt 0 1234) 0)
(num-test (expt 0 1234.0) 0.0)
(num-test (expt 0 1234000000) 0)
(num-test (expt 0 1234000000.0) 0.0)
(num-test (expt 0 2) 0)
(num-test (expt 0 2.71828182845905) 0.0)
(num-test (expt 0 256) 0)
(num-test (expt 0 3) 0)
(num-test (expt 0 362880) 0)
(num-test (expt 0 500029) 0)
(num-test (expt 0 pi) 0.0)
(num-test (expt 0+1e-15i 0-1e-15i) 1.0000000000000015707963267943015114538E0+3.453877639491074211979699606989171173842E-14i)
(num-test (expt 0+1i 2) -1)
(num-test (expt 0+i 0+i) 2.078795763507619085469556198349787700342E-1)
(num-test (expt 0+i 0+i) (exp (/ pi -2)))
(num-test (expt 0+i 0-i) 4.810477380965351655473035666703833126401E0)
(num-test (expt 0+i 1/2) (complex (/ (sqrt 2)) (/ (sqrt 2))))
(num-test (expt 0+i 2) -1.0)
(num-test (expt 0-i 1+i) 0.0-4.810477380965351655473035666703833126401E0i)
(num-test (expt 0-i 1-i) 0.0-2.078795763507619085469556198349787700342E-1i)
(num-test (expt 0-i 2) -1)
(num-test (expt 0.0 (expt 2 31)) 0.0)
(num-test (expt 0.0 (expt 2 32)) 0.0)
(num-test (expt 0.0 (expt 2 33)) 0.0)
(num-test (expt 0.0 (expt 2 63)) 0.0)
(num-test (expt 0.0 (expt 2 64)) 0.0)
(num-test (expt 0.0 (expt 2 65)) 0.0)
(num-test (expt 0.0 0) 0.0)
(num-test (expt 0.0 0+i) 0.0) ; why would they be radically different?
(num-test (expt 0.0 0-i) 0.0)
(num-test (expt 0.0 0.0) 0.0)
(num-test (expt 0.0 0.00000001) 0.0)
(num-test (expt 0.0 1) 0.0)
(num-test (expt 0.0 1.0) 0.0)
(num-test (expt 0.0 1234.0) 0.0)
(num-test (expt 0.0 1234000000.0) 0.0)
(num-test (expt 0.0 1e-15+i) 0.0)
(num-test (expt 0.0 1e-15-i) 0.0)
(num-test (expt 0.0 2.71828182845905) 0.0)
(num-test (expt 0.0 pi) 0.0)
(num-test (expt 0.0-1234000000.0i -1234000000.0+0.00000001i) 0.0)
(num-test (expt 0.00000001 -0.0) 1.0)
(num-test (expt 0.00000001 -0.00000001) 1.00000018420682)
(num-test (expt 0.00000001 -1) 100000000.00000017881393)
(num-test (expt 0.00000001 -1.0) 100000000.00000017881393)
(num-test (expt 0.00000001 0) 1.0)
(num-test (expt 0.00000001 0.0) 1.0)
(num-test (expt 0.00000001 0.00000001) 0.99999981579321)
(num-test (expt 0.00000001 1) 0.00000001)
(num-test (expt 0.00000001 1.0) 0.00000001)
(num-test (expt 0.00000001 10) 0.0)
(num-test (expt 0.00000001 1234) 0.0)
(num-test (expt 0.00000001 1234.0) 0.0)
(num-test (expt 0.00000001 1234000000) 0.0)
(num-test (expt 0.00000001 1234000000.0) 0.0)
(num-test (expt 0.00000001 2) 0.0)
(num-test (expt 0.00000001 2.71828182845905) 0.0)
(num-test (expt 0.00000001 3) 0.0)
(num-test (expt 0.00000001 362880) 0.0)
(num-test (expt 0.00000001 500029) 0.0)
(num-test (expt 0.00000001 pi) 0.0)
(num-test (expt 0.00000001+0.00000001i 1.0+0.0i) 0.00000001+0.00000001i)
(num-test (expt 0.00000001+0.0i 0.00000001+0.00000001i) 0.99999981579319-0.00000018420677i)
(num-test (expt 0.00000001-0.00000001i -1.0+0.0i) 50000000.00000004470348+50000000.00000003725290i)
(num-test (expt 0.00000001-0.0i -0.00000001+0.00000001i) 1.00000018420681-0.00000018420684i)
(num-test (expt 0.0e+00+1.0e+00i -1.0e+00+0.0e+00i) 0-1i)
(num-test (expt 0.0e+00+1.0e+00i 0.0e+00+0.0e+00i) 1e0+0.0i)
(num-test (expt 0.0e+00+1.0e+00i 0.0e+00+1.0e+00i) 2.0787957635076190855e-1+0.0i)
(num-test (expt 0.0e+00+1.0e+00i 0.0e+00-1.0e+00i) 4.8104773809653516555e0+0.0i)
(num-test (expt 0.0e+00+1.0e+00i 1.0e+00+0.0e+00i) 0+1i)
(num-test (expt 0.0e+00+1.0e+00i 5.0e-01+1.00000000000000005551e-01i) 6.0431891044739184057e-1+6.0431891044739184057e-1i)
(num-test (expt 0.0e+00+1.0e+00i 5.0e-01-1.00000000000000005551e-01i) 8.2737771622906514822e-1+8.2737771622906514822e-1i)
(num-test (expt 0.0e+00-1.0e+00i -1.0e+00+0.0e+00i) 0+1i)
(num-test (expt 0.0e+00-1.0e+00i 0.0e+00+0.0e+00i) 1e0+0.0i)
(num-test (expt 0.0e+00-1.0e+00i 0.0e+00+1.0e+00i) 4.8104773809653516555e0+0.0i)
(num-test (expt 0.0e+00-1.0e+00i 0.0e+00-1.0e+00i) 2.0787957635076190855e-1+0.0i)
(num-test (expt 0.0e+00-1.0e+00i 1.0e+00+0.0e+00i) 0-1i)
(num-test (expt 0.0e+00-1.0e+00i 5.0e-01+1.00000000000000005551e-01i) 8.2737771622906514822e-1-8.2737771622906514822e-1i)
(num-test (expt 0.0e+00-1.0e+00i 5.0e-01-1.00000000000000005551e-01i) 6.0431891044739184057e-1-6.0431891044739184057e-1i)
(num-test (expt 0/1 1/362880) 0.0)
(num-test (expt 0/10 10/1234) 0.0)
(num-test (expt 0/11 000) 1)
(num-test (expt 0/1234 1234/10) 0.0)
(num-test (expt 0/2 2/500029) 0.0)
(num-test (expt 0/3 3/1234000000) 0.0)
(num-test (expt 0/362880 362880/1) 0)
(num-test (expt 0/500029 500029/2) 0.0)
(num-test (expt -0.0 most-positive-fixnum) 0.0)
(num-test (expt 0 most-positive-fixnum) 0)
(test (expt 0 (- (expt 2 32))) 'error)
(test (expt 0 (- (expt 2.0 60))) 'error)
(test (expt 0 (complex (- (expt 2 60)) 1.0)) 'error)
(test (expt 0 -255) 'error)
(test (expt 0 -1) 'error)
(test (expt 0 -1.0) 'error)
(test (expt 0 -1/2) 'error)
(num-test (expt 0 1/2) 0) ; or 0.0
(num-test (expt 0 -0+i) 0.0)
(num-test (expt 0 -0-i) 0.0)
(test (expt 0 -1+i) 'error)
(test (expt 0 most-negative-fixnum) 'error)
(test (expt 0.0 most-negative-fixnum) 'error)
(test (expt 0.0 -255) 'error)
(test (expt 0.0 -1) 'error)
(test (expt 0.0 -1.0) 'error)
(test (expt 0.0 -1/2) 'error)
(num-test (expt 0.0 1/2) 0.0) 
(num-test (expt 0.0 -0+i) 0.0)
(num-test (expt 0.0 -0-i) 0.0)
(test (expt 0.0 -1+i) 'error)
(test (expt 0.0 most-negative-fixnum) 'error)
(test (expt 0.0 most-negative-fixnum) 'error)
(num-test (expt 1 1/2) 1)
(num-test (expt 1 (- (expt 2 32))) 1)
(num-test (expt 1 (expt 2 32)) 1)
(num-test (expt 1 (real-part (log 0))) (expt 1.0 (real-part (log 0))))
(num-test (expt 1 -0) 1)
(num-test (expt 1 -0.0) 1.0)
(num-test (expt 1 -0.00000001) 1.0)
(num-test (expt 1 -1) 1)
(num-test (expt 1 -1.0) 1.0)
(num-test (expt 1 -10) 1)
(num-test (expt 1 -100) 1)
(num-test (expt 1 -1000) 1)
(num-test (expt 1 -1001) 1)
(num-test (expt 1 -101) 1)
(num-test (expt 1 -1234) 1)
(num-test (expt 1 -1234.0) 1.0)
(num-test (expt 1 -1234000000) 1)
(num-test (expt 1 -1234000000.0) 1.0)
(num-test (expt 1 -1e-15) 1)
(num-test (expt 1 -2) 1)
(num-test (expt 1 -2.71828182845905) 1.0)
(num-test (expt 1 -3) 1)
(num-test (expt 1 -3.14159265358979) 1.0)
(num-test (expt 1 -362880) 1)
(num-test (expt 1 -500029) 1)
(num-test (expt 1 0) 1)
(num-test (expt 1 0+i) 1)
(num-test (expt 1 0-i) 1)
(num-test (expt 1 0.0) 1.0)
(num-test (expt 1 0.00000001) 1.0)
(num-test (expt 1 1) 1)
(num-test (expt 1 1+i) 1)
(num-test (expt 1 1.0) 1.0)
(num-test (expt 1 1/10) 1)
(num-test (expt 1 10) 1)
(num-test (expt 1 100) 1)
(num-test (expt 1 1000) 1)
(num-test (expt 1 1001) 1)
(num-test (expt 1 101) 1)
(num-test (expt 1 1234) 1)
(num-test (expt 1 1234.0) 1.0)
(num-test (expt 1 1234000000) 1)
(num-test (expt 1 1234000000.0) 1.0)
(num-test (expt 1 2) 1)
(num-test (expt 1 2.71828182845905) 1.0)
(num-test (expt 1 3) 1)
(num-test (expt 1 362880) 1)
(num-test (expt 1 500029) 1)
(num-test (expt 1 most-negative-fixnum) 1)
(num-test (expt 1 pi) 1.0)
(num-test (expt 1+i 1) 1+i)
(num-test (expt 1+i 1.0) 1.0+i)
(num-test (expt 1.0 -0.0) 1.0)
(num-test (expt 1.0 -0.00000001) 1.0)
(num-test (expt 1.0 -1) 1.0)
(num-test (expt 1.0 -1.0) 1.0)
(num-test (expt 1.0 -1/2) 1.0)
(num-test (expt 1.0 -10) 1.0)
(num-test (expt 1.0 -1234) 1.0)
(num-test (expt 1.0 -1234.0) 1.0)
(num-test (expt 1.0 -1234000000) 1.0)
(num-test (expt 1.0 -1234000000.0) 1.0)
(num-test (expt 1.0 -2) 1.0)
(num-test (expt 1.0 -2.71828182845905) 1.0)
(num-test (expt 1.0 -3) 1.0)
(num-test (expt 1.0 -3.14159265358979) 1.0)
(num-test (expt 1.0 -362880) 1.0)
(num-test (expt 1.0 -500029) 1.0)
(num-test (expt 1.0 0) 1.0)
(num-test (expt 1.0 0.0) 1.0)
(num-test (expt 1.0 0.00000001) 1.0)
(num-test (expt 1.0 1) 1.0)
(num-test (expt 1.0 1.0) 1.0)
(num-test (expt 1.0 1/2) 1.0)
(num-test (expt 1.0 10) 1.0)
(num-test (expt 1.0 1234) 1.0)
(num-test (expt 1.0 1234.0) 1.0)
(num-test (expt 1.0 1234000000) 1.0)
(num-test (expt 1.0 1234000000.0) 1.0)
(num-test (expt 1.0 2) 1.0)
(num-test (expt 1.0 2.71828182845905) 1.0)
(num-test (expt 1.0 3) 1.0)
(num-test (expt 1.0 362880) 1.0)
(num-test (expt 1.0 500029) 1.0)
(num-test (expt 1.0 pi) 1.0)
(num-test (expt 1.0+0.00000001i 3.14159265358979+0.00000001i) 1.0+0.00000003141593i)
(num-test (expt 1.0+1.0i 2.71828182845905+0.0i) -1.37164508585166+2.16782742612896i)
(num-test (expt 1.0-0.00000001i -3.14159265358979+0.00000001i) 1.0+0.00000003141593i)
(num-test (expt 1.0-1.0i -2.71828182845905+0.0i) -0.20842863525121+0.32941270052205i)
(num-test (expt 1.0e+00+0.0e+00i -1.0e+00+0.0e+00i) 1e0+0.0i)
(num-test (expt 1.0e+00+0.0e+00i 0.0e+00+1.0e+00i) 1e0+0.0i)
(num-test (expt 1.0e+00+0.0e+00i 0.0e+00-1.0e+00i) 1e0+0.0i)
(num-test (expt 1.0e+00+0.0e+00i 1.0e+00+0.0e+00i) 1e0+0.0i)
(num-test (expt 1.0e+00+0.0e+00i 5.0e-01+1.00000000000000005551e-01i) 1e0+0.0i)
(num-test (expt 1.0e+00+0.0e+00i 5.0e-01-1.00000000000000005551e-01i) 1e0+0.0i)
(num-test (expt 1/10 1234/1234000000) 0.99999769741756)
(num-test (expt 1/1234000000 500029/10) 0.0)
(num-test (expt 1/2 (- (real-part (log 0)))) (expt 0.5 (- (real-part (log 0)))))
(num-test (expt 1/2 -10) 1024)
(num-test (expt 1/2 -3) 8)
(num-test (expt 1/2 1/3) 7.937005259840997373758528196361541301963E-1)
(num-test (expt 1/2 10) 1/1024)
(num-test (expt 1/2 3) 1/8)
(num-test (expt 1/2 3/362880) 0.99999426963298)
(num-test (expt 1/3 10/500029) 0.99997802926990)
(num-test (expt 1/362880 0/2) 1)
(num-test (expt 1/4 -2) 16)
(num-test (expt 1/4 1/2) 1/2)
(num-test (expt 1/4 1/3) 6.299605249474365823836053036391141752849E-1)
(num-test (expt 1/500029 362880/3) 0.0)
(num-test (expt 1/64 -1/2) 8)
(num-test (expt 1/64 -1/3) 4)
(num-test (expt 1/64 -2/3) 16)
(num-test (expt 1/64 -3/2) 512)
(num-test (expt 1/64 1/2) 1/8)
(num-test (expt 1/64 1/3) 1/4)
(num-test (expt 1/64 2/3) 1/16)
(num-test (expt 1/64 3/2) 1/512)
(num-test (expt 1/9223372036854775807 -1) 9223372036854775807)
(num-test (expt 1/9223372036854775807 1) 1/9223372036854775807)
(num-test (expt 9223372036854775807 -1) 1/9223372036854775807)
(num-test (expt 10 -0.0) 1.0)
(num-test (expt 10 -0.00000001) 0.99999997697415)
(num-test (expt 10 -1) 1/10)
(num-test (expt 10 -1.0) 0.1)
(num-test (expt 10 -10) 1/10000000000)
(num-test (expt 10 -2) 1/100)
(num-test (expt 10 -2.71828182845905) 0.00191301410222)
(num-test (expt 10 -3) 1/1000)
(num-test (expt 10 -3.14159265358979) 0.00072178415907)
(num-test (expt 10 0) 1)
(num-test (expt 10 0.0) 1.0)
(num-test (expt 10 0.00000001) 1.00000002302585)
(num-test (expt 10 1) 10)
(num-test (expt 10 1.0) 10.0)
(num-test (expt 10 10) 10000000000)
(num-test (expt 10 2) 100)
(num-test (expt 10 2.71828182845905) 522.73529967043669)
(num-test (expt 10 3) 1000)
(num-test (expt 10 pi) 1385.45573136701182)
(num-test (expt 10/1234 0/362880) 1)
(num-test (expt 10/1234000000 1/500029) 0.99996274097186)
(num-test (expt 10/362880 3/1234) 0.97479810574733)
(num-test (expt 10/500029 2/1234000000) 0.99999998246380)
(num-test (expt 10000000000 1/10) 10)
(num-test (expt 1024 1/10) 2)
(num-test (expt 1048576 1/10) 4)
(num-test (expt 1073741824 1/10) 8)
(num-test (expt 11 10) 25937424601)
(num-test (expt 1234 -0.0) 1.0)
(num-test (expt 1234 -0.00000001) 0.99999992881984)
(num-test (expt 1234 -1) 1/1234)
(num-test (expt 1234 -1.0) 0.00081037277147)
(num-test (expt 1234 -2) 1/1522756)
(num-test (expt 1234 -2.71828182845905) 0.00000000395307)
(num-test (expt 1234 -3) 1/1879080904)
(num-test (expt 1234 -3.14159265358979) 0.00000000019424)
(num-test (expt 1234 0) 1)
(num-test (expt 1234 0.0) 1.0)
(num-test (expt 1234 0.00000001) 1.00000007118016)
(num-test (expt 1234 1) 1234)
(num-test (expt 1234 1.0) 1234.00000000000045)
(num-test (expt 1234 2) 1522756)
(num-test (expt 1234 2.71828182845905) 252968138.32201290130615)
(num-test (expt 1234.0 -0.0) 1.0)
(num-test (expt 1234.0 -0.00000001) 0.99999992881984)
(num-test (expt 1234.0 -1) 0.00081037277147)
(num-test (expt 1234.0 -1.0) 0.00081037277147)
(num-test (expt 1234.0 -2) 0.00000065670403)
(num-test (expt 1234.0 -2.71828182845905) 0.00000000395307)
(num-test (expt 1234.0 -3) 0.00000000053218)
(num-test (expt 1234.0 -3.14159265358979) 0.00000000019424)
(num-test (expt 1234.0 0) 1.0)
(num-test (expt 1234.0 0.0) 1.0)
(num-test (expt 1234.0 0.00000001) 1.00000007118016)
(num-test (expt 1234.0 1) 1234.00000000000045)
(num-test (expt 1234.0 1.0) 1234.00000000000045)
(num-test (expt 1234.0 2) 1522756.00000000093132)
(num-test (expt 1234.0 2.71828182845905) 252968138.32201290130615)
(num-test (expt 1234.0+1234.0i 3.14159265358979+0.0i) -11947544392.17545890808105+9547275530.50568199157715i)
(num-test (expt 1234.0+2.71828182845905i 1.0+0.00000001i) 1233.99999977932634+2.71836966474906i)
(num-test (expt 1234.0-1234.0i -3.14159265358979+0.0i) -5.108095859217296E-11+4.081876325659167E-11i)
(num-test (expt 1234.0-2.71828182845905i -1.0+0.00000001i) 0.00081036883911+0.00000178515565i)
(num-test (expt 1234/10 0/1) 1)
(num-test (expt 1234/1234000000 2/362880) 0.99992385921192)
(num-test (expt 1234/362880 10/1234000000) 0.99999995393994)
(num-test (expt 1234/500029 3/500029) 0.99996397630725)
(num-test (expt 1234000000 -0.0) 1.0)
(num-test (expt 1234000000 -0.00000001) 0.99999979066475)
(num-test (expt 1234000000 -1) 1/1234000000)
(num-test (expt 1234000000 -1.0) 0.00000000081037)
(num-test (expt 1234000000 0) 1)
(num-test (expt 1234000000 0.0) 1.0)
(num-test (expt 1234000000 0.00000001) 1.00000020933529)
(num-test (expt 1234000000.0 -0.0) 1.0)
(num-test (expt 1234000000.0 -0.00000001) 0.99999979066475)
(num-test (expt 1234000000.0 -1) 0.00000000081037)
(num-test (expt 1234000000.0 -1.0) 0.00000000081037)
(num-test (expt 1234000000.0 0) 1.0)
(num-test (expt 1234000000.0 0.0) 1.0)
(num-test (expt 1234000000.0 0.00000001) 1.00000020933529)
(num-test (expt 1234000000.0-1234.0i -2.71828182845905+0.00000001i) 1.9375066625441e-25+5.672277629054e-31i)
(num-test (expt 1234000000/10 1/2) 11108.55526159905094)
(num-test (expt 1234000000/3 0/3) 1)
(num-test (expt 1234000000/362880 1234/500029) 1.02027058333165)
(num-test (expt 1234000000/500029 10/362880) 1.00021527629325)
(num-test (expt 14879/18662 14879/18662) 8.347553395975456341642526041524525735791E-1)
(num-test (expt 16 1/4) 2)
(num-test (expt 1e-1 1e1) 1e-10)
(num-test (expt 1e-1 1e2) 1e-100)
(num-test (expt 1e-15 -1e-15) 1.000000000000034538776394911284329951335E0)
(num-test (expt 1e-15 0+i) -0.999824358967590-0.018741697229594i)
(num-test (expt 1e-15 0-i) -0.999824358967590+0.018741697229594i)
(num-test (expt 1e-15 1e-15) 9.99999999999965461223605089908597123527E-1)
(num-test (expt 1e-15 1e100) 0.0)
(num-test (expt 1e15 -1e1) 1e-150)
(num-test (expt 1e15 1e1) 1e150)
(num-test (expt 1e18 -3) 1e-54)
(if (not with-bignums) (num-test (expt 1e18 -63) 0.0)) ; 1e-1134
(num-test (expt 1+1i -63) 2.3283064365386962890625E-10+2.3283064365386962890625E-10i)
(num-test (expt 1+1i -3) -0.25-0.25i)
(num-test (expt 2 (real-part (log 0))) (expt 2.0 (real-part (log 0))))
(num-test (expt 2 -0.0) 1.0)
(num-test (expt 2 -0.00000001) 0.99999999306853)
(num-test (expt 2 -1) 1/2)
(num-test (expt 2 -1.0) 0.50000000000000)
(num-test (expt 2 -10) 1/1024)
(num-test (expt 2 -2) 1/4)
(num-test (expt 2 -2.71828182845905) 0.15195522325791)
(num-test (expt 2 -3) 1/8)
(num-test (expt 2 -3.14159265358979) 0.11331473229676)
(num-test (expt 2 -9) 1/512)
(num-test (expt 2 0) 1)
(num-test (expt 2 0.0) 1.0)
(num-test (expt 2 0.00000001) 1.00000000693147)
(num-test (expt 2 1) 2)
(num-test (expt 2 1+i) 1.538477802727944253156659987322541402879E0+1.277922552627269602300065822929403568513E0i)
(num-test (expt 2 1.0) 2.0)
(num-test (expt 2 1/3) 1.25992104989487316476721060727822835057E0)
(num-test (expt 2 10) 1024)
(num-test (expt 2 2) 4)
(num-test (expt 2 2.71828182845905) 6.58088599101792)
(num-test (expt 2 3) 8)
(num-test (expt 2 9) 512)
(if (not with-bignums) (test (infinite? (expt 2 1000000000000)) #t))
(num-test (expt 2 pi) 8.82497782707629)
(num-test (expt 2.0 -1.0220000e+03) 2.225073858507201383090232717332404063624E-308)
(num-test (expt 2.0 1.0230000e+03) 8.98846567431157953864652595394512365232E307)
(num-test (expt 2.71828182845905 -0.0) 1.0)
(num-test (expt 2.71828182845905 -0.00000001) 0.99999999000000)
(num-test (expt 2.71828182845905 -1) 0.36787944117144)
(num-test (expt 2.71828182845905 -1.0) 0.36787944117144)
(num-test (expt 2.71828182845905 -10) 0.00004539992976)
(num-test (expt 2.71828182845905 -2) 0.13533528323661)
(num-test (expt 2.71828182845905 -2.71828182845905) 0.06598803584531)
(num-test (expt 2.71828182845905 -3) 0.04978706836786)
(num-test (expt 2.71828182845905 -3.14159265358979) 0.04321391826377)
(num-test (expt 2.71828182845905 0) 1.0)
(num-test (expt 2.71828182845905 0.0) 1.0)
(num-test (expt 2.71828182845905 0.00000001) 1.00000001)
(num-test (expt 2.71828182845905 1) 2.71828182845905)
(num-test (expt 2.71828182845905 1.0) 2.71828182845905)
(num-test (expt 2.71828182845905 10) 22026.46579480671789)
(num-test (expt 2.71828182845905 2) 7.38905609893065)
(num-test (expt 2.71828182845905 2.71828182845905) 15.15426224147926)
(num-test (expt 2.71828182845905 3) 20.08553692318767)
(num-test (expt 2.71828182845905 pi) 23.14069263277927)
(num-test (expt 2.71828182845905+2.71828182845905i 0.00000001+0.0i) 1.00000001346574+0.00000000785398i)
(num-test (expt 2.71828182845905+3.14159265358979i 0.0+0.00000001i) 0.99999999142488+0.00000001424157i)
(num-test (expt 2.71828182845905-2.71828182845905i -0.00000001+0.0i) 0.99999998653426+0.00000000785398i)
(num-test (expt 2.71828182845905-3.14159265358979i -0.0+0.00000001i) 1.00000000857512+0.00000001424157i)
(num-test (expt 2/1 3/1) 8)
(num-test (expt 2/10 1234000000/500029) 0.0)
(num-test (expt 2/1234 500029/1234000000) 0.99739996551176)
(num-test (expt 2/1234000000 362880/1234) 0.0)
(num-test (expt 2/3 -5) (/ 1 (* 2/3 2/3 2/3 2/3 2/3)))
(num-test (expt 2/3 1234/362880) 0.99862213634996)
(num-test (expt 2/3 5) (* 2/3 2/3 2/3 2/3 2/3))
(num-test (expt 2/362880 1/3) 0.01766399721581)
(num-test (expt 2/500029 0/10) 1)
(num-test (expt 25 6) (+ (expt 1 6) (expt 2 6) (expt 3 6) (expt 5 6) (expt 6 6) (expt 7 6) (expt 8 6) (expt 9 6) (expt 10 6) (expt 12 6) (expt 13 6) (expt 15 6) (expt 16 6) (expt 17 6) (expt 18 6) (expt 23 6)))
(num-test (expt 256 0) 1)
(num-test (expt 256 1) 256)
(num-test (expt 25937424601 1/10) 11)
(num-test (expt 2718/1000 617/5) 3.858179469787681136058424024656091858698003418770850904916305853631035158956514884526199288e53) ; not an int!
(num-test (expt 282475249 1/10) 7)
(num-test (expt 29490/26049 29490/26049) 1.15080464191338725897675441635942490625E0)
(num-test (expt 3 -0.0) 1.0)
(num-test (expt 3 -0.00000001) 0.99999998901388)
(num-test (expt 3 -1) 1/3)
(num-test (expt 3 -1.0) 0.33333333333333)
(num-test (expt 3 -10) 1/59049)
(num-test (expt 3 -2) 1/9)
(num-test (expt 3 -2.71828182845905) 0.05047193595639)
(num-test (expt 3 -3) 1/27)
(num-test (expt 3 -3.14159265358979) 0.03170146783514)
(num-test (expt 3 0) 1)
(num-test (expt 3 0.0) 1.0)
(num-test (expt 3 0.00000001) 1.00000001098612)
(num-test (expt 3 1) 3)
(num-test (expt 3 1.0) 3.0)
(num-test (expt 3 10) 59049)
(num-test (expt 3 2) 9)
(num-test (expt 3 2.71828182845905) 19.81299074527465)
(num-test (expt 3 3) 27)
(num-test (expt 3 9) (* 3 3 3 3 3 3 3 3 3))
(num-test (expt 3 pi) 31.54428070019755)
(num-test (expt 3.0 0) 1.0)
(num-test (expt 3.0 0.0) 1.0)
(num-test (expt 3.0 1) 3.0)
(num-test (expt 3.0 1.0) 3.0)
(num-test (expt 3.14159265358979 -0.0) 1.0)
(num-test (expt 3.14159265358979 -0.00000001) 0.99999998855270)
(num-test (expt 3.14159265358979 -1) 0.31830988618379)
(num-test (expt 3.14159265358979 -1.0) 0.31830988618379)
(num-test (expt 3.14159265358979 -10) 0.00001067827923)
(num-test (expt 3.14159265358979 -2) 0.10132118364234)
(num-test (expt 3.14159265358979 -2.71828182845905) 0.04452526726692)
(num-test (expt 3.14159265358979 -3) 0.03225153443320)
(num-test (expt 3.14159265358979 -3.14159265358979) 0.02742569312330)
(num-test (expt 3.14159265358979 0) 1.0)
(num-test (expt 3.14159265358979 0.0) 1.0)
(num-test (expt 3.14159265358979 0.00000001) 1.00000001144730)
(num-test (expt 3.14159265358979 1) pi)
(num-test (expt 3.14159265358979 1.0) pi)
(num-test (expt 3.14159265358979 10) 93648.04747608296748)
(num-test (expt 3.14159265358979 2) 9.86960440108936)
(num-test (expt 3.14159265358979 2.71828182845905) 22.45915771836104)
(num-test (expt 3.14159265358979 3) 31.00627668029983)
(num-test (expt 3.14159265358979 pi) 36.46215960720790)
(num-test (expt 3.14159265358979-3.14159265358979i -1234000000.0+0.0i) 0.0)
(num-test (expt 3/1 10/2) 243)
(num-test (expt 3/10 500029/362880) 0.19032743228093)
(num-test (expt 3/1234 362880/500029) 0.01267163536282)
(num-test (expt 3/1234000000 0/1234000000) 1)
(num-test (expt 3/362880 2/10) 0.09626571578282)
(num-test (expt 3/4 0) 1)
(num-test (expt 3/4 0.0) 1.0)
(num-test (expt 3/4 1) 3/4)
(num-test (expt 3/4 1.0) 0.75)
(num-test (expt 3/500029 1/1234) 0.99030354920325)
(num-test (expt 3486784401 1/10) 9)
(num-test (expt 362880 -0.0) 1.0)
(num-test (expt 362880 -0.00000001) 0.99999987198173)
(num-test (expt 362880 -1) 1/362880)
(num-test (expt 362880 -1.0) 0.00000275573192)
(num-test (expt 362880 -2) 1/131681894400)
(num-test (expt 362880 0) 1)
(num-test (expt 362880 0.0) 1.0)
(num-test (expt 362880 0.00000001) 1.00000012801828)
(num-test (expt 362880 1) 362880)
(num-test (expt 362880 1.0) 362879.99999999982538)
(num-test (expt 362880/1 0/500029) 1)
(num-test (expt 362880/10 3/10) 23.33076127248722)
(num-test (expt 362880/1234 10/3) 169106218.17807236313820)
(num-test (expt 362880/1234000000 1234/2) 0.0)
(num-test (expt 362880/2 1/1234000000) 1.00000000981254)
(num-test (expt 362880/3 2/1234) 1.01914896791961)
(num-test (expt 36836/40706 36836/40706) 9.135636805317119582757524254250295946631E-1)
(num-test (expt 38246/41321 38246/41321) 9.309245639585393834533875308768247886091E-1)
(num-test (expt 4 1/3) 1.587401051968199474751705639272308260393E0)
(num-test (expt 4 10) 1048576)
(num-test (expt 45692/25507 45692/25507) 2.841422098671431061341360858366953184273E0)
(num-test (expt 46394/6866 46394/6866) 4.043224602803809364259118808807234861721E5)
(num-test (expt 5 10) 9765625)
(num-test (expt 5.0e-01+1.00000000000000005551e-01i -1.0e+00+0.0e+00i) 1.9230769230769230687e0-3.8461538461538463509e-1i)
(num-test (expt 5.0e-01+1.00000000000000005551e-01i 0.0e+00+0.0e+00i) 1e0+0.0i)
(num-test (expt 5.0e-01+1.00000000000000005551e-01i 0.0e+00+1.0e+00i) 6.4160554864378080418e-1-5.1201864456768275590e-1i)
(num-test (expt 5.0e-01+1.00000000000000005551e-01i 0.0e+00-1.0e+00i) 9.5219021866126714108e-1+7.5987364224031834571e-1i)
(num-test (expt 5.0e-01+1.00000000000000005551e-01i 1.0e+00+0.0e+00i) 5e-1+1.0000000000000000555e-1i)
(num-test (expt 5.0e-01+1.00000000000000005551e-01i 5.0e-01+1.00000000000000005551e-01i) 6.9977300530987816719e-1+2.1940939105372143160e-2i)
(num-test (expt 5.0e-01+1.00000000000000005551e-01i 5.0e-01-1.00000000000000005551e-01i) 7.1829191470060938876e-1+1.2038189555821612762e-1i)
(num-test (expt 5.0e-01-1.00000000000000005551e-01i -1.0e+00+0.0e+00i) 1.9230769230769230687e0+3.8461538461538463509e-1i)
(num-test (expt 5.0e-01-1.00000000000000005551e-01i 0.0e+00+0.0e+00i) 1e0+0.0i)
(num-test (expt 5.0e-01-1.00000000000000005551e-01i 0.0e+00+1.0e+00i) 9.5219021866126714108e-1-7.5987364224031834571e-1i)
(num-test (expt 5.0e-01-1.00000000000000005551e-01i 0.0e+00-1.0e+00i) 6.4160554864378080418e-1+5.1201864456768275590e-1i)
(num-test (expt 5.0e-01-1.00000000000000005551e-01i 1.0e+00+0.0e+00i) 5e-1-1.0000000000000000555e-1i)
(num-test (expt 5.0e-01-1.00000000000000005551e-01i 5.0e-01+1.00000000000000005551e-01i) 7.1829191470060938876e-1-1.2038189555821612762e-1i)
(num-test (expt 5.0e-01-1.00000000000000005551e-01i 5.0e-01-1.00000000000000005551e-01i) 6.9977300530987816719e-1-2.1940939105372143160e-2i)
(num-test (expt 5.551115123125783999999999999999999999984E-17 1.110223024625156799999999999999999999997E-16) 9.999999999999958444410197170329529649165E-1)
(num-test (expt 500029 -0.0) 1.0)
(num-test (expt 500029 -0.00000001) 0.99999986877579)
(num-test (expt 500029 -1) 1/500029)
(num-test (expt 500029 -1.0) 0.00000199988401)
(num-test (expt 500029 -2) 1/250029000841)
(num-test (expt 500029 0) 1)
(num-test (expt 500029 0.0) 1.0)
(num-test (expt 500029 0.00000001) 1.00000013122422)
(num-test (expt 500029 1) 500029)
(num-test (expt 500029 1.0) 500029.00000000040745)
(num-test (expt 500029/1 362880/1234000000) 1.00386634022855)
(num-test (expt 500029/10 2/3) 1357.26128653075921)
(num-test (expt 500029/1234 3/2) 8156.80442672750178)

(if (not with-bignums)
    (num-test (expt 500029/1234000000 10/1) 0.0)
    (num-test (expt 500029/1234000000 10/1) 977129054104898258427314355689841897479681961836578300201/8187505353567209228244052427776000000000000000000000000000000000000000000000000000000000000))

(num-test (expt 500029/2 0/1234) 1)
(num-test (expt 500029/3 1/10) 3.32803123591083)
(num-test (expt 50664/22466 50664/22466) 6.258302816095884603297081160883745414829E0)
(num-test (expt 512 1/9) 2)
(num-test (expt 56052/41477 56052/41477) 1.502246288382607077882411462458143945519E0)
(num-test (expt 58288/55799 58288/55799) 1.046641989822034585352255152505850793912E0)
(num-test (expt 59049 1/10) 3)
(num-test (expt 6 10) 60466176)
(num-test (expt 60466176 1/10) 6)
(num-test (expt 64 -1/2) 1/8)
(num-test (expt 64 -1/3) 1/4)
(num-test (expt 64 -1/6) 1/2)
(num-test (expt 64 -2/3) 1/16)
(num-test (expt 64 -3/2) 1/512)
(num-test (expt 64 1/2) 8)
(num-test (expt 64 1/3) 4)
(num-test (expt 64 1/6) 2)
(num-test (expt 64 2/3) 16)
(num-test (expt 64 3/2) 512)
(num-test (expt 64/81 1/2) 8/9)
(num-test (expt 7 10) 282475249)
(num-test (expt 747/28616 747/28616) 9.092208838715899745892490249764275628871E-1)
(num-test (expt 8 1/3) 2)
(num-test (expt 8 10) 1073741824)
(num-test (expt 9 10) 3486784401)
(num-test (expt 9765625 1/10) 5)
(num-test (sqrt (- (expt 4 1/5) (expt 3 1/5))) (/ (+ (* (- (expt 2 3/5)) (expt 3 4/5)) (expt 3 3/5) (* 2 (expt 2 2/5) (expt 3 2/5)) (* (- (expt 2 4/5)) (expt 3 1/5)) (expt 2 1/5)) 5))
(num-test (sqrt (- (expt 4 2/3) (* (sqrt 3) (expt 5 1/6)))) (+ (/ (expt 5 1/3) (sqrt 6)) (- (/ (expt 5 5/6) (* 3 (sqrt 2)))) (/ (* (expt 2 1/6) (sqrt 5)) 3) (- (/ (* (expt 2 5/6) (expt 5 1/6)) 3)) (/ (expt 2 1/6) (sqrt 3))))
(num-test (sqrt (- (expt 5 1/3) (expt 4 1/3))) (/ (+ (expt 2 1/3) (expt 20 1/3) (- (expt 25 1/3))) 3))
(num-test (sqrt (- (expt 5 1/3) (expt 4 1/3))) (/ (+ (expt 2 1/3) (expt 20 1/3) (- (expt 25 1/3))) 3))
(num-test (sqrt (- 127 (* 4 (sqrt 6) (expt 7 1/4)))) (+ (/ (* (sqrt 3) (expt 7 3/4)) (sqrt 2)) (* 2 (sqrt 7)) (/ (* 3 (sqrt 3) (expt 7 1/4)) (sqrt 2)) -6))
(num-test (sqrt (- 161 (* 12 (expt 5 1/4)))) (+ (* 2 (expt 5 3/4)) (- (* 3 (sqrt 5))) (* 4 (sqrt (sqrt 5))) 6))
(num-test (sqrt (- 2 (expt 2 1/7))) (/ (* (expt 2 1/14) (+ (- (expt 2 6/7)) (expt 2 5/7) (expt 2 3/7) (* 2 (expt 2 1/7)) -1)) (sqrt 7)))
(test (= (+ (expt 2421 3) (expt 19083 3)) (+ (expt 5436 3) (expt 18948 3)) (+ (expt 10200 3) (expt 18072 3)) (+ (expt 13322 3) (expt 16630 3))) #t)

;;; amol sasane MAA Monthly
(num-test (expt (sqrt 2) (log 3 2)) (sqrt 3))
(num-test (expt (expt 2 (sqrt 2)) 1/2) (expt (sqrt 2) (sqrt 2)))
(num-test (expt (sqrt 2) (* 2 (log 3 2))) 3)
(num-test (expt (sqrt 2) (+ (sqrt 2) 1)) (* (sqrt 2) (expt (sqrt 2) (sqrt 2))))
(num-test (expt (expt (sqrt 2) (sqrt 2)) (sqrt 2)) 2)

(unless with-bignums
  (num-test (expt (+ 1 (/ 1000000)) 100) 1.0001000049501534764)
  (num-test (expt (+ 1 (/ 1000000000)) 100000000) 1.1051709271646142850)
  (num-test (expt (+ 1 (/ 1000000000)) 10000000000) 2.20264839094613347809362152246750859877E4)
  (test (infinite? (expt 3/4 most-negative-fixnum)) #t)
  (num-test (expt 4/3 most-negative-fixnum) 0)
  (num-test (expt 1.0 most-negative-fixnum) 1.0)
  (num-test (expt -1.0 most-negative-fixnum) 1.0)
  (num-test (expt 1.0 most-positive-fixnum) 1.0)
  (num-test (expt -1.0 most-positive-fixnum) -1.0)
  (num-test (expt -1.0 (+ (expt 2 53) 1)) -1.0)
  (num-test (expt -1.0 (- 1 (expt 2 54))) -1.0)
  (num-test (expt -1.0 (expt 2 54)) 1.0)
  (num-test (expt 2.0 (- (expt 2 53))) 0.0)
  (num-test (expt 2 most-negative-fixnum) 0)
  (test (nan? (expt 1/0 0)) #t)
  (test (nan? (expt (complex 0 1/0) 0)) #t)
  (test (nan? (expt (complex 1/0 1/0) 0)) #t)
  (test (nan? (expt (complex 1/0 0) 0)) #t)
  (num-test (expt most-negative-fixnum 8) 5.237424972633826992021103514924158643547E151)
  (num-test (expt most-negative-fixnum 2) 8.5070591730234615865843651857942052864E37)
  (num-test (expt most-negative-fixnum -1) -1.084202172485504434007452800869941711426E-19)
  (num-test (expt most-negative-fixnum -2) 1.175494350822287507968736537222245677819E-38))

(num-test (expt 1 most-negative-fixnum) 1)
(num-test (expt -1 most-negative-fixnum) 1)
(num-test (expt 1 most-positive-fixnum) 1)
(num-test (expt -1 most-positive-fixnum) -1)
(num-test (expt most-positive-fixnum 1) most-positive-fixnum)
(num-test (expt most-positive-fixnum -1) (/ most-positive-fixnum))
(num-test (expt most-negative-fixnum 1) most-negative-fixnum)
(num-test (expt most-negative-fixnum 0) 1)
(num-test (expt 1/9223372036854775807 9223372036854775807) 0.0)
(test (infinite? (expt 1/9223372036854775807 -9223372036854775807)) #t)
(test (infinite? (expt 9223372036854775807 9223372036854775807)) #t)

(num-test (expt 0+i (+ 0 (expt 2 16))) 1.0)
(num-test (expt 0+i (+ 1 (expt 2 16))) 0+i)
(num-test (expt 0+i (+ 2 (expt 2 16))) -1.0)
(num-test (expt 0+i (+ 3 (expt 2 16))) 0-i)
(num-test (expt 0-i (+ 0 (expt 2 16))) 1.0)
(num-test (expt 0-i (+ 1 (expt 2 16))) 0-i)
(num-test (expt 0-i (+ 2 (expt 2 16))) -1.0)
(num-test (expt 0-i (+ 3 (expt 2 16))) 0+i)
(num-test (expt 0+i (+ 0 (expt 2 54))) 1.0)
(num-test (expt 0+i (+ 1 (expt 2 54))) 0+i)
(num-test (expt 0+i (+ 2 (expt 2 54))) -1.0)
(num-test (expt 0+i (+ 3 (expt 2 54))) 0-i)
(num-test (expt 0-i (+ 0 (expt 2 54))) 1.0)
(num-test (expt 0-i (+ 1 (expt 2 54))) 0-i)
(num-test (expt 0-i (+ 2 (expt 2 54))) -1.0)
(num-test (expt 0-i (+ 3 (expt 2 54))) 0+i)

(let ((val1 (catch #t (lambda () (expt 0.0 0.0)) (lambda args 'error)))
      (val2 (catch #t (lambda () (expt 0.0 -0.0)) (lambda args 'error))))
  (test (equal? val1 val2) #t))
(let ((val1 (catch #t (lambda () (expt 2.0 0.0)) (lambda args 'error)))
      (val2 (catch #t (lambda () (expt 2.0 -0.0)) (lambda args 'error))))
  (test (equal? val1 val2) #t))

;;      (test (expt 0 0-i) 0.0) ; sbcl and clisp say division by 0 here, guile says NaN
;;      but (expt 0.0 1e-15-i) is 0.0??
;; clisp says (expt 0 1+i) is 0, but (expt 0 0+i) is division by zero??) -- sbcl agrees

#|
(do ((i 30 (+ i 1))) 
    ((= i 63)) 
  (format #t "~D: (- ~A ~A) -> ~A~%" i (+ (expt 2.0 i) 500) (+ (expt 2.0 i) 100) (- (+ (expt 2.0 i) 500) (+ (expt 2.0 i) 100))))

55: (- 3.6028797018964e+16 3.6028797018964e+16) -> 400.0
56: (- 7.2057594037928e+16 7.2057594037928e+16) -> 400.0
57: (- 1.4411518807586e+17 1.4411518807586e+17) -> 416.0
58: (- 2.8823037615171e+17 2.8823037615171e+17) -> 384.0
59: (- 5.7646075230342e+17 5.7646075230342e+17) -> 384.0
60: (- 1.1529215046068e+18 1.1529215046068e+18) -> 512.0
61: (- 2.3058430092137e+18 2.3058430092137e+18) -> 512.0
62: (- 4.6116860184274e+18 4.6116860184274e+18) -> 0.0
|#

(test (or (< (magnitude (- (expt -2/362880 1/3) 0.00883199860790+0.01529747032127i)) 1e-6)
	  (< (magnitude (- (expt -2/362880 1/3) 0.00883199860790-0.01529747032127i)) 1e-6)
	  (< (magnitude (- (expt -2/362880 1/3) -0.017663997215805)) 1e-6)) #t)

(test (< (abs (- (+ (complex 1.0 0.0) (make-polar 1.0 0.0) 1.0+0i (* -1.0 -1.0) (/ 1.0) 
		    (exp 0.0) (abs -1.0) (cos 0.0) (log (exp 1)) (magnitude 1.0+0i) (max 0.0 1.0) (min 1.0 2.0))
		 12.0))
	 1e-12)
      #t)

(let ((xs (list 2 3 4 1/2 1/3 1/4 2.5 1+i 2.5+1.5i 2.5-.5i))
      (ys  (list 2 3 4 -2 -3 1/2 1/3 1/4 -1/2 -1/3 -1/4 2.5 -3.5 1+i -1+2i 2.5+1.5i 2.5-.5i)))
  (for-each
   (lambda (x)
     (for-each 
      (lambda (y)
	(num-test (expt (expt x y) (/ y)) x)
	;;	(if (> (magnitude (- (expt (expt x y) (/ y)) x)) 1e-6)
	;;	    (format #t ";(expt (expt ~A ~A) (/ ~A)) -> ~A (~A)~%" x y y (expt (expt x y) (/ y)) (magnitude (- (expt (expt x y) (/ y)) x))))
	)
      ys))
   xs))

(when with-bignums
  ;; from Knuth IIp245(3rd)
  (let* ((f (lambda (x) (/ (- 1 (expt x 107)) (- 1 x))))
	 (g (lambda (y) (f (* (- 1/3 (* y y)) (+ 3 (* 3.45 y y))))))
	 (gx (lambda (y) (+ 107 (* -10491.35 y y) (* 659749.9625 y y y y) (* 30141386.26625 (expt y 6))))))
    (do ((i 3 (+ i 1)))
	((> i 10))
      (let ((g1 (g (expt 10 (- i))))
	    (g2 (gx (expt 10 (- i)))))
	(let ((diff (abs (- g1 g2))))
	  (if (or (nan? diff) (> diff (expt 10 (- -7 i))))
	      (format #t ";g(1e-~D) -> ~A ~A, diff: ~A~%" i g1 g2 (abs (- g1 g2))))))))
  
  (let ((p (lambda (x y) (+ (* 2 y y) (* 9 x x x x) (* -1 y y y y)))))
    (num-test (p 408855776 708158977) 1))
  (let ((p (lambda (x y) (+ (* 2 y y) (* (- (* 3 x x) (* y y)) (+ (* 3 x x) (* y y)))))))
    (num-test (p 408855776 708158977) 1)))

(let ((top-exp 60))  
  (let ((happy #t))
    (do ((i 2 (+ i 1)))
	((or (not happy) (> i top-exp)))
      (let* ((val1 (+ 2 (expt 2 i)))
	     (val2 (- val1 1)))
	(if (not (> val1 val2))
	    (begin (set! happy #f) (display "(> ") (display val1) (display " ") (display val2) (display ") -> ") (display (> val1 val2)) (display "?") (newline)))
	(if (< val1 val2)
	    (begin (set! happy #f) (display "(< ") (display val1) (display " ") (display val2) (display ") -> ") (display (< val1 val2)) (display "?") (newline))))))
  
  (let ((happy #t))
    (do ((i 2 (+ i 1)))
	((or (not happy) (> i top-exp)))
      (let* ((val1 (/ (expt 2 i) 3))
	     (val2 (/ (+ 1 (expt 2 i)) 3)))
	(if (> val1 val2)
	    (begin (set! happy #f) (display "(> ") (display val1) (display " ") (display val2) (display ") -> ") (display (> val1 val2)) (display "?") (newline)))
	(if (not (> val2 val1))
	    (begin (set! happy #f) (display "(> ") (display val1) (display " ") (display val2) (display ") -> ") (display (> val2 val1)) (display "?") (newline)))
	(if (not (< val1 val2))
	    (begin (set! happy #f) (display "(< ") (display val1) (display " ") (display val2) (display ") -> ") (display (< val1 val2)) (display "?") (newline)))
	(if (< val2 val1)
	    (begin (set! happy #f) (display "(< ") (display val1) (display " ") (display val2) (display ") -> ") (display (< val2 val1)) (display "?") (newline)))
	))))

(let* ((x (* #x1.6000022202b1076a (expt 2 -58))) 
       (a (expt (- 1.01 x) (- 1.01 x))) 
       (b (expt x (- 1.01 (expt x (- 1.01 x)))))) 
  (num-test a 1.010100503341741589854787064753636627742E0)
  (num-test b 3.201463978607038931337314838029261023486E-18)
  (num-test x 4.770489999999999999978271189676737354422E-18)
  (num-test (+ a b -1.01) 1.005033417415841744668463594232356924E-4)
  (test (positive? (+ a b -1.01)) #t))

(do ((k 1 (+ k 1)))
    ((= k 12))
  (num-test (+ (expt 11 k) (expt 24 k) (expt 65 k) (expt 90 k) (expt 129 k) 
	       (expt 173 k) (expt 212 k) (expt 237 k) (expt 278 k) (expt 291 k) (expt 302 k))
	    (+ (expt 3 k) (expt 5 k) (expt 30 k) (expt 57 k) (expt 104 k) (expt 116 k) 
	       (expt 186 k) (expt 198 k) (expt 245 k) (expt 272 k) (expt 297 k) (expt 299 k))))


(let ((top 0))
  (let ((x-10 (lambda (n) (- (expt n 10) (* n n n n n n n n n n)))))
    (let ((happy #t)
	  (lim (if with-bignums 100 74)))
      (do ((i 1 (+ i 1)))
	  ((or (not happy) (= i lim))) ; stop around 63 bits
	(let ((val (x-10 i)))
	  (if (not (= val 0))
	      (begin
		(set! top (- i 1))
		(set! happy #f)
		(display "(expt ") (display i) (display " 10) = ") (display (expt i 10))
		(display " but (* ") (display i) (display "... 10x) = ")
		(display (* i i i i i i i i i i)) (newline)))))))
  (if (> top 63)
      (num-test (+ (expt 1 10) (expt 2 10) (expt 4 10) (expt 5 10) (expt 6 10) (expt 8 10) (expt 12 10) 
		   (expt 15 10) (expt 16 10) (expt 17 10) (expt 20 10) (expt 21 10) (expt 25 10) (expt 26 10) 
		   (expt 27 10) (expt 28 10) (expt 30 10) (expt 36 10) (expt 37 10) (expt 38 10) (expt 40 10) 
		   (expt 51 10) (expt 62 10))
		(expt 63 10))))

(do ((i 1 (+ i 1)))
    ((= i 10))
  (let ((v (vector i (- i) (/ i) (/ i (+ i 1)) (- (/ i)) (/ (- i) (+ i 1))
		   (random (* i 10.0)) (sqrt i) (+ i (random (sqrt i))) (- (random (* i 2.0)) i)
		   (complex i i)
		   (complex (- i) (- i))
		   )))
    (let ((len (length v)))
      (do ((k 0 (+ k 1)))
	  ((= k len))
	(do ((j 0 (+ j 1)))
	    ((= j len))
	  (let ((val1 (catch #t (lambda () (expt (v k) (v j))) (lambda args 'error)))) ; (expt 0 -1) for example
	    (if (number? val1)
		(let ((val2 (if (zero? (v k)) 0 (exp (* (v j) (log (v k))))))
		      (val3 (if (zero? (v k)) 0 (exp (* (v j) (+ (* 0+2i pi) (log (v k))))))))
		  (let ((diff 
			 (min (magnitude (- val1 val2))
			      (magnitude (- val1 val3)))))
		    (if (> (/ diff (max (magnitude val1) 1)) 1e-12)
			(format #t ";(expt ~A ~A), ~A ~A ~A: ~A~%" (v k) (v j) val1 val2 val3 diff)))))))))))

(if with-bignums
    (num-test (let ((dickey (lambda (x y) ; from Kawa
			      (+  (* 1335/4 (expt y 6))
				  (* (expt x 2)
				     (- (* 11 (expt x 2) (expt y 2))
					(expt y 6)
					(* 121 (expt y 4))
					2))
				  (* 11/2 (expt y 8))
				  (/ x (* 2 y))))))
		(dickey 77617 33096))
	      -54767/66192))



(let ((x-10 (lambda (n) (- (expt n 10) (* n n n n n n n n n n)))))
  (let ((happy #t)
	(lim (if with-bignums 100 74)))
    (do ((i 1 (+ i 2)))
	((or (not happy) (> i lim))) ; stop around 63 bits
      (let ((val (x-10 (/ i 2))))
	(if (not (= val 0))
	    (begin
	      (set! happy #f)
	      (display "(expt ") (display i) (display "/2 10) = ") (display (expt (/ i 2) 10))
	      (display " but (* ") (display i) (display "/2 ... 10x) = ")
	      (display (/ (* i i i i i i i i i i) 1024)) (newline)))))))

(let ((x-10 (lambda (n) (- (expt n -10) (/ 1 (* n n n n n n n n n n))))))
  (let ((happy #t)
	(lim (if with-bignums 100 74)))
    (do ((i 1 (+ i 2)))
	((or (not happy) (> i lim))) ; stop around 63 bits
      (let ((val (x-10 (/ i 2))))
	(if (not (= val 0))
	    (begin
	      (set! happy #f)
	      (display "(expt ") (display i) (display "/2 -10) = ") (display (expt (/ i 2) -10))
	      (display " but (* 1/(") (display i) (display "/2) ... 10x) = ")
	      (display (/ 1024 (* i i i i i i i i i i))) 
	      (display " [diff=") (display val) (display "]")
	      (newline)))))))

(let ((happy #t)
      (lim (if with-bignums 50 19)))
  (do ((i 1 (+ i 1)))
      ((or (not happy) (> i lim)))
    (let* ((val1 (expt 3 i))
	   (val2 (sqrt (* val1 val1))))
      (if (not (= val1 val2))
	  (begin
	    (set! happy #f)
	    (display "[3^i] (sqrt ") (display (* val1 val1)) (display " = ") (display val2)
	    (display " but should be ") (display val1) (newline))))))


(if (not with-bignums)
    (begin
      (num-test (* (/ (expt 2 31) (+ (expt 2 20) 1)) (/ (+ (expt 2 31) 1) (expt 2 20))) 4194300.0019569)
      (num-test (expt -2/10 1234000000/500029) 0.0)
      (num-test (expt -2/1234000000 362880/1234) 0.0)
      (num-test (expt -1/1234000000 500029/10) 0.0)
      (num-test (expt 3.14159265358979-1.0i -1234.0+0.00000001i) 0.0)
      (num-test (expt -3.14159265358979-1.0i -1234.0-0.00000001i) 0.0)
      (num-test (expt 1234000000.0-1234000000.0i -1234.0+0.0i) 0.0)
      (num-test (expt -1234000000.0-1234000000.0i -1234.0-0.0i) 0.0)
      )
    (begin
      (num-test (* (/ (expt 2 31) (+ (expt 2 20) 1)) (/ (+ (expt 2 31) 1) (expt 2 20))) 4398046513152/1048577)
      (test (expt 1/2 9223372036854775807) 0.0)
      (num-test (expt (expt -4722366482869645213696/6561 1/2) 2) -4722366482869645213696/6561)
      (num-test (expt 324518553658426726783156020576256.0 1/3) 68719476736.0)
      (num-test (expt 4722366482869645213696 1/2) 68719476736)
      (num-test (expt 4722366482869645213696.0 1/2) 68719476736.0)
      (num-test (expt 4722366482869645213696/6561 -1/2) (/ 68719476736/81))
      (num-test (* (/ (expt 2 61) (+ (expt 2 40) 1)) (/ (+ (expt 2 61) 1) (expt 2 40)))	4835703278458516700921856/1099511627777)
      (num-test (+ (- 512 (expt 2.0 62)) (- (expt 2.0 62) 513)) -1.0)
      (num-test (+ (/ (expt 2 61) (+ (expt 2 40) 1)) (/ (+ (expt 2 61) 1) (expt 2 40))) 5070602400915223450095538143233/1208925819615728686333952)
      (num-test (+ (expt 2 61) (expt 2 62) (expt 2 61)) (/ (expt 2 64) 2))
      (num-test (* 2 (expt 2 62)) (expt 2 63))
      (num-test (* 8 (expt 2 30) (expt 2 30)) 9223372036854775808)
      (num-test (- (+ (expt 2.0 62) 500) (+ (expt 2.0 62) 100)) 4.000E2)
      (num-test (- (+ (expt 2.0 62) 512) (+ (expt 2.0 62) 513)) -1.0)
      (num-test (- (/ (expt 2 61) (+ (expt 2 40) 1)) (/ (+ (expt 2 61) 1) (expt 2 40)))	-2305844108725321729/1208925819615728686333952)
      (num-test (/ (/ (expt 2 61) (+ (expt 2 40) 1)) (/ (+ (expt 2 61) 1) (expt 2 40)))	2535301200456458802993406410752/2535301200458764647102131732481)
      (num-test (/ (expt (* 1.2345e-170 1.2345e-170) 1/100)) 2.501325312985302606641508258507698932691E3)
      (num-test (/ (log (expt 2 32)) (log 2)) 32.0)
      (num-test 1180591620717411303424/1180591620717411303425 (/ (expt 2 70) (+ (expt 2 70) 1)))
      (test (< (abs (- (expt (- (exp (* pi (sqrt (bignum "163")))) 744) 1/3) 6.4031999999999999999999999999939031735E5)) 1e-32) #t)
      (test (> (+ (expt 2.0 62) 500) (+ (expt 2.0 62) 100)) #t)
      (num-test (expt -2/10 1234000000/500029) 9.92209574402351949043519108941671096176E-1726-4.788930572030484370393069119625570107346E-1726i)
      (num-test (expt -2/1234000000 362880/1234) 1.116318539471846948140196659021553350719E-2585+2.424343808068083320544106524660635302266E-2586i)
      (num-test (expt -1/1234000000 500029/10) -7.168156874677746632219778149112758764437E-454593+2.32907535423388290492582809530285175961E-454593i)
      (num-test (expt 3.14159265358979-1.0i -1234.0+0.00000001i) -4.480790643664505864348068449454625911766E-640-6.676876181099023202939008945839411012697E-641i)
      (num-test (expt -3.14159265358979-1.0i -1234.0-0.00000001i) -4.480790502896318391426668753233092987401E-640+6.676875971338774903151645323179283073828E-641i)
      (num-test (expt 1234000000.0-1234000000.0i -1234.0+0.0i) 0.0+3.815800046393940013006703716489144169017E-11405i)
      (num-test (expt -1234000000.0-1234000000.0i -1234.0-0.0i) 0.0-3.815800046393940013006703716489144169017E-11405i)

      (num-test (expt 2 1/3) 1.25992104989487316476721060727822835057E0)
      (test (zero? (- (expt 2 1/3) 1.2599210498949)) #f) ; make sure it's not just libm's cbrt
      ))

(when (and (not (provided? 'freebsd)) (not (provided? 'openbsd)))
  (for-each
   (lambda (data)
     (let ((num1 (car data)) (num2 (cadr data)) (val (caddr data))) (num-test-2 'expt num1 num2 (expt num1 num2) val)))
   (vector (list 0 0 1) (list 0 1 0) (list 0 2 0) (list 0 3 0) (list 0 1/2 0) (list 0 1/3 0) 
	   (list 0 0.0 0.0) (list 0 1.0 0.0) (list 0 2.0 0.0) (list 0 1.000000000000000000000000000000000000002E-309 0.0) 
	   (list 0 1e+16 0.0) (list 0 inf.0 0.0) (list 0 0+1i 0.0) (list 0 0+2i 0.0) 
	   (list 0 0-1i 0.0) (list 0 1+1i 0.0) (list 0 1-1i 0.0) (list 0 0.1+0.1i 0.0) (list 0 1e+16+1e+16i 0.0) 
	   (list 0 1e-16+1e-16i 0.0) (list 1 0 1) (list 1 1 1) (list 1 2 1) (list 1 3 1) (list 1 -1 1) 
	   (list 1 -2 1) (list 1 -3 1) (list 1 1/2 1) (list 1 1/3 1.0) (list 1 -1/2 1.000E0) 
	   (list 1 -1/3 1.000E0) (list 1 0.0 1.000E0) (list 1 1.0 1.000E0) (list 1 2.0 1.000E0) 
	   (list 1 -2.0 1.000E0) (list 1 1.000000000000000000000000000000000000002E-309 1.000E0) 
	   (list 1 1e+16 1.000E0) (list 1 inf.0 1.000E0) (list 1 -inf.0 1.000E0) 
	   (list 1 0+1i 1.0) (list 1 0+2i 1.0) (list 1 0-1i 1.0) (list 1 1+1i 1.0) (list 1 1-1i 1.0) (list 1 -1+1i 1.0) 
	   (list 1 -1-1i 1.0) (list 1 0.1+0.1i 1.0) (list 1 1e+16+1e+16i 1.0) (list 1 1e-16+1e-16i 1.0) 
	   (list 2 0 1) (list 2 1 2) (list 2 2 4) (list 2 3 8) (list 2 -1 1/2) (list 2 -2 1/4) 
	   (list 2 -3 1/8) (list 2 1/2 1.4142135623731) (list 2 1/3 1.2599210498949) (list 2 -1/2 7.071067811865475244008443621048490392845E-1) 
	   (list 2 -1/3 7.937005259840997475556964875637659160371E-1) (list 2 0.0 1.000E0) (list 2 1.0 2.000E0) 
	   (list 2 2.0 4.000E0) (list 2 -2.0 2.500E-1) (list 2 1.000000000000000000000000000000000000002E-309 1.000E0) 
	   (list 2 -inf.0 0.0) (list 2 0+1i 7.692389013639721265783299936612707014395E-1+6.389612763136348011500329114647017842567E-1i) 
	   (list 2 0+2i 1.83456974743301676839941236809235104518E-1+9.830277404112437205861648503427281526099E-1i) 
	   (list 2 0-1i 7.692389013639721265783299936612707014395E-1-6.389612763136348011500329114647017842567E-1i) 
	   (list 2 1+1i 1.538477802727944253156659987322541402879E0+1.277922552627269602300065822929403568513E0i) 
	   (list 2 1-1i 1.538477802727944253156659987322541402879E0-1.277922552627269602300065822929403568513E0i) 
	   (list 2 -1+1i 3.846194506819860632891649968306353507197E-1+3.194806381568174005750164557323508921283E-1i) 
	   (list 2 -1-1i 3.846194506819860632891649968306353507197E-1-3.194806381568174005750164557323508921283E-1i) 
	   (list 2 0.1+0.1i 1.069199809265204517687304849996528484166E0+7.423020183379063973209835788737470580225E-2i) 
	   (list 2 1e-16+1e-16i 1.00000000000000006931471805599452949289E0+6.931471805599453429742233135802455373554E-17i) 
	   (list 3 0 1) (list 3 1 3) (list 3 2 9) (list 3 3 27) (list 3 -1 1/3) (list 3 -2 1/9) 
	   (list 3 -3 1/27) (list 3 1/2 1.7320508075689) (list 3 1/3 1.4422495703074) (list 3 -1/2 5.773502691896257645091487805019574556475E-1) 
	   (list 3 -1/3 6.933612743506347189382852083362015558497E-1) (list 3 0.0 1.000E0) (list 3 1.0 3.000E0) 
	   (list 3 2.0 9.000E0) (list 3 -2.0 1.111111111111111111111111111111111111113E-1) (list 3 1.000000000000000000000000000000000000002E-309 1.000E0) 
	   (list 3 -inf.0 0.0) (list 3 0+1i 4.548324228266097550275651435950424840878E-1+8.905770416677470590749273065651780951036E-1i) 
	   (list 3 0+2i -5.862549342913521629213761016900936427016E-1+8.101266271509919688171526765177844453941E-1i) 
	   (list 3 0-1i 4.548324228266097550275651435950424840878E-1-8.905770416677470590749273065651780951036E-1i) 
	   (list 3 1+1i 1.364497268479829265082695430785127452266E0+2.671731125003241177224781919695534285314E0i) 
	   (list 3 1-1i 1.364497268479829265082695430785127452266E0-2.671731125003241177224781919695534285314E0i) 
	   (list 3 -1+1i 1.516108076088699183425217145316808280297E-1+2.968590138892490196916424355217260317017E-1i) 
	   (list 3 -1-1i 1.516108076088699183425217145316808280297E-1-2.968590138892490196916424355217260317017E-1i) 
	   (list 3 0.1+0.1i 1.109394427306365911813022078881836880638E0+1.223721548273860448930668229757603279477E-1i) 
	   (list 3 1e-16+1e-16i 1.00000000000000010986122886681096684318E0+1.098612288668109789126712952843432012306E-16i) 
	   (list -1 0 1) (list -1 1 -1) (list -1 2 1) (list -1 3 -1) (list -1 -1 -1) (list -1 -2 1) 
	   (list -1 -3 -1) (list -1 1/2 0+1i) (list -1 1/3 -1.0) (list -1 -1/2 0.0-1.00E0i)
	   (list -1 -1/3 5.000000000000000503430454055824822034062E-1-8.660254037844386176981523540143355578944E-1i) 
	   (list -1 0.0 1.000E0) (list -1 1.0 -1.00E0) (list -1 2.0 1.000E0) (list -1 -2.0 1.000E0) 
					;(list -1 1e+16 1.000E0) 
	   (list -1 0+1i 4.321391826377224977441773717172801127579E-2) 
	   (list -1 0+2i 1.86744273170798881443021293482703039342E-3) (list -1 0-1i 2.314069263277926900572908636794854738031E1) 
	   (list -1 1+1i -4.321391826377224977441773717172801127579E-2) (list -1 1-1i -2.314069263277926900572908636794854738031E1) 
	   (list -1 -1+1i -4.321391826377224977441773717172801127579E-2) (list -1 -1-1i -2.314069263277926900572908636794854738031E1) 
	   (list -1 0.1+0.1i 6.946542388413302284911578278489504217747E-1+2.257068442712257901873502529761755278285E-1i) 
	   (list -1 1e+16+1e+16i 0.0) (list -1 1e-16+1e-16i 9.999999999999996858407346410206827203587E-1+3.141592653589792185835963602803850622895E-16i) 
	   (list -2 0 1) (list -2 1 -2) (list -2 2 4) (list -2 3 -8) (list -2 -1 -1/2) (list -2 -2 1/4) 
	   (list -2 -3 -1/8) (list -2 1/2 0+1.4142135623731i) (list -2 1/3 -1.2599210498949) 
	   (list -2 -1/2 0.0-7.071067811865475244008443621048490392845E-1i) 
	   (list -2 -1/3 3.968502629920499137351498618341152884837E-1-6.873648184993012989383839761489500939792E-1i) 
	   (list -2 0.0 1.000E0) (list -2 1.0 -2.00E0) (list -2 2.0 4.000E0) (list -2 -2.0 2.500E-1) 
	   (list -2 -inf.0 0.0) (list -2 0+1i 3.324182700885665525901791766265082328307E-2+2.761202036833300995082465454051316449496E-2i) 
	   (list -2 0+2i 3.425953940655147934023229852954811989202E-4+1.835748008898304681163796172161682131024E-3i) 
	   (list -2 0-1i 1.780072097764048857359856955378859222048E1-1.478600649942216768260366593652156810413E1i) 
	   (list -2 1+1i -6.648365401771331051803583532530164656613E-2-5.522404073666601990164930908102632898992E-2i) 
	   (list -2 1-1i -3.560144195528097714719713910757718444095E1+2.957201299884433536520733187304313620826E1i) 
	   (list -2 -1+1i -1.662091350442832762950895883132541164153E-2-1.380601018416650497541232727025658224748E-2i) 
	   (list -2 -1-1i -8.900360488820244286799284776894296110238E0+7.393003249711083841301832968260784052065E0i) 
	   (list -2 0.1+0.1i 7.259699150688950609812198701314241029302E-1+2.928900391985359860022641767906842987898E-1i) 
	   (list -2 1e+16+1e+16i 0.0) (list -2 1e-16+1e-16i 9.999999999999997551554526970151686615297E-1+3.834739834149737528810186916384012655492E-16i) 
	   (list -3 0 1) (list -3 1 -3) (list -3 2 9) (list -3 3 -27) (list -3 -1 -1/3) (list -3 -2 1/9) 
	   (list -3 -3 -1/27) (list -3 1/2 0+1.7320508075689i) (list -3 1/3 -1.4422495703074) 
	   (list -3 -1/2 0.0-5.773502691896257645091487805019574556475E-1i) 
	   (list -3 -1/3 3.466806371753173943750607212746369268463E-1-6.004684775880013553913614575447052401843E-1i) 
	   (list -3 0.0 1.000E0) (list -3 1.0 -3.00E0) (list -3 2.0 9.000E0) (list -3 -2.0 1.111111111111111111111111111111111111113E-1) 
	   (list -3 -inf.0 0.0) (list -3 0+1i 1.965509114374261361108537566165204334024E-2+3.848532348622211453375207440262631065206E-2i) 
	   (list -3 0+2i -1.094797515970330168691448329739632503045E-3+1.512865081636227781901948390654863520171E-3i) 
	   (list -3 0-1i 1.052513729605287378161514526579733692066E1-2.060856958704319044776041543097331663996E1i) 
	   (list -3 1+1i -5.896527343122784083325612698495613002091E-2-1.15455970458666343601256223207878931956E-1i) 
	   (list -3 1-1i -3.157541188815862134484543579739201076193E1+6.182570876112957134328124629291994991979E1i) 
	   (list -3 -1+1i -6.551697047914204537028458553884014446755E-3-1.282844116207403817791735813420877021735E-2i) 
	   (list -3 -1-1i -3.508379098684291260538381755265778973549E0+6.869523195681063482586805143657772213312E0i) 
	   (list -3 0.1+0.1i 7.430253085825579186796890883432274992943E-1+3.354042513063949187690186935389269335405E-1i) 
	   (list -3 1e+16+1e+16i 0.0) (list -3 1e-16+1e-16i 9.999999999999997957019635078315805356955E-1+4.240204942257901974962676555647136289098E-16i) 
	   (list 1/2 0 1) (list 1/2 1 1/2) (list 1/2 2 1/4) (list 1/2 3 1/8) (list 1/2 -1 2) 
	   (list 1/2 -2 4) (list 1/2 -3 8) (list 1/2 1/2 0.70710678118655) (list 1/2 1/3 0.7937005259841) 
	   (list 1/2 -1/2 1.414213562373095048801688724209698078569E0) (list 1/2 -1/3 1.259921049894873148607716059938123324722E0) 
	   (list 1/2 0.0 1.000E0) (list 1/2 1.0 5.000E-1) (list 1/2 2.0 2.500E-1) (list 1/2 -2.0 4.000E0) 
	   (list 1/2 1.000000000000000000000000000000000000002E-309 1.000E0) (list 1/2 1e+16 0.0) 
	   (list 1/2 inf.0 0.0) (list 1/2 0+1i 7.692389013639721265783299936612707014395E-1-6.389612763136348011500329114647017842567E-1i) 
	   (list 1/2 0+2i 1.83456974743301676839941236809235104518E-1-9.830277404112437205861648503427281526099E-1i) 
	   (list 1/2 0-1i 7.692389013639721265783299936612707014395E-1+6.389612763136348011500329114647017842567E-1i) 
	   (list 1/2 1+1i 3.846194506819860632891649968306353507197E-1-3.194806381568174005750164557323508921283E-1i) 
	   (list 1/2 1-1i 3.846194506819860632891649968306353507197E-1+3.194806381568174005750164557323508921283E-1i) 
	   (list 1/2 -1+1i 1.538477802727944253156659987322541402879E0-1.277922552627269602300065822929403568513E0i) 
	   (list 1/2 -1-1i 1.538477802727944253156659987322541402879E0+1.277922552627269602300065822929403568513E0i) 
	   (list 1/2 0.1+0.1i 9.307924962319322751032548220951692988141E-1-6.462114401999142796156052473887795907618E-2i) 
	   (list 1/2 1e+16+1e+16i 0.0) (list 1/2 1e-16+1e-16i 9.999999999999999306852819440054705071071E-1-6.931471805599452468836205299399646209468E-17i) 
	   (list 1/3 0 1) (list 1/3 1 1/3) (list 1/3 2 1/9) (list 1/3 3 1/27) (list 1/3 -1 3) 
	   (list 1/3 -2 9) (list 1/3 -3 27) (list 1/3 1/2 0.57735026918963) (list 1/3 1/3 0.69336127435063) 
	   (list 1/3 -1/2 1.732050807568877341601513501094972563495E0) (list 1/3 -1/3 1.442249570307408379689974332217791378498E0) 
	   (list 1/3 0.0 1.000E0) (list 1/3 1.0 3.333333333333333148296162562473909929395E-1) 
	   (list 1/3 2.0 1.111111111111110987752997263871498932361E-1) (list 1/3 -2.0 9.000000000000000999200722162640969581442E0) 
	   (list 1/3 1.000000000000000000000000000000000000002E-309 1.000E0) (list 1/3 1e+16 0.0) 
	   (list 1/3 inf.0 0.0) (list 1/3 0+1i 4.548324228266097055906083004905301340071E-1-8.905770416677470843231987149725161148001E-1i) 
	   (list 1/3 0+2i -5.862549342913522528634995341851693014879E-1-8.101266271509919037297800414810374565267E-1i) 
	   (list 1/3 0-1i 4.548324228266097055906083004905301340071E-1+8.905770416677470843231987149725161148001E-1i) 
	   (list 1/3 1+1i 1.516108076088698934474456306943980624137E-1-2.968590138892490116287472906226681453643E-1i) 
	   (list 1/3 1-1i 1.516108076088698934474456306943980624137E-1+2.968590138892490116287472906226681453643E-1i) 
	   (list 1/3 -1+1i 1.364497268479829192516639126693602447003E0-2.671731125003241401280466674231091613441E0i) 
	   (list 1/3 -1-1i 1.364497268479829192516639126693602447003E0+2.671731125003241401280466674231091613441E0i) 
	   (list 1/3 0.1+0.1i 8.905570151840088631186184238937353595899E-1-9.823321468210062916108146236871209771647E-2i) 
	   (list 1/3 1e+16+1e+16i 0.0) 
	   (list 1/3 1e-16+1e-16i 9.999999999999998901387711331890276057033E-1-1.098612288668109603248072021584861739285E-16i) 
	   (list -1/2 0 1) (list -1/2 1 -1/2) (list -1/2 2 1/4) (list -1/2 3 -1/8) (list -1/2 -1 -2) 
	   (list -1/2 -2 4) (list -1/2 -3 -8) (list -1/2 1/2 0+0.70710678118655i) (list -1/2 1/3 -0.7937005259841) 
	   (list -1/2 -1/2 0.0-1.414213562373095048801688724209698078569E0i) 
	   (list -1/2 -1/3 6.299605249474366377321206522758126486977E-1-1.09112363597172135294521532465807648133E0i) 
	   (list -1/2 0.0 1.000E0) (list -1/2 1.0 -5.00E-1) (list -1/2 2.0 2.500E-1) (list -1/2 -2.0 4.000E0) 
	   (list -1/2 1e+16 0.0) (list -1/2 inf.0 0.0)
	   (list -1/2 0+1i 3.324182700885665525901791766265082328307E-2-2.761202036833300995082465454051316449496E-2i) 
	   (list -1/2 0+2i 3.425953940655147934023229852954811989202E-4-1.835748008898304681163796172161682131024E-3i) 
	   (list -1/2 0-1i 1.780072097764048857359856955378859222048E1+1.478600649942216768260366593652156810413E1i) 
	   (list -1/2 1+1i -1.662091350442832762950895883132541164153E-2+1.380601018416650497541232727025658224748E-2i) 
	   (list -1/2 1-1i -8.900360488820244286799284776894296110238E0-7.393003249711083841301832968260784052065E0i) 
	   (list -1/2 -1+1i -6.648365401771331051803583532530164656613E-2+5.522404073666601990164930908102632898992E-2i) 
	   (list -1/2 -1-1i -3.560144195528097714719713910757718444095E1-2.957201299884433536520733187304313620826E1i) 
	   (list -1/2 0.1+0.1i 6.611643874791633083240145101585573999158E-1+1.651968853835831321053883592233542783317E-1i) 
	   (list -1/2 1e+16+1e+16i 0.0) 
	   (list -1/2 1e-16+1e-16i 9.999999999999996165260165850261967791906E-1+2.448445473029846938952343072863939318955E-16i) 
	   (list -1/3 0 1) (list -1/3 1 -1/3) (list -1/3 2 1/9) (list -1/3 3 -1/27) (list -1/3 -1 -3) 
	   (list -1/3 -2 9) (list -1/3 -3 -27) (list -1/3 1/2 0+0.57735026918963i) (list -1/3 1/3 -0.69336127435063) 
	   (list -1/3 -1/2 0.0-1.732050807568877341601513501094972563495E0i) 
	   (list -1/3 -1/3 7.211247851537042624522227702765802634347E-1-1.249024766483406435214284662923064132397E0i) 
	   (list -1/3 0.0 1.000E0) (list -1/3 1.0 -3.333333333333333148296162562473909929395E-1) 
	   (list -1/3 2.0 1.111111111111110987752997263871498932361E-1) (list -1/3 -2.0 9.000000000000000999200722162640969581442E0) 
	   (list -1/3 1e+16 0.0) (list -1/3 inf.0 0.0) 
	   (list -1/3 0+1i 1.965509114374261147472076343409745270744E-2-3.848532348622211562482881134707887874423E-2i) 
	   (list -1/3 0+2i -1.094797515970330336653213008135348071651E-3-1.512865081636227660355007437386042651667E-3i) 
	   (list -1/3 0-1i 1.052513729605287263760972225954207976974E1+2.060856958704319103202290360191646176391E1i) 
	   (list -1/3 1+1i -6.551697047914203461214675496548324731564E-3+1.282844116207403782948806637317477237465E-2i) 
	   (list -1/3 1-1i -3.508379098684290684449078029532994204954E0-6.869523195681063296005826865220406716345E0i) 
	   (list -1/3 -1+1i -5.896527343122783769739250113564997536121E-2+1.154559704586663532835802707239006768699E-1i) 
	   (list -1/3 -1-1i -3.15754118881586196656166312914556280733E1-6.182570876112957652808497982451530065146E1i) 
	   (list -1/3 0.1+0.1i 6.408011144159694212372342969009069525835E-1+1.327666945668531521695779387535105337549E-1i) 
	   (list -1/3 1e+16+1e+16i 0.0) 
	   (list -1/3 1e-16+1e-16i 9.999999999999995759795057742097793539085E-1+2.042980364921682582587891581219059394882E-16i) 
	   (list 0.0 0 0.0) (list 0.0 1 0.0) (list 0.0 2 0.0) (list 0.0 3 0.0) (list 0.0 1/2 0.0) 
	   (list 0.0 1/3 0.0) (list 0.0 0.0 0.0) (list 0.0 1.0 0.0) (list 0.0 2.0 0.0)
	   (list 0.0 1.000000000000000000000000000000000000002E-309 0.0) 
	   (list 0.0 1e+16 0.0) (list 0.0 inf.0 0.0) (list 0.0 0+1i 0.0) 
	   (list 0.0 0+2i 0.0) (list 0.0 0-1i 0.0) (list 0.0 1+1i 0.0) (list 0.0 1-1i 0.0) (list 0.0 0.1+0.1i 0.0) 
	   (list 0.0 1e+16+1e+16i 0.0) (list 0.0 1e-16+1e-16i 0.0) (list 1.0 0 1.0) (list 1.0 1 1.0) 
	   (list 1.0 2 1.0) (list 1.0 3 1.0) (list 1.0 -1 1.0) (list 1.0 -2 1.0) (list 1.0 -3 1.0) 
	   (list 1.0 1/2 1.0) (list 1.0 1/3 1.0) (list 1.0 -1/2 1.000E0) (list 1.0 -1/3 1.000E0) 
	   (list 1.0 0.0 1.000E0) (list 1.0 1.0 1.000E0) (list 1.0 2.0 1.000E0) (list 1.0 -2.0 1.000E0) 
	   (list 1.0 1.000000000000000000000000000000000000002E-309 1.000E0) (list 1.0 1e+16 1.000E0) 
	   (list 1.0 inf.0 1.000E0) (list 1.0 -inf.0 1.000E0) (list 1.0 0+1i 1) 
	   (list 1.0 0+2i 1) (list 1.0 0-1i 1) (list 1.0 1+1i 1) (list 1.0 1-1i 1) (list 1.0 -1+1i 1) 
	   (list 1.0 -1-1i 1) (list 1.0 0.1+0.1i 1) (list 1.0 1e+16+1e+16i 1) (list 1.0 1e-16+1e-16i 1) 
	   (list 2.0 0 1.0) (list 2.0 1 2.0) (list 2.0 2 4.000E0) (list 2.0 3 8.000E0) (list 2.0 -1 5.000E-1) 
	   (list 2.0 -2 2.500E-1) (list 2.0 -3 1.250E-1) (list 2.0 1/2 1.4142135623731) (list 2.0 1/3 1.2599210498949) 
	   (list 2.0 -1/2 7.071067811865475244008443621048490392845E-1) (list 2.0 -1/3 7.937005259840997475556964875637659160371E-1) 
	   (list 2.0 0.0 1.000E0) (list 2.0 1.0 2.000E0) (list 2.0 2.0 4.000E0) (list 2.0 -2.0 2.500E-1) 
	   (list 2.0 1.000000000000000000000000000000000000002E-309 1.000E0) (list 2.0 -inf.0 0.0) 
	   (list 2.0 0+1i 7.692389013639721265783299936612707014395E-1+6.389612763136348011500329114647017842567E-1i) 
	   (list 2.0 0+2i 1.83456974743301676839941236809235104518E-1+9.830277404112437205861648503427281526099E-1i) 
	   (list 2.0 0-1i 7.692389013639721265783299936612707014395E-1-6.389612763136348011500329114647017842567E-1i) 
	   (list 2.0 1+1i 1.538477802727944253156659987322541402879E0+1.277922552627269602300065822929403568513E0i) 
	   (list 2.0 1-1i 1.538477802727944253156659987322541402879E0-1.277922552627269602300065822929403568513E0i) 
	   (list 2.0 -1+1i 3.846194506819860632891649968306353507197E-1+3.194806381568174005750164557323508921283E-1i) 
	   (list 2.0 -1-1i 3.846194506819860632891649968306353507197E-1-3.194806381568174005750164557323508921283E-1i) 
	   (list 2.0 0.1+0.1i 1.069199809265204517687304849996528484166E0+7.423020183379063973209835788737470580225E-2i) 
	   (list 2.0 1e-16+1e-16i 1.00000000000000006931471805599452949289E0+6.931471805599453429742233135802455373554E-17i) 
	   (list -2.0 0 1.0) (list -2.0 1 -2.0) (list -2.0 2 4.000E0) (list -2.0 3 -8.00E0) 
	   (list -2.0 -1 -5.00E-1) (list -2.0 -2 2.500E-1) (list -2.0 -3 -1.25E-1) (list -2.0 1/2 0+1.4142135623731i) 
	   (list -2.0 1/3 -1.2599210498949) (list -2.0 -1/2 0.0-7.071067811865475244008443621048490392845E-1i) 
	   (list -2.0 -1/3 3.968502629920499137351498618341152884837E-1-6.873648184993012989383839761489500939792E-1i) 
	   (list -2.0 0.0 1.000E0) (list -2.0 1.0 -2.00E0) (list -2.0 2.0 4.000E0) (list -2.0 -2.0 2.500E-1) 
	   (list -2.0 -inf.0 0.0) (list -2.0 0+1i 3.324182700885665525901791766265082328307E-2+2.761202036833300995082465454051316449496E-2i) 
	   (list -2.0 0+2i 3.425953940655147934023229852954811989202E-4+1.835748008898304681163796172161682131024E-3i) 
	   (list -2.0 0-1i 1.780072097764048857359856955378859222048E1-1.478600649942216768260366593652156810413E1i) 
	   (list -2.0 1+1i -6.648365401771331051803583532530164656613E-2-5.522404073666601990164930908102632898992E-2i) 
	   (list -2.0 1-1i -3.560144195528097714719713910757718444095E1+2.957201299884433536520733187304313620826E1i) 
	   (list -2.0 -1+1i -1.662091350442832762950895883132541164153E-2-1.380601018416650497541232727025658224748E-2i) 
	   (list -2.0 -1-1i -8.900360488820244286799284776894296110238E0+7.393003249711083841301832968260784052065E0i) 
	   (list -2.0 0.1+0.1i 7.259699150688950609812198701314241029302E-1+2.928900391985359860022641767906842987898E-1i) 
	   (list -2.0 1e+16+1e+16i 0.0) 
	   (list -2.0 1e-16+1e-16i 9.999999999999997551554526970151686615297E-1+3.834739834149737528810186916384012655492E-16i) 
	   (list 1.000000000000000000000000000000000000002E-309 0 1.0) 
	   (list 1.000000000000000000000000000000000000002E-309 1 1.000000000000000000000000000000000000002E-309) 
	   (list 1.000000000000000000000000000000000000002E-309 2 1.000000000000000000000000000000000000006E-618) 
	   (list 1.000000000000000000000000000000000000002E-309 3 1.000000000000000000000000000000000000006E-927) 
	   (list 1.000000000000000000000000000000000000002E-309 1/2 3.162277660168379331998893544432718533725E-155) 
	   (list 1.000000000000000000000000000000000000002E-309 1/3 1.000000000000000000000000000000000000001E-103) 
	   (list 1.000000000000000000000000000000000000002E-309 -1/2 3.162277660168379331998893544432718533715E154) 
	   (list 1.000000000000000000000000000000000000002E-309 -1/3 9.999999999999868346276200367559315452517E102) 
	   (list 1.000000000000000000000000000000000000002E-309 0.0 1.000E0)
	   (list 1.000000000000000000000000000000000000002E-309 1.0 1.000000000000000000000000000000000000002E-309) 
	   (list 1.000000000000000000000000000000000000002E-309 2.0 1.000000000000000000000000000000000000006E-618) 
	   (list 1.000000000000000000000000000000000000002E-309 1.000000000000000000000000000000000000002E-309 1.000E0) 
	   (list 1.000000000000000000000000000000000000002E-309 1e+16 0.0) (list 1.000000000000000000000000000000000000002E-309 inf.0 0.0) 
	   (list 1.000000000000000000000000000000000000002E-309 0+1i 7.188026041688456386956035152151008205727E-2-9.974132684912512522858369772702724490842E-1i) 
	   (list 1.000000000000000000000000000000000000002E-309 0+2i -9.896664563248017162886921042023427507381E-1-1.433886509648142863446390724753118562651E-1i) 
	   (list 1.000000000000000000000000000000000000002E-309 0-1i 7.188026041688456386956035152151008205727E-2+9.974132684912512522858369772702724490842E-1i) 
	   (list 1.000000000000000000000000000000000000002E-309 1+1i 7.188026041688456386956035152151008205733E-311-9.974132684912512522858369772702724490883E-310i) 
	   (list 1.000000000000000000000000000000000000002E-309 1-1i 7.188026041688456386956035152151008205733E-311+9.974132684912512522858369772702724490883E-310i) 
	   (list 1.000000000000000000000000000000000000002E-309 0.1+0.1i -5.63455610426506242496256141630861088283E-32-1.125793483521731083006048050604051624164E-31i) 
	   (list 1.000000000000000000000000000000000000002E-309 1e+16+1e+16i 0.0) 
	   (list 1.000000000000000000000000000000000000002E-309 1e-16+1e-16i 9.999999999999288501206264839898510340166E-1-7.114987937351094784363111696637191907549E-14i) 
	   (list 1e+16 0 1.0) (list 1e+16 1 1e+16) (list 1e+16 2 1.000E32) (list 1e+16 3 1.000E48) 
	   (list 1e+16 -1 1.000000000000000000000000000000000000001E-16) (list 1e+16 -2 9.999999999999999999999999999999999999998E-33) 
	   (list 1e+16 -3 9.999999999999999999999999999999999999991E-49) (list 1e+16 1/2 100000000.0) 
	   (list 1e+16 1/3 215443.46900319) (list 1e+16 -1/2 9.99999999999999999999999999999999999999E-9) 
	   (list 1e+16 -1/3 4.641588833612782056591069448235278756067E-6) (list 1e+16 0.0 1.000E0) 
	   (list 1e+16 1.0 1.000E16) (list 1e+16 2.0 1.000E32) (list 1e+16 -2.0 9.999999999999999999999999999999999999998E-33) 
	   (list 1e+16 1.000000000000000000000000000000000000002E-309 1.000E0) (list 1e+16 -inf.0 0.0) 
	   (list 1e+16 0+1i 6.541406923671771082966425998087477095845E-1-7.563728938753623529733450264648351927405E-1i) 
	   (list 1e+16 0+2i -1.441999091787803208994630162235380065937E-1-9.895485769747898065837021120946943010267E-1i) 
	   (list 1e+16 0-1i 6.541406923671771082966425998087477095845E-1+7.563728938753623529733450264648351927405E-1i) 
	   (list 1e+16 1+1i 6.541406923671771082966425998087477095832E15-7.563728938753623529733450264648351927387E15i) 
	   (list 1e+16 1-1i 6.541406923671771082966425998087477095832E15+7.563728938753623529733450264648351927387E15i) 
	   (list 1e+16 -1+1i 6.541406923671771082966425998087477095825E-17-7.563728938753623529733450264648351927399E-17i) 
	   (list 1e+16 -1-1i 6.541406923671771082966425998087477095825E-17+7.563728938753623529733450264648351927399E-17i) 
	   (list 1e+16 0.1+0.1i -3.409382666305111714726686098434812471081E1-2.055490637125206804018448749591854294103E1i) 
	   (list 1e+16 1e-16+1e-16i 1.000000000000003684136148790473017422188E0+3.684136148790486590281349632497736627823E-15i) 
	   (list inf.0 0 1.0) (list inf.0 -1 0.0) (list inf.0 -2 0.0) 
	   (list inf.0 -3 0.0) (list inf.0 -1/2 0.0) (list inf.0 -1/3 0.0) (list inf.0 0.0 1.000E0) 
	   (list inf.0 -2.0 0.0) (list inf.0 -inf.0 0.0) (list inf.0 -1+1i 0.0) (list inf.0 -1-1i 0.0) 
	   (list -inf.0 0 1.0) (list -inf.0 -1 0.0) (list -inf.0 -2 0.0) (list -inf.0 -3 0.0) 
	   (list -inf.0 -1/2 0.0) (list -inf.0 -1/3 0.0) (list -inf.0 0.0 1.000E0) (list -inf.0 -2.0 0.0) 
	   (list -inf.0 -inf.0 0.0) (list -inf.0 -1+1i 0.0) (list -inf.0 -1-1i 0.0) (list 0+1i 0 1.0) 
	   (list 0+1i 1 0+1i) (list 0+1i 2 -1.00E0) (list 0+1i 3 0.0-1.00E0i) (list 0+1i -1 0.0-1.00E0i) 
	   (list 0+1i -2 -1.00E0) (list 0+1i -3 0.0+1.000E0i) (list 0+1i 1/2 0.70710678118655+0.70710678118655i) 
	   (list 0+1i 1/3 8.660254037844386612965085791222353988232E-1+4.999999999999999748284772972087582646907E-1i) 
	   (list 0+1i -1/2 7.071067811865475244008443621048490392845E-1-7.071067811865475244008443621048490392845E-1i) 
	   (list 0+1i -1/3 8.660254037844386612965085791222353988232E-1-4.999999999999999748284772972087582646907E-1i) 
	   (list 0+1i 0.0 1.000E0) (list 0+1i 1.0 0.0+1.000E0i) (list 0+1i 2.0 -1.00E0) (list 0+1i -2.0 -1.00E0) 
	   (list 0+1i 1.000000000000000000000000000000000000002E-309 1.000E0+1.570796326794896619231321691639751442098E-309i) 
					;(list 0+1i 1e+16 1.000E0) 
	   (list 0+1i 0+1i 2.078795763507619085469556198349787700342E-1) 
	   (list 0+1i 0+2i 4.321391826377224977441773717172801127579E-2) (list 0+1i 0-1i 4.810477380965351655473035666703833126401E0) 
	   (list 0+1i 1+1i 0.0+2.078795763507619085469556198349787700342E-1i) (list 0+1i 1-1i 0.0+4.810477380965351655473035666703833126401E0i) 
	   (list 0+1i -1+1i 0.0-2.078795763507619085469556198349787700342E-1i) (list 0+1i -1-1i 0.0-4.810477380965351655473035666703833126401E0i) 
	   (list 0+1i 0.1+0.1i 8.441140118165246481415723784169170682829E-1+1.336945253316592796595429310740609657101E-1i) 
	   (list 0+1i 1e+16+1e+16i 0.0) (list 0+1i 1e-16+1e-16i 9.999999999999998429203673205103413601794E-1+1.570796326794896339658091828635841709635E-16i) 
	   (list 0+2i 0 1.0) (list 0+2i 1 0+2i) (list 0+2i 2 -4.00E0) (list 0+2i 3 0.0-8.00E0i) 
	   (list 0+2i -1 0.0-5.00E-1i) (list 0+2i -2 -2.50E-1) (list 0+2i -3 0.0+1.250E-1i) 
	   (list 0+2i 1/2 1+1i) (list 0+2i 1/3 1.09112363597172140787570207348670009638E0+6.299605249474365425897267188156853709001E-1i) 
	   (list 0+2i -1/2 5.000E-1-5.00E-1i) (list 0+2i -1/3 6.873648184993013335424222440592397343418E-1-3.968502629920498537991974347557662898919E-1i) 
	   (list 0+2i 0.0 1.000E0) (list 0+2i 1.0 0.0+2.000E0i) (list 0+2i 2.0 -4.00E0) (list 0+2i -2.0 -2.50E-1) 
	   (list 0+2i 1.000000000000000000000000000000000000002E-309 1.000E0+1.570796326794896619231321691639751442098E-309i) 
	   (list 0+2i -inf.0 0.0) (list 0+2i 0+1i 1.599090569280680525199117755445296515815E-1+1.328269994246205222492823642245871455648E-1i) 
	   (list 0+2i 0+2i 7.927894711475968677072935966913922424434E-3+4.248048042515221109836149914964543748435E-2i) 
	   (list 0+2i 0-1i 3.700406335570025108741522919010577122043E0-3.073708767019492322385562434551223151799E0i) 
	   (list 0+2i 1+1i -2.656539988492410444985647284491742911296E-1+3.19818113856136105039823551089059303163E-1i) 
	   (list 0+2i 1-1i 6.147417534038984644771124869102446303599E0+7.400812671140050217483045838021154244087E0i) 
	   (list 0+2i -1+1i 6.641349971231026112464118211229357278239E-2-7.995452846403402625995588777226482579074E-2i) 
	   (list 0+2i -1-1i -1.5368543835097461611927812172756115759E0-1.850203167785012554370761459505288561022E0i) 
	   (list 0+2i 0.1+0.1i 8.926023688328728424160522546503419745435E-1+2.056049144522835172454080598405456305612E-1i) 
	   (list 0+2i 1e+16+1e+16i 0.0) (list 0+2i 1e-16+1e-16i 9.999999999999999122350853765048490772098E-1+2.263943507354841682632315142216062597333E-16i) 
	   (list 0-1i 0 1.0) (list 0-1i 1 0-1i) (list 0-1i 2 -1.00E0) (list 0-1i 3 0.0+1.000E0i) 
	   (list 0-1i -1 0.0+1.000E0i) (list 0-1i -2 -1.00E0) (list 0-1i -3 0.0-1.00E0i) (list 0-1i 1/2 0.70710678118655-0.70710678118655i) 
	   (list 0-1i 1/3 8.660254037844386612965085791222353988232E-1-4.999999999999999748284772972087582646907E-1i) 
	   (list 0-1i -1/2 7.071067811865475244008443621048490392845E-1+7.071067811865475244008443621048490392845E-1i) 
	   (list 0-1i -1/3 8.660254037844386612965085791222353988232E-1+4.999999999999999748284772972087582646907E-1i) 
	   (list 0-1i 0.0 1.000E0) (list 0-1i 1.0 0.0-1.00E0i) (list 0-1i 2.0 -1.00E0) (list 0-1i -2.0 -1.00E0) 
	   (list 0-1i 1.000000000000000000000000000000000000002E-309 1.000E0-1.570796326794896619231321691639751442098E-309i) 
					;(list 0-1i 1e+16 1.000E0)
	   (list 0-1i 0+1i 4.810477380965351655473035666703833126401E0) 
	   (list 0-1i 0+2i 2.314069263277926900572908636794854738031E1) (list 0-1i 0-1i 2.078795763507619085469556198349787700342E-1) 
	   (list 0-1i 1+1i 0.0-4.810477380965351655473035666703833126401E0i) (list 0-1i 1-1i 0.0-2.078795763507619085469556198349787700342E-1i) 
	   (list 0-1i -1+1i 0.0+4.810477380965351655473035666703833126401E0i) (list 0-1i -1-1i 0.0+2.078795763507619085469556198349787700342E-1i) 
	   (list 0-1i 0.1+0.1i 1.15568305287131774105188044357174956096E0-1.830422135215751576397991439148491080012E-1i) 
	   (list 0-1i 1e-16+1e-16i 1.000000000000000157079632679489658639818E0-1.570796326794896833138311883103752021701E-16i) 
	   (list 1+1i 0 1.0) (list 1+1i 1 1+1i) (list 1+1i 2 0.0+2.000E0i) (list 1+1i 3 -2.00E0+2.000E0i) 
	   (list 1+1i -1 5.000E-1-5.00E-1i) (list 1+1i -2 0.0-5.00E-1i) (list 1+1i -3 -2.50E-1-2.50E-1i) 
	   (list 1+1i 1/2 1.0986841134678+0.45508986056223i) 
	   (list 1+1i 1/3 1.084215081491351179148689172984121435876E0+2.905145555072514268841073782856571173254E-1i) 
	   (list 1+1i -1/2 7.768869870150186536720794765315734740815E-1-3.217971264527913123677217187091049044625E-1i) 
	   (list 1+1i -1/3 8.605420804595790018414012402960957705697E-1-2.305815555121423995608566442452670487351E-1i) 
	   (list 1+1i 0.0 1.000E0) (list 1+1i 1.0 1.000E0+1.000E0i) (list 1+1i 2.0 0.0+2.000E0i) 
	   (list 1+1i -2.0 0.0-5.00E-1i)
	   (list 1+1i 1.000000000000000000000000000000000000002E-309 1.000E0+7.853981633974483096156608458198757210488E-310i) 
	   (list 1+1i -inf.0 0.0) (list 1+1i 0+1i 4.288290062943678493226520070973354996125E-1+1.548717524642467781923098896798325813036E-1i) 
	   (list 1+1i 0+2i 1.599090569280680525199117755445296515815E-1+1.328269994246205222492823642245871455648E-1i) 
	   (list 1+1i 0-1i 2.062872235080904951706990637170143171029E0-7.450070621797240878593548325920103204625E-1i) 
	   (list 1+1i 1+1i 2.739572538301210711303421174175029183081E-1+5.837007587586146275149618967771680809154E-1i) 
	   (list 1+1i 1-1i 2.807879297260629039566345469762153491497E0+1.317865172901180863847635804578132850572E0i) 
	   (list 1+1i -1+1i 2.918503793793073137574809483885840404577E-1-1.369786269150605355651710587087514591541E-1i) 
	   (list 1+1i -1-1i 6.589325864505904319238179022890664252861E-1-1.403939648630314519783172734881076745749E0i) 
	   (list 1+1i 0.1+0.1i 9.509412581367732262071184402582209392577E-1+1.08106001655210286400223506650660553711E-1i) 
	   (list 1+1i 1e+16+1e+16i 0.0) (list 1+1i 1e-16+1e-16i 9.99999999999999956117542688252429982572E-1+1.131971753677420890989859729961488955736E-16i) 
	   (list 1-1i 0 1.0) (list 1-1i 1 1-1i) (list 1-1i 2 0.0-2.00E0i) (list 1-1i 3 -2.00E0-2.00E0i) 
	   (list 1-1i -1 5.000E-1+5.000E-1i) (list 1-1i -2 0.0+5.000E-1i) (list 1-1i -3 -2.50E-1+2.500E-1i) 
	   (list 1-1i 1/2 1.0986841134678-0.45508986056223i)
	   (list 1-1i 1/3 1.084215081491351179148689172984121435876E0-2.905145555072514268841073782856571173254E-1i) 
	   (list 1-1i -1/2 7.768869870150186536720794765315734740815E-1+3.217971264527913123677217187091049044625E-1i) 
	   (list 1-1i -1/3 8.605420804595790018414012402960957705697E-1+2.305815555121423995608566442452670487351E-1i) 
	   (list 1-1i 0.0 1.000E0) (list 1-1i 1.0 1.000E0-1.00E0i) (list 1-1i 2.0 0.0-2.00E0i) 
	   (list 1-1i -2.0 0.0+5.000E-1i) 
	   (list 1-1i 1.000000000000000000000000000000000000002E-309 1.000E0-7.853981633974483096156608458198757210488E-310i) 
	   (list 1-1i -inf.0 0.0) (list 1-1i 0+1i 2.062872235080904951706990637170143171029E0+7.450070621797240878593548325920103204625E-1i) 
	   (list 1-1i 0+2i 3.700406335570025108741522919010577122043E0+3.073708767019492322385562434551223151799E0i) 
	   (list 1-1i 0-1i 4.288290062943678493226520070973354996125E-1-1.548717524642467781923098896798325813036E-1i) 
	   (list 1-1i 1+1i 2.807879297260629039566345469762153491497E0-1.317865172901180863847635804578132850572E0i) 
	   (list 1-1i 1-1i 2.739572538301210711303421174175029183081E-1-5.837007587586146275149618967771680809154E-1i) 
	   (list 1-1i -1+1i 6.589325864505904319238179022890664252861E-1+1.403939648630314519783172734881076745749E0i) 
	   (list 1-1i -1-1i 2.918503793793073137574809483885840404577E-1+1.369786269150605355651710587087514591541E-1i) 
	   (list 1-1i 0.1+0.1i 1.118774658142734663065880800594211744947E0-4.912611879174141197780391086654035970153E-2i) 
	   (list 1-1i 1e-16+1e-16i 1.000000000000000113197175367742099510321E0-4.388245731174756954083421259082963337401E-17i) 
	   (list -1+1i 0 1.0) (list -1+1i 1 -1+1i) (list -1+1i 2 0.0-2.00E0i) (list -1+1i 3 2.000E0+2.000E0i) 
	   (list -1+1i -1 -5.00E-1-5.00E-1i) (list -1+1i -2 0.0+5.000E-1i) (list -1+1i -3 2.500E-1-2.50E-1i) 
	   (list -1+1i 1/2 0.45508986056223+1.0986841134678i) 
	   (list -1+1i 1/3 7.937005259840997668899692535826356354889E-1+7.937005259840996976818927177620594283082E-1i) 
	   (list -1+1i -1/2 3.217971264527913123677217187091049044625E-1-7.768869870150186536720794765315734740815E-1i) 
	   (list -1+1i -1/3 6.299605249474366138887223148884515164688E-1-6.299605249474365589582355660598282273075E-1i) 
	   (list -1+1i 0.0 1.000E0) (list -1+1i 1.0 -1.00E0+1.000E0i) (list -1+1i 2.0 0.0-2.00E0i) 
	   (list -1+1i -2.0 0.0+5.000E-1i) 
	   (list -1+1i 1.000000000000000000000000000000000000002E-309 1.000E0+2.35619449019234492884698253745962716315E-309i) 
	   (list -1+1i -inf.0 0.0) (list -1+1i 0+1i 8.914479215539140039333169785416699948907E-2+3.219467429096768688435430339284927790439E-2i) 
	   (list -1+1i 0+2i 6.910296915726436425237112293342453374671E-3+5.7399750963576748986151091014202337188E-3i) 
	   (list -1+1i 0-1i 9.923400226678132867281183645053121674554E0-3.583839621275010020102858511593195855531E0i) 
	   (list -1+1i 1+1i -1.213394664463590872776860012470162773935E-1+5.695011786442371350897739446131772158468E-2i) 
	   (list -1+1i 1-1i -6.339560605403122847178325133459925819034E0+1.350723984795314288738404215664631753007E1i) 
	   (list -1+1i -1+1i -2.847505893221185675448869723065886079234E-2-6.066973322317954363884300062350813869673E-2i) 
	   (list -1+1i -1-1i -6.753619923976571443692021078323158765037E0-3.169780302701561423589162566729962909517E0i) 
	   (list -1+1i 0.1+0.1i 7.882496598308880991233017323974702727041E-1+2.1838943088351018304792416348997040808E-1i) 
	   (list -1+1i 1e+16+1e+16i 0.0) 
	   (list -1+1i 1e-16+1e-16i 9.999999999999997990379100087627604548201E-1+2.702768080472316983907841531363385588262E-16i) 
	   (list -1-1i 0 1.0) (list -1-1i 1 -1-1i) (list -1-1i 2 0.0+2.000E0i) (list -1-1i 3 2.000E0-2.00E0i) 
	   (list -1-1i -1 -5.00E-1+5.000E-1i) (list -1-1i -2 0.0-5.00E-1i) (list -1-1i -3 2.500E-1+2.500E-1i) 
	   (list -1-1i 1/2 0.45508986056223-1.0986841134678i) 
	   (list -1-1i 1/3 7.937005259840997668899692535826356354889E-1-7.937005259840996976818927177620594283082E-1i) 
	   (list -1-1i -1/2 3.217971264527913123677217187091049044625E-1+7.768869870150186536720794765315734740815E-1i) 
	   (list -1-1i -1/3 6.299605249474366138887223148884515164688E-1+6.299605249474365589582355660598282273075E-1i) 
	   (list -1-1i 0.0 1.000E0) (list -1-1i 1.0 -1.00E0-1.00E0i) (list -1-1i 2.0 0.0+2.000E0i) 
	   (list -1-1i -2.0 0.0-5.00E-1i) (list -1-1i 1.000000000000000000000000000000000000002E-309 1.000E0-2.35619449019234492884698253745962716315E-309i) 
	   (list -1-1i -inf.0 0.0) (list -1-1i 0+1i 9.923400226678132867281183645053121674554E0+3.583839621275010020102858511593195855531E0i) 
	   (list -1-1i 0+2i 8.562996562781501151982322359385576132148E1+7.112774982027701655978420905114385775416E1i) 
	   (list -1-1i 0-1i 8.914479215539140039333169785416699948907E-2-3.219467429096768688435430339284927790439E-2i) 
	   (list -1-1i 1+1i -6.339560605403122847178325133459925819034E0-1.350723984795314288738404215664631753007E1i) 
	   (list -1-1i 1-1i -1.213394664463590872776860012470162773935E-1-5.695011786442371350897739446131772158468E-2i) 
	   (list -1-1i -1+1i -6.753619923976571443692021078323158765037E0+3.169780302701561423589162566729962909517E0i) 
	   (list -1-1i -1-1i -2.847505893221185675448869723065886079234E-2+6.066973322317954363884300062350813869673E-2i) 
	   (list -1-1i 0.1+0.1i 1.283956758872096257591990187677552600208E0-2.615572127992484175251616566885584992446E-1i) 
	   (list -1-1i 1e-16+1e-16i 1.000000000000000270276808047231769038073E0-2.009620899912372775286764036246047795846E-16i) 
	   (list 0.1+0.1i 0 1.0) (list 0.1+0.1i 1 0.1+0.1i) (list 0.1+0.1i 2 0.0+2.000000000000000222044604925031314247702E-2i) 
	   (list 0.1+0.1i 3 -2.000000000000000333066907387546980616012E-3+2.000000000000000333066907387546980616012E-3i) 
	   (list 0.1+0.1i -1 4.999999999999999722444243843710880301532E0-4.999999999999999722444243843710880301532E0i) 
	   (list 0.1+0.1i -2 0.0-4.999999999999999444888487687421776010503E1i) 
	   (list 0.1+0.1i -3 -2.499999999999999583666365765566343563457E2-2.499999999999999583666365765566343563457E2i) 
	   (list 0.1+0.1i 1/2 0.34743442276012+0.14391204994251i) 
	   (list 0.1+0.1i 1/3 5.032480615484825043523903544407412355396E-1+1.348449116844438143505188591437346924604E-1i) 
	   (list 0.1+0.1i -1/2 2.45673236351311521671469493547019420871E0-1.017611864088040968689409531603674348818E0i) 
	   (list 0.1+0.1i -1/3 1.853981710374325315321217484547221353494E0-4.967729020768720696346827580207236635648E-1i) 
	   (list 0.1+0.1i 0.0 1.000E0) (list 0.1+0.1i 1.0 1.000000000000000055511151231257827021182E-1+1.000000000000000055511151231257827021182E-1i) 
	   (list 0.1+0.1i 2.0 0.0+2.000000000000000222044604925031314247702E-2i) (list 0.1+0.1i -2.0 0.0-4.999999999999999444888487687421776010503E1i) 
	   (list 0.1+0.1i 1.000000000000000000000000000000000000002E-309 1.000E0+7.853981633974483096156608458198757210488E-310i) 
	   (list 0.1+0.1i 1e+16 0.0) (list 0.1+0.1i inf.0 0.0)
	   (list 0.1+0.1i 0+1i -1.713226510357599956083331913106303247236E-1-4.22525887482460786856087271691853977193E-1i) 
	   (list 0.1+0.1i 0+2i -1.491766748349203175549260651566533449245E-1+1.447765103494648437770214174856742113327E-1i) 
	   (list 0.1+0.1i 0-1i -8.241437376545436347801862567004657850891E-1+2.032551224606688826869616254728598600103E0i) 
	   (list 0.1+0.1i 1+1i 2.512032364467008051923349285554493285946E-2-5.938485385182208154296364931488770060654E-2i) 
	   (list 0.1+0.1i 1-1i -2.856694962261232620228228583084710444815E-1+1.208407486952145259169520755212883935691E-1i) 
	   (list 0.1+0.1i -1+1i -2.969242692591103747496022164280467138525E0-1.256016182233503886515866161034993752114E0i) 
	   (list 0.1+0.1i -1-1i 6.042037434760725625046696204216927090118E0+1.428347481130616151535688219886713564214E1i) 
	   (list 0.1+0.1i 0.1+0.1i 7.550220306566742029451631510549876832316E-1-8.878982993466537268563019824356751882119E-2i) 
	   (list 0.1+0.1i 1e+16+1e+16i 0.0) 
	   (list 0.1+0.1i 1e-16+1e-16i 9.999999999999997258590333888479081137213E-1-1.170613339316624318801081266623392933101E-16i) 
	   (list 1e+16+1e+16i 0 1.0) (list 1e+16+1e+16i 1 1e+16+1e+16i) (list 1e+16+1e+16i 2 0.0+2.000E32i) 
	   (list 1e+16+1e+16i 3 -2.00E48+2.000E48i) 
	   (list 1e+16+1e+16i -1 5.000000000000000000000000000000000000004E-17-5.000000000000000000000000000000000000004E-17i) 
	   (list 1e+16+1e+16i -2 0.0-4.999999999999999999999999999999999999999E-33i) 
	   (list 1e+16+1e+16i -3 -2.499999999999999999999999999999999999998E-49-2.499999999999999999999999999999999999998E-49i) 
	   (list 1e+16+1e+16i 1/2 109868411.34678+45508986.056223i)
	   (list 1e+16+1e+16i 1/3 2.335870583020711134947889498537726801442E5+6.258946363440152792122310286091229534238E4i) 
	   (list 1e+16+1e+16i -1/2 7.76886987015018653672079476531573474081E-9-3.217971264527913123677217187091049044617E-9i) 
	   (list 1e+16+1e+16i -1/3 3.994282511515094148675512812353991597295E-6-1.070264773302225997506194769200154785053E-6i) 
	   (list 1e+16+1e+16i 0.0 1.000E0) (list 1e+16+1e+16i 1.0 1.000E16+1.000E16i) (list 1e+16+1e+16i 2.0 0.0+2.000E32i) 
	   (list 1e+16+1e+16i -2.0 0.0-4.999999999999999999999999999999999999999E-33i) 
	   (list 1e+16+1e+16i 1.000000000000000000000000000000000000002E-309 1.000E0+7.853981633974483096156608458198757210488E-310i) 
	   (list 1e+16+1e+16i -inf.0 0.0) 
	   (list 1e+16+1e+16i 0+1i 3.97655298675457451476815297378330384373E-1-2.23046721083486532799277949440696753733E-1i) 
	   (list 1e+16+1e+16i 0+2i 1.083798967785726369788640263558841648425E-1-1.773914209820705797251910148995630479122E-1i) 
	   (list 1e+16+1e+16i 0-1i 1.912911819699309232365644880468914363155E0+1.072961206670599579011330828139081101248E0i) 
	   (list 1e+16+1e+16i 1+1i 6.207020197589439842760932468190271381067E15+1.746085775919709186775373479376336306396E15i) 
	   (list 1e+16+1e+16i 1-1i 8.39950613028709653354314052329833261908E15+2.985873026369908811376975708607995464407E16i) 
	   (list 1e+16+1e+16i -1+1i 8.730428879598545933876867396881681532013E-18-3.103510098794719921380466234095135690525E-17i) 
	   (list 1e+16+1e+16i -1-1i 1.492936513184954405688487854303997732202E-16-4.19975306514354826677157026164916630953E-17i) 
	   (list 1e+16+1e+16i 0.1+0.1i -3.019911767946562559553699791129052056384E1-2.323225580723027414176687762549620584343E1i) 
	   (list 1e+16+1e+16i 1e-16+1e-16i 1.000000000000003640253691478724868702006E0+3.797333324158228934745194038802400084708E-15i) 
	   (list 1e-16+1e-16i 0 1.0) (list 1e-16+1e-16i 1 1e-16+1e-16i) (list 1e-16+1e-16i 2 0.0+1.999999999999999916391146896138415121169E-32i) 
	   (list 1e-16+1e-16i 3 -1.999999999999999874586720344207623992465E-48+1.999999999999999874586720344207623992465E-48i) 
	   (list 1e-16+1e-16i -1 5.000000000000000104511066379826984375319E15-5.000000000000000104511066379826984375319E15i) 
	   (list 1e-16+1e-16i -2 0.0-5.00000000000000020902213275965397093513E31i) 
	   (list 1e-16+1e-16i -3 -2.500000000000000156766599569740479839725E47-2.500000000000000156766599569740479839725E47i) 
	   (list 1e-16+1e-16i 1/2 1.0986841134678e-08+4.5508986056223e-09i) 
	   (list 1e-16+1e-16i 1/3 5.032480615484828131577934532998162284517E-6+1.348449116844438970946772378503363059943E-6i) 
	   (list 1e-16+1e-16i -1/2 7.768869870150186617914082234866133300043E7-3.217971264527913157308578030636299721171E7i) 
	   (list 1e-16+1e-16i -1/3 1.853981710374324177672385518009559821262E5-4.967729020768717648025969623769604859166E4i) 
	   (list 1e-16+1e-16i 0.0 1.000E0) (list 1e-16+1e-16i 1.0 9.999999999999999790977867240346035618411E-17+9.999999999999999790977867240346035618411E-17i) 
	   (list 1e-16+1e-16i 2.0 0.0+1.999999999999999916391146896138415121169E-32i) (list 1e-16+1e-16i -2.0 0.0-5.00000000000000020902213275965397093513E31i) 
	   (list 1e-16+1e-16i 1.000000000000000000000000000000000000002E-309 1.000E0+7.853981633974483096156608458198757210488E-310i) 
	   (list 1e-16+1e-16i 1e+16 0.0) (list 1e-16+1e-16i inf.0 0.0) 
	   (list 1e-16+1e-16i 0+1i 1.633737074935952277071942452600366041402E-1+4.256625518536474393286932017574035701805E-1i) 
	   (list 1e-16+1e-16i 0+2i -1.544976397503562816275493845355474590488E-1+1.390841384750302156856253710476447606724E-1i) 
	   (list 1e-16+1e-16i 0-1i 7.859055245423894167511168257029299588438E-1-2.047640077615962126490396474363177248838E0i) 
	   (list 1e-16+1e-16i 1+1i -2.622888443600522061390815917770620324788E-17+5.890362593472426547237259268645081580369E-17i) 
	   (list 1e-16+1e-16i 1-1i 2.833545602158351484014138796578448096738E-16-1.26173455307357268336623492266154970137E-16i) 
	   (list 1e-16+1e-16i -1+1i 2.945181296736213396740244835851862239781E15+1.311444221800261085519581606088360070987E15i) 
	   (list 1e-16+1e-16i -1-1i -6.308672765367863680561621873294727149409E15-1.416772801079175801234443901776883778303E16i) 
	   (list 1e-16+1e-16i 0.1+0.1i -2.185846675892145203322615268234771243738E-2+1.000746379588156995072970612624735653063E-2i) 
	   (list 1e-16+1e-16i 1e+16+1e+16i 0.0) 
	   (list 1e-16+1e-16i 1e-16+1e-16i 9.999999999999962719813938977799891729155E-1-3.570938973422717612919117771011138615376E-15i) 
	     )))
    
;; there's a difference here between gmp/non-gmp:
; (test (expt 0 (real-part (log 0))) (expt 0.0 (real-part (log 0)))) 
; (num-test (expt 1.0 (/ (real-part (log 0)) (real-part (log 0)))) (expt 1 (/ (real-part (log 0)) (real-part (log 0)))))
; (num-test (expt 0.0 (/ (real-part (log 0)) (real-part (log 0)))) (expt 0 (/ (real-part (log 0)) (real-part (log 0)))))

#|
(let ((eps 1e-7))
  (do ((i 0 (+ i 1)))
      ((= i 1000))
    (let ((val (- (random 1000.0) 500.0)))
      (let ((rval (rationalize val))
	    (ival (floor val)))
	(let ((frval (exact->inexact rval))
	      (fival (exact->inexact ival)))
	  (for-each
	   (lambda (e)
	     (if (> (magnitude (- (expt rval e) (expt frval e))) eps)
		 (format #t "~A: ;(expt ~A e) != (expt ~A e) -> ~A~%" e rval frval (magnitude (- (expt rval e) (expt frval e)))))
	     (if (> (magnitude (- (expt ival e) (expt fival e))) eps)
		 (format #t "~A ;(expt ~A e) != (expt ~A e) -> ~A~%" e ival fival (magnitude (- (expt ival e) (expt fival e))))))
	   (list 0 0.0 (log 0) (real-part (log 0)) (- (real-part (log 0))))))))))
|#

  ;; table[(1/10^k)/(((1/10^k)^(1/10^k)) - 1), {k, 1, 30}]
  ;;   the test came from calc_errors.txt from the web by "dave"
  (let ((expts (list
		-0.48621160938616180680870317336747983548142173621715706851490974881717
		-0.22218561601345857583044966876729715619642038672598556073380084629504
		-0.14526540294689938889864991134840220307566223888497162784858064408875
		-0.10862362815109649171007844591526444220973735508130191198062253212652
		-0.08686389647659141105044978528770239308857034812798554177686261943193
		-0.07238291365169326382168151357331039782973682143307349669152489742891
		-0.06204211884333512141082278643490234288550259196615819050849846987015
		-0.05428681523790663196206398113420109019962541643547760927657854324749
		-0.04825494293369464924373092184737925979664303236414611590980578553450
		-0.04342944824032518278430110099994422226122739720915846151097610557365
		-0.03948131654165925705940460838351885560840418164027583205682137097699
		-0.03619120682577098563759637916147675090355043511246085981138602579761
		-0.03340726783876167905008686486133377017608955166698061593202699553920
		-0.03102103442166584483222349447696386196557178259759899539894506586562
		-0.02895296546021728851007526126398523685253569082526692705926181546848
		-0.02714340511895328922819555743231851877797306680518273360154914602559
		-0.02554673422960305368536052464215356633451937057629542604571806752914
		-0.02412747121684732425839605105092250802578858425793889081112350331353
		-0.02285760431069746466321731152192658331511007129540571803806313398860
		-0.02171472409516259138755644594583025411510361447234900258639235440074
		-0.02068068961444056322198232947221928963307055360980162368063530687389
		-0.01974065826832962852964676904166386737701808793240851850210059107980
		-0.01888236877840225337614103995289587314323465286757518193028428290776
		-0.01809560341263549281879753828819187842893320857975794377409033233328
		-0.01737177927613007310604520675666420329177588023219463316734886061171
		-0.01670363391935583952504342495833096470363065406937228989783888395986
		-0.01608498081123154917226403453394833638127396317791358170357400676126
		-0.01551051721083042241611174715416446722479989306441666312924319204483
		-0.01497567178976730440176306617453810628601368985529884710795141610434
		-0.01447648273010839425503763063105350274314656686012221887048754923492)))
    (let ((happy #t))
      (do ((i 1 (+ i 1))) 
	  ((or (= i (length expts))
	       (not happy)))
	(catch #t
	       (lambda ()
		 (let ((val (/ (expt .1 i)
			       (- (expt (expt .1 i) (expt .1 i)) 1))))
		   (if (> (abs (- val (list-ref expts (- i 1)))) 1e-6)
		       (begin
			 (set! happy #f)
                         (if (or with-bignums (< (abs (log (expt .1 i) 2)) 46))
			     (begin (display "expt error > 1e-6 around 2^") (display (log (expt .1 i) 2)) (newline)))))))
	       (lambda args 
		 (display "expt not accurate below around 2^") (display (/ (log (expt .1 i)) (log 2))) (newline))))))

(test (expt) 'error)
(test (expt 1) 'error)
(test (expt 1.0+23.0i) 'error)
(test (expt "hi" "hi") 'error)
(test (expt 1.0+23.0i 1.0+23.0i 1.0+23.0i) 'error)
(test (expt #t 0) 'error)
(test (expt 0 -1) 'error)
(test (expt 0 -1/4) 'error)
(test (expt 0.0 -1.0) 'error)
(test (expt 0.0 -0.1) 'error)
(test (expt 0 -1.0) 'error)
(test (expt 0 -1.0+i) 'error)

(when (not with-bignums)
  (test (nan? (expt 0 0+0/0i)) #t)
  (test (nan? (expt 0 0-0/0i)) #t)
  (test (nan? (expt 0 0/0+i)) #t)
  (test (nan? (expt 0 nan.0)) #t))
(for-each
 (lambda (arg)
   (test (expt arg nan.0) 'error)
   (test (expt nan.0 arg) 'error)
   (test (expt arg inf.0) 'error)
   (test (expt inf.0 arg) 'error)
   (test (expt arg 2) 'error)
   (test (expt 2 arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))





;;; --------------------------------------------------------------------------------
  
(let ((f= (lambda (a b) (< (abs (- a b)) 1.0e-15))))
  (let ((log2 0.69314718055994530941723212145817656807550013436025525412068000949339362196969471560586332699641868754200148102057068573368552023575813055703267075163507596193072757082837143519030703862389167347112335011536449795523912047517268157493206515552473413952588295045300709532636664265410423915781495204374043038550080194417064167151864471283996817178454695702627163106454615025720740248163777338963855069526066834113727387372292895649354702576265209885969320196505855476470330679365443254763274495125040606943814710468994650622016772042452452961268794654619316517468139267250410380254625965686914419287160829380317271436778265487756648508567407764845146443994046142260319309673540257444607030809608504748663852313818167675143866747664789088143714198549423151997354880375165861275352916610007105355824987941472950929311389715599820565439287170007218085761025236889213244971389320378439353088774825970171559107088236836275898425891853530243634214367061189236789192372314672321720534016492568727477823445353476481149418642386776774406069562657379600867076257199184734022651462837904883062033061144630073719489002743643965002580936519443041191150608094879306786515887090060520346842973619384128965255653968602219412292420757432175748909770675268711581705113700915894266547859596489065305846025866838294002283300538207400567705304678700184162404418833232798386349001563121889560650553151272199398332030751408426091479001265168243443893572472788205486271552741877243002489794540196187233980860831664811490930667519339312890431641370681397776498176974868903887789991296503619270710889264105230924783917373501229842420499568935992206602204654941510613918788574424557751020683703086661948089641218680779020818158858000168811597305618667619918739520076671921459223672060253959543654165531129517598994005600036651356756905124592682574394648316833262490180382424082423145230614096380570070255138770268178516306902551370323405380214501901537402950994226299577964742713815736380172987394070424217997226696297993931270694)
	
	(log3 1.09861228866810969139524523692252570464749055782274945173469433363749429321860896687361575481373208878797002906595786574236800422593051982105280187076727741060316276918338136717937369884436095990374257031679591152114559191775067134705494016677558022220317025294689756069010652150564286813803631737329857778236699165479213181814902003010382363012224865274819822599109745249089645805346700884596508574844411901885708764749486707961308582941160216612118400140982551439194876889367984943022557315353296853452952514592138764946859325627944165569415782723103551688661021184698904399430631382552857364668828249881368228006341439107868932514564375102044516275619349739821169415857405353617589009751222337977369696877543547951357129821770175812421223514058101632724655889372495649191852429607966842346470693772372526550820320783339280558928531468730951326064583091843974968222303257654675333118230196492752575991322178513533902374829643395025460742458249346668661218814365265654295427676105054777954229339733234011737431939745798470185595484940594783539438410106029307622922281312074893063445340252777326856271480016818715472439782071878034446780216178158419042820076721243255738014364178876826161041016818724240687908909929874208152183237528942752732534071002835750695062403965462752244308462588450859786253083224774538885068003488324340490083990058080943565282122370388702036804548600776214244088697259413584365999226211739670804950952792714363154640444623089158185367119608370304853520909672629582415040355995121355450332241748474100331981487832452569334704949937301656336660991903957122822844881674312150628569993874038819012744839564791034772885972119850649422796985791669956418551265041502191554719665856929726606523573293736830027830921776605387030462007661584946700226011756797518003934791763277844935142634968360037557857160700498181519184373438290934746660457750659273670121115370582496479847930404205823964753857850960626093389914706120130243108260518262958640076003059494321166880446106134684533980))
    
    (if (not (f= log3 (log 3.0)))
	(begin (display "(- (log 3.0) true-log-3) = ") (display (- log3 (log 3.0))) (newline)))
    (if (not (f= log2 (log 2.0)))
	(begin (display "(- (log 2.0) true-log-2) = ") (display (- log2 (log 2.0))) (newline)))
    (if (not (f= 3.0 (exp log3)))
	(begin (display "(- 3.0 (exp log3)) = ") (display (- 3.0 (exp log3))) (newline)))
    (if (not (f= 2.0 (exp log2)))
	(begin (display "(- 2.0 (exp log2)) = ") (display (- 2.0 (exp log2))) (newline))))
  
  (let ((sin1 8.414709848078965066525023216302989996225630607983710656727517099919104043912396689486397435430526959e-1)
	(cos1 5.403023058681397174009366074429766037323104206179222276700972553811003947744717645179518560871830894e-1)
	(tan1 1.557407724654902230506974807458360173087250772381520038383946605698861397151727289555099965202242984e0))
    
    (if (not (f= sin1 (sin 1)))
	(begin (display "(- (sin 1) true-sin-1) = ") (display (- sin1 (sin 1))) (newline)))
    (if (not (f= (asin sin1) 1.0))
	(begin (display "(- (asin (sin 1)) 1) = ") (display (- (asin sin1) 1)) (newline)))
    
    (if (not (f= cos1 (cos 1)))
	(begin (display "(- (cos 1) true-cos-1) = ") (display (- cos1 (cos 1))) (newline)))
    (if (not (f= (acos cos1) 1.0))
	(begin (display "(- (acos (cos 1)) 1) = ") (display (- (acos cos1) 1)) (newline)))
    
    (if (not (f= tan1 (tan 1)))
	(begin (display "(- (tan 1) true-tan-1) = ") (display (- tan1 (tan 1))) (newline)))
    (if (not (f= (atan tan1) 1.0))
	(begin (display "(- (atan (tan 1)) 1) = ") (display (- (atan tan1) 1)) (newline)))
    
    (set! sin1 -.3056143888882523)
    (set! cos1 -.9521553682590148)
    (set! tan1 .3209711346238149)
    
    (if (not (f= sin1 (sin 10000)))
	(begin (display "(- (sin 10000) true-sin-10000) = ") (display (- sin1 (sin 10000))) (newline)))
    
    (if (not (f= cos1 (cos 10000)))
	(begin (display "(- (cos 10000) true-cos-10000) = ") (display (- cos1 (cos 10000))) (newline)))
    
    (if (not (f= tan1 (tan 10000)))
	(begin (display "(- (tan 10000) true-tan-10000) = ") (display (- tan1 (tan 10000))) (newline)))
    )
  
  
  (let ((sinh1 1.175201193643801456882381850595600815155717981334095870229565413013307567304323895607117452089623392e0)
	(cosh1 1.543080634815243778477905620757061682601529112365863704737402214710769063049223698964264726435543036e0)
	(tanh1 7.615941559557648881194582826047935904127685972579365515968105001219532445766384834589475216736767144e-1))
    
    (if (not (f= sinh1 (sinh 1)))
	(begin (display "(- (sinh 1) true-sinh-1) = ") (display (- sinh1 (sinh 1))) (newline)))
    (if (not (f= (asinh sinh1) 1.0))
	(begin (display "(- (asinh (sinh 1)) 1) = ") (display (- (asinh sinh1) 1)) (newline)))
    
    (if (not (f= cosh1 (cosh 1)))
	(begin (display "(- (cosh 1) true-cosh-1) = ") (display (- cosh1 (cosh 1))) (newline)))
    (if (not (f= (acosh cosh1) 1.0))
	(begin (display "(- (acosh (cosh 1)) 1) = ") (display (- (acosh cosh1) 1)) (newline)))
    
    (if (not (f= tanh1 (tanh 1)))
	(begin (display "(- (tanh 1) true-tanh-1) = ") (display (- tanh1 (tanh 1))) (newline)))
    (if (not (f= (atanh tanh1) 1.0))
	(begin (display "(- (atanh (tanh 1)) 1) = ") (display (- (atanh tanh1) 1)) (newline)))
    ))

(when with-bignums 
  (let-temporarily (((*s7* 'bignum-precision) 512))
					; these checked against arprec (digits = 512)
    (num-test (sin (bignum "696898287454081973170944403677937368733396.0")) -0.01999904696709900707248379699203543861700131080741493395453090012397)
    (num-test (cos (bignum "696898287454081973170944403677937368733396.0")) -0.99979999906001588673892554498680272502063995303949755633430660411025)
    (num-test (tan (bignum "696898287454081973170944403677937368733396.0")) 0.02000304759542063815661565629241173304757896817099118262507840447691)
    (num-test (log (bignum "696898287454081973170944403677937368733396.0")) 96.34745809783239800899232787971326647885871562509641009125683617504293)
    (num-test (sqrt (bignum "696898287454081973170944403677937368733396.0")) 8.34804340821298061589146684184612401904558331041225568173326261228620e20))
  
  ;; these can be checked against arprec -- get tables of the others as well
  ;;	(num-test (sin 31415926535897932384626433832795028841.971693993751058209749445) 6.8290634690588564658126265428876656461078982456442870201741792E-24)
  ;; this test requires 500 bits of precision
  (num-test (sin 31415926535897932384626433832795028841) -8.2584214320186030736155068085595298665361290626210864656288000E-1)
  (num-test (sin 1.0) 0.84147098480789650665250232163029899962256306079837106567275170999191) ; if bignum here
  
  ;;	(num-test (cos 31415926535897932384626433832795028841.971693993751058209749445) 9.9999999999999999999999999999999999999999999997668194606778265E-1)
  ;; 500 bits
  (num-test (cos 1.0) 5.4030230586813971740093660744297660373231042061792222767009714E-1))




;;; --------------------------------------------------------------------------------
;;; *
;;; --------------------------------------------------------------------------------

(num-test (* -0.0) 0.0)
(num-test (* -0.0+0.00000001i) -0.0+0.00000001i)
(num-test (* -1.0) -1.0)
(num-test (* -1.0+1.0i -1.0+1.0i) 0.0-2.0i)
(num-test (* -1.0+1.0i 0) 0.0)
(num-test (* -1.0+1.0i 0.0) 0.0)
(num-test (* -1.0+1.0i 0.0+1.0i) -1.0-1.0i)
(num-test (* -1.0+1.0i 1) -1.0+1.0i)
(num-test (* -1.0+1.0i 1.0) -1.0+1.0i)
(num-test (* -1.0+1.0i 1.0+1.0i) -2.0)
(num-test (* -1.0+1.0i 1.234+1.234i) -2.468)
(num-test (* -1.0+1.0i 1/1) -1.0+1.0i)
(num-test (* -1.0+1.0i 123.4) -123.4+123.4i)
(num-test (* -1.0+1.0i 1234) -1234.0+1234.0i)
(num-test (* -1.0+1.0i 1234/11) -112.18181818181819+112.18181818181819i)
(num-test (* -1.0+1.0i) -1.0+1.0i)
(num-test (* -10) -10)
(num-test (* -10/3) -10/3)
(num-test (* -1234000000) -1234000000)
(num-test (* -1234000000.0) -1234000000.0)
(num-test (* -1234000000.0+2.71828182845905i) -1234000000.0+2.71828182845905i)
(num-test (* -1234000000/10) -1234000000/10)
(num-test (* -2) -2)
(num-test (* -2.71828182845905) -2.71828182845905)
(num-test (* -2.71828182845905+3.14159265358979i) -2.71828182845905+3.14159265358979i)
(num-test (* -2/2) -2/2)
(num-test (* -362880) -362880)
(num-test (* -362880/1234) -362880/1234)
(num-test (* 0 -1.0+1.0i) 0.0)
(num-test (* 0 0) 0)
(num-test (* 0 0.0) 0.0)
(num-test (* 0 0.0+1.0i) 0.0)
(num-test (* 0 1 -1.0+1.0i) 0.0)
(num-test (* 0 1 0) 0)
(num-test (* 0 1 0.0) 0.0)
(num-test (* 0 1 0.0+1.0i) 0.0)
(num-test (* 0 1 1) 0)
(num-test (* 0 1 1.0) 0.0)
(num-test (* 0 1 1.0+1.0i) 0.0)
(num-test (* 0 1 1.234+1.234i) 0.0)
(num-test (* 0 1 1/1) 0)
(num-test (* 0 1 123.4) 0.0)
(num-test (* 0 1 1234) 0)
(num-test (* 0 1 1234/11) 0)
(num-test (* 0 1) 0)
(num-test (* 0 1.0 -1.0+1.0i) 0.0)
(num-test (* 0 1.0 0) 0.0)
(num-test (* 0 1.0 0.0) 0.0)
(num-test (* 0 1.0 0.0+1.0i) 0.0)
(num-test (* 0 1.0 1) 0.0)
(num-test (* 0 1.0 1.0) 0.0)
(num-test (* 0 1.0 1.0+1.0i) 0.0)
(num-test (* 0 1.0 1.234+1.234i) 0.0)
(num-test (* 0 1.0 1/1) 0.0)
(num-test (* 0 1.0 123.4) 0.0)
(num-test (* 0 1.0 1234) 0.0)
(num-test (* 0 1.0 1234/11) 0.0)
(num-test (* 0 1.0) 0.0)
(num-test (* 0 1.0+1.0i -1.0+1.0i) 0.0)
(num-test (* 0 1.0+1.0i 0) 0.0)
(num-test (* 0 1.0+1.0i 0.0) 0.0)
(num-test (* 0 1.0+1.0i 0.0+1.0i) 0.0)
(num-test (* 0 1.0+1.0i 1) 0.0)
(num-test (* 0 1.0+1.0i 1.0) 0.0)
(num-test (* 0 1.0+1.0i 1.0+1.0i) 0.0)
(num-test (* 0 1.0+1.0i 1.234+1.234i) 0.0)
(num-test (* 0 1.0+1.0i 1/1) 0.0)
(num-test (* 0 1.0+1.0i 123.4) 0.0)
(num-test (* 0 1.0+1.0i 1234) 0.0)
(num-test (* 0 1.0+1.0i 1234/11) 0.0)
(num-test (* 0 1.0+1.0i) 0.0)
(num-test (* 0 1.234+1.234i) 0.0)
(num-test (* 0 1/1 -1.0+1.0i) 0.0)
(num-test (* 0 123.4) 0.0)
(num-test (* 0 1234) 0)
(num-test (* 0 1234/11) 0)
(num-test (* 0) 0)
(num-test (* 0) 0)
(num-test (* 0.0 -1.0+1.0i -1.0+1.0i) 0.0)
(num-test (* 0.0 -1.0+1.0i 0) 0.0)
(num-test (* 0.0 -1.0+1.0i 0.0) 0.0)
(num-test (* 0.0 -1.0+1.0i 0.0+1.0i) 0.0)
(num-test (* 0.0 -1.0+1.0i 1) 0.0)
(num-test (* 0.0 -1.0+1.0i 1.0) 0.0)
(num-test (* 0.0 -1.0+1.0i 1.0+1.0i) 0.0)
(num-test (* 0.0 -1.0+1.0i 1.234+1.234i) 0.0)
(num-test (* 0.0 -1.0+1.0i 1/1) 0.0)
(num-test (* 0.0 -1.0+1.0i 123.4) 0.0)
(num-test (* 0.0 -1.0+1.0i 1234) 0.0)
(num-test (* 0.0 -1.0+1.0i 1234/11) 0.0)
(num-test (* 0.0 -1.0+1.0i) 0.0)
(num-test (* 0.0 0 -1.0+1.0i) 0.0)
(num-test (* 0.0 0 0) 0.0)
(num-test (* 0.0 0 0.0) 0.0)
(num-test (* 0.0 0 0.0+1.0i) 0.0)
(num-test (* 0.0 0 1) 0.0)
(num-test (* 0.0 0 1.0) 0.0)
(num-test (* 0.0 0 1.0+1.0i) 0.0)
(num-test (* 0.0 0 1.234+1.234i) 0.0)
(num-test (* 0.0 0 1/1) 0.0)
(num-test (* 0.0 0 123.4) 0.0)
(num-test (* 0.0 0 1234) 0.0)
(num-test (* 0.0 0 1234/11) 0.0)
(num-test (* 0.0 0) 0.0)
(num-test (* 0.0 0.0 -1.0+1.0i) 0.0)
(num-test (* 0.0 0.0 0) 0.0)
(num-test (* 0.0 0.0 0.0) 0.0)
(num-test (* 0.0 0.0 0.0+1.0i) 0.0)
(num-test (* 0.0 0.0 1) 0.0)
(num-test (* 0.0 0.0 1.0) 0.0)
(num-test (* 0.0 0.0 1.0+1.0i) 0.0)
(num-test (* 0.0 0.0 1.234+1.234i) 0.0)
(num-test (* 0.0 0.0 1/1) 0.0)
(num-test (* 0.0 0.0 123.4) 0.0)
(num-test (* 0.0 0.0 1234) 0.0)
(num-test (* 0.0 0.0 1234/11) 0.0)
(num-test (* 0.0 0.0) 0.0)
(num-test (* 0.0 0.0+1.0i -1.0+1.0i) 0.0)
(num-test (* 0.0 0.0+1.0i 0) 0.0)
(num-test (* 0.0 0.0+1.0i 0.0) 0.0)
(num-test (* 0.0 0.0+1.0i 0.0+1.0i) 0.0)
(num-test (* 0.0 0.0+1.0i 1) 0.0)
(num-test (* 0.0 0.0+1.0i 1.0) 0.0)
(num-test (* 0.0 0.0+1.0i 1.0+1.0i) 0.0)
(num-test (* 0.0 0.0+1.0i 1.234+1.234i) 0.0)
(num-test (* 0.0 0.0+1.0i 1/1) 0.0)
(num-test (* 0.0 0.0+1.0i 123.4) 0.0)
(num-test (* 0.0 0.0+1.0i 1234) 0.0)
(num-test (* 0.0 0.0+1.0i 1234/11) 0.0)
(num-test (* 0.0 0.0+1.0i) 0.0)
(num-test (* 0.0 1 -1.0+1.0i) 0.0)
(num-test (* 0.0 1 0) 0.0)
(num-test (* 0.0 1 0.0) 0.0)
(num-test (* 0.0 1 0.0+1.0i) 0.0)
(num-test (* 0.0 1 1.0) 0.0)
(num-test (* 0.0 1 1.0+1.0i) 0.0)
(num-test (* 0.0 1 1.234+1.234i) 0.0)
(num-test (* 0.0 1 1/1) 0.0)
(num-test (* 0.0 1 123.4) 0.0)
(num-test (* 0.0 1 1234) 0.0)
(num-test (* 0.0 1 1234/11) 0.0)
(num-test (* 0.0 1) 0.0)
(num-test (* 0.0 1.0 -1.0+1.0i) 0.0)
(num-test (* 0.0 1.0 0) 0.0)
(num-test (* 0.0 1.0 0.0) 0.0)
(num-test (* 0.0 1.0 0.0+1.0i) 0.0)
(num-test (* 0.0 1.0 1) 0.0)
(num-test (* 0.0 1.0 1.0) 0.0)
(num-test (* 0.0 1.0 1.0+1.0i) 0.0)
(num-test (* 0.0 1.0 1.234+1.234i) 0.0)
(num-test (* 0.0 1.0 1/1) 0.0)
(num-test (* 0.0 1.0 123.4) 0.0)
(num-test (* 0.0 1.0 1234) 0.0)
(num-test (* 0.0 1.0 1234/11) 0.0)
(num-test (* 0.0 1.0) 0.0)
(num-test (* 0.0 1.0+1.0i -1.0+1.0i) 0.0)
(num-test (* 0.0 1.0+1.0i 0) 0.0)
(num-test (* 0.0 1.0+1.0i 0.0) 0.0)
(num-test (* 0.0 1.0+1.0i 0.0+1.0i) 0.0)
(num-test (* 0.0 1.0+1.0i 1) 0.0)
(num-test (* 0.0 1.0+1.0i 1.0) 0.0)
(num-test (* 0.0 1.0+1.0i 1.0+1.0i) 0.0)
(num-test (* 0.0 1.0+1.0i 1.234+1.234i) 0.0)
(num-test (* 0.0 1.0+1.0i 1/1) 0.0)
(num-test (* 0.0 1.0+1.0i 123.4) 0.0)
(num-test (* 0.0 1.0+1.0i 1234) 0.0)
(num-test (* 0.0 1.0+1.0i 1234/11) 0.0)
(num-test (* 0.0 1.0+1.0i) 0.0)
(num-test (* 0.0 1.234+1.234i -1.0+1.0i) 0.0)
(num-test (* 0.0 1.234+1.234i 0) 0.0)
(num-test (* 0.0 1.234+1.234i 0.0) 0.0)
(num-test (* 0.0 1.234+1.234i 0.0+1.0i) 0.0)
(num-test (* 0.0 1.234+1.234i 1) 0.0)
(num-test (* 0.0 1.234+1.234i 1.0) 0.0)
(num-test (* 0.0 1.234+1.234i 1.0+1.0i) 0.0)
(num-test (* 0.0 1.234+1.234i 1.234+1.234i) 0.0)
(num-test (* 0.0 1.234+1.234i 1/1) 0.0)
(num-test (* 0.0 1.234+1.234i 123.4) 0.0)
(num-test (* 0.0 1.234+1.234i 1234) 0.0)
(num-test (* 0.0 1.234+1.234i 1234/11) 0.0)
(num-test (* 0.0 1.234+1.234i) 0.0)
(num-test (* 0.0 123.4 -1.0+1.0i) 0.0)
(num-test (* 0.0 123.4 0) 0.0)
(num-test (* 0.0 123.4 0.0) 0.0)
(num-test (* 0.0 123.4 0.0+1.0i) 0.0)
(num-test (* 0.0 123.4 1) 0.0)
(num-test (* 0.0 123.4 1.0) 0.0)
(num-test (* 0.0 123.4 1.0+1.0i) 0.0)
(num-test (* 0.0 123.4 1.234+1.234i) 0.0)
(num-test (* 0.0 123.4 1/1) 0.0)
(num-test (* 0.0 123.4 123.4) 0.0)
(num-test (* 0.0 123.4 1234) 0.0)
(num-test (* 0.0 123.4 1234/11) 0.0)
(num-test (* 0.0 123.4) 0.0)
(num-test (* 0.0 1234 -1.0+1.0i) 0.0)
(num-test (* 0.0 1234 0) 0.0)
(num-test (* 0.0 1234 0.0) 0.0)
(num-test (* 0.0 1234 0.0+1.0i) 0.0)
(num-test (* 0.0 1234 1) 0.0)
(num-test (* 0.0 1234 1.0) 0.0)
(num-test (* 0.0 1234 1.0+1.0i) 0.0)
(num-test (* 0.0 1234 1.234+1.234i) 0.0)
(num-test (* 0.0 1234 1/1) 0.0)
(num-test (* 0.0 1234 123.4) 0.0)
(num-test (* 0.0 1234 1234) 0.0)
(num-test (* 0.0 1234 1234/11) 0.0)
(num-test (* 0.0 1234) 0.0)
(num-test (* 0.0 1234/11 -1.0+1.0i) 0.0)
(num-test (* 0.0 1234/11 0) 0.0)
(num-test (* 0.0 1234/11 0.0) 0.0)
(num-test (* 0.0 1234/11 0.0+1.0i) 0.0)
(num-test (* 0.0 1234/11 1) 0.0)
(num-test (* 0.0 1234/11 1.0) 0.0)
(num-test (* 0.0 1234/11 1.0+1.0i) 0.0)
(num-test (* 0.0 1234/11 1.234+1.234i) 0.0)
(num-test (* 0.0 1234/11 1/1) 0.0)
(num-test (* 0.0 1234/11 123.4) 0.0)
(num-test (* 0.0 1234/11 1234) 0.0)
(num-test (* 0.0 1234/11 1234/11) 0.0)
(num-test (* 0.0 1234/11) 0.0)
(num-test (* 0.0) 0.0)
(num-test (* 0.0+0.00000001i) 0.0+0.00000001i)
(num-test (* 0.0+1.0i -1.0+1.0i) -1.0-1.0i)
(num-test (* 0.0+1.0i 0) 0.0)
(num-test (* 0.0+1.0i 0.0) 0.0)
(num-test (* 0.0+1.0i 0.0+1.0i) -1.0)
(num-test (* 0.0+1.0i 1) 0.0+1.0i)
(num-test (* 0.0+1.0i 1.0) 0.0+1.0i)
(num-test (* 0.0+1.0i 1.0+1.0i) -1.0+1.0i)
(num-test (* 0.0+1.0i 1.234+1.234i) -1.234+1.234i)
(num-test (* 0.0+1.0i 1/1) 0.0+1.0i)
(num-test (* 0.0+1.0i 123.4) 0.0+123.4i)
(num-test (* 0.0+1.0i 1234) 0.0+1234.0i)
(num-test (* 0.0+1.0i 1234/11) 0.0+112.18181818181819i)
(num-test (* 0/1) 0/1)
(num-test (* 0/1) 0/1)
(num-test (* 1 -1.0+1.0i) -1.0+1.0i)
(num-test (* 1 0) 0)
(num-test (* 1 0.0) 0.0)
(num-test (* 1 0.0+1.0i) 0.0+1.0i)
(num-test (* 1 1 -1.0+1.0i) -1.0+1.0i)
(num-test (* 1 1 0) 0)
(num-test (* 1 1 0.0) 0.0)
(num-test (* 1 1 0.0+1.0i) 0.0+1.0i)
(num-test (* 1 1 1) 1)
(num-test (* 1 1 1.0) 1.0)
(num-test (* 1 1 1.0+1.0i) 1.0+1.0i)
(num-test (* 1 1 1.234+1.234i) 1.234+1.234i)
(num-test (* 1 1 1/1) 1)
(num-test (* 1 1 123.4) 123.4)
(num-test (* 1 1 1234) 1234)
(num-test (* 1 1 1234/11) 1234/11)
(num-test (* 1 1) 1)
(num-test (* 1 1.0 -1.0+1.0i) -1.0+1.0i)
(num-test (* 1 1.0 0) 0.0)
(num-test (* 1 1.0 0.0) 0.0)
(num-test (* 1 1.0 0.0+1.0i) 0.0+1.0i)
(num-test (* 1 1.0 1) 1.0)
(num-test (* 1 1.0 1.0) 1.0)
(num-test (* 1 1.0 1.0+1.0i) 1.0+1.0i)
(num-test (* 1 1.0 1.234+1.234i) 1.234+1.234i)
(num-test (* 1 1.0 1/1) 1.0)
(num-test (* 1 1.0 123.4) 123.4)
(num-test (* 1 1.0 1234) 1234.0)
(num-test (* 1 1.0 1234/11) 112.18181818181819)
(num-test (* 1 1.0) 1.0)
(num-test (* 1 1.0+1.0i -1.0+1.0i) -2.0)
(num-test (* 1 1.0+1.0i 0) 0.0)
(num-test (* 1 1.0+1.0i 0.0) 0.0)
(num-test (* 1 1.0+1.0i 0.0+1.0i) -1.0+1.0i)
(num-test (* 1 1.0+1.0i 1) 1.0+1.0i)
(num-test (* 1 1.0+1.0i 1.0) 1.0+1.0i)
(num-test (* 1 1.0+1.0i 1.0+1.0i) 0.0+2.0i)
(num-test (* 1 1.0+1.0i 1.234+1.234i) 0.0+2.468i)
(num-test (* 1 1.0+1.0i 1/1) 1.0+1.0i)
(num-test (* 1 1.0+1.0i 123.4) 123.4+123.4i)
(num-test (* 1 1.0+1.0i 1234) 1234.0+1234.0i)
(num-test (* 1 1.0+1.0i 1234/11) 112.18181818181819+112.18181818181819i)
(num-test (* 1 1.0+1.0i) 1.0+1.0i)
(num-test (* 1 1.234+1.234i) 1.234+1.234i)
(num-test (* 1 123.4) 123.4)
(num-test (* 1 1234) 1234)
(num-test (* 1 1234/11) 1234/11)
(num-test (* 1.0 -1.0+1.0i -1.0+1.0i) 0.0-2.0i)
(num-test (* 1.0 -1.0+1.0i 0) 0.0)
(num-test (* 1.0 -1.0+1.0i 0.0) 0.0)
(num-test (* 1.0 -1.0+1.0i 0.0+1.0i) -1.0-1.0i)
(num-test (* 1.0 -1.0+1.0i 1) -1.0+1.0i)
(num-test (* 1.0 -1.0+1.0i 1.0) -1.0+1.0i)
(num-test (* 1.0 -1.0+1.0i 1.0+1.0i) -2.0)
(num-test (* 1.0 -1.0+1.0i 1.234+1.234i) -2.468)
(num-test (* 1.0 -1.0+1.0i 1/1) -1.0+1.0i)
(num-test (* 1.0 -1.0+1.0i 123.4) -123.4+123.4i)
(num-test (* 1.0 -1.0+1.0i 1234) -1234.0+1234.0i)
(num-test (* 1.0 -1.0+1.0i 1234/11) -112.18181818181819+112.18181818181819i)
(num-test (* 1.0 -1.0+1.0i) -1.0+1.0i)
(num-test (* 1.0 0 -1.0+1.0i) 0.0)
(num-test (* 1.0 0 0) 0.0)
(num-test (* 1.0 0 0.0) 0.0)
(num-test (* 1.0 0 0.0+1.0i) 0.0)
(num-test (* 1.0 0 1) 0.0)
(num-test (* 1.0 0 1.0) 0.0)
(num-test (* 1.0 0 1.0+1.0i) 0.0)
(num-test (* 1.0 0 1.234+1.234i) 0.0)
(num-test (* 1.0 0 1/1) 0.0)
(num-test (* 1.0 0 123.4) 0.0)
(num-test (* 1.0 0 1234) 0.0)
(num-test (* 1.0 0 1234/11) 0.0)
(num-test (* 1.0 0) 0.0)
(num-test (* 1.0 0.0 -1.0+1.0i) 0.0)
(num-test (* 1.0 0.0 0) 0.0)
(num-test (* 1.0 0.0 0.0) 0.0)
(num-test (* 1.0 0.0 0.0+1.0i) 0.0)
(num-test (* 1.0 0.0 1) 0.0)
(num-test (* 1.0 0.0 1.0) 0.0)
(num-test (* 1.0 0.0 1.0+1.0i) 0.0)
(num-test (* 1.0 0.0 1.234+1.234i) 0.0)
(num-test (* 1.0 0.0 1/1) 0.0)
(num-test (* 1.0 0.0 123.4) 0.0)
(num-test (* 1.0 0.0 1234) 0.0)
(num-test (* 1.0 0.0 1234/11) 0.0)
(num-test (* 1.0 0.0) 0.0)
(num-test (* 1.0 0.0+1.0i -1.0+1.0i) -1.0-1.0i)
(num-test (* 1.0 0.0+1.0i 0) 0.0)
(num-test (* 1.0 0.0+1.0i 0.0) 0.0)
(num-test (* 1.0 0.0+1.0i 0.0+1.0i) -1.0)
(num-test (* 1.0 0.0+1.0i 1) 0.0+1.0i)
(num-test (* 1.0 0.0+1.0i 1.0) 0.0+1.0i)
(num-test (* 1.0 0.0+1.0i 1.0+1.0i) -1.0+1.0i)
(num-test (* 1.0 0.0+1.0i 1.234+1.234i) -1.234+1.234i)
(num-test (* 1.0 0.0+1.0i 1/1) 0.0+1.0i)
(num-test (* 1.0 0.0+1.0i 123.4) 0.0+123.4i)
(num-test (* 1.0 0.0+1.0i 1234) 0.0+1234.0i)
(num-test (* 1.0 0.0+1.0i 1234/11) 0.0+112.18181818181819i)
(num-test (* 1.0 0.0+1.0i) 0.0+1.0i)
(num-test (* 1.0 1 -1.0+1.0i) -1.0+1.0i)
(num-test (* 1.0 1 0) 0.0)
(num-test (* 1.0 1 0.0) 0.0)
(num-test (* 1.0 1 0.0+1.0i) 0.0+1.0i)
(num-test (* 1.0 1 1) 1.0)
(num-test (* 1.0 1 1.0) 1.0)
(num-test (* 1.0 1 1.0+1.0i) 1.0+1.0i)
(num-test (* 1.0 1 1.234+1.234i) 1.234+1.234i)
(num-test (* 1.0 1 1/1) 1.0)
(num-test (* 1.0 1 123.4) 123.4)
(num-test (* 1.0 1 1234) 1234.0)
(num-test (* 1.0 1 1234/11) 112.18181818181819)
(num-test (* 1.0 1) 1.0)
(num-test (* 1.0 1.0 -1.0+1.0i) -1.0+1.0i)
(num-test (* 1.0 1.0 0) 0.0)
(num-test (* 1.0 1.0 0.0) 0.0)
(num-test (* 1.0 1.0 0.0+1.0i) 0.0+1.0i)
(num-test (* 1.0 1.0 1) 1.0)
(num-test (* 1.0 1.0 1.0) 1.0)
(num-test (* 1.0 1.0 1.0+1.0i) 1.0+1.0i)
(num-test (* 1.0 1.0 1.234+1.234i) 1.234+1.234i)
(num-test (* 1.0 1.0 1/1) 1.0)
(num-test (* 1.0 1.0 123.4) 123.4)
(num-test (* 1.0 1.0 1234) 1234.0)
(num-test (* 1.0 1.0 1234/11) 112.18181818181819)
(num-test (* 1.0 1.0) 1.0)
(num-test (* 1.0 1.0+1.0i -1.0+1.0i) -2.0)
(num-test (* 1.0 1.0+1.0i 0) 0.0)
(num-test (* 1.0 1.0+1.0i 0.0) 0.0)
(num-test (* 1.0 1.0+1.0i 0.0+1.0i) -1.0+1.0i)
(num-test (* 1.0 1.0+1.0i 1) 1.0+1.0i)
(num-test (* 1.0 1.0+1.0i 1.0) 1.0+1.0i)
(num-test (* 1.0 1.0+1.0i 1.0+1.0i) 0.0+2.0i)
(num-test (* 1.0 1.0+1.0i 1.234+1.234i) 0.0+2.468i)
(num-test (* 1.0 1.0+1.0i 1/1) 1.0+1.0i)
(num-test (* 1.0 1.0+1.0i 123.4) 123.4+123.4i)
(num-test (* 1.0 1.0+1.0i 1234) 1234.0+1234.0i)
(num-test (* 1.0 1.0+1.0i 1234/11) 112.18181818181819+112.18181818181819i)
(num-test (* 1.0 1.0+1.0i) 1.0+1.0i)
(num-test (* 1.0 1.234+1.234i -1.0+1.0i) -2.468)
(num-test (* 1.0 1.234+1.234i 0) 0.0)
(num-test (* 1.0 1.234+1.234i 0.0) 0.0)
(num-test (* 1.0 1.234+1.234i 0.0+1.0i) -1.234+1.234i)
(num-test (* 1.0 1.234+1.234i 1) 1.234+1.234i)
(num-test (* 1.0 1.234+1.234i 1.0) 1.234+1.234i)
(num-test (* 1.0 1.234+1.234i 1.0+1.0i) 0.0+2.468i)
(num-test (* 1.0 1.234+1.234i 1.234+1.234i) 0.0+3.04551200000000i)
(num-test (* 1.0 1.234+1.234i 1/1) 1.234+1.234i)
(num-test (* 1.0 1.234+1.234i 123.4) 152.2756+152.2756i)
(num-test (* 1.0 1.234+1.234i 1234) 1522.756+1522.756i)
(num-test (* 1.0 1.234+1.234i 1234/11) 138.43236363636365+138.43236363636365i)
(num-test (* 1.0 1.234+1.234i) 1.234+1.234i)
(num-test (* 1.0 1/1 -1.0+1.0i) -1.0+1.0i)
(num-test (* 1.0 123.4 -1.0+1.0i) -123.4+123.4i)
(num-test (* 1.0 123.4 0) 0.0)
(num-test (* 1.0 123.4 0.0) 0.0)
(num-test (* 1.0 123.4 0.0+1.0i) 0.0+123.4i)
(num-test (* 1.0 123.4 1) 123.4)
(num-test (* 1.0 123.4 1.0) 123.4)
(num-test (* 1.0 123.4 1.0+1.0i) 123.4+123.4i)
(num-test (* 1.0 123.4 1.234+1.234i) 152.2756+152.2756i)
(num-test (* 1.0 123.4 1/1) 123.4)
(num-test (* 1.0 123.4 123.4) 15227.56000000000131)
(num-test (* 1.0 123.4 1234) 152275.60000000000582)
(num-test (* 1.0 123.4 1234/11) 13843.23636363636433)
(num-test (* 1.0 123.4) 123.4)
(num-test (* 1.0 1234 -1.0+1.0i) -1234.0+1234.0i)
(num-test (* 1.0 1234 0) 0.0)
(num-test (* 1.0 1234 0.0) 0.0)
(num-test (* 1.0 1234 0.0+1.0i) 0.0+1234.0i)
(num-test (* 1.0 1234 1) 1234.0)
(num-test (* 1.0 1234 1.0) 1234.0)
(num-test (* 1.0 1234 1.0+1.0i) 1234.0+1234.0i)
(num-test (* 1.0 1234 1.234+1.234i) 1522.756+1522.756i)
(num-test (* 1.0 1234 1/1) 1234.0)
(num-test (* 1.0 1234 123.4) 152275.60000000000582)
(num-test (* 1.0 1234 1234) 1522756.0)
(num-test (* 1.0 1234 1234/11) 138432.36363636364695)
(num-test (* 1.0 1234) 1234.0)
(num-test (* 1.0 1234/11 -1.0+1.0i) -112.18181818181819+112.18181818181819i)
(num-test (* 1.0 1234/11 0) 0.0)
(num-test (* 1.0 1234/11 0.0) 0.0)
(num-test (* 1.0 1234/11 0.0+1.0i) 0.0+112.18181818181819i)
(num-test (* 1.0 1234/11 1) 112.18181818181819)
(num-test (* 1.0 1234/11 1.0) 112.18181818181819)
(num-test (* 1.0 1234/11 1.0+1.0i) 112.18181818181819+112.18181818181819i)
(num-test (* 1.0 1234/11 1.234+1.234i) 138.43236363636365+138.43236363636365i)
(num-test (* 1.0 1234/11 1/1) 112.18181818181819)
(num-test (* 1.0 1234/11 123.4) 13843.23636363636433)
(num-test (* 1.0 1234/11 1234) 138432.36363636364695)
(num-test (* 1.0 1234/11 1234/11) 12584.76033057851237)
(num-test (* 1.0 1234/11) 112.18181818181819)
(num-test (* 1.0) 1.0)
(num-test (* 1.0+1.0i -1.0+1.0i -1.0+1.0i) 2.0-2.0i)
(num-test (* 1.0+1.0i -1.0+1.0i 0) 0.0)
(num-test (* 1.0+1.0i -1.0+1.0i 0.0) 0.0)
(num-test (* 1.0+1.0i -1.0+1.0i 0.0+1.0i) -0.0-2.0i)
(num-test (* 1.0+1.0i -1.0+1.0i 1) -2.0)
(num-test (* 1.0+1.0i -1.0+1.0i 1.0) -2.0)
(num-test (* 1.0+1.0i -1.0+1.0i 1.0+1.0i) -2.0-2.0i)
(num-test (* 1.0+1.0i -1.0+1.0i 1.234+1.234i) -2.468-2.468i)
(num-test (* 1.0+1.0i -1.0+1.0i 1/1) -2.0)
(num-test (* 1.0+1.0i -1.0+1.0i 123.4) -246.8)
(num-test (* 1.0+1.0i -1.0+1.0i 1234) -2468.0)
(num-test (* 1.0+1.0i -1.0+1.0i 1234/11) -224.36363636363637)
(num-test (* 1.0+1.0i -1.0+1.0i) -2.0)
(num-test (* 1.0+1.0i 0 -1.0+1.0i) 0.0)
(num-test (* 1.0+1.0i 0 0) 0.0)
(num-test (* 1.0+1.0i 0 0.0) 0.0)
(num-test (* 1.0+1.0i 0 0.0+1.0i) 0.0)
(num-test (* 1.0+1.0i 0 1) 0.0)
(num-test (* 1.0+1.0i 0 1.0) 0.0)
(num-test (* 1.0+1.0i 0 1.0+1.0i) 0.0)
(num-test (* 1.0+1.0i 0 1.234+1.234i) 0.0)
(num-test (* 1.0+1.0i 0 1/1) 0.0)
(num-test (* 1.0+1.0i 0 123.4) 0.0)
(num-test (* 1.0+1.0i 0 1234) 0.0)
(num-test (* 1.0+1.0i 0 1234/11) 0.0)
(num-test (* 1.0+1.0i 0) 0.0)
(num-test (* 1.0+1.0i 0.0 -1.0+1.0i) 0.0)
(num-test (* 1.0+1.0i 0.0 0) 0.0)
(num-test (* 1.0+1.0i 0.0 0.0) 0.0)
(num-test (* 1.0+1.0i 0.0 0.0+1.0i) 0.0)
(num-test (* 1.0+1.0i 0.0 1) 0.0)
(num-test (* 1.0+1.0i 0.0 1.0) 0.0)
(num-test (* 1.0+1.0i 0.0 1.0+1.0i) 0.0)
(num-test (* 1.0+1.0i 0.0 1.234+1.234i) 0.0)
(num-test (* 1.0+1.0i 0.0 1/1) 0.0)
(num-test (* 1.0+1.0i 0.0 123.4) 0.0)
(num-test (* 1.0+1.0i 0.0 1234) 0.0)
(num-test (* 1.0+1.0i 0.0 1234/11) 0.0)
(num-test (* 1.0+1.0i 0.0) 0.0)
(num-test (* 1.0+1.0i 0.0+1.0i -1.0+1.0i) 0.0-2.0i)
(num-test (* 1.0+1.0i 0.0+1.0i 0) 0.0)
(num-test (* 1.0+1.0i 0.0+1.0i 0.0) 0.0)
(num-test (* 1.0+1.0i 0.0+1.0i 0.0+1.0i) -1.0-1.0i)
(num-test (* 1.0+1.0i 0.0+1.0i 1) -1.0+1.0i)
(num-test (* 1.0+1.0i 0.0+1.0i 1.0) -1.0+1.0i)
(num-test (* 1.0+1.0i 0.0+1.0i 1.0+1.0i) -2.0)
(num-test (* 1.0+1.0i 0.0+1.0i 1.234+1.234i) -2.468)
(num-test (* 1.0+1.0i 0.0+1.0i 1/1) -1.0+1.0i)
(num-test (* 1.0+1.0i 0.0+1.0i 123.4) -123.4+123.4i)
(num-test (* 1.0+1.0i 0.0+1.0i 1234) -1234.0+1234.0i)
(num-test (* 1.0+1.0i 0.0+1.0i 1234/11) -112.18181818181819+112.18181818181819i)
(num-test (* 1.0+1.0i 0.0+1.0i) -1.0+1.0i)
(num-test (* 1.0+1.0i 1 -1.0+1.0i) -2.0)
(num-test (* 1.0+1.0i 1 0) 0.0)
(num-test (* 1.0+1.0i 1 0.0) 0.0)
(num-test (* 1.0+1.0i 1 0.0+1.0i) -1.0+1.0i)
(num-test (* 1.0+1.0i 1 1) 1.0+1.0i)
(num-test (* 1.0+1.0i 1 1.0) 1.0+1.0i)
(num-test (* 1.0+1.0i 1 1.0+1.0i) 0.0+2.0i)
(num-test (* 1.0+1.0i 1 1.234+1.234i) 0.0+2.468i)
(num-test (* 1.0+1.0i 1 1/1) 1.0+1.0i)
(num-test (* 1.0+1.0i 1 123.4) 123.4+123.4i)
(num-test (* 1.0+1.0i 1 1234) 1234.0+1234.0i)
(num-test (* 1.0+1.0i 1 1234/11) 112.18181818181819+112.18181818181819i)
(num-test (* 1.0+1.0i 1) 1.0+1.0i)
(num-test (* 1.0+1.0i 1.0 -1.0+1.0i) -2.0)
(num-test (* 1.0+1.0i 1.0 0) 0.0)
(num-test (* 1.0+1.0i 1.0 0.0) 0.0)
(num-test (* 1.0+1.0i 1.0 0.0+1.0i) -1.0+1.0i)
(num-test (* 1.0+1.0i 1.0 1) 1.0+1.0i)
(num-test (* 1.0+1.0i 1.0 1.0) 1.0+1.0i)
(num-test (* 1.0+1.0i 1.0 1.0+1.0i) 0.0+2.0i)
(num-test (* 1.0+1.0i 1.0 1.234+1.234i) 0.0+2.468i)
(num-test (* 1.0+1.0i 1.0 1/1) 1.0+1.0i)
(num-test (* 1.0+1.0i 1.0 123.4) 123.4+123.4i)
(num-test (* 1.0+1.0i 1.0 1234) 1234.0+1234.0i)
(num-test (* 1.0+1.0i 1.0 1234/11) 112.18181818181819+112.18181818181819i)
(num-test (* 1.0+1.0i 1.0) 1.0+1.0i)
(num-test (* 1.0+1.0i 1.0+1.0i -1.0+1.0i) -2.0-2.0i)
(num-test (* 1.0+1.0i 1.0+1.0i 0) 0.0)
(num-test (* 1.0+1.0i 1.0+1.0i 0.0) 0.0)
(num-test (* 1.0+1.0i 1.0+1.0i 0.0+1.0i) -2.0)
(num-test (* 1.0+1.0i 1.0+1.0i 1) 0.0+2.0i)
(num-test (* 1.0+1.0i 1.0+1.0i 1.0) 0.0+2.0i)
(num-test (* 1.0+1.0i 1.0+1.0i 1.0+1.0i) -2.0+2.0i)
(num-test (* 1.0+1.0i 1.0+1.0i 1.234+1.234i) -2.468+2.468i)
(num-test (* 1.0+1.0i 1.0+1.0i 1/1) 0.0+2.0i)
(num-test (* 1.0+1.0i 1.0+1.0i 123.4) 0.0+246.8i)
(num-test (* 1.0+1.0i 1.0+1.0i 1234) 0.0+2468.0i)
(num-test (* 1.0+1.0i 1.0+1.0i 1234/11) 0.0+224.36363636363637i)
(num-test (* 1.0+1.0i 1.0+1.0i) 0.0+2.0i)
(num-test (* 1.0+1.0i 1.234+1.234i -1.0+1.0i) -2.468-2.468i)
(num-test (* 1.0+1.0i 1.234+1.234i 0) 0.0)
(num-test (* 1.0+1.0i 1.234+1.234i 0.0) 0.0)
(num-test (* 1.0+1.0i 1.234+1.234i 0.0+1.0i) -2.468)
(num-test (* 1.0+1.0i 1.234+1.234i 1) 0.0+2.468i)
(num-test (* 1.0+1.0i 1.234+1.234i 1.0) 0.0+2.468i)
(num-test (* 1.0+1.0i 1.234+1.234i 1.0+1.0i) -2.468+2.468i)
(num-test (* 1.0+1.0i 1.234+1.234i 1.234+1.234i) -3.04551200000000+3.04551200000000i)
(num-test (* 1.0+1.0i 1.234+1.234i 1/1) 0.0+2.468i)
(num-test (* 1.0+1.0i 1.234+1.234i 123.4) 0.0+304.55119999999999i)
(num-test (* 1.0+1.0i 1.234+1.234i 1234) 0.0+3045.51200000000017i)
(num-test (* 1.0+1.0i 1.234+1.234i 1234/11) 0.0+276.86472727272729i)
(num-test (* 1.0+1.0i 1.234+1.234i) 0.0+2.468i)
(num-test (* 1.0+1.0i 123.4 -1.0+1.0i) -246.8)
(num-test (* 1.0+1.0i 123.4 0) 0.0)
(num-test (* 1.0+1.0i 123.4 0.0) 0.0)
(num-test (* 1.0+1.0i 123.4 0.0+1.0i) -123.4+123.4i)
(num-test (* 1.0+1.0i 123.4 1) 123.4+123.4i)
(num-test (* 1.0+1.0i 123.4 1.0) 123.4+123.4i)
(num-test (* 1.0+1.0i 123.4 1.0+1.0i) 0.0+246.8i)
(num-test (* 1.0+1.0i 123.4 1.234+1.234i) 0.0+304.55119999999999i)
(num-test (* 1.0+1.0i 123.4 1/1) 123.4+123.4i)
(num-test (* 1.0+1.0i 123.4 123.4) 15227.56000000000131+15227.56000000000131i)
(num-test (* 1.0+1.0i 123.4 1234) 152275.60000000000582+152275.60000000000582i)
(num-test (* 1.0+1.0i 123.4 1234/11) 13843.23636363636433+13843.23636363636433i)
(num-test (* 1.0+1.0i 123.4) 123.4+123.4i)
(num-test (* 1.0+1.0i 1234 -1.0+1.0i) -2468.0)
(num-test (* 1.0+1.0i 1234 0) 0.0)
(num-test (* 1.0+1.0i 1234 0.0) 0.0)
(num-test (* 1.0+1.0i 1234 0.0+1.0i) -1234.0+1234.0i)
(num-test (* 1.0+1.0i 1234 1) 1234.0+1234.0i)
(num-test (* 1.0+1.0i 1234 1.0) 1234.0+1234.0i)
(num-test (* 1.0+1.0i 1234 1.0+1.0i) 0.0+2468.0i)
(num-test (* 1.0+1.0i 1234 1.234+1.234i) 0.0+3045.51200000000017i)
(num-test (* 1.0+1.0i 1234 1/1) 1234.0+1234.0i)
(num-test (* 1.0+1.0i 1234 123.4) 152275.60000000000582+152275.60000000000582i)
(num-test (* 1.0+1.0i 1234 1234) 1522756.0+1522756.0i)
(num-test (* 1.0+1.0i 1234 1234/11) 138432.36363636364695+138432.36363636364695i)
(num-test (* 1.0+1.0i 1234) 1234.0+1234.0i)
(num-test (* 1.0+1.0i 1234/11 -1.0+1.0i) -224.36363636363637)
(num-test (* 1.0+1.0i 1234/11 0) 0.0)
(num-test (* 1.0+1.0i 1234/11 0.0) 0.0)
(num-test (* 1.0+1.0i 1234/11 0.0+1.0i) -112.18181818181819+112.18181818181819i)
(num-test (* 1.0+1.0i 1234/11 1) 112.18181818181819+112.18181818181819i)
(num-test (* 1.0+1.0i 1234/11 1.0) 112.18181818181819+112.18181818181819i)
(num-test (* 1.0+1.0i 1234/11 1.0+1.0i) 0.0+224.36363636363637i)
(num-test (* 1.0+1.0i 1234/11 1.234+1.234i) 0.0+276.86472727272729i)
(num-test (* 1.0+1.0i 1234/11 1/1) 112.18181818181819+112.18181818181819i)
(num-test (* 1.0+1.0i 1234/11 123.4) 13843.23636363636433+13843.23636363636433i)
(num-test (* 1.0+1.0i 1234/11 1234) 138432.36363636364695+138432.36363636364695i)
(num-test (* 1.0+1.0i 1234/11 1234/11) 12584.76033057851419+12584.76033057851419i)
(num-test (* 1.0+1.0i 1234/11) 112.18181818181819+112.18181818181819i)
(num-test (* 1.0+1.0i) 1.0+1.0i)
(num-test (* 1.234+1.234i -1.0+1.0i) -2.468)
(num-test (* 1.234+1.234i 0) 0.0)
(num-test (* 1.234+1.234i 0.0) 0.0)
(num-test (* 1.234+1.234i 0.0+1.0i) -1.234+1.234i)
(num-test (* 1.234+1.234i 1) 1.234+1.234i)
(num-test (* 1.234+1.234i 1.0) 1.234+1.234i)
(num-test (* 1.234+1.234i 1.0+1.0i) 0.0+2.468i)
(num-test (* 1.234+1.234i 1.234+1.234i) 0.0+3.04551200000000i)
(num-test (* 1.234+1.234i 1/1) 1.234+1.234i)
(num-test (* 1.234+1.234i 123.4) 152.2756+152.2756i)
(num-test (* 1.234+1.234i 1234) 1522.756+1522.756i)
(num-test (* 1.234+1.234i 1234/11) 138.43236363636365+138.43236363636365i)
(num-test (* 10) 10)
(num-test (* 10/3) 10/3)
(num-test (* 123.4 -1.0+1.0i -1.0+1.0i) 0.0-246.8i)
(num-test (* 123.4 -1.0+1.0i 0) 0.0)
(num-test (* 123.4 -1.0+1.0i 0.0) 0.0)
(num-test (* 123.4 -1.0+1.0i 0.0+1.0i) -123.4-123.4i)
(num-test (* 123.4 -1.0+1.0i 1) -123.4+123.4i)
(num-test (* 123.4 -1.0+1.0i 1.0) -123.4+123.4i)
(num-test (* 123.4 -1.0+1.0i 1.0+1.0i) -246.8)
(num-test (* 123.4 -1.0+1.0i 1.234+1.234i) -304.55119999999999)
(num-test (* 123.4 -1.0+1.0i 1/1) -123.4+123.4i)
(num-test (* 123.4 -1.0+1.0i 123.4) -15227.56000000000131+15227.56000000000131i)
(num-test (* 123.4 -1.0+1.0i 1234) -152275.60000000000582+152275.60000000000582i)
(num-test (* 123.4 -1.0+1.0i 1234/11) -13843.23636363636433+13843.23636363636433i)
(num-test (* 123.4 -1.0+1.0i) -123.4+123.4i)
(num-test (* 123.4 0 -1.0+1.0i) 0.0)
(num-test (* 123.4 0 0) 0.0)
(num-test (* 123.4 0 0.0) 0.0)
(num-test (* 123.4 0 0.0+1.0i) 0.0)
(num-test (* 123.4 0 1) 0.0)
(num-test (* 123.4 0 1.0) 0.0)
(num-test (* 123.4 0 1.0+1.0i) 0.0)
(num-test (* 123.4 0 1.234+1.234i) 0.0)
(num-test (* 123.4 0 1/1) 0.0)
(num-test (* 123.4 0 123.4) 0.0)
(num-test (* 123.4 0 1234) 0.0)
(num-test (* 123.4 0 1234/11) 0.0)
(num-test (* 123.4 0) 0.0)
(num-test (* 123.4 0.0 -1.0+1.0i) 0.0)
(num-test (* 123.4 0.0 0) 0.0)
(num-test (* 123.4 0.0 0.0) 0.0)
(num-test (* 123.4 0.0 0.0+1.0i) 0.0)
(num-test (* 123.4 0.0 1) 0.0)
(num-test (* 123.4 0.0 1.0) 0.0)
(num-test (* 123.4 0.0 1.0+1.0i) 0.0)
(num-test (* 123.4 0.0 1.234+1.234i) 0.0)
(num-test (* 123.4 0.0 1/1) 0.0)
(num-test (* 123.4 0.0 123.4) 0.0)
(num-test (* 123.4 0.0 1234) 0.0)
(num-test (* 123.4 0.0 1234/11) 0.0)
(num-test (* 123.4 0.0) 0.0)
(num-test (* 123.4 0.0+1.0i -1.0+1.0i) -123.4-123.4i)
(num-test (* 123.4 0.0+1.0i 0) 0.0)
(num-test (* 123.4 0.0+1.0i 0.0) 0.0)
(num-test (* 123.4 0.0+1.0i 0.0+1.0i) -123.4)
(num-test (* 123.4 0.0+1.0i 1) 0.0+123.4i)
(num-test (* 123.4 0.0+1.0i 1.0) 0.0+123.4i)
(num-test (* 123.4 0.0+1.0i 1.0+1.0i) -123.4+123.4i)
(num-test (* 123.4 0.0+1.0i 1.234+1.234i) -152.2756+152.2756i)
(num-test (* 123.4 0.0+1.0i 1/1) 0.0+123.4i)
(num-test (* 123.4 0.0+1.0i 123.4) 0.0+15227.56000000000131i)
(num-test (* 123.4 0.0+1.0i 1234) 0.0+152275.60000000000582i)
(num-test (* 123.4 0.0+1.0i 1234/11) 0.0+13843.23636363636433i)
(num-test (* 123.4 0.0+1.0i) 0.0+123.4i)
(num-test (* 123.4 1 -1.0+1.0i) -123.4+123.4i)
(num-test (* 123.4 1 0) 0.0)
(num-test (* 123.4 1 0.0) 0.0)
(num-test (* 123.4 1 0.0+1.0i) 0.0+123.4i)
(num-test (* 123.4 1 1) 123.4)
(num-test (* 123.4 1 1.0) 123.4)
(num-test (* 123.4 1 1.0+1.0i) 123.4+123.4i)
(num-test (* 123.4 1 1.234+1.234i) 152.2756+152.2756i)
(num-test (* 123.4 1 1/1) 123.4)
(num-test (* 123.4 1 123.4) 15227.56000000000131)
(num-test (* 123.4 1 1234) 152275.60000000000582)
(num-test (* 123.4 1 1234/11) 13843.23636363636433)
(num-test (* 123.4 1) 123.4)
(num-test (* 123.4 1.0 -1.0+1.0i) -123.4+123.4i)
(num-test (* 123.4 1.0 0) 0.0)
(num-test (* 123.4 1.0 0.0) 0.0)
(num-test (* 123.4 1.0 0.0+1.0i) 0.0+123.4i)
(num-test (* 123.4 1.0 1) 123.4)
(num-test (* 123.4 1.0 1.0) 123.4)
(num-test (* 123.4 1.0 1.0+1.0i) 123.4+123.4i)
(num-test (* 123.4 1.0 1.234+1.234i) 152.2756+152.2756i)
(num-test (* 123.4 1.0 1/1) 123.4)
(num-test (* 123.4 1.0 123.4) 15227.56000000000131)
(num-test (* 123.4 1.0 1234) 152275.60000000000582)
(num-test (* 123.4 1.0 1234/11) 13843.23636363636433)
(num-test (* 123.4 1.0) 123.4)
(num-test (* 123.4 1.0+1.0i -1.0+1.0i) -246.8)
(num-test (* 123.4 1.0+1.0i 0) 0.0)
(num-test (* 123.4 1.0+1.0i 0.0) 0.0)
(num-test (* 123.4 1.0+1.0i 0.0+1.0i) -123.4+123.4i)
(num-test (* 123.4 1.0+1.0i 1) 123.4+123.4i)
(num-test (* 123.4 1.0+1.0i 1.0) 123.4+123.4i)
(num-test (* 123.4 1.0+1.0i 1.0+1.0i) 0.0+246.8i)
(num-test (* 123.4 1.0+1.0i 1.234+1.234i) 0.0+304.55119999999999i)
(num-test (* 123.4 1.0+1.0i 1/1) 123.4+123.4i)
(num-test (* 123.4 1.0+1.0i 123.4) 15227.56000000000131+15227.56000000000131i)
(num-test (* 123.4 1.0+1.0i 1234) 152275.60000000000582+152275.60000000000582i)
(num-test (* 123.4 1.0+1.0i 1234/11) 13843.23636363636433+13843.23636363636433i)
(num-test (* 123.4 1.0+1.0i) 123.4+123.4i)
(num-test (* 123.4 1.234+1.234i -1.0+1.0i) -304.55119999999999)
(num-test (* 123.4 1.234+1.234i 0) 0.0)
(num-test (* 123.4 1.234+1.234i 0.0) 0.0)
(num-test (* 123.4 1.234+1.234i 0.0+1.0i) -152.2756+152.2756i)
(num-test (* 123.4 1.234+1.234i 1) 152.2756+152.2756i)
(num-test (* 123.4 1.234+1.234i 1.0) 152.2756+152.2756i)
(num-test (* 123.4 1.234+1.234i 1.0+1.0i) 0.0+304.55119999999999i)
(num-test (* 123.4 1.234+1.234i 1.234+1.234i) 0.0+375.81618079999998i)
(num-test (* 123.4 1.234+1.234i 1/1) 152.2756+152.2756i)
(num-test (* 123.4 1.234+1.234i 123.4) 18790.80904000000010+18790.80904000000010i)
(num-test (* 123.4 1.234+1.234i 1234) 187908.09039999998640+187908.09039999998640i)
(num-test (* 123.4 1.234+1.234i 1234/11) 17082.55367272727381+17082.55367272727381i)
(num-test (* 123.4 1.234+1.234i) 152.2756+152.2756i)
(num-test (* 123.4 1/1 -1.0+1.0i) -123.4+123.4i)
(num-test (* 123.4 123.4 -1.0+1.0i) -15227.56000000000131+15227.56000000000131i)
(num-test (* 123.4 123.4 0) 0.0)
(num-test (* 123.4 123.4 0.0) 0.0)
(num-test (* 123.4 123.4 0.0+1.0i) 0.0+15227.56000000000131i)
(num-test (* 123.4 123.4 1) 15227.56000000000131)
(num-test (* 123.4 123.4 1.0) 15227.56000000000131)
(num-test (* 123.4 123.4 1.0+1.0i) 15227.56000000000131+15227.56000000000131i)
(num-test (* 123.4 123.4 1.234+1.234i) 18790.80904000000010+18790.80904000000010i)
(num-test (* 123.4 123.4 1/1) 15227.56000000000131)
(num-test (* 123.4 123.4 123.4) 1879080.90400000032969)
(num-test (* 123.4 123.4 1234) 18790809.04000000283122)
(num-test (* 123.4 123.4 1234/11) 1708255.36727272742428)
(num-test (* 123.4 123.4) 15227.56000000000131)
(num-test (* 123.4 1234 -1.0+1.0i) -152275.60000000000582+152275.60000000000582i)
(num-test (* 123.4 1234 0) 0.0)
(num-test (* 123.4 1234 0.0) 0.0)
(num-test (* 123.4 1234 0.0+1.0i) 0.0+152275.60000000000582i)
(num-test (* 123.4 1234 1) 152275.60000000000582)
(num-test (* 123.4 1234 1.0) 152275.60000000000582)
(num-test (* 123.4 1234 1.0+1.0i) 152275.60000000000582+152275.60000000000582i)
(num-test (* 123.4 1234 1.234+1.234i) 187908.09040000001551+187908.09040000001551i)
(num-test (* 123.4 1234 1/1) 152275.60000000000582)
(num-test (* 123.4 1234 123.4) 18790809.04000000283122)
(num-test (* 123.4 1234 1234) 187908090.40000000596046)
(num-test (* 123.4 1234 1234/11) 17082553.67272727191448)
(num-test (* 123.4 1234) 152275.60000000000582)
(num-test (* 123.4 1234/11 -1.0+1.0i) -13843.23636363636433+13843.23636363636433i)
(num-test (* 123.4 1234/11 0) 0.0)
(num-test (* 123.4 1234/11 0.0) 0.0)
(num-test (* 123.4 1234/11 0.0+1.0i) 0.0+13843.23636363636433i)
(num-test (* 123.4 1234/11 1) 13843.23636363636433)
(num-test (* 123.4 1234/11 1.0) 13843.23636363636433)
(num-test (* 123.4 1234/11 1.0+1.0i) 13843.23636363636433+13843.23636363636433i)
(num-test (* 123.4 1234/11 1.234+1.234i) 17082.55367272727381+17082.55367272727381i)
(num-test (* 123.4 1234/11 1/1) 13843.23636363636433)
(num-test (* 123.4 1234/11 123.4) 1708255.36727272742428)
(num-test (* 123.4 1234/11 1234) 17082553.67272727191448)
(num-test (* 123.4 1234/11 1234/11) 1552959.42479338846169)
(num-test (* 123.4 1234/11) 13843.23636363636433)
(num-test (* 1234 -1.0+1.0i) -1234.0+1234.0i)
(num-test (* 1234 0) 0)
(num-test (* 1234 0.0) 0.0)
(num-test (* 1234 0.0+1.0i) 0.0+1234.0i)
(num-test (* 1234 1) 1234)
(num-test (* 1234 1.0) 1234.0)
(num-test (* 1234 1.0+1.0i) 1234.0+1234.0i)
(num-test (* 1234 1.234+1.234i) 1522.756+1522.756i)
(num-test (* 1234 1/1) 1234)
(num-test (* 1234 123.4) 152275.60000000000582)
(num-test (* 1234 1234) 1522756)
(num-test (* 1234 1234/11) 1522756/11)
(num-test (* 1234/11 -1.0+1.0i) -112.18181818181819+112.18181818181819i)
(num-test (* 1234/11 0) 0)
(num-test (* 1234/11 0.0) 0.0)
(num-test (* 1234/11 0.0+1.0i) 0.0+112.18181818181819i)
(num-test (* 1234/11 1) 1234/11)
(num-test (* 1234/11 1.0) 112.18181818181819)
(num-test (* 1234/11 1.0+1.0i) 112.18181818181819+112.18181818181819i)
(num-test (* 1234/11 1.234+1.234i) 138.43236363636365+138.43236363636365i)
(num-test (* 1234/11 1/1) 1234/11)
(num-test (* 1234/11 123.4) 13843.23636363636433)
(num-test (* 1234/11 1234) 1522756/11)
(num-test (* 1234/11 1234/11) 1522756/121)
(num-test (* 1234000000) 1234000000)
(num-test (* 1234000000.0) 1234000000.0)
(num-test (* 1234000000.0+2.71828182845905i) 1234000000.0+2.71828182845905i)
(num-test (* 1234000000/10) 1234000000/10)
(num-test (* 2) 2)
(num-test (* 2.71828182845905) 2.71828182845905)
(num-test (* 2.71828182845905+3.14159265358979i) 2.71828182845905+3.14159265358979i)
(num-test (* 2/2) 2/2)
(num-test (* 362880) 362880)
(num-test (* 362880/1234) 362880/1234)
(num-test (let ((x 1) (y 2)) (set! x (* 0 (let () (set! y 32) 1))) y) 32)
(num-test (* 4) 4 )
(num-test (* 7 6 5 4 3 2 1) 5040)
(num-test (*) 1 )
(num-test (* (+ 1 3 5) (* 1 3 5)) 135)
(num-test (* -1/2147483648 1/4294967296) -1/9223372036854775808)
(num-test (* -2147483648 4294967296) -9223372036854775808)
(num-test (* .000000000000123 .000000000000123) 1.5129e-26)
(num-test (* 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20) 2432902008176640000)
(num-test (* 1/98947 2/97499 3/76847) 6/741360956847391)
(num-test (* 11/1234 1234/11 11/1234 1234/11 11/1234 1234/11) 1)
(num-test (* 12 (/ 13591409 (expt 640320 3/2))) (/ pi))
(num-test (* 1e100 0.001) 1e97)
(num-test (* 1e100 1e-100) 1.0)
(num-test (* 1e200 1e-200) 1.0)
(num-test (* 1e300 1e-300) 1.0)
(num-test (* 500009/500029 500057/500041) 250033000513/250035001189)
(num-test (* -9223372036854775808 5.551115123125783999999999999999999999984E-17) -5.120000000000001197084708550423347199985E2)
(num-test (* -9223372036854775808) -9223372036854775808)
(num-test (* 1.110223024625156799999999999999999999997E-16 -9223372036854775808) -1.024000000000000239416941710084669439997E3)
(num-test (* 1.110223024625156799999999999999999999997E-16 5.551115123125783999999999999999999999984E-17 5.42101086242752217060000000000000000001E-20) 3.340955887615246120290922872835723707327E-52)
(num-test (* 5.551115123125783999999999999999999999984E-17 1.110223024625156799999999999999999999997E-16) 6.162975822039157611655737122931199999952E-33)
(num-test (* 9223372036854775807 (/ 9223372036854775807)) 1)
(num-test (* 1234567890e24 1e-33) 1.23456789)
(num-test (* 1234567890e-24 1e20) 123456.789)
(when (provided? 'overflow-checks)
  (num-test (* 92233720/9221 -92233720/9221 9221/92233720 -9221/92233720) 1)
  (num-test (* 9221/92233720 -9221/92233720 92233720/9221 -92233720/9221) 1))

(for-each-permutation 
 (lambda args
   (if (not (< (magnitude (- (apply * args) 0.25+0.25i)) 1e-15))
       (format #t "~A: (* ~{~A~^ ~}) -> ~A?~%" (port-line-number) args (apply * args))))
 '(1 1/2 0.5 1+i))

(for-each-permutation 
 (lambda args
   (if (not (< (magnitude (- (apply * args) 1.0)) 1e-15))
       (format #t "~A: (* ~{~A~^ ~}) -> ~A?~%" (port-line-number) args (apply * args))))
 '(5 1/3 0.5 1+i 1/5 3 2.0 0.5-0.5i))

(num-test (* 7/1000 1000/999 999/7 most-positive-fixnum) most-positive-fixnum)
(num-test (* 7/1000000 1/999 999/7 (- most-positive-fixnum 775807)) 9223372036854)
(num-test (* 7/100000000000 1/999 999/7 (- most-positive-fixnum 36854775807)) 92233720)

(num-test (* -0.2554913394465045E0 0.27042187315261135E0) -6.909044658739340841916780452607499999997E-2)
(num-test (* -0.4489211233229662E0 -0.42892136850270857E0) 1.925518625654598642702435865603340000003E-1)
(num-test (* -0.44586465919973783E0 -0.15168042462027043E0) 6.762894083058839862686475970136690000031E-2)
(num-test (* 0.5509395670465355E0 0.3577558280766836E0) 1.971018410289428517174637096677999999998E-1)
(num-test (* -0.42780066410606965E0 0.22704747885906007E0) -9.713106223951470697784938095387549999991E-2)
(num-test (* 0.20955388816500042E0 0.605628751935113E0) 1.269118597525194529275610775776050864747E-1)
(num-test (* 0.9993471610818964E0 -4.363771855901198E9) -4.360923015803940523218504871887199999987E9)
(num-test (* 0.10502219375257282E0 3.425205053451057E9) 3.597225487658284459716764716837978363041E8)
(num-test (* 0.7768651149081368E0 1.666066330143864E9) 1.294308811011790623456907580692100524906E9)
(num-test (* -0.6438389801759042E0 2.8922130868526487E9) -1.862119524290613178578671687454540000003E9)
(num-test (* -0.7427680566504474E0 6.763974500466173E9) -5.024064194944440168218138681386184692391E9)
(num-test (* -0.8563035843259611E0 2.9100478627456827E9) -2.491884415429230578930028553142970000007E9)
(num-test (* 0.6219502737119671E0 2.8868752190811842E-11) 1.795492832679837500144381979439820000005E-11)
(num-test (* 0.6767479505813657E0 2.9324524289075574E-11) 1.98453117144053746900587234314118E-11)
(num-test (* 0.7944531541461581E0 8.282076647859848E-11) 6.579721915772496180466156449968800000014E-11)
(num-test (* -0.4662914070981966E0 -6.921260263903422E-11) 3.22732418734836218212517276876520000001E-11)
(num-test (* 0.037804762510578516E0 -3.044514833184461E-11) -1.150971602284721156705916516398760000005E-12)
(num-test (* -0.5364168049485208E0 -3.695280705974925E-11) 1.982210669686983584095600640940000000003E-11)
(num-test (* 0.10343751426551051E0 4.8902635121181385E19) 5.058367017968254798845671333856350000002E18)
(num-test (* -0.45511004829813784E0 1.8210069906740634E19) -8.287585794769196371535086060990559999988E18)
(num-test (* -0.9675158737162977E0 8.097401718869682E19) -7.834364698864051180664785816331399999997E19)
(num-test (* -0.06573561186185628E0 2.6049125586869125E19) -1.712355208919177984462215919354999999997E18)
(num-test (* -0.5574365795036731E0 -8.822383181882661E19) 4.917919103979402413863422702119099999985E19)
(num-test (* -0.4222667103024276E0 -1.8561723355961213E19) 7.837997859065477747526525340678799999995E18)
(num-test (* -0.8412207478192143E0 2.3416069046402696E-22) -1.969808311420123220453436412175280000003E-22)
(num-test (* 0.24291385591230452E0 -9.448120185342916E-21) -2.295079305344524973092760016780319999996E-21)
(num-test (* -0.37792600430678414E0 -2.3929024368177364E-21) 9.043400566424941101603791982206959999978E-22)
(num-test (* -0.007648867433060369E0 -5.3162210182098465E-21) 4.066306981313632980042734472335849999998E-23)
(num-test (* -0.7631807323096114E0 -4.534410248041209E-21) 3.460574533692296555855373976182600000004E-21)
(num-test (* 0.4735366300649959E0 -1.3895270471326203E-21) -6.579919552833457409343160757567699999986E-22)
(num-test (* -8.64834403600587E9 -0.14057280586223464E0) 1.215721987203268063989050502795104980466E9)
(num-test (* -1.5525713051163936E9 0.10621224657238759E0) -1.649020862802360033147528021954240000002E8)
(num-test (* 3.297132746298694E9 0.05318660311813239E0) 1.753632908051865357781730185173082351681E8)
(num-test (* 2.1659831568875275E9 0.11704159596099262E0) 2.535101255067452830195785975470499999995E8)
(num-test (* -5.533403510176525E9 0.37778599060251605E0) -2.090442326495477997892444645726250000003E9)
(num-test (* -2.4217306331294374E9 0.6051350227557695E0) -1.465474021787126179631541139079300000002E9)
(num-test (* 1.4048311850866513E9 -4.304799039580996E9) -6.047515936334448947178704758694799999987E18)
(num-test (* -5.070278162013437E9 -9.116233758795675E9) 4.622184094703138120556628748497500000004E19)
(num-test (* 8.452801605894673E9 -9.002885976919611E9) -7.609960904339272295066535438875484466566E19)
(num-test (* 6.352601599408395E9 -4.484034289922495E9) -2.84852834019637276707985964548254013062E19)
(num-test (* -6.565407710101401E8 -6.718825369609182E9) 4.411182788445701880089696066398200000001E18)
(num-test (* -9.37193973536698E9 9.577576231327314E9) -8.976046725088278448381480077370724757202E19)
(num-test (* -1.7766859308675253E9 -4.079350537765101E-11) 7.247724707524128390808760574555300000015E-2)
(num-test (* 2.3810136983742104E9 9.195156930614704E-11) 2.189379461049416913728349262972160000005E-1)
(num-test (* -3.313966320976337E9 -3.44704749912067E-11) 1.142339931889161000998337758579000000001E-1)
(num-test (* 6.598963960681895E9 -2.4298605961767928E-11) -1.6034562503651679888964996364737701416E-1)
(num-test (* 7.908258993705348E9 1.528909719631646E-11) 1.209101404084048656249131044486427307128E-1)
(num-test (* -5.906667889594469E9 5.917852809041966E-11) -3.4954791162514609467168142486054E-1)
(num-test (* 4.86261281419926E9 -2.3925611132123714E19) -1.1634098327861323021375513143190574646E29)
(num-test (* -9.753392818607462E9 -2.5653634777279775E18) 2.502099772078991953507318766810499999998E28)
(num-test (* 1.5861252889272392E9 5.12939252547053E19) 8.135859201483165467280698143134187520016E28)
(num-test (* -8.422142961023593E8 1.0428099441045047E19) -8.782694430425160722507674279387100000022E27)
(num-test (* -3.109042783121446E9 -4.138252722536039E19) 1.286600476173334775049764879239400000004E29)
(num-test (* -6.459303282089468E8 1.8408981660472957E19) -1.18909195659417795593544068516876E28)
(num-test (* -1.432764110232635E9 8.98766033001457E-21) -1.287719715580647603395563949195000000001E-11)
(num-test (* 8.539623949953406E9 -3.498784805440049E-21) -2.987830652026891151867478398400020599353E-11)
(num-test (* 7.336784327799637E9 -1.048985206018761E-21) -7.696178219612118988966933703567504882842E-12)
(num-test (* -4.320357143553698E9 2.591531476439043E-21) -1.119634152697768142457549423101400000004E-11)
(num-test (* -9.374098076239548E9 5.5773248420603045E-21) -5.2282390072520541300690003822366E-11)
(num-test (* 9.118926580475056E9 -1.379170270330765E-21) -1.257655243712018104094987568109512329098E-11)
(num-test (* 8.145792307872788E-11 -0.06511382435429458E0) -5.304036895613925967063321178890399999982E-12)
(num-test (* -6.1928426627437E-11 0.2526275616632321E0) -1.564482741652978543296795912770000000003E-11)
(num-test (* -8.555119338859813E-11 -0.8366318482083728E0) 7.157485304113477734096792042286400000002E-11)
(num-test (* 8.243060442429263E-12 0.3939656708074719E0) 3.247482836708180702664407610209699999993E-12)
(num-test (* 8.600529286105945E-11 -0.891441509265547E0) -7.666868807288821095008580376914999999987E-11)
(num-test (* -7.531046724969747E-11 0.24398797995196886E0) -1.837484877349259372047496586078419999997E-11)
(num-test (* -3.7666526619188126E-12 4.659322150343885E9) -1.755004818033008198811983615043067932129E-2)
(num-test (* 3.032501107241211E-11 -9.592046453776636E9) -2.908789149178678011789796814619600000006E-1)
(num-test (* 7.311626957349528E-11 -9.061108567148174E9) -6.625144566303134478698468496187199999991E-1)
(num-test (* 4.898078204161461E-11 8.88014689134599E9) 4.34956539382539434542556734824485778809E-1)
(num-test (* 1.278207138618518E-11 -4.279966992086118E9) -5.470684362336102162321405533123999999992E-2)
(num-test (* -8.538580654966055E-11 -5.191059833953482E8) 4.432428307696650304902715905351E-2)
(num-test (* 4.0761422500127225E-11 1.527607426117321E-11) 6.226745171030000570391027616422499999987E-22)
(num-test (* -9.186363051001198E-11 8.557763803549676E-11) -7.861472520412421845045812851184799999979E-21)
(num-test (* -9.89183505930065E-11 9.717968160611499E-11) -9.61285381563042758142312881743500000002E-21)
(num-test (* 7.440627873114725E-12 -4.535521332601712E-11) -3.374712644646273959960130740919999999997E-22)
(num-test (* 8.701410920357686E-11 -7.032883383151379E-12) -6.119600827175551716944456414899399999975E-22)
(num-test (* 9.866226673114161E-11 -2.814669610817353E-11) -2.777016839025002299729708883583300000003E-21)
(num-test (* 5.192240545105114E-11 -3.366056660574579E19) -1.747737587015645175992519129700599999996E9)
(num-test (* -1.372355669576939E-11 -4.819955130360066E19) 6.614692750256090679268960117974000000002E8)
(num-test (* 3.637511103766519E-11 -4.071776382810416E19) -1.481113180452716050522430526190399999997E9)
(num-test (* 7.446388208685151E-13 2.7760294268649034E19) 2.06713927911698144246650226294134E7)
(num-test (* 6.267855179410938E-11 7.471751480940298E19) 4.683185621908299321917798617952399999997E9)
(num-test (* -4.336562006766369E-11 8.143188451558233E19) -3.531344165296609191472762946597699999996E9)
(num-test (* -1.0432655006975122E-11 -9.379512413340694E-21) 9.785321714202410134613576821466799999983E-32)
(num-test (* -8.167646898574611E-11 -5.810795749825724E-21) 4.746052788431460582580726109336400000004E-31)
(num-test (* -4.33805459341994E-11 -2.4289860591796017E-21) 1.053707413137706937228749003789799999998E-31)
(num-test (* -1.384613082275421E-11 2.2174009100764947E-21) -3.070242308741338958377843646768700000007E-32)
(num-test (* -4.910905591314494E-11 -5.456657623752349E-21) 2.679713043437427118620763024640600000007E-31)
(num-test (* 1.3653011366548008E-11 -3.925911962906968E-21) -5.3600520653635635667567009719744E-32)
(num-test (* 7.641468950470222E19 0.9034599537348024E0) 6.903761184457755820350566254132800000009E19)
(num-test (* 5.146778093125584E19 -0.2791459460022878E0) -1.436702239669392041403916711075200000002E19)
(num-test (* -8.874303077863696E19 -0.23153988023519345E0) 2.054755071819368785424861291991199999996E19)
(num-test (* 7.10798162637783E19 -0.4719034863212067E0) -3.354281310194779040746230255943679999999E19)
(num-test (* -9.820386602197546E19 0.03346146041258036E0) -3.286044775256677372510003197965599999991E18)
(num-test (* -5.210458089116161E19 0.11173798093222442E0) -5.822060666098160855554015008516199999997E18)
(num-test (* 3.257626718953688E18 -6.150510855712356E9) -2.003606849878328222529021336892800000007E28)
(num-test (* -7.755105754004988E19 5.514896832715505E9) -4.276860816013589383294629509647750854492E29)
(num-test (* 2.426235084788384E19 8.685431434428486E9) 2.10728984727342930836693974581298828125E29)
(num-test (* -2.847383850475709E19 -2.412830829567453E9) 6.870255538040273498936753499177000000002E28)
(num-test (* 1.4664659669727164E19 -4.8673539253155E9) -7.137808880686241930432174599520111083984E28)
(num-test (* -4.24770317054668E19 1.3102543269150825E9) -5.5655714586597020914994623011E28)
(num-test (* 2.17116835964837E19 -3.654789326884115E-11) -7.935162947711353824080778955354111999976E8)
(num-test (* -1.8125809977916906E17 -5.944782899600832E-11) 1.077540051981345570924422644657920000001E7)
(num-test (* -7.915462827540546E19 9.762153025588201E-11) -7.727195939080587759467382669774600000011E9)
(num-test (* -4.360953588949649E19 -7.152431005584812E-11) 3.119141966351983288172806713098800000002E9)
(num-test (* 3.550776271395866E19 -6.387656982922894E-11) -2.268114084477872045705002835620399999998E9)
(num-test (* -8.278954580496595E19 -7.359178231519021E-11) 6.09263023285252303789473682334949999999E9)
(num-test (* -5.5022682113038156E19 -8.979630229039327E19) 4.94083339585058897667477175561012E39)
(num-test (* 1.1716230943203277E19 5.5764415854118265E19) 6.53348774559675813536051493554405E38)
(num-test (* 7.462799608352103E19 6.061883497941003E19) 4.5238621794310193360802344979309E39)
(num-test (* -3.2160334983646097E19 -3.8817785710003675E19) 1.248392991757108737054938769406475E39)
(num-test (* 5.868090263060238E19 -8.37300331667736E19) -4.913353923516549470233569081168E39)
(num-test (* -7.3652924769962656E19 9.725738480757314E19) -7.16329084655549342691442378865984E39)
(num-test (* -6.447063647969567E19 4.0587529685661844E-21) -2.616703871973161409821231651015480000002E-1)
(num-test (* -3.1999317568381926E17 3.015031281949113E-21) -9.647894346969533174030688093163799999993E-4)
(num-test (* -1.5005852398726605E19 5.391316601974659E-21) -8.090130116403600588996007910269500000005E-2)
(num-test (* 1.0084552719733576E19 2.78150956101201E-21) 2.805027980846861049488413624776000000002E-2)
(num-test (* -7.171404412051077E19 1.4733392992015492E-21) -1.056591195074223176150038792848839999998E-1)
(num-test (* -5.909802783283228E19 5.356071274587122E-21) -3.165332492601832012651928738981599999998E-1)
(num-test (* 8.272641144282955E-22 -0.16191056182923802E0) -1.339427975482523749443486923949099999995E-22)
(num-test (* 8.410471541398583E-21 -0.43256058128353736E0) -3.638038458816019512260007931560879999991E-21)
(num-test (* -7.887238384137063E-22 0.5589746137044918E0) -4.408766028968254895651429959583400000002E-22)
(num-test (* 4.778995446616728E-21 0.21608373898977795E0) 1.0326632047200663557809034755476E-21)
(num-test (* 3.992449163872154E-21 0.9593422165456676E0) 3.830125030315009512425388980010399999991E-21)
(num-test (* -9.700320218813958E-21 -0.42620535269852766E0) 4.134328400148261975602018057078279999983E-21)
(num-test (* -1.7901566262876555E-21 9.461674014776534E8) -1.693787843332593653628245958251059055323E-12)
(num-test (* 1.0928019952544443E-22 8.279199780524873E9) 9.047526039267738313652918648958873748777E-13)
(num-test (* 9.942869097320962E-21 9.523169242022762E9) 9.46876251650656124754254949341964721678E-11)
(num-test (* -2.7432601692209267E-21 -4.922145522647528E9) 1.350272575938808435595052562419760000003E-11)
(num-test (* -5.97929682563092E-21 -6.147792689359443E8) 3.675947731212389417723913477756000000004E-12)
(num-test (* -1.3564305221188254E-21 1.0862842413758955E9) -1.4734691006989580907776383331457E-12)
(num-test (* -5.446806293721964E-21 -1.5358504316888942E-11) 8.365479797538664267835041412208799999977E-32)
(num-test (* -1.0222776562632463E-21 -1.9781477525280056E-11) 2.022216248196737715829186720579279999999E-32)
(num-test (* 8.192540157543917E-21 3.3215076993103644E-11) 2.721158521019146605658900627335480000005E-31)
(num-test (* 9.685592607330157E-21 6.034805605641166E-11) 5.845066856067266821880143244306199999988E-31)
(num-test (* 6.671870463340688E-21 -9.07657686679269E-11) -6.055774510579551477490933797071999999989E-31)
(num-test (* -1.109409648670322E-21 -4.7905821901849965E-11) 5.314718104539438656835419223873000000025E-32)
(num-test (* -3.9052432481663676E-22 2.0306112771345453E19) -7.930030979680167745084943578652280000005E-3)
(num-test (* 8.596834841113507E-21 -9.453548987989818E19) -8.127059931212420192062869827172600000005E-1)
(num-test (* 3.946325780779758E-21 -9.084484011754447E19) -3.585033346066809630978128408382600000004E-1)
(num-test (* 5.3518824877647604E-21 -6.814116447592617E19) -3.64683504854607466529059878139668000001E-1)
(num-test (* -7.456278485417833E-22 9.61914445493285E19) -7.172301984744205963559813785437470719996E-2)
(num-test (* -5.0781537010216826E-21 9.216915512986622E19) -4.680491362427717476508990573017719999994E-1)
(num-test (* 3.2906792172396555E-22 4.571445785546992E-21) 1.504316163923729767672342114125599999998E-42)
(num-test (* 5.39814714322422E-21 6.687033308557664E-21) 3.609758975123575798079875142208000000008E-41)
(num-test (* 4.3506183844841724E-21 7.266196706225928E-21) 3.161244897538486151238585450198720000008E-41)
(num-test (* 6.910763289107986E-21 3.910584203890238E-21) 2.702512175521023610171407324066800000011E-41)
(num-test (* -4.6131515924393325E-21 5.228174479773633E-21) -2.411836142691841383820888561997250000001E-41)
(num-test (* -2.1886866436065787E-21 6.29322016055891E-22) -1.377388691069093503544474490121700000002E-42)

(num-test (* 19813/30200 41168/38464 2571/31632) 43688873593/765502835200)
(num-test (* 16476/12673 40086/15929) 38850408/11874601)

(if (provided? 'overflow-checks)
    (num-test (* 22713/35036 2008/41994 58982/21726 37919/44341 59831/3870) 608349727545125531/546777281752405290))
(num-test (* 26100/43623 64347/64939 51424/56858) 4798021185600/8948293077857)
(num-test (* 13336/48674 21323/50854 60055/14813) 4269362918510/9166534724887)
(num-test (* 33457/53498 45548/13003 50476/8209 9613/3657) 369717652332927784/10441582621738311)
(num-test (* 31186/2829 35725/62132) 557059925/87885714)
(num-test (* 28682/22045 54652/61935 19725/39778 14431/165 5682/36504) 54173177045874781/6989848058967345)
(num-test (* 6054/59436 53485/47493 65091/13749 59111/51596) 5324119682728535/8557570117787688)
(num-test (* 26270/51496 62100/14371 9302/6501 11918/55524) 627970006908375/927532016146043)
(num-test (* 6865/57699 53935/1664 25223/46128 13016/30664) 15194818521234275/16975596844836864)
(num-test (* 0110/001) 110)
(num-test (* 14000000000000 524288) 7340032000000000000)
(num-test (* 17500000000000 524288) 9175040000000000000)
(num-test (* 1907348632812 524288) 999999999999737856)
(num-test (* 524288 14000000000000) 7340032000000000000)
(num-test (* 524288 17500000000000) 9175040000000000000)
(num-test (* 524288 1907348632812) 999999999999737856)
(num-test (* 9223372036854775807 1/9223372036854775807) 1.0)

(let ((bes-i0 (lambda (x)			;I0(x)
		(if (< (abs x) 3.75)
		    (let* ((y (expt (/ x 3.75) 2)))
		      (+ 1.0
			 (* y (+ 3.5156229
				 (* y (+ 3.0899424
					 (* y (+ 1.2067492
						 (* y (+ 0.2659732
							 (* y (+ 0.360768e-1
								 (* y 0.45813e-2)))))))))))))
		    (let* ((ax (abs x))
			   (y (/ 3.75 ax)))
		      (* (/ (exp ax) (sqrt ax)) 
			 (+ 0.39894228
			    (* y (+ 0.1328592e-1
				    (* y (+ 0.225319e-2
					    (* y (+ -0.157565e-2
						    (* y (+ 0.916281e-2
							    (* y (+ -0.2057706e-1
								    (* y (+ 0.2635537e-1
									    (* y (+ -0.1647633e-1
										    (* y 0.392377e-2))))))))))))))))))))))
  (num-test (bes-i0 1.0) 1.266065877752009)
  (num-test (bes-i0 2.0) 2.279585302336067)
  (num-test (bes-i0 5.0) 27.23987182360445)
  (num-test (bes-i0 10.0) 2815.716628466254)
  (num-test (bes-i0 50.0) 2.93255291463847587034176447517387076592E20) ;2.932553783849336E+20) arprec
  (num-test (bes-i0 100.0) 1.073751199431789167620943174959211991306E42))

(unless (or with-bignums (not (provided? 'overflow-checks)))
  (num-test (* 1/9223372036854775807 1/9223372036854775806) 1.1754943508223e-38)
  (num-test (* 1/98947 2/97499 3/76847 4/61981 5/59981 6/66601) 3.9223808052178e-27)
  (num-test (* 1/98947 2/97499 3/76847 4/61981 5/59981) 4.3539080668052e-23)
  (num-test (* 1/98947 2/97499 3/76847 4/61981) 5.2230351951008e-19)
  (num-test (* 500009/500029 500057/500041 500083/500069) 1.00001999432878)
  (num-test (* 98947 2/97499 76847 4/61981 5/59981) 304151204360/362470312515139) ;0.00083910652502692
  
  (num-test (* 256 2048 35184372088832) 1.8446744073709551616E19)
  (num-test (* 64 67108864 4294967296) 1.8446744073709551616E19)
  (num-test (* 65535/131072 2305843009213693952 1048576/524287) 2.30581222282939585599978637654567059645E18))

(when with-bignums
  (let ((twos (make-vector 30)))
    (do ((i 0 (+ i 1))
	 (t2 1 (* t2 8)))
	((= i 30))
      (set! (twos i) t2))
    (do ((i 0 (+ i 1)))
	((= i 29))
      (if (not (= (twos (+ i 1)) (* 8 (twos i))))
	  (format #t "~A * 8 -> ~A (~A)~%" (twos i) (* 8 (twos i)) (twos (+ i 1))))
      (if (not (= (+ (twos (+ i 1)) (* 8 (twos i))) (* 2 (twos (+ i 1)))))
	  (format #t "~A + ~A -> ~A (~A)~%" (* 8 (twos i)) (twos (+ i 1)) (* 2 (twos (+ i 1)))))
      (if (not (= (/ (twos (+ i 1)) (twos i)) 8))
	  (format #t "~A / ~A = ~A (8)~%" (twos (+ i 1)) (twos i) (/ (twos (+ i 1)) (twos i))))
      (if (not (= (- (twos (+ i 1)) (* 8 (twos i))) 0))
	  (format #t "~A - ~A -> ~A (0)~%" (* 8 (twos i)) (twos (+ i 1)) (- (twos (+ i 1)) (* 8 (twos i)))))))
  
  (letrec ((factorial (lambda (n i) (if (positive? n) (factorial (- n 1) (* i n)) i))))
    (num-test (/ (factorial 100 1) (factorial 99 1)) 100)
    (num-test (/ (factorial 1000 1) (factorial 999 1)) 1000)
    (num-test (factorial 100 1) 93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000)
    (num-test (factorial 200 1) 788657867364790503552363213932185062295135977687173263294742533244359449963403342920304284011984623904177212138919638830257642790242637105061926624952829931113462857270763317237396988943922445621451664240254033291864131227428294853277524242407573903240321257405579568660226031904170324062351700858796178922222789623703897374720000000000000000000000000000000000000000000000000)
    
    (num-test (* (factorial 3 1) (factorial 5 1) (factorial 7 1)) (factorial 10 1)))
  
  (num-test (* 30370004999 30370004999) 922337203639284990001)
  
  (num-test (* 12345678901234567890 1e-19) 1.234567890123456789E0)
  (num-test (* 12345678901234567890123456789 1e-29) 1.2345678901234567890123456789e-1)
  (num-test (* -1.797693134862315699999999999999999999998E308 -9223372036854775808) 1.658079259093488393947175407121858559998E327)
  (num-test (* -1/21 -1/2432902008176640000) 1/51090942171709440000)
  (num-test (* -1/21 1/2432902008176640000) -1/51090942171709440000)
  (num-test (* -1/2432902008176640000 -1/21) 1/51090942171709440000)
  (num-test (* -1/2432902008176640000 1/21) -1/51090942171709440000)
  (num-test (* -1/2432902008176640000 2432902008176640000) -1)
  (num-test (* -21 -2432902008176640000) 51090942171709440000)
  (num-test (* -21 2432902008176640000) -51090942171709440000)
  (num-test (* -2432902008176640000 -21) 51090942171709440000)
  (num-test (* -2432902008176640000 21) -51090942171709440000)
  (num-test (* -524288 -17600000000000) 9227468800000000000)
  (num-test (* -9223372036854775808 -9223372036854775808) 85070591730234615865843651857942052864)
  (num-test (* -9223372036854775808 9223372036854775807 -9223372036854775808) 784637716923335095394403086170723686146950778700062261248)
  (num-test (* 0+1e20i 0+1e20i) -1e40)
  (num-test (* 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23) 25852016738884976640000)
  (num-test (* 1.0e70+i 1.0e70-i) 1.0e140)
  (num-test (* 1/1024 -1/9765625 -1/512 1/1953125) 1/10000000000000000000)
  (num-test (* 1/1024 1/9765625 1/512 1/1953125) 1/10000000000000000000)
  (num-test (* 1/21 -1/2432902008176640000) -1/51090942171709440000)
  (num-test (* 1/21 1/2432902008176640000) 1/51090942171709440000)
  (num-test (* 1/2432902008176640000 -1/21) -1/51090942171709440000)
  (num-test (* 1/2432902008176640000 1/21) 1/51090942171709440000)
  (num-test (* 1/256 1/256 1/256 1/256 1/256 1/256 1/256 -1/128) (/ most-negative-fixnum))
  (num-test (* 1/9223372036854775807 1/9223372036854775806) 1/85070591730234615838173535747377725442)
  (num-test (* 1/98947 2/97499 3/76847 4/61981 5/59981 6/66601) 720/183561983334767209753061626751) 
  (num-test (* 1/98947 2/97499 3/76847 4/61981 5/59981) 120/2756144552405627689570151)
  (num-test (* 1000000.0 (+ 1.0 1.2345e-10 -1.0)) 1.2345e-4)
  (num-test (* 1000000.0 (- 1.0 -1.2345e-10 1.0)) 1.2345e-4)
  (num-test (* 1000000000 1000000000 1000000000) 1000000000000000000000000000)
  (num-test (* 1024 -9765625 512 -1953125) 10000000000000000000)
  (num-test (* 1024 9765625 512 1953125) 10000000000000000000)
  (num-test (* 132120577/12 33292289/6 260046847/4) 1143841133453061178785791/288)
  (num-test (* 2 12345678901234567890+12345678901234567890i) 2.469135780246913578E19+2.469135780246913578E19i)
  (num-test (* 2.0e-170 3.0e-170 4.0e170 5.0e170) 120.0)
  (num-test (* 21 -2432902008176640000) -51090942171709440000)
  (num-test (* 21 2432902008176640000) 51090942171709440000)
  (num-test (* 2432902008176640000 -21) -51090942171709440000)
  (num-test (* 2432902008176640000 21) 51090942171709440000)
  (num-test (* 4.0e170 5.0e170 2.0e-170 3.0e-170) 120.0)
  (num-test (* 4294967296 4294967296) 18446744073709551616)
  (num-test (* 500009/500029 500057/500041 500083/500069) 125037252995542579/125034753009582041)
  (num-test (* 524288 -19073486328125) -10000000000000000000)
  (num-test (* 524288 -19073486328125) -10000000000000000000)
  (num-test (* 524288 17600000000000) 9227468800000000000)
  (num-test (* 9223372036854775807 -9223372036854775808) -85070591730234615856620279821087277056)
  (num-test (* 9223372036854775807 9223372036854775807) 85070591730234615847396907784232501249)
  (num-test (* 98947 2/97499 76847 4/61981 5/59981) 304151204360/362470312515139)
  (num-test (* 8736/53718 63349/36593 2595/65149 64793/55654 43939/26485) 1390659088083157464/64205855201422018751)
  (num-test (* 54969/62648 20435/1782 23198/40155 17874/3641 36734/7395 36402/62041) 13827254253801875273/166253154009320895)
  (num-test (* 60943/34150 48303/50035 11510/48029 47829/30632 32873/18834 22417/2481 33058/12503 17309/26655) 1265424338804436192426278624740533/72495658400472874898571063803000)
  (num-test (* 27004/45232 47028/36314 65506/17434 26523/52475 51611/16322 12090/12813 11405/42722) 3271229108161979601346009209/2797073684091589444785715868)
  (num-test (* 49543/13313 13047/51213 291/3256 62128/1256 22252/50000 6721/49922 20433/22341) 13848375453906602673519/60295540932769356700000)
  (num-test (* 24886/21411 24103/16998 16669/52061 10869/30910 63499/50270 23235/64564 6966/28625 26608/32424 957/55396 36661/63680) 252953666671747144783991553669663/1509848199529034284126219405993600000)
  (num-test (* 10658/5373 33874/4120 50218/27624 32003/31997 36890/5232 20975/22222 42566/23821 32593/38877) 79446367034396970532424018904275/268718417239101417993099877056)
  (num-test (* 47540/33937 9597/40213 20965/57592 33167/35761 51930/46345 5554/50786 22141/42957 38576/15987 33878/10223) 94287693697494661741863470671584800/1654020197364120441179131115365910721)
  (num-test (* 25521/34695 63478/8947 53875/28904 102/42469 1068/32213 42994/18166 58634/22402 26266/21149 46345/3896 12489/21331) 2213218340996076291055274962125/53325428353972306616141560355198)
  (num-test (* 40953/64127 12327/6961 22167/29019 49635/32796 7657/16493 22904/2449 61975/28667 20516/6004) 4090451708614082328368601750/97539662436128754819974369)
  (num-test (* 10109/23696 35613/28646 25222/28402 1339/25272 54032/1074 54456/39833 38346/15060 41802/41388 56761/38781 54798/1261) 8983158114946791370557093367421339/31998667830808722335250880339080)
  (num-test (* 3039/17717 46858/6352 49984/23638 8924/34958 34932/46369 4022/13488 38433/34538 46750/2645 43883/61392) 6694310491567033247725656525/3103280388958588906030059796)
  (num-test (* 31536/12807 62185/56296 30389/6526 53321/20781 58342/28759 39269/53225) 108723306155880938114002/2235179806925856029655)
  (num-test (* 58784/29145 14245/16217 32388/51826 46401/13774 59002/56853 35615/17085 41786/53891 41646/4047 49564/4554 33807/36767) 2545383335773830668541245993741980009984/3950524525412306420222230035841219227)
  (num-test (* 39890/59976 16641/39135 36632/15382 4037/16674 32789/39049 5621/24393 7230/37552) 4325746891228381220240705/712068637373286863948894448)
  (num-test (* 64658/532 12056/22843 48004/41965 17525/20404 46987/34608 39890/37132 32167/52059 26352/16429 62428/21665 39941/30015 19743/16456) 24452413077816850567396233613920457829/58345020552056693855433778720676771)
  (num-test (* 46215/56564 13217/15837 35488/45940 34754/59356 39024/37453 37845/19747 12129/17699 11475/23380 3024/11313) 9665517455334091811247537600/174562349461714107552224378659)
  (num-test (* 20849/43211 44644/8350 39144/3119 26169/58795 48540/58870 53603/35775 50387/50026) 1503119635914748931419827344/83828469729567613584821875)
  
  (num-test (* -1412797070596191471 -15492755620416346417) 21888119755986895161222137392796809407)
  (num-test (* 16686841096925954110 1491135775021813104) 24882345731730524499708005167300657440)
  (num-test (* 13262412958100188045 -18379071970155621919) -243750842254847872704698616507823758355)
  (num-test (* 889503034794263569 -16600674457216690894) -14766350309325860687849239111838240686)
  (num-test (* 3148165694020236318 -11771070679825280729) -37057280896113409834434531491271315822)
  (num-test (* -4443818546267181727 -12001052312087213799) 53330498839175802532024121011435050873)
  (num-test (* 8305259347214213793 -229351169208067535459370186456659711595) -1904820941859811670566233132773219565154696335396051029835)
  (num-test (* -18273334758510166901 290047155020180552782039318570071650475) -5300128759437251944808204783222405076790289915320785927975)
  (num-test (* -703280433697652940 91110448009482115063492795153459771021) -64076195390496041906141380919369524419358692517527451740)
  (num-test (* 15279634596127882146 -220998726467849290098339792307263567896) -3376779786638352686104608499923871317791563686466157184816)
  (num-test (* -4472497681184076830 325612942672822430032905460436166528379) -1456303131067722058341139305566346079551678140995111358570)
  (num-test (* -6180420673489141029 -161157288800853703711204405567379740552) 996019839388256252540244286609069684717518686623358308008)
  (num-test (* 14044956603588468379 10163190459901171254101452124764637970005230126310661589196828892266636678427020930101076689732526935899135126391465178494895371156141265424428405590113790) 142741568963316278148132287599703960511135825069792278910440475692913696263448088587778211787403889397993501704943449376875999977937418748662459138952952917221024170426846410)
  (num-test (* 2133283347509865817 10577710515843519541178984366353275630877942729579274295972091544607384358263130633386329706527832990861547566574369528634541156662300858851752195966167381) 22565253698228972909216255630133478029433774404794962869038558824053350969301054394347471181756471783852326407546652836376109109470959746153989521923555764579738243072315277)
  (num-test (* 7812722507014599311 -5055959518947106416800910724733658104378582281318226107212861190073091017493970778425583956006925004399967175604321778956828368132273155364830637407968648) -39500808728232764770485117356353304373275127104839804121600969932458363071148383405901570717732548020267052999198017578112731079638156026910705662052515278317807704170401528)
  (num-test (* -17560801708050275829 9842515227842383346577123873881045824143545509071137371075701856197189100217561683579562062872293951325890789283651221922663521213150065638405410634222129) -172842458224605375239887212582262805312641302639067963604956593404910080268476692854082531021580381176489626536608405283010496488558204787140272050713264572452317265305619941)
  (num-test (* 16743386830114877156 7347065846171565625701636575261347705942035850951855454324853850791855951431141198155170102434274509450315416946729031216385536668189501958761688618635668) 123014765528775807847206414290825117502032199391400884957413813554539073118943905948723779020186281150198999824020769031248882909461419778092564985979904308229718874140000208)
  (num-test (* 12697192948029671719 -11416780209809507417142822520376617951137069007568339428552592261458272400645205700952156716454820410468812274673183389934216970221062627926131479014990611) -144961061169197993494569769162151457365959287966302572862364500950127981616038900865036521107816831702945678695331078399461327412574397914795455218447174498277798426197230309)
  (num-test (* 17005139720743105479 -29990519259587469661876904501488342396062731024702923152492275204626478246142153608222329335341363164148761307659972897552084842238285026253664841395295138667328930482145590159132144957515157474957872335043653264146346772142483721767458961320947069718037828473530001033848282453826154763424789967441239969918856795769965946388666154136004597297855416503729657013008165049478441197537144135384444157408972370236442813734429031404855591324183846423588871065272526864866155918285777640819778251612915859290336548446745308788013234099839998683451658620461972798204104633072664604846231692505409653434538208644416538994256) -509992970306921990341332390474393215554862069848994183152714032617297815196921655222705396130464246880845576204295466273071779248718654338767559016551390771145212884412809612574391658668778295682412755916528976282396155832617323980694289208942491001345059122414240884660276842648466533488559879226195446807748573906940273568334343093922652142252689341425941673567630236228358747411926991658260241924294146562230425295426217833820067881064577380516936937782688004146531121831211284735538742160763820814174631414364095096099434285754767091040812242751724012532803037860394426031234340719537172735695313262283511554154662650333168783128624)
  (num-test (* -15877530153400521290 27863984127681242643954505352420303514833683768731313003271701952957204538094398204984051331105594788039352443762851136101330385230866919393696564428736685568762923746771275677491379334452751710169529933675128178840986001684425353245791752781476028565228371147542431713985092322787978914276414008774443194161599919167210582437024618824616489802661351916633993681556274980075051797120207655478780052593534285265078265845445633803877185868676955831374479850746658711791169579387317321983669227930929736238215792068273805543745311609083833407544342964285215427999724272264458975101474080574470499647168865409458531868592) -442411248181132450919255517905812929771246981404050821923231762557171158858876183536414772404562764742655092127161703706239729646027465795612501446223663310668879007072125975886873343449629108246953385822769744013416908613100114754904323190537317463286500657291202287742354250227377164455244103312266617146454847578457073139633297517170508179596166314955134347046515455569689877574427319658085169791949003021426613961459610227430636932814700361914589752207776142403364490846294795496119883683491811246550808038342285518518431538295199537270236275774546666026424361019715280652576803278928827199810150387207105149968313623040090578323680)
  (num-test (* -14162897687527555611 -23016403916121951319848021112075986869602408568431399211927062304968548663313037929311574133954267816204873252195499803324830278637331653769648377216095499136975244697758388851688873078022850203685120154634090802825656419418077380419130449990938627982123188424119187922828250625318327074513352279785514062876718714640725789938556578327139793467832731546881422469843509318627826856881082450937188956068348931459011923844607158528494902828851692203126881727638511348944908726926619613375594042390434147948508706733126737304560579515324106834237197081860910657003346633962662773394999353766192391746258372744063777808796) 325978973798843759388794644178802841408656469654887121096165875654577046313115917671847505813174070119516580105483409446057747653173640660143855580491229746795572929387698247460831363721394707501497262525550824977473864621747159715947297817600227665840640555029633517390896890601028716769035575763283168066843141870124768085499453574902575378368669494153555135898430469356384416638130459557518713454927909937610851489821263029886989981438507377741962130296498574556444168140838201069779040087521405032426995145166201901368032136008107323350679784004016321425234898132080844200202007395427054392280809376612533414505539109579739614954356)
  (num-test (* 10844738523441551664 13010289169828379103330191247192587220592807931898339555723704078985668371901953113936581573750666143303899278973814509164982887504269303358034042953769514772858989849512527461308415676004712388964136857232374888643347097138114199889581495448978914022318770898259317738823514820591042321773469959130347470144905381758960436645008051488666423115693738341045851119808222048272924385188356021826450267608127588500233526688704136268009202730309974485584784539415807259862449203760469406037505772435323036790641520939576046423540699016607317147689982042035523118533555744274806239272109508745089640043900389441390176681340) 141093184161152226992592021994885140117836445291515772908453669279294934817987511015413332614094493905560980363483549300117114491702466085602279965168041684355125886388302948336158133555051817733078300668260616983283027038746214728386770752826764135491650323133831923154477800324207350667020747545837613879364064704092093040155243919335078139087599906324684688427176309081290932504214653249366429592335409761783188358003723753633106574740731573467850133547164922532633897844647383889253777956821171583261238607289172489135768839436605233457738153233579088224808850428203888700116300637190661108848906846940291749737998056247719674749760)
  (num-test (* -16402132873169057380 8202725117980211375579199554494319645475746305836527475507064811368616698686329266053570766100878145903342129595869654087772486685252653587846560946850102095086896668181099435964053041678323706849735936082196618754721606824996486473796843333331029865501790248862590712245450877098960007272754260813822886287008295409755783478345202299352891066800825979067590290793893933819913530599309037639082839491869155044147367415785329077864525961799400923643936705317921900308490987828345313709179960659814100113658528990241758360711799009722683007157350272749544178688961738222930753008443755881419398858537860612954576778456) -134542187307192759584182063854799850608007421111316277594191532129597970622559949723743396309231347084450105499455916612009290113746722460358793168839937004812915757145655285798961178877391232945062437277255128401572171216279188126380587081673725314534095093062983435026047851041796084651601813918099532876684901239903769891552275465470747567830660442193995685219383258617057944010709906130655663966913354414611799232001438943448374556294933488875450563987147224709383408815994320229340710143082135667640802837699940654151297907451396297241124380508001357553893328703788960812706653503939250831164194874527033594779746890593262611805280)
  (num-test (* -12094905083549825231 -7303327854122277566083382629094740392048421584433028903125893639493993705575691832165314461496849401726460344615713884253150283931509897329926825128629833541892164122168618243719393446304446866677253728405617434021389128710195093788280203239300086905325641224801020413858421914412156234316517981228056539721130386645649016559425091470643854813419057026759188125291655398451427686659900364573485593902992038773538760663063071699966278379037038361219424927031644750173900916227834573604566165762753650347331082640552394430002401423199016978155236550541225512734287851807727860645247391524620773399994302380387697957581) 88333057189654571362020288527489792875655269960629008914349561689924145109953656394378545526256758871407020025766992398117775520525507898420898102744530402370720932219749861094609497366188371774072368034971851022164946370916317410415503705484491514312339956381120953283812334833067601825812118392757289250628861166579446800637104996060739031010579056633535166403083327528575504427815713481850979373113173151813491831551023902022537957860211597622343157802805275942920911544696695931809085743355666792408029743911424760065578742910735408262758198787195579745280191859776661700139596074108035867940154338953640690242795671183308201526211)
  (num-test (* -81618231044418675360403541307856740187 9751573706924018395) -795906195858402819552264165081526765614024708979523739865)
  (num-test (* -167600745660011044249531125104202473984 -12960244919927910377) 2172146712516287908809731894157839567367040369214826131968)
  (num-test (* 90306383312124738690336097936949488486 156109477991590792) 14097682358164298866835386043901377722456291173827620912)
  (num-test (* 126202800261728727198105694812165074067 -17404362862588500316) -2196479330029905727399352310201914876903532806486592905172)
  (num-test (* -80093647977875266525946940496137725572 -9499399805878278852) 760841584053111508349403804472960020663660465509267203344)
  (num-test (* 304052889577333477963637861956318521374 7233536405885618691) 2199377646072361697737485358722028853038393128548297401434)
  (num-test (* -124787646062877233829165925777950698937 -125798384154373172164515376683173327013) 15698084237137783175768362160964949930745617334715009097620154581879012485181)
  (num-test (* 259623502197082370239517374851053110076 307089583871541575627915295134832918432) 79727673252974285068387698133566605944659309374400074880377824560177225320832)
  (num-test (* -245358177397026033963771466683003477163 -285087883756432161967673595037725276963) 69948643556453419103498093570621669430956866597291662675473644085666220495969)
  (num-test (* 46731711386059374483493216849082745840 -216522280665540473581476116002923812173) -10118456728713381305690589407461434638634240429858378588644634276171257110320)
  (num-test (* -301422430661955757433852743238845048860 -737194742467573013847855072675441356) 222207031145790358162820429948896977201848379524899474475604149595884654160)
  (num-test (* 109781582310220385246795023904554278713 -273317662617851276579672019029762858338) -30005245475518685175699313262818315773200953201653075289648004177366787958994)
  (num-test (* -312236719893391897821327608828679767006 -661158307192284418474080017860142217763949256471548515134335997907628404839044913830388499435166012788226998900468665646723366842553747501004752506346280) 206437901167986463762021023207669068873036145952740267172145693855475451354717023377588805030022300923600718715029262618794758202955817341818233889201852381575043965927328029955969846754837680)
  (num-test (* -134379788461141842858846278268259347105 -5535479645589936472405910397299739073641612836770238183712206042659632410776896398062277742229906915852933418684231779996404071421767274180368154310128427) 743856583805332082970350662728998610690268824090148728726850517499798631519601137183443104910590855501252539324674812560702657332874686395923181633958702249128106139207076314713649515720653835)
  (num-test (* 278271843790644800793473851247546123375 -3845690285506025443856370771250487683891303505653819308540635173436088084480277686684743918745832832765066355874381847690771330587033980524869033600561589) -1070147326395532917564114389205677334125034378502074943828571411806344559859053091006175486397820822872698474899835730026158782698085673635033947150554253148685482702599776833910878579880042875)
  (num-test (* 22345490710865165412267189692679994671 -13168094845644809414256057134926669929759930873747535851687323456073141938879368460977723280750841588750507348317544461824280674332488497533955177541413394) -294247541053147552931885013427268298282376074124656716577088212043667912662239091316191145352314750820026626159649861330384837204227899202392764926604802655267738710003310052268554637728023374)
  (num-test (* -223445051950608517881717261787296926498 -2609806601119499724524852022247741111662431776874117401343811680374867931883996125145979162937751368655661775097445043144114599069842524778189198926688379) 583148371568187658089071213924575304457465978545376486297236105670932990897420147110485946155066725440999079357995678147717407410446012970360780626554347417807723098476525833332400212113766742)
  (num-test (* 12604140228725912459681435851589379433 10671266866958584640992033560488052420339425977492420594983497264069815016478448589306666811246532193922229713077112601565462530332258877522384022088660628) 134502144009302626262781543880199144227907004673612064586081220538754991037447647926963488301214672345398823354945333417956344119228084327815583754032364976497975702972112644238248704660063924)
  (num-test (* -221289678591114384943252477126208006780 20020996887149770966522122735176842174467884990518978494604707026520269232864200848420530223248762875769520715632742683760311747174524709550334825291720803698613541109690224185041740294906022358446325921538593105347423518731748623037078340006459454656405997570119591344894717789372844612253617591807770017562530034107842444403952657949565007792107071767260484233194674888488789619319597151367813735192433631007526015463229060702510632792171187339118004038505860316305860704455466207113207893106982258864355430481457640304138738182009363353560090082819036973601710432437342931523433079941958203038050750205966472435692) -4430439966231074415853738608900692925851705818190624801199561884242897308817127146763274284287396980593383317678766559004881552228480591814939402896201244425805503258878061459604511214900528594870260206969839682573246490602076070316760182753341371682323914671418233629420599310422437691170629449435494697829163966912842611408632129590129483811802031178053300073562716917597174161526976287351465154825036851645956354853960835948518860624747958440181683978083391663149733813297698623499283645627889274004656942800842013709298338912226207338477579862672216831422765369078886850523202897989792734789430796029206661261129141144642117177625405158700499049991760)
  (num-test (* 180785619668676509441152734583033930295 -11909038209406834057075682058438206007134213485822042209417443270921391661498900475635417780140585878716264253792335317341527677051828500780153492153490249297998660274828986996948999762620400587091118252205695562417522111840305140989214300921122857271717052213225664738544344394774362885331856170636862181712515248810239601812262573113794334115259873527539564296101166439562124016438281173202196876398090029995104489712272260608848551754611421227761245487365953257890749115194455096508613617028024932657498899001119282498614739316599704645009607294747043489655424155986912576002393048535846081096337705941547991821928) -2152982852345560218506186041143281789706715672110278207735389192913214838321097754496849942223194392302524369156102301165660674797665128931611291246607346536492650554391248756408556789391955568308599431054809433808337036546281323840555452571430884302696950144068129601527530304907460164571704857360215834011779559395577299313379666503707563751314135201994045874159291100986903645360754621200008830207429980872071814202801994486961737459218017354210479544121100423399040398021780750351097082070296255480707530391964970754186799748521538525274241709676878827522138880241734356460339681718690408853314007343934035505873192699052380699509877559455199604508760)
  (num-test (* -196121729286794751535600080816329923561 31755463535476988506639447113088283661031267977524968610501132544098607201258848456920865390506381665724254592728643925608893982794532243733117636645689751360224314774452374503339856173343683819017479955914451013484169313685311530532055735999039466721411777061709328450052490025363788971916050033904534189719389237878257877112162843506491071470067738867693853480174965212750301808781573369342701195147083717623066339671595077736036738235636996351642097684597005928843274525502529735435418805821748637387888409663397547514467435322454217015563134545731593492200855670248739786405074231658957946422903165662016649229286) -6227936422881500100190187768375947805694946596622670066116457374856427496311253030141271922822486386675428302332027411428470488965226898801659352566022706152307022438261392466548357753526474097246042956052374187605144719189465046544498482461077851578811186829094445089366592317045580466302238653533114619908864036973070346979261546801894831273337217021756025770590122176562027129481076270727248949609326868225755958667670279949371399535144788247565199415296122873444199709788941984099349149684384486618280260678252604631431089580057102263617056951788273430713908768738965854953667135156866028646584137788146112300214498814212865170902491169332389942607446)
  (num-test (* -149247491509558553673630984739524508601 -9241905448313719916485289537122695595500213295294799660583133638026091750542612875183284894676615989153030773719811347110864468582634048542108726080717551794580656021381515769591713295631818532114918070215760259364277583650102628486861397602958930509695263902920994329409932518607260720657755504091822028630927071374796474717671220452208310602827254296323761245420486376569048549643478954846020045263141546849795367522490793641049509748005893155533480849922847230018411440739584477452313387881413141538766185123978087175960946255649923135634987656065468774634483495944248865774633962770893338531522570776854773975281) 1379331204929344851843348280532786532350930013132149419346606977890849868537539899667631713548510207947097949976792337278764045110931774279794402312944786743575421497528669859045492875676005849752425421867514661792129580445000023570590786705609341859529483054902802038173138834528021423393677908655442991197348183257271932188161681770513283703502340499171444058119260228931558784004778969491586252899270869275893402714040693571919281494643765571068045362364213060063345212881008657925426024923296369533374671614852576576041747836643356665301762059898161073609265572267138950725010661453917338098901465732991316661901878681888138048552901254914604845891881)
  (num-test (* -246070233154436622785727814428081917418 29761582253452470642591719346200231425423204062498655510037025199574178834762931489817919404889920159374886981199608181795387339523762458361385170203883094308920011218315748466148953320570427838912637152446837553950810011344492780712558515815917745810385725989241835877316836808088478276603934260581342710503593237081689944686263274319354100341139245512159619947319496638082702549196795236216458749363904150768879765280332386830831409591769966706351022328535490587838695167807967607003680703048770719240872629379640571077329748828739281770075441660330884779539288220944313294762143588847790653176774089774033399559617) -7323439484151992757431054484912931979861244043627630118213112440051387392428853497035249623931234821362770902740177541812170377563064854590834087655133962963430877452052749127605572395112726398103244974178157574726551814002744001021805127518246639418981066588073652668879613252372759895389345727455380224104332342029151667860553645106555190741775758687650292791318963679857313030729683299101577207875499929500963723267185390425716927303375831321783415003339099100562942730763231688479910689887284950156875532151104047755803876078837921949287811575034368641167438367411569736575067233548122814012421044943430647665260439418887639347030312118291762161708906)
  (num-test (* 203826295936164259559522643510940430939 428315860474710981601019542870649234168732095026625500771233691514247613083810271191136212287636290276352210600151884730196161003906066671915478570992925366265552107746965374246537358349673161970290367972281768471743836339191023211359427335141701167253694144280251188008871929010775436125645541749886873478179599464478734149706121117222690271210887178499620737860802605991262799781279373870647695125320153193063528861104479576369448865373971847676465682752435142074973627172566791961541105525781297462635428308325033717669972726101583722868689418677558787287897456521530400671342257419067050354522203242849353639864) 87302035331271280954456598486072605056704393103691656908943847729634903654600322194677794243221825233700566108459784062758955025931450719283517278054268553004951352280583820782976072352456972931479389375165173986780482062859853305469143408707179895843295115510597584169486406323435925707638987591151227843652210256611991940374072593149367903739596883229844326054223707236369465710416960023659329202073724249764308867733476242261506975691004092043954515337899900837434270833782490145948781128533218641649564543508314976001614187701395586824982250794852925954991265270537649691628899148413763865280007928191637215283244406869662872539567459561720369352296)
  (num-test (* -5899540498246269366107488541138263797694914692322476860852796858749106720144552037986906792251681094769894732746138541066810195167688318229720888479512583 5834015210744942902) -34418009003174534626858248456163154666511779871358190892629413477534042866009573638264296461516598238780495750056279721797403178867717911762916049857737963922333901125535866)
  (num-test (* -7558198374656605586076446665394545534375963428962439959101805545423930654069723860456022097647139432324162475685494459942871728608277717748075653794546685 -2079670855873590264) 15718564882684481784074014915267371190416032453294568239793060140651422710113447422494938907375595456199203928496644205320139985222135619659630853564447794621716315309474840)
  (num-test (* -9442744083812363570102321552182535031605446031706376100893354933468482520577272174689455502380973733378565213055641110431767353396963744600184737808983381 -7204974197101757391) 68034727473703353914019458883709211780958983263702756416891835054494728840771498925306650413027883039860202168095834137357212487561983607389479135319040711944281262212918971)
  (num-test (* -10658732210276096534851972646242288663170038580488752611749460640657411087860047053151548660331707024718100598181073744715506934778234716535781332588396176 9193953347013373121) -97995886679587166046252015742839992974979220158813197140160489510432960510418039749924861744197553021702396544307690217470606424904065359660871469041838900287446937257585296)
  (num-test (* 3330096979672637104536573277593029682675932033891010715180474877149733802060455951241981993421466123791200840797318740359792251505430948855600408060492000 -9413190658845804679) -31346837782105095097578725347257193539696338226258990009265748336528353873277500144838721882313026604404426563737656928378230261942407473822851842589487713775609448642068000)
  (num-test (* 2224201331350479188470378485954814766783857696988331736807430786504130570570323948774102396158334805040994159865821844362926631687258969480929122732089195 10226747830478556903) 22746346139936030910929166328517425029735137934434969334578972386859485783192993228082340012742115893176871887387993591191632260444955081663604449277961804869872353878963085)
  (num-test (* -12394770820700925077767705800588617445613665027183406054209162910642613421436080064653443098327137503596792411463268187212855350864330592654862321763110243 336135860956209890623046930607725140868) -4166326961171213704571179876442248501325782360170764344978629523457550315208845439497110652079907652744850691289494398473488033083739905461347650605270023127087625641779424751335704552988710924)
  (num-test (* 11792778994619176404079667787533709801900490264171877873621265044313417667869688303207909681289642260521608966405181881416781694320672906600599581862090088 -197661229068721548419113517262926820105) -2330975190212228827672814304508257223671550753091700552243633152084831515892056240354560520878171696176381845689952044935988868477421447557890739834031207059212175922089523097911477486879619240)
  (num-test (* 11608994516281296345925963401821217560860934641820086911326880657644311461955556832927259499969983808078591149768068360172431078248807463030805586293656663 -40654941048774156019243747229920736005) -471962987694958552110784676392477007070112288398143925079396435246284471999814508543057304008480666763661066976653446723271982094424149279649226771823800871458389214002872916339341019732251315)
  (num-test (* 4821517917539756801293776911844480642406562140007084392649374723119190602353617113036081438891134008988421494142194891002983491670246762173236312873933599 -255528396376819316172341014108564420589) -1232034741571035406264710387186737842510579499938716343220834781077329515145216794636313459582844773420679078031627466542930137302257934575129329529129776153159694412903937370462708576694469811)
  (num-test (* 7638751115643228563298483305056828584775811590562130101723525925933790010789130133831569153863129513189315440899053288261039147463032870669035935364282061 114438828287750304954799140618669114911) 874169727255956505920153418854946321208907128396839975975317705220623267360648189969313978740314703015845506506608054761304647627635292132043887080298168302864314697920637105700927041824911571)
  (num-test (* -3653826017463740005170218884285271512636869606149686475539243914909566619638259666405831445823138528809165270360144267462878986866506114069923299116957450 215752050445782448772085819939961259625) -788320455239949216234629350585027855111249573063377172522422069903710014529292638311216050777840734448624510386643245486023092483841464815987597578151663227035102742664709136512524899527956250)
  (num-test (* -43242564273985683175827997542883970694363047476880657467026050730764924897992516355909421962249292250047896135687573746158665836208681548975073555418266 4424346097667245771102179669235543742385176589624011161914909311078645828684936231569739522607200308028372644149306431599085361996722603718517735348761218) -191320070498733614136284309000213964486426347688040889144514933290125387693498098446328694172047943298442181705949005984031677324306763731212307716485454004382079159622650481983102917517993601466178931324415483972311904823997211920702201161092866663969163567426868740120661073974542958600768774774949607988)
  (num-test (* -5093597555679260616199210906198149266592665304134802327659606846977583233938836318559188141955851256260954289429418183711191354912372372976165948043123133 -2240632735861652612028397136046974907251405868353380459030143407902436514978447480884513019736738955326732458088791830752499716417751919868492224207936623) 11412881426559848135724717164530530041659963797467536748076144863846600718211858527283843975968920120508569299672573958424908957105703597501013710262110218780710678312197455759181436286391257283676806548463507528765947919856827004176416634630489598937924092540289712219714362500246928243091408698274649199859)
  (num-test (* 6049789822056553589237940133475342650218069231558204589924996117723031491205673061674252841792149409384720347601549237626288416453061224734057079515141650 -826416247951451524584060567988229017033981218652490450160817307801130685352465013890931297548015267655971295627931896259998420078888499206031390299169584) -4999644605638856588581238481465237523157457201817697008198975191261856978252081380810200468420738807464233192102972784271159116426108806200426852134469939032473362689081653859652824862066224063273799612269941254948709760659691148103622071316554194507524610166457990087959160807415102946877307193349131573600)
  (num-test (* -1175978338162966145239180473229656000174129248706173549637767835154921467129547950144109700900405904250603515318348888619371004435353505449762899046094747 8633693716102199391202401198009047492431980605560930404972542822133579985462906768067706391388213605203282586546130434156768523403030127356256666478340720) -10153036788469908062299722391986722149392791936544969945546931764708792252481931153733789787389051773529081688846141949513463792442701686406966696738286561777611293604311491896230769507535896070984747493738525389837795316954065260075941524322954935690803870500012809797698319359975893462672845329776468197840)
  (num-test (* -5083395547684319640767882199938390155755986838939007846911062687871291096073452055061784159768637502151635665247461348347470360218957222873087414506633886 10813098236568616588240471432239693891825284805405416395976866126102880121934298269375465735278296789484402954117593716698067735458182402220278016922449294) -54967255432446073625448401244836956268872685687128644401372608170106281377801209665004925733448944141633739594240156882328181133879414641109484442890809130544146420476457200729843868300396656004198615619691952536924980482714767859804902602805398865249514544806725162402291122143659939645240358379962457176484)
  (num-test (* -8944626200084865988157251013718979706166428261352840753194709093968177704853157211364231059892647813839391802007588961807572842923682104089512428902387812 3814836951264415657788614449012480613328314590744410079075164918748648723114236698412482309581077603776489883375576245233128800002373843611668945838558629) -34122290543331565327874124324135450224668275222811493728051290368641401807963502623692504750924543845019291736982354932620821594287780848608647686402233097059022704206628297180782771812500512744911371653368388270442874670230118309469599458827222162362901084328510647514081302476000779049412605744638457029748)
  (num-test (* 5186176030253526423885531264483408352469356233262336223619904269047786350470477526433506158542551137478071074193659876898065998079440819597952826155782068 21428324964794197485898135923805540163916541943812058590308650649384013587098638034673796533027113673143959572855470411726978105342739938341516634354246514986124789451866589211982659199267654387148420461876524076040233779391563396552267276880650559148637067641021059664960876301072636635299261389450890094318429077561092553337025096293793433968243940381587994428364726938534453507046761494257538813861046058298873206568935790790373886840765817404479239485444563488020955730741209738203470138117422899051269778988135668626686262669881048094388220931264751830393793846372816717368806996496715219806062282836392457741918) 111131065300898907482632501071313138589398597291097276435916516379173430095773463468344138866282820740991088290299992221985607057347883717514843661030457396422379155394966857856069231504805779448809986906434617741485942621643754096548512120178021034054648207248963478122178145159262707381679354401629366698488021743300737044695960363216253889163551918513521913593214414139637549577618641974388739304727218804595402055185824193445089425262833385286117064481648652550355832014346131722965510192584901901111154083186713580209077544982897821477349293279848852596241762198202012197892321827305803333334823616660229870976569043453639028059771892706354703750763908127611939169337399882784092285804830644630059487027413697220038110815990084742241055099963659761569486906596326424)
  (num-test (* -12615422028124847936088012564413126213419674293830655240645918456932358053670311316461359727921727680491520480380615359506308571290338231702217134487397730 21538722931308708400287621200994476771789912594554241036641406577761480056366647329031140922034590767810855360008375309986798226712928670905618807986829790199948665185268081173685941421700542631395958882077936923141152528333121096909688700106365468854487023847026564219531968849793109908193037522063952753477768381591929787242143631287330811801315216116212154423972654430356675401769729358415036943501470085182304183033246682446978634892995900678975109490698283226559860736462409705544079080978470202336645384768211440438501339641775269445439018148409151795830925198162301321965042997632479354427154223366199106583051) -271720079725309675925162538296715595434811519956795637977932956405490708202732964133816538801099235844279338645471102896234318181092598033040518838847055114923365599862266767493227393553801736813141780001130539648588341196802606083178208108557367013886856183999712817955194261262279080641101769944037282423238147653270651419282545398168930625797556638625301898893565965773914460998322350526545278664715332414172614761548301364063397364632709194713561073496860524124460861314674679928692398440036071116570829193414179054372604203478369755566003622621281005164747628075596444178089558747835994702060740334079222508147598079351187013336751322569865313532407367116553748939535664259669808534100091049960040092785009707220249025633808590643620557093069849490009472441113874230)
  (num-test (* 10381022953674450046578890619826448644067144294659610359943634722044183130638243233110364436029778310048006743033299956844491228999113516347401915490861208 -20974871685432829994714153210121536409377362402944992609230062091789259307033495284524234519701670462495676590513192861649457148897274608767543942797542628100823017887236899471151903799837558453043431373811892813126194662218472834650841742305925226558315372771353677064933578639099452438843500601586038910108679737480263349221244638463171088589123712367802373159421798288708123925853179931628847579314900787361946716531755600236755527982132768286927549323465697241340003870259800347640599467922823203446834792229595507968354687630029075884034263531531423883902851487995214646322431057626558858528344843531280263328354) -217740624416854507100100919338835880277259264187442792458843251425095703739537223785767883764746809214920580060316177442387941385712712426957388995082877226019966428812240179251716274377143798847348759498926420314709056615470455134468678662646006408843897699718742372199854223008996321568642038054564397441209859567556502098420151667437837356649730396360374136203172669776530655738388121236079327354422138744456395348910073462618440421257604563050031602590345028438897601523520973759458890228893913090702884911857207117714231568437403212806578764580006787626657709435954760239671948147344463295520930250155876010414461245194991189183956653772752290656063730950237649394743456230607077768595983629559996700837383822873994717987698780007691157576205450973669241823945091632)
  (num-test (* -3984492646329789478973994496812455855595578196959138558282015917391108383154917581748539892089090551298072688793487597623310815918942283997753800645644511 22199897116873160263914990610762123553075230334116099569358672964060004245706770678771431369917479502828754815568950371273785689812698287446020480951417047185190067265849637510591502642000414540862689426343523077229502494771352820057572619644085930901096534031496492870227890836816886496090287321502805172125273822231241073590840684742085641304915656543831190976008986490532066597410386596132766422026234488163435487889876791504407434387555507637783709991326338482319227500686541368087892665100076351075069628862376686619537655838590687615291898971286325099164241688147975845320979841704002364545072665891829427213069) -88455326811459002089798581395024759975871889172872668466370443703433800509268320055453743803627754859670391415348970278548381190662701716228279482045339649051139909543850883613464992501666524385524517648069873862957915620016943364950043289963237718026629805297916194484838158010754666017024585366330526135823515744339445036315966714684052345462172808299142368905939297220895721123725415007532441824406115746741972351142687017849809593982432484296719999502992792447259391592152463664807498752410740679664044620898308783634092355737296495489953554685938970593890496829484673393665321572846542839714620847185428664388282452532264810310019327395691530430185946743995669191791841546685206884247468693248673484055915613115527492005264289557719000245333079386593840592027314259)
  (num-test (* -10672574004830373997900438516438419278676753890756925443116289034080220708922677740383425352837266631691319394850521121221541344600832530724104047804922665 -7307684417326792807224298894786988180161884427390942431653062127076829842696634441114228528164049031680536693195116703321494895319862805505304314401000204515985676763063862569446064343853536464020413910728442475032187317639476018710375702206456631041987826826225461927793241495220512935434301833094232834266749666697332380140380619185254354273073522191066457437931022783436360434167505326773192959291779779370530770935758482422581712556111319611455306383173529090289274267200543081481693078804068524057891845603351773722737987393428313340760607600482724483853560340630587029610437280601010173185018227638972500038072) 77991802747865927212086621295493124451256238920588746597961055391511562690441964216934615500942858653797884925704270904527938466874924049039962754703188019915846345804228044693122758075602494985337649496117180241872910247079655077012999375809878184011356481981590430241786534827516536543734645410817621964035091467871491521760928486006653992134635010794346993161329777270345449763927429735191213854873362673179799811714902439637861750855639857969259787075469241319618538795721956528400353086156169058060112255274542232054021662809196965752800525093125763127895334967094763817500702626282397394521201385439419885607578137159972521677923972708827090645776826953976605193554447841693259586575931864396484621463004541561908426383260772786784541411548146173991869741515701880)
  (num-test (* 1420855003086789510813111205540636553863493314684153860389816109865085846062678305775289632805233481596171530412925552158799875183492757047174905459819169 13897739053062356545217161606361735964779941697726983959749295377836209520566715597422965426908191354971972501742952706730523748574796773473606175934144970768662226027157110240776527834790487577863781140089347362129598158760833470434895693782503529955845076709376071972727346128409008293671217324995682020009675316075606538241192607139905488719485728099428376369506685875348346231688684483781160648420909364963718027571565217314827671844485031440079254478598236877074793221578612249882886835580737423192061550370069895525711885220268707201966615936769696379335772521903910689934596134239331592980694745008817040569590) 19746672065138309742065153069587996891492444461032276894328314121573439684229636534026409362850111716212254549198595854140809664451286626009917828620279583631575940837712663100442879662416765138504151063632823014639305658882804073655537352377258786105147057375069447099908107785635606190515362082317465738205179108333064680370909383338688734129396788764959056886328471374018961975554190739706996184818378586233017775166959010668462907838359485424792026496574369912033757997469014639705459505746723512361959074802456098328538419933637295482429555127226978561859965498424173552676019033370307387047798600024901453757451579262061785051932535359410827170361533603618131510421439128567361259204833501190218719779570258541358012741265599985490513564378203502703406698160470710)
  (num-test (* -25117824099635104147178796272946098711514362630774369209876335291088434247131228189812265510495277875692804180473811834186270331245779845635089547499275113671007257221593872123397418355506777725721168216892830217596134983713752526559153149600553468865338887605949011743043425900799896245185282419637806859906582214420191794114207677635194054239563071023206500505880052007267243210206807805387341085613436600843317096291021780624738422589234020279836961194869688005260369009833026575446099544900581955685627511787510900479881434909308757027825050977932238481841909425598834367032841935054158448815026264505726593064239 7846111496222858966) -197077248428250572361351389692146917243277049539013604789802566767174747369897711991559940484392921619974209620152008632450612546796556905740493507885376190913893140368029841033442857949219716681475253727058707723386016055991276120001690579154370788782636181079931076758384034193266737114305362492836167078199155929937891579224024229182935372106924021709421948701131654358516297806197381566809357458374057189773041520552821330635689748583803171230633654728360451100477472934847975252390985102859262992904778849652221553818627134153578436315973777720706502751232660284910468721430874674021521629540714057383398858244828214000543075116874)
  (num-test (* -12000343217458212092754251360179138661969968218789048702097501439124892987400633614429800307263114371624489988815324366411323242909652002510513570900627875514001409309670202055060404640758548257776155562167062337394219073071639153822126554525439988062676648294108951003012550815746564810508912122306190725453386412796036693387315128514162061147675205485143205925649214342646148112549805850530430229663418469577245456944558387628002442451042105749848177325651852669794048215063957689756465788955050513359977166122710392613631703123491357791351447110169966270916789849428298930624807758982400706608788793481972190953569 15463017349709835150) -185561515374029078700596518575548896805308728003103939537818954646551372890610870275966055765608887701776880889777402229764948269089126750201922167386201171243298907675542965323275634529293654817279957832652909009385491998537031060285890512199675273422070784691446251899120095880199298512230290860589352290462643231396804350623684034400741386070220057232978556614620855818271117742675632435727751812101639747357642295230273344552327870600519422276996860893842363996198017494117619585153346745838853026029459826407782259598477529242420507010652705302341725948095720110508044256096963772599572721279996322424269691990173052929936294150350)
  (num-test (* 20244597897909303129995907707212050478823487084391413473821544089492035634291726811145005824559631386634261268723753786161463497881725871168747275110149007801865428978596190887145324535224079986377522166727137028753272158887188902047835658826867304220850429481233026043496635847568448251753504834367809877190895369288045026559783632709799678639927825194847005181499299410953860627694080906167346078299421796974815616608326704894611151743720515377248152215241639534004099341398238713597030368980166731393247619511322804984829747216779359780372801101821087516269912916462719248736442644433057333788741151270815989388229 17931151643499274580) 363008954869078360197158713265773114114991766614027768774402465306840646219477262855625957403406166192075865834283840624408916170935610374573318606346031792128003204902147985329385955814330782527184421959263266167048755628089412213360508944817963403092490479480264538027768728303095523018598016863928762335410109567604756183580676503045557867957273324581082608248341332512325136675167966306268035077761004923732568405295901819511346235524577361289712297365403327125212199451099538443576479787130510546755789504852631291774614010584650672707483555436445926222945298928326313943231688436271883746272589347954697213098866117569339490918820)
  (num-test (* 18134862906191691435095953372467318196853760384894170022863300447691250350836421337333332682828557871096554531436829166444150586004379181099133295174348038948038399079336722004125999533719492457544642570217406286811480006881054375314838605871238868968956868878182133492469763282800195060849734382249696543089869191257451321764806079423169235271658993054867624410589213892458246001270123109841429271429275464249821855221014782727398959126117031823977229309775211695677345378510417534328974531801634095862859684508240122911023047425473036305928743193594967362216559973174709883576295373749738633873828863608550295977368 15082354452174510460) 273516430292774638949326170314933525797985748367549139070674899956657807928629067317576809269188258819686207094298714770978509118959142516619521080722291318367607601498107007447014759288176261262818034997399866363248136237609824401265450913244758024085739876914482935655100890803279961929047974391299795570244708811454483314898873277493486428279875241232025231140855860469097028388778917980779775554139507550577255217032521719099071084956515691364008526064349956553916033914728254580848198941020806723485184338914882588931083516851849558411503129184026079582257756707601984686901646494090820169212279581209612798749779318126482639269280)
  (num-test (* 19213874382308276075905228027166553836726993832150876980655958901416537033385379180983129528081628446454583401834309285184752924794893846406622935494758142810049493348116192315865522516744262115026742103678965417868790607689989205765793528434388393584537260717130892518011447327847533083474230074174308157934463971640826422302901570010591182715932658037868980053012095115562188975692530473556182305847290196895478280679341869546292639446526021874910117953225154204035612531584978136604161393474554294315903436682283787080297348697922389355209790646124024053098888687638640826064745026930980189268652291562437512941810 3155416591710364359) 60627778016974262766014671335614995348970065077989108071534610098195400001445248886220725085881796599270026085183075312353388418711598523030563716616967792282609748819081238929738105086199457414615236966895805539596649555457494710621217412773036416007129418290246899690911654008867819945724649185574237527152410775686803449108977881160831441280833577932476667657759420192656716352190871667386955409426879693856001112340390304980532208752863058384169885129364117656404549585836664647784765508649117301622797243353610345828189312360124462238989888436478381583689386509617357901461416012201469794664889076397809504626996523928173064949790)
  (num-test (* -6561903839860415551587224953276060627466820222543175464705113686962550773423611522044145975606965294164125376820288981286542044306677764776675868357117109664125730405280822770267329297542599719353907954399688197248115043785617436343303277493146049939491224480136371029084354063731401026459653680017632996944506546122253686805764620116169065663214526857151412139439538335533979733329962892417175374550305659302592107472151941922230309227785266745974334776462642676959433923828440435340579340133192678341787895007461237846313005612116885419002449356480017828933592324336731295317076205553526568668826499450826560670163 14908715577157091280) -97829557993133908713082095435440645457469053259814412551982534425389603663024461131358343104414088618618030154957456050473312402460589893359522167472060177968099538846750606564761307960896264958539903740023783283814849937681270591589750181462708056758506230073751440847913386576449367635057595344744119561166438538811561109125506233466453974371464999669336530949393433719456191822836826214814780222021267726528396849558417851727452246676857867278196266042327956933753121947589485377148388716839519782819642328655117625818256334190717182923260613562191698788004591479576661108985313450029332968584240383859113741485244318702724563478640)
  (num-test (* -10378013547095983701124686671659666242518351347561698092030999302329372512356819420877395264401390796163955327080881297568412490286247154759694714275858127906305200295043241717769593877683535229411640745872559018085757273530771413156968541499388413497221629366848027355125816131586610997516488552323667400115617175682996681969687885201321292153656071894385242141321468096793766926179134511319941715949712230831768643024119693594235207988046511542691719002262040067921088838755337917414526554050602539873232518619281766327369577617796816586064895744680567067970817494102948032924671421242699225194947982378019119315136 30004910492448871409155105619400474385) -311391367570036811050052853596227388481520279736812036769684195465110674594690412517879149770622679377262288447706750813509857551308594851067359841826754786725926298013483569424123912020079066150719085450400229896983461212531213110847425940968466564079253939695853896434719530729030897976597410468081535234663568150722646854183317007227669132983719314653861536414057481478039579810285535699518386214012059191958557306338432321511585867535008319640705419431310336566447165302011113284064246284641707577414470505948868362067233709611758700034131461348997580441628136979257037186480770286846026250437141175360847735150981343952303257191661069675154710791360)
  (num-test (* 6311357747888359229575837883366949670125882865462293491587368290797766017168248637163030339387377997726585769250585768079027576213724941259801478313127113803503561717311996500019522893295813684259416551410025111443510215766297835872165689077882298506134885487991732718254835036694083204758447948541157893533099634169589161496492972953698758234452126564385255035294546278732684663873459439615228706684138982066055370429797835904846166362278557095045056472775166294675997320598469599722704075215700819354957397052721573993997624711445698656580401684113096559767093466880001548887739825916626416328760047783071058963451 -212654096583990292869707082365869207538) -1342136080095566600483524091094048745061145155430997807005186206704767933140306297188996797343723817220160636373424666345108189275851749622201429179882167381735732553825696482751584102093819432866729465599060815670807282181979889263381844726842751894916887860819210652174987999919869623292751389157233409465756974677789790982740267208982768450215563288024088369480574425410032306456026930809228182100949940216614156925537929648841127727165386031716586596638254705402653861723407930666152691102484352058909219619985877341630210918347460471644327858114815713557305185589162775699323253049631349906791700893878999711846225062306568467992135934882289075693638)
  (num-test (* 25104391676237653962996674810232896003857294806799086059884413856421530328279649263948893056601611073815235439115612155497964541323584159786678357898152394779494741995735881624055133443980324145256438160990490767324719276757840825641421547232460969806196141938571103617707677351907526127993230143577974386169402623023560579220343920203666762052525898442578990183400559087522259053245822827313206196194989095468393682721753147596892214609346047051670610252732846805143964713621673722554204896154742594858056891979146566683467510164875593192581407047920719605560716270697985110227952698114701527191421628561835164291236 -205991315859231724218751687295926841150) -5171286675233738337789203670843122752625713948587464573381323151628930998435518250812603433784823922283042037694290795352461861058217142213862777203850665369756106838860420507328654214723398688455622487003912073924323587826356928211672752672052670663842775836967587150049181838707784871641183683742967716787111671792311389517753578360293551031540853470719098360013225516593755039537796518619542838794169319227197212817921098393499332268929332950035803734983497370378852859829228973012039890600437082235032378948656232679080766068869430262740600476498399803176452431728914806536862849281928869092524387549297345184969051926149006293586531930828748109161400)
  (num-test (* -25971587288596053786734900662696128734726180676323130693160397208008930123341700520454723462226657743365779183466120836187720332442041321870351823609046027805781414454998487673927365486893294110931852680018706479684281928396163669935417207859889405108139261480861908067489849403284000981453574189898304616775302917687860062501465417706095450121596418236563421425311420755550335597318818628123183624214438801254105808079227429950505879366254661664881055965092586612702279548151277733307180663770432418397550642136953750720624507617115504303570076531620003848642167562950736271141440609700821621532583527124386811144839 -182748557863603655835821910989658558236) 4746270122419629115710902425435990509747636609113505336611751359043717100752575149404352359855260443259846554733621122684788488984010741203981300775978945529551335641218319619542248418128319220383298229263331638090009313676486209764655429828385994626323209879925281409485074778611946493692237774852428345451174837474328995186242262565013937544898941834362941815633750896882758939509605799422068815435202904271722442099465950700886702949580264958171808372530471918175963644209760378395316412115175988232945569517230829200985652504383431054550902852797293952515652017940918628980037316292352828228005975466732028971159947131994753006597870175664981312344004)
  (num-test (* 2117427896392849163304163145095251890404997781812823978967013619233450901604407363671467658244435728579079751353560538034596183240362499870272373308111405924505741579887345118857908796509418246599428633956038017783178050402412769812823236255234302205027282366926174916871858199918908361186936687654278623156607813451034087735179167324944824913226799346886951212979149617678949292799645035425029596869092844906629996914674904522806258932192931217652241231736891642224851547474205131131019084734780208254203537633402057673465583362982905095029133132240839391503135932501785844503813910210348239157828902668852795945482 -296778668392678698960782643314222141731) -628407431508980610909134894336322264939705333430111861505965183839156278363647883745193463537783397824947515214540990712455315080515980803996660089847066076833542492719707493333185909990202372284811233272987993068106356248349054482194817336258302692039392400931536481136340269417905505366385505196886218794044229758585631131853635721528813397816307666671727692971421531381290925317161326036075629905443938124481334173158440927555118173661486114828362551889594188958723424604273078091320087897088472418346754088900034854230711982602435635574895960156993014703292551046970069204857846207328434544990709459402656908170089318995291341536347275682867153109342)
  (num-test (* 24743327715258194976385899813930363006464428087412805068703455203318769863096919192538751530954777047772548306936907016751357570434930538612382851621309732767199276228580401695793317612267605312672263736938703887622824117576912830029817460033437752668221355377879837833796222831371174014543622739933433581963103361464022058091243110136610854806189138108937004805781857031030005354158991203388998364340053773883952742645161560754545458260688560269655272249435540890073696261770299845722705104648358053080678920468895189601731801025555650490534399590288852165862135571140382055044665678298182909026026068995867606241201 309156501491030456401354118244509785044) 7649560631695275371386748526795333430293346807872366006552933839286343590101586516802834568317627508914888989005968805867728947519409222814667350103434422356009252082456906520988877859152125402282765775845766265340707473525444185795403554160270722809642681642831847296672303556012796775586274347178092325226458743113317655523655255626670958156216225968018208281266858684283741496986683426354716284780229004376492833583965647875097951642088252875535823145900129967026856898970545720526282798418382467634180690243423325770596949644122541224189780082061715230852249880601371985342796525016176048518593825361248232406051886794538203297084423942036889326397844)
  (num-test (* 31345149697924857384985323414506591310628538098830133854928154990821019223495435414394178930529373634315044777562902565397455028894455733092896622048288278424884040917250546068175763309233883078972879622697667174865833277342334219810618450605650614585133187005110148963483824629405555603493157452295284935004578187488673124814714326405406894084902824045787647963172437833905574178160343833139650913077173865287057167288286708807322607983179910358234015596109655900840652230258122852488289951986129788952718105898226951651151495867246384586164892018870981480003722043190639707903266193064807571586900961788679579912089 2067227180806746570739122295766566373146995767544546241400900414826379465803168632854028593293108913670556431832056563218709444199286888840721753894461468) 64797545442006646811970698282511426059102976298051534827345388707272469591333019870381858263624490336448197115781363489554169207652559213486772008013638214870324260793199674746523791257170452738018910619029072942848422098770309928561867618844814267276213608306045020686764830302020953883994906997293368193331696747777630621086600981981357507299729947717565760536305785574555255589190221698706036770081438750974356437738060098906046001271392354762036427049946092656701257615490057677558059955825843182799904828201890893555678855718728417223845757559310912618029462136640226686626513375024547351747669476392735304999046232068947570708757930233036922714350584650744960478326257916948676866148362166017752159953504981324652709881831381637989229842766220141292801807437886652)
  (num-test (* 1965759082776833678304908699214846485256126608825750175641683294458978302204367346739996602241053060915897480812220051082619942907491598551933638540412113496542245474287364500698693202553692963910123752514310355402167440783023542848697962967771951714434359320001430281377747193083851165947498546085410216620013287853719686698746328198021011905482303248172483782066908570502837009924228011993318265674390462360820566174204659723461994730913995303015012684826295802887547970851558451858623353950391701673651959262042520584275132971807158231859672678070714276061110616753309305801080136339206017351200193800253572481467 -11092241138073130060021642325471345789108575712118027611362686690749327689527135459714040658411176246054106270789083336195599640521602432629024562630323934) -21804673765518097879589124792137157558586438669762099454880024920520894260754279593873244443852337739758694535682558790532827482894104906218015712179591886600693703465749571299271429989154199263793230178266758966678432691901731270899259065726530463438316383699558373053423999416350780342222940065486831353604365192968606300436304827279383661172824549131179471364227618431414928702407510473319879188990689163932586727702195573766225861364297410904859137393184592815970592502081722125458353280743087607273547490382023433724488604177909671497082747464946083901888849483505451426245881736990810339421864101129619181017696837017966116165703320918568645290788634265522956017905246042460811062666193790657969385648522736090098231379029903772234867701846824572274796526421531178)
  (num-test (* -4067457132547237558852016696244696525033953641638067592741078194074861352472861925779476293767777560910963786727886946479865734639031042985368829200802420611189793957001730656623744670821921724417176679009632346904384261431052972127975733031277489967119978909321422086102208644766894305071609385305464547231057263658903212521469801833214062476735046735467944834107695748433481665714184831786462886261252526036621257865158497049125410241033365487816324425563483999957660557670189397770488996359512245971368638615503320507431381893539767352426795415898379765583574977542068222040889423739693921998717145084904555464058 9635268828818063607505341812331931088336041632536136269505180222913464638532245578488168867093853062326136774925531196873279749483997619950077042084971972) -39191042921786100943542578352486285322085069425292685238158202937549417928185097567102615300826629615520476316505465412722375794150552330462353356124896483739321653441446703127728441315609093330694305784991844511900128172079464896650958648496336601612657347012294121239821167759496102233234525084695798195547141521849769350204659392602605928907953707277320590923278178152903602506284861018886300148663530071056792375593665422754923886137410482547324901798328311927545105456397213670390651819229021443747424183114992653572959318104053511452473611466305149349027962240989590453237778130260105665310067480846969449221473610614214933278048389171979184119355459010233147440293881252851501522689209874112819966647846701257081192324007280573826673895648273593609466000383382376)
  (num-test (* -22047771987573494284336211037167956208924595972749016352929724093971147687332865088249749580556015503923927321586913446367676445848750229391300778587369581738560634537089081840938984779012854694220894920437076215176060179241185151442003472788530160589267677502568156006531439509890061829154786579353177129190813899423306499631144919702707240832059008168851983259611724134448165201725432622521420667808597545410136493805873769372831833878868603946583848422310946469083400330960925084024624317866822897278934924368888332618046649078771617892961267312226309927786691384460940015979582201446635756024251269978545916298961 7481502540911026808093162425787184755732317118387068406204973030847892995155568099553397887864257088525242568880427634318737874025160499293315047534753494) -164950462146458057264341765173378248123415893870534274075422323606836246718538063890359159423074703472625232511667875897808555123518162244263016096627959208397334135559180524195701526029092734741010866589515172934676451385008535538102832400604699294088534999994990970130226363762230944961249818769566697211068918154629209895730969522747736738946126971914549491889482944152891334838234907190697109929512401661529882587076352559260375439428815896053844621297552401396168240947357044985051323834074355418902009161796886350497072010833513601114819625605048943438304411954380599728561071485061414856047768286383287807924135081902458690495890129203192613070824670256334683011083767124852354110322463725619194174195587835939047474059288568764831570274891727391545546467943319734)
  (num-test (* 22607201423790553279447786193696575272983924506336369475058795405894123712509544256099524616893423762658394830755129501447553593365768543361107397299007141714383407862976654294384881771985218996697067215804348472693636567074361380875512341556932579903687576929186215185312685712277482751425466251201421842248749944123326048360909954588266368306843116245625635467041934524547983478110533044085242847795585598341867070787331785945399446665919396062565614516404861115244243161694059679274045050270546536781907061002623188435269769778378780371158624481539046590932125320888745103158180784231722265376331553893647061533815 10075764395489719205294189472045365742345400155046712954334138069917417587273618147303160957788995022989479371576840422540097479703418600112174202202728054) 227784835187493343385594867881830022845566753253174983274076326016001091958812135049265213053390506720261776960833046225700903422206015373488419693650378821159134369608830936915027161415300759990632038898164509761337714774392506802504397626551196717184785586630245704512525844329038355790338277254618639554796026366029578805283659986085947726260520495140332204643887370987929304924491772630534558682402396784510750317396488402942581973350428066695976988812610467654886227733900635715495731445319565054848075104982244316563526232071957624002266648721592744376122065531440026836549316222728280595228806728872537793522244957258060730038589170810090676474272044568671474692128168357087077816573419470273384256552275636517940058764711467508281344270125535855785388198570146010)
  (num-test (* 21997874907846585575969651776904015812729615626636027149446399573806943459105370044846476738175828244018281160136531735881270437472624605280356112191272531838028896521621800558410217146758345955334174583639352151367532676985598470747138461153212653362188252002768647808852054182649808145379073620834551216386805267446360709820441771932135218282126427988826945094538034579367527908530151926679515746133600376612899354099328788736038811470295396365432559354070365548930628714861826464935305416998192532029724853617023971964507955475554955277722555849603716733374588174421463022213135839490633927005539569058361144905451 -1400498192750070094581812894241996480373581610489471746158083224360249880335094841398529960182484181641387946900090289855375996313447832474435929084180606) -30807984052781257825246153008277875918087659020905755686964119182052911551148620538090633516362197112383237624321406969368641524681503231262834662890145617622830207559490089313283375890353617292096501953380469351747504928597461154633889236826060654886877907382241867167198409355653371944304660938495445848950444683274236538890057643038410268234731745456035923559528706349316582901179686671568504971088561096469997823300883298811440849031903066114422309644669680078733839046643542078157684064686933779591609758494599988463628362190034612412739669041368897594110022347872452261447359402810277413572637740870748949093642723240662839444216981630862346445890780016393330114883270596630385367407921496982236074288475142085411632630374714528706189796772213264952893973677883306)
  (num-test (* -270155241925436273159477510619232592261228150696806729750247050 15545126743930076938536195287546926534964892301082800206802745964245668351235397 72127079799316080210744562119267314209211162112457416152560774669179705347659265 58427280233475514109627698916382980237252687770812483048907352594138577656301900 91336330475502063985843547526216808965829995610054777216888670176112782119332811 99495081134815818196404370468895496198561677002653930126818668800341380375657337 6904264296552316628911621065724553059847235903647375662685025031963599691416829398469283631386160328944460790101458427909545198569619131058877708293713734 -16074984786353617526516141164566295497596312655026144270863093715961484079732496604871734572736757225277596743795506589617891195569235287256031608792067121393492186703333733526879481948463529609113624075923052999494363547340563039654910799974388353472433635130983731604982117092991918514078659590068643956240711810902756784590442416249652077644077280371860780741318193975770906075446772544431670392964384669681404295839302410058434872964315897505894833409101781069230919347279857855594782111721176074849502391457684148683668165019969667481755384384017844104770253558111588611189351637275389688093074751942960310850074) 17849860827147993486644896214424106325295064110723402251474432199595968349198253682890653243676378684005650871261983711134190416277366473221365848417375107498764965893729640224952922241531788638514200018520970345581414705756736222535562338748426356003659523260330725662384208724142177900990027225665451069059291754155591197426279006090296512196415617974140965334686090032257444820748820516976632201388937358434205022475303705442914044454220818215336283948743042841946229853366515552653568436171217572212088935263340599371830215580988184775240338748954666846379831467518505260487989636951404886967842600777836444030434816421999334066711024026401362115623932221335906548647785232855815515579448393689650116225664467056283988125816950714780486880294535933597118808163054631168063568847830481653855357008353733414826165759079092633441356914450038756281940532159493763482047244493174370100586359619040444818634156576789665732998111907245928253704097384811414269835758656988678207624731164159069547745777423464124959379113843649940896359346515513936964849811155238140671698227057228045173997904545787593258286212427476788605370334985423461194148838623911634821153061693257996982252745844329344589168264774527631972524787804330730506700000)
  (num-test (* 6411564443509812216548163965666668398784964137255201222920640150 65325385402074288043601436729391841747319174569548241717675134253657593233436152 63305037198546989906433329294566491017476837189978173607681765241525113921707860 72383582945810879300930057856704905379805338886592055772943486702915907397618845 35525980101796892634292856352740658817031405780112750352735419884048051630180860 47579150292602967366908574298176357632207539947399443701205872093150879604391127 7775494633965874654516687741429737470333189902121089184439228657893110997221737422210698789286625633365548095171257583020272703565350668755439139356570 -7847653632223099338936161226557020783515367997970448568586056286591257384101422312757649765574456754668588904917800060981155642916520580540801153603733496143328839018174649200566737789874193483124577734129346933208306772618814806884416239295732454033604210880463262467564639515484363761639994642888910703066277724414372379965872478153546766131136324967950786993982228851928269842355632200589446224738709869729930285189047112131897218464505263042012855229737941639093204086147932759923796947642895167078971517834730472596647456786099215405165290569214043431009370032818978995463168133051136053246705694337584724712230) -197949741939898550383903354028842356745461597695099989904494711851411610441324234089773644533872304737431480244289438922163630848266242200711131210228027234579469457105291847132071566876246332653149194709623963836885480655282595345693084881617726426841183231475364991154699746506928116505297453355016975688761948609740314324443406930215518937775475617384099331839748494157863510168743547396262979908353122625808170296763676837551973930928848463398657587603606321137626467028732193151671337338929938959296176472483674270114824853018199281637976410726195357458134038379491704909997939715446657856320452698914513791221947734373322868574099599391493563479057703049036936132407025278683219316357543078875410080612067641232277376174351958080693019953378024732243763129075732499165068171168470237875348580987967740148512425201518758344757030205911031119619416763996490581551977913711646761182756531618786226541010835120092904291975494846126923510483263978074437667987560077422810120462938292680423746968095994108344184522240467647491991837793653579480334442342102339933473270535800619630342940590477752278184994533764839125736268376640933720554199782388890444619996919031351334561766248781813883867406045414518951152508504891407920000000)
  (num-test (* 1669833986019218156514274418186396165434871163342486930502417566 58528969848472951398118375496887849181512821636583415470809040929690124231959506 50098163184827557635697120379841225459445103589988345336880332217224622666020381 90445522698871905833766573423181067004916996574451008349087758531794463581708977 92366726802191504770638415639612204654473958526592425718659284841373421985393966 69096133232785816552402133765198624674167660496399099321713067612475604030259084 323971624832697152056406152359288553860210436839331005469891386690556929684663075996719803995137130737141925308417709520389528780839777347463558171582753 2635514624483961079560488004237441873979133312246005082134175818331132377114926863102436691793380965631848192666106793612266994709357524826644421074908075389316030912936338175907209987972553710900613011802455058538786723149316934049388525865455871552882282353445228425640452635081303490379594663330152071465360003249884180020993032086861074931796165970076448856988084523672973069824258299029863033098237556417571526135639288006133579174344589248428714474318969988990720790226604664141927030250855550010512291136517209169959021730625428868037074528890516086527430801590050720467893089085308995719513895962750896813152) 2413207990093478676325592386500172980330574558867366638913149256222218924700401110600319869300256745035993991818342784487193857053589994816247466074246569162659879368383295411190237107255160498774228460295857931362161062884154872938368166514128474751716517750517217000290486110198899480877593169193610813452614906598055909439037075588626529658637140089909227353944313408987644743661503976835580507054926908821206921014266535160031749397432350114673787218438589065861056449106115395189057409933330355574558853874223262465965933679584884152813357065227868165556818717270584803360466149860292769520737249610469675917864449261901859162854558012721179400237645357401213337423255109839806528503425658270050436129019270883446965562683284298538825840361267548675967778385927410390726055957928634152514415917053614892441910675109517307682075989998558764742821214685548219206933043196677521610851950501225469125512893859254575460130829051324112015464552874242522140166275233893076603452098841950130740353331198999756316969161591691095397245996664755249875720008141774247384884623389430842799829690618405724986702942913150258769060684255363816662231923570491001519802836627028431389746450987110456127797025006251203111629141890634728548553728)
  
  (num-test (* -6520062188352981842/3213004995534018829 -3812444292971845716/15284944374811818089) 24857373879807849010516976362973488872/49110602632729971801355498746248797781)
  (num-test (* -844583948128454879/4750740551331102615 -1309778567130405125/4885884698278749707) 221243590680205607733892613510570975/4642314113048197066962569716783636761)
  (num-test (* -4579815856418431271/16947444571374397297 7990245706938186906/12540719430158043191) -36593853985314806270746820601513137526/212533147427761354206383017714519654727)
  (num-test (* -3587966953201943536/3194797554208122281 975954052071387816/2707062718507963111) -3501690886675668292903668827990357376/8648517352177231144330968693325176191)
  (num-test (* 710265334225408429/567023629756400552 -5578988760400430103/4131535930210536898) -3962562316545608552741467762441538187/2342678499616965424161446427863567696)
  (num-test (* 18305319006789031727/4480148641441744463 -1641093267260986094/16028097657311023719) -30040735777106040963634910981471804338/71808259944297590021537032075729917897)
  (num-test (* 522499067029593907/142530390958606446621834761330018829110 1567459634764499377/31663510497342378306792964160850079086) 818996196770998943862055820464495939/4513012530308148429025282037949729145117603192483641232823845248212618993460)
  (num-test (* 6214041481074460220/139497414619784295310756757536261769729 12187470171919324678/129216394212432939561557938117593031955) 15146689039532873328968703771155061832/3605070583825050709361064709099418651298807367637359842488375232197429738039)
  (num-test (* 10022419596195177499/91129297586760817507648681092594591108 239769653037576215/24086455608554015268646156321002022494) 104481394312031409685890479072416795/95433990476618390508514520731482064738017476445225501421324446942302103624)
  (num-test (* 127731839927226607/59760640855511386051149338950192132591 3679984267166095161/269870724770589242613062477043917992045) 470051161348371979221331000573148727/16127647460431744118786930146746069875784110572380855085272434637353123238595)
  (num-test (* 4919926511230586366/29288587285987487013553554568227355149 -2914615432991234299/34407808954885309804037535414452526052) -7169846869407694119621783007930483717/503878057947370143933800273784055481319429768630967123178484618174989420874)
  (num-test (* -4322680734125283661/246950524730861178141734701180345535020 11581515233057355754/82204027418720951285150957025638971309) -3575942340708251875937466941988609671/1450023407574517046920597087724458064116343346221474061477327267648859624370)
  (num-test (* -5552456004563371781/36434418778024040927761226774271610950778609263056622471030041615086459120568 233319937833204741/228703279535756717601739981368829304509550463672786894384479957768850829340) -1295498689806330283646616799874813721/8332671062513255913250553083541810221054209355142441164334390514659539371361850837178162594438925276666798780352514152276296209564179606228713851865120)
  (num-test (* 7279569964232187047/36316165899095632459738478614507512808578186173163489609755035948221062420580 4568992288187244990/18279847281938710983382796940666233712517527808023718591530848159479207220137) 1108676634263212048809114991909788151/22128465550033953372731954247755694375180631486898426116907313824243654714198100644737500721615620412852035450119116976232805701601749863504629937973982)
  (num-test (* -8689289043809733973/34365105035540924847908154205433563929060132734873649554594240958996510665976 281724695877043289/3383396067954681850718083474385093262190311835985400909911383280975222535225) -2447987313255021583629117408894957197/116270761252098802423406562021935246701911690887646043563899994409915142686943691634418411056232663942535537938126289647041118885713303684881867869004600)
  (num-test (* -4176416206981759902/47077361360975682486641492558477246171356187409295624938308162261216397376441 -10870319933050648575/51626085927005484523186190379579228801774286705829757742503501130303410401261) 2670528255498212232918897515060496450/142965876637554026205455979922464979254073063785755559223760631646970673683621524411341782655829702451013418009338618833412062193643308417898164204593653)
  (num-test (* 4496049401725150702/8024116634872885909638996643719901973664008349644172107626390134736213108465 -5231341280619167012/99267989241776204190444307671763754306088564051099822830201760217121508089279) -23520368834947889555464127765407042424/796537923785319116837266627763277272873506235001122453584405648384893204423914484193595265931840447141766909166026026228531619859740155558402735330646735)
  (num-test (* -2488955833769033882/80573015130339486598712021266263458487997757617589137912729682647628329090307 17723590657579960683/79078600039601362101827108583564759878924923849842119643649415446502020994810) -22056617181258995266120581914227430703/3185800618738432636378738398589185111057563002909241393794402306079667392482341108052833514927720630087013771419748846412352850012097731569487991234153335)
  (num-test (* 24410613567363183821142175154197794689/2233491913446620869 -289777146895293391500645889398422195537/12394177861163531771) -7073637953514043162500219088395995153310329907185649946877180402954938102993/27682296026727883467940485833673128999)
  (num-test (* 15029397898618080393623393093137341347/9939158597399833599 268484092305118852707129202725716126526/9752180454987984749) 1345051417567645337656755504737828287428006597367109244226136136424901090174/32309489404196149853047846865649927217)
  (num-test (* 175291724581304230067306380062677652261/4791591464449055089 -207911166974886786162808240992513636954/957635297799905137) -36445107018739410292029741836217649994267718828374576884161821761303211252994/4588597118993154438342028473487092193)
  (num-test (* 208446980882041538439350888438428103817/11756453246592156788 -99855903858077543170703702663212319708/7775813092266901197) -1734555140205305628415286772698507060801514301420325900368570916304368260453/7617998589456250715053087609460739603)
  (num-test (* -49595797981179247160347259926801311825/16426101929443877636 104499598328969971414586784725010079457/3085074725343747115) -1036548193567594227670217621556353400490405002875929378150074378019016735805/10135150379689493069951723318357604028)
  (num-test (* -288919818051255959565698296502103975540/9373352185361138021 77343596824463059344208562767410464067/8355013728778983070) -319229970313622361785032672064391711775428287673147624981393545586243098874/1118778374191039878067165437747032921)
  (num-test (* 301194765217764762175383920433701358543/150076401641721289621709469985978858175 -109319143590504335906407585568245068241/158084148208214805386290412276525928977) -32926353787549066990014316879429253235742017240010356390402491456481443332863/23724700119685440084214937112355810539035473428177368317381421021523605836975)
  (num-test (* 14575317438235510996984657523859363247/6747043355688580686998987940004831062 -98472042392613093668204392119412188287/152397803267436514292317070561082866275) -1435261276663720115408306632770383012566806521695455296458086302958691687889/1028234585957093005711368462502470683211464374115746651290896689614112234050)
  (num-test (* 7543367187310376010646193530301789591/61115754966424662873097894247178344192 309940239796651595482411737112678240799/200261667764086238794802895148430893795) 2337993034909171213000031444662193658341848356694420878002930517675329723209/12239143016237439360279809707749702660797878084581096344749106125186707088640)
  (num-test (* 306232835922656327867425959604977465100/55646521674811091128956181530575055283 45245255551837746690160535427248646677/3669533234425940180962041078287629087) 13855582919684583969821610044729507626133731299765443289084519977056998472700/204196760665922729081584465192637337445710456706084552841012480810023816621)
  (num-test (* -280037880297253633994139513185953058494/23798550327416056573646642830182072429 13967268482262630670960486883264178489/7947215947745048068401387767511847243) -434596028812829556627014314125713048434599389957141408329542154357763726174/21014690966139335562014814134594464675233042588696546668504776333756662583)
  (num-test (* 87160410649223805266866345018804635271/204719779683096591635231158476535039583 91197762560765392928084914476898132964/277206223024759381433146631560580134513) 7948834435086720002947247338196997812861466884983039250681993725808882173244/56749596904412078223459353928850191672356004665473536520452927516595919428079)
  (num-test (* 272801380449749740391855824723351316848/2170368723435176720708253536680067463416474841046765138040214254204061862261 14545537787709209389572055399030228996/8381323291479119825335849511027103148981778425333781230074116361235206363821) 3968042787871071204066360146704950989545352280096012736206796950415592924608/18190561932825050861659739926693806725838682397154479213760300500132465705680046683155463862909993066621811136554677896021527098482779305371951555659281)
  (num-test (* 58980225701104541897366713189611773567/10973700523953435846969235385386214078292603476932194022615006557054104506344 21633357583056027790037764923811848217/41236459355840549300942497778444413350482341379076368704834339005347182486274) 1275940312921345964633100864283753667394719832288287163056787891633576680039/452516555639171997520308257003811683819837367444947027711901120987864272999978391252372420644671039873982401560595091423172287702745925783369137325922256)
  (num-test (* -39569537110370574225194522625562874655/36290593978404925051095380486087641410218299612051669925683823165483928853304 39273660356839128453616088747231247259/28875229647500294680887983884278577441525691250738380954940513956990510132534) -1554040560950035541902707236381071410695075315482961522429891905381129320645/1047899235170633560739863801929205639611958070150694189488499584527041043137082563721218908614201921449076002548982308540689571766482794493357171683792336)
  (num-test (* 8957762734053174688386697837976422606/712105675122280831038408324375785815130945929819518342973925027507219300067 118977607972668646264715307919875588738/36563306353035936296510796886853084280648109576589600551753305930842020963283) 355257727628119695756412145322380851760544279491883270008434507085780737076/8678979318410478400681656718586483785992423192579006235728835173903750764880944673586689792087386144715446501744012435157310426693657188196381455479987)
  (num-test (* 114386050140129336980347743358441052599/11994188887964574384037137314302737861703229337059619512751326848591488081229 -50822174853799566513638003084407139228/97406657802317796912648600328217961853548397771614449630742570869667560514587) -5813347841057137571369557065847591420664634372223088557679866032754664253572/1168313852626327929522799656188055465298138284154709873285311568978496136227795809646907486798429717114923178357702460243511883684964123937654308495387423)
  (num-test (* -22147677230189664783449572410799931501/75580058176304394102183955194485040346816524663599269056794063928343401057143 -127672554664595215026114551202414743739/35777311684781371234035985601066874920871049301826919955489852676067316906014) 2827650531865200718433745248471704607394596478050653604940563621773668622239/2704051298527551014378337257898371613519363350219566689647796093438747503077807722203668806231503452508016974614236112792032033672965127824348803574358002)
  (num-test (* 3468729773587632113679855593063165286551216344725198121609354788619580819847/7106612002452012151 20863200733446307102600190583661606839853255577505815215312643683864543217073/5700246487811068117) 72368805556440529088812813715602124890901251289457147618293618526488567540302416253970205832659523238561757581481150988870947074663135867252252227647831/40509440107213064064897416415172689667)
  (num-test (* 43306673717838918980731699770600730039727453611468399058203483818093233880231/6173575908538565981 106634227988568775671050783423559067905086861634892257032833451008548321218936/17988169594879808463) 1539324572884864883885215269788177741067901747630436643318399808029602335378536990210735234944615096105103848497832537965483619535769637171783464984418072/37017110149885307295697375341989232401)
  (num-test (* 61636028396239445662576777415312348317278054920190931147781159688109244233565/149659999183936017 50280832809996410949441105432174396823883728565382915986396125237655209339731/3406752842984125790) 206607389257567119017662603624829733217835095238758046754428174885007999774491792658838812826043033826701244157167565054600950156595290052398436186551401/33990308513391731439280046802638562)
  (num-test (* -100579490802304807750359433955474958462342659278486016345156932756807754105945/15683759624513404963 7314396152134987983181095955389244247502417255088677055075146925285457081540/950287995699608967) -735678240508074701153113537069655056596152436111651040530896921701439724727486696483134676487497031899584038731663111390949471467249259023050011663755300/14904088498613295322494450308817103221)
  (num-test (* 25984831699359211750216710442693374608159925357093100400945034699383345074385/10463598404993207796 -2395913226491242076662067669730978955981403048697660449593722338244504668974/7015215522730452775) -6225740195664363384298636893730784883811595661227613249243163802476751022407971476247993440178871949687923603921101094083879668063131450147131783163099/7340439795432595812648347200273983390)
  (num-test (* 5173661857391320950903772549611256023540539838210520778403003347430938670915/2590493168574884173 100300641976357496491877756123729102910724064566692821682523911939220592349990/15304416107565779147) 518921605664943617990486317157527087053001312760892500249127957517476408720600460633868004681188890038115877413554399588737851074382787744833707113540850/39645985375676570588146199684023740431)
  (num-test (* 30299639015164203561126609159677900559022306879488518544803392527841364186955/97638167801975054493877206805944332747 -50150465496280036231382225902610460555496341860773955714344071185921583266663/170117675960786609061777750278261277482) -1519541000979732808188648781832621044050652591754537200855596768903085847105531546641139177813880505696192826380113425984545675787584857974943247950981165/16609978191541300835961154615181304582159561006676548938424954151558306303054)
  (num-test (* -34494394944257769716276791009665812125094062960425641316440943461722789694119/69239821080832171466311153221314488591 -68027404272124217088707268142523090163964888591405843143848585935878552833247/257149529774225346004390673137885895872) 2346564149995340998782934409780604815295734898030424565252099571337345550054284934036215402972664245125313098735082896555892607540059632597741979943574393/17804987432587488254198543762235568841018786223139145264591718687823557996352)
  (num-test (* 22330754509472350470460807673039908304726422770752644988051418230315708975569/141163736844241522445115344332946835969 -3776092949566234532895208849184634613770861313997034923686862122594334787771/22367110097535579962848998753563258272) -9369222740190326741203615957382420344247102784278353165345406236082475331042528539717966581690645628370939381978953360215380653092335198860022382107411/350824982641632215769272917522017419782283768012468846380070797128085153952)
  (num-test (* 1376215273451682681102140384578115142238259557166158859699272578561460124263/3593386179017642636485249017714833669104405991325015697577507088650274886871 37146275008876311604039415809582675415172661567487888072055609579242279390723/55424998453085285819414374477780690192979527887019008768378662580126754826472) 51121271019052119686352858568900325361226598163234091421115939503875711782442415328681175322030659510284806538410228985354770913411724825992699509412149/199163423413390889071651575953261174839972499014963134990506980080139461063269751906284862132821075544766093817070661266293471833091996501160433036049112)
  (num-test (* -88175289711320073148300791156190227927348022787624424521937188958291199926437/38194742314758366741668899229532351990874883495690656157862650973602784662629 93421911195279228911508870033119580111709458306921869937709821511660370035352/66371395138592894543765954603571534463846496049156722497129962530412046587003) -8237504085028962150049531747535213236460729066521397582683209771842938254589363802757604921456170821878391951762499073662677974506165863935238701489400824/2535038334389561782321790943041741331416028402594806464107449488311138037598457377927652600804722340759363172755193254192462811091332303758223034251210887)
  (num-test (* -88364214910455569163017945328431687038422451206033411348821431934742389780753/43010507830592044720656702803904712217809857004582018186125828892174875808576 10405170283887792832024806983921158923908589830001636723872220129826733402834/4055629711949631304631599195955105801456753694558712994574702123032807265321) -459722351572673455425943766571506569631562018487574498847133029199411842205331593858852090421782204158679934054007027833206633183796877753882057444427001/87217346741895687976684378003169607737518608233754137677854312677618987931466495788077930577814677920791330694741284253568592140275298729115088619596448)
  
  (num-test (* -1412797070596191471.0 -15492755620416346417.0) 21888119755986895161222137392796809407.0)
  (num-test (* 16686841096925954110.0 1491135775021813104.0) 24882345731730524499708005167300657440.0)
  (num-test (* 13262412958100188045.0 -18379071970155621919.0) -243750842254847872704698616507823758355.0)
  (num-test (* 889503034794263569.0 -16600674457216690894.0) -14766350309325860687849239111838240686.0)
  (num-test (* 3148165694020236318.0 -11771070679825280729.0) -37057280896113409834434531491271315822.0)
  (num-test (* -4443818546267181727.0 -12001052312087213799.0) 53330498839175802532024121011435050873.0)
  (num-test (* 8305259347214213793.0 -229351169208067535459370186456659711595.0) -1904820941859811670566233132773219565154696335396051029835.0)
  (num-test (* -18273334758510166901.0 290047155020180552782039318570071650475.0) -5300128759437251944808204783222405076790289915320785927975.0)
  (num-test (* -703280433697652940.0 91110448009482115063492795153459771021.0) -64076195390496041906141380919369524419358692517527451740.0)
  (num-test (* 15279634596127882146.0 -220998726467849290098339792307263567896.0) -3376779786638352686104608499923871317791563686466157184816.0)
  (num-test (* -4472497681184076830.0 325612942672822430032905460436166528379.0) -1456303131067722058341139305566346079551678140995111358570.0)
  (num-test (* -6180420673489141029.0 -161157288800853703711204405567379740552.0) 996019839388256252540244286609069684717518686623358308008.0)
  (num-test (* 14044956603588468379.0 10163190459901171254101452124764637970005230126310661589196828892266636678427020930101076689732526935899135126391465178494895371156141265424428405590113790.0) 142741568963316278148132287599703960511135825069792278910440475692913696263448088587778211787403889397993501704943449376875999977937418748662459138952952917221024170426846410.0)
  (num-test (* 2133283347509865817.0 10577710515843519541178984366353275630877942729579274295972091544607384358263130633386329706527832990861547566574369528634541156662300858851752195966167381.0) 22565253698228972909216255630133478029433774404794962869038558824053350969301054394347471181756471783852326407546652836376109109470959746153989521923555764579738243072315277.0)
  (num-test (* 7812722507014599311.0 -5055959518947106416800910724733658104378582281318226107212861190073091017493970778425583956006925004399967175604321778956828368132273155364830637407968648.0) -39500808728232764770485117356353304373275127104839804121600969932458363071148383405901570717732548020267052999198017578112731079638156026910705662052515278317807704170401528.0)
  (num-test (* -17560801708050275829.0 9842515227842383346577123873881045824143545509071137371075701856197189100217561683579562062872293951325890789283651221922663521213150065638405410634222129.0) -172842458224605375239887212582262805312641302639067963604956593404910080268476692854082531021580381176489626536608405283010496488558204787140272050713264572452317265305619941.0)
  (num-test (* 16743386830114877156.0 7347065846171565625701636575261347705942035850951855454324853850791855951431141198155170102434274509450315416946729031216385536668189501958761688618635668.0) 123014765528775807847206414290825117502032199391400884957413813554539073118943905948723779020186281150198999824020769031248882909461419778092564985979904308229718874140000208.0)
  (num-test (* 12697192948029671719.0 -11416780209809507417142822520376617951137069007568339428552592261458272400645205700952156716454820410468812274673183389934216970221062627926131479014990611.0) -144961061169197993494569769162151457365959287966302572862364500950127981616038900865036521107816831702945678695331078399461327412574397914795455218447174498277798426197230309.0)
  (num-test (* 17005139720743105479.0 -29990519259587469661876904501488342396062731024702923152492275204626478246142153608222329335341363164148761307659972897552084842238285026253664841395295138667328930482145590159132144957515157474957872335043653264146346772142483721767458961320947069718037828473530001033848282453826154763424789967441239969918856795769965946388666154136004597297855416503729657013008165049478441197537144135384444157408972370236442813734429031404855591324183846423588871065272526864866155918285777640819778251612915859290336548446745308788013234099839998683451658620461972798204104633072664604846231692505409653434538208644416538994256.0) -509992970306921990341332390474393215554862069848994183152714032617297815196921655222705396130464246880845576204295466273071779248718654338767559016551390771145212884412809612574391658668778295682412755916528976282396155832617323980694289208942491001345059122414240884660276842648466533488559879226195446807748573906940273568334343093922652142252689341425941673567630236228358747411926991658260241924294146562230425295426217833820067881064577380516936937782688004146531121831211284735538742160763820814174631414364095096099434285754767091040812242751724012532803037860394426031234340719537172735695313262283511554154662650333168783128624.0)
  (num-test (* -15877530153400521290.0 27863984127681242643954505352420303514833683768731313003271701952957204538094398204984051331105594788039352443762851136101330385230866919393696564428736685568762923746771275677491379334452751710169529933675128178840986001684425353245791752781476028565228371147542431713985092322787978914276414008774443194161599919167210582437024618824616489802661351916633993681556274980075051797120207655478780052593534285265078265845445633803877185868676955831374479850746658711791169579387317321983669227930929736238215792068273805543745311609083833407544342964285215427999724272264458975101474080574470499647168865409458531868592.0) -442411248181132450919255517905812929771246981404050821923231762557171158858876183536414772404562764742655092127161703706239729646027465795612501446223663310668879007072125975886873343449629108246953385822769744013416908613100114754904323190537317463286500657291202287742354250227377164455244103312266617146454847578457073139633297517170508179596166314955134347046515455569689877574427319658085169791949003021426613961459610227430636932814700361914589752207776142403364490846294795496119883683491811246550808038342285518518431538295199537270236275774546666026424361019715280652576803278928827199810150387207105149968313623040090578323680.0)
  (num-test (* -14162897687527555611.0 -23016403916121951319848021112075986869602408568431399211927062304968548663313037929311574133954267816204873252195499803324830278637331653769648377216095499136975244697758388851688873078022850203685120154634090802825656419418077380419130449990938627982123188424119187922828250625318327074513352279785514062876718714640725789938556578327139793467832731546881422469843509318627826856881082450937188956068348931459011923844607158528494902828851692203126881727638511348944908726926619613375594042390434147948508706733126737304560579515324106834237197081860910657003346633962662773394999353766192391746258372744063777808796.0) 325978973798843759388794644178802841408656469654887121096165875654577046313115917671847505813174070119516580105483409446057747653173640660143855580491229746795572929387698247460831363721394707501497262525550824977473864621747159715947297817600227665840640555029633517390896890601028716769035575763283168066843141870124768085499453574902575378368669494153555135898430469356384416638130459557518713454927909937610851489821263029886989981438507377741962130296498574556444168140838201069779040087521405032426995145166201901368032136008107323350679784004016321425234898132080844200202007395427054392280809376612533414505539109579739614954356.0)
  (num-test (* 10844738523441551664.0 13010289169828379103330191247192587220592807931898339555723704078985668371901953113936581573750666143303899278973814509164982887504269303358034042953769514772858989849512527461308415676004712388964136857232374888643347097138114199889581495448978914022318770898259317738823514820591042321773469959130347470144905381758960436645008051488666423115693738341045851119808222048272924385188356021826450267608127588500233526688704136268009202730309974485584784539415807259862449203760469406037505772435323036790641520939576046423540699016607317147689982042035523118533555744274806239272109508745089640043900389441390176681340.0) 141093184161152226992592021994885140117836445291515772908453669279294934817987511015413332614094493905560980363483549300117114491702466085602279965168041684355125886388302948336158133555051817733078300668260616983283027038746214728386770752826764135491650323133831923154477800324207350667020747545837613879364064704092093040155243919335078139087599906324684688427176309081290932504214653249366429592335409761783188358003723753633106574740731573467850133547164922532633897844647383889253777956821171583261238607289172489135768839436605233457738153233579088224808850428203888700116300637190661108848906846940291749737998056247719674749760.0)
  (num-test (* -16402132873169057380.0 8202725117980211375579199554494319645475746305836527475507064811368616698686329266053570766100878145903342129595869654087772486685252653587846560946850102095086896668181099435964053041678323706849735936082196618754721606824996486473796843333331029865501790248862590712245450877098960007272754260813822886287008295409755783478345202299352891066800825979067590290793893933819913530599309037639082839491869155044147367415785329077864525961799400923643936705317921900308490987828345313709179960659814100113658528990241758360711799009722683007157350272749544178688961738222930753008443755881419398858537860612954576778456.0) -134542187307192759584182063854799850608007421111316277594191532129597970622559949723743396309231347084450105499455916612009290113746722460358793168839937004812915757145655285798961178877391232945062437277255128401572171216279188126380587081673725314534095093062983435026047851041796084651601813918099532876684901239903769891552275465470747567830660442193995685219383258617057944010709906130655663966913354414611799232001438943448374556294933488875450563987147224709383408815994320229340710143082135667640802837699940654151297907451396297241124380508001357553893328703788960812706653503939250831164194874527033594779746890593262611805280.0)
  (num-test (* -12094905083549825231.0 -7303327854122277566083382629094740392048421584433028903125893639493993705575691832165314461496849401726460344615713884253150283931509897329926825128629833541892164122168618243719393446304446866677253728405617434021389128710195093788280203239300086905325641224801020413858421914412156234316517981228056539721130386645649016559425091470643854813419057026759188125291655398451427686659900364573485593902992038773538760663063071699966278379037038361219424927031644750173900916227834573604566165762753650347331082640552394430002401423199016978155236550541225512734287851807727860645247391524620773399994302380387697957581.0) 88333057189654571362020288527489792875655269960629008914349561689924145109953656394378545526256758871407020025766992398117775520525507898420898102744530402370720932219749861094609497366188371774072368034971851022164946370916317410415503705484491514312339956381120953283812334833067601825812118392757289250628861166579446800637104996060739031010579056633535166403083327528575504427815713481850979373113173151813491831551023902022537957860211597622343157802805275942920911544696695931809085743355666792408029743911424760065578742910735408262758198787195579745280191859776661700139596074108035867940154338953640690242795671183308201526211.0)
  (num-test (* -81618231044418675360403541307856740187.0 9751573706924018395.0) -795906195858402819552264165081526765614024708979523739865.0)
  (num-test (* -167600745660011044249531125104202473984.0 -12960244919927910377.0) 2172146712516287908809731894157839567367040369214826131968.0)
  (num-test (* 90306383312124738690336097936949488486.0 156109477991590792.0) 14097682358164298866835386043901377722456291173827620912.0)
  (num-test (* 126202800261728727198105694812165074067.0 -17404362862588500316.0) -2196479330029905727399352310201914876903532806486592905172.0)
  (num-test (* -80093647977875266525946940496137725572.0 -9499399805878278852.0) 760841584053111508349403804472960020663660465509267203344.0)
  (num-test (* 304052889577333477963637861956318521374.0 7233536405885618691.0) 2199377646072361697737485358722028853038393128548297401434.0)
  (num-test (* -124787646062877233829165925777950698937.0 -125798384154373172164515376683173327013.0) 15698084237137783175768362160964949930745617334715009097620154581879012485181.0)
  (num-test (* 259623502197082370239517374851053110076.0 307089583871541575627915295134832918432.0) 79727673252974285068387698133566605944659309374400074880377824560177225320832.0)
  (num-test (* -245358177397026033963771466683003477163.0 -285087883756432161967673595037725276963.0) 69948643556453419103498093570621669430956866597291662675473644085666220495969.0)
  (num-test (* 46731711386059374483493216849082745840.0 -216522280665540473581476116002923812173.0) -10118456728713381305690589407461434638634240429858378588644634276171257110320.0)
  (num-test (* -301422430661955757433852743238845048860.0 -737194742467573013847855072675441356.0) 222207031145790358162820429948896977201848379524899474475604149595884654160.0)
  (num-test (* 109781582310220385246795023904554278713.0 -273317662617851276579672019029762858338.0) -30005245475518685175699313262818315773200953201653075289648004177366787958994.0)
  (num-test (* -312236719893391897821327608828679767006.0 -661158307192284418474080017860142217763949256471548515134335997907628404839044913830388499435166012788226998900468665646723366842553747501004752506346280.0) 206437901167986463762021023207669068873036145952740267172145693855475451354717023377588805030022300923600718715029262618794758202955817341818233889201852381575043965927328029955969846754837680.0)
  (num-test (* -134379788461141842858846278268259347105.0 -5535479645589936472405910397299739073641612836770238183712206042659632410776896398062277742229906915852933418684231779996404071421767274180368154310128427.0) 743856583805332082970350662728998610690268824090148728726850517499798631519601137183443104910590855501252539324674812560702657332874686395923181633958702249128106139207076314713649515720653835.0)
  (num-test (* 278271843790644800793473851247546123375.0 -3845690285506025443856370771250487683891303505653819308540635173436088084480277686684743918745832832765066355874381847690771330587033980524869033600561589.0) -1070147326395532917564114389205677334125034378502074943828571411806344559859053091006175486397820822872698474899835730026158782698085673635033947150554253148685482702599776833910878579880042875.0)
  (num-test (* 22345490710865165412267189692679994671.0 -13168094845644809414256057134926669929759930873747535851687323456073141938879368460977723280750841588750507348317544461824280674332488497533955177541413394.0) -294247541053147552931885013427268298282376074124656716577088212043667912662239091316191145352314750820026626159649861330384837204227899202392764926604802655267738710003310052268554637728023374.0)
  (num-test (* -223445051950608517881717261787296926498.0 -2609806601119499724524852022247741111662431776874117401343811680374867931883996125145979162937751368655661775097445043144114599069842524778189198926688379.0) 583148371568187658089071213924575304457465978545376486297236105670932990897420147110485946155066725440999079357995678147717407410446012970360780626554347417807723098476525833332400212113766742.0)
  (num-test (* 12604140228725912459681435851589379433.0 10671266866958584640992033560488052420339425977492420594983497264069815016478448589306666811246532193922229713077112601565462530332258877522384022088660628.0) 134502144009302626262781543880199144227907004673612064586081220538754991037447647926963488301214672345398823354945333417956344119228084327815583754032364976497975702972112644238248704660063924.0)
  (num-test (* -221289678591114384943252477126208006780.0 20020996887149770966522122735176842174467884990518978494604707026520269232864200848420530223248762875769520715632742683760311747174524709550334825291720803698613541109690224185041740294906022358446325921538593105347423518731748623037078340006459454656405997570119591344894717789372844612253617591807770017562530034107842444403952657949565007792107071767260484233194674888488789619319597151367813735192433631007526015463229060702510632792171187339118004038505860316305860704455466207113207893106982258864355430481457640304138738182009363353560090082819036973601710432437342931523433079941958203038050750205966472435692.0) -4430439966231074415853738608900692925851705818190624801199561884242897308817127146763274284287396980593383317678766559004881552228480591814939402896201244425805503258878061459604511214900528594870260206969839682573246490602076070316760182753341371682323914671418233629420599310422437691170629449435494697829163966912842611408632129590129483811802031178053300073562716917597174161526976287351465154825036851645956354853960835948518860624747958440181683978083391663149733813297698623499283645627889274004656942800842013709298338912226207338477579862672216831422765369078886850523202897989792734789430796029206661261129141144642117177625405158700499049991760.0)
  (num-test (* 180785619668676509441152734583033930295.0 -11909038209406834057075682058438206007134213485822042209417443270921391661498900475635417780140585878716264253792335317341527677051828500780153492153490249297998660274828986996948999762620400587091118252205695562417522111840305140989214300921122857271717052213225664738544344394774362885331856170636862181712515248810239601812262573113794334115259873527539564296101166439562124016438281173202196876398090029995104489712272260608848551754611421227761245487365953257890749115194455096508613617028024932657498899001119282498614739316599704645009607294747043489655424155986912576002393048535846081096337705941547991821928.0) -2152982852345560218506186041143281789706715672110278207735389192913214838321097754496849942223194392302524369156102301165660674797665128931611291246607346536492650554391248756408556789391955568308599431054809433808337036546281323840555452571430884302696950144068129601527530304907460164571704857360215834011779559395577299313379666503707563751314135201994045874159291100986903645360754621200008830207429980872071814202801994486961737459218017354210479544121100423399040398021780750351097082070296255480707530391964970754186799748521538525274241709676878827522138880241734356460339681718690408853314007343934035505873192699052380699509877559455199604508760.0)
  (num-test (* -196121729286794751535600080816329923561.0 31755463535476988506639447113088283661031267977524968610501132544098607201258848456920865390506381665724254592728643925608893982794532243733117636645689751360224314774452374503339856173343683819017479955914451013484169313685311530532055735999039466721411777061709328450052490025363788971916050033904534189719389237878257877112162843506491071470067738867693853480174965212750301808781573369342701195147083717623066339671595077736036738235636996351642097684597005928843274525502529735435418805821748637387888409663397547514467435322454217015563134545731593492200855670248739786405074231658957946422903165662016649229286.0) -6227936422881500100190187768375947805694946596622670066116457374856427496311253030141271922822486386675428302332027411428470488965226898801659352566022706152307022438261392466548357753526474097246042956052374187605144719189465046544498482461077851578811186829094445089366592317045580466302238653533114619908864036973070346979261546801894831273337217021756025770590122176562027129481076270727248949609326868225755958667670279949371399535144788247565199415296122873444199709788941984099349149684384486618280260678252604631431089580057102263617056951788273430713908768738965854953667135156866028646584137788146112300214498814212865170902491169332389942607446.0)
  (num-test (* -149247491509558553673630984739524508601.0 -9241905448313719916485289537122695595500213295294799660583133638026091750542612875183284894676615989153030773719811347110864468582634048542108726080717551794580656021381515769591713295631818532114918070215760259364277583650102628486861397602958930509695263902920994329409932518607260720657755504091822028630927071374796474717671220452208310602827254296323761245420486376569048549643478954846020045263141546849795367522490793641049509748005893155533480849922847230018411440739584477452313387881413141538766185123978087175960946255649923135634987656065468774634483495944248865774633962770893338531522570776854773975281.0) 1379331204929344851843348280532786532350930013132149419346606977890849868537539899667631713548510207947097949976792337278764045110931774279794402312944786743575421497528669859045492875676005849752425421867514661792129580445000023570590786705609341859529483054902802038173138834528021423393677908655442991197348183257271932188161681770513283703502340499171444058119260228931558784004778969491586252899270869275893402714040693571919281494643765571068045362364213060063345212881008657925426024923296369533374671614852576576041747836643356665301762059898161073609265572267138950725010661453917338098901465732991316661901878681888138048552901254914604845891881.0)
  (num-test (* -246070233154436622785727814428081917418.0 29761582253452470642591719346200231425423204062498655510037025199574178834762931489817919404889920159374886981199608181795387339523762458361385170203883094308920011218315748466148953320570427838912637152446837553950810011344492780712558515815917745810385725989241835877316836808088478276603934260581342710503593237081689944686263274319354100341139245512159619947319496638082702549196795236216458749363904150768879765280332386830831409591769966706351022328535490587838695167807967607003680703048770719240872629379640571077329748828739281770075441660330884779539288220944313294762143588847790653176774089774033399559617.0) -7323439484151992757431054484912931979861244043627630118213112440051387392428853497035249623931234821362770902740177541812170377563064854590834087655133962963430877452052749127605572395112726398103244974178157574726551814002744001021805127518246639418981066588073652668879613252372759895389345727455380224104332342029151667860553645106555190741775758687650292791318963679857313030729683299101577207875499929500963723267185390425716927303375831321783415003339099100562942730763231688479910689887284950156875532151104047755803876078837921949287811575034368641167438367411569736575067233548122814012421044943430647665260439418887639347030312118291762161708906.0)
  (num-test (* 203826295936164259559522643510940430939.0 428315860474710981601019542870649234168732095026625500771233691514247613083810271191136212287636290276352210600151884730196161003906066671915478570992925366265552107746965374246537358349673161970290367972281768471743836339191023211359427335141701167253694144280251188008871929010775436125645541749886873478179599464478734149706121117222690271210887178499620737860802605991262799781279373870647695125320153193063528861104479576369448865373971847676465682752435142074973627172566791961541105525781297462635428308325033717669972726101583722868689418677558787287897456521530400671342257419067050354522203242849353639864.0) 87302035331271280954456598486072605056704393103691656908943847729634903654600322194677794243221825233700566108459784062758955025931450719283517278054268553004951352280583820782976072352456972931479389375165173986780482062859853305469143408707179895843295115510597584169486406323435925707638987591151227843652210256611991940374072593149367903739596883229844326054223707236369465710416960023659329202073724249764308867733476242261506975691004092043954515337899900837434270833782490145948781128533218641649564543508314976001614187701395586824982250794852925954991265270537649691628899148413763865280007928191637215283244406869662872539567459561720369352296.0)
  (num-test (* -5899540498246269366107488541138263797694914692322476860852796858749106720144552037986906792251681094769894732746138541066810195167688318229720888479512583.0 5834015210744942902.0) -34418009003174534626858248456163154666511779871358190892629413477534042866009573638264296461516598238780495750056279721797403178867717911762916049857737963922333901125535866.0)
  (num-test (* -7558198374656605586076446665394545534375963428962439959101805545423930654069723860456022097647139432324162475685494459942871728608277717748075653794546685.0 -2079670855873590264.0) 15718564882684481784074014915267371190416032453294568239793060140651422710113447422494938907375595456199203928496644205320139985222135619659630853564447794621716315309474840.0)
  (num-test (* -9442744083812363570102321552182535031605446031706376100893354933468482520577272174689455502380973733378565213055641110431767353396963744600184737808983381.0 -7204974197101757391.0) 68034727473703353914019458883709211780958983263702756416891835054494728840771498925306650413027883039860202168095834137357212487561983607389479135319040711944281262212918971.0)
  (num-test (* -10658732210276096534851972646242288663170038580488752611749460640657411087860047053151548660331707024718100598181073744715506934778234716535781332588396176.0 9193953347013373121.0) -97995886679587166046252015742839992974979220158813197140160489510432960510418039749924861744197553021702396544307690217470606424904065359660871469041838900287446937257585296.0)
  (num-test (* 3330096979672637104536573277593029682675932033891010715180474877149733802060455951241981993421466123791200840797318740359792251505430948855600408060492000.0 -9413190658845804679.0) -31346837782105095097578725347257193539696338226258990009265748336528353873277500144838721882313026604404426563737656928378230261942407473822851842589487713775609448642068000.0)
  (num-test (* 2224201331350479188470378485954814766783857696988331736807430786504130570570323948774102396158334805040994159865821844362926631687258969480929122732089195.0 10226747830478556903.0) 22746346139936030910929166328517425029735137934434969334578972386859485783192993228082340012742115893176871887387993591191632260444955081663604449277961804869872353878963085.0)
  (num-test (* -12394770820700925077767705800588617445613665027183406054209162910642613421436080064653443098327137503596792411463268187212855350864330592654862321763110243.0 336135860956209890623046930607725140868.0) -4166326961171213704571179876442248501325782360170764344978629523457550315208845439497110652079907652744850691289494398473488033083739905461347650605270023127087625641779424751335704552988710924.0)
  (num-test (* 11792778994619176404079667787533709801900490264171877873621265044313417667869688303207909681289642260521608966405181881416781694320672906600599581862090088.0 -197661229068721548419113517262926820105.0) -2330975190212228827672814304508257223671550753091700552243633152084831515892056240354560520878171696176381845689952044935988868477421447557890739834031207059212175922089523097911477486879619240.0)
  (num-test (* 11608994516281296345925963401821217560860934641820086911326880657644311461955556832927259499969983808078591149768068360172431078248807463030805586293656663.0 -40654941048774156019243747229920736005.0) -471962987694958552110784676392477007070112288398143925079396435246284471999814508543057304008480666763661066976653446723271982094424149279649226771823800871458389214002872916339341019732251315.0)
  (num-test (* 4821517917539756801293776911844480642406562140007084392649374723119190602353617113036081438891134008988421494142194891002983491670246762173236312873933599.0 -255528396376819316172341014108564420589.0) -1232034741571035406264710387186737842510579499938716343220834781077329515145216794636313459582844773420679078031627466542930137302257934575129329529129776153159694412903937370462708576694469811.0)
  (num-test (* 7638751115643228563298483305056828584775811590562130101723525925933790010789130133831569153863129513189315440899053288261039147463032870669035935364282061.0 114438828287750304954799140618669114911.0) 874169727255956505920153418854946321208907128396839975975317705220623267360648189969313978740314703015845506506608054761304647627635292132043887080298168302864314697920637105700927041824911571.0)
  (num-test (* -3653826017463740005170218884285271512636869606149686475539243914909566619638259666405831445823138528809165270360144267462878986866506114069923299116957450.0 215752050445782448772085819939961259625.0) -788320455239949216234629350585027855111249573063377172522422069903710014529292638311216050777840734448624510386643245486023092483841464815987597578151663227035102742664709136512524899527956250.0)
  (num-test (* -43242564273985683175827997542883970694363047476880657467026050730764924897992516355909421962249292250047896135687573746158665836208681548975073555418266.0 4424346097667245771102179669235543742385176589624011161914909311078645828684936231569739522607200308028372644149306431599085361996722603718517735348761218.0) -191320070498733614136284309000213964486426347688040889144514933290125387693498098446328694172047943298442181705949005984031677324306763731212307716485454004382079159622650481983102917517993601466178931324415483972311904823997211920702201161092866663969163567426868740120661073974542958600768774774949607988.0)
  (num-test (* -5093597555679260616199210906198149266592665304134802327659606846977583233938836318559188141955851256260954289429418183711191354912372372976165948043123133.0 -2240632735861652612028397136046974907251405868353380459030143407902436514978447480884513019736738955326732458088791830752499716417751919868492224207936623.0) 11412881426559848135724717164530530041659963797467536748076144863846600718211858527283843975968920120508569299672573958424908957105703597501013710262110218780710678312197455759181436286391257283676806548463507528765947919856827004176416634630489598937924092540289712219714362500246928243091408698274649199859.0)
  (num-test (* 6049789822056553589237940133475342650218069231558204589924996117723031491205673061674252841792149409384720347601549237626288416453061224734057079515141650.0 -826416247951451524584060567988229017033981218652490450160817307801130685352465013890931297548015267655971295627931896259998420078888499206031390299169584.0) -4999644605638856588581238481465237523157457201817697008198975191261856978252081380810200468420738807464233192102972784271159116426108806200426852134469939032473362689081653859652824862066224063273799612269941254948709760659691148103622071316554194507524610166457990087959160807415102946877307193349131573600.0)
  (num-test (* -1175978338162966145239180473229656000174129248706173549637767835154921467129547950144109700900405904250603515318348888619371004435353505449762899046094747.0 8633693716102199391202401198009047492431980605560930404972542822133579985462906768067706391388213605203282586546130434156768523403030127356256666478340720.0) -10153036788469908062299722391986722149392791936544969945546931764708792252481931153733789787389051773529081688846141949513463792442701686406966696738286561777611293604311491896230769507535896070984747493738525389837795316954065260075941524322954935690803870500012809797698319359975893462672845329776468197840.0)
  (num-test (* -5083395547684319640767882199938390155755986838939007846911062687871291096073452055061784159768637502151635665247461348347470360218957222873087414506633886.0 10813098236568616588240471432239693891825284805405416395976866126102880121934298269375465735278296789484402954117593716698067735458182402220278016922449294.0) -54967255432446073625448401244836956268872685687128644401372608170106281377801209665004925733448944141633739594240156882328181133879414641109484442890809130544146420476457200729843868300396656004198615619691952536924980482714767859804902602805398865249514544806725162402291122143659939645240358379962457176484.0)
  (num-test (* -8944626200084865988157251013718979706166428261352840753194709093968177704853157211364231059892647813839391802007588961807572842923682104089512428902387812.0 3814836951264415657788614449012480613328314590744410079075164918748648723114236698412482309581077603776489883375576245233128800002373843611668945838558629.0) -34122290543331565327874124324135450224668275222811493728051290368641401807963502623692504750924543845019291736982354932620821594287780848608647686402233097059022704206628297180782771812500512744911371653368388270442874670230118309469599458827222162362901084328510647514081302476000779049412605744638457029748.0)
  (num-test (* 5186176030253526423885531264483408352469356233262336223619904269047786350470477526433506158542551137478071074193659876898065998079440819597952826155782068.0 21428324964794197485898135923805540163916541943812058590308650649384013587098638034673796533027113673143959572855470411726978105342739938341516634354246514986124789451866589211982659199267654387148420461876524076040233779391563396552267276880650559148637067641021059664960876301072636635299261389450890094318429077561092553337025096293793433968243940381587994428364726938534453507046761494257538813861046058298873206568935790790373886840765817404479239485444563488020955730741209738203470138117422899051269778988135668626686262669881048094388220931264751830393793846372816717368806996496715219806062282836392457741918.0) 111131065300898907482632501071313138589398597291097276435916516379173430095773463468344138866282820740991088290299992221985607057347883717514843661030457396422379155394966857856069231504805779448809986906434617741485942621643754096548512120178021034054648207248963478122178145159262707381679354401629366698488021743300737044695960363216253889163551918513521913593214414139637549577618641974388739304727218804595402055185824193445089425262833385286117064481648652550355832014346131722965510192584901901111154083186713580209077544982897821477349293279848852596241762198202012197892321827305803333334823616660229870976569043453639028059771892706354703750763908127611939169337399882784092285804830644630059487027413697220038110815990084742241055099963659761569486906596326424.0)
  (num-test (* -12615422028124847936088012564413126213419674293830655240645918456932358053670311316461359727921727680491520480380615359506308571290338231702217134487397730.0 21538722931308708400287621200994476771789912594554241036641406577761480056366647329031140922034590767810855360008375309986798226712928670905618807986829790199948665185268081173685941421700542631395958882077936923141152528333121096909688700106365468854487023847026564219531968849793109908193037522063952753477768381591929787242143631287330811801315216116212154423972654430356675401769729358415036943501470085182304183033246682446978634892995900678975109490698283226559860736462409705544079080978470202336645384768211440438501339641775269445439018148409151795830925198162301321965042997632479354427154223366199106583051.0) -271720079725309675925162538296715595434811519956795637977932956405490708202732964133816538801099235844279338645471102896234318181092598033040518838847055114923365599862266767493227393553801736813141780001130539648588341196802606083178208108557367013886856183999712817955194261262279080641101769944037282423238147653270651419282545398168930625797556638625301898893565965773914460998322350526545278664715332414172614761548301364063397364632709194713561073496860524124460861314674679928692398440036071116570829193414179054372604203478369755566003622621281005164747628075596444178089558747835994702060740334079222508147598079351187013336751322569865313532407367116553748939535664259669808534100091049960040092785009707220249025633808590643620557093069849490009472441113874230.0)
  (num-test (* 10381022953674450046578890619826448644067144294659610359943634722044183130638243233110364436029778310048006743033299956844491228999113516347401915490861208.0 -20974871685432829994714153210121536409377362402944992609230062091789259307033495284524234519701670462495676590513192861649457148897274608767543942797542628100823017887236899471151903799837558453043431373811892813126194662218472834650841742305925226558315372771353677064933578639099452438843500601586038910108679737480263349221244638463171088589123712367802373159421798288708123925853179931628847579314900787361946716531755600236755527982132768286927549323465697241340003870259800347640599467922823203446834792229595507968354687630029075884034263531531423883902851487995214646322431057626558858528344843531280263328354.0) -217740624416854507100100919338835880277259264187442792458843251425095703739537223785767883764746809214920580060316177442387941385712712426957388995082877226019966428812240179251716274377143798847348759498926420314709056615470455134468678662646006408843897699718742372199854223008996321568642038054564397441209859567556502098420151667437837356649730396360374136203172669776530655738388121236079327354422138744456395348910073462618440421257604563050031602590345028438897601523520973759458890228893913090702884911857207117714231568437403212806578764580006787626657709435954760239671948147344463295520930250155876010414461245194991189183956653772752290656063730950237649394743456230607077768595983629559996700837383822873994717987698780007691157576205450973669241823945091632.0)
  (num-test (* -3984492646329789478973994496812455855595578196959138558282015917391108383154917581748539892089090551298072688793487597623310815918942283997753800645644511.0 22199897116873160263914990610762123553075230334116099569358672964060004245706770678771431369917479502828754815568950371273785689812698287446020480951417047185190067265849637510591502642000414540862689426343523077229502494771352820057572619644085930901096534031496492870227890836816886496090287321502805172125273822231241073590840684742085641304915656543831190976008986490532066597410386596132766422026234488163435487889876791504407434387555507637783709991326338482319227500686541368087892665100076351075069628862376686619537655838590687615291898971286325099164241688147975845320979841704002364545072665891829427213069.0) -88455326811459002089798581395024759975871889172872668466370443703433800509268320055453743803627754859670391415348970278548381190662701716228279482045339649051139909543850883613464992501666524385524517648069873862957915620016943364950043289963237718026629805297916194484838158010754666017024585366330526135823515744339445036315966714684052345462172808299142368905939297220895721123725415007532441824406115746741972351142687017849809593982432484296719999502992792447259391592152463664807498752410740679664044620898308783634092355737296495489953554685938970593890496829484673393665321572846542839714620847185428664388282452532264810310019327395691530430185946743995669191791841546685206884247468693248673484055915613115527492005264289557719000245333079386593840592027314259.0)
  (num-test (* -10672574004830373997900438516438419278676753890756925443116289034080220708922677740383425352837266631691319394850521121221541344600832530724104047804922665.0 -7307684417326792807224298894786988180161884427390942431653062127076829842696634441114228528164049031680536693195116703321494895319862805505304314401000204515985676763063862569446064343853536464020413910728442475032187317639476018710375702206456631041987826826225461927793241495220512935434301833094232834266749666697332380140380619185254354273073522191066457437931022783436360434167505326773192959291779779370530770935758482422581712556111319611455306383173529090289274267200543081481693078804068524057891845603351773722737987393428313340760607600482724483853560340630587029610437280601010173185018227638972500038072.0) 77991802747865927212086621295493124451256238920588746597961055391511562690441964216934615500942858653797884925704270904527938466874924049039962754703188019915846345804228044693122758075602494985337649496117180241872910247079655077012999375809878184011356481981590430241786534827516536543734645410817621964035091467871491521760928486006653992134635010794346993161329777270345449763927429735191213854873362673179799811714902439637861750855639857969259787075469241319618538795721956528400353086156169058060112255274542232054021662809196965752800525093125763127895334967094763817500702626282397394521201385439419885607578137159972521677923972708827090645776826953976605193554447841693259586575931864396484621463004541561908426383260772786784541411548146173991869741515701880.0)
  (num-test (* 1420855003086789510813111205540636553863493314684153860389816109865085846062678305775289632805233481596171530412925552158799875183492757047174905459819169.0 13897739053062356545217161606361735964779941697726983959749295377836209520566715597422965426908191354971972501742952706730523748574796773473606175934144970768662226027157110240776527834790487577863781140089347362129598158760833470434895693782503529955845076709376071972727346128409008293671217324995682020009675316075606538241192607139905488719485728099428376369506685875348346231688684483781160648420909364963718027571565217314827671844485031440079254478598236877074793221578612249882886835580737423192061550370069895525711885220268707201966615936769696379335772521903910689934596134239331592980694745008817040569590.0) 19746672065138309742065153069587996891492444461032276894328314121573439684229636534026409362850111716212254549198595854140809664451286626009917828620279583631575940837712663100442879662416765138504151063632823014639305658882804073655537352377258786105147057375069447099908107785635606190515362082317465738205179108333064680370909383338688734129396788764959056886328471374018961975554190739706996184818378586233017775166959010668462907838359485424792026496574369912033757997469014639705459505746723512361959074802456098328538419933637295482429555127226978561859965498424173552676019033370307387047798600024901453757451579262061785051932535359410827170361533603618131510421439128567361259204833501190218719779570258541358012741265599985490513564378203502703406698160470710.0)
  (num-test (* -25117824099635104147178796272946098711514362630774369209876335291088434247131228189812265510495277875692804180473811834186270331245779845635089547499275113671007257221593872123397418355506777725721168216892830217596134983713752526559153149600553468865338887605949011743043425900799896245185282419637806859906582214420191794114207677635194054239563071023206500505880052007267243210206807805387341085613436600843317096291021780624738422589234020279836961194869688005260369009833026575446099544900581955685627511787510900479881434909308757027825050977932238481841909425598834367032841935054158448815026264505726593064239.0 7846111496222858966.0) -197077248428250572361351389692146917243277049539013604789802566767174747369897711991559940484392921619974209620152008632450612546796556905740493507885376190913893140368029841033442857949219716681475253727058707723386016055991276120001690579154370788782636181079931076758384034193266737114305362492836167078199155929937891579224024229182935372106924021709421948701131654358516297806197381566809357458374057189773041520552821330635689748583803171230633654728360451100477472934847975252390985102859262992904778849652221553818627134153578436315973777720706502751232660284910468721430874674021521629540714057383398858244828214000543075116874.0)
  (num-test (* -12000343217458212092754251360179138661969968218789048702097501439124892987400633614429800307263114371624489988815324366411323242909652002510513570900627875514001409309670202055060404640758548257776155562167062337394219073071639153822126554525439988062676648294108951003012550815746564810508912122306190725453386412796036693387315128514162061147675205485143205925649214342646148112549805850530430229663418469577245456944558387628002442451042105749848177325651852669794048215063957689756465788955050513359977166122710392613631703123491357791351447110169966270916789849428298930624807758982400706608788793481972190953569.0 15463017349709835150.0) -185561515374029078700596518575548896805308728003103939537818954646551372890610870275966055765608887701776880889777402229764948269089126750201922167386201171243298907675542965323275634529293654817279957832652909009385491998537031060285890512199675273422070784691446251899120095880199298512230290860589352290462643231396804350623684034400741386070220057232978556614620855818271117742675632435727751812101639747357642295230273344552327870600519422276996860893842363996198017494117619585153346745838853026029459826407782259598477529242420507010652705302341725948095720110508044256096963772599572721279996322424269691990173052929936294150350.0)
  (num-test (* 20244597897909303129995907707212050478823487084391413473821544089492035634291726811145005824559631386634261268723753786161463497881725871168747275110149007801865428978596190887145324535224079986377522166727137028753272158887188902047835658826867304220850429481233026043496635847568448251753504834367809877190895369288045026559783632709799678639927825194847005181499299410953860627694080906167346078299421796974815616608326704894611151743720515377248152215241639534004099341398238713597030368980166731393247619511322804984829747216779359780372801101821087516269912916462719248736442644433057333788741151270815989388229.0 17931151643499274580.0) 363008954869078360197158713265773114114991766614027768774402465306840646219477262855625957403406166192075865834283840624408916170935610374573318606346031792128003204902147985329385955814330782527184421959263266167048755628089412213360508944817963403092490479480264538027768728303095523018598016863928762335410109567604756183580676503045557867957273324581082608248341332512325136675167966306268035077761004923732568405295901819511346235524577361289712297365403327125212199451099538443576479787130510546755789504852631291774614010584650672707483555436445926222945298928326313943231688436271883746272589347954697213098866117569339490918820.0)
  (num-test (* 18134862906191691435095953372467318196853760384894170022863300447691250350836421337333332682828557871096554531436829166444150586004379181099133295174348038948038399079336722004125999533719492457544642570217406286811480006881054375314838605871238868968956868878182133492469763282800195060849734382249696543089869191257451321764806079423169235271658993054867624410589213892458246001270123109841429271429275464249821855221014782727398959126117031823977229309775211695677345378510417534328974531801634095862859684508240122911023047425473036305928743193594967362216559973174709883576295373749738633873828863608550295977368.0 15082354452174510460.0) 273516430292774638949326170314933525797985748367549139070674899956657807928629067317576809269188258819686207094298714770978509118959142516619521080722291318367607601498107007447014759288176261262818034997399866363248136237609824401265450913244758024085739876914482935655100890803279961929047974391299795570244708811454483314898873277493486428279875241232025231140855860469097028388778917980779775554139507550577255217032521719099071084956515691364008526064349956553916033914728254580848198941020806723485184338914882588931083516851849558411503129184026079582257756707601984686901646494090820169212279581209612798749779318126482639269280.0)
  (num-test (* 19213874382308276075905228027166553836726993832150876980655958901416537033385379180983129528081628446454583401834309285184752924794893846406622935494758142810049493348116192315865522516744262115026742103678965417868790607689989205765793528434388393584537260717130892518011447327847533083474230074174308157934463971640826422302901570010591182715932658037868980053012095115562188975692530473556182305847290196895478280679341869546292639446526021874910117953225154204035612531584978136604161393474554294315903436682283787080297348697922389355209790646124024053098888687638640826064745026930980189268652291562437512941810.0 3155416591710364359.0) 60627778016974262766014671335614995348970065077989108071534610098195400001445248886220725085881796599270026085183075312353388418711598523030563716616967792282609748819081238929738105086199457414615236966895805539596649555457494710621217412773036416007129418290246899690911654008867819945724649185574237527152410775686803449108977881160831441280833577932476667657759420192656716352190871667386955409426879693856001112340390304980532208752863058384169885129364117656404549585836664647784765508649117301622797243353610345828189312360124462238989888436478381583689386509617357901461416012201469794664889076397809504626996523928173064949790.0)
  (num-test (* -6561903839860415551587224953276060627466820222543175464705113686962550773423611522044145975606965294164125376820288981286542044306677764776675868357117109664125730405280822770267329297542599719353907954399688197248115043785617436343303277493146049939491224480136371029084354063731401026459653680017632996944506546122253686805764620116169065663214526857151412139439538335533979733329962892417175374550305659302592107472151941922230309227785266745974334776462642676959433923828440435340579340133192678341787895007461237846313005612116885419002449356480017828933592324336731295317076205553526568668826499450826560670163.0 14908715577157091280.0) -97829557993133908713082095435440645457469053259814412551982534425389603663024461131358343104414088618618030154957456050473312402460589893359522167472060177968099538846750606564761307960896264958539903740023783283814849937681270591589750181462708056758506230073751440847913386576449367635057595344744119561166438538811561109125506233466453974371464999669336530949393433719456191822836826214814780222021267726528396849558417851727452246676857867278196266042327956933753121947589485377148388716839519782819642328655117625818256334190717182923260613562191698788004591479576661108985313450029332968584240383859113741485244318702724563478640.0)
  (num-test (* -10378013547095983701124686671659666242518351347561698092030999302329372512356819420877395264401390796163955327080881297568412490286247154759694714275858127906305200295043241717769593877683535229411640745872559018085757273530771413156968541499388413497221629366848027355125816131586610997516488552323667400115617175682996681969687885201321292153656071894385242141321468096793766926179134511319941715949712230831768643024119693594235207988046511542691719002262040067921088838755337917414526554050602539873232518619281766327369577617796816586064895744680567067970817494102948032924671421242699225194947982378019119315136.0 30004910492448871409155105619400474385.0) -311391367570036811050052853596227388481520279736812036769684195465110674594690412517879149770622679377262288447706750813509857551308594851067359841826754786725926298013483569424123912020079066150719085450400229896983461212531213110847425940968466564079253939695853896434719530729030897976597410468081535234663568150722646854183317007227669132983719314653861536414057481478039579810285535699518386214012059191958557306338432321511585867535008319640705419431310336566447165302011113284064246284641707577414470505948868362067233709611758700034131461348997580441628136979257037186480770286846026250437141175360847735150981343952303257191661069675154710791360.0)
  (num-test (* 6311357747888359229575837883366949670125882865462293491587368290797766017168248637163030339387377997726585769250585768079027576213724941259801478313127113803503561717311996500019522893295813684259416551410025111443510215766297835872165689077882298506134885487991732718254835036694083204758447948541157893533099634169589161496492972953698758234452126564385255035294546278732684663873459439615228706684138982066055370429797835904846166362278557095045056472775166294675997320598469599722704075215700819354957397052721573993997624711445698656580401684113096559767093466880001548887739825916626416328760047783071058963451.0 -212654096583990292869707082365869207538.0) -1342136080095566600483524091094048745061145155430997807005186206704767933140306297188996797343723817220160636373424666345108189275851749622201429179882167381735732553825696482751584102093819432866729465599060815670807282181979889263381844726842751894916887860819210652174987999919869623292751389157233409465756974677789790982740267208982768450215563288024088369480574425410032306456026930809228182100949940216614156925537929648841127727165386031716586596638254705402653861723407930666152691102484352058909219619985877341630210918347460471644327858114815713557305185589162775699323253049631349906791700893878999711846225062306568467992135934882289075693638.0)
  (num-test (* 25104391676237653962996674810232896003857294806799086059884413856421530328279649263948893056601611073815235439115612155497964541323584159786678357898152394779494741995735881624055133443980324145256438160990490767324719276757840825641421547232460969806196141938571103617707677351907526127993230143577974386169402623023560579220343920203666762052525898442578990183400559087522259053245822827313206196194989095468393682721753147596892214609346047051670610252732846805143964713621673722554204896154742594858056891979146566683467510164875593192581407047920719605560716270697985110227952698114701527191421628561835164291236.0 -205991315859231724218751687295926841150.0) -5171286675233738337789203670843122752625713948587464573381323151628930998435518250812603433784823922283042037694290795352461861058217142213862777203850665369756106838860420507328654214723398688455622487003912073924323587826356928211672752672052670663842775836967587150049181838707784871641183683742967716787111671792311389517753578360293551031540853470719098360013225516593755039537796518619542838794169319227197212817921098393499332268929332950035803734983497370378852859829228973012039890600437082235032378948656232679080766068869430262740600476498399803176452431728914806536862849281928869092524387549297345184969051926149006293586531930828748109161400.0)
  (num-test (* -25971587288596053786734900662696128734726180676323130693160397208008930123341700520454723462226657743365779183466120836187720332442041321870351823609046027805781414454998487673927365486893294110931852680018706479684281928396163669935417207859889405108139261480861908067489849403284000981453574189898304616775302917687860062501465417706095450121596418236563421425311420755550335597318818628123183624214438801254105808079227429950505879366254661664881055965092586612702279548151277733307180663770432418397550642136953750720624507617115504303570076531620003848642167562950736271141440609700821621532583527124386811144839.0 -182748557863603655835821910989658558236.0) 4746270122419629115710902425435990509747636609113505336611751359043717100752575149404352359855260443259846554733621122684788488984010741203981300775978945529551335641218319619542248418128319220383298229263331638090009313676486209764655429828385994626323209879925281409485074778611946493692237774852428345451174837474328995186242262565013937544898941834362941815633750896882758939509605799422068815435202904271722442099465950700886702949580264958171808372530471918175963644209760378395316412115175988232945569517230829200985652504383431054550902852797293952515652017940918628980037316292352828228005975466732028971159947131994753006597870175664981312344004.0)
  (num-test (* 2117427896392849163304163145095251890404997781812823978967013619233450901604407363671467658244435728579079751353560538034596183240362499870272373308111405924505741579887345118857908796509418246599428633956038017783178050402412769812823236255234302205027282366926174916871858199918908361186936687654278623156607813451034087735179167324944824913226799346886951212979149617678949292799645035425029596869092844906629996914674904522806258932192931217652241231736891642224851547474205131131019084734780208254203537633402057673465583362982905095029133132240839391503135932501785844503813910210348239157828902668852795945482.0 -296778668392678698960782643314222141731.0) -628407431508980610909134894336322264939705333430111861505965183839156278363647883745193463537783397824947515214540990712455315080515980803996660089847066076833542492719707493333185909990202372284811233272987993068106356248349054482194817336258302692039392400931536481136340269417905505366385505196886218794044229758585631131853635721528813397816307666671727692971421531381290925317161326036075629905443938124481334173158440927555118173661486114828362551889594188958723424604273078091320087897088472418346754088900034854230711982602435635574895960156993014703292551046970069204857846207328434544990709459402656908170089318995291341536347275682867153109342.0)
  (num-test (* 24743327715258194976385899813930363006464428087412805068703455203318769863096919192538751530954777047772548306936907016751357570434930538612382851621309732767199276228580401695793317612267605312672263736938703887622824117576912830029817460033437752668221355377879837833796222831371174014543622739933433581963103361464022058091243110136610854806189138108937004805781857031030005354158991203388998364340053773883952742645161560754545458260688560269655272249435540890073696261770299845722705104648358053080678920468895189601731801025555650490534399590288852165862135571140382055044665678298182909026026068995867606241201.0 309156501491030456401354118244509785044.0) 7649560631695275371386748526795333430293346807872366006552933839286343590101586516802834568317627508914888989005968805867728947519409222814667350103434422356009252082456906520988877859152125402282765775845766265340707473525444185795403554160270722809642681642831847296672303556012796775586274347178092325226458743113317655523655255626670958156216225968018208281266858684283741496986683426354716284780229004376492833583965647875097951642088252875535823145900129967026856898970545720526282798418382467634180690243423325770596949644122541224189780082061715230852249880601371985342796525016176048518593825361248232406051886794538203297084423942036889326397844.0)
  (num-test (* 31345149697924857384985323414506591310628538098830133854928154990821019223495435414394178930529373634315044777562902565397455028894455733092896622048288278424884040917250546068175763309233883078972879622697667174865833277342334219810618450605650614585133187005110148963483824629405555603493157452295284935004578187488673124814714326405406894084902824045787647963172437833905574178160343833139650913077173865287057167288286708807322607983179910358234015596109655900840652230258122852488289951986129788952718105898226951651151495867246384586164892018870981480003722043190639707903266193064807571586900961788679579912089.0 2067227180806746570739122295766566373146995767544546241400900414826379465803168632854028593293108913670556431832056563218709444199286888840721753894461468.0) 64797545442006646811970698282511426059102976298051534827345388707272469591333019870381858263624490336448197115781363489554169207652559213486772008013638214870324260793199674746523791257170452738018910619029072942848422098770309928561867618844814267276213608306045020686764830302020953883994906997293368193331696747777630621086600981981357507299729947717565760536305785574555255589190221698706036770081438750974356437738060098906046001271392354762036427049946092656701257615490057677558059955825843182799904828201890893555678855718728417223845757559310912618029462136640226686626513375024547351747669476392735304999046232068947570708757930233036922714350584650744960478326257916948676866148362166017752159953504981324652709881831381637989229842766220141292801807437886652.0)
  (num-test (* 1965759082776833678304908699214846485256126608825750175641683294458978302204367346739996602241053060915897480812220051082619942907491598551933638540412113496542245474287364500698693202553692963910123752514310355402167440783023542848697962967771951714434359320001430281377747193083851165947498546085410216620013287853719686698746328198021011905482303248172483782066908570502837009924228011993318265674390462360820566174204659723461994730913995303015012684826295802887547970851558451858623353950391701673651959262042520584275132971807158231859672678070714276061110616753309305801080136339206017351200193800253572481467.0 -11092241138073130060021642325471345789108575712118027611362686690749327689527135459714040658411176246054106270789083336195599640521602432629024562630323934.0) -21804673765518097879589124792137157558586438669762099454880024920520894260754279593873244443852337739758694535682558790532827482894104906218015712179591886600693703465749571299271429989154199263793230178266758966678432691901731270899259065726530463438316383699558373053423999416350780342222940065486831353604365192968606300436304827279383661172824549131179471364227618431414928702407510473319879188990689163932586727702195573766225861364297410904859137393184592815970592502081722125458353280743087607273547490382023433724488604177909671497082747464946083901888849483505451426245881736990810339421864101129619181017696837017966116165703320918568645290788634265522956017905246042460811062666193790657969385648522736090098231379029903772234867701846824572274796526421531178.0)
  (num-test (* -4067457132547237558852016696244696525033953641638067592741078194074861352472861925779476293767777560910963786727886946479865734639031042985368829200802420611189793957001730656623744670821921724417176679009632346904384261431052972127975733031277489967119978909321422086102208644766894305071609385305464547231057263658903212521469801833214062476735046735467944834107695748433481665714184831786462886261252526036621257865158497049125410241033365487816324425563483999957660557670189397770488996359512245971368638615503320507431381893539767352426795415898379765583574977542068222040889423739693921998717145084904555464058.0 9635268828818063607505341812331931088336041632536136269505180222913464638532245578488168867093853062326136774925531196873279749483997619950077042084971972.0) -39191042921786100943542578352486285322085069425292685238158202937549417928185097567102615300826629615520476316505465412722375794150552330462353356124896483739321653441446703127728441315609093330694305784991844511900128172079464896650958648496336601612657347012294121239821167759496102233234525084695798195547141521849769350204659392602605928907953707277320590923278178152903602506284861018886300148663530071056792375593665422754923886137410482547324901798328311927545105456397213670390651819229021443747424183114992653572959318104053511452473611466305149349027962240989590453237778130260105665310067480846969449221473610614214933278048389171979184119355459010233147440293881252851501522689209874112819966647846701257081192324007280573826673895648273593609466000383382376.0)
  (num-test (* -22047771987573494284336211037167956208924595972749016352929724093971147687332865088249749580556015503923927321586913446367676445848750229391300778587369581738560634537089081840938984779012854694220894920437076215176060179241185151442003472788530160589267677502568156006531439509890061829154786579353177129190813899423306499631144919702707240832059008168851983259611724134448165201725432622521420667808597545410136493805873769372831833878868603946583848422310946469083400330960925084024624317866822897278934924368888332618046649078771617892961267312226309927786691384460940015979582201446635756024251269978545916298961.0 7481502540911026808093162425787184755732317118387068406204973030847892995155568099553397887864257088525242568880427634318737874025160499293315047534753494.0) -164950462146458057264341765173378248123415893870534274075422323606836246718538063890359159423074703472625232511667875897808555123518162244263016096627959208397334135559180524195701526029092734741010866589515172934676451385008535538102832400604699294088534999994990970130226363762230944961249818769566697211068918154629209895730969522747736738946126971914549491889482944152891334838234907190697109929512401661529882587076352559260375439428815896053844621297552401396168240947357044985051323834074355418902009161796886350497072010833513601114819625605048943438304411954380599728561071485061414856047768286383287807924135081902458690495890129203192613070824670256334683011083767124852354110322463725619194174195587835939047474059288568764831570274891727391545546467943319734.0)
  (num-test (* 22607201423790553279447786193696575272983924506336369475058795405894123712509544256099524616893423762658394830755129501447553593365768543361107397299007141714383407862976654294384881771985218996697067215804348472693636567074361380875512341556932579903687576929186215185312685712277482751425466251201421842248749944123326048360909954588266368306843116245625635467041934524547983478110533044085242847795585598341867070787331785945399446665919396062565614516404861115244243161694059679274045050270546536781907061002623188435269769778378780371158624481539046590932125320888745103158180784231722265376331553893647061533815.0 10075764395489719205294189472045365742345400155046712954334138069917417587273618147303160957788995022989479371576840422540097479703418600112174202202728054.0) 227784835187493343385594867881830022845566753253174983274076326016001091958812135049265213053390506720261776960833046225700903422206015373488419693650378821159134369608830936915027161415300759990632038898164509761337714774392506802504397626551196717184785586630245704512525844329038355790338277254618639554796026366029578805283659986085947726260520495140332204643887370987929304924491772630534558682402396784510750317396488402942581973350428066695976988812610467654886227733900635715495731445319565054848075104982244316563526232071957624002266648721592744376122065531440026836549316222728280595228806728872537793522244957258060730038589170810090676474272044568671474692128168357087077816573419470273384256552275636517940058764711467508281344270125535855785388198570146010.0)
  (num-test (* 21997874907846585575969651776904015812729615626636027149446399573806943459105370044846476738175828244018281160136531735881270437472624605280356112191272531838028896521621800558410217146758345955334174583639352151367532676985598470747138461153212653362188252002768647808852054182649808145379073620834551216386805267446360709820441771932135218282126427988826945094538034579367527908530151926679515746133600376612899354099328788736038811470295396365432559354070365548930628714861826464935305416998192532029724853617023971964507955475554955277722555849603716733374588174421463022213135839490633927005539569058361144905451.0 -1400498192750070094581812894241996480373581610489471746158083224360249880335094841398529960182484181641387946900090289855375996313447832474435929084180606.0) -30807984052781257825246153008277875918087659020905755686964119182052911551148620538090633516362197112383237624321406969368641524681503231262834662890145617622830207559490089313283375890353617292096501953380469351747504928597461154633889236826060654886877907382241867167198409355653371944304660938495445848950444683274236538890057643038410268234731745456035923559528706349316582901179686671568504971088561096469997823300883298811440849031903066114422309644669680078733839046643542078157684064686933779591609758494599988463628362190034612412739669041368897594110022347872452261447359402810277413572637740870748949093642723240662839444216981630862346445890780016393330114883270596630385367407921496982236074288475142085411632630374714528706189796772213264952893973677883306.0)
  (num-test (* -270155241925436273159477510619232592261228150696806729750247050.0 15545126743930076938536195287546926534964892301082800206802745964245668351235397.0 72127079799316080210744562119267314209211162112457416152560774669179705347659265.0 58427280233475514109627698916382980237252687770812483048907352594138577656301900.0 91336330475502063985843547526216808965829995610054777216888670176112782119332811.0 99495081134815818196404370468895496198561677002653930126818668800341380375657337.0 6904264296552316628911621065724553059847235903647375662685025031963599691416829398469283631386160328944460790101458427909545198569619131058877708293713734.0 -16074984786353617526516141164566295497596312655026144270863093715961484079732496604871734572736757225277596743795506589617891195569235287256031608792067121393492186703333733526879481948463529609113624075923052999494363547340563039654910799974388353472433635130983731604982117092991918514078659590068643956240711810902756784590442416249652077644077280371860780741318193975770906075446772544431670392964384669681404295839302410058434872964315897505894833409101781069230919347279857855594782111721176074849502391457684148683668165019969667481755384384017844104770253558111588611189351637275389688093074751942960310850074.0) 17849860827147993486644896214424106325295064110723402251474432199595968349198253682890653243676378684005650871261983711134190416277366473221365848417375107498764965893729640224952922241531788638514200018520970345581414705756736222535562338748426356003659523260330725662384208724142177900990027225665451069059291754155591197426279006090296512196415617974140965334686090032257444820748820516976632201388937358434205022475303705442914044454220818215336283948743042841946229853366515552653568436171217572212088935263340599371830215580988184775240338748954666846379831467518505260487989636951404886967842600777836444030434816421999334066711024026401362115623932221335906548647785232855815515579448393689650116225664467056283988125816950714780486880294535933597118808163054631168063568847830481653855357008353733414826165759079092633441356914450038756281940532159493763482047244493174370100586359619040444818634156576789665732998111907245928253704097384811414269835758656988678207624731164159069547745777423464124959379113843649940896359346515513936964849811155238140671698227057228045173997904545787593258286212427476788605370334985423461194148838623911634821153061693257996982252745844329344589168264774527631972524787804330730506700000.0)
  (num-test (* 6411564443509812216548163965666668398784964137255201222920640150.0 65325385402074288043601436729391841747319174569548241717675134253657593233436152.0 63305037198546989906433329294566491017476837189978173607681765241525113921707860.0 72383582945810879300930057856704905379805338886592055772943486702915907397618845.0 35525980101796892634292856352740658817031405780112750352735419884048051630180860.0 47579150292602967366908574298176357632207539947399443701205872093150879604391127.0 7775494633965874654516687741429737470333189902121089184439228657893110997221737422210698789286625633365548095171257583020272703565350668755439139356570.0 -7847653632223099338936161226557020783515367997970448568586056286591257384101422312757649765574456754668588904917800060981155642916520580540801153603733496143328839018174649200566737789874193483124577734129346933208306772618814806884416239295732454033604210880463262467564639515484363761639994642888910703066277724414372379965872478153546766131136324967950786993982228851928269842355632200589446224738709869729930285189047112131897218464505263042012855229737941639093204086147932759923796947642895167078971517834730472596647456786099215405165290569214043431009370032818978995463168133051136053246705694337584724712230.0) -197949741939898550383903354028842356745461597695099989904494711851411610441324234089773644533872304737431480244289438922163630848266242200711131210228027234579469457105291847132071566876246332653149194709623963836885480655282595345693084881617726426841183231475364991154699746506928116505297453355016975688761948609740314324443406930215518937775475617384099331839748494157863510168743547396262979908353122625808170296763676837551973930928848463398657587603606321137626467028732193151671337338929938959296176472483674270114824853018199281637976410726195357458134038379491704909997939715446657856320452698914513791221947734373322868574099599391493563479057703049036936132407025278683219316357543078875410080612067641232277376174351958080693019953378024732243763129075732499165068171168470237875348580987967740148512425201518758344757030205911031119619416763996490581551977913711646761182756531618786226541010835120092904291975494846126923510483263978074437667987560077422810120462938292680423746968095994108344184522240467647491991837793653579480334442342102339933473270535800619630342940590477752278184994533764839125736268376640933720554199782388890444619996919031351334561766248781813883867406045414518951152508504891407920000000.0)
  (num-test (* 1669833986019218156514274418186396165434871163342486930502417566.0 58528969848472951398118375496887849181512821636583415470809040929690124231959506.0 50098163184827557635697120379841225459445103589988345336880332217224622666020381.0 90445522698871905833766573423181067004916996574451008349087758531794463581708977.0 92366726802191504770638415639612204654473958526592425718659284841373421985393966.0 69096133232785816552402133765198624674167660496399099321713067612475604030259084.0 323971624832697152056406152359288553860210436839331005469891386690556929684663075996719803995137130737141925308417709520389528780839777347463558171582753.0 2635514624483961079560488004237441873979133312246005082134175818331132377114926863102436691793380965631848192666106793612266994709357524826644421074908075389316030912936338175907209987972553710900613011802455058538786723149316934049388525865455871552882282353445228425640452635081303490379594663330152071465360003249884180020993032086861074931796165970076448856988084523672973069824258299029863033098237556417571526135639288006133579174344589248428714474318969988990720790226604664141927030250855550010512291136517209169959021730625428868037074528890516086527430801590050720467893089085308995719513895962750896813152.0) 2413207990093478676325592386500172980330574558867366638913149256222218924700401110600319869300256745035993991818342784487193857053589994816247466074246569162659879368383295411190237107255160498774228460295857931362161062884154872938368166514128474751716517750517217000290486110198899480877593169193610813452614906598055909439037075588626529658637140089909227353944313408987644743661503976835580507054926908821206921014266535160031749397432350114673787218438589065861056449106115395189057409933330355574558853874223262465965933679584884152813357065227868165556818717270584803360466149860292769520737249610469675917864449261901859162854558012721179400237645357401213337423255109839806528503425658270050436129019270883446965562683284298538825840361267548675967778385927410390726055957928634152514415917053614892441910675109517307682075989998558764742821214685548219206933043196677521610851950501225469125512893859254575460130829051324112015464552874242522140166275233893076603452098841950130740353331198999756316969161591691095397245996664755249875720008141774247384884623389430842799829690618405724986702942913150258769060684255363816662231923570491001519802836627028431389746450987110456127797025006251203111629141890634728548553728.0))

(let ((val1 (catch #t (lambda () (* 1.0 0.0)) (lambda args 'error)))
      (val2 (catch #t (lambda () (* 1.0 -0.0)) (lambda args 'error))))
  (test (equal? val1 val2) #t))

(if with-bignums
    (begin
      (num-test (let ((n 40) (s 1)) (do ((i 0 (+ i 1))) ((= i n) s) (set! s (* s 2/3)))) 1099511627776/12157665459056928801)
      (num-test (expt 2 40) 1099511627776)
      (num-test (expt 3 40) 12157665459056928801))
    (if (provided? 'overflow-checks)
	(num-test (let ((n 40) (s 1)) (do ((i 0 (+ i 1))) ((= i n) s) (set! s (* s 2/3)))) 9.043772683816628192400549525035572818665E-8)))
    
(test (* 0 1 "hi") 'error)
(test (* 0.0 "hi") 'error)
(test (* 0.0+0.0i "hi") 'error)
(test (* 0/1 "hi") 'error)
(test (* 1 0.0 #\a) 'error)
(test (* 2 2 2.0 2) 16.0)

(test (nan? (* nan.0 0)) #t)
(test (nan? (* inf.0 0)) #t)
(test (infinite? (* inf.0 inf.0)) #t)

(for-each
 (lambda (arg)
   (test (* arg nan.0) 'error)
   (test (* nan.0 arg) 'error)
   (test (* arg inf.0) 'error)
   (test (* inf.0 arg) 'error)
   (test (* 0 arg nan.0) 'error)
   (test (* 0 nan.0 arg) 'error)
   (test (* 0 arg inf.0) 'error)
   (test (* 0 inf.0 arg) 'error)
   (test (* 0 arg) 'error)
   (test (* 0.0 arg) 'error)
   (test (* 1 arg) 'error)
   (test (* 1.0 arg) 'error)
   (test (* 1/2 arg) 'error)
   (test (* 1+i arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))

(test (let () (define (func) (do ((i 0 (+ i 1))) ((= i 1)) (make-float-vector (* (ash 1 43) (ash 1 43))))) (define (hi) (func)) (hi)) 'error)
(test (let () (define (func) (do ((i 0 (+ i 1))) ((= i 1)) (make-float-vector (* (ash 1 2) (ash 1 43) (ash 1 43))))) (define (hi) (func)) (hi)) 'error)



;;; --------------------------------------------------------------------------------
;;; +
;;; --------------------------------------------------------------------------------

(num-test (+ -0.0) 0.0)
(num-test (+ -0.0+0.00000001i) -0.0+0.00000001i)
(num-test (+ -1.0) -1.0)
(num-test (+ -1.0+1.0i -1.0+1.0i) -2.0+2.0i)
(num-test (+ -1.0+1.0i 0) -1.0+1.0i)
(num-test (+ -1.0+1.0i 0.0) -1.0+1.0i)
(num-test (+ -1.0+1.0i 0.0+1.0i) -1.0+2.0i)
(num-test (+ -1.0+1.0i 1) 0.0+1.0i)
(num-test (+ -1.0+1.0i 1.0) 0.0+1.0i)
(num-test (+ -1.0+1.0i 1.0+1.0i) 0.0+2.0i)
(num-test (+ -1.0+1.0i 1.234+1.234i) 0.234+2.234i)
(num-test (+ -1.0+1.0i 1/1) 0.0+1.0i)
(num-test (+ -1.0+1.0i 123.4) 122.4+1.0i)
(num-test (+ -1.0+1.0i 1234) 1233.0+1.0i)
(num-test (+ -1.0+1.0i 1234/11) 111.18181818181819+1.0i)
(num-test (+ -1.0+1.0i) -1.0+1.0i)
(num-test (+ -10) -10)
(num-test (+ -10/3) -10/3)
(num-test (+ -1234000000) -1234000000)
(num-test (+ -1234000000.0) -1234000000.0)
(num-test (+ -1234000000.0+2.71828182845905i) -1234000000.0+2.71828182845905i)
(num-test (+ -1234000000/10) -1234000000/10)
(num-test (+ -2) -2)
(num-test (+ -2.71828182845905) -2.71828182845905)
(num-test (+ -2.71828182845905+3.14159265358979i) -2.71828182845905+3.14159265358979i)
(num-test (+ -2/2) -2/2)
(num-test (+ -362880) -362880)
(num-test (+ -362880/1234) -362880/1234)
(num-test (+ 0 -1.0+1.0i) -1.0+1.0i)
(num-test (+ 0 0) 0)
(num-test (+ 0 0.0) 0.0)
(num-test (+ 0 0.0+1.0i) 0.0+1.0i)
(num-test (+ 0 1 -1.0+1.0i) 0.0+1.0i)
(num-test (+ 0 1 0) 1)
(num-test (+ 0 1 0.0) 1.0)
(num-test (+ 0 1 0.0+1.0i) 1.0+1.0i)
(num-test (+ 0 1 1) 2)
(num-test (+ 0 1 1.0) 2.0)
(num-test (+ 0 1 1.0+1.0i) 2.0+1.0i)
(num-test (+ 0 1 1.234+1.234i) 2.234+1.234i)
(num-test (+ 0 1 1/1) 2)
(num-test (+ 0 1 123.4) 124.4)
(num-test (+ 0 1 1234) 1235)
(num-test (+ 0 1 1234/11) 1245/11)
(num-test (+ 0 1) 1)
(num-test (+ 0 1.0 -1.0+1.0i) 0.0+1.0i)
(num-test (+ 0 1.0 0) 1.0)
(num-test (+ 0 1.0 0.0) 1.0)
(num-test (+ 0 1.0 0.0+1.0i) 1.0+1.0i)
(num-test (+ 0 1.0 1) 2.0)
(num-test (+ 0 1.0 1.0) 2.0)
(num-test (+ 0 1.0 1.0+1.0i) 2.0+1.0i)
(num-test (+ 0 1.0 1.234+1.234i) 2.234+1.234i)
(num-test (+ 0 1.0 1/1) 2.0)
(num-test (+ 0 1.0 123.4) 124.4)
(num-test (+ 0 1.0 1234) 1235.0)
(num-test (+ 0 1.0 1234/11) 113.18181818181819)
(num-test (+ 0 1.0) 1.0)
(num-test (+ 0 1.0+1.0i -1.0+1.0i) 0.0+2.0i)
(num-test (+ 0 1.0+1.0i 0) 1.0+1.0i)
(num-test (+ 0 1.0+1.0i 0.0) 1.0+1.0i)
(num-test (+ 0 1.0+1.0i 0.0+1.0i) 1.0+2.0i)
(num-test (+ 0 1.0+1.0i 1) 2.0+1.0i)
(num-test (+ 0 1.0+1.0i 1.0) 2.0+1.0i)
(num-test (+ 0 1.0+1.0i 1.0+1.0i) 2.0+2.0i)
(num-test (+ 0 1.0+1.0i 1.234+1.234i) 2.234+2.234i)
(num-test (+ 0 1.0+1.0i 1/1) 2.0+1.0i)
(num-test (+ 0 1.0+1.0i 123.4) 124.4+1.0i)
(num-test (+ 0 1.0+1.0i 1234) 1235.0+1.0i)
(num-test (+ 0 1.0+1.0i 1234/11) 113.18181818181819+1.0i)
(num-test (+ 0 1.0+1.0i) 1.0+1.0i)
(num-test (+ 0 1.234+1.234i) 1.234+1.234i)
(num-test (+ 0 1/1 -1.0+1.0i) 0.0+1.0i)
(num-test (+ 0 123.4) 123.4)
(num-test (+ 0 1234) 1234)
(num-test (+ 0 1234/11) 1234/11)
(num-test (+ 0) 0)
(num-test (+ 0.0 -1.0+1.0i -1.0+1.0i) -2.0+2.0i)
(num-test (+ 0.0 -1.0+1.0i 0) -1.0+1.0i)
(num-test (+ 0.0 -1.0+1.0i 0.0) -1.0+1.0i)
(num-test (+ 0.0 -1.0+1.0i 0.0+1.0i) -1.0+2.0i)
(num-test (+ 0.0 -1.0+1.0i 1) 0.0+1.0i)
(num-test (+ 0.0 -1.0+1.0i 1.0) 0.0+1.0i)
(num-test (+ 0.0 -1.0+1.0i 1.0+1.0i) 0.0+2.0i)
(num-test (+ 0.0 -1.0+1.0i 1.234+1.234i) 0.234+2.234i)
(num-test (+ 0.0 -1.0+1.0i 1/1) 0.0+1.0i)
(num-test (+ 0.0 -1.0+1.0i 123.4) 122.4+1.0i)
(num-test (+ 0.0 -1.0+1.0i 1234) 1233.0+1.0i)
(num-test (+ 0.0 -1.0+1.0i 1234/11) 111.18181818181819+1.0i)
(num-test (+ 0.0 -1.0+1.0i) -1.0+1.0i)
(num-test (+ 0.0 0 -1.0+1.0i) -1.0+1.0i)
(num-test (+ 0.0 0 0) 0.0)
(num-test (+ 0.0 0 0.0) 0.0)
(num-test (+ 0.0 0 0.0+1.0i) 0.0+1.0i)
(num-test (+ 0.0 0 1) 1.0)
(num-test (+ 0.0 0 1.0) 1.0)
(num-test (+ 0.0 0 1.0+1.0i) 1.0+1.0i)
(num-test (+ 0.0 0 1.234+1.234i) 1.234+1.234i)
(num-test (+ 0.0 0 1/1) 1.0)
(num-test (+ 0.0 0 123.4) 123.4)
(num-test (+ 0.0 0 1234) 1234.0)
(num-test (+ 0.0 0 1234/11) 112.18181818181819)
(num-test (+ 0.0 0) 0.0)
(num-test (+ 0.0 0.0 -1.0+1.0i) -1.0+1.0i)
(num-test (+ 0.0 0.0 0) 0.0)
(num-test (+ 0.0 0.0 0.0) 0.0)
(num-test (+ 0.0 0.0 0.0+1.0i) 0.0+1.0i)
(num-test (+ 0.0 0.0 1) 1.0)
(num-test (+ 0.0 0.0 1.0) 1.0)
(num-test (+ 0.0 0.0 1.0+1.0i) 1.0+1.0i)
(num-test (+ 0.0 0.0 1.234+1.234i) 1.234+1.234i)
(num-test (+ 0.0 0.0 1/1) 1.0)
(num-test (+ 0.0 0.0 123.4) 123.4)
(num-test (+ 0.0 0.0 1234) 1234.0)
(num-test (+ 0.0 0.0 1234/11) 112.18181818181819)
(num-test (+ 0.0 0.0) 0.0)
(num-test (+ 0.0 0.0+1.0i -1.0+1.0i) -1.0+2.0i)
(num-test (+ 0.0 0.0+1.0i 0) 0.0+1.0i)
(num-test (+ 0.0 0.0+1.0i 0.0) 0.0+1.0i)
(num-test (+ 0.0 0.0+1.0i 0.0+1.0i) 0.0+2.0i)
(num-test (+ 0.0 0.0+1.0i 1) 1.0+1.0i)
(num-test (+ 0.0 0.0+1.0i 1.0) 1.0+1.0i)
(num-test (+ 0.0 0.0+1.0i 1.0+1.0i) 1.0+2.0i)
(num-test (+ 0.0 0.0+1.0i 1.234+1.234i) 1.234+2.234i)
(num-test (+ 0.0 0.0+1.0i 1/1) 1.0+1.0i)
(num-test (+ 0.0 0.0+1.0i 123.4) 123.4+1.0i)
(num-test (+ 0.0 0.0+1.0i 1234) 1234.0+1.0i)
(num-test (+ 0.0 0.0+1.0i 1234/11) 112.18181818181819+1.0i)
(num-test (+ 0.0 0.0+1.0i) 0.0+1.0i)
(num-test (+ 0.0 1 -1.0+1.0i) 0.0+1.0i)
(num-test (+ 0.0 1 0) 1.0)
(num-test (+ 0.0 1 0.0) 1.0)
(num-test (+ 0.0 1 0.0+1.0i) 1.0+1.0i)
(num-test (+ 0.0 1 1.0) 2.0)
(num-test (+ 0.0 1 1.0+1.0i) 2.0+1.0i)
(num-test (+ 0.0 1 1.234+1.234i) 2.234+1.234i)
(num-test (+ 0.0 1 1/1) 2.0)
(num-test (+ 0.0 1 123.4) 124.4)
(num-test (+ 0.0 1 1234) 1235.0)
(num-test (+ 0.0 1 1234/11) 113.18181818181819)
(num-test (+ 0.0 1) 1.0)
(num-test (+ 0.0 1.0 -1.0+1.0i) 0.0+1.0i)
(num-test (+ 0.0 1.0 0) 1.0)
(num-test (+ 0.0 1.0 0.0) 1.0)
(num-test (+ 0.0 1.0 0.0+1.0i) 1.0+1.0i)
(num-test (+ 0.0 1.0 1) 2.0)
(num-test (+ 0.0 1.0 1.0) 2.0)
(num-test (+ 0.0 1.0 1.0+1.0i) 2.0+1.0i)
(num-test (+ 0.0 1.0 1.234+1.234i) 2.234+1.234i)
(num-test (+ 0.0 1.0 1/1) 2.0)
(num-test (+ 0.0 1.0 123.4) 124.4)
(num-test (+ 0.0 1.0 1234) 1235.0)
(num-test (+ 0.0 1.0 1234/11) 113.18181818181819)
(num-test (+ 0.0 1.0) 1.0)
(num-test (+ 0.0 1.0+1.0i -1.0+1.0i) 0.0+2.0i)
(num-test (+ 0.0 1.0+1.0i 0) 1.0+1.0i)
(num-test (+ 0.0 1.0+1.0i 0.0) 1.0+1.0i)
(num-test (+ 0.0 1.0+1.0i 0.0+1.0i) 1.0+2.0i)
(num-test (+ 0.0 1.0+1.0i 1) 2.0+1.0i)
(num-test (+ 0.0 1.0+1.0i 1.0) 2.0+1.0i)
(num-test (+ 0.0 1.0+1.0i 1.0+1.0i) 2.0+2.0i)
(num-test (+ 0.0 1.0+1.0i 1.234+1.234i) 2.234+2.234i)
(num-test (+ 0.0 1.0+1.0i 1/1) 2.0+1.0i)
(num-test (+ 0.0 1.0+1.0i 123.4) 124.4+1.0i)
(num-test (+ 0.0 1.0+1.0i 1234) 1235.0+1.0i)
(num-test (+ 0.0 1.0+1.0i 1234/11) 113.18181818181819+1.0i)
(num-test (+ 0.0 1.0+1.0i) 1.0+1.0i)
(num-test (+ 0.0 1.234+1.234i -1.0+1.0i) 0.234+2.234i)
(num-test (+ 0.0 1.234+1.234i 0) 1.234+1.234i)
(num-test (+ 0.0 1.234+1.234i 0.0) 1.234+1.234i)
(num-test (+ 0.0 1.234+1.234i 0.0+1.0i) 1.234+2.234i)
(num-test (+ 0.0 1.234+1.234i 1) 2.234+1.234i)
(num-test (+ 0.0 1.234+1.234i 1.0) 2.234+1.234i)
(num-test (+ 0.0 1.234+1.234i 1.0+1.0i) 2.234+2.234i)
(num-test (+ 0.0 1.234+1.234i 1.234+1.234i) 2.468+2.468i)
(num-test (+ 0.0 1.234+1.234i 1/1) 2.234+1.234i)
(num-test (+ 0.0 1.234+1.234i 123.4) 124.634+1.234i)
(num-test (+ 0.0 1.234+1.234i 1234) 1235.23399999999992+1.234i)
(num-test (+ 0.0 1.234+1.234i 1234/11) 113.41581818181818+1.234i)
(num-test (+ 0.0 1.234+1.234i) 1.234+1.234i)
(num-test (+ 0.0 1/1 -1.0+1.0i) 0.0+1.0i)
(num-test (+ 0.0 123.4 -1.0+1.0i) 122.4+1.0i)
(num-test (+ 0.0 123.4 0) 123.4)
(num-test (+ 0.0 123.4 0.0) 123.4)
(num-test (+ 0.0 123.4 0.0+1.0i) 123.4+1.0i)
(num-test (+ 0.0 123.4 1) 124.4)
(num-test (+ 0.0 123.4 1.0) 124.4)
(num-test (+ 0.0 123.4 1.0+1.0i) 124.4+1.0i)
(num-test (+ 0.0 123.4 1.234+1.234i) 124.634+1.234i)
(num-test (+ 0.0 123.4 1/1) 124.4)
(num-test (+ 0.0 123.4 123.4) 246.8)
(num-test (+ 0.0 123.4 1234) 1357.4)
(num-test (+ 0.0 123.4 1234/11) 235.58181818181819)
(num-test (+ 0.0 123.4) 123.4)
(num-test (+ 0.0 1234 -1.0+1.0i) 1233.0+1.0i)
(num-test (+ 0.0 1234 0) 1234.0)
(num-test (+ 0.0 1234 0.0) 1234.0)
(num-test (+ 0.0 1234 0.0+1.0i) 1234.0+1.0i)
(num-test (+ 0.0 1234 1) 1235.0)
(num-test (+ 0.0 1234 1.0) 1235.0)
(num-test (+ 0.0 1234 1.0+1.0i) 1235.0+1.0i)
(num-test (+ 0.0 1234 1.234+1.234i) 1235.23399999999992+1.234i)
(num-test (+ 0.0 1234 1/1) 1235.0)
(num-test (+ 0.0 1234 123.4) 1357.4)
(num-test (+ 0.0 1234 1234) 2468.0)
(num-test (+ 0.0 1234 1234/11) 1346.18181818181824)
(num-test (+ 0.0 1234) 1234.0)
(num-test (+ 0.0 1234/11 -1.0+1.0i) 111.18181818181819+1.0i)
(num-test (+ 0.0 1234/11 0) 112.18181818181819)
(num-test (+ 0.0 1234/11 0.0) 112.18181818181819)
(num-test (+ 0.0 1234/11 0.0+1.0i) 112.18181818181819+1.0i)
(num-test (+ 0.0 1234/11 1) 113.18181818181819)
(num-test (+ 0.0 1234/11 1.0) 113.18181818181819)
(num-test (+ 0.0 1234/11 1.0+1.0i) 113.18181818181819+1.0i)
(num-test (+ 0.0 1234/11 1.234+1.234i) 113.41581818181818+1.234i)
(num-test (+ 0.0 1234/11 1/1) 113.18181818181819)
(num-test (+ 0.0 1234/11 123.4) 235.58181818181819)
(num-test (+ 0.0 1234/11 1234) 1346.18181818181824)
(num-test (+ 0.0 1234/11 1234/11) 224.36363636363637)
(num-test (+ 0.0 1234/11) 112.18181818181819)
(num-test (+ 0.0) 0.0)
(num-test (+ 0.0+0.00000001i) 0.0+0.00000001i)
(num-test (+ 0.0+1.0i -1.0+1.0i) -1.0+2.0i)
(num-test (+ 0.0+1.0i 0) 0.0+1.0i)
(num-test (+ 0.0+1.0i 0.0) 0.0+1.0i)
(num-test (+ 0.0+1.0i 0.0+1.0i) 0.0+2.0i)
(num-test (+ 0.0+1.0i 1) 1.0+1.0i)
(num-test (+ 0.0+1.0i 1.0) 1.0+1.0i)
(num-test (+ 0.0+1.0i 1.0+1.0i) 1.0+2.0i)
(num-test (+ 0.0+1.0i 1.234+1.234i) 1.234+2.234i)
(num-test (+ 0.0+1.0i 1/1) 1.0+1.0i)
(num-test (+ 0.0+1.0i 123.4) 123.4+1.0i)
(num-test (+ 0.0+1.0i 1234) 1234.0+1.0i)
(num-test (+ 0.0+1.0i 1234/11) 112.18181818181819+1.0i)
(num-test (+ 0/1) 0/1)
(num-test (+ 0/1) 0/1)
(num-test (+ 1 -1.0+1.0i) 0.0+1.0i)
(num-test (+ 1 0) 1)
(num-test (+ 1 0.0) 1.0)
(num-test (+ 1 0.0+1.0i) 1.0+1.0i)
(num-test (+ 1 1 -1.0+1.0i) 1.0+1.0i)
(num-test (+ 1 1 0) 2)
(num-test (+ 1 1 0.0) 2.0)
(num-test (+ 1 1 0.0+1.0i) 2.0+1.0i)
(num-test (+ 1 1 1) 3)
(num-test (+ 1 1 1.0) 3.0)
(num-test (+ 1 1 1.0+1.0i) 3.0+1.0i)
(num-test (+ 1 1 1.234+1.234i) 3.234+1.234i)
(num-test (+ 1 1 1/1) 3)
(num-test (+ 1 1 123.4) 125.4)
(num-test (+ 1 1 1234) 1236)
(num-test (+ 1 1 1234/11) 1256/11)
(num-test (+ 1 1) 2)
(num-test (+ 1 1.0 -1.0+1.0i) 1.0+1.0i)
(num-test (+ 1 1.0 0) 2.0)
(num-test (+ 1 1.0 0.0) 2.0)
(num-test (+ 1 1.0 0.0+1.0i) 2.0+1.0i)
(num-test (+ 1 1.0 1) 3.0)
(num-test (+ 1 1.0 1.0) 3.0)
(num-test (+ 1 1.0 1.0+1.0i) 3.0+1.0i)
(num-test (+ 1 1.0 1.234+1.234i) 3.234+1.234i)
(num-test (+ 1 1.0 1/1) 3.0)
(num-test (+ 1 1.0 123.4) 125.4)
(num-test (+ 1 1.0 1234) 1236.0)
(num-test (+ 1 1.0 1234/11) 114.18181818181819)
(num-test (+ 1 1.0) 2.0)
(num-test (+ 1 1.0+1.0i -1.0+1.0i) 1.0+2.0i)
(num-test (+ 1 1.0+1.0i 0) 2.0+1.0i)
(num-test (+ 1 1.0+1.0i 0.0) 2.0+1.0i)
(num-test (+ 1 1.0+1.0i 0.0+1.0i) 2.0+2.0i)
(num-test (+ 1 1.0+1.0i 1) 3.0+1.0i)
(num-test (+ 1 1.0+1.0i 1.0) 3.0+1.0i)
(num-test (+ 1 1.0+1.0i 1.0+1.0i) 3.0+2.0i)
(num-test (+ 1 1.0+1.0i 1.234+1.234i) 3.234+2.234i)
(num-test (+ 1 1.0+1.0i 1/1) 3.0+1.0i)
(num-test (+ 1 1.0+1.0i 123.4) 125.4+1.0i)
(num-test (+ 1 1.0+1.0i 1234) 1236.0+1.0i)
(num-test (+ 1 1.0+1.0i 1234/11) 114.18181818181819+1.0i)
(num-test (+ 1 1.0+1.0i) 2.0+1.0i)
(num-test (+ 1 1.234+1.234i) 2.234+1.234i)
(num-test (+ 1 123.4) 124.4)
(num-test (+ 1 1234) 1235)
(num-test (+ 1 1234/11) 1245/11)
(num-test (+ 1.0 -1.0+1.0i -1.0+1.0i) -1.0+2.0i)
(num-test (+ 1.0 -1.0+1.0i 0) 0.0+1.0i)
(num-test (+ 1.0 -1.0+1.0i 0.0) 0.0+1.0i)
(num-test (+ 1.0 -1.0+1.0i 0.0+1.0i) 0.0+2.0i)
(num-test (+ 1.0 -1.0+1.0i 1) 1.0+1.0i)
(num-test (+ 1.0 -1.0+1.0i 1.0) 1.0+1.0i)
(num-test (+ 1.0 -1.0+1.0i 1.0+1.0i) 1.0+2.0i)
(num-test (+ 1.0 -1.0+1.0i 1.234+1.234i) 1.234+2.234i)
(num-test (+ 1.0 -1.0+1.0i 1/1) 1.0+1.0i)
(num-test (+ 1.0 -1.0+1.0i 123.4) 123.4+1.0i)
(num-test (+ 1.0 -1.0+1.0i 1234) 1234.0+1.0i)
(num-test (+ 1.0 -1.0+1.0i 1234/11) 112.18181818181819+1.0i)
(num-test (+ 1.0 -1.0+1.0i) 0.0+1.0i)
(num-test (+ 1.0 0 -1.0+1.0i) 0.0+1.0i)
(num-test (+ 1.0 0 0) 1.0)
(num-test (+ 1.0 0 0.0) 1.0)
(num-test (+ 1.0 0 0.0+1.0i) 1.0+1.0i)
(num-test (+ 1.0 0 1) 2.0)
(num-test (+ 1.0 0 1.0) 2.0)
(num-test (+ 1.0 0 1.0+1.0i) 2.0+1.0i)
(num-test (+ 1.0 0 1.234+1.234i) 2.234+1.234i)
(num-test (+ 1.0 0 1/1) 2.0)
(num-test (+ 1.0 0 123.4) 124.4)
(num-test (+ 1.0 0 1234) 1235.0)
(num-test (+ 1.0 0 1234/11) 113.18181818181819)
(num-test (+ 1.0 0) 1.0)
(num-test (+ 1.0 0.0 -1.0+1.0i) 0.0+1.0i)
(num-test (+ 1.0 0.0 0) 1.0)
(num-test (+ 1.0 0.0 0.0) 1.0)
(num-test (+ 1.0 0.0 0.0+1.0i) 1.0+1.0i)
(num-test (+ 1.0 0.0 1) 2.0)
(num-test (+ 1.0 0.0 1.0) 2.0)
(num-test (+ 1.0 0.0 1.0+1.0i) 2.0+1.0i)
(num-test (+ 1.0 0.0 1.234+1.234i) 2.234+1.234i)
(num-test (+ 1.0 0.0 1/1) 2.0)
(num-test (+ 1.0 0.0 123.4) 124.4)
(num-test (+ 1.0 0.0 1234) 1235.0)
(num-test (+ 1.0 0.0 1234/11) 113.18181818181819)
(num-test (+ 1.0 0.0) 1.0)
(num-test (+ 1.0 0.0+1.0i -1.0+1.0i) 0.0+2.0i)
(num-test (+ 1.0 0.0+1.0i 0) 1.0+1.0i)
(num-test (+ 1.0 0.0+1.0i 0.0) 1.0+1.0i)
(num-test (+ 1.0 0.0+1.0i 0.0+1.0i) 1.0+2.0i)
(num-test (+ 1.0 0.0+1.0i 1) 2.0+1.0i)
(num-test (+ 1.0 0.0+1.0i 1.0) 2.0+1.0i)
(num-test (+ 1.0 0.0+1.0i 1.0+1.0i) 2.0+2.0i)
(num-test (+ 1.0 0.0+1.0i 1.234+1.234i) 2.234+2.234i)
(num-test (+ 1.0 0.0+1.0i 1/1) 2.0+1.0i)
(num-test (+ 1.0 0.0+1.0i 123.4) 124.4+1.0i)
(num-test (+ 1.0 0.0+1.0i 1234) 1235.0+1.0i)
(num-test (+ 1.0 0.0+1.0i 1234/11) 113.18181818181819+1.0i)
(num-test (+ 1.0 0.0+1.0i) 1.0+1.0i)
(num-test (+ 1.0 1 -1.0+1.0i) 1.0+1.0i)
(num-test (+ 1.0 1 0) 2.0)
(num-test (+ 1.0 1 0.0) 2.0)
(num-test (+ 1.0 1 0.0+1.0i) 2.0+1.0i)
(num-test (+ 1.0 1 1) 3.0)
(num-test (+ 1.0 1 1.0) 3.0)
(num-test (+ 1.0 1 1.0+1.0i) 3.0+1.0i)
(num-test (+ 1.0 1 1.234+1.234i) 3.234+1.234i)
(num-test (+ 1.0 1 1/1) 3.0)
(num-test (+ 1.0 1 123.4) 125.4)
(num-test (+ 1.0 1 1234) 1236.0)
(num-test (+ 1.0 1 1234/11) 114.18181818181819)
(num-test (+ 1.0 1) 2.0)
(num-test (+ 1.0 1.0 -1.0+1.0i) 1.0+1.0i)
(num-test (+ 1.0 1.0 0) 2.0)
(num-test (+ 1.0 1.0 0.0) 2.0)
(num-test (+ 1.0 1.0 0.0+1.0i) 2.0+1.0i)
(num-test (+ 1.0 1.0 1) 3.0)
(num-test (+ 1.0 1.0 1.0) 3.0)
(num-test (+ 1.0 1.0 1.0+1.0i) 3.0+1.0i)
(num-test (+ 1.0 1.0 1.234+1.234i) 3.234+1.234i)
(num-test (+ 1.0 1.0 1/1) 3.0)
(num-test (+ 1.0 1.0 123.4) 125.4)
(num-test (+ 1.0 1.0 1234) 1236.0)
(num-test (+ 1.0 1.0 1234/11) 114.18181818181819)
(num-test (+ 1.0 1.0) 2.0)
(num-test (+ 1.0 1.0+1.0i -1.0+1.0i) 1.0+2.0i)
(num-test (+ 1.0 1.0+1.0i 0) 2.0+1.0i)
(num-test (+ 1.0 1.0+1.0i 0.0) 2.0+1.0i)
(num-test (+ 1.0 1.0+1.0i 0.0+1.0i) 2.0+2.0i)
(num-test (+ 1.0 1.0+1.0i 1) 3.0+1.0i)
(num-test (+ 1.0 1.0+1.0i 1.0) 3.0+1.0i)
(num-test (+ 1.0 1.0+1.0i 1.0+1.0i) 3.0+2.0i)
(num-test (+ 1.0 1.0+1.0i 1.234+1.234i) 3.234+2.234i)
(num-test (+ 1.0 1.0+1.0i 1/1) 3.0+1.0i)
(num-test (+ 1.0 1.0+1.0i 123.4) 125.4+1.0i)
(num-test (+ 1.0 1.0+1.0i 1234) 1236.0+1.0i)
(num-test (+ 1.0 1.0+1.0i 1234/11) 114.18181818181819+1.0i)
(num-test (+ 1.0 1.0+1.0i) 2.0+1.0i)
(num-test (+ 1.0 1.234+1.234i -1.0+1.0i) 1.234+2.234i)
(num-test (+ 1.0 1.234+1.234i 0) 2.234+1.234i)
(num-test (+ 1.0 1.234+1.234i 0.0) 2.234+1.234i)
(num-test (+ 1.0 1.234+1.234i 0.0+1.0i) 2.234+2.234i)
(num-test (+ 1.0 1.234+1.234i 1) 3.234+1.234i)
(num-test (+ 1.0 1.234+1.234i 1.0) 3.234+1.234i)
(num-test (+ 1.0 1.234+1.234i 1.0+1.0i) 3.234+2.234i)
(num-test (+ 1.0 1.234+1.234i 1.234+1.234i) 3.468+2.468i)
(num-test (+ 1.0 1.234+1.234i 1/1) 3.234+1.234i)
(num-test (+ 1.0 1.234+1.234i 123.4) 125.634+1.234i)
(num-test (+ 1.0 1.234+1.234i 1234) 1236.23399999999992+1.234i)
(num-test (+ 1.0 1.234+1.234i 1234/11) 114.41581818181818+1.234i)
(num-test (+ 1.0 1.234+1.234i) 2.234+1.234i)
(num-test (+ 1.0 1/1 -1.0+1.0i) 1.0+1.0i)
(num-test (+ 1.0 123.4 -1.0+1.0i) 123.4+1.0i)
(num-test (+ 1.0 123.4 0) 124.4)
(num-test (+ 1.0 123.4 0.0) 124.4)
(num-test (+ 1.0 123.4 0.0+1.0i) 124.4+1.0i)
(num-test (+ 1.0 123.4 1) 125.4)
(num-test (+ 1.0 123.4 1.0) 125.4)
(num-test (+ 1.0 123.4 1.0+1.0i) 125.4+1.0i)
(num-test (+ 1.0 123.4 1.234+1.234i) 125.634+1.234i)
(num-test (+ 1.0 123.4 1/1) 125.4)
(num-test (+ 1.0 123.4 123.4) 247.8)
(num-test (+ 1.0 123.4 1234) 1358.4)
(num-test (+ 1.0 123.4 1234/11) 236.58181818181819)
(num-test (+ 1.0 123.4) 124.4)
(num-test (+ 1.0 1234 -1.0+1.0i) 1234.0+1.0i)
(num-test (+ 1.0 1234 0) 1235.0)
(num-test (+ 1.0 1234 0.0) 1235.0)
(num-test (+ 1.0 1234 0.0+1.0i) 1235.0+1.0i)
(num-test (+ 1.0 1234 1) 1236.0)
(num-test (+ 1.0 1234 1.0) 1236.0)
(num-test (+ 1.0 1234 1.0+1.0i) 1236.0+1.0i)
(num-test (+ 1.0 1234 1.234+1.234i) 1236.23399999999992+1.234i)
(num-test (+ 1.0 1234 1/1) 1236.0)
(num-test (+ 1.0 1234 123.4) 1358.4)
(num-test (+ 1.0 1234 1234) 2469.0)
(num-test (+ 1.0 1234 1234/11) 1347.18181818181824)
(num-test (+ 1.0 1234) 1235.0)
(num-test (+ 1.0 1234/11 -1.0+1.0i) 112.18181818181819+1.0i)
(num-test (+ 1.0 1234/11 0) 113.18181818181819)
(num-test (+ 1.0 1234/11 0.0) 113.18181818181819)
(num-test (+ 1.0 1234/11 0.0+1.0i) 113.18181818181819+1.0i)
(num-test (+ 1.0 1234/11 1) 114.18181818181819)
(num-test (+ 1.0 1234/11 1.0) 114.18181818181819)
(num-test (+ 1.0 1234/11 1.0+1.0i) 114.18181818181819+1.0i)
(num-test (+ 1.0 1234/11 1.234+1.234i) 114.41581818181818+1.234i)
(num-test (+ 1.0 1234/11 1/1) 114.18181818181819)
(num-test (+ 1.0 1234/11 123.4) 236.58181818181819)
(num-test (+ 1.0 1234/11 1234) 1347.18181818181824)
(num-test (+ 1.0 1234/11 1234/11) 225.36363636363637)
(num-test (+ 1.0 1234/11) 113.18181818181819)
(num-test (+ 1.0) 1.0)
(num-test (+ 1.0+1.0i -1.0+1.0i -1.0+1.0i) -1.0+3.0i)
(num-test (+ 1.0+1.0i -1.0+1.0i 0) 0.0+2.0i)
(num-test (+ 1.0+1.0i -1.0+1.0i 0.0) 0.0+2.0i)
(num-test (+ 1.0+1.0i -1.0+1.0i 0.0+1.0i) 0.0+3.0i)
(num-test (+ 1.0+1.0i -1.0+1.0i 1) 1.0+2.0i)
(num-test (+ 1.0+1.0i -1.0+1.0i 1.0) 1.0+2.0i)
(num-test (+ 1.0+1.0i -1.0+1.0i 1.0+1.0i) 1.0+3.0i)
(num-test (+ 1.0+1.0i -1.0+1.0i 1.234+1.234i) 1.234+3.234i)
(num-test (+ 1.0+1.0i -1.0+1.0i 1/1) 1.0+2.0i)
(num-test (+ 1.0+1.0i -1.0+1.0i 123.4) 123.4+2.0i)
(num-test (+ 1.0+1.0i -1.0+1.0i 1234) 1234.0+2.0i)
(num-test (+ 1.0+1.0i -1.0+1.0i 1234/11) 112.18181818181819+2.0i)
(num-test (+ 1.0+1.0i -1.0+1.0i) 0.0+2.0i)
(num-test (+ 1.0+1.0i 0 -1.0+1.0i) 0.0+2.0i)
(num-test (+ 1.0+1.0i 0 0) 1.0+1.0i)
(num-test (+ 1.0+1.0i 0 0.0) 1.0+1.0i)
(num-test (+ 1.0+1.0i 0 0.0+1.0i) 1.0+2.0i)
(num-test (+ 1.0+1.0i 0 1) 2.0+1.0i)
(num-test (+ 1.0+1.0i 0 1.0) 2.0+1.0i)
(num-test (+ 1.0+1.0i 0 1.0+1.0i) 2.0+2.0i)
(num-test (+ 1.0+1.0i 0 1.234+1.234i) 2.234+2.234i)
(num-test (+ 1.0+1.0i 0 1/1) 2.0+1.0i)
(num-test (+ 1.0+1.0i 0 123.4) 124.4+1.0i)
(num-test (+ 1.0+1.0i 0 1234) 1235.0+1.0i)
(num-test (+ 1.0+1.0i 0 1234/11) 113.18181818181819+1.0i)
(num-test (+ 1.0+1.0i 0) 1.0+1.0i)
(num-test (+ 1.0+1.0i 0.0 -1.0+1.0i) 0.0+2.0i)
(num-test (+ 1.0+1.0i 0.0 0) 1.0+1.0i)
(num-test (+ 1.0+1.0i 0.0 0.0) 1.0+1.0i)
(num-test (+ 1.0+1.0i 0.0 0.0+1.0i) 1.0+2.0i)
(num-test (+ 1.0+1.0i 0.0 1) 2.0+1.0i)
(num-test (+ 1.0+1.0i 0.0 1.0) 2.0+1.0i)
(num-test (+ 1.0+1.0i 0.0 1.0+1.0i) 2.0+2.0i)
(num-test (+ 1.0+1.0i 0.0 1.234+1.234i) 2.234+2.234i)
(num-test (+ 1.0+1.0i 0.0 1/1) 2.0+1.0i)
(num-test (+ 1.0+1.0i 0.0 123.4) 124.4+1.0i)
(num-test (+ 1.0+1.0i 0.0 1234) 1235.0+1.0i)
(num-test (+ 1.0+1.0i 0.0 1234/11) 113.18181818181819+1.0i)
(num-test (+ 1.0+1.0i 0.0) 1.0+1.0i)
(num-test (+ 1.0+1.0i 0.0+1.0i -1.0+1.0i) 0.0+3.0i)
(num-test (+ 1.0+1.0i 0.0+1.0i 0) 1.0+2.0i)
(num-test (+ 1.0+1.0i 0.0+1.0i 0.0) 1.0+2.0i)
(num-test (+ 1.0+1.0i 0.0+1.0i 0.0+1.0i) 1.0+3.0i)
(num-test (+ 1.0+1.0i 0.0+1.0i 1) 2.0+2.0i)
(num-test (+ 1.0+1.0i 0.0+1.0i 1.0) 2.0+2.0i)
(num-test (+ 1.0+1.0i 0.0+1.0i 1.0+1.0i) 2.0+3.0i)
(num-test (+ 1.0+1.0i 0.0+1.0i 1.234+1.234i) 2.234+3.234i)
(num-test (+ 1.0+1.0i 0.0+1.0i 1/1) 2.0+2.0i)
(num-test (+ 1.0+1.0i 0.0+1.0i 123.4) 124.4+2.0i)
(num-test (+ 1.0+1.0i 0.0+1.0i 1234) 1235.0+2.0i)
(num-test (+ 1.0+1.0i 0.0+1.0i 1234/11) 113.18181818181819+2.0i)
(num-test (+ 1.0+1.0i 0.0+1.0i) 1.0+2.0i)
(num-test (+ 1.0+1.0i 1 -1.0+1.0i) 1.0+2.0i)
(num-test (+ 1.0+1.0i 1 0) 2.0+1.0i)
(num-test (+ 1.0+1.0i 1 0.0) 2.0+1.0i)
(num-test (+ 1.0+1.0i 1 0.0+1.0i) 2.0+2.0i)
(num-test (+ 1.0+1.0i 1 1) 3.0+1.0i)
(num-test (+ 1.0+1.0i 1 1.0) 3.0+1.0i)
(num-test (+ 1.0+1.0i 1 1.0+1.0i) 3.0+2.0i)
(num-test (+ 1.0+1.0i 1 1.234+1.234i) 3.234+2.234i)
(num-test (+ 1.0+1.0i 1 1/1) 3.0+1.0i)
(num-test (+ 1.0+1.0i 1 123.4) 125.4+1.0i)
(num-test (+ 1.0+1.0i 1 1234) 1236.0+1.0i)
(num-test (+ 1.0+1.0i 1 1234/11) 114.18181818181819+1.0i)
(num-test (+ 1.0+1.0i 1) 2.0+1.0i)
(num-test (+ 1.0+1.0i 1.0 -1.0+1.0i) 1.0+2.0i)
(num-test (+ 1.0+1.0i 1.0 0) 2.0+1.0i)
(num-test (+ 1.0+1.0i 1.0 0.0) 2.0+1.0i)
(num-test (+ 1.0+1.0i 1.0 0.0+1.0i) 2.0+2.0i)
(num-test (+ 1.0+1.0i 1.0 1) 3.0+1.0i)
(num-test (+ 1.0+1.0i 1.0 1.0) 3.0+1.0i)
(num-test (+ 1.0+1.0i 1.0 1.0+1.0i) 3.0+2.0i)
(num-test (+ 1.0+1.0i 1.0 1.234+1.234i) 3.234+2.234i)
(num-test (+ 1.0+1.0i 1.0 1/1) 3.0+1.0i)
(num-test (+ 1.0+1.0i 1.0 123.4) 125.4+1.0i)
(num-test (+ 1.0+1.0i 1.0 1234) 1236.0+1.0i)
(num-test (+ 1.0+1.0i 1.0 1234/11) 114.18181818181819+1.0i)
(num-test (+ 1.0+1.0i 1.0) 2.0+1.0i)
(num-test (+ 1.0+1.0i 1.0+1.0i -1.0+1.0i) 1.0+3.0i)
(num-test (+ 1.0+1.0i 1.0+1.0i 0) 2.0+2.0i)
(num-test (+ 1.0+1.0i 1.0+1.0i 0.0) 2.0+2.0i)
(num-test (+ 1.0+1.0i 1.0+1.0i 0.0+1.0i) 2.0+3.0i)
(num-test (+ 1.0+1.0i 1.0+1.0i 1) 3.0+2.0i)
(num-test (+ 1.0+1.0i 1.0+1.0i 1.0) 3.0+2.0i)
(num-test (+ 1.0+1.0i 1.0+1.0i 1.0+1.0i) 3.0+3.0i)
(num-test (+ 1.0+1.0i 1.0+1.0i 1.234+1.234i) 3.234+3.234i)
(num-test (+ 1.0+1.0i 1.0+1.0i 1/1) 3.0+2.0i)
(num-test (+ 1.0+1.0i 1.0+1.0i 123.4) 125.4+2.0i)
(num-test (+ 1.0+1.0i 1.0+1.0i 1234) 1236.0+2.0i)
(num-test (+ 1.0+1.0i 1.0+1.0i 1234/11) 114.18181818181819+2.0i)
(num-test (+ 1.0+1.0i 1.0+1.0i) 2.0+2.0i)
(num-test (+ 1.0+1.0i 1.234+1.234i -1.0+1.0i) 1.234+3.234i)
(num-test (+ 1.0+1.0i 1.234+1.234i 0) 2.234+2.234i)
(num-test (+ 1.0+1.0i 1.234+1.234i 0.0) 2.234+2.234i)
(num-test (+ 1.0+1.0i 1.234+1.234i 0.0+1.0i) 2.234+3.234i)
(num-test (+ 1.0+1.0i 1.234+1.234i 1) 3.234+2.234i)
(num-test (+ 1.0+1.0i 1.234+1.234i 1.0) 3.234+2.234i)
(num-test (+ 1.0+1.0i 1.234+1.234i 1.0+1.0i) 3.234+3.234i)
(num-test (+ 1.0+1.0i 1.234+1.234i 1.234+1.234i) 3.468+3.468i)
(num-test (+ 1.0+1.0i 1.234+1.234i 1/1) 3.234+2.234i)
(num-test (+ 1.0+1.0i 1.234+1.234i 123.4) 125.634+2.234i)
(num-test (+ 1.0+1.0i 1.234+1.234i 1234) 1236.23399999999992+2.234i)
(num-test (+ 1.0+1.0i 1.234+1.234i 1234/11) 114.41581818181818+2.234i)
(num-test (+ 1.0+1.0i 1.234+1.234i) 2.234+2.234i)
(num-test (+ 1.0+1.0i 123.4 -1.0+1.0i) 123.4+2.0i)
(num-test (+ 1.0+1.0i 123.4 0) 124.4+1.0i)
(num-test (+ 1.0+1.0i 123.4 0.0) 124.4+1.0i)
(num-test (+ 1.0+1.0i 123.4 0.0+1.0i) 124.4+2.0i)
(num-test (+ 1.0+1.0i 123.4 1) 125.4+1.0i)
(num-test (+ 1.0+1.0i 123.4 1.0) 125.4+1.0i)
(num-test (+ 1.0+1.0i 123.4 1.0+1.0i) 125.4+2.0i)
(num-test (+ 1.0+1.0i 123.4 1.234+1.234i) 125.634+2.234i)
(num-test (+ 1.0+1.0i 123.4 1/1) 125.4+1.0i)
(num-test (+ 1.0+1.0i 123.4 123.4) 247.8+1.0i)
(num-test (+ 1.0+1.0i 123.4 1234) 1358.4+1.0i)
(num-test (+ 1.0+1.0i 123.4 1234/11) 236.58181818181819+1.0i)
(num-test (+ 1.0+1.0i 123.4) 124.4+1.0i)
(num-test (+ 1.0+1.0i 1234 -1.0+1.0i) 1234.0+2.0i)
(num-test (+ 1.0+1.0i 1234 0) 1235.0+1.0i)
(num-test (+ 1.0+1.0i 1234 0.0) 1235.0+1.0i)
(num-test (+ 1.0+1.0i 1234 0.0+1.0i) 1235.0+2.0i)
(num-test (+ 1.0+1.0i 1234 1) 1236.0+1.0i)
(num-test (+ 1.0+1.0i 1234 1.0) 1236.0+1.0i)
(num-test (+ 1.0+1.0i 1234 1.0+1.0i) 1236.0+2.0i)
(num-test (+ 1.0+1.0i 1234 1.234+1.234i) 1236.23399999999992+2.234i)
(num-test (+ 1.0+1.0i 1234 1/1) 1236.0+1.0i)
(num-test (+ 1.0+1.0i 1234 123.4) 1358.4+1.0i)
(num-test (+ 1.0+1.0i 1234 1234) 2469.0+1.0i)
(num-test (+ 1.0+1.0i 1234 1234/11) 1347.18181818181824+1.0i)
(num-test (+ 1.0+1.0i 1234) 1235.0+1.0i)
(num-test (+ 1.0+1.0i 1234/11 -1.0+1.0i) 112.18181818181819+2.0i)
(num-test (+ 1.0+1.0i 1234/11 0) 113.18181818181819+1.0i)
(num-test (+ 1.0+1.0i 1234/11 0.0) 113.18181818181819+1.0i)
(num-test (+ 1.0+1.0i 1234/11 0.0+1.0i) 113.18181818181819+2.0i)
(num-test (+ 1.0+1.0i 1234/11 1) 114.18181818181819+1.0i)
(num-test (+ 1.0+1.0i 1234/11 1.0) 114.18181818181819+1.0i)
(num-test (+ 1.0+1.0i 1234/11 1.0+1.0i) 114.18181818181819+2.0i)
(num-test (+ 1.0+1.0i 1234/11 1.234+1.234i) 114.41581818181818+2.234i)
(num-test (+ 1.0+1.0i 1234/11 1/1) 114.18181818181819+1.0i)
(num-test (+ 1.0+1.0i 1234/11 123.4) 236.58181818181819+1.0i)
(num-test (+ 1.0+1.0i 1234/11 1234) 1347.18181818181824+1.0i)
(num-test (+ 1.0+1.0i 1234/11 1234/11) 225.36363636363637+1.0i)
(num-test (+ 1.0+1.0i 1234/11) 113.18181818181819+1.0i)
(num-test (+ 1.0+1.0i) 1.0+1.0i)
(num-test (+ 1.234+1.234i -1.0+1.0i) 0.234+2.234i)
(num-test (+ 1.234+1.234i 0) 1.234+1.234i)
(num-test (+ 1.234+1.234i 0.0) 1.234+1.234i)
(num-test (+ 1.234+1.234i 0.0+1.0i) 1.234+2.234i)
(num-test (+ 1.234+1.234i 1) 2.234+1.234i)
(num-test (+ 1.234+1.234i 1.0) 2.234+1.234i)
(num-test (+ 1.234+1.234i 1.0+1.0i) 2.234+2.234i)
(num-test (+ 1.234+1.234i 1.234+1.234i) 2.468+2.468i)
(num-test (+ 1.234+1.234i 1/1) 2.234+1.234i)
(num-test (+ 1.234+1.234i 123.4) 124.634+1.234i)
(num-test (+ 1.234+1.234i 1234) 1235.23399999999992+1.234i)
(num-test (+ 1.234+1.234i 1234/11) 113.41581818181818+1.234i)
(num-test (+ 10) 10)
(num-test (+ 10/3) 10/3)
(num-test (+ 123.4 -1.0+1.0i -1.0+1.0i) 121.4+2.0i)
(num-test (+ 123.4 -1.0+1.0i 0) 122.4+1.0i)
(num-test (+ 123.4 -1.0+1.0i 0.0) 122.4+1.0i)
(num-test (+ 123.4 -1.0+1.0i 0.0+1.0i) 122.4+2.0i)
(num-test (+ 123.4 -1.0+1.0i 1) 123.4+1.0i)
(num-test (+ 123.4 -1.0+1.0i 1.0) 123.4+1.0i)
(num-test (+ 123.4 -1.0+1.0i 1.0+1.0i) 123.4+2.0i)
(num-test (+ 123.4 -1.0+1.0i 1.234+1.234i) 123.634+2.234i)
(num-test (+ 123.4 -1.0+1.0i 1/1) 123.4+1.0i)
(num-test (+ 123.4 -1.0+1.0i 123.4) 245.8+1.0i)
(num-test (+ 123.4 -1.0+1.0i 1234) 1356.4+1.0i)
(num-test (+ 123.4 -1.0+1.0i 1234/11) 234.58181818181819+1.0i)
(num-test (+ 123.4 -1.0+1.0i) 122.4+1.0i)
(num-test (+ 123.4 0 -1.0+1.0i) 122.4+1.0i)
(num-test (+ 123.4 0 0) 123.4)
(num-test (+ 123.4 0 0.0) 123.4)
(num-test (+ 123.4 0 0.0+1.0i) 123.4+1.0i)
(num-test (+ 123.4 0 1) 124.4)
(num-test (+ 123.4 0 1.0) 124.4)
(num-test (+ 123.4 0 1.0+1.0i) 124.4+1.0i)
(num-test (+ 123.4 0 1.234+1.234i) 124.634+1.234i)
(num-test (+ 123.4 0 1/1) 124.4)
(num-test (+ 123.4 0 123.4) 246.8)
(num-test (+ 123.4 0 1234) 1357.4)
(num-test (+ 123.4 0 1234/11) 235.58181818181819)
(num-test (+ 123.4 0) 123.4)
(num-test (+ 123.4 0.0 -1.0+1.0i) 122.4+1.0i)
(num-test (+ 123.4 0.0 0) 123.4)
(num-test (+ 123.4 0.0 0.0) 123.4)
(num-test (+ 123.4 0.0 0.0+1.0i) 123.4+1.0i)
(num-test (+ 123.4 0.0 1) 124.4)
(num-test (+ 123.4 0.0 1.0) 124.4)
(num-test (+ 123.4 0.0 1.0+1.0i) 124.4+1.0i)
(num-test (+ 123.4 0.0 1.234+1.234i) 124.634+1.234i)
(num-test (+ 123.4 0.0 1/1) 124.4)
(num-test (+ 123.4 0.0 123.4) 246.8)
(num-test (+ 123.4 0.0 1234) 1357.4)
(num-test (+ 123.4 0.0 1234/11) 235.58181818181819)
(num-test (+ 123.4 0.0) 123.4)
(num-test (+ 123.4 0.0+1.0i -1.0+1.0i) 122.4+2.0i)
(num-test (+ 123.4 0.0+1.0i 0) 123.4+1.0i)
(num-test (+ 123.4 0.0+1.0i 0.0) 123.4+1.0i)
(num-test (+ 123.4 0.0+1.0i 0.0+1.0i) 123.4+2.0i)
(num-test (+ 123.4 0.0+1.0i 1) 124.4+1.0i)
(num-test (+ 123.4 0.0+1.0i 1.0) 124.4+1.0i)
(num-test (+ 123.4 0.0+1.0i 1.0+1.0i) 124.4+2.0i)
(num-test (+ 123.4 0.0+1.0i 1.234+1.234i) 124.634+2.234i)
(num-test (+ 123.4 0.0+1.0i 1/1) 124.4+1.0i)
(num-test (+ 123.4 0.0+1.0i 123.4) 246.8+1.0i)
(num-test (+ 123.4 0.0+1.0i 1234) 1357.4+1.0i)
(num-test (+ 123.4 0.0+1.0i 1234/11) 235.58181818181819+1.0i)
(num-test (+ 123.4 0.0+1.0i) 123.4+1.0i)
(num-test (+ 123.4 1 -1.0+1.0i) 123.4+1.0i)
(num-test (+ 123.4 1 0) 124.4)
(num-test (+ 123.4 1 0.0) 124.4)
(num-test (+ 123.4 1 0.0+1.0i) 124.4+1.0i)
(num-test (+ 123.4 1 1) 125.4)
(num-test (+ 123.4 1 1.0) 125.4)
(num-test (+ 123.4 1 1.0+1.0i) 125.4+1.0i)
(num-test (+ 123.4 1 1.234+1.234i) 125.634+1.234i)
(num-test (+ 123.4 1 1/1) 125.4)
(num-test (+ 123.4 1 123.4) 247.8)
(num-test (+ 123.4 1 1234) 1358.4)
(num-test (+ 123.4 1 1234/11) 236.58181818181819)
(num-test (+ 123.4 1) 124.4)
(num-test (+ 123.4 1.0 -1.0+1.0i) 123.4+1.0i)
(num-test (+ 123.4 1.0 0) 124.4)
(num-test (+ 123.4 1.0 0.0) 124.4)
(num-test (+ 123.4 1.0 0.0+1.0i) 124.4+1.0i)
(num-test (+ 123.4 1.0 1) 125.4)
(num-test (+ 123.4 1.0 1.0) 125.4)
(num-test (+ 123.4 1.0 1.0+1.0i) 125.4+1.0i)
(num-test (+ 123.4 1.0 1.234+1.234i) 125.634+1.234i)
(num-test (+ 123.4 1.0 1/1) 125.4)
(num-test (+ 123.4 1.0 123.4) 247.8)
(num-test (+ 123.4 1.0 1234) 1358.4)
(num-test (+ 123.4 1.0 1234/11) 236.58181818181819)
(num-test (+ 123.4 1.0) 124.4)
(num-test (+ 123.4 1.0+1.0i -1.0+1.0i) 123.4+2.0i)
(num-test (+ 123.4 1.0+1.0i 0) 124.4+1.0i)
(num-test (+ 123.4 1.0+1.0i 0.0) 124.4+1.0i)
(num-test (+ 123.4 1.0+1.0i 0.0+1.0i) 124.4+2.0i)
(num-test (+ 123.4 1.0+1.0i 1) 125.4+1.0i)
(num-test (+ 123.4 1.0+1.0i 1.0) 125.4+1.0i)
(num-test (+ 123.4 1.0+1.0i 1.0+1.0i) 125.4+2.0i)
(num-test (+ 123.4 1.0+1.0i 1.234+1.234i) 125.634+2.234i)
(num-test (+ 123.4 1.0+1.0i 1/1) 125.4+1.0i)
(num-test (+ 123.4 1.0+1.0i 123.4) 247.8+1.0i)
(num-test (+ 123.4 1.0+1.0i 1234) 1358.4+1.0i)
(num-test (+ 123.4 1.0+1.0i 1234/11) 236.58181818181819+1.0i)
(num-test (+ 123.4 1.0+1.0i) 124.4+1.0i)
(num-test (+ 123.4 1.234+1.234i -1.0+1.0i) 123.634+2.234i)
(num-test (+ 123.4 1.234+1.234i 0) 124.634+1.234i)
(num-test (+ 123.4 1.234+1.234i 0.0) 124.634+1.234i)
(num-test (+ 123.4 1.234+1.234i 0.0+1.0i) 124.634+2.234i)
(num-test (+ 123.4 1.234+1.234i 1) 125.634+1.234i)
(num-test (+ 123.4 1.234+1.234i 1.0) 125.634+1.234i)
(num-test (+ 123.4 1.234+1.234i 1.0+1.0i) 125.634+2.234i)
(num-test (+ 123.4 1.234+1.234i 1.234+1.234i) 125.86799999999999+2.468i)
(num-test (+ 123.4 1.234+1.234i 1/1) 125.634+1.234i)
(num-test (+ 123.4 1.234+1.234i 123.4) 248.03399999999999+1.234i)
(num-test (+ 123.4 1.234+1.234i 1234) 1358.63400000000001+1.234i)
(num-test (+ 123.4 1.234+1.234i 1234/11) 236.81581818181817+1.234i)
(num-test (+ 123.4 1.234+1.234i) 124.634+1.234i)
(num-test (+ 123.4 1/1 -1.0+1.0i) 123.4+1.0i)
(num-test (+ 123.4 123.4 -1.0+1.0i) 245.8+1.0i)
(num-test (+ 123.4 123.4 0) 246.8)
(num-test (+ 123.4 123.4 0.0) 246.8)
(num-test (+ 123.4 123.4 0.0+1.0i) 246.8+1.0i)
(num-test (+ 123.4 123.4 1) 247.8)
(num-test (+ 123.4 123.4 1.0) 247.8)
(num-test (+ 123.4 123.4 1.0+1.0i) 247.8+1.0i)
(num-test (+ 123.4 123.4 1.234+1.234i) 248.03400000000002+1.234i)
(num-test (+ 123.4 123.4 1/1) 247.8)
(num-test (+ 123.4 123.4 123.4) 370.20000000000005)
(num-test (+ 123.4 123.4 1234) 1480.79999999999995)
(num-test (+ 123.4 123.4 1234/11) 358.98181818181820)
(num-test (+ 123.4 123.4) 246.8)
(num-test (+ 123.4 1234 -1.0+1.0i) 1356.4+1.0i)
(num-test (+ 123.4 1234 0) 1357.4)
(num-test (+ 123.4 1234 0.0) 1357.4)
(num-test (+ 123.4 1234 0.0+1.0i) 1357.4+1.0i)
(num-test (+ 123.4 1234 1) 1358.4)
(num-test (+ 123.4 1234 1.0) 1358.4)
(num-test (+ 123.4 1234 1.0+1.0i) 1358.4+1.0i)
(num-test (+ 123.4 1234 1.234+1.234i) 1358.63400000000001+1.234i)
(num-test (+ 123.4 1234 1/1) 1358.4)
(num-test (+ 123.4 1234 123.4) 1480.80000000000018)
(num-test (+ 123.4 1234 1234) 2591.4)
(num-test (+ 123.4 1234 1234/11) 1469.58181818181833)
(num-test (+ 123.4 1234) 1357.4)
(num-test (+ 123.4 1234/11 -1.0+1.0i) 234.58181818181819+1.0i)
(num-test (+ 123.4 1234/11 0) 235.58181818181819)
(num-test (+ 123.4 1234/11 0.0) 235.58181818181819)
(num-test (+ 123.4 1234/11 0.0+1.0i) 235.58181818181819+1.0i)
(num-test (+ 123.4 1234/11 1) 236.58181818181819)
(num-test (+ 123.4 1234/11 1.0) 236.58181818181819)
(num-test (+ 123.4 1234/11 1.0+1.0i) 236.58181818181819+1.0i)
(num-test (+ 123.4 1234/11 1.234+1.234i) 236.81581818181820+1.234i)
(num-test (+ 123.4 1234/11 1/1) 236.58181818181819)
(num-test (+ 123.4 1234/11 123.4) 358.98181818181820)
(num-test (+ 123.4 1234/11 1234) 1469.58181818181811)
(num-test (+ 123.4 1234/11 1234/11) 347.76363636363635)
(num-test (+ 123.4 1234/11) 235.58181818181819)
(num-test (+ 1234 -1.0+1.0i) 1233.0+1.0i)
(num-test (+ 1234 0) 1234)
(num-test (+ 1234 0.0) 1234.0)
(num-test (+ 1234 0.0+1.0i) 1234.0+1.0i)
(num-test (+ 1234 1) 1235)
(num-test (+ 1234 1.0) 1235.0)
(num-test (+ 1234 1.0+1.0i) 1235.0+1.0i)
(num-test (+ 1234 1.234+1.234i) 1235.23399999999992+1.234i)
(num-test (+ 1234 1/1) 1235)
(num-test (+ 1234 123.4) 1357.4)
(num-test (+ 1234 1234) 2468)
(num-test (+ 1234 1234/11) 14808/11)
(num-test (+ 1234/11 -1.0+1.0i) 111.18181818181819+1.0i)
(num-test (+ 1234/11 0) 1234/11)
(num-test (+ 1234/11 0.0) 112.18181818181819)
(num-test (+ 1234/11 0.0+1.0i) 112.18181818181819+1.0i)
(num-test (+ 1234/11 1) 1245/11)
(num-test (+ 1234/11 1.0) 113.18181818181819)
(num-test (+ 1234/11 1.0+1.0i) 113.18181818181819+1.0i)
(num-test (+ 1234/11 1.234+1.234i) 113.41581818181818+1.234i)
(num-test (+ 1234/11 1/1) 1245/11)
(num-test (+ 1234/11 123.4) 235.58181818181819)
(num-test (+ 1234/11 1234) 14808/11)
(num-test (+ 1234/11 1234/11) 2468/11)
(num-test (+ 1234000000) 1234000000)
(num-test (+ 1234000000.0) 1234000000.0)
(num-test (+ 1234000000.0+2.71828182845905i) 1234000000.0+2.71828182845905i)
(num-test (+ 1234000000.0-2.71828182845905i) 1234000000.0-2.71828182845905i)
(num-test (+ 1234000000/10) 1234000000/10)
(num-test (+ 2) 2)
(num-test (+ 2.71828182845905) 2.71828182845905)
(num-test (+ 2.71828182845905+3.14159265358979i) 2.71828182845905+3.14159265358979i)
(num-test (+ 2.71828182845905-3.14159265358979i) 2.71828182845905-3.14159265358979i)
(num-test (+ 2/2) 2/2)
(num-test (+ 362880) 362880)
(num-test (+ 362880/1234) 362880/1234)

(for-each-permutation 
 (lambda args
   (if (not (= (apply + args) 3+i))
       (format #t "~A: (+ ~{~A~^ ~}) -> ~A?~%" (port-line-number) args (apply + args))))
 '(1 1/2 0.5 1+i))

(for-each-permutation 
 (lambda args
   (if (not (zero? (apply + args)))
       (format #t "~A: (+ ~{~A~^ ~}) -> ~A?~%" (port-line-number) args (apply + args))))
 '(1 1/2 0.5 1+i -1/2 -1 -0.5 -1-i))

(num-test (+ 10.0+0.i) 10.0)
(num-test (+ +10.+.0i) 10.0)
(test (integer? (+ 1/2 1/2)) #t)
(test (real? (+ 1+i 1-i)) #t)
(test (integer? (+ 1/100 99/100 (- most-positive-fixnum 2))) #t) ; of course reversing the args won't work
(test (integer? (+ 1/1000 999/1000 (- most-positive-fixnum 9223372036854775807))) #t)
(num-test (+ 1/1000 999/1000 (- most-positive-fixnum 9223372036854775807)) 1)
(test (integer? (+ 1/1000 999/1000 (- most-positive-fixnum 9200000000000000000))) #t)
(num-test (+ 1/1000 999/1000 (- most-positive-fixnum 9200000000000000000)) 23372036854775808)
(test (+ (rootlet) 1) 'error)

(test (< (+ 0.7 8388608) 8388609) #t) ; false in clisp!

(num-test (+ -1.797693134862315699999999999999999999998E308 -9223372036854775808) -1.797693134862315699999999999999999999998E308)
(num-test (+ -9223372036854775808 5.551115123125783999999999999999999999984E-17) -9.223372036854775807999999999999999944489E18)
(num-test (+ -9223372036854775808 9223372036854775807 -9223372036854775808) -9.223372036854775809e18)
(num-test (+ -9223372036854775808) -9223372036854775808)
(num-test (+ 1.110223024625156799999999999999999999997E-16 -9223372036854775808) -9.223372036854775807999999999999999888978E18)
(num-test (+ 1.110223024625156799999999999999999999997E-16 5.551115123125783999999999999999999999984E-17 5.42101086242752217060000000000000000001E-20) 1.665876638023977952217059999999999999994E-16)
(num-test (+ 5.551115123125783999999999999999999999984E-17 1.110223024625156799999999999999999999997E-16) 1.665334536937735199999999999999999999992E-16)
(num-test (+ 9223372036854775807 -9223372036854775808) -1)
(num-test (+ 0.(*)) 1.0)
(num-test (+ 0.(+)) 0.0)
(when (provided? 'overflow-checks)
  (num-test (+ 1/9223372036854775807 1/9223372036854775807) 2/9223372036854775807)
  (num-test (+ 10000000/9223372036854775807 1/3) 3.333333333344175355058188377674583355698E-1)
  (num-test (+ 1073741824 1073741824 1073741824 1073741824) (* 4 1073741824))
  (num-test (+ 268435456/129140163 129140163/268435456 7/19 29/19) 2933929486555791403/658650172313567232)
  (num-test (+ 268435456/129140163 129140163/268435456 7/29 29/19) 4.327416192871913348352681814704887193821E0)
  (num-test (+ -9223372036854775808 9223372036854775807) -1)
  (num-test (+ -9221/92233720 -92233720/9221 9221/92233720 92233720/9221) 0))

(num-test (+ (/ most-negative-fixnum 2) (/ most-negative-fixnum 2)) -9223372036854775808)
(num-test (+ (/ most-negative-fixnum 2) (/ most-negative-fixnum 2) 1) -9223372036854775807)
(num-test (+ (/ most-negative-fixnum 2) (/ most-negative-fixnum 2) -1) (if with-bignums -9223372036854775809 -9.223372036854776e+18))
(if (provided? 'overflow-checks)
    (num-test (- (/ most-negative-fixnum 2) (/ most-positive-fixnum 2) 1) (if with-bignums -18446744073709551617/2 -9.223372036854776e+18)))
(num-test (* 3037000499 3037000500) 9223372033963249500) 
(num-test (* 3037000499 3037000499) 9223372030926249001)
;(num-test (* 3037000500 3037000500) (if with-bignums 9223372037000250000 9.223372037000249e+18))
;(num-test (/ (* (/ 3037000499) (/ 3037000498))) 9223372027889248502)
(when (provided? 'overflow-checks)
  (num-test (/ (* (/ 3037000500) (/ 3037000500))) (if with-bignums 9223372037000250000 9.223372037000251e+18))
  (num-test (/ 3037000499 (/ 3037000499)) 9223372030926249001)
  (num-test (/ 3037000500 (/ 3037000500)) (if with-bignums 9223372037000250000 9.223372037000251e+18)))

(num-test (+ 0.6049332056786565E0 -0.9611373574853808E0) -3.562041518067242999999999999999999999981E-1)
(num-test (+ -0.4763715667865308E0 0.25936932107685584E0) -2.170022457096749600000000000000000000008E-1)
(num-test (+ 0.2666481927718355E0 -0.04984768063142031E0) 2.168005121404151899999999999999999999994E-1)
(num-test (+ -0.29478659758474846E0 0.3371004337672615E0) 4.231383618251304000000000000000000000076E-2)
(num-test (+ 0.8203063910979178E0 0.28968607542857916E0) 1.109992466526496959999999999999999999999E0)
(num-test (+ -0.08207985138263585E0 0.4368723951711785E0) 3.5479254378854265E-1)
(num-test (+ -0.8659875373355486E0 -6.631430771196765E9) -6.6314307720627525373355486E9)
(num-test (+ 0.15071385783307878E0 -7.154424279496395E9) -7.154424279345681142166921220000000000013E9)
(num-test (+ -0.8969642760814789E0 -2.4070067380831727E8) -2.407006747052815460814789000000000000005E8)
(num-test (+ -0.9610362081435054E0 9.070410778399954E9) 9.070410777438917634019580537500000000004E9)
(num-test (+ 0.5129052501104072E0 -7.47841120327471E9) -7.478411202761804451427678737500000000008E9)
(num-test (+ 0.3840242289740675E0 7.793048210060242E9) 7.793048210444265928192817499999999999991E9)
(num-test (+ 0.07603066126204616E0 5.215008470388369E-11) 7.603066131419624470388369000000000000006E-2)
(num-test (+ -0.17187858025312586E0 -5.116645189173968E-11) -1.718785803042923118917396799999999999997E-1)
(num-test (+ 0.2521315816245864E0 8.603210607505339E-11) 2.521315817106185060750533899999999999992E-1)
(num-test (+ -0.3557185853193914E0 -2.0371324697272998E-11) -3.557185853397627246972729979999999999995E-1)
(num-test (+ 0.7142792289542045E0 -7.106356053331326E-11) 7.142792288831409394666867399999999999997E-1)
(num-test (+ 0.4380415886629452E0 -3.069969538383403E-11) 4.380415886322455046161659700000000000005E-1)
(num-test (+ 0.24798614227178573E0 3.972393639614975E19) 3.972393639614975000024798614227178572989E19)
(num-test (+ -0.5210677288128815E0 4.846393336901129E19) 4.846393336901128999947893227118711850007E19)
(num-test (+ 0.5825404819115E0 1.9710987361264255E19) 1.971098736126425500058254048191149998548E19)
(num-test (+ 0.9105175208730549E0 2.391166552096775E19) 2.391166552096775000091051752087305489998E19)
(num-test (+ 0.48414423368371695E0 -9.696117779740095E19) -9.696117779740094999951585576631628304997E19)
(num-test (+ 0.25780758450697716E0 6.094683117025535E19) 6.094683117025535000025780758450697715991E19)
(num-test (+ 0.9824539149570484E0 -5.4680066990812835E-21) 9.824539149570483999945319933009187165013E-1)
(num-test (+ -0.9520982941158654E0 3.2513564801568073E-21) -9.520982941158653999967486435198431927013E-1)
(num-test (+ 0.0630170624560149E0 -9.858852595793203E-21) 6.301706245601489999014114740420679700008E-2)
(num-test (+ 0.24705141169888878E0 1.4582081178692862E-22) 2.470514116988887800001458208117869286195E-1)
(num-test (+ 0.7440948700757135E0 -3.0932442581890818E-21) 7.440948700757134999969067557418109181978E-1)
(num-test (+ -0.5055970869515372E0 4.0277457257516025E-21) -5.055970869515371999959722542742483974988E-1)
(num-test (+ 1.672355787134947E9 0.0064909681594120805E0) 1.6723557871414380296981083695625E9)
(num-test (+ -9.694504381396599E9 -0.8925470085542831E0) -9.694504382289146008554283099999999999987E9)
(num-test (+ -1.6695005924298635E9 -0.34426964741306E0) -1.669500592774133147413059987073324919041E9)
(num-test (+ -6.085591212594774E9 0.5107956920100049E0) -6.085591212083978307989995100000000000004E9)
(num-test (+ 7.457486660952688E9 -0.4323787588338597E0) 7.457486660520309458329226237499999999989E9)
(num-test (+ -8.790796444526546E9 0.911415263281967E0) -8.790796443615130736718033019187146237507E9)
(num-test (+ 9.667548804251982E9 -1.266547751029956E8) 9.54089402914898613522949218749999999999E9)
(num-test (+ -6.169561898845145E9 9.627911197121864E9) 3.458349298276719318847656250000000000009E9)
(num-test (+ -9.870287253215279E9 9.004242781937655E8) -8.969862975021513478950500488281249999995E9)
(num-test (+ -8.175630881172554E9 -4.08632236263908E9) -1.226195324381163404760742187500000000002E10)
(num-test (+ 2.9069444232153206E9 -7.961831315741894E9) -5.054886892526573399999999999999999999977E9)
(num-test (+ -7.003647401371184E9 -1.768371514817526E9) -8.772018916188710000000000000000000000001E9)
(num-test (+ -6.418847599138249E9 2.755257250162372E-11) -6.418847599138248999972447427498376279997E9)
(num-test (+ 2.3093152687241793E9 1.2205440142364766E-11) 2.309315268724179300012205440142364766011E9)
(num-test (+ 8.634577667577518E9 -9.065714034538668E-11) 8.634577667577518463044108484654613319994E9)
(num-test (+ 1.711283212591781E9 -3.235019197733951E-11) 1.71128321259178090092285000333516049E9)
(num-test (+ 2.583886638357791E9 -8.199109798920928E-11) 2.583886638357790946878458120760790719997E9)
(num-test (+ -7.517123950474774E9 5.2057802142431697E-11) -7.51712395047477399994794219785756830298E9)
(num-test (+ 3.266571938086574E9 -4.4782768261898355E19) -4.478276825863178306191342592239379882812E19)
(num-test (+ 2.1000389219899452E9 -8.547158903365463E19) -8.547158903155459107801005480000000000002E19)
(num-test (+ -3.9140926801217155E9 7.387959860641422E19) 7.387959860250012731987828450000000000009E19)
(num-test (+ -7.087607465790431E9 7.96875093387599E19) 7.968750933167229781420956900000000000008E19)
(num-test (+ -8.341000808926519E9 6.9360028397637304E19) 6.936002838929630319107348100000000000009E19)
(num-test (+ -5.507940634743809E9 9.760028858210094E19) 9.760028857659299936525619099999999999989E19)
(num-test (+ 8.492522971238823E9 -2.8253881864964467E-22) 8.492522971238822937011718749999717461174E9)
(num-test (+ 1.2731765723336241E9 -5.8473937102910264E-21) 1.273176572333624099999999999994152606294E9)
(num-test (+ 9.654280758878323E9 -4.2332114049658973E-22) 9.654280758878322601318359374999576678861E9)
(num-test (+ -6.864618926120946E9 -1.245648314796599E-21) -6.864618926120946000000000000001245648334E9)
(num-test (+ -3.9916044043798673E8 1.697737588450543E-21) -3.991604404379867299999999999983022624115E8)
(num-test (+ -7.818041624198686E9 4.635421587404246E-21) -7.818041624198685999999999999995364578418E9)
(num-test (+ 2.0609929543990767E-12 -0.2126306554359736E0) -2.126306554339126070456009232999999999998E-1)
(num-test (+ -1.5923091695877845E-11 0.515731533720818E0) 5.157315337048949444413677540931484848253E-1)
(num-test (+ 4.794527092905871E-11 -0.9066947202676092E0) -9.0669472021966392907094129E-1)
(num-test (+ -8.63854477728633E-11 0.3122982022565777E0) 3.122982021701922522271366999999999999999E-1)
(num-test (+ -7.577966666552416E-11 -0.24137602092437593E0) -2.413760210001555966655241600000000000004E-1)
(num-test (+ -4.971730475882754E-11 -0.8202688719750202E0) -8.202688720247375047588275400000000000012E-1)
(num-test (+ -5.249369194379291E-11 -8.546120620321186E9) -8.546120620321186000052493691943792910002E9)
(num-test (+ 8.280786962526793E-11 5.758373397436368E9) 5.758373397436367988669233650875267930002E9)
(num-test (+ 6.370323595535815E-11 -8.470663335712393E9) -8.470663335712392999936296764044641849996E9)
(num-test (+ 3.59771226839467E-11 3.5042505440266216E8) 3.504250544026621600359771226839466999997E8)
(num-test (+ -3.945501687396375E-11 -5.082779978069177E9) -5.082779978069177000039455016873963749988E9)
(num-test (+ 9.780590963267516E-11 -5.05591945120475E9) -5.055919451204750060937350340367324839998E9)
(num-test (+ 6.323293597096768E-11 -7.208898910487284E-11) -8.856053133905159999999999999999999999986E-12)
(num-test (+ -4.549781732354749E-11 -6.095452636416357E-11) -1.064523436877110600000000000000000000002E-10)
(num-test (+ -5.372680267837374E-11 2.0748354219485134E-11) -3.297844845888860599999999999999999999998E-11)
(num-test (+ 3.550879553916665E-11 -4.374873254056574E-11) -8.239937001399090000000000000000000000007E-12)
(num-test (+ -6.746002242414832E-11 3.0803985031459436E-11) -3.665603739268888400000000000000000000013E-11)
(num-test (+ -7.902512161494214E-11 -8.907842858073236E-11) -1.681035501956744999999999999999999999998E-10)
(num-test (+ -4.1465935469350415E-11 6.244210696961323E19) 6.24421069696132299999999999999585340645E19)
(num-test (+ 4.921297536286578E-11 -1.694436650099881E19) -1.694436650099880999999999999995078702462E19)
(num-test (+ -7.879478980672654E-11 6.41757969360492E19) 6.41757969360491970559999999999212052103E19)
(num-test (+ -8.200749317872953E-11 -9.490225542618815E19) -9.490225542618815000000000000008200749324E19)
(num-test (+ -7.572981329795812E-11 -3.350367078181029E19) -3.350367078181029000000000000007572981326E19)
(num-test (+ -5.955255565125549E-11 -5.009913629288125E19) -5.00991362928812500000000000000595525556E19)
(num-test (+ -9.818180775332558E-11 -7.926156011681593E-21) -9.818180776125173601168159300000000000011E-11)
(num-test (+ -5.2466438379505935E-12 8.468830229031857E-21) -5.246643829481763270968143000000000000009E-12)
(num-test (+ 3.582774358441715E-11 3.6865211729351863E-22) 3.582774358478580211729351862999999999999E-11)
(num-test (+ 7.169296413565744E-11 -9.974881413980864E-21) 7.169296412568255858601913599999999999987E-11)
(num-test (+ -9.615073655516977E-11 4.9552491300097786E-21) -9.615073655021452086999022140000000000005E-11)
(num-test (+ 6.7696956269187E-11 4.1431488006404866E-21) 6.769695627333015423852294397336791395272E-11)
(num-test (+ -4.663397365185298E19 0.9758464195927673E0) -4.663397365185297999902415358040723270005E19)
(num-test (+ -4.77977261393851E19 0.04145189313162445E0) -4.779772613938509999995854810686837555009E19)
(num-test (+ 7.195364554121596E19 0.5169917736820715E0) 7.195364554121596000051699177368207149992E19)
(num-test (+ -7.766254779507882E19 0.5919134938460356E0) -7.766254779507881999940808650615396440016E19)
(num-test (+ -8.411122653901408E19 -0.14463225181516137E0) -8.411122653901408000014463225181516137013E19)
(num-test (+ -9.101920591747218E19 0.23349918704239836E0) -9.101920591747217999976650081295760164003E19)
(num-test (+ 7.037477746142529E18 -3.250947575909365E9) 7.037477742891581424090634999999999999988E18)
(num-test (+ -6.864341752972099E19 -4.0510449339565725E9) -6.864341753377203493395657250000000000004E19)
(num-test (+ -5.329540273290228E19 8.14869777458878E9) -5.329540272475358222541121959686279296875E19)
(num-test (+ -9.726234388247201E19 2.053976989398215E9) -9.726234388041803301060178494453430175781E19)
(num-test (+ -1.910324088450308E19 6.247052535748024E9) -1.910324087825602746425197601318359375E19)
(num-test (+ -6.079933001949367E18 6.316829148809886E9) -6.07993299563253785119011402130126953125E18)
(num-test (+ -4.499107911798452E19 9.659763881732633E-11) -4.499107911798451999999999999990340236126E19)
(num-test (+ -3.0972208018542522E19 -9.077209886078653E-11) -3.097220801854252200000000000009077209882E19)
(num-test (+ -2.3000547840875442E19 -3.2043634522621155E-11) -2.300054784087544200000000000003204363456E19)
(num-test (+ 2.124555308489292E19 2.252166800652451E-11) 2.124555308489292000000000000002252166802E19)
(num-test (+ -7.74280238703686E19 1.7289553748884322E-11) -7.74280238703685999999999999999827104461E19)
(num-test (+ -8.119446783121816E19 -4.3461802389685114E-11) -8.11944678312181600000000000000434618023E19)
(num-test (+ -4.70848534032654E18 -4.698316648967506E19) -5.16916518300016E19)
(num-test (+ 2.853799842810312E19 -5.56805968603395E19) -2.714259843223638E19)
(num-test (+ -2.9128622996090335E19 -5.153369106520702E19) -8.0662314061297355E19)
(num-test (+ -5.415993984772977E19 4.481932558278175E19) -9.34061426494802E18)
(num-test (+ -1.4652301908531261E19 7.89284449966826E19) 6.4276143088151335352E19)
(num-test (+ -8.241911630479252E19 5.377001886877124E19) -2.864909743602128E19)
(num-test (+ -6.923631123395076E19 7.100129853298664E-22) -6.923631123395076E19)
(num-test (+ -5.864213410820717E19 -2.649878514627326E-21) -5.864213410820717E19)
(num-test (+ 8.660575002861176E19 2.751926085897399E-21) 8.660575002861176E19)
(num-test (+ -3.0252871646631318E19 6.852831573716124E-21) -3.0252871646631318E19)
(num-test (+ -9.155476807340938E19 -5.552907466957205E-21) -9.155476807340938E19)
(num-test (+ -4.03382621358461E19 6.670808279457885E-21) -4.03382621358461E19)
(num-test (+ 8.842980509187577E-21 0.5028466982188534E0) 5.028466982188534000088429805091875769998E-1)
(num-test (+ 1.7292043381396136E-21 0.19490424064972922E0) 1.949042406497292200017292043381396136E-1)
(num-test (+ -5.854820918836103E-21 -0.6700030154364615E0) -6.700030154364615000058548209188361029995E-1)
(num-test (+ -2.152396491682048E-21 0.5002930268902921E0) 5.002930268902920999978476035083179519998E-1)
(num-test (+ -1.0897149666610629E-21 0.16555534170490604E0) 1.655553417049060399989102850333389370996E-1)
(num-test (+ 6.321421497987867E-24 -0.08008112131564671E0) -8.008112131564670999999367857850201213302E-2)
(num-test (+ -6.1552667309563055E-21 7.235074489769488E9) 7.23507448976948833465576171874384473328E9)
(num-test (+ -2.2311335001219955E-22 1.220011008333989E9) 1.220011008333988904953002929687276886647E9)
(num-test (+ 8.523565724937177E-23 -4.1650242034123087E9) -4.165024203412308699999999999999914764338E9)
(num-test (+ -2.4400041303825447E-21 4.435554678685388E9) 4.435554678685387611389160156247559995867E9)
(num-test (+ -3.4479065449345757E-22 8.491084033112451E8) 8.491084033112450838088989257809052093456E8)
(num-test (+ -7.919939059912893E-21 -7.610637842585286E9) -7.610637842585286000000000000007919939044E9)
(num-test (+ 4.4958602369105625E-21 5.758376768873417E-11) 5.758376769323003023691056249999999999989E-11)
(num-test (+ 2.4375297386412195E-21 9.417086717671841E-11) 9.41708671791559397386412194999999999998E-11)
(num-test (+ 1.0040647133383462E-21 3.4701016271268983E-12) 3.470101628130963013338346199999999999999E-12)
(num-test (+ -3.885093055726793E-21 -8.523534862249969E-11) -8.523534862638478305572679299999999999995E-11)
(num-test (+ 1.027951323422187E-21 -7.65508060829868E-11) -7.655080608195884867657781300000000000011E-11)
(num-test (+ -9.83813940552434E-21 -5.048380063082019E-11) -5.048380064065832940552434000000000000001E-11)
(num-test (+ -7.640856498925806E-21 -5.743808556015994E19) -5.743808556015994E19)
(num-test (+ 8.053891045717591E-21 4.0840032650134725E19) 4.0840032650134725E19)
(num-test (+ -4.794782783871528E-21 -3.431216587740782E18) -3.431216587740782E18)
(num-test (+ 1.860870988390988E-21 -3.757945694933625E19) -3.757945694933625E19)
(num-test (+ 5.445498222566789E-21 7.575823566817991E19) 7.575823566817991E19)
(num-test (+ 2.631896745307223E-21 4.906449817201212E19) 4.906449817201212E19)
(num-test (+ -6.61689881073516E-21 5.357007670385275E-21) -1.25989114034988500000000000000000000001E-21)
(num-test (+ 3.0173001109587537E-21 5.2947222461350496E-21) 8.312022357093803300000000000000000000009E-21)
(num-test (+ -8.792518441030627E-21 -1.0516787854168774E-21) -9.84419722644750439999999999999999999997E-21)
(num-test (+ 7.349451992884509E-21 -8.427997362671486E-21) -1.078545369786976999999999999999999999993E-21)
(num-test (+ -7.881179611953633E-21 3.2080446524364824E-21) -4.673134959517150599999999999999999999987E-21)
(num-test (+ -9.614117725927607E-21 -5.35667712698602E-21) -1.4970794852913627E-20)

(num-test (+ 763661/10959 314049/215772 801211/520111) 29795593575023947/409959352197876)
(num-test (+ 754684/707399 364133/66140) 43928874261/6683909980)
(num-test (+ 440608/272315 551945/732519 640011/210080) 45409303060766899/8381179896953760)
(num-test (+ 6567/58532 12009/41861 51413/44691) 169671941552201/109502248051932)
(num-test (+ 24362/18498 57440/40727 22449/57480) 22502908640629/7217265880680)
(num-test (+ 31721/56074 60995/54239) 5140748949/3041397686)
(num-test (+ 53838/33670 41433/21212 18707/18707 38145/30697 18708/22768) 51605878718885969/7799478725530310)
(num-test (+ 28104/38994 16087/7686 61878/25480) 238289915659/45455695740)
(num-test (+ 19084/1172 31274/36894 58813/47401 21693/36339) 58866653148990514/3103363080883923)
(num-test (+ 46622/34221 37123/47024 30488/35441) 2816139009923/934950024624)
(num-test (+ 5132/18296 39996/45879 41433/58822 63206/41458) 72097712837475423/21322935628641329)
(num-test (+ 2203/36057 55977/14559 48383/64098 9101/28942) 134587284141221743/27051518778595353)
(num-test (+ 32375/41641 50274/42858 18792/37422 7370/20399) 1314683476492406/467198461232349)
(num-test (+ 13733/12161 54393/23682 3717/60389) 2888390497365/828182803618)
(num-test (+ 62280/7667 54471/23126 54070/62784) 31558604335387/2783011331232)
(num-test (+ 11072/35120 33950/8514 59489/8783 38683/16720) 66811589960405/4989817212336)
(num-test (+ 20220/12370 24149/50379 63926/10436) 2679308820467/325179618414)
(num-test (+ 26718/50103 44333/20749 6375/11441 47216/19118) 12699871541397230/2229293103730143)
(num-test (+ 38673/65491 57303/2569 40991/55309) 219956905519979/9305538976111)

(num-test (+ 1/98947 2/97499 3/76847) 51641766530/741360956847391)
(test (> (+ 123456789/3 3/123456789 -123456789/3 -3/123456789) 2e-12) #f) ; it's really 0, but fp inaccuracies catch us
(num-test (+ 1e100 -1e100) 0.0)
(num-test (+ 1e100 1e100) 2e100)
(num-test (+ 1e200 -1e200) 0.0)
(num-test (+ 1e300 -1e300) 0.0)
(num-test (+ 500009/500029 500057/500041) 500068002022/250035001189)
(num-test (+ 0.5 -0.5 1/2) 0.5)
(num-test (+ 1 1/2 0.5 3.0+5.5i) 5.0+5.5i)
(num-test (+ 1/2 0.5) 1.0)
(num-test (+ 3 4) 7 )
(num-test (+ 3) '3 )
(num-test (+) 0 )
(num-test (+ 123123123123123 123123123123123) 246246246246246)

(unless (or with-bignums (not (provided? 'overflow-checks)))
  (num-test (+ 3/4 4611686018427387904) 4.61168601842738790475E18)
  (num-test (+ 1/17179869184 1073741824) 1.073741824000000000058207660913467407227E9)
  (num-test (+ 1/8589934592 1073741824) 1.073741824000000000116415321826934814453E9)
  (num-test (+ 100000 1/142857142857140) 1.000000000000000000070000000000001400001E5)
  (num-test (+ 4611686018427387904 3/4) 4.61168601842738790475E18)
  (num-test (+ -63 8 1/9223372036854775807) -55.0)
  (num-test (+ 8 8 1/9223372036854775807) 16.0)
  (num-test (+ -1 -63 1/9223372036854775807) -64.0)
  (num-test (+ 32768 -1 562949953421312/281474976710655) 32769.0)
  (num-test (+ -63 262144 70368744177664/35184372088831) 262083.0)
  (num-test (+ 2147483648 -1 8589934592/4294967295) 2147483649.0)
  (num-test (+ 8589934592/4294967295 2147483648 -1) 2147483649.0)
  (num-test (+ 8589934592/4294967295 -1 2147483648) 2147483649.0)
  (num-test (+ -1 8589934592/4294967295 2147483648) 2147483649.0))

;      (num-test (+ 4611686018427387904 4611686018427387904) 9.223372036854775808e18)
;      (num-test (+ most-positive-fixnum most-positive-fixnum) 1.8446744073709551614e19)
;      (num-test (+ most-negative-fixnum most-negative-fixnum) -1.8446744073709551616e19)

(let ()
  (define (add1)
    (+ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99))
  (num-test (add1) 4950)
  
  (define (add2)
    (+ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999))
  (num-test (add2) 499500)
  
  (define (add3)
    (+ 1 (+ 2 (+ 3 (+ 4 (+ 5 (+ 6 (+ 7 (+ 8 (+ 9 (+ 10 (+ 11 (+ 12 (+ 13 (+ 14 (+ 15 (+ 16 (+ 17 (+ 18 (+ 19 (+ 20 (+ 21 (+ 22 (+ 23 (+ 24 (+ 25 (+ 26 (+ 27 (+ 28 (+ 29 (+ 30 (+ 31 (+ 32 (+ 33 (+ 34 (+ 35 (+ 36 (+ 37 (+ 38 (+ 39 (+ 40 (+ 41 (+ 42 (+ 43 (+ 44 (+ 45 (+ 46 (+ 47 (+ 48 (+ 49 (+ 50 (+ 51 (+ 52 (+ 53 (+ 54 (+ 55 (+ 56 (+ 57 (+ 58 (+ 59 (+ 60 (+ 61 (+ 62 (+ 63 (+ 64 (+ 65 (+ 66 (+ 67 (+ 68 (+ 69 (+ 70 (+ 71 (+ 72 (+ 73 (+ 74 (+ 75 (+ 76 (+ 77 (+ 78 (+ 79 (+ 80 (+ 81 (+ 82 (+ 83 (+ 84 (+ 85 (+ 86 (+ 87 (+ 88 (+ 89 (+ 90 (+ 91 (+ 92 (+ 93 (+ 94 (+ 95 (+ 96 (+ 97 (+ 98 (+ 99))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
  (num-test (add3) 4950)

  (define (add4)
    (+ 1 (+ 2 (+ 3 (+ 4 (+ 5 (+ 6 (+ 7 (+ 8 (+ 9 (+ 10 (+ 11 (+ 12 (+ 13 (+ 14 (+ 15 (+ 16 (+ 17 (+ 18 (+ 19 (+ 20 (+ 21 (+ 22 (+ 23 (+ 24 (+ 25 (+ 26 (+ 27 (+ 28 (+ 29 (+ 30 (+ 31 (+ 32 (+ 33 (+ 34 (+ 35 (+ 36 (+ 37 (+ 38 (+ 39 (+ 40 (+ 41 (+ 42 (+ 43 (+ 44 (+ 45 (+ 46 (+ 47 (+ 48 (+ 49 (+ 50 (+ 51 (+ 52 (+ 53 (+ 54 (+ 55 (+ 56 (+ 57 (+ 58 (+ 59 (+ 60 (+ 61 (+ 62 (+ 63 (+ 64 (+ 65 (+ 66 (+ 67 (+ 68 (+ 69 (+ 70 (+ 71 (+ 72 (+ 73 (+ 74 (+ 75 (+ 76 (+ 77 (+ 78 (+ 79 (+ 80 (+ 81 (+ 82 (+ 83 (+ 84 (+ 85 (+ 86 (+ 87 (+ 88 (+ 89 (+ 90 (+ 91 (+ 92 (+ 93 (+ 94 (+ 95 (+ 96 (+ 97 (+ 98 (+ 99 (+ 100 (+ 101 (+ 102 (+ 103 (+ 104 (+ 105 (+ 106 (+ 107 (+ 108 (+ 109 (+ 110 (+ 111 (+ 112 (+ 113 (+ 114 (+ 115 (+ 116 (+ 117 (+ 118 (+ 119 (+ 120 (+ 121 (+ 122 (+ 123 (+ 124 (+ 125 (+ 126 (+ 127 (+ 128 (+ 129 (+ 130 (+ 131 (+ 132 (+ 133 (+ 134 (+ 135 (+ 136 (+ 137 (+ 138 (+ 139 (+ 140 (+ 141 (+ 142 (+ 143 (+ 144 (+ 145 (+ 146 (+ 147 (+ 148 (+ 149 (+ 150 (+ 151 (+ 152 (+ 153 (+ 154 (+ 155 (+ 156 (+ 157 (+ 158 (+ 159 (+ 160 (+ 161 (+ 162 (+ 163 (+ 164 (+ 165 (+ 166 (+ 167 (+ 168 (+ 169 (+ 170 (+ 171 (+ 172 (+ 173 (+ 174 (+ 175 (+ 176 (+ 177 (+ 178 (+ 179 (+ 180 (+ 181 (+ 182 (+ 183 (+ 184 (+ 185 (+ 186 (+ 187 (+ 188 (+ 189 (+ 190 (+ 191 (+ 192 (+ 193 (+ 194 (+ 195 (+ 196 (+ 197 (+ 198 (+ 199 (+ 200 (+ 201 (+ 202 (+ 203 (+ 204 (+ 205 (+ 206 (+ 207 (+ 208 (+ 209 (+ 210 (+ 211 (+ 212 (+ 213 (+ 214 (+ 215 (+ 216 (+ 217 (+ 218 (+ 219 (+ 220 (+ 221 (+ 222 (+ 223 (+ 224 (+ 225 (+ 226 (+ 227 (+ 228 (+ 229 (+ 230 (+ 231 (+ 232 (+ 233 (+ 234 (+ 235 (+ 236 (+ 237 (+ 238 (+ 239 (+ 240 (+ 241 (+ 242 (+ 243 (+ 244 (+ 245 (+ 246 (+ 247 (+ 248 (+ 249 (+ 250 (+ 251 (+ 252 (+ 253 (+ 254 (+ 255 (+ 256 (+ 257 (+ 258 (+ 259 (+ 260 (+ 261 (+ 262 (+ 263 (+ 264 (+ 265 (+ 266 (+ 267 (+ 268 (+ 269 (+ 270 (+ 271 (+ 272 (+ 273 (+ 274 (+ 275 (+ 276 (+ 277 (+ 278 (+ 279 (+ 280 (+ 281 (+ 282 (+ 283 (+ 284 (+ 285 (+ 286 (+ 287 (+ 288 (+ 289 (+ 290 (+ 291 (+ 292 (+ 293 (+ 294 (+ 295 (+ 296 (+ 297 (+ 298 (+ 299 (+ 300 (+ 301 (+ 302 (+ 303 (+ 304 (+ 305 (+ 306 (+ 307 (+ 308 (+ 309 (+ 310 (+ 311 (+ 312 (+ 313 (+ 314 (+ 315 (+ 316 (+ 317 (+ 318 (+ 319 (+ 320 (+ 321 (+ 322 (+ 323 (+ 324 (+ 325 (+ 326 (+ 327 (+ 328 (+ 329 (+ 330 (+ 331 (+ 332 (+ 333 (+ 334 (+ 335 (+ 336 (+ 337 (+ 338 (+ 339 (+ 340 (+ 341 (+ 342 (+ 343 (+ 344 (+ 345 (+ 346 (+ 347 (+ 348 (+ 349 (+ 350 (+ 351 (+ 352 (+ 353 (+ 354 (+ 355 (+ 356 (+ 357 (+ 358 (+ 359 (+ 360 (+ 361 (+ 362 (+ 363 (+ 364 (+ 365 (+ 366 (+ 367 (+ 368 (+ 369 (+ 370 (+ 371 (+ 372 (+ 373 (+ 374 (+ 375 (+ 376 (+ 377 (+ 378 (+ 379 (+ 380 (+ 381 (+ 382 (+ 383 (+ 384 (+ 385 (+ 386 (+ 387 (+ 388 (+ 389 (+ 390 (+ 391 (+ 392 (+ 393 (+ 394 (+ 395 (+ 396 (+ 397 (+ 398 (+ 399 (+ 400 (+ 401 (+ 402 (+ 403 (+ 404 (+ 405 (+ 406 (+ 407 (+ 408 (+ 409 (+ 410 (+ 411 (+ 412 (+ 413 (+ 414 (+ 415 (+ 416 (+ 417 (+ 418 (+ 419 (+ 420 (+ 421 (+ 422 (+ 423 (+ 424 (+ 425 (+ 426 (+ 427 (+ 428 (+ 429 (+ 430 (+ 431 (+ 432 (+ 433 (+ 434 (+ 435 (+ 436 (+ 437 (+ 438 (+ 439 (+ 440 (+ 441 (+ 442 (+ 443 (+ 444 (+ 445 (+ 446 (+ 447 (+ 448 (+ 449 (+ 450 (+ 451 (+ 452 (+ 453 (+ 454 (+ 455 (+ 456 (+ 457 (+ 458 (+ 459 (+ 460 (+ 461 (+ 462 (+ 463 (+ 464 (+ 465 (+ 466 (+ 467 (+ 468 (+ 469 (+ 470 (+ 471 (+ 472 (+ 473 (+ 474 (+ 475 (+ 476 (+ 477 (+ 478 (+ 479 (+ 480 (+ 481 (+ 482 (+ 483 (+ 484 (+ 485 (+ 486 (+ 487 (+ 488 (+ 489 (+ 490 (+ 491 (+ 492 (+ 493 (+ 494 (+ 495 (+ 496 (+ 497 (+ 498 (+ 499 (+ 500 (+ 501 (+ 502 (+ 503 (+ 504 (+ 505 (+ 506 (+ 507 (+ 508 (+ 509 (+ 510 (+ 511 (+ 512 (+ 513 (+ 514 (+ 515 (+ 516 (+ 517 (+ 518 (+ 519 (+ 520 (+ 521 (+ 522 (+ 523 (+ 524 (+ 525 (+ 526 (+ 527 (+ 528 (+ 529 (+ 530 (+ 531 (+ 532 (+ 533 (+ 534 (+ 535 (+ 536 (+ 537 (+ 538 (+ 539 (+ 540 (+ 541 (+ 542 (+ 543 (+ 544 (+ 545 (+ 546 (+ 547 (+ 548 (+ 549 (+ 550 (+ 551 (+ 552 (+ 553 (+ 554 (+ 555 (+ 556 (+ 557 (+ 558 (+ 559 (+ 560 (+ 561 (+ 562 (+ 563 (+ 564 (+ 565 (+ 566 (+ 567 (+ 568 (+ 569 (+ 570 (+ 571 (+ 572 (+ 573 (+ 574 (+ 575 (+ 576 (+ 577 (+ 578 (+ 579 (+ 580 (+ 581 (+ 582 (+ 583 (+ 584 (+ 585 (+ 586 (+ 587 (+ 588 (+ 589 (+ 590 (+ 591 (+ 592 (+ 593 (+ 594 (+ 595 (+ 596 (+ 597 (+ 598 (+ 599 (+ 600 (+ 601 (+ 602 (+ 603 (+ 604 (+ 605 (+ 606 (+ 607 (+ 608 (+ 609 (+ 610 (+ 611 (+ 612 (+ 613 (+ 614 (+ 615 (+ 616 (+ 617 (+ 618 (+ 619 (+ 620 (+ 621 (+ 622 (+ 623 (+ 624 (+ 625 (+ 626 (+ 627 (+ 628 (+ 629 (+ 630 (+ 631 (+ 632 (+ 633 (+ 634 (+ 635 (+ 636 (+ 637 (+ 638 (+ 639 (+ 640 (+ 641 (+ 642 (+ 643 (+ 644 (+ 645 (+ 646 (+ 647 (+ 648 (+ 649 (+ 650 (+ 651 (+ 652 (+ 653 (+ 654 (+ 655 (+ 656 (+ 657 (+ 658 (+ 659 (+ 660 (+ 661 (+ 662 (+ 663 (+ 664 (+ 665 (+ 666 (+ 667 (+ 668 (+ 669 (+ 670 (+ 671 (+ 672 (+ 673 (+ 674 (+ 675 (+ 676 (+ 677 (+ 678 (+ 679 (+ 680 (+ 681 (+ 682 (+ 683 (+ 684 (+ 685 (+ 686 (+ 687 (+ 688 (+ 689 (+ 690 (+ 691 (+ 692 (+ 693 (+ 694 (+ 695 (+ 696 (+ 697 (+ 698 (+ 699 (+ 700 (+ 701 (+ 702 (+ 703 (+ 704 (+ 705 (+ 706 (+ 707 (+ 708 (+ 709 (+ 710 (+ 711 (+ 712 (+ 713 (+ 714 (+ 715 (+ 716 (+ 717 (+ 718 (+ 719 (+ 720 (+ 721 (+ 722 (+ 723 (+ 724 (+ 725 (+ 726 (+ 727 (+ 728 (+ 729 (+ 730 (+ 731 (+ 732 (+ 733 (+ 734 (+ 735 (+ 736 (+ 737 (+ 738 (+ 739 (+ 740 (+ 741 (+ 742 (+ 743 (+ 744 (+ 745 (+ 746 (+ 747 (+ 748 (+ 749 (+ 750 (+ 751 (+ 752 (+ 753 (+ 754 (+ 755 (+ 756 (+ 757 (+ 758 (+ 759 (+ 760 (+ 761 (+ 762 (+ 763 (+ 764 (+ 765 (+ 766 (+ 767 (+ 768 (+ 769 (+ 770 (+ 771 (+ 772 (+ 773 (+ 774 (+ 775 (+ 776 (+ 777 (+ 778 (+ 779 (+ 780 (+ 781 (+ 782 (+ 783 (+ 784 (+ 785 (+ 786 (+ 787 (+ 788 (+ 789 (+ 790 (+ 791 (+ 792 (+ 793 (+ 794 (+ 795 (+ 796 (+ 797 (+ 798 (+ 799 (+ 800 (+ 801 (+ 802 (+ 803 (+ 804 (+ 805 (+ 806 (+ 807 (+ 808 (+ 809 (+ 810 (+ 811 (+ 812 (+ 813 (+ 814 (+ 815 (+ 816 (+ 817 (+ 818 (+ 819 (+ 820 (+ 821 (+ 822 (+ 823 (+ 824 (+ 825 (+ 826 (+ 827 (+ 828 (+ 829 (+ 830 (+ 831 (+ 832 (+ 833 (+ 834 (+ 835 (+ 836 (+ 837 (+ 838 (+ 839 (+ 840 (+ 841 (+ 842 (+ 843 (+ 844 (+ 845 (+ 846 (+ 847 (+ 848 (+ 849 (+ 850 (+ 851 (+ 852 (+ 853 (+ 854 (+ 855 (+ 856 (+ 857 (+ 858 (+ 859 (+ 860 (+ 861 (+ 862 (+ 863 (+ 864 (+ 865 (+ 866 (+ 867 (+ 868 (+ 869 (+ 870 (+ 871 (+ 872 (+ 873 (+ 874 (+ 875 (+ 876 (+ 877 (+ 878 (+ 879 (+ 880 (+ 881 (+ 882 (+ 883 (+ 884 (+ 885 (+ 886 (+ 887 (+ 888 (+ 889 (+ 890 (+ 891 (+ 892 (+ 893 (+ 894 (+ 895 (+ 896 (+ 897 (+ 898 (+ 899 (+ 900 (+ 901 (+ 902 (+ 903 (+ 904 (+ 905 (+ 906 (+ 907 (+ 908 (+ 909 (+ 910 (+ 911 (+ 912 (+ 913 (+ 914 (+ 915 (+ 916 (+ 917 (+ 918 (+ 919 (+ 920 (+ 921 (+ 922 (+ 923 (+ 924 (+ 925 (+ 926 (+ 927 (+ 928 (+ 929 (+ 930 (+ 931 (+ 932 (+ 933 (+ 934 (+ 935 (+ 936 (+ 937 (+ 938 (+ 939 (+ 940 (+ 941 (+ 942 (+ 943 (+ 944 (+ 945 (+ 946 (+ 947 (+ 948 (+ 949 (+ 950 (+ 951 (+ 952 (+ 953 (+ 954 (+ 955 (+ 956 (+ 957 (+ 958 (+ 959 (+ 960 (+ 961 (+ 962 (+ 963 (+ 964 (+ 965 (+ 966 (+ 967 (+ 968 (+ 969 (+ 970 (+ 971 (+ 972 (+ 973 (+ 974 (+ 975 (+ 976 (+ 977 (+ 978 (+ 979 (+ 980 (+ 981 (+ 982 (+ 983 (+ 984 (+ 985 (+ 986 (+ 987 (+ 988 (+ 989 (+ 990 (+ 991 (+ 992 (+ 993 (+ 994 (+ 995 (+ 996 (+ 997 (+ 998 (+ 999))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
  (num-test (add4) 499500))

(let ()
  (define (fact n) (if (<= n 1) 1 (* n (fact (- n 1)))))
  (num-test (fact 7) 5040)
  (num-test (fact 20) 2432902008176640000)
  (do ((i 2 (+ i 1)))
      ((= i 21))
    (num-test (* i (fact (- i 1))) (fact i))
    (num-test (/ (* i (fact (- i 1)))) (/ (fact i))))
  (if with-bignums 
      (begin
	(num-test (fact 21) 51090942171709440000)
	(num-test (fact 32) 263130836933693530167218012160000000)
	(do ((i 20 (+ i 1)))
	    ((= i 40))
	  (num-test (* i (fact (- i 1))) (fact i))))))

(num-test (let ((pi2 0.0)
		(ais (vector 1 -3 -2 -3 1 0)))
	    (do ((i 1 (+ i 1))
		 (two 2 (* two 2)))
		((= i 30) (* 36 pi2))
	      (set! pi2 (+ pi2 (/ (vector-ref ais (modulo (- i 1) 6))
				  (* two i i))))))
	  (* pi pi))

(num-test (let ((log2 0.0)
		(ais (vector 2 -10 -7 -10 2 -1)))
	    (do ((i 1 (+ i 1))
		 (two 2 (* two 2)))
		((= i 30) (* 2 log2))
	      (set! log2 (+ log2 (/ (vector-ref ais (modulo (- i 1) 6))
				    (* two i i))))))
	  (* (log 2) (log 2)))

(unless (or with-bignums (not (provided? 'overflow-checks)))
  (num-test (+ 1/9223372036854775807 1/9223372036854775806) 2.168404344971e-19)
  (num-test (+ 1/98947 2/97499 3/76847 4/61981 5/59981 6/66601) 0.00030764243484887)
  (num-test (+ 1/98947 2/97499 3/76847 4/61981 5/59981) 0.00021755369744252)
  (num-test (+ 1/98947 2/97499 3/76847 4/61981) 0.00013419396686117)
  (num-test (+ 500009/500029 500057/500041 500083/500069) 3.00001999583261)
  (num-test (+ 98947 2/97499 76847 4/61981 5/59981) 175794.00016841))

(if with-bignums
    (test (< (abs (- (do ((x0 11/2) 
			  (x1 61/11)
			  (i 0 (+ i 1))) 
			 ((= i 100) x1)
		       (let ((tmp x1)) 
			 (set! x1 (- 111 (/ (- 1130 (/ 3000 x0)) x1)))
			 (set! x0 tmp)))
		     6))                  ; (6 - 1/(1+(6/5)^k))
	     0.00001)
	  #t))

;; in floats this heads for 100:
;; (do ((x0 (exact->inexact 11/2)) (x1 (exact->inexact 61/11)) (i 0 (+ i 1))) ((= i 100) x1) (let ((tmp x1)) (set! x1 (- 111 (/ (- 1130 (/ 3000 x0)) x1))) (set! x0 tmp)))

#|
in gmp case we get:
:(+ 8388608 .00000001)
8388608.0
but it's the printout that is at fault:
:(- (+ 8388608 .000000001) 8388608)
1.862645149231e-09
|#

(when with-bignums
  (num-test (+ 0.999999995 8388608) 8388608.999999995)
  (num-test (+ (+ 1.0e-30 1.0e30) -1.0e30) (+ 1.0e-30 (+ 1.0e30 -1.0e30)))
  (num-test (+ 11111111111111113.0 (+ -11111111111111111.0 7.5111111111111)) (+ (+ 11111111111111113.0 -11111111111111111.0) 7.5111111111111))
  (num-test (+ -1000000000 -1000000000 -1000000000) -3000000000)
  (num-test (+ -8589934591 -4611686018427387904) -4611686027017322495)
  (num-test (+ -8589934591 4611686018427387904) 4611686009837453313)
  (num-test (+ -9223372036854775807 -1) -9223372036854775808)
  (num-test (+ -9223372036854775807 1) -9223372036854775806)
  (num-test (+ -9223372036854775808 -9223372036854775808) -18446744073709551616)
  (num-test (+ 1 1/2 0+9223372036854775808.0i 0-i) 1.5+9.223372036854775807E18i)
  (num-test (+ 1 1/2 9223372036854775808.0 0+i) 9.2233720368547758095E18+1.0i)
  (num-test (+ 1 1/2 9223372036854775808.0 0-i) 9.2233720368547758095E18-1.0i)
  (num-test (+ 1 1/2 9223372036854775808.0) 9.2233720368547758095E18)
  (num-test (+ 1.0 12345678901234567890) 1.2345678901234567891E19)
  (num-test (+ 1.0e80+i 1.0e80+i) 2.0e80+2.0i)
  (num-test (+ 1.0e80+i 1.0e80-i) 2.0e80)
  (num-test (+ 1.5 9223372036854775808.0) 9.2233720368547758095E18)
  (num-test (+ 1/1231234567891234567891 1/4) 1231234567891234567895/4924938271564938271564)
  (num-test (+ 1/2147483648 1/2147483647) 4294967295/4611686016279904256)
  (num-test (+ 1/3 (* 13835058055282163710 2/3)) 9223372036854775807) ; would be nice if this worked...
  (num-test (+ 1/65537 -1/65536) -1/4295032832)
  (num-test (+ 1/65537 -1/65538) 1/4295163906)
  (num-test (+ 1/65537 1/65536) 131073/4295032832)
  (num-test (+ 1/65537 1/65538) 131075/4295163906)
  (num-test (+ 1/9223372036854775807 1/9223372036854775806) 18446744073709551613/85070591730234615838173535747377725442)
  (num-test (+ 1/98947 2/97499 3/76847 4/61981 5/59981 6/66601) 56471455498794722585779775/183561983334767209753061626751) 
  (num-test (+ 1/98947 2/97499 3/76847 4/61981 5/59981) 599609438061905323469/2756144552405627689570151)
  (num-test (+ 10 9223372036854775800) 9223372036854775810)
  (num-test (+ 1000000000 1000000000 1000000000) 3000000000)
  (num-test (+ 1073741825 1073741825) 2147483650)
  (num-test (+ 1099511627775 9223372036854775807) 9223373136366403582)
  (num-test (+ 1180591620717411303424+i 1+1180591620717411303424i) 1.180591620717411303425E21+1.180591620717411303425E21i)
  (num-test (+ 1180591620717411303424.0+i 1+1180591620717411303424.0i) 1.180591620717411303425E21+1.180591620717411303425E21i)
  (num-test (+ 12345678901234567890+12345678901234567890i 12345678901234567890-12345678901234567890i) 2.469135780246913578E19)
  (num-test (+ 132120577/12 33292289/6 260046847/4) 244711424/3)
  (num-test (+ 18446744082299486212 1) 18446744082299486213)
  (num-test (+ 1e400 1e399) 1.1e400)
  (num-test (+ 2147483647 1) 2147483648)
  (num-test (+ 2147483647 2) 2147483649)
  (num-test (+ 2147483647 4611686018427387904) 4611686020574871551)
  (num-test (+ 2147483648 -1) 2147483647)
  (num-test (+ 2147483648 -2) 2147483646)
  (num-test (+ 2147483648 1) 2147483649)
  (num-test (+ 2147483648 4611686018427387904) 4611686020574871552)
  (num-test (+ 2147483648) 2147483648)
  (num-test (+ 2147483649 -1) 2147483648)
  (num-test (+ 2147483649 -4611686018427387904 -2147483649 4611686018427387904) 0)
  (num-test (+ 2147483649 4611686018427387904 2147483649 4611686018427387904) 9223372041149743106)
  (num-test (+ 2147483649 4611686018427387904) 4611686020574871553)
  (num-test (+ 3 9223372036854775807/4) 9223372036854775819/4) 
  (num-test (+ 3 9223372036854775808/4) 2305843009213693955)
  (num-test (+ 3/2 9223372036854775808.0) 9.2233720368547758095E18)
  (num-test (+ 3/4 9223372036854775807/4) 4611686018427387905/2)
  (num-test (+ 3/4 9223372036854775808) 36893488147419103235/4)
  (num-test (+ 4611686018427387904 -1) 4611686018427387903)
  (num-test (+ 4611686018427387904 -4611686018427387904) 0)
  (num-test (+ 4611686018427387904 1) 4611686018427387905) ; (expt 2 62) + 1 -- should work in both cases
  (num-test (+ 4611686018427387904 4611686018427387904) 9223372036854775808)
  (num-test (+ 4611686018427387904 4611686018427387906) 9223372036854775810)
  (num-test (+ 500009/500029 500057/500041 500083/500069) 375106759202738205/125034753009582041)
  (num-test (+ 8589934591 -4611686018427387904) -4611686009837453313)
  (num-test (+ 8589934591 4611686018427387904) 4611686027017322495)
  (num-test (+ 8589934592 4611686018427387904) 4611686027017322496)
  (num-test (+ 9223372036854775800 10) 9223372036854775810)
  (num-test (+ 9223372036854775807 -1) 9223372036854775806)
  (num-test (+ 9223372036854775807 1) 9223372036854775808)
  (num-test (+ 9223372036854775807 2) 9223372036854775809)
  (num-test (+ 9223372036854775807 9223372036854775807) 18446744073709551614)
  (num-test (+ 9223372036854775807/4 3) 9223372036854775819/4) 
  (num-test (+ 9223372036854775807/4 3/4 4611686018427387905/2) 4611686018427387905)
  (num-test (+ 9223372036854775807/4 3/4) 4611686018427387905/2)
  (num-test (+ 9223372036854775807/4 4611686018427387905/3) 46116860184273879041/12)
  (num-test (+ 9223372036854775808 -1) 9223372036854775807)
  (num-test (+ 9223372036854775808 -2) 9223372036854775806)
  (num-test (+ 9223372036854775808 1) 9223372036854775809)
  (num-test (+ 9223372036854775808 3/4) 36893488147419103235/4)
  (num-test (+ 9223372036854775808.0 3.4) 9.2233720368547758114E18)
  (num-test (+ 9223372036854775808.0+1.5i 3.4) 9.2233720368547758114E18+1.5i)
  (num-test (+ 9223372036854775808/4 3) 2305843009213693955)
  (num-test (+ 9223372036854775808/9223372036854775808) 1)
  (num-test (+ 9223372036854775809 -1) 9223372036854775808)
  (num-test (+ 9223372041149743106 -9223372041149743106) 0)
  (num-test (+ 9223372041149743106 9223372041149743106) 18446744082299486212) 
  (num-test (+ 98947 2/97499 76847 4/61981 5/59981) 63720106179329487759/362470312515139)
  
  (num-test (+ 576460752303423488 576460752303423488 576460752303423488 576460752303423488 
	       576460752303423488 576460752303423488 576460752303423488 576460752303423488 
	       576460752303423488 576460752303423488 576460752303423488 576460752303423488 
	       576460752303423488 576460752303423488 576460752303423488 576460752303423488)
	    9223372036854775808)
  (num-test (+ -576460752303423488 -576460752303423488 -576460752303423488 -576460752303423488 
	       -576460752303423488 -576460752303423488 -576460752303423488 -576460752303423488 
	       -576460752303423488 -576460752303423488 -576460752303423488 -576460752303423488 
	       -576460752303423488 -576460752303423488 -576460752303423488 -576460752303423488)
	    -9223372036854775808) ; this fits in both cases = -(expt 2 63)
  
  (num-test (+ 12766/44484 39852/43605 31122/19043 51508/63811 36845/41288 28101/14083 56682/37410 47892/22120 39412/22980 60124/55166 42856/59693) 208780620213964670464533749059169842219977/15202497819117370814835285951563379420520)
  (num-test (+ 63216/39382 57676/45091 53354/2630 1048/39076 16116/23210 42095/55806 27474/26658 50811/59328) 191349291372060004326881331664759/7211602793633848370218614932160)
  (num-test (+ 59885/27233 26245/45891 40482/5828 51990/36443 9623/46196) 34799310234648621493801/3065498111736131980788)
  (num-test (+ 37870/11132 60558/48391 53644/64989 60943/2780 9073/15664 15430/61388 55088/37713) 49618689694342545850764990997/1671112820517946923490092720)
  (num-test (+ 37890/11488 45896/14037 3589/36071 22835/41473 42331/17823 42800/56681) 420312190408065989902262231/40617147626636993628447504)
  (num-test (+ 26660/49395 52605/23369 30235/15203 37926/38348 54028/49472 32407/12923 20689/1984 27919/46263) 69930317632493223450434305725419/3428000885137780298513956804672)
  (num-test (+ 56351/21775 14958/21250 13859/32508 24968/65124 885/6861 3913/38588 90/55711 12269/37075 6579/33653) 201796703852921650643001395969752/41522567198031666874435508825625)
  (num-test (+ 8582/48034 27069/11031 29676/5507 56684/32514 25699/47391 44069/2704 18193/3289) 5684819414248430672302049/176897854654356635413328)
  (num-test (+ 421240/871225 1021193/39462 252094/592111 2478/11660) 32043461749854904862/1186809749708031735)
  (num-test (+ 149278/597089 747410/315908 218673/956214 174632/245649 45750/515909) 165277142441527691870266634/45353662154623612097256297)
  (num-test (+ 361087/1038423 629417/722796 693707/392139 237025/961767 88560/187279) 2426130069686588061565863289/654491499930590555724694236)
  (num-test (+ 94466/1038229 807503/592385 802950/953585 954630/176875) 6384533383241957925411/829875721759976907875)
  (num-test (+ 913461/774815 817965/788155 237677/532117 542827/225728 343160/431483) 2183257313717880748058258989/372346251755101707126455360)
  (num-test (+ 888429/600657 680124/108845 265059/727366 395224/748135) 20445657641208104518701/2371792747070499020510)
  (num-test (+ 37622/1698 9183/57409 12127/36899 11451/26597 64339/35514) 14092685195493114237067/566256574856769105474)
  (num-test (+ 24122/8583 41997/57541 42760/57555 40699/12923 30325/37640) 1518749441232333398909/184353450944764326984)
  (num-test (+ 16104/12728 32020/64625 35345/37481 29241/50823 13216/61075 11245/2022) 751811438787510154499/83010789184720173150)
  (num-test (+ 4312/48465 44171/56694 8599/3231 46048/62568 2132/45901 24407/26161) 455702434782048082459/86885567283849955830)
  (num-test (+ 59496/7030 37058/2679 2158/41193 48873/59329 52768/30853 34749/39139) 339576145632874325598832/13177075606485410552535)
  (num-test (+ 131/58542 41136/2572 43951/20070 63439/14560 33259/63731 10981/51495 49078/63698 10727/32805 29362/30842) 51962727546984124809096307414129847/2051626916225689647807786049306080)
  (num-test (+ 16640/40785 56062/38132 43843/29406 5867/50944 19248/58540) 1083456041462784832133/284138789764221200640)
  (num-test (+ 34314/54910 54195/13905 32762/15225 20808/42764 20977/59771 26320/20306 53116/23035 30385/31200 57396/3367 58378/6806 5724/29599) 39875514688522166158239445824103603/1051980164901898842922034228906400)
  (num-test (+ 40391/35273 27957/29448 52381/18500 60009/3366 27528/2124 62426/65445 43110/25891 40183/26944 30274/1504 27638/40611) 15253761502587455936752727098716743/251570544261187774378167518568000)
  (num-test (+ 52269/62857 21518/38958 29849/9192 27730/2604 20427/36068) 116322789710447328047/7340588373519969288)
  (num-test (+ 17009115185923538769 -12047631083067675031) 4961484102855863738)
  (num-test (+ 12677011568664239747 3269056182420253574) 15946067751084493321)
  (num-test (+ 9315504781982082433 13857624532376678678) 23173129314358761111)
  (num-test (+ 15226508728194069537 11481952022080775416) 26708460750274844953)
  (num-test (+ 7461641943684774743 12249026721402718630) 19710668665087493373)
  (num-test (+ 1180469445886971055 -3208456171287181032) -2027986725400209977)
  (num-test (+ 18358552990465743315 221529797579218180385160273426219343697) 221529797579218180403518826416685087012)
  (num-test (+ -14819874956616484359 30498815629431206969122152847973230849) 30498815629431206954302277891356746490)
  (num-test (+ -11781881800334342169 112219460388643619332860331282276228017) 112219460388643619321078449481941885848)
  (num-test (+ 3570694277032201957 284821691832196381859344006870088122712) 284821691832196381862914701147120324669)
  (num-test (+ -17005463295060938595 69162171850264911722979835561124066203) 69162171850264911705974372266063127608)
  (num-test (+ 15647113311796203488 150750467185419235519670165664526735459) 150750467185419235535317278976322938947)
  (num-test (+ -14330150541101371097 -13054027994001826312503071338715966858478218093171762021549815587520723118772963817341751396703629529810372702877555022105594068768886421335353882155416908) -13054027994001826312503071338715966858478218093171762021549815587520723118772963817341751396703629529810372702877555022105594068768886435665504423256788005)
  (num-test (+ 7406427184711759740 -4059250217961011548005203450962458026528281798230141192186669580689721046971433745892994467792118611646113962840750314719233572760336084100766391093756252) -4059250217961011548005203450962458026528281798230141192186669580689721046971433745892994467792118611646113962840750314719233572760336076694339206381996512)
  (num-test (+ 8819522415901031498 7274905269237471130619913887005155660991437201841760414347836177003483932007334374478344594178179032728521106519295465031750530183363793325150672647162846) 7274905269237471130619913887005155660991437201841760414347836177003483932007334374478344594178179032728521106519295465031750530183363802144673088548194344)
  (num-test (+ -7242932332215698200 -10558564312909325527488520195600871241245891651644550509993750377630234801225525279855157008009255586978047154906058790342845859331159009687703010657137320) -10558564312909325527488520195600871241245891651644550509993750377630234801225525279855157008009255586978047154906058790342845859331159016930635342872835520)
  (num-test (+ 9794320575955609492 13380937715397052566925484435342184213544885758759259410983243841206628594840271850190097746775475837233042430565529099681550277688470325394342993771343357) 13380937715397052566925484435342184213544885758759259410983243841206628594840271850190097746775475837233042430565529099681550277688470335188663569726952849)
  (num-test (+ -18404048401680891243 6690884608978704096379677348142836785900717005050936986370615083929607190833180925295418079551348559691161519822750772440155040888224482801864925665484770) 6690884608978704096379677348142836785900717005050936986370615083929607190833180925295418079551348559691161519822750772440155040888224464397816523984593527)
  (num-test (+ -10763220363947284865 -30985722824355332972176356513316569304601382411274079243859710673739383446566598659878378034375348869471278415635671865753349734809209959160389615096293457362383744562507969316522225741589739150453090393424063226271167062127000223628785686999799282795143706407082119829140399988180879618548495395684946331608899565543458192773899200054228140747414544792128323269250618482622488195333106891323515989863192944848391405358725993695671970811097285270641251816244586360288952156538400321933146150313939864593445583603568771077260174826348411367609521412133720180359748539721570562669201065857989876521301209899829037444385) -30985722824355332972176356513316569304601382411274079243859710673739383446566598659878378034375348869471278415635671865753349734809209959160389615096293457362383744562507969316522225741589739150453090393424063226271167062127000223628785686999799282795143706407082119829140399988180879618548495395684946331608899565543458192773899200054228140747414544792128323269250618482622488195333106891323515989863192944848391405358725993695671970811097285270641251816244586360288952156538400321933146150313939864593445583603568771077260174826348411367609521412133720180359748539721570562669201065857989876521311973120192984729250)
  (num-test (+ -12742462236537568498 8711131313747826394504271797986775572294949693272674156076339989631171694968899228610359983845552623710580616605402899155485071497929100432998183040757832449369366844015907530612334721882095163137705867337969942902346066961718232788529860214990099385213558935023241940238638069647809530490438245386869385682221280939688108487754251075630026707075310465788398213293782900699868609660892232563106662995330591906155134237356516622436517046191466823447743155250482328613449506396571170001248589926831956459700467126756876526930443317428628239358666456771112897986098390410773312792390699312960051747534683311506465130527) 8711131313747826394504271797986775572294949693272674156076339989631171694968899228610359983845552623710580616605402899155485071497929100432998183040757832449369366844015907530612334721882095163137705867337969942902346066961718232788529860214990099385213558935023241940238638069647809530490438245386869385682221280939688108487754251075630026707075310465788398213293782900699868609660892232563106662995330591906155134237356516622436517046191466823447743155250482328613449506396571170001248589926831956459700467126756876526930443317428628239358666456771112897986098390410773312792390699312960051747521940849269927562029)
  (num-test (+ 9991390529516174614 7879872958436992955898278403297937595295396115022400543178444946646147916754852888072481665174663073269556311758611700754643170639645548596647557683044355930340624784190093631808382820554407595007761070026239341594197877214157118335743842022627898879376346092898666610367809537340994845045475091410516226225078052019727419030585524815982151736622865401299588936172760762386183577504972623377661437665668080131418564228642443266935225613702941906491478788336262289516199380144218708241406077806669686589734333554945412904560108150202389909124657090061223183441083590340175629756198442568877659538345749595968764873879) 7879872958436992955898278403297937595295396115022400543178444946646147916754852888072481665174663073269556311758611700754643170639645548596647557683044355930340624784190093631808382820554407595007761070026239341594197877214157118335743842022627898879376346092898666610367809537340994845045475091410516226225078052019727419030585524815982151736622865401299588936172760762386183577504972623377661437665668080131418564228642443266935225613702941906491478788336262289516199380144218708241406077806669686589734333554945412904560108150202389909124657090061223183441083590340175629756198442568877659538355740986498281048493)
  (num-test (+ 831234034418847630 -744676478858160349467117341859049692149463503380690495147216354303526704924280287782902146026018180364963325847811379182950159627878800024734206345960410146056000392683000433501805629464626281031086102425271022388473812300724085127447081771317912465921636737545371909901577246384446144919253141375367648958387948463576516115079816552636772639965957498569187848459747361493535081532845254971492261148968198806736512864867151355002902241562014241077734122599581732704243705918200179789271894804233542502502119523149682814025979598424744685548054183678652651244898867735764030968089217841214778606507809487462642341164) -744676478858160349467117341859049692149463503380690495147216354303526704924280287782902146026018180364963325847811379182950159627878800024734206345960410146056000392683000433501805629464626281031086102425271022388473812300724085127447081771317912465921636737545371909901577246384446144919253141375367648958387948463576516115079816552636772639965957498569187848459747361493535081532845254971492261148968198806736512864867151355002902241562014241077734122599581732704243705918200179789271894804233542502502119523149682814025979598424744685548054183678652651244898867735764030968089217841214778606506978253428223493534)
  (num-test (+ -6996572501442843347 -16567158719848992553565776505785820491834685475229611199353714982570065913508303466008005931649515528390057456882757990896824841386431756898386429000065518724021230756426613661219891419166146764347562529640689229693578574350948436847247856000438153789455857903402883189892697143647998643667467614427922009931545254965075041050860609824086811877108940020349157317276288348430058535959434983921323332907180869396258655826781438419383792024592535415693101119109484610789291889841197827977530804650015884500878613240443324806805475203272442094530735476095374446946252236490708915034012846683015547314889561060687692538144) -16567158719848992553565776505785820491834685475229611199353714982570065913508303466008005931649515528390057456882757990896824841386431756898386429000065518724021230756426613661219891419166146764347562529640689229693578574350948436847247856000438153789455857903402883189892697143647998643667467614427922009931545254965075041050860609824086811877108940020349157317276288348430058535959434983921323332907180869396258655826781438419383792024592535415693101119109484610789291889841197827977530804650015884500878613240443324806805475203272442094530735476095374446946252236490708915034012846683015547314896557633189135381491)
  (num-test (+ -8920936222630165483 -18738991973681679876688842391791783563249057933653045519186959571392922172943405646958686202208790537612746921398028331540617848217445632123805070077600768524509025758950743971128222843292926773668584735575066246660802064630842300367821042873152766467703905048558085377302000898639290554395913805527529259855535801856020623830262396582180677933562523957295341539162448074423901242873918231922121053192425691524797238343327318801359521456598967984637483081312932069399045363737622797213185099130529375169698811801965974416555301085043300426947769193582129151016159057101028336667142913854943018973494705119572045938607) -18738991973681679876688842391791783563249057933653045519186959571392922172943405646958686202208790537612746921398028331540617848217445632123805070077600768524509025758950743971128222843292926773668584735575066246660802064630842300367821042873152766467703905048558085377302000898639290554395913805527529259855535801856020623830262396582180677933562523957295341539162448074423901242873918231922121053192425691524797238343327318801359521456598967984637483081312932069399045363737622797213185099130529375169698811801965974416555301085043300426947769193582129151016159057101028336667142913854943018973503626055794676104090)
  (num-test (+ -243510292488206214847646757340020705642 5940577100149745132) -243510292488206214841706180239870960510)
  (num-test (+ 35446324064743728955945058978206455057 -6248622708755929572) 35446324064743728949696436269450525485)
  (num-test (+ -285342226760657637664173494795024413673 -11942737781617905307) -285342226760657637676116232576642318980)
  (num-test (+ 180790435817422032042321866247362452865 12401641959336396832) 180790435817422032054723508206698849697)
  (num-test (+ -179994871947239535956826388240542999950 13573822506399140772) -179994871947239535943252565734143859178)
  (num-test (+ -308198027295905163635866438671452347268 -8790069282378476990) -308198027295905163644656507953830824258)
  (num-test (+ -139324757925833055762410227358605285566 -190622873846936719063564661032771271922) -329947631772769774825974888391376557488)
  (num-test (+ 332866352618304570046318203427223999347 147978646177673305481282943528696833018) 480844998795977875527601146955920832365)
  (num-test (+ -39471620476300923970352914034802271156 28992893610776120142668950821916856486) -10478726865524803827683963212885414670)
  (num-test (+ 274120253734611965146455315763505869288 254675910805265090692978775702306142625) 528796164539877055839434091465812011913)
  (num-test (+ -122086811464559635596206661886176775901 287312583034687582188356355813963609701) 165225771570127946592149693927786833800)
  (num-test (+ 288576174771266329955482943556556984728 -57843540651903655425270706396868707777) 230732634119362674530212237159688276951)
  (num-test (+ -47977736580820486006305788441965482221 984809271313988066640898939725532304075331399066274624928410251834520283291912387208948664716457549646483445981126881113426109906085249657168046936670489) 984809271313988066640898939725532304075331399066274624928410251834520283291912387208948664716457549646483445981126833135689529085599243351379604971188268)
  (num-test (+ 21225484205143479814642328762121362291 11839789093732539327981861490012713257538550745921177905266671749716203131127256902110452504526721633943016923389974867770082516862899595554460170417713940) 11839789093732539327981861490012713257538550745921177905266671749716203131127256902110452504526721633943016923389974888995566722006379410196788932539076231)
  (num-test (+ -193095363331703875886398909106293703000 4389392021031719669078675478621418677903292147307684123866099084349756491860737402449105804868232530632178577388168068485304437343508442251302846768269976) 4389392021031719669078675478621418677903292147307684123866099084349756491860737402449105804868232530632178577388167875389941105639632555852393740474566976)
  (num-test (+ -14827657635864183514988182371035598180 -7256545787852407071411458891023580461638051949278710509801472046178301830006724297747051044450550248499056073213660185258676369175307019300952192657194576) -7256545787852407071411458891023580461638051949278710509801472046178301830006724297747051044450550248499056073213660200086334005039490534289134563692792756)
  (num-test (+ 54301423175725658626298504084995819705 -13385853291610595576947504757201441006088030688464261540642594993520424631577281077984278942244446266776534612440941312995898184903431893212829646845766101) -13385853291610595576947504757201441006088030688464261540642594993520424631577281077984278942244446266776534612440941258694475009177773266914325561849946396)
  (num-test (+ 195114404067053480147948948510253723990 -8373866462448797623435948949281383906369538962237624940506813188612614128993186653340202956656303504523161255703176374041758276069255591562198514767063594) -8373866462448797623435948949281383906369538962237624940506813188612614128993186653340202956656303504523161255703176178927354209015775443613250004513339604)
  (num-test (+ -308030589512186791277525017840002670741 -11922204352024596469278978325035646517433105521287613403902396944414655739824695945028308092245747333098422116078042326104667969967224788442970266049942774583538734406057081597034454910987815490244451193242377705191422489528853976486607580169986057592557285271953385769215318545520155212402919465580052078255078759756709086185424029620805084776442744700501748376290562843380642608395240491162047933014854466267084965223593172702334466729933986413870670083326499598274393380692146118979961818816348097032083332695128587696590646086980241100792624502607816103195636761141133903550454815591457829485684936036414823492160) -11922204352024596469278978325035646517433105521287613403902396944414655739824695945028308092245747333098422116078042326104667969967224788442970266049942774583538734406057081597034454910987815490244451193242377705191422489528853976486607580169986057592557285271953385769215318545520155212402919465580052078255078759756709086185424029620805084776442744700501748376290562843380642608395240491162047933014854466267084965223593172702334466729933986413870670083326499598274393380692146118979961818816348097032083332695128587696590646086980241100792624502607816103195636761141133903550762846180970016276962461054254826162901)
  (num-test (+ -172649878347923210775992373331623646864 22180935775581457002090790736532281654456312526625354262953960635330604551829750571440878712430708012807252279301365732385899228826740712544768476577874129759972563823209525283326887563301081200476495752033290851190327066070873711444930389093339915885090143783170994309089448293499799071372787520776773788274677288230540162485916160484352398851925328125588729604931589867889917097887951581817207079060016091919559509735997493084833476849835444339835031436580214492450731100723026312163752403946315983551266206214298679421644737804098691991631489261658890937663698502561036246447760919715595005106669653475931803053499) 22180935775581457002090790736532281654456312526625354262953960635330604551829750571440878712430708012807252279301365732385899228826740712544768476577874129759972563823209525283326887563301081200476495752033290851190327066070873711444930389093339915885090143783170994309089448293499799071372787520776773788274677288230540162485916160484352398851925328125588729604931589867889917097887951581817207079060016091919559509735997493084833476849835444339835031436580214492450731100723026312163752403946315983551266206214298679421644737804098691991631489261658890937663698502561036246447588269837247081895893661102600179406635)
  (num-test (+ 17539006966816771902104329685391462527 15609797782337099611892065465036826453911053690739041627254619195700021040383385710184052653282070244915503750549545390475671883312314708978681904377133928647935359080875691628246716591529028104762422990155477702994042953196747769893182153631482194578269859879402160062955490194674372351117284129320011166238130774752386987036267064693133554447596069886693581191241594745541512444806003236372840085705813835001957163976961730871756250344335996073970142337882238844723800849054637237549515249957267772181010402413375667537558243971058326641257721901094391380667244006959028327507917720426571969997513984360849930719808) 15609797782337099611892065465036826453911053690739041627254619195700021040383385710184052653282070244915503750549545390475671883312314708978681904377133928647935359080875691628246716591529028104762422990155477702994042953196747769893182153631482194578269859879402160062955490194674372351117284129320011166238130774752386987036267064693133554447596069886693581191241594745541512444806003236372840085705813835001957163976961730871756250344335996073970142337882238844723800849054637237549515249957267772181010402413375667537558243971058326641257721901094391380667244006959028327507935259433538786769416088690535322182335)
  (num-test (+ 244901855797156286376563377540855746602 -22138106346578776369849317622304392466030036563754663379976505966920461958652141160336156065177498990718609170201272980114106671808245437660234479124938853665375934080221740523696180221118540569603989748587853373569525751680828044059607889572522502629277877343410298879764820905044284757389006201848194571453112545228115550224254565141563427486518108434758694923122284117299374156393942906293546318323661938734959824887786185558612820887463537294120950912969343488704744978847504513710882720654330147775174336365363311173472002077960424794151168301281665765411704505095008907760396535767621855642720080219960822554492) -22138106346578776369849317622304392466030036563754663379976505966920461958652141160336156065177498990718609170201272980114106671808245437660234479124938853665375934080221740523696180221118540569603989748587853373569525751680828044059607889572522502629277877343410298879764820905044284757389006201848194571453112545228115550224254565141563427486518108434758694923122284117299374156393942906293546318323661938734959824887786185558612820887463537294120950912969343488704744978847504513710882720654330147775174336365363311173472002077960424794151168301281665765411704505095008907760151633911824699356343516842419966807890)
  (num-test (+ -119403662992279138748600939857239307122 26272999248235953724172008428088697264933069743507017434844709711501131900922919455931092196539942532993887162365511473221418376205773427597933886270411672062672089518774390132453916538404354895529975888201032175628249480896964400801763570333497287321002961557096975786141940970260074557095118887294558700145949117395512768347250531196100831164663613049206690894640391431616112104502483838173255614981302462548882276825096564828583591963617871547373532874400764134244496979962241959713525053686209002866840900623246072884125102845824992994967009109046451949348656842486048332953732384499190437432898387573320391878853) 26272999248235953724172008428088697264933069743507017434844709711501131900922919455931092196539942532993887162365511473221418376205773427597933886270411672062672089518774390132453916538404354895529975888201032175628249480896964400801763570333497287321002961557096975786141940970260074557095118887294558700145949117395512768347250531196100831164663613049206690894640391431616112104502483838173255614981302462548882276825096564828583591963617871547373532874400764134244496979962241959713525053686209002866840900623246072884125102845824992994967009109046451949348656842486048332953612980836198158294149786633463152571731)
  (num-test (+ 313963939617834410089002930298454269912 23286645405607099799151331553995799851855144387826191186590140820016670502830395945076644578998873585162998873396623634135231418574284200209367505115739462344028303923666952261030907434438322884189133236837089851688275865098623902644385995630973049587854251981548128145516004461191094062488421288607625783540996659060285661398859383778209495884203323937672739376151794507745282074538961033778823733980759695886879886017489555795079194346438911010371103435094677167286870898482214310646392174423422237727456012197253183422715313378603607058548706460095379882633958651034759773864354021315490712575535559549015858088608) 23286645405607099799151331553995799851855144387826191186590140820016670502830395945076644578998873585162998873396623634135231418574284200209367505115739462344028303923666952261030907434438322884189133236837089851688275865098623902644385995630973049587854251981548128145516004461191094062488421288607625783540996659060285661398859383778209495884203323937672739376151794507745282074538961033778823733980759695886879886017489555795079194346438911010371103435094677167286870898482214310646392174423422237727456012197253183422715313378603607058548706460095379882633958651034759773864667985255108546985624562479314312358520)
  (num-test (+ 2000877973959266893810594143560134441447453310844726478119781029700338468704683515329516333146806175216349912753585564808803731447160643580198590073658869 -17993015014355471903) 2000877973959266893810594143560134441447453310844726478119781029700338468704683515329516333146806175216349912753585564808803731447160625587183575718186966)
  (num-test (+ 5492930533666246223206322654398877802091439062008700770880939594548305919677404080859141226095489505872709347538974725998600861651942609010590873980143878 15372278140141207703) 5492930533666246223206322654398877802091439062008700770880939594548305919677404080859141226095489505872709347538974725998600861651942624382869014121351581)
  (num-test (+ -13405500833215428652808705089190188280715732437731292502890523313631564795139560159124390691283401484515088713758307366404145018349044148223082253439210893 -14793401891248640808) -13405500833215428652808705089190188280715732437731292502890523313631564795139560159124390691283401484515088713758307366404145018349044163016484144687851701)
  (num-test (+ 9945195259699924701593703207751086973468898794114625092150620088406276196469184233537941913755508476427888065765634203723512911676149274871082481174186606 8699133332160461067) 9945195259699924701593703207751086973468898794114625092150620088406276196469184233537941913755508476427888065765634203723512911676149283570215813334647673)
  (num-test (+ -1785165974800693006461065312083337532938610906605533088558498259067461510781028452552786542598361030690629530721209490413999022804146471920873844686294838 -13079925952361275418) -1785165974800693006461065312083337532938610906605533088558498259067461510781028452552786542598361030690629530721209490413999022804146485000799797047570256)
  (num-test (+ -4861207515430071951958387366611380234482792653010151054346367776006873932152600469133110239669746470475230906073865131648496652783311445471793936775767736 -9381557743227419896) -4861207515430071951958387366611380234482792653010151054346367776006873932152600469133110239669746470475230906073865131648496652783311454853351680003187632)
  (num-test (+ -6638723469626495957966112633999375479181736600737250559572415894485618850919815869703127084789143821420728194272094956858541960962483734293877093635361160 277811698220276334443479876776376776138) -6638723469626495957966112633999375479181736600737250559572415894485618850919815869703127084789143821420728194272094679046843740686149290814000317258585022)
  (num-test (+ 1983880417172931934469534542170437296262471214582817006917470485544552211448284732460451903536334682269123998240709059499894818265755197559390728940140016 -118940994129137705779355371753506018694) 1983880417172931934469534542170437296262471214582817006917470485544552211448284732460451903536334682269123998240708940558900689128049418204018975434121322)
  (num-test (+ -9354509264984586574958285335910611806441061705184818350015454221731287473282231343722010109181841005578131927454778025302197744540571159656556971614966757 120224841184491944160266976391113485817) -9354509264984586574958285335910611806441061705184818350015454221731287473282231343722010109181841005578131927454777905077356560048626999389580580501480940)
  (num-test (+ 4389359421234641412950681847970318834150108533025088077429496538447029921663033978550089607257809597829358374972237448178553189381274150213236222139873594 106674783386899772113212633712093787897) 4389359421234641412950681847970318834150108533025088077429496538447029921663033978550089607257809597829358374972237554853336576281046263425869934233661491)
  (num-test (+ -9319417879153488839579936799737117639058244394679644240663244688680826325564084529474537634510092069422987165268448907193562300482925125162731530249763801 192969103435503875767216559494769734726) -9319417879153488839579936799737117639058244394679644240663244688680826325564084529474537634510092069422987165268448714224458864979049357946172035480029075)
  (num-test (+ 1394404616168163951844558734723678125985464491792846741433683801962971891047718103736551854371207400145441134823994228143957746922511631911996296931168332 -211230038021470285136061932161632203274) 1394404616168163951844558734723678125985464491792846741433683801962971891047718103736551854371207400145441134823994016913919725452226495850064135298965058)
  (num-test (+ -2935941510094051560788359387128767361559188973149773593522440619832472030019457317998381634585179453958737810428870232715146002408187749944694186205812791 -1221176156661231926164756142840452419679061324806989304452215660535991083923207702827717652226257158321829748247784282139952864899457896871473184473608543) -4157117666755283486953115529969219781238250297956762897974656280368463113942665020826099286811436612280567558676654514855098867307645646816167370679421334)
  (num-test (+ -1338674579024795395027232680327531457830908239605718353094975139226848400289367913459076082700361212506196070727982446232782659114647371030398516119682505 -1298372177520411182435886041880377054374169787570856408996533471838082317927648953576721017727347029007573543972764860712708420553928791798580799809858729) -2637046756545206577463118722207908512205078027176574762091508611064930718217016867035797100427708241513769614700747306945491079668576162828979315929541234)
  (num-test (+ -2072456075229532951804023218627137969798924912365258263779029006567941400203608770518731715660383378937120213112973528605594220795605977413985543331908189 -9744489461776287963808523409593616918248399004543154581056479712028497082820841423941781438667661074968238703192056877665754560746003512076830245760254982) -11816945537005820915612546628220754888047323916908412844835508718596438483024450194460513154328044453905358916305030406271348781541609489490815789092163171)
  (num-test (+ -2570682164188734368809161664810917340861573482754788446510182252413437925852206735928397938304353826925422441004271229738766803460790995673395984247950088 656920705293329551826685120408221577679101260931105312141757138825917579070505267306626244216341686712802796891966598838285570807961966448181138356047523) -1913761458895404816982476544402695763182472221823683134368425113587520346781701468621771694088012140212619644112304630900481232652829029225214845891902565)
  (num-test (+ 7846359203342053693101523606887617345982401999003795257520576318451663998927274759872692123323796450295314377046602880394071105863527900699633560551732837 3683380639347829102597675045842249667669675715600522157867595962635108482512780509393310714588544837398923613138772339053021025559943198965234376657126821) 11529739842689882795699198652729867013652077714604317415388172281086772481440055269266002837912341287694237990185375219447092131423471099664867937208859658)
  (num-test (+ -11692323148567132684205145901751681947225824260005631214936266006610207543813382900867093989444659986091234552140689684476541703112098935301322850961583953 -8534276689564199122569555420819240948691777228327984555753862457592427992599992931175844172478864477440165366128106812103785256271256853749622592560655914) -20226599838131331806774701322570922895917601488333615770690128464202635536413375832042938161923524463531399918268796496580326959383355789050945443522239867)
  (num-test (+ -10734754884168724884333968138739681643742524619139397687680049322697740991391014196697040576174049452737571835233123127815762146577096625434481167057340772 17059878151450238567815178684522345445687980385106446646013863901583786249398194029757376950491550197185231926262467028755342392379269039238766592672298850588065335172902157386017520689203005559576263548017475991638498600879259882041932152385436968424098224966518534467302264172016376096778201462205990822825056602379115848799619564610033123837036507127427054121975400703490855123544706355545059512146550901507159940126280812512339749605195422987937677650572797378799103456094203126081464905326203083057134061673694975250599375795827437561275156235513192978645909947341297774926450637694325145427434486258223666250272) 17059878151450238567815178684522345445687980385106446646013863901583786249398194029757376950491550197185231926262467028755342392379269039238766592672298850588065335172902157386017520689203005559576263548017475991638498600879259882041932152385436968424098224966518534467302264172016376096778201462205990822825056602379115848799619564610033123837036507127427054121975400703490855123544706355545059512146550901507159940126280812512339749605195422987937677650572797368064348571925478241747496766586521439314609442534297287570550053098086446170260959538472616804596457209769462541803322821932178568330809051777056608909500)
  (num-test (+ 1982582032974021971225071139786536402936929744496433027195224299475980201425925452469321205602618940472354066218156609448199804973454183972974358405933935 -5591374624026484498020036332218412149978824230210339582240360391202660977358546150723165491729699122647688030937226316069237264083850854032732663284717882873051337566653841254365703461654061656817936193716386141166210237666314879751427421825450110467888973152907618520704486700443275358649289847595635931220181024199692771066498714511145489237541761266539978351840438236927937894376002981658065431416811632941197501676956304254109064936038146674412392128883565757325842468006824235119684861972224857533964558963441079998949499582965764591461900562931342373507763081479989957632695010603500633322408246084430203281475) -5591374624026484498020036332218412149978824230210339582240360391202660977358546150723165491729699122647688030937226316069237264083850854032732663284717882873051337566653841254365703461654061656817936193716386141166210237666314879751427421825450110467888973152907618520704486700443275358649289847595635931220181024199692771066498714511145489237541761266539978351840438236927937894376002981658065431416811632941197501676956304254109064936038146674412392128883565755343260435032802263894613722185688454597034814467008052803725200106985563165536448093610136770888822609125923739476085562403695659868224273110071797347540)
  (num-test (+ 11532228364136654310006206557545352284448588590560137249197311142901246089838098630841794341370689745410654263817911440601934362503092628725755210859171724 -25776236925500995542036591604259749301547568770017466769502569415611770276300787105037848049555500555975152877716727294374436703766730618054071617947449695177320842403963009384468257891933593584757723535299746543328292715942626303315235241470269740287031317322772461137186093930239744879822272349431389779234805703118929710210161489122272898252221025966631463842234537744822906696719691188223105175714602909117904182229960075276443648211003011686250829474364425483901920822837775032295913486152631638908227467242772081310515646217115760180349854601959031626524004201825198439309850266508687796415478396821644422350208) -25776236925500995542036591604259749301547568770017466769502569415611770276300787105037848049555500555975152877716727294374436703766730618054071617947449695177320842403963009384468257891933593584757723535299746543328292715942626303315235241470269740287031317322772461137186093930239744879822272349431389779234805703118929710210161489122272898252221025966631463842234537744822906696719691188223105175714602909117904182229960075276443648211003011686250829474364425472369692458701120722289706928607279354459638876682634832113204503315869670342251223760164690255834258791170934621398409664574325293322849671066433563178484)
  (num-test (+ -2603756427337798371354526130541868239006085657393372011847827118826669474695402075575479286172808099892726251004549675772420422527946534088483901153485670 -10844269742362409682236511127219508926736627172993604953084481596070757241623728297275447608738915355190715664012379562650777199088096670239050254578284071100042116609747208178716191571268815994455064584659920497876052406993834873124981417288518101426395560764186717660091472734401090302285129741058888303693710456902635092811413971399734306158050053239768185860958896447298052082493590498954512083131068867270078638929796561440903919430094619437872896595720463663570751134804664228918188923926951933302878771189484614604311920655871182974081898031051411394311700207305532216445616083858025977851570522763537300875989) -10844269742362409682236511127219508926736627172993604953084481596070757241623728297275447608738915355190715664012379562650777199088096670239050254578284071100042116609747208178716191571268815994455064584659920497876052406993834873124981417288518101426395560764186717660091472734401090302285129741058888303693710456902635092811413971399734306158050053239768185860958896447298052082493590498954512083131068867270078638929796561440903919430094619437872896595720463666174507562142462600272715054468820172308964428582856626452139039482540657669483973606530697567119800100031783220995291856278448505798104611247438454361659)
  (num-test (+ -5929887196386997518766568868806997104240129372360669348628384183712406620199102166145939206783172815805659513128544493795329100599632286529420772709366102 24544958491142793859949310604465694574872439331169358241746200808802938771527900616394258199996170862256988647191747967628756772368808644819831481350919782560499270148419601775750932556119448001824346026042068416905254113155445053931789404515589532235225580737103411251232560863878948880220469490014568323308965914171394449781093816607870593225534700167342589927524232815571862258490314644577819742372918446373756857848586825568514909823940075182825283229026250682015641747568282510036326125505522447591703308661608718100933027549520132308555240654655887041040427813131621391320267698106519650611462269033902177180035) 24544958491142793859949310604465694574872439331169358241746200808802938771527900616394258199996170862256988647191747967628756772368808644819831481350919782560499270148419601775750932556119448001824346026042068416905254113155445053931789404515589532235225580737103411251232560863878948880220469490014568323308965914171394449781093816607870593225534700167342589927524232815571862258490314644577819742372918446373756857848586825568514909823940075182825283229026250676085754551181284991269757256698525343351573936300939369472548843837113512109453074508716680257867612007472108262775773902777419050979175739613129467813933)
  (num-test (+ -8848084327536592532063677611386811805244460767433749071435930786126721080365289638381557872263825830664387392539638767251180242665642373539064690745095464 -15917950175678012281826361248776190984758236997789474333609547749168308439513527143790323694526378056113636462939674273462177686456811495629631337058042159570336251822399402513133598701991665209363955263097315081570618652783181494594400709239428597117944511110842795526862595552977665064029517628515465251448116061875878430407784298951946811321795808932206846491091803276390661869369638950672478828532423383951689632136029256108992610781912267083149156104328033893238864631158195280554850035949666897861529711006187241710164902350100555999894332438423857208747342184052953230247487231455921360593096823760117493579248) -15917950175678012281826361248776190984758236997789474333609547749168308439513527143790323694526378056113636462939674273462177686456811495629631337058042159570336251822399402513133598701991665209363955263097315081570618652783181494594400709239428597117944511110842795526862595552977665064029517628515465251448116061875878430407784298951946811321795808932206846491091803276390661869369638950672478828532423383951689632136029256108992610781912267083149156104328033902086948958694787812618527647336478703105990478439936313146095688476821636365183970819981729472573172848440345769886254482636164026235470362824808238674712)
  (num-test (+ -16314775600714318471451792035636584056297958597339492996728118376578145765736873313518831390349547274517050864260054903974054712997529177834428786007341762649083404743713562157667828894017440065599882523458121037421757904691003094608420565550031561905074671735751685371533975894842331113347413787808917193134135744321547478500861021485075363990553639161661734684228250909589741380076008551020384304303171431833670236949934603973673998262066558668396388979463892768199916011368116729432353268535563246463324517035331079693172060671712718486388759443825620676228470068291448236914050793177812037679396721657020438979754 12553426083939460917) -16314775600714318471451792035636584056297958597339492996728118376578145765736873313518831390349547274517050864260054903974054712997529177834428786007341762649083404743713562157667828894017440065599882523458121037421757904691003094608420565550031561905074671735751685371533975894842331113347413787808917193134135744321547478500861021485075363990553639161661734684228250909589741380076008551020384304303171431833670236949934603973673998262066558668396388979463892768199916011368116729432353268535563246463324517035331079693172060671712718486388759443825620676228470068291448236914050793177812037679384168230936499518837)
  (num-test (+ 20637030084881771176788188367974505419050866216433677435050410899110162793040751338330447574748263391136356400036001988938659722098883893353523409458775455519257672423829361150611806294256710309281788819450225670112435352092313483086404714074567539245791066202051788986426960935796927738180831688497683293306590464598379493141645539253898709000874685535467854788184424886911457134522632486730390913239660179785071885982403741669161655812015114272497907946919026898579927936299607156006210124954460880383605958519412435713868501997649784658832599101777001703519408664662715322044086646014163774269660274683400619225321 11620128128044940816) 20637030084881771176788188367974505419050866216433677435050410899110162793040751338330447574748263391136356400036001988938659722098883893353523409458775455519257672423829361150611806294256710309281788819450225670112435352092313483086404714074567539245791066202051788986426960935796927738180831688497683293306590464598379493141645539253898709000874685535467854788184424886911457134522632486730390913239660179785071885982403741669161655812015114272497907946919026898579927936299607156006210124954460880383605958519412435713868501997649784658832599101777001703519408664662715322044086646014163774269671894811528664166137)
  (num-test (+ -9838804688358141062268493389453191808060717708062736103828856866310283812230958467655270667206937622979717683919584610288962829724022506216738929136418489468786902364550847498615864720240589837282441807174290461916292258263929411081218952357662703079709351365960916688275651864441386750529258343003652300629003597744958152243494244227986280506395347894285277364095898602965258114321853474000520432831298793365139040664543928707100657375292032051256485942532600998813627925626928634068613637417702688610315924917761411247617905738119218110678854564441914784262998574445847209847985439514580300936248281049628734475702 2380166482232871816) -9838804688358141062268493389453191808060717708062736103828856866310283812230958467655270667206937622979717683919584610288962829724022506216738929136418489468786902364550847498615864720240589837282441807174290461916292258263929411081218952357662703079709351365960916688275651864441386750529258343003652300629003597744958152243494244227986280506395347894285277364095898602965258114321853474000520432831298793365139040664543928707100657375292032051256485942532600998813627925626928634068613637417702688610315924917761411247617905738119218110678854564441914784262998574445847209847985439514580300936245900883146501603886)
  (num-test (+ -30961575335426221869515496362216292453766907587859856766456625722888557357647164641922707199324601608700561081422636642523431947551124957385652791834855425829101761914145137205962610515642614866296480715893528289170482422505734612327038754622917335073993027434927547277037587173529054849390646376806910407207016292483185533697336599641898250465186168797820802225861771331652801064811222606773495565340386327294310913503461903243119204619412324538886439122443769008953829820425376589389335553937319588224864611583436327810214798652896733118881040503785110481197462772022447173744898802421806800203373153221004361953729 -10586442965055062759) -30961575335426221869515496362216292453766907587859856766456625722888557357647164641922707199324601608700561081422636642523431947551124957385652791834855425829101761914145137205962610515642614866296480715893528289170482422505734612327038754622917335073993027434927547277037587173529054849390646376806910407207016292483185533697336599641898250465186168797820802225861771331652801064811222606773495565340386327294310913503461903243119204619412324538886439122443769008953829820425376589389335553937319588224864611583436327810214798652896733118881040503785110481197462772022447173744898802421806800203383739663969417016488)
  (num-test (+ 8835746018617511846981408800319983340292665114153404569022025834059427359831684523399830234196625160662387716033871154398104436720494608541518837969397374272734698261557358249258503982414578618525420572597611597792132117034895074841909295420434392963714805547538976612884853497014341345150095544449860198192757839489063747595073430612069212219930749783824683135433987509303139260133564905961552149844964215891730262218278214035649706577154652729844092199333026620127958228847111442161350881527928460177763370427262298116900358910460957772350452949782281117704005514462730290063772968929608448642592954601418753021512 -12227722924075527556) 8835746018617511846981408800319983340292665114153404569022025834059427359831684523399830234196625160662387716033871154398104436720494608541518837969397374272734698261557358249258503982414578618525420572597611597792132117034895074841909295420434392963714805547538976612884853497014341345150095544449860198192757839489063747595073430612069212219930749783824683135433987509303139260133564905961552149844964215891730262218278214035649706577154652729844092199333026620127958228847111442161350881527928460177763370427262298116900358910460957772350452949782281117704005514462730290063772968929608448642580726878494677493956)
  (num-test (+ -5455184800550144006991157215735481579353213544152145628297990102571936052187486515129266239245491863623978659179559754999567936067584384479787934704340911556625153536160778495579370425428019248950494107696016864499055854257192071541354806671987402367524770228296322497224645429524493838356022616251290117624472061673033274133156467148770562815676767117605001434288573911556053311048284534341905722947046607192815465807736361991479044698448267471087552952494477144251510778491315012457514838113324210534577956298926109164909779987221094000880908857594198276812276890284008572664102792405452379662935026125770444036994 -7349798942312432150) -5455184800550144006991157215735481579353213544152145628297990102571936052187486515129266239245491863623978659179559754999567936067584384479787934704340911556625153536160778495579370425428019248950494107696016864499055854257192071541354806671987402367524770228296322497224645429524493838356022616251290117624472061673033274133156467148770562815676767117605001434288573911556053311048284534341905722947046607192815465807736361991479044698448267471087552952494477144251510778491315012457514838113324210534577956298926109164909779987221094000880908857594198276812276890284008572664102792405452379662942375924712756469144)
  (num-test (+ 27233955893140063612427006607965940109569052437681267421929959186535416115028420267622879017163568256526042146282241931623674996867133390355390677118211537487769195270234259640386625552763891339073878417517169618832945750393661600092643257470064376916337734385887099957095417541169462231630821139075814859604097878094729685589777579267192538715202397220666651307185763054526407234767132218634060693076054116575833737797189157152326979078121760900891899319809724675232853322526718686306470372869701173824664984405178677187081936624687293494821338781534163633206006387449585716391843039459733925494003066841874935048611 -66646390577667468207341453008390168215) 27233955893140063612427006607965940109569052437681267421929959186535416115028420267622879017163568256526042146282241931623674996867133390355390677118211537487769195270234259640386625552763891339073878417517169618832945750393661600092643257470064376916337734385887099957095417541169462231630821139075814859604097878094729685589777579267192538715202397220666651307185763054526407234767132218634060693076054116575833737797189157152326979078121760900891899319809724675232853322526718686306470372869701173824664984405178677187081936624687293494821338781534163633206006387449585716391776393069156258025795725388866544880396)
  (num-test (+ 15030400024888781078933103028897733817304421960545019199443871381537070197157227994520524631721701055962609956080413517776229513420814407790533237358129529547793422514837651333555776540939235592155512951229106778709351772195248438493792786143040421233061520515971787881798980515709417481015662862327435825812557205663033601853937647320838585333754027488605638576977560072206293290493215523194883494322543800546276353830683084405428005815296131527861252717516620765986589669237487765523936713749717927502645633123584240464131140829496052170285171610845098023517906586134613874506419828208611247177336492131262918439281 -164048419232636429449474429717211197442) 15030400024888781078933103028897733817304421960545019199443871381537070197157227994520524631721701055962609956080413517776229513420814407790533237358129529547793422514837651333555776540939235592155512951229106778709351772195248438493792786143040421233061520515971787881798980515709417481015662862327435825812557205663033601853937647320838585333754027488605638576977560072206293290493215523194883494322543800546276353830683084405428005815296131527861252717516620765986589669237487765523936713749717927502645633123584240464131140829496052170285171610845098023517906586134613874506255779789378610747887017701545707241839)
  (num-test (+ -10227062646189307616073129048534031298512434237226774743330733206156788005874968173984804649812506029813402205606562016228122184161577517837608957023376079537037472977098465137152327215807765130656192272994478964341604278041664840636982572214751638093860605132350960802560601354006634296348422600320863531059118477125143903734159707623839282511184908969206873548650544269932394344952983661665472663102992782521888857016369837211403335306200813816060883478434441858442549261115972947741929087886423170398410216855322384956160289855500229952405068604320121652911887067414460828300146993858360430784079225137421074839819 117460076430162201914796277915447781936) -10227062646189307616073129048534031298512434237226774743330733206156788005874968173984804649812506029813402205606562016228122184161577517837608957023376079537037472977098465137152327215807765130656192272994478964341604278041664840636982572214751638093860605132350960802560601354006634296348422600320863531059118477125143903734159707623839282511184908969206873548650544269932394344952983661665472663102992782521888857016369837211403335306200813816060883478434441858442549261115972947741929087886423170398410216855322384956160289855500229952405068604320121652911887067414460828300029533781930268582164428859505627057883)
  (num-test (+ 27989453264793973121573869640708223239762902243991948581280654553806618470632044367386680716040316895884976837122054709584963028986161694425215067648887944710852278135008221491665079705797192389681328802747226171436158375378499411314855257919224316919346771317457123252623293612958336691335423245293660257386649100685560072354549579281852792682734916555498283053758141666658137856828164206947320523255487437004565021167276952652515632644458005291855624829941937578229983628962137595011570216766689546500517528191189928660433013004254032861383790553611840534023221000900694995707453499030166286828319347894538505334235 -59175168207571178843658955348404514921) 27989453264793973121573869640708223239762902243991948581280654553806618470632044367386680716040316895884976837122054709584963028986161694425215067648887944710852278135008221491665079705797192389681328802747226171436158375378499411314855257919224316919346771317457123252623293612958336691335423245293660257386649100685560072354549579281852792682734916555498283053758141666658137856828164206947320523255487437004565021167276952652515632644458005291855624829941937578229983628962137595011570216766689546500517528191189928660433013004254032861383790553611840534023221000900694995707394323861958715649475688939190100819314)
  (num-test (+ 1178650930337394440162727078866515771626896502845852711186000991913866844090831426017480263676964607121490209778220339316756171449922437605552456088105443130477974682689512446683178356259305893852096425478878588001446154476458310269704392486398646169362313605456233489086567865316333034897433650974160168545492823208575634152241341906068149887959566983066154182855136114289266802474404127414747112706158621650063987662749553991791509795764642256261917497984177610694405881831052199417235241109412927893781778469398975117797578753730248539151297798807326284978255001046995523851829184120171969918537718488250577987049 -151873924489040812813761508259707631973) 1178650930337394440162727078866515771626896502845852711186000991913866844090831426017480263676964607121490209778220339316756171449922437605552456088105443130477974682689512446683178356259305893852096425478878588001446154476458310269704392486398646169362313605456233489086567865316333034897433650974160168545492823208575634152241341906068149887959566983066154182855136114289266802474404127414747112706158621650063987662749553991791509795764642256261917497984177610694405881831052199417235241109412927893781778469398975117797578753730248539151297798807326284978255001046995523851677310195682929105723956979990870355076)
  (num-test (+ 28233332719950979786871881804755080223325040620170668729385709165879717973040387558150293205758215739710262749733170837042434162049732587908182282319848154049410849721309988807368466228286699721201975848741931128639324322061892706638973259354962358866000024260698793885547287093369940035337370984725857550291339492871017395328145015077506882578124550084937438336881072124376107623716831044079223921566902242543198986921476998895559488862309653154914291349588095330683589871173449191854284433182368052817373384461363574550061788800329400860372148193491004593903732351395815409821222597665222975816418433744748143385431 -43245950360315656184924888243641533635) 28233332719950979786871881804755080223325040620170668729385709165879717973040387558150293205758215739710262749733170837042434162049732587908182282319848154049410849721309988807368466228286699721201975848741931128639324322061892706638973259354962358866000024260698793885547287093369940035337370984725857550291339492871017395328145015077506882578124550084937438336881072124376107623716831044079223921566902242543198986921476998895559488862309653154914291349588095330683589871173449191854284433182368052817373384461363574550061788800329400860372148193491004593903732351395815409821179351714862660160233508856504501851796)
  (num-test (+ 17311283930487575047109155431670372891723312431004343097275158353815289445461275098157423001160013464866170709729134076291306322952612660169010483426086431377525432637844274608988581691477819008626983761905899834444008235608280930166913911248710072733217113558125600345343437000427963292980921009445490627620344145866648036116660335905940809860199697939729919140888034303887423527841395304960072549430314367914315102150378504502158659627719016733307736583749830415574905929299482373462584995162798576853564481617711234957058703455021082855018642616999836886763535412642684228990890160568207941504887072856663966242787 1954009743321912552050341299974626734964446274711484506734354360114801426013796892421541915293157994203607853436799102383078659985249097057923578528366737) 17311283930487575047109155431670372891723312431004343097275158353815289445461275098157423001160013464866170709729134076291306322952612660169010483426086431377525432637844274608988581691477819008626983761905899834444008235608280930166913911248710072733217113558125600345343437000427963292980921009445490627620344145866648036116660335905940809860199697939729919140888034303887423527841395304960072549430314367914315102150378504502158659627719016733307736583749830417528915672621394925512926295137425311818010756329195741691413063569822508868815535038541752179921529616250537665789992543646867926753984130780242494609524)
  (num-test (+ 1135960177108146621604027872788612991247811085764456406834564014092038611848908717507207251239454266163702244932570537009884467598603226302482406831131219148530146321028801515381981782506355042255201016953375149829517466449677312249611502599434850555618739830488706171667035140895674806873502543300909514568759918040129665855731078258004983486524477103833885001539135541445685573269814159175744401893663504523858005835387122082112362666991112899837534230326730196110477118156871579503345757821268248575583821695674912517830056856597644827244194658166928026249459511837772775196175188368236573504643083995409774002567 -5513982495816270388232134254127393284677692173792609278582774509636977743203029647121158805174638642867428501907786521939155900331399058909602425073976766) 1135960177108146621604027872788612991247811085764456406834564014092038611848908717507207251239454266163702244932570537009884467598603226302482406831131219148530146321028801515381981782506355042255201016953375149829517466449677312249611502599434850555618739830488706171667035140895674806873502543300909514568759918040129665855731078258004983486524477103833885001539135541445685573269814159175744401893663504523858005835387122082112362666991112899837534230326730190596494622340601191271211503693874963897891647903065633935055547219619901624214547537008122851610816644409270867409653249212336242105584174392984700025801)
  (num-test (+ -30369736932762868789456108597366835061749107555998091727589163626331595118680326568212941898571309672187038272915036839449380083450246957904300051802617002374912724325419651633014408152565340519439718081357147324136023867003917288524338643759680061563616479323818330115572573568245719292922176485298767387601922362893307843067637295955606642841006993776777666041277965868780958830666697755738164183356399977211227424725670822944234275611849032230010745799964550976844117943559190671369193871330514473741920389633762695829790016565565261170688485790141638094160105909405353382982945608773290740598479367828342651860878 3451570547959142767282758882796967240086418127970526029661337442068316209707489088420708984628065070358319478649952710478991064476168799556496237099109563) -30369736932762868789456108597366835061749107555998091727589163626331595118680326568212941898571309672187038272915036839449380083450246957904300051802617002374912724325419651633014408152565340519439718081357147324136023867003917288524338643759680061563616479323818330115572573568245719292922176485298767387601922362893307843067637295955606642841006993776777666041277965868780958830666697755738164183356399977211227424725670822944234275611849032230010745799964550973392547395600047904086434988533547233655502261663236666168452574497249051463199397369432653466095035551085874733030235129782226264429679811332105552751315)
  (num-test (+ 24749014370880469345815230363662696846133977441600857690896762642529872426102613384561609594131771018575590861342023688138502403609639138062665279129058939911797019091643704220495944170754490238422880589600838613701783818105188827633578438439212856537589855796204839275633245851474930725845096235668385012500773524750522781174430369067441632028068262240870795850561389232369373523415592833273932285308223863420210049445377497367753786125779044716949754454461623397410528064697616617917065021866397277409044449982605591256067763430930720398889239414812509701319783809830072841056369381573100589260104551934136733317845 -9461623592584966196513107657889418526847060851423069480904645009418813160370721071067349946095573698635859409908288864150475056170059858850823883834932131) 24749014370880469345815230363662696846133977441600857690896762642529872426102613384561609594131771018575590861342023688138502403609639138062665279129058939911797019091643704220495944170754490238422880589600838613701783818105188827633578438439212856537589855796204839275633245851474930725845096235668385012500773524750522781174430369067441632028068262240870795850561389232369373523415592833273932285308223863420210049445377497367753786125779044716949754454461623387948904472112650421403957363976978750561983598559536110351422754012117560028168168347462563605746085173970662932767505231098044419200245701110252898385714)
  (num-test (+ 19070246171469235561279483225919489206942407814032615339351735800304747459507922411906751965555240682457214768298108831815622470433175555196912899313888991765436434867025639919521068437191248198117664398275835972573354886915721765715992151871453808224011999677700078879590132676060988550961950472536029228350169237717222998397029428440792110955380302156159849645211726041489206565536560827557279129751110297078563108009278363910936720061216511798518178957070787710331228500533067546198458251241005176280410230146430275074766072259256583499095689284871987010372039977403712023630453400259082684930755893684499232318008 12330599952818018622104330691506128012101935028731995985677032980931398338453806827555760801312052792065671886621851470997557806941112316627790755867100463) 19070246171469235561279483225919489206942407814032615339351735800304747459507922411906751965555240682457214768298108831815622470433175555196912899313888991765436434867025639919521068437191248198117664398275835972573354886915721765715992151871453808224011999677700078879590132676060988550961950472536029228350169237717222998397029428440792110955380302156159849645211726041489206565536560827557279129751110297078563108009278363910936720061216511798518178957070787722661828453351086168302788942747133188382345258878426260751799053190654921952902516840632788322424832043075598645481924397816889626043072521475255099418471)
  (num-test (+ -20895998178036569919774658790651496115060841511658297683195804524712012347695091074325978179977718571444320688167469052862702339462089668992243209990795362064005869602003990235714500149401994013174762139297327430396441552225926368085284222509085197484452650071390132794942944512235132641643003294762547138305644086106533258432786768644384855008506026923783604514268955071498269812887794817192371944269611642901807443894686178438687102834127061425955994253034824027771176714559050403098437684091684851207513969915720607528045624635094984539637789113651579846373399975502788877555747414523231999341294756679330384323996 764238600803843266244444637050072967342049538611688895792923539838804953492110953673720766879606601435939162680753428779068917662740403667549850724878795) -20895998178036569919774658790651496115060841511658297683195804524712012347695091074325978179977718571444320688167469052862702339462089668992243209990795362064005869602003990235714500149401994013174762139297327430396441552225926368085284222509085197484452650071390132794942944512235132641643003294762547138305644086106533258432786768644384855008506026923783604514268955071498269812887794817192371944269611642901807443894686178438687102834127061425955994253034824027006938113755207136853993047041611883865464431304031711735122084796290031047526835439930812966766798539563626196802318635454314336600891089129479659445201)
  (num-test (+ 6243894672855694190803081952962387322599009058758027960092936187687064819462191583137945440936085088260632250436567758576422207449236613172605950116622271404444221039084346501796818945639456207912207604248991842124079786471250102192718092353598850889806607728696519257402580732995770031331187089424192803722612735557735028710899438934171272639518928194764526910590046378401600819132587804143949995694950116915803127294011661411525934100144319021440919928013617766507409909846670172516021888661284467975865076091834094160862228180625536450124272957206172214541444266874056050295270719541605687740822711659847211976891 11877496607682442993105675644902145742318375725225741293060927105303783712520284640625374957608051032540491531573337817824773543104969422017506696018037874641947740606655370938613842356322585858034851150595788166740174872996252792014218946552442572806242471174234462119454014379628228878122072189387777413014452140618318641689597452676091677588204537830401725113931418426919671512011822864583481449136550835952005765386885680701637038206002172218712504732572449659704181315669255320876647592649071711438131711904976335957846353867776093588236311654631696625859173554395714740218099921290128795607292259527492722462071) 18121391280538137183908757597864533064917384783983769253153863292990848531982476223763320398544136120801123782009905576401195750554206035190112646134660146046391961645739717440410661301962042065947058754844780008864254659467502894206937038906041423696049078902930981376856595112623998909453259278811970216737064876176053670400496891610262950227723466025166252024521464805321272331144410668727431444831500952867808892680897342113162972306146491240153424660586067426211591225515925493392669481310356179413996787996810430118708582048401630038360584611837868840400617821269770790513370640831734483348114971187339934438962)
  (num-test (+ -24023960171862805266003610953999097357395283354964456554686635290239019705581779621120391229617494503580661676939681517550103414632840981987397485411400553792707518662609532504246677658012933762605038799352109564432278094548068984563394926376371580465135388578139331334464060067790936072127680597181415407099723844313625277987147283697141407959289588588489162704824409673099509423520008795428217612706997355591985894255450783091681112776112997887084157623388943538145736618168104404283342039105202585543852590302154958791010622670839015475427693311663800177428904406869645066988663292128104453773413982185343111560886 -31939808827732134714870375774276102357277346245583282398423150631754622253109692213928642228787888509211781331649081002266227303203259124984426497846441848502574293640959494009564992092503141598640200823656998243767453860939156780549404892392521391484933772285520949470194562525777116137058001008184603332597820522016200623301007194309404025522056113671560767212894303567191067178003014955596425115379852712737129325098876542459702682095445350281859042779889411325882123213577906096942649941285655935053362468972482748617111598313960198743596285343178242282172686940700127068972627110105953098737923773182254460772630) -55963768999594939980873986728275199714672629600547738953109785921993641958691471835049033458405383012792443008588762519816330717836100106971823983257842402295281812303569026513811669750516075361245239623009107808199731955487225765112799818768892971950069160863660280804658622593568052209185681605366018739697544366329825901288154478006545433481345702260049929917718713240290576601523023751024642728086850068329115219354327325551383794871558348168943200403278354864027859831746010501225991980390858520597215059274637707408122220984799214219023978654842042459601591347569772135961290402234057552511337755367597572333516)
  (num-test (+ 14513652183174940741664411990199277445706189147726874603036586212536012746892966848269748909379750612027025331446918381470766609543142456872580466135425754204680927122749772612276850998180593344389487924747722210296498854143380696064338777945015153982467675141485724865534995199700908286263993697988986805404864429385840512740226775506122190698806967785494289035976495492863456705096841250592980439363856397663738211335801835896091823148249303370609165910779981271035234045185574995335952208702661648744928539539455138167482396767268362221492607154709559716065850417221174683768503217544145599044845325824451589309835 -12814535978730024053359592817368712576084646962861720729844389627130663192435154658607204342320327460695280260731620465435530495952836598646143907272825807563512741964987882356778796849529260646503692618525570185450780889283642116889481314560395290434301143877809550098309214046129802023655714098730144464028249594406616074059558969757405392170810220921023905546104487938441503430332099605473144930508420331873995741851604525954472341693863067199617721032815462094767522339305487934030130207039176659398466616780628644572276059410087128533031562978399689702766028716401176531098447698206272762966470643604141938670152) 1699116204444916688304819172830564869621542184865153873192196585405349554457812189662544567059423151331745070715297916035236113590305858226436558862599946641168185157761890255498054148651332697885795306222152024845717964859738579174857463384619863548166531263676174767225781153571106262608279599258842341376614834979224438680667805748716798527996746864470383489872007554421953274764741645119835508855436065789742469484197309941619481454386236170991444877964519176267711705880087061305822001663484989346461922758826493595206337357181233688461044176309870013299821700819998152670055519337872836078374682220309650639683)
  (num-test (+ 11356479761814008572465147431830778885327227506593483181241437802252618729479905490826767363633131720717461693888023278837835457496021519184903984385091047829540007466025527592005114414671285638168997562037691602144751434208304408870143450743278437854754504713023422097017723330207792526222436928747286558205279330508360438281011315147578105966454344087225699378388309094140949428028313539634103047841948634832398526343605363013644180832752120081735152285507591096001749463421326282317713079361827765412853023201330345752038722069405404812511739634687282327711258974520622248165974215116400638833123609666501349513623 -2451734542868054449539778460457497703609327132304922810342762480808881050209276687756391911546806187586640918078231508181876445466503459873508196878629364924241891220686182517218825181707207808769770392864734466652524094735160185556148554260517746279303022469784592528209667497664672945900929888144529727881050106027775707933311860110618130543481573815538047460723253898548348335762406437618625388229555824532715231231491787570056329865617082709588903922431713098922691537317839185452018617461891748518176708607861270770493263960554805373552348256747200291438630960804647686832667981625018361034564086859426490014044) 8904745218945954122925368971373281181717900374288560370898675321443737679270628803070375452086325533130820775809791770655959012029518059311395787506461682905298116245339345074786289232964077829399227169172957135492227339473144223313994896482760691575451482243238829568808055832543119580321507040602756830324229224480584730347699455036959975422972770271687651917665055195592601092265907102015477659612392810299683295112113575443587850967135037372146248363075877997079057926103487096865694461899936016894676314593469074981545458108850599438959391377940082036272628013715974561333306233491382277798559522807074859499579)
  (num-test (+ -1814184401790217165873937825605141478060935014868566665644215718762341535891730598045990231798382966074312671040257824056876679135909008140059087311700216658095793352051583071432744886316274989901835606602224927350560604355249919901932382803472476702792978322468747380191775778902733911968522382089332819162367884984027854067607561808704316828316820133400099093450636968732151876570835173932998599031643640476109466728761033062776578175554441947411139184426213290292577467587355369954997241091769769542810051228504545831588488726789173405585678190671534386784806998695797717346491308862362775748058331375692317599945 15466182953987394334491149436346080039471412309427279110582769586053943302670765125931570041904640518032832554998553018838321871748542118021556398569294085708441934948186080236498081517178574839977996802813431873543309853609838200338534343580791382510179184571852290959723696010410340740895530535423959476873857191548113125728667781953125153120447892632916574768078583174099545013854248664119997703948998871566374080719541931440495888606776561795893839624084254684939434035018741535261951124673664746010067859317726891535170781460914710499572006592206360512398012457295755926986236618644330364227754380084585899275327) 13651998552197177168617211610740938561410477294558712444938553867291601766779034527885579810106257551958519883958295194781445192612633109881497311257593869050346141596134497165065336630862299850076161196211206946192749249254588280436601960777318905807386206249383543579531920231507606828927008153334626657711489306564085271661060220144420836292131072499516475674627946205367393137283413490186999104917355231090264613990780898377719310431222119848482700439658041394646856567431386165306953883581894976467257808089222345703582292734125537093986328401534826125613205458599958209639745309781967588479696048708893581675382)
  (num-test (+ -27127130599753372624001250456405972983012981437652156246797208697430661165612459362971759027335854588888552031022264244768883843080959804690580574272908031271224646245152017114094021048441971097191444782106551075175878815012595015584723250801765859461211934306789890718268168352614164589637346918581658850565274510502652089457352942736418509881708568727739912127781455473660768550022762222130489047215089836402367851853412705556570667960548570630054608024914653686223423908494006675057953013815512203710764854485332282975729323105427143207127239069826750682633272289409910001698385240596625059970587393681128674617278 5719655139276246085992066702308194672442413085748146924567717361937179810269300239821879673460959112727066470468217892213025828988023367028158410455624528688729907493639908638553730770145274142147983721694721139760883483821883267129411125364089207412089113869427479340283853501026803387874124668123626271531796990801822527792189514551888019206405597994403243358155410088320317141454525417323186389587327532772638942220300149829241141659063128602316305332848477566686425551944956989370838072872906293845914921103561360871571846865478762953536949621421094416539099628942010528483544062050170673327754206501716239719529) -21407475460477126538009183754097778310570568351904009322229491335493481355343159123149879353874895476161485560554046352555858014092936437662422163817283502582494738751512108475540290278296696955043461060411829935414995331190711748455312125437676652049122820437362411377984314851587361201763222250458032579033477519700829561665163428184530490675302970733336668769626045385340451408568236804807302657627762303629728909633112555727329526301485442027738302692066176119536998356549049685687114940942605909864849933381770922104157476239948380253590289448405656266094172660467899473214841178546454386642833187179412434897749)
  
  (num-test (+ -6069217517368004039/4076344942716985944 -399587800008780737/578697755310708616) -321318766345655960630110128852941297/147435729263904928853096856396980844)
  (num-test (+ -41285036778370718/305793940074617155 -1396094619926552183/15846027887642356854) -1081121118676718273499338028514700537/4845619302294419132297197085940230370)
  (num-test (+ 15975644088444536091/18063939613598316583 17501188199168431305/2979264551795273683) 363736076920798535449296038324193823968/53817254956563877935003279344562385189)
  (num-test (+ 10197734562406803221/17452826108659293487 14639450560606090654/236781760961536951) 257914422508077920978698094723491089669/4132510899763835955061848877304138137)
  (num-test (+ -16810360766832230069/13652857552883800956 5011749175730438558/4169057419710079215) -184295743992738197672588473692806043/6324394120121667288243293659228081060)
  (num-test (+ 2234573531734039025/1128831476977636536 5842177084459535064/10255356071975483971) 29511180623959738330730559435115466579/11576568741659658592450950022331964456)
  (num-test (+ 2268894928233321367/45672733521488298991909987382109984899 -10510750087507287356/187832098427494353069556175466145198255) -53883392376116199828369509984040539934420061636271022459/8578805378260910951788610598591490227836321974082207035230408675959411151245)
  (num-test (+ 14273433611429514043/7774518083776389556784045601066955324 17247074371340283485/225579726714102822702316919752160926694) 1676942472465190408518249346164012571239098147062478293991/876886832336064155131767120243155911448808491410701588797601053820468509428)
  (num-test (+ -384768590020206817/26284423885474502132625533495652664626 -913687410374243983/254477371735734658619949996700223764026) -10160887225658731404416073535892287983824191154410167550/557399258996959835387173465565070652935481894323496556880024318994528462023)
  (num-test (+ -4465222504572200650/89674568206322981678158378582739708537 4148550863841320780/74302497820894496090312266744880513261) 2118016946376507498169590394563632549990739165791772590/350686547828419379316750498534703170285368675911953477374458878558215968903)
  (num-test (+ -4466938407638238142/281859125741189685767904931589784285893 7302241525893379697/204618108204962312932373858463395271264) 1144186926000295881841982161759159994442430111060328362933/57673481089466829503954266461746705742702466399988738560842837126631263478752)
  (num-test (+ 6692616266348342275/280491911593106290120490189988812804382 5414100524539959087/183579771905991028181574615911067652873) 2747240373316006570071525025488180559154305534334705425309/51492641151737853299832848099101317109893853469394209716061486746077629289486)
  (num-test (+ -2794289802081124319/15768464977850217600859580216291365931410230647587457388598921425875331529149 10869776169503285673/33805119742344157512165738805682358903614971418053290198565741206390317449856) 76938383491719886409504555688515759257937029058461512747558964579607347503639994773101488934213/533054846729186819415263583890627325668798847177803707144003483502948153457972377767011992167761176556555806720273883868208938866192358148729990609852544)
  (num-test (+ -253222140119290489/2123024034843473393742534167007121513293496410591072104903085284304117612082 17957334013642389787/32058972871090153103034645121513493401113378486125580864856088310966601405847) 30005809992231287609744177955201962181880644831204431411802631067134766877061419104162728517351/68061969937719269465960475690278941280799593161143759512261685488134507341176789799765185182008442410081522124548392827986923668912612728349293792643454)
  (num-test (+ -13318881947309618/3105936147298438543619802738126617974207009907186580731552500517452462642139 1850968757748704519/36469179946212878965111748233319050931475015876401494718861814560453153824935) 5263262069792987469108717688485565287648879759118200779949761992573778798556738644541735401311/113270944257273905484832818286307416845956086746130199501242465128236430928807948126409718436237517505516279133169796919230385184900609912160483959935965)
  (num-test (+ -9937822914683494298/36414156259035675966580098631253549474580108307284844243190992829476777586283 -13712605099585970325/17758145954890657915358548152198427387923366136638180213650029984340849686198) -675810254607579372158951115566887998278519717754376916387787672973408477396668549189167387350979/646647901672150721610792561233068038707362067627156669418022102308446036384411330678972562863413004325878365438890328206637571985169324874284800419222034)
  (num-test (+ 2479135971595944301/28169711053558469409458629766960029324030958129245230797895768033968717159836 3427244662960653095/28446538857424788738244844756675951434179713170118835630969510829753715142438) 83533664807147783700314944003289704497366290621039272787320536148072960487262393639109696219129/400665390043739792096386856839000624247597803909916773326187593475005945995926511155915226239317839405221783416485999405286913042389632370302962776360084)
  (num-test (+ 14865500635281371370/56222262470894935247131881777606182311286871927285650835673424014252462156319 6436092572090050725/19282524131572095520593158313261757267758159099923763177708581262473988426947) 648496060602737474174747620183913927791943082591316359990137585798909535115053578637078811588665/1084107132826611778585714784136700465449309125114745313342842325649687943726086785657821763235618936882528385000712567133180567926723616940173290425928093)
  (num-test (+ 340196811925805824067049620503247332111/14422464039094716975 51285507111580975533385007190438537498/3230944134273302873) 1838820276033673324738967436225477772648372110186756083453/46598175588880723338390245118389369175)
  (num-test (+ -210449319160504160992731982827917332322/5436857856220342451 251628249079137248539965770847855056283/4323109210037952829) 458271632943884346915405609513071881239303671882386130695/23504130271893362375786510953364243879)
  (num-test (+ -40984360445255688839942109197081457275/6593417935076565019 -138094174027187773198981391229349265879/7135512300754720691) -1202957011856131413678873259651070808566709454882536663726/47047414779755620074837011989046108129)
  (num-test (+ -289704472880230079383856507128133962457/10452740760651010288 -55251460678415911958671096669490155237/10333740726609314202) -1785630052601050832889834016432677758176770083879794496285/54007956451514283340719766211063255088)
  (num-test (+ 276702099951674677215621541062877777467/3899918017008359516 42623843937285717338660228144403811741/1973785812353331893) 712380176058162142132059442064597996057720566915757732387/7697602851312240113570356856612843788)
  (num-test (+ -323480614013303716597188084301661616596/12957985934572321773 -72966206939397711493108854138997499334/4539020357040680881) -2413780175334213399707013296172687953960842714316410700258/58816561943270580900205343368941122013)
  (num-test (+ 65443777543319569578713907336699651721/218804857459609839540825438673960136766 -61986861924091374470669233802827103921/65997977315012279293170493460332070399) -9243869541956614722377007489838492339200370508580665293676272508698701352807/14440678019033825487758061900150103876633207457375858942267120523885980189634)
  (num-test (+ 75417845823236070411341994633288547531/70553457686181702397810927701121800017 -7132208259849175775323757110664708879/24379326462014713478002790304943339422) 1335434330716260509518880689691257567128541829706203586134358870209350816139/1720045777955364955754847231620711706115121721983605654691934662747636370174)
  (num-test (+ -144692585186931942602350348772472248638/135233395864627580439431775527364081053 282512666765911374279543408363363928190/317835040256607665191397469890906044457) -7783226336195038987381961251409043080655184208289882004756343793157154115496/42981911818671667582796085276418080952868666330715445603855323471628969373221)
  (num-test (+ 44888992584766727877549626240272070725/30583318432547259097085073976959329092 8004917623696885952432014881247978821/22005016116109025986417835664774768346) 616299974987760892931461886440810919939264155149950328291076750435394215691/336493207496148335911511951044490614757807556827643881435283379298939260916)
  (num-test (+ 78378756441281199312006031491361997668/175125578595003447448566412156266355477 41128705932035853424044828385766740319/216359823601433445464965619660717081261) 24160702340946845080381231961736762955784254747832931999121777482667650876511/37890139292913914697800186893609983979783140570423836226844401085057321416497)
  (num-test (+ -36669293296367265584135816683983780855/7341750629088488427994322429098120058 -110335983484012479290765295565662258281/5944410911181873015545360879141666465) -1028036623331099574157832708037007047972965676333418398303213384036005227873/43642382546729990922161061763293407461832155878510163500678954788762454970)
  (num-test (+ 228535455883892721240720366651075744967/13353170075841095813026701300679754576855418298534901819672803635370738730013 50622643250826426975012800479360461693/18462345430382979738234695697296360785230118465695284267226773073149552698303) 4895273294635392498665165879164922265508724130843670837390305811645771221742112327485665544066552056189958877583010/246530838530831602270074647792752210668736478466245992891169449973883874207653264921203783108295835419855394180777469634862446033810927048792871560267939)
  (num-test (+ 11355068601761731966774720678777239425/4604724775053993730579400400679579947095967462408565975449642189823843820753 140083339434585694465706029861026468774/44667214322013486680993684507177513903616004462434123967566781106229226297333) 1152244506542792151980649054527153167035843960949499862764543674633978109831264344257976000890169981044543787620347/205680228421222079539939271800361418862113882206694593495620042859527547538342323521609420336002641308832164587573546802806916292021672743366881933951749)
  (num-test (+ -1347509007210283053816302848714698886/1127513773036247565111791991337919355855664936242166138889250311777351432819 -29464928273311615445392112247506626497/61933028109313748081628643142485450090725737246358993405254280723087421657760) -116677425670791909053501267317366054796703074907755330120413752187834449333299886015456661052906469074533366060403/69830342199092322009251417145364324484174202256910311362396720371574344280505889954115533896831727771442604285956749924105078563356474162416148250025440)
  (num-test (+ -324250487660721070279458563122233299722/81069650926979269606211148691445887485067008319429991878657612702576019034861 221744296343315457943731256980089803078/69422237643162665956763790134527973903052044485041686255401689654420090859107) -1511153903564243978242173323335554031611949546418082039382510246845821774680210236992700372319944685567533765722032/1876012190766999122356500320654631447623282613780323887424324139799202291067983209550065997185860196433399782230215269625922714982832188312141580824109709)
  (num-test (+ -5518324152042099343909980322067306333/114786626838714403445081775763480415805466836213320421844559660900880511042496 -34415425451618992284220085078832944671/96012285963709194218263616278916829663708037691620330613749177799086889040577) -121088040955051148243092870850103339772063863319219725752028251933576579890093496821887384992074112246777968211161/297862876779681729593084954525306275464788137269287692384941959703420459939692410434239827100068259769782676124741025632728203586961467995819025176090816)
  (num-test (+ -14763921690861243371082340598041267817/5580497386043551028888310256097864185640794395615400088682607872958152738111 -37917865546640067592937379176813765341/6460563866107795917092814416816176677900242086501650458839130903088333290440) -306983808565398982164654624310995401934900925070311336095043743767915008644459192438083753301097540174379867380331/36053159767181973313125557585868206969047484351694148822117591172786449966899079869470557965303954072842600790897257698854023751399649072014440219958840)
  (num-test (+ -50167218239107621378232529938205077788547946059832391744348095230748591585676/15685777859540025727 2959973815535345735348053015389999235839609978295604181643547897863515739931/7556072538495923601) -332637648328710384664787658442281566361265475773778265650094684540358159241317316408573560734439/118522875329417757148187346888166482927)
  (num-test (+ 36275100136090483878026478935942224245036692059657264537598788566553406654319/7192442039871568876 31833552596558882106090352174644817045294359487590746360517241517440556146007/5115621724114081523) 6795584791386081942310910570767193224876510928834120433155946649367201608618436115134135392229/603177258173744207443043238127434068)
  (num-test (+ 1518304705177739493483387141342904186483658277690975456045607777812450680478/1837349761252804045 -98159070764971437450169149833809835519268242923913777966502463698396945141091/17238232824535200528) -154179655228376218743158291724235398278770272999447263973992852061897564252670941977524115620711/31672662964580000612902147746364535760)
  (num-test (+ -16820231344048323866426670709751443650129113909724546927974450301780935205864/4879137683452153951 41987219452495799378686134495924115238909423831017150785452046648616005475639/10470103987572807938) 28751853386830083847297108941057082854166610198448421498169760256533906032780671559334244751257/51085078915429149801779227663330863038)
  (num-test (+ 106981694162678522688926793970551228214793665448093395251834862896418045995969/12359470989873920972 57736849967187961211538031441400807467468650239660040144967046985609433512403/9148121311784151716) 211534804819567028232303054650327703050869189253958355919997046592895748577556985792570078031065/14133242495605447754080611005730273494)
  (num-test (+ 32477400086615533920132766925666506741908300936974348739732763951610256880146/9045135183308696243 -27444990730472195954051975667481893116650518055101159075033425831129583042846/14815776448343565085) 232934248044934592851252865496377968609159820017147884670610366058217203617961573611006127074832/134010700820948737148715427669965475655)
  (num-test (+ -110053921687226074580746319073262192216481755737797790655164396095655530752161/255625377233605953547425802301922658850 104095037267817888539158192425982072195078148060302393917025130946535913363779/52156238014583575190277280296975732513) 20869334635774913818120011435677143948904421430726712952150525645851498022294865158343391008006649321440592131083557/13332458017563665620865770931104425383051282278510599570476131200251352190050)
  (num-test (+ -29732769078100192507326444863945498799317005912797369958801703828462203585495/153426302667449722633466432797809987061 36094569840376017510791155197897623093337784636438580042046806320700826250193/73286165979315961333009750429763545174) 3358855747298609357265422062476767573626163217619249414656940907348235709105513077913806378841119674678021275101643/11244025482879487592663298816607141776071841230792806495601092332558428993614)
  (num-test (+ -5942892427460131788264792587455286675871284855854073854440582948253436001319/42136930106315714728428443448730580823 4013357443728612356640061171485791666303136232331145404661874650095235381569/4039594279673425548586623641599574814) 48367895947790658831309709091377784501687363167039737892874371817395083020674648576881857510385191335175551957207/56738700606823969419119152217721454504573192499839513549171731025354063974)
  (num-test (+ 83833896550100013648317056712064289497247852876055488793078639582729685477353/188580876675619574786621140720273228537 -94310653397371924313725082402708514144086936359594289802762093989853507835016/223423274286761439988276492107364036191) 945257965914081840217765265999453398105151083284254483307155736205796420255026737575918161700355729594975143830831/42133356934734885127066999419230498520039134905254787577957770920054881982567)
  (num-test (+ -14753992026457621496269953958381833108089826525439816493815533773338622353285/187171041855711408638339193132645929319 41340837577662628944845446369855468662228665858415210386857356535970453143469/322471558852595372991189266479896691326) 993354944176102401496932276511264091214577507066786487301109889019709943488537161608732610457423116833164991120567/20119112546425211128699888199278894685207186285215928241217590790016852128998)
  (num-test (+ 1370528773439579327226257222995383030603284075640526658282329726447335048230/305600505683287165495713194488435114383 65450762047588146235054351616480175308174618406941901794570541085963681607527/78934496562987400429145916504112602768) 2234440886428442112499564751364146150136438855986167755259621093816030535881959724370423862435538502079424185584609/2680269118389404699570998335430047660909241475691839354273569734988880268016)
  (num-test (+ -76890617375308981455205142622328108690129081798840077873315966300000409208129/15716637731576156581128288257209679492686622162926707938907282962815471734862 38716252217351070567267262306332875768795464072349655597599997486613800623507/8966639693620677733207403249675415446338239705879120765911896990394928596139) -80961151400006413290662155450270992168701818633203071886556882897757813544592915596861717853520674107309124394292702460320442121704840951425284048212897/140925427734207212133604717335369986754855062343668899363006574618520848268718851310007161609443093589067206438198588881828988648068282656538084484897818)
  (num-test (+ -43290760758277846058307167265569849910514905939554272559141355223092464986939/39390771697068809730875092892395235497943839933482798653607450783947201796777 -34021960935937170163894986285771504067448629886312440795733904794894095253649/106500928228745564800818258673435811176493306775154643113582742982704678574998) -5950657500399238361998292872481533631424138885403498309639150240712482075115081624153513501886127772738596607451116548616099047843190357858736503567640395/4195153749384427435979718872073512266029328962522899010907363614544821318917440413166534226890289043064894115954085809567292470182917919104836361549181446)
  (num-test (+ 17906146982204022925114071077515882010955693727109005464426577098738402001871/11978213712662686419384559301746021856683603106261241838035626618416021524231 37108371752538653389309509075248119316034595087990649061240232817571629131708/23044877611981158676785639370406786635050056158699399001947422631523989139615) 857136973087880657664203854652754375000000796400911171478039451763440064550649429609696307332611304395324153178602635490321877797571177424460384122636213/276036469018466057777760709173569478463866562650149880633721199971933767458324034017734890892482223472007882939609440193626728031771767304374122564511065)
  (num-test (+ -77062185592993847534024832256462395143306675613123510837298699277378172890089/108133793614758275822883834459865239455798743725021300772336023406871185253111 11169356025540464491224577661206910726665825152149521753528516637690366838655/6369000033300801574913390611244042297918207179453133439308688067382050608197) 716975776667538986425481530620118513423964367153518065425241139444161780269039780459555836804116752462325735011822817367819625929553250251515977390346172/688704135133337463423649074673019029541747166391680122270752018123634233590688096940261480888455237095078029621363428114402137147558304641222314936350867)
  (num-test (+ 13583698920327742567560325715281067532806062839142769830536738488850089822247/37364394142255392010559408553278838878570049727027927213977555360874308098434 89809462356450792524214360688853318641058652796345720882094866396911421360072/67457610947238032712889230619376608100793287037427539672885124981055281513463) 4272000026182362299819817378001862956001381379478285995446709640464951377212652125169846305230835604666564953883168949950485767679005929254184987140738609/2520512763327523955464432226120154092742373168521113224665257966793820057379494860454732800329019773731110452438496395974166220481124541266348389100216942)
  (num-test (+ -56124163112538495128545947597589743957824668875494126834084658670528264380488/4752969512023182700122983723156599300062332404522277372984645779569746369511 -24794747728228571193100294011820993825205231022194400752319729320185378063197/98168688073468429337427023004226732413974455700654808087001957859427678524065) -5627484141989830997868845457242226973925524393512774885292323552602180052845805156311097870316601631410500655735815037997645271136502511615781690896430387/466592781448509275992390948177487068548424631274164031114910250651063315574511979617153568070687706304645818907382693929886654490427484894987856595782215)
  (num-test (+ 17009115185923538769.0 -12047631083067675031.0) 4961484102855863738.0)
  (num-test (+ 12677011568664239747.0 3269056182420253574.0) 15946067751084493321.0)
  (num-test (+ 9315504781982082433.0 13857624532376678678.0) 23173129314358761111.0)
  (num-test (+ 15226508728194069537.0 11481952022080775416.0) 26708460750274844953.0)
  (num-test (+ 7461641943684774743.0 12249026721402718630.0) 19710668665087493373.0)
  (num-test (+ 1180469445886971055.0 -3208456171287181032.0) -2027986725400209977.0)
  (num-test (+ 18358552990465743315.0 221529797579218180385160273426219343697.0) 221529797579218180403518826416685087012.0)
  (num-test (+ -14819874956616484359.0 30498815629431206969122152847973230849.0) 30498815629431206954302277891356746490.0)
  (num-test (+ -11781881800334342169.0 112219460388643619332860331282276228017.0) 112219460388643619321078449481941885848.0)
  (num-test (+ 3570694277032201957.0 284821691832196381859344006870088122712.0) 284821691832196381862914701147120324669.0)
  (num-test (+ -17005463295060938595.0 69162171850264911722979835561124066203.0) 69162171850264911705974372266063127608.0)
  (num-test (+ 15647113311796203488.0 150750467185419235519670165664526735459.0) 150750467185419235535317278976322938947.0)
  (num-test (+ -14330150541101371097.0 -13054027994001826312503071338715966858478218093171762021549815587520723118772963817341751396703629529810372702877555022105594068768886421335353882155416908.0) -13054027994001826312503071338715966858478218093171762021549815587520723118772963817341751396703629529810372702877555022105594068768886435665504423256788005.0)
  (num-test (+ 7406427184711759740.0 -4059250217961011548005203450962458026528281798230141192186669580689721046971433745892994467792118611646113962840750314719233572760336084100766391093756252.0) -4059250217961011548005203450962458026528281798230141192186669580689721046971433745892994467792118611646113962840750314719233572760336076694339206381996512.0)
  (num-test (+ 8819522415901031498.0 7274905269237471130619913887005155660991437201841760414347836177003483932007334374478344594178179032728521106519295465031750530183363793325150672647162846.0) 7274905269237471130619913887005155660991437201841760414347836177003483932007334374478344594178179032728521106519295465031750530183363802144673088548194344.0)
  (num-test (+ -7242932332215698200.0 -10558564312909325527488520195600871241245891651644550509993750377630234801225525279855157008009255586978047154906058790342845859331159009687703010657137320.0) -10558564312909325527488520195600871241245891651644550509993750377630234801225525279855157008009255586978047154906058790342845859331159016930635342872835520.0)
  (num-test (+ 9794320575955609492.0 13380937715397052566925484435342184213544885758759259410983243841206628594840271850190097746775475837233042430565529099681550277688470325394342993771343357.0) 13380937715397052566925484435342184213544885758759259410983243841206628594840271850190097746775475837233042430565529099681550277688470335188663569726952849.0)
  (num-test (+ -18404048401680891243.0 6690884608978704096379677348142836785900717005050936986370615083929607190833180925295418079551348559691161519822750772440155040888224482801864925665484770.0) 6690884608978704096379677348142836785900717005050936986370615083929607190833180925295418079551348559691161519822750772440155040888224464397816523984593527.0)
  (num-test (+ -10763220363947284865.0 -30985722824355332972176356513316569304601382411274079243859710673739383446566598659878378034375348869471278415635671865753349734809209959160389615096293457362383744562507969316522225741589739150453090393424063226271167062127000223628785686999799282795143706407082119829140399988180879618548495395684946331608899565543458192773899200054228140747414544792128323269250618482622488195333106891323515989863192944848391405358725993695671970811097285270641251816244586360288952156538400321933146150313939864593445583603568771077260174826348411367609521412133720180359748539721570562669201065857989876521301209899829037444385.0) -30985722824355332972176356513316569304601382411274079243859710673739383446566598659878378034375348869471278415635671865753349734809209959160389615096293457362383744562507969316522225741589739150453090393424063226271167062127000223628785686999799282795143706407082119829140399988180879618548495395684946331608899565543458192773899200054228140747414544792128323269250618482622488195333106891323515989863192944848391405358725993695671970811097285270641251816244586360288952156538400321933146150313939864593445583603568771077260174826348411367609521412133720180359748539721570562669201065857989876521311973120192984729250.0)
  (num-test (+ -12742462236537568498.0 8711131313747826394504271797986775572294949693272674156076339989631171694968899228610359983845552623710580616605402899155485071497929100432998183040757832449369366844015907530612334721882095163137705867337969942902346066961718232788529860214990099385213558935023241940238638069647809530490438245386869385682221280939688108487754251075630026707075310465788398213293782900699868609660892232563106662995330591906155134237356516622436517046191466823447743155250482328613449506396571170001248589926831956459700467126756876526930443317428628239358666456771112897986098390410773312792390699312960051747534683311506465130527.0) 8711131313747826394504271797986775572294949693272674156076339989631171694968899228610359983845552623710580616605402899155485071497929100432998183040757832449369366844015907530612334721882095163137705867337969942902346066961718232788529860214990099385213558935023241940238638069647809530490438245386869385682221280939688108487754251075630026707075310465788398213293782900699868609660892232563106662995330591906155134237356516622436517046191466823447743155250482328613449506396571170001248589926831956459700467126756876526930443317428628239358666456771112897986098390410773312792390699312960051747521940849269927562029.0)
  (num-test (+ 9991390529516174614.0 7879872958436992955898278403297937595295396115022400543178444946646147916754852888072481665174663073269556311758611700754643170639645548596647557683044355930340624784190093631808382820554407595007761070026239341594197877214157118335743842022627898879376346092898666610367809537340994845045475091410516226225078052019727419030585524815982151736622865401299588936172760762386183577504972623377661437665668080131418564228642443266935225613702941906491478788336262289516199380144218708241406077806669686589734333554945412904560108150202389909124657090061223183441083590340175629756198442568877659538345749595968764873879.0) 7879872958436992955898278403297937595295396115022400543178444946646147916754852888072481665174663073269556311758611700754643170639645548596647557683044355930340624784190093631808382820554407595007761070026239341594197877214157118335743842022627898879376346092898666610367809537340994845045475091410516226225078052019727419030585524815982151736622865401299588936172760762386183577504972623377661437665668080131418564228642443266935225613702941906491478788336262289516199380144218708241406077806669686589734333554945412904560108150202389909124657090061223183441083590340175629756198442568877659538355740986498281048493.0)
  (num-test (+ 831234034418847630.0 -744676478858160349467117341859049692149463503380690495147216354303526704924280287782902146026018180364963325847811379182950159627878800024734206345960410146056000392683000433501805629464626281031086102425271022388473812300724085127447081771317912465921636737545371909901577246384446144919253141375367648958387948463576516115079816552636772639965957498569187848459747361493535081532845254971492261148968198806736512864867151355002902241562014241077734122599581732704243705918200179789271894804233542502502119523149682814025979598424744685548054183678652651244898867735764030968089217841214778606507809487462642341164.0) -744676478858160349467117341859049692149463503380690495147216354303526704924280287782902146026018180364963325847811379182950159627878800024734206345960410146056000392683000433501805629464626281031086102425271022388473812300724085127447081771317912465921636737545371909901577246384446144919253141375367648958387948463576516115079816552636772639965957498569187848459747361493535081532845254971492261148968198806736512864867151355002902241562014241077734122599581732704243705918200179789271894804233542502502119523149682814025979598424744685548054183678652651244898867735764030968089217841214778606506978253428223493534.0)
  (num-test (+ -6996572501442843347.0 -16567158719848992553565776505785820491834685475229611199353714982570065913508303466008005931649515528390057456882757990896824841386431756898386429000065518724021230756426613661219891419166146764347562529640689229693578574350948436847247856000438153789455857903402883189892697143647998643667467614427922009931545254965075041050860609824086811877108940020349157317276288348430058535959434983921323332907180869396258655826781438419383792024592535415693101119109484610789291889841197827977530804650015884500878613240443324806805475203272442094530735476095374446946252236490708915034012846683015547314889561060687692538144.0) -16567158719848992553565776505785820491834685475229611199353714982570065913508303466008005931649515528390057456882757990896824841386431756898386429000065518724021230756426613661219891419166146764347562529640689229693578574350948436847247856000438153789455857903402883189892697143647998643667467614427922009931545254965075041050860609824086811877108940020349157317276288348430058535959434983921323332907180869396258655826781438419383792024592535415693101119109484610789291889841197827977530804650015884500878613240443324806805475203272442094530735476095374446946252236490708915034012846683015547314896557633189135381491.0)
  (num-test (+ -8920936222630165483.0 -18738991973681679876688842391791783563249057933653045519186959571392922172943405646958686202208790537612746921398028331540617848217445632123805070077600768524509025758950743971128222843292926773668584735575066246660802064630842300367821042873152766467703905048558085377302000898639290554395913805527529259855535801856020623830262396582180677933562523957295341539162448074423901242873918231922121053192425691524797238343327318801359521456598967984637483081312932069399045363737622797213185099130529375169698811801965974416555301085043300426947769193582129151016159057101028336667142913854943018973494705119572045938607.0) -18738991973681679876688842391791783563249057933653045519186959571392922172943405646958686202208790537612746921398028331540617848217445632123805070077600768524509025758950743971128222843292926773668584735575066246660802064630842300367821042873152766467703905048558085377302000898639290554395913805527529259855535801856020623830262396582180677933562523957295341539162448074423901242873918231922121053192425691524797238343327318801359521456598967984637483081312932069399045363737622797213185099130529375169698811801965974416555301085043300426947769193582129151016159057101028336667142913854943018973503626055794676104090.0)
  (num-test (+ -243510292488206214847646757340020705642.0 5940577100149745132.0) -243510292488206214841706180239870960510.0)
  (num-test (+ 35446324064743728955945058978206455057.0 -6248622708755929572.0) 35446324064743728949696436269450525485.0)
  (num-test (+ -285342226760657637664173494795024413673.0 -11942737781617905307.0) -285342226760657637676116232576642318980.0)
  (num-test (+ 180790435817422032042321866247362452865.0 12401641959336396832.0) 180790435817422032054723508206698849697.0)
  (num-test (+ -179994871947239535956826388240542999950.0 13573822506399140772.0) -179994871947239535943252565734143859178.0)
  (num-test (+ -308198027295905163635866438671452347268.0 -8790069282378476990.0) -308198027295905163644656507953830824258.0)
  (num-test (+ -139324757925833055762410227358605285566.0 -190622873846936719063564661032771271922.0) -329947631772769774825974888391376557488.0)
  (num-test (+ 332866352618304570046318203427223999347.0 147978646177673305481282943528696833018.0) 480844998795977875527601146955920832365.0)
  (num-test (+ -39471620476300923970352914034802271156.0 28992893610776120142668950821916856486.0) -10478726865524803827683963212885414670.0)
  (num-test (+ 274120253734611965146455315763505869288.0 254675910805265090692978775702306142625.0) 528796164539877055839434091465812011913.0)
  (num-test (+ -122086811464559635596206661886176775901.0 287312583034687582188356355813963609701.0) 165225771570127946592149693927786833800.0)
  (num-test (+ 288576174771266329955482943556556984728.0 -57843540651903655425270706396868707777.0) 230732634119362674530212237159688276951.0)
  (num-test (+ -47977736580820486006305788441965482221.0 984809271313988066640898939725532304075331399066274624928410251834520283291912387208948664716457549646483445981126881113426109906085249657168046936670489.0) 984809271313988066640898939725532304075331399066274624928410251834520283291912387208948664716457549646483445981126833135689529085599243351379604971188268.0)
  (num-test (+ 21225484205143479814642328762121362291.0 11839789093732539327981861490012713257538550745921177905266671749716203131127256902110452504526721633943016923389974867770082516862899595554460170417713940.0) 11839789093732539327981861490012713257538550745921177905266671749716203131127256902110452504526721633943016923389974888995566722006379410196788932539076231.0)
  (num-test (+ -193095363331703875886398909106293703000.0 4389392021031719669078675478621418677903292147307684123866099084349756491860737402449105804868232530632178577388168068485304437343508442251302846768269976.0) 4389392021031719669078675478621418677903292147307684123866099084349756491860737402449105804868232530632178577388167875389941105639632555852393740474566976.0)
  (num-test (+ -14827657635864183514988182371035598180.0 -7256545787852407071411458891023580461638051949278710509801472046178301830006724297747051044450550248499056073213660185258676369175307019300952192657194576.0) -7256545787852407071411458891023580461638051949278710509801472046178301830006724297747051044450550248499056073213660200086334005039490534289134563692792756.0)
  (num-test (+ 54301423175725658626298504084995819705.0 -13385853291610595576947504757201441006088030688464261540642594993520424631577281077984278942244446266776534612440941312995898184903431893212829646845766101.0) -13385853291610595576947504757201441006088030688464261540642594993520424631577281077984278942244446266776534612440941258694475009177773266914325561849946396.0)
  (num-test (+ 195114404067053480147948948510253723990.0 -8373866462448797623435948949281383906369538962237624940506813188612614128993186653340202956656303504523161255703176374041758276069255591562198514767063594.0) -8373866462448797623435948949281383906369538962237624940506813188612614128993186653340202956656303504523161255703176178927354209015775443613250004513339604.0)
  (num-test (+ -308030589512186791277525017840002670741.0 -11922204352024596469278978325035646517433105521287613403902396944414655739824695945028308092245747333098422116078042326104667969967224788442970266049942774583538734406057081597034454910987815490244451193242377705191422489528853976486607580169986057592557285271953385769215318545520155212402919465580052078255078759756709086185424029620805084776442744700501748376290562843380642608395240491162047933014854466267084965223593172702334466729933986413870670083326499598274393380692146118979961818816348097032083332695128587696590646086980241100792624502607816103195636761141133903550454815591457829485684936036414823492160.0) -11922204352024596469278978325035646517433105521287613403902396944414655739824695945028308092245747333098422116078042326104667969967224788442970266049942774583538734406057081597034454910987815490244451193242377705191422489528853976486607580169986057592557285271953385769215318545520155212402919465580052078255078759756709086185424029620805084776442744700501748376290562843380642608395240491162047933014854466267084965223593172702334466729933986413870670083326499598274393380692146118979961818816348097032083332695128587696590646086980241100792624502607816103195636761141133903550762846180970016276962461054254826162901.0)
  (num-test (+ -172649878347923210775992373331623646864.0 22180935775581457002090790736532281654456312526625354262953960635330604551829750571440878712430708012807252279301365732385899228826740712544768476577874129759972563823209525283326887563301081200476495752033290851190327066070873711444930389093339915885090143783170994309089448293499799071372787520776773788274677288230540162485916160484352398851925328125588729604931589867889917097887951581817207079060016091919559509735997493084833476849835444339835031436580214492450731100723026312163752403946315983551266206214298679421644737804098691991631489261658890937663698502561036246447760919715595005106669653475931803053499.0) 22180935775581457002090790736532281654456312526625354262953960635330604551829750571440878712430708012807252279301365732385899228826740712544768476577874129759972563823209525283326887563301081200476495752033290851190327066070873711444930389093339915885090143783170994309089448293499799071372787520776773788274677288230540162485916160484352398851925328125588729604931589867889917097887951581817207079060016091919559509735997493084833476849835444339835031436580214492450731100723026312163752403946315983551266206214298679421644737804098691991631489261658890937663698502561036246447588269837247081895893661102600179406635.0)
  (num-test (+ 17539006966816771902104329685391462527.0 15609797782337099611892065465036826453911053690739041627254619195700021040383385710184052653282070244915503750549545390475671883312314708978681904377133928647935359080875691628246716591529028104762422990155477702994042953196747769893182153631482194578269859879402160062955490194674372351117284129320011166238130774752386987036267064693133554447596069886693581191241594745541512444806003236372840085705813835001957163976961730871756250344335996073970142337882238844723800849054637237549515249957267772181010402413375667537558243971058326641257721901094391380667244006959028327507917720426571969997513984360849930719808.0) 15609797782337099611892065465036826453911053690739041627254619195700021040383385710184052653282070244915503750549545390475671883312314708978681904377133928647935359080875691628246716591529028104762422990155477702994042953196747769893182153631482194578269859879402160062955490194674372351117284129320011166238130774752386987036267064693133554447596069886693581191241594745541512444806003236372840085705813835001957163976961730871756250344335996073970142337882238844723800849054637237549515249957267772181010402413375667537558243971058326641257721901094391380667244006959028327507935259433538786769416088690535322182335.0)
  (num-test (+ 244901855797156286376563377540855746602.0 -22138106346578776369849317622304392466030036563754663379976505966920461958652141160336156065177498990718609170201272980114106671808245437660234479124938853665375934080221740523696180221118540569603989748587853373569525751680828044059607889572522502629277877343410298879764820905044284757389006201848194571453112545228115550224254565141563427486518108434758694923122284117299374156393942906293546318323661938734959824887786185558612820887463537294120950912969343488704744978847504513710882720654330147775174336365363311173472002077960424794151168301281665765411704505095008907760396535767621855642720080219960822554492.0) -22138106346578776369849317622304392466030036563754663379976505966920461958652141160336156065177498990718609170201272980114106671808245437660234479124938853665375934080221740523696180221118540569603989748587853373569525751680828044059607889572522502629277877343410298879764820905044284757389006201848194571453112545228115550224254565141563427486518108434758694923122284117299374156393942906293546318323661938734959824887786185558612820887463537294120950912969343488704744978847504513710882720654330147775174336365363311173472002077960424794151168301281665765411704505095008907760151633911824699356343516842419966807890.0)
  (num-test (+ -119403662992279138748600939857239307122.0 26272999248235953724172008428088697264933069743507017434844709711501131900922919455931092196539942532993887162365511473221418376205773427597933886270411672062672089518774390132453916538404354895529975888201032175628249480896964400801763570333497287321002961557096975786141940970260074557095118887294558700145949117395512768347250531196100831164663613049206690894640391431616112104502483838173255614981302462548882276825096564828583591963617871547373532874400764134244496979962241959713525053686209002866840900623246072884125102845824992994967009109046451949348656842486048332953732384499190437432898387573320391878853.0) 26272999248235953724172008428088697264933069743507017434844709711501131900922919455931092196539942532993887162365511473221418376205773427597933886270411672062672089518774390132453916538404354895529975888201032175628249480896964400801763570333497287321002961557096975786141940970260074557095118887294558700145949117395512768347250531196100831164663613049206690894640391431616112104502483838173255614981302462548882276825096564828583591963617871547373532874400764134244496979962241959713525053686209002866840900623246072884125102845824992994967009109046451949348656842486048332953612980836198158294149786633463152571731.0)
  (num-test (+ 313963939617834410089002930298454269912.0 23286645405607099799151331553995799851855144387826191186590140820016670502830395945076644578998873585162998873396623634135231418574284200209367505115739462344028303923666952261030907434438322884189133236837089851688275865098623902644385995630973049587854251981548128145516004461191094062488421288607625783540996659060285661398859383778209495884203323937672739376151794507745282074538961033778823733980759695886879886017489555795079194346438911010371103435094677167286870898482214310646392174423422237727456012197253183422715313378603607058548706460095379882633958651034759773864354021315490712575535559549015858088608.0) 23286645405607099799151331553995799851855144387826191186590140820016670502830395945076644578998873585162998873396623634135231418574284200209367505115739462344028303923666952261030907434438322884189133236837089851688275865098623902644385995630973049587854251981548128145516004461191094062488421288607625783540996659060285661398859383778209495884203323937672739376151794507745282074538961033778823733980759695886879886017489555795079194346438911010371103435094677167286870898482214310646392174423422237727456012197253183422715313378603607058548706460095379882633958651034759773864667985255108546985624562479314312358520.0)
  (num-test (+ 2000877973959266893810594143560134441447453310844726478119781029700338468704683515329516333146806175216349912753585564808803731447160643580198590073658869.0 -17993015014355471903.0) 2000877973959266893810594143560134441447453310844726478119781029700338468704683515329516333146806175216349912753585564808803731447160625587183575718186966.0)
  (num-test (+ 5492930533666246223206322654398877802091439062008700770880939594548305919677404080859141226095489505872709347538974725998600861651942609010590873980143878.0 15372278140141207703.0) 5492930533666246223206322654398877802091439062008700770880939594548305919677404080859141226095489505872709347538974725998600861651942624382869014121351581.0)
  (num-test (+ -13405500833215428652808705089190188280715732437731292502890523313631564795139560159124390691283401484515088713758307366404145018349044148223082253439210893.0 -14793401891248640808.0) -13405500833215428652808705089190188280715732437731292502890523313631564795139560159124390691283401484515088713758307366404145018349044163016484144687851701.0)
  (num-test (+ 9945195259699924701593703207751086973468898794114625092150620088406276196469184233537941913755508476427888065765634203723512911676149274871082481174186606.0 8699133332160461067.0) 9945195259699924701593703207751086973468898794114625092150620088406276196469184233537941913755508476427888065765634203723512911676149283570215813334647673.0)
  (num-test (+ -1785165974800693006461065312083337532938610906605533088558498259067461510781028452552786542598361030690629530721209490413999022804146471920873844686294838.0 -13079925952361275418.0) -1785165974800693006461065312083337532938610906605533088558498259067461510781028452552786542598361030690629530721209490413999022804146485000799797047570256.0)
  (num-test (+ -4861207515430071951958387366611380234482792653010151054346367776006873932152600469133110239669746470475230906073865131648496652783311445471793936775767736.0 -9381557743227419896.0) -4861207515430071951958387366611380234482792653010151054346367776006873932152600469133110239669746470475230906073865131648496652783311454853351680003187632.0)
  (num-test (+ -6638723469626495957966112633999375479181736600737250559572415894485618850919815869703127084789143821420728194272094956858541960962483734293877093635361160.0 277811698220276334443479876776376776138.0) -6638723469626495957966112633999375479181736600737250559572415894485618850919815869703127084789143821420728194272094679046843740686149290814000317258585022.0)
  (num-test (+ 1983880417172931934469534542170437296262471214582817006917470485544552211448284732460451903536334682269123998240709059499894818265755197559390728940140016.0 -118940994129137705779355371753506018694.0) 1983880417172931934469534542170437296262471214582817006917470485544552211448284732460451903536334682269123998240708940558900689128049418204018975434121322.0)
  (num-test (+ -9354509264984586574958285335910611806441061705184818350015454221731287473282231343722010109181841005578131927454778025302197744540571159656556971614966757.0 120224841184491944160266976391113485817.0) -9354509264984586574958285335910611806441061705184818350015454221731287473282231343722010109181841005578131927454777905077356560048626999389580580501480940.0)
  (num-test (+ 4389359421234641412950681847970318834150108533025088077429496538447029921663033978550089607257809597829358374972237448178553189381274150213236222139873594.0 106674783386899772113212633712093787897.0) 4389359421234641412950681847970318834150108533025088077429496538447029921663033978550089607257809597829358374972237554853336576281046263425869934233661491.0)
  (num-test (+ -9319417879153488839579936799737117639058244394679644240663244688680826325564084529474537634510092069422987165268448907193562300482925125162731530249763801.0 192969103435503875767216559494769734726.0) -9319417879153488839579936799737117639058244394679644240663244688680826325564084529474537634510092069422987165268448714224458864979049357946172035480029075.0)
  (num-test (+ 1394404616168163951844558734723678125985464491792846741433683801962971891047718103736551854371207400145441134823994228143957746922511631911996296931168332.0 -211230038021470285136061932161632203274.0) 1394404616168163951844558734723678125985464491792846741433683801962971891047718103736551854371207400145441134823994016913919725452226495850064135298965058.0)
  (num-test (+ -2935941510094051560788359387128767361559188973149773593522440619832472030019457317998381634585179453958737810428870232715146002408187749944694186205812791.0 -1221176156661231926164756142840452419679061324806989304452215660535991083923207702827717652226257158321829748247784282139952864899457896871473184473608543.0) -4157117666755283486953115529969219781238250297956762897974656280368463113942665020826099286811436612280567558676654514855098867307645646816167370679421334.0)
  (num-test (+ -1338674579024795395027232680327531457830908239605718353094975139226848400289367913459076082700361212506196070727982446232782659114647371030398516119682505.0 -1298372177520411182435886041880377054374169787570856408996533471838082317927648953576721017727347029007573543972764860712708420553928791798580799809858729.0) -2637046756545206577463118722207908512205078027176574762091508611064930718217016867035797100427708241513769614700747306945491079668576162828979315929541234.0)
  (num-test (+ -2072456075229532951804023218627137969798924912365258263779029006567941400203608770518731715660383378937120213112973528605594220795605977413985543331908189.0 -9744489461776287963808523409593616918248399004543154581056479712028497082820841423941781438667661074968238703192056877665754560746003512076830245760254982.0) -11816945537005820915612546628220754888047323916908412844835508718596438483024450194460513154328044453905358916305030406271348781541609489490815789092163171.0)
  (num-test (+ -2570682164188734368809161664810917340861573482754788446510182252413437925852206735928397938304353826925422441004271229738766803460790995673395984247950088.0 656920705293329551826685120408221577679101260931105312141757138825917579070505267306626244216341686712802796891966598838285570807961966448181138356047523.0) -1913761458895404816982476544402695763182472221823683134368425113587520346781701468621771694088012140212619644112304630900481232652829029225214845891902565.0)
  (num-test (+ 7846359203342053693101523606887617345982401999003795257520576318451663998927274759872692123323796450295314377046602880394071105863527900699633560551732837.0 3683380639347829102597675045842249667669675715600522157867595962635108482512780509393310714588544837398923613138772339053021025559943198965234376657126821.0) 11529739842689882795699198652729867013652077714604317415388172281086772481440055269266002837912341287694237990185375219447092131423471099664867937208859658.0)
  (num-test (+ -11692323148567132684205145901751681947225824260005631214936266006610207543813382900867093989444659986091234552140689684476541703112098935301322850961583953.0 -8534276689564199122569555420819240948691777228327984555753862457592427992599992931175844172478864477440165366128106812103785256271256853749622592560655914.0) -20226599838131331806774701322570922895917601488333615770690128464202635536413375832042938161923524463531399918268796496580326959383355789050945443522239867.0)
  (num-test (+ -10734754884168724884333968138739681643742524619139397687680049322697740991391014196697040576174049452737571835233123127815762146577096625434481167057340772.0 17059878151450238567815178684522345445687980385106446646013863901583786249398194029757376950491550197185231926262467028755342392379269039238766592672298850588065335172902157386017520689203005559576263548017475991638498600879259882041932152385436968424098224966518534467302264172016376096778201462205990822825056602379115848799619564610033123837036507127427054121975400703490855123544706355545059512146550901507159940126280812512339749605195422987937677650572797378799103456094203126081464905326203083057134061673694975250599375795827437561275156235513192978645909947341297774926450637694325145427434486258223666250272.0) 17059878151450238567815178684522345445687980385106446646013863901583786249398194029757376950491550197185231926262467028755342392379269039238766592672298850588065335172902157386017520689203005559576263548017475991638498600879259882041932152385436968424098224966518534467302264172016376096778201462205990822825056602379115848799619564610033123837036507127427054121975400703490855123544706355545059512146550901507159940126280812512339749605195422987937677650572797368064348571925478241747496766586521439314609442534297287570550053098086446170260959538472616804596457209769462541803322821932178568330809051777056608909500.0)
  (num-test (+ 1982582032974021971225071139786536402936929744496433027195224299475980201425925452469321205602618940472354066218156609448199804973454183972974358405933935.0 -5591374624026484498020036332218412149978824230210339582240360391202660977358546150723165491729699122647688030937226316069237264083850854032732663284717882873051337566653841254365703461654061656817936193716386141166210237666314879751427421825450110467888973152907618520704486700443275358649289847595635931220181024199692771066498714511145489237541761266539978351840438236927937894376002981658065431416811632941197501676956304254109064936038146674412392128883565757325842468006824235119684861972224857533964558963441079998949499582965764591461900562931342373507763081479989957632695010603500633322408246084430203281475.0) -5591374624026484498020036332218412149978824230210339582240360391202660977358546150723165491729699122647688030937226316069237264083850854032732663284717882873051337566653841254365703461654061656817936193716386141166210237666314879751427421825450110467888973152907618520704486700443275358649289847595635931220181024199692771066498714511145489237541761266539978351840438236927937894376002981658065431416811632941197501676956304254109064936038146674412392128883565755343260435032802263894613722185688454597034814467008052803725200106985563165536448093610136770888822609125923739476085562403695659868224273110071797347540.0)
  (num-test (+ 11532228364136654310006206557545352284448588590560137249197311142901246089838098630841794341370689745410654263817911440601934362503092628725755210859171724.0 -25776236925500995542036591604259749301547568770017466769502569415611770276300787105037848049555500555975152877716727294374436703766730618054071617947449695177320842403963009384468257891933593584757723535299746543328292715942626303315235241470269740287031317322772461137186093930239744879822272349431389779234805703118929710210161489122272898252221025966631463842234537744822906696719691188223105175714602909117904182229960075276443648211003011686250829474364425483901920822837775032295913486152631638908227467242772081310515646217115760180349854601959031626524004201825198439309850266508687796415478396821644422350208.0) -25776236925500995542036591604259749301547568770017466769502569415611770276300787105037848049555500555975152877716727294374436703766730618054071617947449695177320842403963009384468257891933593584757723535299746543328292715942626303315235241470269740287031317322772461137186093930239744879822272349431389779234805703118929710210161489122272898252221025966631463842234537744822906696719691188223105175714602909117904182229960075276443648211003011686250829474364425472369692458701120722289706928607279354459638876682634832113204503315869670342251223760164690255834258791170934621398409664574325293322849671066433563178484.0)
  (num-test (+ -2603756427337798371354526130541868239006085657393372011847827118826669474695402075575479286172808099892726251004549675772420422527946534088483901153485670.0 -10844269742362409682236511127219508926736627172993604953084481596070757241623728297275447608738915355190715664012379562650777199088096670239050254578284071100042116609747208178716191571268815994455064584659920497876052406993834873124981417288518101426395560764186717660091472734401090302285129741058888303693710456902635092811413971399734306158050053239768185860958896447298052082493590498954512083131068867270078638929796561440903919430094619437872896595720463663570751134804664228918188923926951933302878771189484614604311920655871182974081898031051411394311700207305532216445616083858025977851570522763537300875989.0) -10844269742362409682236511127219508926736627172993604953084481596070757241623728297275447608738915355190715664012379562650777199088096670239050254578284071100042116609747208178716191571268815994455064584659920497876052406993834873124981417288518101426395560764186717660091472734401090302285129741058888303693710456902635092811413971399734306158050053239768185860958896447298052082493590498954512083131068867270078638929796561440903919430094619437872896595720463666174507562142462600272715054468820172308964428582856626452139039482540657669483973606530697567119800100031783220995291856278448505798104611247438454361659.0)
  (num-test (+ -5929887196386997518766568868806997104240129372360669348628384183712406620199102166145939206783172815805659513128544493795329100599632286529420772709366102.0 24544958491142793859949310604465694574872439331169358241746200808802938771527900616394258199996170862256988647191747967628756772368808644819831481350919782560499270148419601775750932556119448001824346026042068416905254113155445053931789404515589532235225580737103411251232560863878948880220469490014568323308965914171394449781093816607870593225534700167342589927524232815571862258490314644577819742372918446373756857848586825568514909823940075182825283229026250682015641747568282510036326125505522447591703308661608718100933027549520132308555240654655887041040427813131621391320267698106519650611462269033902177180035.0) 24544958491142793859949310604465694574872439331169358241746200808802938771527900616394258199996170862256988647191747967628756772368808644819831481350919782560499270148419601775750932556119448001824346026042068416905254113155445053931789404515589532235225580737103411251232560863878948880220469490014568323308965914171394449781093816607870593225534700167342589927524232815571862258490314644577819742372918446373756857848586825568514909823940075182825283229026250676085754551181284991269757256698525343351573936300939369472548843837113512109453074508716680257867612007472108262775773902777419050979175739613129467813933.0)
  (num-test (+ -8848084327536592532063677611386811805244460767433749071435930786126721080365289638381557872263825830664387392539638767251180242665642373539064690745095464.0 -15917950175678012281826361248776190984758236997789474333609547749168308439513527143790323694526378056113636462939674273462177686456811495629631337058042159570336251822399402513133598701991665209363955263097315081570618652783181494594400709239428597117944511110842795526862595552977665064029517628515465251448116061875878430407784298951946811321795808932206846491091803276390661869369638950672478828532423383951689632136029256108992610781912267083149156104328033893238864631158195280554850035949666897861529711006187241710164902350100555999894332438423857208747342184052953230247487231455921360593096823760117493579248.0) -15917950175678012281826361248776190984758236997789474333609547749168308439513527143790323694526378056113636462939674273462177686456811495629631337058042159570336251822399402513133598701991665209363955263097315081570618652783181494594400709239428597117944511110842795526862595552977665064029517628515465251448116061875878430407784298951946811321795808932206846491091803276390661869369638950672478828532423383951689632136029256108992610781912267083149156104328033902086948958694787812618527647336478703105990478439936313146095688476821636365183970819981729472573172848440345769886254482636164026235470362824808238674712.0)
  (num-test (+ -16314775600714318471451792035636584056297958597339492996728118376578145765736873313518831390349547274517050864260054903974054712997529177834428786007341762649083404743713562157667828894017440065599882523458121037421757904691003094608420565550031561905074671735751685371533975894842331113347413787808917193134135744321547478500861021485075363990553639161661734684228250909589741380076008551020384304303171431833670236949934603973673998262066558668396388979463892768199916011368116729432353268535563246463324517035331079693172060671712718486388759443825620676228470068291448236914050793177812037679396721657020438979754.0 12553426083939460917.0) -16314775600714318471451792035636584056297958597339492996728118376578145765736873313518831390349547274517050864260054903974054712997529177834428786007341762649083404743713562157667828894017440065599882523458121037421757904691003094608420565550031561905074671735751685371533975894842331113347413787808917193134135744321547478500861021485075363990553639161661734684228250909589741380076008551020384304303171431833670236949934603973673998262066558668396388979463892768199916011368116729432353268535563246463324517035331079693172060671712718486388759443825620676228470068291448236914050793177812037679384168230936499518837.0)
  (num-test (+ 20637030084881771176788188367974505419050866216433677435050410899110162793040751338330447574748263391136356400036001988938659722098883893353523409458775455519257672423829361150611806294256710309281788819450225670112435352092313483086404714074567539245791066202051788986426960935796927738180831688497683293306590464598379493141645539253898709000874685535467854788184424886911457134522632486730390913239660179785071885982403741669161655812015114272497907946919026898579927936299607156006210124954460880383605958519412435713868501997649784658832599101777001703519408664662715322044086646014163774269660274683400619225321.0 11620128128044940816.0) 20637030084881771176788188367974505419050866216433677435050410899110162793040751338330447574748263391136356400036001988938659722098883893353523409458775455519257672423829361150611806294256710309281788819450225670112435352092313483086404714074567539245791066202051788986426960935796927738180831688497683293306590464598379493141645539253898709000874685535467854788184424886911457134522632486730390913239660179785071885982403741669161655812015114272497907946919026898579927936299607156006210124954460880383605958519412435713868501997649784658832599101777001703519408664662715322044086646014163774269671894811528664166137.0)
  (num-test (+ -9838804688358141062268493389453191808060717708062736103828856866310283812230958467655270667206937622979717683919584610288962829724022506216738929136418489468786902364550847498615864720240589837282441807174290461916292258263929411081218952357662703079709351365960916688275651864441386750529258343003652300629003597744958152243494244227986280506395347894285277364095898602965258114321853474000520432831298793365139040664543928707100657375292032051256485942532600998813627925626928634068613637417702688610315924917761411247617905738119218110678854564441914784262998574445847209847985439514580300936248281049628734475702.0 2380166482232871816.0) -9838804688358141062268493389453191808060717708062736103828856866310283812230958467655270667206937622979717683919584610288962829724022506216738929136418489468786902364550847498615864720240589837282441807174290461916292258263929411081218952357662703079709351365960916688275651864441386750529258343003652300629003597744958152243494244227986280506395347894285277364095898602965258114321853474000520432831298793365139040664543928707100657375292032051256485942532600998813627925626928634068613637417702688610315924917761411247617905738119218110678854564441914784262998574445847209847985439514580300936245900883146501603886.0)
  (num-test (+ -30961575335426221869515496362216292453766907587859856766456625722888557357647164641922707199324601608700561081422636642523431947551124957385652791834855425829101761914145137205962610515642614866296480715893528289170482422505734612327038754622917335073993027434927547277037587173529054849390646376806910407207016292483185533697336599641898250465186168797820802225861771331652801064811222606773495565340386327294310913503461903243119204619412324538886439122443769008953829820425376589389335553937319588224864611583436327810214798652896733118881040503785110481197462772022447173744898802421806800203373153221004361953729.0 -10586442965055062759.0) -30961575335426221869515496362216292453766907587859856766456625722888557357647164641922707199324601608700561081422636642523431947551124957385652791834855425829101761914145137205962610515642614866296480715893528289170482422505734612327038754622917335073993027434927547277037587173529054849390646376806910407207016292483185533697336599641898250465186168797820802225861771331652801064811222606773495565340386327294310913503461903243119204619412324538886439122443769008953829820425376589389335553937319588224864611583436327810214798652896733118881040503785110481197462772022447173744898802421806800203383739663969417016488.0)
  (num-test (+ 8835746018617511846981408800319983340292665114153404569022025834059427359831684523399830234196625160662387716033871154398104436720494608541518837969397374272734698261557358249258503982414578618525420572597611597792132117034895074841909295420434392963714805547538976612884853497014341345150095544449860198192757839489063747595073430612069212219930749783824683135433987509303139260133564905961552149844964215891730262218278214035649706577154652729844092199333026620127958228847111442161350881527928460177763370427262298116900358910460957772350452949782281117704005514462730290063772968929608448642592954601418753021512.0 -12227722924075527556.0) 8835746018617511846981408800319983340292665114153404569022025834059427359831684523399830234196625160662387716033871154398104436720494608541518837969397374272734698261557358249258503982414578618525420572597611597792132117034895074841909295420434392963714805547538976612884853497014341345150095544449860198192757839489063747595073430612069212219930749783824683135433987509303139260133564905961552149844964215891730262218278214035649706577154652729844092199333026620127958228847111442161350881527928460177763370427262298116900358910460957772350452949782281117704005514462730290063772968929608448642580726878494677493956.0)
  (num-test (+ -5455184800550144006991157215735481579353213544152145628297990102571936052187486515129266239245491863623978659179559754999567936067584384479787934704340911556625153536160778495579370425428019248950494107696016864499055854257192071541354806671987402367524770228296322497224645429524493838356022616251290117624472061673033274133156467148770562815676767117605001434288573911556053311048284534341905722947046607192815465807736361991479044698448267471087552952494477144251510778491315012457514838113324210534577956298926109164909779987221094000880908857594198276812276890284008572664102792405452379662935026125770444036994.0 -7349798942312432150.0) -5455184800550144006991157215735481579353213544152145628297990102571936052187486515129266239245491863623978659179559754999567936067584384479787934704340911556625153536160778495579370425428019248950494107696016864499055854257192071541354806671987402367524770228296322497224645429524493838356022616251290117624472061673033274133156467148770562815676767117605001434288573911556053311048284534341905722947046607192815465807736361991479044698448267471087552952494477144251510778491315012457514838113324210534577956298926109164909779987221094000880908857594198276812276890284008572664102792405452379662942375924712756469144.0)
  (num-test (+ 27233955893140063612427006607965940109569052437681267421929959186535416115028420267622879017163568256526042146282241931623674996867133390355390677118211537487769195270234259640386625552763891339073878417517169618832945750393661600092643257470064376916337734385887099957095417541169462231630821139075814859604097878094729685589777579267192538715202397220666651307185763054526407234767132218634060693076054116575833737797189157152326979078121760900891899319809724675232853322526718686306470372869701173824664984405178677187081936624687293494821338781534163633206006387449585716391843039459733925494003066841874935048611.0 -66646390577667468207341453008390168215.0) 27233955893140063612427006607965940109569052437681267421929959186535416115028420267622879017163568256526042146282241931623674996867133390355390677118211537487769195270234259640386625552763891339073878417517169618832945750393661600092643257470064376916337734385887099957095417541169462231630821139075814859604097878094729685589777579267192538715202397220666651307185763054526407234767132218634060693076054116575833737797189157152326979078121760900891899319809724675232853322526718686306470372869701173824664984405178677187081936624687293494821338781534163633206006387449585716391776393069156258025795725388866544880396.0)
  (num-test (+ 15030400024888781078933103028897733817304421960545019199443871381537070197157227994520524631721701055962609956080413517776229513420814407790533237358129529547793422514837651333555776540939235592155512951229106778709351772195248438493792786143040421233061520515971787881798980515709417481015662862327435825812557205663033601853937647320838585333754027488605638576977560072206293290493215523194883494322543800546276353830683084405428005815296131527861252717516620765986589669237487765523936713749717927502645633123584240464131140829496052170285171610845098023517906586134613874506419828208611247177336492131262918439281.0 -164048419232636429449474429717211197442.0) 15030400024888781078933103028897733817304421960545019199443871381537070197157227994520524631721701055962609956080413517776229513420814407790533237358129529547793422514837651333555776540939235592155512951229106778709351772195248438493792786143040421233061520515971787881798980515709417481015662862327435825812557205663033601853937647320838585333754027488605638576977560072206293290493215523194883494322543800546276353830683084405428005815296131527861252717516620765986589669237487765523936713749717927502645633123584240464131140829496052170285171610845098023517906586134613874506255779789378610747887017701545707241839.0)
  (num-test (+ -10227062646189307616073129048534031298512434237226774743330733206156788005874968173984804649812506029813402205606562016228122184161577517837608957023376079537037472977098465137152327215807765130656192272994478964341604278041664840636982572214751638093860605132350960802560601354006634296348422600320863531059118477125143903734159707623839282511184908969206873548650544269932394344952983661665472663102992782521888857016369837211403335306200813816060883478434441858442549261115972947741929087886423170398410216855322384956160289855500229952405068604320121652911887067414460828300146993858360430784079225137421074839819.0 117460076430162201914796277915447781936.0) -10227062646189307616073129048534031298512434237226774743330733206156788005874968173984804649812506029813402205606562016228122184161577517837608957023376079537037472977098465137152327215807765130656192272994478964341604278041664840636982572214751638093860605132350960802560601354006634296348422600320863531059118477125143903734159707623839282511184908969206873548650544269932394344952983661665472663102992782521888857016369837211403335306200813816060883478434441858442549261115972947741929087886423170398410216855322384956160289855500229952405068604320121652911887067414460828300029533781930268582164428859505627057883.0)
  (num-test (+ 27989453264793973121573869640708223239762902243991948581280654553806618470632044367386680716040316895884976837122054709584963028986161694425215067648887944710852278135008221491665079705797192389681328802747226171436158375378499411314855257919224316919346771317457123252623293612958336691335423245293660257386649100685560072354549579281852792682734916555498283053758141666658137856828164206947320523255487437004565021167276952652515632644458005291855624829941937578229983628962137595011570216766689546500517528191189928660433013004254032861383790553611840534023221000900694995707453499030166286828319347894538505334235.0 -59175168207571178843658955348404514921.0) 27989453264793973121573869640708223239762902243991948581280654553806618470632044367386680716040316895884976837122054709584963028986161694425215067648887944710852278135008221491665079705797192389681328802747226171436158375378499411314855257919224316919346771317457123252623293612958336691335423245293660257386649100685560072354549579281852792682734916555498283053758141666658137856828164206947320523255487437004565021167276952652515632644458005291855624829941937578229983628962137595011570216766689546500517528191189928660433013004254032861383790553611840534023221000900694995707394323861958715649475688939190100819314.0)
  (num-test (+ 1178650930337394440162727078866515771626896502845852711186000991913866844090831426017480263676964607121490209778220339316756171449922437605552456088105443130477974682689512446683178356259305893852096425478878588001446154476458310269704392486398646169362313605456233489086567865316333034897433650974160168545492823208575634152241341906068149887959566983066154182855136114289266802474404127414747112706158621650063987662749553991791509795764642256261917497984177610694405881831052199417235241109412927893781778469398975117797578753730248539151297798807326284978255001046995523851829184120171969918537718488250577987049.0 -151873924489040812813761508259707631973.0) 1178650930337394440162727078866515771626896502845852711186000991913866844090831426017480263676964607121490209778220339316756171449922437605552456088105443130477974682689512446683178356259305893852096425478878588001446154476458310269704392486398646169362313605456233489086567865316333034897433650974160168545492823208575634152241341906068149887959566983066154182855136114289266802474404127414747112706158621650063987662749553991791509795764642256261917497984177610694405881831052199417235241109412927893781778469398975117797578753730248539151297798807326284978255001046995523851677310195682929105723956979990870355076.0)
  (num-test (+ 28233332719950979786871881804755080223325040620170668729385709165879717973040387558150293205758215739710262749733170837042434162049732587908182282319848154049410849721309988807368466228286699721201975848741931128639324322061892706638973259354962358866000024260698793885547287093369940035337370984725857550291339492871017395328145015077506882578124550084937438336881072124376107623716831044079223921566902242543198986921476998895559488862309653154914291349588095330683589871173449191854284433182368052817373384461363574550061788800329400860372148193491004593903732351395815409821222597665222975816418433744748143385431.0 -43245950360315656184924888243641533635.0) 28233332719950979786871881804755080223325040620170668729385709165879717973040387558150293205758215739710262749733170837042434162049732587908182282319848154049410849721309988807368466228286699721201975848741931128639324322061892706638973259354962358866000024260698793885547287093369940035337370984725857550291339492871017395328145015077506882578124550084937438336881072124376107623716831044079223921566902242543198986921476998895559488862309653154914291349588095330683589871173449191854284433182368052817373384461363574550061788800329400860372148193491004593903732351395815409821179351714862660160233508856504501851796.0)
  (num-test (+ 17311283930487575047109155431670372891723312431004343097275158353815289445461275098157423001160013464866170709729134076291306322952612660169010483426086431377525432637844274608988581691477819008626983761905899834444008235608280930166913911248710072733217113558125600345343437000427963292980921009445490627620344145866648036116660335905940809860199697939729919140888034303887423527841395304960072549430314367914315102150378504502158659627719016733307736583749830415574905929299482373462584995162798576853564481617711234957058703455021082855018642616999836886763535412642684228990890160568207941504887072856663966242787.0 1954009743321912552050341299974626734964446274711484506734354360114801426013796892421541915293157994203607853436799102383078659985249097057923578528366737.0) 17311283930487575047109155431670372891723312431004343097275158353815289445461275098157423001160013464866170709729134076291306322952612660169010483426086431377525432637844274608988581691477819008626983761905899834444008235608280930166913911248710072733217113558125600345343437000427963292980921009445490627620344145866648036116660335905940809860199697939729919140888034303887423527841395304960072549430314367914315102150378504502158659627719016733307736583749830417528915672621394925512926295137425311818010756329195741691413063569822508868815535038541752179921529616250537665789992543646867926753984130780242494609524.0)
  (num-test (+ 1135960177108146621604027872788612991247811085764456406834564014092038611848908717507207251239454266163702244932570537009884467598603226302482406831131219148530146321028801515381981782506355042255201016953375149829517466449677312249611502599434850555618739830488706171667035140895674806873502543300909514568759918040129665855731078258004983486524477103833885001539135541445685573269814159175744401893663504523858005835387122082112362666991112899837534230326730196110477118156871579503345757821268248575583821695674912517830056856597644827244194658166928026249459511837772775196175188368236573504643083995409774002567.0 -5513982495816270388232134254127393284677692173792609278582774509636977743203029647121158805174638642867428501907786521939155900331399058909602425073976766.0) 1135960177108146621604027872788612991247811085764456406834564014092038611848908717507207251239454266163702244932570537009884467598603226302482406831131219148530146321028801515381981782506355042255201016953375149829517466449677312249611502599434850555618739830488706171667035140895674806873502543300909514568759918040129665855731078258004983486524477103833885001539135541445685573269814159175744401893663504523858005835387122082112362666991112899837534230326730190596494622340601191271211503693874963897891647903065633935055547219619901624214547537008122851610816644409270867409653249212336242105584174392984700025801.0)
  (num-test (+ -30369736932762868789456108597366835061749107555998091727589163626331595118680326568212941898571309672187038272915036839449380083450246957904300051802617002374912724325419651633014408152565340519439718081357147324136023867003917288524338643759680061563616479323818330115572573568245719292922176485298767387601922362893307843067637295955606642841006993776777666041277965868780958830666697755738164183356399977211227424725670822944234275611849032230010745799964550976844117943559190671369193871330514473741920389633762695829790016565565261170688485790141638094160105909405353382982945608773290740598479367828342651860878.0 3451570547959142767282758882796967240086418127970526029661337442068316209707489088420708984628065070358319478649952710478991064476168799556496237099109563.0) -30369736932762868789456108597366835061749107555998091727589163626331595118680326568212941898571309672187038272915036839449380083450246957904300051802617002374912724325419651633014408152565340519439718081357147324136023867003917288524338643759680061563616479323818330115572573568245719292922176485298767387601922362893307843067637295955606642841006993776777666041277965868780958830666697755738164183356399977211227424725670822944234275611849032230010745799964550973392547395600047904086434988533547233655502261663236666168452574497249051463199397369432653466095035551085874733030235129782226264429679811332105552751315.0)
  (num-test (+ 24749014370880469345815230363662696846133977441600857690896762642529872426102613384561609594131771018575590861342023688138502403609639138062665279129058939911797019091643704220495944170754490238422880589600838613701783818105188827633578438439212856537589855796204839275633245851474930725845096235668385012500773524750522781174430369067441632028068262240870795850561389232369373523415592833273932285308223863420210049445377497367753786125779044716949754454461623397410528064697616617917065021866397277409044449982605591256067763430930720398889239414812509701319783809830072841056369381573100589260104551934136733317845.0 -9461623592584966196513107657889418526847060851423069480904645009418813160370721071067349946095573698635859409908288864150475056170059858850823883834932131.0) 24749014370880469345815230363662696846133977441600857690896762642529872426102613384561609594131771018575590861342023688138502403609639138062665279129058939911797019091643704220495944170754490238422880589600838613701783818105188827633578438439212856537589855796204839275633245851474930725845096235668385012500773524750522781174430369067441632028068262240870795850561389232369373523415592833273932285308223863420210049445377497367753786125779044716949754454461623387948904472112650421403957363976978750561983598559536110351422754012117560028168168347462563605746085173970662932767505231098044419200245701110252898385714.0)
  (num-test (+ 19070246171469235561279483225919489206942407814032615339351735800304747459507922411906751965555240682457214768298108831815622470433175555196912899313888991765436434867025639919521068437191248198117664398275835972573354886915721765715992151871453808224011999677700078879590132676060988550961950472536029228350169237717222998397029428440792110955380302156159849645211726041489206565536560827557279129751110297078563108009278363910936720061216511798518178957070787710331228500533067546198458251241005176280410230146430275074766072259256583499095689284871987010372039977403712023630453400259082684930755893684499232318008.0 12330599952818018622104330691506128012101935028731995985677032980931398338453806827555760801312052792065671886621851470997557806941112316627790755867100463.0) 19070246171469235561279483225919489206942407814032615339351735800304747459507922411906751965555240682457214768298108831815622470433175555196912899313888991765436434867025639919521068437191248198117664398275835972573354886915721765715992151871453808224011999677700078879590132676060988550961950472536029228350169237717222998397029428440792110955380302156159849645211726041489206565536560827557279129751110297078563108009278363910936720061216511798518178957070787722661828453351086168302788942747133188382345258878426260751799053190654921952902516840632788322424832043075598645481924397816889626043072521475255099418471.0)
  (num-test (+ -20895998178036569919774658790651496115060841511658297683195804524712012347695091074325978179977718571444320688167469052862702339462089668992243209990795362064005869602003990235714500149401994013174762139297327430396441552225926368085284222509085197484452650071390132794942944512235132641643003294762547138305644086106533258432786768644384855008506026923783604514268955071498269812887794817192371944269611642901807443894686178438687102834127061425955994253034824027771176714559050403098437684091684851207513969915720607528045624635094984539637789113651579846373399975502788877555747414523231999341294756679330384323996.0 764238600803843266244444637050072967342049538611688895792923539838804953492110953673720766879606601435939162680753428779068917662740403667549850724878795.0) -20895998178036569919774658790651496115060841511658297683195804524712012347695091074325978179977718571444320688167469052862702339462089668992243209990795362064005869602003990235714500149401994013174762139297327430396441552225926368085284222509085197484452650071390132794942944512235132641643003294762547138305644086106533258432786768644384855008506026923783604514268955071498269812887794817192371944269611642901807443894686178438687102834127061425955994253034824027006938113755207136853993047041611883865464431304031711735122084796290031047526835439930812966766798539563626196802318635454314336600891089129479659445201.0)
  (num-test (+ 6243894672855694190803081952962387322599009058758027960092936187687064819462191583137945440936085088260632250436567758576422207449236613172605950116622271404444221039084346501796818945639456207912207604248991842124079786471250102192718092353598850889806607728696519257402580732995770031331187089424192803722612735557735028710899438934171272639518928194764526910590046378401600819132587804143949995694950116915803127294011661411525934100144319021440919928013617766507409909846670172516021888661284467975865076091834094160862228180625536450124272957206172214541444266874056050295270719541605687740822711659847211976891.0 11877496607682442993105675644902145742318375725225741293060927105303783712520284640625374957608051032540491531573337817824773543104969422017506696018037874641947740606655370938613842356322585858034851150595788166740174872996252792014218946552442572806242471174234462119454014379628228878122072189387777413014452140618318641689597452676091677588204537830401725113931418426919671512011822864583481449136550835952005765386885680701637038206002172218712504732572449659704181315669255320876647592649071711438131711904976335957846353867776093588236311654631696625859173554395714740218099921290128795607292259527492722462071.0) 18121391280538137183908757597864533064917384783983769253153863292990848531982476223763320398544136120801123782009905576401195750554206035190112646134660146046391961645739717440410661301962042065947058754844780008864254659467502894206937038906041423696049078902930981376856595112623998909453259278811970216737064876176053670400496891610262950227723466025166252024521464805321272331144410668727431444831500952867808892680897342113162972306146491240153424660586067426211591225515925493392669481310356179413996787996810430118708582048401630038360584611837868840400617821269770790513370640831734483348114971187339934438962.0)
  (num-test (+ -24023960171862805266003610953999097357395283354964456554686635290239019705581779621120391229617494503580661676939681517550103414632840981987397485411400553792707518662609532504246677658012933762605038799352109564432278094548068984563394926376371580465135388578139331334464060067790936072127680597181415407099723844313625277987147283697141407959289588588489162704824409673099509423520008795428217612706997355591985894255450783091681112776112997887084157623388943538145736618168104404283342039105202585543852590302154958791010622670839015475427693311663800177428904406869645066988663292128104453773413982185343111560886.0 -31939808827732134714870375774276102357277346245583282398423150631754622253109692213928642228787888509211781331649081002266227303203259124984426497846441848502574293640959494009564992092503141598640200823656998243767453860939156780549404892392521391484933772285520949470194562525777116137058001008184603332597820522016200623301007194309404025522056113671560767212894303567191067178003014955596425115379852712737129325098876542459702682095445350281859042779889411325882123213577906096942649941285655935053362468972482748617111598313960198743596285343178242282172686940700127068972627110105953098737923773182254460772630.0) -55963768999594939980873986728275199714672629600547738953109785921993641958691471835049033458405383012792443008588762519816330717836100106971823983257842402295281812303569026513811669750516075361245239623009107808199731955487225765112799818768892971950069160863660280804658622593568052209185681605366018739697544366329825901288154478006545433481345702260049929917718713240290576601523023751024642728086850068329115219354327325551383794871558348168943200403278354864027859831746010501225991980390858520597215059274637707408122220984799214219023978654842042459601591347569772135961290402234057552511337755367597572333516.0)
  (num-test (+ 14513652183174940741664411990199277445706189147726874603036586212536012746892966848269748909379750612027025331446918381470766609543142456872580466135425754204680927122749772612276850998180593344389487924747722210296498854143380696064338777945015153982467675141485724865534995199700908286263993697988986805404864429385840512740226775506122190698806967785494289035976495492863456705096841250592980439363856397663738211335801835896091823148249303370609165910779981271035234045185574995335952208702661648744928539539455138167482396767268362221492607154709559716065850417221174683768503217544145599044845325824451589309835.0 -12814535978730024053359592817368712576084646962861720729844389627130663192435154658607204342320327460695280260731620465435530495952836598646143907272825807563512741964987882356778796849529260646503692618525570185450780889283642116889481314560395290434301143877809550098309214046129802023655714098730144464028249594406616074059558969757405392170810220921023905546104487938441503430332099605473144930508420331873995741851604525954472341693863067199617721032815462094767522339305487934030130207039176659398466616780628644572276059410087128533031562978399689702766028716401176531098447698206272762966470643604141938670152.0) 1699116204444916688304819172830564869621542184865153873192196585405349554457812189662544567059423151331745070715297916035236113590305858226436558862599946641168185157761890255498054148651332697885795306222152024845717964859738579174857463384619863548166531263676174767225781153571106262608279599258842341376614834979224438680667805748716798527996746864470383489872007554421953274764741645119835508855436065789742469484197309941619481454386236170991444877964519176267711705880087061305822001663484989346461922758826493595206337357181233688461044176309870013299821700819998152670055519337872836078374682220309650639683.0)
  (num-test (+ 11356479761814008572465147431830778885327227506593483181241437802252618729479905490826767363633131720717461693888023278837835457496021519184903984385091047829540007466025527592005114414671285638168997562037691602144751434208304408870143450743278437854754504713023422097017723330207792526222436928747286558205279330508360438281011315147578105966454344087225699378388309094140949428028313539634103047841948634832398526343605363013644180832752120081735152285507591096001749463421326282317713079361827765412853023201330345752038722069405404812511739634687282327711258974520622248165974215116400638833123609666501349513623.0 -2451734542868054449539778460457497703609327132304922810342762480808881050209276687756391911546806187586640918078231508181876445466503459873508196878629364924241891220686182517218825181707207808769770392864734466652524094735160185556148554260517746279303022469784592528209667497664672945900929888144529727881050106027775707933311860110618130543481573815538047460723253898548348335762406437618625388229555824532715231231491787570056329865617082709588903922431713098922691537317839185452018617461891748518176708607861270770493263960554805373552348256747200291438630960804647686832667981625018361034564086859426490014044.0) 8904745218945954122925368971373281181717900374288560370898675321443737679270628803070375452086325533130820775809791770655959012029518059311395787506461682905298116245339345074786289232964077829399227169172957135492227339473144223313994896482760691575451482243238829568808055832543119580321507040602756830324229224480584730347699455036959975422972770271687651917665055195592601092265907102015477659612392810299683295112113575443587850967135037372146248363075877997079057926103487096865694461899936016894676314593469074981545458108850599438959391377940082036272628013715974561333306233491382277798559522807074859499579.0)
  (num-test (+ -1814184401790217165873937825605141478060935014868566665644215718762341535891730598045990231798382966074312671040257824056876679135909008140059087311700216658095793352051583071432744886316274989901835606602224927350560604355249919901932382803472476702792978322468747380191775778902733911968522382089332819162367884984027854067607561808704316828316820133400099093450636968732151876570835173932998599031643640476109466728761033062776578175554441947411139184426213290292577467587355369954997241091769769542810051228504545831588488726789173405585678190671534386784806998695797717346491308862362775748058331375692317599945.0 15466182953987394334491149436346080039471412309427279110582769586053943302670765125931570041904640518032832554998553018838321871748542118021556398569294085708441934948186080236498081517178574839977996802813431873543309853609838200338534343580791382510179184571852290959723696010410340740895530535423959476873857191548113125728667781953125153120447892632916574768078583174099545013854248664119997703948998871566374080719541931440495888606776561795893839624084254684939434035018741535261951124673664746010067859317726891535170781460914710499572006592206360512398012457295755926986236618644330364227754380084585899275327.0) 13651998552197177168617211610740938561410477294558712444938553867291601766779034527885579810106257551958519883958295194781445192612633109881497311257593869050346141596134497165065336630862299850076161196211206946192749249254588280436601960777318905807386206249383543579531920231507606828927008153334626657711489306564085271661060220144420836292131072499516475674627946205367393137283413490186999104917355231090264613990780898377719310431222119848482700439658041394646856567431386165306953883581894976467257808089222345703582292734125537093986328401534826125613205458599958209639745309781967588479696048708893581675382.0)
  (num-test (+ -27127130599753372624001250456405972983012981437652156246797208697430661165612459362971759027335854588888552031022264244768883843080959804690580574272908031271224646245152017114094021048441971097191444782106551075175878815012595015584723250801765859461211934306789890718268168352614164589637346918581658850565274510502652089457352942736418509881708568727739912127781455473660768550022762222130489047215089836402367851853412705556570667960548570630054608024914653686223423908494006675057953013815512203710764854485332282975729323105427143207127239069826750682633272289409910001698385240596625059970587393681128674617278.0 5719655139276246085992066702308194672442413085748146924567717361937179810269300239821879673460959112727066470468217892213025828988023367028158410455624528688729907493639908638553730770145274142147983721694721139760883483821883267129411125364089207412089113869427479340283853501026803387874124668123626271531796990801822527792189514551888019206405597994403243358155410088320317141454525417323186389587327532772638942220300149829241141659063128602316305332848477566686425551944956989370838072872906293845914921103561360871571846865478762953536949621421094416539099628942010528483544062050170673327754206501716239719529.0) -21407475460477126538009183754097778310570568351904009322229491335493481355343159123149879353874895476161485560554046352555858014092936437662422163817283502582494738751512108475540290278296696955043461060411829935414995331190711748455312125437676652049122820437362411377984314851587361201763222250458032579033477519700829561665163428184530490675302970733336668769626045385340451408568236804807302657627762303629728909633112555727329526301485442027738302692066176119536998356549049685687114940942605909864849933381770922104157476239948380253590289448405656266094172660467899473214841178546454386642833187179412434897749.0))

(test (+ 1 #f) 'error)
(test (+ 1 #t) 'error)
(test (+ 1 + 2) 'error)
(test (+ 1 - 2) 'error)
(test (+ 1 2 . 3) 'error)
(test (+ 1 . 2) 'error)

;;; an optimizer test
(let ()
  (define (hi a b c)
    (+ (+ 1 (* 2 b))
       (+ a (* b c))
       (+ (* a b) c)
       (+ (* a 3) 4)))
  (num-test (hi 5 6 7) 116))

(for-each
 (lambda (arg)
   (test (+ arg nan.0) 'error)
   (test (+ nan.0 arg) 'error)
   (test (+ arg inf.0) 'error)
   (test (+ inf.0 arg) 'error)
   (test (+ arg) 'error)
   (test (+ 0 arg) 'error)
   (test (+ 0.0 arg) 'error)
   (test (+ 1 arg) 'error)
   (test (+ 1/2 arg) 'error)
   (test (+ 1.0 arg) 'error)
   (test (+ 1+i arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))
  


;;; --------------------------------------------------------------------------------
;;; -
;;; --------------------------------------------------------------------------------

(num-test (- -0) 0)
(num-test (- -0.0) 0.0)
(num-test (- -0.0+0.00000001i) 0.0-0.00000001i)
(num-test (- -1.0 0.0) -1.0)
(num-test (- -1.0) 1.0)
(num-test (- -1.0+1.0i -1.0+1.0i) 0.0)
(num-test (- -1.0+1.0i 0) -1.0+1.0i)
(num-test (- -1.0+1.0i 0.0) -1.0+1.0i)
(num-test (- -1.0+1.0i 0.0) -1.0+1.0i)
(num-test (- -1.0+1.0i 0.0+1.0i) -1.0)
(num-test (- -1.0+1.0i 1) -2.0+1.0i)
(num-test (- -1.0+1.0i 1.0) -2.0+1.0i)
(num-test (- -1.0+1.0i 1.0+1.0i) -2.0)
(num-test (- -1.0+1.0i 1.234+1.234i) -2.234-0.234i)
(num-test (- -1.0+1.0i 1/1) -2.0+1.0i)
(num-test (- -1.0+1.0i 123.4) -124.4+1.0i)
(num-test (- -1.0+1.0i 1234) -1235.0+1.0i)
(num-test (- -1.0+1.0i 1234/11) -113.18181818181819+1.0i)
(num-test (- -1.0+1.0i) 1.0-1.0i)
(num-test (- -10) 10)
(num-test (- -10/3) 10/3)
(num-test (- -1234000000) 1234000000)
(num-test (- -1234000000.0) 1234000000.0)
(num-test (- -1234000000.0+2.71828182845905i) 1234000000.0-2.71828182845905i)
(num-test (- -1234000000/10) 1234000000/10)
(num-test (- -2 0) -2)
(num-test (- -2) 2)
(num-test (- -2.71828182845905) 2.71828182845905)
(num-test (- -2.71828182845905+3.14159265358979i) 2.71828182845905-3.14159265358979i)
(num-test (- -2.71828182845905-3.14159265358979i) 2.71828182845905+3.14159265358979i)
(num-test (- -2/2 0/1) -2/2)
(num-test (- -362880) 362880)
(num-test (- -362880/1234) 362880/1234)
(num-test (- 0 -1.0+1.0i) 1.0-1.0i)
(num-test (- 0 0) 0)
(num-test (- 0 0.0) 0.0)
(num-test (- 0 0.0+1.0i) 0.0-1.0i)
(num-test (- 0 1 -1.0+1.0i) 0.0-1.0i)
(num-test (- 0 1 0) -1)
(num-test (- 0 1 0.0) -1.0)
(num-test (- 0 1 0.0+1.0i) -1.0-1.0i)
(num-test (- 0 1 1) -2)
(num-test (- 0 1 1.0) -2.0)
(num-test (- 0 1 1.0+1.0i) -2.0-1.0i)
(num-test (- 0 1 1.234+1.234i) -2.234-1.234i)
(num-test (- 0 1 1/1) -2)
(num-test (- 0 1 123.4) -124.4)
(num-test (- 0 1 1234) -1235)
(num-test (- 0 1 1234/11) -1245/11)
(num-test (- 0 1) -1)
(num-test (- 0 1.0 -1.0+1.0i) 0.0-1.0i)
(num-test (- 0 1.0 0) -1.0)
(num-test (- 0 1.0 0.0) -1.0)
(num-test (- 0 1.0 0.0+1.0i) -1.0-1.0i)
(num-test (- 0 1.0 1) -2.0)
(num-test (- 0 1.0 1.0) -2.0)
(num-test (- 0 1.0 1.0+1.0i) -2.0-1.0i)
(num-test (- 0 1.0 1.234+1.234i) -2.234-1.234i)
(num-test (- 0 1.0 1/1) -2.0)
(num-test (- 0 1.0 123.4) -124.4)
(num-test (- 0 1.0 1234) -1235.0)
(num-test (- 0 1.0 1234/11) -113.18181818181819)
(num-test (- 0 1.0) -1.0)
(num-test (- 0 1.0+1.0i -1.0+1.0i) 0.0-2.0i)
(num-test (- 0 1.0+1.0i 0) -1.0-1.0i)
(num-test (- 0 1.0+1.0i 0.0) -1.0-1.0i)
(num-test (- 0 1.0+1.0i 0.0+1.0i) -1.0-2.0i)
(num-test (- 0 1.0+1.0i 1) -2.0-1.0i)
(num-test (- 0 1.0+1.0i 1.0) -2.0-1.0i)
(num-test (- 0 1.0+1.0i 1.0+1.0i) -2.0-2.0i)
(num-test (- 0 1.0+1.0i 1.234+1.234i) -2.234-2.234i)
(num-test (- 0 1.0+1.0i 1/1) -2.0-1.0i)
(num-test (- 0 1.0+1.0i 123.4) -124.4-1.0i)
(num-test (- 0 1.0+1.0i 1234) -1235.0-1.0i)
(num-test (- 0 1.0+1.0i 1234/11) -113.18181818181819-1.0i)
(num-test (- 0 1.0+1.0i) -1.0-1.0i)
(num-test (- 0 1.234+1.234i) -1.234-1.234i)
(num-test (- 0 123.4) -123.4)
(num-test (- 0 1234) -1234)
(num-test (- 0 1234/11) -1234/11)
(num-test (- 0) 0)
(num-test (- 0) 0)
(num-test (- 0.0 -1.0+1.0i -1.0+1.0i) 2.0-2.0i)
(num-test (- 0.0 -1.0+1.0i 0) 1.0-1.0i)
(num-test (- 0.0 -1.0+1.0i 0.0) 1.0-1.0i)
(num-test (- 0.0 -1.0+1.0i 0.0+1.0i) 1.0-2.0i)
(num-test (- 0.0 -1.0+1.0i 1) 0.0-1.0i)
(num-test (- 0.0 -1.0+1.0i 1.0) 0.0-1.0i)
(num-test (- 0.0 -1.0+1.0i 1.0+1.0i) 0.0-2.0i)
(num-test (- 0.0 -1.0+1.0i 1.234+1.234i) -0.234-2.234i)
(num-test (- 0.0 -1.0+1.0i 1/1) 0.0-1.0i)
(num-test (- 0.0 -1.0+1.0i 123.4) -122.4-1.0i)
(num-test (- 0.0 -1.0+1.0i 1234) -1233.0-1.0i)
(num-test (- 0.0 -1.0+1.0i 1234/11) -111.18181818181819-1.0i)
(num-test (- 0.0 -1.0+1.0i) 1.0-1.0i)
(num-test (- 0.0 0 -1.0+1.0i) 1.0-1.0i)
(num-test (- 0.0 0 0) 0.0)
(num-test (- 0.0 0 0.0) 0.0)
(num-test (- 0.0 0 0.0+1.0i) 0.0-1.0i)
(num-test (- 0.0 0 1) -1.0)
(num-test (- 0.0 0 1.0) -1.0)
(num-test (- 0.0 0 1.0+1.0i) -1.0-1.0i)
(num-test (- 0.0 0 1.234+1.234i) -1.234-1.234i)
(num-test (- 0.0 0 1/1) -1.0)
(num-test (- 0.0 0 123.4) -123.4)
(num-test (- 0.0 0 1234) -1234.0)
(num-test (- 0.0 0 1234/11) -112.18181818181819)
(num-test (- 0.0 0) 0.0)
(num-test (- 0.0 0.0 -1.0+1.0i) 1.0-1.0i)
(num-test (- 0.0 0.0 0) 0.0)
(num-test (- 0.0 0.0 0.0) 0.0)
(num-test (- 0.0 0.0 0.0+1.0i) 0.0-1.0i)
(num-test (- 0.0 0.0 1) -1.0)
(num-test (- 0.0 0.0 1.0) -1.0)
(num-test (- 0.0 0.0 1.0+1.0i) -1.0-1.0i)
(num-test (- 0.0 0.0 1.234+1.234i) -1.234-1.234i)
(num-test (- 0.0 0.0 1/1) -1.0)
(num-test (- 0.0 0.0 123.4) -123.4)
(num-test (- 0.0 0.0 1234) -1234.0)
(num-test (- 0.0 0.0 1234/11) -112.18181818181819)
(num-test (- 0.0 0.0) 0.0)
(num-test (- 0.0 0.0+1.0i -1.0+1.0i) 1.0-2.0i)
(num-test (- 0.0 0.0+1.0i 0) 0.0-1.0i)
(num-test (- 0.0 0.0+1.0i 0.0) 0.0-1.0i)
(num-test (- 0.0 0.0+1.0i 0.0+1.0i) 0.0-2.0i)
(num-test (- 0.0 0.0+1.0i 1) -1.0-1.0i)
(num-test (- 0.0 0.0+1.0i 1.0) -1.0-1.0i)
(num-test (- 0.0 0.0+1.0i 1.0+1.0i) -1.0-2.0i)
(num-test (- 0.0 0.0+1.0i 1.234+1.234i) -1.234-2.234i)
(num-test (- 0.0 0.0+1.0i 1/1) -1.0-1.0i)
(num-test (- 0.0 0.0+1.0i 123.4) -123.4-1.0i)
(num-test (- 0.0 0.0+1.0i 1234) -1234.0-1.0i)
(num-test (- 0.0 0.0+1.0i 1234/11) -112.18181818181819-1.0i)
(num-test (- 0.0 0.0+1.0i) 0.0-1.0i)
(num-test (- 0.0 1 -1.0+1.0i) 0.0-1.0i)
(num-test (- 0.0 1 0) -1.0)
(num-test (- 0.0 1 0.0) -1.0)
(num-test (- 0.0 1 0.0+1.0i) -1.0-1.0i)
(num-test (- 0.0 1 1.0) -2.0)
(num-test (- 0.0 1 1.0+1.0i) -2.0-1.0i)
(num-test (- 0.0 1 1.234+1.234i) -2.234-1.234i)
(num-test (- 0.0 1 1/1) -2.0)
(num-test (- 0.0 1 123.4) -124.4)
(num-test (- 0.0 1 1234) -1235.0)
(num-test (- 0.0 1 1234/11) -113.18181818181819)
(num-test (- 0.0 1) -1.0)
(num-test (- 0.0 1.0 -1.0+1.0i) 0.0-1.0i)
(num-test (- 0.0 1.0 0) -1.0)
(num-test (- 0.0 1.0 0.0) -1.0)
(num-test (- 0.0 1.0 0.0+1.0i) -1.0-1.0i)
(num-test (- 0.0 1.0 1) -2.0)
(num-test (- 0.0 1.0 1.0) -2.0)
(num-test (- 0.0 1.0 1.0+1.0i) -2.0-1.0i)
(num-test (- 0.0 1.0 1.234+1.234i) -2.234-1.234i)
(num-test (- 0.0 1.0 1/1) -2.0)
(num-test (- 0.0 1.0 123.4) -124.4)
(num-test (- 0.0 1.0 1234) -1235.0)
(num-test (- 0.0 1.0 1234/11) -113.18181818181819)
(num-test (- 0.0 1.0) -1.0)
(num-test (- 0.0 1.0+1.0i -1.0+1.0i) 0.0-2.0i)
(num-test (- 0.0 1.0+1.0i 0) -1.0-1.0i)
(num-test (- 0.0 1.0+1.0i 0.0) -1.0-1.0i)
(num-test (- 0.0 1.0+1.0i 0.0+1.0i) -1.0-2.0i)
(num-test (- 0.0 1.0+1.0i 1) -2.0-1.0i)
(num-test (- 0.0 1.0+1.0i 1.0) -2.0-1.0i)
(num-test (- 0.0 1.0+1.0i 1.0+1.0i) -2.0-2.0i)
(num-test (- 0.0 1.0+1.0i 1.234+1.234i) -2.234-2.234i)
(num-test (- 0.0 1.0+1.0i 1/1) -2.0-1.0i)
(num-test (- 0.0 1.0+1.0i 123.4) -124.4-1.0i)
(num-test (- 0.0 1.0+1.0i 1234) -1235.0-1.0i)
(num-test (- 0.0 1.0+1.0i 1234/11) -113.18181818181819-1.0i)
(num-test (- 0.0 1.0+1.0i) -1.0-1.0i)
(num-test (- 0.0 1.234+1.234i -1.0+1.0i) -0.234-2.234i)
(num-test (- 0.0 1.234+1.234i 0) -1.234-1.234i)
(num-test (- 0.0 1.234+1.234i 0.0) -1.234-1.234i)
(num-test (- 0.0 1.234+1.234i 0.0+1.0i) -1.234-2.234i)
(num-test (- 0.0 1.234+1.234i 1) -2.234-1.234i)
(num-test (- 0.0 1.234+1.234i 1.0) -2.234-1.234i)
(num-test (- 0.0 1.234+1.234i 1.0+1.0i) -2.234-2.234i)
(num-test (- 0.0 1.234+1.234i 1.234+1.234i) -2.468-2.468i)
(num-test (- 0.0 1.234+1.234i 1/1) -2.234-1.234i)
(num-test (- 0.0 1.234+1.234i 123.4) -124.634-1.234i)
(num-test (- 0.0 1.234+1.234i 1234) -1235.23399999999992-1.234i)
(num-test (- 0.0 1.234+1.234i 1234/11) -113.41581818181818-1.234i)
(num-test (- 0.0 1.234+1.234i) -1.234-1.234i)
(num-test (- 0.0 1/1 -1.0+1.0i) 0.0-1.0i)
(num-test (- 0.0 123.4 -1.0+1.0i) -122.4-1.0i)
(num-test (- 0.0 123.4 0) -123.4)
(num-test (- 0.0 123.4 0.0) -123.4)
(num-test (- 0.0 123.4 0.0+1.0i) -123.4-1.0i)
(num-test (- 0.0 123.4 1) -124.4)
(num-test (- 0.0 123.4 1.0) -124.4)
(num-test (- 0.0 123.4 1.0+1.0i) -124.4-1.0i)
(num-test (- 0.0 123.4 1.234+1.234i) -124.634-1.234i)
(num-test (- 0.0 123.4 1/1) -124.4)
(num-test (- 0.0 123.4 123.4) -246.8)
(num-test (- 0.0 123.4 1234) -1357.4)
(num-test (- 0.0 123.4 1234/11) -235.58181818181819)
(num-test (- 0.0 123.4) -123.4)
(num-test (- 0.0 1234 -1.0+1.0i) -1233.0-1.0i)
(num-test (- 0.0 1234 0) -1234.0)
(num-test (- 0.0 1234 0.0) -1234.0)
(num-test (- 0.0 1234 0.0+1.0i) -1234.0-1.0i)
(num-test (- 0.0 1234 1) -1235.0)
(num-test (- 0.0 1234 1.0) -1235.0)
(num-test (- 0.0 1234 1.0+1.0i) -1235.0-1.0i)
(num-test (- 0.0 1234 1.234+1.234i) -1235.23399999999992-1.234i)
(num-test (- 0.0 1234 1/1) -1235.0)
(num-test (- 0.0 1234 123.4) -1357.4)
(num-test (- 0.0 1234 1234) -2468.0)
(num-test (- 0.0 1234 1234/11) -1346.18181818181824)
(num-test (- 0.0 1234) -1234.0)
(num-test (- 0.0 1234/11 -1.0+1.0i) -111.18181818181819-1.0i)
(num-test (- 0.0 1234/11 0) -112.18181818181819)
(num-test (- 0.0 1234/11 0.0) -112.18181818181819)
(num-test (- 0.0 1234/11 0.0+1.0i) -112.18181818181819-1.0i)
(num-test (- 0.0 1234/11 1) -113.18181818181819)
(num-test (- 0.0 1234/11 1.0) -113.18181818181819)
(num-test (- 0.0 1234/11 1.0+1.0i) -113.18181818181819-1.0i)
(num-test (- 0.0 1234/11 1.234+1.234i) -113.41581818181818-1.234i)
(num-test (- 0.0 1234/11 1/1) -113.18181818181819)
(num-test (- 0.0 1234/11 123.4) -235.58181818181819)
(num-test (- 0.0 1234/11 1234) -1346.18181818181824)
(num-test (- 0.0 1234/11 1234/11) -224.36363636363637)
(num-test (- 0.0 1234/11) -112.18181818181819)
(num-test (- 0.0) -0.0)
(num-test (- 0.0+0.00000001i) -0.0-0.00000001i)
(num-test (- 0.0+1.0i -1.0+1.0i) 1.0)
(num-test (- 0.0+1.0i 0) 0.0+1.0i)
(num-test (- 0.0+1.0i 0.0) 0.0+1.0i)
(num-test (- 0.0+1.0i 0.0+1.0i) 0.0)
(num-test (- 0.0+1.0i 1) -1.0+1.0i)
(num-test (- 0.0+1.0i 1.0) -1.0+1.0i)
(num-test (- 0.0+1.0i 1.0+1.0i) -1.0)
(num-test (- 0.0+1.0i 1.234+1.234i) -1.234-0.234i)
(num-test (- 0.0+1.0i 1/1) -1.0+1.0i)
(num-test (- 0.0+1.0i 123.4) -123.4+1.0i)
(num-test (- 0.0+1.0i 1234) -1234.0+1.0i)
(num-test (- 0.0+1.0i 1234/11) -112.18181818181819+1.0i)
(num-test (- 0.0-0.00000001i) -0.0+0.00000001i)
(num-test (- 0/1) 0/1)
(num-test (- 0/1) 0/1)
(num-test (- 1 -1.0+1.0i) 2.0-1.0i)
(num-test (- 1 0) 1)
(num-test (- 1 0.0) 1.0)
(num-test (- 1 0.0+1.0i) 1.0-1.0i)
(num-test (- 1 1 -1.0+1.0i) 1.0-1.0i)
(num-test (- 1 1 0) 0)
(num-test (- 1 1 0.0) 0.0)
(num-test (- 1 1 0.0+1.0i) 0.0-1.0i)
(num-test (- 1 1 1) -1)
(num-test (- 1 1 1.0) -1.0)
(num-test (- 1 1 1.0+1.0i) -1.0-1.0i)
(num-test (- 1 1 1.234+1.234i) -1.234-1.234i)
(num-test (- 1 1 1/1) -1)
(num-test (- 1 1 123.4) -123.4)
(num-test (- 1 1 1234) -1234)
(num-test (- 1 1 1234/11) -1234/11)
(num-test (- 1 1) 0)
(num-test (- 1 1.0 -1.0+1.0i) 1.0-1.0i)
(num-test (- 1 1.0 0) 0.0)
(num-test (- 1 1.0 0.0) 0.0)
(num-test (- 1 1.0 0.0+1.0i) 0.0-1.0i)
(num-test (- 1 1.0 1) -1.0)
(num-test (- 1 1.0 1.0) -1.0)
(num-test (- 1 1.0 1.0+1.0i) -1.0-1.0i)
(num-test (- 1 1.0 1.234+1.234i) -1.234-1.234i)
(num-test (- 1 1.0 1/1) -1.0)
(num-test (- 1 1.0 123.4) -123.4)
(num-test (- 1 1.0 1234) -1234.0)
(num-test (- 1 1.0 1234/11) -112.18181818181819)
(num-test (- 1 1.0) 0.0)
(num-test (- 1 1.0+1.0i -1.0+1.0i) 1.0-2.0i)
(num-test (- 1 1.0+1.0i 0) 0.0-1.0i)
(num-test (- 1 1.0+1.0i 0.0) 0.0-1.0i)
(num-test (- 1 1.0+1.0i 0.0+1.0i) 0.0-2.0i)
(num-test (- 1 1.0+1.0i 1) -1.0-1.0i)
(num-test (- 1 1.0+1.0i 1.0) -1.0-1.0i)
(num-test (- 1 1.0+1.0i 1.0+1.0i) -1.0-2.0i)
(num-test (- 1 1.0+1.0i 1.234+1.234i) -1.234-2.234i)
(num-test (- 1 1.0+1.0i 1/1) -1.0-1.0i)
(num-test (- 1 1.0+1.0i 123.4) -123.4-1.0i)
(num-test (- 1 1.0+1.0i 1234) -1234.0-1.0i)
(num-test (- 1 1.0+1.0i 1234/11) -112.18181818181819-1.0i)
(num-test (- 1 1.0+1.0i) 0.0-1.0i)
(num-test (- 1 1.234+1.234i) -0.234-1.234i)
(num-test (- 1 1/1 -1.0+1.0i) 1.0-1.0i)
(num-test (- 1 123.4) -122.4)
(num-test (- 1 1234) -1233)
(num-test (- 1 1234/11) -1223/11)
(num-test (- 1.0 -1.0+1.0i -1.0+1.0i) 3.0-2.0i)
(num-test (- 1.0 -1.0+1.0i 0) 2.0-1.0i)
(num-test (- 1.0 -1.0+1.0i 0.0) 2.0-1.0i)
(num-test (- 1.0 -1.0+1.0i 0.0+1.0i) 2.0-2.0i)
(num-test (- 1.0 -1.0+1.0i 1) 1.0-1.0i)
(num-test (- 1.0 -1.0+1.0i 1.0) 1.0-1.0i)
(num-test (- 1.0 -1.0+1.0i 1.0+1.0i) 1.0-2.0i)
(num-test (- 1.0 -1.0+1.0i 1.234+1.234i) 0.766-2.234i)
(num-test (- 1.0 -1.0+1.0i 1/1) 1.0-1.0i)
(num-test (- 1.0 -1.0+1.0i 123.4) -121.4-1.0i)
(num-test (- 1.0 -1.0+1.0i 1234) -1232.0-1.0i)
(num-test (- 1.0 -1.0+1.0i 1234/11) -110.18181818181819-1.0i)
(num-test (- 1.0 -1.0+1.0i) 2.0-1.0i)
(num-test (- 1.0 0 -1.0+1.0i) 2.0-1.0i)
(num-test (- 1.0 0 0) 1.0)
(num-test (- 1.0 0 0.0) 1.0)
(num-test (- 1.0 0 0.0+1.0i) 1.0-1.0i)
(num-test (- 1.0 0 1) 0.0)
(num-test (- 1.0 0 1.0) 0.0)
(num-test (- 1.0 0 1.0+1.0i) 0.0-1.0i)
(num-test (- 1.0 0 1.234+1.234i) -0.234-1.234i)
(num-test (- 1.0 0 1/1) 0.0)
(num-test (- 1.0 0 123.4) -122.4)
(num-test (- 1.0 0 1234) -1233.0)
(num-test (- 1.0 0 1234/11) -111.18181818181819)
(num-test (- 1.0 0) 1.0)
(num-test (- 1.0 0.0 -1.0+1.0i) 2.0-1.0i)
(num-test (- 1.0 0.0 0) 1.0)
(num-test (- 1.0 0.0 0.0) 1.0)
(num-test (- 1.0 0.0 0.0+1.0i) 1.0-1.0i)
(num-test (- 1.0 0.0 1) 0.0)
(num-test (- 1.0 0.0 1.0) 0.0)
(num-test (- 1.0 0.0 1.0+1.0i) 0.0-1.0i)
(num-test (- 1.0 0.0 1.234+1.234i) -0.234-1.234i)
(num-test (- 1.0 0.0 1/1) 0.0)
(num-test (- 1.0 0.0 123.4) -122.4)
(num-test (- 1.0 0.0 1234) -1233.0)
(num-test (- 1.0 0.0 1234/11) -111.18181818181819)
(num-test (- 1.0 0.0) 1.0)
(num-test (- 1.0 0.0+1.0i -1.0+1.0i) 2.0-2.0i)
(num-test (- 1.0 0.0+1.0i 0) 1.0-1.0i)
(num-test (- 1.0 0.0+1.0i 0.0) 1.0-1.0i)
(num-test (- 1.0 0.0+1.0i 0.0+1.0i) 1.0-2.0i)
(num-test (- 1.0 0.0+1.0i 1) 0.0-1.0i)
(num-test (- 1.0 0.0+1.0i 1.0) 0.0-1.0i)
(num-test (- 1.0 0.0+1.0i 1.0+1.0i) 0.0-2.0i)
(num-test (- 1.0 0.0+1.0i 1.234+1.234i) -0.234-2.234i)
(num-test (- 1.0 0.0+1.0i 1/1) 0.0-1.0i)
(num-test (- 1.0 0.0+1.0i 123.4) -122.4-1.0i)
(num-test (- 1.0 0.0+1.0i 1234) -1233.0-1.0i)
(num-test (- 1.0 0.0+1.0i 1234/11) -111.18181818181819-1.0i)
(num-test (- 1.0 0.0+1.0i) 1.0-1.0i)
(num-test (- 1.0 1 -1.0+1.0i) 1.0-1.0i)
(num-test (- 1.0 1 0) 0.0)
(num-test (- 1.0 1 0.0) 0.0)
(num-test (- 1.0 1 0.0+1.0i) 0.0-1.0i)
(num-test (- 1.0 1 1) -1.0)
(num-test (- 1.0 1 1.0) -1.0)
(num-test (- 1.0 1 1.0+1.0i) -1.0-1.0i)
(num-test (- 1.0 1 1.234+1.234i) -1.234-1.234i)
(num-test (- 1.0 1 1/1) -1.0)
(num-test (- 1.0 1 123.4) -123.4)
(num-test (- 1.0 1 1234) -1234.0)
(num-test (- 1.0 1 1234/11) -112.18181818181819)
(num-test (- 1.0 1) 0.0)
(num-test (- 1.0 1.0 -1.0+1.0i) 1.0-1.0i)
(num-test (- 1.0 1.0 0) 0.0)
(num-test (- 1.0 1.0 0.0) 0.0)
(num-test (- 1.0 1.0 0.0+1.0i) 0.0-1.0i)
(num-test (- 1.0 1.0 1) -1.0)
(num-test (- 1.0 1.0 1.0) -1.0)
(num-test (- 1.0 1.0 1.0+1.0i) -1.0-1.0i)
(num-test (- 1.0 1.0 1.234+1.234i) -1.234-1.234i)
(num-test (- 1.0 1.0 1/1) -1.0)
(num-test (- 1.0 1.0 123.4) -123.4)
(num-test (- 1.0 1.0 1234) -1234.0)
(num-test (- 1.0 1.0 1234/11) -112.18181818181819)
(num-test (- 1.0 1.0) 0.0)
(num-test (- 1.0 1.0+1.0i -1.0+1.0i) 1.0-2.0i)
(num-test (- 1.0 1.0+1.0i 0) 0.0-1.0i)
(num-test (- 1.0 1.0+1.0i 0.0) 0.0-1.0i)
(num-test (- 1.0 1.0+1.0i 0.0+1.0i) 0.0-2.0i)
(num-test (- 1.0 1.0+1.0i 1) -1.0-1.0i)
(num-test (- 1.0 1.0+1.0i 1.0) -1.0-1.0i)
(num-test (- 1.0 1.0+1.0i 1.0+1.0i) -1.0-2.0i)
(num-test (- 1.0 1.0+1.0i 1.234+1.234i) -1.234-2.234i)
(num-test (- 1.0 1.0+1.0i 1/1) -1.0-1.0i)
(num-test (- 1.0 1.0+1.0i 123.4) -123.4-1.0i)
(num-test (- 1.0 1.0+1.0i 1234) -1234.0-1.0i)
(num-test (- 1.0 1.0+1.0i 1234/11) -112.18181818181819-1.0i)
(num-test (- 1.0 1.0+1.0i) 0.0-1.0i)
(num-test (- 1.0 1.234+1.234i -1.0+1.0i) 0.766-2.234i)
(num-test (- 1.0 1.234+1.234i 0) -0.234-1.234i)
(num-test (- 1.0 1.234+1.234i 0.0) -0.234-1.234i)
(num-test (- 1.0 1.234+1.234i 0.0+1.0i) -0.234-2.234i)
(num-test (- 1.0 1.234+1.234i 1) -1.234-1.234i)
(num-test (- 1.0 1.234+1.234i 1.0) -1.234-1.234i)
(num-test (- 1.0 1.234+1.234i 1.0+1.0i) -1.234-2.234i)
(num-test (- 1.0 1.234+1.234i 1.234+1.234i) -1.468-2.468i)
(num-test (- 1.0 1.234+1.234i 1/1) -1.234-1.234i)
(num-test (- 1.0 1.234+1.234i 123.4) -123.634-1.234i)
(num-test (- 1.0 1.234+1.234i 1234) -1234.23399999999992-1.234i)
(num-test (- 1.0 1.234+1.234i 1234/11) -112.41581818181818-1.234i)
(num-test (- 1.0 1.234+1.234i) -0.234-1.234i)
(num-test (- 1.0 1/1 -1.0+1.0i) 1.0-1.0i)
(num-test (- 1.0 123.4 -1.0+1.0i) -121.4-1.0i)
(num-test (- 1.0 123.4 0) -122.4)
(num-test (- 1.0 123.4 0.0) -122.4)
(num-test (- 1.0 123.4 0.0+1.0i) -122.4-1.0i)
(num-test (- 1.0 123.4 1) -123.4)
(num-test (- 1.0 123.4 1.0) -123.4)
(num-test (- 1.0 123.4 1.0+1.0i) -123.4-1.0i)
(num-test (- 1.0 123.4 1.234+1.234i) -123.634-1.234i)
(num-test (- 1.0 123.4 1/1) -123.4)
(num-test (- 1.0 123.4 123.4) -245.8)
(num-test (- 1.0 123.4 1234) -1356.4)
(num-test (- 1.0 123.4 1234/11) -234.58181818181819)
(num-test (- 1.0 123.4) -122.4)
(num-test (- 1.0 1234 -1.0+1.0i) -1232.0-1.0i)
(num-test (- 1.0 1234 0) -1233.0)
(num-test (- 1.0 1234 0.0) -1233.0)
(num-test (- 1.0 1234 0.0+1.0i) -1233.0-1.0i)
(num-test (- 1.0 1234 1) -1234.0)
(num-test (- 1.0 1234 1.0) -1234.0)
(num-test (- 1.0 1234 1.0+1.0i) -1234.0-1.0i)
(num-test (- 1.0 1234 1.234+1.234i) -1234.23399999999992-1.234i)
(num-test (- 1.0 1234 1/1) -1234.0)
(num-test (- 1.0 1234 123.4) -1356.4)
(num-test (- 1.0 1234 1234) -2467.0)
(num-test (- 1.0 1234 1234/11) -1345.18181818181824)
(num-test (- 1.0 1234) -1233.0)
(num-test (- 1.0 1234/11 -1.0+1.0i) -110.18181818181819-1.0i)
(num-test (- 1.0 1234/11 0) -111.18181818181819)
(num-test (- 1.0 1234/11 0.0) -111.18181818181819)
(num-test (- 1.0 1234/11 0.0+1.0i) -111.18181818181819-1.0i)
(num-test (- 1.0 1234/11 1) -112.18181818181819)
(num-test (- 1.0 1234/11 1.0) -112.18181818181819)
(num-test (- 1.0 1234/11 1.0+1.0i) -112.18181818181819-1.0i)
(num-test (- 1.0 1234/11 1.234+1.234i) -112.41581818181818-1.234i)
(num-test (- 1.0 1234/11 1/1) -112.18181818181819)
(num-test (- 1.0 1234/11 123.4) -234.58181818181819)
(num-test (- 1.0 1234/11 1234) -1345.18181818181824)
(num-test (- 1.0 1234/11 1234/11) -223.36363636363637)
(num-test (- 1.0 1234/11) -111.18181818181819)
(num-test (- 1.0) -1.0)
(num-test (- 1.0+1.0i -1.0+1.0i -1.0+1.0i) 3.0-1.0i)
(num-test (- 1.0+1.0i -1.0+1.0i 0) 2.0)
(num-test (- 1.0+1.0i -1.0+1.0i 0.0) 2.0)
(num-test (- 1.0+1.0i -1.0+1.0i 0.0+1.0i) 2.0-1.0i)
(num-test (- 1.0+1.0i -1.0+1.0i 1) 1.0)
(num-test (- 1.0+1.0i -1.0+1.0i 1.0) 1.0)
(num-test (- 1.0+1.0i -1.0+1.0i 1.0+1.0i) 1.0-1.0i)
(num-test (- 1.0+1.0i -1.0+1.0i 1.234+1.234i) 0.766-1.234i)
(num-test (- 1.0+1.0i -1.0+1.0i 1/1) 1.0)
(num-test (- 1.0+1.0i -1.0+1.0i 123.4) -121.4)
(num-test (- 1.0+1.0i -1.0+1.0i 1234) -1232.0)
(num-test (- 1.0+1.0i -1.0+1.0i 1234/11) -110.18181818181819)
(num-test (- 1.0+1.0i -1.0+1.0i) 2.0)
(num-test (- 1.0+1.0i 0 -1.0+1.0i) 2.0)
(num-test (- 1.0+1.0i 0 0) 1.0+1.0i)
(num-test (- 1.0+1.0i 0 0.0) 1.0+1.0i)
(num-test (- 1.0+1.0i 0 0.0+1.0i) 1.0)
(num-test (- 1.0+1.0i 0 1) 0.0+1.0i)
(num-test (- 1.0+1.0i 0 1.0) 0.0+1.0i)
(num-test (- 1.0+1.0i 0 1.0+1.0i) 0.0)
(num-test (- 1.0+1.0i 0 1.234+1.234i) -0.234-0.234i)
(num-test (- 1.0+1.0i 0 1/1) 0.0+1.0i)
(num-test (- 1.0+1.0i 0 123.4) -122.4+1.0i)
(num-test (- 1.0+1.0i 0 1234) -1233.0+1.0i)
(num-test (- 1.0+1.0i 0 1234/11) -111.18181818181819+1.0i)
(num-test (- 1.0+1.0i 0) 1.0+1.0i)
(num-test (- 1.0+1.0i 0.0 -1.0+1.0i) 2.0)
(num-test (- 1.0+1.0i 0.0 0) 1.0+1.0i)
(num-test (- 1.0+1.0i 0.0 0.0) 1.0+1.0i)
(num-test (- 1.0+1.0i 0.0 0.0+1.0i) 1.0)
(num-test (- 1.0+1.0i 0.0 1) 0.0+1.0i)
(num-test (- 1.0+1.0i 0.0 1.0) 0.0+1.0i)
(num-test (- 1.0+1.0i 0.0 1.0+1.0i) 0.0)
(num-test (- 1.0+1.0i 0.0 1.234+1.234i) -0.234-0.234i)
(num-test (- 1.0+1.0i 0.0 1/1) 0.0+1.0i)
(num-test (- 1.0+1.0i 0.0 123.4) -122.4+1.0i)
(num-test (- 1.0+1.0i 0.0 1234) -1233.0+1.0i)
(num-test (- 1.0+1.0i 0.0 1234/11) -111.18181818181819+1.0i)
(num-test (- 1.0+1.0i 0.0) 1.0+1.0i)
(num-test (- 1.0+1.0i 0.0+1.0i -1.0+1.0i) 2.0-1.0i)
(num-test (- 1.0+1.0i 0.0+1.0i 0) 1.0)
(num-test (- 1.0+1.0i 0.0+1.0i 0.0) 1.0)
(num-test (- 1.0+1.0i 0.0+1.0i 0.0+1.0i) 1.0-1.0i)
(num-test (- 1.0+1.0i 0.0+1.0i 1) 0.0)
(num-test (- 1.0+1.0i 0.0+1.0i 1.0) 0.0)
(num-test (- 1.0+1.0i 0.0+1.0i 1.0+1.0i) 0.0-1.0i)
(num-test (- 1.0+1.0i 0.0+1.0i 1.234+1.234i) -0.234-1.234i)
(num-test (- 1.0+1.0i 0.0+1.0i 1/1) 0.0)
(num-test (- 1.0+1.0i 0.0+1.0i 123.4) -122.4)
(num-test (- 1.0+1.0i 0.0+1.0i 1234) -1233.0)
(num-test (- 1.0+1.0i 0.0+1.0i 1234/11) -111.18181818181819)
(num-test (- 1.0+1.0i 0.0+1.0i) 1.0)
(num-test (- 1.0+1.0i 1 -1.0+1.0i) 1.0)
(num-test (- 1.0+1.0i 1 0) 0.0+1.0i)
(num-test (- 1.0+1.0i 1 0.0) 0.0+1.0i)
(num-test (- 1.0+1.0i 1 0.0+1.0i) 0.0)
(num-test (- 1.0+1.0i 1 1) -1.0+1.0i)
(num-test (- 1.0+1.0i 1 1.0) -1.0+1.0i)
(num-test (- 1.0+1.0i 1 1.0+1.0i) -1.0)
(num-test (- 1.0+1.0i 1 1.234+1.234i) -1.234-0.234i)
(num-test (- 1.0+1.0i 1 1/1) -1.0+1.0i)
(num-test (- 1.0+1.0i 1 123.4) -123.4+1.0i)
(num-test (- 1.0+1.0i 1 1234) -1234.0+1.0i)
(num-test (- 1.0+1.0i 1 1234/11) -112.18181818181819+1.0i)
(num-test (- 1.0+1.0i 1) 0.0+1.0i)
(num-test (- 1.0+1.0i 1.0 -1.0+1.0i) 1.0)
(num-test (- 1.0+1.0i 1.0 0) 0.0+1.0i)
(num-test (- 1.0+1.0i 1.0 0.0) 0.0+1.0i)
(num-test (- 1.0+1.0i 1.0 0.0+1.0i) 0.0)
(num-test (- 1.0+1.0i 1.0 1) -1.0+1.0i)
(num-test (- 1.0+1.0i 1.0 1.0) -1.0+1.0i)
(num-test (- 1.0+1.0i 1.0 1.0+1.0i) -1.0)
(num-test (- 1.0+1.0i 1.0 1.234+1.234i) -1.234-0.234i)
(num-test (- 1.0+1.0i 1.0 1/1) -1.0+1.0i)
(num-test (- 1.0+1.0i 1.0 123.4) -123.4+1.0i)
(num-test (- 1.0+1.0i 1.0 1234) -1234.0+1.0i)
(num-test (- 1.0+1.0i 1.0 1234/11) -112.18181818181819+1.0i)
(num-test (- 1.0+1.0i 1.0) 0.0+1.0i)
(num-test (- 1.0+1.0i 1.0+1.0i -1.0+1.0i) 1.0-1.0i)
(num-test (- 1.0+1.0i 1.0+1.0i 0) 0.0)
(num-test (- 1.0+1.0i 1.0+1.0i 0.0) 0.0)
(num-test (- 1.0+1.0i 1.0+1.0i 0.0+1.0i) 0.0-1.0i)
(num-test (- 1.0+1.0i 1.0+1.0i 1) -1.0)
(num-test (- 1.0+1.0i 1.0+1.0i 1.0) -1.0)
(num-test (- 1.0+1.0i 1.0+1.0i 1.0+1.0i) -1.0-1.0i)
(num-test (- 1.0+1.0i 1.0+1.0i 1.234+1.234i) -1.234-1.234i)
(num-test (- 1.0+1.0i 1.0+1.0i 1/1) -1.0)
(num-test (- 1.0+1.0i 1.0+1.0i 123.4) -123.4)
(num-test (- 1.0+1.0i 1.0+1.0i 1234) -1234.0)
(num-test (- 1.0+1.0i 1.0+1.0i 1234/11) -112.18181818181819)
(num-test (- 1.0+1.0i 1.0+1.0i) 0.0)
(num-test (- 1.0+1.0i 1.234+1.234i -1.0+1.0i) 0.766-1.234i)
(num-test (- 1.0+1.0i 1.234+1.234i 0) -0.234-0.234i)
(num-test (- 1.0+1.0i 1.234+1.234i 0.0) -0.234-0.234i)
(num-test (- 1.0+1.0i 1.234+1.234i 0.0+1.0i) -0.234-1.234i)
(num-test (- 1.0+1.0i 1.234+1.234i 1) -1.234-0.234i)
(num-test (- 1.0+1.0i 1.234+1.234i 1.0) -1.234-0.234i)
(num-test (- 1.0+1.0i 1.234+1.234i 1.0+1.0i) -1.234-1.234i)
(num-test (- 1.0+1.0i 1.234+1.234i 1.234+1.234i) -1.468-1.468i)
(num-test (- 1.0+1.0i 1.234+1.234i 1/1) -1.234-0.234i)
(num-test (- 1.0+1.0i 1.234+1.234i 123.4) -123.634-0.234i)
(num-test (- 1.0+1.0i 1.234+1.234i 1234) -1234.23399999999992-0.234i)
(num-test (- 1.0+1.0i 1.234+1.234i 1234/11) -112.41581818181818-0.234i)
(num-test (- 1.0+1.0i 1.234+1.234i) -0.234-0.234i)
(num-test (- 1.0+1.0i 1/1 -1.0+1.0i) 1.0)
(num-test (- 1.0+1.0i 123.4 -1.0+1.0i) -121.4)
(num-test (- 1.0+1.0i 123.4 0) -122.4+1.0i)
(num-test (- 1.0+1.0i 123.4 0.0) -122.4+1.0i)
(num-test (- 1.0+1.0i 123.4 0.0+1.0i) -122.4)
(num-test (- 1.0+1.0i 123.4 1) -123.4+1.0i)
(num-test (- 1.0+1.0i 123.4 1.0) -123.4+1.0i)
(num-test (- 1.0+1.0i 123.4 1.0+1.0i) -123.4)
(num-test (- 1.0+1.0i 123.4 1.234+1.234i) -123.634-0.234i)
(num-test (- 1.0+1.0i 123.4 1/1) -123.4+1.0i)
(num-test (- 1.0+1.0i 123.4 123.4) -245.8+1.0i)
(num-test (- 1.0+1.0i 123.4 1234) -1356.4+1.0i)
(num-test (- 1.0+1.0i 123.4 1234/11) -234.58181818181819+1.0i)
(num-test (- 1.0+1.0i 123.4) -122.4+1.0i)
(num-test (- 1.0+1.0i 1234 -1.0+1.0i) -1232.0)
(num-test (- 1.0+1.0i 1234 0) -1233.0+1.0i)
(num-test (- 1.0+1.0i 1234 0.0) -1233.0+1.0i)
(num-test (- 1.0+1.0i 1234 0.0+1.0i) -1233.0)
(num-test (- 1.0+1.0i 1234 1) -1234.0+1.0i)
(num-test (- 1.0+1.0i 1234 1.0) -1234.0+1.0i)
(num-test (- 1.0+1.0i 1234 1.0+1.0i) -1234.0)
(num-test (- 1.0+1.0i 1234 1.234+1.234i) -1234.23399999999992-0.234i)
(num-test (- 1.0+1.0i 1234 1/1) -1234.0+1.0i)
(num-test (- 1.0+1.0i 1234 123.4) -1356.4+1.0i)
(num-test (- 1.0+1.0i 1234 1234) -2467.0+1.0i)
(num-test (- 1.0+1.0i 1234 1234/11) -1345.18181818181824+1.0i)
(num-test (- 1.0+1.0i 1234) -1233.0+1.0i)
(num-test (- 1.0+1.0i 1234/11 -1.0+1.0i) -110.18181818181819)
(num-test (- 1.0+1.0i 1234/11 0) -111.18181818181819+1.0i)
(num-test (- 1.0+1.0i 1234/11 0.0) -111.18181818181819+1.0i)
(num-test (- 1.0+1.0i 1234/11 0.0+1.0i) -111.18181818181819)
(num-test (- 1.0+1.0i 1234/11 1) -112.18181818181819+1.0i)
(num-test (- 1.0+1.0i 1234/11 1.0) -112.18181818181819+1.0i)
(num-test (- 1.0+1.0i 1234/11 1.0+1.0i) -112.18181818181819)
(num-test (- 1.0+1.0i 1234/11 1.234+1.234i) -112.41581818181818-0.234i)
(num-test (- 1.0+1.0i 1234/11 1/1) -112.18181818181819+1.0i)
(num-test (- 1.0+1.0i 1234/11 123.4) -234.58181818181819+1.0i)
(num-test (- 1.0+1.0i 1234/11 1234) -1345.18181818181824+1.0i)
(num-test (- 1.0+1.0i 1234/11 1234/11) -223.36363636363637+1.0i)
(num-test (- 1.0+1.0i 1234/11) -111.18181818181819+1.0i)
(num-test (- 1.0+1.0i) -1.0-1.0i)
(num-test (- 1.234+1.234i -1.0+1.0i) 2.234+0.234i)
(num-test (- 1.234+1.234i 0) 1.234+1.234i)
(num-test (- 1.234+1.234i 0.0) 1.234+1.234i)
(num-test (- 1.234+1.234i 0.0+1.0i) 1.234+0.234i)
(num-test (- 1.234+1.234i 1) 0.234+1.234i)
(num-test (- 1.234+1.234i 1.0) 0.234+1.234i)
(num-test (- 1.234+1.234i 1.0+1.0i) 0.234+0.234i)
(num-test (- 1.234+1.234i 1.234+1.234i) 0.0)
(num-test (- 1.234+1.234i 1/1) 0.234+1.234i)
(num-test (- 1.234+1.234i 123.4) -122.16600000000001+1.234i)
(num-test (- 1.234+1.234i 1234) -1232.766+1.234i)
(num-test (- 1.234+1.234i 1234/11) -110.94781818181818+1.234i)
(num-test (- 10) -10)
(num-test (- 10/3) -10/3)
(num-test (- 123.4 -1.0+1.0i -1.0+1.0i) 125.4-2.0i)
(num-test (- 123.4 -1.0+1.0i 0) 124.4-1.0i)
(num-test (- 123.4 -1.0+1.0i 0.0) 124.4-1.0i)
(num-test (- 123.4 -1.0+1.0i 0.0+1.0i) 124.4-2.0i)
(num-test (- 123.4 -1.0+1.0i 1) 123.4-1.0i)
(num-test (- 123.4 -1.0+1.0i 1.0) 123.4-1.0i)
(num-test (- 123.4 -1.0+1.0i 1.0+1.0i) 123.4-2.0i)
(num-test (- 123.4 -1.0+1.0i 1.234+1.234i) 123.16600000000001-2.234i)
(num-test (- 123.4 -1.0+1.0i 1/1) 123.4-1.0i)
(num-test (- 123.4 -1.0+1.0i 123.4) 1.0-1.0i)
(num-test (- 123.4 -1.0+1.0i 1234) -1109.59999999999991-1.0i)
(num-test (- 123.4 -1.0+1.0i 1234/11) 12.21818181818182-1.0i)
(num-test (- 123.4 -1.0+1.0i) 124.4-1.0i)
(num-test (- 123.4 0 -1.0+1.0i) 124.4-1.0i)
(num-test (- 123.4 0 0) 123.4)
(num-test (- 123.4 0 0.0) 123.4)
(num-test (- 123.4 0 0.0+1.0i) 123.4-1.0i)
(num-test (- 123.4 0 1) 122.4)
(num-test (- 123.4 0 1.0) 122.4)
(num-test (- 123.4 0 1.0+1.0i) 122.4-1.0i)
(num-test (- 123.4 0 1.234+1.234i) 122.16600000000001-1.234i)
(num-test (- 123.4 0 1/1) 122.4)
(num-test (- 123.4 0 123.4) 0.0)
(num-test (- 123.4 0 1234) -1110.59999999999991)
(num-test (- 123.4 0 1234/11) 11.21818181818182)
(num-test (- 123.4 0) 123.4)
(num-test (- 123.4 0.0 -1.0+1.0i) 124.4-1.0i)
(num-test (- 123.4 0.0 0) 123.4)
(num-test (- 123.4 0.0 0.0) 123.4)
(num-test (- 123.4 0.0 0.0+1.0i) 123.4-1.0i)
(num-test (- 123.4 0.0 1) 122.4)
(num-test (- 123.4 0.0 1.0) 122.4)
(num-test (- 123.4 0.0 1.0+1.0i) 122.4-1.0i)
(num-test (- 123.4 0.0 1.234+1.234i) 122.16600000000001-1.234i)
(num-test (- 123.4 0.0 1/1) 122.4)
(num-test (- 123.4 0.0 123.4) 0.0)
(num-test (- 123.4 0.0 1234) -1110.59999999999991)
(num-test (- 123.4 0.0 1234/11) 11.21818181818182)
(num-test (- 123.4 0.0) 123.4)
(num-test (- 123.4 0.0+1.0i -1.0+1.0i) 124.4-2.0i)
(num-test (- 123.4 0.0+1.0i 0) 123.4-1.0i)
(num-test (- 123.4 0.0+1.0i 0.0) 123.4-1.0i)
(num-test (- 123.4 0.0+1.0i 0.0+1.0i) 123.4-2.0i)
(num-test (- 123.4 0.0+1.0i 1) 122.4-1.0i)
(num-test (- 123.4 0.0+1.0i 1.0) 122.4-1.0i)
(num-test (- 123.4 0.0+1.0i 1.0+1.0i) 122.4-2.0i)
(num-test (- 123.4 0.0+1.0i 1.234+1.234i) 122.16600000000001-2.234i)
(num-test (- 123.4 0.0+1.0i 1/1) 122.4-1.0i)
(num-test (- 123.4 0.0+1.0i 123.4) 0.0-1.0i)
(num-test (- 123.4 0.0+1.0i 1234) -1110.59999999999991-1.0i)
(num-test (- 123.4 0.0+1.0i 1234/11) 11.21818181818182-1.0i)
(num-test (- 123.4 0.0+1.0i) 123.4-1.0i)
(num-test (- 123.4 1 -1.0+1.0i) 123.4-1.0i)
(num-test (- 123.4 1 0) 122.4)
(num-test (- 123.4 1 0.0) 122.4)
(num-test (- 123.4 1 0.0+1.0i) 122.4-1.0i)
(num-test (- 123.4 1 1) 121.4)
(num-test (- 123.4 1 1.0) 121.4)
(num-test (- 123.4 1 1.0+1.0i) 121.4-1.0i)
(num-test (- 123.4 1 1.234+1.234i) 121.16600000000001-1.234i)
(num-test (- 123.4 1 1/1) 121.4)
(num-test (- 123.4 1 123.4) -1.0)
(num-test (- 123.4 1 1234) -1111.59999999999991)
(num-test (- 123.4 1 1234/11) 10.21818181818182)
(num-test (- 123.4 1) 122.4)
(num-test (- 123.4 1.0 -1.0+1.0i) 123.4-1.0i)
(num-test (- 123.4 1.0 0) 122.4)
(num-test (- 123.4 1.0 0.0) 122.4)
(num-test (- 123.4 1.0 0.0+1.0i) 122.4-1.0i)
(num-test (- 123.4 1.0 1) 121.4)
(num-test (- 123.4 1.0 1.0) 121.4)
(num-test (- 123.4 1.0 1.0+1.0i) 121.4-1.0i)
(num-test (- 123.4 1.0 1.234+1.234i) 121.16600000000001-1.234i)
(num-test (- 123.4 1.0 1/1) 121.4)
(num-test (- 123.4 1.0 123.4) -1.0)
(num-test (- 123.4 1.0 1234) -1111.59999999999991)
(num-test (- 123.4 1.0 1234/11) 10.21818181818182)
(num-test (- 123.4 1.0) 122.4)
(num-test (- 123.4 1.0+1.0i -1.0+1.0i) 123.4-2.0i)
(num-test (- 123.4 1.0+1.0i 0) 122.4-1.0i)
(num-test (- 123.4 1.0+1.0i 0.0) 122.4-1.0i)
(num-test (- 123.4 1.0+1.0i 0.0+1.0i) 122.4-2.0i)
(num-test (- 123.4 1.0+1.0i 1) 121.4-1.0i)
(num-test (- 123.4 1.0+1.0i 1.0) 121.4-1.0i)
(num-test (- 123.4 1.0+1.0i 1.0+1.0i) 121.4-2.0i)
(num-test (- 123.4 1.0+1.0i 1.234+1.234i) 121.16600000000001-2.234i)
(num-test (- 123.4 1.0+1.0i 1/1) 121.4-1.0i)
(num-test (- 123.4 1.0+1.0i 123.4) -1.0-1.0i)
(num-test (- 123.4 1.0+1.0i 1234) -1111.59999999999991-1.0i)
(num-test (- 123.4 1.0+1.0i 1234/11) 10.21818181818182-1.0i)
(num-test (- 123.4 1.0+1.0i) 122.4-1.0i)
(num-test (- 123.4 1.234+1.234i -1.0+1.0i) 123.16600000000001-2.234i)
(num-test (- 123.4 1.234+1.234i 0) 122.16600000000001-1.234i)
(num-test (- 123.4 1.234+1.234i 0.0) 122.16600000000001-1.234i)
(num-test (- 123.4 1.234+1.234i 0.0+1.0i) 122.16600000000001-2.234i)
(num-test (- 123.4 1.234+1.234i 1) 121.16600000000001-1.234i)
(num-test (- 123.4 1.234+1.234i 1.0) 121.16600000000001-1.234i)
(num-test (- 123.4 1.234+1.234i 1.0+1.0i) 121.16600000000001-2.234i)
(num-test (- 123.4 1.234+1.234i 1.234+1.234i) 120.93200000000002-2.468i)
(num-test (- 123.4 1.234+1.234i 1/1) 121.16600000000001-1.234i)
(num-test (- 123.4 1.234+1.234i 123.4) -1.23399999999999-1.234i)
(num-test (- 123.4 1.234+1.234i 1234) -1111.83400000000006-1.234i)
(num-test (- 123.4 1.234+1.234i 1234/11) 9.98418181818183-1.234i)
(num-test (- 123.4 1.234+1.234i) 122.16600000000001-1.234i)
(num-test (- 123.4 1/1 -1.0+1.0i) 123.4-1.0i)
(num-test (- 123.4 123.4 -1.0+1.0i) 1.0-1.0i)
(num-test (- 123.4 123.4 0) 0.0)
(num-test (- 123.4 123.4 0.0) 0.0)
(num-test (- 123.4 123.4 0.0+1.0i) 0.0-1.0i)
(num-test (- 123.4 123.4 1) -1.0)
(num-test (- 123.4 123.4 1.0) -1.0)
(num-test (- 123.4 123.4 1.0+1.0i) -1.0-1.0i)
(num-test (- 123.4 123.4 1.234+1.234i) -1.234-1.234i)
(num-test (- 123.4 123.4 1/1) -1.0)
(num-test (- 123.4 123.4 123.4) -123.4)
(num-test (- 123.4 123.4 1234) -1234.0)
(num-test (- 123.4 123.4 1234/11) -112.18181818181819)
(num-test (- 123.4 123.4) 0.0)
(num-test (- 123.4 1234 -1.0+1.0i) -1109.59999999999991-1.0i)
(num-test (- 123.4 1234 0) -1110.59999999999991)
(num-test (- 123.4 1234 0.0) -1110.59999999999991)
(num-test (- 123.4 1234 0.0+1.0i) -1110.59999999999991-1.0i)
(num-test (- 123.4 1234 1) -1111.59999999999991)
(num-test (- 123.4 1234 1.0) -1111.59999999999991)
(num-test (- 123.4 1234 1.0+1.0i) -1111.59999999999991-1.0i)
(num-test (- 123.4 1234 1.234+1.234i) -1111.83399999999983-1.234i)
(num-test (- 123.4 1234 1/1) -1111.59999999999991)
(num-test (- 123.4 1234 123.4) -1234.0)
(num-test (- 123.4 1234 1234) -2344.59999999999991)
(num-test (- 123.4 1234 1234/11) -1222.78181818181815)
(num-test (- 123.4 1234) -1110.59999999999991)
(num-test (- 123.4 1234/11 -1.0+1.0i) 12.21818181818182-1.0i)
(num-test (- 123.4 1234/11 0) 11.21818181818182)
(num-test (- 123.4 1234/11 0.0) 11.21818181818182)
(num-test (- 123.4 1234/11 0.0+1.0i) 11.21818181818182-1.0i)
(num-test (- 123.4 1234/11 1) 10.21818181818182)
(num-test (- 123.4 1234/11 1.0) 10.21818181818182)
(num-test (- 123.4 1234/11 1.0+1.0i) 10.21818181818182-1.0i)
(num-test (- 123.4 1234/11 1.234+1.234i) 9.98418181818182-1.234i)
(num-test (- 123.4 1234/11 1/1) 10.21818181818182)
(num-test (- 123.4 1234/11 123.4) -112.18181818181819)
(num-test (- 123.4 1234/11 1234) -1222.78181818181815)
(num-test (- 123.4 1234/11 1234/11) -100.96363636363635)
(num-test (- 123.4 1234/11) 11.21818181818182)
(num-test (- 1234 -1.0+1.0i) 1235.0-1.0i)
(num-test (- 1234 0) 1234)
(num-test (- 1234 0.0) 1234.0)
(num-test (- 1234 0.0+1.0i) 1234.0-1.0i)
(num-test (- 1234 1) 1233)
(num-test (- 1234 1.0) 1233.0)
(num-test (- 1234 1.0+1.0i) 1233.0-1.0i)
(num-test (- 1234 1.234+1.234i) 1232.766-1.234i)
(num-test (- 1234 1/1) 1233)
(num-test (- 1234 123.4) 1110.59999999999991)
(num-test (- 1234 1234) 0)
(num-test (- 1234 1234/11) 12340/11)
(num-test (- 1234/11 -1.0+1.0i) 113.18181818181819-1.0i)
(num-test (- 1234/11 0) 1234/11)
(num-test (- 1234/11 0.0) 112.18181818181819)
(num-test (- 1234/11 0.0+1.0i) 112.18181818181819-1.0i)
(num-test (- 1234/11 1) 1223/11)
(num-test (- 1234/11 1.0) 111.18181818181819)
(num-test (- 1234/11 1.0+1.0i) 111.18181818181819-1.0i)
(num-test (- 1234/11 1.234+1.234i) 110.94781818181819-1.234i)
(num-test (- 1234/11 1/1) 1223/11)
(num-test (- 1234/11 123.4) -11.21818181818182)
(num-test (- 1234/11 1234) -12340/11)
(num-test (- 1234/11 1234/11) 0)
(num-test (- 1234000000) -1234000000)
(num-test (- 1234000000.0) -1234000000.0)
(num-test (- 1234000000.0+2.71828182845905i) -1234000000.0-2.71828182845905i)
(num-test (- 1234000000.0-2.71828182845905i) -1234000000.0+2.71828182845905i)
(num-test (- 1234000000/10) -1234000000/10)
(num-test (- 2) -2)
(num-test (- 2.71828182845905) -2.71828182845905)
(num-test (- 2.71828182845905+3.14159265358979i) -2.71828182845905-3.14159265358979i)
(num-test (- 2.71828182845905-3.14159265358979i) -2.71828182845905+3.14159265358979i)
(num-test (- 2/2) -2/2)
(num-test (- 362880) -362880)
(num-test (- 362880/1234) -362880/1234)
(num-test (- 0+6i 1/4 0.5 7) -7.75+6.0i)
(num-test (- 1/2 0.5e0) 0.0e0)
(num-test (- 100000000000000.0 100000000000001.0) -1.0)
(num-test (- 1000000000000000000/3 1000000000000000001/3) -1/3)
(num-test (- 3 0 3 5 -6) 1)
(num-test (- 3 4) -1 )
(num-test (- 3) -3 )

(call-with-exit
 (lambda (ok)
   (for-each-permutation 
    (lambda args
      (when (not (morally-equal? (apply - args) (- (car args) (apply + (cdr args)))))
	(format #t "~A: ~A != ~A?~%" (port-line-number) (apply - args) (- (car args) (apply + (cdr args))))
	(ok)))
    '(1 1/2 0.5 1+i))))

(call-with-exit
 (lambda (ok)
   (for-each-permutation 
    (lambda args
      (when (not (morally-equal? (apply - args) (+ (car args) (- (apply + (cdr args))))))
	(format #t "~A: (- ~{~A~^ ~}) -> ~A?~%" (port-line-number) args (apply - args))
	(ok)))
    '(1 1/2 0.5 1+i -1/2 -1 -0.5 -1-i))))

(num-test (- -1.797693134862315699999999999999999999998E308 -9223372036854775808) -1.797693134862315699999999999999999999998E308)
(num-test (- -9223372036854775808 -9223372036854775808) 0)
(num-test (- -9223372036854775808 5.551115123125783999999999999999999999984E-17) -9.223372036854775808000000000000000055511E18)
(num-test (- -9223372036854775808 9223372036854775807 -9223372036854775808) -9223372036854775807)
(if with-bignums (num-test (- -9223372036854775808) 9223372036854775808))
(num-test (- 1.110223024625156799999999999999999999997E-16 -9223372036854775808) 9.223372036854775808000000000000000111022E18)
(num-test (- 1.110223024625156799999999999999999999997E-16 5.551115123125783999999999999999999999984E-17 5.42101086242752217060000000000000000001E-20) 5.545694112263356477829399999999999999977E-17)
(num-test (- 5.551115123125783999999999999999999999984E-17 1.110223024625156799999999999999999999997E-16) -5.551115123125783999999999999999999999984E-17)
(num-test (- 9223372036854775807 9223372036854775807) 0)
(num-test (- .(1.1)) -1.1)
(num-test (- 1. .()) -1.0)
(num-test (- 1/9223372036854775807 1/9223372036854775807) 0)
(num-test (- 1/98947 2/97499 3/76847) -36656755224/741360956847391)
(num-test (- 500009/500029 500057/500041) -18001284/250035001189)

(unless (or with-bignums (not (provided? 'overflow-checks)))
  (num-test (- 8 -1/9223372036854775807 1/9223372036854775807) 8.0)
;      (num-test (- most-positive-fixnum most-negative-fixnum) 1.8446744073709551615E19)
;      (num-test (- most-negative-fixnum most-positive-fixnum) -1.8446744073709551615E19)
;;; currently s7's optimizer screws up these cases
      )

(num-test (- -0.011326914400453525E0 -0.6668141757661364E0) 6.554872613656828749999999999999999999976E-1)
(num-test (- -0.46185382764946437E0 0.7488210697846337E0) -1.210674897434098070000000000000000000001E0)
(num-test (- -0.35834120541234993E0 -0.30919976341834987E0) -4.914144199400005999999999999999999999972E-2)
(num-test (- 0.44705025064976966E0 -0.9277893553610955E0) 1.374839606010865160000000000000000000002E0)
(num-test (- -0.47647537517067917E0 0.29158058381073604E0) -7.680559589814152099999999999999999999997E-1)
(num-test (- -0.021697999002707746E0 0.1779871773524142E0) -1.996851763551219460000000000000000000001E-1)
(num-test (- 0.4179484378019861E0 9.9990307469939E9) -9.999030746575951861270279525000000000019E9)
(num-test (- -0.7475415524823718E0 1.3993312799214797E9) -1.399331280669021252482371799999999999998E9)
(num-test (- 0.2519442433861928E0 -6.699632771871848E9) 6.699632772123792243386192799999999999993E9)
(num-test (- -0.5124988631497671E0 2.7959244812290273E9) -2.795924481741526163149767100000000000009E9)
(num-test (- -0.6870193827604301E0 4.851102442573468E9) -4.851102443260487591073418381249999999995E9)
(num-test (- 0.7609656780357723E0 7.481252865855436E8) -7.481252858245779544715519187499999999991E8)
(num-test (- -0.6301276042170191E0 -7.099314875214215E-11) -6.301276041460259512478578500000000000002E-1)
(num-test (- -0.4139053484357884E0 -2.897413526398709E-11) -4.139053484068142647360129100000000000006E-1)
(num-test (- -0.6944623060197281E0 -3.291569879873739E-11) -6.94462305986812401201262610000000000001E-1)
(num-test (- -0.2057822500703933E0 3.6505182026159854E-11) -2.057822501068984820261598540000000000004E-1)
(num-test (- -0.8792706674467908E0 8.094527736950817E-11) -8.792706675277360773695081699999999999978E-1)
(num-test (- -0.6888184243601332E0 9.127622796988807E-11) -6.888184244514094279698880700000000000006E-1)
(num-test (- -0.980711030497252E0 8.752272461345245E19) -8.752272461345245000098071103049725200009E19)
(num-test (- 0.8035082489836539E0 -3.903355151264917E19) 3.90335515126491700008035082489836539001E19)
(num-test (- -0.7537841372394811E0 -5.879942447417834E19) 5.879942447417833999924621586276051889998E19)
(num-test (- -0.6877475951546845E0 -2.3972266191169642E19) 2.397226619116964199931225240484531550001E19)
(num-test (- -0.43128282112433525E0 -5.422824998003439E19) 5.422824998003438999956871717887566474998E19)
(num-test (- 0.29538116818276694E0 1.1291858990580939E19) -1.129185899058093899970461883181723306002E19)
(num-test (- 0.9166687388673976E0 6.395175407123937E-21) 9.166687388673975999936048245928760629984E-1)
(num-test (- 0.41840538498193025E0 -2.6655662412599155E-21) 4.18405384981930250002665566241259915501E-1)
(num-test (- -0.8036940092501853E0 6.7473779576832565E-21) -8.036940092501853000067473779576832565009E-1)
(num-test (- 0.8555054025209989E0 -7.939970418096797E-21) 8.55505402520998900007939970418096796999E-1)
(num-test (- 0.3365495704567003E0 8.694519827555395E-21) 3.365495704567002999913054801724446050001E-1)
(num-test (- -0.7430322011471231E0 7.430332379292914E-22) -7.430322011471231000007430332379292914019E-1)
(num-test (- 5.102372414731216E9 -0.5073635765350494E0) 5.102372415238580007199111899999999999994E9)
(num-test (- 4.629827365822252E9 0.6534380055543355E0) 4.629827365168814268005234812499999999993E9)
(num-test (- 7.218192507117569E9 0.9781542046565127E0) 7.21819250613941476507004979999999999999E9)
(num-test (- 6.595760326622413E8 0.7339510561932947E0) 6.595760319282902834902380148437500000014E8)
(num-test (- 7.191166637703489E9 0.80792475493853E0) 7.191166636895564548650337188817616151937E9)
(num-test (- -7.95531405213956E9 0.5353636841430115E0) -7.955314052674923429931585718750000000006E9)
(num-test (- 5.438904545553836E8 6.533536518165114E9) -5.98964606360973083972930908203125E9)
(num-test (- -7.389650313101625E8 -9.983943153365381E9) 9.244978122055218499999999999999999999979E9)
(num-test (- 8.364404619492165E9 -7.600563055115287E9) 1.596496767460745161181640624999999999997E10)
(num-test (- 2.070813748323649E9 6.421052769114957E9) -4.350239020791307926177978515625E9)
(num-test (- -2.8555256820439434E9 -3.4077342921686625E8) -2.514752252827077150000000000000000000005E9)
(num-test (- 9.147878229420991E8 8.439982790150545E9) -7.525194967208446025848388671875E9)
(num-test (- -4.315772980070098E9 -6.48869466068404E-11) -4.315772980070097999935113053393159599999E9)
(num-test (- -3.5186299785635023E9 3.990046539849716E-11) -3.518629978563502300039900465398497159997E9)
(num-test (- 2.5645532837267537E9 8.566645694205622E-13) 2.564553283726753699999143335430579437802E9)
(num-test (- 6.145110896031829E9 -9.242734002954773E-11) 6.145110896031828880402485933779547730013E9)
(num-test (- -6.6836855975624E9 9.117930361283473E-11) -6.683685597562399864287956647362834729995E9)
(num-test (- -1.7472828462085754E8 -5.125838712019503E-11) -1.747282846208575399487416128798049699998E8)
(num-test (- 9.05675399397055E9 9.086705650502484E19) -9.0867056495968086006029449462890625E19)
(num-test (- -5.834806594586836E9 9.981576053842906E19) -9.981576054426386659458683599999999999999E19)
(num-test (- 3.047010922754272E9 1.1715352070471352E19) -1.171535206742434107724572801589965820312E19)
(num-test (- 7.294295638574767E9 2.845702947515113E19) -2.845702946785683436142523288726806640625E19)
(num-test (- 8.264143132493019E9 -1.6322956072452289E19) 1.632295608071643213249301910400390625E19)
(num-test (- -9.597823287256088E9 3.954126758718671E19) -3.95412675967845332872560880000000000001E19)
(num-test (- 3.229389511771705E9 -4.329831377266493E-21) 3.229389511771705150604248046879329831377E9)
(num-test (- 6.897089200279753E9 2.4428208790287663E-21) 6.897089200279752731323242187497557179116E9)
(num-test (- 2.3579775300187545E9 4.729400988996349E-21) 2.357977530018754499999999999995270599018E9)
(num-test (- 1.6718929117460046E9 5.8162277016717065E-21) 1.671892911746004599999999999994183772301E9)
(num-test (- 2.537177500868296E9 1.4856605280697543E-21) 2.537177500868296146392822265623514339469E9)
(num-test (- 6.117674696930935E9 -1.6187214719634357E-21) 6.117674696930934906005859375001618721474E9)
(num-test (- 4.1877888304549216E-11 -0.06920550501017497E0) 6.920550505205285830454921600000000000007E-2)
(num-test (- 9.61054846124015E-11 0.885309193732889E0) -8.85309193636783481398417376384291797877E-1)
(num-test (- 2.5559085051828467E-11 -0.8112181469812297E0) 8.112181470067887850518284670000000000006E-1)
(num-test (- -1.4549570208293283E-12 -0.5049325945871657E0) 5.049325945857107429791706717000000000005E-1)
(num-test (- -7.091628047158497E-11 0.61946884965934E0) -6.194688497302562955729347334266968816526E-1)
(num-test (- 2.877466355456826E-11 0.4496491857374E0) -4.49649185708625317645189543551619872451E-1)
(num-test (- 1.3041612488449928E-12 5.408018587130755E9) -5.40801858713075542449820755750115500719E9)
(num-test (- -5.379752339715717E-11 -4.009594691514288E9) 4.009594691514287999946202476602842829998E9)
(num-test (- 7.023042501342336E-12 -3.4153434285746374E9) 3.415343428574637400007023042501342336004E9)
(num-test (- 6.968174934871611E-11 4.713087404332662E9) -4.713087404332661628653462781901283890003E9)
(num-test (- -5.153562653896506E-11 -8.44732228013254E8) 8.447322280132540463885888851797849400006E8)
(num-test (- -8.424177457818745E-11 1.6817117809824567E9) -1.681711780982456700084241774578187449998E9)
(num-test (- 3.374755984316538E-11 8.893678266883364E-11) -5.518922282566826000000000000000000000009E-11)
(num-test (- -8.684123447823306E-11 -7.888825869147879E-11) -7.952975786754269999999999999999999999987E-12)
(num-test (- 7.788477523205632E-11 1.741674745286914E-11) 6.046802777918717999999999999999999999988E-11)
(num-test (- 6.546622477606044E-11 -4.7719651007530584E-11) 1.131858757835910240000000000000000000001E-10)
(num-test (- -1.8595152377503265E-11 5.7288738553553045E-11) -7.588389093105630999999999999999999999984E-11)
(num-test (- -8.184033550427558E-11 -8.834399228929296E-11) 6.503656785017380000000000000000000000234E-12)
(num-test (- 5.749469292140762E-11 7.493129199779113E19) -7.493129199779112999999999999994250530697E19)
(num-test (- -5.2285095120702066E-11 -2.0611179974216552E19) 2.061117997421655199999999999994771490491E19)
(num-test (- -8.84727820032067E-11 4.7423077384022024E19) -4.742307738402202400000000000008847278205E19)
(num-test (- 3.437676989338625E-11 -3.5368755480277647E19) 3.536875548027764700000000000003437676988E19)
(num-test (- 2.2665031619145437E-11 -6.072845659234921E19) 6.072845659234921000000000000002266503153E19)
(num-test (- -8.429070146313393E-11 5.134329153614969E18) -5.134329153614969000000000000084290701453E18)
(num-test (- -9.009531819191212E-11 2.301790665456671E-22) -9.009531819214229906654566710000000000025E-11)
(num-test (- -2.706942469371907E-11 9.282350542107287E-21) -2.706942470300142054210728700000000000001E-11)
(num-test (- 5.358266626996117E-11 -4.409057695582885E-22) 5.358266627040207576955828850000000000004E-11)
(num-test (- -7.189537285608088E-11 9.569273217393917E-21) -7.189537286565015321739391700000000000027E-11)
(num-test (- -4.160295905335358E-11 5.930867524794025E-21) -4.160295905928444752479402499999999999992E-11)
(num-test (- 6.7922062777334035E-12 -7.747524338474154E-22) 6.792206278508155933847415400000000000006E-12)
(num-test (- -9.038821102045805E19 0.04779131019959271E0) -9.038821102045805000004779131019959271002E19)
(num-test (- 2.2020595055495963E19 -0.424631558292516E0) 2.202059505549596300042463155829251600002E19)
(num-test (- -8.164003027214308E19 0.6832198147365239E0) -8.164003027214308000068321981473652389997E19)
(num-test (- -3.878233560364984E19 -0.28756619113600546E0) -3.878233560364983999971243380886399453999E19)
(num-test (- 7.0829003521450525E19 -0.6071548125948544E0) 7.08290035214505250006071548125948544E19)
(num-test (- 5.968540808784698E19 0.7674294173432648E0) 5.968540808784697999923257058265673519995E19)
(num-test (- -2.2143621795153547E19 -2.443529365769125E9) -2.214362179271001763423087500000000000004E19)
(num-test (- -9.77092538926342E18 5.903189771537687E8) -9.770925389853738977153768658638000488281E18)
(num-test (- 9.974714452399537E19 -6.980456691485629E9) 9.974714453097582669148562899999999999991E19)
(num-test (- 1.7428950527159094E18 3.68843657888816E9) 1.742895049027472821111839771270751953125E18)
(num-test (- -1.1094381875350845E19 -7.157723640671709E9) -1.109438186819312135932829100000000000002E19)
(num-test (- -3.638795590369631E19 6.9246542750294075E9) -3.638795591062096427502940750000000000005E19)
(num-test (- -5.66543282261991E19 -5.1005028153082024E-11) -5.665432822619909999999999999994899497189E19)
(num-test (- -3.901527864456216E19 -1.064153465992923E-12) -3.901527864456215999999999999999893584646E19)
(num-test (- 1.1477489418879848E19 3.327888063907735E-11) 1.147748941887984799999999999996672111937E19)
(num-test (- 3.508978072054437E19 9.238453417997638E-11) 3.508978072054436999999999999990761546584E19)
(num-test (- -4.7642024461416964E19 -4.758309941438892E-11) -4.764202446141696399999999999995241690065E19)
(num-test (- -8.307715835429606E19 3.313910202186439E-11) -8.307715835429606000000000000003313910214E19)
(num-test (- 2.704675010192592E18 -2.6840207147078365E19) 2.9544882157270957E19)
(num-test (- -9.860969100714668E18 -4.719594638795429E19) 3.7334977287239622E19)
(num-test (- 7.87799781828944E18 -6.657221298850535E19) 7.4450210806794789744E19)
(num-test (- -3.3937781740759863E19 4.783805995045389E19) -8.1775841691213753E19)
(num-test (- -1.0747572720102216E19 -1.7144708598072445E19) 6.397135877970229E18)
(num-test (- 1.3938845733158445E19 5.604369854609131E19) -4.2104852812932865E19)
(num-test (- 6.0938348303695315E19 1.1005522580049531E-21) 6.0938348303695315E19)
(num-test (- -2.4870844028694925E19 1.5391650322730598E-22) -2.4870844028694925E19)
(num-test (- 7.323118607079343E19 6.637280375859432E-21) 7.323118607079343E19)
(num-test (- -4.181201584825501E19 4.768935182006663E-21) -4.181201584825501E19)
(num-test (- 4.1225910279381205E19 6.117191687463543E-21) 4.1225910279381205E19)
(num-test (- 6.438313875980151E17 -1.4883489002691529E-21) 6.438313875980151E17)
(num-test (- -4.573961206963222E-21 0.3586300020381973E0) -3.586300020381973000045739612069632220001E-1)
(num-test (- 7.74206782371325E-22 0.23168389210368656E0) -2.316838921036865599992257932176286750005E-1)
(num-test (- 8.572446613640605E-21 0.6114581963443891E0) -6.114581963443890999914275533863593949978E-1)
(num-test (- -8.539467934859551E-21 0.33474735899049E0) -3.347473589904900182020371578704711119401E-1)
(num-test (- -5.55811309570968E-21 -0.9637216018651454E0) 9.637216018651453999944418869042903199998E-1)
(num-test (- -6.705839413964189E-21 0.3787619614522374E0) -3.787619614522374000067058394139641890005E-1)
(num-test (- 1.338539206480238E-22 6.683968625235106E9) -6.683968625235106468200683593749866146082E9)
(num-test (- -9.64078167549023E-21 3.291420859310843E9) -3.291420859310842990875244140634640781671E9)
(num-test (- -9.26536204591093E-22 2.9839295142529476E8) -2.98392951425294760000000000000926536205E8)
(num-test (- -3.647737608953592E-21 6.115300020921433E8) -6.115300020921432971954345703161477376078E8)
(num-test (- 1.4069763806331204E-21 -1.183109060480878E9) 1.18310906048087800000000000000140697638E9)
(num-test (- -6.0037865798761924E-21 -7.442246743849378E9) 7.442246743849377999999999999993996213425E9)
(num-test (- -5.994118986299138E-21 -9.091558282012836E-11) 9.091558281413424101370086199999999999991E-11)
(num-test (- 6.969393585974241E-21 3.435352867093995E-11) -3.435352866397055641402575899999999999989E-11)
(num-test (- -6.278554484817533E-22 -4.7211920270841604E-11) 4.721192027021374855151824670000000000001E-11)
(num-test (- -8.603262886304741E-21 1.7296517702077242E-11) -1.729651771068050488630474100000000000006E-11)
(num-test (- 4.104502790901735E-21 -4.8473213720301105E-11) 4.847321372440560779090173499999999999986E-11)
(num-test (- -4.449725859444968E-21 -8.944265568403936E-11) 8.944265567958963414055503200000000000002E-11)
(num-test (- 4.828216540804827E-21 -1.1712152029346877E19) 1.1712152029346877E19)
(num-test (- -5.65034940464881E-21 -9.445303840982011E19) 9.445303840982011E19)
(num-test (- -7.24107519738777E-21 2.340578690102746E19) -2.340578690102746E19)
(num-test (- 1.7659593956231534E-21 -8.048768257390671E18) 8.048768257390671E18)
(num-test (- -3.0538518255248124E-21 8.834631867521575E19) -8.834631867521575E19)
(num-test (- 8.57952908388053E-21 -5.730742870111307E19) 5.730742870111307E19)
(num-test (- -4.5090103564928485E-21 1.8907114777916313E-21) -6.399721834284479799999999999999999999996E-21)
(num-test (- -3.8487625143236447E-22 5.354282198078924E-21) -5.739158449511288470000000000000000000003E-21)
(num-test (- 2.6660110440404615E-22 3.833744224501756E-22) -1.167733180461294499999999999999999999996E-22)
(num-test (- -7.503762004261027E-22 -9.623906576475644E-21) 8.873530376049541300000000000000000000014E-21)
(num-test (- -9.113431042260725E-21 -3.5516521546085545E-21) -5.561778887652170499999999999999999999997E-21)
(num-test (- -3.4813735333296525E-21 -2.6602650182385188E-21) -8.211085150911336999999999999999999999942E-22)

(num-test (- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99) -4948)

(unless (or with-bignums (not (provided? 'overflow-checks)))
  (num-test (- 1/9223372036854775807 1/9223372036854775806) -1.1754943508223e-38)
  (num-test (- 1/98947 2/97499 3/76847 4/61981 5/59981 6/66601) -0.00028742959363084)
  (num-test (- 1/98947 2/97499 3/76847 4/61981 5/59981) -0.00019734085622449)
  (num-test (- 1/98947 2/97499 3/76847 4/61981) -0.00011398112564314)
  (num-test (- 500009/500029 500057/500041 500083/500069) -1.00009999119288)
  (num-test (- 98947 2/97499 76847 4/61981 5/59981) 22099.999831591)
  (test (< (abs (- (/ 1/98947 2/97499 3/76847 4/61981) 195556288.07955816413500830)) 1e-8) #t))

(when with-bignums
  (num-test (- -4611686018427387904 4611686018427387906) -9223372036854775810)
  (num-test (- -9223372036854775800 10) -9223372036854775810)
  (num-test (- 1/9223372036854775807 1/9223372036854775806) -1/85070591730234615838173535747377725442)
  (num-test (- 1/98947 2/97499 3/76847 4/61981 5/59981 6/66601) -52761146275983172771170709/183561983334767209753061626751)
  (num-test (- 1/98947 2/97499 3/76847 4/61981 5/59981) -543899925850203550003/2756144552405627689570151) 
  (num-test (- 1e40+1e30i 1e40-1e30i) 0+2e30i)
  (num-test (- 2 12345678901234567890+12345678901234567890i) -12345678901234567888-12345678901234567890i)
  (num-test (- 500009/500029 500057/500041 500083/500069) -125047255383687283/125034753009582041)
  (num-test (- 9223372036854775807 -9223372036854775808) 18446744073709551615)
  (num-test (- 98947 2/97499 76847 4/61981 5/59981) 8010593845541429507/362470312515139)
  (num-test (- most-negative-fixnum) 9223372036854775808)
  (num-test (- 3872339191937382556 13437882608410293981) -9565543416472911425)
  (num-test (- 12702320881720530101 13823645380834800545) -1121324499114270444)
  (num-test (- 10222969257152373972 -3454292165863475982) 13677261423015849954)
  (num-test (- 591233951053628288 -17639978232337836611) 18231212183391464899)
  (num-test (- -7878405903223218778 9050739027069287469) -16929144930292506247)
  (num-test (- 11347120771894057376 8443917396834074370) 2903203375059983006)
  (num-test (- 7831959259127703467 -257470007821066702597399141202130667973) 257470007821066702605231100461258371440)
  (num-test (- 1092406341647857980 -325710450166845666190895573961860069495) 325710450166845666191987980303507927475)
  (num-test (- -4220606126689357919 73461013742902296577411907972196819778) -73461013742902296581632514098886177697)
  (num-test (- -5112059189225304080 334306213789148650102245018234146620793) -334306213789148650107357077423371924873)
  (num-test (- 3093346224554776175 -204967241927023874963787190016588249299) 204967241927023874966880536241143025474)
  (num-test (- -5735747638156472357 -3881750746805128137401544408305666047) 3881750746805128131665796770149193690)
  (num-test (- 17639095392510638323 13312205908441007415860933757605397223142073616822325142416364932887680287063250296996056787873086490231950036662943632990219865746131453861285495087665017) -13312205908441007415860933757605397223142073616822325142416364932887680287063250296996056787873086490231950036662943632990219865746131436222190102577026694)
  (num-test (- 16304056910692545233 1463591032326743052350022746892396184459320617971409440301562638996633667625451301419074212369365394140737678584830314878769698416417465834928609990708982) -1463591032326743052350022746892396184459320617971409440301562638996633667625451301419074212369365394140737678584830314878769698416417449530871699298163749)
  (num-test (- -10347586523508777315 12614325304787850623826535169596975975360455924114817820074336137897280818245940873677389644701038550150832199897314137414727161192173691528917744363375331) -12614325304787850623826535169596975975360455924114817820074336137897280818245940873677389644701038550150832199897314137414727161192173701876504267872152646)
  (num-test (- 16875252323587344863 -10230183557696638447600885112945653217398839137450096120772416948425622105048400944465287395231588821521217980407867153259741079758527788318592431794213674) 10230183557696638447600885112945653217398839137450096120772416948425622105048400944465287395231588821521217980407867153259741079758527805193844755381558537)
  (num-test (- 8574302739232756920 2945205250727759066959418729185252318153395797902208079569164623770839848878181416073351760975066439564334127158302281471631001294503759011790017443478716) -2945205250727759066959418729185252318153395797902208079569164623770839848878181416073351760975066439564334127158302281471631001294503750437487278210721796)
  (num-test (- -17657597319577965851 -470389901349206124503884936612357721199915776516939967013182926735009022045917047211666512521578494339222795740836335004070464944715357800461845632614015) 470389901349206124503884936612357721199915776516939967013182926735009022045917047211666512521578494339222795740836335004070464944715340142864526054648164)
  (num-test (- 11472336850218354926 16764018932433717867649699977474298016589762238077229911249331402108995850754999065988360217500238643747316139204767820295123085026049273617874157749889925712672510963712964034497935503076689670786498045302562704435768723916334451317158760704743066709581593570757498670622547878516907127632802801541072452593999435195637193819500375063696114131057474475407791672955417184592088612921927282233762919112197264895445408873539746256555444555901857369535350160665235184955438709679669964546134487688796078142789125799020704969226557493354453298489954288702387159956161243151013189140749021799388406290339231792790773612376) -16764018932433717867649699977474298016589762238077229911249331402108995850754999065988360217500238643747316139204767820295123085026049273617874157749889925712672510963712964034497935503076689670786498045302562704435768723916334451317158760704743066709581593570757498670622547878516907127632802801541072452593999435195637193819500375063696114131057474475407791672955417184592088612921927282233762919112197264895445408873539746256555444555901857369535350160665235184955438709679669964546134487688796078142789125799020704969226557493354453298489954288702387159956161243151013189140749021799388406290327759455940555257450)
  (num-test (- 12682607562584942903 32133619583510009354538204193505267426986629771080807813988708187761849276650847958886764459302043799013813125903744946349479743277662066609741649009023451783267511140245797235200413941774959851628239089013586399425314412329003636059313583335807925401822165199322334470452126484173417518861322963430951772895619791799137157183662289329901964728384697377777905235894234370773419160283767144177627084271804319157013765325677633945370597318765372346484383325176768117059688792498687750479618961541872574768601477738410497806623403054372221338126223825515939164627992974469102910882915893925327931884157735553718792115929) -32133619583510009354538204193505267426986629771080807813988708187761849276650847958886764459302043799013813125903744946349479743277662066609741649009023451783267511140245797235200413941774959851628239089013586399425314412329003636059313583335807925401822165199322334470452126484173417518861322963430951772895619791799137157183662289329901964728384697377777905235894234370773419160283767144177627084271804319157013765325677633945370597318765372346484383325176768117059688792498687750479618961541872574768601477738410497806623403054372221338126223825515939164627992974469102910882915893925327931884145052946156207173026)
  (num-test (- 14621880654476679971 -10075923784619510279100488003620810539888599376089081798647754628017452762406215094511315867213396543200861274584884759429891242650999761503100661310915213260386281412125687376866399124849043409890009033179987278297335571911640353059036551139958369871790768643514550179661619387008678118363266091945225880595898524898713646458647465935791224159084684209727153050053537752111696883536364966526666445737103854446009305531519860527938394412863332757413309423156200192973778629503534709731073637828912608835085933003410694216843775182940057891552358942312728978810053715387504707194992816961400377579655168106377696154728) 10075923784619510279100488003620810539888599376089081798647754628017452762406215094511315867213396543200861274584884759429891242650999761503100661310915213260386281412125687376866399124849043409890009033179987278297335571911640353059036551139958369871790768643514550179661619387008678118363266091945225880595898524898713646458647465935791224159084684209727153050053537752111696883536364966526666445737103854446009305531519860527938394412863332757413309423156200192973778629503534709731073637828912608835085933003410694216843775182940057891552358942312728978810053715387504707194992816961400377579669789987032172834699)
  (num-test (- -3220156644655019630 -8347829670073174550775641165362740628312221836466572623516708794243074870361401136762432100726575330214254748615114820602945887237367461962207075265579588481261313345359877816874924645801358760718027997416917747796144940020489321523749233377708490614979453376328244189926517907474704635785063100359787580409065317918203485474119227673185211436285930586838616288721370975925191964611302275354365110550116042403226844820172448647475637867255305805337047967053177320593337377763657329816935516961201488840745892529800883680912275812320160312651894919502389242002380151562481051684439333368396132543667539444686619670713) 8347829670073174550775641165362740628312221836466572623516708794243074870361401136762432100726575330214254748615114820602945887237367461962207075265579588481261313345359877816874924645801358760718027997416917747796144940020489321523749233377708490614979453376328244189926517907474704635785063100359787580409065317918203485474119227673185211436285930586838616288721370975925191964611302275354365110550116042403226844820172448647475637867255305805337047967053177320593337377763657329816935516961201488840745892529800883680912275812320160312651894919502389242002380151562481051684439333368396132543664319288041964651083)
  (num-test (- 11628988978410243120 21091260149209133824278525560739673446778991946138130571540201996950100883736332286627324787663044982195445635023357027423513202277912840570399895946346028843517588470258087913846945044832851780108963206182331994065720076983528527849542421619745503796476103034657238118665288185878258232226731582201217795631247916614224227701409259346052937919425072595891571572960468193421257458185693656090215937518204243652916583730260295885562094977775951577484951577581277292356830523013216949489797535362720471761788697932265967910160407593278848113303674799017334692501935041730808945554336564957621028111014116286675587727714) -21091260149209133824278525560739673446778991946138130571540201996950100883736332286627324787663044982195445635023357027423513202277912840570399895946346028843517588470258087913846945044832851780108963206182331994065720076983528527849542421619745503796476103034657238118665288185878258232226731582201217795631247916614224227701409259346052937919425072595891571572960468193421257458185693656090215937518204243652916583730260295885562094977775951577484951577581277292356830523013216949489797535362720471761788697932265967910160407593278848113303674799017334692501935041730808945554336564957621028111002487297697177484594)
  (num-test (- -15960716439913426281 18799211173341989380260980155501104944815245973352765317821146163884181375747259542484535639646490774929026134833947975785613727050541297797675705933339289016115326958150660323801621778641184271728990164666383865587422591755046779736996211052149338115836473967202556153668963815595875844414662034458693455631979862997316049580586739835122770408911308146605671192538040301857163633538268589024651373766021087864982140201615461513687698136663128896835597598904095187715456109340116329587986878167776146023396961265667934659006280575496363066974484893764810659481361856335795455814679851690737943592227795474197104696127) -18799211173341989380260980155501104944815245973352765317821146163884181375747259542484535639646490774929026134833947975785613727050541297797675705933339289016115326958150660323801621778641184271728990164666383865587422591755046779736996211052149338115836473967202556153668963815595875844414662034458693455631979862997316049580586739835122770408911308146605671192538040301857163633538268589024651373766021087864982140201615461513687698136663128896835597598904095187715456109340116329587986878167776146023396961265667934659006280575496363066974484893764810659481361856335795455814679851690737943592243756190637018122408)
  (num-test (- -181065640455671431985325539445069267017 14120143334024043377) -181065640455671431999445682779093310394)
  (num-test (- -91295299684959299024846233061686623774 6891102275697080803) -91295299684959299031737335337383704577)
  (num-test (- -252582289949155881579950873916766853744 883304029266526072) -252582289949155881580834177946033379816)
  (num-test (- -10104159950635417603045689770006558103 17251490913777465304) -10104159950635417620297180683784023407)
  (num-test (- 288463495341489091297108607960869684860 -16376960611483226267) 288463495341489091313485568572352911127)
  (num-test (- 204661965092367792468062569536290631004 7774991291341524479) 204661965092367792460287578244949106525)
  (num-test (- 174559967167400201536723778015754014369 168183438971818617783400303174116396891) 6376528195581583753323474841637617478)
  (num-test (- -253300708624436983509156598368557395374 -77166863757693227553099778725240875400) -176133844866743755956056819643316519974)
  (num-test (- -38587765028356074196061530813295290944 5999161273284748726648331130480323187) -44586926301640822922709861943775614131)
  (num-test (- -236400856885875891058508662756360145662 222191413471626205952456600591947275777) -458592270357502097010965263348307421439)
  (num-test (- 212937903940173587742882129816769611096 336470165768472077447806282475185249734) -123532261828298489704924152658415638638)
  (num-test (- -264812595676159375893264580577855253845 -247068943830535581577267897204259299723) -17743651845623794315996683373595954122)
  (num-test (- -1725732715479127274526681751197327660 -2279805492899538651574406423954277869507456204136276822451602661149698386520868702017367409743272511010382761246500508887739763323997191435566266331339917) 2279805492899538651574406423954277869507456204136276822451602661149698386520868702017367409743272511010382761246500507162007047844869916908884515134012257)
  (num-test (- -220007189346579184019349894240059989979 9116030813176547770422918633286023943039811682891023288884273747820892639481842291616424036020927750322528731882517057595815179415042385175627374957565803) -9116030813176547770422918633286023943039811682891023288884273747820892639481842291616424036020927750322528731882517277603004525994226404525521615017555782)
  (num-test (- 139683266109784685815165642637380856544 5782493350903499652295971390391981928106911831248674750993968151944332845911526084530951283012280786005612601970108688202931002414214353708335212597807345) -5782493350903499652295971390391981928106911831248674750993968151944332845911526084530951283012280786005612601970108548519664892629528538542692575216950801)
  (num-test (- 239160165978290709841254489756277328273 5152132850125501873897264811465207492706871561577273155117982457627773151595716641409297120994045059130053034927464958986304380141364542178714472948085275) -5152132850125501873897264811465207492706871561577273155117982457627773151595716641409297120994045059130053034927464719826138401850654700924224716670757002)
  (num-test (- 315772704643232632782106484978382006176 -3689252327480456512393153800679864208480329729627292260734151097785848947569336194072922395859496552999163037466184616218582046814434719444842678248982224) 3689252327480456512393153800679864208480329729627292260734151097785848947569336194072922395859496552999163037466184931991286690047067501551327656630988400)
  (num-test (- 82735713197488344149642668226610301853 -12473025194535761005577066561696471986140205263843017221991729197337093872383371857001077050460827652296473928714097816492579684543651922277865558518876774) 12473025194535761005577066561696471986140205263843017221991729197337093872383371857001077050460827652296473928714097899228292882031996071920533785129178627)
  (num-test (- 63472235942371758467270296983419551089 -7866520408163137968600317959735552406794938230345293650627055135268307695389903092041438746530663083967329111232451176014649873249349534808700483360707382397988918594143264031213181385790969271527978925616276399184489007642142996251807222768397530946779296600805549276528669432847672215219943599871223372831999133812100481632278022608906065923652981249057846548868473376683960144009223047416366697876553049362242497225174860431577034875737250719899362881567590934060155436179316063810148362442197071642183371654740845983314705249832168923202400873364289483910868432511677656218937984504828452980698439495961392749596) 7866520408163137968600317959735552406794938230345293650627055135268307695389903092041438746530663083967329111232451176014649873249349534808700483360707382397988918594143264031213181385790969271527978925616276399184489007642142996251807222768397530946779296600805549276528669432847672215219943599871223372831999133812100481632278022608906065923652981249057846548868473376683960144009223047416366697876553049362242497225174860431577034875737250719899362881567590934060155436179316063810148362442197071642183371654740845983314705249832168923202400873364289483910868432511677656219001456740770824739165709792944812300685)
  (num-test (- -284018520801241078671538235859630240269 -5529748211779294240854894683633173443789067073881249229985499707296461959655918837051490512357840133495603640185675483847478587849599477020706893805485599954539589062532211767295361120129440287144117406526027552427750375526095104163474774446716012360038076376952619723549765229763943818011605991300849052030142173100367582906381575666628005795818339029350398340616624791399526643991489247585213423174803853961438830286737553181353007081438503238779644371968004083452645077716952159339978836669723137339898471600546912430030276920763475622536295311290657163861398519747560279682401429552174530714298081464588450842581) 5529748211779294240854894683633173443789067073881249229985499707296461959655918837051490512357840133495603640185675483847478587849599477020706893805485599954539589062532211767295361120129440287144117406526027552427750375526095104163474774446716012360038076376952619723549765229763943818011605991300849052030142173100367582906381575666628005795818339029350398340616624791399526643991489247585213423174803853961438830286737553181353007081438503238779644371968004083452645077716952159339978836669723137339898471600546912430030276920763475622536295311290657163861398519747560279682117411031373289635626543228728820602312)
  (num-test (- -171812101820192353275910956459431262142 11401673303315394031728944442295528921842441448377692701102691446500671963119794838260543877466107345474902885032629120622020177051592733148817057943390167845763358795044702079370835841331467130719834250134674578757640577473495192331790176510774020541399177011446664359866582351045889299070080989390219063301859447807907203943168891690028442190793548699886572720360741686677780644932612683647303776634496172481504075784427704287335805355801794320914944330891519283383694196486986108936857630373759865062862204149003789919218681050221366182434949855054760827976853645027544605870235074909890698574792562001595287630131) -11401673303315394031728944442295528921842441448377692701102691446500671963119794838260543877466107345474902885032629120622020177051592733148817057943390167845763358795044702079370835841331467130719834250134674578757640577473495192331790176510774020541399177011446664359866582351045889299070080989390219063301859447807907203943168891690028442190793548699886572720360741686677780644932612683647303776634496172481504075784427704287335805355801794320914944330891519283383694196486986108936857630373759865062862204149003789919218681050221366182434949855054760827976853645027544605870406887011710890928068472958054718892273)
  (num-test (- -243638660221338112796448050030955119997 -32214383478080953899491069562585164652288236626686985994647827422262342469970423345510055643470262764747630363450204055220886177681745412924556264758690138113272748656941509018308925555317383307928766093730384151056027828368474245304944063213926492719166086055718735381341569379006804236876950175122702350552198046290567043195716369691666842524594399597143281611765509174168738392889075290806378316647736667077047013214732267367344808724905727602402784621437141760604478301412768904784950365257469208085143467704875589485635570084387755189599791857576855454112556762755762408826226326879491415484319411662301650468948) 32214383478080953899491069562585164652288236626686985994647827422262342469970423345510055643470262764747630363450204055220886177681745412924556264758690138113272748656941509018308925555317383307928766093730384151056027828368474245304944063213926492719166086055718735381341569379006804236876950175122702350552198046290567043195716369691666842524594399597143281611765509174168738392889075290806378316647736667077047013214732267367344808724905727602402784621437141760604478301412768904784950365257469208085143467704875589485635570084387755189599791857576855454112556762755762408825982688219270077371522963612270695348951)
  (num-test (- -126332081511349770866908261827634312283 31497387372874133218238910173378055967910722258532087598053588964599898753455370244114881403020152175272452951858324158004662566613339529101292284073176382818309096142522412043073218657587031893636358434796164444941535757484360125937835242214199979245499374972029624710574236962978707708765065292759037309958875006017588240959790355958632745299212449602934380927677385974488564420550408281673927387615657765312151272852486266800510090872812376232597458154951925709496664568906509814364388823105469855516803225244972466742963619633076158367569109107733990828830121948130235858799809203410103682003414364238243553515261) -31497387372874133218238910173378055967910722258532087598053588964599898753455370244114881403020152175272452951858324158004662566613339529101292284073176382818309096142522412043073218657587031893636358434796164444941535757484360125937835242214199979245499374972029624710574236962978707708765065292759037309958875006017588240959790355958632745299212449602934380927677385974488564420550408281673927387615657765312151272852486266800510090872812376232597458154951925709496664568906509814364388823105469855516803225244972466742963619633076158367569109107733990828830121948130235858799935535491615031774281272500071187827544)
  (num-test (- 219979452670016849533060110266815720199 3900115048441644499033281842448985956665866771934663536385503692700586024397767816761943054115584011069129310718114010862034970648115172218305599786238607524420973404711138276011261135403209178420948996472570042497859127324157786975578751148348046315727383390370594954695454631662061021971027739429505825056455676233533511412589936865597034183410893428831818716136282201523804692574965779771140320669492229416601369453681528301333865290947482219850340728455965391492610516639151652595539203632139883064874286555941718154489936421274731413286355640404192677546692090304496817063325766995908926108582896362623757323811) -3900115048441644499033281842448985956665866771934663536385503692700586024397767816761943054115584011069129310718114010862034970648115172218305599786238607524420973404711138276011261135403209178420948996472570042497859127324157786975578751148348046315727383390370594954695454631662061021971027739429505825056455676233533511412589936865597034183410893428831818716136282201523804692574965779771140320669492229416601369453681528301333865290947482219850340728455965391492610516639151652595539203632139883064874286555941718154489936421274731413286355640404192677546692090304496817063105787543238909259049836252356941603612)
  (num-test (- 585873325961105129055557280004608765382109855007674169500308242261038324959928764512890600512016613154122762798104714052579267789493643522748210870974797 -1855792162818946202) 585873325961105129055557280004608765382109855007674169500308242261038324959928764512890600512016613154122762798104714052579267789493645378540373689920999)
  (num-test (- -3026050092505200332789765255096964033685859497096213532090644235603419347590512426830117415222669642053441336442247132403948783838396746566100575461602162 18009081534399282710) -3026050092505200332789765255096964033685859497096213532090644235603419347590512426830117415222669642053441336442247132403948783838396764575182109860884872)
  (num-test (- -11124638695599888462310706699308855434715251048597328942409434888923094027849143412724699165971400546471660924330688750607774759764580214088920441698992069 -4827559068742614723) -11124638695599888462310706699308855434715251048597328942409434888923094027849143412724699165971400546471660924330688750607774759764580209261361372956377346)
  (num-test (- 4950293428090696283711882613183655723616682297360442241017758383241177602498881186549809051670562038601658285833496694108818253845693871318067007752043113 17597810481352184048) 4950293428090696283711882613183655723616682297360442241017758383241177602498881186549809051670562038601658285833496694108818253845693853720256526399859065)
  (num-test (- -5733769947958740467479139247420201065087494801172241127791526686385518674532830661413722661802560247463032020003355494614502034002778775472609306735864748 -3892174127829225880) -5733769947958740467479139247420201065087494801172241127791526686385518674532830661413722661802560247463032020003355494614502034002778771580435178906638868)
  (num-test (- 8320894458193427045187598554188178307429755504967209344418448624882517461814957461249858674758807195827056824653471934409067429988676743031117653237018365 -12861394200627120797) 8320894458193427045187598554188178307429755504967209344418448624882517461814957461249858674758807195827056824653471934409067429988676755892511853864139162)
  (num-test (- 13033402737450594044106258936169013897237368708138118260402180886096095497725071502601849887805439844083105685971731015312020770945603825344926844435936044 236396022362585261770052671762207864597) 13033402737450594044106258936169013897237368708138118260402180886096095497725071502601849887805439844083105685971730778915998408360342055292255082228071447)
  (num-test (- 12170667278114656173974716189098171384426379753661081475485441559687661443127166543908925678856145097632475832903680828294561265828775791256812588754280222 -276673555533799047589626400978981416789) 12170667278114656173974716189098171384426379753661081475485441559687661443127166543908925678856145097632475832903681104968116799627823380883213567735697011)
  (num-test (- -12755594876262399860618168642932232021734362385933348033134635580177924615701078617214764415318471507488803810365565826229169313660087149542130819663319659 -157671440495648010763311068579191828684) -12755594876262399860618168642932232021734362385933348033134635580177924615701078617214764415318471507488803810365565668557728818012076386231062240471490975)
  (num-test (- 8664063140780163008577373335591938905735059211566906376953760862047748343846207426667781783874718320339071949903053785280430612875488847226724390758938740 54361107931665215623681874454167019934) 8664063140780163008577373335591938905735059211566906376953760862047748343846207426667781783874718320339071949903053730919322681210273223544849936591918806)
  (num-test (- 3699576825118349347309026261327541749454660339251578894574483235547605815416603169143590292164644149607672871236942391817131531474661895913650810587431606 -50508350367572393968128467319633674717) 3699576825118349347309026261327541749454660339251578894574483235547605815416603169143590292164644149607672871236942442325481899047055864042118130221106323)
  (num-test (- 5626548453644136572409808769267055618695663227750732922630041368983808478347120771651822300668480671524976882745306794511840379704578900504784165956486985 170502882789371639987361620116696459267) 5626548453644136572409808769267055618695663227750732922630041368983808478347120771651822300668480671524976882745306624008957590332938913143164049260027718)
  (num-test (- -10859007735074693411217019392659638207496329895257318665547454149984863458541990037760564769787816800806064437172810158051442267508476778676439633382657890 -7558060977666720080449823996328496253877735754811271086853901493753796001778345391546991917892931500169890406340928835457635973812901681485438886367096185) -3300946757407973330767195396331141953618594140446047578693552656231067456763644646213572851894885300636174030831881322593806293695575097191000747015561705)
  (num-test (- 9842028993407961669727766131360795288615020071102475108883839785397865740828387076847892646234215787999498419839351470775471313077046438080666908734795616 8259939762466350877481193620364896193464602165170783019804380181692322874550956777598992104871440502758410340359413403619753571535498118388286469082729503) 1582089230941610792246572510995899095150417905931692089079459603705542866277430299248900541362775285241088079479938067155717741541548319692380439652066113)
  (num-test (- 3122315115429970622394662815735050825423438028108957393747131991771456957037829402044934484343765915727397519247940959221091465331254497476137639859816450 10737995515603450913722681305571315249864367824351372254572936648132763616823019940208526402092654554035074813865303483747097673960803093638463005072804384) -7615680400173480291328018489836264424440929796242414860825804656361306659785190538163591917748888638307677294617362524526006208629548596162325365212987934)
  (num-test (- 11618335890332522671268040181306950825004789685088262996478365976802329054158653675768163009290064139158450983598701977173152384425333441365287895694522192 -13130287008197231017935223399369698658354829835061356451363818961959486828237111511740029441613108087354987794332115218978284937263725126538295501305403242) 24748622898529753689203263580676649483359619520149619447842184938761815882395765187508192450903172226513438777930817196151437321689058567903583396999925434)
  (num-test (- -4829477140897377009195646150061276059814366801005389903693533021027427566117360765323647260121062827801190746646296803957067548167571028717513392985791293 10716557117391614298810040587314742187092120526669273567183969821384063434473189717686678450880765426943205955814024872764413373364846268902370055526485180) -15546034258288991308005686737376018246906487327674663470877502842411491000590550483010325711001828254744396702460321676721480921532417297619883448512276473)
  (num-test (- 1560421244904974852620371975782132605421448226892487453928759432083522187778803424020804578027100625536441377609275030418285893555753560195716001014786650 -11797558308994912054526619290334311429749533070145154703018977152548370444659962978040151671210413666186432921816690953994784423526183449271023503069393845) 13357979553899886907146991266116444035170981297037642156947736584631892632438766402060956249237514291722874299425965984413070317081937009466739504084180495)
  (num-test (- -7701347923966912534344428538744620884561375267012102797292378941649984539207353887059064943586048644516121387166836442084007442716291792933061162738380376 5290969389374230541016502448421359606252744677802288901830045825873182202718418905866055323957065013553046698199939002159982374580735362593037515863844280108947533575824820196689891621498006303535207762625068798755031433921940066544809959896067184147997503827988613858484669349726945188167613248195147619673963531690938913245110754715059472477991342216448470339490385593605806518967792963339193162830698488489270925945408227996742278697477358272529028932771642478870844024835907350391770605391526921411004262446196112836319091260967898895009427182171643279100998182191816962677328417390867021108292139204864164048286) -5290969389374230541016502448421359606252744677802288901830045825873182202718418905866055323957065013553046698199939002159982374580735362593037515863844280108947533575824820196689891621498006303535207762625068798755031433921940066544809959896067184147997503827988613858484669349726945188167613248195147619673963531690938913245110754715059472477991342216448470339490385593605806518967792963339193162830698488489270925945408227996742278697477358272529028932771642486572191948802819884736199144136147805972379529458298910128698032910952438102363314241236586865149642698313204129513770501398309737400085072266026902428662)
  (num-test (- 9733743430220591762422540139212426729307515492818443460852332805653889275463385649305231919846970974905736816260992940027028218064265519723018527155353151 -29407855293830047984154639411082591337348779678279017647951764366455421210163494489475996514661359700145916243499452007595041420522019751347743105082745321262372977262641488359297167392118038994384136863563032667040671405618315550876997904307423736276844997706938133936081058323434935833614475654922773162140266784233792639117145232791514703532554345086520312281500696798706889025860427142771458666376271994240028586899592254884476941388776984078337603148583453255593120138178690189726206775893096279000909079330468718593887702543025737308336025198677457129910473491269839827087491228569718246503140134413881896746751) 29407855293830047984154639411082591337348779678279017647951764366455421210163494489475996514661359700145916243499452007595041420522019751347743105082745321262372977262641488359297167392118038994384136863563032667040671405618315550876997904307423736276844997706938133936081058323434935833614475654922773162140266784233792639117145232791514703532554345086520312281500696798706889025860427142771458666376271994240028586899592254884476941388776984078337603148583453265326863568399281952148746915105523008308424572148912179446220508196915012771721674503909376976881448397006656088080431255597936310768659857432409052099902)
  (num-test (- -276731217243271862683214238489380950428392903790808046630969592255272629537001990355375434170910931115552132394269672247616298060929507021008951190291387 100289083769237476480554074865040988004216167545459907207847010762380733541100608695693297149249375537088329431700364201275915507683345148401600569951338052791424407090330310974243070931256108167365334162914085216447196038922091547331474328250886730614683299908003398886233860613008266913065047699535081030427106800418656336608005860846045905149012346378286475449307630537665901621055008855374148058291266835796203075976592585729940879567246284967856356337849150102261744547461816282538319258966892339056695718919291240188920586288417893106046698069355647145603908383687239983874164793005765733782432717429040621674) -100289083769237476480554074865040988004216167545459907207847010762380733541100608695693297149249375537088329431700364201275915507683345148401600569951338052791424407090330310974243070931256108167365334162914085216447196038922091547331474328250886730614683299908003398886233860613008266913065047699535081030427106800418656336608005860846045905149012346378286475449307630537665901621055008855374148058291266835796203075976592585729940879567246284967856356337849150378992961790733678965752557748347842767449599509727337871158512841561047430108037053444789818056535023935819634253546412409303826663289453726380230913061)
  (num-test (- 8505070389896098095621766692413480203366379968950158493268895987250690600795955783113900096527432416791184386061684833478921638080978014176210898461637606 -16410711613672171332126342754193842244915477287016327757357714698751777287458963458682349581881560880814595167244857846847668988374679430572782121021084683986742283012573569894084166107235597351093334125816075658348307113218478800035703971671113417712009419861470917307849916674203301497919242668373376352901312309673053175315189945730756118172940886476343290174961420986113367531057713782438374928471960914578818951372282574754612716278516397754222547513576728677459134022062202283647690649100602260948409511070624300011106517649666031530376191755817891213910847547809248990517666613043010292627100428536737652546738) 16410711613672171332126342754193842244915477287016327757357714698751777287458963458682349581881560880814595167244857846847668988374679430572782121021084683986742283012573569894084166107235597351093334125816075658348307113218478800035703971671113417712009419861470917307849916674203301497919242668373376352901312309673053175315189945730756118172940886476343290174961420986113367531057713782438374928471960914578818951372282574754612716278516397754222547513576728685964204411958300379269457341514082464314789480020782793280002504900356632326331974869717987741343264338993635052202500091964648373605114604747636114184344)
  (num-test (- -12618010259109779267590315037969998053964054382853891516547435925972388025118492931596200697357628900783311183940584302426381939302632641549019984810957030 -30500906828861638007306362171210132987300359439962044769219457463653547834815716264412200930088623097530758080891972640000479943534665059199377729854850415258341537838023739964147532129877743393965857370995558748807382396090020006195649251292012405690725917389684473999400905751109361754679152179983739269026226054012963756892488872262522587481931950410504651253101938824790285623805566521723062029033001745636445860437154344665483641408727637784045030118212476306906983993748299291616038887011943864441807818857508443930272872365334665976442185494702520760793786640113779099219233665607521784524244604432396247693263) 30500906828861638007306362171210132987300359439962044769219457463653547834815716264412200930088623097530758080891972640000479943534665059199377729854850415258341537838023739964147532129877743393965857370995558748807382396090020006195649251292012405690725917389684473999400905751109361754679152179983739269026226054012963756892488872262522587481931950410504651253101938824790285623805566521723062029033001745636445860437154344665483641408727637784045030118212476294288973734638520024025723849041945810477753436003616927382836946392946640857949253898501823403164885856802595158634931239225582481891603055412411436736233)
  (num-test (- 793528769616879938852241178439496352527042950647521648629732169156958768358523029837406526207126598190786120139491813624819360632811627576064199559812277 -7357484069649002655190557040768215614708659708788999334802985986235721030962928900092675952032143512196279092521450986819067071570862007086586132687661085824939677603953832219860573980632016025218580608321648907608385784471745482257672314890331358256478273312255285010343369949412955387472116587504557483184506548209831317705115523967163525846685455369176657510129844566195941925821733027993620517287411895496215426174909366458092382652675628195464969405904518323018004882611048769247228828875493680284766874334247375868318795940759082324831733175858991629741478124633015067484305547002438816473086042218906532116413) 7357484069649002655190557040768215614708659708788999334802985986235721030962928900092675952032143512196279092521450986819067071570862007086586132687661085824939677603953832219860573980632016025218580608321648907608385784471745482257672314890331358256478273312255285010343369949412955387472116587504557483184506548209831317705115523967163525846685455369176657510129844566195941925821733027993620517287411895496215426174909366458092382652675628195464969405904518323811533652227928708099470007314990032811809824981769024498050965097717850683354763013265517836868076315419135206976119171821799449284713618283106091928690)
  (num-test (- 30958566711373255787092081401292877738974978442987704470984765018293851031728996862405055424093249924047528792113585028592262445810946419909807061004531455817427671594281537965628880611732831524185850161910304038646992464838306728350704966234151134620041799373762432970330864023007632010865749239024802839173884778578927209741320635135275002489733299806669933393428518104197594560039136096527206600870299327752296492029012993590212340409989598323540081430189567580333356380487749078595746626408529223195894600223743978246922817054226858311823994547784553612982586322603593335538875728113115443554199017672360091721648 9164115638960783470) 30958566711373255787092081401292877738974978442987704470984765018293851031728996862405055424093249924047528792113585028592262445810946419909807061004531455817427671594281537965628880611732831524185850161910304038646992464838306728350704966234151134620041799373762432970330864023007632010865749239024802839173884778578927209741320635135275002489733299806669933393428518104197594560039136096527206600870299327752296492029012993590212340409989598323540081430189567580333356380487749078595746626408529223195894600223743978246922817054226858311823994547784553612982586322603593335538875728113115443554189853556721130938178)
  (num-test (- -22540807692474380279530794404584230073523360203115293035869063366926380719566516089428840111682263403627532047214106171892715667227836310498366393991106231487046533598391969789120283294510723096483520917309134391072655861112766764278247568027435618337967113341863713181603534251049249873125130781073437913954718595729437608729446837417196899902194261111827656247095442897532040935029872731410799530408713850806239149348700486268275019296069828199088780767614008685960242354118969741283398882689239770114582524756296906388861630890288875920861344939520380841337675934551587994259348267613541166769237154904791412049964 16928681651977808800) -22540807692474380279530794404584230073523360203115293035869063366926380719566516089428840111682263403627532047214106171892715667227836310498366393991106231487046533598391969789120283294510723096483520917309134391072655861112766764278247568027435618337967113341863713181603534251049249873125130781073437913954718595729437608729446837417196899902194261111827656247095442897532040935029872731410799530408713850806239149348700486268275019296069828199088780767614008685960242354118969741283398882689239770114582524756296906388861630890288875920861344939520380841337675934551587994259348267613541166769254083586443389858764)
  (num-test (- -5403850875869356031749551669837202919756114555261706106905659104903792701565965475066159243529680606410723686422444947172225540145977333194008702465610630608545009270872541652430806931212184915840724378685979865349848151917650322286497417985248678815214889868576385900691591784772762893647315325310416150353725001943778473686980157692817497562783521120544549784746647104651038037129984152623720529803205580894126664077380391379306511348324442512538418658728022685805514196592544294177914956734669359073791151050869328577099869772182315103156047405800398706114122356939316464974680113324979723289916823063616573634058 -10755560408227106818) -5403850875869356031749551669837202919756114555261706106905659104903792701565965475066159243529680606410723686422444947172225540145977333194008702465610630608545009270872541652430806931212184915840724378685979865349848151917650322286497417985248678815214889868576385900691591784772762893647315325310416150353725001943778473686980157692817497562783521120544549784746647104651038037129984152623720529803205580894126664077380391379306511348324442512538418658728022685805514196592544294177914956734669359073791151050869328577099869772182315103156047405800398706114122356939316464974680113324979723289906067503208346527240)
  (num-test (- 16201587974698660164372991183566748501003872177894450603471850345714117528335101264234127789041855420954511595895378320972957964222386731614839583078498685801156670229700092209313747849610762975747730086443186821337319452128253859293962343891549207804191088925361935683615063225197130192492652062735684739784075955094308092423304262201429421582566117390598395895220976999990205945523225411701169301910362640419341608407294018105959688929256136725564385243617240412649023368133778798063226772467915584333795357813292935080009919284755332034998122912861893282865727947810588086156919649131720183722427134042574317487793 -126159569916621842) 16201587974698660164372991183566748501003872177894450603471850345714117528335101264234127789041855420954511595895378320972957964222386731614839583078498685801156670229700092209313747849610762975747730086443186821337319452128253859293962343891549207804191088925361935683615063225197130192492652062735684739784075955094308092423304262201429421582566117390598395895220976999990205945523225411701169301910362640419341608407294018105959688929256136725564385243617240412649023368133778798063226772467915584333795357813292935080009919284755332034998122912861893282865727947810588086156919649131720183722427260202144234109635)
  (num-test (- -9976758107386398142455037422077809088581080675608340830198269021688955930541332630075972471934165382030070969307731206728197760190279942894255740733209190331510591013089699837164445642396864912572863786290237335963836376543389815671640509582958465164874961381137096877288362944469137669502842448492172241151419831252572392809173900377271652074261706120638052379886108764460001026094198502028776365675088466580595870167840105746912975236851293882732079317535103041585285239081516202482201377111734010788198635874359396626004300532752450289119192633850562141516671742961938277967783337559307443617308447853505824391099 13449070890444925581) -9976758107386398142455037422077809088581080675608340830198269021688955930541332630075972471934165382030070969307731206728197760190279942894255740733209190331510591013089699837164445642396864912572863786290237335963836376543389815671640509582958465164874961381137096877288362944469137669502842448492172241151419831252572392809173900377271652074261706120638052379886108764460001026094198502028776365675088466580595870167840105746912975236851293882732079317535103041585285239081516202482201377111734010788198635874359396626004300532752450289119192633850562141516671742961938277967783337559307443617321896924396269316680)
  (num-test (- -8570952518585194406209873586517687582701183275108243979199329595605282282125006489076327154374449108678257552384372919282846744626955206382078850958298637157198962032090439427286914716782317030245513658212430127586764421559372214829010306717557679285031617989735914399954286846456953917915955558448774972943731602144914068097214910567329340361564904028964471241318105967747431610163083002382821902859161510204381788262611298660559327478615315484763561786397041779926288206767156863141140852268323253657685018587945456372648431446464389004257999049529945532453598011773843788498650935959375182414447893892341891463988 4431555062692055371) -8570952518585194406209873586517687582701183275108243979199329595605282282125006489076327154374449108678257552384372919282846744626955206382078850958298637157198962032090439427286914716782317030245513658212430127586764421559372214829010306717557679285031617989735914399954286846456953917915955558448774972943731602144914068097214910567329340361564904028964471241318105967747431610163083002382821902859161510204381788262611298660559327478615315484763561786397041779926288206767156863141140852268323253657685018587945456372648431446464389004257999049529945532453598011773843788498650935959375182414452325447404583519359)
  (num-test (- 4117976000917214601143188578494558474138167055110060832594841842655428229500889876131794484851166401425675703592388271925904534237338595998991043982676292549088043959446082382516734793718348862105938692342851330680670593768890094290655852108130945387988863730762717733881418314989528719379494082656897158942547008663543153236129762264443358316776532465284014215413819415615612452225913947961681691310132286840303081453109375175436902292224029179426794714036524361081174901146731799945483243427138748119832116750910126386838614645397770107366925613473924955965862778639046707637382775371488874447622330992324750207465 329466253508616383200261654231797136951) 4117976000917214601143188578494558474138167055110060832594841842655428229500889876131794484851166401425675703592388271925904534237338595998991043982676292549088043959446082382516734793718348862105938692342851330680670593768890094290655852108130945387988863730762717733881418314989528719379494082656897158942547008663543153236129762264443358316776532465284014215413819415615612452225913947961681691310132286840303081453109375175436902292224029179426794714036524361081174901146731799945483243427138748119832116750910126386838614645397770107366925613473924955965862778639046707637053309117980258064422069338092953070514)
  (num-test (- 28857935543824608075326348244201981931023939250259142606733822094071772153858420201297951828741003977413353359215638528196235956061529059419904405354390715114239219947402126760298132539402386106279333968395498788354937020337343839325588433318100331044091923709732742795159387846354148919054314582749477292946200912006940503778924320301062789466388997936618573519744795661160190636101768486096961991215006236190655062992372061052426455063703038765465688361316141792840153608145888307784845264037109867657483109819380082597605481013612040648149090345778910883349230476481347645708269410828528742743794495302359380494607 126536164564464424337714470705049463978) 28857935543824608075326348244201981931023939250259142606733822094071772153858420201297951828741003977413353359215638528196235956061529059419904405354390715114239219947402126760298132539402386106279333968395498788354937020337343839325588433318100331044091923709732742795159387846354148919054314582749477292946200912006940503778924320301062789466388997936618573519744795661160190636101768486096961991215006236190655062992372061052426455063703038765465688361316141792840153608145888307784845264037109867657483109819380082597605481013612040648149090345778910883349230476481347645708142874663964278319456780831654331030629)
  (num-test (- 3146199586408378667812619157270468624370984629500707476575291934586478540055436137993431548830607708293475788354970610669452058906009873485175438772484599603993015239438297747261356407887781450787482447252615210880612867127689283653562498484594955015919746443263740095372831444793239911996227663006098501180972347442107190398034048225264564325230296723559400768342331039755765597288518435463475921534765025262262798267314969774604439319964638461636007229819888743218820584570149249791727508891676067767073852694327748467914037392778283816153183422263956621516748627574334199731850712255885395479903525322397561293553 -169494171680584797187706369710105239124) 3146199586408378667812619157270468624370984629500707476575291934586478540055436137993431548830607708293475788354970610669452058906009873485175438772484599603993015239438297747261356407887781450787482447252615210880612867127689283653562498484594955015919746443263740095372831444793239911996227663006098501180972347442107190398034048225264564325230296723559400768342331039755765597288518435463475921534765025262262798267314969774604439319964638461636007229819888743218820584570149249791727508891676067767073852694327748467914037392778283816153183422263956621516748627574334199732020206427565980277091231692107666532677)
  (num-test (- -17024716654716744558842421452239026542281806678754026383430912733874686056449261218428541803113383766132449624540209841726047308927951820311213785345168358108138304716549475322223600292513384537980742126687035576531330089447100646214364923043445903103768701639992829171572718403272488931980504461938688955457870904289239032709146514866818331202329982821151580491257491540240579366183525075936339515949345815704583685855315810611089822402567649542290589282153225725537026309623090382054078872576985425957096858376112688308214148412270019118710904983829984589093557307164347051152307499446188262820058714564165108542508 -26845770031559702758807696432929071597) -17024716654716744558842421452239026542281806678754026383430912733874686056449261218428541803113383766132449624540209841726047308927951820311213785345168358108138304716549475322223600292513384537980742126687035576531330089447100646214364923043445903103768701639992829171572718403272488931980504461938688955457870904289239032709146514866818331202329982821151580491257491540240579366183525075936339515949345815704583685855315810611089822402567649542290589282153225725537026309623090382054078872576985425957096858376112688308214148412270019118710904983829984589093557307164347051152280653676156703117299906867732179470911)
  (num-test (- -20875354448001792153279041347864644172439177882677780548397567327274288309764204295853633150227327732322157811413794613378828291977852467550695289535036337326494269114787031260705326469002279939986228049380615128280814933748700667874022724707001736732724010699175779382411342385842744973636495738468838244099596215421975861650998954057316519632062827510021706536194961332185926551767127180751211669386674770139039516623606727799489291663572125587356845055646322930167536458093283930082765496058330805117442824718962237069840252138957395570892073194575112213410604881673785921789655406716271370732069643455590690035701 -321447426701397438572265325285879998363) -20875354448001792153279041347864644172439177882677780548397567327274288309764204295853633150227327732322157811413794613378828291977852467550695289535036337326494269114787031260705326469002279939986228049380615128280814933748700667874022724707001736732724010699175779382411342385842744973636495738468838244099596215421975861650998954057316519632062827510021706536194961332185926551767127180751211669386674770139039516623606727799489291663572125587356845055646322930167536458093283930082765496058330805117442824718962237069840252138957395570892073194575112213410604881673785921789333959289569973293497378130304810037338)
  (num-test (- -6750548706930727136186675393752693335334383613941059024795513640678178119089262068912855951615043660442324823673049951182143778744824110223137384940032268718291241014850714197673735719784663896993460156686600813524168487673234842233781654493200950459723884918456280719440022930492599128086690014332139955274261568563155723011697763382009890186816226119314994799655369791620499988988986590903148198659095740939986627235565633349906453726759224441608018598520571182643709143072528030332708598472074166415467718451869993686505339408706320298338691467040585228617379086727764240955696690287600957842671916189752415855520 132223863177855649509430852484092802671) -6750548706930727136186675393752693335334383613941059024795513640678178119089262068912855951615043660442324823673049951182143778744824110223137384940032268718291241014850714197673735719784663896993460156686600813524168487673234842233781654493200950459723884918456280719440022930492599128086690014332139955274261568563155723011697763382009890186816226119314994799655369791620499988988986590903148198659095740939986627235565633349906453726759224441608018598520571182643709143072528030332708598472074166415467718451869993686505339408706320298338691467040585228617379086727764240955828914150778813492181347042236508658191)
  (num-test (- 15737797902964168014939893286340956118635524170934156177365242966267432695262586636031957242055461736359478270642576860414422844075672388559647477705484719667060463718865742735598799928335211410004369240278699196301127699945374217439676378682879115442203681638050752745036508637214733712716867800216723838016099572951915042604603457902610639317648800296497583507890473114507231814851908526534709496988648572353272479026750068932474334642929727977996779536604912743446197670724757690108283368934769626461285961947257397454619164856011847736479229692086038931510067165282571276049292116713101550911614590774659556899356 -6114512833799784097991148713266650451765474382378581896952003894922931741133332233338460555227243451198289670274036744955599177213449957470212981501678055) 15737797902964168014939893286340956118635524170934156177365242966267432695262586636031957242055461736359478270642576860414422844075672388559647477705484719667060463718865742735598799928335211410004369240278699196301127699945374217439676378682879115442203681638050752745036508637214733712716867800216723838016099572951915042604603457902610639317648800296497583507890473114507231814851908526534709496988648572353272479026750068932474334642929727977996779536604912749560710504524541788099432082201420078226760344325839294406623059778943588869811463030546594158753518363572241550086037072312278764361572060987641058577411)
  (num-test (- -26633154627863501044020127597209297142657179797586777727331879111280843451446814109347357601013807189824906954310855123313836812409388745541128842840054310853220032505914307470215180950497357091093642400638925719682307925365402618310180378684705799724964274776149984064608716300479893889145492885897234574442542501896696821902329473018442082678749291668341477914681413039643187020003425962922948452894682558162414623956491734656939841377698702802567258906642912449969621455596132708975438173455827361542712483153981422051943690720556013580161324856788091093465837542336129629269227369781823515673967591796132853515009 3321161637038961370471515250185392889390643163295535903347391615170504064647249127732639364682803744773593849851778894972403397573953564801884397178069327) -26633154627863501044020127597209297142657179797586777727331879111280843451446814109347357601013807189824906954310855123313836812409388745541128842840054310853220032505914307470215180950497357091093642400638925719682307925365402618310180378684705799724964274776149984064608716300479893889145492885897234574442542501896696821902329473018442082678749291668341477914681413039643187020003425962922948452894682558162414623956491734656939841377698702802567258906642912453290783092635094079446953423641220250933355646449517325399335305891060078227410452589427455776269582315929979481048122342185221089627532393680530031584336)
  (num-test (- 27668394897866653012794531261739800318882766882548843941974485394983434533400277607364280566269718161470415771058329222680901477416257843578362127708934184467195154000133252468684612556324066063725677629160438683034201285122508880444372096430021219637788794365539396242345208611990491721052691567092029622640533057073151980959055665792776356282961971341363712186503783566960850166774438868528799819047163739437906559674823146932668464230936946321915236658512741918196732794332451120218658490129307932187658010681746557120172585093207839141764683325214902696969028472942954863209641597556494684135445935915485525220911 204625459185084436546676461283890328511903949966691877662249903659689934813784661695047569885195881142676761876303280806728760511429260843727967794322777) 27668394897866653012794531261739800318882766882548843941974485394983434533400277607364280566269718161470415771058329222680901477416257843578362127708934184467195154000133252468684612556324066063725677629160438683034201285122508880444372096430021219637788794365539396242345208611990491721052691567092029622640533057073151980959055665792776356282961971341363712186503783566960850166774438868528799819047163739437906559674823146932668464230936946321915236658512741917992107335147366683671982028845417603675754060715054679457922681433517904327980021630167332811773147330266192986906360790827734172706185092187517730898134)
  (num-test (- 18944451653774463090918576081661764936021793389045063662102219434278236461286997354190032851092512146937346521704215170240383659165117708716738711782597164244188741818096207452074083439983059414271417130274747048227795964884943105011205424198661201055104372863019759130697888820715782179466491256695453118035286889359217448004524564796840711987314064158194625731263591557915838970249677548534895064545467992194029425250039951132361639559343536937119283951538321037694842089561504643350632756961329867761604760788760440497535611072991056505806805291706178639395690245460397975614715123591611301423752799666149495108752 994321141213369910357526037382331323092462599623554452705525887587326552002660849455542761618020243106424015447778226642816634338781654345001677083881111) 18944451653774463090918576081661764936021793389045063662102219434278236461286997354190032851092512146937346521704215170240383659165117708716738711782597164244188741818096207452074083439983059414271417130274747048227795964884943105011205424198661201055104372863019759130697888820715782179466491256695453118035286889359217448004524564796840711987314064158194625731263591557915838970249677548534895064545467992194029425250039951132361639559343536937119283951538321036700520948348134732993106719578998544669142161165205987792009723485664504503145955836163417021375447139036382527836488480774976962642098454664472411227641)
  (num-test (- -25075128489482657321316021943980016828761861550379828525731288423212311433274066958090940464803020097932875912251380196071686918459370667428905844496548191635733867314315152547202859654044591981512687559437417616479425752991419002108503390319869665933757684966460526631533822984311725217788657567199485442486045019468844265484117570385156844404625735176559901986920712550964238722824122000259551821135404274194791706113272773768366572120227974096419295159271316157215551931810740200836725504693738229444336470213883741520460842708733150362983831267583568258736572295448486287825894301201018490203520738439038977754991 -7402949251688548738762242219263594861535354011996392637087346760786292549376145193266590582054224293289596877537643409310483743293801574030358189880866069) -25075128489482657321316021943980016828761861550379828525731288423212311433274066958090940464803020097932875912251380196071686918459370667428905844496548191635733867314315152547202859654044591981512687559437417616479425752991419002108503390319869665933757684966460526631533822984311725217788657567199485442486045019468844265484117570385156844404625735176559901986920712550964238722824122000259551821135404274194791706113272773768366572120227974096419295159271316149812602680122191462074483285430143367908982458217491104433114081922440600986838638000992986204512279005851608750182484990717275196401946708080849096888922)
  (num-test (- -26509487378481600038412836495388065888781507388737194948728047318975269277448073484403390476243134990463394380967295356958474984927721196047241216945988250219075749832868804186657201899994373052648345989716938779173325348547767647529160988985542438998030764420175306438858518207072038513664360905985908879070216069156102379349899544471658754952888660878997691670566078979940005195987259493512159628198906090101827331841914429358969184839073862821059400943312264269215878469013316796620921077244799814690434355127994011220041638393750697699141479399553359747084811371804524490919966410379714725200415331414459870271869 -9247155945465656153397925559476432992975541781462281935278489123804934847762489500833913193183733932905776020790478662969835879365116238125565077744775032) -26509487378481600038412836495388065888781507388737194948728047318975269277448073484403390476243134990463394380967295356958474984927721196047241216945988250219075749832868804186657201899994373052648345989716938779173325348547767647529160988985542438998030764420175306438858518207072038513664360905985908879070216069156102379349899544471658754952888660878997691670566078979940005195987259493512159628198906090101827331841914429358969184839073862821059400943312264259968722523547660643222995517768366821714892573665712075941552514588815849936651978565640166563350878466028503700441303440543835360084177205849382125496837)
  (num-test (- -17010604274474750006607667808593883725990508452473783283717890546525148212376267233909567638545898628257361383837671935903199638230375408397752251127816717091041943873728526445398525706450929660366518707254053655364610471112296477865068960744948010561798109833411657930112293904378353445961131058136287425064317621271289456901138718557297733713446119244533144377470099270824020439428168481914824420861176457152299497728390918971852021025089592998997807574907789524112450146545688385954763667980124432645276563626082835790429598328230426471161191074551543308732791287559033843466623138171520961684959997180979203053477 -17319079025684619178510812811805110270463447771889107440996086020812918555191263705580533644731591929176480040622705607552852994906782176254877135818109655911838591767583157894999741648979817400330572419476101372927546509769818404491634583907246692993992514876697330603464497645633398167129555001859772111887143352351860130929715392173452396253437927361301990735683539169040916027268831202732178553152351117118606495416985612909248422655861312689027789401950549626643389790516560291620711705848717875304929186131258525831197192620523261738944873398924939726689336762464320190834794155527335576391767307110012289717973) 308474751209869171903145003211226544472939319415324157278195474287770342814996471670966006185693300919118656785033671649653356676406767857124884690292938820796647893854631449601215942528887739964053712222047717562936038657521926626565623162298682432194405043285672673352203741255044721168423943723484686822825731080570674028576673616154662539991808116768846358213439898216895587840662720817354132291174659966306997688594693937396401630771719690029981827042760102530939643970871905665948037868593442659652622505175690040767594292292835267783682324373396417956545474905286347368171017355814614706807309929033086664496)
  (num-test (- -28362352496476494327713713233021518136860402239251781438945998574753662942796270292818595738100959519541952077905620088422871490191217157269435052965329201030095268586136492980900212955645939325800541690754639292707053269767151001292253701853012092829784482071789669480438026889625605099744553642207773753943711175375843649210118677569597324789367425691177169929576236753018329085700397911235750600921874606148324025962628852167093806152864269874177214562322576097931390470469397118268354868919899638376323751276807304678316688836173746719723312665764603485606350244811113608471530958617108833879194264695174468397461 -4081062111675377984305281082755054920741203741273067094307824323728798665450292976016160959354997082250970415737745853292134965575242789548167162064123232363464302136338349828801951197252612093077640695564825095503535921549690447893467349156939791370286866987224201115453216606688305427702274940837032716124925028835914047967887674858015919302546781010326385758988488478290741665427521820112231266659657169118374988259423444686317389869729817643396097464874333968181509317307320406521221309011946212308190273531009796563611621389720223920155554879800901239072885025170342349379379336047732368458185953903872634982504) -24281290384801116343408432150266463216119198497978714344638174251024864277345977316802434778745962437290981662167874235130736524615974367721267890901205968666630966449798143152098261758393327232722900995189814197203517348217460553398786352696072301459497615084565468364984810282937299672042278701370741037818786146539929601242231002711581405486820644680850784170587748274727587420272876091123519334262217437029949037703205407480776416283134452230781117097448242129749881153162076711747133559907953426068133477745797508114705067446453522799567757785963702246533465219640771259092151622569376465421008310791301833414957)
  (num-test (- 10367142604728811799331249565431331488313655422005202933702176605382043644320209814639311439871418581341534233560256605231366966869093495784665834232350567124110194965198962966795893926025854156729633358240069116588609932539289897499402463770167927610848388138020589286461244557962368497723086593344721146859584146431437967506007518396464517349944129896971137720357645026281243138165214047233258394590454775153944241555543594427555914116439316287902470043292624597940465373006598913770411505099332700167695871387948271302951230983772351549087620538875967635100644404345317626621438913980275970160864401622986870735123 -13323117602411502623386235160326625769048477819798659261203460002048250420188223753407093545503703207645050883770850457071863684414849353264890601744588860687970804808452855795406182324143949747985869939791374195222513169904228914579995165180964917538177994190229733465224857616114628815752065632238207474599531507602861647623695058640735949593381112671690796335596142010430124683781417828023076027476816068202219709673411776556090962187853799456968290579708094595903778622705850818245685205707447012659247018940946510378371952655457988959551256869060428488498330109152756599450626641948447980234503249330875085656261) 23690260207140314422717484725757957257362133241803862194905636607430294064508433568046404985375121788986585117331107062303230651283942849049556435976939427812080999773651818762202076250169803904715503298031443311811123102443518812079397628951132845149026382328250322751686102174076997313475152225582928621459115654034299615129702577037200466943325242568661934055953787036711367821946631875256334422067270843356163951228955370983646876304293115744870760623000719193844243995712449732016096710806779712826942890328894781681323183639230340508638877407936396123598974513498074226072065555928723950395367650953861956391384)
  (num-test (- -25321281404861286799950777949097462701962113587443565138655462269365151737118518315058035825695270231347401755128007072923189452859397209062457461602335603630181865680063451525170253746137368267674863889514153713728814272332433431604233690200451816570240227260445028630591376891139306370205846627093813889699170594185178241812081296510140572331372738998993116117098817936927692238682202717231675283209016857095739468507690090676681400453024293870135659990528969837132054786661560150259115734877162158755858653364070279937027014730947342216816307219127474721622123875699701715404820384545693058511056735799834754890692 -15870257059811626693754498423136372480069134596343998984549199283973854570508228359295418026089909378687774627821225399931314225867711515277913855368473873536462450935842786002269065816311054834857109074848803122494252885020527074586145467185882674518032764708782999568002770206995683800833252068328835778749976046128872525287656002968632147457840467536682726059599593635219947081138082647985895437016641903078766878782632503812736486529143041369932038649270950453231711525943737962179463585338023463992816994328519710963267459007592689204838965317062070771191372220277256094361390952025057574056586665509010902583686) -9451024345049660106196279525961090221892978991099566154106262985391297166610289955762617799605360852659627127306781672991875226991685693784543606233861730093719414744220665522901187929826313432817754814665350591234561387311906357018088223014569142052207462551662029062588606684143622569372594558764978110949194548056305716524425293541508424873532271462310390057499224301707745157544120069245779846192374954016972589725057586863944913923881252500203621341258019383900343260717822188079652149539138694763041659035550568973759555723354653011977341902065403950430751655422445621043429432520635484454470070290823852307006)
  (num-test (- -10064759312484387184876313010284016458560725440641239737323234767636591183611201479885347260175161165340917225306019885202675573016295152797559983194160634880140345743489989007821872426587698574795394887035658449467358615185057180305109018898637903449135520486663185036663238956537895356325733583128141439025002140924158670346599492383552938312402521066705186885506193758499006001382444818328802338159713646715901977137011576113434170842422373328479181457354927400927267448788528116619711184792932525071391797130057189079431487557270366699175956757661488296856660145077706273571985222726397848614141194988258117115194 -3689074607001776735792882994440038588887963294487080609346609068733026224735369468180206799966728461935654851527895876039403151156669223687679382665269013769686991783531091821265184956524448064027733731862929686596729449196238312997460578818232100254940830907672953344544031914926653652310468671685310332327057444910423081752028857828828473637496272809899061573593874011995802487442092326045415689987885712749026491545159340468151000027397821404233369034594141219014219707193746581364791219277489927025992135462852894714639406751538919395016165215641239054420028872350709704191189169571752512626755385998505584006855) -6375684705482610449083430015843977869672762146154159127976625698903564958875832011705140460208432703405262373778124009163272421859625929109880600528891621110453353959958897186556687470063250510767661155172728762870629165988818867307648440080405803194194689578990231692119207041611241704015264911442831106697944696013735588594570634554724464674906248256806125311912319746503203513940352492283386648171827933966875485591852235645283170815024551924245812422760786181913047741594781535254919965515442598045399661667204294364792080805731447304159791542020249242436631272726996569380796053154645335987385808989752533108339)
  (num-test (- -4621513851362114851854472268081584822344822740665629177305004335694395719163541988311496405455186973857145245414214464449674464879082042971313025249648887349614046805778335573547862191522938924075560443632614665169520240664970180760364771373836023824195690134618554368845612471858027311791638881380352344527105480173917778084361560336490212845414303819150625355111300877737042696291233444311426721588476948565949641149735838580313236869041013210454558557732497012037162735013212361842433337324577522358968152852532145622765032318936569346015498130151789662274686368870963891262060214274101000058555635785833724062234 20283847238128227963042817384468009365120280641032764409860857066215336820785816567924217697745867082423864450685360959383940995237907453126362378908108545669654749698030305432673477271848544313029448526561606175059997663752601262173667861202924953502866611309434183496911206954880840674239880495147451496219568787221129244201657487090244435562896841733049066453539864301122516559479757096183362477594406691085946787803323712522074578611082872627361465163804239673539339633332349145205596371287028267780080937728455742966681547897652607170788637996317683436193829274172400558140357237480809582038468874094877651383053) -24905361089490342814897289652549594187465103381698393587165861401909732539949358556235714103201054056281009696099575423833615460116989496097675404157757433019268796503808641006221339463371483237105008970194220840229517904417571442934032632576760977327062301444052737865756819426738867986031519376527803840746674267395047022286019047426734648408311145552199691808651165178859559255770990540494789199182883639651896428953059551102387815480123885837816023721536736685576502368345561507048029708611605790139049090580987888589446580216589176516804136126469473098468515643043364449402417451754910582097024509880711375445287)
  (num-test (- 8229768172162771789/4094631553683915058 14916542302144281688/9648520391570031013) 18327341244785642013243791303754634353/39507136041685332578233153660317693754)
  (num-test (- 13554976081719376860/5850035209629724601 -6813034992928443315/16012083383654426278) 256899901877002811987490932642058619395/93671251573905451634945335611797465078)
  (num-test (- -221798849980968127/896588178875000428 -10118632981534633697/16809799818197706916) 333990778095757160537366868413422249/941966737890699707694484674257410003)
  (num-test (- -10398409463665680242/10672871071680021919 908300169382593227/1663860017749090135) -2076589873614048366639515256135965791/1366012573135328609279238070700513005)
  (num-test (- -2198518713248421187/494031967775171833 162489257999262168/3608560229859558061) -8013762081101965644053022173225152351/1782744111192743850497670941715295813)
  (num-test (- 4025149216228566945/640594137312937394 5467380276809034025/15813352732084653151) 60148732603712157399679443099667862845/10129941051434949990590527231467828494)
  (num-test (- 45649282670476595/278386580761220266717341154184065537 -8637266763647548631/320617180101036447149595031898805939080) 17040443444897688379155017841073877168061229451634462447/89255520501631886327999278515127058459530587144975987720686743155549485960)
  (num-test (- 5648415331928005377/86815630814151297970860026950116430492 -3858618729527320883/27855468652821710859204555976171379400) 123081918822962876101148539477322308270739795776139149559/604572520679633516300271119677141637780408278090307422820905500994965166200)
  (num-test (- 9781572955588417059/112881800445343004034168709823458687843 -5059688483724168531/4577416283528891230944530353546966748) 615921077060787960354561606126348783111829996215681822765/516706991472571912574910836774186280180852506048696459094758451180832844564)
  (num-test (- -4967914039344839478/238170260180199675500515253723794945205 1851848905279976507/5731170327270969184071911155742503278) -469527297115675955424190428047537920421409443442551107819/1364994327983166854234805393053180119374354994464588574791772715189542881990)
  (num-test (- -16853061581795824324/96404437352723357070647888504166371117 2887610208906060444/32980643277330946266739822018299212963) -834203249643667606680245846951263316484378801689149307960/3179480358681967952651970543397987660141008737601948320258541111852875189671)
  (num-test (- -10766003534404571638/1736320411127247334175538439020437437 -220564366893542891/24024005562370344889629855466198025799) -11228676451427374102904112111967705085778332338188090365/1813624835433832784217556253227924899981441517333394378436857197512671181)
  (num-test (- -4039872531792560303/2717817538621352660433068255065439787147153801016478776178010367557953211548 -17969900169229544519/10371230759745501411127733226376204123221866394120596070959771442399588297129) 6940459580028931824293913174633904994365279610168782399332846513086074139209123514834476635325/28187112855925579976299840753672542065528422968220885043792832460046226866036339425358907691441054924266606457279617295071355282523744922239122018045692)
  (num-test (- 11905720953886477738/26349991043344773150817457299711471013733618033386232710348739943906972457535 -1868508269239354100/7915113871665192715310471309271830385175189228544536787145345883401181858893) 15941145914794937177093386304443205602552827651536706608400845076162777444155363739893353329726/23173686625047977587990304423741788120258508897732978034793987736019678129860415537604628640859289817332994555163435451240013483415438259775849311623195)
  (num-test (- -2449440712560236858/3924161613720467738425590715321110829708355586356453490516463081317902575263 3313932993860824279/18392642760231276916239249302906853654153090246504347205856270072174622214792) -19352032211145724571420568734409847660231095572377236173431089875006133635431666731719362137971/24058567564857748536604240288023690440577404826273237225585673569644473540232022448230431237781096357243673961302816983638647478040822458289501843963432)
  (num-test (- 2375854596996813469/17171542567603713573317138241061150416263899780234956304631913156611236192733 -1690236091628058998/115698505401619203741389026136939663329574241316722960060260525901879106902321) 303906786920788985464713527121698374469813384178920405503303785899916213843318155692692663023083/1986721810512032345893371071989737461519340072368099757524397292434629497187713075053126253107235936414498803590298681018206068059043963268488989361033293)
  (num-test (- -9066703779833220052/53996509329904595759286231403247566365148374715934463324003880626270687736687 10104829441267883881/34350188217372122913844475743718288066233853695548819225257606841719829170673) -857068498550946301314281599902676812596945461499639532351672507051201056365247232693696093577243/1854790258563312749374056592838765632813507083399863975139987272744324437901043103651094837595789610803765303659351781344942305171362498886075754606580351)
  (num-test (- -712905705954993103/38361275706852471555340413672243335795384295466685977818182375699688812583403 -3487523845474404757/24004509207225606167828624323100421869226668573968691661898194620137716910067) 116672912187985693533424614379662678476187446315443107971581372764612623068602629062267386180170/920843595906060126846114857872490000269306626188013726759480780006531676144330596572087176480154495471428384288229491172449159350622326294294528887818001)
  (num-test (- -104068455909264700529593875361271227125/3443783531459345396 94266182755532992545775726171008609186/10986871169556601787) -1468019045636814162670978305715811638938423723806410280031/37836405995984502494576730289263822652)
  (num-test (- 6250188382163250356218308848100308290/74975517450841979 10057222263694104272437942231238950849/1377150882331486572) 7853407001895533030925726629648778749078643531548391709/103252600010686800286181264132405988)
  (num-test (- -325869560300902552275820653500571757882/6390430580148850471 94468553562411191993094256419298214695/11908765973274803007) -4484399064985071999330976874105690617426359030318059422519/76102142247451389303559481900024166297)
  (num-test (- -93570528036598407567281714804477572547/1681213810574384291 -244906502561054838674546679498356325029/6878656438675875801) -231899320744132980638168050942881155823492361410591515708/11564492202898292712047439710761442091)
  (num-test (- -81411835730261219386583131450337332863/716127167248934 305772198898084305417824619321954306670/5852119619187572757) -476650772889757879179369019399921041943854248979406203071/4190861845290706865359628655691038)
  (num-test (- 8378821874364768218652992773582270365/264620166167099506 -235085292482743132422942426826553295351/5218853722286899445) 105936154887632142427944491040385766054707164161382644031/1381013939193345109641609957531174170)
  (num-test (- -46932041053326337601984043288899377207/83004348019257810472659105973646518650 -172752976692389001100875729845538600392/64697064048458368935602368307247306331) 11302882932785858045495103305619355060523322049764297548269071809310077113283/5370137620102451116225827082734739449691101289924623877117727128768254573150)
  (num-test (- -5215113722152182902641295804790889582/37267147737183802417372262122851319461 -174324915479281952095382231256728338942/198797486533978895289571841018885549001) 1819946959828587625889363843813156766676787993042778284071188313098762447560/2469538433480866339929667414220581052912334718874062150193407525506073469487)
  (num-test (- -308468863588547635528373349890793262605/277175417813474671446046438490775760091 -88071245580784145343997181342216325733/109042592277517238289414020635536175644) -9225060231388102579469362745283215538990500777711808852192407359260779270917/30223926073985207174135233898799350451872811382182855106546181559011381423604)
  (num-test (- -139281160373255540085888405052544101003/21590054032847718908692432707921390245 -175128181843395150044469443628898278945/101874815793501611839718166887463701141) -10408215647857282226079103083273257459322595128147732742048301223816698452898/2199482777568107961766315941206227462112836158088743951492692685709912769545)
  (num-test (- -13653637423911886957204229566898836211/6724361745919744069899921221745423919 60537422461958273742622747790343370991/323722395245687564470126807800714703749) -4827063738484690108652046326448960810791170812913084889649499536314520788768/2176826490887613088066161490358401961235974091796973399049221882998503572331)
  (num-test (- 207284509647982883454717074874778610186/315575836476247924963087075944676754095 59454580888278446469281150437143941047/3799382139920332759258392540934029749) -17974876032324524053425850245755672169670471578477359535347261991433397414151/1198993196898275844180025803639723883733761367273976879884312817813487572155)
  (num-test (- -149255714031984711085009662216310611563/61209488724728410476016289765233999883959861482512968048939594260689484910535 -206353007879160639705730135450663155/12341134377195982958424940281067948493740598784362073339140017508008773524522) -1829354061323966095884091779117676852909282652562065419187935424186237303685407507859167669375269438805585201409961/755394525511335693198081866608161950899365908489933659716533239785460293292606918153507868614180865950008697266433342863460741791684603303270127798639270)
  (num-test (- 286228990947356503137685907205210886138/64525193112922470913382853022276019736227442678252533126077234112153953877503 -93778927468512815169462456699065596479/70019706577332037325570327903202382111804035215024271930215402736305222068556) 26092773364888269343302672267572690894453186378630697330693315371426642609003667116358459590920104883240139740188665/4518035088612517412858008269349176355736855744033363257986123715832709510554983209440815107866748014413528943649032845277041680450752670951433682692095668)
  (num-test (- 128067958966292694713545212085241612749/50804897676960765097908813878456128842417954009101908722816951877006748778869 -331437715897535092432788513322484606485/102911257177761006574263802557003927106564530572416215828322919550454967864323) 30018293903870953799879886574342637699455128356488843398998059810000258259055116602688738404467489640369684487419392/5228395890723542025866546462435908982096651119675992137235094920338650164475761939608730060759309002063498665792819192135030537577109853650729817121390687)
  (num-test (- 27065789167947870065829490227927612633/10795458608984562931374526676297845621730864739104955678079256994070639461197 53314096352440087811254806167289750292/44807028208492548064750449353871285104149154384082409595945081934090139448067) 637187458285170434834128234123875152637450428605039275620795715002449318075555518355578432548587274399560043210887/483712418416385035748598509413117409273155809870339120248356475239836262578288026980177669113025449532258001487616187498682131415946755647640047843156199)
  (num-test (- 275528434092876314751862670579225752027/23290954563951481764306221308726902093226107549717031306984541394996363441752 118398743375843543978994815511147957868/26050691402435592629863948804505350954161759382372519491414484055670238339031) 4420086456754111377514058698455330162869575963826459083894390154200727636413353382047981846196341965799691593361101/606745469813648893293125236863835131523556569847025597910312571817347251611730291043895952533706547565767925058454286630395458711598751591845070996622312)
  (num-test (- -263828172858355421790882308711676546531/27836884730007976814146538035133148053942251062564400015534567388490010158584 31580638196736633522674344981675107601/26210154715367115936541726366619494863883445533448748701891278370021519416412) -1948520953518189888695889830515156795224640917019574042614412953331052369986548949517168001067643449389746489215939/182402263891837359872743630675214135004512597266032306942151126033873543370078488920825920736994254287019873146147276876145783659805845233146169813070152)
  (num-test (- 43029409555492054023102681165249027816896930295612442385573977041111849786681/17478431621804970398 -63831159286570708329826084149841946467426290005331979697932225104261019322894/15909114936773208135) 1800228375210677909820927489860838061135888931548234366640994061734196466170531105718785437541747/278066377585826623354880511023167787730)
  (num-test (- -34677827126365037739221949705076349308552841821108642369491195428278121711851/12321935233094032355 2466652720703038662112375481129216761044838204088317060529010755963314905661/458077759838279587) -46279076433142446690218423399092373290016631287423134630356063713373023144989129659854095947192/5644404488448083755690706619714037385)
  (num-test (- 75657421640076548917316021979547903196453821552146142751737530624725671569062/5416811919979369403 -51031635143911513328361770575139950616395278082588474953679149885798666896870/16274277637120569843) 1507698654622877634185545368063085304919907004898369478770589865697455127479301592176158803465876/88154701093808389139357381843158713729)
  (num-test (- -86696779369804422745383183615836359604633179506005810847902134850836986706763/15354752711854066426 83875579121692496325618937810567731584819474189441279434601944065565889174333/1890321146489013312) -725886765676185953186290796464189476910148783977596698524963064505627422317719186476684911836457/14512706875163632554860591439823131456)
  (num-test (- -2824584270835350806110810310308644313069326027498380007733023821989145840779/3128200028313826545 -16485532380752962986834975164722153533427821569516340079793116204530103476885/4044901389917631001) 40144878017198534388242075435853869853984060096218401720566307902396394251666454424383286522546/12653260642466969643085415999628721545)
  (num-test (- -71140717297594692514165816539390347954764512441693085945645019026357644035048/15130773661553937219 106518314860779634188990156539381479314908411240039365434170935270962911954978/11202282371121185733) -267626990691150539404999353980899804835901788880218020004516046839225745741587662342920970677374/18833244338916713919008552672213388503)
  (num-test (- -31372444086039981530710911528326367048894875160807395940269724829549418985367/149682691887362386596593782520991059630 13980025800771566396092717430902170466939197897483207383178768135899198010674/143215924045734814208985239450703841431) -6585601463869631351127457963734548845246885851328680299125624347680443020577881573937479731612385878788264587830797/21436945032301618223045694723696447349670080755369221855700055538448185530530)
  (num-test (- 60002561005149795132492915799111287923312170708430066011808292212167201814322/16346766380600148228286881361520329811 104734497917913613491539581495799848702023341599268915776996571583385896191203/61937476024742321910315674059586179787) 19844918952732846654680216616282727016967753441473733514766184661191061075852141231786969917096326062063227788681/10024529215648371311559365663430434349900555024451481776473735938354274557)
  (num-test (- 78980655687309201443760271907411093305339297143458162112992101000746746121121/24094471248783344167514231679460830840 10562090177736342378322146805187203837437609238688017154037816697523731420573/74961473522415640988394298626742882726) 2833009175986364875175323375606672657538996734036576482627590142336455915129629838687125527863027857335645122892263/903078534276138789186206765245648729133926893901427360507431923032322034920)
  (num-test (- 96507496069338193466683209170737942070468924698476218759487496209308948365/19252547784216386872197161331387216893 12563973560096321588715986952435909079270363887929001032891628645353358046011/79879611474172059435223762585596250921) -234179520035021783886726161079163865833895106001667476480293126893061678147610754451356994012799045797572757769658/1537886036891137155393554113191390737924110193971845147480358562685078008453)
  (num-test (- -95307376781556674397571761484869767912211504027346871580288574968524683908606/128329921725822403056205582017133271311 36170894925879686192917617159219095595164782822289198001474013555499918728596/240886887357120796976726436320063138705) -27600105449672599524131749634403660999916186956076872373762346977331203119722064380924286397976905109959929163304586/30912995399316310109755266138690547023211992922143297688759057498082990192255)
  (num-test (- -22104893896795356297688360407985617971036912713007110938688208155601366216839/5790727918973991999188987227357894380 -2339372311396919406471876113751500811577555408710269902369834593304924842262/12937689744925498650506694361349920911) -90813196841584888136609582546105640167792279132393576014002859436259486025871518847027719826829986116492656710923/24972880404321196721702428178050372850585634300866259560981343234830460060)
  (num-test (- -3426218098660813853559652497557253942819662042768623922183022792185928242671/2077407536662385613357832628600529321326686191757127715026249042748302985178 102639297566540827510784861997871251414598617775200449087621943894148321803293/83089038429507982364103335021257902316010144851865721965726693103637274338545) -497904817589969304680335736144278473886197067420059149312627956679073246109792679236301202959163792633927112737045328517845259242265445360227131779644849/172609794647490471018785535271654901168315737813115654161745630290269473799997219289162551586864155467201760250711449118429648095083028041134558889086010)
  (num-test (- 1543899448831604569141696144740105016328586790221799945430718394112623114412/1094690716976737526626281319975432667416762320123576900412499904933271786567 -101835025746074730017715423582062511397387458863000475669454309217160145993/55116548932808468782187525862059393507883043749327746382569396580129398962) 196572266866178229534134252625134989714563665559807019513454337864363053729628560611312158082929567528955985669620113192156991984486011150099776316375/60335574468539540262844259780498204139853746803235564167348945699931512713417761400790104247218084745081610815218855896912895393599203789305655343454)
  (num-test (- -37581128364300495505521143552535972339959603365602244668159915869829949338997/42947503543372015019662104425995959382231280059683481488692141811517675950053 -64888994735350842409379226446854438865448614840503930577860382883594178287934/83188698741706753136718468601650233481619465918167616089202536622553688681087) -339504834548876267781536981106771553482515399809961247195394672491113984585270709765073243997043174508213253440272888923497173265137136111635177948889237/3572746933977957867604303713153220827104741303667912510494658617478381525690274918494624922428110123336345510454960178899375325287131764283538305257747611)
  (num-test (- -16230533405187239318665866908175768720879595131719076634847964191318368133798/22572606803697929681675696479626869642065470042484269772607381297011844085929 -3238806615045730440879378702226410558103197865253164974472379309242480970831/7167633180423354812410246140643720752789573307606828791458541239290047771821) -43226201536346598702395278529841763047400215735214225929426206339139243925579733185594282160061132691154727543083543034702325848468839969037250195569159/161792165494835249202675342837643048016103040739685489755239980324180308179745586573032524649518850731442178659412287492012066453331740508600962908806709)
  (num-test (- -58154703770626762920775801228739843350302933064569814497417973139312614069763/25655935043535628671780902110427599603857741303802203417196105196580175051005 2291927744682353823611191393035210406213286149316388597509251757479544491322/2075117977066796442381930295725401140983312287419314083032058820231519915051) -2848879691864593463404526996418656511058536739346277043463623510210968076493148319480555434626780964688210750895957968447300033820091387019574369485421/845064952814266442598400897276554701819815257830830535600041451476645443978805142044657833921127247033533628716506571358424324423237490438402971304385)
  (num-test (- 16233726784138742204308718138203086218138595789383817317246449554340898453104/16370584482945481446847872945862788646563748664837147378940234530469832625057 14431071141710676049963542765626402177344958369162454874051268130438178883381/21166786163219212747261378458659387864767326410261049063051557406799162784072) 107370754167217929909136144689909613387440429633745577224054233373886366171618903318258855919060113440621302505589923655976636732694637334616990468681771/346512661117421566971293748815177161526095870176610277140325665174756629068111228154091043637596506814557119477231243643171068111260010676990408227692104)
  
  (num-test (- 3872339191937382556.0 13437882608410293981.0) -9565543416472911425.0)
  (num-test (- 12702320881720530101.0 13823645380834800545.0) -1121324499114270444.0)
  (num-test (- 10222969257152373972.0 -3454292165863475982.0) 13677261423015849954.0)
  (num-test (- 591233951053628288.0 -17639978232337836611.0) 18231212183391464899.0)
  (num-test (- -7878405903223218778.0 9050739027069287469.0) -16929144930292506247.0)
  (num-test (- 11347120771894057376.0 8443917396834074370.0) 2903203375059983006.0)
  (num-test (- 7831959259127703467.0 -257470007821066702597399141202130667973.0) 257470007821066702605231100461258371440.0)
  (num-test (- 1092406341647857980.0 -325710450166845666190895573961860069495.0) 325710450166845666191987980303507927475.0)
  (num-test (- -4220606126689357919.0 73461013742902296577411907972196819778.0) -73461013742902296581632514098886177697.0)
  (num-test (- -5112059189225304080.0 334306213789148650102245018234146620793.0) -334306213789148650107357077423371924873.0)
  (num-test (- 3093346224554776175.0 -204967241927023874963787190016588249299.0) 204967241927023874966880536241143025474.0)
  (num-test (- -5735747638156472357.0 -3881750746805128137401544408305666047.0) 3881750746805128131665796770149193690.0)
  (num-test (- 17639095392510638323.0 13312205908441007415860933757605397223142073616822325142416364932887680287063250296996056787873086490231950036662943632990219865746131453861285495087665017.0) -13312205908441007415860933757605397223142073616822325142416364932887680287063250296996056787873086490231950036662943632990219865746131436222190102577026694.0)
  (num-test (- 16304056910692545233.0 1463591032326743052350022746892396184459320617971409440301562638996633667625451301419074212369365394140737678584830314878769698416417465834928609990708982.0) -1463591032326743052350022746892396184459320617971409440301562638996633667625451301419074212369365394140737678584830314878769698416417449530871699298163749.0)
  (num-test (- -10347586523508777315.0 12614325304787850623826535169596975975360455924114817820074336137897280818245940873677389644701038550150832199897314137414727161192173691528917744363375331.0) -12614325304787850623826535169596975975360455924114817820074336137897280818245940873677389644701038550150832199897314137414727161192173701876504267872152646.0)
  (num-test (- 16875252323587344863.0 -10230183557696638447600885112945653217398839137450096120772416948425622105048400944465287395231588821521217980407867153259741079758527788318592431794213674.0) 10230183557696638447600885112945653217398839137450096120772416948425622105048400944465287395231588821521217980407867153259741079758527805193844755381558537.0)
  (num-test (- 8574302739232756920.0 2945205250727759066959418729185252318153395797902208079569164623770839848878181416073351760975066439564334127158302281471631001294503759011790017443478716.0) -2945205250727759066959418729185252318153395797902208079569164623770839848878181416073351760975066439564334127158302281471631001294503750437487278210721796.0)
  (num-test (- -17657597319577965851.0 -470389901349206124503884936612357721199915776516939967013182926735009022045917047211666512521578494339222795740836335004070464944715357800461845632614015.0) 470389901349206124503884936612357721199915776516939967013182926735009022045917047211666512521578494339222795740836335004070464944715340142864526054648164.0)
  (num-test (- 11472336850218354926.0 16764018932433717867649699977474298016589762238077229911249331402108995850754999065988360217500238643747316139204767820295123085026049273617874157749889925712672510963712964034497935503076689670786498045302562704435768723916334451317158760704743066709581593570757498670622547878516907127632802801541072452593999435195637193819500375063696114131057474475407791672955417184592088612921927282233762919112197264895445408873539746256555444555901857369535350160665235184955438709679669964546134487688796078142789125799020704969226557493354453298489954288702387159956161243151013189140749021799388406290339231792790773612376.0) -16764018932433717867649699977474298016589762238077229911249331402108995850754999065988360217500238643747316139204767820295123085026049273617874157749889925712672510963712964034497935503076689670786498045302562704435768723916334451317158760704743066709581593570757498670622547878516907127632802801541072452593999435195637193819500375063696114131057474475407791672955417184592088612921927282233762919112197264895445408873539746256555444555901857369535350160665235184955438709679669964546134487688796078142789125799020704969226557493354453298489954288702387159956161243151013189140749021799388406290327759455940555257450.0)
  (num-test (- 12682607562584942903.0 32133619583510009354538204193505267426986629771080807813988708187761849276650847958886764459302043799013813125903744946349479743277662066609741649009023451783267511140245797235200413941774959851628239089013586399425314412329003636059313583335807925401822165199322334470452126484173417518861322963430951772895619791799137157183662289329901964728384697377777905235894234370773419160283767144177627084271804319157013765325677633945370597318765372346484383325176768117059688792498687750479618961541872574768601477738410497806623403054372221338126223825515939164627992974469102910882915893925327931884157735553718792115929.0) -32133619583510009354538204193505267426986629771080807813988708187761849276650847958886764459302043799013813125903744946349479743277662066609741649009023451783267511140245797235200413941774959851628239089013586399425314412329003636059313583335807925401822165199322334470452126484173417518861322963430951772895619791799137157183662289329901964728384697377777905235894234370773419160283767144177627084271804319157013765325677633945370597318765372346484383325176768117059688792498687750479618961541872574768601477738410497806623403054372221338126223825515939164627992974469102910882915893925327931884145052946156207173026.0)
  (num-test (- 14621880654476679971.0 -10075923784619510279100488003620810539888599376089081798647754628017452762406215094511315867213396543200861274584884759429891242650999761503100661310915213260386281412125687376866399124849043409890009033179987278297335571911640353059036551139958369871790768643514550179661619387008678118363266091945225880595898524898713646458647465935791224159084684209727153050053537752111696883536364966526666445737103854446009305531519860527938394412863332757413309423156200192973778629503534709731073637828912608835085933003410694216843775182940057891552358942312728978810053715387504707194992816961400377579655168106377696154728.0) 10075923784619510279100488003620810539888599376089081798647754628017452762406215094511315867213396543200861274584884759429891242650999761503100661310915213260386281412125687376866399124849043409890009033179987278297335571911640353059036551139958369871790768643514550179661619387008678118363266091945225880595898524898713646458647465935791224159084684209727153050053537752111696883536364966526666445737103854446009305531519860527938394412863332757413309423156200192973778629503534709731073637828912608835085933003410694216843775182940057891552358942312728978810053715387504707194992816961400377579669789987032172834699.0)
  (num-test (- -3220156644655019630.0 -8347829670073174550775641165362740628312221836466572623516708794243074870361401136762432100726575330214254748615114820602945887237367461962207075265579588481261313345359877816874924645801358760718027997416917747796144940020489321523749233377708490614979453376328244189926517907474704635785063100359787580409065317918203485474119227673185211436285930586838616288721370975925191964611302275354365110550116042403226844820172448647475637867255305805337047967053177320593337377763657329816935516961201488840745892529800883680912275812320160312651894919502389242002380151562481051684439333368396132543667539444686619670713.0) 8347829670073174550775641165362740628312221836466572623516708794243074870361401136762432100726575330214254748615114820602945887237367461962207075265579588481261313345359877816874924645801358760718027997416917747796144940020489321523749233377708490614979453376328244189926517907474704635785063100359787580409065317918203485474119227673185211436285930586838616288721370975925191964611302275354365110550116042403226844820172448647475637867255305805337047967053177320593337377763657329816935516961201488840745892529800883680912275812320160312651894919502389242002380151562481051684439333368396132543664319288041964651083.0)
  (num-test (- 11628988978410243120.0 21091260149209133824278525560739673446778991946138130571540201996950100883736332286627324787663044982195445635023357027423513202277912840570399895946346028843517588470258087913846945044832851780108963206182331994065720076983528527849542421619745503796476103034657238118665288185878258232226731582201217795631247916614224227701409259346052937919425072595891571572960468193421257458185693656090215937518204243652916583730260295885562094977775951577484951577581277292356830523013216949489797535362720471761788697932265967910160407593278848113303674799017334692501935041730808945554336564957621028111014116286675587727714.0) -21091260149209133824278525560739673446778991946138130571540201996950100883736332286627324787663044982195445635023357027423513202277912840570399895946346028843517588470258087913846945044832851780108963206182331994065720076983528527849542421619745503796476103034657238118665288185878258232226731582201217795631247916614224227701409259346052937919425072595891571572960468193421257458185693656090215937518204243652916583730260295885562094977775951577484951577581277292356830523013216949489797535362720471761788697932265967910160407593278848113303674799017334692501935041730808945554336564957621028111002487297697177484594.0)
  (num-test (- -15960716439913426281.0 18799211173341989380260980155501104944815245973352765317821146163884181375747259542484535639646490774929026134833947975785613727050541297797675705933339289016115326958150660323801621778641184271728990164666383865587422591755046779736996211052149338115836473967202556153668963815595875844414662034458693455631979862997316049580586739835122770408911308146605671192538040301857163633538268589024651373766021087864982140201615461513687698136663128896835597598904095187715456109340116329587986878167776146023396961265667934659006280575496363066974484893764810659481361856335795455814679851690737943592227795474197104696127.0) -18799211173341989380260980155501104944815245973352765317821146163884181375747259542484535639646490774929026134833947975785613727050541297797675705933339289016115326958150660323801621778641184271728990164666383865587422591755046779736996211052149338115836473967202556153668963815595875844414662034458693455631979862997316049580586739835122770408911308146605671192538040301857163633538268589024651373766021087864982140201615461513687698136663128896835597598904095187715456109340116329587986878167776146023396961265667934659006280575496363066974484893764810659481361856335795455814679851690737943592243756190637018122408.0)
  (num-test (- -181065640455671431985325539445069267017.0 14120143334024043377.0) -181065640455671431999445682779093310394.0)
  (num-test (- -91295299684959299024846233061686623774.0 6891102275697080803.0) -91295299684959299031737335337383704577.0)
  (num-test (- -252582289949155881579950873916766853744.0 883304029266526072.0) -252582289949155881580834177946033379816.0)
  (num-test (- -10104159950635417603045689770006558103.0 17251490913777465304.0) -10104159950635417620297180683784023407.0)
  (num-test (- 288463495341489091297108607960869684860.0 -16376960611483226267.0) 288463495341489091313485568572352911127.0)
  (num-test (- 204661965092367792468062569536290631004.0 7774991291341524479.0) 204661965092367792460287578244949106525.0)
  (num-test (- 174559967167400201536723778015754014369.0 168183438971818617783400303174116396891.0) 6376528195581583753323474841637617478.0)
  (num-test (- -253300708624436983509156598368557395374.0 -77166863757693227553099778725240875400.0) -176133844866743755956056819643316519974.0)
  (num-test (- -38587765028356074196061530813295290944.0 5999161273284748726648331130480323187.0) -44586926301640822922709861943775614131.0)
  (num-test (- -236400856885875891058508662756360145662.0 222191413471626205952456600591947275777.0) -458592270357502097010965263348307421439.0)
  (num-test (- 212937903940173587742882129816769611096.0 336470165768472077447806282475185249734.0) -123532261828298489704924152658415638638.0)
  (num-test (- -264812595676159375893264580577855253845.0 -247068943830535581577267897204259299723.0) -17743651845623794315996683373595954122.0)
  (num-test (- -1725732715479127274526681751197327660.0 -2279805492899538651574406423954277869507456204136276822451602661149698386520868702017367409743272511010382761246500508887739763323997191435566266331339917.0) 2279805492899538651574406423954277869507456204136276822451602661149698386520868702017367409743272511010382761246500507162007047844869916908884515134012257.0)
  (num-test (- -220007189346579184019349894240059989979.0 9116030813176547770422918633286023943039811682891023288884273747820892639481842291616424036020927750322528731882517057595815179415042385175627374957565803.0) -9116030813176547770422918633286023943039811682891023288884273747820892639481842291616424036020927750322528731882517277603004525994226404525521615017555782.0)
  (num-test (- 139683266109784685815165642637380856544.0 5782493350903499652295971390391981928106911831248674750993968151944332845911526084530951283012280786005612601970108688202931002414214353708335212597807345.0) -5782493350903499652295971390391981928106911831248674750993968151944332845911526084530951283012280786005612601970108548519664892629528538542692575216950801.0)
  (num-test (- 239160165978290709841254489756277328273.0 5152132850125501873897264811465207492706871561577273155117982457627773151595716641409297120994045059130053034927464958986304380141364542178714472948085275.0) -5152132850125501873897264811465207492706871561577273155117982457627773151595716641409297120994045059130053034927464719826138401850654700924224716670757002.0)
  (num-test (- 315772704643232632782106484978382006176.0 -3689252327480456512393153800679864208480329729627292260734151097785848947569336194072922395859496552999163037466184616218582046814434719444842678248982224.0) 3689252327480456512393153800679864208480329729627292260734151097785848947569336194072922395859496552999163037466184931991286690047067501551327656630988400.0)
  (num-test (- 82735713197488344149642668226610301853.0 -12473025194535761005577066561696471986140205263843017221991729197337093872383371857001077050460827652296473928714097816492579684543651922277865558518876774.0) 12473025194535761005577066561696471986140205263843017221991729197337093872383371857001077050460827652296473928714097899228292882031996071920533785129178627.0)
  (num-test (- 63472235942371758467270296983419551089.0 -7866520408163137968600317959735552406794938230345293650627055135268307695389903092041438746530663083967329111232451176014649873249349534808700483360707382397988918594143264031213181385790969271527978925616276399184489007642142996251807222768397530946779296600805549276528669432847672215219943599871223372831999133812100481632278022608906065923652981249057846548868473376683960144009223047416366697876553049362242497225174860431577034875737250719899362881567590934060155436179316063810148362442197071642183371654740845983314705249832168923202400873364289483910868432511677656218937984504828452980698439495961392749596.0) 7866520408163137968600317959735552406794938230345293650627055135268307695389903092041438746530663083967329111232451176014649873249349534808700483360707382397988918594143264031213181385790969271527978925616276399184489007642142996251807222768397530946779296600805549276528669432847672215219943599871223372831999133812100481632278022608906065923652981249057846548868473376683960144009223047416366697876553049362242497225174860431577034875737250719899362881567590934060155436179316063810148362442197071642183371654740845983314705249832168923202400873364289483910868432511677656219001456740770824739165709792944812300685.0)
  (num-test (- -284018520801241078671538235859630240269.0 -5529748211779294240854894683633173443789067073881249229985499707296461959655918837051490512357840133495603640185675483847478587849599477020706893805485599954539589062532211767295361120129440287144117406526027552427750375526095104163474774446716012360038076376952619723549765229763943818011605991300849052030142173100367582906381575666628005795818339029350398340616624791399526643991489247585213423174803853961438830286737553181353007081438503238779644371968004083452645077716952159339978836669723137339898471600546912430030276920763475622536295311290657163861398519747560279682401429552174530714298081464588450842581.0) 5529748211779294240854894683633173443789067073881249229985499707296461959655918837051490512357840133495603640185675483847478587849599477020706893805485599954539589062532211767295361120129440287144117406526027552427750375526095104163474774446716012360038076376952619723549765229763943818011605991300849052030142173100367582906381575666628005795818339029350398340616624791399526643991489247585213423174803853961438830286737553181353007081438503238779644371968004083452645077716952159339978836669723137339898471600546912430030276920763475622536295311290657163861398519747560279682117411031373289635626543228728820602312.0)
  (num-test (- -171812101820192353275910956459431262142.0 11401673303315394031728944442295528921842441448377692701102691446500671963119794838260543877466107345474902885032629120622020177051592733148817057943390167845763358795044702079370835841331467130719834250134674578757640577473495192331790176510774020541399177011446664359866582351045889299070080989390219063301859447807907203943168891690028442190793548699886572720360741686677780644932612683647303776634496172481504075784427704287335805355801794320914944330891519283383694196486986108936857630373759865062862204149003789919218681050221366182434949855054760827976853645027544605870235074909890698574792562001595287630131.0) -11401673303315394031728944442295528921842441448377692701102691446500671963119794838260543877466107345474902885032629120622020177051592733148817057943390167845763358795044702079370835841331467130719834250134674578757640577473495192331790176510774020541399177011446664359866582351045889299070080989390219063301859447807907203943168891690028442190793548699886572720360741686677780644932612683647303776634496172481504075784427704287335805355801794320914944330891519283383694196486986108936857630373759865062862204149003789919218681050221366182434949855054760827976853645027544605870406887011710890928068472958054718892273.0)
  (num-test (- -243638660221338112796448050030955119997.0 -32214383478080953899491069562585164652288236626686985994647827422262342469970423345510055643470262764747630363450204055220886177681745412924556264758690138113272748656941509018308925555317383307928766093730384151056027828368474245304944063213926492719166086055718735381341569379006804236876950175122702350552198046290567043195716369691666842524594399597143281611765509174168738392889075290806378316647736667077047013214732267367344808724905727602402784621437141760604478301412768904784950365257469208085143467704875589485635570084387755189599791857576855454112556762755762408826226326879491415484319411662301650468948.0) 32214383478080953899491069562585164652288236626686985994647827422262342469970423345510055643470262764747630363450204055220886177681745412924556264758690138113272748656941509018308925555317383307928766093730384151056027828368474245304944063213926492719166086055718735381341569379006804236876950175122702350552198046290567043195716369691666842524594399597143281611765509174168738392889075290806378316647736667077047013214732267367344808724905727602402784621437141760604478301412768904784950365257469208085143467704875589485635570084387755189599791857576855454112556762755762408825982688219270077371522963612270695348951.0)
  (num-test (- -126332081511349770866908261827634312283.0 31497387372874133218238910173378055967910722258532087598053588964599898753455370244114881403020152175272452951858324158004662566613339529101292284073176382818309096142522412043073218657587031893636358434796164444941535757484360125937835242214199979245499374972029624710574236962978707708765065292759037309958875006017588240959790355958632745299212449602934380927677385974488564420550408281673927387615657765312151272852486266800510090872812376232597458154951925709496664568906509814364388823105469855516803225244972466742963619633076158367569109107733990828830121948130235858799809203410103682003414364238243553515261.0) -31497387372874133218238910173378055967910722258532087598053588964599898753455370244114881403020152175272452951858324158004662566613339529101292284073176382818309096142522412043073218657587031893636358434796164444941535757484360125937835242214199979245499374972029624710574236962978707708765065292759037309958875006017588240959790355958632745299212449602934380927677385974488564420550408281673927387615657765312151272852486266800510090872812376232597458154951925709496664568906509814364388823105469855516803225244972466742963619633076158367569109107733990828830121948130235858799935535491615031774281272500071187827544.0)
  (num-test (- 219979452670016849533060110266815720199.0 3900115048441644499033281842448985956665866771934663536385503692700586024397767816761943054115584011069129310718114010862034970648115172218305599786238607524420973404711138276011261135403209178420948996472570042497859127324157786975578751148348046315727383390370594954695454631662061021971027739429505825056455676233533511412589936865597034183410893428831818716136282201523804692574965779771140320669492229416601369453681528301333865290947482219850340728455965391492610516639151652595539203632139883064874286555941718154489936421274731413286355640404192677546692090304496817063325766995908926108582896362623757323811.0) -3900115048441644499033281842448985956665866771934663536385503692700586024397767816761943054115584011069129310718114010862034970648115172218305599786238607524420973404711138276011261135403209178420948996472570042497859127324157786975578751148348046315727383390370594954695454631662061021971027739429505825056455676233533511412589936865597034183410893428831818716136282201523804692574965779771140320669492229416601369453681528301333865290947482219850340728455965391492610516639151652595539203632139883064874286555941718154489936421274731413286355640404192677546692090304496817063105787543238909259049836252356941603612.0)
  (num-test (- 585873325961105129055557280004608765382109855007674169500308242261038324959928764512890600512016613154122762798104714052579267789493643522748210870974797.0 -1855792162818946202.0) 585873325961105129055557280004608765382109855007674169500308242261038324959928764512890600512016613154122762798104714052579267789493645378540373689920999.0)
  (num-test (- -3026050092505200332789765255096964033685859497096213532090644235603419347590512426830117415222669642053441336442247132403948783838396746566100575461602162.0 18009081534399282710.0) -3026050092505200332789765255096964033685859497096213532090644235603419347590512426830117415222669642053441336442247132403948783838396764575182109860884872.0)
  (num-test (- -11124638695599888462310706699308855434715251048597328942409434888923094027849143412724699165971400546471660924330688750607774759764580214088920441698992069.0 -4827559068742614723.0) -11124638695599888462310706699308855434715251048597328942409434888923094027849143412724699165971400546471660924330688750607774759764580209261361372956377346.0)
  (num-test (- 4950293428090696283711882613183655723616682297360442241017758383241177602498881186549809051670562038601658285833496694108818253845693871318067007752043113.0 17597810481352184048.0) 4950293428090696283711882613183655723616682297360442241017758383241177602498881186549809051670562038601658285833496694108818253845693853720256526399859065.0)
  (num-test (- -5733769947958740467479139247420201065087494801172241127791526686385518674532830661413722661802560247463032020003355494614502034002778775472609306735864748.0 -3892174127829225880.0) -5733769947958740467479139247420201065087494801172241127791526686385518674532830661413722661802560247463032020003355494614502034002778771580435178906638868.0)
  (num-test (- 8320894458193427045187598554188178307429755504967209344418448624882517461814957461249858674758807195827056824653471934409067429988676743031117653237018365.0 -12861394200627120797.0) 8320894458193427045187598554188178307429755504967209344418448624882517461814957461249858674758807195827056824653471934409067429988676755892511853864139162.0)
  (num-test (- 13033402737450594044106258936169013897237368708138118260402180886096095497725071502601849887805439844083105685971731015312020770945603825344926844435936044.0 236396022362585261770052671762207864597.0) 13033402737450594044106258936169013897237368708138118260402180886096095497725071502601849887805439844083105685971730778915998408360342055292255082228071447.0)
  (num-test (- 12170667278114656173974716189098171384426379753661081475485441559687661443127166543908925678856145097632475832903680828294561265828775791256812588754280222.0 -276673555533799047589626400978981416789.0) 12170667278114656173974716189098171384426379753661081475485441559687661443127166543908925678856145097632475832903681104968116799627823380883213567735697011.0)
  (num-test (- -12755594876262399860618168642932232021734362385933348033134635580177924615701078617214764415318471507488803810365565826229169313660087149542130819663319659.0 -157671440495648010763311068579191828684.0) -12755594876262399860618168642932232021734362385933348033134635580177924615701078617214764415318471507488803810365565668557728818012076386231062240471490975.0)
  (num-test (- 8664063140780163008577373335591938905735059211566906376953760862047748343846207426667781783874718320339071949903053785280430612875488847226724390758938740.0 54361107931665215623681874454167019934.0) 8664063140780163008577373335591938905735059211566906376953760862047748343846207426667781783874718320339071949903053730919322681210273223544849936591918806.0)
  (num-test (- 3699576825118349347309026261327541749454660339251578894574483235547605815416603169143590292164644149607672871236942391817131531474661895913650810587431606.0 -50508350367572393968128467319633674717.0) 3699576825118349347309026261327541749454660339251578894574483235547605815416603169143590292164644149607672871236942442325481899047055864042118130221106323.0)
  (num-test (- 5626548453644136572409808769267055618695663227750732922630041368983808478347120771651822300668480671524976882745306794511840379704578900504784165956486985.0 170502882789371639987361620116696459267.0) 5626548453644136572409808769267055618695663227750732922630041368983808478347120771651822300668480671524976882745306624008957590332938913143164049260027718.0)
  (num-test (- -10859007735074693411217019392659638207496329895257318665547454149984863458541990037760564769787816800806064437172810158051442267508476778676439633382657890.0 -7558060977666720080449823996328496253877735754811271086853901493753796001778345391546991917892931500169890406340928835457635973812901681485438886367096185.0) -3300946757407973330767195396331141953618594140446047578693552656231067456763644646213572851894885300636174030831881322593806293695575097191000747015561705.0)
  (num-test (- 9842028993407961669727766131360795288615020071102475108883839785397865740828387076847892646234215787999498419839351470775471313077046438080666908734795616.0 8259939762466350877481193620364896193464602165170783019804380181692322874550956777598992104871440502758410340359413403619753571535498118388286469082729503.0) 1582089230941610792246572510995899095150417905931692089079459603705542866277430299248900541362775285241088079479938067155717741541548319692380439652066113.0)
  (num-test (- 3122315115429970622394662815735050825423438028108957393747131991771456957037829402044934484343765915727397519247940959221091465331254497476137639859816450.0 10737995515603450913722681305571315249864367824351372254572936648132763616823019940208526402092654554035074813865303483747097673960803093638463005072804384.0) -7615680400173480291328018489836264424440929796242414860825804656361306659785190538163591917748888638307677294617362524526006208629548596162325365212987934.0)
  (num-test (- 11618335890332522671268040181306950825004789685088262996478365976802329054158653675768163009290064139158450983598701977173152384425333441365287895694522192.0 -13130287008197231017935223399369698658354829835061356451363818961959486828237111511740029441613108087354987794332115218978284937263725126538295501305403242.0) 24748622898529753689203263580676649483359619520149619447842184938761815882395765187508192450903172226513438777930817196151437321689058567903583396999925434.0)
  (num-test (- -4829477140897377009195646150061276059814366801005389903693533021027427566117360765323647260121062827801190746646296803957067548167571028717513392985791293.0 10716557117391614298810040587314742187092120526669273567183969821384063434473189717686678450880765426943205955814024872764413373364846268902370055526485180.0) -15546034258288991308005686737376018246906487327674663470877502842411491000590550483010325711001828254744396702460321676721480921532417297619883448512276473.0)
  (num-test (- 1560421244904974852620371975782132605421448226892487453928759432083522187778803424020804578027100625536441377609275030418285893555753560195716001014786650.0 -11797558308994912054526619290334311429749533070145154703018977152548370444659962978040151671210413666186432921816690953994784423526183449271023503069393845.0) 13357979553899886907146991266116444035170981297037642156947736584631892632438766402060956249237514291722874299425965984413070317081937009466739504084180495.0)
  (num-test (- -7701347923966912534344428538744620884561375267012102797292378941649984539207353887059064943586048644516121387166836442084007442716291792933061162738380376.0 5290969389374230541016502448421359606252744677802288901830045825873182202718418905866055323957065013553046698199939002159982374580735362593037515863844280108947533575824820196689891621498006303535207762625068798755031433921940066544809959896067184147997503827988613858484669349726945188167613248195147619673963531690938913245110754715059472477991342216448470339490385593605806518967792963339193162830698488489270925945408227996742278697477358272529028932771642478870844024835907350391770605391526921411004262446196112836319091260967898895009427182171643279100998182191816962677328417390867021108292139204864164048286.0) -5290969389374230541016502448421359606252744677802288901830045825873182202718418905866055323957065013553046698199939002159982374580735362593037515863844280108947533575824820196689891621498006303535207762625068798755031433921940066544809959896067184147997503827988613858484669349726945188167613248195147619673963531690938913245110754715059472477991342216448470339490385593605806518967792963339193162830698488489270925945408227996742278697477358272529028932771642486572191948802819884736199144136147805972379529458298910128698032910952438102363314241236586865149642698313204129513770501398309737400085072266026902428662.0)
  (num-test (- 9733743430220591762422540139212426729307515492818443460852332805653889275463385649305231919846970974905736816260992940027028218064265519723018527155353151.0 -29407855293830047984154639411082591337348779678279017647951764366455421210163494489475996514661359700145916243499452007595041420522019751347743105082745321262372977262641488359297167392118038994384136863563032667040671405618315550876997904307423736276844997706938133936081058323434935833614475654922773162140266784233792639117145232791514703532554345086520312281500696798706889025860427142771458666376271994240028586899592254884476941388776984078337603148583453255593120138178690189726206775893096279000909079330468718593887702543025737308336025198677457129910473491269839827087491228569718246503140134413881896746751.0) 29407855293830047984154639411082591337348779678279017647951764366455421210163494489475996514661359700145916243499452007595041420522019751347743105082745321262372977262641488359297167392118038994384136863563032667040671405618315550876997904307423736276844997706938133936081058323434935833614475654922773162140266784233792639117145232791514703532554345086520312281500696798706889025860427142771458666376271994240028586899592254884476941388776984078337603148583453265326863568399281952148746915105523008308424572148912179446220508196915012771721674503909376976881448397006656088080431255597936310768659857432409052099902.0)
  (num-test (- -276731217243271862683214238489380950428392903790808046630969592255272629537001990355375434170910931115552132394269672247616298060929507021008951190291387.0 100289083769237476480554074865040988004216167545459907207847010762380733541100608695693297149249375537088329431700364201275915507683345148401600569951338052791424407090330310974243070931256108167365334162914085216447196038922091547331474328250886730614683299908003398886233860613008266913065047699535081030427106800418656336608005860846045905149012346378286475449307630537665901621055008855374148058291266835796203075976592585729940879567246284967856356337849150102261744547461816282538319258966892339056695718919291240188920586288417893106046698069355647145603908383687239983874164793005765733782432717429040621674.0) -100289083769237476480554074865040988004216167545459907207847010762380733541100608695693297149249375537088329431700364201275915507683345148401600569951338052791424407090330310974243070931256108167365334162914085216447196038922091547331474328250886730614683299908003398886233860613008266913065047699535081030427106800418656336608005860846045905149012346378286475449307630537665901621055008855374148058291266835796203075976592585729940879567246284967856356337849150378992961790733678965752557748347842767449599509727337871158512841561047430108037053444789818056535023935819634253546412409303826663289453726380230913061.0)
  (num-test (- 8505070389896098095621766692413480203366379968950158493268895987250690600795955783113900096527432416791184386061684833478921638080978014176210898461637606.0 -16410711613672171332126342754193842244915477287016327757357714698751777287458963458682349581881560880814595167244857846847668988374679430572782121021084683986742283012573569894084166107235597351093334125816075658348307113218478800035703971671113417712009419861470917307849916674203301497919242668373376352901312309673053175315189945730756118172940886476343290174961420986113367531057713782438374928471960914578818951372282574754612716278516397754222547513576728677459134022062202283647690649100602260948409511070624300011106517649666031530376191755817891213910847547809248990517666613043010292627100428536737652546738.0) 16410711613672171332126342754193842244915477287016327757357714698751777287458963458682349581881560880814595167244857846847668988374679430572782121021084683986742283012573569894084166107235597351093334125816075658348307113218478800035703971671113417712009419861470917307849916674203301497919242668373376352901312309673053175315189945730756118172940886476343290174961420986113367531057713782438374928471960914578818951372282574754612716278516397754222547513576728685964204411958300379269457341514082464314789480020782793280002504900356632326331974869717987741343264338993635052202500091964648373605114604747636114184344.0)
  (num-test (- -12618010259109779267590315037969998053964054382853891516547435925972388025118492931596200697357628900783311183940584302426381939302632641549019984810957030.0 -30500906828861638007306362171210132987300359439962044769219457463653547834815716264412200930088623097530758080891972640000479943534665059199377729854850415258341537838023739964147532129877743393965857370995558748807382396090020006195649251292012405690725917389684473999400905751109361754679152179983739269026226054012963756892488872262522587481931950410504651253101938824790285623805566521723062029033001745636445860437154344665483641408727637784045030118212476306906983993748299291616038887011943864441807818857508443930272872365334665976442185494702520760793786640113779099219233665607521784524244604432396247693263.0) 30500906828861638007306362171210132987300359439962044769219457463653547834815716264412200930088623097530758080891972640000479943534665059199377729854850415258341537838023739964147532129877743393965857370995558748807382396090020006195649251292012405690725917389684473999400905751109361754679152179983739269026226054012963756892488872262522587481931950410504651253101938824790285623805566521723062029033001745636445860437154344665483641408727637784045030118212476294288973734638520024025723849041945810477753436003616927382836946392946640857949253898501823403164885856802595158634931239225582481891603055412411436736233.0)
  (num-test (- 793528769616879938852241178439496352527042950647521648629732169156958768358523029837406526207126598190786120139491813624819360632811627576064199559812277.0 -7357484069649002655190557040768215614708659708788999334802985986235721030962928900092675952032143512196279092521450986819067071570862007086586132687661085824939677603953832219860573980632016025218580608321648907608385784471745482257672314890331358256478273312255285010343369949412955387472116587504557483184506548209831317705115523967163525846685455369176657510129844566195941925821733027993620517287411895496215426174909366458092382652675628195464969405904518323018004882611048769247228828875493680284766874334247375868318795940759082324831733175858991629741478124633015067484305547002438816473086042218906532116413.0) 7357484069649002655190557040768215614708659708788999334802985986235721030962928900092675952032143512196279092521450986819067071570862007086586132687661085824939677603953832219860573980632016025218580608321648907608385784471745482257672314890331358256478273312255285010343369949412955387472116587504557483184506548209831317705115523967163525846685455369176657510129844566195941925821733027993620517287411895496215426174909366458092382652675628195464969405904518323811533652227928708099470007314990032811809824981769024498050965097717850683354763013265517836868076315419135206976119171821799449284713618283106091928690.0)
  (num-test (- 30958566711373255787092081401292877738974978442987704470984765018293851031728996862405055424093249924047528792113585028592262445810946419909807061004531455817427671594281537965628880611732831524185850161910304038646992464838306728350704966234151134620041799373762432970330864023007632010865749239024802839173884778578927209741320635135275002489733299806669933393428518104197594560039136096527206600870299327752296492029012993590212340409989598323540081430189567580333356380487749078595746626408529223195894600223743978246922817054226858311823994547784553612982586322603593335538875728113115443554199017672360091721648.0 9164115638960783470.0) 30958566711373255787092081401292877738974978442987704470984765018293851031728996862405055424093249924047528792113585028592262445810946419909807061004531455817427671594281537965628880611732831524185850161910304038646992464838306728350704966234151134620041799373762432970330864023007632010865749239024802839173884778578927209741320635135275002489733299806669933393428518104197594560039136096527206600870299327752296492029012993590212340409989598323540081430189567580333356380487749078595746626408529223195894600223743978246922817054226858311823994547784553612982586322603593335538875728113115443554189853556721130938178.0)
  (num-test (- -22540807692474380279530794404584230073523360203115293035869063366926380719566516089428840111682263403627532047214106171892715667227836310498366393991106231487046533598391969789120283294510723096483520917309134391072655861112766764278247568027435618337967113341863713181603534251049249873125130781073437913954718595729437608729446837417196899902194261111827656247095442897532040935029872731410799530408713850806239149348700486268275019296069828199088780767614008685960242354118969741283398882689239770114582524756296906388861630890288875920861344939520380841337675934551587994259348267613541166769237154904791412049964.0 16928681651977808800.0) -22540807692474380279530794404584230073523360203115293035869063366926380719566516089428840111682263403627532047214106171892715667227836310498366393991106231487046533598391969789120283294510723096483520917309134391072655861112766764278247568027435618337967113341863713181603534251049249873125130781073437913954718595729437608729446837417196899902194261111827656247095442897532040935029872731410799530408713850806239149348700486268275019296069828199088780767614008685960242354118969741283398882689239770114582524756296906388861630890288875920861344939520380841337675934551587994259348267613541166769254083586443389858764.0)
  (num-test (- -5403850875869356031749551669837202919756114555261706106905659104903792701565965475066159243529680606410723686422444947172225540145977333194008702465610630608545009270872541652430806931212184915840724378685979865349848151917650322286497417985248678815214889868576385900691591784772762893647315325310416150353725001943778473686980157692817497562783521120544549784746647104651038037129984152623720529803205580894126664077380391379306511348324442512538418658728022685805514196592544294177914956734669359073791151050869328577099869772182315103156047405800398706114122356939316464974680113324979723289916823063616573634058.0 -10755560408227106818.0) -5403850875869356031749551669837202919756114555261706106905659104903792701565965475066159243529680606410723686422444947172225540145977333194008702465610630608545009270872541652430806931212184915840724378685979865349848151917650322286497417985248678815214889868576385900691591784772762893647315325310416150353725001943778473686980157692817497562783521120544549784746647104651038037129984152623720529803205580894126664077380391379306511348324442512538418658728022685805514196592544294177914956734669359073791151050869328577099869772182315103156047405800398706114122356939316464974680113324979723289906067503208346527240.0)
  (num-test (- 16201587974698660164372991183566748501003872177894450603471850345714117528335101264234127789041855420954511595895378320972957964222386731614839583078498685801156670229700092209313747849610762975747730086443186821337319452128253859293962343891549207804191088925361935683615063225197130192492652062735684739784075955094308092423304262201429421582566117390598395895220976999990205945523225411701169301910362640419341608407294018105959688929256136725564385243617240412649023368133778798063226772467915584333795357813292935080009919284755332034998122912861893282865727947810588086156919649131720183722427134042574317487793.0 -126159569916621842.0) 16201587974698660164372991183566748501003872177894450603471850345714117528335101264234127789041855420954511595895378320972957964222386731614839583078498685801156670229700092209313747849610762975747730086443186821337319452128253859293962343891549207804191088925361935683615063225197130192492652062735684739784075955094308092423304262201429421582566117390598395895220976999990205945523225411701169301910362640419341608407294018105959688929256136725564385243617240412649023368133778798063226772467915584333795357813292935080009919284755332034998122912861893282865727947810588086156919649131720183722427260202144234109635.0)
  (num-test (- -9976758107386398142455037422077809088581080675608340830198269021688955930541332630075972471934165382030070969307731206728197760190279942894255740733209190331510591013089699837164445642396864912572863786290237335963836376543389815671640509582958465164874961381137096877288362944469137669502842448492172241151419831252572392809173900377271652074261706120638052379886108764460001026094198502028776365675088466580595870167840105746912975236851293882732079317535103041585285239081516202482201377111734010788198635874359396626004300532752450289119192633850562141516671742961938277967783337559307443617308447853505824391099.0 13449070890444925581.0) -9976758107386398142455037422077809088581080675608340830198269021688955930541332630075972471934165382030070969307731206728197760190279942894255740733209190331510591013089699837164445642396864912572863786290237335963836376543389815671640509582958465164874961381137096877288362944469137669502842448492172241151419831252572392809173900377271652074261706120638052379886108764460001026094198502028776365675088466580595870167840105746912975236851293882732079317535103041585285239081516202482201377111734010788198635874359396626004300532752450289119192633850562141516671742961938277967783337559307443617321896924396269316680.0)
  (num-test (- -8570952518585194406209873586517687582701183275108243979199329595605282282125006489076327154374449108678257552384372919282846744626955206382078850958298637157198962032090439427286914716782317030245513658212430127586764421559372214829010306717557679285031617989735914399954286846456953917915955558448774972943731602144914068097214910567329340361564904028964471241318105967747431610163083002382821902859161510204381788262611298660559327478615315484763561786397041779926288206767156863141140852268323253657685018587945456372648431446464389004257999049529945532453598011773843788498650935959375182414447893892341891463988.0 4431555062692055371.0) -8570952518585194406209873586517687582701183275108243979199329595605282282125006489076327154374449108678257552384372919282846744626955206382078850958298637157198962032090439427286914716782317030245513658212430127586764421559372214829010306717557679285031617989735914399954286846456953917915955558448774972943731602144914068097214910567329340361564904028964471241318105967747431610163083002382821902859161510204381788262611298660559327478615315484763561786397041779926288206767156863141140852268323253657685018587945456372648431446464389004257999049529945532453598011773843788498650935959375182414452325447404583519359.0)
  (num-test (- 4117976000917214601143188578494558474138167055110060832594841842655428229500889876131794484851166401425675703592388271925904534237338595998991043982676292549088043959446082382516734793718348862105938692342851330680670593768890094290655852108130945387988863730762717733881418314989528719379494082656897158942547008663543153236129762264443358316776532465284014215413819415615612452225913947961681691310132286840303081453109375175436902292224029179426794714036524361081174901146731799945483243427138748119832116750910126386838614645397770107366925613473924955965862778639046707637382775371488874447622330992324750207465.0 329466253508616383200261654231797136951.0) 4117976000917214601143188578494558474138167055110060832594841842655428229500889876131794484851166401425675703592388271925904534237338595998991043982676292549088043959446082382516734793718348862105938692342851330680670593768890094290655852108130945387988863730762717733881418314989528719379494082656897158942547008663543153236129762264443358316776532465284014215413819415615612452225913947961681691310132286840303081453109375175436902292224029179426794714036524361081174901146731799945483243427138748119832116750910126386838614645397770107366925613473924955965862778639046707637053309117980258064422069338092953070514.0)
  (num-test (- 28857935543824608075326348244201981931023939250259142606733822094071772153858420201297951828741003977413353359215638528196235956061529059419904405354390715114239219947402126760298132539402386106279333968395498788354937020337343839325588433318100331044091923709732742795159387846354148919054314582749477292946200912006940503778924320301062789466388997936618573519744795661160190636101768486096961991215006236190655062992372061052426455063703038765465688361316141792840153608145888307784845264037109867657483109819380082597605481013612040648149090345778910883349230476481347645708269410828528742743794495302359380494607.0 126536164564464424337714470705049463978.0) 28857935543824608075326348244201981931023939250259142606733822094071772153858420201297951828741003977413353359215638528196235956061529059419904405354390715114239219947402126760298132539402386106279333968395498788354937020337343839325588433318100331044091923709732742795159387846354148919054314582749477292946200912006940503778924320301062789466388997936618573519744795661160190636101768486096961991215006236190655062992372061052426455063703038765465688361316141792840153608145888307784845264037109867657483109819380082597605481013612040648149090345778910883349230476481347645708142874663964278319456780831654331030629.0)
  (num-test (- 3146199586408378667812619157270468624370984629500707476575291934586478540055436137993431548830607708293475788354970610669452058906009873485175438772484599603993015239438297747261356407887781450787482447252615210880612867127689283653562498484594955015919746443263740095372831444793239911996227663006098501180972347442107190398034048225264564325230296723559400768342331039755765597288518435463475921534765025262262798267314969774604439319964638461636007229819888743218820584570149249791727508891676067767073852694327748467914037392778283816153183422263956621516748627574334199731850712255885395479903525322397561293553.0 -169494171680584797187706369710105239124.0) 3146199586408378667812619157270468624370984629500707476575291934586478540055436137993431548830607708293475788354970610669452058906009873485175438772484599603993015239438297747261356407887781450787482447252615210880612867127689283653562498484594955015919746443263740095372831444793239911996227663006098501180972347442107190398034048225264564325230296723559400768342331039755765597288518435463475921534765025262262798267314969774604439319964638461636007229819888743218820584570149249791727508891676067767073852694327748467914037392778283816153183422263956621516748627574334199732020206427565980277091231692107666532677.0)
  (num-test (- -17024716654716744558842421452239026542281806678754026383430912733874686056449261218428541803113383766132449624540209841726047308927951820311213785345168358108138304716549475322223600292513384537980742126687035576531330089447100646214364923043445903103768701639992829171572718403272488931980504461938688955457870904289239032709146514866818331202329982821151580491257491540240579366183525075936339515949345815704583685855315810611089822402567649542290589282153225725537026309623090382054078872576985425957096858376112688308214148412270019118710904983829984589093557307164347051152307499446188262820058714564165108542508.0 -26845770031559702758807696432929071597.0) -17024716654716744558842421452239026542281806678754026383430912733874686056449261218428541803113383766132449624540209841726047308927951820311213785345168358108138304716549475322223600292513384537980742126687035576531330089447100646214364923043445903103768701639992829171572718403272488931980504461938688955457870904289239032709146514866818331202329982821151580491257491540240579366183525075936339515949345815704583685855315810611089822402567649542290589282153225725537026309623090382054078872576985425957096858376112688308214148412270019118710904983829984589093557307164347051152280653676156703117299906867732179470911.0)
  (num-test (- -20875354448001792153279041347864644172439177882677780548397567327274288309764204295853633150227327732322157811413794613378828291977852467550695289535036337326494269114787031260705326469002279939986228049380615128280814933748700667874022724707001736732724010699175779382411342385842744973636495738468838244099596215421975861650998954057316519632062827510021706536194961332185926551767127180751211669386674770139039516623606727799489291663572125587356845055646322930167536458093283930082765496058330805117442824718962237069840252138957395570892073194575112213410604881673785921789655406716271370732069643455590690035701.0 -321447426701397438572265325285879998363.0) -20875354448001792153279041347864644172439177882677780548397567327274288309764204295853633150227327732322157811413794613378828291977852467550695289535036337326494269114787031260705326469002279939986228049380615128280814933748700667874022724707001736732724010699175779382411342385842744973636495738468838244099596215421975861650998954057316519632062827510021706536194961332185926551767127180751211669386674770139039516623606727799489291663572125587356845055646322930167536458093283930082765496058330805117442824718962237069840252138957395570892073194575112213410604881673785921789333959289569973293497378130304810037338.0)
  (num-test (- -6750548706930727136186675393752693335334383613941059024795513640678178119089262068912855951615043660442324823673049951182143778744824110223137384940032268718291241014850714197673735719784663896993460156686600813524168487673234842233781654493200950459723884918456280719440022930492599128086690014332139955274261568563155723011697763382009890186816226119314994799655369791620499988988986590903148198659095740939986627235565633349906453726759224441608018598520571182643709143072528030332708598472074166415467718451869993686505339408706320298338691467040585228617379086727764240955696690287600957842671916189752415855520.0 132223863177855649509430852484092802671.0) -6750548706930727136186675393752693335334383613941059024795513640678178119089262068912855951615043660442324823673049951182143778744824110223137384940032268718291241014850714197673735719784663896993460156686600813524168487673234842233781654493200950459723884918456280719440022930492599128086690014332139955274261568563155723011697763382009890186816226119314994799655369791620499988988986590903148198659095740939986627235565633349906453726759224441608018598520571182643709143072528030332708598472074166415467718451869993686505339408706320298338691467040585228617379086727764240955828914150778813492181347042236508658191.0)
  (num-test (- 15737797902964168014939893286340956118635524170934156177365242966267432695262586636031957242055461736359478270642576860414422844075672388559647477705484719667060463718865742735598799928335211410004369240278699196301127699945374217439676378682879115442203681638050752745036508637214733712716867800216723838016099572951915042604603457902610639317648800296497583507890473114507231814851908526534709496988648572353272479026750068932474334642929727977996779536604912743446197670724757690108283368934769626461285961947257397454619164856011847736479229692086038931510067165282571276049292116713101550911614590774659556899356.0 -6114512833799784097991148713266650451765474382378581896952003894922931741133332233338460555227243451198289670274036744955599177213449957470212981501678055.0) 15737797902964168014939893286340956118635524170934156177365242966267432695262586636031957242055461736359478270642576860414422844075672388559647477705484719667060463718865742735598799928335211410004369240278699196301127699945374217439676378682879115442203681638050752745036508637214733712716867800216723838016099572951915042604603457902610639317648800296497583507890473114507231814851908526534709496988648572353272479026750068932474334642929727977996779536604912749560710504524541788099432082201420078226760344325839294406623059778943588869811463030546594158753518363572241550086037072312278764361572060987641058577411.0)
  (num-test (- -26633154627863501044020127597209297142657179797586777727331879111280843451446814109347357601013807189824906954310855123313836812409388745541128842840054310853220032505914307470215180950497357091093642400638925719682307925365402618310180378684705799724964274776149984064608716300479893889145492885897234574442542501896696821902329473018442082678749291668341477914681413039643187020003425962922948452894682558162414623956491734656939841377698702802567258906642912449969621455596132708975438173455827361542712483153981422051943690720556013580161324856788091093465837542336129629269227369781823515673967591796132853515009.0 3321161637038961370471515250185392889390643163295535903347391615170504064647249127732639364682803744773593849851778894972403397573953564801884397178069327.0) -26633154627863501044020127597209297142657179797586777727331879111280843451446814109347357601013807189824906954310855123313836812409388745541128842840054310853220032505914307470215180950497357091093642400638925719682307925365402618310180378684705799724964274776149984064608716300479893889145492885897234574442542501896696821902329473018442082678749291668341477914681413039643187020003425962922948452894682558162414623956491734656939841377698702802567258906642912453290783092635094079446953423641220250933355646449517325399335305891060078227410452589427455776269582315929979481048122342185221089627532393680530031584336.0)
  (num-test (- 27668394897866653012794531261739800318882766882548843941974485394983434533400277607364280566269718161470415771058329222680901477416257843578362127708934184467195154000133252468684612556324066063725677629160438683034201285122508880444372096430021219637788794365539396242345208611990491721052691567092029622640533057073151980959055665792776356282961971341363712186503783566960850166774438868528799819047163739437906559674823146932668464230936946321915236658512741918196732794332451120218658490129307932187658010681746557120172585093207839141764683325214902696969028472942954863209641597556494684135445935915485525220911.0 204625459185084436546676461283890328511903949966691877662249903659689934813784661695047569885195881142676761876303280806728760511429260843727967794322777.0) 27668394897866653012794531261739800318882766882548843941974485394983434533400277607364280566269718161470415771058329222680901477416257843578362127708934184467195154000133252468684612556324066063725677629160438683034201285122508880444372096430021219637788794365539396242345208611990491721052691567092029622640533057073151980959055665792776356282961971341363712186503783566960850166774438868528799819047163739437906559674823146932668464230936946321915236658512741917992107335147366683671982028845417603675754060715054679457922681433517904327980021630167332811773147330266192986906360790827734172706185092187517730898134.0)
  (num-test (- 18944451653774463090918576081661764936021793389045063662102219434278236461286997354190032851092512146937346521704215170240383659165117708716738711782597164244188741818096207452074083439983059414271417130274747048227795964884943105011205424198661201055104372863019759130697888820715782179466491256695453118035286889359217448004524564796840711987314064158194625731263591557915838970249677548534895064545467992194029425250039951132361639559343536937119283951538321037694842089561504643350632756961329867761604760788760440497535611072991056505806805291706178639395690245460397975614715123591611301423752799666149495108752.0 994321141213369910357526037382331323092462599623554452705525887587326552002660849455542761618020243106424015447778226642816634338781654345001677083881111.0) 18944451653774463090918576081661764936021793389045063662102219434278236461286997354190032851092512146937346521704215170240383659165117708716738711782597164244188741818096207452074083439983059414271417130274747048227795964884943105011205424198661201055104372863019759130697888820715782179466491256695453118035286889359217448004524564796840711987314064158194625731263591557915838970249677548534895064545467992194029425250039951132361639559343536937119283951538321036700520948348134732993106719578998544669142161165205987792009723485664504503145955836163417021375447139036382527836488480774976962642098454664472411227641.0)
  (num-test (- -25075128489482657321316021943980016828761861550379828525731288423212311433274066958090940464803020097932875912251380196071686918459370667428905844496548191635733867314315152547202859654044591981512687559437417616479425752991419002108503390319869665933757684966460526631533822984311725217788657567199485442486045019468844265484117570385156844404625735176559901986920712550964238722824122000259551821135404274194791706113272773768366572120227974096419295159271316157215551931810740200836725504693738229444336470213883741520460842708733150362983831267583568258736572295448486287825894301201018490203520738439038977754991.0 -7402949251688548738762242219263594861535354011996392637087346760786292549376145193266590582054224293289596877537643409310483743293801574030358189880866069.0) -25075128489482657321316021943980016828761861550379828525731288423212311433274066958090940464803020097932875912251380196071686918459370667428905844496548191635733867314315152547202859654044591981512687559437417616479425752991419002108503390319869665933757684966460526631533822984311725217788657567199485442486045019468844265484117570385156844404625735176559901986920712550964238722824122000259551821135404274194791706113272773768366572120227974096419295159271316149812602680122191462074483285430143367908982458217491104433114081922440600986838638000992986204512279005851608750182484990717275196401946708080849096888922.0)
  (num-test (- -26509487378481600038412836495388065888781507388737194948728047318975269277448073484403390476243134990463394380967295356958474984927721196047241216945988250219075749832868804186657201899994373052648345989716938779173325348547767647529160988985542438998030764420175306438858518207072038513664360905985908879070216069156102379349899544471658754952888660878997691670566078979940005195987259493512159628198906090101827331841914429358969184839073862821059400943312264269215878469013316796620921077244799814690434355127994011220041638393750697699141479399553359747084811371804524490919966410379714725200415331414459870271869.0 -9247155945465656153397925559476432992975541781462281935278489123804934847762489500833913193183733932905776020790478662969835879365116238125565077744775032.0) -26509487378481600038412836495388065888781507388737194948728047318975269277448073484403390476243134990463394380967295356958474984927721196047241216945988250219075749832868804186657201899994373052648345989716938779173325348547767647529160988985542438998030764420175306438858518207072038513664360905985908879070216069156102379349899544471658754952888660878997691670566078979940005195987259493512159628198906090101827331841914429358969184839073862821059400943312264259968722523547660643222995517768366821714892573665712075941552514588815849936651978565640166563350878466028503700441303440543835360084177205849382125496837.0)
  (num-test (- -17010604274474750006607667808593883725990508452473783283717890546525148212376267233909567638545898628257361383837671935903199638230375408397752251127816717091041943873728526445398525706450929660366518707254053655364610471112296477865068960744948010561798109833411657930112293904378353445961131058136287425064317621271289456901138718557297733713446119244533144377470099270824020439428168481914824420861176457152299497728390918971852021025089592998997807574907789524112450146545688385954763667980124432645276563626082835790429598328230426471161191074551543308732791287559033843466623138171520961684959997180979203053477.0 -17319079025684619178510812811805110270463447771889107440996086020812918555191263705580533644731591929176480040622705607552852994906782176254877135818109655911838591767583157894999741648979817400330572419476101372927546509769818404491634583907246692993992514876697330603464497645633398167129555001859772111887143352351860130929715392173452396253437927361301990735683539169040916027268831202732178553152351117118606495416985612909248422655861312689027789401950549626643389790516560291620711705848717875304929186131258525831197192620523261738944873398924939726689336762464320190834794155527335576391767307110012289717973.0) 308474751209869171903145003211226544472939319415324157278195474287770342814996471670966006185693300919118656785033671649653356676406767857124884690292938820796647893854631449601215942528887739964053712222047717562936038657521926626565623162298682432194405043285672673352203741255044721168423943723484686822825731080570674028576673616154662539991808116768846358213439898216895587840662720817354132291174659966306997688594693937396401630771719690029981827042760102530939643970871905665948037868593442659652622505175690040767594292292835267783682324373396417956545474905286347368171017355814614706807309929033086664496.0)
  (num-test (- -28362352496476494327713713233021518136860402239251781438945998574753662942796270292818595738100959519541952077905620088422871490191217157269435052965329201030095268586136492980900212955645939325800541690754639292707053269767151001292253701853012092829784482071789669480438026889625605099744553642207773753943711175375843649210118677569597324789367425691177169929576236753018329085700397911235750600921874606148324025962628852167093806152864269874177214562322576097931390470469397118268354868919899638376323751276807304678316688836173746719723312665764603485606350244811113608471530958617108833879194264695174468397461.0 -4081062111675377984305281082755054920741203741273067094307824323728798665450292976016160959354997082250970415737745853292134965575242789548167162064123232363464302136338349828801951197252612093077640695564825095503535921549690447893467349156939791370286866987224201115453216606688305427702274940837032716124925028835914047967887674858015919302546781010326385758988488478290741665427521820112231266659657169118374988259423444686317389869729817643396097464874333968181509317307320406521221309011946212308190273531009796563611621389720223920155554879800901239072885025170342349379379336047732368458185953903872634982504.0) -24281290384801116343408432150266463216119198497978714344638174251024864277345977316802434778745962437290981662167874235130736524615974367721267890901205968666630966449798143152098261758393327232722900995189814197203517348217460553398786352696072301459497615084565468364984810282937299672042278701370741037818786146539929601242231002711581405486820644680850784170587748274727587420272876091123519334262217437029949037703205407480776416283134452230781117097448242129749881153162076711747133559907953426068133477745797508114705067446453522799567757785963702246533465219640771259092151622569376465421008310791301833414957.0)
  (num-test (- 10367142604728811799331249565431331488313655422005202933702176605382043644320209814639311439871418581341534233560256605231366966869093495784665834232350567124110194965198962966795893926025854156729633358240069116588609932539289897499402463770167927610848388138020589286461244557962368497723086593344721146859584146431437967506007518396464517349944129896971137720357645026281243138165214047233258394590454775153944241555543594427555914116439316287902470043292624597940465373006598913770411505099332700167695871387948271302951230983772351549087620538875967635100644404345317626621438913980275970160864401622986870735123.0 -13323117602411502623386235160326625769048477819798659261203460002048250420188223753407093545503703207645050883770850457071863684414849353264890601744588860687970804808452855795406182324143949747985869939791374195222513169904228914579995165180964917538177994190229733465224857616114628815752065632238207474599531507602861647623695058640735949593381112671690796335596142010430124683781417828023076027476816068202219709673411776556090962187853799456968290579708094595903778622705850818245685205707447012659247018940946510378371952655457988959551256869060428488498330109152756599450626641948447980234503249330875085656261.0) 23690260207140314422717484725757957257362133241803862194905636607430294064508433568046404985375121788986585117331107062303230651283942849049556435976939427812080999773651818762202076250169803904715503298031443311811123102443518812079397628951132845149026382328250322751686102174076997313475152225582928621459115654034299615129702577037200466943325242568661934055953787036711367821946631875256334422067270843356163951228955370983646876304293115744870760623000719193844243995712449732016096710806779712826942890328894781681323183639230340508638877407936396123598974513498074226072065555928723950395367650953861956391384.0)
  (num-test (- -25321281404861286799950777949097462701962113587443565138655462269365151737118518315058035825695270231347401755128007072923189452859397209062457461602335603630181865680063451525170253746137368267674863889514153713728814272332433431604233690200451816570240227260445028630591376891139306370205846627093813889699170594185178241812081296510140572331372738998993116117098817936927692238682202717231675283209016857095739468507690090676681400453024293870135659990528969837132054786661560150259115734877162158755858653364070279937027014730947342216816307219127474721622123875699701715404820384545693058511056735799834754890692.0 -15870257059811626693754498423136372480069134596343998984549199283973854570508228359295418026089909378687774627821225399931314225867711515277913855368473873536462450935842786002269065816311054834857109074848803122494252885020527074586145467185882674518032764708782999568002770206995683800833252068328835778749976046128872525287656002968632147457840467536682726059599593635219947081138082647985895437016641903078766878782632503812736486529143041369932038649270950453231711525943737962179463585338023463992816994328519710963267459007592689204838965317062070771191372220277256094361390952025057574056586665509010902583686.0) -9451024345049660106196279525961090221892978991099566154106262985391297166610289955762617799605360852659627127306781672991875226991685693784543606233861730093719414744220665522901187929826313432817754814665350591234561387311906357018088223014569142052207462551662029062588606684143622569372594558764978110949194548056305716524425293541508424873532271462310390057499224301707745157544120069245779846192374954016972589725057586863944913923881252500203621341258019383900343260717822188079652149539138694763041659035550568973759555723354653011977341902065403950430751655422445621043429432520635484454470070290823852307006.0)
  (num-test (- -10064759312484387184876313010284016458560725440641239737323234767636591183611201479885347260175161165340917225306019885202675573016295152797559983194160634880140345743489989007821872426587698574795394887035658449467358615185057180305109018898637903449135520486663185036663238956537895356325733583128141439025002140924158670346599492383552938312402521066705186885506193758499006001382444818328802338159713646715901977137011576113434170842422373328479181457354927400927267448788528116619711184792932525071391797130057189079431487557270366699175956757661488296856660145077706273571985222726397848614141194988258117115194.0 -3689074607001776735792882994440038588887963294487080609346609068733026224735369468180206799966728461935654851527895876039403151156669223687679382665269013769686991783531091821265184956524448064027733731862929686596729449196238312997460578818232100254940830907672953344544031914926653652310468671685310332327057444910423081752028857828828473637496272809899061573593874011995802487442092326045415689987885712749026491545159340468151000027397821404233369034594141219014219707193746581364791219277489927025992135462852894714639406751538919395016165215641239054420028872350709704191189169571752512626755385998505584006855.0) -6375684705482610449083430015843977869672762146154159127976625698903564958875832011705140460208432703405262373778124009163272421859625929109880600528891621110453353959958897186556687470063250510767661155172728762870629165988818867307648440080405803194194689578990231692119207041611241704015264911442831106697944696013735588594570634554724464674906248256806125311912319746503203513940352492283386648171827933966875485591852235645283170815024551924245812422760786181913047741594781535254919965515442598045399661667204294364792080805731447304159791542020249242436631272726996569380796053154645335987385808989752533108339.0)
  (num-test (- -4621513851362114851854472268081584822344822740665629177305004335694395719163541988311496405455186973857145245414214464449674464879082042971313025249648887349614046805778335573547862191522938924075560443632614665169520240664970180760364771373836023824195690134618554368845612471858027311791638881380352344527105480173917778084361560336490212845414303819150625355111300877737042696291233444311426721588476948565949641149735838580313236869041013210454558557732497012037162735013212361842433337324577522358968152852532145622765032318936569346015498130151789662274686368870963891262060214274101000058555635785833724062234.0 20283847238128227963042817384468009365120280641032764409860857066215336820785816567924217697745867082423864450685360959383940995237907453126362378908108545669654749698030305432673477271848544313029448526561606175059997663752601262173667861202924953502866611309434183496911206954880840674239880495147451496219568787221129244201657487090244435562896841733049066453539864301122516559479757096183362477594406691085946787803323712522074578611082872627361465163804239673539339633332349145205596371287028267780080937728455742966681547897652607170788637996317683436193829274172400558140357237480809582038468874094877651383053.0) -24905361089490342814897289652549594187465103381698393587165861401909732539949358556235714103201054056281009696099575423833615460116989496097675404157757433019268796503808641006221339463371483237105008970194220840229517904417571442934032632576760977327062301444052737865756819426738867986031519376527803840746674267395047022286019047426734648408311145552199691808651165178859559255770990540494789199182883639651896428953059551102387815480123885837816023721536736685576502368345561507048029708611605790139049090580987888589446580216589176516804136126469473098468515643043364449402417451754910582097024509880711375445287.0))

(test (- - 1) 'error)
(test (-) 'error)
(test (- 1 #f) 'error)
(test (- 1 #t) 'error)
(test (- 1 + 2) 'error)
(test (- 1 - 2) 'error)
(test (- 1 2 . 3) 'error)
(test (- 1 . 2) 'error)

(for-each
 (lambda (arg)
   (test (- arg nan.0) 'error)
   (test (- nan.0 arg) 'error)
   (test (- arg inf.0) 'error)
   (test (- inf.0 arg) 'error)
   (test (- arg) 'error)
   (test (- 1 arg) 'error)
   (test (- 1/2 arg) 'error)
   (test (- 1.0 arg) 'error)
   (test (- 1+i arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))



;;; --------------------------------------------------------------------------------
;;; /
;;; --------------------------------------------------------------------------------

(num-test (/ -0.0+0.00000001i) 0.0-100000000.0i)
(num-test (/ -1.0) -1.0)
(num-test (/ -1.0+1.0i -1.0+1.0i) 1.0)
(num-test (/ -1.0+1.0i 0.0+1.0i) 1.0+1.0i)
(num-test (/ -1.0+1.0i 1) -1.0+1.0i)
(num-test (/ -1.0+1.0i 1.0) -1.0+1.0i)
(num-test (/ -1.0+1.0i 1.0+1.0i) 0.0+1.0i)
(num-test (/ -1.0+1.0i 1.234+1.234i) 0.0+0.81037277147488i)
(num-test (/ -1.0+1.0i 1/1) -1.0+1.0i)
(num-test (/ -1.0+1.0i 123.4) -0.00810372771475+0.00810372771475i)
(num-test (/ -1.0+1.0i 1234) -0.00081037277147+0.00081037277147i)
(num-test (/ -1.0+1.0i 1234/11) -0.00891410048622+0.00891410048622i)
(num-test (/ -1.0+1.0i) -0.5-0.5i)
(num-test (/ -10) -1/10)
(num-test (/ -10/3) -3/10)
(num-test (/ -10 3) -10/3)
(num-test (/ -1234000000) -1/1234000000)
(num-test (/ -1234000000.0) -0.00000000081037)
(num-test (/ -1234000000.0+2.71828182845905i) -0.00000000081037-0.0i)
(num-test (/ -1234000000/10) -10/1234000000)
(num-test (/ -2) -1/2)
(num-test (/ -2.71828182845905) -0.36787944117144)
(num-test (/ -2.71828182845905+3.14159265358979i) -0.15750247989732-0.18202992367723i)
(num-test (/ -2/2) -2/2)
(num-test (/ -362880) -1/362880)
(num-test (/ -362880/1234) -1234/362880)
(num-test (/ 0 -1.0+1.0i) 0.0)
(num-test (/ 0 0.0+1.0i) 0.0)
(num-test (/ 0 1 -1.0+1.0i) 0.0)
(num-test (/ 0 1 0.0+1.0i) 0.0)
(num-test (/ 0 1 1) 0)
(num-test (/ 0 1 1.0) 0.0)
(num-test (/ 0 1 1.0+1.0i) 0.0)
(num-test (/ 0 1 1.234+1.234i) 0.0)
(num-test (/ 0 1 1/1) 0)
(num-test (/ 0 1 123.4) 0.0)
(num-test (/ 0 1 1234) 0)
(num-test (/ 0 1 1234/11) 0)
(num-test (/ 0 1) 0)
(num-test (/ 0 1.0 -1.0+1.0i) 0.0)
(num-test (/ 0 1.0 0.0+1.0i) 0.0)
(num-test (/ 0 1.0 1) 0.0)
(num-test (/ 0 1.0 1.0) 0.0)
(num-test (/ 0 1.0 1.0+1.0i) 0.0)
(num-test (/ 0 1.0 1.234+1.234i) 0.0)
(num-test (/ 0 1.0 1/1) 0.0)
(num-test (/ 0 1.0 123.4) 0.0)
(num-test (/ 0 1.0 1234) 0.0)
(num-test (/ 0 1.0 1234/11) 0.0)
(num-test (/ 0 1.0) 0.0)
(num-test (/ 0 1.0+1.0i -1.0+1.0i) 0.0)
(num-test (/ 0 1.0+1.0i 0.0+1.0i) 0.0)
(num-test (/ 0 1.0+1.0i 1) 0.0)
(num-test (/ 0 1.0+1.0i 1.0) 0.0)
(num-test (/ 0 1.0+1.0i 1.0+1.0i) 0.0)
(num-test (/ 0 1.0+1.0i 1.234+1.234i) 0.0)
(num-test (/ 0 1.0+1.0i 1/1) 0.0)
(num-test (/ 0 1.0+1.0i 123.4) 0.0)
(num-test (/ 0 1.0+1.0i 1234) 0.0)
(num-test (/ 0 1.0+1.0i 1234/11) 0.0)
(num-test (/ 0 1.0+1.0i) 0.0)
(num-test (/ 0 1.234+1.234i) 0.0)
(num-test (/ 0 1/1 -1.0+1.0i) 0.0)
(num-test (/ 0 123.4) 0.0)
(num-test (/ 0 1234) 0)
(num-test (/ 0 1234/11) 0)
(num-test (/ 0.0 -1.0+1.0i -1.0+1.0i) 0.0)
(num-test (/ 0.0 -1.0+1.0i 0.0+1.0i) 0.0)
(num-test (/ 0.0 -1.0+1.0i 1) 0.0)
(num-test (/ 0.0 -1.0+1.0i 1.0) 0.0)
(num-test (/ 0.0 -1.0+1.0i 1.0+1.0i) 0.0)
(num-test (/ 0.0 -1.0+1.0i 1.234+1.234i) 0.0)
(num-test (/ 0.0 -1.0+1.0i 1/1) 0.0)
(num-test (/ 0.0 -1.0+1.0i 123.4) 0.0)
(num-test (/ 0.0 -1.0+1.0i 1234) 0.0)
(num-test (/ 0.0 -1.0+1.0i 1234/11) 0.0)
(num-test (/ 0.0 -1.0+1.0i) 0.0)
(num-test (/ 0.0 0.0+1.0i -1.0+1.0i) 0.0)
(num-test (/ 0.0 0.0+1.0i 0.0+1.0i) 0.0)
(num-test (/ 0.0 0.0+1.0i 1) 0.0)
(num-test (/ 0.0 0.0+1.0i 1.0) 0.0)
(num-test (/ 0.0 0.0+1.0i 1.0+1.0i) 0.0)
(num-test (/ 0.0 0.0+1.0i 1.234+1.234i) 0.0)
(num-test (/ 0.0 0.0+1.0i 1/1) 0.0)
(num-test (/ 0.0 0.0+1.0i 123.4) 0.0)
(num-test (/ 0.0 0.0+1.0i 1234) 0.0)
(num-test (/ 0.0 0.0+1.0i 1234/11) 0.0)
(num-test (/ 0.0 0.0+1.0i) 0.0)
(num-test (/ 0.0 1 -1.0+1.0i) 0.0)
(num-test (/ 0.0 1 0.0+1.0i) 0.0)
(num-test (/ 0.0 1 1.0) 0.0)
(num-test (/ 0.0 1 1.0+1.0i) 0.0)
(num-test (/ 0.0 1 1.234+1.234i) 0.0)
(num-test (/ 0.0 1 1/1) 0.0)
(num-test (/ 0.0 1 123.4) 0.0)
(num-test (/ 0.0 1 1234) 0.0)
(num-test (/ 0.0 1 1234/11) 0.0)
(num-test (/ 0.0 1) 0.0)
(num-test (/ 0.0 1.0 -1.0+1.0i) 0.0)
(num-test (/ 0.0 1.0 0.0+1.0i) 0.0)
(num-test (/ 0.0 1.0 1) 0.0)
(num-test (/ 0.0 1.0 1.0) 0.0)
(num-test (/ 0.0 1.0 1.0+1.0i) 0.0)
(num-test (/ 0.0 1.0 1.234+1.234i) 0.0)
(num-test (/ 0.0 1.0 1/1) 0.0)
(num-test (/ 0.0 1.0 123.4) 0.0)
(num-test (/ 0.0 1.0 1234) 0.0)
(num-test (/ 0.0 1.0 1234/11) 0.0)
(num-test (/ 0.0 1.0) 0.0)
(num-test (/ 0.0 1.0+1.0i -1.0+1.0i) 0.0)
(num-test (/ 0.0 1.0+1.0i 0.0+1.0i) 0.0)
(num-test (/ 0.0 1.0+1.0i 1) 0.0)
(num-test (/ 0.0 1.0+1.0i 1.0) 0.0)
(num-test (/ 0.0 1.0+1.0i 1.0+1.0i) 0.0)
(num-test (/ 0.0 1.0+1.0i 1.234+1.234i) 0.0)
(num-test (/ 0.0 1.0+1.0i 1/1) 0.0)
(num-test (/ 0.0 1.0+1.0i 123.4) 0.0)
(num-test (/ 0.0 1.0+1.0i 1234) 0.0)
(num-test (/ 0.0 1.0+1.0i 1234/11) 0.0)
(num-test (/ 0.0 1.0+1.0i) 0.0)
(num-test (/ 0.0 1.234+1.234i -1.0+1.0i) 0.0)
(num-test (/ 0.0 1.234+1.234i 0.0+1.0i) 0.0)
(num-test (/ 0.0 1.234+1.234i 1) 0.0)
(num-test (/ 0.0 1.234+1.234i 1.0) 0.0)
(num-test (/ 0.0 1.234+1.234i 1.0+1.0i) 0.0)
(num-test (/ 0.0 1.234+1.234i 1.234+1.234i) 0.0)
(num-test (/ 0.0 1.234+1.234i 1/1) 0.0)
(num-test (/ 0.0 1.234+1.234i 123.4) 0.0)
(num-test (/ 0.0 1.234+1.234i 1234) 0.0)
(num-test (/ 0.0 1.234+1.234i 1234/11) 0.0)
(num-test (/ 0.0 1.234+1.234i) 0.0)
(num-test (/ 0.0 1/1 -1.0+1.0i) 0.0)
(num-test (/ 0.0 123.4 -1.0+1.0i) 0.0)
(num-test (/ 0.0 123.4 0.0+1.0i) 0.0)
(num-test (/ 0.0 123.4 1) 0.0)
(num-test (/ 0.0 123.4 1.0) 0.0)
(num-test (/ 0.0 123.4 1.0+1.0i) 0.0)
(num-test (/ 0.0 123.4 1.234+1.234i) 0.0)
(num-test (/ 0.0 123.4 1/1) 0.0)
(num-test (/ 0.0 123.4 123.4) 0.0)
(num-test (/ 0.0 123.4 1234) 0.0)
(num-test (/ 0.0 123.4 1234/11) 0.0)
(num-test (/ 0.0 123.4) 0.0)
(num-test (/ 0.0 1234 -1.0+1.0i) 0.0)
(num-test (/ 0.0 1234 0.0+1.0i) 0.0)
(num-test (/ 0.0 1234 1) 0.0)
(num-test (/ 0.0 1234 1.0) 0.0)
(num-test (/ 0.0 1234 1.0+1.0i) 0.0)
(num-test (/ 0.0 1234 1.234+1.234i) 0.0)
(num-test (/ 0.0 1234 1/1) 0.0)
(num-test (/ 0.0 1234 123.4) 0.0)
(num-test (/ 0.0 1234 1234) 0.0)
(num-test (/ 0.0 1234 1234/11) 0.0)
(num-test (/ 0.0 1234) 0.0)
(num-test (/ 0.0 1234/11 -1.0+1.0i) 0.0)
(num-test (/ 0.0 1234/11 0.0+1.0i) 0.0)
(num-test (/ 0.0 1234/11 1) 0.0)
(num-test (/ 0.0 1234/11 1.0) 0.0)
(num-test (/ 0.0 1234/11 1.0+1.0i) 0.0)
(num-test (/ 0.0 1234/11 1.234+1.234i) 0.0)
(num-test (/ 0.0 1234/11 1/1) 0.0)
(num-test (/ 0.0 1234/11 123.4) 0.0)
(num-test (/ 0.0 1234/11 1234) 0.0)
(num-test (/ 0.0 1234/11 1234/11) 0.0)
(num-test (/ 0.0 1234/11) 0.0)
(num-test (/ 0.0+0.00000001i) 0.0-100000000.0i)
(num-test (/ 0.0+1.0i -1.0+1.0i) 0.5-0.5i)
(num-test (/ 0.0+1.0i 0.0+1.0i) 1.0)
(num-test (/ 0.0+1.0i 1) 0.0+1.0i)
(num-test (/ 0.0+1.0i 1.0) 0.0+1.0i)
(num-test (/ 0.0+1.0i 1.0+1.0i) 0.5+0.5i)
(num-test (/ 0.0+1.0i 1.234+1.234i) 0.40518638573744+0.40518638573744i)
(num-test (/ 0.0+1.0i 1/1) 0.0+1.0i)
(num-test (/ 0.0+1.0i 123.4) 0.0+0.00810372771475i)
(num-test (/ 0.0+1.0i 1234) 0.0+0.00081037277147i)
(num-test (/ 0.0+1.0i 1234/11) 0.0+0.00891410048622i)
(num-test (/ 1 -1.0+1.0i) -0.5-0.5i)
(num-test (/ 1 0.0+1.0i) 0.0-1.0i)
(num-test (/ 1 1 -1.0+1.0i) -0.5-0.5i)
(num-test (/ 1 1 0.0+1.0i) 0.0-1.0i)
(num-test (/ 1 1 1) 1)
(num-test (/ 1 1 1.0) 1.0)
(num-test (/ 1 1 1.0+1.0i) 0.5-0.5i)
(num-test (/ 1 1 1.234+1.234i) 0.40518638573744-0.40518638573744i)
(num-test (/ 1 1 1/1) 1)
(num-test (/ 1 1 123.4) 0.00810372771475)
(num-test (/ 1 1 1234) 1/1234)
(num-test (/ 1 1 1234/11) 11/1234)
(num-test (/ 1 1) 1)
(num-test (/ 1 1.0 -1.0+1.0i) -0.5-0.5i)
(num-test (/ 1 1.0 0.0+1.0i) 0.0-1.0i)
(num-test (/ 1 1.0 1) 1.0)
(num-test (/ 1 1.0 1.0) 1.0)
(num-test (/ 1 1.0 1.0+1.0i) 0.5-0.5i)
(num-test (/ 1 1.0 1.234+1.234i) 0.40518638573744-0.40518638573744i)
(num-test (/ 1 1.0 1/1) 1.0)
(num-test (/ 1 1.0 123.4) 0.00810372771475)
(num-test (/ 1 1.0 1234) 0.00081037277147)
(num-test (/ 1 1.0 1234/11) 0.00891410048622)
(num-test (/ 1 1.0) 1.0)
(num-test (/ 1 1.0+1.0i -1.0+1.0i) -0.5)
(num-test (/ 1 1.0+1.0i 0.0+1.0i) -0.5-0.5i)
(num-test (/ 1 1.0+1.0i 1) 0.5-0.5i)
(num-test (/ 1 1.0+1.0i 1.0) 0.5-0.5i)
(num-test (/ 1 1.0+1.0i 1.0+1.0i) 0.0-0.5i)
(num-test (/ 1 1.0+1.0i 1.234+1.234i) 0.0-0.40518638573744i)
(num-test (/ 1 1.0+1.0i 1/1) 0.5-0.5i)
(num-test (/ 1 1.0+1.0i 123.4) 0.00405186385737-0.00405186385737i)
(num-test (/ 1 1.0+1.0i 1234) 0.00040518638574-0.00040518638574i)
(num-test (/ 1 1.0+1.0i 1234/11) 0.00445705024311-0.00445705024311i)
(num-test (/ 1 1.0+1.0i) 0.5-0.5i)
(num-test (/ 1 1.234+1.234i) 0.40518638573744-0.40518638573744i)
(num-test (/ 1 123.4) 0.00810372771475)
(num-test (/ 1 1234) 1/1234)
(num-test (/ 1 1234/11) 11/1234)
(num-test (/ 1.0 -1.0+1.0i -1.0+1.0i) -0.0+0.5i)
(num-test (/ 1.0 -1.0+1.0i 0.0+1.0i) -0.5+0.5i)
(num-test (/ 1.0 -1.0+1.0i 1) -0.5-0.5i)
(num-test (/ 1.0 -1.0+1.0i 1.0) -0.5-0.5i)
(num-test (/ 1.0 -1.0+1.0i 1.0+1.0i) -0.5)
(num-test (/ 1.0 -1.0+1.0i 1.234+1.234i) -0.40518638573744)
(num-test (/ 1.0 -1.0+1.0i 1/1) -0.5-0.5i)
(num-test (/ 1.0 -1.0+1.0i 123.4) -0.00405186385737-0.00405186385737i)
(num-test (/ 1.0 -1.0+1.0i 1234) -0.00040518638574-0.00040518638574i)
(num-test (/ 1.0 -1.0+1.0i 1234/11) -0.00445705024311-0.00445705024311i)
(num-test (/ 1.0 -1.0+1.0i) -0.5-0.5i)
(num-test (/ 1.0 0.0+1.0i -1.0+1.0i) -0.5+0.5i)
(num-test (/ 1.0 0.0+1.0i 0.0+1.0i) -1.0)
(num-test (/ 1.0 0.0+1.0i 1) 0.0-1.0i)
(num-test (/ 1.0 0.0+1.0i 1.0) 0.0-1.0i)
(num-test (/ 1.0 0.0+1.0i 1.0+1.0i) -0.5-0.5i)
(num-test (/ 1.0 0.0+1.0i 1.234+1.234i) -0.40518638573744-0.40518638573744i)
(num-test (/ 1.0 0.0+1.0i 1/1) 0.0-1.0i)
(num-test (/ 1.0 0.0+1.0i 123.4) 0.0-0.00810372771475i)
(num-test (/ 1.0 0.0+1.0i 1234) 0.0-0.00081037277147i)
(num-test (/ 1.0 0.0+1.0i 1234/11) 0.0-0.00891410048622i)
(num-test (/ 1.0 0.0+1.0i) 0.0-1.0i)
(num-test (/ 1.0 1 -1.0+1.0i) -0.5-0.5i)
(num-test (/ 1.0 1 0.0+1.0i) 0.0-1.0i)
(num-test (/ 1.0 1 1) 1.0)
(num-test (/ 1.0 1 1.0) 1.0)
(num-test (/ 1.0 1 1.0+1.0i) 0.5-0.5i)
(num-test (/ 1.0 1 1.234+1.234i) 0.40518638573744-0.40518638573744i)
(num-test (/ 1.0 1 1/1) 1.0)
(num-test (/ 1.0 1 123.4) 0.00810372771475)
(num-test (/ 1.0 1 1234) 0.00081037277147)
(num-test (/ 1.0 1 1234/11) 0.00891410048622)
(num-test (/ 1.0 1) 1.0)
(num-test (/ 1.0 1.0 -1.0+1.0i) -0.5-0.5i)
(num-test (/ 1.0 1.0 0.0+1.0i) 0.0-1.0i)
(num-test (/ 1.0 1.0 1) 1.0)
(num-test (/ 1.0 1.0 1.0) 1.0)
(num-test (/ 1.0 1.0 1.0+1.0i) 0.5-0.5i)
(num-test (/ 1.0 1.0 1.234+1.234i) 0.40518638573744-0.40518638573744i)
(num-test (/ 1.0 1.0 1/1) 1.0)
(num-test (/ 1.0 1.0 123.4) 0.00810372771475)
(num-test (/ 1.0 1.0 1234) 0.00081037277147)
(num-test (/ 1.0 1.0 1234/11) 0.00891410048622)
(num-test (/ 1.0 1.0) 1.0)
(num-test (/ 1.0 1.0+1.0i -1.0+1.0i) -0.5)
(num-test (/ 1.0 1.0+1.0i 0.0+1.0i) -0.5-0.5i)
(num-test (/ 1.0 1.0+1.0i 1) 0.5-0.5i)
(num-test (/ 1.0 1.0+1.0i 1.0) 0.5-0.5i)
(num-test (/ 1.0 1.0+1.0i 1.0+1.0i) 0.0-0.5i)
(num-test (/ 1.0 1.0+1.0i 1.234+1.234i) 0.0-0.40518638573744i)
(num-test (/ 1.0 1.0+1.0i 1/1) 0.5-0.5i)
(num-test (/ 1.0 1.0+1.0i 123.4) 0.00405186385737-0.00405186385737i)
(num-test (/ 1.0 1.0+1.0i 1234) 0.00040518638574-0.00040518638574i)
(num-test (/ 1.0 1.0+1.0i 1234/11) 0.00445705024311-0.00445705024311i)
(num-test (/ 1.0 1.0+1.0i) 0.5-0.5i)
(num-test (/ 1.0 1.234+1.234i -1.0+1.0i) -0.40518638573744)
(num-test (/ 1.0 1.234+1.234i 0.0+1.0i) -0.40518638573744-0.40518638573744i)
(num-test (/ 1.0 1.234+1.234i 1) 0.40518638573744-0.40518638573744i)
(num-test (/ 1.0 1.234+1.234i 1.0) 0.40518638573744-0.40518638573744i)
(num-test (/ 1.0 1.234+1.234i 1.0+1.0i) 0.0-0.40518638573744i)
(num-test (/ 1.0 1.234+1.234i 1.234+1.234i) 0.0-0.32835201437394i)
(num-test (/ 1.0 1.234+1.234i 1/1) 0.40518638573744-0.40518638573744i)
(num-test (/ 1.0 1.234+1.234i 123.4) 0.00328352014374-0.00328352014374i)
(num-test (/ 1.0 1.234+1.234i 1234) 0.00032835201437-0.00032835201437i)
(num-test (/ 1.0 1.234+1.234i 1234/11) 0.00361187215811-0.00361187215811i)
(num-test (/ 1.0 1.234+1.234i) 0.40518638573744-0.40518638573744i)
(num-test (/ 1.0 1/1 -1.0+1.0i) -0.5-0.5i)
(num-test (/ 1.0 1/1 0.0+1.0i) 0.0-1.0i)
(num-test (/ 1.0 123.4 -1.0+1.0i) -0.00405186385737-0.00405186385737i)
(num-test (/ 1.0 123.4 0.0+1.0i) 0.0-0.00810372771475i)
(num-test (/ 1.0 123.4 1) 0.00810372771475)
(num-test (/ 1.0 123.4 1.0) 0.00810372771475)
(num-test (/ 1.0 123.4 1.0+1.0i) 0.00405186385737-0.00405186385737i)
(num-test (/ 1.0 123.4 1.234+1.234i) 0.00328352014374-0.00328352014374i)
(num-test (/ 1.0 123.4 1/1) 0.00810372771475)
(num-test (/ 1.0 123.4 123.4) 0.00006567040287)
(num-test (/ 1.0 123.4 1234) 0.00000656704029)
(num-test (/ 1.0 123.4 1234/11) 0.00007223744316)
(num-test (/ 1.0 123.4) 0.00810372771475)
(num-test (/ 1.0 1234 -1.0+1.0i) -0.00040518638574-0.00040518638574i)
(num-test (/ 1.0 1234 0.0+1.0i) 0.0-0.00081037277147i)
(num-test (/ 1.0 1234 1) 0.00081037277147)
(num-test (/ 1.0 1234 1.0) 0.00081037277147)
(num-test (/ 1.0 1234 1.0+1.0i) 0.00040518638574-0.00040518638574i)
(num-test (/ 1.0 1234 1.234+1.234i) 0.00032835201437-0.00032835201437i)
(num-test (/ 1.0 1234 1/1) 0.00081037277147)
(num-test (/ 1.0 1234 123.4) 0.00000656704029)
(num-test (/ 1.0 1234 1234) 0.00000065670403)
(num-test (/ 1.0 1234 1234/11) 0.00000722374432)
(num-test (/ 1.0 1234) 0.00081037277147)
(num-test (/ 1.0 1234/11 -1.0+1.0i) -0.00445705024311-0.00445705024311i)
(num-test (/ 1.0 1234/11 0.0+1.0i) 0.0-0.00891410048622i)
(num-test (/ 1.0 1234/11 1) 0.00891410048622)
(num-test (/ 1.0 1234/11 1.0) 0.00891410048622)
(num-test (/ 1.0 1234/11 1.0+1.0i) 0.00445705024311-0.00445705024311i)
(num-test (/ 1.0 1234/11 1.234+1.234i) 0.00361187215811-0.00361187215811i)
(num-test (/ 1.0 1234/11 1/1) 0.00891410048622)
(num-test (/ 1.0 1234/11 123.4) 0.00007223744316)
(num-test (/ 1.0 1234/11 1234) 0.00000722374432)
(num-test (/ 1.0 1234/11 1234/11) 0.00007946118748)
(num-test (/ 1.0 1234/11) 0.00891410048622)
(num-test (/ 1.0) 1.0)
(num-test (/ 1.0+1.0i -1.0+1.0i -1.0+1.0i) -0.5+0.5i)
(num-test (/ 1.0+1.0i -1.0+1.0i 0.0+1.0i) -1.0)
(num-test (/ 1.0+1.0i -1.0+1.0i 1) -0.0-1.0i)
(num-test (/ 1.0+1.0i -1.0+1.0i 1.0) -0.0-1.0i)
(num-test (/ 1.0+1.0i -1.0+1.0i 1.0+1.0i) -0.5-0.5i)
(num-test (/ 1.0+1.0i -1.0+1.0i 1.234+1.234i) -0.40518638573744-0.40518638573744i)
(num-test (/ 1.0+1.0i -1.0+1.0i 1/1) -0.0-1.0i)
(num-test (/ 1.0+1.0i -1.0+1.0i 123.4) -0.0-0.00810372771475i)
(num-test (/ 1.0+1.0i -1.0+1.0i 1234) -0.0-0.00081037277147i)
(num-test (/ 1.0+1.0i -1.0+1.0i 1234/11) -0.0-0.00891410048622i)
(num-test (/ 1.0+1.0i -1.0+1.0i) -0.0-1.0i)
(num-test (/ 1.0+1.0i 0.0+1.0i -1.0+1.0i) -1.0)
(num-test (/ 1.0+1.0i 0.0+1.0i 0.0+1.0i) -1.0-1.0i)
(num-test (/ 1.0+1.0i 0.0+1.0i 1) 1.0-1.0i)
(num-test (/ 1.0+1.0i 0.0+1.0i 1.0) 1.0-1.0i)
(num-test (/ 1.0+1.0i 0.0+1.0i 1.0+1.0i) 0.0-1.0i)
(num-test (/ 1.0+1.0i 0.0+1.0i 1.234+1.234i) 0.0-0.81037277147488i)
(num-test (/ 1.0+1.0i 0.0+1.0i 1/1) 1.0-1.0i)
(num-test (/ 1.0+1.0i 0.0+1.0i 123.4) 0.00810372771475-0.00810372771475i)
(num-test (/ 1.0+1.0i 0.0+1.0i 1234) 0.00081037277147-0.00081037277147i)
(num-test (/ 1.0+1.0i 0.0+1.0i 1234/11) 0.00891410048622-0.00891410048622i)
(num-test (/ 1.0+1.0i 0.0+1.0i) 1.0-1.0i)
(num-test (/ 1.0+1.0i 1 -1.0+1.0i) -0.0-1.0i)
(num-test (/ 1.0+1.0i 1 0.0+1.0i) 1.0-1.0i)
(num-test (/ 1.0+1.0i 1 1) 1.0+1.0i)
(num-test (/ 1.0+1.0i 1 1.0) 1.0+1.0i)
(num-test (/ 1.0+1.0i 1 1.0+1.0i) 1.0)
(num-test (/ 1.0+1.0i 1 1.234+1.234i) 0.81037277147488)
(num-test (/ 1.0+1.0i 1 1/1) 1.0+1.0i)
(num-test (/ 1.0+1.0i 1 123.4) 0.00810372771475+0.00810372771475i)
(num-test (/ 1.0+1.0i 1 1234) 0.00081037277147+0.00081037277147i)
(num-test (/ 1.0+1.0i 1 1234/11) 0.00891410048622+0.00891410048622i)
(num-test (/ 1.0+1.0i 1) 1.0+1.0i)
(num-test (/ 1.0+1.0i 1.0 -1.0+1.0i) -0.0-1.0i)
(num-test (/ 1.0+1.0i 1.0 0.0+1.0i) 1.0-1.0i)
(num-test (/ 1.0+1.0i 1.0 1) 1.0+1.0i)
(num-test (/ 1.0+1.0i 1.0 1.0) 1.0+1.0i)
(num-test (/ 1.0+1.0i 1.0 1.0+1.0i) 1.0)
(num-test (/ 1.0+1.0i 1.0 1.234+1.234i) 0.81037277147488)
(num-test (/ 1.0+1.0i 1.0 1/1) 1.0+1.0i)
(num-test (/ 1.0+1.0i 1.0 123.4) 0.00810372771475+0.00810372771475i)
(num-test (/ 1.0+1.0i 1.0 1234) 0.00081037277147+0.00081037277147i)
(num-test (/ 1.0+1.0i 1.0 1234/11) 0.00891410048622+0.00891410048622i)
(num-test (/ 1.0+1.0i 1.0) 1.0+1.0i)
(num-test (/ 1.0+1.0i 1.0+1.0i -1.0+1.0i) -0.5-0.5i)
(num-test (/ 1.0+1.0i 1.0+1.0i 0.0+1.0i) 0.0-1.0i)
(num-test (/ 1.0+1.0i 1.0+1.0i 1) 1.0)
(num-test (/ 1.0+1.0i 1.0+1.0i 1.0) 1.0)
(num-test (/ 1.0+1.0i 1.0+1.0i 1.0+1.0i) 0.5-0.5i)
(num-test (/ 1.0+1.0i 1.0+1.0i 1.234+1.234i) 0.40518638573744-0.40518638573744i)
(num-test (/ 1.0+1.0i 1.0+1.0i 1/1) 1.0)
(num-test (/ 1.0+1.0i 1.0+1.0i 123.4) 0.00810372771475)
(num-test (/ 1.0+1.0i 1.0+1.0i 1234) 0.00081037277147)
(num-test (/ 1.0+1.0i 1.0+1.0i 1234/11) 0.00891410048622)
(num-test (/ 1.0+1.0i 1.0+1.0i) 1.0)
(num-test (/ 1.0+1.0i 1.234+1.234i -1.0+1.0i) -0.40518638573744-0.40518638573744i)
(num-test (/ 1.0+1.0i 1.234+1.234i 0.0+1.0i) 0.0-0.81037277147488i)
(num-test (/ 1.0+1.0i 1.234+1.234i 1) 0.81037277147488)
(num-test (/ 1.0+1.0i 1.234+1.234i 1.0) 0.81037277147488)
(num-test (/ 1.0+1.0i 1.234+1.234i 1.0+1.0i) 0.40518638573744-0.40518638573744i)
(num-test (/ 1.0+1.0i 1.234+1.234i 1.234+1.234i) 0.32835201437394-0.32835201437394i)
(num-test (/ 1.0+1.0i 1.234+1.234i 1/1) 0.81037277147488)
(num-test (/ 1.0+1.0i 1.234+1.234i 123.4) 0.00656704028748)
(num-test (/ 1.0+1.0i 1.234+1.234i 1234) 0.00065670402875)
(num-test (/ 1.0+1.0i 1.234+1.234i 1234/11) 0.00722374431623)
(num-test (/ 1.0+1.0i 1.234+1.234i) 0.81037277147488)
(num-test (/ 1.0+1.0i 1/1 -1.0+1.0i) -0.0-1.0i)
(num-test (/ 1.0+1.0i 1/1 0.0+1.0i) 1.0-1.0i)
(num-test (/ 1.0+1.0i 123.4 -1.0+1.0i) -0.0-0.00810372771475i)
(num-test (/ 1.0+1.0i 123.4 0.0+1.0i) 0.00810372771475-0.00810372771475i)
(num-test (/ 1.0+1.0i 123.4 1) 0.00810372771475+0.00810372771475i)
(num-test (/ 1.0+1.0i 123.4 1.0) 0.00810372771475+0.00810372771475i)
(num-test (/ 1.0+1.0i 123.4 1.0+1.0i) 0.00810372771475)
(num-test (/ 1.0+1.0i 123.4 1.234+1.234i) 0.00656704028748)
(num-test (/ 1.0+1.0i 123.4 1/1) 0.00810372771475+0.00810372771475i)
(num-test (/ 1.0+1.0i 123.4 123.4) 0.00006567040287+0.00006567040287i)
(num-test (/ 1.0+1.0i 123.4 1234) 0.00000656704029+0.00000656704029i)
(num-test (/ 1.0+1.0i 123.4 1234/11) 0.00007223744316+0.00007223744316i)
(num-test (/ 1.0+1.0i 123.4) 0.00810372771475+0.00810372771475i)
(num-test (/ 1.0+1.0i 1234 -1.0+1.0i) -0.0-0.00081037277147i)
(num-test (/ 1.0+1.0i 1234 0.0+1.0i) 0.00081037277147-0.00081037277147i)
(num-test (/ 1.0+1.0i 1234 1) 0.00081037277147+0.00081037277147i)
(num-test (/ 1.0+1.0i 1234 1.0) 0.00081037277147+0.00081037277147i)
(num-test (/ 1.0+1.0i 1234 1.0+1.0i) 0.00081037277147)
(num-test (/ 1.0+1.0i 1234 1.234+1.234i) 0.00065670402875)
(num-test (/ 1.0+1.0i 1234 1/1) 0.00081037277147+0.00081037277147i)
(num-test (/ 1.0+1.0i 1234 123.4) 0.00000656704029+0.00000656704029i)
(num-test (/ 1.0+1.0i 1234 1234) 0.00000065670403+0.00000065670403i)
(num-test (/ 1.0+1.0i 1234 1234/11) 0.00000722374432+0.00000722374432i)
(num-test (/ 1.0+1.0i 1234) 0.00081037277147+0.00081037277147i)
(num-test (/ 1.0+1.0i 1234/11 -1.0+1.0i) -0.0-0.00891410048622i)
(num-test (/ 1.0+1.0i 1234/11 0.0+1.0i) 0.00891410048622-0.00891410048622i)
(num-test (/ 1.0+1.0i 1234/11 1) 0.00891410048622+0.00891410048622i)
(num-test (/ 1.0+1.0i 1234/11 1.0) 0.00891410048622+0.00891410048622i)
(num-test (/ 1.0+1.0i 1234/11 1.0+1.0i) 0.00891410048622)
(num-test (/ 1.0+1.0i 1234/11 1.234+1.234i) 0.00722374431623)
(num-test (/ 1.0+1.0i 1234/11 1/1) 0.00891410048622+0.00891410048622i)
(num-test (/ 1.0+1.0i 1234/11 123.4) 0.00007223744316+0.00007223744316i)
(num-test (/ 1.0+1.0i 1234/11 1234) 0.00000722374432+0.00000722374432i)
(num-test (/ 1.0+1.0i 1234/11 1234/11) 0.00007946118748+0.00007946118748i)
(num-test (/ 1.0+1.0i 1234/11) 0.00891410048622+0.00891410048622i)
(num-test (/ 1.0+1.0i) 0.5-0.5i)
(num-test (/ 1.234+1.234i -1.0+1.0i) -0.0-1.234i)
(num-test (/ 1.234+1.234i 0.0+1.0i) 1.234-1.234i)
(num-test (/ 1.234+1.234i 1) 1.234+1.234i)
(num-test (/ 1.234+1.234i 1.0) 1.234+1.234i)
(num-test (/ 1.234+1.234i 1.0+1.0i) 1.234)
(num-test (/ 1.234+1.234i 1.234+1.234i) 1.0)
(num-test (/ 1.234+1.234i 1/1) 1.234+1.234i)
(num-test (/ 1.234+1.234i 123.4) 0.01+0.01i)
(num-test (/ 1.234+1.234i 1234) 0.001+0.001i)
(num-test (/ 1.234+1.234i 1234/11) 0.011+0.011i)
(num-test (/ 10) 1/10)
(num-test (/ 10/3) 3/10)
(num-test (/ 10 3) 10/3)
(num-test (/ 10 -3) -10/3)
(num-test (/ -10 -3) 10/3)
(num-test (/ 11) 1/11)
(num-test (/ 123.4 -1.0+1.0i -1.0+1.0i) -0.0+61.7i)
(num-test (/ 123.4 -1.0+1.0i 0.0+1.0i) -61.7+61.7i)
(num-test (/ 123.4 -1.0+1.0i 1) -61.7-61.7i)
(num-test (/ 123.4 -1.0+1.0i 1.0) -61.7-61.7i)
(num-test (/ 123.4 -1.0+1.0i 1.0+1.0i) -61.7)
(num-test (/ 123.4 -1.0+1.0i 1.234+1.234i) -50.0)
(num-test (/ 123.4 -1.0+1.0i 1/1) -61.7-61.7i)
(num-test (/ 123.4 -1.0+1.0i 123.4) -0.5-0.5i)
(num-test (/ 123.4 -1.0+1.0i 1234) -0.05000000000000-0.05000000000000i)
(num-test (/ 123.4 -1.0+1.0i 1234/11) -0.55000000000000-0.55000000000000i)
(num-test (/ 123.4 -1.0+1.0i) -61.7-61.7i)
(num-test (/ 123.4 0.0+1.0i -1.0+1.0i) -61.7+61.7i)
(num-test (/ 123.4 0.0+1.0i 0.0+1.0i) -123.4)
(num-test (/ 123.4 0.0+1.0i 1) 0.0-123.4i)
(num-test (/ 123.4 0.0+1.0i 1.0) 0.0-123.4i)
(num-test (/ 123.4 0.0+1.0i 1.0+1.0i) -61.7-61.7i)
(num-test (/ 123.4 0.0+1.0i 1.234+1.234i) -50.0-50.0i)
(num-test (/ 123.4 0.0+1.0i 1/1) 0.0-123.4i)
(num-test (/ 123.4 0.0+1.0i 123.4) 0.0-1.0i)
(num-test (/ 123.4 0.0+1.0i 1234) 0.0-0.1i)
(num-test (/ 123.4 0.0+1.0i 1234/11) 0.0-1.10000000000000i)
(num-test (/ 123.4 0.0+1.0i) 0.0-123.4i)
(num-test (/ 123.4 1 -1.0+1.0i) -61.7-61.7i)
(num-test (/ 123.4 1 0.0+1.0i) 0.0-123.4i)
(num-test (/ 123.4 1 1) 123.4)
(num-test (/ 123.4 1 1.0) 123.4)
(num-test (/ 123.4 1 1.0+1.0i) 61.7-61.7i)
(num-test (/ 123.4 1 1.234+1.234i) 50.0-50.0i)
(num-test (/ 123.4 1 1/1) 123.4)
(num-test (/ 123.4 1 123.4) 1.0)
(num-test (/ 123.4 1 1234) 0.1)
(num-test (/ 123.4 1 1234/11) 1.10000000000000)
(num-test (/ 123.4 1) 123.4)
(num-test (/ 123.4 1.0 -1.0+1.0i) -61.7-61.7i)
(num-test (/ 123.4 1.0 0.0+1.0i) 0.0-123.4i)
(num-test (/ 123.4 1.0 1) 123.4)
(num-test (/ 123.4 1.0 1.0) 123.4)
(num-test (/ 123.4 1.0 1.0+1.0i) 61.7-61.7i)
(num-test (/ 123.4 1.0 1.234+1.234i) 50.0-50.0i)
(num-test (/ 123.4 1.0 1/1) 123.4)
(num-test (/ 123.4 1.0 123.4) 1.0)
(num-test (/ 123.4 1.0 1234) 0.1)
(num-test (/ 123.4 1.0 1234/11) 1.10000000000000)
(num-test (/ 123.4 1.0) 123.4)
(num-test (/ 123.4 1.0+1.0i -1.0+1.0i) -61.7)
(num-test (/ 123.4 1.0+1.0i 0.0+1.0i) -61.7-61.7i)
(num-test (/ 123.4 1.0+1.0i 1) 61.7-61.7i)
(num-test (/ 123.4 1.0+1.0i 1.0) 61.7-61.7i)
(num-test (/ 123.4 1.0+1.0i 1.0+1.0i) 0.0-61.7i)
(num-test (/ 123.4 1.0+1.0i 1.234+1.234i) 0.0-50.0i)
(num-test (/ 123.4 1.0+1.0i 1/1) 61.7-61.7i)
(num-test (/ 123.4 1.0+1.0i 123.4) 0.5-0.5i)
(num-test (/ 123.4 1.0+1.0i 1234) 0.05000000000000-0.05000000000000i)
(num-test (/ 123.4 1.0+1.0i 1234/11) 0.55000000000000-0.55000000000000i)
(num-test (/ 123.4 1.0+1.0i) 61.7-61.7i)
(num-test (/ 123.4 1.234+1.234i -1.0+1.0i) -50.0)
(num-test (/ 123.4 1.234+1.234i 0.0+1.0i) -50.0-50.0i)
(num-test (/ 123.4 1.234+1.234i 1) 50.0-50.0i)
(num-test (/ 123.4 1.234+1.234i 1.0) 50.0-50.0i)
(num-test (/ 123.4 1.234+1.234i 1.0+1.0i) 0.0-50.0i)
(num-test (/ 123.4 1.234+1.234i 1.234+1.234i) 0.0-40.51863857374392i)
(num-test (/ 123.4 1.234+1.234i 1/1) 50.0-50.0i)
(num-test (/ 123.4 1.234+1.234i 123.4) 0.40518638573744-0.40518638573744i)
(num-test (/ 123.4 1.234+1.234i 1234) 0.04051863857374-0.04051863857374i)
(num-test (/ 123.4 1.234+1.234i 1234/11) 0.44570502431118-0.44570502431118i)
(num-test (/ 123.4 1.234+1.234i) 50.0-50.0i)
(num-test (/ 123.4 1/1 -1.0+1.0i) -61.7-61.7i)
(num-test (/ 123.4 1/1 0.0+1.0i) 0.0-123.4i)
(num-test (/ 123.4 123.4 -1.0+1.0i) -0.5-0.5i)
(num-test (/ 123.4 123.4 0.0+1.0i) 0.0-1.0i)
(num-test (/ 123.4 123.4 1) 1.0)
(num-test (/ 123.4 123.4 1.0) 1.0)
(num-test (/ 123.4 123.4 1.0+1.0i) 0.5-0.5i)
(num-test (/ 123.4 123.4 1.234+1.234i) 0.40518638573744-0.40518638573744i)
(num-test (/ 123.4 123.4 1/1) 1.0)
(num-test (/ 123.4 123.4 123.4) 0.00810372771475)
(num-test (/ 123.4 123.4 1234) 0.00081037277147)
(num-test (/ 123.4 123.4 1234/11) 0.00891410048622)
(num-test (/ 123.4 123.4) 1.0)
(num-test (/ 123.4 1234 -1.0+1.0i) -0.05000000000000-0.05000000000000i)
(num-test (/ 123.4 1234 0.0+1.0i) 0.0-0.1i)
(num-test (/ 123.4 1234 1) 0.1)
(num-test (/ 123.4 1234 1.0) 0.1)
(num-test (/ 123.4 1234 1.0+1.0i) 0.05000000000000-0.05000000000000i)
(num-test (/ 123.4 1234 1.234+1.234i) 0.04051863857374-0.04051863857374i)
(num-test (/ 123.4 1234 1/1) 0.1)
(num-test (/ 123.4 1234 123.4) 0.00081037277147)
(num-test (/ 123.4 1234 1234) 0.00008103727715)
(num-test (/ 123.4 1234 1234/11) 0.00089141004862)
(num-test (/ 123.4 1234) 0.1)
(num-test (/ 123.4 1234/11 -1.0+1.0i) -0.55000000000000-0.55000000000000i)
(num-test (/ 123.4 1234/11 0.0+1.0i) 0.0-1.10000000000000i)
(num-test (/ 123.4 1234/11 1) 1.10000000000000)
(num-test (/ 123.4 1234/11 1.0) 1.10000000000000)
(num-test (/ 123.4 1234/11 1.0+1.0i) 0.55000000000000-0.55000000000000i)
(num-test (/ 123.4 1234/11 1.234+1.234i) 0.44570502431118-0.44570502431118i)
(num-test (/ 123.4 1234/11 1/1) 1.10000000000000)
(num-test (/ 123.4 1234/11 123.4) 0.00891410048622)
(num-test (/ 123.4 1234/11 1234) 0.00089141004862)
(num-test (/ 123.4 1234/11 1234/11) 0.00980551053485)
(num-test (/ 123.4 1234/11) 1.10000000000000)
(num-test (/ 1234 -1.0+1.0i) -617.0-617.0i)
(num-test (/ 1234 0.0+1.0i) 0.0-1234.0i)
(num-test (/ 1234 1) 1234)
(num-test (/ 1234 1.0) 1234.0)
(num-test (/ 1234 1.0+1.0i) 617.0-617.0i)
(num-test (/ 1234 1.234+1.234i) 500.0-500.0i)
(num-test (/ 1234 1/1) 1234)
(num-test (/ 1234 123.4) 10.0)
(num-test (/ 1234 1234) 1)
(num-test (/ 1234 1234/11) 11)
(num-test (/ 1234/11 -1.0+1.0i) -56.09090909090909-56.09090909090909i)
(num-test (/ 1234/11 0.0+1.0i) 0.0-112.18181818181819i)
(num-test (/ 1234/11 1) 1234/11)
(num-test (/ 1234/11 1.0) 112.18181818181819)
(num-test (/ 1234/11 1.0+1.0i) 56.09090909090909-56.09090909090909i)
(num-test (/ 1234/11 1.234+1.234i) 45.45454545454546-45.45454545454546i)
(num-test (/ 1234/11 1/1) 1234/11)
(num-test (/ 1234/11 123.4) 0.90909090909091)
(num-test (/ 1234/11 1234) 1/11)
(num-test (/ 1234/11 1234/11) 1)
(num-test (/ 1234000000) 1/1234000000)
(num-test (/ 1234000000.0) 0.00000000081037)
(num-test (/ 1234000000.0+2.71828182845905i) 0.00000000081037-0.0i)
(num-test (/ 1234000000/10) 10/1234000000)
(num-test (/ 2) 1/2)
(num-test (/ 2.71828182845905) 0.36787944117144)
(num-test (/ 2.71828182845905+3.14159265358979i) 0.15750247989732-0.18202992367723i)
(num-test (/ 2/2) 2/2)
(num-test (/ 362880) 1/362880)
(num-test (/ 362880/1234) 1234/362880)
(num-test (/ 1/2 1+i 1-i) 0.25)

(when (provided? 'overflow-checks)
  (num-test (/ 2/9223372036854775807 2) 1/9223372036854775807)
  (num-test (/ -63/288230376151711744 -63) 1/288230376151711744))

(unless (or with-bignums (not (provided? 'overflow-checks)))
  (num-test (/ 1/2305843009213693952 -1 4194304/2097151) -2.168403310995243176730312012479018335398E-19)
  (num-test (/ 1/2199023255552 -63 8388608/4194303) -3.609105098938467225452985162735872325445E-15)
  (num-test (/ 1/17179869184 -1 1073741824/536870911) -2.91038304025235949890060282996273599565E-11))

(for-each-permutation 
 (lambda args
   (if (not (= (apply / args) (/ (car args) (apply * (cdr args)))))
       (format #t "~A: ~A != ~A?~%" (port-line-number) (apply / args) (/ (car args) (apply * (cdr args))))))
 '(1 1/2 0.5 1+i))

(num-test (/ -9223372036854775808 5.551115123125783999999999999999999999984E-17) -1.661534994731144452653560599947843044136E35)
(num-test (/ 1.110223024625156799999999999999999999997E-16 -9223372036854775808) -1.203706215242022689593248685469006886702E-35)
(num-test (/ 1.110223024625156799999999999999999999997E-16 5.551115123125783999999999999999999999984E-17 5.42101086242752217060000000000000000001E-20) 3.689348814741910322817021726897015792169E19)
(num-test (/ 5.551115123125783999999999999999999999984E-17 1.110223024625156799999999999999999999997E-16) 5.000E-1)
(num-test (/ 9223372036854775807 9223372036854775807) 1)
(num-test (/ (* 2 3 4 5 6 7 8 9 10) (* 2 (expt (log 2) 11))) 102247563.00527)
(num-test (/ 1 (/ 1 1234)) 1234)
(num-test (/ 1.0 (/ 1.0 1.0+1.0i)) 1.0+1.0i)
(num-test (/ 1.0 (/ 1.0 pi)) pi)
(num-test (/ 1/123412341234) 123412341234)
(num-test (/ 1/98947 2/97499 3/76847) 7492505653/593682)
(num-test (/ 123412341234) 1/123412341234)
(num-test (/ 500009/500029 500057/500041) 250025000369/250043001653)
(num-test (/ -9223372036854775808 -9223372036854775808 4) 1/4)
(num-test (/ -9223372036854775808 2) -4611686018427387904)
(num-test (/ 0 -00-1i) 0.0)
(num-test (/ 0+i) 0-1i)
(num-test (/ 0-i) 0+i)
(num-test (/ 1+i) 1/2-1/2i);
(num-test (/ 1.0 1/524288 1/19073486328125) 1.000000000000000024754073164739868757037E19)
(num-test (/ 1/10 010) 1/100)
(num-test (/ 1/9223372036854775807 1/9223372036854775807) 1)
(num-test (/ 1234567890/9223372036854775807 123456789/9223372036854775807) 10)
(num-test (/ 2 -9223372036854775808) -1/4611686018427387904)
(num-test (/ 2 most-negative-fixnum) -1/4611686018427387904)
(when (provided? 'overflow-checks) 
  (num-test (/ 2/9223372036854775807 2/3) 3/9223372036854775807))
(num-test (/ 9223372036854775807/123456789 9223372036854775807/123456789) 1)
(num-test (/ 9223372036854775807/1234567890 9223372036854775807/12345678900) 10)
(num-test (/ most-negative-fixnum 2) -4611686018427387904)
(num-test (/ most-negative-fixnum most-negative-fixnum 2) 1/2)
(num-test (/ most-negative-fixnum most-negative-fixnum) 1)
(num-test (/ (/ (- most-positive-fixnum))) -9223372036854775807)
(num-test (/ most-negative-fixnum 864691128455135232) -32/3)
(num-test (/(*(/(*)))) 1)
(num-test (/ 12341234/111 123456789 12341234/111) 1/123456789)
(num-test (/ 1e63 1e-63) 1e126)
(num-test (/ 1e154 1e-154) 1e308) ; else inf
(num-test (/ 1e-200 1e200) 0.0)
;;; inaccuracies creep in (/ 1e-200 1e123) => 9.8813129168249e-324
;;; or (/ 10e307 1e309) => 0.0 and (/ 10e308 1e308) => inf
;;; might be neat to handle these (if exps= just divide mant?

(num-test (/ -0.651381628953465E0 -0.9237050214744277E0) 7.051835962889135018948026610294923703508E-1)
(num-test (/ 0.5067986732438687E0 0.6260017267692811E0) 8.095803119575965307784422745290898299591E-1)
(num-test (/ -0.8399445051045212E0 0.1829250718359493E0) -4.591740742120902283769244624290448381427E0)
(num-test (/ -0.5987041550692662E0 -0.4124053212463479E0) 1.451737221187875469260813375116670894624E0)
(num-test (/ 0.5861382519823647E0 -0.7560374696447822E0) -7.752767230673855251634630463492900473644E-1)
(num-test (/ -0.012882644582824954E0 -0.4671067448591679E0) 2.757965866390787237919533761751626109973E-2)
(num-test (/ -0.7830198970435231E0 2.1690164135025935E9) -3.610022921767930828778117437420472499541E-10)
(num-test (/ -0.2339206226652567E0 2.729373380002701E9) -8.570488170622710029144125942503181451939E-11)
(num-test (/ -0.2285806315782951E0 -2.602073870582813E9) 8.784555817667757706754728345837912936962E-11)
(num-test (/ -0.5298716781559242E0 1.3509547453340487E9) -3.922201539215168658138266422439019362809E-10)
(num-test (/ 0.7287190523338418E0 -8.244205871151566E9) -8.839166121309546680006433484161854320415E-11)
(num-test (/ 0.18973054487786212E0 6.557593452200545E9) 2.893295326415727180554709812740977209383E-11)
(num-test (/ 0.5084032300982587E0 4.5431682148621014E-11) 1.119049980221104893780059617560389832312E10)
(num-test (/ 0.6621212705475221E0 -1.838873437953206E-11) -3.6006897314505184969089186237646638616E10)
(num-test (/ -0.4041791750277005E0 7.707875701307648E-11) -5.243716825365141031107302892929967408104E9)
(num-test (/ -0.09569063343466655E0 4.789751448902253E-11) -1.9978204392338054187984205729651608099E9)
(num-test (/ -0.6471008513340974E0 1.890250884404079E-11) -3.423359600956370337454713673029890117878E10)
(num-test (/ -0.4301276572683971E0 9.134844738134672E-11) -4.708647706651977799170970961042517830565E9)
(num-test (/ -0.5061027989171409E0 4.246468515299164E19) -1.191820443490291421327933820140392588455E-20)
(num-test (/ -0.9601783702217944E0 7.495754288877955E19) -1.280962973461506313537075112900039769719E-20)
(num-test (/ -0.6477754868655262E0 -8.507334914535449E19) 7.614317449272520944989386124046318248581E-21)
(num-test (/ 0.1934462826116784E0 3.6173521417193476E19) 5.347731573618163299262146929108634114511E-21)
(num-test (/ -0.7794308505212441E0 4.172217291786081E19) -1.868145391314406352823434511710862322776E-20)
(num-test (/ -0.8462346361305484E0 7.378170819620111E19) -1.146943675904374803577079154661818066039E-20)
(num-test (/ 0.9783005897625496E0 6.175045007596078E-21) 1.584280905740958108982369263614665552851E20)
(num-test (/ -0.9700832605850568E0 -1.7695051741124812E-21) 5.4822290139480091183029856440319954731E20)
(num-test (/ 0.07062591404368701E0 -8.855398515753737E-21) -7.975464223100026969579387130724758972895E18)
(num-test (/ 0.4751383409805402E0 -8.1371029771106E-21) -5.839158510308749293926976970601471638106E19)
(num-test (/ -0.5103510786836052E0 8.302178001281015E-21) -6.147195092719750272554937885528717433502E19)
(num-test (/ 0.7148807879199733E0 4.338856119331781E-21) 1.647625015115898182854639201045676562387E20)
(num-test (/ 4.180670608983218E9 -0.8621420131862095E0) -4.849167010818503318377538718886882159085E9)
(num-test (/ 3.202209376555907E9 0.008113117870009012E0) 3.946952858152361317410218375892707092144E11)
(num-test (/ 7.767843042272955E9 -0.04145956871894663E0) -1.87359475322354819500790198613468533242E11)
(num-test (/ 1.1937839884817846E9 0.45557753834605563E0) 2.620374992181877679062077123717269598672E9)
(num-test (/ -2.4205138097471213E9 -0.3737757916008485E0) 6.475844247109412171348144805246962117951E9)
(num-test (/ -7.534066568550288E9 -0.3609372553147958E0) 2.087361849632108651836399241353567759856E10)
(num-test (/ 6.098867840095913E9 3.0464612528039427E9) 2.001951554277132357084991750811780094278E0)
(num-test (/ 4.956687716396978E9 7.035407926465974E9) 7.045345157244949942198957065331702603612E-1)
(num-test (/ 6.969049109639194E9 -8.115758334653503E9) -8.587058438990264159516222429259889060394E-1)
(num-test (/ -8.0699835500126705E9 -1.1896420666819375E9) 6.783539163608157717597859343396495021042E0)
(num-test (/ -2.229793060172571E9 -2.658809828346301E9) 8.386433043838395143199282594014446842336E-1)
(num-test (/ 3.0672739776038485E9 -7.988270854370873E9) -3.839722054398737311833139439634292109412E-1)
(num-test (/ 2.477055391151669E9 -1.3522358047779648E-11) -1.831822070085178675709536653203693354871E20)
(num-test (/ 1.1318646612469008E9 -8.457695758685169E-11) -1.338265992938554414702828284241585726631E19)
(num-test (/ -7.978772126259147E9 6.210468872769038E-11) -1.284729428601367805018001112036580297153E20)
(num-test (/ -9.057338243339752E9 7.364415429198257E-11) -1.22987877726580108212627205863468836645E20)
(num-test (/ -5.341117220720213E9 4.7359651161519756E-11) -1.127777990277920421924982539741683693507E20)
(num-test (/ 5.838003830912871E9 -5.0625478501901024E-11) -1.153175042225753978331600642680269130096E20)
(num-test (/ 6.407156672927742E9 5.006339136594536E19) 1.279808758079079048751288572047629634958E-10)
(num-test (/ 4.687485139826675E8 -3.5561755068968083E19) -1.318125365504547538826162177354689732851E-11)
(num-test (/ -5.838044723576891E9 -6.843985743599882E19) 8.530182473036721969937888742798001972008E-11)
(num-test (/ 3.9279221543350096E9 -5.882918042982924E19) -6.676826237652909876656284584084555589571E-11)
(num-test (/ -9.686323716926361E9 -3.44800215666902E19) 2.809256861452760638746791455737599480861E-10)
(num-test (/ 7.301304808910639E9 1.2845297359643038E19) 5.684029419085037872687787191413868358377E-10)
(num-test (/ 4.380345662298534E9 -4.352751895415198E-21) -1.006339384266859136854551985691861659542E30)
(num-test (/ 8.239490918139045E9 3.2397577733346748E-21) 2.543242888698483402490821850315555889368E30)
(num-test (/ 3.8980499504872713E9 8.311650110069505E-21) 4.689862901910189296816144765858628505003E29)
(num-test (/ -9.425472285331268E9 -3.294031046828316E-21) 2.861379310436876111669825630018089608938E30)
(num-test (/ 2.517833161624173E9 3.6891560299469316E-21) 6.824957093669990747641669780362243770063E29)
(num-test (/ -5.463519676339016E9 -7.298583081866205E-22) 7.485726496576409428699223883071063828111E30)
(num-test (/ 1.39357009199772E-11 0.417842407627649E0) 3.335157146709649079791043787228216537723E-11)
(num-test (/ 8.58494900746665E-11 -0.6481371063028898E0) -1.324557554872456302657963676252150750478E-10)
(num-test (/ -9.310282234439046E-11 0.9146343299129254E0) -1.017923986663107128254299604028521252096E-10)
(num-test (/ -8.800556770159418E-11 -0.9305573406536135E0) 9.457296596014170681132977631993414317205E-11)
(num-test (/ -1.3361456473382827E-11 0.06420301636905124E0) -2.081125970247038707404762086321230923761E-10)
(num-test (/ 6.1406425153971765E-12 -0.3082496074575478E0) -1.992100676476244033296635444865296145538E-11)
(num-test (/ -3.6962256202372035E-11 3.089420488573177E9) -1.196413901541863127466123235969256148157E-20)
(num-test (/ -6.145126590884831E-11 -6.225608984106817E9) 9.870723661849873241350389006374300024184E-21)
(num-test (/ 9.052281678541901E-11 -6.9187138778508625E9) -1.308376359878287335554324548627653637652E-20)
(num-test (/ -3.4950245360118636E-11 7.543342567738434E9) -4.633257080169574405642456881139071687897E-21)
(num-test (/ -3.482822570743636E-11 -3.87599225187502E9) 8.985628309909063146939690605121402184145E-21)
(num-test (/ -9.42226868788213E-11 7.501937454180854E9) -1.25597803839741017709728590003874245271E-20)
(num-test (/ -4.8165035309367155E-11 9.484620130429997E-11) -5.078225026096383416618039442767276425835E-1)
(num-test (/ 6.880022773725747E-11 -9.699156104509544E-11) -7.093424107822057000929770558471489984227E-1)
(num-test (/ 1.5817962388036865E-11 -7.11651152335492E-11) -2.222712959309569253469449863287830842251E-1)
(num-test (/ -7.0140750853949335E-12 -4.4677941652531186E-11) 1.569919030725435801904141818366904619636E-1)
(num-test (/ -2.6947489262085355E-11 8.365454450205894E-11) -3.221282169723859093984652053864584015511E-1)
(num-test (/ 8.703167674410303E-11 -4.88739813223768E-11) -1.780736383435491638475146912252252561499E0)
(num-test (/ 1.165112061543483E-12 -5.899528740399518E19) -1.974923952086012268924127751659019857389E-32)
(num-test (/ 7.126386981630328E-12 5.091741402945837E19) 1.399597194293359595983101664952569614126E-31)
(num-test (/ -7.132349854872655E-13 7.70347159367981E19) -9.258617712985762871283798832641751905855E-33)
(num-test (/ 4.507266517270466E-11 -1.6192737232544485E19) -2.78351118315665136913517665604742725923E-30)
(num-test (/ -3.025128309814261E-11 -5.606736896306867E19) 5.395523930874836927233660478269495795871E-31)
(num-test (/ -5.390258677516223E-11 6.628750121976767E18) -8.131636550373975963243412569165785520017E-30)
(num-test (/ -8.484515181627938E-11 6.226893371743352E-21) -1.362559895457550846279271972989853630227E10)
(num-test (/ 5.110456708789676E-11 -7.434814854731122E-21) -6.873683889434922905934754874417370413592E9)
(num-test (/ -7.784815533665352E-11 -8.942884975553875E-21) 8.705038200698988300091363733020271337225E9)
(num-test (/ 6.06871371776654E-11 -8.4720755768444E-21) -7.163195916657483482294943699821186479438E9)
(num-test (/ 6.395725883763629E-11 3.2465500186809204E-21) 1.970006883295217146112013920243427167994E10)
(num-test (/ 8.23766365482318E-11 3.5665958051648335E-21) 2.309671211661863324131996575306264215863E10)
(num-test (/ -6.882125490660233E19 0.680553203393516E0) -1.011254587641810638505458546065261498221E20)
(num-test (/ -8.955858402134752E19 0.11144092291315044E0) -8.036418012361891226885340978581557821805E20)
(num-test (/ 4.517225460957592E19 -0.5804969398143229E0) -7.781652496570381006264991321295105224966E19)
(num-test (/ -9.741926397385082E19 -0.9037000739789977E0) 1.078004381972805693752225428081454781542E20)
(num-test (/ 9.654390326446178E19 -0.061963385089831124E0) -1.558079874501654704495847314268744072438E21)
(num-test (/ 9.50855454738802E19 0.30375471599023185E0) 3.130339727036137864357134952530976170215E20)
(num-test (/ 4.323538184184934E19 -2.6027608151521606E9) -1.661135421670382968923474255247239383096E10)
(num-test (/ 4.0554081767557594E17 4.814123702784068E9) 8.423979995384136048633041200603888010585E7)
(num-test (/ 5.12727309625028E19 1.761988796449604E9) 2.909935129316203535920673855950717437829E10)
(num-test (/ -7.335661993746345E19 -4.961351435504E9) 1.478561252736806087045652086640747044774E10)
(num-test (/ 3.7135994768593306E18 3.273427798269768E8) 1.134468118961482490398408895662653948827E10)
(num-test (/ 1.3911083524706402E19 8.651242909451927E9) 1.607986698594236535694138981270724564992E9)
(num-test (/ 6.473382688386894E19 -3.700509647679497E-11) -1.74932193257385527761113361595002688054E30)
(num-test (/ 7.25328632809461E19 6.793518758100849E-11) 1.0676773828651782212117989476182162163E30)
(num-test (/ 7.053090091571119E19 8.009021819073383E-11) 8.806431360661641824334823520600629499368E29)
(num-test (/ -1.6322872380348074E19 -1.234889420758779E-11) 1.32180842316378978004378947103470484747E30)
(num-test (/ -7.716951191497702E19 -2.473367210466666E-11) 3.120018393888910452644610629695438606501E30)
(num-test (/ -2.1174708383466066E19 -9.66632270128099E-11) 2.190565020207733610503619470750854251338E29)
(num-test (/ 4.0902039392392786E18 -5.029423690873208E19) -8.132549951322828067822875337940065787516E-2)
(num-test (/ 1.4562115759233494E17 4.2665150414889705E19) 3.413117173530803542079920263107168159861E-3)
(num-test (/ -3.309692589578652E19 1.1329455009949342E19) -2.92131667999222745140457080629099499358E0)
(num-test (/ 3.059130103268258E19 -7.719433592654628E19) -3.962894513632647141286488246687660445133E-1)
(num-test (/ 5.622979366632147E19 -8.407251901594788E19) -6.688248945610292804540334084533940238665E-1)
(num-test (/ -7.457587910839625E18 1.102755747735572E19) -6.762683328700153669243467171164281736437E-1)
(num-test (/ 1.2026615920578564E19 -3.77964792582931E-21) -3.181940793583240608441984111790776956096E39)
(num-test (/ -2.74643694419756E19 2.538907641816601E-22) -1.08173960287601117923133084738647095934E41)
(num-test (/ 8.267361397156658E18 -4.986401395715489E-21) -1.657981526368955793956856573504468676464E39)
(num-test (/ 9.876393891158812E19 -5.792612775193684E-22) -1.704998119925007613535922021885867984527E41)
(num-test (/ 3.927461252713038E17 4.810589424292295E-21) 8.164199656866003466542429981600313024025E37)
(num-test (/ 7.29943837795987E19 -4.8820727437034755E-21) -1.495151498382347474354240468822304376928E40)
(num-test (/ -7.837850970911807E-21 0.41514160181315674E0) -1.887994587070894820872902637806483134671E-20)
(num-test (/ 1.1499234744049124E-21 0.4643166529612681E0) 2.476593219457143961012942936990797968514E-21)
(num-test (/ -1.094368243984769E-21 0.9008053219044149E0) -1.214877640455251662856715755193246361763E-21)
(num-test (/ 2.4821206327531197E-21 0.22988631081892086E0) 1.079716588565493668307955174993650571244E-20)
(num-test (/ -4.56226662576732E-22 0.6695285124602162E0) -6.814148375851898788485451948577541009839E-22)
(num-test (/ 6.442796853653397E-21 -0.0419134640377401E0) -1.537166397855380228851954699451812058468E-19)
(num-test (/ -5.584403218169678E-21 -8.092869169805251E9) 6.900399723506295845105466793248363429626E-31)
(num-test (/ -9.796722996869492E-21 -3.2988270899833827E9) 2.969759471970033259328414098139420231204E-30)
(num-test (/ 9.441829923771915E-22 5.464575083746736E9) 1.727825087783076315606418411938950517056E-31)
(num-test (/ -6.419360319610147E-21 -7.333962810289677E9) 8.752921831841952013186922455457072581443E-31)
(num-test (/ 7.973734412555454E-21 -9.367577614661436E9) -8.512055880994845185202464827966401354632E-31)
(num-test (/ 8.105484193881594E-21 -8.664550975192905E9) -9.354765431108951260398341387461553707907E-31)
(num-test (/ -5.3151708182942476E-21 -3.406928289732576E-11) 1.560106455516695805992469791379650741489E-10)
(num-test (/ -7.026602845639829E-21 -9.92483846943868E-11) 7.079815824989676856562805642631867847741E-11)
(num-test (/ -5.901970468193158E-21 2.074489043942647E-11) -2.845023686881582124910812196899705492945E-10)
(num-test (/ -6.40466723844613E-21 -2.551008177490094E-11) 2.510641594550905909683475044031419810602E-10)
(num-test (/ 8.056066940872177E-21 4.645883100460603E-11) 1.734022739417072488146823616965762354533E-10)
(num-test (/ 7.453765056481805E-21 6.956136187014756E-11) 1.071538114851171096483487539186715128913E-10)
(num-test (/ 7.357434693258832E-21 -7.093525088486332E19) -1.037204295675341715303117810431180096085E-40)
(num-test (/ -3.3759558579798473E-21 9.991075630444324E19) -3.378971376908405498870850768959668870304E-41)
(num-test (/ 6.908026973557955E-21 -4.20805893397862E19) -1.641618399822784611549409240045335916762E-40)
(num-test (/ 5.181767322756247E-21 7.46986056263721E19) 6.936899664063931551045422017869651239957E-41)
(num-test (/ -5.7217313601659264E-21 5.604979023134118E19) -1.020830111326005351069300302415295512527E-40)
(num-test (/ -9.340193892824771E-21 9.147101848766205E19) -1.021109641857175884684740262364588092125E-40)
(num-test (/ 8.331002176099931E-21 2.0276444314093977E-21) 4.108709617449606347005645831416724715479E0)
(num-test (/ -3.747505523684784E-21 4.394623185543803E-21) -8.527478615259381231018127145394525879915E-1)
(num-test (/ -3.310403953328861E-21 2.3420390876737627E-21) -1.413470838617356120752866783055539347411E0)
(num-test (/ 6.23845405853013E-21 -8.933620117412232E-21) -6.983119918397872761237650028889120834928E-1)
(num-test (/ -4.276770609150315E-21 6.853299965034864E-21) -6.240454424832049912604789277138688124888E-1)
(num-test (/ -8.847946637724495E-21 6.33827952828724E-21) -1.395953996386055439061738621964402924048E0)

(when with-bignums ; from futilitycloset I think
  (let-temporarily (((*s7* 'bignum-precision) 2048))
    (test (object->string (/ 1.0 999999999999999999999998999999999999999999999999)) "1.00000000000000000000000100000000000000000000000200000000000000000000000300000000000000000000000500000000000000000000000800000000000000000000001300000000000000000000002100000000000000000000003400000000000000000000005500000000000000000000008900000000000000000000014400000000000000000000023300000000000000000000037700000000000000000000061000000000000000000000098700000000000000000000159700000000000000000000258400000000000000000000418100000000000000000000676500000000000000000001094600000000000000000001771100000000000000000002865700000000000000000004636800000000000000000007502500000000000000000012139300000000000000001E-48")))

(for-each
 (lambda (num-and-val)
   (let ((num (car num-and-val)) (val (cadr num-and-val))) (num-test-1 '/ num (/ num) val)))
 (vector (list 1 1) (list 2 1/2) (list 3 1/3) (list -1 -1) (list -2 -1/2) (list -3 -1/3) (list 9223372036854775807 1/9223372036854775807) 
	 (list 1/2 2) (list 1/3 3) (list -1/2 -2) 
	 (list -1/3 -3) (list 1/9223372036854775807 9223372036854775807) (list 1.0 1.0) (list 2.0 0.5) 
	 (list -2.0 -0.5) (list 1e+16 1e-16) (list inf.0 0.0) (list -inf.0 0.0) (list 0+1i 0-1i) 
	 (list 0+2i 0-0.5i) (list 0-1i 0+1i) (list 1+1i 0.5-0.5i) (list 1-1i 0.5+0.5i) (list -1+1i -0.5-0.5i) 
	 (list -1-1i -0.5+0.5i) (list 0.1+0.1i 5-5i) (list 1e+16+1e+16i 5e-17-5e-17i) (list 1e-16+1e-16i 5e+15-5e+15i) 
	 ))

(num-test (/ -8) -1/8)
(num-test (/ 0 2/3) 0)
(num-test (/ 1e-10 1e10) 1e-20)
(num-test (/ 4 2) 2)
(num-test (/ -9223372036854775808 -9223372036854775808) 1)
(num-test (/ -9223372036854775808 9223372036854775807) -9223372036854775808/9223372036854775807)
(num-test (/ most-positive-fixnum most-positive-fixnum) 1)
(num-test (/ (/ 1 most-positive-fixnum)) most-positive-fixnum)
(num-test (/ (/ -1 most-positive-fixnum)) (- most-positive-fixnum))
(num-test (/ (/ most-positive-fixnum) 1) 1/9223372036854775807) ; why isn't this a ratio in the non-bignum case?

(unless (or with-bignums (not (provided? 'overflow-checks)))
  (num-test (/ -1024 1/9765625 1/512 1/1953125) -1e19)
  (num-test (/ 1/19073486328125 -524288) -1e-19)
  (num-test (/ 1/19073486328125 524288) 1e-19)
  (num-test (/ 1/524288 -19073486328125) -1e-19)
  (num-test (/ 1/524288 19073486328125) 1e-19)
  (num-test (/ 1/9223372036854775807 1/3) 3.2526065174565e-19)
  (num-test (/ 1/9223372036854775807 1/9223372036854775806) 1.0)
  (num-test (/ 1/98947 2/97499 3/76847 4/61981 5/59981 6/66601) 2.6040239996689e+16)
  (num-test (/ 1/98947 2/97499 3/76847 4/61981 5/59981) 2345932343059.9)
  (num-test (/ 1/98947 2/97499 3/76847 4/61981) 464392992878593/2374728) ;195556288.07955 -- seems to fit
  (num-test (/ 1024 1/9765625 1/512 1/1953125) 1e19)
  (num-test (/ 500009/500029 500057/500041 500083/500069) 0.999900013909921)
  (num-test (/ 98947 2/97499 76847 4/61981 5/59981) 11667778186668.0)
  (num-test (/ 3037000500 1/3037000500) 9.22337203700025E18))

(when with-bignums
  (num-test (/ 1/9223372036854775807 1+1i 1-1i) 5.421010862427522170625011179760852311177E-20)
  (num-test (/ (/ 1 most-positive-fixnum) most-negative-fixnum) -1/85070591730234615856620279821087277056)
  (num-test (/ 1.0e308+1.0e308i 2.0e308+2.0e308i) (/ 1.0e307+1.0e307i 2.0e307+2.0e307i))
  (num-test (/ (+ 1.2345e-15 1 -1)) 8.1004455245038e+14)
  (num-test (/ -1.797693134862315699999999999999999999998E308 -9223372036854775808) 1.949062802279999590850112500817203908808E289)
  (num-test (/ -1/19073486328125 524288) -1/10000000000000000000)
  (num-test (/ -1/524288 19073486328125) -1/10000000000000000000)
  (num-test (/ -1024 1/9765625 1/512 1/1953125) -10000000000000000000)
  (num-test (/ -21 -1/2432902008176640000) 51090942171709440000)
  (num-test (/ -21 1/2432902008176640000) -51090942171709440000)
  (num-test (/ -2432902008176640000 -1/21) 51090942171709440000)
  (num-test (/ -2432902008176640000 1/21) -51090942171709440000)
  (num-test (/ -9223372036854775808 -9223372036854775808 -9223372036854775808) -1/9223372036854775808)
  (num-test (/ -9223372036854775808 -9223372036854775808) 1)
  (num-test (/ -9223372036854775808 9223372036854775807 -9223372036854775808) 1/9223372036854775807)
  (num-test (/ 0+1e20i 0-1e20i) -1.0)
  (num-test (/ 1 1000000000 1000000000 1000000000) 1/1000000000000000000000000000)
  (num-test (/ 1.0e20+i 1.0e20+i) 1.0)
  (num-test (/ 1/1024 9765625 -512 1953125) -1/10000000000000000000)
  (num-test (/ 1/1024 9765625 512 1953125) 1/10000000000000000000)
  (num-test (/ 1/19073486328125 524288) 1/10000000000000000000)
  (num-test (/ 1/524288 19073486328125) 1/10000000000000000000)
  (num-test (/ 1/9223372036854775807 1/3) 3/9223372036854775807)
  (num-test (/ 1/9223372036854775807 1/9223372036854775806) 9223372036854775806/9223372036854775807)
  (num-test (/ 1/98947 2/97499 3/76847 4/61981 5/59981 6/66601) 1855154611405774907304533/71241840)
  (num-test (/ 1/98947 2/97499 3/76847 4/61981 5/59981) 27854756105850886733/11873640)
  (num-test (/ 1024 1/9765625 1/512 1/1953125) 10000000000000000000)
  (num-test (/ 132120577/12 33292289/6 260046847/4) 264241154/8657554783862783)
  (num-test (/ 1e20 0+i) 0-1e20i)
  (num-test (/ 21 -1/2432902008176640000) -51090942171709440000)
  (num-test (/ 21 1/2432902008176640000) 51090942171709440000)
  (num-test (/ 2432902008176640000 -1/21) -51090942171709440000)
  (num-test (/ 2432902008176640000 1/21) 51090942171709440000)
  (num-test (/ 500009/500029 500057/500041 500083/500069) 125029751909525461/125042254395637199)
  (num-test (/ 9223372036854775807 -9223372036854775808) -9223372036854775807/9223372036854775808)
  (num-test (/ 98947 2/97499 76847 4/61981 5/59981) 35865350012435458633/3073880)
  (num-test (/ most-negative-fixnum) -1/9223372036854775808)
  (num-test (/ 10105597264942543888 14352488138967388642) 5052798632471271944/7176244069483694321)
  (num-test (/ -17631701977702695093 3931860028646338313) -17631701977702695093/3931860028646338313)
  (num-test (/ -1606495881715082381 16324360910828438638) -1606495881715082381/16324360910828438638)
  (num-test (/ -7960193178071300653 -10280747961248435844) 7960193178071300653/10280747961248435844)
  (num-test (/ -11544909483975853384 -16041992360613233027) 11544909483975853384/16041992360613233027)
  (num-test (/ -5758820541298901548 -2596462557714095861) 5758820541298901548/2596462557714095861)
  (num-test (/ -13056342734667572546 46502284983183419157350605242474199851) -13056342734667572546/46502284983183419157350605242474199851)
  (num-test (/ 12668118634717482325 -338544675918656078399121171905238525746) -12668118634717482325/338544675918656078399121171905238525746)
  (num-test (/ -16738429327795346815 164053836541028518093058940786011794219) -16738429327795346815/164053836541028518093058940786011794219)
  (num-test (/ -9884600460121235549 -53914696297933680001835530599748561584) 9884600460121235549/53914696297933680001835530599748561584)
  (num-test (/ 6753521264659576004 71759828079371803409570464915096122874) 3376760632329788002/35879914039685901704785232457548061437)
  (num-test (/ -6072478784520825268 83641961138289700975241455431547940418) -3036239392260412634/41820980569144850487620727715773970209)
  (num-test (/ -6708950756971973620 -9847903810677323447803434015107261150885944735136350527205856921771320298384705376646797569973415403097847060539915279223391112430240736564839483430569706) 3354475378485986810/4923951905338661723901717007553630575442972367568175263602928460885660149192352688323398784986707701548923530269957639611695556215120368282419741715284853)
  (num-test (/ 11263779860755455072 2292311486393743282743453705144070351222990311578446825826935237655927864700827857707370158936582804478427014131790879562565658386819339761919809732496450) 1877296643459242512/382051914398957213790575617524011725203831718596407804304489206275987977450137976284561693156097134079737835688631813260427609731136556626986634955416075)
  (num-test (/ 9956488981426387585 -12351244248621474338537656633137999145154500022264356186225225426288301330225259889671144104952158102155582320296061124840400655528634050137479515338944145) -1991297796285277517/2470248849724294867707531326627599829030900004452871237245045085257660266045051977934228820990431620431116464059212224968080131105726810027495903067788829)
  (num-test (/ -14875992781716065391 4906952781757522095285156014969507916562921709689447567404076064849249737893410245743456952512717420040816186768213920574809530298070437840356629617118643) -2125141825959437913/700993254536788870755022287852786845223274529955635366772010866407035676841915749391922421787531060005830883824030560082115647185438633977193804231016949)
  (num-test (/ 16043178952268979636 -4962728781666935768923030490263743715131420507991284894489828489607808897271220927863958149140648859077934323268424257800724618076505149638049461104621679) -5347726317422993212/1654242927222311922974343496754581238377140169330428298163276163202602965757073642621319383046882953025978107756141419266908206025501716546016487034873893)
  (num-test (/ -14889985628902581941 3075736124701105220602924325296812116294816310089906623707854625135862902005059305428034753787024827094954645083406870532379125275086885405969947540175361) -14889985628902581941/3075736124701105220602924325296812116294816310089906623707854625135862902005059305428034753787024827094954645083406870532379125275086885405969947540175361)
  (num-test (/ -1719613957783789857 19860562547348050982501313785551054055826630539673708970554435103060535649825139319625648954889488501680865494719253019921780044205805557658109807483499994523398090829033362953135186523580359552555144614353929273831853529446536288544481045105104526669277307473478898498061888931858821517694257595658138564305517447595298378933983614114298000880741350618424855028965861930329619462261269994651112266861896630584883581092431090390354633458596611690990999635499563944625720180529318327647519405136188243979680965052005899543797270970540925042201315580510136864931200059448645464256385079735225156720340173280541113382758) -1719613957783789857/19860562547348050982501313785551054055826630539673708970554435103060535649825139319625648954889488501680865494719253019921780044205805557658109807483499994523398090829033362953135186523580359552555144614353929273831853529446536288544481045105104526669277307473478898498061888931858821517694257595658138564305517447595298378933983614114298000880741350618424855028965861930329619462261269994651112266861896630584883581092431090390354633458596611690990999635499563944625720180529318327647519405136188243979680965052005899543797270970540925042201315580510136864931200059448645464256385079735225156720340173280541113382758)
  (num-test (/ -10969623867482498359 1292477254230352575769754773488799598312602810841892384475535212194939033905139960602724737178675944133847094464739764817257836826367652752931492512753561670732296265459534230949226553571982695924178928914002527460943582374603078611662312521259541641138419845784008028215876048965254023368247445173694441960256131358058174374542730502334351759171930973722361567186133851896057677818979314942434199157003833234473048838906103902832115569853657335216793235394595479328932380393044485884605451918890395812628720641212850763944658735838941829604119213195707479940053016354291972875689927240247563236506479099606571912595) -10969623867482498359/1292477254230352575769754773488799598312602810841892384475535212194939033905139960602724737178675944133847094464739764817257836826367652752931492512753561670732296265459534230949226553571982695924178928914002527460943582374603078611662312521259541641138419845784008028215876048965254023368247445173694441960256131358058174374542730502334351759171930973722361567186133851896057677818979314942434199157003833234473048838906103902832115569853657335216793235394595479328932380393044485884605451918890395812628720641212850763944658735838941829604119213195707479940053016354291972875689927240247563236506479099606571912595)
  (num-test (/ -3716891004757979686 -19452372993227550502015765258932159656814363741878583541173956168837566077148160901999018823586675966076058615847408138956450751813058209394199427182041779436168298455103717521843644244801542056954603631432685194627158423459586845252167819811850263444712218938833443253125954475476481099092216538126519474183531297423759923656571895377587989169731023397615799830371852298135015608612181670362528239430952907458704415974164085176066242388561893721949244663406941558257051263727439679525692652639731850971185056484335828001005009903973037524233097329857690857731943951449292814500362180170793919266389501882641682782987) 3716891004757979686/19452372993227550502015765258932159656814363741878583541173956168837566077148160901999018823586675966076058615847408138956450751813058209394199427182041779436168298455103717521843644244801542056954603631432685194627158423459586845252167819811850263444712218938833443253125954475476481099092216538126519474183531297423759923656571895377587989169731023397615799830371852298135015608612181670362528239430952907458704415974164085176066242388561893721949244663406941558257051263727439679525692652639731850971185056484335828001005009903973037524233097329857690857731943951449292814500362180170793919266389501882641682782987)
  (num-test (/ -4863232114852441787 -22963038454503597269981750990033903654256693514059439027985256604978917966584414065892146187253799108250061573972673983350956191446047978392921074610323648301008272837432907303975548030552369880338022067315042332692023645592417869181836251486577977896077712912433381480614752789750181208326525834629219729662085632321271870762094800588296544243340047360684854239747242066367921596241226349790282723168222543448385227922748241223520686047460119733024390425165073367321644498280127168757335614077882325524816799960018589278475564547840614315473357481582710826551932681173443524724802157570101916268510464302946527662720) 4863232114852441787/22963038454503597269981750990033903654256693514059439027985256604978917966584414065892146187253799108250061573972673983350956191446047978392921074610323648301008272837432907303975548030552369880338022067315042332692023645592417869181836251486577977896077712912433381480614752789750181208326525834629219729662085632321271870762094800588296544243340047360684854239747242066367921596241226349790282723168222543448385227922748241223520686047460119733024390425165073367321644498280127168757335614077882325524816799960018589278475564547840614315473357481582710826551932681173443524724802157570101916268510464302946527662720)
  (num-test (/ -16248276650501285553 -3381199474840825715485713565301777938368574604710714363907009216856320913536015299178065264912798511857598595067318796576494480424838898250138649774858742984769125731728430552285782315111538920026330816414650913188340281906359149109963139438960274321560117812365241840204034925444652058916966934904097509799291744775242863360284348334605170437300543978049053839829106628489146216325576991696936733592366926096500684308845306493636196092408597450926695579897293944488261001228478152650490677071497874746121221519036861983646423005753475340900508665494162949119110128646472783016552527735050067363030838015919512260159) 16248276650501285553/3381199474840825715485713565301777938368574604710714363907009216856320913536015299178065264912798511857598595067318796576494480424838898250138649774858742984769125731728430552285782315111538920026330816414650913188340281906359149109963139438960274321560117812365241840204034925444652058916966934904097509799291744775242863360284348334605170437300543978049053839829106628489146216325576991696936733592366926096500684308845306493636196092408597450926695579897293944488261001228478152650490677071497874746121221519036861983646423005753475340900508665494162949119110128646472783016552527735050067363030838015919512260159)
  (num-test (/ 18296946401228630959 3302341071702763311560113831030141639804425031433511503765833897787925467295486187687396312611805794369889470239777040624530990622212474466940548049117664906468330871893337410618797113677420975837622378808494314918471282099855916016026079371666730617071364751834080179173620476977670099126230223862266413091012344741482772771219725893630556702028108027870656512750807359335108428687238687397060104669074315031780019301768744978815422943986587389425726602444937024004102212071953113581935989741954695450085391443134273670514145585869912689150728183940456773133212037846765421397201956541430155664614978559762638030787) 494512064898071107/89252461397371981393516590027841665940660135984689500101779294534808796413391518586145846286805562009997012709183163260122459206005742553160555352678855808282927861402522632719426949018308675022638442670499846349147872489185295027460164307342344070731658506806326491329016769648045137814222438482763957110567901209229264128951884483611636667622381298050558284128400198900948876451006451010731354180245251757615676197345101215643660079567205064579073691957971270919029789515458192258971242965998775552705010579544169558662544475293781424031100761728120453327924649671534200578302755582200815017962566988101692919751)
  (num-test (/ -60488682170925814337492051725122486652 14880088785789146426) -30244341085462907168746025862561243326/7440044392894573213)
  (num-test (/ 126617729996196635247771282957911941277 -7166506344996883172) -126617729996196635247771282957911941277/7166506344996883172)
  (num-test (/ -278675896803726074870988122161067771390 7744689831802931490) -27867589680372607487098812216106777139/774468983180293149)
  (num-test (/ -283351838662873779255871649630248958879 6912311315831153835) -14913254666467041013466928927907839941/363805858727955465)
  (num-test (/ -9715584046609700027352634666499181378 3368831995960494221) -9715584046609700027352634666499181378/3368831995960494221)
  (num-test (/ -137493547985106345282009151869389470397 -1916381539906956855) 137493547985106345282009151869389470397/1916381539906956855)
  (num-test (/ -328662747577960331872949773416436800743 -231069430804205460334599495337085157308) 328662747577960331872949773416436800743/231069430804205460334599495337085157308)
  (num-test (/ 213595640581249636406536485951630735277 -48492294677143227478357598229530842959) -213595640581249636406536485951630735277/48492294677143227478357598229530842959)
  (num-test (/ 85922846498729014445816145204889624189 193533957681757355413031965695625196813) 85922846498729014445816145204889624189/193533957681757355413031965695625196813)
  (num-test (/ 24053342958857142686054803491202486471 196417511107100936775397820630955772553) 24053342958857142686054803491202486471/196417511107100936775397820630955772553)
  (num-test (/ 102038936612518756467074084117019701214 -111946989731587760700903475996379168167) -102038936612518756467074084117019701214/111946989731587760700903475996379168167)
  (num-test (/ -3006867214208872584699983438179656913 -234257597822744479264249663225224173340) 3006867214208872584699983438179656913/234257597822744479264249663225224173340)
  (num-test (/ -279839802710533516603863620922251878907 -3244112647743502769852782626803305310331045534071805654982307107362388474314396636799597033636575215617240554815450017779373048313695795886893032630263219) 279839802710533516603863620922251878907/3244112647743502769852782626803305310331045534071805654982307107362388474314396636799597033636575215617240554815450017779373048313695795886893032630263219)
  (num-test (/ 123635964546481689465778244982425098404 7701433613491146708866098469269971554817017737111287276993583150548359764165526640986060909954451793171933304569726872785964805121981749276421956645830854) 61817982273240844732889122491212549202/3850716806745573354433049234634985777408508868555643638496791575274179882082763320493030454977225896585966652284863436392982402560990874638210978322915427)
  (num-test (/ 166158110049010486343321316578688184578 4093720847216792748840371965199135052196058344862447621818024731938681519017878880275303125899149558774718190527651555811733139227128378041055212888819294) 83079055024505243171660658289344092289/2046860423608396374420185982599567526098029172431223810909012365969340759508939440137651562949574779387359095263825777905866569613564189020527606444409647)
  (num-test (/ 147416259636838312272435267341375281181 -11266711292262839805944890501811605204323255169233519804446548849178247889563130015168799346120099052214488209897402054530713234143622703174309015777885801) -147416259636838312272435267341375281181/11266711292262839805944890501811605204323255169233519804446548849178247889563130015168799346120099052214488209897402054530713234143622703174309015777885801)
  (num-test (/ 102557200511608632541115941654031896919 3866177549962722728707550488877109233779215384377007088712280650225992470307822792085413087509167847767889824884877044539352696974351192629898363157976511) 102557200511608632541115941654031896919/3866177549962722728707550488877109233779215384377007088712280650225992470307822792085413087509167847767889824884877044539352696974351192629898363157976511)
  (num-test (/ 47794953079190110032282671989549362415 3802290983508829335098916118339496411537222492645529399519373082799614656011270200284796148989094312601047370399228868583158444769807910513767845541589667) 47794953079190110032282671989549362415/3802290983508829335098916118339496411537222492645529399519373082799614656011270200284796148989094312601047370399228868583158444769807910513767845541589667)
  (num-test (/ -169956065319483471022234920202991103615 -9934427489865644196610501807375648335352544234206717324511161205173460054921759084767897792996557220898467288533128078406604709773449948420404563411793533441010236017064154469575084055359823982786110746700747423674942932421964955746280671982635899487781780756099620799397239156211815110739544719746684712086075069101799537802834839550142629064374734870047412916259754010150500874430055034366305216104752636211802195447299210332237598443674867760860326529472901775427058078447963316168327741049511844237329137194533000697525539835371015163158135757326482343130221118201740819963770851200676279882978581431999960842565) 33991213063896694204446984040598220723/1986885497973128839322100361475129667070508846841343464902232241034692010984351816953579558599311444179693457706625615681320941954689989684080912682358706688202047203412830893915016811071964796557222149340149484734988586484392991149256134396527179897556356151219924159879447831242363022147908943949336942417215013820359907560566967910028525812874946974009482583251950802030100174886011006873261043220950527242360439089459842066447519688734973552172065305894580355085411615689592663233665548209902368847465827438906600139505107967074203032631627151465296468626044223640348163992754170240135255976595716286399992168513)
  (num-test (/ -83006311763073652927964071041666508273 13480787677843057038436344704360462056114592749322481662307876594244244638227291805757775026215166740035048814729231681821563443093991755779505400592913963236010573873554317250153995160235771659208137440518282824497744092608999871327127239673370293239927529076145825972430101380272357235582367639159280348164804218713823424182167974242317526959809443701996053548231667727254858428867000011055354779789221097183515832386890638024105232865079002765479933320220378271026425568216748186200736499581088153390350474814123049637951929317200314355414551809067125550551841102097159644340520444983020267926123546444838010089690) -83006311763073652927964071041666508273/13480787677843057038436344704360462056114592749322481662307876594244244638227291805757775026215166740035048814729231681821563443093991755779505400592913963236010573873554317250153995160235771659208137440518282824497744092608999871327127239673370293239927529076145825972430101380272357235582367639159280348164804218713823424182167974242317526959809443701996053548231667727254858428867000011055354779789221097183515832386890638024105232865079002765479933320220378271026425568216748186200736499581088153390350474814123049637951929317200314355414551809067125550551841102097159644340520444983020267926123546444838010089690)
  (num-test (/ -312626207169475064151212222217866488926 6989069923898656093413456232544365450599471748502878018530391549015151484336014906416216966193568842618920902504390187814247729346977677905224098932673981665869061845335443588666641982676550205160521286690015544764015602751932938178737949961754714143180917985455875095030469699198116593730005119922928175789172042067281849364217595912265452199938281052984802042194034638773435768458457616208103331213440768472281882976004050012769415198321241810008696147179275528426468408383757692656341606162350211696837361434874035354680073309142183699892959618671515841112321607728427286289324836870027735590091451421689980776552) -52104367861579177358535370369644414821/1164844987316442682235576038757394241766578624750479669755065258169191914056002484402702827698928140436486817084065031302374621557829612984204016488778996944311510307555907264777773663779425034193420214448335924127335933791988823029789658326959119023863486330909312515838411616533019432288334186653821362631528673677880308227369599318710908699989713508830800340365672439795572628076409602701350555202240128078713647162667341668794902533053540301668116024529879254737744734730626282109390267693725035282806226905812339225780012218190363949982159936445252640185386934621404547714887472811671289265015241903614996796092)
  (num-test (/ -151709660794612786408772973806200383563 -26960472721919005254400858042130056790831511338891584787669209989714807518625849812230185079206081782191501696661436514815190623849929065098497737155759771863508038766934134444191240792356114381746781342181881402424707118515655119761011977116554236461222788625158348668147995099157685699761135150772589445239536582228655532345059046596356954495360132444243748421428095867292294626357084961338288369883088525401649234025290736504802104065029036642533076183281468647642956623788270236516849523210698622687255735945678505925047193818483603361307498423724202227256505312543145618362906047473400380196192622607541097732443) 151709660794612786408772973806200383563/26960472721919005254400858042130056790831511338891584787669209989714807518625849812230185079206081782191501696661436514815190623849929065098497737155759771863508038766934134444191240792356114381746781342181881402424707118515655119761011977116554236461222788625158348668147995099157685699761135150772589445239536582228655532345059046596356954495360132444243748421428095867292294626357084961338288369883088525401649234025290736504802104065029036642533076183281468647642956623788270236516849523210698622687255735945678505925047193818483603361307498423724202227256505312543145618362906047473400380196192622607541097732443)
  (num-test (/ 138834496986391136939574372853300933725 -8052690543272184576133758511645801940246473546142520821850130421981395129853341888352999304040698251945886555605291324954368612109314080471658982022831338507499254609048475429862437003158379101603576571787302167207044118847876475134352180874260998595377014195145760071923429129767580115085764485254455919915567128572731355497418831212259648020550107573824886521471697331410754043280744066090848295906051303624846301488010249980896364883452154860562864255354208802313850527991005497484253401461375477060954782095047043919500670383372218536999834862885439984085848342867301834247551832677237328664699302165347765799113) -15426055220710126326619374761477881525/894743393696909397348195390182866882249608171793613424650014491331266125539260209816999922671188694660654061733921258328263179123257120052406553558092370945277694956560941714429159667017597677955952952420811351911893790983097386126039131208251222066153001577238417785769269903307508901676196053917161768879507458730303483944157647912473294224505567508202765169052410814601194893697860451787872032878450144847205144609778916664544040542605794984506984917261578755812650058665667277498250377940152830784550531343894115991055630042596913170777759429209493331565094260318589092694172425853026369851633255796149751755457)
  (num-test (/ 276499207940187081393841843387608369874 27347897028734618663428054896349668572244941195143856840032842195489553215406302254043947382368793914074147314353589439281000471813879502242851166670252197853998033813694814376228360691543987661407996785043637351295817024680721181205269262470473172181965930243852520386958529041036476807810647578694133804796395977642274699322030062940721165202488695975750512485574440928370802874677938542169620505668128224812441566912043326338714451629730522324228356364241376445033028898865300103247057378058702233150414643818049655628999871012383236520330575609745427181485617250755214922048672375947942288446974485524776744246517) 8919329288393131657865865915729302254/882190226733374795594453383753215115233707780488511510968801361144824297271171040453030560721573997228198300463019014170354853929479983943317779570008135414645097864957897237942850344888515731013161186614310882299865065312281328425976427821628166844579546136898468399579307388420531509929375728344972058219238579923944345139420324610991005329112538579862919757599175513818412995957352856199020016311875104026207792481033655688345627471926791042717043753685205691775258996737590325911195399292216201069368214316711279213838705516528491500655825019669207328435019911314684352324150721804772331885386273726605701427307)
  (num-test (/ -8979365591106781219797187096315899769868799444656824967426553299158070014074001230883484015880186603742048949313393413640240595706939311540002219411120389 -1698360947072008877) 1282766513015254459971026728045128538552685634950974995346650471308295716296285890126212002268598086248864135616199059091462942243848473077143174201588627/242622992438858411)
  (num-test (/ -12831814656788829919185319784994714617782749504716966706877579983082880759985031662545957372565411439648298939198657738497464024214657609856476819270030801 454910754379715) -273017333123166594025219569893504566335803180951424823550586808150699590637979397075445901543944924247836147642524632733988596259886332124605889771702783/9678952220845)
  (num-test (/ -7834266257250691217409788323211914445703052638619784568844628449769010091330019095736167988675873769434766592786720961949649685040028101508217441360672222 -428418418877192732) 3917133128625345608704894161605957222851526319309892284422314224884505045665009547868083994337936884717383296393360480974824842520014050754108720680336111/214209209438596366)
  (num-test (/ 5737805823029931079838944835405107564434908634489801628049345331760087020955028323378020396677249341204498685189403657652738071833877470777083253103936452 9588993061977446661) 5737805823029931079838944835405107564434908634489801628049345331760087020955028323378020396677249341204498685189403657652738071833877470777083253103936452/9588993061977446661)
  (num-test (/ -4001605821592542867351046644170905984672346731784670159062281252096012802838642896466582343641124674682428297533953704119505640938363392225910275838094045 15760991890495426717) -4001605821592542867351046644170905984672346731784670159062281252096012802838642896466582343641124674682428297533953704119505640938363392225910275838094045/15760991890495426717)
  (num-test (/ 2876630161532936743269451364955814480771395635620140205538288339793482694260173239474830738010159518887660000673207712630507802368373928478641773477534499 -6788234478844960330) -2876630161532936743269451364955814480771395635620140205538288339793482694260173239474830738010159518887660000673207712630507802368373928478641773477534499/6788234478844960330)
  (num-test (/ 6230070442453337264527950102774203962152836811174649694700041895216739851602598854067104967963392074425258687296947909484969927078206601660837276754799333 190237375887614033974333796608341639595) 6230070442453337264527950102774203962152836811174649694700041895216739851602598854067104967963392074425258687296947909484969927078206601660837276754799333/190237375887614033974333796608341639595)
  (num-test (/ -12098771374444180013224380531550204930654718468097503123335711776524055419889032578894177605164827523969169377266342179411916625188550162928371789854647472 -41681385674896602840749705069663453185) 12098771374444180013224380531550204930654718468097503123335711776524055419889032578894177605164827523969169377266342179411916625188550162928371789854647472/41681385674896602840749705069663453185)
  (num-test (/ 13185465843955116174925558412278612918939024395488172088108029202384613698982949554556435640011161663974075894844304583900497170806796813871943782330552768 -155202352609947911537719051033334010254) -6592732921977558087462779206139306459469512197744086044054014601192306849491474777278217820005580831987037947422152291950248585403398406935971891165276384/77601176304973955768859525516667005127)
  (num-test (/ 12784980722915659825738808684740823452025110516624579136271791852138148426775553817114893299569867520414470532361018804123866264934222335562072872489963044 -249441012384365373362771955533424187237) -12784980722915659825738808684740823452025110516624579136271791852138148426775553817114893299569867520414470532361018804123866264934222335562072872489963044/249441012384365373362771955533424187237)
  (num-test (/ 8517839393030302736298983538193047531846908718502576675615969705563208303329257882565359266876007571790337440612227785062203468682754778416335180236967433 -23101645464137481399279134347982485126) -8517839393030302736298983538193047531846908718502576675615969705563208303329257882565359266876007571790337440612227785062203468682754778416335180236967433/23101645464137481399279134347982485126)
  (num-test (/ -10157767522292361462005308817460390811646115952647174687477824271227382383351453540195549992670001314693794150879368708343715654899952822395459036505947192 -25611473771508763579433379623726126173) 10157767522292361462005308817460390811646115952647174687477824271227382383351453540195549992670001314693794150879368708343715654899952822395459036505947192/25611473771508763579433379623726126173)
  (num-test (/ -8580252632668820290302987230726290672170301642399871646484841866604753910447257372311950907045477729554307803379310475132687855999835211879267570997069974 5347050029330174629945013741349819215851040371727058829687387719215168997632386672310746837193930669173408831178932364105722911104309540550576485594530627) -8580252632668820290302987230726290672170301642399871646484841866604753910447257372311950907045477729554307803379310475132687855999835211879267570997069974/5347050029330174629945013741349819215851040371727058829687387719215168997632386672310746837193930669173408831178932364105722911104309540550576485594530627)
  (num-test (/ 7706102251141221799524762336156378964168657337573751909064577951085535246905735244239132983582998872001001594454632956803416956154262109939446710205558308 6334400709835247308796432875490978646658012545184955441452799118298109610816693049400832749087993843490999852355789914065232784070007399786089389453289854) 3853051125570610899762381168078189482084328668786875954532288975542767623452867622119566491791499436000500797227316478401708478077131054969723355102779154/3167200354917623654398216437745489323329006272592477720726399559149054805408346524700416374543996921745499926177894957032616392035003699893044694726644927)
  (num-test (/ 12609622044672092190084693450911157599596799695538449568681964257744962273690941575572590166273187189250007688411096790312605666562908125521094386992971478 -8237858212652788898158635047388584411011830102060269605835391741772914864422465141467281143809161251942948659243584296367296559912373856433388249393853968) -6304811022336046095042346725455578799798399847769224784340982128872481136845470787786295083136593594625003844205548395156302833281454062760547193496485739/4118929106326394449079317523694292205505915051030134802917695870886457432211232570733640571904580625971474329621792148183648279956186928216694124696926984)
  (num-test (/ -9988492519236282081446302885464711911055350309732728352574982611126604133339499170845224383282665522673248920309221355720665956477799939031063172954469785 -1878204914631111607000020160429571305542722711529281855381736226230242796648854769713662269068364131804626863789957256573308715572826753755672493154125086) 9988492519236282081446302885464711911055350309732728352574982611126604133339499170845224383282665522673248920309221355720665956477799939031063172954469785/1878204914631111607000020160429571305542722711529281855381736226230242796648854769713662269068364131804626863789957256573308715572826753755672493154125086)
  (num-test (/ -10729942326579120947061030583094707809945059776287551713953926998992375520903658867971835616518813070294302895655369081976222497359056962112544408591462495 -4917625712783289245414023733273041940212797202855299465496072729329693853584860839801663152618595377553772371725021213143455497822882736730281253858119747) 10729942326579120947061030583094707809945059776287551713953926998992375520903658867971835616518813070294302895655369081976222497359056962112544408591462495/4917625712783289245414023733273041940212797202855299465496072729329693853584860839801663152618595377553772371725021213143455497822882736730281253858119747)
  (num-test (/ 8114113595157517238445304590338354472776364877475201453112450680537221171989478096363668912966343706408770932684807802285529572133696646343108263717309148 5443953102973235688784499815692116502566847594605098596244123647428188581304528525010862185203718640610834003873728718183528722470626702382993497913086105) 8114113595157517238445304590338354472776364877475201453112450680537221171989478096363668912966343706408770932684807802285529572133696646343108263717309148/5443953102973235688784499815692116502566847594605098596244123647428188581304528525010862185203718640610834003873728718183528722470626702382993497913086105)
  (num-test (/ -7125100205152691887479515774712530950031072786448635736036405923401522078562323494262148946679985384635556474075282302608446439950458673260234175964199684 -23871420315894180764743988478670341498770583257649869670486332228804693253344466615199983955886679924409910043885402198203427975742868174334723967563526738510726448815413356678504144193747696164586135745786501041060322480940451156015256191962506052700295351077719851275026974629635679531161390660244641370183176979934485671396035404817388717005746812037357500295693454623478902942336087760288091719793968445716246099043828787040340339906538864570506773535078524092440112404847904632624419421052178754041718790915772437556681684830937503838434712179830722395832238257078212535157309743054115702650740005055678387806081) 7125100205152691887479515774712530950031072786448635736036405923401522078562323494262148946679985384635556474075282302608446439950458673260234175964199684/23871420315894180764743988478670341498770583257649869670486332228804693253344466615199983955886679924409910043885402198203427975742868174334723967563526738510726448815413356678504144193747696164586135745786501041060322480940451156015256191962506052700295351077719851275026974629635679531161390660244641370183176979934485671396035404817388717005746812037357500295693454623478902942336087760288091719793968445716246099043828787040340339906538864570506773535078524092440112404847904632624419421052178754041718790915772437556681684830937503838434712179830722395832238257078212535157309743054115702650740005055678387806081)
  (num-test (/ 4801495919363827077158204249631885157347198552733998896638174958434968555935827788499392382851493568264006507028024783408190862186734863708684652212703744 29234959990138609668202089052356468732793041824333219340488007351402997202222578434579705387840772390513345507274006495462445058795870182760749392281528881636623188890883479914921272700981309656920982410970774047916714087713562927554033500521877735827036675598267184309367127514966388636440710253467328441763131873309183205727440365838789320851968108312559316922678357314418486932673434031479515016224407618177089903730349114511598373251388750023508633761000320088841886505077453257141723747388913336375142897897501529451618927178835485127020789481918641637409265186365292847057986276062625965612268181771076051892980) 1200373979840956769289551062407971289336799638183499724159543739608742138983956947124848095712873392066001626757006195852047715546683715927171163053175936/7308739997534652417050522263089117183198260456083304835122001837850749300555644608644926346960193097628336376818501623865611264698967545690187348070382220409155797222720869978730318175245327414230245602742693511979178521928390731888508375130469433956759168899566796077341781878741597159110177563366832110440782968327295801431860091459697330212992027078139829230669589328604621733168358507869878754056101904544272475932587278627899593312847187505877158440250080022210471626269363314285430936847228334093785724474375382362904731794708871281755197370479660409352316296591323211764496569015656491403067045442769012973245)
  (num-test (/ 10769619761532897875307527770350128978615798426116103116325434914975512103385205123955114305107607195469345895102375220593168903042839441996791318999499708 -7224105715967976893083374742254251507019823877014718307738328810406361200631626366722837314776666720638271529652546975342143108973422364041422652163016078890272393678677152791565494865444430757858556891645947268886646732022748338160528677218733159766121781240328812893374941548395710123982510227501927393735585082736583984561348450061452997663109932611188779299623613963995350679177776686423432406091192517292522853783968685873925548901506191291253596763183277703635837071862492572256145656312023955675669362656148946145528559574994353884313568526553663370513565393821926602014407548325293145102073923450066319746913) -10769619761532897875307527770350128978615798426116103116325434914975512103385205123955114305107607195469345895102375220593168903042839441996791318999499708/7224105715967976893083374742254251507019823877014718307738328810406361200631626366722837314776666720638271529652546975342143108973422364041422652163016078890272393678677152791565494865444430757858556891645947268886646732022748338160528677218733159766121781240328812893374941548395710123982510227501927393735585082736583984561348450061452997663109932611188779299623613963995350679177776686423432406091192517292522853783968685873925548901506191291253596763183277703635837071862492572256145656312023955675669362656148946145528559574994353884313568526553663370513565393821926602014407548325293145102073923450066319746913)
  (num-test (/ 1505915608160301518246681692927442986955390537144107830770082927276722640395785957392652130911646706470337068266772174699405268120590454296080828168261019 31152879253507543898583880698200027990847289346701738353567402100527465991154555548630544962150902011282973749886327325250084401181379196961322399337408341296727915922288276602390334861175305055229766353672502691855637668618950047400571070157436221479289152631256433294884836727331457389922838951144187501751190662594278336543502171639899940796536926507796271202659224890656712231014450702948847764643603683153113663072089256293587951842007583210791100743318865647555912543508324790181772321217524164822106191538518498016236866957803105254555578252294418243701672226181762763332992886540089416888889135117147250495261) 1505915608160301518246681692927442986955390537144107830770082927276722640395785957392652130911646706470337068266772174699405268120590454296080828168261019/31152879253507543898583880698200027990847289346701738353567402100527465991154555548630544962150902011282973749886327325250084401181379196961322399337408341296727915922288276602390334861175305055229766353672502691855637668618950047400571070157436221479289152631256433294884836727331457389922838951144187501751190662594278336543502171639899940796536926507796271202659224890656712231014450702948847764643603683153113663072089256293587951842007583210791100743318865647555912543508324790181772321217524164822106191538518498016236866957803105254555578252294418243701672226181762763332992886540089416888889135117147250495261)
  (num-test (/ -4912349668310730778272626761660101328812783790262451913449395750351147048676353891314609774894027305081515542385381430403698808605768281804457186380542764 6582102431028556562269167182029950958541569095123705594954788174046339660437206159173417583841743892857066740116322758515837624700881569925244230209567223461401193316695082415261197843574563450002486582967745135870782254839990479649574452750850133306720341823136645982650022199634379361313745598455049448887744206616434903460504591098363901961758069797933831934878649993183747273660007900662110776570580293994733189753806312784239743585453090900671308673380802381312083077891736513388250097195232616017027333586286786139736783210630705878401429301217589001317082952461701571026008195534878902572422952568763551674434) -2456174834155365389136313380830050664406391895131225956724697875175573524338176945657304887447013652540757771192690715201849404302884140902228593190271382/3291051215514278281134583591014975479270784547561852797477394087023169830218603079586708791920871946428533370058161379257918812350440784962622115104783611730700596658347541207630598921787281725001243291483872567935391127419995239824787226375425066653360170911568322991325011099817189680656872799227524724443872103308217451730252295549181950980879034898966915967439324996591873636830003950331055388285290146997366594876903156392119871792726545450335654336690401190656041538945868256694125048597616308008513666793143393069868391605315352939200714650608794500658541476230850785513004097767439451286211476284381775837217)
  (num-test (/ -11503235648135220410087372678575470255397243144180272745183844970864347348074104828328211521698012119761674096067066173927209129755062269068090560678650614 -5548338218081690289723998288742945948643693817491921699797822887914665364835947234564530865119623677435878746610856459141463506776423054050179729345956931675338102809929977610828639446535095411122377961067651902947030310564736893080382424590568134091858634304377553326990788802662029347894499019277621467098333287442862683493159356014650672092060912274570436879076161496563079759704321556494898013269338428360856068237785049960484767969682269790642298701577934519452927652996671267126348627432295779183359417597868330923329974640383630473044712419371517153268338860560601603043892503067815822312755611206254762903436) 5751617824067610205043686339287735127698621572090136372591922485432173674037052414164105760849006059880837048033533086963604564877531134534045280339325307/2774169109040845144861999144371472974321846908745960849898911443957332682417973617282265432559811838717939373305428229570731753388211527025089864672978465837669051404964988805414319723267547705561188980533825951473515155282368446540191212295284067045929317152188776663495394401331014673947249509638810733549166643721431341746579678007325336046030456137285218439538080748281539879852160778247449006634669214180428034118892524980242383984841134895321149350788967259726463826498335633563174313716147889591679708798934165461664987320191815236522356209685758576634169430280300801521946251533907911156377805603127381451718)
  (num-test (/ -22964048032108117904633365483799091488990853392670636861794813863757795874434768543212887316456319246155824842161717179767513360050328383696194174741889496306018655333450647372293193335577883672679165775070112770359697627614883420620410888137853011387271594559450892054491963940112235887802995117234918878648066362268919389271696465517050425727202664230530633207566444357393843669758809938086228366322548799235049875711702216182219182908217345405023677260470015666831191434586902791186444958476491096759363292487221288620810273243009200212776634572092195691654105986099646006756823055390654876878195583529521482548988 10644501761877612307) -22964048032108117904633365483799091488990853392670636861794813863757795874434768543212887316456319246155824842161717179767513360050328383696194174741889496306018655333450647372293193335577883672679165775070112770359697627614883420620410888137853011387271594559450892054491963940112235887802995117234918878648066362268919389271696465517050425727202664230530633207566444357393843669758809938086228366322548799235049875711702216182219182908217345405023677260470015666831191434586902791186444958476491096759363292487221288620810273243009200212776634572092195691654105986099646006756823055390654876878195583529521482548988/10644501761877612307)
  (num-test (/ -19058897134776675884737764093896349427183484738023061956638485191239529906311503740032626797095131123523175909943402828257449376045336777553758951620699386266853663342003969442142858702229701661125904623724248177901462857013835790939020450746503125344631958534655024089231193396521561965297735217497608287565163852923704017958259400904834287026933197193592591423799328167149965328232560408884408251535373934831244856695227539243433290481951528897142697352526450162440279318507285454432916819060795455956931254810171588139618689138022062041222735056137988435900866680084665165131313435515187611756148824388549448126467 -8326067459929079652) 19058897134776675884737764093896349427183484738023061956638485191239529906311503740032626797095131123523175909943402828257449376045336777553758951620699386266853663342003969442142858702229701661125904623724248177901462857013835790939020450746503125344631958534655024089231193396521561965297735217497608287565163852923704017958259400904834287026933197193592591423799328167149965328232560408884408251535373934831244856695227539243433290481951528897142697352526450162440279318507285454432916819060795455956931254810171588139618689138022062041222735056137988435900866680084665165131313435515187611756148824388549448126467/8326067459929079652)
  (num-test (/ 25828007361450952719858846443651616751980622231808382804245407702688699228397920589229449608543284896555585501243582045708656531815385828908740757435341854996277769645696261182122648194952548457487178342682313459444433667556195761154944956714756269417591048771194019245925463541886773351873002480266654825771525233808830260734678788520487541379982691221386179066818743751876186761036101255542680066874888848011074569355779905086056095043888696435054884292698783753890317487209955316141370052511469715869816445031102161253514609763532756500340262263800747279044587806090353812452308490155782240390040070679663451429071 -16419739031141199968) -25828007361450952719858846443651616751980622231808382804245407702688699228397920589229449608543284896555585501243582045708656531815385828908740757435341854996277769645696261182122648194952548457487178342682313459444433667556195761154944956714756269417591048771194019245925463541886773351873002480266654825771525233808830260734678788520487541379982691221386179066818743751876186761036101255542680066874888848011074569355779905086056095043888696435054884292698783753890317487209955316141370052511469715869816445031102161253514609763532756500340262263800747279044587806090353812452308490155782240390040070679663451429071/16419739031141199968)
  (num-test (/ -1669696848499325185991294008037906453080648048592518700324899343297324898656645662186964240087582483813312797482298159224575128489696846451225871663856944749639170892311973606684486632224811435175199158920841554176114937196187087530038509898368755036744105403511353564606301040888877621412514452110348953863172547944175251415725815533087344857665837809749724257466399374547882097484009980477192931829030533366309859182367479867549644502538060694266048652224732348150866071381652452605392696555259221463464108413747443898588713629829490175098280805280460168541344102200890646453100478450456898359263676257882174308268 -3154577849943484396) 417424212124831296497823502009476613270162012148129675081224835824331224664161415546741060021895620953328199370574539806143782122424211612806467915964236187409792723077993401671121658056202858793799789730210388544028734299046771882509627474592188759186026350877838391151575260222219405353128613027587238465793136986043812853931453883271836214416459452437431064366599843636970524371002495119298232957257633341577464795591869966887411125634515173566512163056183087037716517845413113151348174138814805365866027103436860974647178407457372543774570201320115042135336025550222661613275119612614224589815919064470543577067/788644462485871099)
  (num-test (/ -2215504974719141921873290809898041836016933916943403987778356628123168736190963062169230280020568365292362281642280014010817115943641228422541948070912910166283758843455538187697141038676028739959626556519808411324617157646799936128314485433146912658200236754847332237438334421065771940922444296618134121662770699950019164632463150784605652351782139277998735272280336096528241168196650073301607171613955878761317417480490869592669781417658461696905996344800864447403426286476662235990122025654999230690604488053668524888833992415515434190712628587043474760836969696399229242018051635699746048823240033842587927229964 -11305319675542865070) 1107752487359570960936645404949020918008466958471701993889178314061584368095481531084615140010284182646181140821140007005408557971820614211270974035456455083141879421727769093848570519338014369979813278259904205662308578823399968064157242716573456329100118377423666118719167210532885970461222148309067060831385349975009582316231575392302826175891069638999367636140168048264120584098325036650803585806977939380658708740245434796334890708829230848452998172400432223701713143238331117995061012827499615345302244026834262444416996207757717095356314293521737380418484848199614621009025817849873024411620016921293963614982/5652659837771432535)
  (num-test (/ 24358677073350645219370308521851912760304925518671532565724702185818845784332554892130070740233218685874351979772556877899278790031132507391155876157108663291716896413773711734271947599485714147026138105714458778787734198938526335256418673319464023475137997251085298903419563039860433435847755093653670989129405749785476487449599232956305952768800154351414655365461746574761818724131185410194605648466196476174400166047788352670171627261342369793028465418799251589432585363577887467959594667618177199696618852093807640490831859585621198048572586882398004957371434677752931134884039120875470266936204172511104679441462 8754800987327220648) 12179338536675322609685154260925956380152462759335766282862351092909422892166277446065035370116609342937175989886278438949639395015566253695577938078554331645858448206886855867135973799742857073513069052857229389393867099469263167628209336659732011737568998625542649451709781519930216717923877546826835494564702874892738243724799616478152976384400077175707327682730873287380909362065592705097302824233098238087200083023894176335085813630671184896514232709399625794716292681788943733979797333809088599848309426046903820245415929792810599024286293441199002478685717338876465567442019560437735133468102086255552339720731/4377400493663610324)
  (num-test (/ -26302114071841994464108666310942614602208671348774320769941579409198660404735714925432808094014718434192516800374483192192707032773903982752997957629389083405320034044554226640590549491188742685901503166669355807243735533977994184111229208270447279559478659750835531593667003322059717930484363943660175452777363121025595100592911646539549735930625865256846706785601753749996181113742254145758187876411260965175520035400453360390392991183382425735199046574346992179663247011131958270717402007532256308394559029768974932620173103778338779940189812875680687510582798628982957687329572431433891809534332514765287899172737 196971971351558855568201373145365478995) -26302114071841994464108666310942614602208671348774320769941579409198660404735714925432808094014718434192516800374483192192707032773903982752997957629389083405320034044554226640590549491188742685901503166669355807243735533977994184111229208270447279559478659750835531593667003322059717930484363943660175452777363121025595100592911646539549735930625865256846706785601753749996181113742254145758187876411260965175520035400453360390392991183382425735199046574346992179663247011131958270717402007532256308394559029768974932620173103778338779940189812875680687510582798628982957687329572431433891809534332514765287899172737/196971971351558855568201373145365478995)
  (num-test (/ -25700334917103749626396366612061842558162882395534131493737229591609654899446089376271023701490708870843231350129849819430092002268875830384992877382393956173037794109904701961390126146975281052960293513473777226100954163054292968509501976296424278813632162404905591038465215586347229260479401862039805429711982871702185657527199220459658257385112793877259572278229045135617281858788415643567614198333459934599272409406206213115625226065750113120833933806486512117533453281522448845990642550827848765145774541658722594353290694745164913189694785762218575339370800538946514325662656804799046877175035545715523049884960 56325873113907570153638933263921340484) -6425083729275937406599091653015460639540720598883532873434307397902413724861522344067755925372677217710807837532462454857523000567218957596248219345598489043259448527476175490347531536743820263240073378368444306525238540763573242127375494074106069703408040601226397759616303896586807315119850465509951357427995717925546414381799805114914564346278198469314893069557261283904320464697103910891903549583364983649818102351551553278906306516437528280208483451621628029383363320380612211497660637706962191286443635414680648588322673686291228297423696440554643834842700134736628581415664201199761719293758886428880762471240/14081468278476892538409733315980335121)
  (num-test (/ -25716495567761925495340309269248196976121711927176026606462843116646034561721958499564011513233986043633061335866265799467020807570689498961190839877265773450484494789052182300993137822542881883769593344810286970036960228835955266304979090841345697560418139960733748874044680214388098802745248923989851173047158103142988835055585349795022662576576434371181693607267864646932929998659458265265400181839509356921460222604661909947838434113964465769102604033848276159366897885013231683417270877512514679528402888899725431524867260144325739317224922955028035417867933390409466302057857579158202739536568407090965929352402 -92089830031261826185903006947297196357) 25716495567761925495340309269248196976121711927176026606462843116646034561721958499564011513233986043633061335866265799467020807570689498961190839877265773450484494789052182300993137822542881883769593344810286970036960228835955266304979090841345697560418139960733748874044680214388098802745248923989851173047158103142988835055585349795022662576576434371181693607267864646932929998659458265265400181839509356921460222604661909947838434113964465769102604033848276159366897885013231683417270877512514679528402888899725431524867260144325739317224922955028035417867933390409466302057857579158202739536568407090965929352402/92089830031261826185903006947297196357)
  (num-test (/ 6427758281007308443295844679532867042370757542760390680622584758338041709910068192973790897624827722686313216884084305612889554116246627679267186323854642904894988936981064543865794245002470271142875081223308666588659587718561791667575945670118263124267218395749059879636505504607358472659126298770422135028955713148882314050530771750859372048576074912599265823577267962213046012777760882389021047579367276198483178024744924299929585515193595330026399302022065656106472153858484998010254767462854235008343139218888170221421046454280858208068658907389288543063912721882521711363713136166478126504226820360347652405439 80854661163518168674595213426641201760) 6427758281007308443295844679532867042370757542760390680622584758338041709910068192973790897624827722686313216884084305612889554116246627679267186323854642904894988936981064543865794245002470271142875081223308666588659587718561791667575945670118263124267218395749059879636505504607358472659126298770422135028955713148882314050530771750859372048576074912599265823577267962213046012777760882389021047579367276198483178024744924299929585515193595330026399302022065656106472153858484998010254767462854235008343139218888170221421046454280858208068658907389288543063912721882521711363713136166478126504226820360347652405439/80854661163518168674595213426641201760)
  (num-test (/ 1960728263483597985471065015024594804771170333646104429205729831998416939777820080209106943861368202560376682136488253096512360698625765514606930980274938979705620987031595592685578710084284618125325617453699875318678007463857705931376750632972266553809944621631324385690517092215690694024807784270742388108802858889381036105223858467345514041786882957807868961085072340965930749117411726729713477739990680381647988935514765113077094375924848051541167125595015542791382355149166582367766443782842193396221676952668624805183924877889696428989259842153378327156342464279071638070457876940165186524833987190050817072048 91266493124541431873557009470479491083) 1960728263483597985471065015024594804771170333646104429205729831998416939777820080209106943861368202560376682136488253096512360698625765514606930980274938979705620987031595592685578710084284618125325617453699875318678007463857705931376750632972266553809944621631324385690517092215690694024807784270742388108802858889381036105223858467345514041786882957807868961085072340965930749117411726729713477739990680381647988935514765113077094375924848051541167125595015542791382355149166582367766443782842193396221676952668624805183924877889696428989259842153378327156342464279071638070457876940165186524833987190050817072048/91266493124541431873557009470479491083)
  (num-test (/ 4941680418946960910262990974014623728051861920391294141439502190044830922127013115391726343950340163023958511659132792063033185693862678433421115681422259770928656196358763089894449447854011668445981430826871764812047994423858851467292757304285634515474652989618200442851239459073981986390515468331839802701176644729973346052528164203299481240263263697394061787580128379398464090163611942724580936445878570184925290925246112514015572149640886198984723311273144361235138411362294735799814160816806773736605477503201836095726740734281001021071803299510239436683913500734680524381145064985356627091311888606290704759943 291575320383555320391938911470370670502) 1647226806315653636754330324671541242683953973463764713813167396681610307375671038463908781316780054341319503886377597354344395231287559477807038560474086590309552065452921029964816482618003889481993810275623921604015998141286283822430919101428544838491550996539400147617079819691327328796838489443946600900392214909991115350842721401099827080087754565798020595860042793132821363387870647574860312148626190061641763641748704171338524049880295399661574437091048120411712803787431578599938053605602257912201825834400612031908913578093667007023934433170079812227971166911560174793715021661785542363770629535430234919981/97191773461185106797312970490123556834)
  (num-test (/ -17803449239532304707372697093467431202778585961066204978641168716990033159088600623106396534094218402005803618121159982050197012697237961155375180768349707725936023283589475384693590539312637333226292265409814019687105755522332846972859860649558844229320481883408457674560284773922666633054564243260924189551494368660033292970122831009582038986061326503238023206238467592238752824663935316307653075615249537594229930297642710570473007696494702367783692850946455203144153509057520651038068881755863521371187245025834292163874467913915588768778393773565536027848586260129438664753479013894698439967637389690509120223682 -10962227285754340409566802000064407225866105372406170304563353147415988225079632767886653994299800743521362563345682593189107807948342418743229049299449088) 8901724619766152353686348546733715601389292980533102489320584358495016579544300311553198267047109201002901809060579991025098506348618980577687590384174853862968011641794737692346795269656318666613146132704907009843552877761166423486429930324779422114660240941704228837280142386961333316527282121630462094775747184330016646485061415504791019493030663251619011603119233796119376412331967658153826537807624768797114965148821355285236503848247351183891846425473227601572076754528760325519034440877931760685593622512917146081937233956957794384389196886782768013924293130064719332376739506947349219983818694845254560111841/5481113642877170204783401000032203612933052686203085152281676573707994112539816383943326997149900371760681281672841296594553903974171209371614524649724544)
  (num-test (/ -11349783565099575757929584771389010505157850113880084607145768380886038854233583951229136273631022011781914171912628263930864052254964518914857757025547156428098062812984733912827827545722979442676567330004437902674729872754963478834939047061999292143602525229120558979819117729589695377623970606315287270030693151486803968345724658003068961239204812937084581894755863859944500186226990319892122692007317326534880413455575446314965159569830188583093978564829748603480193166063624130610256395632946002879039047154077629561745862713628266069928068634042545592328263646730943717246953000457159714049930890865576634096206 -5169948998417532948043886408019867395123131165917923418040862036041756675786217242743410895008311710518018466892169868028617239526646914529999134517417939) 11349783565099575757929584771389010505157850113880084607145768380886038854233583951229136273631022011781914171912628263930864052254964518914857757025547156428098062812984733912827827545722979442676567330004437902674729872754963478834939047061999292143602525229120558979819117729589695377623970606315287270030693151486803968345724658003068961239204812937084581894755863859944500186226990319892122692007317326534880413455575446314965159569830188583093978564829748603480193166063624130610256395632946002879039047154077629561745862713628266069928068634042545592328263646730943717246953000457159714049930890865576634096206/5169948998417532948043886408019867395123131165917923418040862036041756675786217242743410895008311710518018466892169868028617239526646914529999134517417939)
  (num-test (/ -4372008041495429462966226028389793326873997497126815043214338280101332483009650104005998792061125254101227371430911497751865710691604158789733634394053254604723940088324934622768312096370232736965692181452463495731681105253628558429524788376108667441329817524961077744083376843098018692898745743361309486938506049017980865957895278210133305721083115513131884239744064081819033733041876411992332060293539102545847193260167588667810376670587099064558298380310132769718526554738650709745767046942440481512965138461694790645096012018276362849398785863823724642554436182185786302301222529261914437437947741031113015699315 -13213007132248918651858333568248204618745148942720942572088217188768868803339938910599097839075045781852237705726227293430250507070717570662238736211897310) 874401608299085892593245205677958665374799499425363008642867656020266496601930020801199758412225050820245474286182299550373142138320831757946726878810650920944788017664986924553662419274046547393138436290492699146336221050725711685904957675221733488265963504992215548816675368619603738579749148672261897387701209803596173191579055642026661144216623102626376847948812816363806746608375282398466412058707820509169438652033517733562075334117419812911659676062026553943705310947730141949153409388488096302593027692338958129019202403655272569879757172764744928510887236437157260460244505852382887487589548206222603139863/2642601426449783730371666713649640923749029788544188514417643437753773760667987782119819567815009156370447541145245458686050101414143514132447747242379462)
  (num-test (/ -24003371850945507239307096734506644624830254935119140199726507920301383328662376914775504920527918338079792692943250446679097229950654636321252144129692109999375967030689211646504258922323499994340282315270808545865248969923421472430657741998787024263629527291510416193284540865950122841477102934165296344839654902079279846705581902668360663987722715177845485423354226653585575109653937253382583158263755381721094429734122004436184054214443676096492583897635497699417294183504529284810360226314491839533303380490277211336049582128602304906849999737224506976061216780230350942535246958957024226614847691329767208211525 10686139440491678930358521446524488461285005495304677740436234635584738003880529034339295291091217655777627375148264449580064000634364863951333061091724053) -1263335360576079328384584038658244453938434470269428431564553048436914912034861942882921311606732544109462773312802655088373538418455507174802744427878532105230314054246800612973908364332815789175804332382674133992907840522285340654245144315725632855980501436395285062804449519260532781130373838640278754991560784319962097195030626456229508630932774483044499232808117192293977637350207223862241218855987125353741812091269579180851792327075982952446978099875552510495647062289712067621597906648131149449121230552119853228213135901505384468781578933538131946108485093696334260133434050471422327716570931122619326747975/562428391604825206860974812974973076909737131331825144233486033451828315993712054438910278478485139777769861849908655241056000033387624418491213741669687)
  (num-test (/ 11114571678097117920369007866358540243142633567044843952020632081573546909920632543585596494530749645890342978505657174505155646987551523455565703297238406590291026899487431109110746657023874064284362499621762851387854720746040865741433394111425240861542892218169985953747711593827913014379823797703717216676877313898809377467394109623799717556800777662963842899812297087284510893865429864819927951428138755600792987191034272014681606301885821862650098620488569288170357746018556395309910262410994899971436293672676949544989196526035130226777567220128838888396668158456237490064462262193759918857287915854681904206680 4808076329737968688023887165061921594706561818755147855784713748545995818001333418509444774306288638038607173052166709335820929501845348060033808100812677) 11114571678097117920369007866358540243142633567044843952020632081573546909920632543585596494530749645890342978505657174505155646987551523455565703297238406590291026899487431109110746657023874064284362499621762851387854720746040865741433394111425240861542892218169985953747711593827913014379823797703717216676877313898809377467394109623799717556800777662963842899812297087284510893865429864819927951428138755600792987191034272014681606301885821862650098620488569288170357746018556395309910262410994899971436293672676949544989196526035130226777567220128838888396668158456237490064462262193759918857287915854681904206680/4808076329737968688023887165061921594706561818755147855784713748545995818001333418509444774306288638038607173052166709335820929501845348060033808100812677)
  (num-test (/ -27971792815424016824370019866875377333122266892537700816201893161065327053508379094007350664178576160161460501442627646041422270472469587140689725524176629653056006769618104516779694726446739085332330345789012312708713495757968594985567285237456431009983022526625885024663335598317191838389804118084831445251467492693688286258834282078888862754754572546522075833632779922232880101875914894393005204887265821991459415144492487189071888581048779385051174007698853920104709378859053075296413813207007405843448595681090932498329066591349910723578718333092115184652723310842559914379989208301125396793101430807658654849482 3169580893680227534064172567436590084742349042688765883461923377455374714865282199177755353861979892274552092801376364846717140845237173266602633583445110) -4661965469237336137395003311145896222187044482089616802700315526844221175584729849001225110696429360026910083573771274340237045078744931190114954254029438275509334461603017419463282454407789847555388390964835385451452249292994765830927880872909405168330503754437647504110555933052865306398300686347471907541911248782281381043139047013148143792459095424420345972272129987038813350312652482398834200814544303665243235857415414531511981430174796564175195667949808986684118229809842179216068968867834567640574765946848488749721511098558318453929786388848685864108787218473759985729998201383520899465516905134609775808247/528263482280037922344028761239431680790391507114794313910320562909229119144213699862959225643663315379092015466896060807786190140872862211100438930574185)
  (num-test (/ -138888658164471549506154385143989713534453638138516110941977029 48484067562152384719540184707188444570280914254129306788137384972303743285284814 56428088099244342456240635263153370817851703737803685168591843059886944388583310 6984617762898435035101945891920384937438416626357047934508608980105797822504000 90193136183227859939744547239819443586783276313678017953708293432043879247302040 70539472782976230144489157899475475029273447055080677052149474853222128626227832 2525164589393997980217929709704832829968554364529060039097810436136432713906553063644429644328565051224269893261942396763235990073001625976866246420775436 15614337547041181126817477188043219628044963126229393225781917631975649438502836750353253851523795212263078850399716875892512719059737913422781999218667136371648316387382440793865460028660248325297931269646982047533754121791358966254514009830876592200454797694143082163294323565673200905929297174223061890100210054105027025488322289599106119653451218493916291922340123640475500240519924011764050880374885136181582395113140580448936759383024305870622004464940344826337458060607492042593813585998516868215921180540240201095202617277388950504036371411600204964284568597705251929695275183521036281637399204541958859605054) -138888658164471549506154385143989713534453638138516110941977029/4793535847709521198063287553243915170068914691727215964454867625024011698922303669226389748584276840530192157568469968220857898703102351955898913589325705637953049380748829567692600765708909637920797057370082064005557328769108356548100875674196976079597658854339583183901899349355521527519781721778545444496852540362424465770767219571362842157786846795990148969989617793004579188905882473140017509154008696803103206996067638134383708975696867028865870695941933200225325283190379262695816923376790224594063264297952504481719779782130509306530621779762254864669078635401870023086312919956154224782043667754741333688780367667466505233610011253346902821033707597517691608103391952937194719540981992469020284583499872663129517095879706480339710037976698298522952071766717472040399518290905103777436461474880898550115925718887748413534479076504168236430697214654069473800915087572730747027455509241250627470590715812698745630545585772046458363388764449879417348554556621640336029897762172500880501074103433267444717053504878282494505367980026597725927414511391047010801407870379019921551218005714825277162504166028680939100225793768617321830389705750902850499916610355200000)
  (num-test (/ 2902267908619179684129536324641634394442732593027015198805855082 4748067699021154152763168285921806700655154833226062437593302484475663167752990 92172802787151156076284963978247829387076983213530315481815585776147505007251090 15808981285029107672090190966349736198141855760941720122983980047623201110025085 60559202289239963744584432021634662330089323842876293477363484160210450706125345 20641717016962556495214267565148984505293698026059157698737040675346468206231142 142380249473014630955299439077662853963947100833592874440361316474000948841420058017600161066408668117933232436922811486348705081331372574460204309908598 22418721268614574393232189860262616514600143215945007038687873335656746730488694050883006164427390756358558140145027011322151188565843290717535647848841274550496431839061217253488169143292339455650565906288959125935798633464526818546688779845699340483771625364583343140648892889571715648295855169294054985996834093294240640072029711789359793649773566295329912082241637482772608479106201840565936084243727069954911883243252762742415647868355726139789907900798435783365130277592703989608678774745914668128791639635886550753850811717805962562157686110637810320436812644047534536168343578232389700410352900247092236175044) 1451133954309589842064768162320817197221366296513507599402927541/13803211377640454778526029288269623376813125655593684775595099045285713415153039020789267800416616529908688645478733023490751981264976732618374046330204398361829051480928696426688037404239513603403603849882719851670264413777889524531938606364925013854252374108222701436535488401321603495905123597139234414735397259257280679663147039651553472142280954446675036289021783142392760217244908768132158498744301278889276778209560846418263599491357632762902447742083022806085077053406738681250354036208472026046315736408632370478801849290705001622808552373129971427533249307210975612625050706661691322027927380443494854794852235813844542319971019369687589916047377092369702778251658652143114091304960406840026816351348391618676357634544120732441610431417230403811846208113160343697557236265319994702483700922393762500190362776377442551539417224595247790865885105594005740401824824367904020732469833438717527758468635665777261969819260766044978137909489986407113029460354144391595512642835261443393260585888868936164331461486646676578398836326366036777321522851855085808626766493197635871100152761464712744017549919220291986785134521319127277292845352756807452050073157340000)
  (num-test (/ 7798204144688205291220879078360728451593323170355809361079096742 35808393784851478122520372074317359817820799318259895240196875729073154197251420 58532175726063855694248618287185551673975962776708803423334853085996022345828434 97834368697888769536063057370864051207348099191057106781292664602519775900739777 92489021460656714290092899983209031746574776013841975324837145038810562509209529 71083733375588666647468985607775761710974844539643116636307037921671845148256816 6123989271760127932230015643359630675168106436173654465119508990415235040641894537960236511442249258231302028977221206744158863083898145166446430168108 -27418900206398855942064397259705713102524342707255992250395147550519659429645343464288092288218160406382406024735131578979728501208163782063519839258876833755387025755815673514708453862847139552613587001235204464673999898312854941659541050445981594990466469147364579547089805525464252876345032296745312923488525701877655352034887018931755379078328147999631937419977103372927428613463482328465834563846802083044643719319690088670748858904291298575733560600669924511028715689681303059001186388754140003746463568171428267337107394361025465082282061651196456268663181772211292647101192148287507051053367729008997838464209) -3899102072344102645610439539180364225796661585177904680539548371/113184205287561573324139833190653102440730360395399197973956984769580868365256138025034414373155098575475566747215877030265786675432252675717351889433714136838615056208470421665419618669892136317438270826178251174708190860235979949204785938786562420189510825909814566675745650194525647207897976611434325225523578368855952217879373499055292850828774005130267218801086474623429504045290678320168493275019256514768273116059350700654655821674309331585233552793659038912697151359657915391954687630783641745610431060563252789714638916120291482852533638921356624929690158752601417722733222880768367060672103351737811624242610815140332559619520810810999145535251960674284283045907801934328911198563750515779896457101601178888594882087326241517566336011980952110586199881600553269825310575512911473547251704677890770772166895623118832621335417348044312911888377718725944255218219811801447500167145561774582342171995333086224230231746597452848775656030037837271428187450747141983599129861631612369300880722326218963779650411119279310045263996988089484063433088077868691314162108392639864773907107325220582413508233901954483499166402135445110435112499264825479433389003494762240)
  (num-test (/ 6291885367078853457481986049409245691302078375827782321496819120 20959289231548357352292073342856567687394126070322865796282035211176720583560298 24366038587110130209541647226271577368736240640393242419005751016119649778306566 40118119174220166901790237425673316895032570534639145502274313654443256239236466 73598137358602854818844747625643480865061277528564461120022408463105339470504117 36695182446520138181079917512512743290981469731336486456411609014364293489978544 8671667981598505073194269824535189054936442262459158402875147736469644925300845122881093216273840895555488593258562684601176239455526568314028830532770 15920064019095473156324398162334173238735268739049399738654357508344572552411935473846021991360836375685872129737682603096450566258725052013769725919038955505690389573813769125933987978360857342250911865713011888064725725934341157729878064563080803955584985269499994186472079783942404183377695242296289152788154908185130552013951432753148997632323578507137074131845177376689609114975253308906745794984371839952312988353950198030866538756253618535421214253194954603293145507537939731320546686208032528588232652963255550963088571344119439249328480867640436815434047309164687808223851012490130534705427647158409623238123) 1439421788255379275215959765325419043929720157723371200401/1747562187028503746686299553853635643553063923188506902759251937250022196751705340155682655202720363192751787186892107863159676381018035068965958466119538181810433273947829904580526582292369320932134048728374142501965682147541817431447933591106030690334465450755701191781243754499216697336293783127396687916725975251100500896467549458036395977769801208905203001097425041200299917628353220804629035768571072498715030261324138691471497255335498185741379289492513543474304524261634247519034231348033379344777678679950561777846684978640375273167561174451700942154388980887510088060818147834369595669846115248027925007288445161871535514130090907585140894883683709507099726386549038354860875469377442908932714711235823032704493155679240378374325069782368108779247450762222838197717507164088182062062215767468125843278459189085290703729281279344184417197883359351058003644499215541300350121854220342250451978930421772367851329849662028719768708399155817754711362398236471946313773603716759409265530444582884661320404389499624411965234669344882203618613097197387901166904575791500958722726774956950592290330175936039556139052663816485140080963740296685158607671768592)
  (num-test (/ 7377598052472799909620353419322603137723415431070641423056433630 50990728761110292768803869421408199244526424730838143228662194914314857136430737 89434155113971221138805303763480423496687322824531744020762041598590716339098287 91343386111124700155689622654961840380754244946720984970313893805578518003516073 5641075230099727784981579696383316732450130418277879081291954534985607255267932 91040802121912074401640073226003257602385910518707524375098380810792151468159323 59272268188012925764499414539835790113036863511169317924034366016920114706179376837448098952655862721652129333873020625135398431500899131874782270590048 26690053756452308398721390096804652429111408747235998849320348549870126230712525274708597346508961935323823048352116439255386668122483555236157562141222434006899926132549352821247340442387991613448730451171206857242290791156220288682675982609964518905569737166444127835826079348146626921864776959482079234994631361894786436656768739968380067890165160954836874044821979903056957225885565092422439358816023307475581832942250031121721325840673134241504501661692722633100336840768527354183989544434614842654682324213774503456414914613412547380720171088896588158750436205804689590730033393056191028424154915201435563063992) 3688799026236399954810176709661301568861707715535320711528216815/169215718032454146095901737002485678790901914179482864125777331106759302744215797822810809511498045518338288799757661725047129775976254373463314416017128993811694804386237923340900604770406784566473173755998386770282409830097844352035251738093305402541509197084964701114515390028814839744480965823142680384744649624767291550851759670297818996073873968006960956353033659153219390871979066743795530136868490210455800714335529013059123604101460242870160400211866883478263106349349114199154533363251799944090298252763172390952446660627602934622584400932001701907172000401485323481964448487312714644861543740014645407417493588261100128985848137181719614326345024112347151970444057551896842474702539258687521054961314443551837168457190568932765925484427579811571491887599619302241390226818415165012748654917331557679228501007751078584244340346651276906088856205294333241792044902850102153793417101337667969641035858108457362954650972654353600494166650067557014544136240962457086782865870886529792004619668808741311540795514394731398977642092124679638585188974746423756335151669217754388004341907440529525288302872368689364872785975840444000802518095138062596107983803117056)
  (num-test (/ -239344771695510351349291992975349015183687755312261264640655565 59880027487583466136533364102518649070390160795136023810470091681171428955831193 48344457085007359228086666145324485903333773379391455489556219681156342646858065 96824393663737121700189215323825147927318524415097221824671795011444303522438090 73240728471954064253765051525185557601431281145369716902120469411886093226662465 53476482728312567840603110355495270554470432250981685279567813448298175801364992 2468459436652089730331798017030410049989399340882712030505584719342958436741536069714790640546086933185494149096286590992747248311590137695839482679011866 -20583944357058654336975302336113341974001469085102805363209530168831840401111182124827636905521584509677325966689931599005216123375088335255672290604710305325984961984791919524676460851699284525672773368217606895110240237523696098521003978238685169880199868729577660354717875890521074505342309726366304528678619465048659607726264456481345739318939431629704180230985397408136331466856633265343276511285483458860216756106887559724757372775728879136089013590836231272961497930729470443491032308329051560641396901204040829291495325588896591482909336032903587307512310970849256645908744180630660878534263566681640143534823) 15956318113034023423286132865023267678912517020817417642710371/3718709813392127924163278362562751486187605430152002432053108623099406465632705761508167478249438322470295467114170871555665890539409511492475240415534629792791729596612426725326976353265532166735941330128195885206087665506220364347120981130748862937276841801804372097254983242962029582754709606117339082763083905960784323141929645331591164015455383939302728076410053178677168172481507115685831178503426055335630689722163467637005123748113214310366231893390818795405612007113310547901224920768646006621130651182788173442625298859454337696280614462941186626306295514630883052819172301830539345633711941340491653447613466053205836875456839023743314390098829184111583809697328393569588632000669468187410368485286035179259523632217543401146996259011916302393091677624838641658623073752023082344005134299104409908004250830639232078441523519412192782367689826532215394196055149255026188549091956300108740792221660678858924234682223183500313556198187095251404633698868186071148295957994257417049500872570631774233307260384902571112475241073598945295745287525486108978093728296107260155093397986671349139935376427469718767763295900745932105722655724205000829205748307261900800)
  
  (num-test (/ 7013212896988366906/12397903473277899947 818833870013215068/2125577647443895255) 7453564285301859120853045020886215515/5075911640537211768265804260348400698)
  (num-test (/ -15781329068048599432/14942574238341613337 4388772934226358350/2640112802717985697) -20832244458230302534551181278529162052/32789782692450857054331267544650656975)
  (num-test (/ -9015230453321124271/17425619133302730035 -10422000746814766599/14972344381173680534) 134979135022768387806775446187867640714/181609815620990738305316999098032100965)
  (num-test (/ -14741075237791868512/12448692140900938227 -1090381863721238817/1060836378253796023) 15637868866825840780217685066084527776/13573828137487503515304766902031557459)
  (num-test (/ -7371815071140740177/4722722556038701367 3872455829192658988/994203944294825175) -7329087620340161131469364260313555975/18288534491791723206480607737200436596)
  (num-test (/ -9856364379969390509/7988230468709836259 -7208901117187058135/7430860779232874136) 1093153305924514768551484985555671272/859497963436269188803272225817371895)
  (num-test (/ -16740689272507881147/56924866550406451570641164619431212169 -14712532880452686095/143481612520580129383584255576273223983) 2401981091525408257128502717450566513166280001357873948501/837508970838236191644285394369194561392491093277901090055)
  (num-test (/ 1874027699956565000/65960003455647360668413772300355814843 -172394881832672950/2006879686300828197846469567507151887) -75218962452157875130617756878839223573611935155763100/227423340028380523596387094039260091189651621559491937)
  (num-test (/ 851521912886492079/58839621451933520132430725102159653727 -5525838657334730480/268863138354222710211869290179088409033) -228942853876053297959532391872114722003932597144466549607/325138254802036127673497464266072288930584674567672498960)
  (num-test (/ 2130823024472312937/30463932363736038600114358208342163020 413938864244113775/131673792970459944919771618253738144891) 280573549781056638388629087822719475587456644826399754867/12610205563054396144647765193069861697742251186477600500)
  (num-test (/ 17234694073181371137/253506951459931119968572673772742357160 8407879684613951161/42697666588937447817581914537644794355) 147176244259806896721181660841298454615950364713859506327/426291189417673978158704851675227114861497071554451732552)
  (num-test (/ 14739301038477826821/4801125431810347467140397350459581435 -1752125940488995048/127905197451270157484305628763539243969) -1885233209620217720514367144506571751170505057476450692549/8412176412616337518572109406238500578932979745867733880)
  (num-test (/ 9194848570227974720/45448499872046683203864930109076126035374684748838016011669264943000310475483 -4572473918523931944/28941042619577200519536336906341131911598596429670188136734086846500956354149) -33263563043940787786171015409141766453199063320923723716765930467953050399983260590187417389160/25976510037621464639740779963549572814837984766154635046133743883024710122710674726552171566119)
  (num-test (/ -2662376868940711929/2674240208804755702377222409224408783678596883960539287029565653749020338064 -5046618244273151929/26826013625152995057141957222948811537350409769204161465077735924332004069058) 35710479080747854012875521001477955195584454274704368888444222736697434540936425667291700196441/6747934713661461716612153292457811722283965560031580498434684530869001786777260513409206862728)
  (num-test (/ 646980248518054663/28444849537262537816809349756569888989442483441699293309597267649158853799707 -10174938507557455325/16470612178414296088079890015341965945714023680627341561729034923083435428747) -10656160760434978971303471120231114671340660575734505071429575384684610862775940451177787597261/289424594898370460244167952344748286246980979584479610186308309369583658143095854438992150589775)
  (num-test (/ 1268676597518744714/6024937921458004492480888468749320142603908196076058575752452561172018490893 17823595902143962912/85935047374548136904062562443188289405155329832270007415035044821925251080203) 18170630585125644385503771892175817370913744757273904248648000044618805359154885235028182716157/17897676474595109057512045856227678061218241143085827332930191066967148125532813505892133626736)
  (num-test (/ -3035741006152688190/58890268425224581569217175195410848521985674465189565646495474378301884202047 -4870935665435665519/47998868922405332801456101880162843269583282603435159879276723163289928325531) 145712134636693761356266465698326002831562744975420904782663360472436650653549187025441059178890/286850708819506259357726384810790881448875152111132928069815447961129371272624891025817707117393)
  (num-test (/ -4420263280205408439/38682162086456801604593696710774835436326970692840048042132553053971380151628 -758651402628235427/1755534012040040367913026343944696058732638465867705260088080517539506722166) 3879961265286134914514096239640695384126081133972137242327715997675029567458817030555062379437/14673138261791601182714628661554161812345431143865809776872034934342213839184709418896670662578)
  (num-test (/ -312487180249669742743295380499853180353/9828632991038934281 -86131955660561774942466932680637336739/10268762916730341592) 3208856768501438660232746468300370677374054716853273141976/846559380988100144557815474234956961169507773676687849659)
  (num-test (/ 105376075880566042097567073713047434893/11411565636673693365 -220737802783327232867818580441304577024/5817406274606660773) -613015445021032499619145665530563205764250055719854552289/2518963924957071797477174332253152325843619212749200245760)
  (num-test (/ -311533429150518992652072799089375050497/4403073054828470603 -320230219907951760832723580313293021909/1370493254961533625) 426954463345823097468320537904981772054351338526938461625/1409997052618498081840381197699863669488222338862641441127)
  (num-test (/ 305676222727436457375950609916137360009/2001517485431820526 324338803123828318219640932070020543912/11123178903397935211) 3400091311912189654145957985944153094384781502787164376899/649169785656371151621897383467144093766684841422885937712)
  (num-test (/ 8845112929712368402815105446090151026/8124751572615311799 -107609110538267962880281203537194473336/8714443449141779053) -38540118213625599008519681983731393728094066419546629189/437148645036763776481446937412401903340367189496615845732)
  (num-test (/ 152921217721894690043853278309581658066/11705615305395353865 184187448038871874764725486848823516773/4171619104693691390) 127585814672335876029018138907883882524550368713261650348/431205482165106014329333719781838993214328411764819575529)
  (num-test (/ 16414254293541341780725162107696242521/155838132618727968561620486302365154071 323320173010032367023620851618405869489/49801924105617352177018959505967933104) 817461446577249670665800625691379410535771218196808189195363718417488315184/50385611999847495177988476252475899813264458225659097815552272081452203039719)
  (num-test (/ -188149667625860588508273820953820709614/21438745582767797684161462130971215025 128458309657689922121539794960212789849/134174286369366827879740776978166655691) -25244847384333405496229128525982900130397411994350175944375943735942831513274/2753985018743617742875555653653797261370358442640799457019039857068516281225)
  (num-test (/ 1218460641064115152742257147372113443/1773382194117714970762642066492794929 -105212349758139121832338365854603836112/35045896682356785176328011712384921341) -42702045738251194875426595475683618047253961691478453648029952948483687063/186581707662369193907913729212042024270164277319717456729276609131940676048)
  (num-test (/ 1467722271775252460214852151179762687/1747611358981474614363356529179985509 25495740211005247928144692929451604259/29615224810946461612486375021101910565) 14488975012885720730598332784736375353299643425098519766594278819666029385/14852215066131169889445443721709162270198753408805825268529301698140894277)
  (num-test (/ 6278399735526726207674375684072448068/13890681759576280617381650633747782321 -112063146811220963294237186476216238443/46495820670393894026441353693945662660) -291919348200099113895651901892723884699250237261456280525601785996696740880/1556633509331345870779770006255469001211806559199158615405344674499795966203)
  (num-test (/ 248406099260780863433196593538936526373/315762135750029127758352280023694126018 -24578051912523675039725210046249323571/3033769619337997374435389027823294736) -376803438597807975522050212312559316811899647514236724224019181136008036264/3880409082236781853269738100403484871805889674074731389226471480469265885139)
  (num-test (/ -305871752543087256004326578375555909668/80170799467978436032303243749692785696371676780847080230403479135749775915991 -208573266832391890136462745593008906685/96016271562601269514856687672805175650907293023094157826925793080307407361434) 29368665255505841438632782694581946057561031972462112644657516768267440383833513431444679871238206541553985530943912/16721485549600848123731461311227384049611071114404954309505697259277905994635125654414916826332204568970567318299835)
  (num-test (/ -171651126582338417143004525987733942986/48126955023093310081685702171788275811688444573315712039582092051531229683107 32570134112026732491936310765048378699/18584159151613423191553551933672204731023422884196280183931777685641069715348) -3189991854959918631828923606391779823799241149346421336570141741355492000935500642040047513113849334779592681149128/1567501379505627719887579027549074087653888429037997616626567546431482074522690424133509833932668944596793898937793)
  (num-test (/ -31304786393644787215292629624842492472/10539846271603297974613179098685212701091372728582260780054561526149580513583 43496364289252206338797704034889660065/966865502932307025364733802774045297740949567802356684866342045679773834966) -30267518040679809082934454680954168768135550720881039440573156734314284479043791824457029301083428211405425375952/458444992982373700837242411005687390212275114474481688646320865335043970683786989531994936463047685893258985162895)
  (num-test (/ 124366625369659591476708994326732418029/107684759001536292829359995221778346870065030877016948429894748600664800488759 -90949754058598173499067700725927605729/79727020098830307921496202496061295138733611655702270828135321391380898414003) -9915380440470549523296226431396644117384598256053664887332801972488440466568616812942647849957495261151611303260087/9793902347049141646079571573977765974008832433473016883117384010293158932212528563016145547341801740792289848500311)
  (num-test (/ 26792084925762094333829722201654015569/6815899891200140342329613369008754659665480100088941978786466272502677117648 179968988142253715757129058636648023126/97033837835570527321466682927970125702018459951415339098532052222053589117353) 866579607987744230609336186273867662887766686833260209925103055244528379635362816895584608387230956963010276689619/408883535566062149539621907018509777969515872715944952500700527207173412646715462423653890585029605025758308909216)
  (num-test (/ 320794852821756057819990044473359503428/42380074203350930293358543616207018031675687905746455222111844144668904183229 -11813439835454851567822019323728871339/51852159737956631156972450987013128151750117741949546305537111598356497409240) -5544635317209327550045071802859986261979158492907374734760649234578367469399038563605323839330681533705071632958240/166884818941132804535892580774781586387104334774784737031184369589400544303785250219152004898392301479219940857877)
  (num-test (/ 63160395612932962868082774785156358041658469338654564454114468396132462549944/5671929772244157797 19541045450680948617094710246839287171374470593288265457341382295544977156173/10827756125123268218) 227961786821047895774887365257727015864174017882302289602409601101722343657899277052494444293264/36945145824164509580938949252327087600266044162541122809277442696583642758457532273140841543627)
  (num-test (/ 31389399613343712511677734270541516183531975055644318154870016415582858008412/11320913214023484367 -95931706646769408081251897664360951854776052790951374912970042200868629796051/14301831604104230477) -149641969141325406602881756591195860220337618158488775091717625369334526143115090325362684257508/362011508473745439254610688691597507367516106821889963803421575701854031622412859179610532278239)
  (num-test (/ -50845041077039215658764589763556935122444212169574762080162289087527164772395/482986173890811026 -51342299909113507561385579724776151277474630060658338514843664853027455595538/3864573616937705869) 196494404298439669659681446421686066898686292162412914850963937042669022612531239234324840686255/24797620991857267698917294149872672843409173617406514673128342148521539559341861421304646801988)
  (num-test (/ 76283614020376921713154299810619585257752996149145061806263596894412414185408/337890011287912517039286436540240936661 70530558237421368381589233382700323659036925075366138096846582768833233488577/12121510300837787759729092713205686989) 924672613133132744522463879340347327755455994321131972145048214329608890428265966744607561005512244129921459256512/23831571118985077324412202325831974453532679575894228007993082738742295289254461850021038245882565939546151124021397)
  (num-test (/ 13518475961402756750057330871273933874583566313800024119371308450919239424622/71146816100737230880567880716110051085 -11914742388051168959634071864657967837347162591767656949770878950409478930980/166466796775669753065110807850377519909) -1125188695291804746273664719520877594103080002716204716437885631737502681157239448228517736957154781558316254899699/423847992785167635691798025732868758201476408654527740579259436528169254792708107390082891890404030666159494556650)
  (num-test (/ -53624051286117226406327700847140806598091981633622544805551583455315188018537/149060170957501829683988930330276188371 -49540630291338976658332195799658601133012561780540500265134312414843218811481/313014990314092319823049811442768272842) 16785131893926373429171158665038393627227592608630727377590747943991201054188961463248027101037470630205119769672154/7384534820569381535972144752572408048556227885764547207137140227958732266609348654686668662110083737942669493487451)
  (num-test (/ 2634758410586745842739353561704344884865889793873131750193619887157306355755/83106075320614705363810122092414199463231740446254118542567688658288107572919 10787649314660479714744029413883607304719873485501736976813666398631455642569/2439964488756696481271244145022481444549967702052558191280867337292105066432) 2142905652761565172685487282499186838096673751132490328620490049367034561455889328384026705096013173825469773464105722689198047146574263705663366838720/298839732158850477765824602476778580028064205733214070073086531571837859351705342746223206218407306637658483098569582239416197836311325170250187389329637)
  (num-test (/ -1907320079310938642409293211056905401889419041722087613680756850005726714712/10387378553621846874105702088597026076825105075730032753153301604042569998683 113647247724474559442709588703965365251731833799417671287796250968092484717057/58756890421232187224353930678527831208703723187770044891160428018937233424397) -37356065632762902117955690133395145368676268194116097031480521390942668514422835237280325034441435052929702455487858500299401976652159912902024146542888/393498994563785425899168694480259206994308562177080555315323154941891277193612821825931878224565302417504072329241812530787363937691786269618438039211977)
  (num-test (/ -54987418627898620923060954379316763081930842855917193391807940070173620336071/17370345837184638879794373707261631548922174314274224219546763452439685451597 107349939397731511365417710412808670916754334908520065561311453951414109180973/7800708635318451621630266369706695626474649690647985662113853436261704078874) -428940831324519456770429889832838610542119304716244392653623661175655561457214418178921042544524225772650432309479656622489393939407340321261255371264054/1864705572939408818246392762570376592749103793151936455808919833872532407312841098160841844995663367019074328670998871082130543124576872890789577304863881)
  
  
  (test (= -98781233389595723930250385525631360344437602649022271391716773162526352115087074898920261954897888235939429993829738630297052776667061779065100945771127020439712527398509771853491319737304616607041615012797134365574007368603232768089410097730646360760856052946465578073788924743642391638455649511108051053789425902013657106523269224045822294981391380222050223141347787674321888089837786284947870569165079491411110074602544203383038299901291952931113248943344436935596614205784436844912243069019367149526328612664067719765890897558075277707055756274228634652905751880612235340874976952880431555921814590049070979276358637989837532124647692152520447680373275200239544449293834424643702763974403094033892112967196087310232853165951285609426599617479356206218697586025251765476179158153123631158173662488102357611674821528467825910806391548770908013608889792001203039243914696463472490444573930050190716726220002151679336252008777326482398042427845860796285369622627679324605214987983884122808994422164327311297556122943400093231935477754959547620500784989043704825777186301417894825200797719289692636286337716705491307686644214213732116277102140558505945554566856673724837541141206267647285222293953181717113434757149921850120377706206012113994795124049471433490016083401216757825264766474891405185591236321448744678896448941259668731597494947127423662646933419809756274038044752395708014998820826196523041220918922611359697502638594907608648168849193813197790291360087857093790119162389573209640804111261616771827989939551840471235079945175327536638365874717775169210186608268924244639016270610098894971732892267642318266405837012482726627199088381027028630711279130575230815976484191675172279903609489448225149181063260231957171204855841611039996959582465138269247794842445177715476581512709861409446684911276158067098438009067149531119008707418601627426255891/2063950098473886055933596136103014753954685977787179797499441692283103642150668140884348149132839387663291870239435604463778573480782766958396423322880804442523056530013282118705429274303746421980903580754656364533869319744640130831962767797772323836293079599182477171562218297208495122660799328579852852969560730744211066545295945803939271680397511478811389399527913043145952054883289558914237172406636283114284363301999238526952309439259354223729114988806937903509692118585280437646676248013406270664905997291670857985754768850507766359973207600149782819306010561088246502918148146264806947375101624011387317921439210509902170092173796154464078297852707797984007992277904626058467143192149921546030028316990855470478894515952884526783686210401408859364838148201339959570732480920969000913791571631154267939054105878236201498477027265774680071188764947522112650857013491135901945605796776829525789886482760578142306057177990048751864852763036720112071475134369179525117161001517868525821398753039187062869247457336940152614866298628205010037695017885878296140891234142925514925051385440766473260338168038302226808098439763889250948602137806546736025439919604390464712793474019469457135856879584745805794574609707742445431851999335443724488636749987837445626810087003490329257105472274738811579817454656532496370562155449815456374456838912258383282154811001588175608617475540639254689723629881619252699580383612847920348111900440075645703960104081690968807839189109040568288972353424306876947127635585164905071821419089229871978994388197349499565628906992171901547121903117815637249359328193980583892566359962066242217169190169986105579733710057404319381685578470983838597020624234209884597110721892707818651210378187525863009879314177842634871978427592746452643603586344401223449546482306838947819060455178762434166799996220143825677025686435609179225302671777326568324855229172912876656233006785717920665743720753617646617017219230313226844735567400507490772935145894670445831971526014183234960075574401616682479457962912905141754252265169682318523572680657053374002911007741991220001444440319448034755483178790032581428679303588017268970 0) #f)
  
  (num-test (/ 10105597264942543888.0 14352488138967388642.0) 5052798632471271944/7176244069483694321)
  (num-test (/ -17631701977702695093.0 3931860028646338313.0) -17631701977702695093/3931860028646338313)
  (num-test (/ -1606495881715082381.0 16324360910828438638.0) -1606495881715082381/16324360910828438638)
  (num-test (/ -7960193178071300653.0 -10280747961248435844.0) 7960193178071300653/10280747961248435844)
  (num-test (/ -11544909483975853384.0 -16041992360613233027.0) 11544909483975853384/16041992360613233027)
  (num-test (/ -5758820541298901548.0 -2596462557714095861.0) 5758820541298901548/2596462557714095861)
  (num-test (/ -13056342734667572546.0 46502284983183419157350605242474199851.0) -13056342734667572546/46502284983183419157350605242474199851)
  (num-test (/ 12668118634717482325.0 -338544675918656078399121171905238525746.0) -12668118634717482325/338544675918656078399121171905238525746)
  (num-test (/ -16738429327795346815.0 164053836541028518093058940786011794219.0) -16738429327795346815/164053836541028518093058940786011794219)
  (num-test (/ -9884600460121235549.0 -53914696297933680001835530599748561584.0) 9884600460121235549/53914696297933680001835530599748561584)
  (num-test (/ 6753521264659576004.0 71759828079371803409570464915096122874.0) 3376760632329788002/35879914039685901704785232457548061437)
  (num-test (/ -6072478784520825268.0 83641961138289700975241455431547940418.0) -3036239392260412634/41820980569144850487620727715773970209)
  (num-test (/ -6708950756971973620.0 -9847903810677323447803434015107261150885944735136350527205856921771320298384705376646797569973415403097847060539915279223391112430240736564839483430569706.0) 3354475378485986810/4923951905338661723901717007553630575442972367568175263602928460885660149192352688323398784986707701548923530269957639611695556215120368282419741715284853)
  (num-test (/ 11263779860755455072.0 2292311486393743282743453705144070351222990311578446825826935237655927864700827857707370158936582804478427014131790879562565658386819339761919809732496450.0) 1877296643459242512/382051914398957213790575617524011725203831718596407804304489206275987977450137976284561693156097134079737835688631813260427609731136556626986634955416075)
  (num-test (/ 9956488981426387585.0 -12351244248621474338537656633137999145154500022264356186225225426288301330225259889671144104952158102155582320296061124840400655528634050137479515338944145.0) -1991297796285277517/2470248849724294867707531326627599829030900004452871237245045085257660266045051977934228820990431620431116464059212224968080131105726810027495903067788829)
  (num-test (/ -14875992781716065391.0 4906952781757522095285156014969507916562921709689447567404076064849249737893410245743456952512717420040816186768213920574809530298070437840356629617118643.0) -2125141825959437913/700993254536788870755022287852786845223274529955635366772010866407035676841915749391922421787531060005830883824030560082115647185438633977193804231016949)
  (num-test (/ 16043178952268979636.0 -4962728781666935768923030490263743715131420507991284894489828489607808897271220927863958149140648859077934323268424257800724618076505149638049461104621679.0) -5347726317422993212/1654242927222311922974343496754581238377140169330428298163276163202602965757073642621319383046882953025978107756141419266908206025501716546016487034873893)
  (num-test (/ -14889985628902581941.0 3075736124701105220602924325296812116294816310089906623707854625135862902005059305428034753787024827094954645083406870532379125275086885405969947540175361.0) -14889985628902581941/3075736124701105220602924325296812116294816310089906623707854625135862902005059305428034753787024827094954645083406870532379125275086885405969947540175361)
  (num-test (/ -1719613957783789857.0 19860562547348050982501313785551054055826630539673708970554435103060535649825139319625648954889488501680865494719253019921780044205805557658109807483499994523398090829033362953135186523580359552555144614353929273831853529446536288544481045105104526669277307473478898498061888931858821517694257595658138564305517447595298378933983614114298000880741350618424855028965861930329619462261269994651112266861896630584883581092431090390354633458596611690990999635499563944625720180529318327647519405136188243979680965052005899543797270970540925042201315580510136864931200059448645464256385079735225156720340173280541113382758.0) -1719613957783789857/19860562547348050982501313785551054055826630539673708970554435103060535649825139319625648954889488501680865494719253019921780044205805557658109807483499994523398090829033362953135186523580359552555144614353929273831853529446536288544481045105104526669277307473478898498061888931858821517694257595658138564305517447595298378933983614114298000880741350618424855028965861930329619462261269994651112266861896630584883581092431090390354633458596611690990999635499563944625720180529318327647519405136188243979680965052005899543797270970540925042201315580510136864931200059448645464256385079735225156720340173280541113382758)
  (num-test (/ -10969623867482498359.0 1292477254230352575769754773488799598312602810841892384475535212194939033905139960602724737178675944133847094464739764817257836826367652752931492512753561670732296265459534230949226553571982695924178928914002527460943582374603078611662312521259541641138419845784008028215876048965254023368247445173694441960256131358058174374542730502334351759171930973722361567186133851896057677818979314942434199157003833234473048838906103902832115569853657335216793235394595479328932380393044485884605451918890395812628720641212850763944658735838941829604119213195707479940053016354291972875689927240247563236506479099606571912595.0) -10969623867482498359/1292477254230352575769754773488799598312602810841892384475535212194939033905139960602724737178675944133847094464739764817257836826367652752931492512753561670732296265459534230949226553571982695924178928914002527460943582374603078611662312521259541641138419845784008028215876048965254023368247445173694441960256131358058174374542730502334351759171930973722361567186133851896057677818979314942434199157003833234473048838906103902832115569853657335216793235394595479328932380393044485884605451918890395812628720641212850763944658735838941829604119213195707479940053016354291972875689927240247563236506479099606571912595)
  (num-test (/ -3716891004757979686.0 -19452372993227550502015765258932159656814363741878583541173956168837566077148160901999018823586675966076058615847408138956450751813058209394199427182041779436168298455103717521843644244801542056954603631432685194627158423459586845252167819811850263444712218938833443253125954475476481099092216538126519474183531297423759923656571895377587989169731023397615799830371852298135015608612181670362528239430952907458704415974164085176066242388561893721949244663406941558257051263727439679525692652639731850971185056484335828001005009903973037524233097329857690857731943951449292814500362180170793919266389501882641682782987.0) 3716891004757979686/19452372993227550502015765258932159656814363741878583541173956168837566077148160901999018823586675966076058615847408138956450751813058209394199427182041779436168298455103717521843644244801542056954603631432685194627158423459586845252167819811850263444712218938833443253125954475476481099092216538126519474183531297423759923656571895377587989169731023397615799830371852298135015608612181670362528239430952907458704415974164085176066242388561893721949244663406941558257051263727439679525692652639731850971185056484335828001005009903973037524233097329857690857731943951449292814500362180170793919266389501882641682782987)
  (num-test (/ -4863232114852441787.0 -22963038454503597269981750990033903654256693514059439027985256604978917966584414065892146187253799108250061573972673983350956191446047978392921074610323648301008272837432907303975548030552369880338022067315042332692023645592417869181836251486577977896077712912433381480614752789750181208326525834629219729662085632321271870762094800588296544243340047360684854239747242066367921596241226349790282723168222543448385227922748241223520686047460119733024390425165073367321644498280127168757335614077882325524816799960018589278475564547840614315473357481582710826551932681173443524724802157570101916268510464302946527662720.0) 4863232114852441787/22963038454503597269981750990033903654256693514059439027985256604978917966584414065892146187253799108250061573972673983350956191446047978392921074610323648301008272837432907303975548030552369880338022067315042332692023645592417869181836251486577977896077712912433381480614752789750181208326525834629219729662085632321271870762094800588296544243340047360684854239747242066367921596241226349790282723168222543448385227922748241223520686047460119733024390425165073367321644498280127168757335614077882325524816799960018589278475564547840614315473357481582710826551932681173443524724802157570101916268510464302946527662720)
  (num-test (/ -16248276650501285553.0 -3381199474840825715485713565301777938368574604710714363907009216856320913536015299178065264912798511857598595067318796576494480424838898250138649774858742984769125731728430552285782315111538920026330816414650913188340281906359149109963139438960274321560117812365241840204034925444652058916966934904097509799291744775242863360284348334605170437300543978049053839829106628489146216325576991696936733592366926096500684308845306493636196092408597450926695579897293944488261001228478152650490677071497874746121221519036861983646423005753475340900508665494162949119110128646472783016552527735050067363030838015919512260159.0) 16248276650501285553/3381199474840825715485713565301777938368574604710714363907009216856320913536015299178065264912798511857598595067318796576494480424838898250138649774858742984769125731728430552285782315111538920026330816414650913188340281906359149109963139438960274321560117812365241840204034925444652058916966934904097509799291744775242863360284348334605170437300543978049053839829106628489146216325576991696936733592366926096500684308845306493636196092408597450926695579897293944488261001228478152650490677071497874746121221519036861983646423005753475340900508665494162949119110128646472783016552527735050067363030838015919512260159)
  (num-test (/ 18296946401228630959.0 3302341071702763311560113831030141639804425031433511503765833897787925467295486187687396312611805794369889470239777040624530990622212474466940548049117664906468330871893337410618797113677420975837622378808494314918471282099855916016026079371666730617071364751834080179173620476977670099126230223862266413091012344741482772771219725893630556702028108027870656512750807359335108428687238687397060104669074315031780019301768744978815422943986587389425726602444937024004102212071953113581935989741954695450085391443134273670514145585869912689150728183940456773133212037846765421397201956541430155664614978559762638030787.0) 494512064898071107/89252461397371981393516590027841665940660135984689500101779294534808796413391518586145846286805562009997012709183163260122459206005742553160555352678855808282927861402522632719426949018308675022638442670499846349147872489185295027460164307342344070731658506806326491329016769648045137814222438482763957110567901209229264128951884483611636667622381298050558284128400198900948876451006451010731354180245251757615676197345101215643660079567205064579073691957971270919029789515458192258971242965998775552705010579544169558662544475293781424031100761728120453327924649671534200578302755582200815017962566988101692919751)
  (num-test (/ -60488682170925814337492051725122486652.0 14880088785789146426.0) -30244341085462907168746025862561243326/7440044392894573213)
  (num-test (/ 126617729996196635247771282957911941277.0 -7166506344996883172.0) -126617729996196635247771282957911941277/7166506344996883172)
  (num-test (/ -278675896803726074870988122161067771390.0 7744689831802931490.0) -27867589680372607487098812216106777139/774468983180293149)
  (num-test (/ -283351838662873779255871649630248958879.0 6912311315831153835.0) -14913254666467041013466928927907839941/363805858727955465)
  (num-test (/ -9715584046609700027352634666499181378.0 3368831995960494221.0) -9715584046609700027352634666499181378/3368831995960494221)
  (num-test (/ -137493547985106345282009151869389470397.0 -1916381539906956855.0) 137493547985106345282009151869389470397/1916381539906956855)
  (num-test (/ -328662747577960331872949773416436800743.0 -231069430804205460334599495337085157308.0) 328662747577960331872949773416436800743/231069430804205460334599495337085157308)
  (num-test (/ 213595640581249636406536485951630735277.0 -48492294677143227478357598229530842959.0) -213595640581249636406536485951630735277/48492294677143227478357598229530842959)
  (num-test (/ 85922846498729014445816145204889624189.0 193533957681757355413031965695625196813.0) 85922846498729014445816145204889624189/193533957681757355413031965695625196813)
  (num-test (/ 24053342958857142686054803491202486471.0 196417511107100936775397820630955772553.0) 24053342958857142686054803491202486471/196417511107100936775397820630955772553)
  (num-test (/ 102038936612518756467074084117019701214.0 -111946989731587760700903475996379168167.0) -102038936612518756467074084117019701214/111946989731587760700903475996379168167)
  (num-test (/ -3006867214208872584699983438179656913.0 -234257597822744479264249663225224173340.0) 3006867214208872584699983438179656913/234257597822744479264249663225224173340)
  (num-test (/ -279839802710533516603863620922251878907.0 -3244112647743502769852782626803305310331045534071805654982307107362388474314396636799597033636575215617240554815450017779373048313695795886893032630263219.0) 279839802710533516603863620922251878907/3244112647743502769852782626803305310331045534071805654982307107362388474314396636799597033636575215617240554815450017779373048313695795886893032630263219)
  (num-test (/ 123635964546481689465778244982425098404.0 7701433613491146708866098469269971554817017737111287276993583150548359764165526640986060909954451793171933304569726872785964805121981749276421956645830854.0) 61817982273240844732889122491212549202/3850716806745573354433049234634985777408508868555643638496791575274179882082763320493030454977225896585966652284863436392982402560990874638210978322915427)
  (num-test (/ 166158110049010486343321316578688184578.0 4093720847216792748840371965199135052196058344862447621818024731938681519017878880275303125899149558774718190527651555811733139227128378041055212888819294.0) 83079055024505243171660658289344092289/2046860423608396374420185982599567526098029172431223810909012365969340759508939440137651562949574779387359095263825777905866569613564189020527606444409647)
  (num-test (/ 147416259636838312272435267341375281181.0 -11266711292262839805944890501811605204323255169233519804446548849178247889563130015168799346120099052214488209897402054530713234143622703174309015777885801.0) -147416259636838312272435267341375281181/11266711292262839805944890501811605204323255169233519804446548849178247889563130015168799346120099052214488209897402054530713234143622703174309015777885801)
  (num-test (/ 102557200511608632541115941654031896919.0 3866177549962722728707550488877109233779215384377007088712280650225992470307822792085413087509167847767889824884877044539352696974351192629898363157976511.0) 102557200511608632541115941654031896919/3866177549962722728707550488877109233779215384377007088712280650225992470307822792085413087509167847767889824884877044539352696974351192629898363157976511)
  (num-test (/ 47794953079190110032282671989549362415.0 3802290983508829335098916118339496411537222492645529399519373082799614656011270200284796148989094312601047370399228868583158444769807910513767845541589667.0) 47794953079190110032282671989549362415/3802290983508829335098916118339496411537222492645529399519373082799614656011270200284796148989094312601047370399228868583158444769807910513767845541589667)
  (num-test (/ -169956065319483471022234920202991103615.0 -9934427489865644196610501807375648335352544234206717324511161205173460054921759084767897792996557220898467288533128078406604709773449948420404563411793533441010236017064154469575084055359823982786110746700747423674942932421964955746280671982635899487781780756099620799397239156211815110739544719746684712086075069101799537802834839550142629064374734870047412916259754010150500874430055034366305216104752636211802195447299210332237598443674867760860326529472901775427058078447963316168327741049511844237329137194533000697525539835371015163158135757326482343130221118201740819963770851200676279882978581431999960842565.0) 33991213063896694204446984040598220723/1986885497973128839322100361475129667070508846841343464902232241034692010984351816953579558599311444179693457706625615681320941954689989684080912682358706688202047203412830893915016811071964796557222149340149484734988586484392991149256134396527179897556356151219924159879447831242363022147908943949336942417215013820359907560566967910028525812874946974009482583251950802030100174886011006873261043220950527242360439089459842066447519688734973552172065305894580355085411615689592663233665548209902368847465827438906600139505107967074203032631627151465296468626044223640348163992754170240135255976595716286399992168513)
  (num-test (/ -83006311763073652927964071041666508273.0 13480787677843057038436344704360462056114592749322481662307876594244244638227291805757775026215166740035048814729231681821563443093991755779505400592913963236010573873554317250153995160235771659208137440518282824497744092608999871327127239673370293239927529076145825972430101380272357235582367639159280348164804218713823424182167974242317526959809443701996053548231667727254858428867000011055354779789221097183515832386890638024105232865079002765479933320220378271026425568216748186200736499581088153390350474814123049637951929317200314355414551809067125550551841102097159644340520444983020267926123546444838010089690.0) -83006311763073652927964071041666508273/13480787677843057038436344704360462056114592749322481662307876594244244638227291805757775026215166740035048814729231681821563443093991755779505400592913963236010573873554317250153995160235771659208137440518282824497744092608999871327127239673370293239927529076145825972430101380272357235582367639159280348164804218713823424182167974242317526959809443701996053548231667727254858428867000011055354779789221097183515832386890638024105232865079002765479933320220378271026425568216748186200736499581088153390350474814123049637951929317200314355414551809067125550551841102097159644340520444983020267926123546444838010089690)
  (num-test (/ -312626207169475064151212222217866488926.0 6989069923898656093413456232544365450599471748502878018530391549015151484336014906416216966193568842618920902504390187814247729346977677905224098932673981665869061845335443588666641982676550205160521286690015544764015602751932938178737949961754714143180917985455875095030469699198116593730005119922928175789172042067281849364217595912265452199938281052984802042194034638773435768458457616208103331213440768472281882976004050012769415198321241810008696147179275528426468408383757692656341606162350211696837361434874035354680073309142183699892959618671515841112321607728427286289324836870027735590091451421689980776552.0) -52104367861579177358535370369644414821/1164844987316442682235576038757394241766578624750479669755065258169191914056002484402702827698928140436486817084065031302374621557829612984204016488778996944311510307555907264777773663779425034193420214448335924127335933791988823029789658326959119023863486330909312515838411616533019432288334186653821362631528673677880308227369599318710908699989713508830800340365672439795572628076409602701350555202240128078713647162667341668794902533053540301668116024529879254737744734730626282109390267693725035282806226905812339225780012218190363949982159936445252640185386934621404547714887472811671289265015241903614996796092)
  (num-test (/ -151709660794612786408772973806200383563.0 -26960472721919005254400858042130056790831511338891584787669209989714807518625849812230185079206081782191501696661436514815190623849929065098497737155759771863508038766934134444191240792356114381746781342181881402424707118515655119761011977116554236461222788625158348668147995099157685699761135150772589445239536582228655532345059046596356954495360132444243748421428095867292294626357084961338288369883088525401649234025290736504802104065029036642533076183281468647642956623788270236516849523210698622687255735945678505925047193818483603361307498423724202227256505312543145618362906047473400380196192622607541097732443.0) 151709660794612786408772973806200383563/26960472721919005254400858042130056790831511338891584787669209989714807518625849812230185079206081782191501696661436514815190623849929065098497737155759771863508038766934134444191240792356114381746781342181881402424707118515655119761011977116554236461222788625158348668147995099157685699761135150772589445239536582228655532345059046596356954495360132444243748421428095867292294626357084961338288369883088525401649234025290736504802104065029036642533076183281468647642956623788270236516849523210698622687255735945678505925047193818483603361307498423724202227256505312543145618362906047473400380196192622607541097732443)
  (num-test (/ 138834496986391136939574372853300933725.0 -8052690543272184576133758511645801940246473546142520821850130421981395129853341888352999304040698251945886555605291324954368612109314080471658982022831338507499254609048475429862437003158379101603576571787302167207044118847876475134352180874260998595377014195145760071923429129767580115085764485254455919915567128572731355497418831212259648020550107573824886521471697331410754043280744066090848295906051303624846301488010249980896364883452154860562864255354208802313850527991005497484253401461375477060954782095047043919500670383372218536999834862885439984085848342867301834247551832677237328664699302165347765799113.0) -15426055220710126326619374761477881525/894743393696909397348195390182866882249608171793613424650014491331266125539260209816999922671188694660654061733921258328263179123257120052406553558092370945277694956560941714429159667017597677955952952420811351911893790983097386126039131208251222066153001577238417785769269903307508901676196053917161768879507458730303483944157647912473294224505567508202765169052410814601194893697860451787872032878450144847205144609778916664544040542605794984506984917261578755812650058665667277498250377940152830784550531343894115991055630042596913170777759429209493331565094260318589092694172425853026369851633255796149751755457)
  (num-test (/ 276499207940187081393841843387608369874.0 27347897028734618663428054896349668572244941195143856840032842195489553215406302254043947382368793914074147314353589439281000471813879502242851166670252197853998033813694814376228360691543987661407996785043637351295817024680721181205269262470473172181965930243852520386958529041036476807810647578694133804796395977642274699322030062940721165202488695975750512485574440928370802874677938542169620505668128224812441566912043326338714451629730522324228356364241376445033028898865300103247057378058702233150414643818049655628999871012383236520330575609745427181485617250755214922048672375947942288446974485524776744246517.0) 8919329288393131657865865915729302254/882190226733374795594453383753215115233707780488511510968801361144824297271171040453030560721573997228198300463019014170354853929479983943317779570008135414645097864957897237942850344888515731013161186614310882299865065312281328425976427821628166844579546136898468399579307388420531509929375728344972058219238579923944345139420324610991005329112538579862919757599175513818412995957352856199020016311875104026207792481033655688345627471926791042717043753685205691775258996737590325911195399292216201069368214316711279213838705516528491500655825019669207328435019911314684352324150721804772331885386273726605701427307)
  (num-test (/ -8979365591106781219797187096315899769868799444656824967426553299158070014074001230883484015880186603742048949313393413640240595706939311540002219411120389.0 -1698360947072008877.0) 1282766513015254459971026728045128538552685634950974995346650471308295716296285890126212002268598086248864135616199059091462942243848473077143174201588627/242622992438858411)
  (num-test (/ -12831814656788829919185319784994714617782749504716966706877579983082880759985031662545957372565411439648298939198657738497464024214657609856476819270030801.0 454910754379715.0) -273017333123166594025219569893504566335803180951424823550586808150699590637979397075445901543944924247836147642524632733988596259886332124605889771702783/9678952220845)
  (num-test (/ -7834266257250691217409788323211914445703052638619784568844628449769010091330019095736167988675873769434766592786720961949649685040028101508217441360672222.0 -428418418877192732.0) 3917133128625345608704894161605957222851526319309892284422314224884505045665009547868083994337936884717383296393360480974824842520014050754108720680336111/214209209438596366)
  (num-test (/ -4001605821592542867351046644170905984672346731784670159062281252096012802838642896466582343641124674682428297533953704119505640938363392225910275838094045.0 15760991890495426717.0) -4001605821592542867351046644170905984672346731784670159062281252096012802838642896466582343641124674682428297533953704119505640938363392225910275838094045/15760991890495426717)
  (num-test (/ 2876630161532936743269451364955814480771395635620140205538288339793482694260173239474830738010159518887660000673207712630507802368373928478641773477534499.0 -6788234478844960330.0) -2876630161532936743269451364955814480771395635620140205538288339793482694260173239474830738010159518887660000673207712630507802368373928478641773477534499/6788234478844960330)
  (num-test (/ 6230070442453337264527950102774203962152836811174649694700041895216739851602598854067104967963392074425258687296947909484969927078206601660837276754799333.0 190237375887614033974333796608341639595.0) 6230070442453337264527950102774203962152836811174649694700041895216739851602598854067104967963392074425258687296947909484969927078206601660837276754799333/190237375887614033974333796608341639595)
  (num-test (/ -12098771374444180013224380531550204930654718468097503123335711776524055419889032578894177605164827523969169377266342179411916625188550162928371789854647472.0 -41681385674896602840749705069663453185.0) 12098771374444180013224380531550204930654718468097503123335711776524055419889032578894177605164827523969169377266342179411916625188550162928371789854647472/41681385674896602840749705069663453185)
  (num-test (/ 13185465843955116174925558412278612918939024395488172088108029202384613698982949554556435640011161663974075894844304583900497170806796813871943782330552768.0 -155202352609947911537719051033334010254.0) -6592732921977558087462779206139306459469512197744086044054014601192306849491474777278217820005580831987037947422152291950248585403398406935971891165276384/77601176304973955768859525516667005127)
  (num-test (/ 12784980722915659825738808684740823452025110516624579136271791852138148426775553817114893299569867520414470532361018804123866264934222335562072872489963044.0 -249441012384365373362771955533424187237.0) -12784980722915659825738808684740823452025110516624579136271791852138148426775553817114893299569867520414470532361018804123866264934222335562072872489963044/249441012384365373362771955533424187237)
  (num-test (/ 8517839393030302736298983538193047531846908718502576675615969705563208303329257882565359266876007571790337440612227785062203468682754778416335180236967433.0 -23101645464137481399279134347982485126.0) -8517839393030302736298983538193047531846908718502576675615969705563208303329257882565359266876007571790337440612227785062203468682754778416335180236967433/23101645464137481399279134347982485126)
  (num-test (/ -10157767522292361462005308817460390811646115952647174687477824271227382383351453540195549992670001314693794150879368708343715654899952822395459036505947192.0 -25611473771508763579433379623726126173.0) 10157767522292361462005308817460390811646115952647174687477824271227382383351453540195549992670001314693794150879368708343715654899952822395459036505947192/25611473771508763579433379623726126173)
  (num-test (/ -8580252632668820290302987230726290672170301642399871646484841866604753910447257372311950907045477729554307803379310475132687855999835211879267570997069974.0 5347050029330174629945013741349819215851040371727058829687387719215168997632386672310746837193930669173408831178932364105722911104309540550576485594530627.0) -8580252632668820290302987230726290672170301642399871646484841866604753910447257372311950907045477729554307803379310475132687855999835211879267570997069974/5347050029330174629945013741349819215851040371727058829687387719215168997632386672310746837193930669173408831178932364105722911104309540550576485594530627)
  (num-test (/ 7706102251141221799524762336156378964168657337573751909064577951085535246905735244239132983582998872001001594454632956803416956154262109939446710205558308.0 6334400709835247308796432875490978646658012545184955441452799118298109610816693049400832749087993843490999852355789914065232784070007399786089389453289854.0) 3853051125570610899762381168078189482084328668786875954532288975542767623452867622119566491791499436000500797227316478401708478077131054969723355102779154/3167200354917623654398216437745489323329006272592477720726399559149054805408346524700416374543996921745499926177894957032616392035003699893044694726644927)
  (num-test (/ 12609622044672092190084693450911157599596799695538449568681964257744962273690941575572590166273187189250007688411096790312605666562908125521094386992971478.0 -8237858212652788898158635047388584411011830102060269605835391741772914864422465141467281143809161251942948659243584296367296559912373856433388249393853968.0) -6304811022336046095042346725455578799798399847769224784340982128872481136845470787786295083136593594625003844205548395156302833281454062760547193496485739/4118929106326394449079317523694292205505915051030134802917695870886457432211232570733640571904580625971474329621792148183648279956186928216694124696926984)
  (num-test (/ -9988492519236282081446302885464711911055350309732728352574982611126604133339499170845224383282665522673248920309221355720665956477799939031063172954469785.0 -1878204914631111607000020160429571305542722711529281855381736226230242796648854769713662269068364131804626863789957256573308715572826753755672493154125086.0) 9988492519236282081446302885464711911055350309732728352574982611126604133339499170845224383282665522673248920309221355720665956477799939031063172954469785/1878204914631111607000020160429571305542722711529281855381736226230242796648854769713662269068364131804626863789957256573308715572826753755672493154125086))

(let ((val1 (catch #t (lambda () (/ 1.0 0.0)) (lambda args 'error)))
      (val2 (catch #t (lambda () (/ 1.0 -0.0)) (lambda args 'error))))
  (test (equal? val1 val2) #t))

(test (/ "hi") 'error)
(test (/ -0) 'error)
(test (/ 0) 'error)
(test (/ 0.0) 'error)
(test (/ 1.0 0) 'error)
(test (/) 'error)
(test (/ 0/3) 'error)
(test (/ 0 1 "hi") 'error)
(test (/ 2/3 0) 'error)
(test (/ 0 0) 'error)
(test (/ 1 0) 'error)
(test (/ 0 0.0) 'error)
(test (/ 1 0.0) 'error)
(test (/ 0.0 0.0) 'error)
(test (/ 1.0 0.0) 'error)
(test (/ 0 1 2 3 0 4) 'error)
(test (/ 0.0 1 2.0 3 0.0 4) 'error)
(let ((NaN 1/0)) (test (nan? (/ 0 1 NaN 2 0 3)) #t))
(let ((NaN 1/0)) (test (nan? (/ 0.0 1.0 NaN 0 1+i)) #t))
(test (/ 1/9223372036854775807 0) 'error)
(test (/ 1/9223372036854775807 0.0) 'error)
(when with-bignums
  (test (/ (bignum 1.0) (bignum 0)) 'error)
  (test (/ (bignum 1.0) (bignum -0.0)) 'error)
  (test (/ 9223372036854775807123123123 0) 'error))

(for-each
 (lambda (arg)
   (test (/ arg nan.0) 'error)
   (test (/ nan.0 arg) 'error)
   (test (/ arg inf.0) 'error)
   (test (/ inf.0 arg) 'error)
   (test (/ 0 arg nan.0) 'error)
   (test (/ nan.0 0 arg) 'error)
   (test (/ arg inf.0 0) 'error)
   (test (/ 0 inf.0 arg) 'error)
   (test (/ 0 arg) 'error)
   (test (/ 0.0 arg) 'error)
   (test (/ 1/2 arg) 'error)
   (test (/ 1+i arg) 'error))
 (list "hi" () (integer->char 65) #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))

(test (nan? (/ 0 nan.0)) #t)
(test (nan? (/ 0 nan.0 0)) #t)
(test (nan? (/ 0 0 inf.0 nan.0)) #t)
(test (zero? (/ 0 inf.0)) #t)
(test (nan? (/ 0 0 inf.0)) #t)
(test (nan? (/ 1 nan.0 0)) #t)
(test (nan? (/ 2 0 inf.0 nan.0)) #t)
(test (zero? (/ 3 inf.0)) #t)
(test (nan? (/ 4 0 inf.0)) #t)
(test (negative? (/ inf.0 2.0)) #f)
(test (negative? (/ inf.0 -2.0)) #t)
(test (negative? (/ -inf.0 2)) #t)
(test (negative? (/ -inf.0 -2)) #f)
(test (negative? (/ inf.0 -2)) #t)

(for-each
 (lambda (arg)
   (test (/ arg) 'error))
 (list "hi" () (integer->char 65) 0 0.0 0+0i -0.0 -0 0-0i #f #t '(1 2) _ht_ _undef_ _null_ _c_obj_ 'a-symbol (cons 1 2) (make-vector 3) abs 
       #<eof> '(1 2 3) #\newline (lambda (a) (+ a 1)) #<unspecified> #<undefined>))

;;; from guile irc
(test (boolean? (let ((x (/ 1e-300 1e8))) x)) #f)

(when with-bignums
  (let-temporarily (((*s7* 'bignum-precision) 512))
    (let* ((rats (list 2/3
		       5/8
		       12/19
		       53/84
		       253/401
		       665/1054
		       12941/20511
		       15601/24727
		       79335/125743
		       190537/301994
		       7161071/11350029
		       10400200/16483927
		       10781274/17087915
		       53715833/85137581
		       171928773/272500658
		       397573379/630138897
		       4201378396/6659027209
		       6189245291/9809721694
		       6586818670/10439860591
		       65470613321/103768467013
		       137528045312/217976794617
		       615582794569/975675645481
		       753110839881/1193652440098
		       5409303924479/8573543875303
		       11571718688839/18340740190704
		       52449289519716/83130157078217
		       326267455807135/517121682660006
		       483615324366283/766512153894657
		       3816473305410548/6048967074079039
		       6234549927241963/9881527843552324
		       111738283365989051/177100989030047175
		       130441933147714940/206745572560704147
		       397560349370386783/630118245525664765
		       3447601211185766107/5464318637170278738
		       4640282259296926456/7354673373747273033
		       22803850947114245497/36143248623210700400
		       50247984153525417450/79641170620168673833
		       205632218873398596256/325919355854421968365
		       5680010011095224105765/9002602871306688466954
		       7530699980955811472069/11935877073996486182239
		       23414628818361028801231/37111308645407146420177
		       31150961018190238869556/49373105075258054570781
		       1534133422091150914676569/2431543945117495582118873
		       1721039188200292347893905/2727782575569043909543559
		       3473229337418774934657366/5504938256213345873657899
		       154574280995644579711687565/244994438954031520405061896
		       171940427682738454384974395/272519130235098249773351391
		       522767741723052913024237917/828567267217721441067369971
		       2438425051595107335801557824/3864812267597295609689840565
		       8360810638231427833453149306/13251571337227329711204261637
		       25605199656417336413383685835/40583281278899710574680154882
		       62532402744384260909046316717/99111513429841767911321781937
		       201880404458020531058243690939/319972870696382667546684028520
		       378155609259623725703103696043/599362460113865624518687902158
		       2180796053156940756896192173706/3456479965974452268626125476129
		       30909300353456794322249794127927/48990081983756197385284444567964
		       72722580972698292428980549124384/115262563797384656113699516516573
		       253438635377865553122983825848491/401690733307859070263635245069941
		       579599851728429398674948200821366/918644030413102796640970006656455
		       2391121987886415887128773352409848/3789838685449795842677579543142393
		       8658726883466670304288180833845151/13723757414280836847692013404326603
		       13440970859239502078545727538664847/21303434785180428533047172490611389
		       42714034565604922122765955968404389/67700143040991081441819097014976560
		       114701132837575264289752140366548320/181796994337792815792410118554318291
		       845621964428631772151030938534242629/1340279103405540791988689926895204597
		       960323097266207036440783078900790949/1522076097743333607781100045449522888
		       6836962813701024519375233692672084963/10836329678541128070260110436700978507
		       14634248724668256075191250464244960875/23194735454825589748301320918851479902
		       51700032084971999781389768164307758537/81942612140761230922945173238704941101
		       229231662975523486756566339893048870935/363323589794154975118123224355821745701
		       724760772286874203975897537379209410467/1148718646068400566529013525387318698302
		       1360755729128472664464206788894048264735/2156746803310104260960438025216078994304
		       6167783688800764861832724692955402469407/9775705859308817610370765626251634675518
		       28435404464167678210479364512746335244699/45069049768544731377148664330740395536983
		       34603188152968443072312089205701737714106/54844755627853548987519429956992030212501
		       144580536300674537151081081515762353325831/229154728370723013560448485454219755525522
		       792109057809309571900029585990215242057367/1255463153109322165777281287185082838052612
		       1907982376372936661174533424217656928480502/3024080518587943907662978975235597217368769
		       27503862327030422828343497525037412240784395/43592590413340536873058986940483443881215378
		       31319827079776296150692564373472726097745399/49640751450516424688384944890954638315952916
		       221146771934807009716022484038526739612698295/350509340672202916726357593211918065429039181
		       252466599014583305866715048411999465710443694/400150092122719341414742538102872703744992097
		       2555985817225609354817843048493467383202182339/4051141672677709838835810325919681675765873886
		       2808452416240192660684558096905466848912626033/4451291764800429180250552864022554379510865983
		       50299676893308884586455330695886403814716824900/79723101674285005903095209014303106127450595597
		       72767296223230425871931795471130138606017833164/115333435792688439345099631926483541163537523461
		       148343044862701044404548149039165744060948292361/235118163350177307870449816716989636706585912905
		       590563727034563984957508038059757509394880543411/936021361635908802301548714003935992446832785637
		       1550580840017760484596044169668976645517675504708/2457612485764860659689096693368334799470374920545
		       26950438007336492223090258922432360483195364123447/42715433619638540017016192501265627583443206434902
		       ))
	   (fifth (/ (log 2.0) (log 3.0)))
	   (c-fifth (complex fifth fifth))
	   (p-fifth (make-polar (* (sqrt 2.0) fifth) (/ pi 4)))
	   (last-rat 26950438007336492223090258922432360483195364123447/42715433619638540017016192501265627583443206434902))
      (for-each 
       (lambda (a b) 
	 (if (not (< (abs (- b fifth)) (abs (- a fifth))))
	     (format #t ";fifth: ~A is not better than ~A??~%" b a))
	 (if (not (< (magnitude (- (complex b b) c-fifth)) (magnitude (- (complex a a) c-fifth))))
	     (format #t ";rectangular fifth: ~A is not better than ~A??~%" b a))
	 (let ((pa (make-polar (* (sqrt 2.0) a) (/ pi 4)))
	       (pb (make-polar (* (sqrt 2.0) b) (/ pi 4))))
	   (if (not (< (magnitude (- pb p-fifth)) (magnitude (- pa p-fifth))))
	       (format #t ";polar  fifth: ~A is not better than ~A??~%" b a)))
	 (if (not (< (abs (- b last-rat)) (abs (- a last-rat))))
	     (format #t ";- last: ~A is not better than ~A??~%" b a))
	 (if (not (< (magnitude (sqrt (- b last-rat))) (magnitude (sqrt (- a last-rat)))))
	     (format #t ";sqrt last: ~A is not better than ~A??~%" b a)))
       rats (cdr rats)))))

(if with-bignums
    (num-test (- 2 (* 3796553736732654909229441/2684568892382786771291329 3796553736732654909229441/2684568892382786771291329)) 1/7206910137949342581102166717750576215502190586241))
    



;;; --------------------------------------------------------------------------------
;;; random
;;; --------------------------------------------------------------------------------

(let ()
  (define (v n range chker) ; chi^2 or mus-random
    (let ((hits (make-vector 100 0)))
      (do ((i 0 (+ 1 i )))
	  ((= i n))
	(let ((y (random range)))
	  (if (not (chker y))
	      (format #t ";(random ~A) -> ~A?~%" range y))
	  (let ((iy (min 99 (floor (* 100 (/ y range))))))
	    (vector-set! hits iy (+ 1 (vector-ref hits iy))))))
      (let ((sum 0.0)
	    (p (/ n 100.0)))
	(do ((i 0 (+ 1 i)))
	    ((= i 100) sum)
	  (let ((num (- (vector-ref hits i) p)))
	    (set! sum (+ sum (/ (* num num) p))))))))
  
  (num-test (random 0) 0)
  (num-test (random 0.0) 0.0)
  
  (let ()
    (define (rtest) (- (random 2.0) 1.0))
    (do ((i 0 (+ i 1)))
	((= i 100))
      (let ((val (rtest)))
	(if (or (> val 1.0)
		(< val -1.0))
	    (format #t "(- (random 2.0) 1.0): ~A~%" i val)))))
  
  (let ((vr (v 1000 
	       1.0
	       (lambda (val)
		 (and (real? val)
		      (not (negative? val))
		      (<= val 1.0))))))
    (if (or (< vr 40)
	    (> vr 400))
	(format #t ";(random 1.0) not so random? ~A~%" vr)))
  
  (let ((vr (v 1000 
	       100
	       (lambda (val)
		 (and (integer? val)
		      (not (negative? val))
		      (<= val 100))))))
    (if (or (< vr 40)
	    (> vr 400))
	(format #t ";(random 100) not so random? ~A~%" vr)))
  
  (let ((vr (v 1000 
	       1/2
	       (lambda (val)
		 (and (rational? val)
		      (not (negative? val))
		      (<= val 1/2))))))
    (if (or (< vr 40)
	    (> vr 400))
	(format #t ";(random 1/2) not so random? ~A~%" vr)))
  
  (let ((vr (v 1000 
	       -10.0
	       (lambda (val)
		 (and (real? val)
		      (not (positive? val))
		      (>= val -10.0))))))
    (if (or (< vr 40)
	    (> vr 400))
	(format #t ";(random -10.0) not so random? ~A~%" vr)))
  
  (let ((imax 0.0)
	(rmax 0.0)
	(imin 100.0)
	(rmin 100.0))
    (do ((i 0 (+ i 1)))
	((= i 100))
      (let ((val (random 1+i)))
	(set! imax (max imax (imag-part val)))
	(set! imin (min imin (imag-part val)))
	(set! rmax (max rmax (real-part val)))
	(set! rmin (min rmin (real-part val)))))
    (if (or (> imax 1.0)
	    (< imin 0.0)
	    (> rmax 1.0)
	    (< rmin 0.0)
	    (< rmax 0.001)
	    (< imax 0.001))
	(format #t ";(random 1+i): ~A ~A ~A ~A~%" rmin rmax imin imax)))
	
  (let ((imax 0.0)
	(rmax 0.0)
	(imin 100.0)
	(rmin 100.0))
    (do ((i 0 (+ i 1)))
	((= i 100))
      (let ((val (random 0+i)))
	(set! imax (max imax (imag-part val)))
	(set! imin (min imin (imag-part val)))
	(set! rmax (max rmax (real-part val)))
	(set! rmin (min rmin (real-part val)))))
    (if (or (> imax 1.0)
	    (< imin 0.0)
	    (> rmax 0.0)
	    (< rmin 0.0)
	    (< imax 0.001))
	(format #t ";(random 0+i): ~A ~A ~A ~A~%" rmin rmax imin imax)))
	
  (let ((imax 0.0)
	(rmax 0.0)
	(imin 100.0)
	(rmin 100.0))
    (do ((i 0 (+ i 1)))
	((= i 100))
      (let ((val (random 10.0+100.0i)))
	(set! imax (max imax (imag-part val)))
	(set! imin (min imin (imag-part val)))
	(set! rmax (max rmax (real-part val)))
	(set! rmin (min rmin (real-part val)))))
    (if (or (> imax 100.0)
	    (< imin 0.0)
	    (> rmax 10.0)
	    (< rmin 0.0)
	    (< imax 0.1)
	    (< rmax 0.01))
	(format #t ";(random 100+10i): ~A ~A ~A ~A~%" rmin rmax imin imax)))
	
  
  (do ((i 0 (+ i 1)))
      ((= i 100))
    (let ((val (random 1.0+1.0i)))
      (if (or (not (complex? val))
	      (> (real-part val) 1.0)
	      (> (imag-part val) 1.0)
	      (< (real-part val) 0.0))
	  (format #t ";(random 1.0+1.0i) -> ~A?~%" val))))
  
  (let ((rs (random-state 12345678)))
    (do ((i 0 (+ i 1)))
	((= i 100))
      (let ((val (random 1.0 rs)))
	(if (or (not (real? val))
		(negative? val)
		(> val 1.0))
	    (format #t ";(random 1.0 rs) -> ~A?~%" val)))))
  
  (when with-bignums
    (num-test (random (bignum "0")) 0)
    (num-test (random (bignum "0.0")) 0.0)
    
    (let ((vr (v 1000 
		 (bignum "1.0")
		 (lambda (val)
		   (and (real? val)
			(not (negative? val))
			(<= val 1.0))))))
      (if (or (< vr 40)
	      (> vr 400))
	  (format #t ";(big-random 1.0) not so random? ~A~%" vr)))
    
    (let ((vr (v 1000 
		 (bignum "100")
		 (lambda (val)
		   (and (integer? val)
			(not (negative? val))
			(<= val 100))))))
      (if (or (< vr 40)
	      (> vr 400))
	  (format #t ";(big-random 100) not so random? ~A~%" vr)))
    
    (let ((vr (v 1000 
		 (bignum "1/2")
		 (lambda (val)
		   (and (rational? val)
			(not (negative? val))
			(<= val 1/2))))))
      (if (or (< vr 40)
	      (> vr 400))
	  (format #t ";(big-random 1/2) not so random? ~A~%" vr)))
    
    (let ((vr (v 1000 
		 (bignum "-10.0")
		 (lambda (val)
		   (and (real? val)
			(not (positive? val))
			(>= val -10.0))))))
      (if (or (< vr 40)
	      (> vr 400))
	  (format #t ";(big-random -10.0) not so random? ~A~%" vr)))
    
    (do ((i 0 (+ i 1)))
	((= i 100))
      (let ((val (random (bignum "1.0+1.0i"))))
	(if (or (not (complex? val))
		(> (real-part val) 1.0)
		(> (imag-part val) 1.0)
		(< (real-part val) 0.0))
	    (format #t ";(big-random 1.0+1.0i) -> ~A?~%" val))))
    
    (let ((rs (random-state (bignum "12345678"))))
      (do ((i 0 (+ i 1)))
	  ((= i 100))
	(let ((val (random (bignum "1.0") rs)))
	  (if (or (not (real? val))
		  (negative? val)
		  (> val 1.0))
	      (format #t ";(big-random 1.0 rs) -> ~A?~%" val)))
	(let ((val (random 1.0 rs)))
	  (if (or (not (real? val))
		  (negative? val)
		  (> val 1.0))
	      (format #t ";(big-random small-1.0 rs) -> ~A?~%" val)))))
    
    (let ((rs (random-state 1234)))
      (do ((i 0 (+ i 1)))
	  ((= i 100))
	(let ((val (random (bignum "1.0") rs)))
	  (if (or (not (real? val))
		  (negative? val)
		  (> val 1.0))
	      (format #t ";(big-random 1.0 small-rs) -> ~A?~%" val)))
	(let ((val (random 1.0 rs)))
	  (if (or (not (real? val))
		  (negative? val)
		  (> val 1.0))
	      (format #t ";(random small-1.0 rs) -> ~A?~%" val)))))
    ))

(test (random 0 #t) 'error)
(test (random 0.0 #(1 2)) 'error)
(test (nan? (random 1/0)) #t)
(test (zero? (random 1e-30)) #f)

(unless with-bignums
  (test ((object->string (random-state 1234) :readable) 1) #\r) ; print-readably here
  (test ((object->string (random-state 1234)) 1) #\<)) ; write (#t as default) here
(test (random-state 1.0) 'error)
(test (random-state 1+i) 'error)
(test (random-state 3/4) 'error)
(test (random-state 1/0) 'error)
(test (random-state (real-part (log 0))) 'error)
(test (random-state? (random-state 100)) #t)
(test (random-state?) 'error)
(test (random-state? (random-state 100) 100) 'error)
(test (equal? (random-state 1234) #f) #f)
(unless with-bignums
  (test (random-state -1) 'error)
  (test (random-state -1 123) 'error)
  (test (random-state 1 -123) 'error)
  (test (random-state 1 most-negative-fixnum) 'error)
  (test (random-state -9223372036854775808) 'error)

  (let ((r1 (random-state 100))
	(r2 (random-state 100))
	(r3 (random-state 200)))
    (test (random-state? r3) #t)
    (test (equal? r1 r2) #t)
    (test (equal? r1 r3) #f)
    (random 1.0 r1)
    (test (equal? r1 r2) #f)
    (random 1.0 r2)
    (test (equal? r1 r2) #t)
    (test (equal? (copy r1) r1) #t)
    (test (random-state? r2) #t)
    (test (random-state? (copy r1)) #t)))

(test (complex? (random 1+i (random-state 1234))) #t)
(when with-bignums 
  (test (complex? (random (bignum "1+i") (random-state 1234))) #t)
  (test (real? (random (bignum "1.5") (random-state 1234))) #t)
  (test (rational? (random (bignum "1/2") (random-state 1234))) #t)
  (test (integer? (random (bignum "100") (random-state 1234))) #t)
  (test (complex? (random (bignum "1+i") (random-state (bignum "1234")))) #t)
  (test (real? (random (bignum "1.5") (random-state (bignum "1234")))) #t)
  (test (rational? (random (bignum "1/2") (random-state (bignum "1234")))) #t)
  (test (integer? (random (bignum "100") (random-state (bignum "1234")))) #t))

(for-each
 (lambda (arg)
   (test (random arg) 'error)
   (test (random 1.0 arg) 'error)
   (test (random-state arg) 'error)
   (test (random-state->list arg) 'error)
   (test (random-state? arg) #f)
   )
 (list "hi" _ht_ _undef_ _null_ _c_obj_ () '(1 2) #f (integer->char 65) 'a-symbol (make-vector 3) abs #\f (lambda (a) (+ a 1)) (if #f #f) :hi #<eof> #<undefined>))

(when (not with-bignums)
  (test (car (random-state->list (random-state 1234))) 1234)
  (test (pair? (random-state->list)) #t)) ; the default? 
(test (random-state->list #f 1234) 'error)
(test (random-state) 'error)

(let ((r1 (random-state 1234))
      (r2 (random-state 1234)))
  (test (eq? r1 r2) #f)
  (unless with-bignums (test (equal? r1 r2) #t))
  (test (eq? r2 r2) #t)
  (test (equal? r1 r1) #t)
  (test ((object->string r1 #f) 1) #\<) ; display, not write
  (let ((val1 (random 10000000 r1))
	(val2 (random 10000000 r2)))
    (test val1 val2)))

(let ((r1 (random-state 1234))
      (r2 (random-state 1234567)))
  (let ((val1 (random 10000000 r1))
	(val2 (random 10000000 r2)))
    (let ((val3 (random 10000000 r1))
	  (val4 (random 10000000 r2)))
      (let ((val5 (random 10000000 r1))
	    (val6 (random 10000000 r2)))
	(test (or (not (= val1 val2))
		  (not (= val3 val4))
		  (not (= val5 val6)))
	      #t)))))

(when (not with-bignums)
  (let ((r1 (make-vector 10)))
    (let* ((rs1 (random-state 12345))
	   (rs2 (copy rs1))
	   (rs3 (apply random-state (random-state->list rs1)))
	   (rs4 #f)
	   (rs5 #f))
      (do ((i 0 (+ i 1)))
	  ((= i 10))
	(set! (r1 i) (random 1.0 rs1))
	(if (= i 3) 
	    (set! rs4 (copy rs1)))
	(if (= i 5)
	    (set! rs5 (apply random-state (random-state->list rs1)))))
      (do ((i 0 (+ i 1)))
	  ((= i 10))
	(let ((v1 (random 1.0 rs2))
	      (v2 (random 1.0 rs3)))
	  (if (not (= v1 v2 (r1 i)))
	      (format #t ";random v1: ~A, v2: ~A, r1[~A]: ~A~%" v1 v2 i (r1 i))))
	(if (> i 3)
	    (let ((v3 (random 1.0 rs4)))
	      (if (not (= v3 (r1 i)))
		  (format #t ";random v3: ~A, r1[~A]: ~A~%" v3 i (r1 i)))))
	(if (> i 5)
	    (let ((v4 (random 1.0 rs5)))
	      (if (not (= v4 (r1 i)))
		  (format #t ";random v4: ~A, r1[~A]: ~A~%" v4 i (r1 i)))))))))

(do ((i 0 (+ i 1)))
    ((= i 20))              ; this was ((+ i 100)) !! -- surely a warning would be in order?
  (let ((val (random -1.0)))
    (test (and (real? val) (<= val 0.0) (>= val -1.0)) #t))
  (let ((val (random -100)))
    (test (and (integer? val) (<= val 0) (>= val -100)) #t))
  (let ((val (random most-negative-fixnum)))
    (test (and (integer? val) (<= val 0)) #t))
  (let ((val (random most-positive-fixnum)))
    (test (and (integer? val) (>= val 0)) #t))
  (let ((val (random pi)))
    (test (and (real? val) (>= val 0) (< val pi)) #t))
  (let ((val (random 3/4)))
    (test (and (rational? val) (>= val 0) (< val 3/4)) #t))
  (test (let ((x (random most-positive-fixnum))) (integer? x)) #t)
  (if with-bignums
      (begin
	(let ((val (random (expt 2 70))))
	  (test (and (integer? val) (>= val 0)) #t))
	(let ((val (random 1180591620717411303424.0)))
	  (test (and (real? val) (>= val 0.0)) #t)))))
  
(when with-bignums
  (let ((r1 (random-state (expt 2 70))))
    (test (random-state? r1) #t)
    (test ((object->string r1) 1) #\<)
    (test (eq? r1 r1) #t)
    (test (equal? r1 r1) #t)
    (let ((val1 (random 10000000 r1))
	  (val2 (random 10000000 r1)))
      (test (not (= val1 val2)) #t))))

(let () ; optimizer tests
  (define (f1) (- (random 100) 50)) 
  (define (f2) (- (random 1.0) 0.5))
  (define (f3) (random 100))
  (define (f4) (random 1.0))
  (do ((i 0 (+ i 1)))
      ((= i 20))
    (let ((v1 (f1))
	  (v2 (f2))
	  (v3 (f3))
	  (v4 (f4)))
      (if (not (<= -50 v1 50)) (format *stderr* ";f1: sub_random_ic: ~A~%" v1))
      (if (not (<= 0 v3 100)) (format *stderr* ";f3: random_ic: ~A~%" v3))
      (if (not (<= -0.5 v2 0.5)) (format *stderr* ";f2: sub_random_rc: ~A~%" v2))
      (if (not (<= 0.0 v4 1.0)) (format *stderr* ";f4: random_rc: ~A~%" v4)))))

(test (real-part (random 0+i)) 0.0)
	  



;;; --------------------------------------------------------------------------------
;;; string->number 
;;; number->string
;;; --------------------------------------------------------------------------------

(test (string->number "+#.#") #f)
(test (string->number "-#.#") #f)
(test (string->number "#.#") #f)
(test (string->number "#") #f)

(for-each
 (lambda (n)
   (if (not (eqv? n (string->number (number->string n))))
       (format #t ";(string->number (number->string ~A)) = ~A?~%" n (string->number (number->string n)))))
 (list 1 2 3 10 1234 1234000000 500029 362880 0/1 0/2 0/3 0/10 0/1234 0/1234000000 0/500029 
       0/362880 1/1 1/2 1/3 1/10 1/1234 1/1234000000 1/500029 1/362880 2/1 2/2 2/3 2/10 2/1234 
       2/1234000000 2/500029 2/362880 3/1 3/2 3/3 3/10 3/1234 3/1234000000 3/500029 3/362880 
       10/1 10/2 10/3 10/10 10/1234 10/1234000000 10/500029 10/362880 1234/1 1234/2 1234/3 
       1234/10 1234/1234 1234/1234000000 1234/500029 1234/362880 1234000000/1 1234000000/2 1234000000/3 
       1234000000/10 1234000000/1234 1234000000/1234000000 1234000000/500029 1234000000/362880 
       500029/1 500029/2 500029/3 500029/10 500029/1234 500029/1234000000 500029/500029 500029/362880 
       362880/1 362880/2 362880/3 362880/10 362880/1234 362880/1234000000 362880/500029 362880/362880))

(let ((fequal? (lambda (a b) (< (magnitude (- a b)) 1e-14))))
  (for-each
   (lambda (x)
     (if (not (fequal? x (string->number (number->string x))))
	 (format #t ";(string->number (number->string ~A)) -> ~A?~%" x (string->number (number->string x)))))
   (list 0.000000 1.000000 3.141593 2.718282 1234.000000 1234000000.000000 0.000000+0.000000i 0.000000+0.000000i 0.000000+1.000000i 
	 0.000000+3.141593i 0.000000+2.718282i 0.000000+1234.000000i 0.000000+1234000000.000000i 0.000000+0.000000i 0.000000+0.000000i 
	 0.000000+1.000000i 0.000000+3.141593i 0.000000+2.718282i 0.000000+1234.000000i 0.000000+1234000000.000000i 1.000000+0.000000i 
	 1.000000+0.000000i 1.000000+1.000000i 1.000000+3.141593i 1.000000+2.718282i 1.000000+1234.000000i 1.000000+1234000000.000000i 
	 3.141593+0.000000i 3.141593+0.000000i 3.141593+1.000000i 3.141593+3.141593i 3.141593+2.718282i 3.141593+1234.000000i 
	 3.141593+1234000000.000000i 2.718282+0.000000i 2.718282+0.000000i 2.718282+1.000000i 2.718282+3.141593i 2.718282+2.718282i 
	 2.718282+1234.000000i 2.718282+1234000000.000000i 1234.000000+0.000000i 1234.000000+0.000000i 1234.000000+1.000000i 
	 1234.000000+3.141593i 1234.000000+2.718282i 1234.000000+1234.000000i 1234.000000+1234000000.000000i 1234000000.000000+0.000000i 
	 1234000000.000000+0.000000i 1234000000.000000+1.000000i 1234000000.000000+3.141593i 1234000000.000000+2.718282i 1234000000.000000+1234.000000i 
	 1234000000.000000+1234000000.000000i)))

(test (string->number "1+1+i") #f)
(test (string->number "1+i+i") #f)
(test (string->number "1+.i") #f)
(test (string->number ".") #f)
(test (string->number "8.41470984807896506652502321630298999622563060798371065672751709991910404391239668948639743543052695.") #f)
(test (string->number "8.41470184807816506652502321630218111622563060718371065672751701111110404311231668148631743543052695" 9) #f)
(test (number->string -9223372036854775808) "-9223372036854775808")
(test (number->string 9223372036854775807) "9223372036854775807")

(test (number->string 123 8) "173")
(test (number->string 123 16) "7b")
(test (number->string 123 2) "1111011")
(test (number->string -123 8) "-173")
(test (number->string -123 16) "-7b")
(test (number->string -123 2) "-1111011")

(test (number->string 0 8) "0")
(test (number->string 0 2) "0")
(test (number->string 0 16) "0")
(test (number->string 1 8) "1")
(test (number->string 1 2) "1")
(test (number->string 1 16) "1")
(test (number->string -1 8) "-1")
(test (number->string -1 2) "-1")
(test (number->string -1 16) "-1")
(test (string->number "- 1") #f)
(num-test (string->number "1+0i") 1.0)
(num-test (string->number "0-0i") 0.0)
(num-test (string->number "0-0e10i") 0.0)
(num-test (string->number "0-0e40i") 0.0)
(num-test (string->number "0-0e100i") 0.0)
(test (string->number "0e10e100") #f)

(test (equal? (string->number (number->string -1e19)) -1e19) #t)
(test (equal? (string->number (number->string 1e308)) 1e308) #t)
(test (equal? (string->number (number->string 9.22e18)) 9.22e18) #t)

;;; @ exponent added 26-Mar-12
(when (provided? '@-exponent)
  (num-test 0.0 0@0)
  (num-test 0.0 0@-0)
  (num-test 0.0 0@+0)
  (num-test 1.0 1@0)
  (num-test 10.0 1@1)
  (num-test 10.0 1@+1)
  (num-test 0.1 1@-1)
  
  (num-test (string->number "1@0" 16) 1.0)
  (num-test (string->number "e@0" 16) 14.0)
  (num-test (string->number "a@1" 16) 160.0)
  (num-test (string->number "#xa@1") 160.0)
  (num-test (string->number ".a@0" 12) 0.83333333333333)
  (num-test (string->number "a.@0" 16) 10.0)
  (num-test (string->number "0a" 16) 10)
  (num-test (string->number "a@-1" 16) 0.625)
  
  (num-test 1@0+1@0i 1+1i)
  (num-test (string->number "1@1" 12) 12.0)
  (num-test (string->number "1@-1" 16) 0.0625)
  (num-test (string->number "1.0@1+0.1@2i" 16) 16+16i)
  (num-test (string->number "#b.0@2") 0.0)
  (num-test (string->number ".2@-22") 2e-23)
  (num-test (string->number "+02@02") 200.0)
  (num-test (string->number "2fe2@2" 16) 3138048.0)
  (num-test (string->number "1@-0-bc/di" 16) 1-14.461538461538i)
  (num-test (string->number ".f-a.c1@0i" 16) 0.9375-10.75390625i)
  (num-test (string->number "df2@2-ccfi" 16) 913920-3279i)
  (num-test (string->number "0/0de-0@2i" 16) 0.0)
  (num-test (string->number "-1a12cd.@1" 16) -27339984.0)
  (num-test (string->number "fb/2ea+2@+1i" 16) 0.33646112600536+32i)
  (num-test (string->number "af.e0@-0+0b/efefd11i" 16) 175.875+4.3721589140015e-08i)
  (num-test (string->number "bb10@1-i" 12) 247248-1i)
  (num-test (string->number "b.+0@01i" 12) 11.0)
  (num-test (string->number "-0@-0221" 12) 0.0)
  (num-test (string->number "-a-01@2i" 12) -10-144i)
  (num-test (string->number "-111@-1-1i" 10) -11.1-1i)
  (num-test (string->number "122@9-2@0i" 10) 122000000000-2i)
  (num-test (string->number "-0@+10-20i" 10) 0-20i)
  (num-test (string->number "+2@-909221" 10) 0.0))

;; s7.html claims this '=' is guaranteed...
(test (= .6 (string->number ".6")) #t)
(test (= 0.60 (string->number "0.60")) #t)
(test (= 60e-2 (string->number "60e-2")) #t)
(test (= 0.11 (string->number "0.11")) #t)
(test (= 0.999 (string->number "0.999")) #t)
(test (= 100.000 (string->number "100.000")) #t)
(test (= 1e10 (string->number "1e10")) #t)
(test (= 0.18 (string->number "0.18")) #t)
(test (= 0.3 (string->number "0.3")) #t)
(test (= 0.333 (string->number "0.333")) #t)
(test (= -1/10 (string->number "-1/10")) #t)
(test (= -110 (string->number "-110")) #t)
(test (= 1+i (string->number "1+i")) #t)
(test (= 0.6-.1i (string->number "0.6-.1i")) #t)

;; but is this case also guaranteed??
(when (not with-bignums)
  (test (= .6 (string->number (number->string .6))) #t)
  (test (= 0.6 (string->number (number->string 0.6))) #t)
  (test (= 0.60 (string->number (number->string 0.60))) #t)
  (test (= 60e-2 (string->number (number->string 60e-2))) #t)
  (test (= 0.6-.1i (string->number (number->string 0.6-.1i))) #t))
(test (= 0.11 (string->number (number->string 0.11))) #t)
(test (= 0.999 (string->number (number->string 0.999))) #t)
(test (= 100.000 (string->number (number->string 100.000))) #t)
(test (= 1e10 (string->number (number->string 1e10))) #t)
(test (= 0.18 (string->number (number->string 0.18))) #t)
(test (= 0.3 (string->number (number->string 0.3))) #t)
(test (= 0.333 (string->number (number->string 0.333))) #t)
(test (= -1/10 (string->number (number->string -1/10))) #t)
(test (= -110 (string->number (number->string -110))) #t)
(test (= 1+i (string->number (number->string 1+i))) #t)

(test (= 0.6 0.600) #t)
(test (= 0.6 6e-1 60e-2 .06e1 6.e-1) #t)
(test (= 0.6 6e-1 60e-2 .06e1 600e-3 6000e-4 .0006e3) #t)
(test (= 0.3 0.3000) #t)
(test (= 0.345 0.345000 345.0e-3) #t)

(test (string->number #u8(0 0 0 0 0) #\a) 'error)
(test (string->number "" "") 'error)

#|
;; scheme spec says (eqv? (number->string (string->number num radix) radix) num) is always #t
;;   (also that radix is 10 if num is inexact)
;; currently in s7, if m below is 0, s7 is ok, but if there's a true integer part, we sometimes lose by 1e-15 or so
(let ()
  (do ((m 0 (+ m 1)))
      ((= m 10))
    (do ((i 0 (+ i 1)))
	((= i 10))
      (do ((j 0 (+ j 1)))
	  ((= j 10))
	(do ((k 0 (+ k 1)))
	    ((= k 10))
	  (let* ((str (string (integer->char (+ (char->integer #\0) i))
			      (integer->char (+ (char->integer #\0) j))
			      (integer->char (+ (char->integer #\0) k))))
		 (strd (string (integer->char (+ (char->integer #\0) m))))
		 (str1 (string-append strd "." str))
		 (str2 (string-append (if (= m 0) "" strd) "." str "000"))
		 (str3 (string-append strd str "e-3"))
		 (str4 (string-append strd str ".e-3"))
		 (str5 (string-append "0.0" strd str "e2"))
		 (str6 (string-append ".00000" strd str "e6"))
		 (str7 (string-append strd str "00e-5"))
		 (args (list (string->number str1)
			     (string->number str2)
			     (string->number str3)
			     (string->number str4)
			     (string->number str5)
			     (string->number str6)
			     (string->number str7))))
	    (if (not (apply = args))
		(format #t "~A.~A: ~{~D~^~4T~}~%" strd str
			(map (lambda (val)
			       (let ((ctr 0))
				 (for-each
				  (lambda (arg)
				    (if (not (equal? val arg))
					(set! ctr (+ ctr 1))))
				  args)
				 ctr))
			     args)))))))))
|#

(test (number->string 1/0) "nan.0")
(test (number->string 1/0 2) "nan.0")
(test (number->string 1/0 10) "nan.0")
(test (number->string 1/0 16) "nan.0")
(test (number->string 1000000000000000000000000000000000/0) "nan.0")
(test (number->string 0/1000000000000000000000000000000000) "0")
(test (object->string 1/0) "nan.0")
(test (format #f "~F" 1/0) "nan.0")
(test (format #f "~E" 1/0) "nan.0")
(test (format #f "~G" 1/0) "nan.0")
(test (format #f "~D" 1/0) "nan.0")
(test (format #f "~X" 1/0) "nan.0")
(test (format #f "~B" 1/0) "nan.0")
(test (format #f "~O" 1/0) "nan.0")
(test (format #f "~A" 1/0) "nan.0")
(test (format #f "~S" 1/0) "nan.0")
(test (format #f "~P" 1/0) "s")
(test (nan? (string->number "nan.0")) #t)
(test (nan? (string->number "nan.0" 2)) #t)

(test (number->string (real-part (log 0.0))) "-inf.0")
(test (number->string (real-part (log 0.0)) 2) "-inf.0")
(test (number->string (real-part (log 0.0)) 16) "-inf.0")
(test (number->string (- (real-part (log 0.0)))) "inf.0")
(test (number->string (- (real-part (log 0.0))) 2) "inf.0")
(test (format #f "~G" (real-part (log 0))) "-inf.0")
(test (format #f "~E" (real-part (log 0))) "-inf.0")
(test (format #f "~F" (real-part (log 0))) "-inf.0")
(test (format #f "~D" (real-part (log 0))) "-inf.0")
(test (format #f "~X" (real-part (log 0))) "-inf.0")
(test (format #f "~B" (real-part (log 0))) "-inf.0")
(test (format #f "~O" (real-part (log 0))) "-inf.0")
(test (format #f "~A" (real-part (log 0))) "-inf.0")
(test (format #f "~S" (real-part (log 0))) "-inf.0")
(test (format #f "~P" (real-part (log 0))) "s")
(test (infinite? (string->number "inf.0")) #t)
(test (infinite? (string->number "inf.0" 16)) #t)
(test (infinite? (string->number "-inf.0")) #t)
(test (infinite? (string->number "-inf.0" 16)) #t)
(test (negative? (string->number "-inf.0")) #t)

;(test (number->string 0+0/0i 2) "0-nani") ; there are too many possible correct choices

(test (equal? 0.0 0e0) #t)
(test (equal? 0.0 -0.0) #t)
(test (eqv? 0.0 -0.0) #t)
(test (equal? 0.0 0e-0) #t)
(test (equal? 0.0 .0e+0) #t)
(test (equal? 0.0 00000000000000000000000000000000000000000000000000000e100) #t)
(test (equal? 0.0 .0000000000000000000000000000000000000000000000000000e100) #t)
(test (equal? 0.0 00000000000000000000000000000000000000000000000000000.0000000000000000000000000000000000000000000000000000000000e100) #t)
(test (equal? 0.0 0e100000000000000000000000000000000000000000000000000000000000000000000000) #t)

(num-test 0 0/1000000000)
(num-test 0 0/100000000000000000000000000000000000000)
(num-test 0 0/100000000000000000000000000000000000000000000000000000000000000)
(num-test 0 0/100000000000000000000000000000000000000000000000000000000000000000000)
(num-test 0 -0/100000000000000000000000000000000000000000000000000000000000000000000)

(num-test 0 0/1000000000+0/1000000000i)
(num-test 0 0/100000000000000000000000000000000000000-0/100000000000000000000000000000000000000i)
(num-test 0 0/100000000000000000000000000000000000000000000000000000000000000+0/100000000000000000000000000000000000000000000000000000000000000i)
(num-test 0 0/100000000000000000000000000000000000000000000000000000000000000000000-0/100000000000000000000000000000000000000000000000000000000000000000000i)

(num-test 0 0+0/1000000000i)
(num-test 0 0-0/100000000000000000000000000000000000000i)
(num-test 0 0+0/100000000000000000000000000000000000000000000000000000000000000i)
(num-test 0 0-0/100000000000000000000000000000000000000000000000000000000000000000000i)

(num-test 0 0/1000000000+0i)
(num-test 0 0/100000000000000000000000000000000000000-0i)
(num-test 0 0/100000000000000000000000000000000000000000000000000000000000000+0i)
(num-test 0 0/100000000000000000000000000000000000000000000000000000000000000000000-0i)

(when with-bignums
  (test (< 0 1000000000000000000000000000000000) #t)
  (test (> 0 -1000000000000000000000000000000000) #t))

#|
;;; are these worth fixing?
:(* 0 1000000000000000000000000000000000)
nan.0
:(* 0.0 1000000000000000000000000000000000)
nan.0
:(integer? 1000000000000000000000000000000000)
#f
:(positive? 1/1000000000000000000000000000000000)
#f
:(exact? 1/1000000000000000000000000000000000)
#f
:(floor  1/1000000000000000000000000000000000)
;floor argument 1, nan.0, is out of range (argument is NaN)
etc....

10000000000000000000000000000/10000000000000000000000000000 
|#

(test (equal? 0.0 0.0e10) #t)
(test (equal? 0.0 0e100) #t)
(test (equal? 0.0 0.0e1000) #t)
(test (equal? 0.0 0e+1000) #t)
(test (equal? 0.0 0.0e-1) #t)
(test (equal? 0.0 0e-10) #t)
(test (equal? 0.0 0.0e-100) #t)
(test (equal? 0.0 0e-1000) #t)
(test (equal? 0.0 0.0e0123456789) #t)

(test (equal? 0.0 0-0e10i) #t)
(test (equal? 0.0 0-0.0e100i) #t)
(test (equal? 0.0 0-0e1000i) #t)
(test (equal? 0.0 0-0.0e+1000i) #t)
(test (equal? 0.0 0-0e-1i) #t)
(test (equal? 0.0 0-0.0e-10i) #t)
(test (equal? 0.0 0-0e-100i) #t)
(test (equal? 0.0 0-0.0e-1000i) #t)
(test (equal? 0.0 0.0+0e0123456789i) #t)
(num-test 0.0 1e-1000)

(num-test 0e123412341231231231231231231231231231 0.0)
(num-test 0e-123412341231231231231231231231231231 0.0)
(num-test 0.00000e123412341231231231231231231231231231 0.0)
(num-test .0e-123412341231231231231231231231231231 0.0)
(num-test 2e-123412341231231231231 0.0)
(num-test 2e-123412341231231231231231231231231231 0.0)
(num-test 2.001234e-123412341231231231231 0.0)
(num-test .00122e-123412341231231231231231231231231231 0.0)
(num-test 2e00000000000000000000000000000000000000001 20.0)
(num-test 2e+00000000000000000000000000000000000000001 20.0)
(num-test 2e-00000000000000000000000000000000000000001 0.2)
(num-test 2e-9223372036854775807 0.0)
(num-test 2000.000e-9223372036854775807 0.0)

(unless with-bignums
  (test (infinite? 2e123412341231231231231) #t)
  (test (infinite? 2e12341234123123123123123123) #t)
  (test (infinite? 2e12341234123123123123213123123123) #t)
  (test (infinite? 2e9223372036854775807) #t))
      
;;  (do ((i 0 (+ i 1)) (n 1 (* n 2))) ((= i 63)) (display n) (display " ") (display (number->string n 16)) (newline))

(test (number->string 3/4 2) "11/100")
(test (number->string 3/4 8) "3/4")
(test (number->string 3/4 16) "3/4")
(test (number->string -3/4 2) "-11/100")
(test (number->string -3/4 8) "-3/4")
(test (number->string -3/4 16) "-3/4")

(num-test (string->number "1/2") 1/2)
(test (nan? (string->number "1/0")) #t)
(test (nan? (string->number "0/0")) #t)
(test (nan? 0/0) #t)
(test (string->number "1.0/0.0") #f)
(test (string->number "'1") #f)
(test (string->number "`1") #f)
(test (string->number ".@0") #f)
(test (string->number "+.@0") #f)
(test (string->number "+.-i") #f)
(test (string->number "+.-0i") #f)
(num-test (string->number "10111/100010" 2) 23/34) 
(num-test (string->number "27/42" 8) 23/34) 
(num-test (string->number "17/22" 16) 23/34) 
(num-test (string->number "-10111/100010" 2) -23/34) 
(num-test (string->number "-27/42" 8) -23/34) 
(num-test (string->number "-17/22" 16) -23/34) 
(num-test (string->number "11/100" 2) 3/4)

(test (number->string 23/34 2) "10111/100010")
(test (number->string 23/34 8) "27/42")
(test (number->string 23/34 16) "17/22")
(test (number->string -23/34 2) "-10111/100010")
(test (number->string -23/34 8) "-27/42")
(test (number->string -23/34 16) "-17/22")

(test (number->string -1 16) "-1")
;(test (number->string #xffffffffffffffff 16) "-1") -- is this a bug? 
(when (not with-bignums) 
  ;(test (= #xffffffffffffffff -1) #t) ; this is an overflow
  (test (= #x8000000000000000 -9223372036854775808) #t))
(test (= #x7fffffffffffffff 9223372036854775807) #t)
(test (number->string 9223372036854775807 16) "7fffffffffffffff")
(test (number->string -9223372036854775808 16) "-8000000000000000")
(test (number->string #o777777777777777777777) "9223372036854775807")
(when (not with-bignums)
  (test (number->string #o1000000000000000000000) "-9223372036854775808")
  (test (number->string #b1000000000000000000000000000000000000000000000000000000000000000) "-9223372036854775808"))

(num-test (string->number "3/4+1/2i") 0.75+0.5i)
(num-test (string->number "3/4+i") 0.75+i)
(num-test (string->number "0+1/2i") 0+0.5i)
(test (string->number "3+0i/4") #f)
(num-test (string->number "3/4+0i") 0.75)

(test (string->number " 1.0") #f)
(test (string->number "1.0 ") #f)
(test (string->number "1.0 1.0") #f)
;(test (string->number (string #\1 (integer->char 0) #\0)) 1) ; ?? Guile returns #f
(test (string->number "1+1 i") #f)
(test (string->number "1+ei") #f)
(test (string->number " #b1") #f)
(test (string->number "#b1 ") #f)
(test (string->number "#b1 1") #f)
(test (string->number "#b 1") #f)
(test (string->number "# b1") #f)
(test (string->number "#b12") #f)
(test (string->number "000+1") #f)
(test (string->number (string (integer->char 216))) #f) ; slashed 0
(test (string->number (string (integer->char 189))) #f) ; 1/2 as single char
(test (string->number (string #\1 (integer->char 127) #\0)) #f) ; backspace

(test (string->number "1\
2") 12)

(test (string->number "1E1") 10.0)
(test (string->number "1e1") 10.0)
(num-test (string->number "1234567890123456789012345678901234567890.123456789e-30") 1234567890.1235)
(num-test (string->number "123456789012345678901234567890123456789012345678901234567890.123456789e-50") 1234567890.1235)
(num-test (- 1234567890123456789012345678901234567890123456789012345678901234567890.123456789e-60 12345678901234567890123456789012345678901234567890.123456789e-40) 0.0)
(num-test (string->number "#b000100111110110010011010100001.10111010011000100e1" 2) 167136579.45612)
(num-test (string->number "000100111110110010011010100001.10111010011000100e1" 2) 167136579.45612)
(num-test (string->number "#b1010100100110001111001001100101010011111010100110110.00011001001011101111101111111000110100100111011100100e-59") 5.163418497654431203689554326589836167902E-3)
(num-test (string->number "#b01010011000101001010000101011001111110000010110010.1000000000111001011010110110011111101011100000100e-3") 4.567403573967031260951910866285885504112E13)

(num-test 0000000000000000000000000001.0 1.0)
(num-test 1.0000000000000000000000000000 1.0)
(num-test 1000000000000000000000000000.0e-40 1.0e-12)
(num-test 0.0000000000000000000000000001e40 1.0e12)
(num-test 1.0e00000000000000000001 10.0)
(num-test 12341234.56789e12 12341234567889999872.0)
(num-test -1234567890123456789.0 -1234567890123456768.0)
(num-test 12345678901234567890.0 12345678901234567168.0)
(num-test 123.456e30 123456000000000012741097792995328.0)
(num-test 12345678901234567890.0e12 12345678901234569054409354903552.0)
(num-test 1.234567890123456789012e30 1234567890123456849145940148224.0)
(num-test 1e20 100000000000000000000.0)
(num-test 1234567890123456789.0 1234567890123456768.0)
(num-test 123.456e16 1234560000000000000.0)
(num-test 98765432101234567890987654321.0e-5 987654321012345728401408.0)
(num-test 98765432101234567890987654321.0e-10 9876543210123456512.0)
(num-test 0.00000000000000001234e20 1234.0)
(num-test 0.000000000000000000000000001234e30 1234.0)
(num-test 0.0000000000000000000000000000000000001234e40 1234.0)
(num-test 0.000000000012345678909876543210e15 12345.678909877)
(num-test 98765432101234567890987654321.0e-20 987654321.012346)
(num-test 98765432101234567890987654321.0e-29 0.98765432101235)
(num-test 98765432101234567890987654321.0e-30 0.098765432101235)
(num-test 98765432101234567890987654321.0e-28 9.8765432101235)
(num-test 1.0123456789876543210e1 10.12345678987654373771)
(num-test 1.0123456789876543210e10 10123456789.87654304504394531250)
(num-test 0.000000010000000000000000e10 100.0)
(num-test 0.000000010000000000000000000000000000000000000e10 100.0)
(num-test 0.000000012222222222222222222222222222222222222e10 122.22222222222222)
(num-test 0.000000012222222222222222222222222222222222222e17 1222222222.222222)
(num-test (- (string->number "769056139124082.") (string->number "769056139124080.")) 2.0)

(num-test (string->number "0000000000000000000000000001.0") 1.0)
(num-test (string->number "1.0000000000000000000000000000") 1.0)
(num-test (string->number "1000000000000000000000000000.0e-40") 1.0e-12)
(num-test (string->number "0.0000000000000000000000000001e40") 1.0e12)
(num-test (string->number "1.0e00000000000000000001") 10.0)
(num-test (string->number "12341234.56789e12") 12341234567889999872.0)
(num-test (string->number "-1234567890123456789.0") -1234567890123456768.0)
(num-test (string->number "12345678901234567890.0") 12345678901234567168.0)
(num-test (string->number "123.456e30") 123456000000000012741097792995328.0)
(num-test (string->number "12345678901234567890.0e12") 12345678901234569054409354903552.0)
(num-test (string->number "1.234567890123456789012e30") 1234567890123456849145940148224.0)
(num-test (string->number "1e20") 100000000000000000000.0)
(num-test (string->number "1234567890123456789.0") 1234567890123456768.0)
(num-test (string->number "123.456e16") 1234560000000000000.0)
(num-test (string->number "98765432101234567890987654321.0e-5") 987654321012345728401408.0)
(num-test (string->number "98765432101234567890987654321.0e-10") 9876543210123456512.0)
(num-test (string->number "0.00000000000000001234e20") 1234.0)
(num-test (string->number "0.000000000000000000000000001234e30") 1234.0)
(num-test (string->number "0.0000000000000000000000000000000000001234e40") 1234.0)
(num-test (string->number "0.000000000012345678909876543210e15") 12345.678909877)
(num-test (string->number "98765432101234567890987654321.0e-20") 987654321.012346)
(num-test (string->number "98765432101234567890987654321.0e-29") 0.98765432101235)
(num-test (string->number "98765432101234567890987654321.0e-30") 0.098765432101235)
(num-test (string->number "98765432101234567890987654321.0e-28") 9.8765432101235)
(num-test (string->number "1.0123456789876543210e1") 10.12345678987654373771)
(num-test (string->number "1.0123456789876543210e10") 10123456789.87654304504394531250)
(num-test (string->number "0.000000010000000000000000e10") 100.0)
(num-test (string->number "0.000000010000000000000000000000000000000000000e10") 100.0)
(num-test (string->number "0.000000012222222222222222222222222222222222222e10") 122.22222222222222)
(num-test (string->number "0.000000012222222222222222222222222222222222222e17") 1222222222.222222)
(num-test (string->number "1.1001001000011111101101010100010001000010110100010011" 2) 1.5707963267949)

(num-test #x0000000000000000000000000001.0 1.0)
(num-test #x1.0000000000000000000000000000 1.0)
;(test (number->string 1222222222.222222 16) "48d9a18e.38e38c")
(num-test (string->number (number->string 1222222222.222222222222222222 16) 16) 1222222222.222222222222222222)

(if with-bignums
    (num-test (string->number "179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0")
	      179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0)
    (num-test (string->number "179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0")
	      1.7976931348623e+308))

(when with-bignums
  (num-test (string->number (number->string (bignum "12345.67890987654321") 2) 2) 12345.67890987654321)
  (test (number->string 1234.5678909876543212345 16) "4.d291614dc3ab1f80e55a563311b8f308@2")
  (test (number->string -1234.5678909876543212345 16) "-4.d291614dc3ab1f80e55a563311b8f308@2")
  (test (number->string 1234.5678909876543212345e8 16) "1.cbe991a6ac3f35c11868cb7e3fb75536@9")
  (test (number->string 1234.5678909876543212345e-8 16) "c.f204983a27e1eff701c562a870641e5@-5")
  (test (number->string 123456789098765432.12345e-8 16) "4.99602d2fcd6e9e1748ba5adccc12c5a8@7")
  (test (number->string 123456789098765432.1e20 16) "9.49b0f70beeac8895e74b18b968@30"))

(num-test (string->number "12345678900000000000.0") 1.23456789e+19)
(num-test (string->number "1234567890000000000000000000000000000000000000000000000000000000000000.0") 1.23456789e+69)
(num-test (string->number "1234567890000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0") 1.23456789e+129)

(num-test (string->number "1.1e4" 5) 750.0)
(num-test (string->number "1.1e4" 4) 320.0)
(num-test (string->number "1.1e4" 3) 108.0)
(num-test (string->number "1.1e4" 2) 24.0)

(num-test #b111111111111111111111111111111111111111111111111111111111111111 most-positive-fixnum)
(num-test #o777777777777777777777 most-positive-fixnum)
(num-test #x7fffffffffffffff most-positive-fixnum)
(num-test #o-1000000000000000000000 most-negative-fixnum)
(num-test #x-8000000000000000 most-negative-fixnum)
(num-test #b-1000000000000000000000000000000000000000000000000000000000000000 most-negative-fixnum)

(test (number->string 1.0 most-negative-fixnum) 'error)
(test (number->string 1.0 most-positive-fixnum) 'error)
(test (string->number "1.0" most-negative-fixnum) 'error)
(test (string->number "1.0" most-positive-fixnum) 'error)
(test (number->string 16 17) 'error)
(test (number->string -0. 11 -) 'error)
(test (string->number "11" 2 -) 'error)

(test (string->number "1.0F") #f)
(test (string->number "1F") #f)
(test (string->number "1d") #f)
(test (string->number "1.0L") #f)
(test (string->number "1.0+1.0Ei") #f)
(test (string->number "0xff") #f)

;; duplicate various non-digit chars
(for-each
 (lambda (str)
   (test (string->number str) #f))
 (list "..1" "1.." "1..2" "++1" "+-1" "-+1" "--1" "-..1" "+..1" "1+i+" "1+i."
       "1++i" "1--i" "1.ee1" "1+1..i" "1+ii" "1+1ee1i" "1e1e1" "1+2i.i"
       "1//2" "1+.1/2i" "1+1//2i" "1+1/2" "1i" "1ii" "1+.i" "1+..i"))

(test (number->string most-positive-fixnum 2) "111111111111111111111111111111111111111111111111111111111111111")
(test (number->string most-positive-fixnum 8) "777777777777777777777")
(test (number->string most-positive-fixnum 16) "7fffffffffffffff")
(test (number->string most-positive-fixnum 10) "9223372036854775807")
(test (number->string most-negative-fixnum 10) "-9223372036854775808")
(test (number->string most-negative-fixnum 8) "-1000000000000000000000")
(test (number->string most-negative-fixnum 16) "-8000000000000000")
(test (number->string most-negative-fixnum 2) "-1000000000000000000000000000000000000000000000000000000000000000")

(test (string->number "111111111111111111111111111111111111111111111111111111111111111" 2) most-positive-fixnum)
(test (string->number "777777777777777777777" 8) most-positive-fixnum)
(test (string->number "7fffffffffffffff" 16) most-positive-fixnum)
(test (string->number "9223372036854775807" 10) most-positive-fixnum)
(test (string->number "-9223372036854775808" 10) most-negative-fixnum)
(test (string->number "-1000000000000000000000" 8) most-negative-fixnum)
(test (string->number "-8000000000000000" 16) most-negative-fixnum)
(test (string->number "-1000000000000000000000000000000000000000000000000000000000000000" 2) most-negative-fixnum)

(test (string->number (string #\1 #\. #\0 (integer->char 128) #\1)) #f)
(test (string->number (string #\1 #\. #\0 (integer->char 20) #\1)) #f)
(test (string->number (string #\1 #\. #\0 (integer->char 200) #\1)) #f)
(test (string->number (string #\1 #\. #\0 (integer->char 255) #\1)) #f)
(test (string->number (string #\1 #\. #\0 (integer->char 2) #\1)) #f)
(test (string->number (string #\1 #\. (integer->char 128) #\1)) #f)
(test (string->number (string #\1 #\. (integer->char 20) #\1)) #f)
(test (string->number (string #\1 #\. (integer->char 200) #\1)) #f)
(test (string->number (string #\1 #\. (integer->char 255) #\1)) #f)
(test (string->number (string #\1 #\. (integer->char 2) #\1)) #f)
(test (string->number (string #\1 (integer->char 128) #\1)) #f)
(test (string->number (string #\1 (integer->char 20) #\1)) #f)
(test (string->number (string #\1 (integer->char 200) #\1)) #f)
(test (string->number (string #\1 (integer->char 255) #\1)) #f)
(test (string->number (string #\1 (integer->char 2) #\1)) #f)
(test (string->number (string (integer->char 128) #\1)) #f)
(test (string->number (string (integer->char 20) #\1)) #f)
(test (string->number (string (integer->char 200) #\1)) #f)
(test (string->number (string (integer->char 255) #\1)) #f)
(test (string->number (string (integer->char 2) #\1)) #f)
(test (string->number (string (integer->char 128) #\/ #\2)) #f)
(test (string->number (string (integer->char 20) #\/ #\2)) #f)
(test (string->number (string (integer->char 200) #\/ #\2)) #f)
(test (string->number (string (integer->char 255) #\/ #\2)) #f)
(test (string->number (string (integer->char 2) #\/ #\2)) #f)
(do ((i 103 (+ i 1)))
    ((= i 256))
  (test (string->number (string (integer->char i))) #f)
  (test (string->number (string (integer->char i) #\. #\0)) #f))
(test (string->number "1,000") #f)
(test (string->number "1 000") #f)
(test (string->number "1 / 2") #f)
(test (string->number "1 .2") #f)
(test (string->number "1:") #f)
(test (string->number "#b 1") #f)

#|
(do ((i 20 (+ i 1)))
    ((= i 128))
  (let ((str (string-append "#" (string (integer->char i)) "1.0e8")))
    (catch #t (lambda ()
		(let ((val (eval-string str)))
		  (format #t "~A -> ~S~%" str val)))
	   (lambda args 'error))))
|#
(num-test #b1.0e8 256.0)
(num-test #o1.0e8 16777216.0)
(num-test #x1.0e8 1.056640625) ; e is a digit

(if with-bignums
    (num-test #b1.1111111111111111111111111111111111111111111111111110011101010100100100011001011011111011000011001110110101010011110011000100111E1023 1.7976931348623156E308))

(test (number->string 1/9 2) "1/1001")
(test (number->string -11/4 2) "-1011/100")
(test (number->string -11/4 8) "-13/4")
(test (number->string -15/4 16) "-f/4")
(test (string->number "f/4" 16) 15/4)
(test (string->number "#b'0") #f)
(test (string->number "#b0/0") #f)
(test (string->number "#b-1/0") #f)
(test (string->number "1e1/2") #f)
(test (string->number "1e#b0") #f)
(test (string->number "#B0") #f)
(test (string->number "0+I") #f)

(num-test (string->number "#x10+10i") 16+16i)
(num-test 00-10e+001i 0-100i)
(num-test (string->number "#x+e/00011ee0") 7/36720)
(num-test (string->number "-1.-00.0e+10i") -1.0)
(num-test (string->number "#x+1e1.+e10i") 481+3600i)
(num-test (string->number "#xe/e+e/ei") 1+1i)
(num-test (string->number "1e-0-.11e+1i") 1-1.1i)
(num-test (string->number "00.-1.1e-00i") 0-1.1i)
(num-test (string->number "+01.e+1+.00i") 10.0)
(num-test (string->number "#x1e0/e+0/ei") 34.285714285714)
(num-test (string->number "+01e0+00.i") 1.0)
(num-test (string->number "+0/0100+0i") 0.0)
(num-test (string->number "#x-e1e/eee") -139/147)
(num-test (string->number "#x-0101.+00/11i") -257.0)
(num-test (string->number "#x+ee.-e00e0110i") 238-3759014160i)
(num-test (string->number "#x-e0/1ee") -112/247)

(num-test (string->number "+01e01+0/1i") 10.0)
(num-test (string->number "1.-0.0e+00i") 1.0)
(num-test (string->number "#x1/7e2") 1/2018)

(num-test (string->number "0.1e00" 2) 0.5)
(num-test (string->number "10.101" 2) 2.625)
(num-test (string->number "0e1010" 2) 0.0)
(num-test (string->number ".1e010" 2) 512.0)
(num-test (string->number "1/000100" 2) 1/4)
(num-test (string->number "1000e+03" 2) 64.0)
(num-test (string->number "-1e+1-1i" 2) -2-1i)
(num-test (string->number ".1-110e03i" 2) 0.5-48i)
(num-test (string->number "1e9" 2) 512.0)

(num-test (string->number "52/7" 8) 6)
(num-test (string->number "130." 8) 88.0)
(num-test (string->number "121.-16i" 8) 81-14i)
(num-test (string->number "12/15150" 8) 1/676)
(num-test (string->number "612444175735" 8) 52958395357)
(num-test (string->number "31005331+.4i" 8) 6556377+0.5i)
(num-test (string->number "42220e-2" 8) 274.25)
(num-test (string->number "1e9" 8) 134217728.0)
(test (string->number "1e9" 12) #f) ; this may not be ideal...
(num-test (string->number "1b9/64" 12) 15/4)
(num-test (string->number "a880+i" 12) 18528+1i)
(num-test (string->number "dc-i" 16) 220-1i)
(num-test (string->number "dcd-fi" 16) 3533-15i)
(num-test (string->number "d/ebee" 16) 1/4646)
(num-test (string->number "a.d-ci" 16) 10.8125-12i)
(num-test (string->number "fac/ed" 16) 4012/237)
(num-test (string->number "-ccdebef.a" 16) -214821871.625)
(num-test (string->number "+dfefc/c" 16) 76437)
(num-test (string->number "acd/eabf" 16) 79/1717)
(num-test (string->number "-1e-1-1e-1i") -0.1-0.1i)
(num-test (string->number "+1e+1+1e+1i") 10+10i)
(test (= 1e19 .1e20) #t)

(test (string->number "15+b7a9+8bbi-95+4e" 16) #f)
(num-test (string->number "776.0a9b863471095a93" 12) 1098.0752175102)
(num-test (string->number "a72972b301/398371448" 12) 54708015601/1637213240)
(num-test (string->number "+ac946/b72ddf4847ce6" 16) 353443/1611261179739763)
(num-test (string->number "b85.361c23cec099e742" 15) 2600.2272029731)
(num-test (string->number "ade2411.a1422432dea8" 15) 1.24494541672338806082296187159063753079E8)
(num-test (string->number "da99007963b182/8a66b" 15) 26681038227104972/440201)
(num-test (string->number "74cc.d+b44.02a11ee5i" 15) 24717.866666667+2539.0118742348i)
(num-test (string->number "d+7a5d40di" 14) 13+58313541i)

(test (nan? (string->number "1/0")) #t)
(test (nan? (string->number "5639d72702b62527/0" 14)) #t)
(test (nan? (string->number "-28133828f9421ef5/0" 16)) #t)
(test (nan? (string->number "+4a11654f7e00d5f2/0" 16)) #t)

(when (and with-bignums (not pure-s7))
  (test (number->string (/ most-positive-fixnum most-negative-fixnum) 2) "-111111111111111111111111111111111111111111111111111111111111111/1000000000000000000000000000000000000000000000000000000000000000")
  (test (string->number "-111111111111111111111111111111111111111111111111111111111111111/1000000000000000000000000000000000000000000000000000000000000000" 2) -9223372036854775807/9223372036854775808)
  (num-test (string->number "b2706b3d3e8e46ad5aae" 15) 247500582888444441302414)
  (num-test (string->number "ceec932122d7c22289da9144.4b7836de0a2f5ef" 16) 6.403991331575236168367699181229480307503E28)
  (num-test (string->number "c23177c20fb1296/fcf15a82c8544613721236e2" 16) 437284287268358475/39141000511500755277510679409)
  
  (num-test (string->number "775f81b8fee51b723f" 16) 2202044529881940455999)
  (num-test (string->number "5d9eb6d6496f5c9b6e" 16) 1726983762769631550318)
  (num-test (string->number "+775f81b8fee51b723f" 16) 2202044529881940455999)
  (num-test (string->number "+5d9eb6d6496f5c9b6e" 16) 1726983762769631550318)
  (num-test (string->number "-775f81b8fee51b723f" 16) -2202044529881940455999)
  (num-test (string->number "-5d9eb6d6496f5c9b6e" 16) -1726983762769631550318)
  (num-test (string->number "+d053d635e581a5c4/d7" 16) 15011577509928084932/215)
  (num-test (string->number "+a053a635a581a5a4/a7" 16) 11552760218475668900/167)
  (num-test (string->number "-d053d635e581a5c4/d7" 16) -15011577509928084932/215)
  (num-test (string->number "-a053a635a581a5a4/a7" 16) -11552760218475668900/167)
  (num-test (string->number "+6/a47367025481df6c8" 16) 1/31599808811326133196)
  (num-test (string->number "d053d635e581a5c4/d7" 16) 15011577509928084932/215)
  (num-test (string->number "+074563336d48564b774" 16) 2146033681147780970356)
  (num-test (string->number "e/4246061597ec79345a" 15) 7/204584420774687563055)
  (num-test (string->number "c57252467ff.cfd94d" 16) 1.3568424830975811909496784210205078125E13)
  (num-test (string->number "f309e9b9ba.7c52ff2" 16) 1.043843365306485641427338123321533203125E12)
  (num-test (string->number "+42e-0106653" 10) 4.199999999999999999999999999999999999999E-106652)
  (test (infinite? (string->number "8e7290491476" 10)) #t)
  (num-test (string->number "4ff7da4d/ab09e16255c06a55c5cb7193ebb2fbb" 16) 1341643341/14209330580250438592763227155654717371)
  
  (num-test (string->number "#x400000000000000000") (expt 2 70))
  
  (for-each
   (lambda (op)
     (if (not (= (op 1e19) (op .1e20)))
	 (format #t ";(~A 1e19) = ~A, but (~A .1e20) = ~A?~%"
			op (op 1e19)
			op (op .1e20))))
   (list floor ceiling truncate round inexact->exact exact->inexact))
  
  (for-each
   (lambda (op)
     (if (not (= (op -1e19) (op -.1e20)))
	 (format #t ";(~A -1e19) = ~A, but (~A -.1e20) = ~A?~%"
			op (op -1e19)
			op (op -.1e20))))
   (list floor ceiling truncate round inexact->exact exact->inexact)))

(num-test #b+01 1)
(num-test #b-01 -1)

(num-test #b1.0e-8 0.00390625)
(num-test #o1.0e-8 5.9604644775391e-08)

(num-test #b-.1 -0.5)
(num-test #o-.1 -0.125)
(num-test #x-.1 -0.0625)

(num-test #b+.1 +0.5)
(num-test #o+.1 +0.125)
(num-test #x+.1 +0.0625)

(num-test #b+.1e+1 1.0)
(num-test #o+.1e+1 1.0)

(num-test #b000000001 1)
(num-test #b1e1 2.0)
(num-test #b1.e1 2.0)

(num-test #x-AAF -2735)
(num-test #x-aAf -2735)

(num-test #b1+1.1i 1+1.5i)  ; yow...
(num-test #xf/c 5/4)
(num-test #x+f/c 5/4)
(num-test #x-f/c -5/4)

(num-test #b0/1 0)
;(test #b0/0 'division-by-zero) ; read-error
(num-test #o7/6 7/6)
(num-test #o11/2 9/2)
(num-test #x11/2 17/2)
(num-test #b111/11 7/3)
(num-test #b111111111111111111111111111111111111111111111111111111111111111/111 1317624576693539401)
(num-test (* 1317624576693539401 7) most-positive-fixnum)
(num-test #o777777777777777777777/7 1317624576693539401)
(num-test #x7fffffffffffffff/7 1317624576693539401)
(num-test (string->number "#x1234/12") (string->number "1234/12" 16))

(test (equal? 0.0 #b0e0) #t)
(test (equal? 0.0 #b0e-0) #t)
(test (equal? 0.0 #b.0e+0) #t)
(test (equal? 0.0 #b00000000000000000000000000000000000000000000000000000e100) #t)
(test (equal? 0.0 #b.0000000000000000000000000000000000000000000000000000e100) #t)
(test (equal? 0.0 #b00000000000000000000000000000000000000000000000000000.0000000000000000000000000000000000000000000000000000000000e100) #t)
(test (equal? 0.0 #b0e100000000000000000000000000000000000000000000000000000000000000000000000) #t)
(num-test 0 #b0/1000000000)
(num-test 0 #b0/100000000000000000000000000000000000000)
(num-test 0 #b0/100000000000000000000000000000000000000000000000000000000000000)
(if with-bignums
    (begin
      (num-test (string->number "#b0/100000000000000000000000000000000000000000000000000000000000000000000") 0)
      (num-test (string->number "#b-0/100000000000000000000000000000000000000000000000000000000000000000000") 0)))
;;; there's a problem here -- the reader tries to make sense of every form even if it can't actually
;;;    be evaluated, so in the block above in the non-bignum case, if the #b... is not in double quotes, it tries to read
;;;    the value as a number.  make_atom however returns NaN because it can't represent the integer in 64 bits, and
;;;    the #... code interprets that as #b<not-a-number> and it raises a read error!  Ideally, we'd distinguish
;;;    between #b... that can't possibly be right and the same that might be ok if the bits are available.

(test (equal? 0.0 #b0.0e10) #t)
(test (equal? 0.0 #b0e100) #t)
(test (equal? 0.0 #b0.0e1000) #t)
(test (equal? 0.0 #b0e+1000) #t)
(test (equal? 0.0 #b0.0e-1) #t)
(test (equal? 0.0 #b0e-10) #t)
(test (equal? 0.0 #b0.0e-100) #t)
(test (equal? 0.0 #b0e-1000) #t)
(test (equal? 0.0 #b0.0e0123456789) #t)

(test (equal? 0.0 #b0-0e10i) #t)
(test (equal? 0.0 #b0-0.0e100i) #t)
(test (equal? 0.0 #b0-0e1000i) #t)
(test (equal? 0.0 #b0-0.0e+1000i) #t)
(test (equal? 0.0 #b0-0e-1i) #t)
(test (equal? 0.0 #b0-0.0e-10i) #t)
(test (equal? 0.0 #b0-0e-100i) #t)
(test (equal? 0.0 #b0-0.0e-1000i) #t)
(test (equal? 0.0 #b0.0+0e0123456789i) #t)
(num-test 0.0 #b1e-1000)

(num-test #b+0+i 0+1i)
(num-test #b0.-i 0-1i)
(num-test #b0/01 0)
(num-test #b-0/1 0)
(num-test #b1.+.1i 1+0.5i)
(num-test 1e-0 1.0)
(num-test #b0100/10 2)
(num-test #b0e+1-0.i 0.0)
(num-test #b.1-0/01i 0.5)
(num-test #b0e+1-0.i 0.0)
(num-test #b1.+01.e+1i 1+2i)
(num-test #b0+.0e10101i 0.0)
(num-test #b00e+0-.00e11i 0.0)
(num-test #b-000e+10110001 0.0)

(test (number? ''1) #f)
(test (symbol? ''1) #f)
(test (string->number "''1") #f)

(test 00 0)
(test (string->number "00") 0)
(test 000 0)
(test (string->number "000") 0)
(test 00.00 0.0)
(test (string->number "00.00") 0.0)
(test (number? '0-0) #f)
(test (string->number "0-0") #f)
(test (number? '00-) #f)
(test (string->number "00-") #f)

(num-test #o-11 -9)
(num-test #o-0. 0.0)
(num-test #o+.0 0.0)
(num-test #xe/1 14)
(num-test #xe/a 7/5)
(num-test #xfad 4013)
(num-test #xd/1 13)
(num-test #x0/f 0)
(num-test #x+00 0)
(num-test #x.c0 0.75)
(num-test #x-fc -252)
(num-test (= 0e-1 0.0) #t)
;;; (/ (/ 0))??
(num-test #x.a+i 0.625+1i)
(num-test #b1.+i 1+1i)
(num-test 0.e-0 0.0)

(let ((str (make-string 3)))
   (set! (str 0) #\#)
   (set! (str 1) #\b)
   (set! (str 2) #\null)
   (test (string->number str) #f))
(let ((str (make-string 4)))
   (set! (str 0) #\#)
   (set! (str 1) #\b) 
   (set! (str 2) #\0)
   (set! (str 3) #\null)          ; #\space here -> #f
   (test (string->number str) 0)) ; this is consistent with other (non-#) cases

(do ((i 2 (+ i 1)))
    ((= i 17)) 
  (num-test (string->number (number->string 12345.67890987654321 i) i) 12345.67890987654321))

(let ()
  (define (make-number radix)
    (let* ((max-len (+ 1 (vector-ref (vector 0 0 62 39 31 26 23 22 20 19 18 17 17 16 16 15 15) radix)))
	   (int-len (floor (* max-len (random 1.0) (random 1.0) (random 1.0))))
	   (frac-len (floor (* max-len (random 1.0) (random 1.0) (random 1.0))))
	   (exp-len 1)
	   (has-frac (> (random 1.0) 0.2))
	   (has-exp (and (<= radix 10)
			 (< int-len 9)
			 (> (random 1.0) 0.5)))
	   (signed (> (random 1.0) 0.5))
	   (exp-signed (> (random 1.0) 0.5)))
      (if (and (= int-len 0)
	       (or (not has-frac)
		   (= frac-len 0)))
	  (set! int-len 1))
      (let ((str (make-string (+ int-len
				 (if signed 1 0)
				 (if has-frac (+ frac-len 1) 0) ; extra 1 for "."
				 (if has-exp (+ (+ exp-len 1)   ; extra 1 for exponent char
						(if exp-signed 1 0))
				     0))))
	    (loc 0))
	
	(define (digit->char digit)
	  (if (< digit 10)
	      (integer->char (+ (char->integer #\0) digit))
	      (integer->char (+ (char->integer #\a) (- digit 10)))))
	
	(define (exponent-marker)
	  (string-ref "eE" (random 2)))
	
	(if signed 
	    (begin
	      (set! (str 0) #\-)
	      (set! loc (+ loc 1))))
	
	(do ((i 0 (+ i 1)))
	    ((= i int-len))
	  (set! (str loc) (digit->char (random radix)))
	  (set! loc (+ loc 1)))
	
	(if has-frac
	    (begin
	      (set! (str loc) #\.)
	      (set! loc (+ loc 1))
	      (do ((i 0 (+ i 1)))
		  ((= i frac-len))
		(set! (str loc) (digit->char (random radix)))
		(set! loc (+ loc 1)))))
	
	(if has-exp
	    (begin
	      (set! (str loc) (exponent-marker))
	      (set! loc (+ loc 1))
	      (if exp-signed
		  (begin
		    (set! (str loc) #\-)
		    (set! loc (+ loc 1))))
	      (do ((i 0 (+ i 1)))
		  ((= i exp-len))
		(set! (str loc) (digit->char (random 10)))
		(set! loc (+ loc 1)))))
	
	str)))
  
  (let ((tries 1000))
    (do ((i 0 (+ i 1)))
	((= i tries))
      (let ((rad (+ 2 (random 15))))
	(let ((str (make-number rad)))
	  (if (not (number? (string->number str rad)))
	      (format #t ";(1) trouble in string->number ~A ~S: ~A~%"
		      rad str
		      (string->number str rad))
	      (if (not (string? (number->string (string->number str rad) rad)))
		  (format #t ";(2) trouble in number->string ~A ~S: ~A ~S~%"
			  rad str
			  (string->number str rad)
			  (number->string (string->number str rad) rad))
		  (if (not (number? (string->number (number->string (string->number str rad) rad) rad)))
		      (format #t ";(3) trouble in number->string ~A ~S: ~A ~S ~A~%"
			      rad str
			      (string->number str rad)
			      (number->string (string->number str rad) rad)
			      (string->number (number->string (string->number str rad) rad) rad))
		      (let ((diff (abs (- (string->number (number->string (string->number str rad) rad) rad) (string->number str rad)))))
			(if (> diff 2e-5)
			    (format #t "(string->number ~S ~D): ~A, n->s: ~S, s->n: ~A, diff: ~A~%"
				    str rad
				    (string->number str rad)
				    (number->string (string->number str rad) rad)
				    (string->number (number->string (string->number str rad) rad) rad)
				    diff)))))))))))

(let ()
  (define (no-char str radix)
    (let ((len (length str)))
      (do ((i 0 (+ i 1)))
	  ((= i len))
	(if (and (not (char=? (str i) #\.))
		 (>= (string->number (string (str i)) 16) radix))
	    (format #t ";~S in base ~D has ~C?" str radix (str i))))))

  (no-char (number->string (* 1.0 2/3) 9) 9)
  (no-char (number->string (string->number "0.05" 9) 9) 9)
  ;; (number->string (string->number "-5L-4" 9) 9) -> "-0.00049" if rounding is stupid
  ;; (number->string (string->number "5.e-8" 6) 6) -> "0.000000046"
  (no-char (number->string (* 1.0 6/7) 7) 7)
  
  (do ((i 2 (+ i 1)))
      ((= i 17))
    (no-char (number->string (* 1.0 (/ 1 i)) i) i)
    (no-char (number->string (* 1.0 (/ 1 (* i i))) i) i)
    (no-char (number->string (* 0.99999999999999 (/ 1 i)) i) i)
    (no-char (number->string (* 0.999999 (/ 1 i)) i) i)))

(let ((happy #t))
  (do ((i 2 (+ i 1)))
      ((or (not happy)
	   (= i 17)))
    (if (not (eqv? 3/4 (string->number (number->string 3/4 i) i)))
	(begin 
	  (set! happy #f) 
	  (format #t ";(string<->number 3/4 ~A) -> ~A?~%" i (string->number (number->string 3/4 i) i))))
    (if (not (eqv? 1234/11 (string->number (number->string 1234/11 i) i)))
	(begin 
	  (set! happy #f) 
	  (format #t ";(string<->number 1234/11 ~A) -> ~A?~%" i (string->number (number->string 1234/11 i) i))))
    (if (not (eqv? -1234/11 (string->number (number->string -1234/11 i) i)))
	(begin 
	  (set! happy #f) 
	  (format #t ";(string<->number -1234/11 ~A) -> ~A?~%" i (string->number (number->string -1234/11 i) i))))))

(test (< (abs (- (string->number "3.1415926535897932384626433832795029") 3.1415926535897932384626433832795029)) 1e-7) #t)

(num-test (string->number "111.01" 2) 7.25)
(num-test (string->number "-111.01" 2) -7.25)
(num-test (string->number "0.001" 2) 0.125)
(num-test (string->number "1000000.001" 2) 64.125)

(num-test (string->number "111.01" 8) 73.015625)
(num-test (string->number "-111.01" 8) -73.015625)
(num-test (string->number "0.001" 8) 0.001953125)
(num-test (string->number "1000000.001" 8) 262144.001953125)

(num-test (string->number "111.01" 16) 273.00390625)
(num-test (string->number "-111.01" 16) -273.00390625)
(num-test (string->number "0.001" 16) 0.000244140625)
(num-test (string->number "1000000.001" 16) 16777216.000244)

(num-test (string->number "11.+i" 2) 3+1i)
(num-test (string->number "0+.1i" 2) 0+0.5i)
(num-test (string->number "1.+0.i" 2) 1.0)
(num-test (string->number ".01+.1i" 2) 0.25+0.5i)
(num-test (string->number "1+0.i" 2) 1.0)
(num-test (string->number "1+0i" 2) 1.0)

(test (number->string 0.75 2) "0.11")
(test (number->string 0.125 8) "0.1")
(test (number->string 12.5 8) "14.4")
(test (number->string 12.5 16) "c.8")
(test (number->string 12.5 2) "1100.1")
(test (number->string -12.5 8) "-14.4")
(test (number->string -12.5 16) "-c.8")
(test (number->string -12.5 2) "-1100.1")
(test (number->string 12.0+0.75i 2) "1100.0+0.11i")
(test (number->string -12.5-3.75i 2) "-1100.1-11.11i")
(test (number->string 12.0+0.75i 8) "14.0+0.6i")
(test (number->string -12.5-3.75i 8) "-14.4-3.6i")
(test (number->string 12.0+0.75i 16) "c.0+0.ci")
(test (number->string -12.5-3.75i 16) "-c.8-3.ci")
(test (string->number "2/#b1" 10) #f)
(test (string->number "2.i" 10) #f)
(num-test (string->number "6+3.i" 10) 6+3i)
(num-test (string->number "-61" 7) -43)
(num-test (string->number "10100.000e11+011110111.1010110e00i" 2) 40960+247.671875i)
(num-test (string->number "+4a00/b" 16) 18944/11)

(num-test (string->number "9-9.e+9i" 10) 9-9000000000i)
(num-test (string->number "-9+9e-9i" 10) -9+9e-09i)  ; why the 09?
(num-test (string->number "9-9.e+9i" 10) 9-9000000000i)

(num-test +2-0.e-1i 2.0)
(num-test +2.-0e-1i 2.0)

;; weird cases:
(num-test (string->number "#b1000" 8) 8)
(num-test (string->number "#b1000" 2) 8)
(num-test (string->number "#b1000" 16) 8)
(num-test (string->number "11" 2) 3)
(num-test (string->number "#x11" 2) 17)
(num-test (string->number "#b11" 16) 3)
(num-test (string->number "#xffff" 2) 65535)
(num-test (string->number "#xffff" 10) 65535)
(num-test (string->number "#xffff" 6) 65535)
(num-test (string->number "#xffff" 16) 65535)
(num-test (string->number "#x35/3de" 10) 53/990)

(test (string->number "#x#|1|#1") #f)
(test (string->number "#||#1") #f)
(test (string->number "#<") #f)
(test (string->number "+.e1") #f)
(test (string->number ".e1") #f)

(num-test (string->number "4\x32;\x37;") 427)
(num-test (string->number "\x32;.\x39;") 2.9)
(num-test (string->number "4\x31;+3\x36;i") 41+36i)

(when with-bignums
  (num-test (string->number "101461074055444526136" 8) 1181671265888545886)
  (num-test (string->number "-67330507011755171566102306711560321" 8) -35128577239298592313751007322321)
  (num-test (string->number "35215052773447206642040260+177402503313573563274751i" 8) 1.38249897923920622272688E23+1.176027342049207220713E21i)
  ;; there is some randomness here: 1.0e309 -> inf, but 1.0e310 -> -nan and others equally scattered
  )

(test (string=? (substring (number->string pi 16) 0 14) "3.243f6a8885a3") #t)

(for-each
 (lambda (expchar)
   (let ((exponent (string expchar)))
     (do ((base 2 (+ base 1)))
	 ((= base 11))
       (let ((val (string->number (string-append "1" exponent "1") base)))
	 (if (and (number? val)
		  (> (abs (- val base)) 1e-9))
	     (format #t ";(string->number ~S ~A) returned ~A?~%" 
		     (string-append "1" exponent "1") base (string->number (string-append "1" exponent "1") base)))))
     
     (do ((base 2 (+ base 1)))
	 ((= base 11))
       (let ((val (string->number (string-append "1.1" exponent "1") base)))
	 (if (and (number? val)
		  (> (abs (- val (+ base 1))) 1e-9))
	     (format #t ";(string->number ~S ~A) returned ~A?~%" 
		     (string-append "1.1" exponent "1") base (string->number (string-append "1.1" exponent "1") base)))))
     
     (do ((base 2 (+ base 1)))
	 ((= base 11))
       (let ((val (string->number (string-append "1" exponent "+1") base)))
	 (if (and (number? val)
		  (> (abs (- val base)) 1e-9))
	     (format #t ";(string->number ~S ~A) returned ~A?~%"
		     (string-append "1" exponent "+1") base (string->number (string-append "1" exponent "+1") base)))))
					; in base 16 this is still not a number because of the + (or -)
					; but "1e+1i" is a number -- gad!
     
     (do ((base 2 (+ base 1)))
	 ((= base 11))
       (let ((val (string->number (string-append "1" exponent "-1+1i") base)))
	 (if (and (number? val)
		  (> (magnitude (- val (complex (/ base) 1))) 1e-6))
	     (format #t ";(string->number ~S ~A) returned ~A?~%" 
		     (string-append "1" exponent "-1+1i") base (string->number (string-append "1" exponent "-1+1i") base)))))))
 
 (list #\e #\d #\f #\s #\l))

(test (< (abs (- (string->number "3.1415926535897932384626433832795029" 10) 3.1415926535897932384626433832795029)) 1e-7) #t)
(num-test (string->number "2.718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427" 16) 2.4433976119657)
(num-test (string->number "2.718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427" 11) 2.6508258818757)

(let ((happy #t))
  (do ((i 2 (+ i 1)))
      ((or (not happy)
	   (= i 17)))
    (let ((val (+ 1.0 i)))
      (do ((k 1 (+ k 1))
	   (incr (/ 1.0 i) (/ incr i)))
	  ((< incr 1e-14))
	(set! val (+ val incr)))
      (if (> (abs (- val (string->number "11.111111111111111111111111111111111111111111111111111111111111111111111111111111111111" i))) 1e-7)
	  (begin
	    (set! happy #f) 
	    (display "(string->number 11.111... ") (display i) (display ") -> ") 
	    (display (string->number "11.111111111111111111111111111111111111111111111111111111111111111111111111111111111111" i))
	    (display " but expected ") (display val) (newline))))
    
    (let* ((digits "00123456789abcdef")
	   (str (make-string 80 (string-ref digits i))))
      (string-set! str 2 #\.)
      (let ((val (exact->inexact (* i i))))
	(if (> (abs (- val (string->number str i))) 1e-7)
	    (begin
	      (set! happy #f) 
	      (format #t ";(string->number ~S ~A) -> ~A (expected ~A)?~%" str i (string->number str i) val)))))
    
    (let* ((radlim (list 0 0 62 39 31 26 23 22 20 19 18 17 17 16 16 15 15))
	   (digits "00123456789abcdef"))
      (do ((k (- (list-ref radlim i) 3) (+ k 1)))
	  ((= k (+ (list-ref radlim i) 4)))
	(let ((str (make-string (+ k 3) (string-ref digits i))))
	  (string-set! str 2 #\.)
	  (let ((val (exact->inexact (* i i))))
	    (if (> (abs (- val (string->number str i))) 1e-7)
		(begin
		  (set! happy #f) 
		  (format #t ";(string->number ~S ~A) -> ~A (expected ~A)?~%" str i (string->number str i) val)))))))))

(let ((happy #t))
  (do ((i 2 (+ i 1)))
      ((or (not happy)
	   (= i 17)))
    (if (> (abs (- 0.75 (string->number (number->string 0.75 i) i))) 1e-6)
	(begin 
	  (set! happy #f) 
	  (format #t ";(string->number (number->string 0.75 ~A) ~A) -> ~A?~%" i i (string->number (number->string 0.75 i) i))))
    
    (if (> (abs (- 1234.75 (string->number (number->string 1234.75 i) i))) 1e-6)
	(begin 
	  (set! happy #f) 
	  (format #t ";(string->number (number->string 1234.75 ~A) ~A) -> ~A?~%" i i (string->number (number->string 1234.75 i) i))))
    
    (if (> (abs (- -1234.25 (string->number (number->string -1234.25 i) i))) 1e-6)
	(begin 
	  (set! happy #f) 
	  (format #t ";(string->number (number->string -1234.75 ~A) ~A) -> ~A?~%" i i (string->number (number->string -1234.75 i) i))))
    
    (let ((val (string->number (number->string 12.5+3.75i i) i)))
      (if (or (not (number? val))
	      (> (abs (- (real-part val) 12.5)) 1e-6)
	      (> (abs (- (imag-part val) 3.75)) 1e-6))
	  (begin 
	    (set! happy #f) 
	    (format #t ";(string->number (number->string 12.5+3.75i ~A) ~A) -> ~A?~%" i i (string->number (number->string 12.5+3.75i i) i)))))
    
    (let ((happy #t))
      (do ((base 2 (+ base 1)))
	  ((or (not happy)
	       (= base 11))) ;;; see s7.c for an explanation of this limit
	(do ((i 0 (+ i 1)))
	    ((= i 10))
	  (let* ((rl (- (random 200.0) 100.0))
		 (im (- (random 200.0) 100.0))
		 (rlstr (number->string rl base))
		 (imstr (number->string im base))
		 (val (complex rl im))
		 (str (string-append rlstr 
				     (if (or (negative? im)
					     (char=? (string-ref imstr 0) #\-)) ; sigh -- -0.0 is not negative!
					 "" "+") 
				     imstr 
				     "i")))
	    (let* ((sn (string->number str base))
		   (nsn (and (number? sn) (number->string sn base)))
		   (nval (and (string? nsn) (string->number nsn base))))
	      (if (or (not nval)
		      (> (abs (- (real-part nval) (real-part val))) 1e-3)
		      (> (abs (- (imag-part nval) (imag-part val))) 1e-3))
		  (begin
		    (set! happy #f)
		    (format #t ";(number<->string ~S ~A) -> ~A? [~A ~S]~%" str base nval sn nsn)
		    )))))))))
    

(let ((val (number->string 1.0-1.0i)))
  (if (and (not (string=? val "1-1i"))
	   (not (string=? val "1.0-1.0i"))
	   (not (string=? val "1-i"))
	   (not (string=? val "1.0-i")))
      (begin
	(display "(number->string 1.0-1.0i) returned ") (display val) (display "?") (newline))))

(let ()
  (define (make-integer str j digits radix zero-ok)
    (do ((k 0 (+ k 1)))
	((= k digits))
      (if zero-ok
	  (set! (str j) (#(#\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9 #\a #\b #\c #\d #\e #\f) (random radix)))
	  (set! (str j) (#(#\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9 #\a #\b #\c #\d #\e #\f) (random (- radix 1)))))
      (set! j (+ j 1)))
    j)
  
  (define (make-ratio str j ndigits ddigits radix)
    (set! j (make-integer str j (+ 1 ndigits) radix #t))
    (set! (str j) #\/)
    (make-integer str (+ j 1) (+ 1 ddigits) radix #f))
  
  (define (make-real str j digits edigits radix)
    (let ((nj (make-integer str j (random digits) radix #t)))
      (set! (str nj) #\.)
      (set! j (make-integer str (+ nj 1) (+ (if (= j nj) 1 0) (random digits)) radix #t))
      (if (and (> edigits 0)
	       (<= radix 10))
	  (begin
	    (set! (str j) #\e)
	    (set! j (make-integer str (+ j 1) (+ 1 (random edigits)) radix #t))))
      j))
  
  (define (make-complex str j digits edigits radix)
    (set! j (make-real str j digits edigits radix))
    (set! (str j) (#(#\+ #\-) (random 2)))
    (set! j (make-real str (+ j 1) digits edigits radix))
    (set! (str j) #\i)
    (+ j 1))
  
  (let ((str (make-string 512))
	(max-digits 10)
	(edigits 2))
    
    (do ((i 0 (+ i 1)))
	((= i 100))
      (let ((j 0)
	    (radix (+ 2 (random 15)))
	    (choice (case (random 10)
		      ((0 1) 'integer)
		      ((2 3) 'ratio)
		      ((4 5 6) 'real)
		      (else 'complex))))
	
	;; possible #x etc
	(if (> (random 10) 7)
	    (begin
	      (set! (str j) #\#)
	      (set! j (+ j 1))
	      (let ((rchoice (random 3)))
		(set! (str j) (#(#\b #\o #\x) rchoice))
		(set! radix (#(2 8 16) rchoice)))
	      (set! j (+ j 1))))
	
	;; possible sign
	(if (> (random 10) 5)
	    (begin
	      (set! (str j) (#(#\+ #\-) (random 2)))
	      (set! j (+ j 1))))
	
	(set! j (case choice
		  ((integer) (make-integer str j (+ 1 (random max-digits)) radix #t))
		  ((ratio)   (make-ratio str j (random max-digits) (random max-digits) radix))
		  ((real)    (make-real str j max-digits edigits radix))
		  ((complex) (make-complex str j max-digits edigits radix))))
	
	(let ((num (catch #t (lambda () (string->number (substring str 0 j) radix)) (lambda args 'error))))
	  (if (not (number? num))
	      (format *stderr* "(string->number ~S ~D) ~60T~A~%" (substring str 0 j) radix num)))))))

(let ((string->number-2 (lambda (str radix)
			  (let ((old-str (if (string? str) (string-copy str) str)))
			    (let ((val (string->number str radix)))
			      (if (not (string=? str old-str))
				  (error 'string->number-messed-up)
				  val)))))
      (string->number-1 (lambda (str)
			  (let ((old-str (if (string? str) (string-copy str) str)))
			    (let ((val (string->number str)))
			      (if (not (string=? str old-str))
				  (error 'string->number-messed-up)
				  val))))))

  (num-test (string->number-1 "100") 100)
  (num-test (string->number-2 "100" 16) 256)
  (num-test (string->number-2 "100" 2) 4)
  (num-test (string->number-2 "100" 8) 64)
  (num-test (string->number-2 "100" 10) 100)
  (num-test (string->number-2 "11" 16) 17)
  (num-test (string->number-2 "-11" 16) -17)
  (num-test (string->number-2 "+aa" 16) 170)
  (num-test (string->number-2 "-aa" 16) -170)
  
  (for-each
   (lambda (str rval fval)
     (let ((happy #t))
       (do ((radix 3 (+ radix 1)))
	   ((or (not happy)
		(= radix 16)))
	 (let ((val (string->number-2 str radix)))
	   (if (and (number? val)
		    (not (fval val (rval radix) radix)))
	       (begin
		 (display "(string->number \"") (display str) (display "\" ") (display radix) (display ") = ") (display val) (display "?") (newline)
		 (set! happy #f)))))))
   (list "101"
	 "201.02"
	 "1/21"
	 "2e1"
	 "10.1e-1"
	 )
   (list (lambda (radix) (+ 1 (* radix radix)))
	 (lambda (radix) (+ 1.0 (* 2 radix radix) (/ 2.0 (* radix radix))))
	 (lambda (radix) (/ 1 (+ 1 (* 2 radix))))
	 (lambda (radix) (if (< radix 15) (* 2 radix) (+ 1 (* 14 radix) (* 2 radix radix))))
	 (lambda (radix) (+ 1 (/ 1.0 (* radix radix))))
	 )
   (list (lambda (a b radix) (= a b))
	 (lambda (a b radix) (< (abs (- a b)) (/ 1.0 (* radix radix))))
	 (lambda (a b radix) (= a b))
	 (lambda (a b radix) (= a b))
	 (lambda (a b radix) (< (abs (- a b)) (/ 1.0 (* radix radix radix))))
	 ))
  
  (num-test (string->number-2 "34" 2) #f)
  (num-test (string->number-2 "19" 8) #f)
  (num-test (string->number-2 "1c" 10) #f)
  (num-test (string->number-2 "1c" 16) 28)
  
  (test (string->number-1 "") #f )
  (test (string->number-1 ".") #f )
  (test (string->number-1 "d") #f )
  (test (string->number-1 "D") #f )
  (test (string->number-1 "i") #f )
  (test (string->number-1 "I") #f )
  (test (string->number-1 "3i") #f )
  (test (string->number-1 "3I") #f )
  (test (string->number-1 "33i") #f )
  (test (string->number-1 "33I") #f )
  (test (string->number-1 "3.3i") #f )
  (test (string->number-1 "3.3I") #f )
  (test (string->number-1 "-") #f )
  (test (string->number-1 "+") #f )
  
  (test (string->number "1e0+i") 1+i)
  (test (string->number "1+ie0") #f)
  (test (string->number "1+e0") #f)
  (test (string->number "1+1e0i") 1+i)
  (test (string->number "1+1e0e0i") #f)
  (test (string->number "1+1e00i") 1+i)
  (test (string->number "1L") #f)
  (test (string->number "1.L") #f)
  (test (string->number "0+I") #f)
  
  (num-test (string->number-1 "3.4e3") 3400.0)
  (num-test (string->number-1 "0") 0))

(test (let* ((str "1+0i") (x (string->number str))) (and (number? x) (string=? str "1+0i"))) #t)

(for-each
 (lambda (n)
   (let ((nb 
	  (catch #t
		 (lambda ()
		   (number? n))
		 (lambda args
		   'error))))
     (if (not nb)
	 (begin
	   (display "(number? ") (display n) (display ") returned #f?") (newline)))))
     (list 1 -1 +1 +.1 -.1 .1 .0 0. 0.0 -0 +0 -0. +0.
	   +1.1 -1.1 1.1
	   '1.0e2 '-1.0e2 '+1.0e2
	   '1.1e-2 '-1.1e-2 '+1.1e-2
	   '1.1e+2 '-1.1e+2 '+1.1e+2
	   '1/2 '-1/2 '+1/2
	   '1.0+1.0i '1.0-1.0i '-1.0-1.0i '-1.0+1.0i
	   '1+i '1-i '-1-i '-1+i
	   '2/3+i '2/3-i '-2/3+i
	   '1+2/3i '1-2/3i '2/3+2/3i '2.3-2/3i '2/3-2.3i
	   '2e2+1e3i '2e2-2e2i '2.0e2+i '1+2.0e2i '2.0e+2-2.0e-1i '2/3-2.0e3i '2e-3-2/3i
	   '-2.0e-2-2.0e-2i '+2.0e+2+2.0e+2i '+2/3-2/3i '2e2-2/3i
	   '1e1-i '1.-i '.0+i '-.0-1e-1i '1.+.1i '0.-.1i
	   '.1+.0i '1.+.0i '.1+.1i '1.-.1i '.0+.00i '.10+.0i '-1.+.0i '.1-.01i '1.0+.1i 
	   '1e1+.1i '-1.-.10i '1e01+.0i '0e11+.0i '1.e1+.0i '1.00-.0i '-1e1-.0i '1.-.1e0i 
	   '1.+.001i '1e10-.1i '1e+0-.1i '-0e0-.1i
	   '-1.0e-1-1.0e-1i '-111e1-.1i '1.1-.1e11i '-1e-1-.11i '-1.1-.1e1i '-.1+.1i))

(for-each
 (lambda (n rl im)
   (if (not (number? n))
       (begin
	 (display "(number? ") (display n) (display ") returned #f?") (newline))
       (begin
	 (if (> (abs (- (real-part n) rl)) .000001)
	     (begin
	       (display "real-part: ") (display n) (display " ") (display (real-part n)) (display " ") (display rl) (newline)))
	 (if (> (abs (- (imag-part n) im)) .000001)
	     (begin
	       (display "imag-part: ") (display n) (display " ") (display (imag-part n)) (display " ") (display im) (newline)))
	 )))
 (list 1 -1 +1 +.1 -.1 .1 .0 0. 0.0 -0 +0 -0. +0.
       +1.1 -1.1 1.1
       '1.0e2 '-1.0e2 '+1.0e2
       '1.1e-2 '-1.1e-2 '+1.1e-2
       '1.1e+2 '-1.1e+2 '+1.1e+2
       '1/2 '-1/2 '+1/2

       '1.0+1.0i '1.0-1.0i '-1.0-1.0i '-1.0+1.0i
       '1+i '1-i '-1-i '-1+i
       '2/3+i '2/3-i '-2/3+i
       '1+2/3i '1-2/3i '2/3+2/3i '2.3-2/3i '2/3-2.3i
       '2e2+1e3i '2e2-2e2i '2.0e2+i '1+2.0e2i '2.0e+2-2.0e-1i '2/3-2.0e3i '2e-3-2/3i
       '-2.0e-2-2.0e-2i '+2.0e+2+2.0e+2i '+2/3-2/3i '2e2-2/3i
       '1e1-i '1.-i '.0+i '-.0-1e-1i '1.+.1i '0.-.1i
       '.1+.0i '1.+.0i '.1+.1i '1.-.1i '.0+.00i '.10+.0i '-1.+.0i '.1-.01i '1.0+.1i 
       '1e1+.1i '-1.-.10i '1e01+.0i '0e11+.0i '1.e1+.0i '1.00-.0i '-1e1-.0i '1.-.1e0i 
       '1.+.001i '1e10-.1i '1e+0-.1i '-0e0-.1i
       '-1.0e-1-1.0e-1i '-111e1-.1i '1.1-.1e11i '-1e-1-.11i '-1.1-.1e1i)
 
 (list 1.0 -1.0 1.0 0.1 -0.1 0.1 0.0 0.0 0.0 0.0 0.0 -0.0 0.0 1.1 -1.1 1.1 100.0 -100.0 
       100.0 0.011 -0.011 0.011 110.0 -110.0 110.0 0.5 -0.5 0.5 
       1.0 1.0 -1.0 -1.0 1.0 1.0 -1.0 
       -1.0 0.66666666666667 0.66666666666667 -0.66666666666667 1.0 1.0 0.66666666666667 
       2.3 0.66666666666667 200.0 200.0 200.0 1.0 200.0 0.66666666666667 0.002 -0.02 200.0 
       0.66666666666667 200.0 10.0 1.0 0.0 -0.0 1.0 0.0 0.1 1.0 0.1 1.0 0.0 0.1 -1.0 0.1 
       1.0 10.0 -1.0 10.0 0.0 10.0 1.0 -10.0 1.0 1.0 10000000000.0 1.0 -0.0 -0.1 -1110.0 
       1.1 -0.1 -1.1)
 
 (list 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 
       0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 -1.0 
       -1.0 1.0 1.0 -1.0 -1.0 1.0 1.0 -1.0 1.0 0.66666666666667 -0.66666666666667 
       0.66666666666667 -0.66666666666667 -2.3 1000.0 -200.0 1.0 200.0 -0.2 -2000.0 
       -0.66666666666667 -0.02 200.0 -0.66666666666667 -0.66666666666667 -1.0 -1.0 1.0 
       -0.1 0.1 -0.1 0.0 0.0 0.1 -0.1 0.0 0.0 0.0 -0.01 0.1 0.1 -0.1 0.0 0.0 0.0 0.0 
       0.0 -0.1 0.001 -0.1 -0.1 -0.1 -0.1 -0.1 -10000000000.0 -0.11 -1.0))


(for-each
 (lambda (n name)
   (if (number? n)
       (begin
	 (display "(number? ") (display name) (display ") returned #t?") (newline)))
   (if (or (not (symbol? n))
	   (boolean? n))
       (begin
	 (display "(symbol? ") (display name) (display ") returned #f?") (newline)))
   (if (number? (string->number name))
       (begin
	 (display "(string->number ") (display name) (display ") returned ") (display (string->number name)) (display "?") (newline))))
 
 (list '1e '--1 '++1 '+. '+.+ '.. '.- '1e- '+ '- '-e1
       '1/2/3 '1/2+/2 '/2 '2/ '1+2 '1/+i '1/2e1 '1/2.
       '1..0 '1.+0 '1--1 '1+- '1.0++i '1.0-ie++2 '1+1 '1.0. '1.0e
       '1ee2 '1.0e2e2 '1es2 '1e1.0 '1.0.0 '1/2.0 '1+i2 '1+1.0i0
       '+.i 'i 'e 'e1 '1e.1 '1+.i '1.0e.1
       '-.1ei '-1.0+1.0 '1.0+1.0i+1.0 '1.1/2 '1/2.0
       '1/e '1/i 'e/i '1e2/3 '2/1e2 '1e2+1e2ii '1i-1.0 '1.0-i/2
       '1/2i '2i/3 '2+/i '2+2/i '2+2/-i '2/- '2/+ '2/+3
       '1e1.0 '1e1e2 '1+ie2 '1ei1 '1e/2 '0-- '1+ '1- '.1. '.1+
       '1//2 '1/-/2 '1/2/ '1// '+/1 '.0.
       '+0ei '0e++i '+0e+i '0e+-i '+0e-i '+00ei '+.0ei '0+0ei '-01ei '+.1ei 
       '1-1ei '-1.ei '0+.i '0-.i '1+e0i '1+/0i '1-/0i '1+e1i '1+/1i '10+.i 
       '.0+.i '-0+.i '.1+.i '0.+.i '00-.i '.1-.i '1.-.i '1e++0i '1e--1i '.1e++i 
       '+10e+i '1+0e+i '+01e+i '+0e+-i '.1e+-i '1-10ei '0e++00i '1e--.1i '1.e-+1i 
       '1-0.e+i '1.+1e+i '-1.e--i '1.e+-.0i '1-e+01i '1-/101i '1+/10i '1-e10i 
       '-1+e+1i '.1-e-1i '1-/0e1i '1e10+.i '1/1.1+i '1/11.+i 
       '1/2e1-i '-1.0e-1-1-1.0e-1i '-1.0e-1-1.0e-1-1i
       '1.0e2/3 '-1e--1.e1i '-11e--1e1i '1e--1.1e1i '1.e-1-1.ei '-1.e--1.ei 
       '-1.1e1-e1i '-1.e1-e-1i '.1e1-e-11i 
       '3.-3. '1'2 '+-2 '1?
       '1a '1.a '-a '+a '1.. '..1 '-..1 '1ee1 '1ef2 '1+ief2 '1.+ '1.0- '1/2+/3
       '1'2 '1-i. '1-ie '1... '1/1/1/1 '1//1 '-.e1
       )
 (list "1e" "--1" "++1" "+." "+.+" ".." ".-" "1e-" "+" "-" "-e1"
       "1/2/3" "1/2+/2" "/2" "2/" "1+2" "1/+i" "1/2e1" "1/2."
       "1..0" "1.+0" "1--1" "1+-" "1.0++i" "1.0-ie++2" "1+1" "1.0." "1.0e"
       "1ee2" "1.0e2e2" "1es2" "1e1.0" "1.0.0" "1/2.0" "1+i2" "1+1.0i0" 
       "+.i" "i" "e" "e1" "1e.1" "1+.i" "1.0e.1" 
       "-.1ei" "-1.0+1.0" "1.0+1.0i+1.0" "1.1/2" "1/2.0" 
       "1/e" "1/i" "e/i" "1e2/3" "2/1e2" "1e2+1e2ii" "1i-1.0" "1.0-i/2" 
       "1/2i" "2i/3" "2+/i" "2+2/i" "2+2/-i" "2/-" "2/+" "2/+3" 
       "1e1.0" "1e1e2" "1+ie2" "1ei1" "1e/2" "0--" "1+" "1-" ".1." ".1+" 
       "1//2" "1/-/2" "1/2/" "1//" "+/1" ".0."
       "+0ei" "0e++i" "+0e+i" "0e+-i" "+0e-i" "+00ei" "+.0ei" "0+0ei" "-01ei" "+.1ei" 
       "1-1ei" "-1.ei" "0+.i" "0-.i" "1+e0i" "1+/0i" "1-/0i" "1+e1i" "1+/1i" "10+.i" 
       ".0+.i" "-0+.i" ".1+.i" "0.+.i" "00-.i" ".1-.i" "1.-.i" "1e++0i" "1e--1i" ".1e++i" 
       "+10e+i" "1+0e+i" "+01e+i" "+0e+-i" ".1e+-i" "1-10ei" "0e++00i" "1e--.1i" "1.e-+1i" 
       "1-0.e+i" "1.+1e+i" "-1.e--i" "1.e+-.0i" "1-e+01i" "1-/101i" "1+/10i" "1-e10i" 
       "-1+e+1i" ".1-e-1i" "1-/0e1i" "1e10+.i" "1/1.1+i" "1/11.+i" 
       "1/2e1-i" "-1.0e-1-1-1.0e-1i" "-1.0e-1-1.0e-1-1i" 
       "1.0e2/3" "-1e--1.e1i" "-11e--1e1i" "1e--1.1e1i" "1.e-1-1.ei" "-1.e--1.ei" 
       "-1.1e1-e1i" "-1.e1-e-1i" ".1e1-e-11i" 
       "3.-3." "'1'2" "'+-2" "'1?"
       "1a" "1.a" "-a" "+a" "1.." "..1" "-..1" "1ee1" "1ef2" "1+ief2" "1.+" "1.0-" "1/2+/3"
       "'1'2" "1-i." "1-ie" "1..." "1/1/1/1" "1//1" "-.e1"
       ))

(let ((val (catch #t 
		  (lambda ()
		    (= 1 
		       
		       01 +1 1. 
		       
		       001 +01 1/1 1.0 1e0 01. +1. #b1 #o1 #x1 2/2 3/3 4/4 5/5 6/6 7/7 8/8 9/9
		       1E0 1e0
		       
		       0001 +001 1/01 .1e1 01/1 +1/1 1.00 1e00 01.0 +1.0 1e+0 1e-0 01e0 +1e0 1.e0 001. +01. 1+0i 1-0i 
		       #b+1 #b01 #b1. #o+1 #o01 #o1. #x+1 #x01 #x1.
		       +1E0 +1e0 +2/2 +3/3 +4/4 +5/5 +6/6 +7/7 +8/8 +9/9
		       .1E1 0001 001. 01.0 01/1 01E0
		       02/2 03/3 04/4 05/5 06/6 07/7 08/8 09/9  
		       1.E0 1/01 1E+0 1E-0 1E00 
		       2/02 3/03 4/04 5/05 6/06 7/07 8/08 9/09 
		       
		       11/11 00001 +0001 1/001 .1e01 01/01 +1/01 .1e+1 10e-1 0.1e1 +.1e1 .10e1 001/1 +01/1 10/10 1.000 1e000 
		       01.00 +1.00 1e+00 1e-00 01e00 +1e00 1.e00 001.0 +01.0 01e+0 +1e+0 1.e+0 01e-0 +1e-0 1.e-0 001e0 +01e0 
		       1.0e0 01.e0 +1.e0 0001. +001. 1+00i 1-00i 1+.0i 1-.0i 01+0i +1+0i 1.+0i 01-0i +1-0i 1.-0i 1+0.i 1-0.i 
		       
		       11/011 011/11 +11/11 000001 +00001 1/0001 .1e001 01/001 +1/001 .1e+01 10e-01 0.1e01 +.1e01 .10e01 001/01 
		       +01/01 0.1e+1 +.1e+1 .10e+1 010e-1 +10e-1 10.e-1 00.1e1 +0.1e1 0.10e1 +.10e1 .100e1 0001/1 +001/1 10/010 
		       010/10 +10/10 1.0000 1e0000 01.000 +1.000 1e+000 1e-000 01e000 +1e000 1.e000 001.00 +01.00 01e+00 +1e+00 
		       1.e+00 01e-00 +1e-00 1.e-00 001e00 +01e00 1.0e00 01.e00 +1.e00 0001.0 +001.0 001e+0 +01e+0 1.0e+0 01.e+0 
		       +1.e+0 001e-0 +01e-0 1.0e-0 01.e-0 +1.e-0 0001e0 +001e0 1.00e0 01.0e0 +1.0e0 001.e0 +01.e0 00001. +0001. 
		       1+0e1i 1-0e1i 1+0/1i 1-0/1i 1+000i 1-000i 1+.00i 1-.00i 01+00i +1+00i 1.+00i 01-00i +1-00i 1.-00i 1+0.0i 
		       1-0.0i 01+.0i +1+.0i 1.+.0i 01-.0i +1-.0i 1.-.0i 001+0i +01+0i 1/1+0i 1.0+0i 1e0+0i 01.+0i +1.+0i 001-0i 
		       +01-0i 1/1-0i 1.0-0i 1e0-0i 01.-0i +1.-0i 1+0e0i 1-0e0i 1+00.i 1-00.i 01+0.i +1+0.i 1.+0.i 01-0.i +1-0.i 
		       1.-0.i 
		       
		       111/111 11/0011 011/011 +11/011 0011/11 +011/11 101/101 0000001 +000001 1/00001 .1e0001 01/0001 +1/0001 
		       .1e+001 10e-001 0.1e001 +.1e001 .10e001 001/001 +01/001 0.1e+01 +.1e+01 .10e+01 010e-01 +10e-01 10.e-01 
		       00.1e01 +0.1e01 0.10e01 +.10e01 .100e01 0001/01 +001/01 00.1e+1 +0.1e+1 0.10e+1 +.10e+1 .100e+1 0010e-1 
		       +010e-1 10.0e-1 010.e-1 +10.e-1 000.1e1 +00.1e1 00.10e1 +0.10e1 0.100e1 +.100e1 .1000e1 00001/1 +0001/1 
		       110/110 10/0010 010/010 +10/010 0010/10 +010/10 100/100 1.00000 1e00000 01.0000 +1.0000 1e+0000 1e-0000 
		       01e0000 +1e0000 1.e0000 001.000 +01.000 01e+000 +1e+000 1.e+000 01e-000 +1e-000 1.e-000 001e000 +01e000 
		       1.0e000 01.e000 +1.e000 0001.00 +001.00 001e+00 +01e+00 1.0e+00 01.e+00 +1.e+00 001e-00 +01e-00 1.0e-00 
		       01.e-00 +1.e-00 0001e00 +001e00 1.00e00 01.0e00 +1.0e00 001.e00 +01.e00 00001.0 +0001.0 0001e+0 +001e+0 
		       1.00e+0 01.0e+0 +1.0e+0 001.e+0 +01.e+0 0001e-0 +001e-0 1.00e-0 01.0e-0 +1.0e-0 001.e-0 +01.e-0 00001e0 
		       +0001e0 1.000e0 01.00e0 +1.00e0 001.0e0 +01.0e0 0001.e0 +001.e0 000001. +00001. 1+0e11i 1-0e11i 1+0/11i 
		       1-0/11i 1+0e01i 1-0e01i 1+0/01i 1-0/01i 1+0e+1i 1-0e+1i 1+0e-1i 1-0e-1i 1+00e1i 1-00e1i 1+.0e1i 1-.0e1i 
		       01+0e1i +1+0e1i 1.+0e1i 01-0e1i +1-0e1i 1.-0e1i 1+0.e1i 1-0.e1i 1+00/1i 1-00/1i 01+0/1i +1+0/1i 1.+0/1i 
		       01-0/1i +1-0/1i 1.-0/1i 1+0e10i 1-0e10i 1+0/10i 1-0/10i 1+0000i 1-0000i 1+.000i 1-.000i 01+000i +1+000i 
		       1.+000i 01-000i +1-000i 1.-000i 1+0.00i 1-0.00i 01+.00i +1+.00i 1.+.00i 01-.00i +1-.00i 1.-.00i 001+00i 
		       +01+00i 1/1+00i 1.0+00i 1e0+00i 01.+00i +1.+00i 001-00i +01-00i 1/1-00i 1.0-00i 1e0-00i 01.-00i +1.-00i 
		       1+0e00i 1-0e00i 1+00.0i 1-00.0i 01+0.0i +1+0.0i 1.+0.0i 01-0.0i +1-0.0i 1.-0.0i 001+.0i +01+.0i 1/1+.0i 
		       1.0+.0i 1e0+.0i 01.+.0i +1.+.0i 001-.0i +01-.0i 1/1-.0i 1.0-.0i 1e0-.0i 01.-.0i +1.-.0i 0001+0i +001+0i 
		       1/01+0i .1e1+0i 01/1+0i +1/1+0i 1.00+0i 1e00+0i 01.0+0i +1.0+0i 1e+0+0i 1e-0+0i 01e0+0i +1e0+0i 1.e0+0i 
		       001.+0i +01.+0i 1+0e+0i 1-0e+0i 0001-0i +001-0i 1/01-0i .1e1-0i 01/1-0i +1/1-0i 1.00-0i 1e00-0i 01.0-0i 
		       +1.0-0i 1e+0-0i 1e-0-0i 01e0-0i +1e0-0i 1.e0-0i 001.-0i +01.-0i 1+0e-0i 1-0e-0i 1+00e0i 1-00e0i 1+.0e0i 
		       1-.0e0i 01+0e0i +1+0e0i 1.+0e0i 01-0e0i +1-0e0i 1.-0e0i 1+0.e0i 1-0.e0i 1+000.i 1-000.i 01+00.i +1+00.i 
		       1.+00.i 01-00.i +1-00.i 1.-00.i 001+0.i +01+0.i 1/1+0.i 1.0+0.i 1e0+0.i 01.+0.i +1.+0.i 001-0.i +01-0.i 
		       1/1-0.i 1.0-0.i 1e0-0.i 01.-0.i +1.-0.i 
		       
		       111/0111 0111/111 +111/111 11/00011 011/0011 +11/0011 0011/011 +011/011 00011/11 +0011/11 101/0101 0101/101 
		       +101/101 00000001 +0000001 1/000001 .1e00001 01/00001 +1/00001 .1e+0001 10e-0001 0.1e0001 +.1e0001 .10e0001 
		       001/0001 +01/0001 0.1e+001 +.1e+001 .10e+001 010e-001 +10e-001 10.e-001 00.1e001 +0.1e001 0.10e001 +.10e001 
		       .100e001 0001/001 +001/001 00.1e+01 +0.1e+01 0.10e+01 +.10e+01 .100e+01 0010e-01 +010e-01 10.0e-01 010.e-01 
		       +10.e-01 000.1e01 +00.1e01 00.10e01 +0.10e01 0.100e01 +.100e01 .1000e01 00001/01 +0001/01 000.1e+1 +00.1e+1 
		       00.10e+1 +0.10e+1 0.100e+1 +.100e+1 .1000e+1 00010e-1 +0010e-1 10.00e-1 010.0e-1 +10.0e-1 0010.e-1 +010.e-1 
		       0000.1e1 +000.1e1 000.10e1 +00.10e1 00.100e1 +0.100e1 0.1000e1 +.1000e1 .10000e1 000001/1 +00001/1 110/0110 
		       0110/110 +110/110 10/00010 010/0010 +10/0010 0010/010 +010/010 00010/10 +0010/10 100/0100 0100/100 +100/100 
		       1.000000 1e000000 01.00000 +1.00000 1e+00000 1e-00000 01e00000 +1e00000 1.e00000 001.0000 +01.0000 01e+0000 
		       +1e+0000 1.e+0000 01e-0000 +1e-0000 1.e-0000 001e0000 +01e0000 1.0e0000 01.e0000 +1.e0000 0001.000 +001.000 
		       001e+000 +01e+000 1.0e+000 01.e+000 +1.e+000 001e-000 +01e-000 1.0e-000 01.e-000 +1.e-000 0001e000 +001e000 
		       1.00e000 01.0e000 +1.0e000 001.e000 +01.e000 00001.00 +0001.00 0001e+00 +001e+00 1.00e+00 01.0e+00 +1.0e+00 
		       001.e+00 +01.e+00 0001e-00 +001e-00 1.00e-00 01.0e-00 +1.0e-00 001.e-00 +01.e-00 00001e00 +0001e00 1.000e00 
		       01.00e00 +1.00e00 001.0e00 +01.0e00 0001.e00 +001.e00 000001.0 +00001.0 00001e+0 +0001e+0 1.000e+0 01.00e+0 
		       +1.00e+0 001.0e+0 +01.0e+0 0001.e+0 +001.e+0 00001e-0 +0001e-0 1.000e-0 01.00e-0 +1.00e-0 001.0e-0 +01.0e-0
		       0001.e-0 +001.e-0 000001e0 +00001e0 1.0000e0 01.000e0 +1.000e0 001.00e0 +01.00e0 0001.0e0 +001.0e0 00001.e0 
		       +0001.e0 0000001. +000001.))
		  (lambda args 'error))))
  (if (not (eq? val #t))
      (format #t ";funny 1's are not all equal to 1? ~A~%" val)))

(num-test (string->number "2.718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427") 2.718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427)

;; from testbase-report.ps Vern Paxson (with some changes)
;; resultant strings are thanks to clisp
(let ((cases 
       (list 
	(list '(* 49517601571415211 (expt 2 -94)) "2.5e-12")
	(list '(* 49517601571415211 (expt 2 -95)) "1.25e-12")
	(list '(* 54390733528642804 (expt 2 -133)) "4.995e-24")
	(list '(* 71805402319113924 (expt 2 -157)) "3.9305e-31")
	(list '(* 40435277969631694 (expt 2 -179)) "5.27705e-38")
	(list '(* 57241991568619049 (expt 2 -165)) "1.223955e-33")
	(list '(* 65224162876242886 (expt 2.0 58)) "1.8799585e+34")
	(list '(* 70173376848895368 (expt 2 -138)) "2.01387715e-25")
	(list '(* 37072848117383207 (expt 2 -99)) "5.849064105e-14")
	(list '(* 56845051585389697 (expt 2 -176)) "5.9349003055e-37")
	(list '(* 54791673366936431 (expt 2 -145)) "1.22847180395e-27")
	(list '(* 66800318669106231 (expt 2 -169)) "8.927076718085e-35")
	(list '(* 66800318669106231 (expt 2 -170)) "4.4635383590425e-35")
	(list '(* 66574323440112438 (expt 2 -119)) "1.00169908625495e-19")
	(list '(* 65645179969330963 (expt 2 -173)) "5.482941262802465e-36")
	(list '(* 61847254334681076 (expt 2 -109)) "9.529078328103644e-17")
	(list '(* 39990712921393606 (expt 2 -145)) "8.966227936640557e-28")
	(list '(* 59292318184400283 (expt 2 -149)) "8.308623441805854e-29")
	(list '(* 69116558615326153 (expt 2 -143)) "6.1985873566126555e-27")
	(list '(* 69116558615326153 (expt 2 -144)) "3.0992936783063277e-27")
	(list '(* 39462549494468513 (expt 2 -152)) "6.912351250617602e-30")
	(list '(* 39462549494468513 (expt 2 -153)) "3.456175625308801e-30")
	(list '(* 50883641005312716 (expt 2 -172)) "8.5e-36")
	(list '(* 38162730753984537 (expt 2 -170)) "2.55e-35")
	(list '(* 50832789069151999 (expt 2 -101)) "2.005e-14")
	(list '(* 51822367833714164 (expt 2 -109)) "7.984499999999999e-17")
	(list '(* 66840152193508133 (expt 2 -172)) "1.11655e-35")
	(list '(* 55111239245584393 (expt 2 -138)) "1.581615e-25")
	(list '(* 71704866733321482 (expt 2 -112)) "1.3809855e-17")
	(list '(* 67160949328233173 (expt 2 -142)) "1.20464045e-26")
	(list '(* 53237141308040189 (expt 2 -152)) "9.325140545e-30")
	(list '(* 62785329394975786 (expt 2 -112)) "1.2092014595e-17")
	(list '(* 48367680154689523 (expt 2 -77)) "3.20070458385e-07")
	(list '(* 42552223180606797 (expt 2 -102)) "8.391946324355e-15")
	(list '(* 63626356173011241 (expt 2 -112)) "1.2253990460585e-17")
	(list '(* 43566388595783643 (expt 2 -99)) "6.87356414897605e-14")
	(list '(* 54512669636675272 (expt 2 -159)) "7.459816430480385e-32")
	(list '(* 52306490527514614 (expt 2 -167)) "2.7960588398142556e-34")
	(list '(* 52306490527514614 (expt 2 -168)) "1.3980294199071278e-34")
	(list '(* 41024721590449423 (expt 2 -89)) "6.627901237305737e-11")
	(list '(* 37664020415894738 (expt 2 -132)) "6.917788004396807e-24")
	(list '(* 37549883692866294 (expt 2 -93)) "3.791569310834971e-12")
	(list '(* 69124110374399839 (expt 2 -104)) "3.408081767659137e-15")
	(list '(* 69124110374399839 (expt 2 -105)) "1.7040408838295685e-15")
	(list '(* 9 (expt 10 26)) "9e+26")
	(list '(* 79 (expt 10 -8)) "7.9e-07")
	(list '(* 393 (expt 10.0 26)) "3.93e+28")
	(list '(* 9171 (expt 10 -40)) "9.171e-37")
	(list '(* 56257 (expt 10 -16)) "5.6257e-12")
	(list '(* 281285 (expt 10 -17)) "2.81285e-12")
	(list '(* 4691113 (expt 10 -43)) "4.691113e-37")
	(list '(* 29994057 (expt 10 -15)) "2.9994057e-08")
	(list '(* 834548641 (expt 10 -46)) "8.34548641e-38")
	(list '(* 1058695771 (expt 10 -47)) "1.058695771e-38")
	(list '(* 87365670181 (expt 10 -18)) "8.7365670181e-08")
	(list '(* 872580695561 (expt 10 -36)) "8.72580695561e-25")
	(list '(* 6638060417081 (expt 10 -51)) "6.638060417081e-39")
	(list '(* 88473759402752 (expt 10 -52)) "8.8473759402752e-39")
	(list '(* 412413848938563 (expt 10 -27)) "4.12413848938563e-13")
	(list '(* 5592117679628511 (expt 10 -48)) "5.592117679628511e-33")
	(list '(* 83881765194427665 (expt 10 -50)) "8.388176519442766e-34")
					;(list '(* 638632866154697279 (expt 10 -35)) "6.3863286615469725e-18")
					;(list '(* 3624461315401357483 (expt 10 -53)) "3.6244613154013574e-35")
					;(list '(* 75831386216699428651 (expt 10 -30)) "7.583138621669942e-11")
					;(list '(* 356645068918103229683 (expt 10 -42)) "3.566450689181032e-22")
					;(list '(* 7022835002724438581513 (expt 10 -33)) "7.022835002724439e-12")
	(list '(* 7 (expt 10 -27)) "7e-27")
	(list '(* 37 (expt 10 -29)) "3.7e-28")
	(list '(* 743 (expt 10 -18)) "7.43e-16")
	(list '(* 7861 (expt 10 -33)) "7.861e-30")
	(list '(* 46073 (expt 10 -30)) "4.6073e-26")
	(list '(* 774497 (expt 10 -34)) "7.74497e-29")
	(list '(* 8184513 (expt 10 -33)) "8.184513e-27")
	(list '(* 89842219 (expt 10 -28)) "8.9842219e-21")
	(list '(* 449211095 (expt 10 -29)) "4.49211095e-21")
	(list '(* 8128913627 (expt 10 -40)) "8.128913627e-31")
	(list '(* 87365670181 (expt 10 -18)) "8.7365670181e-08")
	(list '(* 436828350905 (expt 10 -19)) "4.36828350905e-08")
	(list '(* 5569902441849 (expt 10 -49)) "5.569902441849e-37")
	(list '(* 60101945175297 (expt 10 -32)) "6.0101945175297e-19")
	(list '(* 754205928904091 (expt 10 -51)) "7.54205928904091e-37")
	(list '(* 5930988018823113 (expt 10 -37)) "5.930988018823113e-22")
	(list '(* 51417459976130695 (expt 10 -27)) "5.14174599761307e-11")
	(list '(* 826224659167966417 (expt 10 -41)) "8.262246591679665e-24")
					;(list '(* 9612793100620708287 (expt 10 -57)) "9.612793100620708e-39")
					;(list '(* 93219542812847969081 (expt 10 -39)) "9.321954281284797e-20")
					;(list '(* 544579064588249633923 (expt 10 -48)) "5.445790645882496e-28")
					;(list '(* 4985301935905831716201 (expt 10 -48)) "4.9853019359058315e-27")
	(list '(* 12676506 (expt 2 -102)) "2.499999999549897e-24")
	(list '(* 12676506 (expt 2 -103)) "1.2499999997749484e-24")
	(list '(* 15445013 (expt 2.0 86)) "1.1949999999989506e+33")
	(list '(* 13734123 (expt 2 -138)) "3.941499999999621e-35")
	(list '(* 12428269 (expt 2 -130)) "9.13084999999985e-33")
	(list '(* 15334037 (expt 2 -146)) "1.719004999999994e-37")
	(list '(* 11518287 (expt 2 -41)) "5.237910499999998e-06")
	(list '(* 12584953 (expt 2 -145)) "2.82164405e-37")
	(list '(* 15961084 (expt 2 -125)) "3.752432815e-31")
	(list '(* 14915817 (expt 2 -146)) "1.6721209165e-37")
	(list '(* 10845484 (expt 2 -102)) "2.13889458145e-24")
	(list '(* 16431059 (expt 2 -61)) "7.125835945615e-12")
	(list '(* 16093626 (expt 2.0 69)) "9.500000001279935e+27")
	(list '(* 9983778 (expt 2.0 25)) "335000000004096.0")
	(list '(* 12745034 (expt 2.0 104)) "2.5850000000046706e+38")
	(list '(* 12706553 (expt 2.0 72)) "6.000500000000674e+28")
	(list '(* 11005028 (expt 2.0 45)) "3.8720500000001465e+20")
	(list '(* 15059547 (expt 2.0 71)) "3.555835000000006e+28")
	(list '(* 16015691 (expt 2 -99)) "2.5268305000000024e-23")
	(list '(* 8667859 (expt 2.0 56)) "6.24585065e+23")
	(list '(* 14855922 (expt 2 -82)) "3.072132665e-18")
	(list '(* 14855922 (expt 2 -83)) "1.5360663325e-18")
	(list '(* 10144164 (expt 2 -110)) "7.81477968335e-27")
	(list '(* 13248074 (expt 2.0 95)) "5.248102799365e+35")
	(list '(* 5 (expt 10 -20)) "5e-20")
	(list '(* 67 (expt 10.0 14)) "6.7e+15")
	(list '(* 985 (expt 10.0 15)) "9.85e+17")
	(list '(* 7693 (expt 10 -42)) "7.693e-39")
	(list '(* 55895 (expt 10 -16)) "5.5895e-12")
	(list '(* 996622 (expt 10 -44)) "9.96622e-39")
	(list '(* 7038531 (expt 10 -32)) "7.038531e-26")
	(list '(* 60419369 (expt 10 -46)) "6.0419369e-39")
	(list '(* 702990899 (expt 10 -20)) "7.02990899e-12")
	(list '(* 6930161142 (expt 10 -48)) "6.930161142e-39")
	(list '(* 25933168707 (expt 10.0 13)) "2.5933168707e+23")
	(list '(* 596428896559 (expt 10.0 20)) "5.96428896559e+31")
	(list '(* 3 (expt 10 -23)) "3e-23")
	(list '(* 57 (expt 10.0 18)) "5.7e+19")
	(list '(* 789 (expt 10 -35)) "7.89e-33")
	(list '(* 2539 (expt 10 -18)) "2.539e-15")
	(list '(* 76173 (expt 10.0 28)) "7.6173e+32")
	(list '(* 887745 (expt 10 -11)) "8.87745e-06")
	(list '(* 5382571 (expt 10 -37)) "5.382571e-31")
	(list '(* 82381273 (expt 10 -35)) "8.2381273e-28")
	(list '(* 750486563 (expt 10 -38)) "7.50486563e-30")
	(list '(* 3752432815 (expt 10 -39)) "3.752432815e-30")
	(list '(* 75224575729 (expt 10 -45)) "7.5224575729e-35")
	(list '(* 459926601011 (expt 10.0 15)) "4.59926601011e+26") ; 10.0 (and 2.0 above) because we aren't interested here in numeric overflows
	)))
  (let ((maxdiff 0.0)
	(maxdiff-case ()))
    (do ((lst cases (cdr lst)))
	((null? lst))
      (let* ((form (caar lst))
	     (str (cadar lst))
	     (num (eval form))
	     (fnum (* 1.0 num))
	     (n2s (number->string fnum))
	     (s2n (string->number n2s))
	     (mnum (string->number str))
	     (diff (let ()
		     (if (not (string? n2s))
			 (format #t "(number->string ~A) #f?~%" fnum))
		     (if (not (number? s2n))
			 (format #t "(string->number ~S) #f?~%" n2s))
		     (/ (abs (- mnum s2n)) (max (expt 2 -31.0) (abs fnum))))))
	(if (> diff maxdiff)
	    (begin
	      (set! maxdiff diff)
	      (set! maxdiff-case (car lst))))))
    (if (> maxdiff 1e-15) ; we're only interested in real problems
	(format #t ";number->string rounding checks worst case relative error ~A ~A ~S~%" maxdiff (car maxdiff-case) (cadr maxdiff-case)))
    ))


#|
;;; here's code to generate all (im)possible numbers (using just a few digits) of a given length

(define file (open-output-file "ntest.scm"))
(define chars (list #\1 #\0 #\9 #\# #\. #\+ #\- #\e #\i #\/ #\b #\x #\d #\o #\l #\s #\f #\@))

(define (all-syms len with-file)
  (let ((sym (make-string len))
	(num-chars (length chars))
	(ctrs (make-vector len 0)))
    (do ((i 0 (+ i 1)))
	((= i (expt num-chars len)))
      (let ((carry #t))
	(do ((k 0 (+ k 1)))
	    ((or (= k len)
		 (not carry)))
	  (vector-set! ctrs k (+ 1 (vector-ref ctrs k)))
	  (if (= (vector-ref ctrs k) num-chars)
	      (vector-set! ctrs k 0)
	      (set! carry #f)))
	(do ((k 0 (+ k 1)))
	    ((= k len))
	  (string-set! sym k (list-ref chars (vector-ref ctrs k)))))
      (let ((tag (catch #t (lambda () (string->number sym)) (lambda args (car args)))))
	(if (not with-file)
	    (if (and (number? tag)
		     (= tag 1))
		(format #t "~S " sym))
	    (begin
	      (if (number? tag)
		  (format file "(if (not (number? (string->number ~S))) (begin (display ~S) (display #\\space)))" sym sym)
		  (format file "(if (number? (string->number ~S)) (begin (display ~S) (display #\\space)))" sym sym))
	      (newline file)))))))

(do ((len 1 (+ len 1)))
    ((= len 12))
  (all-syms len #f))

(close-output-port file)
|#

(let ()
  (define (~ !) (* 2 !))
  (test (~ 3) 6)
  (define (~~ !) (* 2 !))
  (test (~~ 3) 6)
  (define (\x00 !) (* 2 !))
  (test (\x00 3) 6))

(for-each
 (lambda (n name)
   (if (number? n)
       (format #t ";(number? ~A) returned #t?~%" name)))
 (list
  'a9 'aa 'aA 'a! 'a$ 'a% 'a& 'a* 'a+ 'a- 'a. 'a/ 'a: 'a< 'a= 'a> 'a? 'a@ 'a^ 'a_ 'a~ 'A9 'Aa 'AA 'A! 'A$ 'A% 'A& 'A* 'A+ 'A- 'A. 'A/ 'A: 'A< 'A= 'A> 'A? 'A@ 'A^ 'A_ 'A~ '!9 '!a '!A '!! '!$ '!% '!& '!* '!+ '!- '!. '!/ '!: '!< '!= '!> '!? '!@ '!^ '!_ '!~ '$9 '$a '$A '$! '$$ '$% '$& '$* '$+ '$- '$. '$/ '$: '$< '$= '$> '$? '$@ '$^ '$_ '$~ '%9 '%a '%A '%! '%$ '%% '%& '%* '%+ '%- '%. '%/ '%: '%< '%= '%> '%? '%@ '%^ '%_ '%~ '&9 '&a '&A '&! '&$ '&% '&& '&* '&+ '&- '&. '&/ '&: '&< '&= '&> '&? '&@ '&^ '&_ '&~ '*9 '*a '*A '*! '*$ '*% '*& '** '*+ '*- '*. '*/ '*: '*< '*= '*> '*? '*@ '*^ '*_ '*~ '/9 '/a '/A '/! '/$ '/% '/& '/* '/+ '/- '/. '// '/: '/< '/= '/> '/? '/@ '/^ '/_ '/~ ':9 ':a ':A ':! ':$ ':% ':& ':* ':+ ':- ':. ':/ ':: ':< ':= ':> ':? ':@ ':^ ':_ ':~ '<9 '<a '<A '<! '<$ '<% '<& '<* '<+ '<- '<. '</ '<: '<< '<= '<> '<? '<@ '<^ '<_ '<~ '=9 '=a '=A '=! '=$ '=% '=& '=* '=+ '=- '=. '=/ '=: '=< '== '=> '=? '=@ '=^ '=_ '=~ '>9 '>a '>A '>! '>$ '>% '>& '>* '>+ '>- '>. '>/ '>: '>< '>= '>> '>? '>@ '>^ '>_ '>~ '?9 '?a '?A '?! '?$ '?% '?& '?* '?+ '?- '?. '?/ '?: '?< '?= '?> '?? '?@ '?^ '?_ '?~ '^9 '^a '^A '^! '^$ '^% '^& '^* '^+ '^- '^. '^/ '^: '^< '^= '^> '^? '^@ '^^ '^_ '^~ '_9 '_a '_A '_! '_$ '_% '_& '_* '_+ '_- '_. '_/ '_: '_< '_= '_> '_? '_@ '_^ '__ '_~ '~9 '~a '~A '~! '~$ '~% '~& '~* '~+ '~- '~. '~/ '~: '~< '~= '~> '~? '~@ '~^ '~_ '~~)
 
 (list
  "'a9" "'aa" "'aA" "'a!" "'a$" "'a%" "'a&" "'a*" "'a+" "'a-" "'a." "'a/" "'a:" "'a<" "'a=" "'a>" "'a?" "'a@" "'a^" "'a_" "'a~" "'A9" "'Aa" "'AA" "'A!" "'A$" "'A%" "'A&" "'A*" "'A+" "'A-" "'A." "'A/" "'A:" "'A<" "'A=" "'A>" "'A?" "'A@" "'A^" "'A_" "'A~" "'!9" "'!a" "'!A" "'!!" "'!$" "'!%" "'!&" "'!*" "'!+" "'!-" "'!." "'!/" "'!:" "'!<" "'!=" "'!>" "'!?" "'!@" "'!^" "'!_" "'!~" "'$9" "'$a" "'$A" "'$!" "'$$" "'$%" "'$&" "'$*" "'$+" "'$-" "'$." "'$/" "'$:" "'$<" "'$=" "'$>" "'$?" "'$@" "'$^" "'$_" "'$~" "'%9" "'%a" "'%A" "'%!" "'%$" "'%%" "'%&" "'%*" "'%+" "'%-" "'%." "'%/" "'%:" "'%<" "'%=" "'%>" "'%?" "'%@" "'%^" "'%_" "'%~" "'&9" "'&a" "'&A" "'&!" "'&$" "'&%" "'&&" "'&*" "'&+" "'&-" "'&." "'&/" "'&:" "'&<" "'&=" "'&>" "'&?" "'&@" "'&^" "'&_" "'&~" "'*9" "'*a" "'*A" "'*!" "'*$" "'*%" "'*&" "'**" "'*+" "'*-" "'*." "'*/" "'*:" "'*<" "'*=" "'*>" "'*?" "'*@" "'*^" "'*_" "'*~" "'/9" "'/a" "'/A" "'/!" "'/$" "'/%" "'/&" "'/*" "'/+" "'/-" "'/." "'//" "'/:" "'/<" "'/=" "'/>" "'/?" "'/@" "'/^" "'/_" "'/~" "':9" "':a" "':A" "':!" "':$" "':%" "':&" "':*" "':+" "':-" "':." "':/" "'::" "':<" "':=" "':>" "':?" "':@" "':^" "':_" "':~" "'<9" "'<a" "'<A" "'<!" "'<$" "'<%" "'<&" "'<*" "'<+" "'<-" "'<." "'</" "'<:" "'<<" "'<=" "'<>" "'<?" "'<@" "'<^" "'<_" "'<~" "'=9" "'=a" "'=A" "'=!" "'=$" "'=%" "'=&" "'=*" "'=+" "'=-" "'=." "'=/" "'=:" "'=<" "'==" "'=>" "'=?" "'=@" "'=^" "'=_" "'=~" "'>9" "'>a" "'>A" "'>!" "'>$" "'>%" "'>&" "'>*" "'>+" "'>-" "'>." "'>/" "'>:" "'><" "'>=" "'>>" "'>?" "'>@" "'>^" "'>_" "'>~" "'?9" "'?a" "'?A" "'?!" "'?$" "'?%" "'?&" "'?*" "'?+" "'?-" "'?." "'?/" "'?:" "'?<" "'?=" "'?>" "'??" "'?@" "'?^" "'?_" "'?~" "'^9" "'^a" "'^A" "'^!" "'^$" "'^%" "'^&" "'^*" "'^+" "'^-" "'^." "'^/" "'^:" "'^<" "'^=" "'^>" "'^?" "'^@" "'^^" "'^_" "'^~" "'_9" "'_a" "'_A" "'_!" "'_$" "'_%" "'_&" "'_*" "'_+" "'_-" "'_." "'_/" "'_:" "'_<" "'_=" "'_>" "'_?" "'_@" "'_^" "'__" "'_~" "'~9" "'~a" "'~A" "'~!" "'~$" "'~%" "'~&" "'~*" "'~+" "'~-" "'~." "'~/" "'~:" "'~<" "'~=" "'~>" "'~?" "'~@" "'~^" "'~_" "'~~"))

					;(let ((initial-chars "aA!$%&*/:<=>?^_~")
					;      (subsequent-chars "9aA!$%&*+-./:<=>?@^_~"))
					;  (do ((i 0 (+ i 1)))
					;      ((= i (string-length initial-chars)))
					;    (do ((k 0 (+ k 1)))
					;	((= k (string-length subsequent-chars)))
					;      (format #t "'~A " (string (string-ref initial-chars i) (string-ref subsequent-chars k))))))


(for-each
 (lambda (z)
   (if (not (zero? z))
       (format #t "~A is not zero?~%" z))
   (if (and (real? z) (positive? z))
       (format #t "~A is positive?~%" z))
   (if (and (real? z) (negative? z))
       (format #t "~A is negative?~%" z)))
 '(0 -0 +0 0.0 -0.0 +0.0 0/1 -0/1 +0/24 0+0i 0-0i -0-0i +0-0i 0.0-0.0i -0.0+0i #b0 #o-0 #x000 000/111))


(for-each 
 (lambda (x) 
   (if (string->number x)
       (format #t ";(string->number ~A) returned ~A~%" x (string->number x))))
 '("" "q" "1q" "6+7iq" "8+9q" "10+11" "13+" "18@19q" "20@q" "23@"
   "+25iq" "26i" "-q" "-iq" "i" "5#.0" "8/" "10#11" ".#" "."
   "3.4q" "15.16e17q" "18.19e+q" ".q" ".17#18" "10q" "#b2" "#b12" "#b-12"
   "#b3" "#b4" "#b5" "#b6" "#b7" "#b8" "#b9" "#ba" "#bb" "#bc"
   "#bd" "#be" "#bf" "#q" "#xag" "#x1x"
   "#o8" "#o9" "#o#" 
   "-#b1" "+#b1" "#b1/#b2" "#b1+#b1i" "1+#bi" "1+#b1i" "1#be1" "#b" "#o" "#" "1+ie1" "1+i1" "1e+1i"
   "#b#b" "1e3e4" "1.0e-3e+4" "1e3s" "1e3s3" "1e-i" "#be1" "1/i" "1/e1" "1+e1"
   "1e+" "1e1+" "1e1e1" "1e-+1" "1e0x1" "1e-" "1/#o2" "-#xae" "-#o-7"
   "12@12i"))

(for-each 
 (lambda (couple)
   (apply
    (lambda (x y)
      (let ((xx (string->number x)))
	(if (or (not xx)
		(not y)
		(and (rational? y)
		     (not (eqv? xx y)))
		(> (abs (- xx y)) 1e-12))
	    (format #t ";(string->number ~A) returned ~A but expected ~A (~A ~A ~A ~A)~%"
		    x (string->number x) y
		    xx (eq? xx #f)
		    (if (and xx y) (and (rational? y) (not (eqv? xx y))) #f)
		    (if (and xx y) (abs (- xx y)) #f)))))
    couple))
 '(
   ("#b0" 0)  ("#b1" 1) ("#o0" 0) ("#b-1" -1) ("#b+1" 1)
   ("#o1" 1)  ("#o2" 2) ("#o3" 3) ("#o-1" -1)
   ("#o4" 4)  ("#o5" 5) ("#o6" 6)
   ("#o7" 7)  
   ("#xa" 10) ("#xb" 11) ("#x-1" -1) ("#x-a" -10)
   ("#xc" 12) ("#xd" 13) 
   ("#xe" 14) ("#xf" 15) ("#x-abc" -2748)
   ("#b1010" 10)
   ("#o12345670" 2739128)
   ("#x1234567890abcdef" 1311768467294899695)
   ("1" 1) ("23" 23) ("-1" -1) 
   ("-45" -45)                      ;("2#" 20.0) ("2##" 200.0) ("12##" 1200.0) ; this # = 0 is about the stupidest thing I've ever seen
   ("#xA" 10) ("#xB" 11) ("#x-1" -1) ("#x-A" -10)
   ("#xC" 12) ("#xD" 13) 
   ("#xE" 14) ("#xF" 15) ("#x-ABC" -2748)
   ("#xaBC" 2748) ("#xAbC" 2748) ("#xabC" 2748) ("#xABc" 2748)
   ("1/1" 1) ("1/2" 1/2) ("-1/2" -1/2) 
   ("1e2" 100.0) 
   ("1e+2" 100.0) ("1e-2" 0.01)
   (".1" .1) (".0123456789" 123456789e-10) 
   (".0123456789e10" 123456789.0)
   ("3." 3.0) ("3.e0" 3.0)
   ("1+i" 1+1i) ("1-i" 1-1i) 
   ))

;;; some schemes are case insensitive throughout -- they accept 0+I, #X11 etc

(for-each
 (lambda (arg)
   (test (string->number arg) 'error))
 (list -1 #f #\a 1 _ht_ _undef_ _null_ _c_obj_ #(1 2 3) 3.14 3/4 1.0+1.0i () 'hi abs #(()) (list 1 2 3) '(1 . 2) (lambda () 1)))

(for-each
 (lambda (arg)
   (test (string->number "123" arg) 'error)
   (test (string->number "1" arg) 'error))
 (list -1 0 1 17 #f _ht_ _undef_ _null_ _c_obj_ #\a #(1 2 3) 3.14 3/4 1.5+0.3i 1+i () "" "12" #() :hi most-positive-fixnum most-negative-fixnum 'hi abs #(()) (list 1 2 3) '(1 . 2) (lambda () 1)))

;; (string->number "0" 1) ?? why not?

(for-each
 (lambda (arg)
   (test (number->string arg) 'error))
 (list #\a #(1 2 3) () _ht_ _undef_ _null_ _c_obj_ 'hi abs "hi" #(()) #f (list 1 2 3) '(1 . 2) (lambda () 1)))

(for-each
 (lambda (arg)
   (test (number->string 123 arg) 'error))
 (list -1 17 most-positive-fixnum most-negative-fixnum 0 1 512 _ht_ _undef_ _null_ _c_obj_ #\a #f #(1 2 3) 3.14 2/3 1.5+0.3i 1+i () 'hi abs "hi" #(()) (list 1 2 3) '(1 . 2) (lambda () 1)))

(test (string->number "34.1" (+ 5 (expt 2 32))) 'error)
(test (number->string 34.1 (+ 5 (expt 2 32))) 'error)
(test (string->number) 'error)
(test (string->number 'symbol) 'error)
(test (string->number "1.0" "1.0") 'error)
(test (number->string) 'error)
(test (number->string "hi") 'error)
(test (number->string 1.0+23.0i 1.0+23.0i 1.0+23.0i) 'error)
(test (string->number "") #f)
(test (string->number "" 8) #f)
(test (string->number (make-string 0)) #f)
(test (string->number (string #\null)) #f)
(test (string->number (string)) #f)
(test (string->number (substring "hi" 0 0)) #f)
(test (string->number (string (integer->char 30))) #f)
(test (string->number "123" 10+0i) 'error) ; a real in s7

(when with-bignums
  (test (number->string -46116860184273879035/27670116110564327424) "-46116860184273879035/27670116110564327424")
  (test (number->string 123 (bignum "10")) "123")
  (test (number->string 123 (bignum "2")) "1111011")
  (test (string->number "123" (bignum "10")) 123)
  (test (string->number "1111011" (bignum "2")) 123)
  (test (number->string 123 (bignum "17")) 'error)
  (test (number->string 123 (bignum "-1")) 'error)
  (test (number->string 123 (bignum "1")) 'error)
  (test (number->string 123 (bignum "1/2")) 'error)
  (test (string->number "101" (bignum "17")) 'error)
  (test (string->number "101" (bignum "1")) 'error)
  (test (string->number "101" (bignum "-1")) 'error)
  (test (string->number "101" (bignum "1/2")) 'error))

(num-test (- (string->number "11880772664.84631001" 10) (string->number "1.188077266484631001E10" 10)) 0.0)
(num-test (- (string->number "11880772.66484631001" 10) (string->number "1.188077266484631001E7" 10)) 0.0)
(if with-bignums 
    (num-test (- (string->number "118807726648463.1001" 10) (string->number "1.188077266484631001E14" 10)) 0.0)
    (test (> (abs (- (string->number "118807726648463.1001" 10) (string->number "1.188077266484631001E14" 10))) 1e-1) #f))
(if with-bignums
    (num-test (- (string->number "118807726648463.1001" 9) (string->number "1.188077266484631001E14" 9)) 0.0)
    (test (> (abs (- (string->number "118807726648463.1001" 9) (string->number "1.188077266484631001E14" 9))) 1e-1) #f))
(num-test (- (string->number "11880772664.84631001" 9) (string->number "1.188077266484631001E10" 9)) 0.0)
(num-test (- (string->number "11880772.66484631001" 9) (string->number "1.188077266484631001E7" 9)) 0.0)

#|
(num-test (- (string->number "1188077266484631001.") (string->number "1.188077266484631001E18")) 0.0)
(num-test (- (string->number "1188077266484631001." 10) (string->number "1.188077266484631001E18" 10)) 0.0)
(num-test (- (string->number "118807726648463100.1" 10) (string->number "1.188077266484631001E17" 10)) 0.0)
(num-test (- (string->number "118807726648463100100." 9) (string->number "1.188077266484631001E20" 9)) 0.0)
(num-test (- (string->number "1188077266484631001." 9) (string->number "1.188077266484631001E18" 9)) 0.0)
(num-test (- (string->number "118807726648463100.1" 9) (string->number "1.188077266484631001E17" 9)) 0.0)
;; (num-test (- (string->number "1177077266474631001000." 8) (string->number "1.177077266474631001E21" 8)) 0.0)
;; a fake unfortunately -- actually all of these are not what they appear to be
|#

(num-test 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111e-300 1.111111111111111111111111111111111111113E-1)
(num-test 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001e300 1.0)
(num-test 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001e309 1.0)
(num-test 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000123e309 1.23)
(num-test -.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000123456e312 -1234.56)

(num-test (string->number "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111e-300") 1.111111111111111111111111111111111111113E-1)
(num-test (string->number "0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001e300") 1.0)
(num-test (string->number "0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001e309") 1.0)
(num-test (string->number "0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000123e309") 1.23)
(num-test (string->number "-.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000123456e312") -1234.56)

(num-test #b0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001e300 1.0)
(num-test #o0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001e300 1.0)
(num-test #x0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001e300 1.0)

(num-test 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001e600 10.0)

(num-test 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-300 1.0)
(num-test 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-309 1.0)
(num-test -1234000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-309 -1.234)

(num-test (string->number "1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-300") 1.0)
(num-test (string->number "1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-309") 1.0)
(num-test (string->number "-1234000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-309") -1.234)

(num-test 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-300 1.0)
(num-test (string->number "1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-300") 1.0)

(num-test 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-309 1.0)
(num-test (string->number "1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-309") 1.0)

(num-test (string->number "7218817.36503571385593731949749063134519967478471341285646368059547752954588980538968510599079437e7") 7.218817365035713855937319497490631345183E13)
(num-test (string->number "-8209943b.31283867353472bb21b" 12) -2.928292312585025742274395996260284298851E8)
(test (string->number "-8209943b.31283867353472bc21b" 12) #f)
(num-test (string->number "-25708892.1b6583269007366320788640bb79398b32a42" 12) -8.835044616346879740283599816201349374646E7)
(test (string->number "-25708892.1b6583269007366320788640bb79398b32ac2" 12) #f)
(num-test (string->number "9418.b89a40b0211a01147b75b23a529b0382775b32b+45936610b.a936586185a57b00ba4a90a139343235054b2i" 12) 1.614897792919114090019672485580641433273E4+1.926841115897881740778679262842131716289E9i)

(num-test (string->number "1.0e0000000000000000000000000000000000001") 10.0)

(num-test 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001 10.0)
(num-test (string->number "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001") 10.0)

(num-test (string->number "\
0000000000000000000000000000000000000000\
0000000000000000000000000000000000000000\
0000000000000000000000000000000000000000\
0000000000000000000000000000000000000000\
0000000000000000000000000000000000000000\
0000000000000000000000000000000000000000\
0000000000000000000000000000000000000000\
0000000000000000000000000000000000000000\
0000000000000000000000000000000000000000\
0000000000000000000000000000000000000000\
1.00000000000000000000000000000000000000\
0000000000000000000000000000000000000000\
0000000000000000000000000000000000000000\
0000000000000000000000000000000000000000\
0000000000000000000000000000000000000000\
0000000000000000000000000000000000000000\
0000000000000000000000000000000000000000\
0000000000000000000000000000000000000000\
0000000000000000000000000000000000000000\
0000000000000000000000000000000000000000\
00e0000000000000000000000000000000000000\
0000000000000000000000000000000000000000\
0000000000000000000000000000000000000000\
0000000000000000000000000000000000000000\
0000000000000000000000000000000000000000\
0000000000000000000000000000000000000000\
0000000000000000000000000000000000000000\
0000000000000000000000000000000000000000\
0000000000000000000000000000000000000000\
0000000000000000000000000000000000000000\
0001") 10.0)

;;; this whitespace handling only works in string constants in s7, not in arbitrary code.

(num-test 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001/00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001 1)
(num-test (string->number "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001/00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001") 1)

#|
;;; if not gmp:
:(string->number "0.999999999999999")
1.0
:(number->string 0.999999999999999)
"1.0"
also
:(string->number ".0999999999999995")
                 0.099999999999999
:(string->number ".0999999999999996")
                 0.1
:(string->number ".0fffffffffff" 16)
0.062499999999996
:(string->number ".0ffffffffffff" 16)
0.0625
but
:(number->string 0.062499999999996 16)
"0.0ffffffffffee"
:(number->string (string->number ".0fffffffffff" 16)  16)
"0.0fffffffffff"
 the 0.624... version is actually an approximation (off by 4.4408920985006e-16)
:(number->string 0.062499999999996 16)
"0.0ffffffffffedfc506118a9ea64de0c590"
more non-gmp:
:9999999999999999999
-8446744073709551617
:9999999999999999991
-8446744073709551625
:-9999999999999999991
8446744073709551625
:9223372036854775810
-9223372036854775806
etc
|#

(when with-bignums
  (test (char=? ((number->string 9.999999999999999) 0) #\9) #t)
  (test (char=? ((number->string 0.999999999999999999) 3) #\9) #t)
  (num-test -0.1e309 -1e308)
  (num-test .01e310 1e308)
  (num-test .1e310 1e309)
  (num-test 0.0e310 0.0))
  


;;; --------------------------------------------------------------------------------
;;; bignum
;;; --------------------------------------------------------------------------------

(when with-bignums
  (test (bignum? (bignum "2")) #t)
  
  (num-test (bignum "6/3") 2)
  (num-test (bignum "+3/6") 1/2)
  (num-test (bignum "7447415382/3") 2482471794)
  
  (for-each
   (lambda (n)
     (test (bignum? n) #f))
   (list 0 1 -1 1/3 1.0 1+i 1073741824 1.0e8 1+1.0e8i "hi" () (integer->char 65) #f #t '(1 2) 'a-symbol _ht_ _undef_ _null_ _c_obj_ (cons 1 2) (make-vector 3) abs))
  
  (for-each 
   (lambda (n)
     (test (bignum? n) #t))
   (list 1.0e30 -1.0e20+i 1.0+1.0e80i 1e100 1267650600228229401496703205376 -1267650600228229401496703205376
	 1180591620717411303424/3 3/1180591620717411303424 1180591620717411303424/1180591620717411303423
	 1267650600228229401496703205376.99 -1267650600228229401496703205376.88 0.1231231231231231231231231231))
  (for-each
   (lambda (n)
     (test (bignum n) 'error)
     (test (bignum "1.0" n) 'error))
   (list "hi" (integer->char 65) #f #t '(1 2) 'a-symbol (cons 1 2) () _ht_ _undef_ _null_ _c_obj_ (make-vector 3) 1 3/4 1.5 1+i abs))
  
  (test (bignum?) 'error)
  (test (bignum? 1 2) 'error)
  
  (test (bignum) 'error)
  (test (bignum "hi" "ho") 'error)
  (test (bignum "") 'error)
  (test (bignum " ") 'error)
  (test (bignum " 1 ") 'error)
  (test (bignum "abc") 'error)
  (test (bignum "1/2/3") 'error))




;;; --------------------------------------------------------------------------------
;;; errors
;;; --------------------------------------------------------------------------------

(let ()
  (for-each

   (lambda (op)
     (for-each

      (lambda (arg)
	(let ((val (catch #t (lambda () (op arg)) (lambda args 'error))))
	  (if (not (eq? val 'error))
	      (format #t "(~A ~A) -> ~A (expected 'error)~%" op arg val)))
	(let ((val (catch #t (lambda () (op 0 arg)) (lambda args 'error))))
	  (if (not (eq? val 'error))
	      (format #t "(~A 0 ~A) -> ~A (expected 'error)~%" op arg val)))
	(let ((val (catch #t (lambda () (op 0 1 arg)) (lambda args 'error))))
	  (if (not (eq? val 'error))
	      (format #t "(~A 0 1 ~A) -> ~A (expected 'error)~%" op arg val)))
	(if with-bignums
	    (let ((val (catch #t (lambda () (op (expt 2 60) arg)) (lambda args 'error))))
	      (if (not (eq? val 'error))
		  (format #t "(~A 2^60 ~A) -> ~A (expected 'error)~%" op arg val)))))

      (list "hi" () #\a (list 1) '(1 . 2) #f 'a-symbol (make-vector 3) abs #t _ht_ _undef_ _null_ _c_obj_ :hi (if #f #f) (lambda (a) (+ a 1)) #<undefined> #<unspecified> #<eof> :rest)))

   (list exact? inexact? zero? positive? negative? even? odd? quotient remainder modulo truncate floor ceiling round
	 abs max min gcd lcm expt exact->inexact inexact->exact rationalize numerator denominator imag-part real-part
	 magnitude angle make-polar complex sqrt exp log sin cos tan asin acos atan number->string
	 + - * / < > <= >= =)))

(let ((d 3.14)
      (i 32)
      (r 2/3)
      (c 1.5+0.3i))
  (let ((check-vals (lambda (name)
		      (if (or (not (= d 3.14)) ; (> (abs (- d 3.14)) 1e-16) ; (- 3.14 (bignum "3.14")) is around 1e-17!
			      (not (= i 32))
			      (not (= r 2/3))
			      (not (= c 1.5+0.3i))) ; (> (magnitude (- c 1.5+0.3i)) 1e-16))
			  (begin 
			    (display name) (display " changed ")
			    (if (not (= i 32))
				(begin (display "stored integer to: ") (display i))
				(if (not (= r 2/3))
				    (begin (display "stored ratio to: ") (display r))
				    (if (not (= d 3.14))
					(begin (display "stored real to: ") (display d))
					(begin (display "stored complex to: ") (display c)))))
			    (display "?") (newline))))))
    (for-each
     (lambda (op)
       (let ((x (catch #t (lambda () (op i)) (lambda args 'error))))
	 (check-vals op))
       (let ((x (catch #t (lambda () (op r)) (lambda args 'error))))
	 (check-vals op))
       (let ((x (catch #t (lambda () (op d)) (lambda args 'error))))
	 (check-vals op))
       (let ((x (catch #t (lambda () (op c)) (lambda args 'error))))
	 (check-vals op))
       (let ((x (catch #t (lambda () (op i d)) (lambda args 'error))))
	 (check-vals op))
       (let ((x (catch #t (lambda () (op r d)) (lambda args 'error))))
	 (check-vals op))
       (let ((x (catch #t (lambda () (op d d)) (lambda args 'error))))
	 (check-vals op))
       (let ((x (catch #t (lambda () (op c d)) (lambda args 'error))))
	 (check-vals op)))
     (list
      number->string string->number complex magnitude abs exp make-polar angle
      sin cos tan sinh cosh tanh atan sqrt log asinh acosh atanh acos asin
      number? integer? real? complex? rational? even? odd? zero? positive? negative? real-part imag-part
      numerator denominator rationalize exact? inexact? exact->inexact inexact->exact floor ceiling truncate round
      logior logxor logand lognot logbit? ash integer-length
      + - * / quotient remainder
      expt = max min modulo < > <= >= lcm gcd 
      ))))

(when with-bignums
  (test (bignum "1/3.0") 'error)
  
  (let ((d (bignum "3.14"))
	(i (bignum "32"))
	(r (bignum "2/3"))
	(c (bignum "1.5+0.3i")))
    (let ((check-vals (lambda (name)
			(if (or (not (= d (bignum "3.14"))) ; see above
				(not (= i 32))
				(not (= r 2/3))
				(not (= c (bignum "1.5+0.3i"))))
			    (begin 
			      (display name) (display " changed ")
			      (if (not (= i 32))
				  (begin (display "stored integer to: ") (display i))
				  (if (not (= r 2/3))
				      (begin (display "stored ratio to: ") (display r))
				      (if (not (= d 3.14))
					  (begin (display "stored real to: ") (display d))
					  (begin (display "stored complex to: ") (display c)))))
			      (display "?") (newline))))))
      (for-each
       (lambda (op)
	 (let ((x (catch #t (lambda () (op i)) (lambda args 'error))))
	   (check-vals op))
	 (let ((x (catch #t (lambda () (op r)) (lambda args 'error))))
	   (check-vals op))
	 (let ((x (catch #t (lambda () (op d)) (lambda args 'error))))
	   (check-vals op))
	 (let ((x (catch #t (lambda () (op c)) (lambda args 'error))))
	   (check-vals op))
	 (let ((x (catch #t (lambda () (op i d)) (lambda args 'error))))
	   (check-vals op))
	 (let ((x (catch #t (lambda () (op r d)) (lambda args 'error))))
	   (check-vals op))
	 (let ((x (catch #t (lambda () (op d d)) (lambda args 'error))))
	   (check-vals op))
	 (let ((x (catch #t (lambda () (op c d)) (lambda args 'error))))
	   (check-vals op)))
       (list
	number->string string->number complex magnitude abs exp make-polar angle
	sin cos tan sinh cosh tanh atan sqrt log asinh acosh atanh acos asin
	number? integer? real? complex? rational? even? odd? zero? positive? negative? real-part imag-part
	numerator denominator rationalize exact? inexact? exact->inexact inexact->exact floor ceiling truncate round
	logior logxor logand lognot logbit? ash integer-length
	+ - * / quotient remainder
	expt = max min modulo < > <= >= lcm gcd 
	))))
  
  (for-each
   (lambda (arg)
     (test (bignum "1.0" arg) 'error))
   (list -1 0 #\a #(1 2 3) 2/3 1.5+0.3i 1+i () 'hi abs "hi" #(()) (list 1 2 3) '(1 . 2) (lambda () 1))))



#|
(let ((funcs (list
	      make-polar complex magnitude angle real-part imag-part numerator denominator rationalize abs
	      exp log sin cos tan asin acos atan sinh cosh tanh asinh acosh atanh sqrt floor ceiling truncate
	      round lcm gcd + - * / max min quotient remainder modulo = < > <= >= even? odd? zero? positive? negative?
	      infinite? inexact->exact exact->inexact integer-length logior logxor logand lognot logbit?
	      ash integer-decode-float exact? inexact? number? integer? real? complex? rational? nan?; number->string expt
	      ))
      (func-names (list
		   'make-polar 'complex 'magnitude 'angle 'real-part 'imag-part 'numerator 'denominator 'rationalize 'abs
		   'exp 'log 'sin 'cos 'tan 'asin 'acos 'atan 'sinh 'cosh 'tanh 'asinh 'acosh 'atanh 'sqrt 'floor 'ceiling 'truncate
		   'round 'lcm 'gcd '+ '- '* '/ 'max 'min 'quotient 'remainder 'modulo '= '< '> '<= '>= 'even? 'odd? 'zero? 'positive? 'negative?
		   'infinite? 'inexact->exact 'exact->inexact 'integer-length 'logior 'logxor 'logand 'lognot 'logbit?
		   'ash 'integer-decode-float 'exact? 'inexact? 'number? 'integer? 'real? 'complex? 'rational? 'nan?; 'number->string 'expt
		   ))
      (args (list 0 1 -1)))
  (define (for-each-subset-permuted func name args)
    (let* ((ar (arity func))
	   (min-args (car ar))
	   (max-args (min 1000 (cdr ar))))
      (if (= min-args 0) (set! min-args 1))
      (for-each-subset
       (lambda s-args
	 (if (<= min-args (length s-args) max-args)
	     (for-each-permutation
	      (lambda p-args
		(catch #t 
		  (lambda () 
		    (let ((val (apply func p-args)))
		      (format #t "(let ((new-val (catch-it (~A ~{~A~^ ~})))) " name p-args)
		      (if (not (number? val))
			  (format #t "(if (not (equal? new-val ~A)) (format #t \"(~A ~{~A~^ ~}) -> ~~A~~%\" new-val)))~%" val name p-args)
			  (if (nan? val)
			      (format #t "(if (not (nan? new-val)) (format #t \"(~A ~{~A~^ ~}) -> ~~A, not NaN?~~%\" new-val)))~%" name p-args)
			      (if (infinite? val)
				  (format #t "(if (not (infinite? new-val)) (format #t \"(~A ~{~A~^ ~}) -> ~~A, not inf?~~%\" new-val)))~%" name p-args)
				  (format #t "(if (> (magnitude (- new-val ~A)) 1e-6) (format #t \"(~A ~{~A~^ ~}) -> ~~A, not ~A~~%\" new-val)))~%" val name p-args val))))))
		  (lambda e-args (format *stderr* "~A~%" e-args) ''error)))
	      s-args)))
       args)))
  
  (with-output-to-file "t248.data"
    (lambda ()
      (format #t "(define-macro (catch-it tst)~%  `(catch #t (lambda () ,tst) (lambda args 'error)))~%")
      (for-each
       (lambda (func name)
	 (for-each-subset-permuted func name args))
       funcs func-names))))
|#

;(gc)

;;; --------------------------------------------------------------------------------
;;;
;;; fft from s7.html

(define* (cfft! data n (dir 1)) ; (complex data)
  (if (not n) (set! n (length data)))
  (do ((i 0 (+ i 1))
       (j 0))
      ((= i n))
    (if (> j i)
	(let ((temp (data j)))
	  (set! (data j) (data i))
	  (set! (data i) temp)))
    (let ((m (/ n 2)))
      (do () 
	  ((or (< m 2) (< j m)))
	(set! j (- j m))
	(set! m (/ m 2)))
      (set! j (+ j m))))
  (let ((ipow (floor (log n 2)))
	(prev 1))
    (do ((lg 0 (+ lg 1))
	 (mmax 2 (* mmax 2))
	 (pow (/ n 2) (/ pow 2))
	 (theta (complex 0.0 (* pi dir)) (* theta 0.5)))
	((= lg ipow))
      (let ((wpc (exp theta))
	    (wc 1.0))
	(do ((ii 0 (+ ii 1)))
	    ((= ii prev))
	  (do ((jj 0 (+ jj 1))
	       (i ii (+ i mmax))
	       (j (+ ii prev) (+ j mmax)))
	      ((>= jj pow))
	    (let ((tc (* wc (data j))))
	      (set! (data j) (- (data i) tc))
	      (set! (data i) (+ (data i) tc))))
	  (set! wc (* wc wpc)))
	(set! prev mmax))))
  data)

(test (morally-equal? (cfft! (list 0.0 1+i 0.0 0.0)) '(1+1i -1+1i -1-1i 1-1i)) #t)
(test (morally-equal? (cfft! (vector 0.0 1+i 0.0 0.0)) #(1+1i -1+1i -1-1i 1-1i)) #t)

(let ((size 32))
  (let ((v (make-vector size)))
    (do ((i 0 (+ i 1)))
	((= i size))
      (set! (v i) (random 1.0)))
    (let ((copy-v (copy v)))
      (cfft! v size)
      (cfft! v size -1)
      (do ((i 0 (+ i 1)))
	  ((= i size))
	(set! (v i) (/ (v i) size))
	(if (or (> (abs (imag-part (v i))) 1e-14)
		(> (magnitude (- (v i) (copy-v i))) 1e-14))
	    (format *stderr* ";cfft! reals: ~D: ~A ~A~%" i (v i) (copy-v i)))))))

(let ((size 32))
  (let ((v (make-vector size)))
    (do ((i 0 (+ i 1)))
	((= i size))
      (set! (v i) (random 100)))
    (let ((copy-v (copy v)))
      (cfft! v size)
      (cfft! v size -1)
      (do ((i 0 (+ i 1)))
	  ((= i size))
	(set! (v i) (/ (v i) size))
	(if (or (> (abs (imag-part (v i))) 1e-12)
		(> (magnitude (- (v i) (copy-v i))) 1e-12))
	    (format *stderr* ";cfft! ints: ~D: ~A ~A~%" i (v i) (copy-v i)))))))

(let ((size 32))
  (let ((v (make-vector size)))
    (do ((i 0 (+ i 1)))
	((= i size))
      (set! (v i) (random 1+i)))
    (let ((copy-v (copy v)))
      (cfft! v size)
      (cfft! v size -1)
      (do ((i 0 (+ i 1)))
	  ((= i size))
	(set! (v i) (/ (v i) size))
	(if (> (magnitude (- (v i) (copy-v i))) 1e-12)
	    (format *stderr* ";cfft! complex: ~D: ~A ~A~%" i (v i) (copy-v i)))))))

(when with-bignums
  (let ((size 32))
    (let ((data (make-vector size)))
      (do ((i 0 (+ i 1)))
	  ((= i size))
	(set! (data i) (complex (bignum (number->string (random 1.0))) 
				(bignum (number->string (random 1.0))))))
      (let ((old-data (copy data)))
	(cfft! data size)
	(cfft! data size -1)
	(do ((i 0 (+ i 1)))
	    ((= i size))
	  (set! (data i) (/ (data i) size))
	  (if (> (magnitude (- (data i) (old-data i))) 1e-14)
	      (format *stderr* ";cfft! big: ~D: ~A~%" i (magnitude (- (old-data i) (data i))))))))))
#|
;;; 1048576 forces us to 4608000, 32568 512000
(let ((size 65536))
  (let ((v (make-vector size)))
    (do ((i 0 (+ i 1)))
	((= i size))
      (set! (v i) (random 1+i)))
    (let ((copy-v (copy v)))
      (cfft! v size)
      (cfft! v size -1)
      (do ((i 0 (+ i 1)))
	  ((= i size))
	(set! (v i) (/ (v i) size))
	(if (> (magnitude (- (v i) (copy-v i))) 1e-10)
	    (format *stderr* "~D: ~A (~A ~A)~%" (magnitude (- (v i) (copy-v i))) i (v i) (copy-v i)))))))
|#


(load "stuff.scm")

(let ()
  ;(load "stuff.scm" (curlet))

  (typed-let ((i 0 integer?)
	      (x () list?))
    (test (set! i 3) 3)
    (test  (set! i pi) 'error)
    (test (set! x (list 3)) '(3))
    (test (set! x pi) 'error))

  (let ((i 0))
    (typed-let ((i () list?))
      (set! i ()))
    (set! i 2))
  (typed-let ((i 0)
	      (x pi real?))
    (test (set! i ()) ())
    (test (set! x ()) 'error))

  (test (first '(1 2 3 4 5 6 7 8 9 10)) 1)
  (test (second '(1 2 3 4 5 6 7 8 9 10)) 2)
  (test (third '(1 2 3 4 5 6 7 8 9 10)) 3)
  (test (fourth '(1 2 3 4 5 6 7 8 9 10)) 4)
  (test (fifth '(1 2 3 4 5 6 7 8 9 10)) 5)
  (test (sixth '(1 2 3 4 5 6 7 8 9 10)) 6)
  (test (seventh '(1 2 3 4 5 6 7 8 9 10)) 7)
  (test (eighth '(1 2 3 4 5 6 7 8 9 10)) 8)
  (test (ninth '(1 2 3 4 5 6 7 8 9 10)) 9)
  (test (tenth '(1 2 3 4 5 6 7 8 9 10)) 10)
  (test (first #(1 2 3 4 5 6 7 8 9 10)) 1)
  (test (second #(1 2 3 4 5 6 7 8 9 10)) 2)
  (test (third #(1 2 3 4 5 6 7 8 9 10)) 3)
  (test (fourth #(1 2 3 4 5 6 7 8 9 10)) 4)
  (test (fifth #(1 2 3 4 5 6 7 8 9 10)) 5)
  (test (sixth #(1 2 3 4 5 6 7 8 9 10)) 6)
  (test (seventh #(1 2 3 4 5 6 7 8 9 10)) 7)
  (test (eighth #(1 2 3 4 5 6 7 8 9 10)) 8)
  (test (ninth #(1 2 3 4 5 6 7 8 9 10)) 9)
  (test (tenth #(1 2 3 4 5 6 7 8 9 10)) 10)
  (test (first "1234567890") #\1)
  (test (second "1234567890") #\2)
  (test (third "1234567890") #\3)
  (test (fourth "1234567890") #\4)
  (test (fifth "1234567890") #\5)
  (test (sixth "1234567890") #\6)
  (test (seventh "1234567890") #\7)
  (test (eighth "1234567890") #\8)
  (test (ninth "1234567890") #\9)
  (test (tenth "1234567890") #\0)

  (for-each (lambda (obj)
	      (test (empty? obj) #t)
	      (test (not (sequence? obj)) #f))
	    (list "" () #() (hash-table) (inlet) (if with-block (block) (float-vector)) (float-vector) #2d()))

  (for-each (lambda (obj)
	      (test (empty? obj) #f)
	      (test (not (sequence? obj)) #t)
	      (test (not (applicable? obj)) #f))
	    (list abs (lambda () 1) quasiquote))

  (for-each (lambda (obj)
	      (test (empty? obj) #f)
	      (test (indexable? obj) #f)
	      (test (applicable? obj) #f)
	      (test (not (sequence? obj)) #t))
	    (list #\null #\a 1 'a-symbol 1/0 (log 0) 3.14 3/4 1.0+1.0i #t :hi (if #f #f)))
  (test (sequence?) 'error)
  (test (sequence? () '(1)) 'error)

  (test (->predicate 1) integer?)
  (test (->predicate (curlet)) let?)
  (test (->predicate #<eof>) eof-object?)
  (test (->predicate (cons 1 2)) pair?)
  (test (->predicate :hi) keyword?)
  (test (->predicate #\a) char?)
  (test (->predicate) 'error)

  (when with-block
    (add-predicate block?)
    (test (->predicate (block 1 2)) block?))

  (test (let ((a 1) (b "hi")) (value->symbol "hi")) 'b)

  (test (typeq? 1 2) #t)
  (test (typeq? #\a #\space #\b) #t)
  (test (typeq?) #t)
  (test (typeq? 1.2) #t)
  (test (typeq? 1 1/2) #f)
  (test (typeq? "hi" "" (string #\null) "abc") #t)
  (test (typeq? 1.0 pi) #t)
  (test (typeq? #<unspecified> (if #f #f)) #t)

  (test (let ((x 1)) (typecase x ((integer?) 32) ((real? string?) 2) (else 0))) 32)
  (test (let ((x 1.0)) (typecase x ((integer?) 32) ((real? string?) 2) (else 0))) 2)
  (test (let ((x ())) (typecase x ((integer?) 32) ((real? string?) 2) (else 0))) 0)
  (test (let ((x "hi")) (typecase x ((integer?) 32) ((real? string?) 2) (else 0))) 2)
  (test (let ((x 0)) (typecase (set! x (+ x 1)) ((even?) -1) ((odd?) 1))) 1)

  ;; 2^n and 2^n-1 are tested above as are log-n-of et al and the ldb/dpb functions
  (test (lognand 1 2) -1)
  (test (lognand -1 1) -2)
  (test (lognand -1 -2) 1)
  (test (lognand 123 321) -66)

  (test (lognor -1 -2) 0)
  (test (lognor 1 2) -4)
  (test (lognor 123 321) -380)
  (test (lognor 0 1) -2)

  (test (logeqv 1) 1)
  (test (logeqv) -1)
  (test (logeqv 1 2) -4)
  (test (logeqv -1 2) 2)
  (test (logeqv -1 123 321) -315)
  (test (logeqv 1 2 3 4) -5)
  (test (logeqv 1 2 3 4 5) 1)

  (test (iota 0) ())
  (test (iota 3) '(0 1 2))
  (test (iota -1) 'error)
  (test (iota 3 -2) '(-2 -1 0))

  (test (union vector '(1 2 3) #() #(4 2 1)) #(1 2 3 4))
  (test (union string '(#\a) #(#\b) "abcde") "abcde")
  (test (union vector) #())
  (test (equal? (union list '(1 2 3) ()) '(1 2 3)) #t)
  (test (let? (union inlet (inlet 'a 2) (inlet 'b 3))) #t)
  (test ((union inlet '(a 1) #(b 2)) 'b) 2)
  (test ((union hash-table (hash-table '(a . 1)) (hash-table '(a . 1) '(b . 2))) 'b) 2)

  (test (intersection vector) #())
  (test (intersection list '(1 2 3) #()) ())
  (test (intersection list '(1 2 3) #(4 5 1 9)) '(1)) ; pair: unbound variable
  (num-test ((intersection float-vector '(1 2 3) #(4 5 1 9 3)) 0) 1.0)
  (test (intersection (lambda x (make-shared-vector (apply vector x) '(2 2))) '(1 2 3 4 5) #(4 5 1 9 3)) #2D((1 3) (4 5)))
  (when with-block
    (test (block? (intersection block '(1.0 2.0) #(1.0))) #t)
    (test (block? (intersection block (block 1.0 2.0) #(2.0))) #t))
  (test (intersection list '(1 2 3) '(3 2 1)) '(1 2 3))
  (test (intersection inlet (inlet 'a 1 'b 2) (inlet 'b 3)) (inlet))
  (test (intersection inlet (inlet 'a 1 'b 2) (inlet 'b 2)) (inlet 'b 2))

  (test (symmetric-difference list '(1 2 3)) '(1 2 3))
  (test (symmetric-difference list ()) ())
  (test (symmetric-difference list '(1 2 3) '(1 2 4)) '(3 4))
  (test (symmetric-difference list '(1 2 3) '(1 2 4) '(3 1 5)) '(1 4 5))

  (test (asymmetric-difference list '(1 2 3) '(1 2 4)) '(4))
  (test (asymmetric-difference list ()) ())
  (test (asymmetric-difference list '(1 2 3)) ())
  
  (test (null? (cl-set-difference list () ())) #t)
  (test (null? (cl-set-difference list () '(1 2 3))) #t)
  (test (null? (cl-set-difference list '(1 2 3 4) '(4 3 2 1))) #t)
  (test (null? (cl-set-difference list '(1 2 3 4) '(2 4 3 1))) #t)
  (test (null? (cl-set-difference list '(1 2 3 4) '(1 3 4 2))) #t)
  (test (null? (cl-set-difference list '(1 2 3 4) '(1 3 2 4))) #t)

  (test (power-set list ()) '(()))
  (test (power-set list '(1)) '(() (1)))
  (test (power-set list '(1 2)) '(() (2) (1) (1 2)))
  (test (power-set list '(1 2 3)) '(() (3) (2) (2 3) (1) (1 3) (1 2) (1 2 3)))
  
  (test (apply union list (power-set list '(1 2 3))) '(3 2 1))

  ;; this used to be built into s7.c
  (test (let ((a 1) (b 2)) (multiple-value-set! (a b) (values 32 64)) (+ a b)) 96)
  (test (let ((a 1) (b 2)) (multiple-value-set! (a b) (values 32 64) (set! a (+ b 1))) (+ a b)) 129)
  (test (let ((a 1) (b 2)) (multiple-value-set! (a b) (values 32 64 12) (+ a b))) 'error) ; was  96)
  (test (let ((a 1) (b 2)) (multiple-value-set! (a b) (values 32)) (cons a b)) 'error)    ; was  '(32 . #f))

  (test (multiple-value-set! #() "1234" #(0 1 2 3 4)) 'error)
  (test (multiple-value-set! "" #(0 1 2 3 4) :readable) 'error)
  (test (multiple-value-set! () #(0 1 2 3 4) :readable) 'error)
  (test (multiple-value-set! () ()) ())
  (test (multiple-value-set! () () 1 2) 2)

  (test (hash-table->alist (hash-table)) ())
  (test (hash-table->alist (hash-table '(a . 1))) '((a . 1)))
  (test (let ((lst (hash-table->alist (hash-table '(a . 1) '(b . 2)))))
	  (or (equal? lst '((a . 1) (b . 2)))
	      (equal? lst '((b . 2) (a . 1)))))
	#t)
  
  (test (merge-hash-tables (hash-table) (hash-table '(a . 1))) (hash-table '(a . 1)))
  (test (merge-hash-tables (hash-table '(a . 1) '(b . 2)) (hash-table '(a . 1))) (hash-table '(a . 1) '(b . 2)))
  (test (union hash-table (hash-table '(a . 1) '(b . 2)) (hash-table '(a . 1))) (hash-table '(a . 1) '(b . 2)))
  (test (with-let (union inlet (inlet 'a 1) (inlet 'b 2)) (+ a b)) 3)
  (let ()
    (define e (let ((e's (list (inlet 'a 1 'b 2) (inlet 'a 3 'b 4))))
		(lambda (sym) 
		  (apply values (map (lambda (e1) 
				       (if (defined? sym e1) 
					   (e1 sym) 
					   (values))) 
				     e's)))))
    (test (+ (e 'a) (e 'b)) 10))

  (test (find-if (lambda (x) (= x 3)) '(1 2 3 4)) 3)
  (test (find-if (lambda (x) (= x 3)) '(1 2 5 4)) #f)
  (test (find-if (lambda (x) (= x 3)) ()) #f)
  
  (test (index-if (lambda (x) (= x 3)) '(1 2 3 4)) 2)
  (test (index-if (lambda (x) (= x 1)) '(1 2 3 4)) 0)
  (test (index-if (lambda (x) (= x 3)) '(1 2 5 4)) #f)
  (test (index-if (lambda (x) (= x 3)) ()) #f)
  (test (index-if (lambda (x) (equal? (cdr x) 2)) (hash-table '(a . 1) '(b . 2))) 'b)
  
  (test (count-if (lambda (x) (= x 3)) ()) 0)
  (test (count-if (lambda (x) (= x 3)) '(1 2)) 0)
  (test (count-if (lambda (x) (= x 3)) '(3 3)) 2)

  (test (every? (lambda (x) (= x 3)) ()) #t)
  (test (every? (lambda (x) (= x 3)) '(1 2)) #f)
  (test (every? (lambda (x) (= x 3)) '(1 3)) #f)
  (test (every? (lambda (x) (= x 3)) '(3 3 3)) #t)

  (test (any? (lambda (x) (= x 3)) ()) #f)
  (test (any? (lambda (x) (= x 3)) '(1 2)) #f)
  (test (not (any? (lambda (x) (= x 3)) '(1 3))) #f)
  (test (not (any? (lambda (x) (= x 3)) '(3 3 3))) #f)

  (test (collect-if list (lambda (x) (> x 3)) ()) ())
  (test (collect-if list (lambda (x) (> x 3)) '(1)) ())
  (test (collect-if list (lambda (x) (> x 3)) '(1 3 4)) '(4))
  (test (collect-if list (lambda (x) (> x 3)) '(1 3 4 2 1 5 1)) '(4 5))

  (test (collect-if inlet (let ((syms ())) 
				  (lambda (x) 
				    (and (not (memq (car x) syms)) 
					 (set! syms (cons (car x) syms))))) 
		    (inlet 'a 1 'b 2 'a 3))
	(inlet 'b 2 'a 3)) 
  ;; i.e. clean out shadowed vars, ((inlet 'a 1 'b 2 'a 3) 'a) -> 3

  (test (remove-if list (lambda (x) (> x 3)) ()) ())
  (test (remove-if list (lambda (x) (> x 3)) '(1)) '(1))
  (test (remove-if list (lambda (x) (> x 3)) '(1 3 4)) '(1 3))
  (test (remove-if list (lambda (x) (> x 3)) '(1 3 4 2 1 5 1)) '(1 3 2 1 1))
  (test (let ((e (inlet 'a 1 'b 2 'c 3)))
	  (remove-if inlet (lambda (x) (= (cdr x) 2)) e))
	(inlet 'a 1 'c 3))
  (test (let ((ht (hash-table '(a . 1) '(b . 2) '(c . 3))))
	  (remove-if hash-table (lambda (x) (= (cdr x) 2)) ht))
	(hash-table '(a . 1) '(c . 3)))
  (test (remove-if vector (lambda (x) (integer? x)) #(() #\a 3/2 2 21 "hi")) #(() #\a 3/2 "hi"))

  (test (nonce list ()) ())
  (test (nonce list '(1 2)) '(1 2))
  (test (nonce list '(1 1)) ())
  (test (nonce list '(1 2 3 1 3 1 1)) '(2))

  (test (member? 1 ()) #f)
  (test (member? 1 '(2 3)) #f)
  (test (member? 1 '(2 1 3)) 1)

  (test (concatenate list ()) ())
  (test (concatenate list () #() "") ())
  (test (concatenate vector '(1) #() "2") #(1 #\2))
  (test (concatenate string '(#\1 #\2) "34" #(#\5)) "12345")
  (test (concatenate inlet (inlet 'a 1) (inlet 'b 2 'a 3)) (inlet 'a 1 'b 2 'a 3))

  (test (full-find-if (lambda (x) (and (integer? x) (= x 1))) '(2 (3 (4 5) 6 1))) 1)
  (test (full-find-if (lambda (x) (and (integer? x) (= x 1))) '(2 (3 (4 5) 6))) #f)

  (test (full-count-if (lambda (x) (and (integer? x) (= x 1))) '(1 2 (3 4 1) (5 (6 (1))))) 3)
  (test (let ((l1 '(1 2))) (full-count-if (lambda (x) (and (integer? x) (= x 2))) (list 1 l1 2 l1 3 l1))) 4)

  (test (full-index-if (lambda (x) (and (integer? x) (= x 3))) '(1 2 3)) '(2))
  (test (full-index-if (lambda (x) (= (cdr x) 3)) (hash-table '(a . 1) '(b . 3))) '(b))
  (test (full-index-if (lambda (x) (and (integer? x) (= x 3))) '(1 (2 3))) '(1 1))
  (test (full-index-if (lambda (x) (and (integer? x) (= x 3))) '((1 (2 (3))))) '(0 1 1 0))
  (test (full-index-if (lambda (x) (and (integer? x) (= x 3))) #((1 (2 #(3))))) '(0 1 1 0))
  (test (full-index-if (lambda (x) (and (integer? x) (= x 3))) (hash-table '(a . 1) '(b . #(1 2 3)))) '(b 2))
  (test (full-index-if (lambda (x) (and (integer? x) (= x 4))) (hash-table '(a . 1) '(b . #(1 2 3)))) #f)

  (test (let ((lst (list 1 2))) (set-cdr! lst lst) (let ((i (make-complete-iterator lst))) (map values i))) '(1))
  (test (let ((lst (list 1 2))) (set-cdr! (cdr lst) lst) (let ((i (make-complete-iterator lst))) (map values i))) '(1 2))
  (test (let ((lst (list 1 2 3))) (set-cdr! (cddr lst) lst) (let ((i (make-complete-iterator lst))) (map values i))) '(1 2 3))
  (test (let ((lst (list 1 2 3 4))) (set-cdr! (cdddr lst) lst) (let ((i (make-complete-iterator lst))) (map values i))) '(1 2 3 4))
  (test (let ((v '(1 2 . 3))) (let ((i (make-complete-iterator v))) (map values i))) '(1 2 3))
  (test (let ((v '(1 2 #(4 5) ("67")))) (let ((i (make-complete-iterator v))) (map values i))) '(1 2 #(4 5) 4 5 ("67") "67" #\6 #\7))
  (test (let ((v (list (circular-list 1)))) (let ((iter (make-complete-iterator v))) (map values iter))) (list (circular-list 1) 1))
  (test (let ((v (list (circular-list 1 2)))) (let ((iter (make-complete-iterator v))) (map values iter))) (list (circular-list 1 2) 1 2))

  (test (let ((v (cons 3 (circular-list 1)))) (let ((iter (make-complete-iterator v))) (map values iter))) '(3 1))
  (test (let ((v (cons 3 (circular-list 1 2)))) (let ((iter (make-complete-iterator v))) (map values iter))) '(3 1 2))
  (test (let ((v (list 3 (circular-list 1)))) (let ((iter (make-complete-iterator v))) (map values iter))) (list 3 (circular-list 1) 1))
  (test (let ((v (list 3 (circular-list 1 2)))) (let ((iter (make-complete-iterator v))) (map values iter))) (list 3 (circular-list 1 2) 1 2))

  (test (let ((v (vector (list 4 5) (circular-list 1 2 3) (cons 6 (cons 7 8)))))
	  (let ((iter (make-complete-iterator v)))
	    (map values iter)))
	(list (list 4 5) 4 5 (circular-list 1 2 3) 1 2 3 (cons 6 (cons 7 8)) 6 7 8))

  (test (let ((lst (list 1 2))) (let ((v (list lst lst))) (let ((iter (make-complete-iterator v))) (map values iter))))	'((1 2) 1 2))

  (test (let ((lst (circular-list 1)))
    (let ((v (list lst lst)))
      (let ((iter (make-complete-iterator v)))
	(map values iter))))
	(list (circular-list 1) 1))

  (let ((v (circular-list 1))) (set-car! v v) (test (let ((i5 (make-complete-iterator v))) (map values i5)) ()))
  (let ((v (vector 1))) (set! (v 0) v) (test (let ((i4 (make-complete-iterator v))) (map values i4)) ()))

  (let ((v (vector 1)) (lst (circular-list 2))) 
    (set! (v 0) lst) (set-car! lst v) 
    (test (let ((i1 (make-complete-iterator v))) (map values i1)) (list lst))) ; not v because it's the outermost container?

  (let ((v (vector 1)) (lst (circular-list 2))) 
    (set! (v 0) lst) (set-car! lst v) 
    (test (let ((i2 (make-complete-iterator (list v)))) (map values i2)) (list v lst)))

  (let ((v (vector 1 2))) 
    (set! (v 1) v) (set! (v 0) v)
    (test (let ((i3 (make-complete-iterator (list v)))) (map values i3)) (list v)))

  (test (safe-find-if (lambda (x) (and (integer? x) (= x 1))) '(2 (3 (4 5) 6 1))) 1)
  (test (safe-find-if (lambda (x) (and (integer? x) (= x 1))) '(2 (3 (4 5) 6))) #f)
  (test (safe-find-if (lambda (x) (and (integer? x) (= x 1))) (circular-list 2 3 1 4)) 1)
  (test (safe-find-if (lambda (x) (and (integer? x) (= x 1))) (vector 2 (circular-list 2 3 1 4) 3)) 1)
  (test (safe-find-if (lambda (x) (and (integer? x) (= x 1))) (vector 2 (circular-list 2 3 4) 3)) #f)
  (test (let ((v (vector 1 2))) (set! (v 1) v) (safe-find-if (lambda (x) (and (integer? x) (= x 1))) v)) 1)
  (test (let ((v (vector 1 2)) (lst (list 1 2))) (set! (v 1) lst) (set! (lst 1) v) (safe-find-if (lambda (x) (and (integer? x) (= x 1))) v)) 1)

  (test (safe-count-if (lambda (x) (and (integer? x) (= x 1))) '(2 (3 (4 5) 6 1))) 1)
  (test (safe-count-if (lambda (x) (and (integer? x) (= x 1))) '(2 (3 (4 5) 6))) 0)
  (test (safe-count-if (lambda (x) (and (integer? x) (= x 1))) (circular-list 2 3 1 4)) 1)
  (test (safe-count-if (lambda (x) (and (integer? x) (= x 1))) (vector 2 (circular-list 2 3 1 4) 3)) 1)
  (test (safe-count-if (lambda (x) (and (integer? x) (= x 1))) (vector 2 (circular-list 2 3 4) 3)) 0)
  (test (safe-count-if (lambda (x) (and (integer? x) (= x 1))) (vector 2 #(1) (circular-list 2 1 3 1 4) 3)) 3)
  (test (let ((v (vector 1 2))) (set! (v 1) v) (safe-count-if (lambda (x) (and (integer? x) (= x 1))) v)) 1)
  (test (let ((v (vector 1 2)) (lst (list 1 2))) (set! (v 1) lst) (set! (lst 1) v) (safe-count-if (lambda (x) (and (integer? x) (= x 1))) v)) 2)

  (let ((x 1)
	(y 2))
    (let*-temporarily ((x 32) (y x))
      (test (list x y) '(32 32)))
    (test (list x y) '(1 2)))
  
  (let ((a (vector 1 2 3))
	(x 1)
	(y 32)
	(z 0))
    (let*-temporarily (((a x) y) (z (a x)))
      (test (list (a x) y z) '(32 32 32)))
    (test (list (a x) y z) '(2 32 0)))
  
  (test (make-directory-iterator #\a) 'error)
  (test (catch #t 
	  (lambda ()
	    (let ((f (make-directory-iterator "/home/bil/libxm")))
	      (f)
	      ((iterator-sequence f) #<eof>)
	      #f))
	  (lambda args #f))
	#f)

  (let ((a 3))
    (let/setter ((a 1)
		 (b 2 (lambda (s v)
			(+ v a))))
      (set! a (+ a 1))
      (set! b (+ a b))
      (test (list a b) '(2 7))))

  (let ()
    (let/setter ((a 1 (lambda (s v)
			(- v 1)))
		 (b 2 (lambda (s v)
			(+ v 1))))
      (set! a (+ a 1))
      (set! b (+ a b))
      (test (list a b) '(1 4))))

  (let ()
    (define-macro (inlet/setter . fields)
      ;; (inlet/setter (name value [setter]) ...)
      (let ((setters (map (lambda (binding)
			    (and (pair? (cddr binding))
				 (caddr binding)))
			  fields))
	    (gsetters (gensym))
	    (glet (gensym)))
	`(let ((,gsetters (list ,@setters))
	       (,glet (inlet ,@(map (lambda (binding)
				      `(cons ',(car binding) ,(cadr binding)))
				    fields))))
	   ,@(do ((setter setters (cdr setter))
		  (var fields (cdr var))
		  (i 0 (+ i 1))
		  (result ()))
		 ((null? setter)
		  (reverse result))
	       (if (car setter)
		   (set! result (cons `(set! (symbol-setter (quote ,(caar var)) ,glet) (list-ref ,gsetters ,i)) result))))
	   ,glet)))
    
    (let ((lt (inlet/setter (a 1) (b 2 (lambda (s v) (+ v 1))))))
      (set! (lt 'a) 21)
      (set! (lt 'b) 3)
      (test (list (lt 'a) (lt 'b)) '(21 4))))


  (test (let ((x 32))
	  (define gx (elambda () (*env* 'x)))
	  (let ((x 100))
	    (let ((x 12))
	      (gx))))
	12)
  (test (let ()
	  (define hi (elambda (x) (string->symbol "b")))
	  (eq? (hi 1) 'b))
	#t)
  (test (let ()
	  (define hi (elambda (x) (+ (*env* 'y) x)))
	  (let ((y 3)) (hi 1)))
	4)
  (test (letrec ((efunc (elambda (x) (if (= x 0) 0 (efunc (- x 1)))))) (efunc 3)) 0)
  (test (let ((y 1)) (define hi (elambda (x z) (if (= x z) (display "oops")) (+ z x (*env* 'y)))) (hi 2 3)) 6)
  (test (let ((y 1)) (define hi (elambda (x z) (if (= x z) (display "oops")) (+ z x (*env* 'y)))) (let ((y 12)) (hi 2 3))) 17)

  (test (let ((vals #(0 0 0)))
	  (define rx (rlambda ((a (+ c 1))) (+ a 2)))
	  (set! (vals 0) (rx 5))
	  (let ((c 3))
	    (set! (vals 1) (rx))) ; error if lambda* not rlambda
	  (let ((c 5))
	    (set! (vals 2) (rx)))
	  vals)
	#(7 6 8))
  (test (let ((x 3)) (define rx (rlambda ((a x)) (if (> a 0) (rx (- a 1)) 0))) (rx)) 0)
  (test (let () (define rx (rlambda ((a x)) (if (> a 0) (let ((x (- x 1))) (rx)) 0))) (let ((x 3)) (rx))) 0)


  (test (let ((a 1) (b 2)) (eval-case 1 ((a) 123) ((b) 321) (else 0))) 123)
  (test (let ((a 1) (b 2) (c 3)) (eval-case 3 ((a c) 123) ((b) 321) (else 0))) 123)
  (test (let ((a 1) (b 2)) (eval-case 3 ((a) 123) ((b) 321) (((+ a b)) -1) (else 0))) -1)
  (test (let ((a 1) (b 2)) (eval-case 6 ((a (* (+ a 2) b)) 123) ((b) 321) (((+ a b)) -1) (else 0))) 123)
  (test (let ((a 1) (b 2) (c 5)) (eval-case (set! c (+ c 1)) ((a (* (+ a 2) b)) 123) ((b) 321) (((+ a b)) -1) (else 0))) 123)
  (test (let ((a 1) (b 2) (c 5)) (eval-case (set! c (+ c 1)) ((b) 321) ((+ a b) -1) ((a (* (+ a 2) b)) 123) (((+ a b)) -1) (else 0))) 123)

  (test (linearize (circular-list 1 2 3)) '(1 2 3))
  (test (linearize ()) ())
  (test (linearize (let ((lst (list 1 2 3 4))) (set-cdr! (list-tail lst 3) (cdr lst)) lst)) '(1 2 3 4))

  (test (flatten-let (with-let (inlet) (let ((x 1)) (curlet)))) (inlet 'x 1))
  (test (flatten-let (with-let (inlet) (let ((x 1)) (let ((y 2)) (curlet))))) (inlet 'x 1 'y 2))

  (test (clamp 1 0 3) 1)
  (test (clamp 1 2 3) 2)
  (test (clamp 1 4 3) 3)

  (test (n-choose-k 4 4) 1)
  (test (n-choose-k 4 3) 4)
  (test (n-choose-k 4 2) 6)
  (test (n-choose-k 4 1) 4)
  (test (n-choose-k 4 0) 1)

  (test (let ((a 1) (b 2) (c 3)) (reactive-set! a (+ b c)) (set! b 4) (set! c 5) a) 9)
  (test (let ((a 1) (b 2) (c 3)) (reactive-set! b (+ c 4)) (reactive-set! a (+ b c)) (set! c 5) a) 14)
  (test (let ((expr 21) (symbol 1)) (reactive-set! expr (* symbol 2)) (set! symbol 3) expr) 6)
  (test (let ((a 21) (b 1)) (reactive-set! a (* b 2)) (set! b 3) a) 6)
  (test (let ((s 21) (v 1)) (reactive-set! s (* v 2)) (set! v 3) s) 6)
  (test (let ((a 21) (v 1)) (reactive-set! a (* v 2)) (set! v 3) a) 6)
  (test (let ((symbol 21) (nv 1)) (reactive-set! symbol (* nv 2)) (set! nv 3) symbol) 6)
  (test (let ((nv 21) (sym 1)) (reactive-set! nv (* sym 2)) (set! sym 3) nv) 6)
  (test (let ((a 1) (b 2)) (reactive-set! b (+ a 4)) (let ((a 10)) (set! a (+ b 5)) (list a b))) '(10 5))
  (test (let ((a 1) (b 2)) (reactive-set! b (+ a 4)) (list (let ((b 10)) (set! a (+ b 5)) a) b)) '(15 19))
  (test (let ((a 21) (b 1)) (set! (symbol-setter 'b) (lambda (x y) (* 2 y))) (reactive-set! a (* b 2)) (set! b 3) a) 12)
  (test (let ((a 21) (b 1)) (set! (symbol-setter 'b) (lambda (x y) (* 2 y))) (let ((b 2)) (reactive-set! a (* b 2)) (set! b 3) a)) 6)
  (test (let ((a 1) (b 2) (c 3)) (reactive-set! b (+ c 4)) (let ((a 0)) (reactive-set! a (+ b c)) (set! c 5) a)) 14)
  (test (let ((a 1) (b 2) (c 3)) (reactive-set! a (reactive-set! b (+ c 4))) (list a b c)) '(7 7 3))
  (test (let ((a 1) (b 2) (c 3)) (reactive-set! a (+ 1 (reactive-set! b (+ c 4)))) (list a b c)) '(8 7 3))
  (test (let ((a 1) (v (vector 1 2 3))) (reactive-set! (v 1) (* a 3)) (set! a 4) v) #(1 12 3))

  (test (let ((a 1)) (let ((v (reactive-vector a (+ a 1) 2))) (set! a 4) v)) #(4 5 2))
  (test (let* ((a 1) (v (reactive-vector a (+ a 1) 2))) (set! a 4) v) #(4 5 2))
  (test (let* ((a 1) (v (reactive-vector a (+ a 1) (* 2 (_ 0))))) (set! a 4) (v 'value)) #(4 5 8))
  (test (let ((v (let ((a 1)) (reactive-vector a (+ a 1) (* 2 (_ 0)))))) (set! (v 0) 3) (v 'value)) #(3 2 6))

  ;; unfortunately, reactive-set! does not clear out dead symbol-setters:
  ;; (let ((a 1) (b 2)) (let ((c 3)) (reactive-set! b (* a c))) (let ((c 4)) (reactive-set! b (+ a 1)) (set! a 5)) (list a b))
  ;; complains about unbound curlet gensym because the let it is defined in has been exited but the function still sits on the accessor

  (test (reactive-let () 3) 3)
  (test (let ((a 1)) (reactive-let ((b (+ a 1))) b)) 2)
  (test (let ((a 1)) (+ (reactive-let ((b (+ a 1))) (set! a 3) b) a)) 7)
  (test (let ((a 1)) (+ (reactive-let ((b (+ a 1)) (a 0)) (set! a 3) b) a)) 3)
  (test (let ((a 1)) (reactive-let ((a 2) (b (* a 3))) (set! a 3) b)) 3)
  (test (let ((a 1) (b 2)) (reactive-let ((a (* b 2)) (b (* a 3))) (set! a 3) b)) 3)
  (test (let ((a 1) (b 2)) (reactive-let ((a (* b 2)) (b (* a 3))) (set! b 3) a)) 4)
  (test (let ((a 1) (b 2)) (reactive-let ((a (* b 2))) (set! b 3) a)) 6)
  (test (let ((a 1)) (reactive-let ((b (+ a 1))) (set! a 3) b)) 4)
  (test (let ((a 1)) (reactive-let ((b (+ a 1)) (c (* a 2))) (set! a 3) (+ c b))) 10)
  (test (let ((a 1) (d 2)) (reactive-let ((b (+ a d)) (c (* a d)) (d 0)) (set! a 3) (+ b c))) 11)
  (test (let ((a 1) (d 2)) (reactive-let ((b (+ a d)) (c (* a d)) (d 0)) (set! a 3)) (symbol-setter 'a)) #f)
  (test (let ((a 1) (d 2)) (reactive-let ((b (+ a d)) (c (* a d)) (d 0)) (set! a 3) (set! d 12) (+ b c))) 11)
  (test (let ((a 1) (b 2)) (+ (reactive-let ((b (+ a 1)) (c (* b 2))) (set! a 3) (+ b c)) a b)) 13)  ;c=4 because it watches the outer b
  (test (let ((a 1)) (reactive-let ((b (* a 2))) (reactive-let ((c (* a 3))) (set! a 2) (+ b c)))) 10)
  (test (let ((a 1)) (reactive-let ((b (* a 2))) (let ((d (reactive-let ((c (* a 3))) c))) (set! a 2) (+ b d)))) 7)
  (test (let ((a 1)) (reactive-let ((b (* a 2))) (+ (reactive-let ((c (* a 3))) c) (set! a 2) b))) 9) ; a=2 is added to b=4 and c=3
  (test (let ((a 1)) (reactive-let ((b (+ a 1))) (reactive-let ((c (* b 2))) (begin (set! a 3) (+ c b))))) 12)
  (test (reactive-let ((a (lambda (b) b))) (a 1)) 1)
  (test (reactive-let ((a (let ((b 1) (c 2)) (+ b c)))) a) 3)
  (test (let ((b 1)) (reactive-let ((a (let ((b 1) (c 2)) (+ b c))) (c (* b 2))) (set! b 43) c)) 86)
  (num-test (let ((x 0.0)) (reactive-let ((y (sin x))) (set! x 1.0) y)) (sin 1.0))
  (num-test (let ((x 0.0)) (reactive-let* ((y x) (z (* y (cos x)))) (set! x 1.0) z)) (cos 1.0))
  (test (let ((a 1)) (reactive-let* ((b a) (x (+ a b))) (set! a 3) (list b x))) '(3 6))
  (test (let ((a 1)) (reactive-let ((b a) (c a)) (set! a 3) (list b c))) '(3 3))
  (test (let ((a 1)) (reactive-let* ((b a) (c (* b a))) (set! a 3) (list b c))) '(3 9))
  (test (let ((a 1)) (reactive-let ((b a)) (reactive-let ((c (* b a))) (set! a 3) (list b c)))) '(3 9))
  (test (let ((a 1) (b 2)) (reactive-let ((c a) (d (* b a))) (set! a 3) (list a b c d))) '(3 2 3 6))
  (test (let ((a 1)) (reactive-let ((b (* a 2)) (c (* a 3)) (d (* a 4))) (set! a 2) (list a b c d))) '(2 4 6 8))
  (test (let ((b 2)) (reactive-let ((a (* b 2))) (+ (reactive-let ((a (* b 3))) (set! b 3) a) a))) 15)

  ;; (let ((a 1)) (define (set-a x) (set! a x)) (reactive-let ((b (* a 2))) (set-a 3) b)) -> b is still 2
  ;; we can't see the outer set! without changing the outer accessor
  ;; even: (rlet ((a 1)) (define (set-a x) (set! a x)) (rlet ((b (* a 2))) (set-a 3) b)) -> 2
  ;; (let ((a 1)) (define (set-a x e) (set! (e 'a) x)) (rlet ((b (* a 2))) (set-a 3 (curlet)) b)) -> 6
  ;; (let ((a 1)) (define-macro (set-a x) `(set! a ,x)) (rlet ((b (* a 2))) (set-a 3) b)) -> 6

  ;; reactive-set! places an accessor but never removes it -- dangling refs eventually

  (let ((max-stack 0))
    (define (tc-1 a c) 
      (reactive-let ((b (+ a 1)))
        (if (> (-s7-stack-top-) max-stack)
	    (set! max-stack (-s7-stack-top-)))
	(if (< b c) 
	    (tc-1 b c))))
    (tc-1 0 32)
    (if (> max-stack 12) (format *stderr* ";reactive-let tc max: ~D~%" max-stack)))

  (test (let ((a 1)) (reactive-let* ((b (+ a 1)) (c (* b 2))) (set! a 3) (+ c b))) 12)
  (test (let ((a 1)) (reactive-let* ((b (+ a 1))) (set! a 3) b)) 4)
  (test (reactive-let* ((a 1) (b (* a 2))) (set! a 3) b) 6)

  (let ((max-stack 0))
    (define (tc-2 a c) 
      (reactive-let* ((b (+ a 1)))
        (if (> (-s7-stack-top-) max-stack)
	    (set! max-stack (-s7-stack-top-)))
	(if (< b c) 
	    (tc-2 b c))))
    (tc-2 0 32)
    (if (> max-stack 12) (format *stderr* ";reactive-let* tc max: ~D~%" max-stack)))


  (let ((e (let ((a 1) (b 2)) (reactive-lambda* (s v) ((curlet) s)) (curlet)))) ; constant let
    (test (set! (e 'a) 32) 1)
    (set! (e 'b) 12)
    (test (e 'b) 2)
    (test (with-let e (set! a 32) a) 1))

  (let ()
    (define (make-library)
      (let ((A 1.0)             ; define a library with 2 globals (A and B) and a function (f1)
	    (B 2.0))
	(reactive-lambda* (s v) ; make sure B is always twice A
	  (case s
	    ((A) (set! B (* 2 v)))
	    ((B) (set! A (/ v 2))))
	  v)
	(define (f1 x) 
	  (+ A (* B x)))
	(curlet)))
    (with-let (make-library)
      (num-test (f1 3.0) 7.0)
      (set! A 3.0)
      (num-test B 6.0)
      (num-test (f1 3.0) 21.0)
      (set! B 4.0)
      (num-test (f1 3.0) 14.0)))

  (let ((lst ()))
    (call-with-input-vector 
     (vector 1 2 3 4) 
     (lambda (p)
       (do ((i 0 (+ i 1)))
	   ((= i 4))
	 (set! lst (cons (read p) lst)))))
    (test lst '(4 3 2 1)))

  (test (call-with-output-vector 
	 (lambda (p)
	   (do ((i 0 (+ i 1)))
	       ((= i 4))
	     (write (* i 2) p) ; ("do" does not rebind in s7)
	     (display (* i 4) p)
	     (format p "~A" i))))
	#(0 0 "0" 2 4 "1" 4 8 "2" 6 12 "3"))

  (test (subsequence (list 1 2 3 4)) (list 1 2 3 4))
  (test (subsequence (list 1 2 3 4) 1) (list 2 3 4))
  (test (subsequence (list 1 2 3 4) 1 3) (list 2 3))
  (test (subsequence (list 1 2 3 4) 3 3) ())
  (test (subsequence #(1 2 3 4) 2) #(3 4))
  (test (subsequence "1234" 1) "234")
  (when with-block (test (subsequence (block .1 .2 .3 .4) 1 3) (block .2 .3)))
  (let ((e (openlet (inlet 'value #(1 2 3 4) 'subsequence (lambda args (apply subsequence ((car args) 'value) (cdr args)))))))
    (test (subsequence e 1 3) #(2 3))
    (test (subsequence e 1) #(2 3 4))
    (test (apply subsequence e ()) #(1 2 3 4))
    (test (subsequence e) #(1 2 3 4)))

  (let-temporarily (((*s7* 'print-length) 3))
    (test (sequence->string '(0 1 2)) "(0 1 2)")
    (test (sequence->string '()) "()")
    (test (sequence->string '(0 1 2 3)) "(0 1 2 ...)")
    (test (sequence->string #(0 1 2)) "#(0 1 2)")
    (test (sequence->string #()) "#()")
    (test (sequence->string #(0 1 2 3)) "#(0 1 2 ...)")
    (test (sequence->string (hash-table)) "(hash-table)")
    (test (string? (sequence->string (hash-table '(a . 1) '(b . 2) '(c . 3)))) #t)
    (test (string? (sequence->string (hash-table '(a . 1) '(b . 2) '(c . 3) '(d . 4)))) #t)
    (test (sequence->string (inlet)) "(inlet)")
    (test (sequence->string (inlet 'a 1 'b 2 'c 3)) "(inlet '(a . 1) '(b . 2) '(c . 3))")
    (test (sequence->string (inlet 'a 1 'b 2 'c 3 'd 4)) "(inlet '(a . 1) '(b . 2) '(c . 3) ...)")
    (test (sequence->string "") "\"\"")
    (test (sequence->string "abc") "\"abc\"")
    (test (sequence->string "abcd") "\"abc ...\"")
    (test (sequence->string #u8()) "#u8()")
    (test (sequence->string (string->byte-vector "abc")) "#u8(97 98 99)")
    (test (sequence->string (byte-vector 0 1 2 3)) "#u8(0 1 2 ...)")
    (test (sequence->string (float-vector)) "#r()")
    (test (sequence->string (float-vector 0 1 2 3)) "#(0.0 1.0 2.0 ...)")
    (test (sequence->string (float-vector 0 1 2)) "#(0.0 1.0 2.0)")
    (when with-block (test (sequence->string (block)) "(block)"))
    (when with-block (test (sequence->string (block 0 1 2)) "(0.0 1.0 2.0)")) 
    (when with-block (test (sequence->string (block 0 1 2 3)) "(0.0 1.0 2.0 ...)") )
    (set! (*s7* 'print-length) 8)
    (test (string? (sequence->string (hash-table '(a . 1) '(b . 2) '(c . 3) '(d . 4)))) #t)
    (test (sequence->string (inlet 'a 1 'b 2 'c 3 'd 4)) "(inlet '(a . 1) '(b . 2) '(c . 3) '(d . 4))"))

  (test (pair? (member :heap-size (*s7*->list))) #t)

  (test (#_eval '(define x 3) (null-environment)) 3)
  (test (#_eval '(< x 4) (null-environment)) 'error)
  (test (object->string (null-environment)) "(inlet 'x 3)")
  (test (#_eval '(let ((y 2)) ((lambda z z) x y)) (null-environment)) '(3 2))

  ;; sandbox
  (test (sandbox '(+ 1 2)) 3)
  (test (sandbox '(let ((x (floor pi))) (+ x 1))) 4)
  (test (sandbox '(+ 1 x)) "error: x: unbound variable")
;  (test (sandbox '(let ((p (open-output-string))) (display (+ 2 3) p) (get-output-string p))) "5")
  (test (sandbox '(begin (define-macro (_mx_ x) `(+ ,x 1)) (_mx_ 2))) 3)
  (test (sandbox '(let ((_fx_ (lambda (x) (+ x 1)))) (_fx_ 2))) 3)
  
  ;; *1*
  (test (sandbox '(set! (*s7* 'autoloading) #t)) #f)
  (test (sandbox '(,file-exists? "lint.scm")) #f) ; unquote
  (if (provided? 'snd) (test (sandbox '(set! *clm-srate* ())) #f))
  
  ;; *2*
  (test (sandbox `(eval '(+ 1 2))) #f)
  (test (sandbox '(open-input-file "lint.scm")) #f)
  (test (sandbox '(error (exit))) #f)
  (test (sandbox '(error)) "error: ?")
  (test (sandbox '(exit)) #f)
  (test (sandbox '(begin (define-macro (mx x) `(,file-exists? ,x)) (mx "lint.scm"))) #f)
  (test (sandbox '(begin (define-macro (mx x) `(,(symbol "file" "-exists?") ,x)) (mx "lint.scm"))) #f)
  (test (let ((fx exit)) (sandbox '(fx))) "error: fx: unbound variable")
  (test (sandbox '(let ((_fxex_ exit)) (_fxex_))) #f)
  (test (sandbox '((symbol->value 'exit))) #f)
  ;(begin (define _fxit_ exit) (test (sandbox '(_fxit_)) #f)) ; or4 unbound var in this context
  (test (sandbox '(begin (define-macro (_mx_ x) `(,(string->symbol "file-exists?") ,x)) (_mx_ "lint.scm"))) #f)
  (test (sandbox '(begin (set! baddies ()) (let ((abs #_exit)) (abs 1)))) #f)
  (test (sandbox '((*repl* 'tty-reset))) "error: *repl*: unbound variable")
  
  ;; *3*
  (test (let-temporarily ((abs exit)) (sandbox '(abs 1))) #f)
  
  ;; *4*
  (test (sandbox '(let ((abs #_exit)) (abs 1))) #f)
  (test (sandbox '(begin (define-macro (mx x) `(#_file-exists? ,x)) (mx "lint.scm"))) #f)

  
  (test (cdr-assoc 'a '((a . 1) (b . 2))) 1)
  (test (cdr-assoc 'c '((a . 1) (b . 2))) #f)
  (test (cdr-assoc 'c ()) #f)
  (test (adjoin 'a ()) '(a))
  (test (adjoin 'a '(a)) '(a))
  (test (adjoin 'a '(b a c)) '(b a c))
  (test (adjoin 'a '(b c)) '(a b c))

  (define (Display-test)
    
    (define-macro (with-Display . body)
      `(call-with-output-string
	(lambda (p)
	  (let ((oldp (Display-port)))
	    (set! (Display-port) p)
	    ,@body
	    (set! (Display-port) oldp)))))
    
    (define (strip-comments s)
      (let* ((len (length s))
	     (new-s (make-string len #\null)))
	(do ((i 0 (+ i 1))
	     (j 0)
	     (k 1))
	    ((= i len) (substring new-s 0 j))
	  (case (s i)
	    ((#\;) 
	     (set! k 0) 
	     (set! j (- j 1)))
	    ((#\newline) 
	     (set! k 1) 
	     (set! (new-s j) #\newline))
	    (else (set! (new-s j) (s i))))
	  (set! j (+ j k)))))
    
    (define (Display-string=? s1 s2)
      (or (string=? s1 s2)
	  (string=? (strip-comments s1) s2)))
    (Display (define (hi x) (+ x 1)))
    (let ((str (with-Display (hi 1))))
      (if (not (Display-string=? str "(hi :x 1)\n    -> 2\n"))
	  (format *stderr* "Display 0: (hi 1) -> ~S~%" (strip-comments str))))
    
    (define (ho y) (let ((z (+ y 1))) (hi z)))  
    (let ((str (with-Display (ho 1))))
      (if (not (Display-string=? str "(hi :x 2)\n    -> 3\n"))
	  (format *stderr* "Display 1: (ho 1) -> ~S~%" (strip-comments str))))
    
    (Display (define (ho y) (let ((z (+ y 1))) (hi z))))
    (let ((str (with-Display (ho 1))))
      (if (not (Display-string=? str "(ho :y 1)\n  (let ((z . 2))\n  (hi :x 2)\n      -> 3\n    (hi z)) -> 3\n    -> 3\n"))
	  (format *stderr* "Display 1a: (ho 1) -> ~S~%" (strip-comments str))))
    
    (Display (define (hi x) (if (> x 0) (hi (- x 1)) 0)))
    (let ((str (with-Display (hi 1))))
      (if (not (Display-string=? str "(hi :x 1)\n  (hi :x 0)\n      -> 0\n    -> 0\n"))
	  (format *stderr* "Display 2: (hi 1) -> ~S~%" (strip-comments str))))
    
    (Display (define (hi a b) (+ a b)))
    (let ((str (with-Display (hi 1 2))))
      (if (and (not (Display-string=? str "(hi :a 1 :b 2)\n    -> 3\n"))
	       (not (Display-string=? str "(hi :b 2 :a 1)\n    -> 3\n")))
	  (format *stderr* "Display 3: (hi 1 2) -> ~S~%" (strip-comments str))))
    
    (Display (define (hi x) (let ((a 1) (b 2)) (+ x a b))))
    (let ((str (with-Display (hi 1))))
      (if (not (Display-string=? str "(hi :x 1)\n  (let ((a . 1) (b . 2))\n    (+ x a b)) -> 4\n    -> 4\n"))
	  (format *stderr* "Display 4: (hi 1) -> ~S~%" (strip-comments str))))
    
    (Display (define (hi x) (let ((a 1) (b 2) (c 3) (d 4) (e 5) (f 6) (g 7)) (+ x e))))
    (let ((str (with-Display (hi 1))))
      (if (not (Display-string=? str "(hi :x 1)\n  (let ((a . 1) (b . 2) (c . 3) (d . 4) (e . 5) (f . 6) ...)\n    (+ x e)) -> 6\n    -> 6\n"))
	  (format *stderr* "Display 5: (hi 1) -> ~S~%" (strip-comments str))))
    
    (Display (define (hi x) (x 0)))
    (let ((str (with-Display (hi '(0 1 2 3 4 5 6)))))
      (if (not (Display-string=? str "(hi :x (0 1 2 3 4 5 ...))\n    -> 0\n"))
	  (format *stderr* "Display 5: (hi '(0 1 2 3 4 5 6)) -> ~S~%" (strip-comments str))))
    
    (let ((str (with-Display (hi #(0 1 2 3 4 5 6)))))
      (if (not (Display-string=? str "(hi :x #(0 1 2 3 4 5 ...))\n    -> 0\n"))
	  (format *stderr* "Display 5: (hi #(0 1 2 3 4 5 6)) -> ~S~%" (strip-comments str))))
    
    (let ((str (with-Display (hi #u8(0 1 2 3 4 5 6)))))
      (if (not (Display-string=? str "(hi :x #u8(0 1 2 3 4 5 ...))\n    -> 0\n"))
	  (format *stderr* "Display 5: (hi #u8(0 1 2 3 4 5 6)) -> ~S~%" (strip-comments str))))
    
    (let ((str (with-Display (hi "01234567"))))
      (if (not (Display-string=? str "(hi :x \"012345 ...\")\n    -> #\\0\n"))
	  (format *stderr* "Display 5: (hi \"01234567\") -> ~S~%" (strip-comments str))))
    
    (Display (define (hi x) (x 'a)))
    (let ((str (with-Display (hi (hash-table '(a . 1))))))
      (if (not (Display-string=? str "(hi :x (hash-table '(a . 1)))\n    -> 1\n"))
	  (format *stderr* "Display 5: (hi (hash-table '(a . 1))) -> ~S~%" (strip-comments str))))
    
    (let ((str (with-Display (hi (inlet 'a 1)))))
      (if (not (Display-string=? str "(hi :x (inlet '(a . 1)))\n    -> 1\n"))
	  (format *stderr* "Display 5: (hi (inlet 'a 1)) -> ~S~%" (strip-comments str))))

    (Display (define* (hi (x 1)) (* x 2)))
    (let ((str (with-Display (hi))))
      (if (not (Display-string=? str "(hi :x 1)\n    -> 2\n"))
	  (format *stderr* "Display 6: (hi) -> ~S~%" (strip-comments str))))
    
    (let ((y 5))
      (Display (define* (hi (x (* y 2))) (* x 3)))
      (let ((str (with-Display (hi))))
	(if (not (Display-string=? str "(hi :x 10)\n    -> 30\n"))
	    (format *stderr* "Display 7: (hi) -> ~S~%" (strip-comments str))))

      (let ((str (with-Display (hi 3))))
	(if (not (Display-string=? str "(hi :x 3)\n    -> 9\n"))
	    (format *stderr* "Display 8: (hi) -> ~S~%" (strip-comments str)))))

    (Display
     (define (f1 x)
       (or (> x 1)
	   (< x -1)
	   (= x 0))))
    
    (let ((str (with-Display (f1 1))))
      (if (not (Display-string=? str "(f1 :x 1)\n    -> #f\n"))
	  (format *stderr* "Display 9: (f1 1) -> ~S~%" (strip-comments str))))
    (let ((str (with-Display (f1 -2))))
      (if (not (Display-string=? str "(f1 :x -2)\n  (or  ... (< x -1) ... ) -> #t\n    -> #t\n"))
	  (format *stderr* "Display 9: (f1 -2) -> ~S~%" (strip-comments str))))
    (let ((str (with-Display (f1 2))))
      (if (not (Display-string=? str "(f1 :x 2)\n  (or (> x 1) ... ) -> #t\n    -> #t\n"))
	  (format *stderr* "Display 9: (f1 2) -> ~S~%" (strip-comments str))))
    (let ((str (with-Display (f1 0))))
      (if (not (Display-string=? str "(f1 :x 0)\n  (or  ... (= x 0)) -> #t\n    -> #t\n"))
	  (format *stderr* "Display 9: (f1 0) -> ~S~%" (strip-comments str))))
    
    (Display
     (define (f2 x)
       (and (> x 1)
	    (not (= x 3))
	    (integer? x))))
    
    (let ((str (with-Display (f2 0))))
      (if (not (Display-string=? str "(f2 :x 0)\n  (and (> x 1) ... ) -> #f\n    -> #f\n"))
	  (format *stderr* "Display 10: (f2 0) -> ~S~%" (strip-comments str))))
    (let ((str (with-Display (f2 2))))
      (if (not (Display-string=? str "(f2 :x 2)\n    -> #t\n"))
	  (format *stderr* "Display 10: (f2 2) -> ~S~%" (strip-comments str))))
    (let ((str (with-Display (f2 3))))
      (if (not (Display-string=? str "(f2 :x 3)\n  (and  ... (not (= x 3)) ... ) -> #f\n    -> #f\n"))
	  (format *stderr* "Display 10: (f2 3) -> ~S~%" (strip-comments str))))
    (let ((str (with-Display (f2 3.5))))
      (if (not (Display-string=? str "(f2 :x 3.5)\n  (and  ... (integer? x)) -> #f\n    -> #f\n"))
	  (format *stderr* "Display 10: (f2 3.5) -> ~S~%" (strip-comments str))))
    
    (Display
     (define (f3 x)
       (let ((y (* x 2)))
	 (and (> y 1)
	      (not (= y 6))
	      (integer? x)))))
    
    (let ((str (with-Display (f3 3.5))))
      (if (not (Display-string=? str "(f3 :x 3.5)\n  (let ((y . 7.0))\n    (and (> y 1) (not (= y 6)) (integer? x))) -> #f\n    -> #f\n"))
	  (format *stderr* "Display 11: (f3 3.5) -> ~S~%" (strip-comments str))))
    
    (Display 
     (define (f4 x)
       (display x (Display-port))
       (newline (Display-port))
       (* x 2)))
    
    (let ((str (with-Display (f4 1))))
      (if (not (Display-string=? str "(f4 :x 1)\n1\n    -> 2\n"))
	  (format *stderr* "Display 12: (f4 1) -> ~S~%" (strip-comments str))))
    
    (Display
     (define (f5 x)
       (when (> x 1)
	 (display x (Display-port))
	 (newline (Display-port))
	 (* x 2))))
    
    (let ((str (with-Display (f5 3))))
      (if (not (Display-string=? str "(f5 :x 3)\n3\n(when ... (* x 2)) -> 6\n    -> 6\n"))
	  (format *stderr* "Display 13: (f5 3) -> ~S~%" (strip-comments str))))
    (let ((str (with-Display (f5 0))))
      (if (not (Display-string=? str "(f5 :x 0)\n(when (> x 1) -> #f ...)\n    -> #<unspecified>\n"))
	  (format *stderr* "Display 13: (f5 0) -> ~S~%" (strip-comments str))))
    
    (Display
     (define (f5a x)
       (unless (> x 1)
	 (display x (Display-port))
	 (newline (Display-port))
	 (* x 2))))
    
    (let ((str (with-Display (f5a 3))))
      (if (not (Display-string=? str "(f5a :x 3)\n(unless (> x 1) -> #t ...)\n    -> #<unspecified>\n"))
	  (format *stderr* "Display 14: (f5a 3) -> ~S~%" (strip-comments str))))
    (let ((str (with-Display (f5a 0))))
      (if (not (Display-string=? str "(f5a :x 0)\n0\n(unless ... (* x 2)) -> 0\n    -> 0\n"))
	  (format *stderr* "Display 14: (f5a 0) -> ~S~%" (strip-comments str))))
    
    (Display
     (define (f6 x)
       (begin
	 (display x (Display-port))
	 (newline (Display-port))
	 (* x 2))))
    
    (let ((str (with-Display (f6 3))))
      (if (not (Display-string=? str "(f6 :x 3)\n3\n(begin  ... (* x 2)) -> 6\n    -> 6\n"))
	  (format *stderr* "Display 15: (f6 3) -> ~S~%" (strip-comments str))))
    
    (Display
     (define (f7 x)
       (cond ((= x 0) 123)
	     ((> x 1) (display x (Display-port)) (newline (Display-port)) (* x 2))
	     (#t x))))
    
    (let ((str (with-Display (f7 3))))
      (if (not (Display-string=? str "(f7 :x 3)\n3\n  (cond  ... ((> x 1) (display x (Display-port)) (newline (Display-port)) (* x 2)) ... ) -> 6\n    -> 6\n"))
	  (format *stderr* "Display 16: (f7 3) -> ~S~%" (strip-comments str))))
    (let ((str (with-Display (f7 0))))
      (if (not (Display-string=? str "(f7 :x 0)\n  (cond ((= x 0) 123) ... ) -> 123\n    -> 123\n"))
	  (format *stderr* "Display 16: (f7 0) -> ~S~%" (strip-comments str))))
    (let ((str (with-Display (f7 1))))
      (if (not (Display-string=? str "(f7 :x 1)\n  (cond  ... (#t x)) -> 1\n    -> 1\n"))
	  (format *stderr* "Display 16: (f7 1) -> ~S~%" (strip-comments str))))
    
    (Display
     (define (f8 x)
       (case (+ x 1)
	 ((0) 123)
	 ((1 2 3) 0)
	 (else 4))))
    
    (let ((str (with-Display (f8 3))))
      (if (not (Display-string=? str "(f8 :x 3)\n  (case [4]  ... (else 4)) -> 4\n    -> 4\n"))
	  (format *stderr* "Display 17: (f8 3) -> ~S~%" (strip-comments str))))
    (let ((str (with-Display (f8 -1))))
      (if (not (Display-string=? str "(f8 :x -1)\n  (case [0] ((0) 123) ... ) -> 123\n    -> 123\n"))
	  (format *stderr* "Display 17: (f8 -1) -> ~S~%" (strip-comments str))))
    (let ((str (with-Display (f8 1))))
      (if (not (Display-string=? str "(f8 :x 1)\n  (case [2]  ... ((1 2 3) 0) ... ) -> 0\n    -> 0\n"))
	  (format *stderr* "Display 17: (f8 1) -> ~S~%" (strip-comments str))))
    
    (Display
     (define (f9 x)
       (if (< x 0) (* x 2) (* x 3))))
    
    (let ((str (with-Display (f9 3))))
      (if (not (Display-string=? str "(f9 :x 3)\n    -> 9\n"))
	  (format *stderr* "Display 18: (f9 3) -> ~S~%" (strip-comments str))))
    
    (Display
     (define (f10 x)
       (dynamic-wind
	   (lambda ()
	     (set! x (* x 2)))
	   (lambda ()
	     (display x (Display-port))
	     (newline (Display-port))
	     (* x 2))
	   (lambda ()
	     (set! x 0)))))
    
    (let ((str (with-Display (f10 1))))
      (if (not (Display-string=? str "(f10 :x 1)\n2\n(dynamic-wind ... (* x 2)) -> 4\n    -> 4\n"))
	  (format *stderr* "Display 19: (f10 1) -> ~S~%" (strip-comments str))))
    
    (Display
     (define (f11 x)
       (cond (x => abs))))
    
    (let ((str (with-Display (f11 -1))))
      (if (not (Display-string=? str "(f11 :x -1)\n  (cond (x => abs)) -> 1\n    -> 1\n"))
	  (format *stderr* "Display 20: (f11 -1) -> ~S~%" (strip-comments str))))
    
    (Display
     (define (f12 x)
       (cond ((+ x 1) => (lambda (y) (* y 2))))))
    
    (let ((str (with-Display (f12 2))))
      (if (not (Display-string=? str "(f12 :x 2)\n  (cond ((+ x 1) => (lambda (y) (* y 2)))) -> 6\n    -> 6\n"))
	  (format *stderr* "Display 21: (f12 2) -> ~S~%" (strip-comments str))))
    
    (Display
     (define (f13 x)
       (case x
	 ((a) => (lambda (y) y))
	 (else => symbol?))))
    
    (let ((str (with-Display (f13 'a))))
      (if (not (Display-string=? str "(f13 :x a)\n  (case [a] ((a) => (lambda (y) y)) ... ) -> a\n    -> a\n"))
	  (format *stderr* "Display 22: (f13 'a) -> ~S~%" (strip-comments str))))
    (let ((str (with-Display (f13 1))))
      (if (not (Display-string=? str "(f13 :x 1)\n  (case [1]  ... (else => symbol?)) -> #f\n    -> #f\n"))
	  (format *stderr* "Display 22: (f13 1) -> ~S~%" (strip-comments str))))
    
    (Display
     (define (f14 . x)
       (display x (Display-port))
       (newline (Display-port))
       (apply + x)))
    
    (let ((str (with-Display (f14))))
      (if (not (Display-string=? str "(f14 :x ())\n()\n    -> 0\n"))
	  (format *stderr* "Display 23: (f14) -> ~S~%" (strip-comments str))))
    (let ((str (with-Display (f14 1))))
      (if (not (Display-string=? str "(f14 :x (1))\n(1)\n    -> 1\n"))
	  (format *stderr* "Display 23: (f14 1) -> ~S~%" (strip-comments str))))
    (let ((str (with-Display (f14 1 2))))
      (if (not (Display-string=? str "(f14 :x (1 2))\n(1 2)\n    -> 3\n"))
	  (format *stderr* "Display 23: (f14 1 2) -> ~S~%" (strip-comments str))))
    (let ((str (with-Display (let ((a 1) (b 2)) (f14 a b)))))
      (if (not (Display-string=? str "(f14 :x (1 2))\n(1 2)\n    -> 3\n"))
	  (format *stderr* "Display 23: (f14 a b) -> ~S~%" (strip-comments str))))
    
    (Display
     (define (f15)
       (+ 1 2)))
    
    (let ((str (with-Display (f15))))
      (if (not (Display-string=? str "(f15)\n    -> 3\n"))
	  (format *stderr* "Display 23: (f15) -> ~S~%" (strip-comments str))))
    
    (Display
     (define (f16 x)
       (case (+ x 1)
	 ((0) 123)
	 ((1 2 3) 0))))
    
    (let ((str (with-Display (f16 4))))
      (if (not (Display-string=? str "(f16 :x 4)\n  (case [5] falls through\n    -> #<unspecified>\n"))
	  (format *stderr* "Display 24: (f16 4) -> ~S~%" (strip-comments str))))

    (Display
     (define (f17 x . y)
       (display y (Display-port))
       (newline (Display-port))
       (apply + x y)))
    
    (let ((str (with-Display (f17 1))))
      (if (and (not (Display-string=? str "(f17 :x 1 :y ())\n()\n    -> 1\n"))
	       (not (Display-string=? str "(f17 :y () :x 1)\n()\n    -> 1\n")))
	  (format *stderr* "Display 25: (f17 1) -> ~S~%" (strip-comments str))))
    (let ((str (with-Display (f17 1 2))))
      (if (and (not (Display-string=? str "(f17 :x 1 :y (2))\n(2)\n    -> 3\n"))
	       (not (Display-string=? str "(f17 :y (2) :x 1)\n(2)\n    -> 3\n")))
	  (format *stderr* "Display 25: (f17 1 2) -> ~S~%" (strip-comments str))))
    (let ((str (with-Display (let ((a 1) (b 2)) (f17 a b)))))
      (if (and (not (Display-string=? str "(f17 :x 1 :y (2))\n(2)\n    -> 3\n"))
	       (not (Display-string=? str "(f17 :y (2) :x 1)\n(2)\n    -> 3\n")))
	  (format *stderr* "Display 25: (f17 a b) -> ~S~%" (strip-comments str))))

    (Display
     (define* (f18 (x 1) (y 2))
       (display y (Display-port))
       (newline (Display-port))
       (+ x y)))
    
    (let ((str (with-Display (f18))))
      (if (and (not (Display-string=? str "(f18 :x 1 :y 2)\n2\n    -> 3\n"))
	       (not (Display-string=? str "(f18 :y 2 :x 1)\n2\n    -> 3\n")))
	  (format *stderr* "Display 26: (f18) -> ~S~%" (strip-comments str))))
    (let ((str (with-Display (f18 3))))
      (if (and (not (Display-string=? str "(f18 :x 3 :y 2)\n2\n    -> 5\n"))
	       (not (Display-string=? str "(f18 :y 2 :x 3)\n2\n    -> 5\n")))
	  (format *stderr* "Display 26: (f18 3) -> ~S~%" (strip-comments str))))
    (let ((str (with-Display (f18 :y 32))))
      (if (and (not (Display-string=? str "(f18 :x 1 :y 32)\n32\n    -> 33\n"))
	       (not (Display-string=? str "(f18 :y 32 :x 1)\n32\n    -> 33\n")))
	  (format *stderr* "Display 26: (f18 :y 32) -> ~S~%" (strip-comments str))))
    (let ((str (with-Display (f18 :y 32 :x 12))))
      (if (and (not (Display-string=? str "(f18 :x 12 :y 32)\n32\n    -> 44\n"))
	       (not (Display-string=? str "(f18 :y 32 :x 12)\n32\n    -> 44\n")))
	  (format *stderr* "Display 26: (f18 :y 32 :x 12) -> ~S~%" (strip-comments str))))
    
    (Display
     (define* (f19 (x 1) y)
       (display y (Display-port))
       (newline (Display-port))
       (list x y)))
    
    (let ((str (with-Display (f19))))
      (if (and (not (Display-string=? str "(f19 :x 1 :y #f)\n#f\n    -> (1 #f)\n"))
	       (not (Display-string=? str "(f19 :y #f :x 1)\n#f\n    -> (1 #f)\n")))
	  (format *stderr* "Display 27: (f19) -> ~S~%" (strip-comments str))))

    (Display
     (define* (f20 x :rest y)
       (display y (Display-port))
       (newline (Display-port))
       (list x y)))

    (let ((str (with-Display (f20))))
      (if (and (not (Display-string=? str "(f20 :x #f :y ())\n()\n    -> (#f ())\n"))
	       (not (Display-string=? str "(f20 :y () :x #f)\n()\n    -> (#f ())\n")))
	  (format *stderr* "Display 28: (f20) -> ~S~%" (strip-comments str))))

    (let ((str (with-Display (let ((x 1)) (Display (or (< x 1) (= x 1)))))))
      (if (not (Display-string=? str "  (or  ... (= x 1)) -> #t\n"))
	  (format *stderr* "Display 29: (or...) -> ~S~%" (strip-comments str))))
    
    (let ((str (with-Display (let ((x 1)) (Display (when (> x 0) (+ x 1)))))))
      (if (not (Display-string=? str "(when ... (+ x 1)) -> 2\n"))
	  (format *stderr* "Display 30: (when...) -> ~S~%" (strip-comments str))))
    
    (let ((str (with-Display (Display (let ((x 1)) (+ x 1))))))
      (if (not (Display-string=? str "(let ((x . 1))\n  (+ x 1)) -> 2\n"))
	  (format *stderr* "Display 30: (let...) -> ~S~%" (strip-comments str))))
    
    (set! ((funclet Display) '*display-spacing*) 4)
    (Display (define (f21 x) (if (> x 0) (f21 (- x 1)) 0)))
    (let ((str (with-Display (f21 2))))
      (if (not (Display-string=? str "(f21 :x 2)\n    (f21 :x 1)\n        (f21 :x 0)\n            -> 0\n        -> 0\n    -> 0\n"))
	  (format *stderr* "Display 31: (f21 2) -> ~S~%" (strip-comments str))))
    
    (set! ((funclet Display) '*display-spacing*) 1)
    (Display (define (f21 x) (if (> x 0) (f21 (- x 1)) 0)))
    (let ((str (with-Display (f21 2))))
      (if (not (Display-string=? str "(f21 :x 2)\n (f21 :x 1)\n  (f21 :x 0)\n      -> 0\n     -> 0\n    -> 0\n"))
	  (format *stderr* "Display 31a: (f21 2) -> ~S~%" (strip-comments str))))
    
    (set! ((funclet Display) '*display-spacing*) 2)
    )
  (Display-test)
  )

(let ()
  (require write.scm)

  (if (not (string=? (pp '(lambda* (a b) (+ a b) (* 1 2))) "(lambda* (a b)\n  (+ a b)\n  (* 1 2))"))
      (format *stderr* "pp 1~%"))
  (if (not (string=? (pp '(let ((a 1) (b 2)) (+ a b))) "(let ((a 1)\n      (b 2))\n  (+ a b))"))
      (format *stderr* "pp 2~%"))
  (if (not (string=? (pp '(let () (+ a b))) "(let ()\n  (+ a b))"))
      (format *stderr* "pp 2a~%"))
  (if (not (string=? (pp '(begin (+ 1 2) (* 2 3))) "(begin\n  (+ 1 2)\n  (* 2 3))"))
      (format *stderr* "pp 3~%"))
  (if (not (string=? (pp '(case a ((a b c) 1) ((d) 2) (else 3))) "(case a\n  ((a b c) 1)\n  ((d) 2)\n  (else 3))"))
      (format *stderr* "pp 4: ~A~%" (pp '(case a ((a b c) 1) ((d) 2) (else 3)))))
  (if (not (string=? (pp '(cond ((> a 1) 2) ((< a 3) 3) (#t 4))) "(cond ((> a 1) 2)\n      ((< a 3) 3)\n      (#t 4))"))
      (format *stderr* "pp 5~%"))
  (if (not (string=? (pp '(catch 'x (lambda () 32) (lambda args 'error))) "(catch 'x\n  (lambda ()\n    32)\n  (lambda args\n    'error))"))
      (format *stderr* "pp 6~%"))
  (if (not (string=? (pp '(if a '(1 2 3))) "(if a '(1 2 3))"))
      (format *stderr* "pp7~%"))
  (if (not (= ((funclet pretty-print) '*pretty-print-length*) 100))
      (format *stderr* "*pretty-print-length*: ~A~%" ((funclet pretty-print) '*pretty-print-length*)))
  (if (not (= ((funclet pretty-print) '*pretty-print-spacing*) 2))
      (format *stderr* "*pretty-print-spacing*: ~A~%" ((funclet pretty-print) '*pretty-print-spacing*)))
  (if (not (string=? (pp '(+ pi nan.0 1.123456)) "(+ pi nan.0 1.123456)"))
      (format *stderr* "pp8~%"))
  (if (not (string=? (pp 3.1415123123213) "3.1415"))
      (format *stderr* "pp9: ~A~%" (pp 3.1415123123213)))
  (let-temporarily ((((funclet pretty-print) '*pretty-print-float-format*) "~,12F"))
    (if (not (string=? (pp 3.1415123123213) "3.141512312321"))
	(format *stderr* "pp10: ~A~%" (pp 3.1415123123213))))
  (set! ((funclet pretty-print) '*pretty-print-spacing*) 8)
  (if (not (string=? (pp '(let () (+ a b))) "(let ()\n        (+ a b))"))
      (format *stderr* "pp 11~%"))
  (let ((lt (openlet (inlet 'pretty-print (lambda* (obj port (col 0))
					    (display "(special-inlet)" port))))))
    (test (with-output-to-string (lambda () (pretty-print lt))) "(special-inlet)"))
  )


(let ()
  (require r7rs.scm)
  
   ;;; boolean=?
  (test (boolean=? #f #f) #t)
  (test (boolean=? #f #t) #f)
  (test (boolean=? #f #f #f) #t)
  (test (boolean=? #t #t) #t)
  (test (boolean=? #f #f #t #f) #f)
  (test (boolean=? #f (values) #f) #f)
  (test (boolean=? 1 #t) #f)
					;(test (boolean=?) 'error)
					;(test (boolean=? #f) 'error)
  (for-each
   (lambda (arg)
     (if (boolean=? #f arg)
	 (format #t ";(boolean=? #f ~A) -> #t?~%" arg)))
   (list "hi" '(1 2) () "" #() (integer->char 65) 1 'a-symbol (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
	 3.14 3/4 1.0+1.0i #\f (lambda (a) (+ a 1)) :hi (if #f #f) #<eof> #<undefined> #<unspecified>))
  
  (test (boolean=? #f #false) #t)
  (test (boolean=? #t #true) #t)
  
   ;;; symbol=?
  (test (symbol=? 'hi 'hi) #t)
  (test (symbol=? 'hi 'hi 'hi) #t)
  (test (symbol=? 'hi 'hi 'ho) #f)
  (test (symbol=? 'hi 'hi pi) #f)
  (test (symbol=? #f 'hi) #f)
  (for-each
   (lambda (arg)
     (if (symbol=? 'abs arg)
	 (format #t ";(symbol=? 'abs ~A) -> #t?~%" arg)))
   (list "hi" (integer->char 65) 1 (list 1 2) '#t '3 (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0) 
	 3.14 3/4 1.0+1.0i #\f (lambda (a) (+ a 1)) #<eof> #<undefined>))
					;(test (symbol=?) 'error)
					;(test (symbol=? 'hi) 'error)
  (test (symbol=? :hi :hi) #t)
  (test (symbol=? :hi hi:) #f)

  (let ()
    (test (provided? 'locals) #f)
    (provide 'locals)
    (test (provided? 'locals) #t)
    (test (pair? (memq 'locals (features))) #t)
    (test (pair? (memq 'locals *features*)) #t)
    (test (equal? (features) *features*) #t))
  (test (memq 'locals (features)) #f)
  (test (equal? (features) *features*) #t)

  ;; from chibi scheme I think
  (let*-values (((root rem) (exact-integer-sqrt 32)))
    (test (* root rem) 35))
  (test (let ((a 'a) (b 'b) (x 'x) (y 'y))
	  (let*-values (((a b) (values x y))
			((x y) (values a b)))
	    (list a b x y)))
	'(x y x y))

  (test (force (r7rs-delay (+ 1 2))) 3)
  (test (let ((p (r7rs-delay (+ 1 2)))) (list (force p) (force p))) '(3 3))
  (let ()
    (define integers
      (letrec ((next
		(lambda (n)
		  (r7rs-delay (cons n (next (+ n 1)))))))
	(next 0)))
    (define head (lambda (stream) (car (force stream))))
    (define tail (lambda (stream) (cdr (force stream))))
    (test (head (tail (tail integers))) 2)

    (define (stream-filter p? s)
      (delay-force
       (if (null? (force s)) 
	   (r7rs-delay '())
	   (let ((h (car (force s)))
		 (t (cdr (force s))))
	     (if (p? h)
		 (r7rs-delay (cons h (stream-filter p? t)))
		 (stream-filter p? t))))))
    (test (head (tail (tail (stream-filter odd? integers)))) 5))

  (let ()
    (define radix (make-parameter 10 (lambda (x) (if (and (integer? x) (<= 2 x 16)) x (error 'wrong-type-arg "invalid radix")))))
    (define (f n) (number->string n (radix)))
    (test (f 12) "12")
    (test (parameterize ((radix 2)) (f 12)) "1100")
    (test (f 12) "12"))

  (let ()
    (define plus
      (case-lambda 
       (() 0)
       ((x) x)
       ((x y) (+ x y))
       ((x y z) (+ (+ x y) z))
       (args (apply + args))))
    (test (plus) 0)
    (test (plus 1) 1)
    (test (plus 1 2) 3)
    (test (plus 1 2 3) 6)
    (test (plus 1 2 3 4) 10)

    (define mult
      (case-lambda 
       (() 1)
       ((x) x)
       ((x y) (* x y))
       ((x y . z) (apply mult (* x y) z))))
    (test (mult) 1)
    (test (mult 1) 1)
    (test (mult 1 2) 2)
    (test (mult 1 2 3) 6)
    (test (mult 1 2 3 4) 24))

  (test (let () (define-values (x y) (values 1 2)) (+ x y)) 3)
  ;; from Guile:
  (test (let () (define-values () (values)) #f) #f) ; just avoid dumb error
  (test (let () (define-values (x) 1) x) 1)
  (test (let () (define-values (x y) (values 2 3)) (+ x y)) 5)
  (test (let () (define-values (x y z) (values 4 5 6)) (+ x y z)) 15)
  (test (let () (define-values (x . y) (values 'a 'b 'c 'd)) (list x y)) '(a (b c d)))
  (test (let () (define-values (x y . z) (values 'x 'y 'z 'w)) (list x y z)) '(x y (z w)))
  (test (let () (define-values x (values 1 2 3)) x) '(1 2 3))

  (test (call-with-values (lambda () (exact-integer-sqrt 4)) list) '(2 0))
  (test (call-with-values (lambda () (exact-integer-sqrt 5)) list) '(2 1))

  (test (let-values (((x) (values 1))) x) 1)
  (test (let-values ((x (values 1))) x) '(1))
  (test (let-values (((x) (values 1)) ((y) (values 2))) (list x y)) '(1 2))
  (test (let ((x 32)) (let-values (((x) (values 1)) ((y) (values (+ x 1)))) (list x y))) '(1 33))
  (test (let-values (((x y) (values 1 2))) (list x y)) '(1 2))
  (test (let ((d 32)) (let-values (((a) 1) ((c d e) (values 3 4 5)) ((b) d)) (+ a b (* c d e))))
	(let ((d 32))
	  (with-let (apply sublet (curlet) 
			   (list ((lambda (a) (values :a a)) 1) 
				 ((lambda (c d e) (values :c c :d d :e e)) (values 3 4 5))
				 ((lambda (b) (values :b b)) d))) (+ a b (* c d e)))))
  (test (let ((a 32) (b -1)) (let-values (((a b) (values 1 2)) ((x y) (values a b))) (list a b x y)))
	(let ((a 32) (b -1))
	  (with-let (apply sublet (curlet) 
			   (list ((lambda (a b) (values :a a :b b)) (values 1 2)) 
				 ((lambda (x y) (values :x x :y y)) (values a b))))
	    (list a b x y))))
  
  (test (let*-values (((x) (values 1))) x) 1)
  (test (let*-values ((x (values 1))) x) '(1))
  (test (let*-values (((x) (values 1)) ((y) (values 2))) (list x y)) '(1 2))
  (test (let*-values (((x) (values 1)) ((y) (values (+ x 1)))) (list x y)) '(1 2))
  (test (let*-values (((x y) (values 1 2))) (list x y)) '(1 2))
  (test (let*-values (((a) 1) ((c d e) (values 3 4 5)) ((b) d)) (+ a b (* c d e)))
	(let ((a 1)) ((lambda (c d e) (let ((b d)) (+ a b (* c d e)))) (values 3 4 5))))
  (test (let*-values (((a b) (values 1 2)) ((x y) (values a b))) (list a b x y))
	((lambda (a b) ((lambda (x y) (list a b x y)) (values a b))) (values 1 2)))

  (test (vector-copy #()) #())
  (test (vector-copy #(a b c)) #(a b c))
  (test (vector-copy #(a b c) 1) #(b c))
  (test (vector-copy #(a b c) 1 2) #(b))

  (let ((e (box 1)))
    (test (box? e) #t)
    (test (unbox e) 1)
    (test (e 'value) 1)
    (set-box! e 2)
    (test (unbox e) 2)
    (test (string=? (object->string e) "#<box-type: (value 2)>") #t))
  )


;;; --------------------------------------------------------------------------------
;;;
;;; cload c-define tests
;;;   (see libc.scm et al below)

(when (provided? 'snd)
  (load "cload.scm")
  
  (c-define '((double j0 (double)) 
	      (double j1 (double)) 
	      (double erf (double)) 
	      (double erfc (double))
	      (double lgamma (double)))
	    "m" "math.h")
  (num-test (m:j0 1.0) 0.76519768655797)
  (num-test (m:j1 1.0) 0.44005058574493)
  (num-test (m:j0 1/2) 0.93846980724081)
  (num-test (m:erf 1.0) 0.84270079294971)
  (num-test (m:erf 2) 0.99532226501895)
  (num-test (m:erfc 1.0) 0.15729920705029)
  (num-test (m:lgamma 2/3) 0.30315027514752)
  
  (let ()
    (c-define '(char* getenv (char*)))
    (c-define '(int setenv (char* char* int)))
    (test (string? (getenv "HOST")) #t))
  
  (test (defined? 'setenv) #f)
  
  (let ()
    (define local-file-exists? (let () ; define F_OK and access only within this let
				 (c-define '((int F_OK) (int access (char* int))) "" "unistd.h") 
				 (lambda (arg) (= (access arg F_OK) 0))))
    
    (define delete-file (let () 
			  (c-define '(int unlink (char*)) "" "unistd.h") 
			  (lambda (file) (= (unlink file) 0)))) ; 0=success
    
    (test (local-file-exists? "s7test.scm") #t))
  
  (c-define 
   '((in-C "static struct timeval overall_start_time;  \n\
           static bool time_set_up = false;           \n\
           static double get_internal_real_time(void) \n\
           {                                          \n\
            struct timezone z0;                       \n\
            struct timeval t0;                        \n\
            double secs;                              \n\
            if (!time_set_up) {gettimeofday(&overall_start_time, &z0); time_set_up = true;} \n\
            gettimeofday(&t0, &z0);                   \n\
            secs = difftime(t0.tv_sec, overall_start_time.tv_sec);\n\
            return(secs + 0.000001 * (t0.tv_usec - overall_start_time.tv_usec)); \n\
           }")
     (double get_internal_real_time (void)))
   "" '("time.h" "sys/time.h"))
  
  (define-macro (new-time func) 
    `(let ((start (get_internal_real_time)))
       ,func
       (- (get_internal_real_time) start)))
  
  (test (real? (new-time (do ((i 0 (+ i 1))) ((= i 30) i)))) #t)
  
  (when (provided? 'linux)
    (c-define '(int getpid (void)) "" "unistd.h")
    (call-with-input-file (format #f "/proc/~D/status" (getpid))
      (lambda (p)
	(let ((name (substring (read-line p) 6)))
	  (do ((str (read-line p) (read-line p)))
	      ((eof-object? str))
	    (if (string=? (substring str 0 6) "VmRSS:")
		(let ((size (with-input-from-string (substring str 7) read)))
		  (format #t "~%~A size: ~A kB, time: ~A~%" name size (*s7* 'cpu-time))))))))))


;;; --------------------------------------------------------------------------------
(when with-block
(let ()
  (define (catch1)
    (catch #t
      (lambda ()
	(asdf 21))
      (lambda args
	12)))
  
  (with-output-to-file "tmp343.scm"
    (lambda ()
      (display "
        (catch #t
          (lambda ()
            (asdf-tmp343 21))
          (lambda args
            12))
       ")))

  (let ((val1 (catch1))
	(val2 (eval-string "(catch1)"))
	(val3 (eval-string " 
     	          (catch #t
	            (lambda ()
		      (asdf 21))
	            (lambda args
		      12))
                   "))
	(val4 (eval '(catch1)))
	(val5 (eval '(catch #t
		       (lambda ()
			 (asdf 21))
		       (lambda args
			 12))))
	(val6 (load "tmp343.scm"))
	(val7 (sload "tmp343.scm"))
	(val8 (scall catch1 ()))
	(val9 (eval (call-with-input-file "tmp343.scm" read)))
	(val10 (eval (call-with-input-file "tmp343.scm" sread)))
	(val11 (swind (lambda () #f) catch1 (lambda () #f)))
	(val12 (seval '(catch #t
			 (lambda ()
			   (asdf 21))
			 (lambda args
			   12))))
	(val13 (sevalstr "
	          (catch #t
	            (lambda ()
		      (asdf 21))
	            (lambda args
		      12))
                   ")))
    (test (list val1 val2 val3 val4 val5 val6 val7 val8 val9 val10 val11 val12 val13) '(12 12 12 12 12 12 12 12 12 12 12 12 12)))

  (delete-file "tmp343.scm")
  
  (define (catch2)
    (catch #t
      (lambda ()
	(asdf 21))
      (lambda args
	(catch #t
	  (lambda ()
	    (fdsa 12))
	  (lambda args
	    32)))))
  
  (with-output-to-file "tmp343.scm"
    (lambda ()
      (display "
        (catch #t
          (lambda ()
            (asdf 21))
          (lambda args
            (catch #t
      	      (lambda ()
      	        (fdsa 12))
      	      (lambda args
      	        32))))
              ")))
        
  (let ((val1 (catch2))
	(val2 (eval-string "(catch2)"))
	(val3 (eval-string " 
              (catch #t
                (lambda ()
                  (asdf 21))
                (lambda args
                  (catch #t
      	            (lambda ()
	              (fdsa 12))
	            (lambda args
	              32))))
                    "))
	(val4 (eval '(catch2)))
	(val5 (eval '(catch #t
		       (lambda ()
			 (asdf 21))
		       (lambda args
			 (catch #t
			   (lambda ()
			     (fdsa 12))
			   (lambda args
			     32))))))
	(val6 (load "tmp343.scm"))
	(val7 (sload "tmp343.scm"))
	(val8 (scall catch2 ()))
	(val9 (eval (call-with-input-file "tmp343.scm" read)))
	(val10 (eval (call-with-input-file "tmp343.scm" sread)))
	(val11 (swind (lambda () #f) catch2 (lambda () #f)))
	(val12 (seval '(catch #t
			 (lambda ()
			   (asdf 21))
			 (lambda args
			   (catch #t
			     (lambda ()
			       (fdsa 12))
			     (lambda args
			       32))))))
	(val13 (sevalstr "
                (catch #t
                  (lambda ()
                    (asdf 21))
                  (lambda args
                    (catch #t
              	(lambda ()
              	  (fdsa 12))
              	(lambda args
              	  32))))
                ")))

    (test (list val1 val2 val3 val4 val5 val6 val7 val8 val9 val10 val11 val12 val13) '(32 32 32 32 32 32 32 32 32 32 32 32 32)))
  
  (delete-file "tmp343.scm")
  
  (define (catch3)
    (catch #t
      (lambda ()
	(asdf 21))
      (lambda args
	(catch #t
	  (lambda ()
	    (fdsa 12))
	  (lambda args
	    (catch #t
	      (lambda ()
		(sfsa 32))
	      (lambda args
		64)))))))
  
  (with-output-to-file "tmp343.scm"
    (lambda ()
      (display "(catch #t
                  (lambda ()
                    (asdf 21))
                  (lambda args
                    (catch #t
              	(lambda ()
              	  (fdsa 12))
              	(lambda args
              	  (catch #t
              	    (lambda ()
              	      (sfsa 32))
              	    (lambda args
              	      64))))))
                ")))
  
  (let ((val1 (catch3))
	(val2 (eval-string "(catch3)"))
	(val3 (eval-string " 
                (catch #t
                  (lambda ()
                    (asdf 21))
                  (lambda args
                    (catch #t
              	(lambda ()
              	  (fdsa 12))
              	(lambda args
              	  (catch #t
              	    (lambda ()
              	      (sfsa 32))
              	    (lambda args
              	      64))))))
                           "))
	(val4 (eval '(catch3)))
	(val5 (eval '(catch #t
		       (lambda ()
			 (asdf 21))
		       (lambda args
			 (catch #t
			   (lambda ()
			     (fdsa 12))
			   (lambda args
			     (catch #t
			       (lambda ()
				 (sfsa 32))
			       (lambda args
				 64))))))))
	(val6 (load "tmp343.scm"))
	(val7 (sload "tmp343.scm"))
	(val8 (scall catch3 ()))
	(val9 (eval (call-with-input-file "tmp343.scm" read)))
	(val10 (eval (call-with-input-file "tmp343.scm" sread)))
	(val11 (swind (lambda () #f) catch3 (lambda () #f)))
	(val12 (seval '(catch #t
			 (lambda ()
			   (asdf 21))
			 (lambda args
			   (catch #t
			     (lambda ()
			       (fdsa 12))
			     (lambda args
			       (catch #t
				 (lambda ()
				   (sfsa 32))
				 (lambda args
				   64))))))))
	(val13 (sevalstr " 
                (catch #t
                  (lambda ()
                    (asdf 21))
                  (lambda args
                    (catch #t
              	(lambda ()
              	  (fdsa 12))
              	(lambda args
              	  (catch #t
              	    (lambda ()
              	      (sfsa 32))
              	    (lambda args
              	      64))))))
                    ")))
    (test (list val1 val2 val3 val4 val5 val6 val7 val8 val9 val10 val11 val12 val13) '(64 64 64 64 64 64 64 64 64 64 64 64 64)))))


;;; --------------------------------------------------------------------------------

(let ((e (openlet (inlet 'absolute-value (lambda (x) (abs x))))))
  (test (+ 3 ((e 'absolute-value) -3)) 6)
  (test (catch #t (lambda () (+ ((e 'absolute-value) -3) 32)) (lambda args "oops")) 35)
  (test (catch #t (lambda () (+ ((e 'absolute-value) "oops") 32)) (lambda args 35)) 35))

(let ((e (openlet (inlet 'x -3 'abs (lambda (e) (let ((x (e 'x))) (if (negative? x) (- x) x)))))))
  (test (+ 3 (abs e)) 6)
  (test (catch #t (lambda () (+ (abs e) 32)) (lambda args "oops")) 35)
  (set! (e 'x) "oops")
  (test (catch #t (lambda () (+ (abs e) 32)) (lambda args 35)) 35))

(test (+ 32 (call-with-exit
	     (lambda (return)
	       (let ((e (lambda (x) (return (if (negative? x) (- x) x)))))
		 (+ 123 (e -321)))))) 353)
(test (+ 32 (catch #t
	      (lambda ()
		(let ((e (openlet (inlet 'x -3 'abs (lambda (e) (let ((x (e 'x))) (error 'oops (if (negative? x) (- x) x))))))))
		  (+ 123 (abs e) -321)))
	      (lambda args 3))) 35)
(test (+ 32 (catch #t
	      (lambda ()
		(let ((e (openlet (inlet 'x -3 'abs (lambda (e) (let ((x (e 'x))) (throw 'oops (if (negative? x) (- x) x))))))))
		  (+ 123 (abs e) -321)))
	      (lambda args 3))) 35)
(test (+ 32 (call-with-exit
	     (lambda (return)
	       (let ((e (openlet (inlet 'x -3 'abs (lambda (e) (let ((x (e 'x))) (return (if (negative? x) (- x) x))))))))
		 (+ 123 (abs e) -321))))) 35)
(test (+ 32 (call-with-exit
	     (lambda (return)
	       (let ((e (openlet (inlet 'x -3 'abs (lambda (e) (let ((x (e 'x))) (return (if (negative? x) (- x) x))))))))
		 (+ 123 (eval `(abs e)) -321))))) 35)
(test (+ 32 (catch #t
	      (lambda ()
		(call-with-exit
		 (lambda (return)
		   (let ((e (openlet (inlet 'x -3 'abs (lambda (e) (let ((x (e 'x))) (return (if (negative? x) (- x) x))))))))
		     (+ 123 (error 'oops (abs e)) -321)))))
	      (lambda args 3))) 35)
(test (+ 32 (call-with-exit
	     (lambda (return)
	       (let ((e (openlet (inlet 'x -3 'abs (lambda (e) (let ((x (e 'x))) (return (if (negative? x) (- x) x))))))))
		 (let ((e1 (openlet (inlet 'abs (lambda (x) (abs e))))))
		   (+ 123 (abs e1) -321)))))) 35)
(test (+ 32 (call-with-exit
	     (lambda (return)
	       (let ((e (openlet (inlet 'x -3 'abs (lambda (e) (let ((x (e 'x))) (return (if (negative? x) (- x) x))))))))
		 (let ((e1 (openlet (inlet 'abs (lambda (x) (abs e))))))
		   (let ((e2 (openlet (inlet 'abs (lambda (x) (abs e1))))))
		     (+ 123 (abs e2) -321))))))) 35)

(let () ; optimize these things
  (define (tst-it)
    (+ 32 (call-with-exit
	   (lambda (return)
	     (let ((e (openlet (inlet 'x -3 'abs (lambda (e) 
						   (let ((x (e 'x)))
						     (return (if (negative? x) (- x) x))))))))
	       (+ 123 (abs e) -321))))))
  (test (tst-it) 35)) ; (+ 123 3 -321 32) is -163

(let ()
  (define (tst-it1)
    (+ 32 (catch 'ok
	    (lambda ()
	      (let ((e (openlet (inlet 'x -3 'abs (lambda (e) 
						    (let ((x (e 'x)))
						      (throw 'ok (if (negative? x) (- x) x))))))))
		(+ 123 (abs e) -321)))
	    (lambda (type info) 
	      (car info)))))
  (test (tst-it1) 35))

(let ()
  (define (tst-it2)
    (+ 32 (call/cc
	   (lambda (return)
	     (let ((e (openlet (inlet 'x -3 'abs (lambda (e) 
						   (let ((x (e 'x)))
						     (return (if (negative? x) (- x) x))))))))
	       (+ 123 (abs e) -321))))))
  (test (tst-it2) 35))



;;; reader-cond
(define (rt2)
  (reader-cond ((> 3 2) `(+ 1 2))
	       (#t 'error)))
(test (rt2) '(+ 1 2))
(define (rt3)
  (reader-cond ((> 3 2) (+ 1 2))
	       (#t 'error)))
(test (rt3) 3)

(define (rt2)
  (reader-cond ((> 3 2))
	       (#t 'error)))
(test (rt2) #t)

(define (rt2)
  (reader-cond ((> 3 2)
		(values 1 2 3))
	       (#t 'error)))
(test (+ (rt2) 4) 10)

(define (rt2)
  (reader-cond ((assq 'x '((a . 3) (x . 4))) => cdr)
	       (#t 'error)))
(test (+ (rt2) 2) 6)

(let ()
  (define (f1)
    (let ((x 1)
	  (y 1))
      (reader-cond ((not (provided? 'asdf))
		    (set! x (+ x 1))
		    (set! x (+ x 1)))
		   (#t (set! x (- x 1))))
      (reader-cond ((provided? 'asdf)
		    (set! y (+ y 1))
		    (set! y (+ y 1)))
		   (#t (set! y (- y 1))))
      (list x y)))
  (f1)
  (test (f1) (list 3 0)))

(test (list 1 (reader-cond ((> 3 2) 2 3 4)) 5) (list 1 2 3 4 5))

(define-expansion (__exp1__) (values 1 2 3))

#|
(let ()
  (test (abs (+ 2 -3)) (+ 1))

  (define-macro (protected-let vars . body)
    ;; locals outside this let are not changed (and aren't accessible), 
    ;;   and we'll protect the current rootlet values of built-ins
    `(with-let (inlet :in (apply inlet ',(map (lambda (f)
						(values (car f) ((rootlet) (car f))))
					      (unlet))))
       (dynamic-wind
	   (lambda ()
	     #f)
	   (lambda ()
	     (let ,vars ,@body))
	   (lambda ()
	     (for-each 
	      (lambda (f) ; if any built-in's value has changed in the protected-let, reset it
		(let ((value-before-let (in (car f))))
		  (unless (equal? (symbol->value (car f)) value-before-let)
		    (apply set! (list (car f) 
				      (if (eq? value-before-let #<undefined>) ; it was not changed before
					  (cdr f)                             ;   so use the start-up value
					  value-before-let))))))
	      (unlet))))))
  
  (let ((abs 32))
    (let ((val (protected-let ()
			      (set! abs 64)
			      (set! + 0)
			      (test (- + abs) -64)
			      12)))
      (test (+ val abs) 44)))
  (test (abs (+ 2 -3)) (+ 1))
  
  (define-macro (local-let vars . body)
    ;; locals outside this let are accessible and can be changed, but we'll protect them and the current rootlet values of built-ins
    `(let ((in (apply inlet (curlet) ',(map (lambda (f)
					      (values (car f) ((rootlet) (car f))))
					    (unlet)))))
       (dynamic-wind
	   (lambda () 
	     #f)
	   (lambda ()
	     (let ,vars ,@body))
	   (lambda ()
	     (let ((out (unlet)))
	       (when (out 'set!)            ; in case set! was changed -- see example below
		 (eval `(define set! #_set!) (rootlet)))
	       (for-each 
		(lambda (f)
		  (let ((value-before-let (in (car f))))
		    (unless (or (equal? (symbol->value (car f)) value-before-let)
				(eq? 'set! (car f)))
		      (apply #_set! (list (car f) 
					  (if (eq? value-before-let #<undefined>)
					      (cdr f)
					      value-before-let))))))
		(inlet in out)))))))

  (let ((abs 32)
	(a 20))
    (let ((val (local-let ()
			  (set! abs 64)
			  (set! + 0)
			  (set! a 1)
			  (test (- + abs) -64)
			  12)))
      (test (+ abs a val) 64)))
  (test (abs -1) (+ 1)))
|#

(let ()
  (define (f1) (let ((lst '(1 2 (reader-cond ((> 1 0) 3) (else 4)) 5 6))) lst))
  (test (f1) '(1 2 3 5 6))
  (define (f2) (let ((lst '(1 2 (reader-cond ((> 1 0) 3 4)) 5 6))) lst))
  (test (f2) '(1 2 3 4 5 6))
  (define (f3) '((__exp1__) 5))
  (test (f3) '(1 2 3 5))
  (define (f4) (+ (__exp1__) (__exp1__)))
  (test (f4) 12)
  (define (f5) (let ((lst '((reader-cond ((> 1 0) (__exp1__)) (else 4)) 5 6))) lst))
  (test (f5) '(1 2 3 5 6))
  (define (f6) (let ((lst ((reader-cond ((> 1 0) list) (else cons)) 1 2))) lst))
  (test (f6) '(1 2))
  (define (f7) (let ((lst ((reader-cond ((= 1 0) vector) ((< 1 0) list) (else cons)) 1 2))) lst))
  (test (f7) '(1 . 2))
  (define (f8) (let ((lst ((reader-cond ((> 1 0) quote)) (+ 2 3)))) lst))
  (test (f8) '(+ 2 3))
  (define (f9) (let ((lst ((reader-cond ((= 1 0) quote)) list 2 3))) lst))
  (test (f9) '(2 3))
  (define (f10) (let ((lst #(0 (reader-cond ((> 1 0) (+ 2 3))) 2))) lst))
  (test (f10) #(0 (+ 2 3) 2))
  (define (f11) (let ((lst `(0 ,(reader-cond ((> 1 0) (+ 2 3))) 2))) lst))
  (test (f11) '(0 5 2))
  )
(test (let ((v #(1 (reader-cond (#t 32)) 890))) v) #(1 32 890))
(test (let ((v #(1 (reader-cond (#t 2 3)) 4))) v) #(1 2 3 4))
(test (let ((v #(1 (reader-cond ((+ 2 3))) 4))) v) #(1 5 4))
;;; even worse:
;;  (define (reader-cond ((display "defining hiho\n" *stderr*) hiho)) (lambda () "hiho"))
;;  (format *stderr* "~S~%" (hiho))


(let ()
  (define (test-abs)
    (define (abs x) (+ x 1))
    (test (abs -1) 0))
  (test-abs)
  
  (define (test-sin)
    (let ((sin (lambda (x) (+ x 2))))
      (test (sin -1) 1)))
  (test-sin)
  
  (define (test-cos)
    (define cos (lambda (x) (+ x 3)))
    (test (cos -1) 2))
  (test-cos)
  
  (define test-log
    (lambda ()
      (define log (let () (lambda (x) (+ x 4))))
      (test (log -1) 3)))
  (test-log)
  
  (define test-tan
    (let ((tan (lambda (x) (+ x 5))))
      (lambda ()
	(test (tan -1) 4))))
  (test-tan)
  
  (define (test-acos)
    (let ()
      (define (acos x) (+ x 6))
      (test (acos -1) 5)))
  (test-acos)
  
  (define (test-acos1)
    (let ()
      (if #f (define (acos x) (+ x 6)))
      (test (acos 1) 0)))
  (test-acos1)
  
  (define (test-acos2)
    (let ()
      (if #t (define (acos x) (+ x 6)))
      (test (acos -3) 3)))
  (test-acos2)
  
  (define (test-atan)
    (define (atan x) (+ x 7))
    (test (atan -1) 6))
  (test-atan)

  (define (test-atan1)
    (if #f (define (atan x) (+ x 7)))
    (test (atan 0) 0))
  (test-atan1)

  (define (test-asin)
    (define asin (let () (lambda (x) (+ x 8))))
    (test (asin -1) 7))
  (test-asin)

  (define test-sinh
    (lambda ()
      (define sinh (lambda (x) (+ x 9)))
      (test (sinh -1) 8)))
  (test-sinh))


(define-class quaternion () 
  '((r 0) (i 0) (j 0) (k 0))
  (list (list 'real-part (lambda (obj) (obj 'r)))
	(list 'imag-part (lambda (obj) (vector (obj 'i) (obj 'j) (obj 'k))))

	(list 'number? (lambda (obj) #t))
	(list 'complex? (lambda (obj) #f))
	(list 'real? (lambda (obj) #f))
	(list 'integer? (lambda (obj) #f))
	(list 'rational? (lambda (obj) #f))

	(list '+ (lambda orig-args
		   (let add ((r ()) (i ()) (j ()) (k ()) (args orig-args))
		     (if (null? args)
			 (make-quaternion (apply + r) (apply + i) (apply + j) (apply + k)) 
			 (let ((n (car args)))
			   (cond
			    ((real? n) (add (cons n r) i j k (cdr args)))
			    ((complex? n) (add (cons (real-part n) r) (cons (imag-part n) i) j k (cdr args)))
			    ((quaternion? n) (add (cons (n 'r) r) (cons (n 'i) i) (cons (n 'j) j) (cons (n 'k) k) (cdr args)))
			    ((openlet? n)
			     (if (eq? n (car orig-args))
				 (error 'missing-method "+ can't handle these arguments: ~A" args)
				 (apply (n '+) (make-quaternion (apply + r) (apply + i) (apply + j) (apply + k)) (cdr args))))

			    ;; this code is trying to make sure we don't start bouncing:
			    ;; if (+ q1 o1) goes to (o1 '+) which also can't handle this
			    ;; combination, don't bounce back here!
			    ;; In the current case, it would be (+ o1 q1) bouncing us here.
			    ;; we're assuming (+ a b c) = (+ (+ a b) c), and that any other
			    ;; + method will behave that way.  I think the optimizer also
			    ;; assumes that (+ a b) = (+ b a).

			    (else (error 'wrong-type-arg "+ argument ~A is not a number" n))))))))

	(list '- (lambda args
		   (let ((first (car args)))
		     (if (null? (cdr args)) ; (- q) is not the same as (- q 0)
			 (make-quaternion (- (first 'r)) (- (first 'i)) (- (first 'j)) (- (first 'k)))
			 (let ((q (cond ((real? first) (make-quaternion first 0 0 0))
					((complex? first) (make-quaternion (real-part first) (imag-part first) 0 0))
					(else (copy first))))
			       (n (apply + (cdr args))))
			   (cond ((real? n) (set! (q 'r) (- (q 'r) n)) q)
				 ((complex? n) (make-quaternion (- (q 'r) (real-part n)) (- (q 'i) (imag-part n)) (q 'j) (q 'k)))
				 ((quaternion? n) (make-quaternion (- (q 'r) (n 'r)) (- (q 'i) (n 'i)) (- (q 'j) (n 'j)) (- (q 'k) (n 'k))))
				 (else (apply (n '-) (list q n)))))))))
	))

(let ((old-make-quaternion make-quaternion))
  (varlet (outlet (curlet))
    (cons 'make-quaternion (lambda args
			     (let ((q (apply old-make-quaternion args)))
			       (if (or (not (real? (q 'r)))
				       (not (real? (q 'i)))
				       (not (real? (q 'j)))
				       (not (real? (q 'k))))
				   (error 'wrong-type-arg "quaternion fields should all be real: ~A" q)
				   q))))))


(define-class pfloat () ; don't clobber built-in float?!
  '((x 0.0))
  (list (list '+ (lambda orig-args
		   (let add ((x ()) (args orig-args))
		     (if (null? args)
			 (make-pfloat (apply + x))
			 (let ((n (car args)))
			   (cond
			    ((pfloat? n) (add (cons (n 'x) x) (cdr args)))
			    ((real? n) (add (cons n x) (cdr args)))
			    ((complex? n) (add (cons (real-part n) x) (cdr args)))
			    ((openlet? n)
			     (if (eq? n (car orig-args))
				 (error 'missing-method "+ can't handle these arguments: ~A" args)
				 (apply (n '+) (make-pfloat (apply + x)) (cdr args))))
			    (else (error 'wrong-type-arg "+ argument ~A is not a number" n))))))))
	(list 'number? (lambda (obj) #t))))


(let ((q1 (make-quaternion 1.0 1.0 0.0 0.0)))
  (test (complex? q1) #f)
  (test (number? q1) #t)
  (test (quaternion? q1) #t)
  (test (quaternion? 1) #f)
  (test (quaternion? 1+i) #f)
  (test (integer? q1) #f)
  (test (real? q1) #f)
  (test (rational? q1) #f)

  (test (real-part q1) 1.0)
  (test (imag-part q1) #(1.0 0.0 0.0))

  (test (eq? q1 q1) #t)
  (test (eqv? q1 q1) #t)
  (test (equal? q1 q1) #t)

  (let ((q2 (make-quaternion 1.0 1.0 0.0 0.0)))
    (test (eq? q1 q2) #f)
    (test (eqv? q1 q2) #f)
    (test (equal? q1 q2) #t)
    (set! (q2 'r) 2.0)
    (test (equal? q1 q2) #f)
    
    (test (+ q1) q1)
    (test (+ 1 q1) q2)
    (test (+ q1 1) q2)
    (test (+ 1/2 q1 1/2) q2)
    (test (+ .5 1/2 q1) q2)
    (test (+ 1+i q1 0-i) q2)
    (test (+ 1.0 q1) q2)
    (test (+ q1 1+i 0-i) q2)
    (test (+ 0+i q1 1 0-i) q2)

    (test (- q1) (make-quaternion -1.0 -1.0 0.0 0.0))
    (test (- q1 1) (make-quaternion 0.0 1.0 0.0 0.0))
    (test (- q1 1 0.0+i) (make-quaternion 0.0 0.0 0.0 0.0))
    (test (- 1 q1) (make-quaternion 0.0 -1.0 0.0 0.0))


    (test (+ (make-pfloat 1.0) 1.0) (make-pfloat 2.0))
    (test (+ (make-quaternion 1 0 0 0) (make-pfloat 1.0)) 'error)
    (test (+ (make-pfloat 1.0) 2 (make-quaternion 1 1 1 1)) 'error)
    (test (+ 1 (make-pfloat 1.0) 2 (make-quaternion 1 1 1 1)) 'error)

    (test (make-quaternion 1 2+i 0 0) 'error)
    (test (make-quaternion 1 2 3 "hi") 'error)

    (let () (define (a1 q) (+ q 1)) (test (a1 q1) (make-quaternion 2.0 1.0 0.0 0.0)))
    (let () (define (a1 q) (+ q 1)) (test (a1 (+ q1 1)) (make-quaternion 3.0 1.0 0.0 0.0)))
    (let () (define (a1 q) (+ q 1)) (test (a1 (- q1 1)) q1))
    (let () (define (a1 q) (+ q 1)) (test (a1 (+ 1 q1)) (make-quaternion 3.0 1.0 0.0 0.0)))
    (let () (define (a1 q) (+ q 1)) (test (a1 (- 1 q1)) (make-quaternion 1.0 -1.0 0.0 0.0)))
    (let () (define (a1 q) (+ q 1)) (test (a1 (+ q1 q1)) (make-quaternion 3.0 2.0 0.0 0.0)))
    (let () (define (a1 q) (+ 1 q)) (test (a1 q1) (make-quaternion 2.0 1.0 0.0 0.0)))
    (let () (define (a1 q) (+ q q)) (test (a1 q1) (make-quaternion 2.0 2.0 0.0 0.0)))
    (let () (define (a1 q) (- q 1)) (test (a1 q1) (make-quaternion 0.0 1.0 0.0 0.0)))
    (let () (define (a2 q p) (+ q p)) (test (a2 q1 q2) (make-quaternion 3.0 2.0 0.0 0.0)))
    (let () (define (a2 q p) (+ q p)) (test (a2 (+ 1 q1) (+ q2 1)) (make-quaternion 5.0 2.0 0.0 0.0)))
    )) 

(unless with-bignums
  (let ((e1 (openlet 
	     (inlet 
	      'x 3
	      '* (lambda args
		   (if (number? (car args))    ; are we the first?
		       (apply * (car args) ((cadr args) 'x) (cddr args))
		       (apply * ((car args) 'x) (cdr args))))))))
    (let ((e2 (copy e1)))
      (set! (e2 'x) 4)
      (test (* 2 e1 e2 5) 120)
      (test (* e1 e2 5) 60)
      (test (* e1 e2) 12)
      (test (* e1) 3)
      (test (* 2 e1 e2) 24)
      (test (* 2 e1 4) 24)
      (test (* e1 2 e2 e1) 72))))

(let ()
  (begin
    (define fvector? #f)
    (define make-fvector #f)
    (let ((type (gensym))
	  (->float (lambda (x)
		     (if (real? x)
			 (* x 1.0)
			 (error 'wrong-type-arg "fvector new value is not a real: ~A" x)))))
      (set! make-fvector
	    (lambda* (len (init 0.0)) 
	      (openlet
	       (inlet 'v (make-vector len (->float init))
			     'type type
			     'length (lambda (e) len)
			     'let-set-fallback (lambda (fv i val) (#_vector-set! (fv 'v) i (->float val)))
			     'let-ref-fallback (lambda (fv i) (#_vector-ref (fv 'v) i))))))
      (set! fvector? (lambda (p) (and (let? p) (eq? (p 'type) type))))))
  (let ((f (make-fvector 10)))
    (test (fvector? f) #t)
    (test (length f) 10)
    (test (f 0) 0.0)
    (set! (f 1) 123)
    (test (f 1) 123.0)))

(let ()
  (define (baser-method func)
    (lambda largs
      (if (let? (car largs))
	  (apply func ((car largs) 'c) (cdr largs))
	  (if (let? (cadr largs))
	      (apply func (car largs) ((cadr largs) 'c) (cddr largs))
	      (if (let? (caddr largs))
		  (apply func (car largs) (cadr largs) ((caddr largs) 'c) (cdddr largs))
		  (apply func (car largs) (cadr largs) (caddr largs) ((cadddr largs) 'c) (cddddr largs)))))))
  (test (numerator (openlet (inlet 'c 1/9223372036854775807 'numerator (baser-method numerator)))) 1)
  (test (cdaadr (openlet (inlet 'c '((1 (2)) (((3) 4))) 'cdaadr (baser-method cdaadr)))) '(4))
  (test (cadadr (openlet (inlet 'c '((1 2) (3 4)) 'cadadr (baser-method cadadr)))) 4)
  (test (caadar (openlet (inlet 'c '((1 (2)) (((3) 4))) 'caadar (baser-method caadar)))) 2)
  (test (caaadr (openlet (inlet 'c '((1 (2)) (((3) 4))) 'caaadr (baser-method caaadr)))) '(3))
  (test (boolean? (openlet (inlet 'c #f 'boolean? (baser-method boolean?)))) #t)
  (test (number->string (openlet (inlet 'c 1/9223372036854775807 'number->string (baser-method number->string)))) "1/9223372036854775807")
  (test (lognot (openlet (inlet 'c '9223372036854775807 'lognot (baser-method lognot)))) -9223372036854775808)
  (unless pure-s7 (test (vector-length (openlet (inlet 'c #() 'vector-length (baser-method vector-length)))) 0))
  (test (round (openlet (inlet 'c 1/9223372036854775807 'round (baser-method round)))) 0)
  (test (string-upcase (openlet (inlet 'c #u8(104 105 52 53 53) 'string-upcase (baser-method string-upcase)))) "HI455")
  (test (vector? (openlet (inlet 'c #() 'vector? (baser-method vector?)))) #t)
  (test (null? (openlet (inlet 'c () 'null? (baser-method null?)))) #t)
  (test (keyword? (openlet (inlet 'c ':key 'keyword? (baser-method keyword?)))) #t)
  (test (real? (openlet (inlet 'c 1/9223372036854775807 'real? (baser-method real?)))) #t)
  (test (length (openlet (inlet 'c () 'length (baser-method length)))) 0)
  (test (pair? (openlet (inlet 'c '(1) 'pair? (baser-method pair?)))) #t)
  (test (number? (openlet (inlet 'c 1/9223372036854775807 'number? (baser-method number?)))) #t)
  (test (odd? (openlet (inlet 'c '9223372036854775807 'odd? (baser-method odd?)))) #t)
  (test (symbol (openlet (inlet 'c #u8(104 105 52 53 53) 'symbol (baser-method symbol)))) 'hi455)
  (test (cdar (openlet (inlet 'c '((1 2)) 'cdar (baser-method cdar)))) '(2))
  (test (even? (openlet (inlet 'c -9223372036854775808 'even? (baser-method even?)))) #t)
  (test (caar (openlet (inlet 'c '((1 2)) 'caar (baser-method caar)))) 1)
  (test (negative? (openlet (inlet 'c -1/9223372036854775807 'negative? (baser-method negative?)))) #t)
  (test (floor (openlet (inlet 'c 1/9223372036854775807 'floor (baser-method floor)))) 0)
  (test (positive? (openlet (inlet 'c 1/9223372036854775807 'positive? (baser-method positive?)))) #t)
  (test (string (openlet (inlet 'c #\a 'string (baser-method string)))) "a")
  (test (rational? (openlet (inlet 'c 1/9223372036854775807 'rational? (baser-method rational?)))) #t)
  (unless pure-s7 (test (string-copy (openlet (inlet 'c #u8(104 105 52 53 53) 'string-copy (baser-method string-copy)))) "hi455"))
  (test (string->keyword (openlet (inlet 'c #u8(104 105 52 53 53) 'string->keyword (baser-method string->keyword)))) :hi455)
  (unless pure-s7 (test (inexact? (openlet (inlet 'c 1.5+1i 'inexact? (baser-method inexact?)))) #t))
  (test (char? (openlet (inlet 'c #\a 'char? (baser-method char?)))) #t)
  (test (exact? (openlet (inlet 'c 1/9223372036854775807 'exact? (baser-method exact?)))) #t)
  (test (format (openlet (inlet 'c #u8(104 105 52 53 53) 'format (baser-method format)))) "hi455")
  (test (cadar (openlet (inlet 'c '((1 2)) 'cadar (baser-method cadar)))) '2)
  (test (char-lower-case? (openlet (inlet 'c #\a 'char-lower-case? (baser-method char-lower-case?)))) #t)
  (test (char-upcase (openlet (inlet 'c #\a 'char-upcase (baser-method char-upcase)))) #\A)
  (test (byte-vector? (openlet (inlet 'c #u8(104 105 52 53 53) 'byte-vector? (baser-method byte-vector?)))) #t)
  (unless pure-s7 (test (string->list (openlet (inlet 'c #u8(104 105 52 53 53) 'string->list (baser-method string->list)))) '(#\h #\i #\4 #\5 #\5)))
  (test (denominator (openlet (inlet 'c 1/9223372036854775807 'denominator (baser-method denominator)))) 9223372036854775807)
  (test (integer-length (openlet (inlet 'c '9223372036854775807 'integer-length (baser-method integer-length)))) 63)
  (test (integer? (openlet (inlet 'c '9223372036854775807 'integer? (baser-method integer?)))) #t)
  (test (char->integer (openlet (inlet 'c #\a 'char->integer (baser-method char->integer)))) 97)
  (test (min (openlet (inlet 'c 1/9223372036854775807 'real? (lambda (obj) (#_real? (obj 'c))) 'min (baser-method min)))) 1/9223372036854775807)
  (test (ceiling (openlet (inlet 'c 1/9223372036854775807 'ceiling (baser-method ceiling)))) 1)
  (test (max (openlet (inlet 'c 1/9223372036854775807 'real? (lambda (obj) (#_real? (obj 'c))) 'max (baser-method max)))) 1/9223372036854775807)
  (test (car (openlet (inlet 'c '(1) 'car (baser-method car)))) 1)
  (test (char-alphabetic? (openlet (inlet 'c #\a 'char-alphabetic? (baser-method char-alphabetic?)))) #t)
  (test (modulo 1/9223372036854775807 (openlet (inlet 'c 1/9223372036854775807 'modulo (baser-method modulo)))) 0)
  (test (substring #u8(104 105 52 53 53) (openlet (inlet 'c '0 'substring (baser-method substring)))) "hi455")
  (test (char-position #\a (openlet (inlet 'c #u8(97 0 98) 'char-position (baser-method char-position)))) 0)
  (test (assv 1 (openlet (inlet 'c '((1 2)) 'assv (baser-method assv)))) '(1 2))
  (test (assq 1 (openlet (inlet 'c '((1 2)) 'assq (baser-method assq)))) '(1 2))
  (test (rationalize 1/9223372036854775807 (openlet (inlet 'c 1/9223372036854775807 'rationalize (baser-method rationalize)))) 0)
  (test (make-shared-vector #(1 2) (openlet (inlet 'c '(1) 'make-shared-vector (baser-method make-shared-vector)))) #(1))
  (test (string>=? #u8(52 53 104 105 53) (openlet (inlet 'c #u8(52 53 104 105 53) 'string>=? (baser-method string>=?)))) #t)
  (test (string<=? #u8(52 53 104 105 53) (openlet (inlet 'c #u8(52 53 104 105 53) 'string<=? (baser-method string<=?)))) #t)
  (test (fill! #u8(97 97 97 97 97) (openlet (inlet 'c 120 'fill! (baser-method fill!)))) 120)
  (test (string #\a (openlet (inlet 'c #\a 'string (baser-method string)))) "aa")
  (test (logbit? 9223372036854775807 (openlet (inlet 'c '0 'logbit? (baser-method logbit?)))) #t)
  (test (remainder 1/9223372036854775807 (openlet (inlet 'c 1/9223372036854775807 'remainder (baser-method remainder)))) 0)
  (if (not pure-s7) (test (string-ci>? #u8(0 0 0 0 0) (openlet (inlet 'c #u8(0) 'string-ci>? (baser-method string-ci>?)))) #t))
  (if (not pure-s7) (test (string-ci=? #u8(0 0 0 0 0) (openlet (inlet 'c #u8(0 0 0 0 0) 'string-ci=? (baser-method string-ci=?)))) #t))
  (test (string-ref #u8(0 0 0 0 0) (openlet (inlet 'c '0 'string-ref (baser-method string-ref)))) #\null)
  (test (string-position #u8(0 0 0 0 0) (openlet (inlet 'c #u8(0 0 0 0 0) 'string-position (baser-method string-position)))) 0)
  (test (string>? #u8(0 0 0 0 0) (openlet (inlet 'c #u8(0) 'string>? (baser-method string>?)))) #t)
  (test (string>=? #u8(52 53 104 105 53) #u8(52 53 104 105 53) (openlet (inlet 'c #u8(52 53 104 105 53) 'string>=? (baser-method string>=?)))) #t)
  (when (not with-bignums)
    (test (logxor (openlet (inlet 'c '9223372036854775807 'logxor (baser-method logxor)))) 9223372036854775807)
    (test (> 1/9223372036854775807 (openlet (inlet 'c -1/9223372036854775807 '> (baser-method >)))) #t)
    (test (= 1/9223372036854775807 (openlet (inlet 'c 1/9223372036854775807 '= (baser-method =)))) #t)
    (test (< 1/9223372036854775807 (openlet (inlet 'c 1e+18 '< (baser-method <)))) #t)
    (test (/ 1/9223372036854775807 (openlet (inlet 'c 1/9223372036854775807 '/ (baser-method /)))) 1)
    (test (- 1/9223372036854775807 (openlet (inlet 'c 1/9223372036854775807 '- (baser-method -)))) 0)
    (test (+ 1/9223372036854775807 (openlet (inlet 'c 1/9223372036854775807 '+ (baser-method +)))) 2/9223372036854775807)
    (test (> 1/9223372036854775807 -1/9223372036854775807 (openlet (inlet 'c -9223372036854775808 '> (baser-method >)))) #t)
    (test (= 1/9223372036854775807 1/9223372036854775807 (openlet (inlet 'c 1/9223372036854775807 '= (baser-method =)))) #t)
    (test (+ -1 (openlet (inlet 'c -1 '+ (baser-method +)))) -2)
    (test (- -1 (openlet (inlet 'c -1 '- (baser-method -)))) 0)
    (test (* (openlet (inlet 'c 2.0 '* (baser-method *))) 2.0) 4.0)
    (test (let ((x (openlet (inlet 'c -1 '- (baser-method -))))) (- x 1)) -2)
    (test (let ((x (openlet (inlet 'c 1.0 '- (baser-method -))))) (- 1.0 x)) 0.0)
    (test (* 3.0 (openlet (inlet 'c 2.0 '* (baser-method *))) 2.0) 12.0))
  (test (symbol->string (openlet (inlet 'c 'a 'symbol->string (baser-method symbol->string)))) "a")
  (test (let? (outlet (openlet (inlet 'c (curlet) 'outlet (baser-method outlet)))) ) #t)
  (test (c-pointer? (c-pointer (openlet (inlet 'c 0 'c-pointer (baser-method c-pointer))))) #t))

(let ((e (openlet (inlet 'x (list 1 2 3) 'make-iterator (let ((iterator? #t)) (lambda (y) (#_make-iterator (y 'x))))))))
  (test (map (lambda (z) (+ z 1)) e) '(2 3 4)))

(let () 
  (let ((x (openlet (inlet 'integer? (lambda (y) #t)))))
    (define (func)
      (let ((z (vector (integer? x) (vector (integer? x)))))
	(test (z 0) ((z 1) 0))))
    (func)))

(let ()
  (require mockery.scm)
  (let ((v ((*mock-vector* 'make-mock-vector) 10 0)))
    (test (vector? v) #t)
    (let-temporarily (((*s7* 'print-length) 32))
      (test (object->string v) "#(0 0 0 0 0 0 0 0 0 0)"))
    (test (length v) 10)
    (test (vector-length v) 10)
    (test (vector-dimensions v) '(10))
    (test (vector-set! v 0 1) 1)
    (test (vector-ref v 0) 1)
    (test (v 0) 1)
    (test (set! (v 1) 2) 2)
    (test (v 1) 2)
    (fill! v 0)
    (test (v 'value) #(0 0 0 0 0 0 0 0 0 0))
    (test (morally-equal? v #(0 0 0 0 0 0 0 0 0 0)) #t)
    (test (morally-equal? #(0 0 0 0 0 0 0 0 0 0) v) #t)
    (test (morally-equal? v ((*mock-vector* 'make-mock-vector) 10 0)) #t)
    (unless pure-s7 (vector-fill! v 3 1 4))
    (unless pure-s7 (test (v 'value) #(0 3 3 3 0 0 0 0 0 0)))
    (unless pure-s7 (test (vector->list v) '(0 3 3 3 0 0 0 0 0 0)))
    (unless pure-s7 (test (map (lambda (a) (+ a 1)) v) '(1 4 4 4 1 1 1 1 1 1)))
    (do ((i 0 (+ i 1)))
	((= i 10))
      (set! (v i) i))
    (test (v 'value) #(0 1 2 3 4 5 6 7 8 9))
    (for-each (lambda (x) (test (integer? x) #t)) v) 
    (let ((v1 (make-shared-vector v '(3) 2)))
      (test v1 #(2 3 4)))
    (sort! v >)
    (test (v 'value) #(9 8 7 6 5 4 3 2 1 0))
    (test (reverse v) #(0 1 2 3 4 5 6 7 8 9))
    (test (let* ((y (list 1)) (x ((*mock-vector* 'mock-vector) y))) (set! (y 0) x) (null? (cyclic-sequences x))) #f)

    (let ((v1 ((*mock-vector* 'make-mock-vector) 10 1)))
      (let ((v2 (copy v1)))
	(set! (v1 3) 32)
	(test (or (eq? (v1 'value) (v2 'value))
		  (equal? (v1 'value) (v2 'value)))
	      #f)))
#|
    (let ((v1 #(1 2 3))
	  (v2 ((*mock-vector* 'make-mock-vector) 2 4)))
      (test (vector-append v1 v2) #(1 2 3 4 4))
      (test (vector-append v2 v1) #(4 4 1 2 3))
      (test (vector-append v1 v1 v2) #(1 2 3 1 2 3 4 4))
      (test (vector-append v2 v2 v1) #(4 4 4 4 1 2 3)))
|#
    (let ((v1 ((*mock-vector* 'mock-vector) 0 1 2 3 4)))
      (test (subsequence v1 0 2) #(0 1))))

  (let ()
    (define (vset v i j k)
      (let ((x 3.0))
	(vector-set! v 0 x)
	(vector-set! v j (vector-ref v i))
	(vector-set! v i (+ (vector-ref v j) x))
	(vector-set! v k x)))
    (let ((v (vector 1 2 0)) (i 0) (j 1) (k 2)) (vset v i j k) (test (morally-equal? v #(6.0 3.0 3.0)) #t))
    (let ((v ((*mock-vector* 'mock-vector) 1 2 0)) (i 0) (j 1) (k 2)) (vset v i j k) (test (morally-equal? v #(6.0 3.0 3.0)) #t))
    (let ((v (vector 1 2 0))
	  (i ((*mock-number* 'mock-number) 0))
	  (j ((*mock-number* 'mock-number) 1))
	  (k ((*mock-number* 'mock-number) 2)))
      (vset v i j k) (test (morally-equal? v #(6.0 3.0 3.0)) #t))
    (let ((v ((*mock-vector* 'mock-vector) 1 2 0))
	  (i ((*mock-number* 'mock-number) 0))
	  (j ((*mock-number* 'mock-number) 1))
	  (k ((*mock-number* 'mock-number) 2)))
      (vset v i j k) (test (morally-equal? v #(6.0 3.0 3.0)) #t))
    (let ((v (vector 1 2 0)) (i 0) (j ((*mock-number* 'mock-number) 1)) (k 2)) (vset v i j k) (test (morally-equal? v #(6.0 3.0 3.0)) #t)))

  (num-test (+ ((*mock-number* 'mock-number) 1) ((*mock-number* 'mock-number) 2)) 3)
  (num-test (log ((*mock-number* 'mock-number) 2) ((*mock-number* 'mock-number) 2)) 1)

  (num-test (/ ((*mock-number* 'mock-number) 0) 1) 0)
  (num-test (/ ((*mock-number* 'mock-number) 0) ((*mock-number* 'mock-number) 1-i) ((*mock-number* 'mock-number) 3/4)) 0.0)
  (test (make-float-vector 0 ((*mock-number* 'mock-number) 3)) #())

  (test (= ((*mock-number* 'mock-number) 0) ((*mock-number* 'mock-number) 0) ((*mock-number* 'mock-number) 0)) #t)
  (test (= ((*mock-number* 'mock-number) 0) ((*mock-number* 'mock-number) 0) #\a) 'error)
  (test (nan? (/ 0 1-1i inf.0 nan.0)) #t)
  (test (nan? (/ ((*mock-number* 'mock-number) 0) ((*mock-number* 'mock-number) 1-1i) ((*mock-number* 'mock-number) inf.0) ((*mock-number* 'mock-number) nan.0))) #t)
  (test (/ 0 0.0) 'error)
  (test (/ ((*mock-number* 'mock-number) 0) ((*mock-number* 'mock-number) 0.0)) 'error)
  (test (/ 0.0 0) 'error)
  (test (/ ((*mock-number* 'mock-number) 0.0) ((*mock-number* 'mock-number) 0)) 'error)
  (test (nan? (/ 2.0 inf.0 1-1i 0.0)) #t)
  (test (nan? (/ ((*mock-number* 'mock-number) 2.0) ((*mock-number* 'mock-number) inf.0) ((*mock-number* 'mock-number) 1-1i) ((*mock-number* 'mock-number) 0.0))) #t)

  (test (length (append '(1) ((*mock-number* 'mock-number) 1))) -1)
  (test (number? (append ((*mock-number* 'mock-number) 1))) #t)
;  (test (append ((*mock-number* 'mock-number) 1) ()) 'error)

  (test (string=? "hi" ((*mock-string* 'mock-string) "hi") ((*mock-string* 'mock-string) "hi")) #t)
  (test (string=? "hi" ((*mock-string* 'mock-string) "hi") ((*mock-string* 'mock-string) "ho")) #f)
  (test (string=? "hi" ((*mock-string* 'mock-string) "hi") ((*mock-string* 'mock-string) "hi") "hi") #t)
  (test (string=? ((*mock-string* 'mock-string) "hi") ((*mock-string* 'mock-string) "hi") "hi") #t)
  (test (string=? ((*mock-string* 'mock-string) "hi") ((*mock-string* 'mock-string) "hi") ((*mock-string* 'mock-string) "hi")) #t)
  (test (string<=? ((*mock-string* 'mock-string) "hi") ((*mock-string* 'mock-string) "hi") ((*mock-string* 'mock-string) "hi")) #t)
  (test (string>=? ((*mock-string* 'mock-string) "hi") ((*mock-string* 'mock-string) "hi") ((*mock-string* 'mock-string) "hi")) #t)
  (test (string>=? ((*mock-string* 'mock-string) "hi") ((*mock-string* 'mock-string) "hi") ((*mock-string* 'mock-string) "hj")) #f)
  (test (string>=? ((*mock-string* 'mock-string) "hi") ((*mock-string* 'mock-string) "hi") ((*mock-string* 'mock-string) "hj") 1) 'error)
  (test (string>=? ((*mock-string* 'mock-string) "hi") ((*mock-string* 'mock-string) "hi") ((*mock-string* 'mock-string) "hj") ((*mock-number* 'mock-number) 1)) 'error)
  (test (string<? ((*mock-string* 'mock-string) "hi") ((*mock-string* 'mock-string) "hi") ((*mock-string* 'mock-string) "hi")) #f)
  (test (string>? ((*mock-string* 'mock-string) "hi") ((*mock-string* 'mock-string) "hi") ((*mock-string* 'mock-string) "hi")) #f)
  (test (string<? ((*mock-string* 'mock-string) "hi") ((*mock-string* 'mock-string) "hih") ((*mock-string* 'mock-string) "hihi")) #t)
  (test (string>? ((*mock-string* 'mock-string) "hihi") ((*mock-string* 'mock-string) "hih") ((*mock-string* 'mock-string) "hi")) #t)
  (test (string>? ((*mock-string* 'mock-string) "hihi") ((*mock-string* 'mock-string) "hih") ((*mock-string* 'mock-string) "hih")) #f)
  (test (string>? ((*mock-string* 'mock-string) "hihi") ((*mock-string* 'mock-string) "hih") ((*mock-string* 'mock-string) "hih") #\a) 'error)
  (test (string>? ((*mock-string* 'mock-string) "hihi") ((*mock-string* 'mock-string) "hih") ((*mock-string* 'mock-string) "hih") ((*mock-number* 'mock-number) 1)) 'error)

  (test (char=? #\i ((*mock-char* 'mock-char) #\i) ((*mock-char* 'mock-char) #\i)) #t)
  (test (char=? #\i ((*mock-char* 'mock-char) #\i) ((*mock-char* 'mock-char) #\k)) #f)
  (test (char=? #\i ((*mock-char* 'mock-char) #\i) ((*mock-char* 'mock-char) #\i) #\i) #t)
  (test (char=? ((*mock-char* 'mock-char) #\i) ((*mock-char* 'mock-char) #\i) #\i) #t)
  (test (char=? ((*mock-char* 'mock-char) #\i) ((*mock-char* 'mock-char) #\i) ((*mock-char* 'mock-char) #\i)) #t)
  (test (char<=? ((*mock-char* 'mock-char) #\i) ((*mock-char* 'mock-char) #\i) ((*mock-char* 'mock-char) #\i)) #t)
  (test (char>=? ((*mock-char* 'mock-char) #\i) ((*mock-char* 'mock-char) #\i) ((*mock-char* 'mock-char) #\i)) #t)
  (test (char>=? ((*mock-char* 'mock-char) #\i) ((*mock-char* 'mock-char) #\i) ((*mock-char* 'mock-char) #\j)) #f)
  (test (char>=? ((*mock-char* 'mock-char) #\i) ((*mock-char* 'mock-char) #\i) ((*mock-char* 'mock-char) #\j) 1) 'error)
  (test (char>=? ((*mock-char* 'mock-char) #\i) ((*mock-char* 'mock-char) #\i) ((*mock-char* 'mock-char) #\j) ((*mock-number* 'mock-number) 1)) 'error)
  (test (char<? ((*mock-char* 'mock-char) #\i) ((*mock-char* 'mock-char) #\i) ((*mock-char* 'mock-char) #\i)) #f)
  (test (char>? ((*mock-char* 'mock-char) #\i) ((*mock-char* 'mock-char) #\i) ((*mock-char* 'mock-char) #\i)) #f)
  (test (char<? ((*mock-char* 'mock-char) #\i) ((*mock-char* 'mock-char) #\m) ((*mock-char* 'mock-char) #\p)) #t)
  (test (char>? ((*mock-char* 'mock-char) #\p) ((*mock-char* 'mock-char) #\m) ((*mock-char* 'mock-char) #\i)) #t)
  (test (char>? ((*mock-char* 'mock-char) #\p) ((*mock-char* 'mock-char) #\m) ((*mock-char* 'mock-char) #\m)) #f)
  (test (char>? ((*mock-char* 'mock-char) #\p) ((*mock-char* 'mock-char) #\m) ((*mock-char* 'mock-char) #\m) "a") 'error)
  (test (char>? ((*mock-char* 'mock-char) #\p) ((*mock-char* 'mock-char) #\m) ((*mock-char* 'mock-char) #\m) ((*mock-number* 'mock-number) 1)) 'error)

  (test (string-ci=? "hi" ((*mock-string* 'mock-string) "HI") ((*mock-string* 'mock-string) "hi")) #t)
  (test (string-ci=? "hi" ((*mock-string* 'mock-string) "hi") ((*mock-string* 'mock-string) "ho")) #f)
  (test (string-ci=? "hi" ((*mock-string* 'mock-string) "hi") ((*mock-string* 'mock-string) "hi") "HI") #t)
  (test (string-ci=? ((*mock-string* 'mock-string) "HI") ((*mock-string* 'mock-string) "hi") "hi") #t)
  (test (string-ci=? ((*mock-string* 'mock-string) "hi") ((*mock-string* 'mock-string) "HI") ((*mock-string* 'mock-string) "hi")) #t)
  (test (string-ci<=? ((*mock-string* 'mock-string) "hi") ((*mock-string* 'mock-string) "hi") ((*mock-string* 'mock-string) "hi")) #t)
  (test (string-ci>=? ((*mock-string* 'mock-string) "HI") ((*mock-string* 'mock-string) "hi") ((*mock-string* 'mock-string) "hi")) #t)
  (test (string-ci>=? ((*mock-string* 'mock-string) "hi") ((*mock-string* 'mock-string) "hi") ((*mock-string* 'mock-string) "hj")) #f)
  (test (string-ci>=? ((*mock-string* 'mock-string) "hi") ((*mock-string* 'mock-string) "hi") ((*mock-string* 'mock-string) "hj") 1) 'error)
  (test (string-ci>=? ((*mock-string* 'mock-string) "hi") ((*mock-string* 'mock-string) "HI") ((*mock-string* 'mock-string) "hj") ((*mock-number* 'mock-number) 1)) 'error)
  (test (string-ci<? ((*mock-string* 'mock-string) "hi") ((*mock-string* 'mock-string) "hi") ((*mock-string* 'mock-string) "hi")) #f)
  (test (string-ci<? ((*mock-string* 'mock-string) "hi") ((*mock-string* 'mock-string) "hih") "hi") #f)
  (test (string-ci>? ((*mock-string* 'mock-string) "hi") ((*mock-string* 'mock-string) "hi") ((*mock-string* 'mock-string) "HI")) #f)
  (test (string-ci<? ((*mock-string* 'mock-string) "hi") ((*mock-string* 'mock-string) "HIH") ((*mock-string* 'mock-string) "hihi")) #t)
  (test (string-ci<? ((*mock-string* 'mock-string) "hi") "HIH" ((*mock-string* 'mock-string) "hihi")) #t)
  (test (string-ci>? ((*mock-string* 'mock-string) "hihi") ((*mock-string* 'mock-string) "hih") ((*mock-string* 'mock-string) "HI")) #t)
  (test (string-ci>? ((*mock-string* 'mock-string) "HIHI") ((*mock-string* 'mock-string) "hih") ((*mock-string* 'mock-string) "hih")) #f)
  (test (string-ci>? ((*mock-string* 'mock-string) "hihi") ((*mock-string* 'mock-string) "HIH") ((*mock-string* 'mock-string) "hih") #\a) 'error)
  (test (string-ci>? ((*mock-string* 'mock-string) "hihi") ((*mock-string* 'mock-string) "hih") ((*mock-string* 'mock-string) "HIH") ((*mock-number* 'mock-number) 1)) 'error)

  (test (char-ci=? #\i ((*mock-char* 'mock-char) #\i) ((*mock-char* 'mock-char) #\I)) #t)
  (test (char-ci=? #\i ((*mock-char* 'mock-char) #\i) ((*mock-char* 'mock-char) #\k)) #f)
  (test (char-ci=? #\I ((*mock-char* 'mock-char) #\i) ((*mock-char* 'mock-char) #\i) #\i) #t)
  (test (char-ci=? ((*mock-char* 'mock-char) #\I) ((*mock-char* 'mock-char) #\i) #\i) #t)
  (test (char-ci=? ((*mock-char* 'mock-char) #\i) ((*mock-char* 'mock-char) #\I) ((*mock-char* 'mock-char) #\i)) #t)
  (test (char-ci<=? ((*mock-char* 'mock-char) #\I) ((*mock-char* 'mock-char) #\i) ((*mock-char* 'mock-char) #\i)) #t)
  (test (char-ci>=? ((*mock-char* 'mock-char) #\i) ((*mock-char* 'mock-char) #\I) ((*mock-char* 'mock-char) #\i)) #t)
  (test (char-ci>=? ((*mock-char* 'mock-char) #\I) ((*mock-char* 'mock-char) #\i) ((*mock-char* 'mock-char) #\j)) #f)
  (test (char-ci>=? ((*mock-char* 'mock-char) #\i) ((*mock-char* 'mock-char) #\i) ((*mock-char* 'mock-char) #\J) 1) 'error)
  (test (char-ci>=? ((*mock-char* 'mock-char) #\i) ((*mock-char* 'mock-char) #\I) ((*mock-char* 'mock-char) #\J) ((*mock-number* 'mock-number) 1)) 'error)
  (test (char-ci<? ((*mock-char* 'mock-char) #\i) ((*mock-char* 'mock-char) #\I) ((*mock-char* 'mock-char) #\i)) #f)
  (test (char-ci>? ((*mock-char* 'mock-char) #\i) ((*mock-char* 'mock-char) #\I) ((*mock-char* 'mock-char) #\i)) #f)
  (test (char-ci<? ((*mock-char* 'mock-char) #\I) ((*mock-char* 'mock-char) #\m) ((*mock-char* 'mock-char) #\p)) #t)
  (test (char-ci>? ((*mock-char* 'mock-char) #\P) ((*mock-char* 'mock-char) #\m) ((*mock-char* 'mock-char) #\i)) #t)
  (test (char-ci>? ((*mock-char* 'mock-char) #\p) ((*mock-char* 'mock-char) #\M) ((*mock-char* 'mock-char) #\m)) #f)
  (test (char-ci>? ((*mock-char* 'mock-char) #\p) ((*mock-char* 'mock-char) #\m) ((*mock-char* 'mock-char) #\M) "a") 'error)
  (test (char-ci>? ((*mock-char* 'mock-char) #\p) ((*mock-char* 'mock-char) #\m) ((*mock-char* 'mock-char) #\m) ((*mock-number* 'mock-number) 1)) 'error)

  (test (rationalize ((*mock-number* 'mock-number) 2.5) (openlet (inlet 'c 1/100 'rationalize (make-method #_rationalize (lambda (obj) (obj 'c)))))) 5/2)
  (test (autoload 'asdf (openlet (inlet 'c "asdf" 'autoload (make-method #_autoload (lambda (obj) (obj 'c)))))) "asdf")

  (define stretchable-vector-class
    (let ((local-ref (lambda (obj index)
		       (if (>= index (length (obj 'value)))
			   (obj 'initial-element)
			   (#_vector-ref (obj 'value) index))))
	  (local-set! (lambda (obj index val)
			(if (>= index (length (obj 'value)))
			    (set! (obj 'value) (copy (obj 'value) (make-vector (+ index 8) (obj 'initial-element)))))
			(#_vector-set! (obj 'value) index val))))
      (openlet
       (sublet (*mock-vector* 'mock-vector-class)
	 'value (vector)
	 'object->string (lambda* (obj (w #t)) (format #f "#<stretchable-vector: ~S>" (obj 'value)))
	 'initial-element #f
	 'vector-ref local-ref
	 'let-ref-fallback local-ref
	 'vector-set! local-set!
	 'let-set-fallback local-set!))))
  
  (let ((v1 (copy stretchable-vector-class))
	(ind 12))
    (test (vector-length v1) 0)
    (test ((*mock-vector* 'mock-vector?) v1) #t)
    (test (v1 123) #f)
    (test (vector-length v1) 0)
    (test (object->string v1) "#<stretchable-vector: #()>")
    (set! (v1 ind) 32)
    (test (v1 ind) 32)
    (test (length v1) 20)
    (test (v1 11) #f))

  (let ((ht ((*mock-hash-table* 'mock-hash-table*) 'a 1 'b 2)))
    (test (ht 'a) 1)
    (test (hash-table? ht) #t)
    (test ((*mock-hash-table* 'mock-hash-table?) ht) #t)
    (test (vector? ht) #f)
    (test (morally-equal? ht (hash-table* 'a 1 'b 2)) #t)
    (test (hash-table-ref ht 'b) 2)
    (hash-table-set! ht 'c 3)
    (test (ht 'c) 3)
    (test (ht 'd) #f)
    (set! (ht 'c) 32)
    (test (hash-table-ref ht 'c) 32)
    (test (length ht) (*s7* 'default-hash-table-length))
    (test (hash-table-entries ht) 3)
    (let ((ht1 (copy ht)))
      (test (hash-table-ref ht1 'b) 2)
      (test (hash-table-entries ht1) 3))
    (let ((hti (make-iterator ht)))
      (for-each (lambda (x)
		  (if (not (equal? x (hti)))
		      (format *stderr* "hti not ~A~%" x)))
		ht))
    (fill! ht ())
    (test (hash-table-entries ht) 3))
  (test (let ((v (vector 0 0))) (copy ((*mock-hash-table* 'mock-hash-table*) 'b 2) v) v) #((b . 2) 0))
  
  (unless pure-s7 (test (let ((e (openlet (inlet 'fill! (lambda (obj val) (string-fill! (obj 'value) val)) 'value "01234")))) (vector-fill! e #\a) (e 'value)) 'error))
  (test (let ((e (openlet (inlet 'call/cc (lambda (obj) 32))))) (call/cc e)) 32)
  (test (let ((e (openlet (inlet 'call-with-current-continuation (lambda (obj) 32))))) (call/cc e)) 32)
  
  (define gloomy-hash-table
    (openlet
     (sublet (*mock-hash-table* 'mock-hash-table-class)
       'mock-hash-table-table #f
       'false (gensym)
       'not-a-key #f
       'hash-table-ref (lambda (obj key)
			 (let ((val (#_hash-table-ref (obj 'mock-hash-table-table) key)))
			   (if (eq? val (obj 'false))
			       #f
			       (or val (obj 'not-a-key)))))
       'hash-table-key? (lambda (obj key)
			  (#_hash-table-ref (obj 'mock-hash-table-table) key)))))
  
  (define* (make-gloomy-hash-table (len 511) not-a-key)
    (let ((ht (copy gloomy-hash-table)))
      (set! (ht 'mock-hash-table-table) (make-hash-table len))
      (set! (ht 'not-a-key) not-a-key)
      ht))
  
  (define (hash-table-key? obj key) ((obj 'hash-table-key?) obj key))
  
  (let ((ht (make-gloomy-hash-table :not-a-key 'nope)))
    (test (hash-table-key? ht 'a) #f)
    (test (hash-table-ref ht 'a) 'nope)
    (hash-table-set! ht 'a 1)
    (test (not (hash-table-key? ht 'a)) #f)
    (test (ht 'a) 1))


  (let ((s ((*mock-string* 'mock-string) #\a #\b #\c)))
    (test (length s) 3)
    (test (string-length s) 3)
    (test (string? s) #t)
    (test (morally-equal? s "abc") #t)
    (test ((*mock-string* 'mock-string?) s) #t)
    (test (append "asd" ((*mock-string* 'mock-string) "hi")) "asdhi")
    (test ((*mock-vector* 'mock-vector?) s) #f)
    (test (string-ref s 0) #\a)
    (test (string-set! s 0 #\A) #\A)
    (test (s 0) #\A)
    (test (set! (s 1) #\B) #\B)
    (test (s 1) #\B)
    (test (string->list s) '(#\A #\B #\c))
    (test (string-append s "d") "ABcd")
    (test (string-append "d" s "e") "dABce")
    (test (string-append "d" "f" s) "dfABc")
    (test (string-append "d" "f" s "gh") "dfABcgh")
    (test (reverse s) "cBA")
    (test (copy s) "ABc")
    (test (string-copy s) "ABc")
    (test (object->string s) "\"ABc\"")
    (test (string=? s "ABc") #t)
    (test (string=? "ABc" s) #t)
    (test (string=? s "ABC") #f)
    (test (substring s 0 1) "A")
    (test (string-downcase s) "abc")
    (test (string-upcase s) "ABC")
    (test (string->symbol s) 'ABc)
    (test (gensym? (gensym s)) #t)
    (test (string->keyword s) :ABc)
    (test (map values s) '(#\A #\B #\c))
    (test (string>? s "ABC") #t)
    (test (string-ci>? s "ABC") #f)
    (test (string<? s "ABC") #f)
    (test (string-ci<=? s "ABC") #t)
    (test (string>=? s "ABC") #t)
    (test (string-ci>=? s "ABC") #t)
    (test (string<=? s "ABC") #f)
    (test (string-ci<=? s "ABC") #t)
    (test (call-with-input-string s read) 'ABc)
    (test (with-input-from-string s read) 'ABc)
    (test (let ((p (open-input-string s))) (let ((r (read p))) (close-input-port p) r)) 'ABc)
    (unless pure-s7
      (string-fill! s #\1)
      (test (s 0) #\1)
      (test (string->number s) 111))
    (fill! s #\2)
    (test (s 1) #\2)
    (for-each (lambda (c) (if (not (char=? c #\2)) (format *stderr* ";fill! mock-string: ~C~%" c))) s)
    (test (format #f s) "222")
    (test (format #f "~A" s) "222")
    (test (format s) "222")
    (test (eval-string s) 222)
    (test (string-position "2" s) 0)
    (test (string->byte-vector s) #u8(50 50 50)))

  (let ((c ((*mock-char* 'mock-char) #\a)))
    (test (char? c) #t)
    (test ((*mock-char* 'mock-char?) c) #t)
    (test (morally-equal? c #\a) #t)
    (test (char-upcase c) #\A)
    (test (char-downcase c) #\a)
    (test (char->integer c) 97)
    (test (char-upper-case? c) #f)
    (test (char-lower-case? c) #t)
    (test (char-alphabetic? c) #t)
    (test (char-numeric? c) #f)
    (test (char-whitespace? c) #f)
    (test (char=? c #\A) #f)
    (test (char=? c #\a) #t)
    (test (char<? c #\b) #t)
    (test (char<=? c #\b) #t)
    (test (char>? c #\b) #f)
    (test (char>=? c #\b) #f)
    (test (char-ci=? c #\A) #t)
    (test (char-ci=? c #\a) #t)
    (test (char-ci<? c #\b) #t)
    (test (char-ci<=? c #\b) #t)
    (test (char-ci>? c #\b) #f)
    (test (char-ci>=? c #\b) #f)
    (test (char-position c "abc") 0)
    (test (char-position ((*mock-char* 'mock-char) #\b) "hoho" 63) #f)
    (test (char-position #\null "hoho" ((*mock-char* 'mock-char) #\b)) 'error)
    (test (char-position ((*mock-char* 'mock-char) #\null) "hoho" ((*mock-char* 'mock-char) #\b)) 'error)
    (test (object->string c #f) "a")
    (test (copy c) #\a)
    (test (string c #\b) "ab")
    (test (string #\c c) "ca")
    (test (string #\a c c #\b) "aaab")
    (test (format #f "~C" c) (format #f "~C" (c 'value)))
    (let ((str "0123"))
      (string-set! str 1 c)
      (test str "0a23"))
    )

  (let ((mock-number (*mock-number* 'mock-number))
	(mock-number? (*mock-number* 'mock-number?)))
    (let ((i (mock-number 32))
	  (x (mock-number pi))
	  (z (mock-number 1+i))
	  (r (mock-number 3/2)))
      (let ((nums (list i r x z))
	    (rnums (list i r x)))
	(define (practically-equal? tst l1 l2)
	  (call-with-exit
	   (lambda (quit)
	     (for-each (lambda (n1 n2)
			 (when (not (number-ok? tst n1 n2))
			   (format *stderr* ";~S: ~A ~A~%" tst n1 n2)
			   (quit #f)))
		       l1 l2)
	     #t)))
	(test (map mock-number? nums) '(#t #t #t #t))
	(test (morally-equal? i 32) #t)
	(if with-bignums
	    (test (map object->string nums) '("32" "3/2" "3.141592653589793238462643383279502884195E0" "1+1i"))
	    (test (map object->string nums) '("32" "3/2" "3.141592653589793" "1+1i")))
	(test (map copy nums) (list 32 3/2 pi 1+1i))
	(test (practically-equal? 'real-part (map real-part nums) (list 32 3/2 pi 1.0)) #t)
	(test (map imag-part nums) '(0 0 0.0 1.0))
	(test (numerator i) 32)
	(test (numerator r) 3)
	(test (denominator i) 1)
	(test (denominator r) 2)
	(test (even? i) #t)
	(test (odd? i) #f)
	(test (map zero? nums) '(#f #f #f #f))
	(test (map positive? rnums) '(#t #t #t))
	(test (map negative? rnums) '(#f #f #f))
	(test (map infinite? nums) '(#f #f #f #f))
	(test (map nan? nums) '(#f #f #f #f))
	(num-test (make-polar i r) (make-polar 32 3/2))
	(num-test (make-polar x i) (make-polar pi 32))
	(num-test (complex i r) (complex 32 3/2))
	(test (practically-equal? 'magnitude (map magnitude nums) (list 32 3/2 pi (sqrt 2))) #t)
	(test (practically-equal? 'angle (map angle nums) '(0 0 0.0 0.7853981633974483)) #t)
	(num-test (rationalize x) (rationalize pi))

	(test (practically-equal? 'abs (map abs rnums) '(32 3/2 3.141592653589793)) #t)
	(test (practically-equal? 'exp (map exp nums) '(78962960182680.69 4.481689070338065 23.14069263277927 1.468693939915885+2.287355287178842i)) #t)
	(test (practically-equal? 'log (map log nums) '(3.465735902799727 0.4054651081081644 1.1447298858494 0.3465735902799727+0.7853981633974483i)) #t)
	(test (practically-equal? 'sin (map sin nums) '(0.5514266812416906 0.9974949866040544 1.224646799147353e-16 1.298457581415977+0.6349639147847361i)) #t)
	(test (practically-equal? 'cos (map cos nums) '(0.8342233605065102 0.07073720166770291 -1.0 0.8337300251311491-0.9888977057628651i)) #t)
	(test (practically-equal? 'tan (map tan nums) '(0.6610060414837631 14.10141994717172 -1.224646799147353e-16 0.2717525853195117+1.083923327338695i)) #t)
	(test (practically-equal? 'asin (map asin nums) '(1.570796326794897-4.158638853279167i 1.570796326794897-0.9624236501192069i 
							  1.570796326794897-1.811526272460853i 0.6662394324925153+1.061275061905036i)) #t)
	(test (practically-equal? 'acos (map acos nums) '(0+4.158638853279167i 0+0.9624236501192069i 0+1.811526272460853i 0.9045568943023813-1.061275061905036i)) #t)
	(test (practically-equal? 'atan (map atan nums) '(1.539556493364628 0.9827937232473291 1.262627255678912 1.017221967897851+0.4023594781085251i)) #t)
	(test (practically-equal? 'sinh (map sinh nums) '(39481480091340.34 2.129279455094817 11.54873935725775 0.6349639147847361+1.298457581415977i)) #t)
	(test (practically-equal? 'cosh (map cosh nums) '(39481480091340.34 2.352409615243247 11.59195327552152 0.8337300251311491+0.9888977057628651i)) #t)
	(test (practically-equal? 'tanh (map tanh nums) '(1.0 0.9051482536448664 0.99627207622075 1.083923327338695+0.2717525853195117i)) #t)
	(test (practically-equal? 'asinh (map asinh nums) '(4.15912713462618 1.194763217287109 1.862295743310848 1.061275061905036+0.6662394324925153i)) #t)
	(test (practically-equal? 'acosh (map acosh nums) '(4.158638853279167 0.9624236501192069 1.811526272460853 1.061275061905036+0.9045568943023813i)) #t)
	(test (practically-equal? 'atanh (map atanh nums) '(0.03126017849066698+1.570796326794897i 0.8047189562170503+1.570796326794897i 
                                                            0.3297653149566991+1.570796326794897i 0.4023594781085251+1.017221967897851i)) #t)
	(test (practically-equal? 'sqrt (map sqrt nums) '(5.656854249492381 1.224744871391589 1.772453850905516 1.09868411346781+0.4550898605622273i)) #t)
	(test (practically-equal? 'expt (map (lambda (n) (expt n 2)) nums) '(1024 9/4 9.869604401089358 1.224606353822377e-16+2i)) #t)
	(test (practically-equal? 'expt (map (lambda (n) (expt n r)) nums) '(181.0193359837562 1.837117307087384 5.568327996831708 
                                                                             0.6435942529055828+1.553773974030037i)) #t)
	(test (map floor rnums) '(32 1 3))
	(test (map ceiling rnums) '(32 2 4))
	(test (map truncate rnums) '(32 1 3))
	(test (map round rnums) '(32 2 3))
	(test (integer->char (mock-number (char->integer #\a))) #\a)
	(test (practically-equal? 'exact->inexact (map exact->inexact rnums) '(32.0 1.5 3.141592653589793)) #t)
	(test (integer-length i) 6)
	(test (integer-decode-float x) '(7074237752028440 -51 1))
	(test (map number? nums) '(#t #t #t #t))
	(test (map integer? nums) '(#t #f #f #f))
	(test (map real? nums) '(#t #t #t #f))
	(test (map complex? nums) '(#t #t #t #t))
	(test (map rational? nums) '(#t #t #f #f))
	(unless pure-s7 
	  (test (map inexact->exact rnums) '(32 3/2 4272943/1360120))
	  (test (map exact? nums) '(#t #t #f #f))
	  (test (map inexact? nums) '(#f #f #t #t)))

	(test (ash 1 i) 4294967296)
	(test (ash i -3) 4)
	(test (logbit? i 1) #f)
	(test (logbit? 1 i) #f)
	(if with-bignums
	    (test (map number->string nums) '("32" "3/2" "3.141592653589793238462643383279502884195E0" "1+1i"))
	    (test (map number->string nums) '("32" "3/2" "3.141592653589793" "1+1i")))
	(test (every? number? (map random nums)) #t)
	(test (quotient i r) 21)
	(test (remainder i r) 1/2)
	(test (modulo i r) 1/2)
	(test (lognot i) -33)
	(test (logior i 2) 34)
	(test (logior 1 i 2 3) (logior 1 32 2 3))
	(test (logior 1 7 i 62) (logior 1 7 32 62))
	(test (logior (mock-number 1) (mock-number 8) 2 4 16 (mock-number 32)) 63)
	(test (logxor (mock-number 1) (mock-number 7) 2 4 16 (mock-number 32)) (logxor 1 7 2 4 16 32))
	(test (logand 63 15 31 127) (logand 63 (mock-number 15) (mock-number 31) 127))
	(num-test (apply + nums) 37.6415926535898+1i)
	(num-test (apply - nums) 26.35840734641021-1i)
	(num-test (apply * nums) 150.7964473723101+150.7964473723101i)
	(num-test (apply / nums) 3.3953054526271-3.3953054526271i)
	(num-test (apply max rnums) 32)
	(num-test (apply min rnums) 3/2)
	(num-test (min 65 i) 32)
	(test (apply < rnums) #f)
	(test (apply > rnums) #f)
	(test (apply <= rnums) #f)
	(test (apply >= rnums) #f)
	(test (< 1 3 i 47) #t)
	(test (> 5/2 r 1/2 (/ i 100)) #t)
	(test (<= 1.0 2.0 3.0 x) #t)
	(test (>= 101.231 i 4 x 5/2 r) #t)
	(test (> x z) 'error)
	(test (> i 0) #t)
	(test (< 0 i) #t)
	(test (>= x 0.0) #t)
	(test (<= 0.0 x) #t)
	(test (apply = nums) #f)
	(test (= i 32) #t)
	(test (= 33 i) #f)
	(test (= r 1/2) #f)
	(test (lcm i 3/2) (lcm i r))
	(test (lcm 3/2 i) (lcm r i))
	(test (lcm 33 2 i) (lcm 2 i 33))
	(test (lcm 33 x) 'error)
	(test (apply lcm nums) 'error)
	(test (lcm i 0 x) 'error)
	(test (lcm 9 0 r) 0)
	(test (gcd i 3/2) (gcd i r))
	(test (gcd i 3/2) (gcd 32 3/2))
	(test (gcd 3/2 i) (gcd r i))
	(test (gcd 33 2 i) (gcd 2 i 33))
	(test (gcd 33 x) 'error)
	(test (apply gcd nums) 'error)
	(test (gcd i 0 x) 'error)
	(test (gcd 9 0 r) 3/2)

	(test (format #f "~D" ((*mock-number* 'mock-number) 123)) "123")
	(test (format #f "~F" ((*mock-number* 'mock-number) 1.23)) (format #f "~F" 1.23))
	(test (format #f "~A" r) "3/2")

	(let ((index (mock-number 2))
	      (v #(0 1 2 3 4))
	      (s "01234")
	      (p (list 0 1 2 3 4)))
	  (test (string-ref s index) #\2)
	  (test (list-ref p index) 2)
	  (test (vector-ref v index) 2)
	  (test (s index) #\2)
	  (test (p index) 2)
	  (test (v index) 2)
	  (test (make-shared-vector #(0 1 2 3) '(3) (mock-number 1)) #(1 2 3))
	  (test (vector->list #(0 1 2 3 4) (mock-number 1) (mock-number 3)) '(1 2))
	  (test (list-tail p index) '(2 3 4))
	  (test (substring "01234" index) "234")
	  (test (substring "01234" 0 index) "01")
	  (test (substring "01234" index (mock-number 3)) "2")
	  (test (vector->list #(0 1 2 3 4) index) '(2 3 4))
	  (test (vector->list #(0 1 2 3 4) index index) ())
	  (test (string->list "01234" index) '(#\2 #\3 #\4))
	  (test (string->list "01234" 0 index) '(#\0 #\1))
	  (test (let ((dest (make-string 3))) (copy "01234" dest index) dest) "234")
	  (test (let ((dest (make-string 2))) (copy "01234" dest 0 index) dest) "01")
	  (unless pure-s7 (test (let ((str "01234")) (string-fill! str #\a index) str) "01aaa"))
	  (unless pure-s7 (test (let ((vec #(0 1 2 3 4))) (vector-fill! vec 5 (mock-number 0) (mock-number 3)) vec) #(5 5 5 3 4)))
	  (test (let ((vec #2D((0 1 2) (3 4 5)))) (vector-ref vec (mock-number 1) index)) 5)
	  )
	(test (let ((vec ((*mock-vector* 'mock-vector) 10 11 12))) (vec ((*mock-number* 'mock-number) 1))) 11)

	(test (vector? (make-vector i)) #t)
	(test (string? (make-string i)) #t)
	(test (hash-table? (make-hash-table i)) #t)
	(test (pair? (make-list i)) #t)

	(define (p1-check . args)
	  (if (> (magnitude (- (apply * args) 0.25+0.25i)) 1e-15)
	      (format #t "~A: (* ~{~A~^ ~}) -> ~A?~%" (port-line-number) args (apply * args)))
	  (if (not (= (apply + args) 3+i))
	      (format #t "~A: (+ ~{~A~^ ~}) -> ~A?~%" (port-line-number) args (apply + args)))
	  (if (not (= (apply - args) (- (car args) (apply + (cdr args)))))
	      (format #t "~A: ~A != ~A?~%" (port-line-number) (apply - args) (- (car args) (apply + (cdr args)))))
	  (if (not (= (apply / args) (/ (car args) (apply * (cdr args)))))
	      (format #t "~A: ~A != ~A?~%" (port-line-number) (apply / args) (/ (car args) (apply * (cdr args))))))

	(for-each
	 (lambda (lst)
	   (for-each-permutation p1-check lst))
	 (list
	  (list 1 1/2 0.5 1+i)
	  (list (mock-number 1) 1/2 0.5 1+i)
	  (list 1 (mock-number 1/2) 0.5 1+i)
	  (list 1 1/2 (mock-number 0.5) 1+i)
	  (list 1 1/2 0.5 (mock-number 1+i))
	  (list (mock-number 1)
		(mock-number 1/2)
		(mock-number 0.5)
		(mock-number 1+i))))
	)))

  (let ()
    (let ((lst '(1 2 3)))
      (list-set! lst ((inlet 'i 2) 'i) 32)
      (test lst '(1 2 32)))
    (let ((lst '((1 2 3))))
      (list-set! lst 0 ((inlet 'i 2) 'i) 32)
      (test lst '((1 2 32))))
    (let ((lst '((1 2 3))))
      (list-set! lst ((inlet 'i 0) 'i) ((inlet 'i 2) 'i) 32) 
      (test lst '((1 2 32))))
    (let ((i0 ((*mock-number* 'mock-number) 0))
	  (i1 ((*mock-number* 'mock-number) 1))
	  (i2 ((*mock-number* 'mock-number) 2))
	  (lst '((0 1 2) (3 4 5))))
      (list-set! lst i0 i1 32)
      (test lst '((0 32 2) (3 4 5))))
    (let ((i0 (openlet (inlet 'i 0 'list-set! (lambda (l . args) (apply #_list-set! l ((car args) 'i) (cdr args))))))
	  (i1 (openlet (inlet 'i 1 'list-set! (lambda (l . args) (apply #_list-set! l ((car args) 'i) (cdr args))))))
	  (i2 (openlet (inlet 'i 2 'list-set! (lambda (l . args) (apply #_list-set! l ((car args) 'i) (cdr args))))))
	  (lst '((0 1 2) (3 4 5))))
      (list-set! lst i0 i1 32)
      (test lst '((0 32 2) (3 4 5)))))

  (let ((mock-pair (*mock-pair* 'mock-pair))
	(mock-pair? (*mock-pair* 'mock-pair?)))
    (let ((lst (mock-pair 1 2 3)))
      
      (test (pair? lst) #t)
      (test (mock-pair? lst) #t)
      (test (morally-equal? (list 1 2 3) lst) #t)
      (test (morally-equal? lst (mock-pair 1 2 3)) #t)
      ;(test (integer? (pair-line-number lst)) #t)
      (unless pure-s7 (test (list->string (mock-pair #\a #\b #\c)) "abc"))
      (test (object->string lst) "(1 2 3)")
      (test (list? lst) #t)
      (test (null? lst) #f)
      (test (car lst) 1)
      (test (cdr lst) '(2 3))
      (test (length lst) 3)
      (test (arity lst) (cons 1 1))
      (test (reverse lst) '(3 2 1))
      (unless pure-s7 (test (list->vector lst) #(1 2 3)))
      (test (map values lst) '(1 2 3))
      (test (memq 2 lst) '(2 3))
      (test (memv 3 lst) '(3))
      (test (member 1 lst) '(1 2 3))
      (test (list-tail lst 1) '(2 3))
      (test (cadr lst) 2)
      (test (caddr lst) 3)
      (test (cddr lst) '(3))
      (test (cdddr lst) ())
      (test (list-ref lst 1) 2)
      (set-car! lst 4)
      (test (car lst) 4)
      (list-set! lst 2 32)
      (test (caddr lst) 32)
      (set-cdr! lst ())
      (test (length lst) 1)
      (set! lst (apply mock-pair '((a . 1) (b . 2) (c . 3))))
      (test (assq 'a lst) '(a . 1))
      (test (assv 'b lst) '(b . 2))
      (test (assoc 'c lst) '(c . 3))
      (fill! lst 1)
      (test (car lst) 1)
      (set! lst (mock-pair 1 2 3))
      (reverse! lst)
      (test (copy lst) '(3 2 1))
      (set! lst (apply mock-pair (sort! lst <)))
      (test (copy lst) '(1 2 3))
      (set! (lst 0) 4)
      (test (lst 0) 4)
      (test (list-tail lst 0) '(4 2 3))
      (for-each (lambda (x) (if (not (integer? x)) (format *stderr* ";for-each mock-pair: ~A~%" x))) (mock-pair 1 2 3))
      (test (make-shared-vector #(0 1 2 3) (mock-pair 2)) #(0 1))
      (test (caar (apply mock-pair '((a) b c d e f g))) 'a)
      (test (cadr (apply mock-pair '(a b c d e f g))) 'b)
      (test (cdar (apply mock-pair '((a b) c d e f g))) '(b))
      (test (cddr (apply mock-pair '(a b c d e f g))) '(c d e f g))
      (test (caaar (apply mock-pair '(((a)) b c d e f g))) 'a)
      (test (caadr (apply mock-pair '(a (b) c d e f g))) 'b)
      (test (cadar (apply mock-pair '((a b) c d e f g))) 'b)
      (test (caddr (apply mock-pair '(a b c d e f g))) 'c)
      (test (cdaar (apply mock-pair '(((a b)) c d e f g))) '(b))
      (test (cdadr (apply mock-pair '(a (b c) d e f g))) '(c))
      (test (cddar (apply mock-pair '((a b c) d e f g))) '(c))
      (test (cdddr (apply mock-pair '(a b c d e f g))) '(d e f g))
      (test (caaaar (apply mock-pair '((((a))) b c d e f g))) 'a)
      (test (caaadr (apply mock-pair '(a ((b)) c d e f g))) 'b)
      (test (caadar (apply mock-pair '((a (b)) c d e f g))) 'b)
      (test (caaddr (apply mock-pair '(a b (c) d e f g))) 'c)
      (test (cadaar (apply mock-pair '(((a b)) c d e f g))) 'b)
      (test (cadadr (apply mock-pair '(a (b c) d e f g))) 'c)
      (test (caddar (apply mock-pair '((a b c) d e f g))) 'c)
      (test (cadddr (apply mock-pair '(a b c d e f g))) 'd)
      (test (cdaaar (apply mock-pair '((((a b))) c d e f g))) '(b))
      (test (cdaadr (apply mock-pair '(a ((b c)) d e f g))) '(c))
      (test (cdadar (apply mock-pair '((a (b c)) d e f g))) '(c))
      (test (cdaddr (apply mock-pair '(a b (c d) e f g))) '(d))
      (test (cddaar (apply mock-pair '(((a b c)) d e f g))) '(c))
      (test (cddadr (apply mock-pair '(a (b c d) e f g))) '(d))
      (test (cdddar (apply mock-pair '((a b c d) e f g))) '(d))
      (test (cddddr (apply mock-pair '(a b c d e f g))) '(e f g))
      (test (cyclic-sequences (mock-pair 1 2 3)) ())
      (test (let ((y (mock-pair (make-circular-list 3)))) (let ((x (cyclic-sequences y))) (length x))) 1)
      (test (subsequence ((*mock-pair* 'mock-pair) 1 2 3 4) 2) '(3 4))
      ))
  
;  (test (let ((lst ((*mock-pair* 'mock-pair) 1 2 3))) (append lst '(4 5 6))) '(1 2 3 4 5 6))
;  (test (let ((lst ((*mock-pair* 'mock-pair) 1 2 3))) (append '(4 5 6) lst ())) '(4 5 6 1 2 3))
;  (test (let ((lst ((*mock-pair* 'mock-pair) 1 2 3))) (append '(4 5 6) lst)) '(4 5 6 1 2 3))
  (test (sort! 'begin ((*mock-pair* 'mock-pair) 1 2)) 'error)

  (let ((immutable-list-class 
	 (sublet (*mock-pair* 'mock-pair-class)
	   'object->string   (lambda (obj . args) 
			       (apply #_object->string (obj 'value) args))
	   'let-set-fallback (lambda (obj i val) 
			       (set! (obj 'value) (append (copy (obj 'value) (make-list (+ i 1))) (list-tail (obj 'value) (+ i 1))))
			       (list-set! (obj 'value) i val))
	   'list-set!        (lambda (obj i val) 
			       (set! (obj 'value) (append (copy (obj 'value) (make-list (+ i 1))) (list-tail (obj 'value) (+ i 1))))
			       (list-set! (obj 'value) i val))
	   'set-car!         (lambda (obj val) 
			       (set! (obj 'value) (cons val (cdr (obj 'value)))))
	   'set-cdr!         (lambda (obj val) 
			       (set! (obj 'value) (cons (car (obj 'value)) val)))
	   'fill!            (lambda (obj val) 
			       (set! (obj 'value) (fill! (copy (obj 'value)) val)))
	   'reverse!         (lambda (obj) 
			       (set! (obj 'value) (reverse (obj 'value))))
	   'sort!            (lambda (obj func) 
			       (set! (obj 'value) (sort! (copy (obj 'value)) func))))))
    
    (define (immutable-list lst)
      (openlet 
       (sublet immutable-list-class
	 'value lst)))
    
    (let ((L1 (immutable-list (list 1 2 3 4 5))))
      (let ((L2 (cdr L1))
	    (L3 (cons 0 (L1 'value))))
	(list-set! L1 0 32)
	(test (L1 'value) '(32 2 3 4 5))
	(test L2 '(2 3 4 5))
	(test L3 '(0 1 2 3 4 5))
	(set! (L1 2) 32)
	(test (L1 'value) '(32 2 32 4 5))
	(test L2 '(2 3 4 5))
	(test L3 '(0 1 2 3 4 5))
	(set-cdr! L1 3)
	(test (L1 'value) '(32 . 3))
	(test L2 '(2 3 4 5))
	(set! L1 (immutable-list (list 1 2 3 4 5)))
	(set! L2 (cddr L1))
	(set! L3 (cons 0 (L1 'value)))
	(sort! L1 >)
	(test (L1 'value) '(5 4 3 2 1))
	(test L2 '(3 4 5))
	(test L3 '(0 1 2 3 4 5))
	(reverse! L1)
	(test (L1 'value) '(1 2 3 4 5))
	(test L2 '(3 4 5))
	(test (object->string L1) "(1 2 3 4 5)")
	)))

  (let ((mock-symbol (*mock-symbol* 'mock-symbol))
	(mock-symbol? (*mock-symbol* 'mock-symbol?)))
    (let ((sym (mock-symbol 'a)))
      (test (symbol? sym) #t)
      (test (mock-symbol? sym) #t)
      (test (morally-equal? sym 'a) #t)
      (test (keyword? sym) #f)
      (test (gensym? sym) #f)
      (test (symbol->string sym) "a")
      (let ((a 32))
	(test (let ((a 32)) (symbol->value sym (curlet))) 32)
	(test (symbol->dynamic-value sym) 32)
	(test (defined? sym) #t)
	(test (symbol->keyword sym) :a)
	(test (provided? sym) #f)
	(test (symbol-setter sym) #f)))
    (let ((sym (mock-symbol :a)))
      (test (keyword? sym) #t)
      (test (keyword->symbol sym) 'a))
    (let () 
      (define* (f1 a b) (+ a b)) 
      (test (f1 (mock-symbol :a) 3 :b 2) 5)))

  (let ((mock-port (*mock-port* 'mock-port))
	(mock-port? (*mock-port* 'mock-port?)))
    (let ((ip (open-input-string "0123456789"))
	  (op (open-output-string)))
      (let ((mip (mock-port ip))
	    (mop (mock-port op)))
	(test (mock-port? mip) #t)
	(test (mock-port? ip) #f)
	(test (mock-port? mop) #t)
	(test (input-port? mip) #t)
	(test (output-port? mip) #f)
	(test (input-port? mop) #f)
	(test (output-port? mop) #t)
	(if (not pure-s7) (test (char-ready? mip) #t))
	(test (char-ready? mop) 'error)
	(test (port-closed? mip) #f)
	(test (port-closed? mop) #f)
;	(test (port-line-number mip) 0) ; ??
	(test (port-filename mip) "")
	(test (read-char mip) #\0)
	(test (read-byte mip) (char->integer #\1))
	(test (peek-char mip) #\2)
	(test (read-string 3 mip) "234")
	(test (read-line mip) "56789")
	(close-input-port mip)
	(test (port-closed? mip) #t)
	(test (port-closed? ip) #t)
	(write-char #\a mop)
	(test (get-output-string mop) "a")
	(write-byte (char->integer #\b) mop)
	(test (get-output-string mop) "ab")
	(write-string "cde" mop)
	(test (get-output-string mop) "abcde")
	(display #\f mop)
	(write 'g mop)
	(test (get-output-string mop) "abcdefg")
	(format mop "~C~C" #\h #\i)
	(test (get-output-string mop) "abcdefghi")
	(test (flush-output-port mop) op)
	(close-output-port mop)
	(test (port-closed? mop) #t)
	(test (port-closed? op) #t)
	(set! mip (mock-port (open-input-string "(+ 1 2)")))
	(test (eval (read mip)) 3)
	(close-input-port mip)
	)))

  ) ; mockery.scm

;(let () (define (f1) (with-let (inlet '+ (lambda args (apply * args))) (+ 1 2 3 4))) (test (with-let (inlet '+ (lambda args (apply * args))) (+ 1 2 3 4)) (f1)))
;as elsewhere stated, this is documented -- not sure it needs to be fixed

(when (and (not with-bignums)
	   (not pure-s7))
  (let ()
    (require stuff.scm mockery.scm)
    (define (write-func1 port name expr c method)
      (format port "(define (~A x) ~S)~%" name expr)
      (format port "(let ((val1 (~A ~S))~%" name c)
      (format port "      (val2 (let ((x ~S)) ~S)))~%" c expr)
      (format port "  (let ((val3 (~A (make-object 'x ~S '~A (make-method ~A (lambda (e) (e 'x)))))))~%" name c method method)
      (format port "    (if (or (not (morally-equal? val1 val2))~%")
      (format port "            (not (morally-equal? val2 val3)))~%")
      (format port "        (format *stderr* \"~A: opt ~~A, unopt ~~A, env ~~A~~%\" val1 val2 val3))))~%~%" name))
    
    (define* (write-func2 port name expr c1 c2 method method2)
      (format port "(define (~A x y) ~S)~%" name expr)
      (format port "(let ((val1 (~A ~S ~S))~%" name c1 c2)
      (format port "      (val2 (let ((x ~S) (y ~S)) ~S)))~%" c1 c2 expr)
      (format port "  (let ((val3 (~A (make-object 'x ~S '~A (make-method ~A (lambda (e) (e 'x))))~%" name c1 method method)
      (format port "                    (make-object 'y ~S '~A (make-method ~A (lambda (e) (e 'y)))))))~%" c2 (or method2 method) (or method2 method))
      (format port "    (let ((val4 (~A ~S (make-object 'y ~S '~A (make-method ~A (lambda (e) (e 'y)))))))~%" name c1 c2 (or method2 method) (or method2 method))
      (format port "      (let ((val5 (~A (make-object 'x ~S '~A (make-method ~A (lambda (e) (e 'x)))) ~S)))~%" name c1 method method c2)
      (format port "        (if (or (not (morally-equal? val1 val2))~%")
      (format port "                (not (morally-equal? val2 val3))~%")
      (format port "                (not (morally-equal? val3 val4))~%")
      (format port "                (not (morally-equal? val4 val5)))~%")
      (format port "        (format *stderr* \"~A: opt ~~A, unopt ~~A, exy ~~A, ecy ~~A, exc ~~A~~%\" val1 val2 val3 val4 val5))))))~%~%" name))
    
    (call-with-output-file
	"t923.scm"
      (lambda (p)
	(format p "(require stuff.scm)~%~%")
	(format p "(let ()~%")
	(write-func1 p "+_1s" '(+ 1 x) 3 '+)
	(write-func1 p "+_s1" '(+ x 1) 3 '+)
	(write-func1 p "+_s12" '(+ (+ x) 1) 3 '+)
	(write-func1 p "+_sf" '(+ x 2.0) 3 '+)
	(write-func1 p "+_fs" '(+ 2.0 x) 3 '+)
	(write-func2 p "+_xy" '(+ x y) 3 4 '+)
	(write-func2 p "+_xy1" '(+ 5 x y) 3 4 '+)
	(write-func2 p "+_xy2" '(+ 5 3 x 2 y) 3 4 '+)
	
	(write-func1 p "-_s1" '(- x 1) 3 '-)
	(write-func1 p "-_s1" '(- x 6) 3 '-)
	(write-func1 p "-_s1" '(- (- x) 1) 3 '-)
	(write-func1 p "-_1s" '(- 1 x) 3 '-)
	(write-func1 p "-_sf" '(- x 2.0) 3 '-)
	(write-func1 p "-_fs" '(- 2.0 x) 3 '-)
	(write-func2 p "-_xy" '(- x y) 3 4 '-)
	
	(write-func1 p "*_s" '(* x) 3 '*)
	(write-func1 p "*_2s" '(* 2 x) 3 '*)
	(write-func1 p "*_s2" '(* x 2) 3 '*)
	(write-func1 p "*_sf" '(* x 2.0) 3 '*)
	(write-func1 p "*_fs" '(* 2.0 x) 3 '*)
	(write-func1 p "*_xx" '(* x x) 3 '*)
	(write-func1 p "*_xnk" '(+ (* x 2) 3) 3 '*)
	(write-func1 p "-_fss" '(- 2.0 (* x x)) 3 '*)
	(write-func2 p "*_xy" '(* x y) 3 4 '*)
	(write-func2 p "*1xy" '(* (- 1.0 x) y) 3.0 4 '- '*)
	(write-func2 p "r2cos" '(* -2.0 x (cos y)) 3.0 1.8 '* 'cos)
	(write-func1 p "fsf" '(+ 3.5 (* x 4.5)) 5.0 '*)
	
	(write-func1 p "/_s" '(/ x) 3 '/)
	(write-func1 p "/_1s" '(/ 1 x) 3 '/)
	(write-func1 p "/_1.0s" '(/ 1.0 x) 3 '/)
	(write-func1 p "/_2s" '(/ 2 x) 3 '/)
	(write-func1 p "/_s2" '(/ x 2) 3 '/)
	(write-func1 p "/_sf" '(/ x 2.0) 3 '/)
	(write-func1 p "/_fs" '(/ 2.0 x) 3 '/)
	(write-func2 p "/_xy" '(/ x y) 3 4 '/)
	
	(write-func2 p "s_cos_s" '(* x (cos y)) 3.1 1.8 '* 'cos)
	(write-func2 p "s_sin_s" '(* x (sin y)) 3.1 1.8 '* 'sin)
	
	(write-func1 p "min_2f" '(min x 1.0) 3.1 'min)
	(write-func1 p "max_2f" '(max 1.0 x) 3.1 'max)
	(write-func1 p "min_2f1" '(min x 1.0) 3.1 'min)
	(write-func1 p "max_2f1" '(max 1.0 x) 3.1 'max)
	(write-func1 p "modsi0" '(zero? (modulo x 3)) 5 'modulo)
	(write-func1 p "neglen" '(negative? (length x)) #(0 1) 'length)
	(write-func1 p "eqzlen" '(= (length x) 0) #() 'length)
	(write-func1 p "zlen" '(zero? (length x)) #() 'length)
	
	(write-func1 p "=x" '(= x 1) 1 '=)
	(write-func1 p "<x" '(< x 1) 1 '<)
	(write-func1 p "<=x" '(<= x 1) 1 '<=)
	(write-func1 p ">=x" '(>= x 1) 1 '>=)
	(write-func1 p ">x" '(> x 1) 1 '>)
	
	(write-func1 p "=len" '(= (length x) 6) #(0 1 2 3 4 5) 'length)
	(write-func1 p "<len" '(< (length x) 6) #(0 1 2 3 4 5) 'length)
	(write-func1 p ">len" '(> (length x) 6) #(0 1 2 3 4 5) 'length)
	(write-func1 p "<=len" '(<= (length x) 6) #(0 1 2 3 4 5 ) 'length)
	(write-func1 p "<=len" '(<= (length x) 6) #(0 1 2 3 4 5) 'length)
	(write-func1 p ">=len" '(>= (length x) 6) #(0 1 2 3 4 5) 'length)
	
	(for-each ; ints
	 (lambda (f1)
	   (write-func1 p (string-append (symbol->string f1) "_si") `(,f1 x) -3 f1))
	 (list 'real-part 'imag-part 'numerator 'denominator 'even? 'odd? 'zero? 'positive? 'negative? 'infinite? 'nan?
	       'magnitude 'angle 'rationalize 'abs 'exp 'log 'sin 'cos 'tan 'asin 'acos 'atan 'sinh 'cosh 'tanh 'asinh 'acosh 'atanh 'sqrt
	       'floor 'ceiling 'truncate 'round 'inexact->exact 'exact->inexact 'integer-length 'logior 'logxor 'logand 'lognot
	       'number? 'integer? 'real? 'complex? 'rational? 'exact? 'inexact? 'number->string))
	
	(for-each ; reals
	 (lambda (f1)
	   (write-func1 p (string-append (symbol->string f1) "_sf") `(,f1 x) 3.14 f1))
	 (list 'real-part 'imag-part 'zero? 'positive? 'negative? 'infinite? 'nan?
	       'magnitude 'angle 'rationalize 'abs 'exp 'log 'sin 'cos 'tan 'asin 'acos 'atan 'sinh 'cosh 'tanh 'asinh 'acosh 'atanh 'sqrt
	       'floor 'ceiling 'truncate 'round 'inexact->exact 'exact->inexact 'integer-decode-float
	       'number? 'integer? 'real? 'complex? 'rational? 'exact? 'inexact? 'number->string))
	
	(for-each
	 (lambda (f1)
	   (write-func1 p (string-append (symbol->string f1) "_si") `(,f1 x 3) 4 f1))
	 (list 'log 'logior 'logxor 'logand 'modulo 'remainder 'quotient 'max 'min 'lcm 'gcd 'expt 'ash))
	
	(for-each
	 (lambda (f1)
	   (write-func2 p (string-append (symbol->string f1) "_xy") `(,f1 x y) 3 4 f1))
	 (list 'make-polar 'complex 'expt 'lcm 'gcd 'max 'min 'quotient 'remainder 'modulo
	       '= '< '> '<= '>= 'ash 'logbit?))
	
	(for-each
	 (lambda (f1)
	   (write-func1 p (string-append (symbol->string f1) "_x0") `(,f1 x 0) 3 f1))
	 (list 'make-polar 'complex 'expt 'lcm 'gcd 'max 'min '= '< '> '<= '>= 'ash 'logbit?))
	
	(for-each
	 (lambda (f1)
	   (write-func2 p (string-append (symbol->string f1) "_xy") `(,f1 x y) 3.14 4.2 f1))
	 (list 'make-polar 'complex 'expt 'max 'min 'quotient 'remainder 'modulo
	       '= '< '> '<= '>=))
	
	(for-each
	 (lambda (f1)
	   (write-func1 p (string-append (symbol->string f1) "_c") `(,f1 x) #\a f1))
	 (list 'char-upcase 'char-downcase 'char->integer 'char-upper-case? 'char-lower-case? 'char-alphabetic?
	       'char-numeric? 'char-whitespace? 'char?))
	
	(for-each
	 (lambda (f2)
	   (write-func2 p (string-append (symbol->string f2) "_xy") `(,f2 x y) #\a #\space f2))
	 (list 'char=? 'char<? 'char>? 'char<=? 'char>=? 'string))
	
	(for-each
	 (lambda (f1)
	   (write-func1 p (string-append (symbol->string f1) "_xc") `(,f1 x #\b) #\a f1))
	 (list 'char=? 'char<? 'char>? 'char<=? 'char>=?))
	
	(write-func1 p "intchar" '(integer->char x) 92 'integer->char)
	(write-func2 p "charpos" '(char-position x y) #\a "dsafa" 'char-position 'char-position)
	
	(for-each
	 (lambda (f1)
	   (write-func1 p (string-append (symbol->string f1) "_c") `(,f1 x) "asd" f1))
	 (list 'string? 'string-downcase 'string-upcase 'string->list 'string-length 'string-copy))
	
	(for-each
	 (lambda (f2)
	   (write-func2 p (string-append (symbol->string f2) "_xy") `(,f2 x y) "Aasd" "basd" f2))
	 (list 'string=? 'string<? 'string>? 'string<=? 'string>=? 'string-ci=? 'string-ci<? 'string-ci>? 'string-ci<=? 'string-ci>=? 'string-append))
	
	(for-each
	 (lambda (f1)
	   (write-func1 p (string-append (symbol->string f1) "_xc") `(,f1 x "asbda") "asda" f1))
	 (list 'string=? 'string<? 'string>? 'string<=? 'string>=? 'string-ci=? 'string-ci<? 'string-ci>? 'string-ci<=? 'string-ci>=?))
	
	(write-func1 p "lst0" '(list-ref x 0) '(list 0 1 3) 'list-ref)
	(write-func1 p "lst1" '(list-set! x 0 1) '(list 0 1 3) 'list-set!)
	(write-func1 p "vct0" '(vector-ref x 0) '(vector 0 1 3 4 5 6 7 8) 'vector-ref)
	(write-func1 p "vct1" '(vector-ref x 1) '(vector 0 1 3 4 5 6 7 8) 'vector-ref)
	(write-func1 p "vct2" '(vector-ref x 2) '(vector 0 1 3 4 5 6 7 8) 'vector-ref)
	(write-func1 p "vct3" '(vector-ref x 3) '(vector 0 1 3 4 5 6 7 8) 'vector-ref)
	(write-func1 p "vct4" '(vector-ref x 4) '(vector 0 1 3 4 5 6 7 8) 'vector-ref)
	
	(write-func1 p "arit" '(aritable? x 1) abs 'aritable?)
	(write-func1 p "arty" '(arity x) abs 'arity)    
	(write-func1 p "bool" '(boolean? x) #f 'boolean?)
	(write-func1 p "cc" '(continuation? x) #f 'continuation?)
	(write-func1 p "eof" '(eof-object? x) #<eof> 'eof-object?)
	(write-func1 p "gen" '(gensym? x) ''a 'gensym?)
	(write-func1 p "df" '(defined? x) ''format 'defined?)
	(write-func1 p "key" '(keyword? x) ':a 'keyword?)
	(write-func1 p "keysym" '(keyword->symbol x) ':a 'keyword->symbol)
	(write-func1 p "intchr" '(integer->char x) 95 'integer->char)
					;(write-func1 p "gens" '(gensym x) "asdf" 'gensym) -- can't be the same (this is like calling random)
					;(write-func1 p "evl" '(eval x) ''(+ 1 2) 'eval) -- env evals to itself 
	(write-func1 p "evlstr" '(eval-string x) "(+ 1 2)" 'eval-string)
	(write-func1 p "rev" '(reverse x) #(0 1 2) 'reverse)
	(write-func1 p "symb" `(symbol x) "asdf" 'symbol)
	(write-func1 p "mb" '(member 1 x) '(list 0 1 2) 'member)
	(write-func1 p "mq" '(memq 1 x) '(list 0 1 2) 'memq)
	(write-func1 p "mv" '(memv 1 x) '(list 0 1 2) 'memv)
	(write-func1 p "ac" '(assoc 1 x) '(list (cons 0 1) (cons 1 2) (cons 2 3)) 'assoc)
	(write-func1 p "aq" '(assq 1 x) '(list (cons 0 1) (cons 1 2) (cons 2 3)) 'assq)
	(write-func1 p "av" '(assv 1 x) '(list (cons 0 1) (cons 1 2) (cons 2 3)) 'assv)
	(write-func1 p "srt" '(sort! x <) #(0 1 2) 'sort!)
	
	(for-each
	 (lambda (f1)
	   (write-func1 p (string-append (symbol->string f1) "_x") `(,f1 x) abs f1))
	 (list 'documentation 'funclet 
	       'setter 'procedure-source 'dilambda?))
	
	(for-each
	 (lambda (f1) 
	   (write-func1 p (string-append (symbol->string f1) "_x") `(,f1 x) ''abs f1))
	 (list 'symbol->dynamic-value 'symbol->keyword 'symbol->string 'symbol->value 'symbol-setter 'symbol?))
	
	(for-each
	 (lambda (f1)
	   (write-func1 p (string-append (symbol->string f1) "_x") `(,f1 x) #(0 1 2) f1))
	 (list 'vector->list 'vector-dimensions  'vector-length 'vector?))
	
	(write-func1 p "vs" '(vector-set! x 0 1) (vector 0 1) 'vector-set!)
	(write-func1 p "vf" '(vector-fill! x 0) (vector 0 1) 'vector-fill!)
	;(write-func2 p "va" '(vector-append x y) (vector 0 1) (vector 2 3) 'vector-append 'vector-append)
	
	(write-func1 p "cwof" '(call-with-output-file x (lambda (p) (display 12 p))) "tmp1.r5rs" 'call-with-output-file)
	(write-func1 p "cwif" '(call-with-input-file x (lambda (p) (read p))) "tmp1.r5rs" 'call-with-input-file)
	(write-func1 p "cwis" '(call-with-input-string x (lambda (p) (read p))) "123" 'call-with-input-string)
	(write-func1 p "wof" '(with-output-to-file x (lambda () (display 12))) "tmp1.r5rs" 'with-output-to-file)
	(write-func1 p "wif" '(with-input-from-file x (lambda () (read))) "tmp1.r5rs" 'with-input-from-file)
	(write-func1 p "wis" '(with-input-from-string x (lambda () (read))) "123" 'with-input-from-string)
	
	(write-func1 p "fvr" '(float-vector-ref x 0) '(float-vector 0 1) 'float-vector-ref)
	(write-func1 p "fvs" '(float-vector-set! x 0 1.0) '(float-vector 0 1) 'float-vector-set!) ; g_vct_set_three clm2xen.c 9507
	(write-func1 p "fvq" '(float-vector? x) '(float-vector 0 1) 'float-vector?)
	
	(for-each
	 (lambda (f1)
	   (write-func1 p (string-append (symbol->string f1) "_x") `(,f1 x) '(hash-table '(a . 1) '(b . 2)) f1))
	 (list 'hash-table-entries 'hash-table?))
	(write-func1 p "htr" '(hash-table-ref x 'a) '(hash-table '(a . 1) '(b . 2)) 'hash-table-ref)
	(write-func1 p "hts" '(hash-table-set! x 'a 1) '(hash-table '(a . 1) '(b . 2)) 'hash-table-set!)
	
	(write-func1 p "lstail" '(list-tail x 2) '(list 0 1 2 3) 'list-tail)
	(write-func1 p "op1" '(let ((p (open-input-file x))) (close-input-port p)) "tmp1.r5rs" 'open-input-file)
	(write-func1 p "op1" '(let ((p (open-input-string x))) (close-input-port p)) "tmp1.r5rs" 'open-input-string)
;	(write-func1 p "mapx" '(map abs x) #(-1 -2 -3) 'map)
;	(write-func1 p "forx" '(let ((sum 0)) (for-each (lambda (n) (set! sum (+ sum n))) x) sum) #(1 2 3) 'for-each)
	
	(write-func1 p "strfil" '(string-fill! x #\a) '(make-string 3) 'string-fill!)
	(write-func1 p "strfil" '(string-fill! (make-string 3) x) #\a 'string-fill!)
	(write-func1 p "lststr" '(list->string x) '(list #\a #\b) 'list->string)
	(write-func1 p "substr" '(substring x 1) "asdf" 'substring)
	(write-func2 p "makstr" `(make-string x y) 3 #\a 'make-string)
	
	(write-func1 p "n?" '(null? x) '(list) 'null?)
	(write-func1 p "nl?" '(null? x) '(list 1) 'null?)
	(write-func1 p "npa" '(not (pair? (car x))) '(list 1 2) 'car)
	(write-func1 p "npa1" '(not (pair? (car x))) '(list (list 1 2)) 'car)
	(write-func1 p "ft" '(format #f x) "test" 'format)
	(write-func1 p "sca" '(set-car! x 1) '(list 1 2) 'set-car!)
	(write-func1 p "scd" '(set-cdr! x 1) '(list 1 2) 'set-cdr!)
	(write-func1 p "nnd" '(not (null? (cdr x))) '(list 1) 'cdr)
	(write-func1 p "nnd1" '(not (null? (cdr x))) '(list 1 2) 'cdr)
	(write-func2 p "strref" `(string-ref x y) "asdf" 1 'string-ref)
	(write-func2 p "strset" `(string-set! x y #\a) "asdf" 1 'string-set!)
	(write-func1 p "objstr" `(object->string x) 12 'object->string)
	(write-func1 p "newstr" `(call-with-output-string (lambda (p) (newline x))) #f 'newline)
	
	(write-func1 p "ftn" '(format #f x) "test~%" 'format)
					;(write-func1 p "stk" '(stacktrace x) 2 'stacktrace)
	(write-func1 p "symstr" '(symbol->string x) ''a 'symbol->string)
	(write-func1 p "mrns" '(random-state x) 123 'random-state)
	(write-func1 p "mrnx" '(random-state 123 x) 123 'random-state)
	(write-func1 p "a1y" '(assoc (+ 0 1) x) '(list (cons 0 1) (cons 1 2) (cons 2 3)) 'assoc)
	(write-func1 p "mba" '(member 'a x) '(list 0 'a 2) 'member)
	
	(write-func1 p ">xf" '(> x 2.0) 3.0 '>)
	(write-func1 p "=rx" '(= 3/2 x) 2/3 '=)
	(write-func1 p "-*x" '(- (* x 2.0) 3.0) 4.0 '*)
	(write-func1 p "-_rs" '(- 2/3 x) 3 '-)    
	(write-func1 p "-_rf" '(- 12 x) 3 '-)    
	(write-func1 p "-_cs" '(- 1+i x) 3 '-)    
	(write-func1 p "+_rs" '(+ 2/3 x) 3 '+)    
	(write-func1 p "+_cs" '(+ 1+i x) 3 '+)    
	(write-func1 p "*_rs" '(* 2/3 x) 3 '*)    
	(write-func1 p "*_cs" '(* 1+i x) 3 '*)    
	(write-func1 p "+_si" '(+ x 12) 3 '+)
	
	(for-each
	 (lambda (f1 lst)
	   (write-func1 p (string-append (symbol->string f1) "_x") `(,f1 x) lst f1))
	 (list 'car 'cdr 'caar 'cadr 'cdar 'cddr 'caaar 'caadr 'cadar 'caddr 'cdaar 'cdadr 'cddar 'cdddr 'caaaar 'caaadr 'caadar 
	       'caaddr 'cadaar 'cadadr 'caddar 'cadddr 'cdaaar 'cdaadr 'cdadar 'cdaddr 'cddaar 'cddadr 'cdddar 'cddddr )
	 (list ''(a) ''(a b) ''((a) b c) ''(a b c) ''((a . aa) b c) ''(a b . c) ''(((a)) b c) ''(a (b) c)
	       ''((a aa) b c) ''(a b c) ''(((a . aa)) b c) ''(a (b . bb) c) ''((a aa . aaa) b c) ''(a b c . d)
	       ''((((a))) b c) ''(a ((b)) c) ''((a (aa)) b c) ''(a b (c)) ''(((a aa)) b c) ''(a (b bb) c) ''((a aa aaa) b c)
	       ''(a b c d) ''((((a . aa))) b c) ''(a ((b . bb)) c) ''((a (aa . aaa)) b c) ''(a b (c . cc)) ''(((a aa . aaa)) b c)
	       ''(a (b bb . bbb) c) ''((a aa aaa . aaaa) b c) ''(a b c d . e)))
	
	(write-func1 p "np" '(not (pair? x)) '(list 1) 'pair?)
	(write-func1 p "nn" '(not (null? x)) () 'null?)
	(write-func1 p "ns" '(not (symbol? x)) '(quote q) 'symbol?)
	(write-func1 p "nx" '(not (number? x)) 3 'number?)
	(write-func1 p "nr" '(not (real? x)) 3 'real?)
	(write-func1 p "nm" '(not (rational? x)) 3 'rational?)
	(write-func1 p "ni" '(not (integer? x)) 3 'integer?)
	(write-func1 p "nb" '(not (boolean? x)) #f 'boolean?)
	(write-func1 p "ny" '(not (string? x)) "a" 'string?)
	(write-func1 p "nc" '(not (char? x)) #\a 'char?)
	(write-func1 p "ne" '(not (eof-object? x)) #<eof> 'eof-object?)
	(write-func1 p "nl" '(not (list? x)) '(list 1) 'list?)
	(write-func1 p "nl1" '(not (proper-list? x)) '(cons 1 2) 'proper-list?)
	(write-func1 p "scar" '(set! (car x) 2) '(list 0 1) 'set-car!)
	
	(format p ")~%")
	))
    (load "t923.scm" (curlet))))

(let ()
  (define (call-with-input-vector v proc)
    (let ((i -1))
      (proc (openlet
	     (inlet 'read (lambda (p) (v (set! i (+ i 1))))
			   'read-byte (lambda (p) (v (set! i (+ i 1))))
			   'read-char (lambda (p) (v (set! i (+ i 1))))
			   'read-line (lambda (p) (v (set! i (+ i 1))))
			   'close-input-port (lambda (p) p)
			   'read-string (lambda (p) (v (set! i (+ i 1)))))))))
  (define (call-with-output-vector proc)
    (let* ((size 1)
	   (v (make-vector size #f))
	   (i 0)
	   (write-to-vector (lambda (obj p)
			      (when (= i size) ; make the vector bigger to accommodate the output
				    (set! v (copy v (make-vector (set! size (* size 2)) #f))))
			      (set! (v i) obj)
			      (set! i (+ i 1))
			      #<unspecified>))) ; that's what write/display return!
      (proc (openlet
	     (inlet 'write (lambda* (obj p) ((if (not (let? p)) write write-to-vector) obj p))
			   'display (lambda* (obj p) ((if (not (let? p)) display write-to-vector) obj p))
			   'format (lambda (p . args)
				     (if (not (let? p))
					 (apply format p args)
					 (write (apply format #f args) p)))
			   'write-byte (lambda* (obj p) ((if (not (let? p)) write write-to-vector) obj p))
			   'write-char (lambda* (obj p) ((if (not (let? p)) write write-to-vector) obj p))
			   'close-output-port (lambda (p) p)
			   'flush-output-port (lambda (p) p)
			   'write-string (lambda* (obj p) ((if (not (let? p)) write write-to-vector) obj p)))))
      (make-shared-vector v (list i))))
  (let ((lst ()))
    (call-with-input-vector 
     (vector 1 2 3 4 5) 
     (lambda (p)
       (set! lst (cons (read p) lst))
       (set! lst (cons (read-byte p) lst))
       (set! lst (cons (read-char p) lst))
       (set! lst (cons (read-line p) lst))
       (set! lst (cons (read-string p) lst))
       (close-input-port p)))
    (test lst '(5 4 3 2 1)))
  (test (call-with-output-vector 
	 (lambda (p)
	   (write 2 p)
	   (display 4 p)
	   (format p "~C" #\a)
	   (write-byte 8 p)
	   (write-char #\a p)
	   (write-string "a" p)
	   (flush-output-port p)
	   (close-output-port p)))
	#(2 4 "a" 8 #\a "a")))

(let ()
  (define (open-output-log name)
    ;; return a soft output port that does not hold its output file open
    (define (logit name str)
      (let ((p (open-output-file name "a")))
	(display str p)
	(close-output-port p)))
    (openlet 
     (inlet :name name
	    :format (lambda (p str . args) (logit (p 'name) (apply format #f str args)))
	    :write (lambda (obj p)         (logit (p 'name) (object->string obj #t)))
	    :display (lambda (obj p)       (logit (p 'name) (object->string obj #f)))
	    :write-string (lambda (str p)  (logit (p 'name) str))
	    :write-char (lambda (ch p)     (logit (p 'name) (string ch)))
	    :newline (lambda (p)           (logit (p 'name) (string #\newline)))
	    :close-output-port (lambda (p) #f)
	    :flush-output-port (lambda (p) #f))))
  
  (if (file-exists? "s7-test.log")
      (delete-file "s7-test.log"))
  (let ((elog (open-output-log "s7-test.log")))
    (format elog "this is a test~%")
    (format elog "all done!~%"))
  (let ((p (open-input-file "s7-test.log")))
    (test (read-line p) "this is a test")
    (test (read-line p) "all done!")
    (test (eof-object? (read-line p)) #t)
    (close-input-port p)))

;;; *s7* --------

(test (let? *s7*) #t)
(test (outlet *s7*) (rootlet))
(test (defined? 'heap-size *s7*) #t)
(test (defined? '_x_ *s7*) #f)
(let ((hpsize (*s7* 'heap-size)))
  (test (let-ref *s7* 'heap-size) hpsize)
  (test (with-let *s7* heap-size) hpsize)
  (test ((sublet *s7* 'a 1) 'heap-size) hpsize)
  (test (eval-string "heap-size" *s7*) hpsize)
  (test (symbol->value 'heap-size *s7*) hpsize))

(test (integer? (*s7* 'stack-top)) #t)
(test (integer? (*s7* 'stack-size)) #t)
(test (integer? (*s7* 'max-stack-size)) #t)
(test (integer? (*s7* 'max-heap-size)) #t)
(test (integer? (*s7* 'rootlet-size)) #t)
(test (integer? (*s7* 'heap-size)) #t)
(test (integer? (*s7* 'free-heap-size)) #t)
(test (integer? (*s7* 'gc-freed)) #t)
(test (real? (*s7* 'cpu-time)) #t)
(test (integer? (*s7* 'max-string-length)) #t)
(test (integer? (*s7* 'max-list-length)) #t)
(test (integer? (*s7* 'max-vector-length)) #t)
(test (integer? (*s7* 'max-vector-dimensions)) #t)
(test (integer? (*s7* 'default-hash-table-length)) #t)
(test (integer? (*s7* 'initial-string-port-length)) #t)
(test (real? (*s7* 'morally-equal-float-epsilon)) #t)
(test (real? (*s7* 'hash-table-float-epsilon)) #t)
(test (integer? (*s7* 'float-format-precision)) #t)
(test (random-state? (*s7* 'default-random-state)) #t)
(test (*s7* 'stacktrace-defaults) '(3 45 80 45 #t))
(test (boolean? (*s7* 'undefined-identifier-warnings)) #t)
(let ()
  (catch 'one
    (lambda ()
      (catch 'two
	(lambda ()
	  (catch 'three
	    (lambda ()
	      (test (*s7* 'catches) '(#t three two one)))
	    (lambda a a))) (lambda a a))) (lambda a a)))
(let ()
  (call-with-exit
   (lambda (one)
     (call-with-exit
      (lambda (two)
	(call-with-exit
	 (lambda (three)
	   (test (list? (*s7* 'exits)) #t))))))))
(test (list? (*s7* 'stack)) #t)
(test (string? (object->string (catch #t (lambda () (dynamic-wind (lambda () #f) (lambda () (object->string (*s7* 'stack))) (lambda () #f))) (lambda args #f)))) #t)
(test (vector? (*s7* 'gc-protected-objects)) #t)
(test (list? (*s7* 'file-names)) #t)
(test (boolean? (*s7* 'gc-stats)) #f)
(test (real? (*s7* 'default-rationalize-error)) #t)

(let-temporarily (((*s7* 'default-hash-table-length) 31)
		  ((*s7* 'hash-table-float-epsilon) 1e-4)
		  ((*s7* 'morally-equal-float-epsilon) .1)
		  ((*s7* 'gc-stats) #f)
		  ((*s7* 'max-stack-size) 1234)
		  ((*s7* 'safety) 1)
		  ((*s7* 'default-rationalize-error) .1))
  (let ((ht (make-hash-table))) (test (length ht) 32))
  (let ((ht (hash-table '(a . 1)))) (test (length ht) 32))
  (let ((ht (hash-table* :a 1))) (test (length ht) 32))
  (let ((ht (make-hash-table))) (set! (ht 3.0) 'x) (set! (ht 3.00005) 'y) (test (ht 3.00001) 'y))
  (test (morally-equal? 1.0 1.01) #t)
  (test (rationalize 3.14159) 16/5))
(let ((ht (make-hash-table))) (test (length ht) (*s7* 'default-hash-table-length)))
(let ((ht (make-hash-table))) (set! (ht 3.0) 'x) (set! (ht 3.05) 'y) (test (ht 3.01) #f))
(test (morally-equal? 1.0 1.01) #f)
(test (rationalize 3.14159) 314159/100000)

(let-temporarily (((*s7* 'float-format-precision) 123123123))
  (test (*s7* 'float-format-precision) 128))
(let ((lim (*s7* 'float-format-precision)))
  (test (set! (*s7* 'float-format-precision) -123) 'error)
  (test (*s7* 'float-format-precision) lim))
  
(let-temporarily (((*s7* 'max-vector-length) 123))
  (test (catch #t (lambda () (make-vector 256)) (lambda args 'error)) 'error)  
  (test (catch #t (lambda () (make-float-vector 256)) (lambda args 'error)) 'error) 
  (test (catch #t (lambda () (make-int-vector 256)) (lambda args 'error)) 'error)
  (test (catch #t (lambda () (make-hash-table 256)) (lambda args 'error)) 'error))

(let-temporarily (((*s7* 'max-vector-dimensions) 1))
  (test (catch #t (lambda () (make-vector '(2 3))) (lambda args 'error)) 'error)  
  (test (catch #t (lambda () (make-float-vector '(2 3))) (lambda args 'error)) 'error) 
  (test (catch #t (lambda () (make-int-vector '(2 3))) (lambda args 'error)) 'error))

(let-temporarily (((*s7* 'max-string-length) 12))
  (test (catch #t (lambda () (make-string 256)) (lambda args 'error)) 'error))

(let-temporarily (((*s7* 'max-string-length) 20))
  (let ((str "0123456789"))
    (test (string-append str str str) 'error)))

(let-temporarily (((*s7* 'max-list-length) 1))
  (test (catch #t (lambda () (make-list 256)) (lambda args 'error)) 'error))

(test (*s7* 14) 'error)
(test (*s7* (list 1)) 'error)
(test (set! (*s7* 14) 1) 'error)
(when (not pure-s7)
  (test (let ((old-out (current-output-port))) (set-current-output-port #f) (*s7* 'memory-usage) (set-current-output-port old-out)) #f))
(test (set! (*s7* 'hash-table-float-epsilon) 10) 10)
(test (set! (*s7* 'hash-table-float-epsilon) 1/10000) 1/10000)


(let ((v ())) 
  (let ((val1 (object->string (do ((i 1 (+ i 1))) ((= i 4) v) (set! v (cons (sin i) v))))))
    (set! v ())
    (let ((val2 (let-temporarily (((*s7* 'float-format-precision) 3))
		  (object->string (do ((i 1 (+ i 1))) ((= i 4) v) (set! v (cons (sin i) v)))))))
      (if with-bignums
	  (test val1 "(1.411200080598672221007448028081102798466E-1 9.092974268256816953960198659117448427036E-1 8.414709848078965066525023216302989996239E-1)")
	  (test val1 "(0.1411200080598672 0.9092974268256817 0.8414709848078965)"))
      (if with-bignums
	  (test val2 "(1.411200080598672221007448028081102798466E-1 9.092974268256816953960198659117448427036E-1 8.414709848078965066525023216302989996239E-1)")
	  (test val2 "(0.141 0.909 0.841)"))
      (if (not with-bignums) (test (<= (length val1) (length val2)) #f)))))

(for-each
 (lambda (field)
   (for-each
    (lambda (arg)
      (test (set! (*s7* field) arg) 'error))
    (list "hi" (integer->char 65) (list 1 2) #t (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand 1/0 (log 0)
	  3.14 3/4 1.0+1.0i #\f (lambda (a) (+ a 1)) #<eof> #<undefined>)))
 '(print-length safety cpu-time heap-size free-heap-size gc-freed max-string-length max-list-length max-vector-length max-vector-dimensions
   default-hash-table-length initial-string-port-length gc-protected-objects file-names rootlet-size c-types stack-top stack-size stacktrace-defaults max-stack-size 
   catches exits float-format-precision bignum-precision))

(for-each
 (lambda (field)
   (let ((old-val (*s7* field)))
     (test (set! (*s7* field) -12) 'error)
     (test (set! (*s7* field) 0) 'error)
     (set! (*s7* field) old-val)))
 '(max-string-length max-list-length max-vector-length max-vector-dimensions bignum-precision
   default-hash-table-length initial-string-port-length max-stack-size))

(for-each
 (lambda (field)
   (let ((old-val (*s7* field)))
     (test (set! (*s7* field) -12) 'error)
     (set! (*s7* field) old-val)))
 '(print-length float-format-precision))

(for-each
 (lambda (field)
   (for-each
    (lambda (arg)
      (test (set! (*s7* field) arg) 'error))
    (list "hi" (integer->char 65) (list 1 2) #t (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand
	  1.0+1.0i #\f (lambda (a) (+ a 1)) #<eof> #<undefined>)))
 '(default-rationalize-error default-random-state morally-equal-float-epsilon hash-table-float-epsilon))

(for-each
 (lambda (field)
   (for-each
    (lambda (arg)
      (test (set! (*s7* field) arg) 'error))
    (list "hi" (integer->char 65) (list 1 2) (make-vector 3) abs _ht_ _undef_ _null_ _c_obj_ quasiquote macroexpand
	  3/4 3.14 1.0+1.0i #\f (lambda (a) (+ a 1)) #<eof> #<undefined>)))
 '(undefined-identifier-warnings gc-stats))
  
(test (set! #_abs 32) 'error)
(test (define (#_abs a) (= a 1)) 'error)
(test #|a|#|b|#|c|# 'error) ; unbound variable |b|#|c|#


;; it's documented that this kind of stuff may be optimized out, so these can do anything
;(test (let ((x (abs -1)) (sba abs)) (set! abs odd?) (let ((y (abs 1))) (set! abs sba) (list x y abs))) (list 1 #t abs))
;(test (let () (define (hi z) (abs z)) (let ((x (hi -1)) (sba abs)) (set! abs odd?) (let ((y (hi 1))) (set! abs sba) (list x y)))) (list 1 #t))
;(test (let () (define (hi z) (abs z)) (let ((x (hi -1)) (sba abs)) (set! abs (lambda (a b) (+ a b))) (let ((y (hi 1))) (set! abs sba) (list x y)))) 'error)
;(set! abs #_abs)
;(test (let () (define (hi) (let ((cond 3)) (set! cond 4) cond)) (hi)) 4)
;(test (let ((old+ +) (j 0)) (do ((i 0 (+ i 1))) ((or (< i -3) (> i 3))) (set! + -) (set! j (old+ j i))) (set! + old+) j) -6)

;;; test stack size check 
(let-temporarily (((*s7* 'max-stack-size) 1024))
  (let () 
    (define (rdiv2 l) (cond ((null? l) ()) (else (cons (car l) (rdiv2 (cddr l))))))
    (test (rdiv2 (make-list 200 ())) (make-list 100 ())))
  (define-macro (stack-test tst)
    `(if (not (eq? (catch #t
		     (lambda () ,tst)
		     (lambda (type info)
		       type))
		   'stack-too-big))
	 (format *stderr* "stack: ~S~%" ',tst)))
  ;; same for op_c_p
  (stack-test (let () (define (r3 lst) (if (pair? lst) (append (r3 (cdr lst))) ())) (r3 (make-list 200))))
  ;; safe_c_sp
  (stack-test (let ((x 1)) (define (r3 lst) (if (pair? lst) (cons x (r3 (cdr lst))) ())) (r3 (make-list 200))))
  ;; safe_c_cp
  (stack-test (let () (define (r3 lst) (if (pair? lst) (cons 1 (r3 (cdr lst))) ())) (r3 (make-list 200))))
  ;; safe_c_qp
  (stack-test (let ((x 1)) (define (r3 lst) (if (pair? lst) (cons 'x (r3 (cdr lst))) ())) (r3 (make-list 200))))
  ;; safe_c_ap
  (stack-test (let ((x 1)) (define (r3 lst) (if (pair? lst) (cons (cons (+ x 1) 2) (r3 (cdr lst))) ())) (r3 (make-list 200))))
  ;; safe_c_ssp
  (stack-test (let ((x 1)) (define (r3 lst) (if (pair? lst) (list x x (r3 (cdr lst))) ())) (r3 (make-list 200))))
  ;; not_p
  (stack-test (let () (define (r3 lst) (not (r3 (cdr lst)))) (r3 (make-list 200))))
  ;; safe_c_p
  (stack-test (let () (define (r3 lst) (pair? (r3 (cdr lst)))) (r3 (make-list 200))))
  ;; safe_closure_p
  (stack-test (let () (define (f x) (pair? x)) (define (r3 lst) (f (r3 (cdr lst)))) (r3 (make-list 200))))
  ;; closure_p
  (stack-test (let () (define (f x) (map car x)) (define (r3 lst) (f (r3 (cdr lst)))) (r3 (make-list 200))))
  )

(let ()
  (define (freef) (local-func 0))
  (test (freef) 'error)
  (define (local-func x) (+ x 1))
  (test (freef) 1)
  (set! local-func (lambda (x y) (+ x y)))
  (test (freef) 'error)
  (set! local-func (lambda (x) (+ x 2)))
  (test (freef) 2)
  (set! local-func 2)
  (test (freef) 'error))

(let ()
  (define (freeg) (+ local-var 1))
  (define (freeh) (set! local-var 2))
  (test (freeg) 'error)
  (test (freeh) 'error)
  (define local-var 1)
  (test (freeg) 2)
  (test (freeh) 2))

;;; bizarre optimizer checks
(test (let () (define (func x) (if (pair? (cdr /)) 3)) (define (hi) (func (integer->char 255))) (catch #t (lambda () (hi) (func (integer->char 255))) (lambda arg #f))) #f)
(test (catch #t (lambda () (define (func x) (cond (case `((1)) (if x y) =>))) (define (hi) (func ())) (hi)) (lambda args 'error)) 'error)
(let () 
  (define (func x) 
    (case x 
      ((#t) (- (cdaadr)))
      (('(((x 1) 2) 3)) (cadddr or (list (list 1 2)) (<= (sort!))))
      (else (cond (case / #() let* 0+1/0i (list (list 1)) (lambda* / (caadar (read-byte // (assv)))))))))
  (define (hi) 
    (func 1+0/0i)) 
  (hi) 
  (func 1+0/0i))

(test (let () 
	(define (f1 a b) 
	  (list a b))
	(define (f2) 
	  (when #f (define f2_c 2))
	  (f1 f2_c #f))
	(f2)) 'error)

(test (let () 
	(define (f1 a b) 
	  (list a b))
	(define (f3) 
	  (if #f (define f3_c 2)) 
	  (f1 f3_c f3_c))
	(f3)) 'error)

(test (let ()
	(define (f4 a b)
	  (catch #t (lambda () a) (lambda args (display (ow!)))))
	(define (f5)
	  (when #f (define f5_c 50))
	  (f4 f5_c (lambda () 1)))
	(f5)) 'error)

(test (let ()
	(define (f6)
	  (and #f (define f7_c 50))
	  (+ f7_c ((lambda () 1))))
	(f6)) 'error)

(test (let () (define (func x) (call-with-exit (lambda ((i 0 (+ i 1))) #f))) (define (hi) (func begin)) (hi) (func begin)) 'error)
(test (let () (define (func x) (if (cond (cddr => (lambda))) (cddddr `(((+ x 1)))))) (define (hi) (func '((x 1) (y) . 2))) (hi) (func '((x 1) (y) . 2))) 'error)
(test (let () (define (func x) (if (memq / (quote . "")) (assv '()))) (define (hi) (func x y z)) (hi) (func x y z)) 'error)
(test (let () (define (func x) (cond (case / (set! _settee_ (caadr))))) (define (hi) (func 0/0+0/0i)) (hi) (func 0/0+0/0i)) 'error)
(test (let () (define (func x) (object->string (list  (funclet  /)))) (define (hi) (func abs)) (hi)) "((rootlet))")
(test (let () (define (func x) (cdadar (not (eq? / '())))) (define (hi) (func '((())))) (hi)) 'error)
(test (let () (define (func x) (append (inlet 'integer? (lambda (f) #f)) (hash-table `((+ x 1)) '(((x 1) 2) 3)))) (define (hi) (func 1)) (hi)) 'error)
(test (let () (define (func x) (float-vector? (<= / (let-ref 1+0/0i 0)))) (define (hi) (func 0/0+i)) (hi)) 'error)
(test (let () (set! else #(0 0)) (define (func x) (car (boolean? (char=? (else ()) (= i 2))))) (define (hi) (func '(()))) (hi)) 'error)
(test (let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1) i) (logior // (+)))) (define (hi) (func 0+1/0i)) (hi)) 'error)
(test (let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1) i) (int-vector-ref /(asinh (logand))))) (define (hi) (func 0+1/0i)) (hi)) 'error)
(test (let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1) i) (logxor /(lognot (gcd))))) (define (hi) (func (list (list 1 2)))) (hi)) 'error)
(test (let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1) i) (int-vector-set! / 1 2))) (define (hi) (func 1.5)) (hi)) 'error)
(test (let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1)) (quote . /))) (define (hi) (func (integer->char 255))) (hi)) 'error)
(test (let () (define (func x) (cond ((if if . :readable) #f))) (define (hi) (func begin)) (hi)) 'error)
(test (let () (define (func x) (if (not . /) x)) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (set! (with-let / begin `(+ ,a ,b ,@c) #<undefined>) #f)) (define (hi) (func #f)) (hi)) 'error)
(test (procedure? (let () (define (func) (cond (case 'x (lambda / x)))) (func))) #t)
(test (let () (define (func x) (let () (define _x_ (lambda* '((x 1 . 2) . 3) `((x)) (reverse! /))))) (define (hi) (func #f)) (hi)) 'error)
(test (procedure? (let () (define (func x) (cond (case / (lambda* abs /)) (else #f))) (define (hi) (func #f)) (hi))) #t)
(test (let () (define (func x) (let () (define _x_ (lambda* . let*)))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (set! (with-let . ()) #f)) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (call/cc (lambda (_x_) (acosh (unlet))))) (define (hi) (func #f)) (hi)) 'error)
(test (procedure? (let () (define (func x) (cond (case '((x 1) y . 2) 1/0+i :readable (lambda / macroexpand `(x 1))) (else #f))) (define (hi) (func #f)) (hi))) #t)
(test (let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1)) (member :rest (cons 1 2) /))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1)) (char-numeric?  (make-vector 3)  1.5  `((+ x 1))  ))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1)) (procedure? //))) (define (hi) (func #f)) (hi)) 'error)
;(test (let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1)) (char-numeric? (char-ready?  )))) (define (hi) (func #f)) (hi)) 'error) ;#t if opt
(test (let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1)) (iterator-at-end? /))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1)) (hash-table-ref /(flush-output-port  )))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (let () (set! ((dilambda / (let ((x 3)) (lambda (y) (+ x y)))  )) 3))) (define (hi) (func #f)) (hi)) 6) ;!
(test (let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1)) (unlet /(immutable?  )))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (catch #f (vector-ref #(1 2) 0 1.0+1.0i) (vector-ref #(1 2) 0 1.0+1.0i))) (define (hi) (func #f)) (hi)) 'error)
(test (vector-ref (vector abs log) 0 -1) 1) ; weird...
(test (let () (define (func x) (cond (lambda (if x y) 0 1.0+1.0i (string>=? / `((+ x 1)) x y z (integer->char 255))) (else #f))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1)) (format  `((x))  (list 1)  cons  else  (read  (string-append  /))))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1)) (<= -1 (round /)))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1)) (byte-vector-ref (make-string 3) 0))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1)) (char-ci<? (null? i) (quote . let)))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1)) (int-vector-ref #i2d((1 2) (3 4)) 0))) (define (hi) (func #f)) (hi)) #t)
(test (let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1)) (denominator (sqrt (hash-table-ref (if x y) 0+0/0i))))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1)) (and  `((x)) (string (integer->char 255))))) (define (hi) (func #f)) (hi)) #t)
(test (let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1)) (string>? (null? i) (object->let /)) (string>? (null? i) (object->let /)))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1) i) / (letrec . #t))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1) i) :readable `((x . 1)) (provide (quote /)))) (define (hi) (func #f)) (hi)) 1)
(test (let () (define (func x) (iterator-sequence (string-ci<=? (do ((i 0 (+ i 1))) ((= i 1) i) (when (+ i 1) `(+ x 1) (list 1) (- i 1)))))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (continuation? (do ((i 0 (+ i 1))) ((= i 1) i)  (unless   (+ i 1)  quasiquote  )))) (define (hi) (func #f)) (hi)) #f)
(test (let () (define (func x) (error `(x 1) (null? i) (list 1 2) (lambda . /))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1) i) / (case / (if x y) #2d((1 2) (3 4)) (x => y)))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (char>=? (inlet 'a 1) (hook-functions (output-port?))) (vector? (letrec))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (letrec // . letrec)) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (for-each quasiquote (object->let /))) (define (hi) (func #f)) (hi)) #<unspecified>)
(test (let () (define (func x) (provided? (eval-string  (do ((i 0 (+ i 1))) ((= i 1) i) (case))))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (cond (denominator 1 . 2))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (when denominator 1 . 2)) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (case 0 ((0) 1 . 2))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (case denominator ((0) 1) (else 1 . 2))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (cond (denominator . 2))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (when denominator . 2)) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (case 0 ((0) . 2))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (case denominator ((0) 1) (else . 2))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (string? (object->string (hash-table (list-values (object->let /)))))) (define (hi) (func #f)) (hi)) #t)
(test (let () (define (func x) (sort! / (lambda (zero? i) (zero? i)))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1) i) (string>? (string) (read-line)))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (do ((i 0 (+ i 1))) ((= i 3)) (let-set! cons '() macroexpand))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (call-with-values  quasiquote  macroexpand  )) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1) i) (modulo (expt 2 32) (make-iterator (list 1 2 3))))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (< (read-char (cond (boolean? lambda* (lambda (a) (values a (+ a 1))) `(+ ,a ,b) 0+0/0i))))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (exact->inexact (cond (continuation? lambda (lambda (a) (values a (+ a 1))) (values "ho") `(x) `(+ ,a ,b))))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1) i) 0 (cond (quote (define _definee_ 0))))) (define (hi) (func #f)) (hi)) 1)
(test (let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1) i) 0 (cond '(define _definee_ 0)))) (define (hi) (func #f)) (hi)) 1)
(test (let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1) i) (let* ()))) (define (hi) (func #f)) (hi)) 'error) ; not 0!
(test (let () (define (func x) (input-port? (c-pointer (values 1 2) begin))) (define (hi) (func #f)) (hi)) #f) ; not 'error
(test (let () (define (func x) (member letrec '#())) (define (hi) (func #f)) (hi)) 'error) ; not #f
(test (let () (define (func abs) (abs 1)) (define (hi) (func '(1 2 3))) (hi)) 2)
(test (let () (define (hi) ((lambda (abs) (abs 1)) '(1 2 3))) (hi)) 2)
(test (let () (define (func x) ((lambda (values) (values "ho")) '((x 1) 2))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (multiple-value-bind (values) '((x 1) 2) (values "ho"))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (multiple-value-bind (list) macroexpand '((1 2) (3 4)) (length (list)))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (multiple-value-bind (hash-table) (integer->char 255) (pair? (hash-table? (let* () 0+1/0i (hash-table)))))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (multiple-value-bind (list) -1 `((1) . x) #() (make-iterator (list 1 2 3)) (random-state 1234) 1234)) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1) i) (char-numeric? most-negative-fixnum))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1) i) (char-alphabetic? (list)))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1) i) (char-whitespace? (make-hash-table)))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (vector->list (values 1 2) #(1 2))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (truncate (/ (values 1 2) 0))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (fill! (values 1 2) `(+ x 1))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (not (zero? :readable))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1) i) (exact->inexact 1.0+123.0i))) (define (hi) (func #f)) (hi)) 1)
(test (let () (define (func x) (inlet 'if 3)) (define (hi) (func #f)) (hi)) 'error)
(test ((let () (define (func x) (inlet ':allow-other-keys 3)) (define (hi) (func #f)) (hi)) 'allow-other-keys) 3)
(test (let () (define (func x) (vector (setter car) (quote (null? i) #r2d((.1 .2) (.3 .4))))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (c-pointer? begin (member let-temporarily (values 1 2)))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (integer? (assoc (values) '((x 1) (y) . 2) cons))) (define (hi) (func #f)) (hi)) #f)
(test (let () (define-macro (_mac_ x) `(+ ,x 1)) (let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1) 1) (_mac_ inf.0 . #x123.123))) (define (hi) (func #f)) (hi))) 'error)
(test (let () (define (func x) (reverse! (write-string (symbol->string :allow-other-keys) #f))) (define (hi) (func #f)) (hi)) "syek-rehto-wolla:") ; copied we hope
(test (symbol->string :allow-other-keys) ":allow-other-keys")
(test (let () (define (func x) (with-let (openlet (inlet 'abs (lambda (x) (- x)))) '(- 1) (abs 1+1i))) (define (hi) (func #f)) (hi)) -1-i)
(test (let ((x #f)) (define (func) (member "c" '(x) (lambda (a b) (call/cc (lambda (return) (return #f)))))) (define (hi) (func)) (hi)) #f)
(test (let ((x #f)) (define (func) (assoc "c" '((x . 1)) (lambda (a b) (call/cc (lambda (return) (return #t)))))) (define (hi) (func)) (hi)) '(x . 1))
(let ((imp '(0 1))) (define (func) (list (hash-table-ref imp imp) #u8(0 1) #r())) (define (hi) (func)) (test (hi) 'error))

(let ((x #f)) 
  (define (func) (do ((i 0 (+ i 1))) ((= i 1) x) (set! x (eval-string (object->string (curlet))))))
  (define (hi) (func)) 
  (test (hi) (inlet 'i 0 (symbol "(dox_slot)") 1)))

(test (let ((x #f)) (define (func) (do ((i 0 (+ i 1))) ((= i 1) x) (set! x (let-temporarily ((i 0 (+ i 1))) #i(1) 1)))) (define (hi) (func)) (hi)) 'error)
(test (let ((x #f)) (define (func) (do ((i 0 (+ i 1))) ((= i 1) x) (set! x (for-each (lambda s s) (object->let (block)))))) (define (hi) (func)) (hi)) #<unspecified>)
(test (let ((x #f)) (define (func) (call-with-exit (lambda (x) (char-ci>? (call-with-output-string x))))) (define (hi) (func)) (hi)) 'error)
(test (let ((x #f)) (define (func) (call-with-exit (lambda (x) (char-ci>? (with-output-to-string x))))) (define (hi) (func)) (hi)) 'error)
(test (let ((x #f)) (define (func) (call-with-exit (lambda (x) (char-ci>? (with-output-to-file "/dev/null" x))))) (define (hi) (func)) (hi)) 'error)
(unless pure-s7 (test (let ((x #f)) (define (func) (let () (vector (quasiquote (fill! (with-baffle (unquote))))))) (define (hi) (func)) (hi)) 'error))
(test (let ((x #f)) (define (func) (do ((i 0 (+ i 1))) ((= i 1) x) (set! x (indexable?)))) (define (hi) (func)) (hi)) 'error)

(test (let () (define (func x) (make-list (reader-cond (#t _definee_ (define _definee_ 0))))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (make-list _definee_ (define _definee_ 0))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (make-list z (define z 0))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (string-ci>=? _definee_ -1.0 (define-bacro* _definee_ 0 (tan (string (A (f x) B) '() 1+i))))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (string-ci>=? _definee_ -1.0 (define _definee_ 0))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (call-with-input-string _definee_ (define _definee_ 0 `(x 1) (openlet (inlet 'abs (lambda (x) x))) lambda))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (call-with-input-string _definee_ (define _definee_ 0 (openlet (inlet 'abs 1))))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (quasiquote (define _definee_ 0)) (symbol _definee_)) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (int-vector-ref _definee_ (define _definee_ (define _definee_ 0)))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (vector-fill! _definee_ (char<=? enver (begin (define _definee_ 0))))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (fill! _definee_ (set! __var__ (define _definee_ 0)))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (list-ref _definee_ (with-baffle (define _definee_ 0)))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (max _definee_ (let 1/0+i (define _definee_ 0)))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (hash-table _definee_ (let-temporarily 1.0+123.0i (define _definee_ 0)))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (with-baffle (define _definee_ 0)) (for-each _definee_ (make-int-vector 3))) (define (hi) (func #f)) (hi)) 'error) ; with-baffle is like with-let
(test (let () (define (func x) (let-temporarily () (define _definee_ 2)) (+ 1 _definee_)) (define (hi) (func #f)) (hi)) 3) ; but let-temporarily is like begin??
(test (let () (let-temporarily () (define x 2)) (+ x 1)) 3)
(test (let ((y 1)) (let-temporarily ((y 3)) (define x y)) (+ x y)) 4)
(test (let () (define (func x) (with-input-from-string _definee_ (lambda* 0/0+0/0i (define _definee_ 0)))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (with-input-from-string _definee_ (lambda* ((x (define _definee_ 0))) x))) (define (hi) (func #f)) (hi)) 'error)
(test (let () (define (func x) (c-pointer? _definee_ (let-temporarily () (define _definee_ 0)))) (define (hi) (func #f)) (hi)) 'error)

(test (let ((x -1)) (define (func) (with-let (inlet 'a 1) (+ x 1))) (define (hi) (func)) (hi)) 'error)
(test (let ((x -1)) (define (func) (with-let (inlet 'a 1) (+ 2 x 1))) (define (hi) (func)) (hi)) 'error)
(test (let ((x -1)) (define (func) (with-let (inlet 'a 1) (+ 3 2 x 1))) (define (hi) (func)) (hi)) 'error)
(test (let ((x -1)) (define (func) (with-let (inlet 'a 1) (abs x))) (define (hi) (func)) (hi)) 'error)
(test (let ((x #f)) (define (func) (do ((i 0 (+ i 1))) ((= i 1) x) (set! x (with-let (inlet 'a 1) (setter x))))) (define (hi) (func)) (hi)) 'error)
(test (let ((x -1)) (define (func) (with-let (inlet 'a 1) (with-let (inlet 'b 1) (+ b 1)) (+ x 1))) (define (hi) (func)) (hi)) 'error)
(test (let ((x -1)) (define (func) (with-let (inlet 'a 1) (let ((x 1)) (+ x 1)))) (define (hi) (func)) (hi)) 2)
(test (let ((x -1)) (define (func) (with-let (inlet 'a 1) (let ((x 1)) (with-let (inlet 'b 1) (+ b 1)) (+ x 1)))) (define (hi) (func)) (hi)) 2)
(test (let ((x -1)) (define (func) (with-let (inlet 'a 1) (let ((x 1)) (with-let (inlet 'b 1) (+ b 1)))) (+ x 1)) (define (hi) (func)) (hi)) 0)
(test (let ((x #f)) (define (func) (do ((i 0 (+ i 1))) ((= i 1) x) (set! x (atanh (with-let (inlet 'integer? (lambda (f) #f)) (+ x 1)))))) (define (hi) (func)) (hi)) 'error)
(test (let () (define (func) (call-with-exit (lambda (_x_) 1 . 2))) (define (hi) (func)) (hi)) 'error)
(test (let () (define (func) (list (quote 1 abs) (quote 1))) (define (hi) (func)) (hi)) 'error)

(test (with-let (inlet) (let () (signature abs) . if)) 'error)
(test (with-let (inlet) (let* () (signature abs) . if)) 'error)
(test (with-let (inlet) (letrec () (signature abs) . if)) 'error)
(test (let-temporarily ((__var__ 1)) (signature abs) . if) 'error)
(test (with-let (inlet 'i 0) 1 cons . 2) 'error)
(test (call-with-output-file "/dev/null" (lambda* '(- 1) (vector 1 '(3)) '((1)))) 'error)

(test (let () (define (f) (let ((_x_ (+ _x_ 1.0))) 1)) (f)) 'error)
(test (let () (define (f) (define _x_ (let-ref (cdr _x_) 'a))) (f)) 'error)
(test (let () (define (f) (define _x_ (define _x_ 1))) (f)) 1)
(test (let () (define (f y) (define _x_ (* y (cos _x_))) 1) (f 1)) 'error)
(test (let () (define (f y) (define _x_ (* _x_ y)) 1) (f 1)) 'error)
(test (let () (define (f) (define _x_ (+ _x_ 123)) 1) (f)) 'error)
(test (let () (define (f) (define _x_ (+ _x_ 1)) 1) (f)) 'error)
(test (let () (define (f) (define _x_ (+ 1 _x_)) 1) (f)) 'error)
(test (let () (define (f) (define _x_ (* .1 _x_)) 1) (f)) 'error)
(test (let () (define (f) (define _x_ (+ .1 _x_)) 1) (f)) 'error)
(test (let () (define (f) (define _x_ (+ _x_ .1)) 1) (f)) 'error)

(test (let () (define (func) (do ((i 0 (+ i 1))) ((= i 1)) (set!))) (define (hi) (func)) (hi)) 'error)
(test (let () (define (func) (do ((i 0 (+ i 1))) ((= i 1)) (do ((j 0 (+ j 1))) ((= j 1)) (if (list 1) (byte-vector 0 1 2))))) (define (hi) (func)) (hi)) #t)
(test (let () (define (func) (do ((i 0 (+ i 1))) ((= i 1)) (do ((j 0 (+ j 1))) ((= j 1)) (if (c-pointer 1234) #i(1))))) (define (hi) (func)) (hi)) #t)
(test (let () (define (func) (let ((x #f)) (do ((i 0 (+ i 1))) ((= i 1)) (do ((j 0 (+ j 1))) ((= j 1)) (let _let_ #x123.123))))) (define (hi) (func)) (hi)) 'error)
(test (let () (define (func) (do ((i 0 (+ i 1))) ((= i 1)) (do ((j 0 (+ j 1))) ((= j 1)) (if (immutable! (float-vector 0 1 2)) #_cons)))) (define (hi) (func)) (hi)) #t)
(test (let () (define (func) (let ((x #f)) (do ((i 0 (+ i 1))) ((= i 1)) (do ((j 0 (+ j 1))) ((= j 1)) (if (let-temporarily ((x 1234)) (+ x 1)) _undef_))))) (define (hi) (func)) (hi)) #t)
(test (let () (define (func) (do ((i 0 (+ i 1))) ((= i 1)) (do ((j 0 (+ j 1))) ((= j 1)) (if (list 1 2) and)))) (define (hi) (func)) (hi)) #t)
(test (let () (define (func) (do ((i 0 (+ i 1))) ((= i 1)) (do ((j 0 (+ j 1))) ((= j 1)) (if (string #\c #\b) '((1 (2)) (((3) 4))))))) (define (hi) (func)) (hi)) #t)
(test (let () (define (func) (do ((i 0 (+ i 1))) ((= i 1)) (do ((j 0 (+ j 1))) ((= j 1)) (if 1 (* 2 x 3.0 4))))) (define (hi) (func)) (hi)) 'error)
(test (let () (define (func) (let ((x #f) (i 0)) (do ((i 0 (+ i 1))) ((= i 1)) (do ((j 0 (+ j 1))) ((= j 1)) (let _let_ #x123.123))))) (define (hi) (func)) (hi)) 'error)
(test (let () (define (func) (do ((i 0 (+ i 1))) ((= i 1)) (do ((j 0 (+ j 1))) ((= j 1)) (hash-table-set! (immutable! (hash-table* 'a 1)) 'x 3)))) (define (hi) (func)) (hi)) 'error)
(test (let () (define (func) (let ((x #f) (i 0)) (do ((i 0 (+ i 1))) ((= i 1)) (do ((j 0 (+ j 1))) ((= j 1)) (cond (set! __var__ . #x123)))))) (define (hi) (func)) (hi)) 'error)
(test (let () (define (func) (do ((i 0 (+ i 1))) ((= i 1)) (do ((j 0 (+ j 1))) ((= j 1)) (if (not :readable #i()) (vector))))) (define (hi) (func)) (hi)) 'error)
(test (let () (define (func) (let ((x #f) (i 0)) (do ((i 0 (+ i 1))) ((= i 1)) (let ((j 0)) (truncate (exp #x123.123)))))) (define (hi) (func)) (hi)) 'error)
(test (eval-string "(let ((x #f) (i 0)) (do ((i 0 (+ i 1))) ((= i 1)) (do ((j 0 (+ j 1))) ((= j 1)) (cond-expand (x => y) (values 1 2) #\\newline `(+ ,a ,b)))))") 'error)

(test (multiple-value-bind lambda #f (call-with-exit (lambda (return) (return 1)))) 'error)
(unless pure-s7
  (test (let ((x #f) (i 0)) (if (not x) (begin (quasiquote (type-of `((x)) "" #r2d((.1 .2) (.3 .4)) unquote))))) 'error)
  (test (let () (define (func) (let ((x #f) (i 0)) (let () (values (zero? (quasiquote (unquote . #x123.123))))))) (define (hi) (func)) (hi)) 'error))
(test (let ((x #f) (i 0)) (call/cc (lambda* quote `((1) . x)))) 'error)
(test (let () (define (func) (let ((x #f) (i 0)) (call/cc (lambda* quote `((1) . x) (begin))))) (define (hi) (func)) (hi)) 'error)
(test (let () (define (func) (do ((i 0 (+ i 1))) ((= i 1)) (fill! (immutable! (list 0 1 2)) (call/cc (lambda (return) (return 1 2)))))) (define (hi) (func)) (hi)) 'error)
(test (let () (define (func) (member 1 '(2 3) (lambda (a b) (do ((i 0 (+ i 1))) ((= i 1) 1) (/ (random 1)))))) (define (hi) (func)) (hi)) 'error)
(test (let () (define (func) (let ((x #f) (i 0)) (let () (_do1_ (make-vector (do ())) (make-byte-vector (hash-table-ref)))))) (define (hi) (func)) (hi)) 'error)
(let-temporarily (((current-output-port) #f))
  (if (let ((false #f)) (define (func) (do () ((not false) (format () "ra")))) (define (hi) (func)) (hi)) (format *stderr* "format1 bug~%"))
  (if (let ((false #f)) (define (func) (when (not false) (format () "ra"))) (define (hi) (func)) (hi)) (format *stderr* "format2 bug~%")))

(let ()
  (let ((x 1)) (define (func) (do ((i 0 (+ i 1))) ((= i 1) x) (set! x (clamp 0 x 10)))) (define (hi) (func)) (hi))
  (test (let ((x 1)) (define (func) (do ((i 0 (+ i 1))) ((= i 1) 1) (clamp 0 (make-iterator (list 1)) 0))) (define (hi) (func)) (hi)) 'error))

(when with-block
  (test (let () (define (func x) (syntax? (values -1 (copy (block) (vector))))) (define (hi) (func #f)) (display (hi)) (newline)) 'error))

(when (defined? 's7-optimize)
  (test (s7-optimize '((cdadr (cddddr (symbol->string (min '((x 1 . 2) . 3) #<undefined> '((x 1) . 2))))))) #<undefined>) ; #<undefined> is s7-optimize's error value
  (test (s7-optimize '((set! (cyclic-sequences . 0+0/0i) #f))) #<undefined>)
  (test (s7-optimize (list (catch #t (lambda () (with-input-from-string "(if (not) (cadddr (rational?)))" read)) (lambda args args)))) #<undefined>)
  )

;;; same as above but change location of test
(let () (define (func x) (object->string (list  (funclet  /)))) (define (hi) (func abs)) (test (hi) "((rootlet))"))
(let () (define (func x) (cdadar (not (eq? / '())))) (define (hi) (func '((())))) (test (hi) 'error))
(let () (define (func x) (append (inlet 'integer? (lambda (f) #f)) (hash-table `((+ x 1)) '(((x 1) 2) 3)))) (define (hi) (func 1)) (test (hi) 'error))
(let () (define (func x) (float-vector? (<= / (let-ref 1+0/0i 0)))) (define (hi) (func 0/0+i)) (test (hi) 'error))
(let () (set! else #(0 0)) (define (func x) (car (boolean? (char=? (else ()) (= i 2))))) (define (hi) (func '(()))) (test (hi) 'error))
(let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1) i) (logior // (+)))) (define (hi) (func 0+1/0i)) (test (hi) 'error))
(let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1) i) (int-vector-ref /(asinh (logand))))) (define (hi) (func 0+1/0i)) (test (hi) 'error))
(let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1) i) (logxor /(lognot (gcd))))) (define (hi) (func (list (list 1 2)))) (test (hi) 'error))
(let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1) i) (int-vector-set! / 1 2))) (define (hi) (func 1.5)) (test (hi) 'error))
(let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1)) (quote . /))) (define (hi) (func (integer->char 255))) (test (hi) 'error))
(let () (define (func x) (cond ((if if . :readable) #f))) (define (hi) (func begin)) (test (hi) 'error))
(let () (define (func x) (if (not . /) x)) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (set! (with-let / begin `(+ ,a ,b ,@c) #<undefined>) #f)) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (let () (define _x_ (lambda* '((x 1 . 2) . 3) `((x)) (reverse! /))))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (let () (define _x_ (lambda* . let*)))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (set! (with-let . ()) #f)) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (call/cc (lambda (_x_) (acosh (unlet))))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1)) (member :rest (cons 1 2) /))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1)) (char-numeric?  (make-vector 3)  1.5  `((+ x 1))  ))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1)) (procedure? //))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1)) (iterator-at-end? /))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1)) (hash-table-ref /(flush-output-port  )))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (let () (set! ((dilambda / (let ((x 3)) (lambda (y) (+ x y)))  )) 3))) (define (hi) (func #f)) (test (hi) 6))
(let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1)) (unlet /(immutable?  )))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (catch #f (vector-ref #(1 2) 0 1.0+1.0i) (vector-ref #(1 2) 0 1.0+1.0i))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (cond (lambda (if x y) 0 1.0+1.0i (string>=? / `((+ x 1)) x y z (integer->char 255))) (else #f))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1)) (format  `((x))  (list 1)  cons  else  (read  (string-append  /))))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1)) (<= -1 (round /)))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1)) (byte-vector-ref (make-string 3) 0))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1)) (char-ci<? (null? i) (quote . let)))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1)) (int-vector-ref #i2d((1 2) (3 4)) 0))) (define (hi) (func #f)) (test (hi) #t))
(let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1)) (denominator (sqrt (hash-table-ref (if x y) 0+0/0i))))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1)) (and  `((x)) (string (integer->char 255))))) (define (hi) (func #f)) (test (hi) #t))
(let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1)) (string>? (null? i) (object->let /)) (string>? (null? i) (object->let /)))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1) i) / (letrec . #t))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1) i) :readable `((x . 1)) (provide (quote /)))) (define (hi) (func #f)) (test (hi) 1))
(let () (define (func x) (iterator-sequence (string-ci<=? (do ((i 0 (+ i 1))) ((= i 1) i) (when (+ i 1) `(+ x 1) (list 1) (- i 1)))))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (continuation? (do ((i 0 (+ i 1))) ((= i 1) i)  (unless   (+ i 1)  quasiquote  )))) (define (hi) (func #f)) (test (hi) #f))
(let () (define (func x) (error `(x 1) (null? i) (list 1 2) (lambda . /))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1) i) / (case / (if x y) #2d((1 2) (3 4)) (x => y)))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (char>=? (inlet 'a 1) (hook-functions (output-port?))) (vector? (letrec))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (letrec // . letrec)) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (for-each quasiquote (object->let /))) (define (hi) (func #f)) (test (hi) #<unspecified>))
(let () (define (func x) (provided? (eval-string  (do ((i 0 (+ i 1))) ((= i 1) i) (case))))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (cond (denominator 1 . 2))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (when denominator 1 . 2)) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (case 0 ((0) 1 . 2))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (case denominator ((0) 1) (else 1 . 2))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (cond (denominator . 2))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (when denominator . 2)) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (case 0 ((0) . 2))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (case denominator ((0) 1) (else . 2))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (string? (object->string (hash-table (list-values (object->let /)))))) (define (hi) (func #f)) (test (hi) #t))
(let () (define (func x) (sort! / (lambda (zero? i) (zero? i)))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1) i) (string>? (string) (read-line)))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (do ((i 0 (+ i 1))) ((= i 3)) (let-set! cons '() macroexpand))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (call-with-values  quasiquote  macroexpand  )) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1) i) (modulo (expt 2 32) (make-iterator (list 1 2 3))))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (< (read-char (cond (boolean? lambda* (lambda (a) (values a (+ a 1))) `(+ ,a ,b) 0+0/0i))))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (exact->inexact (cond (continuation? lambda (lambda (a) (values a (+ a 1))) (values "ho") `(x) `(+ ,a ,b))))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1) i) 0 (cond (quote (define _definee_ 0))))) (define (hi) (func #f)) (test (hi) 1))
(let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1) i) 0 (cond '(define _definee_ 0)))) (define (hi) (func #f)) (test (hi) 1))
(let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1) i) (let* ()))) (define (hi) (func #f)) (test (hi) 'error)) ; not 0!
(let () (define (func x) (input-port? (c-pointer (values 1 2) begin))) (define (hi) (func #f)) (test (hi) #f))
(let () (define (func x) (member letrec '#())) (define (hi) (func #f)) (test (hi) 'error)) ; not #f
(let () (define (func abs) (abs 1)) (define (hi) (func '(1 2 3))) (test (hi) 2))
(let () (define (hi) ((lambda (abs) (abs 1)) '(1 2 3))) (test (hi) 2))
(let () (define (func x) ((lambda (values) (values "ho")) '((x 1) 2))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (multiple-value-bind (values) '((x 1) 2) (values "ho"))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (multiple-value-bind (list) macroexpand '((1 2) (3 4)) (length (list)))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (multiple-value-bind (hash-table) (integer->char 255) (pair? (hash-table? (let* () 0+1/0i (hash-table)))))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (multiple-value-bind (list) -1 `((1) . x) #() (make-iterator (list 1 2 3)) (random-state 1234) 1234)) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1) i) (char-numeric? most-negative-fixnum))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1) i) (char-alphabetic? (list)))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1) i) (char-whitespace? (make-hash-table)))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (vector->list (values 1 2) #(1 2))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (truncate (/ (values 1 2) 0))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (fill! (values 1 2) `(+ x 1))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (not (zero? :readable))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1) i) (exact->inexact 1.0+123.0i))) (define (hi) (func #f)) (test (hi) 1))
(let () (define (func x) (inlet 'if 3)) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (vector (setter car) (quote (null? i) #r2d((.1 .2) (.3 .4))))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (c-pointer? begin (member let-temporarily (values 1 2)))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (integer? (assoc (values) '((x 1) (y) . 2) cons))) (define (hi) (func #f)) (test (hi) #f))
(let () (define-macro (_mac_ x) `(+ ,x 1)) (let () (define (func x) (do ((i 0 (+ i 1))) ((= i 1) 1) (_mac_ inf.0 . #x123.123))) (define (hi) (func #f)) (test (hi) 'error)) 'error)
(let () (define (func x) (reverse! (write-string (symbol->string :allow-other-keys) #f))) (define (hi) (func #f)) (test (hi) "syek-rehto-wolla:"))
(let () (define (func x) (with-let (openlet (inlet 'abs (lambda (x) (- x)))) '(- 1) (abs 1+1i))) (define (hi) (func #f)) (test (hi) -1-i))
(let ((x #f)) (define (func) (member "c" '(x) (lambda (a b) (call/cc (lambda (return) (return #f)))))) (define (hi) (func)) (test (hi) #f))
(let ((x #f)) (define (func) (assoc "c" '((x . 1)) (lambda (a b) (call/cc (lambda (return) (return #t)))))) (define (hi) (func)) (test (hi) '(x . 1)))
(let ((imp '(0 1))) (define (func) (list (hash-table-ref imp imp) #u8(0 1) #r())) (define (hi) (func)) (test (hi) 'error))
(let ((x #f)) (define (func) (do ((i 0 (+ i 1))) ((= i 1) x) (set! x (let-temporarily ((i 0 (+ i 1))) #i(1) 1)))) (define (hi) (func)) (test (hi) 'error))
(let ((x #f)) (define (func) (do ((i 0 (+ i 1))) ((= i 1) x) (set! x (for-each (lambda s s) (object->let (block)))))) (define (hi) (func)) (test (hi) #<unspecified>))
(let ((x #f)) (define (func) (call-with-exit (lambda (x) (char-ci>? (call-with-output-string x))))) (define (hi) (func)) (test (hi) 'error))
(let ((x #f)) (define (func) (call-with-exit (lambda (x) (char-ci>? (with-output-to-string x))))) (define (hi) (func)) (test (hi) 'error))
(let ((x #f)) (define (func) (call-with-exit (lambda (x) (char-ci>? (with-output-to-file "/dev/null" x))))) (define (hi) (func)) (test (hi) 'error))
(let ((x #f)) (define (func) (do ((i 0 (+ i 1))) ((= i 1) x) (set! x (indexable?)))) (define (hi) (func)) (test (hi) 'error))
(let () (define (func x) (make-list (reader-cond (#t _definee_ (define _definee_ 0))))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (make-list _definee_ (define _definee_ 0))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (make-list z (define z 0))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (string-ci>=? _definee_ -1.0 (define-bacro* _definee_ 0 (tan (string (A (f x) B) '() 1+i))))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (string-ci>=? _definee_ -1.0 (define _definee_ 0))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (call-with-input-string _definee_ (define _definee_ 0 `(x 1) (openlet (inlet 'abs (lambda (x) x))) lambda))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (call-with-input-string _definee_ (define _definee_ 0 (openlet (inlet 'abs 1))))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (quasiquote (define _definee_ 0)) (symbol _definee_)) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (int-vector-ref _definee_ (define _definee_ (define _definee_ 0)))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (vector-fill! _definee_ (char<=? enver (begin (define _definee_ 0))))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (fill! _definee_ (set! __var__ (define _definee_ 0)))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (list-ref _definee_ (with-baffle (define _definee_ 0)))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (max _definee_ (let 1/0+i (define _definee_ 0)))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (hash-table _definee_ (let-temporarily 1.0+123.0i (define _definee_ 0)))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (with-baffle (define _definee_ 0)) (for-each _definee_ (make-int-vector 3))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (let-temporarily () (define _definee_ 2)) (+ 1 _definee_)) (define (hi) (func #f)) (test (hi) 3))
(let () (define (func x) (with-input-from-string _definee_ (lambda* 0/0+0/0i (define _definee_ 0)))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (with-input-from-string _definee_ (lambda* ((x (define _definee_ 0))) x))) (define (hi) (func #f)) (test (hi) 'error))
(let () (define (func x) (c-pointer? _definee_ (let-temporarily () (define _definee_ 0)))) (define (hi) (func #f)) (test (hi) 'error))
(let ((x -1)) (define (func) (with-let (inlet 'a 1) (+ x 1))) (define (hi) (func)) (test (hi) 'error))
(let ((x -1)) (define (func) (with-let (inlet 'a 1) (+ 2 x 1))) (define (hi) (func)) (test (hi) 'error))
(let ((x -1)) (define (func) (with-let (inlet 'a 1) (+ 3 2 x 1))) (define (hi) (func)) (test (hi) 'error))
(let ((x -1)) (define (func) (with-let (inlet 'a 1) (abs x))) (define (hi) (func)) (test (hi) 'error))
(let ((x #f)) (define (func) (do ((i 0 (+ i 1))) ((= i 1) x) (set! x (with-let (inlet 'a 1) (setter x))))) (define (hi) (func)) (test (hi) 'error))
(let ((x -1)) (define (func) (with-let (inlet 'a 1) (with-let (inlet 'b 1) (+ b 1)) (+ x 1))) (define (hi) (func)) (test (hi) 'error))
(let ((x -1)) (define (func) (with-let (inlet 'a 1) (let ((x 1)) (+ x 1)))) (define (hi) (func)) (test (hi) 2))
(let ((x -1)) (define (func) (with-let (inlet 'a 1) (let ((x 1)) (with-let (inlet 'b 1) (+ b 1)) (+ x 1)))) (define (hi) (func)) (test (hi) 2))
(let ((x -1)) (define (func) (with-let (inlet 'a 1) (let ((x 1)) (with-let (inlet 'b 1) (+ b 1)))) (+ x 1)) (define (hi) (func)) (test (hi) 0))
(let ((x #f)) (define (func) (do ((i 0 (+ i 1))) ((= i 1) x) (set! x (atanh (with-let (inlet 'integer? (lambda (f) #f)) (+ x 1)))))) (define (hi) (func)) (test (hi) 'error))
(let () (define (func) (call-with-exit (lambda (_x_) 1 . 2))) (define (hi) (func)) (test (hi) 'error))
(let () (define (func) (list (quote 1 abs) (quote 1))) (define (hi) (func)) (test (hi) 'error))
(let () (define (func) (do ((i 0 (+ i 1))) ((= i 1)) (set!))) (define (hi) (func)) (test (hi) 'error))
(let () (define (func) (do ((i 0 (+ i 1))) ((= i 1)) (do ((j 0 (+ j 1))) ((= j 1)) (if (list 1) (byte-vector 0 1 2))))) (define (hi) (func)) (test (hi) #t))
(let () (define (func) (do ((i 0 (+ i 1))) ((= i 1)) (do ((j 0 (+ j 1))) ((= j 1)) (if (c-pointer 1234) #i(1))))) (define (hi) (func)) (test (hi) #t))
(let () (define (func) (let ((x #f)) (do ((i 0 (+ i 1))) ((= i 1)) (do ((j 0 (+ j 1))) ((= j 1)) (let _let_ #x123.123))))) (define (hi) (func)) (test (hi) 'error))
(let () (define (func) (do ((i 0 (+ i 1))) ((= i 1)) (do ((j 0 (+ j 1))) ((= j 1)) (if (immutable! (float-vector 0 1 2)) #_cons)))) (define (hi) (func)) (test (hi) #t))
(let () (define (func) (let ((x #f)) (do ((i 0 (+ i 1))) ((= i 1)) (do ((j 0 (+ j 1))) ((= j 1)) (if (let-temporarily ((x 1234)) (+ x 1)) _undef_))))) (define (hi) (func)) (test (hi) #t))
(let () (define (func) (do ((i 0 (+ i 1))) ((= i 1)) (do ((j 0 (+ j 1))) ((= j 1)) (if (list 1 2) and)))) (define (hi) (func)) (test (hi) #t))
(let () (define (func) (do ((i 0 (+ i 1))) ((= i 1)) (do ((j 0 (+ j 1))) ((= j 1)) (if (string #\c #\b) '((1 (2)) (((3) 4))))))) (define (hi) (func)) (test (hi) #t))
(let () (define (func) (do ((i 0 (+ i 1))) ((= i 1)) (do ((j 0 (+ j 1))) ((= j 1)) (if 1 (* 2 x 3.0 4))))) (define (hi) (func)) (test (hi) 'error))
(let () (define (func) (let ((x #f) (i 0)) (do ((i 0 (+ i 1))) ((= i 1)) (do ((j 0 (+ j 1))) ((= j 1)) (let _let_ #x123.123))))) (define (hi) (func)) (test (hi) 'error))
(let () (define (func) (do ((i 0 (+ i 1))) ((= i 1)) (do ((j 0 (+ j 1))) ((= j 1)) (hash-table-set! (immutable! (hash-table* 'a 1)) 'x 3)))) (define (hi) (func)) (test (hi) 'error))
(let () (define (func) (let ((x #f) (i 0)) (do ((i 0 (+ i 1))) ((= i 1)) (do ((j 0 (+ j 1))) ((= j 1)) (cond (set! __var__ . #x123)))))) (define (hi) (func)) (test (hi) 'error))
(let () (define (func) (do ((i 0 (+ i 1))) ((= i 1)) (do ((j 0 (+ j 1))) ((= j 1)) (if (not :readable #i()) (vector))))) (define (hi) (func)) (test (hi) 'error))
(let () (define (func) (let ((x #f) (i 0)) (do ((i 0 (+ i 1))) ((= i 1)) (let ((j 0)) (truncate (exp #x123.123)))))) (define (hi) (func)) (test (hi) 'error))



(let () ; (copy func) after func use -- clearing all opts is a problem, here OP_IF -> OP_IF_IS_TYPE needs to be reset
  (define h->a 
    (let ((+documentation+ "(h->a table) returns the contents of table as an association list:\n\
                              (h->a (hash-table '(a . 1))) -> '((a . 1))"))
      (lambda (table)
	(if (hash-table? table)
	    (map values table)
	    (error 'wrong-type-arg "h->a argument, ~A, is not a hash-table" table)))))
  (define (func)
    (h->a (hash-table* 'a 1)))
  (func)
  (define (func1)
    (call-with-output-file "/dev/null" (copy h->a)))
  (test (func1) 'error))

;;; clumsy test, but will hang in older s7's
(define global_fi
  (let ((+documentation+ "docs"))
    (lambda (par_f lst)
      (do ((p lst (cdr p)))
	  ((or (not (pair? p))
	       (par_f (car p)))
	   (and (pair? p)
		(car p)))))))

(define (par_f)
  (let ((items (list 1 (list 2 3 4))))
    (global_fi (lambda (x)
		 (not (or (symbol? x)
			  (memq x '(#f #t () #<unspecified> #<undefined> #<eof>)))))
	       (cadr items))))
(par_f)
(par_f)

;;; check cond=>opt result
(let ()
  (define (f) (cond ((= 1 2) => (lambda (s) s))))
  (test (f) #<unspecified>)
  (test (f) #<unspecified>))

;;; some clm optimizer stuff
(let ()
  (define (fdo1)
    (let ((sum 0))
      (do ((i 0 (+ i 1)))
	  ((= i 10) sum)
	(do ((j 0 (+ j 1)))
	    ((= j 3))
	  (set! sum (+ sum j))))))
  
  (let ((sum (fdo1)))
    (if (not (= sum 30))
	(format *stderr* "fdo1: ~A~%" sum)))
  
  (define (fdo2)
    (let ((sum 0))
      (do ((i 0 (+ i 1)))
	  ((= i 10) sum)
	(do ((j 0 (+ j 1)))
	    ((= j 3))
	  (set! sum (+ sum i j))))))
  
  (let ((sum (fdo2)))
    (if (not (= sum 165))
	(format *stderr* "fdo2: ~A~%" sum)))
  
  (define (fdo3)
    (let ((sum 0))
      (do ((i 0 (+ i 1)))
	  ((= i 10) sum)
	(do ((j 0 (+ j 1)))
	    ((= j 3))
	  (do ((k 0 (+ k 1)))
	      ((= k 2))
	    (set! sum (+ sum 1)))))))
  
  (let ((sum (fdo3)))
    (if (not (= sum 60))
	(format *stderr* "fdo3: ~A~%" sum)))
  
  (define (fdo4)
    (do ((i 0 (+ i 1)))
	((= i 10) i)
      (do ((j 0 (+ j 1)))
	  ((= j 3)))))
  
  (let ((sum (fdo4)))
    (if (not (= sum 10))
	(format *stderr* "fdo4: ~A~%" sum)))
  
  (define (fdo5)
    (let ((sum 0))
      (do ((i 0 (+ i 1)))
	  ((= i 10) sum)
	(do ((j 0 (+ j 1)))
	    ((= j 3))
	  (set! sum (+ sum j))
	  (set! sum (+ sum i))))))
  
  (let ((sum (fdo5)))
    (if (not (= sum 165))
	(format *stderr* "fdo5: ~A~%" sum)))
  
  (define (fdo6)
    (let ((sum 0))
      (do ((i 0 (+ i 1)))
	  ((= i 3))
	(if (zero? sum)
	    (do ((j 0 (+ j 1)))
		((= j 3))
	      (set! sum (+ sum j)))))
      sum))
  
  (let ((sum (fdo6)))
    (if (not (= sum 3))
	(format *stderr* "fdo6: ~A~%" sum)))
  
  (define (f1)
    (let ((x 0)) 
      (do ((i 0 (+ i 1/2)))
	  ((= i 3) x)
	(set! x (+ x i)))))
  (f1)
  
  (define (fdo7)
    (let ((sum 0))
      (do ((i 0 (+ i 1)))
	  ((= i 3) sum)
	(if (zero? sum)
	    (do ((j 0 (+ j 1)))
		((= j 3))
	      (set! sum (+ sum j)))))))
  
  (let ((sum (fdo7)))
    (if (not (= sum 3))
	(format *stderr* "fdo7: ~A~%" sum)))
  
  (define (fdo8)
    (let ((sum 0))
      (do ((i 0 (+ i 1)))
	  ((= i 3) (set! sum (+ sum 1)) (* sum 2))
	(if (zero? sum)
	    (do ((j 0 (+ j 1)))
		((= j 3))
	      (set! sum (+ sum j)))))))
  
  (let ((sum (fdo8)))
    (if (not (= sum 8))
	(format *stderr* "fdo8: ~A~%" sum)))
  
  (define (fdo9)
    (let ((sum 0))
      (do ((i 0 (+ i 1)))
	  ((= i 3) sum)
	(do ()
	    ((> (* sum 3) i))
	  (set! sum (+ sum 1))))))
  
  (let ((sum (fdo9)))
    (if (not (= sum 1))
	(format *stderr* "fdo9: ~A~%" sum)))
  
  (define (fdo10)
    (let ((sum 0))
      (do ((i 0 (+ i 1)))
	  ((= i 3) sum)
	(do ((k 1))
	    ((> sum 3))
	  (set! sum (+ sum k))))))
  
  (let ((sum (fdo10)))
    (if (not (= sum 4))
	(format *stderr* "fdo10: ~A~%" sum)))
  
  (define (fdo11)
    (let ((sum 0))
      (do ((i 0 (+ i 1)))
	  ((= i 3) sum)
	(do ((k 1 (+ k 1))
	     (j 2 (+ j 2)))
	    ((> k 3))
	  (set! sum (+ sum k j))))))
  
  (let ((sum (fdo11)))
    (if (not (= sum 54))
	(format *stderr* "fdo11: ~A~%" sum)))
  
  (define (fdo12)
    (let ((sum 0))
      (do ((i 0 (+ i 1)))
	  ((= i 3) sum)
	(do ((k 1 (+ k 1))
	     (j 2 (+ j k)))
	    ((> k 3))
	  (set! sum (+ sum k j))))))
  
  (let ((sum (fdo12)))
    (if (not (= sum 48))
	(format *stderr* "fdo12: ~A~%" sum)))
  
  (define size 100)
  
  (define (ft1)
    (let ((sum 0))
      (do ((i 0 (+ i 1)))
	  ((= i 10) sum)
	(do ((k 0 (+ k 1)))
	    ((= k size))
	  (set! sum (+ sum 1))))))
  
  (let ((sum (ft1)))
    (if (not (= sum (* size 10)))
	(format *stderr* "ft1: ~A~%" sum)))
  
  (define (fcond1)
    (let ((res 0))
      (do ((i 0 (+ i 1)))
	  ((= i 1))
	(cond ((zero? i) (set! res (+ i 21)))
	      (else (set! res -1))))
      res))
  
  (let ((res (fcond1)))
    (if (not (= res 21))
	(format *stderr* "fcond1: ~A~%" res)))
  
  (define (fcond2)
    (let ((res 0))
      (do ((i 0 (+ i 1)))
	  ((= i 1))
	(cond ((negative? i) (set! res (+ i 21)))
	      (else (set! res -1))))
      res))
  
  (let ((res (fcond2)))
    (if (not (= res -1))
	(format *stderr* "fcond2: ~A~%" res)))
  
  (define (fcond3)
    (let ((res 0))
      (do ((i 0 (+ i 1)))
	  ((= i 1))
	(cond ((negative? i) (set! res (+ i 21)))
	      ((> i 4) (set! res 100))))
      res))
  
  (let ((res (fcond3)))
    (if (not (zero? res))
	(format *stderr* "fcond3: ~A~%" res)))
  )


;;; --------------------------------------------------------------------------------
;;; libm

(unless (provided? 'windows)
  (let ()
    (require libm.scm)
    
    (when (and (defined? '*libm*)
	       (procedure? (*libm* 'remquo))) ; ignore ancient versions of libm
      (with-let (sublet *libm*)
	
	;; __DBL_DENORM_MIN__ comes from gcc
	;; these tests come from the autotester (I also tried those in glibc 2-17 math/libm-test.inc)  
	
	;; just representative values -- maybe catch more possibilities?
	(when (not (provided? 'solaris))
	  (num-test __DBL_DENORM_MIN__ 4.9406564584125e-324)
	  (num-test __DBL_MAX__ 1.7976931348623e+308)
	  (num-test __DBL_MIN__ 2.2250738585072e-308)
	  (num-test __DBL_EPSILON__ 2.2204460492503e-16)
	  (num-test __DBL_MIN_10_EXP__ -307)
	  (num-test __DBL_MAX_10_EXP__ 308)
	  (num-test __DBL_DIG__ 15)
	  (num-test __DBL_MANT_DIG__ 53)
	  (num-test __DBL_MIN_EXP__ -1021)
	  (num-test __DBL_MAX_EXP__ 1024)
	  (reader-cond ((not (provided? 'openbsd)) (num-test __SIZEOF_DOUBLE__ 8)))
	  (reader-cond ((not (provided? 'openbsd)) (num-test __SIZEOF_LONG_LONG__ 8)))
	  (num-test __LONG_LONG_MAX__ 9223372036854775807))
	
	(reader-cond ((provided? 'linux) 
		      (num-test FP_NAN 0)
		      (num-test FP_INFINITE 1)
		      (num-test FP_ZERO 2)
		      (num-test FP_SUBNORMAL 3)
		      (num-test FP_NORMAL 4))
		     ((provided? 'freebsd)
		      (num-test FP_NAN 2)
		      (num-test FP_INFINITE 1)
		      (num-test FP_ZERO 16)
		      (num-test FP_SUBNORMAL 8)
		      (num-test FP_NORMAL 4))
		     ((provided? 'osx) 
		      (num-test FP_NAN 1)
		      (num-test FP_INFINITE 2)
		      (num-test FP_ZERO 3)
		      (num-test FP_SUBNORMAL 5)
		      (num-test FP_NORMAL 4)))
	
	(num-test M_E (exp 1.0))
	(num-test M_LOG2E (/ (log 2)))
	(num-test M_LOG10E (/ (log 10)))
	(num-test M_LN2 (log 2))
	(num-test M_LN10 (log 10))
	(num-test M_PI pi)
	(num-test M_PI_2 (/ pi 2))
	(num-test M_PI_4 (/ pi 4))
	(num-test M_1_PI (/ pi))
	(num-test M_2_PI (/ 2 pi))
	(num-test M_2_SQRTPI (/ 2 (sqrt pi)))
	(num-test M_SQRT2 (sqrt 2))
	(num-test M_SQRT1_2 (/ (sqrt 2)))
	
	(num-test (j0 -1) 0.76519768655797)
	(num-test (j0 0) 1.0)
	(num-test (j0 1) 0.76519768655797)
	(num-test (j0 1.5) 0.51182767173592)
	(num-test (j0 -1234567.5) -0.00056797538542782)
	(num-test (j0 32.75) 0.11922756341796)
	(num-test (j0 3) -0.26005195490193)
	(num-test (j0 inf.0) 0.0)
	(test (nan? (j0 nan.0)) #t)
	
	(num-test (j1 -42) 0.045993888221887)
	(num-test (j1 -1) -0.44005058574493)
	(num-test (j1 0) 0.0)
	(num-test (j1 3/4) 0.34924360217486)
	(num-test (j1 -63) 0.057696680293944)
	(num-test (j1 inf.0) 0.0)
	(test (nan? (j1 nan.0)) #t)
	(num-test (j1 32.75) 0.074086803054576)
	(num-test (j1 1.5) 0.5579365079101)
	
	(test (nan? (erf nan.0)) #t)
	(num-test (erf -1) -0.84270079294971)
	(num-test (erf 0) 0.0)
	(num-test (erf 1.5) 0.96610514647531)
	(num-test (erf 3/4) 0.71115563365352)
	(num-test (erf -63) -1.0)
	(num-test (erf 3.1415926535898) 0.99999112385363)
	(num-test (erf inf.0) 1.0)
	
	(num-test (erfc inf.0) 0.0)
	(test (nan? (erfc nan.0)) #t)
	(num-test (erfc 1234567.6) 0.0)
	(num-test (erfc 1.5) 0.033894853524689)
	(num-test (erfc -1.5) 1.9661051464753)
	(num-test (erfc 3.0) 2.2090496998585e-05)
	
	(num-test (lgamma inf.0) inf.0)
	(test (nan? (lgamma nan.0)) #t)
	(num-test (lgamma 1.5) -0.12078223763525)
	(num-test (lgamma 3/4) 0.2032809514313)
	(num-test (lgamma 32.75) 80.688603510529)
	(num-test (lgamma 1.5) -0.12078223763525)
	(num-test (lgamma -1.5) 0.86004701537648)
	
	(num-test (fabs -1) 1.0)
	(num-test (fabs 0) 0.0)
	(num-test (fabs inf.0) inf.0)
	(test (nan? (fabs nan.0)) #t)
	(num-test (fabs 1234567.6) 1234567.6)
	(num-test (fabs -1234567.6) 1234567.6)
	(num-test (fabs -1.5) 1.5)
	
	(num-test (ceil -1) -1.0)
	(num-test (ceil 0) 0.0)
	(num-test (ceil inf.0) inf.0)
	(test (nan? (ceil nan.0)) #t)
	(num-test (ceil 1234567.6) 1234568.0)
	(num-test (ceil -1234567.6) -1234567.0)
	(num-test (ceil 1234567.5) 1234568.0)
	(num-test (ceil -1234567.5) -1234567.0)
	(num-test (ceil 32.75) 33.0)
	
	(when (not (provided? 'netbsd))
	  (num-test (nearbyint 1.5) 2.0)
	  (num-test (nearbyint 3/4) 1.0)
	  (num-test (nearbyint -63) -63.0)
	  (num-test (nearbyint inf.0) inf.0)
	  (test (nan? (nearbyint nan.0)) #t)
	  (num-test (nearbyint 1234567.6) 1234568.0)
	  (num-test (nearbyint 1234567.5) 1234568.0)
	  (num-test (nearbyint -1234567.5) -1234568.0)
	  (num-test (nearbyint 1/9223372036854775807) 0.0))
	
	(num-test (rint inf.0) inf.0)
	(test (nan? (rint nan.0)) #t)
	(num-test (rint 1234567.6) 1234568.0)
	(num-test (rint -1234567.6) -1234568.0)
	(num-test (rint 1234567.5) 1234568.0)
	(num-test (rint -1234567.5) -1234568.0)
	(num-test (rint 32.75) 33.0)
	(num-test (rint 1.5) 2.0)
	
	(num-test (llrint 3.1415926535898) 3)
	(num-test (llrint 1.5707963267949) 2)
	(num-test (llrint 1234567.6) 1234568)
	(num-test (llrint -1234567.6) -1234568)
	(num-test (llrint 1234567.5) 1234568)
	(num-test (llrint -1234567.5) -1234568)
	(num-test (llrint 32.75) 33)
	
	(num-test (llround 1.5) 2)
	(num-test (llround 3/4) 1)
	(num-test (llround 1234567.6) 1234568)
	(num-test (llround -1234567.6) -1234568)
	(num-test (llround 1234567.5) 1234568)
	(num-test (llround -1234567.5) -1234568)
	(num-test (llround 32.75) 33)
	
	(num-test (trunc 1.5707963267949) 1.0)
	(num-test (trunc inf.0) inf.0)
	(test (nan? (trunc nan.0)) #t)
	(num-test (trunc 1234567.6) 1234567.0)
	(num-test (trunc -1234567.6) -1234567.0)
	(num-test (trunc 1234567.5) 1234567.0)
	(num-test (trunc -1234567.5) -1234567.0)
	(num-test (trunc 32.75) 32.0)
	(num-test (trunc 1.5) 1.0)
	(num-test (trunc -1.5) -1.0)
	
	(test (nan? (fmod nan.0 -42.0)) #t)
	(num-test (fmod 3.1415926535898 3) 0.14159265358979)
	(num-test (fmod 32.75 -1.5) 1.25)
	(num-test (fmod 32.75 1.5) 1.25)
	
	(num-test (ldexp -1 6) -64.0)
	(num-test (ldexp 0 6) 0.0)
	(num-test (ldexp 6 6) 384.0)
	(num-test (ldexp 3.0 1) 6.0)
	(num-test (ldexp 6 0) 6.0)
	(num-test (ldexp inf.0 -1) inf.0)
	(test (nan? (ldexp nan.0 -1)) #t)
	
	(num-test (scalbn 1.5 3) 12.0)
	(num-test (scalbn 3.0 6) 192.0)
	(num-test (scalbn 1.5 1) 3.0)
	(num-test (scalbn 6 -1) 3.0)
	
	(when (not (provided? 'netbsd))
	  (num-test (scalbln inf.0 -42) inf.0)
	  (test (nan? (scalbln nan.0 -42)) #t)
	  (num-test (scalbln 3.0 3) 24.0)
	  (num-test (scalbln 0 -42) 0.0)
	  (num-test (scalbln -1.5 6) -96.0)
	  (num-test (scalbln 3.0 6) 192.0)
	  (num-test (scalbln 1 -1) 0.5)
	  (num-test (scalbln 1.5 -1) 0.75))
	
	(num-test (exp2 -1) 0.5)
	(num-test (exp2 0) 1.0)
	(num-test (exp2 1.5) 2.8284271247462)
	(num-test (exp2 3/4) 1.6817928305074)
	(num-test (exp2 6) 64.0)
	(num-test (exp2 inf.0) inf.0)
	(test (nan? (exp2 nan.0)) #t)
	
	(num-test (expm1 inf.0) inf.0)
	(test (nan? (expm1 nan.0)) #t)
	(num-test (expm1 -1) -0.63212055882856)
	(num-test (expm1 0) 0.0)
	(num-test (expm1 1) 1.718281828459)
	(num-test (expm1 1.5) 3.4816890703381)
	(num-test (expm1 3/4) 1.1170000166127)
	(num-test (expm1 -63) -1.0)
	
	(num-test (log10 inf.0) inf.0)
	(test (nan? (log10 nan.0)) #t)
	(num-test (log10 32.75) 1.5152113043278)
	(num-test (log10 1.5) 0.17609125905568)
	(num-test (log10 1) 0.0)
	(num-test (log10 1234567.6) 6.0915148751535)
	
	(num-test (log1p inf.0) inf.0)
	(if (provided? 'linux) (test (nan? (log1p nan.0)) #t))
	(num-test (log1p 1234567.6) 14.02623215528)
	(num-test (log1p 0.0) 0.0)
	(num-test (log1p 1) 0.69314718055995)
	(num-test (log1p 1.5) 0.91629073187416)
	(num-test (log1p 3/4) 0.55961578793542)
	
	(num-test (log2 inf.0) inf.0)
	(test (nan? (log2 nan.0)) #t)
	(num-test (log2 1234567.6) 20.235574404197)
	(num-test (log2 1) 0.0)
	(num-test (log2 32.75) 5.0334230015375)
	(num-test (log2 1.5) 0.58496250072116)
	
	(num-test (ilogb 3.1415926535898) 1)
	(num-test (ilogb 1.5707963267949) 0)
	(num-test (ilogb inf.0) 2147483647)
	(num-test (ilogb nan.0) (if (or (provided? 'freebsd) (provided? 'solaris)) 2147483647 -2147483648))
	(num-test (ilogb 1234567.6) 20)
	(num-test (ilogb -1234567.6) 20)
	(num-test (ilogb 1) 0)
	(num-test (ilogb 3.0) 1)
	
	(num-test (cbrt inf.0) inf.0)
	(test (nan? (cbrt nan.0)) #t)
	(num-test (cbrt 1234567.6) 107.27658956435)
	(num-test (cbrt -1) -1.0)
	(num-test (cbrt 0) 0.0)
	(num-test (cbrt 1) 1.0)
	(num-test (cbrt 1.5) 1.1447142425533)
	(num-test (cbrt 3.0) 1.4422495703074)
	
	(num-test (hypot 0 -42.0) 42.0)
	(num-test (hypot 1 3) 3.1622776601684)
	(num-test (hypot 1.5 3) 3.3541019662497)
	(num-test (hypot 3/4 3) 3.0923292192132)
	(num-test (hypot inf.0 -1.5) inf.0)
	(test (nan? (hypot nan.0 -1.5)) #t)
	(num-test (hypot 1.5 32.75) 32.784333148625)
	
	(when (not (provided? 'netbsd))
	  (num-test (fma 3.0 3 -42.0) -33.0)
	  (num-test (fma 6 -42 -42.0) -294.0)
	  (num-test (fma 1.5 -42 -42.0) -105.0)
	  (num-test (fma -1.5 -42 -42.0) 21.0)
	  (num-test (fma 3.0 -42 -42.0) -168.0)
	  (num-test (fma inf.0 1.5 -42.0) inf.0))
	
	(test (nan? (pow nan.0 -42.0)) #t)
	(num-test (pow 1 3) 1.0)
	(num-test (pow 1.5 3) 3.375)
	(num-test (pow 3/4 3) 0.421875)
	(num-test (pow -63 3) -250047.0)
	(num-test (pow 6 3) 216.0)
	(num-test (pow 0.0 3.0) 0.0)
	
	(num-test (fdim 1.5 -42) 43.5)
	(num-test (fdim -1.5 -42) 40.5)
	(num-test (fdim 3.0 -42) 45.0)
	(num-test (fdim 0 -42.0) 42.0)
	(test (nan? (fdim 0.0 nan.0)) #t)
	(num-test (fdim 1 6) 0.0)
	(num-test (fdim 32.75 6) 26.75)
	
	(num-test (tgamma 1.5) 0.88622692545276)
	(num-test (tgamma 3/4) 1.2254167024652)
	(num-test (tgamma 3.1415926535898) 2.28803779534)
	(num-test (tgamma 1.5707963267949) 0.89056089038154)
	(num-test (tgamma inf.0) inf.0)
	(test (nan? (tgamma nan.0)) #t)
	(num-test (tgamma -1.5) 2.3632718012074)
	(num-test (tgamma 3.0) 2.0)
	
	(num-test (copysign -1.5 3) 1.5)
	(num-test (copysign 3/4 -42.0) -0.75)
	(num-test (copysign inf.0 3.0) inf.0)
	(test (nan? (copysign nan.0 3.0)) #t)
	(num-test (copysign 1.5 3.0) 1.5)
	(num-test (copysign -1.5 3.0) 1.5)
	
	(num-test (nextafter 1 -42) 1.0)
	(num-test (nextafter 1.5 -42) 1.5)
	(num-test (nextafter 3/4 -42) 0.75)
	(test (nan? (nextafter nan.0 -1.5)) #t)
	(num-test (nextafter 0 -1.5) -4.9406564584125e-324)
	
	(num-test (nexttoward 0 -42) -4.9406564584125e-324)
	(num-test (nexttoward 1.5 3) 1.5)
	
	(when (not (provided? 'solaris))
	  (num-test (isfinite inf.0) 0)
	  (num-test (isfinite nan.0) 0)
	  (num-test (isfinite 1234567.6) 1)
	  (num-test (isfinite -1234567.6) 1)
	  (num-test (isfinite 9223372036854775807) 1)
	  
	  (num-test (isinf inf.0) 1)
	  (num-test (isinf nan.0) 0)
	  (num-test (isinf 1234567.6) 0)
	  (num-test (isinf -9223372036854775807) 0)
	  (num-test (isinf -1) 0)
	  (num-test (isinf 0) 0)
	  
	  (num-test (isnan inf.0) 0)
	  (num-test (isnan nan.0) 1)
	  (num-test (isnan 1234567.6) 0)
	  
	  (num-test (isnormal inf.0) 0)
	  (num-test (isnormal nan.0) 0)
	  (num-test (isnormal 1234567.6) 1)
	  (num-test (isnormal 0) 0)
	  
	  (when (defined? 'signbit)
	    (num-test (signbit 1.5) 0)
	    (num-test (signbit 0) 0)
	    (num-test (signbit inf.0) 0)
	    (num-test (signbit nan.0) 0)))
	
	(num-test (floor 1.5) 1.0)
	(num-test (floor 3/4) 0.0)
	(num-test (floor -63) -63.0)
	(num-test (floor inf.0) inf.0)
	(test (nan? (floor nan.0)) #t)
	(num-test (floor 1234567.6) 1234567.0)
	(num-test (floor -1234567.6) -1234568.0)
	(num-test (floor 1234567.5) 1234567.0)
	(num-test (floor -1234567.5) -1234568.0)
	(num-test (floor 32.75) 32.0)
	(num-test (floor 1.5) 1.0)
	(num-test (floor -1.5) -2.0)
	
	(num-test (round inf.0) inf.0)
	(test (nan? (round nan.0)) #t)
	(num-test (round 1234567.6) 1234568.0)
	(num-test (round -1234567.6) -1234568.0)
	(num-test (round 1234567.5) 1234568.0)
	(num-test (round -1234567.5) -1234568.0)
	(num-test (round 32.75) 33.0)
	(num-test (round 1.5) 2.0)
	(num-test (round -1.5) -2.0)
	
	(test (nan? (remainder nan.0 -42)) #t)
	(num-test (remainder 1234567.6 -42) 19.600000000093)
	(num-test (remainder -63 3.0) 0.0)
	(num-test (remainder 32.75 3.0) -0.25)
	(test (nan? (remainder 3.0 nan.0)) #t)
	(num-test (remainder -1.5 3/4) 0.0)
	
	(num-test (exp 1.5707963267949) 4.8104773809654)
	(num-test (exp inf.0) inf.0)
	(test (nan? (exp nan.0)) #t)
	(num-test (exp -1) 0.36787944117144)
	(num-test (exp 0) 1.0)
	(num-test (exp 1.5) 4.4816890703381)
	(num-test (exp 3/4) 2.1170000166127)
	
	(num-test (log 6) 1.7917594692281)
	(num-test (log 3.1415926535898) 1.1447298858494)
	(num-test (log 1.5707963267949) 0.45158270528945)
	(num-test (log inf.0) inf.0)
	(test (nan? (log nan.0)) #t)
	(num-test (log 1234567.6) 14.02623134528)
	(num-test (log 32.75) 3.4889029620813)
	(num-test (log 1.5) 0.40546510810816)
	
	(num-test (sqrt 0.0) 0.0)
	(num-test (sqrt 1) 1.0)
	(num-test (sqrt 1.5) 1.2247448713916)
	(num-test (sqrt 3/4) 0.86602540378444)
	(num-test (sqrt 6) 2.4494897427832)
	(num-test (sqrt 3.1415926535898) 1.7724538509055)
	(num-test (sqrt 1.5707963267949) 1.2533141373155)
	(num-test (sqrt inf.0) inf.0)
	(test (nan? (sqrt nan.0)) #t)
	(num-test (sqrt 1234567.6) 1111.1109755555)
	
	(num-test (cos 0.0) 1.0)
	(num-test (cos 1) 0.54030230586814)
	(num-test (cos 1.5) 0.070737201667703)
	(num-test (cos 3/4) 0.73168886887382)
	(num-test (cos -63) 0.98589658158255)
	(num-test (cos 6) 0.96017028665037)
	(num-test (cos 3.1415926535898) -1.0)
	(num-test (cos 1.5707963267949) 6.1232339957368e-17)
	(test (nan? (cos nan.0)) #t)
	(num-test (cos 1234567.6) -0.97435594756269)
	
	(num-test (sin 0.0) 0.0)
	(num-test (sin 1) 0.8414709848079)
	(num-test (sin 1.5) 0.99749498660405)
	(num-test (sin 3/4) 0.68163876002333)
	(num-test (sin -63) -0.16735570030281)
	(num-test (sin 6) -0.27941549819893)
	(num-test (sin 3.1415926535898) 1.2246467991474e-16)
	(num-test (sin 1.5707963267949) 1.0)
	(test (nan? (sin nan.0)) #t)
	(num-test (sin 1234567.6) -0.22501219400117)
	
	(num-test (tan 0.0) 0.0)
	(num-test (tan 1) 1.5574077246549)
	(num-test (tan 1.5) 14.101419947172)
	(num-test (tan 3/4) 0.93159645994407)
	(num-test (tan -63) -0.16974975208269)
	(num-test (tan 6) -0.29100619138475)
	(num-test (tan 3.1415926535898) -1.2246467991474e-16)
	(test (nan? (tan nan.0)) #t)
	(num-test (tan 1234567.6) 0.23093428491305)
	
	(num-test (sinh 0.0) 0.0)
	(num-test (sinh 1) 1.1752011936438)
	(num-test (sinh 1.5) 2.1292794550948)
	(num-test (sinh 3/4) 0.82231673193583)
	(num-test (sinh -63) -1.1468915797348e+27)
	(num-test (sinh 6) 201.71315737028)
	(num-test (sinh 3.1415926535898) 11.548739357258)
	(num-test (sinh 1.5707963267949) 2.3012989023073)
	(num-test (sinh inf.0) inf.0)
	(test (nan? (sinh nan.0)) #t)
	(num-test (sinh 1234567.6) inf.0)
	
	(num-test (tanh 0.0) 0.0)
	(num-test (tanh 1) 0.76159415595576)
	(num-test (tanh 1.5) 0.90514825364487)
	(num-test (tanh 3/4) 0.63514895238729)
	(num-test (tanh -63) -1.0)
	(num-test (tanh 6) 0.9999877116508)
	(num-test (tanh 3.1415926535898) 0.99627207622075)
	(num-test (tanh 1.5707963267949) 0.91715233566727)
	(num-test (tanh inf.0) 1.0)
	(test (nan? (tanh nan.0)) #t)
	(num-test (tanh 1234567.6) 1.0)
	
	(num-test (acos 1) 0.0)
	(num-test (acos 3/4) 0.72273424781342)
	(test (nan? (acos 1.5707963267949)) #t)
	(num-test (acos -1) 3.1415926535898)
	(num-test (acos 0) 1.5707963267949)
	
	(num-test (asin 0.0) 0.0)
	(num-test (asin 1) 1.5707963267949)
	(test (nan? (asin inf.0)) #t)
	(test (nan? (asin nan.0)) #t)
	(num-test (asin 3/4) 0.84806207898148)
	
	(num-test (atan 0.0) 0.0)
	(num-test (atan 1) 0.78539816339745)
	(num-test (atan 1.5) 0.98279372324733)
	(num-test (atan 3/4) 0.64350110879328)
	(num-test (atan -63) -1.5549246438031)
	(num-test (atan 6) 1.4056476493803)
	(num-test (atan 3.1415926535898) 1.2626272556789)
	(num-test (atan 1.5707963267949) 1.0038848218539)
	(num-test (atan inf.0) 1.5707963267949)
	(test (nan? (atan nan.0)) #t)
	(num-test (atan 1234567.6) 1.5707955167947)
	
	(test (nan? (atan2 nan.0 3.0)) #t)
	(num-test (atan2 -1 3) -0.32175055439664)
	(num-test (atan2 -1 32.75) -0.030524866917203)
	(num-test (atan2 0.0 3) 0.0)
	(num-test (atan2 1 3) 0.32175055439664)
	(num-test (atan2 1.5 3) 0.46364760900081)
	(num-test (atan2 3/4 3) 0.24497866312686)
	(num-test (atan2 -63 3) -1.5232132235179)
	
	(num-test (acosh 1) 0.0)
	(num-test (acosh 1.5) 0.96242365011921)
	(num-test (acosh 6) 2.4778887302885)
	(num-test (acosh 3.1415926535898) 1.8115262724609)
	(num-test (acosh 1.5707963267949) 1.0232274785476)
	(num-test (acosh inf.0) inf.0)
	(test (nan? (acosh nan.0)) #t)
	(num-test (acosh 1234567.6) 14.71937852584)
	
	(num-test (asinh 0.0) 0.0)
	(num-test (asinh 1) 0.88137358701954)
	(num-test (asinh 1.5) 1.1947632172871)
	(num-test (asinh 3/4) 0.69314718055995)
	(num-test (asinh -63) -4.8363448891593)
	(num-test (asinh 6) 2.4917798526449)
	(num-test (asinh 3.1415926535898) 1.8622957433108)
	(num-test (asinh 1.5707963267949) 1.2334031175112)
	(num-test (asinh inf.0) inf.0)
	(test (nan? (asinh nan.0)) #t)
	(num-test (asinh 1234567.6) 14.71937852584)
	
	(num-test (atanh 0.0) 0.0)
	(num-test (atanh 3/4) 0.97295507452766)
	(test (nan? (atanh nan.0)) #t)
	
	(morally-equal? (remquo -42.0 -42.0) '(0.0 1))
	(morally-equal? (remquo 1234567.5 3) '(1.5 2))
	(morally-equal? (remquo 3.1415926535898 3) '(0.14159265358979 1))
	(morally-equal? (remquo -63 3.0) '(0.0 -5))
	(morally-equal? (remquo 1 -1.5) '(-0.5 -1))
	(morally-equal? (remquo 3/4 1.5) '(0.75 0))
	
	(morally-equal? (frexp 0.0) '(0.0 0))
	(morally-equal? (frexp 1) '(0.5 1))
	(morally-equal? (frexp 1.5) '(0.75 1))
	(morally-equal? (frexp 3/4) '(0.75 0))
	(morally-equal? (frexp -63) '(-0.984375 6))
	(morally-equal? (frexp 6) '(0.75 3))
	(morally-equal? (frexp 3.1415926535898) '(0.78539816339745 2))
	(morally-equal? (frexp 1.5707963267949) '(0.78539816339745 1))
	(morally-equal? (frexp inf.0) '(inf.0 0))
	(morally-equal? (frexp nan.0) '(nan.0 0))
	(morally-equal? (frexp 1234567.6) '(0.58868770599365 21))
	
	(morally-equal? (modf 0.0) '(0.0 0.0))
	(morally-equal? (modf 1) '(0.0 1.0))
	(morally-equal? (modf 1.5) '(0.5 1.0))
	(morally-equal? (modf 3/4) '(0.75 0.0))
	(morally-equal? (modf -63) '(0.0 -63.0))
	(morally-equal? (modf 6) '(0.0 6.0))
	(morally-equal? (modf 3.1415926535898) '(0.14159265358979 3.0))
	(morally-equal? (modf 1.5707963267949) '(0.5707963267949 1.0))
	(morally-equal? (modf inf.0) '(0.0 inf.0))
	(morally-equal? (modf nan.0) '(nan.0 nan.0))
	(morally-equal? (modf 1234567.6) '(0.60000000009313 1234567.0))))))

;; now check for leaks
(test (defined? 'remquo) #f)
(test (defined? 'M_LN2) #f)
(num-test (sin 1+i) 1.298457581415977+0.6349639147847361i)
(test (integer? (round 123.3)) #t)


;;; --------------------------------------------------------------------------------
;;; libc

(unless (provided? 'windows)
  (let ()
    (require libc.scm)
    (when (and (defined? '*libc*)
	       (procedure? (*libc* 'passwd.pw_name)))
      (with-let (sublet *libc*)
	
	(test (let ((buf (make-string 20 #\null)))
		(strcat buf "All ")
		(strcat buf "for ")
		(strcat buf "one.")
		(substring buf 0 12))
	      "All for one.")
	(test (strcmp "a" "b") -1)
	(test (strcmp "a" "a") 0)
	(test (strncmp "1234" "1235" 3) 0)
	(test (strcpy (make-string 3) "123") "123")
	(test (strlen "123") 3)
	(test (strchr "12345" (char->integer #\3)) "345")
	(test (strspn "12345" "123") 3)
	(test (isalpha (char->integer #\.)) 0)
	(test (zero? (isdigit (char->integer #\2))) #f)
	(test (integer->char (toupper (char->integer #\a))) #\A)
	(test (let ((buf (malloc 3))) 
		(memset buf 90 3) 
		(let ((result (c-pointer->string buf 3)))
		  (free buf) 
		  result)) 
	      "ZZZ")
	
	(define get-environment-variable getenv)
	(define get-environment-variables getenvs)
	(define* (set-environment-variable x v (overwrite #t)) (setenv x v (if overwrite 1 0)))
	(define delete-environment-variable unsetenv)
	
	(define (file-exists? file)
	  (= (access file F_OK) 0))
	
	(define delete-file unlink)
	;; system can be used as is
	
	(define* (ls dir-name (port *stderr*))
	  (let ((dir (opendir dir-name)))
	    (do ((p (read_dir dir) (read_dir dir)))
		((= (length p) 0))
	      (format port "~A " p))
	    (closedir dir)))
	
	(define (directory->list dir-name)
	  (let ((lst ())
		(dir (opendir dir-name)))
	    (do ((p (read_dir dir) (read_dir dir)))
		((= (length p) 0))
	      (if (not (member p '("." "..")))
		  (set! lst (cons p lst)))) ; read_dir in libc.scm returns dpos->d_name
	    (closedir dir)
	    lst))
	
	(define (memory-usage)
	  (let ((v (rusage.make))) 
	    (getrusage RUSAGE_SELF v)
	    (let ((mem (rusage.ru_maxrss v))) 
	      (free v) 
	      (* 1024 mem))))
	
	(define (os-type) (car (uname)))
	(define (cpu-architecture) (cadr (uname)))
	(define (machine-name) (caddr (uname)))
	(define (os-version) (string-append (list-ref (uname) 3) " " (list-ref (uname) 4)))
	(define (implementation-name) "s7")
	(define (implementation-version) (substring (s7-version) 3 7))
	
	(reader-cond ((and (not (provided? 'openbsd)) (not (provided? 'solaris)))
		      (define (word-size) __WORDSIZE)))
	(reader-cond ((and (not (provided? 'openbsd)) (not (provided? 'solaris)))
		      (define (little-endian?) (= __BYTE_ORDER __LITTLE_ENDIAN))))
	
	(define (command-line)
	  (let ((lst ()))
	    (with-input-from-file "/proc/self/cmdline"
	      (lambda ()
		(do ((c (read-char) (read-char))
		     (s ""))
		    ((eof-object? c)
		     (reverse lst))
		  (if (char=? c #\null)
		      (begin
			(set! lst (cons s lst))
			(set! s ""))
		      (set! s (string-append s (string c)))))))))
	
	(define (daytime)
	  (let ((timestr (make-string 64))) 
	    (let ((len (strftime timestr 64 "%a %d-%b-%Y %H:%M %Z"
				 (localtime 
				  (time.make (time 
					      (c-pointer 0 'time_t*)))))))
	      (substring timestr 0 len))))
	
	(define (write-date file)
	  (let ((buf (stat.make)))
	    (and (stat file buf)
		 (stat.st_mtime buf))))
	
	(define (file-write-date->string file)
	  (let ((timestr (make-string 64))) 
	    (let ((len (strftime timestr 64 "%a %d-%b-%Y %H:%M %Z" (localtime (time.make (write-date file))))))
	      (substring timestr 0 len))))
	
	(define (copy-file in-file out-file)
	  (with-let (sublet *libc* 
		      (inlet 'in-file in-file 'out-file out-file))
	    (let ((infd (open in-file O_RDONLY 0)))
	      (if (= infd -1)
		  (error 'io-error "can't find ~S~%" in-file)
		  (let ((outfd (creat out-file #o666)))
		    (if (= outfd -1)
			(begin
			  (close infd)
			  (error 'io-error "can't open ~S~%" out-file))
			(let* ((BUF_SIZE 1024)
			       (buf (malloc BUF_SIZE)))
			  (do ((num (read infd buf BUF_SIZE) (read infd buf BUF_SIZE)))
			      ((or (<= num 0)
				   (not (= (write outfd buf num) num)))))
			  (close outfd)
			  (close infd)
			  (free buf)
			  out-file)))))))
	
	(define (tty-direct) ; run in a non-GUI repl
	  (with-let (sublet *libc*)
	    (call-with-exit
	     (lambda (quit)
	       (let ((saved (termios.make))
		     (fn (fileno stdin)))
		 (define (tty_reset fd)
		   (tcsetattr fd TCSAFLUSH saved))
		 (define (sigcatch no)
		   (tty_reset fn)
		   (quit))
		 (if (or (equal? (signal SIGINT sigcatch) SIG_ERR)
			 (equal? (signal SIGQUIT sigcatch) SIG_ERR)
			 (equal? (signal SIGTERM sigcatch) SIG_ERR)
			 (negative? (tcgetattr fn saved)))
		     (quit))
		 (let ((buf (termios.make))
		       (c (string #\null #\null)))
		   (let ((cc (string->c-pointer c)))
		     (tcgetattr fn buf)
		     (termios.set_c_lflag buf (logand (termios.c_lflag buf) (lognot (logior ECHO ICANON))))
		     (termios.set_c_cc buf VMIN 1)
		     (termios.set_c_cc buf VTIME 0)
		     (if (negative? (tcsetattr fn TCSAFLUSH buf))
			 (quit))
		     (do ((i (read fn cc 1) (read fn cc 1)))
			 ((not (= i 1))
			  (tty_reset fn)
			  (quit))
		       (format *stderr* "got ~C~%" (c 0))))))))))
	
	;; to write a directory files + file size:
	(test (string? (with-output-to-string
			 (lambda ()
			   (ftw "/home/bil/sf1" 
				(lambda (a b c) 
				  (format () "~A ~A~%" a ((*libc* 'stat.st_size) b))
				  0) 10))))
	      #t)

	(define (directory? file)
	  (let ((buf (stat.make)))
	    (let ((result (and (stat file buf)
			       (S_ISDIR (stat.st_mode buf)))))
	      (free buf)
	      result)))
	
	(define* (home-directory name)
	  (if (not name)
	      (getenv "HOME")
	      (passwd.pw_dir (getpwnam name))))
	
	(define (file-length file)
	  (let ((buf (stat.make)))
	    (stat file buf)
	    (let ((result (stat.st_size buf)))
	      (free buf)
	      result)))
	
	(define (system-limits)
	  (list 'arg-max (sysconf _SC_ARG_MAX)
		'login-max (sysconf _SC_LOGIN_NAME_MAX)
		'open-max (sysconf _SC_OPEN_MAX)
		'groups-max (sysconf _SC_NGROUPS_MAX)
		'page-size (sysconf _SC_PAGESIZE)))
	
	(test (string? (getcwd (make-string 1024 #\space) 1024)) #t)
	(test (string? (get-environment-variable "HOME")) #t)
	(test (integer? (random)) #t)
	(test ((localeconv) 'decimal_point) ".")
	(test (string? (getlogin)) #t)
	(test (integer? (getpid)) #t)
	(test (integer? _POSIX_VERSION) #t)
	(if (provided? 'linux) (test (>= __GLIBC__ 2) #t))
	(test (c-null? (c-pointer 0)) #t)
	(test (fnmatch "*.c" "s7.c" FNM_PATHNAME) 0)
	(test (string? (realpath "s7.c" (string))) #t) ; second arg is simply ignored
	(test (string? (realpath "s7.c" #f)) #t)
	(let ((log (getlogin)))  ; this is null in an emacs shell!
	  (when (and (string? log)
		     (> (string-length log) 0))
	    (test (passwd.pw_name (getpwnam (getlogin))) (getlogin))
	    (test (string? (passwd.pw_shell (getpwnam (getlogin)))) #t)))
	(reader-cond ((not (provided? 'openbsd)) 
		      (test (string? (car (let ((w (wordexp.make))) (wordexp "~/cl/snd-gdraw" w 0) (wordexp.we_wordv w)))) #t)))
	(test (pair? (system-limits)) #t)
	(test (> (file-length "s7test.scm") 4000000) #t)
	(test (string? (home-directory)) #t)
	(test (directory? (home-directory)) #t)
	(test (string? (file-write-date->string "s7test.scm")) #t)
	(if (provided? 'linux) (test (string? (car (command-line))) #t))
	(test (string? (daytime)) #t)
	(reader-cond ((and (not (provided? 'openbsd)) (not (provided? 'solaris)))
		      (test (not (member (word-size) '(32 64))) #f)))
	(reader-cond ((provided? 'linux) (test (os-type) "Linux"))
		     ((provided? 'osx) (test (os-type) "Darwin"))
		     ((provided? 'freebsd) (test (os-type) "FreeBSD"))
		     ((provided? 'netbsd) (test (os-type) "NetBSD"))
		     ((provided? 'openbsd) (test (os-type) "OpenBSD"))
		     ((provided? 'solaris) (test (os-type) "SunOS"))
		     (#t (test (os-type) "Unknown")))
	(test (integer? (memory-usage)) #t)
	(test (file-exists? "s7test.scm") #t)
	(test (atoi "123") 123)
	(test (llabs -1234) 1234)
	(test (strtod "1.5") 1.5)
	(test CLOCKS_PER_SEC 1000000)
	(test (*libc* 'INT8_MIN) -128)
	(test (not (member (group.gr_name (getgrnam "wheel")) '("" "wheel"))) #f)
	(test (group.gr_name (getgrgid 0)) "root")
	(test (group.gr_gid (getgrnam "root")) 0)
	(test (let ((g (glob.make))) (glob "s7t*.scm" 0 g) (let ((res (glob.gl_pathv g))) (globfree g) res)) '("s7test.scm"))
	(test (fegetround) 0)
	(test (fegetenv (fenv_t.make)) 0)
	(test (let ((file (fopen "s7test.scm" "r")))
		(let ((c (getc file)))
		  (fclose file)
		  (integer->char c)))
	      #\;)

	))))

(if (defined? '*libc*) (format *stderr* "*libc* is defined~%"))
(if (equal? (arity random) '(0 . 0)) (format *stderr* "libc random is global~%"))


;;; --------------------------------------------------------------------------------
;;; libgsl

(when (or (provided? 'linux)
	  (provided? 'osx))
  (let ()
    (require libgsl.scm)
    (when (and (defined? '*libgsl*)
	       (procedure? (*libgsl* 'gsl_vector_equal)))
      (with-let (sublet *libgsl*)
	
	(define (eigenvalues M)
	  (with-let (sublet *libgsl* (inlet 'M M))
	    (let* ((len (sqrt (length M)))
		   (gm (gsl_matrix_alloc len len))
		   (m (float-vector->gsl_matrix M gm))
		   (evl (gsl_vector_complex_alloc len))
		   (evc (gsl_matrix_complex_alloc len len))
		   (w (gsl_eigen_nonsymmv_alloc len)))
	      
	      (gsl_eigen_nonsymmv m evl evc w)
	      (gsl_eigen_nonsymmv_free w)
	      (gsl_eigen_nonsymmv_sort evl evc GSL_EIGEN_SORT_ABS_DESC)
	      
	      (let ((vals (make-vector len)))
		(do ((i 0 (+ i 1)))
		    ((= i len))
		  (set! (vals i) (gsl_vector_complex_get evl i)))
		(gsl_matrix_free gm)
		(gsl_vector_complex_free evl)
		(gsl_matrix_complex_free evc)
		vals))))
	
	(test (eigenvalues (float-vector 3 1 1 3)) #(4.0 2.0))
	(test (eigenvalues (float-vector 1 2 4 3)) #(5.0 -1.0))
	
	(num-test GSL_CONST_CGS_LIGHT_YEAR 9.460536207070001e+17)
	(num-test (GSL_SIGN -123) -1)
	(test (GSL_IS_ODD 4) #f)
	(test (integer? GSL_SF_FACT_NMAX) #t)
	
	(num-test (gsl_sf_airy_Ai -500.0 GSL_MODE_DEFAULT) 0.07259012010418163)
	(num-test (gsl_sf_airy_Bi -500.0 GSL_MODE_DEFAULT) -0.0946885701328829)
	(num-test (gsl_sf_airy_Ai_scaled -5.0 GSL_MODE_DEFAULT) 0.3507610090241141)
	(num-test (gsl_sf_airy_Bi_scaled -5.0 GSL_MODE_DEFAULT) -0.1383691349016009)
	(num-test (gsl_sf_airy_Ai_deriv -5.0 GSL_MODE_DEFAULT) 0.3271928185544435)
	(num-test (gsl_sf_airy_Bi_deriv -5.0 GSL_MODE_DEFAULT) 0.778411773001899)
	(num-test (gsl_sf_airy_Ai_deriv_scaled -5.0 GSL_MODE_DEFAULT) 0.3271928185544435)
	(num-test (gsl_sf_airy_Bi_deriv_scaled -5.0 GSL_MODE_DEFAULT) 0.778411773001899)
	(num-test (gsl_sf_airy_zero_Ai_deriv 2) -3.248197582179837)
	(num-test (gsl_sf_airy_zero_Bi_deriv 2) -4.073155089071828)
	(num-test (gsl_sf_bessel_J0 1.0) 0.7651976865579666)
	(num-test (let ((sfr (gsl_sf_result.make))) (gsl_sf_bessel_J0_e 1.0 sfr) (gsl_sf_result.val sfr)) 0.7651976865579666)
	(num-test (let ((sfr (gsl_sf_result.make))) (gsl_sf_bessel_J0_e 1.0 sfr) (gsl_sf_result.err sfr)) 6.72613016567227e-16)
	(num-test (gsl_sf_bessel_J0 .1) 0.9975015620660401)
	(num-test (gsl_sf_bessel_J1 .1) 0.049937526036242)
	(num-test (gsl_sf_bessel_Jn 45 900.0) 0.02562434700634277)
	(num-test (gsl_sf_bessel_Y0 .1) -1.534238651350367)
	(num-test (gsl_sf_bessel_Y1 .1) -6.458951094702027)
	(num-test (gsl_sf_bessel_Yn 4 .1) -305832.2979335312)
	(num-test (gsl_sf_bessel_I0_scaled .1) 0.9071009257823011)
	(num-test (gsl_sf_bessel_I1_scaled .1) 0.04529844680880932)
	(num-test (gsl_sf_bessel_In_scaled 4 .1) 2.35752586200546e-07)
	(num-test (gsl_sf_bessel_I0 .1) 1.002501562934096)
	(num-test (gsl_sf_bessel_I1 .1) 0.05006252604709269)
	(num-test (gsl_sf_bessel_In 4 .1) 2.605469021299657e-07)
	(num-test (gsl_sf_bessel_K0_scaled .1) 2.682326102262894)
	(num-test (gsl_sf_bessel_K1_scaled .1) 10.8901826830497)
	(num-test (gsl_sf_bessel_Kn_scaled 4 .1) 530040.2483725621)
	(num-test (gsl_sf_bessel_K0 .1) 2.427069024702016)
	(num-test (gsl_sf_bessel_K1 .1) 9.853844780870606)
	(num-test (gsl_sf_bessel_Kn 4 .1) 479600.2497925678)
	(num-test (gsl_sf_bessel_j0 1.0) 0.8414709848078965)
	(num-test (gsl_sf_bessel_j1 1.0) 0.3011686789397567)
	(num-test (gsl_sf_bessel_j2 1.0) 0.06203505201137386)
	(num-test (gsl_sf_bessel_jl 5 1.0) 9.256115861125814e-05)
	(num-test (gsl_sf_bessel_zero_J0 1) 2.404825557695771)
	(num-test (gsl_sf_bessel_zero_Jnu 5 5) 22.21779994656127)
	(num-test (gsl_sf_hydrogenicR_1 3 2) 0.02575994825614847)
	(num-test (gsl_sf_dilog -3.0) -1.939375420766708)
	(let ((s1 (gsl_sf_result.make)) 
	      (s2 (gsl_sf_result.make))) 
	  (gsl_sf_complex_dilog_e 0.99999 (/ pi 2) s1 s2) 
	  (num-test (gsl_sf_result.val s1) -0.2056132926277968)
	  (num-test (gsl_sf_result.val s2) 0.9159577401813151))
	(let ((s1 (gsl_sf_result.make)) 
	      (s2 (gsl_sf_result.make))) 
	  (gsl_sf_complex_spence_xy_e 0.5 0.0 s1 s2) 
	  (num-test (gsl_sf_result.val s1) 0.5822405264650126)
	  (num-test (gsl_sf_result.val s2) 0.0))
	(num-test (gsl_sf_lngamma -0.1) 2.368961332728787)
	(num-test (gsl_sf_gamma 9.0) 40320.0)
	(num-test (gsl_sf_gammastar 9.0) 1.009298426421819)
	(num-test (gsl_sf_gammainv -1.0) 0.0)
	(let ((s1 (gsl_sf_result.make)) 
	      (s2 (gsl_sf_result.make))) 
	  (gsl_sf_lngamma_complex_e 5.0 2.0 s1 s2) 
	  (num-test (gsl_sf_result.val s1) 2.748701756133804)
	  (num-test (gsl_sf_result.val s2) 3.073843410049702))
	(num-test (gsl_sf_taylorcoeff 10 5) 2.691144455467373)
	(num-test (gsl_sf_choose 7 3) 35.0)
	(num-test (gsl_sf_poch 7 3) 504.0000000000001)
	(num-test (gsl_sf_gamma_inc_P 1.0 10.0) 0.9999546000702381)
	(num-test (gsl_sf_lnbeta 0.1 1.0) 2.302585092994044)
	(num-test (gsl_sf_beta 100.1 -1.2) 1203.895236907804)
	(num-test (gsl_sf_hyperg_0F1 1 0.5) 1.56608292975635)
	(num-test (gsl_sf_hyperg_1F1 1 1.5 1) 2.030078469278705)
	(num-test (gsl_sf_hyperg_U_int 100 100 1) 0.009998990209084679)
	(num-test (gsl_sf_hyperg_2F1 1 1 1 0.5) 2.0)
	(num-test (gsl_sf_legendre_P1 -0.5) -0.5)
	(num-test (gsl_sf_legendre_sphPlm 10 0 -0.5) -0.2433270236930014)
	(num-test (gsl_sf_legendre_Q0 -0.5) -0.5493061443340549)
	(num-test (gsl_sf_clausen (+ (* 2 pi) (/ pi 3))) 1.014941606409653)
	(num-test (gsl_sf_coupling_3j 0 1 1 0 1 -1) 0.7071067811865476)
	(num-test (gsl_sf_dawson 0.5) 0.4244363835020223)
	(num-test (gsl_sf_multiply -3 2) -6.0)
	(num-test (gsl_sf_ellint_E (/ pi 2) 0.5 GSL_MODE_DEFAULT) 1.467462209339427)
	(num-test (gsl_sf_erfc -10) 2.0)
	(num-test (gsl_sf_exp_mult 10 -2) -44052.93158961344)
	(num-test (gsl_sf_expm1 -.001) -0.0009995001666250082)
	(num-test (gsl_sf_Shi -1) -1.057250875375728)
	(num-test (gsl_sf_fermi_dirac_0 -1) 0.3132616875182229)
	(num-test (gsl_sf_gegenpoly_1 1.0 1.0) 2.0)
	
	(let ((p (float-vector 1.0 -2.0 1.0)) (res (vector 0.0 0.0)))
	  (gsl_poly_complex_solve (double* p) 3 res)
	  (test res #(1.0 1.0)))
	(let ((p (float-vector 1 -1 1 -1 1 -1 1 -1 1 -1 1)))
	  (num-test (gsl_poly_eval (double* p) 11 1.0) 1.0))
	(let ((p (float-vector 2.1 -1.34 0.76 0.45)))
	  (num-test (gsl_poly_complex_eval (double* p) 4 0.49+0.95i) 0.3959142999999998-0.6433305000000001i))
	(let ((res (float-vector 0.0 0.0)))
	  (let ((err (gsl_poly_solve_quadratic 4.0 -20.0 26.0 (double* res))))
	    (test err 0)))
	(let ((res (float-vector 0.0 0.0)))
	  (let ((err (gsl_poly_solve_quadratic 4.0 -20.0 21.0 (double* res))))
	    (test res (float-vector 1.5 3.5))))
	(let ((res (float-vector 0.0 0.0 0.0)))
	  (let ((err (gsl_poly_solve_cubic -51 867 -4913 (double* res))))
	    (test res (float-vector 17.0 17.0 17.0))))
	(let ((res (vector 0.0 0.0)))
	  (let ((err (gsl_poly_complex_solve_quadratic 4.0 -20.0 26.0 res)))
	    (test res #(2.5-0.5i 2.5+0.5i))))
	(let ((res (vector 0.0 0.0 0.0))) ; workspace handling is internal
	  (let ((err (gsl_poly_complex_solve_cubic -51 867 -4913 res)))
	    (test res #(17.0 17.0 17.0))))
	
	(num-test (gsl_hypot3 1.0 1.0 1.0) (sqrt 3))
	(num-test (gsl_hypot 1.0 1.0) (sqrt 2))
	(test (nan? (gsl_nan)) #t)
	(test (infinite? (gsl_posinf)) #t)
	(test (gsl_frexp 2.0) '(0.5 2))
	(num-test (gsl_pow_2 4) 16.0)
	
	(num-test (gsl_cdf_ugaussian_P 0.0) 0.5)
	(num-test (gsl_cdf_ugaussian_P 0.5) 0.691462461274013)
	(num-test (gsl_cdf_ugaussian_Q 0.5) 0.3085375387259869)
	(num-test (gsl_cdf_ugaussian_Pinv 0.5) 0.0)
	(num-test (gsl_cdf_ugaussian_Qinv 0.5) 0.0)
	(num-test (gsl_cdf_exponential_P 0.1 0.7) 0.1331221002498184)
	(num-test (gsl_cdf_exponential_Q 0.1 0.7) 0.8668778997501816)
	(num-test (gsl_cdf_exponential_Pinv 0.13 0.7) 0.09748344713345537)
	(num-test (gsl_cdf_exponential_Qinv 0.86 0.7) 0.1055760228142086)
	(num-test (gsl_cdf_exppow_P -0.1 0.7 1.8) 0.4205349082867516)
	(num-test (gsl_cdf_exppow_Q -0.1 0.7 1.8) 0.5794650917132484)
	(num-test (gsl_cdf_tdist_P 0.0 1.0) 0.5)
	(num-test (gsl_cdf_tdist_Q 0.0 1.0) 0.5)
	(num-test (gsl_cdf_fdist_P 0.0 1.0 1.3) 0.0)
	(num-test (gsl_cdf_fdist_Q 0.0 1.0 1.3) 1.0)
	(num-test (gsl_cdf_fdist_Pinv 0.0 1.0 1.3) 0.0)
	(num-test (gsl_cdf_fdist_Qinv 1.0 1.0 1.3) 0.0)
	(num-test (gsl_cdf_gamma_P 0 1 1) 0.0)
	(num-test (gsl_cdf_gamma_Q 0 1 1) 1.0)
	(num-test (gsl_cdf_chisq_P 0 13) 0.0)
	(num-test (gsl_cdf_chisq_Q 0 13) 1.0)
	(num-test (gsl_cdf_beta_P 0 1.2 1.3) 0.0)
	(num-test (gsl_cdf_beta_Q 0 1.2 1.3) 1.0)
	#|
	;; this is *very* slow!
	(let ((d (gsl_dht_new 128 1.0 1.0))
	(f_in (make-float-vector 128 0.0))
	(f_out (make-float-vector 128 0.0)))
	(do ((i 0 (+ i 1)))
	((= i 128))
	(let ((x (gsl_dht_x_sample d i)))
	(set! (f_in i) (* x (- 1.0 (* x x))))))
	(gsl_dht_apply d (double* f_in) (double* f_out))
	(let ((res (list (f_out 0) (f_out 5))))
	(gsl_dht_free d)
	(num-test (res 0) 0.05727421417071144)
	(num-test (res 1) -0.0001908501261051786)))
	|#	  
	(num-test (gsl_stats_mean (double* (float-vector 1.0 2.0 3.0 4.0)) 1 4) 2.5)
	(num-test (gsl_stats_skew (double* (float-vector 1.0 2.0 3.0 4.0)) 1 4) 0.0)
	(num-test (gsl_stats_max (double* (float-vector 1.0 2.0 3.0 4.0)) 1 4) 4.0)
	
	(let ((rng (gsl_rng_alloc gsl_rng_default)))
	  (test (real? (gsl_ran_exponential rng 1.0)) #t)
	  (gsl_rng_free rng))
	
	(num-test (gsl_complex_log 1+i) (log 1+i))
	(num-test (gsl_complex_abs 1+i) (magnitude 1+i))
	(num-test (gsl_complex_sin 1+i) (sin 1+i))
	
	(let ((gs (gsl_cheb_alloc 40)))
	  (gsl_cheb_init gs (lambda (x) x) -1.0 1.0)
	  (num-test (gsl_cheb_eval gs -1.0) -1.0)
	  (num-test (gsl_cheb_eval gs 0.0) 0.0)
	  (num-test (gsl_cheb_eval gs 1.0) 1.0)
	  (gsl_cheb_free gs))
	
	(let ((x (float-vector 0.0)) 
	      (y (float-vector 0.0))) 
	  (gsl_deriv_central (lambda (x) (expt x 1.5)) 2.0 1e-8 (double* x) (double* y))
	  (num-test (x 0) (* 1.5 (sqrt 2)))
	  (gsl_deriv_forward (lambda (x) (expt x 1.5)) 0.0 1e-8 (double* x) (double* y))
	  (num-test (x 0) 0.0))
	
	(let ((f (float-vector -1 3 0 4 2 6)))
	  (gsl_sort (double* f) 1 6)
	  (test f (float-vector -1 0 2 3 4 6)))
	
	(let ((g1 (gsl_vector_alloc 3))
	      (g2 (gsl_vector_alloc 3))
	      (f1 (make-float-vector 3)))
	  (gsl_vector_add (float-vector->gsl_vector (float-vector 0 1 2) g1)
			  (float-vector->gsl_vector (float-vector 3 4 5) g2))
	  (gsl_vector->float-vector g1 f1)
	  (gsl_vector_free g1)
	  (gsl_vector_free g2)
	  (test f1 (float-vector 3 5 7)))
	
	(let ((f (make-float-vector '(3 3))))
	  (let ((g (gsl_matrix_alloc 3 3)))
	    (gsl_matrix_set_identity g) 
	    (do ((i 0 (+ i 1)))
		((= i 3) 
		 (gsl_matrix_free g))
	      (do ((j 0 (+ j 1)))
		  ((= j 3))
		(set! (f i j) (gsl_matrix_get g i j)))))
	  (test (morally-equal? f #2D((1.0 0.0 0.0) (0.0 1.0 0.0) (0.0 0.0 1.0))) #t))
	
	(let ((f (make-vector '(3 3))))
	  (let ((g (gsl_matrix_complex_alloc 3 3)))
	    (gsl_matrix_complex_set_identity g)
	    (gsl_matrix_complex_scale g 1+i)
	    (do ((i 0 (+ i 1)))
		((= i 3) 
		 (gsl_matrix_complex_free g))
	      (do ((j 0 (+ j 1)))
		  ((= j 3))
		(set! (f i j) (gsl_matrix_complex_get g i j)))))
	  (test (morally-equal? f #2D((1+i 0.0 0.0) (0.0 1+i 0.0) (0.0 0.0 1+i))) #t))
	
	(let ((Y (float-vector 0.554))
	      (A (float-vector -0.047))
	      (X (float-vector 0.672)))
	  (cblas_dgemv 101 111 1 1 -0.3 (double* A) 1 (double* X) -1 -1 (double* Y) -1)
	  (num-test (Y 0) -0.5445248))
	
	(let ((Y (float-vector 0.348 0.07))
	      (A (float-vector 0.932 -0.724))
	      (X (float-vector 0.334 -0.317)) 
	      (alpha (float-vector 0 .1)) 
	      (beta (float-vector 1 0)))
	  (cblas_zgemv 101 111 1 1 (double* alpha) (double* A) 1 (double* X) -1 (double* beta) (double* Y) -1)
	  (num-test (Y 0) 0.401726)
	  (num-test (Y 1) 0.078178))
	
	(test (let ((f (float-vector 0 1 2 3 4))) (gsl_interp_bsearch (double* f) 1.5 0 4)) 1)
	
	(let ((x (make-float-vector 10))
	      (y (make-float-vector 10)))
	  (do ((i 0 (+ i 1)))
	      ((= i 10))
	    (set! (x i) (+ i (* 0.5 (sin i))))
	    (set! (y i) (+ i (cos (* i i)))))
	  (let ((acc (gsl_interp_accel_alloc))
		(spline (gsl_spline_alloc gsl_interp_cspline 10)))
	    (gsl_spline_init spline (double* x) (double* y) 10)
	    (let ((res (gsl_spline_eval spline (x 5) acc)))
	      (gsl_spline_free spline)
	      (gsl_interp_accel_free acc)
	      (num-test res 5.991202811863474))))
	
	(let ((c (gsl_combination_alloc 6 3))
	      (data #2d((0 1 2) (0 1 3) (0 1 4) (0 1 5)
			(0 2 3) (0 2 4) (0 2 5) (0 3 4)
			(0 3 5) (0 4 5) (1 2 3) (1 2 4)
			(1 2 5) (1 3 4) (1 3 5) (1 4 5)
			(2 3 4) (2 3 5) (2 4 5) (3 4 5)))
	      (iv (make-int-vector 3 0)))
	  (gsl_combination_init_first c)
	  (do ((i 0 (+ i 1)))
	      ((= i 20))
	    ((*libgsl* 'gsl_combination->int-vector) c iv)
	    (if (not (morally-equal? iv (data i)))
		(format *stderr* ";gsl_combination: ~A ~A~%" iv (data i)))
	    (gsl_combination_next c))
	  (gsl_combination_free c))
	
	(let ((p (gsl_permutation_alloc 3)) 
	      (data (make-int-vector 18 0)))
	  (gsl_permutation_init p)
	  (do ((pp GSL_SUCCESS (gsl_permutation_next p)) 
	       (i 0 (+ i 3)))
	      ((not (= pp GSL_SUCCESS)))
	    (set! (data i) (gsl_permutation_get p 0))
	    (set! (data (+ i 1)) (gsl_permutation_get p 1))
	    (set! (data (+ i 2)) (gsl_permutation_get p 2)))
	  (gsl_permutation_free p)
	  (test (morally-equal? data #(0 1 2 0 2 1 1 0 2 1 2 0 2 0 1 2 1 0)) #t))
	
	(let ((N 50))
	  (let ((t (make-float-vector N 0.0)))
	    (do ((i 0 (+ i 1)))
		((= i N))
	      (set! (t i) (/ 1.0 (* (+ i 1) (+ i 1)))))
	    (let ((zeta_2 (/ (* pi pi) 6.0)))
	      (let ((accel (float-vector 0.0))
		    (err (float-vector 0.0))
		    (w (gsl_sum_levin_u_alloc N)))
		(gsl_sum_levin_u_accel (double* t) N w (double* accel) (double* err))
		(num-test zeta_2 (accel 0))
		(gsl_sum_levin_u_free w)))))
	
	(let ((data (float-vector 0 0  1 0  1 1  0 -1)) ; complex data as rl+im coming and going
	      (output (make-float-vector 8 0.0)))
	  (gsl_dft_complex_forward (double* data) 1 4 (double* output)) 
	  ;; = -1 in snd terminology: (cfft! (vector 0 1 1+i 0-i) 4 -1): #(2.0 0-2i 0+2i -2.0)
	  (test (morally-equal? output (float-vector 2.0 0.0  0.0 -2.0  0.0 2.0  -2.0 0.0)) #t))
	(let ((data (float-vector 0 0  1 0  1 1  0 -1))) ; complex data as rl+im coming and going
	  (gsl_fft_complex_radix2_forward (double* data) 1 4)
	  (test (morally-equal? data (float-vector 2.0 0.0  0.0 -2.0  0.0 2.0  -2.0 0.0)) #t))
	
	(let ((data (make-float-vector 256))
	      (w (gsl_wavelet_alloc gsl_wavelet_daubechies 4))
	      (work (gsl_wavelet_workspace_alloc 256)))
	  (do ((i 0 (+ i 1)))
	      ((= i 256))
	    (set! (data i) (sin (* i (/ pi 128)))))
	  (gsl_wavelet_transform_forward w (double* data) 1 256 work)
	  (gsl_wavelet_transform_inverse w (double* data) 1 256 work)
	  (gsl_wavelet_free w)
	  (gsl_wavelet_workspace_free work)
	  data)
	
	(let ((h (gsl_histogram_alloc 10))
	      (data (make-int-vector 10)))
	  (gsl_histogram_set_ranges_uniform h 0.0 1.0)
	  (do ((i 0 (+ i 1)))
	      ((= i 50))
	    (gsl_histogram_increment h (random 1.0)))
	  (do ((i 0 (+ i 1)))
	      ((= i 10))
	    (set! (data i) (round (gsl_histogram_get h i))))
	  (gsl_histogram_free h)
	  data)
	
	(let ((a_data (float-vector 0.18 0.60 0.57 0.96  0.41 0.24 0.99 0.58  0.14 0.30 0.97 0.66  0.51 0.13 0.19 0.85))
	      (b_data (float-vector 1 2 3 4)))
	  (let ((m (gsl_matrix_alloc 4 4))
		(b (gsl_vector_alloc 4)))
	    (let ((x (gsl_vector_alloc 4))
		  (p (gsl_permutation_alloc 4)))
	      (do ((i 0 (+ i 1)))
		  ((= i 4))
		(do ((j 0 (+ j 1)))
		    ((= j 4))
		  (gsl_matrix_set m i j (a_data (+ j (* i 4))))))
	      (do ((i 0 (+ i 1)))
		  ((= i 4))
		(gsl_vector_set b i (b_data i)))
	      (gsl_linalg_LU_decomp m p) ; int-by-ref is internal
	      (gsl_linalg_LU_solve m p b x)
	      (do ((i 0 (+ i 1)))
		  ((= i 4))
		(set! (b_data i) (gsl_vector_get x i)))
	      (gsl_permutation_free p)
	      (gsl_vector_free x)
	      b_data)))
	
	(when (>= gsl-version 1.16)
	  (let ()
	    (define (dofit T X y c cov)
	      (let ((work (gsl_multifit_robust_alloc T (car (gsl_matrix_size X)) (cdr (gsl_matrix_size X)))))
		(let ((s (gsl_multifit_robust X y c cov work)))
		  (gsl_multifit_robust_free work)
		  s)))
	    (let* ((n 30)
		   (p 2)
		   (a 1.45)
		   (b 3.88)
		   (X (gsl_matrix_alloc n p))
		   (x (gsl_vector_alloc n))
		   (y (gsl_vector_alloc n))
		   (c (gsl_vector_alloc p))
		   (c_ols (gsl_vector_alloc p))
		   (cov (gsl_matrix_alloc p p))
		   (gv (gsl_vector_alloc p))
		   (r (gsl_rng_alloc gsl_rng_default)))
	      (do ((i 0 (+ i 1)))
		  ((= i (- n 3)))
		(let* ((dx (/ 10.0 (- n 1.0)))
		       (ei (gsl_rng_uniform r))
		       (xi (+ -5.0 (* i dx)))
		       (yi (+ b (* a xi))))
		  (gsl_vector_set x i xi)
		  (gsl_vector_set y i (+ yi ei))))
	      (gsl_vector_set x (- n 3) 4.7)
	      (gsl_vector_set y (- n 3) -8.3)
	      (gsl_vector_set x (- n 2) 3.5)
	      (gsl_vector_set y (- n 2) -6.7)
	      (gsl_vector_set x (- n 1) 4.1)
	      (gsl_vector_set y (- n 1) -6.0)
	      (do ((i 0 (+ i 1)))
		  ((= i n))
		(let ((xi (gsl_vector_get x i)))
		  (gsl_matrix_set X i 0 1.0)
		  (gsl_matrix_set X i 1 xi)))
	      (dofit gsl_multifit_robust_ols X y c_ols cov)
	      (dofit gsl_multifit_robust_bisquare X y c cov)
	      (do ((i 0 (+ i 1)))
		  ((= i n))
		(let ((xi (gsl_vector_get x i))
		      (yi (gsl_vector_get y i))
		      (y_ols (float-vector 0.0))
		      (y_rob (float-vector 0.0))
		      (y_err (float-vector 0.0)))
		  (gsl_vector_set gv 0 (gsl_matrix_get X i 0))
		  (gsl_vector_set gv 1 (gsl_matrix_get X i 1))
		  (gsl_multifit_robust_est gv c cov (double* y_rob) (double* y_err))
		  (gsl_multifit_robust_est gv c_ols cov (double* y_ols) (double* y_err))))
	      (gsl_matrix_free X)
	      (gsl_matrix_free cov)
	      (gsl_vector_free x)
	      (gsl_vector_free y)
	      (gsl_vector_free c)
	      (gsl_vector_free gv)
	      (gsl_rng_free r))))
	
	(let ()
	  (gsl_rng_env_setup)
	  (let* ((T gsl_rng_default)
		 (r (gsl_rng_alloc T))
		 (x 0)
		 (y 0)
		 (dx (float-vector 0.0))
		 (dy (float-vector 0.0)))
	    (do ((i 0 (+ i 1)))
		((= i 10))
	      (gsl_ran_dir_2d r (double* dx) (double* dy))
	      (set! x (+ x (dx 0)))
	      (set! y (+ y (dy 0))))
	    (gsl_rng_free r)))
	
	(let ((f_size 2)
	      (T gsl_multimin_fminimizer_nmsimplex))
	  (define (simple-abs x)
	    (let ((u (gsl_vector_get x 0))
		  (v (gsl_vector_get x 1)))
	      (let ((a (- u 1))
		    (b (- v 2)))
		(+ (abs a) (abs b)))))
	  (let ((x (gsl_vector_alloc f_size))
		(step_size (gsl_vector_alloc f_size))
		(s (gsl_multimin_fminimizer_alloc T 2)))
	    (gsl_vector_set x 0 1.0)
	    (gsl_vector_set x 1 2.0)
	    (gsl_vector_set step_size 0 1)
	    (gsl_vector_set step_size 1 1)
	    (gsl_multimin_fminimizer_set s simple-abs x step_size)
	    (do ((i 0 (+ i 1)))
		((= i 10))
	      (gsl_multimin_fminimizer_iterate s))
	    (let ((result (abs (gsl_multimin_fminimizer_fval s))))
	      (gsl_multimin_fminimizer_free s)
	      (gsl_vector_free x)
	      (gsl_vector_free step_size)
	      (num-test result 0.0))))
	
	(let ((n 4)
	      (x (float-vector 1970 1980 1990 2000))
	      (y (float-vector 12 11 14 13))
	      (w (float-vector 0.1 0.2 0.3 0.4))
	      (c0 (float-vector 0.0))
	      (c1 (float-vector 0.0))
	      (cov00 (float-vector 0.0))
	      (cov01 (float-vector 0.0))
	      (cov11 (float-vector 0.0))
	      (chisq (float-vector 0.0)))
	  (gsl_fit_wlinear (double* x) 1 (double* w) 1 (double* y) 1 n
			   (double* c0) (double* c1) (double* cov00) (double* cov01) (double* cov11) (double* chisq))
	  (num-test (+ (c0 0) (c1 0)) -106.54))
	
	(let ((c (gsl_multiset_calloc 4 2)))
	  (test (list (gsl_multiset_n c) (gsl_multiset_k c)) '(4 2)))
	
	(let ((x (gsl_vector_alloc 2))
	      (factor 1.0)
	      (T gsl_multiroot_fsolver_dnewton))
	  (define (rosenb x f)
	    (let ((x0 (gsl_vector_get x 0))
		  (x1 (gsl_vector_get x 1)))
	      (let ((y0 (- 1 x0))
		    (y1 (* 10 (- x1 (* x0 x0)))))
		(gsl_vector_set f 0 y0)
		(gsl_vector_set f 1 y1)
		GSL_SUCCESS)))
	  (gsl_vector_set x 0 -1.2)
	  (gsl_vector_set x 1 1.0)
	  (let ((s (gsl_multiroot_fsolver_alloc T 2)))
	    (gsl_multiroot_fsolver_set s rosenb x)
	    (do ((i 0 (+ i 1)))
		((= i 10))
	      (gsl_multiroot_fsolver_iterate s))
	    (let ((residual (abs (gsl_vector_get (gsl_multiroot_fsolver_f s) 0))))
	      (gsl_multiroot_fsolver_free s)
	      (gsl_vector_free x)
	      (test residual 0.0))))
	))))

(test (defined? 'CLOCKS_PER_SEC (rootlet)) #f) ; autoloader can cause endless confusion here!



;;; --------------------------------------------------------------------------------
;;; libgdbm

(when (and (provided? 'linux)
	   (provided? 'system-extras)
	   (file-exists? "/usr/local/lib/libgdbm.a"))
  (let ()
    (require libgdbm.scm)
    (when (and (defined? '*libgdbm*)
	       (procedure? (*libgdbm* 'gdbm_store)))
      (with-let (sublet *libgdbm*)
	(let ((gfile (gdbm_open "test.gdbm" 1024 GDBM_NEWDB #o664 (lambda (str) (format *stderr* "str: ~S~%" str)))))
	  (gdbm_store gfile "1" "1234" GDBM_REPLACE)
	  (gdbm_fetch gfile "1")
	  (gdbm_close gfile))
	
	(define *db* 
	  (openlet 
	   (inlet :file (gdbm_open "test.gdbm" 1024 GDBM_NEWDB #o664 
				   (lambda (str) (format *stderr* "gdbm error: ~S~%" str)))
		  
		  :let-ref-fallback (lambda (obj sym)
				      (with-input-from-string
					  (gdbm_fetch (obj 'file) (symbol->string sym))
					(lambda () (eval (read)))))
		  
		  :let-set-fallback (lambda (obj sym val)
				       (gdbm_store (obj 'file)
						   (symbol->string sym)
						   (object->string val :readable)
						   GDBM_REPLACE)
				       val)
		  
		  :make-iterator (lambda (obj)
				   (let ((key #f)
					 (length (lambda (obj) (expt 2 20))))
				     (#_make-iterator
				      (openlet 
				       (let ((iterator? #t))
					 (lambda ()
					   (if key
					       (set! key (gdbm_nextkey (obj 'file) (cdr key)))
					       (set! key (gdbm_firstkey (obj 'file))))
					   (if (pair? key)
					       (cons (string->symbol (car key))
						     (with-input-from-string
							 (gdbm_fetch (obj 'file) (car key))
						       (lambda () (eval (read)))))
					       key))))))))))
	
	(set! (*db* 'str) "123") ; add a variable named 'hi with the value "123"
	(test (*db* 'str) "123")
	(set! (*db* 'int) 432)
	(test (*db* 'int) 432)
	(test (with-let *db* (+ int (length str))) 435)
	(test (let ((lst (map values *db*)))
		(or (equal? lst '((str . "123") (int . 432)))
		    (equal? lst '((int . 432) (str . "123")))))
	      #t)
	
	(gdbm_close (*db* 'file))))))


;;; --------------------------------------------------------------------------------
;;; libutf8proc
;;;
;;;   these are from the libutf8proc test directory

(when full-test
  (load "libutf8proc.scm")
  
  (when (defined? '*libutf8proc*)
    (with-let *libutf8proc*
      
      (define (print-property c)
	(format *stderr* "  category = ~S~% charwidth = ~D~%~A~%"
		(utf8proc_category_string c)
		(utf8proc_charwidth c)
		(utf8proc_get_property c)))
      
      (do ((c 1 (+ c 1)))
	  ((= c #x110000))
	(let ((l (utf8proc_tolower c))
	      (u (utf8proc_toupper c)))
	  (if (not (or (= l c)
		       (utf8proc_codepoint_valid l)))
	      (format *stderr* "~X: invalid tolower~%" c))
	  (if (not (or (= u c)
		       (utf8proc_codepoint_valid u)))
	      (format *stderr* "~X: invalid toupper~%" c))
	  ))
      
      (do ((c 0 (+ c 1)))
	  ((or (= c #xd800)
	       (and (not (utf8proc_codepoint_valid c))
		    (not (format *stderr* "~X: codepoint invalid~%" c))))))
      
      (do ((c #xd800 (+ c 1)))
	  ((or (= c #xe000)
	       (and (utf8proc_codepoint_valid c)
		    (not (format *stderr* "~X: codepoint valid?~%" c))))))
      
      (do ((c #xe000 (+ c 1)))
	  ((or (= c #x110000)
	       (and (not (utf8proc_codepoint_valid c))
		    (not (format *stderr* "~X: codepoint invalid~%" c))))))
      
      (do ((c #x110000 (+ c 1)))
	  ((or (= c #x110010)
	       (and (utf8proc_codepoint_valid c)
		    (not (format *stderr* "~X: codepoint valid?~%" c))))))
      
      ;; (print-property #xbb)
      
      (do ((c 1 (+ c 1)))
	  ((= c #x110000))
	(let ((cat ((utf8proc_get_property c) 'category))
	      (w (utf8proc_charwidth c)))
	  (if (and (or (= cat UTF8PROC_CATEGORY_MN) (= cat UTF8PROC_CATEGORY_ME))
		   (positive? w))
	      (format *stderr* "nonzero width ~D for combining char ~X~%" w c))
	  (if (and (zero? w)
		   (or (and (>= cat UTF8PROC_CATEGORY_LU) (<= cat UTF8PROC_CATEGORY_LO))
		       (and (>= cat UTF8PROC_CATEGORY_ND) (<= cat UTF8PROC_CATEGORY_SC))
		       (and (>= cat UTF8PROC_CATEGORY_SO) (<= cat UTF8PROC_CATEGORY_ZS))))
	      (format *stderr* "zero width for symbol-like char ~X~%" c))))
      )))


(test (procedure? (symbol->value-anywhere 'getchar)) #t)
(test (integer? (symbol->value-anywhere 'GSL_SUCCESS)) #t)
(test (integer? (symbol->value-anywhere 'most-positive-fixnum)) #t)

(test (let? (cdr (assoc "libc.scm" *libraries*))) #t)



;;; --------------------------------------------------------------------------------

(define (string-wi=? s1 s2)
  (let ((len1 (length s1))
	(len2 (length s2)))
    (let loop ((i1 0) (i2 0))
      (if (< i1 len1)
	  (if (< i2 len2)
	      (if (char=? (string-ref s1 i1) (string-ref s2 i2))
		  (loop (+ i1 1) (+ i2 1))
		  (or (and (char-whitespace? (string-ref s2 i2))
			   (loop i1 (+ i2 1)))
		      (and (char-whitespace? (string-ref s1 i1))
			   (loop (+ i1 1) i2))))
	      (and (char-whitespace? (string-ref s1 i1))
		   (loop (+ i1 1) i2)))
	  (if (< i2 len2)
	      (and (char-whitespace? (string-ref s2 i2))
		   (loop i1 (+ i2 1)))
	      (and (= i1 len1)
		   (= i2 len2)))))))
#|
;;; slower:
(define (string-wi=? s1 s2)
  (or (string=? s1 s2)
      (let ((len1 (length s1))
	    (len2 (length s2)))
	(let loop ((i1 0) (i2 0))
	  (or (and (= i1 len1)
		   (= i2 len2))
	      (if (and (< i1 len1)
		       (char-whitespace? (s1 i1)))
		  (loop (+ i1 1) i2)
		  (if (and (< i2 len2)
			   (char-whitespace? (s2 i2)))
		      (loop i1 (+ i2 1))
		      (and (< i1 len1)
			   (< i2 len2)
			   (char=? (s1 i1) (s2 i2))
			   (loop (+ i1 1) (+ i2 1))))))))))
;;; even slower
(define (no-spaces s1)
  (let ((len (length s1)))
    (do ((i 0 (+ i 1))
	 (str (make-string len))
	 (j 0))
	((= i len)
	 (copy str (make-string j)))
      (when (not (char-whitespace? (s1 i)))
	(set! (str j) (s1 i))
	(set! j (+ j 1))))))
(define (string-wi=? s1 s2)
  (or (string=? s1 s2)
      (string=? (no-spaces s1) (no-spaces s2))))
|#

(test (string-wi=? "" "") #t)
(test (string-wi=? "" " ") #t)
(test (string-wi=? "" " a") #f)
(test (string-wi=? "a" " a") #t)
(test (string-wi=? "a " " a") #t)
(test (string-wi=? " a " "a") #t)
(test (string-wi=? " a " " a") #t)
(test (string-wi=? "\n a\n " "a") #t)
(test (string-wi=? "aa" " a") #f)
(test (string-wi=? "aa" " a a ") #t)
(test (string-wi=? "aa" "aa ") #t)

(let ()
  (require lint.scm)
  (set! *report-repeated-code-fragments* #f)
  (set! (setter /) #f); clear stuff from above

  (define lint-test 
    (letrec ((no-lines 
	      (lambda (s)
		(let* ((pos (string-position "(line " s))
		       (epos (and pos (string-position "): " s (+ pos 1))))) ; might be "):" unrelated to (line...)!
		  (if (and pos epos)
		      (no-lines (string-append (substring s 0 (- pos 1)) (substring s (+ epos 1)))) ; sometimes there are two "(line ...)" intrusions
		      s)))))
      (lambda (str1 str2) 
	(let ((result (call-with-output-string 
		       (lambda (op) 
			 (call-with-input-string str1
			   (lambda (ip) 
			     (lint ip op)))))))
	  (if (and (not (string-wi=? result str2))
		   (not (string-wi=? (no-lines result) str2)))
	      (format *stderr* ";(lint ~S) -> ~S~%" str1 result))))))

  (lint-test "(+ 1 2)"			" +: perhaps (+ 1 2) -> 3")
  (lint-test "(+ 1 (+ 2 3))"		" +: perhaps (+ 1 (+ 2 3)) -> 6")
  (lint-test "(+ 1 (+ x 3))"		" +: perhaps (+ 1 (+ x 3)) -> (+ 4 x)")
  (lint-test "(+ x)"			" +: perhaps (+ x) -> x")
  (lint-test "(+ (+ (+ x 2) 3) 4)"	" +: perhaps (+ (+ (+ x 2) 3) 4) -> (+ 9 x)")
  (lint-test "(+ 1 2 x -3)"		" +: perhaps (+ 1 2 x -3) -> x")
  (lint-test "(+ 1/2 -1/2)"		" +: perhaps (+ 1/2 -1/2) -> 0")
  (lint-test "(+ 1/3 2/3)"		" +: perhaps (+ 1/3 2/3) -> 1")
  (lint-test "(+ (log x) (log 3))"	"") ; oops...
  (lint-test "(+ x 0 (+ 0 0))"		" +: perhaps (+ x 0 (+ 0 0)) -> x")
  (lint-test "(+ x #(a))"		" +: in (+ x #(a)), +'s argument 2 should be a number, but #(a) is a vector?")
  (lint-test "(+ x 2.0 -2)"		" +: perhaps (+ x 2.0 -2) -> (* x 1)") ; ??
  (lint-test "(+ x (+ y z) (+ a b))"    " +: perhaps (+ x (+ y z) (+ a b)) -> (+ x y z a b)")
  (lint-test "(+ (- x) y)"              " +: perhaps (+ (- x) y) -> (- y x)")
  (lint-test "(+ x (- y))"              " +: perhaps (+ x (- y)) -> (- x y)")
  (lint-test "(+ x (+ y 2) (+ z 3))"	" +: perhaps (+ x (+ y 2) (+ z 3)) -> (+ 5 x y z)")
  (lint-test "(+ 1 (* 2 (+ x)) (+ y z))" " +: perhaps (+ 1 (* 2 (+ x)) (+ y z)) -> (+ 1 (* 2 x) y z)")
  (lint-test "(+ x (- y) (- a b) w)"    " +: perhaps (+ x (- y) (- a b) w) -> (- (+ x a w) y b)")
  (lint-test "(+ x (- 1))"		" +: perhaps (+ x (- 1)) -> (- x 1)")
  (lint-test "(+ -1 x)"                 " +: perhaps (+ -1 x) -> (- x 1)")
  (lint-test "(+ x -1)"                 " +: perhaps (+ x -1) -> (- x 1)")
  (lint-test "(+ (/ a b) (/ c b))"      " +: perhaps (+ (/ a b) (/ c b)) -> (/ (+ a c) b)")
  (lint-test "(+ (/ a b d) (/ c b d))"  " +: perhaps (+ (/ a b d) (/ c b d)) -> (/ (+ a c) b d)")
  (lint-test "(+ (* a b) (* c a))"      " +: perhaps (+ (* a b) (* c a)) -> (* a (+ b c))")
  (lint-test "(+ x (- (+ y z) w))"      " +: perhaps (+ x (- (+ y z) w)) -> (- (+ x y z) w)")
  (lint-test "(+ (- (+ y z) w v) x)"    " +: perhaps (+ (- (+ y z) w v) x) -> (- (+ y z x) w v)")
  (lint-test "(+ (- (+ a b) c d e) (- (+ y z) w v))" " +: perhaps (+ (- (+ a b) c d e) (- (+ y z) w v)) -> (- (+ a b y z) c d e w v)")
  (lint-test "(+ x (- (+ y z) w) v)"    " +: perhaps (+ x (- (+ y z) w) v) -> (- (+ x y z v) w)")
  (lint-test "(+ (- x) (- y))"          " +: perhaps (+ (- x) (- y)) -> (- (+ x y))")
  (lint-test "(+ (- x) (- y) (- z))"    " +: perhaps (+ (- x) (- y) (- z)) -> (- (+ x y z))")
  (lint-test "(+ (- x) (- y z))"        " +: perhaps (+ (- x) (- y z)) -> (- y x z)")
  (lint-test "(+ (- x) (- x z))"        " +: perhaps (+ (- x) (- x z)) -> (- z)")
  (lint-test "(+ (- x z) (- y))"        " +: perhaps (+ (- x z) (- y)) -> (- x z y)")
  (lint-test "(+ (- y z) (- y))"        " +: perhaps (+ (- y z) (- y)) -> (- z)")
  (lint-test "(+ -1 (- x y))"           " +: perhaps (+ -1 (- x y)) -> (- x y 1)")
  (lint-test "(+ (- x) -1)"             " +: perhaps (+ (- x) -1) -> (- (+ x 1))")
  (lint-test "(+ (- -1 x) (- y -1))"    " +: perhaps (+ (- -1 x) (- y -1)) -> (- y x)")
  (lint-test "(+ (- -1 x) (- -1 y))"    " +: perhaps (+ (- -1 x) (- -1 y)) -> (- (+ x y 2))")
  (lint-test "(+ (- x 2) (- 1 y 3 4))"  " +: perhaps (+ (- x 2) (- 1 y 3 4)) -> (- x y 8)")  
  (lint-test "(+ (* a b) (* b c))"      " +: perhaps (+ (* a b) (* b c)) -> (* b (+ a c))")
  (lint-test "(+ (* a b b) (* b c))"    " +: perhaps (+ (* a b b) (* b c)) -> (* b (+ (* a b) c))")
  (lint-test "(+ (* a b c) (* b c))"    " +: perhaps (+ (* a b c) (* b c)) -> (* b c (+ a 1))")
  (lint-test "(+ (* a b) (* a b c d))"  " +: perhaps (+ (* a b) (* a b c d)) -> (* a b (+ 1 (* c d)))")
  (lint-test "(+ (* a b) (* c d))"      "")
  (lint-test "(+ (* a b) (* a b))"      " +: perhaps (+ (* a b) (* a b)) -> (* a b 2)")
  (lint-test "(exp (+ (* 0.5 (log hi)) (* 0.5 (log lo))))" " exp: perhaps (exp (+ (* 0.5 (log hi)) (* 0.5 (log lo)))) -> (exp (* 0.5 (+ (log hi) (log lo))))")
  (lint-test "(+ (* x 2) 3 (* 4 x x))"  " +: perhaps (+ (* x 2) 3 (* 4 x x)) -> (+ 3 (* x (+ 2 (* x 4))))")
  (lint-test "(+ -1 (* x -2) 3 (* 4 x x x))" " +: perhaps (+ -1 (* x -2) 3 (* 4 x x x)) -> (+ 2 (* x (+ -2 (* x (* x 4)))))")
  (lint-test "(+ (* x 65536) (* x 256) x)" " +: perhaps (+ (* x 65536) (* x 256) x) -> (* x 65793)")
  (lint-test "(+ x x x x)"              " +: perhaps (+ x x x x) -> (* x 4)")
  (lint-test "(+ n (if (= 0 m) 0 1))"   " +: perhaps (+ n (if (= 0 m) 0 1)) -> (if (= 0 m) n (+ n 1))")
  (lint-test "(if (= m 0) n (+ n 1))"   "")
  (lint-test "(+ n (if x 0 y))"         " +: perhaps (+ n (if x 0 y)) -> (if x n (+ n y))")
  (lint-test "(+ n (if x y 0))"         " +: perhaps (+ n (if x y 0)) -> (if x (+ n y) n)")
  (lint-test "(+ (if x 0 y) n)"         " +: perhaps (+ (if x 0 y) n) -> (if x n (+ y n))")
  (lint-test "(+ (if x y 0) n)"         " +: perhaps (+ (if x y 0) n) -> (if x (+ y n) n)")
  (lint-test "(+ x (if y #() 0))"       
	     " +: in (+ x (if y #() 0)), +'s argument 2 should be a number, but #() is a vector?
               +: perhaps (+ x (if y #() 0)) -> (if y (+ x #()) x)")
  (lint-test "(+ 1 (if x 0 #()))"       
	     " +: in (+ 1 (if x 0 #())), +'s argument 2 should be a number, but #() is a vector?
               +: perhaps (+ 1 (if x 0 #())) -> (if x 1 (+ 1 #()))")
  (lint-test "(+ 1 (if x #() 0))"       
	     " +: in (+ 1 (if x #() 0)), +'s argument 2 should be a number, but #() is a vector?
               +: perhaps (+ 1 (if x #() 0)) -> (if x (+ 1 #()) 1)")
  (lint-test "(+ n (make-rectangular 0.0 0.0))" " +: perhaps (+ n (make-rectangular 0.0 0.0)) -> (+ n 0.0)")
  (lint-test "(if old (list form) (cons form old))" " if: perhaps (if old (list form) (cons form old)) -> (cons form (if old () old))")
  (lint-test "(if old (cons form old) (list form))" " if: perhaps (if old (cons form old) (list form)) -> (cons form (or old ()))")
  (lint-test "(if (not x) (list y) (cons y x))"     " if: perhaps (if (not x) (list y) (cons y x)) -> (cons y (or x ()))")
  (lint-test "(if (not x) (cons y x) (list y))"     " if: perhaps (if (not x) (cons y x) (list y)) -> (cons y (if (not x) x ()))")

  (lint-test "(* 2 3)"			" *: perhaps (* 2 3) -> 6")
  (lint-test "(* 2 (+))"		" *: perhaps (* 2 (+)) -> 0")
  (lint-test "(* (* 2 3) 4)"		" *: perhaps (* (* 2 3) 4) -> 24")
  (lint-test "(* (* x 3) 4)"		" *: perhaps (* (* x 3) 4) -> (* 12 x)")
  (lint-test "(* x)"			" *: perhaps (* x) -> x")
  (lint-test "(* x (*))"		" *: perhaps (* x (*)) -> x")
  (lint-test "(* 2 x 3 y 1/6)"		" *: perhaps (* 2 x 3 y 1/6) -> (* x y)")
  (lint-test "(* x -1)"			" *: perhaps (* x -1) -> (- x)")
  (lint-test "(* -1 x y)"               " *: perhaps (* -1 x y) -> (- (* x y))")
  (lint-test "(* x 1 1 1)"		" *: perhaps (* x 1 1 1) -> x")
  (lint-test "(* x 1 1.0 1)"		" *: perhaps (* x 1 1.0 1) -> (* x 1.0)")
  (lint-test "(* x y 2 0)"		" *: perhaps (* x y 2 0) -> 0")
  (lint-test "(* -1 x -1 -1)"		" *: perhaps (* -1 x -1 -1) -> (- x)")
  (lint-test "(* x (* y z) a)"          " *: perhaps (* x (* y z) a) -> (* x y z a)")
  (lint-test "(* (- x) (- y))"          " *: perhaps (* (- x) (- y)) -> (* x y)")
  (lint-test "(* 2.0 (inexact x))"      " *: perhaps (* 2.0 (inexact x)) -> (* 2.0 x)")
  (lint-test "(* (inexact x) 2.0)"      " *: perhaps (* (inexact x) 2.0) -> (* x 2.0)")
  (lint-test "(* (exp a) (exp b))"      " *: perhaps (* (exp a) (exp b)) -> (exp (+ a b))")
  (lint-test "(* (sqrt x) (sqrt y))"    "") ; here we need to know that x and y are not negative
  (lint-test "(* (expt x z) (expt y z))" " *: perhaps (* (expt x z) (expt y z)) -> (expt (* x y) z)")
  (lint-test "(* (expt x z) (expt x y))" " *: perhaps (* (expt x z) (expt x y)) -> (expt x (+ z y))")
  (lint-test "(* 2.0 (random 1.0))"     " *: perhaps (* 2.0 (random 1.0)) -> (random 2.0)")
  (lint-test "(* (gcd a b) (lcm a b))"	" *: perhaps (* (gcd a b) (lcm a b)) -> (abs (* a b))")
  (lint-test "(* (/ x) (/ y z))"        " *: perhaps (* (/ x) (/ y z)) -> (/ y (* x z))")
  (lint-test "(* (/ x) (/ x z))"        " *: perhaps (* (/ x) (/ x z)) -> (/ z)")
  (lint-test "(* (/ x z) (/ y))"        " *: perhaps (* (/ x z) (/ y)) -> (/ x (* z y))")
  (lint-test "(* (/ y z) (/ y))"        " *: perhaps (* (/ y z) (/ y)) -> (/ z)")
  (lint-test "(* (/ x z) (/ y w v))"    " *: perhaps (* (/ x z) (/ y w v)) -> (/ (* x y) (* z w v))")
  (lint-test "(* (/ x) (/ y))"          " *: perhaps (* (/ x) (/ y)) -> (/ (* x y))")
  (lint-test "(* (/ x y) z (/ y x))"    " *: perhaps (* (/ x y) z (/ y x)) -> z")
  (lint-test "(* (/ x y z) z (/ y x))"  " *: perhaps (* (/ x y z) z (/ y x)) -> 1")
  (lint-test "(* (/ x a) z (/ y x))"    " *: perhaps (* (/ x a) z (/ y x)) -> (/ (* z y) a)")
  (lint-test "(* n (if x 0 1))"         " *: perhaps (* n (if x 0 1)) -> (if x 0 (* n 1))")
  (lint-test "(* n (if x y 1))"         " *: perhaps (* n (if x y 1)) -> (if x (* n y) n)")
  (lint-test "(* n (if x y 0))"         " *: perhaps (* n (if x y 0)) -> (if x (* n y) 0)")
  (lint-test "(* n (if x 0 y))"         " *: perhaps (* n (if x 0 y)) -> (if x 0 (* n y))")
  (lint-test "(* n (if x 1 y))"         " *: perhaps (* n (if x 1 y)) -> (if x n (* n y))")
  (lint-test "(* (if x 0 y) n)"         " *: perhaps (* (if x 0 y) n) -> (if x 0 (* y n))")
  (lint-test "(* (if x y 0) n)"         " *: perhaps (* (if x y 0) n) -> (if x (* y n) 0)")
  (lint-test "(* (if x 1 y) n)"         " *: perhaps (* (if x 1 y) n) -> (if x n (* y n))")
  (lint-test "(* (if x y 1) n)"         " *: perhaps (* (if x y 1) n) -> (if x (* y n) n)")
  (lint-test "(* (if x w y) n)"         "")
  (lint-test "(* x (if y 0 z) w)"       " *: perhaps (* x (if y 0 z) w) -> (if y 0 (* z x w))")
  (lint-test "(* (if y z 0) x w)"       " *: perhaps (* (if y z 0) x w) -> (if y (* z x w) 0)")

  (lint-test "(- 1 2)"			" -: perhaps (- 1 2) -> -1")
  (lint-test "(- 1 (- 1 2))"		" -: perhaps (- 1 (- 1 2)) -> 2")
  (lint-test "(- x (- 2 0))"		" -: perhaps (- x (- 2 0)) -> (- x 2)")
  (lint-test "(- (- x))"		" -: perhaps (- (- x)) -> x")
  (lint-test "(- 0 x)"			" -: perhaps (- 0 x) -> (- x)")
  (lint-test "(- x 0)"			" -: perhaps (- x 0) -> x")
  (lint-test "(- (- y x))"		" -: perhaps (- (- y x)) -> (- x y)")
  (lint-test "(- 3/2 1/2)"		" -: perhaps (- 3/2 1/2) -> 1")
  (lint-test "(- (- x y) z)"		" -: perhaps (- (- x y) z) -> (- x y z)")
  (lint-test "(- x 0 (+ 3 2))"		" -: perhaps (- x 0 (+ 3 2)) -> (- x 5)")
  (lint-test "(- 5 x (+ 3 2))"		" -: perhaps (- 5 x (+ 3 2)) -> (- x)")
  (lint-test "(- x 0 0 0)"		" -: perhaps (- x 0 0 0) -> x")
  (lint-test "(- 0 0 0 x)"		" -: perhaps (- 0 0 0 x) -> (- x)")
  (lint-test "(- 0.0 x)"		"")
  (lint-test "(- x (+ 0 x))"		" -: perhaps (- x (+ 0 x)) -> 0")
  (lint-test "(- (abs x) (abs x) y)"	" -: perhaps (- (abs x) (abs x) y) -> (- y)")
  (lint-test "(- (abs x) (abs x) (abs x) y)"  " -: perhaps (- (abs x) (abs x) (abs x) y) -> (- (+ (abs x) y))")
  (lint-test "(- (- x) y)" " -: perhaps (- (- x) y) -> (- (+ x y))")
  (lint-test "(- x (truncate x))"       " -: perhaps (- x (truncate x)) -> (remainder x 1)")
  (lint-test "(- x (+ y z))"            " -: perhaps (- x (+ y z)) -> (- x y z)")
  (lint-test "(- x (- y))"              " -: perhaps (- x (- y)) -> (+ x y)")
  (lint-test "(- (- x y) z w)"          " -: perhaps (- (- x y) z w) -> (- x y z w)")
  (lint-test "(- (- x y) (+ z w))"      " -: perhaps (- (- x y) (+ z w)) -> (- x y z w)")
  (lint-test "(- x -1)"                 " -: perhaps (- x -1) -> (+ x 1)")
  (lint-test "(- x (if y 0 z))"         " -: perhaps (- x (if y 0 z)) -> (if y x (- x z))")
  (lint-test "(- x (if y z 0))"         " -: perhaps (- x (if y z 0)) -> (if y (- x z) x)")

  (lint-test "(/ 2 3)"			" /: perhaps (/ 2 3) -> 2/3")
  (lint-test "(/ 1 x)"			" /: perhaps (/ 1 x) -> (/ x)")
  (lint-test "(/ 2)"			" /: perhaps (/ 2) -> 1/2")
  (lint-test "(/ 0 2 x)"		"")
  (lint-test "(/ 0 x)"                  "")
  (lint-test "(/ (/ x))"		" /: perhaps (/ (/ x)) -> x")
  (lint-test "(/ (log x) (log 2))"	" /: perhaps (/ (log x) (log 2)) -> (log x 2)")
  (lint-test "(/ (log x) (log y))"	" /: perhaps (/ (log x) (log y)) -> (log x y)")
  (lint-test "(/ x (/ y))"		" /: perhaps (/ x (/ y)) -> (* x y)")
  (lint-test "(/ x (/ 1 y z))"          " /: perhaps (/ x (/ 1 y z)) -> (* x y z)")
  (lint-test "(/ x 1 1 1)"		" /: perhaps (/ x 1 1 1) -> x")
  (lint-test "(/ x a (* b 1 c) d)"	" /: perhaps (/ x a (* b 1 c) d) -> (/ x a b c d)")
  (lint-test "(/ 0 a (* b 1 c) d)"	" /: perhaps (/ 0 a (* b 1 c) d) -> (/ 0 a b c d)")
  (lint-test "(/ x x)"			" /: this looks odd: (/ x x)")
  (lint-test "(/ 0)"			" /: attempt to invert zero: (/ 0)")
  (lint-test "(/ x y 2 0)"		" /: attempt to divide by 0: (/ x y 2 0)")
  (lint-test "(/ (/ 1 a) (/ b c d))"    " /: perhaps (/ (/ 1 a) (/ b c d)) -> (/ (* c d) (* a b))")
  (lint-test "(/ (/ a) (/ b))"          " /: perhaps (/ (/ a) (/ b)) -> (/ b a)")
  (lint-test "(/ (/ a b c) (/ d e f))"  " /: perhaps (/ (/ a b c) (/ d e f)) -> (/ (* a e f) (* b c d))")
  (lint-test "(/ (/ a b) c)"            " /: perhaps (/ (/ a b) c) -> (/ a b c)")
  (lint-test "(/ a b a)"                " /: perhaps (/ a b a) -> (/ b)")
  (lint-test "(/ a b a c)"              " /: perhaps (/ a b a c) -> (/ 1 b c)")
  (lint-test "(/ a (* b a))"            " /: perhaps (/ a (* b a)) -> (/ b)")
  (lint-test "(/ a (* b a c))"          " /: perhaps (/ a (* b a c)) -> (/ 1 b c)")
  (lint-test "(/ 2.0 (inexact x))"      " /: perhaps (/ 2.0 (inexact x)) -> (/ 2.0 x)")
  (lint-test "(/ (inexact x) 2.0)"      " /: perhaps (/ (inexact x) 2.0) -> (/ x 2.0)")
  (lint-test "(/ (- x) (- y))"          " /: perhaps (/ (- x) (- y)) -> (/ x y)")
  (lint-test "(/ x (/ y z))"            " /: perhaps (/ x (/ y z)) -> (/ (* x z) y)")
  (lint-test "(/ 3 (/ -3 x))"           " /: perhaps (/ 3 (/ -3 x)) -> (- x)")
  (lint-test "(/ 2/3 (/ 3/2 x))"        " /: perhaps (/ 2/3 (/ 3/2 x)) -> (* 4/9 x)")
;  (lint-test "(/ x (* y z))"            " /: perhaps (/ x (* y z)) -> (/ x y z)")
  (lint-test "(/ x (/ y))"              " /: perhaps (/ x (/ y)) -> (* x y)")
  (lint-test "(/ (* x y) (* z y))"      " /: perhaps (/ (* x y) (* z y)) -> (/ x z)")
  (lint-test "(/ (* 12 (log x)) (log 2))" " /: perhaps (/ (* 12 (log x)) (log 2)) -> (* 12 (log x 2))")
  (lint-test "(/ (* x y) (log 2))"      "")
  (lint-test "(/ (expt x y))"           " /: perhaps (/ (expt x y)) -> (expt x (- y))")
  (lint-test "(/ (expt 10 6))"          " /: perhaps (/ (expt 10 6)) -> (expt 10 (- 6))")
  (lint-test "(/ (exp x))"              " /: perhaps (/ (exp x)) -> (exp (- x))")
  (lint-test "(/ x (sqrt x))"           " /: perhaps (/ x (sqrt x)) -> (sqrt x)")
  (lint-test "(/ (sqrt x) x)"           " /: perhaps (/ (sqrt x) x) -> (/ (sqrt x))")
  (lint-test "(/ (/ x))"                " /: perhaps (/ (/ x)) -> x")
  (lint-test "(/ (/ 1 x))"              " /: perhaps (/ (/ 1 x)) -> x")
  (lint-test "(/ (/ 1 x y))"            " /: perhaps (/ (/ 1 x y)) -> (* x y)")
  (lint-test "(/ (/ z x))"              " /: perhaps (/ (/ z x)) -> (/ x z)")
  (lint-test "(/ (/ z x y))"            " /: perhaps (/ (/ z x y)) -> (/ (* x y) z)")
  (lint-test "(/ 1 (/ 1 x y))"          " /: perhaps (/ 1 (/ 1 x y)) -> (* x y)")
  (lint-test "(/ x y (length z))"       " /: (length z) will cause division by 0 if z is empty")
  (lint-test "(/ (length x))"           " /: (length x) will cause division by 0 if x is empty")
  (lint-test "(/ (length x) z)"         "")

  (lint-test "(/ (exact->inexact x) 10)"        " /: perhaps (/ (exact->inexact x) 10) -> (/ x 10.0)")
  (lint-test "(+ (exact->inexact x) 10)"        " +: perhaps (+ (exact->inexact x) 10) -> (+ x 10.0)")
  (lint-test "(+ 10 (exact->inexact x))"        " +: perhaps (+ 10 (exact->inexact x)) -> (+ 10.0 x)")
  (lint-test "(* (exact->inexact x) 10)"        " *: perhaps (* (exact->inexact x) 10) -> (* x 10.0)")
  (lint-test "(* (exact->inexact x) 10 10.0)"   " *: perhaps (* (exact->inexact x) 10 10.0) -> (* x 10 10.0)")
  (lint-test "(* 10 (exact->inexact x) 10.0)"   " *: perhaps (* 10 (exact->inexact x) 10.0) -> (* 10 x 10.0)")
  (lint-test "(* 10.0 (exact->inexact x) 10.0)" " *: perhaps (* 10.0 (exact->inexact x) 10.0) -> (* 10.0 x 10.0)")
  (lint-test "(exact->inexact (/ x 32))"        " exact->inexact: perhaps (exact->inexact (/ x 32)) -> (/ x 32.0)")
  (lint-test "(inexact (random 10))"            "")

  (lint-test "(sin (asin x))"		" sin: perhaps (sin (asin x)) -> x")
  (lint-test "(sin 0)"			" sin: perhaps (sin 0) -> 0")
  (lint-test "(sin pi)"			" sin: perhaps (sin pi) -> 0.0")
  (lint-test "(cos 0)"			" cos: perhaps (cos 0) -> 1")
  (lint-test "(cos (acos (+ x 1)))"	" cos: perhaps (cos (acos (+ x 1))) -> (+ x 1)")
  (lint-test "(cos (* pi 1))"		" cos: perhaps (cos (* pi 1)) -> -1.0")
  (lint-test "(cos (- (* x y)))"	" cos: perhaps (cos (- (* x y))) -> (cos (* x y))")
  (lint-test "(cos 0)"			" cos: perhaps (cos 0) -> 1")
  (lint-test "(exp (* (+ x y) (log (+ y 1))))" " exp: perhaps (exp (* (+ x y) (log (+ y 1)))) -> (expt (+ y 1) (+ x y))")
  (lint-test "(exp (* (log x) a))"	" exp: perhaps (exp (* (log x) a)) -> (expt x a)")
  (lint-test "(exp (log (* x y)))"      " exp: perhaps (exp (log (* x y))) -> (* x y)")
  (lint-test "(acosh (cosh 0))"		" acosh: perhaps (acosh (cosh 0)) -> (acosh 1)")
  (lint-test "(exp (log 1))"		" exp: perhaps (exp (log 1)) -> 1")
  (if with-bignums
      (lint-test "(exp 0.0)"		" exp: perhaps (exp 0.0) -> 1.000E0")
      (lint-test "(exp 0.0)"		" exp: perhaps (exp 0.0) -> 1.0"))
  (lint-test "(sin x 0.0)"		" sin: sin has too many arguments: (sin x 0.0)")
  (lint-test "(sin)"			" sin: sin needs 1 argument: (sin)")
  (lint-test "(/ (sin x) (cos x))"      " /: perhaps (/ (sin x) (cos x)) -> (tan x)")

  (lint-test "(log 1)"			" log: perhaps (log 1) -> 0")
  (lint-test "(log (exp 0))"		" log: perhaps (log (exp 0)) -> 0")
  (lint-test "(log (exp (* x y)))"	" log: perhaps (log (exp (* x y))) -> (* x y)")
  (lint-test "(log (* x 1) (- x 0))"	" log: perhaps (log (* x 1) (- x 0)) -> 1.0")
  (lint-test "(log 2 2)"		" log: perhaps (log 2 2) -> 1")
  (lint-test "(log pi pi)"		" log: perhaps (log pi pi) -> 1.0")
  (lint-test "(log (* x pi) (* x pi))"	" log: perhaps (log (* x pi) (* x pi)) -> 1.0")
  (lint-test "(log (* x pi))"		"")
  (lint-test "(log (sqrt x))"           " log: perhaps (log (sqrt x)) -> (* 1/2 (log x))")
  (lint-test "(log (expt x y))"         " log: perhaps (log (expt x y)) -> (* y (log x))")
  (lint-test "(log (expt x y) z)"       " log: perhaps (log (expt x y) z) -> (* y (log x z))")

  (lint-test "(sqrt 4)"			" sqrt: perhaps (sqrt 4) -> 2")
  (if (not with-bignums) (lint-test "(sqrt 3)" ""))
  (lint-test "(sqrt 4.0)"		"")
  (lint-test "(sqrt (* (+ x 1) (+ x 1)))" "") ; tricky case, x might be -2 for example
  (lint-test "(sqrt)"			" sqrt: sqrt needs 1 argument: (sqrt)")
  (lint-test "(sqrt (- x 0))"		" sqrt: perhaps (sqrt (- x 0)) -> (sqrt x)")
  (lint-test "(sqrt (exp x))"           " sqrt: perhaps (sqrt (exp x)) -> (exp (/ x 2))")
  (lint-test "(complex (- x 0) 2)"	" complex: perhaps (complex (- x 0) 2) -> (complex x 2)")

  (lint-test "(floor 3.4)"		" floor: perhaps (floor 3.4) -> 3")
  (lint-test "(round 3.4+i)"		" round: in (round 3.4+1i), round's argument should be real, but 3.4+1i is complex?")
  (lint-test "(ceiling (floor 2.1))"	" ceiling: perhaps (ceiling (floor 2.1)) -> 2")
  (lint-test "(ceiling (floor x))"	" ceiling: perhaps (ceiling (floor x)) -> (floor x)")
  (lint-test "(truncate 2/3)"		" truncate: perhaps (truncate 2/3) -> 0")
  (lint-test "(truncate (/ 2 3))"	" truncate: perhaps (truncate (/ 2 3)) -> 0")
  (lint-test "(truncate (/ 12 (* 2 3)))" " truncate: perhaps (truncate (/ 12 (* 2 3))) -> 2")
  (lint-test "(truncate (* 2.0 (inexact->exact (log 3))))" " truncate: perhaps (truncate (* 2.0 (inexact->exact (log 3)))) -> (truncate (* 2.0 (log 3)))")
  (lint-test "(truncate (inexact->exact (log 3)))" " truncate: perhaps (truncate (inexact->exact (log 3))) -> (truncate (log 3))")
  (lint-test "(round (random 10))"      " round: perhaps (round (random 10)) -> (random 10)")
  (lint-test "(floor (random 10.0))"    " floor: perhaps (floor (random 10.0)) -> (random 10)")

  (lint-test "(inexact->exact (numerator x))"  "inexact->exact: perhaps (inexact->exact (numerator x)) -> (numerator x)")
  (lint-test "(exact->inexact (real-part x))" "") ; if complex?
  (lint-test "(inexact->exact (random 10))" " inexact->exact: perhaps (inexact->exact (random 10)) -> (random 10)")
  (lint-test "(exact->inexact (random 10))" "") ; this can't be changed to (random 10.0)
  (lint-test "(inexact->exact (floor x))" " inexact->exact: perhaps (inexact->exact (floor x)) -> (floor x)")
  (lint-test "(exact (round x))"        " exact: perhaps (exact (round x)) -> (round x)")
  (lint-test "(inexact (+ 1.0 x))"      " inexact: perhaps (inexact (+ 1.0 x)) -> (+ 1.0 x)")

  (lint-test "(abs (magnitude 1+i))"	" abs: perhaps (abs (magnitude 1+1i)) -> (magnitude 1+1i)")
  (lint-test "(magnitude 2/3)"		" magnitude: perhaps use abs here: (magnitude 2/3) magnitude: perhaps (magnitude 2/3) -> 2/3")
  (lint-test "(abs (- (* 2 x)))"	" abs: perhaps (abs (- (* 2 x))) -> (abs (* 2 x))")
  (lint-test "(abs (* (+ x 1) 1))"	" abs: perhaps (abs (* (+ x 1) 1)) -> (abs (+ x 1))")
  (lint-test "(magnitude (real-part z))" " magnitude: perhaps use abs here: (magnitude (real-part z))")
  (lint-test "(abs (denominator x))"    " abs: perhaps (abs (denominator x)) -> (denominator x)")
  (lint-test "(abs (modulo x 2))"       " abs: perhaps (abs (modulo x 2)) -> (modulo x 2)")
  (lint-test "(abs () ())"              " abs: abs has too many arguments: (abs () ())
                                          abs: in (abs () ()), abs's argument 1 should be real, but () is null?")

  (lint-test "(real-part 3.0)"		" real-part: perhaps (real-part 3.0) -> 3.0")
  (lint-test "(imag-part 3.0)"		" imag-part: perhaps (imag-part 3.0) -> 0.0")
  (lint-test "(real-part (abs x))"	" real-part: perhaps (real-part (abs x)) -> (abs x)")
  (lint-test "(imag-part (abs x))"	" imag-part: perhaps (imag-part (abs x)) -> 0.0")
  (lint-test "(imag-part (sin x))"	"")
  (lint-test "(real-part 1+i)"		"")
  (lint-test "(imag-part x)"		"")
  (lint-test "(real-part x)"		"")
  (lint-test "(imag-part (vector-ref x i))" "")
  (lint-test "(imag-part (x i))"	"")

  (lint-test "(string? (number->string x))" " string?: number->string always returns a string, so (string? (number->string x)) -> #t")
  (lint-test "(number? (string->number x))" " number?: string->number returns either #f or a number, so (number? (string->number x)) -> (string->number x)")

  (lint-test "(numerator 1/3)"		" numerator: perhaps (numerator 1/3) -> 1")
  (lint-test "(numerator 3)"		" numerator: perhaps (numerator 3) -> 3")
  (lint-test "(numerator (floor x))"	" numerator: perhaps (numerator (floor x)) -> (floor x)")
  (lint-test "(denominator (floor x))"	" denominator: perhaps (denominator (floor x)) -> 1")
  (lint-test "(denominator 3)"		" denominator: perhaps (denominator 3) -> 1")
  (lint-test "(denominator (round (+ x 1)))" " denominator: perhaps (denominator (round (+ x 1))) -> 1")
  (lint-test "(numerator (round (+ x 1)))" " numerator: perhaps        (numerator (round (+ x 1))) -> (round (+ x 1))")  
  (lint-test "(> (numerator x) 0)"       " >: perhaps (> (numerator x) 0) -> (> x 0)")
  (lint-test "(negative? (numerator x))" " negative?: perhaps (negative? (numerator x)) -> (negative? x)")

  (lint-test "(random 0)"		" random: perhaps (random 0) -> 0")
  (lint-test "(random 0.0)"		" random: perhaps (random 0.0) -> 0.0")
  (lint-test "(random x)"		"")
  (lint-test "(random 1)"		" random (line 0): perhaps (random 1) -> 0")
  (lint-test "(random -1)"		" random (line 0): perhaps (random -1) -> 0")
  (lint-test "(random 0 y)"		"")

  (lint-test "(lognot 1)"		" lognot: perhaps (lognot 1) -> -2")
  (lint-test "(lognot 1/2)"		" lognot: in (lognot 1/2), lognot's argument should be an integer, but 1/2 is rational?")
  (if with-bignums
      (lint-test "(ash 2 64)"		" ash: perhaps (ash 2 64) -> 36893488147419103232")
      (lint-test "(ash 2 64)"		""))
  (lint-test "(ash 1 7)"		" ash: perhaps (ash 1 7) -> 128")
  (lint-test "(ash x 0)"                " ash: perhaps (ash x 0) -> x")
  (lint-test "(quotient (remainder x y) y)" " quotient: perhaps (quotient (remainder x y) y) -> 0")
  (lint-test "(ash 0 x)"                " ash: perhaps (ash 0 x) -> 0")
  (lint-test "(modulo (abs x) y)"       " modulo: perhaps (modulo (abs x) y) -> (modulo x y)")

  (lint-test "(complex 1.0 0)"		" complex: perhaps (complex 1.0 0) -> 1.0")
  (lint-test "(expt 0 x)"		" expt: perhaps (expt 0 x) -> 0")
  (lint-test "(expt x 0)"		" expt: perhaps (expt x 0) -> 1")
  (lint-test "(expt (* 2 x) 1)"		" expt: perhaps (expt (* 2 x) 1) -> (* 2 x)")
  (lint-test "(expt (* 2 x) -1)"	" expt: perhaps (expt (* 2 x) -1) -> (/ (* 2 x))")
  (lint-test "(expt 2 3)"		" expt: perhaps (expt 2 3) -> 8")
  (lint-test "(expt 1/2 -2)"		" expt: perhaps (expt 1/2 -2) -> 4")
  (lint-test "(expt 2 1/2)"		"")
  (lint-test "(expt 1.0 1.0)"		"")
  (lint-test "(expt 0 0)"		" expt: perhaps (expt 0 0) -> 1")
  (lint-test "(expt (expt x y) z)"      " expt: perhaps (expt (expt x y) z) -> (expt x (* y z))")

  (lint-test "(angle -1)"		" angle: perhaps (angle -1) -> pi")
  (lint-test "(angle 0.0)"		" angle: perhaps (angle 0.0) -> 0.0")
  (lint-test "(angle pi)"		" angle: perhaps (angle pi) -> 0.0")

  (lint-test "(atan x 0.0)"		"")
  (lint-test "(atan (/ x y))"		" atan: perhaps (atan (/ x y)) -> (atan x y)")

  (lint-test "(inexact->exact 1.5)"	" inexact->exact: perhaps (inexact->exact 1.5) -> 3/2")
  (lint-test "(inexact->exact (floor x))" " inexact->exact: perhaps (inexact->exact (floor x)) -> (floor x)")
  (lint-test "(inexact->exact 2/3)"	" inexact->exact: perhaps (inexact->exact 2/3) -> 2/3")

  (lint-test "(logior x (logior y z))"	" logior: perhaps (logior x (logior y z)) -> (logior x y z)")
  (lint-test "(logior x 3 7 3 1 x)"	" logior: perhaps (logior x 3 7 3 1 x) -> (logior 7 x)")
  (lint-test "(logior x)"		" logior: perhaps (logior x) -> x")
  (lint-test "(logior x -1 2 y)"	" logior: perhaps (logior x -1 2 y) -> -1")
  (lint-test "(logior 6 2)"		" logior: perhaps (logior 6 2) -> 6")
  (lint-test "(logior)"			" logior: perhaps (logior) -> 0")
  (lint-test "(logior x 0 y)"		" logior: perhaps (logior x 0 y) -> (logior x y)")

  (lint-test "(logand x 3 7 3 1 x)"	" logand: perhaps (logand x 3 7 3 1 x) -> (logand 1 x)")
  (lint-test "(logand 3 91 2)"		" logand: perhaps (logand 3 91 2) -> 2")
  (lint-test "(logand)"			" logand: perhaps (logand) -> -1")
  (lint-test "(logand (* x 3))"		" logand: perhaps (logand (* x 3)) -> (* x 3)")
  (lint-test "(logand (* x 3) 0 y)"	" logand: perhaps (logand (* x 3) 0 y) -> 0")
  (lint-test "(logand -1 x -1 y)"	" logand: perhaps (logand -1 x -1 y) -> (logand x y)")
  (lint-test "(logand x (logand y 1))"	" logand: perhaps (logand x (logand y 1)) -> (logand x y 1)")
  (lint-test "(logand x (logand y 0))"	" logand: perhaps (logand x (logand y 0)) -> 0")

  (lint-test "(logxor x y x z)"		"")
  (lint-test "(logxor 2 4 1)"		" logxor: perhaps (logxor 2 4 1) -> 7")
  (lint-test "(logxor x)"		" logxor: perhaps (logxor x) -> x")
  (lint-test "(logxor x x)"		" logxor: perhaps (logxor x x) -> 0")
  (lint-test "(integer-length 1)"       " integer-length: perhaps (integer-length 1) -> 1")

  (lint-test "(gcd x (gcd x y))"	" gcd: perhaps (gcd x (gcd x y)) -> (gcd x y)")
  (lint-test "(lcm x (lcm x y))"	" lcm: perhaps (lcm x (lcm x y)) -> (lcm x y)")
  (lint-test "(gcd x x)"		" gcd: perhaps (gcd x x) -> (abs x)")
  (lint-test "(gcd)"			" gcd: perhaps (gcd) -> 0")
  (lint-test "(lcm)"			" lcm: perhaps (lcm) -> 1")
  (lint-test "(gcd x y 1 3)"		" gcd: perhaps (gcd x y 1 3) -> 1")
  (lint-test "(lcm x y 0 3)"		" lcm: perhaps (lcm x y 0 3) -> 0")
  (lint-test "(gcd 12 18)"		" gcd: perhaps (gcd 12 18) -> 6")
  (lint-test "(gcd x 0)"		" gcd: perhaps (gcd x 0) -> (abs x)")
  (lint-test "(lcm 12 18)"		" lcm: perhaps (lcm 12 18) -> 36")
  (lint-test "(lcm x)"			" lcm: perhaps (lcm x) -> (abs x)")
  (lint-test "(lcm x x x)"		" lcm: perhaps (lcm x x x) -> (abs x)")
  (lint-test "(if (negative? (gcd x y)) a b)" " if: perhaps (negative? (gcd x y)) -> #f if: perhaps (if (negative? (gcd x y)) a b) -> b")
  (lint-test "(gcd (random x) (random x))" "")

  (lint-test "(max x)"			" max: perhaps (max x) -> x")
  (lint-test "(max 3 4 5)"		" max: perhaps (max 3 4 5) -> 5")
  (lint-test "(max 3 x 4 5)"		" max: perhaps (max 3 x 4 5) -> (max 5 x)")
  (lint-test "(max 3.0 x 4/5 5)"	" max: perhaps (max 3.0 x 4/5 5) -> (max 5 x)")
  (lint-test "(min 3.0 x 4/5 5)"	" min: perhaps (min 3.0 x 4/5 5) -> (min 4/5 x)")
  (lint-test "(max 3.0 x x 5)"		" max: it looks odd to have repeated arguments in (max 3.0 x x 5) max: perhaps (max 3.0 x x 5) -> (max 5 x)")
  (lint-test "(max 3 (max 4 x) y)"	" max: perhaps (max 3 (max 4 x) y) -> (max 4 x y)")
  (lint-test "(max 4 (min 3 x) y)"	" max: perhaps (max 4 (min 3 x) y) -> (max 4 y)")
  (lint-test "(min 4 (max 3 x) y)"	"")
  (lint-test "(min (max x 3) 4 y)"	"")
  (lint-test "(min 3 (max 4 x) y)"	" min: perhaps (min 3 (max 4 x) y) -> (min 3 y)")
  (lint-test "(max (min x 3) (min x 3))" " max: this looks odd: (max (min x 3) (min x 3)) max: perhaps (max (min x 3) (min x 3)) -> (min x 3)")
  (lint-test "(min x (max y x))"	" min: perhaps (min x (max y x)) -> x")
  (lint-test "(max (min y x) x)"	" max: perhaps (max (min y x) x) -> x")
  (lint-test "(max 3 (min x 3))"        " max: perhaps (max 3 (min x 3)) -> 3")
  (lint-test "(min x (max y z (+ 21 x) x (* y z)))" " min: perhaps (min x (max y z (+ 21 x) x (* y z))) -> x")
  (lint-test "(max 0 (string-length x))" " max: perhaps (max 0 (string-length x)) -> (string-length x)")
  (lint-test "(max (string-length x) -1 y)" " max: perhaps (max (string-length x) -1 y) -> (max (string-length x) y)")

  (lint-test "(equal? x y z)"		" equal?: equal? has too many arguments: (equal? x y z)")
  (lint-test "(= 1 y 2)"		" =: this comparison can't be true: (= 1 y 2)")
  (lint-test "(= x 1.5)"		" =: = can be troublesome with floats: (= x 1.5)")
  (lint-test "(= x 0.0)"		"")
  (lint-test "(= x 1.0 x)"		" =: it looks odd to have repeated arguments in (= x 1.0 x)")
  (lint-test "(= x x)"                  " =: this looks odd: (= x x), perhaps use (not (nan? x))")
  (lint-test "(= (- x y) 0)"		" =: perhaps (= (- x y) 0) -> (= x y)")
  (lint-test "(= 0.0 (- x y))"		" =: perhaps (= 0.0 (- x y)) -> (= x y)")
  (lint-test "(= (- (abs x) 2) 0)"	" =: perhaps (= (- (abs x) 2) 0) -> (= (abs x) 2)")
  (lint-test "(= (length x) 0)"         " =: perhaps (assuming x is a list), (= (length x) 0) -> (null? x)")
  (lint-test "(= (length x) 1)"         " =: perhaps (assuming x is a list), (= (length x) 1) -> (and (pair? x) (null? (cdr x)))")

  (lint-test "(> (- fltdur 50868) 256)" " >: perhaps (> (- fltdur 50868) 256) -> (> fltdur 51124)")
  (lint-test "(= (- fltdur 50868) 256)" " =: perhaps (= (- fltdur 50868) 256) -> (= fltdur 51124)")
  (lint-test "(= (- fltdur 50868) 0)"   " =: perhaps (= (- fltdur 50868) 0) -> (= fltdur 50868)")
  (lint-test "(< 256 (- fltdur 50868))" " <: perhaps (< 256 (- fltdur 50868)) -> (> fltdur 51124)")
  (lint-test "(= 256 (- fltdur 50868))" " =: perhaps (= 256 (- fltdur 50868)) -> (= fltdur 51124)")
  (lint-test "(> (+ fltdur 50868) 256)" " >: perhaps (> (+ fltdur 50868) 256) -> (> fltdur -50612)")
  (lint-test "(= (+ fltdur 50868) 256)" " =: perhaps (= (+ fltdur 50868) 256) -> (= fltdur -50612)")
  (lint-test "(= (+ fltdur 50868) 0)"   " =: perhaps (= (+ fltdur 50868) 0) -> (= fltdur -50868)")
  (lint-test "(< 256 (+ fltdur 50868))" " <: perhaps (< 256 (+ fltdur 50868)) -> (> fltdur -50612)")
  (lint-test "(= 256 (+ fltdur 50868))" " =: perhaps (= 256 (+ fltdur 50868)) -> (= fltdur -50612)")

  (lint-test "(zero? (- x))"            " zero?: perhaps (zero? (- x)) -> (zero? x)")
  (lint-test "(zero? (- x y))"          " zero?: perhaps (zero? (- x y)) -> (= x y)")
  (lint-test "(zero? (- x y z))"        " zero?: perhaps (zero? (- x y z)) -> (= x (+ y z))")
  (lint-test "(positive? (- x))"        " positive?: perhaps (positive? (- x)) -> (negative? x)")
  (lint-test "(positive? (- x y))"      " positive?: perhaps (positive? (- x y)) -> (> x y)")
  (lint-test "(positive? (- x y z))"    " positive?: perhaps (positive? (- x y z)) -> (> x (+ y z))")
  (lint-test "(negative? (- x))"        " negative?: perhaps (negative? (- x)) -> (positive? x)")
  (lint-test "(negative? (- x y))"      " negative?: perhaps (negative? (- x y)) -> (< x y)")
  (lint-test "(negative? (- x y z))"    " negative?: perhaps (negative? (- x y z)) -> (< x (+ y z))")
  (lint-test "(negative? (string-length s))" " negative?: string-length can't be negative: (negative? (string-length s))")
  (lint-test "(not (positive? (- n 2)))" " not: perhaps (positive? (- n 2)) -> (> n 2)")

  (lint-test "(+ 1 +i)"                 " +: +i is not a number in s7")
  (lint-test "(let ((|ABS| abs)) |ABS|)"
	     " let: | is not a special character in s7, so |ABS| is not the symbol ABS
               let: perhaps (let ((|ABS| abs)) |ABS|) -> abs
               let: assuming we see all set!s, the binding (|ABS| abs) is pointless: perhaps (let ((|ABS| abs)) |ABS|) -> abs")

  (lint-test "(char? '#\\a)"            
	     " char?: perhaps (char? '#\\a) -> #t
               char?: (char? '#\\a) is always #t
               char?: quote is not needed here: '#\\a")
  (lint-test "(string? '\"a\")"         
	     " string?: perhaps (string? '\"a\") -> #t
               string?: (string? '\"a\") is always #t
               string?: quote is not needed here: '\"a\"")

  (lint-test "(memq 1.0 x)"		" memq: (memq 1.0 x): perhaps memq -> memv")
  (lint-test "(assq \"test\" x)"	" assq: (assq \"test\" x): perhaps assq -> assoc")
  (lint-test "(assq (cons 1 2) x)"	" assq: (assq (cons 1 2) x): perhaps assq -> assoc")
  (lint-test "(assv #(a) x)"		" assv: (assv #(a) x): perhaps assv -> assoc")
  (lint-test "(member 'a x (lambda (a b c) (eq? a b)))" " member: member equality function (optional third arg) should take two arguments")
  (lint-test "(member 'a x (lambda (a b) (eq? a (car b))))" " member: member might perhaps be assq")
  (lint-test "(member y x (lambda (a b) (equal? a (car b))))" " member: member might perhaps be assoc")
  (lint-test "(member 1 x (lambda (a b) (> a b)))" " member: perhaps (lambda (a b) (> a b)) -> >")
  (lint-test "(member 1 x (lambda (a b) (> b a)))" " member: perhaps (lambda (a b) (> b a)) -> <")
  (lint-test "(member (abs x) lt (lambda (a b) (< b 2)))" " member: a is ignored, so perhaps (member #f ...)")
  (lint-test "(member 1 x abs)"		" member: abs is a questionable member function")
  (lint-test "(member x (list \"asdf\"))" 
	     " member: perhaps (member x (list \"asdf\")) -> (string=? x \"asdf\")
               member: perhaps (list \"asdf\") -> '(\"asdf\")")
  (lint-test "(member x (list \"asd\" \"abc\" \"asd\"))" 
	     " member: duplicated entry \"asd\" in (list \"asd\" \"abc\" \"asd\") 
               member: perhaps (list \"asd\" \"abc\" \"asd\") -> '(\"asd\" \"abc\" \"asd\")")
  (lint-test "(memq x '(1))"		" memq: perhaps (memq x '(1)) -> (= x 1)")
  (lint-test "(memq x '(begin))"	" memq: perhaps (memq x '(begin)) -> (eq? x 'begin)")
  (lint-test "(memq x (list 'car))"     
	     " memq: perhaps (memq x (list 'car)) -> (eq? x 'car)
               memq: perhaps (list 'car) -> '(car)")
  (lint-test "(memq x '(a 'b c))"       " memq: stray quote? (memq x '(a 'b c))
                                          memq: memq should be member in (memq x '(a 'b c))
                                          memq: pointless list member: 'b in (memq x '(a 'b c))")
  (unless pure-s7
    (lint-test "(memq x '(a ,b c))"     " memq: memq should be member in (memq x '(a (unquote b) c))
                                          memq: stray comma? (memq x '(a (unquote b) c))"))
  (lint-test "(memq x '(a (+ 1 2) 3))"  " memq: memq should be member in (memq x '(a (+ 1 2) 3))
                                          memq: pointless list member: (+ 1 2) in (memq x '(a (+ 1 2) 3))")
  (lint-test "(memq x '(a #(a)))"       " memq: memq should be member in (memq x '(a #(a)))
                                          memq: pointless list member: #(a) in (memq x '(a #(a)))")
  (lint-test "(memv x '(#f #\\c a 1 () :a))"  "")
  (lint-test "(memq x '(a b a c))"      " memq: duplicated entry a in '(a b a c)")
  (lint-test "(assq x '((a . 1)))"      "")
  (lint-test "(member x (list \"a\" \"b\"))" " member: perhaps (list \"a\" \"b\") -> '(\"a\" \"b\")")
  (lint-test "(memq x (list 'a 'b 'x))" " memq: perhaps (list 'a 'b 'x) -> '(a b x)")
  (lint-test "(memq x (map car y))"     " memq: perhaps use assoc: (memq x (map car y)) -> (assq x y)")
  (lint-test "(memq #t (map null? items))"  " memq: perhaps (memq #t (map null? items)) -> (memq () items)")
  (lint-test "(memq #t (map cadr items))"   " memq: perhaps avoid 'map: (memq #t (map cadr items)) -> (member #t items (lambda (a b) (cadr b)))")
  (lint-test "(memq #t (map b items))"   " memq: perhaps avoid 'map: (memq #t (map b items)) -> (member #t items (lambda (a c) (b c)))")
  (lint-test "(member x (map floor items))" " member: perhaps avoid 'map: (member x (map floor items)) -> (member x items (lambda (a b) (equal? a (floor b))))")
  (lint-test "(member x (map b items))" " member: perhaps avoid 'map: (member x (map b items)) -> (member x items (lambda (a c) (equal? a (b c))))")
  (lint-test "(member x (cons y z))"        " member: perhaps avoid 'cons: (member x (cons y z)) -> (or (equal? x y) (member x z))")
  (lint-test "(member x (append (list x) y))" 
	     " member: perhaps (member x (append (list x) y)) -> (or (equal? x x) (member x y))
               member: perhaps (append (list x) y) -> (cons x y)")
  (lint-test "(memq (string->symbol x) (map string->symbol y))" " memq: perhaps (memq (string->symbol x) (map string->symbol y)) -> (member x y string=?)")
  (lint-test "(memv #\\= (string->list x))" " memv: perhaps (memv #\\= (string->list x)) -> (char-position #\\= x)")
  (lint-test "(memv #\\= (string->list x start end))"  " memv: perhaps (memv #\\= (string->list x start end)) -> (char-position #\\= x start end)")
  (lint-test "(memv (string-ref s 0) (string->list x))" " memv: perhaps (memv (string-ref s 0) (string->list x)) -> (char-position (string-ref s 0) x)")
  (lint-test "(memv (string-ref x 0) '(+ -))" " memv: memv could be memq in (memv (string-ref x 0) '(+ -))
                                                memv: perhaps (memv (string-ref x 0) '(+ -)) -> #f")
  (lint-test "(memv (string-ref x 0) '(#\\+ -))" " memv: perhaps (memv (string-ref x 0) '(#\\+ -)) -> (memv (string-ref x 0) '(#\\+))")
  (lint-test "(memq expr '(#t #f))"     " memq: perhaps (memq expr '(#t #f)) -> (boolean? expr)")
  (lint-test "(member (denominator k/n) '(1 2 3 4 6))" " member: (member (denominator k/n) '(1 2 3 4 6)): perhaps member -> memv
                                                         member: member could be memv in (member (denominator k/n) '(1 2 3 4 6))")

  (lint-test "(member x '(1 0))"                    " member: member could be memv in (member x '(1 0))")
  (lint-test "(memq (strname 0) '(#\\{ #\\[ #\\())" " memq: memq should be memv in (memq (strname 0) '(#\\{ #\\[ #\\())")
  (lint-test "(member (car op) '(x y z))"           " member: member could be memq in (member (car op) '(x y z))")
  (lint-test "(memv (car op) '(x y z))"             " memv: memv could be memq in (memv (car op) '(x y z))")
  (lint-test "(member (car tail) '(:x :y :z))"      " member: member could be memq in (member (car tail) '(:x :y :z))")
  (lint-test "(member x (list 1 0))"                " member: member could be memv in (member x (list 1 0))  
                                                      member: perhaps (list 1 0) -> '(1 0)")
  (lint-test "(memq (strname 0) (list #\\{ #\\[ #\\())" " memq: memq should be memv in (memq (strname 0) (list #\\{ #\\[ #\\()) 
                                                          memq: perhaps (list #\\{ #\\[ #\\() -> '(#\\{ #\\[ #\\()")
  (lint-test "(member (car op) (list x y z))"       "")
  (lint-test "(member (car op) (list \"a\" (f x)))" "")
  (lint-test "(member (car op) (list \"a\" #(1)))"  " member: perhaps (list \"a\" #(1)) -> '(\"a\" #(1)) member: #(1) could be #i(1)")
  (lint-test "(member (car op) '(\"a\" #()))"       "")
  (lint-test "(memq (car op) '(\"a\" #()))"         " memq: memq should be member in (memq (car op) '(\"a\" #())) 
                                                      memq: pointless list member: \"a\" in (memq (car op) '(\"a\" #()))")
  (lint-test "(member (car op) '(#f ()))"           " member: member could be memq in (member (car op) '(#f ()))")
  (lint-test "(assq c '((#\\b . 2) (#\\o . 8) (#\\d . 10)))" " assq: assq should be assv in (assq c '((#\\b . 2) (#\\o . 8) (#\\d . 10)))")
  (lint-test "(assoc order '((1 . 1.0) (2 . 1.3)) =)" "")
  (lint-test "(assoc order '((1 . 1.0) (2 . 1.3)))" " assoc: assoc could be assv in (assoc order '((1 . 1.0) (2 . 1.3)))")
  (lint-test "(assq order '((1 . 1.0) (2 . 1.3)))"  " assq: assq should be assv in (assq order '((1 . 1.0) (2 . 1.3)))")
  (lint-test "(assq c (list '(#\\b . 2) '(#\\o . 8) '(#\\d . 10)))" 
                                                    " assq: assq should be assv in (assq c (list '(#\\b . 2) '(#\\o . 8) '(#\\d . 10)))
                                                      assq: perhaps (list '(#\\b . 2) '(#\\o . 8) '(#\\d . 10)) -> '((#\\b . 2) (#\\o . 8) (#\\d . 10))")
  (lint-test "(assoc order (list '(1 . 1.0) '(2 . 1.3)))" " assoc: assoc could be assv in (assoc order (list '(1 . 1.0) '(2 . 1.3)))
                                                            assoc: perhaps (list '(1 . 1.0) '(2 . 1.3)) -> '((1 . 1.0) (2 . 1.3))")
  (lint-test "(assv order (list '(a . 1.0) '(b . 1.3)))"  " assv: assv should be assoc in (assv order (list '(a . 1.0) '(b . 1.3)))
                                                            assv: perhaps (list '(a . 1.0) '(b . 1.3)) -> '((a . 1.0) (b . 1.3))")
  (lint-test "(member (car (string->list S)) (string->list x))" 
	     " member: perhaps (member (car (string->list S)) (string->list x)) -> (char-position (car (string->list S)) x)
               member: perhaps (car (string->list S)) -> (string-ref S 0)")
  (lint-test "(memq x '(a #<eof> #<undefined> #<unspecified>))" "") 
  (lint-test "(member x '(a #<eof> #<undefined> #<unspecified>))" " member: member could be memq in (member x '(a #<eof> #<undefined> #<unspecified>))")
  
  (lint-test "(if #f x y)"		" if: if test is never true: (if #f x y) if: perhaps (if #f x y) -> y")
  (lint-test "(if #t #f)"		" if: if test is never false: (if #t #f)  if: perhaps (if #t #f) -> #f")
  (lint-test "(if x #f #t)"		" if: perhaps (if x #f #t) -> (not x)")
  (lint-test "(if x #t #t)"		" if: if is not needed here: (if x #t #t) -> #t")
  (lint-test "(if x #f #f)"		" if: if is not needed here: (if x #f #f) -> #f")
  (lint-test "(if x (+ y 1) (+ y 1))"	" if: if is not needed here: (if x (+ y 1) (+ y 1)) -> (+ y 1)")
  (lint-test "(if #f #f)"		" if: perhaps (if #f #f) -> #<unspecified>")
  (lint-test "(if #f x)"		" if: if test is never true: (if #f x)  if: perhaps (if #f x) -> #<unspecified>")
  (lint-test "(if #t x y)"		" if: if test is never false: (if #t x y)  if: perhaps (if #t x y) -> x")
  (lint-test "(if x #t #f)"		" if: perhaps (if x #t #f) -> x")
  (lint-test "(if x y #f)"		" if: perhaps (if x y #f) -> (and x y)")
  (lint-test "(if x y #t)"		" if: perhaps (if x y #t) -> (or (not x) y)")
  (lint-test "(if x #f y)"		" if: perhaps (if x #f y) -> (and (not x) y)")
  (lint-test "(if x #t y)"		" if: perhaps (if x #t y) -> (or x y)")
  (lint-test "(if (not x) y #t)"	" if: perhaps (if (not x) y #t) -> (or x y)")
  (lint-test "(if (not x) #f y)"	" if: perhaps (if (not x) #f y) -> (and x y)")
  (lint-test "(if x x y)"               " if: perhaps (if x x y) -> (or x y)")
  (lint-test "(if (not x) y x)"         " if: perhaps (if (not x) y x) -> (or x y)")
  (lint-test "(if (< 1 2) x y)"		" if: perhaps (< 1 2) -> #t  if: perhaps (if (< 1 2) x y) -> x")
  (lint-test "(if (and x z) y #f)"      " if: perhaps (if (and x z) y #f) -> (and x z y)")
  (lint-test "(if (and x z) (and y w) #f)" " if: perhaps (if (and x z) (and y w) #f) -> (and x z y w)")
  (lint-test "(if (or x z) #t y)"       " if: perhaps (if (or x z) #t y) -> (or x z y)")
  (lint-test "(if (or x z) #t (or y w))" " if: perhaps (if (or x z) #t (or y w)) -> (or x z y w)")
  (lint-test "(if (not (or x z)) y #t)" " if: perhaps (if (not (or x z)) y #t) -> (or x z y)")
  (lint-test "(if (not (and x z)) #f y)" " if: perhaps (if (not (and x z)) #f y) -> (and x z y)")
  (lint-test "(if (cons 1 2) x y)"	" if: if test is never false: (if (cons 1 2) x y)")
  (lint-test "(if (getenv x) x w)"      " if: if test is never false: (if (getenv x) x w)")
  (lint-test "(if y)"			" if: if has too few clauses: (if y)")
  (lint-test "(if y z a b)"		" if: if has too many clauses: (if y z a b)")
  (lint-test "(if x y (if z y))"	" if: perhaps (if x y (if z y)) -> (if (or x z) y)")
  (lint-test "(if x y (if x y))"	" if: perhaps (if x y (if x y)) -> (if x y) if: weird repetition! perhaps (if x y (if x y)) -> (if x y)")
  (lint-test "(if x (if x y))"		" if: perhaps (if x (if x y)) -> (if x y)")
  (lint-test "(if x (set! y #t) (set! y #f))" " if: perhaps (if x (set! y #t) (set! y #f)) -> (set! y x)")
  (lint-test "(if x (f 1 2 1) (f 1 2 2))" " if: perhaps (if x (f 1 2 1) (f 1 2 2)) -> (f 1 2 (if x 1 2))")
  (lint-test "(if x (f 1 1 1) (f 1 2 1))" " if: perhaps (if x (f 1 1 1) (f 1 2 1)) -> (f 1 (if x 1 2) 1)")
  (lint-test "(if x (f (+ x 1) (* y 2) (+ x 1)) (f (+ x 1) (+ x 1) (+ x 1)))"
	     " if: perhaps (if x (f (+ x 1) (* y 2) (+ x 1)) (f (+ x 1) (+ x 1) (+ x 1))) -> (f (+ x 1) (if x (* y 2) (+ x 1)) (+ x 1))")
  (lint-test "(if (and (= x y) z) (+ x 1) #f)" " if: perhaps (if (and (= x y) z) (+ x 1) #f) -> (and (= x y) z (+ x 1))")
  (lint-test "(if x (f y) (else z))"    " if: else (as car of false branch of if) makes no sense: (if x (f y) (else z))")

  (lint-test "(if x (set! y #f) (set! y #t))" " if: perhaps (if x (set! y #f) (set! y #t)) -> (set! y (not x))")
  (lint-test "(if x (set! y x) (set! y 21))"  " if: perhaps (if x (set! y x) (set! y 21)) -> (set! y (or x 21))")
  (lint-test "(if x (set! y z) (set! y w))"   " if: perhaps (if x (set! y z) (set! y w)) -> (set! y (if x z w))")
  (lint-test "(if x (+ y 1) (- y 1))"    " if: perhaps (if x (+ y 1) (- y 1)) -> ((if x + -) y 1)")
  (lint-test "(if x (set! y 1) (set! y (+ x 1)))" " if: perhaps (if x (set! y 1) (set! y (+ x 1))) -> (set! y (if x 1 (+ x 1)))")
  (lint-test "(if x (set! y (+ x 1)) (set! y 1))" " if: perhaps (if x (set! y (+ x 1)) (set! y 1)) -> (set! y (if x (+ x 1) 1))")
  (lint-test "(if x (or y z) (and y z))"      " if: perhaps (if x (or y z) (and y z)) -> ((if x or and) y z)")
  (lint-test "(if x (or (f y) z) (and y (f z)))" "")
  (lint-test "(if (positive? x) (log x) (exp x))" " if: perhaps (if (positive? x) (log x) (exp x)) -> ((if (positive? x) log exp) x)")

  (lint-test "(if x (if y z))"		" if: perhaps (if x (if y z)) -> (if (and x y) z)")
  (lint-test "(if (cadr x) (if (cadr x) 0))" " if: perhaps (if (cadr x) (if (cadr x) 0)) -> (if (cadr x) 0)")
  (lint-test "(if (cadr x) 3 (if (not (cadr x)) 4))" " if: perhaps (if (cadr x) 3 (if (not (cadr x)) 4)) -> (if (cadr x) 3 4)")
  (lint-test "(if (cadr x) 3 (if (not (cadr x)) 4 5))" " if: perhaps (if (cadr x) 3 (if (not (cadr x)) 4 5)) -> (if (cadr x) 3 4)")
  (lint-test "(if x x y)"		" if: perhaps (if x x y) -> (or x y)")
  (lint-test "(if (not x) x y)"         " if: perhaps (if (not x) x y) -> (and x y)")
  (lint-test "(if x (not x) y)"         " if: perhaps (if x (not x) y) -> (and (not x) y)")
  (lint-test "(if (not x) y x)"         " if: perhaps (if (not x) y x) -> (or x y)")
  (lint-test "(if x y (not x))"         " if: perhaps (if x y (not x)) -> (or (not x) y)")

  (lint-test "(if a A A)"               " if: if is not needed here: (if a A A) -> A")
  (lint-test "(if A A (if B B C))"      " if: perhaps (if A A (if B B C)) -> (or A (if B B C))  if: perhaps (if B B C) -> (or B C)")
  (lint-test "(if a (if b A) A)"        " if: perhaps (if a (if b A) A) -> (if (or (not a) b) A)")
  (lint-test "(if a (if (not a) B) A)"  " if: perhaps (if a (if (not a) B) A) -> (if (not a) A)")
  (lint-test "(if a (if (not a) B C) A)"  " if: perhaps (if a (if (not a) B C) A) -> (if a C A)")
  (lint-test "(if a A (if b B A))"      " if: perhaps (if a A (if b B A)) -> (if (or a (not b)) A B)")
  (lint-test "(if a A (if b A B))"      " if: perhaps (if a A (if b A B)) -> (if (or a b) A B)")
  (lint-test "(if a (if b B A) A)"      " if: perhaps (if a (if b B A) A) -> (if (and a b) B A)")
  (lint-test "(if a (if b A B) A)"      " if: perhaps (if a (if b A B) A) -> (if (and a (not b)) B A)")
  (lint-test "(if a A (if (not a) B))"  " if: perhaps (if a A (if (not a) B)) -> (if a A B)")

  (lint-test "(if A (if B C D) D)"        " if: perhaps (if A (if B C D) D) -> (if (and A B) C D)")
  (lint-test "(if A (if B C D) C)"        " if: perhaps (if A (if B C D) C) -> (if (and A (not B)) D C)")
  (lint-test "(if A B (if C B D))"        " if: perhaps (if A B (if C B D)) -> (if (or A C) B D)")
  (lint-test "(if A B (if C D B))"        " if: perhaps (if A B (if C D B)) -> (if (or A (not C)) B D)")
  (lint-test "(if A (and B C) (and B D))" " if: perhaps (if A (and B C) (and B D)) -> (and B (if A C D))")
  (lint-test "(if A (or B C) (or B D))"   " if: perhaps (if A (or B C) (or B D)) -> (or B (if A C D))")
  (lint-test "(if A (and B C) (and D C))" " if: perhaps (if A (and B C) (and D C)) -> (and (if A B D) C)")
  (lint-test "(if A (or B C) (or D C))"   " if: perhaps (if A (or B C) (or D C)) -> (or (if A B D) C)")

  (lint-test "(if a (if b A B) (if b B A))" 
	     " if: perhaps (if a (if b A B) (if b B A)) -> (if (eq? (not a) (not b)) A B)")
  (lint-test "(if (not a) (if b A B) (if b B A))" 
	     " if: perhaps (if (not a) (if b A B) (if b B A)) -> (if (eq? (not a) (not b)) B A)")
  (lint-test "(if (not a) (if (not b) A B) (if (not b) B A))" 
	     " if: perhaps (if (not a) (if (not b) A B) (if (not b) B A)) -> (if (eq? (not a) (not b)) A B)")
  (lint-test "(if a (if (not b) A B) (if (not b) B A))" 
	     " if: perhaps (if a (if (not b) A B) (if (not b) B A)) -> (if (eq? (not a) (not b)) B A)")
  (lint-test "(if a (if b A B) (if b A B))" 
	     " if: if is not needed here: (if a (if b A B) (if b A B)) -> (if b A B)")
  (lint-test "(if test (< a b) (> b a))"        " if: if is not needed here: (if test (< a b) (> b a)) -> (< a b)")
  (lint-test "(if test (< a b c) (> c b a))"    " if: if is not needed here: (if test (< a b c) (> c b a)) -> (< a b c)")
  (lint-test "(if test (* a b) (* b a))"        " if: if is not needed here: (if test (* a b) (* b a)) -> (* a b)")
  (lint-test "(if test (< a b) (not (>= a b)))" 
	     " if: if is not needed here: (if test (< a b) (not (>= a b))) -> (< a b)
               if: perhaps (not (>= a b)) -> (< a b)")

  (lint-test "(if A (if B C #f) #f)"    " if: perhaps (if A (if B C #f) #f) -> (and A B C)            if: perhaps (if B C #f) -> (and B C)")
  (lint-test "(if A (if B #f D) #f)"    " if: perhaps (if A (if B #f D) #f) -> (and A (not B) D)      if: perhaps (if B #f D) -> (and (not B) D)")
  (lint-test "(if A #f (if C #f D))"    " if: perhaps (if A #f (if C #f D)) -> (and (not (or A C)) D) if: perhaps (if C #f D) -> (and (not C) D)")
  (lint-test "(if A #f (if C D #f))"    " if: perhaps (if A #f (if C D #f)) -> (and (not A) C D)      if: perhaps (if C D #f) -> (and C D)")
  (lint-test "(if A (if B d c) (if B d a))" " if: perhaps (if A (if B d c) (if B d a)) -> (if B d (if A c a))")
  (lint-test "(if A (if B c a) (if B d a))" " if: perhaps (if A (if B c a) (if B d a)) -> (if B (if A c d) a)")

  (lint-test "(if (> (random 10) 1) (> (random 10) 1) x)" "")
  (lint-test "(if (assq (string->symbol x) y) (assq (string->symbol x) y) z)" 
	     " if: perhaps (if (assq (string->symbol x) y) (assq (string->symbol x) y) z) -> (or (assq (string->symbol x) y) z)")
  (lint-test "(if x y x)"		" if: perhaps (if x y x) -> (and x y)")
  (lint-test "(if (> x 1) (> x 1) (< x 2))" " if: perhaps (if (> x 1) (> x 1) (< x 2)) -> #t")
  (lint-test "(if x x x)"		" if: perhaps (if x x x) -> x  if: if is not needed here: (if x x x) -> x")
  (lint-test "(if x x)"			" if: perhaps (if x x) -> (or x #<unspecified>)")
  (lint-test "(if (> x 1) (> x 1))"	" if: perhaps (if (> x 1) (> x 1)) -> (or (> x 1) #<unspecified>)")
  (lint-test "(if (display x) (display x) y)" "")
  (lint-test "(if (= x 1) 2 (if (= x 3) 2 3))" 
	     "if: perhaps (if (= x 1) 2 (if (= x 3) 2 3)) -> (case x ((1) 2) ((3) 2) (else 3))
	      if: perhaps (if (= x 1) 2 (if (= x 3) 2 3)) -> (if (member x '(1 3) =) 2 3)")
  (lint-test "(if a b (if c d (if e f g)))" " if: perhaps use cond: (if a b (if c d (if e f g))) -> (cond (a b) (c d) (e f) (else g))")
  (lint-test "(if a b (if c d (if e f)))" " if: perhaps use cond: (if a b (if c d (if e f))) -> (cond (a b) (c d) (e f))")
  (lint-test "(if a (begin (b) c) (if d e (if f g (begin (h) i))))" 
	     " if: perhaps use cond: (if a (begin (b) c) (if d e (if f g (begin (h) i)))) -> (cond (a (b) c) (d e) (f g) (else (h) i))")
  (lint-test "(if (f x) (g (f x)))"     " if: perhaps (if (f x) (g (f x))) -> (cond ((f x) => g))")
  (lint-test "(if (f x) (g (f x)) z)"   " if: perhaps (if (f x) (g (f x)) z) -> (cond ((f x) => g) (else z))")
  (lint-test "(if x (set! y z) (set! w z))" "")
  (lint-test "(if x (set! y x) (set! y #f))" " if: perhaps (if x (set! y x) (set! y #f)) -> (set! y x)")
  (lint-test "(if x (set! y z) (set! y w))" " if: perhaps (if x (set! y z) (set! y w)) -> (set! y (if x z w))")
  (lint-test "(if x (set! y (+ 1 z)) (set! y (+ 1 w)))" " if: perhaps (if x (set! y (+ 1 z)) (set! y (+ 1 w))) -> (set! y (+ 1 (if x z w)))")
  (lint-test "(if (< x y) (set! x y))"    " if: perhaps (if (< x y) (set! x y)) -> (set! x (max x y))")
  (lint-test "(if (<= y x) (set! x y))"   " if: perhaps (if (<= y x) (set! x y)) -> (set! x (min x y))")
  (lint-test "(if (> x y) (set! x y))"    " if: perhaps (if (> x y) (set! x y)) -> (set! x (min x y))")
  (lint-test "(if (>= y x) (set! x y))"   " if: perhaps (if (>= y x) (set! x y)) -> (set! x (max x y))")
  (lint-test "(if (< x y) x y)"           " if: perhaps (if (< x y) x y) -> (min x y)")
  (lint-test "(if (< x y) y x)"           " if: perhaps (if (< x y) y x) -> (max y x)")
  (lint-test "(if (> x y) x y)"           " if: perhaps (if (> x y) x y) -> (max x y)")
  (lint-test "(if (> x y) y x)"           " if: perhaps (if (> x y) y x) -> (min y x)")
  (lint-test "(if (= x y) x y)"           " if: perhaps (if (= x y) x y) -> y")
  (lint-test "(if (= x y) y x)"           " if: perhaps (if (= x y) y x) -> x")
  (lint-test "(if (pair? x) #t #f)"       " if: perhaps (if (pair? x) #t #f) -> (pair? x)")
  (lint-test "(if (pair? x) #t z)"        " if: perhaps (if (pair? x) #t z) -> (or (pair? x) z)")
  (lint-test "(if x (not y) (not z))"     "")

  (lint-test "(if (> (vector-ref ind i) (vector-ref ind j)) (vector-set! ind i (vector-ref ind j)))" 
	     " if: perhaps (if (> (vector-ref ind i) (vector-ref ind j)) (vector-set! ind i... -> 
                 (vector-set! ind i (min (vector-ref ind i) (vector-ref ind j)))")
  (lint-test "(if (<= (list-ref ind i) (list-ref ind j)) (list-set! ind i (list-ref ind j)))" 
	     " if: perhaps (if (<= (list-ref ind i) (list-ref ind j)) (list-set! ind i (list-ref ind j))) ->
                 (list-set! ind i (max (list-ref ind i) (list-ref ind j)))")
  (lint-test "(if (<= (list-ref ind i) 32) (list-set! ind i 32))" 
	     " if: perhaps (if (<= (list-ref ind i) 32) (list-set! ind i 32)) -> (list-set! ind i (max (list-ref ind i) 32))")
  (lint-test "(if (<= 32 (list-ref ind i)) (list-set! ind i 32))" 
	     " if: perhaps (if (<= 32 (list-ref ind i)) (list-set! ind i 32)) -> (list-set! ind i (min 32 (list-ref ind i)))")
  (lint-test "(if (> 32 (list-ref ind i)) (list-set! ind i 32))" 
	     " if: perhaps (if (> 32 (list-ref ind i)) (list-set! ind i 32)) -> (list-set! ind i (max 32 (list-ref ind i)))")

  (lint-test "(if (eq? (car sv) 'list-values) 'list (car sv))" 
	     " if: perhaps use case: (if (eq? (car sv) 'list-values) 'list (car sv)) -> (case (car sv) ((list-values) 'list) (else))")
  (lint-test "(if (eq? (car sv) 'list-values) (car sv) 'list)" 
	     " if: perhaps use case: (if (eq? (car sv) 'list-values) (car sv) 'list) -> (case (car sv) ((list-values)) (else 'list))")
  (lint-test "(let ((q (car sv))) (if (eq? q 'list-values) 'list q))" 
	     " let: perhaps use case: (let ((q (car sv))) (if (eq? q 'list-values) 'list q)) -> (case (car sv) ((list-values) 'list) (else))")
  (lint-test "(let ((q (car sv))) (if (eq? q 'list-values) q 'list))"
	     " let: perhaps use case: (let ((q (car sv))) (if (eq? q 'list-values) q 'list)) -> (case (car sv) ((list-values)) (else 'list))")
  (lint-test "(if (eq? (caddr x) 'a) b (caddr x))" 
	     " if: perhaps use case: (if (eq? (caddr x) 'a) b (caddr x)) -> (case (caddr x) ((a) b) (else))")
  (lint-test "(let ((q (caddr x))) (if (eq? q 'a) b q))" 
	     " let: perhaps use case: (let ((q (caddr x))) (if (eq? q 'a) b q)) -> (case (caddr x) ((a) b) (else))")
  (lint-test "(let ((q (read-char sv))) (if (eof-object? q) 0 q))" 
	     " let: perhaps use case: (let ((q (read-char sv))) (if (eof-object? q) 0 q)) -> (case (read-char sv) ((#<eof>) 0) (else))")
  (lint-test "(let ((q (f x))) (if (null? q) 0 q))" 
	     " let: perhaps use case: (let ((q (f x))) (if (null? q) 0 q)) -> (case (f x) ((()) 0) (else))")
  (lint-test "(let* ((p 32) (q (* p (car sv)))) (if (= q 0) q p))" 
	     " let*: perhaps use case: (let* ((p 32) (q (* p (car sv)))) (if (= q 0) q p)) -> (let ((p 32)) (case (* p (car sv)) ((0)) (else p)))")
  (lint-test "(let ((q (read-char sv))) (if (eof-object? q) 0 (f q)))" 
	     " let: perhaps use case: (let ((q (read-char sv))) (if (eof-object? q) 0 (f q))) -> (case (read-char sv) ((#<eof>) 0) (else => f))")
  (lint-test "(let ((q (read-char sv))) (if (eof-object? q) (f q) 0))" 
	     " let: perhaps use case: (let ((q (read-char sv))) (if (eof-object? q) (f q) 0)) -> (case (read-char sv) ((#<eof>) => f) (else 0))")
  (lint-test "(if (null? (f x)) 0 (f x))" " if: perhaps use case: (if (null? (f x)) 0 (f x)) -> (case (f x) ((()) 0) (else))")
  (lint-test "(if (null? (caddr x)) 0 (caddr x))" " if: perhaps use case: (if (null? (caddr x)) 0 (caddr x)) -> (case (caddr x) ((()) 0) (else))")
  (lint-test "(if (null? (caddr x)) () (caddr x))" " if: perhaps use case: (if (null? (caddr x)) () (caddr x)) -> (case (caddr x) ((()) ()) (else))")
  (lint-test "(if (eq? (car sv) 'a) 'list (f (car sv)))" 
	     " if: perhaps use case: (if (eq? (car sv) 'a) 'list (f (car sv))) -> (case (car sv) ((a) 'list) (else => f))")
  (lint-test "(if (eq? (car sv) 'a) (f (car sv)) 'list)" 
	     " if: perhaps use case: (if (eq? (car sv) 'a) (f (car sv)) 'list) -> (case (car sv) ((a) => f) (else 'list))")
  (lint-test "(let ((q (car sv))) (cond ((eq? q 'list-values) 'list) (else q)))" 
	     " let: perhaps use case: (let ((q (car sv))) (cond ((eq? q 'list-values) 'list) (else q))) -> (case (car sv) ((list-values) 'list) (else))")

  (lint-test "(if A (f x) (or (f x) (g y)))" " if: perhaps (if A (f x) (or (f x) (g y))) -> (or (f x) (and (not A) (g y)))")
  (lint-test "(if A (or (f x) (g y)) (f x))" " if: perhaps (if A (or (f x) (g y)) (f x)) -> (or (f x) (and A (g y)))")
  (lint-test "(if A (f x) (or (f x) (g y) (h z)))" " if: perhaps (if A (f x) (or (f x) (g y) (h z))) -> (or (f x) (and (not A) (or (g y) (h z))))")
  (lint-test "(if A (or (f x) (g y) (h z)) (f x))" " if: perhaps (if A (or (f x) (g y) (h z)) (f x)) -> (or (f x) (and A (or (g y) (h z))))")
  (lint-test "(if A (or (f x) (h z)) (or (f x) (g y)))" " if: perhaps (if A (or (f x) (h z)) (or (f x) (g y))) -> (or (f x) (if A (h z) (g y)))")
  (lint-test "(if A (and (f x) (h z)) (and (f x) (g y)))" " if: perhaps (if A (and (f x) (h z)) (and (f x) (g y))) -> (and (f x) (if A (h z) (g y)))")
  (lint-test "(if A (f x) (begin (f x) (g y)))" " if: perhaps (if A (f x) (begin (f x) (g y))) -> (begin (f x) (when (not A) (g y)))")
  (lint-test "(if A (begin (f x) (g y)) (f x))" " if: perhaps (if A (begin (f x) (g y)) (f x)) -> (begin (f x) (when A (g y)))")
  (lint-test "(if A (f x) (begin (f x) (g y) (h z)))" " if: perhaps (if A (f x) (begin (f x) (g y) (h z))) -> (begin (f x) (when (not A) (g y) (h z)))")
  (lint-test "(if A (begin (f x) (g y) (h z)) (f x))" " if: perhaps (if A (begin (f x) (g y) (h z)) (f x)) -> (begin (f x) (when A (g y) (h z)))")

  (lint-test "(if x (set! a (* 2 b)) (set! a (* 3 b)))" " if: perhaps (if x (set! a (* 2 b)) (set! a (* 3 b))) -> (set! a (* (if x 2 3) b))")
  (lint-test "(if x y (cond ((= y z) 2) (else 3)))" 
	     " if: perhaps (if x y (cond ((= y z) 2) (else 3))) -> (cond (x y) ((= y z) 2) (else 3))")
  (lint-test "(if x y (cond ((= y z) 2) ((= y 2) 3)))" 
	     " if: perhaps (if x y (cond ((= y z) 2) ((= y 2) 3))) -> (cond (x y) ((= y z) 2) ((= y 2) 3))")
  (lint-test "(if (eof-object? x) 32 (case x ((#\\a) 3) (else 4)))" 
	     " if: perhaps (if (eof-object? x) 32 (case x ((#\\a) 3) (else 4))) -> (case x ((#<eof>) 32) ((#\\a) 3) (else 4))
               if: perhaps (case x ((#\\a) 3) (else 4)) -> (if (eqv? x #\\a) 3 4)")
  (lint-test "(if (< x 0) (if (< y 0) (if (< z 0) (+ a b c d e f g h i j k l m n o p q r s) z) y) x)" 
	     " if: perhaps (if (< x 0) (if (< y 0) (if (< z 0) (+ a b c d e f g h i j k l m n o p q r... ->
                 (cond ((>= x 0) x) ((>= y 0) y) ((>= z 0) z) (else (+ a b c d e f g h i j k l m n o p q r s)))
               if: surely there's a better name for this variable than l")
  (lint-test "(if (< x 0) (if (< y 0) y (if (< z 0) z (+ a b c d e f g h i j k l m n o p q r s))) x)" 
	     " if: perhaps (if (< x 0) (if (< y 0) y (if (< z 0) z (+ a b c d e f g h i j k l m n o p... ->
                 (cond ((>= x 0) x) ((< y 0) y) ((< z 0) z) (else (+ a b c d e f g h i j k l m n o p q r s)))
               if: surely there's a better name for this variable than l")
  (lint-test "(if (< x 0) x (if (< y 0) (if (< z 0) (+ a b c d e f g h i j k l m n o p q r s) z) y))" 
	     " if: perhaps (if (< x 0) x (if (< y 0) (if (< z 0) (+ a b c d e f g h i j k l m n o p q... ->
                 (cond ((< x 0) x) ((>= y 0) y) ((>= z 0) z) (else (+ a b c d e f g h i j k l m n o p q r s)))
               if: surely there's a better name for this variable than l")
  (lint-test "(if (< x 1) (let ((y (+ x 1)) (z (- x 1))) (+ y z)) (let ((y (+ x 1)) (z (+ x 2))) (- y z)))" 
	     " if: perhaps (if (< x 1) (let ((y (+ x 1)) (z (- x 1))) (+ y z)) (let ((y (+ x 1)) (z... ->
                 (let ((y (+ x 1))) (if (< x 1) (let ((z (- x 1))) (+ y z)) (let ((z (+ x 2))) (- y z))))
               if: perhaps (let ((y (+ x 1)) (z (- x 1))) (+ y z)) -> (+ (+ x 1) (- x 1))
               if: perhaps (let ((y (+ x 1)) (z (+ x 2))) (- y z)) -> (- (+ x 1) (+ x 2))")
  (lint-test "(if (< x 1) (let ((y (+ x 1)) (z (- x 1))) (+ y z)) (let ((y (+ x 1)) (z (- x 1))) (- y z)))" 
	     " if: perhaps (if (< x 1) (let ((y (+ x 1)) (z (- x 1))) (+ y z)) (let ((y (+ x 1)) (z... ->
                 (let ((_1_ (< x 1))) (let ((y (+ x 1)) (z (- x 1))) ((if _1_ + -) y z)))
               if: perhaps (let ((y (+ x 1)) (z (- x 1))) (+ y z)) -> (+ (+ x 1) (- x 1))
               if: perhaps (let ((y (+ x 1)) (z (- x 1))) (- y z)) -> (- (+ x 1) (- x 1))")
  (lint-test "(if (> (+ a b) 3) (let ((a x) (c y)) (* a (log c))) (let ((b z) (c y)) (+ b (log c))))" 
	     "if: perhaps (if (> (+ a b) 3) (let ((a x) (c y)) (* a (log c))) (let ((b z) (c y)) (+... ->
    (let ((c y))
      (if (> (+ a b) 3)
          (let ((a x))
            (* a (log c)))
          (let ((b z))
            (+ b (log c)))))
            if: perhaps (let ((a x) (c y)) (* a (log c))) -> (* x (log y))
            if: assuming we see all set!s, the bindings (c y), (a x) are pointless: perhaps (let ((a x) (c y)) (* a (log c))) -> (* x (log y))
            if: perhaps (let ((b z) (c y)) (+ b (log c))) -> (+ z (log y))
            if: assuming we see all set!s, the bindings (c y), (b z) are pointless: perhaps (let ((b z) (c y)) (+ b (log c))) -> (+ z (log y))")

  (lint-test "(if (> (+ a b) 3) (let ((a (+ x 1)) (c y)) (* a (log c))) (let ((a (+ x 1)) (c y)) (+ a (log c))))" 
	     " if: perhaps (if (> (+ a b) 3) (let ((a (+ x 1)) (c y)) (* a (log c))) (let ((a (+ x... ->
                (let ((_1_ (> (+ a b) 3))) (let ((a (+ x 1)) (c y)) ((if _1_ * +) a (log c))))
               if: perhaps (let ((a (+ x 1)) (c y)) (* a (log c))) -> (* (+ x 1) (log y))
               if: assuming we see all set!s, the binding (c y) is pointless: perhaps (let ((a (+ x 1)) (c y)) (* a (log c))) -> (let ((a (+ x 1))) (* a (log y)))
               if: perhaps (let ((a (+ x 1)) (c y)) (+ a (log c))) -> (+ (+ x 1) (log y))
               if: assuming we see all set!s, the binding (c y) is pointless: perhaps (let ((a (+ x 1)) (c y)) (+ a (log c))) -> (let ((a (+ x 1))) (+ a (log y)))")
  (lint-test "(let ((a (f x)) (b (g y)) (c (g z))) (h a b c))" 
	     " let: perhaps (let ((a (f x)) (b (g y)) (c (g z))) (h a b c)) -> (h (f x) (g y) (g z))")

  (lint-test "(if a (if b d e) (if c d e))"     " if: perhaps (if a (if b d e) (if c d e)) -> (if (if a b c) d e)")
  (lint-test "(if a (if b d) (if c d))"         " if: perhaps (if a (if b d) (if c d)) -> (if (if a b c) d)")
  (lint-test "(if a (if (f b) d) (if (f c) d))" " if: perhaps (if a (if (f b) d) (if (f c) d)) -> (if (if a (f b) (f c)) d)")
  (lint-test "(if a (if b c d) d)"              " if: perhaps (if a (if b c d) d) -> (if (and a b) c d)")

  (lint-test "(if x y (if (not x) z w))"        " if: perhaps (if x y (if (not x) z w)) -> (if x y z)")
  (lint-test "(if x y (if (not x) z))"          " if: perhaps (if x y (if (not x) z)) -> (if x y z)")
  (lint-test "(if x y (if x z))"                " if: perhaps (if x y (if x z)) -> (if x y)")
  (lint-test "(if x y (if x z w))"              " if: perhaps (if x y (if x z w)) -> (if x y w)")
  (lint-test "(if x (if x z w) y)"              " if: perhaps (if x (if x z w) y) -> (if x z y)")
  (lint-test "(if x (if x z w))"                " if: perhaps (if x (if x z w)) -> (if x z w)")
  (lint-test "(if x (if x z) w)"                " if: perhaps (if x (if x z) w) -> (if x z w)")
  (lint-test "(if x (if x y))"                  " if: perhaps (if x (if x y)) -> (if x y)")
  (lint-test "(if x (if (not x) z w) y)"        " if: perhaps (if x (if (not x) z w) y) -> (if x w y)")
  (lint-test "(if x (if (not x) z w))"          " if: perhaps (if x (if (not x) z w)) -> w")
  (lint-test "(if x (if (not x) z) w)"          " if: perhaps (if x (if (not x) z) w) -> (if (not x) w)")
  
  (lint-test "(if A (and B C) (and B D))"       " if: perhaps (if A (and B C) (and B D)) -> (and B (if A C D))")
  (lint-test "(if A (and B C E) (and B D E))"   " if: perhaps (if A (and B C E) (and B D E)) -> (and B (if A C D) E)")
  (lint-test "(if A (list B C) (list B D))"     " if: perhaps (if A (list B C) (list B D)) -> (list B (if A C D))")
  (lint-test "(if A (+ B C) (+ B D))"           " if: perhaps (if A (+ B C) (+ B D)) -> (+ B (if A C D))")
  (lint-test "(if A (< B C) (< B D))"           " if: perhaps (if A (< B C) (< B D)) -> (< B (if A C D))")
  
  (lint-test "(if A (list B C E) (list B D))"   "") ; used to suggest values here
  (lint-test "(if A (+ B C E) (+ B D))"         " if: perhaps (if A (+ B C E) (+ B D)) -> (+ B (if A (+ C E) D))")
  (lint-test "(if A (< B C E) (< B D))"         "")
  (lint-test "(if A (and B C E) (and B D))"     " if: perhaps (if A (and B C E) (and B D)) -> (and B (if A (and C E) D))")
  (lint-test "(if A (and B C E) (and B D F))"   " if: perhaps (if A (and B C E) (and B D F)) -> (and B (if A (and C E) (and D F)))")
  (lint-test "(if A (or B C E) (or B D))"       " if: perhaps (if A (or B C E) (or B D)) -> (or B (if A (or C E) D))")
  (lint-test "(if A (or B C E) (or B D F))"     " if: perhaps (if A (or B C E) (or B D F)) -> (or B (if A (or C E) (or D F)))")
  (lint-test "(if A (or B C E) (or B C D F))"   " if: perhaps (if A (or B C E) (or B C D F)) -> (or B C (if A E (or D F)))")
  (lint-test "(if A (or B C) (or B C D F))"     "")
  (lint-test  "(if A (+ B E C) (+ D E C))"      " if: perhaps (if A (+ B E C) (+ D E C)) -> (+ (if A B D) E C)")
  (lint-test  "(if A (+ B B E C) (+ D D E C))"  " if: perhaps (if A (+ B B E C) (+ D D E C)) -> (+ (if A (+ B B) (+ D D)) E C)")
  (lint-test "(if A (if B C D) (if (not B) C D))" " if: perhaps (if A (if B C D) (if (not B) C D)) -> (if (eq? (not A) (not B)) C D)")
  (lint-test "(if A (if (not B) C D) (if B C D))" " if: perhaps (if A (if (not B) C D) (if B C D)) -> (if (not (eq? (not A) (not B))) C D)")
  (lint-test "(if A (if B C D) (if E C D))"      " if: perhaps (if A (if B C D) (if E C D)) -> (if (if A B E) C D)")
  (lint-test "(+ (if A B C) (if A C D) y)"       " +: perhaps (+ (if A B C) (if A C D) y) -> (+ (if A (values B C) (values C D)) y)")
  (lint-test "(if A (cond (C D) (else F)) B)"    " if: perhaps (if A (cond (C D) (else F)) B) -> (cond ((not A) B) (C D) (else F))")
  (lint-test "(if A (cond (C D) (else F)))"      " if: perhaps (if A (cond (C D) (else F))) -> (cond ((not A) #<unspecified>) (C D) (else F))")

  (lint-test "(if (code-constant? setv) (list 'fill! (cadr body) (cadddr body) start end) (list 'copy (cadr setv) (cadr body) start end))" "")
  (lint-test "(if (code-constant? setv) (list 'fill! (cadr body) (cadddr body) start end start end) (list 'copy (cadr setv) (cadr body) start end start end))"
	     " if: perhaps (if (code-constant? setv) (list 'fill! (cadr body) (cadddr body) start end... ->
                 (list (if (code-constant? setv) (values 'fill! (cadr body) (cadddr body)) (values 'copy (cadr setv) (cadr body))) start end start end)")
  (lint-test "(if (code-constant? setv) (list 'fill! start end (cadr body) (cadddr body) start end) (list 'fill! start end (cadr setv) (cadr body) start end))" "")
  (lint-test "(if (code-constant? setv) (list 'fill! start end start (cadr body) (cadddr body)) (list 'fill! start end start (cadr setv) (cadr body)))" 
	     " if: perhaps (if (code-constant? setv) (list 'fill! start end start (cadr body) (cadddr... ->
                 (list 'fill! start end start (if (code-constant? setv) (values (cadr body) (cadddr body)) (values (cadr setv) (cadr body))))")

  (lint-test "(if x (begin (f y)) (begin (g y)))" 
	     " if: perhaps (if x (begin (f y)) (begin (g y))) -> (begin ((if x f g) y))
               if: begin could be omitted: (begin (f y))
               if: begin could be omitted: (begin (g y))")
  (lint-test "(if x (f 2 y) (f 4 y))" " if: perhaps (if x (f 2 y) (f 4 y)) -> (f (if x 2 4) y)")
  (lint-test "(if x (f 2 y) (f 4 z))" "")
  (lint-test "(if x (let ((z (log y))) (f 2 y z)) (let ((z (log y))) (f 4 y z)))" 
	     " if: perhaps (if x (let ((z (log y))) (f 2 y z)) (let ((z (log y))) (f 4 y z))) -> (let ((_1_ x)) (let ((z (log y))) (f (if _1_ 2 4) y z)))
               if: perhaps (let ((z (log y))) (f 2 y z)) -> (f 2 y (log y))
               if: perhaps (let ((z (log y))) (f 4 y z)) -> (f 4 y (log y))")
  (lint-test "(if restarting? (eq? 'ronly opt) (eq? 'sonly opt))" 
	     " if: perhaps (if restarting? (eq? 'ronly opt) (eq? 'sonly opt)) -> (eq? (if restarting? 'ronly 'sonly) opt)")

  (lint-test "(if x (let* ((y (f x)) (z (g x))) (display y) (list y z)) (let* ((y (f x)) (z (g x))) (display z) (list y z)))" 
	     " if: perhaps (if x (let* ((y (f x)) (z (g x))) (display y) (list y z)) (let* ((y (f x))... ->
                 (let ((_1_ x)) (let* ((y (f x)) (z (g x))) (display (if _1_ y z)) (list y z)))")
  (lint-test "(if x (let ((y (f x))) (display y) (list z)) (let ((y (g x))) (display y) (list z)))" 
	     " if: perhaps (if x (let ((y (f x))) (display y) (list z)) (let ((y (g x))) (display y)... -> (let ((y ((if x f g) x))) (display y) (list z))
               if: perhaps (let ((y (f x))) (display y) (list z)) -> (let () (display (f x)) (list z))
               if: perhaps (let ((y (g x))) (display y) (list z)) -> (let () (display (g x)) (list z))")
  (lint-test "(if x (let ((y (f x))) (display y) z) (let ((y (g x))) (f y) z))" 
	     " if: perhaps (let ((y (f x))) (display y) z) -> (let () (display (f x)) z)
               if: perhaps, assuming f is not a macro, (let ((y (g x))) (f y) z) -> (let () (f (g x)) z)")
  (lint-test "(if x (let ((y (abs x))) (display z) y) (let ((y (log x))) (display z) y))" 
	     " if: perhaps (if x (let ((y (abs x))) (display z) y) (let ((y (log x))) (display z) y)) ->
                 (let ((y ((if x abs log) x))) (display z) y)")
  (lint-test "(if x (let loop1 ((x y)) (if (null? x) 1 (loop1 (cdr x)))) (let loop2 ((x z)) (if (null? x) 1 (loop2 (cdr x)))))" 
	     " loop1: perhaps (let loop1 ((x y)) (if (null? x) 1 (loop1 (cdr x)))) -> (do ((x y (cdr x))) ((null? x) 1))
               loop2: perhaps (let loop2 ((x z)) (if (null? x) 1 (loop2 (cdr x)))) -> (do ((x z (cdr x))) ((null? x) 1))")
  (lint-test "(let loop ((x y)) (case x ((1) (display b)) (else (display c) (loop (+ x 1)))))" 
	     " loop: perhaps (let loop ((x y)) (case x ((1) (display b)) (else (display c) (loop (+ x 1))))) ->
                 (do ((x y (+ x 1))) ((memv x '(1)) (display b)) (display c))")
  (lint-test "(let loop ((x y)) (when (zero? x) (loop (- x 1))))" 
	     " loop: perhaps (let loop ((x y)) (when (zero? x) (loop (- x 1)))) -> (do ((x y (- x 1))) ((not (zero? x))))")
  (lint-test "(let loop ((x y)) (unless (zero? x) (loop (- x 1))))" 
	     " loop: perhaps (let loop ((x y)) (unless (zero? x) (loop (- x 1)))) -> (do ((x y (- x 1))) ((zero? x)))")
  (lint-test "(let loop ((x y)) (when (zero? x) (display b) (loop (- x 1)) x))" "")
  (lint-test "(let loop ((x y)) (when (zero? x) (display b) (loop (- x 1))))" 
	     " loop: perhaps (let loop ((x y)) (when (zero? x) (display b) (loop (- x 1)))) -> (do ((x y (- x 1))) ((not (zero? x))) (display b))")

  (lint-test "(if polar
                (let ((vals (parse-polar-coordinates points 3d)))
                  (set! (bezier-x xpath) (car vals))
                  (set! (bezier-y xpath) (cadr vals))
                  (set! (bezier-z xpath) (caddr vals))
                  (set! (bezier-v xpath) (cadddr vals)))
                (let ((vals (parse-cartesian-coordinates points 3d)))
                  (set! (bezier-x xpath) (car vals))
                  (set! (bezier-y xpath) (cadr vals))
                  (set! (bezier-z xpath) (caddr vals))
                  (set! (bezier-v xpath) (cadddr vals))))" 
	     " if: perhaps (if polar (let ((vals (parse-polar-coordinates points 3d))) (set!... ->
                (let ((vals ((if polar parse-polar-coordinates parse-cartesian-coordinates) points 3d)))
                  (set! (bezier-x xpath) (car vals))
                  (set! (bezier-y xpath) (cadr vals))
                  (set! (bezier-z xpath) (caddr vals))
                  (set! (bezier-v xpath) (cadddr vals)))")
  (lint-test "(if (< x 1) (let ((a 32) (b 31)) (f a b)) (let ((a 31) (b 32)) (f a b)))" 
	     " if: perhaps (let ((a 32) (b 31)) (f a b)) -> (f 32 31)
               if: perhaps (let ((a 31) (b 32)) (f a b)) -> (f 31 32)")
  (lint-test "(if (< x 1) (let ((a 32) (b 31) (c 12)) (f a b c)) (let ((a 32) (b 31) (c 11)) (f a b c)))" 
	     " if: perhaps (if (< x 1) (let ((a 32) (b 31) (c 12)) (f a b c)) (let ((a 32) (b 31) (c... ->
                 (let ((a 32) (b 31) (c (if (< x 1) 12 11))) (f a b c))
               if: perhaps (let ((a 32) (b 31) (c 12)) (f a b c)) -> (f 32 31 12)
               if: perhaps (let ((a 32) (b 31) (c 11)) (f a b c)) -> (f 32 31 11)")
  (lint-test "(if x (for-each (lambda (x) (display (+ x a))) (f y)) (for-each (lambda (x) (display (+ x a))) (g y)))" 
	     " if: perhaps (if x (for-each (lambda (x) (display (+ x a))) (f y)) (for-each (lambda... ->
                 (for-each (lambda (x) (display (+ x a))) ((if x f g) y))")
  (lint-test "(cond (x (for-each (lambda (x) (display (+ x a))) (f y))) (else (for-each (lambda (x) (display (+ x a))) (g y))))"
	     " cond: perhaps (cond (x (for-each (lambda (x) (display (+ x a))) (f y))) (else (for-each... ->
                 (for-each (lambda (x) (display (+ x a))) (if x (f y) (g y)))")
  (lint-test "(if x (for-each (lambda (x) (display (+ x a))) (f y)) (for-each (lambda (x) (display (+ x b))) (f y)))" 
	     " if: perhaps (if x (for-each (lambda (x) (display (+ x a))) (f y)) (for-each (lambda... ->
                 (for-each (lambda (x) (display (+ x (if x a b)))) (f y))")
  (lint-test "(let loop ((lst x) (res ())) (if (null? lst) (reverse res) (loop (cdr lst) (cons (car lst) res))))" 
	     " loop: perhaps (let loop ((lst x) (res ())) (if (null? lst) (reverse res) (loop (cdr lst)... -> (copy x)")
  (lint-test "(let loop ((lst x) (res ())) (if (not (pair? lst)) (reverse res) (loop (cdr lst) (cons (caar lst) res))))" 
	     " loop: perhaps (let loop ((lst x) (res ())) (if (not (pair? lst)) (reverse res) (loop... -> (map car x)")
  (lint-test "(let loop ((lst x) (res ())) (if (not (pair? lst)) (reverse res) (loop (cdr lst) (append (z w (car lst) v) res))))" 
	     " loop: perhaps (let loop ((lst x) (res ())) (if (not (pair? lst)) (reverse res) (loop... -> (map (lambda (_1_) (apply values (z w _1_ v))) x)")
  (lint-test "(let loop ((lst x) (res ())) (if (not (pair? lst)) (reverse res) (loop (cons (caar lst) res) (cdr lst))))" "") ; reversed loop args so nothing to rewrite
  (lint-test "(let loop ((res ()) (lst x)) (if (pair? lst) (loop (let ((a (g (car lst)))) (cons a res)) (cdr lst)) (reverse! res)))" 
	     " loop: perhaps (let loop ((res ()) (lst x)) (if (pair? lst) (loop (let ((a (g (car... -> (map (lambda (_1_) (let ((a (g _1_))) a)) x)
               let: perhaps (let ((a (g (car lst)))) (cons a res)) -> (cons (g (car lst)) res)")
  (lint-test "(let loop ((res ()) (lst x)) (if (pair? lst) (loop (let ((a (g (cadar lst)))) (if (g a) (cons a res) res)) (cdr lst)) (reverse! res)))" 
	     " loop: perhaps (let loop ((res ()) (lst x)) (if (pair? lst) (loop (let ((a (g (cadar... ->
                 (map (lambda (_1_) (let ((a (g (cadr _1_)))) (if (g a) a (values)))) x)")
  (lint-test "(let loop ((lst x) (res ())) (if (null? lst) (reverse res) (loop (cdr lst) (if (g z) res (cons (car lst) res)))))"
	     " loop: perhaps (let loop ((lst x) (res ())) (if (null? lst) (reverse res) (loop (cdr lst)... -> (map (lambda (_1_) (if (g z) (values) _1_)) x)")
  (lint-test "(let loop ((lst x) (res ())) (cond ((null? lst) (reverse res)) (else (loop (cdr lst) (cons (car lst) res)))))" 
	     " loop: perhaps (let loop ((lst x) (res ())) (cond ((null? lst) (reverse res)) (else (loop... -> (copy x)")
  (lint-test "(let loop ((x y)) (if (null? x) () (let ((p (car x))) (cons p (loop (cdr x))))))" 
	     " loop: perhaps (let loop ((x y)) (if (null? x) () (let ((p (car x))) (cons p (loop (cdr... -> (copy y)")

  (lint-test "(if (char=? (str i) #\\]) (set! (str i) #\\)) (if (char=? (str i) #\\[) (set! (str i) #\\()))" 
	     " if: perhaps (if (char=? (str i) #\\]) (set! (str i) #\\)) (if (char=? (str i) #\\[) (set!... ->
                (case (str i) ((#\\]) (set! (str i) #\\))) ((#\\[) (set! (str i) #\\()))")
  (lint-test "(if (char=? (str i) #\\]) (set! (str i) #\\)) (if (char=? (str i) #\\[) (set! (str i) #\\() (set! x y)))" 
	     " if: perhaps (if (char=? (str i) #\\]) (set! (str i) #\\)) (if (char=? (str i) #\\[) (set!... ->
                (case (str i) ((#\\]) (set! (str i) #\\))) ((#\\[) (set! (str i) #\\()) (else (set! x y)))")
  (lint-test "(if (char=? (str i) #\\]) (set! (str i) #\\)) (if (char=? (str i) #\\[) (set! (str i) #\\() (if (char=? (str i) #\\a) (set! x y))))"
	     " if: perhaps use cond: (if (char=? (str i) #\\]) (set! (str i) #\\)) (if (char=? (str i) #\\[) (set!... ->
                 (cond ((char=? (str i) #\\]) (set! (str i) #\\))) ((char=? (str i) #\\[) (set! (str i) #\\()) ((char=? (str i) #\\a) (set! x y)))
               if: perhaps (if (char=? (str i) #\\]) (set! (str i) #\\)) (if (char=? (str i) #\\[) (set!... ->
                 (case (str i) ((#\\]) (set! (str i) #\\))) ((#\\[) (set! (str i) #\\()) ((#\\a) (set! x y)))")
  (lint-test "(if (= x 1) 2 (if (= x 3) 3 4))" " if: perhaps (if (= x 1) 2 (if (= x 3) 3 4)) -> (case x ((1) 2) ((3) 3) (else 4))")
  (lint-test "(if (null? (f x)) 0 (if (eof-object? (f x)) 1 (f x)))" 
	     " if: perhaps (if (null? (f x)) 0 (if (eof-object? (f x)) 1 (f x))) -> (case (f x) ((()) 0) ((#<eof>) 1) (else))
               if: perhaps use case: (if (eof-object? (f x)) 1 (f x)) -> (case (f x) ((#<eof>) 1) (else))")
  (lint-test "(if (null? (f x)) 0 (if (eof-object? (f x)) (g (f x)) (f x)))" 
	     " if: perhaps (if (null? (f x)) 0 (if (eof-object? (f x)) (g (f x)) (f x))) -> (case (f x) ((()) 0) ((#<eof>) => g) (else))
               if: perhaps use case: (if (eof-object? (f x)) (g (f x)) (f x)) -> (case (f x) ((#<eof>) (g (f x))) (else))")

  (lint-test "(if z (f y) (f x))"                 " if: perhaps (if z (f y) (f x)) -> (f (if z y x))")
  (lint-test "(if z (f y) (g y))"                 " if: perhaps (if z (f y) (g y)) -> ((if z f g) y)")
  (lint-test "(if z (f (g y)) (f (h y)))"         " if: perhaps (if z (f (g y)) (f (h y))) -> (f ((if z g h) y))")
  (lint-test "(if z (f (g x)) (f (h x)))"         " if: perhaps (if z (f (g x)) (f (h x))) -> (f ((if z g h) x))")
  (lint-test "(if z (f (h x)) (g (h x)))"         " if: perhaps (if z (f (h x)) (g (h x))) -> ((if z f g) (h x))")
  (lint-test "(if z (f (g (h x))) (f (g (h y))))" " if: perhaps (if z (f (g (h x))) (f (g (h y)))) -> (f (g (h (if z x y))))")
  (lint-test "(if z (f (g (h x))) (f (g (j x))))" " if: perhaps (if z (f (g (h x))) (f (g (j x)))) -> (f (g ((if z h j) x)))")
  (lint-test "(if z (f (g (h x))) (f (j (h x))))" " if: perhaps (if z (f (g (h x))) (f (j (h x)))) -> (f ((if z g j) (h x)))")
  (lint-test "(if z (f (g (h x))) (h (g (h x))))" " if: perhaps (if z (f (g (h x))) (h (g (h x)))) -> ((if z f h) (g (h x)))")

  (lint-test "(begin (if A (f B) (g C)) (if (and A D) (g Z)) X)" 
	     " begin: perhaps (... (if A (f B) (g C)) (if (and A D) (g Z)) ...) -> (... (if A (begin (f B) (when D (g Z))) (g C)) ...)")
  (lint-test "(begin (if A (f B)) (if (and A C) (g D) (h E)) X)" "")
  (lint-test "(begin (if A (f B)) (if (and A C) (g D) (h E)))" "")
  (lint-test "(begin (if A (f B) (z G)) (if (and A C) (g D) (h E)))" "")
  (lint-test "(begin (if A (f B)) (when (and A C) (g D) (h E)) X)" 
	     " begin: perhaps (... (if A (f B)) (when (and A C) (g D) (h E)) ...) -> (... (when A (f B) (when C (g D) (h E))) ...)")
  (lint-test "(begin (when A (f B)) (when (and A C) (g D) (h E)) X)"
	     " begin: perhaps (... (when A (f B)) (when (and A C) (g D) (h E)) ...) -> (... (when A (f B) (when C (g D) (h E))) ...)")
  (lint-test "(begin (when A (f B)) (when (and A C) (g D) (h E)))" 
	     " begin: perhaps (... (when A (f B)) (when (and A C) (g D) (h E)) ...) -> (... (when A (f B) (when C (g D) (h E))))")
  (lint-test "(begin (if (and A B) (f C)) (if A (g E)))" 
	     " begin: perhaps (... (if (and A B) (f C)) (if A (g E)) ...) -> (... (when A (when B (f C)) (g E)))")
  (lint-test "(begin (if (and A B) (f C)) (if A (g E) (h F)) X)" 
	     " begin: perhaps (... (if (and A B) (f C)) (if A (g E) (h F)) ...) -> (... (if A (begin (when B (f C)) (g E)) (h F)) ...)")

  (lint-test "(begin (if (and A B) (f C)) (if (and B A) (g E) (h F)) X)" 
	     " begin: perhaps 
                 (... (if (and A B) (f C)) (if (and B A) (g E) (h F)) ...) -> 
                 (... (if (and A B) (begin (f C) (g E)) (begin (h F))) ...)")
  (lint-test "(begin (if (and A B) (f C)) (if (and C B A) (g E) (h F)) X)" "")
  (lint-test "(begin (if (and A B C) (f C)) (if (and B A) (g E) (h F)) X)" 
	     " begin: perhaps 
                 (... (if (and A B C) (f C)) (if (and B A) (g E) (h F)) ...) ->
                 (... (if (and A B) (begin (when C (f C)) (g E)) (h F)) ...)")
  (lint-test "(begin (if (and A B) (f C)) (if (and B C) (g E) (h F)) X)" "")
  (lint-test "(begin (if (and A B) (f C)) (when (and B C) (g E)))" 
	     " begin: perhaps 
                 (... (if (and A B) (f C)) (when (and B C) (g E)) ...) ->
                 (... (when B (when A (f C)) (when C (g E))))")
  (lint-test "(begin (if (and A B C) (f C)) (when (and B C D) (g E)))" 
	     " begin: perhaps 
                 (... (if (and A B C) (f C)) (when (and B C D) (g E)) ...) ->
                 (... (when (and B C) (when A (f C)) (when D (g E))))")

  (lint-test "(if x (display y) (begin (set! z y) (display y)))" 
	     " if: perhaps (if x (display y) (begin (set! z y) (display y))) -> (begin (if (not x) (set! z y)) (display y))")
  (lint-test "(if x (begin (set! z y) (display y)) (display y))" 
	     " if: perhaps (if x (begin (set! z y) (display y)) (display y)) -> (begin (if x (set! z y)) (display y))")
  (lint-test "(if x (begin (display y) (set! y z)) (begin (display y) (set! z y)))"
	     " if: perhaps (if x (begin (display y) (set! y z)) (begin (display y) (set! z y))) -> 
                 (begin (display y) (if x (set! y z) (set! z y)))")
  (lint-test "(if x (begin (display y) (set! y z) (display x)) (begin (display y) (set! z y) (display x)))"
	     " if: perhaps (if x (begin (display y) (set! y z) (display x)) (begin (display y) (set!... -> 
                 (begin (display y) (if x (set! y z) (set! z y)) (display x))")

  (lint-test "(if A (let () (display x)))" 
	     " if: perhaps (if A (let () (display x))) -> (when A (display x))
               if: pointless let: (let () (display x))")
  (lint-test "(if A B (let () (display x)))" 
	     " if: perhaps (if A B (let () (display x))) -> (if A B (begin (display x)))
               if: pointless let: (let () (display x))")
  (lint-test "(if A (let () (set! x z) (display x)) (let () (write y)))" 
	     " if: perhaps (if A (let () (set! x z) (display x)) (let () (write y))) -> (if A (begin (set! x z) (display x)) (begin (write y)))
               if: let could be begin: (let () (set! x z) (display x)) -> (begin (set! x z) (display x))
               if: pointless let: (let () (write y))")
  (lint-test "(if A (if B (+ x 1)) (if B (- x 1)))" 
	     " if: perhaps (if A (if B (+ x 1)) (if B (- x 1))) -> (if B (if A (+ x 1) (- x 1)))")
  (lint-test "(if A (begin (f x) (g y)) (begin (f x) (g z)))"  
	     " if: perhaps (if A (begin (f x) (g y)) (begin (f x) (g z))) -> (begin (f x) (g (if A y z)))")
  (lint-test "(if A (begin (f x) (g y)) (begin (f y) (g y)))" 
	     " if: perhaps (if A (begin (f x) (g y)) (begin (f y) (g y))) -> (begin (f (if A x y)) (g y))")
  (lint-test "(if A (begin (f x) (g y) (h z)) (begin (f x) (g x) (h z)))" 
	     " if: perhaps (if A (begin (f x) (g y) (h z)) (begin (f x) (g x) (h z))) -> (begin (f x) (g (if A y x)) (h z))")
  (lint-test "(if (not x) (display (+ y 1)) (display x))" 
	     " if: perhaps (if (not x) (display (+ y 1)) (display x)) -> (display (or x (+ y 1)))") 
  (lint-test "(if (not x) (set! y z) (set! y x))" " if: perhaps (if (not x) (set! y z) (set! y x)) -> (set! y (or x z))")
  (lint-test "(if a A (if b A (if c A B)))" 
	     " if: perhaps use cond: (if a A (if b A (if c A B))) -> (cond (a A) (b A) (c A) (else B))
               if: perhaps (if a A (if b A (if c A B))) -> (if (or a b c) A B)
               if: perhaps (if b A (if c A B)) -> (if (or b c) A B)")
  (lint-test "(begin (if x (display x) y) z)" " begin: this branch is pointless: y in (if x (display x) y)")
  (lint-test "(begin (if x z (display x)) z)" " begin: this branch is pointless: z in (if x z (display x))")
  (lint-test "(begin (if x (begin (display x) z)) z)" " begin: this is pointless: z in (begin (display x) z)")
  (lint-test "(begin (if x (begin (display y) (+ x 1)) (begin (display x) z)) z)" 
	     " begin: this is pointless: (+ x 1) in (begin (display y) (+ x 1))
               begin: this is pointless: z in (begin (display x) z)")
  (lint-test "(begin (let () (display x)) y)" 
	     " begin: perhaps (begin (let () (display x)) y) -> (let () (display x) y)
               begin: pointless let: (let () (display x))")

  (lint-test "(let ((list x)) (if (null? list) 3 2))" 
	     " let: perhaps (let ((list x)) (if (null? list) 3 2)) -> (if (null? x) 3 2)
               let: assuming we see all set!s, the binding (list x) is pointless: perhaps (let ((list x)) (if (null? list) 3 2)) -> (if (null? x) 3 2)")
  (lint-test "(null? (string->list x))" " null?: perhaps (null? (string->list x)) -> (zero? (length x))")
  (lint-test "(memq x (if (memq y '(< <=)) '(< <=) '(> >=)))" "") ; this is checking the ->simple-type escape
  (lint-test "(if q `(not ,op ,x) `(not ,op ,y))" "") ; make sure we don't try to rewrite quasiquote

  (let-temporarily ((*report-one-armed-if* #t))
    (lint-test "(if a (begin (set! x y) z))"       " if: perhaps (if a (begin (set! x y) z)) -> (when a (set! x y) z)")
    (lint-test "(if (not a) (begin (set! x y) z))" " if: perhaps (if (not a) (begin (set! x y) z)) -> (unless a (set! x y) z)")
    (lint-test "(if a (set! x y))"                 " if: perhaps (if a (set! x y)) -> (when a (set! x y))")
    (lint-test "(if (not a) (set! x y))"           " if: perhaps (if (not a) (set! x y)) -> (unless a (set! x y))"))

  (let-temporarily ((*report-doc-strings* #t))
    (lint-test "(let () (define (hiho a) \"hiho is a function\" (+ a 1)) (hiho 1))" 
	       " let: perhaps (... (define (hiho a) \"hiho is a function\" (+ a 1)) (hiho 1)) -> (... (let ((a 1)) (+ a 1)))
                 hiho: old-style doc string: \"hiho is a function\", in s7 use '+documentation+:
     (define hiho 
      (let ((+documentation+ \"hiho is a function\"))
        (lambda (a)
          (+ a 1))))"))

  (let-temporarily ((*report-undefined-identifiers* #t))
    (lint-test "(let ((x 1)) (cdr? x))"  
	       " let: perhaps, assuming cdr? is not a macro, (let ((x 1)) (cdr? x)) -> (cdr? 1)
                 this identifier was not defined: cdr?")
    (lint-test "(let ((x 1)) (+ x (aaa)))"       " this identifier was not defined: aaa")
    (lint-test "(let ((x 1)) (+ x (zzz) (aaa)))" " the following identifiers were not defined: aaa zzz")
    (lint-test "(let ((example 32)) (+ exampl (* 2 example) (sqrt example)))" " this identifier was not defined: exampl"))

  (let-temporarily ((*report-shadowed-variables* #t))
    (lint-test "(let ((x 1)) (+ (let ((x 2)) (+ x 1)) x))" 
	       " let: let variable x in (x 2) shadows an earlier declaration  let: perhaps (let ((x 2)) (+ x 1)) -> (+ 2 1)"))

  (lint-test "(when (not a) (set! x y))"   " when: perhaps (when (not a) (set! x y)) -> (unless a (set! x y))")
  (lint-test "(unless (not a) (set! x y))" " unless: perhaps (unless (not a) (set! x y)) -> (when a (set! x y))")
  
  (lint-test "(begin (if x (y)) (if x (z)) 32)" " begin: perhaps (... (if x (y)) (if x (z)) ...) -> (... (when x (y) (z)) ...)")
  (lint-test "(begin (if x (y)) (if x (z)))"    " begin: perhaps (... (if x (y)) (if x (z)) ...) -> (... (when x (y) (z)) ...)")
  (lint-test "(begin (if x (y)) (if x (z)) (v) (if x (w)))" " begin: perhaps (... (if x (y)) (if x (z)) ...) -> (... (when x (y) (z)) ...)")
  (lint-test "(begin (if x (y)) (if x (z)) (v) (if x (w)) 12)" " begin: perhaps (... (if x (y)) (if x (z)) ...) -> (... (when x (y) (z)) ...)")

  (lint-test "(begin (if (< x 0) (display y)) (if (< x 0) z))"  
	     " begin: perhaps (... (if (< x 0) (display y)) (if (< x 0) z) ...) ->
               (... (when (< x 0) (display y) z) ...)")
  (lint-test "(begin (if (< x 0) (display y) (display (- y 1))) (if (< x 0) z))" 
	     " begin: perhaps (if (< x 0) (display y) (display (- y 1))) -> (display (if (< x 0) y (- y 1)))
              begin: perhaps  (... (if (< x 0) (display y) (display (- y 1))) (if (< x 0) z) ...) ->
                (... (if (< x 0) (begin (display y) z) (begin (display (- y 1)))) ...)")
  (lint-test "(begin (if (< x 0) (begin (display y) (set! y 3)) (display (- y 1))) (if (< x 0) z (begin (display (+ z 1)) (- z 1))))" 
	     " begin: perhaps (... (if (< x 0) (begin (display y) (set! y 3)) (display (- y 1))) (if (<... ->
               (... (if (< x 0) (begin (display y) (set! y 3) z) (begin (display (- y 1)) (display (+ z 1)) (- z 1))) ...)")

  (lint-test "(cond . 1)"		" cond: cond is messed up: (cond . 1)")
  (lint-test "(cond 1)"			" cond: cond is messed up: (cond 1)")
  (lint-test "(cond ((< 3 1) 2))"	
	     " cond: cond test (< 3 1) is never true: (cond ((< 3 1) 2))
               cond: cond test is always false: ((< 3 1) 2)
               cond: perhaps (cond ((< 3 1) 2)) -> (cond)")
  (lint-test "(cond (else 2) (x 3))"	" cond: cond else clause is not the last:  (cond (else 2) (x 3))")
  (lint-test "(cond (x => abs))"	"")
  (lint-test "(cond (x))"               " cond: perhaps (cond (x)) -> x")
  (lint-test "(cond (x =>))"		" cond: cond => target is messed up:  (x =>)")
  (lint-test "(cond (x #f) (#t #t))"	" cond: perhaps (cond (x #f) (#t #t)) -> (not x)")
  (lint-test "(cond (x #t) (else #f))"	" cond: perhaps (cond (x #t) (else #f)) -> x")
  (lint-test "(cond (x #t) (else y))"   "")
  (lint-test "(cond (x #f) (else y))"   " cond: perhaps (cond (x #f) (else y)) -> (and (not x) y)")
  (lint-test "(cond (x #f) (else (f y) g))" " cond: perhaps (cond (x #f) (else (f y) g)) -> (and (not x) (begin (f y) g))")
  (lint-test "(cond (x #t) (else #t))"  " cond: perhaps (cond (x #t) (else #t)) -> #t")
  (lint-test "(cond ((not x) #f) (else y))" " cond: perhaps (cond ((not x) #f) (else y)) -> (and x y)")
  (lint-test "(cond ((null? x) #t) (else y))" 
	     " cond: this #t could be omitted: ((null? x) #t) cond: perhaps (cond ((null? x) #t) (else y)) -> (or (null? x) y)")
  (lint-test "(cond ((= x 1) 2) (else 2))" " cond: perhaps (cond ((= x 1) 2) (else 2)) -> 2")
  (lint-test "(cond ((and (display x) x) 32) (#t 32))" 
	     " cond: perhaps (cond ((and (display x) x) 32) (#t 32)) -> (begin (and (display x) x) 32)")
  (lint-test "(cond (x y) (z 32) (else 32))" " cond: this clause could be omitted: (z 32)")
  (lint-test "(cond ((= x 1) (display \"a\") 32) (#t (display \"a\") 32))" 
	     " cond: perhaps (cond ((= x 1) (display \"a\") 32) (#t (display \"a\") 32)) ->  (begin (display \"a\") 32)")
  (lint-test "(cond ((= x 1) 32))"      " cond: perhaps (cond ((= x 1) 32)) -> (if (= x 1) 32)")
  (lint-test "(cond ((and (display 32) (= x 1)) 1) (#t 1))" 
	     " cond: perhaps (cond ((and (display 32) (= x 1)) 1) (#t 1)) -> (begin (and (display 32) (= x 1)) 1)")
  (lint-test "(cond ((< x 1) 2) (else (cond ((< y 3) 2) (#t 4))))" 
	     " cond: else clause could be folded into the outer cond: 
                (cond ((< x 1) 2) (else (cond ((< y 3) 2) (#t 4)))) -> (cond ((< x 1) 2) ((< y 3) 2) (#t 4))")
  (lint-test "(cond ((< x 2) 3) ((> x 0) 4) ((< x 2) 5))" 
	     " cond: cond test (< x 2) is never true: (cond ((< x 2) 3) ((> x 0) 4) ((< x 2) 5))
               cond: cond test repeated: ((< x 2) 5)
               cond: cond test is always false: ((< x 2) 5)
               cond: perhaps (cond ((< x 2) 3) ((> x 0) 4) ((< x 2) 5)) -> (cond ((< x 2) 3) ((> x 0) 4))")
  (lint-test "(cond ((< x 1) (+ x 1)) ((> x 1) (+ x 1)) (#t 2))" 
	     " cond: perhaps (cond ((< x 1) (+ x 1)) ((> x 1) (+ x 1)) (#t 2)) -> (cond ((not (= x 1)) (+ x 1)) (#t 2))")
  (lint-test "(cond ((= x 3) 4) ((= x 2) 4) ((= x 1) 4) (else 5))" 
	     " cond: perhaps (cond ((= x 3) 4) ((= x 2) 4) ((= x 1) 4) (else 5)) -> (case x ((3 2 1) 4) (else 5))")
  (lint-test "(cond ((= x 3) 3) ((= x 2) 4) ((= x 1) 4) (else 5))" 
	     " cond: perhaps (cond ((= x 3) 3) ((= x 2) 4) ((= x 1) 4) (else 5)) -> (case x ((3) 3) ((2 1) 4) (else 5))")
  (lint-test "(cond ((= x 3) 3) ((= x 2) 4) ((= x 1) 4))" 
	     " cond: perhaps (cond ((= x 3) 3) ((= x 2) 4) ((= x 1) 4)) -> (case x ((3) 3) ((2 1) 4))")
  (lint-test "(cond (a) (b) (c))"	" cond: perhaps (cond (a) (b) (c)) -> (cond ((or a b c)))")
  (lint-test "(cond ((= x 0) x) ((= x 1) (= x 1)))" 
	     " cond: no need to repeat the test:  ((= x 1) (= x 1)) -> ((= x 1))
               cond: perhaps use case instead of cond: (cond ((= x 0) x) ((= x 1) (= x 1))) -> (case x ((0)) ((1) (= x 1)))")
  (lint-test "(cond (x => expt))"	" cond: => target (expt) may be unhappy: (x => expt)")
  (lint-test "(cond (x (abs x)))"	
	     " in (cond (x (abs x))), perhaps change x to (real? x)
               cond: perhaps use => here: (x (abs x)) -> (x => abs)")
  (lint-test "(cond ((> x 2) (not (> x 2))))" " cond: perhaps replace (not (> x 2)) with #f")
  (lint-test "(cond (x #t) (y #t) (else #f))" 
	     " cond: perhaps (cond (x #t) (y #t) (else #f)) -> (or x y)
               cond: perhaps (cond (x #t) (y #t) (else #f)) -> (or x (and y #t))")
  (lint-test "(cond (x #f) (y #f) (else #t))" " cond: perhaps (cond (x #f) (y #f) (else #t)) -> (not (or x y))")
  (lint-test "(cond (x y) ('else z))" " cond: odd cond clause test: is 'else supposed to be else? ('else z)")
  (lint-test "(cond ((x) y) ((not (x)) z))"   " cond: perhaps (cond ((x) y) ((not (x)) z)) -> (cond ((x) y) (else z))")

  (lint-test "(cond (x (let ((z w)) (+ x z)) y) (else 2))" 
	     " in (cond (x (let ((z w)) (+ x z)) y) (else 2)), perhaps change x to (number? x)
               cond: this could be omitted: (let ((z w)) (+ x z))
               cond: perhaps (let ((z w)) (+ x z)) -> (+ x w)
               cond: assuming we see all set!s, the binding (z w) is pointless: perhaps (let ((z w)) (+ x z)) -> (+ x w)")
  (lint-test "(cond (x (if x y z) (+ x 1)) (z 2))"             " cond: this could be omitted: (if x y z)")
  (lint-test "(cond ((g x) `(c ,x) `(c ,y)))"                  
	     " cond: this could be omitted: (list-values 'c x)
               cond: perhaps (list-values 'c x) -> (list 'c x)
               cond: perhaps (list-values 'c y) -> (list 'c y)
               cond: perhaps (cond ((g x) (list-values 'c x) (list-values 'c y))) -> (when (g x) (list-values 'c x) (list-values 'c y))")
  (lint-test "(cond ((= x 1) 2) ((= x 2) 3))" " cond: perhaps use case instead of cond: (cond ((= x 1) 2) ((= x 2) 3)) -> (case x ((1) 2) ((2) 3))")
  (lint-test "(cond ((= x y) (begin (display x) y)) (else x))" " cond: redundant begin: (begin (display x) y)")
  (lint-test "(cond ((= x y) y) (else (begin (display x) x)))" 
	     " cond: redundant begin: (begin (display x) x) cond: display returns its first argument, so this could be omitted: x")
  (lint-test "(cond ((= x y) z) (else #<unspecified>))"        " cond: this #<unspecified> is redundant: (else #<unspecified>)")
  (lint-test "(cond (x y) (y z (else 3)))" " cond: this could be omitted: z cond: perhaps cond else clause is misplaced: (else 3) in (y z (else 3))")
  (lint-test "(cond (x y) (y z (#t 3)))" " cond: this could be omitted: z cond: perhaps cond else clause is misplaced: (#t 3) in (y z (#t 3))")
  (lint-test "(cond (< x 1) (else 1))"   " cond: strange cond test: < in (< x 1) is a procedure  cond: this could be omitted: x")
  (lint-test "(cond ((memq x '(a b)) 3) ((eq? x 'c) 4) ((or (eq? x 'd) (eq? 'e x)) 5) (else 6))" 
	     " cond: perhaps use case instead of cond: 
                (cond ((memq x '(a b)) 3) ((eq? x 'c) 4) ((or (eq? x 'd) (eq? 'e x)) 5)... -> (case x ((a b) 3) ((c) 4) ((d e) 5) (else 6))")
  (lint-test "(cond ((eq? x 'a) 1) ((not x) 2) (else 3))" 
	     " cond: perhaps use case instead of cond: (cond ((eq? x 'a) 1) ((not x) 2) (else 3)) -> (case x ((a) 1) ((#f) 2) (else 3))")
  (lint-test "(cond ((eof-object? x) 1) ((null? x) 2) ((not x) 3) (else 4))"
	     " cond: perhaps use case instead of cond: 
               (cond ((eof-object? x) 1) ((null? x) 2) ((not x) 3) (else 4)) -> (case x ((#<eof>) 1) ((()) 2) ((#f) 3) (else 4))")
  (lint-test "(cond ((or (null? x) (not x)) 1) ((eq? x 'a) 3) (else 2))" 
	     " cond: perhaps use case instead of cond: 
               (cond ((or (null? x) (not x)) 1) ((eq? x 'a) 3) (else 2)) -> (case x ((() #f) 1) ((a) 3) (else 2))")
  (lint-test "(cond ((= x 0) 1) ((= x 2) 2) ((= x 3) (cond ((not y) 1) ((null? y) 2) ((eq? y 'a) 3) (else 4))) (else 5))"
	     " cond: perhaps use case instead of cond: 
               (cond ((not y) 1) ((null? y) 2) ((eq? y 'a) 3) (else 4)) -> (case y ((#f) 1) ((()) 2) ((a) 3) (else 4))
               cond: perhaps use case instead of cond: (cond ((= x 0) 1) ((= x 2) 2) ((= x 3) (cond ((not y) 1) ((null? y) 2)... ->
               (case x ((0) 1) ((2) 2) ((3) (cond ((not y) 1) ((null? y) 2) ((eq? y 'a) 3) (else 4))) (else 5))
               cond: perhaps (cond ((= x 0) 1) ((= x 2) 2) ((= x 3) (cond ((not y) 1) ((null? y) 2)... ->
               (cond ((= x 0) 1) ((= x 2) 2) ((not (= x 3)) 5) ((not y) 1) ((null? y) 2) ((eq? y 'a) 3) (else 4))")
  (lint-test "(cond ((equal? x 'a) 1) ((equal? x 1) 2) (else 3))" 
	     " cond: equal? could be eq? in (equal? x 'a) 
               cond: equal? could be eqv? in (equal? x 1)
               cond: perhaps use case instead of cond: (cond ((equal? x 'a) 1) ((equal? x 1) 2) (else 3)) -> (case x ((a) 1) ((1) 2) (else 3))")
  (lint-test "(cond ((= x 1) 1) (t 2))" " cond: odd cond clause test: is t supposed to be #t? (t 2)")
  (lint-test "(cond (t 2))"             " cond: odd cond clause test: is t supposed to be #t? (t 2)")
  (lint-test "(cond ((memq x '(a b)) => car) ((eq? x 'c) 2))" "") ; this should not got to case because the => operator won't work the same
  (lint-test "(cond ((char=? c #\\a) (set! x y)) ((char=? c #\\b) (set! y x)) (else (set! x z)))" 
	     " cond: perhaps use case instead of cond: (cond ((char=? c #\\a) (set! x y)) ((char=? c #\\b) (set! y x)) (else (set!... ->
                 (case c ((#\\a) (set! x y)) ((#\\b) (set! y x)) (else (set! x z)))")
  (lint-test "(cond ((char-ci=? c #\\a) (set! x y)) ((char=? c #\\b) (set! y x)) (else (set! x z)))" 
	     " cond: perhaps use case instead of cond: (cond ((char-ci=? c #\\a) (set! x y)) ((char=? c #\\b) (set! y x)) (else... ->
                 (case c ((#\\a #\\A) (set! x y)) ((#\\b) (set! y x)) (else (set! x z)))")
  (lint-test "(cond ((null? x) 1) ((= x 1) 2) ((boolean? x) 3) (else 4))" 
	     " cond: perhaps use case instead of cond: (cond ((null? x) 1) ((= x 1) 2) ((boolean? x) 3) (else 4)) ->
                 (case x ((()) 1) ((1) 2) ((#t #f) 3) (else 4))")
  (lint-test "(cond ((< x 1) 1) ((string? y) 2))" "") ; check a simplification bug
  (lint-test "(cond ((eof-object? x)) ((zero? x)))" 
	     " cond: perhaps use case instead of cond: (cond ((eof-object? x)) ((zero? x))) -> (case x ((#<eof>) #t) ((0 0.0) #t))")
  (lint-test "(cond ((= 3 (length eq)) (caddr eq)) (else #f))" 
	     " cond: perhaps (cond ((= 3 (length eq)) (caddr eq)) (else #f)) -> (and (= 3 (length eq)) (caddr eq))")
  (lint-test "(cond ((= 3 (length eq)) (caddr eq)) (else #t))" 
	     " cond: perhaps (cond ((= 3 (length eq)) (caddr eq)) (else #t)) -> (or (not (= 3 (length eq))) (caddr eq))")
  (lint-test "(cond ((= x y) #f) (else (abs x)))" " cond: perhaps (cond ((= x y) #f) (else (abs x))) -> (and (not (= x y)) (abs x))")
  (lint-test "(cond ((and (= x y) z) (+ x 1)) (else #f))" 
	     " cond: perhaps (cond ((and (= x y) z) (+ x 1)) (else #f)) -> (and (= x y) z (+ x 1))")
  (lint-test "(cond (a A) (else A))"    " cond: perhaps (cond (a A) (else A)) -> A")
  (lint-test "(cond ((a)) (else A))"    " cond: perhaps (cond ((a)) (else A)) -> (or (a) A)")
  (lint-test "(cond (a A) (else (if b B)))" 
	     " cond: else clause could be folded into the outer cond: (cond (a A) (else (if b B))) -> (cond (a A) (b B))")
  (lint-test "(cond (a A) (else (if b B C)))" 
	     " cond: else clause could be folded into the outer cond: (cond (a A) (else (if b B C))) -> (cond (a A) (b B) (else C))")
  (lint-test "(cond (a A) (else (if b (begin (B) D) (begin (C) E))))" 
	     " cond: else clause could be folded into the outer cond: 
                (cond (a A) (else (if b (begin (B) D) (begin (C) E)))) -> (cond (a A) (b (B) D) (else (C) E))")
  (lint-test "(cond (a A) (else (when b B)))" 
	     " cond: else clause could be folded into the outer cond: (cond (a A) (else (when b B))) -> (cond (a A) (b B))")
  (lint-test "(cond (a A) (else (unless b B)))" 
	     " cond: else clause could be folded into the outer cond: (cond (a A) (else (unless b B))) -> (cond (a A) ((not b) B))")
  (lint-test "(cond (A) (B) (else C))"  " cond: perhaps (cond (A) (B) (else C)) -> (or A B C)")
  (lint-test "(cond (A) (B) (else (C) D))"  " cond: perhaps (cond (A) (B) (else (C) D)) -> (or A B (begin (C) D))")
  (lint-test "(cond (A) (B) (C))"       " cond: perhaps (cond (A) (B) (C)) -> (cond ((or A B C)))") ; (or A B C #<unspecified>) ??
  (lint-test "(cond ((A) B) ((or C D)) (else E))" 
	     " cond: perhaps (cond ((A) B) ((or C D)) (else E)) -> (cond ((A) B) (else (or C D E)))")

  (lint-test "(cond (A (cond (B c) (else D))) (else E))" 
	     " cond: perhaps (cond (A (cond (B c) (else D))) (else E)) -> (cond ((not A) E) (B c) (else D))")
  (lint-test "(cond (A (cond (B c) (else D))))" 
	     " cond: perhaps (cond (A (cond (B c) (else D)))) -> (if A (cond (B c) (else D)))
               cond: perhaps (cond (A (cond (B c) (else D)))) -> (cond ((not A) #<unspecified>) (B c) (else D))")
  (lint-test "(cond (A B) (C (cond (D d) (else E))) (else F))" 
	     " cond: perhaps (cond (A B) (C (cond (D d) (else E))) (else F)) -> (cond (A B) ((not C) F) (D d) (else E))")
  (lint-test "(cond (A B) (C (if D d E)) (else F))" 
	     " cond: perhaps (cond (A B) (C (if D d E)) (else F)) -> (cond (A B) ((not C) F) (D d) (else E))")
  (lint-test "(cond (A B) ((not C) (cond (D d) (else E))) (else F))" 
	     " cond: perhaps (cond (A B) ((not C) (cond (D d) (else E))) (else F)) -> (cond (A B) (C F) (D d) (else E))")
  (lint-test "(cond (A B) ((< C 1) (cond (D d) (else E))) (else F))" 
	     " cond: perhaps (cond (A B) ((< C 1) (cond (D d) (else E))) (else F)) -> (cond (A B) ((>= C 1) F) (D d) (else E))")

  (lint-test "(cond (W X) (A B) (C D) (else B))" 
	     " cond: perhaps (cond (W X) (A B) (C D) (else B)) -> (cond (W X) ((or A (not C)) B) (else D))")
  (lint-test "(cond (W X) (A #f) (C D) (else #f))" 
	     " cond: perhaps (cond (W X) (A #f) (C D) (else #f)) -> (cond (W X) ((or A (not C)) #f) (else D))")
  (lint-test "(cond (Y #t) (W X) (A #f) (C #t) (else #f))" 
	     " cond: perhaps (cond (Y #t) (W X) (A #f) (C #t) (else #f)) -> (cond ... ((or A (not C)) #f) (else #t))")
  (lint-test "(cond (W #t) (A B) (C #t) (else B))" 
	     " cond: perhaps (cond (W #t) (A B) (C #t) (else B)) -> (cond (W #t) ((or A (not C)) B) (else #t))")
  (lint-test "(cond (W B) (A B) (C #t) (else B))" 
	     " cond: perhaps (cond (W B) (A B) (C #t) (else B)) -> (cond ((or W A) B) (C #t) (else B))
               cond: perhaps (cond (W B) (A B) (C #t) (else B)) -> (cond (W B) ((or A (not C)) B) (else #t))")
  
  (lint-test "(cond ((string=? x \"a\") 1) ((string=? x \"b\") 2) ((string=? x \"c\") 3) (else 4))" 
	     " cond: perhaps (cond ((string=? x \"a\") 1) ((string=? x \"b\") 2) ((string=? x \"c\") 3) (else 4)) ->
                 (cond ((assq (string->symbol x) '((a . 1) (b . 2) (c . 3))) => cdr) (else 4))")
  (lint-test "(cond ((any-op x) 1) ((eq? x 'b) 2) ((eq? x 'c) 3) (else 4))" 
	     " cond: perhaps (cond ((any-op x) 1) ((eq? x 'b) 2) ((eq? x 'c) 3) (else 4)) ->
                 (cond ((any-op x) 1) ((assq x '((b . 2) (c . 3))) => cdr) (else 4))")
  (lint-test "(cond ((= order 1) 1.0) ((= order 2) 1.3) ((< order 9) 1.7) (else 1.852))" 
	     " cond: perhaps (cond ((= order 1) 1.0) ((= order 2) 1.3) ((< order 9) 1.7) (else 1.852)) ->
                 (cond ((assoc order '((1 . 1.0) (2 . 1.3)) =) => cdr) ((< order 9) 1.7) (else 1.852))")
  (lint-test "(cond ((= order 1) 1.0) ((= order 2) 1.3) ((< order 9) 1.7))" 
	     " cond: perhaps (cond ((= order 1) 1.0) ((= order 2) 1.3) ((< order 9) 1.7)) ->
                 (cond ((assoc order '((1 . 1.0) (2 . 1.3)) =) => cdr) ((< order 9) 1.7))")
  (lint-test "(cond ((< order 8) 1.6) ((= order 1) 1.0) ((= order 2) 1.3) ((< order 9) 1.7))" 
	     " cond: perhaps (cond ((< order 8) 1.6) ((= order 1) 1.0) ((= order 2) 1.3) ((< order 9) 1.7)) ->
                 (cond ((< order 8) 1.6) ((assoc order '((1 . 1.0) (2 . 1.3)) =) => cdr) ((< order 9) 1.7))")
  (lint-test "(cond ((and (integer? x) (exact? x) (integer? y) (exact? y)) 2) (else 3))" 
	     " cond: perhaps (cond ((and (integer? x) (exact? x) (integer? y) (exact? y)) 2) (else 3)) -> 
                (cond ((and (integer? x) (integer? y)) 2) (else 3))")
  (lint-test "(cond ((and (integer? x) (exact? y) (integer? y) (exact? x)) 2) (else 3))" 
	     " cond: perhaps (cond ((and (integer? x) (exact? y) (integer? y) (exact? x)) 2) (else 3)) ->
                (cond ((and (integer? x) (integer? y)) 2) (else 3))")
  (lint-test "(cond ((integer? x) (+ x 1)) ((real? x) (- x 1.0)) (else (+ x 1)))" 
	     " cond: perhaps (cond ((integer? x) (+ x 1)) ((real? x) (- x 1.0)) (else (+ x 1))) ->
                (if (or (integer? x) (not (real? x))) (+ x 1) (- x 1.0))")
  (lint-test "(cond ((complex? x) (+ x 1)) ((not (integer? x)) 0) (else (+ x 1)))" 
	     " cond: perhaps (cond ((complex? x) (+ x 1)) ((not (integer? x)) 0) (else (+ x 1))) ->
                (if (complex? x) (+ x 1) 0)")
  (lint-test "(cond (A a) (B b) (else a))"    " cond: perhaps (cond (A a) (B b) (else a)) -> (if (or A (not B)) a b)")
  (lint-test "(cond (A #f) (B b) (else #f))"  " cond: perhaps (cond (A #f) (B b) (else #f)) -> (and (not A) B b)")
  (lint-test "(cond (A #f) (B #t) (else #f))" 
	     " cond: perhaps (cond (A #f) (B #t) (else #f)) -> (and (not A) B)
               cond: perhaps (cond (A #f) (B #t) (else #f)) -> (and (not A) B)")
  (lint-test "(cond (A #t) (B b) (else #t))"  " cond: perhaps (cond (A #t) (B b) (else #t)) -> (or A (not B) b)")
  (lint-test "(cond (A #t) (B #f) (else #t))" " cond: perhaps (cond (A #t) (B #f) (else #t)) -> (or A (not B))")
  (lint-test "(cond (A a) (B a) (else b))"    " cond: perhaps (cond (A a) (B a) (else b)) -> (cond ((or A B) a) (else b))")
  (lint-test "(cond ((and A B) c) (B d) (else e))" " cond: perhaps (cond ((and A B) c) (B d) (else e)) -> (cond (B (if A c d)) (else e))")
  (lint-test "(cond ((and A B) c) (A d) (else e))" " cond: perhaps (cond ((and A B) c) (A d) (else e)) -> (cond (A (if B c d)) (else e))")
  (lint-test "(cond (A B) ((or A C) D))" " cond: perhaps (cond (A B) ((or A C) D)) -> (cond (A B) (C D))")
  (lint-test "(cond (A B) ((or A C) D) (C E))" 
	     " cond: cond test C is never true: (cond (A B) ((or A C) D) (C E)) 
               cond: cond test is always false: (C E) 
               cond: perhaps (cond (A B) ((or A C) D) (C E)) -> (cond (A B) (C D))")
  (lint-test "(cond ((< x 1) 21) ((< x 2) 32) ((or (< x 1) (> x 3)) 33))" 
	     " cond: perhaps (cond ((< x 1) 21) ((< x 2) 32) ((or (< x 1) (> x 3)) 33)) -> (cond ((assoc x '((1 . 21) (2 . 32)) <) => cdr) ((> x 3) 33))")
  (lint-test "(cond ((not x) (display (+ y 1))) (else (display x)))" 
	     " cond: perhaps (cond ((not x) (display (+ y 1))) (else (display x))) -> (display (if (not x) (+ y 1) x))
               cond: perhaps (cond ((not x) (display (+ y 1))) (else (display x))) -> (if x (display x) (display (+ y 1)))")
  (lint-test "(cond ((not x) (display (+ y 1)) z) (else (display x) a))" 
	     " cond: perhaps (cond ((not x) (display (+ y 1)) z) (else (display x) a)) -> (cond (x (display x) a) (else (display (+ y 1)) z))")
  (lint-test "(begin (cond (x y) (z (display a) (+ a 1))) z)" 
	     " begin: this is pointless: y in (x y)
               begin: this is pointless: (+ a 1) in (z (display a) (+ a 1))")
  (lint-test "(begin (cond ((A) (f B)) ((< C 1) (cond ((D) (f d)) (else (f E))))) x)" 
	     " begin: perhaps (cond ((D) (f d)) (else (f E))) -> (f (if (D) d E))
               begin: perhaps (cond ((A) (f B)) ((< C 1) (cond ((D) (f d)) (else (f E))))) -> (cond ((A) (f B)) ((>= C 1)) ((D) (f d)) (else (f E)))")
  (lint-test "(cond ((A) (f B)) ((< C 1) (cond ((D) (f d)) (else (f E)))))" 
	     " cond: perhaps (cond ((D) (f d)) (else (f E))) -> (f (if (D) d E))
               cond: perhaps (cond ((A) (f B)) ((< C 1) (cond ((D) (f d)) (else (f E))))) -> (cond ((A) (f B)) ((>= C 1) #<unspecified>) ((D) (f d)) (else (f E)))")
  (lint-test "(cond ((= x 0) 1) ((= x 3) (cond ((not y) 1) ((pair? y) 2) ((eq? y 'a) 3) (else 4))) ((< x 200) 2) (else 5))" 
	     " cond: perhaps (cond ((= x 0) 1) ((= x 3) (cond ((not y) 1) ((pair? y) 2) ((eq? y 'a) 3)... ->
                (cond ((= x 0) 1) ((not (= x 3)) (if (< x 200) 2 5)) ((not y) 1) ((pair? y) 2) ((eq? y 'a) 3) (else 4))")
  (lint-test "(cond ((pair? x) 3) ((eq? x 'a) z) ((eq? x 'b) (* 2 z)) ((eq? x 'c) (display z)))" 
	     " cond: possibly use case at the end: 
                (cond ((pair? x) 3) ((eq? x 'a) z) ((eq? x 'b) (* 2 z)) ((eq? x 'c)... ->
                (if (pair? x) 3 (case x ((a) z) ((b) (* 2 z)) ((c) (display z))))")
  (lint-test "(cond ((pair? x) 3) ((eq? x 'a) z) ((eq? x 'b) (* 2 z)) ((eq? x 'c) (display z)) (else (display y)))"
	     " cond: possibly use case at the end: 
                (cond ((pair? x) 3) ((eq? x 'a) z) ((eq? x 'b) (* 2 z)) ((eq? x 'c)... ->
                (if (pair? x) 3 (case x ((a) z) ((b) (* 2 z)) ((c) (display z)) (else (display y))))")
  (lint-test "(cond ((pair? x) #f) ((eq? x 'a) z) ((eq? x 'b) (* 2 z)) ((eq? x 'c) (display z)))" 
	     " cond: possibly use case at the end: 
                (cond ((pair? x) #f) ((eq? x 'a) z) ((eq? x 'b) (* 2 z)) ((eq? x 'c)... ->
                (and (not (pair? x)) (case x ((a) z) ((b) (* 2 z)) ((c) (display z))))")
  (lint-test "(cond ((pair? x) 3) ((integer? x) 4) ((eq? x 'a) z) ((eq? x 'b) (* 2 z)) ((eq? x 'c) (display z)))"
	     " cond: possibly use case at the end: 
                (cond ((pair? x) 3) ((integer? x) 4) ((eq? x 'a) z) ((eq? x 'b) (* 2 z))... ->
                (cond ((pair? x) 3) ((integer? x) 4) (else (case x ((a) z) ((b) (* 2 z)) ((c) (display z)))))")
  (lint-test "(cond ((< x 1) (+ x 1)) (else (+ x 2)))"
	     " cond: perhaps (cond ((< x 1) (+ x 1)) (else (+ x 2))) -> (+ x (if (< x 1) 1 2))")
  (lint-test "(cond ((< x 1) (fx1 x y z)) (else (fx1 x z z)))" 
	     " cond: perhaps (cond ((< x 1) (fx1 x y z)) (else (fx1 x z z))) -> (fx1 x (if (< x 1) y z) z)")
  (lint-test "(cond ((< x 1) (fx1 x y z)) (else (fx1 x z a z)))" 
	     " cond: perhaps (cond ((< x 1) (fx1 x y z)) (else (fx1 x z a z))) -> (fx1 x (if (< x 1) y (values z a)) z)")
  (lint-test "(cond ((< x 1) (fx1 x y z)) (else (fx1 z z y z)))" 
	     " cond: perhaps (cond ((< x 1) (fx1 x y z)) (else (fx1 z z y z))) -> (fx1 (if (< x 1) x (values z z)) y z)")
  (lint-test "(cond ((< x 1) (fx1 x z)) (else (fx1 x z)))" 
	     " cond: perhaps (cond ((< x 1) (fx1 x z)) (else (fx1 x z))) -> (fx1 x z)")
  (lint-test "(cond ((< x 1) (fx1 x y y z)) (else (fx1 x y z)))" 
	     " cond: perhaps (cond ((< x 1) (fx1 x y y z)) (else (fx1 x y z))) -> (fx1 x y (if (< x 1) (values y z) z))")
  (lint-test "(cond ((< x 1) (fx1 x y y z)) (else (fx1 x z)))" 
	     " cond: perhaps (cond ((< x 1) (fx1 x y y z)) (else (fx1 x z))) -> (fx1 x (if (< x 1) (values y y z) z))")
  (lint-test "(cond ((< x 1) (fx1 x y z)) (else (fx1 x y y z)))" 
	     " cond: perhaps (cond ((< x 1) (fx1 x y z)) (else (fx1 x y y z))) -> (fx1 x y (if (< x 1) z (values y z)))")
  (lint-test "(cond ((< x 1) (list x)) (else (list x y)))" 
	     " cond: perhaps (cond ((< x 1) (list x)) (else (list x y))) -> (list (if (< x 1) x (values x y)))")
  (lint-test "(cond ((< x 1) (list x y)) (else (list x)))" 
	     " cond: perhaps (cond ((< x 1) (list x y)) (else (list x))) -> (list (if (< x 1) (values x y) x))")
  (lint-test "(cond ((< x 1) (+ x 1)) ((< y 1) (+ x 3)) (else (+ x 2)))" 
	     " cond: perhaps (cond ((< x 1) (+ x 1)) ((< y 1) (+ x 3)) (else (+ x 2))) -> (+ x (cond ((< x 1) 1) ((< y 1) 3) (else 2)))")
  (lint-test "(cond ((< x 1) (+ x 1 y)) ((< y 1) (+ x 3 y)) (else (+ x 2 y)))" 
	     " cond: perhaps (cond ((< x 1) (+ x 1 y)) ((< y 1) (+ x 3 y)) (else (+ x 2 y))) -> (+ x (cond ((< x 1) 1) ((< y 1) 3) (else 2)) y)")
  (lint-test "(cond (else (+ x 1)))" " cond: perhaps (cond (else (+ x 1))) -> (+ x 1)")
  (lint-test "(cond ((< x 1) (log x 2)) ((< x 2) (log x 3)) (else (error 'oops)))" 
	     " cond: perhaps (cond ((< x 1) (log x 2)) ((< x 2) (log x 3)) (else (error 'oops))) -> (log x (cond ((< x 1) 2) ((< x 2) 3) (else (error 'oops))))")

  (lint-test "(cond (X (f y z)) (else (g y z)))" " cond: perhaps (cond (X (f y z)) (else (g y z))) -> ((cond (X f) (else g)) y z)")
  (lint-test "(cond (X (f y z)) (Y (g y z)))" "")
  (lint-test "(cond (X (f y z)) (Y (f y z)) (Z (f y z)))" 
	     " cond: perhaps (cond (X (f y z)) (Y (f y z)) (Z (f y z))) -> (if (or X Y Z) (f y z))
               cond: perhaps (cond (X (f y z)) (Y (f y z)) (Z (f y z))) -> (cond ((or X Y Z) (f y z)))")
  (lint-test "(cond (X (g y a)) (else (g y z)))" " cond: perhaps (cond (X (g y a)) (else (g y z))) -> (g y (if X a z))")
;  (lint-test "(cond ((not x) (cdr x)) (else (display y)))" " cond: x in (cdr x) should be a pair, but it is #f?")
  (lint-test "(cond ((pair? x) 3) ((eq? x 'a) 4) ((eq? x 'b) 5) ((eq? x 'c) 6))" 
	     " cond: perhaps (cond ((pair? x) 3) ((eq? x 'a) 4) ((eq? x 'b) 5) ((eq? x 'c) 6)) ->
                 (cond ((pair? x) 3) ((assq x '((a . 4) (b . 5) (c . 6))) => cdr))")
  (lint-test "(cond ((pair? x) 3) ((eq? x 'a) 4) ((eq? x 'b) 5) ((eq? x 'c) 6) (else #f))" 
	     " cond: perhaps (cond ((pair? x) 3) ((eq? x 'a) 4) ((eq? x 'b) 5) ((eq? x 'c) 6) (else #f)) ->
                 (cond ((pair? x) 3) ((assq x '((a . 4) (b . 5) (c . 6))) => cdr) (else #f))")
  (lint-test "(cond ((pair? x) 3) ((eq? x 'a) 4) ((eq? x 'b) 5) ((eq? x 'c) 6) ((eq? x 'd) 7))" 
	     " cond: perhaps (cond ((pair? x) 3) ((eq? x 'a) 4) ((eq? x 'b) 5) ((eq? x 'c) 6) ((eq? x... ->
                 (cond ((pair? x) 3) ((assq x '((a . 4) (b . 5) (c . 6) (d . 7))) => cdr))")
  (lint-test "(cond ((= i n) #f) ((pred? (vector-ref v i)) #t) (else (loop (+ 1 i))))" 
	     " cond: perhaps (cond ((= i n) #f) ((pred? (vector-ref v i)) #t) (else (loop (+ 1 i)))) ->
                 (and (not (= i n)) (or (pred? (vector-ref v i)) (loop (+ 1 i))))")
  (lint-test "(cond ((= i n) #f) ((pred? (vector-ref v i))) (else (loop (+ 1 i))))" 
	     " cond: perhaps (cond ((= i n) #f) ((pred? (vector-ref v i))) (else (loop (+ 1 i)))) ->
                 (and (not (= i n)) (or (pred? (vector-ref v i)) (loop (+ 1 i))))")
  (lint-test "(cond ((= i n) #t) ((pred? (vector-ref v i)) (loop (+ 1 i))) (else #f))" 
	     " cond: this #t could be omitted: ((= i n) #t)
               cond: perhaps (cond ((= i n) #t) ((pred? (vector-ref v i)) (loop (+ 1 i))) (else #f)) ->
                 (or (= i n) (and (pred? (vector-ref v i)) (loop (+ 1 i))))")
  (lint-test "(cond ((= i n)) ((pred? (vector-ref v i)) (loop (+ 1 i))) (else #f))" 
	     " cond: perhaps (cond ((= i n)) ((pred? (vector-ref v i)) (loop (+ 1 i))) (else #f)) ->
                 (or (= i n) (and (pred? (vector-ref v i)) (loop (+ 1 i))))")
  (lint-test "(cond (A #f) (B #t) (else C))" " cond: perhaps (cond (A #f) (B #t) (else C)) -> (and (not A) (or B C))")
  (lint-test "(cond (A #t) (B C) (else #f))" " cond: perhaps (cond (A #t) (B C) (else #f)) -> (or A (and B C))")
  (lint-test "(cond (A #f) (B) (else C))"    " cond: perhaps (cond (A #f) (B) (else C)) -> (and (not A) (or B C))")
  (lint-test "(cond (A) (B C) (else #f))"    " cond: perhaps (cond (A) (B C) (else #f)) -> (or A (and B C))")
  (lint-test "(cond ((getenv s) x) ((= y z) w))" " cond: cond test (getenv s) is never false: (cond ((getenv s) x) ((= y z) w))")
  (lint-test "(cond (A #f) (B #f))"          " cond: perhaps (cond (A #f) (B #f)) -> (if (or A B) #f)")
  (lint-test "(cond (A C) (B C))"            " cond: perhaps (cond (A C) (B C)) -> (if (or A B) C)")

  (lint-test "(cond ((and (pair? x) (pair? y) (pair? z)) 32) ((and (pair? x) (pair? y) (pair? w)) 12) ((and (pair? x) (pair? y) (pair? v)) 2))" 
	     " cond: perhaps 
    (cond ((and (pair? x) (pair? y) (pair? z)) 32) ((and (pair? x) (pair? y)... ->
    (cond ((not (and (pair? x) (pair? y))) #<unspecified>)
          ((pair? z) 32)
          ((pair? w) 12)
          ((pair? v) 2))")
  (lint-test "(cond ((and (pair? x) (pair? y) (pair? z)) 32) ((and (pair? x) (pair? w)) 12) ((pair? x) 2))"
	     " cond: perhaps 
    (cond ((and (pair? x) (pair? y) (pair? z)) 32) ((and (pair? x) (pair? w))... ->
    (cond ((not (pair? x)) #<unspecified>)
          ((and (pair? y) (pair? z)) 32)
          ((pair? w) 12)
          (else 2))")
  (lint-test "(cond ((pair? z) 32) ((and (pair? x) (pair? w)) 12) ((pair? x) 2))" 
	     " cond: perhaps 
    (cond ((pair? z) 32) ((and (pair? x) (pair? w)) 12) ((pair? x) 2)) ->
    (cond ((pair? z) 32) ((not (pair? x)) #<unspecified>) ((pair? w) 12) (else 2))")
  (lint-test "(cond ((pair? z) 32) ((and (pair? x) (pair? w)) 12) ((pair? x) 2) (else 0))" 
	     " cond: perhaps 
    (cond ((pair? z) 32) ((and (pair? x) (pair? w)) 12) ((pair? x) 2) (else 0)) ->
    (cond ((pair? z) 32) ((not (pair? x)) 0) ((pair? w) 12) (else 2))")
  (lint-test "(cond ((and x (pair? y)) 1) ((and x (string? y)) 2) ((and x (char? y)) 3) (else 4))" 
	     " cond: perhaps 
    (cond ((and x (pair? y)) 1) ((and x (string? y)) 2) ((and x (char? y)) 3)... ->
    (cond ((not x) 4) ((pair? y) 1) ((string? y) 2) ((char? y) 3) (else 4))")

  (lint-test "(cond ((= x y) 2) ((= x 2) #f) (else #t))" 
	     " cond: perhaps (cond ((= x y) 2) ((= x 2) #f) (else #t)) -> (cond ((= x y) 2) (else (not (= x 2))))")
  (lint-test "(cond ((= x y) 2) ((= x 2) #t) (else #f))" 
	     " cond: this #t could be omitted: ((= x 2) #t)
               cond: perhaps (cond ((= x y) 2) ((= x 2) #t) (else #f)) -> (cond ((= x y) 2) (else (= x 2)))")
  (lint-test "(cond ((not x) y) (else z))" " cond: perhaps (cond ((not x) y) (else z)) -> (if x z y)")
  (lint-test "(cond ((not x) (f z) y) (else z))" " cond: perhaps (cond ((not x) (f z) y) (else z)) -> (cond (x z) (else (f z) y))")
  (lint-test "(cond ((not x)) (else z))" " cond: perhaps (cond ((not x)) (else z)) -> (or (not x) z)")
  (lint-test "(cond ((not x)) (else (f y) z))" " cond: perhaps (cond ((not x)) (else (f y) z)) -> (or (not x) (begin (f y) z))")  

  (lint-test "(cond ((memq x y) z) (else (f x) z))" " cond: perhaps (cond ((memq x y) z) (else (f x) z)) -> (begin (if (not (memq x y)) (f x)) z)")
  (lint-test "(cond (x (f y) z) (else z))" " cond: perhaps (cond (x (f y) z) (else z)) -> (begin (if x (f y)) z)")
  (lint-test "(cond ((memq x y) (display y) z) (else (f x) z))" 
	     " cond: perhaps (cond ((memq x y) (display y) z) (else (f x) z)) -> (begin (if (memq x y) (display y) (f x)) z)")
  (lint-test "(cond (x (f y) z) (else (g y) (h y) z))" 
	     " cond: perhaps (cond (x (f y) z) (else (g y) (h y) z)) -> (begin (if x (f y) (begin (g y) (h y))) z)")
  (lint-test "(cond (x (f y) (g x) z) (else (g y) (h y) z))" 
	     " cond: perhaps (cond (x (f y) (g x) z) (else (g y) (h y) z)) -> (begin (if x (begin (f y) (g x)) (begin (g y) (h y))) z)")
  (lint-test "(cond (x (f y) (g x) z) (else z))" " cond: perhaps (cond (x (f y) (g x) z) (else z)) -> (begin (if x (begin (f y) (g x))) z)")
  (lint-test "(cond ((f x) (display y) z) ((h x) (f x) (display y) z) (else z))" 
	     " cond: perhaps (cond ((f x) (display y) z) ((h x) (f x) (display y) z) (else z)) ->
                (begin (cond ((f x) (display y)) ((h x) (f x) (display y))) z)")
  (lint-test "(let ((x 2)) (cond (A B) (C => (let ((y 4)) (lambda (n) (lambda (m) (+ n m x y)))))))" 
	     " let: perhaps move the let into the '(C => (let ((y 4)) (lambda (n) (lambda (m) (+ n m x y))))) branch: 
                (let ((x 2)) (cond (A B) (C => (let ((y 4)) (lambda (n) (lambda (m) (+ n m... ->
                (cond ... (C => (let ((x 2)) (let ((y 4)) (lambda (n) (lambda (m) (+ n m x y)))))) ...)")

  (lint-test "(cond (A a) (B b) (else (if C (c) (d)) #t))" 
	     " cond: else clause could be folded into the outer cond: 
                (cond (A a) (B b) (else (if C (c) (d)) #t)) -> (cond (A a) (B b) (C (c) #t) (else (d) #t))")
  (lint-test "(cond (A a) (B b) (else (if C (c)) #t))" 
	     " cond: else clause could be folded into the outer cond: 
                (cond (A a) (B b) (else (if C (c)) #t)) -> (cond (A a) (B b) (C (c) #t) (else #t))")
  (lint-test "(cond (A a) (B b) (else (cond (C (c)) (else (d))) #t))" 
	     " cond: else clause could be folded into the outer cond: 
                (cond (A a) (B b) (else (cond (C (c)) (else (d))) #t)) -> (cond (A a) (B b) (C (c) #t) (else (d) #t))
               cond: perhaps (cond (C (c)) (else (d))) -> ((cond (C c) (else d)))")
  (lint-test "(cond (A a) (B b) (else (cond (C (c)) (D (d))) #t))" 
	     " cond: else clause could be folded into the outer cond: 
                (cond (A a) (B b) (else (cond (C (c)) (D (d))) #t)) -> (cond (A a) (B b) (C (c) #t) (D (d) #t) (else #t))")
  (lint-test "(cond (A a) (B b) (else (when C (c) (d)) #t))" 
	     " cond: else clause could be folded into the outer cond: 
                (cond (A a) (B b) (else (when C (c) (d)) #t)) -> (cond (A a) (B b) (C (c) (d) #t) (else #t))")
  (lint-test "(cond (A a) (B b) (else (unless C (c) (d)) #t))" 
	     " cond: else clause could be folded into the outer cond: 
                (cond (A a) (B b) (else (unless C (c) (d)) #t)) -> (cond (A a) (B b) ((not C) (c) (d) #t) (else #t))")

  (lint-test "(begin (if (> x 1) (set! x y)) (if (> x 1) (display x)))" 
	     " begin: perhaps (... (if (> x 1) (set! x y)) (if (> x 1) (display x)) ...) -> (... (when (> x 1) (set! x y) (when (> x 1) (display x))) ...)")
  (lint-test "(begin (if (> x 1) (display x)) (if (> x 1) (set! x y)))" 
	     " begin: perhaps (... (if (> x 1) (display x)) (if (> x 1) (set! x y)) ...) -> (... (when (> x 1) (display x) (set! x y)) ...)")
  (lint-test "(cond ((> x 1) (set! x y)) ((> x 1) (display x)))" 
	     " cond: cond test (> x 1) is never true: (cond ((> x 1) (set! x y)) ((> x 1) (display x)))
               cond: cond test repeated: ((> x 1) (display x))
               cond: cond test is always false: ((> x 1) (display x))
               cond: perhaps (cond ((> x 1) (set! x y)) ((> x 1) (display x))) -> (cond ((> x 1) (set! x y)))")
  (lint-test "(cond (A (f x) => y))" " cond: '=> has no effect here: (A (f x) => y) cond: perhaps (cond (A (f x) => y)) -> (when A (f x) => y)")
	
  (lint-test "(when (and (< x 1) y) (if z (display z)))" 
	     " when: perhaps (when (and (< x 1) y) (if z (display z))) -> (when (and (< x 1) y z) (display z))")
  (lint-test "(when y (if z (display z)))" 
	     " when: perhaps (when y (if z (display z))) -> (when (and y z) (display z))")
  (lint-test "(when y (if (or (< x 1) z) (display z)))" 
	     " when: perhaps (when y (if (or (< x 1) z) (display z))) -> (when (and y (or (< x 1) z)) (display z))")
  (lint-test "(when (and (< x 1) y) (when z (display z) x))" 
	     " when: perhaps (when (and (< x 1) y) (when z (display z) x)) -> (when (and (< x 1) y z) (display z) x)")
  (lint-test "(unless (and (< x 1) y) (if z (display z)))" 
	     " unless: perhaps (unless (and (< x 1) y) (if z (display z))) -> (when (and (not (and (< x 1) y)) z) (display z))")
  (lint-test "(unless y (if z (display z)))" 
	     " unless: perhaps (unless y (if z (display z))) -> (when (and (not y) z) (display z))")
  (lint-test "(unless y (if (or (< x 1) z) (display z)))" 
	     " unless: perhaps (unless y (if (or (< x 1) z) (display z))) -> (when (and (not y) (or (< x 1) z)) (display z))")
  (lint-test "(unless (and (< x 1) y) (when z (display z) x))" 
	     " unless: perhaps (unless (and (< x 1) y) (when z (display z) x)) -> (when (and (not (and (< x 1) y)) z) (display z) x)")
  (lint-test "(unless (and (< x 1) y) (unless z (display z) x))" 
	     " unless: perhaps (unless (and (< x 1) y) (unless z (display z) x)) -> (unless (or (and (< x 1) y) z) (display z) x)")
  (lint-test "(when (< x 2) (cond ((= x 0) 1) ((negative? x) 2) (else 3)))" 
	     " when: perhaps (when (< x 2) (cond ((= x 0) 1) ((negative? x) 2) (else 3))) -> (cond ((>= x 2) #f) ((= x 0) 1) ((negative? x) 2) (else 3))")
  (lint-test "(unless (< x 2) (cond ((= x 0) 1) ((negative? x) 2) (else 3)))" 
	     " unless: perhaps (unless (< x 2) (cond ((= x 0) 1) ((negative? x) 2) (else 3))) -> (cond ((< x 2) #f) ((= x 0) 1) ((negative? x) 2) (else 3))")
  (lint-test "(unless (and x (not y)) (display z))"       " unless: perhaps (unless (and x (not y)) (display z)) -> (when (or (not x) y) ...)")
  (lint-test "(unless (and (not x) y) (display z))"       " unless: perhaps (unless (and (not x) y) (display z)) -> (when (or x (not y)) ...)")
  (lint-test "(unless (and (not x) (not y)) (display z))" " unless: perhaps (unless (and (not x) (not y)) (display z)) -> (when (or x y) ...)")
  (lint-test "(when (and (not x) (not y)) (display z))"   
	     " when: perhaps (when (and (not x) (not y)) (display z)) -> (unless (or x y) ...)
               when: perhaps (and (not x) (not y)) -> (not (or x y))")
  (lint-test "(when A (unless B (display C) (f D E)))" 
	     " when: perhaps (when A (unless B (display C) (f D E))) -> (when (and A (not B)) (display C) (f D E))")
  (lint-test "(unless A (when B (display C) (f D E)))" 
	     " unless: perhaps (unless A (when B (display C) (f D E))) -> (when (and (not A) B) (display C) (f D E))")
  (lint-test "(when A (unless (odd? B) (display C) (f D E)))" 
	     " when: perhaps (when A (unless (odd? B) (display C) (f D E))) -> (when (and A (even? B)) (display C) (f D E))")
  (lint-test "(unless (< x y) (cond ((A B) (C D) (else E))))"  
	     " unless: perhaps (unless (< x y) (cond ((A B) (C D) (else E)))) -> (cond ((< x y) #f) ((A B) (C D) (else E)))
               unless: perhaps (cond ((A B) (C D) (else E))) -> (when (A B) (C D) (else E))")
  (lint-test "(if (and (< x 1) y) (when z (display z) x))" 
	     " if: perhaps (if (and (< x 1) y) (when z (display z) x)) -> (when (and (< x 1) y z) (display z) x)")
  (lint-test "(if (and (< x 1) y) (unless z (display z) x))" 
	     " if: perhaps (if (and (< x 1) y) (unless z (display z) x)) -> (when (and (< x 1) y (not z)) (display z) x)")
  (lint-test "(let ((x (g y))) (when x (display x)) (when x (set! y x)))" 
	     " let: perhaps (... (when x (display x)) (when x (set! y x)) ...) -> (when x (display x) (set! y x))")
  (lint-test "(let ((x (g y))) (unless x (display x)) (unless x (set! y x)))" 
	     " let: perhaps (... (unless x (display x)) (unless x (set! y x)) ...) -> (unless x (display x) (set! y x))")
  (lint-test "(begin (and x (display y)) (log z))" " begin: perhaps (and x (display y)) -> (if x (display y))")
  (lint-test "(begin (or x (display y)) (log z))"  " begin: perhaps (or x (display y)) -> (if (not x) (display y))")
  (lint-test "(begin (if x #f (display y)) y)" 
	     " begin: this branch is pointless: #f in (if x #f (display y))
               begin: perhaps (if x #f (display y)) -> (unless x (display y))")
  (lint-test "(begin (if x (display y) #f) y)" 
	     " begin: this branch is pointless: #f in (if x (display y) #f)
               begin: perhaps (if x (display y) #f) -> (when x (display y))")
  (lint-test "(begin (if x #f (begin (display y) (read z))) y)" 
	     " begin: this branch is pointless: #f in (if x #f (begin (display y) (read z)))
               begin: perhaps (if x #f (begin (display y) (read z))) -> (unless x (display y) (read z))")
  (lint-test "(begin (if (not x) #f (begin (display y) (read z))) y)" 
	     " begin: this branch is pointless: #f in (if (not x) #f (begin (display y) (read z)))
               begin: perhaps (if (not x) #f (begin (display y) (read z))) -> (when x (display y) (read z))")

  (lint-test "(car (cons 1 2))"		" car: (car       (cons 1 2)) is the same as 1")
  (lint-test "(car (string->list x))"   " car: perhaps (car (string->list x)) -> (string-ref x 0)")
  (lint-test "(car (string->list (symbol->string x)))" " car: perhaps (car (string->list (symbol->string x))) -> (string-ref (symbol->string x) 0)")
  (lint-test "(set-car! (list-tail x y) z)" " set-car!: perhaps (set-car! (list-tail x y) z) -> (list-set! x y z)")
  (lint-test "(set-car! (cdr x) y)"     " set-car!: perhaps (set-car! (cdr x) y) -> (list-set! x 1 y)")
  (lint-test "(set-car! (cddr (cdddr x)) y)" " set-car!: perhaps (set-car! (cddr (cdddr x)) y) -> (list-set! x 5 y)")
  (lint-test "(begin (set-car! x (car y)) (set-cdr! x (cdr y)))" " begin: perhaps ...(set-car! x (car y)) (set-cdr! x (cdr y)) -> (copy y x)")
  (lint-test "(car (list-tail x y))"    " car: perhaps (car (list-tail x y)) -> (list-ref x y)")
  (lint-test "(car (list x y))"         " car: perhaps (car (list x y)) -> x")
  (lint-test "(car (append x y))"       " car: perhaps (car (append x y)) -> (car x)")
  (lint-test "(caddr (vector->list x))" " caddr: perhaps (caddr (vector->list x)) -> (vector-ref x 2)")
  (lint-test "(and x x y)"		" and: perhaps (and x x y) -> (and x y)")
  (lint-test "(or x x y)"		" or: perhaps (or x x y) -> (or x y)")
  (lint-test "(or x (or x y))"		" or: perhaps (or x (or x y)) -> (or x y)")
  (lint-test "(< x 1 2 0 y)"		" <: this comparison can't be true: (< x 1 2 0 y)")
  (lint-test "(< (- x y) 0)"            " <: perhaps (< (- x y) 0) -> (< x y)")
  (lint-test "(> (- (log x) (log y)) 0.0)" " >: perhaps (> (- (log x) (log y)) 0.0) -> (> (log x) (log y))")
  (lint-test "(< 0 (- x y))"            " <: perhaps (< 0 (- x y)) -> (> x y)")
  (lint-test "(> x (- y 1))"            "") ; only optimizable if x and y are known to be integers
  (lint-test "(< x 1 2 y)"		"")
  (lint-test "(< x 1 y)"		"")
  (lint-test "(< 0 (floor x) 1)"        " <: perhaps (< 0 (floor x) 1) -> #f")
  (lint-test "(< x x)"                  " <: this looks odd: (< x x)")
  (lint-test "(< x y x)"                " <: it looks odd to have repeated arguments in (< x y x) <: perhaps (< x y x) -> #f")
  (lint-test "(< x x y)"                " <: it looks odd to have repeated arguments in (< x x y) <: perhaps (< x x y) -> #f")
  (lint-test "(<= x x y z)"             " <=: it looks odd to have repeated arguments in (<= x x y z) <=: perhaps (<= x x y z) -> (= x y z)")
  (lint-test "(<= x y x z x)"           " <=: it looks odd to have repeated arguments in (<= x y x z x) <=: perhaps (<= x y x z x) -> (= x y z)")
  (lint-test "(<= x x x)"               " <=: it looks odd to have repeated arguments in (<= x x x) <=: perhaps (<= x x x) -> #t")
  (lint-test "(> x y z y)"              " >: it looks odd to have repeated arguments in (> x y z y) >: perhaps (> x y z y) -> #f")
  (lint-test "(char>? x #\\a #\\b y)"	" char>?: this comparison can't be true: (char>? x #\\a #\\b y)")
  (lint-test "(< (char->integer x) 95)" " <: perhaps (< (char->integer x) 95) -> (char<? x #\\_)")
  (lint-test "(>= (char->integer x) 90 (char->integer y))" " >=: perhaps (>= (char->integer x) 90 (char->integer y)) -> (char>=? x #\\Z y)")
  (lint-test "(> (abs x) -1)"           " >: abs can't be negative: (> (abs x) -1)")
  (lint-test "(or (= (denominator n) 1) (= (denominator n) 0))" 
	     " or: perhaps (or (= (denominator n) 1) (= (denominator n) 0)) -> (member (denominator n) '(1 0) =)
               or: perhaps (= (denominator n) 1) -> (integer? n)
               or: denominator is never 0: (= (denominator n) 0)")
  (lint-test "(or (> (denominator n) 0) (<= (denominator n) 0))" 
	     " or: perhaps (or (> (denominator n) 0) (<= (denominator n) 0)) -> #t
               or: denominator is always > than 0: (> (denominator n) 0)
               or: denominator is never <= than 0: (<= (denominator n) 0)")

  (lint-test "(string>? \"a\" x \"b\" y)" " string>?: this comparison can't be true: (string>? \"a\" x \"b\" y)")
  (lint-test "(copy (copy x))"		" copy: (copy (copy x)) could be (copy x)")
  (lint-test "(copy x x)"               " copy: (copy x x) is a no-op")
  (lint-test "(copy x x 0)"             " copy: (copy x x 0) is a no-op")
  (lint-test "(copy x y 1 0)"           " copy: these copy indices make no sense: (copy x y 1 0)")
  (lint-test "(copy x y 0 0)"           " copy: these copy indices make no sense: (copy x y 0 0)")

  (lint-test "(string-ref (symbol->string 'abs) 1)" 
	     " string-ref: perhaps (string-ref (symbol->string 'abs) 1) -> #\\b
               string-ref: perhaps (symbol->string 'abs) -> \"abs\"")
  (lint-test "(string-ref (substring x 1) 2)"       " string-ref: perhaps (string-ref (substring x 1) 2) -> (string-ref x (+ 2 1))")
  (lint-test "(string-ref (make-string 3 #\\a) 1)"  " string-ref: perhaps (string-ref (make-string 3 #\\a) 1) -> #\\a")
  (lint-test "(string-ref (round x) str)" 
	     " string-ref: in (string-ref (round x) str), string-ref's argument 1 should be a string, but (round x) is an integer?")
  (lint-test "(string-ref x (cons 1 2))" 
	     " string-ref: in (string-ref x (cons 1 2)), string-ref's argument 2 should be an integer, but (cons 1 2) is a pair?")
  (lint-test "(string-copy (string-copy x))" " string-copy: (string-copy (string-copy x)) could be (string-copy x)")

  (lint-test "(string-append x)"        " string-append: perhaps (string-append x) -> x, or use copy")
  (lint-test "(string-append \"\" \"\" x)" " string-append: perhaps (string-append \"\" \"\" x) -> x, or use copy")
  (lint-test "(string-append \"\" \"\")" " string-append: perhaps (string-append \"\" \"\") -> \"\"")
  (lint-test "(string-append \"\" (string-append x y) \"\")" " string-append: perhaps (string-append \"\" (string-append x y) \"\") -> (string-append x y)")
  (lint-test "(string-append \"123\" \"456\")" " string-append: perhaps (string-append \"123\" \"456\") -> \"123456\"")
  (lint-test "(string-append x (string-append y z))" " string-append: perhaps (string-append x (string-append y z)) -> (string-append x y z)")
  (lint-test "(string-append x \"a\" \"bc\" y)" " string-append: perhaps (string-append x \"a\" \"bc\" y) -> (string-append x \"abc\" y)")

  (lint-test "(vector-append)"	" vector-append: perhaps (vector-append) -> #()")
  (lint-test "(vector-append x)" " vector-append: perhaps (vector-append x) -> (copy x)")
  (lint-test "(vector-append #(1 2) (vector-append #(3)))"
	     " vector-append: perhaps (vector-append #(1 2) (vector-append #(3))) -> #(1 2 3)
               vector-append: #(1 2) could be #i(1 2)
               vector-append: #(3) could be #i(3)")
  (lint-test "(vector-append x (vector-append y z))" " vector-append: perhaps (vector-append x (vector-append y z)) -> (vector-append x y z)")
  (lint-test "(vector-append v1 (apply vector-append vs))" 
	     " vector-append: perhaps (vector-append v1 (apply vector-append vs)) -> (vector-append v1 (apply values vs))")

  (lint-test "(object->string (object->string x))" " object->string: (object->string (object->string x)) could be (object->string x)")
  (lint-test "(object->string x :else)" " object->string: bad second argument: :else")
  (lint-test "(display (format #f str x))" " display: perhaps (display (format #f str x)) -> (format () str x)")
  (lint-test "(display (apply format #f str x) p)" " display: perhaps (display (apply format #f str x) p) -> (apply format p str x)")

  (lint-test "(reverse (reverse x))"	" reverse: (reverse (reverse x)) could be (copy x)")
  (lint-test "(reverse (cdr (reverse x)))" " reverse: perhaps (reverse (cdr (reverse x))) -> (copy x (make-list (- (length x) 1)))")
  (lint-test "(reverse (cons x (reverse y)))" " reverse: perhaps (reverse (cons x (reverse y))) -> (append y (list x))")
  (lint-test "(reverse (list-tail (reverse slist) index))" 
	     " reverse: perhaps (reverse (list-tail (reverse slist) index)) -> (copy slist (make-list (- (length slist) index)))")
  (lint-test "(reverse (append (reverse b) res))" " reverse: perhaps (reverse (append (reverse b) res)) -> (append (reverse res) b)")
  (lint-test "(reverse (reverse! x))" " reverse: (reverse (reverse! x)) could be (copy x)")
  (lint-test "(reverse (string->list x))" " reverse: perhaps less consing: (reverse (string->list x)) -> (string->list (reverse x))")
  (lint-test "(reverse '(1 2 3))" " reverse: perhaps (reverse '(1 2 3)) -> '(3 2 1)")
  (lint-test "(reverse (sort! x <))" " reverse: possibly (reverse (sort! x <)) -> (sort! x >)")
  (lint-test "(reverse (map abs (sort! x <)))" " reverse: possibly (reverse (map abs (sort! x <))) -> (map abs (sort! x >))")

;  (lint-test "(let ((v (list 1 2))) (reverse! v) v)" "")
;  (lint-test "(let ((v1 (list 1 2))) (set! v1 (reverse! v1)))" "")

  (lint-test "(vector->list (list->vector x))"   " vector->list: (vector->list (list->vector x)) could be (copy x)")
  (lint-test "(string->number (number->string x))" " string->number: (string->number (number->string x)) could be x")
  (lint-test "(string->number \"123\" 21)"       " string->number: string->number radix should be between 2 and 16: (string->number \"123\" 21)")
  (lint-test "(string->number (string num-char))" 
	     " string->number: perhaps (string->number (string num-char)) -> (- (char->integer num-char) (char->integer #\\0))")
  (lint-test "(string->number (or (f x) \"4\"))" " string->number: perhaps (string->number (or (f x) \"4\")) -> (cond ((f x) => string->number) (else 4))")
  (lint-test "(length (string->list x))"         " length: perhaps (length (string->list x)) -> (length x)")
  (lint-test "(length (vector->list x))"         " length: perhaps (length (vector->list x)) -> (length x)")
  (lint-test "(length (vector->list x 1))"       " length: perhaps (length (vector->list x 1)) -> (- (length x) 1)")
  (lint-test "(length (vector->list x 1 3))"     " length: perhaps (length (vector->list x 1 3)) -> 2")
  (lint-test "(length (vector->list x y 3))"     " length: perhaps (length (vector->list x y 3)) -> (- 3 y)") 
  (lint-test "(list->string (vector->list x))"   " list->string: perhaps (list->string (vector->list x)) -> (copy x (make-string (length x)))")
  (lint-test "(list->vector (string->list x))"   " list->vector: perhaps (list->vector (string->list x)) -> (copy x (make-vector (length x)))")
  (lint-test "(vector->list (make-vector 3 #f))" " vector->list: perhaps (vector->list (make-vector 3 #f)) -> (make-list 3 #f)")
  (lint-test "(list->vector (make-list 3 #f))"   " list->vector: perhaps (list->vector (make-list 3 #f)) -> (make-vector 3 #f)")
  (lint-test "(list->string (reverse x))"        " list->string: perhaps (list->string (reverse x)) -> (reverse (list->string x))")
  (lint-test "(define (getservent) (getserv))"   " getservent: (define (getservent) (getserv)) could probably be (define getservent getserv)")
  (lint-test "(< (char->integer key) 256)"       " <: perhaps (< (char->integer key) 256) -> #t")
  (lint-test "(require \"repl.scm\")"            " require: in s7, require's arguments should be symbols: (require \"repl.scm\")")
  (lint-test "(list-ref (cddr f) (- (length f) 3))" " list-ref: perhaps (list-ref (cddr f) (- (length f) 3)) -> (list-ref f (- (length f) 1))")
  (lint-test "(list-ref (cdddr f) 2)"            " list-ref: perhaps (list-ref (cdddr f) 2) -> (list-ref f 5)")
  (lint-test "(list-ref (cdr f) (- len 1))"      " list-ref: perhaps (list-ref (cdr f) (- len 1)) -> (list-ref f len)")

  (lint-test "(list->vector (reverse (vector->list x)))" 
	     " list->vector: perhaps (list->vector (reverse (vector->list x))) -> (reverse x)
               list->vector: perhaps less consing: (reverse (vector->list x)) -> (vector->list (reverse x))")
  (lint-test "(list->vector (reverse! (vector->list x)))" 
	     " list->vector: perhaps (list->vector (reverse! (vector->list x))) -> (reverse x)
               list->vector: perhaps less consing: (reverse! (vector->list x)) -> (vector->list (reverse x))")
  (lint-test "(list->vector (copy (vector->list x)))" " list->vector: perhaps (list->vector (copy (vector->list x))) -> (copy x)")
  (lint-test "(list->string (reverse (string->list (substring str 1))))" 
	     " list->string: perhaps (list->string (reverse (string->list (substring str 1)))) -> (reverse (substring str 1))
               list->string: perhaps less consing: (reverse (string->list (substring str 1))) -> (string->list (reverse (substring str 1)))")
  (lint-test "(list->string (cdr (string->list x)))" " list->string: perhaps (list->string (cdr (string->list x))) -> (substring x 1)")
  (lint-test "(list->vector (list-tail (vector->list x) y))"
	     " list->vector: perhaps (list->vector (list-tail (vector->list x) y)) -> (copy x (make-vector (- (length x) y))) ")
  (lint-test "(string->list \"123\")" " string->list: perhaps (string->list \"123\") -> '(#\\1 #\\2 #\\3)")
  (lint-test "(list->vector '(1 2 3))" " list->vector: perhaps (list->vector '(1 2 3)) -> #(1 2 3)")
  (lint-test "(list->vector (cons x '()))" 
	     " list->vector: perhaps (list->vector (cons x '())) -> (vector x)
               list->vector: perhaps (cons x '()) -> (list x)
               list->vector: quote is not needed here: '()")
  (lint-test "(list->vector (list x y z))" " list->vector: perhaps (list->vector (list x y z)) -> (vector x y z)")
  (lint-test "(list->vector (append (vector->list x) (vector->list y)))" 
	     " list->vector: perhaps (list->vector (append (vector->list x) (vector->list y))) -> (append x y)
               list->vector: perhaps (append (vector->list x) (vector->list y)) -> (vector->list (append x y))")
  (lint-test "(list->string '(#\\a #\\b #\\c))" " list->string: perhaps (list->string '(#\\a #\\b #\\c)) -> \"abc\"")
  (lint-test "(list->string (cons x '()))" 
	     " list->string: perhaps (list->string (cons x '())) -> (string x)
               list->string: perhaps (cons x '()) -> (list x)
               list->string: quote is not needed here: '()")
  (lint-test "(list->string (list x y z))" " list->string: perhaps (list->string (list x y z)) -> (string x y z)")
  (lint-test "(list->vector (sort! (vector->list x) y))" " list->vector: perhaps (list->vector (sort! (vector->list x) y)) -> (sort! x y)")
  (lint-test "(list->string (sort! (string->list x) y))" " list->string: perhaps (list->string (sort! (string->list x) y)) -> (sort! x y)")
  (lint-test "(string->list x y y)" " string->list: these string->list indices make no sense: (string->list x y y)")
  (lint-test "(symbol->keyword (string->symbol x))" " symbol->keyword: perhaps (symbol->keyword (string->symbol x)) -> (string->keyword x)")
  (lint-test "(vector->list (vector a b c))" " vector->list: perhaps (vector->list (vector a b c)) -> (list a b c)")
  (lint-test "(vector->list (vector-copy v start end))" " vector->list: perhaps (vector->list (vector-copy v start end)) -> (vector->list v start end)")
  (lint-test "(string->list (string a b c))"  " string->list: perhaps (string->list (string a b c)) -> (list a b c)")
  (lint-test "(list->string (list a b c))" " list->string: perhaps (list->string (list a b c)) -> (string a b c)")
  (lint-test "(list->string (make-list a b))" " list->string: perhaps (list->string (make-list a b)) -> (make-string a b)")

  (lint-test "(string->symbol (string-append x y z))" " string->symbol: perhaps (string->symbol (string-append x y z)) -> (symbol x y z)")
  (lint-test "(string->symbol (apply string-append x))" " string->symbol: perhaps (string->symbol (apply string-append x)) -> (apply symbol x)")
  (lint-test "(string->symbol (if (null? x) \"abc\" x))" 
	     " string->symbol: perhaps (string->symbol (if (null? x) \"abc\" x)) -> (if (null? x) 'abc (string->symbol x))")
  (lint-test "(string->symbol (if (not (null? x)) x \"abc\"))" 
	     " string->symbol: perhaps (string->symbol (if (not (null? x)) x \"abc\")) -> (if (not (null? x)) (string->symbol x) 'abc)")
  (lint-test "(string->symbol (if (null? x) \"abc\" \"x\"))"
	     " string->symbol: perhaps (string->symbol (if (null? x) \"abc\" \"x\")) -> (if (null? x) 'abc 'x)")

  (lint-test "(equal? x (list 1 2))"                              " equal?: perhaps (list 1 2) -> '(1 2)")
  (lint-test "(equal? x (list (list 1 2) (list 3 4)))"            " equal?: perhaps (list (list 1 2) (list 3 4)) -> '((1 2) (3 4))")
  (lint-test "(equal? x (vector (list 1 2) (list 3 4)))"          " equal?: perhaps (vector (list 1 2) (list 3 4)) -> #((1 2) (3 4))")
  (lint-test "(equal? x (list (vector 1 2) (list 3 (list 4 5))))" " equal?: perhaps (list (vector 1 2) (list 3 (list 4 5))) -> '(#(1 2) (3 (4 5)))")

  (lint-test "(car (reverse x))"    " car: perhaps use 'last from srfi-1, or (car (reverse x)) -> (list-ref x (- (length x) 1))")
  (lint-test "(caddr (reverse! x))" " caddr: perhaps (caddr (reverse! x)) -> (list-ref x (- (length x) 3))")

  (lint-test "(append 3)"		" append: perhaps (append 3) -> 3")
  (lint-test "(append)"			" append: perhaps (append) -> ()")
  (lint-test "(append (append))"	" append: perhaps (append (append)) -> ()")
  (lint-test "(append '(1) (append '(2)))" 
	     " append: append does not copy its last argument, so (append '(1) (append '(2))) is dangerous
               append: perhaps (append '(1) (append '(2))) -> (list 1 2)")
  (lint-test "(append x (append))"	" append: perhaps clearer: (append x (append)) -> (copy x)")
  (lint-test "(append '(1 2) (list))"   " append: perhaps clearer: (append '(1 2) (list)) -> (copy '(1 2)) append: perhaps (list) -> (); there is only one nil")
  (lint-test "(append x '())"		" append: perhaps clearer: (append x '()) -> (copy x)  append: quote is not needed here: '()")
  (lint-test "(append '(1) (append 2))" " append: perhaps (append '(1) (append 2)) -> (cons 1 2)")
  (lint-test "(append '(1) (append '(2) '(3)) '(4))" 
	     " append: append does not copy its last argument, so (append '(1) (append '(2) '(3)) '(4)) is dangerous
               append: perhaps (append '(1) (append '(2) '(3)) '(4)) -> (list 1 2 3 4)")
  (lint-test "(append (list x y) (list z))" " append: perhaps (append (list x y) (list z)) -> (list x y z)")
  (lint-test "(append '(1 2) (list 3))" " append: perhaps (append '(1 2) (list 3)) -> (list 1 2 3)")
  (lint-test "(append '(1) '(2 3))"     
	     " append: append does not copy its last argument, so (append '(1) '(2 3)) is dangerous
               append: perhaps (append '(1) '(2 3)) -> (list 1 2 3)")
  (lint-test "(append '(x) '((+ 1 2) #(a)))" 
	     " append: append does not copy its last argument, so (append '(x) '((+ 1 2) #(a))) is dangerous
               append: perhaps (append '(x) '((+ 1 2) #(a))) -> (list 'x '(+ 1 2) #(a))")
             ;; (equal? (list 'x '(+ 1 2) #(a)) (append '(x) '((+ 1 2) #(a)))) -> #t
  (lint-test "(append (list x) (list y z) (list 1))" " append: perhaps (append (list x) (list y z) (list 1)) -> (list x y z 1)")
  (lint-test "(append (list x y) '(z))" 
	     " append: append does not copy its last argument, so (append (list x y) '(z)) is dangerous
               append: perhaps (append (list x y) '(z)) -> (list x y 'z)")
  (lint-test "(append (list x) y)"      " append: perhaps (append (list x) y) -> (cons x y)")
  (lint-test "(append (list x) (list y z))" " append: perhaps (append (list x) (list y z)) -> (list x y z)")
  (lint-test "(append () '(1 2) 1)"	" append: perhaps (append () '(1 2) 1) -> (append '(1 2) 1)")
  (lint-test "(append '() (append) (list 1) (list) () (list 2) ())" 
	     " append: perhaps (append '() (append) (list 1) (list) () (list 2) ()) -> (list 1 2) 
               append: quote is not needed here: '()
               append: perhaps (list) -> (); there is only one nil")
  (lint-test "(append x y (append))"    " append: perhaps (append x y (append)) -> (append x y ())")
  (lint-test "(append x y ())"          "")
  (lint-test "(append (list x) y (list z))" " append: perhaps (append (list x) y (list z)) -> (cons x (append y (list z)))")
  (lint-test "(append x (list y) z)"    " append: perhaps (append x (list y) z) -> (append x (cons y z))")
  (lint-test "(append '(x) y)"          " append: perhaps (append '(x) y) -> (cons 'x y)")
  (lint-test "(append '(0) y)"          " append: perhaps (append '(0) y) -> (cons 0 y)")
  (lint-test "(begin (set! x (append x y)) (set! x (append x z w)))" 
	     " begin: perhaps (set! x (append x y)) (set! x (append x z w)) -> (set! x (append x y z w))")
  (lint-test "(append x (copy y) z)" " append: perhaps (append x (copy y) z) -> (append x y z)")
  (lint-test "(append x (copy y))" "")
  (lint-test "(append (cons x y) z)" " append: perhaps (append (cons x y) z) -> (cons x (append y z))")
  (lint-test "(append (list x y) (list z))" " append: perhaps (append (list x y) (list z)) -> (list x y z)")
  (lint-test "(append (list x y) (cons z ()))" 
	     " append: perhaps (append (list x y) (cons z ())) -> (list x y z)
               append: perhaps (cons z ()) -> (list z)")
  (lint-test "(append (list w) (list x y) (list z))" " append: perhaps (append (list w) (list x y) (list z)) -> (list w x y z)")
  (lint-test "(append (list w) (list x y) (cons z ()))" 
	     " append: perhaps (append (list w) (list x y) (cons z ())) -> (list w x y z)
               append: perhaps (cons z ()) -> (list z)")
  (lint-test "(append (cons x ()) (list y w z))" 
	     " append: perhaps (append (cons x ()) (list y w z)) -> (list x y w z)
               append: perhaps (cons x ()) -> (list x)")
  (lint-test "(append (cons a ()) c)" 
	     " append: perhaps (append (cons a ()) c) -> (cons a c)
               append: perhaps (cons a ()) -> (list a)")
  (lint-test "(append (list a b) (cons c d))" " append: perhaps (append (list a b) (cons c d)) -> (cons a (cons b (cons c d)))")
  (lint-test "(append (apply append x) y)" " append: perhaps (append (apply append x) y) -> (append (apply values x) y)")
  (lint-test "(append (cons x y) z w)" " append: perhaps (append (cons x y) z w) -> (cons x (append y z w))")

  (lint-test "(cons x (list y z))"      " cons: perhaps (cons x (list y z)) -> (list x y z)")
  (lint-test "(cons x (list))"          " cons: perhaps (cons x (list)) -> (list x)  cons: perhaps (list) -> (); there is only one nil")
  (lint-test "(cons 1 ())"              " cons: perhaps (cons 1 ()) -> (list 1)")
  (lint-test "(cons a (cons b (cons c ())))" " cons: perhaps (cons a (cons b (cons c ()))) -> (list a b c)")
  (lint-test "(cons a (cons b (list c)))"    " cons: perhaps (cons a (cons b (list c))) -> (list a b c)")
  (lint-test "(cons a (cons b (list c d)))"  " cons: perhaps (cons a (cons b (list c d))) -> (list a b c d)")
  (lint-test "(cons a (cons b c))" "")
  (lint-test "(cons a (cons b (cons c '())))" " cons: perhaps (cons a (cons b (cons c '()))) -> (list a b c) cons: quote is not needed here: '()")
  (lint-test "(cons (car x) (cdr x))"     " cons: possibly (cons (car x) (cdr x)) -> (copy x)")
  (lint-test "(cons (cadar x) (cddar x))" " cons: possibly (cons (cadar x) (cddar x)) -> (copy (cdar x))")
  (lint-test "(set! x (cons a (list)))" " set!: perhaps (cons a (list)) -> (list a) set!: perhaps (list) -> (); there is only one nil")
  (lint-test "(set! x (cons a (list b c)))" " set!: perhaps (cons a (list b c)) -> (list a b c)")
  (lint-test "(set! x (cons a (cons b (list c d))))" " set!: perhaps (cons a (cons b (list c d))) -> (list a b c d)")
  (lint-test "(set! x (cons a (cons b ())))" " set!: perhaps (cons a (cons b ())) -> (list a b)")
  (lint-test "(cons 'x (or y (list 'z)))" "") ; quote for list here is incorrect

  (lint-test "`(,@x ,@(map (lambda (z) `(,z ,@z)) y))" 
	     " list-values: perhaps (list-values (apply-values x) (apply-values (map (lambda (z) (list-values... -> (append x (map (lambda (z) (cons z z)) y))
               list-values: perhaps (list-values z (apply-values z)) -> (cons z z)")
  (lint-test "`(,@x ,@(map (lambda (z) `(,@z ,@z)) y))"
	     " list-values: perhaps (list-values (apply-values x) (apply-values (map (lambda (z) (list-values... -> (append x (map (lambda (z) (append z z)) y))
               list-values: perhaps (list-values (apply-values z) (apply-values z)) -> (append z z)")
  (lint-test "`(,@x ,@(map (lambda (z) `(,@z ,@z ,@x)) y))" 
	     " list-values: perhaps (list-values (apply-values z) (apply-values z) (apply-values x)) -> (append z z x)")
  (lint-test "(append `(,x) z)" " append: perhaps (append (list x) z) -> (cons x z) append: perhaps (list-values x) -> (list x)")
  (lint-test "(values `(x ,@y))"    
	     " values: perhaps (values (list-values 'x (apply-values y))) -> (cons 'x y)
               values: perhaps (list-values 'x (apply-values y)) -> (cons 'x y)")
  (lint-test "(values `(x ,y) a)"   " values: perhaps (values (list-values 'x y) a) -> (values (list 'x y) a) values: perhaps (list-values 'x y) -> (list 'x y)")
  (lint-test "(values `(,x ,@y) z)" 
	     " values: perhaps (values (list-values x (apply-values y)) z) -> (values (cons x y) z)
               values: perhaps (list-values x (apply-values y)) -> (cons x y)")
  (lint-test "(values `(,@x ,@y) `(,x z))"
	     " values: perhaps (values (list-values (apply-values x) (apply-values y)) (list-values x 'z)) -> (values (append x y) (list x 'z))
               values: perhaps (list-values (apply-values x) (apply-values y)) -> (append x y)
               values: perhaps (list-values x 'z) -> (list x 'z)")
  (lint-test "(define (g x) `(+ ,y ,@(map f x)))" " g: perhaps (list-values '+ y (apply-values (map f x))) -> (cons '+ (cons y (map f x)))")
  (lint-test "(define (g x) `(+ ,@(map f x)))" " g: perhaps (list-values '+ (apply-values (map f x))) -> (cons '+ (map f x))")
  (lint-test "(define (g x) `(,e ,@(map f x)))" " g: perhaps (list-values e (apply-values (map f x))) -> (cons e (map f x))")
  (lint-test "(define (g x) `(f ,@x ,@y))" " g: perhaps (list-values 'f (apply-values x) (apply-values y)) -> (cons 'f (append x y))")
  (lint-test "(define (g x) `(display ,(map f x)))" " g: perhaps (list-values 'display (map f x)) -> (list 'display (map f x))")
  (lint-test "(define-macro (g x) `(f ,x))" 
	     " define-macro: perhaps (define-macro (g x) (list-values 'f x)) -> (define g f)
               g: perhaps (list-values 'f x) -> (list 'f x)")
  (lint-test "(define-macro (g x) `(,@x ,y))" " g: perhaps (list-values (apply-values x) y) -> (append x (list y))")
  (lint-test "(define-macro (g x) `(,@x z))"  " g: perhaps (list-values (apply-values x) 'z) -> (append x (list 'z))")
  (lint-test "(define-macro (g x) `(,@x ,(f y)))" " g: perhaps (list-values (apply-values x) (f y)) -> (append x (list (f y)))")
  (lint-test "(define-macro (g x) `(+ ,y ,@(map f x)))" " g: perhaps (list-values '+ y (apply-values (map f x))) -> (cons '+ (cons y (map f x)))")
  (lint-test "(define-macro (g x) `(,@x ,y ,@z))" " g: perhaps (list-values (apply-values x) y (apply-values z)) -> (append x (cons y z))")
  (lint-test "(define-macro (g x) `(,@x ,@y ,z))" " g: perhaps (list-values (apply-values x) (apply-values y) z) -> (append x y (list z))")
  (lint-test "(define f `((cond . ,forced-indent) (case . ,print-case) (let . ,let-expr)))" 
             " f: perhaps (list-values (append (list-values 'cond) forced-indent) (append... -> (list (cons 'cond forced-indent) (cons 'case print-case) ...)
               f: perhaps (append (list 'cond) forced-indent) -> (cons 'cond forced-indent)")
  (lint-test "(define f `((cond . ,forced-indent) (let . ,let-expr)))" 
	     " f: perhaps (list-values (append (list-values 'cond) forced-indent) (append... -> (list (cons 'cond forced-indent) (cons 'let let-expr))
               f: perhaps (append (list 'cond) forced-indent) -> (cons 'cond forced-indent)")
  (lint-test "(set! x `(f . (,g . 100)))" 
	     " set!: perhaps (append (list 'f g) 100) -> (cons 'f (cons g 100))
               set!: perhaps (list-values 'f g) -> (list 'f g)")
  (lint-test "(set! x `(f . (g . 100)))"  
	     " set!: perhaps (append (list 'f 'g) 100) -> (cons 'f (cons 'g 100))
               set!: perhaps (list-values 'f 'g) -> (list 'f 'g)")
  (lint-test "(set! x `(f . g))" 
	     " set!: perhaps (append (list 'f) 'g) -> (cons 'f 'g)
               set!: perhaps (list-values 'f) -> (list 'f)")
  (lint-test "(set! x `((f . (,g . 100)) (f1 . (,g1 . 1001))))" 
	     " set!: perhaps (list-values (append (list-values 'f g) 100) (append (list-values 'f1 g1)... -> (list (cons 'f (cons g 100)) (cons 'f1 (cons g1 1001)))
               set!: perhaps (append (list 'f g) 100) -> (cons 'f (cons g 100))")
  (lint-test "(set! x `((f . (g . 100)) (f1 . (g1 . 1001))))"
	     " set!: perhaps (list-values (append (list-values 'f 'g) 100) (append (list-values 'f1... -> (list (cons 'f (cons 'g 100)) (cons 'f1 (cons 'g1 1001)))
               set!: perhaps (append (list 'f 'g) 100) -> (cons 'f (cons 'g 100))")

  (lint-test "(sort! x abs)"		" sort!: abs is a questionable sort! function")
  (lint-test "(sort! x (lambda (a b) (< a b)))" " sort!: perhaps (lambda (a b) (< a b)) -> <")
  (lint-test "(sort! x (lambda (a b) (< b a)))" " sort!: perhaps (lambda (a b) (< b a)) -> >")
  (lint-test "(abs 1 2)"		" abs: abs has too many arguments: (abs 1 2)")
  (lint-test "(-)"			" -: - needs at least 1 argument: (-)")
  (lint-test "(modulo 3)"		" modulo: modulo needs 2 arguments: (modulo 3)")

  (lint-test "(let () (define* (f1 a b) (+ a b)) (f1 :c 1))" 
	     " let: perhaps (... (define* (f1 a b) (+ a b)) (f1 :c 1)) -> (... (let ((a :c) (b 1)) (+ a b)))
               let: f1 keyword argument :c (in (f1 :c 1)) does not match any argument in (a b)
               let: in (f1 :c 1), f1's argument 1 should be a number, but :c is a keyword?")
  (lint-test "(let () (define (f2 a b) (+ a b)) (f2 1 2 3))" 
	     " let: perhaps (... (define (f2 a b) (+ a b)) (f2 1 2 3)) -> (... (let ((a 1) (b 2)) (+ a b)))
               f2: leaving aside +'s optional args, f2 could be (define f2 +)
               let: f2 has too many arguments: (f2 1 2 3)")
  (lint-test "(let () (define* (f3 a . b) (+ a b)) (f3 1 2 3))" "")
  (lint-test "(let () (define* (f4 (a #f)) a) (f4))" 
	      " let: perhaps (... (define* (f4 (a #f)) a) (f4)) -> (... (let ((a #f)) a))
                f4: the default argument value is #f in define*, so (a #f) can be a")
  (lint-test "(let () (define (f1 a) a) 32)" " let: f1 not used, value: (define (f1 a) a)")

  (lint-test "(letrec ((f1 (lambda (a) a))) 32)"  
	     " letrec: letrec could be let: (letrec ((f1 (lambda (a) a))) 32)
               letrec: f1 not used, initially: (lambda (a) a) from letrec")
  (lint-test "(letrec ((x 32) (f1 (let ((y 1)) (lambda (z) (+ x y z)))) (f2 (f1 x))) (+ x f2))" 
	     " letrec: in (letrec ((x 32) (f1 (let ((y 1)) (lambda (z) (+ x y z)))) (f2 (f1 x))) (+..., 
                 letrec should be letrec* because x is used in f2's value (not a function): (f1 x)")
  (lint-test "(letrec* ((f1 (lambda (x) (+ x (f2 x)))) (f2 (lambda (x) (+ x (f1 x))))) (+ (f1 2) (f2 1)))" 
	     " letrec*: letrec* could be letrec: (letrec* ((f1 (lambda (x) (+ x (f2 x)))) (f2 (lambda (x) (+ x (f1 x)))))...")
  ;; test shadowing checks
  (lint-test "(letrec ((f1 (lambda (x) (* x (f1 2))))) (lambda (y) (+ y (f1 y))))" 
	     " letrec: perhaps (letrec ((f1 (lambda (x) (* x (f1 2))))) (lambda (y) (+ y (f1 y)))) -> (lambda (y) (+ y (let f1 ((x y)) (* x (f1 2)))))")
  (lint-test "(letrec ((f1 (lambda (x) (* x z (f1 2))))) (lambda (y) (let ((z 3)) (+ y (f1 y)))))" 
	     " letrec: z can be moved to the enclosing function's closure")
  (lint-test "(letrec ((f1 (lambda (x) (* x z (f1 2))))) (lambda (y) (let* ((z 3)) (+ y (f1 y)))))" 
	     " letrec: let* could be let: (let* ((z 3)) (+ y (f1 y)))")
  (lint-test "(letrec ((f1 (lambda (x) (* x z (f1 2))))) (lambda (y) (letrec ((z 3)) (+ y (f1 y)))))" 
	     " letrec: letrec could be let: (letrec ((z 3)) (+ y (f1 y)))")
  (lint-test "(letrec ((f1 (lambda (x) (* x z (f1 2))))) (lambda (y) (do ((z 3)) () (+ y (f1 y)))))" "")
  (lint-test "(letrec ((f1 (lambda (x) (* x z (f1 2))))) (lambda (y) (lambda (z) (+ y (f1 y)))))" "")
  (lint-test "(letrec ((f1 (lambda (x z) (* x z (f1 2))))) (lambda (y) (let ((z (g 3))) (+ z (f1 y)))))" 
	     " letrec: perhaps (letrec ((f1 (lambda (x z) (* x z (f1 2))))) (lambda (y) (let ((z (g 3)))... ->
                 (lambda (y) (let ((z (g 3))) (+ z (let f1 ((x y)) (* x z (f1 2))))))")

  (lint-test "(let () (define x 3) 32)" 
	     " let: x not used, initially: 3 from define
               let: perhaps (let () (define x 3) 32) -> (let ((x 3)) ...)")
  (lint-test "(let ((z 1)) (define x 12) (define (y a) a) 32)" 
	     " let: perhaps (... (define x 12) (define (y a) a) 32) -> (... (let ((x 12)) ...))
               let: y not used, value: (define (y a) a)
               let: x not used, initially: 12 from define
               let: z not used, initially: 1 from let
               let: perhaps (let ((z 1)) (define x 12) (define (y a) a) 32) -> (let ((z 1) (x 12)) ...)")
  (lint-test "(let ((z 1)) (define x 12) (define (y a) a) (+ z 32))" 
	     " let: perhaps (... (define x 12) (define (y a) a) (+ z 32)) -> (... (let ((x 12)) ...))
               let: y not used, value: (define (y a) a)
               let: x not used, initially: 12 from define
               let: perhaps (let ((z 1)) (define x 12) (define (y a) a) (+ z 32)) -> (let ((z 1) (x 12)) ...)")
  (lint-test "(let* ((a 1) (b 2) (c (+ a 1))) (* c 2))" 
	     " let*: b not used, initially: 2 from let*
               let*: perhaps restrict a which is not used in the let* body (let* ((a 1) (b 2) (c (+ a 1))) (* c 2)) -> (let* ((b 2) (c (let ((a 1)) (+ a 1)))) ...)
               let*: perhaps split this let*: (let* ((a 1) (b 2) (c (+ a 1))) (* c 2)) -> (let ((a 1) (b 2)) (let ((c (+ a 1))) ...))
               let*: perhaps (let* ((a 1) (b 2) (c (+ a 1))) (* c 2)) -> (let* ((a 1) (b 2)) (* (+ a 1) 2))")
  (lint-test "(let () (define (f4 a . b) (+ a b)) (f4))" " let: f4 needs 1 argument: (f4)")
  (lint-test "(let ((a)) #f)" " let: let variable value is missing? (a)")
  (lint-test "(let ((a . 1)) #f)"	" let: let binding is an improper list? (a . 1)")
  (lint-test "(let ((a 1) . b) a)"      " let: let is messed up: (let ((a 1) . b) a)")
  (lint-test "(let ((1 2)) #f)"		" let: let variable is not a symbol? (1 2)")
  (lint-test "(let ((pi 2)) #f)"	" let: can't bind a constant: (pi 2)")
  (lint-test "(let ((:a 1)) :a)"        " let: let variable is a keyword? (:a 1) let: perhaps (let ((:a 1)) :a) -> 1")
  (lint-test "(let ((a 2) (a 3)) a)"	" let: let variable a is declared twice let: a not used, initially: 2 from let")
  (lint-test "(let (a) a)"		" let: let is messed up: (let (a) a)")
  (lint-test "(let ((a 1) (set! a 2)))" " let: let is messed up:  (let ((a 1) (set! a 2)))")
  (lint-test "(let ((a 1)) (set! a 2))" 
	     " let: a set, but not used: (set! a 2)
               let: perhaps (let ((a 1)) (set! a 2)) -> 2
               let: set! is pointless in (set! a 2): use 2")
  (lint-test "(let ((a 1) (b (display 2))) (set! a 2))" 
	     " let: b not used, initially: (display 2) from let
               let: a set, but not used: (set! a 2)
               let: perhaps (let ((a 1) (b (display 2))) (set! a 2)) -> (let ((b (display 2))) 2)
               let: set! is pointless in (set! a 2): use 2")
  (lint-test "(let ((a 1)) #f)"		" let: a not used, initially: 1 from let")
  (lint-test "(let :x ((i y)) (x i))"	" let: bad let name: :x")
  (lint-test "(let xx () z)"		
	     " let: perhaps (let xx () z) -> z
               let: xx not used, value: (let xx () z)")
  (lint-test "(let ((x (log y))) x)"    " let: perhaps (let ((x (log y))) x) -> (log y)")
  (lint-test "(let* ((x (log y))) x)"   " let*: let* could be let: (let* ((x (log y))) x) let*: perhaps (let* ((x (log y))) x) -> (log y)")
  (lint-test "(let* ((y 3) (x (log y))) x)" 
	     " let*: perhaps restrict y which is not used in the let* body (let* ((y 3) (x (log y))) x) -> (let ((x (let ((y 3)) (log y)))) ...)
	       let*: perhaps substitute y into x: (let* ((y 3) (x (log y))) x) -> (let ((x (log 3))) ...)
               let*: perhaps (let* ((y 3) (x (log y))) x) -> (let ((y 3)) (log y))")
  (lint-test "(let ((y 3) (x (log z))) x)" " let: y not used, initially: 3 from let")
  (lint-test "(let* ((z 3) (y z) (x (log y))) x)" 
	     " let*: perhaps restrict z, y which are not used in the let* body 
                (let* ((z 3) (y z) (x (log y))) x) -> (let ((x (let ((y (let ((z 3)) z))) (log y)))) ...)
	       let*: perhaps substitute z into y: (let* ((z 3) (y z) (x (log y))) x) -> (let* ((y 3) (x (log y))) ...)
               let*: perhaps (let* ((z 3) (y z) (x (log y))) x) -> (let* ((z 3) (y z)) (log y))")
  (lint-test "(let* ((x 1) (x (+ x 1))) x)"
	     " let*: let* variable x is declared twice
               let*: perhaps (let* ((x 1) (x (+ x 1))) x) -> (let ((x 1)) (+ x 1))")
  (lint-test "(let* ((x 1) (x (+ y 1))) x)" 
	     " let*: let* could be let: (let* ((x 1) (x (+ y 1))) x)
               let*: let* variable x is declared twice
               let*: x not used, initially: 1 from let*
               let*: perhaps (let* ((x 1) (x (+ y 1))) x) -> (let ((x 1)) (+ y 1))")
  (lint-test "(let* ((a 1) (b (+ a 2))) (let* ((c (+ b 3)) (d (+ c 4))) (+ a b c d)))" 
	     " let*: perhaps (let* ((c (+ b 3)) (d (+ c 4))) (+ a b c d)) -> (let ((c (+ b 3))) (+ a b c (+ c 4)))
               let*: perhaps (let* ((a 1) (b (+ a 2))) (let* ((c (+ b 3)) (d (+ c 4))) (+ a b c d))) -> 
                 (let* ((a 1) (b (+ a 2)) (c (+ b 3)) (d (+ c 4))) (+ a b c d))")
  (lint-test "(let* ((a 1) (b (+ a 2))) (let* ((c (+ b 3)) (d (+ c 4))) (display a) (+ a b c d)))" 
	     " let*: perhaps (let* ((a 1) (b (+ a 2))) (let* ((c (+ b 3)) (d (+ c 4))) (display a) (+ a... ->
                 (let* ((a 1) (b (+ a 2)) (c (+ b 3)) (d (+ c 4))) (display a) ...)")
  (lint-test "(let* ((a 1) (b (+ a 1))) b)" 
	     " let*: perhaps restrict a which is not used in the let* body (let* ((a 1) (b (+ a 1))) b) -> (let ((b (let ((a 1)) (+ a 1)))) ...)
	       let*: perhaps substitute a into b: (let* ((a 1) (b (+ a 1))) b) -> (let ((b (+ 1 1))) ...)
               let*: perhaps (let* ((a 1) (b (+ a 1))) b) -> (let ((a 1)) (+ a 1))")
  (lint-test "(let* ((a 1) (b (+ a 1))) (+ a b))" " let*: perhaps (let* ((a 1) (b (+ a 1))) (+ a b)) -> (let ((a 1)) (+ a (+ a 1)))")
  (lint-test "(let ((x (assoc y z))) (if x (cdr x)))"  
	     " let: perhaps (let ((x (assoc y z))) (if x (cdr x))) -> (cond ((assoc y z) => cdr))")
  (lint-test "(let ((x (assoc y z))) (if x (cdr x) 32))" 
	     " let: perhaps (let ((x (assoc y z))) (if x (cdr x) 32)) -> (cond ((assoc y z) => cdr) (else 32))")
  (lint-test "(let ((x (f y))) (and x (g x)))" " let: perhaps (let ((x (f y))) (and x (g x))) -> (cond ((f y) => g) (else #f))")
  (lint-test "(let ((x (f y))) (and x (g x)))" " let: perhaps (let ((x (f y))) (and x (g x))) -> (cond ((f y) => g) (else #f))")
  (lint-test "(let ((x (f y))) (or (not x) (g x)))" " let: perhaps (let ((x (f y))) (or (not x) (g x))) -> (cond ((f y) => g) (else #t))")
  (lint-test "(let* ((x (f y))) (and x (g x)))" 
	     " let*: let* could be let: (let* ((x (f y))) (and x (g x)))
               let*: perhaps (let* ((x (f y))) (and x (g x))) -> (cond ((f y) => g) (else #f))")
  (lint-test "(let* ((x (f y))) (or (not x) (g x)))" 
	     " let*: let* could be let: (let* ((x (f y))) (or (not x) (g x)))
               let*: perhaps (let* ((x (f y))) (or (not x) (g x))) -> (cond ((f y) => g) (else #t))")
  (lint-test "(let* ((x (log 2)) (y (+ x 1))) (display y))" 
	     " let*: perhaps restrict x which is not used in the let* body 
                  (let* ((x (log 2)) (y (+ x 1))) (display y)) -> (let ((y (let ((x (log 2))) (+ x 1)))) ...)
                let*: perhaps substitute x into y: (let* ((x (log 2)) (y (+ x 1))) (display y)) -> (let ((y (+ (log 2) 1))) ...)
                let*: perhaps (let* ((x (log 2)) (y (+ x 1))) (display y)) -> (let ((x (log 2))) (display (+ x 1)))")
  (lint-test "(let* ((z 1) (w (read p)) (v (read p)) (y (+ z w)) (x (< y 3))) (if x (f x)))" 
	     " let*: v not used, initially: (read p) from let*
               let*: perhaps restrict z, y which are not used in the let* body 
                  (let* ((z 1) (w (read p)) (v (read p)) (y (+ z w)) (x (< y 3))) (if x (f x))) ->
                  (let* ((w (read p)) (v (read p)) (x (let ((y (let ((z 1)) (+ z w)))) (< y 3)))) ...)
               let*: perhaps substitute y into x: 
                  (let* ((z 1) (w (read p)) (v (read p)) (y (+ z w)) (x (< y 3))) (if x (f x))) ->
                  (let* ((z 1) (w (read p)) (v (read p)) (x (< (+ z w) 3))) ...)
               let*: perhaps (let* ((z 1) (w (read p)) (v (read p)) (y (+ z w)) (x (< y 3))) (if x (f x))) ->
                  (let* ((z 1) (w (read p)) (v (read p)) (y (+ z w))) (cond ((< y 3) => f)))")
  (lint-test "(let* ((z 1) (w (read p)) (y (+ z w)) (x (< y 3))) (if x (f x)))" 
	     " let*: perhaps restrict z, w, y which are not used in the let* body 
                 (let* ((z 1) (w (read p)) (y (+ z w)) (x (< y 3))) (if x (f x))) -> 
                 (let ((x (let ((y (let* ((w (read p)) (z 1)) (+ z w)))) (< y 3)))) ...)
               let*: perhaps substitute w into y: 
                 (let* ((z 1) (w (read p)) (y (+ z w)) (x (< y 3))) (if x (f x))) ->
                 (let* ((z 1) (y (+ z (read p))) (x (< y 3))) ...)
               let*: perhaps (let* ((z 1) (w (read p)) (y (+ z w)) (x (< y 3))) (if x (f x))) ->
                  (let* ((z 1) (w (read p)) (y (+ z w))) (cond ((< y 3) => f)))")
  (lint-test "(let* ((a (car x)) (b (+ a 1))) (do ((i 0 (+ i 1))) ((= i b)) (display i)))" 
	     " let*: perhaps restrict a which is not used in the let* body 
                 (let* ((a (car x)) (b (+ a 1))) (do ((i 0 (+ i 1))) ((= i b)) (display i))) -> (let ((b (let ((a (car x))) (+ a 1)))) ...)
               let*: perhaps (let* ((a (car x)) (b (+ a 1))) (do ((i 0 (+ i 1))) ((= i b)) (display i))) -> (let ((a (car x))) (do ((b (+ a 1)) (i 0 (+ i 1))) ...))
               let*: perhaps substitute a into b: (let* ((a (car x)) (b (+ a 1))) (do ((i 0 (+ i 1))) ((= i b)) (display i))) -> (let ((b (+ (car x) 1))) ...)")
  (lint-test "(let ((x (f y))) (if x (g x) x))" 
	     " let: perhaps (let ((x (f y))) (if x (g x) x)) -> (cond ((f y) => g) (else #f))
               let: perhaps (if x (g x) x) -> (and x (g x))")
  (lint-test "(let ((x (assoc y z))) (if (pair? x) (g x) x))" 
	     " let: perhaps (let ((x (assoc y z))) (if (pair? x) (g x) x)) -> (cond ((assoc y z) => g) (else #f))")
  (lint-test "(let ((x (assoc y z))) (if (null? x) (g x)))" 
	     " let: in (if (null? x) (g x)), x can't be null because assoc in (x (assoc y z)) only returns #f or a pair")
  (lint-test "(let ((x (g y))) (if x x (g z)))" 
	     " let: perhaps (let ((x (g y))) (if x x (g z))) -> (or (g y) (g z))
               let: perhaps (if x x (g z)) -> (or x (g z))")
  (lint-test "(let ((x (g y))) (if x #t #f))" " let: perhaps (let ((x (g y))) (if x #t #f)) -> (g y) let: perhaps (if x #t #f) -> x")
  (lint-test "(let ((x (g y))) (if x (car (cddr x)) z))" 
	     " let: perhaps (let ((x (g y))) (if x (car (cddr x)) z)) -> (cond ((g y) => caddr) (else z))
               let: perhaps (car (cddr x)) -> (caddr x)")
  (lint-test "(let ((x (f y))) (if (not x) y (g x)))" 
	     " let: perhaps (let ((x (f y))) (if (not x) y (g x))) -> (cond ((f y) => g) (else y))
               let: perhaps use case: (let ((x (f y))) (if (not x) y (g x))) -> (case (f y) ((#f) y) (else => g))")
  (lint-test "(let ((x (f y))) (cond (x (g x))))" 
             " let: perhaps (let ((x (f y))) (cond (x (g x)))) -> (cond ((f y) => g))
               let: perhaps use => here: (x (g x)) -> (x => g)")
  (lint-test "(let ((x (f y))) (cond (x (g x)) (else y)))" 
	     " let: perhaps (let ((x (f y))) (cond (x (g x)) (else y))) -> (cond ((f y) => g) (else y))
               let: perhaps use => here: (x (g x)) -> (x => g)")
  (lint-test "(let ((x (f y))) (cond (x x) (else y)))" 
	     " let: perhaps (let ((x (f y))) (cond (x x) (else y))) -> (or (f y) y)
               let: no need to repeat the test: (x x) -> (x)")
  (lint-test "(let ((x (f y))) (cond (x x) (else (g y) y)))" 
	     " let: perhaps (let ((x (f y))) (cond (x x) (else (g y) y))) -> (or (f y) (begin (g y) y))
               let: no need to repeat the test: (x x) -> (x)")
  (lint-test "(let ((x (f y))) (cond (x (g x)) (y z) (else y)))"
	     " let: perhaps (let ((x (f y))) (cond (x (g x)) (y z) (else y))) -> (cond ((f y) => g) (y z) (else y))
               let: perhaps use => here: (x (g x)) -> (x => g)")
  (lint-test "(let ((x (f y))) (cond (x (set-cdr! x y)) (else y)))" 
	     " in (cond (x (set-cdr! x y)) (else y)), perhaps change x to (pair? x)")
  (lint-test "(let () (let ((a x)) (+ a 1)))" 
	     " let: pointless let: (let () (let ((a x)) (+ a 1)))
               let: perhaps (let () (let ((a x)) (+ a 1))) -> (let ((a x)) (+ a 1))
               let: perhaps (let ((a x)) (+ a 1)) -> (+ x 1)
               let: assuming we see all set!s, the binding (a x) is pointless: perhaps (let ((a x)) (+ a 1)) -> (+ x 1)")
  (lint-test "(let ((a x)) (let () (+ a 1)))" 
	     " let: pointless let: (let ((a x)) (let () (+ a 1))) -> (let ((a x)) (+ a 1))
               let: perhaps (let ((a x)) (let () (+ a 1))) -> (let () (+ x 1))
               let: pointless let: (let () (+ a 1))
               let: perhaps (let () (+ a 1)) -> (+ a 1)
               let: assuming we see all set!s, the binding (a x) is pointless: perhaps (let ((a x)) (let () (+ a 1))) -> (let () (+ x 1))")
  (lint-test "(let ((x 32)) (define x 33) x)" 
	     " let: perhaps omit x and return 33
               let: let variable x is redefined in the let body.  Perhaps use set! instead: (set! x 33)
               let: x not used, initially: 32 from let")
  (lint-test "(let ((x 32)) (define (x y) (+ y 33)) (x 1))" 
	     " let: perhaps (... (define (x y) (+ y 33)) (x 1)) -> (... (let ((y 1)) (+ y 33)))
               let: let variable x is declared twice
               let: x not used, initially: 32 from let")
  (lint-test "(let ((x (assq 'a y))) (set! z (if x (cadr x) 0)))" 
	     " let: perhaps (let ((x (assq 'a y))) (set! z (if x (cadr x) 0))) -> (set! z (cond ((assq 'a y) => cadr) (else 0)))")
  (lint-test "(let ((x (assq 'a y))) (g (if x (cadr x) 0) y))" 
	      " let: perhaps (let ((x (assq 'a y))) (g (if x (cadr x) 0) y)) -> (g (cond ((assq 'a y) => cadr) (else 0)) y)")
  (lint-test "(let ((x (assq 'a y))) (g (if x (cadr x)) y))" 
	     " let: perhaps (let ((x (assq 'a y))) (g (if x (cadr x)) y)) -> (g (cond ((assq 'a y) => cadr)) y)")
  (lint-test "(let ((x 1) (y 2) (z 3)) (+ x y z))"  " let: perhaps (let ((x 1) (y 2) (z 3)) (+ x y z)) -> (+ 1 2 3)")
  (lint-test "(let ((x 1)) (set! y x))" " let: perhaps (let ((x 1)) (set! y x)) -> (set! y 1)")
  (lint-test "(let ((x (f 0)) (y (f 1))) (or x y))" 
	     " let: perhaps, ignoring short-circuit issues, (let ((x (f 0)) (y (f 1))) (or x y)) -> (or (f 0) (f 1))")
  (lint-test "(let ((x (undo-edit))) (set! y (or y x)))" 
	     " let: perhaps, ignoring short-circuit issues, (let ((x (undo-edit))) (set! y (or y x))) -> (set! y (or y (undo-edit)))
               let: perhaps (set! y (or y x)) -> (if (not y) (set! y x))")
  (lint-test "(let ((x #(0 a))) (fill! x 1) (f x (x 1)))" 
	     " let: perhaps (let ((x #(0 a))) (fill! x 1) (f x (x 1))) -> (let ((x #(1 1))) (f x (x 1)))")
  (lint-test "(let ((x (make-vector 3))) (fill! x 1) (f x (x 1)))" 
	     " let: perhaps (let ((x (make-vector 3))) (fill! x 1) (f x (x 1))) -> (let ((x (make-vector 3 1))) (f x (x 1)))")
  (lint-test "(let ((x (make-list 3 9))) (fill! x 1) (f x (x 1)))" 
	     " let: perhaps (let ((x (make-list 3 9))) (fill! x 1) (f x (x 1))) -> (let ((x (make-list 3 1))) (f x (x 1)))")
  (lint-test "(let ((v (make-vector 3))) (vector-fill! v 3))" 
	     " let: perhaps (let ((v (make-vector 3))) (vector-fill! v 3)) -> (vector-fill! (make-vector 3) 3)
               let: perhaps (let ((v (make-vector 3))) (vector-fill! v 3)) -> (let () 3)")

  (lint-test "(let ((x 1)) (set! x 2) (+ x 1))" 
	     " let: perhaps (let ((x 1)) (set! x 2) (+ x 1)) -> (let ((x 2)) (+ x 1))")
  (lint-test "(let ((y 3) (x 1)) (set! x 2) (+ x y))" 
	     " let: perhaps (let ((y 3) (x 1)) (set! x 2) (+ x y)) -> (let ((y 3) (x 2)) (+ x y))")
  (lint-test "(let ((y 3) (x 1)) (set! x 2) (display x) (+ x y))" 
	     " let: perhaps (let ((y 3) (x 1)) (set! x 2) (display x) (+ x y)) -> (let ((y 3) (x 2)) (display x) ...)")

  (lint-test "(let ((x (f y))) (if x (g x) (set! x 3)))" "") ; too complicated to deal with this
  (lint-test "(let* ((x (f y))) (if x (g x) (set! x 3)))" " let*: let* could be let: (let* ((x (f y))) (if x (g x) (set! x 3)))")
  (lint-test "(let* ((z 1) (x (< z 2))) (if x (f x)))" 
	     " let*: perhaps restrict z which is not used in the let* body (let* ((z 1) (x (< z 2))) (if x (f x))) -> (let ((x (let ((z 1)) (< z 2)))) ...)
	       let*: perhaps substitute z into x: (let* ((z 1) (x (< z 2))) (if x (f x))) -> (let ((x (< 1 2))) ...)
               let*: perhaps (let* ((z 1) (x (< z 2))) (if x (f x))) -> (let ((z 1)) (cond ((< z 2) => f)))")
  (lint-test "(let* ((z 1) (y (+ z 2)) (x (< y 3))) (if x (f x)))" 
	     " let*: perhaps restrict z, y which are not used in the let* body 
                 (let* ((z 1) (y (+ z 2)) (x (< y 3))) (if x (f x))) -> (let ((x (let ((y (let ((z 1)) (+ z 2)))) (< y 3)))) ...)
	       let*: perhaps substitute z into y: (let* ((z 1) (y (+ z 2)) (x (< y 3))) (if x (f x))) -> (let* ((y (+ 1 2)) (x (< y 3))) ...)
               let*: perhaps (let* ((z 1) (y (+ z 2)) (x (< y 3))) (if x (f x))) -> (let* ((z 1) (y (+ z 2))) (cond ((< y 3) => f)))")
  (lint-test "(let f0 ((i 1)) (if (> i 0) (f0 #() (- i 1))))" " let: f0 has too many arguments: (f0 #() (- i 1))")
  (lint-test "(letrec ((f0 (lambda (i) (if (> i 0) (f0 #() (- i 1)))))) (f0 1))" 
	     " letrec: perhaps (letrec ((f0 (lambda (i) (if (> i 0) (f0 #() (- i 1)))))) (f0 1)) -> (let f0 ((i 1)) (if (> i 0) (f0 #() (- i 1))))")
  (lint-test "(letrec ((f0 (lambda () (if (> i 0) (f0))))) (f0))" 
	     " letrec: perhaps (letrec ((f0 (lambda () (if (> i 0) (f0))))) (f0)) -> (let f0 () (if (> i 0) (f0)))")
  (lint-test "(let ((a 0)) (display x) (set! a 2) (+ a 1))" 
	     " let: perhaps change a's initial value to 2, and remove (set! a 2) in (let ((a 0)) (display x) (set! a 2) (+ a 1))")
  (lint-test "(let ((x (string->number z))) (if (number? x) (g x)))" 
	     " let: perhaps (let ((x (string->number z))) (if (number? x) (g x))) -> (cond ((string->number z) => g))")
  (lint-test "(let ((x (memq a z))) (if (list? x) (g x)))" 
	     " let: in (if (list? x) (g x)), x can't be null so pair? might be better
               let: perhaps (let ((x (memq a z))) (if (list? x) (g x))) -> (cond ((memq a z) => g))")

  (lint-test "(let () (error 'oops \"an error\") #t)" 
	     " let: let could be begin: (let () (error 'oops \"an error\") #t) -> (begin (error 'oops \"an error\") #t)
               let: (error 'oops \"an error\") makes this pointless: #t")
  (lint-test "(let () (error 'oops \"an error\") (display \"oops\") #t)" 
	     " let: let could be begin: (let () (error 'oops \"an error\") (display \"oops\") #t) -> (begin (error 'oops \"an error\") (display \"oops\") #t)
               let: (error 'oops \"an error\") makes the rest of the body unreachable: (... (display \"oops\") ...)")
  (lint-test "(let ((a 1)) (let ((b 2)) (let ((c 3)) (let ((d 4)) (+ a b c d)))))" 
	     " let: perhaps (let ((d 4)) (+ a b c d)) -> (+ a b c 4)
               let: perhaps move 'c into the inner let: (let ((c 3)) (let ((d 4)) (+ a b c d))) -> (let ((c 3) (d 4)) (+ a b c d))
               let: perhaps (let ((c 3)) (let ((d 4)) (+ a b c d))) -> (let ((c 3) (d 4)) (+ a b c d))
               let: perhaps move 'b into the inner let: (let ((b 2)) (let ((c 3)) (let ((d 4)) (+ a b c d)))) -> (let ((b 2) (d 4)) (+ a b c d))
               let: perhaps (let ((b 2)) (let ((c 3)) (let ((d 4)) (+ a b c d)))) -> (let ((b 2) (c 3) (d 4)) (+ a b c d))
               let: perhaps move 'a into the inner let: (let ((a 1)) (let ((b 2)) (let ((c 3)) (let ((d 4)) (+ a b c d))))) -> (let ((a 1) (d 4)) (+ a b c d))
               let: perhaps (let ((a 1)) (let ((b 2)) (let ((c 3)) (let ((d 4)) (+ a b c d))))) -> (let ((a 1) (b 2) (c 3) (d 4)) (+ a b c d))")
  (lint-test "(let ((a 1)) (let ((b 2)) (let ((c 3) (d 4)) (display a) (+ b c d))))" 
	     " let: perhaps move 'b into the inner let: (let ((b 2)) (let ((c 3) (d 4)) (display a) (+ b c d))) -> (let ((b 2) (c 3) (d 4)) (display a) (+ b c d))
 	       let: perhaps (let ((b 2)) (let ((c 3) (d 4)) (display a) (+ b c d))) -> (let ((b 2) (c 3) (d 4)) (display a) ...)
               let: perhaps move 'a into the inner let: (let ((a 1)) (let ((b 2)) (let ((c 3) (d 4)) (display a) (+ b c d)))) -> (let ((a 1) (c 3) (d 4)) (display a) (+ b c d))
               let: perhaps (let ((a 1)) (let ((b 2)) (let ((c 3) (d 4)) (display a) (+ b c d)))) -> (let ((a 1) (b 2) (c 3) (d 4)) (display a) ...)")
  (lint-test "(let ((a 1) (b 2)) (let ((c 3) (d 4)) (display a) (+ b c d)))" 
	     " let: perhaps move 'b into the inner let: (let ((a 1) (b 2)) (let ((c 3) (d 4)) (display a) (+ b c d))) -> (let ((b 2) (c 3) (d 4)) (display a) (+ b c d))
               let: perhaps move 'a into the inner let: (let ((a 1) (b 2)) (let ((c 3) (d 4)) (display a) (+ b c d))) -> (let ((a 1) (c 3) (d 4)) (display a) (+ b c d))
               let: perhaps (let ((a 1) (b 2)) (let ((c 3) (d 4)) (display a) (+ b c d))) -> (let ((a 1) (b 2) (c 3) (d 4)) (display a) ...)")
  (lint-test "(let ((x 1) (y x)) (+ x y))" 
	     " let: x in (y x) does not appear to be defined in the calling environment
               let: perhaps (let ((x 1) (y x)) (+ x y)) -> (+ 1 x)
               let: assuming we see all set!s, the binding (y x) is pointless: perhaps (let ((x 1) (y x)) (+ x y)) -> (let ((x 1)) (+ x x))")
  (lint-test "(let ((x 3)) (+ x (let ((x 1) (y x)) (+ x y))))" 
	     " let: x in (y x) refers to the caller's x, not the let variable
               let: perhaps (let ((x 1) (y x)) (+ x y)) -> (+ 1 x)
               let: assuming we see all set!s, the binding (y x) is pointless: perhaps (let ((x 1) (y x)) (+ x y)) -> (let ((x 1)) (+ x x))")
  (lint-test "(let ((x 0)) (define* (f52 (a 2)) (if (zero? a) x (f52 (- a 1)))) (display x) (if (zero? x) (+ 1 (f52 x))))" 
	     " let: perhaps (... (define* (f52 (a 2)) (if (zero? a) x (f52 (- a 1)))) (display x) (if... ->
                  (... (display x) (if (zero? x) (+ 1 (let* f52 ((a x)) (if (zero? a) x (f52 (- a 1)))))))
               f52: perhaps (define* (f52 (a 2)) (if (zero? a) x (f52 (- a 1)))) -> (define* (f52 (a 2)) (do ((a a (- a 1))) ((zero? a) x)))
               let: x is 0, so (zero? x) is #t")
  (lint-test "(let ((x 0)) (define (f52) (if (zero? a) x (f52))) (f52))" 
	     " let: perhaps (... (define (f52) (if (zero? a) x (f52))) (f52)) -> (... (let f52 () (if (zero? a) x (f52))))
               x is used only in f52")
  (lint-test "(let ((x 0)) (define (f52 x) (if (zero? a) x (f52 x))) (f52 x))" 
	     " let: the inner function f52 could be moved to an outer letrec: 
                 (let ((x 0)) (define (f52 x) (if (zero? a) x (f52 x))) (f52 x)) -> (letrec ((f52 (lambda (x) (if (zero? a) x (f52 x))))) (let ((x 0)) ...))
               let: perhaps (... (define (f52 x) (if (zero? a) x (f52 x))) (f52 x)) -> (... (let f52 ((x x)) (if (zero? a) x (f52 x))))
               f52: perhaps (define (f52 x) (if (zero? a) x (f52 x))) -> (define (f52 x) (do ((x x)) ((zero? a) x)))")
  (lint-test "(let ((x 0)) (define* (f52 (a 2)) (if (zero? a) x (f52 (- a 1)))) (if (zero? x) (+ 1 (f52 x))))" 
	     " let: perhaps (... (define* (f52 (a 2)) (if (zero? a) x (f52 (- a 1)))) (if (zero? x) (+... ->
                 (... (if (zero? x) (+ 1 (let* f52 ((a x)) (if (zero? a) x (f52 (- a 1)))))))
               f52: perhaps (define* (f52 (a 2)) (if (zero? a) x (f52 (- a 1)))) -> (define* (f52 (a 2)) (do ((a a (- a 1))) ((zero? a) x)))
               let: x is 0, so (zero? x) is #t")
  (lint-test "(define (f x) (let ((y 2)) (set! x (+ x y)) (set! y (+ y 1)) (set! x (+ x 1)) (display x)))" 
	     " f: (set! y (+ y 1)) in (let ((y 2)) (set! x (+ x y)) (set! y (+ y 1)) (set! x (+ x 1)) (display x)) could be omitted
               f: this let could be tightened:
     (let ((y 2)) (set! x (+ x y)) (set! y (+ y 1)) (set! x (+ x 1)) (display x)) ->
     (let ((y 2))
       (set! x (+ x y))
       (set! y (+ y 1)))
     (set! x (+ x 1)) ...")
  
  (lint-test "(define (f a) (let ((x 1) (y 2) (z (vector 3))) (vector-set! z 0 (+ x 1)) (display y) (newline) (+ y (vector-ref z 0))))"
	     " f: y can probably be moved to f's closure
               f: x can be moved to f's closure
               f: x is only used in expression 1 (of 4), (vector-set! z 0 (+ x 1)) of
                 (let ((x 1) (y 2) (z (vector 3))) (vector-set! z 0 (+ x 1)) (display y)...
               f: the scope of x could be reduced: 
    (let ((x 1) (y 2) (z (vector 3))) (vector-set! z 0 (+ x 1)) (display y)... ->
    (let ((y 2)
          (z (vector 3)))
      (let ((x 1))
        (vector-set! z 0 (+ x 1)))
      (display y)
      ...)")
  (lint-test "(define (f a) (let ((x 1) (y 2) (z (vector 3 4))) (vector-set! z 0 (+ x 1)) (display (vector-ref z x)) (set! y (+ y 1)) (newline) (+ y 1)))" 
	     "f: x can be moved to f's closure
              f: x is only used in expressions 1 and 2 (of 5), (vector-set! z 0 (+ x 1)) (display (vector-ref z x)) of
                 (let ((x 1) (y 2) (z (vector 3 4))) (vector-set! z 0 (+ x 1)) (display...
              f: the scope of x, z could be reduced: 
    (let ((x 1) (y 2) (z (vector 3 4))) (vector-set! z 0 (+ x 1)) (display... ->
    (let ((y 2))
      (let ((x 1)
            (z (vector 3 4)))
        (vector-set! z 0 (+ x 1))
        (display (vector-ref z x)))
      (set! y (+ y 1))
      ...)")
  (lint-test "(define (f a) (let* ((x 1) (y (+ x 2)) (z (vector 3))) (vector-set! z 0 (+ x 1)) (display y) (newline) (+ y x)))"
	     "f: perhaps split this let*: (let* ((x 1) (y (+ x 2)) (z (vector 3))) (vector-set! z 0 (+ x 1))... ->
                 (let ((x 1)) (let ((y (+ x 2)) (z (vector 3))) ...))
	      f: the scope of z could be reduced: 
    (let* ((x 1) (y (+ x 2)) (z (vector 3))) (vector-set! z 0 (+ x 1))... ->
    (let* ((x 1)
           (y (+ x 2)))
      (let ((z (vector 3)))
        (vector-set! z 0 (+ x 1)))
      (display y)
      ...)")
  (lint-test "(define (f x) (let ((y #f)) (set! z (+ z 1)) (display z) (f z) (if z? (begin (set! y (g x)) (display y)))))" 
	     " f: y is only used in expression 4 (of 4),
                  (if z? (begin (set! y (g x)) (display y))) of
                (let ((y #f)) (set! z (+ z 1)) (display z) (f z) (if z? (begin (set! y (g...")
  (lint-test "(define (f x) (let* ((z x) (y #f)) (set! z (+ z 1)) (display z) (f z) (if z? (begin (set! y (g x)) (display y)))))" 
	     " f: let* could be let: (let* ((z x) (y #f)) (set! z (+ z 1)) (display z) (f z) (if z? (begin...
               f: y is only used in expression 4 (of 4),
                  (if z? (begin (set! y (g x)) (display y))) of
                (let* ((z x) (y #f)) (set! z (+ z 1)) (display z) (f z) (if z? (begin...")

  (lint-test "(let ((x (f y))) (g (car x)) (h (caar x)) (j (caddar x)))" 
	     " let: x is not set, and is always accessed via (car x) so its binding could probably be 
                 (x (car (f y))) in (let ((x (f y))) (g (car x)) (h (caar x)) (j (caddar x)))")
  (lint-test "(let ((x (f y))) (g (cddar x)) (h (caar x)) (j (caddar x)))" 
	     " let: x is not set, and is always accessed via (car x) so its binding could probably be 
                 (x (car (f y))) in (let ((x (f y))) (g (cddar x)) (h (caar x)) (j (caddar x)))")
  (lint-test "(let ((x 2)) (g (+ x x)) (h (+ x x)) (j (+ x x)))" 
	     " let: x is not set, and is always accessed via (+ x x) so its binding could probably be 
                 (x (+ 2 2)) in (let ((x 2)) (g (+ x x)) (h (+ x x)) (j (+ x x)))")
  (lint-test "(let ((x 2)) (g (< 0 x 1)) (h (> 1 x 0)) (j (< 0 x 1)))" 
	     " let: x is not set, and is always accessed via (< 0 x 1) so its binding could probably be (x (< 0 2 1)) in 
                 (let ((x 2)) (g (< 0 x 1)) (h (> 1 x 0)) (j (< 0 x 1)))")
  (lint-test "(let ((x (f y))) (g (cddr x)) (h (caar x)) (j (caddar x)))" "")
  (lint-test "(let ((x (f y))) (g (cddar x)) (h (caadr x)) (j (caddar x)))" "")
  (lint-test "(let ((x (f y))) (g (abs (car x))) (h (caar x)) (j (caddar x)))" 
	     " let: x is not set, and is always accessed via (car x) so its binding could probably be (x (car (f y))) in 
                 (let ((x (f y))) (g (abs (car x))) (h (caar x)) (j (caddar x)))")

  (lint-test "(let ((a (car x))) (if b (display (g a b))))" 
	     " let: perhaps move the let to the true branch: 
                 (let ((a (car x))) (if b (display (g a b)))) -> (if b (let ((a (car x))) (display (g a b))))")
  (lint-test "(let ((a (car x))) (if b (+ a (f a)) (display c)))" 
	     " let: perhaps move the let to the true branch: 
                 (let ((a (car x))) (if b (+ a (f a)) (display c))) -> (if b (let ((a (car x))) (+ a (f a))) (display c))")
  (lint-test "(let ((a (car x))) (if b (begin (display x) (+ a (f a))) (display c)))"
	     " let: perhaps move the let to the true branch: 
                 (let ((a (car x))) (if b (begin (display x) (+ a (f a))) (display c))) -> (if b (let ((a (car x))) (display x) (+ a (f a))) (display c))")
  (lint-test "(let ((a (car x))) (when b (display (g a b))))" 
	     " let: perhaps move the let inside the when: (let ((a (car x))) (when b (display (g a b)))) -> (when b (let ((a (car x))) (display (g a b))))")
  (lint-test "(let ((a (car x))) (cond (b (display (g a b))) (else (set! y z) (display x))))" 
	     " let: perhaps move the let into the '(b (display (g a b))) branch: 
                 (let ((a (car x))) (cond (b (display (g a b))) (else (set! y z) (display x)))) ->
                 (cond (b (let ((a (car x))) (display (g a b)))) ...)")
  (lint-test "(let ((a (car x))) (case b ((0) (display (g a b))) (else (set! y z) (display x))))"
	     " let: perhaps move the let into the '((0) (display (g a b))) branch: 
                 (let ((a (car x))) (case b ((0) (display (g a b))) (else (set! y z)... ->
                 (case b ((0) (let ((a (car x))) (display (g a b)))) ...)")
  (lint-test "(if z (let () (* 2 y)))" 
	     " if: perhaps (if z (let () (* 2 y))) -> (when z (* 2 y))
               if: pointless let: (let () (* 2 y))
               if: perhaps (let () (* 2 y)) -> (* 2 y)")
  (lint-test "(if z (let () (display y) (* 2 y)))" 
	     " if: perhaps (if z (let () (display y) (* 2 y))) -> (when z (display y) (* 2 y))
               if: let could be begin: (let () (display y) (* 2 y)) -> (begin (display y) (* 2 y))")

  (lint-test "(let ((v 3)) v)" " let: perhaps (let ((v 3)) v) -> 3") ; this aimed at a lint bug
  (lint-test "(let ((v (make-vector 3))) #f)" " let: v not used, initially: (make-vector 3) from let") ; also same bug

  (lint-test "(eq? x '())"              " eq?: perhaps (eq? x '()) -> (null? x) eq?: quote is not needed here: '()")
  (lint-test "(equal? x '#())"          " equal?: quote is not needed here: '#()")
  (lint-test "(equal? x '\"\")"         " equal?: quote is not needed here: '\"\"")
  (lint-test "(eq? x '#<unspecified>)"  " eq?: quote is not needed here: '#<unspecified>")
  (lint-test "(eq? x '#t)"              " eq?: quote is not needed here: '#t")
  (lint-test "(eq? x '#f)"              " eq?: perhaps (eq? x '#f) -> (not x) eq?: quote is not needed here: '#f")
  (lint-test "(equal? x '(1))"          "")
  (lint-test "(eqv? x '3)"              " eqv?: quote is not needed here: '3")
  (lint-test "(eq? x 'x)"               "")
  (lint-test "(eq? x 1.5)"		" eq?: eq? should be eqv? in (eq? x 1.5)")
  (lint-test "(eq? 3 x)"		" eq?: eq? should be eqv? in (eq? 3 x)")
  (lint-test "(eq? x (not x))"		" eq?: this looks odd: (eq? x (not x))")
  (lint-test "(eq? #(a) #(a))"		
	     " eq?: this looks odd: (eq? #(a) #(a)) eq?: perhaps (eq? #(a) #(a)) -> #f eq?: eq? should be equal? in (eq? #(a) #(a))")
  (lint-test "(eq? #() ())"		" eq?: perhaps (eq? #() ()) -> #f eq?: eq? should be equal? in (eq? #() ()) eq?: perhaps (eq? #() ()) -> #f")
  (lint-test "(eqv? x #())"             " eqv?: eqv? should be equal? in (eqv? x #())")
  (lint-test "(eq? x \"\")"             " eq?: eq? should be equal? in (eq? x \"\")")
  (lint-test "(eq? #() (vector))"       " eq?: eq? should be equal? in (eq? #() (vector))")
  (lint-test "(eq? () (list))"          " eq?: perhaps (eq? () (list)) -> #t eq?: perhaps (list) -> (); there is only one nil")
  (lint-test "(eqv? x (string))"        " eqv?: eqv? should be equal? in (eqv? x (string)) eqv?: (string) could be \"\"")
  (lint-test "(eq? (symbol->string x) z)" " eq?: eq? should be equal? in (eq? (symbol->string x) z)")
  (lint-test "(eq? (symbol? x) #t)"	" eq?: perhaps (eq? (symbol? x) #t) -> (symbol? x)")
  (lint-test "(eq? (symbol? x) #f)"	" eq?: perhaps (eq? (symbol? x) #f) -> (not (symbol? x))")
  (lint-test "(eq? x '())"		" eq?: perhaps (eq? x '()) -> (null? x) eq?: quote is not needed here: '()")
  (lint-test "(eq? '() x)"              " eq?: perhaps (eq? '() x) -> (null? x) eq?: quote is not needed here: '()")
  (lint-test "(eq? x '#\\a)"            " eq?: eq? should be eqv? in (eq? x '#\\a) eq?: quote is not needed here: '#\\a")
  (lint-test "(eqv? x ())"		" eqv?: eqv? could be null?: (eqv? x ()) -> (null? x)")
  (lint-test "(eqv? x '())"		" eqv?: eqv? could be null?: (eqv? x '()) -> (null? x) eqv?: quote is not needed here:  '()")
  (lint-test "(eqv? x #(a))"		" eqv?: eqv? should be equal? in (eqv? x #(a))")
  (lint-test "(eqv? x 'a)"		" eqv?: eqv? could be eq? in (eqv? x 'a)")
  (lint-test "(eqv? x #f)"              " eqv?: eqv? could be not: (eqv? x #f) -> (not x)")
  (lint-test "(equal? x 'a)"		" equal?: equal? could be eq? in (equal? x 'a)")
  (lint-test "(equal? x (integer->char 96))" " equal?: equal? could be eqv? in (equal? x (integer->char 96)) equal?: perhaps (integer->char 96) -> #\\`")
  (lint-test "(equal? x #f)"            " equal?: equal? could be not: (equal? x #f) -> (not x)")
  (lint-test "(equal? #f x)"            " equal?: equal? could be not: (equal? #f x) -> (not x)")
  (lint-test "(equal? x ())"            " equal?: equal? could be null?: (equal? x ()) -> (null? x)")
  (lint-test "(equal? x '())"           " equal?: equal? could be null?: (equal? x '()) -> (null? x) equal?: quote is not needed here:  '()")
  (lint-test "(equal? (expt x y) z)"    " equal?: equal? could be eqv? in (equal? (expt x y) z)")
  (lint-test "(morally-equal? x 0)"     "")
  (lint-test "(morally-equal? (abs x) 0.0)"   "")
  (lint-test "(equal? (floor x) (round y))" " equal?: equal? could be eqv? or = in (equal? (floor x) (round y))")
  (lint-test "(equal? (string x) (string-append y z))" " equal?: equal? could be string=? in (equal? (string x) (string-append y z))")
  (lint-test "(eqv? (integer->char x) #\\null)" " eqv?: eqv? could be char=? in (eqv? (integer->char x) #\\null)")
  (lint-test "(eq? #\\space (string-ref x 0))" " eq?: eq? should be eqv? or char=? in (eq? #\\space (string-ref x 0))")
  (lint-test "(eq? (sin x) (cos y))"    " eq?: eq? should be eqv? or = in (eq? (sin x) (cos y))")
  (lint-test "(eqv? #\\Space x)"        " reader[0]: unknown # object: #\\Space  perhaps use #\\space instead")
  (lint-test "(equal? (length x) (length y))"                 " equal?: equal? could be eqv? in (equal? (length x) (length y))")
  (lint-test "(equal? (string->number x) (string->number y))" " equal?: equal? could be eqv? in (equal? (string->number x) (string->number y))")
  (lint-test "(eqv? \":\" (string-ref s 0))"
	     " eqv?: this can't be right: (eqv? \":\" (string-ref s 0))
               eqv?: eqv? should be equal? in (eqv? \":\" (string-ref s 0))
               eqv?: perhaps (eqv? \":\" (string-ref s 0)) -> #f")
  (lint-test "(eqv? \"a\" (string))" 
	     " eqv?: (eqv? \"a\" (string)) is #f
               eqv?: eqv? should be equal? or string=? in (eqv? \"a\" (string))
               eqv?: (string) could be \"\"")
  (lint-test "(eqv? (string) \"a\")" 
	     " eqv?: (eqv? (string) \"a\") is #f
               eqv?: eqv? should be equal? or string=? in (eqv? (string) \"a\")
               eqv?: (string) could be \"\"")
  (lint-test "(eqv? \"a\" (substring x 2 3))" 
	     " eqv?: perhaps (eqv? \"a\" (substring x 2 3)) -> (char=? #\\a (string-ref x 2))
               eqv?: eqv? should be equal? or string=? in (eqv? \"a\" (substring x 2 3))")
  (lint-test "(eqv? (string #\\a) (substring x 2 3))" 
	     " eqv?: perhaps (eqv? (string #\\a) (substring x 2 3)) -> (char=? #\\a (string-ref x 2))
               eqv?: eqv? should be equal? or string=? in (eqv? (string #\\a) (substring x 2 3))
               eqv?: (string #\\a) could be \"a\"")
  (lint-test "(eqv? (substring x 0 1) (string #\\a))" 
	     " eqv?: perhaps (eqv? (substring x 0 1) (string #\\a)) -> (char=? #\\a (string-ref x 0))
               eqv?: eqv? should be equal? or string=? in (eqv? (substring x 0 1) (string #\\a))
               eqv?: (string #\\a) could be \"a\"")
  (lint-test "(string=? \"a\" (substring x 2 3))" " string=?: perhaps (string=? \"a\" (substring x 2 3)) -> (char=? #\\a (string-ref x 2))")
  (lint-test "(string=? (string) \"a\")" " string=?: (string=? (string) \"a\") is #f  string=?: (string) could be \"\"")
  (lint-test "(string=? (string y) (substring x 2 3))" " string=?: perhaps (string=? (string y) (substring x 2 3)) -> (char=? y (string-ref x 2))")
  (lint-test "(string=? (string x) (string y))" " string=?: perhaps (string=? (string x) (string y)) -> (char=? x y)")
  (lint-test "(string=? (substring y 0 1) (substring x 2 3))" 
	     " string=?: perhaps (string=? (substring y 0 1) (substring x 2 3)) -> (char=? (string-ref y 0) (string-ref x 2))")

  (lint-test "(char-ci=? x #\\return)"  " char-ci=?: char-ci=? could be char=? here: (char-ci=? x #\\return)")
  (lint-test "(equal? (vector-copy #(a b c)) #(a b c))" " equal?: perhaps (equal? (vector-copy #(a b c)) #(a b c)) -> (equal? #(a b c) #(a b c))")
  (lint-test "(not (equal? v (copy v)))" " not: perhaps (equal? v (copy v)) -> (equal? v v)")

  (lint-test "(eq? (floor x) 'a)"            " eq?: eq? should be eqv? in (eq? (floor x) 'a) eq?: perhaps (eq? (floor x) 'a) -> #f")
  (lint-test "(eq? (floor pi) #t)"           " eq?: eq? should be eqv? in (eq? (floor pi) #t) eq?: perhaps (eq? (floor pi) #t) -> #f")
  (lint-test "(eqv? (string->symbol x) 123)" " eqv?: perhaps (eqv? (string->symbol x) 123) -> #f")
  (lint-test "(eq? 'a (integer->char 48))" 
	     " eq?: eq? should be eqv? in (eq? 'a (integer->char 48))
               eq?: perhaps (eq? 'a (integer->char 48)) -> #f
               eq?: perhaps (integer->char 48) -> #\\0")
  (lint-test "(equal? (string->symbol x) 123)" 
	     " equal?: equal? could be eqv? in (equal? (string->symbol x) 123)
               equal?: perhaps (equal? (string->symbol x) 123) -> #f")
  (lint-test "(equal? (floor pi) (list 1 2))" 
	     " equal?: equal? could be eqv? in (equal? (floor pi) (list 1 2))
               equal?: perhaps (equal? (floor pi) (list 1 2)) -> #f
               equal?: perhaps (list 1 2) -> '(1 2)")
  (lint-test "(morally-equal? (list 1 2) (vector 1 2))" 
	     " morally-equal?: perhaps (morally-equal? (list 1 2) (vector 1 2)) -> #f
               morally-equal?: perhaps (list 1 2) -> '(1 2)
               morally-equal?: perhaps (vector 1 2) -> #(1 2)")
  (lint-test "(eq? x 'a)" "")
  (lint-test "(equal? '(1 2) '(1 2))" " equal?: perhaps (equal? '(1 2) '(1 2)) -> #t")
  (lint-test "(equal? '(1 2) #(1 2))" 
	     " equal?: perhaps (equal? '(1 2) #(1 2)) -> #f
               equal?: perhaps (equal? '(1 2) #(1 2)) -> #f
               equal?: #(1 2) could be #i(1 2)")
  (lint-test "(equal? '(1 . 2) (cons 1 2))" "")

  (lint-test "(map abs '(1 2) '(3 4))"	" map: map has too many arguments in:  (map abs '(1 2) '(3 4))")
  (lint-test "(map (lambda (a b) a) '(1 2))" " map: map has too few arguments in:  (map (lambda (a b) a) '(1 2))")
  (lint-test "(map (lambda (a) (abs a)) '(1 2 3))" " map: perhaps (lambda (a) (abs a)) -> abs")
  (lint-test "(map abs (vector->list #(1 2)))" 
	     " map:  (vector->list #(1 2)) could be simplified to:  #(1 2) ; (map accepts non-list sequences) 
               map: perhaps (vector->list #(1 2)) -> '(1 2)
               map: #(1 2) could be #i(1 2)")
  (lint-test "(begin (map g123 x) x)"	" begin: map could be for-each: (for-each g123 x)")
  (lint-test "(map log x x)"            "")
  (lint-test "(map f (map g h))"        " map: perhaps (map f (map g h)) -> (map (lambda (_1_) (f (g _1_))) h)")
  (lint-test "(for-each x (map g h))"   " for-each: perhaps (for-each x (map g h)) -> (for-each (lambda (_1_) (x (g _1_))) h)")
  (lint-test "(map f (map (lambda (x) (g x y)) h))" " map: perhaps (map f (map (lambda (x) (g x y)) h)) -> (map (lambda (_1_) (f (g _1_ y))) h)")
  (lint-test "(map (lambda (x) (f x y)) (map g h))" " map: perhaps (map (lambda (x) (f x y)) (map g h)) -> (map (lambda (_1_) (f (g _1_) y)) h)")
  (lint-test "(map (lambda (x) (f x y)) (map (lambda (y) (g z y)) h))" 
	     " map: perhaps (map (lambda (x) (f x y)) (map (lambda (y) (g z y)) h)) -> (map (lambda (_1_) (f (g z _1_) y)) h)")
  (lint-test "(map f (map (lambda (x) (g 'x x)) h))" " map: perhaps (map f (map (lambda (x) (g 'x x)) h)) -> (map (lambda (_1_) (f (g 'x _1_))) h)")
  (lint-test "(map (lambda (x) (display 1) (f x)) (map g h))" 
	     " map: perhaps (map (lambda (x) (display 1) (f x)) (map g h)) -> (map (lambda (_1_) (display 1) (f (g _1_))) h)")
  (lint-test "(map (lambda (x) (display 1) (f x)) (map (lambda (y) (+ y 1)) h))" 
	     " map: perhaps (map (lambda (x) (display 1) (f x)) (map (lambda (y) (+ y 1)) h)) -> (map (lambda (_1_) (display 1) (f (+ _1_ 1))) h)")
  (lint-test "(map (lambda (x) x) lst)" " map: perhaps (map (lambda (x) x) lst) -> lst")
  (lint-test "(for-each (lambda (x) (+ (abs x) 1)) lst)" " for-each: pointless for-each: (for-each (lambda (x) (+ (abs x) 1)) lst)")
  (lint-test "(for-each x #\\a)"        " for-each: in (for-each x #\\a), for-each's argument 2 should be a sequence, but #\\a is a char?")
  (lint-test "(map f (cdr (vector->list v)))" 
	     " map: map accepts vector arguments, so perhaps (cdr (vector->list v)) -> (make-shared-vector v (- (length v) 1) 1)")
  (lint-test "(for-each f (list-tail (string->list str) x))"
	     " for-each: for-each accepts string arguments, so perhaps (list-tail (string->list str) x) -> (substring str x)")
  (lint-test "(map char-downcase (string->list str))" 
	     " map: (string->list str) could be simplified to: str ; (map accepts non-list sequences)
               map: perhaps (map char-downcase (string->list str)) -> (string->list (string-downcase str))")
  (lint-test "(for-each display (list a))" 
	     " for-each: perhaps (for-each display (list a)) -> (display a)
               for-each: perhaps (for-each display (list a)) -> (format () \"~A\" a)")
  (lint-test "(map display (vector 'a 'b 'c))" " map: perhaps (vector 'a 'b 'c) -> #(a b c)")
  (lint-test "(map (lambda (v) #f) y)" " map: perhaps (map (lambda (v) #f) y) -> (make-list (abs (length y)) #f)")
  (lint-test "(map abs ())" " map: this (map abs ()) has no effect (null arg)")
  (lint-test "(map fnc '(2))" " map: perhaps (map fnc '(2)) -> (list (fnc 2))")
  (lint-test "(for-each fnc (list x) '(2))" " for-each: perhaps (for-each fnc (list x) '(2)) -> (fnc x 2)")
  (lint-test "(for-each display #())" 
	     " for-each: this (for-each display #()) has no effect (zero length arg)
               for-each: perhaps (for-each display #()) -> (format () \"~{~A~}\" #())")
  (lint-test "(for-each display \"\")" 
	     " for-each: this (for-each display \"\") has no effect (zero length arg)
               for-each: perhaps (for-each display \"\") -> (format () \"~{~A~}\" \"\")")
  (lint-test "(for-each display ())" 
	     " for-each: this (for-each display ()) has no effect (null arg) 
               for-each: perhaps (for-each display ()) -> (format () \"~{~A~}\" ())")
  (lint-test "(for-each fxy ())"  " for-each: this (for-each fxy ()) has no effect (null arg)")
  (lint-test "(for-each fxy '())" 
	     " for-each: this (for-each fxy '()) has no effect (null arg) 
               for-each: quote is not needed here: '()")
  (lint-test "(for-each fxy #())" " for-each: this (for-each fxy #()) has no effect (zero length arg)")
  (lint-test "(map car (list (cons a b)))" "  map: perhaps (map car (list (cons a b))) -> (list (car (cons a b)))")
  (lint-test "(map abs #(1))" " map: perhaps (map abs #(1)) -> (list (abs 1)) map: #(1) could be #i(1)")

  (lint-test "(catch #(a) (lambda () #f) (lambda a a))" " catch: catch tag #(a) is unreliable (catch uses eq? to match tags)")
  (lint-test "(catch x (lambda () #f) (lambda a a))" "")
  (lint-test "(catch 'hi x y)" "")

  (lint-test "(car #(a))"		" car: in (car #(a)), car's argument should be a pair, but #(a) is a vector?")
  (unless pure-s7 
    (lint-test "(vector->list 1.4)"     " vector->list: in (vector->list 1.4), vector->list's argument should be a vector, but 1.4 is a float?"))
  (lint-test "(vector-set! #(0 a) 0 2)" 
	     " vector-set!: #(0 a) is a constant, so vector-set! is problematic, and #(0 a) is discarded; perhaps (vector-set! #(0 a) 0 2) -> 2")
  (lint-test "(list-set! (list 0 1) 0 2)" " list-set!: (list 0 1) is simply discarded; perhaps (list-set! (list 0 1) 0 2) -> 2")
  (lint-test "(string-set! (make-string 3) 0 #\\a)" 
	     " string-set!: (make-string 3) is simply discarded; perhaps (string-set! (make-string 3) 0 #\\a) -> #\\a")
  (lint-test "(let ((x '(0 1))) (list-set! x 0 3.1))" 
             "let: perhaps (let ((x '(0 1))) (list-set! x 0 3.1)) -> (list-set! '(0 1) 0 3.1)
	      let: x's value, '(0 1), is a literal constant, so this set! is trouble: (list-set! x 0 3.1)")
  (lint-test "(let ((c #(0 a))) (vector-set! c 0 1))" 
	     "let: perhaps (let ((c #(0 a))) (vector-set! c 0 1)) -> (vector-set! #(0 a) 0 1)
	      let: c's value, #(0 a), is a literal constant, so this set! is trouble: (vector-set! c 0 1)")
  (lint-test "(let ((x (vector 0 1))) (vector-set! x 0 1))" 
	     " let: perhaps (let ((x (vector 0 1))) (vector-set! x 0 1)) -> (vector-set! (vector 0 1) 0 1)")
  (lint-test "(let ((x (vector 0 1))) (string-set! x 0 #\\a))" 
	     " let: perhaps (let ((x (vector 0 1))) (string-set! x 0 #\\a)) -> (string-set! (vector 0 1) 0 #\\a)
	       let: x is a vector, but string-set! in (string-set! x 0 #\\a) wants a string?")
  (lint-test "(list-set! (cdr x) 0 y)" " list-set!: perhaps (list-set! (cdr x) 0 y) -> (list-set! x 1 y)")

  (lint-test "(+ . 1)"   " +: unexpected dot:  (+ . 1)")
  (lint-test "(or . 0)"  " or: unexpected dot: (or . 0)")
  (lint-test "(not . 0)" " not: unexpected dot: (not . 0)")
  (lint-test "(and . 0)" " and: unexpected dot: (and . 0)")

  (lint-test "(length (a . b))"         " length: missing quote? (a . b) in (length (a . b))")
  (unless pure-s7
    (lint-test "(length ,a)"              " length: stray comma? (unquote a) in (length (unquote a))"))
  (lint-test "(make-vector (length (append x y)))" " make-vector: perhaps (length (append x y)) -> (+ (length x) (length y))")
  (lint-test "(make-float-vector 3 0.0)"      " make-float-vector: 0.0 is the default initial value in (make-float-vector 3 0.0)")
  (lint-test "(make-vector 3 #<unspecified>)" " make-vector: #<unspecified> is the default initial value in (make-vector 3 #<unspecified>)")
  (lint-test "(make-vector 3 #\\null #t)"     
	     " make-vector: make-vector has too many arguments: (make-vector 3 #\\null #t)
               make-vector: make-vector no longer has a fourth argument: (make-vector 3 #\\null #t)")

  (lint-test "(set! a b c)"		" set!: set! has too many arguments: (set! a b c)")
  (lint-test "(set! a)"			" set!: set! has too few arguments: (set! a)")
  (lint-test "(set! (vector-ref v 0) 3)" " set!: perhaps (set! (vector-ref v 0) 3) -> (vector-set! v 0 3)")
  (lint-test "(set! pi 3)"		" set!: can't set! (set! pi 3) (it is a constant)")
  (lint-test "(set! if 3)"              " set!: bad idea: (set! if 3)")
  (lint-test "(set! abs 3)"             " set!: not recommended: (set! abs 3)")
  (lint-test "(set! 3 1)"		" set!: can't set! (set! 3 1)")
  (lint-test "(set! () 3)"              " set!: can't set! (set! () 3)")
  (lint-test "(set! a a)"		" set!: pointless set! (set! a a)")
  (lint-test "(set! x (if y x 1))"      " set!: perhaps (set! x (if y x 1)) -> (if (not y) (set! x 1))")
  (lint-test "(set! x (if y 1 x))"      " set!: perhaps (set! x (if y 1 x)) -> (if y (set! x 1))")
  (lint-test "(set! x (and x y))"       " set!: perhaps (set! x (and x y)) -> (if x (set! x y))")
  (lint-test "(set! x (and y x))"       " set!: perhaps (set! x (and y x)) -> (if (not y) (set! x #f))")
  (lint-test "(set! x (or x y))"        " set!: perhaps (set! x (or x y)) -> (if (not x) (set! x y))")
  (lint-test "(set! x (or y x))"        "")
  (lint-test "(set! x (cond (z w) (else x)))" " set!: perhaps (set! x (cond (z w) (else x))) -> (if z (set! x w))")
  (lint-test "(set! x (cond (z x) (else w)))" " set!: perhaps (set! x (cond (z x) (else w))) -> (if (not z) (set! x w))")

  (lint-test "(begin (set! x (cons 1 z)) (set! x (cons 2 x)))" " begin: perhaps (set! x (cons 1 z)) (set! x (cons 2 x)) -> (set! x (cons 2 (cons 1 z)))")
  (lint-test "(begin (set! x 0) (set! x 1))" " begin: this could be omitted: (set! x 0)")
  (lint-test "(begin (set! x y) (set! x y))" 
	     " begin: this pair of set!s looks odd: (... (set! x y) (set! x y) ...)
	       begin: this could be omitted: (set! x y)")
  (lint-test "(begin (set! x y) (set! y x))" " begin: this pair of set!s looks odd: (... (set! x y) (set! y x) ...)")
  (lint-test "(begin (set! x y) (set! x (+ x 1)))" " begin: perhaps (set! x y) (set! x (+ x 1)) -> (set! x (+ y 1))")
  (lint-test "(quote 3)"		" quote: quote is not needed here: '3")
  (lint-test "(quote . 3)"		" quote: stray dot in quote's arguments? (quote . 3)")
  (lint-test "(quote 3 4)"		" quote: quote has too many arguments: (quote 3 4)")
  (lint-test "'#(a)"			" quote: quote is not needed here: '#(a)")

  (lint-test "(let () (when a (+ x 1)) y)" 
	     " let: let could be begin: (let () (when a (+ x 1)) y) -> (begin (when a (+ x 1)) y)
               let: this could be omitted: (when a (+ x 1))")
  (lint-test "(let () (unless a (+ x 1)) y)"
	     " let: let could be begin: (let () (unless a (+ x 1)) y) -> (begin (unless a (+ x 1)) y)
               let: this could be omitted: (unless a (+ x 1))")
  (lint-test "(let () (cond ((< x y) 3) ((< y z) 4)) (+ x 1))" 
	     " let: let could be begin: (let () (cond ((< x y) 3) ((< y z) 4)) (+ x 1)) -> (begin (cond ((< x y) 3) ((< y z) 4)) (+ x 1))
               let: this could be omitted: (cond ((< x y) 3) ((< y z) 4))")
  (lint-test "(let () (case x ((0) 1) (else 2)) x)"            
	     " let: let could be begin: (let () (case x ((0) 1) (else 2)) x) -> (begin (case x ((0) 1) (else 2)) x)
               let: this could be omitted: (case x ((0) 1) (else 2))
               let: perhaps (case x ((0) 1) (else 2)) -> (if (eqv? x 0) 1 2)")
  (lint-test "(begin (let ((a (+ x 1)) (b 2)) (+ a b)) 32)" 
	     " begin: perhaps (begin (let ((a (+ x 1)) (b 2)) (+ a b)) 32) -> (let ((a (+ x 1)) (b 2)) (+ a b) 32)   
	       begin: this could be omitted: (let ((a (+ x 1)) (b 2)) (+ a b))
               begin: perhaps (let ((a (+ x 1)) (b 2)) (+ a b)) -> (+ (+ x 1) 2)")
  (lint-test "(begin (if x y z) a)" " begin: this could be omitted: (if x y z)")
  (lint-test "(lambda (a) (if x y z) a)" " lambda: this could be omitted: (if x y z)")
  (lint-test "(lambda (a) (case x ((0) 1) (else x)) a)"        
	     " lambda: this could be omitted: (case x ((0) 1) (else x))
               lambda: perhaps (case x ((0) 1) (else x)) -> (if (eqv? x 0) 1 x)
               lambda: in (else x), the result can be omitted")
  (lint-test "(let () (do ((i 0 (+ i 1))) ((= i 1))) x)"       
	     " let: let could be begin: (let () (do ((i 0 (+ i 1))) ((= i 1))) x) -> (begin (do ((i 0 (+ i 1))) ((= i 1))) x)
               let: this could be omitted: (do ((i 0 (+ i 1))) ((= i 1)))
               let: this do-loop could probably be replaced by the end test in a let: (do ((i 0 (+ i 1))) ((= i 1)))
               let: do is unnecessary: (do ((i 0 (+ i 1))) ((= i 1)))")
  (lint-test "(let () (write-byte i) (write-byte i) (write-byte i) (write-byte i) (write-byte i) (newline))" 
	     " let: let could be begin: (let () (write-byte i) (write-byte i) (write-byte i) (write-byte i)... ->
                 (begin (write-byte i) (write-byte i) (write-byte i) (write-byte i)...
               let: perhaps (write-byte i)... -> (do ((_1_ 0 (+ _1_ 1))) ((= _1_ 5)) (write-byte i))")
  (lint-test "(let () (write-byte 0) (write-byte 0) (write-byte 0) (write-byte 0) (write-byte 0))" 
	     " let: let could be begin: (let () (write-byte 0) (write-byte 0) (write-byte 0) (write-byte 0)... ->
                 (begin (write-byte 0) (write-byte 0) (write-byte 0) (write-byte 0)...
               let: perhaps (write-byte 0)... -> (do ((i 0 (+ i 1))) ((= i 5)) (write-byte 0))")
  (lint-test "(let () (write-byte 0) (write-byte 1) (write-byte 2) (write-byte 3) (write-byte 4))" 
	     " let: let could be begin: (let () (write-byte 0) (write-byte 1) (write-byte 2) (write-byte 3)... ->
                 (begin (write-byte 0) (write-byte 1) (write-byte 2) (write-byte 3)...
               let: perhaps (write-byte 0)... -> (for-each write-byte '(0 1 2 3 4))")
  (lint-test "(let () (write-byte 0) (write-byte 1) (write-byte 2) (write-byte 3) (write-byte (* x 2)))" 
	      " let: let could be begin: (let () (write-byte 0) (write-byte 1) (write-byte 2) (write-byte 3)... ->
                (begin (write-byte 0) (write-byte 1) (write-byte 2) (write-byte 3)...
                let: perhaps (write-byte 0)... -> (for-each write-byte (vector 0 1 2 3 (* x 2)))")
  (lint-test "(let () (writ 0) (writ 1) (writ 2) (writ 3) (writ (* x 2)))" 
	     " let: assuming writ is not a macro, perhaps (... (writ 0) ...) -> (for-each writ (vector 0 1 2 3 (* x 2)))")
  (lint-test "(let () (writ 0) (writ 1) (writ) (writ 3) (writ (* x 2)))" "")
  (lint-test "(let () (writ 0 x) (writ 1 x) (writ 2 x) (writ 3 x) (writ 4 x))" 
	     " let: perhaps (writ 0 x)... -> (for-each (lambda (arg) (writ arg x)) '(0 1 2 3 4))")
  (lint-test "(let () (writ x 0) (writ x 1) (writ x 2) (writ x 3) (writ x (* x 2)))"
	      " let: assuming writ is not a macro, perhaps (... (writ x 0) ...) -> (for-each (lambda (arg) (writ x arg)) (vector 0 1 2 3 (* x 2)))")
  (lint-test "(let () (writ x 0) (writ x 1) (writ y 2) (writ x 3) (writ x (* x 2)))" "")
  (lint-test "(let () (writ (display x) 0) (writ (display x) 1) (writ (display x) 2) (writ (display x)))" "")

  (lint-test "(case 3)"			" case: case is messed up:  (case 3)")
  (lint-test "(case 3 ((0) #t))"	
	     " case: perhaps (case 3 ((0) #t)) -> (if (eqv? 3 0) #t)
               case: case selector is a constant: (case 3 ((0) #t))")
  (lint-test "(case (list 1) ((0) #t))"
	     " case: perhaps (case (list 1) ((0) #t)) -> (if (eqv? (list 1) 0) #t)
               case: case selector may not work with eqv: (list 1)
               case: case key 0 in ((0) #t) is pointless")
  (lint-test "(case x (0))"		" case: bad case key 0 in (0)")
  (lint-test "(case x ((0)))"		"") ; result can be null
  (lint-test "(case x ((0) 1) ((1) 2) ((3 0) 4))" " case: repeated case key 0 in ((3 0) 4)")
  (lint-test "(case x ((0) 1) ((1) 2) ((3 . 0) 4))" " case: stray dot in case case key list:  ((3 . 0) 4)")
  (lint-test "(case x ((#(a)) 2))"	
	     " case: perhaps (case x ((#(a)) 2)) -> (if (eqv? x #(a)) 2)
               case: case key #(a) in ((#(a)) 2) is unlikely to work (case uses eqv? but it is a vector)")
  (lint-test "(case x (else 2) ((0) 1))" " case: case else clause is not the last: ((else 2) ((0) 1))")
  (lint-test "(case x ((0) 32) (else 32))" " case: perhaps (case x ((0) 32) (else 32)) -> 32")
  (lint-test "(case (string->symbol x) ((a) 1) ((2 3) 3))" " case: case key 2 in ((2 3) 3) is pointless  case: case key 3 in ((2 3) 3) is pointless")
  (lint-test "(case c ((a) b) (else (begin (display d) e)))" 
	     " case: perhaps (case c ((a) b) (else (begin (display d) e))) -> (if (eq? c 'a) b (begin (display d) e))
               case: redundant begin: (begin (display d) e)")
  (lint-test "(case x ((0) 32) ((1) 32))" "case: perhaps merge keys (1) with (0): (case x ((0) 32) ((1) 32)) -> (case x ((0 1) 32))")
  (lint-test "(case x ((0) 32) (else (case x ((1) 32))))" 
	     " case: perhaps (case x ((0) 32) (else (case x ((1) 32)))) -> (if (eqv? x 0) 32 (case x ((1) 32)))
               case: perhaps (case x ((1) 32)) -> (if (eqv? x 1) 32)
               case: perhaps merge keys (1) with (0): (case x ((0) 32) (else (case x ((1) 32)))) -> (case x ((0 1) 32))")
  (lint-test "(case x ((0) 32) (else (case x ((1) 32)) x))" 
	     " case: this could be omitted: (case x ((1) 32))
               case: perhaps (case x ((1) 32)) -> (if (eqv? x 1) 32)")
  (lint-test "(case x ((0) (display 1) 2) (else (display 1) 2))" 
	     " case: perhaps (case x ((0) (display 1) 2) (else (display 1) 2)) ->  (begin (display 1) 2)")
  (lint-test "(case x (else (case x ((0) 1))))"  
	     " case: perhaps (case x ((0) 1)) -> (if (eqv? x 0) 1)
               case: perhaps (case x (else (case x ((0) 1)))) -> (case x ((0) 1))")
  (lint-test "(case x (else (case x (else 1))))" " case: perhaps (case x (else 1)) -> 1  case: perhaps (case x (else (case x (else 1)))) -> 1")
  (lint-test "(case x ((0) 1) ((1 2) 1))"        " case: perhaps merge keys (1 2) with (0): (case x ((0) 1) ((1 2) 1)) -> (case x ((0 1 2) 1))")
  (lint-test "(case x ((a b a) 1) ((c) 2))"      " case: repeated case key a in ((a b a) 1)")
  (lint-test "(case x ((3) 2) ((4 8) 3) ((1) 3) ((0) 2))"
	     " case: perhaps merge keys (1) with (4 8), (0) with (3): 
                (case x ((3) 2) ((4 8) 3) ((1) 3) ((0) 2)) -> (case x ((0 3) 2) ((1 4 8) 3))")
  (lint-test "(case x ((#\\1) 2) ((#\\space #\\c) 3) ((#\\x) 3) ((#\\null) 2))"
	     " case: perhaps merge keys (#\\x) with (#\\space #\\c), (#\\null) with (#\\1): 
                 (case x ((#\\1) 2) ((#\\space #\\c) 3) ((#\\x) 3) ((#\\null) 2)) -> (case x ((#\\null #\\1) 2) ((#\\space #\\c #\\x) 3))")
  (lint-test "(case ((1) 1) (t 2))"     " case: bad case key t in (t 2)")
  (lint-test "(case x ((a) #t) (else #f))"   " case: perhaps (case x ((a) #t) (else #f)) -> (eq? x 'a)")
  (lint-test "(case x ((a b) #f) (else #t))" " case: perhaps (case x ((a b) #f) (else #t)) -> (not (memq x '(a b)))")
  (lint-test "(case x ((1 2) #t) (else #f))" " case: perhaps (case x ((1 2) #t) (else #f)) -> (memv x '(1 2))")
  (lint-test "(case x ((2) #f) (else #t))"   " case: perhaps (case x ((2) #f) (else #t)) -> (not (eqv? x 2))")
  (lint-test "(case x ((1) y) ((2) z) (#t 3))" " case: bad case key #t in (#t 3)")
  (lint-test "(case x ((a) y) ((b) z) (else (if (eq? x 'c) 32 (+ x 1))))" 
	     " case: perhaps (case x ((a) y) ((b) z) (else (if (eq? x 'c) 32 (+ x 1)))) -> (case x ((a) y) ((b) z) ((c) 32) (else (+ x 1)))")
  (lint-test "(case x ((a) y) ((b) z) (else (if (eq? x 'c) 32)))" 
	     " case: perhaps (case x ((a) y) ((b) z) (else (if (eq? x 'c) 32))) -> (case x ((a) y) ((b) z) ((c) 32))")
  (lint-test "(case x ((a) (+ y 1) z) ((b) (display x)) (else c))" 
	     " case: perhaps use => here: (case x ((a) (+ y 1) z) ((b) (display x)) (else c)) -> (case x ... ((b) => display) ...)
               case: this could be omitted: (+ y 1)")
  (lint-test "(begin (case x ((a) (+ y 1) z) ((b) (display x)) (else c)) (display x))" 
	     " begin: this case clause can be omitted: ((a) (+ y 1) z)
               begin: this case clause can be omitted: (else c)
               begin: perhaps use => here: (case x ((a) (+ y 1) z) ((b) (display x)) (else c)) -> (case x ... ((b) => display) ...)
               begin: this could be omitted: (+ y 1)")
  (lint-test "(case x (else 3))" " case: perhaps (case x (else 3)) -> 3")
  (lint-test "(case x ((1) (+ x 1)) (else (+ x 3)))" 
	     " case: perhaps (case x ((1) (+ x 1)) (else (+ x 3))) -> (+ x (if (eqv? x 1) 1 3))")
  (lint-test "(case x ((#\\a #\\b) (+ x 1)) (else (+ x 3)))" 
	     " case: perhaps (case x ((#\\a #\\b) (+ x 1)) (else (+ x 3))) -> (+ x (if (memv x '(#\\a #\\b)) 1 3))")
  (lint-test "(case (+ x 1) ((1) (fx1 x y z)) ((2 3) (fx1 x y a)) (else (fx1 x y a b)))" 
	     " case: perhaps (case (+ x 1) ((1) (fx1 x y z)) ((2 3) (fx1 x y a)) (else (fx1 x y a b))) -> (fx1 x y (case (+ x 1) ((1) z) ((2 3) a) (else (values a b))))")
  (lint-test "(case x ((symbol) (display x) (+ x 1)))" " case: perhaps (case x ((symbol) (display x) (+ x 1))) -> (when (eq? x 'symbol) (display x) (+ x 1))")
  (lint-test "(case x ((:symbol) (display x) (+ x 1)))" " case: perhaps (case x ((:symbol) (display x) (+ x 1))) -> (when (eq? x :symbol) (display x) (+ x 1))")
  (lint-test "(case x ((0) (log x 2)) ((1) (log x 3)) (else (error 'oops)))" 
	     " case: perhaps (case x ((0) (log x 2)) ((1) (log x 3)) (else (error 'oops))) -> (log x (case x ((0) 2) ((1) 3) (else (error 'oops))))")
  (lint-test "(case x ((a) (f y z)) (else (g y z)))" " case: perhaps (case x ((a) (f y z)) (else (g y z))) -> ((if (eq? x 'a) f g) y z)")
  (lint-test "(case x ((a b) (f y z)) (else (g y z)))" " case: perhaps (case x ((a b) (f y z)) (else (g y z))) -> ((case x ((a b) f) (else g)) y z)")
  (lint-test "(case x ((a) (f y a)) (else (f y z)))" " case: perhaps (case x ((a) (f y a)) (else (f y z))) -> (f y (if (eqv? x a) a z))")

  (lint-test "(case (abs x) ((integer?) 1) ((x) 2) ((1) 3))" 
	      "case: case key integer? in ((integer?) 1) is pointless
               case: case key x in ((x) 2) is pointless")
  (lint-test "(case (floor x) ((1 2) 3) ((a b) 4))" 
	     " case: case key a in ((a b) 4) is pointless
               case: case key b in ((a b) 4) is pointless")

  (lint-test "(if (not sym) (set! sym (eqv-selector p)) (equal? sym (eqv-selector p)))" "")
  (lint-test "(cond (X (f y z)) (else (set! y z)))" "")
  (lint-test "(case x ((a) (set! y z)) (else (g y z)))" " case: perhaps (case x ((a) (set! y z)) (else (g y z))) -> (if (eq? x 'a) (set! y z) (g y z))")
  (lint-test "(case (pair? x) ((#f) y) (else z))" " case: perhaps (case (pair? x) ((#f) y) (else z)) -> (if (not (pair? x)) y z)")
  (lint-test "(case x ((#f) y) (else z))" " case: perhaps (case x ((#f) y) (else z)) -> (if (not x) y z)")

  (lint-test "(case arg-count
                ((0) (call-case 0))
                ((1) (call-case 1))
                ((2) (call-case 2))
                ((3) (call-case 3))
                ((4) (call-case 4))
                ((5) (call-case 5))
                ((6) (call-case 6))
                (else 12))" 
	     " case: perhaps use => here: (case arg-count ((0) (call-case 0)) ((1) (call-case 1)) ((2) (call-case... ->
                (case arg-count ((0 1 2 3 4 5 6) => call-case) ...)")
  (lint-test "(case x ((0) (f 0)) ((1) z) (else y))" 
	     " case: perhaps use => here: (case x ((0) (f 0)) ((1) z) (else y)) -> (case x ((0) => f) ...)")
  (lint-test "(case x ((0) (f 0)) ((1) z) ((2) (f 2)) (else y))" 
	     " case: perhaps use => here: (case x ((0) (f 0)) ((1) z) ((2) (f 2)) (else y)) -> (case x ((0 2) => f) ...)")
  (lint-test "(case x ((0) (f 0)) ((1) z) ((2) (f 2)))" 
	     " case: perhaps use => here: (case x ((0) (f 0)) ((1) z) ((2) (f 2))) -> (case x ((0 2) => f) ...)")
  (lint-test "(case x ((3) (g 3)) ((0) (f 0)) ((1) z) ((2) (f 2)))" 
	     " case: perhaps use => here: (case x ((3) (g 3)) ((0) (f 0)) ((1) z) ((2) (f 2))) -> (case x ((3) => g) ((0 2) => f) ...)")
  (lint-test "(case x ((3) (f 3)) ((0) (f 0)) ((2) (f 2)))" 
	     " case: perhaps use => here: (case x ((3) (f 3)) ((0) (f 0)) ((2) (f 2))) -> (case x ((3 0 2) => f))")
  (lint-test "(case x ((3) (f 3)) ((0) (f x)) ((2) (f 2)))" 
	     " case: perhaps use => here: (case x ((3) (f 3)) ((0) (f x)) ((2) (f 2))) -> (case x ((3 0 2) => f))")
  (lint-test "(case x ((1 2 3) (f x)) ((0) (f x)) ((4) (f 4)))" 
	     " case: perhaps use => here: (case x ((1 2 3) (f x)) ((0) (f x)) ((4) (f 4))) -> (case x ((1 2 3 0 4) => f))
               case: perhaps merge keys (0) with (1 2 3): (case x ((1 2 3) (f x)) ((0) (f x)) ((4) (f 4))) -> (case x ((0 1 2 3) (f x)) ((4) (f 4)))")
  (lint-test "(case x ((0 1) (abs x)))" 
	     " case: perhaps use => here: (case x ((0 1) (abs x))) -> (case x ((0 1) => abs))
               case: perhaps (case x ((0 1) (abs x))) -> (if (memv x '(0 1)) (abs x))")
  (lint-test "(case i ((x) x) ((y) y) ((z) z))" 
	     " case: perhaps use => here: (case i ((x) x) ((y) y) ((z) z)) -> (case i ((x y z) => symbol->value))")
  (lint-test "(case selector ((add-external!) add-external!) ((defun!) defun!) ((depgraph) depgraph) ((a) 1) (else 'oops))" 
	     " case: perhaps use => here: (case selector ((add-external!) add-external!) ((defun!) defun!)... ->
                 (case selector ((add-external! defun! depgraph) => symbol->value) ...)")

  (lint-test "(case x ((0) 0) ((1 2) x) (else x))" 
	     " case: in ((0) 0), the result can be omitted
               case: in ((1 2) x), the result can be omitted
               case: in (else x), the result can be omitted
               case: perhaps (case x ((0) 0) ((1 2) x) (else x)) -> (case x ((0) 0) (else x))")

  (lint-test "(begin (if (= x 1) (display y)) (if (= x 2) (f y)) (if (= x 3) (display z)) (f x))"
	     " begin: perhaps (... (if (= x 1) (display y)) (if (= x 2) (f y)) ...) ->
                 (case x ((1) (display y)) ((2) (f y)) ((3) (display z)))")
  (lint-test "(begin (if (eq? x 'a) (display y)) (if (eqv? x 2) (f y)) (if (char=? x #\\3) (display z)) (f x))"
	     " begin: perhaps (... (if (eq? x 'a) (display y)) (if (eqv? x 2) (f y)) ...) ->
                 (case x ((a) (display y)) ((2) (f y)) ((#\\3) (display z)))")
  (lint-test "(let ((x 2)) (case y ((A) B) ((C D) => (lambda (m) (+ m x)))))" 
	     " let: perhaps move the let into the '((C D) => (lambda (m) (+ m x))) branch: 
                 (let ((x 2)) (case y ((A) B) ((C D) => (lambda (m) (+ m x))))) ->
                 (case y ... ((C D) => (let ((x 2)) (lambda (m) (+ m x)))) ...)")

  (lint-test "(do ())"			" do: do is messed up:  (do ())")
  (lint-test "(do () ())"		"") ; ??
  (lint-test "(do ((x 2) y) ())"	" do: do binding is not a list? y do: x not used, initially: 2 from do")
  (lint-test "(do ((x 2 1)) () x)"	" do: this could be omitted: x")
  (lint-test "(do ((x 2 1)) () (display 1))" " do: x set, but not used: 2 from do")
  (lint-test "(do ((x 2)) () (display 1))" " do: x not used, initially: 2 from do")
  (lint-test "(do ((i 0 (+ i 1))) ((+ i 10) i))" " do: end test is never false: (+ i 10)")
  (lint-test "(do ((i 0 (+ i 1))) (#f i))" " do: result is unreachable: (#f i)")
  (lint-test "(do ((i 0 (+ i 0))) ((= i 10) i))" " do: perhaps (+ i 0) -> i")
  (lint-test "(do ((i 0 (+ i 1))) ((= i 0)) (display i))" 
	     " do (line 0): do is a no-op because (= i 0) is true at the start: (do ((i 0 (+ i 1))) ((= i 0)) (display i))")
  (lint-test "(do ((i 0 (+ i 1))) ((>= 0 i)) (display i))" 
	     " do (line 0): do is a no-op because (>= 0 i) is true at the start: (do ((i 0 (+ i 1))) ((>= 0 i)) (display i))")
  (lint-test "(do ((i 0 (+ i 1))) ((= i 1)) (display i))" " do: do is unnecessary: (do ((i 0 (+ i 1))) ((= i 1)) (display i))")
  (lint-test "(do ((i 0 (+ i 1))) ((= 1 i)) (display i))" " do: do is unnecessary: (do ((i 0 (+ i 1))) ((= 1 i)) (display i))")
  (lint-test "(do ((i 0 (+ i 1))) ((= i len)) (string-set! s i #\\a))" 
	     " do: perhaps (do ((i 0 (+ i 1))) ((= i len)) (string-set! s i #\\a)) ->  (fill! s #\\a 0 len)")
  (lint-test "(do ((i 2 (+ i 1))) ((= i len)) (string-set! s i #\\a))" 
	     " do: perhaps (do ((i 2 (+ i 1))) ((= i len)) (string-set! s i #\\a)) -> (fill! s #\\a 2 len)")
  (lint-test "(do ((i 2 (+ i 10))) ((= i len)) (string-set! s i #\\a))" "")

  (lint-test "(do ((i 0 (+ i 1))) ((= i len)) (vector-set! v0 i (vector-ref v1 i)))" 
	     " do: perhaps (do ((i 0 (+ i 1))) ((= i len)) (vector-set! v0 i (vector-ref v1 i))) ->  (copy v1 v0 0 len)")
  (lint-test "(do ((x 0 (+ x 1)))  ((>= x c) #f) (vector-set! array x (list-ref cells x)))" 
	     " do: perhaps (do ((x 0 (+ x 1))) ((>= x c) #f) (vector-set! array x (list-ref cells x))) -> (copy cells array 0 c)")
  (lint-test "(do ((i 0 (+ 1 1))) ((= i 3) z))" " do: perhaps (+ 1 1) -> 2")
  (lint-test "(do ((x lst (cdr lst))) ((null? x) y))" " do: this looks suspicious: (x lst (cdr lst))")
  (lint-test "(do ((i 0 (+ i 1))) ((>= i len)) (display i))" "")
  (lint-test "(do ((i 0 (+ i 1))) ((< i len)) (display i))" " do: do step looks like it doesn't match end test: (+ i 1) -> (< i len)")
  (lint-test "(do ((i 0 (- i 1))) ((<= i len)) (display i))" "")
  (lint-test "(do ((i 0 (- i 1))) ((> i len)) (display i))" " do: do step looks like it doesn't match end test: (- i 1) -> (> i len)")
  (lint-test "(do ((i 0 (+ i 1))) (= i 10) (display i))" 
	     "do: this could be omitted: i
              do: perhaps missing parens: (= i 10)
              do: do is a no-op because = is true at the start: (do ((i 0 (+ i 1))) (= i 10) (display i))
              do: strange do end-test: = in (= i 10) is a procedure")
  (lint-test "(do ((i 0 (+ i 1)) (j 0 (+ j 1))) ((= i 10)) (display i))" " do: j set, but not used: 0 from do")
  (lint-test "(let ((x #t)) (do ((i 0 (+ i 1))) (x) (display i)))" 
	     " let: perhaps (let ((x #t)) (do ((i 0 (+ i 1))) (x) (display i))) -> (do ((x #t) (i 0 (+ i 1))) ...)")
  (lint-test "(do ((i 0 (display i))) ((x y) z))" "")
  (lint-test "(do ((i 0 (+ i 1))) (abs i) (display i))" 
	     " do: do is a no-op because abs is true at the start: (do ((i 0 (+ i 1))) (abs i) (display i))
	       do: strange do end-test: abs in (abs i) is a procedure")
  (lint-test "(begin (do ((i 0 (+ i 1))) ((= i 10) i) (display i)) x)"
	     " begin: perhaps (begin (do ((i 0 (+ i 1))) ((= i 10) i) (display i)) x) -> (do ((i 0 (+ i 1))) ((= i 10) i x) (display i))
               begin: (do ((i 0 (+ i 1))) ((= i 10) i) (display i)): result i is not used")
  (lint-test "(do ((p (list 1) (cdr p))) ((null? p)) (display p))" " do: do is unnecessary: (do ((p (list 1) (cdr p))) ((null? p)) (display p))")
  (lint-test "(do ((p (list 1) (cdr p))) ((null? p)) (set! y (log z 2)) (do ((z z (+ z 1))) ((= z 0)) (display z)) (display x))"
	     " do: do is unnecessary: (do ((p (list 1) (cdr p))) ((null? p)) (set! y (log z 2)) (do ((z z (+ z 1))) ((= z 0)) (display z)) (display x))
               do: perhaps (do ((p (list 1) (cdr p))) ((null? p)) (set! y (log z 2)) (do ((z z (+ z... ->
                 (for-each (lambda ([p]) (set! y (log z 2)) (do ((z z (+ z 1))) ((= z 0)) (display z)) (display x)) (list 1))")
  (lint-test "(do ((i 0 (+ i 1))) ((= i 3) ()) (display i))" "")
  (lint-test "(do ((x y (cdr x))) ((null? x)) (let ((y x)) (car y)))" 
             " do: this do-loop could probably be replaced by the end test in a let: (do ((x y (cdr x))) ((null? x)) (let ((y x)) (car y)))
               do: this could be omitted: (let ((y x)) (car y)) do: perhaps (let ((y x)) (car y)) -> (car x)")
  (lint-test "(do ((i 0 (+ i 1))) ((= i 3) ()))" " do: this do-loop could be replaced by (): (do ((i 0 (+ i 1))) ((= i 3) ()))")
  (lint-test "(do ((i 0 (+ i 1))) ((= i 3) #t))" 
	     " do: this do-loop could be replaced by #t: (do ((i 0 (+ i 1))) ((= i 3) #t))
               do: return value is redundant: ((= i 3) #t)")
  (lint-test "(do ((i 0 (+ i 1))) ((vector-ref v i) (vector-ref v i)))" " do: return value is redundant: ((vector-ref v i) (vector-ref v i))")
  (lint-test "(do ((i 0 (+ i 1))) ((= i 3) (not (= i 3))) (display i))" " do: perhaps use => here: ((= i 3) (not (= i 3))) -> ((= i 3) => not)")

  (lint-test "(begin (do ((i 0 (+ i 1))) ((= i 3)) (display i)) 32)" 
	     " begin: perhaps (begin (do ((i 0 (+ i 1))) ((= i 3)) (display i)) 32) -> (do ((i 0 (+ i 1))) ((= i 3) 32) (display i))")
  (lint-test "(begin (do ((i 0 (+ i 1))) ((= i 3) (display x)) (display i)) 32)" 
	     " begin: perhaps (begin (do ((i 0 (+ i 1))) ((= i 3) (display x)) (display i)) 32) ->
                 (do ((i 0 (+ i 1))) ((= i 3) (display x) 32) (display i))")
  (lint-test "(begin (do () ((= i 3)) (display i)) 32)" " begin: perhaps (begin (do () ((= i 3)) (display i)) 32) -> (do () ((= i 3) 32) (display i))")
  (lint-test "(let ((x 2)) (do ((x 0 (+ x 1))) ((= x 2)) (display x)) (display x))" "") ; x shadowed if moved into do

  (lint-test "(let ((xx 0)) (do ((x 1 (+ x 1)) (y x (- y 1))) ((= x 3) xx) (display y)))" 
	     " let: x in (y x (- y 1)) does not appear to be defined in the calling environment
               let: perhaps (let ((xx 0)) (do ((x 1 (+ x 1)) (y x (- y 1))) ((= x 3) xx) (display y))) -> (do ((xx 0) (x 1 (+ x 1)) (y x (- y 1))) ...)")
  (lint-test "(let ((x 0)) (do ((x 1 (+ x 1)) (y x (- y 1))) ((= x 3)) (display y)))" 
	     " let: x in (y x (- y 1)) refers to the caller's x, not the do-loop variable")
  (lint-test "(let ((x 0)) (do ((x x (+ x 1)) (y x (- y 1))) ((= x 3)) (display y)))" "")
  (lint-test "(let ((a 1) (b 2)) (do ((x a (+ x 1)) (y (+ b 1) (+ y 1))) ((= i 3)) (display (+ x y))))" 
	     " let: perhaps (let ((a 1) (b 2)) (do ((x a (+ x 1)) (y (+ b 1) (+ y 1))) ((= i 3))... -> (do ((x 1 (+ x 1)) (y (+ 2 1) (+ y 1))) ...)")
  (lint-test "(let ((a 1)) (do ((i a (+ i 1))) ((= i 3)) (display i)))" 
	     " let: perhaps (let ((a 1)) (do ((i a (+ i 1))) ((= i 3)) (display i))) -> (do ((i 1 (+ i 1))) ...)")
  (lint-test "(let ((a 1)) (do ((i a (+ i 1)) (j 0 (+ j 1))) ((= i 3)) (display (+ i j))))" 
	     " let: perhaps (let ((a 1)) (do ((i a (+ i 1)) (j 0 (+ j 1))) ((= i 3)) (display (+ i j)))) -> (do ((i 1 (+ i 1)) (j 0 (+ j 1))) ...)")
  (lint-test "(let ((a 1)) (do ((i 0 (+ i 1)) (j 0 (+ j 1))) ((= i 3)) (display (+ a i j))))"
	     " let: perhaps (let ((a 1)) (do ((i 0 (+ i 1)) (j 0 (+ j 1))) ((= i 3)) (display (+ a i j)))) -> (do ((a 1) (i 0 (+ i 1)) (j 0 (+ j 1))) ...)")
  (lint-test "(let ((a 1)) (do ((i 0 (+ i 1)) (j 0 (+ j 1))) ((= i 3)) (display (+ a i j))) 32)" 
	     " let: perhaps (let ((a 1)) (do ((i 0 (+ i 1)) (j 0 (+ j 1))) ((= i 3)) (display (+ a i... -> (do ((a 1) (i 0 (+ i 1)) (j 0 (+ j 1))) ((= i 3) 32) ...)")
  (lint-test "(do ((i 0 (+ i j)) (j 0 (+ j 1))) ((= i 10)) (display i))"  ; displays 00136
	     " do: perhaps (do ((i 0 (+ i j)) (j 0 (+ j 1))) ((= i 10)) (display i)) ->
                 (do ((i 0) (j 0 (+ j 1))) ((= i 10)) (display i) (set! i (+ i j)))")
  (lint-test "(do ((i 0 j) (j 0 (+ j 1))) ((= i 2)) (display i))" 
	     " do: perhaps (do ((i 0 j) (j 0 (+ j 1))) ((= i 2)) (display i)) ->
                (do ((i 0) (j 0 (+ j 1))) ((= i 2)) (display i) (set! i j))")
  (lint-test "(do ((i 0 (+ i 1)) (j 1)) ((= i 3)) (display (+ i j)) (set! j (+ j 1)))" 
	     " do: perhaps move (set! j (+ j 1)) to j's step expression: (j 1 (+ j 1))")
  (lint-test "(do ((i 0 (+ i 1)) (j 1)) ((= i 3)) (display (+ i j)) (set! j (+ j i)))" "")
  (lint-test "(do ((i 0 (+ i 1)) (j 1 (+ j 1))) ((= i 3)) (display (+ i j)) (set! j (+ j 1)))" 
	     " do: perhaps move (set! j (+ j 1)) to j's step expression: (j 1 (+ 2 j))")
  (lint-test "(do ((i 0 (+ i 1)) (j 1 0)) ((= i 3)) (display (+ i j)) (set! j (+ j i)))" 
	     " do: this set! is pointless: (set! j (+ j i))")
  (lint-test "(do ((i 0 (+ i 1)) (j 1 0)) ((= i 3)) (display (+ i j)) (set! j (display (+ j i))))" 
	      " do: this set! is pointless: (set! j (display (+ j i))); perhaps replace it with (display (+ j i))")
  (lint-test "(do ((i 0 (+ i j)) (j 0 (+ k 1)) (k 1)) ((= i 10)) (display (+ i j k)))" 
	     " do: perhaps (do ((i 0 (+ i j)) (j 0 (+ k 1)) (k 1)) ((= i 10)) (display (+ i j k))) ->
                (do ((i 0) (j 0) (k 1)) ((= i 10)) (display (+ i j k)) (set! i (+ i j)) (set! j (+ k 1)))")
  (lint-test "(do ((i 0 j) (j 1 i) (k 0 (+ k 1))) ((= k 4)) (display (+ i j)))" 
	     " do: this do loop is unreadable; perhaps (do ((i 0 j) (j 1 i) (k 0 (+ k 1))) ((= k 4)) (display (+ i j))) ->
    (let _1_ ((i 0)
              (j 1)
              (k 0))
      (if (= k 4)
          ()
          (begin
            (display (+ i j))
            (_1_ j i (+ k 1)))))")
  (lint-test "(do ((i 0 j) (j 1 i) (k 0 (+ k 1))) ((= k 5) (set! x k) (+ k 1)) (display (+ i j)))" 
	     " do: this do loop is unreadable; perhaps (do ((i 0 j) (j 1 i) (k 0 (+ k 1))) ((= k 5) (set! x k) (+ k 1)) (display... ->
    (let _1_ ((i 0)
              (j 1)
              (k 0))
      (if (= k 5)
          (begin
            (set! x k)
            (+ k 1))
          (begin
            (display (+ i j))
            (_1_ j i (+ k 1)))))")
  (lint-test "(do ((i 0 (+ i 1))) ((= i 3)) (let ((a 12)) (set! a (+ a i)) (display a)))" 
	     " do: perhaps (let ((a 12)) (set! a (+ a i)) (display a)) -> (let ((a (+ 12 i))) (display a))
	       do: perhaps (do ((i 0 (+ i 1))) ((= i 3)) (let ((a 12)) (set! a (+ a i)) (display a))) ->
                (do ((i 0 (+ i 1)) (a 12 12)) ((= i 3)) (set! a (+ a i)) ...)")
  (lint-test "(do ((i 0 (+ i 1))) ((= i 3)) (let () (set! a (+ a i)) (display a)))" 
	     " do: pointless let: (let () (set! a (+ a i)) (display a))
               do: perhaps (do ((i 0 (+ i 1))) ((= i 3)) (let () (set! a (+ a i)) (display a))) ->
                (do ((i 0 (+ i 1))) ((= i 3)) (set! a (+ a i)) ...)")
  (lint-test "(do () ((= i 3)) (let ((a 12)) (set! a (+ a i)) (display a)))" 
	     " do: perhaps (let ((a 12)) (set! a (+ a i)) (display a)) -> (let ((a (+ 12 i))) (display a))
	       do: perhaps (do () ((= i 3)) (let ((a 12)) (set! a (+ a i)) (display a))) ->
                (do ((a 12 12)) ((= i 3)) (set! a (+ a i)) ...)")
  (lint-test "(do ((i 0 (+ i 1))) ((= i 3)) (let ((j (abs x))) (display (+ i j (* 2 j)))))"
	     " do: perhaps (do ((i 0 (+ i 1))) ((= i 3)) (let ((j (abs x))) (display (+ i j (* 2 j))))) ->
                 (do ((i 0 (+ i 1)) (j (abs x) (abs x))) ((= i 3)) (display (+ i j (* 2 j))))")
  (lint-test "(do ((i 0 (+ i 1))) ((= i 3)) (let ((a 12) (b 1)) (set! a (+ a b i)) (display a)))" 
	     " do: perhaps combine these two lines: (set! a (+ a b i)) (display a)
               do: perhaps (do ((i 0 (+ i 1))) ((= i 3)) (let ((a 12) (b 1)) (set! a (+ a b i))... ->
                (do ((i 0 (+ i 1)) (a 12 12) (b 1 1)) ((= i 3)) (set! a (+ a b i)) ...)")
  (lint-test "(do ((i 0 j) (j 1 i) (k 0 (+ k 1))) ((= k 4) (+ i j k)))" 
	     " do: this do loop is unreadable; perhaps (do ((i 0 j) (j 1 i) (k 0 (+ k 1))) ((= k 4) (+ i j k))) ->
                 (let _1_ ((i 0) (j 1) (k 0)) (if (= k 4) (+ i j k) (_1_ j i (+ k 1))))")
  (lint-test "(let ((x (log y))) (do ((i 0 (+ i 1))) ((= i 3)) (display (+ i x))) (abs y))" 
	     " let: perhaps (let ((x (log y))) (do ((i 0 (+ i 1))) ((= i 3)) (display (+ i x))) (abs y)) ->
                 (do ((x (log y)) (i 0 (+ i 1))) ((= i 3) (abs y)) ...)")
  (lint-test "(let ((x (log y))) (do ((i 0 (+ i 1))) ((= i 3)) (display (+ i x))) (abs x))" 
	     " let: perhaps (let ((x (log y))) (do ((i 0 (+ i 1))) ((= i 3)) (display (+ i x))) (abs x)) ->
                 (do ((x (log y)) (i 0 (+ i 1))) ((= i 3) (abs x)) ...)")
  (lint-test "(let ((x (log y))) (do ((i 0 (+ i x))) ((= i 3)) (display i)))" 
	     " let: perhaps (let ((x (log y))) (do ((i 0 (+ i x))) ((= i 3)) (display i))) ->
                 (do ((x (log y)) (i 0 (+ i x))) ...)")
  (lint-test "(let ((x (log y))) (do ((i 0 (+ i 1))) ((= i 3) x) (display i)))" 
	     " let: perhaps (let ((x (log y))) (do ((i 0 (+ i 1))) ((= i 3) x) (display i))) ->
                 (do ((x (log y)) (i 0 (+ i 1))) ...)")
  (lint-test "(let ((x (log y))) (do ((i 0 (+ i 1))) ((= i 3)) (display x)))" 
	     " let: perhaps (let ((x (log y))) (do ((i 0 (+ i 1))) ((= i 3)) (display x))) ->
                 (do ((x (log y)) (i 0 (+ i 1))) ...)")
  (lint-test "(let ((x (log y))) (do () ((= i 3)) (display x)))" 
	     " let: perhaps (let ((x (log y))) (do () ((= i 3)) (display x))) -> (do ((x (log y))) ...)")
  (lint-test "(let ((x (log y)) (z (log w))) (do () ((= i 3)) (display x)) (display x) (cdr v))" 
	     " let: z not used, initially: (log w) from let")
  (lint-test "(let ((x (log y))) (do ((x 0 (+ x 1))) ((= i 3)) (display x)))" 
	     " let: x not used, initially: (log y) from let")
  (lint-test "(let ((a 1)) (do ((i 0 (+ i 1)) (j 0 (+ j 1))) ((= i 3)) (display (+ a i j))) 32)" 
	     " let: perhaps (let ((a 1)) (do ((i 0 (+ i 1)) (j 0 (+ j 1))) ((= i 3)) (display (+ a i... ->
                 (do ((a 1) (i 0 (+ i 1)) (j 0 (+ j 1))) ((= i 3) 32) ...)")
  (lint-test "(let ((x (length y))) (do ((i 0 (+ i 1))) ((= i x)) (display i)))" 
	     " let: perhaps (let ((x (length y))) (do ((i 0 (+ i 1))) ((= i x)) (display i))) -> (do ((x (length y)) (i 0 (+ i 1))) ...)")
  (lint-test "(let ((x (length y))) (do ((i 0 (+ i 1))) ((= i x) (display x)) (display i)) (log x))" 
	     " let: perhaps (let ((x (length y))) (do ((i 0 (+ i 1))) ((= i x) (display x)) (display... ->
                  (do ((x (length y)) (i 0 (+ i 1))) ((= i x) (display x) (log x)) ...)")

  (lint-test "(do ((p lst (cdr p))) ((null? p)) (display (car p)))" 
	     " do: perhaps (do ((p lst (cdr p))) ((null? p)) (display (car p))) -> (for-each (lambda ([p]) (display [p])) lst)")
  (lint-test "(do ((p lst (cdr p))) ((not (pair? p))) (if (cadar p) (display (cdddar p))))" 
	     " do: perhaps (do ((p lst (cdr p))) ((not (pair? p))) (if (cadar p) (display (cdddar p)))) ->
                 (for-each (lambda ([p]) (if (cadr [p]) (display (cdddr [p])))) lst)")
  (lint-test "(do ((i 0 (+ i 1))) ((= i (vector-length x))) (find (vector-ref x i)))"
	     " do: perhaps (do ((i 0 (+ i 1))) ((= i (vector-length x))) (find (vector-ref x i))) -> (for-each (lambda ([x]) (find [x])) x)")
  (lint-test "(let ((n (length v))) (do ((j 0 (+ j 1))) ((= j n)) (let ((x (vector-ref v j))) (f (car x) (cdr x)))))" 
	     " let: perhaps (do ((j 0 (+ j 1))) ((= j n)) (let ((x (vector-ref v j))) (f (car x) (cdr x)))) ->
                 (for-each (lambda ([v]) (let ((x [v])) (f (car x) (cdr x)))) v)
               let: perhaps (let ((n (length v))) (do ((j 0 (+ j 1))) ((= j n)) (let ((x (vector-ref v... ->
                 (do ((n (length v)) (j 0 (+ j 1))) ...)")
  (lint-test "(do ((dist 0.01) (i 0 (+ i 1)) (beg2 (+ beg 2.36) (+ beg2 dist)) (af .1 (* af .85))) ((= i 20)) (savannah-8 beg2 (* amp af)) (set! dist (+ dist .001)))"
	     " do: perhaps (do ((dist 0.01) (i 0 (+ i 1)) (beg2 (+ beg 2.36) (+ beg2 dist)) (af 0.1... ->
                 (do ((dist 0.01) (i 0 (+ i 1)) (beg2 (+ beg 2.36)) (af 0.1 (* af 0.85))) ((= i 20))
                     (savannah-8 beg2 (* amp af)) (set! dist (+ dist 0.001)) (set! beg2 (+ beg2 dist)))")

  (lint-test "(let ((x (f y))) (display x) (define z (f x)) (do ((i 0 (+ i 1))) ((= i 3)) (display (+ x z i))))"
	     " let: the scope of z could be reduced: (... (define z (f x)) (do ((i 0 (+ i 1))) ((= i 3)) (display (+ x z i)))) ->
                 (... (let ((z (f x))) (do ((i 0 (+ i 1))) ((= i 3)) (display (+ x z i)))))
               let: (define z (f x)) occurs in the midst of the body;
                 perhaps use let: (let ((z (f x))) (do ((i 0 (+ i 1))) ((= i 3)) (display (+ x z i))))")
  (lint-test "(let () (display x) (define z (f x)) (do ((i z (+ i 1))) ((= i 3)) (display (+ z i))))" 
	     " let: the scope of z could be reduced: (... (define z (f x)) (do ((i z (+ i 1))) ((= i 3)) (display (+ z i)))) ->
                 (... (let ((z (f x))) (do ((i z (+ i 1))) ((= i 3)) (display (+ z i)))))
               let: (define z (f x)) occurs in the midst of the body;
                 perhaps use let: (let ((z (f x))) (do ((i z (+ i 1))) ((= i 3)) (display (+ z i))))")
  (lint-test "(let () (display x) (define z (f x)) (do ((i z (+ i 1)) (j 0)) ((= i 3)) (display (+ z i))))" 
	     " let: the scope of z could be reduced: (... (define z (f x)) (do ((i z (+ i 1)) (j 0)) ((= i 3)) (display (+ z i)))) ->
                 (... (let ((z (f x))) (do ((i z (+ i 1)) (j 0)) ((= i 3)) (display (+ z i)))))
               let: (define z (f x)) occurs in the midst of the body;
                 perhaps use let: (let ((z (f x))) (do ((i z (+ i 1)) (j 0)) ((= i 3)) (display (+ z i))))
               let: j not used, initially: 0 from do")

  (lint-test "(let ((x (make-vector 3 0)) (y (* 2 x))) (set! x (reverse x)) (vector-ref x y))" 
	     " let: x in (y (* 2 x)) does not appear to be defined in the calling environment
               let: perhaps combine these two lines: (set! x (reverse x)) (vector-ref x y)")
  (lint-test "(let ((x (make-vector 3 0)) (y (* 2 z))) (set! x (reverse x)) (vector-ref x y))" 
	     " let: perhaps (let ((x (make-vector 3 0)) (y (* 2 z))) (set! x (reverse x)) (vector-ref x y)) ->
                 (let ((x (reverse (make-vector 3 0))) (y (* 2 z))) (vector-ref x y))")
  (lint-test "(let ((x (make-vector 3 0)) (y (* 2 z))) (set! x (f x y x)) (vector-ref x y))" "")
  (lint-test "(let ((x (make-vector 3 0)) (y (* 2 z))) (set! x (f x y)))" 
	     " let: perhaps (let ((x (make-vector 3 0)) (y (* 2 z))) (set! x (f x y))) -> (let ((x (make-vector 3 0)) (y (* 2 z))) (f x y))
               let: set! is pointless in (set! x (f x y)): use (f x y)")
  (lint-test "(let ((x (make-vector 3 0))) (set! x (f x y)))" 
	     " let: perhaps (let ((x (make-vector 3 0))) (set! x (f x y))) -> (f (make-vector 3 0) y)
               let: set! is pointless in (set! x (f x y)): use (f x y)")

  ;(lint-test "(byte-vector 3213)"	" byte-vector: byte-vector's argument should be a byte?: 3213: (byte-vector 3213)")
  (lint-test "(make-byte-vector 0)"     " make-byte-vector: perhaps (make-byte-vector 0) -> #u8()")
  (lint-test "(let ())"			" let: let is messed up:  (let ())")
  (lint-test "(let ((x (lambda (a) (x 1)))) x)" 
	     " let: let variable x is called in its binding?  Perhaps let should be letrec: ((x (lambda (a) (x 1))))
               let: perhaps (let ((x (lambda (a) (x 1)))) x) -> (lambda (a) (x 1))")
  (lint-test "(let* ((x 1)) x)"		" let*: let* could be let: (let* ((x 1)) x) let*: perhaps (let* ((x 1)) x) -> 1")
  (lint-test "(let* ((x 1) (x x)) x)"	" let*: let* variable x is declared twice let*: perhaps (let* ((x 1) (x x)) x) -> (let ((x 1)) x)")
  (lint-test "(let* ((x (g g0)) (y (g g0))) (+ x y))" 
	     " let*: perhaps (let* ((x (g g0)) (y (g g0))) (+ x y)) -> (let ((x (g g0))) (+ x (g g0)))")
  (lint-test "(let* ((x 0) (y (g 0))) (+ x y))" 
	     " let*: perhaps (let* ((x 0) (y (g 0))) (+ x y)) -> (let ((x 0)) (+ x (g 0)))")
  (lint-test "(let ((x 0)) (let ((y (g 0))) (+ x y)))" 
	     " let: perhaps (let ((y (g 0))) (+ x y)) -> (+ x (g 0))
               let: perhaps move 'x into the inner let: (let ((x 0)) (let ((y (g 0))) (+ x y))) -> (let ((x 0) (y (g 0))) (+ x y))
               let: perhaps (let ((x 0)) (let ((y (g 0))) (+ x y))) -> (let* ((x 0) (y (g 0))) (+ x y))")

  (lint-test "(let* ((a 1) (b (+ a 1))) (let ((c (+ a b))) (display c)))"
	     " let*: perhaps (let ((c (+ a b))) (display c)) -> (display (+ a b))
               let*: perhaps (let* ((a 1) (b (+ a 1))) (let ((c (+ a b))) (display c))) -> (let* ((a 1) (b (+ a 1)) (c (+ a b))) (display c))")
  (lint-test "(let* ((a 1) (b (+ a 1))) (let* ((c (+ a b)) (d (+ c 1))) (display d)) (display a))" 
	     " let*: perhaps restrict c which is not used in the let* body 
                 (let* ((c (+ a b)) (d (+ c 1))) (display d)) -> (let ((d (let ((c (+ a b))) (+ c 1)))) ...)
               let*: perhaps substitute c into d: (let* ((c (+ a b)) (d (+ c 1))) (display d)) -> (let ((d (+ (+ a b) 1))) ...)
               let*: perhaps (let* ((c (+ a b)) (d (+ c 1))) (display d)) -> (let ((c (+ a b))) (display (+ c 1)))")
  (lint-test "(let* ((a 1) (b (+ a 1))) (let ((c (+ a b)) (d a)) (display (+ c d))))" 
	     " let*: perhaps (let ((c (+ a b)) (d a)) (display (+ c d))) -> (display (+ (+ a b) a))
               let*: assuming we see all set!s, the binding (d a) is pointless: perhaps (let ((c (+ a b)) (d a)) (display (+ c d))) -> 
                 (let ((c (+ a b))) (display (+ c a)))")
  (lint-test "(let* ((x (log y 2)) (y (log y 2)) (z (f x))) (+ x y z z))" " let*: y's value (log y 2) could be x")
  (lint-test "(let* ((x (log a 2)) (y (log y 2)) (z (log y 2))) (+ x y z z))" 
	     " let*: perhaps split this let*: (let* ((x (log a 2)) (y (log y 2)) (z (log y 2))) (+ x y z z)) ->
                 (let ((y (log y 2))) (let ((x (log a 2)) (z (log y 2))) ...))")
  (lint-test "(let* ((a 12) (b (+ a 1)) (c 20) (d (+ c 1))) (+ b d))"
	     " let*: perhaps restrict a, c which are not used in the let* body 
                 (let* ((a 12) (b (+ a 1)) (c 20) (d (+ c 1))) (+ b d)) -> (let* ((b (let ((a 12)) (+ a 1))) (d (let ((c 20)) (+ c 1)))) ...)
               let*: perhaps split this let*: (let* ((a 12) (b (+ a 1)) (c 20) (d (+ c 1))) (+ b d)) -> (let ((a 12) (c 20)) (let ((b (+ a 1)) (d (+ c 1))) ...))
               let*: perhaps substitute a into b, c into d: (let* ((a 12) (b (+ a 1)) (c 20) (d (+ c 1))) (+ b d)) -> (let* ((b (+ 12 1)) (d (+ 20 1))) ...)
               let*: perhaps (let* ((a 12) (b (+ a 1)) (c 20) (d (+ c 1))) (+ b d)) -> (let* ((a 12) (b (+ a 1)) (c 20)) (+ b (+ c 1)))")
  (lint-test "(let ((a 1)) (let ((b (+ a 1))) (+ a b)))" 
	     " let: perhaps (let ((b (+ a 1))) (+ a b)) -> (+ a (+ a 1))
               let: perhaps (let ((a 1)) (let ((b (+ a 1))) (+ a b))) -> (let* ((a 1) (b (+ a 1))) (+ a b))")
  (lint-test "(let ((a 1)) (let ((b 2)) (+ a b)))" 
	     " let: perhaps (let ((b 2)) (+ a b)) -> (+ a 2)
               let: perhaps move 'a into the inner let: (let ((a 1)) (let ((b 2)) (+ a b))) -> (let ((a 1) (b 2)) (+ a b))
               let: perhaps (let ((a 1)) (let ((b 2)) (+ a b))) -> (let ((a 1) (b 2)) (+ a b))")
  (lint-test "(let ((a 1)) (let* ((b (+ a 1)) (c (* b 2))) (display (+ a b c))))" 
	     " let: perhaps (let* ((b (+ a 1)) (c (* b 2))) (display (+ a b c))) -> (let ((b (+ a 1))) (display (+ a b (* b 2))))
               let: perhaps (let ((a 1)) (let* ((b (+ a 1)) (c (* b 2))) (display (+ a b c)))) ->
                 (let* ((a 1) (b (+ a 1)) (c (* b 2))) (display (+ a b c)))")
  (lint-test "(let ((x 1) (y 2)) (set! x (* y 2)) x)" 
	     " let: set! returns the new value, so this could be omitted: x
               let: perhaps (let ((x 1) (y 2)) (set! x (* y 2)) x) -> (let ((y 2)) (* y 2))")
  (lint-test "(let ((x (read-byte)) (y 2)) (set! x (* y x)) x)" 
	     " let: set! returns the new value, so this could be omitted: x
               let: perhaps (let ((x (read-byte)) (y 2)) (set! x (* y x)) x) -> (let ((x (read-byte)) (y 2)) (* y x))")
  (lint-test "(let ((x (read-byte)) (y 2)) (set! x (* y 2)))" 
	     " let: x set, but not used: (set! x (* y 2))
               let: perhaps (let ((x (read-byte)) (y 2)) (set! x (* y 2))) -> (let ((x (read-byte)) (y 2)) (* y 2))
               let: set! is pointless in (set! x (* y 2)): use (* y 2)")
  (lint-test "(let ((x 1) (y 2)) (set! x (* y x)) x)" 
	     " let: set! returns the new value, so this could be omitted: x
               let: perhaps (let ((x 1) (y 2)) (set! x (* y x)) x) -> (let ((x 1) (y 2)) (* y x))")
  (lint-test "(let ((x 1)) (set! x (* 2 x)) x)" 
	     " let: set! returns the new value, so this could be omitted: x
               let: perhaps (let ((x 1)) (set! x (* 2 x)) x) -> (let ((x (* 2 1))) x)")
  (lint-test "(let ((x 1)) (set! x 2) x)" 
	     " let: set! returns the new value, so this could be omitted: x
               let: perhaps (let ((x 1)) (set! x 2) x) -> (let ((x 2)) x)")
  (lint-test "(let ((x 1) (y (f g 2))) (let loop ((a (+ x 1)) (b y)) (loop a b)))" 
	     " let: perhaps (let ((x 1) (y (f g 2))) (let loop ((a (+ x 1)) (b y)) (loop a b))) -> (let loop ((a (+ 1 1)) (b (f g 2))) (loop a b))")
  (lint-test "(let loop ((i 0)) (+ i 1))" " let: loop not used, value: (let loop ((i 0)) (+ i 1))")

  (lint-test "(let () (define x 43) (display (+ x x)))" 
	     " let: perhaps (let () (define x 43) (display (+ x x))) -> (let ((x 43)) ...)")
  (lint-test "(let ((x 43)) (define y 44) (display (+ x y)))" 
	     " let: perhaps (let ((x 43)) (define y 44) (display (+ x y))) -> (let ((x 43) (y 44)) ...)")
  (lint-test "(lambda () (let ((x 43)) (define y 44) (display (+ x y))))" 
	     " lambda: y can be moved to lambda's closure
               lambda: x can be moved to lambda's closure
               lambda: perhaps (let ((x 43)) (define y 44) (display (+ x y))) -> (let ((x 43) (y 44)) ...)")
  (lint-test "(let () (define x 3) (define (y a) a) (g z))" 
	     " let: perhaps (... (define x 3) (define (y a) a) (g z)) -> (... (let ((x 3)) ...))
               let: y not used, value: (define (y a) a)
               let: x not used, initially: 3 from define
               let: perhaps (let () (define x 3) (define (y a) a) (g z)) -> (let ((x 3)) ...)")
  (lint-test "(let* ((x y) (a (* 2 x))) (+ (f a (+ a 1)) (* 3 x)))" 
	     " let*: assuming we see all set!s, the binding (x y) is pointless: perhaps (let* ((x y) (a (* 2 x))) (+ (f a (+ a 1)) (* 3 x))) ->
                 (let ((a (* 2 y))) (+ (f a (+ a 1)) (* 3 y)))")
  (lint-test "(let* ((x y) (a (* 2 (+ x y)))) (+ (f a (+ a 1)) (* 3 x)))" 
	     " let*: assuming we see all set!s, the binding (x y) is pointless: perhaps (let* ((x y) (a (* 2 (+ x y)))) (+ (f a (+ a 1)) (* 3 x))) ->
                 (let ((a (* 2 (+ y y)))) (+ (f a (+ a 1)) (* 3 y)))")
  (lint-test "(let* ((x y) (a (* 2 x))) (set! x (* 3 x)) (+ (f a (+ a 1)) (* 3 x)))" "")
  (lint-test "(let* ((x y) (a (* 2 x))) (set! y (* 3 x)) (+ (f a (+ a 1)) (* 3 x)))" "")
  (lint-test "(let* ((x y) (a (* 2 x))) (cons (push! a x) (* 3 x)))" "")
  (lint-test "(let* ((x y) (a (* 2 x))) (cons (push! a y) (* 3 x)))" "")
  (lint-test "(let ((x y) (a (* 2 y))) (+ (f a (+ a 1)) (* 3 x)))" 
	     " let: assuming we see all set!s, the binding (x y) is pointless: perhaps (let ((x y) (a (* 2 y))) (+ (f a (+ a 1)) (* 3 x))) ->
                (let ((a (* 2 y))) (+ (f a (+ a 1)) (* 3 y)))")
  (lint-test "(let ((x y) (a (* 2 y))) (+ (f a (+ a 1)) (* 3 y x)))" 
	     " let: assuming we see all set!s, the binding (x y) is pointless: perhaps (let ((x y) (a (* 2 y))) (+ (f a (+ a 1)) (* 3 y x))) ->
                (let ((a (* 2 y))) (+ (f a (+ a 1)) (* 3 y y)))")
  (lint-test "(let ((x y) (a (* 2 y))) (set! x (* 3 x)) (+ (f a (+ a 1)) (* 3 x)))" 
	     " let: perhaps (let ((x y) (a (* 2 y))) (set! x (* 3 x)) (+ (f a (+ a 1)) (* 3 x))) ->
                (let ((x (* 3 y)) (a (* 2 y))) (+ (f a (+ a 1)) (* 3 x)))")
  (lint-test "(let ((x y) (a (* 2 y))) (set! y (* 3 x)) (+ (f a (+ a 1)) (* 3 x)))" 
	     " let: x is not set, and is always accessed via (* 3 x) so its binding could probably be (x (* 3 y)) in 
                 (let ((x y) (a (* 2 y))) (set! y (* 3 x)) (+ (f a (+ a 1)) (* 3 x)))")

  (lint-test "(let ((old-x x)) (set! x 12) (display (log x)) (set! x old-x))" 
	     " let: perhaps use let-temporarily here: 
                 (let ((old-x x)) (set! x 12) (display (log x)) (set! x old-x)) -> (let-temporarily ((x 12)) (display (log x)))")
  (lint-test "(let ((old-x x)) (set! x 12) (display (log x)) (set! x 1) (set! x old-x))" 
	     " let: this could be omitted: (set! x 1)
               let: perhaps use let-temporarily here: 
                 (let ((old-x x)) (set! x 12) (display (log x)) (set! x 1) (set! x old-x)) -> (let-temporarily ((x 12)) (display (log x)) (set! x 1))")
  (lint-test "(let ((old-x x) (z (f 3))) (set! x z) (display (log x)) (set! x old-x))" 
	     " let: perhaps use let-temporarily here: 
                 (let ((old-x x) (z (f 3))) (set! x z) (display (log x)) (set! x old-x)) -> (let ((z (f 3))) (let-temporarily ((x z)) (display (log x))))")
  (lint-test "(let ((z (f 3)) (old-x x)) (set! x z) (display (log x)) (set! x old-x))" 
	     " let: perhaps use let-temporarily here: 
                 (let ((z (f 3)) (old-x x)) (set! x z) (display (log x)) (set! x old-x)) -> (let ((z (f 3))) (let-temporarily ((x z)) (display (log x))))")
  (lint-test "(let ((old-p (*s7* 'print-length))) (set! (*s7* 'print-length) 32) (display x) (set! (*s7* 'print-length) old-p))" 
	     " let: perhaps use let-temporarily here: (let ((old-p (*s7* 'print-length))) (set! (*s7* 'print-length) 32)... ->
                 (let-temporarily (((*s7* 'print-length) 32)) (display x))")
  (lint-test "(define equalize-panes (let ((equalize-sound (lambda (ind) (let-temporarily (((channel-style ind) channels-combined))))))
                (lambda* (snd) (if snd (equalize-sound snd) (for-each equalize-sound (sounds))))))" "")
  (lint-test "(let-temporarily () 3)" " let-temporarily: let-temporarily with no vars? (let-temporarily () 3)")
  (lint-test "(let-temporarily)" " let-temporarily: let-temporarily is messed up: (let-temporarily)")

  (lint-test "(null? (let ((p (lambda (x) (not ((if (path? obj) path? picture?) x))))) (filt p (cons obj more-objs))))" 
	     " null?: perhaps (null? (let ((p (lambda (x) (not ((if (path? obj) path? picture?) x)))))... ->
                 (let ... (null? (filt p (cons obj more-objs))))")

  (lint-test "(let () (define-constant _cons_ 32) (define (_cons_ a_) (+ 1 a)))" 
	     " let: _cons_ in (define (_cons_ a_) (+ 1 a)) is already a constant, defined 32
               let: let variable _cons_ is declared twice
               let: _cons_ not used, initially: 32 from define-constant")
  (lint-test "(let ((x 32)) (display x) (define-constant x 2) (f x))" " let: let variable x is later redefined as a constant")
  (lint-test "(let ((x 32)) (display x) (define x 2) (f x))"          
	     " let: (define x 2) occurs in the midst of the body; perhaps use let: (let ((x 2)) (f x))
               let: let variable x is redefined in the let body.  Perhaps use set! instead: (set! x 2)")

  (lint-test "(let ((a 1)) (display (f b)) (let ((b 2)) (display (+ a b))) (display c))" 
	     " let: perhaps (let ((b 2)) (display (+ a b))) -> (display (+ a 2))
                let: perhaps move 'a into the inner let: 
                  (let ((a 1)) (display (f b)) (let ((b 2)) (display (+ a b))) (display c)) -> (let ((a 1) (b 2)) (display (+ a b)))")
  (lint-test "(let ((a 1)) (display (f b)) (let ((b (+ a 1))) (display (+ a b))) (display c))" 
	     " let: perhaps (let ((b (+ a 1))) (display (+ a b))) -> (display (+ a (+ a 1)))")
  (lint-test "(let ((a 1)) (f x) (let ((c 0)) (let ((b (+ c a))) (display b)) (let ((b (+ 1 a))) (display b))))" 
	     " let: perhaps (let ((b (+ c a))) (display b)) -> (display (+ c a))
               let: perhaps (let ((b (+ 1 a))) (display b)) -> (display (+ 1 a))
               let: perhaps move 'a into the inner let: 
                 (let ((a 1)) (f x) (let ((c 0)) (let ((b (+ c a))) (display b)) (let ((b... ->
                 (let ((a 1) (c 0)) (let ((b (+ c a))) (display b)) (let ((b (+ 1 a)))...")
  (lint-test "(let ((a 1)) (display (f b)) (let ((b 2)) (do () () (display (+ a b)))) (display c))" 
	     " let: perhaps (let ((b 2)) (do () () (display (+ a b)))) -> (do ((b 2)) ...)")
  (lint-test "(let ((a 1)) (display (f b)) (let ((b 2)) (lambda () (display (+ a b)))) (display c))" 
	     " let: this has no effect: (lambda () (display (+ a b)))")
  (lint-test "(let ((a 1)) (display (f b)) (let ((b 2)) (let loop () (display (+ a b)))) (display c))" 
	     " let: loop not used, value: (let loop () (display (+ a b)))")
  (lint-test "(let* ((x 1) (a 1)) (display (f x)) (let ((b 2)) (display (+ a b))) (display c))" 
	     " let*: let* could be let: (let* ((x 1) (a 1)) (display (f x)) (let ((b 2)) (display (+ a b)))...
               let*: perhaps (let ((b 2)) (display (+ a b))) -> (display (+ a 2))
               let*: perhaps move 'a into the inner let: (let* ((x 1) (a 1)) (display (f x)) (let ((b 2)) (display (+ a b)))... ->
                  (let ((a 1) (b 2)) (display (+ a b)))")
  (lint-test "(lambda () (let ((a 1)) (define (f211 x) (+ x 1)) (display a) (let ((b 2)) (display (f211 (+ a b))))))" 
	      " lambda: the inner function f211 could be moved outside the lambda: (lambda () (let ((a 1)) (define (f211 x) (+ x 1)) (display a) (let ((b 2))... ->
                  (let () (define (f211 x) (+ x 1)) (lambda () ...))
                lambda: perhaps move 'f211 into the inner let: (lambda () (let ((a 1)) (define (f211 x) (+ x 1)) (display a) (let ((b 2))... ->
                  (let ((f211 (lambda (x) (+ x 1))) (b 2)) (display (f211 (+ a b))))
                lambda: a can probably be moved to lambda's closure")
  (lint-test "(let () (let ((a 1)) (let ((f212 (lambda (x) (+ x 1)))) (display a) (let ((b 2)) (display (f212 (+ a b)))))))"
	     " let: pointless let: (let () (let ((a 1)) (let ((f212 (lambda (x) (+ x 1)))) (display a) (let...
               let: perhaps (let ((a 1)) (let ((f212 (lambda (x) (+ x 1)))) (display a) (let ((b 2))... ->
                 (let* ((a 1) (f212 (lambda (x) (+ x 1)))) (display a) ...)")
  (lint-test "(lambda* ((a 1)) (define f213 (lambda (x) (+ x 1))) (let () (display a) (let ((b 2)) (display (f213 (+ a b))))))" 
	     " lambda*: the inner function f213 could be moved outside the lambda*: (lambda* ((a 1)) (define f213 (lambda (x) (+ x 1))) (let () (display a)... ->
                 (let () (define f213 (lambda (x) (+ x 1))) (lambda* ((a 1)) ...))
               lambda*: pointless let: (let () (display a) (let ((b 2)) (display (f213 (+ a b)))))")
  (lint-test "(let ((a 1)) (let ((f214 (lambda (x) (+ x 1))) (f22 (lambda (x) (+ x 2)))) (* a (f214 1) (f22 2))))" 
	     " let: perhaps move 'a into the inner let: (let ((a 1)) (let ((f214 (lambda (x) (+ x 1))) (f22 (lambda (x) (+ x 2))))... ->
                 (let ((a 1) (f214 (lambda (x) (+ x 1))) (f22 (lambda (x) (+ x 2)))) (* a...")
  (lint-test "(define (f216 a) (define (f217 x) (+ x 1)) (display a) (let ((b 2)) (display (f217 (+ a b)))))" 
	     " define: the inner function f217 could be moved to f216's closure: (define (f216 a) (define (f217 x) (+ x 1)) (display a) (let ((b 2))... ->
                 (define f216 (let () (define (f217 x) (+ x 1)) (lambda (a) ...)))
               f216: perhaps move 'f217 into the inner let: (define (f216 a) (define (f217 x) (+ x 1)) (display a) (let ((b 2))... ->
                 (let ((f217 (lambda (x) (+ x 1))) (b 2)) (display (f217 (+ a b))))")
  (lint-test "(define f218 (lambda (a) (define (f219 x) (+ x 1)) (display a) (let ((b 2)) (display (f219 (+ a b))))))"
	     " f218: the inner function f219 could be moved outside the lambda: (lambda (a) (define (f219 x) (+ x 1)) (display a) (let ((b 2)) (display... ->
                 (let () (define (f219 x) (+ x 1)) (lambda (a) ...))
               f218: perhaps move 'f219 into the inner let: (lambda (a) (define (f219 x) (+ x 1)) (display a) (let ((b 2)) (display... ->
                 (let ((f219 (lambda (x) (+ x 1))) (b 2)) (display (f219 (+ a b))))")
  (lint-test "(define f220 (lambda (a) (if x (begin (define (f221 x) (+ x 1)) (display a) (let ((b 2)) (display (f221 (+ a b))))))))"
	     " f220: perhaps move 'f221 into the inner let: (lambda (a) (if x (begin (define (f221 x) (+ x 1)) (display a) (let ((b... ->
                 (let ((f221 (lambda (x) (+ x 1))) (b 2)) (display (f221 (+ a b))))")

  (lint-test "(let* ((x (log y)) (a (+ x 1)) (a (* x 2))) (+ a 1))" 
	     " let*: let* variable a is declared twice
               let*: a not used, initially: (+ x 1) from let*
               let*: perhaps 
                 (let* ((x (log y)) (a (+ x 1)) (a (* x 2))) (+ a 1)) -> (let* ((x (log y)) (a (+ x 1))) (+ (* x 2) 1))")
  (lint-test "(let* ((x (log y)) (a (+ x 1)) (a (* y 2))) (+ a 1))" 
	     " let*: let* variable a is declared twice
               let*: a not used, initially: (+ x 1) from let*
               let*: perhaps restrict x which is not used in the let* body 
                 (let* ((x (log y)) (a (+ x 1)) (a (* y 2))) (+ a 1)) -> (let* ((a (let ((x (log y))) (+ x 1))) (a (* y 2))) ...)
               let*: perhaps substitute x into a: (let* ((x (log y)) (a (+ x 1)) (a (* y 2))) (+ a 1)) -> (let* ((a (+ (log y) 1)) (a (* y 2))) ...)
               let*: perhaps (let* ((x (log y)) (a (+ x 1)) (a (* y 2))) (+ a 1)) -> (let* ((x (log y)) (a (+ x 1))) (+ (* y 2) 1))")
  (lint-test "(let* ((x (log y)) (a (+ y 1)) (a (* x 2))) (+ a 1))" 
	     " let*: let* variable a is declared twice
               let*: a not used, initially: (+ y 1) from let*
               let*: perhaps restrict x which is not used in the let* body 
                 (let* ((x (log y)) (a (+ y 1)) (a (* x 2))) (+ a 1)) -> (let* ((a (+ y 1)) (a (let ((x (log y))) (* x 2)))) ...)
               let*: perhaps (let* ((x (log y)) (a (+ y 1)) (a (* x 2))) (+ a 1)) -> (let* ((x (log y)) (a (+ y 1))) (+ (* x 2) 1))")
  (lint-test "(let* ((x (log y)) (a (+ y 1)) (b (* x a))) (+ b 1))" 
	     " let*: perhaps restrict x, a which are not used in the let* body 
                 (let* ((x (log y)) (a (+ y 1)) (b (* x a))) (+ b 1)) -> (let ((b (let* ((a (+ y 1)) (x (log y))) (* x a)))) ...)
               let*: perhaps substitute a into b: 
                 (let* ((x (log y)) (a (+ y 1)) (b (* x a))) (+ b 1)) -> (let* ((x (log y)) (b (* x (+ y 1)))) ...)
               let*: perhaps 
                 (let* ((x (log y)) (a (+ y 1)) (b (* x a))) (+ b 1)) -> (let* ((x (log y)) (a (+ y 1))) (+ (* x a) 1))")
  (lint-test "(let* ((x (log y)) (a (+ x 1)) (b (* x a))) (+ b 1))" 
	     " let*: perhaps restrict a which is not used in the let* body 
                 (let* ((x (log y)) (a (+ x 1)) (b (* x a))) (+ b 1)) -> (let* ((x (log y)) (b (let ((a (+ x 1))) (* x a)))) ...)
               let*: perhaps substitute a into b: 
                 (let* ((x (log y)) (a (+ x 1)) (b (* x a))) (+ b 1)) -> (let* ((x (log y)) (b (* x (+ x 1)))) ...)
               let*: perhaps 
                 (let* ((x (log y)) (a (+ x 1)) (b (* x a))) (+ b 1)) -> (let* ((x (log y)) (a (+ x 1))) (+ (* x a) 1))")
  (lint-test "(let* ((a (log x)) (b (f100 a))) (* b 2))" 
	     " let*: perhaps restrict a which is not used in the let* body 
                 (let* ((a (log x)) (b (f100 a))) (* b 2)) -> (let ((b (let ((a (log x))) (f100 a)))) ...)
               let*: perhaps substitute a into b: (let* ((a (log x)) (b (f100 a))) (* b 2)) -> (let ((b (f100 (log x)))) ...)
               let*: perhaps (let* ((a (log x)) (b (f100 a))) (* b 2)) -> (let ((a (log x))) (* (f100 a) 2))")
  (lint-test "(let ((a (log x))) (let ((b (+ a 1))) (* b 2)))" 
	     " let: perhaps (let ((b (+ a 1))) (* b 2)) -> (* (+ a 1) 2)
               let: perhaps 
                 (let ((a (log x))) (let ((b (+ a 1))) (* b 2))) -> (let* ((a (log x)) (b (+ a 1))) (* b 2))")
  (lint-test "(let* ((a (log x)) (b (log y)) (c (+ a b))) (* c 2))" 
	     " let*: perhaps restrict a, b which are not used in the let* body 
                 (let* ((a (log x)) (b (log y)) (c (+ a b))) (* c 2)) -> (let ((c (let* ((b (log y)) (a (log x))) (+ a b)))) ...)
               let*: perhaps substitute b into c: 
                 (let* ((a (log x)) (b (log y)) (c (+ a b))) (* c 2)) -> (let* ((a (log x)) (c (+ a (log y)))) ...)
               let*: perhaps 
                 (let* ((a (log x)) (b (log y)) (c (+ a b))) (* c 2)) -> (let* ((a (log x)) (b (log y))) (* (+ a b) 2))")
  (lint-test "(let* ((a (log x)) (b (read)) (c (+ a b))) (* 2 c))" 
	     " let*: perhaps restrict a, b which are not used in the let* body 
                 (let* ((a (log x)) (b (read)) (c (+ a b))) (* 2 c)) -> (let ((c (let* ((b (read)) (a (log x))) (+ a b)))) ...)
               let*: perhaps substitute b into c: 
                 (let* ((a (log x)) (b (read)) (c (+ a b))) (* 2 c)) -> (let* ((a (log x)) (c (+ a (read)))) ...)
               let*: perhaps 
                 (let* ((a (log x)) (b (read)) (c (+ a b))) (* 2 c)) -> (let* ((a (log x)) (b (read))) (* 2 (+ a b)))")
  (lint-test "(let* ((a (read)) (b (read)) (c (+ a b))) (* 2 c))" 
	     " let*: perhaps restrict b which is not used in the let* body 
                 (let* ((a (read)) (b (read)) (c (+ a b))) (* 2 c)) -> (let* ((a (read)) (c (let ((b (read))) (+ a b)))) ...)
               let*: perhaps substitute b into c: 
                 (let* ((a (read)) (b (read)) (c (+ a b))) (* 2 c)) -> (let* ((a (read)) (c (+ a (read)))) ...)
               let*: perhaps 
                 (let* ((a (read)) (b (read)) (c (+ a b))) (* 2 c)) -> (let* ((a (read)) (b (read))) (* 2 (+ a b)))")
  (lint-test "(let ((x (log y))) (let ((z (+ x y))) (* z 2)))" 
	     " let: perhaps (let ((z (+ x y))) (* z 2)) -> (* (+ x y) 2)
                let: perhaps (let ((x (log y))) (let ((z (+ x y))) (* z 2))) -> (let* ((x (log y)) (z (+ x y))) (* z 2))")
  (lint-test "(let* ((a (read)) (b (read)) (c (* a 2))) (+ c b))" 
	     " let*: perhaps (let* ((a (read)) (b (read)) (c (* a 2))) (+ c b)) -> (let* ((a (read)) (b (read))) (+ (* a 2) b))")
  (lint-test "(let* ((a (read)) (b (read)) (c (* b 2)) (d (* a 2))) (+ c d))" 
	     " let*: perhaps restrict b which is not used in the let* body 
                 (let* ((a (read)) (b (read)) (c (* b 2)) (d (* a 2))) (+ c d)) -> (let* ((a (read)) (c (let ((b (read))) (* b 2))) (d (* a 2))) ...)
               let*: perhaps split this let*: (let* ((a (read)) (b (read)) (c (* b 2)) (d (* a 2))) (+ c d)) ->
                 (let* ((a (read)) (b (read))) (let ((c (* b 2)) (d (* a 2))) ...))
               let*: perhaps substitute b into c: 
                 (let* ((a (read)) (b (read)) (c (* b 2)) (d (* a 2))) (+ c d)) -> (let* ((a (read)) (c (* (read) 2)) (d (* a 2))) ...)
               let*: perhaps 
                 (let* ((a (read)) (b (read)) (c (* b 2)) (d (* a 2))) (+ c d)) -> (let* ((a (read)) (b (read)) (c (* b 2))) (+ c (* a 2)))")
  (lint-test "(let* ((x (f a)) (y (car x)) (z (cadr x)) (w (caddr x))) (g x y z w))" 
	     " let*: perhaps split this let*: (let* ((x (f a)) (y (car x)) (z (cadr x)) (w (caddr x))) (g x y z w)) ->
                 (let ((x (f a))) (let ((y (car x)) (z (cadr x)) (w (caddr x))) ...))
               let*: perhaps (let* ((x (f a)) (y (car x)) (z (cadr x)) (w (caddr x))) (g x y z w)) ->
                 (let* ((x (f a)) (y (car x)) (z (cadr x))) (g x y z (caddr x)))")
  (lint-test "(let* ((x (f a)) (y (car x)) (x (cadr x)) (w (caddr x))) (g x y z w))" 
	     " let*: let* variable x is declared twice
               let*: perhaps (let* ((x (f a)) (y (car x)) (x (cadr x)) (w (caddr x))) (g x y z w)) ->
                 (let* ((x (f a)) (y (car x)) (x (cadr x))) (g x y z (caddr x)))")
  (lint-test "(let* ((x (f a)) (y (display x)) (z (cadr x)) (w (caddr x))) (g x y z w))" 
	     " let*: perhaps split this let*: (let* ((x (f a)) (y (display x)) (z (cadr x)) (w (caddr x))) (g x y z w)) ->
                 (let* ((x (f a)) (y (display x))) (let ((z (cadr x)) (w (caddr x))) ...))
               let*: perhaps (let* ((x (f a)) (y (display x)) (z (cadr x)) (w (caddr x))) (g x y z w)) ->
                 (let* ((x (f a)) (y (display x)) (z (cadr x))) (g x y z (caddr x)))")

  (lint-test "(let* ((a 1)) (do ((i a (+ i 1))) ((= i 3)) (display i)))" 
	     " let*: let* could be let: (let* ((a 1)) (do ((i a (+ i 1))) ((= i 3)) (display i)))")
  (lint-test "(let* ((z (log w)) (x (log z))) (do ((i 0 (+ x z))) ((= i 3)) (display x)))" 
	     " let*: perhaps (let* ((z (log w)) (x (log z))) (do ((i 0 (+ x z))) ((= i 3)) (display x))) ->
                 (let ((z (log w))) (do ((x (log z)) (i 0 (+ x z))) ...))")
  (lint-test "(let* ((x (log z))) (do ((i 0 (+ x z))) ((= i 3)) (display x)))" 
	      " let*: let* could be let: (let* ((x (log z))) (do ((i 0 (+ x z))) ((= i 3)) (display x)))
                let*: perhaps (let* ((x (log z))) (do ((i 0 (+ x z))) ((= i 3)) (display x))) -> (do ((x (log z)) (i 0 (+ x z))) ...)")
  (lint-test "(let* ((a (log b)) (z (log w)) (x (log z))) (do ((i 0 (+ x z a))) ((= i 3)) (display x)))" 
	     " let*: perhaps split this let*: (let* ((a (log b)) (z (log w)) (x (log z))) (do ((i 0 (+ x z a))) ((= i... ->
                 (let ((z (log w))) (let ((a (log b)) (x (log z))) ...))
               let*: perhaps (let* ((a (log b)) (z (log w)) (x (log z))) (do ((i 0 (+ x z a))) ((= i... ->
                 (let* ((a (log b)) (z (log w))) (do ((x (log z)) (i 0 (+ x z a))) ...))")
  (lint-test "(let* ((z (log w)) (x (log z))) (do () ((= i 3) z) (display x)))" 
	     " let*: perhaps (let* ((z (log w)) (x (log z))) (do () ((= i 3) z) (display x))) -> (let ((z (log w))) (do ((x (log z))) ...))")
  (lint-test "(let* ((x (log z))) (do () ((= i 3) z) (display x)))" 
	     " let*: let* could be let: (let* ((x (log z))) (do () ((= i 3) z) (display x)))
               let*: perhaps (let* ((x (log z))) (do () ((= i 3) z) (display x))) -> (do ((x (log z))) ...)")
  (lint-test "(let* ((a (log b)) (z (log w)) (x (log z))) (do () ((= i 3) (+ a z)) (display x)))"
	      " let*: perhaps split this let*: 
                  (let* ((a (log b)) (z (log w)) (x (log z))) (do () ((= i 3) (+ a z))... -> (let ((z (log w))) (let ((a (log b)) (x (log z))) ...))
                let*: perhaps (let* ((a (log b)) (z (log w)) (x (log z))) (do () ((= i 3) (+ a z))... ->
                  (let* ((a (log b)) (z (log w))) (do ((x (log z))) ...))")

  (lint-test "(let* ((a 1) (b (f a)) (c 2) (e 0) (d (g (+ a b c)))) (display d) (* a b c d e))" 
	     " let*: perhaps split this let*: (let* ((a 1) (b (f a)) (c 2) (e 0) (d (g (+ a b c)))) (display d) (* a b c... ->
                 (let ((a 1) (c 2) (e 0)) (let* ((b (f a)) (d (g (+ a b c)))) ...))")
  (lint-test "(let* ((a 1) (b (f a)) (c 2) (d (g (+ a b c))) (e (+ d 1))) (display d) (* a b c d e))"
	     " let*: perhaps split this let*: (let* ((a 1) (b (f a)) (c 2) (d (g (+ a b c))) (e (+ d 1))) (display d) (*... ->
                 (let ((a 1) (c 2)) (let* ((b (f a)) (d (g (+ a b c))) (e (+ d 1))) ...))")
  (lint-test "(let* ((a 1) (b (f a)) (c 2) (d (g (+ a b c))) (e (+ d 1)) (f (+ d 2))) (display d) (* a b c d e f))" 
	     " let*: perhaps split this let*: (let* ((a 1) (b (f a)) (c 2) (d (g (+ a b c))) (e (+ d 1)) (f (+ d 2)))... ->
                 (let ((a 1) (c 2)) (let* ((b (f a)) (d (g (+ a b c)))) (let ((e (+ d 1)) (f (+ d 2))) ...)))")
  (lint-test "(let* ((a 1) (b (f a)) (d (g (+ a b c))) (e (+ d 1)) (f (+ d 2))) (display d) (* a b d e f))"
	     " let*: perhaps split this let*: (let* ((a 1) (b (f a)) (d (g (+ a b c))) (e (+ d 1)) (f (+ d 2))) (display... ->
                 (let* ((a 1) (b (f a)) (d (g (+ a b c)))) (let ((e (+ d 1)) (f (+ d 2))) ...))")
  (lint-test "(let* ((a 1) (b (f a)) (d 3) (e (+ d 1)) (f (+ d 2))) (display d) (* a b d e f))" 
	     " let*: perhaps split this let*: 
                 (let* ((a 1) (b (f a)) (d 3) (e (+ d 1)) (f (+ d 2))) (display d) (* a b d... ->
                 (let ((a 1) (d 3)) (let ((b (f a))) (let ((e (+ d 1)) (f (+ d 2))) ...)))")
  (lint-test "(let* ((a 1) (d 3) (e (+ d 1)) (f (+ d 2))) (display d) (* a d e f))" 
	     " let*: perhaps split this let*: (let* ((a 1) (d 3) (e (+ d 1)) (f (+ d 2))) (display d) (* a d e f)) ->
                 (let ((a 1) (d 3)) (let ((e (+ d 1)) (f (+ d 2))) ...))")
  (lint-test "(let* ((d 3) (e (+ d 1)) (f (+ d 2))) (display d) (* d e f))" 
	     " let*: perhaps split this let*: (let* ((d 3) (e (+ d 1)) (f (+ d 2))) (display d) (* d e f)) ->
                 (let ((d 3)) (let ((e (+ d 1)) (f (+ d 2))) ...))")
  (lint-test "(let* ((d 3) (e (+ d 1))) (display d) (* d e))" "")
  (lint-test "(let* ((a 3) (b (set! c 1)) (c 3))  (display a) (* a b c))" 
	     " let*: perhaps split this let*: (let* ((a 3) (b (set! c 1)) (c 3)) (display a) (* a b c)) ->
                 (let ((b (set! c 1))) (let ((a 3) (c 3)) ...))")
  (lint-test "(let* ((f 3) (a (set! c 1)) (c 3) (b 4) (d 5))  (display a) (* a c b d f))" 
	     " let*: perhaps split this let*: (let* ((f 3) (a (set! c 1)) (c 3) (b 4) (d 5)) (display a) (* a c b d f)) ->
                 (let ((f 3) (b 4) (d 5)) (let* ((a (set! c 1)) (c 3)) ...))")
  (lint-test "(let* ((f (+ a 1)) (a (+ c 1)) (c 3)) (display a) (* a c f))" "")
  
  (lint-test "(letrec () 1)"		" letrec: letrec could be let: (letrec () 1)")
  (lint-test "(letrec* ((a (lambda b (a 1)))) a)" " letrec*: letrec* could be letrec: (letrec* ((a (lambda b (a 1)))) a)")
  (lint-test "(letrec* ((x 12) (x y)) x)" 
	     " letrec*: letrec* could be let*: (letrec* ((x 12) (x y)) x)
               letrec*: letrec* variable x is declared twice
               letrec*: x not used, initially: 12 from letrec*")
  (lint-test "(letrec ((x x)) x)"       " letrec: (x x) is the same as (x #<undefined>) in letrec")
  (lint-test "(letrec* ((x x)) x)"      
	     " letrec*: letrec* could be letrec: (letrec* ((x x)) x) letrec*: (x x) is the same as (x #<undefined>) in letrec*")
  (lint-test "(letrec* ((x 1) (y (log 2))) (+ (g x) y))" " letrec*: letrec* could be let: (letrec* ((x 1) (y (log 2))) (+ (g x) y))")
  (lint-test "(letrec ((f (lambda (z) (+ (f z) 1)))) (lambda (x) (* (f x) x)))" 
	     " letrec: perhaps (letrec ((f (lambda (z) (+ (f z) 1)))) (lambda (x) (* (f x) x))) -> (lambda (x) (* (let f ((z x)) (+ (f z) 1)) x))")

  (lint-test "(begin . 1)"		" begin: stray dot in begin?        (begin . 1)")
  (lint-test "(begin (map abs x) #f)"	" begin: this could be omitted: (map abs x)")
  (lint-test "(begin (map display x) #f)" " begin: map could be for-each: (for-each display x)")
  (lint-test "(begin 1 #f)"		" begin: this could be omitted: 1")
  (lint-test "(begin (+ x y) 3)"	" begin: this could be omitted: (+ x y)")
  (lint-test "(begin (display 1) (begin #f))" " begin: redundant begin: (begin #f)  begin: begin could be omitted: (begin #f)")
  (lint-test "(begin (lambda (x) (log x 4)) 32)" " begin: this has no effect: (lambda (x) (log x 4))")

  (lint-test "(let () (display 1) (begin (display 1) #f))" 
	     " let: let could be begin: (let () (display 1) (begin (display 1) #f)) -> (begin (display 1) (begin (display 1) #f))
               let: redundant begin: (begin (display 1) #f)")
  (lint-test "(if (< x 1) (begin x) y)" " if: begin could be omitted: (begin x)")
  (lint-test "(if (< x 1) (begin (display 1) x) y)" "")
  (lint-test "(let ((menu (lw6-current-menu))) (if menu (begin #f)))" 
	     " let: perhaps (let ((menu (lw6-current-menu))) (if menu (begin #f))) -> (if (lw6-current-menu) (begin #f))
               let: begin could be omitted: (begin #f)")
  (lint-test "(let ((menu (lw6-current-menu))) (when menu (begin #f)))" 
	     " let: perhaps (let ((menu (lw6-current-menu))) (when menu (begin #f))) -> (when (lw6-current-menu) (begin #f))
               let: redundant begin: (begin #f)
               let: begin could be omitted: (begin #f)")
  (lint-test "(let ((vec (vector-ref matrix x))) (if vec (vector-set! (vector-ref matrix x) y value)))"
	     " let: perhaps (let ((vec (vector-ref matrix x))) (if vec (vector-set! (vector-ref matrix... ->
                 (if (vector-ref matrix x) (vector-set! (vector-ref matrix x) y value))
               let: perhaps (vector-set! (vector-ref matrix x) y value) -> (set! (matrix x y) value)")
  (lint-test "(let ((menu (g-menu))) (if menu (display #f)) 32)" 
	     " let: perhaps (let ((menu (g-menu))) (if menu (display #f)) 32) -> (let () (if (g-menu) (display #f)) 32)")
  (lint-test "(let ((menu (g-menu))) (cond (menu (display menu)) (else (display x))) 32)" 
	     " let: perhaps (let ((menu (g-menu))) (cond (menu (display menu)) (else (display x))) 32) -> (let () (cond ((g-menu) => display) (else (display x))) 32)
               let: perhaps (cond (menu (display menu)) (else (display x))) -> (display (if menu menu x))
               let: perhaps use => here: (menu (display menu)) -> (menu => display)")
  (lint-test "(let ((A (abs x)) (B (abs y))) (if A (f A)))" 
	     " let: perhaps (let ((A (abs x)) (B (abs y))) (if A (f A))) -> (let ((B (abs y))) (cond ((abs x) => f)))
               let: B not used, initially: (abs y) from let
               let: A is never #f, so (if A (f A)) -> (f A)")

  (lint-test "(format)"			" format: format needs at least 1 argument: (format)  format: format has too few arguments: (format)")
  (lint-test "(format \"buffer?\")"    " format: perhaps (format \"buffer?\") -> \"buffer?\"")
  (lint-test "(format (format #f str))" " format: redundant format:  (format (format #f str))")
  (lint-test "(format #f \"~H\" 1)"	" format: unrecognized format directive: H in \"~H\", (format #f \"~H\" 1)")
  (lint-test "(format #f \"~^\")"	" format: ~^ has ~^ outside ~{~}?")
  (lint-test "(format #f \"~A\")"	" format: format has too few arguments: (format #f \"~A\")")
  (lint-test "(format #f \"~A\" 1 2)"	" format: format has too many arguments: (format #f \"~A\" 1 2)")
  (lint-test "(format #f \"asdf~\")"	" format: format control string ends in tilde: (format #f \"asdf~\")")
  (lint-test "(format #f \"~{~A\" 1)"	" format: format has 1 unmatched {: (format #f \"~{~A\" 1)")
  (lint-test "(format #f \"123\")"	" format: (format #f \"123\") could be \"123\", (format is a no-op here)")
  (lint-test "(format #f \"~nD\" 1 2)"	"")
  (lint-test "(format #f \"~n,nD\" 1 2 3)" "")
  (lint-test "(format #f \"~%~&\")"     " format: ~%~& in ~%~& could be ~%")
  (lint-test "(format #f \"~~%~&\")"    "")
  (lint-test "(format #f \"1~%~&2\")"   " format: ~%~& in 1~%~&2 could be ~%")
  (lint-test "(format #f \"~nT\" 1 2)"	" format: format has too many arguments: (format #f \"~nT\" 1 2)")
  (lint-test "(format #f \"~nD\" 1)"	" format: format has too few arguments: (format #f \"~nD\" 1)")
  (lint-test "(format 1)"		" format: format with one argument takes a string:  (format 1)")
  (lint-test "(format #f \"~NC ~W\" 1 #\\c 2)" "")
  (lint-test "(format #f \"~4,3F\" x)"  "")
  (lint-test "(format #f \"~32T\")"     "")
  (lint-test "(format #f \"~a\\x00;b\" x)" 
	     " format: #\\null in a format control string will confuse both lint and format: \"~a\\x00;b\" in (format #f \"~a\\x00;b\" x)")
  (lint-test "(let () (format #t \"~A\" x) x)" 
	     " let: let could be begin: (let () (format #t \"~A\" x) x) -> (begin (format #t \"~A\" x) x)
               let: perhaps use () with format since the string value is discarded: (format () \"~A\" x)")
  (lint-test "(format #f \"~A\" (number->string x))" " format: format arg (number->string x) could be x")
  (lint-test "(format #f \"~A\" (number->string x 16))" 
	     " format: format arg (number->string x 16) could use the format directive ~X and change the argument to x")
  (lint-test "(format #f \"~A\" (symbol->string 'x))"  
	     " format: format arg (symbol->string 'x) could be 'x  format: perhaps (symbol->string 'x) -> \"x\"")
  (lint-test "(format #f \"~A\" (make-string len c))"  
	     " format: format arg (make-string len c) could use the format directive ~NC and change the argument to ... len c ...")
  (lint-test "(format #f \"~A\" (make-string len #\\space))"  
	     " format: format arg (make-string len #\\space) could use the format directive ~NC and change the argument to ... len #\\space ...")
  (lint-test "(f \"*****************************\")" " f: perhaps \"*****************************\" -> (format #f \"~NC\" 29 #\\*)")
  (lint-test "(format #f \"~A~%\" (apply string-append x))" " format: use ~{...~} rather than string-append: (apply string-append x)")
  (lint-test "(format #f \"~A\" (symbol->string x))" " format: format arg (symbol->string x) could be x")
  (lint-test "(format #f \"~S\" (symbol->string x))" "")
  (lint-test "(format #f \"~A\" (string->symbol x))" 
	     " format: perhaps (format #f \"~A\" (string->symbol x)) -> (object->string (string->symbol x) #f)
               format: format arg (string->symbol x) could be x")
  (lint-test "(format #f \"~A\" x)" " format: perhaps (format #f \"~A\" x) -> (object->string x #f)")
  (lint-test "(format #f \"~S\" x)" " format: perhaps (format #f \"~S\" x) -> (object->string x)")
  (lint-test "(format t \" \")" " format: 't in (format t \" \") should probably be #t")
  (lint-test "(format #f \"~A ~S\" (symbol->string x) (string->symbol x))" " format: format arg (symbol->string x) could be x")
  (lint-test "(format #f \"~S~A\" (symbol->string x) (string->symbol x))" " format: format arg (string->symbol x) could be x")

  (lint-test "(for-each (lambda (x) (display x)) args)" 
	     " for-each: perhaps (for-each (lambda (x) (display x)) args) -> (format () \"~{~A~}\" args) for-each: perhaps (lambda (x) (display x)) -> display")
  (lint-test "(for-each (lambda (x) (display #\\space) (write x)) args)" 
	     " for-each: perhaps (for-each (lambda (x) (display #\\space) (write x)) args) -> (format () \"~{ ~S~}\" args)")
  (lint-test "(for-each (lambda (x) (newline port) (write-char x port)) args)" 
	     " for-each: perhaps (for-each (lambda (x) (newline port) (write-char x port)) args) -> (format port \"~{~%~C~}\" args)")
  (lint-test "(for-each (lambda (x) (newline port) (display (number->string x 16) port)) args)" 
	     " for-each: perhaps (for-each (lambda (x) (newline port) (display (number->string x 16) port))... -> (format port \"~{~%~X~}\" args)")
  (lint-test "(values 1)"               " values: perhaps (values 1) -> 1")
  (lint-test "(call-with-values p c)"                    " call-with-values: perhaps (call-with-values p c) -> (c (p))")
  (lint-test "(call-with-values log c)"                  " call-with-values: log does not return multiple values")
  (lint-test "(call-with-values (lambda x 0) list)"      " call-with-values: (lambda x 0)'s parameter x will always be ()")
  (lint-test "(call-with-values (lambda (x) 0) list)"    " call-with-values: (lambda (x) 0) requires too many arguments")
  (lint-test "(call-with-values (lambda () (f x)) cons)" " call-with-values: perhaps (call-with-values (lambda () (f x)) cons) -> (cons (f x))")
  (lint-test "(call-with-values (lambda () (read-char p)) cons)" " call-with-values: (read-char p) does not return multiple values")
  (lint-test "(call-with-values (lambda () (values 1 2 3)) list)" 
	     " call-with-values: perhaps (call-with-values (lambda () (values 1 2 3)) list) -> (list 1 2 3)")
  (lint-test "(call-with-values (lambda () (values 1 2)) abs)" 
	     " call-with-values: call-with-values consumer abs wants 1 value, but producer (lambda () (values 1 2)) returns 2
               call-with-values: perhaps (call-with-values (lambda () (values 1 2)) abs) -> (abs 1 2)")

  (lint-test "(let () (define (fv a) (values (+ a 1) (- a 1))) (define (fw a b) (list (+ a 1) b)) (fw (fv 1)))" "")
  (lint-test "(let () (define (fv a) (values (+ a 1) (- a 1))) (list (fv 1)))" 
	     " let: perhaps (... (define (fv a) (values (+ a 1) (- a 1))) (list (fv 1))) -> (... (list (let ((a 1)) (values (+ a 1) (- a 1)))))")
  (unless (provided? 'snd)
    (lint-test "(let () (define (fv) (values 1 -1)) (call-with-values fv list))" 
	       " let: perhaps (call-with-values fv list) -> (list (fv))")
    (lint-test "(let () (define (fv) (values 1 -1)) (define (fw a b) (list (+ a 1) b)) (call-with-values fv fw))"
	       " let: perhaps (call-with-values fv fw) -> (fw (fv))"))
  (lint-test "(receive (value submitter) (current-input-status elt) #f)"
	     " receive: perhaps (call-with-values (lambda () (current-input-status elt)) (lambda (value... ->
                ((lambda (value submitter) #f) (current-input-status elt))")

  (lint-test "(multiple-value-bind (a b) (f) b)" 
	     " multiple-value-bind: perhaps (multiple-value-bind (a b) (f) b) -> ((lambda (a b) b) (f))")	     
  (lint-test "(multiple-value-bind (a b) (values 2 3) b)" 
	     " multiple-value-bind: perhaps (multiple-value-bind (a b) (values 2 3) b) -> ((lambda (a b) b) (values 2 3))")
  (lint-test "(multiple-value-bind (a b c d) (values 2 (values 3 4) 5) (+ a b c d))" 
	     " multiple-value-bind: perhaps (multiple-value-bind (a b c d) (values 2 (values 3 4) 5) (+ a b c d)) ->
                 ((lambda (a b c d) (+ a b c d)) (values 2 (values 3 4) 5))
	       multiple-value-bind: perhaps (values 2 (values 3 4) 5) -> (values 2 3 4 5)")
  (lint-test "(multiple-value-bind (a b) (values 1 2 3) b)" 
	     " multiple-value-bind: multiple-value-bind wants 2 values, but (values 1 2 3) returns 3
               multiple-value-bind: perhaps (multiple-value-bind (a b) (values 1 2 3) b) -> ((lambda (a b) b) (values 1 2 3))")
  (lint-test "(multiple-value-bind (a b) (f) (cons a b))"   
	     " multiple-value-bind: perhaps (multiple-value-bind (a b) (f) (cons a b)) -> (cons (f))")
  (lint-test "(multiple-value-bind (a b) (values 1 2) (cons a b))" 
	     " multiple-value-bind: perhaps (multiple-value-bind (a b) (values 1 2) (cons a b)) -> (cons (values 1 2))")
  (lint-test "(multiple-value-bind (a b) (f) b)" " multiple-value-bind: perhaps (multiple-value-bind (a b) (f) b) -> ((lambda (a b) b) (f))")

  (lint-test "(let () (define (f1) (values 2 3 4)) (multiple-value-bind (a b) (f1) (+ a b)))" 
	     " let: perhaps (... (define (f1) (values 2 3 4)) (multiple-value-bind (a b) (f1) (+ a b))) ->
                 (... (multiple-value-bind (a b) (values 2 3 4) (+ a b)))
               let: multiple-value-bind wants 2 values, but (f1) returns 3
               let: perhaps (multiple-value-bind (a b) (f1) (+ a b)) -> ((lambda (a b) (+ a b)) (f1))")
  (lint-test "(let () (define (f1) (values 2)) (multiple-value-bind (a b) (f1) (+ a b)))"
	     " let: perhaps (... (define (f1) (values 2)) (multiple-value-bind (a b) (f1) (+ a b))) ->
                 (... (multiple-value-bind (a b) (values 2) (+ a b)))
               f1: perhaps (values 2) -> 2
               let: multiple-value-bind wants 2 values, but (f1) returns 1
               let: perhaps (multiple-value-bind (a b) (f1) (+ a b)) -> ((lambda (a b) (+ a b)) (f1))")
  (lint-test "(let () (multiple-value-bind (a b) ((lambda () (values 1 2 3))) (+ a b)))" 
	     " let: pointless let: (let () (multiple-value-bind (a b) ((lambda () (values 1 2 3))) (+ a b)))
               let: multiple-value-bind wants 2 values, but ((lambda () (values 1 2 3))) returns 3
               let: perhaps (multiple-value-bind (a b) ((lambda () (values 1 2 3))) (+ a b)) ->
                 ((lambda (a b) (+ a b)) ((lambda () (values 1 2 3))))
               let: perhaps ((lambda () (values 1 2 3))) -> (values 1 2 3)")

  (lint-test "(let*-values (((a b) (f x))) (+ a b))" 
	     " let*-values: perhaps (let*-values (((a b) (f x))) (+ a b)) -> ((lambda (a b) (+ a b)) (f x))")
  (lint-test "(let*-values (((a) (f x))) (+ a b))"   
	     " let*-values: perhaps (let*-values (((a) (f x))) (+ a b)) -> (let ((a (f x))) (+ a b))")
  (lint-test "(let*-values ((a (f x))) (apply + a))" 
	     " let*-values: perhaps (let*-values ((a (f x))) (apply + a)) -> ((lambda a (apply + a)) (f x))")
  (lint-test "(let*-values (((a b) (f x)) ((c) (g y))) (+ a b c))" 
	     " let*-values: perhaps (let*-values (((a b) (f x)) ((c) (g y))) (+ a b c)) -> 
               ((lambda (a b) (let ((c (g y))) (+ a b c))) (f x))")
  (lint-test "(let*-values (((a) (f x)) ((c d) (g y))) (display c) (+ a b c))" 
	     " let*-values: perhaps (let*-values (((a) (f x)) ((c d) (g y))) (display c) (+ a b c)) ->
               (let ((a (f x))) ((lambda (c d) (display c) (+ a b c)) (g y)))")
  (lint-test "(let*-values (((a . b) (f x)) (c (g y))) (display c) (+ a b c))" 
	     " let*-values: perhaps (let*-values (((a . b) (f x)) (c (g y))) (display c) (+ a b c)) ->
               ((lambda (a . b) ((lambda c (display c) (+ a b c)) (g y))) (f x))")
  (lint-test "(let*-values (((a . b) (f x)) (c (g y)) ((d e f) (h a b))) (display c) (+ a b c))" 
	     " let*-values: perhaps (let*-values (((a . b) (f x)) (c (g y)) ((d e f) (h a b))) (display c) (+... ->
               ((lambda (a . b) ((lambda c ((lambda (d e f) (display c) (+ a b c)) (h a b))) (g y))) (f x))")

  (lint-test "(let-values (((x) (values 1))) x)" 
	      " let-values: perhaps (let-values (((x) (values 1))) x) -> ((lambda (x) x) (values 1))
                let-values: perhaps (values 1) -> 1")
  (lint-test "(let-values ((x (values 1))) x)" 
	     " let-values: perhaps (let-values ((x (values 1))) x) -> ((lambda x x) (values 1))
               let-values: perhaps (values 1) -> 1")
  (lint-test "(let-values (((x) (values 1)) ((y) (values 2))) (list x y))"
	     " let-values: perhaps (let-values (((x) (values 1)) ((y) (values 2))) (list x y)) ->
                (with-let (apply sublet (curlet) 
                            (list ((lambda (x) (values :x x)) (values 1)) 
                                  ((lambda (y) (values :y y)) (values 2))))
                  (list x y))
               let-values: perhaps (values 1) -> 1
               let-values: perhaps (values 2) -> 2")
  (lint-test "(let ((x 32)) (let-values (((x) (values 1)) ((y) (values (+ x 1)))) (list x y)))" 
	     " let: perhaps (let-values (((x) (values 1)) ((y) (values (+ x 1)))) (list x y)) ->
                 (with-let (apply sublet (curlet) 
                             (list ((lambda (x) (values :x x)) (values 1)) 
                                   ((lambda (y) (values :y y)) (values (+ x 1)))))
                  (list x y))
               let: perhaps (values 1) -> 1
               let: perhaps (values (+ x 1)) -> (+ x 1)")
  (lint-test "(let-values (((x y) (values 1 2))) (list x y))"
	     " let-values: perhaps (let-values (((x y) (values 1 2))) (list x y)) -> ((lambda (x y) (list x y)) (values 1 2))")
  (lint-test "(let ((d 32)) (let-values (((a) 1) ((c d e) (values 3 4 5)) ((b) d)) (+ a b (* c d e))))" 
	     " let: perhaps (let-values (((a) 1) ((c d e) (values 3 4 5)) ((b) d)) (+ a b (* c d e))) ->
                 (with-let (apply sublet (curlet) 
                             (list ((lambda (a) (values :a a)) 1) 
                                   ((lambda (c d e) (values :c c :d d :e e)) (values 3 4 5)) 
                                   ((lambda (b) (values :b b)) d)))
                  (+ a b (* c d e)))")
  (lint-test "(let ((a 32) (b -1)) (let-values (((a b) (values 1 2)) ((x y) (values a b))) (list a b x y)))"
	     " let: perhaps (let-values (((a b) (values 1 2)) ((x y) (values a b))) (list a b x y)) ->
                 (with-let (apply sublet (curlet) 
                             (list ((lambda (a b) (values :a a :b b)) (values 1 2)) 
                                   ((lambda (x y) (values :x x :y y)) (values a b))))
                   (list a b x y))")

  (lint-test "(let () (define-values (x y) (values 3 2)) (+ x y))" 
	     " let: perhaps (define-values (x y) (values 3 2)) -> (varlet (curlet) ((lambda (x y) (curlet)) (values 3 2)))")
  (lint-test "(define (sequence-map/maker maker proc seq . opts) (let-optionals opts ((start 0) (end (sequence-length seq))) maker))" 
	     " define: perhaps (define (sequence-map/maker maker proc seq . opts) (let-optionals opts... ->
                 (define* (sequence-map/maker maker proc seq (start 0) (end (sequence-length seq))) ...)")

  (lint-test "(open-output-file x \"fb+\")" " open-output-file: unexpected mode: (open-output-file x \"fb+\")")
  (lint-test "(vector 1 2 . 3)"         " vector: unexpected dot: (vector 1 2 . 3)")

  (lint-test "(begin (display x) (newline) (display y) (newline))" 
	     " begin: perhaps (... (display x) (newline) (display y) (newline)) ->  (format () \"~A~%~A~%\" x y)")
  (lint-test "(begin (display x) (newline) (display y) (newline) 32)" 
	     " begin: perhaps (... (display x) (newline) (display y) (newline)) ->  (format () \"~A~%~A~%\" x y)")
  (lint-test "(begin (write x p) (newline p) (write-char #\\a p) (write-string \"bc\" p))" 
	     " begin: perhaps (... (write x p) (newline p) (write-char #\\a p) (write-string \"bc\" p)) ->  (format p \"~S~%abc\" x)")
  (lint-test "(begin (newline) (set! x 1) (display x) (newline) (newline))"
	     " begin: perhaps (... (display x) (newline) (newline)) -> (format () \"~A~%~%\" x)")
  (lint-test "(begin (write-string x p y z) (write-string \"1234\" p 1) (write-string \"5678\" p 2 3) (write-string \"abc\" p 2 z))" 
	      " begin: perhaps 
                   (... (write-string x p y z) (write-string \"1234\" p 1) (write-string \"5678\"... ->
                   (format p \"~A2347~A\" (substring x y z) (substring \"abc\" 2 z))")
  (lint-test "(display x #f)" " display: (display x #f) could be x")
  (lint-test "(read-line in-port 'concat)" 
	     "read-line: in (read-line in-port 'concat), read-line's argument 2 should be a boolean, but 'concat is a symbol?
              read-line: the third argument should be boolean (#f=default, #t=include trailing newline): (read-line in-port 'concat)")
  (lint-test "(begin (display (number->string x)) (display #\\space) (display (number->string y 8)))" 
	     " begin: perhaps (... (display (number->string x)) (display #\\space) (display... -> (format () \"~A ~O\" x y)")

  (lint-test "(let ((f2 (lambda (x) (display (+ x 1))))) (f2 1) (f2 3) (f2 4))" 
	     " let: perhaps (let ((f2 (lambda (x) (display (+ x 1))))) (f2 1) (f2 3) (f2 4)) -> (for-each (lambda (x) (display (+ x 1))) '(1 3 4))")
  (lint-test "(let ((f2 (lambda (x) (display x)))) (f2 'a) (f2 'b) (f2 'c))" 
	     " let: perhaps (lambda (x) (display x)) -> display
               let: perhaps (let ((f2 (lambda (x) (display x)))) (f2 'a) (f2 'b) (f2 'c)) -> (for-each (lambda (x) (display x)) '(a b c))")
  (lint-test "(let ((f2 (lambda (x) (display (+ x 1))))) (f2 a) (f2 b) (f2 (f c)))" 
	     " let: perhaps (let ((f2 (lambda (x) (display (+ x 1))))) (f2 a) (f2 b) (f2 (f c))) -> (for-each (lambda (x) (display (+ x 1))) (list a b (f c)))")

  (lint-test "(+ 1 (begin (x y) #\\a))" " +: in (+ 1 (begin (x y) #\\a)), +'s argument 2 should be a number, but #\\a is a char?")
  (lint-test "(+ 1 (cond ((x 1) 3) ((x 2) 1+i) ((x 3) '(1 2))))" 
	      " +: in (+ 1 (cond ((x 1) 3) ((x 2) 1+1i) ((x 3) '(1 2)))), +'s argument 2 should be a number, but '(1 2) is a pair?")
  (lint-test "(+ 1 (cond ((x 1) 3) ((x 2) 1+i) ((x 3) 1/2)))" "")

  (lint-test "(substring x 0)"		" substring: perhaps clearer:  (substring x 0) -> (copy x)")
  (lint-test "(substring (substring x 1) 2)" " substring: perhaps (substring (substring x 1) 2) -> (substring x 3)")
  (lint-test "(substring x (+ y 1) (+ y 1))" " substring: leaving aside errors, (substring x (+ y 1) (+ y 1)) is \"\"")
  (lint-test "(substring x 0 (length x))" " substring: perhaps (substring x 0 (length x)) -> (substring x 0)")
  (lint-test "(let ((len (string-length x))) (substring x 1 len))" 
	     " let: perhaps (let ((len (string-length x))) (substring x 1 len)) -> (substring x 1 (string-length x))
               let: perhaps, if len is still (string-length x), (substring x 1 len) -> (substring x 1)")
  (lint-test "(substring (string-append str (make-string len #\\space)) 0 len)" 
	     " substring: perhaps (substring (string-append str (make-string len #\\space)) 0 len) -> (copy str (make-string len #\\space))")
  (lint-test "(substring \"--------\" x)" " substring: perhaps (substring \"--------\" x) -> (make-string (- 8 x) #\\-)")
  (lint-test "(substring \"--------\" x y)" " substring: perhaps (substring \"--------\" x y) -> (make-string (- y x) #\\-)")

  (lint-test "(list-tail x 0)"		" list-tail: perhaps (list-tail x 0) -> x")
  (lint-test "(list-tail (list-tail x 1) 2)" " list-tail: perhaps (list-tail (list-tail x 1) 2) -> (list-tail x 3)")
  (lint-test "(list-tail (list-tail x y) z)" " list-tail: perhaps (list-tail (list-tail x y) z) -> (list-tail x (+ y z))")

  (lint-test "(list (f (g x y) z (* a b)) (f (g x y) z (* a b)) (f (g x y) z (* a b)) (f (g x y) z (* a b)))"
	     " list: perhaps (list (f (g x y) z (* a b)) (f (g x y) z (* a b)) (f (g x y) z (* a b)) (f... ->
                 (let ((_1_ (lambda () (f (g x y) z (* a b))))) (list (_1_) (_1_) (_1_) (_1_)))")
  (lint-test "(list (f 'a) (f 'b) (f 'c))" " list: perhaps (list (f 'a) (f 'b) (f 'c)) -> (map f '(a b c))")
  (lint-test "(list (f a) (f b) (f c))"    " list: perhaps (list (f a) (f b) (f c)) -> (map f (list a b c))")
  (lint-test "(vector 12 12 12 12 12 12)" " vector: perhaps (vector 12 12 12 12 12 12) -> (make-vector 6 12)")
  (lint-test "(vector (car x) (car x) (car x) (car x))" " vector: perhaps (vector (car x) (car x) (car x) (car x)) -> (make-vector 4 (car x))")
  (lint-test "(vector #(1 2) #(1 2) #(1 2) #(1 2))" 
	     " vector: perhaps (vector #(1 2) #(1 2) #(1 2) #(1 2)) -> (make-vector 4 #(1 2))
               or wrap (copy #(1 2)) in a function and call that 4 times
               vector: #(1 2) could be #i(1 2) vector: #(1 2) could be #i(1 2) vector: #(1 2) could be #i(1 2) vector: #(1 2) could be #i(1 2)")
  (lint-test "((list 1 2 3) x)"         " (list 1 2 3): perhaps use vector here: ((list 1 2 3) x)")
  (lint-test "(int-vector 0 0 0 0)"     " int-vector: perhaps (int-vector 0 0 0 0) -> (make-int-vector 4)")
  (lint-test "(unless x)"		" unless: unless is messed up:  (unless x)")
  (lint-test "(unless (abs x) #f)"	" unless: unless test is never false: (unless (abs x) #f)")
  (lint-test "(with-let x)"		" with-let: with-let is messed up:  (with-let x)")
  (lint-test "(with-let (curlet) x)"	" with-let: with-let is not needed here:  (with-let (curlet) x)")
  (lint-test "(object->string x y)"	"")
  (lint-test "(object->string x :readable)" "")

  (lint-test "(or)"			" or: perhaps (or) -> #f")
  (lint-test "(or x)"			" or: perhaps (or x) -> x")
  (lint-test "(or 'a)"			" or: perhaps (or 'a) -> 'a")
  (lint-test "(or 'a 'b)"		" or: perhaps (or 'a 'b) -> 'a")
  (lint-test "(or x x)"			" or: perhaps (or x x) -> x")
  (lint-test "(or x x y)"		" or: perhaps (or x x y) -> (or x y)")
  (lint-test "(or x y z z y)"           " or: perhaps (or x y z z y) -> (or x y z)")
  (lint-test "(or (and x (or y z)) x)" "") ; these 3 hit the (cur 0) code and the 8-way var code
  (lint-test "(or (and x y z) x z)" "")    ;   I think these results are correct -- many truths...
  (lint-test "(or (and x y z) x)" "")
  (lint-test "(or (and x y) (and x z))" " or: perhaps (or (and x y) (and x z)) -> (and x (or y z))")
  (lint-test "(or 1 x)"			" or: perhaps (or 1 x) -> 1")
  (lint-test "(or (or y) x)"		" or: perhaps (or (or y) x) -> (or y x)")
  (lint-test "(or (or y x) x)"		" or: perhaps (or (or y x) x) -> (or y x)")
  (lint-test "(or x (not x))"		"")
  (lint-test "(or x (and x y))"		" or: perhaps (or x (and x y)) -> x")
  (lint-test "(or (and x y) y)"         " or: perhaps (or (and x y) y) -> y")
  (lint-test "(or x #f y)"		" or: perhaps (or x #f y) -> (or x y)")
  (lint-test "(or x #f)"		" or: perhaps (or x #f) -> x")
  (lint-test "(or x y #f)"              " or: perhaps (or x y #f) -> (or x y)")
  (lint-test "(or x #t)"                "")
  (lint-test "(or #t (display \"oops\"))" " or: perhaps (or #t (display \"oops\")) -> #t")
  (lint-test "(or (pair? x) #t (even? y))" " or: perhaps (or (pair? x) #t (even? y)) -> (or (pair? x) #t)")
  (lint-test "(or x (not (and x y)))"	"") ; someday?
  (lint-test "(or (pair? x) (list? x))" " or: perhaps (or (pair? x) (list? x)) -> (list? x)")
  (lint-test "(or (number? x) (rational? x))" " or: perhaps (or (number? x) (rational? x)) -> (number? x)")
  (lint-test "(or (pair? x) (null? x))" " or: perhaps (or (pair? x) (null? x)) -> (list? x)")
  (lint-test "(or (list? x) (list? x))" " or: perhaps (or (list? x) (list? x)) -> (list? x)")
  (lint-test "(or #f (= x 1))"		" or: perhaps (or #f (= x 1)) -> (= x 1)")
  (lint-test "(or (integer? (cadr x)) (number? (cadr x)))"  
	     " or: perhaps (or (integer? (cadr x)) (number? (cadr x))) -> (number? (cadr x))")
  (lint-test "(or (eq? x 'a) (eq? x 'b) (eq? x 'c))" 
	     " or: perhaps (or (eq? x 'a) (eq? x 'b) (eq? x 'c)) -> (memq x '(a b c))")
  (lint-test "(or (= x 1) (= x 2) (= x 3))" 
	     " or: perhaps (or (= x 1) (= x 2) (= x 3)) -> (member x '(1 2 3) =)")
  (lint-test "(or (equal? x #()) (equal? x #(a)))" 
	     " or: perhaps (or (equal? x #()) (equal? x #(a))) -> (member x '(#() #(a)))")
  (lint-test "(or (string=? x \"a\") (string=? x \"b\"))" 
	     " or: perhaps (or (string=? x \"a\") (string=? x \"b\")) -> (member x '(\"a\" \"b\") string=?)")
  (lint-test "(or (char=? (cadr x) #\\a) (char=? (cadr x) #\\b))" 
	     " or: perhaps (or (char=? (cadr x) #\\a) (char=? (cadr x) #\\b)) ->  (memv (cadr x) '(#\\a #\\b))")
  (lint-test "(or (= (let ((z 1)) (display z) z) 1) (= (let ((z 1)) (display z) z) 2))" 
	     " or: perhaps (or (= (let ((z 1)) (display z) z) 1) (= (let ((z 1)) (display z) z) 2)) -> (member (let ((z 1)) (display z) z) '(1 2) =)
                or: display returns its first argument, so this could be omitted: z  or: display returns its first argument, so this could be omitted: z")
  (lint-test "(or (not (null? x)) (not (pair? x)))" " or: perhaps (or (not (null? x)) (not (pair? x))) -> #t")
  (lint-test "(or (not (symbol? x)) (keyword? x))" "")
  (lint-test "(or (not (= x 1)) (not (= y 1)))" " or: perhaps (or (not (= x 1)) (not (= y 1))) -> (not (= x 1 y))")
  (lint-test "(or (char=? x #\\a) (char=? x #\\A))" " or: perhaps (or (char=? x #\\a) (char=? x #\\A)) -> (char-ci=? x #\\A)")
  (lint-test "(or (string=? x \"a\") (string=? x \"A\"))" " or: perhaps (or (string=? x \"a\") (string=? x \"A\")) -> (string-ci=? x \"A\")")
  (lint-test "(or (< x y) (= x y))"     " or: perhaps (or (< x y) (= x y)) -> (<= x y)")
  (lint-test "(or (eq? x #t) (eqv? #f x))" " or: perhaps (or (eq? x #t) (eqv? #f x)) -> (boolean? x) or: eqv? could be not: (eqv? #f x) -> (not x)")
  (lint-test "(and (< x 1) (string? y))" "") ; check a simplification bug
  (lint-test "(or (< x 1) (string? y))"  "") 
  (lint-test "(or (= x 1) (= x 1))"      " or: perhaps (or (= x 1) (= x 1)) -> (= x 1)")
  (lint-test "(or (not (= x 1)) (not (= y 1)))" " or: perhaps (or (not (= x 1)) (not (= y 1))) -> (not (= x 1 y))")
  (lint-test "(or (not (= x 1)) (not (= x 2)))" " or: perhaps (or (not (= x 1)) (not (= x 2))) -> #t")
  (lint-test "(or (not (= x y)) (not (= x z)))" " or: perhaps (or (not (= x y)) (not (= x z))) -> (not (= x y z))")
  (lint-test "(or () (= x 1))"            " or: perhaps (or () (= x 1)) -> ()")
  (lint-test "(or #f #f)"                 " or: perhaps (or #f #f) -> #f")
  (lint-test "(or (and (= n 2) (= d 2)) (and (= n 4) (= d 4)))" " or: perhaps (or (and (= n 2) (= d 2)) (and (= n 4) (= d 4))) -> (or (= n 2 d) (= n 4 d))")
  (lint-test "(or (= n 2 d) (= n 4 d))" "")
  (lint-test "(or (< x 1) (>= x 1))"      " or: perhaps (or (< x 1) (>= x 1)) -> #t")
  (lint-test "(or (< x 1) (< x 2))"       " or: perhaps (or (< x 1) (< x 2)) -> (< x 2)")
  (lint-test "(or (< x 1) (> x 2))"       " or: perhaps (or (< x 1) (> x 2)) -> (not (<= 1 x 2))")
  (lint-test "(or (<= x 1) (< x 1))"      " or: perhaps (or (<= x 1) (< x 1)) -> (<= x 1)")
  (lint-test "(or (< x 2) (> x 1))"       " or: perhaps (or (< x 2) (> x 1)) -> #t")
  (lint-test "(or (<= x 1) (<= 2 x))"     " or: perhaps (or (<= x 1) (<= 2 x)) -> (not (< 1 x 2))")
  (lint-test "(or (< x 3) (> 2 x))"       " or: perhaps (or (< x 3) (> 2 x)) -> (< x 3)")
  (lint-test "(or (char<? x #\\1) (char>=? x #\\1))" " or: perhaps (or (char<? x #\\1) (char>=? x #\\1)) -> #t")
  (lint-test "(or (string<? x \"1\") (string<? x \"2\"))" " or: perhaps (or (string<? x \"1\") (string<? x \"2\")) -> (string<? x \"2\")")
  (lint-test "(or (integer? x) (< x 3) (> x 12))"  " or: perhaps (or (integer? x) (< x 3) (> x 12)) -> (or (integer? x) (not (<= 3 x 12)))")
  (lint-test "(or (zero? x) (positive? x))" " or: perhaps (or (zero? x) (positive? x)) -> (not (negative? x))")
  (lint-test "(or (zero? x) (negative? x))" " or: perhaps (or (zero? x) (negative? x)) -> (not (positive? x))")

  (lint-test "(and (<= x y) (<= y z) (f x y z))" " and: perhaps (and (<= x y) (<= y z) (f x y z)) -> (and (<= x y z) (f x y z))")
  (lint-test "(and (<= x y) (<= y z))"           " and: perhaps (and (<= x y) (<= y z)) -> (<= x y z)")
  (lint-test "(or (< x y) (> x z))"              " or: perhaps (or (< x y) (> x z)) -> (not (<= y x z))")
  (lint-test "(or (>= x y) (<= x z))"            " or: perhaps (or (>= x y) (<= x z)) -> (not (> y x z))")
  (lint-test "(or (< (car v1) (car v2)) (> (car v1) (car v2)))" 
	     " or: perhaps (or (< (car v1) (car v2)) (> (car v1) (car v2))) -> (not (= (car v1) (car v2)))")
  (lint-test "(or (< (car v1) (car v2)) (>= (car v1) (car v2)))" 
	     " or: perhaps (or (< (car v1) (car v2)) (>= (car v1) (car v2))) -> #t")
  (lint-test "(or (<= (car v1) (car v2)) (>= (car v1) (car v2)))" 
	     " or: perhaps (or (<= (car v1) (car v2)) (>= (car v1) (car v2))) -> #t")

  (lint-test "(or (and A B) (and (not A) (not B)))" " or: perhaps (or (and A B) (and (not A) (not B))) -> (eq? (not A) (not B))")
  (lint-test "(or (and A (not B)) (and (not A) B))" " or: perhaps (or (and A (not B)) (and (not A) B)) -> (not (eq? (not A) (not B)))")
  (lint-test "(or (and A B) (and (not A) C))"       " or: perhaps (or (and A B) (and (not A) C)) -> (if A B C)")
  (lint-test "(if (or (and A B) (and (not A) C)) 32)"  " or: perhaps (or (and A B) (and (not A) C)) -> (if A B C)")
  (lint-test "(or (and (not A) B) (and A C))"       " or: perhaps (or (and (not A) B) (and A C)) -> (if A C B)")
  (lint-test "(or (and A B) (and A C))"  " or: perhaps (or (and A B) (and A C)) -> (and A (or B C))")
  (lint-test "(or (and A B) (and C B))"  " or: perhaps (or (and A B) (and C B)) -> (and (or A C) B)")
  (lint-test "(and (or A B) (or A C))"   " and: perhaps (and (or A B) (or A C)) -> (or A (and B C))")
  (lint-test "(and (or A B) (or C B))"   " and: perhaps (and (or A B) (or C B)) -> (or (and A C) B)")
  (lint-test "(or (not A) (and A B))"    " or: perhaps (or (not A) (and A B)) -> (or (not A) B)")
  (lint-test "(or A (and (not A) B))"    " or: perhaps (or A (and (not A) B)) -> (or A B)")

  (lint-test "(or (and x y) (and x z) (and x w))" " or: perhaps (or (and x y) (and x z) (and x w)) -> (and x (or y z w))")
  (lint-test "(or (and x y) (and z y) (and w y))" " or: perhaps (or (and x y) (and z y) (and w y)) -> (and (or x z w) y)")
  (lint-test "(or (and x y w) (and x z) (and x a b))" " or: perhaps (or (and x y w) (and x z) (and x a b)) -> (and x (or (and y w) z (and a b)))")

  (lint-test "(or (and (eq? x 'a) (< y 1)) (and (memq x '(b c)) (< y 2) (> z 1)) (and (null? x) (< y 3)))" 
	     " or: perhaps (or (and (eq? x 'a) (< y 1)) (and (memq x '(b c)) (< y 2) (> z 1)) (and... ->
                (case x ((a) (< y 1)) ((b c) (and (< y 2) (> z 1))) ((()) (< y 3)) (else #f))")
  (lint-test "(or (and (eq? x 'a) (< y 1)) (and (memq x '(b c)) (< y 2) (> z 1)) (< y 3))" "")
  (lint-test "(or (eq? x 'a) (eq? x 'b) (eq? x 'c) (and (< z 3) (< y 4)))" 
	     " or: perhaps (or (eq? x 'a) (eq? x 'b) (eq? x 'c) (and (< z 3) (< y 4))) -> (or (memq x '(a b c)) (and (< z 3) (< y 4)))")
  (lint-test "(or (< y 4) (eq? x 'a) (eq? x 'b) (eq? x 'c))" " or: perhaps (or (< y 4) (eq? x 'a) (eq? x 'b) (eq? x 'c)) -> (or (< y 4) (memq x '(a b c)))")
  (lint-test "(or (> y 32) (eq? x 'a) (eq? x 'b) (eq? x 'c) (and (< z 3) (< y 4)))" 
	     " or: perhaps (or (> y 32) (eq? x 'a) (eq? x 'b) (eq? x 'c) (and (< z 3) (< y 4))) -> (or (> y 32) (memq x '(a b c)) (and (< z 3) (< y 4)))")
  (lint-test "(or (> y 32) (> z 32) (eq? x 'a) (eq? x 'b) (eq? x 'c) (< z 3) (< y 4))" 
	     " or: perhaps (or (> y 32) (> z 32) (eq? x 'a) (eq? x 'b) (eq? x 'c) (< z 3) (< y 4)) -> (or (> y 32) (> z 32) (memq x '(a b c)) (< z 3) (< y 4))")
  (lint-test "(or (> y 32) (> z 32) (eq? x 'a) (eq? x 'b) (eq? x 'c) (< z 3) (> z 4))" 
	     " or: perhaps (or (> y 32) (> z 32) (eq? x 'a) (eq? x 'b) (eq? x 'c) (< z 3) (> z 4)) ->
                (or (> y 32) (> z 32) (memq x '(a b c)) (not (<= 3 z 4)))")
  (lint-test "(or (and (eq? x 'a) (< y 1)) (and (eq? x 'b) (< z 2)) (and (eq? x 'a) (< w 2)))" "")
  (lint-test "(or (not (= x y)) (not (= x z)))" " or: perhaps (or (not (= x y)) (not (= x z))) -> (not (= x y z))")
  (lint-test "(or (not x) (< x 1))" " in (or (not x) (< x 1)), perhaps change (not x) to (not (real? x))")
  (lint-test "(or (not x) (boolean? x))" " or: perhaps (or (not x) (boolean? x)) -> (boolean? x)")
  (lint-test "(or (not x) (< x 1) y)" " in (or (not x) (< x 1) y), perhaps change (not x) to (not (real? x))")
  (lint-test "(or (not (eq? val1 val2)) (not (eq? val2 val3)))" ; don't combine here into one eq?
	     " or: perhaps (or (not (eq? val1 val2)) (not (eq? val2 val3))) -> (not (and (eq? val1 val2) (eq? val2 val3)))")
  
  (lint-test "(and x (x))" " in (and x (x)), perhaps change x to (procedure? x)")
  (lint-test "(if x (x))"  " in (if x (x)), perhaps change x to (procedure? x)")

  (lint-test "(not (or (not x) (not y)))" " not: perhaps (not (or (not x) (not y))) -> (and x y)")
  (lint-test "(not (or (not (< x y)) (not (equal? a b)) (not z)))" 
	     " not: perhaps (not (or (not (< x y)) (not (equal? a b)) (not z))) -> (and (< x y) (equal? a b) z)")
  (lint-test "(not (and (not x) (not y)))" " not: perhaps (not (and (not x) (not y))) -> (or x y)")
  (lint-test "(not (and (not (< x y)) (not (equal? a b)) (not z)))" 
	     " not: perhaps (not (and (not (< x y)) (not (equal? a b)) (not z))) -> (or (< x y) (equal? a b) z)")
  (lint-test "(not (or (not x) (< y z) (not (< z x))))" 
	     " in (and x (< z x)), perhaps change x to (real? x) 
               not: perhaps (not (or (not x) (< y z) (not (< z x)))) -> (and x (>= y z) (< z x))")
  (lint-test "(not (and (> x 2) (< x 5)))" " not: perhaps (not (and (> x 2) (< x 5))) -> (not (> 5 x 2))")
  (lint-test "(not (and (> x 2) (not z)))" " not: perhaps (not (and (> x 2) (not z))) -> (or (<= x 2) z)")
  (lint-test "(not (> x 1))"		" not: perhaps (not (> x 1)) -> (<= x 1)")
  (lint-test "(not (<= 1 x 2))"         "")
  (lint-test "(not (exact? x))"		" not: perhaps (not (exact? x)) -> (inexact? x)")
  (lint-test "(not (not x))"		" paranoia: if you want a boolean, (not (not x)) -> (and x #t) not: perhaps (not (not x)) -> x")
  (lint-test "(not (zero? (logand x (ash 1 z))))" " not: perhaps (not (zero? (logand x (ash 1 z)))) -> (logbit? x z)")
  (lint-test "(not (zero? (logand x 64)))" " not: perhaps (not (zero? (logand x 64))) -> (logbit? x 6)")
  (lint-test "(not x y)"		" not: not has too many arguments: (not x y)")
  (lint-test "(not (+ x y))"            " not: (not (+ x y)) can't be true (+ never returns #f) not: perhaps (not (+ x y)) -> #f")
  (lint-test "(not (list x y))"         " not: (not (list x y)) can't be true (list never returns #f) not: perhaps (not (list x y)) -> #f")
  (lint-test "(not (if (f x) #t x))" 
	     " not: perhaps (not (if (f x) #t x)) -> (if (f x) #f (not x))
               not: perhaps (if (f x) #t x) -> (or (f x) x)")
  (lint-test "(not (begin (f x) x))" " not: perhaps (not (begin (f x) x)) -> (begin (f x) (not x))")
  (lint-test "(not (case x ((0) (f x)) ((1) (not x))))" 
	     " not: perhaps (not (case x ((0) (f x)) ((1) (not x)))) -> (case x ((0) (not (f x))) ((1) x))
               not: perhaps use => here: (case x ((0) (f x)) ((1) (not x))) -> (case x ((0) => f) ((1) => not))
               not: in ((1) (not x)), perhaps replace (not x) with #f")
  (lint-test "(not (cond ((f x) x) ((g x) (not x)) (else (error 'oops))))" 
	     " not: perhaps (not (cond ((f x) x) ((g x) (not x)) (else (error 'oops)))) -> (cond ((f x) (not x)) ((g x) x) (else (error 'oops)))")

  (lint-test "(or (not (< x 2)) (not (> x 1)))" " or: perhaps (or (not (< x 2)) (not (> x 1))) -> (not (< 1 x 2))") ; confusing...
  (lint-test "(or (string? x) (string=? x \"\"))" " or: perhaps (or (string? x) (string=? x \"\")) -> (string? x)")
  (lint-test "(or (number? x) (= x 1.0))" " or: perhaps (or (number? x) (= x 1.0)) -> (number? x)")
  (lint-test "(or (not x) (not (pair? x)))" " or: perhaps (or (not x) (not (pair? x))) -> (not (pair? x))")
  (lint-test "(or (null? x) (not (list? x)))" " or: perhaps (or (null? x) (not (list? x))) -> (not (pair? x))")
  (lint-test "(or (null? x) (not (string? x)))" " or: perhaps (or (null? x) (not (string? x))) -> (not (string? x))")
  (lint-test "(or (null? x) (not (pair? x)))" " or: perhaps (or (null? x) (not (pair? x))) -> (not (pair? x))")
  (lint-test "(or (pair? x) (not (pair? x)))" " or: perhaps (or (pair? x) (not (pair? x))) -> #t")

  (lint-test "(and)"			" and: perhaps (and) -> #t")
  (lint-test "(and x)"			" and: perhaps (and x) -> x")
  (lint-test "(and x #t)"		"")
  (lint-test "(and x #f)"               " and: perhaps (and x #f) -> #f")
  (lint-test "(and #f (display \"oops\"))" " and: perhaps (and #f (display \"oops\")) -> #f")
  (lint-test "(and (pair? x) #f (even? y))" " and: perhaps (and (pair? x) #f (even? y)) -> #f")
  (lint-test "(and x (not x))"		" and: perhaps (and x (not x)) -> #f")
  (lint-test "(and x (and x y))"	" and: perhaps (and x (and x y)) -> (and x y)")
  (lint-test "(and x (or x y))"         " and: perhaps (and x (or x y)) -> x")
  (lint-test "(and (or x y) x)"         " and: perhaps (and (or x y) x) -> x")
  (lint-test "(and (or x y) (or x z))"  " and: perhaps (and (or x y) (or x z)) -> (or x (and y z))")
  (lint-test "(and (number? x) (pair? x))" " and: perhaps (and (number? x) (pair? x)) -> #f")
  (lint-test "(and x (pair? x))"        " and: perhaps (and x (pair? x)) -> (pair? x)")
  (lint-test "(and x (or y 123) z)"	" and: perhaps (and x (or y 123) z) -> (and x z)")
  (lint-test "(and (pair? x) (list? x))" " and: perhaps (and (pair? x) (list? x)) -> (pair? x)")
  (lint-test "(and (number? x) (rational? x))" " and: perhaps (and (number? x) (rational? x)) -> (rational? x)")
  (lint-test "(and (pair? x) (null? x))" " and: perhaps (and (pair? x) (null? x)) -> #f")
  (lint-test "(and (list? x) (list? x))" " and: perhaps (and (list? x) (list? x)) -> (list? x)")
  (lint-test "(and 3.1 #f (= x 1))"	" and: perhaps (and 3.1 #f (= x 1)) -> #f")
  (lint-test "(and 3.1 #t (= x 1))"	" and: perhaps (and 3.1 #t (= x 1)) -> (= x 1)")
  (lint-test "(and (number? (cadr x)) (integer? (cadr x)))" " and: perhaps (and (number? (cadr x)) (integer? (cadr x))) -> (integer? (cadr x))")
  (lint-test "(and x y x)"		"")
  (lint-test "(and x y y)"		" and: perhaps (and x y y) -> (and x y)")
  (lint-test "(and x y x y)"		" and: perhaps (and x y x y) -> (and x y)")
  (lint-test "(and x #f y)"		" and: perhaps (and x #f y) -> #f")
  (lint-test "(and x y #t z)"		" and: perhaps (and x y #t z) -> (and x y z)")
  (lint-test "(and x y z z y)"          " and: perhaps (and x y z z y) -> (and x y z y)")
  (lint-test "(and (g x) (g y) (g x))"	"")
  (lint-test "(and (cadr x) (car y) (cadr x))" "")
  (lint-test "(and (cadr x) (car y) (cadr x) (car y))" " and: perhaps (and (cadr x) (car y) (cadr x) (car y)) -> (and (cadr x) (car y))")
  (lint-test "(and (g x) #f (g y))"	" and: perhaps (and (g x) #f (g y)) -> (and (g x) #f)")
  (lint-test "(and x (or y 123 z))"	" and: perhaps (and x (or y 123 z)) -> (and x (or y 123))")
  (lint-test "(and x (or y 123 z) w)"	" and: perhaps (and x (or y 123 z) w) -> (and x w)")
  (lint-test "(and x (or (g y) z) w)"	"")
  (lint-test "(and (integer? x) (number? x))" " and: perhaps (and (integer? x) (number? x)) -> (integer? x)")
  (lint-test "(and x y #t)"		"")
  (lint-test "(and x y (integer? 1))"	" and: perhaps (and x y (integer? 1)) -> (and x y #t)")
  (lint-test "(and x (or x))"		" and: perhaps (and x (or x)) -> x")
  (lint-test "(and (cadr x) (cadr x))"  " and: perhaps (and (cadr x) (cadr x)) -> (cadr x)")
  (lint-test "(and (< x y) (< y z))"	" and: perhaps (and (< x y) (< y z)) -> (< x y z)")
  (lint-test "(and (< x y) (< y z))"	" and: perhaps (and (< x y) (< y z)) -> (< x y z)")
  (lint-test "(and (< y z) (< x y))"	" and: perhaps (and (< y z) (< x y)) -> (< x y z)")
  (lint-test "(and (< x y) (< x y))"    " and: perhaps (and (< x y) (< x y)) -> (< x y)")
  (lint-test "(and (< x y) (< y x))"    " and: perhaps (and (< x y) (< y x)) -> #f")
  (lint-test "(and (< x y) (< z x))"    " and: perhaps (and (< x y) (< z x)) -> (< z x y)")
  (lint-test "(and (= x y) (= y z))"	" and: perhaps (and (= x y) (= y z)) -> (= x y z)")
  (lint-test "(and (= x y) (= x z))"    " and: perhaps (and (= x y) (= x z)) -> (= x y z)")
  (lint-test "(and (= x y) (= y x))"    " and: perhaps (and (= x y) (= y x)) -> (= x y)")
  (lint-test "(and (= x y) (= z x))"    " and: perhaps (and (= x y) (= z x)) -> (= z x y)")
  (lint-test "(and (>= x y) (>= z x))"	" and: perhaps (and (>= x y) (>= z x)) -> (>= z x y)")
  (lint-test "(and (>= x y) (>= x z))"	" and: perhaps (and (>= x y) (>= x z)) -> (>= x (max y z))")
  (lint-test "(and (= x y) (= x z))"	" and: perhaps (and (= x y) (= x z)) -> (= x y z)")
  (lint-test "(and (< x y) (> z y))"	" and: perhaps (and (< x y) (> z y)) -> (< x y z)")
  (lint-test "(and (< x y) (< y (let ((z 1)) (display z) z)))" " and: display returns its first argument, so this could be omitted: z")
  (lint-test "(and (pair? x) (null? x))"              " and: perhaps (and (pair? x) (null? x)) -> #f")
  (lint-test "(and (> x 1) (> x 2))"                  " and: perhaps (and (> x 1) (> x 2)) -> (> x 2)")
  (lint-test "(and (< x 1) (< x 2))"                  " and: perhaps (and (< x 1) (< x 2)) -> (< x 1)")
  (lint-test "(and (< x 1) (< 2 x))"                  " and: perhaps (and (< x 1) (< 2 x)) -> #f")
  (lint-test "(and (> x 1) (> 2 x))"                  " and: perhaps (and (> x 1) (> 2 x)) -> (> 2 x 1)")
  (lint-test "(and (< x y) (< x z))"                  " and: perhaps (and (< x y) (< x z)) -> (< x (min y z))")
  (lint-test "(and (= x 0) (zero? y))"                " and: perhaps (and (= x 0) (zero? y)) -> (= 0 x y)")
  (lint-test "(and (= 0 x) (= y 0) (zero? z))"        " and: perhaps (and (= 0 x) (= y 0) (zero? z)) -> (= 0 x y z)")
  (lint-test "(and (= x 0) (zero? x))"                " and: perhaps (and (= x 0) (zero? x)) -> (= 0 x)")
  (lint-test "(and (integer? x) (exact? x))"          " and: perhaps (and (integer? x) (exact? x)) -> (integer? x)")
  (lint-test "(and (integer? x) #t)"                  " and: perhaps (and (integer? x) #t) -> (integer? x)")
  (lint-test "(and (inexact? x) (real? x))"           " and: perhaps (and (inexact? x) (real? x)) -> (and (real? x) (inexact? x))")
  (lint-test "(and (infinite? x) (number? x))"        " and: perhaps (and (infinite? x) (number? x)) -> (infinite? x)")
  (lint-test "(and (not (= x 1)) (not (= x 2)))"      " and: perhaps (and (not (= x 1)) (not (= x 2))) -> (not (member x '(1 2) =))")
  (lint-test "(and (not (list? x)) (not (pair? x)))"  " and: perhaps (and (not (list? x)) (not (pair? x))) -> (not (list? x))")
  (lint-test "(and (not (null? x)) (not (pair? x)))"  " and: perhaps (and (not (null? x)) (not (pair? x))) -> (not (list? x))")
  (lint-test "(and (not (null? x)) (not (list? x)))"  " and: perhaps (and (not (null? x)) (not (list? x))) -> (not (list? x))")
  (lint-test "(and (zero? x) (zero? y))"              " and: perhaps (and (zero? x) (zero? y)) -> (= 0 x y)")
  (lint-test "(and (string? x) (string=? x \"\"))"    " and: perhaps (and (string? x) (string=? x \"\")) -> (equal? x \"\")")
  (lint-test "(and (number? x) (= x 1.0))"            " and: perhaps (and (number? x) (= x 1.0)) -> (memv x '(1 1.0))")
  (lint-test "(and (real? x) (= x 1))"                " and: perhaps (and (real? x) (= x 1)) -> (memv x '(1 1.0))")
  (lint-test "(and (integer? x) (= x 1))"             " and: perhaps (and (integer? x) (= x 1)) -> (eqv? x 1)")
  (lint-test "(and (integer? x) (= x y))"             "")
  (lint-test "(and (complex? x) (= x y))"             "")
  (lint-test "(and (symbol? x) (eq? x 'a))"           " and: perhaps (and (symbol? x) (eq? x 'a)) -> (eq? x 'a)")
  (lint-test "(and (keyword? x) (eq? x :a))"          " and: perhaps (and (keyword? x) (eq? x :a)) -> (eq? x :a)")
  (lint-test "(or (= x 1) (not (and (not (= y 2)) (not (= z 3)))))" 
	     " or: perhaps (or (= x 1) (not (and (not (= y 2)) (not (= z 3))))) -> (or (= x 1) (= y 2) (= z 3))")
  (lint-test "(and (= x 1) (not (or (not (= y 2)) (not (= z 3)))))" 
	     " and: perhaps (and (= x 1) (not (or (not (= y 2)) (not (= z 3))))) -> (and (= x 1) (= y 2) (= z 3))")
  (lint-test "(and (pair? x) (not (list? x)))"        " and: perhaps (and (pair? x) (not (list? x))) -> #f")
  (lint-test "(and (list? x) (not (pair? x)))"        " and: perhaps (and (list? x) (not (pair? x))) -> (null? x)")
  (lint-test "(and (not (null? x)) (list? x))"        " and: perhaps (and (not (null? x)) (list? x)) -> (pair? x)")
  (lint-test "(and (pair? x) (not (null? x)))"        " and: perhaps (and (pair? x) (not (null? x))) -> (pair? x)")
  (lint-test "(and (pair? x) (not (string? x)))"      " and: perhaps (and (pair? x) (not (string? x))) -> (pair? x)")
  (lint-test "(and (not (pair? x)) (symbol? x))"      " and: perhaps (and (not (pair? x)) (symbol? x)) -> (symbol? x)")
  (lint-test "(and (not (eof-object? x)) (char=? x #\\a))" " and: perhaps (and (not (eof-object? x)) (char=? x #\\a)) -> (eqv? x #\\a)")
  (lint-test "(and (real? x) (not (rational? x)))"    " and: perhaps (and (real? x) (not (rational? x))) -> (float? x)")
  (lint-test "(and (list? x) (not (proper-list? x)))" "")
  (lint-test "(and (real? x) (not (integer? x)))" "")
  (lint-test "(and (number? x) (inexact? x) (real? x))" " and: perhaps (and (number? x) (inexact? x) (real? x)) -> (and (real? x) (inexact? x))")
  (lint-test "(and (not (complex? x)) (real? x))"     " and: perhaps (and (not (complex? x)) (real? x)) -> #f")
  (lint-test "(and (pair? x) (eq? x #<unspecified>))" " and: perhaps (and (pair? x) (eq? x #<unspecified>)) -> #f")
  (lint-test "(and (eq? x 'a) (pair? x))"             " and: perhaps (and (eq? x 'a) (pair? x)) -> #f")
  (lint-test "(and (not (pair? x)) (or (not (pair? y)) (not (pair? z))))" 
	     " and: perhaps (and (not (pair? x)) (or (not (pair? y)) (not (pair? z)))) -> (not (or (pair? x) (and (pair? y) (pair? z))))")
  (lint-test "(or (not (pair? x)) (and (not (pair? y)) (not (pair? z))))"
	     " or: perhaps (or (not (pair? x)) (and (not (pair? y)) (not (pair? z)))) -> (not (and (pair? x) (or (pair? y) (pair? z))))")
  (lint-test "(if (and (not (pair? x)) (not (pair? z))) 1 2)" " if: perhaps (and (not (pair? x)) (not (pair? z))) -> (not (or (pair? x) (pair? z)))") 
  (lint-test "(if (or (not (pair? x)) (not (pair? z))) 2 1)"  " if: perhaps (or (not (pair? x)) (not (pair? z))) -> (not (and (pair? x) (pair? z)))")
  (lint-test "(and (number? port) (exact? port) (integer? port))"  " and: perhaps (and (number? port) (exact? port) (integer? port)) -> (integer? port)")
  (lint-test "(and (number? port) (integer? port) (exact? port))"  " and: perhaps (and (number? port) (integer? port) (exact? port)) -> (integer? port)")
  (lint-test "(and (integer? port) (number? port) (real? port))"   " and: perhaps (and (integer? port) (number? port) (real? port)) -> (integer? port)")
  (lint-test "(and (real? port) (number? port) (integer? port))"   " and: perhaps (and (real? port) (number? port) (integer? port)) -> (integer? port)")
  (lint-test "(and (real? port) (integer? port) (integer? port))"  " and: perhaps (and (real? port) (integer? port) (integer? port)) -> (integer? port)")
  (lint-test "(and (real? port) (number? port) (integer? port) (even? port))" 
	     " and: perhaps (and (real? port) (number? port) (integer? port) (even? port)) -> (and (integer? port) (even? port))")
  (lint-test "(and (real? port) (number? port) (integer? port) (even? port) (positive? port))" 
	     " and: perhaps (and (real? port) (number? port) (integer? port) (even? port) (positive? port)) ->
                 (and (integer? port) (even? port) (positive? port))")
  (lint-test "(and (integer? x) (< x 12) (> x 3))" " and: perhaps (and (integer? x) (< x 12) (> x 3)) -> (and (integer? x) (> 12 x 3))")
  (lint-test "(and (equal? (car a) (car b)) (equal? (cdr a) (cdr b)))" 
	     " and: perhaps (and (equal? (car a) (car b)) (equal? (cdr a) (cdr b))) -> (equal? a b)")
  (lint-test "(and (equal? (caadr a) (caadr b)) (equal? (cdadr a) (cdadr b)))" 
	     " and: perhaps (and (equal? (caadr a) (caadr b)) (equal? (cdadr a) (cdadr b))) -> (equal? (cadr a) (cadr b))")

  (lint-test "(and t! (string? t!))"                   " and: perhaps (and t! (string? t!)) -> (string? t!)")
  (lint-test "(and t! (string? t!) v (string? v))"     " and: perhaps (and t! (string? t!) v (string? v)) -> (and (string? t!) (string? v))")
  (lint-test "(and v (boolean? v) (not (equal? v w)))" " and: perhaps (and v (boolean? v) (not (equal? v w))) -> (and (eq? v #t) (not (equal? v w)))")
  (lint-test "(and x (< x 2))"                         " in (and x (< x 2)), perhaps change x to (real? x)")
  (lint-test "(and w x (substring s 0 x))"             " in (and x (substring s 0 x)), perhaps change x to (integer? x)")
  (lint-test "(and x (+ (log x) 1))"                   " in (and x (+ (log x) 1)), perhaps change x to (number? x)")
  (lint-test "(and z x (+ (log x) 1))"                 " in (and z x (+ (log x) 1)), perhaps change x to (number? x)")
  (lint-test "(when x (display (log x)))"              " in (when x (display (log x))), perhaps change x to (number? x)")
  (lint-test "(and x (substring s 0 x))"               " in (and x (substring s 0 x)), perhaps change x to (integer? x)")
  (lint-test "(and v (v 100))"                         " in (and v (v 100)), perhaps change v to (procedure? v) ; or maybe sequence?")
  (lint-test "(when x (substring y x))"                " in (when x (substring y x)), perhaps change x to (integer? x)")
  (lint-test "(cond (x (+ 1 (abs x))) (else y))"       " in (cond (x (+ 1 (abs x))) (else y)), perhaps change x to (real? x)")
  (lint-test "(and t! v (string? t!) (string? v))" 
	     " in (and t! v (string? t!) (string? v)), perhaps change (and ... t! ... (string? t!)) to (string? t!)
               in (and t! v (string? t!) (string? v)), perhaps change (and ... v ... (string? v)) to (string? v)")
  (lint-test "(and (number? a!) (positive? a!))" " in (and (number? a!) (positive? a!)), perhaps change (number? a!) to (real? a!)")
  (lint-test "(and (number? x) (< x 1))"       " in (and (number? x) (< x 1)), perhaps change (number? x) to (real? x)")
  (lint-test "(and (number? x) (even? x))" " in (and (number? x) (even? x)), perhaps change (number? x) to (integer? x)")
  (lint-test "(and (list? arg2) (pair? arg2) (memq (car arg2) '(x y)))"
	     " and: perhaps (and (list? arg2) (pair? arg2) (memq (car arg2) '(x y))) -> (and (pair? arg2) (memq (car arg2) '(x y)))")
  (lint-test "(and (eq? val1 val2) (eq? val2 val3))" "")  ; don't combine these!
  (lint-test "(and (equal? val1 val2) (equal? val2 val3))" "")

  (lint-test "(and (pair? x) (not (pair? (car x))) (not y) (not (pair? (cdr x))) (string? z))" 
	     " and: perhaps (and (pair? x) (not (pair? (car x))) (not y) (not (pair? (cdr x))) (string? z)) ->
                (and (pair? x) (not (or (pair? (car x)) y (pair? (cdr x)))) (string? z))")
  (lint-test "(or (pair? x) (not (pair? (car x))) (not y) (not (pair? (cdr x))) (string? z))" 
	     " or: perhaps (or (pair? x) (not (pair? (car x))) (not y) (not (pair? (cdr x))) (string? z)) ->
                  (or (pair? x) (not (and (pair? (car x)) y (pair? (cdr x)))) (string? z))")
  (lint-test "(or (not (list? info))
		  (not (list? diff))
		  (not (eq? (car diff) 'filter))
		  (fnq (caar info) 1.0)
		  (fnq (caadr info) 0.5)
		  (fnq (caaddr info) 0.25)
		  (not (= (cadar info) 0))
		  (not (= (cadadr info) 1))
		  (not (= (cadr (caddr info)) 1)))" 
	   " in (and (list? info) (list? diff) (eq? (car diff) 'filter)) (line 8), perhaps change (list? diff) to (pair? diff)
             or (line 8): perhaps (or (not (list? info)) (not (list? diff)) (not (eq? (car diff) 'filter))... ->
                (or (not (and (list? info)
                              (list? diff)
                              (eq? (car diff) 'filter)))
                    (fnq (caar info) 1.0)
                    (fnq (caadr info) 0.5)
                    (fnq (caaddr info) 0.25)
                    (not (and (= (cadar info) 0)
                              (= (cadadr info) 1)
                              (= (cadr (caddr info)) 1))))")

  (lint-test "(cond ((number? x) (< x 1)) ((number? y) (display (abs y))))" 
	     " in (cond ((number? x) (< x 1)) ((number? y) (display (abs y)))), perhaps change (number? x) to (real? x)
               in (cond ((number? x) (< x 1)) ((number? y) (display (abs y)))), perhaps change (number? y) to (real? y)")
  (lint-test "(cond ((number? y) (display (abs y))) ((number? x) (< x 1)))" 
	     " in (cond ((number? y) (display (abs y))) ((number? x) (< x 1))), perhaps change (number? y) to (real? y)
               in (cond ((number? y) (display (abs y))) ((number? x) (< x 1))), perhaps change (number? x) to (real? x)")
  (lint-test "(cond ((number? (car x)) (< (car x) 1)) ((number? (vector-ref z y)) (display (abs (vector-ref z y)))))"
	     " in (cond ((number? (car x)) (< (car x) 1)) ((number? (vector-ref z y))..., perhaps change (number? (car x)) to (real? (car x))
               in (cond ((number? (car x)) (< (car x) 1)) ((number? (vector-ref z y))..., perhaps change (number? (vector-ref z y)) to (real? (vector-ref z y))")
  (lint-test "(cond ((not x) y) ((string=? x z) z))" " in (cond ((not x) y) ((string=? x z) z)), perhaps change (not x) to (not (string? x))")
  
  (lint-test "(and (number? x) (display (abs x)))" " in (and (number? x) (display (abs x))), perhaps change (number? x) to (real? x)")
  (lint-test "(and (number? x) x (display (abs x)))" " in (and (number? x) x (display (abs x))), perhaps change x to (real? x)")
  (lint-test "(and (number? (car x)) (display (abs (car x))))"  
	     " in (and (number? (car x)) (display (abs (car x)))), perhaps change (number? (car x)) to (real? (car x))")
  (lint-test "(and (number? (car x)) (display (abs (car x))) y)" 
	     " in (and (number? (car x)) (display (abs (car x))) y), perhaps change (number? (car x)) to (real? (car x))")
  
  (lint-test "(or (not (number? x)) (display (abs x)))" 
	     " in (or (not (number? x)) (display (abs x))), perhaps change (not (number? x)) to (not (real? x))")
  (lint-test "(or (not (number? (car x))) (display (abs (car x))))" 
	     " in (or (not (number? (car x))) (display (abs (car x)))), perhaps change (not (number? (car x))) to (not (real? (car x)))")
  (lint-test "(or (not (number? (car x))) (display (abs (car x))) y)" 
	     " in (or (not (number? (car x))) (display (abs (car x))) y), perhaps change (not (number? (car x))) to (not (real? (car x)))")
  
  (lint-test "(if (number? x) (display (abs x)))" " in (if (number? x) (display (abs x))), perhaps change (number? x) to (real? x)")
  (lint-test "(if (not (number? x)) x (display (abs x)))" 
	     " in (if (not (number? x)) x (display (abs x))), perhaps change (not (number? x)) to (not (real? x))")
  (lint-test "(if (number? (car x)) (display (abs (car x))))" 
	     " in (if (number? (car x)) (display (abs (car x)))), perhaps change (number? (car x)) to (real? (car x))")
  (lint-test "(if (not (number? (car x))) x (display (abs (car x))))" 
	     " in (if (not (number? (car x))) x (display (abs (car x)))), perhaps change (not (number? (car x))) to (not (real? (car x)))")
  
  (lint-test "(string-append x (if y z) x)" 
	     " string-append: in (string-append x (if y z) x), string-append's argument 2 should be a string, but #<unspecified> is untyped")
  (lint-test "(string-append x (if y z w) x)" "")
  (lint-test "(string-append str (apply string-append strs))" 
	     " string-append: perhaps (string-append str (apply string-append strs)) -> (string-append str (apply values strs))")
  (lint-test "(string-append (apply string-append strs) str1 str2)" 
	     " string-append: perhaps (string-append (apply string-append strs) str1 str2) -> (string-append (apply values strs) str1 str2)")

  (lint-test "(car (car x))"                 " car: perhaps (car (car x)) -> (caar x)")
  (lint-test "(cdr (cadr x))"                " cdr: perhaps (cdr (cadr x)) -> (cdadr x)")
  (lint-test "(car (car (cdr x)))"           " car: perhaps (car (car (cdr x))) -> (caadr x)")
  (lint-test "(car (car (cdr (cdr x))))"     " car: perhaps (car (car (cdr (cdr x)))) -> (caaddr x)")
  (lint-test "(car (cadr (cdr x)))"          " car: perhaps (car (cadr (cdr x))) -> (caaddr x)")
  (lint-test "(cddar (car x))"               " cddar: perhaps (cddar (car x)) -> (cddaar x)")
  (lint-test "(cadr (car (cdr x)))"          " cadr: perhaps (cadr (car (cdr x))) -> (cadadr x)")
  (lint-test "(cddddr (cddr x))"             " cddddr: perhaps (cddddr (cddr x)) -> (list-tail x 6)")
  (lint-test "(car (cddddr (cddr x)))"       " car: perhaps (car (cddddr (cddr x))) -> (list-ref x 6)")
  (lint-test "(cadr (cddr (cdddr x)))"       " cadr: perhaps (cadr (cddr (cdddr x))) -> (list-ref x 6)")
  (lint-test "(cadr (cddr (cdddr (cdr x))))" " cadr: perhaps (cadr (cddr (cdddr (cdr x)))) -> (list-ref x 7)")
  (lint-test "(cddddr (cdddr (cddddr x)))"   " cddddr: perhaps (cddddr (cdddr (cddddr x))) -> (list-tail x 11)")
  (lint-test "(car (caddr x))"               " car: perhaps (car (caddr x)) -> (caaddr x)")
  (lint-test "(cdr (caadr x))"               " cdr: perhaps (cdr (caadr x)) -> (cdaadr x)")
  (lint-test "(car (cadddr x))"              "")
  (lint-test "(cdr (caaddr x))"              "")
  (lint-test "(cadr (cddr x))"               " cadr: perhaps (cadr (cddr x)) -> (cadddr x)")
  (lint-test "(cddr (cadr x))"               " cddr: perhaps (cddr (cadr x)) -> (cddadr x)")
  (lint-test "(caddr (cddr x))"              " caddr: perhaps (caddr (cddr x)) -> (list-ref x 4)")
  (lint-test "(cdddr (cadr x))"              "")
  (lint-test "(caddr (cdr x))"               " caddr: perhaps (caddr (cdr x)) -> (cadddr x)")
  (lint-test "(cdddr (car x))"               " cdddr: perhaps (cdddr (car x)) -> (cdddar x)")

  (lint-test "(let ((x 3) (y 5)) (set! x (+ x y)) (+ x y))"  " let: set! returns the new value, so this could be omitted: (+ x y)")
  (lint-test "(let ((x 3)) (set! x (+ x 1)) x)"              
	     " let: set! returns the new value, so this could be omitted: x
               let: perhaps (let ((x 3)) (set! x (+ x 1)) x) -> (let ((x (+ 3 1))) x)")
  (lint-test "(let ((x (list 1 2))) (set-car! x 3) (car x))" " let: set-car! returns the new value, so this could be omitted: (car x)")
  (lint-test "(let ((x (list 1 2))) (set-cdr! x 3) (cdr y))" "")
  (lint-test "(let ((g (make-oscil)) (v (make-vector 3))) (fill! v g) (oscil-bank v))" "")
  (lint-test "(begin (vector-set! x 0 32) (vector-ref x 0))" 
	     " begin: vector-set! returns the new value, so this could be omitted: (vector-ref x 0)")
  (lint-test "(begin (list-set! x (* y 2) 32) (list-ref x (* y 2)))" 
	     " begin: list-set! returns the new value, so this could be omitted: (list-ref x (* y 2))")
  (lint-test "(let () (vector-set! x 0 32) (vector-ref x 0))" 
	     " let: let could be begin: (let () (vector-set! x 0 32) (vector-ref x 0)) -> (begin (vector-set! x 0 32) (vector-ref x 0))
               let: vector-set! returns the new value, so this could be omitted: (vector-ref x 0)")
  (lint-test "(let () (list-set! x (* y 2) 32) (list-ref x (* y 2)))" 
	     " let: let could be begin: (let () (list-set! x (* y 2) 32) (list-ref x (* y 2))) -> (begin (list-set! x (* y 2) 32) (list-ref x (* y 2)))
               let: list-set! returns the new value, so this could be omitted: (list-ref x (* y 2))")
  (lint-test "(begin (vector-set! x 0 (* y 2)) (* y 2))"
	     " begin: vector-set! returns the new value, so this could be omitted: (* y 2)")
  (lint-test "(begin (z 1) (do ((i 0 (+ i 1))) ((= i n) 32)))" 
	     " begin: this do-loop could be replaced by 32: (do ((i 0 (+ i 1))) ((= i n) 32))")
  (lint-test "(vector-set! v i (vector-ref v i))" 
	     " vector-set!: redundant vector-set!: (vector-set! v i (vector-ref v i))")
  (lint-test "(list-set! v (+ i 1) (list-ref v (+ i 1)))" 
	     " list-set!: redundant list-set!: (list-set! v (+ i 1) (list-ref v (+ i 1)))")
  (lint-test "(string-set! v (+ i 1) (string-ref v (+ i 1)))" 
	     " string-set!: redundant string-set!: (string-set! v (+ i 1) (string-ref v (+ i 1)))")
  (lint-test "(vector-ref (vector-ref x 0) y)" 
	     " vector-ref: perhaps (vector-ref (vector-ref x 0) y) -> (x 0 y)")
  (lint-test "(vector-ref (make-vector 3) 1)"  
	     " vector-ref: this doesn't make much sense: (vector-ref (make-vector 3) 1)")
  (lint-test "(list-ref (list-ref (list-ref (cadr x) (+ y 1)) (+ y 2)) (+ y 3))" 
	     " list-ref: perhaps (list-ref (list-ref (list-ref (cadr x) (+ y 1)) (+ y 2)) (+ y 3)) ->  ((cadr x) (+ y 1) (+ y 2) (+ y 3))")
  (if (not pure-s7) (lint-test "(current-output-port 123)" " current-output-port: too many arguments: (current-output-port 123)"))
  (lint-test "(copy (owlet))" " copy: (copy (owlet)) could be (owlet): owlet is copied internally")
  (lint-test "(gcd x '(asd))" " gcd: in (gcd x '(asd)), gcd's argument 2 should be rational, but '(asd) is a list?")

  (lint-test "(string #\\null)"	"")
  (lint-test "(string (char->integer x))" " string: in (string (char->integer x)), string's argument should be a char, but (char->integer x) is an integer?")
  (lint-test "(string (string-ref x 0))" " string: perhaps (string (string-ref x 0)) -> (substring x 0 1)")
  (lint-test "(string (string-ref x 0) #\\a)" "")
  (lint-test "(string (char-downcase (string-ref x 1)) (char-downcase (string-ref x 2)))" 
	     " string: perhaps (string (char-downcase (string-ref x 1)) (char-downcase (string-ref x 2))) ->
                 (string-downcase (string (string-ref x 1) (string-ref x 2)))")

  (lint-test "(+ 1 (dynamic-wind (lambda () #f) (lambda () #()) (lambda () #f)))" 
	     " +: in (+ 1 (dynamic-wind (lambda () #f) (lambda () #()) (lambda () #f))), +'s argument 2 should be a number, but #() is a vector?
               +: this dynamic-wind is pointless, (dynamic-wind (lambda () #f) (lambda () #()) (lambda () #f)) -> #()")
  (lint-test "(+ 1 (do () ((x) (display 3) #())))" " +: in (+ 1 (do () ((x) (display 3) #()))), +'s argument 2 should be a number, but #() is a vector?")
  (lint-test "(+ 1 (case x ((0) 1) ((1) #()) (else 2)))" " +: in (+ 1 (case x ((0) 1) ((1) #()) (else 2))), +'s argument 2 should be a number, but #() is a vector?")
  (lint-test "(+ 1 (values 2 3) #\\a)"  " +: in (+ 1 (values 2 3) #\\a), +'s argument 4 should be a number, but #\\a is a char?")
  (lint-test "(+ 1 (values 2 #\\a) x)"  " +: in (+ 1 (values 2 #\\a) x), +'s argument 3 should be a number, but #\\a is a char?")
  (lint-test "(let () ((lambda (a b) (+ (* 2 a) b)) (values 1 2)))" " let: pointless let: (let () ((lambda (a b) (+ (* 2 a) b)) (values 1 2)))")

  (lint-test "(close-output-port 022120)" 
	     " close-output-port: in (close-output-port 22120), close-output-port's argument should be an output-port, but 22120 is an integer?")
  (lint-test "(close-input-port (log 32))" 
	     " close-input-port: in (close-input-port (log 32)), close-input-port's argument should be an input-port, but (log 32) is a number?")

  (lint-test "(+ 1 (call-with-exit (lambda (rtn) (+ x (rtn #\\a)))))" 
	     " +: in (+ 1 (call-with-exit (lambda (rtn) (+ x (rtn #\\a))))), +'s argument 2 should be a number, but #\\a is a char?")
  (lint-test "(call-with-exit (lambda (p) (+ x 1)))" 
	      " call-with-exit: call-with-exit exit function p appears to be unused: (call-with-exit (lambda (p) (+ x 1)))
                call-with-exit: p not used, initially: :call/exit from call-with-exit")
  (lint-test "(call-with-exit (lambda (return) (display x) (return (+ x y))))" " call-with-exit: return is redundant here: (return (+ x y))")
  (lint-test "(call-with-exit (lambda (p) (+ p 1)))"  " call-with-exit: p is a continuation, but + in (+ p 1) wants a number?")
  (lint-test "(begin (call-with-exit (lambda (quit) (if (< x 0) (quit (+ x 1))) (display x))) (+ x 2))" 
	     " begin: this call-with-exit return value will be ignored: (quit (+ x 1))")

  (lint-test "(+ 1 (call/cc (lambda (c) (if x c (c 2)))))" "")
  (lint-test "(+ 1 (call/cc (lambda (c) (if x (c 1) 2))))" " +: perhaps call/cc could be call-with-exit: (call/cc (lambda (c) (if x (c 1) 2)))")
  (lint-test "(call/cc (lambda (p) (+ x (p 1))))" " call/cc: perhaps call/cc could be call-with-exit: (call/cc (lambda (p) (+ x (p 1))))")
  (lint-test "(call/cc (lambda (p) p))" "")
  (lint-test "(call/cc (lambda (p) (lambda () p)))" "")
  (lint-test "(call/cc (lambda (p) (+ p 1)))"  " call/cc: p is a continuation, but + in (+ p 1) wants a number?")

  (lint-test "(call-with-output-file file (lambda (p) (+ x 1)))" 
	     " call-with-output-file: p not used, initially: (open-output-file) from call-with-output-file")
  (lint-test "(call-with-input-file \"file\" (lambda (p) (read-char p)))" 
	     " call-with-input-file: perhaps (call-with-input-file \"file\" (lambda (p) (read-char p))) -> (call-with-input-file \"file\" read-char)")

  (lint-test "(with-output-to-string (lambda () (display object)))" 
	     " with-output-to-string: perhaps (with-output-to-string (lambda () (display object))) -> (object->string object #f)")
  (lint-test "(with-output-to-string (lambda () (write (car defs)) (newline)))" 
	     " with-output-to-string: perhaps (with-output-to-string (lambda () (write (car defs)) (newline))) -> (format #f \"~S~%\" (car defs))")
  (lint-test "(with-output-to-string (lambda () (write answer)))" 
	     " with-output-to-string: perhaps (with-output-to-string (lambda () (write answer))) -> (object->string answer)")
  (lint-test "(call-with-output-string (lambda (p) (display object p)))" 
	     " call-with-output-string: perhaps (call-with-output-string (lambda (p) (display object p))) -> (object->string object #f)")

  (lint-test "(quasiquote 1 2)"		" quasiquote: quasiquote has too many arguments: (quasiquote 1 2)")
  (lint-test "(apply + 1)"		" apply: last argument should be a list:  (apply + 1)")
  (lint-test "(apply (lambda (x) (abs x)) y)" 
	     " apply: perhaps (assuming y is a list of one element) (apply (lambda (x) (abs x)) y) -> (abs (car y))
               apply: perhaps (lambda (x) (abs x)) -> abs")
  (lint-test "(apply (lambda (x) (f x)) y)" 
	     " apply: perhaps (assuming y is a list of one element) (apply (lambda (x) (f x)) y) -> (f (car y))
               apply: perhaps (lambda (x) (f x)) -> f")
  (lint-test "(apply (lambda (x) x) y)" " apply: perhaps (assuming y is a list of one element) (apply (lambda (x) x) y) -> (car y)")
  (lint-test "(apply log (list x y))"   " apply: perhaps (apply log (list x y)) -> (log x y)")
  (lint-test "(apply + 1 2 ())"         " apply: perhaps (apply + 1 2 ()) -> (+ 1 2)")
  (lint-test "(apply + '(1 2 3))"       " apply: perhaps (apply + '(1 2 3)) -> (+ 1 2 3)")
  (lint-test "(apply eq? '(a b))"       " apply: perhaps (apply eq? '(a b)) -> (eq? 'a 'b)")
  (lint-test "(apply f '(a b (c)))"     " apply: perhaps (apply f '(a b (c))) -> (f 'a 'b '(c))")
  (lint-test "(apply f ())"             " apply: perhaps (apply f ()) -> (f)")
  (lint-test "(apply list x)"           " apply: perhaps (apply list x) -> x")
  (lint-test "(apply real? 1 3 rest)"   " apply: too many arguments for real?: (apply real? 1 3 rest)")
  (lint-test "(apply f)"                " apply: perhaps (apply f) -> (f)")
  (lint-test "(apply + (cons a b))"     " apply: perhaps (apply + (cons a b)) -> (apply + a b)")
  (lint-test "(apply string (reverse chars))" " apply: perhaps (apply string (reverse chars)) -> (reverse (apply string chars))")
  (lint-test "(apply + x y ())"         " apply: perhaps (apply + x y ()) -> (+ x y)")
  (lint-test "(apply log x '())"        " apply: perhaps (apply log x '()) -> (log x) apply: quote is not needed here: '()")
  (lint-test "(apply f (append (list y z) a b))" " apply: perhaps (apply f (append (list y z) a b)) -> (apply f y z (append a b))")
  (lint-test "(apply f (append (list y z)))"     " apply: perhaps (apply f (append (list y z))) -> (apply f y z ()) apply: perhaps (append (list y z)) -> (list y z)")
  (lint-test "(apply f (append (list y z) a))"   
	     " apply: perhaps (apply f (append (list y z) a)) -> (apply f y z a)
               apply: perhaps (append (list y z) a) -> (cons y (cons z a))")
  (lint-test "(apply map f (list x y))" " apply: perhaps (apply map f (list x y)) -> (map f x y)")
  (lint-test "(apply string-append (map (lambda (x) (string-append x \" \")) input-files))"
	     " apply: perhaps (apply string-append (map (lambda (x) (string-append x \" \")) input-files)) -> (format #f \"~{~A ~}\" input-files)")
  (lint-test "(apply string-append (map symbol->string args))" 
	     " apply: perhaps (apply string-append (map symbol->string args)) -> (format #f \"~{~A~}\" args)")
  (lint-test "(apply f y z (list a b))" " apply: perhaps (apply f y z (list a b)) -> (f y z a b)")
  (lint-test "(apply append (map vector->list args))" 
	     " apply: perhaps (apply append (map vector->list args)) -> (vector->list (apply append args))")
  (lint-test "(apply f (cons a (cons b c)))" " apply: perhaps (apply f (cons a (cons b c))) -> (apply f a b c)")
  (lint-test "(apply car x)" " apply: perhaps (apply car x) -> (car (car x))")
  (lint-test "(apply string (map char-downcase x))" 
	     " apply: perhaps, assuming x is a list, (apply string (map char-downcase x)) -> (string-downcase (apply string x))")
  (lint-test "(apply f `(x ,y ,@z))" 
	     " apply: perhaps (apply f (list-values 'x y (apply-values z))) -> (apply f 'x y z)
               apply: perhaps (list-values 'x y (apply-values z)) -> (cons 'x (cons y z))")
  (lint-test "(apply f `(,@(list x y)))" 
	      " apply: perhaps (apply f (list-values (apply-values (list x y)))) -> (apply f (list x y))
                apply: perhaps (list-values (apply-values (list x y))) -> (list x y)")
  (lint-test "(apply f `(x (,y 1) ,z))" " apply: perhaps (apply f (list-values 'x (list-values y 1) z)) -> (f 'x (list y 1) z)")
  (lint-test "(apply make-string tcnt initializer)" "")
  (lint-test "(apply cons x y)" " apply: perhaps (apply cons x y) -> (cons x (car y))")
  (lint-test "(apply string (make-list pad #\\null))" " apply: perhaps (apply string (make-list pad #\\null)) -> (make-string pad #\\null)")
  (lint-test "(let ((v (vector 1 2 3))) (apply v (make-list 1 0)))"   ; don't complain here that v is not a procedure!
	     " let: perhaps (let ((v (vector 1 2 3))) (apply v (make-list 1 0))) -> (apply (vector 1 2 3) (make-list 1 0))")
  (lint-test "(apply (lambda (x) (+ x 1)) y ())" " apply: perhaps (apply (lambda (x) (+ x 1)) y ()) -> ((lambda (x) (+ x 1)) y)")
  (lint-test "(apply append (map list x))" " apply: perhaps (apply append (map list x)) -> x")

  (lint-test "(eval '(+ 1 2))"          " eval: perhaps (eval '(+ 1 2)) -> (+ 1 2)")
  (lint-test "(eval 32)"                " eval: this eval is pointless; perhaps (eval 32) -> 32")
  (lint-test "(eval 'x)"                " eval: perhaps (eval 'x) -> x")
  (lint-test "(eval (string->symbol \"x\"))" " eval: perhaps (eval (string->symbol \"x\")) -> x eval: perhaps (string->symbol \"x\") -> 'x")
  (lint-test "(eval 'x env)"            " eval: perhaps (eval 'x env) -> (env 'x)")
  (lint-test "(eval (read (open-input-string expr)))"    " eval: perhaps (eval (read (open-input-string expr))) -> (eval-string expr)")
  (lint-test "(eval (call-with-input-string port read))" " eval: perhaps (eval (call-with-input-string port read)) -> (eval-string port)")
  (lint-test "(eval '(begin (display (* x y)) z) env)"   " eval: perhaps (eval '(begin (display (* x y)) z) env) -> (with-let env (display (* x y)) z)")
  (lint-test "(eval (list '* 2 x))"     " eval: perhaps (eval (list '* 2 x)) -> (* 2 (eval x))")
  (lint-test "(eval (string->symbol str))" " eval: perhaps (eval (string->symbol str)) -> (eval-string str)")

  (lint-test "(write-char x (current-output-port))" 
	     " write-char: (current-output-port) is the default port for write-char: (write-char x (current-output-port))")
  (lint-test "(with-let 123 123)"	" with-let: with-let: first argument should be an environment:  (with-let 123 123)")
  (lint-test "(with-let (rootlet) 1)"	"")
  (lint-test "(with-let e (define b (+ a 1)) (display a))" " with-let: b not used, initially: (+ a 1) from define")
  (lint-test "(string-length \"asdf\")" " string-length: perhaps (string-length \"asdf\") -> 4")
  (lint-test "(> 0 (string-length x))"  " >: string-length can't be negative: (> 0 (string-length x))")
  (lint-test "(< (string-length x) 0)"  " <: string-length can't be negative: (< (string-length x) 0)")

  (lint-test "(round '(1))"		" round: in (round '(1)), round's argument should be real, but '(1) is a list?")
  (lint-test "(round '1.2)"		" round: quote is not needed here: '1.2")
  (lint-test "(round (integer->char 96))" 
	     " round: in (round (integer->char 96)), round's argument should be real, but (integer->char 96) is a char?
               round: perhaps (integer->char 96) -> #\\`")

  (lint-test "(integer->char (+ (char->integer #\\space) 215))" 
	     " integer->char: perhaps (integer->char (+ (char->integer #\\space) 215)) -> #\\xf7")
  (lint-test "(char->integer (read-char p))" 
	     " char->integer: in (char->integer (read-char p)), char->integer's argument  should be a char, but (read-char p) might also be eof-object?
               char->integer: perhaps (char->integer (read-char p)) -> (read-byte p)")
  (lint-test "(write-char (integer->char c))" " write-char: perhaps (write-char (integer->char c)) -> (write-byte c)")

  (lint-test "(let ((v (make-vector 3))) (vector-set! v 3.14 #\\a))"
	     "let: perhaps (let ((v (make-vector 3))) (vector-set! v 3.14 #\\a)) -> (vector-set! (make-vector 3) 3.14 #\\a)
	      let: in (vector-set! v 3.14 #\\a), vector-set!'s argument 2 should be an integer, but 3.14 is a float?")
  (lint-test "(let ((v (make-float-vector 3))) (float-vector-set! v 3.14 1))"
	     "let: perhaps (let ((v (make-float-vector 3))) (float-vector-set! v 3.14 1)) -> (float-vector-set! (make-float-vector 3) 3.14 1)
              let: in (float-vector-set! v 3.14 1), float-vector-set!'s argument 2 should be an integer, but 3.14 is a float?")
  (lint-test "(let ((v (make-float-vector 3))) (float-vector-set! v 1 3.14))" 
	     "let: perhaps (let ((v (make-float-vector 3))) (float-vector-set! v 1 3.14)) -> (float-vector-set! (make-float-vector 3) 1 3.14)")
  (lint-test "(let ((v (make-float-vector 3))) (float-vector-set! v 1 #\\a))"
	     "let: perhaps (let ((v (make-float-vector 3))) (float-vector-set! v 1 #\\a)) -> (float-vector-set! (make-float-vector 3) 1 #\\a)
	      let: in (float-vector-set! v 1 #\\a), float-vector-set!'s argument 3 should be real, but #\\a is a char?")
  (lint-test "(vector-set! (vector-ref a i) j x)" " vector-set!: perhaps (vector-set! (vector-ref a i) j x) -> (set! (a i j) x)")
  (lint-test "(vector-set! (vector-copy doc) i newval)" 
	     " vector-set!: (vector-copy doc) is simply discarded; perhaps (vector-set! (vector-copy doc) i newval) -> newval")

  (lint-test "(reverse! #i(1 2))" 
	     " reverse!: perhaps (reverse! #i(2 1)) -> #i(2 1) 
               reverse!: #i(2 1) is a constant, so (reverse! #i(2 1)) is problematic")
  (lint-test "(sort! #r(0 1 2) <)" " sort!: #r(0.0 1.0 2.0) is a constant, so (sort! #r(0.0 1.0 2.0) <) is problematic")
  (lint-test "(string-fill! \"123\" #\\c)" " string-fill!: 123 is a constant, so (string-fill! \"123\" #\\c) is problematic")
  (lint-test "(list-fill! '(1 2 3) 1)" " list-fill!: '(1 2 3) is a constant, so (list-fill! '(1 2 3) 1) is problematic")
  (lint-test "(vector-fill! #(0 a) 2)" " vector-fill!: #(0 a) is a constant, so (vector-fill! #(0 a) 2) is problematic")
  (lint-test "(fill! #r(0 1 2) <)" " fill!: #r(0.0 1.0 2.0) is a constant, so (fill! #r(0.0 1.0 2.0) <) is problematic")
  (lint-test "(set-car! '(1 2) 3)" " set-car!: '(1 2) is a constant, so (set-car! '(1 2) 3) is problematic")
  (lint-test "(set-cdr! '(1 2) 3)" " set-cdr!: '(1 2) is a constant, so (set-cdr! '(1 2) 3) is problematic")
  (lint-test "(let ((x #r(1 2))) (vector-set! x 0 1))" 
	     " let: perhaps (let ((x #r(1.0 2.0))) (vector-set! x 0 1)) -> (vector-set! #r(1.0 2.0) 0 1)
               let: x's value, #r(1.0 2.0), is a literal constant, so this set! is trouble: (vector-set! x 0 1)
               let: x is a float-vector, so perhaps use float-vector-set!, not vector-set!")
  (lint-test "(int-vector-set! #i(0 1) 0 1)" 
	     " int-vector-set!: #i(0 1) is a constant, so int-vector-set! is problematic, and #i(0 1) is discarded; perhaps (int-vector-set! #i(0 1) 0 1) -> 1")
  (lint-test "(float-vector-set! #r(0 1) 0 1)" 
	     " float-vector-set!: #r(0.0 1.0) is a constant, so float-vector-set! is problematic, and #r(0.0 1.0) is discarded; perhaps (float-vector-set! #r(0.0 1.0) 0 1) -> 1")
  (lint-test "(list-set! '(1 2) 0 1)" 
	     " list-set!: '(1 2) is a constant, so list-set! is problematic, and '(1 2) is discarded; perhaps (list-set! '(1 2) 0 1) -> 1")
  (lint-test "(string-set! \"123\" 0 #\\c)" 
	     " string-set!: \"123\" is a constant, so string-set! is problematic, and \"123\" is discarded; perhaps (string-set! \"123\" 0 #\\c) -> #\\c")
  (lint-test "(vector-set! #(1 2) 0 32)" 
	     " vector-set!: #(1 2) is a constant, so vector-set! is problematic, and #(1 2) is discarded; perhaps (vector-set! #(1 2) 0 32) -> 32
               vector-set!: #(1 2) could be #i(1 2)")
  (lint-test "(int-vector-set! #r(0 1) 0 1)" 
	     " int-vector-set!: in (int-vector-set! #r(0.0 1.0) 0 1),
               int-vector-set!'s argument 1 should be an int-vector, but #r(0.0 1.0) is a float-vector?
               int-vector-set!: #r(0.0 1.0) is a constant, so int-vector-set! is problematic, and #r(0.0 1.0) is discarded; perhaps (int-vector-set! #r(0.0 1.0) 0 1) -> 1")
  (lint-test "(float-vector-set! #i(0 1) 0 1)" 
	     " float-vector-set!: in (float-vector-set! #i(0 1) 0 1),
               float-vector-set!'s argument 1 should be a float-vector, but #i(0 1) is an int-vector?
               float-vector-set!: #i(0 1) is a constant, so float-vector-set! is problematic, and #i(0 1) is discarded; perhaps (float-vector-set! #i(0 1) 0 1) -> 1")
  (lint-test "(float-vector-set! #(0 1) 0 1)" 
	     " float-vector-set!: in (float-vector-set! #(0 1) 0 1),
               float-vector-set!'s argument 1 should be a float-vector, but #(0 1) is a vector?
               float-vector-set!: #(0 1) is a constant, so float-vector-set! is problematic, and #(0 1) is discarded; perhaps (float-vector-set! #(0 1) 0 1) -> 1
               float-vector-set!: #(0 1) could be #i(0 1)")
  (lint-test "(vector-set! (make-vector 1) 0 1)" 
	     " vector-set!: (make-vector 1) is simply discarded; perhaps (vector-set! (make-vector 1) 0 1) -> 1")
  (lint-test "(vector-set! #(0) 1 2)" " vector-set!: index 1 is too large in (vector-set! #(0) 1 2) vector-set!: #(0) could be #i(0)")
  (lint-test "(int-vector-set! (float-vector 0 1) 0 1)" 
	     " int-vector-set!: in (int-vector-set! (float-vector 0 1) 0 1), int-vector-set!'s argument 1 should be an int-vector, but (float-vector 0 1) is a float-vector?
               int-vector-set!: (float-vector 0 1) is simply discarded; perhaps (int-vector-set! (float-vector 0 1) 0 1) -> 1")
  (lint-test "(set! (#(1 a) 0) 32)" " set!: #(1 a) is a constant so (set! (#(1 a) 0) 32) is problematic")

  (lint-test "(string-downcase \"SPEAK SOFTLY\")" " string-downcase: perhaps (string-downcase \"SPEAK SOFTLY\") -> \"speak softly\"")
  (lint-test "(vector-length (copy arr))"                  " vector-length: perhaps (vector-length (copy arr)) -> (vector-length arr)")
  (lint-test "(vector-length (copy src dest))"             " vector-length: perhaps (vector-length (copy src dest)) -> (vector-length dest)")
  (lint-test "(vector-length (vector-copy arr start))"     " vector-length: perhaps (vector-length (vector-copy arr start)) -> (- (vector-length arr) start)")
  (lint-test "(vector-length (vector-copy arr start end))" " vector-length: perhaps (vector-length (vector-copy arr start end)) -> (- end start)")
  (lint-test "(odd? (- x 1))"  " odd?: perhaps (odd? (- x 1)) -> (even? x)")
  (lint-test "(even? (+ 2 x))" " even?: perhaps (even? (+ 2 x)) -> (even? x)")
  (lint-test "(even? (- 1 x))" " even?: perhaps (even? (- 1 x)) -> (odd? x)")
  (lint-test "(even? (- 1 2))" " even?: perhaps (even? (- 1 2)) -> #f even?: perhaps (- 1 2) -> -1")
  (lint-test "(string-append str (format () str arg))" 
	     " string-append: in (string-append str (format () str arg)), string-append's argument 2 should be a string, but (format () str arg) might also be boolean?")
  (lint-test "(not (peek-char))" " not: (not (peek-char)) can't be true (peek-char never returns #f)")
  (lint-test "(number->string saturation 10)" " number->string: 10 is the default radix for number->string: (number->string saturation 10)")
  (lint-test "(<= (string-length m) 0)" " <=: string-length is never negative, so (<= (string-length m) 0) -> (= (string-length m) 0)")
  (lint-test "(>= (vector-length m) 0)" " >=: vector-length is never negative, so (>= (vector-length m) 0) -> #t")
  (lint-test "(<= 0 (string-length m))" " <=: string-length is never negative, so (<= 0 (string-length m)) -> #t")
  (lint-test "(>= 0 (vector-length m))" " >=: vector-length is never negative, so (>= 0 (vector-length m)) -> (= 0 (vector-length m))")
  (lint-test "(cdr (or (assq 'cpu annot) '(_ . 0)))" 
	     " cdr: perhaps (cdr (or (assq 'cpu annot) '(_ . 0))) -> (cond ((assq 'cpu annot) => cdr) (else 0))")
  (lint-test "(cdr (or (memv #\\. file) (cons #\\. file)))" 
	     " cdr: perhaps (cdr (or (memv #\\. file) (cons #\\. file))) -> (cond ((memv #\\. file) => cdr) (else file))")
  (lint-test "(number->string (cdr (or (assv i alist) (cons 0 0))))" 
	     " number->string: perhaps (cdr (or (assv i alist) (cons 0 0))) -> (cond ((assv i alist) => cdr) (else 0))")
  (lint-test "(cdr (or (assoc n oi) `(,n)))" 
	     " cdr: perhaps (cdr (or (assoc n oi) (list-values n))) -> (cond ((assoc n oi) => cdr) (else (list)))
               cdr: perhaps (list-values n) -> (list n)")
  (lint-test "(cdr (or (assoc n oi) (list n y)))" 
	     " cdr: perhaps (cdr (or (assoc n oi) (list n y))) -> (cond ((assoc n oi) => cdr) (else (list y)))")
  (lint-test "(cdr (or (assoc n oi) (list n y z)))" 
	     " cdr: perhaps (cdr (or (assoc n oi) (list n y z))) -> (cond ((assoc n oi) => cdr) (else (list y z)))")
  (lint-test "(cdr (or (find i alist) (error 'oops)))" 
	     " cdr: perhaps (cdr (or (find i alist) (error 'oops))) -> (cond ((find i alist) => cdr) (else (error 'oops)))")
  (lint-test "(cadr (or (find i alist) '(1 2 3)))" 
	     " cadr: perhaps (cadr (or (find i alist) '(1 2 3))) -> (cond ((find i alist) => cadr) (else 2))")
  (lint-test "(list->vector (reverse nts))" " list->vector: perhaps (list->vector (reverse nts)) -> (reverse (list->vector nts))")
  (lint-test "(cadr (reverse (f x)))" " cadr: perhaps (cadr (reverse (f x))) -> (let ((_1_ (f x))) (list-ref _1_ (- (length _1_) 2)))")
  (lint-test "(begin (if x (error 'oops)) (if x y))" 
	     " begin: x is #f in (if x y)
               begin: perhaps (... (if x (error 'oops)) (if x y) ...) -> (... (when x (error 'oops) y) ...)")

  (lint-test "(round (char-position #\\a \"asb\"))" 
	     " round: in (round (char-position #\\a \"asb\")), round's argument should be real, but (char-position #\\a \"asb\") might also be boolean?")
  (lint-test "(string-ref (char-position #\\a \"asb\") 1)" 
	     " string-ref: in (string-ref (char-position #\\a \"asb\") 1), 
                 string-ref's argument 1 should be a string, but (char-position #\\a \"asb\") is an integer or a boolean?")
  (lint-test "(char-position \"xyz\" \"asb\")" "")
  (lint-test "(if (null? (cons x y)) 1.0 0.0)" " if: perhaps (null? (cons x y)) -> #f  if: perhaps (if (null? (cons x y)) 1.0 0.0) -> 0.0")
  (lint-test "(if (null (cdr x)) 0)"	       " if: misspelled 'null? in (null (cdr x))?")
  (lint-test "(list-set x 1 y)"                " list-set: misspelled 'list-set! in (list-set x 1 y)?")
  (lint-test "(string-index path #\\/)"        " string-index: perhaps (string-index path #\\/) -> (char-position #\\/ path)")
  (lint-test "(string-index path #\\/ start end)" " string-index: perhaps (string-index path #\\/ start end) -> (char-position #\\/ path start end)")
  (lint-test "(cons* x y)"                     " cons*: perhaps (cons* x y) -> (cons x y)")
  (lint-test "(if (pair? (sin x)) 1.0 0.0)"    " if: perhaps (pair? (sin x)) -> #f  if: perhaps (if (pair? (sin x)) 1.0 0.0) -> 0.0")
  (lint-test "(if (number? (sin x)) 1.0)"      " if: perhaps (number? (sin x)) -> #t if: perhaps (if (number? (sin x)) 1.0) -> 1.0")
  (lint-test "(if (number? (car x)) 1.0)"      "")
  (lint-test "(if (real? (sin x)) 1.0)"	       "")
  (lint-test "(let ((list x)) (null? list))"  
	     " let: perhaps (let ((list x)) (null? list)) -> (null? x)
               let: assuming we see all set!s, the binding (list x) is pointless: perhaps (let ((list x)) (null? list)) -> (null? x)")
  (lint-test "(set! x (real? (imag-part z)))" "set!: perhaps (real? (imag-part z)) -> #t set!: (real? (imag-part z)) is always #t")
  (lint-test "(let ((x (char? (string-ref z y)))) x)" 
	     " let: perhaps (char? (string-ref z y)) -> #t
               let: (char? (string-ref z y)) is always #t
               let: perhaps (let ((x (char? (string-ref z y)))) x) -> (char? (string-ref z y))")
  (lint-test "(case (number? (log x y)) ((#f) 0) ((#t) 1))" " case: perhaps (number? (log x y)) -> #t case: (number? (log x y)) is always #t")
  (lint-test "(let () (define (f9 x) (write x)) (f9 (vector? (vector))))" 
	     " let: perhaps (... (define (f9 x) (write x)) (f9 (vector? (vector)))) -> (... (let ((x (vector? (vector)))) (write x)))
               f9: leaving aside write's optional arg, f9 could be (define f9 write)
               let: perhaps (vector? (vector)) -> #t
               let: (vector? (vector)) is always #t")
  (lint-test "(display (string? (string)))"           
	     " display: perhaps (string? (string)) -> #t
               display: (string? (string)) is always #t
               display: (string) could be \"\"")
  (lint-test "(if (number? 1.0) 1.0 0.0)"             " if: perhaps (number? 1.0) -> #t  if: perhaps (if (number? 1.0) 1.0 0.0) -> 1.0")
  (lint-test "(if (pair? 1.0) 1.0 0.0)"               " if: perhaps (pair? 1.0) -> #f  if: perhaps (if (pair? 1.0) 1.0 0.0) -> 0.0")
  (lint-test "(if (symbol? (string->symbol x)) 0 1)"  " if: perhaps (symbol? (string->symbol x)) -> #t  if: perhaps (if (symbol? (string->symbol x)) 0 1) -> 0")
  (lint-test "(if (symbol? (symbol->string x)) 0 1)"  " if: perhaps (symbol? (symbol->string x)) -> #f  if: perhaps (if (symbol? (symbol->string x)) 0 1) -> 1")
  (lint-test "(and (symbol? x) (gensym? x))"          " and: perhaps (and (symbol? x) (gensym? x)) -> (gensym? x)")
  (lint-test "(integer? (*s7* 'vector-print-length))" " integer?: unknown *s7* field: 'vector-print-length")
  (lint-test "(dynamic-wind (lambda () (s7-version)) (lambda () (list)) (lambda () #f))"
	     " dynamic-wind: perhaps (lambda () (s7-version)) -> s7-version
               dynamic-wind: perhaps (lambda () (list)) -> list
               dynamic-wind: perhaps (list) -> (); there is only one nil")
  (lint-test "(lambda args (apply + args))"           " lambda: perhaps (lambda args (apply + args)) -> +")
  (lint-test "(let ((x 1) (y '(1 2))) `(,x ,@y))" 
	     " let: perhaps (let ((x 1) (y '(1 2))) (list-values x (apply-values y))) -> (list-values 1 (apply-values '(1 2)))
               let: perhaps (list-values x (apply-values y)) -> (cons x y)")

  (lint-test "(display #\\escape)" "")
  ;; these tickled a lint bug
  (lint-test "(define :xxx 321)"	" define: keywords are constants :xxx")
  (lint-test "(define (:yyy a) a)"	" define: keywords are constants :yyy")
  (lint-test "(cons ((pair? x) 2) y)"   " cons: cons's argument ((pair? x) 2) looks odd: pair? returns boolean? which is not applicable")
  (lint-test "(cons ((g x) y) (else #f))" " cons: else (as car of second argument to cons) makes no sense: (cons ((g x) y) (else #f))")

  (lint-test "(let ((r (make-random-state 123 432))) (random 1.0 r))" 
	     " let: make-random-state is deprecated; use random-state
               let: perhaps (let ((r (make-random-state 123 432))) (random 1.0 r)) -> (random 1.0 (make-random-state 123 432))")
  (lint-test "(let ((c (current-environment))) (defined? 'x c))" 
	     " let: current-environment is deprecated; use curlet
               let: perhaps (let ((c (current-environment))) (defined? 'x c)) -> (defined? 'x (current-environment))")

  (lint-test "(let ((x 1) (y 2)) (if (= x 1) (begin (define (f1) x) (define (f2) (+ x 1)))) (f1 1))" 
	     " let: f1 has too many arguments: (f1 1)
               let: y not used, initially: 2 from let")
  ;; ideally we'd also point out that f2 is unused
  (lint-test "(let ((x 1) (y 2)) (when (= x 1) (begin (define (f1) x) (define (f2) (+ x 1)))) (f1 1))"
	     " let: redundant begin: (begin (define (f1) x) (define (f2) (+ x 1)))
               let: f1 has too many arguments: (f1 1)
               let: y not used, initially: 2 from let")
  ;; and here also

  (lint-test "(defmacro hi ())"		" defmacro: defmacro declaration is messed up:  (defmacro hi ())")
  (lint-test "(defmacro hi (a b a) a)"	" defmacro: defmacro parameter is repeated: (a b a) hi: defmacro parameter a is declared twice")
  (lint-test "(defmacro hi (a b) `(+ ,a ,b))" 
	     " defmacro: defmacro is deprecated; perhaps (defmacro hi (a b) (list-values '+ a b)) -> (define-macro (hi a b) (list-values '+ a b))
               defmacro: perhaps (define-macro (hi a b) (list-values '+ a b)) -> (define hi +)")
  (lint-test "(defmacro hi a `(+ ,a ,b))" 
	     " defmacro: defmacro is deprecated; perhaps (defmacro hi a (list-values '+ a b)) -> (define-macro (hi . a) (list-values '+ a b))")
  (lint-test "(defmacro* mac1 (a :key b :optional c . d) `(list ,a ,b ,c ,@d))" 
	     " defmacro*: defmacro* is deprecated; perhaps (defmacro* mac1 (a :key b :optional c . d) (list-values 'list a b c... ->
                (define-macro* (mac1 a b c . d) (list-values 'list a b c (apply-values d)))")

  (lint-test "(define)"			" define: (define) makes no sense")
  (lint-test "(define a)"		" define: (define a) has no value?")
  (lint-test "(let () (define (f a) (+ a b)) (define b 21) (f 1))" " let: b is used before it is defined: (define b 21)")
  (lint-test "(define a . b)"		" define: (define a . b) makes no sense")
  (lint-test "(define a b c)"		" define: (define a b c) has too many values?")
  (lint-test "(define a a)"		" define: this define is either not needed, or is an error: (define a a)")
  (lint-test "(define #(a) 2)"		" define: strange form: (define #(a) 2)")
  (lint-test "(define (f1 a) (abs a))"  " f1: f1 could be (define f1 abs)")
  (lint-test "(define (f1 a b) \"a docstring\" (log a b))" " f1: f1 could be (define f1 log)")
  (lint-test "(let () (define (f1 a b) (* 2 (log a b))) (define (f2 a b) (f1 a b)) (f2 1 2))" 
	     " let: perhaps change f2 to a let: 
                 (let () (define (f1 a b) (* 2 (log a b))) (define (f2 a b) (f1 a b)) (f2 1 2)) -> (... (let ((a 1) (b 2)) ...))
	       f2: f2 could be (define f2 f1) f1 is called only in f2")
  (lint-test "(define (f x) (define aaa 1) (define aaa 2) (+ aaa 1))" 
	     " f: perhaps (... (define aaa 1) (define aaa 2) (+ aaa 1)) -> (... (let ((aaa 1) (aaa 2)) ...))
               f: define variable aaa is redefined in the define body.  Perhaps use set! instead: (set! aaa 2)
               f: aaa not used, initially: 1 from define")
  (lint-test "(lambda ())"		  " lambda: lambda is messed up in        (lambda ())")
  (lint-test "(lambda (a b a) a)"         " lambda: lambda parameter is repeated: (a b a) lambda: lambda parameter a is declared twice")
  (lint-test "((lambda () 32) 0)"         " (lambda () 32): perhaps ((lambda () 32) 0) -> 32")
  (lint-test "((lambda x x) 1 2 3)"       " (lambda x x): perhaps ((lambda x x) 1 2 3) -> (list 1 2 3)")
  (lint-test "((lambda (a b) (+ a b)) 1)" " (lambda (a b) (+ a b)): perhaps (lambda (a b) (+ a b)) -> +")
  (lint-test "((lambda* ((a 1) b) (+ a b)) (values 2 3))" "")
  (lint-test "(lambda* (:key a :optional b :rest c :allow-other-keys) a)" " lambda*: :key is no longer accepted: (:key a :optional b :rest ...")
  (lint-test "(lambda* (a :rest) a)"	" lambda*: :rest parameter needs a name: (a :rest)")
  (lint-test "(lambda* (a :rest (b 1)) b)" " lambda*: :rest parameter can't specify a default value: (a :rest (b 1))")
  (lint-test "(lambda* (a :allow-other-keys b) a)" " lambda*: :allow-other-keys should be at the end of the parameter list:(a :allow-other-keys b)")
  (lint-test "(lambda (a :b c) a)"	" lambda: lambda arglist can't handle keywords (use lambda*)")
  (lint-test "(lambda (a b) (>= b a))"	" lambda: perhaps (lambda (a b) (>= b a)) -> <=")
  (lint-test "(lambda (a b c) (/ a b c))" " lambda: perhaps (lambda (a b c) (/ a b c)) -> /")
  (lint-test "(lambda (a . b) (apply + a b))" " lambda: perhaps (lambda (a . b) (apply + a b)) -> +")
  (lint-test "(lambda args (apply and args))" "")
  (lint-test "(lambda (x y) (and x y))"  "")
  (lint-test "((lambda (x) x) 32)"       " (lambda (x) x): perhaps ((lambda (x) x) 32) -> 32")
  (lint-test "((lambda (x) (cdr (cdr (car x)))) z)" 
	     " (lambda (x) (cdr (cdr (car x)))): perhaps ((lambda (x) (cdr (cdr (car x)))) z) -> (let ((x z)) (cdr (cdr (car x))))
               (lambda (x) (cdr (cdr (car x)))): perhaps (lambda (x) (cdr (cdr (car x)))) -> cddar
               (lambda (x) (cdr (cdr (car x)))): perhaps (cdr (cdr (car x))) -> (cddar x)")
  (lint-test "((lambda () (+ x y)))"                " (lambda () (+ x y)): perhaps ((lambda () (+ x y))) -> (+ x y)")
  (lint-test "((lambda () (define (f123 x) (+ x 1)) (f123 32)))" 
	     " (lambda () (define (f123 x) (+ x 1)) (f123 32)): perhaps ((lambda () (define (f123 x) (+ x 1)) (f123 32))) -> (let () (define (f123 x) (+ x 1)) (f123 32))
               (lambda () (define (f123 x) (+ x 1)) (f123 32)): the inner function f123 could be moved outside the lambda: 
                 (lambda () (define (f123 x) (+ x 1)) (f123 32)) -> (let () (define (f123 x) (+ x 1)) (lambda () ...))
               (lambda () (define (f123 x) (+ x 1)) (f123 32)): perhaps (... (define (f123 x) (+ x 1)) (f123 32)) -> (... (let ((x 32)) (+ x 1)))")
  (lint-test "((lambda (x) (+ x 1)) y)"             " (lambda (x) (+ x 1)): perhaps ((lambda (x) (+ x 1)) y) -> (let ((x y)) (+ x 1))")
  (lint-test "((lambda x (+ (car x) 1)) y)"         " (lambda x (+ (car x) 1)): perhaps ((lambda x (+ (car x) 1)) y) -> (let ((x (list y))) (+ (car x) 1))")
  (lint-test "((lambda x (+ (car x) 1)) y z)"       " (lambda x (+ (car x) 1)): perhaps ((lambda x (+ (car x) 1)) y z) -> (let ((x (list y z))) (+ (car x) 1))")
  (lint-test "((lambda x (+ (car x) 1)))"           " (lambda x (+ (car x) 1)): perhaps ((lambda x (+ (car x) 1))) -> (let ((x (list))) (+ (car x) 1))")
  (lint-test "((lambda (x . y) (+ x (car y))) a b)" 
	     " (lambda (x . y) (+ x (car y))): perhaps ((lambda (x . y) (+ x (car y))) a b) -> (let ((x a) (y (list b))) (+ x (car y)))")
  (lint-test "((lambda* ((x 1)) (+ x 1)))"          " (lambda* ((x 1)) (+ x 1)): perhaps ((lambda* ((x 1)) (+ x 1))) -> (let ((x 1)) (+ x 1))")
  (lint-test "((lambda* ((x 1)) (+ x 1)) y)"        " (lambda* ((x 1)) (+ x 1)): perhaps ((lambda* ((x 1)) (+ x 1)) y) -> (let ((x y)) (+ x 1))")
  (lint-test "((lambda* (x (y 1)) (+ x y)) z)"      " (lambda* (x (y 1)) (+ x y)): perhaps ((lambda* (x (y 1)) (+ x y)) z) -> (let* ((x z) (y 1)) (+ x y))")
  (lint-test "((lambda* (x (y 1)) (+ x y)) a b)"    " (lambda* (x (y 1)) (+ x y)): perhaps ((lambda* (x (y 1)) (+ x y)) a b) -> (let* ((x a) (y b)) (+ x y))")
  (lint-test "((lambda* (x (y 1)) (+ x y)))"        " (lambda* (x (y 1)) (+ x y)): perhaps ((lambda* (x (y 1)) (+ x y))) -> (let* ((x #f) (y 1)) (+ x y))")

  (lint-test "(lambda (i) (define (fdo x) (+ x 1)) (if (= i 3) (display (fdo i)) (loop (+ i 1))))" 
	     " lambda: the inner function fdo could be moved outside the lambda: 
                 (lambda (i) (define (fdo x) (+ x 1)) (if (= i 3) (display (fdo i)) (loop... ->
                 (let () (define (fdo x) (+ x 1)) (lambda (i) ...))
               lambda: perhaps (... (define (fdo x) (+ x 1)) (if (= i 3) (display (fdo i)) (loop (+ i 1)))) ->
                 (... (if (= i 3) (display (let ((x i)) (+ x 1))) (loop (+ i 1))))")
  (lint-test "(lambda (i) (define (fdo x) (+ (fdi x) 1)) (define (fdi y) (* y 2)) (if (= i 3) (display (fdo i)) (loop (+ i 1))))"
	     " lambda: the inner functions fdo, fdi could be moved outside the lambda: 
                 (lambda (i) (define (fdo x) (+ (fdi x) 1)) (define (fdi y) (* y 2)) (if (=... ->
                 (let () (define (fdo x) (+ (fdi x) 1)) (define (fdi y) (* y 2)) (lambda (i) ...))")
  (lint-test "(lambda (i) (define (fdo x) (+ (fdi x) i)) (define (fdi y) (* y 2)) (if (= i 3) (display (fdo i)) (loop (+ i 1))))" 
	     " lambda: the inner function fdi could be moved outside the lambda: 
                 (lambda (i) (define (fdo x) (+ (fdi x) i)) (define (fdi y) (* y 2)) (if (=... ->
                 (let () (define (fdi y) (* y 2)) (lambda (i) ...))")
  (lint-test "(lambda (i) (let ((y 32)) (define (fdo x) (+ x 1)) (if (= i y) (display (fdo i)) (loop (+ i 1)))))"
	     " lambda: the inner function fdo could be moved outside the lambda: 
                 (lambda (i) (let ((y 32)) (define (fdo x) (+ x 1)) (if (= i y) (display... -> (let () (define (fdo x) (+ x 1)) (lambda (i) ...))
               lambda: perhaps (... (define (fdo x) (+ x 1)) (if (= i y) (display (fdo i)) (loop (+ i 1)))) ->
                 (... (if (= i y) (display (let ((x i)) (+ x 1))) (loop (+ i 1))))
               lambda: y can be moved to lambda's closure")
  (lint-test "(let ((y 33)) (define (fdo x) (+ x 1)) (if (= i y) (display (fdo i)) (loop (+ i 1))))" 
	     " let: the inner function fdo could be moved into the let: 
                 (let ((y 33)) (define (fdo x) (+ x 1)) (if (= i y) (display (fdo i)) (loop... -> (let ((y 33) (fdo (lambda (x) (+ x 1)))) ...)
               let: perhaps (... (define (fdo x) (+ x 1)) (if (= i y) (display (fdo i)) (loop (+ i 1)))) ->
                 (... (if (= i y) (display (let ((x i)) (+ x 1))) (loop (+ i 1))))")
  (lint-test "(let* ((y 34) (z (log y))) (define (fdo x) (+ x 1)) (if (= z y) (display (fdo y)) (loop (+ i 1))))" 
	     " let*: the inner function fdo could be moved out of the let*: 
                 (let* ((y 34) (z (log y))) (define (fdo x) (+ x 1)) (if (= z y) (display... -> (let ((fdo (lambda (x) (+ x 1)))) (let* ((y 34) (z (log y))) ...))
               let*: perhaps (... (define (fdo x) (+ x 1)) (if (= z y) (display (fdo y)) (loop (+ i 1)))) ->
                 (... (if (= z y) (display (let ((x y)) (+ x 1))) (loop (+ i 1))))")
  (lint-test "(define (fda y) (define (fdo x) (+ x 1)) (if (= y 3) (display (fdo y))))" 
	     " define: the inner function fdo could be moved to fda's closure: 
                 (define (fda y) (define (fdo x) (+ x 1)) (if (= y 3) (display (fdo y)))) -> (define fda (let () (define (fdo x) (+ x 1)) (lambda (y) ...)))
               define: perhaps (define (fda y) (define (fdo x) (+ x 1)) (if (= y 3) (display (fdo y)))) ->
                 (define (fda y) (if (= y 3) (display (let ((x y)) (+ x 1)))))")
  (lint-test "(define* (fda (y 32) :rest z) (define (fdo x) (+ x 1)) (if (= y 3) (display (fdo z))))" 
	     " define*: the inner function fdo could be moved to fda's closure: 
                 (define* (fda (y 32) :rest z) (define (fdo x) (+ x 1)) (if (= y 3)... -> (define fda (let () (define (fdo x) (+ x 1)) (lambda* ((y 32) :rest z) ...)))
               define*: perhaps (define* (fda (y 32) :rest z) (define (fdo x) (+ x 1)) (if (= y 3)... ->
                 (define* (fda (y 32) :rest z) (if (= y 3) (display (let ((x z)) (+ x 1)))))")
  (lint-test "(define (fda y . z) (define (fdo x) (+ x 1)) (if (= y 3) (display (fdo y))))" 
	     " define: the inner function fdo could be moved to fda's closure: 
                 (define (fda y . z) (define (fdo x) (+ x 1)) (if (= y 3) (display (fdo y)))) -> 
                 (define fda (let () (define (fdo x) (+ x 1)) (lambda (y . z) ...)))
               define: perhaps (define (fda y . z) (define (fdo x) (+ x 1)) (if (= y 3) (display (fdo y)))) ->
                 (define (fda y . z) (if (= y 3) (display (let ((x y)) (+ x 1)))))")
  (lint-test "(define (fda y z) (define (fdo . x) (list x 1)) (if (= y 3) (display (fdo y))))" 
	     " define: the inner function fdo could be moved to fda's closure: 
                 (define (fda y z) (define (fdo . x) (list x 1)) (if (= y 3) (display (fdo y)))) ->
                 (define fda (let () (define (fdo . x) (list x 1)) (lambda (y z) ...)))")
  (lint-test "(define (fda z) (define (fdo x . y) (list x y)) (if (= z 3) (display (fdo z))))" 
	     " define: the inner function fdo could be moved to fda's closure: 
                 (define (fda z) (define (fdo x . y) (list x y)) (if (= z 3) (display (fdo z)))) ->
                 (define fda (let () (define (fdo x . y) (list x y)) (lambda (z) ...)))")
  (lint-test "(define (fda . z) (define (fdo x) (+ x 1)) (if (= y 3) (display (fdo y))))" 
	     " define: the inner function fdo could be moved to fda's closure: 
                 (define (fda . z) (define (fdo x) (+ x 1)) (if (= y 3) (display (fdo y)))) ->
                 (define fda (let () (define (fdo x) (+ x 1)) (lambda z ...)))
               define: perhaps (define (fda . z) (define (fdo x) (+ x 1)) (if (= y 3) (display (fdo y)))) ->
                 (define (fda . z) (if (= y 3) (display (let ((x y)) (+ x 1)))))")
  (lint-test "(lambda (i) (let ((y 32)) (define (fdo i) (+ i 1)) (if (= i y) (display (fdo i)) (loop (+ i 1)))))" 
	     " lambda: the inner function fdo could be moved outside the lambda: 
                 (lambda (i) (let ((y 32)) (define (fdo i) (+ i 1)) (if (= i y) (display... -> (let () (define (fdo i) (+ i 1)) (lambda (i) ...))
               lambda: perhaps (... (define (fdo i) (+ i 1)) (if (= i y) (display (fdo i)) (loop (+ i 1)))) ->
                 (... (if (= i y) (display (let ((i i)) (+ i 1))) (loop (+ i 1))))
               lambda: y can be moved to lambda's closure")
  (lint-test "(lambda (i) (let ((y 32)) (define fdo (lambda (i) (+ i 1))) (if (= i y) (display (fdo i)) (loop (+ i 1)))))" 
	     " lambda: the inner function fdo could be moved outside the lambda: 
                 (lambda (i) (let ((y 32)) (define fdo (lambda (i) (+ i 1))) (if (= i y)... -> (let () (define fdo (lambda (i) (+ i 1))) (lambda (i) ...))
               lambda: y can be moved to lambda's closure")
  (lint-test "(define (f x) (let ((y 32) (fdo (lambda (i) (+ i 1)))) (if (= i y) (display (fdo i)) (loop (+ i 1)))))"
	     " define: the local function fdo could be moved to f's closure: 
                 (define (f x) (let ((y 32) (fdo (lambda (i) (+ i 1)))) (if (= i y)... -> 
                 (define f (let ((fdo (lambda (i) (+ i 1)))) (lambda (x) ...)))
               f: y can be moved to f's closure")
  (lint-test "(define (f x) (let ((y 32) (fdo (lambda (i) (+ i 1)))) (define (fdi i) (+ i 2)) (if (= i y) (display (fdo (fdi i))) (loop (+ i 1)))))"
	     " define: the inner function fdi could be moved to f's closure: 
                 (define (f x) (let ((y 32) (fdo (lambda (i) (+ i 1)))) (define (fdi i) (+... ->
                 (define f (let () (define (fdi i) (+ i 2)) (lambda (x) ...)))
               define: the local function fdo could be moved to f's closure: 
                 (define (f x) (let ((y 32) (fdo (lambda (i) (+ i 1)))) (define (fdi i) (+... ->
                 (define f (let ((fdo (lambda (i) (+ i 1)))) (lambda (x) ...)))
               f: perhaps (... (define (fdi i) (+ i 2)) (if (= i y) (display (fdo (fdi i))) (loop (+... ->
                 (... (if (= i y) (display (fdo (let ((i i)) (+ i 2)))) (loop (+ i 1))))
               f: y can be moved to f's closure")
  (lint-test "(lambda (x) (let ((y 32) (fdo (lambda (i) (+ i 1)))) (if (= i y) (display (fdo i)) (loop (+ i 1)))))"
	     " lambda: the local function fdo could be moved outside the lambda: 
                 (lambda (x) (let ((y 32) (fdo (lambda (i) (+ i 1)))) (if (= i y) (display... ->
                 (let ((fdo (lambda (i) (+ i 1)))) (lambda (x) ...))
               lambda: y can be moved to lambda's closure")
  (lint-test "(lambda (x) (let ((y 32) (fdo (lambda (i) (+ i 1)))) (define (fdi i) (+ i 2)) (if (= i y) (display (fdo (fdi i))) (loop (+ i 1)))))"
	     " lambda: the inner function fdi could be moved outside the lambda: 
                 (lambda (x) (let ((y 32) (fdo (lambda (i) (+ i 1)))) (define (fdi i) (+ i... ->
                 (let () (define (fdi i) (+ i 2)) (lambda (x) ...))
               lambda: the local function fdo could be moved outside the lambda: 
                 (lambda (x) (let ((y 32) (fdo (lambda (i) (+ i 1)))) (define (fdi i) (+ i... ->
                 (let ((fdo (lambda (i) (+ i 1)))) (lambda (x) ...))
               lambda: perhaps (... (define (fdi i) (+ i 2)) (if (= i y) (display (fdo (fdi i))) (loop (+... ->
                 (... (if (= i y) (display (fdo (let ((i i)) (+ i 2)))) (loop (+ i 1))))
               lambda: y can be moved to lambda's closure")
  
  (lint-test "(let () (define (f1 a) a) (f1 2 3))" 
	     " let: perhaps (... (define (f1 a) a) (f1 2 3)) -> (... (let ((a 2)) a))
               let: f1 has too many arguments: (f1 2 3)")
  (lint-test "(let () (define-macro (m1 a) a) (m1 2 3))" " let: m1 has too many arguments: (m1 2 3)")
  (lint-test "(let () (define-macro (m2 b) `(let ((a 12)) (+ a ,b))) (let ((a 1) (+ *)) (+ a (m2 a))))" 
	     " let: possible problematic macro expansion: (m2 a) may collide with subsequently defined 'a, +
               let: assuming we see all set!s, the binding (+ *) is pointless: perhaps (let ((a 1) (+ *)) (+ a (m2 a))) -> (let ((a 1)) (* a (m2 a)))")
  (lint-test "(let () (define-macro (m3 b) `(let ((a 12)) (+ (symbol->value ,b) a))) (let ((a 1)) (+ a (m3 'a))))" 
	     " let: possible problematic macro expansion:  (m3 'a) could conceivably collide with subsequently defined 'a")
  (lint-test "(define-macro (f . x) `(+ ,@x))" 
	     " define-macro: perhaps (define-macro (f . x) (list-values '+ (apply-values x))) -> (define f +)
               f: perhaps (list-values '+ (apply-values x)) -> (cons '+ x)")
  (lint-test "(define-macro (f a . x) `(+ ,a ,@x))" 
	     " define-macro: perhaps (define-macro (f a . x) (list-values '+ a (apply-values x))) -> (define f +)
               f: perhaps (list-values '+ a (apply-values x)) -> (cons '+ (cons a x))")
  (lint-test "(define-macro (m1 a) `((,a b c)))" " m1: perhaps (list-values (list-values a 'b 'c)) -> (list (list a 'b 'c))")

  (lint-test "(define pi (acos -1))" " define: (acos -1) is one of its many names, but pi is a predefined constant in s7 pi: perhaps (acos -1) -> pi")
  (lint-test "(+ x (atan 0 -1))"     " +: perhaps (+ x (atan 0 -1)) -> (+ x pi)")
  (lint-test "(define (f1) 32)" "")
  (lint-test "(define (f2 a) a)" "")
  (lint-test "(define (f3 . a) a)" "")
  (lint-test "(define (f4 a b) a)" "")
  (lint-test "(define (f5 a . b) a)" "")
  (lint-test "(define (f6 a b . c) a)" "")
  
  (lint-test "(define* (f1) 32)" " f1: define* could be define")
  (lint-test "(define* (f2 a) a)" "")
  (lint-test "(define* (f3 . a) a)" "")
  (lint-test "(define* (f4 a (b 2)) a)" "")
  (lint-test "(define* (f5 a :rest b) a)" "")
  (lint-test "(define* (f6 a b :allow-other-keys) a)" "")
  
  (lint-test "(define f1 (lambda () 32))" "")
  (lint-test "(define f2 (lambda (a) a))" "")
  (lint-test "(define f3 (lambda a a))" "")
  (lint-test "(define f4 (lambda (a b) a))" "")
  (lint-test "(define f5 (lambda (a . b) a))" "")
  
  (lint-test "(define-macro (f1) 32)"     " define-macro: perhaps (define-macro (f1) 32) -> (define f1 32) or (define (f1) 32)")
  (lint-test "(define-macro (m1) 32)"     " define-macro: perhaps (define-macro (m1) 32) -> (define m1 32) or (define (m1) 32)")
  (lint-test "(define-macro (m2) 'a)" "")
  (lint-test "(define-macro (m3) ''a)" 
	     " define-macro: perhaps (define-macro (m3) ''a) -> (define m3 'a) or (define (m3) 'a)
               m3: returns a list constant: ''a")
  (lint-test "(define-macro (m4 a) `(abs ,a))"   
	     " define-macro: perhaps (define-macro (m4 a) (list-values 'abs a)) -> (define m4 abs)
               m4: perhaps (list-values 'abs a) -> (list 'abs a)")
  (lint-test "(define-macro (m5 a) `(log ,a 2))" " define-macro: perhaps (define-macro (m5 a) (list-values 'log a 2)) -> (define (m5 a) (log a 2))")
  (lint-test "(define-macro (m6 a) `(+ ,a ,a))" "")  ; here a might be (display 32) -- should happen twice
  (lint-test "(define-macro (m7 a b) `(set! ,a ,b))" " define-macro: perhaps (define-macro (m7 a b) (list-values 'set! a b)) -> (define m7 set!)")
  (lint-test "(define-macro (m8 a) `(lambda () ,a))" "") 
  (lint-test "(define-macro (m8 a) `(let () ,a))" "") 
  (lint-test "(define-macro (m9 a b) `(+ ,a (* ,b 2)))" "")
  (lint-test "(define-macro (m10 a) `(+ ,a x))" " define-macro: perhaps (define-macro (m10 a) (list-values '+ a 'x)) -> (define (m10 a) (+ a x))")
  (lint-test "(define-macro (m11) (- -1 (* -2 (expt 2 28))))" 
	     " define-macro: perhaps (define-macro (m11) (- -1 (* -2 (expt 2 28)))) ->
                 (define m11 (- -1 (* -2 (expt 2 28)))) or (define (m11) (- -1 (* -2 (expt 2 28))))")
  (lint-test "(define-macro (f2 a) a)" "")
  (lint-test "(define-macro (f3 . a) a)" "")
  (lint-test "(define-macro (f4 a b) a)" "")
  (lint-test "(define-macro (f5 a . b) a)" "")
  (lint-test "(define-macro (f6 a b . c) a)" "")
  (unless pure-s7
    (lint-test "(define-macro (mac a) `(+ ,,a 1))"
	       " mac: define-macro probably has too many unquotes: (list-values '+ (unquote a) 1)"))
  (lint-test "(define-macro (m a) `(+ 1 a))" 
	     " define-macro: missing comma? (define-macro (m a) '(+ 1 a)) m: returns a list constant: '(+ 1 a)")
  (lint-test "(define-macro (m a) `(+ 1 ,a (* a 2)))" 
	     " define-macro: perhaps (define-macro (m a) (list-values '+ 1 a '(* a 2))) -> (define (m a) (+ 1 a (* a 2)))
               define-macro: missing comma? (define-macro (m a) (list-values '+ 1 a '(* a 2)))")
  (lint-test "(define-macro (m1 x) `(begin (vector-set! ,x 0 1)))" 
	     " m1: pointless begin: (list-values 'begin (list-values 'vector-set! x 0 1)) -> (list-values 'vector-set! x 0 1)
               m1: perhaps (list-values 'begin (list-values 'vector-set! x 0 1)) -> (list 'begin (list 'vector-set! x 0 1))")
  
  (lint-test "(let ((a 1)) (define (f1 b) (+ a b)) (f1 0))" 
	     " let: perhaps (... (define (f1 b) (+ a b)) (f1 0)) -> (... (let ((b 0)) (+ a b)))
               a is used only in f1")
  (lint-test "(let f1 ((a 1)) a)" " let: f1 not used, value: (let f1 ((a 1)) a) let: perhaps (let f1 ((a 1)) a) -> 1")
  (lint-test "(let f1 ((a 1)) (f1 a))" "")
  (lint-test "(let f1 ((a 1)) (+ a (f1)))" " let: f1 needs 1 argument:  (f1)")
  (lint-test "(let f1 ((a 1)) (f1 a 2))" " let: f1 has too many arguments: (f1 a 2)")
  (lint-test "(define f7 (let ((a 1)) (lambda () a)))" "")
  (lint-test "(let () (define f7 (let ((a 1)) (lambda () a))) (f7))" "")
;  (lint-test "(let () (define f7 (let ((a 1)) (lambda () a))) (f7 1))" "...")
  
  (lint-test "(let () (define (f1) 32) (f1))" " let: perhaps (... (define (f1) 32) (f1)) -> (... 32)")
  (lint-test "(let () (define (f1) 32) (f1 32))" 
	     " let: perhaps (... (define (f1) 32) (f1 32)) -> (... 32)
               let: f1 has too many arguments: (f1 32)")
  (lint-test "(let () (define (f2 a) a) (f2))" 
	     " let: perhaps (... (define (f2 a) a) (f2)) -> (... (let () a))
               let: f2 needs 1 argument: (f2)")
  (lint-test "(let () (define (f2 a) a) (f2 3))" " let: perhaps (... (define (f2 a) a) (f2 3)) -> (... (let ((a 3)) a))")
  (lint-test "(let () (define (f2 a) a) (f2 3 32))"  
	     " let: perhaps (... (define (f2 a) a) (f2 3 32)) -> (... (let ((a 3)) a))
               let: f2 has too many arguments: (f2 3 32)")
  (lint-test "(let () (define (f3 . a) a) (f3))" "")
  (lint-test "(let () (define (f3 . a) a) (f3 1))" "")
  (lint-test "(let () (define (f3 . a) a) (f3 1 2 3))" "")
  (lint-test "(let () (define (f4 a b) a) (f4))" 
	     " let: perhaps (... (define (f4 a b) a) (f4)) -> (... (let () a))
               let: f4 needs 2 arguments: (f4)")
  (lint-test "(let () (define (f4 a b) a) (f4 1))" 
	     " let: perhaps (... (define (f4 a b) a) (f4 1)) -> (... (let ((a 1)) a))
               let: f4 needs 2 arguments: (f4 1)")
  (lint-test "(let () (define (f4 a b) a) (f4 1 2))" 
	     " let: perhaps (... (define (f4 a b) a) (f4 1 2)) -> (... (let ((a 1) (b 2)) a))
               let: f4's parameter 2 is not used, but a value is passed: 2")
  (lint-test "(let () (define (f4 a b) a) (f4 1 2 3))" 
	     " let: perhaps (... (define (f4 a b) a) (f4 1 2 3)) -> (... (let ((a 1) (b 2)) a))
               let: f4 has too many arguments: (f4 1 2 3)
               let: f4's parameter 2 is not used, but a value is passed: 2")

  (lint-test "(let () (define (f5 a . b) a) (f5))"         " let: f5 needs 1 argument:  (f5)")
  (lint-test "(let () (define (f5 a . b) a) (f5 1))" "")
  (lint-test "(let () (define (f5 a . b) a) (f5 1 2))"     " let: f5's parameter 2 is not used, but a value is passed: 2")
  (lint-test "(let () (define (f5 a . b) a) (f5 1 2 3 4))" " let: f5's parameter 2 is not used, but a value is passed: 2")
  (lint-test "(let () (define (f6 a b . c) a) (f6))"       " let: f6 needs 2 arguments:  (f6)")
  (lint-test "(let () (define (f6 a b . c) a) (f6 1))"     " let: f6 needs 2 arguments:  (f6 1)")
  (lint-test "(let () (define (f6 a b . c) a) (f6 1 2))"   " let: f6's parameter 2 is not used, but a value is passed: 2")
  (lint-test "(let () (define (f6 a b . c) a) (f6 1 2 3))" 
	     " let: f6's parameter 2 is not used, but a value is passed: 2
               let: f6's parameter 3 is not used, but a value is passed: 3")
  (lint-test "(let () (define (f6 a b . c) a) (f6 1 2 3 4))" 
	     " let: f6's parameter 2 is not used, but a value is passed: 2
               let: f6's parameter 3 is not used, but a value is passed: 3")

  (lint-test "(let () (define (f7 x) (+ x 1)) (f7 3) 4)" 
	     " let: perhaps (... (define (f7 x) (+ x 1)) (f7 3) 4) -> (... (let ((x 3)) (+ x 1)) 4)
               let: this could be omitted: (f7 3)")
  (lint-test "(let () (define* (f7 x) (+ x 1)) (f7 3) 4)" 
	     " let: perhaps (... (define* (f7 x) (+ x 1)) (f7 3) 4) -> (... (let ((x 3)) (+ x 1)) 4)
               let: this could be omitted: (f7 3)")
  (lint-test "(let () (define (f7 x) (display x)) (f7 3) 4)" 
	     " let: perhaps (... (define (f7 x) (display x)) (f7 3) 4) -> (... (let ((x 3)) (display x)) 4)
               f7: leaving aside display's optional arg, f7 could be (define f7 display)")
  (lint-test "(let () (define (f a b) (min b a)) (f x y))" 
	     " let: perhaps (... (define (f a b) (min b a)) (f x y)) -> (... (let ((a x) (b y)) (min b a)))
               f: leaving aside min's optional args, f could be (define f min)")
  (lint-test "(let () (define (f a b) (< b a)) (f x y))" 
	     " let: perhaps (... (define (f a b) (< b a)) (f x y)) -> (... (let ((a x) (b y)) (< b a)))
               f: leaving aside <'s optional args, f could be (define f >)")
  (lint-test "(let () (define (f a b) (eq? b a)) (f x y))" 
	     " let: perhaps (... (define (f a b) (eq? b a)) (f x y)) -> (... (let ((a x) (b y)) (eq? b a)))
               f: f could be (define f eq?)")
  (lint-test "(let () (define (f7 x) (+ x 1)) (f7 (display 3)) 4)" 
	     " let: perhaps (... (define (f7 x) (+ x 1)) (f7 (display 3)) 4) -> (... (let ((x (display 3))) (+ x 1)) 4)")
  (lint-test "(let () (define* (f7 x) (+ x 1)) (let ((y 3)) (f7 y) 4))" 
	     " let: perhaps (let ((y 3)) (f7 y) 4) -> (let () (f7 3) 4)
	       let: this could be omitted:  (f7 y)")
  (lint-test "(let () (define (f1 . x) (apply + x)) (f1 1 2))" " f1: f1 could be (define f1 +)")
  (lint-test "(let () (define (f1 a . b) (apply + a b)) (f1 1 2))" " f1: f1 could be (define f1 +)")
  (lint-test "(let () (define (f1 x) (abs x)) (f1 1))" 
	     " let: perhaps (... (define (f1 x) (abs x)) (f1 1)) -> (... (let ((x 1)) (abs x)))
               f1: f1 could be (define f1 abs)")
  (lint-test "(let () (define (f1 x) (cdr (car x))) (f1 z))" 
	     " let: perhaps (... (define (f1 x) (cdr (car x))) (f1 z)) -> (... (let ((x z)) (cdr (car x))))
               f1: f1 could be (define f1 cdar)
               f1: perhaps (cdr (car x)) -> (cdar x)")
  
  (lint-test "(begin (define* (f1) 32) (f1))" " f1: define* could be define")
  (lint-test "(begin (define* (f1) 32) (f1 :a 1))" 
	     " f1: define* could be define begin: f1 has too many arguments: (f1 :a 1) begin: f1 keyword argument :a (in (f1 :a 1)) does not match any argument in ()")
  (lint-test "(begin (define* (f2 a) a) (f2))" "")
  (lint-test "(begin (define* (f2 a) a) (f2 1))" "")
  (lint-test "(begin (define* (f2 a) a) (f2 :a 1))" "")
  (lint-test "(begin (define* (f2 a) a) (f2 :b 1))" " begin: f2 keyword argument :b (in (f2 :b 1)) does not match any argument in (a)")
  (lint-test "(begin (define* (f2 a) a) (f2 :a 1 2))" 
	     " begin: f2 has too many arguments: (f2 :a 1 2) begin: non-keyword argument 2 follows previous keyword")
  (lint-test "(begin (define* (f2 a) a) (f2 :a 1 :a 2))" " begin: f2 has too many arguments: (f2 :a 1 :a 2) begin: :a is repeated in (:a 1 :a 2)")
  (lint-test "(begin (define* (f2 a) a) (f2 1 2))" " begin: f2 has too many arguments: (f2 1 2)")
  (lint-test "(begin (define* (f3 . a) a) (f3))" "")
  (lint-test "(begin (define* (f3 . a) a) (f3 1))" "")
  (lint-test "(begin (define* (f3 . a) a) (f3 :a 1))" "")
  (lint-test "(begin (define* (f3 . a) a) (f3 1 2))" "")
  (lint-test "(begin (define* (f4 a (b 2)) a) (f4))" "")
  (lint-test "(begin (define* (f4 a (b 2)) a) (f4 :a 1))" "")
  (lint-test "(begin (define* (f4 a (b 2)) a) (f4 :b 1))" "")
  (lint-test "(begin (define* (f4 a (b 2)) a) (f4 :c 1))" " begin: f4 keyword argument :c (in (f4 :c 1)) does not match any argument in (a (b 2))")
  (lint-test "(begin (define* (f4 a (b 2)) a) (f4 :a 1 :c 2))" " begin: f4 keyword argument :c (in (f4 :a 1 :c 2)) does not match any argument in (a (b 2))")
  (lint-test "(begin (define* (f4 a (b 2)) a) (f4 :a 1 :b 2))" "")
  (lint-test "(begin (define* (f4 a (b 2)) a) (f4 1 :a 1 :b 2))" " begin: f4 has too many arguments: (f4 1 :a 1 :b 2)")
  (lint-test "(begin (define* (f5 a :rest b) a) (f5))" "")
  (lint-test "(begin (define* (f5 a :rest b) a) (f5 1))" "")
  (lint-test "(begin (define* (f5 a :rest b) a) (f5 1 2 3))" "")
  (lint-test "(begin (define* (f5 a :rest b) a) (f5 :b 1))" "")
  (lint-test "(begin (define* (f5 a :rest b) a) (f5 :a 1 2 3))" " begin: non-keyword argument 2 follows previous keyword")
  (lint-test "(begin (define* (f6 a b :allow-other-keys) a) (f6))" "")
  (lint-test "(begin (define* (f6 a b :allow-other-keys) a) (f6 :a 1 :b 2 :c 3))" "")
  (lint-test "(let () (define (f8 a) (+ a 1)) (string-ref (f8 1) 2))" 
	     " let: perhaps (... (define (f8 a) (+ a 1)) (string-ref (f8 1) 2)) -> (... (string-ref (let ((a 1)) (+ a 1)) 2))
               let: in (string-ref (f8 1) 2), string-ref's argument 1 should be a string, but (f8 1) is a number?")
  (lint-test "(begin (define (f11 x) (+ x 1)) (f11 (integer->char 32)))" 
	     " begin: in (f11 (integer->char 32)), f11's argument should be a number, but (integer->char 32) is a char?
               begin: perhaps (integer->char 32) -> #\\space")
  (lint-test "(begin (define (f12 x) (log x 2)) (f12 \"asdf\"))" 
	     " begin: in (f12 \"asdf\"), f12's argument should be a number, but \"asdf\" is a string?")
  (lint-test "(+ a #\\a 2)" " +: in (+ a #\\a 2), +'s argument 2 should be a number, but #\\a is a char?")
  (lint-test "(begin (define (f13 x) (string-ref x 0)) (f13 #i(0 1 2)))" 
	     " begin: in (f13 #i(0 1 2)), f13's argument should be a string, but #i(0 1 2) is an int-vector?")
  (lint-test "(begin (define (f14 x) (float-vector-set! v x 1.0)) (f14 1+i))" 
	     " begin: in (f14 1+1i), f14's argument should be an integer, but 1+1i is complex?")
  (lint-test "(begin (define (f14 x) (float-vector-set! x 1 1.0)) (f14 1+i))" 
	     " begin: in (f14 1+1i), f14's argument should be a float-vector, but 1+1i is complex?")
  (lint-test "(begin (define (f14 x) (* 2 (float-vector-set! x 1 1.0))) (f14 1+i))" 
	      " begin: in (f14 1+1i), f14's argument should be a float-vector, but 1+1i is complex?")
  (lint-test "(begin (define (f15 x) (* 2 (+ x 1))) (f15 #()))" 
	     " begin: in (f15 #()), f15's argument should be a number, but #() is a vector?")
  (lint-test "(begin (define (f16 x) (vector-set! v 1 x)) (f16 #f))" "")
  (lint-test "(begin (define (f16 y x) (vector-set! v (f y) 2) (vector-set! v (f y) x)) (f16 0 #f))" "")
  (lint-test "(begin (define (f16 y x z) (vector-set! z (f y) x)) (f16 0 #f #()))" "")

  (lint-test "(let ((fv (float-vector 1 2 3))) (fv 1))" " let: perhaps (let ((fv (float-vector 1 2 3))) (fv 1)) -> ((float-vector 1 2 3) 1)")
  (lint-test "(let ((fv (inlet 'a 1))) (fv 'a))" " let: perhaps (let ((fv (inlet 'a 1))) (fv 'a)) -> ((inlet 'a 1) 'a)")
  (lint-test "(let ((fv (float-vector 1 2 3))) (fv -1))"
	     " let: perhaps (let ((fv (float-vector 1 2 3))) (fv -1)) -> ((float-vector 1 2 3) -1)
               let: fv's index -1 is negative")
  (lint-test "(let ((fv (float-vector 1 2 3))) (fv 10))"
	     " let: perhaps (let ((fv (float-vector 1 2 3))) (fv 10)) -> ((float-vector 1 2 3) 10)
               let: fv has length 3, but index is 10")
  (lint-test "(let ((fv (float-vector 1 2 3))) (set! (fv 1) #\\a))"  " let: fv wants real, but the value in (set! (fv 1) #\\a) is a char?")
  (lint-test "(let ((fv (float-vector 1 2 3))) (set! (fv 10) 1.5))"  " let: fv has length 3, but index is 10")
  (lint-test "(let ((fv (make-float-vector 3))) (set! (fv 10) 1.5))" " let: fv has length 3, but index is 10")
  (lint-test "(let ((fv (make-float-vector 3))) (set! (fv 0) (floor x)))" "")
  (lint-test "(let ((fv (make-float-vector 3))) (+ 1 (fv 3)))"       " let: fv has length 3, but index is 3")
  (lint-test "(let ((fv (make-string 3))) (+ 1 (fv 1)))"             "") ; someday...

  (lint-test "(let () (define (f8 a b) (+ 1 (f8 2 3))) (f8 1 2))" 
	     " let: perhaps (... (define (f8 a b) (+ 1 (f8 2 3))) (f8 1 2)) -> (... (let f8 ((a 1) (b 2)) (+ 1 (f8 2 3))))
               let: f8's parameter 1 is not used, but a value is passed: 1
               let: f8's parameter 2 is not used, but a value is passed: 2")
  (lint-test "(let () (define (f8 a b) ((lambda (c) (f8 c 3)) 1)) (f8 1 2))" 
	     " let: perhaps (... (define (f8 a b) ((lambda (c) (f8 c 3)) 1)) (f8 1 2)) -> (... (let f8 ((a 1) (b 2)) ((lambda (c) (f8 c 3)) 1)))
               f8: perhaps ((lambda (c) (f8 c 3)) 1) -> (let ((c 1)) (f8 c 3))
               let: f8's parameter 1 is not used, but a value is passed: 1
               let: f8's parameter 2 is not used, but a value is passed: 2")
  (lint-test "(let () (define (f1) 32) (set! f1 4) (+ 1 f1))" "")
  (lint-test "(let () (define (f1) 32) (+ 1 f1))" " let: f1 is a procedure, but + in (+ 1 f1) wants a number?")
  (lint-test "(let () (define f10 (lambda (a) a)) (set! f10 (lambda (a b) (+ a b))) (f10 1 2))" 
	     " let: perhaps (lambda (a b) (+ a b)) -> +")
  (lint-test "(begin (define (f20 x y) (+ y 1)) (f20 (+ z 1) z))" " begin: f20's parameter 1 is not used, but a value is passed: (+ z 1)")
  (lint-test "(begin (define (f21 x y) (set! x 3) (+ y 1)) (f21 (+ z 1) z))" 
	     " f21: perhaps (set! x 3) -> (let ((x 3)) ...)
	       begin: f21's parameter 1's value is not used, but a value is passed: (+ z 1)")
  (lint-test "(begin (define (f22 x) (case y ((0) `(+ ,x 1)) (else #f))) (f22 2))" 
	     " f22: perhaps (case y ((0) (list-values '+ x 1)) (else #f)) -> (and (eqv? y 0) (list-values '+ x 1))")
  (lint-test "(begin (define (f23 x) (+ y 1)) (define (f24 x) (f23 (+ x 1))) (f24 0))"
	     " f24: f23's parameter 1 is not used, but a value is passed: (+ x 1)")
  (unless pure-s7
    (lint-test "(begin (define x 1) `#(,x))" ; this can be expanded: (lambda (x) #((unquote x)))
	       " begin: quasiquoted vectors are not supported: #((unquote x)) perhaps use `(vector ...) rather than `#(...)"))
  (lint-test "(begin (define-macro (m1 x y) `(+ ,y 1)) (m1 a b))" 
	     " begin: perhaps (define-macro (m1 x y) (list-values '+ y 1)) -> (define (m1 x y) (+ y 1))
               begin: m1's parameter 1 is not used, but a value is passed: a")
  (lint-test "(begin (define (f30 x) (if (> x 0) (f30 #() (- x 1)))) (f30 1))" " f30: f30 has too many arguments: (f30 #() (- x 1))")

  (lint-test "(let () (define plus (case-lambda (() 0) ((x y) x) ((x y) (+ x y)) ((x y z) (+ x y z)) (args (apply + args)))) (plus))"
	     " plus: repeated parameter list? (x y) in (case-lambda (() 0) ((x y) x) ((x y) (+ x y)) ((x y z) (+ x y z)) (args (apply + args)))
               case-lambda: perhaps (lambda (x y) (+ x y)) -> +
               case-lambda: perhaps (lambda (x y z) (+ x y z)) -> +
               case-lambda: perhaps (lambda args (apply + args)) -> +
               let: perhaps (let () (define plus (case-lambda (() 0) ((x y) x) ((x y) (+ x y)) ((x y... ->
                 (let ((plus (case-lambda (() 0) ((x y) x) ((x y) (+ x y)) ((x y z) (+ x y z)) (args (apply + args))))) ...)")
  (lint-test "(case-lambda ((a b) (+ a b)))"
	     " case-lambda: perhaps (lambda (a b) (+ a b)) -> +
               case-lambda: perhaps (case-lambda ((a b) (+ a b))) -> (lambda (a b) (+ a b))")
  (lint-test "(case-lambda \"a doc string\" ((a b) (+ a b)))"
	     " case-lambda: perhaps (lambda (a b) (+ a b)) -> +
               case-lambda: perhaps (case-lambda \"a doc string\" ((a b) (+ a b))) -> (let ((+documentation+ \"a doc string\")) (lambda (a b) (+ a b)))")
  (lint-test "(case-lambda (() (display x #f)) ((y) (display x y)))" 
	     " case-lambda: (display x #f) could be x
               case-lambda: perhaps (case-lambda (() (display x #f)) ((y) (display x y))) -> (lambda* (y) (display x y))")
  (lint-test "(case-lambda (() (+ x 0)) ((y) (+ x y)))" 
	     " case-lambda: perhaps (+ x 0) -> x
               case-lambda: perhaps (case-lambda (() (+ x 0)) ((y) (+ x y))) -> (lambda* ((y 0)) (+ x y))")
  (lint-test "(case-lambda ((x) (log x 2)) ((x y) (log x y)))" 
	     " case-lambda: perhaps (lambda (x y) (log x y)) -> log
               case-lambda: perhaps (case-lambda ((x) (log x 2)) ((x y) (log x y))) -> (lambda* (x (y 2)) (log x y))")
  (lint-test "(case-lambda ((x) (log x 2)) ((y x) (log x y)))" "")
  (lint-test "(case-lambda ((x) (log x 2)) ((y x z) (log x y)))" "")

  (lint-test "(let loop ((pi 1.0) (+ pi 1)))"
	     " let: can't bind a constant: (pi 1.0)
               let: let binding is messed up: (+ pi 1)
               let: loop not used, value: (let loop ((pi 1.0) (+ pi 1)))")
  (lint-test "(define (f12 pi) pi)"             " define: f12 parameter can't be a constant: (f12 pi)")
  (lint-test "(define* (f12 (pi 1.0)) pi)"      "f12: parameter can't be a constant: ((pi 1.0))")
  (lint-test "(define (f12 :key) :key)"         " define: f12 parameter can't be a keyword: (f12 :key)")
  (lint-test "(define :a 3)"                    " define: keywords are constants :a")
  (lint-test "(let () (define most-positive-fixnum 32) most-positive-fixnum)" 
	     " let: most-positive-fixnum is a constant in s7: (define most-positive-fixnum 32)
               let: perhaps omit most-positive-fixnum and return 32
               let: perhaps (let () (define most-positive-fixnum 32) most-positive-fixnum) -> (let ((most-positive-fixnum 32)) ...)")
  (lint-test "(let () (define-constant __lt1__ 32) (set! __lt1__ 3) (+ __lt1__ 1))"
	     " let: can't set! __lt1__ in (set! __lt1__ 3) (it is a constant: 32)")
  (lint-test "(let () (define (f1 x) (+ x 1)) f1)" " let: perhaps omit f1, and change (define (f1 x) ...) -> (lambda (x) ...)")
  (lint-test "(let () (define (f1 x) (f2 (+ x 1))) (define (f2 x) x) (f1 3))" "")
  (lint-test "(let () (define (f1 a) (let ((a (vector->list a))) (car a))) (f1 #(a)))" 
	     " let: perhaps (... (define (f1 a) (let ((a (vector->list a))) (car a))) (f1 #(a))) -> (... (let ((a #(a))) (let ((a (vector->list a))) (car a))))
               f1: perhaps (let ((a (vector->list a))) (car a)) -> (car (vector->list a))")
  (lint-test "(car (vector->list a))"           " car: perhaps (car (vector->list a)) -> (vector-ref a 0)")

  (lint-test "(null? (list))"                   " null?: perhaps (null? (list)) -> #t null?: perhaps (list) -> (); there is only one nil")
  (lint-test "(null? (list 1))"                 " null?: perhaps (null? (list 1)) -> #f null?: perhaps (list 1) -> '(1)")
  (lint-test "(pair? (list 1))"                 " pair?: perhaps (pair? (list 1)) -> #t pair?: perhaps (list 1) -> '(1)")
  (lint-test "(proper-list? (list))"            
	     " proper-list?: perhaps (proper-list? (list)) -> #t  
               proper-list?: (proper-list? (list)) is always #t
               proper-list?: perhaps (list) -> (); there is only one nil")
  (lint-test "(proper-list? (list 1))"          
	     " proper-list?: perhaps (proper-list? (list 1)) -> #t 
               proper-list?: (proper-list? (list 1)) is always #t
               proper-list?: perhaps (list 1) -> '(1)")
  (lint-test "(or (list? e) (null? e))"         " or: perhaps (or (list? e) (null? e)) -> (list? e)")
  (lint-test "(or (list? e) (pair? e))"         " or: perhaps (or (list? e) (pair? e)) -> (list? e)")
  (lint-test "(or (proper-list? e) (null? e))"  " or: perhaps (or (proper-list? e) (null? e)) -> (proper-list? e)")
  (lint-test "(or (proper-list? e) (pair? e))" "")
  (lint-test "(and (list? e) (null? e))"        " and: perhaps (and (list? e) (null? e)) -> (null? e)")
  (lint-test "(and (list? e) (pair? e))"        " and: perhaps (and (list? e) (pair? e)) -> (pair? e)")
  (lint-test "(and (proper-list? e) (null? e))" " and: perhaps (and (proper-list? e) (null? e)) -> (null? e)")
  (lint-test "(and (proper-list? e) (pair? e))" "")
  (lint-test "(let ((x 1/2)) (integer? x))"     " let: perhaps (let ((x 1/2)) (integer? x)) -> (integer? 1/2)  let: x is 1/2, so (integer? x) is #f")
  (lint-test "(let ((x 1/2)) (real? x))"        " let: perhaps (let ((x 1/2)) (real? x)) -> (real? 1/2) let: x is rational, so (real? x) is #t")
  (lint-test "(let ((x 1/2)) (rational? x))"    " let: perhaps (let ((x 1/2)) (rational? x)) -> (rational? 1/2) let: x is rational, so (rational? x) is #t")
  (lint-test "(let ((x 1/2)) (pair? x))"        " let: perhaps (let ((x 1/2)) (pair? x)) -> (pair? 1/2) let: x is rational, so (pair? x) is #f")
  (lint-test "(let ((x ())) (list? x))"         " let: perhaps (let ((x ())) (list? x)) -> (list? ())")
  (lint-test "(let ((x (list 1))) (list? x))"   
	     " let: perhaps (let ((x (list 1))) (list? x)) -> (list? (list 1))
               let: x is a proper-list, so (list? x) is #t")
  (lint-test "(let ((x \"a\") (y \"\")) (eq? x y))" " let: perhaps (let ((x \"a\") (y \"\")) (eq? x y)) -> (eq? \"a\" \"\")")
  (lint-test "(let ((x 12)) (set! x 32) (integer? x))" 
	     " let: x is an integer, so (integer? x) is #t
               let: perhaps (let ((x 12)) (set! x 32) (integer? x)) -> (let ((x 32)) (integer? x))")
  (lint-test "(and (char-alphabetic? x) (char? x))" " and: perhaps (and (char-alphabetic? x) (char? x)) -> (char-alphabetic? x)")
  (lint-test "(or (char-numeric? x) (char? x))"   " or: perhaps (or (char-numeric? x) (char? x)) -> (char? x)")
  (lint-test "(or (char-numeric? x) (char-whitespace? x))" "")
  (lint-test "(and (char-alphabetic? x) (pair? x))" " and: perhaps (and (char-alphabetic? x) (pair? x)) -> #f")
  (lint-test "(and (char? x) (char-numeric? x))" "")
  (lint-test "(char=? #\\a (read-char p))" 
	     " char=?: in (char=? #\\a (read-char p)), char=?'s argument 2 should be a char, but (read-char p) might also be eof-object?")
  (lint-test "(< (string->number x) 0)" 
	     " <: in (< (string->number x) 0), <'s argument 1 should be real, but (string->number x) might also be boolean?")
  (lint-test "(vector-ref v (+ i 1))" "")

  (lint-test "(or (number? x) (nan? x))"         " or: perhaps (or (number? x) (nan? x)) -> (number? x)")
  (lint-test "(and (infinite? x) (nan? x))"      " and: perhaps (and (infinite? x) (nan? x)) -> #f")
  (lint-test "(and (real? x) (nan? x))" "")
  (lint-test "(and (< x 3) (< x 4))"             " and: perhaps (and (< x 3) (< x 4)) -> (< x 3)")
  (lint-test "(and (inexact? x) (exact? x))"     " and: perhaps (and (inexact? x) (exact? x)) -> #f")
  (lint-test "(and (inexact? x) (rational? x))"  " and: perhaps (and (inexact? x) (rational? x)) -> #f")
  (lint-test "(and (inexact? x) (even? x))"      " and: perhaps (and (inexact? x) (even? x)) -> #f")
  (lint-test "(and (integer? x) (even? x))" "")
  (lint-test "(and (odd? x) (integer? x))"       " and: perhaps (and (odd? x) (integer? x)) -> (odd? x)")
  (lint-test "(and (odd? x) (even? x))"          " and: perhaps (and (odd? x) (even? x)) -> #f")
  (lint-test "(and (inexact? x) (float? x))"     " and: perhaps (and (inexact? x) (float? x)) -> (float? x)")
  (lint-test "(or (inexact? x) (float? x))"      " or: perhaps (or (inexact? x) (float? x)) -> (inexact? x)")
  (lint-test "(or (float? x) (inexact? x))"      " or: perhaps (or (float? x) (inexact? x)) -> (inexact? x)")
  (lint-test "(and (float? x) (inexact? x))"     " and: perhaps (and (float? x) (inexact? x)) -> (float? x)")
  (lint-test "(and (symbol? x) (defined? x))" "") ; this avoids a type error if not a symbol, so can't be reduced
  (lint-test "(and (defined? x) (symbol? x))"    " and: perhaps (and (defined? x) (symbol? x)) -> (defined? x)")
  (lint-test "(and (negative? x) (not (real? x)))" " and: perhaps (and (negative? x) (not (real? x))) -> #f")
  (lint-test "(and (positive? x) (real? x))"     " and: perhaps (and (positive? x) (real? x)) -> (positive? x)")
  (lint-test "(or (real? x) (zero? x))"          " or: perhaps (or (real? x) (zero? x)) -> (real? x)")
  (lint-test "(and (zero? x) (negative? x))"     " and: perhaps (and (zero? x) (negative? x)) -> #f")
  (unless pure-s7
    (lint-test "(and (real? x) (not (inexact? x)))" " and: perhaps (and (real? x) (not (inexact? x))) -> (rational? x)")
    (lint-test "(and (exact? x) (not (inexact? x)))" " and: perhaps (and (exact? x) (not (inexact? x))) -> (exact? x)"))
  (lint-test "(and (real? x) (not (zero? x)))" "") ; this is correct
  (lint-test "(and (even? x) (not (real? x)))"   " and: perhaps (and (even? x) (not (real? x))) -> #f")
  (lint-test "(and (exact? x) (zero? x))"        " and: perhaps (and (exact? x) (zero? x)) -> (eqv? x 0)")
  (lint-test "(and (zero? x) (inexact? x))"      " and: perhaps (and (zero? x) (inexact? x)) -> (eqv? x 0.0)")
  (lint-test "(and (pair? x) (+ x 1))"           "in (and (pair? x) (+ x 1)), x is a pair, but + wants a number?")
  (lint-test "(and (boolean? x) (not x))"        " and: perhaps (and (boolean? x) (not x)) -> (not x)")
  (lint-test "(and (boolean? x) (eq? x #f))"     " and: perhaps (and (boolean? x) (eq? x #f)) -> (eq? x #f) and: perhaps (eq? x #f) -> (not x)")
  (lint-test "(and (symbol? id) (not (member id x)))"  " in (and (symbol? id) (not (member id x))), perhaps change (member id x) to (memq ...)")
  (lint-test "(and (symbol? id) (not (equal? id x)))"  " in (and (symbol? id) (not (equal? id x))), perhaps change (equal? id x) to (eq? ...)")
  (lint-test "(and (boolean? id) (not (member id x)))" " in (and (boolean? id) (not (member id x))), perhaps change (member id x) to (memq ...)")
  (lint-test "(and (number? id) (not (equal? id x)))"  " in (and (number? id) (not (equal? id x))), perhaps change (equal? id x) to (eqv? ...)")
  (lint-test "(and (symbol? id) (member id x))"        " in (and (symbol? id) (member id x)), perhaps change (member id x) to (memq ...)")
  (lint-test "(and (symbol? id) (memq id x))"          "")
  (lint-test "(and (symbol? id) (memv id x))"          " in (and (symbol? id) (memv id x)), perhaps change (memv id x) to (memq ...)")
  (lint-test "(and (symbol? id) (equal? id x))"        " in (and (symbol? id) (equal? id x)), perhaps change (equal? id x) to (eq? ...)")
  (lint-test "(and (boolean? id) (member id x))"       " in (and (boolean? id) (member id x)), perhaps change (member id x) to (memq ...)")
  (lint-test "(and (number? id) (equal? id x))"        " in (and (number? id) (equal? id x)), perhaps change (equal? id x) to (eqv? ...)")
  (lint-test "(and (integer? x) (number? y) (< y 3))" 
	     " in (and (integer? x) (number? y) (< y 3)), perhaps change (number? y) to (real? y)")
  (lint-test "(or (integer? x) (not (number? y)) (< y 3))" 
	     " in (or (integer? x) (not (number? y)) (< y 3)), perhaps change (not (number? y)) to (not (real? y))")
  (lint-test "(or (not (number? x)) (> x 2))" " in (or (not (number? x)) (> x 2)), perhaps change (not (number? x)) to (not (real? x))")
  (lint-test "(or (integer? x) (not (number? y)) (< y 3))" 
	     " in (or (integer? x) (not (number? y)) (< y 3)), perhaps change (not (number? y)) to (not (real? y))")
  (lint-test "(and (integer? x) (number? y) (< y 3))" 
	     " in (and (integer? x) (number? y) (< y 3)), perhaps change (number? y) to (real? y)")
  (lint-test "(and (string? (car c)) (string=? (car c) \" \"))" 
	     " and: perhaps (and (string? (car c)) (string=? (car c) \" \")) -> (equal? (car c) \" \")")
  (lint-test "(and (list? x) (equal? x '(1 2)))" " and: perhaps (and (list? x) (equal? x '(1 2))) -> (equal? x '(1 2))")
  (lint-test "(and (char? x) (char=? x #\\a))"  " and: perhaps (and (char? x) (char=? x #\\a)) -> (eqv? x #\\a)")

  (lint-test "(if (number? x) (member x y) 0)"  " in (if (number? x) (member x y) 0), perhaps change (member x y) to (memv ...)")
  (lint-test "(if (number? x) (< x y) 0)"       " in (if (number? x) (< x y) 0), perhaps change (number? x) to (real? x)")
  (lint-test "(if (not (number? x)) 0 (< x y))" " in (if (not (number? x)) 0 (< x y)), perhaps change (not (number? x)) to (not (real? x))")
  (lint-test "(cond ((number? x) (< x y)) (else x))" " in (cond ((number? x) (< x y)) (else x)), perhaps change (number? x) to (real? x)")

  (lint-test "(list? (make-list 1))"             " list?: perhaps (list? (make-list 1)) -> #t list?: (list? (make-list 1)) is always #t")
  (lint-test "(number? (+ 1 x))"                 " number?: perhaps (number? (+ 1 x)) -> #t number?: (number? (+ 1 x)) is always #t")
  (lint-test "(number? (make-list 1))"           " number?: perhaps (number? (make-list 1)) -> #f number?: (number? (make-list 1)) is always #f")
  (lint-test "(pair? (member x y))"              " pair?: member returns either #f or a pair, so (pair? (member x y)) -> (member x y)")
  (lint-test "(null? (member x y))" 	         " null?: perhaps (null? (member x y)) -> #f null?: (null? (member x y)) is always #f")
  (lint-test "(integer? (char-position x y))"    " integer?: char-position returns either #f or an integer, so (integer? (char-position x y)) -> (char-position x y)")
  (lint-test "(car (member x y))"                
	     " car: in (car (member x y)), car's argument should be a pair, but (member x y) might also be boolean?
               car: (car (member x y)) is x, or an error")
  (lint-test "(if (and x (pair? x) (symbol? (cadr x))) x)" " if: perhaps (and x (pair? x) (symbol? (cadr x))) -> (and (pair? x) (symbol? (cadr x)))")
  (lint-test "(catch #t (lambda () (char=? (read-char p) #\\newline)) (lambda arg 'error))" "")
  (lint-test "(if (and (<= 12 x) (<= x 15)) 2 3)" " if: perhaps (and (<= 12 x) (<= x 15)) -> (<= 12 x 15)")
  (lint-test "(and x (set! x (zero? (random 2))) (not x))" "")
  (lint-test "(string-append x , \"b\")" "")
  (unless pure-s7
    (lint-test "(string-append x , y)" " string-append: stray comma? (unquote y) in (string-append x (unquote y))"))
  (lint-test "`(+ ,x 1)" "")
  (lint-test "(let ((x (list 23 1 3))) (sort! x <) x)" "")
  (lint-test "(let ((x (list 23 1 3))) (reverse! x) x)" " let: reverse! might leave x in an undefined state; perhaps (set! x (reverse! x))")
  (lint-test "(let () (define (f x) (if (pair? x) (reverse! x))) (f (vector 1 2)))" 
	     " let: perhaps (... (define (f x) (if (pair? x) (reverse! x))) (f (vector 1 2))) -> (... (let ((x (vector 1 2))) (if (pair? x) (reverse! x))))
               f: if x (a function argument) is a pair, (reverse! x) is ill-advised")
  (lint-test "(if (and (list? x) (car x)) 3)" " in (and (list? x) (car x)), perhaps change (list? x) to (pair? x)")
  (lint-test "(if (and (list? x) (not (null? x)) (car x)) 3)" " if: perhaps (and (list? x) (not (null? x)) (car x)) -> (and (pair? x) (car x))")
  (lint-test "(and (pair? obj) (not (null? obj)) (pair? x))" " and: perhaps (and (pair? obj) (not (null? obj)) (pair? x)) -> (and (pair? obj) (pair? x))")

  (lint-test "(if x (map f x))" " in (if x (map f x)), perhaps change x to (sequence? x)")
  (lint-test "(let ((x 0)) (/ 21 x))" " let: perhaps (let ((x 0)) (/ 21 x)) -> (/ 21 0) let: x is 0, so (/ 21 x) is an error")
  (lint-test "(cond ((> x 0) => abs) (else y))" " cond: in ((> x 0) => abs), (> x 0) returns a a boolean, but abs expects real?")

  (lint-test "(for-each (lambda (x) (display x port)) (list y z 123))" 
	     " for-each: perhaps (for-each (lambda (x) (display x port)) (list y z 123)) -> (format port \"~{~A~}\" (list y z 123))")
  (lint-test "(for-each (lambda (x) (write-string x port)) (list y z \"123\"))" 
	     " for-each: perhaps (for-each (lambda (x) (write-string x port)) (list y z \"123\")) -> (format port \"~{~A~}\" (list y z \"123\"))")
  (lint-test "(map (cut a) (list packages))" " map: perhaps (map (cut a) (list packages)) -> (list ((cut a) packages))")
  (lint-test "(map abs (list packages))" " map: perhaps (map abs (list packages)) -> (list (abs packages))")
  (lint-test "(map string->symbol (list \"IOPAD\" \"IPAD\" \"OPAD\" \"HIGH\" \"LOW\"))"
	     " map: perhaps (map string->symbol (list \"IOPAD\" \"IPAD\" \"OPAD\" \"HIGH\" \"LOW\")) -> '(IOPAD IPAD OPAD HIGH LOW)
               map: perhaps (list \"IOPAD\" \"IPAD\" \"OPAD\" \"HIGH\" \"LOW\") -> '(\"IOPAD\" \"IPAD\" \"OPAD\" \"HIGH\" \"LOW\")")
  (lint-test "(list->string (list h1 h2))" " list->string: perhaps (list->string (list h1 h2)) -> (string h1 h2)")

  (lint-test "(string-append (list->string (make-list indent #\\space)) str)" 
	     " string-append: perhaps (list->string (make-list indent #\\space)) -> (make-string indent #\\space)")
  (lint-test "(string-append (string #\\C) \"ZLl*()def\")" 
	     " string-append: perhaps (string-append (string #\\C) \"ZLl*()def\") -> \"CZLl*()def\"
               string-append: (string #\\C) could be \"C\"")
  (lint-test "(string-append \"USER \" user (string #\\return) (string #\\newline))" 
	     " string-append: perhaps (string-append \"USER \" user (string #\\return) (string #\\newline)) ->
                (string-append \"USER \" user (string #\\return #\\newline))")
  (lint-test "(define (indent->string indent) (string-append (make-string (quotient indent 8) #\\tab) (make-string (modulo indent 8) #\\space)))"
	     " indent->string: perhaps (string-append (make-string (quotient indent 8) #\\tab) (make-string... ->
                 (format #f \"~NC~NC\" (quotient indent 8) #\\tab (modulo indent 8) #\\space)")

  (lint-test "(string=? (string (string-ref file-line 0)) \"*\")" 
	     " string=?: perhaps (string=? (string (string-ref file-line 0)) \"*\") -> (char=? #\\* (string-ref file-line 0))
               string=?: perhaps (string (string-ref file-line 0)) -> (substring file-line 0 1)")
  (lint-test "(string=? (symbol->string a) (symbol->string b))" " string=?: perhaps (string=? (symbol->string a) (symbol->string b)) -> (eq? a b)")
  (lint-test "(string=? (substring s 0 1) \"#\")" " string=?: perhaps (string=? (substring s 0 1) \"#\") -> (char=? #\\# (string-ref s 0))")
  (lint-test "(string=? \"#\" (string (string-ref s 0)))"
	     " string=?: perhaps (string=? \"#\" (string (string-ref s 0))) -> (char=? #\\# (string-ref s 0))
               string=?: perhaps (string (string-ref s 0)) -> (substring s 0 1)")
  (lint-test "(string=? \"\" (string-copy \"\"))" " string=?: perhaps (string=? \"\" (string-copy \"\")) -> (string=? \"\" \"\")")
  (lint-test "(string-copy x 1 y)" 
	     " string-copy: string-copy has too many arguments: (string-copy x 1 y)
               string-copy: perhaps (string-copy x 1 y) -> (substring x 1 y)")

  (lint-test "(char=? #\\a (char-downcase x))" " char=?: perhaps (char=? #\\a (char-downcase x)) -> (char-ci=? #\\a x)")
  (lint-test "(string=? x (string-downcase y))" "")
  (lint-test "(string=? (string-downcase x) (string-downcase y))" " string=?: perhaps (string=? (string-downcase x) (string-downcase y)) -> (string-ci=? x y)")

  (lint-test "(for-each display (list 1 a #\\newline))" 
	     " for-each: perhaps (for-each display (list 1 a #\\newline)) -> (format () \"~A~A~A\" 1 a #\\newline)")
  (lint-test "(for-each write-string (list a \"asdf\" (substring x 1)))" 
	     " for-each: perhaps (for-each write-string (list a \"asdf\" (substring x 1))) -> (format () \"~A~A~A\" a \"asdf\" (substring x 1))")
  (lint-test "(for-each write (append b (list 1 a #\\newline)))" 
	     " for-each: perhaps (for-each write (append b (list 1 a #\\newline))) -> (format () \"~{~S~}\" (append b (list 1 a #\\newline)))")
  (lint-test "(for-each write-char (append b (list a #\\newline)))" 
	     " for-each: perhaps (for-each write-char (append b (list a #\\newline))) -> (format () \"~{~A~}\" (append b (list a #\\newline)))")

  ;; recursion->for-each
  (lint-test "(let f ((v (list 0 1 2))) (if (pair? v) (begin (g (car v)) (f (cdr v)))))" 
	     " f: perhaps (let f ((v (list 0 1 2))) (if (pair? v) (begin (g (car v)) (f (cdr v))))) -> (for-each g (list 0 1 2))")
  (lint-test "(define (f v) (if (pair? v) (begin (g (car v)) (f (cdr v)))))" 
	     " f: perhaps (define (f v) (if (pair? v) (begin (g (car v)) (f (cdr v))))) -> (define (f v) (for-each g v))")
  (lint-test "(let f ((v (list 0 1 2))) (when (pair? v) (g (car v)) (f (cdr v))))" 
	     " f: perhaps (let f ((v (list 0 1 2))) (when (pair? v) (g (car v)) (f (cdr v)))) -> (for-each g (list 0 1 2))")
  (lint-test "(define (f v) (when (not (null? v)) (g (cadar v)) (f (cdr v))))" 
	     " f: perhaps (define (f v) (when (not (null? v)) (g (cadar v)) (f (cdr v)))) -> (define (f v) (for-each (lambda (_1_) (g (cadr _1_))) v))
               f: perhaps (when (not (null? v)) (g (cadar v)) (f (cdr v))) -> (unless (null? v) (g (cadar v)) (f (cdr v)))")
  (lint-test "(let f ((v (list 0 1 2))) (when (pair? v) (let ((g (car v))) (display g) (f (cdr v)))))" 
	     " f: perhaps (let f ((v (list 0 1 2))) (when (pair? v) (let ((g (car v))) (display g)... ->
                 (for-each (lambda (_1_) (let ((g _1_)) (display g))) (list 0 1 2))
               let: perhaps (let ((g (car v))) (display g) (f (cdr v))) -> (let () (display (car v)) (f (cdr v)))")

  ;; recursion->do
  (lint-test "(let f ((v ()) (i 0)) (if (= i 3) (reverse v) (f (cons x v) (+ i 1))))"
	     " f: perhaps (let f ((v ()) (i 0)) (if (= i 3) (reverse v) (f (cons x v) (+ i 1)))) ->
                 (do ((v () (cons x v)) (i 0 (+ i 1))) ((= i 3) (reverse v)))")
  (lint-test "(define (lref lst ind) (if (zero? ind) (car lst) (lref (cdr lst) (- ind 1))))"
	     " lref: perhaps (define (lref lst ind) (if (zero? ind) (car lst) (lref (cdr lst) (- ind 1)))) ->
                 (define (lref lst ind) (do ((lst lst (cdr lst)) (ind ind (- ind 1))) ((zero? ind) (car lst))))")
  (lint-test "(let loop ((a b) (c d)) (if (> a 1) (begin (display c) (loop (- a 1) (cdr c))) (+ a 1)))" 
	     " loop: perhaps (let loop ((a b) (c d)) (if (> a 1) (begin (display c) (loop (- a 1) (cdr... ->
                 (do ((a b (- a 1)) (c d (cdr c))) ((<= a 1) (+ a 1)) (display c))")
  (lint-test "(let loop ((a b) (c d)) (if (< a 1) (+ a 1) (begin (display c) (loop (- a 1) (cdr c)))))"
	     " loop: perhaps (let loop ((a b) (c d)) (if (< a 1) (+ a 1) (begin (display c) (loop (- a... ->
                 (do ((a b (- a 1)) (c d (cdr c))) ((< a 1) (+ a 1)) (display c))")
  (lint-test "(define (loop a) (if (< a 0) (car c) (loop (f1 a))))"
	     " loop: perhaps (define (loop a) (if (< a 0) (car c) (loop (f1 a)))) ->
                 (define (loop a) (do ((a a (f1 a))) ((< a 0) (car c))))")
  (lint-test "(let loop ((a b) (c d)) (if (> a 1) (begin (display c) (loop (- a 1) c)) (+ a 1)))"
	     " loop: perhaps (let loop ((a b) (c d)) (if (> a 1) (begin (display c) (loop (- a 1) c))... ->
                 (do ((a b (- a 1)) (c d)) ((<= a 1) (+ a 1)) (display c))")
  (lint-test "(let loop ((a b) (c d)) (if (< a 1) (+ a 1) (begin (display c) (loop (- a c) (abs c)))))" "")
  (lint-test "(define (f12 x y) (if (positive? x) (+ x y) (f12 1 x)))" "")
  (lint-test "(define loop (lambda (a . b) (if (< a 0) (car c) (loop (f11 a b)))))" "")
  (lint-test "(define loop (lambda (a) (if (< a 0) (car c) (loop (f1 a)))))" 
	     " loop: perhaps (lambda (a) (if (< a 0) (car c) (loop (f1 a)))) -> (lambda (a) (do ((a a (f1 a))) ((< a 0) (car c))))")
  (lint-test "(define* (f52 (a 2)) (if (zero? a) x (f52 (- a 1))))"
	     " f52: perhaps (define* (f52 (a 2)) (if (zero? a) x (f52 (- a 1)))) -> (define* (f52 (a 2)) (do ((a a (- a 1))) ((zero? a) x)))")
  (lint-test "(define (loop a) (if (< a 0) (car c) (or (pair? a) (loop (f1 a)))))" "")
  (lint-test "(define (loop a) (cond ((< a 0) (car c)) (else (loop (f1 a)))))" 
	     " loop: perhaps (define (loop a) (cond ((< a 0) (car c)) (else (loop (f1 a))))) ->
                 (define (loop a) (do ((a a (f1 a))) ((< a 0) (car c))))")
  (lint-test "(define (loop a) (cond ((< a 0)) (else (loop (f1 a)))))" 
	     " loop: perhaps (define (loop a) (cond ((< a 0)) (else (loop (f1 a))))) -> (define (loop a) (do ((a a (f1 a))) ((< a 0) #t)))
               loop: perhaps (cond ((< a 0)) (else (loop (f1 a)))) -> (or (< a 0) (loop (f1 a)))")
  
  (lint-test "(define make-rectangular (lambda args 32))" " top-level (line 0) redefinition of built-in function make-rectangular: (define make-rectangular (lambda args 32))")
  (lint-test "(define abs (lambda args 32))" " top-level (line 0) redefinition of built-in function abs: (define abs (lambda args 32))")

  ;; this is a write.scm lint-pp bug regression test
  (lint-test "(define (any-random amount e) (letrec ((next-random (lambda () (let ((x 32)) (if (<= y (envelope-interp x e)) (next-random)))))) (next-random)))"
	     " any-random: perhaps (letrec ((next-random (lambda () (let ((x 32)) (if (<= y (envelope-interp... ->
    (let next-random ()
      (let ((x 32))
        (if (<= y (envelope-interp x e))
            (next-random))))
               any-random: x can probably be moved to any-random's closure")

  (lint-test "(let () 
                (define (f11 a b) (if (positive? a) (+ a b) b)) 
                (define (f14 x y) (if (positive? x) (+ x y) y))
                (+ (f11 1 2) (f14 1 2)))"       
	     " let: perhaps embed f14: 
                 (let () (define (f11 a b) (if (positive? a) (+ a b) b)) (define (f14 x y)... ->
                   (... (+ (f11 1 2) (let ((x 1) (y 2)) (if (positive? x) (+ x y) y))))
               f14: f14 could be (define f14 f11)")
  (lint-test "(let ((x (let () (define (f11 a b) (if (positive? a) (+ a b) b)) (f11 1 2))))
                (define (f14 x y) (if (positive? x) (+ x y) y))
                (+ x (f14 1 2)))"   
	     " let: perhaps (... (define (f11 a b) (if (positive? a) (+ a b) b)) (f11 1 2)) -> (... (let ((a 1) (b 2)) (if (positive? a) (+ a b) b)))
               let: the inner function f14 could be moved into the let: 
                 (let ((x (let () (define (f11 a b) (if (positive? a) (+ a b) b)) (f11 1... ->
                 (let ((x (let () (define (f11 a b) (if (positive? a) (+ a b) b)) (f11 1 2))) (f14 (lambda (x y) (if (positive? x) (+ x y) y)))) ...)
               let: perhaps (... (define (f14 x y) (if (positive? x) (+ x y) y)) (+ x (f14 1 2))) ->
                 (... (+ x (let ((x 1) (y 2)) (if (positive? x) (+ x y) y))))
               f14: f14 is the same as f11 (line 0)")
  (lint-test "(let ()
                (define (f11 a b) (define (f12 a b) (if (positive? a) (+ a b) b)) (f12 a b))
                (define (f14 x y) (if (positive? x) (+ x y) y))
                (+ (f11 1 2) (f14 1 2)))"    
	     " let: perhaps embed f14: 
                 (let () (define (f11 a b) (define (f12 a b) (if (positive? a) (+ a b) b))... ->
                 (... (+ (f11 1 2) (let ((x 1) (y 2)) (if (positive? x) (+ x y) y))))
               let: the inner function f12 could be moved to f11's closure: 
                 (define (f11 a b) (define (f12 a b) (if (positive? a) (+ a b) b)) (f12 a b)) ->
                 (define f11 (let () (define (f12 a b) (if (positive? a) (+ a b) b)) (lambda (a b) ...)))
               let: perhaps (define (f11 a b) (define (f12 a b) (if (positive? a) (+ a b) b)) (f12 a b)) ->
                 (define (f11 a b) (if (positive? a) (+ a b) b))
               f14: f14 is the same as f12 (line 1)")
  (lint-test "(let () 
                (define (f11 a b) (if (positive? a) (+ a b) b)) 
                (define (f14 y x) (if (positive? x) (+ x y) y))
                (+ (f11 1 2) (f14 1 2)))"       
	     " let: perhaps embed f14: 
                 (let () (define (f11 a b) (if (positive? a) (+ a b) b)) (define (f14 y x)... ->
                   (... (+ (f11 1 2) (let ((y 1) (x 2)) (if (positive? x) (+ x y) y))))")
               ; TODO: f14: perhaps (if (positive? x) (+ x y) y) -> (f11 x y)
  (lint-test "(let () 
                (define (f11 b a) (if (positive? a) (+ a b) b)) 
                (define (f14 x y) (if (positive? x) (+ x y) y))
                (+ (f11 1 2) (f14 1 2)))"       
	     " let: perhaps embed f14: 
                 (let () (define (f11 b a) (if (positive? a) (+ a b) b)) (define (f14 x y)... ->
                    (... (+ (f11 1 2) (let ((x 1) (y 2)) (if (positive? x) (+ x y) y))))")
               ; TODO: f14: perhaps (if (positive? x) (+ x y) y) -> (f11 y x)
  (lint-test "(let ()
                (define (f1 x) (set! x 32) (log x 2.0))
                (define (f2 y) (set! y 32) (log y 2.0))
                (+ (f1 0) (f2 0)))"      
	     " let: perhaps embed f2: 
                 (let () (define (f1 x) (set! x 32) (log x 2.0)) (define (f2 y) (set! y 32)... ->
                 (... (+ (f1 0) (let ((y 0)) (set! y 32) (log y 2.0))))
               f1: perhaps (set! x 32) -> (let ((x 32)) ...)
               f2: f2 could be (define f2 f1)
               f2: perhaps (set! y 32) -> (let ((y 32)) ...)")
  (lint-test "(let ()
                (define (f11 a b) (if (positive? a) (+ a b) b)) 
                (let ((z (if (positive? a1) (+ a1 b1) b1)))
                  (+ z (f11 1 2))))" "") ;" perhaps (if (positive? a1) (+ a1 b1) b1) -> (f11 a1 b1)") -- code fragments turned off now
  (lint-test "(let () 
                (define (f11 a b) (if (positive? a) (+ a b) b)) 
                (define f14 (lambda (x y) (if (positive? x) (+ x y) y)))
                (+ (f11 1 2) (f14 1 2)))"     
	     " let: the scope of f14 could be reduced: 
                 (... (define f14 (lambda (x y) (if (positive? x) (+ x y) y))) (+ (f11 1 2) (f14 1 2))) ->
                 (... (let ((f14 (lambda (x y) (if (positive? x) (+ x y) y)))) (+ (f11 1 2) (f14 1 2))))")
               ; TODO: f14: perhaps (if (positive? x) (+ x y) y) -> (f11 x y)
  (lint-test "(let () 
                (define f11 (let () (lambda (a b) (if (positive? a) (+ a b) b))))
                (define (f14 x y) (if (positive? x) (+ x y) y))
                (+ (f11 1 2) (f14 1 2)))" 
	     " let: perhaps embed f14: (let () (define f11 (let () (lambda (a b) (if (positive? a) (+ a b) b))))... ->
                  (... (+ (f11 1 2) (let ((x 1) (y 2)) (if (positive? x) (+ x y) y))))
               f11: pointless let: (let () (lambda (a b) (if (positive? a) (+ a b) b)))")
               ; TODO: f14: f14 could be (define f14 f11)
  (lint-test "(let () 
                (define (f11 a b) (if (positive? a) (+ a b) b)) 
                (define (f14 x y) (if (positive? x) (+ x (log y)) (log y)))
                (+ (f11 1 2) (f14 1 2)))"  "") ; TODO:      f14: perhaps (if (positive? x) (+ x (log y)) (log y)) -> (f11 x (log y))
  (lint-test "(let () (define union (let ((z 32)) (set! x (lambda (y) (+ z y))) (lambda args args))) (union 1 2))" "")
  (lint-test "(let () 
                (define (f11 a b) (let ((z (+ a 1))) (if (positive? z) (+ a b) b)))
                (define (f14 x y) (let ((w (+ x 1))) (if (positive? w) (+ x y) y)))
                (+ (f11 1 2) (f14 1 2)))"
	     " f11: perhaps (let ((z (+ a 1))) (if (positive? z) (+ a b) b)) -> (if (positive? (+ a 1)) (+ a b) b)
               f14: f14 could be (define f14 f11)
               f14: perhaps (let ((w (+ x 1))) (if (positive? w) (+ x y) y)) -> (if (positive? (+ x 1)) (+ x y) y)")
  (lint-test "(let () 
                (define (f11 a b) (let ((z (+ a 1))) (if (positive? z) (+ a b) b)))
                (define (f14 x . y) (let ((w (+ x 1))) (if (positive? w) (+ x y) y)))
                (+ (f11 1 2) (f14 1 2)))"
	     " f11: perhaps (let ((z (+ a 1))) (if (positive? z) (+ a b) b)) -> (if (positive? (+ a 1)) (+ a b) b)
               f14: perhaps (let ((w (+ x 1))) (if (positive? w) (+ x y) y)) -> (if (positive? (+ x 1)) (+ x y) y)")
  (lint-test "(let () 
                (define (f11 a b) (let ((z (+ a 1))) (if (positive? z) (+ a b) b)))
                (define (f14 x y z) (let ((w (+ x 1))) (if (positive? w) (+ x y) y)))
                (+ (f11 1 2) (f14 1 2 3)))"  
	     " f11: perhaps (let ((z (+ a 1))) (if (positive? z) (+ a b) b)) -> (if (positive? (+ a 1)) (+ a b) b)
               f14: perhaps (let ((w (+ x 1))) (if (positive? w) (+ x y) y)) -> (if (positive? (+ x 1)) (+ x y) y)
               let: f14's parameter 3 is not used, but a value is passed: 3")
  ; TODO: f14: perhaps (let ((w (+ x 1))) (if (positive? w) (+ x y) y)) -> (f11 x y)
  (lint-test "(let () 
                (define (f11 a b) (let ((z (+ a 1))) (if (positive? z) (+ a b) b)))
                (define (f14 x y) (let ((w (+ x 1)) (ww 1)) (if (positive? w) (+ x y) y)))
                (+ (f11 1 2) (f14 1 2)))"      
	     " f11: perhaps (let ((z (+ a 1))) (if (positive? z) (+ a b) b)) -> (if (positive? (+ a 1)) (+ a b) b)
               f14: ww not used, initially: 1 from let
               f14: ww can be moved to f14's closure")
  (lint-test "(let () 
                (define (f12 a b) (let* ((z (+ a 1)) (zz z)) (if (positive? z) (+ a b) zz)))
                (define (f15 x y) (let* ((w (+ x 1)) (ww w)) (if (positive? w) (+ x y) ww)))
                (+ (f12 1 2) (f15 1 2)))"      
	     " f12: perhaps (let* ((z (+ a 1)) (zz z)) (if (positive? z) (+ a b) zz)) -> (let ((z (+ a 1))) (if (positive? z) (+ a b) z))
               f15: f15 could be (define f15 f12)
               f15: perhaps (let* ((w (+ x 1)) (ww w)) (if (positive? w) (+ x y) ww)) -> (let ((w (+ x 1))) (if (positive? w) (+ x y) w))")

  (lint-test "(let ()
                (define (f16 x) (do ((i 0 (+ i 1))) ((= i x)) (display i)))
                (define (f17 y) (do ((k 0 (+ k 1))) ((= k y)) (display k)))
                (f16 2) (f17 2))"               " f17: f17 could be (define f17 f16)")
  (lint-test "(let () 
                (define (f18 a b) (let ((z (lambda (c) (+ c 1)))) (if (positive? (z 1)) (+ a b) b)))
                (define (f19 x y) (let ((w (lambda (d) (+ d 1)))) (if (positive? (w 1)) (+ x y) y)))
                (+ (f18 1 2) (f19 1 2)))"  
	     " let: the local function z could be moved to f18's closure: 
                 (define (f18 a b) (let ((z (lambda (c) (+ c 1)))) (if (positive? (z 1)) (+... ->
                 (define f18 (let ((z (lambda (c) (+ c 1)))) (lambda (a b) ...)))
               f18: perhaps (let ((z (lambda (c) (+ c 1)))) (if (positive? (z 1)) (+ a b) b)) -> (if (positive? (let ((c 1)) (+ c 1))) (+ a b) b)
               let: the local function w could be moved to f19's closure: 
                 (define (f19 x y) (let ((w (lambda (d) (+ d 1)))) (if (positive? (w 1)) (+... ->
                 (define f19 (let ((w (lambda (d) (+ d 1)))) (lambda (x y) ...)))
               f19: f19 could be (define f19 f18)
               f19: perhaps (let ((w (lambda (d) (+ d 1)))) (if (positive? (w 1)) (+ x y) y)) -> (if (positive? (let ((d 1)) (+ d 1))) (+ x y) y)")

  (lint-test "(let ()
                (define (f20 a) (define (f20a b) (+ (* 2 b) a)) (f20a a))
                (define (f21 x) (define (f21a c) (+ (* 2 c) x)) (f21a x))
                (+ (f20 1) (f21 2)))"
	      " let: perhaps (define (f20 a) (define (f20a b) (+ (* 2 b) a)) (f20a a)) -> (define (f20 a) (let ((b a)) (+ (* 2 b) a)))
                let: perhaps (define (f21 x) (define (f21a c) (+ (* 2 c) x)) (f21a x)) -> (define (f21 x) (let ((c x)) (+ (* 2 c) x)))")
  ; f21: f21 could be (define f21 f20)
  (lint-test "(let ()
                (define (f20 a) (define f20a (lambda (b) (+ (* 2 b) a))) (f20a a))
                (define (f21 x) (define f21a (lambda (c) (+ (* 2 c) x))) (f21a x))
                (+ (f20 1) (f21 2)))" "")
  ; f21: f21 could be (define f21 f20)
  (lint-test "(let ()
                (define (f22 a) (lambda (b) (+ (* 2 b) a)))
                (define (f23 x) (lambda (c) (+ (* 2 c) x)))
                (+ ((f22 1) 2) ((f23 2) 3)))" 
	     "let: perhaps embed f23: 
                 (let () (define (f22 a) (lambda (b) (+ (* 2 b) a))) (define (f23 x)... ->
                   (... (+ ((f22 1) 2) ((let ((x 2)) (lambda (c) (+ (* 2 c) x))) 3)))
              f23: f23 could be (define f23 f22)")
  (lint-test "(let ()
                (define (f22 a) (lambda* ((b 21)) (+ (* 2 b) a)))
                (define (f23 x) (lambda* ((c 21)) (+ (* 2 c) x)))
                (+ ((f22 1) 2) ((f23 2) 3)))" 
	     "let: perhaps embed f23: 
                 (let () (define (f22 a) (lambda* ((b 21)) (+ (* 2 b) a))) (define (f23 x)... ->
                   (... (+ ((f22 1) 2) ((let ((x 2)) (lambda* ((c 21)) (+ (* 2 c) x))) 3)))
              f23: f23 could be (define f23 f22)")
  (lint-test "(let ()
                (define (f1 x)   (abs (* 2 (+ (car x) 1))))
                (define (f2 . x) (abs (* 2 (+ (car x) 1))))
                (+ (f1 '(2)) (f2 3)))" "") ; these should not match! 
  (lint-test "(let ()
                (define (f1 . x)   (abs (* 2 (+ (car x) 1))))
                (define (f2 x) (abs (* 2 (+ (car x) 1))))
                (+ (f1 2) (f2 '(3))))"  ; these should not match!
	     " let: perhaps embed f2: 
                (let () (define (f1 . x) (abs (* 2 (+ (car x) 1)))) (define (f2 x) (abs (*... -> (... (+ (f1 2) (let ((x '(3))) (abs (* 2 (+ (car x) 1))))))")
  (lint-test "(let () 
                (define (f24 aa) (let ((z (+ aa 1))) (if (positive? z) (f24 (+ aa 1)) 0)))
                (define (f25 x) (let ((w (+ x 1))) (if (positive? w) (f25 (+ x 1)) 0)))
                (+ (f24 2) (f25 2)))"   
	     " f25: f25 could be (define f25 f24)")
  (lint-test "(let () 
                (define* (f26 (aa 1)) (let ((z (+ aa 1))) (if (positive? z) (f26 (+ aa 1)) 0)))
                (define* (f27 (x 1)) (let ((w (+ x 1))) (if (positive? w) (f27 (+ x 1)) 0)))
                (+ (f26 2) (f27 2)))"   
	     " f27: f27 could be (define f27 f26)")
  (lint-test "(let () 
                (define (f31 a b) (if (> a 0) (+ a b) b)) 
                (define (f32 x y) (if (< 0 y) (+ x y) y))
                (+ (f31 1 2) (f32 1 2)))"       "")
  (lint-test "(let () (define (f32) (let ((xx 1)) (set! xx 2) (+ xx 1))) (f32) 3)" 
	     " let: perhaps (... (define (f32) (let ((xx 1)) (set! xx 2) (+ xx 1))) (f32) 3) -> (... (let ((xx 1)) (set! xx 2) (+ xx 1)) 3)
               f32: perhaps (let ((xx 1)) (set! xx 2) (+ xx 1)) -> (let ((xx 2)) (+ xx 1))
               let: this could be omitted: (f32)")
  (lint-test "(let ((xx 1)) (set! xx 2) (abs xx) xx)" 
	     " let: this could be omitted: (abs xx)
               let: perhaps (let ((xx 1)) (set! xx 2) (abs xx) xx) -> (let ((xx 2)) (abs xx) ...)")
  (lint-test "(let () (define (f32) (let ((xx 1)) (set! xxx 2) (+ xx 1))) (f32) 3)" 
	     " let: perhaps (... (define (f32) (let ((xx 1)) (set! xxx 2) (+ xx 1))) (f32) 3) ->
                 (... (let ((xx 1)) (set! xxx 2) (+ xx 1)) 3) 
               f32: xx can be moved to f32's closure")
  (lint-test "(let () (define (f32 x) (let ((xx (car x))) (vector-set! xx 0 2) xx)) (f32 (list (vector 1))) 3)" 
	     " let: perhaps (... (define (f32 x) (let ((xx (car x))) (vector-set! xx 0 2) xx)) (f32... ->
                 (... (let ((x (list (vector 1)))) (let ((xx (car x))) (vector-set! xx 0 2) xx)) 3)")
  (lint-test "(let () (define* (f1 x (y 0)) (+ x y 1)) (+ (f1 2) (f1 2 3) (f1 3) (f1 4) (f1 5) (f1 6)))" "")
  (lint-test "(let () (define (f21 x) (+ x (let ((f21 (lambda (y) (+ x y)))) (f21 x 1)))) (f21 1))" 
	     " let: perhaps (... (define (f21 x) (+ x (let ((f21 (lambda (y) (+ x y)))) (f21 x 1))))... ->
                 (... (let f21 ((x 1)) (+ x (let ((f21 (lambda (y) (+ x y)))) (f21 x 1)))))
               f21: let variable f21 in (f21 (lambda (y) (+ x y))) shadows the current function?
               f21: perhaps (let ((f21 (lambda (y) (+ x y)))) (f21 x 1)) -> ((lambda (y) (+ x y)) x 1)
               f21: f21 has too many arguments: (f21 x 1)
               f21: perhaps (let ((f21 (lambda (y) (+ x y)))) (f21 x 1)) -> (let ((y x)) (+ x y))")

  (lint-test "(let* ((x 32) (fx (lambda (z) (+ x z)))) (+ x (fx)))" " let*: fx needs 1 argument: (fx)")
  (lint-test "(let* ((x 32) (fx (lambda (z) (+ x z)))) (+ x (fx 1 2)))" " let*: fx has too many arguments: (fx 1 2)")
  (lint-test "(let ((x 32) (fx (lambda (z) (+ x z)))) (+ x (fx 1 2)))" " let: fx has too many arguments: (fx 1 2)")

  (lint-test "(define (f11 a b) (define (f120 a b) (if (positive? a) (+ a b) b)) (f120 a b))" 
	     " define: the inner function f120 could be moved to f11's closure: 
                 (define (f11 a b) (define (f120 a b) (if (positive? a) (+ a b) b)) (f120 a b)) ->
                 (define f11 (let () (define (f120 a b) (if (positive? a) (+ a b) b)) (lambda (a b) ...)))
               define: perhaps (define (f11 a b) (define (f120 a b) (if (positive? a) (+ a b) b)) (f120 a b)) ->
                 (define (f11 a b) (if (positive? a) (+ a b) b))")
  (lint-test "(define (f11 a b) (define (f121 a b) (if (positive? a) (+ a b) b)) (f121 b a))" 
	     " define: the inner function f121 could be moved to f11's closure: 
                 (define (f11 a b) (define (f121 a b) (if (positive? a) (+ a b) b)) (f121 b a)) ->
                 (define f11 (let () (define (f121 a b) (if (positive? a) (+ a b) b)) (lambda (a b) ...)))
               define: perhaps (define (f11 a b) (define (f121 a b) (if (positive? a) (+ a b) b)) (f121 b a)) ->
                 (define (f11 a b) (let ((a b) (b a)) (if (positive? a) (+ a b) b)))")
  (lint-test "(define (f11 a b) (define (f122 a b) (display a) (if (positive? a) (+ a b) b)) (f122 a b))" 
	     " define: the inner function f122 could be moved to f11's closure: 
                 (define (f11 a b) (define (f122 a b) (display a) (if (positive? a) (+ a b)... ->
                 (define f11 (let () (define (f122 a b) (display a) (if (positive? a) (+ a b) b)) (lambda (a b) ...)))
               define: perhaps (define (f11 a b) (define (f122 a b) (display a) (if (positive? a) (+ a b)... ->
                 (define (f11 a b) (display a) (if (positive? a) (+ a b) b))")
  (lint-test "(define (f11 a b) (define (f123) (if (positive? a) (+ a b) b)) (f123))" 
	     " define: perhaps (define (f11 a b) (define (f123) (if (positive? a) (+ a b) b)) (f123)) ->
                 (define (f11 a b) (if (positive? a) (+ a b) b))")
  (lint-test "(define (f11 a b) (define (f124 x y) (if (positive? x) (+ x y) x)) (f124 (+ a 1) (* b 2)))" 
	     " define: the inner function f124 could be moved to f11's closure: 
                 (define (f11 a b) (define (f124 x y) (if (positive? x) (+ x y) x)) (f124... ->
                 (define f11 (let () (define (f124 x y) (if (positive? x) (+ x y) x)) (lambda (a b) ...)))
               define: perhaps (define (f11 a b) (define (f124 x y) (if (positive? x) (+ x y) x)) (f124... ->
                 (define (f11 a b) (let ((x (+ a 1)) (y (* b 2))) (if (positive? x) (+ x y) x)))")
  (lint-test "(define (f11 a b) (define (f125 x y) (if (positive? x) (+ x y) (f125 1 x))) (f125 (+ a 1) (* b 2)))" 
	     " define: the inner function f125 could be moved to f11's closure: 
                 (define (f11 a b) (define (f125 x y) (if (positive? x) (+ x y) (f125 1... ->
                 (define f11 (let () (define (f125 x y) (if (positive? x) (+ x y) (f125 1 x))) (lambda (a b) ...)))
               define: perhaps (define (f11 a b) (define (f125 x y) (if (positive? x) (+ x y) (f125 1... ->
                 (define (f11 a b) (let f125 ((x (+ a 1)) (y (* b 2))) (if (positive? x) (+ x y) (f125 1 x))))")
  (lint-test "(define (f11 a b) (define (f126 x y) (if (positive? x) (+ x y) (f126 1 x))) (+ a (f126 (+ a 1) (* b 2))))"
	     " define: the inner function f126 could be moved to f11's closure: 
                 (define (f11 a b) (define (f126 x y) (if (positive? x) (+ x y) (f126 1... ->
                 (define f11 (let () (define (f126 x y) (if (positive? x) (+ x y) (f126 1 x))) (lambda (a b) ...)))
               define: perhaps (define (f11 a b) (define (f126 x y) (if (positive? x) (+ x y) (f126 1... ->
                 (define (f11 a b) (+ a (let f126 ((x (+ a 1)) (y (* b 2))) (if (positive? x) (+ x y) (f126 1 x)))))")
  (lint-test "(define (f11 a b) (define (f127 x y) (if (positive? x) (+ x y) (f127 1 x))) (display b) (+ a (f127 (+ a 1) (* b 2))))" 
	     " define: the inner function f127 could be moved to f11's closure: 
                 (define (f11 a b) (define (f127 x y) (if (positive? x) (+ x y) (f127 1... ->
                 (define f11 (let () (define (f127 x y) (if (positive? x) (+ x y) (f127 1 x))) (lambda (a b) ...)))
               define: perhaps (define (f11 a b) (define (f127 x y) (if (positive? x) (+ x y) (f127 1... ->
                 (define (f11 a b) (display b) (+ a (let f127 ((x (+ a 1)) (y (* b 2))) (if (positive? x) (+ x y) (f127 1 x)))))")
  (lint-test "(define (f11) (define (f128) (if (positive? a) (+ a b) (f128))) (f128))"
	     " define: the inner function f128 could be moved to f11's closure: 
                 (define (f11) (define (f128) (if (positive? a) (+ a b) (f128))) (f128)) ->
                 (define f11 (let () (define (f128) (if (positive? a) (+ a b) (f128))) (lambda () ...)))
               define: perhaps (define (f11) (define (f128) (if (positive? a) (+ a b) (f128))) (f128)) ->
                 (define (f11) (if (positive? a) (+ a b) (f11)))")

  (lint-test "(lambda (y) (let ((z 3)) (+ z (f1 y))))" " lambda: z can probably be moved to lambda's closure")
  (lint-test "(lambda (y) (let ((z (lambda () 32))) (+ (z) (f1 y))))" 
	     " lambda: the local function z could be moved outside the lambda: 
                 (lambda (y) (let ((z (lambda () 32))) (+ (z) (f1 y)))) -> (let ((z (lambda () 32))) (lambda (y) ...))
               lambda: perhaps (let ((z (lambda () 32))) (+ (z) (f1 y))) -> (+ (let () 32) (f1 y))")
  (lint-test "(lambda (y) (letrec ((z 3)) (+ z (f1 y))))" " lambda: letrec could be let: (letrec ((z 3)) (+ z (f1 y)))")
  (lint-test "(lambda (y) (letrec ((z (lambda () 32))) (+ (z) (f1 y))))"
	     " lambda: the local function z could be moved outside the lambda: 
                 (lambda (y) (letrec ((z (lambda () 32))) (+ (z) (f1 y)))) -> (letrec ((z (lambda () 32))) (lambda (y) ...))
               lambda: letrec could be let: (letrec ((z (lambda () 32))) (+ (z) (f1 y)))
               lambda: perhaps (letrec ((z (lambda () 32))) (+ (z) (f1 y))) -> (+ (let z () 32) (f1 y))")
  (lint-test "(define (lr1 y) (letrec ((z (lambda () 32))) (+ (z) (f1 y))))" 
	     " define: the local function z could be moved to lr1's closure: 
                 (define (lr1 y) (letrec ((z (lambda () 32))) (+ (z) (f1 y)))) -> (define lr1 (letrec ((z (lambda () 32))) (lambda (y) ...)))
               lr1: letrec could be let: (letrec ((z (lambda () 32))) (+ (z) (f1 y)))
               lr1: perhaps (letrec ((z (lambda () 32))) (+ (z) (f1 y))) -> (+ (let z () 32) (f1 y))")
  (lint-test "(define (lr1 y) (letrec ((z (lambda () (z 32)))) (+ (z) (f1 y))))" 
	     " define: the local function z could be moved to lr1's closure: 
                (define (lr1 y) (letrec ((z (lambda () (z 32)))) (+ (z) (f1 y)))) -> (define lr1 (letrec ((z (lambda () (z 32)))) (lambda (y) ...)))
               lr1: perhaps (letrec ((z (lambda () (z 32)))) (+ (z) (f1 y))) -> (+ (let z () (z 32)) (f1 y))")
  (lint-test "(define (lr1 y) (letrec ((z (lambda () (z 32)))) (+ (z) (f1 y))))" 
	     " define: the local function z could be moved to lr1's closure: 
                (define (lr1 y) (letrec ((z (lambda () (z 32)))) (+ (z) (f1 y)))) -> (define lr1 (letrec ((z (lambda () (z 32)))) (lambda (y) ...)))
               lr1: perhaps (letrec ((z (lambda () (z 32)))) (+ (z) (f1 y))) -> (+ (let z () (z 32)) (f1 y))")
  (lint-test "(define (lr1 y) (letrec ((z1 (lambda () (z2 32))) (z2 (lambda () (z1 12)))) (+ (z1) (z2) (f1 y))))" 
	     " define: the local functions z2, z1 could be moved to lr1's closure: 
                 (define (lr1 y) (letrec ((z1 (lambda () (z2 32))) (z2 (lambda () (z1... ->
                 (define lr1 (letrec ((z2 (lambda () (z1 12))) (z1 (lambda () (z2 32)))) (lambda (y) ...)))")
  (lint-test "(define (lr1 y) (letrec ((z1 (lambda () (z2 y))) (z2 (lambda () (z1 12)))) (+ (z1) (z2) (f1 y))))" "")

  (lint-test "(let () (define (f40 x) (+ x 1)) (define (f41 y z) (y (+ z 1))) (f41 f40 2))" 
	     " let: perhaps change f41 to a let: (let () (define (f40 x) (+ x 1)) (define (f41 y z) (y (+ z 1))) (f41 f40 2)) -> (... (let ((y f40) (z 2)) ...))")
  (lint-test "(let () (define (f41 y z) (y (+ z 1))) (f41 abs 2))" 
	     " let: perhaps (... (define (f41 y z) (y (+ z 1))) (f41 abs 2)) -> (... (let ((y abs) (z 2)) (y (+ z 1))))")
  (lint-test "(let () (define (f42 y z) (y (+ z 1))) (f42 (lambda (a) (+ a 1)) 2))" 
	     " let: perhaps (... (define (f42 y z) (y (+ z 1))) (f42 (lambda (a) (+ a 1)) 2)) -> (... (let ((y (lambda (a) (+ a 1))) (z 2)) (y (+ z 1))))")
  
  (lint-test "(define f43 (letrec ((f0 (lambda (a) (+ a 1)))) (lambda (b) (f0 (+ b 1)))))"
	     " define: perhaps (letrec ((f0 (lambda (a) (+ a 1)))) (lambda (b) (f0 (+ b 1)))) -> (lambda (b) (let f0 ((a (+ b 1))) (+ a 1)))
               define: letrec could be let: (letrec ((f0 (lambda (a) (+ a 1)))) (lambda (b) (f0 (+ b 1))))
               define: perhaps (define f43 (letrec ((f0 (lambda (a) (+ a 1)))) (lambda (b) (f0 (+ b 1))))) -> (define (f43 b) (let f0 ((a (+ b 1))) (+ a 1)))")
  (lint-test "(define f43 (letrec ((f0 (lambda (a b) (+ (f0 a b) 1)))) (lambda (b) (f0 b 0))))" 
	     " define: perhaps (letrec ((f0 (lambda (a b) (+ (f0 a b) 1)))) (lambda (b) (f0 b 0))) ->
                 (lambda (b) (let f0 ((a b) (b 0)) (+ (f0 a b) 1)))
               define: perhaps (define f43 (letrec ((f0 (lambda (a b) (+ (f0 a b) 1)))) (lambda (b) (f0 b... ->
                 (define (f43 b) (let f0 ((a b) (b 0)) (+ (f0 a b) 1)))")
  (lint-test "(define f43 (letrec ((f0 (lambda (a) (+ a 1)))) (lambda (b) (if (> b 0) (f0 (+ b 1))))))" 
	     " define: perhaps (letrec ((f0 (lambda (a) (+ a 1)))) (lambda (b) (if (> b 0) (f0 (+ b 1))))) -> (lambda (b) (if (> b 0) (let f0 ((a (+ b 1))) (+ a 1))))
               define: letrec could be let: (letrec ((f0 (lambda (a) (+ a 1)))) (lambda (b) (if (> b 0) (f0 (+ b 1)))))
               define: perhaps (define f43 (letrec ((f0 (lambda (a) (+ a 1)))) (lambda (b) (if (> b 0)... -> (define (f43 b) (if (> b 0) (let f0 ((a (+ b 1))) (+ a 1))))")

  (lint-test "(lambda (c) (letrec ((f0 (lambda (a) (+ a 1)))) (f0 (+ c 1))))" 	
	     " lambda: the local function f0 could be moved outside the lambda: 
                 (lambda (c) (letrec ((f0 (lambda (a) (+ a 1)))) (f0 (+ c 1)))) -> (letrec ((f0 (lambda (a) (+ a 1)))) (lambda (c) ...))
               lambda: letrec could be let: (letrec ((f0 (lambda (a) (+ a 1)))) (f0 (+ c 1)))
               lambda: perhaps (letrec ((f0 (lambda (a) (+ a 1)))) (f0 (+ c 1))) -> (let f0 ((a (+ c 1))) (+ a 1))")
  (lint-test "(lambda (c) (letrec ((f0 (lambda (a) (+ a c 1)))) (let ((c 32)) (f0 (+ c 1)))))" 
	     " lambda: letrec could be let: (letrec ((f0 (lambda (a) (+ a c 1)))) (let ((c 32)) (f0 (+ c 1))))
               lambda: perhaps (let ((c 32)) (f0 (+ c 1))) -> (f0 (+ 32 1))")
  (lint-test "(letrec ((auto-save-func (lambda () (if auto-saving (in 1.0 auto-save-func))))) (lambda () (in 1.0 auto-save-func)))" "") ; don't rewrite this one!
  (lint-test "(let ((x (lambda (y) (+ y (x (- y 1)))))) (x 2))" 
	     " let: let variable x is called in its binding?  Perhaps let should be letrec: ((x (lambda (y) (+ y (x (- y 1))))))
               let: perhaps (let ((x (lambda (y) (+ y (x (- y 1)))))) (x 2)) -> (let ((y 2)) (+ y (x (- y 1))))")
  (lint-test "(let () (define (f60 x) (* 2 x)) (+ 1 (f60 y)))" 
	     " let: perhaps (... (define (f60 x) (* 2 x)) (+ 1 (f60 y))) -> (... (+ 1 (let ((x y)) (* 2 x))))")
  (lint-test "(let () (define f60 (let ((a (lambda (x) (* 2 x)))) a)) (+ 1 (f60 y)))" 
	     " f60: perhaps (let ((a (lambda (x) (* 2 x)))) a) -> (lambda (x) (* 2 x))")
  (lint-test "(let ((x 2)) (let loop ((y x)) (if (positive? y) (loop (- y 1)) 0)))" 
	     " loop: perhaps (let loop ((y x)) (if (positive? y) (loop (- y 1)) 0)) -> (do ((y x (- y 1))) ((not (positive? y)) 0))
               let: perhaps (let ((x 2)) (let loop ((y x)) (if (positive? y) (loop (- y 1)) 0))) -> (let loop ((y 2)) (if (positive? y) (loop (- y 1)) 0))")
  (lint-test "(let ((f60 (lambda (x) (* 2 x)))) (+ 1 (f60 y)))" 
	     " let: perhaps (let ((f60 (lambda (x) (* 2 x)))) (+ 1 (f60 y))) -> (+ 1 (let ((x y)) (* 2 x)))")
  (lint-test "(define (f61 x) (let loop ((y x)) (if (positive? y) (loop (- y 1)) 0)))" 
	     " define: perhaps (define (f61 x) (let loop ((y x)) (if (positive? y) (loop (- y 1)) 0))) -> (define (f61 y) (if (positive? y) (f61 (- y 1)) 0))
               loop: perhaps (let loop ((y x)) (if (positive? y) (loop (- y 1)) 0)) -> (do ((y x (- y 1))) ((not (positive? y)) 0))")
  (lint-test "(define (f61 x) (let loop ((x x)) (if (positive? x) (loop (- x 1)) 0)))" 
	     " define: perhaps (define (f61 x) (let loop ((x x)) (if (positive? x) (loop (- x 1)) 0))) -> (define (f61 x) (if (positive? x) (f61 (- x 1)) 0))
               loop: perhaps (let loop ((x x)) (if (positive? x) (loop (- x 1)) 0)) -> (do ((x x (- x 1))) ((not (positive? x)) 0))")
  (lint-test "(define (f61) (let loop () (if (positive? x) (loop) 0)))" 
	     " define: perhaps (define (f61) (let loop () (if (positive? x) (loop) 0))) -> (define (f61) (if (positive? x) (f61) 0))")
  (lint-test "(define (rep x) (f x) (f x) (f x) (f x) (f x))" "rep: perhaps (f x)... -> (do ((i 0 (+ i 1))) ((= i 5)) (f x))")
  (lint-test "(define (rep1 lim)
                (let ((sum 0))
                  (do ((i 0 (+ i 1))) ((= i lim)) (set! sum (+ sum i)))
                  (do ((i 0 (+ i 1))) ((= i lim)) (set! sum (+ sum i)))
                  (do ((i 0 (+ i 1))) ((= i lim)) (set! sum (+ sum i)))
                  (do ((i 0 (+ i 1))) ((= i lim)) (set! sum (+ sum i)))
                  sum))"
	     "rep1: perhaps (do ((i 0 (+ i 1))) ((= i lim)) (set! sum (+ sum i)))... ->
                (do ((_1_ 0 (+ _1_ 1))) ((= _1_ 4)) (do ((i 0 (+ i 1))) ((= i lim)) (set! sum (+ sum i))))")

  (lint-test "(let () (define (get-xyzzy a) (+ 1 (car a))) 
                      (define (set-xyzzy a b) (cons (+ a 1) b))
                (set-xyzzy x (get-xyzzy y)))" 
	     "let: perhaps change set-xyzzy to a let: 
                 (let () (define (get-xyzzy a) (+ 1 (car a))) (define (set-xyzzy a b) (cons... -> (... (let ((a x) (b (get-xyzzy y))) ...))
	      let: perhaps use dilambda and generalized set! for get-xyzzy and set-xyzzy:
              replace (get-xyzzy ...) with (xyzzy ...) and (set-xyzzy ... b) with (set! (xyzzy ...) b)
              (define xyzzy (dilambda (lambda (a) (+ 1 (car a))) (lambda (a b) (cons (+ a 1) b))))")
  (lint-test "(let () (define (xyzzy-ref a) (+ 1 (car a))) 
                      (define (xyzzy-set! a b) (cons (+ a 1) b))
                (xyzzy-set! x (xyzzy-ref y)))"
	     "let: perhaps change xyzzy-set! to a let: 
                 (let () (define (xyzzy-ref a) (+ 1 (car a))) (define (xyzzy-set! a b)... -> (... (let ((a x) (b (xyzzy-ref y))) ...))
	      let: perhaps use dilambda and generalized set! for xyzzy-ref and xyzzy-set!:
              replace (xyzzy-ref ...) with (xyzzy ...) and (xyzzy-set! ... b) with (set! (xyzzy ...) b)
              (define xyzzy (dilambda (lambda (a) (+ 1 (car a))) (lambda (a b) (cons (+ a 1) b))))")
  (lint-test "(let () (define (get-xyzzy) (+ 1 (car a))) 
                      (define (set-xyzzy b) (set! z b))
                (set-xyzzy x) (get-xyzzy))" 
	     "let: perhaps use dilambda and generalized set! for get-xyzzy and set-xyzzy:
              replace (get-xyzzy) with (xyzzy) and (set-xyzzy b) with (set! (xyzzy) b)
              (define xyzzy (dilambda (lambda () (+ 1 (car a))) (lambda (b) (set! z b))))")
  (lint-test "(let () (define (xyzzy-ref xyzzy b) (+ b (car xyzzy))) 
                      (define (xyzzy-set! xyzzy b c) (list (+ xyzzy c) b))
                (xyzzy-set! obj (xyzzy-ref obj y) z))"
	     "let: perhaps change xyzzy-set! to a let: 
                (let () (define (xyzzy-ref xyzzy b) (+ b (car xyzzy))) (define (xyzzy-set!... -> (... (let ((xyzzy obj) (b (xyzzy-ref obj y)) (c z)) ...))
	      let: perhaps use dilambda and generalized set! for xyzzy-ref and xyzzy-set!:
              replace (xyzzy-ref ...) with (xyzzy ...) and (xyzzy-set! ... c) with (set! (xyzzy ...) c)
              (define xyzzy (dilambda (lambda (_1_ b) (+ b (car _1_))) (lambda (_1_ b c) (list (+ _1_ c) b))))")
  (lint-test "(let () (define (xyz-get-zy xyzzy b) (+ b (car xyzzy))) 
                      (define (xyz-set-zy xyzzy b c) (list (+ xyzzy c) b))
                (xyz-set-zy obj (xyz-get-zy obj y) z))"
	     "let: perhaps change xyz-set-zy to a let: 
                (let () (define (xyz-get-zy xyzzy b) (+ b (car xyzzy))) (define... -> (... (let ((xyzzy obj) (b (xyz-get-zy obj y)) (c z)) ...))
	      let: perhaps use dilambda and generalized set! for xyz-get-zy and xyz-set-zy:
              replace (xyz-get-zy ...) with (xyz-zy ...) and (xyz-set-zy ... c) with (set! (xyz-zy ...) c)
               (define xyz-zy (dilambda (lambda (xyzzy b) (+ b (car xyzzy))) (lambda (xyzzy b c) (list (+ xyzzy c) b))))")
  (lint-test "(begin (define x (let ((y 0)) (dilambda (lambda () y) (lambda (z) (set! y z))))) (or (> (x) 0) (= (x) 0)))" 
	     " begin: perhaps (or (> (x) 0) (= (x) 0)) -> (>= (x) 0)")
  (lint-test "(let* ((x 32) (dx (dilambda (lambda (z) (+ x z)) (lambda (z) (set! x z))))) (set! (dx) 3) x)" "")

  (lint-test "(let () (define (f104 x) (log x 8)) (define (f105 y) (+ y (f104 y))) (f105 (f104 3)))" 
	     " let: perhaps change f105 to a let: (let () (define (f104 x) (log x 8)) (define (f105 y) (+ y (f104 y))) (f105... ->
                (... (let ((y (f104 3))) ...))")
  (lint-test "(let () (define (f104 x) (log x 8)) (define (f105 y) (+ y (f105 y))) (f105 (f104 3)))"
	     " let: perhaps change f105 to a named let: (let () (define (f104 x) (log x 8)) (define (f105 y) (+ y (f105 y))) (f105... ->
                (... (let f105 ((y (f104 3))) ...))")
  (lint-test "(let () (define (f104 x) (log x 8)) (define (f105 y) (+ y (f104 y))) (+ 1 (f105 (f104 3))))" 
	     " let: perhaps embed f105: (let () (define (f104 x) (log x 8)) (define (f105 y) (+ y (f104 y))) (+ 1... ->
                (... (+ 1 (let ((y (f104 3))) (+ y (f104 y)))))")
  (lint-test "(let () (define (f104 x) (log x 8)) (define (f105 y) (+ y (f105 y))) (+ 1 (f105 (f104 3))))"
	     " let: perhaps embed f105: (let () (define (f104 x) (log x 8)) (define (f105 y) (+ y (f105 y))) (+ 1... ->
                (... (+ 1 (let f105 ((y (f104 3))) (+ y (f105 y)))))")

  (lint-test "(define (f70 a b) (let ((a a) (b b)) (+ a b)))" 
	     " define: in (define (f70 a b) (let ((a a) (b b)) (+ a b))) this let binding is pointless: (a a)
               define: in (define (f70 a b) (let ((a a) (b b)) (+ a b))) this let binding is pointless: (b b)
               f70: perhaps (let ((a a) (b b)) (+ a b)) -> (+ a b)")
  (lint-test "(let () (define f74 (lambda (b) (let loop ((c b)) (loop (+ c 1))))) (f74 2))" 
	     " let: perhaps (define f74 (lambda (b) (let loop ((c b)) (loop (+ c 1))))) -> (define (f74 c) (f74 (+ c 1)))")
  (lint-test "(let () (define f74 (lambda (b) (let loop ((b b)) (loop (+ b 1))))) (f74 2))" 
	     " let: perhaps (define f74 (lambda (b) (let loop ((b b)) (loop (+ b 1))))) -> (define (f74 b) (f74 (+ b 1)))")
  (lint-test "(let () (define f74 (lambda (b) (let loop ((b b) (c 0)) (loop (+ b c))))) (f74 2))" 
	     " f74: loop needs 2 arguments: (loop (+ b c))
               let: a toss-up -- perhaps (define f74 (lambda (b) (let loop ((b b) (c 0)) (loop (+ b c))))) -> (define* (f74 b (c 0)) (f74 (+ b c)))")

  (lint-test "(let () (define (f1 x) (+ x 1)) (define (f2 a) (+ (a 1) 1)) (let ((b (f1 2))) (f2 f1) (+ b (f1 2) (f1 2) (f1 2))))" "")
  (lint-test "(let () (define (f1 x) (+ x 1)) (let ((b (f1 2))) (+ b (f1 2) (f1 2) (f1 2))))" " let: f1's 'x parameter is always 2 (4 calls)")

  (lint-test "(let ((s s)) (- (expt s 3) (expt s 2)))" 
	     " let: perhaps omit this useless let: (let ((s s)) (- (expt s 3) (expt s 2))) -> (- (expt s 3) (expt s 2))
               let: assuming we see all set!s, the binding (s s) is pointless: 
                 perhaps (let ((s s)) (- (expt s 3) (expt s 2))) -> (- (expt s 3) (expt s 2))")
  (lint-test "(let ((x x)) (vector-set! x 0 1) x)" 
	     " let: perhaps omit this useless let: (let ((x x)) (vector-set! x 0 1) x) -> (begin (vector-set! x 0 1) x)
               let: assuming we see all set!s, the binding (x x) is pointless: 
                 perhaps (let ((x x)) (vector-set! x 0 1) x) -> (let () (vector-set! x 0 1) x)")
  (lint-test "(let ((abs abs)) (+ x y))" 
	     " let: perhaps omit this useless let: (let ((abs abs)) (+ x y)) -> (+ x y)
               let: abs not used, initially: abs from let
               let: assuming we see all set!s, the binding (abs abs) is pointless: perhaps (let ((abs abs)) (+ x y)) -> (+ x y)")
  (lint-test "(let ((x y)) (display (abs x)) x)" 
	     " let: assuming we see all set!s, the binding (x y) is pointless: perhaps (let ((x y)) (display (abs x)) x) -> (let () (display (abs y)) y)")
  (lint-test "(let ((v V)) (vector-set! v 0 1) v)" 
	     " let: assuming we see all set!s, the binding (v V) is pointless: perhaps (let ((v V)) (vector-set! v 0 1) v) -> (let () (vector-set! V 0 1) V)")
  (lint-test "(let ((abc 'abc)) (eq? x abc))" 
	     " let: perhaps (let ((abc 'abc)) (eq? x abc)) -> (eq? x 'abc) 
               let: pointless local variable: abc, just use 'abc directly")

  (lint-test "(define (f x) (define y (g x)) (h (+ y x)))" "")
  (lint-test "(define (f x) (define y (g x)) (define z (h x)) (w (+ y x z)))" 
	     " f: perhaps (... (define y (g x)) (define z (h x)) (w (+ y x z))) -> (... (let ((y (g x)) (z (h x))) ...))
               f: the scope of z could be reduced: (... (define z (h x)) (w (+ y x z))) -> (... (let ((z (h x))) (w (+ y x z))))")
  (lint-test "(define (f x) (define y (g x)) (define z (h y)) (w (+ y x z)))" 
	     " f: perhaps (... (define y (g x)) (define z (h y)) (w (+ y x z))) -> (... (let* ((y (g x)) (z (h y))) ...))
               f: the scope of z could be reduced: (... (define z (h y)) (w (+ y x z))) -> (... (let ((z (h y))) (w (+ y x z))))")
  (lint-test "(define (f x) (define y (g x)) (define z (lambda (a) (if w (z (- a 1))))) (z (+ y x)))" 
	     " f: perhaps (... (define y (g x)) (define z (lambda (a) (if w (z (- a 1))))) (z (+ y x))) -> (... (let ((y (g x))) ...))
               f: the scope of z could be reduced: 
                 (... (define z (lambda (a) (if w (z (- a 1))))) (z (+ y x))) -> (... (letrec ((z (lambda (a) (if w (z (- a 1)))))) (z (+ y x))))
               z: perhaps (lambda (a) (if w (z (- a 1)))) -> (lambda (a) (do ((a a (- a 1))) ((not w))))")
  (lint-test "(define (f x) (define y (g x)) (define z (lambda (a) (if y (z (- a 1))))) (z (+ y x)))" 
	     " f: perhaps (... (define y (g x)) (define z (lambda (a) (if y (z (- a 1))))) (z (+ y x))) -> (... (let ((y (g x))) ...))
               f: the scope of z could be reduced: 
                (... (define z (lambda (a) (if y (z (- a 1))))) (z (+ y x))) -> (... (letrec ((z (lambda (a) (if y (z (- a 1)))))) (z (+ y x))))
               z: perhaps (lambda (a) (if y (z (- a 1)))) -> (lambda (a) (do ((a a (- a 1))) ((not y))))")

  (lint-test "(lambda (a . opt) (let ((ip (if (null? opt) (current-input-port) (car opt)))) (read ip)))" 
	     " :lambda: perhaps (lambda (a . opt) (let ((ip (if (null? opt) (current-input-port) (car... -> (lambda* (a (ip (current-input-port))) ...)
                lambda: perhaps (let ((ip (if (null? opt) (current-input-port) (car opt)))) (read ip)) -> (read (if (null? opt) (current-input-port) (car opt)))")
  (lint-test "(lambda opt (let ((ip (if (null? opt) (current-input-port) (car opt)))) (read ip)))" 
	     " :lambda: perhaps (lambda opt (let ((ip (if (null? opt) (current-input-port) (car opt))))... -> (lambda* ((ip (current-input-port))) ...)
                lambda: perhaps (let ((ip (if (null? opt) (current-input-port) (car opt)))) (read ip)) -> (read (if (null? opt) (current-input-port) (car opt)))")
  (lint-test "(define (f204 b . opt) (let ((ip (if (null? opt) (current-input-port) (car opt)))) (read ip)))" 
	     " f204: perhaps (define (f204 b . opt) (let ((ip (if (null? opt) (current-input-port) (car... -> (define* (f204 b (ip (current-input-port))) ...)
               f204: perhaps (let ((ip (if (null? opt) (current-input-port) (car opt)))) (read ip)) -> (read (if (null? opt) (current-input-port) (car opt)))")
  (lint-test "(define (f205 b . opt) (let ((ip (if (null? opt) #f (car opt)))) (read ip)))" 
	     " f205: perhaps (define (f205 b . opt) (let ((ip (if (null? opt) #f (car opt)))) (read ip))) -> (define* (f205 b ip) ...)
               f205: perhaps (if (null? opt) #f (car opt)) -> (and (not (null? opt)) (car opt))
               f205: perhaps (let ((ip (if (null? opt) #f (car opt)))) (read ip)) -> (read (if (null? opt) #f (car opt)))")
  (lint-test "(define f206 (lambda (c . opt) (let ((ip (if (null? opt) (current-input-port) (car opt)))) (read ip))))" 
	     " :lambda: perhaps (lambda (c . opt) (let ((ip (if (null? opt) (current-input-port) (car... -> (lambda* (c (ip (current-input-port))) ...)
               f206: perhaps (let ((ip (if (null? opt) (current-input-port) (car opt)))) (read ip)) -> (read (if (null? opt) (current-input-port) (car opt)))")
  (lint-test "(define (f207 b . opt) (let* ((ip (if (null? opt) #f (car opt))) (op (port? ip))) (read ip)))" 
	     " f207: perhaps (define (f207 b . opt) (let* ((ip (if (null? opt) #f (car opt))) (op... -> (define* (f207 b ip) (let ((op (port? ip))) ...))
               f207: perhaps (if (null? opt) #f (car opt)) -> (and (not (null? opt)) (car opt))
               f207: op not used, initially: (port? ip) from let*")
  (lint-test "(define (f208 b . opt) (let* ((ip (if (null? opt) #f (car opt))) (op (port? ip)) (op2 op)) (read ip)))" 
	     " f208: perhaps (define (f208 b . opt) (let* ((ip (if (null? opt) #f (car opt))) (op... ->
                 (define* (f208 b ip) (let* ((op (port? ip)) (op2 op)) ...))
               f208: perhaps (if (null? opt) #f (car opt)) -> (and (not (null? opt)) (car opt))
               f208: op2 not used, initially: op from let*
               f208: perhaps restrict op which is not used in the let* body 
                 (let* ((ip (if (null? opt) #f (car opt))) (op (port? ip)) (op2 op)) (read ip)) ->
                 (let* ((ip (if (null? opt) #f (car opt))) (op2 (let ((op (port? ip))) op))) ...)
               f208: perhaps substitute op into op2: 
                 (let* ((ip (if (null? opt) #f (car opt))) (op (port? ip)) (op2 op)) (read ip)) ->
                 (let* ((ip (if (null? opt) #f (car opt))) (op2 (port? ip))) ...)")
  (lint-test "(define (f210 b . opt) (let ((ip (if (null? opt) 0 (car opt)))) (g ip) (f ip)))" 
	     " f210: perhaps (define (f210 b . opt) (let ((ip (if (null? opt) 0 (car opt)))) (g ip) (f ip))) -> (define* (f210 b (ip 0)) ...)")
  (lint-test "(define (f210 b . opt) (let ((ip (if (not (pair? opt)) 0 (car opt)))) (g ip) (f ip)))" 
	     " f210: perhaps (define (f210 b . opt) (let ((ip (if (not (pair? opt)) 0 (car opt)))) (g... -> (define* (f210 b (ip 0)) ...)")
  (lint-test "(define (f210 b . opt) (let ((ip (if (pair? opt) (car opt) 0))) (g ip) (f ip)))" 
	     " f210: perhaps (define (f210 b . opt) (let ((ip (if (pair? opt) (car opt) 0))) (g ip) (f ip))) -> (define* (f210 b (ip 0)) ...)")
  (lint-test "(define (f210 b . opt) (let ((ip (if (not (null? opt)) (car opt) 0))) (g ip) (f ip)))" 
	     " f210: perhaps (define (f210 b . opt) (let ((ip (if (not (null? opt)) (car opt) 0))) (g... -> (define* (f210 b (ip 0)) ...)
               f210: perhaps (if (not (null? opt)) (car opt) 0) -> (if (null? opt) 0 (car opt))")
  (lint-test "(define (f210 . opt) (let ((ip (if (null? opt) 0 (car opt)))) (g ip) (f ip)))" 
	     " f210: perhaps (define (f210 . opt) (let ((ip (if (null? opt) 0 (car opt)))) (g ip) (f ip))) -> (define* (f210 (ip 0)) ...)")
  (lint-test "(define (f210 . opt) (let ((ip (if (null? opt) #f (car opt)))) (g ip) (f ip)))" 
	     " f210: perhaps (define (f210 . opt) (let ((ip (if (null? opt) #f (car opt)))) (g ip) (f ip))) -> (define* (f210 ip) ...)
               f210: perhaps (if (null? opt) #f (car opt)) -> (and (not (null? opt)) (car opt))")

  (lint-test "(define f230 (lambda* (:allow-other-keys) 1))" " lambda*: :allow-other-keys can't be the only parameter: (:allow-other-keys)")
  (lint-test "(define* (f230 :allow-other-keys) 1)"          " f230: :allow-other-keys can't be the only parameter: (:allow-other-keys)")
  (lint-test "(define f230 (lambda* (:rest) 1))"             " lambda*: :rest parameter needs a name: (:rest)")
  (lint-test "(define* (f230 :rest) 1)"                      " f230: :rest parameter needs a name: (:rest)")

  (let-temporarily ((*report-clobbered-function-return-value* #t))
    (lint-test "(let ((v #f)) (define (f80) (display v) \"a string\") (set! v (f80)) (string-set! v 0 #\\a))" 
	       " let: perhaps (... (define (f80) (display v) \"a string\") (set! v (f80)) (string-set! v 0... ->
                   (... (set! v (let () (display v) \"a string\")) (string-set! v 0 #\\a))
                 f80: returns a string constant: \"a string\"
                 let: (set! v (f80)) returns a constant sequence, but (string-set! v 0 #\\a) appears to clobber it")
    (lint-test "(let ((v #f)) (define (f81) (display v) '(0 1 2 3)) (set! v (f81)) (list-set! v 0 32))"
	       " let: perhaps (... (define (f81) (display v) '(0 1 2 3)) (set! v (f81)) (list-set! v 0 32)) ->
                   (... (set! v (let () (display v) '(0 1 2 3))) (list-set! v 0 32))
                 f81: returns a list constant: '(0 1 2 3)
                 let: (set! v (f81)) returns a constant sequence, but (list-set! v 0 32) appears to clobber it"))
  
  (let-temporarily ((*report-shadowed-variables* #t))
    (lint-test "(let ((f33 33)) (define f33 4) (g f33 1))" 
	       " let: let variable f33 in (define f33 4) shadows an earlier declaration
                   let: let variable f33 is redefined in the let body.  Perhaps use set! instead: (set! f33 4)
                   let: f33 not used, initially: 33 from let")
    (lint-test "(let ((f33 33)) (define (f33 x) (+ x 4)) (g f33 1))" 
	       " let: let variable f33 in (define (f33 x) (+ x 4)) shadows an earlier declaration
                 let: let variable f33 is declared twice
                 let: f33 not used, initially: 33 from let")
    (lint-test "(let ((f33 33)) (if (g x) (begin (define f33 4) (g f33)) 4))" 
	       " let: perhaps move the let to the true branch: 
                   (let ((f33 33)) (if (g x) (begin (define f33 4) (g f33)) 4)) -> (if (g x) (let ((f33 33)) (define f33 4) (g f33)) 4)
	         let: begin variable f33 in (define f33 4) shadows an earlier declaration
                 let: let variable f33 is redefined in the let body.  Perhaps use set! instead: (set! f33 4)
                 let: f33 not used, initially: 33 from let")
    ;; check built-in names
    (lint-test "(define abs 3)" " top-level (line 0) redefinition of built-in function abs: (define abs 3)")
    (lint-test "(define* (abs (ab 1)) (+ ab 1))" " top-level (line 0) redefinition of built-in function abs: (define* (abs (ab 1)) (+ ab 1))")
    (lint-test "(define (f x abs y) (+ x (- abs y)))" 
	       " define: f parameter abs shadows built-in abs
	         f: perhaps (+ x (- abs y)) -> (- (+ x abs) y)")
    (lint-test "(let ((abs 3)) (f abs))" 
	       " let: let variable abs shadows built-in abs
                 let: perhaps, assuming f is not a macro, (let ((abs 3)) (f abs)) -> (f 3)")
    (lint-test "(do ((abs 0 (+ abs 1))) ((= abs 3) 32) (display abs))" " do: do variable abs shadows built-in abs")
    (lint-test "(let abs ((i 10)) (if (positive? i) (abs (- i 1))))" 
	       " let: let named-let-function-name abs shadows built-in abs
	         abs: perhaps (let abs ((i 10)) (if (positive? i) (abs (- i 1)))) -> (do ((i 10 (- i 1))) ((not (positive? i))))")
    (lint-test "(let* abs ((i 10) (j i)) (if (positive? i) (abs (- i j) j)))" " let*: let* named-let*-function-name abs shadows built-in abs")
    (lint-test "(f (lambda (abs) (+ abs 1)))" " lambda: :lambda parameter abs shadows built-in abs")
    (lint-test "(map (lambda (abs) (car abs)) lst)" 
	       " map: perhaps (lambda (abs) (car abs)) -> car
                 lambda: :lambda parameter abs shadows built-in abs")
    (lint-test "(call-with-exit (lambda (abs) (abs 1)))" 
	       " call-with-exit: call-with-exit exit-function abs shadows built-in abs
                 call-with-exit: abs is redundant here: (abs 1)")
    (lint-test "(call/cc (lambda (abs) (abs 1)))" 
	       " call/cc: call/cc continuation abs shadows built-in abs
                 call/cc: perhaps call/cc could be call-with-exit: (call/cc (lambda (abs) (abs 1)))
                 call/cc: abs is redundant here: (abs 1)")
    (lint-test "(call-with-output-file x (lambda (abs) (read abs)))" 
	       " call-with-output-file: call-with-output-file port abs shadows built-in abs
                 call-with-output-file: perhaps (call-with-output-file x (lambda (abs) (read abs))) -> (call-with-output-file x read)
                 call-with-output-file: abs is an output-port, but read in (read abs) wants an input-port?"))

;;; TODO: 'boolean? as #f ought to be 'not (need support in compatible?)
  (lint-test "(call-with-input-file file (lambda (p) (write c p) (write-string str p)))" "")
;	     " call-with-input-file: p is an input-port, but write-string in (write-string str p) wants an output-port?")
;               call-with-input-file: p is an input-port, but write in (write c p) wants an output-port?")
  (lint-test "(call-with-input-string str (lambda (p) (write c p) (read p)))" "")
;	     " call-with-input-string: p is an input-port, but write in (write c p) wants an output-port?")
  (lint-test "(call-with-output-string (lambda (p) (write c p) (read p)))" 
	     " call-with-output-string: p is an output-port, but read in (read p) wants an input-port?")
  (lint-test "(call-with-output-file file (lambda (p) (read p) (write c p)))" 
	     " call-with-output-file: p is an output-port, but read in (read p) wants an input-port?")

  (let-temporarily ((*report-func-as-arg-arity-mismatch* #t))
    (lint-test "(let () (define (f43 x) (+ x 1)) (define (f44 y z) (y (+ z 1) abs)) (f44 f43 2))" 
	       " let: perhaps change f44 to a let: 
                  (let () (define (f43 x) (+ x 1)) (define (f44 y z) (y (+ z 1) abs)) (f44... -> (... (let ((y f43) (z 2)) ...))
                 let: f44's parameter y is passed f43 and called (y (+ z 1) abs), but f43 takes only 1 argument")
    (lint-test "(let () (define (f45 x) (+ x 1)) (define (f46 y z) (if z (y))) (f46 f45 2))" 
	       " let: perhaps change f46 to a let: 
                  (let () (define (f45 x) (+ x 1)) (define (f46 y z) (if z (y))) (f46 f45 2)) -> (... (let ((y f45) (z 2)) ...))
                 let: f46's parameter y is passed f45 and called (y), but f45 needs 1 argument")
    (lint-test "(let () (define (f47 y z) (y (+ z 1) abs)) (f47 abs 2))" 
	       " let: perhaps (... (define (f47 y z) (y (+ z 1) abs)) (f47 abs 2)) -> (... (let ((y abs) (z 2)) (y (+ z 1) abs)))
                 let: f47's parameter y is passed abs and called (y (+ z 1) abs), but abs takes only 1 argument")
    (lint-test "(let () (define (f48 y z) (if z (y))) (f48 abs 2))" 
	       " let: perhaps (... (define (f48 y z) (if z (y))) (f48 abs 2)) -> (... (let ((y abs) (z 2)) (if z (y))))
                 let: f48's parameter y is passed abs and called (y), but abs needs 1 argument")
    (lint-test "(let () (define (f49 y z) (y (+ z 1))) (f49 (lambda () (+ a 1)) 2))" 
	       " let: perhaps (... (define (f49 y z) (y (+ z 1))) (f49 (lambda () (+ a 1)) 2)) -> (... (let ((y (lambda () (+ a 1))) (z 2)) (y (+ z 1))))
                 let: f49's parameter y is passed (lambda () (+ a 1)) and called (y (+ z 1)), but (lambda () (+ a 1)) takes only 0 arguments")
    (lint-test "(let () (define (f50 y z) (y (+ z 1))) (f50 (lambda (a b) (+ a 1)) 2))" 
	       " let: perhaps (... (define (f50 y z) (y (+ z 1))) (f50 (lambda (a b) (+ a 1)) 2)) ->
                   (... (let ((y (lambda (a b) (+ a 1))) (z 2)) (y (+ z 1))))
                 let: f50's parameter y is passed (lambda (a b) (+ a 1)) and called (y (+ z 1)), but (lambda (a b) (+ a 1)) needs 2 arguments"))

  (let-temporarily ((*report-boolean-functions-misbehaving* #t))
    (lint-test "(let () (define (f80? x) (if z (display x) (string-append x y z))) (display x) f80?)" 
	       " let: f80? looks boolean, but it can return (string-append x y z)"))
  
  (let-temporarily (((*lint* '*report-nested-if*) 3))
    (lint-test "(if (< x y) (display z) (if (> x y) (+ w 1) (when (= x y) 0)))" 
	       " if: perhaps (if (< x y) (display z) (if (> x y) (+ w 1) (when (= x y) 0))) ->
                  (cond ((< x y) (display z)) ((> x y) (+ w 1)) (else (when (= x y) 0)))"))

  (lint-test "(let () (define x 2) (display x) (set! y 32) (display y) (* y (log y)))" 
	     " let: perhaps (... (define x 2) (display x) (set! y 32) (display y) (* y (log y))) -> (... (let ((x 2)) ...))
               let: the scope of x could be reduced: (... (define x 2) (display x) ...) -> (... (let ((x 2)) (display x)) ...)
               let: perhaps (let () (define x 2) (display x) (set! y 32) (display y) (* y (log y))) -> (let ((x 2)) ...)")
  (lint-test "(let () (display 32) (define x 2) (define (f101 y) (+ x y)) (display 41) (f101 2))" 
	     " let: perhaps move x into f101's closure: (... (define x 2) (define (f101 y) (+ x y)) ...) ->
                 (... (define f101 (let ((x 2)) (lambda (y) (+ x y)))) ...) 
               let: (define x 2) occurs in the midst of the body; perhaps use let: (let ((x 2)) (define (f101 y) (+ x y)) (display 41) (f101 2))
               x is used only in f101")
  (lint-test "(let () (display 33) (define x 2) (define x (+ x y)) (display 43))" 
	     " let: use set! to redefine x: (... (define x (+ x y)) ...) -> (... (set! x (+ x y)) ...)
               let: (define x 2) occurs in the midst of the body; perhaps use let: (let ((x 2)) (define x (+ x y)) (display 43))
               let: let variable x is redefined in the let body.  Perhaps use set! instead: (set! x (+ x y))
               let: x not used, initially: (+ x y) from define")
  (lint-test "(let () (display 34) (define x 2) (define f101 (lambda (y) (+ x y))) (display 41) (f101 2))" 
	     " let: perhaps move x into f101's closure: (... (define x 2) (define f101 (lambda (y) (+ x y))) ...) -> 
                 (... (define f101 (let ((x 2)) (lambda (y) (+ x y)))) ...)
               let: the scope of f101 could be reduced: 
                 (... (define f101 (lambda (y) (+ x y))) (display 41) (f101 2)) ->
                 (... (let ((f101 (lambda (y) (+ x y)))) (display 41) (f101 2)))
               let: (define x 2) occurs in the midst of the body; perhaps use let: (let ((x 2)) (define f101 (lambda (y) (+ x y))) (display 41) (f101 2))")
  (lint-test "(let ((x (read-byte)) (y (read-byte))) (- x y))" 
	     " let: order of evaluation of let's bindings is unspecified, so (let ((x (read-byte)) (y (read-byte))) (- x y)) is trouble
               let: perhaps (let ((x (read-byte)) (y (read-byte))) (- x y)) -> (- (read-byte) (read-byte))")
  (lint-test "(list (read port) (read-char port))" 
	     " list: order of evaluation of list's arguments is unspecified, so (list (read port) (read-char port)) is trouble")
  (lint-test "(list (read port) (read-char))" "")
  (lint-test "(list (set! x 3) (+ x 1))" 
	     " list: order of evaluation of list's arguments is unspecified, so (list (set! x 3) (+ x 1)) is trouble")
  (lint-test "(list (throw 'oops) 1 2)" "")
  (lint-test "(list (throw 'oops) 1 (read-byte))" 
	     " list: order of evaluation of list's arguments is unspecified, so (list (throw 'oops) 1 (read-byte)) is trouble")
  (lint-test "(values (read) (read-char) (read-string 2))" 
	     " values: order of evaluation of values's arguments is unspecified, so (values (read) (read-char) (read-string 2)) is trouble")
  (lint-test "(letrec ((a (read)) (b (read-char)) (c (read-string 2))) (list a b c))" 
	     " letrec: order of evaluation of letrec's bindings is unspecified, so (letrec ((a (read)) (b (read-char)) (c (read-string 2))) (list a b c)) is trouble
               letrec: letrec could be let: (letrec ((a (read)) (b (read-char)) (c (read-string 2))) (list a b c))")

  (lint-test "(call-with-input-file caaaar)" 
	     " call-with-input-file: call-with-input-file needs 2 arguments: (call-with-input-file caaaar)
               call-with-input-file: in (call-with-input-file caaaar), call-with-input-file's argument  should be a string, but caaaar is a procedure?")

  (lint-test "(and (< 0 x) (< x 1))"   " and: perhaps (and (< 0 x) (< x 1)) -> (< 0 x 1)")
  (lint-test "(and (< 1 x) (< x 1))"   " and: perhaps (and (< 1 x) (< x 1)) -> #f")
  (lint-test "(and (< 1 x) (< x 0))"   " and: perhaps (and (< 1 x) (< x 0)) -> #f")
  (lint-test "(and (<= 0 x) (<= x 1))" " and: perhaps (and (<= 0 x) (<= x 1)) -> (<= 0 x 1)")
  (lint-test "(and (<= 1 x) (<= x 1))" " and: perhaps (and (<= 1 x) (<= x 1)) -> (= 1 x)")
  (lint-test "(and (<= 1 x) (<= x 0))" " and: perhaps (and (<= 1 x) (<= x 0)) -> #f")
  (lint-test "(and (< 0 x) (<= x 1))"  "")
  (lint-test "(and (< 1 x) (<= x 1))"  " and: perhaps (and (< 1 x) (<= x 1)) -> #f")
  (lint-test "(and (< 1 x) (<= x 0))"  " and: perhaps (and (< 1 x) (<= x 0)) -> #f")
  (lint-test "(and (<= 0 x) (< x 1))"  "")
  (lint-test "(and (<= 1 x) (< x 1))"  " and: perhaps (and (<= 1 x) (< x 1)) -> #f")
  (lint-test "(and (<= 1 x) (< x 0))"  " and: perhaps (and (<= 1 x) (< x 0)) -> #f")
  (lint-test "(or (< 0 x) (< x 1))"    " or: perhaps (or (< 0 x) (< x 1)) -> #t")
  (lint-test "(or (< 1 x) (< x 1))"    " or: perhaps (or (< 1 x) (< x 1)) -> (not (= x 1))")
  (lint-test "(or (< 1 x) (< x 0))"    " or: perhaps (or (< 1 x) (< x 0)) -> (not (>= 1 x 0))")
  (lint-test "(or (<= 0 x) (<= x 1))"  " or: perhaps (or (<= 0 x) (<= x 1)) -> #t")
  (lint-test "(or (<= 1 x) (<= x 1))"  " or: perhaps (or (<= 1 x) (<= x 1)) -> #t")
  (lint-test "(or (<= 1 x) (<= x 0))"  " or: perhaps (or (<= 1 x) (<= x 0)) -> (not (> 1 x 0))")
  (lint-test "(or (< 0 x) (<= x 1))"   " or: perhaps (or (< 0 x) (<= x 1)) -> #t")
  (lint-test "(or (< 1 x) (<= x 1))"   " or: perhaps (or (< 1 x) (<= x 1)) -> #t")
  (lint-test "(or (< 1 x) (<= x 0))"   "")
  (lint-test "(or (<= 0 x) (< x 1))"   " or: perhaps (or (<= 0 x) (< x 1)) -> #t")
  (lint-test "(or (<= 1 x) (< x 1))"   " or: perhaps (or (<= 1 x) (< x 1)) -> #t")
  (lint-test "(or (<= 1 x) (< x 0))"   "")
  (lint-test "(or (< x 0) (> x 9))"    " or: perhaps (or (< x 0) (> x 9)) -> (not (<= 0 x 9))")
  (lint-test "(or (> 0 x) (> x 9))"    " or: perhaps (or (> 0 x) (> x 9)) -> (not (<= 0 x 9))")
  (lint-test "(or (>= 0 x) (>= x 9))"  " or: perhaps (or (>= 0 x) (>= x 9)) -> (not (< 0 x 9))")
  (lint-test "(or (> x 9) (< x 0))"    " or: perhaps (or (> x 9) (< x 0)) -> (not (>= 9 x 0))")
  (lint-test "(or (< x 3.0) (> x 3.0))" " or: perhaps (or (< x 3.0) (> x 3.0)) -> (not (= x 3.0))")
  (lint-test "(or (< x 3.0) (= x 3.0))" " or: perhaps (or (< x 3.0) (= x 3.0)) -> (<= x 3.0) or: = can be troublesome with floats: (= x 3.0)")
  (lint-test "(and (< 0 x) (> x 0))"   " and: perhaps (and (< 0 x) (> x 0)) -> (< 0 x)")
  (lint-test "(or (< 0 x) (> x 0))"    " or: perhaps (or (< 0 x) (> x 0)) -> (> x 0)")
  (lint-test "(and (<= 0 x) (>= x 0))" " and: perhaps (and (<= 0 x) (>= x 0)) -> (<= 0 x)")
  (lint-test "(or (<= 0 x) (>= x 0))"  " or: perhaps (or (<= 0 x) (>= x 0)) -> (>= x 0)")
  (lint-test "(and (<= 0 x) (> x 0))"  " and: perhaps (and (<= 0 x) (> x 0)) -> (> x 0)")
  (lint-test "(or (<= 0 x) (> x 0))"   " or: perhaps (or (<= 0 x) (> x 0)) -> (>= x 0)")
  (lint-test "(and (< 0 x) (>= x 0))"  " and: perhaps (and (< 0 x) (>= x 0)) -> (> x 0)")
  (lint-test "(or (< 0 x) (>= x 0))"   " or: perhaps (or (< 0 x) (>= x 0)) -> (>= x 0)")
  (lint-test "(and (< x 0) (> x 0))"   " and: perhaps (and (< x 0) (> x 0)) -> #f")
  (lint-test "(or (< x 0) (> x 0))"    " or: perhaps (or (< x 0) (> x 0)) -> (not (= x 0))")
  (lint-test "(and (<= x 0) (>= x 0))" " and: perhaps (and (<= x 0) (>= x 0)) -> (= x 0)")
  (lint-test "(or (<= x 0) (>= x 0))"  " or: perhaps (or (<= x 0) (>= x 0)) -> #t")
  (lint-test "(and (<= x 0) (> x 0))"  " and: perhaps (and (<= x 0) (> x 0)) -> #f")
  (lint-test "(or (<= x 0) (> x 0))"   " or: perhaps (or (<= x 0) (> x 0)) -> #t")
  (lint-test "(and (< x 0) (>= x 0))"  " and: perhaps (and (< x 0) (>= x 0)) -> #f")
  (lint-test "(or (< x 0) (>= x 0))"   " or: perhaps (or (< x 0) (>= x 0)) -> #t")
  
  (lint-test "(< 0 x 1)"  "")
  (lint-test "(< 1 x 1)"  " <: it looks odd to have repeated arguments in (< 1 x 1) <: this comparison can't be true: (< 1 x 1) <: perhaps (< 1 x 1) -> #f")
  (lint-test "(< 1 x 0)"  " <: this comparison can't be true: (< 1 x 0)") ; return #f!
  (lint-test "(<= 0 x 1)" "")
  (lint-test "(<= 1 x 1)" " <=: it looks odd to have repeated arguments in (<= 1 x 1) <=: perhaps (<= 1 x 1) -> (= 1 x)")
  (lint-test "(<= 1 x 0)" " <=: this comparison can't be true: (<= 1 x 0)")

  (lint-test "(if (>= (length x) 1) y z)" " if: perhaps (assuming x is a proper list), (>= (length x) 1) -> (pair? x)")
;  (lint-test "(if (> (length x) 1) y z)"  " if: perhaps (assuming x is a proper list), (> (length x) 1) -> (and (pair? x) (pair? (cdr x)))")
  (lint-test "(if (< (length x) 1) y z)"  " if: perhaps (assuming x is a proper list), (< (length x) 1) -> (null? x)")
  (lint-test "(if (<= (length x) 1) y z)" " if: perhaps (assuming x is a proper list), (<= (length x) 1) -> (or (null? x) (null? (cdr x)))")
  (lint-test "(if (= (length x) 1) y z)"  " if: perhaps (assuming x is a list), (= (length x) 1) -> (and (pair? x) (null? (cdr x)))")
  (lint-test "(if (>= (length x) 0) y z)" " if: perhaps (assuming x is a proper list), (>= (length x) 0) -> (list? x)")
  (lint-test "(if (> (length x) 0) y z)"  " if: perhaps (assuming x is a proper list), (> (length x) 0) -> (pair? x)")
  (lint-test "(if (< (length x) 0) y z)"  " if: perhaps (< (length x) 0) -> (and (pair? x) (not (proper-list? x)))")
  (lint-test "(if (<= (length x) 0) y z)" " if: perhaps (assuming x is a proper list), (<= (length x) 0) -> (null? x)")
  (lint-test "(if (= (length x) 0) y z)"  " if: perhaps (assuming x is a list), (= (length x) 0) -> (null? x)")
  (lint-test "(if (>= 0 (length x)) y z)" " if: perhaps (assuming x is a proper list), (>= 0 (length x)) -> (null? x)")
  (lint-test "(if (> 0 (length x)) y z)"  " if: perhaps (> 0 (length x)) -> (and (pair? x) (not (proper-list? x)))")
  (lint-test "(if (< 0 (length x)) y z)"  " if: perhaps (assuming x is a proper list), (< 0 (length x)) -> (pair? x)")
  (lint-test "(if (<= 0 (length x)) y z)" " if: perhaps (assuming x is a proper list), (<= 0 (length x)) -> (list? x)")
  (lint-test "(if (= 0 (length x)) y z)"  " if: perhaps (assuming x is a list), (= 0 (length x)) -> (null? x)")
  (lint-test "(if (>= 1 (length x)) y z)" " if: perhaps (assuming x is a proper list), (>= 1 (length x)) -> (or (null? x) (null? (cdr x)))")
  (lint-test "(if (> 1 (length x)) y z)"  " if: perhaps (assuming x is a proper list), (> 1 (length x)) -> (null? x)")
;  (lint-test "(if (< 1 (length x)) y z)"  " if: perhaps (assuming x is a proper list), (< 1 (length x)) -> (and (pair? x) (pair? (cdr x)))")
  (lint-test "(if (<= 1 (length x)) y z)" " if: perhaps (assuming x is a proper list), (<= 1 (length x)) -> (pair? x)")
  (lint-test "(if (= 1 (length x)) y z)"  " if: perhaps (assuming x is a list), (= 1 (length x)) -> (and (pair? x) (null? (cdr x)))")
  (lint-test "(if (null? x) () (map abs x))" " if: perhaps (if (null? x) () (map abs x)) -> (map abs x)")

  (lint-test "(< (vector-length x) 1)" " <: perhaps (< (vector-length x) 1) -> (equal? x #())")
  (lint-test "(> 1 (string-length x))" " >: perhaps (> 1 (string-length x)) -> (string=? x \"\")")
  (lint-test "(zero? (string-length x))" " zero?: perhaps (zero? (string-length x)) -> (string=? x \"\")")
  (lint-test " (string-length (make-string 3))" " string-length: perhaps (string-length (make-string 3)) -> 3")
  (lint-test " (vector-length (make-vector 10))" " vector-length: perhaps (vector-length (make-vector 10)) -> 10")
  (lint-test " (max (log x) :minlog)" " max: in (max (log x) :minlog), max's argument 2 should be real, but :minlog is a keyword?")

  (lint-test "(member outport (list *stderr* *stdout*))" "") ; not '(*stderr*...)!
  (lint-test "(define ((foo x) y) (list x y))" 
	     " define: perhaps (define ((foo x) y) (list x y)) -> (define (foo x) (lambda (y) (list x y)))")
  (lint-test "(let () (define ((foo x) y) (list x y)) (foo 1 2))" 
	     " let: perhaps (define ((foo x) y) (list x y)) -> (define (foo x) (lambda (y) (list x y)))")
  (lint-test "(define ((foo x) y) (+ (* -1 x) y))" 
	     " define: perhaps (define ((foo x) y) (+ (* -1 x) y)) -> (define (foo x) (lambda (y) (+ (* -1 x) y)))
               foo: perhaps (+ (* -1 x) y) -> (- y x)")

  ;; this needs work (never #f vars are tricky)
  (lint-test "(equal? x abs)" " equal?: equal? could be eq? in (equal? x abs)")
  (lint-test "(equal? x begin)" " equal?: equal? could be eq? in (equal? x begin)")
  (lint-test "(equal? x lint)" "")
  (lint-test "(string x #\\xd)" " #\\xd is #\\return")
  
  (lint-test "(let ((x ())) (set! x (cons 1 x)) (if x 3 2))" 
	     " let: x is never #f, so (if x 3 2) -> 3 
               let: perhaps (let ((x ())) (set! x (cons 1 x)) (if x 3 2)) -> (let ((x (cons 1 ()))) (if x 3 2))")
  (lint-test "(let ((x ())) (if x 3 2))" 
	     " let: perhaps (let ((x ())) (if x 3 2)) -> (if () 3 2)
               let: x is never #f, so (if x 3 2) -> 3")
  (lint-test "(let ((x ())) (if (pair? x) 3 2))" " let: perhaps (let ((x ())) (if (pair? x) 3 2)) -> (if (pair? ()) 3 2)")
  (lint-test "(let ((x 0)) (if x 3 2))" 
	     " let: perhaps (let ((x 0)) (if x 3 2)) -> (if 0 3 2)
               let: x is never #f, so (if x 3 2) -> 3")
  (lint-test "(let ((x 0)) (if (zero? x) 3 2))"
	     " let: perhaps (let ((x 0)) (if (zero? x) 3 2)) -> (if (zero? 0) 3 2)
               let: x is 0, so (zero? x) is #t")
  (lint-test "(let ((x 0)) (set! x ()) (if x 3 2))" " let: perhaps (let ((x 0)) (set! x ()) (if x 3 2)) -> (let ((x ())) (if x 3 2))")
  (lint-test "(let ((x 0)) (set! x ()) (if (null? x) 3 2))"   
	     " let: perhaps (let ((x 0)) (set! x ()) (if (null? x) 3 2)) -> (let ((x ())) (if (null? x) 3 2))")
  (lint-test "(let ((x 0)) (display x) (set! x ()) (if (null? x) 3 2))"   
	     " let: perhaps combine these two lines: (set! x ()) (if (null? x) 3 2)")
  (lint-test "(let ((x 0)) (when x 3))" " let: perhaps (let ((x 0)) (when x 3)) -> (when 0 3) let: x is never #f, so (when x 3) -> 3")
  (lint-test "(let ((x 0)) (when (zero? x) 3))"
	     " let: perhaps (let ((x 0)) (when (zero? x) 3)) -> (when (zero? 0) 3)
               let: x is 0, so (zero? x) is #t")
  (lint-test "(let ((x 0)) (set! x ()) (unless x 3))"  " let: perhaps (let ((x 0)) (set! x ()) (unless x 3)) -> (let ((x ())) (unless x 3))")
  
  (lint-test "(let ((x 0)) (cond (x 3) (else 4)))" " let: perhaps (let ((x 0)) (cond (x 3) (else 4))) -> (cond (0 3) (else 4))")
  (lint-test "(let ((x 0)) (cond ((zero? x) 3) (else 4)))" " let: x is 0, so (zero? x) is #t")
  (lint-test "(let ((x 0)) (set! x ()) (cond (x 3) (else 4)))"   
	     " let: perhaps (let ((x 0)) (set! x ()) (cond (x 3) (else 4))) -> (let ((x ())) (cond (x 3) (else 4)))")
  
  (lint-test "(let ((x 0)) (case x ((0) 3) (else 4)))" " let: perhaps (case x ((0) 3) (else 4)) -> (if (eqv? x 0) 3 4)")
  (lint-test "(let ((x 0)) (do ((i x (+ i 1))) ((= i 0))))" 
	     " let: this do-loop could probably be replaced by the end test in a let: (do ((i x (+ i 1))) ((= i 0)))
               let: perhaps (let ((x 0)) (do ((i x (+ i 1))) ((= i 0)))) -> (do ((i 0 (+ i 1))) ...)")

  (lint-test "(let ((x 32)) (display x) (set! y (f x)) (g (+ x 1) y) (a y) (f y) (g y) (h y) (i y) (set! x 3) (display x) (h y x))" 
	     " let: perhaps add a new binding for x to replace (set! x 3): 
                 (let ((x 32)) (display x) (set! y (f x)) (g (+ x 1) y) (a y) (f y) (g y)... ->
                 (let ... (let ((x 3)) ...))")
  (lint-test "(let ((x 32)) (set! y (f 1)) (a y) (f y) (g y) (h y) (i y) (set! x (+ x 1)) (display x) (h y x))" 
	     " let: perhaps move the x binding to replace (set! x (+ x 1)): 
                 (let ((x 32)) (set! y (f 1)) (a y) (f y) (g y) (h y) (i y) (set! x (+ x... ->
                 (let () ... (let ((x (+ 32 1))) ...))")

  (lint-test "(let loop ((x y)) (if (null? x) () (cons (car x) (loop (cdr x)))))" 
	     " loop: perhaps (let loop ((x y)) (if (null? x) () (cons (car x) (loop (cdr x))))) -> (copy y)")
  (lint-test "(let loop ((x y)) (if (null? x) () (cons (string (car x)) (loop (cdr x)))))" 
	     " loop: perhaps (let loop ((x y)) (if (null? x) () (cons (string (car x)) (loop (cdr x))))) -> (map string y)")
  (lint-test "(let loop ((x y)) (cond ((null? x) ()) (else (cons (abs (car x)) (loop (cdr x))))))"
	     " loop: perhaps (let loop ((x y)) (cond ((null? x) ()) (else (cons (abs (car x)) (loop... -> (map abs y)")
  (lint-test "(let loop ((x y)) (when (pair? x) (display (car x)) (loop (cdr x))))" 
	     " loop: perhaps (let loop ((x y)) (when (pair? x) (display (car x)) (loop (cdr x)))) -> (for-each display y)")
  (lint-test "(let loop ((x y)) (unless (null? x) (display (car x)) (loop (cdr x))))" 
	     " loop: perhaps (let loop ((x y)) (unless (null? x) (display (car x)) (loop (cdr x)))) -> (for-each display y)")
  (lint-test "(let loop ((x y)) (case x ((0 1) x) (else (loop (+ x 1)))))" 
	     " loop: perhaps (let loop ((x y)) (case x ((0 1) x) (else (loop (+ x 1))))) -> (do ((x y (+ x 1))) ((memv x '(0 1)) x))
               let: perhaps (case x ((0 1) x) (else (loop (+ x 1)))) -> (if (memv x '(0 1)) x (loop (+ x 1)))
               let: in ((0 1) x), the result can be omitted")
  
  (lint-test "(if (or (eq? x abs) (eq? x case) (eq? x null?)) 3 2)" "")
  (lint-test "(cond ((eq? x begin) 1) ((eq? x reader-cond) 2) ((eq? x lint) 3))" "")
  (lint-test "(cond ((eq? x 'begin) 1) ((eq? x 'reader-cond) 2) ((eq? x 'lint) 3))" 
	     " cond: perhaps use case instead of cond: 
               (cond ((eq? x 'begin) 1) ((eq? x 'reader-cond) 2) ((eq? x 'lint) 3)) -> (case x ((begin) 1) ((reader-cond) 2) ((lint) 3))")
  
  (lint-test "(let ((x (getenv \"HOME\"))) (if x (display x)))" 
	     " let: perhaps (let ((x (getenv \"HOME\"))) (if x (display x))) -> (cond ((getenv \"HOME\") => display))
               let: x is never #f, so (if x (display x)) -> (display x)")
  (lint-test "(and-let* ((x (f y))) (abs x))" " and-let*: perhaps (and-let* ((x (f y))) (abs x)) -> (cond ((f y) => abs))")
  (lint-test "(let () (define* (f51 (a 3)) (if (zero? a) 3 (f51 (- a 1)))) (f51 -1))" 
	     " let: perhaps (... (define* (f51 (a 3)) (if (zero? a) 3 (f51 (- a 1)))) (f51 -1)) ->
                 (... (let* f51 ((a -1)) (if (zero? a) 3 (f51 (- a 1)))))
               f51: perhaps (define* (f51 (a 3)) (if (zero? a) 3 (f51 (- a 1)))) -> (define* (f51 (a 3)) (do ((a a (- a 1))) ((zero? a) 3)))")
  (lint-test "(let () (define* (f51 (a 3) b) (if (zero? a) 3 (f51 (- a 1)))) (f51 -1))" 
	     " let: perhaps (... (define* (f51 (a 3) b) (if (zero? a) 3 (f51 (- a 1)))) (f51 -1)) ->
                 (... (let* f51 ((a -1) (b #f)) (if (zero? a) 3 (f51 (- a 1)))))")
  (lint-test "(let () (define* (f51 (a 3) (b 32)) (if (zero? a) 3 (f51 (- a 1)))) (f51 -1))" 
	     " let: perhaps (... (define* (f51 (a 3) (b 32)) (if (zero? a) 3 (f51 (- a 1)))) (f51 -1)) ->
                 (... (let* f51 ((a -1) (b 32)) (if (zero? a) 3 (f51 (- a 1)))))")
  (lint-test "(let () (lambda (a b) (+ a (* 2 b))))" " let: pointless let: (let () (lambda (a b) (+ a (* 2 b))))")
  (lint-test "(let () (define (f x) x) (do ((i 0 (+ i 1))) ((= i 10)) (f i)))" 
	     " let: this do-loop could probably be replaced by the end test in a let: (do ((i 0 (+ i 1))) ((= i 10)) (f i))
               let: this could be omitted: (f i)
               let: perhaps (do ((i 0 (+ i 1))) ((= i 10)) (f i)) -> (do ((i 0 (+ i 1))) ((= i 10)) i)")
  (lint-test "(let () (define (f x) (abs (* 2 x))) (do ((i 0 (+ i 1))) ((= i 10)) (f i)))"
	     " let: this do-loop could probably be replaced by the end test in a let: (do ((i 0 (+ i 1))) ((= i 10)) (f i))
               let: this could be omitted: (f i)
               let: perhaps (do ((i 0 (+ i 1))) ((= i 10)) (f i)) -> (do ((i 0 (+ i 1))) ((= i 10)) (abs (* 2 i)))")

  (lint-test "(let () (define (f202 x) (x 1 2)) (f202 (lambda (a b) a)) (f202 (lambda (a b) (+ a 1))))" 
	     " let: f202 parameter x is a function whose parameter 2 is never used")
  (lint-test "(let () (define (f202 x) (x 1 2)) (f202 (lambda (a b) a)) (f202 (lambda (c d) (+ c 1))))" 
	     " let: f202 parameter x is a function whose parameter 2 is never used")
  (lint-test "(let () (define (f202 x) (x 1 2)) (f202 (lambda (a b) a)) (f202 (lambda (c d) (+ d 1))))" "")
  (lint-test "(let () (define (f201 x) (g (f x))) (f201 1) (f201 1) (f201 1))" " let: f201's 'x parameter is always 1 (3 calls)")

  (lint-test "(string->symbol (let ((s (copy vstr))) (set! (s (+ pos 1)) #\\s) s))" 
	     " string->symbol: perhaps
                (string->symbol (let ((s (copy vstr))) (set! (s (+ pos 1)) #\\s) s)) ->
                (let ((s (copy vstr))) (set! (s (+ pos 1)) #\\s) (string->symbol s))")

  (lint-test "(apply env-channel 
                (make-env :envelope '(0 0 1 1) 
                          :length (if (and (> (length args) 1) (number? (cadr args))) (cadr args)
                                      (framples (if (> (length args) 2) (caddr args) (selected-sound))))) args)" 
	     " apply: perhaps (apply env-channel (make-env ...) args) -> 
                 (let ((_1_ (make-env ...))) (apply env-channel _1_ args))")
  (let-temporarily ((*report-bloated-arg* 50))
    (lint-test "(apply env-channel 
                  (make-env :envelope '(0 0 1 1) 
                            :length (if (and (> (length args) 1) (number? (cadr args))) (cadr args)
                                        (framples (if (> (length args) 2) (caddr args) (selected-sound))))) args)" ""))

  (lint-test "(let ((x 1)) (and x (< x 1)))" 
	     " in (and x (< x 1)), perhaps change x to (real? x)
               let: x is an integer, so (and x (< x 1)) -> (< x 1)")
  (lint-test "(let ((x 1)) (and (< x 1) x))" "")
  (lint-test "(let ((x 1)) (and x (< x 1) x))" 
	     " in (and x (< x 1)), perhaps change x to (real? x)
               let: x is an integer, so (and x (< x 1) x) -> (and (< x 1) x)")
  (lint-test "(let ((x 1)) (not x))" " let: perhaps (let ((x 1)) (not x)) -> (not 1) let: x is an integer, so (not x) -> #f")
  (lint-test "(gensym 'ok)" " gensym: in (gensym 'ok), gensym's argument should be a string, but 'ok is a symbol?")
  (lint-test "(string-ref 'ok 0)" 
	     " string-ref: in (string-ref 'ok 0), string-ref's argument 1 should be a string, but 'ok is a symbol?
               string-ref: (string-ref 'ok 0): string-ref argument 1, ok, is a symbol but should be a string")
  (lint-test "(+ 2 #X11)" " reader[0]: unknown # object: #X11 use #x11 not #X11 +: perhaps (+ 2 17) -> 19")

  (lint-test "(let ((l 1)) (+ l 1))" " let: perhaps (let ((l 1)) (+ l 1)) -> (+ 1 1) let: \"l\" is a really bad variable name")
  (lint-test "(let ((let 1)) (+ let 1))" " let: perhaps (let ((let 1)) (+ let 1)) -> (+ 1 1) let: let variable named let is asking for trouble")
  (lint-test "(define (f12 l) (log (abs l)))" " f12: \"l\" is a really bad variable name")
  (let-temporarily ((*report-bad-variable-names* '(info data)))
    (lint-test "(let ((data 1)) (+ data 32))" 
	       " let: perhaps (let ((data 1)) (+ data 32)) -> (+ 1 32)
                 let: surely there's a better name for this variable than data")
    (lint-test "(let ((info1 32) (info-1 31)) (+ info1 info-1))" 
	       " let: perhaps (let ((info1 32) (info-1 31)) (+ info1 info-1)) -> (+ 32 31)
                 let: surely there's a better name for this variable than info-1
                 let: surely there's a better name for this variable than info1")
    (lint-test "(let ((compute-x 32)) (+ compute-x x))" 
	       " let: perhaps (let ((compute-x 32)) (+ compute-x x)) -> (+ 32 x)
                 let: surely there's a better name for this variable than compute-x"))
  (lint-test "(set! else #f)" " set!: bad idea: (set! else #f)")
  (lint-test "(define (f12 else) (log (abs else)))" " f12: surely there's a better name for this variable than else")
  (lint-test "(define (f12 => else) (+ => else))" 
	     " f12: leaving aside +'s optional args, f12 could be (define f12 +)
               f12: surely there's a better name for this variable than else")
  (lint-test "(let ((else #f)) (or 3 else))" 
	     " let: perhaps, ignoring short-circuit issues, (let ((else #f)) (or 3 else)) -> (or 3 #f)
               let: perhaps (or 3 else) -> 3
               let: surely there's a better name for this variable than else")
  (lint-test "(define else 32)" " define: redefinition of else is a bad idea: (define else 32)")

  (let-temporarily ((*report-built-in-functions-used-as-variables* #t))
    (lint-test "(let ((list 3)) (display list))" 
	       " let: perhaps (let ((list 3)) (display list)) -> (display 3)
                 let: let variable named list is asking for trouble")
    (lint-test "(let ((cond 3)) (display cond))" 
	       " let: perhaps (let ((cond 3)) (display cond)) -> (display 3)
                 let: let variable named cond is asking for trouble")
    (lint-test "(let () (define (f50 abs) (abs -1)) (f50 positive?))" 
	       " let: perhaps (... (define (f50 abs) (abs -1)) (f50 positive?)) -> (... (let ((abs positive?)) (abs -1)))
                 let: f50's parameter abs is called (abs -1) : find a less confusing parameter name!
                 f50: f50 parameter named abs is asking for trouble")
    (lint-test "(let () (define (f50 abs) (positive? abs)) (f50 -1))" 
	       " let: perhaps (... (define (f50 abs) (positive? abs)) (f50 -1)) -> (... (let ((abs -1)) (positive? abs)))
                 f50: f50 could be (define f50 positive?)
                 f50: f50 parameter named abs is asking for trouble")
    (lint-test "(let append ((x y)) (if (null? x) () (append (cdr y))))"
	       " append: perhaps (let append ((x y)) (if (null? x) () (append (cdr y)))) -> (do ((x y (cdr y))) ((null? x) ()))
                 let: let variable named append is asking for trouble")
    (lint-test "(let () (define (f list) (+ list 1)) (f list))" 
	       " let: perhaps (... (define (f list) (+ list 1)) (f list)) -> (... (let ((list list)) (+ list 1)))
               f: f parameter named list is asking for trouble
               let: in (f list), f's argument should be a number, but list is a procedure?"))

  (lint-test "(error 'error \"ERROR SOMEWHERE UP TO HERE\")" " error: There's no need to shout: (error 'error \"ERROR SOMEWHERE UP TO HERE\")")
  (lint-test "(display \"ERROR: oops\" port)" " display: There's no need to shout: (display \"ERROR: oops\" port)")
  (lint-test "(throw 'oops \"throw: ~A~%\" x)" "")
  (lint-test "(throw 'oops \"throw: ~A~%\" x y)" " throw: throw has too many arguments: (throw 'oops \"throw: ~A~%\" x y)")
  (lint-test "(error 'oops \"error: ~A ~A~%\" x)" " error: error has too few arguments: (error 'oops \"error: ~A ~A~%\" x)")
  (lint-test "(catch #f (lambda () 1) (lambda args 2))" " catch: catch tag #f makes this catch a no-op")

  (lint-test "(define (f75) \"a string\")" " f75: returns a string constant: \"a string\"")
  (lint-test "(define (f75) #i(0 1 2 3))"   " f75: returns an int-vector constant: #i(0 1 2 3)")
  (lint-test "(define (f75) '(0 1 2 3))"   " f75: returns a list constant: '(0 1 2 3)")
  (lint-test "(define (f75 x) (if x '(0 1 2 3) (+ x 1)))" " f75: returns a list constant: '(0 1 2 3)")

  (lint-test "(define (f73 x) (let ((result 0)) (if (positive? x) (set! result 32) (set! result -1))))" 
	     " f73: perhaps (if (positive? x) (set! result 32) (set! result -1)) -> (set! result (if (positive? x) 32 -1))
               f73: result set, but not used: (set! result -1) (set! result 32)")
  (lint-test "(do ((res 0 (+ res 1))) ((= res 3)) (set! res (+ res 32)))" 
	     " do: perhaps move (set! res (+ res 32)) to res's step expression: (res 0 (+ 33 res))")
  (lint-test "(begin (define res 0) (set! res (+ res 32)))" "")
  (lint-test "(cond ((string=? x \"a\") 1) ((string=? \"b\" x) 2)((string=? x \"c\") 3) ((string=? \"a\" x) 4))" 
	     " cond: cond test (string=? \"a\" x) is never true: (cond ((string=? x \"a\") 1) ((string=? \"b\" x) 2) ((string=? x \"c\") 3)...
               cond: cond test is always false: ((string=? \"a\" x) 4)
               cond: perhaps (cond ((string=? x \"a\") 1) ((string=? \"b\" x) 2) ((string=? x \"c\") 3)... ->
              (cond ((string=? x \"a\") 1) ((string=? \"b\" x) 2) ((string=? x \"c\") 3))")
  (lint-test "(cond ((string=? x \"a\") 1) ((string=? \"b\" x) 2)((string=? x \"c\") 3) ((string=? x \"a\") 4))" 
	     " cond: cond test (string=? x \"a\") is never true: (cond ((string=? x \"a\") 1) ((string=? \"b\" x) 2) ((string=? x \"c\") 3)...
               cond: cond test repeated: ((string=? x \"a\") 4)
               cond: cond test is always false: ((string=? x \"a\") 4)
               cond: perhaps (cond ((string=? x \"a\") 1) ((string=? \"b\" x) 2) ((string=? x \"c\") 3)... ->
              (cond ((string=? x \"a\") 1) ((string=? \"b\" x) 2) ((string=? x \"c\") 3))")
  (lint-test "(cond ((< x 3) 1) ((> 2 x) 2) ((< x 1) 3))" "")
  (let-temporarily ((*report-unused-parameters* #t))
    (lint-test "(define (f74 x) (let ((lst (list 1 2 3 4 5 6 7 8))) (list-ref lst 2)))" 
	       "f74: lst can be moved to f74's closure
                f74: x not used")
    (lint-test "(let () (define (f75 x) (let ((lst (list 1 2 3 4 5 6 7 8))) (list-ref lst 2))) (f75 2))" 
	       " let: perhaps (... (define (f75 x) (let ((lst (list 1 2 3 4 5 6 7 8))) (list-ref lst... ->
                   (... (let ((x 2)) (let ((lst (list 1 2 3 4 5 6 7 8))) (list-ref lst 2))))
                 f75: lst can be moved to f75's closure
                 f75: x not used
                 let: f75's parameter 1 is not used, but a value is passed: 2"))

  (let-temporarily ((*report-loaded-files* #t))
    (call-with-output-file "tmp1.r5rs"
      (lambda (p)
	(format p "(define (f x) (and (< x 3) (> x 0)))~%")))
    (lint-test "(load \"tmp1.r5rs\")" " --------------------- ;tmp1.r5rs f: perhaps (and (< x 3) (> x 0)) -> (< 0 x 3)"))

  (lint-test "(or (< x 3) (> 3 x))" " or: perhaps (or (< x 3) (> 3 x)) -> (< x 3)")
  (lint-test "(and (< x 3) (> 3 x))" " and: perhaps (and (< x 3) (> 3 x)) -> (< x 3)")
  (lint-test "(case x ((1) (f 1)) ((2) (f 2)) (else (f 3)))" 
	     " case: perhaps (case x ((1) (f 1)) ((2) (f 2)) (else (f 3))) -> (f (case x ((1) 1) ((2) 2) (else 3)))
               case: perhaps use => here: (case x ((1) (f 1)) ((2) (f 2)) (else (f 3))) -> (case x ((1 2) => f) ...)")
  (lint-test "(case x ((1) (f 1)) ((2) (f 2)) (else (error 'oops)))" 
	     " case: perhaps (case x ((1) (f 1)) ((2) (f 2)) (else (error 'oops))) -> (f (case x ((1) 1) ((2) 2) (else (error 'oops))))
               case: perhaps use => here: (case x ((1) (f 1)) ((2) (f 2)) (else (error 'oops))) -> (case x ((1 2) => f) ...)")
  (lint-test "(cond ((< x a) (f 1)) ((< x b) (f 2)) (else (f 3)))" 
	     " cond: perhaps (cond ((< x a) (f 1)) ((< x b) (f 2)) (else (f 3))) -> (f (cond ((< x a) 1) ((< x b) 2) (else 3)))")
  (lint-test "(- (cond ((char-position c dline id-pos)) (else 0)) 1)" 
	     " -: perhaps (cond ((char-position c dline id-pos)) (else 0)) -> (or (char-position c dline id-pos) 0)")
  (lint-test "(begin (cond ((find-sound v) => close-sound)) (display x))" "") ; check for side-effect confusion

  (lint-test "(let ((p (open-output-file str))) (display 32 p) x)" 
	     " let: in (let ((p (open-output-file str))) (display 32 p) x) perhaps p is opened via (open-output-file str), but never closed")
  (lint-test "(let ((p #f)) (if x (set! p (open-output-file str))) (display 32 p) x)" 
	     " let: in (let ((p #f)) (if x (set! p (open-output-file str))) (display 32 p) x) 
                 perhaps p is opened via (set! p (open-output-file str)), but never closed")

  (lint-test "(define (listtail x k) (if (zero? k) x (listtail (cdr x) (- k 1))))"
	     " listtail: perhaps (define (listtail x k) (if (zero? k) x (listtail (cdr x) (- k 1)))) ->
                 (define (listtail x k) (do ((x x (cdr x)) (k k (- k 1))) ((zero? k) x)))
               listtail: listtail is the same as the built-in function list-tail")
  ;; too tricky!  (lint-test "(define (mdi) (define reader1 (lambda* (quit) (reader1))))" "")

  (lint-test "(truncate (/ x y))"               " truncate: perhaps (truncate (/ x y)) -> (quotient x y)")
  (lint-test "(- x (* y (quotient x y)))"       "-: perhaps (- x (* y (quotient x y))) -> (remainder x y)")
  (lint-test "(- x (* (quotient x y) y))"       "-: perhaps (- x (* (quotient x y) y)) -> (remainder x y)")
  (lint-test "(cdr '(a))"                       " cdr: perhaps (cdr '(a)) -> ()")
  (lint-test "(char-upcase #\\a)"               " char-upcase: perhaps (char-upcase #\\a) -> #\\A")
  (lint-test "(char-upper-case? #\\a)"          " char-upper-case?: perhaps (char-upper-case? #\\a) -> #f")
  (lint-test "(load \"\")"                      " load: load needs a real file name, not the empty string: (load \"\")")
  (lint-test "(load)"                           " load: load needs at least 1 argument: (load)")
  (lint-test "(write-byte 300)"                 " write-byte: write-byte argument must be (<= 0 byte 255): (write-byte 300)")
  (lint-test "(write-byte 95 (current-output-port))" 
	     " write-byte: (current-output-port) is the default port for write-byte: (write-byte 95 (current-output-port))")
  (lint-test "(peek-char (current-input-port))" 
	     " peek-char: (current-input-port) is the default port for peek-char: (peek-char (current-input-port))")
  (lint-test "(write-char #\\newline)"          " write-char: perhaps (write-char #\\newline) -> (newline)")
  (lint-test "(write-char #\\newline port)"     " write-char: perhaps (write-char #\\newline port) -> (newline port)")
  (lint-test "(write-string \"\n\")"            " write-string: perhaps (write-string \"\n\") -> (newline)")
  (lint-test "(write-string \"\")"              " write-string: (write-string \"\") is pointless")
  (lint-test "(char? #\\a)"                     " char?: perhaps (char? #\\a) -> #t")
  (lint-test "(symbol->string (keyword->symbol :hi))" " symbol->string: perhaps (keyword->symbol :hi) -> 'hi")
  (lint-test "(string->keyword (string-append \":\" z))" " string->keyword: string->keyword prepends #\\: for you: (string->keyword (string-append \":\" z))")
  (lint-test "(string->keyword (symbol->string sym))" " string->keyword: perhaps (string->keyword (symbol->string sym)) -> (symbol->keyword sym)")
  (lint-test "(keyword->symbol (string->keyword str))" " keyword->symbol: perhaps (keyword->symbol (string->keyword str)) -> (string->symbol str)")
  (lint-test "(symbol->keyword (string->symbol str))" " symbol->keyword: perhaps (symbol->keyword (string->symbol str)) -> (string->keyword str)")
  (lint-test "(keyword->symbol :hi)"            " keyword->symbol: perhaps (keyword->symbol :hi) -> 'hi")
  (lint-test "(symbol->keyword 'hiho)"          " symbol->keyword: perhaps (symbol->keyword 'hiho) -> :hiho")
  (lint-test "(positive? 1.0)"                  " positive?: perhaps (positive? 1.0) -> #t")
  (lint-test "(list? 'a)"                       " list?: perhaps (list? 'a) -> #f")
  (lint-test "(pair? 'a)"                       " pair?: perhaps (pair? 'a) -> #f")
  (lint-test "(proper-list? '(this - that))"    " proper-list?: perhaps (proper-list? '(this - that)) -> #t")
  (lint-test "(symbol? 'let)"                   " symbol?: perhaps (symbol? 'let) -> #t")
  (lint-test "(keyword? :rest)"                 " keyword?: perhaps (keyword? :rest) -> #t")
  (lint-test "(char? 'a)"                       " char?: perhaps (char? 'a) -> #f")
  (lint-test "(lcm 3/4 2)"                      " lcm: perhaps (lcm 3/4 2) -> 6")
  (lint-test "(string->list \"12345\" 2 1)"     " string->list: these string->list indices make no sense: (string->list \"12345\" 2 1)")
  (lint-test "(list->vector '(1 2 3))"          " list->vector: perhaps (list->vector '(1 2 3)) -> #(1 2 3)")
  (lint-test "(port-filename *stdout*)"         " port-filename: (port-filename *stdout*): \"*stdout*\"")
  (lint-test "(call-with-input-string \"(+ 1 2 3)\" s7-version)" 
	     " call-with-input-string: call-with-input-string argument should be a function of one argument: s7-version")
  (lint-test "(call-with-input-file tmp-output-file s7-version)" 
	     " call-with-input-file: call-with-input-file argument should be a function of one argument: s7-version")
  (lint-test "(vector? vector?)"                " vector?: perhaps (vector? vector?) -> #f")
  (lint-test "(vector? begin)"                  " vector?: perhaps (vector? begin) -> #f")
  (lint-test "(procedure? apply)"               " procedure?: perhaps (procedure? apply) -> #t")
  (lint-test "(dilambda? quasiquote)"           " dilambda?: perhaps (dilambda? quasiquote) -> #f")
  (lint-test "(number? most-negative-fixnum)"   " number?: perhaps (number? most-negative-fixnum) -> #t")
  (lint-test "(complex? pi)"                    " complex?: perhaps (complex? pi) -> #t")
  (lint-test "(exact? 1.0)"                     " exact?: perhaps (exact? 1.0) -> #f")
  (lint-test "(vector-ref #(hi) 0)"             " vector-ref: perhaps (vector-ref #(hi) 0) -> 'hi")
  (lint-test "(hash-table* 'a 3 'b)"            " hash-table*: key with no value? (hash-table* 'a 3 'b)")
  (lint-test "(close-output-port (current-output-port))" 
	     " close-output-port: (current-output-port) is the default port for close-output-port: (close-output-port (current-output-port))")
  (lint-test "(string-ref \"\" 0)"              " string-ref: (string-ref \"\" 0) is an error")
  (lint-test "(string-ref \"abc\" -1)"          " string-ref: (string-ref \"abc\" -1): string-ref argument 2, -1, is an integer but should be a non-negative integer")
  (lint-test "(vector-ref #() 0)"               " vector-ref: (vector-ref #() 0) is an error")
  (lint-test "(string-ref \"abc\" 1)"           " string-ref: perhaps (string-ref \"abc\" 1) -> #\\b")
  (lint-test "    (dilambda 1 2)" 
	     " dilambda: in (dilambda 1 2), dilambda's argument 1 should be a procedure, but 1 is an integer?
               dilambda: in (dilambda 1 2), dilambda's argument 2 should be a procedure, but 2 is an integer?")
  (lint-test "(let ((v (float-vector 1 2 3))) (vector-set! v 0 12) v)" " let: v is a float-vector, so perhaps use float-vector-set!, not vector-set!")
  (lint-test "(let ((v (int-vector 1 2 3))) (+ (vector-ref v 1) (int-vector-ref v 0)))" " let: v is an int-vector, so perhaps use int-vector-ref, not vector-ref")
  (lint-test "(let ((v (vector 1 2 3))) (float-vector-set! v 0 12) v)" " let: v is a vector, so use vector-set!, not float-vector-set!")
  (lint-test "(nth 1 lst)"  " nth: perhaps (nth 1 lst) -> (list-ref lst 1)")
  (lint-test "(sort lst <)" " sort: perhaps (sort lst <) -> (sort! (copy lst) <)")
  (lint-test "(sort (map car lst) (lambda (a b) (< (car a) (car b))))" " sort: use sort! here: (sort (map car lst) (lambda (a b) (< (car a) (car b))))")
  (lint-test "(display x (newline))"  
	     " display: in (display x (newline)), display's argument 2  should be an output-port or a boolean, but (newline) is a char?")
  (lint-test "(let ((p (open-input-string str))) (display x))"
	     " let: in (let ((p (open-input-string str))) (display x)) perhaps p is opened via (open-input-string str), but never closed
               let: p not used, initially: (open-input-string str) from let")
  (lint-test "(let ((p (open-output-string))) (display x))" 
	     " let: in (let ((p (open-output-string))) (display x)) perhaps p is opened via (open-output-string), but never closed
               let: p not used, initially: (open-output-string) from let")
  (lint-test "(let ((p (open-input-string str))) (display x) (close-output-port p))"
	     " let: in (let ((p (open-input-string str))) (display x) (close-output-port p)) p is opened and closed, but never used
               let: p is an input-port, but close-output-port in (close-output-port p) wants an output-port?")
  (lint-test "(let ((p (open-output-string))) (display x) (close-input-port p))"
	     " let: in (let ((p (open-output-string))) (display x) (close-input-port p)) p is opened and closed, but never used
               let: p is an output-port, but close-input-port in (close-input-port p) wants an input-port?")
  (lint-test "(let ((p (open-output-string))) (display x) (close-output-port p))" 
	     " let: in (let ((p (open-output-string))) (display x) (close-output-port p)) p is opened and closed, but never used")
  (lint-test "(let ((p (open-input-string str))) (display x) (close-input-port p))" 
	     " let: in (let ((p (open-input-string str))) (display x) (close-input-port p)) p is opened and closed, but never used")
  (lint-test "(let ((p (open-output-string))) (display val p) (close-output-port p))" 
	     " p: (let ((p (open-output-string))) (display val p) (close-output-port p)) is missing get-output-string")
  (lint-test "(let ((p (open-output-string))) (display val p) (fos val (close-output-port p)))" 
	     " p: (let ((p (open-output-string))) (display val p) (fos val... is missing get-output-string")
  (lint-test "(let ((s (open-output-string))) (write obj s) (let ((result (get-output-string s))) (close-output-port s) result))"
	     " s: perhaps (let ((s (open-output-string))) (write obj s) (let ((result... -> (object->string obj)")  
  (lint-test "(let ((x '(1 2 3))) (display (car x)) (display (list-ref x y)) (list-ref x 1))" " let: x could be a vector, rather than a list")
  (lint-test "(let ((x '(1 2 3))) (display (car x)) (display (x y)) (x 1))" " let: x could be a vector, rather than a list")
  (lint-test "(display 123 #f)" " display: (display 123 #f) could be 123")
  (lint-test "(write 123 #f)"   " write: (write 123 #f) could be 123")
  (lint-test "(newline #f)"     " newline: (newline #f) is a no-op, returning #<unspecified>")
  (lint-test "(define (func x) (if (or x 1/0+i) 3))" " func: perhaps (or x nan+1i) -> (or x nan+1i)") ; infinite loop 
  (lint-test "(if (and x 1/0) 3)" " if: perhaps (and x nan.0) -> (and x nan.0)")
  (lint-test "(cond ((number? x) 4) ((integer? x) 3) ((list? x) 0) ((pair? x) 1))"
	     " cond: (number? x) makes (integer? x) pointless in (cond ((number? x) 4) ((integer? x) 3) ((list? x) 0) ((pair? x) 1))
               cond: (list? x) makes (pair? x) pointless in (cond ((number? x) 4) ((integer? x) 3) ((list? x) 0) ((pair? x) 1))
                  (r5rs list? is proper-list? in s7)")
  (lint-test "(set! (symbol-setter 'x) (lambda () 21))" " set!: symbol-setter function should take 2 arguments: (set! (symbol-setter 'x) (lambda () 21))")
  (lint-test "(cond-expand (s7 (define (f x) (* x 23))) (else))" "")
  (lint-test "(cond-expand (s7))" " cond-expand: pointless cond-expand: (cond-expand (s7))")
  (lint-test "(cond-expand ((or s7 guile)))"  " cond-expand: pointless cond-expand: (cond-expand ((or s7 guile)))")
  (lint-test "(macroexpand (abs x))" " macroexpand: in s7, macroexpand's argument should be an expression whose car is a macro: (macroexpand (abs x))")
  (lint-test "(macroexpand macroexpand)" " macroexpand: in s7, macroexpand's argument should be an expression whose car is a macro: (macroexpand macroexpand)")
  (lint-test "(let () (define-macro (f1 x) `(g ,x ,x)) (macroexpand (f1 a)))" "")
  (lint-test "(let ((fv (float-vector 1.0 2.0))) (equal? fv X))" 
	     " let: perhaps (let ((fv (float-vector 1.0 2.0))) (equal? fv X)) -> (equal? (float-vector 1.0 2.0) X)
               let: perhaps use morally-equal? in (equal? fv X)")
  (lint-test "(let ((fv (float-vector 1.0 2.0)) (iv (int-vector 1 2))) (equal? fv iv))" 
	     " let: perhaps (let ((fv (float-vector 1.0 2.0)) (iv (int-vector 1 2))) (equal? fv iv)) -> (equal? (float-vector 1.0 2.0) (int-vector 1 2))
               let: perhaps use morally-equal? in (equal? fv iv)")
  (lint-test "(begin (let loop ((x y)) (if (null? x) 1 (loop (cdr x)))) x)" 
	     " begin: this could be omitted: (let loop ((x y)) (if (null? x) 1 (loop (cdr x))))
               loop: perhaps (let loop ((x y)) (if (null? x) 1 (loop (cdr x)))) -> (do ((x y (cdr x))) ((null? x) 1))")
  (lint-test "(begin (do ((x y (cdr x))) ((null? x) 1)) x)" 
	     " begin: this could be omitted: (do ((x y (cdr x))) ((null? x) 1))
               begin: this do-loop could be replaced by 1: (do ((x y (cdr x))) ((null? x) 1))")
  (lint-test "(begin (do ((x y (cdr x)) (i 0 ( i 1)) (j 1 (+ j i))) ((null? x) 1)) j)"  
	     " begin: (do ((x y (cdr x)) (i 0 (i 1)) (j 1 (+ j i))) ((null? x) 1)): result 1 is not used
               begin: perhaps (do ((x y (cdr x)) (i 0 (i 1)) (j 1 (+ j i))) ((null? x) 1)) ->
                 (do ((x y (cdr x)) (i 0 (i 1)) (j 1)) ((null? x) 1) (set! j (+ j i)))
               begin: j set, but not used: 1 from do")
  (lint-test "(begin (define (f300 x) (if (null? x) 0 (f300 (cdr x)))) (display x) (f300 '(1)) x)" 
	     " f300: perhaps (define (f300 x) (if (null? x) 0 (f300 (cdr x)))) -> (define (f300 x) (do ((x x (cdr x))) ((null? x) 0)))
               begin: this could be omitted: (f300 '(1))")
  (lint-test "(let ((is-running? (f x))) (g is-running? 0))" 
	     " let: perhaps (let ((is-running? (f x))) (g is-running? 0)) -> (g (f x) 0)
               let: 'is-running? is redundant: perhaps use 'running?")

  (lint-test "(begin (for-each f (list x y)) (values))" " begin: (values) is redundant; for-each returns #<unspecified>")
  (lint-test "(begin (map f x) #t)" 
	     " begin: map could be for-each: (for-each f x)
               begin: #t is probably redundant; map can't return #f")
  (lint-test "(begin (set! y (map f x)) #t)"  " begin: #t is probably redundant; map can't return #f")

  (lint-test "(cond (A =>) (else B))"          " cond: cond => target is messed up: (A =>)")
  (lint-test "(case x ((A) =>) (else B))"      " case: perhaps (case x ((A) =>) (else B)) -> (if (eq? x 'A) => B) case: case => target is messed up: ((A) =>)")
  (lint-test "(do ((i 0 (+ i 1))) (i =>))"     
	     " do: do-result => target is messed up: (i =>)
	       do: do is a no-op because i is true at the start: (do ((i 0 (+ i 1))) (i =>))")
  (lint-test "(cond (A => . B) (else B))"      " cond: cond => target is messed up: (A => . B)")
  (lint-test "(case x ((A) => . B) (else B))"  " case: case => target is messed up: ((A) => . B)")
  (lint-test "(do ((i 0 (+ i 1))) (i => . B))" " do: do is messed up: (do ((i 0 (+ i 1))) (i => . B))")

  (when (provided? 'snd)
    (lint-test "(begin (cond ((find-sound \"test.snd\") => close-sound)) (display x))" "")
    (lint-test "(if (real? (oscil x)) 1.0 0.0)" " if: perhaps (real? (oscil x)) -> #t  if: perhaps (if (real? (oscil x)) 1.0 0.0) -> 1.0")
    (lint-test "(if (pair? (oscil x)) 1.0 0.0)" " if: perhaps (pair? (oscil x)) -> #f  if: perhaps (if (pair? (oscil x)) 1.0 0.0) -> 0.0")
    (lint-test "(if (float? (oscil x)) 1.0 0.0)" " if: perhaps (float? (oscil x)) -> #t if: perhaps (if (float? (oscil x)) 1.0 0.0) -> 1.0")
    (lint-test "(radians->hz 3.4+i)" " radians->hz: in (radians->hz 3.4+1i), radians->hz's argument should be real, but 3.4+1i is complex?")
    (lint-test "(string-ref (radians->hz x) 3)" 
	       " string-ref: in (string-ref (radians->hz x) 3), string-ref's argument 1 should be a string, but (radians->hz x) is a float?")
    (lint-test "(set! (print-length) \"asd\")" " set!: print-length: new value should be an integer?: string?: (set! (print-length) \"asd\")")
    (lint-test "(set! (print-length) 9)" "")
    (lint-test "(set! (show-indices) 32)" " set!: show-indices: new value should be a boolean?: integer?: (set! (show-indices) 32)")
    (lint-test "(set! (show-indices) #t)" "")
    (lint-test "(mus-header-type-name 121)" " mus-header-type-name: mus-header-type-name's argument, 121, should be an integer between 1 and 70")
    (lint-test "(mus-header-type-name 2)" "")
    (lint-test "(mus-header-type-name 3.5)" " mus-header-type-name: in (mus-header-type-name 3.5), mus-header-type-name's argument should be an integer, but 3.5 is a float?")
    (lint-test "(mus-header-type-name mus-aiff)" "")

    (when (provided? 'snd-gtk)
      (lint-test "(gtk_scale_set_value_pos (GTK_SCALE scale) GTK_POS_TOP)" "")
      (lint-test "(gtk_scale_set_value_pos (GTK_SCALE scale) GDK_RELEASE_MASK)" 
		 " gtk_scale_set_value_pos: gtk_scale_set_value_pos's argument, GDK_RELEASE_MASK, should be between 0 and 3")
      (lint-test "(gtk_scale_set_value_pos (GTK_SCALE scale) 1)" 
		 " gtk_scale_set_value_pos: gtk_scale_set_value_pos's argument, 1, should be GTK_POS_RIGHT")
      (lint-test "(gtk_scale_set_value_pos (GTK_SCALE scale) 10)" 
		 " gtk_scale_set_value_pos: gtk_scale_set_value_pos's argument, 10, should be between 0 and 3")
      (lint-test "(gtk_scale_set_value_pos (GTK_SCALE scale) x)" "")
      (lint-test "(gtk_scale_set_value_pos (GTK_SCALE scale) 1/2)" 
		 " gtk_scale_set_value_pos: in (gtk_scale_set_value_pos (GTK_SCALE scale) 1/2), 
                   gtk_scale_set_value_pos's argument 2 should be an integer, but 1/2 is rational?")))

  ;; lint regression tests
  (lint-test "(define (func x) (if (*  (call/cc (lambda (go) (go 9) 0))  '((1 (2)) (((3) 4)))  1(/  )) (iterator-sequence 1-)))" 
	     " func: if test is never false: (if (* (call/cc (lambda (go) (go 9) 0)) '((1 (2)) (((3) 4))) 1 (/))...
               func: in (* (call/cc (lambda (go) (go 9) 0)) '((1 (2)) (((3) 4))) 1 (/)), *'s argument 2 should be a number, but '((1 (2)) (((3) 4))) is a list?
               func: perhaps (* (call/cc (lambda (go) (go 9) 0)) '((1 (2)) (((3) 4))) 1 (/)) -> (* (call/cc (lambda (go) (go 9) 0)) '((1 (2)) (((3) 4))) (/))
               func: perhaps call/cc could be call-with-exit: (call/cc (lambda (go) (go 9) 0))
               func: (go 9) makes this pointless: 0
               func: / needs at least 1 argument: (/)")
  (lint-test "(define (func x) (if (string-position -) (begin . 0) (hash-table* //(round))))" 
	     " func: string-position needs at least 2 arguments: (string-position -)
               func: in (string-position -), string-position's argument should be a string, but - is a procedure?
               func: stray dot in begin? (begin . 0)
               func: round needs 1 argument: (round)")
  (lint-test "(define (func x) (if (string->symbol) (cond . 3/4)))" 
	     " func: if test is never false: (if (string->symbol) (cond . 3/4))
               func: string->symbol needs 1 argument: (string->symbol)
               func: cond is messed up: (cond . 3/4)")
  (lint-test "(define (func x) (if (expt 2) (cond 0 1/1.2 when . and)))" 
	     " func: if test is never false: (if (expt 2) (cond 0 1/1.2 when . and))
               func: expt needs 2 arguments: (expt 2)
               func: cond is messed up: (cond 0 1/1.2 when . and)")
  (lint-test "(define (func x) (if (imag-part (define-macro  `(((+ x 1))) '((x . 1) . 2) 1.2.3)) (cond (list 1 2) `(1) . =>)))" 
	     " func: if test is never false: (if (imag-part (define-macro '(((+ x 1))) '((x . 1) . 2) 1.2.3)) (cond...
               func: either a stray quote, or a really bad idea: (define-macro '(((+ x 1))) '((x . 1) . 2) 1.2.3)
               quote: strange parameter for define-macro: (((+ x 1)))
               quote: this could be omitted: '((x . 1) . 2)
               func: cond is messed up: (cond (list 1 2) '(1) . =>)")
  (unless pure-s7
    (lint-test "(define (func x) (if (inexact->exact /i-) (defined? +--) (cond . else)))" 
	       " func: if test is never false: (if (inexact->exact /i-) (defined? +--) (cond . else))
               func: cond is messed up: (cond . else)"))
  (lint-test "(define (func x) (if (let-set! /+0) (begin .(cdddar . and)) (port-line-number 2(exp 1))))" 
	     " func: let-set! needs 3 arguments: (let-set! /+0)
               func: stray dot in begin? (begin cdddar . and)
               func: in (port-line-number 2 (exp 1)), port-line-number's argument 1 should be an input-port, but 2 is an integer?")
  (lint-test "(define (func x) (if (char<? (vector (defined?))) (define-constant +(random-state->list -)) (hash-table? (define-macro* + (list ()) `(x 1) :hi 1+0/0i))))"
	     " func: char<? needs at least 2 arguments: (char<? (vector (defined?)))
               func: in (char<? (vector (defined?))), char<?'s argument should be a char, but (vector (defined?)) is a vector?
               func: defined? needs at least 1 argument: (defined?)
               +: in (random-state->list -), random-state->list's argument should be a random-state, but - is a procedure?
               func: + in (define-macro* + (list ()) '(x 1) :hi 1nani) is already a constant, defined: (random-state->list -)
               func: (define-macro* + (list ()) '(x 1) :hi 1nani) is messed up
               func: + not used, initially: (random-state->list -) from define-constant")
  (lint-test "(define (func x) (if (arity (apply +)) (caaadr /) (begin .. when `((x . 1)) . 0/0+0/0i)))" 
	     " func: perhaps (apply +) -> (+)
               func: in (caaadr /), caaadr's argument should be a pair, but / is a procedure?
               func: stray dot in begin? (begin .. when (list-values (append (list-values 'x) 1)) . nannani)")
  (lint-test "(define (func x) (if (even? (asinh .0)) (when (real?))))" 
	     " func: perhaps (if (even? (asinh 0.0)) (when (real?))) -> (when (and (even? (asinh 0.0)) (real?)))
               func: in (even? (asinh 0.0)), even?'s argument should be an integer, but (asinh 0.0) is a number?
               func: perhaps (asinh 0.0) -> 0.0
               func: when is messed up: (when (real?))")
  (lint-test "(define (func x) (if (boolean?) (unless /)))" 
	     " func: perhaps (if (boolean?) (unless /)) -> (when (and (boolean?) (not /)))
               func: boolean? needs 1 argument: (boolean?)
               func: unless is messed up: (unless /)")
  (lint-test "(define (func x) (cond ((output-port? i) (char-numeric? /i(denominator))) (else (if +/ 1 . #f))))" 
	     " func: char-numeric? has too many arguments: (char-numeric? /i (denominator))
               func: denominator needs 1 argument: (denominator)
               func: if has too few clauses: (if +/ 1 . #f)")
  (lint-test "(define (func x) (do . unless))"  " func: do is messed up: (do . unless)")
  (lint-test "(define (func x) (lambda* (lambda args args) . -1))"  " func: lambda* is messed up in (lambda* (lambda args args) . -1)")
  (lint-test "(define (func x) (if (or . set!) (sublet 2)))" 
	     " func: unexpected dot: (or . set!)
               func: in (sublet 2), sublet's argument should be a let or null, but 2 is an integer?")
  (lint-test "(define (func x) (if (or . 1+0/0i) (caaddr (caaadr /)))) (define (hi) (func (make-hook '(0 0 #f))))" 
	     " func: unexpected dot: (or . 1nani)
               func: in (caaadr /), caaadr's argument should be a pair, but / is a procedure?
               hi: func's parameter 1 is not used, but a value is passed: (make-hook '(0 0 #f))")
  (lint-test "(define (func x) (case x ((else) (char>? 11/(symbol-setter))) ((-1) (load - -1 3/4)) (else (positive? (format 0(inlet (make-list)))))))" 
	     " func: in (char>? 11/ (symbol-setter)),
	       char>?'s argument 2 should be a char, but (symbol-setter) is a boolean or a procedure?
               func: symbol-setter needs at least 1 argument: (symbol-setter)
               func: load has too many arguments: (load - -1 3/4)
               func: in (load - -1 3/4), load's argument 1 should be a string, but - is a procedure?
               func: in (load - -1 3/4), load's argument 2 should be a let, but -1 is an integer?
               func: perhaps (- -1 3/4) -> -7/4
               func: in (positive? (format 0 (inlet (make-list)))),
                 positive?'s argument should be real, but (format 0 (inlet (make-list))) is a string or a boolean?
               func: make-list needs at least 1 argument: (make-list)")
  (lint-test "(zero? (system str))" "")
  (lint-test "(define (func x) (if (- 2(+)) (lambda 1.)))" 
	     " func: if test is never false: (if (- 2 (+)) (lambda 1.0))
               func: perhaps (- 2 (+)) -> 2
               func: lambda is messed up in (lambda 1.0)")
  (lint-test "(define (func x) (when 0 1+0/0i `((+ x 1)) => . with-let))" " func: when is messed up: (when 0 1nani '((+ x 1)) => . with-let)")
  (unless pure-s7
    (lint-test "(define (func x) (if (string-ci>=?) (dilambda? (char-numeric? 20+)) (* 1 enver quasiquote 0+0/0i /0/01(/))))" 
	       " func: string-ci>=? needs at least 2 arguments: (string-ci>=?)
               func: (dilambda? (char-numeric? 20+)) is always #f
               func: perhaps (* 1 enver quasiquote 0nani /0/01 (/)) -> (* enver quasiquote 0nani /0/01 (/))
               func: / needs at least 1 argument: (/)"))
  (lint-test "(define (func x) (if (continuation?) (when (continuation? 0-2))))" 
	     " func: perhaps (if (continuation?) (when (continuation? 0-2))) -> (when (and (continuation?) (continuation? 0-2)))
               func: continuation? needs 1 argument: (continuation?)
               func: when is messed up: (when (continuation? 0-2))")
  (lint-test "(define (func x) (if (close-input-port) (caaddr /) (with-input-from-file 0(let (make-dilambda (lambda () 1) (lambda (a) a)) (set! i01+)))))" 
	     " func: if test is never false: (if (close-input-port) (caaddr /) (with-input-from-file 0 (let...
               func: close-input-port needs 1 argument: (close-input-port)
               func: in (caaddr /), caaddr's argument should be a pair, but / is a procedure?
               func: in (with-input-from-file 0 (let (make-dilambda (lambda () 1) (lambda (a) a))...,
                   with-input-from-file's argument 1 should be a string, but 0 is an integer?
               func: let is messed up: (let (make-dilambda (lambda () 1) (lambda (a) a)) (set! i01+))")
  (lint-test "(define (func x) (cond ((byte-vector-ref) (iterator? 12.)) (else (unless .+2 '((x 1) y . 2) 1 - or case quote . __asdf__))))" 
	     " func: cond test (byte-vector-ref) is never false: (cond ((byte-vector-ref) (iterator? 12.0)) (else (unless .+2 '((x 1) y ....
               func: byte-vector-ref needs 2 arguments: (byte-vector-ref)
               func: unless is messed up: (unless .+2 '((x 1) y . 2) 1 - or case quote . __asdf__)")
  (lint-test "(define (func x) (lambda* .(lcm . do)))" " func: lambda* is messed up in (lambda* lcm . do)")
  (lint-test "(define (func x) (let . `(((x 1))) ))" 
	     " func: let variable is not a symbol? ((x 1))
               func: let variable named quote is asking for trouble
               func: quote not used, value: (let quote (((x 1))))")
  (lint-test "(define (func x) (do . 1))" " func: do is messed up: (do . 1)")
  (lint-test "(define (func x) (unless 1 (let ((x 3)) (lambda (y) (+ x y))) let* `(+ x 1) . \"\"))" 
	     " func: unless is messed up: (unless 1 (let ((x 3)) (lambda (y) (+ x y))) let* '(+ x 1) . \"\")")
  (lint-test "(define (func x) (when `((x)) when '((())) and . case))" " func: when is messed up: (when '((x)) when '((())) and . case)")
  (lint-test "(define (func x) (do . 0)) (define (hi) (func (define-macro (_m1_ a) `(+ ,a 1)))) (hi)" 
	     " func: do is messed up: (do . 0)
               hi: func's parameter 1 is not used, but a value is passed: (define-macro (_m1_ a) (list-values '+ a 1))
               hi: perhaps (define-macro (_m1_ a) (list-values '+ a 1)) -> (define (_m1_ a) (+ a 1))")
  (lint-test "(define (func x) (unless .(atan . __asdf__)))" " func: unless is messed up: (unless atan . __asdf__)")
  (lint-test "(define (func x) (floor (* +.(inexact->exact))))" " func: inexact->exact needs 1 argument: (inexact->exact)")
  (lint-test "(define (func x) (if (proper-list? ) (and / when '((())) () begin) (call-with-input-string (stacktrace +0 -1 1 20100))))"
	     " func: proper-list? needs 1 argument: (proper-list?)
               func: call-with-input-string needs 2 arguments: (call-with-input-string (stacktrace 0 -1 1 20100))")
  (lint-test "(define (func x) (if (ceiling (denominator)) (with-let .0+) (cdaadr (floor (random 0/0+0i inf.0)))))" 
	     " func: if test is never false: (if (ceiling (denominator)) (with-let .0+) (cdaadr (floor (random nan.0...
               func: denominator needs 1 argument: (denominator)
               func: with-let is messed up: (with-let .0+)
               func: in (cdaadr (floor (random nan.0 inf.0))), cdaadr's argument should be a pair, but (floor (random nan.0 inf.0)) is an integer?
               func: in (random nan.0 inf.0), random's argument 2 should be a random-state, but inf.0 is a float?")
  (lint-test "(define (func x) (if (begin 2(caaar 2)) (make-list (unless +)) (char-upper-case? 0i2 0+1/0i 
                 `(((x 1))) (cons 1 2) (string (or / (let ((x 3)) (lambda (y) (+ x y))) . =>)))))" 
	     " func: this could be omitted: 2
               func: in (caaar 2), caaar's argument should be a pair, but 2 is an integer?
               func: unless is messed up: (unless +)
               func: char-upper-case? has too many arguments: (char-upper-case? 0i2 0nani '(((x 1))) (cons 1 2) (string (or / (let ((x...
               func: missing quote? (or / (let ((x 3)) (lambda (y) (+ x y))) . =>) in (string (or / (let ((x 3)) (lambda (y) (+ x y))) . =>))
               func: unexpected dot: (or / (let ((x 3)) (lambda (y) (+ x y))) . =>)")
  (lint-test "(define (func x) (if (lambda*  +i  . begin  ) (symbol->value i-/)))" " func: lambda* is messed up in (lambda* +i . begin)")
  (lint-test "(define (func x) (let . '((()))  ))"
	     " func: let variable is not a symbol? (())
               func: let variable named quote is asking for trouble
               func: quote not used, value: (let quote ((())))")
  (lint-test "(define (func x) (if (defined? +) (when (string=?  +))))" 
	     " func: perhaps (if (defined? +) (when (string=? +))) -> (when (and (defined? +) (string=? +)))
               func: in (defined? +), defined?'s argument should be a symbol, but + is a procedure?
               func: when is messed up: (when (string=? +))")
  (unless pure-s7
    (lint-test "(define (func x) (if (asinh /(inexact?  1)) (cos (string-ci>? 1)) (int-vector 1(set! .--(cond .(char-alphabetic? .+))))))"
	     " func: if test is never false: (if (asinh / (inexact? 1)) (cos (string-ci>? 1)) (int-vector 1 (set! .--...
               func: asinh has too many arguments: (asinh / (inexact? 1))
               func: in (asinh / (inexact? 1)), asinh's argument 1 should be a number, but / is a procedure?
               func: in (cos (string-ci>? 1)), cos's argument should be a number, but (string-ci>? 1) is a boolean?
               func: string-ci>? needs at least 2 arguments: (string-ci>? 1)
               func: in (string-ci>? 1), string-ci>?'s argument should be a string, but 1 is an integer?
               func: cond is messed up: (cond char-alphabetic? .+)"))
  (lint-test "(define (func x) (if (help 11) (make-iterator (letrec* 2)) (byte-vector (case -(dilambda i let +i (list (list 1)) let . cons  )))))" 
	     " func: perhaps (help 11) -> #f
               func: perhaps (if (help 11) (make-iterator (letrec* 2)) (byte-vector (case - (dilambda i... ->
               (byte-vector (case - (dilambda i let +i (list (list 1)) let . cons)))
               func: in (make-iterator (letrec* 2)), make-iterator's argument should be a sequence, but 2 is an integer?
               func: letrec* is messed up: (letrec* 2)
               func: bad case key dilambda in (dilambda i let +i (list (list 1)) let . cons)
               func: stray dot? (i let +i (list (list 1)) let . cons)")
  (lint-test "(cddr (cddar :hi))" 
	     " cddr: :hi can't be a pair
               cddr: in (cddar :hi), cddar's argument should be a pair, but :hi is a keyword?")

  ;; this tickles an infinite recursion bug that is still in lint, but hacked around for now
  (lint-test "(let* ((seed 0) 
                     (hashfn (lambda (obj)
                               (cond  ((string? obj) (let ((sl (string-length obj))) (+ (if (> sl 0) (hashfn obj) seed) (if (> sl 1) (hashfn obj) seed))))
                                      ((else #f))))))
               (modulo (hashfn obj) size))" 
	     " let*: perhaps restrict seed which is not used in the let* body 
                 (let* ((seed 0) (hashfn (lambda (obj) (cond ((string? obj) (let ((sl... ->
                  (let ((hashfn (let ((seed 0))
                      (lambda (obj)
                        (cond ((string? obj)
                                 (let ((sl (string-length obj)))
                                   (+ (if (> sl 0) (hashfn obj) seed) (if (> sl 1) (hashfn obj) seed))))
                              ((else #f))))))) ...)")

  (let ()
    (define (glint str1)
      (let ((result (call-with-output-string 
		     (lambda (op) 
		       (call-with-input-string str1
			 (lambda (ip) 
			   (lint ip op)))))))
	(if (string=? result "")
	    (format *stderr* ";(glint ~S) -> ~S~%" str1 result))))
    (glint "(define (func x) (if (string-position -) (begin . 0) (hash-table* //(round))))")
    (glint "(define (func x) (if (* (call/cc (lambda (go) (go 9) 0)) '((1 (2)) (((3) 4))) 1(/)) (iterator-sequence 1-)))")
    (glint "(define (func x) (if (string->symbol) (cond . 3/4)))")
    (glint "(define (func x) (if (expt 2) (cond 0 1/1.2 when . and)))")
    (glint "(define (func x) (if (imag-part (define-macro `(((+ x 1))) '((x . 1) . 2) 1.2.3)) (cond (list 1 2) `(1) . =>)))")
    (glint "(define (func x) (if (inexact->exact /i-) (defined? +--) (cond . else)))")
    (glint "(define (func x) (if (let-set! /+0) (begin .(cdddar . and)) (port-line-number 2(exp 1))))")
    (glint "(define (func x) (if (char<? (vector (defined?))) (define-constant +(random-state->list -)) (hash-table? (define-macro* + (list ()) `(x 1) :hi 1+0/0i))))")
    (glint "(define (func x) (if (arity (apply +)) (caaadr /) (begin .. when `((x . 1)) . 0/0+0/0i)))")
    (glint "(define (func x) (if (even? (asinh .0)) (when (real?))))")
    (glint "(define (func x) (if (boolean?) (unless /)))")
    (glint "(define (func x) (cond ((output-port? i) (char-numeric? /i(denominator))) (else (if +/ 1 . #f))))")
    (glint "(define (func x) (do . unless))")
    (glint "(define (func x) (lambda* (lambda args args) . -1))")
    (glint "(define (func x) (if (or . set!) (sublet 2)))")
    (glint "(define (func x) (if (or . 1+0/0i) (caaddr (caaadr /)))) (define (hi) (func (make-hook '(0 0 #f))))")
    (glint "(define (func x) (case x ((else) (char>? 11/(symbol-setter))) ((-1) (load - -1 3/4)) (else (positive? (format 0(inlet (make-list)))))))")
    (glint "(define (func x) (if (- 2(+)) (lambda 1.)))")
    (glint "(define (func x) (when 0 1+0/0i `((+ x 1)) => . with-let))")
    (glint "(define (func x) (if (string-ci>=?) (dilambda? (char-numeric? 20+)) (* 1 enver quasiquote 0+0/0i /0/01(/))))")
    (glint "(define (func x) (if (continuation?) (when (continuation? 0-2))))")
    (glint "(define (func x) (if (close-input-port) (caaddr /) (with-input-from-file 0(let (make-dilambda (lambda () 1) (lambda (a) a)) (set! i01+)))))")
    (glint "(define (func x) (cond ((byte-vector-ref) (iterator? 12.)) (else (unless .+2 '((x 1) y . 2) 1 - or case quote . __asdf__))))")
    (glint "(define (func x) (lambda* .(lcm . do)))")
    (glint "(define (func x) (let . `(((x 1)))))")
    (glint "(define (func x) (do . 1))")
    (glint "(define (func x) (unless 1 (let ((x 3)) (lambda (y) (+ x y))) let* `(+ x 1) . \"\"))")
    (glint "(define (func x) (when `((x)) when '((())) and . case))")
    (glint "(define (func x) (do . 0)) (define (hi) (func (define-macro (_m1_ a) `(+ ,a 1)))) (hi)")
    (glint "(define (func x) (unless .(atan . __asdf__)))")
    (glint "(define (func x) (floor (* +.(inexact->exact))))")
    (glint "(define (func x) (if (proper-list?) (and / when '((())) () begin) (call-with-input-string (stacktrace +0 -1 1 20100))))")
    (glint "(define (func x) (if (ceiling (denominator)) (with-let .0+) (cdaadr (floor (random 0/0+0i inf.0)))))")
    (glint "(define (func x) (if (begin 2(caaar 2)) (make-list (unless +))
        (char-upper-case? 0i2 0+1/0i `(((x 1))) (cons 1 2) (string (or / (let ((x 3)) (lambda (y) (+ x y))) . =>)))))")
    (glint "(define (func x) (if (lambda* +i . begin) (symbol->value i-/)))")
    (glint "(define (func x) (let . '((()))))")
    (glint "(define (func x) (if (defined? +) (when (string=? +))))")
    (glint "(define (func x) (if (asinh /(inexact? 1)) (cos (string-ci>? 1)) (int-vector 1(set! .--(cond .(char-alphabetic? .+))))))")
    (glint "(define (func x) (if (help 11) (make-iterator (letrec* 2)) (byte-vector (case -(dilambda i let +i (list (list 1)) let . cons)))))")
    (glint "(define (func x) (cond ((log) (*s7* (quote))) (else (string-ci>? 01(* (numerator (memq 1i(proper-list? (cdr 1)))))))))")
    (glint "(define (func x) (define* pi))")
    (glint "(define (func x) (if (char=? 2) (string->number (string>=? 21 1/1.2 -1)) (hash-table? /+(assoc 2i(list . or)))))")
    (glint "(define (func x) (if (random-state->list (list (list 1)) set! do (list (list 1 2)))
        (define-macro +(defmacro* 21)) (substring 1+02(getenv 0(write () . defmacro*)))))")
    (glint "(define (func x) (if (char-downcase) (float-vector-set! (setter))
        (signature -(do `((1)) (string #\\a #\\null #\\b) i+ \"hi\" (do define-bacro* -(length))))))")
    (glint "(define (func x) (if (apply -+) (floor ii.) (eval (string->symbol \"\" 1.2.3 i))))")
    (glint "(define (func x) (if (string>=? 0i) (number->string 2(real? 1)) (/ +2(logand))))")
    (glint "(define (func x) (case x ((define-macro) (list? 01)) ((`((+ x 1))) (/ 2 -1)) (else (char-downcase +00+(eval)))))")
    (glint "(define (func x) (cond ((byte-vector-set! 1) (multiple-value-bind -0 (values) 2)) (else (car 1+ `(x) '((x 1) (y) . 2) nan.0))))")
    (glint "(define (func x) (case x ((define*) (current-input-port .1+)) (((values #\\c 3 1.2))
         (symbol .2/)) (else (documentation 2-2i(char=? (+ (reverse (list-tail (reverse /)))))))))")
    (glint "(define (func x) (if (values i-(caaaar)) (cdaddr ++) (assv +(list (quote 2)))))")
    (glint "(define (func x) (/ 0(/ 0 (let-temporarily))))")
    (glint "(define (func x) (cond ((when 1/1.2 #2d((1 2) (3 4)) /1) (openlet (caadar 0))) (else (let*-values (string-ci=? 0-(min //))))))")
    (glint "(define (func x) (cond ((let* 'hi (let)) (make-rectangular +)) (else (cutlet 002 define-bacro #<unspecified> i(list-ref '((x 1) 2) macroexpand #t)))))")
    (glint "(if x (int-vector-set! z 0 1) (begin .1 (let ((x 3)) (lambda (y) (+ x y))) . #t))")
    (glint "(define (func x) (if (real?) (string-ci<=? 0 1/0+i 1.5 '(1 2 . 3) '(- 1) '((x 1) (y) . 2) (values #\\c 3 1.2) 0) (string-ci>=? . macroexpand)))")
    (glint "(define (func x) (if (call-with-input-file (string #\\a #\\null #\\b) '((x 1 . 2) . 3) -1 (>= /)) (let . inf.0) (let ..(let? 0(cddr (procedure?))))))")
    (glint "(define (func x) (if (caadar 2) (make-list i)))")
    (glint "(define (func x) (cond ((for-each `(x) `(((+ x 1))) 3/4 2) (cddadr 02)) (else (let / :hi (lambda args args) define-bacro))))")
    (glint "(define (func x) (if (cyclic-sequences .i/) (string-set! i) (proper-list? -
        (getenv 0 nan.0 (values) '((1 (2)) (((3) 4))) 'hi (symbol->keyword (cond . '((x 1) y . 2)))))))")
    (glint "(define (func x) (case x ((#t) (dynamic-wind -1-)) (((values \"hi\")) (input-port? +/)) (else (or +i (memq define-macro '((x 1) y . 2))))))")
    (glint "(define (func x) (if (and -(not)) (input-port? .i abs inf.0 define-macro*) (quote 0///i.)))")
    (glint "(define (func x) (let* '((x 1) (y) . 2) (let* 0)))")
    (glint "(define (func x) (char-ci>? (inexact->exact (/ 1 3/4))))")
    (glint "(define (func x) (cond ((number?) (1- #t lambda* '(- 1) let* i(let-values))) (else (cdaaar -(char? (append `((x)) `((set! x (+ x 1)) (* x 2)) (cons)))))))")
    (glint "(define (func x) (if (cons / `(x 1) '((()))) (get-output-string -(file-exists? -i)) (case 1(int-vector-set! (not 1)))))")
    (glint "(define (func x) (if (char-ci<? 0) (gensym (substring /.)) (reverse (cons /-00(reverse!)))))")
    (glint "(define (func x) (case x ((quasiquote) (caddr `(x 1) /)) (((vector 1 '(3))) (string-copy (ash 2(unless))))
         (else (length /(with-output-to-string (lambda ()))))))")
    (glint "(define (func x) (if (case . '(1 2 . 3)) (system (sequence?'string->byte-vector 0/0+0i let 
        (values #\\c 3 1.2) (make-dilambda (lambda () 1) (lambda (a) a)) (sublet /))) (hook-functions 20120i 0+0/0i)))")
    (glint "(define (func x) (if (string-copy (ash 2(unless))) (caddr `(x 1) /) (length /(with-output-to-string (lambda ())))))")
    (glint "(define (func x) (if (vector-append 210) (port-closed? / (define-macro (_m1_ a) `(+ ,a 1)) .-) (define-constant .-(gensym . 1+1/0i))))")
    (glint "(define (func x) (if (number? +) (when (= ..)))) ")
    (glint "(define (func x) (cond ((tan) (denominator -+0 begin `((x . 1)))) (else (let `((set! x (+ x 1)) (* x 2)) (let ii. (list 1) '(- 1) \"hi\" or -)))))")
    (glint " (define (func x) (if (boolean? i(let)) (when (eq? ++.))))")
    (glint "(define (func x) (if (immutable?) (complex do 0+0/0i (cons 1 2) /2.) (not (immutable?))))")
    (glint "(define (func x) (case x (('(- 1)) (string-position 2)) ((#<eof>) (caar 0
        (iterator-sequence))) (else (do '((1 (2)) (((3) 4))) (call/cc (lambda (go) (go 9) 0)) (let (system  `(1) 0/0+0i 1+1/0i '((x 1) (y . 2)) 0))))))")
    (glint "(define (func x) (if (not) (not) (car '((x 1) . 2) '((x 1) 2) `(x 1) (char-numeric? +2))))")
    (glint "(define (func x) (if (zero?) (zero?) (zero? (floor -+2+))))")
    (glint "(define (func x) (if (not) (not) (not i/))) (define (hi) (func 1/0+i))")
    (glint "(define (func x) (if (not) (not) (or .(or -+/ 1/1.2 '((x 1) (y . 2)) `((set! x (+ x 1)) (* x 2)) let* (define-macro (_m1_ a) `(+ ,a 1)) unless))))")
    (glint "(define (func x) (if (string? 1i0) (string? 1i0) (and . else)))")
    (glint "(define (func x) (case x (((values 1 2)) (sort! (string-set! .2))) 
        (((call/cc (lambda (go) (go 9) 0))) (sort! (string-set! .2))) (else (sort! /- 3/4 :hi '(()) if . 1+0/0i))))")
    (glint "(let () (define (func x) (if (integer? 1 '((x 1) (y . 2))) (integer? 1 '((x 1) (y . 2))) (= 1))))")
    (glint "(define (func x) (if (number? +) (number? +) (nan? . ())))")
    (glint "(define (func x) (if (boolean? .(varlet)) (boolean? .(varlet)) (if . and)))")
    (glint "(define (func x) (if (complex? i-) (complex? i-) (or (positive?))))")
    (glint "(define (func x) (if (case 0/0+i (values) 1+1/0i (integer-decode-float)) (case 0/0+i (values) 1+1/0i (integer-decode-float))))")
    (glint "(define (func x) (catch case 1 1.0+1.0i (values) 0/0+i (hash-table)))")
    (glint "(define (func x) (if (string? +.) (string? +.) (string=? +.)))")
    (glint "(define (func x) (if (real? -) (real? -) (= -)))")
    (glint "(define (func x) (if (memq) (memq) (round 0+0/0i (set! _x1_ 3) (list (list 1)) (make-hook '(0 0 #f)) 2 
         else 0(int-vector 2 letrec - quasiquote (set! _x1_ 3) quote #<eof>))))")
    (glint "(define (func x) (if (char-ci=? 1 0) (char-ci=? 1 0) (case 0(immutable? '((x 1) 2) -1 1.0+1.0i macroexpand i(logbit? (output-port? (char-whitespace? .2)))))))")
    (glint "(define (func x) (if (sqrt 0.1) (sqrt 0.1) (with-baffle + (define _h1_ 3) (let))))")
    (glint "(define (func x) (case x (((values)) (sqrt 0.1)) ((`((x 1))) (sqrt 0.1)) (else (with-baffle + (define _h1_ 3) (let)))))")
    (glint "(define (func x) (if (copy 0+) (copy 0+) (length (values #\\c 3 1.2) (set! _x1_ 3) if ++i
         (gensym? and (set! _x1_ 3) (integer->char 255) let* 0(integer? i.))))) ")
    (glint "(define (func x) (if (char->integer 1.) (char->integer 1.) (reverse 0 \"hi\" 0+0/0i (set! _x1_ 3)
         (integer->char 255) 1+0/0i '(- 1) => (let* 1 nan.0 (set! _x1_ 3) `(x) 0(peek-char 2))))) ")
    (glint "(define (func x) (if (list-tail (morally-equal?)) (list-tail (morally-equal?)) (lcm 20 (set! _x1_ 3) (integer-length (set! _x1_ 3) let* begin ii))))")
    (glint "(define (func x) (case x ((`(+ x 1)) (list-tail (morally-equal?))) (('((x 1) . 2))
         (list-tail (morally-equal?))) (else (lcm 20 (set! _x1_ 3) (integer-length (set! _x1_ 3) let* begin ii)))))")
    (glint "(define (func x) (if (letrec - '((x 1) y . 2) '((x 1) . 2) #<eof> (define _h1_ 3) (do)) (letrec - '((x 1) y . 2) '((x 1) . 2) #<eof> (define _h1_ 3) (do))))")
    (glint "(define (func x) (case x (((values \"hi\")) (letrec - '((x 1) y . 2) '((x 1) . 2) #<eof>
         (define _h1_ 3) (do))) ((`(x . 1)) (letrec - '((x 1) y . 2) '((x 1) . 2) #<eof> (define _h1_ 3) (do))) (else (keyword? ./(char-position .(varlet 2-..))))))")
    (glint "(define (func x) (if (vector-set! 1+(string->list)) (vector-set! 1+(string->list))
         (make-string (set! _x1_ 3) (floor i0/ let* 0/0+i -1 (set! _x1_ 3) `(x 1)))))")
    (glint "(define (func x) (case x ((#f) (vector-set! 1+(string->list))) (('((x 1 . 2) . 3))
        (vector-set! 1+(string->list))) (else (make-string (set! _x1_ 3) (floor i0/ let* 0/0+i -1 (set! _x1_ 3) `(x 1))))))")
    (glint "(define (func x) (if (char-ci=? 0(provided?)) (char-ci=? 0(provided?)) (if else)))")
    (glint "(define (func x) (let* `(x 1) (do (list (list 1 2)) quote 0/0+i (define _h1_ 3))))")
    (glint "(define (func x) (if (list->vector (list-tail (vector->list 0))) (list->vector (list-tail (vector->list 0)))))")
    (glint "(define (func x) (case x ((''2) (list->vector (list-tail (vector->list 0)))) ((`((+ x 1))) (list->vector (list-tail (vector->list 0)))) (else (/ /1-+))))")
    (glint "(define (func x) (if (not -) (not -) (and (and))))")
    (glint "(define (func x) (reverse (cdr (reverse))))")
    (glint "(define (func x) (if (cdr) (cdr) (format +i0/(outlet (do `(x) (string (integer->char 255)) -1 (define _h1_ 3) (do 0-))))))")
    (glint "(define (func x) (if (string-append (string-append . 1/0+i)) (string-append (string-append . 1/0+i))))")
    (glint "(map 2(list-tail (string->list i)))")
    (glint "(for-each +(list-tail (string->list -)))")
    (glint "(char-alphabetic? (letrec (list (list 1)) (values 1 2) (*s7* 'print-length) (define _h1_ 3) (let* 2 begin 0+1/0i (define* (_d1_ (a 1)) (+ a 1)) 0+0/0i 1212)))")
    (glint "(with-baffle 1i 0+0/0i '((1 (2)) (((3) 4))) '((x . 1) . 2) 3/4 -1 unless (define _h1_ 3) (let 1))")
    (glint "(when 00/(cond . +i))")
    (glint "(letrec* - (define _h1_ 3) 1.5 (define _h1_ 3) (do '((()))))")
    (glint "(map +(list-tail (vector->list //1(port-line-number ./))))")
    (glint "(asin (procedure-source (string-append (string-append . when))))")
    (glint "(for-each 1(list-tail (string->list (funclet (with-input-from-file .(signature))))))")
    (glint "(eval (list 02(quote)))")
    (glint "(string-append +0 (integer->char 255) (string-append . 1))")
    (glint "(vector-append (vector-append . 1.2.3))")
    (glint "(reverse! (map 0(sort!)))")
    (glint "(append i2(append . #<unspecified>))")
    (glint "(cadr (do (list (list 1)) `((+ x 1)) '(()) (list (list 1 2)) (do 00- #(1 2) or (lambda* ((a 1)) (+ a 1)) #() /100(number? (dilambda 1/)))))")
    (glint "(do (list (list 1)) '((x 1) . 2) ..(case i/ 1.5 let . '(1 2 . 3)))")
    (glint "(pair-line-number i2(outlet (c-pointer? (for-each if nan.0 `(1) (quote \"\" #2d((1 2) (3 4))
                   '((x 1) (y . 2)) (let ((x 3)) (lambda (y) (+ x y))) i/(char-downcase (logior 2(hash-table))))))))")
    (glint "(when -(cond 2/1 (lambda args args) . 0))")
    (glint "(string-ci>=? (cdaadr 1/+ `(x 1) `(1) #f case --+/-0(number? 0 1 '((x . 1) . 2) .-(eval (read (open-input-string))))))")
    (glint "(make-hash-table ++0.(string-append \"hi\" (string)))")
    (glint "(map (*s7* 'print-length) '((x 1) . 2) letrec* `(((x 1))) 0/0+i '(- 1) (quote #() #<eof> 1/1.2 inf.0 i020))")
    (glint "(multiple-value-bind 0(expt (map 2(quote))))")
    (glint "(documentation (do () `((x 1)) (integer->char 255) . =>))")
    (glint "(let*-values ((x)) (list ()) do -/(proper-list? -0(iterator? .-.-0(input-port? i0))))")
    (glint "(logand .-0+11 'hi (1) i12(let-values ((1) . x)))")
    (glint "(let-values ((x . 1) . 2) (make-dilambda (lambda () 1) (lambda (a) a)) 2.(cons* .210/))")
    (glint "(/ i0+(let*-values ((x 1 . 2) . 3) #(1 2) '((1 (2)) (((3) 4))) and ((set! x (+ x 1)) (* x 2)) (proper-list?)))")
    (glint "(let ((x 1) (y) . 2) (define _h1_ 3) (list 1 2) 2)")
    (glint "(case .. ((x 1) 2) quasiquote -1234 (x 1) 10(abs 2))")
    (glint "(let + (((x 1))) (unless 01001/i(outlet 2 (string (integer->char 255)) (lambda args args) (define-macro (_m1_ a) `(+ ,a 1)) 'hi (append (do +)))))")
    (glint "(let? i0..-(let* '((())) (do ((set! x (+ x 1)) (* x 2)) (char-upper-case? (memq (string->symbol (proper-list? -)))))))")
    (glint "(eqv? i.(write-byte (symbol-table (string>=? (call-with-exit i0(> 12+.(multiple-value-bind 2 -1 ((x 1) . 2))))))))")
    (glint "(case .2i1./ ((x 1) 2) (x 1) (complex? 2))")
    (glint "(let ((x #f)) (*s7* 'print-length) . else)")
    (glint "(int-vector (let ((x . 1) . 2) (do (float-vector? -))))")
    (glint "(when 0(let (((+ x 1))) +i :hi --(get-output-string #(#(0)) ((1)) (- 1) 1.0+1.0i (cddadr))))")
    (glint "(let* + (((+ x 1))) (if ((x 1) (y . 2)) letrec* 0/0+i or))")
    (glint "(caddr (letrec* i+ (((x 1) 2) 3) '((1 2) (3 4)) (define _h1_ 3) (do ((x . 1) . 2) 221.)))")
    (glint "(let* (define-macro (_m1_ a) `(+ ,a 1)) (do (((+ x 1))) #() \"hi\" 0i #() let #2d((1 2) (3 4)) 0 /1))")
    (glint "(eof-object? 0-+(let and ((x 1) (y . 2)) (unless +2+0(read -0(do (vector? 1 1.0+1.0i (pi 0) and .0))))))")
    (glint "(aritable? +02(not (begin 1i __asdf__ (make-dilambda (lambda () 1) (lambda (a) a)) -1 ((x 1) (y) . 2) . 1234)))")
    (glint "(let* + ((set! x (+ x 1)) (* x 2)) (when))")
    (glint "(catch (lambda* ((a 1)) (+ a 1)) + (cons 1 2) (integer->char 255) lambda -.2.1++.(lambda*))")
    (glint "(number? i0(cadr /(help (do ((x . 1)) (((x 1))) #2d((1 2) (3 4)) letrec*))))")
    (glint "(do (+ x 1) 'hi (- 1) case ((x . 1) . 2) (integer->char 255) letrec .(string-downcase .(keyword? i)))")
    (glint "(set-current-error-port (let i (((+ x 1))) #f ((x . 1) . 2) i+1.i(string-ci>? let* -1 -1 ((x))
                    (current-output-port (abs x) 1.5 #() (x (y 1)) '((1 (2)) (((3) 4)))))))")
    (glint "(string-downcase (open-input-file i(let /12 (((+ x 1))) __asdf__ do (*s7* 'print-length))))")
    (glint "(read-char /2(morally-equal? /(c-pointer? (iterate (let i. (((+ x 1))) ((x 1) y . 2) do (set-current-input-port .11))))))")
    (glint "(do 'hi () 1/1.2 - or ((x 1) 2) most-negative-fixnum (cddaar /1(cosh do (list (list 1 2)) () '((())) begin 1 and 00.(length .i))))")
    (glint "(expt .+/+(call-with-exit (lambda (x) ((x 1 . 2) . 3) -+)))")
    (glint "(cdr -(lambda (define _h1_ 3) (not)))")
    (glint "(zero? (- . (x . y)))")
    (glint "(vector? 1./.1(int-vector-ref 1/(list-ref .(string-upcase -.(make-rectangular (let (pi 0) (do ((set! x (+ x 1)) (* x 2)) pi 1)))))))")
    (glint "(if 0.(if (not 00.)))")
    (glint "(let + (((+ x 1))) (when 2))")
    (glint "(vector-length (copy .(gensym . pi)))")
    (glint "(lambda 1-1/.0i/-i(let))")
    (glint "(angle i+.(let ((x 1) (y) . 2) (define* (_d1_ (a 1)) (+ a 1)) 1(logxor)))")
    (glint "(open-output-string (logxor ((x . 1)) ((set! x (+ x 1)) (* x 2)) pi #<unspecified> (define-macro (_m1_ a) `(+ ,a 1)) 1(call-with-values (values) (lambda))))")
    (glint "(proper-list? (lambda* ..2(let ((x 1) . 2) (string #\\a #\\null #\\b) i1)))")
    (glint "(lognot -(case i quote 00 (x y) => (set! _x1_ 3) .(string-ci>=? -/0 #2d((1 2) (3 4)) (((x 1) 2) 3) (- 1) 0/0+0/0i (float-vector-ref =>))))")
    (glint "(string-append +(let* ''2 (define-macro (_m1_ a) `(+ ,a 1)) inf.0 ((x 1) 2)
                     21 case -1234 (define _h1_ 3) 0 +-(eval 02-(float-vector 2 (values \"hi\") (list (list 1)) ((x 1) . 2) inf.0 -+2.))))")
    (glint "(or -1i1 (or . 0))")
    (glint "(caaaar '((1 2) (3 4)) (list 1 2) (char-lower-case? /+/. \"hi\" (pi 0) ((x . 1)) i/(make-list (set-current-error-port 12(when .1(when (not)))))))")
    (glint "(cond (#t ()) 'hi ((x . 1)) i.1.)")
    (glint "(cond (#t ()) ((x . 1) . 2) define x (cons 1 2) /-/(port-filename (x 1) ((set! x (+ x 1)) (* x 2)) (- 1) (- 1) .ii1(hash-table-entries 10)))")
    (glint "(cond /2 (#t ()))")
    (glint "(assv /2(map i (x 1) (make-dilambda (lambda () 1) (lambda (a) a)) 12+i1+/1(make-rectangular /2(cond (x . 1) (#t ()) (cdddar)))))")
    (glint "(gc i/(case 1 (integer->char 255) (else ())))")
    (glint "(list->string +(flush-output-port (case //2- (list 1) (else ()))))")
    (glint "(cond (((+ x 1))) (else ()) (flush-output-port))")
    (glint "(even? /(make-shared-vector 0-(list->string 1(cond ((i 0 (+ i 1))) ((x . 1) . 2) (#t ())))))")
    (glint "(cond ((x 1) (y) . 2) (else (f x) B) ((x 1) (y) . 2))")
    (glint "(cons +1.(list 02/ (pi 0) `(+ ,a ,@b) ((null? i) i) 2201))")
    (glint "(let* / ((1)) (unless (unless '((())) x y z 1+0/0i most-negative-fixnum /)))")
    (glint "(define* ((x . 1)) letrec ((1)) (pi 0) let (+ x 1) (x . 1) set! x quasiquote (f x) i `(+ ,a ,@b) )")
    (glint "(define* , `(+ ,a ,b ,@c) (define* macroexpand macroexpand \"\"))")
    (glint "(define* ((i 0 (+ i 1))) (define* 3/4 unless (call/cc (lambda (go) (go 9) 0)) or ' `(+ ,a ,@b) 1.0+1.0i abs (abs x) (A (f x) B) () ((1) . x) ))")
    (glint "(define* , (else ()) ,(lambda))")
    (glint "(cond ` (#t ()) (abs x) (= i 2) ((+ x 1)) (else (f x) B) ((x 1) (y) . 2) (A (f x) B))")
    (glint "(unless (set! _x1_ 3) `(+ ,a ,@b) `(+ ,a ,@b) `(+ ,a ,@b) `(+ ,a ,b) (((x 1))) (vector 1 '(3)) (else (f x) B) nan.0 ((x 1)))")
    (glint "(lambda* .(:allow-other-keys (integer->char 255) define x (lambda args args) \" \"))")
    (glint "(begin (define* (_d1_ (a 1)) (+ a 1)) (f x) (define* (_d1_ (a 1)) (+ a 1)) (else (f x) B) (- 1) ' ((x 1) 2) (A (f x) B) `(+ ,a ,b ,@c) #(1 2) .\" ` `  \")")
    (glint "(define-macro* (null? i) #t (list 1 2) (define* (_d1_ (a 1)) (+ a 1)) ((x 1 . 2) . 3) ' 1 defmacro #f if (#t ()) quasiquote (quote ))")
    (glint "(define-bacro (pi) (let .' define x cons or (#t ()) defmacro (x . y) (string (integer->char 255)) ((x 1 . 2) . 3) ,\"\"))")
    (glint "(cond `(+ ,a ,@b) ((x 1) (y) . 2) (else (f x) B) ((x 1) (y) . 2))")
    (glint "(lambda* lambda* -1 (= i 2) (- i 1) cons \"   \")")
    (glint "(define-macro (pi) (quote))")
    (glint "(cond (1) (else))")
    (glint "(pair? (defmacro* define  #(#(0)) 3/4 `(+ ,a ,b ,@c) `(+ ,a b ,@c ',d) ((x 1 . 2) . 3) set! x))")
    (glint "(list-values (apply-values))")
    (glint "(list-values (begin (f x) B) nan.0 (apply-values))")
    (glint "(symbol->value (vector->list quasiquote (list-values -1.3 (apply-values))))")
    (glint "(define-macro (list (list 1 2)) (list-values))")
    (glint "(define-bacro  (x => y)  (cond   ((x 1) . 2)  ))")
    (glint "(int-vector-set! ((+ x 1)) \"hi\" '(string #\\a #\\null #\\b) 3/4 (((+ x 1))) (1) (do (#t ()) #() (= i 2)))")
    (glint "(list-values (list-values . -1))")
    (glint "(lambda* `(string>? inf.0 ((set! x (+ x 1)) (* x 2)) macroexpand `(+ ,a ,b ,@c) (()) pi (pi 0) (= i 2) let (1) begin (1 2 . 3) if cond (begin (f x) B) (()) (define-macro (_m1_ a) `(+ ,a 1)) (x y) (values \"hi\") ((+ x 1)) :hi ((set! x (+ x 1)) (* x 2)) inf.0 (()) (pi 0) ((x 1 . 2) . 3) (x y) (x . 1) ((x . 1) . 2) nan.0 (if x y) `(+ ,a b ,@c ',d) (make-dilambda (lambda () 1) (lambda (a) a)) with-let ))")
    )

  (let ((out-vars (*lint* 'out-vars)))
    (test (out-vars 'hi '(a b) '(+ a b)) '(() ()))
    (test (out-vars 'hi '(a b) '(set! a b)) '(() ()))
    (test (out-vars 'hi '(a b) '(set! c (+ a b))) '(() (c)))
    (test (out-vars 'hi '(a b) '(set! a (+ b c))) '((c) ()))
    (test (out-vars 'hi '(a b) '(set! c (+ (* a b) c))) '((c) (c)))
    (test (out-vars 'hi '(a b) '(set! (c 0) (+ (* a b) c))) '((c) (c)))
    (test (out-vars 'hi '(a b) '(let ((c 1)) (+ (* a b) c))) '(() ()))
    (test (out-vars 'hi '(a b) '(let ((c (+ a b))) (set! c (* a b)))) '(() ()))
    (test (out-vars 'hi '(a b) '(let loop ((c (+ a b))) (set! c (loop a)))) '(() ()))
    (test (out-vars 'hi '(a b) '(let loop ((c (+ a b))) (set! c (loop d)))) '((d) ()))
    (test (out-vars 'hi '(a b) '(let ((c (+ a b)) (d 1)) (set! c (loop d)))) '((loop) ()))
    (test (out-vars 'hi '(a b) '(let ((c (+ a b)) (d 1)) (set! e d) (+ a b c d))) '(() (e)))
    (test (out-vars 'hi '(a b) '(let ((c (+ a b)) (d 1)) (set! e d) (+ a b c d e f g))) '((g f e) (e)))
    (test (out-vars 'hi '(a b) '(let ((c 1) (d (+ c 1))) (+ (* a b) c))) '((c) ()))
    (test (out-vars 'hi '(a b) '(let* ((c 1) (d (+ c 1))) (+ (* a b) c))) '(() ()))
    (test (out-vars 'hi '(a b) '(let ((g 1)) (let ((c g)) (* c g)))) '(() ()))
    (test (out-vars 'hi '(a b) '(let ((g 1)) (letrec ((c g)) (* c g)))) '(() ()))
    (test (out-vars 'hi '(a b) '(do ((i 0 (+ i 1))) ((= i 10) i) (display i))) '(() ()))
    (test (out-vars 'hi '(a b) '(do ((i 0 (+ i j))) ((= i 10) i) (display i))) '((j) ()))
    (test (out-vars 'hi '(a b) '(do ((i 0 (+ i j)) (j 2)) ((= i 10) i) (display i))) '(() ()))
    (test (out-vars 'hi '(a b) '(do ((i 0 (+ i j)) (j 2)) ((= i 10) k) (display i))) '((k) ()))
    (test (out-vars 'hi '(a b) '(do ((i 0 (+ i j)) (j 2)) ((= i 10) k) (set! n i))) '((k) (n)))
    (test (out-vars 'hi '(a b) '(lambda () (+ a b))) '(() ()))
    (test (out-vars 'hi '(a b) '(lambda (c) (+ a b c))) '(() ()))
    (test (out-vars 'hi '(a b) '(lambda c (+ a b c))) '(() ()))
    (test (out-vars 'hi '(a b) '(lambda (c . d) (+ a b c d))) '(() ()))
    (test (out-vars 'hi '(a b) '(lambda (c . d) (set! e (+ a b c d)))) '(() (e)))
    (test (out-vars 'hi '(a b) '(lambda* ((c 1) (d 2)) (+ a b c d))) '(() ()))
    (test (out-vars 'hi '(a b) '(let () (define c 1) (+ a b c))) '(() ()))
    (test (out-vars 'hi '(a b) '(let () (define c 1) (+ a b c d))) '((d) ()))
    (test (out-vars 'hi '(a b) '(let* () (define c 1) (+ a b c d))) '((d) ()))
    (test (out-vars 'hi '(a b) '(let () (define (c s) (* s 2)) (+ a b (c d)))) '((d) ())))


;  (define fmatch (*lint* 'function-match))
;  (define walkfunc (*lint* 'lint-walk-function))
;  (define (f1 x) (if (< x 3) (+ x 1) (+ x 2)))
;  (let ((e (walkfunc 'define 'f1 '(x) '((if (< x 3) (+ x 1) (+ x 2))) '(define (f1 x) (if (< x 3) (+ x 1) (+ x 2))) ())))
;    (fmatch 'tester '(if (< y 3) (+ y 1) (+ y 2)) e))
;  (define sequal? (*lint* 'structures-equal?))
;  (sequal? '(if (< y 3) (+ y 1) (+ y 2)) '(if (< x 3) (+ x 1) (+ x 2)) '((y . :unset)) () ())
;  (sequal? '(and x y) '(and a b) '((x . a) (y . b)) () ()) 


  (define f321
    (let ((+signature+ '(float? integer?)))
      (lambda (int)
	(if (integer? int)
	    (* 1.0 int)
	    (error 'wrong-type-arg "~A: ~A is not an integer" f321 int)))))
  (lint-test "(string-ref (f321 3) 2)" " string-ref: in (string-ref (f321 3) 2), string-ref's argument 1 should be a string, but (f321 3) is a float?")

  (set! reader-cond #f)
  )


;;; --------------------------------------------------------------------------------

(test (let ((equal? #f)) (member 3 '(1 2 3))) '(3))
(test (let ((eqv? #f)) (case 1 ((1) 1))) 1) ; scheme wg
(test (let ((eqv? equal?)) (case "asd" (("asd") 1) (else 2))) 2)
(test (let ((eq? #f)) (memq 'a '(a b c))) '(a b c))
(test (let ((if #t)) (or if)) #t)
(test (let ((if +)) (if 1 2 3)) 6)
(test (if (let ((if 3)) (> 2 if)) 4 5) 5)
(test (let ('1 ) quote) 1)
(test (let ((quote 1)) (+ quote 1)) 2)
(test (let ((quote -)) '32) -32)
(test (do ((do 1)) (#t do)) 1)
(test (do ((do 1 (+ do do))) ((> do 3) do)) 4)
(test (do ((do 1 do) (j do do)) (do do)) 1)
(test (do ((do do do)) (do do)) do)
(test (do ((do do do)) (do do do)) do) ; ok ok!
(test (or (let ((or #t)) or)) #t)
(test (and (let ((and #t)) and)) #t)
(test (let ((=> 3) (cond 4)) (+ => cond)) 7)
(test (case 1 ((1 2) (let ((case 3)) (+ case 1))) ((3 4) 0)) 4)
(test (let ((lambda 4)) (+ lambda 1)) 5)

(test (let () (define (hi a) (let ((pair? +)) (pair? a 1))) (hi 2)) 3)
(test ((lambda (let) (let* ((letrec 1)) (+ letrec let))) 123) 124)

(test (let ((begin 3)) (+ begin 1)) 4)
(test ((lambda (let*) (let ((letrec 1)) (+ letrec let*))) 123) 124)
(test ((lambda (quote) (+ quote 1)) 2) 3)
(test ((lambda (quote . args) (list quote args)) 1 2 3) '(1 (2 3)))
(test (let ((do 1) (map 2) (for-each 3) (quote 4)) (+ do map for-each quote)) 10)
(test ((lambda lambda lambda) 'x) '(x))
(test ((lambda (begin) (begin 1 2 3)) (lambda lambda lambda)) '(1 2 3))
(test (let* ((let 3) (x let)) (+ x let)) 6)
(test (((lambda case lcm))) 1)
(test (((lambda let* *))) 1)
(test (do ((i 0 1) '(list)) (#t quote)) ())
(test ((lambda (let) (+)) 0) 0)
(test (let () (define (hi cond) (+ cond 1)) (hi 2)) 3)
(test (let () (define* (hi (cond 1)) (+ cond 1)) (hi 2)) 3)
(test (let () (define* (hi (cond 1)) (+ cond 1)) (hi)) 2)
(test (let () ((lambda (cond) (+ cond 1)) 2)) 3)
(test (let () ((lambda* (cond) (+ cond 1)) 2)) 3)
(test (let () (define-macro (hi cond) `(+ 1 ,cond)) (hi 2)) 3)
(test (let () (define-macro* (hi (cond 1)) `(+ 1 ,cond)) (hi)) 2)
(test (let () (define (hi abs) (+ abs 1)) (hi 2)) 3)
(test (let () (define (hi if) (+ if 1)) (hi 2)) 3)

(test (let () (define* (hi (lambda 1)) (+ lambda 1)) (hi)) 2)
(test (do ((i 0 0) '(+ 0 1)) ((= i 0) i)) 0) ; guile also! (do ((i 0 0) (quote list (+ 0 1))) ((= i 0) i))?
(test (let () (define (cond a) a) (cond 1)) 1)
(test (let ((cond 1)) (+ cond 3)) 4)
(test (let () (define (tst cond) (if cond 0 1)) (tst #f)) 1)
(test (let () (define (tst fnc) (fnc ((> 0 1) 2) (#t 3))) (tst cond)) 3)
(test (let () (define (tst fnc) (fnc ((> 0 1) 2) (#t 3))) (define (val) cond) (tst (val))) 3)
(test (let () (define-macro (hi a) `(let ((lambda +)) (lambda ,a 1))) (hi 2)) 3)
(test ((let ((do or)) do) 1 2) 1)

(test (let () (define (hi) (let ((oscil *)) (if (< 3 2) (+ 1 2) (oscil 4 2)))) (hi) (hi)) 8)
(test (let () (define (hi) (let ((oscil *)) (if (< 3 2) (+ 1 2) (oscil 4 2)))) (hi) (hi) (hi) (hi)) 8)
(test (let ((x 12)) (define (hi env) (set! x (env 0)) x) (hi '(1 2 3)) (hi '(1 2 3))) 1)
(test (let ((x 12)) (define (hi env) (set! x (+ x (env 0))) x) (hi '(1 2 3)) (hi '(1 2 3))) 14)
(test (let ((x 12)) (define (hi env) (set! x (+ (env 0) x)) x) (hi '(1 2 3)) (hi '(1 2 3))) 14)
(test (let ((x 12)) (define (hi env) (set! x (+ x (env 0))) x) (hi '(1 2 3)) (hi '(1 2 3)) (hi '(1 2 3))) 15)
(test (let ((x 12)) (define (hi env) (set! x (+ (env 0) x)) x) (hi '(1 2 3)) (hi '(1 2 3)) (hi '(1 2 3))) 15)

(test (let ((env +) (x 0)) (define (hi) (do ((i 0 (+ i (env 1 2)))) ((> i (env 4 5)) (env 1 2 3)) (+ x (env 1)))) (hi) (hi)) 6)
(test (let ((env +) (x 0)) (define (hi) (do ((i 0 (+ i 3))) ((> i (env 4 5)) (env 1 2 3)) (+ x (env 1)))) (hi) (hi)) 6)
(test (let ((env +) (x 0)) (define (hi) (do ((i 0 (+ i 3))) ((> i (env 4 5)) (env 1 2 3)) (+ x 1))) (hi) (hi)) 6)
(test (let ((env +) (x 0)) (define (hi) (do ((i 0 (+ i 3))) ((> i 9) (env 1 2 3)) (+ x 1))) (hi) (hi)) 6)
(test (let ((env +) (x 0)) (define (hi) (do ((i 0 (+ i 3))) ((> i 9) (+ 1 2 3)) (+ x 1))) (hi) (hi)) 6)
(test (let * ((i 0)) (if (< i 1) (* (+ i 1))) i) 0)
(test (let ((car if)) (car #t 0 1)) 0)
(test (call-with-exit (lambda (abs) (abs -1))) -1)

(test (let ((sqrt (lambda (a) (* a a)))) `(+ ,@(map sqrt '(1 4 9)) 2)) '(+ 1 16 81 2))
(test (let ((sqrt (lambda (a) (* a a)))) `(+ ,(sqrt 9) 4)) '(+ 81 4))
(test `(+ ,(let ((sqrt (lambda (a) (* a a)))) (sqrt 9)) 4) '(+ 81 4))
(test `(+ (let ((sqrt (lambda (a) (* a a)))) ,(sqrt 9)) 4) '(+ (let ((sqrt (lambda (a) (* a a)))) 3) 4))
(test (let ((sqrt (lambda (a) (* a a)))) `(+ ,(apply values (map sqrt '(1 4 9))) 2)) '(+ 1 16 81 2))
(if (not (provided? 'immutable-unquote)) (test (let ((sqrt (lambda (a) (* a a)))) `(+ (unquote (apply values (map sqrt '(1 4 9)))) 2)) '(+ 1 16 81 2)))

(test ((((eval lambda) lcm gcd))) 0)
(test ((((lambda - -) -) 0) 1) -1)

(test (let () (define (hi) (let ((oscil >)) (or (< 3 2) (oscil 4 2)))) (hi) (hi)) #t)
(test (let () (define (hi) (let ((oscil >)) (and (< 2 3) (oscil 4 2)))) (hi) (hi)) #t)

(test ((lambda* ((- 0)) -) :- 1) 1)

(let ()
  (define-macro (i_ arg)
    `(with-let (unlet) ,arg))
  
  (define-bacro* (mac b)
    `((i_ let) ((a 12)) 
      ((i_ +) a ,(symbol->value b)))) 
  ;; this assumes the 'b' value is a symbol: (let ((a 1)) (mac (* a 2))) is an error -- see s7.html for a better version
  (test (let ((a 32) 
	      (+ -)) 
	  (mac a))
	44))

;(define (hi) (do ((i 0 (+ i 1))) ((= i 200000) i) (abs i)))
;(test (hi) 200000)

(let ()
  (define-macro (cube x) `(with-let (inlet :x ,x) (* x x x)))
  (test (cube 2) 8)
  (let ((x 2)) (test (cube (set! x (+ x 1))) 27))

  (define-macro (pop! sym)
    `(with-let (#_inlet :e (#_curlet) :result (#_car ,sym))
       (with-let e (#_set! ,sym (#_cdr ,sym)))
       result))
					
  (test (let ((lst '(1 2 3))) (list (pop! lst) lst)) '(1 (2 3)))
  (test (let ((lst (vector (list 1 2 3)))) (list (pop! (lst 0)) lst)) '(1 #((2 3))))
  (test (let ((result '(1 2 3))) (list (pop! result) result)) '(1 (2 3)))
  (test (let ((cdr '(1 2 3))) (list (pop! cdr) cdr)) '(1 (2 3)))
	
  (define-macro (pushnew! val lst)
    `(set! ,lst (with-let (inlet :val ,val :lst ,lst)
		  (if (not (member val lst))
		      (cons val lst)
		      lst))))
					
  (test (let ((lst (list 1 2))) (pushnew! 3 lst)) '(3 1 2))
  (test (let ((val (list 1 2)) (lst 3)) (pushnew! lst val)) '(3 1 2))
  (test (let ((lst (list 1 2)) (val 3)) (pushnew! val lst)) '(3 1 2))
  (test (let ((lst (list 1 2)) (member 3)) (pushnew! member lst)) '(3 1 2))
  )


(test (let ()
	(define-immaculo (hi a) `(let ((b 23)) (+ b ,a)))
	(let ((+ *)
	      (b 12))
	  (hi b)))
      35)

(test (let ()
	(define-clean-macro (hi a) `(+ ,a 1))
	(let ((+ *)
	      (a 12))
	  (hi a)))
      13)

(test (let ()
	(define-immaculo (hi a) `(+ ,a 1))
	(let ((+ *)
	      (a 12))
	  (hi a)))
      13)

(test (let ()
	(define-clean-macro (mac a . body)
	  `(+ ,a ,@body))
	(let ((a 2)
	      (+ *))
	  (mac a (- 5 a) (* a 2))))
      9)

(test (let () 
	(define-macro (mac b) 
	  `(let ((a 12)) 
	     (,+ a ,b)))
	(let ((a 1) 
	      (+ *))
	  (mac a)))
      24)

(test (let () 
	(define-macro (mac b) 
	  `(let ((a 12)) 
	     (+ a ,b)))
	(let ((a 1) 
	      (+ *))
	  (mac a)))
      144)

(test (let ()
	(define-immaculo (mac c d) `(let ((a 12) (b 3)) (+ a b ,c ,d)))
	(let ((a 21) (b 10) (+ *)) (mac a b)))
      46)

(let ()
  (define-macro (pure-let bindings . body)
    `(with-let (unlet)
       (let ,bindings ,@body)))
  (test (let ((+ *) (lambda abs)) (pure-let ((x 2)) ((lambda (y) (+ x y)) 3))) 5))

(test (let ((name '+))
	(let ((+ *))	
	  (eval (list name 2 3))))
      6)
(test (let ((name +))
	(let ((+ *))	
	  (eval (list name 2 3))))
      5)
;; why is this considered confusing?  It has nothing to do with eval!

(test (let ((call/cc (lambda (x)
		       (let ((c (call/cc x))) c))))
	(call/cc (lambda (r) (r 1))))
      1)

; (test (with-let (sublet (curlet) (cons '+ (lambda args (apply * args)))) (+ 1 2 3 4)) 24) ; not sure about this -- the inner '+ might be optimized

(let ()
  (define-constant [begin] begin)
  (define-constant [if] if)
  (define-macro (when1 expr . body)
    `([if] ,expr ([begin] ,@body)))
  (let ((if 32) (begin +)) 
    (test (when1 (> 2 1) 1 2 3) 3)
    (test (when1 (> 1 2) 3 4 5) #<unspecified>))
  (test (when1 (> 2 1) 3) 3))

(test (let ((car 1) (cdr 2) (list '(1 2 3))) (+ car cdr (cadr list))) 5)
(test (letrec ((null? (lambda (car cdr) (+ car cdr)))) (null? 1 2)) 3)
(test (letrec ((append (lambda (car list) (car list)))) (append cadr '(1 2 3))) 2)
(test (let () (define (hi) (let ((car 1) (cdr 2) (list '(1 2 3))) (+ car cdr (cadr list)))) (hi)) 5)
(test (let () (define (hi) (letrec ((null? (lambda (car cdr) (+ car cdr)))) (null? 1 2))) (hi)) 3)
(test (let () (define (hi) (letrec ((append (lambda (car list) (car list)))) (append cadr '(1 2 3)))) (hi)) 2)

(let ()
  (test ((lambda 'a (eval-string "1")) (curlet) 1) 1)
  (test ((lambda 'a (eval-string "a")) (curlet) 1) 1))

;;; check optimizer 
(let ((lst (list 1 2 3)) 
      (old-lambda lambda)
      (ho #f)
      (val #f))
  (let* ((lambda 1))
    (define (hi) 
      (for-each (lambda (a) (display a)) lst))
    (set! val (+ lambda 2))
    (set! ho hi))
  (test val 3)
  (test (ho) #<unspecified>))

(let ()
  (define mac (let ((var (gensym))) 
		(define-macro (mac-inner b) 
		  `(#_let ((,var 12)) (#_+ ,var ,b))) 
		mac-inner))
  (test (let ((a 1) (+ *) (let /)) (mac a)) 13)
  (test (let ((a 1) (+ *) (let /)) (mac (mac a))) 25))

(test (let ((begin +)) (with-let (unlet) (begin 1 2))) 2)
(test (let () (define (f x) (let > (begin (vector-dimensions 22)))) (f 0)) 'error)
(test (let () (define (f x) (let asd ())) (f 1)) 'error)
(test (let () (define (f x) (hook *)) (f #f)) 'error)
(test (let ((e (sublet () '(a . 1)))) (define (f x) (e *)) (f 1)) 'error)
(test (let () (define (f) (eval (lambda 2.(hash-table-ref 1-)))) (f)) 'error)
(test (let () (eval (lambda 2.(hash-table-ref 1-)))) 'error)
(test (let () (define (f) (eval (lambda 2 #f))) (f)) 'error)
(test (let () (define (f) (eval (lambda #f))) (f)) 'error)
(test (let () (define (f) (eval (lambda))) (f)) 'error)
(test (let () ((lambda () (eval (lambda 2 #f))))) 'error)
(test (let () (define (f x) (help (lambda  `(x 1) 12))) (f (string #\a))) 'error)
(test (let () (define (func x) (* +(quote (vector? )))) (func '((x 1) (y) . 2))) 'error)
(test (let () (define (func x) (* +(quote i))) (func cond))  'error)
(test (let ((i 1)) (define (func x) (begin i(let -))) (func macroexpand))  'error)
(test (let ((i 1)) (define (func x) (if (* i '((x 1) (y) . 2) ) (atan (procedure? 2(sin ))))) (func '(values #\c 3 1.2))) 'error)
(test (let ((i 1)) (define (func x) (* 1- '(values #\c 3 1.2) )) (func set!))  'error)
(test (let ((dynamic-wind 1)) (+ dynamic-wind 2)) 3)
(test (list (call-with-exit (lambda quote ((car quote) 1 2 3)))) '(1 2 3))
(test (call-with-exit (lambda* (quote (ho 1)) (quote ho))) 1)
(test (lambda 'ho (hash-table* 'a 1) . #<unspecified>) 'error) ; stray dot check

(test (set! case 3) 'error)
(test (begin (let ((case 2)) case) (set! case 4)) 'error)
(test (let () (define (f case) (+ case 4)) (set! case (f 1))) 'error)
(test (begin (let () (define case 8) case) (set! case 6)) 'error)

(test (let ((max min) (min max)) (min 10 (max 100 5))) 10)
(test (let ((max min) (min max)) (min 10 (max 12 15))) 12)
(test ((let ((mx max)) (lambda* ((max min) (min mx)) (min 10 (max 100 5))))) 10)
(test ((let ((mx max)) (lambda* ((max min) (min mx)) (min 10 (max 12 15))))) 12)
(test (let ((max min) (min max)) (define (func) (min 10 (max 100 5))) (define (hi) (func)) (hi)) 10)
(test (let ((max min) (min max)) (define (func) (min 10 (max 12 15))) (define (hi) (func)) (hi)) 12)

(test (catch #t (lambda () ((lambda quote (abs '__a__)))) (lambda (type info) (car info))) "~A: unbound variable")
(test (catch #t (lambda () ((lambda quote (+ '__a__ 1)))) (lambda (type info) (car info))) "~A: unbound variable")
(test (catch #t (lambda () ((lambda quote (+ 1 '__a__)))) (lambda (type info) (car info))) "~A: unbound variable")
(test (catch #t (lambda () ((lambda quote (+ '__a__ '__a__)))) (lambda (type info) (car info))) "~A: unbound variable")
(test (catch #t (lambda () ((lambda quote (+ 1 '__a__ '__a__)))) (lambda (type info) (car info))) "~A: unbound variable")
(test (catch #t (lambda () ((lambda quote (+ 1 '__a__ 3)))) (lambda (type info) (car info))) "~A: unbound variable")
(test (catch #t (lambda () ((lambda quote (+ 1 2 '__a__ 3)))) (lambda (type info) (car info))) "~A: unbound variable")
(test (catch #t (lambda () ((lambda quote (vector '__a__ 1 2)))) (lambda (type info) (car info))) "~A: unbound variable")
(test (catch #t (lambda () ((lambda* 'x (abs '__a__)))) (lambda (type info) (car info))) "~A: unbound variable")
(test (catch #t (lambda () ((lambda* 'x (+ '__a__ 1)))) (lambda (type info) (car info))) "~A: unbound variable")
(test (catch #t (lambda () ((lambda* 'x (+ 1 '__a__)))) (lambda (type info) (car info))) "~A: unbound variable")
(test (catch #t (lambda () ((lambda* 'x (vector '__a__ 1 2)))) (lambda (type info) (car info))) "~A: unbound variable")

;;; these 4 lines go together
(define-expansion (_mem2_ . args)
  `(begin (format #f "~S~%" args) ((lambda (a b) ,@args) 1 3) ((lambda (a b) ,@args) 1 2) #f))
(let ((args #(1 2))) (define (func) (_mem2_ 1 2)) (define (hi) (func)) (hi))
(let ((args #(1 2))) (define (func) (_mem2_ 1 2)) (define (hi) (func)) (hi))

#|
;;; after much dithering I've decided that built-in C functions have a very aggressive take
;;; on "lexical scope": if gcd appears as the car of an expression in a function, and
;;; at that point in the overall s7 process gcd has not been redefined, then the function
;;; can embed the actual gcd function in that part of its source (as if it was (#_gcd ...)).
;;; Hence a subsequent (set! gcd +) has no effect on any call that lexically (textually)
;;; preceded that set!.  This is different from the handling of scheme-defined functions
;;; where (define (a) 0) (define (b) (a)) (define (c) 1) (set! a c) (b) -> 1.
;;; The decision as to when to replace the 'gcd with the gcd function is up to the optimizer, so
;;; consistency here is considered of no importance compared to speed -- either don't (set! gcd +)
;;; or do it before using gcd in any way. 

(test (let ()
	(define (gset-test)
	  (let-temporarily ((gcd +))
	    (do ((sum 0)
		 (x 12)
		 (y 4)
		 (i 0 (+ i 1)))
		((= i 3)
		 sum)
	      (set! sum (+ sum (gcd x y)))
	      (set! gcd +))))
	(define (gset-test-1) (gset-test))
	(gset-test-1))
      36 or 12 -- who knows)

(let ()
  (define %gcd gcd)
  (define (gset-test-x)
    (let ((sum 0)
	  (x 12)
	  (y 4))
      (do ((i 0 (+ i 1)))
	  ((= i 3) sum)
	(set! sum (+ sum (%gcd x y))))))
  (define (gset-test-1x) (gset-test-x))
  
  (define (gset-test-a)
    (let ((sum 0)
	  (x 12)
	  (y 4))
      (do ((i 0 (+ i 1)))
	  ((= i 3) sum)
	(set! sum (+ sum (gcd x y))))))
  (define (gset-test-1a) (gset-test-a))
  
  (define (gset-test-b)
    (let ((sum 0)
	  (x 12)
	  (y 4))
      (do ((i 0 (+ i 1)))
	  ((= i 3) sum)
	(set! sum (+ sum (gcd x y)))
	(set! gcd +))))
  (define (gset-test-1b) (gset-test-b))
  
  (define (gset-test-c)
    (let ((sum 0)
	  (x 12)
	  (y 4))
      (do ((i 0 (+ i 1)))
	  ((= i 3) sum)
	(set! sum (+ sum (gcd x y))))))
  (define (gset-test-1c) (gset-test-c))
  
  (let* ((x (gset-test-1x))
	 (a (gset-test-1a))
	 (b (gset-test-1b))
	 (c (gset-test-1c))
	 (a (gset-test-1a)))
    (set! %gcd +)
    (let ((xx (gset-test-1x)))
      (display (list x a b c a xx))
      (newline))))


;;; s7:    12 12 12 12 12 12 12
;;; guile: 12 12 36 48 48 12 48
|#

;;; --------------------------------------------------------------------------------

#|
;; here's a reasonably complete test of part of the 'or handling
(let ((ops #(not = null? eof-object? boolean? eq? eqv? equal? memq memv member char=? string=? char-ci=? string-ci=? zero?))
      (op-args #(2 3 2 2 2 3 3 3 3 3 3 3 3 3 3 2))
      (xvals #(0 10000 1.0 10000.0 1+i 1/2 #\a #\A "a" "A" "" #() #(#f) #<eof> () #f #t a b (1 10000)))
      (yvals #(0 10000 1.0 10000.0 1+i 1/2 #\a #\A "a" "A" "" #() #(#f) #<eof> () #f #t a b (1 10000))) 
      ;; val list must be repeated else we'll get bogus eq? -> #t hits
      (val-quoted #(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t)))
  (for-each
   (lambda (t1 t1-args)
     (for-each
      (lambda (t2 t2-args)
	(for-each
	 (lambda (x)
	   (for-each
	    (lambda (y q)
	      (catch #t
		(lambda ()
		  (let ((f1 (if (= t1-args 2) `(,t1 x) (if q `(,t1 x ',y) `(,t1 x ,y))))
			(f2 (if (= t2-args 2) `(,t2 x) (if q `(,t2 x ',y) `(,t2 x ,y))))
			(x1 (if q `(x ',x) `(x ,x))))
		    (let ((result (eval `(let (,x1) (or ,f1 ,f2))))) ; check for errors in basic expr
		      (let ((val (call-with-output-string
				  (lambda (op) 
				    (call-with-input-string (format #f "(let (~S) (or ~S ~S))" x1 f1 f2)
				      (lambda (ip) 
					(lint ip op)))))))
			(when (positive? (length val))
			  (let ((pos (and (not (string-position "let: " val)) ; ignore various eqx problems that lint will report
					  (string-position " -> " val))))
			    (when pos
			      (let ((form (with-input-from-string (substring val (+ pos 3)) read)))
				(let ((new-val (eval form)))
				  (when (not (eq? (not result) (not new-val)))
				    (format *stderr* "(let (~S) (or ~S ~S)) -> ~S~%  ~A -> ~S~%" 
					    x1 f1 f2 result
					    (substring val (+ pos 3)) new-val)))))))))))
		(lambda (type info)
		  'error)))
	    yvals val-quoted))
	 xvals))
      ops op-args))
   ops op-args))

(let ((old+ +))
  (let ((vals 
	 (list (let ()
		 (define a 32)
		 (define p +)
		 (define (f b) (+ a b))
		 (set! a 1)
		 (let ((t1 (f 2)))
		   (set! + -)
		   (let ((t2 (f 2)))
		     (let ((t3 (equal? p +)))
		       (list t1 t2 t3)))))
	       
	       ;; s7: (3 -1 #f) ; this is now (3 3 #f) which strikes me as correct
	       ;; guile: (3 3 #f)
	       
	       (let ()
		 (define a 32)
		 (define p old+)
		 (define (f b) (p a b))
		 (set! a 1)
		 (let ((t1 (f 2)))
		   (set! p -)
		   (let ((t2 (f 2)))
		     (let ((t3 (equal? p old+)))
		       (list t1 t2 t3)))))
	       
	       ;; s7 (3 -1 #t)
	       ;; guile (3 -1 #t)
	       )))
    (set! + old+)
    (test (car vals) (cadr vals))))

;; these confuse t101.scm test suite do loops using +
(let ((old+ +))
  (define (f x) (with-let (unlet) (+ x 1)))
  (set! + -)
  (test (+ 1 1) 0)
  (test (f 1) 2)
  (set! + old+))

(let ((old+ +))
  (let ((f #f))
    (let ((+ -))
      (set! f (lambda (a) (+ 1 a))))
    (test (f 2) -1)
    (set! + *)
    (test (f 2) -1)
    (set! + old+)))

;;; this is confusing lint in t101.scm
(set! *#readers* old-readers)

(set! *#readers* (list (cons #\F (lambda (s) (and (string=? s "F") (list 'not #t))))
		       (cons #\F (lambda (s) (and (string=? s "First") 1)))))
(let ((x #F))
  (if x (format *stderr* "#F true?~%")) ; to what extent can this actually work?
  (if #F (format *stderr* "#F #t?~%")))

(let ((x #First))
  (test (+ x 1) 2)
  (test (if #F #First (not #F)) #t))

(set! *#readers* (list (cons #\A (lambda (s) (and (string=? s "A") let)))
		       (cons #\B (lambda (s) (and (string=? s "B") `((x 1)))))
		       (cons #\C (lambda (s) (and (string=? s "C") `(+ x 1))))))
(test (#A #B #C) 2) ; yow!!

(set! *#readers* old-readers)

(define (mu) ; infinite loop if bignums
  (let* ((x 1)
	 (xp (+ x 1)))
    (do ()
	((<= xp 1) (list (* 2 x) (* 2.0 x)))
      (set! x (/ x 2))
      (set! xp (+ x 1)))))

; (1/1152921504606846976 8.673617379884e-19)

smallest positive normalized fp	2-1022 = 2.225 10-308
largest normalized fp  2+1023 (2 - 2-52) 2+1024 - 2+971 = 1.798 10+308
smallest positive denormal  2-1023 2-52	 2-1075 = 2.470 10-324
largest denormal  2-1023 (1 - 2-52)	 2-1023 - 2-1075 = 1.113 10-308
largest fp integer	 2+1024 - 2+971 = 1.798 10+308
gap from largest fp integer to previous fp integer	2+971 = 1.996 10+292
largest fp integer with a predecessor	2+53 - 1 = 9,007,199,254,740,991

#x7ff0000000000000 +inf
#xfff0000000000000 -inf
#x7ff8000000000000 nan
#xfff8000000000000 -nan

but how to build these in scheme? (set! flt (integer-encode-float 0 #x7ff 0)) ? (would need check for invalid args)
in C:
	    s7_pointer p;
	    unsigned long long int NAN_1, NAN_0;
	    s7_double f_NAN_0, f_NAN_1;
	    p = s7_make_real(sc, NAN);
	    f_NAN_0 = real(p);
	    NAN_0 = integer(p);
	    NAN_1 = integer(p) | 1;
	    f_NAN_1 = (* ((s7_double*)(&NAN_1)));
	    fprintf(stderr, "%llx %f %d, %llx %f %d\n", NAN_0, f_NAN_0, is_NaN(f_NAN_0), NAN_1, f_NAN_1, is_NaN(f_NAN_1));

7ff8000000000000 nan 1, 7ff8000000000001 nan 1

so we can use these low order bits to mark where the NaN was created
but I think we get NaN's implicitly and s7_make_real does not check

in non-gmp, 
  (+ most-negative-fixnum -1 most-positive-fixnum) is the same as 
  (+ most-positive-fixnum most-positive-fixnum) -> -2!

apparently in solaris, it's NaN.0 not nan.0?  
    fprintf(stderr, "NaN: %f %e %g\n", NAN, NAN, NAN);
    in every other case this prints "nan nan nan", but on Solaris it's "NaN NaN NaN"

(let ((lst ()))
   (do ((i 0 (+ i 1)))
       ((= i 1000) (reverse lst)) 
     (set! lst (cons i lst))))
;;; ok (tested) up to 10000000 

(set! (*s7* 'print-length) 256)
(let ((st (symbol-table))
      (counts 0)
      (alphs (make-vector 256 0 #t))
      (alph-min (make-vector 256 256 #t))
      (alph-max (make-vector 256 -1 #t)))
  (for-each
   (lambda (sym)
     (let ((name (symbol->string sym)))
       (if (= (length name) 2)
	   (let ((index (char->integer (name 0)))
		 (index2 (char->integer (name 1))))
	     (set! counts (+ counts 1))
	     (set! (alphs index) (+ (alphs index) 1))
	     (set! (alph-min index) (min (alph-min index) index2))
	     (set! (alph-max index) (max (alph-min index) index2))))))
   st)
  (format *stderr* "~A~%"
	  (list counts 
		(let ((in-use 0))
		  (for-each
		   (lambda (c)
		     (if (> c 0)
			 (set! in-use (+ in-use 1))))
		   alphs)
		  in-use)
		(let ((total 0))
		  (do ((i 0 (+ i 1)))
		      ((= i 256))
		    (if (>= (alph-max i) 0)
			(set! total (+ total (+ 1 (- (alph-max i) (alph-min i)))))))
		  total)
		alphs)))

;; this works but has the same results as (let () (load "s7test.scm" (curlet)))
;;  some minor __func__ mis-assumption at 27547
(let ()
  (call-with-input-file "s7test.scm"
     (lambda (p)
       (do ((form (read p) (read p)))
	   ((eq? form #<eof>))
	 (eval form)))))
|#

(when (and full-test (provided? 'snd)) ; repl gets confused here
  (set! *#readers* ())
  (require lint.scm)
  (lint "s7test.scm" #f))

#|
  (for-each
   (lambda (s)
     (if (and (symbol-setter s)
              (not (char=? #\* ((symbol->string s) 0))))
	 (format *stderr* "~A " s)))
   (symbol-table))

  (for-each
   (lambda (s)
     (if (and (procedure? (symbol->value s))
              (let ((p (signature (symbol->value s))))
                (and (pair? p) (pair? (car p)) (memq 'boolean? (car p)))))
	 (format *stderr* "~A " s)))
   (symbol-table))

(for-each
 (lambda (s)
   (if (and (dilambda? (symbol->value s))
	    (defined? (string->symbol (string-append "*" (symbol->string s) "*"))))
       (format *stderr* "~A " s)))
 (symbol-table))

(let ((vars (make-vector 32 0)))
  (for-each
   (lambda (s)
     (let ((len (min (length (symbol->string s)) 31)))
       (set! (vars len) (+ (vars len) 1))))
   (symbol-table))
  (do ((i 0 (+ i 1)))
      ((= i 32))
    (format *stderr* "~D: ~D~%" i (vars i))))

(let ((st (symbol-table)))
  (for-each
   (lambda (s)
     (if (and (keyword? s)
	      (not (eq? s (symbol->value s))))
	 (format *stderr* "~S: ~S~%" s (symbol->value s))))
   st))
|#

(if (provided? 'debugging)
    (format #t "~%;all done! (debugging flag is on)~%")
    (format #t "~%;all done!~%"))

;(close-output-port error-port)

(when (provided? 'profiling)
  (load "profile.scm")
  (show-profile 200))

(s7-version)
(if s7test-exits (exit))